Просмотр исходного кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dengfei

695593266@qq.com 7 месяцев назад
Родитель
Сommit
880cd802e9

+ 1 - 1
src/api/recordRules/index.js

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

+ 282 - 0
src/components/selectPlanRules/selectPlanRules.vue

@@ -0,0 +1,282 @@
+<template>
+  <ele-modal
+    :visible="visible"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    title="选择计划规则"
+    @update:visible="updateVisible"
+    :maxable="true"
+    width="90%"
+    :before-close="handleClose"
+  >
+    <el-card shadow="never" v-loading="loading">
+      <seekPage :seekList="seekList" @search="reload" :maxLength="4"></seekPage>
+      <ele-pro-table
+        ref="tableRef"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        cache-key="select-plan-rules-table-2511141448"
+      >
+        <!-- 单选列 -->
+        <template v-slot:radio="{ row }">
+          <el-radio
+            class="radio"
+            v-model="currentRowId"
+            :label="row.id"
+            @change="radioChange($event, row)"
+            ><i></i
+          ></el-radio>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <template v-slot:footer>
+      <el-button type="primary" @click="confirmSelection"> 选择 </el-button>
+
+      <el-button @click="visible = false">关闭</el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import dictMixins from '@/mixins/dictMixins';
+  import { planConfigPage } from '@/api/ruleManagement/plan.js';
+
+  export default {
+    components: {},
+    mixins: [tabMixins, dictMixins],
+    props: {
+      // 是否多选
+      multiple: {
+        type: Boolean,
+        default: false
+      },
+      // 默认 筛选条件
+      where: {
+        type: Object,
+        default: () => ({
+          // 生效
+          status: 1
+        })
+      },
+      // 1巡点检 2保养
+      ruleType: {
+        type: Number,
+        default: 1
+      }
+    },
+    computed: {
+      columns() {
+        const list = [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '计划配置单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'code'
+          },
+          {
+            prop: 'name',
+            label: '计划配置名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          ...[
+            this.ruleType == 1
+              ? {
+                  prop: 'groupName',
+                  label: '巡点检部门',
+                  align: 'center',
+                  showOverflowTooltip: true,
+                  minWidth: 110,
+                  slot: 'groupName'
+                }
+              : {
+                  prop: 'groupName',
+                  label: '部门',
+                  align: 'center',
+                  showOverflowTooltip: true,
+                  minWidth: 110,
+                  slot: 'groupName'
+                }
+          ],
+          {
+            prop: 'categoryName',
+            label: '设备分类',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'ruleName',
+            label: '规则名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'autoOrder',
+            label: '自动派单',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row) => {
+              let autoOrder =
+                _row.autoOrder == 1 ? '是' : _row.autoOrder == 0 ? '否' : '-';
+              return autoOrder;
+            }
+          },
+          {
+            //修改此prop名称时,请同步修改columnKey属性和下方selectType方法
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row) => {
+              return this.getDictValue('规则状态', _row.status);
+            },
+            filters: [
+              { value: 1, text: '生效' },
+              { value: 0, text: '失效' }
+            ],
+            filterMultiple: false,
+            columnKey: 'status'
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          }
+        ];
+
+        if (this.multiple) {
+          list.unshift({
+            type: 'selection',
+            width: 50,
+            align: 'center',
+            fixed: 'left'
+          });
+        } else {
+          list.unshift({
+            prop: 'radio',
+            width: 50,
+            align: 'center',
+            fixed: 'left',
+            slot: 'radio'
+          });
+        }
+
+        return list;
+      },
+      seekList() {
+        return [
+          {
+            label: '规则名称:',
+            value: 'name',
+            type: 'input',
+            placeholder: '规则名称'
+          },
+          {
+            label: '规则编码:',
+            value: 'code',
+            type: 'input',
+            placeholder: '规则编码'
+          }
+        ];
+      }
+    },
+    data() {
+      return {
+        loading: false,
+        visible: false,
+        selection: [],
+        produceTaskId: '',
+        reportWorkType: '', // 事项报工类型 产前、过程、产后
+        currentRowId: null,
+        currentRow: null
+      };
+    },
+    created() {
+      this.requestDict('事项类型');
+      this.requestDict('规则周期');
+    },
+    methods: {
+      open() {
+        this.visible = true;
+        this.reload(); // 刷新表格
+      },
+      updateVisible(val) {
+        this.visible = val;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return planConfigPage({
+          pageNum: page,
+          size: limit,
+          ...where,
+          ...this.where,
+          ruleType: this.ruleType
+        });
+      },
+      /* 刷新表格 */
+      reload(where = {}) {
+        this.$refs.tableRef?.reload({
+          page: 1, // 已发布
+          where
+        });
+      },
+      confirmSelection() {
+        if (this.multiple && this.selection.length === 0) {
+          this.$message.warning('请先选择事项');
+          return;
+        }
+
+        if (!this.multiple && !this.currentRow) {
+          this.$message.warning('请先选择事项');
+          return;
+        }
+
+        this.$emit(
+          'chooseRules',
+          this.multiple ? this.selection : this.currentRow
+        );
+        this.handleClose();
+      },
+      radioChange(_, row) {
+        this.currentRow = row;
+      },
+      handleClose() {
+        this.selection = [];
+        this.currentRowId = null;
+        this.currentRow = null;
+        this.visible = false;
+      }
+    }
+  };
+</script>

+ 1 - 1
src/components/selectReleaseRules/select-release-rules.vue

@@ -50,7 +50,7 @@
     components: { search },
     mixins: [tabMixins, dictMixins],
     props: {
-      // NotProduceTaskConfig bool 是否排除已配置的记录规则 过程监测传true
+      // NotProduceTaskConfig bool 是否排除已配置的记录规则 过程控制传true
       notProduceTaskConfig: {
         type: Boolean,
         default: false

+ 86 - 102
src/views/batchRecord/components/editModal.vue

@@ -13,7 +13,6 @@
         class="switch"
         v-if="details && details.processInstanceId"
         :maxable="true"
-        style="margin-bottom: 20px"
       >
         <div class="switch_left">
           <ul>
@@ -37,7 +36,7 @@
         label-width="130px"
       >
         <header-title title="事项信息"></header-title>
-        <el-row style="margin-bottom: 20px">
+        <el-row>
           <el-col :span="8">
             <el-form-item label="记录编码">
               <el-input
@@ -70,28 +69,6 @@
           </el-col>
         </el-row>
         <el-row>
-          <el-col :span="8">
-            <el-form-item
-              v-if="form.itemType == '1'"
-              label="选择设备"
-              required
-              prop="deviceName"
-            >
-              <div class="mask-box" @click="selectDeviceId">
-                <el-input
-                  v-model="form.deviceName"
-                  placeholder="请选择设备"
-                  size="small"
-                  :readonly="true"
-                >
-                  <template #append>
-                    <el-button size="small">选择设备</el-button>
-                  </template>
-                </el-input>
-              </div>
-            </el-form-item>
-          </el-col>
-
           <el-col v-if="form.itemType == '3'" :span="8">
             <el-form-item label="关联任务">
               <el-input
@@ -127,7 +104,7 @@
             </el-form-item>
           </el-col>
           <el-col v-if="form.itemType == '1'" :span="8">
-            <el-form-item label="关联事项规则" required prop="ruleName">
+            <el-form-item label="关联计划规则" required prop="ruleName">
               <div class="mask-box" @click="selectRulesId">
                 <el-input
                   v-model="form.ruleName"
@@ -146,13 +123,13 @@
 
         <header-title
           title="基本信息"
-          v-if="form.itemType == 2 && reportWorkType != 4"
+          v-if="form.itemType != 1 && reportWorkType != 4"
           style="margin-top: 20px"
         ></header-title>
 
-        <template v-if="form.itemType == 2 && reportWorkType != 4">
-          <el-row style="margin-bottom: 20px">
-            <el-col :span="8">
+        <template v-if="form.itemType != 1 && reportWorkType != 4">
+          <el-row>
+            <el-col v-if="form.itemType == 2" :span="8">
               <el-form-item
                 v-if="form.recordRulesClassify == 3"
                 label="关联设备"
@@ -219,11 +196,13 @@
                 </el-date-picker>
               </el-form-item>
             </el-col>
-          </el-row>
 
-          <el-row style="margin-bottom: 20px">
             <el-col :span="8">
-              <el-form-item label="执行人" required prop="teamId">
+              <el-form-item
+                label="执行人"
+                :required="form.itemType == 2"
+                :prop="form.itemType == 2 ? 'teamId' : ''"
+              >
                 <div style="display: flex">
                   <el-select
                     v-model="form.teamId"
@@ -265,7 +244,11 @@
               </el-form-item>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="工时" required prop="duration">
+              <el-form-item
+                label="工时"
+                :required="form.itemType == 2"
+                :prop="form.itemType == 2 ? 'duration' : ''"
+              >
                 <el-input
                   placeholder="请输入"
                   v-model="form.duration"
@@ -280,7 +263,7 @@
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col v-if="form.itemType == 2" :span="8">
               <el-form-item label="检查有效期">
                 <el-input
                   placeholder="请输入"
@@ -309,7 +292,7 @@
             </el-col>
           </el-row>
 
-          <el-row style="margin-bottom: 20px">
+          <el-row v-if="form.itemType == 2">
             <el-col v-if="form.recordRulesExecuteMethodName" :span="8">
               <el-form-item label="执行方式">
                 <el-input
@@ -348,27 +331,9 @@
         </template>
 
         <header-title title="关联产品" style="margin-top: 20px"></header-title>
-        <el-row style="margin-bottom: 20px">
+        <el-row>
           <el-col :span="8">
             <el-form-item label="生产工单号" prop="workOrderCode">
-              <!-- <el-select
-                v-model="form.workOrderCode"
-                placeholder="请选择生产工单"
-                style="width: 100%"
-                filterable
-                remote
-                clearable
-                :remote-method="getWorkOrderList"
-                @change="workOrderCodeChange"
-              >
-                <el-option
-                  v-for="item in workOrderList"
-                  :key="item.id"
-                  :label="item.code"
-                  :value="item.code"
-                >
-                </el-option>
-              </el-select> -->
               <el-input
                 v-model="form.workOrderCode"
                 placeholder="请选择生产工单"
@@ -405,7 +370,7 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row style="margin-bottom: 20px">
+        <el-row>
           <el-col :span="8">
             <el-form-item
               label="产品编码"
@@ -460,7 +425,7 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row style="margin-bottom: 20px">
+        <el-row>
           <el-col :span="8">
             <el-form-item label="规格" prop="specification">
               <el-input
@@ -613,10 +578,10 @@
                 @change="checkUsersIdsChange(row)"
               >
                 <el-option
-                  v-for="item in activeTeamUserList"
-                  :label="item.name"
-                  :value="item.id"
-                  :key="item.id"
+                  v-for="item in form.executeUsers"
+                  :label="item.userName"
+                  :value="item.userId"
+                  :key="item.userId"
                 >
                 </el-option>
               </el-select>
@@ -703,12 +668,6 @@
       @chooseEquipment="chooseEquipment"
     ></selectDevices>
 
-    <selectMatterRules
-      ref="selectMatterRulesRef"
-      @chooseRules="chooseRules"
-      :filterType="[1, 2, 5]"
-    ></selectMatterRules>
-
     <selectReleaseRules
       ref="selectReleaseRulesRef"
       @chooseRules="chooseReleaseRules"
@@ -749,6 +708,11 @@
       @confirm="selectWorkOrderConfirm"
       :multiple="false"
     ></selectWorkOrder>
+
+    <selectPlanRules
+      ref="selectPlanRulesRef"
+      @chooseRules="chooseRules"
+    ></selectPlanRules>
   </ele-modal>
 </template>
 
@@ -785,7 +749,7 @@
   import material from '@/views/produce/components/prenatalExamination/material.vue';
   import statistics from './statistics.vue';
   import selectWorkOrder from '@/views/checklistManagement/components/selectWorkOrder.vue';
-  import { set } from 'nprogress';
+  import selectPlanRules from '@/components/selectPlanRules/selectPlanRules.vue';
 
   export default {
     name: 'editModal',
@@ -805,10 +769,11 @@
       bpmTask,
       material,
       statistics,
-      selectWorkOrder
+      selectWorkOrder,
+      selectPlanRules
     },
     props: {
-      // 1-产前准备,2-过程监测,3-产后检查 4-生产统计
+      // 1-产前准备,2-过程控制,3-产后检查 4-生产统计
       reportWorkType: {
         type: Number,
         default: 1
@@ -1087,7 +1052,7 @@
           case 1:
             return '产前准备';
           case 2:
-            return '过程监测';
+            return '过程控制';
           case 3:
             return '产后检查';
           case 4:
@@ -1363,13 +1328,11 @@
       },
       // 去选择事项规则
       selectRulesId() {
-        this.$refs.selectMatterRulesRef.open([this.form.ruleId]);
+        this.$refs.selectPlanRulesRef.open();
       },
       // 选择事项规则
       chooseRules(rules) {
         console.log('rules', rules);
-        this.form.ruleId = rules?.id;
-        this.form.ruleName = rules?.name;
       },
       // 获取生产工单号
       async getWorkOrderList(code = '') {
@@ -1594,7 +1557,16 @@
       // 任务确认报工
       async saveRuleRecord() {
         this.butLoading = true;
-        await saveRuleRecord(this.form);
+
+        const body = JSON.parse(JSON.stringify(this.form));
+
+        if (body.duration) {
+          // 工时小时转毫秒
+          body.duration = Number(body.duration);
+          body.duration = body.duration * 60 * 60 * 1000;
+        }
+
+        await saveRuleRecord(body);
         this.$message.success('报工成功!');
         this.butLoading = false;
         // 返回
@@ -1840,7 +1812,6 @@
         }
       },
       checkTeamList(id) {
-        this.form.executeUsersIds = [];
         const index = this.teamList.findIndex((item) => item.id == id);
         this.teamUserList = this.teamAllList[index];
         console.log('this.teamUserList', this.teamUserList);
@@ -1887,25 +1858,35 @@
           this.checked = false;
         }
 
-        // 同步 executeUsers
-        this.form.executeUsers = this.form.executeUsersIds
-          .map((id) => {
-            const user = this.teamUserList.find((item) => item.id === id);
-            console.log('user', user);
-            if (user) {
-              return {
-                teamId: this.form.teamId,
-                teamName: this.teamList.find(
-                  (team) => team.id == this.form.teamId
-                )?.name,
-                userId: user.id,
-                userName: user.name
-              };
-            } else {
-              return null;
-            }
-          })
-          .filter((item) => item !== null);
+        const deleteUserIds = this.form.executeUsers
+          .map((i) => i.userId)
+          .filter((id) => !this.form.executeUsersIds.includes(id));
+
+        const addUserIds = this.form.executeUsersIds.filter(
+          (id) => !this.form.executeUsers.map((i) => i.userId).includes(id)
+        );
+
+        // 删除 用户
+        if (deleteUserIds.length > 0) {
+          this.form.executeUsers = this.form.executeUsers.filter(
+            (item) => !deleteUserIds.includes(item.userId)
+          );
+        }
+
+        // 添加 用户
+        addUserIds.forEach((id) => {
+          const user = this.teamUserList.find((item) => item.id === id);
+          if (user) {
+            this.form.executeUsers.push({
+              teamId: this.form.teamId,
+              teamName: this.teamList.find(
+                (team) => team.id == this.form.teamId
+              )?.name,
+              userId: user.id,
+              userName: user.name
+            });
+          }
+        });
 
         console.log('this.form.executeUsers', this.form.executeUsers);
 
@@ -1934,14 +1915,8 @@
       checkUsersIdsChange(row) {
         // 同步 checkUsers
         row.checkUsers = row.checkUsersIds.map((i) => {
-          const user = this.activeTeamUserList.find((item) => item.id === i);
-          return {
-            teamId: this.form.teamId,
-            teamName: this.teamList.find((team) => team.id == this.form.teamId)
-              ?.name,
-            userId: user.id,
-            userName: user.name
-          };
+          const user = this.form.executeUsers.find((item) => item.userId === i);
+          return user;
         });
 
         console.log('row', row);
@@ -2000,4 +1975,13 @@
     padding: 8px 20px;
     border-bottom: 1px solid #ccc;
   }
+
+  :deep(
+      .el-dialog:not(.ele-dialog-form)
+        .el-dialog__body
+        .el-form
+        .el-form-item:last-child
+    ) {
+    margin-bottom: 22px;
+  }
 </style>

+ 2 - 2
src/views/batchRecord/components/list.vue

@@ -191,7 +191,7 @@
     name: 'batchRecordTable',
     mixins: [dictMixins, tableColumnsMixin],
     props: {
-      // 1-产前准备,2-过程监测,3-产后检查
+      // 1-产前准备,2-过程控制,3-产后检查
       reportWorkType: {
         type: Number,
         default: 1
@@ -439,7 +439,7 @@
         if (this.reportWorkType == 1) {
           businessType = '产前准备';
         } else if (this.reportWorkType == 2) {
-          businessType = '过程监测';
+          businessType = '过程控制';
         } else if (this.reportWorkType == 3) {
           businessType = '产后检查';
         } else {

+ 4 - 4
src/views/produce/components/footBtn.vue

@@ -54,7 +54,7 @@
             isShow: 'mes:feed:save'
           },
           {
-            name: '过程监测',
+            name: '过程控制',
             type: 'processDetection',
             bjColor: '#008888',
             isShow: 'mes:producetaskrulerecord:save2'
@@ -267,16 +267,16 @@
         btnList: [],
         disableObj: {
           preResult: {
-            buts: ['投料', '过程监测', '产后检查', '报工'],
+            buts: ['投料', '过程控制', '产后检查', '报工'],
             msg: '请先完成产前准备'
           },
           feedResult: {
-            buts: ['过程监测', '产后检查', '报工'],
+            buts: ['过程控制', '产后检查', '报工'],
             msg: '请先完成投料'
           },
           postResult: {
             buts: ['产后检查', '报工'],
-            msg: '请先完成过程监测'
+            msg: '请先完成过程控制'
           },
           finalResult: {
             buts: ['报工'],

+ 20 - 4
src/views/produce/components/prenatalExamination/PlanRulesDialog.vue

@@ -10,8 +10,17 @@
     append-to-body
   >
     <div v-if="rulesInfo && currentPlanDevices">
+      <!-- {{ JSON.stringify(currentPlanDevices) }} -->
       <!-- 根据当前currentPlanDevices的 planStatus状态展示不同内容 -->
-      <!-- 0 派单 -->
+      <!-- 0 派单, 4为撤回的计划 -->
+      <programRulesDialog
+        v-if="
+          currentPlanDevices.planStatus == 0 ||
+          currentPlanDevices.planStatus == 4
+        "
+        :planId="currentPlanDevices.planId"
+        @done="setPlanStatus(1)"
+      />
       <!-- 1 报工 -->
       <signingUpWork
         v-if="currentPlanDevices.planStatus == 1"
@@ -19,9 +28,12 @@
         :workOrderId="currentPlanDevices.eamWorkOrderId"
         @refresh="setPlanStatus(2)"
       ></signingUpWork>
-      <!-- 2 详情-->
+      <!-- 2 执行中 3 完成展示详情-->
       <workOrderDetails
-        v-if="currentPlanDevices.planStatus == 3"
+        v-if="
+          currentPlanDevices.planStatus == 3 ||
+          currentPlanDevices.planStatus == 2
+        "
         :workOrderId="currentPlanDevices.eamWorkOrderId"
       ></workOrderDetails>
     </div>
@@ -68,12 +80,14 @@
   import dictMixins from '@/mixins/dictMixins';
   import signingUpWork from './components/workOrder/signingUpWork.vue';
   import workOrderDetails from './components/workOrder/details.vue';
+  import programRulesDialog from './components/workOrder/programRulesDialog.vue';
 
   export default {
     mixins: [dictMixins],
     components: {
       signingUpWork,
-      workOrderDetails
+      workOrderDetails,
+      programRulesDialog
     },
     data() {
       return {
@@ -105,6 +119,8 @@
       handleClose() {
         this.rulesInfo = null;
         this.activeIndex = 0;
+        // 触发父组件刷新
+        this.$emit('reload');
         this.$nextTick(() => {
           this.visible = false;
         });

+ 42 - 19
src/views/produce/components/prenatalExamination/components/workOrder/details.vue

@@ -6,43 +6,51 @@
           <HeaderTitle title="基本信息" size="16px"> </HeaderTitle>
           <el-row>
             <el-col :span="24">
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="计划单号">
                   <span> {{ infoData.planCode }} </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="来源计划配置单号">
                   <span> {{ infoData.planConfigCode }} </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="名称">
                   <span> {{ infoData.planName }} </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
-                <el-form-item label="部门">
-                  <span>
-                    {{ infoData.executeGroupName }}
+              <el-col :span="8">
+                <el-form-item label="指定执行人">
+                  <span v-if="infoData.assignUser">
+                    {{
+                      infoData.assignUser
+                        .map((i) => {
+                          return `${i.groupName}-${i.userName}`;
+                        })
+                        .join(',')
+                    }}
                   </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
-                <el-form-item label="人员">
-                  <span>
-                    {{ infoData.executeUserName }}
+              <el-col :span="8">
+                <el-form-item label="实际执行人">
+                  <span v-if="infoData.executeUserName">
+                    {{ infoData.executeGroupName }}-{{
+                      infoData.executeUserName
+                    }}
                   </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="计划完成时长">
                   <span v-if="infoData.duration >= 0"
                     >{{ infoData.duration }}分钟</span
                   >
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="周期">
                   <span v-if="infoData.ruleInfo">
                     {{ infoData.ruleInfo.cycleValue
@@ -52,40 +60,55 @@
                   </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="设备分类">
                   <span> {{ infoData.categoryLevelName }} </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="规则名称">
                   <span>
                     {{ infoData.ruleName }}
                   </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="创建部门">
                   <span> {{ infoData.createGroupName }} </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="创建人">
                   <span> {{ infoData.createUserName }} </span>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <el-col :span="8">
                 <el-form-item label="创建时间">
                   <span> {{ infoData.createTime }} </span>
                 </el-form-item>
               </el-col>
+              <el-col :span="8">
+                <el-form-item label="实际开始时间">
+                  <span> {{ infoData.acceptTime }} </span>
+                </el-form-item>
+              </el-col>
+              <el-col :span="8">
+                <el-form-item label="实际完成时间">
+                  <span> {{ infoData.finishTime }} </span>
+                </el-form-item>
+              </el-col>
+              <el-col :span="8">
+                <el-form-item label="报工时间">
+                  <span> {{ infoData.reportTime }} </span>
+                </el-form-item>
+              </el-col>
               <el-col :span="24">
                 <el-form-item label="备注">
                   <span> {{ infoData.remark }} </span>
                 </el-form-item>
               </el-col>
             </el-col>
-            <!-- <el-col :span="12">
+            <!-- <el-col :span="8">
               <img :src="data.imageUrl" alt="" />
             </el-col> -->
           </el-row>

+ 962 - 788
src/views/produce/components/prenatalExamination/components/workOrder/programRulesDialog.vue

@@ -1,25 +1,46 @@
 <template>
-  <ele-modal width="80%" :visible="visible" v-if="visible" append-to-body custom-class="ele-dialog-form"
-    :title="dialogTitle" :close-on-click-modal="false" :before-close="close" :maxable="true">
+  <div>
     <header-title title="基本信息"></header-title>
-    <el-form ref="addFormRef" :model="addForm" :rules="addFormRules" label-width="120px">
+    <el-form
+      ref="addFormRef"
+      :model="addForm"
+      :rules="addFormRules"
+      label-width="120px"
+    >
       <el-row>
         <el-col :span="8">
           <el-form-item label="计划配置单号" prop="code">
-            <el-input v-model="addForm.code" size="small" placeholder="自动带出" disabled></el-input>
+            <el-input
+              v-model="addForm.code"
+              size="small"
+              placeholder="自动带出"
+              disabled
+            ></el-input>
           </el-form-item>
         </el-col>
 
         <el-col :span="8">
           <el-form-item label="计划配置名称" prop="name">
-            <el-input :disabled="dialogTitle === '派单'" v-model="addForm.name" size="small" placeholder="请输入"></el-input>
+            <el-input
+              :disabled="dialogTitle === '派单'"
+              v-model="addForm.name"
+              size="small"
+              placeholder="请输入"
+            ></el-input>
           </el-form-item>
         </el-col>
 
         <el-col :span="8">
           <el-form-item label="自动派单" prop="autoOrder">
-            <el-select :disabled="dialogTitle === '派单' || dialogTitle.includes('量具送检')
-              " v-model="addForm.autoOrder" size="small" style="width: 100%" @change="autoOrderChange">
+            <el-select
+              :disabled="
+                dialogTitle === '派单' || dialogTitle.includes('量具送检')
+              "
+              v-model="addForm.autoOrder"
+              size="small"
+              style="width: 100%"
+              @change="autoOrderChange"
+            >
               <el-option :value="1" label="是"></el-option>
               <el-option :value="0" label="否"></el-option>
             </el-select>
@@ -29,38 +50,81 @@
         <el-col :span="8">
           <el-form-item label="计划完成时长" prop="duration">
             <div style="display: flex">
-              <el-input type="number" :disabled="dialogTitle === '派单'" v-model="addForm.duration" size="small"
-                placeholder="请输入" @input="formDataDurationTime">
+              <el-input
+                type="number"
+                :disabled="dialogTitle === '派单'"
+                v-model="addForm.duration"
+                size="small"
+                placeholder="请输入"
+                @input="formDataDurationTime"
+              >
                 <template #suffix>分钟</template>
               </el-input>
             </div>
           </el-form-item>
         </el-col>
 
-        <el-col :span="8" v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')">
+        <el-col
+          :span="8"
+          v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
+        >
           <el-form-item label="部门" prop="groupId">
-            <deptSelect v-model="addForm.groupId" @changeGroup="searchDeptNodeClick" :disabled="isBindPlan" />
+            <deptSelect
+              v-model="addForm.groupId"
+              @changeGroup="searchDeptNodeClick"
+              :disabled="isBindPlan"
+            />
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')">
+        <el-col
+          :span="8"
+          v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
+        >
           <el-form-item label="负责人" prop="executorId">
-            <el-select v-model="addForm.executorId" 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
+              v-model="addForm.executorId"
+              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-col>
         <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
           <el-form-item label="审核人" prop="approvalUserId">
-            <el-select :disabled="dialogTitle === '派单'" v-model="addForm.approvalUserId" size="small" clearable
-              style="width: 100%" filterable>
-              <el-option v-for="item in uerList" :key="item.id" :value="item.id" :label="item.name"></el-option>
+            <el-select
+              :disabled="dialogTitle === '派单'"
+              v-model="addForm.approvalUserId"
+              size="small"
+              clearable
+              style="width: 100%"
+              filterable
+            >
+              <el-option
+                v-for="item in uerList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="紧急程度" prop="urgent">
-            <DictSelection dictName="紧急程度" clearable v-model="addForm.urgent" :disabled="dialogTitle === '派单'">
+            <DictSelection
+              dictName="紧急程度"
+              clearable
+              v-model="addForm.urgent"
+              :disabled="dialogTitle === '派单'"
+            >
             </DictSelection>
           </el-form-item>
         </el-col>
@@ -77,25 +141,54 @@
         </el-col> -->
         <el-col :span="24">
           <el-form-item label="备注" prop="remark">
-            <el-input type="textarea" resize="none" v-model="addForm.remark" :rows="2" placeholder="请详细说明" size="small"
-              :disabled="dialogTitle === '派单'"></el-input>
+            <el-input
+              type="textarea"
+              resize="none"
+              v-model="addForm.remark"
+              :rows="2"
+              placeholder="请详细说明"
+              size="small"
+              :disabled="dialogTitle === '派单'"
+            ></el-input>
           </el-form-item>
         </el-col>
       </el-row>
 
-      <el-button v-if="dialogTitle.includes('新增')" type="primary" size="small" style="margin-bottom: 10px"
-        @click="handleAddTab">添加规则</el-button>
+      <el-button
+        v-if="dialogTitle.includes('新增')"
+        type="primary"
+        size="small"
+        style="margin-bottom: 10px"
+        @click="handleAddTab"
+        >添加规则</el-button
+      >
 
-      <el-tabs v-model="tabsValue" type="card" :closable="dialogTitle !== '派单'" @tab-click="handleTab"
-        @tab-remove="removeTab">
-        <el-tab-pane v-for="(item, ruleIdListIndex) in ruleIdList" :key="item.ruleId" :label="item.name"
-          :name="item.ruleId">
+      <el-tabs
+        v-model="tabsValue"
+        type="card"
+        :closable="dialogTitle !== '派单'"
+        @tab-click="handleTab"
+        @tab-remove="removeTab"
+      >
+        <el-tab-pane
+          v-for="(item, ruleIdListIndex) in ruleIdList"
+          :key="item.ruleId"
+          :label="item.name"
+          :name="item.ruleId"
+        >
           <div class="el-tab_box">
             <div class="equipmentList_box">
               <header-title title="设备列表">
                 <div v-if="dialogTitle !== '派单'">
-                  <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
-                    :disables="hasCategoryId" @click="handleAdd(ruleIdList, ruleIdListIndex)">新增</el-button>
+                  <el-button
+                    size="small"
+                    icon="el-icon-plus"
+                    class="ele-btn-icon"
+                    type="primary"
+                    :disables="hasCategoryId"
+                    @click="handleAdd(ruleIdList, ruleIdListIndex)"
+                    >新增</el-button
+                  >
                 </div>
               </header-title>
               <el-table :data="item.equipmentList" border>
@@ -122,9 +215,17 @@
                     </template>
                   </template>
                 </el-table-column>
-                <el-table-column v-if="dialogTitle !== '派单'" label="操作" width="100">
+                <el-table-column
+                  v-if="dialogTitle !== '派单'"
+                  label="操作"
+                  width="100"
+                >
                   <template slot-scope="scope">
-                    <el-button type="text" @click="deleteEquipment(scope.$index)">删除</el-button>
+                    <el-button
+                      type="text"
+                      @click="deleteEquipment(scope.$index)"
+                      >删除</el-button
+                    >
                   </template>
                 </el-table-column>
               </el-table>
@@ -132,8 +233,14 @@
             <div class="ruleMatters_box">
               <header-title title="规则事项">
                 <div v-if="dialogTitle !== '派单'">
-                  <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
-                    @click="addPostscript">新增</el-button>
+                  <el-button
+                    size="small"
+                    icon="el-icon-plus"
+                    class="ele-btn-icon"
+                    type="primary"
+                    @click="addPostscript"
+                    >新增</el-button
+                  >
                 </div>
               </header-title>
               <el-table :data="item.ruleItems" border>
@@ -142,20 +249,34 @@
                     <span>{{ scope.$index + 1 }}</span>
                   </template>
                 </el-table-column>
-                <el-table-column label="零部件编码" prop="categoryCode" width="100">
+                <el-table-column
+                  label="零部件编码"
+                  prop="categoryCode"
+                  width="100"
+                >
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
-                      <el-input v-model="scope.row.categoryCode" placeholder="请输入零部件编码"></el-input>
+                      <el-input
+                        v-model="scope.row.categoryCode"
+                        placeholder="请输入零部件编码"
+                      ></el-input>
                     </div>
                     <div v-else>
                       <span>{{ scope.row.categoryCode }}</span>
                     </div>
                   </template>
                 </el-table-column>
-                <el-table-column label="零部件名称" prop="categoryName" width="100">
+                <el-table-column
+                  label="零部件名称"
+                  prop="categoryName"
+                  width="100"
+                >
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
-                      <el-input v-model="scope.row.categoryName" placeholder="请输入零部件名称"></el-input>
+                      <el-input
+                        v-model="scope.row.categoryName"
+                        placeholder="请输入零部件名称"
+                      ></el-input>
                     </div>
                     <div v-else>
                       <span>{{ scope.row.categoryName }}</span>
@@ -165,7 +286,10 @@
                 <el-table-column label="事项" prop="name" width="100">
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
-                      <el-input v-model="scope.row.name" placeholder="请输入内容"></el-input>
+                      <el-input
+                        v-model="scope.row.name"
+                        placeholder="请输入内容"
+                      ></el-input>
                     </div>
                     <div v-else>
                       <span>{{ scope.row.name }}</span>
@@ -175,7 +299,10 @@
                 <el-table-column label="内容" prop="content" width="200">
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
-                      <el-input v-model="scope.row.content" placeholder="请输入内容"></el-input>
+                      <el-input
+                        v-model="scope.row.content"
+                        placeholder="请输入内容"
+                      ></el-input>
                     </div>
                     <div v-else>
                       <span>{{ scope.row.content }}</span>
@@ -184,22 +311,33 @@
                 </el-table-column>
                 <el-table-column label="操作指导" prop="operationGuide">
                   <template slot-scope="scope">
-                    <div class="operationGuide_box" @click="
-                      openOperationGuideDialogDialog(
-                        scope.row.operationGuide,
-                        scope.$index
-                      )
-                      ">
+                    <div
+                      class="operationGuide_box"
+                      @click="
+                        openOperationGuideDialogDialog(
+                          scope.row.operationGuide,
+                          scope.$index
+                        )
+                      "
+                    >
                       <div class="left_content">
                         <template v-if="scope.row.operationGuide">
-                          <div v-for="(item, index) in scope.row.operationGuide
-                            .toolList" :key="item.id">{{ index + 1 }}.{{ item.name }}</div>
+                          <div
+                            v-for="(item, index) in scope.row.operationGuide
+                              .toolList"
+                            :key="item.id"
+                            >{{ index + 1 }}.{{ item.name }}</div
+                          >
                         </template>
                       </div>
                       <div class="right_content">
                         <template v-if="scope.row.operationGuide">
-                          <div v-for="(item, index) in scope.row.operationGuide
-                            .procedureList" :key="item.id">{{ index + 1 }}.{{ item.content }}</div>
+                          <div
+                            v-for="(item, index) in scope.row.operationGuide
+                              .procedureList"
+                            :key="item.id"
+                            >{{ index + 1 }}.{{ item.content }}</div
+                          >
                         </template>
                       </div>
                     </div>
@@ -208,16 +346,25 @@
                 <el-table-column label="标准" prop="norm" width="100">
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
-                      <el-input v-model="scope.row.norm" placeholder="请输入内容"></el-input>
+                      <el-input
+                        v-model="scope.row.norm"
+                        placeholder="请输入内容"
+                      ></el-input>
                     </div>
                     <div v-else>
                       <span>{{ scope.row.norm }}</span>
                     </div>
                   </template>
                 </el-table-column>
-                <el-table-column v-if="dialogTitle !== '派单'" label="操作" width="100">
+                <el-table-column
+                  v-if="dialogTitle !== '派单'"
+                  label="操作"
+                  width="100"
+                >
                   <template slot-scope="scope">
-                    <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
+                    <el-button type="text" @click="deleteItem(scope.$index)"
+                      >删除</el-button
+                    >
                   </template>
                 </el-table-column>
               </el-table>
@@ -226,838 +373,865 @@
         </el-tab-pane>
       </el-tabs>
     </el-form>
-    <template v-slot:footer>
-      <el-button @click="visible = false">取消</el-button>
-      <el-button type="primary" @click="save">
-        {{ dialogTitle === '派单' ? '派单' : '保存' }}</el-button>
-    </template>
+    <div class="footer-box">
+      <el-button type="primary" @click="save" :loading="loading">
+        {{ dialogTitle === '派单' ? '派 单' : '保 存' }}</el-button
+      >
+    </div>
 
     <!-- 添加规则 -->
-    <ele-modal width="800px" :visible="addDialog" :append-to-body="true" title="规则配置" :close-on-click-modal="true"
-      @update:visible="closeAdd" :maxable="true">
-      <el-select v-model="ruleObj.ruleId" size="small" style="width: 100%" @change="handleRuleNameChange"
-        :disabled="isBindPlan" filterable>
-        <el-option v-for="item in ruleNameList" :key="item.id" :value="item.id" :label="item.code + '-' + item.name"
-          @click.native="ruleChange(item)"></el-option>
+    <ele-modal
+      width="800px"
+      :visible="addDialog"
+      :append-to-body="true"
+      title="规则配置"
+      :close-on-click-modal="true"
+      @update:visible="closeAdd"
+      :maxable="true"
+    >
+      <el-select
+        v-model="ruleObj.ruleId"
+        size="small"
+        style="width: 100%"
+        @change="handleRuleNameChange"
+        :disabled="isBindPlan"
+        filterable
+      >
+        <el-option
+          v-for="item in ruleNameList"
+          :key="item.id"
+          :value="item.id"
+          :label="item.code + '-' + item.name"
+          @click.native="ruleChange(item)"
+        ></el-option>
       </el-select>
       <template v-slot:footer>
         <el-button @click="addDialog = false">取消</el-button>
         <el-button type="primary" @click="addRule"> 添加 </el-button>
       </template>
     </ele-modal>
-  </ele-modal>
+  </div>
 </template>
 
 <script>
-import { getDetail, getCode } from '@/api/ruleManagement/matter';
-import {
-  getRule,
-  getCategory,
-} from '@/api/ruleManagement/plan';
-import { saveOrUpdate } from '@/api/maintenance/patrol_maintenance';
-import { getUserPage } from '@/api/system/organization';
-import deptSelect from '@/components/CommomSelect/dept-select.vue';
-import { pageList } from '@/api/technology/version/version.js';
-import { getById } from '@/api/maintenance/patrol_maintenance';
-import { getFile } from '@/api/system/file';
-import { deepClone } from 'ele-admin/lib/utils/core';
+  import { getDetail, getCode } from '@/api/ruleManagement/matter';
+  import { getRule, getCategory } from '@/api/ruleManagement/plan';
+  import { saveOrUpdate } from '@/api/maintenance/patrol_maintenance';
+  import { getUserPage } from '@/api/system/organization';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import { pageList } from '@/api/technology/version/version.js';
+  import { getById } from '@/api/maintenance/patrol_maintenance';
+  import { getFile } from '@/api/system/file';
+  import { deepClone } from 'ele-admin/lib/utils/core';
+  import work from '@/api/technology/work';
 
-export default {
-  components: {
-    deptSelect
-  },
-  props: {
-    dialogTitle: {
-      type: String,
-      default: () => {
-        return '派单';
+  export default {
+    components: {
+      deptSelect
+    },
+    props: {
+      dialogTitle: {
+        type: String,
+        default: () => {
+          return '派单';
+        }
+      },
+      // 计划id
+      planId: {
+        type: String,
+        required: true
       }
-    }
-    // visible: {
-    //   type: Boolean,
-    //   default: false
-    // }
-  },
-  data() {
-    const defaultForm = {
-      id: null,
-      code: '',
-      name: '',
-      modelType: '',
-      brandNum: '',
-      specification: '',
-      measuringUnit: '',
-
-      bomList: []
-    };
-    return {
-      visible: false,
-      ruleIndex: 0, // 规则index
-      ruleId: '',
-      formLabel: '',
-      isBindPlan: false,
-      ruleObj: {
-        ruleId: '',
-        name: '',
+    },
+    data() {
+      const defaultForm = {
+        id: null,
         code: '',
-        equipmentList: []
-      },
-      ruleIdList: [],
-      addForm: {
-        id: '',
-        code: '', // 计划配置单号
-        name: '', // 计划配置名称
-        autoOrder: 1, // 自动派单
-        ruleId: '', // 规则id
-        ruleName: '', // 规则名称
-        duration: null, // 计划完成时长
-        categoryId: '', // 设备类别id
-        approvalUserId: '', // 审核人id
-        groupId: '', // 巡点检部门code
-        executorId: [], // 巡点检人员id
-        executorPhone: '',
-        status: 1, // 状态
-        remark: '', // 备注
-        urgent: '1'
-      },
-      ruleNameList: [], // 规则列表
-      uerList: [], // 审核人列表
-      executorList: [], // 业务人员列表
-      defaultForm,
-      // 表单数据
-      form: {
-        ...defaultForm
-      },
-
-      versionList: [],
-
-      // 表单验证规则
-      addFormRules: {
-        name: [
-          { required: true, message: '请输入计划配置名称', trigger: 'blur' }
-        ],
-        autoOrder: [
-          { required: true, message: '请选择是否自动派单', trigger: 'change' }
-        ],
-        ruleId: [
-          { required: true, message: '请选择规则名称', trigger: 'change' }
-        ],
-        duration: [
-          { required: true, message: '请输入计划完成时长', trigger: 'blur' }
-        ],
-        categoryLevelId: [
-          { required: true, message: '请选择设备分类', trigger: 'change' }
-        ],
-        categoryId: [
-          { required: true, message: '请选择设备类别', trigger: 'change' }
-        ],
-        groupId: [
-          { required: true, message: '请选择巡点检部门', trigger: 'change' }
-        ],
-        executorId: [
-          { required: true, message: '请选择巡点检人员', trigger: 'change' }
-        ],
-        urgent: [
-          { required: true, message: '请选择紧急程度', trigger: 'change' }
-        ]
-      },
+        name: '',
+        modelType: '',
+        brandNum: '',
+        specification: '',
+        measuringUnit: '',
 
-      columns: [
-        {
-          type: 'index',
-          width: 55,
-          align: 'center'
+        bomList: []
+      };
+      return {
+        visible: false,
+        ruleIndex: 0, // 规则index
+        ruleId: '',
+        formLabel: '',
+        isBindPlan: false,
+        ruleObj: {
+          ruleId: '',
+          name: '',
+          code: '',
+          equipmentList: []
         },
-        {
-          label: '子项编号',
-          prop: 'subCode',
-          action: 'subCode'
+        ruleIdList: [],
+        addForm: {
+          id: '',
+          code: '', // 计划配置单号
+          name: '', // 计划配置名称
+          autoOrder: 1, // 自动派单
+          ruleId: '', // 规则id
+          ruleName: '', // 规则名称
+          duration: null, // 计划完成时长
+          categoryId: '', // 设备类别id
+          approvalUserId: '', // 审核人id
+          groupId: '', // 巡点检部门code
+          executorId: [], // 巡点检人员id
+          executorPhone: '',
+          status: 1, // 状态
+          remark: '', // 备注
+          urgent: '1'
         },
-        {
-          label: '物料名称',
-          prop: 'categoryName',
-          action: 'categoryName'
+        ruleNameList: [], // 规则列表
+        uerList: [], // 审核人列表
+        executorList: [], // 业务人员列表
+        defaultForm,
+        // 表单数据
+        form: {
+          ...defaultForm
         },
 
-        {
-          label: '是否回收料',
-          prop: 'isReworkBom',
-          action: 'isReworkBom',
-          slot: 'isReworkBom',
-          width: 95
-        },
+        versionList: [],
 
-        {
-          label: '物料编码',
-          prop: 'categoryCode'
-        },
-        {
-          label: '牌号',
-          prop: 'brandNum'
-        },
-        {
-          label: '型号',
-          prop: 'modelType'
-        },
-        {
-          label: '数量',
-          prop: 'count'
-        },
-        {
-          label: '计量单位',
-          prop: 'unit'
+        // 表单验证规则
+        addFormRules: {
+          name: [
+            { required: true, message: '请输入计划配置名称', trigger: 'blur' }
+          ],
+          autoOrder: [
+            { required: true, message: '请选择是否自动派单', trigger: 'change' }
+          ],
+          ruleId: [
+            { required: true, message: '请选择规则名称', trigger: 'change' }
+          ],
+          duration: [
+            { required: true, message: '请输入计划完成时长', trigger: 'blur' }
+          ],
+          categoryLevelId: [
+            { required: true, message: '请选择设备分类', trigger: 'change' }
+          ],
+          categoryId: [
+            { required: true, message: '请选择设备类别', trigger: 'change' }
+          ],
+          groupId: [
+            { required: true, message: '请选择巡点检部门', trigger: 'change' }
+          ],
+          executorId: [
+            { required: true, message: '请选择巡点检人员', trigger: 'change' }
+          ],
+          urgent: [
+            { required: true, message: '请选择紧急程度', trigger: 'change' }
+          ]
         },
 
-        {
-          label: '附件',
-          slot: 'bomArtFiles',
-          action: 'bomArtFiles',
-          minWidth: 100
-        },
+        columns: [
+          {
+            type: 'index',
+            width: 55,
+            align: 'center'
+          },
+          {
+            label: '子项编号',
+            prop: 'subCode',
+            action: 'subCode'
+          },
+          {
+            label: '物料名称',
+            prop: 'categoryName',
+            action: 'categoryName'
+          },
 
-        {
-          label: '单位',
-          prop: 'weightUnit'
-        },
+          {
+            label: '是否回收料',
+            prop: 'isReworkBom',
+            action: 'isReworkBom',
+            slot: 'isReworkBom',
+            width: 95
+          },
 
-        {
-          label: '备注',
-          prop: 'remark'
-        }
-      ],
+          {
+            label: '物料编码',
+            prop: 'categoryCode'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum'
+          },
+          {
+            label: '型号',
+            prop: 'modelType'
+          },
+          {
+            label: '数量',
+            prop: 'count'
+          },
+          {
+            label: '计量单位',
+            prop: 'unit'
+          },
 
-      statusList: [
-        { label: '草稿', value: -1 },
-        { label: '失效', value: 0 },
-        { label: '生效', value: 1 }
-      ],
+          {
+            label: '附件',
+            slot: 'bomArtFiles',
+            action: 'bomArtFiles',
+            minWidth: 100
+          },
 
-      // 提交状态
-      loading: false,
+          {
+            label: '单位',
+            prop: 'weightUnit'
+          },
 
-      categoryId: null,
+          {
+            label: '备注',
+            prop: 'remark'
+          }
+        ],
 
-      current: null,
+        statusList: [
+          { label: '草稿', value: -1 },
+          { label: '失效', value: 0 },
+          { label: '生效', value: 1 }
+        ],
 
-      materialShow: false,
+        // 提交状态
+        loading: false,
 
-      tabsList: [],
-      tableData: [],
+        categoryId: null,
 
-      taskId: null,
+        current: null,
 
-      addDialog: false,
-      tabsValue: null,
+        materialShow: false,
 
-      hasCategoryId: false,
-      getByIdData: {}
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  watch: {
-    visible(val) {
-      if (val) {
-        // 获取审核人列表数据
-        this.getUserList();
-        // 获取规则名称
-        this._getRuleNameList();
-      }
-    }
-  },
-  methods: {
-    close() {
-      this.visible = false;
+        tabsList: [],
+        tableData: [],
+
+        taskId: null,
+
+        addDialog: false,
+        tabsValue: null,
+
+        hasCategoryId: false,
+        getByIdData: {}
+      };
     },
-    // 初始化
-    async init(row, tips) {
-      console.log(row);
-      console.log(tips);
-      this.visible = true;
-      if (row) {
-        this.getInfo(row.id, tips);
-      } else {
-        //  获取计划配置单号
-        this.getOrderCode(tips);
-        this.addForm = {
-          code: '', // 计划配置单号
-          name: '', // 计划配置名称
-          autoOrder: 1, // 自动派单
-          ruleId: '', // 规则id
-          ruleName: '', // 规则名称
-          duration: null, // 计划完成时长
-          categoryId: '', // 设备类别id
-          approvalUserId: '', // 审核人id
-          groupId: '', // 巡点检部门code
-          executorId: [], // 巡点检人员id
-          executorPhone: '',
-          status: 1, // 状态
-          remark: '', // 备注
-          urgent: '1'
-        };
-        this.ruleIdList = [];
-        this.isBindPlan = false;
-        this.planRuleEquiList = [];
-        //   this.matterRulesList = [];
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
       }
-      this.formLabel = this.dialogTitle.includes('巡点检')
-        ? '巡点检'
-        : this.dialogTitle.includes('保养')
-          ? '保养'
-          : this.dialogTitle.includes('量具送检')
-            ? '量具送检'
-            : this.dialogTitle.includes('运行记录')
-              ? '运行记录'
-              : '盘点';
-      const typeOptions = {
-        巡点检: 1,
-        保养: 2,
-        维修: 3,
-        计划性维修: 4,
-        量具送检: 5,
-        运行记录: 6
-      };
-      this.$set(this.addForm, 'type', typeOptions[this.formLabel]);
-
-      // const planRuleTypeObj = {
-      //   巡点检: 'PATROL',
-      //   保养: 'MAINTAIN',
-      //   量具送检: '',
-      //   盘点: 'INVENTORY'
-      // };
-      // this.addForm.planType = planRuleTypeObj[this.formLabel];
     },
-    autoOrderChange(val) {
-      if (val == 0) {
-        this.addForm.executorId = '';
-        this.addForm.groupId = '';
+    watch: {
+      visible(val) {
+        if (val) {
+          // 获取审核人列表数据
+          this.getUserList();
+          // 获取规则名称
+          this._getRuleNameList();
+        }
       }
     },
-    ruleChange(item) {
-      this.ruleObj.name = item.name;
-      this.ruleObj.code = item.code;
+    created() {
+      console.log('触发');
+      this.init({ id: this.planId });
     },
-    save() {
-      console.log(this.addForm, 888);
-      console.log(this.ruleIdList);
-      if (this.ruleIdList && this.ruleIdList.length > 0) {
-        this.$refs.addFormRef.validate(async (valid) => {
-          console.log(valid);
-          if (valid) {
-            const planDeviceList = this.ruleIdList.map((ruleItem) => {
-              return ruleItem.equipmentList.map((item) => {
+    methods: {
+      // 初始化
+      async init(row, tips = '') {
+        console.log(row);
+        console.log(tips);
+        this.visible = true;
+        if (row) {
+          this.getInfo(row.id, tips);
+        } else {
+          //  获取计划配置单号
+          this.getOrderCode(tips);
+          this.addForm = {
+            code: '', // 计划配置单号
+            name: '', // 计划配置名称
+            autoOrder: 1, // 自动派单
+            ruleId: '', // 规则id
+            ruleName: '', // 规则名称
+            duration: null, // 计划完成时长
+            categoryId: '', // 设备类别id
+            approvalUserId: '', // 审核人id
+            groupId: '', // 巡点检部门code
+            executorId: [], // 巡点检人员id
+            executorPhone: '',
+            status: 1, // 状态
+            remark: '', // 备注
+            urgent: '1'
+          };
+          this.ruleIdList = [];
+          this.isBindPlan = false;
+          this.planRuleEquiList = [];
+          //   this.matterRulesList = [];
+        }
+        this.formLabel = this.dialogTitle.includes('巡点检')
+          ? '巡点检'
+          : this.dialogTitle.includes('保养')
+          ? '保养'
+          : this.dialogTitle.includes('量具送检')
+          ? '量具送检'
+          : this.dialogTitle.includes('运行记录')
+          ? '运行记录'
+          : '盘点';
+        const typeOptions = {
+          巡点检: 1,
+          保养: 2,
+          维修: 3,
+          计划性维修: 4,
+          量具送检: 5,
+          运行记录: 6
+        };
+        this.$set(this.addForm, 'type', typeOptions[this.formLabel]);
+
+        // const planRuleTypeObj = {
+        //   巡点检: 'PATROL',
+        //   保养: 'MAINTAIN',
+        //   量具送检: '',
+        //   盘点: 'INVENTORY'
+        // };
+        // this.addForm.planType = planRuleTypeObj[this.formLabel];
+      },
+      autoOrderChange(val) {
+        if (val == 0) {
+          this.addForm.executorId = '';
+          this.addForm.groupId = '';
+        }
+      },
+      ruleChange(item) {
+        this.ruleObj.name = item.name;
+        this.ruleObj.code = item.code;
+      },
+      save() {
+        console.log(this.addForm, 888);
+        console.log(this.ruleIdList);
+        if (this.ruleIdList && this.ruleIdList.length > 0) {
+          this.$refs.addFormRef.validate(async (valid) => {
+            console.log(valid);
+            if (valid) {
+              this.loading = true;
+              const planDeviceList = this.ruleIdList.map((ruleItem) => {
+                return ruleItem.equipmentList.map((item) => {
+                  return {
+                    // equiCode: item.code,
+                    // equiName: item.name,
+                    deviceId: item.id,
+                    codeNumber: item.codeNumber,
+                    // equiModel: item.modelType,
+                    equiLocation: item.position[0] && item.position[0].pathName,
+                    equiLocationCode:
+                      item.position[0] && item.position[0].pathIds,
+                    workItems: ruleItem.ruleItems ? ruleItem.ruleItems : []
+                    // categoryId: item.category.categoryLevelId,
+                    // categoryName: item.category.categoryLevelName
+                    // sparePart: ruleItem.sparePart ? obj.sparePart : []
+                  };
+                });
+              });
+              let boolen = planDeviceList.every((item) => item.length > 0);
+              console.log(planDeviceList);
+              if (!boolen) {
+                this.$message.error('请添加设备!');
+                return false;
+              }
+              let sendMsg = this.ruleIdList.map((item, index) => {
                 return {
-                  // equiCode: item.code,
-                  // equiName: item.name,
-                  deviceId: item.id,
-                  codeNumber: item.codeNumber,
-                  // equiModel: item.modelType,
-                  equiLocation: item.position[0] && item.position[0].pathName,
-                  equiLocationCode:
-                    item.position[0] && item.position[0].pathIds,
-                  workItems: ruleItem.ruleItems ? ruleItem.ruleItems : []
-                  // categoryId: item.category.categoryLevelId,
-                  // categoryName: item.category.categoryLevelName
-                  // sparePart: ruleItem.sparePart ? obj.sparePart : []
+                  ...this.addForm,
+                  ruleId: item.ruleId,
+                  categoryId: item.categoryId,
+                  planDeviceList: planDeviceList[index],
+                  executorId: this.addForm.executorId
+                    ? this.addForm.executorId.join(',')
+                    : ''
                 };
               });
-            });
-            let boolen = planDeviceList.every((item) => item.length > 0);
-            console.log(planDeviceList);
-            if (!boolen) {
-              this.$message.error('请添加设备!');
-              return false;
-            }
-            let sendMsg = this.ruleIdList.map((item, index) => {
-              return {
-                ...this.addForm,
-                ruleId: item.ruleId,
-                categoryId: item.categoryId,
-                planDeviceList: planDeviceList[index],
-                executorId: this.addForm.executorId
-                  ? this.addForm.executorId.join(',')
-                  : ''
-              };
-            });
-            let type = '';
-            if (this.dialogTitle === '派单') {
-              type = '派单';
-            } else {
-              type = this.dialogTitle.includes('新增') ? '新增' : '编辑';
-            }
-            // return
-            try {
-              let res = await saveOrUpdate(sendMsg);
-              if (res) {
-                this.$message.success(type + '成功!');
-                this.$emit('done');
-                this.visible = false;
+              let type = '';
+              if (this.dialogTitle === '派单') {
+                type = '派单';
+              } else {
+                type = this.dialogTitle.includes('新增') ? '新增' : '编辑';
+              }
+              // return
+              try {
+                let res = await saveOrUpdate(sendMsg);
+                if (res) {
+                  this.$message.success(type + '成功!');
+                  this.$emit('done');
+                  this.loading = false;
+                  this.visible = false;
+                }
+              } catch (error) {
+                this.$message.error(type + '失败!');
+                this.loading = false;
               }
-            } catch (error) {
-              this.$message.error(type + '失败!');
             }
-          }
-        });
-      } else {
-        this.$message.error('请添加规则!');
-      }
-    },
-    // 保存操作指导数据
-    saveEdit(data, index) {
-      console.log(this.matterRulesList);
-      console.log(data);
-      console.log(index);
-      this.$set(
-        this.ruleIdList[this.ruleIndex].ruleItems[index],
-        'operationGuide',
-        data
-      );
-    },
-    /* 打开操作手册编辑款 */
-    openOperationGuideDialogDialog(row, index) {
-      if (this.dialogTitle !== '派单') {
-        this.$refs.operationGuideDialog.open(row, index);
-      }
-    },
-    deleteEquipment(index) {
-      this.ruleIdList[this.ruleIndex].equipmentList.splice(index, 1);
-    },
-    deleteItem(index) {
-      if (this.ruleIdList[this.ruleIndex].ruleItems.length > 1) {
-        this.ruleIdList[this.ruleIndex].ruleItems.splice(index, 1);
-      } else {
-        this.$message.error('至少要有一个规则事项!');
-      }
-    },
-    addPostscript() {
-      console.log(
-        'this.matterRulesList---------------',
-        this.matterRulesList
-      );
-      this.ruleIdList[this.ruleIndex].ruleItems.push({
-        sort: null,
-        name: '',
-        content: '',
-        norm: '',
-        isNew: true,
-        operationGuide: {
-          procedureList: [],
-          toolList: []
+          });
+        } else {
+          this.$message.error('请添加规则!');
         }
-      });
-    },
-    async getInfo(id, tips) {
-      console.log(id);
-      try {
-        const res = await getById(id);
-        console.log('res----------', res);
-        this.addForm = res.data;
-        this.addForm.id = res.data.planId;
-        if (this.dialogTitle === '派单') {
-          this.addForm.autoOrder = 1;
+      },
+      // 保存操作指导数据
+      saveEdit(data, index) {
+        console.log(this.matterRulesList);
+        console.log(data);
+        console.log(index);
+        this.$set(
+          this.ruleIdList[this.ruleIndex].ruleItems[index],
+          'operationGuide',
+          data
+        );
+      },
+      /* 打开操作手册编辑款 */
+      openOperationGuideDialogDialog(row, index) {
+        if (this.dialogTitle !== '派单') {
+          this.$refs.operationGuideDialog.open(row, index);
         }
-        this.isBindPlan = res.isBindPlan;
-        // this.categoryEquipment(res.categoryLevelId);
-        this.ruleIdList = [
-          {
-            id: res.data.id,
-            ruleId: res.data.ruleId,
-            name: res.data.name,
-            code: res.data.code,
-            categoryId: res.data.categoryId,
-            equipmentList: res.data.planDeviceList.map((item) => {
-              return {
-                name: item.substance.name,
-                position: item.substance.position,
-                id: item.substance.id,
-                fixCode: item.substance.fixCode,
-                codeNumber: item.substance.codeNumber
-                // category: {
-                //   categoryLevelId: item.categoryId,
-                //   categoryLevelName: item.categoryName
-                // }
-              };
-            }),
-            ruleItems: res.data.planDeviceList[0].workItems
+      },
+      deleteEquipment(index) {
+        this.ruleIdList[this.ruleIndex].equipmentList.splice(index, 1);
+      },
+      deleteItem(index) {
+        if (this.ruleIdList[this.ruleIndex].ruleItems.length > 1) {
+          this.ruleIdList[this.ruleIndex].ruleItems.splice(index, 1);
+        } else {
+          this.$message.error('至少要有一个规则事项!');
+        }
+      },
+      addPostscript() {
+        console.log(
+          'this.matterRulesList---------------',
+          this.matterRulesList
+        );
+        this.ruleIdList[this.ruleIndex].ruleItems.push({
+          sort: null,
+          name: '',
+          content: '',
+          norm: '',
+          isNew: true,
+          operationGuide: {
+            procedureList: [],
+            toolList: []
           }
-        ];
-        console.log(this.ruleIdList);
-        this.tabsValue = this.ruleIdList[0].ruleId;
-
-        // this._getMatterRulesDetails(res.ruleId);
-        this.$set(this.addForm, 'code', res.data.code);
-        this.$set(this.addForm, 'urgent', JSON.stringify(res.data.urgent));
-        this.$set(this.addForm, 'executorId', res.data.executorId.split(','));
-        this.$set(this.addForm, 'imageUrl', {});
-        console.log(this.rootData);
-        if(res.data.groupId){
-        this.getUserList({ groupId: res.data.groupId });
+        });
+      },
+      async getInfo(id, tips) {
+        console.log(id);
+        try {
+          const res = await getById(id);
+          console.log('res----------', res);
+          this.addForm = res.data;
+          this.addForm.id = res.data.planId;
+          if (this.dialogTitle === '派单') {
+            this.addForm.autoOrder = 1;
+          }
+          this.isBindPlan = res.isBindPlan;
+          // this.categoryEquipment(res.categoryLevelId);
+          this.ruleIdList = [
+            {
+              id: res.data.id,
+              ruleId: res.data.ruleId,
+              name: res.data.name,
+              code: res.data.code,
+              categoryId: res.data.categoryId,
+              equipmentList: res.data.planDeviceList.map((item) => {
+                return {
+                  name: item.substance.name,
+                  position: item.substance.position,
+                  id: item.substance.id,
+                  fixCode: item.substance.fixCode,
+                  codeNumber: item.substance.codeNumber
+                  // category: {
+                  //   categoryLevelId: item.categoryId,
+                  //   categoryLevelName: item.categoryName
+                  // }
+                };
+              }),
+              ruleItems: res.data.planDeviceList[0].workItems
+            }
+          ];
+          console.log(this.ruleIdList);
+          this.tabsValue = this.ruleIdList[0].ruleId;
 
+          // this._getMatterRulesDetails(res.ruleId);
+          this.$set(this.addForm, 'code', res.data.code);
+          this.$set(this.addForm, 'urgent', JSON.stringify(res.data.urgent));
+          this.$set(this.addForm, 'executorId', res.data.executorId.split(','));
+          this.$set(this.addForm, 'imageUrl', {});
+          console.log(this.rootData);
+          if (res.data.groupId) {
+            this.getUserList({ groupId: res.data.groupId });
+          }
+          // const rep = await getTreeByType(0);
+          // console.log('sasas', res);
+          // const ids = this.findTopLevelAncestorId(
+          //   rep.data,
+          //   res.categoryLevelId
+          // );
+          // this.rootId = ids;
+          // //   await this._getEquipmentList(res.categoryLevelId, this.isBindPlan);
+          // let keys = [];
+          // res.deviceInfo.map((item) => {
+          //   keys.push(item.substanceId);
+          // });
+          // this.$nextTick(() => {
+          //   this.$refs.equiListTree.setCheckedKeys(keys);
+          // });
+          // this.clickedTreeNode = true;
+        } catch (error) {
+          console.log(error);
         }
-        // const rep = await getTreeByType(0);
-        // console.log('sasas', res);
-        // const ids = this.findTopLevelAncestorId(
-        //   rep.data,
-        //   res.categoryLevelId
-        // );
-        // this.rootId = ids;
-        // //   await this._getEquipmentList(res.categoryLevelId, this.isBindPlan);
-        // let keys = [];
-        // res.deviceInfo.map((item) => {
-        //   keys.push(item.substanceId);
-        // });
-        // this.$nextTick(() => {
-        //   this.$refs.equiListTree.setCheckedKeys(keys);
-        // });
-        // this.clickedTreeNode = true;
-      } catch (error) {
-        console.log(error);
-      }
-    },
-    // 获取设备分类数据
-    async categoryEquipment(id) {
-      const params = { categoryLevelId: id, pageNum: 1, size: -1 };
-      console.log('params==', params);
-      const data = await getCategory(params);
-      console.log(data);
-      this.equipmentList = data.list;
-    },
-    // 选择设备
-    chooseEquipment(data, index, categoryId) {
-      this.$set(
-        this.ruleIdList[index],
-        'equipmentList',
-        this.ruleIdList[index].equipmentList.concat(data)
-      );
-      this.$set(this.ruleIdList[index], 'categoryId', categoryId);
-      console.log(this.ruleIdList);
-    },
-    // 获取计划配置单号
-    async getOrderCode(tips) {
-      if (tips.includes('巡点检')) {
-        const data = await getCode('patrolconfig_code');
-        this.$set(this.addForm, 'code', data);
-      }
-      if (tips.includes('保养')) {
-        const code = await getCode('maintainconfig_code');
-        this.$set(this.addForm, 'code', code);
-      }
-      if (tips.includes('量具送检')) {
-        const code = await getCode('quantity_code');
-        this.$set(this.addForm, 'code', code);
-      }
-      if (tips.includes('运行记录')) {
-        const code = await getCode('runRecord_code');
-        this.$set(this.addForm, 'code', code);
-      }
-    },
-    //选择部门(搜索)
-    searchDeptNodeClick(info, data) {
-      if (info) {
-        // 根据部门获取人员
-        this.addForm.groupName = data.name;
-        const params = { groupId: info };
-        this.getUserList(params);
-      } else {
-        this.addForm.groupId = null;
-      }
-    },
-    // 过滤计划完成时长
-    formDataDurationTime(value) {
-      if (value > 0) {
-        this.addForm.duration = value.replace(/^[0]+/, '');
-      } else {
-        this.addForm.duration = 0;
-      }
-    },
-    // 获取审核人列表、巡点检人员
-    async getUserList(params) {
-      try {
-        let data = { pageNum: 1, size: -1 };
-        // 如果传了参数就是获取巡点检人员数据
-        if (params) {
-          data = Object.assign(data, params);
+      },
+      // 获取设备分类数据
+      async categoryEquipment(id) {
+        const params = { categoryLevelId: id, pageNum: 1, size: -1 };
+        console.log('params==', params);
+        const data = await getCategory(params);
+        console.log(data);
+        this.equipmentList = data.list;
+      },
+      // 选择设备
+      chooseEquipment(data, index, categoryId) {
+        this.$set(
+          this.ruleIdList[index],
+          'equipmentList',
+          this.ruleIdList[index].equipmentList.concat(data)
+        );
+        this.$set(this.ruleIdList[index], 'categoryId', categoryId);
+        console.log(this.ruleIdList);
+      },
+      // 获取计划配置单号
+      async getOrderCode(tips) {
+        if (tips.includes('巡点检')) {
+          const data = await getCode('patrolconfig_code');
+          this.$set(this.addForm, 'code', data);
         }
-        const res = await getUserPage(data);
-        console.log('res------------', res);
-        if (params) {
-          this.executorList = res.list;
+        if (tips.includes('保养')) {
+          const code = await getCode('maintainconfig_code');
+          this.$set(this.addForm, 'code', code);
+        }
+        if (tips.includes('量具送检')) {
+          const code = await getCode('quantity_code');
+          this.$set(this.addForm, 'code', code);
+        }
+        if (tips.includes('运行记录')) {
+          const code = await getCode('runRecord_code');
+          this.$set(this.addForm, 'code', code);
+        }
+      },
+      //选择部门(搜索)
+      searchDeptNodeClick(info, data) {
+        if (info) {
+          // 根据部门获取人员
+          this.addForm.groupName = data.name;
+          const params = { groupId: info };
+          this.getUserList(params);
         } else {
-          this.uerList = res.list;
+          this.addForm.groupId = null;
         }
-      } catch (error) { }
-    },
-    // 获取规则名列表
-    async _getRuleNameList() {
-      if (
-        this.dialogTitle === '新增保养计划配置' ||
-        this.dialogTitle === '编辑保养计划配置'
-      ) {
-        const res = await getRule({
-          status: 1,
-          type: 2,
-          pageNum: 1,
-          size: -1
-        });
-        if (res.list) {
-          this.ruleNameList = res.list || [];
+      },
+      // 过滤计划完成时长
+      formDataDurationTime(value) {
+        if (value > 0) {
+          this.addForm.duration = value.replace(/^[0]+/, '');
+        } else {
+          this.addForm.duration = 0;
         }
-      }
-      if (
-        this.dialogTitle === '新增巡点检计划配置' ||
-        this.dialogTitle === '编辑巡点检计划配置'
-      ) {
-        const res = await getRule({
-          status: 1,
-          type: 1,
-          pageNum: 1,
-          size: -1
-        });
-        if (res.list) {
-          this.ruleNameList = res.list || [];
+      },
+      // 获取审核人列表、巡点检人员
+      async getUserList(params) {
+        try {
+          let data = { pageNum: 1, size: -1 };
+          // 如果传了参数就是获取巡点检人员数据
+          if (params) {
+            data = Object.assign(data, params);
+          }
+          const res = await getUserPage(data);
+          console.log('res------------', res);
+          if (params) {
+            this.executorList = res.list;
+          } else {
+            this.uerList = res.list;
+          }
+        } catch (error) {}
+      },
+      // 获取规则名列表
+      async _getRuleNameList() {
+        if (
+          this.dialogTitle === '新增保养计划配置' ||
+          this.dialogTitle === '编辑保养计划配置'
+        ) {
+          const res = await getRule({
+            status: 1,
+            type: 2,
+            pageNum: 1,
+            size: -1
+          });
+          if (res.list) {
+            this.ruleNameList = res.list || [];
+          }
         }
-      }
-      if (
-        this.dialogTitle === '新增量具送检计划配置' ||
-        this.dialogTitle === '编辑量具送检计划配置'
-      ) {
-        const res = await getRule({
-          status: 1,
-          type: 5,
-          pageNum: 1,
-          size: -1
-        });
-        if (res.list) {
-          this.ruleNameList = res.list || [];
+        if (
+          this.dialogTitle === '新增巡点检计划配置' ||
+          this.dialogTitle === '编辑巡点检计划配置'
+        ) {
+          const res = await getRule({
+            status: 1,
+            type: 1,
+            pageNum: 1,
+            size: -1
+          });
+          if (res.list) {
+            this.ruleNameList = res.list || [];
+          }
         }
-      }
-      if (
-        this.dialogTitle === '新增运行记录配置' ||
-        this.dialogTitle === '编辑运行记录配置'
-      ) {
-        const res = await getRule({
-          status: 1,
-          type: 6,
-          pageNum: 1,
-          size: -1
-        });
-        if (res.list) {
-          this.ruleNameList = res.list || [];
+        if (
+          this.dialogTitle === '新增量具送检计划配置' ||
+          this.dialogTitle === '编辑量具送检计划配置'
+        ) {
+          const res = await getRule({
+            status: 1,
+            type: 5,
+            pageNum: 1,
+            size: -1
+          });
+          if (res.list) {
+            this.ruleNameList = res.list || [];
+          }
         }
-      }
-    },
-    downloadFile(file) {
-      getFile({ objectName: file.storePath }, file.name);
-    },
+        if (
+          this.dialogTitle === '新增运行记录配置' ||
+          this.dialogTitle === '编辑运行记录配置'
+        ) {
+          const res = await getRule({
+            status: 1,
+            type: 6,
+            pageNum: 1,
+            size: -1
+          });
+          if (res.list) {
+            this.ruleNameList = res.list || [];
+          }
+        }
+      },
+      downloadFile(file) {
+        getFile({ objectName: file.storePath }, file.name);
+      },
 
-    openEdit(index) {
-      this.current = this.form.bomList[index];
-      console.log(this.current);
-      this.materialShow = true;
-    },
+      openEdit(index) {
+        this.current = this.form.bomList[index];
+        console.log(this.current);
+        this.materialShow = true;
+      },
 
-    /* 表格数据源 */
-    datasource({ page, limit, where }) {
-      return [];
-    },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return [];
+      },
 
-    async getVersionList() {
-      const res = await pageList({
-        pageNum: 1,
-        size: 100
-      });
+      async getVersionList() {
+        const res = await pageList({
+          pageNum: 1,
+          size: 100
+        });
 
-      this.versionList = res.list;
-    },
+        this.versionList = res.list;
+      },
 
-    handleAdd(ruleIdList, ruleIdListIndex) {
-      this.$refs.productRefs.open(ruleIdList, ruleIdListIndex);
-    },
+      handleAdd(ruleIdList, ruleIdListIndex) {
+        this.$refs.productRefs.open(ruleIdList, ruleIdListIndex);
+      },
 
-    // /* 更新visible */
-    // updateVisible(value) {
-    //   this.$emit('update:visible', value);
-    // },
+      // /* 更新visible */
+      // updateVisible(value) {
+      //   this.$emit('update:visible', value);
+      // },
 
-    handleAddTab() {
-      this.tableData = this.tabsList;
-      this.addDialog = true;
-    },
+      handleAddTab() {
+        this.tableData = this.tabsList;
+        this.addDialog = true;
+      },
 
-    handleTab(e) {
-      this.ruleIndex = e.index;
-      // this.ruleIdList[e.index].ruleItems = this._getMatterRulesDetails(this.ruleId)
-    },
+      handleTab(e) {
+        this.ruleIndex = e.index;
+        // this.ruleIdList[e.index].ruleItems = this._getMatterRulesDetails(this.ruleId)
+      },
 
-    removeTab(targetName) {
-      this.$confirm('是否删除当前工序?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          this.ruleIdList.forEach((e, index) => {
-            if (e.ruleId == targetName) {
-              this.ruleIdList.splice(index, 1);
-              this.$nextTick(() => {
-                if (this.ruleIdList.length == 1) {
-                  this.tabsValue = this.ruleIdList[0].ruleId;
-                }
-              });
-            }
-          });
+      removeTab(targetName) {
+        this.$confirm('是否删除当前工序?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         })
-        .catch(() => { });
-    },
-
-    /*关闭选择参数*/
-    closeAdd() {
-      this.addDialog = false;
-    },
-    // 规则名称下拉触发
-    handleRuleNameChange(val) {
-      this.ruleId = val;
-      console.log('勾选的规则----', val);
-      this.getRulesDetails(val);
-    },
-    async getRulesDetails(val) {
-      const res = await getDetail(val);
-      this.hasCategoryId = res?.categoryId;
-      this.getByIdData = res;
-      console.log(res, 'sssssssssssssssssssssss')
-    },
-    // 封装 - 获取规则下面的详情数据及事项
-    async _getMatterRulesDetails(val) {
-      const res = await getDetail(val);
-      return res.ruleItems;
-    },
-    async addRule() {
+          .then(() => {
+            this.ruleIdList.forEach((e, index) => {
+              if (e.ruleId == targetName) {
+                this.ruleIdList.splice(index, 1);
+                this.$nextTick(() => {
+                  if (this.ruleIdList.length == 1) {
+                    this.tabsValue = this.ruleIdList[0].ruleId;
+                  }
+                });
+              }
+            });
+          })
+          .catch(() => {});
+      },
 
-      let boolen = this.ruleIdList.every((item) => {
-        return this.ruleId != item.ruleId;
-      });
-      if (boolen) {
-        this.ruleObj.ruleItems = await this._getMatterRulesDetails(
-          this.ruleId
-        );
+      /*关闭选择参数*/
+      closeAdd() {
+        this.addDialog = false;
+      },
+      // 规则名称下拉触发
+      handleRuleNameChange(val) {
+        this.ruleId = val;
+        console.log('勾选的规则----', val);
+        this.getRulesDetails(val);
+      },
+      async getRulesDetails(val) {
+        const res = await getDetail(val);
+        this.hasCategoryId = res?.categoryId;
+        this.getByIdData = res;
+        console.log(res, 'sssssssssssssssssssssss');
+      },
+      // 封装 - 获取规则下面的详情数据及事项
+      async _getMatterRulesDetails(val) {
+        const res = await getDetail(val);
+        return res.ruleItems;
+      },
+      async addRule() {
+        let boolen = this.ruleIdList.every((item) => {
+          return this.ruleId != item.ruleId;
+        });
+        if (boolen) {
+          this.ruleObj.ruleItems = await this._getMatterRulesDetails(
+            this.ruleId
+          );
 
-        for (let i = 0; i < this.ruleObj.ruleItems.length; i++) {
-          const id = this.getByIdData?.categoryId;
-          const name = this.getByIdData?.categoryName;
+          for (let i = 0; i < this.ruleObj.ruleItems.length; i++) {
+            const id = this.getByIdData?.categoryId;
+            const name = this.getByIdData?.categoryName;
 
-          this.ruleObj.ruleItems[i].categoryId = id;
-          this.ruleObj.ruleItems[i].categoryName = name;
+            this.ruleObj.ruleItems[i].categoryId = id;
+            this.ruleObj.ruleItems[i].categoryName = name;
 
-          this.ruleObj.ruleItems[i].isNew = true;
-        }
+            this.ruleObj.ruleItems[i].isNew = true;
+          }
 
-        this.ruleIdList.push(deepClone(this.ruleObj));
+          this.ruleIdList.push(deepClone(this.ruleObj));
 
-        console.log('this.ruleIdList--------', this.ruleIdList);
+          console.log('this.ruleIdList--------', this.ruleIdList);
 
-        this.addDialog = false;
-        this.$nextTick(() => {
-          if (this.ruleIdList.length == 1) {
-            this.tabsValue = this.ruleIdList[0].ruleId;
-          }
-        });
-      } else {
-        this.$message.error('请误重复添加规则');
+          this.addDialog = false;
+          this.$nextTick(() => {
+            if (this.ruleIdList.length == 1) {
+              this.tabsValue = this.ruleIdList[0].ruleId;
+            }
+          });
+        } else {
+          this.$message.error('请误重复添加规则');
+        }
+      },
+      onClose() {
+        console.log('关闭窗口');
+        this.visible = false;
       }
-    },
-    onClose() {
-      console.log('关闭窗口');
-      this.visible = false;
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-::v-deep .el-row {
-  display: flex;
-  flex-wrap: wrap;
-}
-
-::v-deep .el-tab_box {
-  display: flex;
-  margin-top: 10px;
-  height: 300px;
-  width: 100%;
+  ::v-deep .el-row {
+    display: flex;
+    flex-wrap: wrap;
+  }
 
-  .equipmentList_box {
-    flex: 1;
-    height: 100%;
-    margin-right: 10px;
+  ::v-deep .el-tab_box {
     display: flex;
-    flex-direction: column;
+    margin-top: 10px;
+    height: 300px;
+    width: 100%;
 
-    .divider {
-      flex: 0 0 50px;
+    .equipmentList_box {
+      flex: 1;
+      height: 100%;
+      margin-right: 10px;
+      display: flex;
+      flex-direction: column;
 
-      .title {
-        height: 35px;
+      .divider {
+        flex: 0 0 50px;
+
+        .title {
+          height: 35px;
+        }
       }
-    }
 
-    .el-table {
-      overflow: auto;
+      .el-table {
+        overflow: auto;
+      }
     }
-  }
 
-  .ruleMatters_box {
-    flex: 3;
-    height: 100%;
-    display: flex;
-    flex-direction: column;
-    overflow: hidden;
+    .ruleMatters_box {
+      flex: 3;
+      height: 100%;
+      display: flex;
+      flex-direction: column;
+      overflow: hidden;
 
-    .divider {
-      flex: 0 0 50px;
+      .divider {
+        flex: 0 0 50px;
 
-      .title {
-        height: 35px;
+        .title {
+          height: 35px;
+        }
       }
-    }
 
-    .el-table {
-      overflow: auto;
+      .el-table {
+        overflow: auto;
 
-      .operationGuide_box {
-        width: 100%;
-        height: 50px;
-        display: flex;
-        overflow: hidden;
-        cursor: pointer;
+        .operationGuide_box {
+          width: 100%;
+          height: 50px;
+          display: flex;
+          overflow: hidden;
+          cursor: pointer;
 
-        .left_content {
-          flex: 0 0 200px;
-          padding: 10px;
-          box-sizing: border-box;
-          border: 1px solid #c0c4cc;
-          border-radius: 10px;
-          margin-right: 10px;
-          overflow-y: auto;
-        }
+          .left_content {
+            flex: 0 0 200px;
+            padding: 10px;
+            box-sizing: border-box;
+            border: 1px solid #c0c4cc;
+            border-radius: 10px;
+            margin-right: 10px;
+            overflow-y: auto;
+          }
 
-        .right_content {
-          flex: 1;
-          padding: 10px;
-          box-sizing: border-box;
-          border: 1px solid #c0c4cc;
-          border-radius: 10px;
-          overflow-y: auto;
+          .right_content {
+            flex: 1;
+            padding: 10px;
+            box-sizing: border-box;
+            border: 1px solid #c0c4cc;
+            border-radius: 10px;
+            overflow-y: auto;
+          }
         }
       }
-    }
 
-    .el-table::before {
-      display: none;
+      .el-table::before {
+        display: none;
+      }
     }
   }
-}
+
+  .footer-box {
+    margin-top: 20px;
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    gap: 15px;
+  }
 </style>

+ 110 - 28
src/views/produce/components/prenatalExamination/index.vue

@@ -2,7 +2,7 @@
   <el-dialog
     title="报工"
     :visible.sync="dialogVisible"
-    width="600px"
+    width="60%"
     :before-close="handleClose"
   >
     <div>
@@ -14,25 +14,30 @@
         class="step-list"
         v-loading="loading"
       >
-        <div
-          class="step-item"
-          v-for="(item, index) in ruleRecordsList"
-          :key="item.id"
-          @click="openMaintenancePlan(item)"
+        <ele-pro-table
+          ref="table"
+          row-key="id"
+          :columns="columns"
+          :datasource="ruleRecordsList"
+          cache-key="mes-ruleRecordsList-2511172018"
+          autoAmendPage
+          :need-page="false"
+          @refresh="getData"
         >
-          <div class="circle">{{ index + 1 }}</div>
-          <div class="desc">{{
-            item.ruleName || item.itemTaskName || item.planConfigName
-          }}</div>
-          <div class="methods">{{ item.recordRulesExecuteMethodName }}</div>
+          <template v-slot:num="{ $index }">
+            <div class="circle">{{ $index + 1 }}</div>
+          </template>
 
-          <el-button
-            :type="item.executeStatus == 0 ? 'primary' : 'default'"
-            class="status-btn"
-          >
-            {{ executeStatusTest(item.executeStatus) }}
-          </el-button>
-        </div>
+          <template v-slot:action="{ row }">
+            <el-button
+              :type="row.executeStatus == 0 ? 'primary' : 'default'"
+              class="status-btn"
+              @click="openMaintenancePlan(row)"
+            >
+              {{ executeStatusTest(row.executeStatus) }}
+            </el-button>
+          </template>
+        </ele-pro-table>
       </div>
       <el-empty v-else></el-empty>
     </div>
@@ -48,7 +53,10 @@
 
     <taskDialog ref="taskDialogRef" @reload="getData" />
 
-    <PlanRulesDialog ref="planRulesDialogRef"></PlanRulesDialog>
+    <PlanRulesDialog
+      ref="planRulesDialogRef"
+      @reload="getData"
+    ></PlanRulesDialog>
   </el-dialog>
 </template>
 
@@ -60,8 +68,11 @@
   } from '@/api/producetaskrulerecord/index.js';
   import taskDialog from './taskDialog.vue';
   import PlanRulesDialog from './PlanRulesDialog.vue';
+  import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
 
   export default {
+    mixins: [dictMixins, tableColumnsMixin],
     components: {
       releaseRulesDialog,
       taskDialog,
@@ -75,7 +86,7 @@
         workOrderInfo: null,
         // 工序信息
         produceTaskInfo: null,
-        // 	报工类型,参考字典项:record_rules_report_work_type,1-产前准备,2-过程监测,3-产后检查
+        // 	报工类型,参考字典项:record_rules_report_work_type,1-产前准备,2-过程控制,3-产后检查
         reportWorkType: 1,
         butLoad: false,
         // 记录规则
@@ -83,6 +94,74 @@
         loading: true
       };
     },
+    computed: {
+      columns() {
+        return [
+          {
+            width: 50,
+            type: 'index',
+            slot: 'num',
+            align: 'center',
+            label: '序号'
+          },
+          {
+            prop: 'produceTaskName',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            formatter: (row) => {
+              return row.ruleName || row.itemTaskName || row.planConfigName;
+            }
+          },
+          {
+            prop: 'executeMethod',
+            label: '执行方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            formatter: (row) => {
+              return this.getDictValue('记录规则执行方式', row.executeMethod);
+            }
+          },
+          {
+            prop: 'reportUserName',
+            label: '报工人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'finishTime',
+            label: '报工时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'duration',
+            label: '工时',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            formatter: (row) => {
+              // 毫秒转小时
+              return row.duration
+                ? (row.duration / 1000 / 60 / 60).toFixed(2) + ' 时'
+                : '';
+            }
+          },
+          // 操作
+          {
+            label: '操作',
+            align: 'center',
+            width: 130,
+            fixed: 'right',
+            slot: 'action'
+          }
+        ];
+      }
+    },
     methods: {
       open(workOrderInfo, produceTaskInfo, reportWorkType) {
         console.log('workOrderInfo 工单信息', workOrderInfo);
@@ -180,14 +259,7 @@
     display: flex;
     flex-direction: column;
     gap: 24px;
-    padding: 24px;
-  }
-
-  .step-item {
-    display: flex;
-    flex-flow: row wrap;
-    align-items: center;
-    gap: 32px;
+    // padding: 24px;
 
     .circle {
       width: 28px;
@@ -222,6 +294,8 @@
       width: 100px;
       height: 40px;
       font-size: 16px;
+      margin: 5px 0;
+
       &.el-button--default {
         background: #e1e1e1;
         color: #999;
@@ -234,4 +308,12 @@
       }
     }
   }
+
+  .step-item {
+    display: flex;
+    flex-flow: row wrap;
+    align-items: center;
+    gap: 32px;
+    justify-content: space-around;
+  }
 </style>

+ 39 - 34
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -340,10 +340,10 @@
               @change="checkUsersIdsChange(row)"
             >
               <el-option
-                v-for="item in activeTeamUserList"
-                :label="item.name"
-                :value="item.id"
-                :key="item.id"
+                v-for="item in addForm.executeUsers"
+                :label="item.userName"
+                :value="item.userId"
+                :key="item.userId"
               >
               </el-option>
             </el-select>
@@ -864,6 +864,7 @@
               (item) => item.id == this.addForm.teamId
             );
             this.teamUserList = this.teamAllList[index];
+            console.log('this.teamUserList', this.teamUserList);
           }
 
           if (this.addForm.outputType == null) {
@@ -1204,14 +1205,13 @@
         row.toolNames = '';
       },
       checkTeamList(id) {
-        this.addForm.executeUsersIds = [];
         const index = this.teamList.findIndex((item) => item.id == id);
         this.teamUserList = this.teamAllList[index];
         console.log('this.teamUserList', this.teamUserList);
       },
 
       async getTeamList(id) {
-        if(!id) return;
+        if (!id) return;
         const ids = id.split(',');
         this.teamList = [];
         this.teamUserList = [];
@@ -1235,25 +1235,35 @@
           this.checked = false;
         }
 
-        // 同步 executeUsers
-        this.addForm.executeUsers = this.addForm.executeUsersIds
-          .map((id) => {
-            const user = this.teamUserList.find((item) => item.id === id);
-            console.log('user', user);
-            if (user) {
-              return {
-                teamId: this.addForm.teamId,
-                teamName: this.teamList.find(
-                  (team) => team.id == this.addForm.teamId
-                )?.name,
-                userId: user.id,
-                userName: user.name
-              };
-            } else {
-              return null;
-            }
-          })
-          .filter((item) => item !== null);
+        const deleteUserIds = this.addForm.executeUsers
+          .map((i) => i.userId)
+          .filter((id) => !this.addForm.executeUsersIds.includes(id));
+
+        const addUserIds = this.addForm.executeUsersIds.filter(
+          (id) => !this.addForm.executeUsers.map((i) => i.userId).includes(id)
+        );
+
+        // 删除 用户
+        if (deleteUserIds.length > 0) {
+          this.addForm.executeUsers = this.addForm.executeUsers.filter(
+            (item) => !deleteUserIds.includes(item.userId)
+          );
+        }
+
+        // 添加 用户
+        addUserIds.forEach((id) => {
+          const user = this.teamUserList.find((item) => item.id === id);
+          if (user) {
+            this.addForm.executeUsers.push({
+              teamId: this.addForm.teamId,
+              teamName: this.teamList.find(
+                (team) => team.id == this.addForm.teamId
+              )?.name,
+              userId: user.id,
+              userName: user.name
+            });
+          }
+        });
 
         console.log('this.addForm.executeUsers', this.addForm.executeUsers);
 
@@ -1302,15 +1312,10 @@
       checkUsersIdsChange(row) {
         // 同步 checkUsers
         row.checkUsers = row.checkUsersIds.map((i) => {
-          const user = this.activeTeamUserList.find((item) => item.id === i);
-          return {
-            teamId: this.addForm.teamId,
-            teamName: this.teamList.find(
-              (team) => team.id == this.addForm.teamId
-            )?.name,
-            userId: user.id,
-            userName: user.name
-          };
+          const user = this.formDate.executeUsers.find(
+            (item) => item.userId === i
+          );
+          return user;
         });
 
         console.log('row', row);

+ 357 - 22
src/views/produce/components/prenatalExamination/taskDialog.vue

@@ -52,6 +52,97 @@
           </el-form-item>
         </el-col>
       </el-row>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="检查开始时间" required prop="checkStartTime">
+            <el-date-picker
+              v-model="addForm.checkStartTime"
+              type="datetime"
+              format="yyyy-MM-dd HH:mm:ss"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              placeholder="选择日期"
+              style="width: 100%"
+              :picker-options="{
+                disabledDate: (time) => time.getTime() > Date.now()
+              }"
+              @change="computedDuration"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="检查结束时间" required prop="checkFinishTime">
+            <el-date-picker
+              v-model="addForm.checkFinishTime"
+              type="datetime"
+              format="yyyy-MM-dd HH:mm:ss"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              placeholder="选择日期"
+              style="width: 100%"
+              :picker-options="{
+                disabledDate: (time) => time.getTime() > Date.now()
+              }"
+              @change="computedDuration"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="执行人">
+            <el-select
+              v-model="addForm.teamId"
+              placeholder="请选择班组"
+              filterable
+              style="width: 120px"
+              @change="checkTeamList(addForm.teamId)"
+            >
+              <el-option
+                v-for="item in teamList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+            <el-select
+              v-model="addForm.executeUsersIds"
+              placeholder="请选择执行人"
+              filterable
+              multiple
+              @change="changeId"
+            >
+              <div class="checkboxWrapper">
+                <el-checkbox v-model="checked" @change="checkChange">
+                  全选
+                </el-checkbox>
+              </div>
+              <el-option
+                v-for="item in teamUserList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="工时">
+            <el-input
+              placeholder="请输入"
+              v-model="addForm.duration"
+              type="number"
+              min="0"
+              step="0.1"
+              @change="durationChagne"
+            >
+              <template slot="append">
+                <div style="width: 40px; box-sizing: border-box">小时</div>
+              </template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
 
     <!-- 底部按钮 -->
@@ -79,6 +170,8 @@
   import DictSelection from '@/components/Dict/DictSelection.vue';
   import SelectUser from '@/components/select/SelectUser/index.vue';
   import { saveRuleRecord } from '@/api/producetaskrulerecord/index.js';
+  import { getTeam } from '@/api/produce/job.js';
+  import { getById } from '@/api/producetaskrecordrulesrecord/index';
 
   export default {
     components: { SelectUser },
@@ -122,7 +215,13 @@
         specification: '',
         workOrderCode: '',
         workOrderId: 0,
-        itemTaskName: ''
+        itemTaskName: '',
+        teamId: null,
+        checkStartTime: '',
+        checkFinishTime: '',
+        duration: null,
+        executeUsers: [],
+        executeUsersIds: []
       };
 
       return {
@@ -153,6 +252,51 @@
               message: '请选择检查有效期单位',
               trigger: 'change'
             }
+          ],
+          checkStartTime: [
+            { required: true, message: '请选择检查开始时间', trigger: 'blur' },
+            {
+              required: true,
+              message: '请选择检查开始时间',
+              trigger: 'change'
+            },
+            {
+              validator: (rule, value, callback) => {
+                if (!value) return callback();
+                const start = new Date(value).getTime();
+                const now = Date.now();
+                if (start > now) {
+                  callback(new Error('开始时间不能超过当前时间'));
+                } else {
+                  callback();
+                }
+              },
+              trigger: 'blur'
+            }
+          ],
+          checkFinishTime: [
+            { required: true, message: '请选择检查完成时间', trigger: 'blur' },
+            {
+              required: true,
+              message: '请选择检查完成时间',
+              trigger: 'change'
+            },
+            {
+              validator: (rule, value, callback) => {
+                if (!value) return callback();
+                const start = new Date(this.addForm.checkStartTime).getTime();
+                const finish = new Date(value).getTime();
+                const now = Date.now();
+                if (finish <= start) {
+                  callback(new Error('结束时间必须大于开始时间'));
+                } else if (finish > now) {
+                  callback(new Error('结束时间不能超过当前时间'));
+                } else {
+                  callback();
+                }
+              },
+              trigger: 'blur'
+            }
           ]
         },
         productionInfo: null,
@@ -167,10 +311,23 @@
         loading: false,
         title: '任务确认',
         // 编辑 或者是  详情 edit detila
-        type: 'edit'
+        type: 'edit',
+        checked: false,
+        teamUserList: [],
+        teamList: [],
+        teamAllList: [],
+        checked: false
       };
     },
     computed: {},
+    mounted() {
+      if (localStorage.getItem('singleUserInfo') == '1') {
+        const data = JSON.parse(localStorage.getItem('chooseUserInfo'));
+        this.getTeamList(data.teamId);
+      } else {
+        this.getTeamList(this.$store.state.user.info.teamId);
+      }
+    },
     methods: {
       openView(productionInfo, workOrderInfo) {
         this.type = 'detail';
@@ -186,25 +343,31 @@
         this.productionInfo = productionInfo;
         this.workOrderInfo = workOrderInfo;
 
-        this.addForm.batchNo = workOrderInfo.batchNo;
-        this.addForm.executeMethod = productionInfo.executeMethod;
-        this.addForm.formingNum = workOrderInfo.formingNum;
-        this.addForm.itemType = productionInfo.itemType;
-        this.addForm.produceRoutingId = workOrderInfo.produceRoutingId;
-        this.addForm.produceRoutingName = workOrderInfo.produceRoutingName;
-        this.addForm.produceTaskConfigId = productionInfo.produceTaskConfigId;
-        this.addForm.produceTaskId = productionInfo.produceTaskId;
-        this.addForm.produceTaskName = productionInfo.produceTaskName;
-        this.addForm.productCode = workOrderInfo.productCode;
-        this.addForm.productModel = workOrderInfo.model;
-        this.addForm.productName = workOrderInfo.productName;
-        this.addForm.reportWorkType = productionInfo.reportWorkType;
-        this.addForm.specification = workOrderInfo.specification;
-        this.addForm.workOrderCode = workOrderInfo.code;
-        this.addForm.workOrderId = workOrderInfo.id;
-        this.addForm.itemTaskName = productionInfo.itemTaskName;
-        this.addForm.ruleId = productionInfo.ruleId;
-        this.addForm.brandNo = productionInfo.brandNo;
+        // 存在缓存记录
+        if (this.productionInfo.recordId != null) {
+          // 查询详情
+          this.getCacheInfo();
+        } else {
+          this.addForm.batchNo = workOrderInfo.batchNo;
+          this.addForm.executeMethod = productionInfo.executeMethod;
+          this.addForm.formingNum = workOrderInfo.formingNum;
+          this.addForm.itemType = productionInfo.itemType;
+          this.addForm.produceRoutingId = workOrderInfo.produceRoutingId;
+          this.addForm.produceRoutingName = workOrderInfo.produceRoutingName;
+          this.addForm.produceTaskConfigId = productionInfo.produceTaskConfigId;
+          this.addForm.produceTaskId = productionInfo.produceTaskId;
+          this.addForm.produceTaskName = productionInfo.produceTaskName;
+          this.addForm.productCode = workOrderInfo.productCode;
+          this.addForm.productModel = workOrderInfo.model;
+          this.addForm.productName = workOrderInfo.productName;
+          this.addForm.reportWorkType = productionInfo.reportWorkType;
+          this.addForm.specification = workOrderInfo.specification;
+          this.addForm.workOrderCode = workOrderInfo.code;
+          this.addForm.workOrderId = workOrderInfo.id;
+          this.addForm.itemTaskName = productionInfo.itemTaskName;
+          this.addForm.ruleId = productionInfo.ruleId;
+          this.addForm.brandNo = productionInfo.brandNo;
+        }
 
         console.log('this.productionInfo', this.productionInfo);
         console.log('this.addForm', this.addForm);
@@ -231,7 +394,13 @@
           // 提交
           this.butLoading = true;
           try {
-            await saveRuleRecord(this.addForm);
+            const body = JSON.parse(JSON.stringify(this.addForm));
+
+            // 工时小时转毫秒
+            body.duration = Number(body.duration);
+            body.duration = body.duration * 60 * 60 * 1000;
+
+            await saveRuleRecord(body);
             this.$message.success('报工成功!');
 
             this.butLoading = false;
@@ -244,6 +413,152 @@
             this.butLoading = false;
           }
         });
+      },
+      durationChagne() {
+        // 保留小数后一位
+        if (
+          this.addForm.duration &&
+          this.addForm.duration.toString().includes('.')
+        ) {
+          this.addForm.duration = Number(this.addForm.duration).toFixed(1);
+        }
+      },
+      async getTeamList(id) {
+        if (!id) return;
+        const ids = id.split(',');
+        this.teamList = [];
+        this.teamUserList = [];
+        const list = ids.map((item) => getTeam(item));
+
+        const dataList = await Promise.all(list);
+
+        dataList.forEach((item) => {
+          this.teamList.push({
+            name: item.name,
+            id: item.id
+          });
+
+          this.teamAllList.push(item.userVOList);
+        });
+      },
+      checkTeamList(id) {
+        const index = this.teamList.findIndex((item) => item.id == id);
+        this.teamUserList = this.teamAllList[index];
+        console.log('this.teamUserList', this.teamUserList);
+      },
+      changeId() {
+        if (this.addForm.executeUsersIds.length == this.teamUserList.length) {
+          this.checked = true;
+        } else {
+          this.checked = false;
+        }
+
+        const deleteUserIds = this.addForm.executeUsers
+          .map((i) => i.userId)
+          .filter((id) => !this.addForm.executeUsersIds.includes(id));
+
+        const addUserIds = this.addForm.executeUsersIds.filter(
+          (id) => !this.addForm.executeUsers.map((i) => i.userId).includes(id)
+        );
+
+        // 删除 用户
+        if (deleteUserIds.length > 0) {
+          this.addForm.executeUsers = this.addForm.executeUsers.filter(
+            (item) => !deleteUserIds.includes(item.userId)
+          );
+        }
+
+        // 添加 用户
+        addUserIds.forEach((id) => {
+          const user = this.teamUserList.find((item) => item.id === id);
+          if (user) {
+            this.addForm.executeUsers.push({
+              teamId: this.addForm.teamId,
+              teamName: this.teamList.find(
+                (team) => team.id == this.addForm.teamId
+              )?.name,
+              userId: user.id,
+              userName: user.name
+            });
+          }
+        });
+
+        console.log('this.addForm.executeUsers', this.addForm.executeUsers);
+
+        this.computedDuration();
+
+        // 同步详情执行人
+        this.addForm.details.forEach((detail) => {
+          detail.checkUsersIds = this.addForm.executeUsersIds;
+          detail.checkUsers = this.addForm.executeUsers;
+        });
+      },
+      // 计算工时
+      computedDuration() {
+        if (
+          this.addForm.checkStartTime &&
+          this.addForm.checkFinishTime &&
+          this.addForm.executeUsersIds.length > 0
+        ) {
+          const start = new Date(this.addForm.checkStartTime);
+          const finish = new Date(this.addForm.checkFinishTime);
+          const diff = finish - start; // 毫秒差值
+          const hours = diff / (1000 * 60 * 60); // 转换为小时
+          const totalDuration = hours * this.addForm.executeUsersIds.length;
+          this.addForm.duration = totalDuration.toFixed(1);
+        }
+      },
+      checkChange() {
+        this.addForm.executeUsersIds = [];
+        if (this.checked) {
+          this.addForm.executeUsersIds = this.teamUserList.map(
+            (item) => item.id
+          );
+        } else {
+          this.addForm.executeUsersIds = [];
+        }
+      },
+      // 获取详情
+      async getCacheInfo() {
+        this.loading = true;
+        try {
+          const data = await getById(this.productionInfo.recordId);
+          console.log('dat 缓存', data);
+
+          this.$util.assignObject(this.addForm, data);
+
+          // 工时毫秒转小时
+          this.addForm.duration = (
+            this.addForm.duration /
+            (1000 * 60 * 60)
+          ).toFixed(2);
+
+          this.addForm.recordRulesClassify += '';
+
+          this.addForm.executeUsersIds = this.addForm.executeUsers.map(
+            (i) => i.userId
+          );
+
+          this.addForm.teamId =
+            this.addForm.executeUsers.length > 0
+              ? this.addForm.executeUsers[0].teamId
+              : '';
+
+          // 加载班组人员列表
+          if (this.addForm.teamId) {
+            const index = this.teamList.findIndex(
+              (item) => item.id == this.addForm.teamId
+            );
+            this.teamUserList = this.teamAllList[index];
+            console.log('this.teamUserList', this.teamUserList);
+          }
+
+          console.log('this.addForm', this.addForm);
+
+          this.loading = false;
+        } catch (error) {
+          this.loading = false;
+        }
       }
     }
   };
@@ -264,4 +579,24 @@
   .el-form-item .el-form-item {
     margin-bottom: -5px;
   }
+
+  .checkboxWrapper {
+    padding: 8px 20px;
+    border-bottom: 1px solid #ccc;
+  }
+
+  ::v-deep .el-select__tags {
+    flex-wrap: nowrap;
+    overflow: auto;
+  }
+
+  /* 输入框最大宽度*/
+  ::v-deep .el-select__tags-text {
+    max-width: 90px;
+  }
+
+  /* 底部滚动条的高度*/
+  ::v-deep .el-select__tags::-webkit-scrollbar {
+    height: 2px !important;
+  }
 </style>

+ 4 - 4
src/views/produce/index.vue

@@ -346,7 +346,7 @@
     <!-- BOM详情 -->
     <BomDetailsPop ref="bomDrawer"></BomDetailsPop>
 
-    <!-- 产前准备 、 过程监测 、产后检测 -->
+    <!-- 产前准备 、 过程控制 、产后检测 -->
     <prenatalExamination
       ref="prenatalExaminationRef"
       @close="closePrenatalExamination"
@@ -1052,7 +1052,7 @@
           }
         }
 
-        // 产前准备 过程监测 产后检查
+        // 产前准备 过程控制 产后检查
         if (
           t == 'prenatalExamination' ||
           t == 'processDetection' ||
@@ -1063,7 +1063,7 @@
               return this.$message.warning('产前准备只能选择一个工单!');
             }
             if (t == 'processDetection') {
-              return this.$message.warning('过程监测只能选择一个工单!');
+              return this.$message.warning('过程控制只能选择一个工单!');
             }
             return this.$message.warning('产后检查只能选择一个工单!');
           }
@@ -1093,7 +1093,7 @@
           this.$refs.prenatalExaminationRef.open(
             this.workData.list[0],
             this.produceTaskInfo,
-            // 	报工类型,参考字典项:record_rules_report_work_type,1-产前准备,2-过程监测,3-产后检查
+            // 	报工类型,参考字典项:record_rules_report_work_type,1-产前准备,2-过程控制,3-产后检查
             reportWorkType
           );
         }

+ 1 - 1
src/views/produceOrder/components/details/index.vue

@@ -177,7 +177,7 @@
             this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
           } else {
             this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
-            this.desIndex = 0;
+            // this.desIndex = 0;
           }
           this.activeIndex = index;
           console.log('this.curTaskObj', this.curTaskObj);

+ 1 - 1
src/views/produceOrder/components/recordRules/recordRules.vue

@@ -142,7 +142,7 @@
         reportWorkType: 1,
         reportWorkTypeOptions: [
           { label: '产前准备', value: 1 },
-          { label: '过程监测', value: 2 },
+          { label: '过程控制', value: 2 },
           { label: '产后检查', value: 3 }
         ],
         dialogTitle: ''

+ 1 - 1
vue.config.js

@@ -33,7 +33,7 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.125:18086',