ezhizao_zx hace 3 meses
padre
commit
528b80b693

+ 12 - 22
src/views/business/returnReceipt/DialogOutsourceDetails.vue

@@ -2,26 +2,12 @@
 	<el-dialog title="添加收回明细" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
 		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
 			<el-form-item label="产品描述:" prop="productDescription" label-width="100">
-				<el-input
-					v-model.trim="queryParams.productDescription"
-					type="text"
-					@keydown.enter.prevent
-					style="width: 140px"
-					placeholder="请输入产品描述"
-					:clearable="true"
-					@keyup.enter="handleSearch"
-				/>
+				<el-input v-model.trim="queryParams.productDescription" type="text" @keydown.enter.prevent style="width: 140px"
+					placeholder="请输入产品描述" :clearable="true" @keyup.enter="handleSearch" />
 			</el-form-item>
 			<el-form-item label="箱号:" prop="newCarrier" label-width="70">
-				<el-input
-					v-model.trim="queryParams.newCarrier"
-					type="text"
-					@keydown.enter.prevent
-					style="width: 140px"
-					placeholder="请输入箱号"
-					:clearable="true"
-					@keyup.enter="handleSearch"
-				/>
+				<el-input v-model.trim="queryParams.newCarrier" type="text" @keydown.enter.prevent style="width: 140px"
+					placeholder="请输入箱号" :clearable="true" @keyup.enter="handleSearch" />
 			</el-form-item>
 			<el-form-item label-width="20px">
 				<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
@@ -48,7 +34,7 @@
 		<div><span style="color: red;">注:如果选择框为灰色,外协厂已填写收回单,暂未提交!</span></div>
 		<el-table ref="dialogTable" :data="dataList" row-key="id" size="small" v-loading="loading" border height="370px"
 			@selection-change="handleSelectionChange">
-			<el-table-column type="selection" width="40" align="center" :selectable="handleAllowSelected"/>
+			<el-table-column type="selection" width="40" align="center" :selectable="handleAllowSelected" />
 			<el-table-column type="index" label="行号" width="50" align="center" />
 			<el-table-column label="批次号" align="center" prop="lotCode" width="96" />
 			<el-table-column label="产品描述" align="center" prop="productDescription" />
@@ -111,20 +97,20 @@ function open(data) {
 
 //查看对应外协所有批次
 function handleShowAllDetail() {
-	queryParams.value.pageNum =1
+	queryParams.value.pageNum = 1
 	queryParams.value.pageSize = 10
 	showAll.value = true
 	getAllList()
 }
 //查看对应外协已完成批次
 function handleShowFinishedDetail() {
-	queryParams.value.pageNum =1
+	queryParams.value.pageNum = 1
 	queryParams.value.pageSize = 10
 	showAll.value = false
 	getList()
 }
 function handleAllowSelected(row) {
-  return row.returnReceiptDetailList.length >0?false:true
+	return row.returnReceiptDetailList.length > 0 ? false : true
 }
 //查找分配给外协商的所有明细,除了已经德迈仕已经确认的批次
 function getAllList() {
@@ -185,6 +171,10 @@ function handleSearch() {
 }
 /** 多选事件 */
 function handleMultipleSelected() {
+	if (selections.value.findIndex(e => e.carrierIds == null || e.newCarriers == null) >= 0) {
+		proxy.$modal.msgError('请选择已绑定载具的外协明细');
+		return
+	}
 	if (multipleSelected.value) {
 		multipleSelected.value(selections.value)
 	}

+ 129 - 151
src/views/business/returnReceipt/form.vue

@@ -81,44 +81,22 @@
                 {{ scope.row.newCarrier }} {{ scope.row.unbind == 1 ? "(已解绑)" : "" }}
               </template>
             </el-table-column>
-            <el-table-column
-              label="新箱号"
-              align="center"
-              prop="carrierNames"
-              width="320"
-            >
+            <el-table-column label="新箱号" align="center" prop="carrierNames" width="320">
               <template #default="scope">
-                <el-button
-                  link
-                  type="primary"
-                  icon="Refresh"
-                  v-if="!scope.row.editStatus"
-                  @click="handleChangeCarrier(scope.row)"
-                  >换箱</el-button
-                >
+                <el-button link type="primary" icon="Refresh" v-if="!scope.row.editStatus"
+                  @click="handleChangeCarrier(scope.row)">换箱</el-button>
                 <el-select
-                  v-if="!(scope.row.productionDeptId != 0 || (scope.row.isApproved === 0 && scope.row.processInspecionList && scope.row.processInspecionList.length > 0) || scope.row.isProvedForCheck === 1 || scope.row.isCheckout === 1)&&( scope.row.editStatus) "
-                  v-model="scope.row.carrierIds"
-                  multiple
-                  filterable
-                  remote
-                  reserve-keyword
-                  placeholder="请选择箱号"
-                  :remote-method="
-                    (arg) =>
-                      remoteCarriers(arg, scope.row.newCarriers, scope.row)
-                  "
-                  :loading="loadingCarrier"
-                  @change="(arg) => handleCarrierChange(arg, scope.row)"
-                >
-                  <el-option
-                    v-for="item in scope.row.carriers"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  />
+                  v-if="!(scope.row.productionDeptId != 0 || (scope.row.isApproved === 0 && scope.row.processInspecionList && scope.row.processInspecionList.length > 0) || scope.row.isProvedForCheck === 1 || scope.row.isCheckout === 1) && (scope.row.editStatus)"
+                  v-model="scope.row.carrierIds" multiple filterable remote reserve-keyword placeholder="请选择箱号"
+                  :remote-method="(arg) =>
+                    remoteCarriers(arg, scope.row.newCarriers, scope.row)
+                    " :loading="loadingCarrier" @change="(arg) => handleCarrierChange(arg, scope.row)">
+                  <el-option v-for="item in scope.row.carriers" :key="item.value" :label="item.label"
+                    :value="item.value" />
                 </el-select>
-                <span v-if="((scope.row.productionDeptId != 0 || (scope.row.isApproved === 0 && scope.row.processInspecionList && scope.row.processInspecionList.length > 0) || scope.row.isProvedForCheck === 1 || scope.row.isCheckout === 1)&& scope.row.editStatus)">{{ scope.row.newCarrier }}</span>
+                <span
+                  v-if="((scope.row.productionDeptId != 0 || (scope.row.isApproved === 0 && scope.row.processInspecionList && scope.row.processInspecionList.length > 0) || scope.row.isProvedForCheck === 1 || scope.row.isCheckout === 1) && scope.row.editStatus)">{{
+                    scope.row.newCarrier }}</span>
               </template>
             </el-table-column>
             <el-table-column label="外协工序" align="center" prop="processAlias" width="200" />
@@ -315,7 +293,7 @@ const handleMultipleSelectedOutsourceDetails = (selection) => {
       outsourceDetailId: selection[i].id,
       productDescription: selection[i].productDescription,
       lotCode: selection[i].lotCode,
-      lotId:selection[i].lotId,
+      lotId: selection[i].lotId,
       productNum: selection[i].productNum,
       receiptNum:
         selection[i].processes[selection[i].processes.length - 1].qualifiedNum
@@ -324,9 +302,9 @@ const handleMultipleSelectedOutsourceDetails = (selection) => {
       newCarrier: selection[i].newCarrier,
       remark: "",
       carrierIds: Array.from(selection[i].carrierIds),
-        carrierNames: selection[i].carrierNames,
-        newCarriers: JSON.parse(JSON.stringify(selection[i].newCarriers)),
-        dayworkId: selection[i].dayworkId,
+      carrierNames: selection[i].carrierNames,
+      newCarriers: JSON.parse(JSON.stringify(selection[i].newCarriers)),
+      dayworkId: selection[i].dayworkId,
       processAlias: selection[i].processNames,
       productionDeptId: selection[i].productionDeptId,
       status: 0,
@@ -404,8 +382,8 @@ function submitForm() {
         flag = false
         proxy.$modal.msgError(checkRes.msg)
       }
-            //一箱多批是否全部收回
-            const checkMore = await checkAllowMore(form.value.details);
+      //一箱多批是否全部收回
+      const checkMore = await checkAllowMore(form.value.details);
       if (!checkMore.data) {
         flag = false
         proxy.$modal.msgError(checkMore.msg)
@@ -414,112 +392,112 @@ function submitForm() {
       const checkHasNone = await checkIsNone(form.value.details);
       if (!checkHasNone.data) {
         proxy.$modal
-    .confirm(checkHasNone.msg)
-    .then(function () {
-      let lotCode = "";
-      lotCode = form.value.details.filter(v => v.carrierIds == null||v.carrierIds.length == 0).map(v=>v.lotCode).join(",");
-      if(lotCode!=""){
-        proxy.$modal
-    .confirm(lotCode+"批次的载具为空,可能影响周转,是否确认提交?")
-    .then(function () {
-      if (flag) {
-        //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
-        handleSetAuditStatus();
-        form.value.processes = processList.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);
-          addReceipt(form.value).then((response) => {
-            proxy.$modal.msgSuccess("新增成功");
-            visible.value = false;
-            emit("handleSaveSuccess");
-          });
-        }
-      }
-      }).catch(_ => {})
-    }else{
-      if (flag) {
-        //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
-        handleSetAuditStatus();
-        form.value.processes = processList.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);
-          addReceipt(form.value).then((response) => {
-            proxy.$modal.msgSuccess("新增成功");
-            visible.value = false;
-            emit("handleSaveSuccess");
-          });
-        }
-      }
-    }
+          .confirm(checkHasNone.msg)
+          .then(function () {
+            let lotCode = "";
+            lotCode = form.value.details.filter(v => v.carrierIds == null || v.carrierIds.length == 0).map(v => v.lotCode).join(",");
+            if (lotCode != "") {
+              proxy.$modal
+                .confirm(lotCode + "批次的载具为空,可能影响周转,是否确认提交?")
+                .then(function () {
+                  if (flag) {
+                    //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
+                    handleSetAuditStatus();
+                    form.value.processes = processList.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);
+                      addReceipt(form.value).then((response) => {
+                        proxy.$modal.msgSuccess("新增成功");
+                        visible.value = false;
+                        emit("handleSaveSuccess");
+                      });
+                    }
+                  }
+                }).catch(_ => { })
+            } else {
+              if (flag) {
+                //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
+                handleSetAuditStatus();
+                form.value.processes = processList.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);
+                  addReceipt(form.value).then((response) => {
+                    proxy.$modal.msgSuccess("新增成功");
+                    visible.value = false;
+                    emit("handleSaveSuccess");
+                  });
+                }
+              }
+            }
 
-    }).catch(_ => {})
-    }else{
-      let lotCode = "";
-      lotCode = form.value.details.filter(v => v.carrierIds == null||v.carrierIds.length == 0).map(v=>v.lotCode).join(",");
-      if(lotCode!=""){
-        proxy.$modal
-    .confirm(lotCode+"批次的载具为空,可能影响周转,是否确认提交?")
-    .then(function () {
-            if (flag) {
-        //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
-        handleSetAuditStatus();
-        form.value.processes = processList.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);
-          addReceipt(form.value).then((response) => {
-            proxy.$modal.msgSuccess("新增成功");
-            visible.value = false;
-            emit("handleSaveSuccess");
-          });
-        }
-      }
-    }).catch(_ => {})
-  }else{
-    if (flag) {
-        //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
-        handleSetAuditStatus();
-        form.value.processes = processList.value
-        if (form.value.id != null) {
-          console.log(form.value);
-          updateReceipt(form.value).then((response) => {
-            proxy.$modal.msgSuccess("修改成功");
-            visible.value = false;
-            emit("handleSaveSuccess");
-          });
+          }).catch(_ => { })
+      } else {
+        let lotCode = "";
+        lotCode = form.value.details.filter(v => v.carrierIds == null || v.carrierIds.length == 0).map(v => v.lotCode).join(",");
+        if (lotCode != "") {
+          proxy.$modal
+            .confirm(lotCode + "批次的载具为空,可能影响周转,是否确认提交?")
+            .then(function () {
+              if (flag) {
+                //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
+                handleSetAuditStatus();
+                form.value.processes = processList.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);
+                  addReceipt(form.value).then((response) => {
+                    proxy.$modal.msgSuccess("新增成功");
+                    visible.value = false;
+                    emit("handleSaveSuccess");
+                  });
+                }
+              }
+            }).catch(_ => { })
         } else {
-          console.log(form.value);
-          addReceipt(form.value).then((response) => {
-            proxy.$modal.msgSuccess("新增成功");
-            visible.value = false;
-            emit("handleSaveSuccess");
-          });
+          if (flag) {
+            //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
+            handleSetAuditStatus();
+            form.value.processes = processList.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);
+              addReceipt(form.value).then((response) => {
+                proxy.$modal.msgSuccess("新增成功");
+                visible.value = false;
+                emit("handleSaveSuccess");
+              });
+            }
+          }
         }
-      }
-  }
 
+      }
     }
-  }
   });
 }
 //换箱
@@ -527,12 +505,12 @@ function handleChangeCarrier(row) {
   row.editStatus = true
   row.carriers = [];
   if (!form.value.id) {
-      row.carriers.push(
-        ...row.newCarriers.map((v) => ({
-          value: v.id,
-          label: v.code,
-        }))
-      );
+    row.carriers.push(
+      ...row.newCarriers.map((v) => ({
+        value: v.id,
+        label: v.code,
+      }))
+    );
 
   }
   console.log(row)
@@ -562,11 +540,11 @@ function remoteCarriers(code, newCarrier, row) {
   let hasAddCarriers = []
   console.log(form.value.details)
   form.value.details.forEach((item) => {
-    let info ={}
+    let info = {}
     let carrierIds = []
     info.lotId = item.lotId
     info.dayworkId = item.dayworkId
-    item.carrierIds.forEach(v=>{
+    item.carrierIds.forEach(v => {
       carrierIds.push(v)
     })
     info.hasAddCarrierIds = carrierIds
@@ -575,7 +553,7 @@ function remoteCarriers(code, newCarrier, row) {
   carrierForReturnReceipt({
     code: code,
     lotId: row.lotId,
-    dayworkId:row.dayworkId,
+    dayworkId: row.dayworkId,
     hasAddCarriers: hasAddCarriers
   }).then((res) => {
     if (res.code === 200 && res.data) {