소스 검색

1.修改工序管理相关需求;

zhaoxing 2 년 전
부모
커밋
45932952bc
1개의 변경된 파일81개의 추가작업 그리고 76개의 파일을 삭제
  1. 81 76
      imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/technologyMgr/index.vue

+ 81 - 76
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/technologyMgr/index.vue

@@ -36,7 +36,7 @@
           <el-input-number @change="test" v-model="row.sort" :min="1" :max="100" :placeholder='$t("common.pleaseEnter")'></el-input-number>
         </template>
       </el-table-column>
-      <el-table-column v-for="item in tableData.titleList" :key="item.id" :prop="item.identifier" :label='item.fieldName' :show-overflow-tooltip="true"  v-if="item.identifier!='opid'">
+      <el-table-column v-for="item in tableData.titleList" :key="item.id" :prop="item.identifier" :label='item.fieldName' :show-overflow-tooltip="true" v-show="item.identifier!='opid'">
         <template slot="header">
           <span>{{ item.fieldName }}</span>
           <span v-if="item.identifier!='remark'" class="star">*</span>
@@ -95,9 +95,9 @@
             </div>
           </div>
 
-           <!-- 如果是【隐藏域】-->
-           <div v-if="item.formControlsType == 'hidden' && item.showStatus == '1'" :key="item.id">
-            <div class="block">             
+          <!-- 如果是【隐藏域】-->
+          <div v-if="item.formControlsType == 'hidden' && item.showStatus == '1'" :key="item.id">
+            <div class="block">
               <el-input v-model="row[item.identifier]" v-show="false" :disabled="item.readonly == '1' ? true : false" :placeholder='$t("common.pleaseEnter")' />
             </div>
           </div>
@@ -495,42 +495,29 @@ export default {
       // this.getSpanArr(this.tableData.data)
     },
     changename(name, obj) {
-      let keys = this.dictsKeys;
-      let no = keys.find(
-        (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == name
-      );
-      let n = no ? no[no.length - 1] : -2;
-      obj["no"] = `OP${obj.xh}${n}`;
-      if (n == 0 || n == 1 || n == 3) {
-        obj["type"] = `设备序`;
-      }
-      if (n == 2) {
-        obj["type"] = `工序下料`;
-      }
-      if (n == 6) {
-        obj["type"] = `工序上料`;
-      }
-      if (n == 5) {
-        obj["type"] = `下料`;
-      }
-      if (n == 4) {
-        obj["type"] = `热处理下料`;
-      }
-      if (n == 8) {
-        obj["type"] = `热处理上料`;
+      try {
+        const keys = this.dictsKeys,
+          no = keys.find(
+            (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == name
+          ),
+          n = no ? no[no.length - 1] : -2;
+        obj["no"] = `OP${obj.xh}${n}`;
+        if (obj.index == 1) obj["no"] = `OP0${n}`;
+        this.getType(n, obj);
+      } catch (error) {
+        cosnole.log(error);
       }
     },
     getSpanArr(data) {
       // firstLevelIndexArr/secondLevelIndexArr来存放要合并的格数,同时还要设定一个变量firstLevelIndexPos/secondLevelIndexPos来记录
       for (let i = 0, len = data.length; i < len; i++) {
-        let xh = Math.ceil((i + 1) / 4);
-
-        data[i].index = i + 1;
+        const item = data[i];
+        item.index = i + 1;
         if (i == 0) {
-          data[i].no = `OP${i}5`;
-          data[i].type = `上料`;
-          data[i].name = `上料`;
-          data[i].content = `上料`;
+          item.no = `OP${i}5`;
+          item.type = `上料`;
+          item.name = `上料`;
+          item.content = `上料`;
         }
       }
       data.sort((a, b) => a.xh - b.xh);
@@ -542,8 +529,6 @@ export default {
           this.firstLevelIndexArr.push(1);
           this.firstLevelIndexPos = 0;
         } else {
-          // 判断当前元素与上一个元素是否相同(第1和第2列)
-
           if (data[i].xh === data[i - 1].xh) {
             this.firstLevelIndexArr[this.firstLevelIndexPos] += 1;
             this.firstLevelIndexArr.push(0);
@@ -565,20 +550,6 @@ export default {
         };
       }
     },
-
-    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
-      let n = this.tableData.data.filter((ele) => ele.xh == row.xh);
-      n = n.length;
-      console.log(n);
-      if (columnIndex === 0 || columnIndex === 11) {
-        if (rowIndex % n === 0) {
-          return [n, 1];
-        } else {
-          return [0, 0];
-        }
-      }
-    },
-
     // 【确认】按钮-事件
     submitForm() {
       let obj = {
@@ -593,10 +564,10 @@ export default {
 
         for (let property in item) {
           if (
-            ["remark", "xh", "index", "isadd", "isinput", "opid"].includes(property)
+            ["remark", "xh", "index", "isadd", "isinput", "opid"].includes(
+              property
+            )
           ) {
-            // if (["xh", "index", "isadd"].includes(property))
-            //   delete item[property];
             continue;
           }
           if (
@@ -706,25 +677,7 @@ export default {
             }
             if (key == "sort") obj[key] = (item.sort || 101) - i - 1;
             let n = obj.no ? obj.no[obj.no.length - 1] : -2;
-            if (n == 0 || n == 1 || n == 3) {
-              obj["type"] = `设备序`;
-            }
-            if (n == 2) {
-              obj["type"] = `工序下料`;
-            }
-            if (n == 6) {
-              obj["type"] = `工序上料`;
-            }
-            if (n == 5) {
-              obj["type"] = `下料`;
-            }
-            if (n == 4) {
-              obj["type"] = `热处理下料`;
-            }
-            if (n == 8) {
-              obj["type"] = `热处理上料`;
-            }
-            // obj["no"] = `OP${xh}${i}`;
+            this.getType(n, obj);
             obj.content = obj.name;
           }
           this.tableData.data.push(obj);
@@ -736,9 +689,7 @@ export default {
     },
     add1(xh, index) {
       // let index = this.tableData.data.length - 1;
-
       let obj = {};
-
       // let xh = Math.ceil((index + 1 + 1) / 4);
       obj.xh = xh;
       // obj.index = index + 1 + 1;
@@ -746,13 +697,57 @@ export default {
         obj[key] = "";
         obj["type"] = `设备序`;
         obj["name"] = `打标`;
+        obj["content"] = `打标`;
         obj["no"] = `OP${xh}3`;
       }
-      this.tableData.data.splice(index, 0, obj);
+      obj.isdel = true; //标识当前小行是可以直接删除而不是默认的清楚内容
+      console.log(this.tableData.data[index - 1]);
+      obj.sort = this.tableData.data[index - 1].sort - 1;
 
+      this.tableData.data.splice(index, 0, obj);
+      // 更新排序值
+      this.tableData.data.every((ele, i) => {
+        if (i > index) ele.sort = +ele.sort - 1;
+        return true;
+      });
       this.getSpanArr(this.tableData.data);
+      console.log(obj.sort);
+    },
+    getType(n, obj) {
+      if (n == 0 || n == 1 || n == 3) {
+        obj["type"] = `设备序`;
+      }
+      if (n == 2) {
+        obj["type"] = `工序下料`;
+      }
+      if (n == 6) {
+        obj["type"] = `工序上料`;
+      }
+      if (n == 5) {
+        obj["type"] = `下料`;
+      }
+      if (n == 4) {
+        obj["type"] = `热处理下料`;
+      }
+      if (n == 8) {
+        obj["type"] = `热处理上料`;
+      }
     },
     clear(row) {
+      if (row.isdel) {
+        // 更新排序值
+        // let index_isadd = this.tableData.data.find(
+        //   (ele) => ele.xh == row.xh && ele.isadd
+        // );
+        // let n = row.index - index_isadd; //计算当前删除行和可执行新增行的差值
+        this.tableData.data.every((ele, i) => {
+          if (i > row.index - 1) ele.sort = +ele.sort + 1;
+          return true;
+        });
+        this.tableData.data.splice(row.index - 1, 1);
+        this.getSpanArr(this.tableData.data);
+        return;
+      }
       for (let key in this.titleMap) {
         if (key == "sort") continue;
         row[key] = "";
@@ -776,12 +771,22 @@ export default {
         type: "warning",
       })
         .then(() => {
+          let data_del = this.tableData.data.filter((ele) => ele.xh == row.xh);
           let data = this.tableData.data.filter((ele) => ele.xh != row.xh);
-
+         
           for (let i = 0, len = data.length; i < len; i++) {
+            if (data[i].xh > row.xh) {
+              data[i].sort = +data[i].sort + data_del.length; //更新排序值
+            }
+
             if (data[i].xh > row.xh) data[i].xh = data[i].xh - 1;
+            // 更新编码的n值
+            let arr = data[i].no.split("");
+            arr.splice(2, 1, data[i].xh);
+            data[i].no = arr.join("");
           }
           this.tableData.data = data;
+          this.getSpanArr(this.tableData.data);
           // // 过滤我们需要的数据
           // this.tableData.data.splice(index, 1);
           // // 清除table的选中数据