|
@@ -0,0 +1,935 @@
|
|
|
+<template>
|
|
|
+ <!-- 审核信息-->
|
|
|
+ <div class="form-examine">
|
|
|
+ <el-form :model="form" label-width="130px">
|
|
|
+ <el-row :gutter="24" v-if="!isHisExamine" style="margin: 0px;border-radius: 3px;padding: 10px;margin-bottom: 10px;">
|
|
|
+ <el-col v-if="cfgParam.isOpt ? step.stepOrder > 1 : true" :span="8">
|
|
|
+ <el-form-item label="处理结果:">
|
|
|
+ <el-select
|
|
|
+ v-model="form.headleState"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ @change="handleTypeChange"
|
|
|
+ :disabled="
|
|
|
+ cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in headleState"
|
|
|
+ :key="item.key"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.key"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col v-if="cfgParam.isOpt ? step.stepOrder > 1 : true" :span="16">
|
|
|
+ <el-form-item label="备注:">
|
|
|
+ <el-input
|
|
|
+ v-model="form.remarks"
|
|
|
+ size="small"
|
|
|
+ :disabled="
|
|
|
+ cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- v-if="(form.headleState == 1 || form.headleState == 2) && !isLastStep" -->
|
|
|
+ <!-- 显示情况:(1)当处理结果为1(通过)并且不是最后一个节点
|
|
|
+ (2)当处理结果为2 -->
|
|
|
+ <el-col
|
|
|
+ v-if="((form.headleState == 1 && !isLastStep) || (form.headleState == 2))"
|
|
|
+ :span="8"
|
|
|
+ >
|
|
|
+ <el-form-item label="下一环节:">
|
|
|
+ <el-select
|
|
|
+ v-model="form.processStep"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ @change="nextStepChange"
|
|
|
+ :disabled="
|
|
|
+ form.headleState == 2
|
|
|
+ ? true
|
|
|
+ : cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in nextSteps"
|
|
|
+ :key="item.id + ''"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id + ''"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- v-if="(form.headleState == 1 || form.headleState == 2) && !isLastStep" -->
|
|
|
+ <el-col
|
|
|
+ v-if="((form.headleState == 1 && !isLastStep) || (form.headleState == 2))"
|
|
|
+ :span="8"
|
|
|
+ >
|
|
|
+ <el-form-item label="下一环节处理部门:">
|
|
|
+ <el-select
|
|
|
+ v-model="form.dept"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ @change="nextStepDeptChange"
|
|
|
+ :disabled="
|
|
|
+ form.headleState == 2
|
|
|
+ ? true
|
|
|
+ : cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in nextStepDepts"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- v-if="(form.headleState == 1 || form.headleState == 2) && !isLastStep" -->
|
|
|
+ <el-col
|
|
|
+ v-if="((form.headleState == 1 && !isLastStep) || (form.headleState == 2))"
|
|
|
+ :span="8"
|
|
|
+ >
|
|
|
+ <el-form-item label="下一环节处理人:">
|
|
|
+ <el-select
|
|
|
+ v-model="form.deptStaff"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ :disabled="
|
|
|
+ form.headleState == 2
|
|
|
+ ? true
|
|
|
+ : cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in nextStepStaffs"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <!-- 处理状态为驳回 -->
|
|
|
+ <el-col v-if="form.headleState == 3" :span="8">
|
|
|
+ <el-form-item label="处理部门:">
|
|
|
+ <el-select
|
|
|
+ v-model="form.dept"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ @change="curStepDeptChange"
|
|
|
+ :disabled="
|
|
|
+ cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in curStepDepts"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- 处理状态为驳回 -->
|
|
|
+ <el-col v-if="form.headleState == 3" :span="8">
|
|
|
+ <el-form-item label="处理人员:">
|
|
|
+ <el-select
|
|
|
+ v-model="form.deptStaff"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ :disabled="
|
|
|
+ cfgParam.isOpt
|
|
|
+ ? cfgParam.optionType == 0
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ : true
|
|
|
+ "
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in curStepStaffs"
|
|
|
+ :key="item.userId"
|
|
|
+ :label="item.userName"
|
|
|
+ :value="item.userId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <!-- 处理历史 -->
|
|
|
+ <el-row
|
|
|
+ :gutter="24"
|
|
|
+ class="history"
|
|
|
+ v-for="history in examinaHistory"
|
|
|
+ :key="history.nextProcessStep + ',' + history.nextStepNode"
|
|
|
+ style="margin: 0px;border: 1px solid #e7e7e7;border-radius: 4px;padding: 10px;margin-bottom: 10px;"
|
|
|
+ >
|
|
|
+ <!-- <el-col :span="24" v-if="isHisExamine">
|
|
|
+ <div class="title"><span>处理历史</span></div>
|
|
|
+ </el-col> -->
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="处理结果:">
|
|
|
+ <el-select
|
|
|
+ v-model="history.examineState"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in nodeStates"
|
|
|
+ :key="item.key"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.key"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item label="备注:">
|
|
|
+ <el-input
|
|
|
+ v-model="history.remarks"
|
|
|
+ size="small"
|
|
|
+ disabled
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8" v-if="step.stepOrder < steps.length">
|
|
|
+ <el-form-item label="下一环节:">
|
|
|
+ <el-input
|
|
|
+ v-model="history.nextStepName"
|
|
|
+ size="small"
|
|
|
+ disabled
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="step.stepOrder < steps.length">
|
|
|
+ <el-form-item label="下一环节处理部门:">
|
|
|
+ <el-input
|
|
|
+ v-model="history.nextStepExamineDept"
|
|
|
+ size="small"
|
|
|
+ disabled
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="step.stepOrder < steps.length">
|
|
|
+ <el-form-item label="下一环节处理人:">
|
|
|
+ <el-input
|
|
|
+ v-model="history.nextStepExamineUser"
|
|
|
+ size="small"
|
|
|
+ disabled
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import blocks from "./Blocks.vue";
|
|
|
+import { config } from "./cfgOrderProcess";
|
|
|
+import { scaleAndAdd } from "zrender/lib/core/vector";
|
|
|
+export default {
|
|
|
+ components: { blocks },
|
|
|
+ props: {
|
|
|
+ /**流程配置里面参数
|
|
|
+ * 包含处理结果(处理状态)、下一环节数组、下一环节处理部门数组、下一环节处理人数组
|
|
|
+ * isOpt 是否允许操作
|
|
|
+ * handleState 流程配置中步骤节点选择的处理状态(处理方式)。字符串类型,以逗号隔开
|
|
|
+ * nextStep 下一步审核人和审核部门(最后一步为null)
|
|
|
+ */
|
|
|
+ cfgParam: {
|
|
|
+ type: Object,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 流程总步数
|
|
|
+ */
|
|
|
+ steps: {
|
|
|
+ type: Array,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 当前步骤
|
|
|
+ */
|
|
|
+ step: {
|
|
|
+ type: Object,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 流程配置信息
|
|
|
+ */
|
|
|
+ process: {
|
|
|
+ type: Object,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 所有部门和用户
|
|
|
+ */
|
|
|
+ allDeptAndUser: {
|
|
|
+ type: Array,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * s审核信息
|
|
|
+ */
|
|
|
+ editData: {
|
|
|
+ type: Object,
|
|
|
+ required: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ headleState: [],
|
|
|
+ nodeStates: [],
|
|
|
+ nextSteps: [], //下一环节(下一步)
|
|
|
+ nextStepDepts: [], //下一环节处理部门
|
|
|
+ nextStepStaffs: [], //下一环节处理人
|
|
|
+ form: {
|
|
|
+ curProcessStep: 1, //当前流程步骤,默认为1
|
|
|
+ curStepNode: 1, //当前流程步骤结点,默认为1
|
|
|
+ headleState: 1, //处理结果 默认为1(通过)
|
|
|
+ processStep: "", //下一步步骤,默认1
|
|
|
+ stepNode: 1, //下一步步骤环节,默认第一个环节
|
|
|
+ dept: "", //下一环节处理部门
|
|
|
+ deptStaff: "", //下一环节出处理
|
|
|
+ remarks: "", //备注
|
|
|
+ },
|
|
|
+ isLastStep: false, //是不是最后一步审核
|
|
|
+ curStepStaffs: [], //转派时候的被驳回人
|
|
|
+ curStepDepts: [], //转派时候的驳回部门
|
|
|
+ examinaHistory: [], //审核历史
|
|
|
+ isHisExamine: false, //只显示历史(true:只显示历史,false:都显示)
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ async created() {
|
|
|
+ //初始化处理结果选项
|
|
|
+ this.headleState = config.headleState;
|
|
|
+ this.nodeStates = config.nodeState;
|
|
|
+ if (!(JSON.stringify(this.editData) === "{}")) {
|
|
|
+ if (this.editData.processNode != 100) {
|
|
|
+ //默认传处理状态为1 通过 [{ key: 1, name: '通过' }, { key: 2, name: '驳回' }, { key: 3, name: '转派' }, { key: 4, name: '终止' }],
|
|
|
+ this.resetExamina(1);
|
|
|
+ this.init();
|
|
|
+ if (this.editData.hasOwnProperty("processNodeVos")) {
|
|
|
+ this.examinaHistory = [];
|
|
|
+ //已经审核完成的
|
|
|
+ if (this.editData.currentNode.processStep > this.step.stepOrder) {
|
|
|
+ //查询所有已经提交的
|
|
|
+ const processNode = this.editData.processNodeVos.filter(
|
|
|
+ (item) =>
|
|
|
+ //item.processStep == this.step.stepOrder && item.nodeState == 2
|
|
|
+ item.processStep == this.step.stepOrder
|
|
|
+ );
|
|
|
+ processNode.forEach((pn) => {
|
|
|
+ const next = this.editData.processNodeVos.find(
|
|
|
+ (n) => pn.id == n.upStepNode
|
|
|
+ );
|
|
|
+ const curDept = this.allDeptAndUser.find(
|
|
|
+ (a) => a.id == pn.handleDept
|
|
|
+ );
|
|
|
+
|
|
|
+ let nextDept = null;
|
|
|
+ if (next) {
|
|
|
+ nextDept = this.allDeptAndUser.find(
|
|
|
+ (a) => a.id == next.handleDept
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //当前步
|
|
|
+ const curStep = this.steps.find(
|
|
|
+ (n) => n.stepOrder == pn.processStep
|
|
|
+ );
|
|
|
+ //下一步
|
|
|
+ let nextStep = null;
|
|
|
+ if (next) {
|
|
|
+ nextStep = this.steps.find(
|
|
|
+ (n) => n.stepOrder == next.processStep
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ const nextStepName = nextStep ? nextStep.title + (next ? '(' + next.stepNode+ ')' : ''): ""
|
|
|
+
|
|
|
+ this.examinaHistory.push({
|
|
|
+ processStep: pn.processStep, //流程步骤
|
|
|
+ processStep: curStep.title,
|
|
|
+ stepNode: pn.stepNode, //流程结点
|
|
|
+ examineState: pn.nodeState, //审核状态,1通过
|
|
|
+ remarks: pn.remark, //审核意见
|
|
|
+ deptId: pn.handleDept, //审核部门
|
|
|
+ dept: curDept.name,
|
|
|
+ examineUserId: pn.handleStaff, //审核人ID
|
|
|
+ examineUser: pn.handleStaffName, //审核人
|
|
|
+ nextProcessStep: next ? next.processStep : '', //下一步
|
|
|
+ nextStepName: nextStepName,
|
|
|
+ nextStepNode: next ? next.stepNode : '', //下一步
|
|
|
+ nextStepExamineDeptId: next ? next.handleDept : '', //下一步审核部门ID
|
|
|
+ nextStepExamineDept: nextDept ? nextDept.name : "", //下一步审核部门
|
|
|
+ nextStepExamineUserId: next ? next.handleStaff : '', //下一步审核人ID
|
|
|
+ nextStepExamineUser: next ? next.handleStaffName : '', //下一步审核人
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.isHisExamine = true;
|
|
|
+ }
|
|
|
+ //审核中的
|
|
|
+ else if (
|
|
|
+ this.editData.currentNode.processStep == this.step.stepOrder
|
|
|
+ ) {
|
|
|
+ this.isHisExamine = false;
|
|
|
+ //查询所有已经提交的
|
|
|
+ const processNoded = this.editData.processNodeVos.filter(
|
|
|
+ (item) =>
|
|
|
+ item.processStep == this.step.stepOrder && item.nodeState == 2
|
|
|
+ );
|
|
|
+ //查询所有待处理的
|
|
|
+ const unprocessNode = this.editData.processNodeVos.filter(
|
|
|
+ (item) =>
|
|
|
+ item.processStep == this.step.stepOrder && item.nodeState == 0
|
|
|
+ );
|
|
|
+ //查询所有处理中
|
|
|
+ const processNodeing = this.editData.processNodeVos.filter(
|
|
|
+ (item) =>
|
|
|
+ item.processStep == this.step.stepOrder && item.nodeState == 1
|
|
|
+ );
|
|
|
+ processNoded.forEach((pn) => {
|
|
|
+ //下一步
|
|
|
+ const next = this.editData.processNodeVos.find(
|
|
|
+ (n) => pn.id == n.upStepNode
|
|
|
+ );
|
|
|
+ //当前审核部门
|
|
|
+ const curDept = this.allDeptAndUser.find(
|
|
|
+ (a) => a.id == pn.handleDept
|
|
|
+ );
|
|
|
+ //下一步审核部门
|
|
|
+ const nextDept = this.allDeptAndUser.find(
|
|
|
+ (a) => a.id == next.handleDept
|
|
|
+ );
|
|
|
+ //当前步
|
|
|
+ const curStep = this.steps.find(
|
|
|
+ (n) => n.stepOrder == pn.processStep
|
|
|
+ );
|
|
|
+ //下一步
|
|
|
+ let nextStep = null;
|
|
|
+ if (next) {
|
|
|
+ nextStep = this.steps.find(
|
|
|
+ (n) => n.stepOrder == next.processStep
|
|
|
+ );
|
|
|
+ }
|
|
|
+ const nextStepName = nextStep ? nextStep.title + (next ? '(' + next.stepNode+ ')' : ''): ""
|
|
|
+ this.examinaHistory.push({
|
|
|
+ processStep: pn.processStep, //流程步骤
|
|
|
+ processStep: curStep.title,
|
|
|
+ stepNode: pn.stepNode, //流程结点
|
|
|
+ examineState: pn.nodeState, //审核状态,1通过
|
|
|
+ remarks: pn.remark, //审核意见
|
|
|
+ deptId: pn.handleDept, //审核部门
|
|
|
+ dept: curDept ? curDept.name : "",
|
|
|
+ examineUserId: pn.handleStaff, //审核人ID
|
|
|
+ examineUser: pn.handleStaffName, //审核人
|
|
|
+ nextProcessStep: next.processStep, //下一步
|
|
|
+ nextStepName: nextStepName,
|
|
|
+ nextStepNode: next.stepNode, //下一步
|
|
|
+ nextStepExamineDeptId: next.handleDept, //下一步审核部门ID
|
|
|
+ nextStepExamineDept: nextDept ? nextDept.name : "", //下一步审核部门
|
|
|
+ nextStepExamineUserId: next.handleStaff, //下一步审核人ID
|
|
|
+ nextStepExamineUser: next.handleStaffName, //下一步审核人
|
|
|
+ });
|
|
|
+ });
|
|
|
+ if (processNodeing.length > 0) {
|
|
|
+ //this.setNextSelect()
|
|
|
+ if (unprocessNode.length > 0) {
|
|
|
+ //已保存审核信息
|
|
|
+ if (this.nextSteps.length == 1) {
|
|
|
+ this.form.processStep = this.nextSteps[0].id; //下一环节
|
|
|
+ this.nextStepChange(this.form.processStep);
|
|
|
+ this.form.dept = unprocessNode[0].handleDept; //下一环节处理部门
|
|
|
+ this.nextStepDeptChange(this.form.dept);
|
|
|
+ this.form.deptStaff = unprocessNode[0].handleStaff;
|
|
|
+ this.form.remarks = unprocessNode[0].handleResults;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.nextSteps.length == 1) {
|
|
|
+ this.form.processStep = this.nextSteps[0].id; //下一环节
|
|
|
+ this.nextStepChange(this.form.processStep);
|
|
|
+ const nextStep = this.editData.processNodeVos.find(
|
|
|
+ (pn) => pn.upStepNode == processNodeing[0].id
|
|
|
+ );
|
|
|
+ if (nextStep) {
|
|
|
+ this.form.dept = nextStep.handleDept; //下一环节处理部门
|
|
|
+ this.nextStepDeptChange(this.form.dept);
|
|
|
+ this.form.deptStaff = nextStep.handleStaff;
|
|
|
+ this.form.remarks = nextStep.handleResults;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //查询所有已经提交的
|
|
|
+ const processNode = this.editData.processNodeVos.filter(
|
|
|
+ (item) =>
|
|
|
+ //item.processStep == this.step.stepOrder && item.nodeState == 2
|
|
|
+ item.processStep == this.step.stepOrder
|
|
|
+ );
|
|
|
+ this.examinaHistory = [];
|
|
|
+ processNode.forEach((pn) => {
|
|
|
+ const next = this.editData.processNodeVos.find(
|
|
|
+ (n) => pn.id == n.upStepNode
|
|
|
+ );
|
|
|
+ const curDept = this.allDeptAndUser.find(
|
|
|
+ (a) => a.id == pn.handleDept
|
|
|
+ );
|
|
|
+ let nextDept = null;
|
|
|
+ if (next) {
|
|
|
+ nextDept = this.allDeptAndUser.find((a) => a.id == next.handleDept);
|
|
|
+ }
|
|
|
+ //当前步
|
|
|
+ const curStep = this.steps.find((n) => n.stepOrder == pn.processStep);
|
|
|
+ //下一步
|
|
|
+ let nextStep = null;
|
|
|
+ if (next) {
|
|
|
+ nextStep = this.steps.find((n) => n.stepOrder == next.processStep);
|
|
|
+ }
|
|
|
+ const nextStepName = nextStep ? nextStep.title + (next ? '(' + next.stepNode+ ')' : ''): ""
|
|
|
+ this.examinaHistory.push({
|
|
|
+ processStep: pn.processStep, //流程步骤
|
|
|
+ processStep: curStep.title,
|
|
|
+ stepNode: pn.stepNode, //流程结点
|
|
|
+ examineState: pn.nodeState, //审核状态,1通过
|
|
|
+ remarks: pn.remark, //审核意见
|
|
|
+ deptId: pn.handleDept, //审核部门
|
|
|
+ dept: curDept.name,
|
|
|
+ examineUserId: pn.handleStaff, //审核人ID
|
|
|
+ examineUser: pn.handleStaffName, //审核人
|
|
|
+ nextProcessStep: next ? next.processStep : "", //下一步
|
|
|
+ nextStepName: nextStepName,
|
|
|
+ nextStepNode: next ? next.stepNode : "", //下一步
|
|
|
+ nextStepExamineDeptId: next ? next.handleDept : "", //下一步审核部门ID
|
|
|
+ nextStepExamineDept: nextDept ? nextDept.name : "", //下一步审核部门
|
|
|
+ nextStepExamineUserId: next ? next.handleStaff : "", //下一步审核人ID
|
|
|
+ nextStepExamineUser: next ? next.handleStaffName : "", //下一步审核人
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.isHisExamine = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.isHisExamine = false;
|
|
|
+ this.resetExamina(1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ /**
|
|
|
+ * 初始化数据
|
|
|
+ */
|
|
|
+ init() {
|
|
|
+ //判断配置中是不是最后一步审核
|
|
|
+ if (JSON.stringify(this.step.nextStep) === "{}") {
|
|
|
+ this.form.curProcessStep = this.editData.currentNode.processStep;
|
|
|
+ this.form.curStepNode = this.editData.currentNode.stepNode;
|
|
|
+ this.isLastStep = true;
|
|
|
+ } else {
|
|
|
+ this.setNextSelect();
|
|
|
+ }
|
|
|
+ //获取处理状态(处理方式)重置处理方式选择控件
|
|
|
+ let handleState =
|
|
|
+ this.step.handleState != "" ? this.step.handleState.split(",") : [];
|
|
|
+ handleState = handleState.map((str) => parseInt(str));
|
|
|
+ this.headleState = this.headleState.filter(
|
|
|
+ (item) => handleState.indexOf(item.key) > -1
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理结果改变
|
|
|
+ * headleState: [{ key: 1, name: '通过' }, { key: 2, name: '驳回' }, { key: 3, name: '转派' }, { key: 4, name: '终止' }],
|
|
|
+ */
|
|
|
+ handleTypeChange(value) {
|
|
|
+ this.resetExamina(value);
|
|
|
+ },
|
|
|
+
|
|
|
+ /***
|
|
|
+ * 重置审核信息
|
|
|
+ * @handleState Number 处理状态
|
|
|
+ */
|
|
|
+ resetExamina(handleState) {
|
|
|
+ //当工单流程刚新建时
|
|
|
+ if (JSON.stringify(this.editData) === "{}") {
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.nextStep.stepOrder,
|
|
|
+ name: this.step.nextStep.stepName,
|
|
|
+ levelstaffs: this.step.nextStep.levelstaffs,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //审核过程中
|
|
|
+ const currentNode = this.editData.currentNode;
|
|
|
+ this.form.processStep = "";
|
|
|
+ this.form.dept = "";
|
|
|
+ this.form.deptStaff = "";
|
|
|
+ //获取上一步的审核信息
|
|
|
+ switch (handleState) {
|
|
|
+ case 1: //通过
|
|
|
+ //获取下一步
|
|
|
+ this.form.processStep = "";
|
|
|
+ this.form.dept = "";
|
|
|
+ this.form.deptStaff = "";
|
|
|
+ this.init();
|
|
|
+ break;
|
|
|
+ case 2: //驳回
|
|
|
+ //判断驳回方式是 按处理流程驳回(1)还是按主流程驳回(2)
|
|
|
+ if (this.process.info.reiectMode == 1) {
|
|
|
+ //按处理流程驳回 1
|
|
|
+ const upStepNode = this.editData.processNodeVos.find(
|
|
|
+ (item) => item.id == currentNode.upStepNode
|
|
|
+ );
|
|
|
+ if (upStepNode) {
|
|
|
+ const step = this.steps.find(
|
|
|
+ (p) => p.stepOrder == upStepNode.processStep
|
|
|
+ );
|
|
|
+ const levelstaffs =
|
|
|
+ step.nodes[upStepNode.stepNode - 1].levelstaffs;
|
|
|
+ this.nextSteps = [];
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: upStepNode.processStep + "," + upStepNode.stepNode,
|
|
|
+ name: step.title,
|
|
|
+ levelstaffs: levelstaffs,
|
|
|
+ });
|
|
|
+ this.form.processStep =
|
|
|
+ upStepNode.processStep + "," + upStepNode.stepNode; //下一环节
|
|
|
+ this.nextStepChange(this.form.processStep);
|
|
|
+ this.form.dept = upStepNode.handleDept; //下一环节处理部门
|
|
|
+ this.nextStepDeptChange(this.form.dept);
|
|
|
+
|
|
|
+ //如果审核人不在this.nextStepStaffs中则加进去
|
|
|
+ if (
|
|
|
+ !this.nextStepStaffs.find(
|
|
|
+ (n) => n.id == upStepNode.handleStaff
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ const dept = this.allDeptAndUser.find(
|
|
|
+ (n) => n.id == upStepNode.handleDept
|
|
|
+ );
|
|
|
+ const user = dept.users.find(
|
|
|
+ (u) => u.id == upStepNode.handleStaff
|
|
|
+ );
|
|
|
+ if (user)
|
|
|
+ this.nextStepStaffs.push({
|
|
|
+ id: user.id,
|
|
|
+ name: user.realName,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.form.deptStaff = upStepNode.handleStaff; //下一环节处理人
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //主流程驳回 2
|
|
|
+ const upStepNode = this.editData.processNodeVos.find(
|
|
|
+ (item) => item.id == currentNode.upStepNode
|
|
|
+ );
|
|
|
+ if (upStepNode) {
|
|
|
+ const step = this.steps.find(
|
|
|
+ (p) => p.stepOrder == upStepNode.processStep
|
|
|
+ );
|
|
|
+ const levelstaffs = step.nodes[0].levelstaffs;
|
|
|
+ this.nextSteps = [];
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: upStepNode.processStep + "," + 1,
|
|
|
+ name: step.title,
|
|
|
+ levelstaffs: levelstaffs,
|
|
|
+ });
|
|
|
+ this.form.processStep = upStepNode.processStep + "," + 1; //下一环节
|
|
|
+ this.nextStepChange(this.form.processStep);
|
|
|
+ this.form.dept = upStepNode.handleDept; //下一环节处理部门
|
|
|
+ this.nextStepDeptChange(this.form.dept);
|
|
|
+ //如果审核人不在this.nextStepStaffs中则加进去
|
|
|
+ if (
|
|
|
+ !this.nextStepStaffs.find(
|
|
|
+ (n) => n.id == upStepNode.handleStaff
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ const dept = this.allDeptAndUser.find(
|
|
|
+ (n) => n.id == upStepNode.handleDept
|
|
|
+ );
|
|
|
+ const user = dept.users.find(
|
|
|
+ (u) => u.id == upStepNode.handleStaff
|
|
|
+ );
|
|
|
+ if (user)
|
|
|
+ this.nextStepStaffs.push({
|
|
|
+ id: user.id,
|
|
|
+ name: user.realName,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.form.deptStaff = upStepNode.handleStaff; //下一环节处理人
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3: //转派
|
|
|
+ //当前步骤
|
|
|
+ this.curStepStaffs = []; //转派时候的处理人
|
|
|
+ this.curStepDepts = []; //转派时候的处理部门
|
|
|
+ const proStep = this.steps.find(
|
|
|
+ (p) => p.stepOrder == currentNode.processStep
|
|
|
+ );
|
|
|
+ const proNode = proStep.nodes[currentNode.stepNode - 1];
|
|
|
+ this.form.processStep =
|
|
|
+ this.form.curProcessStep + "," + this.form.curStepNode;
|
|
|
+ //只有一个处理人
|
|
|
+ if (proNode.selectUser.length <= 1) {
|
|
|
+ this.$message.warning(
|
|
|
+ "该审核节点只有一个审核人,不能进行转派!如果需要转派请联系管理员处理!"
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ //过滤出当前处理人
|
|
|
+ const users = proNode.selectUser.filter(
|
|
|
+ (u) => u.userId != currentNode.handleStaff
|
|
|
+ );
|
|
|
+
|
|
|
+ users.forEach((u) => {
|
|
|
+ const dept = this.allDeptAndUser.find((p) => p.id == u.deptId);
|
|
|
+ //this.curStepDepts;
|
|
|
+ if (this.curStepDepts.length <= 0) {
|
|
|
+ this.curStepDepts.push({
|
|
|
+ id: dept.id,
|
|
|
+ name: dept.name,
|
|
|
+ users: [u],
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (this.curStepDepts.find((cs) => cs.id == dept.id)) {
|
|
|
+ this.curStepDepts.forEach((csd) => {
|
|
|
+ if (csd.id == dept.id) csd.users.push(u);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.curStepDepts.push({
|
|
|
+ id: dept.id,
|
|
|
+ name: dept.name,
|
|
|
+ users: [u],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4: //终止
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置选择
|
|
|
+ */
|
|
|
+ setNextSelect() {
|
|
|
+ if (this.editData.hasOwnProperty("currentNode")) {
|
|
|
+ const currentNode = this.editData.currentNode;
|
|
|
+ this.form.curProcessStep = this.editData.currentNode.processStep;
|
|
|
+ this.form.curStepNode = this.editData.currentNode.stepNode;
|
|
|
+ this.nextSteps = [];
|
|
|
+ //当前步骤数强制处理层级大于当前当前步骤结点,初始化选择步骤数
|
|
|
+ if (this.step.coerceLevel > this.form.curStepNode) {
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.stepOrder + "," + (this.form.curStepNode + 1),
|
|
|
+ name: this.step.title + "(" + (this.form.curStepNode + 1) + ")",
|
|
|
+ levelstaffs: this.step.nodes[this.form.curStepNode].levelstaffs,
|
|
|
+ });
|
|
|
+ } else if (this.step.coerceLevel == this.form.curStepNode) {
|
|
|
+ //如果当前结点等于强制等级数
|
|
|
+ //如果强制的层数和总结点数一样,则进入下一步骤选择只能选择配置的下一步
|
|
|
+ if (this.step.nodes.length == this.step.coerceLevel) {
|
|
|
+ //初始化下一步骤
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.nextStep.stepOrder + "",
|
|
|
+ name: this.step.nextStep.stepName,
|
|
|
+ levelstaffs: this.step.nextStep.levelstaffs,
|
|
|
+ });
|
|
|
+ } else if (this.step.nodes.length > this.step.coerceLevel) {
|
|
|
+ //如果强制的层数小于总结点数一样,则进入下一步骤可选择两步
|
|
|
+ for (
|
|
|
+ let i = this.step.coerceLevel;
|
|
|
+ i < this.step.nodes.length;
|
|
|
+ i++
|
|
|
+ ) {
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.stepOrder + "," + (i + 1),
|
|
|
+ name: this.step.title + "(" + (i + 1) + ")",
|
|
|
+ levelstaffs: this.step.nodes[i].levelstaffs,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //同时把下一步信息审核带入
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.nextStep.stepOrder + "",
|
|
|
+ name: this.step.nextStep.stepName,
|
|
|
+ levelstaffs: this.step.nextStep.levelstaffs,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //如果当前结点大于强制等级数,说明上一个结点选择了不是强制审核的
|
|
|
+ //如果当前和总结点数一样,则进入下一步骤选择只能选择配置的下一步
|
|
|
+ if (this.step.nodes.length == this.form.curStepNode) {
|
|
|
+ //初始化下一步骤
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.nextStep.stepOrder + "",
|
|
|
+ name: this.step.nextStep.stepName,
|
|
|
+ levelstaffs: this.step.nextStep.levelstaffs,
|
|
|
+ });
|
|
|
+ } else if (this.step.nodes.length > this.form.curStepNode) {
|
|
|
+ //如果当前结点数小于总结点数一样,则进入下一步骤可选择两步
|
|
|
+ for (
|
|
|
+ let i = this.form.curStepNode;
|
|
|
+ i < this.step.nodes.length;
|
|
|
+ i++
|
|
|
+ ) {
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.form.curStepNode + "," + (i + 1),
|
|
|
+ name: this.step.title + "(" + (i + 1) + ")",
|
|
|
+ levelstaffs: this.step.nodes[i].levelstaffs,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //同时把下一步信息审核带入
|
|
|
+ this.nextSteps.push({
|
|
|
+ id: this.step.nextStep.stepOrder + "",
|
|
|
+ name: this.step.nextStep.stepName,
|
|
|
+ levelstaffs: this.step.nextStep.levelstaffs,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转派当前处理部门改变
|
|
|
+ */
|
|
|
+ curStepDeptChange(value) {
|
|
|
+ let stepStaffs = this.curStepDepts.find((item) => item.id == value);
|
|
|
+ this.curStepStaffs = stepStaffs ? stepStaffs.users : [];
|
|
|
+ this.form.deptStaff = "";
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下一步骤改变,初始化处理部门
|
|
|
+ */
|
|
|
+ nextStepChange(value) {
|
|
|
+ this.nextStepDepts = [];
|
|
|
+ //this.nextStepStaffs = [];
|
|
|
+ this.nextStepDepts = [];
|
|
|
+ this.form.dept = "";
|
|
|
+ this.form.deptStaff = "";
|
|
|
+ const obj = this.nextSteps.find((item) => item.id == value);
|
|
|
+ if (obj && obj.levelstaffs.length > 0) {
|
|
|
+ //取第一个
|
|
|
+ obj.levelstaffs[0].staffs.forEach((item) => {
|
|
|
+ const dept = this.allDeptAndUser.find((p) => p.id == item.deptId);
|
|
|
+ const param = this.nextStepDepts.find((tp) => {
|
|
|
+ const flag = tp.id == item.deptId;
|
|
|
+ if (flag)
|
|
|
+ tp.staffs.push({
|
|
|
+ id: item.staffId,
|
|
|
+ name: item.staffIdName,
|
|
|
+ });
|
|
|
+ return flag;
|
|
|
+ });
|
|
|
+ if (!param)
|
|
|
+ this.nextStepDepts.push({
|
|
|
+ id: dept.id,
|
|
|
+ name: dept.name,
|
|
|
+ staffs: [
|
|
|
+ {
|
|
|
+ id: item.staffId,
|
|
|
+ name: item.staffIdName,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 下一环节处理部门改变
|
|
|
+ */
|
|
|
+ nextStepDeptChange(value) {
|
|
|
+ this.nextStepStaffs = [];
|
|
|
+ this.form.deptStaff = "";
|
|
|
+ const obj = this.nextStepDepts.find((item) => item.id == value);
|
|
|
+ this.nextStepStaffs = obj.staffs;
|
|
|
+ },
|
|
|
+ submitForm() {
|
|
|
+ if (this.form.headleState != 1 && this.form.remarks == "") {
|
|
|
+ this.$message.warning("请填写备注信息");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return this.form;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ destroyed(){
|
|
|
+ this.isLastStep = false
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.form-examine {
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 10px;
|
|
|
+ top: 43px;
|
|
|
+ bottom: 0;
|
|
|
+}
|
|
|
+</style>
|