|
|
@ -64,20 +64,20 @@ import { DeviceMaintenanceMain,DeviceMaintenanceMainRules } from './deviceMainte |
|
|
|
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
|
|
|
|
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
// import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
defineOptions({ name: 'DeviceMaintenanceMain' }) |
|
|
|
const userStore = useUserStore() |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const userStore = useUserStore() // 用户信息 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
const basicFormRef = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(DeviceMaintenanceMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
@ -104,7 +104,7 @@ const HeadButttondata = [ |
|
|
|
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintenanceMain:create'}), // 新增 |
|
|
|
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintenanceMain:import'}), // 导入 |
|
|
|
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceMaintenanceMain:export' }), // 导出 |
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
defaultButtons.defaultAddBtn({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) }), // 新增 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
@ -121,6 +121,10 @@ const HeadButttondata = [ |
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[3].componentProps.disabled = true; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[3].value = 'DEVICE'; |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
handleImport() |
|
|
@ -141,33 +145,47 @@ const butttondata = (row) => { |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMaintenanceMain:delete'}), // 删除 |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
|
// defaultButtons.backoutBtn(null), // 撤销 |
|
|
|
defaultButtons.acceptOrderBtn({ hide: !(row.status == 'PENDING') }), // 接单 |
|
|
|
defaultButtons.turnOrderBtn({ hide: !(row.status == 'PECEIVED') }), // 转办 |
|
|
|
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)}), // 完成 |
|
|
|
defaultButtons.verifyOrderBtn({ hide: !(row.status == 'COMPLETED')}), // 验证 |
|
|
|
// defaultButtons.backoutBtn(null), // 撤销吗,,,, |
|
|
|
defaultButtons.acceptOrderBtn({ hide: !(row.status == 'PENDING' && userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker'))}), // 接单 |
|
|
|
defaultButtons.turnOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), // 转办 |
|
|
|
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)}), // 完成 |
|
|
|
defaultButtons.verifyOrderBtn({ hide: !(row.status == 'COMPLETED' && userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), // 验证 |
|
|
|
defaultButtons.repairBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), // 维修 |
|
|
|
defaultButtons.mainListDetailBtn(null), // 查看详情 |
|
|
|
] |
|
|
|
} |
|
|
|
const onChange = (field, cur) => { |
|
|
|
const onChange = (field, cur, item) => { |
|
|
|
// 当有效天数 和 生效时间 发生变化 |
|
|
|
console.log(field) |
|
|
|
console.log(cur) |
|
|
|
if(field == 'deviceNumber'){ |
|
|
|
// DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true |
|
|
|
basicFormRef.value.formRef.formModel.factoryAreaNumber=119 |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true; |
|
|
|
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(item => item.number == cur).factoryAreaNumber) |
|
|
|
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id) |
|
|
|
} |
|
|
|
} |
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
openForm('update', row) |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true; |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} else if (val == 'acceptOrder') { |
|
|
|
acceptOrder(row) |
|
|
|
} else if (val == 'turnOrder') { |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[3].componentProps.disabled = false; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = false; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true; |
|
|
|
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true; |
|
|
|
debugger |
|
|
|
openForm('turnOrder', row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
|
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
@ -186,8 +204,13 @@ const formsSuccess = async (formType,data) => { |
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
if (formType === 'create') { |
|
|
|
|
|
|
|
data.status = 'PECEIVED' |
|
|
|
await DeviceMaintenanceMainApi.createDeviceMaintenanceMain(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else if (formType === 'turnOrder') { |
|
|
|
await DeviceMaintenanceMainApi.orderTurnTo(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} else { |
|
|
|
await DeviceMaintenanceMainApi.updateDeviceMaintenanceMain(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
@ -255,6 +278,32 @@ const searchFormClick = (searchData) => { |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
|
|
|
|
// 接单 |
|
|
|
function acceptOrder(row) { |
|
|
|
DeviceMaintenanceMainApi.orderStepChange(row); |
|
|
|
} |
|
|
|
// 转办 |
|
|
|
function turnOrder() { |
|
|
|
|
|
|
|
} |
|
|
|
// 完成 |
|
|
|
function finishOrder() { |
|
|
|
|
|
|
|
} |
|
|
|
// 验证 |
|
|
|
function verifyOrder() { |
|
|
|
|
|
|
|
} |
|
|
|
// 维修 |
|
|
|
function repair() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 详情 |
|
|
|
function mainListDetail() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|