diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index 7073e9d..0293b0e 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -788,6 +788,58 @@ export function backoutBtn(option:any) { }) } +// 主列表-接单 +export function acceptOrderBtn(option:any) { + return __defaultBtnOption(option,{ + label: '接单', + name: 'acceptorder', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + +// 主列表-转办 +export function turnOrderBtn(option:any) { + return __defaultBtnOption(option,{ + label: '转办', + name: 'turnorder', + hide: false, + type: 'warning', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + +// 主列表-完成 +export function finishOrderBtn(option:any) { + return __defaultBtnOption(option,{ + label: '完成', + name: 'finishorder', + hide: false, + type: 'success', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + +// 主列表-验证 +export function verifyOrderBtn(option:any) { + return __defaultBtnOption(option,{ + label: '验证', + name: 'verifyorder', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 默认按钮规则 function __defaultBtnOption(option:any,specific:any){ return { diff --git a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts index 64b0101..f00de59 100644 --- a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts +++ b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts @@ -61,8 +61,11 @@ export const DeviceAccounts = useCrudSchemas(reactive([ }, { label: '采购部门', - field: 'deptId', + field: 'purchaseDept', sort: 'custom', + isSearch: false, + isForm: true, + isTable: true, form: { component: 'Input', } @@ -121,6 +124,7 @@ export const DeviceAccounts = useCrudSchemas(reactive([ dictType: DICT_TYPE.BASIC_STATUS, dictClass: 'string', isSearch: true, + isForm: false, }, { diff --git a/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts b/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts index da5a3e0..350d9c3 100644 --- a/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts +++ b/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts @@ -1,5 +1,11 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { selectAllFactoryArea } from '@/api/system/dept' +import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import { dateFormatter } from '@/utils/formatTime' +const factoryList = await selectAllFactoryArea() +const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) +const showFactory = ref(false); +const factoryValue = ref(null); // 表单校验 export const DeviceMaintenanceMainRules = reactive({ @@ -20,34 +26,91 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ field: 'number', sort: 'custom', isSearch: true, + isForm: false, }, { label: '报修工单申请号', field: 'requestNumber', sort: 'custom', + isForm: false, + isSearch: true, + isTable: true, }, - { - label: '描述', - field: 'describe', - sort: 'custom', - }, + { label: '设备模具编号', field: 'deviceNumber', sort: 'custom', + api: () => deviceList, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return factoryList.find((account) => account.number == cellValue)?.name + }, + search: { + show: true, + component: 'Select', + api: () => deviceList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'number' + } + } + }, + form: { + component: 'Select', + api: () => deviceList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'number' + }, + onChange: (val) => { + factoryValue.value = Number(deviceList.find((account) => account.number == val)?.factoryAreaNumber) + showFactory.value = true + console.log('factoryValue.value',factoryValue.value) + console.log('showFactory.value',showFactory.value) + } + }, + } }, { label: '厂区编号', field: 'factoryAreaNumber', sort: 'custom', + api: () => factoryList, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return factoryList.find((account) => account.id == cellValue)?.name + }, + search: { + show: true, + component: 'Select', + api: () => factoryList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'id' + } + } + }, + form: { + component: 'Select', + show: showFactory.value, + value: factoryValue.value, + api: () => factoryList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'id' + }, + }, + } }, { label: '维修人', field: 'maintenance', sort: 'custom', form: { - component: 'InputNumber', - value: 0 + component: 'Input', }, }, { @@ -60,8 +123,11 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ field: 'status', sort: 'custom', isSearch: true, + isForm: false, + dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS, + dictClass: 'string', form: { - component: 'Radio' + component: 'Select' }, }, { @@ -69,34 +135,41 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ field: 'type', sort: 'custom', isSearch: true, - form: { - component: 'Select' - }, - }, - { - label: '创建时间', - field: 'createTime', - sort: 'custom', - formatter: dateFormatter, - isForm: false, + dictType: DICT_TYPE.DEVICE_MOLD_TYPE, + dictClass: 'string', + form: { + component: 'Select' + }, }, { - label: '地点ID', - field: 'siteId', + label: '描述', + field: 'describe', sort: 'custom', + form: { + component: 'Input', + componentProps: { + type: 'textarea', + } + }, }, + // { + // label: '地点ID', + // field: 'siteId', + // sort: 'custom', + // }, { label: '是否可用', field: 'available', sort: 'custom', - }, - { - label: '并发乐观锁', - field: 'concurrencyStamp', - sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', form: { - component: 'InputNumber', - value: 0 + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } }, }, { @@ -104,7 +177,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ field: 'action', isForm: false, table: { - width: 150, + width: 300, fixed: 'right' } } diff --git a/src/views/eam/device/deviceMaintenanceMain/index.vue b/src/views/eam/device/deviceMaintenanceMain/index.vue index 6b31a56..80f85a4 100644 --- a/src/views/eam/device/deviceMaintenanceMain/index.vue +++ b/src/views/eam/device/deviceMaintenanceMain/index.vue @@ -33,7 +33,7 @@ @@ -62,12 +62,13 @@ import download from '@/utils/download' import { DeviceMaintenanceMain,DeviceMaintenanceMainRules } from './deviceMaintenanceMain.data' 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() // 国际化 @@ -99,9 +100,10 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintenanceMain:create'}), // 新增 - defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintenanceMain:import'}), // 导入 - defaultButtons.defaultExportBtn({hasPermi:'eam:deviceMaintenanceMain:export'}), // 导出 + // defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintenanceMain:create'}), // 新增 + // defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintenanceMain:import'}), // 导入 + // defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceMaintenanceMain:export' }), // 导出 + defaultButtons.defaultAddBtn(null), // 新增 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 @@ -132,10 +134,19 @@ const buttonBaseClick = (val, item) => { } // 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMaintenanceMain:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMaintenanceMain:delete'}), // 删除 -] +const butttondata = (row) => { + return [ + // defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMaintenanceMain:update'}), // 编辑 + // 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')}), // 验证 + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { diff --git a/src/views/eam/device/deviceRepair/deviceRepair.data.ts b/src/views/eam/device/deviceRepair/deviceRepair.data.ts index 88c8953..9848a67 100644 --- a/src/views/eam/device/deviceRepair/deviceRepair.data.ts +++ b/src/views/eam/device/deviceRepair/deviceRepair.data.ts @@ -39,7 +39,6 @@ export const DeviceRepair = useCrudSchemas(reactive([ label: '厂区', field: 'factoryAreaNumber', sort: 'custom', - api: () => factoryList, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { return factoryList.find((account) => account.id == cellValue)?.name