diff --git a/src/api/eam/item/itemApplyMain/index.ts b/src/api/eam/item/itemApplyMain/index.ts index fd0e19e..af82f15 100644 --- a/src/api/eam/item/itemApplyMain/index.ts +++ b/src/api/eam/item/itemApplyMain/index.ts @@ -46,6 +46,12 @@ export const deleteItemApplyMain = async (id: number) => { return await request.delete({ url: `/eam/item-apply-main/delete?id=` + id }) } +// 撤销备件申领记录主 +export const backoutItemApplyMain = async (id: number) => { + return await request.get({ url: `/eam/item-apply-main/backout?id=` + id }) +} + + // 导出备件申领记录主 Excel export const exportItemApplyMain = async (params) => { return await request.download({ url: `/eam/item-apply-main/export-excel`, params }) @@ -54,4 +60,4 @@ export const exportItemApplyMain = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/item-apply-main/get-import-template' }) -} \ No newline at end of file +} diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index d387ee0..e8fc2d0 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -801,6 +801,19 @@ export function backoutBtn(option:any) { }) } +// 主列表-撤销 +export function approveBtn(option:any) { + return __defaultBtnOption(option,{ + label: '审批', + name: 'approve', + hide: false, + type: 'danger', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 主列表-接单 export function acceptOrderBtn(option:any) { return __defaultBtnOption(option,{ diff --git a/src/views/eam/item/applicationRecord/applicationRecordMain.data.ts b/src/views/eam/item/applicationRecord/applicationRecordMain.data.ts index 77ded41..c83aa89 100644 --- a/src/views/eam/item/applicationRecord/applicationRecordMain.data.ts +++ b/src/views/eam/item/applicationRecord/applicationRecordMain.data.ts @@ -1,7 +1,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' -import { Item } from '@/views/eam/basic/item/item.data' -import * as ItemApi from '@/api/eam/basic/item' +import { ItemAccounts } from '@/views/eam/item/itemAccounts/itemAccounts.data' +import * as ItemAccountsApi from '@/api/eam/item/itemAccounts' +import * as DeviceMoldItemsApi from '@/api/eam/basic/deviceMaintenance' import { validateHanset, validateEmail } from '@/utils/validator' const { t } = useI18n() // 国际化 @@ -47,28 +48,19 @@ export const ApplicationRecordMain = useCrudSchemas(reactive([ sort: 'custom', }, { - label: '是否可用', - field: 'available', - dictType: DICT_TYPE.TRUE_FALSE, + label: '状态', + field: 'status', + sort: 'custom', + dictType: DICT_TYPE.ITEM_APPLY_STATUS, dictClass: 'string', - isSearch: false, + isSearch: true, isTable: true, - sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select', - inactiveValue: 'FALSE', disabled: true - }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } } }, { @@ -96,6 +88,30 @@ export const ApplicationRecordMainRules = reactive({ ], }) +export const DeviceMOLD = useCrudSchemas(reactive([ + { + label: '编号', + field: 'number', + sort: 'custom', + isForm: false, + table: { + width: 180, + fixed: 'left' + }, + }, + { + label: '名称', + field: 'name', + sort: 'custom', + }, + { + label: '规格型号', + field: 'specification', + sort: 'custom', + }, + +])) + /** * @returns {Array} 备件申请子表 */ @@ -110,8 +126,8 @@ export const ApplicationRecordDetail = useCrudSchemas(reactive([ searchListPlaceholder: '请选择备件编号', searchField: 'number', searchTitle: '库区信息', - searchAllSchemas: Item.allSchemas, // 查询弹窗所需类 - searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法 + searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 + searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', @@ -121,7 +137,49 @@ export const ApplicationRecordDetail = useCrudSchemas(reactive([ }, }, { - label: '数量', + label: '类型', + field: 'type', + sort: 'custom', + dictType: DICT_TYPE.DEVICE_MOLD_TYPE, + dictClass: 'string', + isSearch: true, + isTable: true, + table: { + width: 150 + }, + tableForm: { + type: 'Select', + disabled: false + } + }, + + + { + label: '设备/模具编号', + field: 'deviceNumber', + sort: 'custom', + isSearch: true, + tableForm: { + isInpuFocusShow: true, + searchListPlaceholder: '请选择单号', + searchField: 'number', + searchTitle: '单号信息', + searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类 + searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: "TRUE", + isMainValue: false + }, { + key: 'type', + value: "type", + isMainValue: true + } + ] + }, + }, + { + label: '申领数量', field: 'qty', sort: 'custom', table: { @@ -160,6 +218,8 @@ export const ApplicationRecordDetail = useCrudSchemas(reactive([ precision: 6 } }, + + { label: '是否可用', field: 'available', diff --git a/src/views/eam/item/applicationRecord/index.vue b/src/views/eam/item/applicationRecord/index.vue index 10eede7..c67f0d5 100644 --- a/src/views/eam/item/applicationRecord/index.vue +++ b/src/views/eam/item/applicationRecord/index.vue @@ -163,8 +163,9 @@ // 列表-操作按钮 const butttondata = (row) => { return [ - defaultButtons.mainListEditBtn(null), // 编辑 - defaultButtons.mainListDeleteBtn(null), // 删除 + defaultButtons.approveBtn({ hide: isShowMainButton(row, ['0']) }), // 撤回 + // defaultButtons.mainListEditBtn(null), // 编辑 + // defaultButtons.mainListDeleteBtn(null), // 删除 ] } @@ -172,6 +173,8 @@ const buttonTableClick = async (val, row) => { if (val == 'edit') { // 编辑 openForm('update', row) + }else if (val == 'approve') { // 删除 + // handleDelete(row.id) } else if (val == 'delete') { // 删除 handleDelete(row.id) } @@ -287,4 +290,4 @@ getList() importTemplateData.templateUrl = await ApplicationRecordMainApi.importTemplate() }) - \ No newline at end of file + diff --git a/src/views/eam/item/itemApplyMain/index.vue b/src/views/eam/item/itemApplyMain/index.vue index 2d9cc59..bb1ec5c 100644 --- a/src/views/eam/item/itemApplyMain/index.vue +++ b/src/views/eam/item/itemApplyMain/index.vue @@ -75,8 +75,9 @@ if (type == 'tableForm') { // 明细查询页赋值 row[formField] = val[0][searchField] - row['itemNumber'] = val[0]['number'] + row['itemNumber'] = val[0]['itemNumber'] row['isRadeIn'] = val[0]['isRadeIn'] + row['currentQty'] = val[0]['qty'] row['available'] = val[0]['available'] } else { const setV = {} @@ -158,9 +159,9 @@ // 列表-操作按钮 const butttondata = (row) => { return [ - defaultButtons.mainListOrderCloBtn({ hide: isShowMainButton(row, ['0']) }), // 关闭 - defaultButtons.mainListEditBtn(null), // 编辑 - defaultButtons.mainListDeleteBtn(null), // 删除 + defaultButtons.backoutBtn({ hide: isShowMainButton(row, ['0']) }), // 撤回 + // defaultButtons.mainListEditBtn(null), // 编辑 + // defaultButtons.mainListDeleteBtn(null), // 删除 ] } @@ -168,11 +169,28 @@ const buttonTableClick = async (val, row) => { if (val == 'edit') { // 编辑 openForm('update', row) - } else if (val == 'delete') { // 删除 + } + else if (val == 'backout') { // 提交审批 + backout(row.id) + } + else if (val == 'delete') { // 删除 handleDelete(row.id) } } + /** 撤销按钮操作 */ + const backout = async (id : number) => { + try { + // 撤销的二次确认 + await message.confirm('是否撤销所选中数据?') + // 发起撤销 + await ItemApplyMainApi.backoutItemApplyMain(id) + message.success(t('撤销成功!')) + // 刷新列表 + await getList() + } catch { } + } + /** 添加/修改操作 */ const formRef = ref() const openForm = async (type : string, row ?: number) => { diff --git a/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts b/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts index d2036bf..7e290e1 100644 --- a/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts +++ b/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts @@ -1,7 +1,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' -import { Item } from '@/views/eam/basic/item/item.data' -import * as ItemApi from '@/api/eam/basic/item' +import { ItemAccounts } from '@/views/eam/item/itemAccounts/itemAccounts.data' +import * as ItemAccountsApi from '@/api/eam/item/itemAccounts' +import * as DeviceMoldItemsApi from '@/api/eam/basic/deviceMaintenance' import { validateHanset, validateEmail } from '@/utils/validator' const { t } = useI18n() // 国际化 @@ -87,6 +88,31 @@ export const ItemApplyMainRules = reactive({ ], }) + +export const DeviceMOLD = useCrudSchemas(reactive([ + { + label: '编号', + field: 'number', + sort: 'custom', + isForm: false, + table: { + width: 180, + fixed: 'left' + }, + }, + { + label: '名称', + field: 'name', + sort: 'custom', + }, + { + label: '规格型号', + field: 'specification', + sort: 'custom', + }, + +])) + /** * @returns {Array} 备件申请子表 */ @@ -101,8 +127,8 @@ export const ItemApplyDetail = useCrudSchemas(reactive([ searchListPlaceholder: '请选择备件编号', searchField: 'number', searchTitle: '库区信息', - searchAllSchemas: Item.allSchemas, // 查询弹窗所需类 - searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法 + searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 + searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', @@ -112,7 +138,49 @@ export const ItemApplyDetail = useCrudSchemas(reactive([ }, }, { - label: '数量', + label: '类型', + field: 'type', + sort: 'custom', + dictType: DICT_TYPE.DEVICE_MOLD_TYPE, + dictClass: 'string', + isSearch: true, + isTable: true, + table: { + width: 150 + }, + tableForm: { + type: 'Select', + disabled: false + } + }, + + + { + label: '设备/模具编号', + field: 'deviceNumber', + sort: 'custom', + isSearch: true, + tableForm: { + isInpuFocusShow: true, + searchListPlaceholder: '请选择单号', + searchField: 'number', + searchTitle: '单号信息', + searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类 + searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: "TRUE", + isMainValue: false + }, { + key: 'type', + value: "type", + isMainValue: true + } + ] + }, + }, + { + label: '申领数量', field: 'qty', sort: 'custom', table: { @@ -151,6 +219,8 @@ export const ItemApplyDetail = useCrudSchemas(reactive([ precision: 6 } }, + + { label: '是否可用', field: 'available',