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

View File

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

View File

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