|
@ -142,12 +142,20 @@ const { tableObject, tableMethods } = useTable({ |
|
|
// 获得表格的各种操作 |
|
|
// 获得表格的各种操作 |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
|
|
|
|
const judgeHasAddFunc = () => { |
|
|
|
|
|
const rolesOk = userStore.roles.find(item => { |
|
|
|
|
|
return item == 'device_class_worker_role' || item == 'device_class_Engineer_role' || item == 'tech_class_worker_role' || item == 'tech_class_Engineer_role' |
|
|
|
|
|
}) |
|
|
|
|
|
if (rolesOk != undefined && rolesOk != null && rolesOk.length > 0) { |
|
|
|
|
|
return true |
|
|
|
|
|
} else { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
|
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), // 新增 |
|
|
defaultButtons.defaultAddBtn({ hide: !(judgeHasAddFunc()) }), // 新增 |
|
|
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), // 导入 |
|
|
|
|
|
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceInspectionMain:export' }), // 导出 |
|
|
|
|
|
defaultButtons.defaultAddBtn({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') || userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), // 新增 |
|
|
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
@ -189,7 +197,7 @@ const butttondata = (row) => { |
|
|
return [ |
|
|
return [ |
|
|
// defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), // 编辑 |
|
|
// defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), // 编辑 |
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), // 删除 |
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), // 删除 |
|
|
defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED')}), // 编辑 |
|
|
defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED' && isReceiver(row.maintenance))}), // 编辑 |
|
|
defaultButtons.mainInspectionOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //检修 |
|
|
defaultButtons.mainInspectionOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //检修 |
|
|
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //完成 |
|
|
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //完成 |
|
|
] |
|
|
] |
|
@ -530,19 +538,19 @@ const openFormCallBack = (type, row, masterParmas, callback) => { |
|
|
|
|
|
|
|
|
function buttonControllFunction(row, val) { |
|
|
function buttonControllFunction(row, val) { |
|
|
if (val == 'delete') { |
|
|
if (val == 'delete') { |
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' ) { |
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' || !isReceiver(row.maintenance)) { |
|
|
return false |
|
|
return false |
|
|
} else { |
|
|
} else { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
} else if (val == 'edit') { |
|
|
} else if (val == 'edit') { |
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' ) { |
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' || !isReceiver(row.maintenance)) { |
|
|
return false |
|
|
return false |
|
|
} else { |
|
|
} else { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
} else if(val == 'add') { |
|
|
} else if(val == 'add') { |
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED') { |
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' || !isReceiver(row.maintenance)) { |
|
|
return false |
|
|
return false |
|
|
} else { |
|
|
} else { |
|
|
return true |
|
|
return true |
|
@ -552,6 +560,14 @@ function buttonControllFunction(row, val) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function isReceiver(orderPerson) { |
|
|
|
|
|
if (orderPerson == userStore?.getUser?.id) { |
|
|
|
|
|
return true |
|
|
|
|
|
} else { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
/** 初始化 **/ |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|