pull/4/head
qiuhongwu 8 months ago
parent 411428d486
commit 88dfe85d6a

@ -374,6 +374,7 @@ const handleStatus = async (num) => {
query.id = formData.value.id query.id = formData.value.id
query.type = 'update' query.type = 'update'
openerror() openerror()
reload() reload()
} }
@ -414,19 +415,23 @@ const UpError = (err, file, fileList) => {
} }
const openerror = () => { const openerror = () => {
setTimeout(() => {
//
ElMessageBox.alert( setTimeout(() => {
// 使 if(failedAttachmentsName.value.length>0){
`文件名为:${failedAttachmentsName.value}的上传失败`, //
`文件格式不正确或网络问题 请您稍微再试`, ElMessageBox.alert(
{ // 使
dangerouslyUseHTMLString: false, // 使HTMLfalse `文件名为:${failedAttachmentsName.value.join(' / ')}上传失败`,
confirmButtonText: '知道了', `文件格式不正确或网络问题 请您稍微再试`,
center: true {
} dangerouslyUseHTMLString: false, // 使HTMLfalse
) confirmButtonText: '知道了',
}, 1000) center: true
}
)
}
}, 1000)
} }
const refreshAttachments = (files, type) => { const refreshAttachments = (files, type) => {
@ -536,7 +541,6 @@ const submitForm = async () => {
query.type = 'update' query.type = 'update'
// //
openerror() openerror()
reload() reload()
} }

@ -9,8 +9,7 @@
<img src="/src/assets/imgs/status/statuszf.png" v-else-if="formData.status == 3" alt="" /> <img src="/src/assets/imgs/status/statuszf.png" v-else-if="formData.status == 3" alt="" />
<span v-else></span> <span v-else></span>
</div> </div>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading" <el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading" v-bind:disabled="isShowBtnOther">
v-bind:disabled="isShowBtnOther">
<!-- 基础信息 --> <!-- 基础信息 -->
<el-card class="hl-card-info"> <el-card class="hl-card-info">
<template #header> <template #header>
@ -29,8 +28,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="stockInType" label="出库类型"> <el-form-item prop="stockInType" label="出库类型">
<el-select v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType" v-bind:disabled="ctrView || ctrSave"> <el-select v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType" v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_TYPE)" :key="dict.value" <el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" />
:label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -41,8 +39,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="industry" label="单据状态"> <el-form-item prop="industry" label="单据状态">
<el-select v-model="formData.status" placeholder="下拉选择" clearable class="!w-700px" disabled> <el-select v-model="formData.status" placeholder="下拉选择" clearable class="!w-700px" disabled>
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_STATUS)" :key="dict.value" <el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_STATUS)" :key="dict.value" :label="dict.label" :value="dict.value" />
:label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -50,7 +47,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="headerNo" label="上游单号"> <el-form-item prop="headerNo" label="上游单号">
<el-input v-model="formData.headerNo" class="!w-700px" v-bind:disabled="ctrView || ctrSave || enableHeadNo"/> <el-input v-model="formData.headerNo" class="!w-700px" v-bind:disabled="ctrView || ctrSave || enableHeadNo" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -59,16 +56,14 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="单据日期" prop="createTime"> <el-form-item label="单据日期" prop="createTime">
<el-date-picker v-model="formData.createTime" value-format="x" placeholder="单据日期" disabled <el-date-picker v-model="formData.createTime" value-format="x" placeholder="单据日期" disabled class="!w-400px" />
class="!w-400px" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="whId" label="出库仓库" required> <el-form-item prop="whId" label="出库仓库" required>
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" <el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" v-bind:disabled="ctrView || ctrSave">
v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" /> <el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -79,7 +74,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="description"> <el-form-item label="备注" prop="description">
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" class="!w-2080px" v-bind:disabled="ctrView || ctrSave"/> <el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" class="!w-2080px" v-bind:disabled="ctrView || ctrSave" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -95,17 +90,14 @@
<el-col> <el-col>
<el-button class="hl-addbutton" type="primary" size="large" v-bind:disabled="ctrView || ctrSave" @click="onAddItem"></el-button> <el-button class="hl-addbutton" type="primary" size="large" v-bind:disabled="ctrView || ctrSave" @click="onAddItem"></el-button>
</el-col> </el-col>
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules" <el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules" v-loading="subFormLoading" label-width="0">
v-loading="subFormLoading" label-width="0">
<el-table :data="formData.matItemDOList" class="hl-table"> <el-table :data="formData.matItemDOList" class="hl-table">
<el-table-column prop="cid" label="序号" :width="80" /> <el-table-column prop="cid" label="序号" :width="80" />
<el-table-column prop="matId" min-width="140" align="center"> <el-table-column prop="matId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span>物料名称 </template> <template #header> <span class="hl-table_header">*</span>物料名称 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!">
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatNameSearch" v-bind:disabled="ctrView || ctrSave" <el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatNameSearch" v-bind:disabled="ctrView || ctrSave" remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" @change="(val) => handleMatName(scope, val)" class="!w-180px">
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading"
@change="(val) => handleMatName(scope, val)" class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -114,24 +106,21 @@
<el-table-column prop="matCode" label="物料编码" min-width="120" align="center" /> <el-table-column prop="matCode" label="物料编码" min-width="120" align="center" />
<el-table-column prop="matType" label="物料类型" min-width="120" align="center"> <el-table-column prop="matType" label="物料类型" min-width="120" align="center">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" <dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" v-if="scope.row.matType ? true : false" />
v-if="scope.row.matType ? true : false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" /> <el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" />
<el-table-column prop="matUnit" label="系统单位" min-width="120" align="center"> <el-table-column prop="matUnit" label="系统单位" min-width="120" align="center">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" <dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" v-if="scope.row.matUnit ? true : false" />
v-if="scope.row.matUnit ? true : false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rgId" min-width="120" align="center"> <el-table-column prop="rgId" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>出库库区 </template> <template #header> <span class="hl-table_header">*</span>出库库区 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" <el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" v-bind:disabled="true">
v-bind:disabled="true">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rg_name" :value="dict.id" /> <el-option v-for="dict in rgList" :key="dict.id" :label="dict.rg_name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -142,8 +131,7 @@
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="ctrView || ctrSave" @change="handlePn(scope)"> <el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="ctrView || ctrSave" @change="handlePn(scope)">
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name" <el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name" :value="dict.id" />
:value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
@ -152,16 +140,15 @@
<el-table-column prop="storageOkQty" min-width="120" align="center"> <el-table-column prop="storageOkQty" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>出库数量</template> <template #header> <span class="hl-table_header">*</span>出库数量</template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" <el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" class="mb-0px!">
class="mb-0px!"> <el-input v-model="scope.row.storageOkQty" v-bind:disabled="ctrView || ctrSave" />
<el-input v-model="scope.row.storageOkQty" v-bind:disabled="ctrView || ctrSave"/>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" v-if="false" /> <el-table-column prop="lotNo" min-width="120" label="批次号" align="center" v-if="false" />
<el-table-column prop="description" min-width="180" label="备注" align="center"> <el-table-column prop="description" min-width="180" label="备注" align="center">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.description" v-bind:disabled="ctrView || ctrSave"/> <el-input v-model="scope.row.description" v-bind:disabled="ctrView || ctrSave" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="240"> <el-table-column label="操作" align="center" width="240">
@ -175,8 +162,7 @@
</el-button> </el-button>
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> --> <el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> -->
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)" <el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)" v-bind:disabled="ctrView || ctrDelete">
v-bind:disabled="ctrView || ctrDelete">
删除 删除
</el-button> </el-button>
</template> </template>
@ -196,15 +182,12 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-upload ref="matUploadRef" :file-list="matUploadFiles" multiple :limit="10" :action="uploadUrl" <el-upload ref="matUploadRef" :file-list="matUploadFiles" multiple :limit="10" :action="uploadUrl" :headers="{
:headers="{
Authorization: 'Bearer ' + getAccessToken(), Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId() 'tenant-id': getTenantId()
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData" }" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData" :on-change="matUploadChange" :on-error="UpError" class="upload-file-uploader">
:on-change="matUploadChange"
:on-error="UpError" class="upload-file-uploader" >
<el-button type="primary" v-bind:disabled="ctrView || ctrSave"> <el-button type="primary" v-bind:disabled="ctrView || ctrSave">
<Icon icon="ep:upload-filled" />上传 <Icon icon="ep:upload-filled" />上传
</el-button> </el-button>
</el-upload> </el-upload>
</el-col> </el-col>
@ -219,12 +202,10 @@
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button link type="danger" size="small" v-bind:disabled="ctrView || ctrDelete" <el-button link type="danger" size="small" v-bind:disabled="ctrView || ctrDelete" @click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
删除 删除
</el-button> </el-button>
<el-button link type="primary" size="small" v-bind:disabled="ctrView || ctrDelete" <el-button link type="primary" size="small" v-bind:disabled="ctrView || ctrDelete" @click="downloadAttachment(scope.row.name, scope.row.url)">
@click="downloadAttachment(scope.row.name, scope.row.url)">
下载 下载
</el-button> </el-button>
</template> </template>
@ -280,11 +261,11 @@
</el-form> </el-form>
<div class="text-center hl-footer"> <div class="text-center hl-footer">
<el-button @click="() => router.go(-1)" size="large"> </el-button> <el-button @click="() => router.go(-1)" size="large"> </el-button>
<el-button @click="submitForm" type="success" v-if="btnSave" size="large"> <el-button @click="submitForm" type="success" v-if="btnSave" size="large">
</el-button> </el-button>
<el-button @click="handleStatus(2)" type="primary" v-if="btnSave" size="large"> <el-button @click="handleStatus(2)" type="primary" v-if="btnSave" size="large">
</el-button> </el-button>
<el-button @click="handleStatus(3)" type="danger" v-if="btnCancel" size="large"> <el-button @click="handleStatus(3)" type="danger" v-if="btnCancel" size="large">
</el-button> </el-button>
</div> </div>
</el-card> </el-card>
@ -364,16 +345,13 @@ const handleStockType = async (typeid) => {
if (typeid == 1) { if (typeid == 1) {
enableHeadNo.value = false enableHeadNo.value = false
} else { } else {
enableHeadNo.value = true enableHeadNo.value = true
} }
} }
const handleStatus = async (num) => { const handleStatus = async (num) => {
formData.value.status = num formData.value.status = num
const data = formData.value as unknown as StorageApi.StorageVO const data = formData.value as unknown as StorageApi.StorageVO
if(num==2){ if (num == 2) {
// //
await formRef.value.validate() await formRef.value.validate()
if (formData.value.matItemDOList.length === 0) { if (formData.value.matItemDOList.length === 0) {
@ -386,8 +364,8 @@ const handleStatus = async (num) => {
} catch (e) { } catch (e) {
return return
} }
// //
const matCurrentData = await StorageMatApi.getStorageMatList(0) const matCurrentData = await StorageMatApi.getStorageMatList(0)
var hasRestNum = true var hasRestNum = true
formData.value.matItemDOList.forEach((rest) => { formData.value.matItemDOList.forEach((rest) => {
if ( if (
@ -396,7 +374,8 @@ const handleStatus = async (num) => {
mat.matId == rest.matId && mat.matId == rest.matId &&
mat.pnId == rest.pnId && mat.pnId == rest.pnId &&
mat.matRest < Number(rest.storageOkQty) mat.matRest < Number(rest.storageOkQty)
) !== undefined || rest.storageOkQty.length ==0 ) !== undefined ||
rest.storageOkQty.length == 0
) { ) {
hasRestNum = false hasRestNum = false
} }
@ -411,11 +390,10 @@ const handleStatus = async (num) => {
await saveFormData() await saveFormData()
data.outbound = useUserStore().getUser.id data.outbound = useUserStore().getUser.id
} else {
}else{ await StorageApi.updateStorage(data)
await StorageApi.updateStorage(data) data.cancel = useUserStore().getUser.id
data.cancel = useUserStore().getUser.id commonResult = 'common.updateSuccess'
commonResult = 'common.updateSuccess'
} }
await StorageApi.updateStorageStatus(data) await StorageApi.updateStorageStatus(data)
@ -423,11 +401,10 @@ const handleStatus = async (num) => {
query.id = formData.value.id query.id = formData.value.id
query.type = 'update' query.type = 'update'
openerror() openerror()
reload() reload()
} }
// ==================== ======================================= // ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL) const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
const matUploadRef = ref() const matUploadRef = ref()
@ -456,21 +433,22 @@ const UpError = (err, file, fileList) => {
const openerror = () => { const openerror = () => {
setTimeout(() => { setTimeout(() => {
// if (failedAttachmentsName.value.length > 0) {
ElMessageBox.alert( //
// 使 ElMessageBox.alert(
`文件名为:${failedAttachmentsName.value}的上传失败`, // 使
`文件格式不正确或网络问题 请您稍微再试`, `文件名为:${failedAttachmentsName.value.join(' / ')}上传失败`,
{ `文件格式不正确或网络问题 请您稍微再试`,
dangerouslyUseHTMLString: false, // 使HTMLfalse {
confirmButtonText: '知道了', dangerouslyUseHTMLString: false,
center: true confirmButtonText: '知道了',
} center: true
) }
)
}
}, 1000) }, 1000)
} }
const refreshAttachments = (files, type) => { const refreshAttachments = (files, type) => {
formData.value.attachments = formData.value.attachments.filter((value) => value.id) formData.value.attachments = formData.value.attachments.filter((value) => value.id)
@ -529,7 +507,6 @@ const saveFormData = async () => {
formData.value.id = await StorageApi.createStorage(data) formData.value.id = await StorageApi.createStorage(data)
commonResult = 'common.createSuccess' commonResult = 'common.createSuccess'
} else { } else {
await StorageApi.updateStorage(data) await StorageApi.updateStorage(data)
commonResult = 'common.updateSuccess' commonResult = 'common.updateSuccess'
} }
@ -576,7 +553,8 @@ const submitForm = async () => {
mat.matId == rest.matId && mat.matId == rest.matId &&
mat.pnId == rest.pnId && mat.pnId == rest.pnId &&
mat.matRest < Number(rest.storageOkQty) mat.matRest < Number(rest.storageOkQty)
) !== undefined || rest.storageOkQty.length ==0 ) !== undefined ||
rest.storageOkQty.length == 0
) { ) {
hasRestNum = false hasRestNum = false
} }
@ -601,7 +579,6 @@ const submitForm = async () => {
var matCount = 1 var matCount = 1
const onAddItem = () => { const onAddItem = () => {
if (formData.value.whId) { if (formData.value.whId) {
const newData = { const newData = {
// //
@ -621,7 +598,7 @@ const onAddItem = () => {
lotNo: '', lotNo: '',
description: '', description: '',
productBomItemValueDOList: [], productBomItemValueDOList: [],
matList : matList.value matList: matList.value
} }
matCount = matCount + 1 matCount = matCount + 1
@ -648,47 +625,62 @@ const handleWh = async (wid) => {
formData.value.rgId = '' formData.value.rgId = ''
// //
rgList.value = (await RgApi.getSimpList()).filter( rg => rg.wh_id == wid) rgList.value = (await RgApi.getSimpList()).filter((rg) => rg.wh_id == wid)
// //
pnList.value = (await PnApi.getSimpList()).filter( pn => pn.wh_id == wid) pnList.value = (await PnApi.getSimpList()).filter((pn) => pn.wh_id == wid)
//await getMatList() //await getMatList()
} }
const getMatList = async (name) =>{ const getMatList = async (name) => {
// //
let matParams = { let matParams = {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
status: '1' status: '1'
} }
if(name.length>0){ if (name.length > 0) {
matParams.name = name matParams.name = name
} }
//const matLastRemoteData = await StorageMatApi.getStorageMatList(0) //const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
const dataMat = await MaterialApi.getMaterialPage(matParams) const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = dataMat.list matList.value = dataMat.list
// matList.value = dataMat.list.filter( // matList.value = dataMat.list.filter(
// (item) => // (item) =>
// matLastRemoteData.find( // matLastRemoteData.find(
// (fish) => fish.matId === item.id && fish.whId == formData.value.whId // (fish) => fish.matId === item.id && fish.whId == formData.value.whId
// ) !== undefined // ) !== undefined
// ) // )
} }
const handlePn = async (scope) =>{ const handlePn = async (scope) => {
scope.row.matList = matList.value scope.row.matList = matList.value
var repeatItem = formData.value.matItemDOList.filter( mat => mat.matId==scope.row.matId && mat.pnId == scope.row.pnId) var repeatItem = formData.value.matItemDOList.filter(
if(repeatItem.length>1){ (mat) => mat.matId == scope.row.matId && mat.pnId == scope.row.pnId
message.alertWarning('物料编码['+repeatItem[0].matCode+']出库库位存在多行数据,请修改,避免重复出库') )
return if (repeatItem.length > 1) {
message.alertWarning(
'物料编码[' + repeatItem[0].matCode + ']出库库位存在多行数据,请修改,避免重复出库'
)
return
} }
if (matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.pnId == scope.row.pnId)) { if (
const matVo = matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.pnId == scope.row.pnId) matLastData.value.find(
(item) =>
item.matId === scope.row.matId &&
item.whId == formData.value.whId &&
item.pnId == scope.row.pnId
)
) {
const matVo = matLastData.value.find(
(item) =>
item.matId === scope.row.matId &&
item.whId == formData.value.whId &&
item.pnId == scope.row.pnId
)
// scope.row.matId = matVo.matId // scope.row.matId = matVo.matId
// scope.row.matName = matVo.matName // scope.row.matName = matVo.matName
// scope.row.matCode = matVo.matCode // scope.row.matCode = matVo.matCode
@ -701,15 +693,13 @@ const handlePn = async (scope) =>{
// scope.row.storageOkQty = matVo.storageOkQty // scope.row.storageOkQty = matVo.storageOkQty
// scope.row.lotNo = matVo.lotNo // scope.row.lotNo = matVo.lotNo
// scope.row.description = matVo.description // scope.row.description = matVo.description
} else {
} else{
scope.row.rgId = '' scope.row.rgId = ''
scope.row.matRest = '0' scope.row.matRest = '0'
message.alertWarning('当前库位无库存数量可出库') message.alertWarning('当前库位无库存数量可出库')
} }
} }
const matSelectLoading = ref(false) const matSelectLoading = ref(false)
const remoteMatNameSearch = async (name) => { const remoteMatNameSearch = async (name) => {
matSelectLoading.value = true matSelectLoading.value = true
@ -719,20 +709,23 @@ const remoteMatNameSearch = async (name) => {
} }
const handleMatName = async (scope, matid) => { const handleMatName = async (scope, matid) => {
scope.row.matId = scope.row.matList.find((item) => item.id === matid)?.id scope.row.matId = scope.row.matList.find((item) => item.id === matid)?.id
scope.row.matName = scope.row.matList.find((item) => item.id === matid)?.name scope.row.matName = scope.row.matList.find((item) => item.id === matid)?.name
scope.row.matCode = scope.row.matList.find((item) => item.id === matid)?.code scope.row.matCode = scope.row.matList.find((item) => item.id === matid)?.code
scope.row.matSpec = scope.row.matList.find((item) => item.id === matid)?.spec scope.row.matSpec = scope.row.matList.find((item) => item.id === matid)?.spec
scope.row.matType = scope.row.matList.find((item) => item.id === matid)?.materialType scope.row.matType = scope.row.matList.find((item) => item.id === matid)?.materialType
scope.row.matUnit = scope.row.matList.find((item) => item.id === matid)?.unit scope.row.matUnit = scope.row.matList.find((item) => item.id === matid)?.unit
scope.row.rgId = '' scope.row.rgId = ''
scope.row.pnId = '' scope.row.pnId = ''
if(matid.length==0){ if (matid.length == 0) {
}
}
scope.row.pnlist = pnList.value.filter(pn => pn.wh_id == formData.value.whId && matLastData.value.filter( mat => mat.matId == matid && mat.pnId == pn.id).length>0) scope.row.pnlist = pnList.value.filter(
(pn) =>
pn.wh_id == formData.value.whId &&
matLastData.value.filter((mat) => mat.matId == matid && mat.pnId == pn.id).length > 0
)
} }
const matLastData = ref([]) const matLastData = ref([])
@ -746,14 +739,14 @@ const btnCancel = ref(false)
// //
const initStatus = async (status) => { const initStatus = async (status) => {
switch(status){ switch (status) {
case 1: case 1:
ctrView.value = false ctrView.value = false
ctrSave.value = false ctrSave.value = false
ctrCancel.value = true ctrCancel.value = true
ctrDelete.value = false ctrDelete.value = false
btnSave.value= true btnSave.value = true
btnCancel.value = false btnCancel.value = false
break break
case 2: case 2:
@ -761,7 +754,7 @@ const initStatus = async (status) => {
ctrSave.value = true ctrSave.value = true
ctrCancel.value = false ctrCancel.value = false
ctrDelete.value = true ctrDelete.value = true
btnSave.value= false btnSave.value = false
btnCancel.value = true btnCancel.value = true
break break
case 3: case 3:
@ -769,21 +762,21 @@ const initStatus = async (status) => {
ctrSave.value = true ctrSave.value = true
ctrCancel.value = true ctrCancel.value = true
ctrDelete.value = true ctrDelete.value = true
btnSave.value= false btnSave.value = false
btnCancel.value = false btnCancel.value = false
break break
default: default:
break break
} }
// //
if(query.type === 'review'){ if (query.type === 'review') {
ctrView.value = true ctrView.value = true
ctrSave.value = true ctrSave.value = true
ctrCancel.value = true ctrCancel.value = true
ctrDelete.value = true ctrDelete.value = true
btnSave.value= false btnSave.value = false
btnCancel.value = false btnCancel.value = false
} }
} }
const matList = ref<MaterialApi.MaterialVO[]>([]) // const matList = ref<MaterialApi.MaterialVO[]>([]) //
@ -793,7 +786,6 @@ const matSimpList = ref([]) // 物料基本信息列表
const matSimpVirtualList = ref([]) // const matSimpVirtualList = ref([]) //
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
// //
dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type) dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type)
@ -808,17 +800,15 @@ onMounted(async () => {
// //
if (query.id) { if (query.id) {
// //
matSimpList.value = await MaterialApi.getSimpList() matSimpList.value = await MaterialApi.getSimpList()
matSimpVirtualList.value = await MaterialApi.getSimpVirtualList() matSimpVirtualList.value = await MaterialApi.getSimpVirtualList()
matEditList.value = matSimpList.value //matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0) matEditList.value = matSimpList.value //matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0)
// //
formData.value = await StorageApi.getStorage(query.id) formData.value = await StorageApi.getStorage(query.id)
if(formData.value.vmatName){ if (formData.value.vmatName) {
matEditList.value = matSimpVirtualList.value matEditList.value = matSimpVirtualList.value
} }
@ -827,11 +817,11 @@ onMounted(async () => {
// //
const dataRgList = await RgApi.getSimpList() const dataRgList = await RgApi.getSimpList()
rgList.value = dataRgList.filter( rg => rg.wh_id == formData.value.whId) rgList.value = dataRgList.filter((rg) => rg.wh_id == formData.value.whId)
// //
const dataPnList = await PnApi.getSimpList() const dataPnList = await PnApi.getSimpList()
pnList.value = dataPnList.filter( pn => pn.wh_id == formData.value.whId) pnList.value = dataPnList.filter((pn) => pn.wh_id == formData.value.whId)
// //
const queryParamsMat = reactive({ const queryParamsMat = reactive({
@ -845,13 +835,15 @@ onMounted(async () => {
formData.value.matItemDOList.forEach((item) => { formData.value.matItemDOList.forEach((item) => {
item.cid = matCount item.cid = matCount
item.matId = matEditList.value.find((record) => record.id === item.matId)?.id item.matId = matEditList.value.find((record) => record.id === item.matId)?.id
item.matCode = matEditList.value.find( (record) => record.id === item.matId)?.code item.matCode = matEditList.value.find((record) => record.id === item.matId)?.code
item.matName = matEditList.value.find((record) => record.id === item.matId)?.name item.matName = matEditList.value.find((record) => record.id === item.matId)?.name
item.matSpec = matEditList.value.find((record) => record.id === item.matId)?.spec item.matSpec = matEditList.value.find((record) => record.id === item.matId)?.spec
item.matType = matEditList.value.find((record) => record.id === item.matId)?.material_type item.matType = matEditList.value.find((record) => record.id === item.matId)?.material_type
item.matUnit = matEditList.value.find((record) => record.id === item.matId)?.unit item.matUnit = matEditList.value.find((record) => record.id === item.matId)?.unit
item.matRest = matLastData.value.find( row => row.matId == item.matId && row.pnId == item.pnId)?.matRest item.matRest = matLastData.value.find(
item.matRest = (item.matRest==undefined || item.matRest.length==0)?0:item.matRest (row) => row.matId == item.matId && row.pnId == item.pnId
)?.matRest
item.matRest = item.matRest == undefined || item.matRest.length == 0 ? 0 : item.matRest
item.pnlist = pnList.value.filter((pn) => pn.wh_id === item.whId) item.pnlist = pnList.value.filter((pn) => pn.wh_id === item.whId)
item.matList = matEditList.value.filter((record) => record.id === item.matId) item.matList = matEditList.value.filter((record) => record.id === item.matId)
matCount = matCount + 1 matCount = matCount + 1

Loading…
Cancel
Save