feat: Enhance HR employee synchronization with new button for department cache refresh and user sync functionality

This commit is contained in:
Ling 2025-09-29 18:04:09 +08:00
parent 7d75a72a3a
commit 5e4960c96d
6 changed files with 187 additions and 171 deletions

View File

@ -20,21 +20,26 @@ let extension = {
tableAction: '', //(,)
buttons: { view: [], box: [], detail: [] }, //
methods: {
//
//
onInit() { //
//
// this.buttons.unshift({ //pushsplicebuttons
// name: '', //
// icon: 'el-icon-document', //https://element.eleme.cn/#/zh-CN/component/icon
// type: 'primary', //:https://element-plus.gitee.io/zh-CN/component/button.html
// //color:"#eee",//
// onClick: function () {
// this.$Message.success('');
// }
// });
//
this.buttons.unshift({ //pushsplicebuttons
name: '刷新部门信息缓存', //
icon: 'el-icon-document', //https://element.eleme.cn/#/zh-CN/component/icon
type: 'primary', //:https://element-plus.gitee.io/zh-CN/component/button.html
//color:"#eee",//
onClick: function () {
//
// this.boxOptions.labelWidth = 150;
this.http.post('api/HR_DeptSync/cacheDingTalkDept', {}, '刷新钉钉部门缓存中').then((reslut) => {
this.http.post('api/HR_DeptSync/cacheYSERPDept', {}, '刷新YS部门缓存中').then((reslut) => {
this.$Message.warning('部门信息缓存刷新成功');
});
});
}
});
//
// this.boxOptions.labelWidth = 150;
},
onInited() {
//

View File

@ -4,7 +4,7 @@
** 框架文档 http://v3.volcore.xyz/
*****************************************************************************************/
//js[.vue]
let extension = {
components: {
//
@ -20,27 +20,24 @@ let extension = {
tableAction: '', //(,)
buttons: { view: [], box: [], detail: [] }, //
methods: {
//
//
onInit() { //
//
this.buttons.unshift({ //pushsplicebuttons
name: '立即同步', //
icon: 'el-icon-refresh', //https://element.eleme.cn/#/zh-CN/component/icon
type: 'primary', //:https://element-plus.gitee.io/zh-CN/component/button.html
//color:"#eee",//
onClick: function () {
let url = 'api/HR_EmployeeSync/GenEmpSystemShip';
this.buttons.unshift({
name: '立即同步',
icon: 'el-icon-refresh',
type: 'primary',
onClick: function () {
let url = 'api/HR_EmployeeSync/GenEmpSystemShip';
this.http.post(url, {}, '生成关联关系中').then((reslut) => {
this.$Message.success('生成完成,请点击查询进行刷新');
this.search();
});
// proxy.http.post(url, {}, '').then((reslut) => {});
}
this.http.post(url, {}, '生成关联关系中').then((reslut) => {
this.$Message.success('生成完成,请点击查询进行刷新');
this.search();
});
// proxy.http.post(url, {}, '').then((reslut) => {});
}
});
//
// this.boxOptions.labelWidth = 150;
},
onInited() {
//
@ -78,4 +75,8 @@ let extension = {
}
}
};
export default extension;
function saveClick(row) {
}
export default extension;

View File

@ -25,7 +25,7 @@ export default function(){
{field:'YSDeptName',title:'YS部门名称',type:'string',width:60,hidden:true,readonly:true,align:'left'},
{field:'DingTalkDeptId',title:'钉钉部门',type:'string',bind:{ key:'Q002',data:[]},width:60,align:'left'},
{field:'DingTalkDeptName',title:'钉钉部门名称',type:'string',width:60,hidden:true,readonly:true,align:'left'},
{field:'IsRoot',title:'根节点',type:'bool',width:120,align:'left'}];
{field:'IsRoot',title:'根节点',type:'bool',width:120,hidden:true,align:'left'}];
const detail ={columns:[]};
const details = [];

View File

@ -5,79 +5,104 @@
*新版本支持vue或.jsx]文件编写业务,文档见:https://v3.volcore.xyz/docs/view-gridhttps://v3.volcore.xyz/docs/web
-->
<template>
<view-grid ref="grid"
:columns="columns"
:detail="detail"
:details="details"
:editFormFields="editFormFields"
:editFormOptions="editFormOptions"
:searchFormFields="searchFormFields"
:searchFormOptions="searchFormOptions"
:table="table"
:extend="extend"
:onInit="onInit"
:onInited="onInited"
:searchBefore="searchBefore"
:searchAfter="searchAfter"
:addBefore="addBefore"
:updateBefore="updateBefore"
:rowClick="rowClick"
:modelOpenBefore="modelOpenBefore"
:modelOpenAfter="modelOpenAfter">
<view-grid ref="grid" :columns="columns" :detail="detail" :details="details" :editFormFields="editFormFields"
:editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
:table="table" :extend="extend" :onInit="onInit" :onInited="onInited" :searchBefore="searchBefore"
:searchAfter="searchAfter" :addBefore="addBefore" :updateBefore="updateBefore" :rowClick="rowClick"
:modelOpenBefore="modelOpenBefore" :modelOpenAfter="modelOpenAfter">
<!-- 自定义组件数据槽扩展更多数据槽slot见文档 -->
<template #gridHeader>
</template>
</view-grid>
</template>
<script setup lang="jsx">
import extend from "@/extension/hr/employeesync/HR_EmployeeSync.jsx";
import viewOptions from './HR_EmployeeSync/options.js'
import { ref, reactive, getCurrentInstance, watch, onMounted } from "vue";
const grid = ref(null);
const { proxy } = getCurrentInstance()
//httpproxy.http.post/get
const { table, editFormFields, editFormOptions, searchFormFields, searchFormOptions, columns, detail, details } = reactive(viewOptions())
import extend from "@/extension/hr/employeesync/HR_EmployeeSync.jsx";
import viewOptions from './HR_EmployeeSync/options.js'
import { ref, reactive, getCurrentInstance, watch, onMounted } from "vue";
const grid = ref(null);
const { proxy } = getCurrentInstance()
//httpproxy.http.post/get
const { table, editFormFields, editFormOptions, searchFormFields, searchFormOptions, columns, detail, details } = reactive(viewOptions())
let gridRef;//[.jsx]this.使
//
const onInit = async ($vm) => {
gridRef = $vm;
//jsxthis.xx使this.xxgridRef.xx
//https://v3.volcore.xyz/docs/view-grid
}
//,
const onInited = async () => {
}
const searchBefore = async (param) => {
//,param.wheres
//false
return true;
}
const searchAfter = async (rows, result) => {
return true;
}
const addBefore = async (formData) => {
//formDataformData
return true;
}
const updateBefore = async (formData) => {
//formDataId
return true;
}
const rowClick = ({ row, column, event }) => {
//
// grid.value.toggleRowSelection(row); //;
}
const modelOpenBefore = async (row) => {//
return true;//false
}
const modelOpenAfter = (row) => {
//,,
}
//
//watch(() => editFormFields.,(newValue, oldValue) => { })
//
defineExpose({})
let gridRef;
//
const syncThis = async (row) => {
proxy.$confirm('是否同步该用户?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
//
const res = await proxy.http.post('api/HR_EmployeeSync/SyncYSEmpToDingTalk', row.EmpYSID,'正在同步信息...');
if (res.success) {
proxy.$message({
type: 'success',
message: '同步成功!'
});
gridRef.load();
} else {
proxy.$message({
type: 'error',
message: res.message
});
}
}).catch(() => {
//
});
}
const onInit = async ($vm) => {
gridRef = $vm;
//
columns.push({
title: '操作', //
field: '操作',
align: 'center',
width: 70,
fixed: 'right',
render: (h, { row, column, index }) => {
return (
<div>
<el-button
onClick={($e) => { syncThis(row) }}
type="primary" link>同步这个用户</el-button>
</div>
);
}
});
}
//,
const onInited = async () => {
}
const searchBefore = async (param) => {
//,param.wheres
//false
return true;
}
const searchAfter = async (rows, result) => {
return true;
}
const addBefore = async (formData) => {
//formDataformData
return true;
}
const updateBefore = async (formData) => {
//formDataId
return true;
}
const rowClick = ({ row, column, event }) => {
//
// grid.value.toggleRowSelection(row); //;
}
const modelOpenBefore = async (row) => {//
return true;//false
}
const modelOpenAfter = (row) => {
//,,
}
//
//watch(() => editFormFields.,(newValue, oldValue) => { })
//
defineExpose({})
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>

View File

@ -29,7 +29,7 @@ export default function(){
{field:'EmpJobNumber',title:'员工工号',type:'string',link:true,width:60,readonly:true,align:'left',sort:true},
{field:'EmpYSID',title:'员工YSID',type:'string',width:60,readonly:true,align:'left'},
{field:'EmpDingDingID',title:'员工钉钉ID',type:'string',width:60,readonly:true,align:'left'},
{field:'EmpYSMobile',title:'员工YS手机号',type:'string',width:60,readonly:true,align:'left'},
{field:'EmpYSMobile',title:'员工YS手机号',type:'string',sort:true,width:60,readonly:true,align:'left'},
{field:'EmpDingDingMobile',title:'员工钉钉手机号',type:'string',width:60,readonly:true,align:'left'},
{field:'EmpYSDeptID',title:'员工YS所属部门',type:'string',bind:{ key:'Q001',data:[]},width:60,readonly:true,align:'left'},
{field:'EmpLastSyncInfo',title:'最后一次同步记录',type:'string',width:60,readonly:true,align:'left'},

View File

@ -5,81 +5,66 @@
*新版本支持vue或.jsx]文件编写业务,文档见:https://v3.volcore.xyz/docs/view-gridhttps://v3.volcore.xyz/docs/web
-->
<template>
<view-grid ref="grid"
:columns="columns"
:detail="detail"
:details="details"
:editFormFields="editFormFields"
:editFormOptions="editFormOptions"
:searchFormFields="searchFormFields"
:searchFormOptions="searchFormOptions"
:table="table"
:extend="extend"
:onInit="onInit"
:onInited="onInited"
:searchBefore="searchBefore"
:searchAfter="searchAfter"
:addBefore="addBefore"
:updateBefore="updateBefore"
:rowClick="rowClick"
:modelOpenBefore="modelOpenBefore"
:modelOpenAfter="modelOpenAfter">
<view-grid ref="grid" :columns="columns" :detail="detail" :details="details" :editFormFields="editFormFields"
:editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
:table="table" :extend="extend" :onInit="onInit" :onInited="onInited" :searchBefore="searchBefore"
:searchAfter="searchAfter" :addBefore="addBefore" :updateBefore="updateBefore" :rowClick="rowClick"
:modelOpenBefore="modelOpenBefore" :modelOpenAfter="modelOpenAfter">
<!-- 自定义组件数据槽扩展更多数据槽slot见文档 -->
<template #gridHeader>
</template>
</view-grid>
</template>
<script setup lang="jsx">
import extend from "@/extension/hr/ysemployees/HR_YSEmployees.jsx";
import viewOptions from './HR_YSEmployees/options.js'
import { ref, reactive, getCurrentInstance, watch, onMounted } from "vue";
const grid = ref(null);
const { proxy } = getCurrentInstance()
//httpproxy.http.post/get
const { table, editFormFields, editFormOptions, searchFormFields, searchFormOptions, columns, detail, details } = reactive(viewOptions())
import extend from "@/extension/hr/ysemployees/HR_YSEmployees.jsx";
import viewOptions from './HR_YSEmployees/options.js'
import { ref, reactive, getCurrentInstance, watch, onMounted } from "vue";
const grid = ref(null);
const { proxy } = getCurrentInstance()
//httpproxy.http.post/get
const { table, editFormFields, editFormOptions, searchFormFields, searchFormOptions, columns, detail, details } = reactive(viewOptions())
let gridRef;//[.jsx]this.使
//
const onInit = async ($vm) => {
gridRef = $vm;
let gridRef;
gridRef.paginationHide=true;
//jsxthis.xx使this.xxgridRef.xx
//https://v3.volcore.xyz/docs/view-grid
}
//,
const onInited = async () => {
}
const searchBefore = async (param) => {
//,param.wheres
//false
return true;
}
const searchAfter = async (rows, result) => {
return true;
}
const addBefore = async (formData) => {
//formDataformData
return true;
}
const updateBefore = async (formData) => {
//formDataId
return true;
}
const rowClick = ({ row, column, event }) => {
//
// grid.value.toggleRowSelection(row); //;
}
const modelOpenBefore = async (row) => {//
return true;//false
}
const modelOpenAfter = (row) => {
//,,
}
//
//watch(() => editFormFields.,(newValue, oldValue) => { })
//
defineExpose({})
const onInit = async ($vm) => {
gridRef = $vm;
gridRef.paginationHide = true;
}
//,
const onInited = async () => {
}
const searchBefore = async (param) => {
//,param.wheres
//false
return true;
}
const searchAfter = async (rows, result) => {
return true;
}
const addBefore = async (formData) => {
//formDataformData
return true;
}
const updateBefore = async (formData) => {
//formDataId
return true;
}
const rowClick = ({ row, column, event }) => {
//
// grid.value.toggleRowSelection(row); //;
}
const modelOpenBefore = async (row) => {//
return true;//false
}
const modelOpenAfter = (row) => {
//,,
}
//
//watch(() => editFormFields.,(newValue, oldValue) => { })
//
defineExpose({})
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>