Andy 3 yıl önce
ebeveyn
işleme
f6f865b308

+ 106 - 12
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -524,28 +524,31 @@
                 transfer
                 filter-by-label
                 label-in-value
-                v-if="!scope.row.is_metal"
                 v-model="scope.row.product_id"
                 @change="$refs.xTable.updateStatus(scope)"
                 @on-change="
-                  changeEditTableData(scope.row, scope.rowIndex, $event, scope)
+                  handleSelectProductMetail(
+                    scope.row,
+                    scope.rowIndex,
+                    $event,
+                    scope
+                  )
                 "
               >
                 <Option
-                  v-for="item in productList"
-                  :tag="item.img_url"
+                  v-for="item in product_metailList"
+                  :tag="item.key"
                   :value="item.id"
                   :label="item.title"
-                  :key="item.id"
+                  :key="item.key"
                 ></Option>
               </Select>
-              <Select
+              <!-- <Select
                 filterable
                 clearable
                 transfer
                 filter-by-label
                 label-in-value
-                v-else
                 v-model="scope.row.material_id"
                 @change="$refs.xTable.updateStatus(scope)"
                 @on-change="
@@ -558,12 +561,22 @@
                   :key="item.id"
                   :label="item.title"
                 ></Option>
-              </Select>
+              </Select> -->
             </template>
             <template #default="{ row }">{{
               row.is_metal
-                ? getSelectedLabel(row.material_id, metalList, "id", "title")
-                : getSelectedLabel(row.product_id, productList, "id", "title")
+                ? getSelectedLabel(
+                    row.product_id,
+                    product_metailList,
+                    "id",
+                    "title"
+                  )
+                : getSelectedLabel(
+                    row.product_id,
+                    product_metailList,
+                    "id",
+                    "title"
+                  )
             }}</template>
           </vxe-column>
           <vxe-column
@@ -2126,6 +2139,7 @@ export default {
       modalArray: [],
       modalData: {},
       productList: [],
+      product_metailList: [],
       metalList: [],
       extList: [],
       coumstList: [],
@@ -2571,6 +2585,7 @@ export default {
       let _save_metal = this.tableData.filter((v) => v.is_metal && v.id);
       _save_metal.map((v) => {
         v.type = 1;
+        v.material_id = v.product_id;
       });
       // this.tableData.map((item, index) => {
       //   if (!item.is_metal) {
@@ -2663,6 +2678,7 @@ export default {
                   v.total_price = v.num * v.price;
                 } else {
                   v.material_id = v.ext_id;
+                  v.product_id = v.ext_id;
                   v.single_price = v.price;
                   v.price = v.num * v.single_price;
                 }
@@ -2776,10 +2792,13 @@ export default {
             if (v.type === 1) {
               v.is_metal = true;
               v.material_id = v.ext_id;
+              v.product_id = v.ext_id;
+
               this.tableData.push(v);
             }
           });
           this.handleCalcCount();
+          this.HandleAutoCreateNewLine();
           //获取客户信息
           this.axios
             .get("/api/custom_detail", { params: { id: res.data.custom_id } })
@@ -2842,6 +2861,9 @@ export default {
           v.value = v.id;
         });
       });
+      this.axios("/api/get_select_all").then((res) => {
+        this.product_metailList = res.data;
+      });
     },
     cancelModal() {
       this.showEditProduct = false;
@@ -2974,6 +2996,7 @@ export default {
       this.tableData.forEach((element) => {
         sum += element.price * 1;
         if (!element.is_metal) {
+          element.part&&
           element.part.forEach((elem) => {
             if (!elem.is_metal) {
               // 统计部件
@@ -3641,12 +3664,14 @@ export default {
     HandleAutoCreateNewLine() {
       let flag = false;
       this.tableData.map((v) => {
-        if (!v.position || !v.product_id || !v.material_id) {
+        if (!v.position && !v.product_id) {
           flag = true;
         }
       });
       if (flag) {
-        this.handleTableAdd()
+        return;
+      } else {
+        this.handleTableAdd();
       }
     },
     handleTableAdd() {
@@ -3673,6 +3698,7 @@ export default {
           overdraft: [], //超标公式
           measure: this._measure, //测量字段数组
           support_remark: this.support_remark, //备注列表
+          is_metal: false,
           ext: [],
           extArray: [
             {
@@ -3701,6 +3727,7 @@ export default {
         type: 1,
         is_metal: true,
         material_id: "",
+        product_id: "",
         title: "",
         price: 0,
         single_price: 0,
@@ -4072,6 +4099,73 @@ export default {
         this.handleCalcCount();
       }
     },
+    handleSelectProductMetail(row, rowIndex, $event, scope) {
+      const arr = $event.tag.split("_");
+      let obj = {};
+      // 分类   1产品   2五金
+      if (arr[1] === "1") {
+        obj = {
+          type_name: "", //展示用产品名称
+          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, //备注列表
+          is_metal: false,
+          ext: [],
+          extArray: [
+            {
+              num: 0,
+              price: 0,
+              total_price: 0,
+              type: 2,
+              remark: "",
+              title: "",
+              id: "",
+              is_metal: true,
+            },
+          ],
+          process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
+        };
+        obj.process_obj.map(
+          (v) => ((obj[v.id] = ""), (obj.procedure_properties[v.id] = ""))
+        );
+      } else {
+        obj = {
+          type: 1,
+          is_metal: true,
+          material_id: "",
+          product_id: "",
+          title: "",
+          price: 0,
+          single_price: 0,
+          num: 0,
+          unit: "",
+        };
+      }
+      obj.product_id = $event.value;
+      this.tableData.splice(rowIndex, 1, obj);
+      if (arr[1] === "1") {
+        this.changeEditTableData(row, rowIndex, $event, scope);
+      } else {
+        this.changeEditMetal(row, rowIndex, $event, scope);
+      }
+      this.HandleAutoCreateNewLine();
+    },
     changeEditTableData(row, rowIndex, $event, scope) {
       if ($event) {
         let id = $event.value;

+ 5 - 2
src/views/leadMatch/MatchList/matchPage.vue

@@ -738,7 +738,7 @@ export default {
         house_list: [{ title: 1 }], //当前图号下表格列表
       }, //房间信息
       currentChooseId: "", //选中码单信息中的ID
-      currentChooseNumber: "", //选中码单信息中的ID
+      currentChooseNumber: 0, //选中码单信息中的ID
       currentChooseTitle: "", //选中码单信息中的ID
       currentChooseNumberUsed: "",
       matchedList: [],
@@ -1035,6 +1035,9 @@ export default {
       this.handleHandingMatchNumChange();
     },
     handleIsAllowHandingMatch() {
+      if (this.unmatchedSelectedList.length <1 || !this.currentChooseNumber) {
+        return this.$Message.warning("请选择");
+      }
       if (this.currentChooseNumber < this.unmatchedSelectedList.length) {
         return this.$Message.warning("未匹配数量不足,请重新选择");
       }
@@ -1076,7 +1079,7 @@ export default {
             this.showHandingMatchModal = false;
             this.handleSearchUnmatchedInfo();
             this.currentChooseId = "";
-            this.currentChooseNumber = "";
+            this.currentChooseNumber = 0;
             this.currentChooseTitle = "";
             this.unmatchedSelectedList = [];
           }