ysy 1 an în urmă
părinte
comite
f78e4bd012
1 a modificat fișierele cu 27 adăugiri și 123 ștergeri
  1. 27 123
      src/views/material/BOMmanage/components/workingProcedure.vue

+ 27 - 123
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -331,9 +331,14 @@
               </div>
             </template>
             <template v-slot:action="{ row, $index }">
-              <el-link type="primary" @click="handleDel(row, $index)"
+              <el-link type="danger" @click="handleDel(row, $index)"
                 >删除</el-link
               >
+              <el-link type="primary" @click="handSubstitution(row)"
+                >替代料</el-link
+              >
+
+              
             </template>
             <template v-slot:subCode="{ row }">
               <div v-if="isView">{{ row.subCode }}</div>
@@ -523,113 +528,7 @@
             </template>
           </ele-pro-table>
         </el-tab-pane>
-        <el-tab-pane label="替代料" name="替代料">
-          <ele-pro-table
-            ref="replaceMaterialTable"
-            :columns="columns1"
-            :datasource="datasource"
-            :need-page="false"
-            :immediate="true"
-          >
-            <!-- 表头工具栏 -->
-            <template v-slot:toolbar>
-              <el-button type="primary" v-if="!isView" @click="add"
-                >添加</el-button
-              >
-              <div class="toolbar_box">
-                <div
-                  ><span>基本数量</span>
-                  <el-input
-                    placeholder="请输入"
-                    :disabled="isView"
-                    v-model.number="baseCount2"
-                  >
-                  </el-input>
-                  <DictSelection dictName="计量单位" v-model="baseCountUnit2"
-                /></div>
-              </div>
-            </template>
-
-            <template v-slot:action="{ row, $index }">
-              <el-link type="primary" @click="handleDel(row, $index)"
-                >删除</el-link
-              >
-            </template>
-            <template v-slot:subCode="{ row }">
-              <div v-if="isView">{{ row.subCode }}</div>
-              <el-input
-                v-else
-                v-model="row.subCode"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:isReworkBom="{ row }">
-              <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
-              <div v-else>
-                <el-select v-model="row.isReworkBom">
-                  <el-option
-                    v-for="item in isReworkBomList"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </el-select>
-              </div>
-            </template>
-
-            <template v-slot:unit="{ row }">
-              <div v-if="isView">{{ row.unit }}</div>
-              <div v-else>
-                <DictSelection
-                  dictName="计量单位"
-                  v-model="row.unit"
-                ></DictSelection>
-              </div>
-            </template>
-
-            <template v-slot:count="{ row }">
-              <div v-if="isView">{{ row.count }}</div>
-              <el-input
-                v-else
-                v-model="row.count"
-                placeholder="请输入"
-                @input="
-                  (value) =>
-                    (row.count = value.replace(
-                      /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
-                      '$1$2.$3'
-                    ))
-                "
-              ></el-input>
-            </template>
-
-            <template v-slot:categoryName="{ row, $index }">
-              <div v-if="isView">{{ row.categoryName }}</div>
-              <div v-else
-                ><el-input
-                  :value="row.categoryName"
-                  placeholder="请选择"
-                  @click.native="categorySelect(row, $index)"
-                ></el-input
-              ></div>
-            </template>
-
-            <template v-slot:bomArtFiles="{ row }">
-              <fileUpload v-model="row.bomArtFiles" type="add" size="mini" />
-            </template>
-
-            <template v-slot:remark="{ row }">
-              <div v-if="isView">{{ row.remark }}</div>
-              <el-input
-                v-else
-                v-model="row.remark"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-          </ele-pro-table>
-        </el-tab-pane>
+  
         <el-tab-pane label="工种" name="工种">
           <ele-pro-table
             ref="jobTable"
@@ -1155,9 +1054,7 @@
           type = 'materialQuota';
         } else if (this.activeName === '制造资源') {
           type = 'resource';
-        } else if (this.activeName === '替代料') {
-          type = 'replaceMaterial';
-        }
+        } 
         if (title == '选择物料') {
           this.$set(
             this.tableData.taskParam[this.currentIndex][type][idx],
@@ -1217,8 +1114,6 @@
           type = 'materialQuota';
         } else if (this.activeName === '制造资源') {
           type = 'resource';
-        } else if (this.activeName === '替代料') {
-          type = 'replaceMaterial';
         } else if (this.activeName === '工种') {
           type = 'aptitudeParam';
         } else if (this.activeName === '工艺文件') {
@@ -1289,10 +1184,25 @@
           });
         });
 
-        this.tableData.taskParam[this.currentIndex].materialQuota =
-          this.tableData.taskParam[this.currentIndex].materialQuota.concat(
-            array
-          );
+            let _arr =   this.tableData.taskParam[this.currentIndex].materialQuota.concat(
+                    array
+                  );
+             let uniqueArray = []
+
+            uniqueArray = _arr.reduce((acc, current) => {
+            const existing = acc.find(item => item.id === current.id);
+            if (!existing) {
+                acc.push(current);
+            }
+            return acc;
+        }, []);
+
+
+
+        this.tableData.taskParam[this.currentIndex].materialQuota = uniqueArray
+       
+
+
 
         this.$refs.materialTable.setData(
           this.tableData.taskParam[this.currentIndex].materialQuota
@@ -1334,8 +1244,6 @@
           return;
         } else if (this.activeName === '制造资源') {
           type = 'resource';
-        } else if (this.activeName === '替代料') {
-          type = 'replaceMaterial';
         }
         console.log(this.tableData.taskParam[this.currentIndex]);
         if (this.tableData.taskParam[this.currentIndex][type].length) {
@@ -1394,10 +1302,6 @@
           this.$refs.resourceTable.setData(
             this.tableData.taskParam[this.currentIndex].resource || []
           );
-        } else if (this.activeName === '替代料') {
-          this.$refs.replaceMaterialTable.setData(
-            this.tableData.taskParam[this.currentIndex].replaceMaterial || []
-          );
         } else if (this.activeName === '工种') {
           if (
             JSON.stringify(