Преглед изворни кода

批记录管理-记录管理-部分功能

lucw пре 10 месеци
родитељ
комит
7449877192

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

@@ -44,3 +44,38 @@ export async function producetaskrulerecordPage(body) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 新增或编辑,临时配置事项,不派单
+export async function tempSaveOrUpdate(body) {
+  const res = await request.post(
+    '/mes/producetaskrulerecord/tempSaveOrUpdate',
+    body
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 新增执行,编辑执行,临时配置事项,并向EAM派单
+export async function tempSaveOrUpdateAndSubmit(body) {
+  const res = await request.post(
+    '/mes/producetaskrulerecord/tempSaveOrUpdateAndSubmit',
+    body
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 新增执行,编辑执行,临时配置事项,并向EAM派单
+export async function logicDeleteById(id) {
+  const res = await request.delete(
+    `/mes/producetaskrulerecord/logicDeleteById/${id}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

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

@@ -17,3 +17,12 @@ export async function recordRulesDetailPage(body) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 规则记录分页查询
+export async function recordrulesPage(body) {
+  const res = await request.post(`/main/recordrules/page`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 60 - 60
src/components/Dict/DictSelection.vue

@@ -15,72 +15,72 @@
 </template>
 
 <script>
-import dictEnum from '@/enum/dict';
-import { mapActions, mapGetters } from 'vuex';
-export default {
-  model: {
-    prop: 'value',
-    event: 'updateVal'
-  },
-  props: {
-    value: {
-      type: [String, Number],
-      default: ''
+  import dictEnum from '@/enum/dict';
+  import { mapActions, mapGetters } from 'vuex';
+  export default {
+    model: {
+      prop: 'value',
+      event: 'updateVal'
     },
-    dictName: {
-      type: String,
-      required: true
-    },
-    labelName: {
-      type: String,
-      default: 'dictValue'
+    props: {
+      value: {
+        type: [String, Number],
+        default: ''
+      },
+      dictName: {
+        type: String,
+        required: true
+      },
+      labelName: {
+        type: String,
+        default: 'dictValue'
+      },
+      valueName: {
+        type: String,
+        default: 'dictCode'
+      },
+      filterArr: {
+        type: Array,
+        default: function () {
+          return [];
+        }
+      }
     },
-    valueName: {
-      type: String,
-      default: 'dictCode'
+    data() {
+      return {};
     },
-    filterArr: {
-      type: Array,
-      default:function(){
-        return  []
+    computed: {
+      ...mapGetters(['dict', 'getDict']),
+      dictList() {
+        return this.filterArrFn(this.dict[dictEnum[this.dictName]]);
+      },
+      selectVal: {
+        set(val) {
+          this.$emit('updateVal', val);
+          // change获取选中项所有数据
+
+          this.$emit('itemChange', this.getDict(this.dictName, val));
+        },
+        get() {
+          return this.value;
+        }
       }
-    }
-  },
-  data() {
-    return {};
-  },
-  computed: {
-    ...mapGetters(['dict', 'getDict']),
-    dictList() {
-      return this.filterArrFn(this.dict[dictEnum[this.dictName]]);
     },
-    selectVal: {
-      set(val) {
-        this.$emit('updateVal', val);
-        // change获取选中项所有数据
-
-        this.$emit('itemChange', this.getDict(this.dictName, val));
-      },
-      get() {
-        return this.value;
+    created() {
+      if (this.dictName) {
+        this.requestDict(this.dictName);
       }
-    }
-  },
-  created() {
-    if (this.dictName) {
-      this.requestDict(this.dictName);
-    }
-  },
-  methods: {
-    ...mapActions('dict', ['requestDict']),
-    //过滤
-    filterArrFn(data) {
-      let arr = [];
-      if (data) {
-        arr = data.filter((item) => !this.filterArr.includes(item.dictValue));
+    },
+    methods: {
+      ...mapActions('dict', ['requestDict']),
+      //过滤
+      filterArrFn(data) {
+        let arr = [];
+        if (data) {
+          arr = data.filter((item) => !this.filterArr.includes(item.dictValue));
+        }
+        return arr;
       }
-      return arr;
     }
-  }
-};
+  };
 </script>

+ 306 - 0
src/components/selectDevices/index.vue

@@ -0,0 +1,306 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    class="productModal_dialog"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="90%"
+  >
+    <el-card shadow="never">
+      <ele-split-layout
+        width="244px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div class="ele-border-lighter split-layout-right-content">
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            ref="treeRef"
+            :expand-on-click-node="false"
+            :default-expanded-keys="categoryId ? [categoryId] : []"
+            :highlight-current="true"
+            node-key="id"
+            @node-click="handleNodeClick"
+          ></el-tree>
+        </div>
+
+        <!-- 数据表格 -->
+        <template v-slot:content>
+          <ProductSearch @search="reload" ref="searchRef" />
+          <ele-pro-table
+            height="400"
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            :selection.sync="selection"
+            row-key="id"
+            :initLoad="false"
+          >
+            <template v-slot:modelType="{ row }">
+              <span>{{ row.category.modelType }}</span>
+            </template>
+            <template v-slot:specification="{ row }">
+              <span>{{ row.category.specification }}</span>
+            </template>
+            <template v-slot:pathName="{ row }">
+              <span>{{
+                row.position.length > 0 ? row.position[0].pathName : ''
+              }}</span>
+            </template>
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+
+    <div class="rx-sc">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import ProductSearch from './product-search.vue';
+  import { getAssetList } from '@/api/ruleManagement/plan';
+  import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
+  export default {
+    data() {
+      return {
+        ruleIdListIndex: 0,
+        visible: false,
+        title: '选择设备',
+        categoryLevelId: null,
+        categoryId: 1,
+        treeList: [],
+        treeLoading: false,
+        defaultProps: {
+          children: 'children',
+          label: 'name'
+        },
+        type: null,
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            selectable: (row, index) => {
+              return !this.processData.some((id) => id == row.id);
+            },
+            reserveSelection: true,
+            fixed: 'left'
+          },
+          {
+            label: '设备名称',
+            prop: 'name'
+          },
+          {
+            label: '编号',
+            prop: 'codeNumber'
+          },
+          {
+            label: '固资编码',
+            prop: 'fixCode'
+          },
+          {
+            label: '使用人',
+            prop: 'usePerson'
+          },
+          {
+            label: '使用岗位',
+            prop: 'postName'
+          },
+          {
+            label: '负责人',
+            prop: 'chargePerson'
+          },
+          {
+            label: '有效开始时间',
+            prop: 'startTime'
+          },
+          {
+            label: '有效结束时间',
+            prop: 'endTime'
+          },
+          {
+            label: '型号',
+            prop: 'modelType',
+            slot: 'modelType'
+          },
+          {
+            label: '规格',
+            prop: 'specification',
+            slot: 'specification'
+          },
+          {
+            label: '设备位置',
+            prop: 'pathName',
+            slot: 'pathName'
+          }
+        ],
+
+        // 表格选中数据
+        selection: [],
+        processData: []
+      };
+    },
+    components: {
+      ProductSearch
+    },
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where }) {
+        const res = await getAssetList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId,
+          rootCategoryLevelId: this.rootId
+        });
+        console.log('res---------', res);
+        this.categoryId = res.list[0]?.categoryId;
+        return res;
+      },
+      open(ruleIdList, ruleIdListIndex) {
+        let list = ruleIdList
+          .map((item) => {
+            return item.equipmentList;
+          })
+          .flat();
+        if (list.length > 0) {
+          this.processData = list.map((item) => item.id);
+        } else {
+          this.processData = [];
+        }
+        this.ruleIdListIndex = ruleIdListIndex;
+        this.visible = true;
+        this.getTreeData();
+      },
+
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+
+          const res = await getTreeByGroup({ type: 4 });
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+            return this.treeList;
+          }
+        } catch (error) {
+          console.log('error', error);
+        }
+        this.treeLoading = false;
+      },
+
+      handleNodeClick(data) {
+        this.rootId = data.rootCategoryLevelId;
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1, where: {} });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        if (this.rootId && this.categoryLevelId) {
+          this.$refs.table.reload({ page: 1, where: where });
+        } else {
+          this.$message.error('请选择设备');
+        }
+      },
+
+      handleClose() {
+        this.visible = false;
+        this.$refs.table.setSelectedRows([]);
+        this.selection = [];
+      },
+      selected() {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        const selectList = this.$refs.treeRef.getCheckedNodes();
+        console.log('selectList-----------', selectList);
+        this.$emit(
+          'chooseEquipment',
+          this.selection,
+          this.ruleIdListIndex,
+          this.categoryId
+        );
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .productModal_dialog {
+    overflow: hidden;
+    ::v-deep .el-dialog {
+      margin: 50px auto !important;
+      height: 90%;
+      overflow: hidden;
+
+      .el-dialog__body {
+        position: absolute;
+        left: 0;
+        top: 54px;
+        bottom: 0;
+        right: 0;
+        padding: 0;
+        z-index: 1;
+        overflow: hidden;
+        overflow-y: auto;
+        // 下边设置字体,我的需求是黑底白字
+        color: #ffffff;
+        line-height: 30px;
+        padding: 0 15px;
+        display: flex;
+        flex-direction: column;
+        > div {
+          flex: 1;
+          .el-card__body {
+            height: 100%;
+            display: flex;
+            flex-direction: column;
+            > div {
+              flex: 1;
+              .ele-split-panel-body {
+                display: flex;
+                flex-direction: column;
+                > div {
+                  height: 100%;
+                  display: flex;
+                  flex-direction: column;
+                  .el-table {
+                    flex: 1 0 auto;
+                    height: 0;
+                    overflow: auto;
+                  }
+                }
+              }
+            }
+          }
+        }
+        .rx-sc {
+          flex: 0 0 50px;
+          display: flex;
+          align-items: center;
+          justify-content: center;
+        }
+      }
+    }
+  }
+  ::v-deep {
+    .el-checkbox__input.is-disabled .el-checkbox__inner {
+      background-color: #c1c1c1 !important;
+    }
+  }
+  .ml60 {
+    margin-left: 60px;
+  }
+</style>

+ 114 - 0
src/components/selectDevices/product-search.vue

@@ -0,0 +1,114 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="77px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="10">
+      <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-form-item label="设备名称">
+          <el-input clearable v-model.trim="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-form-item label="编号">
+          <el-input clearable v-model.trim="where.codeNumber" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-form-item label="固资编码">
+          <el-input clearable v-model.trim="where.fixCode" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-form-item label="结束时间">
+          <el-date-picker
+            style="width: 100%"
+            v-model.trim="where.endTime"
+            value-format="yyyy-MM"
+            type="month"
+            placeholder="选择有效期结束"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh"
+            class="ele-btn-icon"
+            size="medium"
+            >重置</el-button
+          >
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        codeNumber: '',
+        fixCode: '',
+        endTime: ''
+      };
+      return {
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {},
+    methods: {
+      /* 搜索 */
+      search() {
+        if (this.where.appType === 0) {
+          this.where.appType = '';
+        }
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      },
+      reset2() {
+        this.where = { ...this.defaultWhere };
+      }
+    }
+  };
+</script>
+
+<style>
+  .ele-form-actions {
+    display: inline-block;
+    transform: translate(0);
+    transition: all;
+  }
+</style>

+ 149 - 0
src/components/selectMatterRules/matter-search.vue

@@ -0,0 +1,149 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="80px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="规则名称:">
+          <el-input clearable v-model.trim="where.name" placeholder="请输入" />
+        </el-form-item>
+        <!-- <el-form-item label="规则状态:">
+          <DictSelection
+            dictName="规则状态"
+            clearable
+            v-model.trim="where.status"
+          >
+          </DictSelection>
+        </el-form-item> -->
+        <el-form-item label="创建时间:">
+          <el-date-picker
+            style="width: 100%"
+            v-model="time"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="规则编码:">
+          <el-input clearable v-model.trim="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="规则类型:">
+          <DictSelection
+            dictName="规则类型"
+            clearable
+            v-model.trim="where.type"
+            :listFormatte="listFormatte"
+          >
+          </DictSelection>
+        </el-form-item>
+        <!-- <el-form-item label="组织机构:">
+          <auth-selection v-model.trim="where.deptIds" style="width: 100%"></auth-selection>
+        </el-form-item> -->
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <!-- <el-form-item label="创建人:">
+          <el-input
+            clearable
+            v-model.trim="where.userName"
+            placeholder="请输入"
+          />
+        </el-form-item> -->
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+            size="small"
+          >
+            查询
+          </el-button>
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh-left"
+            size="small"
+            type="primary"
+            >重置</el-button
+          >
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    props: {
+      filterType: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      }
+    },
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        userName: '',
+        type: '',
+        status: 1,
+        startTime: '',
+        endTime: ''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData: [],
+        time: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {},
+    methods: {
+      listFormatte(list, valueName) {
+        return list.filter((i) => ['1', '2', '5'].includes(i[valueName]));
+      },
+      /* 搜索 */
+      search() {
+        const [startTime = '', endTime = ''] = this.time || [];
+        this.$emit('search', {
+          ...this.where,
+          startTime,
+          endTime
+        });
+      },
+      /*  重置 */
+      reset() {
+        this.time = [];
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
+</style>

+ 211 - 0
src/components/selectMatterRules/select-matter-rules.vue

@@ -0,0 +1,211 @@
+<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%"
+  >
+    <el-card shadow="never" v-loading="loading">
+      <matter-search @search="reload" :filterType="filterType"> </matter-search>
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :page-size="pageSize"
+        @columns-change="handleColumnChange"
+        :cache-key="cacheKeyUrl"
+        :selection.sync="selection"
+      >
+        <!-- 编码列 -->
+        <template v-slot:code="{ row }">
+          <el-link type="primary" :underline="false" @click="goDetail(row)">
+            {{ row.code }}
+          </el-link>
+        </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 MatterSearch from './matter-search.vue';
+  import { getList, removeRule } from '@/api/ruleManagement/matter';
+  import dictMixins from '@/mixins/dictMixins';
+
+  export default {
+    mixins: [dictMixins, tabMixins],
+    emits: ['chooseRules'],
+    props: {
+      filterType: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      }
+    },
+    components: {
+      MatterSearch
+    },
+    data() {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            prop: 'code',
+            label: '规则编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'code'
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row) => {
+              return this.getDictValue('规则状态', _row.status);
+            }
+          },
+          {
+            prop: 'ruleType',
+            label: '规则类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'enable',
+            minWidth: 110,
+            formatter: (_row) => {
+              return this.getDictValue('规则类型', _row.ruleType);
+            }
+          },
+          {
+            prop: 'name',
+            label: '规则名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'cycle',
+            label: '周期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row) => {
+              return this.getDictValue('规则周期', _row.cycleType);
+            }
+          },
+          {
+            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);
+            }
+          }
+        ],
+        // 加载状态
+        loading: false,
+        pageType: 'add',
+        dialogTitle: '',
+        pageSize: this.$store.state.tablePageSize,
+        cacheKeyUrl: '0c40331c-rulesManagement-matterRules',
+        visible: false,
+        selection: [],
+        produceTaskOptions: []
+      };
+    },
+    computed: {},
+    mounted() {
+      this.requestDict('规则周期');
+      this.requestDict('规则类型');
+      this.requestDict('规则状态');
+    },
+    methods: {
+      open(selection = []) {
+        this.visible = true;
+        this.selection = selection;
+        this.reload();
+      },
+      updateVisible(val) {
+        this.visible = val;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return getList({
+          pageNum: page,
+          size: limit,
+          ...where,
+          types: this.filterType
+        });
+      },
+      /* 刷新表格 */
+      reload(where = {}) {
+        this.$refs.table?.reload({ page: 1, where, types: this.filterType });
+      },
+
+      remove(row) {
+        removeRule([row.id]).then(() => {
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      },
+
+      openEdit(type, row) {
+        this.pageType = type;
+        this.dialogTitle =
+          type == 'add' ? '新建规则' : type == 'edit' ? '编辑规则' : '克隆规则';
+        this.$refs.addMatterRulesRef.openDialog(row, type);
+      },
+
+      goDetail({ id }) {
+        this.$router.push({
+          path: '/rulesManagement/matterRules/details',
+          query: { id }
+        });
+      },
+      confirmSelection() {
+        this.$emit('chooseRules', this.selection);
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 83 - 0
src/components/selectReleaseRules/search.vue

@@ -0,0 +1,83 @@
+<!-- 搜索表单 -->
+<template>
+  <seekPage :seekList="seekList" @search="search" :maxLength="4"></seekPage>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+
+  export default {
+    props: {},
+    mixins: [dictMixins],
+    data() {
+      return {
+        typeList: []
+      };
+    },
+    computed: {
+      // 表格列配置
+      seekList() {
+        return [
+          {
+            label: '规则编码:',
+            value: 'code',
+            type: 'input',
+            placeholder: '规则编码'
+          },
+          {
+            label: '规则名称:',
+            value: 'name',
+            type: 'input',
+            placeholder: '规则名称'
+          },
+          {
+            label: '记录表分类:',
+            value: 'classify',
+            type: 'select',
+            placeholder: '记录表分类',
+            planList: this.typeList
+          }
+          //,
+          // {
+          //   label: '状态:',
+          //   value: 'publishStatus',
+          //   type: 'select',
+          //   placeholder: '状态',
+          //   // 0-草稿,1-已发布,2-已撤销
+          //   planList: [
+          //     {
+          //       label: '草稿',
+          //       value: '0'
+          //     },
+          //     {
+          //       label: '已发布',
+          //       value: '1'
+          //     },
+          //     {
+          //       label: '已撤销',
+          //       value: '2'
+          //     }
+          //   ]
+          // }
+        ];
+      }
+    },
+    mounted() {
+      this.requestDict('记录规则类型').then(() => {
+        if (this.$store.state.dict['record_sheet']) {
+          this.typeList = this.$store.state.dict['record_sheet'].map((i) => {
+            return { label: i.dictValue, value: i.dictCode };
+          });
+        }
+      });
+    },
+    methods: {
+      /* 搜索 */
+      search(e) {
+        this.$emit('search', {
+          ...e
+        });
+      }
+    }
+  };
+</script>

+ 218 - 0
src/components/selectReleaseRules/select-release-rules.vue

@@ -0,0 +1,218 @@
+<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%"
+  >
+    <el-card shadow="never" v-loading="loading">
+      <search @search="reload" />
+      <ele-pro-table
+        ref="tableRef"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+      >
+      </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 search from './search.vue';
+  import { recordrulesPage } from '@/api/recordRules/index';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import dictMixins from '@/mixins/dictMixins';
+
+  export default {
+    components: { search },
+    mixins: [tabMixins, dictMixins],
+    computed: {
+      columns() {
+        return [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            prop: 'code',
+            label: '记录规则编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '记录规则名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'classify',
+            label: '记录规则分类',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return this.getDictValue('记录规则类型', row.classify);
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return row.version ? `V${row.version.toFixed(1)}` : '';
+            }
+          },
+          {
+            prop: 'fromName',
+            label: '来源版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'startDate',
+            label: '启用日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'stopDate',
+            label: '停用日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: '',
+            label: '周期',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return (
+                row.frequencyValue +
+                this.getDictValue('记录规则频率', row.frequencyUnit + '')
+              );
+            }
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'enable',
+            label: '是否启用',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return row.enable ? '启用' : '停用';
+            }
+          },
+          {
+            prop: 'publishStatus',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              switch (row.publishStatus) {
+                case 0:
+                  return '草稿';
+                case 1:
+                  return '已发布';
+                case 2:
+                  return '已撤销';
+                default:
+                  return '';
+              }
+            }
+          }
+        ];
+      }
+    },
+    data() {
+      return {
+        loading: false,
+        visible: false,
+        selection: []
+      };
+    },
+    mounted() {
+      this.requestDict('记录规则类型');
+      this.requestDict('记录规则频率');
+    },
+    methods: {
+      open() {
+        this.visible = true;
+        this.selection = [];
+        this.reload({}); // 刷新表格
+      },
+      updateVisible(val) {
+        this.visible = val;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return recordrulesPage({
+          pageNum: page,
+          size: limit,
+          // 已发布
+          publishStatus: 1,
+          // 启用
+          enable: 1,
+          ...where
+        });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.tableRef?.reload({
+          page: 1, // 已发布
+          publishStatus: 1,
+          // 启用
+          enable: 1,
+          where
+        });
+      },
+      confirmSelection() {
+        this.$emit('chooseRules', this.selection);
+        this.visible = false;
+      }
+    }
+  };
+</script>

+ 8 - 1
src/enum/dict.js

@@ -31,7 +31,14 @@ export default {
   检查有效期单位: 'validity_unit',
   事项类型: 'record_rules_item_type',
   报工类型: 'record_rules_report_work_type',
-  执行方式: 'record_rules_execute_method'
+  执行方式: 'record_rules_execute_method',
+  记录规则报工类型: 'record_rules_report_work_type',
+  记录规则执行方式: 'record_rules_execute_method',
+  记录规则事项类型: 'record_rules_item_type',
+  记录规则频率: 'record_rules_frequency',
+  规则类型: 'rule_type',
+  规则状态: 'rule_status',
+  规则周期: 'rule_cycle'
 };
 export const numberList = ['date_method'];
 

+ 1 - 1
src/store/getters.js

@@ -15,7 +15,7 @@ export default {
   // 根据字典enumName  和 dictCode 获取字典 值(名称
   getDictValue: (state) => (enumName, dictCode) => {
     const obj = (state.dict[dictEnum[enumName]] || []).find((item) => {
-      return item.dictCode === dictCode;
+      return item.dictCode === dictCode + '';
     });
 
     return obj && obj.dictValue;

+ 82 - 0
src/views/batchRecord/components/detialsModal.vue

@@ -0,0 +1,82 @@
+<template>
+  <ele-modal
+    :title="title"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    @close="handleClose"
+    resizable
+    maxable
+  >
+    <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
+      <el-form-item label="用户名" prop="username">
+        <el-input v-model="form.username" placeholder="请输入用户名"></el-input>
+      </el-form-item>
+
+      <el-form-item label="邮箱" prop="email">
+        <el-input v-model="form.email" placeholder="请输入邮箱"></el-input>
+      </el-form-item>
+    </el-form>
+
+    <template v-slot:footer>
+      <el-button @click="handleClose">返回</el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  export default {
+    name: 'editModal',
+    mixins: [dictMixins],
+    data() {
+      const formBaseData = {
+        username: '',
+        email: ''
+      };
+
+      return {
+        visible: false,
+        title: '表单弹窗',
+        formBaseData,
+        form: JSON.parse(JSON.stringify(formBaseData)),
+        rules: {
+          username: [
+            { required: true, message: '请输入用户名', trigger: 'blur' }
+          ],
+          email: [
+            { required: true, message: '请输入邮箱', trigger: 'blur' },
+            { type: 'email', message: '邮箱格式不正确', trigger: 'change' }
+          ]
+        }
+      };
+    },
+    methods: {
+      // 外部调用,打开弹窗
+      open(data, title) {
+        console.log('data', data);
+        if (data) {
+          this.form = Object.assign({}, this.formBaseData, data);
+        }
+        this.title = title || '表单弹窗';
+        this.visible = true;
+      },
+      // 关闭时清理表单
+      handleClose() {
+        this.visible = false;
+        this.form = JSON.parse(JSON.stringify(this.formBaseData));
+        this.$refs.formRef && this.$refs.formRef.resetFields();
+      },
+      // 提交
+      submit() {
+        this.$refs.formRef.validate((valid) => {
+          if (valid) {
+            this.$emit('submit', this.form);
+            this.handleClose();
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss"></style>

+ 581 - 0
src/views/batchRecord/components/editModal.vue

@@ -0,0 +1,581 @@
+<template>
+  <ele-modal
+    :title="title"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    @close="handleClose"
+    resizable
+    maxable
+    width="80%"
+  >
+    <div>
+      <el-form ref="formRef" :model="form" :rules="rules" label-width="130px">
+        <header-title title="事项信息"></header-title>
+        <el-row style="margin-bottom: 20px">
+          <el-col :span="8">
+            <el-form-item label="记录编码">
+              <el-input
+                v-model="form.code"
+                placeholder="系统自动生成"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="类型" required prop="itemType">
+              <DictSelection
+                dictName="记录规则事项类型"
+                clearable
+                v-model="form.itemType"
+                @change="itemTypeChange"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8"> </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="执行方式" required prop="executeMethod">
+              <DictSelection
+                dictName="记录规则执行方式"
+                clearable
+                v-model="form.executeMethod"
+                disabled
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+          <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-select
+                placeholder="请选择关联任务"
+                filterable
+                clearable
+                style="width: 100%"
+                v-model="form.taskId"
+              >
+                <el-option
+                  v-for="task in []"
+                  :key="task.id"
+                  :label="task.name"
+                  :value="task.id"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col v-if="form.itemType == '2'" :span="8">
+            <el-form-item label="关联记录规则" required prop="ruleName">
+              <div class="mask-box" @click="selectReleaseId">
+                <el-input
+                  v-model="form.ruleName"
+                  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 == '1'" :span="8">
+            <el-form-item label="关联事项规则" required prop="ruleName">
+              <div class="mask-box" @click="selectRulesId">
+                <el-input
+                  v-model="form.ruleName"
+                  placeholder="请选择设备有关计划规则,如保养规则,巡点检规则等"
+                  size="small"
+                  :readonly="true"
+                >
+                  <template #append>
+                    <el-button size="small">选择规则</el-button>
+                  </template>
+                </el-input>
+              </div>
+            </el-form-item></el-col
+          >
+        </el-row>
+        <header-title title="关联产品"></header-title>
+        <el-row style="margin-bottom: 20px">
+          <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-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="工序名称" prop="produceTaskId">
+              <el-select
+                v-model="form.produceTaskId"
+                placeholder="请选择工序"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in produceTaskList"
+                  :key="item.taskId"
+                  :label="item.taskTypeName"
+                  :value="item.taskId"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row style="margin-bottom: 20px">
+          <el-col :span="8">
+            <el-form-item label="产品编码" required prop="productCode">
+              <el-input
+                v-model="form.productCode"
+                placeholder="请选择产品信息"
+                :disabled="Boolean(form.workOrderId)"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="产品名称" required prop="productName">
+              <el-input
+                v-model="form.productName"
+                placeholder="请输入"
+                :disabled="Boolean(form.workOrderId)"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="批次号" prop="batchNo">
+              <el-input
+                v-model="form.batchNo"
+                placeholder="请输入"
+                :disabled="Boolean(form.workOrderId)"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row style="margin-bottom: 20px">
+          <el-col :span="8">
+            <el-form-item label="规格" prop="specification">
+              <el-input
+                v-model="form.specification"
+                placeholder="请输入"
+                :disabled="Boolean(form.workOrderId)"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="型号" prop="productModel">
+              <el-input
+                v-model="form.productModel"
+                placeholder="请输入"
+                :disabled="Boolean(form.workOrderId)"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="要求生产数量" required prop="formingNum">
+              <el-input
+                v-model.number="form.formingNum"
+                placeholder="请输入"
+                :disabled="Boolean(form.workOrderId)"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+
+    <template v-slot:footer>
+      <el-button type="primary" @click="save" :loading="butLoading"
+        >保存</el-button
+      >
+      <el-button type="primary" @click="submit" :loading="butLoading"
+        >执行</el-button
+      >
+      <el-button @click="handleClose" :loading="butLoading">取 消</el-button>
+    </template>
+
+    <selectDevices
+      ref="deviceSelectDialog"
+      selectType="single"
+      @chooseEquipment="chooseEquipment"
+    ></selectDevices>
+
+    <selectMatterRules
+      ref="selectMatterRulesRef"
+      @chooseRules="chooseRules"
+      :filterType="[1, 2, 5]"
+    ></selectMatterRules>
+
+    <selectReleaseRules
+      ref="selectReleaseRulesRef"
+      @chooseRules="chooseReleaseRules"
+    ></selectReleaseRules>
+
+    <programRulesDialog
+      ref="programRulesDialogRef"
+      :dialogTitle="dialogTitle"
+      @reload="reload"
+      :isTempRecord="1"
+    />
+
+    <releaseRulesDialog
+      v-model="showReleaseRulesDialog"
+      ref="releaseRulesDialogRef"
+      @reload="reload"
+      :isTempRecord="1"
+    />
+  </ele-modal>
+</template>
+
+<script>
+  import { submit } from '@/api/entrust';
+  import dictMixins from '@/mixins/dictMixins';
+  import selectMatterRules from '@/components/selectMatterRules/select-matter-rules.vue';
+  import selectReleaseRules from '@/components/selectReleaseRules/select-release-rules.vue';
+  import selectDevices from '@/components/selectDevices/index.vue';
+  import { produceOrder } from '@/api/aps/index.js';
+  import { getTaskInstanceList } from '@/api/produce/job.js';
+  import { tempSaveOrUpdate } from '@/api/producetaskrulerecord/index.js';
+  import programRulesDialog from '@/views/produce/components/prenatalExamination/programRulesDialog.vue';
+  import releaseRulesDialog from '@/views/produce/components/prenatalExamination/releaseRulesDialog.vue';
+
+  export default {
+    name: 'editModal',
+    mixins: [dictMixins],
+    components: {
+      selectMatterRules,
+      selectReleaseRules,
+      selectDevices,
+      programRulesDialog,
+      releaseRulesDialog
+    },
+    props: {
+      // 1-产前准备,2-过程监测,3-产后检查
+      reportWorkType: {
+        type: Number,
+        default: 1
+      }
+    },
+    data() {
+      const formBaseData = {
+        id: null,
+        // 设备id
+        deviceId: null,
+        //设备名称
+        deviceName: '',
+        // 记录规则执行方式,参考字典项:record_rules_execute_method
+        executeMethod: '1',
+        // 记录规则事项类型,参考字典项:record_rules_item_type
+        itemType: '1',
+        // 工序ID
+        produceTaskId: null,
+        // 记录规则报工类型,参考字典项:record_rules_report_work_type
+        reportWorkType: null,
+        // 规则id,包括事项规则id,记录规则id,根据事项类型区分
+        ruleId: null,
+        // 	规则名称
+        ruleName: '',
+        // 任务id
+        taskId: null,
+        // mes生产工单表工单号 code
+        workOrderCode: '',
+        // workOrderId mes生产工单表id
+        workOrderId: null,
+        // 产品编码
+        productCode: null,
+        // 产品型号
+        productModel: null,
+        // 产品名称
+        productName: null,
+        // 记录规则分类,字典项:record_sheet
+        recordRulesClassify: null,
+        // 产品批次号
+        batchNo: '',
+        // 产品规格
+        specification: '',
+        // 要求生产数量
+        formingNum: null,
+        // 是否临时执行
+        isTempRecord: 1
+      };
+
+      var validatepProduceTaskId = (rule, value, callback) => {
+        if (this.form.workOrderCode) {
+          if (!this.form.produceTaskId) {
+            callback(new Error('请选择工序'));
+          }
+        }
+        callback();
+      };
+
+      return {
+        visible: false,
+        title: '',
+        formBaseData,
+        form: JSON.parse(JSON.stringify(formBaseData)),
+        rules: {
+          itemType: [
+            { required: true, message: '请选择规则事项类型', trigger: 'blur' }
+          ],
+          deviceName: [
+            { required: true, message: '请选择设备', trigger: 'blur' }
+          ],
+          ruleName: [
+            { required: true, message: '请选择规则', trigger: 'blur' }
+          ],
+          productCode: [
+            { required: true, message: '请输入产品编码', trigger: 'blur' }
+          ],
+          productName: [
+            { required: true, message: '请输入产品名称', trigger: 'blur' }
+          ],
+          formingNum: [
+            { required: true, message: '请输入要求生产数量', trigger: 'blur' }
+          ],
+          produceTaskId: [
+            { validator: validatepProduceTaskId, trigger: 'blur' }
+          ]
+        },
+        // 生产工单列表
+        workOrderList: [],
+        //工序名称列表
+        produceTaskList: [],
+        // 工单信息
+        workOrderInfo: null,
+        butLoading: false,
+        showReleaseRulesDialog: false,
+        dialogTitle: ''
+      };
+    },
+    computed: {
+      reportWorkTypeName() {
+        switch (this.reportWorkType) {
+          case 1:
+            return '产前准备';
+          case 2:
+            return '过程监测';
+
+          default:
+            return '产后检查';
+        }
+      }
+    },
+    created() {
+      this.requestDict('记录规则报工类型');
+      this.requestDict('记录规则执行方式');
+      this.requestDict('记录规则事项类型');
+      this.getWorkOrderList();
+    },
+    methods: {
+      // 外部调用,打开弹窗
+      open(type, data) {
+        console.log('data', type, data);
+        if (type == 'add') {
+          this.title = `新增${this.reportWorkTypeName}事项`;
+        } else {
+          this.title = `编辑${this.reportWorkTypeName}事项`;
+        }
+        this.visible = true;
+      },
+      // 关闭时清理表单
+      handleClose() {
+        this.visible = false;
+        this.form = JSON.parse(JSON.stringify(this.formBaseData));
+        this.$refs.formRef && this.$refs.formRef.resetFields();
+      },
+      // 修改规则事项类型
+      itemTypeChange() {
+        this.form.executeMethod = this.form.itemType;
+        this.form.ruleId = null;
+        this.form.ruleName = '';
+      },
+      // 去选择设备
+      selectDeviceId() {
+        this.$refs.deviceSelectDialog.open([]);
+      },
+      // 设备选
+      chooseEquipment(data, index, categoryId) {
+        console.log('data', data, index, categoryId);
+        this.form.deviceId = data[0]?.id || null;
+        this.form.deviceName = data[0]?.name || '';
+        if (this.rules && this.rules.length > 1) {
+          // 提示用户选择的规则有多个事项规则
+          this.$message.warning('所选设备包含多个设备,请注意选择');
+        }
+      },
+      // 去选择记录规则
+      selectReleaseId() {
+        this.$refs.selectReleaseRulesRef.open();
+      },
+      // 选择记录规则
+      chooseReleaseRules(rules) {
+        console.log('rules', rules);
+        this.form.ruleId = rules[0]?.id || null;
+        this.form.ruleName = rules[0]?.name || '';
+        this.form.recordRulesClassify = rules[0]?.classify;
+        if (this.rules && this.rules.length > 1) {
+          // 提示用户选择的规则有多个事项规则
+          this.$message.warning('所选记录规则包含多个事项规则,请注意选择');
+        }
+      },
+      // 去选择事项规则
+      selectRulesId() {
+        this.$refs.selectMatterRulesRef.open([this.form.ruleId]);
+      },
+      // 选择事项规则
+      chooseRules(rules) {
+        console.log('rules', rules);
+        this.form.ruleId = rules[0]?.id || null;
+        this.form.ruleName = rules[0]?.name || '';
+      },
+      // 获取生产工单号
+      async getWorkOrderList(code = '') {
+        if (typeof code != 'string') {
+          code = '';
+        }
+        const { list } = await produceOrder({
+          code,
+          pageNum: 1,
+          size: 50
+        });
+        console.log('生产工单', list);
+        this.workOrderList = list;
+      },
+      // 选择生产工单
+      workOrderCodeChange(code) {
+        console.log('code', code);
+        if (code) {
+          const workOrder = this.workOrderList.find((i) => i.code == code);
+          this.workOrderInfo = workOrder;
+          console.log('workOrder', workOrder);
+          this.form.workOrderId = workOrder.id;
+          // 赋值产品信息
+          this.form.productCode = workOrder.productCode;
+          this.form.productModel = workOrder.productModel;
+          this.form.productName = workOrder.productName;
+          this.form.batchNo = workOrder.batchNo;
+          this.form.specification = workOrder.specification;
+          this.form.formingNum = workOrder.formingNum;
+          this.getProductTaskList(workOrder.id);
+        } else {
+          this.workOrderInfo = null;
+          this.form.workOrderId = null;
+          // 赋值产品信息
+          this.form.productCode = null;
+          this.form.productModel = null;
+          this.form.productName = '';
+          this.form.batchNo = '';
+          this.form.specification = null;
+          this.form.formingNum = null;
+          this.form.produceTaskId = null;
+          this.produceTaskList = [];
+        }
+      },
+      // 获取工序列表
+      async getProductTaskList(id) {
+        const data = await getTaskInstanceList(id);
+        console.log('data 工序列表', data);
+        this.produceTaskList = data;
+      },
+      // 执行
+      submit() {
+        this.$refs.formRef.validate((valid) => {
+          if (!valid) {
+            return '';
+          }
+          this.form.reportWorkType = this.reportWorkType;
+          console.log('this.form', this.form);
+          if (this.form.executeMethod == 1) {
+            // 设备保养计划相关逻辑
+            this.dialogTitle = '新增设备保养计划';
+            this.$refs.programRulesDialogRef.init(
+              this.form,
+              this.workOrderInfo,
+              {}
+            );
+          } else {
+            this.$refs.releaseRulesDialogRef.open(
+              this.form,
+              this.workOrderInfo,
+              {}
+            );
+          }
+        });
+      },
+      // 保存
+      save() {
+        this.$refs.formRef.validate(async (valid) => {
+          if (!valid) {
+            return '';
+          }
+          this.form.reportWorkType = this.reportWorkType;
+          console.log('this.form', this.form);
+          try {
+            this.butLoading = true;
+            const data = await tempSaveOrUpdate(this.form);
+            this.$message.success('保存成功!');
+            this.butLoading = false;
+          } catch (error) {
+            this.butLoading = false;
+          }
+        });
+      },
+      // 执行完成
+      reload() {}
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .mask-box {
+    &::after {
+      content: '';
+      width: 100%;
+      height: 100%;
+      position: absolute;
+      top: 0;
+      left: 0;
+      background: rgba(0, 0, 0, 0);
+      cursor: pointer;
+    }
+  }
+</style>

+ 25 - 4
src/views/batchRecord/components/list.vue

@@ -7,7 +7,7 @@
       :columns="columns"
       :datasource="datasource"
       cacheKey="batchRecordBefore"
-      :cache-key="'batchRecordTable' + 'rules'"
+      :cache-key="'batchRecordTableRules-reportWorkType-' + reportWorkType"
       autoAmendPage
     >
       <!-- 操作列 -->
@@ -18,7 +18,7 @@
           type="primary"
           icon="el-icon-plus"
           class="ele-btn-icon"
-          @click="open('add')"
+          @click="openEdit('add', null)"
         >
           新建
         </el-button>
@@ -57,6 +57,7 @@
           v-if="row.executeStatus == 0"
           title="确定要删除此用户吗?"
           class="ele-action"
+          @confirm="deleteById(item)"
         >
           <template v-slot:reference>
             <el-link type="danger" :underline="false"> 删除 </el-link>
@@ -64,15 +65,24 @@
         </el-popconfirm>
       </template>
     </ele-pro-table>
+    <!-- 详情-审核组件 -->
+    <editModal ref="detailsRef" :reportWorkType="reportWorkType"></editModal>
   </el-card>
 </template>
 
 <script>
   import dictMixins from '@/mixins/dictMixins';
   import tableColumnsMixin from '@/mixins/tableColumnsMixin';
-  import { producetaskrulerecordPage } from '@/api/producetaskrulerecord/index';
+  import {
+    producetaskrulerecordPage,
+    logicDeleteById
+  } from '@/api/producetaskrulerecord/index';
+  import editModal from './editModal.vue';
 
   export default {
+    components: {
+      editModal
+    },
     name: 'batchRecordTable',
     mixins: [dictMixins, tableColumnsMixin],
     props: {
@@ -120,6 +130,7 @@
           },
           {
             label: '类型',
+            prop: 'itemType',
             formatter: (row) => {
               return this.getDictValue('事项类型', row.itemType + '');
             }
@@ -140,6 +151,7 @@
           {
             label: '状态',
             minWidth: 180,
+            prop: 'executeStatus',
             formatter: (row) => {
               switch (row.executeStatus) {
                 case 0:
@@ -250,7 +262,7 @@
     },
     methods: {
       // 刷新表格
-      reload(where) {
+      reload(where = {}) {
         this.$nextTick(() => {
           this.$refs.table.reload({
             page: 1,
@@ -268,6 +280,15 @@
           limit,
           reportWorkType: this.reportWorkType
         });
+      },
+      // 打开详情
+      openEdit(type, row) {
+        this.$refs.detailsRef.open(type, row);
+      },
+      // 删除临时记录
+      async deleteById(item) {
+        await logicDeleteById(item.id);
+        this.$message.warning('删除成功!');
       }
     }
   };

+ 22 - 5
src/views/produce/components/prenatalExamination/programRulesDialog.vue

@@ -336,7 +336,10 @@
   import { getById } from '@/api/maintenance/patrol_maintenance';
   import { getFile } from '@/api/system/file';
   import { getAssetInfo } from '@/api/produce/device';
-  import { saveRuleRecord } from '@/api/producetaskrulerecord/index.js';
+  import {
+    saveRuleRecord,
+    tempSaveOrUpdateAndSubmit
+  } from '@/api/producetaskrulerecord/index.js';
 
   export default {
     components: {
@@ -344,7 +347,12 @@
       OperationGuideDialog
     },
     emits: ['reload'],
-    props: {},
+    props: {
+      isTempRecord: {
+        type: Number,
+        default: 0
+      }
+    },
     data() {
       const formData = {
         code: '', // 计划配置单号
@@ -363,7 +371,8 @@
         urgent: '1', // 紧急程度
         type: '',
         groupName: '',
-        isTempRecord: 0
+        // 是否临时执行记录
+        isTempRecord: this.isTempRecord
       };
 
       return {
@@ -463,7 +472,10 @@
         this.produceTaskInfo = produceTaskInfo;
         this.visible = true;
 
-        if (this.productionInfo.executeStatus != 0) {
+        if (
+          this.productionInfo.executeStatus &&
+          this.productionInfo.executeStatus != 0
+        ) {
           // 执行中 已执行 获取基本信息
           this.getInfo();
         } else {
@@ -664,7 +676,12 @@
 
             console.log('body', body);
 
-            await saveRuleRecord(body);
+            if (this.isTempRecord) {
+              await tempSaveOrUpdateAndSubmit(body);
+            } else {
+              await saveRuleRecord(body);
+            }
+
             this.$message.success('派单成功!');
             this.butLoading = false;
             this.beforeClose();

+ 25 - 8
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -254,11 +254,17 @@
     logicDelete,
     getById
   } from '@/api/producetaskrecordrulesrecord/index';
+  import { tempSaveOrUpdateAndSubmit } from '@/api/producetaskrulerecord/index.js';
 
   export default {
     components: { SelectUser },
     emits: ['reload'],
-    props: {},
+    props: {
+      isTempRecord: {
+        type: Number,
+        default: 0
+      }
+    },
     data() {
       const formDate = {
         id: null,
@@ -267,7 +273,7 @@
         checkValidity: null,
         checkValidityUnit: '',
         conclution: null,
-        isTempRecord: 0,
+        isTempRecord: this.isTempRecord,
         details: [],
         deviceId: 0,
         deviceName: '',
@@ -500,13 +506,24 @@
           // 提交
           this.butLoading = true;
           try {
-            if (type == 'submit') {
-              await saveOrUpdateAndSubmit(this.addForm);
-              this.$message.success('报工成功!');
+            if (this.isTempRecord) {
+              if (type == 'submit') {
+                await tempSaveOrUpdateAndSubmit(this.addForm);
+                this.$message.success('报工成功!');
+              } else {
+                const id = await saveOrUpdate(this.addForm);
+                this.addForm.id = id;
+                this.$message.success('缓存成功!');
+              }
             } else {
-              const id = await saveOrUpdate(this.addForm);
-              this.addForm.id = id;
-              this.$message.success('缓存成功!');
+              if (type == 'submit') {
+                await saveOrUpdateAndSubmit(this.addForm);
+                this.$message.success('报工成功!');
+              } else {
+                const id = await saveOrUpdate(this.addForm);
+                this.addForm.id = id;
+                this.$message.success('缓存成功!');
+              }
             }
 
             this.butLoading = false;

+ 2 - 0
src/views/produce/index.vue

@@ -632,6 +632,7 @@
                   this.produceTaskList[0].id
                 );
               });
+              this.produceTaskInfo = this.produceTaskList[0];
             }
           });
         } else {
@@ -649,6 +650,7 @@
                   this.produceTaskList[0].id
                 );
               });
+              this.produceTaskInfo = this.produceTaskList[0];
             }
           });
         }

+ 2 - 2
vue.config.js

@@ -33,7 +33,7 @@ module.exports = {
       '/api': {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.116:18086',
-        // target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.103:18086',192.168.1.116
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.116:18086',
@@ -43,7 +43,7 @@ module.exports = {
         // target: 'http://192.168.1.33:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18087',
-        target: 'http://192.168.1.116:18086',
+        // target: 'http://192.168.1.116:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''