Sfoglia il codice sorgente

工序管理-配置事项功能完成

lucw 11 mesi fa
parent
commit
ef9322f6e3

+ 23 - 0
src/api/producetaskrecordrules/index.js

@@ -0,0 +1,23 @@
+import request from '@/utils/request';
+
+// 分页查询 /main/producetaskrecordrules/page
+// 消息分页
+export async function produceTaskRecordRules(data) {
+  const res = await request.post(`/main/producetaskrecordrules/page`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 批量保存 /main/producetaskrecordrules/batchSave
+export async function produceTaskRecordRulesBatchSave(data) {
+  const res = await request.post(
+    `/main/producetaskrecordrules/batchSave`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

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

@@ -0,0 +1,137 @@
+<!-- 搜索表单 -->
+<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-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-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="规则类型:">
+          <DictSelection
+            dictName="规则类型"
+            clearable
+            v-model.trim="where.type"
+          >
+          </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 {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        userName: '',
+        type: '',
+        status: '',
+        startTime: '',
+        endTime: ''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData: [],
+        time: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {},
+    methods: {
+      /* 搜索 */
+      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>

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

@@ -0,0 +1,239 @@
+<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"> </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>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-finished"
+            @click="openEdit('clone', row)"
+            v-if="$hasPermission('main:ruleinfo:saveOrEdit')"
+          >
+            克隆
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('edit', row)"
+            v-if="$hasPermission('main:ruleinfo:saveOrEdit')"
+          >
+            修改
+          </el-link>
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除此条数据吗?"
+            @confirm="remove(row)"
+            v-if="$hasPermission('main:ruleinfo:delete')"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </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'],
+    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);
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 230,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        // 加载状态
+        loading: false,
+        pageType: 'add',
+        dialogTitle: '',
+        pageSize: this.$store.state.tablePageSize,
+        cacheKeyUrl: '0c40331c-rulesManagement-matterRules',
+        visible: false,
+        selection: [],
+        produceTaskOptions: []
+      };
+    },
+    computed: {},
+    created() {
+      this.requestDict('规则周期');
+      this.requestDict('规则类型');
+      this.requestDict('规则状态');
+    },
+    methods: {
+      open(selection = []) {
+        this.visible = true;
+        this.selection = selection;
+      },
+      updateVisible(val) {
+        this.visible = val;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return getList({ pageNum: page, size: limit, ...where });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+
+      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>

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

@@ -0,0 +1,82 @@
+<!-- 搜索表单 -->
+<template>
+  <seekPage :seekList="seekList" :formLength="4" @search="search"></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>

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

@@ -0,0 +1,204 @@
+<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: []
+      };
+    },
+    created() {
+      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, ...where });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.tableRef?.reload({ page: 1, where });
+      },
+      confirmSelection() {
+        this.$emit('chooseRules', this.selection);
+        this.visible = false;
+      }
+    }
+  };
+</script>

+ 4 - 1
src/enum/dict.js

@@ -75,7 +75,10 @@ export default {
   物品机型: 'product_model_key',
   物品颜色: 'product_color_key',
   记录规则类型: 'record_sheet',
-  记录规则频率: 'record_rules_frequency'
+  记录规则频率: 'record_rules_frequency',
+  记录规则报工类型: 'record_rules_report_work_type',
+  记录规则执行方式: 'record_rules_execute_method',
+  记录规则事项类型: 'record_rules_item_type'
 };
 
 export const numberList = [

+ 14 - 2
src/views/technology/production/components/user-edit.vue

@@ -83,8 +83,7 @@
         <el-col :span="8">
           <el-form-item label="附件上传:" prop="sort">
             <!-- <fileUpload v-model="form.files"></fileUpload> -->
-            <fileMain v-model="form.files" ></fileMain>
-
+            <fileMain v-model="form.files"></fileMain>
           </el-form-item>
         </el-col>
       </el-row>
@@ -486,6 +485,18 @@
             </el-radio-group>
           </el-form-item>
         </el-col>
+        <el-col :span="12">
+          <el-form-item label="是否限制产前准备后再报工:" label-width="200px">
+            <el-radio-group v-model="form.isPrenatalPreProduction">
+              <el-radio
+                :label="item.value"
+                v-for="(item, i) in radioList"
+                :key="i"
+                >{{ item.name }}</el-radio
+              >
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
       </el-row>
     </el-form>
 
@@ -552,6 +563,7 @@
           feedNeedMeasuringEquipment: '',
           feedNeedQuality: '',
           isReportProcessProduce: '',
+          isPrenatalPreProduction: '',
           sort: null,
           intervalTime: {
             nextShortPreTime: '', // 时间单位转换后的下一个短周期的时间,格式为YYYY-MM-DDTHH'

+ 320 - 0
src/views/technology/production/components/user-setting-matter-add.vue

@@ -0,0 +1,320 @@
+<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"
+    :before-close="handleClose"
+  >
+    <el-form
+      :model="formData"
+      v-loading="dialogLoading"
+      ref="formRef"
+      label-width="180px"
+      :rules="rules"
+      style="width: 800px; margin: 0 auto"
+    >
+      <el-form-item label="类型" required prop="itemType">
+        <DictSelection
+          dictName="记录规则事项类型"
+          clearable
+          v-model="formData.itemType"
+          @change="itemTypeChange"
+        >
+        </DictSelection>
+      </el-form-item>
+
+      <el-form-item label="执行方式" required prop="executeMethod">
+        <DictSelection
+          dictName="记录规则执行方式"
+          clearable
+          v-model="formData.executeMethod"
+          isProhibit
+        >
+        </DictSelection>
+      </el-form-item>
+
+      <el-form-item
+        v-if="formData.itemType == '1'"
+        label="选择设备"
+        required
+        prop="deviceName"
+      >
+        <el-input
+          v-model="formData.deviceName"
+          placeholder="请选择设备"
+          size="small"
+          :readonly="true"
+        >
+          <template #append>
+            <el-button size="small" @click="selectDeviceId">选择设备</el-button>
+          </template>
+        </el-input>
+      </el-form-item>
+
+      <el-form-item v-if="formData.itemType == '3'" label="关联任务">
+        <!-- 下拉选择 -->
+        <el-select
+          placeholder="请选择关联任务"
+          filterable
+          clearable
+          style="width: 100%"
+          v-model="formData.taskId"
+        >
+          <el-option
+            v-for="task in []"
+            :key="task.id"
+            :label="task.name"
+            :value="task.id"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item
+        v-if="formData.itemType == '2'"
+        label="关联记录规则"
+        required
+        prop="rulesName"
+      >
+        <el-input
+          v-model="formData.rulesName"
+          placeholder="请选择记录规则名称"
+          size="small"
+          :readonly="true"
+        >
+          <template #append>
+            <el-button size="small" @click="selectReleaseId"
+              >选择规则</el-button
+            >
+          </template>
+        </el-input>
+      </el-form-item>
+
+      <el-form-item
+        v-if="formData.itemType == '1'"
+        label="关联事项规则"
+        required
+        prop="rulesId"
+      >
+        <el-input
+          v-model="formData.rulesName"
+          placeholder="请选择设备有关计划规则,如保养规则,巡点检规则等"
+          size="small"
+          :readonly="true"
+        >
+          <template #append>
+            <el-button size="small" @click="selectRulesId">选择规则</el-button>
+          </template>
+        </el-input>
+      </el-form-item>
+    </el-form>
+
+    <template v-slot:footer>
+      <el-button type="primary" @click="confirm"> 确定 </el-button>
+
+      <el-button @click="handleClose">取消</el-button>
+    </template>
+
+    <material-add
+      ref="deviceSelectDialog"
+      selectType="single"
+      @chooseEquipment="chooseEquipment"
+    ></material-add>
+
+    <selectMatterRules
+      ref="selectMatterRulesRef"
+      @chooseRules="chooseRules"
+    ></selectMatterRules>
+
+    <selectReleaseRules
+      ref="selectReleaseRulesRef"
+      @chooseRules="chooseReleaseRules"
+    ></selectReleaseRules>
+  </ele-modal>
+</template>
+
+<script>
+  import { produceTaskRecordRules } from '@/api/producetaskrecordrules';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import dictMixins from '@/mixins/dictMixins';
+  import rules from '@/components/bpmnProcessDesigner/src/modules/rules';
+  import MaterialAdd from '@/views/rulesManagement/components/MaterialAdd.vue';
+  import selectMatterRules from '@/components/selectMatterRules/select-matter-rules.vue';
+  import selectReleaseRules from '@/components/selectReleaseRules/select-release-rules.vue';
+
+  export default {
+    name: 'UserSettingMatter',
+    mixins: [dictMixins, tableColumnsMixin],
+    emits: ['addMatter', 'editMatter'],
+    components: {
+      MaterialAdd,
+      selectMatterRules,
+      selectReleaseRules
+    },
+    data() {
+      return {
+        visible: false,
+        type: 'add', // add新增 edit编辑
+        formData: {
+          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,根据事项类型区分
+          rulesId: null,
+          // 	规则名称
+          rulesName: '',
+          // 任务id
+          taskId: null
+        },
+        // 表单验证规则
+        rules: {
+          // 验证类型、执行方式、设备、关联事项规则
+          executeMethod: [
+            { required: true, message: '请选择执行方式', trigger: 'change' }
+          ],
+          itemType: [
+            { required: true, message: '请选择事项类型', trigger: 'change' },
+            { required: true, message: '请选择事项类型', trigger: 'blur' }
+          ],
+          deviceName: [
+            { required: true, message: '请选择设备', trigger: 'change' },
+            { required: true, message: '请选择设备', trigger: 'blur' }
+          ],
+          rulesName: [
+            {
+              required: true,
+              message: '请选择关联事项规则',
+              trigger: 'change'
+            },
+            { required: true, message: '请选择关联事项规则', trigger: 'blur' }
+          ]
+        },
+        // 记录规则报工类型
+        reportWorkTypeOptions: [],
+        // 记录规则执行方式,参考字典项:record_rules_execute_method
+        executeMethodOptions: [],
+        // 记录规则事项类型,参考字典项:record_rules_item_type
+        itemTypeOptions: [],
+        dialogLoading: false
+      };
+    },
+    methods: {
+      itemTypeChange() {
+        this.formData.executeMethod = this.formData.itemType;
+        this.formData.rulesId = null;
+        this.formData.rulesName = '';
+      },
+      updateVisible(val) {
+        this.visible = val;
+      },
+      openAdd() {
+        this.type = 'add';
+        this.visible = true;
+      },
+      openEdit(row) {
+        console.log('row', row);
+        this.type = 'edit';
+        this.visible = true;
+        this.$util.assignObject(this.formData, row);
+        this.formData.executeMethod = row.executeMethod + '';
+        this.formData.itemType = row.itemType + '';
+        this.formData.reportWorkType = row.reportWorkType + '';
+        console.log('this.formData', this.formData);
+      },
+      // 去选择设备
+      selectDeviceId() {
+        this.$refs.deviceSelectDialog.open([]);
+      },
+      chooseEquipment(data, index, categoryId) {
+        console.log('data', data, index, categoryId);
+        this.formData.deviceId = data[0]?.id || null;
+        this.formData.deviceName = data[0]?.name || '';
+        if (this.rules && this.rules.length > 1) {
+          // 提示用户选择的规则有多个事项规则
+          this.$message.warning('所选设备包含多个设备,请注意选择');
+        }
+      },
+      // 去选择事项规则
+      selectRulesId() {
+        this.$refs.selectMatterRulesRef.open();
+      },
+      confirm() {
+        console.log('this.formData', this.formData);
+        // 验证表单
+        this.$refs.formRef.validate((valid) => {
+          if (valid) {
+            if (this.type == 'add') {
+              this.$emit('addMatter', this.formData);
+            } else {
+              this.$emit('editMatter', this.formData);
+            }
+            this.handleClose();
+          }
+        });
+      },
+      // 选择规则
+      chooseRules(rules) {
+        console.log('rules', rules);
+        this.formData.rulesId = rules[0]?.id || null;
+        this.formData.rulesName = rules[0]?.name || '';
+      },
+      // 关闭清空formData
+      handleClose() {
+        this.visible = false;
+        this.formData = {
+          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,根据事项类型区分
+          rulesId: null,
+          // 	规则名称
+          rulesName: '',
+          // 任务id
+          taskId: null
+        };
+        this.$nextTick(() => {
+          this.$refs.formRef.clearValidate();
+        });
+      },
+      // 去选择记录规则
+      selectReleaseId() {
+        this.$refs.selectReleaseRulesRef.open();
+      },
+      // 选择记录规则
+      chooseReleaseRules(rules) {
+        console.log('rules', rules);
+        this.formData.rulesId = rules[0]?.id || null;
+        this.formData.rulesName = rules[0]?.name || '';
+        if (this.rules && this.rules.length > 1) {
+          // 提示用户选择的规则有多个事项规则
+          this.$message.warning('所选记录规则包含多个事项规则,请注意选择');
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped></style>

+ 284 - 0
src/views/technology/production/components/user-setting-matter.vue

@@ -0,0 +1,284 @@
+<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"
+    :before-close="handleClose"
+    width="60%"
+  >
+    <el-tabs v-model="reportWorkType" type="card">
+      <el-tab-pane
+        v-for="i in this.dict['record_rules_report_work_type']"
+        :label="i.dictValue"
+        :name="i.dictCode"
+        :key="i.dictCode"
+      ></el-tab-pane>
+    </el-tabs>
+    <div style="margin: 10px 0"></div>
+    <ele-pro-table
+      ref="table"
+      :columns="bankColumns"
+      :datasource="datasource"
+      :need-page="false"
+      class="table_list"
+    >
+      <template v-slot:toolbar>
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-plus"
+          class="ele-btn-icon"
+          @click="openAddMatter"
+        >
+          新建
+        </el-button>
+      </template>
+
+      <!-- 操作列 -->
+      <template v-slot:action="{ row }">
+        <el-popconfirm
+          class="ele-action"
+          title="确定要删除此事项吗?"
+          @confirm="delMatter(row)"
+        >
+          <template v-slot:reference>
+            <el-link type="danger" :underline="false" icon="el-icon-delete">
+              删除
+            </el-link>
+          </template>
+        </el-popconfirm>
+
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-edit"
+          @click="openEditMatter(row)"
+        >
+          详情
+        </el-link>
+      </template>
+    </ele-pro-table>
+
+    <template v-slot:footer>
+      <el-button type="primary" @click="saveMatterList" :loading="butLoading">
+        确定
+      </el-button>
+
+      <el-button @click="handleClose">取消</el-button>
+    </template>
+
+    <userSettingMatterAdd
+      ref="userSettingMatterAddRef"
+      @addMatter="addMatter"
+      @editMatter="editMatter"
+    />
+  </ele-modal>
+</template>
+
+<script>
+  import {
+    produceTaskRecordRules,
+    produceTaskRecordRulesBatchSave
+  } from '@/api/producetaskrecordrules';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import dictMixins from '@/mixins/dictMixins';
+  import userSettingMatterAdd from './user-setting-matter-add.vue';
+  import { mapGetters } from 'vuex';
+  import { addMaterial } from '@/api/material/list';
+
+  export default {
+    name: 'UserSettingMatter',
+    mixins: [dictMixins, tableColumnsMixin],
+    components: { userSettingMatterAdd },
+    data() {
+      return {
+        visible: false,
+        // 	记录规则报工类型 产前、过程、产后
+        reportWorkType: '1',
+        // 事项列表
+        matterList: [],
+        // 表格列
+        bankColumns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center'
+          },
+          {
+            prop: 'itemType',
+            label: '类型',
+            align: 'center',
+            formatter: (row) => {
+              return this.getDictValue('记录规则事项类型', row.itemType);
+            }
+          },
+          {
+            prop: 'executeMethod',
+            label: '执行方式',
+            align: 'center',
+            formatter: (row) => {
+              return this.getDictValue('记录规则执行方式', row.executeMethod);
+            }
+          },
+          {
+            prop: 'rulesName',
+            label: '名称',
+            align: 'center'
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            slot: 'action'
+          }
+        ],
+        // 当前行数据
+        currentRow: null,
+        // 添加事项列表
+        addPOs: [],
+        deletedIds: [],
+        updatePOs: [],
+        butLoading: false
+      };
+    },
+    computed: {
+      ...mapGetters(['dict']),
+      // 根据报工类型过滤事项
+      datasource() {
+        return this.matterList.filter(
+          (item) => item.reportWorkType == this.reportWorkType
+        );
+      }
+    },
+    created() {},
+    methods: {
+      updateVisible(val) {
+        this.visible = val;
+      },
+      openSetting(row) {
+        console.log('row', row);
+        this.currentRow = row;
+        this.visible = true;
+        this.getMatterList(row);
+      },
+      // 查询事项数据
+      async getMatterList() {
+        const { list } = await produceTaskRecordRules({
+          produceTaskId: this.currentRow.id
+          // reportWorkType: this.reportWorkType
+        });
+        console.log('list', list);
+        // 表格数据
+        this.matterList = list;
+      },
+      // 删除事项
+      async delMatter(row) {
+        // 事项列表过滤
+        this.matterList = this.matterList.filter((item) => item.id !== row.id);
+        // 如果是临时id,直接前端删除
+        if (row.id.includes('tem')) {
+          this.addPOs = this.addPOs.filter((item) => item.id !== row.id);
+        } else {
+          this.deletedIds.push(row.id);
+        }
+        // updatePOs 过滤
+        this.updatePOs = this.updatePOs.filter((item) => item.id !== row.id);
+      },
+      // 打开添加事项
+      openAddMatter() {
+        this.$refs.userSettingMatterAddRef.openAdd();
+      },
+      openEditMatter(row) {
+        this.$refs.userSettingMatterAddRef.openEdit(row);
+      },
+      addMatter(matter) {
+        console.log('matter', matter);
+        const id = 'tem' + new Date().getTime();
+        // 添加事项
+        this.matterList.push({
+          ...matter,
+          id: id,
+          produceTaskId: this.currentRow.id,
+          reportWorkType: this.reportWorkType
+        });
+        this.addPOs.push({
+          ...matter,
+          id: id,
+          produceTaskId: this.currentRow.id,
+          reportWorkType: this.reportWorkType
+        });
+      },
+      editMatter(matter) {
+        console.log('matter', matter);
+        // 编辑事项
+        this.matterList = this.matterList.map((item) => {
+          if (item.id === matter.id) {
+            return {
+              ...item,
+              ...matter
+            };
+          }
+          return item;
+        });
+        // 如果不是临时id,加入updatePOs
+        if (!matter.id.includes('tem')) {
+          // 先过滤掉之前的
+          this.updatePOs = this.updatePOs.filter(
+            (item) => item.id !== matter.id
+          );
+          this.updatePOs.push({
+            ...matter,
+            produceTaskId: this.currentRow.id,
+            reportWorkType: this.reportWorkType
+          });
+        } else {
+          // 如果是临时id,直接更新addPOs
+          this.addPOs = this.addPOs.map((item) => {
+            if (item.id === matter.id) {
+              return {
+                ...item,
+                ...matter
+              };
+            }
+            return item;
+          });
+        }
+      },
+      // 确定保存事项
+      async saveMatterList() {
+        console.log('this.matterList', this.matterList);
+        try {
+          this.butLoading = true;
+          await produceTaskRecordRulesBatchSave({
+            addPOs: this.addPOs,
+            deletedIds: this.deletedIds,
+            produceTaskId: this.currentRow.id,
+            updatePOs: this.updatePOs
+          });
+          this.$message.success('保存成功');
+          this.handleClose();
+          this.butLoading = false;
+        } catch (error) {
+          this.butLoading = false;
+        }
+      },
+      // 关闭弹窗、清空数据
+      handleClose() {
+        this.visible = false;
+        this.matterList = [];
+        this.addPOs = [];
+        this.deletedIds = [];
+        this.updatePOs = [];
+        this.butLoading = false;
+        this.reportWorkType = '1';
+      }
+    }
+  };
+</script>
+
+<style scoped></style>

+ 32 - 3
src/views/technology/production/index.vue

@@ -83,7 +83,12 @@
           >
             修改
           </el-link>
-          <!-- <el-link type="primary" :underline="false" icon="el-icon-setting" @click="openSetting(row)">
+          <!-- <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-setting"
+            @click="openSetting(row)"
+          >
             配置工艺参数
           </el-link> -->
 
@@ -99,9 +104,19 @@
               </el-link>
             </template>
           </el-popconfirm>
+
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-setting"
+            @click="openSettingMatter(row)"
+          >
+            配置事项
+          </el-link>
         </template>
       </ele-pro-table>
     </el-card>
+
     <!-- 编辑弹窗 -->
     <user-edit
       :visible.sync="showEdit"
@@ -111,6 +126,7 @@
       ref="userEdit"
       :typeList="typeList"
     />
+
     <!-- 配置工艺参数 -->
     <user-setting
       :visible.sync="showSetting"
@@ -132,6 +148,9 @@
       @success="reload"
     />
 
+    <!-- 配置事项 -->
+    <userSettingMatter ref="userSettingMatterRef" />
+
     <WorkCenter ref="centerRefs" @changeCenter="determineChoose" />
   </div>
 </template>
@@ -147,17 +166,20 @@
   import importDialog from '@/components/upload/comm-dialog.vue';
   import work from '@/api/technology/work';
   import WorkCenter from './components/WorkCenter.vue';
+  import userSettingMatter from './components/user-setting-matter.vue';
+  import dictMixins from '@/mixins/dictMixins';
 
   export default {
     name: 'technologyProduction',
-    mixins: [tabMixins],
+    mixins: [tabMixins, dictMixins],
     components: {
       UserSearch,
       UserEdit,
       UserSetting,
       SampleParam,
       importDialog,
-      WorkCenter
+      WorkCenter,
+      userSettingMatter
     },
     data() {
       return {
@@ -317,8 +339,15 @@
     created() {
       this.getControlList();
       this.getListWorkCenter();
+      this.requestDict('记录规则报工类型');
+      this.requestDict('记录规则执行方式');
+      this.requestDict('记录规则事项类型');
     },
     methods: {
+      openSettingMatter(row) {
+        this.$refs.userSettingMatterRef.openSetting(row);
+      },
+
       typeLabel(type) {
         return (
           this.typeList.find((m) => m.value == type) &&