Pārlūkot izejas kodu

明细出库页面

liumy 1 gadu atpakaļ
vecāks
revīzija
0ff45cf878

+ 8 - 0
src/api/orderManage-sup/index.js

@@ -91,6 +91,14 @@ export function getOrdDetlList(data) {
         data
     })
 }
+// /web/purcOrd/getMcsPurcOrdMx 提取订单
+export function getMcsPurcOrdMx(data) {
+    return request({
+        url:"/web/purcOrd/getMcsPurcOrdMx",
+        method:"post",
+        data
+    })
+}
 // 骨科
 
 

+ 5 - 6
src/views/page/orderManage-sup/alreadyDelivery/alreadyDetail.vue

@@ -7,7 +7,7 @@
         </div> -->
         <div class="common-card">
             <h3>基本信息</h3>
-            <el-form :model="listForm" ref="listform" label-width="237px" class="grid-form-class">
+            <el-form :model="listForm" ref="listform" label-width="200px" class="grid-form-class">
             <div class="form-body">
             <div class="flex-css">
                 <el-form-item label="出库单号" prop="delvOrdId">
@@ -116,8 +116,8 @@
           <el-table-column label="采购单位" prop="purcUnt" />
           <el-table-column label="包装内数量" prop="convrat" width="90px"/>
                 <el-table-column label="批次号" prop="lotNum" />
-                <el-table-column label="生产日期" prop="manuDate" />
-                <el-table-column label="有效期至" prop="prodExpy" />
+                <el-table-column label="生产日期" prop="manuDate"  width="100px"/>
+                <el-table-column label="有效期至" prop="prodExpy" width="100px"/>
                 <el-table-column label="需求数量" prop="purcCnt" />
                 <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px"/>
                 <el-table-column label="本次出库量" prop="delvCnt" width="90px"/>
@@ -408,9 +408,8 @@ import { getOrdDetlList,finishDelvOrd } from "@/api/orderManage-sup/index";
             // 合并列
             handleSpan({ row, column, rowIndex, columnIndex }){
                 if (columnIndex === 1 || columnIndex === 2 || columnIndex === 3 || columnIndex === 4
-                || columnIndex === 5|| columnIndex === 6|| columnIndex === 7|| columnIndex === 8
-                || columnIndex === 12 || columnIndex === 13|| columnIndex === 14|| columnIndex === 15
-                || columnIndex === 16) {
+                || columnIndex === 5|| columnIndex === 6|| columnIndex === 7|| columnIndex === 8 ||columnIndex === 9
+                || columnIndex === 10 || columnIndex === 15 || columnIndex === 14) {
                     // console.log("单元格数组,若下一项为0,则代表合并上一项", this.cellList);
                     const rowCell = this.cellList[rowIndex];
                     if (rowCell > 0) {

+ 2 - 2
src/views/page/orderManage-sup/purOrderAccept/index.vue

@@ -155,8 +155,8 @@
             <el-table-column label="客户名称" prop="branchName" />
             <el-table-column label="来源部门" prop="deptName" />
             <el-table-column label="发起时间" prop="docmkDate" width="140" />
-            <el-table-column label="受理人" prop="docmker" />
-            <el-table-column label="受理时间" prop="docmkDate"  width="140" />
+            <!-- <el-table-column label="受理人" prop="docmker" />
+            <el-table-column label="受理时间" prop="docmkDate"  width="140" /> -->
             <el-table-column label="状态" prop="stas">
               <template #default="{ row }">
                 <span v-if="row.stas == 'A'">未受理</span>

+ 51 - 44
src/views/page/orderManage-sup/purOrderDelivery/deliveryDetail.vue

@@ -202,7 +202,7 @@
           <el-table-column label="报关单" prop="invoFileId" width="200">
             <template slot-scope="scope">
               <yl-upload
-                v-if="scope.row.source=='进口'"
+                v-if="scope.row.prodSouc=='进口'"
                 :fileId="scope.row.invoFileId"
                 @getUpload="getUpload1"
                 urlName="acco"
@@ -264,7 +264,7 @@
           v-if="listForm.stas === '部分出库'"
           >出库</el-button
         >
-        <el-button type="danger" @click="handleOrderEnd" v-show="endBtn" :loading="endLoad">结束订单</el-button>
+        <!-- <el-button type="danger" @click="handleOrderEnd" v-show="endBtn" :loading="endLoad">结束订单</el-button> -->
         <el-button type="success" @click="handleBack" >返回</el-button>
       </div>
     </div>
@@ -413,7 +413,6 @@
             <th>医保编码</th>
             <th>耗材名称</th>
             <th>商品类别</th>
-            <th>商品分类</th>
             <th>规格</th>
             <th>型号</th>
             <th>材质</th>
@@ -421,13 +420,14 @@
             <th>注册证号</th>
             <th>生产企业</th>
             <th>单价</th>
-            <th>需求数量</th>
-            <th>已出库数量</th>
-            <th>剩余出库量</th>
-            <th>出库数量</th>
             <th>批号</th>
             <th>生产日期</th>
             <th>有效期至</th>
+            <th>需求数量</th>
+            <th>已出库数量</th>
+            <th>剩余出库量</th>
+            <th>本次出库数量</th>
+            
           </tr>
           <tr v-for="(item, index) in chuList" :key="index" class="hang">
             <td align="center">
@@ -437,64 +437,65 @@
               {{ item.materialId }}
             </td>
             <td align="center">
-              {{ item.ybbm }}
-            </td>
-            <td align="center">
-              {{ item.materialName }}
+              {{ item.hiCode }}
             </td>
             <td align="center">
-              {{ item.prodType }}
+              {{ item.prodName }}
             </td>
             <td align="center">
-              {{ item.drugListId }}
+              <span v-if="item.mcsType=='0'">普通耗材</span>
+              <span v-if="item.mcsType=='1'">高值耗材</span>
+              <span v-if="item.mcsType=='2'">试剂</span>
             </td>
             <td align="center">
               {{ item.spec }}
             </td>
             <td align="center">
-              {{ item.model }}
+              {{ item.mol }}
             </td>
             <!-- 材质 -->
             <td align="center">
               {{ item.matl }}
             </td>
             <td align="center">
-              {{ item.source }}
+              <span v-if="item.prodSouc=='1'">国产</span>
+              <span v-if="item.prodSouc=='2'">进口</span>
             </td>
             <td align="center">
-              {{ item.approveNo }}
+              {{ item.regcertno }}
             </td>
             <td align="center">
-              {{ item.factory }}
+              {{ item.prodEntp }}
             </td>
             <td align="center">
               {{ item.purcPric }}
             </td>
             <td align="center">
-              {{ item.purcCnt }}
+              {{ item.lotNum }}
             </td> 
             <td align="center">
-              {{ item.delvCntYck }}
+              {{ item.manuDate }}
             </td>
             <td align="center">
-              {{ item.toDelvCnt }}
+              {{ item.prodExpy }}
             </td>
+
             <td align="center">
-              {{ item.delvCnt }}
+              {{ item.purcCnt }}
             </td>
             <td align="center">
-              {{ item.lotNum }}
+              {{ item.delvCntYck }}
             </td>
             <td align="center">
-              {{ item.manuDate }}
+              {{ item.toDelvCnt }}
             </td>
             <td align="center">
-              {{ item.prodExpy }}
+              {{ item.delvCnt }}
             </td>
           </tr>
           <tr class="hang">
             <th align="left" :colspan="6" >合计</th>
-            <td :colspan="14" align="left">
+            <td :colspan="13" align="left">
               {{ moneySum | toChineseAmount }}
             </td>
             <!-- <td align="center"> -->
@@ -503,13 +504,13 @@
           </tr>
           <tr class="hang">
             <th :colspan="6" align="left">发货金额(人民币)大写:</th>
-            <td :colspan="14">
+            <td :colspan="13">
               {{ moneySum | toChineseAmount }}
             </td>
           </tr>
           <tr height="50px">
             <th :colspan="6" align="left">备注:</th>
-            <td :colspan="14"></td>
+            <td :colspan="13"></td>
           </tr>
           <!-- <tr class="hang">
             <th align="left" :colspan="6">收货人:</th>
@@ -878,26 +879,27 @@ export default {
     // 添加批次
     handleBatch(row, index) {
       let list = {
-        approveNo:row.approveNo,
+        prodCode:row.prodCode,
+        regcertno:row.regcertno,
         delvCnt: "",
         delvCntYck:row.delvCntYck,
         docmkDate:row.docmkDate,
         docmker:row.docmker,
         essdrugType:row.essdrugType,
-        factory: row.factory,
+        prodEntp: row.prodEntp,
         materialId: row.materialId,
-        materialName: row.materialName,
-        model: row.model,
+        prodName: row.prodName,
+        hiCode:row.hiCode,
+        mol: row.mol,
         matl: row.matl,
         memo:row.memo,
-        prodType: row.prodType,
+        mcsType:row.mcsType,
         purcPric: row.purcPric,
         purcAmt: row.purcAmt,
         purcCnt: row.purcCnt,
-        source:row.source,
+        prodSouc:row.prodSouc,
         spec: row.spec,
         toDelvCnt: row.toDelvCnt,
-        ybbm: row.ybbm,        
         invoFileId: "",
         lotNum: "",
         manuDate: "",
@@ -949,9 +951,9 @@ export default {
         columnIndex === 9 ||
         columnIndex === 10 ||
         columnIndex === 11 ||
-        columnIndex === 12 ||
-        columnIndex === 13 ||
-        columnIndex === 14 
+        columnIndex === 15 ||
+        columnIndex === 16 ||
+        columnIndex === 17 
       ) {
         // console.log("单元格数组,若下一项为0,则代表合并上一项", this.cellList);
         const rowCell = this.cellList[rowIndex];
@@ -1112,9 +1114,15 @@ export default {
     // 出库
     handleDelivery() {
       this.tableData.forEach((item) => {
-        console.log(item, "item");
-        // if (!item.invoFileId || !item.dyntFileId) {
-         if (item.source=="进口" && !item.invoFileId) {
+        // console.log(item, "item");
+        if (item.delvCnt=='0') {
+          this.$message({
+            message: "本次出库数量必须大于0",
+            type: "warning",
+          });
+          throw new Error("本次出库数量必须大于0");
+        }
+         if (item.prodSouc=="进口" && !item.invoFileId) {
           this.$message({
             // message: "请填写相应信息,并选择报关单和随货单",
             message: "请填写相应信息,并选择报关单",
@@ -1151,9 +1159,10 @@ export default {
         let data = this.tableData.map((i) => {
           console.log(i,"1111")
           return {
-            materialId: i.materialId,
+            materialId: i.prodCode,
             memo:i.memo,
             delvCnt: i.delvCnt,
+            hiCode:i.hiCode,
             delvPric:i.purcPric,
             lotNum: i.lotNum,
             manuDate: i.manuDate,
@@ -1172,15 +1181,13 @@ export default {
           deptName: this.$route.query.deptName,
         };
         console.log(data, "data");
-        this.confirmLoadLoad = true;
         submitMcsDelvOrd(data2)
           .then((res) => {
-            this.confirmLoadLoad = false;
             this.printVisible = false;
             this.$router.push("purOrderDelivery");
           })
           .catch((err) => {
-            this.confirmLoadLoad = false;
+            // this.confirmLoadLoad = false;
           });
       });
     },

+ 326 - 176
src/views/page/orderManage-sup/purOrderDelivery/purchaseDetails.vue

@@ -3,8 +3,8 @@
   <div>
     <div class="common-card">
       <el-form :model="listForm" ref="planForm" :inline="true">
-        <el-form-item label="随货同行单号" prop="aa" :rules="rules.required">
-          <el-input v-model="listForm.aa" placeholder="请输入随货同行单号"></el-input>
+        <el-form-item label="随货同行单号" prop="dyntNo">
+          <el-input v-model="listForm.dyntNo" placeholder="请输入随货同行单号"></el-input>
         </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="getDetails('search')"
@@ -27,45 +27,18 @@
             <p>暂无数据</p>
           </template>
           <el-table-column fixed type="index" label="序号" width="60" />
+          <el-table-column label="采购单号" prop="purcOrdId" />
           <el-table-column label="耗材编码" prop="materialId" />
-          <el-table-column label="医保编码" prop="ybbm" />
-          <el-table-column label="耗材名称" prop="materialName" />
-          <el-table-column label="商品类别" prop="prodType" />
-          <el-table-column label="商品分类" prop="drugListId" />
+          <el-table-column label="医保编码" prop="hiCode" />
+          <el-table-column label="耗材名称" width="300">
+            <template slot-scope="scope">
+              <mcs-info :info="scope.row"></mcs-info>
+            </template>
+          </el-table-column>
           <el-table-column label="规格" prop="spec" />
           <el-table-column label="型号" prop="mol" />
           <el-table-column label="材质" prop="matl" />
-          <el-table-column label="生产来源" prop="source" />
-          <el-table-column label="注册证号" prop="approveNo" />
-          <el-table-column label="生产企业" prop="factory" />
           <el-table-column label="单价" prop="purcPric" />
-          <el-table-column label="需求数量" prop="purcCnt" />
-          <el-table-column label="已出库数量" prop="delvCntYck" width="90px" />
-          <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
-          <el-table-column label="出库数量" prop="delvCnt" width="150">
-            <template slot-scope="scope">
-              <el-form-item
-                label-width="0"
-                class="item"
-                :prop="scope.$index + '.delvCnt'"
-                :rules="[
-                  {
-                    required: true,
-                    pattern: /^[0-9]\d*$/,
-                    message: '请输入正整数',
-                    trigger: 'blur',
-                  },
-                ]"
-              >
-                <el-input-number
-                  v-model="scope.row.delvCnt"
-                  controls-position="right"
-                  @change="updateNum(scope.row, scope.$index)"
-                  :min="0"
-                ></el-input-number>
-              </el-form-item>
-            </template>
-          </el-table-column>
           <el-table-column label="批号" prop="lotNum" width="120">
             <template slot-scope="scope">
               <el-form-item
@@ -132,6 +105,34 @@
               </el-form-item>
             </template>
           </el-table-column>
+          <el-table-column label="需求数量" prop="purcCnt" />
+          <!-- <el-table-column label="已出库数量" prop="delvCntYck" width="90px" /> -->
+          <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
+          <el-table-column label="出库数量" prop="delvCnt" width="150">
+            <template slot-scope="scope">
+              <el-form-item
+                label-width="0"
+                class="item"
+                :prop="scope.$index + '.delvCnt'"
+                :rules="[
+                  {
+                    required: true,
+                    pattern: /^[0-9]\d*$/,
+                    message: '请输入正整数',
+                    trigger: 'blur',
+                  },
+                ]"
+              >
+                <el-input-number
+                  v-model="scope.row.delvCnt"
+                  controls-position="right"
+                  @change="updateNum(scope.row, scope.$index)"
+                  :min="0"
+                ></el-input-number>
+              </el-form-item>
+            </template>
+          </el-table-column>
+
           <el-table-column label="报关单" prop="invoFileId" width="200">
             <template slot-scope="scope">
               <yl-upload
@@ -188,11 +189,8 @@
     <el-dialog title="提取采购单" :visible.sync="dialog" width="70%">
       <template>
         <el-form :model="listQuery" ref="listQuery" :inline="true" label-width="90px">
-          <el-form-item size="mini" label="采购单号" prop="id" class="long">
-            <el-input v-model="listQuery.id" placeholder="请输入采购单号"></el-input>
-          </el-form-item>
-          <el-form-item size="mini" label="采购员" prop="docmker" class="long">
-            <el-input v-model="listQuery.docmker" placeholder="请输入采购员"></el-input>
+          <el-form-item size="mini" label="采购单号" prop="purcOrdId" class="long">
+            <el-input v-model="listQuery.purcOrdId" placeholder="请输入采购单号"></el-input>
           </el-form-item>
           <el-form-item size="mini" label="耗材名称" prop="prodName" class="long">
             <el-input
@@ -206,7 +204,7 @@
 
           <el-form-item>
             <el-button type="primary" @click="getdialog('search')">查询</el-button>
-            <el-button @click="resetdialog('consumableData')">重置</el-button>
+            <el-button @click="reset('consumable')">重置</el-button>
           </el-form-item>
         </el-form>
         <el-table
@@ -230,31 +228,30 @@
             :reserve-selection="true"
             width="55"
           ></el-table-column>
-          <el-table-column prop="hiCode" label="医保编码"> </el-table-column>
-          <el-table-column prop="prodName" label="耗材名称" width="180">
+          <el-table-column label="采购单号" prop="purcOrdId"> </el-table-column>
+          <el-table-column label="耗材编码" prop="materialId" />
+          <el-table-column label="医保编码" prop="hiCode" />
+          <el-table-column label="耗材名称" width="300">
+            <template slot-scope="scope">
+              <mcs-info :info="scope.row"></mcs-info>
+            </template>
           </el-table-column>
-          <el-table-column prop="pubonlnPric" label="挂网价格"> </el-table-column>
-          <el-table-column prop="isFas" label="是否集采">
+          <el-table-column label="规格" prop="spec" />
+          <el-table-column label="型号" prop="mol" />
+          <el-table-column label="材质" prop="matl" />
+          <el-table-column label="是否集采" prop="isFas">
             <template #default="{ row }">
               <span v-if="row.isFas == '1'">否</span>
               <span v-if="row.isFas == '0'">是</span>
             </template>
           </el-table-column>
-          <el-table-column prop="fasBtch" label="集采批次"> </el-table-column>
-          <el-table-column prop="spec" label="规格"> </el-table-column>
-          <el-table-column prop="mol" label="型号"> </el-table-column>
-          <el-table-column prop="matl" label="材质"> </el-table-column>
-          <el-table-column prop="pacmatl" label="包装材质"> </el-table-column>
-          <el-table-column prop="prodSouc" label="生产来源">
-            <template #default="{ row }">
-              <span v-if="row.prodSouc == '1'">国产</span>
-              <span v-if="row.prodSouc == '0'">进口</span>
-            </template>
-          </el-table-column>
-          <el-table-column prop="regcertno" label="注册证号"> </el-table-column>
-          <el-table-column prop="prodEntp" label="生产企业" width="120">
-          </el-table-column>
-          <el-table-column prop="agnt" label="代理企业" width="150"> </el-table-column>
+          <el-table-column label="计价单位" prop="prcUnt" />
+          <el-table-column label="采购单位" prop="purcUnt" />
+          <el-table-column label="包装内数量" prop="convrat" />
+          <el-table-column label="单价" prop="purcPric" />
+          <el-table-column label="需求数量" prop="purcCnt" />
+          <!-- <el-table-column label="已出库数量" prop="delvCntYck" width="90px" /> -->
+          <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
         </el-table>
         <div slot="footer" class="dialog-footer">
           <el-button type="primary" @click="handleConfirm">确认</el-button>
@@ -273,13 +270,23 @@
 </template>
 
 <script>
+import mcsInfo from "@/views/components/mcs-info.vue";
+import ylUpload from "@/components/yl-upload";
+import { countNumPrice, getTotalAmount } from "@/utils/utils";
 import rules from "@/utils/rules";
+import { getMcsPurcOrdMx, submitMcsDelvOrd } from "@/api/orderManage-sup/index";
 export default {
+  components: {
+    mcsInfo,
+    ylUpload,
+  },
   data() {
     return {
       rules,
       listForm: {
-        aa: "",
+        dyntNo: "",
+        current: 1,
+        size: 10,
       },
       planForm: {},
       // 表格数据
@@ -290,32 +297,30 @@ export default {
       listQuery: {
         hiCode: "",
         prodName: "",
-        id: "",
-        docmker: "",
+        purcOrdId: "",
+        current: 1,
+        size: 10,
       },
       consumableData: [],
       selectData: [],
-      dialogLoading:false,
-      Loading:false,
+      dialogLoading: false,
+      Loading: false,
+      cellList: [],
     };
   },
   methods: {
     getDetails() {
-      this.$refs["planForm"].validate((valid) => {
-        if (valid) {
-          this.dialog = true;
-          this.getdialog();
-          this.$nextTick(() => {
-            this.$refs.tidata.clearSelection();
-            this.tableData.forEach((i) => {
-              this.consumableData.forEach((row) => {
-                if (i.id == row.id) {
-                  this.$refs.tidata.toggleRowSelection(row, true);
-                }
-              });
-            });
+      this.dialog = true;
+      this.getdialog();
+      this.$nextTick(() => {
+        this.$refs.multipleTable.clearSelection();
+        this.tableData.forEach((i) => {
+          this.consumableData.forEach((row) => {
+            if (i.id == row.id) {
+              this.$refs.multipleTable.toggleRowSelection(row, true);
+            }
           });
-        }
+        });
       });
     },
     // 列表数据
@@ -330,13 +335,18 @@ export default {
           this.Loading = false;
         });
     },
+    // 重置
+    reset(){
+      this.$refs.listQuery.resetFields();
+      this.getdialog();
+    },
     // 采购明细数据
-    getdialog() {
+    getdialog(type) {
       if (type == "search") {
         this.listQuery.current = 1;
       }
       this.dialogLoading = true;
-      getPurcOrdDrugList(this.listQuery)
+      getMcsPurcOrdMx(this.listQuery)
         .then((res) => {
           this.consumableData = res.data.records;
           this.consumableData.forEach((i) => {
@@ -349,6 +359,29 @@ export default {
           this.dialogLoading = false;
         });
     },
+    //删除
+    handleDelete(row, i) {
+      const index = this.tableData.findIndex(
+        (item) => item.materialId === row.materialId
+      );
+      if (index !== -1) {
+        let qwe = this.tableData.findIndex(function (item) {
+          return item.materialId == row.materialId;
+        });
+        this.tableData.splice(i, 1);
+        this.cellList.splice(i, 1);
+        this.cellList[qwe]--;
+      }
+      row.showDeleteButton = false;
+
+      this.shanchu3(row);
+      // if(this.number[index]){
+      //     this.shanchu2(row,index);
+      // }else{
+      //     this.shanchu(row);
+      // }
+      // this.number.splice(i,1);
+    },
     // 合并列
     handleSpan({ row, column, rowIndex, columnIndex }) {
       if (
@@ -359,13 +392,7 @@ export default {
         columnIndex === 5 ||
         columnIndex === 6 ||
         columnIndex === 7 ||
-        columnIndex === 8 ||
-        columnIndex === 9 ||
-        columnIndex === 10 ||
-        columnIndex === 11 ||
-        columnIndex === 12 ||
-        columnIndex === 13 ||
-        columnIndex === 14
+        columnIndex === 8
       ) {
         // console.log("单元格数组,若下一项为0,则代表合并上一项", this.cellList);
         const rowCell = this.cellList[rowIndex];
@@ -385,104 +412,227 @@ export default {
           };
         }
       }
-
-      // if (columnIndex === 2 && rowIndex == 0) {
-      //     return {
-      //         rowspan: this.pos,
-      //         colspan: 1
-      //     };
-      // }else{
-      //     for(let i=1;i<this.pos;i++){
-      //         if(rowIndex === this.pos-i && columnIndex == 2){
-      //             return {
-      //                 rowspan: 0,
-      //                 colspan: 0
-      //             };
-      //         }
-      //     }
-      // }
     },
     //弹框选择
-    handleSelectionChange() {
+    handleSelectionChange(e) {
       this.selectData = e;
     },
     // 出库
     handleDelivery() {
-      if (this.tableData.length != 0) {
-        this.$refs.tabledata.validate((valid) => {
-          if (valid) {
-            let data = this.tableData.map((i) => {
-              return i.purcOrdId;
-            });
-            let data2 = data.slice(1);
-            let qwe = data2.some((item) => {
-              if (item != data[0]) {
-                return true;
-              }
-            });
-            if (qwe == true) {
-              this.$message.info("请勾选同一采购单明细");
-            } else {
-              this.$confirm("确认出库", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-              }).then(() => {
-                let data = this.tableData.map((i) => {
-                  return {
-                    drugListId: i.drugListId,
-                    delvCnt: i.delvCnt,
-                    lotNum: i.lotNum,
-                    manuDate: i.manuDate,
-                    prodExpy: i.prodExpy,
-                    invoFileId: i.invoFileId,
-                    dyntFileId: i.dyntFileId,
-                    delvPric: i.purcPric,
-                  };
-                });
-                let data2 = {
-                  delvOrdId: "",
-                  spdId: "",
-                  dyntNo: this.listForm.dyntNo,
-                  purcOrdId: this.tableData[0].purcOrdId,
-                  detlList: data,
-                };
-                this.confirmLoadLoad = true;
-                submitDelvOrd(data2)
-                  .then((res) => {
-                    this.confirmLoadLoad = false;
-                    this.getTiData();
-                    this.tableData = [];
-                    this.selectData = [];
-                    this.$message({
-                      message: "出库成功",
-                      type: "success",
-                    });
-                    this.listForm.dyntNo = "";
-                  })
-                  .catch((err) => {
-                    this.confirmLoadLoad = false;
-                  });
-              });
+      this.tableData.forEach((item) => {
+        // console.log(item, "item");
+        if (item.delvCnt == "0") {
+          this.$message({
+            message: "本次出库数量必须大于0",
+            type: "warning",
+          });
+          throw new Error("本次出库数量必须大于0");
+        }
+        if (item.prodSouc == "进口" && !item.invoFileId) {
+          this.$message({
+            message: "请填写相应信息,并选择报关单",
+            type: "warning",
+          });
+          throw new Error("请填写相应信息,并选择报关单");
+        }
+      });
+      this.$refs.tabledata.validate((valid) => {
+        if (valid) {
+          let data = this.tableData.map((i) => {
+            return i.purcOrdId;
+          });
+          let data2 = data.slice(1);
+          let qwe = data2.some((item) => {
+            if (item != data[0]) {
+              return true;
             }
+          });
+          if (qwe == true) {
+            this.$message.info("请勾选同一采购单明细");
           } else {
-            this.$message({
-              type: "info",
-              message: "请填写必填项信息",
+            this.$confirm("确认出库", "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning",
+            }).then(() => {
+              let data = this.tableData.map((i) => {
+                return {
+                  materialId: i.prodCode,
+                  memo: i.memo,
+                  delvCnt: i.delvCnt,
+                  hiCode: i.hiCode,
+                  delvPric: i.purcPric,
+                  lotNum: i.lotNum,
+                  manuDate: i.manuDate,
+                  prodExpy: i.prodExpy,
+                  invoFileId: i.invoFileId,
+                  dyntFileId: i.dyntFileId,
+                  noRow: i.index,
+                };
+              });
+              let data2 = {
+                delvOrdId: "",
+                spdId: "",
+                purcOrdId: this.$route.query.id,
+                detlList: data,
+                dyntNo: this.listForm.dyntNo,
+                purcOrdId: this.tableData[0].purcOrdId,
+              };
+              submitMcsDelvOrd(data2)
+                .then((res) => {
+                  this.getdialog();
+                  this.tableData = [];
+                  this.selectData = [];
+                  this.$message({
+                      message: '出库成功',
+                      type: 'success'
+                  });
+                  this.listForm.dyntNo = "";
+                })
+                .catch((err) => {});
             });
           }
-        });
-        // }else{
-        //     this.$message({
-        //         type: "info",
-        //         message: "随货同行单号不能为空",
-        //     });
-        // }
+        } else {
+          this.$message({
+            type: "warning",
+            message: "请填写必填项信息",
+          });
+        }
+      });
+    },
+    // 添加批次
+    handleBatch(row, index) {
+      let list = {
+        purcOrdId: row.purcOrdId,
+        prodCode: row.prodCode,
+        regcertno: row.regcertno,
+        delvCnt: "",
+        delvCntYck: row.delvCntYck,
+        docmkDate: row.docmkDate,
+        docmker: row.docmker,
+        essdrugType: row.essdrugType,
+        prodEntp: row.prodEntp,
+        materialId: row.materialId,
+        id: row.id,
+        prodName: row.prodName,
+        hiCode: row.hiCode,
+        mol: row.mol,
+        matl: row.matl,
+        memo: row.memo,
+        mcsType: row.mcsType,
+        purcPric: row.purcPric,
+        purcAmt: row.purcAmt,
+        purcCnt: row.purcCnt,
+        prodSouc: row.prodSouc,
+        spec: row.spec,
+        toDelvCnt: row.toDelvCnt,
+        invoFileId: "",
+        lotNum: "",
+        manuDate: "",
+        prodExpy: "",
+        dyntFileId: "",
+      };
+      this.tableData.splice(index + 1, 0, list);
+      list.showDeleteButton = true;
+      this.computeCell(this.tableData);
+      console.log(this.tableData, "tableData");
+      // const aa = this.tableData.findIndex((item) => item.id === row.id);
+      // this.number.splice(aa+1,0,this.number[aa])
+    },
+    getUpload1(id, index) {
+      this.tableData[index].invoFileId = id;
+      if (id) {
+        this.$refs.tabledata.clearValidate("invoFileId");
       } else {
-        this.$message({
-          type: "info",
-          message: "出库数据不能为空",
-        });
+        this.$refs.tabledata.validateField("invoFileId");
+      }
+    },
+    // 筛选合并项
+    computeCell(tableData) {
+      this.cellList = [];
+      this.count = null;
+      for (let i = 0; i < tableData.length; i++) {
+        if (i == 0) {
+          // 先设置第一项
+          this.cellList.push(1); // 初为1,若下一项和此项相同,就往cellList数组中追加0
+          this.count = 0;
+          console.log("索引", 0, this.count);
+        } else {
+          // 判断当前项与上项的设备类别是否相同,因为是合并这一列的单元格
+          if (tableData[i].id == tableData[i - 1].id) {
+            this.cellList[this.count] += 1; // 增加计数
+            this.cellList.push(0); // 相等就往cellList数组中追加0
+            console.log("索引", i, this.count);
+          } else {
+            this.cellList.push(1); // 不等就往cellList数组中追加1
+            this.count = i; // 将索引赋值为计数
+            console.log("索引", i, this.count);
+          }
+        }
+      }
+    },
+    //获取出库数量和
+    numAll(row) {
+      let num = 0;
+      this.tableData.forEach((item) => {
+        if (item.materialId == row.materialId) {
+          num += item.delvCnt;
+        }
+      });
+      return num;
+    },
+    shanchu3(row) {
+      this.tableData.forEach(async (item) => {
+        await this.numAll(row);
+        console.log(this.numAll(row), "he");
+        if (item.materialId == row.materialId) {
+          if (this.numAll(row) > item.toDelvCnt) {
+            this.$message.warning("出库数量不能大于待出库数量");
+            row.delvCnt = 0;
+            row.price = 0;
+            return;
+          }
+        }
+        let choose = this.tableData;
+        this.tableData = choose;
+      });
+    },
+    numOrPriceChange(index, row) {
+      this.$set(
+        this.tableData[index],
+        "price",
+        getTotalAmount(row.delvCnt, row.purcPric)
+      );
+      this.amount = countNumPrice(this.tableData);
+    },
+    // 出库数量变更
+    updateNum(row, index) {
+      // const aa = this.tableData.findIndex((item) => item.id === row.id);
+      // if(this.number[aa]){
+      //     this.shanchu2(row,aa);
+      // }else{
+      //     this.shanchu(row);
+      // }
+      this.shanchu3(row);
+      this.numOrPriceChange(index, row);
+    },
+    // 确认
+    handleConfirm() {
+      let data = this.selectData.map((i) => {
+        return i.purcOrdId;
+      });
+      let data2 = data.slice(1);
+      let qwe = data2.some((item) => {
+        if (item != data[0]) {
+          return true;
+        }
+      });
+      if (qwe == true) {
+        this.$message.info("请勾选同一采购单明细");
+      } else {
+        this.tableData = this.selectData;
+        this.computeCell(this.tableData);
+        this.dialog = false;
       }
     },
   },