diff --git a/src/api/wms/preparetoissueMain/index.ts b/src/api/wms/preparetoissueMain/index.ts index 8febec008..0b3797730 100644 --- a/src/api/wms/preparetoissueMain/index.ts +++ b/src/api/wms/preparetoissueMain/index.ts @@ -53,10 +53,51 @@ export const deletePreparetoissueMain = async (id: number) => { // 导出备料计划主 Excel export const exportPreparetoissueMain = async (params) => { - return await request.download({ url: `/wms/preparetoissue-main/export-excel`, params }) + if (params.isSearch) { + const data = {...params} + return await request.downloadPost({ url: `/wms/preparetoissue-main/export-excel-senior`, data }) + } else { + return await request.download({ url: `/wms/preparetoissue-main/export-excel`, params }) + } } // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/wms/preparetoissue-main/get-import-template' }) -} \ No newline at end of file +} + + +// 关闭 +export const close = (id) => { + return request.put({ url: '/wms/preparetoissue-main/close?id=' + id }) +} + +// 提交审批 +export const submit = (id) => { + return request.put({ url: '/wms/preparetoissue-main/submit?id=' + id }) +} + +// 打开 +export const open = (id) => { + return request.put({ url: '/wms/preparetoissue-main/open?id=' + id }) +} + +// 驳回 +export const reject = (id) => { + return request.put({ url: '/wms/preparetoissue-main/reject?id=' + id }) +} + +// 驳回 +export const agree = (id) => { + return request.put({ url: '/wms/preparetoissue-main/agree?id=' + id }) +} + +// 发布 +export const publish = (id) => { + return request.put({ url: '/wms/preparetoissue-main/publish?id=' + id }) +} + +// 重置 +export const resetting = (id) => { + return request.put({ url: '/wms/preparetoissue-main/resetting?id=' + id }) +} diff --git a/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/index.vue b/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/index.vue index 4d4fa5b9e..9154c9ea2 100644 --- a/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/index.vue +++ b/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/index.vue @@ -33,7 +33,7 @@ @@ -50,6 +50,7 @@ :apiUpdate="PreparetoissueMainApi.updatePreparetoissueMain" :apiCreate="PreparetoissueMainApi.createPreparetoissueMain" :isBusiness="true" + :isShowButton="isShowButton" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess" @@ -80,6 +81,8 @@ import { PreparetoissueMain,PreparetoissueMainRules,PreparetoissueDetail,Prepare import * as PreparetoissueMainApi from '@/api/wms/preparetoissueMain' import * as PreparetoissueDetailApi from '@/api/wms/preparetoissueDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' +import * as ProductionDetailApi from '@/api/wms/productionDetail' +import * as ProductionlineitemApi from '@/api/wms/productionlineitem' // 备料计划 defineOptions({ name: 'PreparetoissueMain' }) @@ -92,6 +95,8 @@ const routeName = ref() routeName.value = route.name const tableColumns = ref(PreparetoissueMain.allSchemas.tableColumns) +const isShowButton = ref(true) + // 字段设置 更新主列表字段 const updataTableColumns = (val) => { tableColumns.value = val @@ -109,9 +114,53 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => setV[formField] = val[0][searchField] if (formField == 'productionPlanNumber') { setV['workshop'] = val[0]['workshop'] - setV['prodLine'] = val[0]['production_line'] + setV['prodLine'] = val[0]['productionLine'] setV['shift'] = val[0]['shift'] setV['team'] = val[0]['team'] + isShowButton.value = false + // 获取子表数据 + ProductionDetailApi.getProductionDetailPage({ + masterId: val[0]['id'], + pageSize: 100, + pageNo: 1, + sort: '', + by: 'ASC' + }).then(res => { + if (res) tableData.value = res.list + // 根据子表物品代码 和主表生产线 查询生产线物品关系 获取 原料库位赋值目标库位 + tableData.value.map(item => { + ProductionlineitemApi.getProductionlineitemPage({ + productionLineCode: val[0]['productionLine'], + itemCode: item.itemCode, + pageSize: 100, + pageNo: 1, + sort: '', + by: 'ASC' + }).then(res => { + item.toLocationCode = res.list[0].rawLocationCode + }) + }) + // 修改 tableform 属性 + PreparetoissueDetail.allSchemas.tableFormColumns.map(item => { + if(item.field == 'itemCode') { + item.isInpuFocusShow = false + item.tableForm.isInpuFocusShow = false + item.tableForm.disabled = true + } + if(item.field == 'planQty') { + item.tableForm.disabled = true + } + if(item.field == 'uom') { + item.tableForm.disabled = true + } + if(item.field == 'available') { + item.tableForm.disabled = true + } + }) + }).catch(err => { + console.log(err) + message.error('错误') + }) } formRef.setValues(setV) } @@ -136,8 +185,8 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'wms:preparetoissue-main:create'}), // 新增——需要手动修改下权限 - defaultButtons.defaultImportBtn({hasPermi:'wms:preparetoissue-main:import'}), // 导入 + defaultButtons.defaultAddBtn({hasPermi:'wms:preparetoissue-main:create'}), // 新增 + // defaultButtons.defaultImportBtn({hasPermi:'wms:preparetoissue-main:import'}), // 导入 defaultButtons.defaultExportBtn({hasPermi:'wms:preparetoissue-main:export'}), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 @@ -156,6 +205,7 @@ const HeadButttondata = [ const buttonBaseClick = (val, item) => { if (val == 'add') { // 新增 openForm('create') + resetShow() } else if (val == 'import') { // 导入 handleImport() } else if (val == 'export') { // 导出 @@ -180,29 +230,75 @@ const isShowMainButton = (row,val) => { // 列表-操作按钮 const butttondata = (row) => { return [ - defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5','4'])}), // 打开 - defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4','6'])}), // 关闭 + defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5'])}), // 打开 + defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4'])}), // 关闭 defaultButtons.mainListPlanSubBtn({hide:isShowMainButton(row,['1'])}), // 提交审批 defaultButtons.mainListPlanTurBtn({hide:isShowMainButton(row,['2'])}), // 驳回 defaultButtons.mainListPlanAppBtn({hide:isShowMainButton(row,['2'])}), // 审批通过 defaultButtons.mainListPlanPubBtn({hide:isShowMainButton(row,['3'])}), // 发布 + defaultButtons.mainListPlanResBtn({hide:isShowMainButton(row,['4'])}), // 重置 defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:production-main:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:production-main:delete'}), // 删除 + // defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:production-main:delete'}), // 删除 ] } // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { if (val == 'mainPlanOpe') { // 打开 - console.log('列表-操作按钮事件-打开') + PreparetoissueMainApi.open(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) } else if (val == 'mainPlanClo') { // 关闭 - console.log('列表-操作按钮事件-关闭') + await message.confirm('确认要关闭吗?') + PreparetoissueMainApi.close(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) } else if (val == 'mainPlanSub') { // 提交审批 - console.log('列表-操作按钮事件-提交审批') + await message.confirm('确认要提交审批吗?') + PreparetoissueMainApi.submit(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) } else if (val == 'mainPlanTur') { // 驳回 - console.log('列表-操作按钮事件-驳回') + await message.confirm('确认要驳回吗?') + PreparetoissueMainApi.reject(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) } else if (val == 'mainPlanApp') { // 审批通过 - console.log('列表-操作按钮事件-审批通过') + await message.confirm('确认要审批通过吗?') + PreparetoissueMainApi.agree(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) + } else if (val == 'mainPlanPub') { // 发布 + await message.confirm('确认要发布吗?') + PreparetoissueMainApi.publish(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) + } else if (val == 'mainPlanRes') { // 重置 + await message.confirm('确认要重置吗?') + PreparetoissueMainApi.resetting(row.id).then(() => { + message.success(t('common.updateSuccess')) + getList() + }).catch(err => { + console.log(err) + }) } else if (val == 'edit') { // 编辑 openForm('update', row) } else if (val == 'delete') { // 删除 @@ -315,9 +411,32 @@ const searchFormClick = (searchData) => { getList() // 刷新当前列表 } +// 恢复最初属性:明细添加/删除行按钮,字段查询弹窗,可输入状态等 +// 列表头部 新增按钮 触发 +const resetShow = async () => { + isShowButton.value = true // tableform按钮恢复到显示 + // 修改 tableform 属性 + PreparetoissueDetail.allSchemas.tableFormColumns.map(item => { + if(item.field == 'itemCode') { + item.isInpuFocusShow = true + item.tableForm.isInpuFocusShow = true + item.tableForm.disabled = false + } + if(item.field == 'planQty') { + item.tableForm.disabled = false + } + if(item.field == 'uom') { + item.tableForm.disabled = false + } + if(item.field == 'available') { + item.tableForm.disabled = false + } + }) +} + /** 初始化 **/ onMounted(async () => { getList() - importTemplateData.templateUrl = await PreparetoissueMainApi.importTemplate() + // importTemplateData.templateUrl = await PreparetoissueMainApi.importTemplate() }) diff --git a/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/preparetoissueMain.data.ts b/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/preparetoissueMain.data.ts index dee166718..c9b420296 100644 --- a/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/preparetoissueMain.data.ts +++ b/src/views/wms/issueManage/preparetoissueplan/preparetoissueMain/preparetoissueMain.data.ts @@ -80,7 +80,7 @@ export const PreparetoissueMain = useCrudSchemas(reactive([ width: 150 }, form: { - labelMessage: '该生产线会影响明细中的物品代码,需在基础管理生产线物品关系中维护', + labelMessage: '该生产线会影响明细中的物品代码,工位', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择生产线', // 输入框占位文本 @@ -476,7 +476,12 @@ export const PreparetoissueDetail = useCrudSchemas(reactive([ searchField: 'code', // 查询弹窗赋值字段 searchTitle: '工位信息', // 查询弹窗标题 searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 - searchPage: WorkStationApi.getWorkstationPage // 查询弹窗所需分页方法 + searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key:'productionLineCode', + value:'prodLine', + isMainValue: true + }] } }, tableForm:{ @@ -485,7 +490,12 @@ export const PreparetoissueDetail = useCrudSchemas(reactive([ searchField: 'code', // 查询弹窗赋值字段 searchTitle: '工位信息', // 查询弹窗标题 searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 - searchPage: WorkStationApi.getWorkstationPage // 查询弹窗所需分页方法 + searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key:'productionLineCode', + value:'prodLine', + isMainValue: true + }] }, }, { @@ -499,6 +509,11 @@ export const PreparetoissueDetail = useCrudSchemas(reactive([ table: { width: 180 }, + tableForm: { + type: 'FormDateTime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + }, form: { component: 'DatePicker', componentProps: {