Selaa lähdekoodia

产前准备功能暂存

lucw 11 kuukautta sitten
vanhempi
commit
247d24e8ad

+ 94 - 0
src/api/flowable/manage.js

@@ -0,0 +1,94 @@
+import request from '@/utils/request';
+import { Message } from 'element-ui';
+
+export function postAction(url, parameter) {
+  return request({
+    url: url,
+    method: 'post',
+    data: parameter
+  });
+}
+
+export async function listDictionaries() {
+  const res = await request.get('/system/dict/getPage', {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export function httpAction(url, parameter, method) {
+  return request({
+    url: url,
+    method: method,
+    data: parameter
+  });
+}
+
+export function putAction(url, parameter) {
+  return request({
+    url: url,
+    method: 'put',
+    data: parameter
+  });
+}
+
+export function getAction(url, parameter) {
+  return request({
+    url: url,
+    method: 'get',
+    params: parameter
+  });
+}
+
+export function downloadAction(url, method, parameter, filename) {
+  return request({
+    url: url,
+    method: method,
+    params: parameter,
+    responseType: 'blob'
+  })
+    .then((response) => {
+      const type = response.type || '';
+      if (type.includes('application/json')) {
+        let reader = new FileReader();
+        reader.onload = (e) => {
+          if (e.target.readyState === 2) {
+            let res = {};
+            res = JSON.parse(e.target.result);
+            Message.error(res.message);
+          }
+        };
+        reader.readAsText(response);
+      } else {
+        filename = decodeURI(filename);
+        if (typeof window.navigator.msSaveBlob !== 'undefined') {
+          window.navigator.msSaveBlob(response, filename);
+        } else {
+          var blobURL = window.URL.createObjectURL(response); // 将blob对象转为一个URL
+          var tempLink = document.createElement('a'); // 创建一个a标签
+          tempLink.style.display = 'none';
+          tempLink.href = blobURL;
+          tempLink.setAttribute('download', filename); // 给a标签添加下载属性
+          if (typeof tempLink.download === 'undefined') {
+            tempLink.setAttribute('target', '_blank');
+          }
+          document.body.appendChild(tempLink); // 将a标签添加到body当中
+          tempLink.click(); // 启动下载
+          document.body.removeChild(tempLink); // 下载完毕删除a标签
+          window.URL.revokeObjectURL(blobURL);
+        }
+      }
+    })
+    .catch((error) => {
+      console.log(error);
+    });
+}
+
+export function deleteAction(url, parameter) {
+  return request({
+    url: url,
+    method: 'delete',
+    params: parameter
+  });
+}

+ 25 - 0
src/api/producetaskrulerecord/index.js

@@ -0,0 +1,25 @@
+import request from '@/utils/request';
+
+// 获取记录规则 /mes/producetaskrulerecord/getLastRuleRecords
+export async function getLastRuleRecords(data) {
+  const res = await request.post(
+    '/mes/producetaskrulerecord/getLastRuleRecords',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 保存配置事项-事项规则执行记录表信息,并向EAM派单 /mes/producetaskrulerecord/saveRuleRecord
+export async function saveRuleRecord(data) {
+  const res = await request.post(
+    '/mes/producetaskrulerecord/saveRuleRecord',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 19 - 0
src/api/recordRules/index.js

@@ -0,0 +1,19 @@
+import request from '@/utils/request';
+
+// 获取记录规则详情
+export async function getRecordRulesDetail(id) {
+  const res = await request.get(`/main/recordrules/getById/` + id, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 记录规则明细表
+export async function recordRulesDetailPage(body) {
+  const res = await request.post(`/main/recordrulesdetail/page`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 2 - 2
src/components/select/organization/components/org-user-edit.vue

@@ -183,7 +183,7 @@
 <script>
   import { emailReg, phoneReg } from 'ele-admin';
   import OrgSelect from './org-select.vue';
-  import RoleSelect from '@/views/system/user/components/role-select.vue';
+  // import RoleSelect from '@/views/system/user/components/role-select.vue';
   import RegionsSelect from '@/components/RegionsSelect/index.vue';
   import { getNotBoundAccount } from '@/api/system/user';
   import {
@@ -192,7 +192,7 @@
     checkExistence
   } from '@/api/system/organization';
   export default {
-    components: { OrgSelect, RoleSelect, RegionsSelect },
+    components: { OrgSelect, RegionsSelect },
     props: {
       // 弹窗是否打开
       visible: Boolean,

+ 3 - 1
src/enum/dict.js

@@ -25,7 +25,9 @@ export default {
   退料场景: 'returnScenario',
   质检计划类型: 'inspection_plan_type',
   处置状态: 'dispose_status',
-  紧急程度: 'urgent_type'
+  紧急程度: 'urgent_type',
+  记录规则类型: 'record_sheet',
+  检查有效期单位: 'validity_unit'
 };
 export const numberList = ['date_method'];
 

+ 145 - 16
src/views/produce/components/prenatalExamination/index.vue

@@ -6,12 +6,31 @@
     :before-close="handleClose"
   >
     <div>
-      <el-button type="primary" plain round @click="openMaintenancePlan">
+      <!-- <el-button type="primary" plain round @click="openMaintenancePlan">
         设备保养计划
-      </el-button>
+      </el-button> -->
+      <div class="step-list">
+        <div
+          class="step-item"
+          v-for="(item, index) in ruleRecordsList"
+          :key="item.id"
+          @click="openMaintenancePlan(item)"
+        >
+          <div class="circle">{{ index + 1 }}</div>
+          <div class="desc">{{ item.ruleName }}</div>
+          <el-button
+            :type="item.executeStatus == 0 ? 'primary' : 'default'"
+            class="status-btn"
+          >
+            {{ executeStatusTest(item.executeStatus) }}
+          </el-button>
+        </div>
+      </div>
     </div>
     <template #footer>
-      <el-button @click="handleUpdate" type="primary">更新</el-button>
+      <el-button @click="handleUpdate" type="primary" :loading="butLoad"
+        >更新</el-button
+      >
       <el-button @click="handleConfirm" type="primary">确定</el-button>
       <el-button @click="handleClose">取消</el-button>
     </template>
@@ -19,45 +38,155 @@
     <programRulesDialog
       ref="programRulesDialogRef"
       :dialogTitle="dialogTitle"
+      @reload="getData()"
+    />
+
+    <releaseRulesDialog
+      v-model="showReleaseRulesDialog"
+      ref="releaseRulesDialogRef"
     />
   </el-dialog>
 </template>
 
 <script>
+  import releaseRulesDialog from './releaseRulesDialog.vue';
   import programRulesDialog from './programRulesDialog.vue';
+  import { getLastRuleRecords } from '@/api/producetaskrulerecord/index.js';
 
   export default {
-    components: { programRulesDialog },
+    components: { programRulesDialog, releaseRulesDialog },
     data() {
       return {
         dialogVisible: false,
-        dialogTitle: '设备保养计划'
+        dialogTitle: '设备保养计划',
+        ruleRecordsList: [],
+        // 工艺路线
+        workOrderInfo: null,
+        // 工序信息
+        produceTaskInfo: null,
+        // 参考字典项:record_rules_execute_method,1-事件驱动,2-表单填写,3-任务驱动
+        reportWorkType: 1,
+        butLoad: false,
+        // 记录规则
+        showReleaseRulesDialog: false
       };
     },
     methods: {
-      open(workListId) {
-        console.log('workListId', workListId);
+      open(workOrderInfo, produceTaskInfo, reportWorkType) {
+        console.log('workOrderInfo 工艺路线', workOrderInfo);
+        console.log('工序信息', produceTaskInfo);
+        this.workOrderInfo = workOrderInfo;
+        this.produceTaskInfo = produceTaskInfo;
+        this.reportWorkType = reportWorkType;
+
         this.dialogVisible = true;
+        this.getData(workOrderInfo.id, produceTaskInfo.id);
+      },
+      executeStatusTest(status) {
+        switch (status) {
+          case 0:
+            return '未执行';
+          case 1:
+            return '执行中';
+          default:
+            return '已执行';
+        }
+      },
+      // 获取数据
+      async getData() {
+        const body = {
+          workOrderId: this.workOrderInfo.id,
+          produceTaskId: this.produceTaskInfo.id,
+          reportWorkType: this.reportWorkType,
+          isTempRecord: 0
+        };
+        const data = await getLastRuleRecords(body);
+        this.ruleRecordsList = data;
+        console.log('报工流程 事项', this.ruleRecordsList);
       },
       handleClose() {
         this.dialogVisible = false;
       },
-      handleUpdate() {
-        // 更新逻辑
-        this.$message.success('已更新');
+      async handleUpdate() {
+        try {
+          this.butLoad = true;
+          await this.getData();
+          // 更新逻辑
+          this.$message.success('已更新');
+          this.butLoad = false;
+        } catch (error) {
+          this.butLoad = false;
+        }
       },
       handleConfirm() {
         // 确定逻辑
-        this.$message.success('已确定');
         this.dialogVisible = false;
       },
-      openMaintenancePlan() {
-        // 设备保养计划相关逻辑
-        this.dialogTitle = '新增设备保养计划';
-        this.$refs.programRulesDialogRef.init(null, '保养');
+      openMaintenancePlan(item) {
+        console.log('item', item);
+
+        if (item.executeMethod == 1) {
+          // 设备保养计划相关逻辑
+          this.dialogTitle = '新增设备保养计划';
+          this.$refs.programRulesDialogRef.init(
+            item,
+            this.workOrderInfo,
+            this.produceTaskInfo
+          );
+        } else {
+          this.$refs.releaseRulesDialogRef.open(item);
+        }
       }
     }
   };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+  .step-list {
+    display: flex;
+    flex-direction: column;
+    gap: 24px;
+    padding: 24px;
+  }
+
+  .step-item {
+    display: flex;
+    align-items: center;
+    gap: 32px;
+
+    .circle {
+      width: 28px;
+      height: 28px;
+      background: #6cb300;
+      color: #fff;
+      border-radius: 50%;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      font-size: 16px;
+      font-weight: bold;
+    }
+
+    .desc {
+      flex: 1;
+      font-size: 14px;
+      color: #333;
+    }
+
+    .status-btn {
+      width: 100px;
+      height: 40px;
+      font-size: 16px;
+      &.el-button--default {
+        background: #e1e1e1;
+        color: #999;
+        border: none;
+      }
+      &.el-button--primary {
+        background: #17a2f8;
+        color: #fff;
+        border: none;
+      }
+    }
+  }
+</style>

+ 219 - 693
src/views/produce/components/prenatalExamination/programRulesDialog.vue

@@ -5,7 +5,7 @@
     v-if="visible"
     append-to-body
     custom-class="ele-dialog-form"
-    :title="dialogTitle"
+    :title="title"
     :close-on-click-modal="false"
     :before-close="close"
     :maxable="true"
@@ -32,7 +32,6 @@
         <el-col :span="8">
           <el-form-item label="计划配置名称" prop="name">
             <el-input
-              :disabled="dialogTitle === '派单'"
               v-model="addForm.name"
               size="small"
               placeholder="请输入"
@@ -43,9 +42,6 @@
         <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%"
@@ -62,7 +58,6 @@
             <div style="display: flex">
               <el-input
                 type="number"
-                :disabled="dialogTitle === '派单'"
                 v-model="addForm.duration"
                 size="small"
                 placeholder="请输入"
@@ -74,28 +69,20 @@
           </el-form-item>
         </el-col>
 
-        <el-col
-          :span="8"
-          v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
-        >
+        <el-col :span="8">
           <el-form-item label="部门" prop="groupId">
             <deptSelect
               v-model="addForm.groupId"
               @changeGroup="searchDeptNodeClick"
-              :disabled="isBindPlan"
             />
           </el-form-item>
         </el-col>
-        <el-col
-          :span="8"
-          v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
-        >
+        <el-col :span="8">
           <el-form-item label="负责人" prop="executorId">
             <el-select
               v-model="addForm.executorId"
               size="small"
               style="width: 100%"
-              :disabled="isBindPlan"
               multiple
               filterable
             >
@@ -108,10 +95,9 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
+        <el-col :span="8">
           <el-form-item label="审核人" prop="approvalUserId">
             <el-select
-              :disabled="dialogTitle === '派单'"
               v-model="addForm.approvalUserId"
               size="small"
               clearable
@@ -133,22 +119,10 @@
               dictName="紧急程度"
               clearable
               v-model="addForm.urgent"
-              :disabled="dialogTitle === '派单'"
             >
             </DictSelection>
           </el-form-item>
         </el-col>
-        <!-- <el-col :span="8">
-          <el-form-item label="状态" prop="status">
-            <el-switch
-              v-model="addForm.status"
-              active-text="开"
-              inactive-text="关"
-              :active-value="1"
-              :inactive-value="0"
-            />
-          </el-form-item>
-        </el-col> -->
         <el-col :span="24">
           <el-form-item label="备注" prop="remark">
             <el-input
@@ -158,41 +132,17 @@
               :rows="2"
               placeholder="请详细说明"
               size="small"
-              :disabled="dialogTitle === '派单'"
             ></el-input>
           </el-form-item>
         </el-col>
       </el-row>
 
-      <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 type="card">
+        <el-tab-pane v-if="ruleInfo" :label="ruleInfo.name">
           <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
-                  >
-                </div>
-              </header-title>
-              <el-table :data="item.equipmentList" border>
+              <header-title title="设备列表"> </header-title>
+              <el-table :data="deviceList" border>
                 <el-table-column label="序号" type="index" width="50">
                 </el-table-column>
                 <el-table-column label="设备名称" align="center" prop="name">
@@ -216,25 +166,13 @@
                     </template>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  v-if="dialogTitle !== '派单'"
-                  label="操作"
-                  width="100"
-                >
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      @click="deleteEquipment(scope.$index)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
               </el-table>
             </div>
             <div class="ruleMatters_box">
               <header-title title="规则事项">
-                <div v-if="dialogTitle !== '派单'">
+                <div>
                   <el-button
+                    v-if="productionInfo.executeStatus == 0"
                     size="small"
                     icon="el-icon-plus"
                     class="ele-btn-icon"
@@ -244,7 +182,7 @@
                   >
                 </div>
               </header-title>
-              <el-table :data="item.ruleItems" border>
+              <el-table v-if="ruleInfo" :data="ruleInfo.ruleItems" border>
                 <el-table-column label="序号" width="50">
                   <template slot-scope="scope">
                     <span>{{ scope.$index + 1 }}</span>
@@ -357,13 +295,12 @@
                     </div>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  v-if="dialogTitle !== '派单'"
-                  label="操作"
-                  width="100"
-                >
+                <el-table-column label="操作" width="100">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="deleteItem(scope.$index)"
+                    <el-button
+                      v-if="productionInfo.executeStatus == 0"
+                      type="text"
+                      @click="deleteItem(scope.$index)"
                       >删除</el-button
                     >
                   </template>
@@ -376,126 +313,65 @@
     </el-form>
     <template v-slot:footer>
       <el-button @click="visible = false">取消</el-button>
-      <el-button type="primary" @click="save">
-        {{ dialogTitle === '派单' ? '派单' : '保存' }}</el-button
+      <el-button
+        type="primary"
+        @click="submit"
+        :disabled="productionInfo.executeStatus != 0"
       >
-    </template>
-    <!--  -->
-    <operation-guideDialog ref="operationGuideDialog" @save="saveEdit" />
-    <!-- 添加规则 -->
-    <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-button
       >
-        <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>
+    </template>
+
+    <OperationGuideDialog
+      ref="operationGuideDialog"
+      @save="saveEdit"
+    ></OperationGuideDialog>
   </ele-modal>
 </template>
 
 <script>
   import { getDetail, getCode } from '@/api/ruleManagement/matter';
-  import { getRule, getCategory } from '@/api/ruleManagement/plan';
   import { getUserPage } from '@/api/system/organization';
   import OperationGuideDialog from './operationGuideDialog.vue';
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
-  import { pageList } from '@/api/technology/version/version.js';
-  import { getById, saveOrUpdate } from '@/api/maintenance/patrol_maintenance';
+  import { getById } from '@/api/maintenance/patrol_maintenance';
   import { getFile } from '@/api/system/file';
-  import { deepClone } from 'ele-admin/lib/utils/core';
+  import { getAssetInfo } from '@/api/produce/device';
+  import { saveRuleRecord } from '@/api/producetaskrulerecord/index.js';
 
   export default {
     components: {
       deptSelect,
       OperationGuideDialog
     },
-    props: {
-      dialogTitle: {
-        type: String,
-        default: () => {
-          return '新增巡检点计划配置';
-        }
-      }
-      // visible: {
-      //   type: Boolean,
-      //   default: false
-      // }
-    },
+    emits: ['reload'],
+    props: {},
     data() {
-      const defaultForm = {
-        id: null,
-        code: '',
-        name: '',
-        modelType: '',
-        brandNum: '',
-        specification: '',
-        measuringUnit: '',
-
-        bomList: []
+      const formData = {
+        code: '', // 计划配置单号
+        name: '', // 计划配置名称
+        autoOrder: 1, // 自动派单
+        ruleId: '', // 规则id
+        ruleName: '', // 规则名称
+        duration: null, // 计划完成时长
+        categoryId: '', // 设备类别id
+        approvalUserId: '', // 审核人id
+        groupId: '', // 巡点检部门code
+        executorId: [], // 巡点检人员id
+        executorPhone: '',
+        status: 1, // 状态
+        remark: '', // 备注
+        urgent: '1', // 紧急程度
+        type: '',
+        groupName: '',
+        isTempRecord: 0
       };
+
       return {
         visible: false,
-        ruleIndex: 0, // 规则index
-        ruleId: '',
-        formLabel: '',
-        isBindPlan: false,
-        ruleObj: {
-          ruleId: '',
-          name: '',
-          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: [], // 规则列表
+        addForm: formData,
         uerList: [], // 审核人列表
         executorList: [], // 业务人员列表
-        defaultForm,
-        // 表单数据
-        form: {
-          ...defaultForm
-        },
-
-        versionList: [],
 
         // 表单验证规则
         addFormRules: {
@@ -528,70 +404,6 @@
           ]
         },
 
-        columns: [
-          {
-            type: 'index',
-            width: 55,
-            align: 'center'
-          },
-          {
-            label: '子项编号',
-            prop: 'subCode',
-            action: 'subCode'
-          },
-          {
-            label: '物料名称',
-            prop: 'categoryName',
-            action: 'categoryName'
-          },
-
-          {
-            label: '是否回收料',
-            prop: 'isReworkBom',
-            action: 'isReworkBom',
-            slot: 'isReworkBom',
-            width: 95
-          },
-
-          {
-            label: '物料编码',
-            prop: 'categoryCode'
-          },
-          {
-            label: '牌号',
-            prop: 'brandNum'
-          },
-          {
-            label: '型号',
-            prop: 'modelType'
-          },
-          {
-            label: '数量',
-            prop: 'count'
-          },
-          {
-            label: '计量单位',
-            prop: 'unit'
-          },
-
-          {
-            label: '附件',
-            slot: 'bomArtFiles',
-            action: 'bomArtFiles',
-            minWidth: 100
-          },
-
-          {
-            label: '单位',
-            prop: 'weightUnit'
-          },
-
-          {
-            label: '备注',
-            prop: 'remark'
-          }
-        ],
-
         statusList: [
           { label: '草稿', value: -1 },
           { label: '失效', value: 0 },
@@ -600,29 +412,28 @@
 
         // 提交状态
         loading: false,
-
-        categoryId: null,
-
-        current: null,
-
-        materialShow: false,
-
-        tabsList: [],
-        tableData: [],
-
-        taskId: null,
-
-        addDialog: false,
-        tabsValue: null,
-
-        hasCategoryId: false,
-        getByIdData: {}
+        // 规则信息
+        ruleInfo: null,
+        // 设备信息
+        deviceList: [],
+        // 事项信息
+        productionInfo: null,
+        // 工艺路线
+        workOrderInfo: null,
+        // 工序信息
+        produceTaskInfo: null
       };
     },
     computed: {
       // 是否开启响应式布局
       styleResponsive() {
         return this.$store.state.theme.styleResponsive;
+      },
+      title() {
+        if (this.ruleInfo) {
+          return `新增${this.ruleInfo.name}计划`;
+        }
+        return '';
       }
     },
     watch: {
@@ -630,8 +441,6 @@
         if (val) {
           // 获取审核人列表数据
           this.getUserList();
-          // 获取规则名称
-          this._getRuleNameList();
         }
       }
     },
@@ -640,285 +449,65 @@
         this.visible = false;
       },
       // 初始化
-      async init(row, tips) {
+      async init(row, workOrderInfo, produceTaskInfo) {
         console.log(row);
-        console.log(tips);
+        this.productionInfo = row;
+        this.workOrderInfo = workOrderInfo;
+        this.produceTaskInfo = produceTaskInfo;
         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) {
-              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 {
-                  ...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;
-                }
-              } catch (error) {
-                this.$message.error(type + '失败!');
-              }
-            }
-          });
+        if (this.productionInfo.executeStatus != 0) {
+          // 执行中 已执行 获取基本信息
+          this.getInfo();
         } else {
-          this.$message.error('请添加规则!');
+          // 获取设备信息 规则列表
+          this.getRuleInfoAndList(row);
+          this.getDeviceId(row.deviceId);
         }
       },
-      // 保存操作指导数据
-      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: []
-          }
+      // 已执行获取基本信息
+      async getInfo() {
+        const { data } = await getById(this.productionInfo.eamPlanIds[0]);
+        console.log('data 基本信息', data);
+        // 数据回显
+        this.$util.assignObject(this.addForm, data);
+        // 类型转换
+        this.addForm.urgent = this.addForm.urgent + '';
+        this.addForm.executorId = data.executorId.split(',');
+        // 获取部门用户列表
+        this.getUserList({ groupId: data.groupId });
+        this.ruleInfo = data.ruleInfo;
+        this.ruleInfo.ruleItems = data.planDeviceList[0]?.workItems || [];
+        this.deviceList = 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
+          };
         });
       },
-      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);
-
-          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);
-        }
+      // 获取规则信息 和 规则事项列表
+      async getRuleInfoAndList(row) {
+        // 事项规则
+        const data = await getDetail(row.ruleId);
+        console.log('事项规则', data);
+        this.ruleInfo = data;
+        this.addForm.ruleId = data.id;
+        this.addForm.ruleName = data.name;
+        this.addForm.type = data.ruleType;
+        // code 生成
+        this.getOrderCode(data.ruleType);
       },
-      // 获取设备分类数据
-      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);
-        }
+      // 查询设备信息
+      async getDeviceId(id) {
+        const data = await getAssetInfo(id);
+        this.deviceList = [data];
+        console.log('data -- 设备信息', data);
+        this.addForm.categoryId = data.categoryId;
       },
+
       //选择部门(搜索)
       searchDeptNodeClick(info, data) {
         if (info) {
@@ -947,7 +536,6 @@
             data = Object.assign(data, params);
           }
           const res = await getUserPage(data);
-          console.log('res------------', res);
           if (params) {
             this.executorList = res.list;
           } else {
@@ -955,186 +543,124 @@
           }
         } 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: 1,
-            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: 6,
-            pageNum: 1,
-            size: -1
-          });
-          if (res.list) {
-            this.ruleNameList = res.list || [];
-          }
+      autoOrderChange(val) {
+        if (val == 0) {
+          this.addForm.executorId = '';
+          this.addForm.groupId = '';
         }
       },
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },
-
-      openEdit(index) {
-        this.current = this.form.bomList[index];
-        console.log(this.current);
-        this.materialShow = true;
-      },
-
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
-        return [];
-      },
-
-      async getVersionList() {
-        const res = await pageList({
-          pageNum: 1,
-          size: 100
+      // 添加事项规则
+      addPostscript() {
+        this.ruleInfo.ruleItems.push({
+          sort: null,
+          name: '',
+          content: '',
+          norm: '',
+          isNew: true,
+          operationGuide: {
+            procedureList: [],
+            toolList: []
+          }
         });
-
-        this.versionList = res.list;
-      },
-
-      handleAdd(ruleIdList, ruleIdListIndex) {
-        this.$refs.productRefs.open(ruleIdList, ruleIdListIndex);
       },
-
-      // /* 更新visible */
-      // updateVisible(value) {
-      //   this.$emit('update:visible', value);
-      // },
-
-      handleAddTab() {
-        this.tableData = this.tabsList;
-        this.addDialog = true;
-      },
-
-      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;
-                  }
-                });
-              }
-            });
-          })
-          .catch(() => {});
-      },
-
-      /*关闭选择参数*/
-      closeAdd() {
-        this.addDialog = false;
+      /* 打开操作手册编辑款 */
+      openOperationGuideDialogDialog(row, index) {
+        this.$refs.operationGuideDialog.open(row, index);
       },
-      // 规则名称下拉触发
-      handleRuleNameChange(val) {
-        this.ruleId = val;
-        console.log('勾选的规则----', val);
-        this.getRulesDetails(val);
+      // 删除事项规则
+      deleteItem(index) {
+        if (this.ruleInfo.ruleItems.length > 1) {
+          this.ruleInfo.ruleItems.splice(index, 1);
+        } else {
+          this.$message.error('至少要有一个规则事项!');
+        }
       },
-      async getRulesDetails(val) {
-        const res = await getDetail(val);
-        this.hasCategoryId = res?.categoryId;
-        this.getByIdData = res;
-        console.log(res, 'sssssssssssssssssssssss');
+      // 保存操作指导数据
+      saveEdit(data, index) {
+        this.$set(this.ruleInfo.ruleItems[index], 'operationGuide', data);
       },
-      // 封装 - 获取规则下面的详情数据及事项
-      async _getMatterRulesDetails(val) {
-        const res = await getDetail(val);
-        return res.ruleItems;
+      // code生成
+      async getOrderCode(type) {
+        if (type == 1) {
+          const data = await getCode('patrolconfig_code');
+          this.addForm.code = data;
+        }
+        if (type == 2) {
+          const data = await getCode('maintainconfig_code');
+          this.addForm.code = data;
+        }
+        if (type == 5) {
+          const data = await getCode('quantity_code');
+          this.addForm.code = data;
+        }
       },
-      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;
-
-            this.ruleObj.ruleItems[i].categoryId = id;
-            this.ruleObj.ruleItems[i].categoryName = name;
-
-            this.ruleObj.ruleItems[i].isNew = true;
+      // 提交
+      submit() {
+        // 验证表单
+        this.$refs.addFormRef.validate(async (valid) => {
+          if (!valid) {
+            return;
           }
 
-          this.ruleIdList.push(deepClone(this.ruleObj));
+          // 处理数据
+          console.log('this.addForm', this.addForm);
 
-          console.log('this.ruleIdList--------', this.ruleIdList);
+          try {
+            let deviceInfo = this.deviceList[0] || {};
 
-          this.addDialog = false;
-          this.$nextTick(() => {
-            if (this.ruleIdList.length == 1) {
-              this.tabsValue = this.ruleIdList[0].ruleId;
-            }
-          });
-        } else {
-          this.$message.error('请误重复添加规则');
-        }
+            // 请求参数
+            const body = {
+              planList: [
+                {
+                  ...this.addForm,
+                  executorId: this.addForm.executorId.join(','),
+                  planDeviceList: [
+                    {
+                      deviceId: deviceInfo.id,
+                      codeNumber: deviceInfo.codeNumber,
+                      workItems: this.ruleInfo.ruleItems
+                    }
+                  ]
+                }
+              ],
+              produceRoutingId: this.workOrderInfo.produceRoutingId,
+              produceRoutingName: this.workOrderInfo.produceRoutingName,
+              produceTaskConfigId: this.productionInfo.produceTaskConfigId,
+              produceTaskId: this.productionInfo.produceTaskId,
+              reportWorkType: this.productionInfo.reportWorkType,
+              ruleId: this.productionInfo.ruleId,
+              workOrderCode: this.workOrderInfo.code,
+              workOrderId: this.workOrderInfo.id,
+              batchNo: this.workOrderInfo.batchNo,
+              executeMethod: this.productionInfo.executeMethod,
+              formingNum: this.workOrderInfo.formingNum,
+              productCode: this.workOrderInfo.productCode,
+              productModel: this.workOrderInfo.productModel,
+              productName: this.workOrderInfo.productName,
+              specification: this.workOrderInfo.specification,
+              isTempRecord: 0,
+              itemType: this.productionInfo.itemType
+            };
+
+            console.log('body', body);
+
+            await saveRuleRecord(body);
+            this.$message.success('派单成功!');
+            this.resetFormDate();
+            this.visible = false;
+            this.$emit('reload');
+          } catch (error) {
+            this.$message.error('派单失败!');
+          }
+        });
       },
-      onClose() {
-        console.log('关闭窗口');
-        this.visible = false;
+      // 重置表单
+      resetFormDate() {
+        this.$refs.addFormRef.resetFields();
+        this.addForm = formData;
       }
     }
   };

+ 334 - 0
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -0,0 +1,334 @@
+<template>
+  <ele-modal
+    width="80%"
+    :visible="visible"
+    append-to-body
+    custom-class="ele-dialog-form"
+    :title="title"
+    :close-on-click-modal="false"
+    :before-close="handleBeforeClose"
+    maxable
+  >
+    <header-title title="基本信息"></header-title>
+    <el-form
+      :model="addForm"
+      :rules="formRules"
+      ref="ruleFormRef"
+      label-width="150px"
+    >
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="记录规则名称" required prop="recordRulesName">
+            <el-input
+              v-model="addForm.recordRulesName"
+              size="small"
+              placeholder="自动带出"
+              disabled
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item
+            label="记录规则分类"
+            required
+            prop="recordRulesClassify"
+          >
+            <DictSelection
+              dictName="记录规则类型"
+              clearable
+              v-model="addForm.recordRulesClassify"
+              disabled
+            >
+            </DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item
+            v-if="ruleInfo && ruleInfo.classify == 3"
+            label="关联设备"
+            prop="workshopArea"
+          >
+            <el-input
+              v-model="addForm.deviceName"
+              size="small"
+              placeholder="自动带出"
+              disabled
+            ></el-input>
+          </el-form-item>
+          <el-form-item v-else label="车间区域" prop="workshopArea">
+            <el-input
+              v-model="addForm.workshopArea"
+              size="small"
+              placeholder="请输入"
+            ></el-input>
+          </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"
+              placeholder="选择日期"
+              style="width: 100%"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="检查有效期" required prop="checkValidity">
+            <el-input
+              placeholder="请输入"
+              v-model="addForm.checkValidity"
+              type="text"
+            >
+              <template slot="append">
+                <div style="width: 40px">
+                  <DictSelection
+                    dictName="检查有效期单位"
+                    clearable
+                    v-model="addForm.checkValidityUnit"
+                    placeholder="单位"
+                    style="width: auto"
+                  >
+                  </DictSelection>
+                </div>
+              </template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="结论" required prop="conclution">
+            <el-radio-group v-model="addForm.conclution">
+              <el-radio :label="1">合格</el-radio>
+              <el-radio :label="2">不合格</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <header-title title="检查项目"></header-title>
+
+    <!-- 表格 -->
+    <el-table :data="list" style="width: 100%">
+      <el-table-column type="index" label="序号" width="50"> </el-table-column>
+      <el-table-column label="检查内容">
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.paramValue }}
+          </div>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="检查工具">
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.tools.map((i) => i.toolName).join(',') }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="检查人">
+        <template slot-scope="scope">
+          <div @click="openSelectUser">
+            {{ scope.row.id }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="检查情况">
+        <template slot-scope="scope">
+          <div>
+            <div>
+              <el-input
+                v-if="ruleInfo && ruleInfo.classify == 3"
+                type="textarea"
+                :rows="1"
+                v-model="scope.row.checkStatusDesc"
+              ></el-input>
+              <el-radio-group v-else v-model="scope.row.checkStatus">
+                <el-radio :label="1">已检查</el-radio>
+                <el-radio :label="0">未检查</el-radio>
+              </el-radio-group>
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="检查结果">
+        <template slot-scope="scope">
+          <div>
+            <el-radio-group v-model="scope.row.checkResult">
+              <el-radio :label="1">合格</el-radio>
+              <el-radio :label="0">不合格</el-radio>
+            </el-radio-group>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="异常描述">
+        <template slot-scope="scope">
+          <div>
+            <el-input
+              type="textarea"
+              :rows="1"
+              placeholder="请输入"
+              v-model="scope.row.errorMsg"
+            >
+            </el-input>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 底部按钮 -->
+    <template #footer>
+      <div class="modal-footer">
+        <el-button type="primary" @click="handleOk">一键报工</el-button>
+        <el-button type="primary" @click="handleOk">清空缓存</el-button>
+        <el-button type="primary" @click="handleOk">缓存</el-button>
+      </div>
+    </template>
+    <!-- 选择用户 -->
+    <SelectUser ref="SelectUserRef" v-model="showSelectUser"></SelectUser>
+  </ele-modal>
+</template>
+
+<script>
+  import {
+    recordRulesDetailPage,
+    getRecordRulesDetail
+  } from '@/api/recordRules/index.js';
+  import DictSelection from '@/components/Dict/DictSelection.vue';
+  import SelectUser from '@/components/select/SelectUser/index.vue';
+
+  export default {
+    components: { SelectUser },
+    props: {},
+    data() {
+      const formDate = {
+        checkFinishTime: '',
+        checkValidity: null,
+        checkValidityUnit: '',
+        conclution: 0,
+        details: [],
+        deviceId: 0,
+        deviceName: '',
+        id: 0,
+        produceRoutingId: 0,
+        produceRoutingName: '',
+        produceTaskConfigId: 0,
+        produceTaskId: 0,
+        recordRulesClassify: 0,
+        recordRulesId: 0,
+        recordRulesName: '',
+        workOrderCode: '',
+        workOrderId: 0,
+        workshopArea: ''
+      };
+
+      return {
+        visible: false,
+        addForm: formDate,
+        formRules: {
+          checkFinishTime: [
+            { required: true, message: '请选择检查完成时间', trigger: 'blur' },
+            { required: true, message: '请选择检查完成时间', trigger: 'change' }
+          ],
+          conclution: [
+            { required: true, message: '请选择结论', trigger: 'blur' },
+            { required: true, message: '请选择结论', trigger: 'change' }
+          ],
+          checkValidity: [
+            { required: true, message: '请输入检查有效期', trigger: 'blur' },
+            { required: true, message: '请输入检查有效期', trigger: 'change' }
+          ]
+        },
+        productionInfo: null,
+        list: [],
+        ruleInfo: null,
+        showSelectUser: false
+      };
+    },
+    computed: {
+      title() {
+        if (this.ruleInfo) {
+          switch (this.ruleInfo.classify) {
+            case 1:
+              return '清场清洁类记录表';
+            case 2:
+              return '车间环境类记录表';
+
+            default:
+              return '设备检测类记录表';
+          }
+        }
+        return '类记录表';
+      }
+    },
+    methods: {
+      open(productionInfo) {
+        this.visible = true;
+        this.productionInfo = productionInfo;
+        console.log('this.productionInfo', this.productionInfo);
+        this.getRuleList();
+        this.getRuleInfo();
+      },
+      // 规则信息
+      async getRuleInfo() {
+        const data = await getRecordRulesDetail(this.productionInfo.ruleId);
+        this.ruleInfo = data;
+        console.log('this.ruleInfo', this.ruleInfo);
+        // 复制表单信息
+        this.addForm.recordRulesClassify = this.ruleInfo.classify;
+        this.addForm.recordRulesId = this.ruleInfo.id;
+        this.addForm.recordRulesName = this.ruleInfo.name;
+        this.addForm.deviceId = this.ruleInfo.deviceId;
+        this.addForm.deviceName = this.ruleInfo.deviceName;
+      },
+      // 查询记录规则 事项列表
+      async getRuleList() {
+        const { list } = await recordRulesDetailPage({
+          rulesId: this.productionInfo.ruleId,
+          pageNum: 1,
+          size: 9999
+        });
+        // 添加必要参数
+        this.list = list.map((i) => {
+          return {
+            ...i,
+            checkDeptId: 0,
+            checkDeptName: '',
+            checkResult: null,
+            checkStatus: 0,
+            checkStatusDesc: '',
+            checkUserId: 0,
+            checkUserName: '',
+            errorMsg: '',
+            executeStatus: 0
+          };
+        });
+        console.log('data list 事项列表', this.list);
+      },
+      openSelectUser() {
+        this.showSelectUser = true;
+      },
+      handleBeforeClose(done) {
+        this.visible = false;
+      },
+      handleCancel() {
+        this.visible = false;
+      },
+      handleOk() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style scoped>
+  .modal-body {
+    padding: 16px;
+    min-height: 100px;
+  }
+  .modal-footer {
+    text-align: right;
+  }
+</style>

+ 9 - 1
src/views/produce/index.vue

@@ -406,6 +406,7 @@
         arr: [],
         arrTow: [],
         produceTaskList: [],
+        produceTaskInfo: null,
         isType: '',
         isStep: false,
         outsourceForm: {},
@@ -573,6 +574,7 @@
       handleNodeClick(data) {
         this.feedNeedEquipment = data.feedNeedEquipment;
         this.reportNeedFeed = data.reportNeedFeed;
+        this.produceTaskInfo = data;
 
         console.log(data, 'handleNodeClick');
 
@@ -909,7 +911,13 @@
           }
 
           // 产前准备
-          this.$refs.prenatalExaminationRef.open(this.workListIds[0]);
+          console.log('this.produceTaskInfo', this.produceTaskInfo);
+          this.$refs.prenatalExaminationRef.open(
+            this.workData.list[0],
+            this.produceTaskInfo,
+            // 参考字典项:record_rules_execute_method,1-事件驱动,2-表单填写,3-任务驱动
+            1
+          );
         }
       },