cz 1 gadu atpakaļ
vecāks
revīzija
90c7fa02d9

+ 25 - 70
src/components/product/SelectMaterial.vue

@@ -1,100 +1,48 @@
 <template>
   <div class="user">
     <div class="tree">
-      <treeList
-        title="物料分类"
-        submitType="2"
-        :data="treeListData"
-        v-model="sourceList.pagination.productClassifyId"
-        @change="treeChange"
-        @changeTreeList="getTreeList"
-      >
+      <treeList title="物料分类" submitType="2" :data="treeListData" v-model="sourceList.pagination.productClassifyId" @change="treeChange"
+                @changeTreeList="getTreeList">
       </treeList>
     </div>
     <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :selectConfig="selectConfig"
-        :table-events="{
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
           //element talbe事件都能传
           select: select,
-        }"
-        :action-list="[]"
-        @get-list="getList"
-      >
+        }" :action-list="[]" @get-list="getList">
         <template #pic="{ item }">
           <div v-if="item.fileList.length > 0">
-            <img
-              :src="item.fileList[0].fileUrl"
-              class="pic"
-              @click="handleClickFile(item.fileList[0])"
-            />
+            <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
           </div>
           <div v-else></div>
         </template>
       </byTable>
     </div>
-    <el-dialog
-      :title="modalType == 'add' ? '添加' : '编辑'"
-      v-model="dialogVisible"
-      width="500"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-model="dialogVisible" width="500" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #productPic>
           <div>
-            <el-upload
-              v-model:fileList="fileList"
-              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-              :data="uploadData"
-              list-type="picture-card"
-              :on-remove="handleRemove"
-              :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload"
-            >
-              <el-icon><Plus /></el-icon>
+            <el-upload v-model:fileList="fileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData"
+                       list-type="picture-card" :on-remove="handleRemove" :on-success="handleSuccess" :before-upload="handleBeforeUpload">
+              <el-icon>
+                <Plus />
+              </el-icon>
             </el-upload>
           </div>
         </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          v-no-double-click="submitForm"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
-    <el-dialog
-      title="Excel导入"
-      v-model="openExcelDialog"
-      width="400"
-      v-loading="loading"
-    >
+    <el-dialog title="Excel导入" v-model="openExcelDialog" width="400" v-loading="loading">
       <template #footer>
-        <el-button @click="openExcelDialog = false" size="large"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          @click="submitExcel()"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitExcel()" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
@@ -424,7 +372,14 @@ const getTreeList = () => {
   proxy
     .post("/productClassify/tree", { parentId: "", name: "", definition: "2" })
     .then((message) => {
-      treeListData.value = message;
+      treeListData.value = [
+        {
+          id: "",
+          label: "全部",
+          parentId: "",
+          children: message,
+        },
+      ];
       formConfig.value[0].data = message;
     });
 };

+ 25 - 70
src/components/product/SelectProduct.vue

@@ -1,100 +1,48 @@
 <template>
   <div class="user">
     <div class="tree">
-      <treeList
-        title="产品分类"
-        submitType="1"
-        :data="treeListData"
-        v-model="sourceList.pagination.productClassifyId"
-        @change="treeChange"
-        @changeTreeList="getTreeList"
-      >
+      <treeList title="产品分类" submitType="1" :data="treeListData" v-model="sourceList.pagination.productClassifyId" @change="treeChange"
+                @changeTreeList="getTreeList">
       </treeList>
     </div>
     <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :selectConfig="selectConfig"
-        :table-events="{
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
           //element talbe事件都能传
           select: select,
-        }"
-        :action-list="[]"
-        @get-list="getList"
-      >
+        }" :action-list="[]" @get-list="getList">
         <template #pic="{ item }">
           <div v-if="item.fileList.length > 0">
-            <img
-              :src="item.fileList[0].fileUrl"
-              class="pic"
-              @click="handleClickFile(item.fileList[0])"
-            />
+            <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
           </div>
           <div v-else></div>
         </template>
       </byTable>
     </div>
-    <el-dialog
-      :title="modalType == 'add' ? '添加' : '编辑'"
-      v-model="dialogVisible"
-      width="500"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-model="dialogVisible" width="500" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #productPic>
           <div>
-            <el-upload
-              v-model:fileList="fileList"
-              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-              :data="uploadData"
-              list-type="picture-card"
-              :on-remove="handleRemove"
-              :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload"
-            >
-              <el-icon><Plus /></el-icon>
+            <el-upload v-model:fileList="fileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData"
+                       list-type="picture-card" :on-remove="handleRemove" :on-success="handleSuccess" :before-upload="handleBeforeUpload">
+              <el-icon>
+                <Plus />
+              </el-icon>
             </el-upload>
           </div>
         </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          v-no-double-click="submitForm"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
-    <el-dialog
-      title="Excel导入"
-      v-model="openExcelDialog"
-      width="400"
-      v-loading="loading"
-    >
+    <el-dialog title="Excel导入" v-model="openExcelDialog" width="400" v-loading="loading">
       <template #footer>
-        <el-button @click="openExcelDialog = false" size="large"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          @click="submitExcel()"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitExcel()" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
@@ -419,7 +367,14 @@ const getTreeList = () => {
   proxy
     .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
     .then((message) => {
-      treeListData.value = message;
+      treeListData.value = [
+        {
+          id: "",
+          label: "全部",
+          parentId: "",
+          children: message,
+        },
+      ];
       formConfig.value[0].data = message;
     });
 };

+ 30 - 17
src/views/JXSK/production/bom/index.vue

@@ -465,28 +465,41 @@ const submitForm = () => {
       ...formData.data.bomDetailList,
       ...formData.data.bomDetailListOne,
     ];
-    formData.data.bomDetailList = arr.map((x) => ({
+    // formData.data.bomDetailList = arr.map((x) => ({
+    //   productId: x.productId,
+    //   quantity: x.quantity,
+    //   cost: x.cost,
+    //   type: x.type,
+    //   id: x.id,
+    // }));
+    let bomDetailList = arr.map((x) => ({
       productId: x.productId,
       quantity: x.quantity,
       cost: x.cost,
       type: x.type,
+      id: x.id,
     }));
-    proxy.post(`/bomInfo/${modalType.value}ByJxst`, formData.data).then(
-      (res) => {
-        ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
-          type: "success",
-        });
-        dialogVisible.value = false;
-        submitLoading.value = false;
-        getList();
-      },
-      (err) => {
-        formData.data.bomDetailList = [];
-        formData.data.bomDetailListOne = [];
-        submitLoading.value = false;
-      }
-    );
+    proxy
+      .post(`/bomInfo/${modalType.value}ByJxst`, {
+        ...formData.data,
+        bomDetailList,
+      })
+      .then(
+        (res) => {
+          ElMessage({
+            message: modalType.value == "add" ? "添加成功" : "编辑成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => {
+          formData.data.bomDetailList = [];
+          formData.data.bomDetailListOne = [];
+          submitLoading.value = false;
+        }
+      );
   });
 };
 const byform1 = ref(null);

+ 9 - 7
src/views/JXSK/production/workOrder/index.vue

@@ -83,7 +83,7 @@
               </span>
 
               <!-- 制图 -->
-              <span v-if="isZhiTu && item.researchStatus">
+              <span v-if="isZhiTu && item.researchStatus && item.researchBomStatus">
                 <span v-if="item.isCustomized == 1">
                   <el-button text type="primary" @click="getDtl(item, item.bomStatus ? true : false,1)">
                     <!-- {{ item.bomStatus ? "查看" : "调整" }} -->
@@ -101,10 +101,10 @@
                 <span>
                   <el-button text type="primary" @click="handleUploadFile(item, true)">设计资料</el-button>
                 </span>
-              </span>
-              <span v-if="item.isCustomized == 0">
-                <span v-if="item.productionQuantity == null">
-                  <el-button text type="primary" @click="handleOut(item)">下发</el-button>
+                <span v-if="item.isCustomized == 0">
+                  <span v-if="item.productionQuantity == null">
+                    <el-button text type="primary" @click="handleOut(item)">下发</el-button>
+                  </span>
                 </span>
               </span>
 
@@ -1176,8 +1176,10 @@ const handleSelectRow = (row) => {
 .disActive {
   // background: #fa9841;
   // background: #c4c4c4;
-  border: 1px solid #1c1b1b;
+  // border: 1px solid #1c1b1b;
   border-radius: 4px;
-  color: #1c1b1b;
+  // color: #1c1b1b;
+  border: 1px solid #c4c4c4;
+  color: #c4c4c4;
 }
 </style>

+ 3 - 2
src/views/JXSK/salesMange/contract/index.vue

@@ -244,7 +244,8 @@
               <div>
                 <el-checkbox-group v-model="item.checkList">
                   <el-checkbox v-for="(check) in item.productionTaskDetailList" :key="check.id" :label="check.productSn"
-                               :disabled="check.stockStatus!=10" />
+                               :disabled="check.stockStatus!=10">{{check.productSn}} <span
+                          v-if="check.stockStatus>=15">({{check.stockStatus==15?'出库中':'已出库'}})</span> </el-checkbox>
                 </el-checkbox-group>
               </div>
             </el-collapse-item>
@@ -892,7 +893,7 @@ const outBound = (row) => {
             productSn: y.productSn,
             id: y.id,
             productId: x.productId,
-            stockStatus: x.stockStatus,
+            stockStatus: y.stockStatus,
           };
           obj[y.productSn] = data;
           return data;

+ 52 - 26
src/views/purchaseSales/outAndInWarehouse/manualDelivery/index.vue

@@ -26,15 +26,13 @@
             <template #details>
               <div style="width: 100%">
                 <el-button type="primary" @click="clickAdd()">添加明细</el-button>
-                <el-table :data="formData.data.list" style=" margin-top: 16px">
-                  <el-table-column type="index" width="50" />
+                <el-table :data="formData.data.list" show-summary :summary-method="getSummaries" style=" margin-top: 16px">
+                  <el-table-column type="index" width="60" align="center" />
                   <el-table-column label="是否扫码" width="80">
                     <template #default="{ row, $index }">
                       <div>
                         <span style="padding: 4px" :class="[row.isScan == 1 ? 'active' : 'disActive']">
-                          {{
-                proxy.dictValueLabel(row.isScan, scanData)
-              }}
+                          {{proxy.dictValueLabel(row.isScan, scanData)}}
                         </span>
                       </div>
                     </template>
@@ -73,8 +71,8 @@
               <div class="titlea" @click.stop="handleClickScan">
                 {{btnTitle}}
               </div>
-              <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
-                        @blur="handleScanBlur" class="input" />
+              <el-input v-model="scanValue" :disabled="!isScan" ref="scanInput" @change="handleScanValueChange" @blur="handleScanBlur"
+                        class="input" />
             </div>
           </el-card>
         </div>
@@ -436,28 +434,56 @@ const handleScanBlur = () => {
     btnTitle.value = "扫码出库";
   }, 100);
 };
+
+const timer = ref(null);
 const handleScanValueChange = (val) => {
   if (val) {
-    proxy.post("/purchaseDetail/detail", { id: val }).then(
-      (res) => {
-        formData.data.list.push({
-          isScan: "1",
-          productCode: res.productCode,
-          productId: res.bussinessId,
-          productName: res.productName,
-          productSpec: res.productSpec,
-          productUnit: res.productUnit,
-          quantity: 1,
-          purchaseDetailId: val,
-        });
-        scanValue.value = "";
-      },
-      (err) => {
-        scanValue.value = "";
-      }
-    );
+    let value = val;
+    scanValue.value = "";
+    timer.value && clearTimeout(timer.value);
+    timer.value = setTimeout(() => {
+      proxy.post("/purchaseDetail/detail", { id: value }).then(
+        (res) => {
+          formData.data.list.push({
+            isScan: "1",
+            productCode: res.productCode,
+            productId: res.bussinessId,
+            productName: res.productName,
+            productSpec: res.productSpec,
+            productUnit: res.productUnit,
+            quantity: 1,
+            purchaseDetailId: val,
+          });
+        },
+        (err) => {}
+      );
+    }, 301);
   }
 };
+
+const getSummaries = (param) => {
+  const { columns, data } = param; //columns是每列的信息,data是每行的信息
+  const sums = [];
+  columns.forEach((column, index) => {
+    if (index === 0) {
+      sums[index] = "合计"; //此处是在index=0的这一列显示为“合计”
+      return;
+    }
+    const values = data.map((item) => Number(item[column.property]));
+    if (column.property === "quantity") {
+      sums[index] = values.reduce((prev, curr) => {
+        const value = Number(curr);
+        if (!isNaN(value)) {
+          return Number(parseFloat(prev + curr).toFixed(4));
+        } else {
+          return prev;
+        }
+      }, 0);
+      sums[index];
+    }
+  });
+  return sums;
+};
 </script>
 
 <style lang="scss" scoped>
@@ -490,7 +516,7 @@ const handleScanValueChange = (val) => {
     cursor: pointer;
   }
   .input {
-    opacity: 1;
+    opacity: 0;
     position: absolute;
     top: 0;
     left: 0;

+ 49 - 23
src/views/purchaseSales/outAndInWarehouse/manualWarehousing/index.vue

@@ -27,8 +27,8 @@
             <template #details>
               <div style="width: 100%">
                 <el-button type="primary" @click="clickAdd()">添加明细</el-button>
-                <el-table :data="formData.data.list" style=" margin-top: 16px">
-                  <el-table-column type="index" width="50" />
+                <el-table :data="formData.data.list" show-summary :summary-method="getSummaries" style=" margin-top: 16px">
+                  <el-table-column type="index" width="60" align="center" />
                   <el-table-column label="是否扫码" width="80">
                     <template #default="{ row, $index }">
                       <div>
@@ -74,8 +74,7 @@
               <div class="titlea" @click.stop="handleClickScan">
                 {{btnTitle}}
               </div>
-              <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
-                        @blur="handleScanBlur" class="input" />
+              <el-input v-model="scanValue" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange" @blur="handleScanBlur" class="input" />
             </div>
           </el-card>
         </div>
@@ -419,28 +418,55 @@ const handleScanBlur = () => {
     btnTitle.value = "扫码入库";
   }, 100);
 };
+const timer = ref(null);
 const handleScanValueChange = (val) => {
   if (val) {
-    proxy.post("/purchaseDetail/detail", { id: val }).then(
-      (res) => {
-        formData.data.list.push({
-          isScan: "1",
-          productCode: res.productCode,
-          productId: res.bussinessId,
-          productName: res.productName,
-          productSpec: res.productSpec,
-          productUnit: res.productUnit,
-          quantity: 1,
-          purchaseDetailId: val,
-        });
-        scanValue.value = "";
-      },
-      (err) => {
-        scanValue.value = "";
-      }
-    );
+    let value = val;
+    scanValue.value = "";
+    timer.value && clearTimeout(timer.value);
+    timer.value = setTimeout(() => {
+      proxy.post("/purchaseDetail/detail", { id: value }).then(
+        (res) => {
+          formData.data.list.push({
+            isScan: "1",
+            productCode: res.productCode,
+            productId: res.bussinessId,
+            productName: res.productName,
+            productSpec: res.productSpec,
+            productUnit: res.productUnit,
+            quantity: 1,
+            purchaseDetailId: val,
+          });
+        },
+        (err) => {}
+      );
+    }, 301);
   }
 };
+
+const getSummaries = (param) => {
+  const { columns, data } = param; //columns是每列的信息,data是每行的信息
+  const sums = [];
+  columns.forEach((column, index) => {
+    if (index === 0) {
+      sums[index] = "合计"; //此处是在index=0的这一列显示为“合计”
+      return;
+    }
+    const values = data.map((item) => Number(item[column.property]));
+    if (column.property === "quantity") {
+      sums[index] = values.reduce((prev, curr) => {
+        const value = Number(curr);
+        if (!isNaN(value)) {
+          return Number(parseFloat(prev + curr).toFixed(4));
+        } else {
+          return prev;
+        }
+      }, 0);
+      sums[index];
+    }
+  });
+  return sums;
+};
 </script>
 
 <style lang="scss" scoped>
@@ -473,7 +499,7 @@ const handleScanValueChange = (val) => {
     cursor: pointer;
   }
   .input {
-    opacity: 1;
+    opacity: 0;
     position: absolute;
     top: 0;
     left: 0;

+ 4 - 0
src/views/purchaseSales/outAndInWarehouse/record/index.vue

@@ -188,6 +188,10 @@ const typeList = ref([
     label: "销售合同出库",
     value: "24",
   },
+  {
+    label: "售后物料出库",
+    value: "25",
+  },
 ]);
 const warehouseList = ref([]);
 const productUnit = ref([]);

+ 60 - 29
src/views/purchaseSales/outAndInWarehouse/waitingForDelivery/index.vue

@@ -41,8 +41,8 @@
             <template #details>
               <div style="width: 100%">
                 <el-button type="primary" @click="clickAdd()">添加明细</el-button>
-                <el-table :data="formData.data.stockWaitDetailsList" style=" margin-top: 16px">
-                  <el-table-column type="index" width="50" />
+                <el-table :data="formData.data.stockWaitDetailsList" show-summary :summary-method="getSummaries" style=" margin-top: 16px">
+                  <el-table-column type="index" width="60" align="center" />
                   <el-table-column label="是否扫码" width="80">
                     <template #default="{ row, $index }">
                       <div>
@@ -88,8 +88,7 @@
               <div class="titlea" @click.stop="handleClickScan">
                 {{btnTitle}}
               </div>
-              <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
-                        @blur="handleScanBlur" class="input" />
+              <el-input v-model="scanValue" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange" @blur="handleScanBlur" class="input" />
             </div>
           </el-card>
         </div>
@@ -194,6 +193,10 @@ const businessType = ref([
     label: "销售合同出库",
     value: 12,
   },
+  {
+    label: "售后物料出库",
+    value: 13,
+  },
 ]);
 const sourceList = ref({
   data: [],
@@ -565,35 +568,63 @@ const handleScanBlur = () => {
     btnTitle.value = "扫码出库";
   }, 100);
 };
+
+const timer = ref(null);
 const handleScanValueChange = (val) => {
   if (val) {
-    proxy.post("/purchaseDetail/detail", { id: val }).then(
-      (res) => {
-        if (res.bussinessId != rowData.value.productId) {
-          ElMessage({
-            message: "请扫正确的产品",
-            type: "info",
-          });
+    let value = val;
+    scanValue.value = "";
+    timer.value && clearTimeout(timer.value);
+    timer.value = setTimeout(() => {
+      proxy.post("/purchaseDetail/detail", { id: value }).then(
+        (res) => {
+          if (res.bussinessId != rowData.value.productId) {
+            ElMessage({
+              message: "请扫正确的产品",
+              type: "info",
+            });
+          } else {
+            formData.data.stockWaitDetailsList.push({
+              id: rowData.value.id,
+              isScan: "1",
+              productCode: res.productCode,
+              productId: res.bussinessId,
+              productName: res.productName,
+              productSpec: res.productSpec,
+              productUnit: res.productUnit,
+              quantity: 1,
+              purchaseDetailId: val,
+            });
+          }
+        },
+        (err) => {}
+      );
+    }, 301);
+  }
+};
+
+const getSummaries = (param) => {
+  const { columns, data } = param; //columns是每列的信息,data是每行的信息
+  const sums = [];
+  columns.forEach((column, index) => {
+    if (index === 0) {
+      sums[index] = "合计"; //此处是在index=0的这一列显示为“合计”
+      return;
+    }
+    const values = data.map((item) => Number(item[column.property]));
+    if (column.property === "quantity") {
+      sums[index] = values.reduce((prev, curr) => {
+        const value = Number(curr);
+        if (!isNaN(value)) {
+          return Number(parseFloat(prev + curr).toFixed(4));
         } else {
-          formData.data.stockWaitDetailsList.push({
-            id: rowData.value.id,
-            isScan: "1",
-            productCode: res.productCode,
-            productId: res.bussinessId,
-            productName: res.productName,
-            productSpec: res.productSpec,
-            productUnit: res.productUnit,
-            quantity: 1,
-            purchaseDetailId: val,
-          });
+          return prev;
         }
-        scanValue.value = "";
-      },
-      (err) => {
-        scanValue.value = "";
-      }
-    );
-  }
+      }, 0);
+      sums[index];
+    }
+  });
+  return sums;
 };
 
 const clickAdd = () => {

+ 84 - 1
src/views/salesMange/salesMange/afterSales/index.vue

@@ -131,6 +131,40 @@
                 <el-button type="primary" plain disabled>选择</el-button>
               </el-upload>
             </div>
+            <div style="width: 100%">
+              <TitleInfo content="申请物料" style="margin: 20px 0 20px 0"></TitleInfo>
+              <div style="width: 100%">
+                <el-button type="primary" plain @click="openMaterial = true">
+                  添加物料/半成品
+                </el-button>
+                <el-table :data="formData.followData.afterSalesMaterialsList" style="margin-top: 15px">
+                  <el-table-column prop="productName" label="产品名称" min-width="200" />
+                  <el-table-column prop="productSpec" label="规格型号" width="120" />
+                  <el-table-column prop="quantity" label="数量" width="150">
+                    <template #default="{ row, $index }">
+                      <el-form-item :prop="'afterSalesMaterialsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                        <el-input-number onmousewheel="return false;" v-model="row.quantity" :precision="0" :controls="false" :min="0"
+                                         @change="changeAmount" style="width:80%" />
+                      </el-form-item>
+                    </template>
+                  </el-table-column>
+                  <!-- <el-table-column prop="productRemark" label="备注" min-width="150">
+                    <template #default="{ row, $index }">
+                      <el-form-item :prop="
+                      'afterSalesMaterialsList.' + $index + '.productRemark'
+                    " :rules="rules.productRemark" :inline-message="true">
+                        <el-input v-model="row.productRemark" placeholder="请输入" type="textarea" :rows="3" />
+                      </el-form-item>
+                    </template>
+                  </el-table-column> -->
+                  <el-table-column prop="zip" label="操作" width="60">
+                    <template #default="{ $index }">
+                      <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </div>
           </el-form>
         </div>
       </div>
@@ -140,6 +174,16 @@
         <el-button type="primary" @click="submitFollow()" size="large" :loading="submitLoading" v-if="!isDetail">确 定</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog v-model="openMaterial" title="选择物料/半成品" width="70%" append-to-body>
+      <SelectMaterial @handleSelect="handleSelect"></SelectMaterial>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openMaterial = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+
   </div>
 </template>
   
@@ -149,7 +193,8 @@ import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import useUserStore from "@/store/modules/user";
 import TitleInfo from "@/components/TitleInfo/index.vue";
-import { async } from "@antv/x6/lib/registry/marker/main";
+import SelectMaterial from "@/components/product/SelectMaterial";
+
 const { proxy } = getCurrentInstance();
 const uploadData = ref({});
 const loading = ref(false);
@@ -163,6 +208,7 @@ const sourceList = ref({
     keyword: "",
   },
 });
+const openMaterial = ref(false);
 const dialogVisible = ref(false);
 const openFollow = ref(false);
 const rules = ref({
@@ -178,6 +224,7 @@ const rules = ref({
   afterSalesPersonId: [
     { required: true, message: "请选择售后人员", trigger: "change" },
   ],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
 });
 const userList = ref([]);
 const afterSalesType = ref([]);
@@ -589,6 +636,7 @@ const submitFollow = () => {
           afterSalesRemark: formData.followData.afterSalesRemark,
           amount: formData.followData.amount,
           afterSalesRecordDetailList: arr,
+          afterSalesMaterialsList: formData.followData.afterSalesMaterialsList,
         })
         .then(
           (res) => {
@@ -648,6 +696,7 @@ const handleFollow = (row) => {
   proxy.post("/afterSalesRecord/detail", { id: row.id }).then(async (res) => {
     // 左侧售后信息
     formData.detailData = res;
+
     proxy
       .post("/fileInfo/getList", {
         businessIdList: [row.id],
@@ -675,6 +724,7 @@ const handleFollow = (row) => {
       }
       formData.followData = res;
       formData.followData.id = row.id;
+      formData.followData.afterSalesMaterialsList = [];
       openFollow.value = true;
     } else {
       let arr = res.bomDetailList.map((x) => x.afterSalesRecordDetail.id);
@@ -690,6 +740,7 @@ const handleFollow = (row) => {
       }
       formData.followData = res;
       formData.followData.id = row.id;
+      formData.followData.afterSalesMaterialsList = [];
       openFollow.value = true;
       const fileObj = await proxy.post("/fileInfo/getList", {
         businessIdList: arr,
@@ -759,6 +810,38 @@ const handleSuccess = (any, UploadFile) => {
 const onPreviewFile = (file) => {
   window.open(file.raw.fileUrl, "_blank");
 };
+
+const handleSelect = (row) => {
+  const flag = formData.followData.afterSalesMaterialsList.some(
+    (x) => x.productId === row.id
+  );
+  if (flag) {
+    return ElMessage({
+      message: "该物料已选择",
+      type: "info",
+    });
+  } else {
+    formData.followData.afterSalesMaterialsList.push({
+      productId: row.id,
+      productCode: row.code,
+      productName: row.name,
+      productSpec: row.spec,
+      quantity: null,
+    });
+    return ElMessage({
+      message: "选择成功",
+      type: "success",
+    });
+  }
+};
+
+const handleRemove = (index, type) => {
+  formData.followData.afterSalesMaterialsList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
 </script>
   
 <style lang="scss" scoped>