|
@@ -65,6 +65,8 @@
|
|
|
<!-- 功能按钮区 -->
|
|
|
<div class="list-btns-container">
|
|
|
<el-button
|
|
|
+ :disabled = "dataList.find(item => item.editStatus)"
|
|
|
+ v-if="!editStatus"
|
|
|
type="primary"
|
|
|
icon="Plus"
|
|
|
v-hasPermi="['business:returnReceiptDetail:add']"
|
|
@@ -72,6 +74,15 @@
|
|
|
>
|
|
|
新增
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-else
|
|
|
+ type="primary"
|
|
|
+ icon="Plus"
|
|
|
+ v-hasPermi="['business:returnReceiptDetail:add']"
|
|
|
+ @click="handleAddDetail(null)"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<!-- 渲染数据区 -->
|
|
|
<div class="el-table-container">
|
|
@@ -88,7 +99,7 @@
|
|
|
label="外协商"
|
|
|
align="center"
|
|
|
prop="supplierName"
|
|
|
- width="104"
|
|
|
+ width="120"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -106,13 +117,13 @@
|
|
|
label="收回日期"
|
|
|
align="center"
|
|
|
prop="formDate"
|
|
|
- width="120"
|
|
|
+ width="100"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
{{ parseTime(scope.row.formDate, "{y}-{m}-{d}") }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="外协数量" align="center" prop="productNum" width="100"/>
|
|
|
+ <el-table-column label="外协数量" align="center" prop="productNum" width="90"/>
|
|
|
<el-table-column
|
|
|
label="外协工序"
|
|
|
align="center"
|
|
@@ -135,7 +146,7 @@
|
|
|
<template #default="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.remark"
|
|
|
- v-if="scope.row.editStatus"
|
|
|
+ v-if="!scope.row.editAuditStatus &&scope.row.editStatus"
|
|
|
/>
|
|
|
<span v-else>{{ scope.row.remark }}</span>
|
|
|
</template>
|
|
@@ -179,8 +190,9 @@
|
|
|
<template #default="scope">
|
|
|
<!-- 保存按钮 -->
|
|
|
<el-button
|
|
|
- v-if="scope.row.productionDeptId == 0 && (scope.row.editStatus === true || scope.row.editAuditStatus === true)"
|
|
|
+ v-if="scope.row.productionDeptId == 0 && scope.row.editStatus == true"
|
|
|
link
|
|
|
+ :disabled = "scope.row.allowClick == false"
|
|
|
:loading="isSubmitting"
|
|
|
v-hasPermi="['business:returnReceiptDetail:add']"
|
|
|
type="primary"
|
|
@@ -190,8 +202,9 @@
|
|
|
|
|
|
<!-- 编辑按钮 -->
|
|
|
<el-button
|
|
|
- v-if="scope.row.productionDeptId == 0 && !(scope.row.editStatus === true || scope.row.editAuditStatus === true)"
|
|
|
+ v-if="scope.row.productionDeptId == 0 && scope.row.editStatus == false "
|
|
|
link
|
|
|
+ :disabled = "scope.row.allowClick == false"
|
|
|
type="warning"
|
|
|
v-hasPermi="['business:returnReceiptDetail:edit']"
|
|
|
icon="Edit"
|
|
@@ -200,8 +213,9 @@
|
|
|
|
|
|
<!-- 审核通过按钮 -->
|
|
|
<el-button
|
|
|
- v-if="scope.row.status === 0 && scope.row.id && !scope.row.editStatus && !scope.row.editAuditStatus"
|
|
|
+ v-if="scope.row.status === 0 &&scope.row.isAudit ==1 && scope.row.id && scope.row.editStatus == false && scope.row.editAuditStatus == false"
|
|
|
link
|
|
|
+ :disabled = "scope.row.allowClick == false"
|
|
|
type="warning"
|
|
|
v-hasPermi="['business:returnReceiptDetail:edit']"
|
|
|
icon="CircleCheck"
|
|
@@ -210,8 +224,9 @@
|
|
|
|
|
|
<!-- 审核不通过按钮 -->
|
|
|
<el-button
|
|
|
- v-if="scope.row.status === 1 && scope.row.id && !scope.row.editStatus && !scope.row.editAuditStatus"
|
|
|
+ v-if="scope.row.status === 1 &&scope.row.isAudit ==1 && scope.row.id && scope.row.editStatus == false && scope.row.editAuditStatus == false"
|
|
|
link
|
|
|
+ :disabled = "scope.row.allowClick == false"
|
|
|
type="warning"
|
|
|
v-hasPermi="['business:returnReceiptDetail:edit']"
|
|
|
icon="CircleClose"
|
|
@@ -220,8 +235,9 @@
|
|
|
|
|
|
<!-- 反选按钮 -->
|
|
|
<el-button
|
|
|
- v-if="scope.row.id && scope.row.editStatus && scope.row.productionDeptId == 0 "
|
|
|
+ v-if="scope.row.id && scope.row.productionDeptId == 0 && scope.row.editStatus == false"
|
|
|
link
|
|
|
+ :disabled = "scope.row.allowClick == false"
|
|
|
v-hasPermi="['business:returnReceiptDetail:remove']"
|
|
|
type="danger"
|
|
|
icon="Delete"
|
|
@@ -252,7 +268,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="returnReceiptDetail">
|
|
|
-import { listDetail,saveDetails,delReceiptDetail} from '@/api/business/returnReceiptDetail'
|
|
|
+import { listDetail,saveDetails,delReceiptDetail,saveDetailsForAdd} from '@/api/business/returnReceiptDetail'
|
|
|
import receiptDetailForm from './form'
|
|
|
import dialogOutsourceDetails from './DialogOutsourceDetails'
|
|
|
const { proxy } = getCurrentInstance()
|
|
@@ -262,6 +278,8 @@ const { is_audit_num } = proxy.useDict("is_audit_num");
|
|
|
const spanProps = ref([])
|
|
|
const dataList = ref([])
|
|
|
const loading = ref(true)
|
|
|
+const editStatus = ref(false)
|
|
|
+const detailList = ref([])
|
|
|
const isSubmitting = ref(false)
|
|
|
const ids = ref([])
|
|
|
const total = ref(0)
|
|
@@ -282,11 +300,13 @@ const queryParams = ref({
|
|
|
带箱方式,是整单的。如果换新箱子,明细中,都需要更换箱子列表 */
|
|
|
function getList() {
|
|
|
loading.value = true
|
|
|
+ editStatus.value = false
|
|
|
listDetail(queryParams.value).then((response) => {
|
|
|
dataList.value = response.rows
|
|
|
dataList.value.forEach(item => {
|
|
|
item.editStatus = false
|
|
|
item.editAuditStatus = false
|
|
|
+ item.allowClick = true
|
|
|
})
|
|
|
total.value = response.total
|
|
|
loading.value = false
|
|
@@ -320,6 +340,10 @@ function handleSelectionChange(selection) {
|
|
|
// 外协明细选择带回
|
|
|
const handleMultipleSelectedOutsourceDetails = (selection) => {
|
|
|
console.log(selection)
|
|
|
+ dataList.value.forEach(item=>{
|
|
|
+ item.allowClick = false
|
|
|
+ })
|
|
|
+ editStatus.value = true
|
|
|
for(let i = 0;i<selection.length;i++) {
|
|
|
for(let j = 0;j<selection[i].processes.length;j++) {
|
|
|
const newDetail = {
|
|
@@ -350,9 +374,11 @@ const handleMultipleSelectedOutsourceDetails = (selection) => {
|
|
|
status:0,
|
|
|
auditNum:selection[i].processes[j].qualifiedNum?selection[i].processes[j].qualifiedNum:0,
|
|
|
editStatus:true,
|
|
|
- isAudit:1
|
|
|
+ isAudit:0
|
|
|
}
|
|
|
dataList.value.unshift(newDetail)
|
|
|
+ //存放新增的明细,走总的保存方法
|
|
|
+ detailList.value.push(newDetail)
|
|
|
spanPropGroup(dataList.value)
|
|
|
}
|
|
|
}
|
|
@@ -367,9 +393,6 @@ function handleAdd(row) {
|
|
|
let tempList = dataList.value.filter(item=>{
|
|
|
return item.outsourceDetailId == row.outsourceDetailId})
|
|
|
//保存时将确认状态置为1,从而让状态变成已确认
|
|
|
- tempList.forEach(item =>{
|
|
|
- item.isAudit = 1
|
|
|
- })
|
|
|
for(let i = 0;i<tempList.length;i++) {
|
|
|
if(tempList[i].auditNum == 0){
|
|
|
isSubmitting.value = false
|
|
@@ -403,6 +426,40 @@ if(flag) {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+//总保存方法
|
|
|
+function handleAddDetail() {
|
|
|
+ var flag = true;
|
|
|
+ for(let i = 0;i<detailList.value.length;i++) {
|
|
|
+ if(detailList.value[i].auditNum == 0){
|
|
|
+ proxy.$modal
|
|
|
+ .confirm("第" + (i + 1) + "行确定数量是否确定为0")
|
|
|
+ .then(() => {
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ flag = false;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ console.log(flag)
|
|
|
+ // 无论用户点击确定还是取消,都在这里检查 flag 值
|
|
|
+ if (flag) {
|
|
|
+ saveDetailsForAdd(detailList.value).then(res => {
|
|
|
+ editStatus.value = false
|
|
|
+ proxy.$modal.msgSuccess('操作成功');
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+}
|
|
|
+if(flag) {
|
|
|
+ saveDetailsForAdd(detailList.value).then(res => {
|
|
|
+ editStatus.value = false
|
|
|
+ proxy.$modal.msgSuccess('操作成功');
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+}
|
|
|
+}
|
|
|
//审核通过
|
|
|
function handleCheckDetail(row) {
|
|
|
let tempList = dataList.value.filter(item=>{
|
|
@@ -428,20 +485,28 @@ function handleNotCheckDetail(row) {
|
|
|
getList()
|
|
|
})
|
|
|
}
|
|
|
+//编辑
|
|
|
function handleEditAuditNum(row) {
|
|
|
let tempList = dataList.value.filter(item=>{
|
|
|
return item.outsourceDetailId == row.outsourceDetailId})
|
|
|
tempList.forEach(item=>{
|
|
|
item.editAuditStatus = true
|
|
|
- item.editStatus = false
|
|
|
+ item.editStatus = true
|
|
|
+ })
|
|
|
+ //除了选中的数据
|
|
|
+ let infoList = dataList.value.filter(item=>{
|
|
|
+ return item.outsourceDetailId != row.outsourceDetailId})
|
|
|
+ infoList.forEach(item=>{
|
|
|
+ item.allowClick = false
|
|
|
})
|
|
|
+ console.log(row)
|
|
|
}
|
|
|
//反选操作
|
|
|
function handleDelReturnReceiveDetail(row) {
|
|
|
proxy.$modal
|
|
|
.confirm("是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?")
|
|
|
.then(function () {
|
|
|
- delReceiptDetail(row.id).then(res=>{
|
|
|
+ delReceiptDetail(row.outsourceDetailId).then(res=>{
|
|
|
proxy.$modal.msgSuccess('操作成功')
|
|
|
getList()
|
|
|
})
|