Browse Source

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-qms

lucw 10 months ago
parent
commit
6e524733fe

+ 6 - 2
src/components/addDoc/api/index.js

@@ -116,8 +116,12 @@ export async function uploadFileNew(data) {
   return Promise.reject(new Error(res.data.message));
 }
 // 编码方案
-export async function listCode() {
-  const res = await request.get(`/main/business_code_category/listCode/WD0001`);
+export async function listCode(data = {}) {
+  const res = await request.get(
+    `/main/business_code_category/listCode/${data.id || '0'}` +
+      '?parentId=' +
+      (data.parentId || '')
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 15 - 2
src/components/addDoc/browse.vue

@@ -34,7 +34,6 @@
         this.setFileUrl(row);
       },
       setFileUrl(row) {
-        console.log(row);
         let file = row.storagePath[0];
         let fileNames = file.storePath.split('/');
         let url =
@@ -44,7 +43,21 @@
           '&fullfilename=' +
           fileNames[fileNames.length - 1];
         this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
-        this.visible = true;
+
+        // const fileExt = file.name.substr(file.name.lastIndexOf('.') + 1);
+        // this.fileType = getFileType().includes(fileExt) ? 2 : 1;
+        // if (this.fileType == 2) {
+        //   this.fileUrl =
+        //     '/fm/' +
+        //     (['dxf', 'dwg'].includes(fileExt) ? '2DViewer' : '3DViewer') +
+        //     '/view.html?url=' +
+        //     sessionStorage.filePath +
+        //     '/' +
+        //     row.outputNdsFiles;
+        // } else {
+        //   this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
+        //   // 'http://192.168.1.107:18082/kkfile/onlinePreview?url=' + btoa(url);
+        // }
       }
     }
   };

+ 7 - 3
src/components/addDoc/doc_template.vue

@@ -11,7 +11,11 @@
           <ele-toolbar class="ele-toolbar-actions">
             <div style="margin: 5px 0"> </div>
           </ele-toolbar>
-          <div class="ele-border-lighter sys-organization-list">
+
+          <div
+            class="ele-border-lighter sys-organization-list"
+            style="height: 65vh"
+          >
             <el-tree
               ref="tree"
               :data="data"
@@ -23,7 +27,7 @@
               :default-expand-all="true"
               @node-click="onNodeClick"
             >
-              <span class="custom-tree-node" slot-scope="{ node }">
+              <span class="custom-tree-node" slot-scope="{ node, data }">
                 <ElementTreeLine
                   :node="node"
                   :showLabelLine="true"
@@ -74,7 +78,7 @@
       };
     },
     props: {
-      lcyStatus: null, //1:文档工作区 2:文档归档区 3:文档发布区 4:文档废止区
+      lcyStatus: '', //1:文档工作区 2:文档归档区 3:文档发布区 4:文档废止区
 
       disabledTableList: {
         //已选择列表

+ 213 - 147
src/components/addDoc/file-edit.vue

@@ -9,9 +9,38 @@
     @close="cancel"
     :title="title"
     ref="Emodal"
+    :maxable="true"
+    :resizable="true"
   >
+    <el-tabs
+      v-model="activeName"
+      type="card"
+      @tab-click="handleClick"
+      style="margin-bottom: 10px"
+    >
+      <el-tab-pane label="文档工作区" name="1"></el-tab-pane>
+      <el-tab-pane label="个人文档" name="2"></el-tab-pane>
+    </el-tabs>
     <el-form ref="form" :model="form" :rules="rules" label-width="82px">
       <el-row :gutter="15">
+        <el-col :span="24">
+          <el-form-item label="文档位置" prop="directoryId">
+            <el-cascader
+              style="width: 100%"
+              v-model="form.directoryId"
+              :options="folderList"
+              @change="initFileCode"
+              ref="cascaderRef"
+              :props="{
+                value: 'id',
+                label: 'name',
+                children: 'sonDirectoryList',
+                emitPath: false,
+                checkStrictly: true
+              }"
+            ></el-cascader>
+          </el-form-item>
+        </el-col>
         <el-col :span="24">
           <el-form-item label="编码分类" prop="codeType">
             <ele-tree-select
@@ -63,27 +92,11 @@
                 :multiple="true"
                 @fileChange="fileChange"
               >
-
               </fileUpload>
             </div>
           </el-form-item>
         </el-col>
-        <el-col :span="24">
-          <el-form-item label="文档位置" prop="directoryId">
-            <el-cascader
-              style="width: 100%"
-              v-model="form.directoryId"
-              :options="folderList"
-              :props="{
-                value: 'id',
-                label: 'name',
-                children: 'sonDirectoryList',
-                emitPath: false,
-                checkStrictly: true
-              }"
-            ></el-cascader>
-          </el-form-item>
-        </el-col>
+
         <el-col :span="24">
           <el-form-item label="备注" prop="remark">
             <el-input
@@ -105,159 +118,212 @@
 </template>
 
 <script>
-import { fileSaveAPI,selectTreeList, listParentId,getDocTreeListAPI,listCode} from './api/index';
-import FileUpload from './fileUpload.vue';
-import { setFolderList } from './util.js';
-import { mapGetters } from 'vuex';
-export default {
-  components: { FileUpload },
+  import {
+    fileSaveAPI,
+    selectTreeList,
+    listParentId,
+    getDocTreeListAPI,
+    listCode
+  } from './api/index';
+  import FileUpload from './fileUpload.vue';
+  import { setFolderList } from './util.js';
+  import { mapGetters } from 'vuex';
+  export default {
+    components: { FileUpload },
 
-  data() {
-    const defaultForm = {
-      name: '', //名称
-      type: '', //类型
-      sizeUnit: '', //大小,
-      unit: '', //单位
-      remark: '', //备注
-      status: '', //状态
-      storagePathId: '',
-      directoryId: '',
-      businessCodeId: '',
-      storagePath: [],
-      id: '',
-      lcyStatus: 1,
-      fileType:0
-    };
-    return {
-      rules: {
-        businessCodeId: [
-          { required: true, message: '请选择', trigger: 'blur' }
-        ],
-        // codeType: [{ required: true, message: '请选择', trigger: 'blur' }],
-        directoryId: [{ required: true, message: '请选择', trigger: 'blur' }],
-        storagePath: [{ required: true, message: '请选择', trigger: 'blur' }]
-      },
-      templateVisible: false,
-      folderList: [],
-      list: [],
-      options: [],
-      defaultForm,
-      code: '',
-      // 表单数据
-      form: { ...defaultForm },
+    data() {
+      const defaultForm = {
+        name: '', //名称
+        type: '1', //类型
+        sizeUnit: '', //大小,
+        unit: '', //单位
+        remark: '', //备注
+        status: '', //状态
+        storagePathId: '',
+        directoryId: '',
+        businessCodeId: '',
+        storagePath: [],
+        id: '',
+        lcyStatus: 1,
+        fileType: 0
+      };
+      return {
+        activeName: '1',
+        rules: {
+          businessCodeId: [
+            { required: true, message: '请选择', trigger: 'blur' }
+          ],
+          // codeType: [{ required: true, message: '请选择', trigger: 'blur' }],
+          directoryId: [{ required: true, message: '请选择', trigger: 'blur' }],
+          storagePath: [{ required: true, message: '请选择', trigger: 'blur' }]
+        },
+        templateVisible: false,
+        folderList: [],
+        allFolderList: [],
+        myFolderList: [],
+        list: [],
+        options: [],
+        defaultForm,
+        code: '',
+        // 表单数据
+        form: { ...defaultForm },
 
-      // 提交状态
-      loading: false,
-      showEditFlag: false,
-      title: '',
-      type: '新建附件'
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
+        // 提交状态
+        loading: false,
+        showEditFlag: false,
+        title: '',
+        type: '新建附件',
+        nodeData: {}
+      };
     },
-    ...mapGetters(['user'])
-  },
-  async created() {
-    let query = {
-      type: 0,
-      currentUserId: this.user.info.userId
-    };
-    this.folderList = await getDocTreeListAPI(query);
-    setFolderList(this.folderList); //权限过滤
-  },
-  methods: {
-    async open() {
-    
-      this.showEditFlag = true;
-      this.list = await selectTreeList();
-      this.options= await listCode();
-      if(this.options.length>0){
-        this.form.businessCodeId=this.options[0].id
-      }
-      this.setTree(this.list);
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
+      ...mapGetters(['user'])
     },
-    setTree(data) {
-      data.forEach((item) => {
-        item.sonDirectoryList = item.sonDirectoryList.filter(
-          (item) => item.type == 1
-        );
-        if (item.sonDirectoryList.length > 0) {
-          this.setTree(item.sonDirectoryList);
-        }
+    async created() {
+      this.allFolderList = await getDocTreeListAPI({
+        type: 0,
+        currentUserId: this.user.info.userId
       });
-    },
-    async typeChange(val) {
-      let data = await listParentId({
-        pageNum: 1,
-        size: 100,
-        parentId: val
+      this.myFolderList = await getDocTreeListAPI({
+        type: 1,
+        currentUserId: this.user.info.userId
       });
-      this.options = data.list.filter((item) => item.type == 2);
-      this.form.businessCodeId = '';
-    },
-
-    fileChange(file) {
-      this.form.name = file.name.replace(/\.[^/.]+$/, '');
+      this.folderList = this.allFolderList;
+      setFolderList(this.folderList); //权限过滤
     },
-
-    /* 保存编辑 */
-    save() {
-      this.$refs.form.validate(async (valid) => {
-        if (!valid) {
-          return false;
+    methods: {
+      handleClick() {
+        this.form.directoryId = '';
+        this.form.businessCodeId = '';
+        this.form.codeType = '';
+        if (this.activeName == 2) {
+          this.folderList = this.myFolderList;
+        } else {
+          this.folderList = this.allFolderList;
+        }
+      },
+      async getTreeCode() {
+        let nodeData = {};
+        await this.$nextTick(() => {
+          // console.log(this.$refs,'this.$refs')
+          nodeData =
+            this.$refs.cascaderRef && this.$refs.cascaderRef.getCheckedNodes();
+        });
+        this.nodeData = {
+          id: nodeData[0]?.data?.id,
+          parentId:
+            nodeData[0]?.data?.parentId != 0 ? nodeData[0]?.data?.parentId : ''
+        };
+      },
+      async initFileCode() {
+        await this.getTreeCode();
+        this.options = this.nodeData.id ? await listCode(this.nodeData) : [];
+        if (this.options.length > 0) {
+          this.form.businessCodeId = this.options[0].id;
+          this.form.codeType = this.options[0].parentId;
+        } else {
+          this.form.businessCodeId = '';
         }
+      },
+      async open() {
+        this.showEditFlag = true;
+        this.$nextTick(async () => {
+          this.list = await selectTreeList();
+          await this.initFileCode();
+          this.setTree(this.list);
+        });
+      },
 
-        const data = {
-          ...this.form,
+      setTree(data) {
+        data.forEach((item) => {
+          item.sonDirectoryList = item.sonDirectoryList.filter(
+            (item) => item.type == 1
+          );
+          if (item.sonDirectoryList.length > 0) {
+            this.setTree(item.sonDirectoryList);
+          }
+        });
+      },
+      async typeChange(val) {
+        let obj = {
+          pageNum: 1,
+          size: 100,
+          parentId: val
         };
+        if (this.activeName == 1) {
+          obj['objId'] = this.nodeData?.id;
+          obj['objParentId'] = this.nodeData?.parentId;
+        }
+        let data = await listParentId(obj);
+        this.options = data.list.filter((item) => item.type == 2);
+        this.form.businessCodeId = '';
+      },
+
+      fileChange(file) {
+        this.form.name = file.name.replace(/\.[^/.]+$/, '');
+      },
 
-        this.loading = true;
-        fileSaveAPI(data)
-          .then( (msg) => {
-            this.loading = false;
+      /* 保存编辑 */
+      save() {
+        this.$refs.form.validate(async (valid) => {
+          if (!valid) {
+            return false;
+          }
 
-            this.cancel();
-            this.$emit('done',msg);
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
-    },
+          let data = {
+            ...this.form
+          };
+          if (this.activeName == 2) {
+            data.fileType = 1;
+          }
+          this.loading = true;
+          fileSaveAPI(data)
+            .then((msg) => {
+              this.loading = false;
+
+              this.cancel();
+              this.$emit('done', msg);
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
 
-    cancel() {
-      this.form = { ...this.defaultForm };
-      this.$refs.form.clearValidate();
-      this.showEditFlag = false;
+      cancel() {
+        this.form = { ...this.defaultForm, directoryId: this.form.directoryId };
+        this.$refs.form.clearValidate();
+        this.showEditFlag = false;
+      }
     }
-  }
-};
+  };
 </script>
 <style scoped lang="scss">
-.aaa {
-  width: 100%;
-
-  ::v-deep .upload-demo {
+  .aaa {
     width: 100%;
 
-    .el-upload--text {
+    ::v-deep .upload-demo {
       width: 100%;
 
-      button {
+      .el-upload--text {
         width: 100%;
-        background: #ffffff;
-        border: 1px solid #dbdbdb;
-        border-radius: 5px;
+
+        button {
+          width: 100%;
+          background: #ffffff;
+          border: 1px solid #dbdbdb;
+          border-radius: 5px;
+        }
       }
-    }
 
-    .el-upload-list {
-      transform: translate(10px, -39px);
-      position: absolute;
+      .el-upload-list {
+        transform: translate(10px, -39px);
+        position: absolute;
+      }
     }
   }
-}
 </style>

+ 0 - 1
src/components/addDoc/file-table-listTemplate.vue

@@ -6,7 +6,6 @@
       :columns="columns"
       :datasource="datasource"
       tool-class="ele-toolbar-form"
-      :needPage="false"
       row-key="id"
       :selection.sync="selection"
       :toolbar="false"

+ 1 - 0
src/components/addDoc/fileUpload.vue

@@ -180,6 +180,7 @@
           }).then(() => {
             return true;
           });
+          return true;
         } else {
           return true;
         }

+ 4 - 15
src/components/addDoc/getCode.vue

@@ -8,6 +8,8 @@
     append-to-body
     @close="cancel"
     title="申请编码"
+    :maxable="true"
+    :resizable="true"
   >
     <el-form ref="form" :model="form" :rules="rules" label-width="82px">
       <el-row :gutter="15">
@@ -61,7 +63,6 @@
 
 <script>
   import { selectTreeList, listParentId, getCode } from './api';
-  import headerTitle from '@/components/header-title/index.vue';
 
   export default {
     data() {
@@ -89,9 +90,7 @@
         return this.$store.state.theme.styleResponsive;
       }
     },
-    components: {
-      headerTitle
-    },
+    components: {},
     created() {},
     methods: {
       async open() {
@@ -119,17 +118,7 @@
         this.form.type1 = '';
       },
       async type1Change(val) {
-        this.form.code = await getCode(val);
-        // let data = await pageSegment({
-        //   pageNum: 1,
-        //   size: 100,
-        //   businessCodeCategoryId: val
-        // });
-        // data.list.map((item) =>{
-        //   console.log(item,'dsds')
-        // });
-        // console.log(code, 'ds');
-        // this.options = data.list.map((item) => item.type == 2);
+        // this.form.code = await getCode(val);
       },
       /* 保存编辑 */
       save() {

+ 5 - 0
src/components/addDoc/index.vue

@@ -6,6 +6,7 @@
         v-if="type != 'view'"
         type="primary"
         @click="handleUpload"
+        :size="size"
       >
         上传</el-button
       >
@@ -43,6 +44,10 @@
         default: () => {
           return [];
         }
+      },
+      size: {
+        type: String,
+        default: 'mini'
       }
     },
     data() {

+ 136 - 132
src/components/addDoc/main.vue

@@ -6,6 +6,8 @@
     custom-class="ele-dialog-form"
     append-to-body
     ref="Emodal"
+    :maxable="true"
+    :resizable="true"
   >
     <!-- 数据表格 -->
     <ele-pro-table
@@ -62,6 +64,8 @@
       :close-on-click-modal="false"
       custom-class="ele-dialog-form"
       append-to-body
+      :maxable="true"
+      :resizable="true"
     >
       <doc_template
         :disabledTableList="tableList"
@@ -77,144 +81,144 @@
 </template>
 
 <script>
-import tabMixins from '@/mixins/tableColumnsMixin';
-import doc_template from './doc_template.vue';
-import fileEdit from './file-edit.vue';
-import browse from './browse.vue';
-import { queryIds } from './api';
-import { setFileUrl } from './util.js';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import doc_template from './doc_template.vue';
+  import fileEdit from './file-edit.vue';
+  import browse from './browse.vue';
+  import { queryIds } from './api';
+  import { setFileUrl } from './util.js';
 
-export default {
-  components: { doc_template, fileEdit, browse },
-  mixins:[tabMixins],
-  data() {
-    return {
-      fileId: [],
-      fileShow: false,
-      showEditFlag: false,
-      tableList: [],
-      type: 'add',
-      cacheKeyUrl: 'qms-c2e9664a-addDoc-main',
-      columnsVersion: 1,
-      columns: [
-        {
-          label: '编码',
-          prop: 'code',
-          width: 180,
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'name',
-          label: '文档名称',
-          align: 'center',
-          slot: 'name',
-          showOverflowTooltip: true,
-          minWidth: 200
-        },
-        {
-          prop: 'storagePath',
-          label: '文件名称',
-          align: 'center',
+  export default {
+    components: { doc_template, fileEdit, browse },
+    mixins: [tabMixins],
+    data() {
+      return {
+        fileId: [],
+        fileShow: false,
+        showEditFlag: false,
+        tableList: [],
+        type: 'add',
+        cacheKeyUrl: 'qms-c2e9664a-addDoc-main',
+        columnsVersion: 1,
+        columns: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
 
-          showOverflowTooltip: true,
-          minWidth: 200,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue && cellValue[0]?.name;
-          }
-        },
-        {
-          prop: 'version',
-          label: '版本',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-
-        {
-          prop: 'createUserName',
-          label: '创建人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160
-        },
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue && cellValue[0]?.name;
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
 
-        {
-          prop: 'sizeUnit',
-          label: '文档大小',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
 
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 200,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true
-        }
-      ]
-    };
-  },
-  created() {},
+          {
+            prop: 'sizeUnit',
+            label: '文档大小',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
 
-  methods: {
-    open(fileId, type) {
-      //查看详情:view 新增:add
-      this.showEditFlag = true;
-      this.fileId = fileId || [];
-      if (type) {
-        this.type = type;
-      }
-      this.init();
-    },
-    fileEditOpen() {
-      this.$refs.fileEditRef.open();
-    },
-    remove(row) {
-      this.tableList = this.tableList.filter((item) => item.code != row.code);
-      this.fileId = this.tableList.map((item) => item.id);
-    },
-    async init() {
-      if (this.fileId.length > 0) {
-        this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
-      } else {
-        this.tableList = [];
-      }
-    },
-    done(id) {
-      this.fileId.push(...id);
-      this.init();
-    },
-    browseOpen(row) {
-      window.open(setFileUrl(row));
-    },
-    addFile() {
-      this.$emit(
-        'success',
-        this.tableList.map((item) => item.id)
-      );
-      this.showEditFlag = false;
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 200,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ]
+      };
     },
-    addTemplate() {
-      let list = this.$refs.doc_templateRef.getTableList();
-      this.fileShow = false;
-      if (list.length == 0) {
-        this.$message.error('请选择一条数据');
-        return;
+    created() {},
+
+    methods: {
+      open(fileId, type) {
+        //查看详情:view 新增:add
+        this.showEditFlag = true;
+        this.fileId = fileId || [];
+        if (type) {
+          this.type = type;
+        }
+        this.init();
+      },
+      fileEditOpen() {
+        this.$refs.fileEditRef.open();
+      },
+      remove(row) {
+        this.tableList = this.tableList.filter((item) => item.code != row.code);
+        this.fileId = this.tableList.map((item) => item.id);
+      },
+      async init() {
+        if (this.fileId.length > 0) {
+          this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
+        } else {
+          this.tableList = [];
+        }
+      },
+      done(id) {
+        this.fileId.push(...id);
+        this.init();
+      },
+      browseOpen(row) {
+        window.open(setFileUrl(row));
+      },
+      addFile() {
+        this.$emit(
+          'success',
+          this.tableList.map((item) => item.id)
+        );
+        this.showEditFlag = false;
+      },
+      addTemplate() {
+        let list = this.$refs.doc_templateRef.getTableList();
+        this.fileShow = false;
+        if (list.length == 0) {
+          this.$message.error('请选择一条数据');
+          return;
+        }
+        this.tableList.push(...list);
       }
-      this.tableList.push(...list);
     }
-  }
-};
+  };
 </script>

+ 2 - 2
src/components/addDoc/util.js

@@ -1,6 +1,6 @@
 import store from '@/store';
-const userId = store.state.user.info.userId;
-const userName = store.state.user.info.name;
+const userId = store.state.user?.info?.userId;
+const userName = store.state.user?.info?.name;
 export function isPower(data = {}, power, selection = []) {
   if (power == 'add' && data.userAuthority.length == 0) {
     //文件夹默认开放新增权限

+ 4 - 0
src/components/common/seekPage.vue

@@ -15,6 +15,7 @@
                 v-model="defaultWhere[item.value]"
                 :placeholder="item.placeholder || '请输入内容'"
                 :style="{ width: item.width ? item.width + 'px' : '220px' }"
+                @keyup.enter.native="search"
               />
             </div>
             <div v-if="item.type == 'select'">
@@ -66,6 +67,7 @@
           trigger="click"
           :hide-on-click="false"
           v-model="dropdownVisible"
+          @keydown.enter.native.stop="search"
         >
           <div>
             <span class="el-dropdown-link">
@@ -95,6 +97,8 @@
                           :style="{
                             width: item.width ? item.width + 'px' : '220px'
                           }"
+                          @keydown.enter.native="() => search()"
+                          @keyup.enter.native="() => search()"
                         />
                       </div>
                       <div v-if="item.type == 'select'">

+ 2 - 1
src/enum/dict.js

@@ -16,7 +16,8 @@ export default {
   计量单位: 'measuring_uint',
   检验方案: 'inspection_scheme',
   处置状态: 'dispose_status',
-  质检计划状态: 'inspection_plan_status'
+  质检计划状态: 'inspection_plan_status',
+  文档类型: 'doc_type'
 };
 
 export const numberList = [

+ 20 - 48
src/views/inspectionPoint/components/search.vue

@@ -1,64 +1,36 @@
-<!-- 搜索表单 --> 6
+<!-- 搜索表单 --> 
 <template>
-  <el-form label-width="60px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
-    <el-row :gutter="24">
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 4 }">
-        <el-form-item label="名称:">
-          <el-input clearable v-model="where.pointName" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 4 }">
-        <el-form-item label="编码:">
-          <el-input clearable v-model="where.pointCode" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-
-      <el-col v-bind="styleResponsive ? { lg: 12, md: 10 } : { span: 12 }" style="text-align: right;">
-        <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>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
 </template>
 
 <script>
 export default {
   data() {
-    // 默认表单数据
-    const defaultWhere = {
-      pointName: '',
-      pointCode: '',
-    };
     return {
-      defaultWhere,
-      // 表单数据
-      where: { ...defaultWhere },
-
+      // 表格列配置
+      seekList: [
+        {
+          label: '名称:',
+          value: 'pointName',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '编码:',
+          value: 'pointCode',
+          type: 'input',
+          placeholder: '请输入'
+        }
+      ]
     };
   },
   computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
   },
   methods: {
     /* 搜索 */
-    search() {
-      this.$emit('search', this.where);
-    },
-    /*  重置 */
-    reset() {
-
-      this.where = { ...this.defaultWhere };
-      this.search();
-    }
+      search(e) {
+        this.$emit('search', { ...e });
+      },
   }
 };
 </script>

+ 10 - 0
src/views/inspectionProject/index.vue

@@ -161,6 +161,16 @@ export default {
       cacheKeyUrl: 'qsm-c2e9664a-inspectionProject',
       // 表格列配置
       columns: [
+        
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
         {
           prop: 'inspectionCode',
           label: '参数编码',

+ 48 - 104
src/views/inspectionStandard/components/search.vue

@@ -1,112 +1,56 @@
 <!-- 搜索表单 -->
 6
 <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: 4, md: 10 } : { span: 4 }">
-        <el-form-item label="标准名称:">
-          <el-input clearable v-model="where.name" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-        <el-form-item label="标准代码:">
-          <el-input
-            clearable
-            v-model="where.standardCode"
-            placeholder="请输入"
-          />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-        <el-form-item label="标准类型:">
-          <DictSelection
-            dictName="质检标准类型"
-            v-model="where.type"
-          ></DictSelection>
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-        <el-form-item label="状态:">
-          <el-select
-            v-model="where.status"
-            class="m-2"
-            placeholder="请选择"
-            size="large"
-            style="width: 100%"
-          >
-            <el-option label="停用" :value="0" />
-            <el-option label="启用" :value="1" />
-          </el-select>
-        </el-form-item>
-      </el-col>
-<!--      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">-->
-<!--        <el-form-item label="组织机构:">-->
-<!--          <auth-selection-->
-<!--            data-type="Array"-->
-<!--            v-model="where.deptIds"-->
-<!--            style="width: 100%"-->
-<!--          ></auth-selection>-->
-<!--        </el-form-item>-->
-<!--      </el-col>-->
-      <el-col
-        style="display: flex; justify-content: flex-end"
-        v-bind="styleResponsive ? { lg: 4, md: 18 } : { span: 4 }"
-      >
-        <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>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
 </template>
 
 <script>
-  export default {
-    data() {
-      // 默认表单数据
-      const defaultWhere = {
-        name: '',
-        standardCode: '',
-        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();
-      }
+export default {
+  data() {
+    return {
+      statusList: [
+        { label: '停用', value: 0 },
+        { label: '启用', value: 1 }
+      ]
+    };
+  },
+  computed: {
+    seekList() {
+      return [
+        {
+          label: '标准名称:',
+          value: 'name',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '标准代码:',
+          value: 'standardCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '标准类型:',
+          value: 'type',
+          type: 'DictSelection',
+          dictName: '质检标准类型',
+          placeholder: '请选择'
+        },
+
+        {
+          label: '状态:',
+          value: 'status',
+          type: 'select',
+          placeholder: '请选择',
+          planList: this.statusList
+        }
+      ];
+    }
+  },
+  methods: {
+    search(e) {
+      this.$emit('search', { ...e });
     }
-  };
+  }
+};
 </script>

+ 35 - 115
src/views/inspectionStatistics/qualityControlWorkOrder/components/search.vue

@@ -1,132 +1,52 @@
-<!-- 搜索表单 --> 6
+<!-- 搜索表单 -->
 <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: 10 } : { span: 6 }">
-        <el-form-item label="批次号:">
-          <el-input clearable v-model="where.batchNo" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6 }">
-        <el-form-item label="计划号:">
-          <el-input
-            clearable
-            v-model="where.standardCode"
-            placeholder="请输入"
-          />
-        </el-form-item>
-      </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6 }">
-        <el-form-item label="产品编码:">
-          <el-input
-            clearable
-            v-model="where.productCode"
-            placeholder="请输入"
-          />
-        </el-form-item>
-      </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6 }">
-        <el-form-item label="产品规格:">
-          <el-input
-            clearable
-            v-model="where.specification"
-            placeholder="请输入"
-          />
-        </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>
-        </el-form-item>
-      </el-col> -->
-      <el-col
-        v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }"
-        style="width: 300px"
-      >
-        <el-form-item label="日期" prop="createTime">
-          <el-date-picker
-            v-model="where.createTime"
-            style="width: 240px"
-            value-format="yyyy-MM-dd"
-            type="daterange"
-            range-separator="-"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            :default-time="['00:00:00', '23:59:59']"
-          />
-        </el-form-item>
-      </el-col>
-      <el-col
-        style="display: flex; justify-content: flex-end"
-        v-bind="styleResponsive ? { lg: 18, md: 18 } : { span: 18 }"
-      >
-        <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>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
 </template>
 
 <script>
 export default {
   data() {
-    // 默认表单数据
-    const defaultWhere = {
-      batchNo: '',
-      productName: '',
-      productCode: '',
-      specification: '',
-      // deptIds: [],
-      createTime: []
-    };
     return {
-      defaultWhere,
-      // 表单数据
-      where: { ...defaultWhere }
     };
   },
   computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
+    seekList() {
+      return [
+        {
+          label: '批次号:',
+          value: 'batchNo',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '计划号:',
+          value: 'standardCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '产品编码:',
+          value: 'productCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '产品规格:',
+          value: 'specification',
+          type: 'input',
+          placeholder: '请输入'
+        },
+      ];
     }
   },
+  watch: {},
+  created() {},
   methods: {
-    /* 搜索 */
-    search() {
-      const where = { ...this.where };
-      if (where.createTime?.length) {
-        where.startTime = where.createTime[0];
-        where.endTime = where.createTime[1];
-      }
-      delete where.createTime;
-      this.$emit('search', where);
-    },
-    /*  重置 */
-    reset() {
-      this.where = { ...this.defaultWhere };
-      this.search();
+    search(e) {
+      this.$emit('search', { ...e });
     }
   }
 };
 </script>
+<style lang="scss" scoped>
+</style>

+ 325 - 307
src/views/inspectionTemplate/AddorUpdate.vue

@@ -135,8 +135,8 @@
           tool-class="ele-toolbar-form"
           row-key="qualityLevelId"
           @selection-change="selectionChange"
-              @columns-change="handleColumnChange"
-              :cache-key="cacheKeyUrl"
+          @columns-change="handleColumnChange"
+          :cache-key="cacheKeyUrl"
         >
           <template v-slot:toolbar>
             <el-button @click="handAdd(1)" size="mini" type="primary"
@@ -172,7 +172,12 @@
             <div> <el-input v-model="row.inspectionName"></el-input></div>
           </template>
           <template v-slot:sort="{ row }">
-            <el-input v-model="row.sort" type="number"></el-input>
+            <el-input
+              v-model="row.sort"
+              type="number"
+              @blur="handleSortBlur"
+              placeholder="输入排序"
+            ></el-input>
           </template>
           <template v-slot:defaultValue="{ row }">
             <div style="width: 100%; display: flex">
@@ -255,7 +260,7 @@
       </el-row>
     </el-form>
     <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">取消</el-button>
+      <el-button @click="handleClose()">取消</el-button>
       <el-button type="primary" @click="dataFormSubmit()">保存</el-button>
     </span>
     <termPop ref="termRef" @selectChange="selectChange"></termPop>
@@ -273,331 +278,344 @@
 </template>
 
 <script>
-  import termPop from '@/views/inspectionTemplate/inspectionClassify/index.vue';
-  import EquipmentDialog from '@/views/unqualifiedProduct/unqualifiedList/components/EquipmentDialog.vue';
-  import { getByCode } from '@/api/system/dictionary-data';
+import termPop from '@/views/inspectionTemplate/inspectionClassify/index.vue';
+import EquipmentDialog from '@/views/unqualifiedProduct/unqualifiedList/components/EquipmentDialog.vue';
+import { getByCode } from '@/api/system/dictionary-data';
 import tabMixins from '@/mixins/tableColumnsMixin';
 
-  import {
-    save,
-    update,
-    getById,
-    templatecategoryPage
-  } from '@/api/inspectionTemplate';
-  import { getCode } from '@/api/login';
-  export default {
-    components: { termPop, EquipmentDialog },
-    mixins:[tabMixins],
-      data() {
-      return {
+import {
+  save,
+  update,
+  getById,
+  templatecategoryPage
+} from '@/api/inspectionTemplate';
+import { getCode } from '@/api/login';
+export default {
+  components: { termPop, EquipmentDialog },
+  mixins: [tabMixins],
+  data() {
+    return {
       cacheKeyUrl: 'qms-c2e9664a-inspectionTemplate-AddorUpdate',
       columnsVersion: 1,
-        visible: false,
-        dataForm: {
-          id: 0,
-          type: null,
-          qualitySchemeTemplateName: '',
-          qualitySchemeTemplateCode: '',
-          inspectionItemVOList: [],
-          status: 1,
-          templateRemark: '',
-          sampleProportion: '',
-          sampleProportionUnit: '%',
-          validityPeriod: '',
-          validityPeriodUnit: ''
+      visible: false,
+      dataForm: {
+        id: 0,
+        type: null,
+        qualitySchemeTemplateName: '',
+        qualitySchemeTemplateCode: '',
+        inspectionItemVOList: [],
+        status: 1,
+        templateRemark: '',
+        sampleProportion: '',
+        sampleProportionUnit: '%',
+        validityPeriod: '',
+        validityPeriodUnit: ''
+      },
+      columns: [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          reserveSelection: true
+        },
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          label: '排序',
+          width: 100,
+          align: 'center',
+          slot: 'sort',
+          prop: 'sort',
+          fixed: 'left'
+        },
+        {
+          prop: 'categoryLevelClassName',
+          label: '质检类型',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'inspectionCode',
+          label: '编码',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'inspectionName',
+          slot: 'inspectionName',
+          label: '名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'defaultValue',
+          slot: 'defaultValue',
+          label: '工艺参数',
+          align: 'center',
+          minWidth: 400,
+          columnKey: 'defaultValue'
         },
-        columns: [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center',
-            reserveSelection: true
-          },
-          {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            label: '排序',
-            width: 100,
-            align: 'center',
-            slot: 'sort',
-            prop: 'sort',
-            fixed: 'left'
-          },
-          {
-            prop: 'categoryLevelClassName',
-            label: '质检类型',
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'inspectionCode',
-            label: '编码',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'inspectionName',
-            slot: 'inspectionName',
-            label: '名称',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'defaultValue',
-            slot: 'defaultValue',
-            label: '工艺参数',
-            align: 'center',
-            minWidth: 400,
-            columnKey: 'defaultValue'
-          },
 
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 80,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right'
-          }
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 80,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right'
+        }
+      ],
+      categoryColumns: [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          reserveSelection: true
+        },
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'categoryLevelPath',
+          label: '分类',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'code',
+          label: '编码',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'name',
+          label: '名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'brandNum',
+          label: '牌号',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 80,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right'
+        }
+      ],
+      dataRule: {
+        type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
+        qualitySchemeTemplateName: [
+          { required: true, message: '请输入质检方案名称', trigger: 'blur' }
         ],
-        categoryColumns: [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center',
-            reserveSelection: true
-          },
-          {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'categoryLevelPath',
-            label: '分类',
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'code',
-            label: '编码',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'name',
-            label: '名称',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'brandNum',
-            label: '牌号',
-            align: 'center',
-            minWidth: 150
-          },
+        status: [
           {
-            columnKey: 'action',
-            label: '操作',
-            width: 80,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right'
+            required: true,
+            message: '请选择状态',
+            trigger: 'blur'
           }
-        ],
-        dataRule: {
-          type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
-          qualitySchemeTemplateName: [
-            { required: true, message: '请输入质检方案名称', trigger: 'blur' }
-          ],
-          status: [
-            {
-              required: true,
-              message: '请选择状态',
-              trigger: 'blur'
-            }
-          ]
-        },
-        list: [],
-        templateCategoryList: [],
-        typeList: []
-      };
-    },
-    methods: {
-      async getTnspectionPlanType() {
-        let res = await getByCode('inspection_plan_type');
-        if (res?.code == 0) {
-          let list = res.data.map((item) => {
-            let key = Object.keys(item)[0];
-            return { value: key, label: item[key] };
-          });
-          this.typeList = list;
-        }
+        ]
       },
-      handAdd(type) {
-        if (type == 1) {
-          this.$refs.termRef.open(this.list);
-        }
-        if (type == 2) {
-          this.$refs.equipmentRefs.open();
-        }
-      },
-      handleClose() {
-        this.visible = false;
-      },
-      selectionChange(selection) {
-        console.log(selection, 'selection');
-      },
-      selectChange(list) {
-        this.list = list.map(item=>{
-          item['sort']=item['sort']||0
-          return item
+      list: [],
+      templateCategoryList: [],
+      typeList: []
+    };
+  },
+  methods: {
+      //失去焦点自动排序
+      handleSortBlur() {
+      this.list = this.list.map(item => ({
+        ...item,
+        sort: item.sort === '' || item.sort == null ? 0 : Number(item.sort)
+      }));
+
+      this.list.sort((a, b) => a.sort - b.sort);
+    },
+    async getTnspectionPlanType() {
+      let res = await getByCode('inspection_plan_type');
+      if (res?.code == 0) {
+        let list = res.data.map((item) => {
+          let key = Object.keys(item)[0];
+          return { value: key, label: item[key] };
         });
-      },
-      handDel(index, type) {
-        if (type == 1) {
-          this.list.splice(index, 1);
-        }
-        if (type == 2) {
-          this.templateCategoryList.splice(index, 1);
+        this.typeList = list;
+      }
+    },
+    handAdd(type) {
+      if (type == 1) {
+        this.$refs.termRef.open(this.list);
+      }
+      if (type == 2) {
+        this.$refs.equipmentRefs.open();
+      }
+    },
+    handleClose() {
+      this.visible = false;
+      this.templateCategoryList = [];
+    },
+    selectionChange(selection) {
+      console.log(selection, 'selection');
+    },
+    selectChange(list) {
+      this.list = list.map((item) => {
+        item['sort'] = item['sort'] || 0;
+        return item;
+      });
+    },
+    handDel(index, type) {
+      if (type == 1) {
+        this.list.splice(index, 1);
+      }
+      if (type == 2) {
+        this.templateCategoryList.splice(index, 1);
+      }
+    },
+    confirmChoose(list) {
+      let categoryList = list.map((item) => {
+        item['name'] = item.name;
+        item['categoryId'] = item.id;
+        item['id'] = '';
+        return item;
+      });
+      this.templateCategoryList.push(...categoryList);
+    },
+    init(id) {
+      this.getTnspectionPlanType();
+      this.dataForm.id = id || 0;
+      this.visible = true;
+      this.$nextTick(async () => {
+        this.$refs['dataForm'].resetFields();
+        if (this.dataForm.id) {
+          getById(this.dataForm.id).then(({ data }) => {
+            this.dataForm = data;
+            let itemVOList = [];
+            if (data.inspectionItemVOList.length > 0) {
+              itemVOList = data.inspectionItemVOList.map((item) => {
+                item.inspectionItemId = this.dataForm.id;
+                // item.push({
+                //   inspectionItemId: this.dataForm.id
+                // });
+                return item;
+              });
+            }
+            // this.list = data.inspectionItemVOList;
+            this.list = itemVOList;
+            console.log(this.list);
+          });
+          templatecategoryPage({
+            templateId: this.dataForm.id,
+            size: -1
+          }).then((data) => {
+            console.log(data, 'data');
+            this.templateCategoryList = data.list;
+          });
+          // this.templateCategoryList=data.templateCategoryList||[];
+        } else {
+          const code = await getCode('template_code');
+          this.dataForm.qualitySchemeTemplateCode = code;
+          this.list = [];
         }
-      },
-      confirmChoose(list) {
-        let categoryList = list.map((item) => {
-          item['name'] = item.name;
-          item['categoryId'] = item.id;
-          item['id'] = '';
-          return item;
-        });
-        this.templateCategoryList.push(...categoryList);
-      },
-      init(id) {
-        this.getTnspectionPlanType();
-        this.dataForm.id = id || 0;
-        this.visible = true;
-        this.$nextTick(async () => {
-          this.$refs['dataForm'].resetFields();
+      });
+    },
+    // 表单提交
+    dataFormSubmit() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (!this.dataForm.id) {
+            delete this.dataForm.id;
+          }
+          const saveOrUpdate = this.dataForm.id ? update : save;
           if (this.dataForm.id) {
-            getById(this.dataForm.id).then(({ data }) => {
-              this.dataForm = data;
-              let itemVOList = [];
-              if (data.inspectionItemVOList.length > 0) {
-                itemVOList = data.inspectionItemVOList.map((item) => {
-                  item.inspectionItemId = this.dataForm.id;
-                  // item.push({
-                  //   inspectionItemId: this.dataForm.id
-                  // });
-                  return item;
-                });
+            this.dataForm.inspectionItemVOList = this.list.map((item) => {
+              if (!item.inspectionItemId) {
+                item.inspectionItemId = this.dataForm.id;
+                item.id = '';
               }
-              // this.list = data.inspectionItemVOList;
-              this.list = itemVOList;
-              console.log(this.list);
-            });
-            templatecategoryPage({
-              templateId: this.dataForm.id,
-              size: -1
-            }).then((data) => {
-              console.log(data, 'data');
-              this.templateCategoryList = data.list;
+              return item;
             });
-            // this.templateCategoryList=data.templateCategoryList||[];
           } else {
-            const code = await getCode('template_code');
-            this.dataForm.qualitySchemeTemplateCode = code;
-            this.list = [];
+            this.dataForm.inspectionItemVOList = this.list.map((item) => {
+              item.id = '';
+              return item;
+            });
           }
-        });
-      },
-      // 表单提交
-      dataFormSubmit() {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-            if (!this.dataForm.id) {
-              delete this.dataForm.id;
-            }
-            const saveOrUpdate = this.dataForm.id ? update : save;
-            if (this.dataForm.id) {
-              this.dataForm.inspectionItemVOList = this.list.map((item) => {
-                if (!item.inspectionItemId) {
-                  item.inspectionItemId = this.dataForm.id;
-                  item.id = '';
-                }
-                return item;
-              });
-            } else {
-              this.dataForm.inspectionItemVOList = this.list.map((item) => {
-                item.id = '';
-                return item;
-              });
-            }
 
-            this.dataForm.templateCategoryList = this.templateCategoryList;
+          this.dataForm.templateCategoryList = this.templateCategoryList;
 
-            saveOrUpdate(this.dataForm)
-              .then((msg) => {
-                this.loading = false;
-                this.$refs['dataForm'].resetFields();
-                // this.dataForm = {};
-                const info = this.dataForm.id ? '修改成功' : '新增成功';
-                this.$message.success(info);
-                this.visible = false;
-                // this.updateVisible(false);
-                this.$emit('refreshDataList');
-              })
-              .catch((e) => {
-                this.loading = false;
-              });
-          }
-        });
-      }
-    },
-    watch: {
-      'dataForm.type': {
-        handler(val) {
-          if (val == 2) {
-            this.templateCategoryList = [];
-          }
+          saveOrUpdate(this.dataForm)
+            .then((msg) => {
+              this.loading = false;
+              this.$refs['dataForm'].resetFields();
+              // this.dataForm = {};
+              const info = this.dataForm.id ? '修改成功' : '新增成功';
+              this.$message.success(info);
+              this.visible = false;
+
+              this.templateCategoryList = []; // 必加:清空物品列表
+              this.list = []; // 可选:若需清空质检项列表,可添加这行
+              // this.updateVisible(false);
+              this.$emit('refreshDataList');
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        }
+      });
+    }
+  },
+  watch: {
+    'dataForm.type': {
+      handler(val) {
+        if (val == 2) {
+          this.templateCategoryList = [];
         }
       }
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  .title {
-    font-weight: bold;
-    padding-bottom: 20px;
-    padding-top: 20px;
-  }
+.title {
+  font-weight: bold;
+  padding-bottom: 20px;
+  padding-top: 20px;
+}
 </style>

+ 5 - 5
src/views/sample/samplemanagement/detailList.vue

@@ -95,11 +95,11 @@
             <el-col :span="24">
               <el-form-item
                 label="留样数量:"
-                prop="measureQuantity"
+                prop="keepSampleQuantity"
                 align="center"
               >
                 <el-input
-                  v-model="disposeForm.measureQuantity"
+                  v-model="disposeForm.keepSampleQuantity"
                   placeholder="请输入"
                   style="width: 100%"
                 >
@@ -263,7 +263,7 @@ export default {
         producerManufacturer: '',
         depotId: '',
         depotName: '',
-        measureQuantity: ''
+        keepSampleQuantity: ''
       },
       id: '',
       ids: [],
@@ -290,7 +290,7 @@ export default {
         ],
         depotId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
         // 新增:留样数量的校验规则
-        measureQuantity: [
+        keepSampleQuantity: [
           {
             validator: (rule, value, callback) => {
               if (
@@ -553,7 +553,7 @@ export default {
     disposeTypeChange() {
       console.log(this.disposeForm.disposeType);
       if (this.disposeForm.disposeType == 6) {
-        this.disposeForm.measureQuantity = this.current?.measureQuantity || '';
+        this.disposeForm.keepSampleQuantity = this.current?.measureQuantity || '';
       }
     },
     kk() {

+ 40 - 70
src/views/unqualifiedProduct/unqualifiedList/components/order-search.vue

@@ -1,91 +1,61 @@
 <!-- 搜索表单 -->
 6
 <template>
-  <el-form label-width="77px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
-    <el-row :gutter="24">
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
-        <el-form-item label="来源编码:">
-          <el-input clearable v-model="where.sourceCode" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
-        <el-form-item label="编码:">
-          <el-input clearable v-model="where.unqualifiedProductsCode" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-      <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
-        <el-form-item label="创建人:">
-          <el-input clearable v-model="where.reviewerName" placeholder="请输入" />
-        </el-form-item>
-      </el-col> -->
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
-        <el-form-item label="创建时间:">
-          <el-date-picker class="w100" style="width: 100%" v-model="where.createTime" type="daterange"
-            range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss"
-            :default-time="['00:00:00', '23:59:59']">
-          </el-date-picker>
-        </el-form-item>
-      </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
-        <el-form-item label="工序:">
-          <el-input clearable v-model="where.taskName" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
-        <el-form-item label="状态:">
-          <el-select v-model="where.status" style="width:100%">
-            <el-option v-for="item in statusList" :key="item.code" :value="item.code" :label="item.name"></el-option>
-          </el-select>
-        </el-form-item>
-      </el-col>
-      <el-col style="display: flex; justify-content: flex-end"
-        v-bind="styleResponsive ? { lg: 12, md: 12 } : { span: 12 }">
-        <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>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
 </template>
 
 <script>
 export default {
   data() {
-    // 默认表单数据
-    const defaultWhere = {
-      code: '',
-      produceTaskName: '',
-      deptIds: ''
-    };
     return {
-      defaultWhere,
-      // 表单数据
-      where: { ...defaultWhere },
       statusList: [
         { name: '待处理', code: 0 },
         { name: '处理中', code: 1 },
-        { name: '已处理', code: 2 },
-      ],
+        { name: '已处理', code: 2 }
+      ]
     };
   },
   computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
+    seekList() {
+      return [
+        {
+          label: '来源编码:',
+          value: 'sourceCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '编码:',
+          value: 'unqualifiedProductsCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '创建人:',
+          value: 'reviewerName',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '工序:',
+          value: 'taskName',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        
+        {
+          label: '状态:',
+          value: 'status',
+          type: 'select',
+          placeholder: '请选择',
+          planList: this.statusList
+        }
+      ];
     }
   },
   methods: {
-    /* 搜索 */
-    search() {
-      this.$emit('search', this.where);
-    },
-    /*  重置 */
-    reset() {
-      this.where = { ...this.defaultWhere };
-      this.search();
+    search(e) {
+      this.$emit('search', { ...e });
     }
   }
 };

+ 59 - 153
src/views/unqualifiedProduct/unqualifiedList/components/probationalGoods-search.vue

@@ -1,163 +1,69 @@
 <!-- 搜索表单 -->
 <template>
-  <el-form
-    label-width="90px"
-    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-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-input clearable v-model="where.sampleCode" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="物品编码:">
-          <el-input clearable v-model="where.categoryCode" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="物品名称:">
-          <el-input
-            clearable
-            v-model="where.categoryName"
-            placeholder="请输入"
-          />
-        </el-form-item>
-      </el-col>
-
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="批次号:">
-          <el-input clearable v-model="where.batchNo" placeholder="请输入" />
-        </el-form-item>
-      </el-col>
-
-    
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="产品规格:">
-          <el-input
-            clearable
-            v-model="where.specification"
-            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" style="width:100%">
-            <el-option
-              v-for="item in statusList"
-              :key="item.code"
-              :value="item.code"
-              :label="item.name"
-
-            ></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>
-        </el-form-item>
-      </el-col> -->
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label-width="0px">
-          <el-button
-            type="primary"
-            icon="el-icon-search"
-            class="ele-btn-icon"
-            @click="search"
-          >
-            查询
-          </el-button>
-          <el-button @click="reset" icon="el-icon-refresh-left" type="primary"
-            >重置</el-button
-          >
-        </el-form-item>
-      </el-col>
-    </el-row>
-  </el-form>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
 </template>
 
 <script>
-  export default {
-    props: [],
-    data() {
-      // 默认表单数据
-      const defaultWhere = {
-        batchNo: '',
-        code: '',
-        sampleCode: '',
-        specification: '',
-        categoryName:'',
-        categoryCode: '',
-        createTime: []
-      };
-      return {
-        // 表单数据
-        where: { ...defaultWhere },
-        statusList: [
-          { name: '待处理', code: 0 },
-          { name: '处理中', code: 1 },
-          { name: '已处理', code: 2 }
-        ]
-      };
-    },
-    computed: {
-      // 是否开启响应式布局
-      styleResponsive() {
-        return this.$store.state.theme.styleResponsive;
-      }
-    },
-    watch: {},
-    created() {},
-    methods: {
-      /* 搜索 */
-      search() {
-        const where = { ...this.where };
-        if (where.createTime?.length) {
-          where.startTime = where.createTime[0];
-          where.endTime = where.createTime[1];
+export default {
+  data() {
+    return {
+      statusList: [
+        { name: '待处理', code: 0 },
+        { name: '处理中', code: 1 },
+        { name: '已处理', code: 2 }
+      ]
+    };
+  },
+  computed: {
+    seekList() {
+      return [
+        {
+          label: '编码:',
+          value: 'code',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '样品编码:',
+          value: 'sampleCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '物品编码:',
+          value: 'categoryCode',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '物品名称:',
+          value: 'categoryName',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '批次号:',
+          value: 'batchNo',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '产品规格:',
+          value: 'specification',
+          type: 'input',
+          placeholder: '请输入'
         }
-        delete where.createTime;
-        this.$emit('search', where);
-      },
-      /*  重置 */
-      reset() {
-        this.where = { ...this.defaultWhere };
-        this.search();
-      }
+      ];
+    }
+  },
+  watch: {},
+  created() {},
+  methods: {
+    search(e) {
+      this.$emit('search', { ...e });
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  .ele-form-actions {
-    display: flex;
-    align-items: center;
-    justify-content: flex-end;
-  }
 </style>

+ 5 - 5
src/views/unqualifiedProduct/unqualifiedList/detailList.vue

@@ -117,11 +117,11 @@
             <el-col :span="24">
               <el-form-item
                 label="留样数量:"
-                prop="measureQuantity"
+                prop="keepSampleQuantity"
                 align="center"
               >
                 <el-input
-                  v-model="disposeForm.measureQuantity"
+                  v-model="disposeForm.keepSampleQuantity"
                   placeholder="请输入"
                   style="width: 100%"
                 >
@@ -284,7 +284,7 @@ export default {
           { required: true, message: '请选择处置方式', trigger: 'change' }
         ],
         depotId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
-        measureQuantity: [
+        keepSampleQuantity: [
           {
             validator: (rule, value, callback) => {
               if (
@@ -315,7 +315,7 @@ export default {
         depotId: '',
         depotName: '',
         taskId: '',
-        measureQuantity:'',
+        keepSampleQuantity:'',
       },
       loading: false,
       selection: [],
@@ -608,7 +608,7 @@ export default {
     disposeTypeChange(){
       console.log(this.disposeForm.disposeType)
        if (this.disposeForm.disposeType == 6) {
-        this.disposeForm.measureQuantity = this.current?.measureQuantity || '';
+        this.disposeForm.keepSampleQuantity = this.current?.measureQuantity || '';
       }
     },
     // /* 表格数据源 */