|
@@ -3,7 +3,9 @@
|
|
|
<div class="form-container column-container">
|
|
|
<div class="form-btns-container">
|
|
|
<span class="title-label">
|
|
|
- <el-icon><Document /></el-icon>
|
|
|
+ <el-icon>
|
|
|
+ <Document />
|
|
|
+ </el-icon>
|
|
|
<span>收回单信息</span>
|
|
|
</span>
|
|
|
<el-button-group>
|
|
@@ -24,13 +26,8 @@
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="表单日期" prop="formDate">
|
|
|
- <el-date-picker
|
|
|
- v-if="editStatus"
|
|
|
- v-model="form.formDate"
|
|
|
- type="date"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
+ <el-date-picker v-if="editStatus" v-model="form.formDate" type="date" value-format="YYYY-MM-DD"
|
|
|
+ style="width: 100%">
|
|
|
</el-date-picker>
|
|
|
<el-input v-model="form.formDate" v-else readonly />
|
|
|
</el-form-item>
|
|
@@ -47,7 +44,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="form.remark" v-if ="editStatus" />
|
|
|
+ <el-input v-model="form.remark" v-if="editStatus" />
|
|
|
<el-input v-model="form.remark" v-else readonly />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -55,7 +52,8 @@
|
|
|
</el-form>
|
|
|
<!-- 渲染数据区 -->
|
|
|
<div class="form-details-btns-container">
|
|
|
- <el-button type="primary" icon="Plus" v-if="form.supplierName!=''" :disabled="!editStatus" @click="handleShowDialogOutSourceDetails"> 添加收回明细 </el-button>
|
|
|
+ <el-button type="primary" icon="Plus" v-if="form.supplierName != ''" :disabled="!editStatus"
|
|
|
+ @click="handleShowDialogOutSourceDetails"> 添加收回明细 </el-button>
|
|
|
</div>
|
|
|
<div class="el-table-container">
|
|
|
<div class="el-table-inner-container">
|
|
@@ -64,28 +62,14 @@
|
|
|
<el-table-column label="批次号" align="center" prop="lotCode" width="104" />
|
|
|
<el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
|
|
|
<el-table-column label="产品数量" align="center" prop="productNum" width="96" />
|
|
|
- <el-table-column
|
|
|
- label ='原箱号'
|
|
|
- align="center"
|
|
|
- prop="originalCarrier"
|
|
|
- width="320"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- label="新箱号"
|
|
|
- align="center"
|
|
|
- prop="newCarrier"
|
|
|
- width="320"
|
|
|
- />
|
|
|
+ <el-table-column label='原箱号' align="center" prop="originalCarrier" width="320" />
|
|
|
+ <el-table-column label="新箱号" align="center" prop="newCarrier" width="320" />
|
|
|
<el-table-column label="外协工序" align="center" prop="processAlias" width="120" />
|
|
|
- <el-table-column label="收回数量" align="center" prop="receiptNum" width="104"/>
|
|
|
+ <el-table-column label="收回数量" align="center" prop="receiptNum" width="104" />
|
|
|
<el-table-column label="确定数量" align="center" prop="auditNum" width="104">
|
|
|
<template #default="scope">
|
|
|
- <el-input-number
|
|
|
- v-model="scope.row.auditNum"
|
|
|
- :min="0"
|
|
|
- controls-position="right"
|
|
|
- style="text-align: center"
|
|
|
- />
|
|
|
+ <el-input-number v-model="scope.row.auditNum" :min="0" controls-position="right"
|
|
|
+ style="text-align: center" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="备注" align="center" prop="remark">
|
|
@@ -96,43 +80,31 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="审核状态" align="center" prop="status" width="200">
|
|
|
<template #default="scope">
|
|
|
- <el-switch
|
|
|
- v-model="scope.row.status"
|
|
|
- style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- active-text="已审核"
|
|
|
- inactive-text="未审核"
|
|
|
- @change="handleChangeAuditStatus(scope.row)"
|
|
|
- />
|
|
|
+ <el-switch v-model="scope.row.status"
|
|
|
+ style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" :active-value="1"
|
|
|
+ :inactive-value="0" active-text="已审核" inactive-text="未审核"
|
|
|
+ @change="handleChangeAuditStatus(scope.row)" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="反选" align="center" width="100">
|
|
|
<template #default="scope">
|
|
|
- <el-button
|
|
|
- icon="delete"
|
|
|
- link
|
|
|
- type="danger"
|
|
|
- @click="handleDelReturnReceiveDetail(scope.row)"
|
|
|
- >删除
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-button icon="delete" link type="danger" @click="handleDelReturnReceiveDetail(scope.row)">删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 收回明细选择 -->
|
|
|
- <dialog-outsource-details
|
|
|
- ref="dialogOutsourceDetailsRef"
|
|
|
- :multiple-selected="handleMultipleSelectedOutsourceDetails"
|
|
|
- />
|
|
|
+ <!-- 收回明细选择 -->
|
|
|
+ <dialog-outsource-details ref="dialogOutsourceDetailsRef"
|
|
|
+ :multiple-selected="handleMultipleSelectedOutsourceDetails" />
|
|
|
<!-- 外协商选择 -->
|
|
|
<dialog-suppliers ref="dialogSuppliersRef" :single-selected="handleSingleSelectedSuppliers" />
|
|
|
</el-drawer>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { getReceipt,addReceipt,updateReceipt} from '@/api/business/returnReceipt'
|
|
|
+import { getReceipt, addReceipt, updateReceipt } from '@/api/business/returnReceipt'
|
|
|
import dialogOutsourceDetails from './DialogOutsourceDetails'
|
|
|
import dialogSuppliers from './DialogSuppliers'
|
|
|
const emit = defineEmits(['handleSaveSuccess'])
|
|
@@ -189,7 +161,7 @@ const handleShowDialogSuppliers = () => {
|
|
|
const handleSingleSelectedSuppliers = (selection) => {
|
|
|
console.log(selection)
|
|
|
//如果收回明细已存在,切换外协商名字,删除添加的收回明细
|
|
|
- if(selection.id != form.value.supplierId && form.value.details.length>0) {
|
|
|
+ if (selection.id != form.value.supplierId && form.value.details.length > 0) {
|
|
|
form.value.details = []
|
|
|
}
|
|
|
form.value.supplierId = selection.id
|
|
@@ -198,7 +170,7 @@ const handleSingleSelectedSuppliers = (selection) => {
|
|
|
/***************************** 外协明细对话框相关 *****************************/
|
|
|
// 打开外协明细选择对话框
|
|
|
const handleShowDialogOutSourceDetails = () => {
|
|
|
- var info = {}
|
|
|
+ var info = {}
|
|
|
info.outsourceDetailIds = form.value.details.map((item) => item.outsourceDetailId)
|
|
|
info.supplierId = form.value.supplierId
|
|
|
proxy.$refs.dialogOutsourceDetailsRef.open(info)
|
|
@@ -206,96 +178,120 @@ const handleShowDialogOutSourceDetails = () => {
|
|
|
// 外协明细选择带回
|
|
|
const handleMultipleSelectedOutsourceDetails = (selection) => {
|
|
|
console.log(selection)
|
|
|
- for(let i = 0;i<selection.length;i++) {
|
|
|
- for(let j = 0;j<selection[i].processes.length;j++) {
|
|
|
+ for (let i = 0; i < selection.length; i++) {
|
|
|
+ for (let j = 0; j < selection[i].processes.length; j++) {
|
|
|
const newDetail = {
|
|
|
- outsourceDetailId: selection[i].id,
|
|
|
- productDescription: selection[i].productDescription,
|
|
|
- lotCode:selection[i].lotCode,
|
|
|
- lotId:selection[i].lotId,
|
|
|
- dayworkId:selection[i].dayworkId,
|
|
|
- productId:selection[i].productId,
|
|
|
- productNum: selection[i].productNum,
|
|
|
- receiptNum: selection[i].processes[j].qualifiedNum?selection[i].processes[j].qualifiedNum:0,
|
|
|
- originalCarrier:selection[i].originalCarrier,
|
|
|
- originalCarrierCount:selection[i].originalCarrierCount,
|
|
|
- newCarrier:selection[i].newCarrier,
|
|
|
- newCarrierCount:selection[i].newCarrierCount,
|
|
|
- processNames: selection[i].processNames,
|
|
|
- remark: '',
|
|
|
- technologicalProcessId:selection[i].processes[j].technologicalProcessId,
|
|
|
- technologyVersion:selection[i].processes[j].technologyVersion,
|
|
|
- technologicalProcessDetailId:selection[i].processes[j].technologicalProcessDetailId,
|
|
|
- processId:selection[i].processes[j].processId,
|
|
|
- processAlias:selection[i].processes[j].processAlias,
|
|
|
- processCode:selection[i].processes[j].processCode,
|
|
|
- processStepNumber:selection[i].processes[j].processStepNumber,
|
|
|
- status:0,
|
|
|
- auditNum:0
|
|
|
+ outsourceDetailId: selection[i].id,
|
|
|
+ productDescription: selection[i].productDescription,
|
|
|
+ lotCode: selection[i].lotCode,
|
|
|
+ lotId: selection[i].lotId,
|
|
|
+ dayworkId: selection[i].dayworkId,
|
|
|
+ productId: selection[i].productId,
|
|
|
+ productNum: selection[i].productNum,
|
|
|
+ receiptNum: selection[i].processes[j].qualifiedNum ? selection[i].processes[j].qualifiedNum : 0,
|
|
|
+ originalCarrier: selection[i].originalCarrier,
|
|
|
+ originalCarrierCount: selection[i].originalCarrierCount,
|
|
|
+ newCarrier: selection[i].newCarrier,
|
|
|
+ newCarrierCount: selection[i].newCarrierCount,
|
|
|
+ processNames: selection[i].processNames,
|
|
|
+ remark: '',
|
|
|
+ technologicalProcessId: selection[i].processes[j].technologicalProcessId,
|
|
|
+ technologyVersion: selection[i].processes[j].technologyVersion,
|
|
|
+ technologicalProcessDetailId: selection[i].processes[j].technologicalProcessDetailId,
|
|
|
+ processId: selection[i].processes[j].processId,
|
|
|
+ processAlias: selection[i].processes[j].processAlias,
|
|
|
+ processCode: selection[i].processes[j].processCode,
|
|
|
+ processStepNumber: selection[i].processes[j].processStepNumber,
|
|
|
+ status: 0,
|
|
|
+ auditNum: 0
|
|
|
}
|
|
|
- form.value.details.push(newDetail)
|
|
|
- }
|
|
|
+ form.value.details.push(newDetail)
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
//审核状态按钮
|
|
|
function handleChangeAuditStatus(row) {
|
|
|
-console.log(row)
|
|
|
+ console.log(row)
|
|
|
}
|
|
|
/** 提交按钮 */
|
|
|
function submitForm() {
|
|
|
proxy.$refs['formRef'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
var flag = true;
|
|
|
+ var confirmFlag = false;
|
|
|
for (let i = 0; i < form.value.details.length; i++) {
|
|
|
var tempList = form.value.details.filter(item => {
|
|
|
- return item.lotId ==form.value.details[i].lotId
|
|
|
- })
|
|
|
+ return item.lotId == form.value.details[i].lotId
|
|
|
+ })
|
|
|
//如果外协填入收回数量,则判断确定数量不能大于收回数量
|
|
|
- if(form.value.details[i].receiptNum > 0) {
|
|
|
- if(form.value.details[i].auditNum > form.value.details[i].receiptNum) {
|
|
|
- flag = false
|
|
|
- proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能大于收回数量')
|
|
|
- }
|
|
|
- }//外协没填收回数量
|
|
|
- else {
|
|
|
- //外协没填收回数量,第一行工序确定数量不能超过产品数量,第二行工序确定数量不能超过上一道序的确定数量
|
|
|
- var index = tempList.indexOf(form.value.details[i])
|
|
|
- if(index>0 && form.value.details[i].auditNum > tempList[index-1].auditNum) {
|
|
|
- flag = false
|
|
|
- proxy.$modal.msgError('第' + (i + 1) +'行确定数量不能超过上一道序的确定数量')
|
|
|
- }
|
|
|
- if(form.value.details[i].auditNum > form.value.details[i].productNum) {
|
|
|
- flag = false
|
|
|
- proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能大于产品数量' + form.value.details[i].productNum)
|
|
|
- }
|
|
|
- }
|
|
|
- if(form.value.details[i].auditNum == 0) {
|
|
|
- flag = false
|
|
|
- proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能为0')
|
|
|
+ // if (form.value.details[i].receiptNum > 0) {
|
|
|
+ // if (form.value.details[i].auditNum > form.value.details[i].receiptNum) {
|
|
|
+ // flag = false
|
|
|
+ // proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能大于收回数量')
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ //外协没填收回数量
|
|
|
+ //外协没填收回数量,第一行工序确定数量不能超过产品数量,第二行工序确定数量不能超过上一道序的确定数量
|
|
|
+ var index = tempList.indexOf(form.value.details[i])
|
|
|
+ // if (index > 0 && form.value.details[i].auditNum > tempList[index - 1].auditNum) {
|
|
|
+ // flag = false
|
|
|
+ // proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能超过上一道序的确定数量')
|
|
|
+ // }
|
|
|
+ // if (form.value.details[i].auditNum > form.value.details[i].productNum) {
|
|
|
+ // flag = false
|
|
|
+ // proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能大于产品数量' + form.value.details[i].productNum)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ if (form.value.details[i].auditNum == 0) {
|
|
|
+ // flag = false
|
|
|
+ // proxy.$modal.msgError('第' + (i + 1) + '行确定数量不能为0')
|
|
|
+ confirmFlag = true
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if(form.value.details.length==0) {
|
|
|
+ if (form.value.details.length == 0) {
|
|
|
flag = false
|
|
|
proxy.$modal.msgError('收回明细不能为空')
|
|
|
}
|
|
|
- console.log(form.value.details.length)
|
|
|
- if(flag) {
|
|
|
- console.log(form.value)
|
|
|
- if (form.value.id != null) {
|
|
|
- console.log(form.value)
|
|
|
- updateReceipt(form.value).then((response) => {
|
|
|
- proxy.$modal.msgSuccess('修改成功')
|
|
|
- visible.value = false
|
|
|
- emit('handleSaveSuccess')
|
|
|
- })
|
|
|
- } else {
|
|
|
+ console.log(form.value.details.length)
|
|
|
+ if (flag) {
|
|
|
console.log(form.value)
|
|
|
- addReceipt(form.value).then((response) => {
|
|
|
- proxy.$modal.msgSuccess('新增成功')
|
|
|
- visible.value = false
|
|
|
- emit('handleSaveSuccess')
|
|
|
- })
|
|
|
- }
|
|
|
+ if (confirmFlag) {
|
|
|
+ proxy.$modal.confirm('存在填写确定数量为0的工序,确定要收回吗?').then(function () {
|
|
|
+ if (form.value.id != null) {
|
|
|
+ console.log(form.value)
|
|
|
+ updateReceipt(form.value).then((response) => {
|
|
|
+ proxy.$modal.msgSuccess('修改成功')
|
|
|
+ visible.value = false
|
|
|
+ emit('handleSaveSuccess')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log(form.value)
|
|
|
+ addReceipt(form.value).then((response) => {
|
|
|
+ proxy.$modal.msgSuccess('新增成功')
|
|
|
+ visible.value = false
|
|
|
+ emit('handleSaveSuccess')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ proxy.$modal.msg('取消确认')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (form.value.id != null) {
|
|
|
+ console.log(form.value)
|
|
|
+ updateReceipt(form.value).then((response) => {
|
|
|
+ proxy.$modal.msgSuccess('修改成功')
|
|
|
+ visible.value = false
|
|
|
+ emit('handleSaveSuccess')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log(form.value)
|
|
|
+ addReceipt(form.value).then((response) => {
|
|
|
+ proxy.$modal.msgSuccess('新增成功')
|
|
|
+ visible.value = false
|
|
|
+ emit('handleSaveSuccess')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -303,12 +299,12 @@ function submitForm() {
|
|
|
//反选操作
|
|
|
function handleDelReturnReceiveDetail(row) {
|
|
|
proxy.$modal
|
|
|
- .confirm("是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?")
|
|
|
- .then(function () {
|
|
|
- form.value.details = form.value.details.filter(item => {
|
|
|
- return item.lotId !=row.lotId
|
|
|
- })
|
|
|
- })
|
|
|
+ .confirm("是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?")
|
|
|
+ .then(function () {
|
|
|
+ form.value.details = form.value.details.filter(item => {
|
|
|
+ return item.lotId != row.lotId
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
/** 暴露给父组件的方法 */
|