Andy 3 years ago
parent
commit
ccc3708b93

+ 2 - 1
src/routerMap/index.js

@@ -223,7 +223,8 @@ const routerMap = [{
         path: '/cms/product/index',
         name: 'Products', //产品管理-->通用产品页
         meta: {
-            index: 4
+            index: 4,
+            keepAlive: true
         },
         component: (resolve) => require(['@/views/ProductMannage/index'], resolve),
     },

+ 2 - 2
src/views/MaterialMannage/edit.vue

@@ -100,12 +100,12 @@
               inline
               :model="rows"
               :rules='itemRules'>
-          <FormItem label=""
+          <FormItem label=""
                     prop='long'
                     v-show="isShowDetailLong">
             <Input :disabled='type == 3 ? true : false'
                    v-model="rows.long"
-                   placeholder="请输入度" />
+                   placeholder="请输入度" />
           </FormItem>
           <FormItem label="宽"
                     prop='width'

File diff suppressed because it is too large
+ 1012 - 171
src/views/OrderMannage/BusinessOrderlist/edit.vue


+ 60 - 33
src/views/OrderMannage/BusinessOrderlist/list.vue

@@ -238,6 +238,7 @@
                 v-for="item of headerList"
                 :key="item.key"
                 :label="item.title"
+                :disabled="item.title=='操作'||item.title=='已收款'||item.title=='未收款'"
                 :value="item.key"
               ></Option>
             </Select>
@@ -361,7 +362,11 @@ export default {
             return h(
               "span",
               {},
-              params.row.predict_price - params.row.get_money
+              (
+                params.row.predict_price -
+                params.row.fax_price -
+                params.row.get_money
+              ).toFixed(2)
             );
           },
         },
@@ -411,7 +416,7 @@ export default {
               "span",
               {},
               params.row.state == 0
-                ? "全部"
+                ? "订单未审核"
                 : params.row.state == 1
                 ? "测量未审核"
                 : params.row.state == 2
@@ -419,7 +424,7 @@ export default {
                 : params.row.state == 3
                 ? "测量通过"
                 : params.row.state == 4
-                ? "生产未审核"
+                ? "生产"
                 : params.row.state == 5
                 ? "生产审核中"
                 : params.row.state == 6
@@ -440,6 +445,14 @@ export default {
           align: "center",
           minWidth: 180,
           key: "crt_name",
+          // render: (h, params) => {
+          //   const { row } = params;
+          //   let text = "";
+          //   this.users.map(
+          //     (item) => item.id == row.crt_id && (text = item.nickname)
+          //   );
+          //   return h("span", {}, text);
+          // },
         },
         {
           title: "订单创建时间",
@@ -570,7 +583,7 @@ export default {
         { is_show: true, key: "address", value: "客户地址", title: "客户地址" },
         { is_show: true, key: "salesman", value: "业务员", title: "业务员" },
         { is_show: true, key: "state", value: "订单状态", title: "订单状态" },
-        { is_show: true, key: "crt_name", value: "制单人", title: "制单人" },
+        { is_show: true, key: "crt_id", value: "制单人", title: "制单人" },
         {
           is_show: true,
           key: "warning_state",
@@ -784,7 +797,7 @@ export default {
             { label: "测量未审核", value: 1 },
             { label: "测量审核中", value: 2 },
             { label: "测量通过", value: 3 },
-            { label: "生产未审核", value: 4 },
+            { label: "生产", value: 4 },
             { label: "生产审核中", value: 5 },
             { label: "生产通过", value: 6 },
             { label: "到生产计划", value: 7 },
@@ -810,7 +823,7 @@ export default {
           placeholder: "请选择制单人",
           filterable: true,
           value: "",
-          serverName: "crt_name",
+          serverName: "crt_id",
           optionName: "nickname",
           optionValue: "id",
           option: this.users,
@@ -866,7 +879,9 @@ export default {
     },
     getData(row) {
       this.loading = true;
-      this.axios("/api/order_list_new", { params: row }).then((res) => {
+      this.axios("/api/order_list_new", {
+        params: { ...row },
+      }).then((res) => {
         if (res.code == 200) {
           this.loading = false;
           if (!res.data.data) {
@@ -894,11 +909,15 @@ export default {
     changePage(e) {
       this.page_index = e;
       this.proxyObj.page_index = this.page_index;
+      const temp = this.sortList.filter((item) => item.sort == null);
+      temp.length == 0 && (this.proxyObj.sortList = this.sortList);
       this.getData(this.proxyObj);
     },
     changeSize(e) {
       this.page_size = e;
       this.proxyObj.page_size = this.page_size;
+      const temp = this.sortList.filter((item) => item.sort == null);
+      temp.length == 0 && (this.proxyObj.sortList = this.sortList);
       this.getData(this.proxyObj);
     },
     addOrder(n, row) {
@@ -1014,33 +1033,41 @@ export default {
       }
     },
     handleConfirmSort() {
-      this.loading = true;
-      this.axios("/api/order_list_new", {
-        params: { ...this.proxyObj, sortList: this.sortList },
-      }).then((res) => {
-        if (res.code == 200) {
-          this.loading = false;
-          if (!res.data.data) {
-            return this.$Message.error("列表数据返回格式不正确");
+      if (
+        this.sortList.length > 1 ||
+        (this.sortList.length == 1 && this.sortList[0].sort)
+      ) {
+        this.loading = true;
+        this.axios("/api/order_list_new", {
+          params: { ...this.proxyObj, sortList: this.sortList },
+        }).then((res) => {
+          if (res.code == 200) {
+            this.loading = false;
+            if (!res.data.data) {
+              return this.$Message.error("列表数据返回格式不正确");
+            }
+            this.tableData = res.data.data;
+            this.total = res.data.total;
+            this.showSortModal = false;
+            // this.tableModalTableData =
+            //   res.data.tableSet.tableSet.length < 1
+            //     ? this.tableModalTableData
+            //     : res.data.tableSet.tableSet;
+            // this.formModalTableData =
+            //   res.data.tableSet.formSet.length < 1
+            //     ? this.formModalTableData
+            //     : res.data.tableSet.formSet;
+            // this.sub_formModalTableData = JSON.parse(
+            //   JSON.stringify(this.formModalTableData)
+            // );
+            // this.sub_tableModalTableData = JSON.parse(
+            //   JSON.stringify(this.tableModalTableData)
+            // );
           }
-          this.tableData = res.data.data;
-          this.total = res.data.total;
-          // this.tableModalTableData =
-          //   res.data.tableSet.tableSet.length < 1
-          //     ? this.tableModalTableData
-          //     : res.data.tableSet.tableSet;
-          // this.formModalTableData =
-          //   res.data.tableSet.formSet.length < 1
-          //     ? this.formModalTableData
-          //     : res.data.tableSet.formSet;
-          // this.sub_formModalTableData = JSON.parse(
-          //   JSON.stringify(this.formModalTableData)
-          // );
-          // this.sub_tableModalTableData = JSON.parse(
-          //   JSON.stringify(this.tableModalTableData)
-          // );
-        }
-      });
+        });
+      } else {
+        this.showSortModal = false;
+      }
     },
     onDragDrop(a, b, table, type) {
       if (type == 2 && (a == 0 || b == 0)) {

+ 1 - 1
src/views/PartsMannage/edit.vue

@@ -325,7 +325,7 @@ export default {
         { title: '物料名称', align: 'center', key: 'title', slot: 'title', minWidth: 150 },
         { title: '数量', align: 'center', key: 'number', slot: 'number', minWidth: 150 },
         { title: '单位', align: 'center', key: 'company', slot: 'company', minWidth: 100 },
-        { title: '', align: 'center', key: 'long', slot: 'long', minWidth: 120 },
+        { title: '', align: 'center', key: 'long', slot: 'long', minWidth: 120 },
         { title: '宽', align: 'center', key: 'wide', slot: 'wide', minWidth: 120 },
         { title: '厚', align: 'center', key: 'thick', slot: 'thick', minWidth: 120 },
         { title: '工艺要求', align: 'center', key: 'requirement', slot: 'requirement', minWidth: 150 },

+ 4 - 5
src/views/ProductMannage/edit.vue

@@ -131,7 +131,7 @@
             </Select>
           </template>
         </vxe-table-column>
-        <vxe-table-column field="formula_l" title="长(L)">
+        <vxe-table-column field="formula_l" title="高(H)">
           <template #default="{ row,rowIndex }">
             <Input
               :disabled="type == 3"
@@ -153,7 +153,7 @@
             ></Input>
           </template>
         </vxe-table-column>
-        <vxe-table-column field="formula_h" title="高(H)">
+        <vxe-table-column field="formula_h" title="厚(T)">
           <template #default="{ row,rowIndex }">
             <Input
               :disabled="type == 3"
@@ -439,7 +439,6 @@
 
 <script>
 import KeyBoard from "../../components/keyboard/index";
-import { mapState, mapMutations } from "vuex";
 export default {
   data() {
     return {
@@ -460,7 +459,7 @@ export default {
           tree: true,
         },
         {
-          title: "长(L)",
+          title: "高(H)",
           align: "center",
           key: "formula_l",
           slot: "formula_l",
@@ -472,7 +471,7 @@ export default {
           slot: "formula_w",
         },
         {
-          title: "高(H)",
+          title: "厚(T)",
           align: "center",
           key: "formula_h",
           slot: "formula_h",

+ 621 - 158
src/views/ProductMannage/index.vue

@@ -1,126 +1,290 @@
 <template>
   <div>
-    <FullPage :title='$route.query.title'
-              :list='list'
-              @init='init'
-              :loading='loading'
-              @searchData='init'
-              @changePage='changePage'
-              @changeSize='changeSize'
-              :tableColums='tableColums'
-              :tableData='tableData'
-              :pageIndex='pageIndex'
-              :total='total'>
-      <div slot='titleButton'
-           style="display:flex;">
-        <Upload v-if='persimissionData["批量导入"]||persimissionData.all'
-                name='your_file'
-                :show-upload-list='false'
-                :headers='headers'
-                :on-error='uploadError'
-                :on-success='uploadSuccess'
-                :action="$store.state.ip+'/api/product_import'">
-          <Button type="success"
-                  ghost
-                  icon='md-exit'
-                  style="margin-right:10px;">批量导入</Button>
+    <FullPage
+      :title="$route.query.title"
+      :list="list"
+      @init="init"
+      :loading="loading"
+      @searchData="init"
+      @changePage="changePage"
+      @changeSize="changeSize"
+      :tableColums="tableColums"
+      :tableData="tableData"
+      :pageIndex="pageIndex"
+      :total="total"
+    >
+      <div slot="titleButton" style="display:flex;">
+        <Upload
+          v-if="persimissionData['批量导入'] || persimissionData.all"
+          name="your_file"
+          :show-upload-list="false"
+          :headers="headers"
+          :on-error="uploadError"
+          :on-success="uploadSuccess"
+          :action="$store.state.ip + '/api/product_import'"
+        >
+          <Button type="success" ghost icon="md-exit" style="margin-right:10px;"
+            >批量导入</Button
+          >
         </Upload>
-        <Button v-if='persimissionData["批量导出"]||persimissionData.all'
-                @click="exportData"
-                type="warning"
-                ghost
-                icon='md-return-left'
-                style="margin-right:10px;">批量导出</Button>
-        <Button v-if='persimissionData["新增产品"]||persimissionData.all'
-                type="primary"
-                ghost
-                icon='md-add'
-                @click="goPage(1)">新增产品</Button>
+        <Button
+          v-if="persimissionData['批量导出'] || persimissionData.all"
+          @click="exportData"
+          type="warning"
+          ghost
+          icon="md-return-left"
+          style="margin-right:10px;"
+          >批量导出</Button
+        >
+        <!-- v-if="persimissionData['批改替换项'] || persimissionData.all" -->
+        <Button
+          type="primary"
+          ghost
+          @click="showModal = true"
+          style="margin-right:10px;"
+          >批改替换项</Button
+        >
+        <Button
+          v-if="persimissionData['新增产品'] || persimissionData.all"
+          type="primary"
+          ghost
+          icon="md-add"
+          @click="goPage(1)"
+          >新增产品</Button
+        >
       </div>
-      <div slot='navButton'>
-
-      </div>
-
-      <template slot='set'
-                slot-scope='{row}'>
+      <div slot="navButton"></div>
+      <template slot="set" slot-scope="{ row }">
         <div class="table-set">
-          <svg style="font-size:20px"
-               color='#3764FF'
-               @click="goPage(4,row)"
-               class="icon icon-nav"
-               aria-hidden="true">
+          <svg
+            style="font-size:20px"
+            color="#3764FF"
+            @click="goPage(4, row)"
+            class="icon icon-nav"
+            aria-hidden="true"
+          >
             <use xlink:href="#iconcopy-01"></use>
           </svg>
-          <svg v-if='persimissionData["编辑"]||persimissionData.all'
-               style="font-size:20px"
-               color='#3764FF'
-               @click="goPage(2,row)"
-               class="icon icon-nav"
-               aria-hidden="true">
+          <svg
+            v-if="persimissionData['编辑'] || persimissionData.all"
+            style="font-size:20px"
+            color="#3764FF"
+            @click="goPage(2, row)"
+            class="icon icon-nav"
+            aria-hidden="true"
+          >
             <use xlink:href="#iconbianji"></use>
           </svg>
-          <svg style="font-size:20px"
-               color='green'
-               @click="goPage(3,row)"
-               class="icon icon-nav"
-               aria-hidden="true">
+          <svg
+            style="font-size:20px"
+            color="green"
+            @click="goPage(3, row)"
+            class="icon icon-nav"
+            aria-hidden="true"
+          >
             <use xlink:href="#iconxiangqing"></use>
           </svg>
 
-          <svg v-if='persimissionData["删除"]||persimissionData.all'
-               @click="delItems(row)"
-               class="icon icon-nav"
-               style="font-size:20px"
-               color='red'
-               aria-hidden="true">
+          <svg
+            v-if="persimissionData['删除'] || persimissionData.all"
+            @click="delItems(row)"
+            class="icon icon-nav"
+            style="font-size:20px"
+            color="red"
+            aria-hidden="true"
+          >
             <use xlink:href="#iconshanchu"></use>
           </svg>
         </div>
       </template>
     </FullPage>
+    <Modal
+      v-model="showModal"
+      :title="'批改替换项:' + $route.query.title"
+      width="1300"
+    >
+      <div class="show_modal_content">
+        <div class="show_modal_content_left">
+          <div class="show_modal_content_left_item">
+            <div class="show_modal_content_left_item_title">
+              <Button
+                type="primary"
+                style="cursor:default;border-radius:0"
+                ghost
+                >产品名称</Button
+              >
+            </div>
+            <div class="show_modal_content_left_item_detail_warp">
+              <div
+                class="show_modal_content_left_item_detail"
+                v-for="product in tableData"
+                :key="product.id"
+              >
+                <Button
+                  type="primary"
+                  :ghost="!product.isSelect"
+                  style="border-radius:10px"
+                  @click="handleProductClick(product, 2)"
+                  >{{ product.title }}</Button
+                >
+              </div>
+            </div>
+          </div>
+          <div class="show_modal_content_left_item">
+            <div class="show_modal_content_left_item_title">
+              <Button
+                type="primary"
+                style="cursor:default;border-radius:0"
+                ghost
+                >部件名称</Button
+              >
+            </div>
+            <div v-if="productPartList.length < 1">
+              <Button type="primary" ghost style="border-radius:10px"
+                >无</Button
+              >
+            </div>
+            <div v-else class="show_modal_content_left_item_detail_warp">
+              <div
+                class="show_modal_content_left_item_detail"
+                v-for="part in productPartList"
+                :key="part.id"
+              >
+                <Button
+                  type="primary"
+                  :ghost="!part.isSelect"
+                  style="border-radius:10px"
+                  @click="handlePartClick(part, 3)"
+                  >{{ part.title }}</Button
+                >
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="show_modal_content_right">
+          <div class="show_modal_content_right_top">
+            <Button type="primary" @click="handleAddChangeable"
+              >新增替换部件</Button
+            >
+          </div>
+          <div class="show_modal_content_right_body">
+            <Table
+              border
+              max-height="500"
+              :columns="changeableColumns"
+              :data="changeableTableData"
+            ></Table>
+          </div>
+        </div>
+      </div>
+      <div slot="footer">
+        <Button
+          type="primary"
+          style="margin-right:10px;"
+          @click="showModal = false"
+          >取消</Button
+        >
+        <Button
+          type="primary"
+          style="margin-right:10px;"
+          @click="handleChangeableConfirm"
+          >确定</Button
+        >
+      </div>
+    </Modal>
+    <Modal
+      v-model="showKey"
+      :width="1250"
+      :mask-closable="false"
+      :closable="false"
+    >
+      <div>
+        <KeyBoard
+          :rightData="measureList"
+          @cancel="cancelKey"
+          @success="successKey"
+          class="key-co"
+        />
+      </div>
+      <div slot="footer"></div>
+    </Modal>
   </div>
 </template>
 
 <script>
-import { mapState } from 'vuex'
+import { mapState } from "vuex";
+import KeyBoard from "../../components/keyboard/index";
 export default {
-  data () {
+  components: { KeyBoard },
+  data() {
     return {
       list: [
-        { title: '产品名称', name: 'Input', value: '', serverName: 'title', placeholder: '请输入产品名称' },
-        { title: '产品型号', name: 'Input', value: '', serverName: 'model', placeholder: '请输入产品型号' },
-        { title: '图号', name: 'Input', value: '', serverName: 'url_number', placeholder: '请输入图号' },
+        {
+          title: "产品名称",
+          name: "Input",
+          value: "",
+          serverName: "title",
+          placeholder: "请输入产品名称",
+        },
+        {
+          title: "产品型号",
+          name: "Input",
+          value: "",
+          serverName: "model",
+          placeholder: "请输入产品型号",
+        },
+        {
+          title: "图号",
+          name: "Input",
+          value: "",
+          serverName: "url_number",
+          placeholder: "请输入图号",
+        },
       ],
       tableColums: [
-        { title: '序号', type: 'index', align: 'center', key: '', width: '100' },
-        { title: '分类名称', align: 'center', key: 'type_name' },
-        { title: '产品名称', align: 'center', key: 'title' },
-        { title: '计量单位', align: 'center', key: 'unit' },
-        { title: '型号', align: 'center', key: 'model' },
-        { title: '图号', align: 'center', key: 'url_number' },
         {
-          title: '产品图片', align: 'center', key: 'company',
+          title: "序号",
+          type: "index",
+          align: "center",
+          key: "",
+          width: "100",
+        },
+        { title: "分类名称", align: "center", key: "type_name" },
+        { title: "产品名称", align: "center", key: "title" },
+        { title: "计量单位", align: "center", key: "unit" },
+        { title: "型号", align: "center", key: "model" },
+        { title: "图号", align: "center", key: "url_number" },
+        {
+          title: "产品图片",
+          align: "center",
+          key: "company",
           render: (h, params) => {
-            const { row } = params
-            return h('img', {
+            const { row } = params;
+            return h("img", {
               attrs: {
                 src: this.$store.state.ip + params.row.img_url,
-                style: 'max-width:50px;max-height:50px;position:relative;top:3px;'
+                style:
+                  "max-width:50px;max-height:50px;position:relative;top:3px;",
               },
               on: {
                 click: (e) => {
-                  this.axios('/api/orders_img', { params: { id: row.id, type: 0 } }).then(res => {
-                    console.log('this.$store.state.ip :>> ', this.$store.state.ip);
+                  this.axios("/api/orders_img", {
+                    params: { id: row.id, type: 0 },
+                  }).then((res) => {
+                    console.log(
+                      "this.$store.state.ip :>> ",
+                      this.$store.state.ip
+                    );
                     if (res.code == 200) {
-                      row.imgs = res.data
+                      row.imgs = res.data;
                       this.$previewImg({
                         list: res.data,
                         baseUrl: this.$store.state.ip,
-                        baseImgField: 'img_url',
-                        baseTitleField: ''
-                      })
+                        baseImgField: "img_url",
+                        baseTitleField: "",
+                      });
                     }
-                  })
+                  });
                   // if(row.imgs&&row.imgs.length>0){//优化处理考虑到图纸我就暂时不处理了
                   //     this.$previewImg({
                   //         list:row.imgs,
@@ -141,39 +305,44 @@ export default {
                   //         }
                   //     })
                   // }
-                }
-              }
-            })
-          }
+                },
+              },
+            });
+          },
         },
         {
-          title: '图纸', align: 'center', key: 'url',
+          title: "图纸",
+          align: "center",
+          key: "url",
           render: (h, params) => {
-            const { row } = params
-            return h('img', {
+            const { row } = params;
+            return h("img", {
               attrs: {
                 src: this.$store.state.ip + params.row.url,
-                style: 'max-width:50px;max-height:50px;position:relative;top:3px;'
+                style:
+                  "max-width:50px;max-height:50px;position:relative;top:3px;",
               },
               on: {
                 click: (e) => {
-                  this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
+                  this.axios("/api/orders_img", {
+                    params: { id: row.id, type: 1 },
+                  }).then((res) => {
                     if (res.code == 200) {
-                      row.imgs = res.data
+                      row.imgs = res.data;
                       this.$previewImg({
                         list: row.imgs,
                         baseUrl: this.$store.state.ip,
-                        baseImgField: 'img_url',
-                        baseTitleField: ''
-                      })
+                        baseImgField: "img_url",
+                        baseTitleField: "",
+                      });
                     }
-                  })
-                }
-              }
-            })
-          }
+                  });
+                },
+              },
+            });
+          },
         },
-        { title: '操作', align: 'center', slot: 'set', width: '150' },
+        { title: "操作", align: "center", slot: "set", width: "150" },
       ],
       tableData: [],
       pageIndex: 1,
@@ -181,100 +350,394 @@ export default {
       pageSize: 10,
       proxyObj: {},
       loading: false,
-      headers: { 'Authorization': localStorage.getItem('token') },
+      headers: { Authorization: localStorage.getItem("token") },
+      showModal: false,
+      productPartList: [],
+      currentProductList: [],
+      changeableColumns: [
+        {
+          title: "替换部件",
+          align: "center",
+          key: "part_id",
+          render: (h, params) => {
+            const { index } = params;
+            const currencyRow = this.changeableTableData[index];
+            return h(
+              "Select",
+              {
+                props: {
+                  value: currencyRow.part_id,
+                  size: "small",
+                  transfer: true,
+                  clearable: true,
+                  filterable: true,
+                },
+                on: {
+                  "on-change": (e) => {
+                    currencyRow.part_id = e;
+                  },
+                },
+              },
+              [
+                this.partsList.map((item) => {
+                  return h("Option", {
+                    props: { label: item.title, value: item.id },
+                  });
+                }),
+              ]
+            );
+          },
+        },
+        {
+          title: "高",
+          align: "center",
+          key: "formula_l",
+          width: "100px",
+          render: (h, params) => {
+            const { index } = params;
+            const currencyRow = this.changeableTableData[index];
+            return h("Input", {
+              props: {
+                placeholder: "请输入高",
+                value: currencyRow.formula_l,
+                disabled: this.isChecked,
+              },
+              on: {
+                "on-focus": () => {
+                  this.openKey(index, "formula_l", currencyRow);
+                },
+              },
+            });
+          },
+        },
+        {
+          title: "宽",
+          align: "center",
+          key: "formula_w",
+          width: "100px",
+          render: (h, params) => {
+            const { index } = params;
+            const currencyRow = this.changeableTableData[index];
+            return h("Input", {
+              props: {
+                placeholder: "请输入宽",
+                value: currencyRow.formula_w,
+              },
+              on: {
+                "on-focus": () => {
+                  this.openKey(index, "formula_w", currencyRow);
+                },
+              },
+            });
+          },
+        },
+        {
+          title: "厚",
+          align: "center",
+          key: "formula_h",
+          width: "100px",
+          render: (h, params) => {
+            const { index } = params;
+            const currencyRow = this.changeableTableData[index];
+            return h("Input", {
+              props: {
+                placeholder: "请输入厚",
+                value: currencyRow.formula_h,
+              },
+              on: {
+                "on-focus": () => {
+                  this.openKey(index, "formula_h", currencyRow);
+                },
+              },
+            });
+          },
+        },
+        {
+          title: "操作",
+          align: "center",
+          key: "set",
+          width: "100px",
+          render: (h, params) => {
+            const { index } = params;
+            // const currencyRow = this.changeableTableData[index];
+            return h(
+              "a",
+              {
+                on: {
+                  click: () => {
+                    this.changeableTableData.splice(index, 1);
+                  },
+                },
+              },
+              "删除"
+            );
+          },
+        },
+      ],
+      changeableTableData: [],
+      partsList: [],
+      showKey: false,
+      measureList: [],
+      currencyChoose: {},
+      attrindex: null,
+      attrName: "",
+    };
+  },
+  beforeRouteLeave(to, from, next) {
+    if (to.path == "/cms/product/edit") {
+      this.$route.meta.keepAlive = true;
+    } else {
+      this.$route.meta.keepAlive = false;
     }
+    console.log("this.$route.meta.keepAlive :>> ", this.$route.meta.keepAlive);
+    next();
+  },
+  created() {
+    console.log("1 :>> ", 1);
+    console.log("this.$route :>> ", this.$route);
+    // 获取部件列表
+    this.axios("/api/parts_index").then((res) => {
+      this.partsList = res.data.data;
+    });
+    // 获取产品分类测量字段
+    this.axios("/api/basics_product_list", {
+      params: { id: this.$route.query.id },
+    }).then((res) => {
+      if (res.code == 200) {
+        const { data } = res;
+        const result = data.filter((rows) => rows.id == this.$route.query.id);
+        this.measureList = result[0].measure;
+      }
+    });
   },
-  mounted () {
+  mounted() {
     this.proxyObj.type_id = this.$route.query.id;
-    this.getData(this.proxyObj)
+    this.getData(this.proxyObj);
   },
   computed: {
-    ...mapState(['persimissionData']),
+    ...mapState(["persimissionData"]),
   },
   watch: {
-    $route (to) {
-      this.proxyObj.type_id = to.query.id;
-      this.list.forEach(element => {
-        element.value = ''
-      });
-      this.proxyObj.model = ''
-      this.proxyObj.title = ''
-      this.getData(this.proxyObj)
-    }
+    "$route.query.title": {
+      handler() {
+        this.proxyObj.type_id = this.$route.query.id;
+        this.list.forEach((element) => {
+          element.value = "";
+        });
+        this.proxyObj.model = "";
+        this.proxyObj.title = "";
+        this.getData(this.proxyObj);
+      },
+    },
   },
   methods: {
-    init (row) {
-      this.pageIndex = 1
+    init(row) {
+      this.pageIndex = 1;
       row.page_index = this.pageIndex;
       row.page_size = this.pageSize;
-      row.type_id = this.$route.query.id;//产品管理因为无法使用id 所以用type_id替代
-      this.proxyObj = row
-      this.getData(row)
+      row.type_id = this.$route.query.id; //产品管理因为无法使用id 所以用type_id替代
+      this.proxyObj = row;
+      this.getData(row);
     },
-    getData (row) {
+    getData(row) {
       this.loading = true;
-      this.axios('/api/product', { params: row }).then(res => {
+      this.axios("/api/product", { params: row }).then((res) => {
         this.loading = false;
         this.tableData = res.data.data;
         this.total = res.data.total;
-      })
+        this.tableData.map((item) => (item.isSelect = false));
+      });
     },
-    delItems (row) {
+    delItems(row) {
       this.confirmDelete({
-        content: '确认删除么?',
+        content: "确认删除么?",
         then: () => {
-          this.axios.post('/api/product', { id: row.id, state: 0 }).then(res => {
-            if (res.code == 200) {
-              this.$Message.success(res.msg)
-              this.getData(this.proxyObj)
-            }
-          })
-        }
-      })
+          this.axios
+            .post("/api/product", { id: row.id, state: 0 })
+            .then((res) => {
+              if (res.code == 200) {
+                this.$Message.success(res.msg);
+                this.getData(this.proxyObj);
+              }
+            });
+        },
+      });
+    },
+    handleProductClick(product, type) {
+      product.isSelect = !product.isSelect;
+      this.currentProductList = product;
+      const temp_product = this.tableData.filter((item) => item.isSelect);
+      const product_id = temp_product.map((item) => item.id);
+      this.axios
+        .post("/api/support_product_get_part", {
+          type,
+          basic_product_id: [this.$route.query.id],
+          product_id,
+          part_id: [],
+        })
+        .then((res) => {
+          console.log(res);
+          this.productPartList = res.data;
+          this.productPartList.map((item) => (item.isSelect = false));
+          console.log("this.productPartList :>> ", this.productPartList);
+        });
+      this.$forceUpdate();
     },
-    changePage (e) {
+    handlePartClick(part, type) {
+      // 部件单选
+      this.productPartList.map((item) => (item.isSelect = false));
+      part.isSelect = !part.isSelect;
+      const temp_product = this.tableData.filter((item) => item.isSelect);
+      const product_id = temp_product.map((item) => item.id);
+      const temp_part = this.productPartList.filter((item) => item.isSelect);
+      const part_id = temp_part.map((item) => item.id);
+      this.axios
+        .post("/api/support_product_get_part", {
+          type,
+          basic_product_id: [this.$route.query.id],
+          product_id,
+          part_id,
+        })
+        .then((res) => {
+          console.log(res);
+          this.changeableTableData = res.data;
+        });
+      this.$forceUpdate();
+    },
+    handleAddChangeable() {
+      const temp = this.productPartList.filter((item) => item.isSelect);
+      if (temp.length > 0) {
+        this.changeableTableData.push({
+          id: "",
+          formula_h: "",
+          formula_l: "",
+          formula_w: "",
+        });
+      } else {
+        this.$Message.warning("请选择部件名称");
+      }
+    },
+    handleChangeableConfirm() {
+      const temp_product = this.tableData.filter((item) => item.isSelect);
+      const product_id = temp_product.map((item) => item.id);
+      const temp_part = this.productPartList.filter((item) => item.isSelect);
+      const part_id = temp_part.map((item) => item.id);
+      this.axios
+        .post("/api/support_product_batch", {
+          type: 3,
+          basic_product_id: [this.$route.query.id],
+          product_id,
+          part_id,
+          change: this.changeableTableData,
+        })
+        .then((res) => {
+          if (res.code == 200) {
+            this.$Message.success(res.msg);
+            this.tableData.map((item) => (item.isSelect = false));
+            this.productPartList = [];
+            this.changeableTableData = [];
+            this.showModal = false;
+          }
+        });
+    },
+    openKey(row, attr, cur) {
+      this.showKey = true;
+      this.attrindex = row;
+      this.attrName = attr;
+      this.currencyChoose = cur;
+    },
+    successKey(str) {
+      // this.info.part[this.attrindex][this.attrName] = str;
+      this.currencyChoose[this.attrName] = str;
+      this.showKey = false;
+    },
+    cancelKey() {
+      this.showKey = false;
+    },
+    changePage(e) {
       this.pageIndex = e;
       this.proxyObj.page_index = this.pageIndex;
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     },
-    changeSize (e) {
+    changeSize(e) {
       this.pageSize = e;
       this.proxyObj.page_size = this.pageSize;
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     },
-    goPage (n, row) {//n = 1 新增 2 编辑 3 查看
-      let id = row ? row.id : ''
+    goPage(n, row) {
+      //n = 1 新增 2 编辑 3 查看
+      let id = row ? row.id : "";
       this.$router.push({
-        path: '/cms/product/edit',
+        path: "/cms/product/edit",
         query: {
           type: n,
           id: id,
           back_id: this.$route.query.id,
           title: this.$route.query.title,
-        }
-      })
+        },
+      });
     },
-    async exportData () {
-      const res = await this.axios('/api/product_export', { params: { ...this.proxyObj } })
+    async exportData() {
+      const res = await this.axios("/api/product_export", {
+        params: { ...this.proxyObj },
+      });
       if (res.code == 200) {
-        let url = `${this.$store.state.ip}/api/storage/${res.data.file}`
-        location.href = url
+        let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
+        location.href = url;
       }
     },
-    uploadSuccess (res) {
+    uploadSuccess(res) {
       if (res.code == 200) {
-        this.$Message.success(res.msg || '上传成功')
+        this.$Message.success(res.msg || "上传成功");
       } else {
-        this.$Message.warning(res.msg || '上传失败')
+        this.$Message.warning(res.msg || "上传失败");
       }
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     },
-    uploadError (err) {
-      this.$Message.error(err.msg || '上传失败')
-    }
-  }
-}
+    uploadError(err) {
+      this.$Message.error(err.msg || "上传失败");
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-</style>
+.show_modal_content {
+  display: flex;
+  .show_modal_content_left {
+    width: 50%;
+    min-height: 500px;
+    overflow: hidden;
+    overflow-y: auto;
+    border-right: 1px solid #e8eaec;
+    padding-top: 20px;
+    .show_modal_content_left_item {
+      width: 100%;
+      display: flex;
+      .show_modal_content_left_item_title,
+      .show_modal_content_left_item_detail {
+        margin-bottom: 10px;
+        margin-right: 20px;
+      }
+      .show_modal_content_left_item_detail_warp {
+        display: flex;
+        justify-content: flex-start;
+        align-items: flex-start;
+        flex-wrap: wrap;
+        .show_modal_content_left_item_detail {
+        }
+      }
+    }
+  }
+  .show_modal_content_right {
+    width: 50%;
+    padding-left: 20px;
+    .show_modal_content_right_top {
+      display: flex;
+      justify-content: flex-end;
+      margin-top: 50px;
+      margin-bottom: 10px;
+    }
+  }
+}
+</style>

Some files were not shown because too many files changed in this diff