diff --git a/src/api/eam/basic/rel/index.ts b/src/api/eam/basic/rel/index.ts index 423311d..25f2620 100644 --- a/src/api/eam/basic/rel/index.ts +++ b/src/api/eam/basic/rel/index.ts @@ -44,3 +44,8 @@ export const exportDeviceItem = async (params) => { return await request.download({ url: `/rel/device-item/export-excel`, params }) } +// 新增设备备件关系 +// 新增设备备件关系 +export const createDeviceItemBatch = async (data: Array) => { + return await request.post({url: `/rel/device-item/createBatch`, data }); +}; diff --git a/src/api/eam/device/deviceAccounts/index.ts b/src/api/eam/device/deviceAccounts/index.ts index 121b946..ed79b44 100644 --- a/src/api/eam/device/deviceAccounts/index.ts +++ b/src/api/eam/device/deviceAccounts/index.ts @@ -56,4 +56,10 @@ export const exportDeviceAccounts = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/device-accounts/get-import-template' }) +} + + +// 查询设备台账列表 +export const getDeviceAccountsNoPage = async (params) => { + return await request.get({ url: `/eam/device-accounts/selectData`, params }) } \ No newline at end of file diff --git a/src/api/eam/device/deviceRepair/index.ts b/src/api/eam/device/deviceRepair/index.ts index 904e00f..c890748 100644 --- a/src/api/eam/device/deviceRepair/index.ts +++ b/src/api/eam/device/deviceRepair/index.ts @@ -1,6 +1,7 @@ import request from '@/config/axios' export interface DeviceRepairVO { + id: number number: string describe: string deviceNumber: string @@ -53,4 +54,9 @@ export const exportDeviceRepair = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/device-repair/get-import-template' }) +} + +// 撤销申请 +export const rejected = (id: Number) => { + return request.delete({ url: '/eam/device-repair/rejected?id=' + id }) } \ No newline at end of file diff --git a/src/api/system/dept/index.ts b/src/api/system/dept/index.ts index d995f13..dac8432 100644 --- a/src/api/system/dept/index.ts +++ b/src/api/system/dept/index.ts @@ -41,3 +41,9 @@ export const updateDept = async (params: DeptVO) => { export const deleteDept = async (id: number) => { return await request.delete({ url: '/system/dept/delete?id=' + id }) } + + +// 查询厂区列表 +export const selectAllFactoryArea = async () => { + return await request.get({ url: '/system/dept/selectAllFactoryArea'}) +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 62c18db..7c51e9c 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -276,8 +276,10 @@ export enum DICT_TYPE { DEVICEMOLDITEMS_STATUS = 'devicemolditems_status', // 项类型 DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型 TRANSACTION_TYPE = 'transaction_Type', // 事务类型 - RESULT = 'result', // 事务类型 + RESULT = 'result', // 维修结果 REQUEST_APPLY = 'class_type', // 班组类型 - + FAULT_TYPE = 'fault_type',//故障类型 + WEI_XIU_ORDER_STATUS = 'wei_xiu_order_status',//维修单状态 + BASIC_STATUS = 'basic_status',//设备模具状态 } diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index 22040a3..7073e9d 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -774,6 +774,20 @@ export function selectItemBtn(option:any) { hasPermi: '' }) } + +// 主列表-撤销 +export function backoutBtn(option:any) { + return __defaultBtnOption(option,{ + label: '撤销', + name: 'backout', + hide: false, + type: 'danger', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 默认按钮规则 function __defaultBtnOption(option:any,specific:any){ return { diff --git a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts index 327c77d..b097328 100644 --- a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts +++ b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts @@ -17,7 +17,7 @@ export const FixedAssets = useCrudSchemas(reactive([ label: '编号唯一标识', field: 'number', sort: 'custom', - isSearch: true, + isSearch: false, }, { label: '资产名称', @@ -29,7 +29,7 @@ export const FixedAssets = useCrudSchemas(reactive([ label: '会计单位', field: 'accountingUnit', sort: 'custom', - isSearch: true, + isSearch: false, }, { label: '规格型号', @@ -114,26 +114,16 @@ export const FixedAssets = useCrudSchemas(reactive([ }, isForm: false, }, - { - label: '地点ID', - field: 'siteId', - sort: 'custom', - }, + { label: '是否可用', field: 'available', sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', isSearch: true, }, - { - label: '并发乐观锁', - field: 'concurrencyStamp', - sort: 'custom', - form: { - component: 'InputNumber', - value: 0 - }, - }, + { label: '操作', field: 'action', diff --git a/src/views/eam/basic/fixedAssets/index.vue b/src/views/eam/basic/fixedAssets/index.vue index 9777979..5893951 100644 --- a/src/views/eam/basic/fixedAssets/index.vue +++ b/src/views/eam/basic/fixedAssets/index.vue @@ -60,7 +60,7 @@ diff --git a/src/views/eam/device/deviceRepair/deviceRepair.data.ts b/src/views/eam/device/deviceRepair/deviceRepair.data.ts index 93a7a43..88c8953 100644 --- a/src/views/eam/device/deviceRepair/deviceRepair.data.ts +++ b/src/views/eam/device/deviceRepair/deviceRepair.data.ts @@ -1,5 +1,10 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' +import { selectAllFactoryArea } from '@/api/system/dept' +import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' +// 邮箱账号的列表 +const factoryList = await selectAllFactoryArea() +const deviceList = ref([]); // 表单校验 export const DeviceRepairRules = reactive({ @@ -11,86 +16,134 @@ export const DeviceRepairRules = reactive({ type: [required], available: [required], concurrencyStamp: [required], + // result: [required], }) export const DeviceRepair = useCrudSchemas(reactive([ { - label: '编号唯一标识', - field: 'number', - sort: 'custom', - isSearch: true, - }, - { - label: '描述', - field: 'describe', + label: 'id', + field: 'id', sort: 'custom', + isSearch: false, + isForm: false, + isTable: false }, { - label: '设备模具编号', - field: 'deviceNumber', + label: '编号唯一标识', + field: 'number', sort: 'custom', isSearch: true, + isForm: false }, { - label: '厂区编号', + 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', + api: () => factoryList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'id' + }, + onChange: (e) => { + DeviceAccountsApi.getDeviceAccountsPage({ + isSearch: false, + factoryAreaNumber: e + }).then((res) => { + deviceList.value = res?.list + }).catch((e) => { + console.log(e) + }) + } + }, + } }, { - label: '报修人', - field: 'declarer', + label: '设备', + field: 'deviceNumber', sort: 'custom', + isSearch: true, form: { - component: 'InputNumber', - value: 0 - }, + component: 'Select', + componentProps: { + options:deviceList, + optionsAlias: { + labelField: 'name', + valueField: 'number' + }, + }, + } }, { - label: '报修人联系电话', + label: '报修人电话', field: 'declarerPhone', sort: 'custom', }, { - label: '故障类型枚举EM、CM、 PM', + label: '故障类型', field: 'faultType', sort: 'custom', - form: { - component: 'Select' - }, - }, - { - label: '类型', - field: 'type', - sort: 'custom', - isSearch: true, - form: { - component: 'Select' - }, - }, - { - label: '创建时间', - field: 'createTime', - sort: 'custom', - formatter: dateFormatter, - isForm: false, + dictType: DICT_TYPE.FAULT_TYPE, + dictClass: 'string', + form: { + component: 'Select' + }, }, { - label: '地点ID', - field: 'siteId', + label: '描述', + field: 'describe', sort: 'custom', + form: { + component: 'Input', + componentProps: { + type: 'textarea', + } + + }, }, { label: '是否可用', field: 'available', sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, }, { - label: '并发乐观锁', - field: 'concurrencyStamp', + label: '维修状态', + field: 'result', sort: 'custom', + dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS, + dictClass: 'string', + isSearch: true, + isForm: false, form: { - component: 'InputNumber', - value: 0 + component: 'Select', }, }, { diff --git a/src/views/eam/device/deviceRepair/index.vue b/src/views/eam/device/deviceRepair/index.vue index 44619f9..5306470 100644 --- a/src/views/eam/device/deviceRepair/index.vue +++ b/src/views/eam/device/deviceRepair/index.vue @@ -33,7 +33,7 @@ @@ -62,6 +62,8 @@ import download from '@/utils/download' import { DeviceRepair,DeviceRepairRules } from './deviceRepair.data' import * as DeviceRepairApi from '@/api/eam/device/deviceRepair' import * as defaultButtons from '@/utils/disposition/defaultButtons' +import { selectAllFactoryArea } from '@/api/system/dept' +import { getRowIdentity } from 'element-plus/es/components/table/src/util' // import TableHead from '@/components/TableHead/src/TableHead.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue' // import Detail from '@/components/Detail/src/Detail.vue' @@ -73,6 +75,7 @@ const { t } = useI18n() // 国际化 const route = useRoute() // 路由信息 const routeName = ref() +const factoryAreaList = ref([]) routeName.value = route.name const tableColumns = ref(DeviceRepair.allSchemas.tableColumns) @@ -99,9 +102,12 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'eam:deviceRepair:create'}), // 新增 - defaultButtons.defaultImportBtn({hasPermi:'eam:deviceRepair:import'}), // 导入 - defaultButtons.defaultExportBtn({hasPermi:'eam:deviceRepair:export'}), // 导出 + // defaultButtons.defaultAddBtn({hasPermi:'eam:deviceRepair:create'}), // 新增 + // defaultButtons.defaultImportBtn({hasPermi:'eam:deviceRepair:import'}), // 导入 + // defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceRepair:export' }), // 导出 + defaultButtons.defaultAddBtn(null), // 新增 + // defaultButtons.defaultImportBtn(null), // 导入 + // defaultButtons.defaultExportBtn(null), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 @@ -132,10 +138,13 @@ const buttonBaseClick = (val, item) => { } // 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceRepair:delete'}), // 删除 -] +const butttondata = (row) => { + return [ + // defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), // 编辑 + // defaultButtons.mainListDeleteBtn({ hasPermi: 'eam:deviceRepair:delete' }), // 删除 + defaultButtons.backoutBtn({ hide: row.result != 'PENDING' }), // 撤销 + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -143,6 +152,8 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + } else if (val == 'backout') { //撤销 + handleBackout(row) } } @@ -164,7 +175,9 @@ const formsSuccess = async (formType,data) => { } } if(data.activeTime==0)data.activeTime = null; - if(data.expireTime==0)data.expireTime = null; + if (data.expireTime == 0) data.expireTime = null; + data.type = 'DEVICE'; + data.result = 'PENDING'; if (formType === 'create') { await DeviceRepairApi.createDeviceRepair(data) message.success(t('common.createSuccess')) @@ -235,6 +248,23 @@ const searchFormClick = (searchData) => { getList() // 刷新当前列表 } +// function getAllFactoryAreaList() { +// selectAllFactoryArea().then(res => { +// factoryAreaList.value = res.data +// }) +// } + +function handleBackout(row) { + if (row.result != 'PENDING') { + message.error('该报修单正在处理中,不能撤销!') + } + DeviceRepairApi.rejected(row.id).then(res => { + console.log("撤销成功!") + getList() // 刷新当前列表 + }) + +} + /** 初始化 **/ onMounted(async () => { getList()