浏览代码

流程组件

tengmingxue 2 年之前
父节点
当前提交
6f5a425a98

+ 221 - 0
src/views/dcSystem/components/upload.vue

@@ -0,0 +1,221 @@
+<template>
+  <!-- 上传附件-->
+  <div class="form-upload">
+    <el-form :model="form" label-width="auto">
+      <el-row :gutter="24">
+        <el-col :span="24">
+          <el-upload class="upload-demo" ref="uploadCom" action="" accept=".pdf,.jpg,.png,.jpeg,.xlx,.xlsx,.doc,.docx" multiple :on-change="fileChange" :on-preview="handlePreview" :on-remove="handleRemove" :before-remove="beforeRemove" :limit="limit" :on-exceed="handleExceed" :file-list="fileList" :http-request="selfUpload">
+            <el-button size="small" type="primary" style="margin-right: 20px">点击上传</el-button>
+            <div slot="tip" class="el-upload__tip" style="width: calc(100% - 200px); display: inline-block" v-clock>
+              支持上传{{fileTypes.join(',')}}等文件,单个文件大小不超过{{
+                maxFileSize
+              }}M。
+            </div>
+          </el-upload>
+        </el-col>
+      </el-row>
+    </el-form>
+  </div>
+</template>
+
+<script>
+export default {
+  components: {},
+  props: {
+    files: {
+      type: Array,
+      required: true
+    },
+    fileCountChange: {
+      type: Object,
+      required: false
+    },
+    fileTypes: {
+      type: Array,
+      default: ["pdf", "doc", "docx", "xls", "xlsx", "jpg", "jpeg", "png"]
+    }
+  },
+  data() {
+    return {
+      limit: 5, //限制文件个数
+      maxFileSize: 10, //最大文件大小
+      //fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}],
+      fileList: [],
+      form: {},
+      formDatas: [] //上传的文件数组
+    };
+  },
+  created() {},
+  mounted() {},
+  methods: {
+    /**
+     * 文件状态改变时的钩子
+     */
+    fileChange(file, fileList) {
+      // 该上传文件是否已经存在上传列表中
+      let isTrue = this.formDatas.some(f => f.name === file.name);
+      if (isTrue) {
+        this.$message.warning("请勿重复上传文件!");
+        // 文件展示列表是将新添加的文件放在数组末尾
+        fileList.pop();
+        return;
+      }
+      const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
+      // const whiteList = ["pdf", "doc", "docx", "xls", "xlsx","jpg","jpeg",'png'];
+      const whiteList = this.fileTypes;
+      if (whiteList.indexOf(fileSuffix) === -1) {
+        this.$message.error(`上传⽂件只能是${whiteList.join(",")}格式`);
+        this.fileList = [];
+        return;
+      }
+      let size = Number(file.size / 1024 / 1024);
+      if (this.maxFileSize < size) {
+        this.$message.warning(
+          "文件【" +
+            file.name +
+            "】大小为:" +
+            size +
+            "请确保单个文件最大为:" +
+            this.maxFileSize +
+            "M"
+        );
+        this.fileList = [];
+        return;
+      }
+      //删除不在范围内的
+      let indexflag = -1;
+      fileList.some((item, i) => {
+        const fileSuf = item.name.substring(item.name.lastIndexOf(".") + 1);
+        if (whiteList.indexOf(fileSuf) === -1) indexflag = i;
+      });
+      if (indexflag > -1) fileList.splice(indexflag, 1);
+      this.fileList = fileList;
+      if (this.fileCountChange) this.fileCountChange(this.formDatas.length);
+    },
+
+    /**
+     * 删除文件
+     * 同时删除列表中数据
+     */
+    handleRemove(file, fileList) {
+      const fileName = file.name;
+      let index = -1;
+      this.formDatas.some((item, i) => {
+        if (item.name === fileName) index = i;
+      });
+      if (index > -1) this.formDatas.splice(index, 1);
+      this.fileList = fileList;
+      if (this.fileCountChange) this.fileCountChange(this.formDatas.length);
+    },
+    /**
+     * 点击文件列表中已上传的文件时的钩子
+     */
+    handlePreview(file) {
+      console.log(file);
+    },
+
+    /**
+     * 文件超出个数限制时的钩子
+     */
+    handleExceed(files, fileList) {
+      const limit = this.limit;
+      this.$message.warning(
+        `当前限制选择 ${limit} 个文件,本次选择了 ${
+          files.length
+        } 个文件,共选择了 ${files.length + fileList.length} 个文件`
+      );
+    },
+
+    beforeRemove(file, fileList) {
+      if (file && file.status === "success") {
+        returnthis
+          .$confirm("确定移除" + file.name + "?", "删除", {
+            confirmButtonText: "确认",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            returndelObj(file.id, this.userInfo.userId);
+          })
+          .then(() => {
+            this.$message.success("已删除");
+            this.getFile();
+            if (this.fileCountChange)
+              this.fileCountChange(this.formDatas.length);
+          });
+      }
+    },
+
+    /**
+     * 自定义上传文件格式
+     */
+    selfUpload(param) {
+      let size = Number(param.file.size / 1024 / 1024);
+      if (this.maxFileSize < size) {
+        this.$message.warning(
+          "文件【" +
+            param.file.name +
+            "】大小为:" +
+            size +
+            "请确保单个文件最大为:" +
+            this.maxFileSize +
+            "M"
+        );
+        return;
+      }
+      const fileSuffix = param.file.name.substring(
+        param.file.name.lastIndexOf(".") + 1
+      );
+      const whiteList = [
+        "pdf",
+        "doc",
+        "docx",
+        "xls",
+        "xlsx",
+        ".jpg",
+        "jpeg",
+        "png"
+      ];
+      if (whiteList.indexOf(fileSuffix) === -1) {
+        return;
+      }
+      const fileName = param.file.name;
+      const formData = {
+        name: fileName,
+        file: param.file
+      };
+      if (this.formDatas.length > 0) {
+        let flag = this.formDatas.find(item => item.name === fileName);
+        if (!flag) this.formDatas.push(formData);
+      } else {
+        this.formDatas.push(formData);
+      }
+      if (this.fileCountChange) this.fileCountChange(this.formDatas.length);
+    },
+    /**
+     * 提交文件
+     */
+    submitFiles() {
+      return this.formDatas;
+    },
+    /**
+     * 清除
+     */
+    clearFiles() {
+      this.$nextTick(() => {
+        this.$refs.uploadCom.clearFiles();
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.form-upload {
+  width: 100%;
+  box-sizing: border-box;
+  padding: 10px;
+  top: 43px;
+  bottom: 0;
+}
+</style>

+ 102 - 0
src/views/dcSystem/components/workOrder/cfgOrderProcess.js

@@ -0,0 +1,102 @@
+export const config = {
+    //工单状态
+    orderState: [
+        {
+            key: 1,
+            value: "草稿"
+        }, {
+            key: 2,
+            value: "处理中"
+        }, {
+            key: 3,
+            value: "终止"
+        }, {
+            key: 4,
+            value: "处理完成"
+        },
+    ],
+    //物资类型
+    metrialCategories: [
+        {
+            code: 1,
+            name: '设备类'
+        }, {
+            code: 2,
+            name: '车辆类'
+        }, {
+            code: 3,
+            name: '耗材类'
+        }
+    ],
+    //处理方式
+    headleState: [{ key: 1, name: '通过' }, { key: 2, name: '驳回' }, { key: 3, name: '转派' }, { key: 4, name: '终止' }],
+    //结点状态 节点状态0:待处理;1处理中;2提交;3:驳回;4:转派;5:终止;6:被驳回;
+    nodeState: [{ key: 0, name: '待处理' }, { key: 1, name: '处理中' }, { key: 2, name: '通过' }, { key: 3, name: '驳回' }, { key: 4, name: '转派' }, { key: 5, name: '终止' }, { key: 6, name: '被驳回' }],
+    //流程
+    process: [
+        { processName: "公文管理/收文流程", processNumber: "SW" },
+        { processName: "库存管理/物资申请流程", processNumber: "WZSQ" },
+        { processName: "用车管理/用车流程", processNumber: "YCLC" },
+        { processName: "会议管理/会议流程", processNumber: "HYLC" },
+        { processName: "公告管理/公告发布流程", processNumber: "GGLC" },
+        { processName: "采购管理/采购流程", processNumber: "CGLC" },
+        { rocessName: "库存管理/入库流程", processNumber: "RKLC" },
+        { processName: "公文管理/发文流程", processNumber: "FW" },
+        { processName: "工程管理/工程管理流程", processNumber: "GCLC" }
+    ],
+    //工程类型
+    projectState: [
+        {
+            key: 0,
+            value: "报装"
+        }, {
+            key: 1,
+            value: "维修"
+        }
+    ],
+    //用户类型
+    userState: [
+        {
+            key: 0,
+            value: "个人"
+        }, {
+            key: 1,
+            value: "单位"
+        }
+    ],
+    //是否完工
+    dataStateOpt: [
+        {
+            key: 0,
+            value: "是"
+        }, {
+            key: 1,
+            value: "否"
+        }
+    ],
+    //当前步骤
+    proessNodeOpt: [
+        {
+            key: 1,
+            value: "工程登记"
+        }, {
+            key: 2,
+            value: "工程查勘"
+        }, {
+            key: 3,
+            value: "合同登记"
+        }, {
+            key: 4,
+            value: "合同审核"
+        }, {
+            key: 5,
+            value: "合同上传"
+        }, {
+            key: 6,
+            value: "工程施工"
+        }, {
+            key: 7,
+            value: "工程验收"
+        }
+    ],
+}

+ 935 - 0
src/views/dcSystem/components/workOrder/examineForm.vue

@@ -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>

文件差异内容过多而无法显示
+ 1066 - 0
src/views/dcSystem/components/workOrder/index.vue