|
|
@ -1,7 +1,14 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="[...ProductreceiptRequestMain.allSchemas.searchSchema,...ProductreceiptRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="[ |
|
|
|
...ProductreceiptRequestMain.allSchemas.searchSchema, |
|
|
|
...ProductreceiptRequestDetail.allSchemas.searchSchema |
|
|
|
]" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
@ -17,7 +24,8 @@ |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table v-clientTable |
|
|
|
<Table |
|
|
|
v-clientTable |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
@ -28,13 +36,16 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #number="{row}"> |
|
|
|
<template #number="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row,$index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<template #action="{ row, $index }"> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="butttondata(row, $index)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -43,7 +54,7 @@ |
|
|
|
<BasicForm |
|
|
|
ref="formRef" |
|
|
|
:isOpenSearchTable="true" |
|
|
|
fieldTableColumn="workStationCode" |
|
|
|
fieldTableColumn="itemCode" |
|
|
|
@success="getList" |
|
|
|
:rules="ProductreceiptRequestMainRules" |
|
|
|
:formAllSchemas="ProductreceiptRequestMain.allSchemas" |
|
|
@ -60,12 +71,18 @@ |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
|
> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<el-date-picker v-bind:modelValue="row['expireTime']?addDay(row['produceDate'],row['expireTime']):dayjs('2099-12-31').valueOf()" |
|
|
|
<template v-slot="{ row }"> |
|
|
|
<el-date-picker |
|
|
|
v-bind:modelValue=" |
|
|
|
row['expireTime'] |
|
|
|
? addDay(row['produceDate'], row['expireTime']) |
|
|
|
: dayjs('2099-12-31').valueOf() |
|
|
|
" |
|
|
|
:clearable="true" |
|
|
|
style="width: 100%" |
|
|
|
:disabled="true" |
|
|
|
:placeholder="t('ts.选择日期')"/> |
|
|
|
:placeholder="t('ts.选择日期')" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</BasicForm> |
|
|
|
|
|
|
@ -123,21 +140,37 @@ |
|
|
|
</Dialog> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/productreceipt-request-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" :extend="'predict'"/> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/wms/productreceipt-request-main/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
:updateIsDisable="true" |
|
|
|
:coverIsDisable="true" |
|
|
|
:mode="2" |
|
|
|
:extend="'predict'" |
|
|
|
/> |
|
|
|
<!-- 标签打印 --> |
|
|
|
<SearchTable style="width:905px" ref="searchTableRef" @searchTableSuccess="searchTableSuccessLabel" /> |
|
|
|
<SearchTable |
|
|
|
style="width: 905px" |
|
|
|
ref="searchTableRef" |
|
|
|
@searchTableSuccess="searchTableSuccessLabel" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import { ProductreceiptRequestMain,ProductreceiptRequestMainRules,ProductreceiptRequestDetail, |
|
|
|
ProductreceiptRequestDetailRules, BackflushDetailRequest, |
|
|
|
ProductreceiptRequestLabel,ProductreceiptRequestLabelRules } from './productreceiptRequestMain.data' |
|
|
|
import { |
|
|
|
SupplierdeliverRequestPackage |
|
|
|
} from '../../../purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts' |
|
|
|
import { |
|
|
|
ProductreceiptRequestMain, |
|
|
|
ProductreceiptRequestMainRules, |
|
|
|
ProductreceiptRequestDetail, |
|
|
|
ProductreceiptRequestDetailRules, |
|
|
|
BackflushDetailRequest, |
|
|
|
ProductreceiptRequestLabel, |
|
|
|
ProductreceiptRequestLabelRules |
|
|
|
} from './productreceiptRequestMain.data' |
|
|
|
import { SupplierdeliverRequestPackage } from '../../../purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts' |
|
|
|
// } from '../../../supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data' |
|
|
|
import * as ProductreceiptRequestMainApi from '@/api/wms/productreceiptRequestMain' |
|
|
|
import * as ProductreceiptRequestDetailApi from '@/api/wms/productreceiptRequestDetail' |
|
|
@ -149,7 +182,7 @@ import { formatTime } from '@/utils/index' |
|
|
|
import { getAccessToken } from '@/utils/auth' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import { getJmreportBaseUrl } from '@/utils/systemParam' |
|
|
|
import * as BomApi from "@/api/wms/bom"; |
|
|
|
import * as BomApi from '@/api/wms/bom' |
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
|
import * as WorkshopApi from '@/api/wms/workshop' |
|
|
|
|
|
|
@ -163,9 +196,13 @@ const { t } = useI18n() // 国际化 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref([...ProductreceiptRequestMain.allSchemas.tableColumns,...ProductreceiptRequestDetail.allSchemas.tableMainColumns]) |
|
|
|
const tableColumns = ref([ |
|
|
|
...ProductreceiptRequestMain.allSchemas.tableColumns, |
|
|
|
...ProductreceiptRequestDetail.allSchemas.tableMainColumns |
|
|
|
]) |
|
|
|
// 详情 table 操作扩展 按钮 |
|
|
|
const buttondataTable = ref([{ |
|
|
|
const buttondataTable = ref([ |
|
|
|
{ |
|
|
|
label: 'Bom', |
|
|
|
name: 'bom', |
|
|
|
hide: false, |
|
|
@ -173,98 +210,98 @@ const buttondataTable = ref([{ |
|
|
|
icon: '', |
|
|
|
color: '', |
|
|
|
hasPermi: '', |
|
|
|
link: true, // 文本展现按钮 |
|
|
|
}]) |
|
|
|
link: true // 文本展现按钮 |
|
|
|
} |
|
|
|
]) |
|
|
|
|
|
|
|
//创建标签 |
|
|
|
const detailListTableColumns = ProductreceiptRequestLabel.allSchemas |
|
|
|
const isCreateLabel = ref(false) |
|
|
|
const formLabelRef = ref() |
|
|
|
const labelType = ref('') // 标签类别 采购还是制造等 |
|
|
|
const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ |
|
|
|
const { tableObject: detatableData, tableMethods: detatableMethods } = useTable({ |
|
|
|
getListApi: ProductreceiptRequestDetailApi.getProductreceiptRequestDetailPage |
|
|
|
}) |
|
|
|
const { getList:getDetailList } = detatableMethods |
|
|
|
const { getList: getDetailList } = detatableMethods |
|
|
|
|
|
|
|
// Bom查看 |
|
|
|
const DialogTitle = ref('Bom信息') |
|
|
|
const bomModelVisible = ref(false) |
|
|
|
const { tableObject: detatableDataBom, tableMethods: detatableMethodsBom } =useTable({ |
|
|
|
const { tableObject: detatableDataBom, tableMethods: detatableMethodsBom } = useTable({ |
|
|
|
getListApi: BackflushRequestDetailbApi.getBackflushRequestDetailbPage |
|
|
|
}) |
|
|
|
const { getList:getDetailListBom } = detatableMethodsBom |
|
|
|
|
|
|
|
const { getList: getDetailListBom } = detatableMethodsBom |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
if (formField == 'secondPackUnit') { |
|
|
|
row['secondPackUnit'] = val[0]['packUnit'] |
|
|
|
row['secondPackQty'] = val[0]['packQty'] |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
}else if(formField == 'packUnit'){ |
|
|
|
} else if (formField == 'packUnit') { |
|
|
|
row['packUnit'] = val[0]['packUnit'] |
|
|
|
row['packQty'] = val[0]['packQty'] |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
}else if (formField == 'itemCode') { |
|
|
|
} else if (formField == 'itemCode') { |
|
|
|
if(tableData.value.find(item1=>item1['itemCode'] == val[0]['itemCode'])){ |
|
|
|
message.warning(`物料${val[0]['itemCode']}已经存在`) |
|
|
|
return |
|
|
|
} |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
row['produceDate'] = dayjs().valueOf() |
|
|
|
const index1 = 0 |
|
|
|
setTableFormsValues(val, index1) |
|
|
|
} else { |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
// 查看BOM版本 |
|
|
|
} |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if ('workshopCode' == formField) { |
|
|
|
//车间代码 |
|
|
|
setV['productionLineCode'] = '' |
|
|
|
tableData.value = [] |
|
|
|
} else if ('productionLineCode' == formField) { |
|
|
|
//生产线代码 |
|
|
|
tableData.value = [] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const setTableFormsValues = async (val, index1) => { |
|
|
|
if (index1 <= val.length - 1) { |
|
|
|
const newRow = JSON.parse(JSON.stringify({ ...tableFormKeys, ...val[index1] })) |
|
|
|
newRow['itemCode'] = val[index1]['itemCode'] |
|
|
|
newRow['uom'] = val[0]['uom'] |
|
|
|
newRow['produceDate'] = dayjs().valueOf() |
|
|
|
|
|
|
|
const param1 = { |
|
|
|
productItemCode: val[0]['itemCode'], |
|
|
|
available: 'TRUE', |
|
|
|
pageSize: 20, |
|
|
|
pageNo: 1, |
|
|
|
sort: '', |
|
|
|
by: 'ASC', |
|
|
|
by: 'ASC' |
|
|
|
} |
|
|
|
BomApi.getBomPage(param1).then(res => { |
|
|
|
await BomApi.getBomPage(param1).then((res) => { |
|
|
|
console.log(res) |
|
|
|
if(res?.list?.length>0){ |
|
|
|
row['bomVersion'] = res.list[0].version |
|
|
|
if (res?.list?.length > 0) { |
|
|
|
newRow['bomVersion'] = res.list[0].version |
|
|
|
} |
|
|
|
}) |
|
|
|
}else if (formField == 'workStationCode') { |
|
|
|
// 明细查询页赋值 |
|
|
|
val.forEach(item=>{ |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
|
|
|
newRow[formField] = item[searchField] |
|
|
|
newRow.batch = formatTime(new Date(), 'yyyyMMdd') |
|
|
|
|
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if('workshopCode'==formField){ |
|
|
|
//车间代码 |
|
|
|
setV['productionLineCode'] = '' |
|
|
|
tableData.value = [] |
|
|
|
}else if('productionLineCode'==formField){ |
|
|
|
//生产线代码 |
|
|
|
tableData.value = [] |
|
|
|
console.log(tableData.value) |
|
|
|
index1++ |
|
|
|
setTableFormsValues(val, index1) |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
@ -281,12 +318,12 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:productreceipt-request-main:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:productreceipt-request-main:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:productreceipt-request-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:productreceipt-request-main:create' }), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'wms:productreceipt-request-main:import' }), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:productreceipt-request-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -299,28 +336,34 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
} else if (val == 'import') { |
|
|
|
// 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0) { |
|
|
|
searchFormClick({ |
|
|
|
filters: tableObject.params.filters |
|
|
|
}) |
|
|
|
} else { |
|
|
|
getList() |
|
|
|
} |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
const isShowMainButton = (row, val) => { |
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
return false |
|
|
|
} else { |
|
|
@ -329,100 +372,137 @@ const isShowMainButton = (row,val) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row,$index) => { |
|
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
|
if(findIndex>-1&&findIndex<$index){ |
|
|
|
const butttondata = (row, $index) => { |
|
|
|
const findIndex = row['masterId'] |
|
|
|
? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId']) |
|
|
|
: -1 |
|
|
|
if (findIndex > -1 && findIndex < $index) { |
|
|
|
return [] |
|
|
|
} |
|
|
|
return [ |
|
|
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']), hasPermi:'wms:productreceipt-request-main:close'}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']), hasPermi:'wms:productreceipt-request-main:reAdd'}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']), hasPermi:'wms:productreceipt-request-main:submit'}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:productreceipt-request-main:refused'}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:productreceipt-request-main:agree'}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']), hasPermi:'wms:productreceipt-request-main:handle'}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']), hasPermi:'wms:productreceipt-request-main:update'}), // 编辑 |
|
|
|
defaultButtons.mainListCloseBtn({ |
|
|
|
hide: isShowMainButton(row, ['1', '2', '3', '4', '6']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:close' |
|
|
|
}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({ |
|
|
|
hide: isShowMainButton(row, ['4', '5']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:reAdd' |
|
|
|
}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:submit' |
|
|
|
}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:refused' |
|
|
|
}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:agree' |
|
|
|
}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({ |
|
|
|
hide: isShowMainButton(row, ['3']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:handle' |
|
|
|
}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:productreceipt-request-main:update' |
|
|
|
}), // 编辑 |
|
|
|
{ |
|
|
|
label: '创建标签', |
|
|
|
name: 'cjbq', |
|
|
|
hide: isShowMainButton(row,['3']), |
|
|
|
hide: isShowMainButton(row, ['3']), |
|
|
|
type: 'primary', |
|
|
|
icon: '', |
|
|
|
color: '', |
|
|
|
hasPermi: '', |
|
|
|
link: true, // 文本展现按钮 |
|
|
|
link: true // 文本展现按钮 |
|
|
|
}, |
|
|
|
defaultButtons.mainListPointBtn({hide:isShowMainButton(row,['3','6','8'])}), // 标签打印 |
|
|
|
defaultButtons.mainListPointBtn({ hide: isShowMainButton(row, ['3', '6', '8']) }) // 标签打印 |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:productreceipt-request-main:delete'}), // 删除 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'mainClose') { // 关闭 |
|
|
|
if (val == 'mainClose') { |
|
|
|
// 关闭 |
|
|
|
await message.confirm('确认要关闭吗?') |
|
|
|
tableObject.loading = true |
|
|
|
ProductreceiptRequestMainApi.close(row.masterId).then(() => { |
|
|
|
ProductreceiptRequestMainApi.close(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainReAdd') { // 重新添加 |
|
|
|
} else if (val == 'mainReAdd') { |
|
|
|
// 重新添加 |
|
|
|
await message.confirm('确认要重新添加吗?') |
|
|
|
tableObject.loading = true |
|
|
|
ProductreceiptRequestMainApi.reAdd(row.masterId).then(() => { |
|
|
|
ProductreceiptRequestMainApi.reAdd(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainSubmit') { // 提交审批 |
|
|
|
} else if (val == 'mainSubmit') { |
|
|
|
// 提交审批 |
|
|
|
await message.confirm('确认要提交审批吗?') |
|
|
|
tableObject.loading = true |
|
|
|
ProductreceiptRequestMainApi.submit(row.masterId).then(() => { |
|
|
|
ProductreceiptRequestMainApi.submit(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainTurnDown') { // 驳回 |
|
|
|
} else if (val == 'mainTurnDown') { |
|
|
|
// 驳回 |
|
|
|
await message.confirm('确认要驳回吗?') |
|
|
|
tableObject.loading = true |
|
|
|
ProductreceiptRequestMainApi.refused(row.masterId).then(() => { |
|
|
|
ProductreceiptRequestMainApi.refused(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainApprove') { // 审批通过 |
|
|
|
} else if (val == 'mainApprove') { |
|
|
|
// 审批通过 |
|
|
|
await message.confirm('确认要审批通过吗?') |
|
|
|
tableObject.loading = true |
|
|
|
ProductreceiptRequestMainApi.agree(row.masterId).then(() => { |
|
|
|
ProductreceiptRequestMainApi.agree(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'cjbq') { // 创建标签 |
|
|
|
} else if (val == 'cjbq') { |
|
|
|
// 创建标签 |
|
|
|
|
|
|
|
// 判断 是否已创建标签 |
|
|
|
let isCreateLabel = false |
|
|
|
await PackageApi.getPackagePage({ |
|
|
|
requestNumber: row.number |
|
|
|
}).then(res => { |
|
|
|
}).then((res) => { |
|
|
|
if (res) { |
|
|
|
if (res.list.length > 0) isCreateLabel = true |
|
|
|
} |
|
|
@ -432,7 +512,7 @@ const buttonTableClick = async (val, row) => { |
|
|
|
return |
|
|
|
} |
|
|
|
detatableData.params = { |
|
|
|
masterId:row.masterId |
|
|
|
masterId: row.masterId |
|
|
|
} |
|
|
|
await getDetailList() |
|
|
|
// 打开创建标签页面 |
|
|
@ -445,19 +525,19 @@ const buttonTableClick = async (val, row) => { |
|
|
|
pageNo: 1, |
|
|
|
code: item.itemCode, |
|
|
|
sort: '', |
|
|
|
by: 'ASC', |
|
|
|
}).then(res => { |
|
|
|
by: 'ASC' |
|
|
|
}).then((res) => { |
|
|
|
if (res.list.length > 0) { |
|
|
|
// 判断物料 可采购 可制造 |
|
|
|
if (res.list[0].enableMake == "FALSE") { |
|
|
|
if (res.list[0].enableMake == 'FALSE') { |
|
|
|
// 修改 tableform 属性 |
|
|
|
detailListTableColumns.tableFormColumns.map(itemColumns => { |
|
|
|
if(itemColumns.field == 'productionLineCodePackage') { |
|
|
|
detailListTableColumns.tableFormColumns.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'productionLineCodePackage') { |
|
|
|
// itemColumns.tableForm.isInpuFocusShow = false |
|
|
|
// itemColumns.tableForm.disabled = true |
|
|
|
ProductreceiptRequestLabelRules.productionLineCodePackage[0].required = false |
|
|
|
} |
|
|
|
if(itemColumns.field == 'supplierItemCode') { |
|
|
|
if (itemColumns.field == 'supplierItemCode') { |
|
|
|
itemColumns.tableForm.isInpuFocusShow = true |
|
|
|
itemColumns.tableForm.disabled = false |
|
|
|
ProductreceiptRequestLabelRules.supplierItemCode[0].required = true |
|
|
@ -465,13 +545,13 @@ const buttonTableClick = async (val, row) => { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 修改 tableform 属性 |
|
|
|
detailListTableColumns.tableFormColumns.map(itemColumns => { |
|
|
|
if(itemColumns.field == 'supplierItemCode') { |
|
|
|
detailListTableColumns.tableFormColumns.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'supplierItemCode') { |
|
|
|
itemColumns.tableForm.isInpuFocusShow = false |
|
|
|
itemColumns.tableForm.disabled = true |
|
|
|
ProductreceiptRequestLabelRules.supplierItemCode[0].required = false |
|
|
|
} |
|
|
|
if(itemColumns.field == 'productionLineCodePackage') { |
|
|
|
if (itemColumns.field == 'productionLineCodePackage') { |
|
|
|
item.productionLineCodePackage = item.productionLineCode |
|
|
|
// itemColumns.tableForm.isInpuFocusShow = true |
|
|
|
// itemColumns.tableForm.disabled = false |
|
|
@ -485,13 +565,13 @@ const buttonTableClick = async (val, row) => { |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} else if (val == 'mainHandle') { // 处理 |
|
|
|
} else if (val == 'mainHandle') { |
|
|
|
// 处理 |
|
|
|
// 判断 是否已创建标签 |
|
|
|
let isCreateLabel = false |
|
|
|
await PackageApi.getPackagePage({ |
|
|
|
requestNumber: row.number |
|
|
|
}).then(res => { |
|
|
|
}).then((res) => { |
|
|
|
if (res) { |
|
|
|
if (res.list.length > 0) isCreateLabel = true |
|
|
|
} |
|
|
@ -501,39 +581,44 @@ const buttonTableClick = async (val, row) => { |
|
|
|
return |
|
|
|
} |
|
|
|
tableObject.loading = true |
|
|
|
ProductreceiptRequestMainApi.handle(row.masterId).then(() => { |
|
|
|
ProductreceiptRequestMainApi.handle(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'edit') { // 编辑 |
|
|
|
} else if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.masterId) |
|
|
|
} else if (val == 'point') { // 标签打印 |
|
|
|
} else if (val == 'point') { |
|
|
|
// 标签打印 |
|
|
|
handlePoint(row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm =async (type: string, row?: number) => { |
|
|
|
const openForm = async (type: string, row?: number) => { |
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
// 编辑时 车间代码不可修改 |
|
|
|
if (type == 'update') { |
|
|
|
// 修改 tableform 属性 |
|
|
|
ProductreceiptRequestMain.allSchemas.formSchema.map(itemColumns => { |
|
|
|
if(itemColumns.field == 'workshopCode') { |
|
|
|
ProductreceiptRequestMain.allSchemas.formSchema.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'workshopCode') { |
|
|
|
itemColumns.componentProps.isSearchList = false |
|
|
|
itemColumns.componentProps.disabled = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 修改 tableform 属性 |
|
|
|
ProductreceiptRequestMain.allSchemas.formSchema.map(itemColumns => { |
|
|
|
if(itemColumns.field == 'workshopCode') { |
|
|
|
ProductreceiptRequestMain.allSchemas.formSchema.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'workshopCode') { |
|
|
|
itemColumns.componentProps.isSearchList = true |
|
|
|
itemColumns.componentProps.disabled = false |
|
|
|
} |
|
|
@ -547,9 +632,11 @@ const { wsCache } = useCache() |
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
|
|
|
const departmentCode = wsCache |
|
|
|
.get(CACHE_KEY.DEPT) |
|
|
|
.find((account) => account.id == row.departmentCode)?.name |
|
|
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue,'requestProductreceiptMain') |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestProductreceiptMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
@ -563,8 +650,9 @@ const handleDelete = async (id: number) => { |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
// 刷新列表 |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
} catch {}finally{ |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -578,7 +666,9 @@ const handleExport = async () => { |
|
|
|
// 发起导出 |
|
|
|
exportLoading.value = true |
|
|
|
const excelTitle = ref(route.meta.title) |
|
|
|
const data = await ProductreceiptRequestMainApi.exportProductreceiptRequestMain(tableObject.params) |
|
|
|
const data = await ProductreceiptRequestMainApi.exportProductreceiptRequestMain( |
|
|
|
tableObject.params |
|
|
|
) |
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
@ -588,9 +678,9 @@ const handleExport = async () => { |
|
|
|
|
|
|
|
/** |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const tableFormKeys = {} |
|
|
|
ProductreceiptRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
ProductreceiptRequestDetail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const tableData = ref([]) |
|
|
@ -604,25 +694,27 @@ const handleAddTable = () => { |
|
|
|
// 删除明细 |
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
|
if(itemIndex>-1){ |
|
|
|
if (itemIndex > -1) { |
|
|
|
tableData.value.splice(itemIndex, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
const tableSelectionDelete = (selection) => { |
|
|
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
|
|
|
tableData.value = tableData.value.filter((item) => !selection.includes(item)) |
|
|
|
} |
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
let data = {...submitData} |
|
|
|
if(data.masterId){ |
|
|
|
let data = { ...submitData } |
|
|
|
if (data.masterId) { |
|
|
|
data.id = data.masterId |
|
|
|
} |
|
|
|
tableData.value.forEach((row, index) => { |
|
|
|
row['expireDate'] = row['expireTime']?addDay(row['produceDate'],row['expireTime']).valueOf():dayjs('2099-12-31').valueOf() |
|
|
|
row['expireDate'] = row['expireTime'] |
|
|
|
? addDay(row['produceDate'], row['expireTime']).valueOf() |
|
|
|
: dayjs('2099-12-31').valueOf() |
|
|
|
}) |
|
|
|
data.type = 'predict' |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
if(data.subList.find(item => (item.qty <= 0))) { |
|
|
|
if (data.subList.find((item) => item.qty <= 0)) { |
|
|
|
message.warning('数量必须大于0') |
|
|
|
formRef.value.formLoading = false |
|
|
|
return |
|
|
@ -640,8 +732,8 @@ const submitForm = async (formType, submitData) => { |
|
|
|
// 刷新当前列表 |
|
|
|
if (formType === 'create') { |
|
|
|
getList() |
|
|
|
}else{ |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
} else { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} |
|
|
|
} finally { |
|
|
|
formRef.value.formLoading = false |
|
|
@ -676,19 +768,21 @@ const searchFormClick = (searchData) => { |
|
|
|
|
|
|
|
// 创建标签 |
|
|
|
const submitFormLabel = async (formType, submitData) => { |
|
|
|
let data = {...submitData} |
|
|
|
if(data.masterId){ |
|
|
|
let data = { ...submitData } |
|
|
|
if (data.masterId) { |
|
|
|
data.id = data.masterId |
|
|
|
} |
|
|
|
try { |
|
|
|
console.log("aaaaa",data); |
|
|
|
data.subList=detatableData.tableList |
|
|
|
console.log("bbbbb",data); |
|
|
|
console.log('aaaaa', data) |
|
|
|
data.subList = detatableData.tableList |
|
|
|
console.log('bbbbb', data) |
|
|
|
// 创建标签 要物料库区配置表中 入库包装规格 |
|
|
|
await ProductreceiptRequestMainApi.productCreateLabel(data).then(res => { |
|
|
|
await ProductreceiptRequestMainApi.productCreateLabel(data) |
|
|
|
.then((res) => { |
|
|
|
isCreateLabel.value = true |
|
|
|
message.success('创建标签成功') |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
isCreateLabel.value = false |
|
|
|
console.log(err) |
|
|
|
message.error('创建标签失败') |
|
|
@ -700,8 +794,9 @@ const submitFormLabel = async (formType, submitData) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 查看 Bom 按钮回调事件 |
|
|
|
const tableFormButton = async (val , row) => { |
|
|
|
if (val == 'bom') { // 查看 bom |
|
|
|
const tableFormButton = async (val, row) => { |
|
|
|
if (val == 'bom') { |
|
|
|
// 查看 bom |
|
|
|
bomModelVisible.value = true |
|
|
|
DialogTitle.value = '物料代码【' + row.itemCode + '】——Bom信息' |
|
|
|
detatableDataBom.params = { |
|
|
@ -713,14 +808,14 @@ const tableFormButton = async (val , row) => { |
|
|
|
|
|
|
|
// 子表新增/编辑校验 |
|
|
|
const detailValidate = (data) => { |
|
|
|
let tag = false; |
|
|
|
if(data.qty <= 0){ |
|
|
|
let tag = false |
|
|
|
if (data.qty <= 0) { |
|
|
|
message.warning('数量必须大于0') |
|
|
|
tag = false; |
|
|
|
return tag; |
|
|
|
}else { |
|
|
|
tag = true; |
|
|
|
return tag; |
|
|
|
tag = false |
|
|
|
return tag |
|
|
|
} else { |
|
|
|
tag = true |
|
|
|
return tag |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -730,8 +825,9 @@ const handlePoint = async (row) => { |
|
|
|
// 查询是否已创建过标签 |
|
|
|
await PackageApi.getPackagePage({ |
|
|
|
requestNumber: row.number |
|
|
|
}).then((res) => { |
|
|
|
if(res.list.length > 0) { |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res.list.length > 0) { |
|
|
|
isCreateLabel.value = true |
|
|
|
if (res.list[0].productionLineCode != null) { |
|
|
|
labelType.value = 'zz' |
|
|
@ -741,7 +837,8 @@ const handlePoint = async (row) => { |
|
|
|
} else { |
|
|
|
isCreateLabel.value = false |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
isCreateLabel.value = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
@ -765,58 +862,60 @@ const searchTableRef = ref() |
|
|
|
// |
|
|
|
const labelPrint = async (row) => { |
|
|
|
tableObject.loading = true |
|
|
|
const defaultParams = {'moduleName':'productreceipt_predict','recordNumber':row.number} |
|
|
|
const {tableObject:tableObjectPrint ,tableMethods} = useTable({ |
|
|
|
const defaultParams = { moduleName: 'productreceipt_predict', recordNumber: row.number } |
|
|
|
const { tableObject: tableObjectPrint, tableMethods } = useTable({ |
|
|
|
defaultParams, |
|
|
|
getListApi: PackageApi.getLabelDetailPage // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList:getListPrint } = tableMethods |
|
|
|
const { getList: getListPrint } = tableMethods |
|
|
|
getListPrint() |
|
|
|
tableObject.loading = false |
|
|
|
const tableColumns = SupplierdeliverRequestPackage.allSchemas.tableFormColumns |
|
|
|
tableColumns.forEach((item) => { |
|
|
|
item.width = item.table?.width || 150 |
|
|
|
}) |
|
|
|
searchTableRef.value.openData("标签信息",tableObjectPrint,{tableColumns},true) |
|
|
|
searchTableRef.value.openData('标签信息', tableObjectPrint, { tableColumns }, true) |
|
|
|
} |
|
|
|
|
|
|
|
// 批量打印--预生产收货 |
|
|
|
const searchTableSuccessLabel = async (formField, searchField, val, formRef, type, row) => { |
|
|
|
console.log('批量打印',val) |
|
|
|
console.log('批量打印', val) |
|
|
|
// let rows:any = [] |
|
|
|
// val.forEach(item=>{ |
|
|
|
// rows = [...rows,...item.selectionRows.map(item1=>item1.number)] |
|
|
|
// }) |
|
|
|
if(val.length == 0){ |
|
|
|
message.warning("请先选择要打印的数据!") |
|
|
|
if (val.length == 0) { |
|
|
|
message.warning('请先选择要打印的数据!') |
|
|
|
return |
|
|
|
} |
|
|
|
// window.open(src.value + '&asn_number=' + val.map(item1=>item1.number).join(',')) |
|
|
|
|
|
|
|
await PackageApi.batchPrintingLable(val.map(item1=>item1.number).join(',')).then(res => { |
|
|
|
await PackageApi.batchPrintingLable(val.map((item1) => item1.number).join(',')) |
|
|
|
.then((res) => { |
|
|
|
console.log(res) |
|
|
|
if (labelType.value == 'cg') { |
|
|
|
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken()) |
|
|
|
window.open(src.value+'&asn_number='+res) |
|
|
|
window.open(src.value + '&asn_number=' + res) |
|
|
|
} else { |
|
|
|
const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken()) |
|
|
|
window.open(src.value+'&asn_number='+res) |
|
|
|
window.open(src.value + '&asn_number=' + res) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err) |
|
|
|
message.error('创建标签失败') |
|
|
|
}) |
|
|
|
} |
|
|
|
const getDefaultWorkshopCode = async ()=>{ |
|
|
|
const getDefaultWorkshopCode = async () => { |
|
|
|
let res = await WorkshopApi.getWorkshopPage({ |
|
|
|
available: "TRUE" |
|
|
|
available: 'TRUE' |
|
|
|
}) |
|
|
|
if(res&&res.list.length>0){ |
|
|
|
if(res.list.find(item=>item.code=='PRC')){ |
|
|
|
ProductreceiptRequestMain.allSchemas.formSchema.map(itemColumns => { |
|
|
|
if(itemColumns.field == 'workshopCode') { |
|
|
|
if (res && res.list.length > 0) { |
|
|
|
if (res.list.find((item) => item.code == 'PRC')) { |
|
|
|
ProductreceiptRequestMain.allSchemas.formSchema.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'workshopCode') { |
|
|
|
itemColumns.value = 'PRC' |
|
|
|
} |
|
|
|
}) |
|
|
|