yusheng 11 месяцев назад
Родитель
Сommit
fd05d3f8b9

+ 74 - 0
src/api/experimentReport/index.js

@@ -0,0 +1,74 @@
+import request from '@/utils/request';
+
+// 列表
+
+export async function getList(params) {
+  const res = await request.get(`/qms/taskmonad/page`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//收样
+
+export async function sampleCollection(data) {
+  const res = await request.put(`/qms/taskmonad/sampleCollection`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 保存
+export async function save(data) {
+  const res = await request.post(`/qms/experiment/save`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 修改
+export async function update(data) {
+  const res = await request.put(`/qms/experiment/update`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//请托
+export async function qualityInspectionItemRequest(data) {
+  const res = await request.post(
+    `/qms/quality_work_order/qualityInspectionItemRequest`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//任务报工
+export async function exeTaskReportWork(data) {
+  const res = await request.post(`/qms/taskmonad/exeReportWork`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//请托报工
+export async function exeEntrustReportWork(data) {
+  const res = await request.post(`/qms/requestentrust/exeReportWork`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 获取详情
+export async function getById(id) {
+  const res = await request.get(`/qms/experiment/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 2
src/api/main/index.js

@@ -60,7 +60,6 @@ export async function getCategoryByCode(code) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 规则记录分页查询
 export async function recordrulesPage(body) {
   const res = await request.post(`/main/recordrules/page`, body);
@@ -89,4 +88,12 @@ export async function recordrulesTypePage(body) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+export async function recordrulesGetById(id) {
+  const res = await request.get(`/main/recordrules/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 15 - 14
src/components/releaseRules/index.vue

@@ -68,7 +68,7 @@
 <script>
   import search from './search.vue';
   import dictMixins from '@/mixins/dictMixins';
-  import { recordrulesPage, recordrulesTypePage } from '@/api/main/index';
+  import { recordrulesPage, recordrulesTypePage,recordrulesGetById } from '@/api/main/index';
   export default {
     components: { search },
     mixins: [dictMixins],
@@ -215,18 +215,18 @@
               return this.$util.toDateString(row.stopDate, 'yyyy-MM-dd');
             }
           },
-          {
-            prop: '',
-            label: '周期',
-            align: 'center',
-            showOverflowTooltip: true,
-            formatter: (row) => {
-              return (
-                row.frequencyValue +
-                this.getDictValue('规则周期', row.frequencyUnit)
-              );
-            }
-          },
+          // {
+          //   prop: '',
+          //   label: '周期',
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   formatter: (row) => {
+          //     return (
+          //       row.frequencyValue +
+          //       this.getDictValue('规则周期', row.frequencyUnit)
+          //     );
+          //   }
+          // },
           {
             prop: 'createUserName',
             label: '创建人',
@@ -273,7 +273,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 260,
+            width: 60,
             align: 'center',
             resizable: false,
             slot: 'action',
@@ -399,6 +399,7 @@
         tree.forEach(clean);
 
         this.typeTree = tree; // 结果树
+        console.log(this.typeTree,'this.treeNode')
 
         if (!this.treeNode) {
           // 默认选中第一个节点

+ 44 - 0
src/components/templateDiv/experimentationProcessDialog.vue

@@ -0,0 +1,44 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal
+    width="80%"
+    :visible.sync="visible"
+    title="预览模板"
+    :close-on-click-modal="false"
+    :maxable="true"
+    :resizable="true"
+    append-to-body
+  >
+    <experimentationProcess
+      ref="experimentationProcess"
+      :edit="false"
+    ></experimentationProcess>
+    <template v-slot:footer>
+      <el-button @click="visible = false"> 关闭 </el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import experimentationProcess from './experimentationProcess.vue';
+
+  export default {
+    components: { experimentationProcess },
+
+    data() {
+      return {
+        visible: false
+      };
+    },
+
+    created() {},
+    methods: {
+      open(data) {
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.experimentationProcess.init(data);
+        });
+      }
+    }
+  };
+</script>

+ 110 - 0
src/components/upload/imgList.vue

@@ -0,0 +1,110 @@
+<template>
+  <div>
+    <el-upload
+      action="#"
+      list-type="picture-card"
+      :on-preview="handlePictureCardPreview"
+      :on-remove="handleRemove"
+      accept="image/png,image/jpeg,image/jpg"
+      ref="uploadRef"
+      :http-request="handlRequest"
+      :before-upload="handlSuccess"
+      :file-list="value"
+      :multiple="true"
+    >
+      <i class="el-icon-plus"></i>
+    </el-upload>
+    <el-dialog :visible.sync="dialogVisible" append-to-body>
+      <img width="100%" :src="dialogImageUrl" alt="" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import { uploadFile, removeFile } from '@/api/system/file/index.js';
+  // import { getImageUrl } from '@/utils/file';
+  export default {
+    props: {
+      value: {
+        type: Object,
+        default: () => []
+      }
+    },
+    data() {
+      return {
+        dialogImageUrl: '',
+        dialogVisible: false,
+        fileList: []
+      };
+    },
+
+    methods: {
+      async handleRemove(file, fileList) {
+        this.$emit('input', fileList);
+        // if (!file.id) {
+        //   return;
+        // }
+        // await removeFile({ fileId: file.id });
+      },
+      handlePictureCardPreview(file) {
+        this.dialogImageUrl = file.url;
+        this.dialogVisible = true;
+      },
+
+      //图片添加
+      async handlSuccess(file) {
+        // console.log(params,'params')
+        let res = await uploadFile({
+          multiPartFile: file,
+          module: 'main'
+        });
+        if (res?.data) {
+          this.$emit('input', [...(this.value || []), res.data]);
+        }
+      },
+      handlRequest() {
+        return Promise.resolve();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .img-view {
+    width: 280px;
+    height: 342px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    border-width: 1px;
+    border-style: solid;
+    border-color: rgba(215, 215, 215, 1);
+
+    img {
+      max-width: 100%;
+      max-height: 100%;
+    }
+  }
+
+  .placeholder-box {
+    width: 250px;
+    height: 200px;
+    text-align: center;
+
+    background-color: rgba(242, 242, 242, 1);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    border-color: rgba(215, 215, 215, 1);
+    padding-top: 60px;
+
+    img {
+      width: 100px;
+      height: 100px;
+    }
+  }
+
+  .btn-box {
+    display: flex;
+    justify-content: space-around;
+  }
+</style>

+ 6 - 0
src/enum/dict.js

@@ -21,6 +21,12 @@ export default {
   工种类型: 'work_type',
   工作流任务分配自定义脚本: 'bpm_task_assign_script',
   流程实例的结果: 'bpm_process_instance_result',
+  业务类型: 'business_type',
+  行业类别: 'industry_type',
+  记录表模板样式: 'record_template_style',
+  放行类型: 'checklist_type',
+  记录规则报工类型: 'record_rules_report_work_type',
+
 };
 
 export const numberList = [

+ 198 - 167
src/views/inspectionProject/components/ProductModal.vue

@@ -38,10 +38,17 @@
             :columns="columns"
             :datasource="datasource"
             :selection.sync="selection"
+            @cell-click="cellClick"
             row-key="id"
-              @columns-change="handleColumnChange"
-              :cache-key="cacheKeyUrl"
+            @columns-change="handleColumnChange"
+            :cache-key="cacheKeyUrl"
           >
+            <!-- 表头工具栏 -->
+            <template v-slot:action="{ row }">
+              <el-radio class="radio" v-model="radio" :label="row.id">
+                <i></i>
+              </el-radio>
+            </template>
           </ele-pro-table>
         </template>
       </ele-split-layout>
@@ -55,191 +62,215 @@
 </template>
 
 <script>
-import ProductSearch from './product-search.vue';
-import {
-  getTreeByPid,
-  getList,
-  getProduceTreeByPid
-} from '@/api/classifyManage';
+  import ProductSearch from './product-search.vue';
+  import {
+    getTreeByPid,
+    getList,
+    getProduceTreeByPid
+  } from '@/api/classifyManage';
   import tabMixins from '@/mixins/tableColumnsMixin';
-export default {
-  components: {
-    ProductSearch
-  },
-  mixins:[tabMixins],
-  data() {
-    return {
-      cacheKeyUrl: 'qms-c2e9664a-inspectionProject-components-ProductModal',
-      visible: false,
-      title: '选择工具',
-
-      categoryLevelId: null,
-      categoryId: 1,
-      treeList: [],
-      treeLoading: false,
-
-      defaultProps: {
-        children: 'children',
-        label: 'name'
-      },
-      type: null,
-
-      // 表格列配置
-      columns: [
-        {
-          columnKey: 'selection',
-          type: 'selection',
-          width: 45,
-          align: 'center',
-          selectable: (row, index) => {
-            return !this.processData.some((it) => row.id == it.categoryId);
-          },
-          reserveSelection: true,
-          fixed: 'left'
-        },
+  export default {
+    components: {
+      ProductSearch
+    },
+    mixins: [tabMixins],
+    data() {
+      return {
+        cacheKeyUrl: 'qms-c2e9664a-inspectionProject-components-ProductModal',
+        visible: false,
+        title: '选择工具',
 
-        {
-          label: '物料名称',
-          prop: 'name'
-        },
+        categoryLevelId: null,
+        categoryId: 1,
+        treeList: [],
+        treeLoading: false,
 
-        {
-          label: '物料编码',
-          prop: 'code'
-        },
-        {
-          label: '牌号',
-          prop: 'brandNum'
-        },
-        {
-          label: '型号',
-          prop: 'modelType'
+        defaultProps: {
+          children: 'children',
+          label: 'name'
         },
+        type: null,
+        currentIndex: -1,
+        // 表格列配置
 
-        {
-          prop: 'availableCountBase',
-          label: '包装库存',
-          sortable: 'custom'
-        },
-        {
-          label: '单位',
-          prop: 'weightUnit'
-        },
+        // 表格选中数据
+        selection: [],
+        processData: [],
+        radio: '',
+        current: null
+      };
+    },
+    computed: {
+      columns() {
+        let data = null;
+        if (this.currentIndex == -1) {
+          data = {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            selectable: (row, index) => {
+              return !this.processData.some((it) => row.id == it.categoryId);
+            },
+            reserveSelection: true,
+            fixed: 'left'
+          };
+        } else {
+          data = {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择',
+            fixed: 'left',
+            reserveSelection: true
+          };
+        }
 
-        {
-          prop: 'packingCountBase',
-          label: '计量库存',
-          sortable: 'custom'
-        },
+        return [
+          data,
+          {
+            label: '物料名称',
+            prop: 'name'
+          },
 
-        {
-          label: '计量单位',
-          prop: 'unit'
-        },
+          {
+            label: '物料编码',
+            prop: 'code'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum'
+          },
+          {
+            label: '型号',
+            prop: 'modelType'
+          },
 
-        {
-          label: '数量',
-          prop: 'count'
-        }
-      ],
-
-      // 表格选中数据
-      selection: [],
-
-      processData: [],
-      current: null
-    };
-  },
-
-  watch: {},
-  methods: {
-    /* 表格数据源 */
-    async datasource({ page, limit, where }) {
-      const res = await getList({
-        ...where,
-        pageNum: page,
-        size: limit,
-        categoryLevelId: this.categoryLevelId
-      });
-      return res;
-    },
+          {
+            prop: 'availableCountBase',
+            label: '包装库存',
+            sortable: 'custom'
+          },
+          {
+            label: '单位',
+            prop: 'weightUnit'
+          },
+
+          {
+            prop: 'packingCountBase',
+            label: '计量库存',
+            sortable: 'custom'
+          },
 
-    open(item) {
-      this.processData = item || [];
-      this.visible = true;
+          {
+            label: '计量单位',
+            prop: 'unit'
+          },
 
-      this.getTreeData();
+          {
+            label: '数量',
+            prop: 'count'
+          }
+        ];
+      }
     },
+    watch: {},
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where }) {
+        const res = await getList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId
+        });
+        return res;
+      },
 
-    async getTreeData() {
-      try {
-        this.treeLoading = true;
+      open(item, currentIndex = -1) {
+        this.currentIndex = currentIndex;
+        this.processData = item || [];
+        this.visible = true;
+        this.radio = '';
+        this.getTreeData();
+      },
 
-        const res = await getProduceTreeByPid(5);
-        this.treeLoading = false;
-        if (res?.code === '0') {
-          this.treeList = res.data;
-
-          this.$nextTick(() => {
-            // 默认高亮第一级树节点
-            if (this.treeList[0]) {
-              this.rootTreeId = this.treeList[0].id;
-              this.$nextTick(() => {
-                this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
-              });
-            }
-          });
-          return this.treeList;
-        }
-      } catch (error) {}
-      this.treeLoading = false;
-    },
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
 
-    handleNodeClick(data) {
-      this.categoryLevelId = data.id;
-      this.$refs.table.reload({ pageNum: 1, where: {} });
-    },
+          const res = await getProduceTreeByPid(5);
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
 
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ page: 1, where: where });
-    },
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.rootTreeId = this.treeList[0].id;
+                this.$nextTick(() => {
+                  this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
+                });
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {}
+        this.treeLoading = false;
+      },
 
-    handleClose() {
-      this.visible = false;
-      this.$refs.table.setSelectedRows([]);
-      this.selection = [];
-    },
-    selected() {
-      let _arr = [];
-      if (!this.selection.length) {
-        this.$message.error('请至少选择一条数据');
-        return;
-      }
+      handleNodeClick(data) {
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1, where: {} });
+      },
 
-      _arr = this.selection.map((m) => {
-        m.categoryId = m.id;
-        delete m.id;
-        return {
-          ...m
-        };
-      });
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+      // 单击获取id
+      cellClick(row) {
+        this.current = row;
+        this.radio = row.id;
+      },
+      handleClose() {
+        this.visible = false;
+        this.$refs.table.setSelectedRows([]);
+        this.selection = [];
+      },
+      selected() {
+        let _arr = [];
+        if (this.currentIndex == -1) {
+          _arr = this.selection.map((m) => {
+            m.categoryId = m.id;
+            delete m.id;
+            return {
+              ...m
+            };
+          });
+        } else {
+          _arr = this.current ? [{...this.current,currentIndex:this.currentIndex}] : [];
+        }
 
-      this.$emit('chooseModal', _arr);
-      this.handleClose();
+        if (!_arr.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        this.$emit(this.currentIndex == -1?'chooseModal':'chooseCurrent', _arr);
+        this.handleClose();
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.rx-sc {
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-
-.ml60 {
-  margin-left: 60px;
-}
+  .rx-sc {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .ml60 {
+    margin-left: 60px;
+  }
 </style>

+ 109 - 6
src/views/inspectionTemplate/AddorUpdate.vue

@@ -235,7 +235,44 @@
               </DictSelection>
             </div>
           </template>
-
+          <template v-slot:executionMethod="{ row }">
+            <el-select v-model="row.executionMethod" style="width: 100%">
+              <el-option :value="1" label="常规检验"></el-option>
+              <el-option :value="2" label="实验"></el-option>
+            </el-select>
+          </template>
+          <template v-slot:procedureName="{ row, $index }">
+            <el-input
+              v-model="row.procedureName"
+              @click.native="addTemplate(5, $index)"
+              readonly
+              style="width: calc(100% - 60px)"
+            >
+            </el-input>
+            <el-button
+              type="primary"
+              @click="viewTemplate(row.procedureId)"
+              v-if="row.procedureId"
+              style="margin-left: 8px"
+              >预览</el-button
+            >
+          </template>
+          <template v-slot:recordName="{ row, $index }">
+            <el-input
+              v-model="row.recordName"
+              @click.native="addTemplate(7, $index)"
+              readonly
+              style="width: calc(100% - 60px)"
+            >
+            </el-input>
+            <el-button
+              type="primary"
+              @click="viewTemplate(row.recordId)"
+              v-if="row.recordId"
+              style="margin-left: 8px"
+              >预览</el-button
+            >
+          </template>
           <template v-slot:action="{ row, $index }">
             <el-popconfirm
               class="ele-action"
@@ -307,6 +344,13 @@
       @saveTaskInstance="saveTaskInstance"
       :visible.sync="taskinstanceDialogFlag"
     ></taskinstance-dialog>
+    <releaseRules
+      ref="releaseRulesRef"
+      @success="releaseRulesSuccess"
+    ></releaseRules>
+    <experimentationProcessDialog
+      ref="experimentationProcessDialog"
+    ></experimentationProcessDialog>
   </ele-modal>
 </template>
 
@@ -316,16 +360,25 @@
   import { getByCode } from '@/api/system/dictionary-data';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import taskinstanceDialog from '@/components/procedure/taskinstanceDialog.vue';
-
+  import releaseRules from '@/components/releaseRules/index.vue';
+  import experimentationProcessDialog from '@/components/templateDiv/experimentationProcessDialog.vue';
   import {
     save,
     update,
     getById,
     templatecategoryPage
   } from '@/api/inspectionTemplate';
+  import { recordrulesGetById } from '@/api/main/index';
+
   import { getCode } from '@/api/login';
   export default {
-    components: { termPop, EquipmentDialog, taskinstanceDialog },
+    components: {
+      termPop,
+      EquipmentDialog,
+      taskinstanceDialog,
+      releaseRules,
+      experimentationProcessDialog
+    },
     mixins: [tabMixins],
     data() {
       return {
@@ -346,8 +399,8 @@
           validityPeriod: '',
           validityPeriodUnit: '',
           qualityMode: '',
-          taskId:'',  
-          taskName:'', 
+          taskId: '',
+          taskName: ''
         },
         columns: [
           {
@@ -403,6 +456,30 @@
             minWidth: 400,
             columnKey: 'defaultValue'
           },
+          {
+            prop: 'executionMethod',
+            slot: 'executionMethod',
+            label: '质检方式',
+            showOverflowTooltip: true,
+            align: 'center',
+            width: 150
+          },
+          {
+            prop: 'procedureName',
+            slot: 'procedureName',
+            label: '实验过程',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 200
+          },
+          {
+            prop: 'recordName',
+            slot: 'recordName',
+            label: '实验记录',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 200
+          },
 
           {
             columnKey: 'action',
@@ -494,10 +571,36 @@
         },
         list: [],
         templateCategoryList: [],
-        typeList: []
+        typeList: [],
+        releaseRulesType: '',
+        currentIndex: ''
       };
     },
     methods: {
+      addTemplate(type, index) {
+        this.releaseRulesType = type;
+        this.currentIndex = index;
+        this.$refs.releaseRulesRef.open(type);
+      },
+      async viewTemplate(id) {
+        const data = await recordrulesGetById(id);
+        console.log(data,'data')
+        this.$refs.experimentationProcessDialog.open(data.tempJson.tempJson);
+      },
+      releaseRulesSuccess(data) {
+        if (this.releaseRulesType == 5) {
+          this.$set(this.list[this.currentIndex], 'procedureId', data.id);
+          this.$set(this.list[this.currentIndex], 'procedureCode', data.code);
+          this.$set(this.list[this.currentIndex], 'procedureName', data.name);
+        }
+
+        if (this.releaseRulesType == 7) {
+          this.$set(this.list[this.currentIndex], 'recordId', data.id);
+          this.$set(this.list[this.currentIndex], 'recordCode', data.code);
+          this.$set(this.list[this.currentIndex], 'recordName', data.name);
+        }
+      },
+
       //失去焦点自动排序
       handleSortBlur() {
         this.list = this.list.map((item) => ({

+ 246 - 110
src/views/inspectionWork/components/experimentReport.vue

@@ -12,25 +12,25 @@
     <header-title title="基础信息"> </header-title>
     <el-form
       label-width="115px"
-      :model="{}"
-      :rules="[]"
+      :model="form"
+      :rules="[{}]"
       ref="formRef"
       :disabled="type == 'detail'"
     >
       <el-row>
         <el-col :span="8">
           <el-form-item label="质检项:" prop="inspectionName">
-            {{ projectData.inspectionName }}</el-form-item
+            {{ tableData[0].inspectionName }}</el-form-item
           >
         </el-col>
         <el-col :span="8">
           <el-form-item label="编码:" prop="inspectionCode">
-            {{ projectData.inspectionCode }}
+            {{ tableData[0].inspectionCode }}
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="批次号:" prop="batchNo">
-            {{ projectData.batchNo }}
+            {{ tableData[0].batchNo }}
           </el-form-item>
         </el-col></el-row
       >
@@ -38,25 +38,18 @@
       <ele-pro-table
         :needPage="false"
         :columns="workColumns"
-        :datasource="[projectData]"
+        :datasource="tableData"
       >
-        <template v-slot:qualityResultContent="{ row }">
-          <el-input
-            v-model="row.qualityResultContent"
-            placeholder="请输入内容"
-            :disabled="type == 'detail'"
-            @input="handleInput(row, row.qualityResultContent)"
-          >
-            <template slot="append" v-if="row.unitName">
-              {{ row.unitName }}
-            </template>
-          </el-input>
+        <template v-slot:toolbar>
+          当前质检剩余样品数:{{ getSampleQuantityCount1 }}
         </template>
         <template v-slot:sampleQuantity="{ row, $index }">
           <el-input
             v-model="row.sampleQuantity"
             placeholder="请输入"
+            :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('sampleQuantity', row, $index)"
           >
           </el-input>
         </template>
@@ -67,6 +60,7 @@
             placeholder="请输入"
             :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('qualifiedQuantity', row, $index)"
           >
           </el-input>
         </template>
@@ -76,6 +70,7 @@
             placeholder="请输入"
             :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('noQualifiedQuantity', row, $index)"
           >
           </el-input>
         </template>
@@ -85,6 +80,8 @@
             placeholder="请输入"
             :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('lossNumber', row, $index)"
+            @click.native="curretNum = row.lossNumber"
           >
           </el-input>
         </template>
@@ -94,6 +91,8 @@
             placeholder="请输入"
             :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('lossNumberUnqualified', row, $index)"
+            @click.native="curretNum = row.lossNumberUnqualified"
           >
           </el-input>
         </template>
@@ -103,6 +102,8 @@
             placeholder="请输入"
             :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('retainedSampleQuantity', row, $index)"
+            @click.native="curretNum = row.retainedSampleQuantity"
           >
           </el-input>
         </template>
@@ -112,40 +113,37 @@
             placeholder="请输入"
             :disabled="type == 'detail'"
             type="number"
+            @input="inputValue('retainedSampleUnqualified', row, $index)"
+            @click.native="curretNum = row.retainedSampleUnqualified"
           >
-          </el-input> </template
-      ></ele-pro-table>
-      <header-title title="实验数据"> </header-title>
+          </el-input>
+        </template>
+      </ele-pro-table>
+      <header-title title="实验数据" style="margin-top: 15px"> </header-title>
       <el-row>
         <el-col :span="8">
-          <el-form-item label="实验编号:" prop="industryType">
-            <el-input
-              v-model="form.retainedSampleUnqualified1"
-              placeholder="请输入"
-              :disabled="true"
-              type="number"
-            >
+          <el-form-item label="实验编号:" prop="code">
+            <el-input v-model="form.code" placeholder="请输入" :disabled="true">
             </el-input>
           </el-form-item> </el-col
       ></el-row>
       <el-row>
         <el-col :span="8">
-          <el-form-item label="实验时间:" prop="industryType">
+          <el-form-item label="实验时间:" prop="experimentalTime">
             <el-date-picker
-              v-model="form.retainedSampleUnqualified2"
+              v-model="form.experimentalTime"
               type="datetime"
               placeholder="选择日期时间"
+              value-format="yyyy-MM-dd HH:mm:ss"
               style="width: 100%"
             >
             </el-date-picker>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="执行标准:" prop="pcode">
+          <el-form-item label="执行标准:" prop="qualityStandardName">
             <el-input
-              :value="
-                getDictValue('质检标准类型', projectData.qualityStandardType)
-              "
+              :value="getDictValue('质检标准类型', form.qualityStandardName)"
               placeholder="请输入"
               :disabled="true"
             >
@@ -156,9 +154,9 @@
       <header-title title="实验试/实验设备"> </header-title>
       <el-row>
         <el-col :span="8">
-          <el-form-item label="实验室:" prop="industryType">
+          <el-form-item label="实验室:" prop="workshopId">
             <el-select
-              v-model="form.retainedSampleUnqualified3"
+              v-model="form.workshopId"
               style="width: 100%"
               placeholder="请选择"
             >
@@ -167,28 +165,29 @@
                 :key="item.workshopId"
                 :label="item.workshopName"
                 :value="item.workshopId"
+                @click.native="form.workshopName = item.workshopName"
               >
               </el-option>
             </el-select>
           </el-form-item>
         </el-col>
       </el-row>
-      <el-row v-for="(item, index) in laboratoryItemList">
+      <el-row v-for="(item, index) in form.experimentEquipmentList">
         <el-col :span="24">
           <el-row>
             <el-col :span="8">
               <el-form-item
                 :label="'实验设备' + (index + 1) + ':'"
-                prop="industryType"
+                prop="equipmentName"
               >
-                <el-select
-                  v-model="item.retainedSampleUnqualified4"
-                  style="width: calc(100% - 30px)"
+                <el-input
                   placeholder="请选择"
+                  v-model="item.equipmentName"
+                  @click.native="equipmentOpen(index)"
+                  readonly
+                  style="width: calc(100% - 30px)"
                 >
-                  <el-option :label="'测试设备1'" :value="1"> </el-option>
-                  <el-option :label="'测试设备2'" :value="2"> </el-option>
-                </el-select>
+                </el-input>
                 <i
                   class="el-icon-delete"
                   style="
@@ -206,22 +205,24 @@
         <el-col :span="24">
           <el-row>
             <el-col :span="8">
-              <el-form-item label="开始时间:" prop="industryType">
+              <el-form-item label="开始时间:" prop="startTime">
                 <el-date-picker
-                  v-model="item.retainedSampleUnqualified5"
+                  v-model="item.startTime"
                   type="datetime"
                   placeholder="选择日期时间"
+                  value-format="yyyy-MM-dd HH:mm:ss"
                   style="width: 100%"
                 >
                 </el-date-picker
               ></el-form-item>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="结束时间:" prop="industryType">
+              <el-form-item label="结束时间:" prop="endTime">
                 <el-date-picker
-                  v-model="item.retainedSampleUnqualified6"
+                  v-model="item.endTime"
                   type="datetime"
                   placeholder="选择日期时间"
+                  value-format="yyyy-MM-dd HH:mm:ss"
                   style="width: 100%"
                 >
                 </el-date-picker
@@ -232,9 +233,9 @@
         <el-col :span="24">
           <el-row>
             <el-col :span="16">
-              <el-form-item label="运行参数:" prop="industryType">
+              <el-form-item label="运行参数:" prop="operatingParameters">
                 <el-input
-                  v-model="item.retainedSampleUnqualified7"
+                  v-model="item.operatingParameters"
                   placeholder="请输入"
                 >
                 </el-input
@@ -246,7 +247,7 @@
       <el-row>
         <el-col :span="24">
           <el-form-item label=" " prop="industryType">
-            <el-button type="primary" @click="addlLaboratoryItemList">
+            <el-button type="primary" @click="addExperimentEquipmentList">
               新增实验设备
             </el-button>
           </el-form-item>
@@ -267,25 +268,26 @@
         type="textarea"
         :rows="1"
         placeholder="请输入内容"
-        v-model="projectData.defaultValue"
+        :disabled="true"
+        v-model="form.processRequirementsJson"
       >
       </el-input>
 
-      <el-row> <el-col :span="24"> </el-col></el-row>
-      <header-title title="实验工具"> </header-title>
-      <el-button type="primary" size="small" @click="handleAdd('unitList')"
+      <header-title title="实验工具" style="margin-top: 15px"> </header-title>
+      <el-button type="primary" size="small" @click="handleAdd('toolJson')"
         >选择实验工具</el-button
       >
       <ele-pro-table
         :needPage="false"
         :columns="unitColumns"
-        :datasource="unitList"
+        :datasource="form.toolJson"
+        style="margin-top: 15px"
       >
         <template v-slot:action="{ row, $index }">
           <el-popconfirm
             class="ele-action"
             title="确定要删除此条数据吗?"
-            @confirm="remove($index, 'unitList')"
+            @confirm="remove($index, 'toolJson')"
           >
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -295,14 +297,19 @@
           </el-popconfirm>
         </template>
       </ele-pro-table>
-      <header-title title="实验耗材"> </header-title>
-      <el-button type="primary" size="small" @click="handleAdd('unitList1')"
+
+      <header-title title="实验耗材" style="margin-top: 15px"> </header-title>
+      <el-button
+        type="primary"
+        size="small"
+        @click="handleAdd('consumablesJson')"
         >选择实验耗材</el-button
       >
       <ele-pro-table
         :needPage="false"
         :columns="unitColumns1"
-        :datasource="unitList1"
+        style="margin-top: 15px"
+        :datasource="form.consumablesJson"
       >
         <template v-slot:remark="{ row, $index }">
           <el-input type="textarea" v-model="row.remark"></el-input>
@@ -311,7 +318,7 @@
           <el-popconfirm
             class="ele-action"
             title="确定要删除此条数据吗?"
-            @confirm="remove($index, 'unitList1')"
+            @confirm="remove($index, 'consumablesJson')"
           >
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -321,24 +328,24 @@
           </el-popconfirm>
         </template>
       </ele-pro-table>
-      <header-title title="实验记录"> </header-title>
+      <header-title title="实验记录" style="margin-top: 15px"> </header-title>
       <el-button type="primary" size="small" @click="releaseRulesRefOpen(7)"
         >选择实验记录</el-button
       >
       <el-row>
         <el-col :span="24">
           <experimentationProcess
-            ref="experimentationProcess3"
+            ref="experimentationProcess2"
           ></experimentationProcess> </el-col
       ></el-row>
       <el-row>
         <el-col :span="16">
-          <el-form-item label="实验结果:" prop="industryType">
+          <el-form-item label="实验结果:" prop="resultsDescription">
             <el-input
-              type="textarea"
+              type="resultsDescription"
               :rows="4"
               placeholder="请输入内容"
-              v-model="projectData.textarea"
+              v-model="form.resultsDescription"
             >
             </el-input>
           </el-form-item>
@@ -346,11 +353,8 @@
       </el-row>
       <el-row>
         <el-col :span="8">
-          <el-form-item label="实验结论:" prop="industryType">
-            <el-select
-              v-model="projectData.retainedSampleUnqualified9"
-              placeholder="请选择"
-            >
+          <el-form-item label="实验结论:" prop="results">
+            <el-select v-model="form.results" placeholder="请选择">
               <el-option :label="'合格'" :value="1"> </el-option>
               <el-option :label="'不合格'" :value="2"> </el-option>
             </el-select>
@@ -359,12 +363,16 @@
       </el-row>
       <el-row>
         <el-col :span="24">
-          <el-form-item label="实验图片:" prop="industryType"> </el-form-item>
+          <el-form-item label="实验图片:" prop="imgUrl">
+            <imgList v-model="form.imgUrl"></imgList>
+          </el-form-item>
         </el-col>
       </el-row>
       <el-row>
         <el-col :span="24">
-          <el-form-item label="附件图片:" prop="industryType"> </el-form-item>
+          <el-form-item label="附件图片:" prop="attachmentUrl">
+            <imgList v-model="form.attachmentUrl"></imgList>
+          </el-form-item>
         </el-col>
       </el-row>
     </el-form>
@@ -372,13 +380,17 @@
     <template v-slot:footer>
       <el-button size="small" @click="handleClose">关闭</el-button>
       <el-button type="primary" size="small" @click="save">保存</el-button>
-      <el-button type="primary" size="small" @click="submit">提交</el-button>
+      <!-- <el-button type="primary" size="small" @click="submit">提交</el-button> -->
     </template>
     <releaseRules
       ref="releaseRulesRef"
       @success="releaseRulesSuccess"
     ></releaseRules>
-    <ProductModal ref="productRefs" @chooseModal="chooseModal" />
+    <ProductModal
+      ref="productRefs"
+      @chooseModal="chooseModal"
+      @chooseCurrent="chooseCurrent"
+    />
   </el-dialog>
 </template>
 
@@ -387,23 +399,44 @@
   import experimentationProcess from '@/components/templateDiv/experimentationProcess.vue';
   import releaseRules from '@/components/releaseRules/index.vue';
   import { getFactoryarea } from '@/api/aps/index.js';
+  import { save, getById, update } from '@/api/experimentReport/index.js';
   import ProductModal from '@/views/inspectionProject/components/ProductModal.vue';
+  import imgList from '@/components/upload/imgList.vue';
+  import detailMixins from '../mixins/detailMixins';
+  import { recordrulesGetById } from '@/api/main/index';
 
   export default {
-    components: { experimentationProcess, releaseRules, ProductModal },
+    components: { experimentationProcess, releaseRules, ProductModal, imgList },
     props: {},
-    mixins: [dictMixins],
+    mixins: [dictMixins, detailMixins],
 
     data() {
       return {
         visible: false,
-        projectData: {},
+        tableData: [],
         unitListKey: '',
-        form: {},
-        laboratoryItemList: [{}],
+        curretNum: 0,
+        type: '',
+        getSampleQuantityCount: 0,
+        form: {
+          code: '',
+          correlationId: '',
+          consumablesJson: [],
+          toolJson: [],
+          attachmentUrl: [],
+          experimentalTime: '',
+          imgUrl: [],
+          procedureJson: null,
+          qualityStandardName: '',
+          qualityStandardId: '',
+          processRequirementsJson: '',
+          recordJson: null,
+          qualityWorkOrderId: '',
+          results: 1,
+          resultsDescription: '',
+          experimentEquipmentList: []
+        },
         laboratoryList: [],
-        unitList: [],
-        unitList1: [],
         unitColumns: [
           {
             minWidth: 200,
@@ -550,42 +583,90 @@
         ]
       };
     },
-
+    computed: {
+      getSampleQuantityCount1() {
+        return this.getSampleQuantityCount - this.numTotal;
+      },
+      numTotal() {
+        return (
+          (Number(this.tableData[0].lossNumber) || 0) +
+          (Number(this.tableData[0].lossNumberUnqualified) || 0) +
+          (Number(this.tableData[0].retainedSampleQuantity) || 0) +
+          (Number(this.tableData[0].retainedSampleUnqualified) || 0)
+        );
+      }
+    },
     watch: {},
     methods: {
-      open(row) {
-        this.projectData = row;
+      async open(row) {
+        this.tableData = [row];
+        console.log(row, 'dasd');
+        this.getSampleQuantityCount = row.getSampleQuantityCount;
+        if (row.experimentId) {
+          this.$set(this, 'form', await getById(row.experimentId));
+          this.$nextTick(() => {
+            if (this.form.procedureJson) {
+              this.$refs.experimentationProcess1.init(
+                this.form.procedureJson.tempJson
+              );
+            }
+            if (this.form.recordJson) {
+              this.$refs.experimentationProcess2.init(
+                this.form.recordJson.tempJson
+              );
+            }
+          });
+        } else {
+          this.form.correlationId = row.id;
+          this.form.qualityStandardName = row.qualityStandardName;
+          this.form.qualityStandardId = row.qualityStandardId;
+          this.form.qualityWorkOrderId = row.qualityWorkOrderId;
+          this.form.processRequirementsJson = row.defaultValue;
+          this.$nextTick(async () => {
+            if (row.procedureId) {
+              const data = await recordrulesGetById(row.procedureId);
+              this.$refs.experimentationProcess1.init(data.tempJson.tempJson);
+            }
+            if (row.recordId) {
+              const data = await recordrulesGetById(row.recordId);
+              this.$refs.experimentationProcess2.init(data.tempJson.tempJson);
+            }
+          });
+        }
+
         this.getFactoryarea();
         this.visible = true;
       },
-      handleAdd(type) {
-        this.unitListKey = type;
-        if (type == 'unitList') {
-          this.$refs.productRefs.open(this.unitList);
-        } else {
-          this.$refs.productRefs.open(this.unitList1);
-        }
+      equipmentOpen(index) {
+        this.$refs.productRefs.open([], index);
       },
-      remove(index, type) {
-        if (type == 'unitList') {
-          this.unitList.splice(index, 1);
-        } else {
-          this.unitList1.splice(index, 1);
-        }
+      chooseCurrent(data) {
+        this.$set(
+          this.form.experimentEquipmentList[data[0].currentIndex],
+          'equipmentId',
+          data[0].id
+        );
+        this.$set(
+          this.form.experimentEquipmentList[data[0].currentIndex],
+          'equipmentName',
+          data[0].name
+        );
+      },
+      handleAdd(key) {
+        this.unitListKey = key;
+        this.$refs.productRefs.open(this.form[key]);
+      },
+      remove(index, key) {
+        this.form[key].splice(index, 1);
       },
-
       chooseModal(data) {
-        if (this.unitListKey == 'unitList') {
-          this.unitList = [...this.unitList, ...data];
-        } else {
-          this.unitList1 = [...this.unitList1, ...data];
-        }
+        this.form[this.unitListKey] = [...this.form[this.unitListKey], ...data];
       },
       delLaboratoryItemList(index) {
-        this.laboratoryItemList.splice(index, 1);
+        this.form.experimentEquipmentList.splice(index, 1);
       },
-      addlLaboratoryItemList(index) {
-        this.laboratoryItemList.push({});
+      addExperimentEquipmentList() {
+        this.form.experimentEquipmentList.push({});
       },
       async getFactoryarea() {
         const data = await getFactoryarea({
@@ -594,7 +675,6 @@
           type: 3
         });
         this.laboratoryList = data.list;
-        console.log(this.laboratoryList, 'data');
       },
       releaseRulesRefOpen(type) {
         this.releaseRulesType = type;
@@ -604,12 +684,68 @@
         if (this.releaseRulesType == 5) {
           this.$refs.experimentationProcess1.init(data.tempJson.tempJson);
         }
-        if (this.releaseRulesType == 6) {
+
+        if (this.releaseRulesType == 7) {
           this.$refs.experimentationProcess2.init(data.tempJson.tempJson);
         }
-        if (this.releaseRulesType == 7) {
-          this.$refs.experimentationProcess3.init(data.tempJson.tempJson);
+      },
+      inputValue(type, item, index) {
+        //样品数
+        if (type == 'sampleQuantity') {
+          this.isSampleQuantity(item, index);
+        }
+        //样品合格数、不合格数
+        if (type == 'qualifiedQuantity' || type == 'noQualifiedQuantity') {
+          this.isQualifiedQuantity(item, index, type);
+        }
+        //损耗数
+        if (type == 'lossNumber' || type == 'lossNumberUnqualified') {
+          this.setNumber(item, index, type, '损耗', 'lossNumber');
+          if (this.numTotal > this.getSampleQuantityCount) {
+            this.$message.error('不能大于当前质检剩余样品数');
+            this.$set(this.tableData[index], type, 0);
+          }
         }
+        //留样数
+        if (
+          type == 'retainedSampleQuantity' ||
+          type == 'retainedSampleUnqualified'
+        ) {
+          this.setNumber(item, index, type, '留样', 'retainedSampleQuantity');
+          if (this.numTotal > this.getSampleQuantityCount) {
+            this.$message.error('不能大于当前质检剩余样品数');
+            this.$set(this.tableData[index], type, 0);
+          }
+        }
+      },
+      save() {
+        this.$refs.formRef.validate((valid) => {
+          if (!valid) return false;
+          let data = JSON.parse(JSON.stringify(this.form));
+          let procedureJson = this.$refs.experimentationProcess1.getValue();
+          let recordJson = this.$refs.experimentationProcess2.getValue();
+          if (procedureJson) {
+            data.procedureJson = {
+              tempJson: JSON.stringify(procedureJson)
+            };
+          }
+          if (recordJson) {
+            data.recordJson = {
+              tempJson: JSON.stringify(recordJson)
+            };
+          }
+          let api = data.id ? update : save;
+          api(data)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              this.handleClose();
+              this.$emit('done', this.tableData[0]);
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
       },
       handleClose() {
         this.visible = false;

+ 43 - 9
src/views/inspectionWork/components/inspectionProjectReport.vue

@@ -73,7 +73,7 @@
         <el-select
           v-model="row.executionMethod"
           style="width: 100%"
-          :disabled="type == 'detail'"
+          :disabled="type == 'detail' || !!row.experimentCode"
         >
           <el-option :value="1" label="常规检验"></el-option>
           <el-option :value="2" label="实验"></el-option>
@@ -189,6 +189,16 @@
           </el-option>
         </el-select>
       </template>
+      <template v-slot:inspectImage="{ row, $index }">
+        <fileMain
+          v-model="row.inspectImage"
+          :type="type == 'detail' ? 'view' : 'add'"
+        ></fileMain>
+      </template>
+      <template v-slot:imgUrl="{ row, $index }">
+        <fileMain v-model="row.imgUrl" type="view"></fileMain>
+      </template>
+
       <template v-slot:isRequired="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
@@ -203,14 +213,16 @@
         </el-link>
       </template>
     </ele-pro-table>
-    <newQualityContentTabs ref="newQualityContentTabs"></newQualityContentTabs>
     <template v-slot:footer>
       <el-button @click="handleClose">取消</el-button>
       <el-button type="primary" @click="handleConfirm" v-if="type != 'detail'">
         确认
       </el-button>
     </template>
-    <experimentReport ref="experimentReport"></experimentReport>
+    <experimentReport
+      ref="experimentReport"
+      @done="experimentReportDone"
+    ></experimentReport>
   </ele-modal>
 </template>
 
@@ -628,10 +640,10 @@
       getSampleQuantityCount() {
         return (
           this.form.sampleQuantity -
-          this.form.lossNumber -
-          this.form.lossNumberUnqualified -
-          this.form.retainedSampleQuantity -
-          this.form.retainedSampleUnqualified
+          (this.form.lossNumber || 0) -
+          (this.form.lossNumberUnqualified || 0) -
+          (this.form.retainedSampleQuantity || 0) -
+          (this.form.retainedSampleUnqualified || 0)
         );
       }
     },
@@ -643,11 +655,27 @@
     },
     methods: {
       experimentReport(row, type) {
+        console.log(this.getSampleQuantityCount, 'this.form');
         this.$refs.experimentReport.open(
-          { ...row, batchNo: this.form.batchNo },
+          {
+            ...row,
+            batchNo: this.form.batchNo,
+            qualityWorkOrderId: this.form.qualityWorkOrderId,
+            getSampleQuantityCount:
+              this.getSampleQuantityCount +
+              Number(row.lossNumber) +
+              Number(row.lossNumberUnqualified) +
+              Number(row.retainedSampleQuantity) +
+              Number(row.retainedSampleUnqualified)
+          },
           type
         );
       },
+      experimentReportDone(data) {
+        let index = this.tableData.findIndex((item) => item.id == data.id);
+        this.$set(this.tableData, index, data);
+        this.initData();
+      },
 
       async open({ workData, row, list }, type, pageName) {
         this.tableData = [];
@@ -665,7 +693,13 @@
           this.$set(this, 'form', JSON.parse(JSON.stringify(data)));
           this.tableData = JSON.parse(JSON.stringify(list));
           this.tableData.forEach((item, index) => {
-            item.executionMethod = item.executionMethod || 1;
+            if (item.experimentCode) {
+              this.$set(this.tableData[index],'executionMethod',2)
+              // item.executionMethod = 2;
+            }
+              this.$set(this.tableData[index],'executionMethod',item.executionMethod || 1)
+
+            // item.executionMethod = item.executionMethod || 1;
           });
           if (row.sampleQuantity) {
             this.form.remainingSampleCount =

+ 16 - 4
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -278,7 +278,7 @@
             align="center"
             fixed="right"
             :show-overflow-tooltip="true"
-            v-if="form.recordingMethod !=1"
+            v-if="form.recordingMethod != 1"
           >
             <template slot-scope="scope">
               <span v-if="scope.row.qualityStatus == 0">未检</span>
@@ -293,7 +293,7 @@
             width="180"
             fixed="right"
             :show-overflow-tooltip="true"
-           v-if="form.recordingMethod !=1"
+            v-if="form.recordingMethod != 1"
           >
             <template slot-scope="scope">
               <el-select
@@ -319,7 +319,7 @@
             align="center"
             width="120"
             fixed="right"
-            v-if="type != 'detail' && form.recordingMethod!=1"
+            v-if="type != 'detail' && form.recordingMethod != 1"
           >
             <template slot-scope="scope">
               <el-link
@@ -397,6 +397,11 @@
             prop="inspectionName"
             align="center"
           ></el-table-column>
+          <el-table-column label="附件" prop="imgUrl" align="center">
+            <template slot-scope="scope">
+              <fileMain v-model="scope.row.imgUrl" type="view"></fileMain>
+            </template>
+          </el-table-column>
           <el-table-column
             label="工艺参数"
             show-overflow-tooltip
@@ -514,7 +519,11 @@
         >
         </ele-pro-table>
       </el-tab-pane>
-      <el-tab-pane label="质检项请托单" name="5" v-if="form.recordingMethod == 1">
+      <el-tab-pane
+        label="质检项请托单"
+        name="5"
+        v-if="form.recordingMethod == 1"
+      >
         <ele-pro-table
           ref="table"
           :columns="entrustColumns"
@@ -1478,6 +1487,9 @@
         this.$emit('setSchemeList', this.templateList);
         // this.schemeList = this.templateList;
         this.schemePagination.total = this.templateList.length;
+        if(this.form.recordingMethod == 1){
+           this.$emit('setSchemeListChange')
+        }
       },
       handDel(index) {
         this.templateList.splice(index, 1);

+ 27 - 7
src/views/inspectionWork/edit.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="ele-body">
+  <div class="ele-body" v-loading="loading">
     <div class="switch" v-if="this.qualityType == 2">
       <div class="switch_left">
         <ul>
@@ -211,6 +211,7 @@
         @setSchemeList="setSchemeList"
         @sampleListChange="sampleListChange"
         @inspectionProjectReport="inspectionProjectReport"
+        @setSchemeListChange="setSchemeListChange"
       />
     </el-card>
     <pickOrderList
@@ -843,10 +844,9 @@
       },
       //质检项报工回调
       inspectionProjectReportSuccess({ data, tableData }) {
-
         this.schemeList = [
           ...tableData,
-          ...this.schemeList.filter((item) =>item.correlationId)
+          ...this.schemeList.filter((item) => item.correlationId)
         ];
         data.type = 2;
         this.form.taskMonadInfo = data;
@@ -1443,6 +1443,28 @@
             this.loading = false;
           });
       },
+      setSchemeListChange() {
+        this.form.qualityTimeStart = this.qualityTimeStart;
+        this.form.qualityId = this.form.qualityIdList.join(',');
+        delete this.form['qualityTimeEnd'];
+        let params = {
+          ...this.form,
+          sampleList: this.sampleList,
+          planTemplateList: this.schemeList,
+          templateList: this.schemeList,
+          // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
+          qualityInventoryList: this.inventoryList
+        };
+        this.loading = true;
+        update(params)
+          .then((msg) => {
+            this.loading = false;
+            this.getDetail();
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      },
       restForm() {
         this.form = { ...this.defaultForm() };
         this.$nextTick(() => {
@@ -1560,7 +1582,7 @@
             });
             if (is) {
               this.$message.error('有未完成质检项质检,请检查!');
-              return
+              return;
             }
           }
           this.loading = true;
@@ -1691,9 +1713,7 @@
         if (this.form.recordingMethod == 1) {
           this.inspectionProjectReport({
             index: -1,
-            list: this.schemeList.filter(
-              (item) => !item.correlationId
-            )
+            list: this.schemeList.filter((item) => !item.correlationId)
           });
           return;
         }

+ 20 - 1
src/views/inspectionWork/mixins/detailMixins.js

@@ -759,7 +759,13 @@ export default {
     setNumber(item, index, key, title, keyName) {
       let keyObj = {
         key: key == keyName ? 'qualifiedQuantity' : 'noQualifiedQuantity',
-        title: key == keyName ? '合格数' : '不合格数'
+        title: key == keyName ? '合格数' : '不合格数',
+        title1: title == '留样' ? '损耗' : '留样',
+        numTotal:
+          key == keyName
+            ? Number(item.lossNumber) + Number(item.retainedSampleQuantity)
+            : Number(item.lossNumberUnqualified) +
+              Number(item.retainedSampleUnqualified)
       };
       if (item[key] > item[keyObj.key]) {
         this.$message.error(
@@ -767,6 +773,19 @@ export default {
         );
         this.$set(this.tableData[index], key, 0);
       }
+      if (keyObj.numTotal > item[keyObj.key]) {
+        this.$message.error(
+          title +
+            keyObj.title +
+            '与' +
+            keyObj.title1 +
+            keyObj.title +
+            '之和' +
+            '不能大于样品' +
+            keyObj.title
+        );
+        this.$set(this.tableData[index], key, 0);
+      }
       if (item[key] - (this.curretNum || 0) > this.getSampleQuantityCount) {
         this.$message.error(
           title + keyObj.title + '不能大于当前质检剩余样品数'