浏览代码

Merge branch 'master' of 121.41.102.225:Nidong/jiufang into hw

mushencc 3 年之前
父节点
当前提交
2ae6548f58
共有 2 个文件被更改,包括 554 次插入435 次删除
  1. 41 144
      src/components/product/add/index.vue
  2. 513 291
      src/views/OrderMannage/BusinessOrderlist/edit.vue

+ 41 - 144
src/components/product/add/index.vue

@@ -120,7 +120,7 @@
                   <Tooltip style="width: 120px" transfer>
                     <span slot="content">
                       <span
-                        v-for="_item in ele.processList"
+                        v-for="_item in ele.cld"
                         :key="_item.id"
                         v-show="_item.id == ele.value"
                         >{{ _item.title }}</span
@@ -150,7 +150,7 @@
                       size="small"
                     >
                       <Option
-                        v-for="option of ele.processList"
+                        v-for="option of ele.cld"
                         :key="option.id"
                         :disabled="option.isDisabled"
                         :label="option.title"
@@ -481,7 +481,7 @@
                     <span
                       v-for="_item in process_detail.cld"
                       :key="_item.id"
-                      v-show="_item.id == process_detail.procedure_property"
+                      v-show="_item.id == process_detail.value"
                       >{{ _item.title }}</span
                     >
                   </span>
@@ -491,8 +491,11 @@
                     clearable
                     transfer
                     label-in-value
-                    @on-change="(e) => handlePartProcessChange(e, idx, element)"
-                    v-model="process_detail.procedure_property"
+                    @on-change="
+                      (e) =>
+                        handlePartProcessChange(e, idx, element, process_detail)
+                    "
+                    v-model="process_detail.value"
                     size="small"
                   >
                     <Option
@@ -628,13 +631,6 @@
           <div class="modal_product_info_title">
             附加信息
             <Button
-              @click="handleExtraAdd(currencyProduct.metalArray, 1)"
-              type="primary"
-              style="margin-right: 5px"
-              size="small"
-              >新增五金</Button
-            >
-            <Button
               @click="handleExtraAdd(currencyProduct.extArray, 2)"
               type="primary"
               size="small"
@@ -644,89 +640,6 @@
           <div class="modal_product_info_content modal_extra">
             <Form
               :model="element"
-              v-for="(element, idx) in currencyProduct.metalArray"
-              :key="element.id"
-              :label-width="80"
-            >
-              <FormItem label="五金:">
-                <Select
-                  filterable
-                  clearable
-                  transfer
-                  label-in-value
-                  size="small"
-                  @on-change="
-                    (e) =>
-                      handleMetalChange(
-                        e,
-                        element,
-                        idx,
-                        currencyProduct.metalArray
-                      )
-                  "
-                  v-model="element.material_id"
-                  style="width: 100px"
-                >
-                  <Option
-                    v-for="item of metalList"
-                    :key="item.id"
-                    :label="item.title"
-                    :value="item.id"
-                  ></Option>
-                </Select>
-              </FormItem>
-              <FormItem label="数量:">
-                <Input
-                  size="small"
-                  v-model="element.num"
-                  @on-change="handleTotalPriceCalc(element, currencyProduct)"
-                  style="width: 100px"
-                  placeholder="请输入数量"
-                />
-              </FormItem>
-              <FormItem label="单价:">
-                <Input
-                  size="small"
-                  v-model="element.price"
-                  @on-change="handleTotalPriceCalc(element, currencyProduct)"
-                  style="width: 100px"
-                  placeholder="请输入单价"
-                />
-              </FormItem>
-              <FormItem label="金额:">
-                <Input
-                  size="small"
-                  @on-change="handleTotalPriceChange(element, currencyProduct)"
-                  v-model="element.total_price"
-                  style="width: 100px"
-                  placeholder="请输入金额"
-                />
-              </FormItem>
-              <FormItem label="备注:">
-                <Input
-                  size="small"
-                  v-model="element.remark"
-                  style="width: 100px"
-                  placeholder="请输入备注"
-                />
-              </FormItem>
-              <FormItem>
-                <a
-                  style="color: red"
-                  @click="
-                    handleExtraDele(
-                      currencyProduct.metalArray,
-                      element,
-                      idx,
-                      currencyProduct
-                    )
-                  "
-                  >删除</a
-                >
-              </FormItem>
-            </Form>
-            <Form
-              :model="element"
               v-for="(element, idx) in currencyProduct.extArray"
               :key="element.id"
               :label-width="80"
@@ -832,7 +745,6 @@ export default {
           num: 1,
           position: "位置",
           index: "0",
-          metalArray: [],
           extArray: [],
         },
       ], //新增产品列表
@@ -848,7 +760,6 @@ export default {
       extList: [], //五金列表
       currencyProduct: {}, //当前展示数据
       process_list: [], //所有工艺属性
-      tempMetalArray: [], //临时五金信息,更换产品是否保留用
       tempExtArray: [], //临时附加信息,更换产品是否保留用
       isAdd: false, //判断产品是否为添加
     };
@@ -912,7 +823,6 @@ export default {
         position: "",
         index,
         extArray: [{ type: 2 }],
-        metalArray: [{ type: 1 }],
       });
     },
     handleAddProductSelect(row) {
@@ -1034,33 +944,35 @@ export default {
                   if (this.isAdd) {
                     modalData.process.push({
                       key: key,
+                      id: key,
                       title: ele,
                       value: "",
-                      processList: element.cld,
+                      cld: element.cld,
                     });
                   } else {
                     const compare = res.data.process.list.filter(
                       (item) => item.detail[key] == this.pre_process_obj[key]
                     );
                     if (compare.length > 0) {
-                      modalData.procedure_properties = [];
-                      modalData.procedure_properties.push(
-                        this.pre_process_obj[key] * 1
-                      );
+                      modalData.procedure_properties = {};
+                      modalData.procedure_properties[key] =
+                        this.pre_process_obj[key] * 1;
                       modalData.process.push({
                         key: key,
+                        id: key,
                         title: ele,
                         value: this.pre_process_obj[key] * 1,
-                        processList: element.cld,
+                        cld: element.cld,
                       });
                     } else {
-                      modalData.procedure_properties = [];
-                      modalData.procedure_properties.push("");
+                      modalData.procedure_properties = {};
+                      modalData.procedure_properties[key] = "";
                       modalData.process.push({
                         key: key,
+                        id: key,
                         title: ele,
                         value: "",
-                        processList: element.cld,
+                        cld: element.cld,
                       });
                     }
                   }
@@ -1075,12 +987,12 @@ export default {
                   for (const key in res.data.process.title) {
                     const ele = res.data.process.title[key];
                     if (elem.name == ele) {
-                      elem.procedure_property = this.pre_process_obj[key] * 1;
+                      elem.value = this.pre_process_obj[key] * 1;
                       elem.process_id = key;
                       if (!element.procedure_properties) {
-                        element.procedure_properties = [];
+                        element.procedure_properties = {};
                       }
-                      element.procedure_properties[index] =
+                      element.procedure_properties[key] =
                         this.pre_process_obj[key] * 1;
                     }
                   }
@@ -1088,10 +1000,8 @@ export default {
               }
             });
             if (res.data.bp_id == this.pre_bp_id) {
-              modalData.metalArray = this.tempMetalArray;
               modalData.extArray = this.tempExtArray;
             } else {
-              modalData.metalArray = [];
               modalData.extArray = [];
             }
           }
@@ -1102,7 +1012,7 @@ export default {
       if (val) {
         let change = [];
         if (product.part.filter((v) => !v.change_id).length > 0) {
-          ele.processList = [];
+          ele.cld = [];
           this.$forceUpdate();
           return this.$Message.warning("请先选择部件!");
         }
@@ -1114,9 +1024,9 @@ export default {
           });
         });
         let list = product.process.map((item) => {
-          return { type_id: item.key, value: item.value || "" };
+          return { type_id: item.key|| item.id, value: item.value || "" };
         });
-        ele.processList = [];
+        ele.cld = [];
         this.axios({
           method: "post",
           url: "/api/order_get_product_process",
@@ -1128,9 +1038,9 @@ export default {
           },
         }).then((res) => {
           if (res.code == 200) {
-            ele.processList = res.data;
+            ele.cld = res.data;
           } else {
-            ele.processList = [];
+            ele.cld = [];
           }
           this.$forceUpdate();
         });
@@ -1139,15 +1049,15 @@ export default {
     //修改材质/颜色/工艺的 disabled
     handleProductProcessChange(e, n, modelData, ele) {
       if (e) {
-        this.pre_process_obj[n + 1] = e.value;
+        this.pre_process_obj[ele.id] = e.value;
         if (!modelData.procedure_properties_str) {
           modelData.procedure_properties_str = [];
         }
-        modelData.procedure_properties_str[ele.key - 1] = e.label;
+        modelData.procedure_properties_str[ele.id - 1] = e.label;
         if (!modelData.procedure_properties) {
-          modelData.procedure_properties = [];
+          modelData.procedure_properties = {};
         }
-        modelData.procedure_properties[ele.key - 1] = e.value;
+        modelData.procedure_properties[ele.id] = e.value;
         let isStart = true;
         modelData.process.forEach((element) => {
           if (element.value == "") {
@@ -1182,14 +1092,14 @@ export default {
           if (!element.is_metal) {
             element.process.forEach((elem) => {
               if (elem.name == ele.title) {
-                elem.procedure_property = e.value;
+                elem.value = e.value;
                 if (!element.procedure_properties) {
-                  element.procedure_properties = [];
+                  element.procedure_properties = {};
                 }
                 if (!element.procedure_properties_str) {
                   element.procedure_properties_str = [];
                 }
-                element.procedure_properties[n] = e.value;
+                element.procedure_properties[ele.id] = e.value;
                 element.procedure_properties_str[n] = e.label;
               }
             });
@@ -1203,22 +1113,22 @@ export default {
           );
         }
         // modelData.procedure_properties = [];
-        modelData.procedure_properties[ele.key - 1] = "";
+        modelData.procedure_properties[ele.id] = "";
       }
       this.$forceUpdate();
     },
-    handlePartProcessChange(val, n, row) {
+    handlePartProcessChange(val, n, row, process_detail) {
       if (!row.procedure_properties) {
-        row.procedure_properties = [];
+        row.procedure_properties = {};
       }
       if (!row.procedure_properties_str) {
         row.procedure_properties_str = [];
       }
       if (val) {
-        row.procedure_properties[n] = val.value;
+        row.procedure_properties[process_detail.id] = val.value;
         row.procedure_properties_str[n] = val.label;
       } else {
-        row.procedure_properties[n] = "";
+        row.procedure_properties[process_detail.id] = "";
         row.procedure_properties_str[n] = "";
       }
       this.$forceUpdate();
@@ -1723,19 +1633,13 @@ export default {
     },
     handleTotalPriceCalc(row, item) {
       row.total_price = ((row.price || 0) * (row.num || 0)).toFixed(2);
-      let sum1 = 0;
-      item.metalArray &&
-        item.metalArray.length > 0 &&
-        item.metalArray.forEach((element) => {
-          sum1 += element.total_price * 1 || 0;
-        });
       let sum2 = 0;
       item.extArray &&
         item.extArray.length > 0 &&
         item.extArray.forEach((element) => {
           sum2 += element.total_price * 1 || 0;
         });
-      item.ext_price = sum1 * 1 + sum2 * 1;
+      item.ext_price = sum2 * 1;
       item.price =
         (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
         (item.over_price * 1 || 0) +
@@ -1744,12 +1648,8 @@ export default {
       this.$forceUpdate();
     },
     handleTabsPaneChange(name) {
-      this.tempMetalArray = this.addProductArray[
-        this.currentTabIndex
-      ].metalArray;
       this.tempExtArray = this.addProductArray[this.currentTabIndex].extArray;
       this.pre_bp_id = this.addProductArray[this.currentTabIndex].bp_id;
-      console.log("this.currentTabIndex  :>> ", this.currentTabIndex);
       this.currentTabIndex = this.$refs.tabsRef.activeKey;
       this.currencyProduct = this.addProductArray[this.currentTabIndex];
     },
@@ -1759,9 +1659,6 @@ export default {
       item.extArray.map((v) => {
         return (sum += v.total_price * 1);
       });
-      item.metalArray.map((v) => {
-        return (sum += v.total_price * 1);
-      });
       item.ext_price = sum;
       item.price =
         (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
@@ -1918,7 +1815,7 @@ export default {
   }
   .items {
     width: 80px;
-    height:80px;
+    height: 80px;
     margin-bottom: 10px;
     display: flex;
     justify-content: center;

文件差异内容过多而无法显示
+ 513 - 291
src/views/OrderMannage/BusinessOrderlist/edit.vue


部分文件因为文件数量过多而无法显示