Andy vor 3 Jahren
Ursprung
Commit
a4d1e7f9c4

+ 12 - 1
src/components/product/add/index.vue

@@ -926,6 +926,17 @@ export default {
                       el.high = el.high || "0";
                     });
                   });
+                  element.part_detail.map((_part_detail) => {
+                    _part_detail.material_detail_org_num =
+                      _part_detail.num || 0;
+                    _part_detail.part_detail_option = [];
+                    _part_detail.material_detail_list.map((v) => {
+                      _part_detail.part_detail_option.push({
+                        label: `${v.long}*${v.wide}*${v.high}`,
+                        value: v.material_detail_id,
+                      });
+                    });
+                  });
                 }
               }
             });
@@ -1024,7 +1035,7 @@ export default {
           });
         });
         let list = product.process.map((item) => {
-          return { type_id: item.key|| item.id, value: item.value || "" };
+          return { type_id: item.key || item.id, value: item.value || "" };
         });
         ele.cld = [];
         this.axios({

+ 29 - 11
src/views/BidSystem/ContractList/edit.vue

@@ -1882,8 +1882,8 @@ export default {
         res.data.head[3] &&
           res.data.head[3].length > 0 &&
           res.data.head[3].forEach((item) => {
-            console.log("item :>> ", item);
             // ele[key] = item.key
+            /////
             arr.push({
               title: item.key,
               key: item.key,
@@ -1891,6 +1891,7 @@ export default {
               minWidth: 80,
             });
           });
+        console.log("arr :>> ", arr);
         this.tableColumns = [
           { title: "序号123", key: "index", align: "center", minWidth: 80 },
           {
@@ -2036,12 +2037,13 @@ export default {
                       pdt.index = index + 1;
                       pdt.special &&
                         pdt.special.length > 0 &&
-                        pdt.special.forEach((_pdt) => {
-                          this.formData.head[3].forEach((element) => {
-                            if (_pdt.head_id == element.id) {
-                              _pdt = Object.assign(_pdt, element);
+                        pdt.special.map((_pdt) => {
+                          this.formData.head[3].map((v) => {
+                            if (_pdt.head_id == v.id) {
+                              _pdt = Object.assign(_pdt, v);
+                              v = Object.assign(_pdt, v);
                               pdt[_pdt.key] = _pdt.value;
-                              this.productSpecValueList.push(_pdt);
+                              // this.productSpecValueList.push(_pdt);
                             }
                           });
                         });
@@ -2056,6 +2058,7 @@ export default {
         this.areaSpecValueList = this.formData.head[2]
           ? this.formData.head[2]
           : [];
+        console.log("this.formData.head[3] :>> ", this.formData.head[3]);
         this.productSpecValueList = this.formData.head[3]
           ? this.formData.head[3]
           : [];
@@ -2892,15 +2895,30 @@ export default {
     set_tableColumns() {
       if (this.productSetTableData.length < 1) {
         return this.tableColumns;
+      } else {
+        return this.func.computedHeader(
+          this.productSetTableData,
+          this.tableColumns
+        );
       }
-      return this.func.computedHeader(
-        this.productSetTableData,
-        this.tableColumns
-      );
     },
   },
   // 监控data中的数据变化
-  watch: {},
+  watch: {
+    productSpecValueList() {
+      let arr = [];
+      this.productSpecValueList.length > 0 &&
+        this.productSpecValueList.forEach((element) => {
+          arr.push({
+            title: element.key,
+            key: element.key,
+            align: "center",
+            minWidth: 80,
+          });
+        });
+      this.set_tableColumns.splice(this.set_tableColumns.length - 1, 0, ...arr);
+    },
+  },
   beforeCreate() {}, // 生命周期 - 创建之前
   beforeMount() {}, // 生命周期 - 挂载之前
   beforeUpdate() {}, // 生命周期 - 更新之前

+ 152 - 101
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -530,13 +530,12 @@
               {{ scope.row.is_metal ? "" : scope.row.position }}
             </template>
           </vxe-column>
-          <vxe-column title="产品名称" min-width="150" :edit-render="{}">
+          <vxe-column title="产品名称/五金" min-width="150" :edit-render="{}">
             <template #edit="scope">
               <Select
                 filterable
                 clearable
                 transfer
-                filter-by-label
                 label-in-value
                 v-if="!scope.row.is_metal"
                 v-model="scope.row.product_id"
@@ -762,11 +761,11 @@
                   v-show="!part_detail.is_metal"
                 >
                   <div
-                    v-for="(sub_part_detail, idx) in part_detail.sub_part"
-                    :key="idx + 'sub_part'"
+                    v-for="(sub_part_detail, idx) in part_detail.part_detail"
+                    :key="idx + 'part_detail'"
                     v-show="sub_part_detail.title.indexOf('线条') > 0"
                     :style="
-                      idx != part_detail.sub_part.length - 1
+                      idx != part_detail.part_detail.length - 1
                         ? {
                             borderBottom: '1px solid #e8eaec',
                             padding: '10px 0',
@@ -793,11 +792,11 @@
                   v-show="!part_detail.is_metal"
                 >
                   <div
-                    v-for="(sub_part_detail, idx) in part_detail.sub_part"
-                    :key="idx + 'sub_part'"
+                    v-for="(sub_part_detail, idx) in part_detail.part_detail"
+                    :key="idx + 'part_detail'"
                     v-show="sub_part_detail.title.indexOf('线条') > 0"
                     :style="
-                      idx != part_detail.sub_part.length - 1
+                      idx != part_detail.part_detail.length - 1
                         ? {
                             borderBottom: '1px solid #e8eaec',
                             padding: '10px 0',
@@ -833,11 +832,11 @@
                   v-show="!part_detail.is_metal"
                 >
                   <div
-                    v-for="(sub_part_detail, idx) in part_detail.sub_part"
-                    :key="idx + 'sub_part'"
+                    v-for="(sub_part_detail, idx) in part_detail.part_detail"
+                    :key="idx + 'part_detail'"
                     v-show="sub_part_detail.title.indexOf('线条') > 0"
                     :style="
-                      idx != part_detail.sub_part.length - 1
+                      idx != part_detail.part_detail.length - 1
                         ? {
                             borderBottom: '1px solid #e8eaec',
                             padding: '10px 0',
@@ -858,11 +857,11 @@
                   v-show="!part_detail.is_metal"
                 >
                   <div
-                    v-for="(sub_part_detail, idx) in part_detail.sub_part"
-                    :key="idx + 'sub_part'"
+                    v-for="(sub_part_detail, idx) in part_detail.part_detail"
+                    :key="idx + 'part_detail'"
                     v-show="sub_part_detail.title.indexOf('线条') > 0"
                     :style="
-                      idx != part_detail.sub_part.length - 1
+                      idx != part_detail.part_detail.length - 1
                         ? {
                             borderBottom: '1px solid #e8eaec',
                             padding: '10px 0',
@@ -898,7 +897,9 @@
               />
             </template>
             <template #default="scope">
-              {{ scope.row.is_metal ? scope.row.num : scope.row.total_num }}
+              {{
+                scope.row.is_metal ? scope.row.total_num : scope.row.total_num
+              }}
             </template>
           </vxe-column>
           <vxe-column field="unit" title="单位" min-width="70"> </vxe-column>
@@ -912,12 +913,16 @@
               />
               <Input
                 v-else
-                v-model="scope.row.price"
+                v-model="scope.row.single_price"
                 @on-change="(e) => handleMetailPriceChange(e, scope.row)"
               />
             </template>
             <template #default="scope">
-              {{ scope.row.is_metal ? scope.row.price : scope.row.unit_price }}
+              {{
+                scope.row.is_metal
+                  ? scope.row.single_price
+                  : scope.row.unit_price
+              }}
             </template>
           </vxe-column>
           <vxe-column title="附加项" min-width="150" :edit-render="{}">
@@ -990,18 +995,14 @@
           </vxe-column>
           <vxe-column title="附加金额" min-width="80">
             <template #default="scope"
-              >{{
-                scope.row.is_metal ? scope.row.total_price : scope.row.ext_price
-              }}
+              >{{ scope.row.is_metal ? scope.row.price : scope.row.ext_price }}
             </template>
           </vxe-column>
           <vxe-column field="over_price" title="超标金额" min-width="80">
           </vxe-column>
           <vxe-column title="总金额" min-width="80">
             <template #default="scope"
-              >{{
-                scope.row.is_metal ? scope.row.total_price : scope.row.price
-              }}
+              >{{ scope.row.is_metal ? scope.row.price : scope.row.price }}
             </template>
           </vxe-column>
           <vxe-column
@@ -1017,6 +1018,8 @@
                 v-if="!scope.row.is_metal"
                 transfer
                 v-model="scope.row.remark"
+                allow-create
+                @on-create="handleRemarkCreate"
                 @on-change="changeEditRemark(scope.row)"
               >
                 <Option
@@ -2497,6 +2500,7 @@ export default {
       });
       this.tableData.map((item, index) => {
         if (!item.is_metal) {
+          console.log("item :>> ", item);
           item.part.map((it, idx) => {
             if (!it.is_metal) {
               if (!sendList[index].part) {
@@ -2507,12 +2511,16 @@ export default {
           });
         } else {
           item.type = 1;
+          if (!this.sendList[0].part.extArray) {
+            this.sendList[0].part.extArray = [];
+          }
           this.sendList[0].part.extArray.push(item);
         }
       });
       // sendList= this.tableData.filter(item)
+      console.log("123 :>> ", 123);
       sendList.map((element) => {
-        if (element.is_metal) {
+        if (!element.is_metal) {
           element.part.map((elem) => {
             if (!elem.is_metal) {
               // elem.part_detail = elem.sub_part;
@@ -2536,6 +2544,7 @@ export default {
       } catch (e) {
         console.log(e);
       }
+      console.log("333 :>> ", 333);
       let params = { ...sendData, product: sendList, renovation_type: 2 };
       this.axios.post("/api/order_save_new", params).then((res) => {
         if (res.code == 200) {
@@ -3497,33 +3506,39 @@ export default {
       });
     },
     handleTableAdd() {
-      let obj = {
-        position: "", //位置
-        over_price: "", //超标单价
-        unit_price: "", //单价
-        ext_price: "", //附加金额
-        price: "", //总金额
-        remark: "", //备注
-        measurement: "", //测量字段拼接
-        total_num: "", //数量
-        num: "", //核算数量
-        num_formula: "", //核算数量公式
-        url_number: "", //图号
-        url: [], //图纸
-        unit: "", //单位
-        title: "", //产品名
-        process: "", //工艺属性拼接
-        procedure_properties: {}, //工艺属性对象
-        overdraft: [], //超标公式
-        measure: this._measure, //测量字段数组
-        support_remark: this.support_remark, //备注列表
-        ext: [],
-        process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
-      };
-      this.process_obj.map(
-        (v) => ((obj[v.id] = ""), (obj.procedure_properties[v.id] = ""))
-      );
-      this.tableData.push(obj);
+      if (this.info.custom_id) {
+        this.currentTabIndex = "0";
+        let obj = {
+          position: "", //位置
+          over_price: "", //超标单价
+          unit_price: "", //单价
+          ext_price: "", //附加金额
+          price: "", //总金额
+          remark: "", //备注
+          measurement: "", //测量字段拼接
+          total_num: "", //数量
+          num: "", //核算数量
+          num_formula: "", //核算数量公式
+          url_number: "", //图号
+          url: [], //图纸
+          unit: "", //单位
+          title: "", //产品名
+          process: "", //工艺属性拼接
+          procedure_properties: {}, //工艺属性对象
+          overdraft: [], //超标公式
+          measure: this._measure, //测量字段数组
+          support_remark: this.support_remark, //备注列表
+          ext: [],
+          extArray: [],
+          process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
+        };
+        obj.process_obj.map(
+          (v) => ((obj[v.id] = ""), (obj.procedure_properties[v.id] = ""))
+        );
+        this.tableData.push(obj);
+      } else {
+        this.$Message.warning("请先选择客户");
+      }
     },
     handleMetalAdd() {
       this.tableData.push({
@@ -3531,8 +3546,8 @@ export default {
         material_id: "",
         title: "",
         total_price: 0,
-        price: 0,
-        num: 0,
+        single_price: 0,
+        total_num: 0,
         unit: "",
       });
     },
@@ -3558,12 +3573,10 @@ export default {
           this.title_state = 2;
           this.isCheck = false;
           if (this.type == 1) {
-            console.log("1 :>> ", 1);
             this.showEditProduct = true;
             this.modalData = JSON.parse(JSON.stringify(row));
             this.currencyIndex = index;
           } else if (this.type == 2) {
-            console.log("2 :>> ", 2);
             //订单编辑点产品编辑
             if (row.get_first_data && !row.isEdit) {
               this.axios
@@ -3579,7 +3592,6 @@ export default {
                   }
                 });
             } else {
-              console.log("3 :>> ", 3);
               // 订单新增点产品编辑
               if (row.isEdit) {
                 row.measure.map((v) => {
@@ -3598,8 +3610,20 @@ export default {
           }
           break;
         case 3:
-          this.tableData.splice(index, 1);
-          this.handleCalcCount();
+          if (!row.is_metal) {
+            this.$Modal.confirm({
+              title: "确认删除?",
+              content: "请确认!",
+              onOk: () => {
+                this.tableData.splice(index, 1);
+                this.handleCalcCount();
+              },
+              onCancel: () => {},
+            });
+          } else {
+            this.tableData.splice(index, 1);
+            this.handleCalcCount();
+          }
           break;
         case 4:
           obj = JSON.parse(JSON.stringify(row));
@@ -3793,6 +3817,11 @@ export default {
     },
     changeEditMeasure(e, row, measure) {
       row.isEdit = true;
+      row.measure.map((v) => {
+        if (v.e_title == measure.e_title) {
+          v.value = e.target.value;
+        }
+      });
       this.handleProductMeasureChange(
         e,
         row,
@@ -3807,11 +3836,11 @@ export default {
       row.unit = this.metalList.filter((v) => v.id == $event.value)[0].unit;
     },
     changeEditMetalNum(e, row) {
-      row.total_price = 1 * e.target.value * row.price;
+      row.price = 1 * e.target.value * row.single_price;
       this.handleCalcCount();
     },
     handleMetailPriceChange(e, row) {
-      row.total_price = 1 * e.target.value * row.num;
+      row.price = 1 * e.target.value * row.num;
       this.handleCalcCount();
     },
     changeEditTotalNum(e, row) {
@@ -3833,6 +3862,7 @@ export default {
     changeEditPart(row, part_type, part_detail, e) {
       row.isEdit = true;
       part_detail.change_id = e.value;
+
       this.handlePartChange(e, part_detail, row.measure, row.total_num);
     },
     changeEditTableData(row, rowIndex, $event, scope) {
@@ -3895,46 +3925,47 @@ export default {
               });
               if (element.is_null == 1) {
                 element.change_id = "";
+                element.part_title = "";
+                element.title = "";
               } else {
-                element.part_detail = element.sub_part;
-                //展示非拆分部件
-                // 默认替换部件
                 element.change_id = element.change[0].id;
-                //存计算公式
-                element.long ? "" : (element.long = 0);
-                element.wide ? "" : (element.wide = 0);
-                element.high ? "" : (element.high = 0);
-                element.longCalc = element.long + "";
-                element.wideCalc = element.wide + "";
-                element.highCalc = element.high + "";
-                element.part_detail.forEach((elem) => {
-                  elem.material_detail_title =
-                    elem.material_detail_list[0].title;
-                  elem.material_detail_id =
-                    elem.material_detail_list[0].material_detail_id;
-                  elem.part_detail_option = [];
-                  elem.material_detail_list.map((v) => {
-                    elem.part_detail_option.push({
-                      label: `${v.long}*${v.wide}*${v.high}`,
-                      value: v.material_detail_id,
-                    });
-                  });
-                  elem.org_num = elem.num;
-                  elem.material_detail_org_num = elem.num || 0;
-                  elem.material_detail_num = elem.num || 0;
-                  elem.long ? "" : (elem.long = 0);
-                  elem.wide ? "" : (elem.wide = 0);
-                  elem.high ? "" : (elem.high = 0);
-                  elem.longCalc = elem.long + "";
-                  elem.wideCalc = elem.wide + "";
-                  elem.highCalc = elem.high + "";
-                  elem.material_detail_list.forEach((el) => {
-                    el.long = el.long || "0";
-                    el.wide = el.wide || "0";
-                    el.high = el.high || "0";
+              }
+              element.part_detail = element.sub_part;
+              //展示非拆分部件
+              // 默认替换部件
+              //存计算公式
+              element.long ? "" : (element.long = 0);
+              element.wide ? "" : (element.wide = 0);
+              element.high ? "" : (element.high = 0);
+              element.longCalc = element.long + "";
+              element.wideCalc = element.wide + "";
+              element.highCalc = element.high + "";
+              element.part_detail.forEach((elem) => {
+                elem.material_detail_title = elem.material_detail_list[0].title;
+                elem.material_detail_id =
+                  elem.material_detail_list[0].material_detail_id;
+                elem.part_detail_option = [];
+                elem.material_detail_list.map((v) => {
+                  elem.part_detail_option.push({
+                    label: `${v.long}*${v.wide}*${v.high}`,
+                    value: v.material_detail_id,
                   });
                 });
-              }
+                elem.org_num = elem.num;
+                elem.material_detail_org_num = elem.num || 0;
+                elem.material_detail_num = elem.num || 0;
+                elem.long ? "" : (elem.long = 0);
+                elem.wide ? "" : (elem.wide = 0);
+                elem.high ? "" : (elem.high = 0);
+                elem.longCalc = elem.long + "";
+                elem.wideCalc = elem.wide + "";
+                elem.highCalc = elem.high + "";
+                elem.material_detail_list.forEach((el) => {
+                  el.long = el.long || "0";
+                  el.wide = el.wide || "0";
+                  el.high = el.high || "0";
+                });
+              });
             }
           });
           row.part = JSON.parse(JSON.stringify(res.data.part));
@@ -3946,7 +3977,7 @@ export default {
           });
           this.tableData.splice(rowIndex, 1, row);
           row.get_first_data = false;
-          this.$forceUpdate();
+          // this.$forceUpdate();
         });
       }
       // row.part=[]
@@ -4019,6 +4050,7 @@ export default {
                 // 选择不是线条、或者基础档案中要默认为空的部件
                 element.isBP = true;
                 element.isChoosed = true;
+
                 if (element.is_null == 1) {
                   element.change_id = "";
                 } else {
@@ -4054,6 +4086,17 @@ export default {
                       el.high = el.high || "0";
                     });
                   });
+                  element.part_detail.map((_part_detail) => {
+                    _part_detail.material_detail_org_num =
+                      _part_detail.num || 0;
+                    _part_detail.part_detail_option = [];
+                    _part_detail.material_detail_list.map((v) => {
+                      _part_detail.part_detail_option.push({
+                        label: `${v.long}*${v.wide}*${v.high}`,
+                        value: v.material_detail_id,
+                      });
+                    });
+                  });
                 }
               }
             });
@@ -4113,16 +4156,14 @@ export default {
           if (column.title == "附加金额") {
             let sum = 0;
             data.map((v) => {
-              v.is_metal
-                ? (sum += v.total_price * 1)
-                : (sum += v.ext_price * 1);
+              v.is_metal ? (sum += v.price * 1) : (sum += v.ext_price * 1);
             });
             return sum;
           }
           if (column.title == "总金额") {
             let sum = 0;
             data.map((v) => {
-              v.is_metal ? (sum += v.total_price * 1) : (sum += v.price * 1);
+              v.is_metal ? (sum += v.price * 1) : (sum += v.price * 1);
             });
             return sum;
           }
@@ -4272,6 +4313,16 @@ export default {
             ((elem.material_detail_org_num || elem.num) * product_num) | 0;
           elem.material_detail_num = elem.material_detail_org_num * product_num;
         });
+        row.part_detail.map((_part_detail) => {
+          _part_detail.material_detail_org_num = _part_detail.num || 0;
+          _part_detail.part_detail_option = [];
+          _part_detail.material_detail_list.map((v) => {
+            _part_detail.part_detail_option.push({
+              label: `${v.long}*${v.wide}*${v.high}`,
+              value: v.material_detail_id,
+            });
+          });
+        });
         measure.forEach((element) => {
           if ((row.long + "").indexOf(element.measureCalc) != -1) {
             if (typeof (element.value * 1) == "number") {