lucw 7 месяцев назад
Родитель
Сommit
497d0008ef

+ 2 - 2
src/api/recordrules/index.js

@@ -9,10 +9,10 @@ export async function recordrulesPage(body) {
   return Promise.reject(new Error(res.data.message));
 }
 
-// 规则记录分页查询 过程监测 /main/recordrules/notProduceTaskConfigRecordRulesPage
+// 规则记录分页查询 过程监测 /main/recordrules/processInspectionRecordRulesPage
 export async function recordrulesNotProduceTaskConfigRecordRulesPage(body) {
   const res = await request.post(
-    `/main/recordrules/notProduceTaskConfigRecordRulesPage`,
+    `/main/recordrules/processInspectionRecordRulesPage`,
     body
   );
   if (res.data.code == 0) {

+ 7 - 7
src/components/selectReleaseRules/search.vue

@@ -37,14 +37,14 @@
             type: 'select',
             placeholder: '记录表分类',
             planList: this.typeList
-          },
-          {
-            label: '模块分类',
-            value: 'reportWorkType',
-            type: 'select',
-            placeholder: '模块分类',
-            planList: this.reportWorkTypeList
           }
+          // {
+          //   label: '模块分类',
+          //   value: 'reportWorkType',
+          //   type: 'select',
+          //   placeholder: '模块分类',
+          //   planList: this.reportWorkTypeList,
+          // }
           //,
           // {
           //   label: '状态:',

+ 14 - 5
src/components/selectReleaseRules/select-release-rules.vue

@@ -196,7 +196,9 @@
       return {
         loading: false,
         visible: false,
-        selection: []
+        selection: [],
+        produceTaskId: '',
+        reportWorkType: '' // 记录规则报工类型 产前、过程、产后
       };
     },
     created() {
@@ -204,10 +206,15 @@
       this.requestDict('规则周期');
     },
     methods: {
-      open() {
+      open(reportWorkType, produceTaskId) {
+        console.log('reportWorkType', reportWorkType);
+        console.log('produceTaskId', produceTaskId);
+
         this.visible = true;
         this.selection = [];
-        this.reload({}); // 刷新表格
+        this.reportWorkType = reportWorkType || '';
+        this.produceTaskId = produceTaskId || '';
+        this.reload(); // 刷新表格
       },
       updateVisible(val) {
         this.visible = val;
@@ -225,7 +232,9 @@
           publishStatus: 1,
           // 启用
           enable: 1,
-          ...where
+          ...where,
+          reportWorkType: this.reportWorkType,
+          produceTaskId: this.produceTaskId
         });
       },
       /* 刷新表格 */
@@ -235,7 +244,7 @@
           publishStatus: 1,
           // 启用
           enable: 1,
-          where
+          ...where
         });
       },
       confirmSelection() {

+ 56 - 6
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -420,10 +420,24 @@
           >
             <!-- 表头工具栏 -->
             <template v-slot:toolbar>
-              <el-button type="primary" v-if="!isView" @click="add"
+              <el-button
+                type="primary"
+                v-if="
+                  !isView &&
+                  attributeData.approvalStatus != 1 &&
+                  attributeData.approvalStatus != 2
+                "
+                @click="add"
                 >添加</el-button
               >
-              <el-button type="primary" v-if="!isView" @click="detailsList"
+              <el-button
+                type="primary"
+                v-if="
+                  !isView &&
+                  attributeData.approvalStatus != 1 &&
+                  attributeData.approvalStatus != 2
+                "
+                @click="detailsList"
                 >从明细表导入</el-button
               >
               <div class="toolbar_box">
@@ -472,7 +486,13 @@
                 </div>
               </div>
             </template>
-            <template v-slot:action="{ row, $index }">
+            <template
+              v-if="
+                attributeData.approvalStatus != 1 &&
+                attributeData.approvalStatus != 2
+              "
+              v-slot:action="{ row, $index }"
+            >
               <el-link type="danger" @click="handleDel(row, $index)"
                 >删除</el-link
               >
@@ -486,13 +506,23 @@
                 v-else
                 v-model="row.subCode"
                 placeholder="请输入"
+                :disabled="
+                  attributeData.approvalStatus == 1 ||
+                  attributeData.approvalStatus == 2
+                "
               ></el-input>
             </template>
 
             <template v-slot:isReworkBom="{ row }">
               <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
               <div v-else>
-                <el-select v-model="row.isReworkBom">
+                <el-select
+                  v-model="row.isReworkBom"
+                  :disabled="
+                    attributeData.approvalStatus == 1 ||
+                    attributeData.approvalStatus == 2
+                  "
+                >
                   <el-option
                     v-for="item in isReworkBomList"
                     :key="item.value"
@@ -523,6 +553,10 @@
                 placeholder="请输入"
                 style="width: 90px"
                 @input="handleInput(row)"
+                :disabled="
+                  attributeData.approvalStatus == 1 ||
+                  attributeData.approvalStatus == 2
+                "
               ></el-input>
             </template>
 
@@ -531,7 +565,11 @@
                 type="primary"
                 :underline="false"
                 @click="handSubstitution(row)"
-                v-if="isView"
+                v-if="
+                  isView ||
+                  attributeData.approvalStatus == 1 ||
+                  attributeData.approvalStatus == 2
+                "
                 >{{ row.categoryName }}</el-link
               >
               <div v-else
@@ -544,7 +582,15 @@
             </template>
 
             <template v-slot:bomArtFiles="{ row }">
-              <fileMain v-model="row.bomArtFiles" type="add" size="mini" />
+              <fileMain
+                v-model="row.bomArtFiles"
+                :type="
+                  isView ||
+                  attributeData.approvalStatus == 1 ||
+                  attributeData.approvalStatus == 2 ? 'view' : 'add'
+                "
+                size="mini"
+              />
             </template>
 
             <template v-slot:remark="{ row }">
@@ -553,6 +599,10 @@
                 v-else
                 v-model="row.remark"
                 placeholder="请输入"
+                :disabled="
+                  attributeData.approvalStatus == 1 ||
+                  attributeData.approvalStatus == 2
+                "
               ></el-input>
             </template>
           </ele-pro-table>

+ 0 - 4
src/views/material/BOMmanage/components/workmanship.vue

@@ -209,10 +209,6 @@
             type="primary"
             :underline="false"
             icon="el-icon-setting"
-            v-if="
-              attributeData.approvalStatus != 2 &&
-              attributeData.approvalStatus != 1
-            "
             @click="openConfigure(row)"
           >
             配置

+ 110 - 394
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -25,6 +25,7 @@
               style="width: 100%"
               v-model="formData.classify"
               placeholder="请选择"
+              :disabled="type == 'processEdit'"
             >
               <el-option
                 v-for="item in recordSheet"
@@ -58,7 +59,11 @@
       <el-row style="margin-bottom: 10px">
         <el-col :span="8">
           <el-form-item label="记录规则名称" prop="name">
-            <el-input v-model="formData.name" placeholder="请输入"></el-input>
+            <el-input
+              v-model="formData.name"
+              placeholder="请输入"
+              :disabled="type == 'processEdit'"
+            ></el-input>
           </el-form-item>
         </el-col>
 
@@ -69,6 +74,7 @@
               type="date"
               placeholder="请选择启用日期"
               style="width: 100%"
+              :disabled="type == 'processEdit'"
             ></el-date-picker>
           </el-form-item>
         </el-col>
@@ -80,6 +86,7 @@
               type="date"
               placeholder="请选择停用日期"
               style="width: 100%"
+              :disabled="type == 'processEdit'"
             />
           </el-form-item>
         </el-col>
@@ -105,20 +112,22 @@
               dictName="记录规则报工类型"
               placeholder="请选择模块"
               :clearable="false"
+              :disabled="type == 'processEdit'"
             ></dict-selection>
           </el-form-item>
         </el-col>
         <el-col v-if="formData.reportWorkType == 2" :span="8">
           <el-form-item label="关联工序">
             <el-input
-              v-model="formData.produceTaskConfigBatchSavePo.produceTaskName"
+              v-model="formData.produceTaskName"
               @click.native="openProduceTaskDialog"
               readonly
               placeholder="关联工序"
               clearable
+              :disabled="type == 'processEdit'"
             >
               <i
-                v-if="formData.produceTaskConfigBatchSavePo.produceTaskName"
+                v-if="formData.produceTaskName"
                 slot="suffix"
                 class="el-input__icon el-icon-close"
                 size="24"
@@ -139,56 +148,6 @@
           </el-form-item>
         </el-col>
       </el-row>
-      <el-row
-        v-if="
-          formData.reportWorkType != 0 &&
-          formData.produceTaskConfigBatchSavePo.produceTaskId
-        "
-        style="margin-bottom: 10px"
-      >
-        <el-col
-          v-if="
-            formData.reportWorkType == 2 &&
-            formData.produceTaskConfigBatchSavePo.produceTaskId
-          "
-          :span="8"
-        >
-          <el-form-item
-            label="关联产品方式"
-            required
-            prop="relateProductMethod"
-          >
-            <el-select
-              v-model="formData.relateProductMethod"
-              placeholder="请选择关联产品方式"
-              style="width: 100%"
-            >
-              <el-option
-                v-for="item in relateProductMethodOpeions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-              >
-              </el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-
-        <el-col v-if="formData.relateProductMethod == 1" :span="8">
-          <el-form-item label="关联产品分类" required prop="categoryLevels">
-            <ele-tree-select
-              multiple
-              clearable
-              :data="productCategory"
-              v-model="formData.categoryLevels"
-              placeholder="请选择关联产品分类"
-              default-expand-all
-              labelKey="name"
-              valueKey="id"
-            />
-          </el-form-item>
-        </el-col>
-      </el-row>
       <el-row style="margin-bottom: 10px">
         <el-col :span="24">
           <el-form-item label="周期" prop="frequencyValue" required>
@@ -196,47 +155,12 @@
               ref="cycleMultipleRef"
               :formData="formData"
               :pageType="type"
+              :disabled="type == 'processEdit'"
             />
           </el-form-item>
         </el-col>
       </el-row>
 
-      <template v-if="formData.relateProductMethod == 2">
-        <div style="margin-bottom: 20px">
-          <header-title title="关联产品">
-            <el-button
-              size="mini"
-              type="primary"
-              icon="el-icon-plus"
-              class="ele-btn-icon"
-              @click="relateProductSelect"
-            >
-              添加产品
-            </el-button>
-          </header-title>
-
-          <ele-pro-table
-            ref="productTableRef"
-            :columns="productColumns"
-            :datasource="formData.categories"
-            :needPage="false"
-            row-key="id"
-          >
-            <template v-slot:action="{ row }">
-              <el-link
-                v-if="type != 'detail'"
-                type="danger"
-                :underline="false"
-                icon="el-icon-delete"
-                @click="productColumnsDeleteRow(row)"
-              >
-                删除
-              </el-link>
-            </template>
-          </ele-pro-table>
-        </div>
-      </template>
-
       <header-title title="规则明细">
         <el-button
           v-if="formData.isExecuteMethod"
@@ -284,7 +208,7 @@
             </el-button>
 
             <el-form-item
-              v-if="formData.executeMethodTitle"
+              v-if="formData.isExecuteMethod"
               label="编辑执行方式:"
               label-width="110px"
               style="margin-bottom: 0"
@@ -474,7 +398,7 @@
     </el-form>
     <template v-slot:footer>
       <el-button
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && type != 'processEdit'"
         :loading="btnLoading"
         type="primary"
         @click="saveAndPublish"
@@ -482,13 +406,21 @@
         保存并发布
       </el-button>
       <el-button
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && type != 'processEdit'"
         :loading="btnLoading"
         type="primary"
         @click="confirm"
       >
         保存
       </el-button>
+      <el-button
+        v-if="type == 'processEdit'"
+        :loading="btnLoading"
+        type="primary"
+        @click="processEditSave"
+      >
+        保存
+      </el-button>
       <el-button :loading="btnLoading" @click="handleClose">取消</el-button>
     </template>
 
@@ -507,12 +439,6 @@
       @changeProduct="changeProduct"
     ></ProductModal>
 
-    <ProductModalCorrelation
-      ref="ProductModalCorrelationRef"
-      @changeProduct="changeRelateProduct"
-      multiple
-    ></ProductModalCorrelation>
-
     <processModal
       ref="processModalRef"
       @chooseProcess="processChooseProcess"
@@ -766,30 +692,18 @@
         fromId: null,
         // 模块分类 参考字典项:record_rules_report_work_type
         reportWorkType: '1',
-        // 关联产品方式,0-不关联,1-关联分类,2-关联产品
-        relateProductMethod: 0,
-        // 关联分类
-        categoryLevels: [],
-        // 关联产品
-        categories: [],
         // 执行方式
         isExecuteMethod: 0,
         produceTaskConfigs: [],
-        // 关联工序
-        produceTaskConfigBatchSavePo: {
-          addPOs: [],
-          deletedIds: [],
-          produceTaskId: '',
-          produceTaskName: '',
-          updatePOs: []
-        },
         // 执行方式列表
         executeMethodList: [],
         // 执行方式 活跃项
         executeMethodTitle: '',
         bigVersion: '',
         versionMark: '',
-        smallVersion: ''
+        smallVersion: '',
+        produceTaskId: '',
+        produceTaskName: ''
       };
 
       return {
@@ -828,14 +742,6 @@
           reportWorkType: [
             { required: true, message: '请选择模块分类', trigger: 'change' },
             { required: true, message: '请选择模块分类', trigger: 'blur' }
-          ],
-          categoryLevels: [
-            {
-              required: true,
-              message: '请选择关联产品分类',
-              trigger: 'change'
-            },
-            { required: true, message: '请选择关联产品分类', trigger: 'blur' }
           ]
         },
         recordSheet: [], // 记录表
@@ -845,11 +751,6 @@
         btnLoading: false,
         currentRow: null,
         type: '',
-        relateProductMethodOpeions: [
-          { label: '不关联', value: 0 },
-          // { label: '关联分类', value: 1 },
-          { label: '关联产品', value: 2 }
-        ],
         // 产品分类
         productCategory: [],
         loading: false,
@@ -876,6 +777,11 @@
           this.getDetils(row.id);
         }
 
+        // 过程监测临时修改
+        if (type == 'processEdit') {
+          this.processEditSetValue(row);
+        }
+
         if (type == 'add') {
           this.formData.version = 1;
 
@@ -889,45 +795,43 @@
 
         console.log('this.formData', this.formData);
       },
+      async processEditSetValue(row) {
+        const data = await recordrulesGetById(row.rulesId);
+
+        const info = JSON.parse(JSON.stringify(row));
+        if (data.isExecuteMethod) {
+          data.executeMethodList = produceTaskConfigRuleDetails.map((i) => {
+            return i.executeMethodTitle;
+          });
+
+          data.details = produceTaskConfigRuleDetails;
+          data.executeMethodTitle = data.executeMethodList[0] || '';
+        } else {
+          data.executeMethodList = [];
+          data.details = info.produceTaskConfigRuleDetails || [];
+          data.executeMethodTitle = '';
+        }
+
+        this.$util.assignObject(this.formData, data);
+
+        this.$nextTick(() => {
+          this.$refs.cycleMultipleRef?.setRecordRulesCycleList(
+            this.formData.recordRulesCycleList
+          );
+        });
+
+        this.formData.startDate = new Date(info.startDate);
+        this.formData.stopDate = new Date(info.stopDate);
+        this.formData.classify = this.formData.classify + '';
+        this.formData.reportWorkType = this.formData.reportWorkType + '';
+
+        this.loading = false;
+      },
       async getDetils(id) {
         this.loading = true;
         try {
           const data = await recordrulesGetById(id);
 
-          if (data.relateProductMethod == 1) {
-            data.categoryLevels = data.produceTaskConfigs
-              .map((i) => i.categoryLevelId)
-              .filter((i) => i != null);
-          } else {
-            data.categoryLevels = [];
-          }
-
-          if (data.relateProductMethod == 2) {
-            // 产品
-            data.categories = data.produceTaskConfigs.map((i) => {
-              return {
-                id: i.productId,
-                code: i.productCode,
-                name: i.productName,
-                brandNum: i.brandNum,
-                modelType: i.modelType,
-                measuringUnit: i.measuringUnit,
-                packingUnit: i.packingUnit
-              };
-            });
-          } else {
-            data.categories = [];
-          }
-
-          data.produceTaskConfigBatchSavePo = {
-            addPOs: [],
-            deletedIds: [],
-            produceTaskId: data.produceTaskConfigs[0]?.produceTaskId,
-            produceTaskName: data.produceTaskConfigs[0]?.produceTaskName,
-            updatePOs: [],
-            isTemplate: 1
-          };
-
           if (data.isExecuteMethod) {
             data.executeMethodList = Object.keys(data.detailMap).map((i) => {
               return i === '' ? '无执行方式' : i;
@@ -939,9 +843,6 @@
                 (i) => i !== '无执行方式'
               );
               data.executeMethodList.unshift('无执行方式');
-            } else {
-              // 添加一个 无执行方式
-              data.executeMethodList.unshift('无执行方式');
             }
 
             data.details = Object.values(data.detailMap)
@@ -1046,13 +947,6 @@
             }
           }
 
-          if (this.formData.relateProductMethod == 2) {
-            // 关联产品
-            if (this.formData.categories.length == 0) {
-              return this.$message.warning('请选择关联产品');
-            }
-          }
-
           try {
             this.btnLoading = true;
 
@@ -1109,13 +1003,6 @@
             }
           }
 
-          if (this.formData.relateProductMethod == 2) {
-            // 关联产品
-            if (this.formData.categories.length == 0) {
-              return this.$message.warning('请选择关联产品');
-            }
-          }
-
           // 判断参数类型是否选择
           for (const detail of this.formData.details) {
             if (!detail.paramType) {
@@ -1128,7 +1015,11 @@
 
             const body = this.formatBody();
 
-            await recordrulesSaveAndPublish(body);
+            if (this.type != 'saveAndPublish') {
+              await recordrulesSaveAndPublish(body);
+            } else {
+              this.$emit('processSave', body);
+            }
 
             this.btnLoading = false;
             this.$message.success('操作成功');
@@ -1170,13 +1061,6 @@
 
         const body = JSON.parse(JSON.stringify(this.formData));
 
-        body.details = body.details.map((i) => {
-          if (i.executeMethodTitle == '无执行方式') {
-            i.executeMethodTitle = '';
-          }
-          return i;
-        });
-
         body.startDate = this.$util.toDateString(
           body.startDate,
           'yyyy-MM-dd HH:mm:ss'
@@ -1187,180 +1071,6 @@
           'yyyy-MM-dd HH:mm:ss'
         );
 
-        if (this.type == 'edit') {
-          if (body.produceTaskConfigBatchSavePo.produceTaskId) {
-            // 修改工序
-            if (body.relateProductMethod == 1) {
-              // 分类
-              body.categoryLevels.forEach((categoryId) => {
-                // 判断是否已经存在
-                const exist = body.produceTaskConfigs.find(
-                  (i) => i.categoryLevelId == categoryId
-                );
-
-                if (!exist) {
-                  body.produceTaskConfigBatchSavePo.addPOs.push({
-                    executeMethod: 2,
-                    itemType: 1,
-                    produceTaskId:
-                      body.produceTaskConfigBatchSavePo.produceTaskId,
-                    produceTaskName:
-                      body.produceTaskConfigBatchSavePo.produceTaskName,
-                    categoryLevelId: categoryId,
-                    reportWorkType: this.formData.reportWorkType,
-                    isTemplate: 1
-                  });
-                }
-              });
-
-              // 删除取消的分类
-              body.produceTaskConfigs.forEach((config) => {
-                if (
-                  !body.categoryLevels.includes(config.categoryLevelId) &&
-                  config.id
-                ) {
-                  body.produceTaskConfigBatchSavePo.deletedIds.push(config.id);
-                }
-              });
-            }
-
-            if (body.relateProductMethod == 2) {
-              // 产品
-              body.categories.forEach((product) => {
-                // 判断是否已经存在
-                const exist = body.produceTaskConfigs.find(
-                  (i) => i.productId == product.id
-                );
-                if (!exist) {
-                  body.produceTaskConfigBatchSavePo.addPOs.push({
-                    executeMethod: 2,
-                    itemType: 2,
-                    produceTaskId:
-                      body.produceTaskConfigBatchSavePo.produceTaskId,
-                    produceTaskName:
-                      body.produceTaskConfigBatchSavePo.produceTaskName,
-                    productCode: product.code,
-                    productId: product.id || product.productId,
-                    productName: product.name || product.productName,
-                    reportWorkType: this.formData.reportWorkType,
-                    isTemplate: 1
-                  });
-                }
-              });
-
-              // 删除取消的产品
-              body.produceTaskConfigs.forEach((config) => {
-                const exist = body.categories.find((product) => {
-                  return product.id == config.productId;
-                });
-
-                if (!exist && config.id) {
-                  body.produceTaskConfigBatchSavePo.deletedIds.push(config.id);
-                }
-              });
-            }
-
-            if (body.relateProductMethod == 0) {
-              // 不关联产品 但存在工序
-              // 判断是否已经存在
-              const item = body.produceTaskConfigs.find(
-                (i) =>
-                  i.produceTaskId ==
-                  body.produceTaskConfigBatchSavePo.produceTaskId
-              );
-
-              if (item) {
-                // 修改
-                body.produceTaskConfigBatchSavePo.updatePOs.push({
-                  ...item,
-                  produceTaskId:
-                    body.produceTaskConfigBatchSavePo.produceTaskId,
-                  produceTaskName:
-                    body.produceTaskConfigBatchSavePo.produceTaskName,
-                  reportWorkType: this.formData.reportWorkType,
-                  isTemplate: 1
-                });
-              } else {
-                // 新增
-                body.produceTaskConfigBatchSavePo.deletedIds =
-                  this.formData.produceTaskConfigs.map((i) => i.id);
-
-                body.produceTaskConfigBatchSavePo.addPOs.push({
-                  executeMethod: 2,
-                  itemType: 2,
-                  produceTaskId:
-                    body.produceTaskConfigBatchSavePo.produceTaskId,
-                  produceTaskName:
-                    body.produceTaskConfigBatchSavePo.produceTaskName,
-                  reportWorkType: this.formData.reportWorkType,
-                  isTemplate: 1
-                });
-              }
-            }
-          } else {
-            // 删除工序 全删
-            body.produceTaskConfigBatchSavePo.deletedIds =
-              this.formData.produceTaskConfigs.map((i) => i.id);
-          }
-        } else {
-          // 新增工序
-          if (
-            body.reportWorkType != 0 &&
-            body.produceTaskConfigBatchSavePo.produceTaskId
-          ) {
-            if (body.relateProductMethod == 1) {
-              // 分类
-              body.categoryLevels.forEach((categoryId) => {
-                body.produceTaskConfigBatchSavePo.addPOs.push({
-                  executeMethod: 2,
-                  itemType: 1,
-                  produceTaskId:
-                    body.produceTaskConfigBatchSavePo.produceTaskId,
-                  produceTaskName:
-                    body.produceTaskConfigBatchSavePo.produceTaskName,
-                  categoryLevelId: categoryId,
-                  reportWorkType: this.formData.reportWorkType,
-                  isTemplate: 1
-                });
-              });
-            }
-
-            if (body.relateProductMethod == 2) {
-              // 产品
-              body.categories.forEach((product) => {
-                body.produceTaskConfigBatchSavePo.addPOs.push({
-                  executeMethod: 2,
-                  itemType: 2,
-                  produceTaskId:
-                    body.produceTaskConfigBatchSavePo.produceTaskId,
-                  produceTaskName:
-                    body.produceTaskConfigBatchSavePo.produceTaskName,
-                  productCode: product.code,
-                  productId: product.id || product.productId,
-                  productName: product.name || product.productName,
-                  reportWorkType: this.formData.reportWorkType,
-                  isTemplate: 1
-                });
-              });
-            }
-
-            if (body.relateProductMethod == 0) {
-              // 不关联
-              body.produceTaskConfigBatchSavePo.addPOs.push({
-                executeMethod: 2,
-                itemType: 2,
-                produceTaskId: body.produceTaskConfigBatchSavePo.produceTaskId,
-                produceTaskName:
-                  body.produceTaskConfigBatchSavePo.produceTaskName,
-                reportWorkType: this.formData.reportWorkType,
-                isTemplate: 1
-              });
-            }
-          }
-
-          body.produceTaskConfigBatchSavePo.updatePOs = [];
-        }
-
         return body;
       },
       // startDate 启用日期要大于当前时间
@@ -1428,12 +1138,6 @@
           this.formData.details.splice(index, 1);
         }
       },
-      // 删除关联产品
-      productColumnsDeleteRow(row) {
-        this.formData.categories = this.formData.categories.filter((i) => {
-          return i.id !== row.id;
-        });
-      },
       handleAdd(row) {
         this.currentRow = row;
         this.$refs.toolModalRef.open(row.toolCodes);
@@ -1505,27 +1209,6 @@
         row.productName = '';
         row.productCode = '';
       },
-      // 关联产品
-      async relateProductSelect() {
-        // 查询工序详情
-        const productTaskInfo = await productionAPI.getById(
-          this.formData.produceTaskConfigBatchSavePo.produceTaskId
-        );
-        console.log('productTaskInfo', productTaskInfo);
-        this.$refs.ProductModalCorrelationRef.open([], productTaskInfo.code);
-      },
-      changeRelateProduct(array) {
-        console.log('this.formData.categories ', array);
-
-        const productList = array.filter(
-          (i) => !this.formData.categories.some((cat) => cat.id === i.id)
-        );
-
-        this.formData.categories = [
-          ...this.formData.categories,
-          ...productList
-        ];
-      },
       // 获取产品分类
       async getProductCategory() {
         let { data } = await getTreeByPid(9);
@@ -1539,9 +1222,8 @@
       // 工序
       processChooseProcess(process) {
         console.log('选择的工序', process);
-        this.formData.produceTaskConfigBatchSavePo.produceTaskId = process.id;
-        this.formData.produceTaskConfigBatchSavePo.produceTaskName =
-          process.name;
+        this.formData.produceTaskId = process.id;
+        this.formData.produceTaskName = process.name;
       },
       // 添加执行方式
       addExecuteMethod() {
@@ -1602,11 +1284,45 @@
         }
       },
       clearProductTask() {
-        this.formData.produceTaskConfigBatchSavePo.produceTaskId = '';
-        this.formData.produceTaskConfigBatchSavePo.produceTaskName = '';
-        this.formData.relateProductMethod = 0;
-        this.formData.categoryLevels = [];
-        this.formData.categories = [];
+        this.formData.produceTaskId = '';
+        this.formData.produceTaskName = '';
+      },
+      // 过程监测修改 保存
+      processEditSave() {
+        // 只验证详情内容
+        if (this.formData.details.length == 0) {
+          return this.$message.warning('至少条件一条规则项');
+        }
+
+        if (this.formData.isExecuteMethod) {
+          // 判断 formData.executeMethodList中的item 是否在details中有一条executeMethodTitle的数据
+
+          if (this.formData.executeMethodList.length == 0) {
+            return this.$message.warning(`请添加执行方式`);
+          }
+
+          for (const item of this.formData.executeMethodList) {
+            const exists = this.formData.details.some(
+              (detail) => detail.executeMethodTitle === item
+            );
+            if (!exists) {
+              this.$message.warning(
+                `请为执行方式 "${item}" 添加至少一条规则项`
+              );
+              return false;
+            }
+          }
+        }
+
+        // 判断参数类型是否选择
+        for (const detail of this.formData.details) {
+          if (!detail.paramType) {
+            return this.$message.warning('请选择规则明细中的参数类型!');
+          }
+        }
+
+        this.$emit('processSave', this.formatBody());
+        this.handleClose();
       }
     }
   };

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

@@ -182,6 +182,13 @@
               return this.getDictValue('记录规则报工类型', row.reportWorkType);
             }
           },
+          {
+            prop: 'produceTaskName',
+            label: '工序名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
           {
             prop: 'version',
             label: '版本号',

+ 0 - 133
src/views/technology/production/components/select-template.vue

@@ -1,133 +0,0 @@
-<template>
-  <el-dialog
-    :title="title"
-    :visible.sync="visible"
-    v-if="visible"
-    :before-close="handleClose"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="75%"
-  >
-    <ele-pro-table
-      ref="table"
-      :columns="columns"
-      :datasource="templateList"
-      row-key="id"
-      height="calc(100vh - 350px)"
-      :selection.sync="selection"
-      :needPage="false"
-      @refresh="getList"
-    >
-    </ele-pro-table>
-    <div class="btns">
-      <el-button type="primary" size="small" @click="selected">选择</el-button>
-      <el-button size="small" @click="handleClose">关闭</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-  import { produceTaskRecordRulesGetTemplateListByProduceTaskId } from '@/api/producetaskrecordrules/index.js';
-  import dictMixins from '@/mixins/dictMixins';
-
-  export default {
-    mixins: [dictMixins],
-    components: {},
-    props: {
-      // 工序id
-      produceTaskId: {
-        type: String,
-        required: true
-      }
-    },
-    data() {
-      return {
-        visible: false,
-
-        // 表格列配置
-        columns: [
-          {
-            width: 50,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center'
-          },
-          {
-            columnKey: 'index',
-            type: 'index',
-            width: 45,
-            align: 'center',
-            reserveSelection: true
-          },
-          {
-            prop: 'itemType',
-            label: '类型',
-            align: 'center',
-            formatter: (row) => {
-              return this.getDictValue('记录规则事项类型', row.itemType);
-            }
-          },
-          {
-            prop: 'executeMethod',
-            label: '执行方式',
-            align: 'center',
-            formatter: (row) => {
-              return this.getDictValue('记录规则执行方式', row.executeMethod);
-            }
-          },
-          {
-            prop: 'rulesName',
-            label: '名称',
-            align: 'center',
-            formatter: (row) => {
-              return row.rulesName || row.itemTaskName;
-            }
-          }
-        ],
-        title: '选择模板',
-        selection: [],
-        templateList: []
-      };
-    },
-    mounted() {
-      this.getList();
-    },
-    methods: {
-      async getList() {
-        const data = await produceTaskRecordRulesGetTemplateListByProduceTaskId(
-          {
-            produceTaskId: this.produceTaskId
-          }
-        );
-        console.log('模板列表', data);
-        this.templateList = data;
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.isCategory = false;
-        this.$refs.table.reload({ pageNum: 1, where: where });
-      },
-      open() {
-        this.visible = true;
-      },
-      handleClose() {
-        this.visible = false;
-      },
-      selected() {
-        if (!this.selection.length) {
-          return this.$message.warning('请选择模板!');
-        }
-        this.$emit('confirm', this.selection);
-        this.handleClose();
-      }
-    }
-  };
-</script>
-
-<style lang="scss" scoped>
-  .btns {
-    text-align: center;
-    padding: 10px 0;
-  }
-</style>

+ 48 - 16
src/views/technology/production/components/user-setting-matter-add.vue

@@ -57,7 +57,11 @@
         </div>
       </el-form-item>
 
-      <el-form-item v-if="formData.itemType == '3'" label="关联任务">
+      <el-form-item
+        v-if="formData.itemType == '3'"
+        label="关联任务"
+        prop="itemTaskName"
+      >
         <!-- 下拉选择 -->
         <!-- <el-select
           placeholder="请选择关联任务"
@@ -223,16 +227,28 @@
               trigger: 'change'
             },
             { required: true, message: '请选择关联事项规则', trigger: 'blur' }
+          ],
+          itemTaskName: [
+            {
+              required: true,
+              message: '请输入关联任务名称',
+              trigger: 'blur'
+            },
+            { required: true, message: '请输入关联任务名称', trigger: 'change' }
+          ],
+          rulesId: [
+            {
+              required: true,
+              message: '请选择关联规则',
+              trigger: 'change'
+            },
+            { required: true, message: '请选择关联规则', trigger: 'blur' }
           ]
         },
-        // 记录规则报工类型
-        reportWorkTypeOptions: [],
-        // 记录规则执行方式,参考字典项:record_rules_execute_method
-        executeMethodOptions: [],
-        // 记录规则事项类型,参考字典项:record_rules_item_type
-        itemTypeOptions: [],
         dialogLoading: false,
-        title: '新增事项'
+        title: '新增事项',
+        // 选择的规则
+        ruleInfo: null
       };
     },
     methods: {
@@ -240,14 +256,30 @@
         this.formData.executeMethod = this.formData.itemType;
         this.formData.rulesId = null;
         this.formData.rulesName = '';
+
+        this.$nextTick(() => {
+          this.$refs.formRef.clearValidate();
+        });
       },
       updateVisible(val) {
         this.visible = val;
       },
-      openAdd() {
+      openAdd(reportWorkType, produceTaskId) {
         this.type = 'add';
         this.title = '新增事项';
         this.visible = true;
+        this.formData.reportWorkType = reportWorkType || '';
+        this.formData.produceTaskId = produceTaskId || '';
+        console.log(
+          'this.formData.reportWorkType',
+          this.formData.reportWorkType
+        );
+        console.log('this.formData.produceTaskId', this.formData.produceTaskId);
+        if (reportWorkType === '2') {
+          // 过程监测
+          this.formData.itemType = '2';
+          this.formData.executeMethod = '2';
+        }
       },
       openEdit(row) {
         this.title = '编辑事项';
@@ -289,9 +321,9 @@
         this.$refs.formRef.validate((valid) => {
           if (valid) {
             if (this.type == 'add') {
-              this.$emit('addMatter', this.formData);
+              this.$emit('addMatter', this.formData, this.ruleInfo);
             } else {
-              this.$emit('editMatter', this.formData);
+              this.$emit('editMatter', this.formData, this.ruleInfo);
             }
             this.handleClose();
           }
@@ -311,17 +343,17 @@
       },
       // 去选择记录规则
       selectReleaseId() {
-        this.$refs.selectReleaseRulesRef.open();
+        this.$refs.selectReleaseRulesRef.open(
+          this.formData.reportWorkType,
+          this.formData.produceTaskId
+        );
       },
       // 选择记录规则
       chooseReleaseRules(rules) {
         console.log('rules', rules);
+        this.ruleInfo = rules;
         this.formData.rulesId = rules.id || null;
         this.formData.rulesName = rules.name || '';
-        if (this.rules && this.rules.length > 1) {
-          // 提示用户选择的规则有多个事项规则
-          this.$message.warning('所选记录规则包含多个事项规则,请注意选择');
-        }
       }
     }
   };

+ 62 - 35
src/views/technology/production/components/user-setting-matter-process.vue

@@ -19,15 +19,6 @@
         >
           新建
         </el-button>
-        <el-button
-          size="small"
-          type="primary"
-          icon="el-icon-plus"
-          class="ele-btn-icon"
-          @click="selectTemplate"
-        >
-          从模板添加
-        </el-button>
       </template>
 
       <!-- 操作列 -->
@@ -51,6 +42,15 @@
         >
           详情
         </el-link>
+
+        <!-- <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-edit"
+          @click="openEditInfo(row)"
+        >
+          修改
+        </el-link> -->
       </template>
     </ele-pro-table>
 
@@ -67,12 +67,7 @@
       multiple
     ></ProductModal>
 
-    <selectTemplate
-      ref="selectTemplateRef"
-      :produceTaskId="produceTaskId"
-      @confirm="handleTemplateConfirm"
-    >
-    </selectTemplate>
+    <permitAdd ref="permitAddRef" @processSave="processSave"></permitAdd>
   </div>
 </template>
 
@@ -88,12 +83,12 @@
   import { mapGetters } from 'vuex';
   import { getTreeByPid } from '@/api/classifyManage';
   import ProductModal from '@/components/selectProduct/ProductModal.vue';
-  import selectTemplate from './select-template.vue';
+  import permitAdd from '@/views/rulesManagement/releaseRules/components/permitAdd.vue';
 
   export default {
     name: 'UserSettingMatter',
     mixins: [dictMixins, tableColumnsMixin],
-    components: { userSettingMatterAdd, ProductModal, selectTemplate },
+    components: { userSettingMatterAdd, ProductModal, permitAdd },
     props: {
       // 工序id
       produceTaskId: {
@@ -195,7 +190,8 @@
           { label: '关联产品', value: 2 }
         ],
         // 产品分类
-        productCategory: []
+        productCategory: [],
+        currentEditRow: null
       };
     },
     computed: {
@@ -277,9 +273,16 @@
           size: 9999,
           reportWorkType: this.reportWorkType
         });
-        console.log('list', list);
         // 表格数据
-        this.matterList = list;
+        this.matterList = list.map((i) => {
+          if (!i.produceTaskConfigRuleDetails.length) {
+            i.produceTaskConfigRuleDetails = Object.values(
+              i.produceTaskConfigRuleDetailMap
+            ).flat();
+          }
+          return i;
+        });
+        console.log('list', this.matterList);
       },
       // 删除事项
       async delMatter(row) {
@@ -300,30 +303,47 @@
       },
       // 打开添加事项
       openAddMatter() {
-        this.$refs.userSettingMatterAddRef.openAdd();
+        this.$refs.userSettingMatterAddRef.openAdd(
+          this.reportWorkType,
+          this.produceTaskId
+        );
       },
       openEditMatter(row) {
         this.$refs.userSettingMatterAddRef.openEdit(row);
       },
-      addMatter(matter) {
-        console.log('matter', matter);
+      addMatter(matter, rules) {
         const id = 'tem' + new Date().getTime();
+
+        // 处理detials
+        if (rules.isExecuteMethod) {
+          matter.produceTaskConfigRuleDetails = Object.values(rules.detailMap)
+            .flat()
+            .map((i) => {
+              if (i.executeMethodTitle == '') {
+                i.executeMethodTitle = '无执行方式';
+              }
+              return i;
+            });
+        } else {
+          matter.produceTaskConfigRuleDetails = rules.details;
+        }
+
+        console.log('matter', matter, rules);
+
         // 添加事项
         this.matterList.push({
           ...matter,
           id: id,
           produceTaskId: this.produceTaskId,
           produceTaskName: this.produceTaskName,
-          reportWorkType: this.reportWorkType,
-          isTemplate: 0
+          reportWorkType: this.reportWorkType
         });
         this.addPOs.push({
           ...matter,
           id: id,
           produceTaskId: this.produceTaskId,
           produceTaskName: this.produceTaskName,
-          reportWorkType: this.reportWorkType,
-          isTemplate: 0
+          reportWorkType: this.reportWorkType
         });
         this.handleSort();
       },
@@ -409,8 +429,7 @@
                 ...i,
                 bomCategoryId: this.bomCategoryId
               };
-            }),
-            isTemplate: 0
+            })
           });
           this.handleClose();
 
@@ -442,13 +461,21 @@
           )
         ];
       },
-      selectTemplate() {
-        this.$refs.selectTemplateRef.open();
+      openEditInfo(row) {
+        console.log('row', row);
+        this.currentEditRow = row;
+        this.$refs.permitAddRef.open(row, 'processEdit', '修改记录规则');
       },
-      handleTemplateConfirm(rows) {
-        console.log('rows', rows);
-        rows.forEach((row) => {
-          this.addMatter(row);
+      processSave(info) {
+        console.log('info', info);
+        // 更新当前行数据
+        this.matterList = this.matterList.map((item) => {
+          if (item.id === this.currentEditRow.id) {
+            item.produceTaskConfigRuleDetails = info.details;
+
+            // 修改
+          }
+          return item;
         });
       }
     }

+ 2 - 3
src/views/technology/production/components/user-setting-matter.vue

@@ -205,8 +205,7 @@
         const { list } = await produceTaskRecordRules({
           produceTaskIds: this.currentRows.map((row) => row.id),
           pageNum: 1,
-          size: 9999,
-          isTemplate: 0
+          size: 9999
         });
         console.log('list', list);
         // 表格数据
@@ -231,7 +230,7 @@
       },
       // 打开添加事项
       openAddMatter() {
-        this.$refs.userSettingMatterAddRef.openAdd();
+        this.$refs.userSettingMatterAddRef.openAdd(this.reportWorkType);
       },
       openEditMatter(row) {
         this.$refs.userSettingMatterAddRef.openEdit(row);

+ 1 - 1
src/views/technology/production/index.vue

@@ -268,7 +268,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 210,
+            width: 230,
             align: 'center',
             resizable: false,
             slot: 'action',

+ 2 - 2
vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
         // target: 'http://192.168.1.105:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.1.176:18086',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186', // 测试环境
@@ -44,7 +44,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18086',
 
         // target: 'http://192.168.1.251:18086', // 开发
-        // target: 'http://192.168.1.116:18086', // 赵沙金
+        target: 'http://192.168.1.116:18086', // 赵沙金
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {