Kaynağa Gözat

更新质检

yijing 1 yıl önce
ebeveyn
işleme
0d0960d39d

+ 9 - 0
src/api/inspectionWork/index.js

@@ -98,3 +98,12 @@ export async function warehouseList(data) {
     return res.data.data;
   }
 }
+
+
+//更新合格证号
+export async function updateCertificateNumber(data) {
+  const res = await request.post('/qms/quality_work_order/updateCertificateNumber', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}

+ 189 - 203
src/views/inspectionClassify/components/qualityItem.vue

@@ -1,42 +1,28 @@
 <template>
-  <ele-modal
-    :title="title"
-    :visible.sync="visible"
-    :before-close="handleClose"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="85%"
-    :maxable="true"
-  >
+  <ele-modal :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+    :close-on-press-escape="false" append-to-body width="85%" :maxable="true">
     <el-card shadow="never">
       <!-- 数据表格 -->
       <user-search @search="reload" />
 
-      <ele-pro-table
-        ref="table"
-        :columns="columns"
-        :datasource="datasource"
-        :selection.sync="selection"
-        row-key="id"
-      >
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
         <template v-slot:textType="{ row }">
           {{
             row.textType == 1
               ? '数值'
               : row.textType == 2
-              ? '选择'
-              : row.textType == 3
-              ? '上下限'
-              : row.textType == 4
-              ? '规格'
-              : row.textType == 5
-              ? '时间'
-              : row.textType == 6
-              ? '范围'
-              : row.textType == 7
-              ? '文本'
-              : ''
+                ? '选择'
+                : row.textType == 3
+                  ? '上下限'
+                  : row.textType == 4
+                    ? '规格'
+                    : row.textType == 5
+                      ? '时间'
+                      : row.textType == 6
+                        ? '范围'
+                        : row.textType == 7
+                          ? '文本'
+                          : ''
           }}
         </template>
         <template v-slot:defaultValue="{ row }">
@@ -49,15 +35,10 @@
         </template>
 
         <template v-slot:toolList="{ row }">
-          <div
-            style="display: inline-block"
-            v-for="(item, idx) in row.toolList"
-            :key="idx"
-            >{{ item.name }}
-            <span v-if="row.toolList && idx != row.toolList.length - 1"
-              >,
-            </span></div
-          >
+          <div style="display: inline-block" v-for="(item, idx) in row.toolList" :key="idx">{{ item.name }}
+            <span v-if="row.toolList && idx != row.toolList.length - 1">,
+            </span>
+          </div>
         </template>
       </ele-pro-table>
     </el-card>
@@ -70,179 +51,184 @@
 </template>
 
 <script>
-  import { getList } from '@/api/inspectionProject';
-  import UserSearch from '@/views/inspectionProject/components/user-search.vue';
-  import dictMixins from '@/mixins/dictMixins';
-  export default {
-    components: {
-      UserSearch
-    },
-    mixins: [dictMixins],
-
-    data() {
-      return {
-        visible: false,
-        title: '选择质检项',
-
-        columns: [
-          {
-            columnKey: 'selection',
-            type: 'selection',
-            width: 45,
-            align: 'center',
-            reserveSelection: true
-          },
-          {
-            prop: 'inspectionCode',
-            label: '参数编码',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            prop: 'inspectionName',
-            label: '参数名称',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            prop: 'textType',
-            label: '参数类型',
-            showOverflowTooltip: true,
-            align: 'center',
-            slot: 'textType',
-            minWidth: 110
-          },
-          {
-            prop: 'defaultValue',
-            label: '默认值',
-            align: 'center',
-            showOverflowTooltip: true,
-            slot: 'defaultValue'
-          },
-          {
-            prop: 'maxValue',
-            label: '参数上限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'minValue',
-            label: '参数下限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-
-          // {
-          //   label: '工艺要求',
-          //   prop: 'inspectionStandard',
-          //   formatter: (row, column, cellValue) => {
-          //     return row.symbol + ' ' + cellValue + ' ' + row.unit;
-          //   },
-          //   minWidth: 150
-          // },
-
-          {
-            label: '标准类型',
-            prop: 'type',
-            slot: 'type'
-          },
-
-          {
-            prop: 'qualityStandardName',
-            label: '标准名称',
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            prop: 'toolList',
-            slot: 'toolList',
-            label: '工具名称',
-            align: 'center',
-            minWidth: 150
-          },
-
-          {
-            label: '状态',
-            prop: 'status',
-            formatter: (row, column, cellValue) => {
-              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
-            }
-          },
-
-          {
-            label: '备注',
-            prop: 'inspectionRemark'
+import { getList } from '@/api/inspectionProject';
+import UserSearch from '@/views/inspectionProject/components/user-search.vue';
+import dictMixins from '@/mixins/dictMixins';
+export default {
+  components: {
+    UserSearch
+  },
+  mixins: [dictMixins],
+
+  data() {
+    return {
+      visible: false,
+      title: '选择质检项',
+
+      columns: [
+        {
+          columnKey: 'selection',
+          type: 'selection',
+          width: 45,
+          align: 'center',
+          reserveSelection: true
+        },
+        {
+          prop: 'inspectionCode',
+          label: '参数编码',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          prop: 'inspectionName',
+          label: '参数名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+
+        {
+          prop: 'textType',
+          label: '参数类型',
+          showOverflowTooltip: true,
+          align: 'center',
+          slot: 'textType',
+          minWidth: 110
+        },
+        {
+          prop: 'defaultValue',
+          label: '默认值',
+          align: 'center',
+          showOverflowTooltip: true,
+          slot: 'defaultValue'
+        },
+        {
+          prop: 'maxValue',
+          label: '参数上限',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'minValue',
+          label: '参数下限',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'unitName',
+          label: '参数单位',
+          align: 'center',
+        },
+
+        // {
+        //   label: '工艺要求',
+        //   prop: 'inspectionStandard',
+        //   formatter: (row, column, cellValue) => {
+        //     return row.symbol + ' ' + cellValue + ' ' + row.unit;
+        //   },
+        //   minWidth: 150
+        // },
+
+        {
+          label: '标准类型',
+          prop: 'type',
+          slot: 'type'
+        },
+
+        {
+          prop: 'qualityStandardName',
+          label: '标准名称',
+          align: 'center',
+          minWidth: 110
+        },
+
+        {
+          prop: 'toolList',
+          slot: 'toolList',
+          label: '工具名称',
+          align: 'center',
+          minWidth: 150
+        },
+
+        {
+          label: '状态',
+          prop: 'status',
+          formatter: (row, column, cellValue) => {
+            return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
           }
-        ],
+        },
+
+        {
+          label: '备注',
+          prop: 'inspectionRemark'
+        }
+      ],
+
+      // 表格选中数据
+      selection: [],
 
-        // 表格选中数据
-        selection: [],
+      processData: [],
+      categoryId: null
+    };
+  },
 
-        processData: [],
-        categoryId: null
-      };
+  watch: {},
+  methods: {
+    open(categoryId) {
+      this.categoryId = categoryId;
+      this.visible = true;
     },
 
-    watch: {},
-    methods: {
-      open(categoryId) {
-        this.categoryId = categoryId;
-        this.visible = true;
-      },
-
-      /* 表格数据源 */
-      async datasource({ page, limit, where }) {
-        const res = await getList({
-          ...where,
-          categoryLevelId: this.categoryId,
-          pageNum: page,
-          size: limit
-        });
-
-        return res;
-      },
-
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where: where });
-      },
-
-      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) => {
-          return {
-            inspectionItemId: m.id,
-            status: 1,
-            mode: null,
-            version: null,
-            categoryLevelId: this.categoryId,
-            rootCategoryLevelId: '12'
-          };
-        });
-
-        this.$emit('chooseProcess', _arr);
-        this.handleClose();
+    /* 表格数据源 */
+    async datasource({ page, limit, where }) {
+      const res = await getList({
+        ...where,
+        categoryLevelId: this.categoryId,
+        pageNum: page,
+        size: limit
+      });
+
+      return res;
+    },
+
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where: where });
+    },
+
+    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) => {
+        return {
+          inspectionItemId: m.id,
+          status: 1,
+          mode: null,
+          version: null,
+          categoryLevelId: this.categoryId,
+          rootCategoryLevelId: '12'
+        };
+      });
+
+      this.$emit('chooseProcess', _arr);
+      this.handleClose();
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .btns {
-    text-align: center;
-    padding: 10px 0;
-  }
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
 </style>

+ 211 - 232
src/views/inspectionClassify/components/user-list.vue

@@ -2,25 +2,11 @@
   <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"
-    >
+    <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">
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
-        <el-button
-          size="small"
-          type="primary"
-          icon="el-icon-plus"
-          class="ele-btn-icon"
-          @click="openAdd()"
-        >
+        <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openAdd()">
           添加质检项
         </el-button>
       </template>
@@ -30,16 +16,16 @@
           row.itemVO.textType == 1
             ? '数值'
             : row.itemVO.textType == 2
-            ? '选择'
-            : row.itemVO.textType == 3
-            ? '上下限'
-            : row.itemVO.textType == 4
-            ? '规格'
-            : row.itemVO.textType == 5
-            ? '时间'
-            : row.itemVO.textType == 6
-            ? '范围'
-            : ''
+              ? '选择'
+              : row.itemVO.textType == 3
+                ? '上下限'
+                : row.itemVO.textType == 4
+                  ? '规格'
+                  : row.itemVO.textType == 5
+                    ? '时间'
+                    : row.itemVO.textType == 6
+                      ? '范围'
+                      : ''
         }}
       </template>
 
@@ -48,24 +34,14 @@
       </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
-        >
+        <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>
 
       <template v-slot:action="{ row }">
-        <el-popconfirm
-          class="ele-action"
-          title="确定要删除此质检项吗?"
-          @confirm="remove(row)"
-        >
+        <el-popconfirm class="ele-action" title="确定要删除此质检项吗?" @confirm="remove(row)">
           <template v-slot:reference>
             <el-link type="danger" :underline="false" icon="el-icon-delete">
               删除
@@ -75,214 +51,217 @@
       </template>
     </ele-pro-table>
 
-    <qualityItem
-      ref="qualityItemRef"
-      @chooseProcess="chooseProcess"
-    ></qualityItem>
+    <qualityItem ref="qualityItemRef" @chooseProcess="chooseProcess"></qualityItem>
   </div>
 </template>
 
 <script>
-  import userSearch from './user-search.vue';
-  import {
-    getList,
-    removeItem,
-    saveBatch
-  } from '@/api/inspectionClassify/index';
-  import dictMixins from '@/mixins/dictMixins';
+import userSearch from './user-search.vue';
+import {
+  getList,
+  removeItem,
+  saveBatch
+} from '@/api/inspectionClassify/index';
+import dictMixins from '@/mixins/dictMixins';
 
-  import qualityItem from './qualityItem.vue';
+import qualityItem from './qualityItem.vue';
 
-  export default {
-    mixins: [dictMixins],
-    components: { userSearch, qualityItem },
-    props: {
-      rootId: [Number, String]
-    },
-    data() {
-      return {
-        // 当前编辑数据
-        current: null,
+export default {
+  mixins: [dictMixins],
+  components: { userSearch, qualityItem },
+  props: {
+    rootId: [Number, String]
+  },
+  data() {
+    return {
+      // 当前编辑数据
+      current: null,
+
+      columns: [
+        {
+          prop: 'itemVO.categoryLevelClassName',
+          label: '质检分类层级',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 150
+        },
+        {
+          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
+        },
 
-        columns: [
-          {
-            prop: 'itemVO.categoryLevelClassName',
-            label: '质检分类层级',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 150
-          },
-          {
-            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.textType',
-            label: '参数类型',
-            showOverflowTooltip: true,
-            align: 'center',
-            slot: 'textType',
-            minWidth: 110
-          },
+        {
+          prop: 'itemVO.maxValue',
+          label: '参数上限',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'itemVO.minValue',
+          label: '参数下限',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'itemVO.defaultValue',
+          label: '默认值',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'itemVO.maxValue',
-            label: '参数上限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'itemVO.minValue',
-            label: '参数下限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'itemVO.defaultValue',
-            label: '默认值',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          // {
-          //   label: '工艺要求',
-          //   prop: 'itemVO.inspectionStandard',
-          //   formatter: (row, column, cellValue) => {
-          //     return (
-          //       row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
-          //     );
-          //   },
-          //   align: 'center',
-          //   minWidth: 150,
-          //   showOverflowTooltip: true
-          // },
-          {
-            label: '标准类型',
-            prop: 'itemVO.type',
-            slot: 'type',
-            align: 'center',
-            minWidth: 120
-          },
-          {
-            prop: 'itemVO.qualityStandardName',
-            label: '标准名称',
-            align: 'center',
-            minWidth: 120
-          },
+        {
+          prop: 'unitName',
+          label: '参数单位',
+          align: 'center',
+        },
+        // {
+        //   label: '工艺要求',
+        //   prop: 'itemVO.inspectionStandard',
+        //   formatter: (row, column, cellValue) => {
+        //     return (
+        //       row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
+        //     );
+        //   },
+        //   align: 'center',
+        //   minWidth: 150,
+        //   showOverflowTooltip: true
+        // },
+        {
+          label: '标准类型',
+          prop: 'itemVO.type',
+          slot: 'type',
+          align: 'center',
+          minWidth: 120
+        },
+        {
+          prop: 'itemVO.qualityStandardName',
+          label: '标准名称',
+          align: 'center',
+          minWidth: 120
+        },
 
-          {
-            label: '状态',
-            prop: 'status',
-            align: 'center',
-            formatter: (row, column, cellValue) => {
-              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
-            }
-          },
+        {
+          label: '状态',
+          prop: 'status',
+          align: 'center',
+          formatter: (row, column, cellValue) => {
+            return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
+          }
+        },
 
-          {
-            prop: 'itemVO.toolList',
-            slot: 'toolList',
-            label: '工具名称',
-            align: 'center',
-            minWidth: 120,
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'itemVO.toolList',
+          slot: 'toolList',
+          label: '工具名称',
+          align: 'center',
+          minWidth: 120,
+          showOverflowTooltip: true
+        },
 
-          {
-            label: '备注',
-            prop: 'inspectionRemark',
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            label: '操作',
-            align: 'center',
-            fixed: 'right',
+        {
+          label: '备注',
+          prop: 'inspectionRemark',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          label: '操作',
+          align: 'center',
+          fixed: 'right',
 
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ]
-      };
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ]
+    };
+  },
+  created() { },
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      return getList({
+        ...where,
+        pageNum: page,
+        size: limit,
+        categoryLevelId: this.categoryLevelId || 12,
+        rootCategoryLevelId: this.rootId
+      });
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({
+        pageNum: 1,
+        where: where,
+        categoryLevelId: this.categoryLevelId,
+        rootCategoryLevelId: this.rootId
+      });
     },
-    created() {},
-    methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
-        return getList({
-          ...where,
-          pageNum: page,
-          size: limit,
-          categoryLevelId: this.categoryLevelId || 12,
-          rootCategoryLevelId: this.rootId
-        });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({
-          pageNum: 1,
-          where: where,
-          categoryLevelId: this.categoryLevelId,
-          rootCategoryLevelId: this.rootId
-        });
-      },
 
-      /* 打开编辑弹窗 */
-      openAdd() {
-        this.$refs.qualityItemRef.open(this.categoryLevelId || 12);
-      },
+    /* 打开编辑弹窗 */
+    openAdd() {
+      this.$refs.qualityItemRef.open(this.categoryLevelId || 12);
+    },
 
-      openDetail(row) {
-        console.log(row);
-      },
+    openDetail(row) {
+      console.log(row);
+    },
 
-      chooseProcess(data) {
-        saveBatch(data).then((res) => {
-          if (res.code == 0) {
-            this.$message.success(res.message);
-            this.reload();
-          }
-        });
-      },
+    chooseProcess(data) {
+      saveBatch(data).then((res) => {
+        if (res.code == 0) {
+          this.$message.success(res.message);
+          this.reload();
+        }
+      });
+    },
 
-      /* 删除 */
-      remove(row) {
-        const loading = this.$loading({ lock: true });
-        removeItem([row.id])
-          .then((msg) => {
-            loading.close();
-            this.$message.success(msg);
-            this.reload();
-          })
-          .catch((e) => {
-            loading.close();
-          });
-      },
-      done() {
-        this.$refs.searchRef.search();
-      },
+    /* 删除 */
+    remove(row) {
+      const loading = this.$loading({ lock: true });
+      removeItem([row.id])
+        .then((msg) => {
+          loading.close();
+          this.$message.success(msg);
+          this.reload();
+        })
+        .catch((e) => {
+          loading.close();
+        });
+    },
+    done() {
+      this.$refs.searchRef.search();
+    },
 
-      clickSearch(info) {
-        this.categoryLevelId = info.id;
-        this.rootCategoryLevelId = info.rootCategoryLevelId;
-        this.reload();
-      }
+    clickSearch(info) {
+      this.categoryLevelId = info.id;
+      this.rootCategoryLevelId = info.rootCategoryLevelId;
+      this.reload();
     }
-  };
+  }
+};
 </script>

+ 0 - 1
src/views/inspectionPlan/components/baseInfo.vue

@@ -486,7 +486,6 @@ export default {
 
     async getProductDetails(val) {
       const data = await getDetailInfo(val)
-      console.log(data, '产品详情')
       this.categoryInfo = data.category
 
       this.$emit('getCategoryInfo', this.categoryInfo)

+ 32 - 17
src/views/inspectionPlan/components/edit.vue

@@ -23,7 +23,7 @@
                 </el-dropdown-menu>
               </el-dropdown>
             </template>
-            <template v-slot:toolkit v-if="conditionType == 2">
+            <template v-slot:toolkit v-if="this.baseForm.qualityMode == 2 && conditionType == 2">
               <div>
                 <div style="display: flex;align-items: center;">
                   <el-input v-model="formData.number" style="width: 120px;" placeholder="请输入" size="mini"
@@ -256,6 +256,8 @@ export default {
       },
       isConsumable: '',
       conditionType: null,
+
+      sampleListCode: ''
     };
   },
   computed: {
@@ -479,6 +481,8 @@ export default {
         if (res1.list[0].status != 2) {
           res = res1.list
           this.isCheck = true;
+          console.log('this.isCheck=true', this.isCheck)
+
         } else {
           res = []
           this.$message.error('此数据已质检,无需再次质检!');
@@ -495,6 +499,7 @@ export default {
           if (resData.qualityControl != 2) {
             this.isCheck = false;
             res = [resData];
+            console.log('this.isCheck=false', this.isCheck)
           } else {
             res = []
             this.$message.error('此数据已质检,无需再次质检!');
@@ -533,12 +538,18 @@ export default {
         this.$refs.table12.setData([]);
       }
     },
-    aaa() {
+    //获取样品编码
+    async getSampleCode() {
+      const code = await getCode('sample_code');
+      this.sampleListCode = code;
+    },
+    async aaa() {
       console.log('aaa')
       let packingList = this.$refs.table12.getData();
 
       if (this.baseForm.qualityMode == 1) {
         this.sampleList = [];
+
         if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack != '') {
           if (this.baseForm.isUnpack == 2) {
             const num = Number(this.baseForm.productNumber || 0);
@@ -563,6 +574,7 @@ export default {
           } else {
             if (this.baseForm.qualityMode == 1) {
               this.sampleList = packingList;
+              console.log(this.sampleList, 'this.sampleList222')
               this.samplePagination.currentPage = 1;
               this.samplePagination.total = packingList.length;
             } else {
@@ -576,6 +588,7 @@ export default {
 
     },
     getUnpackSamList(list, num) {
+      console.log('拆包getUnpackSamList')
       let data = [];
       list.forEach(oldItem => {
         const newMeasureQuantity = oldItem.measureQuantity / this.baseForm.productNumber;
@@ -650,9 +663,12 @@ export default {
       this.baseForm.sampleNumber = selection.length;
       //如果取小样
       if (this.conditionType == 2) {
-        // this.baseForm.sampleMeasureUnit = this.$refs.table12.getData()[0].measureUnit
         const data1 = this.$refs.table12.getData()
-        this.formData.sampleUnit = data1[0]?.measureUnit;
+        this.$set(this.formData, 'sampleUnit', data1[0]?.measureUnit);
+        this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
+
+        // this.formData.sampleUnit = data1[0]?.measureUnit;
+        // this.baseForm.sampleMeasureUnit = data1[0].measureUnit
       }
     },
 
@@ -796,14 +812,17 @@ export default {
       this.conditionType = val;
       //清空样品清单列表
       this.sampleList = []
+      let dataS = this.$refs.table12.getData()
       //取整样
       if (val == 1) {
-        this.sampleList = this.$refs.table12.getData()
-        this.formData.portion = this.$refs.table12.getData().length
+        this.sampleList = dataS
+        this.formData.portion = dataS.length
         this.$refs.table12.toggleAllSelection();
         this.activeName = '2'
         this.$message.success('取样成功!');
       } else if (val == 2) {
+        this.formData.sampleUnit = dataS[0].measureUnit
+
         this.$refs.table12.clearSelection();
         //小样
         if (this.selectedList.length == 0) {
@@ -865,8 +884,8 @@ export default {
     },
     handleSampleSubmit() {
       this.sampleList = []
-      if (this.formData.portion == null || this.formData.portion == 0) {
-        this.$message.warning('生成取样数量不能为空!');
+      if (this.formData.portion == null || this.formData.portion == 0 || this.formData.number == '' || this.formData.number == null) {
+        this.$message.warning('计量数量或者取样数量不能为空!');
         return;
       }
       this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
@@ -889,21 +908,17 @@ export default {
     },
     getNewSampleList(measureQ, unit, nums) {
       this.sampleList = [];
-      // let data = [];
       if (!this.selectedList || this.selectedList.length == 0) {
         this.$message.warning('请先选择样品!');
         return;
       }
-      this.selectedList.forEach((oldItem, index) => {
 
-        this.$set(oldItem, 'id', null);
-        this.$set(oldItem, 'measureQuantity', measureQ);
-        this.$set(oldItem, 'measureUnit', unit);
+      this.sampleList = this.selectedList.map(oldItem => {
+        const newItem = JSON.parse(JSON.stringify(oldItem));
+        newItem.measureQuantity = measureQ;
+        newItem.measureUnit = unit;
+        return newItem;
       });
-
-      console.log(this.selectedList, 'datadatadatadatadatadata', nums)
-
-      this.sampleList = this.selectedList;
     },
     handleCancel() {
       this.takeAsampleVisible = false;

+ 201 - 239
src/views/inspectionProject/index.vue

@@ -4,33 +4,14 @@
       <!-- 搜索表单 -->
       <user-search @search="reload" />
       <!-- 数据表格 -->
-      <ele-pro-table
-        ref="table"
-        :columns="columns"
-        :datasource="datasource"
-        :selection.sync="selection"
-        row-key="code"
-      >
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="code">
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-plus"
-            class="ele-btn-icon"
-            @click="openEdit()"
-          >
+          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit()">
             新建
           </el-button>
 
-          <el-button
-            type="primary"
-            size="mini"
-            icon="el-icon-upload2"
-            plain
-            @click="uploadFile"
-            >导入</el-button
-          >
+          <el-button type="primary" size="mini" icon="el-icon-upload2" plain @click="uploadFile">导入</el-button>
         </template>
 
         <template v-slot:maxValue="{ row }">
@@ -51,18 +32,18 @@
             row.textType == 1
               ? '数值'
               : row.textType == 2
-              ? '选择'
-              : row.textType == 3
-              ? '上下限'
-              : row.textType == 4
-              ? '规格'
-              : row.textType == 5
-              ? '时间'
-              : row.textType == 6
-              ? '范围'
-              : row.textType == 7
-              ? '文本'
-              : ''
+                ? '选择'
+                : row.textType == 3
+                  ? '上下限'
+                  : row.textType == 4
+                    ? '规格'
+                    : row.textType == 5
+                      ? '时间'
+                      : row.textType == 6
+                        ? '范围'
+                        : row.textType == 7
+                          ? '文本'
+                          : ''
           }}
         </template>
 
@@ -71,33 +52,19 @@
         </template>
 
         <template v-slot:toolList="{ row }">
-          <div
-            style="display: inline-block"
-            v-for="(item, idx) in row.toolList"
-            :key="idx"
-            >{{ item.name }}
-            <span v-if="row.toolList && idx != row.toolList.length - 1"
-              >,
-            </span></div
-          >
+          <div style="display: inline-block" v-for="(item, idx) in row.toolList" :key="idx">{{ item.name }}
+            <span v-if="row.toolList && idx != row.toolList.length - 1">,
+            </span>
+          </div>
         </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" @click="openEdit(row)">
             修改
           </el-link>
 
-          <el-popconfirm
-            class="ele-action"
-            title="确定要删除当前质检吗?"
-            @confirm="remove(row)"
-          >
+          <el-popconfirm class="ele-action" title="确定要删除当前质检吗?" @confirm="remove(row)">
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
                 删除
@@ -108,216 +75,211 @@
       </ele-pro-table>
     </el-card>
     <!-- 编辑弹窗 -->
-    <user-edit
-      :visible.sync="showEdit"
-      :data="current"
-      @done="reload"
-      ref="userEdit"
-    />
+    <user-edit :visible.sync="showEdit" :data="current" @done="reload" ref="userEdit" />
     <!-- 导入弹窗 -->
 
-    <importDialog
-      :defModule="moudleName"
-      ref="importDialogRef"
-      @success="reload"
-    ></importDialog>
+    <importDialog :defModule="moudleName" ref="importDialogRef" @success="reload"></importDialog>
   </div>
 </template>
 
 <script>
-  import UserSearch from './components/user-search.vue';
-  import UserEdit from './components/user-edit.vue';
-  import importDialog from '@/components/upload/import-dialog.vue';
+import UserSearch from './components/user-search.vue';
+import UserEdit from './components/user-edit.vue';
+import importDialog from '@/components/upload/import-dialog.vue';
 
-  import { getList, removeItem } from '@/api/inspectionProject';
-  import dictMixins from '@/mixins/dictMixins';
-  export default {
-    name: 'inspectionProject',
-    components: {
-      UserSearch,
-      UserEdit,
-      importDialog
-    },
-    mixins: [dictMixins],
-    data() {
-      return {
-        // 表格列配置
-        columns: [
-          {
-            prop: 'inspectionCode',
-            label: '参数编码',
-            align: 'center',
-            minWidth: 130
-          },
-          {
-            prop: 'inspectionName',
-            label: '参数名称',
+import { getList, removeItem } from '@/api/inspectionProject';
+import dictMixins from '@/mixins/dictMixins';
+export default {
+  name: 'inspectionProject',
+  components: {
+    UserSearch,
+    UserEdit,
+    importDialog
+  },
+  mixins: [dictMixins],
+  data() {
+    return {
+      // 表格列配置
+      columns: [
+        {
+          prop: 'inspectionCode',
+          label: '参数编码',
+          align: 'center',
+          minWidth: 130
+        },
+        {
+          prop: 'inspectionName',
+          label: '参数名称',
 
-            align: 'center',
-            minWidth: 110
-          },
+          align: 'center',
+          minWidth: 110
+        },
 
-          {
-            prop: 'textType',
-            label: '参数类型',
+        {
+          prop: 'textType',
+          label: '参数类型',
 
-            align: 'center',
-            slot: 'textType',
-            minWidth: 110
-          },
+          align: 'center',
+          slot: 'textType',
+          minWidth: 110
+        },
 
-          {
-            prop: 'defaultValue',
-            slot: 'defaultValue',
-            label: '默认值',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'defaultValue',
+          slot: 'defaultValue',
+          label: '默认值',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'maxValue',
-            slot: 'maxValue',
-            label: '参数上限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'minValue',
-            slot: 'minValue',
-            label: '参数下限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          // {
-          //   label: '工艺要求',
-          //   prop: 'inspectionStandard',
-          //   formatter: (row, column, cellValue) => {
-          //     return row.symbol + ' ' + cellValue + ' ' + row.unit;
-          //   },
-          //   minWidth: 150
-          // },
+        {
+          prop: 'maxValue',
+          slot: 'maxValue',
+          label: '参数上限',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'minValue',
+          slot: 'minValue',
+          label: '参数下限',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        // {
+        //   label: '工艺要求',
+        //   prop: 'inspectionStandard',
+        //   formatter: (row, column, cellValue) => {
+        //     return row.symbol + ' ' + cellValue + ' ' + row.unit;
+        //   },
+        //   minWidth: 150
+        // },
 
-          {
-            label: '标准类型',
-            prop: 'type',
-            slot: 'type'
-          },
+        {
+          label: '标准类型',
+          prop: 'type',
+          slot: 'type'
+        },
+        {
+          prop: 'unitName',
+          label: '参数单位',
+          align: 'center',
+        },
+        {
+          prop: 'qualityStandardName',
+          label: '标准名称',
+          align: 'center',
+          minWidth: 110
+        },
 
-          {
-            prop: 'qualityStandardName',
-            label: '标准名称',
-            align: 'center',
-            minWidth: 110
-          },
+        {
+          prop: 'toolList',
+          slot: 'toolList',
+          label: '工具名称',
+          align: 'center',
+          minWidth: 150
+        },
 
-          {
-            prop: 'toolList',
-            slot: 'toolList',
-            label: '工具名称',
-            align: 'center',
-            minWidth: 150
-          },
+        {
+          label: '状态',
+          prop: 'status',
+          formatter: (row, column, cellValue) => {
+            return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
+          }
+        },
 
-          {
-            label: '状态',
-            prop: 'status',
-            formatter: (row, column, cellValue) => {
-              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
-            }
-          },
+        {
+          label: '备注',
+          prop: 'inspectionRemark'
+        },
 
-          {
-            label: '备注',
-            prop: 'inspectionRemark'
-          },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 220,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ],
 
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 220,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ],
+      // 表格选中数据
+      selection: [],
+      // 当前编辑数据
+      current: null,
+      // 是否显示编辑弹窗
+      showEdit: false,
+      // 是否显示导入弹窗
+      showImport: false,
+      moudleName: ''
+    };
+  },
+  methods: {
+    /*回显类型 */
 
-        // 表格选中数据
-        selection: [],
-        // 当前编辑数据
-        current: null,
-        // 是否显示编辑弹窗
-        showEdit: false,
-        // 是否显示导入弹窗
-        showImport: false,
-        moudleName: ''
-      };
+    /* 表格数据源 */
+    datasource({ page, where, limit }) {
+      return getList({
+        ...where,
+        pageNum: page,
+        size: limit
+      });
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where: where });
     },
-    methods: {
-      /*回显类型 */
-
-      /* 表格数据源 */
-      datasource({ page, where, limit }) {
-        return getList({
-          ...where,
-          pageNum: page,
-          size: limit
-        });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where: where });
-      },
 
-      uploadFile() {
-        this.$refs.importDialogRef.open();
-      },
+    uploadFile() {
+      this.$refs.importDialogRef.open();
+    },
 
-      /* 打开编辑弹窗 */
-      openEdit(row) {
-        this.current = row;
-        this.showEdit = true;
-        this.$refs.userEdit.$refs.form &&
-          this.$refs.userEdit.$refs.form.clearValidate();
-      },
+    /* 打开编辑弹窗 */
+    openEdit(row) {
+      this.current = row;
+      this.showEdit = true;
+      this.$refs.userEdit.$refs.form &&
+        this.$refs.userEdit.$refs.form.clearValidate();
+    },
 
-      /* 删除 */
-      remove(row) {
-        const loading = this.$loading({ lock: true });
+    /* 删除 */
+    remove(row) {
+      const loading = this.$loading({ lock: true });
 
-        removeItem([row.id])
-          .then((msg) => {
-            loading.close();
-            this.$message.success('删除' + msg);
-            this.reload();
-          })
-          .catch((e) => {
-            loading.close();
-          });
-      },
-      /* 批量删除 */
-      removeBatch() {
-        if (!this.selection.length) {
-          this.$message.error('请至少选择一条数据');
-          return;
-        }
-        this.$confirm('确定要删除选中的质检吗?', '提示', {
-          type: 'warning'
+      removeItem([row.id])
+        .then((msg) => {
+          loading.close();
+          this.$message.success('删除' + msg);
+          this.reload();
         })
-          .then(() => {
-            const loading = this.$loading({ lock: true });
-            removeItem(this.selection.map((d) => d.id))
-              .then((msg) => {
-                loading.close();
-                this.$message.success('删除' + msg);
-                this.reload();
-              })
-              .catch((e) => {
-                loading.close();
-              });
-          })
-          .catch(() => {});
+        .catch((e) => {
+          loading.close();
+        });
+    },
+    /* 批量删除 */
+    removeBatch() {
+      if (!this.selection.length) {
+        this.$message.error('请至少选择一条数据');
+        return;
       }
+      this.$confirm('确定要删除选中的质检吗?', '提示', {
+        type: 'warning'
+      })
+        .then(() => {
+          const loading = this.$loading({ lock: true });
+          removeItem(this.selection.map((d) => d.id))
+            .then((msg) => {
+              loading.close();
+              this.$message.success('删除' + msg);
+              this.reload();
+            })
+            .catch((e) => {
+              loading.close();
+            });
+        })
+        .catch(() => { });
     }
-  };
+  }
+};
 </script>

+ 1 - 1
src/views/inspectionWork/components/QualityContentTabs.vue

@@ -22,7 +22,7 @@
               </el-dropdown-menu>
             </el-dropdown>
           </template>
-          <template v-slot:toolkit v-if="conditionType == 2">
+          <template v-slot:toolkit v-if="form.qualityMode == 2 && conditionType == 2">
             <div>
               <div style="display: flex;align-items: center;">
                 <el-input v-model="formData.number" style="width: 120px;" placeholder="请输入" size="mini"

+ 5 - 8
src/views/inspectionWork/edit.vue

@@ -401,17 +401,14 @@ export default {
         this.$message.warning('请先选择来源清单!');
         return;
       }
-      this.selectedList.forEach((oldItem, index) => {
 
-        this.$set(oldItem, 'id', null);
-        this.$set(oldItem, 'measureQuantity', measureQ);
-        this.$set(oldItem, 'measureUnit', unit);
+      this.sampleList = this.selectedList.map(oldItem => {
+        const newItem = JSON.parse(JSON.stringify(oldItem));
+        newItem.measureQuantity = measureQ;
+        newItem.measureUnit = unit;
+        return newItem;
       });
 
-      console.log(this.selectedList, 'datadatadatadatadatadata', nums)
-
-      this.sampleList = this.selectedList;
-
       this.$refs.tabsRef.tabsChange('2')
     },
 

+ 13 - 5
src/views/inspectionWork/index.vue

@@ -46,10 +46,10 @@
           <el-link type="primary" :underline="false" v-if="row.status == 0" @click="openEdit('edit', row)">
             报工
           </el-link>
-          <!-- <el-link type="primary" :underline="false" @click="openNumber(row)">
+          <el-link type="primary" :underline="false" @click="openNumber(row)">
             合格证
           </el-link>
-          <el-link type="primary" :underline="false">
+          <!-- <el-link type="primary" :underline="false">
             质检报告
           </el-link> -->
           <!-- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(row)" v-if="row.status == 0">
@@ -80,7 +80,7 @@
 <script>
 import search from './components/search.vue';
 
-import { getList, removeItem } from '@/api/inspectionWork';
+import { getList, removeItem, updateCertificateNumber } from '@/api/inspectionWork';
 import dictMixins from '@/mixins/dictMixins';
 import { getFile } from '@/api/system/file';
 
@@ -267,7 +267,8 @@ export default {
       formData: {
         certificateNumber: ''
       },
-      certificateVisible: false
+      certificateVisible: false,
+      rowData: {}
     };
   },
   created() {
@@ -337,12 +338,19 @@ export default {
     },
     openNumber(row) {
       this.formData.certificateNumber = row.certificateNumber;
+      this.rowData = row;
       this.certificateVisible = true
     },
     handleClose() {
       this.certificateVisible = false;
     },
-    handleSubmit() {
+    async handleSubmit() {
+      this.rowData.certificateNumber = this.formData.certificateNumber;
+      const data = await updateCertificateNumber(this.rowData)
+      if (data) {
+        this.$message.success('修改成功!');
+        this.done();
+      }
       this.certificateVisible = false;
     }
   }