ysy 1 год назад
Родитель
Сommit
ef06208621

+ 0 - 238
src/views/material/BOMmanage/qualityTesting/inspectionClassify/components/user-list.vue

@@ -1,238 +0,0 @@
-<template>
-  <div>
-    <user-search @search="reload" ref="searchRef"> </user-search>
-    <!-- 数据表格 -->
-    <ele-pro-table
-      ref="table"
-      :columns="columns"
-      :datasource="datasource"
-      height="calc(100vh - 365px)"
-      full-height="calc(100vh - 116px)"
-      tool-class="ele-toolbar-form"
-      cache-key="inspectionClassify"
-      row-key="id"
-      :selection.sync="selection"
-        @selection-change="handleSelectionChange"
-    >
-      <!-- 表头工具栏 -->
-
-      <template v-slot:textType="{ row }">
-        {{
-          row.itemVO.textType == 1
-            ? '数值'
-            : row.itemVO.textType == 2
-            ? '选择'
-            : row.itemVO.textType == 3
-            ? '上下限'
-            : row.itemVO.textType == 4
-            ? '规格'
-            : row.itemVO.textType == 5
-            ? '时间'
-            : row.itemVO.textType == 6
-            ? '范围'
-            : ''
-        }}
-      </template>
-
-      <template v-slot:type="{ row }">
-        {{ getDictValue('质检标准类型', row.itemVO.qualityStandardType) }}
-      </template>
-
-
-      <template v-slot:defaultValue="{ row }">
-         <div>
-            <span v-if="row.itemVO.textType == 3">
-             [ {{ row.itemVO.minValue }}-{{ row.itemVO.maxValue }}]
-            </span>
-            <span v-else>{{ row.itemVO.defaultValue }}</span>
-
-            <span> {{ row.itemVO.unit }}</span>
-         </div>
-
-      </template>
-
-
-      
-
-
-      <template v-slot:toolList="{ row }">
-        <div
-          style="display: inline-block"
-          v-for="(item, idx) in row.itemVO.toolList"
-          :key="idx"
-          >{{ item.name }}
-          <span
-            v-if="row.itemVO.toolList && idx != row.itemVO.toolList.length - 1"
-            >,
-          </span></div
-        >
-      </template>
-
-
-    </ele-pro-table>
-  </div>
-</template>
-
-<script>
-  import userSearch from './user-search.vue';
-  import { getList } from '@/api/material/inspectionClassify';
-  import dictMixins from '@/mixins/dictMixins';
-
-  export default {
-    mixins: [dictMixins],
-    components: { userSearch },
-    props: {
-      // 类别id
-
-      rootId: [Number, String]
-    },
-    data() {
-      return {
-
-        selection: [],
-
-        columns: [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center',
-            reserveSelection: true
-          },
-
-          {
-            prop: 'itemVO.categoryLevelName',
-            label: '质检类型',
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            prop: 'itemVO.inspectionCode',
-            label: '参数编码',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            prop: 'itemVO.inspectionName',
-            label: '参数名称',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            prop: 'itemVO.textType',
-            label: '参数类型',
-            showOverflowTooltip: true,
-            align: 'center',
-            slot: 'textType',
-            minWidth: 110
-          },
-
-          {
-            prop: 'itemVO.defaultValue',
-            slot: 'defaultValue',
-            label: '工艺参数',
-            align: 'center',
-            minWidth: 150
-
-          },
-
-
-          {
-            label: '工艺要求',
-            prop: 'itemVO.inspectionStandard',
-            formatter: (row, column, cellValue) => {
-              return (
-                row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
-              );
-            },
-            minWidth: 150
-          },
-          {
-            label: '标准类型',
-            prop: 'itemVO.type',
-            slot: 'type'
-          },
-
-          {
-            prop: 'itemVO.qualityStandardName',
-            label: '标准名称',
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            label: '状态',
-            prop: 'status',
-            formatter: (row, column, cellValue) => {
-              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
-            }
-          },
-
-          {
-            prop: 'itemVO.toolList',
-            slot: 'toolList',
-            label: '设备名称',
-            align: 'center',
-            minWidth: 150
-          },
-
-          {
-            label: '备注',
-            prop: 'inspectionRemark'
-          },
- 
-        ]
-      };
-    },
-    created() {
-      this.requestDict('质检方式');
-      this.requestDict('质检标准类型');
-    },
-    methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
-        let _data = null;
-        _data = getList({
-          ...where,
-          pageNum: page,
-          size: limit,
-          categoryLevelId: this.categoryLevelId || 12,
-          rootCategoryLevelId: this.rootId
-        });
-
-        return _data;
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({
-          pageNum: 1,
-          where: where,
-          categoryLevelId: this.categoryLevelId,
-          rootCategoryLevelId: this.rootId
-        });
-      },
-
-      clickSearch(info) {
-        this.categoryLevelId = info.id;
-        this.rootCategoryLevelId = info.rootCategoryLevelId;
-        this.reload();
-      },
-
-
-      handleSelectionChange() {
-        let _arr = []
-        _arr = this.selection.map((m) => {
-          return {
-            ...m
-          }
-        })
-        this.$emit('selectChange', _arr)
- 
-      } 
-    }
-  };
-</script>

+ 54 - 56
src/views/material/BOMmanage/qualityTesting/inspectionClassify/components/user-search.vue

@@ -1,8 +1,12 @@
 <!-- 搜索表单 -->
 <template>
-  <el-form label-width="77px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
+  <el-form
+    label-width="77px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
     <el-row :gutter="15">
-
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="质检名称:">
           <el-input clearable v-model="where.name" placeholder="请输入" />
@@ -10,26 +14,32 @@
       </el-col>
 
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="状态:">
-
-          <el-select clearable  v-model="where.status" placeholder="请选择状态">
-            <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value">
-            </el-option>
-          </el-select>
-
-        </el-form-item>
-      </el-col>
-      <el-col v-bind="styleResponsive ?{ lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="组织机构:">
-          <auth-selection data-type="Array" v-model="where.deptIds" style="width: 100%"></auth-selection>
+          <auth-selection
+            data-type="Array"
+            v-model="where.deptIds"
+            style="width: 100%"
+          ></auth-selection>
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label-width="50px">
-          <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search" size="small">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+            size="small"
+          >
             查询
           </el-button>
-          <el-button @click="reset" icon="el-icon-refresh-left" size="small" type="primary">重置</el-button>
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh-left"
+            size="small"
+            type="primary"
+            >重置</el-button
+          >
         </el-form-item>
       </el-col>
     </el-row>
@@ -37,48 +47,36 @@
 </template>
 
 <script>
-export default {
-  data() {
-    // 默认表单数据
-    const defaultWhere = {
-      name: '',
-      status: ''
-    };
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        status: 1
+      };
 
-
-    return {
-      // 表单数据
-      where: { ...defaultWhere },
-
-      statusList: [
-        {
-          value: 0,
-          label: '停用'
-        },
-        {
-          value: 1,
-          label: '启用'
-        }
-      ]
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  methods: {
-    /* 搜索 */
-    search() {
-      console.log(this.where);
-      this.$emit('search', this.where);
+      return {
+        // 表单数据
+        where: { ...defaultWhere }
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
     },
-    /*  重置 */
-    reset() {
-      this.where = { ...this.defaultWhere };
-      this.search();
+    methods: {
+      /* 搜索 */
+      search() {
+        console.log(this.where);
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
     }
-  }
-};
+  };
 </script>

+ 203 - 21
src/views/material/BOMmanage/qualityTesting/inspectionClassify/index.vue

@@ -26,13 +26,72 @@
             </div>
           </div>
           <template v-slot:content>
-            <user-list
-              v-if="current"
-              :category-id="current.id"
-              @selectChange="selectChange"
-              :root-id="rootId"
-              ref="searchRef"
-            />
+            <user-search @search="reload" ref="searchRef"> </user-search>
+            <!-- 数据表格 -->
+            <ele-pro-table
+              ref="table"
+              :columns="columns"
+              :datasource="datasource"
+              height="calc(100vh - 365px)"
+              full-height="calc(100vh - 116px)"
+              tool-class="ele-toolbar-form"
+              cache-key="inspectionClassify"
+              row-key="id"
+              :selection.sync="selection"
+            >
+              <!-- 表头工具栏 -->
+
+              <template v-slot:textType="{ row }">
+                {{
+                  row.itemVO.textType == 1
+                    ? '数值'
+                    : row.itemVO.textType == 2
+                    ? '选择'
+                    : row.itemVO.textType == 3
+                    ? '上下限'
+                    : row.itemVO.textType == 4
+                    ? '规格'
+                    : row.itemVO.textType == 5
+                    ? '时间'
+                    : row.itemVO.textType == 6
+                    ? '范围'
+                    : ''
+                }}
+              </template>
+
+              <template v-slot:type="{ row }">
+                {{
+                  getDictValue('质检标准类型', row.itemVO.qualityStandardType)
+                }}
+              </template>
+
+              <template v-slot:defaultValue="{ row }">
+                <div>
+                  <span v-if="row.itemVO.textType == 3">
+                    [ {{ row.itemVO.minValue }}-{{ row.itemVO.maxValue }}]
+                  </span>
+                  <span v-else>{{ row.itemVO.defaultValue }}</span>
+
+                  <span> {{ row.itemVO.unit }}</span>
+                </div>
+              </template>
+
+              <template v-slot:toolList="{ row }">
+                <div
+                  style="display: inline-block"
+                  v-for="(item, idx) in row.itemVO.toolList"
+                  :key="idx"
+                  >{{ item.name }}
+                  <span
+                    v-if="
+                      row.itemVO.toolList &&
+                      idx != row.itemVO.toolList.length - 1
+                    "
+                    >,
+                  </span></div
+                >
+              </template>
+            </ele-pro-table>
           </template>
         </ele-split-layout>
       </el-card>
@@ -47,13 +106,15 @@
 
 <script>
   import AssetTree from '@/components/AssetTree';
-  import userList from './components/user-list.vue';
-  import { EventBus } from '@/utils/eventBus';
+  import userSearch from './components/user-search.vue';
+  import { getList } from '@/api/material/inspectionClassify';
+  import dictMixins from '@/mixins/dictMixins';
 
   export default {
+    mixins: [dictMixins],
     components: {
       AssetTree,
-      userList
+      userSearch
     },
     data() {
       return {
@@ -65,23 +126,143 @@
         rootId: '12',
         visible: false,
 
-        selectList: []
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true
+          },
+
+          {
+            prop: 'itemVO.categoryLevelName',
+            label: '质检类型',
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'itemVO.inspectionCode',
+            label: '参数编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'itemVO.inspectionName',
+            label: '参数名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'itemVO.textType',
+            label: '参数类型',
+            showOverflowTooltip: true,
+            align: 'center',
+            slot: 'textType',
+            minWidth: 110
+          },
+
+          {
+            prop: 'itemVO.defaultValue',
+            slot: 'defaultValue',
+            label: '工艺参数',
+            align: 'center',
+            minWidth: 150
+          },
+
+          {
+            label: '工艺要求',
+            prop: 'itemVO.inspectionStandard',
+            formatter: (row, column, cellValue) => {
+              return (
+                row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
+              );
+            },
+            minWidth: 150
+          },
+          {
+            label: '标准类型',
+            prop: 'itemVO.type',
+            slot: 'type'
+          },
+
+          {
+            prop: 'itemVO.qualityStandardName',
+            label: '标准名称',
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            label: '状态',
+            prop: 'status',
+            formatter: (row, column, cellValue) => {
+              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
+            }
+          },
+
+          {
+            prop: 'itemVO.toolList',
+            slot: 'toolList',
+            label: '设备名称',
+            align: 'center',
+            minWidth: 150
+          },
+
+          {
+            label: '备注',
+            prop: 'inspectionRemark'
+          }
+        ]
       };
     },
 
     created() {
-      EventBus.$on('inspectionSelection', (data) => {
-        this.handleClose();
-      });
+      this.requestDict('质检方式');
+      this.requestDict('质检标准类型');
     },
     methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        let _data = null;
+        _data = getList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId || 12,
+          rootCategoryLevelId: this.rootId
+        });
+
+        return _data;
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({
+          pageNum: 1,
+          where: where,
+          categoryLevelId: this.categoryLevelId,
+          rootCategoryLevelId: this.rootId
+        });
+      },
+
       handleNodeClick(info) {
         this.current = info;
         this.$nextTick(() => {
           console.log(info);
-          this.$refs.searchRef.clickSearch(info);
+          this.clickSearch(info);
         });
       },
+
+      clickSearch(info) {
+        this.categoryLevelId = info.id;
+        this.rootCategoryLevelId = info.rootCategoryLevelId;
+        this.reload();
+      },
+
       // 获取根节点id
       setRootId(id) {
         if (id) {
@@ -94,16 +275,17 @@
       },
 
       handleClose() {
-        this.selectList = [];
         this.visible = false;
       },
 
-      selectChange(list) {
-        this.selectList = list;
-      },
-
       handleSave() {
-        console.log(this.selectList, 666);
+        let _arr = [];
+        _arr = this.selection.map((m) => {
+          return {
+            ...m
+          };
+        });
+        this.$emit('selectChange', _arr);
       }
     }
   };