Pārlūkot izejas kodu

新增计划审批

695593266@qq.com 8 mēneši atpakaļ
vecāks
revīzija
f7de3d92bf

+ 30 - 0
src/api/bpm/components/producePlan/index.js

@@ -0,0 +1,30 @@
+import request from '@/utils/request';
+/**
+ * 基本信息
+ */
+export async function getById(id) {
+  console.log(id);
+  const res = await request.get(`/aps/productionplan/getById/` + id);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 提交
+export async function submit(data) {
+  const res = await request.post(`/bpm/apsproduceplan/submit`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//驳回
+export async function planNotPass(data) {
+  const res = await request.put(`/bpm/apsproduceplan/notPass`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 334 - 0
src/views/bpm/handleTask/components/producePlan/detailDialog.vue

@@ -0,0 +1,334 @@
+<template>
+  <div style="margin-top: 20px">
+    <el-form
+      v-if="details"
+      ref="formRef"
+      :model="form"
+      :rules="rules"
+      label-width="130px"
+      v-loading="loading"
+    >
+      <header-title title="订单生产计划信息"></header-title>
+      <el-row style="margin-bottom: 20px">
+        <el-col :span="8">
+          <el-form-item label="计划编号">
+            <el-input :value="details.code" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划类型">
+            <el-input :value="planType" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="产品编码">
+            <el-input :value="details.productCode" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="批次号">
+            <el-input :value="details.batchNo" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="牌号">
+            <el-input :value="details.brandNo" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="规格">
+            <el-input :value="details.specification" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="型号">
+            <el-input :value="details.model" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="销售单数量">
+            <el-input :value="details.codeNum" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="生产类型">
+            <el-input :value="details.produceVersionName" disabled> </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="工艺路线">
+            <el-input :value="details.produceRoutingName" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="订单总数量">
+            <el-input :value="details.contractNum" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="订单重量">
+            <el-input :value="details.sumOrderWeight" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="要求生产数量">
+            <el-input :value="details.requiredFormingNum" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="要求生产重量">
+            <el-input :value="details.newSumOrderWeight" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划开始日期">
+            <el-input :value="details.startTime" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划结束日期">
+            <el-input :value="details.endTime" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="要求完成日期">
+            <el-input :value="details.reqMoldTime" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="所属工厂">
+            <el-input :value="details.factoriesIdName" disabled></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import { getById } from '@/api/bpm/components/producePlan';
+  // import { getById as maintenanceGetById } from '@/api/maintenance/patrol_maintenance.js';
+  import { getUserPage } from '@/api/system/organization';
+
+  export default {
+    name: 'editModal',
+    mixins: [dictMixins],
+    props: {
+      // 业务id
+      businessId: {
+        default: ''
+      }
+    },
+    data() {
+      const formBaseData = {
+        username: '',
+        email: ''
+      };
+
+      return {
+        visible: false,
+        title: '表单弹窗',
+        formBaseData,
+        form: JSON.parse(JSON.stringify(formBaseData)),
+        rules: {},
+        tabOptions: [
+          { key: 'main', name: '记录表1' },
+          { key: 'bpm', name: '流程详情2' }
+        ],
+        // 详情或者是审核
+        type: 'detail',
+        // 当前选项
+        activeComp: 'main',
+        details: null,
+        loading: false,
+        // 计划信息
+        eamPlanInfo: null,
+        // 事项规则相关数据
+        // 负责人
+        executorList: [],
+        // 审核人
+        uerList: [],
+        deviceList: [],
+        // ruleInfo
+        ruleInfo: '',
+        planTypeList: [],
+        planType: ''
+      };
+    },
+    mounted() {
+      this.getPlanTypeList('plan_type');
+      setTimeout(() => {
+        this.getDatails(this.businessId);
+      }, 500);
+    },
+    methods: {
+      // 关闭时清理表单
+      handleClose() {
+        this.visible = false;
+      },
+
+      async getPlanTypeList(code) {
+        let { data: res } = await getByCode(code);
+
+        this.planTypeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+
+      // 获取详情
+      async getDatails(id) {
+        try {
+          this.loading = true;
+          const data = await getById(id);
+          console.log('data 详情数据', data);
+          this.details = data;
+          const typeData = this.planTypeList.find(
+            (it) => it.value == this.details.planType
+          );
+          if ((Object.keys(typeData).length = !0)) {
+            this.planType = typeData.label;
+          }
+          this.loading = false;
+        } catch (error) {
+          this.loading = false;
+        }
+      },
+      showCheckUserNames(userList) {
+        if (userList.length == 0) return '';
+
+        return userList
+          .map((i) => {
+            return i.groupName + '-' + i.userName;
+          })
+          .join(',');
+      },
+      // 事项规则 详情
+      async maintenanceGetById(id) {
+        const { data } = await maintenanceGetById(id);
+        console.log('事项规则 data', data);
+        data.executorId = data.executorId.split(',');
+        this.eamPlanInfo = data;
+        this.getUserList({ groupId: data.groupId });
+
+        this.ruleInfo = data.ruleInfo;
+        this.ruleInfo.ruleItems = data.planDeviceList[0]?.workItems || [];
+
+        this.deviceList = data.planDeviceList.map((item) => {
+          return {
+            name: item.substance.name,
+            position: item.substance.position,
+            id: item.substance.id,
+            fixCode: item.substance.fixCode,
+            codeNumber: item.substance.codeNumber
+          };
+        });
+      },
+      // 获取审核人列表、巡点检人员
+      async getUserList(params) {
+        try {
+          let data = { pageNum: 1, size: -1 };
+          // 如果传了参数就是获取巡点检人员数据
+          if (params) {
+            data = Object.assign(data, params);
+          }
+          const res = await getUserPage(data);
+          if (params) {
+            this.executorList = res.list;
+          } else {
+            this.uerList = res.list;
+          }
+        } catch (error) {}
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .el-form-item .el-form-item {
+    margin-bottom: 0 !important;
+  }
+
+  ::v-deep .el-tab_box {
+    display: flex;
+    margin-top: 10px;
+    height: 300px;
+    width: 100%;
+
+    .equipmentList_box {
+      flex: 1;
+      height: 100%;
+      margin-right: 10px;
+      display: flex;
+      flex-direction: column;
+
+      .divider {
+        flex: 0 0 50px;
+
+        .title {
+          height: 35px;
+        }
+      }
+
+      .el-table {
+        overflow: auto;
+      }
+    }
+
+    .ruleMatters_box {
+      flex: 3;
+      height: 100%;
+      display: flex;
+      flex-direction: column;
+      overflow: hidden;
+
+      .divider {
+        flex: 0 0 50px;
+
+        .title {
+          height: 35px;
+        }
+      }
+
+      .el-table {
+        overflow: auto;
+
+        .operationGuide_box {
+          width: 100%;
+          height: 50px;
+          display: flex;
+          overflow: hidden;
+          cursor: pointer;
+
+          .left_content {
+            flex: 0 0 200px;
+            padding: 10px;
+            box-sizing: border-box;
+            border: 1px solid #c0c4cc;
+            border-radius: 10px;
+            margin-right: 10px;
+            overflow-y: auto;
+          }
+
+          .right_content {
+            flex: 1;
+            padding: 10px;
+            box-sizing: border-box;
+            border: 1px solid #c0c4cc;
+            border-radius: 10px;
+            overflow-y: auto;
+          }
+        }
+      }
+
+      .el-table::before {
+        display: none;
+      }
+    }
+  }
+</style>

+ 280 - 0
src/views/bpm/handleTask/components/producePlan/submit.vue

@@ -0,0 +1,280 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <!-- <el-form-item
+        label="技术员"
+        prop="technicianId"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+        v-if="taskDefinitionKey == 'productionSupervisorApprove1'"
+      >
+        <el-select
+          v-model="form.technicianId"
+          clearable
+          style="width: 100%"
+          :filterable="true"
+        >
+          <el-option
+            v-for="item in userOptions"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item> -->
+      <el-form-item
+        label="审批建议"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        @click="handleAudit(1)"
+        >通过
+      </el-button>
+      <!-- <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        v-if="taskDefinitionKey === 'productionSupervisorApprove1'"
+        @click="head"
+        >指派技术员
+      </el-button> -->
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        v-if="!['starter'].includes(taskDefinitionKey)"
+        >驳回
+      </el-button>
+
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link"
+          >更多<i class="el-icon-arrow-down el-icon--right"></i
+        ></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+
+      <!-- <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleBackList"
+        >退回
+      </el-button> -->
+      <!-- <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
+        >不通过
+      </el-button>
+      <el-button
+        icon="el-icon-edit-outline"
+        type="primary"
+        size="mini"
+        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
+        @click="handleUpdateAssignee"
+        >转办
+      </el-button> -->
+    </div>
+    <head-list ref="headRef" @changeParent="changePersonel"></head-list>
+  </el-col>
+</template>
+
+<script>
+  import {
+    updateTech,
+    UpdateInformation,
+    cancel
+  } from '@/api/bpm/components/saleManage/quotation';
+  import {
+    approveTaskWithVariables,
+    rejectTask,
+    cancelTask
+  } from '@/api/bpm/task';
+  import { listAllUserBind } from '@/api/system/organization';
+  import headList from '@/components/headList';
+  import { planNotPass } from '@/api/bpm/components/producePlan';
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {
+      headList
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          technicianId: '',
+          reason: ''
+        },
+        userOptions: []
+      };
+    },
+    created() {
+      this.userOptions = [];
+      listAllUserBind().then((data) => {
+        this.userOptions.push(...data);
+      });
+    },
+    methods: {
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+      head() {
+        this.$refs.headRef.open();
+      },
+      changePersonel(data) {
+        this.form.technicianId = data.id;
+        this.handleAudit(1, 'zp');
+      },
+      async handleAudit(status, type) {
+        //生产主管审批选择技术员
+        // if (this.taskDefinitionKey === 'productionSupervisorApprove1') {
+        //   if (!this.form.technicianId && type == 'zp') {
+        //     this.$message.warning(`请选择技术人员!`);
+        //     return;
+        //   }
+        // }
+        //技术员修改
+        // if (this.taskDefinitionKey === 'technicianApprove' && status === 1) {
+        //   let data = await this.getTableValue();
+        //   if (!arr) {
+        //     return;
+        //   }
+        //   let arr = data.map((item) => {
+        //     return {
+        //       id: item.id,
+        //       technicalAnswerId: item.technicalAnswerId,
+        //       technicalAnswerName: item.technicalAnswerName,
+        //       technicalDrawings: item.technicalDrawings,
+        //       technicalParams: item.technicalParams
+        //     };
+        //   });
+        //   try {
+        //     await updateTech(arr);
+        //   } catch (error) {}
+        // }
+        //销售员补充
+        // if (
+        //   (this.taskDefinitionKey === 'salesmanApprove' ||
+        //     this.taskDefinitionKey === 'starter') &&
+        //   status === 1
+        // ) {
+        //   let arr = await this.getTableValue();
+        //   if (!arr) {
+        //     return;
+        //   }
+        //   let data = await UpdateInformation(arr);
+        //   if (data.code != '0') {
+        //     return;
+        //   }
+        // }
+        this._approveTaskWithVariables(status, this.form.technicianId, type);
+      },
+      async _approveTaskWithVariables(status, technicianId, type) {
+        let variables = {
+          pass: !!status
+        };
+        if (technicianId && type == 'zp') {
+          variables['technicianId'] = technicianId;
+        }
+
+        let API = !!status ? approveTaskWithVariables : planNotPass;
+        API({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables,
+          businessId: this.businessId
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
+
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
+          });
+        });
+      },
+
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancelTask({
+                id: this.id,
+                taskId: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>