Andy преди 3 години
родител
ревизия
6e63ea2535
променени са 2 файла, в които са добавени 125 реда и са изтрити 61 реда
  1. 124 60
      src/views/OrderMannage/BusinessOrderlist/edit.vue
  2. 1 1
      vue.config.js

+ 124 - 60
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -612,39 +612,67 @@
             :edit-render="{}"
           >
             <template #edit="scope">
-              <Select
-                clearable
-                transfer
-                label-in-value
-                :value="
-                  scope.row.part.filter((v) => v.type_id == part_type.id)
-                    .length > 0
-                    ? scope.row.part.filter((v) => v.type_id == part_type.id)[0]
-                        .part_id
-                    : ''
+              <div
+                v-for="(part_detail, part_index) in scope.row.part"
+                :key="part_index"
+                v-show="part_detail.type_id == part_type.id"
+                :style="
+                  part_index != scope.row.part.length - 1 &&
+                  scope.row.part.length > 1
+                    ? {
+                        borderBottom: '1px solid #e8eaec',
+                        padding: '10px 0',
+                      }
+                    : { padding: '10px 0' }
                 "
-                @on-change="changeEditPart(scope.row, part_type)"
               >
-                <Option
-                  v-for="ch in scope.row.part.filter(
-                    (v) => v.type_id == part_type.id
-                  ).length > 0
-                    ? scope.row.part.filter((v) => v.type_id == part_type.id)[0]
-                        .change
-                    : []"
-                  :key="ch.part_id + '999'"
-                  :label="ch.part_title"
-                  :value="ch.part_id"
-                />
-              </Select>
+                <Select
+                  clearable
+                  transfer
+                  label-in-value
+                  :value="part_detail.change_id"
+                  @on-change="
+                    (e) => changeEditPart(scope.row, part_type, part_detail, e)
+                  "
+                >
+                  <!-- scope.row.part.filter((v) => v.type_id == part_type.id)
+                      .length > 0
+                      ? scope.row.part.filter(
+                          (v) => v.type_id == part_type.id
+                        )[0].part_id
+                      : '' -->
+                  <Option
+                    v-for="ch in part_detail.change"
+                    :key="ch.id + '999'"
+                    :label="ch.part_title"
+                    :value="ch.id"
+                  />
+                </Select>
+              </div>
             </template>
-            <template #default="{ row }">
-              {{
+            <template #default="scope">
+              <div
+                v-for="(part_detail, part_index) in scope.row.part"
+                :key="part_index"
+                v-show="part_detail.type_id == part_type.id"
+                :style="
+                  part_index != scope.row.part.length - 1 &&
+                  scope.row.part.length > 1
+                    ? {
+                        borderBottom: '1px solid #e8eaec',
+                        padding: '10px 0',
+                      }
+                    : { padding: '10px 0' }
+                "
+              >
+                {{ part_detail.part_title || part_detail.title }}
+              </div>
+              <!-- {{
                 row.part.filter((v) => v.type_id == part_type.id).length > 0
                   ? row.part.filter((v) => v.type_id == part_type.id)[0].title
                   : ""
-              }}</template
-            >
+              }} -->
+            </template>
           </vxe-column>
           <vxe-column title="原材料名称" min-width="200">
             <template #default="scope">
@@ -1456,7 +1484,7 @@
                       !element.is_metal &&
                         element.hide_process &&
                         !element.hide_process.filter(
-                          (v) => process_all_list[v] == process_detail.name
+                          (v) => v == process_detail.id
                         ).length > 0
                     "
                   >
@@ -2325,11 +2353,6 @@ export default {
         }
       });
     },
-    // 表格位置选择
-    handleTablePositionChange(obj, $event) {
-      console.log("obj :>> ", obj);
-      console.log("$event :>> ", $event);
-    },
     handleShowMaterial() {
       this.is_material_show = !this.is_material_show;
     },
@@ -2342,6 +2365,7 @@ export default {
           this.tableData = res.data.product_list;
           this.support_remark = res.data.product_list[0].support_remark;
           this.tableData.forEach((element) => {
+            element.type_name = element.title;
             for (const k in element.procedure_properties) {
               const v = element.procedure_properties[k];
               element[k] = v * 1;
@@ -2361,11 +2385,19 @@ export default {
                 new RegExp(v.e_title, "g"),
                 ""
               );
+              // 表格编辑时用
+              element.value = "";
+              v.measureCalc = v.e_title;
             });
             element.part.forEach((elem) => {
               if (!elem.is_metal) {
                 // 表格数据展示字段
                 elem.process_str = elem.process;
+                elem.process = JSON.parse(JSON.stringify(this.process_obj));
+                elem.process.map((v) => {
+                  v.value = element[v.id];
+                });
+                console.log("elem.process :>> ", elem.process);
                 elem.measurement = elem.measure;
                 elem.longCalc = elem.long;
                 elem.wideCalc = elem.wide;
@@ -2519,7 +2551,6 @@ export default {
             "/"
           );
           // 尺寸
-          this.modalData.measure;
           if (!this.modalData.measurement) {
             this.modalData.measurement = "";
           }
@@ -2539,7 +2570,7 @@ export default {
             tempStr_no_letter.length - 1
           );
           // 五金、  附加项目
-          this.modalData.ext = [...this.modalData.extArray];
+          this.modalData.ext = this.modalData.extArray;
           //其他项
           this.modalData.other = this.modalData.customize;
           // 部件字段
@@ -2570,13 +2601,14 @@ export default {
             }
           });
           this.modalData.extra = "";
-          this.modalData.extArray.map((item) => {
-            const temp = this.extList.filter((it) => it.id == item.ext_id);
-            temp && temp.length > 0 && (item.title = temp[0].title);
-          });
-          this.modalData.extra = this.modalData.extArray.reduce((pre, cur) => {
+          this.modalData.extArray &&
+            this.modalData.extArray.map((item) => {
+              const temp = this.extList.filter((it) => it.id == item.ext_id);
+              temp && temp.length > 0 && (item.title = temp[0].title);
+            });
+          this.modalData.extra = this.modalData.extArray?this.modalData.extArray.reduce((pre, cur) => {
             return pre + `${cur.title}/`;
-          }, "");
+          }, ""):'/';
           this.modalData.extra = this.modalData.extra.substring(
             0,
             this.modalData.extra.length - 1
@@ -3155,6 +3187,7 @@ export default {
             if (!element.procedure_properties) {
               element.procedure_properties = {};
             }
+            element.process_obj = element.process;
             element.process_obj.forEach((elem, index) => {
               const _temp = elem.cld.filter((item) => item.id == elem.value);
               element.procedure_properties_str[index] =
@@ -3493,17 +3526,34 @@ export default {
       row.isEdit = true;
       row.procedure_properties[obj.id] = row[obj.id];
       row.process_obj.filter((v) => v.id == obj.id)[0].value = row[obj.id];
+      row.part.map((item) => {
+        if (!item.is_metal) {
+          //赋值默认工艺属性
+          item.process = JSON.parse(JSON.stringify(this.bpp_list));
+          item.process.forEach((elem, index) => {
+            elem.value = row.process_obj.filter(
+              (v) => v.id == elem.id
+            )[0].value;
+          });
+        }
+      });
     },
     changeEditMeasure(e, row, measure) {
       row.isEdit = true;
-      console.log("e :>> ", e);
-      console.log("row :>> ", row);
-      console.log("measure :>> ", measure);
-      this.handleProductMeasureChange(e, row, measure);
+      this.handleProductMeasureChange(
+        e,
+        row,
+        row.measure.filter((v) => v.id == measure.id)[0]
+      );
     },
-    changeEditPart(row, part_type) {
+    changeEditPart(row, part_type, part_detail, e) {
       row.isEdit = true;
       console.log("row :>> ", row);
+      console.log("part_type :>> ", part_type);
+      console.log("part_detail :>> ", part_detail);
+      console.log("e :>> ", e);
+      part_detail.change_id = e.value;
+      this.handlePartChange(e, part_detail, row.measure, row.total_num);
     },
     changeEditTableData(row, rowIndex, $event, scope) {
       if ($event) {
@@ -3548,6 +3598,21 @@ export default {
               element.isBP = true;
               element.isChoosed = true;
               element.title = element.part_title;
+              element.process = JSON.parse(JSON.stringify(this.bpp_list));
+              element.process.forEach((elem, index) => {
+                for (const key in res.data.process.title) {
+                  const ele = res.data.process.title[key];
+                  if (elem.name == ele) {
+                    elem.value = this.pre_process_obj[key] * 1;
+                    elem.process_id = key;
+                    if (!element.procedure_properties) {
+                      element.procedure_properties = {};
+                    }
+                    element.procedure_properties[key] =
+                      this.pre_process_obj[key] * 1;
+                  }
+                }
+              });
               if (element.is_null == 1) {
                 element.change_id = "";
               } else {
@@ -3896,9 +3961,7 @@ export default {
           elem.wideCalc = elem.wide || "";
           elem.highCalc = elem.high || "";
           elem.org_num = elem.num;
-          elem.material_detail_org_num = JSON.parse(
-            JSON.stringify(elem.num || 0)
-          );
+          elem.material_detail_org_num = elem.num || 0;
           elem.num =
             ((elem.material_detail_org_num || elem.num) * product_num) | 0;
           elem.material_detail_num = elem.material_detail_org_num * product_num;
@@ -3957,6 +4020,7 @@ export default {
                 }
               }
             }
+            console.log("item.long :>> ", item.long);
             if ((item.wide || "").indexOf(element.measureCalc) != -1) {
               if (typeof (element.value * 1) == "number") {
                 item.wide = item.wide.replace(
@@ -4147,12 +4211,15 @@ export default {
     handleProductMeasureChange(e, product, measure_detail) {
       if (e.target.value) {
         let cur_measure = measure_detail.measureCalc;
-        let cur_value = measure_detail.value;
+        let cur_value = e.target.value;
         product.over_price = 0;
         //当前测量字段 L W H  修改部件测量字段
         product.part.forEach((element) => {
           if (!element.is_metal) {
             if (!element.is_null == 1) {
+              element.highCalc = element.highCalc + "";
+              element.longCalc = element.longCalc + "";
+              element.wideCalc = element.wideCalc + "";
               //处理公式
               if (element.highCalc.indexOf(cur_measure) != -1) {
                 element.high = element.highCalc.replace(
@@ -4189,24 +4256,24 @@ export default {
                 }
               }
               if (flag_high) {
-                element.high = JSON.parse(JSON.stringify(element.high));
               } else {
                 element.high = eval(element.high);
                 element.high += "";
               }
               if (flag_long) {
-                element.long = JSON.parse(JSON.stringify(element.long));
               } else {
                 element.long = eval(element.long);
                 element.long += "";
               }
               if (flag_wide) {
-                element.wide = JSON.parse(JSON.stringify(element.wide));
               } else {
                 element.wide = eval(element.wide);
                 element.wide += "";
               }
               element.part_detail.forEach((elem) => {
+                elem.highCalc = elem.high + "";
+                elem.longCalc = elem.long + "";
+                elem.wideCalc = elem.wide + "";
                 if (!elem.high) {
                 } else if (elem.highCalc.indexOf(cur_measure) != -1) {
                   elem.high = elem.highCalc.replace(
@@ -4252,21 +4319,18 @@ export default {
                   }
                 }
                 if (_flag_high) {
-                  elem.high = JSON.parse(JSON.stringify(elem.high));
                 } else {
                   elem.high = eval(elem.high);
                   elem.high += "";
                   elem.high == "null" && (elem.high = 0);
                 }
                 if (_flag_long) {
-                  elem.long = JSON.parse(JSON.stringify(elem.long));
                 } else {
                   elem.long = eval(elem.long);
                   elem.long += "";
                   elem.long == "null" && (elem.long = 0);
                 }
                 if (_flag_wide) {
-                  elem.wide = JSON.parse(JSON.stringify(elem.wide));
                 } else {
                   elem.wide = eval(elem.wide);
                   elem.wide += "";
@@ -4288,7 +4352,7 @@ export default {
                 item.long >= element.min &&
                 item.long < element.max
               ) {
-                item.formula_temp = JSON.parse(JSON.stringify(element.formula));
+                item.formula_temp = element.formula;
                 item.formula_temp = item.formula_temp.replace(/H/g, item.long);
                 item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
                 item.formula_temp = item.formula_temp.replace(/T/g, item.high);
@@ -4300,7 +4364,7 @@ export default {
                 item.wide >= element.min &&
                 item.wide < element.max
               ) {
-                item.formula_temp = JSON.parse(JSON.stringify(element.formula));
+                item.formula_temp = element.formula;
                 item.formula_temp = item.formula_temp.replace(/H/g, item.long);
                 item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
                 item.formula_temp = item.formula_temp.replace(/T/g, item.high);
@@ -4312,7 +4376,7 @@ export default {
                 item.high >= element.min &&
                 item.high < element.max
               ) {
-                item.formula_temp = JSON.parse(JSON.stringify(element.formula));
+                item.formula_temp = element.formula;
                 item.formula_temp = item.formula_temp.replace(/H/g, item.long);
                 item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
                 item.formula_temp = item.formula_temp.replace(/T/g, item.high);
@@ -4321,7 +4385,7 @@ export default {
               }
             });
         });
-
+        console.log("123 :>> ", 123);
         //修改核算数量
         // 如果没有核算数量公式,核算数量取产品数量
         if (product.num_formula == "") {

+ 1 - 1
vue.config.js

@@ -1,6 +1,6 @@
 const axios_default_ip =
     process.env.NODE_ENV == 'dev' ?
-    'http://121.37.173.82:82' :
+    'http://121.41.102.225:82' :
     process.env.NODE_ENV == 'test-prd' ?
     'http://121.41.102.225:82' //测试服
     :