Kaynağa Gözat

记录规则功能修改

lucw 10 ay önce
ebeveyn
işleme
011ad34a58

+ 205 - 197
src/components/select/SelectProduct/index.vue

@@ -1,18 +1,40 @@
 <template>
-  <el-dialog :title="title" :visible.sync="visible" v-if="visible" :before-close="handleClose"
-    :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="75%">
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    v-if="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="75%"
+  >
     <el-card shadow="never">
       <ProductSearch @search="reload" ref="searchRef" />
 
-      <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
+      <ele-split-layout
+        width="244px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
         <div class="ele-border-lighter split-layout-right-content">
-          <AssetTree ref="assetTreeRef" :id="categoryLevelId" @handleNodeClick="handleNodeClick" />
+          <AssetTree
+            ref="assetTreeRef"
+            :id="categoryLevelId"
+            @handleNodeClick="handleNodeClick"
+          />
         </div>
         <!-- 表格 -->
         <template v-slot:content>
-          <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection"  row-key="id" height="calc(100vh - 350px)"
-            class="dict-table">
-
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            :selection.sync="selection"
+            row-key="id"
+            height="calc(100vh - 350px)"
+            class="dict-table"
+          >
           </ele-pro-table>
         </template>
       </ele-split-layout>
@@ -23,215 +45,201 @@
     </div>
   </el-dialog>
 </template>
-  
+
 <script>
-import AssetTree from '@/components/AssetTree';
-import ProductSearch from '@/views/technology/productParam/components/product-search.vue'
-import { getMaterialList } from '@/api/material/list.js';
-export default {
-  components: { AssetTree, ProductSearch },
-  data() {
-    return {
-      visible: false,
-
-      // 表格列配置
-      columns: [
-        {
-          columnKey: 'selection',
-          type: 'selection',
-          width: 45,
-          align: 'center',
-          selectable: (row, index) => {
-            return !this.processData.some((it) => it.id == row.id);
+  import AssetTree from '@/components/AssetTree';
+  import ProductSearch from '@/views/technology/productParam/components/product-search.vue';
+  import { getMaterialList } from '@/api/material/list.js';
+  export default {
+    components: { AssetTree, ProductSearch },
+    data() {
+      return {
+        visible: false,
+
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            selectable: (row, index) => {
+              return !this.processData?.some((it) => it.id == row.id);
+            },
+            reserveSelection: true,
+            fixed: 'left'
+          },
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            prop: 'code',
+            label: '编码'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号'
           },
-          reserveSelection: true,
-          fixed: 'left'
-        },
-        {
-          columnKey: 'index',
-          type: 'index',
-          width: 45,
-          align: 'center',
-          reserveSelection: true
-        },
-        {
-          prop: 'code',
-          label: '编码'
-        },
-        {
-          prop: 'name',
-          label: '名称',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'brandNum',
-          label: '牌号'
-        },
-
-        {
-          prop: 'modelType',
-          label: '型号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'specification',
-          label: '规格',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'measuringUnit',
-          label: '计量单位',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-        {
-          prop: 'weightUnit',
-          label: '重量单位',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-        {
-          prop: 'roughWeight',
-          label: '毛重',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-        {
-          prop: 'netWeight',
-          label: '净重',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-
-        {
-          prop: 'packingUnit',
-          align: 'center',
-          label: '包装单位',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'categoryLevelPath',
-          label: '分类',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-
-        {
-          action: 'action',
-          slot: 'action',
-          align: 'center',
-          label: '选择'
-        }
-      ],
 
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measuringUnit',
+            label: '计量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
 
-      // 表格选中数据
-      selection: [],
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
 
-      processData: [],
+          {
+            prop: 'roughWeight',
+            label: '毛重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
 
-      title: null,
-      categoryLevelId: null,
-      current: null,
+          {
+            prop: 'netWeight',
+            label: '净重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
 
-      isCategory: true
-    }
-  },
+          {
+            prop: 'packingUnit',
+            align: 'center',
+            label: '包装单位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryLevelPath',
+            label: '分类',
+            align: 'center',
+            showOverflowTooltip: true
+          },
 
-  watch: {
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择'
+          }
+        ],
 
-  },
-  methods: {
-    /* 表格数据源 */
-    datasource({ page, where, limit }) {
-      return getMaterialList({
-        ...where,
-        pageNum: page,
-        size: limit,
-        categoryLevelId: this.isCategory ? this.categoryLevelId : null,
+        // 表格选中数据
+        selection: [],
 
-      });
-    },
-    handleNodeClick(data) {
-      this.isCategory = true
-      this.categoryLevelId = data.id;
-      this.$refs.table.reload({ pageNum: 1, where: {} });
-      this.$refs.searchRef.reset2()
+        processData: [],
 
+        title: null,
+        categoryLevelId: null,
+        current: null,
 
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.isCategory = false
-      this.$refs.table.reload({ pageNum: 1, where: where });
-    },
-    open(item, title, categoryLevelId, current) {
-      this.processData = item
-      this.title = title
-      this.categoryLevelId = categoryLevelId
-      this.current = current
-      this.visible = true
+        isCategory: true
+      };
     },
 
-
-
-
-
-
-    handleClose() {
-      this.visible = false
-      this.$refs.table.setSelectedRows([]);
-      this.selection = []
-
-    },
-    selected() {
-      if (!this.selection.length) {
-        this.$message.error('请至少选择一条数据');
-        return;
+    watch: {},
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, where, limit }) {
+        return getMaterialList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.isCategory ? this.categoryLevelId : null
+        });
+      },
+      handleNodeClick(data) {
+        this.isCategory = true;
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1, where: {} });
+        this.$refs.searchRef.reset2();
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.isCategory = false;
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+      open(item, title, categoryLevelId, current) {
+        this.processData = item;
+        this.title = title;
+        this.categoryLevelId = categoryLevelId;
+        this.current = current;
+        this.visible = true;
+      },
+
+      handleClose() {
+        this.visible = false;
+        this.$refs.table.setSelectedRows([]);
+        this.selection = [];
+      },
+      selected() {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        console.log(this.current);
+        this.$emit('chooseProcess', this.selection, this.current);
+        this.handleClose();
       }
-      console.log(this.current)
-      this.$emit('chooseProcess', this.selection, this.current)
-      this.handleClose()
-    },
-  }
-}
+    }
+  };
 </script>
-  
+
 <style lang="scss" scoped>
-.tree_col {
-  border: 1px solid #eee;
-  padding: 10px 0;
-  box-sizing: border-box;
-  height: 500px;
-  overflow: auto;
-}
-
-.table_col {
-  padding-left: 10px;
-
-  ::v-deep .el-table th.el-table__cell {
-    background: #f2f2f2;
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
   }
-}
 
-.pagination {
-  text-align: right;
-  padding: 10px 0;
-}
+  .table_col {
+    padding-left: 10px;
 
-.btns {
-  text-align: center;
-  padding: 10px 0;
-}
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
 
-.topsearch {
-  margin-bottom: 15px;
-}
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
 </style>
-  

+ 246 - 234
src/components/select/bom/ProductModal.vue

@@ -1,22 +1,49 @@
 <template>
-  <el-dialog :title="title" :visible.sync="visible" v-if="visible" :before-close="handleClose"
-    :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="75%">
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    v-if="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="75%"
+  >
     <el-card shadow="never">
       <ProductSearch @search="reload" ref="searchRef" />
 
-      <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
+      <ele-split-layout
+        width="244px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
         <div class="ele-border-lighter split-layout-right-content">
-          <el-tree :data="treeList" :props="defaultProps" ref="treeRef"
-            :default-expanded-keys="current && current.id ? [current.id] : []" :highlight-current="true" node-key="id"
-            @node-click="handleNodeClick"></el-tree>
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            ref="treeRef"
+            :default-expanded-keys="current && current.id ? [current.id] : []"
+            :highlight-current="true"
+            node-key="id"
+            @node-click="handleNodeClick"
+          ></el-tree>
         </div>
         <!-- 表格 -->
         <template v-slot:content>
-          <ele-pro-table ref="table" :columns="columns" :datasource="datasource" row-key="id" height="calc(100vh - 350px)"
-            class="dict-table" @cell-click="cellClick">
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            row-key="id"
+            height="calc(100vh - 350px)"
+            class="dict-table"
+            @cell-click="cellClick"
+          >
             <!-- 表头工具栏 -->
             <template v-slot:action="{ row }">
-              <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
+              <el-radio class="radio" v-model="radio" :label="row.id"
+                ><i></i
+              ></el-radio>
             </template>
           </ele-pro-table>
         </template>
@@ -30,245 +57,230 @@
 </template>
 
 <script>
-
-import ProductSearch from './product-search.vue'
-import { getMaterialList } from '@/api/material/list.js';
-import { getTreeByGroup } from '@/api/classifyManage';
-export default {
-  components: { ProductSearch },
-  data() {
-    return {
-      visible: false,
-
-      // 表格列配置
-      columns: [
-        {
-          columnKey: 'index',
-          type: 'index',
-          width: 45,
-          align: 'center',
-          reserveSelection: true
-        },
-        {
-          prop: 'code',
-          label: '编码'
-        },
-        {
-          prop: 'name',
-          label: '名称',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'brandNum',
-          label: '牌号'
-        },
-
-        {
-          prop: 'modelType',
-          label: '型号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'specification',
-          label: '规格',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'measuringUnit',
-          label: '计量单位',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-        {
-          prop: 'weightUnit',
-          label: '重量单位',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-        {
-          prop: 'roughWeight',
-          label: '毛重',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-        {
-          prop: 'netWeight',
-          label: '净重',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
-
-
-        {
-          prop: 'packingUnit',
-          align: 'center',
-          label: '包装单位',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'categoryLevelPath',
-          label: '分类',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-
-        {
-          action: 'action',
-          slot: 'action',
-          align: 'center',
-          label: '选择'
+  import ProductSearch from './product-search.vue';
+  import { getMaterialList } from '@/api/material/list.js';
+  import { getTreeByGroup } from '@/api/classifyManage';
+  export default {
+    components: { ProductSearch },
+    data() {
+      return {
+        visible: false,
+
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            prop: 'code',
+            label: '编码'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measuringUnit',
+            label: '计量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'roughWeight',
+            label: '毛重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'netWeight',
+            label: '净重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'packingUnit',
+            align: 'center',
+            label: '包装单位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryLevelPath',
+            label: '分类',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择'
+          }
+        ],
+        title: null,
+        categoryLevelId: null,
+        radio: null,
+        idx: null,
+
+        isCategory: true,
+
+        current: {},
+
+        treeList: [],
+        treeLoading: false,
+
+        defaultProps: {
+          children: 'children',
+          label: 'name'
         }
-      ],
-      title: null,
-      categoryLevelId: null,
-      radio: null,
-      idx: null,
-
-      isCategory: true,
-
-      current: {},
-
-      treeList: [],
-      treeLoading: false,
-
-      defaultProps: {
-        children: 'children',
-        label: 'name'
-      }
-    }
-  },
-
-  watch: {
-
-  },
-  methods: {
-    /* 表格数据源 */
-    datasource({ page, where, limit }) {
-      return getMaterialList({
-        ...where,
-        pageNum: page,
-        size: limit,
-        categoryLevelId: this.isCategory ? this.categoryLevelId : null,
-
-      });
+      };
     },
-    handleNodeClick(data) {
-      this.isCategory = true
-      this.categoryLevelId = data.id;
-      this.$refs.table.reload({ pageNum: 1, where: {} });
-      this.$refs.searchRef.reset2()
 
-
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.isCategory = false
-      this.$refs.table.reload({ pageNum: 1, where: where });
-    },
-    open(item, title, type, idx) {
-      if (item) {
-        this.title = title
-        this.type = type
-        this.idx = idx
-
-        this.current = {
-          id: item.categoryId,
-          name: item.categoryName,
-          code: item.categoryCode
+    watch: {},
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, where, limit }) {
+        return getMaterialList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.isCategory ? this.categoryLevelId : null
+        });
+      },
+      handleNodeClick(data) {
+        this.isCategory = true;
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1, where: {} });
+        this.$refs.searchRef.reset2();
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.isCategory = false;
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+      open(item, title, type, idx) {
+        if (item) {
+          this.title = title;
+          this.type = type;
+          this.idx = idx;
+
+          this.current = {
+            id: item.categoryId,
+            name: item.categoryName,
+            code: item.categoryCode
+          };
+          this.radio = item.categoryId;
+
+          this.getTreeData();
         }
-        this.radio = item.categoryId
-
-        this.getTreeData();
-
-      }
-      this.visible = true
-    },
-
-
-    async getTreeData() {
-      try {
-        this.treeLoading = true;
-
-        const res = await getTreeByGroup({ type: this.type });
+        this.visible = true;
+      },
+
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+
+          const res = await getTreeByGroup({ type: this.type });
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.rootTreeId = this.treeList[0].id;
+                this.$nextTick(() => {
+                  this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
+                });
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {}
         this.treeLoading = false;
-        if (res?.code === '0') {
-          this.treeList = res.data;
-
-          this.$nextTick(() => {
-            // 默认高亮第一级树节点
-            if (this.treeList[0]) {
-              this.rootTreeId = this.treeList[0].id
-              this.$nextTick(() => {
-                this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
-              });
-
-            }
-          });
-          return this.treeList;
+      },
+
+      // 单击获取id
+      cellClick(row) {
+        this.current = row;
+        this.radio = row.id;
+      },
+      handleClose() {
+        this.visible = false;
+        this.current = null;
+        this.radio = '';
+      },
+      selected() {
+        if (!this.current) {
+          return this.$message.warning('请选择工作中心');
         }
-      } catch (error) { }
-      this.treeLoading = false;
-    },
-
-
-
-
-
-
-    // 单击获取id
-    cellClick(row) {
-      this.current = row
-      this.radio = row.id
-    },
-    handleClose() {
-      this.visible = false
-      this.current = null
-      this.radio = ''
-    },
-    selected() {
-      if (!this.current) {
-        return this.$message.warning('请选择工作中心')
+        this.$emit('changeProduct', this.title, this.current, this.idx);
+        this.handleClose();
       }
-      this.$emit('changeProduct', this.title, this.current, this.idx)
-      this.handleClose()
-    },
-  }
-}
+    }
+  };
 </script>
 
 <style lang="scss" scoped>
-.tree_col {
-  border: 1px solid #eee;
-  padding: 10px 0;
-  box-sizing: border-box;
-  height: 500px;
-  overflow: auto;
-}
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
 
-.table_col {
-  padding-left: 10px;
+  .table_col {
+    padding-left: 10px;
 
-  ::v-deep .el-table th.el-table__cell {
-    background: #f2f2f2;
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
   }
-}
 
-.pagination {
-  text-align: right;
-  padding: 10px 0;
-}
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
 
-.btns {
-  text-align: center;
-  padding: 10px 0;
-}
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
 
-.topsearch {
-  margin-bottom: 15px;
-}
+  .topsearch {
+    margin-bottom: 15px;
+  }
 </style>

+ 147 - 198
src/views/rulesManagement/releaseRules/components/ProductModal.vue

@@ -1,236 +1,185 @@
 <template>
-  <ele-modal
-    :title="title"
+  <el-dialog
+    title="选择产品"
     :visible.sync="visible"
     :before-close="handleClose"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
     append-to-body
-    width="70%"
-    :maxable="true"
+    width="80%"
   >
     <el-card shadow="never">
+      <ProductSearch @search="reload" />
       <ele-split-layout
-        width="236px"
+        width="244px"
         allow-collapse
         :right-style="{ overflow: 'hidden' }"
       >
-        <div>
-          <div class="ele-border-lighter split-layout-right-content">
-            <el-tree
-              :data="treeList"
-              :props="defaultProps"
-              ref="treeRef"
-              :default-expanded-keys="categoryId ? [categoryId] : []"
-              :highlight-current="true"
-              node-key="id"
-              @node-click="handleNodeClick"
-            ></el-tree>
-          </div>
+        <div class="ele-border-lighter split-layout-right-content">
+          <AssetTree
+            ref="assetTreeRef"
+            id="9"
+            @handleNodeClick="handleNodeClick"
+          />
         </div>
-
-        <!-- 数据表格 -->
+        <!-- 表格 -->
         <template v-slot:content>
-          <ProductSearch @search="reload" ref="searchRef" />
           <ele-pro-table
-            style="min-height: 400px"
             ref="table"
             :columns="columns"
             :datasource="datasource"
-            :selection.sync="selection"
-            row-key="id"
+            height="calc(100vh - 350px)"
+            class="dict-table"
+            @cell-click="cellClick"
           >
+            <!-- 表头工具栏 -->
+            <template v-slot:action="{ row }">
+              <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
+            </template>
           </ele-pro-table>
         </template>
       </ele-split-layout>
     </el-card>
-
-    <div class="rx-sc">
+    <div class="btns">
       <el-button type="primary" size="small" @click="selected">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
     </div>
-  </ele-modal>
+  </el-dialog>
 </template>
 
 <script>
-  import ProductSearch from './product-search.vue';
-  import { getMaterialList, getProduceTreeByPid } from '@/api/material/list';
-  export default {
-    components: {
-      ProductSearch
-    },
-    data() {
-      return {
-        visible: false,
-        title: '选择工具',
-
-        categoryLevelId: null,
-        categoryId: 1,
-        treeList: [],
-        treeLoading: false,
-
-        defaultProps: {
-          children: 'children',
-          label: 'name'
+ import AssetTree from '@/components/AssetTree';
+ import ProductSearch from './product-search.vue'
+ import { getList } from '@/api/classifyManage/itemInformation';
+export default {
+   components: { AssetTree, ProductSearch },
+  data () {
+    return {
+      visible: false,
+      // 表格列配置
+      columns: [
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 45,
+          align: 'center',
+          reserveSelection: true
         },
-        type: null,
-
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'selection',
-            type: 'selection',
-            width: 45,
-            align: 'center',
-            selectable: (row, index) => {
-              return !this.processData.some((it) => row.id == it.categoryId);
-            },
-            reserveSelection: true,
-            fixed: 'left'
-          },
-
-          {
-            label: '物料名称',
-            prop: 'name'
-          },
-
-          {
-            label: '物料编码',
-            prop: 'code'
-          },
-          {
-            label: '牌号',
-            prop: 'brandNum'
-          },
-          {
-            label: '型号',
-            prop: 'modelType'
-          },
-
-          {
-            prop: 'availableCountBase',
-            label: '包装库存',
-            sortable: 'custom'
-          },
-          {
-            label: '单位',
-            prop: 'weightUnit'
-          },
-
-          {
-            prop: 'packingCountBase',
-            label: '计量库存',
-            sortable: 'custom'
-          },
-
-          {
-            label: '计量单位',
-            prop: 'unit'
-          },
-
-          {
-            label: '数量',
-            prop: 'count'
-          }
-        ],
-
-        // 表格选中数据
-        selection: [],
-
-        processData: [],
-        current: null
-      };
+        {
+          prop: 'code',
+          label: '产品编码'
+        },
+        {
+          prop: 'name',
+          label: '产品名称',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'brandNum',
+          label: '牌号'
+        },
+        {
+          prop: 'modelType',
+          label: '型号'
+        },
+        {
+          prop: 'measuringUnit',
+          label: '计量单位'
+        },
+        {
+          prop: 'packingUnit',
+          label: '包装单位'
+        },
+        {
+          action: 'action',
+          slot: 'action',
+          align: 'center',
+          label: '选择'
+        }
+      ],
+      categoryLevelId: '9',
+      radio:null
+    }
+  },
+
+  watch: {
+
+  },
+  methods: {
+    /* 表格数据源 */
+    datasource ({ page, where, limit }) {
+      return getList({
+        ...where,
+        pageNum: page,
+        size: limit,
+        categoryLevelId: this.categoryLevelId,
+        isProduct:true
+      });
     },
-
-    watch: {},
-    methods: {
-      /* 表格数据源 */
-      async datasource({ page, limit, where }) {
-        const res = await getMaterialList({
-          ...where,
-          pageNum: page,
-          size: limit,
-          categoryLevelId: this.categoryLevelId
-        });
-        return res;
-      },
-
-      open(item) {
-        this.processData = item || [];
-        this.visible = true;
-
-        this.getTreeData();
-      },
-
-      async getTreeData() {
-        try {
-          this.treeLoading = true;
-
-          const res = await getProduceTreeByPid(5);
-          this.treeLoading = false;
-          if (res?.code === '0') {
-            this.treeList = res.data;
-
-            this.$nextTick(() => {
-              // 默认高亮第一级树节点
-              if (this.treeList[0]) {
-                this.rootTreeId = this.treeList[0].id;
-                this.$nextTick(() => {
-                  this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
-                });
-              }
-            });
-            return this.treeList;
-          }
-        } catch (error) {}
-        this.treeLoading = false;
-      },
-
-      handleNodeClick(data) {
-        this.categoryLevelId = data.id;
-        this.$refs.table.reload({ pageNum: 1, where: {} });
-      },
-
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where: where });
-      },
-
-      handleClose() {
-        this.visible = false;
-        this.$refs.table.setSelectedRows([]);
-        this.selection = [];
-      },
-      selected() {
-        let _arr = [];
-        if (!this.selection.length) {
-          this.$message.error('请至少选择一条数据');
-          return;
+    handleNodeClick (data) {
+      this.categoryLevelId = data.id;
+      this.reload();
+    },
+    /* 刷新表格 */
+    reload () {
+      this.$refs.table.reload();
+    },
+    open(item){
+      if(item){
+        this.current = {
+          id:item.categoryId,
+          name: item.categoryName,
+          code:item.categoryCode
         }
-
-        _arr = this.selection.map((m) => {
-          m.categoryId = m.id;
-          delete m.id;
-          return {
-            ...m
-          };
-        });
-
-        this.$emit('chooseModal', _arr);
-        this.handleClose();
+        this.radio = item.categoryId
       }
-    }
-  };
-</script>
+      this.visible = true
+    },
 
-<style lang="scss" scoped>
-  .rx-sc {
-    display: flex;
-    align-items: center;
-    justify-content: center;
+    // 单击获取id
+    cellClick (row) {
+        this.current = row
+        this.radio = row.id
+    },
+    handleClose () {
+      this.visible = false
+      this.current = null
+      this.radio = ''
+    },
+    selected(){
+       if(!this.current){
+         return this.$message.warning('请选择工作中心')
+       }
+       this.$emit('changeProduct',this.current)
+       this.handleClose()
+    },
   }
+}
+</script>
 
-  .ml60 {
-    margin-left: 60px;
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  height: 500px;
+  overflow: auto;
+}
+.table_col {
+  padding-left: 10px;
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
   }
+}
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+.topsearch{
+	margin-bottom:15px;
+}
 </style>

+ 1 - 1
src/views/rulesManagement/releaseRules/components/details.vue

@@ -281,7 +281,7 @@
 </template>
 
 <script>
-  import ProductModal from './ProductModal.vue';
+  import ProductModal from './toolModal.vue';
   export default {
     components: {
       ProductModal

+ 60 - 9
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -14,7 +14,7 @@
       :rules="formRules"
       ref="formRef"
     >
-      <el-row>
+      <el-row style="margin-bottom: 10px">
         <el-col :span="8">
           <el-form-item label="记录规则类型" prop="classify" required>
             <el-select
@@ -52,6 +52,8 @@
             ></el-input>
           </el-form-item>
         </el-col>
+      </el-row>
+      <el-row style="margin-bottom: 10px">
         <el-col :span="8">
           <el-form-item label="记录规则名称" prop="name">
             <el-input
@@ -101,6 +103,8 @@
             </el-input>
           </el-form-item>
         </el-col>
+      </el-row>
+      <el-row style="margin-bottom: 10px">
         <el-col :span="24">
           <el-form-item label="周期" prop="frequencyValue" required>
             <rule-cycle
@@ -151,7 +155,25 @@
 
         <template v-slot:paramValue="{ row }">
           <!-- 根据参数类型渲染不同的输入组件 -->
+          <el-link
+            v-if="formData.classify == '4'"
+            :underline="false"
+            style="cursor: pointer"
+          >
+            <div class="ele-cell">
+              <div @click="selectProduct(row)">
+                {{ row.productName ? row.productName : '请选择产品' }}
+              </div>
+              <i
+                v-if="row.tools.length == 0"
+                class="el-icon-arrow-down"
+                @click="selectProduct(row)"
+              ></i>
+              <i v-else class="el-icon-close" @click="clearProduct(row)"></i>
+            </div>
+          </el-link>
           <el-input
+            v-else
             v-model="row.paramValue"
             placeholder="请输入参数内容"
             size="mini"
@@ -228,7 +250,6 @@
         <template v-slot:toolName="{ row }">
           <el-link :underline="false" style="cursor: pointer">
             <div class="ele-cell">
-              <!-- class="ele-elip" style="width: 90px" -->
               <div @click="handleAdd(row)">
                 {{
                   row.tools && row.tools.length > 0
@@ -286,13 +307,18 @@
       <el-button :loading="btnLoading" @click="handleClose">取消</el-button>
     </template>
 
-    <ProductModal ref="productRefs" @chooseModal="chooseModal" />
+    <toolModal ref="toolModalRef" @chooseModal="chooseModal" />
 
     <MaterialAdd
       ref="deviceSelectDialog"
       selectType="single"
       @chooseEquipment="chooseEquipment"
     />
+
+    <ProductModal
+      ref="ProductModalRef"
+      @changeProduct="changeProduct"
+    ></ProductModal>
   </ele-modal>
 </template>
 
@@ -303,7 +329,7 @@
   import OperationGuideDialog from '@/views/rulesManagement/matterRules/components/operationGuideDialog.vue';
   import Details from './details.vue';
   import dictMixins from '@/mixins/dictMixins';
-  import ProductModal from './ProductModal.vue';
+  import toolModal from './toolModal.vue';
   import MaterialAdd from '../../components/MaterialAdd.vue';
   import {
     recordrulesSave,
@@ -314,6 +340,7 @@
     recordrulesUpdateVersion,
     recordrulesCyclePage
   } from '@/api/recordrules/index';
+  import ProductModal from './ProductModal.vue';
 
   export default {
     components: {
@@ -321,7 +348,8 @@
       RuleCycle,
       Details,
       ProductModal,
-      MaterialAdd
+      MaterialAdd,
+      toolModal
     },
     mixins: [dictMixins],
     computed: {
@@ -436,7 +464,9 @@
               remark: '',
               symbol: null,
               tools: [],
-              unitName: null
+              unitName: null,
+              productName: '',
+              productCode: ''
             }
           ],
           recordRulesCycleList: [],
@@ -567,7 +597,10 @@
               remark: '',
               symbol: null,
               toolCodes: null,
-              tools: []
+              tools: [],
+              unitName: null,
+              productName: '',
+              productCode: ''
             }
           ],
           recordRulesCycleList: [],
@@ -722,7 +755,9 @@
           remark: '',
           symbol: null,
           tools: [],
-          unitName: null
+          unitName: null,
+          productName: '',
+          productCode: ''
         });
       },
       deleteRow(row) {
@@ -733,7 +768,7 @@
       },
       handleAdd(row) {
         this.currentRow = row;
-        this.$refs.productRefs.open(row.toolCodes);
+        this.$refs.toolModalRef.open(row.toolCodes);
       },
       chooseModal(data) {
         console.log('data', data);
@@ -774,6 +809,22 @@
         this.$nextTick(() => {
           this.$refs.cycleMultipleRef.setRecordRulesCycleList(list);
         });
+      },
+      // 去选择产品
+      selectProduct(row) {
+        this.currentRow = row;
+        this.$refs.ProductModalRef.open();
+      },
+      // 选择产品
+      changeProduct(current) {
+        console.log('current', current);
+        this.currentRow.productName = current.name;
+        this.currentRow.productCode = current.code;
+      },
+      // 清空产品
+      clearProduct(row) {
+        row.productName = '';
+        row.productCode = '';
       }
     }
   };

+ 236 - 0
src/views/rulesManagement/releaseRules/components/toolModal.vue

@@ -0,0 +1,236 @@
+<template>
+  <ele-modal
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+    :maxable="true"
+  >
+    <el-card shadow="never">
+      <ele-split-layout
+        width="236px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div>
+          <div class="ele-border-lighter split-layout-right-content">
+            <el-tree
+              :data="treeList"
+              :props="defaultProps"
+              ref="treeRef"
+              :default-expanded-keys="categoryId ? [categoryId] : []"
+              :highlight-current="true"
+              node-key="id"
+              @node-click="handleNodeClick"
+            ></el-tree>
+          </div>
+        </div>
+
+        <!-- 数据表格 -->
+        <template v-slot:content>
+          <ProductSearch @search="reload" ref="searchRef" />
+          <ele-pro-table
+            style="min-height: 400px"
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            :selection.sync="selection"
+            row-key="id"
+          >
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+
+    <div class="rx-sc">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import ProductSearch from './product-search.vue';
+  import { getMaterialList, getProduceTreeByPid } from '@/api/material/list';
+  export default {
+    components: {
+      ProductSearch
+    },
+    data() {
+      return {
+        visible: false,
+        title: '选择工具',
+
+        categoryLevelId: null,
+        categoryId: 1,
+        treeList: [],
+        treeLoading: false,
+
+        defaultProps: {
+          children: 'children',
+          label: 'name'
+        },
+        type: null,
+
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            selectable: (row, index) => {
+              return !this.processData.some((it) => row.id == it.categoryId);
+            },
+            reserveSelection: true,
+            fixed: 'left'
+          },
+
+          {
+            label: '物料名称',
+            prop: 'name'
+          },
+
+          {
+            label: '物料编码',
+            prop: 'code'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum'
+          },
+          {
+            label: '型号',
+            prop: 'modelType'
+          },
+
+          {
+            prop: 'availableCountBase',
+            label: '包装库存',
+            sortable: 'custom'
+          },
+          {
+            label: '单位',
+            prop: 'weightUnit'
+          },
+
+          {
+            prop: 'packingCountBase',
+            label: '计量库存',
+            sortable: 'custom'
+          },
+
+          {
+            label: '计量单位',
+            prop: 'unit'
+          },
+
+          {
+            label: '数量',
+            prop: 'count'
+          }
+        ],
+
+        // 表格选中数据
+        selection: [],
+
+        processData: [],
+        current: null
+      };
+    },
+
+    watch: {},
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where }) {
+        const res = await getMaterialList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId
+        });
+        return res;
+      },
+
+      open(item) {
+        this.processData = item || [];
+        this.visible = true;
+
+        this.getTreeData();
+      },
+
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+
+          const res = await getProduceTreeByPid(5);
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.rootTreeId = this.treeList[0].id;
+                this.$nextTick(() => {
+                  this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
+                });
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {}
+        this.treeLoading = false;
+      },
+
+      handleNodeClick(data) {
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1, where: {} });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+
+      handleClose() {
+        this.visible = false;
+        this.$refs.table.setSelectedRows([]);
+        this.selection = [];
+      },
+      selected() {
+        let _arr = [];
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+
+        _arr = this.selection.map((m) => {
+          m.categoryId = m.id;
+          delete m.id;
+          return {
+            ...m
+          };
+        });
+
+        this.$emit('chooseModal', _arr);
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .rx-sc {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .ml60 {
+    margin-left: 60px;
+  }
+</style>

+ 10 - 3
src/views/rulesManagement/releaseRules/index.vue

@@ -2,7 +2,12 @@
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
       <search @search="reload" />
-      <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :cache-key="cacheKeyUrl"
+      >
         <template v-slot:toolbar>
           <el-button
             size="small"
@@ -234,14 +239,16 @@
             width: 230,
             align: 'center',
             resizable: false,
-            slot: 'action'
+            slot: 'action',
+            fixed: 'right'
           }
         ];
       }
     },
     data() {
       return {
-        loading: false
+        loading: false,
+        cacheKeyUrl: 'maindata-25922-recordrules-index'
       };
     },
     created() {

+ 3 - 3
vue.config.js

@@ -37,12 +37,12 @@ module.exports = {
         // target: 'http://192.168.1.176:18086',
 
         // target: 'http://192.168.1.251:18086',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
 
         // target: 'http://192.168.1.251:18087',
-
-        target: 'http://192.168.1.116:18086',
+        target: 'http://192.168.1.251:18086',
+        // target: 'http://192.168.1.116:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {