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

@ -23,15 +23,20 @@ let extension = {
//
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.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;

View File

@ -22,12 +22,10 @@ let extension = {
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",//
this.buttons.unshift({
name: '立即同步',
icon: 'el-icon-refresh',
type: 'primary',
onClick: function () {
let url = 'api/HR_EmployeeSync/GenEmpSystemShip';
@ -39,8 +37,7 @@ let extension = {
}
});
//
// this.boxOptions.labelWidth = 150;
},
onInited() {
//
@ -78,4 +75,8 @@ let 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,25 +5,11 @@
*新版本支持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>
@ -38,12 +24,52 @@
//httpproxy.http.post/get
const { table, editFormFields, editFormOptions, searchFormFields, searchFormOptions, columns, detail, details } = reactive(viewOptions())
let gridRef;//[.jsx]this.使
//
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;
//jsxthis.xx使this.xxgridRef.xx
//https://v3.volcore.xyz/docs/view-grid
//
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 () => {
@ -79,5 +105,4 @@
//
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,25 +5,11 @@
*新版本支持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>
@ -38,14 +24,14 @@
//httpproxy.http.post/get
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
//https://v3.volcore.xyz/docs/view-grid
}
//,
const onInited = async () => {
@ -81,5 +67,4 @@
//
defineExpose({})
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>