|
|
@ -27,43 +27,53 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #code="{row}"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
|
<span>{{ row.code }}</span> |
|
|
|
<template #number="{row}"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row }"> |
|
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:rules="StockupMainJobRules" |
|
|
|
:formAllSchemas="StockupMainJob.allSchemas" |
|
|
|
:apiUpdate="StockupMainJobApi.updateStockupMainJob" |
|
|
|
:apiCreate="StockupMainJobApi.createStockupMainJob" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:tableAllSchemas="StockupDetailJob.allSchemas" |
|
|
|
:tableFormRules="StockupDetailJobRules" |
|
|
|
:apiUpdate="StockupJobMainApi.updateStockupMainJob" |
|
|
|
:apiCreate="StockupJobMainApi.createStockupMainJob" |
|
|
|
:isBusiness="true" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="StockupMainJob.allSchemas" /> |
|
|
|
|
|
|
|
<Detail |
|
|
|
ref="detailRef" |
|
|
|
:isBasic="false" |
|
|
|
:allSchemas="StockupMainJob.allSchemas" |
|
|
|
:detailAllSchemas="StockupDetailJob.allSchemas" |
|
|
|
:detailAllSchemasRules="StockupDetailJobRules" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:apiPage="StockupJobDetailApi.getStockupDetailJobPage" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { StockupMainJob,StockupMainJobRules } from './stockupMainJob.data' |
|
|
|
import * as StockupMainJobApi from '@/api/wms/stockupMainJob' |
|
|
|
import { StockupMainJob,StockupMainJobRules,StockupDetailJob,StockupDetailJobRules } from './stockupMainJob.data' |
|
|
|
import * as StockupJobMainApi from '@/api/wms/stockupMainJob' |
|
|
|
import * as StockupJobDetailApi from '@/api/wms/stockupDetailJob' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
defineOptions({ name: 'StockupMainJob' }) |
|
|
|
// 备货任务主 |
|
|
|
defineOptions({ name: 'StockupJobMain' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
@ -73,22 +83,52 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(StockupMainJob.allSchemas.tableColumns) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
// 查询列表页面参数设置 |
|
|
|
const searchTableParams = ref([ |
|
|
|
//{ |
|
|
|
// formField: 'productItemCode', |
|
|
|
// searchTableTitle: '物料信息', |
|
|
|
// searchTableAllSchemas: Itembasic.allSchemas, |
|
|
|
// searchTablePage: ItembasicApi.getItembasicPage |
|
|
|
//} |
|
|
|
]) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
//row[formField] = val[0][searchField] |
|
|
|
//row['poLine'] = val[0]['poLine'] |
|
|
|
//row['batch'] = val[0]['toBatch'] |
|
|
|
//row['altBatch'] = val[0]['altBatch'] |
|
|
|
//row['itemCode'] = val[0]['itemCode'] |
|
|
|
//row['itemName'] = val[0]['itemName'] |
|
|
|
//row['itemDesc1'] = val[0]['itemDesc1'] |
|
|
|
//row['itemDesc2'] = val[0]['itemDesc2'] |
|
|
|
//row['projectCode'] = val[0]['projectCode'] |
|
|
|
//row['qty'] = val[0]['qty'] |
|
|
|
//row['uom'] = val[0]['uom'] |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
//setV['ppNumber'] = val[0]['ppNumber'] |
|
|
|
//setV['supplierCode'] = val[0]['supplierCode'] |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// 子表新增的时候选择表格之后需要会显得字段 |
|
|
|
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] |
|
|
|
const Echo = [] |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: StockupMainJobApi.getStockupMainJobPage // 分页接口 |
|
|
|
getListApi: StockupJobMainApi.getStockupMainJobPage // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
@ -96,9 +136,7 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:stockupMainJob:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:stockupMainJob:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:stockupMainJob:export'}), // 导出 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:stockup-job-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
@ -114,78 +152,158 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
if (val == 'export') { // 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
getList() |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
|
|
|
searchFormClick({ |
|
|
|
filters: tableObject.params.filters |
|
|
|
}) |
|
|
|
} else { |
|
|
|
getList() |
|
|
|
} |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn({hasPermi:'wms:stockupMainJob:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:stockupMainJob:delete'}), // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
return false |
|
|
|
} else { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row) => { |
|
|
|
return [ |
|
|
|
defaultButtons.mainListJobAccBtn({hide:isShowMainButton(row,['1'])}), // 承接 |
|
|
|
defaultButtons.mainListJobCloBtn({hide:isShowMainButton(row,['1'])}), // 关闭 |
|
|
|
defaultButtons.mainListJobAbaBtn({hide:isShowMainButton(row,['2'])}), // 放弃 |
|
|
|
defaultButtons.mainListJobExeBtn({hide:isShowMainButton(row,['2'])}), // 执行 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =StockupMainJob.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
if(isHave){ |
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
if (formType === 'create') { |
|
|
|
await StockupMainJobApi.createStockupMainJob(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await StockupMainJobApi.updateStockupMainJob(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'mainJobExe') { // 执行 |
|
|
|
let aaa = { |
|
|
|
"id": 6, |
|
|
|
"requestNumber": "REQ4520240313-0003", |
|
|
|
"deliverPlanNumber": null, |
|
|
|
"fromWarehouseCode": "CKV", |
|
|
|
"toWarehouseCode": "CKV", |
|
|
|
"details": null, |
|
|
|
"requestTime": null, |
|
|
|
"requestDueTime": null, |
|
|
|
"status": "1", |
|
|
|
"expiredTime": null, |
|
|
|
"concurrencyStamp": "1", |
|
|
|
"jobStageStatus": null, |
|
|
|
"priority": null, |
|
|
|
"priorityincrement": null, |
|
|
|
"departmentCode": null, |
|
|
|
"userGroupCode": null, |
|
|
|
"acceptUserId": null, |
|
|
|
"acceptUserName": null, |
|
|
|
"acceptTime": null, |
|
|
|
"completeUserId": null, |
|
|
|
"completeUserName": null, |
|
|
|
"completeTime": null, |
|
|
|
"fromAreaTypes": "FG", |
|
|
|
"toAreaTypes": "CUST", |
|
|
|
"number": "JOB3220240314-0006", |
|
|
|
"businessType": "Stockup", |
|
|
|
"remark": null, |
|
|
|
"extraProperties": null, |
|
|
|
"siteId": null, |
|
|
|
"autoComplete": "FALSE", |
|
|
|
"allowModifyLocation": "FALSE", |
|
|
|
"allowModifyQty": "TRUE", |
|
|
|
"allowBiggerQty": "TRUE", |
|
|
|
"allowSmallerQty": "TRUE", |
|
|
|
"allowModifyInventoryStatus": "TRUE", |
|
|
|
"allowContinuousScanning": "TRUE", |
|
|
|
"allowPartialComplete": "TRUE", |
|
|
|
"ruleUserId": null, |
|
|
|
"allowModifyBatch": "FALSE", |
|
|
|
"allowModifyPackingNumber": "FALSE", |
|
|
|
"fromAreaCodes": "KQV2", |
|
|
|
"toAreaCodes": "CUST", |
|
|
|
"serialNumber": "0", |
|
|
|
"inInventoryStatuses": "OK", |
|
|
|
"outInventoryStatuses": "OK", |
|
|
|
"createTime": null, |
|
|
|
"subList": [{ |
|
|
|
"id": 1, |
|
|
|
"packingNumber": null, |
|
|
|
"batch": "2024021801", |
|
|
|
"inventoryStatus": "OK", |
|
|
|
"ownerCode": null, |
|
|
|
"containerNumber": null, |
|
|
|
"fromLocationCode": "FG", |
|
|
|
"toLocationCode": "RAW", |
|
|
|
"itemCode": "FOG-LAMP-RIGHT", |
|
|
|
"itemName": "HL后雾灯(新)-右\r\n", |
|
|
|
"itemDesc1": "HL后雾灯(新)-右\r\n", |
|
|
|
"itemDesc2": "HL后雾灯(新)-右\r\n", |
|
|
|
"projectCode": "PJ001", |
|
|
|
"qty": 1, |
|
|
|
"uom": "EA", |
|
|
|
"masterId": 6, |
|
|
|
"number": "JOB3220240314-0006", |
|
|
|
"remark": null, |
|
|
|
"siteId": "", |
|
|
|
"createTime": null, |
|
|
|
"toPackingNumber": null, |
|
|
|
"toContainerNumber": null, |
|
|
|
"toBatch": null, |
|
|
|
"handleQty": null, |
|
|
|
"toInventoryStatus": null, |
|
|
|
recordList: [{ |
|
|
|
handleQty: 10, |
|
|
|
toPackingNumber: '12', |
|
|
|
toContainerNumber: '001', |
|
|
|
toBatch: '21', |
|
|
|
toInventoryStatus: 'OK', |
|
|
|
toLocationCode: 'WIP', |
|
|
|
supplierCode: '31213', |
|
|
|
},{ |
|
|
|
handleQty: 22, |
|
|
|
toPackingNumber: 'M20230421000005', |
|
|
|
toContainerNumber: '001', |
|
|
|
toBatch: '20230808', |
|
|
|
toInventoryStatus: 'OK', |
|
|
|
toLocationCode: 'FG', |
|
|
|
supplierCode: '31213', |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
handleHandle(aaa) |
|
|
|
console.log('列表-操作按钮事件-执行') |
|
|
|
} else if (val == 'mainJobAba') { // 放弃 |
|
|
|
StockupJobMainApi.abandonStockupMainJob(row.id) |
|
|
|
} else if (val == 'mainJobClo') { // 关闭 |
|
|
|
StockupJobMainApi.closeStockupMainJob(row.id) |
|
|
|
} else if (val == 'mainJobAcc') { // 承接 |
|
|
|
StockupJobMainApi.acceptStockupMainJob(row.id) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicStockupMainJob') |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue,'jobStockupMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
const handleHandle = async (data) => { |
|
|
|
try { |
|
|
|
// 删除的二次确认 |
|
|
|
await message.delConfirm() |
|
|
|
// 发起删除 |
|
|
|
await StockupMainJobApi.deleteStockupMainJob(id) |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await message.confirm(t('common.confirmHandle')) |
|
|
|
await StockupJobMainApi.executeStockupMainJob(data) |
|
|
|
message.success(t('common.handleSuccess')) |
|
|
|
await getList() |
|
|
|
} catch {} |
|
|
|
} |
|
|
@ -198,7 +316,7 @@ const handleExport = async () => { |
|
|
|
await message.exportConfirm() |
|
|
|
// 发起导出 |
|
|
|
exportLoading.value = true |
|
|
|
const data = await StockupMainJobApi.exportStockupMainJob(tableObject.params) |
|
|
|
const data = await StockupJobMainApi.exportStockupMainJob(tableObject.params) |
|
|
|
download.excel(data, '备货任务主.xlsx') |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
|