Explorar el Código

优化模板表格编辑功能并新增单元格合并特性

yusheng hace 7 meses
padre
commit
0f484cac66

+ 8 - 0
src/api/inspectionTemplate/index.js

@@ -26,6 +26,14 @@ export async function update(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+// 变更
+export async function qualitytemplateChange(data) {
+  const res = await request.put(`/qms/qualitytemplate/change`, data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 // 获取详情
 export async function getById(id) {
   const res = await request.get(`/qms/qualitytemplate/getById/${id}`);

+ 2 - 0
src/components/releaseRules/index.vue

@@ -295,6 +295,7 @@
     },
     methods: {
       open(type) {
+           this.treeNode = null;
         this.visible = true;
         this.type = type;
         this.getTypeList();
@@ -305,6 +306,7 @@
           pageNum: 1,
           businessType:2,
           size: 99999,
+          reportWorkType:this.type
         });
         this.typeTree = [];
         console.log('type list', list);

+ 341 - 88
src/components/templateDiv/customTable.vue

@@ -1,14 +1,57 @@
 <!-- 搜索表单 -->
 <template>
   <div style="margin-top: 10px">
-    <!-- <el-button type="primary" @click="addColumn()" v-if="edit"
+    <div v-if="isSelecting" class="selection-box" :style="selectionStyle"></div>
+    <el-button type="primary" @click="addColumn()" v-if="edit"
       >新增列</el-button
     >
-    <el-button type="primary" @click="addRow(columns.length)" v-if="edit"
+    <el-button type="primary" @click="addRow(columns[0].length)" v-if="edit"
       >新增行</el-button
-    > -->
+    >
+    <el-checkbox v-model="isMerge" style="margin-left: 10px" v-if="edit"
+      >合并单元格</el-checkbox
+    >
     <div class="table" style="margin-top: 10px" :id="id">
-      <div class="table-body" style="display: flex">
+      <div
+        class="table-body"
+        style="display: flex"
+        @mousedown="startSelecting"
+        @mousemove="updateSelection"
+        @mouseup="stopSelecting"
+      >
+        <!-- <el-popover
+          style="position: fixed; z-index: 2000"
+          width="400"
+          ref="popoverRef"
+          v-model="rightClickShow"
+        >
+          <el-card class="box-card">
+            <div slot="header" class="clearfix" @click="rightClickShow = false">
+              <span>合并单元格</span>
+              <i class="el-icon-close" style="float: right; padding: 3px 0"></i>
+            </div>
+            <div class="text item">
+              向前合并:
+              <el-input v-model="beforeNum" style="width: 100px" type="number">
+              </el-input>
+              列
+            </div>
+            <div class="text item" style="margin-top: 10px">
+              向后合并:
+              <el-input v-model="laterNum" style="width: 100px" type="number">
+              </el-input>
+              列
+            </div>
+            <div>
+              <el-button
+                style="float: right; margin-bottom: 5px"
+                type="primary"
+                @click="save"
+                >确认</el-button
+              >
+            </div>
+          </el-card>
+        </el-popover> -->
         <template v-for="(row, index) in columns">
           <div class="column" :style="{ width: row[0].width + 'px' }">
             <div
@@ -16,38 +59,42 @@
               v-for="(item, rowIndex) in row"
               :style="{
                 height: item.rowspan * 30 + 'px',
-                display: item.rowspan ? 'block' : 'none'
+                display: item.rowspan ? 'block' : 'none',
+                ...item.style,
+                width: item.colspan ? getWidth(item) : 0
               }"
+              @contextmenu.prevent="onRightClick($event, rowIndex, index)"
             >
-              <!-- <i
+              <i
                 class="el-icon-delete delete"
                 style="display: none"
-                @click="removeColumn(index)"
+                @click="removeColumn(item, index)"
                 v-if="edit && rowIndex == 0"
               ></i>
               <i
                 class="el-icon-circle-plus-outline add"
                 style="display: none"
-                @click="addColumn(index)"
+                @click="addColumn(item)"
                 v-if="edit && rowIndex == 0"
               ></i>
               <i
                 class="el-icon-delete deleteRow"
                 @click="removeRow(rowIndex)"
-                v-if="edit && rowIndex != 0"
+                v-if="edit && rowIndex != 0 && item.style?.border != 'none'"
               ></i>
               <i
                 class="el-icon-circle-plus-outline addRow"
                 style="display: none"
-                @click="addRow(rowIndex, index)"
+                @click="addRow(rowIndex, item)"
                 v-if="edit && rowIndex != 0 && index != columns.length - 1"
-              ></i> -->
+              ></i>
               <textarea
                 v-if="item.rowspan > 1"
                 v-model="item.value"
                 class="templateInput"
                 :id="item.id"
-                :readonly="item.readonly == 2 || !edit"
+                :ref="item.id + 'ref'"
+                :readonly="item.readonly == 2 || readonly"
                 @click="inputClick(item)"
                 @input="calculation"
                 autocomplete="off"
@@ -58,7 +105,8 @@
                 v-model="item.value"
                 class="templateInput"
                 :id="item.id"
-                :readonly="item.readonly == 2 || !edit"
+                :ref="item.id + 'ref'"
+                :readonly="item.readonly == 2 || readonly"
                 @click="inputClick(item, rowIndex == 0 ? 'columns' : null)"
                 @input="calculation"
                 type="text"
@@ -84,6 +132,10 @@
       edit: {
         default: true,
         type: Boolean
+      },
+      readonly: {
+        default: false,
+        type: Boolean
       }
     },
     data() {
@@ -94,96 +146,265 @@
         rightClickShow: false,
         columns: [],
         units: {},
-        equation: {}
+        equation: {},
+        beforeNum: 0,
+        laterNum: 0,
+        currentRowIndex: 0,
+        currentColumnIndex: 0,
+        isSelecting: false,
+        startX: 0,
+        startY: 0,
+        endX: 0,
+        endY: 0,
+        selectedItems: [],
+        isMerge: false
       };
     },
     created() {},
+    computed: {
+      selectionStyle() {
+        return {
+          position: 'fixed',
+          left: `${Math.min(this.startX, this.endX)}px`,
+          top: `${Math.min(this.startY, this.endY)}px`,
+          width: `${Math.abs(this.endX - this.startX)}px`,
+          height: `${Math.abs(this.endY - this.startY)}px`,
+          border: '2px dashed black'
+        };
+      }
+    },
     methods: {
+      startSelecting(event) {
+        if (!this.isMerge) {
+          return;
+        }
+        this.isSelecting = true;
+        this.startX = event.clientX;
+        this.startY = event.clientY;
+        this.endX = this.startX;
+        this.endY = this.startY;
+      },
+      updateSelection(event) {
+        if (this.isSelecting) {
+          this.endX = event.clientX;
+          this.endY = event.clientY;
+        }
+      },
+      stopSelecting() {
+        this.isSelecting = false;
+        // 在这里处理框选结果,例如计算被框选的元素
+        this.calculateSelectedItems();
+      },
+      calculateSelectedItems() {
+        this.selectedItems = [];
+        this.columns.forEach((cell, columnIndex) => {
+          cell.forEach((row, rowIndex) => {
+            const rect = this.$refs[row.id + 'ref'][0].getBoundingClientRect();
+            if (
+              rect.left < this.endX &&
+              rect.right > this.startX &&
+              rect.top < this.endY &&
+              rect.bottom > this.startY
+            ) {
+              row.columnIndex = columnIndex;
+              row.rowIndex = rowIndex;
+              this.selectedItems.push(row);
+            }
+          });
+        });
+        // console.log(this.selectedItems, 'this.selectedItems[0]');
+        // return
+
+        if (this.selectedItems.length < 1) {
+          return;
+        }
+        let _columnIndex = this.selectedItems[0].columnIndex;
+        let _rowIndex = this.selectedItems[0].rowIndex;
+        let _colspan = this.selectedItems[0].colspan;
+        let rowspan = this.selectedItems
+          .filter((item) => item.columnIndex === _columnIndex)
+          .reduce((acc, cur) => acc + cur.rowspan, 0);
+        if (this.verify(_colspan, rowspan, this.selectedItems, _rowIndex)) {
+          return;
+        }
+        for (let index = 0; index < this.selectedItems.length; index++) {
+          let item = this.selectedItems[index];
+          if (index != 0) {
+            if (!this.selectedItems[0].style) {
+              this.selectedItems[0].style = {};
+            }
+            if (
+              this.selectedItems[0].rowIndex == item.rowIndex &&
+              this.selectedItems[0].columnIndex != item.columnIndex
+            ) {
+              this.selectedItems[0].colspan += item.colspan;
+              this.selectedItems[0].colspanKey.push(item.id);
+              this.selectedItems[0].colspanKey.push(...item.colspanKey);
+            }
+            if (
+              this.selectedItems[0].rowIndex != item.rowIndex &&
+              this.selectedItems[0].columnIndex == item.columnIndex
+            ) {
+              this.selectedItems[0].rowspan += item.rowspan;
+              item.rowspan = 0;
+            }
+
+            item.colspan = 0;
+            item.style = {
+              border: 'none'
+            };
+            this.$set(this.columns[item.columnIndex], item.rowIndex, item);
+          }
+        }
+        this.$set(this.columns[_columnIndex], _rowIndex, this.selectedItems[0]);
+      },
+      colspanSum(rowIndex) {
+        return this.selectedItems.filter((item) => item.rowIndex == rowIndex);
+      },
+      verify(_colspan, _rowspan, arr, _rowIndex) {
+        for (let index = 0; index < arr.length; index++) {
+          let item = arr[index];
+          if (_rowIndex === 0 && _rowIndex != item.rowIndex) {
+            //表头不能和其他行合并
+            return true;
+          }
+          if (
+            item.rowIndex != this.selectedItems[0].rowIndex &&
+            _colspan > this.colspanSum(item.rowIndex).length &&
+            item.colspan != 0
+          ) {
+            return true;
+          }
+
+          if (item.rowspan > _rowspan) {
+            return true;
+          }
+        }
+      },
+
       // 方法:添加新列
-      addColumn(index) {
+      addColumn(item) {
         let length = this.columns[0]?.length || 1;
-        if (index === 0 || index) {
+        if (item) {
+          let _columnIndex = item.columnIndex;
+          if (item.colspan > 1) {
+            _columnIndex += Number(item.colspan - 1);
+          }
           this.columns.splice(
-            index + 1,
+            _columnIndex + 1,
             0,
             Array(length)
               .fill(null)
-              .map(() => ({
-                readonly: 1,
-                value: '',
-                rowspan: 1,
-                id: generateRandomString(5)
-              }))
+              .map(() => this.getInput())
           );
         } else {
           this.columns.push(
             Array(length)
               .fill(null)
-              .map(() => ({
-                readonly: 1,
-                value: '',
-                rowspan: 1,
-                id: generateRandomString(5)
-              }))
+              .map(() => this.getInput())
           );
         }
       },
+      getInput() {
+        return {
+          readonly: 1,
+          value: '',
+          rowspan: 1,
+          colspan: 1,
+          colspanKey: [],
+          width: 100,
+          style: { width: 100 },
+          id: generateRandomString(5)
+        };
+      },
+      getIndex(id) {
+        let columnIndex, rowIndex;
+        console.log(id);
+        this.columns.forEach((cell, _columnIndex) => {
+          let cellIndex = cell.findIndex((data) => data.id == id);
+          if (cellIndex != '-1') {
+            columnIndex = _columnIndex;
+            rowIndex = cellIndex;
+          }
+        });
+        return { columnIndex, rowIndex };
+      },
 
       // 方法:删除指定列
-      removeColumn(index) {
-        this.columns.splice(index, 1);
-      },
+      removeColumn(item, index) {
+        this.columns[index].forEach((cell, rowIndex) => {
+          if (cell.colspanKey.length) {
+            //当前删除的列其他行有合并过单元格的处理
+            let data = this.columns[index + 1][rowIndex];
 
-      // 方法:添加新行
-      addRow(rowIndex, columnIndex) {
-        if (columnIndex > 0) {
-          this.columns.forEach((item, newColumnIndex) => {
-            let newRow = {
-              readonly: 1,
-              value: '',
-              rowspan: 1,
-              id: generateRandomString(5)
-            };
-            if (newColumnIndex < columnIndex) {
-              newRow.rowspan = 0;
-              let _rowIndex = null;
-              if (item[rowIndex].rowspan == 0) {
-                _rowIndex = this.getPreventRowspan(newColumnIndex, rowIndex);
+            data.colspan = cell.colspan - 1;
+            data.rowspan = cell.rowspan;
+            data.style = cell.style;
+            data.colspanKey = cell.colspanKey.filter((item) => item != data.id);
+            if (data.rowspan > 1) {
+              for (let j = 1; j < data.rowspan; j++) {
+                this.$set(this.columns[index + 1][rowIndex + j], 'rowspan', 0);
               }
-              console.log(_rowIndex, '_rowIndex');
-              let rowspan =
-                this.columns[newColumnIndex][_rowIndex || rowIndex].rowspan ||
-                1;
-
-              this.$set(
-                this.columns[newColumnIndex][_rowIndex || rowIndex],
-                'rowspan',
-                (rowspan += 1)
-              );
             }
-            this.columns[newColumnIndex].splice(rowIndex + 1, 0, newRow);
-          });
-        } else {
-          this.columns.forEach((item, index) => {
-            let _rowIndex = rowIndex;
-            if (item[rowIndex].rowspan > 1) {
-              _rowIndex += Number(item[rowIndex].rowspan);
-            }
-            this.columns[index].splice(_rowIndex + 1, 0, {
-              readonly: 1,
-              value: '',
-              rowspan: 1,
-              id: generateRandomString(5)
+            this.$set(this.columns[index + 1], rowIndex, data);
+          }
+        });
+        if (item?.colspanKey.length) {
+          item.colspanKey.forEach((id) => {
+            let { columnIndex } = this.getIndex(id);
+            console.log(columnIndex, 'columnIndex');
+
+            this.columns[columnIndex].forEach((cell, rowIndex) => {
+              if (cell.colspanKey.length) {
+                //当前删除的列其他行有合并过单元格的处理
+                let data = this.columns[columnIndex + 1][rowIndex];
+
+                data.colspan = cell.colspan - 1;
+                data.rowspan = cell.rowspan;
+                data.style = cell.style;
+                data.colspanKey = cell.colspanKey.filter(
+                  (item) => item != data.id
+                );
+                if (data.rowspan > 1) {
+                  for (let j = 1; j < data.rowspan; j++) {
+                    this.$set(
+                      this.columns[columnIndex + 1][rowIndex + j],
+                      'rowspan',
+                      0
+                    );
+                  }
+                }
+                this.$set(this.columns[columnIndex + 1], rowIndex, data);
+              }
             });
+
+            this.columns.splice(index + 1, 1);
           });
-          console.log(this.columns, 'this.columns');
         }
+        this.columns.splice(index, 1);
+        //当前删除的列合并过单元格的列都删除
+      },
+
+      // 方法:添加新行
+      addRow(rowIndex, row) {
+        let _rowIndex = rowIndex;
+
+        if (row?.rowspan > 1) {
+          _rowIndex += Number(row?.rowspan - 1);
+        }
+
+        this.columns.forEach((item, index) => {
+          this.columns[index].splice(_rowIndex + 1, 0, this.getInput());
+        });
+
+        // }
       },
       //找到真正需要改变rowspan的行
       getPreventRowspan(columnIndex, rowIndex) {
         let preventRowspan = null;
         this.columns[columnIndex].forEach((item, newRowIndex) => {
           if (newRowIndex < rowIndex && item.rowspan > 1) {
+            //向上找到当前列合并过单元格的行
             preventRowspan = newRowIndex;
           }
         });
@@ -194,6 +415,7 @@
       removeRow(rowIndex) {
         this.columns.forEach((item, columnIndex) => {
           if (item[rowIndex].rowspan == 0) {
+            // 如果当前列,删除的这一行rowspan为0,则需要找到真正需要改变rowspan的行
             let preventRowspanIndex = this.getPreventRowspan(
               columnIndex,
               rowIndex
@@ -206,6 +428,7 @@
               );
             }
           } else if (item[rowIndex].rowspan > 1) {
+            //rowspan大于1,代表合并过单元格,需要吧值继承给下一行
             let data = item[rowIndex];
             data.rowspan--;
             this.$set(this.columns[columnIndex], [rowIndex + 1], data);
@@ -214,16 +437,19 @@
           item.splice(rowIndex, 1);
         });
       },
-
-      objInit() {
-        if (Object.keys(this.valueObj).length) {
-          for (let key in this.valueObj) {
-            this.$nextTick(() => {
-              let dom = document.getElementById(key);
-              dom.value = this.valueObj[key];
+      getWidth(item) {
+        let width = Number(item.style.width) || 100;
+        if (item.colspanKey.length) {
+          this.columns.forEach((cell) => {
+            cell.forEach((row) => {
+              if (item.colspanKey.includes(row.id)) {
+                width += Number(row.style.width || 100);
+              }
             });
-          }
+          });
         }
+
+        return width + 'px';
       },
       calculation() {
         this.$emit('calculation');
@@ -249,8 +475,8 @@
       init({ form, valueObj, equation, units }) {
         this.form = form;
         this.columns = valueObj.columns;
-        this.units = units || {};
         this.equation = equation || {};
+        this.units = units || {};
       },
       editInputChange(domObj) {
         if (domObj.equation) {
@@ -259,17 +485,41 @@
         if (domObj.units) {
           this.units[this.domId] = domObj.units;
         }
+        let dom = document.getElementById(domObj.id);
+
         this.columns.forEach((item, index) => {
           let rowsIndex = item.findIndex((cells) => cells.id == this.domId);
 
           if (rowsIndex >= 0) {
+            let width = domObj.width - dom.parentElement.offsetWidth;
+            let newWidth = this.columns[index][rowsIndex].style.width + width;
+            this.columns[index][0].width = newWidth;
             this.$set(this.columns[index], rowsIndex, domObj);
+            item.forEach((cell, _index) => {
+              this.$set(this.columns[index][_index].style, 'width', newWidth);
+              this.$set(this.columns[index][_index], 'width', newWidth);
+            });
           }
         });
       },
+      onRightClick(PointerEvent, rowIndex, columnIndex) {
+        this.currentRowIndex = rowIndex;
+        this.currentColumnIndex = columnIndex;
+        if (rowIndex === 0) {
+          this.rightClickShow = true;
+          this.$nextTick(() => {
+            let y = PointerEvent.pageY;
+            let x = PointerEvent.pageX + 10;
+            if (PointerEvent.screenY >= PointerEvent.view.innerHeight) {
+              y -= 80;
+            }
+            this.$refs.popoverRef.$el.style.top = y + 'px';
+            this.$refs.popoverRef.$el.style.left = x + 'px';
+          });
+        }
+      },
 
       inputClick(item, type) {
-        return;
         if (!this.edit) {
           return;
         }
@@ -279,13 +529,11 @@
         this.$emit('editShow', {
           templateDivRef: 'customTextRef' + this.id,
           domObj: {
+            ...item,
             width: dom.parentElement.offsetWidth,
-            isNoWidth: type == 'columns' ? false : true,
-            id: item.id,
-            readonly: item.readonly,
-            value: item.value,
-            rowspan: item.rowspan,
-            equation: this.equation[item.id]
+            isNoWidth: type != 'columns' ? false : true,
+            equation: this.equation[item.id],
+            units: this.units[item.id] || {}
           }
         });
       }
@@ -319,7 +567,6 @@
     white-space: nowrap;
     .column {
       display: inline-block;
-      width: 100px;
       > div {
         height: 30px;
         border: 1px solid #ddd;
@@ -387,4 +634,10 @@
       color: #409eff;
     }
   }
+  .selection-box {
+    position: absolute;
+    border: 2px dashed black;
+    z-index: 999;
+    pointer-events: none; /* 确保选择框不会干扰鼠标事件 */
+  }
 </style>

+ 10 - 8
src/components/templateDiv/customText.vue

@@ -36,6 +36,10 @@
       edit: {
         default: true,
         type: Boolean
+      },
+      readonly: {
+        default: false,
+        type: Boolean
       }
     },
     data() {
@@ -43,8 +47,8 @@
         form: null,
         valueObj: {},
         equation: {},
-        domId: '',
         units: {},
+        domId: '',
         rightClickShow: false
       };
     },
@@ -114,8 +118,8 @@
         return {
           form: this.$refs[this.id].innerHTML,
           valueObj: data,
-          units: this.units,
-          equation: this.equation
+          equation: this.equation,
+          units: this.units
         };
       },
       equationValue({ domId, value }) {
@@ -132,9 +136,8 @@
         this.valueObj = valueObj;
         this.equation = equation || {};
         this.units = units || {};
-
         this.$nextTick(() => {
-          if (!this.edit) {
+          if (this.readonly) {
             let inputs = document.querySelectorAll('.templateInput');
             inputs.forEach((item) => {
               item.setAttribute('readonly', 'readonly');
@@ -162,7 +165,6 @@
         dom.id = domObj.id;
       },
       onRightClick(PointerEvent) {
-        return;
         this.rightClickShow = true;
         this.$nextTick(() => {
           let y = PointerEvent.pageY;
@@ -182,7 +184,6 @@
         }
       },
       inputClick(event) {
-        return;
         if (!this.edit) {
           return;
         }
@@ -194,7 +195,8 @@
               width: event.target.offsetWidth,
               id: event.target.id,
               readonly: event.target.readOnly ? 2 : 1,
-              equation: this.equation[this.domId]
+              equation: this.equation[this.domId],
+              units: this.units[this.domId] || {}
             }
           });
         }

+ 39 - 9
src/components/templateDiv/experimentationProcess.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="ele-body">
-    <!-- <el-button type="primary" @click="addHtml('customText')" v-if="edit"
+    <el-button type="primary" @click="addHtml('customText')" v-if="edit"
       >插入自定义文本</el-button
     >
     <el-button type="primary" @click="addHtml('customTable')" v-if="edit"
       >插入表格</el-button
-    > -->
+    >
     <!-- <el-button type="primary" @click="save()">保存</el-button> -->
     <div
       style="
@@ -29,7 +29,7 @@
           :key="item.id"
         >
           <div class="listItem">
-            <!-- <i
+            <i
               class="sort-handle el-icon-_nav move"
               style="display: none"
               v-if="edit"
@@ -39,7 +39,7 @@
               v-if="edit"
               style="display: none"
               @click="del(item.id)"
-            ></i> -->
+            ></i>
             <customText
               :ref="'customTextRef' + item.id"
               style="flex: 1"
@@ -49,6 +49,7 @@
               :valueObj="item.valueObj"
               @editShow="editShowFn"
               @calculation="calculation"
+              :readonly="readonly"
               :edit="edit"
             ></customText>
             <customTable
@@ -60,6 +61,7 @@
               :valueObj="item.valueObj"
               @calculation="calculation"
               @editShow="editShowFn"
+              :readonly="readonly"
               :edit="edit"
             ></customTable>
           </div>
@@ -69,6 +71,12 @@
       <el-card class="box-card" v-show="editShow" style="width: 320px">
         <div slot="header" class="clearfix">
           <span>配置</span>
+          <el-button
+            style="float: right; padding: 3px 0"
+            type="text"
+            @click="editShow = false"
+            >关闭</el-button
+          >
         </div>
         <el-form label-width="80px">
           <el-form-item label="字段标识:" prop="id">
@@ -126,6 +134,7 @@
           size="mini"
           style="width: 100px; margin-right: 8px; flex-shrink: 0"
           @change="paramSelectChange($event, 'id')"
+          filterable
         >
           <el-option
             v-for="item in idList"
@@ -176,6 +185,22 @@
           <el-option key="append" label="追加" value="append" />
           <el-option key="replace" label="替换" value="replace" />
         </el-select>
+        <el-input
+          v-model.number="domObj.units.decimalPlace"
+          placeholder="小数位"
+          size="mini"
+          style="width: 120px; margin-left: 8px; flex-shrink: 0"
+        >
+        </el-input>
+        <el-select
+          v-model="domObj.units.takeValueMethod"
+          placeholder="取值方法"
+          size="mini"
+          style="width: 100px; margin-left: 8px; flex-shrink: 0"
+        >
+          <el-option key="1" label="四舍五入" value="1" />
+          <el-option key="2" label="去尾" value="2" />
+        </el-select>
       </div>
 
       <!-- 已组装公式标签展示 -->
@@ -234,6 +259,10 @@
       edit: {
         default: true,
         type: Boolean
+      },
+      readonly: {
+        default: false,
+        type: Boolean
       }
     },
     computed: {},
@@ -243,7 +272,7 @@
         editShow: false,
         visible: false,
         templateDivRef: '',
-        domObj: {},
+        domObj: { units: {} },
         idList: [],
         opSelectOptions: ['+', '-', '*', '/', '%', '(', ')'],
         equationUnit: {
@@ -263,6 +292,7 @@
       calculation() {
         this.getValue();
         let equation = [];
+
         this.list.forEach((item) => {
           equation.push({
             id: item.id,
@@ -284,7 +314,6 @@
                   value += Number(data[equationItem.value]) || 0;
                 }
               });
-
               if (units[key]?.decimalPlace) {
                 if (units[key]?.takeValueMethod) {
                   value =
@@ -302,7 +331,6 @@
               } else {
                 value = parseFloat(eval(value).toFixed(2));
               }
-
               if (this.$refs['customTextRef' + item.id][0]) {
                 this.$refs['customTextRef' + item.id][0].equationValue({
                   domId: key,
@@ -313,6 +341,7 @@
           }
         });
       },
+
       truncateToFixedManual(num, decimalPlaces) {
         let factor = Math.pow(10, decimalPlaces);
         return Math.floor(num * factor) / factor;
@@ -431,14 +460,15 @@
 
       init(list) {
         this.list = JSON.parse(list);
+        this.editShow = false;
         if (this.list.length) {
           this.$nextTick(() => {
             this.list.forEach((item) => {
               this.$refs['customTextRef' + item.id][0].init({
                 form: item.value,
                 valueObj: item.valueObj,
-                units: item.units,
-                equation: item.equation
+                equation: item.equation,
+                units: item.units
               });
             });
           });

+ 22 - 3
src/components/templateDiv/experimentationProcessDialog.vue

@@ -3,7 +3,7 @@
   <ele-modal
     width="80%"
     :visible.sync="visible"
-    title="预览模板"
+    :title="edit?'编辑模板':'预览'"
     :close-on-click-modal="false"
     :maxable="true"
     :resizable="true"
@@ -11,20 +11,32 @@
   >
     <experimentationProcess
       ref="experimentationProcess"
-      :edit="false"
+      :edit="edit"
+      :readonly="readonly"
     ></experimentationProcess>
     <template v-slot:footer>
+      <el-button @click="save" type="primary" v-if="edit"> 保存 </el-button>
       <el-button @click="visible = false"> 关闭 </el-button>
     </template>
   </ele-modal>
 </template>
 
 <script>
+  import { save } from '@/api/experimentReport';
   import experimentationProcess from './experimentationProcess.vue';
 
   export default {
     components: { experimentationProcess },
-
+    props: {
+      edit: {
+        default: true,
+        type: Boolean
+      },
+      readonly: {
+        default: false,
+        type: Boolean
+      }
+    },
     data() {
       return {
         visible: false
@@ -38,6 +50,13 @@
         this.$nextTick(() => {
           this.$refs.experimentationProcess.init(data);
         });
+      },
+      save() {
+        this.$emit(
+          'success',
+          JSON.stringify(this.$refs.experimentationProcess.getValue())
+        );
+        this.visible = false;
       }
     }
   };

+ 6 - 0
src/styles/transition/common.scss

@@ -83,3 +83,9 @@
 //   // height: 32px  !important;
 //   line-height: 32px  !important;
 // }
+.el-input.is-disabled .el-input__inner{
+  color: #333 !important;
+}
+.el-textarea.is-disabled .el-textarea__inner{
+  color: #333 !important;
+}

+ 3 - 3
src/views/inspectionPlan/components/baseInfo.vue

@@ -116,7 +116,7 @@
         </el-form-item>
       </el-col>-->
       <el-col :span="6">
-        <el-form-item label="执行部门:" prop="groupId">
+        <el-form-item label="接收部门:" prop="groupId">
           <deptSelect
             :disabled="btnType == 'detail'"
             v-model="form.groupId"
@@ -125,7 +125,7 @@
         </el-form-item>
       </el-col>
       <el-col :span="6">
-        <el-form-item label="执行人员:" prop="executeId">
+        <el-form-item label="接收人:" prop="executeId">
           <el-select
             :disabled="btnType == 'detail'"
             v-model="form.executeId"
@@ -718,7 +718,7 @@
       },
       //根据类型获取计划来源下拉
       typeChange(val) {
-        console.log(val,'34567')
+        console.log(val, '34567');
         if (val == 1) {
           this.sourceList = [{ label: '采购收货单', value: '1' }];
         } else if (val == 2) {

+ 2 - 2
src/views/inspectionPlan/components/new-baseInfo.vue

@@ -116,7 +116,7 @@
         </el-form-item>
       </el-col>-->
       <el-col :span="6">
-        <el-form-item label="执行部门:" prop="groupId">
+        <el-form-item label="接收部门:" prop="groupId">
           <deptSelect
             :disabled="btnType == 'detail'"
             v-model="form.groupId"
@@ -125,7 +125,7 @@
         </el-form-item>
       </el-col>
       <el-col :span="6">
-        <el-form-item label="执行人员:" prop="executeId">
+        <el-form-item label="接收人:" prop="executeId">
           <el-select
             :disabled="btnType == 'detail'"
             v-model="form.executeId"

+ 2 - 2
src/views/inspectionPlan/index.vue

@@ -256,13 +256,13 @@
           // },
 
           {
-            label: '执行部门',
+            label: '接收部门',
             prop: 'groupName',
             align: 'center',
             showOverflowTooltip: true
           },
           {
-            label: '执行人',
+            label: '接收人',
             prop: 'executeName',
             align: 'center',
             width: 120,

+ 39 - 14
src/views/inspectionProjectRequest/index.vue

@@ -98,9 +98,13 @@
             @click="openTransfer(row)"
             >转派</el-link
           >
-          <el-link v-if="row.qualityWorkOrderId" type="primary" :underline="false" @click="craftFiles(row.qualityWorkOrderId)"
+          <!-- <el-link
+            v-if="row.qualityWorkOrderId"
+            type="primary"
+            :underline="false"
+            @click="craftFiles(row.qualityWorkOrderId)"
             >工艺文件</el-link
-          >
+          > -->
           <el-link
             type="danger"
             :underline="false"
@@ -248,9 +252,24 @@
             minWidth: 110
           },
 
+          {
+            prop: 'receiveDeptName',
+            label: '接收部门',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'receiveUserName',
+            minWidth: 110,
+            label: '接收人员',
+            align: 'center',
+            showOverflowTooltip: true
+          },
           {
             prop: 'executeDeptName',
-            label: '受托部门',
+            label: '执行部门',
             showOverflowTooltip: true,
             align: 'center',
             minWidth: 110
@@ -508,21 +527,27 @@
 
         const res = await getById(row.id);
         this.$refs.inspectionProjectReportRef.open(
-          { workData: {...res,measureUnit:res.sampleMeasureUnit}, list: res.templateList },
+          {
+            workData: { ...res, measureUnit: res.sampleMeasureUnit },
+            list: res.templateList
+          },
           type,
           'inspectionProjectRequest'
         );
       },
-      async craftFiles(id) {
-        if (id) {
-          const data = await craftFiles(id);
-          if (data.length) {
-            this.$nextTick(() => {
-              this.$refs.fileListRef.open(data.map((item) => item.id), 'view');
-            });
-          }
-        }
-      },
+      // async craftFiles(id) {
+      //   if (id) {
+      //     const data = await craftFiles(id);
+      //     if (data.length) {
+      //       this.$nextTick(() => {
+      //         this.$refs.fileListRef.open(
+      //           data.map((item) => item.id),
+      //           'view'
+      //         );
+      //       });
+      //     }
+      //   }
+      // },
       async sampleCollection(row) {
         const code = await verificationQualityInspector(row.id);
         if (code == '-1') {

+ 60 - 13
src/views/inspectionProjectTask/components/inspectionProjectTaskSend.vue

@@ -45,7 +45,7 @@
               placeholder="请输入"
             ></el-input> </el-form-item></el-col
       ></el-row>
-      <el-row>
+      <el-row v-if="type == 1">
         <el-col :span="8">
           <el-form-item label="执行部门" prop="executeDeptId">
             <deptSelect
@@ -69,6 +69,30 @@
               ></el-option>
             </el-select> </el-form-item></el-col
       ></el-row>
+      <el-row v-else>
+        <el-col :span="8">
+          <el-form-item label="接收部门" prop="receiveDeptId">
+            <deptSelect
+              v-model="form.receiveDeptId"
+              @changeGroup="searchDeptNodeClick"
+            /> </el-form-item
+        ></el-col>
+        <el-col :span="8">
+          <el-form-item label="接收人" prop="receiveUserId">
+            <el-select
+              v-model="form.receiveUserId"
+              @change="changeExecutor"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in executorList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select> </el-form-item></el-col
+      ></el-row>
       <el-row>
         <el-col :span="8">
           <el-form-item label="要求完成时间" prop="requiredCompletionTime">
@@ -208,14 +232,20 @@
           executeDeptId: [
             { required: true, message: '请选择部门', trigger: 'blur' }
           ],
+          executeUserId: [
+            { required: true, message: '请选择人员', trigger: 'blur' }
+          ],
+          receiveDeptId: [
+            { required: true, message: '请选择部门', trigger: 'blur' }
+          ],
+          receiveUserId: [
+            { required: true, message: '请选择人员', trigger: 'blur' }
+          ],
           name: [
             { required: true, message: '请输入任务名称', trigger: 'blur' }
           ],
           requiredCompletionTime: [
             { required: true, message: '请输入要求完成日期', trigger: 'blur' }
-          ],
-          executeUserId: [
-            { required: true, message: '请选择人员', trigger: 'blur' }
           ]
         },
         templateIdS: [],
@@ -233,7 +263,15 @@
         this.templateIdS = [];
         if (pgaeName == 'inspectionProjectRequest') {
           this.form = await getQualityInspectionItemById(row.id);
-          this.getUserList({ groupId: this.form.executeDeptId }, true);
+          this.getUserList(
+            {
+              groupId:
+                this.type == 1
+                  ? this.form.executeDeptId
+                  : this.form.receiveDeptId
+            },
+            true
+          );
           if (this.form.templateList.length) {
             this.templateIdS = this.form.templateList.map((item) => item.id);
           }
@@ -249,19 +287,25 @@
         });
       },
       searchDeptNodeClick(info, row) {
+        let depKey = this.type == 1 ? 'executeDeptId' : 'receiveDeptId';
+        let depNameKey = this.type == 1 ? 'executeDeptName' : 'receiveDeptName';
+
         if (info) {
           const params = { groupId: info };
-          this.form.executeDeptId = info;
-          this.form.executeDeptName = row.name;
+          this.form[depKey] = info;
+          this.form[depNameKey] = row.name;
           this.getUserList(params);
         } else {
-          this.form.executeUserId = null;
-          this.form.executeUserName = null;
+          this.form[depKey] = null;
+          this.form[depNameKey] = null;
           this.executorList = [];
         }
       },
       // 获取人员
       async getUserList(params, init) {
+        let userKey = this.type == 1 ? 'executeUserId' : 'receiveUserId';
+        let userNameKey =
+          this.type == 1 ? 'executeUserName' : 'receiveUserName';
         try {
           let data = { pageNum: 1, size: -1 };
 
@@ -273,14 +317,17 @@
           if (init) {
             return;
           }
-          this.form.executeUserId = null;
-          this.form.executeUserName = null;
+          this.form[userKey] = null;
+          this.form[userNameKey] = null;
         } catch (error) {}
       },
       changeExecutor(val) {
+        let userKey = this.type == 1 ? 'executeUserId' : 'receiveUserId';
+        let userNameKey =
+          this.type == 1 ? 'executeUserName' : 'receiveUserName';
         if (val) {
-          this.form.executeUserId = val;
-          this.form.executeUserName = this.executorList.find(
+          this.form[userKey] = val;
+          this.form[userNameKey] = this.executorList.find(
             (item) => item.id === val
           ).name;
         }

+ 6 - 23
src/views/inspectionProjectTask/index.vue

@@ -31,9 +31,7 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link type="primary" :underline="false" @click="craftFiles(row)"
-            >工艺文件</el-link
-          >
+      
           <el-link
             type="primary"
             :underline="false"
@@ -51,15 +49,15 @@
       ref="inspectionProjectReportRef"
       @reload="reload"
     />
-    <fileList ref="fileListRef"></fileList>
-    <wokePopup ref="wokePopupRef"></wokePopup>
+    <!-- <fileList ref="fileListRef"></fileList> -->
+   
   </div>
 </template>
 
 <script>
   import search from './components/search.vue';
   import inspectionProjectReport from '@/views/inspectionWork/components/inspectionProjectReport.vue';
-  import fileList from '@/components/addDoc/main.vue';
+  // import fileList from '@/components/addDoc/main.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import {
     getList,
@@ -69,16 +67,13 @@
   } from '@/api/inspectionProjectTask';
   import dictMixins from '@/mixins/dictMixins';
   import { recordingMethodList } from '@/utils/util.js';
-  import { craftFiles } from '@/api/inspectionWork';
-  import wokePopup from '@/components/workList/wokePopup.vue';
-  import { parameterGetByCode } from '@/api/main/index';
 
   export default {
     components: {
       search,
       inspectionProjectReport,
-      fileList,
-      wokePopup
+      // fileList,
+      // wokePopup
     },
     mixins: [dictMixins, tabMixins],
     data() {
@@ -302,19 +297,7 @@
       reload(where) {
         this.$refs.table.reload({ page: 1, where: where });
       },
-      async craftFiles(row) {
-        const res = await parameterGetByCode({
-          code: 'mes_craft_file_by_category_code'
-        });
-        const byCategory = res?.value === '1';
 
-        if (byCategory) {
-          this.$refs.wokePopupRef.openTwo(row);
-        } else{
-          const data =row.qualityWorkOrderId? await craftFiles(row.qualityWorkOrderId):[];
-        this.$refs.wokePopupRef.open(data.map((item) => item.id));
-        }
-      },
       async sampleCollection(row) {
         const code = await verificationQualityInspector(row.id);
         if (code == '-1') {

+ 103 - 29
src/views/inspectionTemplate/AddorUpdate.vue

@@ -6,7 +6,7 @@
   <!--    width="60%"-->
   <!--  >-->
   <ele-modal
-    :title="!dataForm.id ? '新增' : '修改'"
+    :title="type == 'view' ? '详情' : !dataForm.id ? '新增' : '修改'"
     :visible.sync="visible"
     :before-close="handleClose"
     :close-on-click-modal="false"
@@ -15,12 +15,29 @@
     width="80%"
     :maxable="true"
   >
+    <div class="switch" v-if="type == 'view'">
+      <div class="switch_left">
+        <ul>
+          <li
+            v-for="item in tabOptions"
+            :key="item.key"
+            :class="{ active: activeComp == item.key }"
+            @click="activeComp = item.key"
+          >
+            {{ item.name }}
+          </li>
+        </ul>
+      </div>
+    </div>
     <el-form
+      v-show="activeComp === 'main'"
       :model="dataForm"
       :rules="dataRule"
       ref="dataForm"
       @keyup.enter.native="dataFormSubmit()"
+      :disabled="type == 'view'"
       label-width="80px"
+         style="margin-top: 10px;"
     >
       <el-row style="margin-bottom: 10px">
         <el-col :span="6"
@@ -62,10 +79,11 @@
               clearable
               class="ele-block"
               v-model="dataForm.status"
+              :disabled="true"
               placeholder="请选择"
             >
-              <el-option label="失效" :value="0" />
-              <el-option label="有效" :value="1" />
+              <el-option label="停用" :value="0" />
+              <el-option label="启用" :value="1" />
             </el-select> </el-form-item
         ></el-col>
       </el-row>
@@ -79,6 +97,7 @@
               disabled
             ></el-input>
             <el-button
+              v-if="type != 'view'"
               size="small"
               type="primary"
               @click.native="handleTaskinstance"
@@ -165,7 +184,7 @@
           @columns-change="handleColumnChange"
           :cache-key="cacheKeyUrl"
         >
-          <template v-slot:toolbar>
+          <template v-slot:toolbar v-if="type != 'view'">
             <el-button @click="handAdd(1)" size="mini" type="primary"
               >新增质检项</el-button
             >
@@ -255,10 +274,11 @@
             </el-input>
             <el-button
               type="primary"
-              @click="viewTemplate(row.procedureId)"
-              v-if="row.procedureId"
+              @click="viewTemplate(row.procedureJson.tempJson, 5, $index)"
+              v-if="row.procedureJson.tempJson"
               style="margin-left: 8px"
-              >预览</el-button
+              :disabled="false"
+              >{{ type == 'view' ? '预览' : '编辑' }}</el-button
             >
           </template>
           <template v-slot:recordName="{ row, $index }">
@@ -271,13 +291,14 @@
             </el-input>
             <el-button
               type="primary"
-              @click="viewTemplate(row.recordId)"
-              v-if="row.recordId"
+              @click="viewTemplate(row.recordJson.tempJson, 7, $index)"
+              v-if="row.recordJson.tempJson"
+              :disabled="false"
               style="margin-left: 8px"
-              >预览</el-button
+              >{{ type == 'view' ? '预览' : '编辑' }}</el-button
             >
           </template>
-          <template v-slot:action="{ row, $index }">
+          <template v-slot:action="{ row, $index }" v-if="type != 'view'">
             <el-popconfirm
               class="ele-action"
               title="确定要删除当前质检项吗?"
@@ -305,13 +326,13 @@
           @selection-change="selectionChange"
           :need-page="false"
         >
-          <template v-slot:toolbar>
+          <template v-slot:toolbar v-if="type != 'view'">
             <el-button @click="handAdd(2)" size="mini" type="primary"
               >选择物品</el-button
             >
           </template>
 
-          <template v-slot:action="{ row, $index }">
+          <template v-slot:action="{ row, $index }" v-if="type != 'view'">
             <el-popconfirm
               class="ele-action"
               title="确定要删除当前物品吗?"
@@ -329,7 +350,9 @@
     </el-form>
     <span slot="footer" class="dialog-footer">
       <el-button @click="handleClose()">取消</el-button>
-      <el-button type="primary" @click="dataFormSubmit()">保存</el-button>
+      <el-button type="primary" @click="dataFormSubmit()" v-if="type != 'view'"
+        >保存</el-button
+      >
     </span>
     <termPop ref="termRef" @selectChange="selectChange"></termPop>
 
@@ -354,7 +377,14 @@
     ></releaseRules>
     <experimentationProcessDialog
       ref="experimentationProcessDialog"
+      @success="experimentationSave"
+      :edit="type == 'view' ? false : true"
+      :readonly="type == 'view'"
     ></experimentationProcessDialog>
+    <bpmDetail
+      v-if="activeComp == 'bpm' && dataForm.processInstanceId"
+      :id="dataForm.processInstanceId"
+    ></bpmDetail>
   </ele-modal>
 </template>
 
@@ -370,9 +400,10 @@
     save,
     update,
     getById,
-    templatecategoryPage
+    templatecategoryPage,
+    qualitytemplateChange
   } from '@/api/inspectionTemplate';
-  import { recordrulesGetById } from '@/api/main/index';
+  import bpmDetail from '@/views/bpm/processInstance/detail.vue';
 
   import { getCode } from '@/api/login';
   export default {
@@ -381,7 +412,8 @@
       EquipmentDialog,
       taskinstanceDialog,
       releaseRules,
-      experimentationProcessDialog
+      experimentationProcessDialog,
+      bpmDetail
     },
     mixins: [tabMixins],
     data() {
@@ -390,6 +422,13 @@
         columnsVersion: 1,
         visible: false,
         taskinstanceDialogFlag: false,
+        isChange: '',
+        type: '',
+        activeComp: 'main',
+        tabOptions: [
+          { key: 'main', name: '质检方案详情' },
+          { key: 'bpm', name: '流程详情' }
+        ],
         dataForm: {
           id: 0,
           type: null,
@@ -582,6 +621,9 @@
     },
     methods: {
       addTemplate(type, index) {
+        if (this.type == 'view') {
+          return;
+        }
         if (this.list[index].executionMethod != 2) {
           return;
         }
@@ -589,24 +631,47 @@
         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);
+      async viewTemplate(tempJson, type, index) {
+        this.releaseRulesType = type;
+        this.currentIndex = index;
+        this.$refs.experimentationProcessDialog.open(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].procedureJson,
+            'tempJson',
+            data.tempJson.tempJson
+          );
           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].recordJson,
+            'tempJson',
+            data.tempJson.tempJson
+          );
           this.$set(this.list[this.currentIndex], 'recordName', data.name);
         }
       },
+      experimentationSave(tempJson) {
+        if (this.releaseRulesType == 5) {
+          this.$set(
+            this.list[this.currentIndex].procedureJson,
+            'tempJson',
+            tempJson
+          );
+        }
+
+        if (this.releaseRulesType == 7) {
+          this.$set(
+            this.list[this.currentIndex].recordJson,
+            'tempJson',
+            tempJson
+          );
+        }
+      },
       handleExecutionMethodChange(row) {
         if (row.executionMethod == 1) {
           row.procedureId = '';
@@ -660,6 +725,8 @@
       selectChange(list) {
         this.list = list.map((item) => {
           item['sort'] = item['sort'] || 0;
+          item['procedureJson'] = {}
+          item['recordJson'] = {}
           return item;
         });
       },
@@ -680,7 +747,10 @@
         });
         this.templateCategoryList.push(...categoryList);
       },
-      init(id) {
+      init(type, id, isChange) {
+        this.type = type;
+        this.isChange = isChange;
+        this.activeComp='main'
         this.getTnspectionPlanType();
         this.dataForm.id = id || 0;
         this.visible = true;
@@ -730,7 +800,11 @@
             if (!this.dataForm.id) {
               delete this.dataForm.id;
             }
-            const saveOrUpdate = this.dataForm.id ? update : save;
+            const saveOrUpdate = this.isChange
+              ? qualitytemplateChange
+              : this.dataForm.id
+              ? update
+              : save;
             if (this.dataForm.id) {
               this.dataForm.inspectionItemVOList = this.list.map((item) => {
                 if (!item.inspectionItemId) {
@@ -753,8 +827,8 @@
                 this.loading = false;
                 this.$refs['dataForm'].resetFields();
                 // this.dataForm = {};
-                const info = this.dataForm.id ? '修改成功' : '新增成功';
-                this.$message.success(info);
+                // const info = this.dataForm.id ? '修改成功' : '新增成功';
+                this.$message.success('操作成功');
                 this.visible = false;
 
                 this.templateCategoryList = []; // 必加:清空物品列表

+ 3 - 4
src/views/inspectionTemplate/components/inspectionTemplateDialog.vue

@@ -19,8 +19,7 @@
       v-if="equipmentdialog"
       @selection-change="handleSelectionChange"
       :initLoad="false"
-      @columns-change="handleColumnChange"
-      :cache-key="cacheKeyUrl"
+
     >
       <template v-slot:status="{ row }">
         {{ row.status ? '启用' : '停用' }}
@@ -36,11 +35,11 @@
 <script>
 import search from './search.vue';
 import { getList } from '@/api/inspectionTemplate';
-import tabMixins from '@/mixins/tableColumnsMixin';
+// import tabMixins from '@/mixins/tableColumnsMixin';
 
 export default {
   components: { search },
-  mixins: [tabMixins],
+  // mixins: [tabMixins],
   data() {
     return {
       cacheKeyUrl:

+ 332 - 228
src/views/inspectionTemplate/index.vue

@@ -20,13 +20,22 @@
         @columns-change="handleColumnChange"
         :cache-key="cacheKeyUrl"
       >
+        <template v-slot:qualitySchemeTemplateCode="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="addOrUpdateHandle('view', row.id)"
+          >
+            {{ row.qualitySchemeTemplateCode }}
+          </el-link>
+        </template>
         <template v-slot:toolbar>
           <el-button
             size="small"
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="addOrUpdateHandle()"
+            @click="addOrUpdateHandle('add')"
           >
             新增
           </el-button>
@@ -47,19 +56,37 @@
 
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link
+          <!-- <el-link
             type="primary"
             :underline="false"
             icon="el-icon-tickets"
             @click="copyData(row)"
           >
             复制
+          </el-link> -->
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="approvalSubmit(row)"
+            v-if="row.isUpdate != 1 && [0, 3].includes(row.approvalStatus)"
+          >
+            发布
           </el-link>
           <el-link
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="updateStatus(row)"
+            @click="addOrUpdateHandle('edit', row.id, true)"
+            v-if="row.isUpdate != 1 && [2].includes(row.approvalStatus)"
+          >
+            变更
+          </el-link>
+          <!-- <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="updateStatus(row) && [0, 3].includes(row.approvalStatus)"
             v-if="row.status == 1"
           >
             不启用
@@ -68,14 +95,15 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="updateStatus(row)"
+            @click="updateStatus(row) && [0, 3].includes(row.approvalStatus)"
             v-if="row.status == 0"
           >
             启用
-          </el-link>
+          </el-link> -->
           <el-link
             type="primary"
             :underline="false"
+            v-if="[0, 3].includes(row.approvalStatus)"
             icon="el-icon-edit"
             @click="addOrUpdateHandle(row.id)"
           >
@@ -83,6 +111,7 @@
           </el-link>
           <el-popconfirm
             class="ele-action"
+            v-if="[0, 3].includes(row.approvalStatus)"
             title="确定要删除此方案吗?"
             @confirm="deleteHandle(row.id)"
           >
@@ -100,241 +129,316 @@
       ref="addOrUpdateRef"
       @refreshDataList="getDataList"
     ></AddOrUpdate>
+    <processSubmitDialog
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="search"
+    ></processSubmitDialog>
   </div>
 </template>
 
 <script>
-import AddOrUpdate from './AddorUpdate';
-// import search from './components/search.vue';
-import dictMixins from '@/mixins/dictMixins';
-import {
-  getList,
-  removeItem,
-  update,
-  copyData,
-  updateStatus
-} from '@/api/inspectionTemplate';
-import tabMixins from '@/mixins/tableColumnsMixin';
-export default {
-  mixins: [dictMixins, tabMixins],
-  components: {
-    AddOrUpdate
-    // search
-  },
-  computed: {},
-  data() {
-    return {
-      cacheKeyUrl:'qsm-c2e9664a-inspectionTemplate',
-      seekList: [
-        {
-          label: '名称:',
-          value: 'qualitySchemeTemplateName',
-          type: 'input',
-          placeholder: ''
-        },
-        {
-          label: '编码:',
-          value: 'qualitySchemeTemplateCode',
-          type: 'input',
-          placeholder: ''
-        },
-        // {
-        //   label: '类型:',
-        //   value: 'type',
-        //   type: 'select',
-        //   placeholder: '',
-        //   planList: []
-        // },
-        {
-          label: '类型:',
-          value: 'type',
-          type: 'DictSelection',
-          dictName: '质检计划类型',
-          placeholder: ''
-        },
-        {
-          label: '状态:',
-          value: 'status',
-          type: 'select',
-          planList: [
-            { value: 0, label: '停用' },
-            { value: 1, label: '启用' }
-          ],
-          placeholder: ''
-        }
-      ],
-      dataForm: {
-        key: ''
-      },
-      selection: [],
-      columns: [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center',
-          reserveSelection: true
-        },
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          prop: 'type',
-          label: '类型',
-          showOverflowTooltip: true,
-          align: 'center',
-          minWidth: 110,
-          formatter: (row, column, cellValue) => {
-            return this.getDictName('质检计划类型', cellValue);
+  import AddOrUpdate from './AddorUpdate';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
+
+  import dictMixins from '@/mixins/dictMixins';
+  import {
+    getList,
+    removeItem,
+    update,
+    copyData,
+    updateStatus
+  } from '@/api/inspectionTemplate';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  export default {
+    mixins: [dictMixins, tabMixins],
+    components: {
+      AddOrUpdate,
+      processSubmitDialog
+      // search
+    },
+    computed: {},
+    data() {
+      return {
+        processSubmitDialogFlag: false,
+        cacheKeyUrl: 'qsm-c2e9664a-inspectionTemplate',
+        seekList: [
+          {
+            label: '名称:',
+            value: 'qualitySchemeTemplateName',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '编码:',
+            value: 'qualitySchemeTemplateCode',
+            type: 'input',
+            placeholder: ''
+          },
+          // {
+          //   label: '类型:',
+          //   value: 'type',
+          //   type: 'select',
+          //   placeholder: '',
+          //   planList: []
+          // },
+          {
+            label: '类型:',
+            value: 'type',
+            type: 'DictSelection',
+            dictName: '质检计划类型',
+            placeholder: ''
+          },
+          {
+            label: '状态:',
+            value: 'status',
+            type: 'select',
+            planList: [
+              { value: 0, label: '停用' },
+              { value: 1, label: '启用' }
+            ],
+            placeholder: ''
           }
+        ],
+        dataForm: {
+          key: ''
         },
-        {
-          prop: 'qualitySchemeTemplateCode',
-          label: '质检方案编码',
-          showOverflowTooltip: true,
-          align: 'center',
-          minWidth: 110
-        },
-        {
-          prop: 'qualitySchemeTemplateName',
-          label: '质检方案名称',
-          align: 'center',
-          minWidth: 150
-        },
-        {
-          label: '工序名称',
-          prop: 'taskName',
-          align: 'center'
-        },
-        {
-          label: '状态',
-          prop: 'status',
-          slot: 'status',
-          align: 'center'
-        },
-        {
-          prop: 'templateRemark',
-          label: '备注',
-          showOverflowTooltip: true,
-          align: 'center',
-          minWidth: 110
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 260,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          fixed: 'right'
-        }
-      ],
-      typeList: [],
-      renderFlag: false
-    };
-  },
-  async created() {
-    // const res = await this.requestDict('质检计划类型');
-    // console.log(res, 'res 000');
-    // this.typeList = res.map((item) => {
-    //   console.log(item,'item')
-    //   // let values = Object.keys(item);
-    //   // return {
-    //   //   value: Number(values[0]),
-    //   //   label: item[values[0]]
-    //   // };
-    //   return {
-    //     value: item.dictCode,
-    //     label: item.dictValue
-    //   };
-    // });
+        selection: [],
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'type',
+            label: '类型',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110,
+            formatter: (row, column, cellValue) => {
+              return this.getDictName('质检计划类型', cellValue);
+            }
+          },
+          {
+            prop: 'qualitySchemeTemplateCode',
+            slot: 'qualitySchemeTemplateCode',
+            label: '质检方案编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'qualitySchemeTemplateName',
+            label: '质检方案名称',
+            align: 'center',
+            minWidth: 150
+          },
+          {
+            label: '工序名称',
+            prop: 'taskName',
+            align: 'center'
+          },
+          {
+            label: '版本号',
+            prop: 'version',
+            align: 'center',
+            formatter: (row) => {
+              return `${row.versionSymbol}${row.bigVersion}${row.versionMark}${row.smallVersion}`;
+            }
+          },
+          {
+            label: '创建人',
+            prop: 'createUserName',
+            align: 'center'
+          },
+          {
+            label: '创建时间',
+            prop: 'createTime',
+            align: 'center',
+            width: 170
+          },
+          // {
+          //   label: '启用时间',
+          //   prop: '启用时间',
+          //   align: 'center'
+          // },
+          {
+            label: '停用时间',
+            prop: 'updateTime',
+            align: 'center',
+            formatter: (row) => {
+              if (row.status != 1) {
+                return updateTime;
+              }
+            },
+            width: 170
+          },
+          {
+            label: '状态',
+            prop: 'status',
+            slot: 'status',
+            align: 'center'
+          },
+          {
+            label: '发布状态',
+            prop: 'approvalStatus',
+            formatter: (row) => {
+              return row.approvalStatus == 0
+                ? '待发布'
+                : row.approvalStatus == 1
+                ? '审批中'
+                : row.approvalStatus == 2
+                ? '已发布'
+                : '审核不通过';
+            },
+            align: 'center'
+          },
+          {
+            prop: 'templateRemark',
+            label: '备注',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 260,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
+          }
+        ],
+        typeList: [],
+        renderFlag: false
+      };
+    },
+    async created() {
+      // const res = await this.requestDict('质检计划类型');
+      // console.log(res, 'res 000');
+      // this.typeList = res.map((item) => {
+      //   console.log(item,'item')
+      //   // let values = Object.keys(item);
+      //   // return {
+      //   //   value: Number(values[0]),
+      //   //   label: item[values[0]]
+      //   // };
+      //   return {
+      //     value: item.dictCode,
+      //     label: item.dictValue
+      //   };
+      // });
 
-    // const index = this.seekList.findIndex((item) => item.value === 'type');
+      // const index = this.seekList.findIndex((item) => item.value === 'type');
 
-    // this.$set(this.seekList, index, );
-    this.renderFlag = true;
-  },
-  methods: {
-    // 获取数据列表
-    datasource({ page, where, limit }) {
-      return getList({
-        ...where,
-        pageNum: page,
-        size: limit
-      });
-    },
-    // 多选
-    selectionChangeHandle(val) {
-      this.selection = val;
+      // this.$set(this.seekList, index, );
+      this.renderFlag = true;
     },
-    // 新增 / 修改
-    addOrUpdateHandle(id) {
-      this.$refs.addOrUpdateRef.init(id);
-    },
-    // 删除
-    deleteHandle(id) {
-      var ids = id
-        ? [id]
-        : this.selection.map((item) => {
-            return item.id;
-          });
-      this.$confirm(
-        `确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`,
-        '提示',
-        {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }
-      ).then(() => {
-        removeItem(ids)
-          .then(({ message }) => {
-            this.$message.success(message);
+    methods: {
+      // 获取数据列表
+      datasource({ page, where, limit }) {
+        return getList({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+      },
+      // 多选
+      selectionChangeHandle(val) {
+        this.selection = val;
+      },
+      // 新增 / 修改
+      addOrUpdateHandle(type, id, isChange) {
+        this.$refs.addOrUpdateRef.init(type, id, isChange);
+      },
+      async approvalSubmit(res) {
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: res.id,
+            businessKey: 'qms_quality_template_release',
+            formCreateUserId: res.createUserId,
+            variables: {
+              businessCode: res.qualitySchemeTemplateCode,
+              businessName: res.qualitySchemeTemplateName,
+              businessType: this.getDictName('质检计划类型', res.type)
+            }
+          };
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
+      // 删除
+      deleteHandle(id) {
+        var ids = id
+          ? [id]
+          : this.selection.map((item) => {
+              return item.id;
+            });
+        this.$confirm(
+          `确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`,
+          '提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        ).then(() => {
+          removeItem(ids)
+            .then(({ message }) => {
+              this.$message.success(message);
+              this.getDataList();
+            })
+            .catch((e) => {});
+        });
+      },
+      getDataList() {
+        this.$refs.search.search();
+      },
+      search(where) {
+        this.$refs.table.reload({
+          where: where,
+          page: 1
+        });
+      },
+      //上下架操作
+      updateStatus(row) {
+        let dataForm = {};
+        let status = row.status === 1 ? 0 : 1;
+        dataForm['status'] = status;
+        dataForm['id'] = row.id;
+        updateStatus(dataForm)
+          .then((res) => {
+            this.loading = false;
+            this.$message.success('操作成功!');
+            this.visible = false;
             this.getDataList();
           })
-          .catch((e) => {});
-      });
-    },
-    getDataList() {
-      this.$refs.search.search();
-    },
-    search(where) {
-      this.$refs.table.reload({
-        where: where,
-        page: 1
-      });
-    },
-    //上下架操作
-    updateStatus(row) {
-      let dataForm = {};
-      let status = row.status === 1 ? 0 : 1;
-      dataForm['status'] = status;
-      dataForm['id'] = row.id;
-      updateStatus(dataForm)
-        .then((res) => {
-          this.loading = false;
-          this.$message.success('操作成功!');
-          this.visible = false;
+          .catch((e) => {
+            this.loading = false;
+          });
+      },
+      copyData(row) {
+        console.log(row.id);
+        copyData(row.id).then((res) => {
+          console.log(res);
+          this.$message.success('复制成功!');
           this.getDataList();
-        })
-        .catch((e) => {
-          this.loading = false;
         });
-    },
-    copyData(row) {
-      console.log(row.id);
-      copyData(row.id).then((res) => {
-        console.log(res);
-        this.$message.success('复制成功!');
-        this.getDataList();
-      });
+      }
     }
-  }
-};
+  };
 </script>

+ 57 - 37
src/views/inspectionWork/components/baseInfo.vue

@@ -110,27 +110,52 @@
     <div>
       <el-row>
         <el-col :span="6">
-          <el-form-item label="质检部门" prop="groupId">
+          <el-form-item
+            label="执行部门"
+            prop="executeDeptId"
+            v-if="form.qualityType != 2"
+          >
             <deptSelect
-              :disabled="btnType == 'detail' || form.qualityType == 2"
-              v-model="form.groupId"
+              :disabled="btnType == 'detail'"
+              v-model="form.executeDeptId"
               @changeGroup="searchDeptNodeClick"
             />
           </el-form-item>
         </el-col>
+        <el-col :span="6" v-if="form.qualityType == 2">
+          <el-form-item label="执行班组" prop="executeJobId">
+            <el-select
+              :disabled="btnType == 'detail'"
+              v-model="form.executeJobId"
+              size="small"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in form.jobList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="changeExecuteJob(item)"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
         <el-col :span="6">
-          <el-form-item label="质检人" prop="qualityIdList">
+          <el-form-item label="执行人" prop="executeUserId">
             <el-select
-              :disabled="btnType == 'detail' || form.qualityType == 2"
-              v-model="form.qualityIdList"
-              @change="changeExecutor"
+              :disabled="btnType == 'detail'"
+              v-model="form.executeUserIdList"
               size="small"
               style="width: 100%"
               filterable
               multiple
+              @change="executeUserIdChange"
             >
               <el-option
-                v-for="item in executorList"
+                v-for="item in form.qualityType == 2
+                  ? form.jobList.find((job) => job.id == form.executeJobId)
+                      ?.userVOList
+                  : executorList"
                 :key="item.id"
                 :value="item.id"
                 :label="item.name"
@@ -161,45 +186,35 @@
         </el-col>
       </el-row>
       <el-row>
-        <el-col :span="6" v-if="form.qualityType == 2">
-          <el-form-item label="执行班组" prop="executeJobId">
-            <el-select
-              :disabled="btnType == 'detail'"
-              v-model="form.executeJobId"
-              size="small"
-              style="width: 100%"
-            >
-              <el-option
-                v-for="item in form.jobList"
-                :key="item.id"
-                :value="item.id"
-                :label="item.name"
-                @click.native="changeExecuteJob(item)"
-              ></el-option>
-            </el-select>
+        <el-col :span="6">
+          <el-form-item label="接收人部门" prop="groupId">
+            <!-- <deptSelect
+              :disabled="btnType == 'detail' || form.qualityType == 2"
+              v-model="form.groupId"
+              @changeGroup="searchDeptNodeClick"
+            /> -->
+            <el-input v-model="form.groupName" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="执行人" prop="executeUserId">
-            <el-select
-              :disabled="btnType == 'detail'"
-              v-model="form.executeUserIdList"
+          <el-form-item label="接收人" prop="qualityIdList">
+            <el-input v-model="form.qualityName" disabled></el-input>
+            <!-- <el-select
+              :disabled="btnType == 'detail' || form.qualityType == 2"
+              v-model="form.qualityIdList"
+              @change="changeExecutor"
               size="small"
               style="width: 100%"
               filterable
               multiple
-              @change="executeUserIdChange"
             >
               <el-option
-                v-for="item in form.qualityType == 2
-                  ? form.jobList.find((job) => job.id == form.executeJobId)
-                      ?.userVOList
-                  : executorList"
+                v-for="item in executorList"
                 :key="item.id"
                 :value="item.id"
                 :label="item.name"
               ></el-option>
-            </el-select>
+            </el-select> -->
           </el-form-item>
         </el-col>
       </el-row>
@@ -516,6 +531,9 @@
           executeJobId: [
             { required: true, message: '请选择执行班组', trigger: 'change' }
           ],
+          executeDeptId: [
+            { required: true, message: '请选择执行部门', trigger: 'change' }
+          ],
 
           // qualityId: [
           //   { required: true, message: '请选择质检人', trigger: 'change' }
@@ -718,13 +736,15 @@
       //选择部门(搜索)
       searchDeptNodeClick(info, row) {
         this.form.executeUserId = '';
-
+        this.$set(this.form, 'executeUserName',' item.name');
+        this.$set(this.form, 'executeUserIdList', '');
         if (info) {
           const params = { groupId: info };
           this.getUserList(params);
-          this.form.groupName = row.name;
+          this.form.executeDeptName = row.name;
         } else {
-          this.form.executeGroupId = null;
+          this.form.executeDeptId = null;
+          this.form.executeDeptName = null;
         }
       },
       // 获取人员

+ 17 - 9
src/views/inspectionWork/components/experimentReport.vue

@@ -261,6 +261,8 @@
         <el-col :span="24">
           <experimentationProcess
             ref="experimentationProcess1"
+            :edit="false"
+
           ></experimentationProcess> </el-col
       ></el-row>
       <header-title title="工艺要求"> </header-title>
@@ -340,6 +342,7 @@
         <el-col :span="24">
           <experimentationProcess
             ref="experimentationProcess2"
+            :edit="false"
           ></experimentationProcess> </el-col
       ></el-row>
       <el-row>
@@ -383,7 +386,13 @@
 
     <template v-slot:footer>
       <el-button size="small" @click="handleClose">关闭</el-button>
-      <el-button type="primary" size="small" @click="save" v-if="type!='detail'">保存</el-button>
+      <el-button
+        type="primary"
+        size="small"
+        @click="save"
+        v-if="type != 'detail'"
+        >保存</el-button
+      >
       <!-- <el-button type="primary" size="small" @click="submit">提交</el-button> -->
     </template>
     <releaseRules
@@ -603,10 +612,9 @@
     },
     watch: {},
     methods: {
-      async open(row,type) {
+      async open(row, type) {
         this.tableData = [row];
         this.type = type;
-        console.log(row, 'dasd');
         this.getSampleQuantityCount = row.getSampleQuantityCount;
         if (row.experimentId) {
           this.$set(this, 'form', await getById(row.experimentId));
@@ -629,13 +637,13 @@
           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.procedureJson.tempJson) {
+              this.$refs.experimentationProcess1.init(
+                row.procedureJson.tempJson
+              );
             }
-            if (row.recordId) {
-              const data = await recordrulesGetById(row.recordId);
-              this.$refs.experimentationProcess2.init(data.tempJson.tempJson);
+            if (row.recordJson.tempJson) {
+              this.$refs.experimentationProcess2.init(row.recordJson.tempJson);
             }
           });
         }

+ 48 - 6
src/views/inspectionWork/components/inspectionProjectReport.vue

@@ -18,6 +18,11 @@
       <template v-slot:toolbar>
         剩余样品总数:{{ form.remainingSampleCount }}{{ form.measureUnit }}
       </template>
+      <template v-slot:craftFiles="{ row }">
+        <el-link type="primary" :underline="false" @click="craftFiles(row)"
+          >工艺文件</el-link
+        >
+      </template>
 
       <template v-slot:isRequired="{ column }">
         <span class="is-required">{{ column.label }}</span>
@@ -231,6 +236,7 @@
       ref="experimentReport"
       @done="experimentReportDone"
     ></experimentReport>
+    <wokePopup ref="wokePopupRef"></wokePopup>
   </ele-modal>
 </template>
 
@@ -244,10 +250,14 @@
     exeTaskReportWork,
     exeEntrustReportWork
   } from '@/api/inspectionProjectTask';
+  import wokePopup from '@/components/workList/wokePopup.vue';
+  import { parameterGetByCode } from '@/api/main/index';
+  import { craftFiles } from '@/api/inspectionWork';
+
   export default {
     mixins: [dictMixins, detailMixins],
 
-    components: { toolButtom, experimentReport },
+    components: { toolButtom, experimentReport, wokePopup },
 
     data() {
       return {
@@ -384,7 +394,9 @@
             align: 'center',
             formatter: (row) => {
               if (row.sampleQualifiedNumber) {
-                return row.sampleQualifiedNumber +(this.form.measureUnit || '')
+                return (
+                  row.sampleQualifiedNumber + (this.form.measureUnit || '')
+                );
               }
             },
             label: '样品合格数',
@@ -397,7 +409,7 @@
             align: 'center',
             formatter: (row) => {
               if (row.lossNumber) {
-                return row.lossNumber + (this.form.measureUnit || '')
+                return row.lossNumber + (this.form.measureUnit || '');
               }
             },
             label: '损耗数(合格品)',
@@ -410,7 +422,9 @@
             align: 'center',
             formatter: (row) => {
               if (row.lossNumberUnqualified) {
-                return row.lossNumberUnqualified + (this.form.measureUnit || '')
+                return (
+                  row.lossNumberUnqualified + (this.form.measureUnit || '')
+                );
               }
             },
             label: '损耗数(不合格品)',
@@ -423,7 +437,9 @@
             align: 'center',
             formatter: (row) => {
               if (row.retainedSampleQuantity) {
-                return row.retainedSampleQuantity +(this.form.measureUnit || '')
+                return (
+                  row.retainedSampleQuantity + (this.form.measureUnit || '')
+                );
               }
             },
             label: '留样数(合格品)',
@@ -436,7 +452,9 @@
             align: 'center',
             formatter: (row) => {
               if (row.retainedSampleUnqualified) {
-                return row.retainedSampleUnqualified + (this.form.measureUnit || '')
+                return (
+                  row.retainedSampleUnqualified + (this.form.measureUnit || '')
+                );
               }
             },
             label: '留样数(不合格品)',
@@ -473,6 +491,15 @@
             align: 'center',
             label: '质检时间',
             showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'craftFiles',
+            slot: 'craftFiles',
+            align: 'center',
+            label: '工艺文件',
+            fixed: 'right',
+            showOverflowTooltip: true
           }
         ],
 
@@ -695,6 +722,21 @@
       this.requestDict('质检标准类型');
     },
     methods: {
+      async craftFiles(row) {
+        const res = await parameterGetByCode({
+          code: 'mes_craft_file_by_category_code'
+        });
+        const byCategory = res?.value === '1';
+
+        if (byCategory) {
+          this.$refs.wokePopupRef.openTwo(row);
+        } else {
+          const data = row.qualityWorkOrderId
+            ? await craftFiles(row.qualityWorkOrderId)
+            : [];
+          this.$refs.wokePopupRef.open(data.map((item) => item.id));
+        }
+      },
       experimentReport(row, type) {
         console.log(this.getSampleQuantityCount, 'this.form');
         this.$refs.experimentReport.open(

+ 33 - 16
src/views/inspectionWork/details.vue

@@ -52,12 +52,25 @@
                 </el-form-item>
               </el-col>
               <el-col :span="6">
-                <el-form-item label="质检部门">
+                <el-form-item label="接收人部门">
                   <el-input :value="form.groupName" disabled />
                 </el-form-item>
               </el-col>
-            </el-row>
-            <el-row>
+              <el-col :span="6">
+                <el-form-item label="接收人">
+                  <el-input :value="qualityName" disabled />
+                </el-form-item>
+              </el-col>
+       
+              <el-col :span="6">
+                <el-form-item
+                  label="执行部门"
+                  prop="executeDeptName"
+                  v-if="form.qualityType != 2"
+                >
+                  <el-input :value="form.executeDeptName" disabled />
+                </el-form-item>
+              </el-col>
               <el-col :span="6" v-if="form.qualityType == 2">
                 <el-form-item label="执行班组" prop="executeJobName">
                   <el-input :value="form.executeJobName" disabled />
@@ -68,11 +81,7 @@
                   <el-input :value="form.executeUserName" disabled />
                 </el-form-item>
               </el-col>
-              <el-col :span="6">
-                <el-form-item label="质检人">
-                  <el-input :value="qualityName" disabled />
-                </el-form-item>
-              </el-col>
+
               <el-col :span="6">
                 <el-form-item label="质检时间">
                   <el-input :value="qualityTime" disabled />
@@ -240,9 +249,11 @@
                   label="留样数(合格品):"
                   prop="retainedSampleQuantity"
                 >
-                  <el-input disabled :value="form.retainedSampleQuantity" ><template slot="append">{{
+                  <el-input disabled :value="form.retainedSampleQuantity"
+                    ><template slot="append">{{
                       sourceData2[0]?.measureUnit
-                    }}</template></el-input>
+                    }}</template></el-input
+                  >
                 </el-form-item>
               </el-col>
               <el-col :span="6">
@@ -250,16 +261,20 @@
                   label="留样数(不合格品):"
                   prop="retainedSampleUnqualified"
                 >
-                  <el-input disabled :value="form.retainedSampleUnqualified" ><template slot="append">{{
+                  <el-input disabled :value="form.retainedSampleUnqualified"
+                    ><template slot="append">{{
                       sourceData2[0]?.measureUnit
-                    }}</template></el-input>
+                    }}</template></el-input
+                  >
                 </el-form-item>
               </el-col>
               <el-col :span="6">
                 <el-form-item label="损耗数(合格品):" prop="lossNumber">
-                  <el-input disabled :value="form.lossNumber" ><template slot="append">{{
+                  <el-input disabled :value="form.lossNumber"
+                    ><template slot="append">{{
                       sourceData2[0]?.measureUnit
-                    }}</template></el-input>
+                    }}</template></el-input
+                  >
                 </el-form-item>
               </el-col>
               <el-col :span="6">
@@ -267,9 +282,11 @@
                   label="损耗数(不合格品):"
                   prop="lossNumberUnqualified"
                 >
-                  <el-input disabled :value="form.lossNumberUnqualified" ><template slot="append">{{
+                  <el-input disabled :value="form.lossNumberUnqualified"
+                    ><template slot="append">{{
                       sourceData2[0]?.measureUnit
-                    }}</template></el-input>
+                    }}</template></el-input
+                  >
                 </el-form-item>
               </el-col>
             </el-row>

+ 52 - 19
src/views/inspectionWork/edit.vue

@@ -102,7 +102,11 @@
                 disabled
                 :value="getSampleQuantity('sampleQualifiedNumber')"
                 placeholder=""
-              > <template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+              >
+                <template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -113,7 +117,11 @@
                 disabled
                 :value="getSampleQuantity('sampleNoQualifiedNumber')"
                 placeholder=""
-              > <template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+              >
+                <template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -150,7 +158,11 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="样品数量:" prop="sampleQuantity">
-              <el-input type="number" disabled v-model="form.sampleQuantity" > <template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+              <el-input type="number" disabled v-model="form.sampleQuantity">
+                <template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -166,14 +178,20 @@
                 v-if="form.recordingMethod == 1"
                 disabled
                 :value="getSampleQuantity('retainedSampleQuantity')"
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
               <el-input
                 v-else
                 v-model="form.retainedSampleQuantity"
                 @input="
                   inputValue('retainedSampleQuantity', 'sampleQualifiedNumber')
                 "
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -185,7 +203,10 @@
                 v-if="form.recordingMethod == 1"
                 disabled
                 :value="getSampleQuantity('retainedSampleUnqualified')"
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
               <el-input
                 v-else
                 v-model="form.retainedSampleUnqualified"
@@ -195,7 +216,10 @@
                     'sampleNoQualifiedNumber'
                   )
                 "
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -204,12 +228,18 @@
                 v-if="form.recordingMethod == 1"
                 disabled
                 :value="getSampleQuantity('lossNumber')"
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
               <el-input
                 v-else
                 v-model="form.lossNumber"
                 @input="inputValue('lossNumber', 'sampleQualifiedNumber')"
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -221,14 +251,20 @@
                 v-if="form.recordingMethod == 1"
                 disabled
                 :value="getSampleQuantity('lossNumberUnqualified')"
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
               <el-input
                 v-else
                 v-model="form.lossNumberUnqualified"
                 @input="
                   inputValue('lossNumberUnqualified', 'sampleNoQualifiedNumber')
                 "
-              ><template slot="append">{{ sampleList[0]?.measureUnit }}</template></el-input>
+                ><template slot="append">{{
+                  sampleList[0]?.measureUnit
+                }}</template></el-input
+              >
             </el-form-item>
           </el-col>
         </el-row>
@@ -903,8 +939,6 @@
       //质检项报工
       inspectionProjectReport({ index, list }) {
         this.$nextTick(() => {
-
-          
           if (this.form.taskMonadInfo) {
             delete this.form.taskMonadInfo.remainingSampleCount;
           }
@@ -929,7 +963,7 @@
                 qualityNames: this.form.qualityNames,
                 qualityTimeEnd: this.form.qualityTimeEnd,
                 remainingSampleCount: this.form.remainingSampleCount,
-                measureUnit:this.sampleList[0]?.measureUnit
+                measureUnit: this.sampleList[0]?.measureUnit
               },
               row: this.form.taskMonadInfo || {},
               list
@@ -1514,8 +1548,7 @@
 
           delete this.form['qualityTimeEnd'];
 
-          this.form.executeUserId = '';
-          this.form.executeUserName = '';
+          this.form.executeUserId = this.form.executeUserIdList.join(',');
           let params = {
             ...this.form,
             sampleList: this.sampleList,
@@ -1693,7 +1726,6 @@
               return;
             }
           }
-          this.loading = true;
 
           this.form.qualityTimeEnd = this.getNowTime();
           this.form.qualityTimeStart = this.qualityTimeStart;
@@ -1710,8 +1742,8 @@
               this.form.executeUserIdList.length > 1
                 ? this.form.executeUserName +
                   ',' +
-                  this.$store.state.user.info.userName
-                : this.$store.state.user.info.userName;
+                  this.$store.state.user.info.name
+                : this.$store.state.user.info.name;
           }
           this.form.executeUserId = this.form.executeUserIdList.join(',');
 
@@ -1724,6 +1756,7 @@
             // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
             qualityInventoryList: this.inventoryList
           };
+          this.loading = true;
 
           exeReportWork(params)
             .then((msg) => {

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

@@ -400,7 +400,7 @@
           },
           {
             prop: 'qualityName',
-            label: '质检人',
+            label: '接收人',
             align: 'center',
             width: 120,
             showOverflowTooltip: true,
@@ -411,6 +411,17 @@
               return row.qualityNames || '';
             }
           },
+          {
+            prop: 'executeUserName',
+            label: '执行人',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+      
+              return row.executeUserName || '';
+            }
+          },
           {
             prop: 'qualityTime',
             label: '质检时间',
@@ -740,7 +751,7 @@
 
         sampleCollection({ id: row.id }).then((res) => {
           this.$message.success('收样成功');
-           this.search();
+          this.search();
         });
       },
       // 批量关闭

+ 12 - 6
src/views/inspectionWork/mixins/detailMixins.js

@@ -52,13 +52,9 @@ export default {
           prop: 'inspectionStandardsName',
           span: 6
         },
+   
         {
-          label: '质检部门',
-          prop: 'groupName',
-          span: 6
-        },
-        {
-          label: '质检人',
+          label: '接收人',
           prop: 'qualityName',
           span: 6
         },
@@ -148,7 +144,17 @@ export default {
         {
           prop: 'executeUserName',
           label: '执行人'
+        },
+          {
+          prop: 'executeDeptName',
+          label: '执行部门'
+        },
+        
+        {
+          prop: 'groupName',
+          label: '接收人部门'
         }
+        
       ],
       disposeTypeMap: {
         1: '返工',

+ 2 - 2
src/views/sample/sampleRecord/components/addSample.vue

@@ -195,7 +195,7 @@
         <el-col :span="16">
           <el-row>
             <el-col :span="6" v-if="form.conditionType == 2">
-              <el-form-item prop="quantity">
+              <el-form-item prop="quantity" label="数量">
                 <el-input
                   v-model="form.quantity"
                   placeholder="请输入"
@@ -214,7 +214,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="8" v-if="form.conditionType == 2">
-              <el-form-item prop="portion" label="数">
+              <el-form-item prop="portion" label="数">
                 <el-input
                   v-model="form.portion"
                   placeholder="请输入"