ysy vor 2 Jahren
Ursprung
Commit
ba1e9ac88d

+ 3 - 1
src/enum/dict.js

@@ -6,6 +6,7 @@ export default {
   流程分类: 'processCategory',
   角度: 'angle',
   质检标准类型: 'quality_testing_code',
+  质检方式: 'quality_method_code'
 
 };
 
@@ -14,5 +15,6 @@ export const numberList = [
   'patrol_cycle',
   'order_library',
   'order_type',
-   'quality_testing_code'
+   'quality_testing_code',
+   'quality_method_code'
 ];

+ 66 - 0
src/views/inspectionClassify/components/user-edit-search.vue

@@ -0,0 +1,66 @@
+<!-- 搜索表单 -->
+<template>
+  <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.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="状态:">
+          <el-select v-model="where.status" class="m-2" placeholder="请选择" size="large">
+            <el-option label="停用" :value="0" />
+            <el-option label="启用" :value="1" />
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <div class="ele-form-actions">
+          <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search">
+            查询
+          </el-button>
+          <el-button @click="reset">重置</el-button>
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+export default {
+  data() {
+    // 默认表单数据
+    const defaultWhere = {
+
+      name: '',
+      status: ''
+    };
+    return {
+      defaultWhere,
+      // 表单数据
+      where: { ...defaultWhere },
+
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  methods: {
+    /* 搜索 */
+    search() {
+      this.$emit('search', this.where);
+    },
+    /*  重置 */
+    reset() {
+
+      this.where = { ...this.defaultWhere };
+      this.search();
+    }
+  }
+};
+</script>

+ 132 - 161
src/views/inspectionClassify/components/user-edit.vue

@@ -1,207 +1,178 @@
-<!-- 用户编辑弹窗 -->
 <template>
-  <ele-modal width="60%" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
-    custom-class="ele-dialog-form" :title="isUpdate ? '修改质检' : '新增质检'" @update:visible="updateVisible">
-    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+  <el-dialog :title="title" v-if="visible" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+    :close-on-press-escape="false" append-to-body width="70%">
 
-      <el-row>
-        <el-col :span="12">
-          <el-form-item label="质检类型:" prop="categoryLevelName">
-            <el-input v-model="form.categoryLevelName" @click.native="openCategory" readonly />
-          </el-form-item>
-        </el-col>
+    <el-card shadow="never">
+      <userEditSearch @search="reload" />
 
-        <el-col :span="12">
-          <el-form-item label="质检名称:" prop="name">
-            <el-input clearable v-model="form.name" placeholder="请输入质检名称" />
-          </el-form-item>
-        </el-col>
+      <!-- 数据表格 -->
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
+        <template v-slot:status="{ row }">
+          {{ row.status ? '启用' : "停用" }}
+        </template>
 
+        <template v-slot:type="{ row }">
+          {{ getDictValue('质检标准类型', row.type) }}
+        </template>
 
+      </ele-pro-table>
 
 
+    </el-card>
 
-        <el-col :span="12">
-          <el-form-item label="工序:" prop="specification">
-            <el-input clearable v-model="form.specification" />
-          </el-form-item>
-        </el-col>
-
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
 
+<script>
 
 
-        <el-col :span="12">
-          <el-form-item label="产品类型:"></el-form-item>
-        </el-col>
+import { getList } from '@/api/inspectionStandard';
+import userEditSearch from './user-edit-search.vue'
+import dictMixins from '@/mixins/dictMixins';
+export default {
+  components: {
+    userEditSearch
+  },
+  mixins: [dictMixins],
 
-        <el-col :span="12">
-          <el-form-item label="产品类型编码:" prop="code">
-            <el-input clearable v-model="form.code"></el-input>
-          </el-form-item>
-        </el-col>
+  data() {
+    return {
+      visible: false,
+      title: '选择工序',
 
-        <el-col :span="12">
-          <el-form-item label="状态:" prop="status">
-            <el-switch v-model="form.status" active-color="#13ce66" inactive-color="#ff4949" :active-value="1"
-              :inactive-value="0">
-            </el-switch>
-          </el-form-item>
-        </el-col>
+      // 表格列配置
+      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'
+        },
+        {
+          prop: 'code',
+          label: '质检编码'
+        },
+        {
+          label: '质检名称',
+          prop: 'name'
+        },
 
-        
-        <el-col :span="12">
-          <el-form-item label="备注:" prop="remark">
-            <el-input clearable v-model="form.remark"></el-input>
-          </el-form-item>
-        </el-col>
+        {
+          label: '状态',
+          prop: 'status',
+          slot: 'status'
+        },
 
+        {
+          label: '版本号',
+          prop: 'version',
+        },
 
+        {
+          label: '标准类型',
+          prop: 'type',
+          slot: 'type',
+        },
 
 
-      </el-row>
-    </el-form>
-    <template v-slot:footer>
-      <el-button @click="updateVisible(false)">取消</el-button>
-      <el-button type="primary" :loading="loading" @click="save">
-        保存
-      </el-button>
-    </template>
 
+        {
+          label: '标准代码',
+          prop: 'standardCode',
 
-    <CategoryDialog ref="categoryRefs" @chooseCategory="changeCategory"></CategoryDialog>
-  </ele-modal>
-</template>
+        },
 
-<script>
 
 
 
 
+      ],
 
-import { save, update } from '@/api/inspectionClassify/index';
+      // 表格选中数据
+      selection: [],
 
-export default {
-  components: {
+      processData: [],
+      categoryId: null
 
-  },
-  props: {
-    // 弹窗是否打开
-    visible: Boolean,
-    // 修改回显的数据
-    data: Object,
-    rootId: [Number, String],
-  },
-  data() {
-    const defaultForm = {
-      code: '',
-      name: '',
-      categoryLevelName: '',
-      categoryLevelId: '',
-      status: '',
-      region: '',
-      specification: ''
-    };
-    return {
-      defaultForm,
-      // 表单数据
-      form: { ...defaultForm },
-      // 表单验证规则
-      rules: {
-        name: [
-          { required: true, message: '请输入干燥区名称', trigger: 'blur' }
-        ],
-        categoryLevelName: [
-          { required: true, message: '请选择分类', trigger: 'change' }
-        ],
-
-        status: [
-          { required: true, message: '请选择状态', trigger: 'change' }
-        ],
-
-
-        region: [
-          { required: true, message: '请输入位置', trigger: 'blur' }
-        ],
-
-
-      },
-      // 提交状态
-      loading: false,
-      // 是否是修改
-      isUpdate: false
-    };
+    }
   },
 
+  watch: {
 
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
   },
   methods: {
-    /* 保存编辑 */
-    save() {
-      this.$refs.form.validate((valid) => {
-        if (!valid) {
-          return false;
-        }
-        this.loading = true;
-        if (!this.isUpdate) {
-          delete this.form.id;
-        }
-        const data = {
-          ...this.form
-        };
-        const saveOrUpdate = this.isUpdate ? update : save;
-        saveOrUpdate(data)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            this.updateVisible(false);
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-
-          });
-      });
+
+
+
+
+    open(categoryId) {
+      this.categoryId = categoryId
+      this.visible = true
     },
-    /* 更新visible */
-    updateVisible(value) {
-      this.$emit('update:visible', value);
+
+    /* 表格数据源 */
+    async datasource({ page, limit, where }) {
+      const res = await getList({
+        ...where,
+        categoryId: this.categoryId,
+        pageNum: page,
+        size: limit
+
+      });
+      return res;
     },
 
-    openCategory() {
-      this.$refs.categoryRefs.open(this.rootId, '选择分类')
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where: where });
     },
 
 
-    changeCategory(row) {
-      this.$set(this.form, 'categoryLevelName', row.name)
-      this.$set(this.form, 'categoryLevelId', row.id)
-    },
 
+    handleClose() {
+      this.visible = false
+      this.$refs.table.setSelectedRows([]);
+      this.selection = []
 
+    },
+    selected() {
+      if (!this.selection.length) {
+        this.$message.error('请至少选择一条数据');
+        return;
+      }
+      let _arr = []
+      _arr = this.selection.map(m => {
 
-  },
-  watch: {
-    visible(visible) {
-      if (visible) {
-        if (this.data) {
-          this.$util.assignObject(this.form, {
-            ...this.data,
-          });
-          this.isUpdate = true;
-        } else {
-          this.isUpdate = false;
+        return {
+          name: m.name,
+          code: m.code,
+          qualityStandardId: m.id,
+          status: true,
+          mode: null,
+          version: null
 
         }
-      } else {
-        this.$refs.form.clearValidate();
-        this.form = { ...this.defaultForm };
-      }
-    }
+      })
+
+      this.$emit('chooseProcess', _arr)
+      this.handleClose()
+    },
   }
-};
+}
 </script>
+
+<style lang="scss" scoped>
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+</style>

+ 41 - 28
src/views/inspectionClassify/components/user-list.vue

@@ -21,8 +21,20 @@
       </template>
 
 
+      <template v-slot:mode="{ row }">
+        <DictSelection dictName="质检方式" v-model="row.mode"></DictSelection>
+      </template>
+
+
+
+      <template v-slot:version="{ row }">
+        <el-input v-model="row.version"></el-input>
+      </template>
+
+
+
       <template v-slot:action="{ row }">
-        <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit(row)">
+        <el-link type="primary" :underline="false" icon="el-icon-edit">
           编辑
         </el-link>
         <el-popconfirm class="ele-action" title="确定要删除此干燥区吗?" @confirm="remove(row)">
@@ -37,7 +49,7 @@
 
     </ele-pro-table>
 
-    <user-edit :visible.sync="showEdit" :rootId="rootId" :data="current" @done="reload" ref="userEdit" />
+    <user-edit @chooseProcess="chooseProcess" ref="userEdit" />
 
   </div>
 </template>
@@ -60,8 +72,7 @@ export default {
     return {
       // 当前编辑数据
       current: null,
-      // 是否显示编辑弹窗
-      showEdit: false,
+
 
 
       // 表格列配置
@@ -72,47 +83,47 @@ export default {
           label: '序号',
           width: 55,
           align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
         },
 
         {
           prop: 'name',
-          label: '质检名称',
+          label: '质检标准名称',
           showOverflowTooltip: true,
           minWidth: 110
         },
 
         {
-          prop: 'specification',
-          label: '工序',
+          prop: 'code',
+          label: '质检标准编码',
           showOverflowTooltip: true,
           minWidth: 110
         },
 
 
         {
-          prop: 'region',
-          label: '产品类型',
-          showOverflowTooltip: true,
-          minWidth: 110
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          minWidth: 110,
+          slot: 'status',
         },
 
+
+
         {
-          prop: 'code',
-          label: '产品类型编码',
-          showOverflowTooltip: true,
-          minWidth: 110
+          prop: 'mode',
+          label: '类型',
+          align: 'center',
+          minWidth: 110,
+          slot: 'mode',
         },
 
         {
-          prop: 'status',
-          label: '状态',
+          prop: 'version',
+          label: '版本号',
           align: 'center',
-          width: 80,
-          resizable: false,
-          slot: 'status',
-          showOverflowTooltip: true
+          minWidth: 110,
+          slot: 'version',
         },
 
         {
@@ -147,11 +158,13 @@ export default {
     },
 
     /* 打开编辑弹窗 */
-    openEdit(row) {
-      this.current = row;
-      this.showEdit = true;
-      this.$refs.userEdit.$refs.form &&
-        this.$refs.userEdit.$refs.form.clearValidate();
+    openEdit() {
+      this.$refs.userEdit.open(this.categoryId);
+    },
+
+    chooseProcess(data) {
+      console.log(data)
+      this.$refs.table.setData(data);
     },
 
 

+ 1 - 1
src/views/inspectionClassify/index.vue

@@ -31,7 +31,7 @@ export default {
       // 表格选中数据
       selection: [],
       current: null,
-      rootId: 12
+      rootId: '12'
     };
   },
   computed: {},

+ 2 - 0
src/views/inspectionStandard/components/edit.vue

@@ -198,6 +198,8 @@ export default {
     getDetail(id) {
       getById(id).then(res => {
         this.form = res.data
+        this.form.postscriptRemoveIds = []
+        this.form.toolRemoveIds = []
       })
     },