695593266@qq.com 6 ヶ月 前
コミット
56f0a69e2b

+ 17 - 0
src/api/system/organization/index.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request';
+import { download } from '@/utils/file';
 
 /**
  * 查询机构列表
@@ -171,3 +172,19 @@ export async function getCurrentUserAuthorityDeptAPI() {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+/**
+ * 组织结构导出
+ * @param
+ */
+export async function exportGroupsAPI() {
+  const res = await request.post(
+    '/main/group/exportGroups',
+    {},
+    {
+      responseType: 'blob'
+    }
+  );
+  download(res.data, '组织机构列表.xlsx');
+}

+ 4 - 4
src/components/selectRecordPlan/selectRecordPlan.vue

@@ -107,7 +107,7 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.groupName).join(',');
+                return row.executeUsers.map((i) => i.groupName).join(',');
               }
               return '';
             }
@@ -120,20 +120,20 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.userName).join(',');
+                return row.executeUsers.map((i) => i.userName).join(',');
               }
               return '';
             }
           },
           {
-            prop: 'executeUser',
+            prop: 'executeUsers',
             label: '班组',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 1) {
-                return row.executeUser.map((i) => i.teamName).join(',');
+                return row.executeUsers.map((i) => i.teamName).join(',');
               }
               return '';
             }

+ 1 - 1
src/utils/util.js

@@ -58,7 +58,7 @@ export function generateRandomString(num = 5) {
   }
   for (let j = 0; j < 3; j++) {
     result += charactersNum.charAt(
-      Math.floor(Math.random() * charactersLength)
+      Math.floor(Math.random() * charactersNum.length)
     );
   }
   return result;

+ 17 - 1
src/views/enterpriseModel/dept/index.vue

@@ -31,6 +31,15 @@
             折叠全部
           </el-button>
           <!-- <el-button type="primary" size="mini" icon="el-icon-upload2" plain @click="uploadFile">导入</el-button> -->
+           <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-download"
+            class="ele-btn-icon"
+            @click="exportData"
+          >
+            导出
+          </el-button>
         </template>
         <!-- 标题列 -->
         <template v-slot:name="{ row }">
@@ -123,7 +132,8 @@ import importDialog from '@/components/upload/import-dialog.vue';
 
 import {
   listOrganizations,
-  removeOrganization
+  removeOrganization,
+  exportGroupsAPI
 } from '@/api/system/organization';
 
 export default {
@@ -275,6 +285,12 @@ export default {
     foldAll() {
       this.$refs.table.toggleRowExpansionAll(false);
     },
+    // 导出数据
+    exportData() {
+      exportGroupsAPI().then(() => {
+        // this.$message.success('导出成功');
+      });
+    },
     /* 显示编辑 */
     openEdit(item) {
       this.editData = item;

+ 12 - 7
src/views/factoryModel/station/components/edit.vue

@@ -724,11 +724,16 @@
           if (!valid) {
             return false;
           }
-          // this.form.tMainFactoryWorkstationOperationAddPOList =
-          //   this.$refs.stationMeter.getValue();
-          // if (!this.form.tMainFactoryWorkstationOperationAddPOList.length) {
-          //   return this.$message.error('请添加工序');
-          // }
+          this.form.factoryWorkstationOperations =
+            this.$refs.stationMeter.getValue();
+          if (!this.form.factoryWorkstationOperations.length) {
+            return this.$message.error('请添加工序');
+          } else {
+            this.form.taskIds =
+              this.form.factoryWorkstationOperations.map(
+                (n) => n.operationId
+              );
+          }
           this.loading = true;
 
           if (this.type != 'edit') {
@@ -901,9 +906,9 @@
             // }
           }
           this.$nextTick(() => {
-            console.log(res.tMainFactoryWorkstationOperationAddPOList);
+            // console.log(res.tMainFactoryWorkstationOperationAddPOList);
             this.$refs.stationMeter.setValue(
-              res.tMainFactoryWorkstationOperationAddPOList
+              res.factoryWorkstationOperations
             );
           });
           this.form = Object.assign({}, this.form, res);

+ 4 - 2
src/views/material/BOMmanage/components/standardOutput.vue

@@ -39,7 +39,7 @@
             row-key="id"
             height="calc(100vh - 350px)"
             class="dict-table"
-            :cacheKey="cacheKeyUrl"
+            :cache-key="cacheKeyUrl"
           >
             <template v-slot:componentAttribute="{ row }">
               <div>
@@ -65,6 +65,7 @@
   import { getTreeByGroup } from '@/api/classifyManage';
   import { getByCode } from '@/api/system/dictionary-data';
   import { produceTypeList } from '@/enum/dict.js';
+  import tabMixins from '@/mixins/tableColumnsMixin';
 
   const measureTypeList = [
     {
@@ -89,6 +90,7 @@
     }
   ];
   export default {
+    mixins: [tabMixins],
     components: { ProductSearch },
     data() {
       return {
@@ -254,7 +256,7 @@
 
         treeList: [],
         treeLoading: false,
-        cacheKeyUrl: 'standardOutputKey',
+        cacheKeyUrl: 'main-material-detail-standardOutputKey',
 
         defaultProps: {
           children: 'children',

+ 145 - 17
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -804,6 +804,30 @@
             ref="firstArticleDualInspectionParamRef"
           ></term>
         </el-tab-pane>
+        <el-tab-pane label="NC程序" name="NC程序">
+          <ele-pro-table
+            ref="ncFileTable"
+            :columns="jobColumns2"
+            :datasource="ncCodeList"
+            :need-page="false"
+            :immediate="true"
+          >
+            <!-- 表头工具栏 -->
+            <template v-if="!isView" v-slot:toolbar>
+              <el-button type="primary" @click="addFile('ncCodeList')"
+                >添加</el-button
+              >
+            </template>
+            <template v-slot:action="{ row, $index }">
+              <el-link type="primary" @click="handleDel(row, $index)"
+                >删除</el-link
+              >
+              <el-link type="primary" @click="fileDetails(row, 'nc')"
+                >详情</el-link
+              >
+            </template>
+          </ele-pro-table>
+        </el-tab-pane>
       </el-tabs>
     </el-card>
     <!-- 选择工艺参数 -->
@@ -1184,7 +1208,76 @@
             showOverflowTooltip: true
           }
         ],
-
+        // 表格选中数据
+        jobColumns2: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'versions',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'remark',
+            label: '文本描述',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'ncSize',
+            label: '文件大小',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'createName',
+            label: '创建人',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 260,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
         standardCol: [
           {
             prop: 'code',
@@ -1246,6 +1339,7 @@
         },
 
         qualityParam: [],
+        ncCodeList: [],
         firstArticleDualInspectionParam: [],
         qualityPointParam: [],
 
@@ -1253,7 +1347,8 @@
         resourceBomId: '',
         level: '',
         attributeData: {},
-        unitList: []
+        unitList: [],
+        fileListType: ''
       };
     },
     created() {
@@ -1262,24 +1357,38 @@
       this.getDicTUnitList('measuring_uint');
     },
     methods: {
-      addFile() {
+      addFile(fileListType) {
         this.fileShow = true;
+        this.fileListType = fileListType;
       },
       fileClose(val) {
         if (val == false) {
           this.fileShow = false;
         } else {
           this.fileShow = false;
-
-          this.$refs.fileTable.setData([
-            ...val,
-            ...this.$refs.fileTable.getData()
-          ]);
-          this.$set(
-            this.tableData.taskParam[this.currentIndex],
-            'fileParam',
-            this.$refs.fileTable.getData()
-          );
+          if (this.fileListType == 'ncCodeList') {
+            console.log(val, 'val');
+
+            this.ncCodeList.push(
+              ...val.map((item) => {
+                item.ncSize = item.sizeUnit;
+                item.versions = item.version;
+                item.fileId = item.id;
+                return item;
+              })
+            );
+            // this.tableData.taskParam[this.currentIndex].ncCodeList=this.tableData.taskParam[this.currentIndex].ncCodeList||[]
+          } else {
+            this.$refs.fileTable.setData([
+              ...val,
+              ...this.$refs.fileTable.getData()
+            ]);
+            this.$set(
+              this.tableData.taskParam[this.currentIndex],
+              'fileParam',
+              this.$refs.fileTable.getData()
+            );
+          }
         }
       },
 
@@ -1328,13 +1437,25 @@
 
           this.tableData.taskParam[this.currentIndex].materialQuota = res.data;
 
+
+
           console.log(this.tableData, 'this.tableData');
         });
         // this.$refs.bomDetailList.open(this.resourceBomId, this.level)
       },
 
-      fileDetails(row) {
-        window.open(setFileUrl(row));
+      fileDetails(row, type) {
+        if (type == 'nc') {
+          newFilePageAPI({
+            ids: "'" + row.fileId + "'"
+          }).then((res) => {
+            if (res.length) {
+              window.open(setFileUrl(res[0]));
+            }
+          });
+        } else {
+          window.open(setFileUrl(row));
+        }
       },
       addJob() {
         this.$refs.jobRef.open();
@@ -1442,6 +1563,8 @@
           type = 'standardOutput';
         } else if (this.activeName === '关键设备') {
           type = 'standardDevice';
+        } else if (this.activeName === 'NC程序') {
+          type = 'ncCodeList';
         }
 
         this.tableData.taskParam[this.currentIndex][type].splice(index, 1);
@@ -1806,7 +1929,8 @@
 
         this.baseCount2 = rowData.baseCount2;
         this.baseCountUnit2 = rowData.baseCountUnit2;
-
+   this.ncCodeList =
+            this.tableData.taskParam[this.currentIndex].ncCodeList || [];
         this.visible = true;
         setTimeout(() => {
           console.log(this.$refs);
@@ -1910,7 +2034,11 @@
                   this.$set(this.tableData.taskParam[index], 'fileParam', val);
                 }
               });
-              console.log('111112223344', this.tableData.taskParam);
+              this.$set(
+                this.tableData.taskParam[this.currentIndex],
+                'ncCodeList',
+                this.ncCodeList
+              );
 
               // 保存过程控制事项
               this.$refs.userSettingMatterProcessRef?.saveMatterList();

+ 166 - 27
src/views/rulesManagement/components/programRulesDialog.vue

@@ -35,29 +35,64 @@
             </div>
           </el-form-item>
         </el-col>
-        <el-col :span="8">
-          <el-form-item label="类型" prop="autoOrder">
-            <el-select v-model="addForm.type" size="small" @change="typeChange" style="width: 100%">
+        <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
+          <el-form-item label="类型" prop="type">
+            <el-select v-model="addForm.type" :disabled="isBindPlan" size="small" @change="typeChange" style="width: 100%">
               <el-option :value="1" label="班组"></el-option>
               <el-option :value="0" label="个人"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')">
+
+        <el-col :span="8" v-if="dispatchType && addForm.type == 1 && !dialogTitle.includes('量具送检')">
+          <el-form-item label="班组" prop="teamId">
+            <el-select
+              v-model="addForm.teamId"
+              :disabled="isBindPlan"
+              size="small"
+              @change="teamChange"
+              style="width: 100%"
+            >
+              <el-option
+                :value="i.id"
+                :label="i.name"
+                v-for="i in teamAllList"
+                :key="i.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8" v-if="dispatchType && addForm.type == 0 && !dialogTitle.includes('量具送检')">
           <el-form-item label="部门" prop="groupId">
             <deptSelect v-model="addForm.groupId" @changeGroup="searchDeptNodeClick" :disabled="isBindPlan" />
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="
-          addForm.autoOrder &&
-          !dialogTitle.includes('量具送检') &&
-          addForm.type == 0
+        <el-col :span="8" v-if="dispatchType && addForm.type == 0 && !dialogTitle.includes('量具送检')
         ">
-          <el-form-item label="负责人" prop="executeIdList">
+          <!-- <el-form-item label="负责人" prop="executeIdList">
             <el-select v-model="addForm.executeIdList" size="small" style="width: 100%" :disabled="isBindPlan" multiple
               filterable>
               <el-option v-for="item in executorList" :key="item.id" :value="item.id" :label="item.name"></el-option>
             </el-select>
+          </el-form-item> -->
+          <el-form-item label="负责人" prop="executeIdList">
+            <el-select
+              v-model="addForm.executeIdList"
+              :disabled="isBindPlan"
+              size="small"
+              style="width: 100%"
+              multiple
+              filterable
+              @change="executeIdListChange"
+            >
+              <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-col :span="8" v-if="!dialogTitle.includes('量具送检')">
@@ -277,6 +312,7 @@ import {
   bomTaskDelete,
   getByTaskId
 } from '@/api/material/BOM';
+import { getteampage } from '@/api/workforceManagement/team';
 
 import { getFile } from '@/api/system/file';
 import { deepClone } from 'ele-admin/lib/utils/core';
@@ -308,7 +344,6 @@ export default {
       brandNum: '',
       specification: '',
       measuringUnit: '',
-
       bomList: []
     };
     return {
@@ -338,7 +373,9 @@ export default {
         executorPhone: '',
         status: 1, // 状态
         remark: '', // 备注
-        urgent: '1'
+        urgent: '1',
+        teamId: '', // 班组id
+        executeUsers: [], // 执行人
       },
       ruleNameList: [], // 规则列表
       uerList: [], // 审核人列表
@@ -377,9 +414,15 @@ export default {
         executeIdList: [
           { required: true, message: '请选择人员', trigger: 'change' }
         ],
+        teamId: [
+          { required: true, message: '请选择班组', trigger: 'change' }
+        ],
         urgent: [
           { required: true, message: '请选择紧急程度', trigger: 'change' }
-        ]
+        ],
+        type: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
       },
 
       columns: [
@@ -470,13 +513,18 @@ export default {
       tabsValue: null,
 
       hasCategoryId:false,
-      getByIdData:{}
+      getByIdData:{},
+      modelType: '',
+      teamAllList: [],
     };
   },
   computed: {
     // 是否开启响应式布局
     styleResponsive() {
       return this.$store.state.theme.styleResponsive;
+    },
+    dispatchType() {
+      return ((this.addForm.autoOrder && (this.modelType == 'add' || this.modelType == 'edit')) || (!this.addForm.autoOrder && this.modelType == 'dispatch'))
     }
   },
   watch: {
@@ -498,13 +546,15 @@ export default {
     }
   },
   mounted() {
+    this.getAllTeamList();
     this.getUserList({groupId: "1"});
   },
   methods: {
     // 初始化
-    async init(row, tips) {
+    async init(type, row, tips) {
       console.log(row);
       console.log(tips);
+      this.modelType = type;
       if (row) {
         this.getInfo(row.id);
       } else {
@@ -525,7 +575,9 @@ export default {
           executorPhone: '',
           status: 1, // 状态
           remark: '', // 备注
-          urgent: '1'
+          urgent: '1',
+          teamId: '', // 班组id
+          executeUsers: [], // 执行人
         };
         this.ruleIdList = [];
         this.isBindPlan = false;
@@ -533,9 +585,44 @@ export default {
         //   this.matterRulesList = [];
       }
     },
-    typeChange() {
-      this.addForm.groupId = '';
-      this.addForm.executeIdList = [];
+    async getAllTeamList() {
+      const { list } = await getteampage({
+        pageNum: 1,
+        size: -1
+      });
+      console.log('teamAllList 班组', list);
+      this.teamAllList = list;
+    },
+    teamChange() {
+      console.log('this.addForm.teamId', this.addForm.teamId);
+      // 当前班组
+      const currentTeam = this.teamAllList.find(
+        (item) => item.id === this.addForm.teamId
+      );
+      if (currentTeam) {
+        // 同步执行人
+        this.addForm.executeUsers = [
+          {
+            teamId: currentTeam.id,
+            teamName: currentTeam.name
+          }
+        ];
+      }
+    },
+    typeChange(v) {
+      console.log('typeChange', v, this.addForm.executeIdList);
+      // this.addForm.groupId = '';
+      // this.addForm.executeIdList = [];
+      // this.addForm.teamId = '';
+      // this.addForm.executeUsers = [];
+      this.$set(this.addForm, 'executeUsers', []);
+      if(v == 0) {
+        this.$set(this.addForm, 'groupId', '');
+        this.$set(this.addForm, 'executeIdList', []);
+      } else {
+        this.$set(this.addForm, 'teamId', '');
+      }
+      this.$forceUpdate();
     },
     ruleChange(item) {
       this.ruleObj.name = item.name;
@@ -675,7 +762,8 @@ export default {
       try {
         const res = await getInfoById(id);
         console.log('res----------', res);
-        this.addForm = res;
+        // this.addForm = res;
+        
         this.isBindPlan = res.isBindPlan;
         this.categoryEquipment(res.categoryLevelId);
         this.ruleIdList = res.planConfigVOList.map((item) => {
@@ -700,17 +788,52 @@ export default {
             ruleItems: item.ruleMatters
           };
         });
+
+        // 处理回显数据
+        if (res.type === 0) {
+          // 个人
+          res.executeIdList = res.executeUsers.map(
+            (item) => item.userId
+          );
+
+          let groupIds = res.executeUsers
+            .map((i) => i.groupId)
+            .filter((i) => i);
+          groupIds = Array.from(new Set(groupIds));
+
+          if (groupIds.includes('1')) {
+            // 包含全部部门,置空
+            res.groupId = '1';
+          } else {
+            res.groupId = res.executeUsers?.[0]?.groupId || '1';
+          }
+
+          // this.addForm.teamId = ''
+          // this.$set(this.addForm, 'teamId', '');
+
+          groupIds.map((item) => {
+            this.searchDeptNodeClick(item);
+          });
+        } else {
+          // 班组
+          res.teamId = res.executeUsers?.[0]?.teamId || '';
+          // this.$set(this.addForm, 'groupId', '');
+          // this.$set(this.addForm, 'executeIdList', []);
+          // this.addForm.groupId = ''
+          // this.addForm.executeIdList = []
+        }
         this.tabsValue = this.ruleIdList[0].ruleId;
         if (res.groupId) {
           const params = { groupId: res.groupId };
           this.getUserList(params);
         }
+        this.$set(this, 'addForm', res)
         // this._getMatterRulesDetails(res.ruleId);
         this.$set(this.addForm, 'code', res.code);
         this.$set(this.addForm, 'urgent', JSON.stringify(res.urgent));
-        this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
+        // this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
         this.$set(this.addForm, 'imageUrl', {});
-        console.log(this.rootData);
+        // console.log(this.rootData);
         const rep = await getTreeByType(0);
         console.log('sasas', res);
         const ids = this.findTopLevelAncestorId(
@@ -772,20 +895,36 @@ export default {
     },
     //选择部门(搜索)
     async searchDeptNodeClick(info, data) {
+      console.log('searchDeptNodeClick', info, data);
       if (info) {
         // 根据部门获取人员
-        this.addForm.groupName = data.name;
+        // this.addForm.groupName = data.name;
         const params = { groupId: info };
         await this.getUserList(params);
-        if (this.addForm.type == 1) {
-          this.addForm.executeIdList = this.executorList.map(
-            (item) => item.id
-          );
-        }
+        // if (this.addForm.type == 1) {
+        //   this.addForm.executeIdList = this.executorList.map(
+        //     (item) => item.id
+        //   );
+        // }
       } else {
         this.addForm.groupId = null;
       }
     },
+    // 负责人变更 同步执行人列表
+    executeIdListChange(v) {
+      console.log('executeIdListChange', v);
+      this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
+        const user = this.executorList.find((u) => u.id === userId);
+        return {
+          userId: user.id,
+          userName: user.name,
+
+          groupId: user.groupId,
+          groupName: user.groupName
+        };
+      });
+      console.log('this.addForm.executeUsers', this.addForm.executeUsers);
+    },
     // 过滤计划完成时长
     formDataDurationTime(value) {
       if (value > 0) {

+ 4 - 4
src/views/rulesManagement/inspectionPoint/index.vue

@@ -19,7 +19,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openEdit('add')"
             v-if="$hasPermission('eam:planconfig:save')"
           >
             新建
@@ -42,7 +42,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit('edit', row)"
             v-if="$hasPermission('eam:planconfig:update')"
           >
             修改
@@ -272,7 +272,7 @@
         });
       },
 
-      openEdit(row) {
+      openEdit(type, row) {
         this.isBindPlan = false;
         this.addProgramRulesDialog = true;
         if (row) {
@@ -291,7 +291,7 @@
               : '新增检修配置';
         }
         this.$nextTick(() => {
-          this.$refs.programRulesDialog.init(
+          this.$refs.programRulesDialog.init(type, 
             row,
             this.ruleType == 1
               ? '巡点检'

+ 4 - 4
src/views/rulesManagement/maintenance/index.vue

@@ -19,7 +19,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openEdit('add')"
             v-if="$hasPermission('eam:planconfig:save')"
           >
             新建
@@ -36,7 +36,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit('edit', row)"
             v-if="$hasPermission('eam:planconfig:update')"
 
           >
@@ -236,7 +236,7 @@ export default {
       this.$refs.table.reload({ page: 1, where, ruleType: 2 });
     },
 
-    openEdit(row) {
+    openEdit(type,row) {
       this.isBindPlan = false;
       this.addProgramRulesDialog = true;
       if (row) {
@@ -245,7 +245,7 @@ export default {
         this.dialogTitle = '新增保养计划配置';
       }
       this.$nextTick(() => {
-        this.$refs.programRulesDialog.init(row, '保养');
+        this.$refs.programRulesDialog.init(type, row, '保养');
       });
     },
 

+ 4 - 4
src/views/rulesManagement/measuringSubmit/index.vue

@@ -19,7 +19,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openEdit('add')"
             v-if="$hasPermission('eam:planconfig:save')"
           >
             新建
@@ -36,7 +36,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit('edit', row)"
             v-if="$hasPermission('eam:planconfig:update')"
           >
             修改
@@ -236,7 +236,7 @@ export default {
       this.$refs.table.reload({ page: 1, where, ruleType: 1 });
     },
 
-    openEdit(row) {
+    openEdit(type, row) {
       this.isBindPlan = false;
       this.addProgramRulesDialog = true;
       if (row) {
@@ -245,7 +245,7 @@ export default {
         this.dialogTitle = '新增量具送检计划配置';
       }
       this.$nextTick(() => {
-        this.$refs.programRulesDialog.init(row, '量具送检');
+        this.$refs.programRulesDialog.init(type, row, '量具送检');
       });
     },
 

+ 9 - 9
src/views/rulesManagement/recordPlan/components/programRulesDialog.vue

@@ -603,7 +603,7 @@
         configType: 1,
         createUserName: '',
         duration: null,
-        executeUser: [
+        executeUsers: [
           // {
           //   groupId: 0,
           //   groupName: '',
@@ -881,11 +881,11 @@
         // 处理回显数据
         if (this.addForm.type === 0) {
           // 个人
-          this.addForm.executeIdList = this.addForm.executeUser.map(
+          this.addForm.executeIdList = this.addForm.executeUsers.map(
             (item) => item.userId
           );
 
-          let groupIds = this.addForm.executeUser
+          let groupIds = this.addForm.executeUsers
             .map((i) => i.groupId)
             .filter((i) => i);
           groupIds = Array.from(new Set(groupIds));
@@ -894,7 +894,7 @@
             // 包含全部部门,置空
             this.addForm.groupId = '1';
           } else {
-            this.addForm.groupId = this.addForm.executeUser[0]?.groupId || '1';
+            this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '1';
           }
 
           groupIds.map((item) => {
@@ -902,7 +902,7 @@
           });
         } else {
           // 班组
-          this.addForm.teamId = this.addForm.executeUser[0]?.teamId || '';
+          this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
         }
         this.tabsValue = this.addForm.children[0]?.ruleId || '';
 
@@ -933,7 +933,7 @@
           rule.configType = body.configType;
           rule.createUserName = body.createUserName;
           rule.duration = body.duration;
-          rule.executeUser = body.executeUser;
+          rule.executeUsers = body.executeUsers;
           rule.name = body.name;
           rule.nextExecuteTime = body.nextExecuteTime;
           rule.remark = body.remark;
@@ -1316,7 +1316,7 @@
       },
       // 负责人变更 同步执行人列表
       executeIdListChange() {
-        this.addForm.executeUser = this.addForm.executeIdList.map((userId) => {
+        this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
           const user = this.executorList.find((u) => u.id === userId);
           return {
             userId: user.id,
@@ -1326,7 +1326,7 @@
             groupName: user.groupName
           };
         });
-        console.log('this.addForm.executeUser', this.addForm.executeUser);
+        console.log('this.addForm.executeUsers', this.addForm.executeUsers);
       },
       async getAllTeamList() {
         const { list } = await getteampage({
@@ -1344,7 +1344,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.addForm.executeUser = [
+          this.addForm.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name

+ 4 - 4
src/views/rulesManagement/recordPlan/index.vue

@@ -118,7 +118,7 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.groupName).join(',');
+                return row.executeUsers.map((i) => i.groupName).join(',');
               }
               return '';
             }
@@ -131,20 +131,20 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.userName).join(',');
+                return row.executeUsers.map((i) => i.userName).join(',');
               }
               return '';
             }
           },
           {
-            prop: 'executeUser',
+            prop: 'executeUsers',
             label: '班组',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 1) {
-                return row.executeUser.map((i) => i.teamName).join(',');
+                return row.executeUsers.map((i) => i.teamName).join(',');
               }
               return '';
             }

+ 9 - 6
src/views/rulesManagement/releaseRules/components/experimentationProcess.vue

@@ -69,6 +69,9 @@
       <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 +129,7 @@
           size="mini"
           style="width: 100px; margin-right: 8px; flex-shrink: 0"
           @change="paramSelectChange($event, 'id')"
+          filterable
         >
           <el-option
             v-for="item in idList"
@@ -271,7 +275,7 @@
         });
         equation.forEach((item) => {
           for (const key in item.equation) {
-            let data=this.getObjValue() //每次计算都获取最新的值
+            let data = this.getObjValue(); //每次计算都获取最新的值
             let value = '';
             if (item.equation[key].length) {
               item.equation[key].forEach((equationItem) => {
@@ -300,8 +304,8 @@
           if (item.type == 'customText') {
             data = { ...item.valueObj, ...data };
           } else {
-            item.valueObj.rows.forEach((row) => {
-              row.cells.forEach((cell) => {
+            item.valueObj.columns.forEach((row) => {
+              row.forEach((cell) => {
                 data[cell.id] = cell.value;
               });
             });
@@ -327,8 +331,8 @@
               this.idList.push(key);
             }
           } else {
-            item.valueObj.rows.forEach((row) => {
-              row.cells.forEach((cell) => {
+            item.valueObj.columns.forEach((row) => {
+              row.forEach((cell) => {
                 this.idList.push(cell.id);
               });
             });
@@ -405,7 +409,6 @@
       init(list) {
         this.list = JSON.parse(list);
         if (this.list.length) {
-          // this.list[0].id="ozFSPs"
           this.$nextTick(() => {
             this.list.forEach((item) => {
               this.$refs['customTextRef' + item.id][0].init({

+ 7 - 7
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -104,7 +104,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item :label="qmsReportWorkType.includes(formData.reportWorkType)?'模板编码':'记录规则编码'" prop="code">
+          <el-form-item label="编码" prop="code">
             <el-input
               v-model="formData.code"
               :disabled="true"
@@ -113,7 +113,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item :label="qmsReportWorkType.includes(formData.reportWorkType)?'模板版本':'记录规则版本'">
+          <el-form-item label="版本">
             <el-input
               :value="versionText"
               disabled
@@ -122,7 +122,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item :label="qmsReportWorkType.includes(formData.reportWorkType)?'模板名称':'记录规则名称'"  prop="name">
+          <el-form-item label="名称"  prop="name">
             <el-input
               v-model="formData.name"
               placeholder="请输入"
@@ -1042,7 +1042,7 @@
         formData: JSON.parse(JSON.stringify(formDateBase)),
         formRules: {
           name: [
-            { required: true, message: '请输入规则名称', trigger: 'blur' }
+            { required: true, message: '请输入名称', trigger: 'blur' }
           ],
           frequencyValue: [
             { required: true, message: '请选择周期', trigger: 'blur' },
@@ -1376,7 +1376,7 @@
             this.formData.details.length == 0 &&
             !this.qmsReportWorkType.includes(this.formData.reportWorkType)
           ) {
-            return this.$message.warning('至少条件一条规则项');
+            return this.$message.warning('至少选择一条规则项');
           }
 
           try {
@@ -1420,7 +1420,7 @@
           }
           if (!this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
             if (this.formData.details.length == 0) {
-              return this.$message.warning('至少条件一条规则项');
+              return this.$message.warning('至少选择一条规则项');
             }
 
             if (this.formData.reportWorkType == 4) {
@@ -1858,7 +1858,7 @@
         // 只验证详情内容
         if (!this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
           if (this.formData.details.length == 0) {
-            return this.$message.warning('至少条件一条规则项');
+            return this.$message.warning('至少选择一条规则项');
           }
 
           // 判断参数类型是否选择

+ 235 - 124
src/views/rulesManagement/releaseRules/components/templateDiv/customTable.vue

@@ -1,57 +1,74 @@
 <!-- 搜索表单 -->
 <template>
   <div style="margin-top: 10px">
-    <el-button type="primary" @click="addColumn" v-if="edit">新增列</el-button>
-    <el-button type="primary" @click="addRow" v-if="edit">新增行</el-button>
-
-    <table style="margin-top: 10px" :id="id">
-      <thead>
-        <tr>
-          <th
-            v-for="(item, index) in columns"
-            class="tableTh"
-            :style="{ width: item.width + 'px' }"
-          >
-            <i
-              class="el-icon-delete delete"
-              style="display: none"
-              @click="removeColumn(index)"
-              v-if="edit"
-            ></i>
-            <input
-              v-model="item.value"
-              type="text"
-              class="templateInput"
-              :id="item.id"
-              :readonly="item.readonly == 2 || !edit"
-              @click="inputClick(item, 'columns')"
-            />
-          </th>
-          <th v-if="edit"></th>
-        </tr>
-      </thead>
-      <tbody>
-        <tr v-for="(row, rowIndex) in rows">
-          <td v-for="item in row.cells"
-            ><input
-              v-model="item.value"
-              type="text"
-              class="templateInput"
-              :id="item.id"
-              :readonly="item.readonly == 2 || !edit"
-              @click="inputClick(item)"
-              @input="calculation"
-          /></td>
-          <td v-if="edit">
-            <i
-              class="sort-handle el-icon-delete delete"
-              style="color: #f56c6c"
-              @click="removeRow(rowIndex)"
-            ></i
-          ></td>
-        </tr>
-      </tbody>
-    </table>
+    <el-button type="primary" @click="addColumn()" v-if="edit"
+      >新增列</el-button
+    >
+    <el-button type="primary" @click="addRow(columns.length)" v-if="edit"
+      >新增行</el-button
+    >
+    <div class="table" style="margin-top: 10px" :id="id">
+      <div class="table-body" style="display: flex">
+        <template v-for="(row, index) in columns">
+          <div class="column" :style="{ width: row[0].width + 'px' }">
+            <div
+              class="table-body-item tableTd"
+              v-for="(item, rowIndex) in row"
+              :style="{
+                height: item.rowspan * 30 + 'px',
+                display: item.rowspan ? 'block' : 'none'
+              }"
+            >
+              <i
+                class="el-icon-delete delete"
+                style="display: none"
+                @click="removeColumn(index)"
+                v-if="edit && rowIndex == 0"
+              ></i>
+              <i
+                class="el-icon-circle-plus-outline add"
+                style="display: none"
+                @click="addColumn(index)"
+                v-if="edit && rowIndex == 0"
+              ></i>
+              <i
+                class="el-icon-delete deleteRow"
+                @click="removeRow(rowIndex)"
+                v-if="edit && rowIndex != 0"
+              ></i>
+              <i
+                class="el-icon-circle-plus-outline addRow"
+                style="display: none"
+                @click="addRow(rowIndex, index)"
+                v-if="edit && rowIndex != 0 && index != columns.length - 1"
+              ></i>
+              <textarea
+                v-if="item.rowspan > 1"
+                v-model="item.value"
+                class="templateInput"
+                :id="item.id"
+                :readonly="item.readonly == 2 || !edit"
+                @click="inputClick(item)"
+                @input="calculation"
+                autocomplete="off"
+                style="resize: none"
+              ></textarea>
+              <input
+                v-else
+                v-model="item.value"
+                class="templateInput"
+                :id="item.id"
+                :readonly="item.readonly == 2 || !edit"
+                @click="inputClick(item, rowIndex == 0 ? 'columns' : null)"
+                @input="calculation"
+                type="text"
+                autocomplete="off"
+              />
+            </div>
+          </div>
+        </template>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -76,73 +93,123 @@
         domId: '',
         rightClickShow: false,
         columns: [],
-        rows: [],
+        // rows: [],
         equation: {}
       };
     },
     created() {},
     methods: {
       // 方法:添加新列
-      addColumn() {
-        this.columns.push({
-          value: `列${this.columns.length + 1}`,
-          id: generateRandomString(5),
-          readonly: 1
-        });
-        this.rows.forEach((row) => {
-          row.cells.push({
-            value: '',
-            readonly: 1,
-            id: generateRandomString(5)
-          });
-        });
+      addColumn(index) {
+        let length = this.columns[0]?.length || 1;
+        if (index === 0 || index) {
+          this.columns.splice(
+            index + 1,
+            0,
+            Array(length)
+              .fill(null)
+              .map(() => this.getInput())
+          );
+        } else {
+          this.columns.push(
+            Array(length)
+              .fill(null)
+              .map(() => this.getInput())
+          );
+        }
+      },
+      getInput() {
+        return {
+          readonly: 1,
+          value: '',
+          rowspan: 1,
+          id: generateRandomString(5)
+        };
       },
 
       // 方法:删除指定列
       removeColumn(index) {
         this.columns.splice(index, 1);
-        this.rows.forEach((row) => {
-          row.cells.splice(index, 1);
-        });
       },
 
       // 方法:添加新行
-      addRow() {
-        const newRow = {
-          cells: Array(this.columns.length)
-            .fill(null)
-            .map(() => ({
-              readonly: 1,
-              value: '',
-              id: generateRandomString(5)
-            }))
-        };
-        this.rows.push(newRow);
-      },
-      // 方法:删除指定行
-      removeRow(index) {
-        this.rows.splice(index, 1);
+      addRow(rowIndex, columnIndex) {
+        if (columnIndex > 0) { //不是第一列则需要合并单元格
+          this.columns.forEach((item, newColumnIndex) => {
+            let newRow = this.getInput();
+            if (newColumnIndex < columnIndex) {
+              newRow.rowspan = 0;
+              let _rowIndex = null;
+              if (item[rowIndex].rowspan == 0) {
+                _rowIndex = this.getPreventRowspan(newColumnIndex, 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, this.getInput());
+          });
+        }
       },
+      //找到真正需要改变rowspan的行
+      getPreventRowspan(columnIndex, rowIndex) {
+        let preventRowspan = null;
+        this.columns[columnIndex].forEach((item, newRowIndex) => {
+          if (newRowIndex < rowIndex && item.rowspan > 1) { //向上找到当前列合并过单元格的行
+            preventRowspan = newRowIndex;
+          }
+        });
 
-      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];
-            });
+        return preventRowspan;
+      },
+      // 方法:删除指定行
+      removeRow(rowIndex) {
+        this.columns.forEach((item, columnIndex) => {
+          if (item[rowIndex].rowspan == 0) { // 如果当前列,删除的这一行rowspan为0,则需要找到真正需要改变rowspan的行
+            let preventRowspanIndex = this.getPreventRowspan(
+              columnIndex,
+              rowIndex
+            );
+            if (preventRowspanIndex) {
+              this.$set(
+                this.columns[columnIndex][preventRowspanIndex],
+                'rowspan',
+                this.columns[columnIndex][preventRowspanIndex].rowspan - 1
+              );
+            }
+          } else if (item[rowIndex].rowspan > 1) { //rowspan大于1,代表合并过单元格,需要吧值继承给下一行
+            let data = item[rowIndex];
+            data.rowspan--;
+            this.$set(this.columns[columnIndex], [rowIndex + 1], data); 
           }
-        }
+
+          item.splice(rowIndex, 1);
+        });
       },
+
+
       calculation() {
         this.$emit('calculation');
-
       },
       equationValue({ domId, value }) {
-        this.rows.forEach((item, index) => {
-          let cellIndex = item.cells.findIndex((cell) => cell.id == domId);
+        this.columns.forEach((item, index) => {
+          let cellIndex = item.findIndex((cell) => cell.id == domId);
           if (cellIndex != '-1') {
-            this.$set(this.rows[index].cells[cellIndex], 'value', value);
+            this.$set(this.columns[index][cellIndex], 'value', value);
           }
         });
       },
@@ -151,35 +218,23 @@
           form: null,
           equation: this.equation,
           valueObj: {
-            columns: this.columns,
-            rows: this.rows
+            columns: this.columns
           }
         };
       },
       init({ form, valueObj, equation }) {
         this.form = form;
         this.columns = valueObj.columns;
-        this.rows = valueObj.rows;
         this.equation = equation || {};
       },
       editInputChange(domObj) {
         if (domObj.equation) {
           this.equation[this.domId] = domObj.equation;
         }
-        let columnsIndex = this.columns.findIndex(
-          (item) => item.id == this.domId
-        );
-        if (columnsIndex >= 0) {
-          this.$set(this.columns, columnsIndex, domObj);
-          return;
-        }
-        this.rows.forEach((item, index) => {
-          let rowsIndex = item.cells.findIndex(
-            (cells) => cells.id == this.domId
-          );
-
+        this.columns.forEach((item, index) => {
+          let rowsIndex = item.findIndex((cells) => cells.id == this.domId);
           if (rowsIndex >= 0) {
-            this.$set(this.rows[index].cells, rowsIndex, domObj);
+            this.$set(this.columns[index], rowsIndex, domObj);
           }
         });
       },
@@ -199,6 +254,7 @@
             id: item.id,
             readonly: item.readonly,
             value: item.value,
+            rowspan: item.rowspan,
             equation: this.equation[item.id]
           }
         });
@@ -215,20 +271,51 @@
     text-align: center;
     background-color: #fff;
   }
-  table {
-    width: 100%;
-    border-collapse: collapse;
-  }
-  th,
-  td {
-    border: 1px solid #ddd;
-    padding: 0;
-    text-align: center;
-    height: 30px;
+
+  .table-header {
+    span {
+      display: inline-block;
+      height: 30px;
+      border: 1px solid #ddd;
+      width: 100px;
+      background-color: #f2f2f2 !important;
+    }
+
+    input {
+      background-color: #f2f2f2 !important;
+    }
   }
-  th {
-    background-color: #f2f2f2;
+  .table-body {
+    white-space: nowrap;
+    .column {
+      display: inline-block;
+      width: 100px;
+      > div {
+        height: 30px;
+        border: 1px solid #ddd;
+        width: 100%;
+      }
+      > div:nth-of-type(1) {
+        background-color: #f2f2f2 !important;
+        > input {
+          background-color: #f2f2f2 !important;
+        }
+      }
+    }
   }
+  // th,
+  // td {
+  //   border: 1px solid #ddd;
+  //   padding: 2px;
+  //   text-align: center;
+  //   height: 30px;
+  // }
+  // th {
+  //   background-color: #f2f2f2;
+  //   > input {
+  //     background-color: #f2f2f2 !important;
+  //   }
+  // }
   tr:nth-child(even) {
     background-color: #f9f9f9;
   }
@@ -236,8 +323,17 @@
     border-color: #66afe9; /* 改变边框颜色 */
     outline: none; /* 移除默认的轮廓线 */
   }
-  .tableTh:hover {
+  .tableTd {
     position: relative;
+  }
+  .deleteRow {
+    display: block !important;
+    position: absolute;
+    bottom: 0px;
+    right: -15px;
+    color: #f56c6c;
+  }
+  .tableTd:hover {
     .delete {
       display: block !important;
       position: absolute;
@@ -245,5 +341,20 @@
       top: 0;
       color: #f56c6c;
     }
+
+    .add {
+      display: block !important;
+      position: absolute;
+      right: 20px;
+      top: 0;
+      color: #409eff;
+    }
+    .addRow {
+      display: block !important;
+      position: absolute;
+      bottom: 0px;
+      right: 10px;
+      color: #409eff;
+    }
   }
 </style>

+ 1 - 0
src/views/rulesManagement/releaseRules/components/templateDiv/customText.vue

@@ -96,6 +96,7 @@
         const inputElement = document.createElement('input');
         inputElement.setAttribute('type', 'text');
         inputElement.setAttribute('class', 'templateInput');
+        inputElement.setAttribute('autocomplete', 'off');
         inputElement.setAttribute('id', id);
         return inputElement;
       },

+ 7 - 4
src/views/rulesManagement/releaseRules/index.vue

@@ -43,6 +43,7 @@
                     ></i> -->
 
                     <el-popconfirm
+                      v-if="node.isLeaf"
                       title="确定删除吗?"
                       @confirm="deleteTypeNode(node)"
                     >
@@ -224,7 +225,7 @@
           },
           {
             prop: 'code',
-            label: '记录规则编码',
+            label: '编码',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
@@ -232,7 +233,7 @@
           },
           {
             prop: 'name',
-            label: '记录规则名称',
+            label: '名称',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
@@ -414,7 +415,7 @@
         cacheKeyUrl: 'maindata-25922-recordrules-index',
         typeTree: [],
         treeNode: null,
-        qmsReportWorkType: ['5', '6', '7'],
+        qmsReportWorkType: [5, 6, 7],
       };
     },
     created() {
@@ -521,7 +522,7 @@
         console.log('row~~~~~', row)
         if (!this.qmsReportWorkType.includes(row.reportWorkType)) {
           if (row.details.length == 0) {
-            return this.$message.warning('至少条件一条规则项');
+            return this.$message.warning('至少选择一条规则项');
           }
 
           if (row.reportWorkType == 4) {
@@ -668,6 +669,8 @@
         tree.forEach(clean);
 
         this.typeTree = tree; // 结果树
+
+        console.log('typeTree~~~~~', this.typeTree);
         
         if (!this.treeNode) {
           // 默认选中第一个节点