695593266@qq.com 6 сар өмнө
parent
commit
2c93e3c487

+ 2 - 0
src/views/material/BOMmanage/components/standardOutput.vue

@@ -39,6 +39,7 @@
             row-key="id"
             height="calc(100vh - 350px)"
             class="dict-table"
+            :cacheKey="cacheKeyUrl"
           >
             <template v-slot:componentAttribute="{ row }">
               <div>
@@ -253,6 +254,7 @@
 
         treeList: [],
         treeLoading: false,
+        cacheKeyUrl: 'standardOutputKey',
 
         defaultProps: {
           children: 'children',

+ 427 - 0
src/views/technology/production/components/productionCheck.vue

@@ -0,0 +1,427 @@
+<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 tabPaneList"
+        :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"
+      row-key="id"
+      cache-key="user-setting-matter-2510241427"
+      @refresh="getMatterList"
+    >
+      <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-view"
+          @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: 'produceTaskName',
+            label: '工序名称',
+            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',
+            formatter: (row) => {
+              return row.rulesName || row.itemTaskName || row.planConfigName;
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            slot: 'action'
+          }
+        ],
+        // 配置工序数据
+        currentRows: [],
+        // 添加事项列表
+        addPOs: [],
+        deletedIds: [],
+        updatePOs: [],
+        butLoading: false,
+        tabList: [
+          {
+            dictValue: '生产计划',
+            dictCode: '1'
+          },
+          {
+            dictValue: '生产订单',
+            dictCode: '2'
+          },
+          {
+            dictValue: '生产工单',
+            dictCode: '3'
+          }
+        ]
+      };
+    },
+    computed: {
+      ...mapGetters(['dict']),
+      // 根据报工类型过滤事项
+      datasource() {
+        return this.matterList.filter(
+          (item) => item.reportWorkType == this.reportWorkType
+        );
+      },
+      tabPaneList() {
+        return this.tabList;
+        // const list = this.dict['record_rules_report_work_type'] || [];
+        // // 排除过程控制
+        // return list.filter(
+        //   (item) => item.dictCode != '2' && item.dictCode != '4'
+        // );
+        // return list;
+      }
+    },
+    created() {},
+    methods: {
+      updateVisible(val) {
+        this.visible = val;
+      },
+      openSetting(rows) {
+        console.log('rows', rows);
+
+        if (Array.isArray(rows)) {
+          this.currentRows = rows;
+        } else {
+          this.currentRows = [rows];
+        }
+
+        this.visible = true;
+        this.getMatterList();
+        // if (rows.length > 1) {
+        //   this.bankColumns.splice(1, 0, {
+        //     prop: 'produceTaskName',
+        //     label: '工序名称',
+        //     align: 'center'
+        //   });
+        // } else {
+        //   this.bankColumns = this.bankColumns.filter(
+        //     (col) => col.prop !== 'produceTaskName'
+        //   );
+        // }
+      },
+      // 查询事项数据
+      async getMatterList() {
+        const { list } = await produceTaskRecordRules({
+          produceTaskIds: this.currentRows.map((row) => row.id),
+          pageNum: 1,
+          size: 9999,
+          reportWorkTypes: [1, 3]
+        });
+        console.log('list', list);
+        // 表格数据
+        this.matterList = list;
+      },
+      // 删除事项
+      async delMatter(row) {
+        if (row.isUsing) {
+          return this.$message.warning('事项正在使用中,无法删除');
+        }
+
+        // 事项列表过滤
+        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(this.reportWorkType);
+      },
+      openEditMatter(row) {
+        this.$refs.userSettingMatterAddRef.openEdit(row, 'details');
+      },
+      addMatter(matter) {
+        console.log('matter', matter);
+        const id = 'tem' + new Date().getTime();
+
+        const msgList = [];
+        const className = this.getDictValue(
+          '记录规则类型',
+          matter.recordRulesClassify
+        );
+
+        // 添加事项
+        this.currentRows.forEach((task) => {
+          // 判断是否存在同一分类
+          const exists = this.matterList
+            .filter((item) => item.reportWorkType == this.reportWorkType)
+            .some((item) => {
+              if (item.itemType == 1) {
+                return (
+                  item.planConfigId == matter.planConfigId &&
+                  item.produceTaskId == task.id
+                );
+              } else if (item.itemType == 2 && item.executeMethod == 2) {
+                return (
+                  item.recordRulesClassify == matter.recordRulesClassify &&
+                  item.produceTaskId == task.id
+                );
+              } else if (item.itemType == 2 && item.executeMethod == 1) {
+                return (
+                  item.planConfigId == matter.planConfigId &&
+                  item.produceTaskId == task.id
+                );
+              } else {
+                return (
+                  item.itemTaskName == matter.itemTaskName &&
+                  item.produceTaskId == task.id
+                );
+              }
+            });
+
+          // 记录规则不能重复 计划规则 和 任务确认可以重复
+          if (!exists) {
+            this.matterList.push({
+              ...matter,
+              id: id + task.id,
+              produceTaskId: task.id,
+              produceTaskName: task.name,
+              reportWorkType: this.reportWorkType
+            });
+            this.addPOs.push({
+              ...matter,
+              id: id + task.id,
+              produceTaskId: task.id,
+              produceTaskName: task.name,
+              reportWorkType: this.reportWorkType
+            });
+          } else {
+            let msg = '';
+            if (matter.itemType == 1) {
+              msg = `计划规则【${matter.planConfigName}】`;
+            } else if (matter.itemType == 2 && matter.executeMethod == 2) {
+              msg = `分类规则【${className || ''}】`;
+            } else if (matter.itemType == 2 && matter.executeMethod == 1) {
+              msg = `记录计划【${matter.planConfigName}】`;
+            } else {
+              msg = `任务确认【${matter.itemTaskName}】`;
+            }
+            // 记录重复信息
+            msgList.push({ taskName: task.name, msg: msg });
+          }
+        });
+
+        if (msgList.length > 0) {
+          this.$message.warning(`部分工序已存在${msgList[0].msg}`);
+        }
+
+        this.handleSort();
+      },
+      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
+          });
+        } else {
+          // 如果是临时id,直接更新addPOs
+          this.addPOs = this.addPOs.map((item) => {
+            if (item.id === matter.id) {
+              return {
+                ...item,
+                ...matter
+              };
+            }
+            return item;
+          });
+        }
+        this.handleSort();
+      },
+      // 事项排序 根据matterList的顺序
+      handleSort() {
+        this.matterList = this.matterList.map((item, index) => {
+          item.sortNum = index;
+          return item;
+        });
+        this.addPOs = this.addPOs.map((item) => {
+          const matter = this.matterList.find((m) => m.id === item.id);
+          if (matter) {
+            return {
+              ...item,
+              sortNum: matter.sortNum
+            };
+          }
+          return item;
+        });
+        this.updatePOs = this.updatePOs.map((item) => {
+          const matter = this.matterList.find((m) => m.id === item.id);
+          if (matter) {
+            return {
+              ...item,
+              sortNum: matter.sortNum
+            };
+          }
+          return item;
+        });
+      },
+      // 确定保存事项
+      async saveMatterList() {
+        console.log('this.matterList', this.matterList);
+        try {
+          this.butLoading = true;
+
+          await produceTaskRecordRulesBatchSave({
+            addPOs: this.addPOs,
+            deletedIds: this.deletedIds,
+            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>

+ 38 - 10
src/views/technology/production/index.vue

@@ -58,7 +58,7 @@
           >
             批量修改工作中心
           </el-button>
-          <el-button
+          <!-- <el-button
             v-if="$hasPermission('main:producetask:pre_after_config_item')"
             size="small"
             type="primary"
@@ -66,23 +66,25 @@
             @click="batchSettingMatter"
           >
             生产前生产后配置
-          </el-button>
-          <!-- <el-button
+          </el-button> -->
+
+          <el-button
             size="small"
             type="primary"
             class="ele-btn-icon"
-            @click="bingdingUser"
+            @click="productionPreparation"
           >
-            绑定人员
+            生产前准备
           </el-button>
+
           <el-button
             size="small"
             type="primary"
             class="ele-btn-icon"
-            @click="bingdingWork"
+            @click="productionInspection"
           >
-            绑定任务
-          </el-button> -->
+            生产后检查
+          </el-button>
         </template>
 
         <template v-slot:name="{ row }">
@@ -184,6 +186,9 @@
     <!-- 配置事项 产前准备 产后检查-->
     <userSettingMatter ref="userSettingMatterRef" />
 
+    <!-- 产前准备 产后检查 -->
+    <production-check ref="productionCheckRef"></production-check>
+
     <WorkCenter ref="centerRefs" @changeCenter="determineChoose" />
 
     <!-- 配置事项 过程控制 -->
@@ -207,6 +212,7 @@
   import userSettingMatter from './components/user-setting-matter.vue';
   import userSettingMatterProcessDrawer from './components/user-setting-matter-process-drawer.vue';
   import dictMixins from '@/mixins/dictMixins';
+  import productionCheck from './components/productionCheck.vue';
 
   export default {
     name: 'technologyProduction',
@@ -219,7 +225,8 @@
       importDialog,
       WorkCenter,
       userSettingMatter,
-      userSettingMatterProcessDrawer
+      userSettingMatterProcessDrawer,
+      productionCheck
     },
     data() {
       return {
@@ -407,11 +414,32 @@
       // 批量配置事项
       batchSettingMatter() {
         if (this.selection.length == 0) {
-          this.$message.error('请至少选择一条数据');
+          this.$message.warning('请至少选择一条数据');
           return;
         }
         this.$refs.userSettingMatterRef.openSetting(this.selection);
       },
+
+      //生产前准备
+      productionPreparation() {
+        if (this.selection.length == 0) {
+          this.$message.warning('请至少选择一条数据');
+          return;
+        }
+
+        this.$refs.productionCheckRef.openSetting(this.selection);
+      },
+
+      //生产后检查
+      productionInspection() {
+        if (this.selection.length == 0) {
+          this.$message.warning('请至少选择一条数据');
+          return;
+        }
+
+        this.$refs.productionCheckRef.openSetting(this.selection);
+      },
+
       openSettingMatterProcess(row) {
         this.$refs.userSettingMatterProcessDrawerRef.open(row);
       },

+ 9 - 4
src/views/technology/route/components/user-taskinstance.vue

@@ -204,6 +204,10 @@
         visible: true,
         showEdit: false,
         typeList: [
+          {
+            value: 99,
+            label: '关键工序'
+          },
           {
             value: 1,
             label: '普通工序'
@@ -368,11 +372,12 @@
           });
 
           console.log(res, '_________res');
-          let arr = res?.list?.map((it) => {
-            it.detail.orderNum = it.orderNum;
+          let arr =
+            res?.list?.map((it) => {
+              it.detail.orderNum = it.orderNum;
 
-            return it.detail;
-          })||[];
+              return it.detail;
+            }) || [];
 
           this.$refs.table.setData([...arr]);
         }

+ 2 - 2
vue.config.js

@@ -37,13 +37,13 @@ module.exports = {
         // target: 'http://192.168.1.176:18086',
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
-        // target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.125: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.251:18086',
+        // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.11:18086', // 开发
         // target: 'http://192.168.1.116:18086', // 赵沙金