浏览代码

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

mushencc 3 年之前
父节点
当前提交
5628cd687c

+ 554 - 161
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -496,25 +496,131 @@
             </div>
           </template>
         </vxe-toolbar>
+        <vxe-grid
+          border
+          resizable
+          align="center"
+          :edit-config="{ trigger: 'dblclick', mode: 'row', autoClear: false }"
+          :columns="tableColumn"
+          :data="tableData"
+        >
+          <template #product_id_default="{ row }">
+            {{
+              productList.filter((v) => v.id == row.product_id).length > 0
+                ? productList.filter((v) => v.id == row.product_id)[0].title
+                : ""
+            }}
+          </template>
+          <template #product_id_edit="{ row,rowIndex }">
+            <Select
+              filterable
+              clearable
+              transfer
+              class="my-select"
+              filter-by-label
+              label-in-value
+              v-model="row.product_id"
+              @on-change="changeEditTableData(row, rowIndex, $event)"
+            >
+              <Option
+                v-for="item of productList"
+                :tag="item.img_url"
+                :key="item.id"
+                :label="item.title"
+                :value="item.id"
+              ></Option>
+            </Select>
+          </template>
+
+          <template #material_title_default="{ row }">
+            <div
+              v-for="part_detail in row.part"
+              :key="part_detail.order_product_part_id"
+              v-show="!part_detail.is_metal"
+              style="border-bottom:1px solid #e8eaec;padding:10px 0"
+            >
+              {{ part_detail.title }}
+            </div>
+          </template>
+          <template #material_title_edit="{ row }">
+            <div
+              v-for="part_detail in row.part"
+              :key="part_detail.order_product_part_id"
+              v-show="!part_detail.is_metal"
+              style="border-bottom:1px solid #e8eaec;padding:10px 0"
+            >
+              {{ part_detail.title }}
+            </div>
+          </template>
+          <template #set_default="{ row,rowIndex }">
+            <a @click="handleSet(row, rowIndex, 4)" style="margin: 0 5px"
+              >复制</a
+            >
+            <a @click="handleSet(row, rowIndex, 2)" style="margin: 0 5px"
+              >编辑</a
+            >
+            <a @click="handleSet(row, rowIndex, 3)" style="margin: 0 5px"
+              >删除</a
+            >
+          </template>
+        </vxe-grid>
         <vxe-table
           resizable
           border
           ref="xTree"
-          :tree-config="{ children: 'part' }"
+          :edit-config="{ trigger: 'dblclick', mode: 'row' }"
           :data="tableData"
         >
           <vxe-table-column
+            field="position"
+            title="位置"
+            align="center"
+            min-width="80"
+            :edit-render="{
+              name: '$input',
+              props: {
+                clearable: true,
+              },
+              events: { input: handleTablePositionChange },
+            }"
+          ></vxe-table-column>
+          <vxe-table-column
             field="title"
             title="产品名称"
             align="center"
             min-width="120"
-            tree-node
+            :edit-render="{
+              name: '$select',
+              options: productList,
+              props: {
+                clearable: true,
+                optionProps: {
+                  label: 'title',
+                  value: 'id',
+                },
+              },
+              events: { change: handleTableProductSelect },
+            }"
           ></vxe-table-column>
           <vxe-table-column
-            field="position"
-            title="位置"
+            v-for="(bpp, idx) in bpp_list"
+            :key="bpp.name"
+            field="procedure_properties"
+            :title="bpp.name"
             align="center"
-            min-width="80"
+            min-width="120"
+            :edit-render="{
+              name: '$select',
+              options: bpp.cld,
+              props: {
+                clearable: true,
+                optionProps: {
+                  label: 'title',
+                  value: 'id',
+                },
+              },
+              events: { change: handleTableProductSelect },
+            }"
           ></vxe-table-column>
           <vxe-table-column
             field="unit"
@@ -522,12 +628,12 @@
             align="center"
             min-width="80"
           ></vxe-table-column>
-          <vxe-table-column
+          <!-- <vxe-table-column
             field="process_str"
             title="工艺属性"
             align="center"
             min-width="200"
-          ></vxe-table-column>
+          ></vxe-table-column> -->
           <vxe-table-column
             field="measurement_no_letter"
             title="尺寸"
@@ -1575,48 +1681,10 @@ export default {
     }
   },
   data() {
-    const validateMobile = function(rule, value, fn) {
-      if (!/^1[3456789]\d{9}$/.test(value)) {
-        fn(new Error(" "));
-        return false;
-      }
-      fn();
-    };
     return {
-      formObjs: {
-        order_no: 1,
-        residential_name: 1,
-        client_name: 1,
-        warning_state: 1,
-        service_id: 1,
-        pay_state: 1,
-        address: 1,
-        mobile: 1,
-        start_time: 1,
-        end_time: 1,
-        predict_price: 1,
-        predict_working: 1,
-        predict_time: 1,
-        remark: 1,
-      },
-      formObjs_reset: {
-        order_no: 1,
-        residential_name: 1,
-        warning_state: 1,
-        front_money: 1,
-        start_time: 1,
-        client_name: 1,
-        custom_detail_name: 1,
-        custom_detail_mobile: 1,
-        custom_detail_id: 1,
-        service_id: 1,
-        end_time: 1,
-        predict_price: 1,
-        order_price: 1,
-        box_id: 1,
-        remark: 1,
-        pay_state: 1,
-      },
+      currency_edit_index: null,
+      measure_total: [],
+      part_type_total: [],
       tree_btn_show: false,
       showForms: false,
       forms_list: [],
@@ -1892,9 +1960,212 @@ export default {
       let sum = 0;
       return sum;
     },
+    tableColumn() {
+      let tempHeader = [];
+      this.bpp_list.map((v, k) => {
+        v.k = k;
+        tempHeader.push({
+          field: v.k,
+          title: v.name,
+          align: "center",
+          minWidth: "120",
+          editRender: { autofocus: ".my-process" },
+          slots: {
+            default: ({ row }) => {
+              return [
+                <span>
+                  {v.cld.map((item) => {
+                    if (item.id == row[v.k]) {
+                      return <span>{item.title}</span>;
+                    }
+                  })}
+                </span>,
+              ];
+            },
+            edit: ({ row }) => {
+              return [
+                <Select
+                  filterable
+                  clearable
+                  transfer
+                  class="my-select"
+                  filter-by-label
+                  label-in-value
+                  v-model={row[v.k]}
+                >
+                  {v.cld.map((item) => {
+                    return (
+                      <Option value={item.id} tag={item.img_url}>
+                        {item.title}
+                      </Option>
+                    );
+                  })}
+                </Select>,
+              ];
+            },
+          },
+        });
+      });
+      let tempMeasure = [];
+      this.measure_total.map((v) => {
+        tempMeasure.push({
+          field: v.e_title,
+          title: v.title,
+          align: "center",
+          minWidth: "120",
+          editRender: {
+            name: "$input",
+            props: {
+              clearable: true,
+            },
+            events: { input: this.handleTablePositionChange },
+          },
+        });
+      });
+      // let tempPartType = [];
+      // this.part_type_total.map((v) => {
+      //   tempMeasure.push({
+      //     field: v.e_title,
+      //     title: v.title,
+      //     align: "center",
+      //     minWidth: "50",
+      //     editRender: {
+      //       name: "$input",
+      //       props: {
+      //         clearable: true,
+      //       },
+      //       events: { input: this.handleTablePositionChange },
+      //     },
+      //   });
+      // });
+      return [
+        { type: "seq", title: "序号", minWidth: "50" },
+        {
+          field: "position",
+          title: "位置",
+          align: "center",
+          showHeaderOverflow: true,
+          minWidth: "100",
+          editRender: {
+            name: "$input",
+            props: {
+              clearable: true,
+            },
+          },
+        },
+        {
+          field: "product_id",
+          title: "产品名称",
+          showHeaderOverflow: true,
+          align: "center",
+          minWidth: "150",
+          editRender: { autofocus: ".my-select" },
+          slots: {
+            default: "product_id_default",
+            edit: "product_id_edit",
+          },
+        },
+        ...tempHeader,
+        ...tempMeasure,
+        {
+          field: "total_num",
+          title: "数量",
+          align: "center",
+          minWidth: "80",
+          editRender: {
+            name: "$input",
+            props: {
+              clearable: true,
+            },
+            // events: { input: this.handleTablePositionChange },
+          },
+        },
+        {
+          field: "unit",
+          title: "单位",
+          align: "center",
+          minWidth: "70",
+        },
+        {
+          field: "",
+          title: "原材料名称",
+          align: "center",
+          minWidth: "200",
+          slots: {
+            default: "material_title_default",
+            edit: "material_title_edit",
+          },
+        },
+        {
+          field: "num",
+          title: "核算数量",
+          align: "center",
+          minWidth: "80",
+        },
+        {
+          field: "unit_price",
+          title: "单价",
+          align: "center",
+          minWidth: "80",
+          editRender: {
+            name: "$input",
+            props: {
+              clearable: true,
+            },
+            // events: { input: this.handleTablePositionChange },
+          },
+        },
+        {
+          field: "ext_price",
+          title: "附加金额",
+          align: "center",
+          minWidth: "80",
+        },
+        {
+          field: "over_price",
+          title: "超标金额",
+          align: "center",
+          minWidth: "80",
+        },
+        {
+          field: "price",
+          title: "总金额",
+          align: "center",
+          minWidth: "80",
+        },
+        {
+          field: "remark",
+          title: "备注",
+          align: "center",
+          minWidth: "120",
+          editRender: {
+            name: "$input",
+            props: {
+              clearable: true,
+            },
+          },
+        },
+        {
+          title: "操作",
+          align: "center",
+          minWidth: "180",
+          slots: {
+            default: "set_default",
+          },
+        },
+      ];
+    },
   },
   watch: {},
   created() {
+    //获取部件分类
+    this.axios.get("/api/basics_parts_index").then((res) => {
+      this.part_type_total = res.data.data;
+    });
+    // 获取测量字段
+    this.axios.get("/api/basics_measure_index").then((res) => {
+      this.measure_total = res.data.data;
+    });
     //   获取工艺属性
     this.axios({
       method: "get",
@@ -2037,32 +2308,6 @@ export default {
           this.get_forms();
         }
       });
-      // let result = [];
-      // this.forms_list.map((rows) => {
-      //   for (let i in this.formObjs_reset) {
-      //     // if (i == rows) {
-      //     result.push(i);
-      //     // }
-      //   }
-      // });
-      // const news_forms = {};
-      // this.post_formSetTableData = JSON.parse(JSON.stringify(this.formSetTableData))
-      // result.forEach((element) => {
-      //   news_forms[element] = 1;
-      // });
-      // this.formObjs = news_forms;
-      // if (n) {
-      //   this.axios
-      //     .post("/api/order_set_form", {
-      //       result: this.post_formSetTableData,
-      //       all: Object.keys(this.formObjs_reset),
-      //     })
-      //     .then((res) => {
-      //       if (res.code == 200) {
-      //         this.$Message.success(res.msg);
-      //       }
-      //     });
-      // }
     },
     postData() {
       let sendData = JSON.parse(JSON.stringify(this.info));
@@ -2114,6 +2359,23 @@ export default {
         }
       });
     },
+    // 表格的一些方法
+    // 表格选择产品
+    handleTableProductSelect(obj, $event) {
+      console.log("obj :>> ", obj);
+      console.log("$event :>> ", $event);
+      $event.value &&
+        this.axios("/api/order_get_product_detail_new", {
+          params: { product_id: $event.value, custom_id: this.info.custom_id },
+        }).then((res) => {
+          console.log("res :>> ", res);
+        });
+    },
+    // 表格位置选择
+    handleTablePositionChange(obj, $event) {
+      console.log("obj :>> ", obj);
+      console.log("$event :>> ", $event);
+    },
     handleShowMaterial() {
       this.is_material_show = !this.is_material_show;
     },
@@ -2143,6 +2405,9 @@ export default {
           this.info.img = this.info.imgs;
           this.tableData = res.data.product_list;
           this.tableData.forEach((element) => {
+            element.procedure_properties.map((v, k) => {
+              element[k] = v * 1;
+            });
             // 数据第一次通过接口获取
             element.get_first_data = true;
             //保存用数据
@@ -2260,9 +2525,13 @@ export default {
       });
     },
     getProducts() {
-      this.axios("/api/product").then(
-        (res) => (this.productList = res.data.data)
-      );
+      this.axios("/api/product").then((res) => {
+        this.productList = res.data.data;
+        this.productList.map((v) => {
+          v.label = v.title;
+          v.value = v.id;
+        });
+      });
     },
     cancelModal() {
       this.showEditProduct = false;
@@ -2344,10 +2613,6 @@ export default {
                 elem.process.map((item) => {
                   elem.procedure_properties.push(item.procedure_property);
                 });
-                console.log(
-                  "elem.procedure_properties :>> ",
-                  elem.procedure_properties
-                );
               }
               // }
             } else {
@@ -2855,56 +3120,39 @@ export default {
         element.total_price = (element.price * element.num).toFixed(2);
       });
       // 同步 curData 、 modalData
-      // for (
-      //   let _modal_idx = 0;
-      //   _modal_idx < modalData.part.length;
-      //   _modal_idx++
-      // ) {
-      //   const _modal = modalData.part[_modal_idx];
-      //   //匹配次数
-      //   let match_idx = -1;
-      //   // 相同次数
-      //   let same_idx = 0;
-      //   for (let _cur_idx = 0; _cur_idx < curData.part.length; _cur_idx++) {
-      //     const _cur = curData.part[_cur_idx];
-      //     if (
-      //       _modal.part_id == _cur.part_id ||
-      //       _modal.change_id == _cur.change_id
-      //     ) {
-      //       match_idx++;
-      //     }
-      //     if (match_idx == 1) {
-      //       _modal.splice(
-      //         _modal_idx,
-      //         same_idx,
-      //         JSON.parse(JSON.stringify(_cur))
-      //       );
-      //       match_idx--;
-      //       same_idx++;
-      //       _modal_idx++;
-      //     }
-      //   }
-      //   if (match_idx == -1) {
-      //     //modal存在但是cur不存在数据
-      //     curData.part.splice(
-      //       _modal_idx,
-      //       0,
-      //       JSON.parse(JSON.stringify(_modal))
-      //     );
-      //     modalData.isChoosed = false;
-      //   } else if (match_idx == 0) {
-      //     // modal 与 cur数量一致
-      //   }
-      // }
+      curData.part.map((ele, idx) => {
+        //判断是否存在
+        if (modalData.part[idx]) {
+          //判断是否相等
+          if (modalData.part[idx].part_id != ele.part_id) {
+            //不相等情况1,是否为替换项
+            /////
+            //不相等情况2,是否为另一部件
+            // if (
+            // modalData.part[idx].change.filter(v=>v.id==ele.id).length>0
+            // ) {
+            modalData.part.splice(
+              idx,
+              0,
+              JSON.parse(JSON.stringify(modalData.part[idx - 1]))
+            );
+            // }
+          }
+        } else {
+          modalData.part.splice(
+            idx,
+            0,
+            JSON.parse(JSON.stringify(modalData.part[idx - 1]))
+          );
+        }
+      });
       // 处理部件
       curData.part.forEach((element, index) => {
         if (!element.is_metal) {
-          console.log('element :>> ', element);
-          // modalData.part[index].change_id = element.change_id;
+          console.log("element.change_id :>> ", element.change_id);
+          modalData.part[index].change_id = element.change_id;
           modalData.part[index].part_title = element.part_title;
-          modalData.part[index].org_part_id = JSON.parse(
-            JSON.stringify(modalData.part[index].part_id)
-          );
+          modalData.part[index].org_part_id = modalData.part[index].part_id;
           // 部件测量字段
           if (element.measure && element.measure.length > 0) {
             const part_measure_detail = element.measure.split("*");
@@ -2942,10 +3190,10 @@ export default {
             modalData.part[index].part_detail[idx].num = elem.num;
           });
           modalData.part[index].part_id = element.part_id;
-          // 工艺属性
-          modalData.part[index].procedure_properties = JSON.parse(
-            JSON.stringify(element.process)
-          );
+          // // 工艺属性
+          // modalData.part[index].procedure_properties = JSON.parse(
+          //   JSON.stringify(element.process)
+          // );
           for (let idx = 0; idx < element.process.length; idx++) {
             const item = element.process[idx];
             modalData.part[index].process.forEach((elem) => {
@@ -3518,11 +3766,158 @@ export default {
       }
       this.pre_bp_id = cur_id;
     },
-    changeEditProduct(row) {
-      if (row) {
-        let id = row ? row.value : this.productList[0].id;
-        this.modalData.type_name = row.label;
-        this.modalData.title = row.label;
+    changeEditTableData(row, rowIndex, $event) {
+      if ($event) {
+        let id = $event.value;
+        row.type_name = $event.label;
+        row.title = $event.label;
+        this.axios("/api/order_get_product_detail_new", {
+          params: { product_id: id, custom_id: this.info.custom_id },
+        }).then((res) => {
+          console.log("res :>> ", res);
+          this.process_match_list = res.data.process.list;
+          this.process_all_list = res.data.process.title;
+          this.support_remark = res.data.support_remark;
+          row.url = res.data.url;
+          row.total_num = res.data.total_num || 1;
+          row.ext_price = res.data.ext_price || 0;
+          row.unit_price = res.data.price || 0;
+          row.num = res.data.num || 1;
+          row.num = res.data.num;
+          row.over_price = res.data.over_price || 0;
+          row.position = res.data.position || "";
+          row.unit = res.data.unit || "";
+          row.remark = res.data.remark || "";
+          row.url_number = res.data.url_number || "";
+          row.overdraft = res.data.overdraft;
+          row.num_formula = res.data.num_formula;
+          row.bp_id = res.data.bp_id;
+          // 金额=(产品单价)*核算数量 +附加金额 + 超标金额
+          row.price =
+            (row.unit_price * 1 || 0) * (row.num * 1 || 1) +
+            (row.over_price * 1 || 0) +
+            (row.ext_price * 1 || 0);
+          row.price = row.price.toFixed(2);
+          row.selected_ids = [];
+          row.part = [];
+          row.part = res.data.part;
+          row.part.forEach((element, index) => {
+            // 选择不是附加项目的,
+            if (!element.is_metal) {
+              // 选择不是线条、或者基础档案中要默认为空的部件
+              element.isBP = true;
+              element.isChoosed = true;
+              if (element.is_null == 1) {
+                element.change_id = "";
+              } 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_id = 0;
+                  elem.material_detail_title =
+                    elem.material_detail_list[0].title;
+                  elem.material_detail_id =
+                    elem.material_detail_list[0].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.measure = res.data.measure;
+          row.measure.forEach((element) => {
+            element.value = "";
+            element.measureCalc = element.e_title;
+          });
+          //工艺属性
+          row.process = [];
+          this.axios({
+            method: "get",
+            url: "/api/bpp_list",
+          }).then((re) => {
+            re.data.forEach((element) => {
+              for (const key in res.data.process.title) {
+                const ele = res.data.process.title[key];
+                if (element.name == ele) {
+                  const compare = res.data.process.list.filter(
+                    (item) => item.detail[key] == this.pre_process_obj[key]
+                  );
+                  row.procedure_properties = [];
+                  if (compare.length > 0) {
+                    row.procedure_properties.push(
+                      this.pre_process_obj[key] * 1
+                    );
+                    row.process.push({
+                      key: key,
+                      title: ele,
+                      value: this.pre_process_obj[key] * 1,
+                      processList: element.cld,
+                    });
+                  } else {
+                    row.procedure_properties.push("");
+                    row.process.push({
+                      key: key,
+                      title: ele,
+                      value: "",
+                      processList: element.cld,
+                    });
+                  }
+                }
+              }
+            });
+            row.part.forEach((element) => {
+              if (!element.is_metal) {
+                //赋值默认工艺属性
+                element.process = JSON.parse(JSON.stringify(re.data));
+                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.procedure_property = this.pre_process_obj[key] * 1;
+                      elem.process_id = key;
+                      if (!element.procedure_properties) {
+                        element.procedure_properties = [];
+                      }
+                      element.procedure_properties[index] =
+                        this.pre_process_obj[key] * 1;
+                    }
+                  }
+                });
+              }
+            });
+            this.$forceUpdate();
+          });
+        });
+      }
+      // row.part=[]
+    },
+    changeEditProduct($event) {
+      if ($event) {
+        let id = $event.value;
+        this.modalData.type_name = $event.label;
+        this.modalData.title = $event.label;
         this.axios("/api/order_get_product_detail_new", {
           params: { product_id: id, custom_id: this.info.custom_id },
         }).then((res) => {
@@ -3558,7 +3953,7 @@ export default {
             this.modalData.ext_price = res.data.ext_price || 0;
             this.modalData.unit_price = res.data.price || 0;
             this.modalData.num = res.data.num || 1;
-            this.modalData.num = JSON.parse(JSON.stringify(res.data.num));
+            this.modalData.num = res.data.num;
             this.modalData.over_price = res.data.over_price || 0;
             this.modalData.position = res.data.position || "";
             this.modalData.unit = res.data.unit || "";
@@ -3577,6 +3972,7 @@ export default {
             // this.modalData.model = res.data.model || ''
             // this.modalData.same_process_compare = JSON.parse(JSON.stringify(res.data.intermediate.same_process || []))
             this.modalData.selected_ids = [];
+            this.modalData.part = [];
             this.modalData.part = res.data.part;
             // 数据第一次通过接口获取
             this.modalData.get_first_data = false;
@@ -3597,26 +3993,24 @@ export default {
                   element.long ? "" : (element.long = 0);
                   element.wide ? "" : (element.wide = 0);
                   element.high ? "" : (element.high = 0);
-                  element.longCalc = JSON.parse(JSON.stringify(element.long));
-                  element.wideCalc = JSON.parse(JSON.stringify(element.wide));
-                  element.highCalc = JSON.parse(JSON.stringify(element.high));
+                  element.longCalc = element.long;
+                  element.wideCalc = element.wide;
+                  element.highCalc = element.high;
                   element.part_detail.forEach((elem) => {
                     elem.material_detail_id = 0;
                     elem.material_detail_title =
                       elem.material_detail_list[0].title;
                     elem.material_detail_id =
                       elem.material_detail_list[0].material_detail_id;
-                    elem.org_num = JSON.parse(JSON.stringify(elem.num));
-                    elem.material_detail_org_num = JSON.parse(
-                      JSON.stringify(elem.num || 0)
-                    );
+                    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 = JSON.parse(JSON.stringify(elem.long || ""));
-                    elem.wideCalc = JSON.parse(JSON.stringify(elem.wide || ""));
-                    elem.highCalc = JSON.parse(JSON.stringify(elem.high || ""));
+                    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";
@@ -3630,7 +4024,7 @@ export default {
             this.modalData.measure = res.data.measure;
             this.modalData.measure.forEach((element) => {
               element.value = "";
-              element.measureCalc = JSON.parse(JSON.stringify(element.e_title));
+              element.measureCalc = element.e_title;
             });
             //工艺属性
             this.modalData.process = [];
@@ -3838,20 +4232,20 @@ export default {
       if ($event) {
         let cur = row.change.filter((item) => item.id == row.change_id);
         row.part_title = cur[0].part_title;
-        row.org_part_id =row.part_id;
+        row.org_part_id = row.part_id;
         row.part_id = cur[0].part_id;
         row.high = cur[0].high || 0;
-        row.highCalc =row.high;
+        row.highCalc = row.high;
         row.long = cur[0].long || 0;
-        row.longCalc =row.long;
+        row.longCalc = row.long;
         row.wide = cur[0].wide || 0;
-        row.wideCalc =row.wide;
+        row.wideCalc = row.wide;
         row.part_detail = cur[0].sub_part;
         row.part_detail.forEach((elem) => {
-          elem.longCalc =elem.long || "";
-          elem.wideCalc =elem.wide || "";
-          elem.highCalc =elem.high || "";
-          elem.org_num =elem.num;
+          elem.longCalc = elem.long || "";
+          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)
           );
@@ -4470,8 +4864,8 @@ export default {
     left: 0;
   }
   .add-items {
-    width: 80px;
-    height: 80px;
+    width: 120px;
+    height: 120px;
     border: 1px dotted #e7e7e7;
     border-radius: 5px;
     display: flex;
@@ -4494,8 +4888,8 @@ export default {
     }
   }
   .items {
-    width: 80px;
-    height: 80px;
+    width: 120px;
+    height: 120px;
     margin-bottom: 10px;
     display: flex;
     justify-content: center;
@@ -4699,7 +5093,6 @@ export default {
     }
   }
 }
-
 /deep/.ivu-modal-body {
   max-height: 800px;
 }

+ 147 - 4
src/views/ProductionOrderList/ProductionsOrder/Decorationlist.vue

@@ -16,6 +16,13 @@
       :total="total"
     >
       <div slot="titleButton">
+        <Button
+          type="primary"
+          ghost
+          style="margin-right: 10px"
+          @click="openMeasureModal(selects)"
+          >修改尺寸</Button
+        >
         <Button @click="back" type="primary" ghost style="margin-right: 10px"
           >返回</Button
         >
@@ -55,7 +62,37 @@
           <!-- <a @click="downImg(row.url,row.product_title)">下载图纸</a> -->
         </div>
       </template>
-
+      <Modal
+        class-name="vertical-center-modal"
+        title="修改尺寸"
+        v-model="showMeasureModal"
+        :width="500"
+      >
+        <div>
+          <Table
+            border
+            :columns="measureModalColumns"
+            :data="measureModalTableData"
+          >
+          </Table>
+        </div>
+        <div slot="footer">
+          <Button
+            @click="showMeasureModal = false"
+            type="primary"
+            ghost
+            style="margin-right: 10px"
+            >取消</Button
+          >
+          <Button
+            type="primary"
+            ghost
+            style="margin-right: 10px"
+            @click="handleMeasureModalConfirm"
+            >确认</Button
+          >
+        </div>
+      </Modal>
       <Modal
         @on-ok="saveChip"
         class-name="vertical-center-modal"
@@ -245,6 +282,81 @@ export default {
   },
   data() {
     return {
+      measureModalColumns: [
+        {
+          title: "部件名称",
+          key: "part_title",
+          align: "center",
+          minWidth: 120,
+        },
+        {
+          title: "高",
+          key: "high",
+          align: "center",
+          minWidth: 120,
+          render: (h, params) => {
+            const { row, index } = params;
+            const currentRow = this.measureModalTableData[index];
+            return h("Input", {
+              props: {
+                value: currentRow.high,
+                type: "text",
+              },
+              on: {
+                "on-change": (e) => {
+                  currentRow.high = e.target.value;
+                  this.measureModalTableData.splice(index, 1, currentRow);
+                },
+              },
+            });
+          },
+        },
+        {
+          title: "宽",
+          key: "wide",
+          align: "center",
+          minWidth: 120,
+          render: (h, params) => {
+            const { row, index } = params;
+            const currentRow = this.measureModalTableData[index];
+            return h("Input", {
+              props: {
+                value: currentRow.wide,
+                type: "text",
+              },
+              on: {
+                "on-change": (e) => {
+                  currentRow.wide = e.target.value;
+                  this.measureModalTableData.splice(index, 1, currentRow);
+                },
+              },
+            });
+          },
+        },
+        {
+          title: "厚",
+          key: "thick",
+          align: "center",
+          minWidth: 120,
+          render: (h, params) => {
+            const { row, index } = params;
+            const currentRow = this.measureModalTableData[index];
+            return h("Input", {
+              props: {
+                value: currentRow.thick,
+                type: "text",
+              },
+              on: {
+                "on-change": (e) => {
+                  currentRow.thick = e.target.value;
+                  this.measureModalTableData.splice(index, 1, currentRow);
+                },
+              },
+            });
+          },
+        },
+      ],
+      measureModalTableData: [],
       test_url: "",
       test_modal: false,
       test_content: null,
@@ -663,6 +775,7 @@ export default {
         { title: "工艺路线名称", align: "center", key: "title" },
         { title: "操作", align: "center", key: "id", slot: "processLineSet" },
       ],
+      showMeasureModal: false,
     };
   },
   created() {
@@ -997,6 +1110,36 @@ export default {
         })
         .catch((err) => {});
     },
+    openMeasureModal(row) {
+      if (row.length < 1) {
+        return this.$Message.warning("请至少选择一项");
+      }
+      this.measureModalTableData = [];
+      row.map((v) => {
+        let measure = v.measure.split("*");
+        this.measureModalTableData.push({
+          id: v.pr_id,
+          part_title: v.part_title,
+          high: measure[0],
+          wide: measure[1],
+          thick: measure[2],
+        });
+      });
+      this.showMeasureModal = true;
+    },
+    handleMeasureModalConfirm() {
+      this.axios
+        .post("/api/update_product_pr_measure", {
+          ...this.measureModalTableData,
+        })
+        .then((res) => {
+          if (res.code == 200) {
+            this.$Message.success("修改成功");
+            this.showMeasureModal = false;
+            this.init(this.proxyObj);
+          }
+        });
+    },
     openShipModal(row) {
       // if (this.wxsoect.readyState != 1) {
       //   return this.$Message.error("打印机未正常连接,请检查");
@@ -1108,7 +1251,7 @@ export default {
         const printContent_l2_2 = `图号:${content.url_number}`;
         printparamsJsonArray.push({
           PTK_DrawText_TrueType:
-            "510,80,45,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
+            "610,80,45,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
         });
         const printContent_l3 = `产品名称:${content.product_title}`;
         printparamsJsonArray.push({
@@ -1118,7 +1261,7 @@ export default {
         const printContent_l3_2 = `木皮:${content.color_title}`;
         printparamsJsonArray.push({
           PTK_DrawText_TrueType:
-            "610,130,45,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
+            "810,130,45,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
         });
 
         const printContent_l4 = `部件:${content.part_title}`;
@@ -1129,7 +1272,7 @@ export default {
         const printContent_l4_2 = `尺寸:${content.measure}`;
         printparamsJsonArray.push({
           PTK_DrawText_TrueType:
-            "710,180,45,0,微软雅黑,1,700,0,0,0," + printContent_l4_2,
+            "1010,180,45,0,微软雅黑,1,700,0,0,0," + printContent_l4_2,
         });
         printparamsJsonArray.push({
           PTK_RWRFIDLabel: