ddy-process-pc-vue2 1.0.1-beta.19 → 1.0.1-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/vue2/index.esm.js +4 -3
- package/vue2/index.umd.js +4 -3
package/package.json
CHANGED
package/vue2/index.esm.js
CHANGED
|
@@ -9854,6 +9854,7 @@ var script$2 = {
|
|
|
9854
9854
|
console.log(msg, '流程复活');
|
|
9855
9855
|
this.btnLoading = true;
|
|
9856
9856
|
return new Promise((resolve, reject) => {
|
|
9857
|
+
console.error(this.revivalVars, '流程复活变量');
|
|
9857
9858
|
api$1.pis
|
|
9858
9859
|
.reactivate(
|
|
9859
9860
|
{
|
|
@@ -10546,12 +10547,12 @@ __vue_render__$2._withStripped = true;
|
|
|
10546
10547
|
/* style */
|
|
10547
10548
|
const __vue_inject_styles__$2 = function (inject) {
|
|
10548
10549
|
if (!inject) return
|
|
10549
|
-
inject("data-v-67ecf032_0", { source: ".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAw3BA;EACA,kBAAA;EACA,eAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;ACv3BA;AD23BA;EACA,6BAAA;EACA,gCAAA;EACA,iBAAA;EACA,kBAAA;ACx3BA;AD43BA;EACA,wBAAA;EACA,kBAAA;ACz3BA;AD23BA;EACA,SAAA;EACA,WAAA;ACz3BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined })
|
|
10550
|
-
,inject("data-v-67ecf032_1", { source: ".dept-tree[data-v-67ecf032] {\n width: 65%;\n}\n.process-def-name[data-v-67ecf032] {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n.view-node-info[data-v-67ecf032] {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n.create-form .el-form-item__label[data-v-67ecf032] {\n padding-right: 18px;\n}\n.create-form .el-form-item[data-v-67ecf032] {\n margin-bottom: 10px;\n}\n.node-list[data-v-67ecf032] {\n max-height: 300px;\n overflow-y: scroll;\n}\n.track-view .el-dialog__body[data-v-67ecf032] {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\niframe[data-v-67ecf032] {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAq5BA;EACA,UAAA;ACp5BA;ADu5BA;EACA,iBAAA;EACA,kBAAA;EACA,eAAA;ACp5BA;ADs5BA;EACA,qBAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;EACA,SAAA;ACn5BA;ADu5BA;EACA,mBAAA;ACp5BA;ADs5BA;EACA,mBAAA;ACp5BA;ADu5BA;EACA,iBAAA;EACA,kBAAA;ACp5BA;ADu5BA;EACA,aAAA;EACA,uBAAA;EACA,aAAA;EACA,kBAAA;ACp5BA;ADu5BA;EACA,iBAAA;ACp5BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".dept-tree {\n width: 65%;\n}\n\n.process-def-name {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n\n.view-node-info {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n\n.create-form .el-form-item__label {\n padding-right: 18px;\n}\n.create-form .el-form-item {\n margin-bottom: 10px;\n}\n\n.node-list {\n max-height: 300px;\n overflow-y: scroll;\n}\n\n.track-view .el-dialog__body {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\n\niframe {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined });
|
|
10550
|
+
inject("data-v-13407194_0", { source: ".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAy3BA;EACA,kBAAA;EACA,eAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;ACx3BA;AD43BA;EACA,6BAAA;EACA,gCAAA;EACA,iBAAA;EACA,kBAAA;ACz3BA;AD63BA;EACA,wBAAA;EACA,kBAAA;AC13BA;AD43BA;EACA,SAAA;EACA,WAAA;AC13BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n console.error(this.revivalVars, '流程复活变量')\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined })
|
|
10551
|
+
,inject("data-v-13407194_1", { source: ".dept-tree[data-v-13407194] {\n width: 65%;\n}\n.process-def-name[data-v-13407194] {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n.view-node-info[data-v-13407194] {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n.create-form .el-form-item__label[data-v-13407194] {\n padding-right: 18px;\n}\n.create-form .el-form-item[data-v-13407194] {\n margin-bottom: 10px;\n}\n.node-list[data-v-13407194] {\n max-height: 300px;\n overflow-y: scroll;\n}\n.track-view .el-dialog__body[data-v-13407194] {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\niframe[data-v-13407194] {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAs5BA;EACA,UAAA;ACr5BA;ADw5BA;EACA,iBAAA;EACA,kBAAA;EACA,eAAA;ACr5BA;ADu5BA;EACA,qBAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;EACA,SAAA;ACp5BA;ADw5BA;EACA,mBAAA;ACr5BA;ADu5BA;EACA,mBAAA;ACr5BA;ADw5BA;EACA,iBAAA;EACA,kBAAA;ACr5BA;ADw5BA;EACA,aAAA;EACA,uBAAA;EACA,aAAA;EACA,kBAAA;ACr5BA;ADw5BA;EACA,iBAAA;ACr5BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n console.error(this.revivalVars, '流程复活变量')\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".dept-tree {\n width: 65%;\n}\n\n.process-def-name {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n\n.view-node-info {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n\n.create-form .el-form-item__label {\n padding-right: 18px;\n}\n.create-form .el-form-item {\n margin-bottom: 10px;\n}\n\n.node-list {\n max-height: 300px;\n overflow-y: scroll;\n}\n\n.track-view .el-dialog__body {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\n\niframe {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined });
|
|
10551
10552
|
|
|
10552
10553
|
};
|
|
10553
10554
|
/* scoped */
|
|
10554
|
-
const __vue_scope_id__$2 = "data-v-
|
|
10555
|
+
const __vue_scope_id__$2 = "data-v-13407194";
|
|
10555
10556
|
/* module identifier */
|
|
10556
10557
|
const __vue_module_identifier__$2 = undefined;
|
|
10557
10558
|
/* functional template */
|
package/vue2/index.umd.js
CHANGED
|
@@ -9847,6 +9847,7 @@
|
|
|
9847
9847
|
console.log(msg, '流程复活');
|
|
9848
9848
|
this.btnLoading = true;
|
|
9849
9849
|
return new Promise((resolve, reject) => {
|
|
9850
|
+
console.error(this.revivalVars, '流程复活变量');
|
|
9850
9851
|
api$1.pis
|
|
9851
9852
|
.reactivate(
|
|
9852
9853
|
{
|
|
@@ -10539,12 +10540,12 @@
|
|
|
10539
10540
|
/* style */
|
|
10540
10541
|
const __vue_inject_styles__$2 = function (inject) {
|
|
10541
10542
|
if (!inject) return
|
|
10542
|
-
inject("data-v-67ecf032_0", { source: ".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAw3BA;EACA,kBAAA;EACA,eAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;ACv3BA;AD23BA;EACA,6BAAA;EACA,gCAAA;EACA,iBAAA;EACA,kBAAA;ACx3BA;AD43BA;EACA,wBAAA;EACA,kBAAA;ACz3BA;AD23BA;EACA,SAAA;EACA,WAAA;ACz3BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined })
|
|
10543
|
-
,inject("data-v-67ecf032_1", { source: ".dept-tree[data-v-67ecf032] {\n width: 65%;\n}\n.process-def-name[data-v-67ecf032] {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n.view-node-info[data-v-67ecf032] {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n.create-form .el-form-item__label[data-v-67ecf032] {\n padding-right: 18px;\n}\n.create-form .el-form-item[data-v-67ecf032] {\n margin-bottom: 10px;\n}\n.node-list[data-v-67ecf032] {\n max-height: 300px;\n overflow-y: scroll;\n}\n.track-view .el-dialog__body[data-v-67ecf032] {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\niframe[data-v-67ecf032] {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAq5BA;EACA,UAAA;ACp5BA;ADu5BA;EACA,iBAAA;EACA,kBAAA;EACA,eAAA;ACp5BA;ADs5BA;EACA,qBAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;EACA,SAAA;ACn5BA;ADu5BA;EACA,mBAAA;ACp5BA;ADs5BA;EACA,mBAAA;ACp5BA;ADu5BA;EACA,iBAAA;EACA,kBAAA;ACp5BA;ADu5BA;EACA,aAAA;EACA,uBAAA;EACA,aAAA;EACA,kBAAA;ACp5BA;ADu5BA;EACA,iBAAA;ACp5BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".dept-tree {\n width: 65%;\n}\n\n.process-def-name {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n\n.view-node-info {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n\n.create-form .el-form-item__label {\n padding-right: 18px;\n}\n.create-form .el-form-item {\n margin-bottom: 10px;\n}\n\n.node-list {\n max-height: 300px;\n overflow-y: scroll;\n}\n\n.track-view .el-dialog__body {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\n\niframe {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined });
|
|
10543
|
+
inject("data-v-13407194_0", { source: ".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAy3BA;EACA,kBAAA;EACA,eAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;ACx3BA;AD43BA;EACA,6BAAA;EACA,gCAAA;EACA,iBAAA;EACA,kBAAA;ACz3BA;AD63BA;EACA,wBAAA;EACA,kBAAA;AC13BA;AD43BA;EACA,SAAA;EACA,WAAA;AC13BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n console.error(this.revivalVars, '流程复活变量')\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".flow-dialog .el-dialog__header {\n padding: 18px 24px;\n font-size: 18px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n\n.flow-dialog :deep(.el-dialog__body) {\n border-top: 1px solid #dadbde;\n border-bottom: 1px solid #dadbde;\n overflow: visible;\n overflow-x: hidden;\n}\n\n.flow-dialog .el-dialog__footer {\n padding: 12px !important;\n text-align: center;\n}\n.flow-dialog .el-dialog__headerbtn {\n top: 10px;\n right: 16px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined })
|
|
10544
|
+
,inject("data-v-13407194_1", { source: ".dept-tree[data-v-13407194] {\n width: 65%;\n}\n.process-def-name[data-v-13407194] {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n.view-node-info[data-v-13407194] {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n.create-form .el-form-item__label[data-v-13407194] {\n padding-right: 18px;\n}\n.create-form .el-form-item[data-v-13407194] {\n margin-bottom: 10px;\n}\n.node-list[data-v-13407194] {\n max-height: 300px;\n overflow-y: scroll;\n}\n.track-view .el-dialog__body[data-v-13407194] {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\niframe[data-v-13407194] {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */", map: {"version":3,"sources":["C:\\cod\\items\\ui-process-pc\\vue2\\src\\components\\zjp_process\\beforeCreate.vue","beforeCreate.vue"],"names":[],"mappings":"AAs5BA;EACA,UAAA;ACr5BA;ADw5BA;EACA,iBAAA;EACA,kBAAA;EACA,eAAA;ACr5BA;ADu5BA;EACA,qBAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;EACA,SAAA;ACp5BA;ADw5BA;EACA,mBAAA;ACr5BA;ADu5BA;EACA,mBAAA;ACr5BA;ADw5BA;EACA,iBAAA;EACA,kBAAA;ACr5BA;ADw5BA;EACA,aAAA;EACA,uBAAA;EACA,aAAA;EACA,kBAAA;ACr5BA;ADw5BA;EACA,iBAAA;ACr5BA;;AAEA,2CAA2C","file":"beforeCreate.vue","sourcesContent":["<template>\r\n <div>\r\n <el-dialog\r\n :visible.sync=\"flag\"\r\n width=\"45%\"\r\n class=\"flow-dialog\"\r\n :close-on-click-modal=\"false\"\r\n :title=\"revival ? '流程复活' : '创建并启动流程'\"\r\n append-to-body\r\n @closed=\"onClickCancel\"\r\n >\r\n <el-form\r\n class=\"create-form\"\r\n @submit.native.prevent\r\n label-width=\"200px\"\r\n status-icon\r\n >\r\n <el-form-item label=\"当前流程\" size=\"normal\" :rules=\"[{ required: true, message: '请选择流程' }]\">\r\n <el-select\r\n v-model=\"processDefId\"\r\n v-if=\"processDefList.length > 1\"\r\n style=\"width: 65%; margin-right: 10px\"\r\n filterable\r\n clearable\r\n @change=\"processDefChange\"\r\n placeholder=\"请选择\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in processDefList\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n :value=\"item.id\"\r\n :disabled=\"item.disabled\"\r\n ></el-option>\r\n </el-select>\r\n <b class=\"process-def-name\" v-else>\r\n {{ processDefName }}\r\n </b>\r\n <div\r\n @click=\"viewFlowChart\"\r\n v-if=\"processDefId\"\r\n class=\"view-node-info\"\r\n style=\"margin-right: 10px\"\r\n >\r\n 预览\r\n </div>\r\n <div\r\n @click=\"viewFlowForecast\"\r\n v-if=\"processDefId && showFlowForecast\"\r\n class=\"view-node-info\">\r\n 流程预测\r\n </div>\r\n </el-form-item>\r\n\r\n <!-- 如果没有传入部门,则需要选择部门 -->\r\n <el-form-item v-if=\"!hasDeptId\" label=\"选择部门\" :rules=\"[{ required: true, message: '请选择部门' }]\">\r\n <treeSelect\r\n class=\"dept-tree\"\r\n :deptId=\"deptId\"\r\n :ops=\"deptList\"\r\n @input=\"handleDeptChange\"\r\n />\r\n </el-form-item>\r\n\r\n <div class=\"node-list\" v-if=\"deptId\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"下一步处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n <template v-if=\"processList.length > 0\">\r\n <template v-for=\"(item, index) in processList\" >\r\n <userTask\r\n :index=\"index\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :processNode=\"{\r\n ...item,\r\n REQUIRED: index == 0 ? true : false,\r\n }\"\r\n label=\"处理人\"\r\n :rules=\"[{ required: index == 0 ? true : false, message: '请选择审批人' }]\"\r\n :ref=\"setItemRef(item.id)\"\r\n @complete=\"complete\"\r\n ></userTask>\r\n <div class=\"user-task-split\" v-if=\"index !== processList.length - 1\"></div>\r\n </template>\r\n </template>\r\n\r\n <!-- <template v-if=\"otherProcessList.length > 0 && other\">\r\n <el-form-item\r\n v-if=\"processList && processList.length > 0\"\r\n label=\"其他处理节点\"\r\n size=\"normal\"\r\n >\r\n </el-form-item>\r\n\r\n <template v-if=\"processList.length > 0\">\r\n <userTask\r\n v-for=\"item in otherProcessList\"\r\n :personType=\"personType\"\r\n :personEntity=\"{ ...personEntity, _businessDeptId }\"\r\n :key=\"item.id\"\r\n :processNode=\"item\"\r\n :noprop=\"true\"\r\n :ref=\"setItemRef(item.id)\"\r\n ></userTask>\r\n </template>\r\n </template> -->\r\n </div>\r\n </el-form>\r\n <template #footer>\r\n <el-button\r\n :loading=\"btnLoading\"\r\n type=\"primary\"\r\n @click=\"onClickOperation\"\r\n >确 定</el-button\r\n >\r\n <el-button :loading=\"btnLoading\" @click=\"onClickCancel\"\r\n >取 消</el-button\r\n >\r\n </template>\r\n </el-dialog>\r\n\r\n <!-- <div class=\"dialog\"> -->\r\n <el-dialog\r\n :visible.sync=\"flowChartVisible\"\r\n width=\"60%\"\r\n append-to-body\r\n title=\"流程图信息\"\r\n class=\"track-view\"\r\n v-dialogDrag\r\n >\r\n <bpmnLook v-if=\"flowChartVisible && processXml\" ref=\"PreviewRef\" :diagram=\"processXml\"></bpmnLook>\r\n <!-- <iframe\r\n :src=\"trackUrl\"\r\n frameborder=\"0\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n /> -->\r\n <!-- <el-image :src=\"trackUrl\"></el-image> -->\r\n </el-dialog>\r\n\r\n <el-dialog\r\n :visible.sync=\"flowForecastVisible\"\r\n width=\"45%\"\r\n append-to-body\r\n title=\"流程预测\"\r\n v-dialogDrag\r\n @close=\"flowForecastClose\"\r\n >\r\n <div style=\"margin-left: 20px;\">\r\n <div v-html=\"flowForecastData.completeTime\" style=\"margin-left: 40px;margin-bottom: 20px;\"></div>\r\n <el-timeline>\r\n <el-timeline-item\r\n v-for=\"(activity, index) in flowForecastData.processBudgetModelList\"\r\n :key=\"index\"\r\n icon=\"el-icon-check\"\r\n :color=\"index==0 ? '#009800': activity.color\"\r\n :timestamp=\"activity.title\" placement=\"top\">\r\n <div>\r\n <span style=\"color:#009800;\">\r\n <i class=\"el-icon-s-custom\" style=\"margin-right: 5px;\"></i>\r\n 执行人:{{activity.excutor}}\r\n </span>\r\n </div>\r\n </el-timeline-item>\r\n </el-timeline> \r\n </div>\r\n </el-dialog>\r\n \r\n <!-- </div> -->\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport api from \"./api\";\r\nimport * as Enum from \"./enum\";\r\nimport userTask from \"./operation/userTask.vue\";\r\nimport { Message as ElMessage } from \"element-ui\";\r\nimport bpmnLook from \"./bpmnLook.vue\";\r\nimport treeSelect from \"./operation/treeSelect.vue\";\r\nimport { getNodeUserParams } from './utils'\r\n\r\nexport default {\r\n components: { userTask, bpmnLook, treeSelect },\r\n props: {\r\n extraReqParams: {\r\n type: Object,\r\n default: function() {\r\n return {}\r\n },\r\n },\r\n other: {\r\n default: true,\r\n },\r\n personType: \"\",\r\n personEntity: {\r\n type: Object,\r\n default: () => {},\r\n },\r\n beforeFunction:{\r\n type: Function,\r\n default: null\r\n },\r\n showFlowForecast: {\r\n default: false,\r\n type: Boolean,\r\n },\r\n flowForecastFunction:{\r\n type: Function,\r\n default: null\r\n }\r\n },\r\n data() {\r\n return {\r\n revivalVars: {},\r\n processData: {},\r\n absoluteTaskId: '',\r\n userTaskListData: {},\r\n flag: false,\r\n revival: false,\r\n flowChartVisible: false,\r\n flowForecastVisible: false,\r\n flowForecastData:{\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n },\r\n flowForecastProcessInstId: '',\r\n btnLoading: false,\r\n processList: [],\r\n processDefId: \"\",\r\n processInsId: '',\r\n processDefName: \"\",\r\n businessId: \"\",\r\n trackUrl: \"\",\r\n processDefList: [],\r\n otherProcessList: [],\r\n callback: {},\r\n cancelCallBack: {},\r\n _multiNodeParticipant: [],\r\n _businessDeptId: \"\",\r\n businessCode: \"\",\r\n _vars: {},\r\n _appId: '',\r\n deptList: [],\r\n userInfo: {},\r\n hasDeptId: false,\r\n deptId: '',\r\n subjectId: '',\r\n processXml: '',\r\n };\r\n },\r\n provide () {\r\n return {\r\n getUserInfo: this.getUserInfo,\r\n }\r\n },\r\n methods: {\r\n getUserInfo () {\r\n return {\r\n deptId: this.deptId,\r\n subjectId: this.subjectId,\r\n }\r\n },\r\n handleDeptChange(val) {\r\n console.log(val, 'val')\r\n this.deptId = val\r\n this.getUserDataByDeptId()\r\n },\r\n complete(data) {\r\n console.log(data, 'complete')\r\n },\r\n setLoading(e) {\r\n this.btnLoading = e;\r\n },\r\n async getXml(id) {\r\n console.log(this.isXml, 'isxml')\r\n let res = {}\r\n let xml = ''\r\n try {\r\n res = await api.repository.getXmlByProcessDefId({ processDefId: id })\r\n console.log(res, 'res')\r\n if (res.code == 200) {\r\n xml = res.data;\r\n }\r\n } catch (e) {\r\n console.error(e)\r\n }\r\n return xml;\r\n },\r\n async viewFlowChart() {\r\n this.flowChartVisible = true;\r\n this.processXml = await this.getXml(this.processDefId)\r\n // 打开预览窗口,后续代码不使用了\r\n if (Date.now()) return;\r\n api.repository\r\n .getDiagramUrl({\r\n processDefId: this.processDefId,\r\n diagramType: 1,\r\n type: Enum.SourceType.电脑端,\r\n })\r\n .then((res) => {\r\n res.data.url = 'http://localhost:2888/saber/#/flowPreview'\r\n this.trackUrl = this.getNewUrl(res.data.url, {...res.data})\r\n if (Date.now()) {\r\n this.flowChartVisible = true;\r\n return;\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n if (window.location.protocol == \"https:\") {\r\n if (res.data.indexOf(\"http://121.40.143.183:80/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183:80/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://121.40.143.183/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://121.40.143.183/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://acme-aws.ddzg.cn/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://acme-aws.ddzg.cn/\",\r\n \"https://acme-aws.ddzg.cn/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.231:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.231:8088/\",\r\n \"https://acme-test.ddzg.cn:2119/\"\r\n )\r\n } else if (res.data.indexOf(\"http://59.53.91.230:8088/\") >= 0) {\r\n this.trackUrl = res.data.replace(\r\n \"http://59.53.91.230:8088/\",\r\n \"https://kq.ddzg.cn:8093/\"\r\n )\r\n } else {\r\n this.trackUrl = res.data\r\n }\r\n } else {\r\n this.trackUrl = res.data;\r\n }\r\n this.flowChartVisible = true;\r\n }\r\n });\r\n },\r\n // 判断url和当前网页的url域名是否相同\r\n isSameDomain(url) {\r\n return url.indexOf(window.location.host) != -1\r\n },\r\n // 根据url和query对象,拼接一个新的链接\r\n getNewUrl(url, query) {\r\n let queryStr = ''\r\n for (let key in query) {\r\n queryStr += `${key}=${query[key]}&`\r\n }\r\n // 判断url和当前网页的url域名是否相同\r\n if(!this.isSameDomain(url)){\r\n // 如果不同,则query要加上token,从localstorage获取\r\n let token = localStorage.getItem('token');\r\n queryStr += `token=${token}&`\r\n }\r\n queryStr = queryStr.slice(0, -1)\r\n return `${url}?${queryStr}`\r\n },\r\n viewFlowForecast(){\r\n if(this.flowForecastFunction){\r\n this.flowForecastFunction()\r\n }else {\r\n this.forecast({\r\n appId: this._appId ,\r\n title: '1',//title不能为空,随便传的一个值\r\n }) \r\n } \r\n },\r\n forecast(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .getProcessForecast({\r\n processDefId: this.processDefId,\r\n ...data,\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n if(e.data && e.data.processBudgetModelList && e.data.processBudgetModelList.length){\r\n this.flowForecastProcessInstId = e.data.processBudgetModelList[0].processInstId\r\n }else{\r\n e.data.processBudgetModelList = []\r\n this.flowForecastProcessInstId = ''\r\n }\r\n this.flowForecastData = e.data \r\n this.flowForecastVisible = true;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程预测失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n flowForecastClose(){\r\n if(this.flowForecastProcessInstId){\r\n api.pis\r\n .deleteProcessById(this.flowForecastProcessInstId)\r\n .then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.flowForecastVisible = false;\r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n this.flowForecastProcessInstId = ''\r\n }\r\n });\r\n }else{\r\n this.flowForecastVisible = false; \r\n this.flowForecastData = {\r\n completeTime:'',\r\n processBudgetModelList:[]\r\n }\r\n }\r\n },\r\n processDefChange(processId) {\r\n this.processDefId = processId;\r\n api.repository.getFirstProcessNode(this.processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // // 获取部门id\r\n // const deptId = info.userInfo.deptId\r\n // this.deptId = deptId\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n // api.repository.getAfferentParticipantNodeList(processId).then((res) => {\r\n // if (res.code == Enum.apiCode.success) {\r\n // res.data.map((item) => {\r\n // item.type = \"UserTaskModel\";\r\n // });\r\n // this.processList = res.data;\r\n // let tmp = JSON.parse(JSON.stringify(res.data));\r\n // tmp.shift();\r\n // this.otherProcessList = tmp;\r\n // }\r\n // });\r\n },\r\n setItemRef(key) {\r\n this.userTaskListData[key] = \"userTask\" + key;\r\n return this.userTaskListData[key];\r\n },\r\n isOption(humanPerformer) {\r\n return (\r\n humanPerformer == \"任意指定\" ||\r\n humanPerformer == \"固定部门\" ||\r\n humanPerformer == \"固定单位\" ||\r\n humanPerformer == \"固定群组\"\r\n );\r\n },\r\n createAndStart(data) {\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n api.pis\r\n .createAndStart({\r\n processDefId: this.processDefId,\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n // vars: this._businessDeptId\r\n // ? { _businessDeptId: this._businessDeptId, ...this._vars }\r\n // : this._vars,\r\n vars: {\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n })\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程启动失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n revivalFlow(data = {}, history = false, msg = \"流程复活\") {\r\n console.log(msg, '流程复活')\r\n this.btnLoading = true;\r\n return new Promise((resolve, reject) => {\r\n console.error(this.revivalVars, '流程复活变量')\r\n api.pis\r\n .reactivate(\r\n {\r\n processDefId: this.processDefId,\r\n processInsId: this.processInsId,\r\n isClearHistory: this.isClearHistory,\r\n // reactivateReason: \"重新提交\",\r\n multiNodeParticipant: this._multiNodeParticipant,\r\n firstNodeId: this.processList && this.processList.length > 0 ? this.processList[0].id : '',\r\n vars: {\r\n ...this.revivalVars,\r\n showType: \"all\",\r\n subjectId: this.subjectId,\r\n deptId: this.deptId,\r\n businessType: this.businessCode,\r\n ...data,\r\n ...this._vars,\r\n }\r\n },\r\n \"\",\r\n this.businessId,\r\n msg,\r\n \"\",\r\n history,\r\n this._multiNodeParticipant,\r\n this.extraReqParams,\r\n )\r\n .then((e) => {\r\n this.btnLoading = false;\r\n if (e.code == Enum.apiCode.success) {\r\n this.flag = false;\r\n resolve(e);\r\n } else {\r\n ElMessage.error(e.msg);\r\n }\r\n })\r\n .catch((e) => {\r\n this.btnLoading = false;\r\n ElMessage.error(\"流程复活失败,请重试\");\r\n reject(e);\r\n });\r\n });\r\n },\r\n Show(processDefId, appid = \"\", revival = false) {\r\n this.processList = [];\r\n this.revival = revival;\r\n this.processDefId = processDefId;\r\n\r\n if (appid) {\r\n api.repository.getProcessDefList(appid, \"\").then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n e.data.map((item) => {\r\n if (item.id == processDefId) {\r\n this.processDefName = item.name;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(processDefId).then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n\r\n this.callback = resolve;\r\n // api.repository\r\n // .getAfferentParticipantNodeList(processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n });\r\n },\r\n selectShow(\r\n info = {\r\n appId: \"\",\r\n businessCode: \"\",\r\n keyWord: \"\",\r\n businessDeptId: \"\",\r\n userInfo: {},\r\n }\r\n ) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n this._appId = info.appId\r\n this._businessDeptId = info.businessDeptId;\r\n this.businessCode = info.businessCode\r\n this.userInfo = info.userInfo;\r\n // 获取部门id\r\n this.deptId = info.userInfo.deptId\r\n // 获取主体id\r\n this.subjectId = info.userInfo.subjectId\r\n this.hasDeptId = !!info.userInfo.deptId\r\n console.log('======_businessDeptId',this._businessDeptId);\r\n return new Promise((resolve, reject) => {\r\n console.log(reject, 'reject')\r\n this.cancelCallBack = reject;\r\n api.repository\r\n .getProcessDefListNew(info)\r\n .then((e) => {\r\n if (e.code == Enum.apiCode.success) {\r\n if (e.data.length == 1) {\r\n this.processDefList = e.data;\r\n this.processDefId = e.data[0].id;\r\n this.processDefName = e.data[0].name;\r\n api.repository\r\n .getFirstProcessNode(this.processDefId)\r\n .then(async (res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n console.log(res, 'res')\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n // 获取部门\r\n await this.getNodeUserDept()\r\n // 没有传入部门,则需要在选择部门后进行后续操作\r\n if (!this.deptId) return;\r\n this.getUserDataByDeptId()\r\n // 获取人员,没有人则是之前的选人逻辑\r\n\r\n \r\n // api.repository\r\n // .getAfferentParticipantNodeList(this.processDefId)\r\n // .then((e) => {\r\n // this.otherProcessList = e.data.filter((el) => {\r\n // return el[\"id\"] != this.processList[0][\"id\"];\r\n // });\r\n // this.otherProcessList.map((el) => {\r\n // el[\"REQUIRED\"] = false;\r\n // });\r\n // });\r\n }\r\n });\r\n } else {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.processDefList = e.data;\r\n\r\n if (info.keyWord) {\r\n this.processDefList.map((item) => {\r\n if (\r\n item.name.indexOf(info.keyWord) != -1 &&\r\n !this.processDefId\r\n ) {\r\n this.processDefId = item.id;\r\n this.processDefName = item.name;\r\n this.processDefChange(item.id);\r\n }\r\n });\r\n }\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n }\r\n });\r\n });\r\n },\r\n // 处理routeTxt\r\n handleRouteTxt(item) {\r\n let str\r\n // 交集\r\n if (item.assigneeRetain == true) {\r\n return \r\n }\r\n },\r\n // 通过部门id获取流程节点的人员\r\n getUserDataByDeptId() {\r\n this.processList.map(async (item, index) => {\r\n console.log(item, 'item')\r\n const nodeUserParams = getNodeUserParams(item)\r\n let res\r\n try {\r\n res = await this.getNodeUser({\r\n deptId: this.deptId,\r\n intersection: nodeUserParams.intersection ? 1 : 0,\r\n userIds: nodeUserParams.userIds,\r\n postIds: nodeUserParams.postIds,\r\n deptIds: nodeUserParams.deptIds,\r\n })\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n if (res.code == Enum.apiCode.success) {\r\n const l = this.processList[index]\r\n l.userList = res.data\r\n this.$set(this.processList, index, l)\r\n\r\n }\r\n // console.log(user, 'user', index)\r\n })\r\n },\r\n // 获取节点的人员\r\n async getNodeUser({ deptId, intersection, userIds, postIds, deptIds }) {\r\n return await api.user.getTaskAuditor({\r\n deptId,\r\n intersection,\r\n userIds,\r\n postIds,\r\n deptIds\r\n })\r\n },\r\n // 获取节点人员的部门\r\n async getNodeUserDept() {\r\n let res = {}\r\n try {\r\n res = await api.user.getSelectTree()\r\n console.log(res, 'res')\r\n } catch (error) {\r\n console.log(error, 'error')\r\n }\r\n console.log(res.data, 'data')\r\n this.deptList = res.data || []\r\n },\r\n\r\n listShow(list) {\r\n this.processList = [];\r\n this.otherProcessList = [];\r\n this.processDefId = \"\";\r\n this.processDefName = \"\";\r\n this.revival = false;\r\n return new Promise((resolve, reject) => {\r\n if (list.length == 1) {\r\n this.processDefId = list[0].id;\r\n this.processDefName = list[0].name;\r\n this.cancelCallBack = reject;\r\n api.repository.getFirstProcessNode(this.processDefId).then((res) => {\r\n if (res.code == Enum.apiCode.success) {\r\n this.processList = res.data;\r\n this.flag = true;\r\n this.callback = resolve;\r\n api.repository\r\n .getAfferentParticipantNodeList(this.processDefId)\r\n .then((e) => {\r\n this.otherProcessList = e.data.filter((el) => {\r\n return el[\"id\"] != this.processList[0][\"id\"];\r\n });\r\n this.otherProcessList.map((el) => {\r\n el[\"REQUIRED\"] = false;\r\n });\r\n });\r\n }\r\n });\r\n } else {\r\n this.processDefList = list;\r\n this.flag = true;\r\n this.callback = resolve;\r\n }\r\n });\r\n },\r\n // 流程\r\n async getProcessInfo({ taskId, processInsId }) {\r\n\r\n let res = {};\r\n try {\r\n res = await api.tis.getTaskModelDetail(taskId ? {\r\n processInsId,\r\n taskId,\r\n } : {\r\n processInsId,\r\n })\r\n } catch (e) {\r\n res = {}\r\n }\r\n \r\n if (res.code == 200) {\r\n \r\n }\r\n return res\r\n },\r\n async revivalShow({ processInsId, businessId, taskId, deptId }) {\r\n this.processInsId = processInsId\r\n this.hasDeptId = !!deptId\r\n let res = await this.getProcessInfo({ taskId, processInsId })\r\n // let res = await api.pis.getProcessInstanceByBusinessKey(businessId);\r\n if (res.code == 200) {\r\n this.processData = {\r\n ...this.initProcessData,\r\n ...(res.data || {}),\r\n };\r\n const deptId = ((this.processData.process || {}).variables || {}).deptId\r\n this.deptId = deptId\r\n this._businessDeptId = deptId\r\n this.hasDeptId = !!deptId\r\n const taskId = (this.processData.process || {}).taskId\r\n this.absoluteTaskId = taskId\r\n console.log(deptId, 'id')\r\n\r\n this.revival = true;\r\n this.businessId = businessId;\r\n this.subjectId = res.data.process.variables.subjectId\r\n this.businessCode = res.data.process.variables.businessType\r\n this.revivalVars = res.data.process.variables;\r\n\r\n this.processDefId = res.data.process.processDefinitionId;\r\n this.processDefName = res.data.process.processDefinitionName;\r\n this.processDefList = [];\r\n \r\n return this.Show(res.data.process.processDefinitionId, \"\", true);\r\n }\r\n \r\n },\r\n onClickOperation() {\r\n if(!this.processDefId || this.processDefId==''){\r\n ElMessage.warning(\"请选择流程\");\r\n return false;\r\n }\r\n let multiNodeParticipant = {},\r\n vars = {};\r\n for (let key in this.userTaskListData) {\r\n let o = this.userTaskListData[key];\r\n let refCom = this.$refs[o][0];\r\n let res = refCom\r\n ? refCom.getValue()\r\n : { multiNodeParticipant: [], vars: {} };\r\n if (!res) {\r\n return false;\r\n }\r\n console.log(res, 'res')\r\n multiNodeParticipant = {\r\n ...multiNodeParticipant,\r\n ...res.multiNodeParticipant,\r\n };\r\n vars = { ...vars, ...res.vars };\r\n console.log(vars, 'vars')\r\n }\r\n this._multiNodeParticipant = multiNodeParticipant;\r\n this._vars = vars;\r\n console.log(this.callback, 'callbasck', this.beforeFunction)\r\n if(this.beforeFunction){\r\n this.beforeFunction()\r\n }else if (this.callback) {\r\n this.callback(this.revival ? this.revivalFlow : this.createAndStart);\r\n }\r\n // this.flag = false;\r\n },\r\n onClickCancel() {\r\n this.flag = false;\r\n this.btnLoading = false;\r\n if (this.cancelCallBack) this.cancelCallBack();\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n.flow-dialog {\r\n .el-dialog__header {\r\n padding: 18px 24px;\r\n font-size: 18px;\r\n font-weight: 400;\r\n display: flex;\r\n align-items: center;\r\n }\r\n}\r\n\r\n.flow-dialog :deep(.el-dialog__body) {\r\n border-top: 1px solid #dadbde;\r\n border-bottom: 1px solid #dadbde;\r\n overflow: visible;\r\n overflow-x: hidden;\r\n}\r\n\r\n.flow-dialog {\r\n .el-dialog__footer {\r\n padding: 12px !important;\r\n text-align: center;\r\n }\r\n .el-dialog__headerbtn {\r\n top: 10px;\r\n right: 16px;\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\" scoped>\r\n.dept-tree {\r\n width: 65%;\r\n}\r\n\r\n.process-def-name {\r\n font-weight: bold;\r\n margin-right: 20px;\r\n font-size: 16px;\r\n}\r\n.view-node-info {\r\n display: inline-block;\r\n cursor: pointer;\r\n color: #1389ff;\r\n font-size: 14px;\r\n margin: 0;\r\n}\r\n\r\n.create-form {\r\n .el-form-item__label {\r\n padding-right: 18px;\r\n }\r\n .el-form-item {\r\n margin-bottom: 10px;\r\n }\r\n}\r\n.node-list {\r\n max-height: 300px;\r\n overflow-y: scroll;\r\n}\r\n.track-view {\r\n .el-dialog__body {\r\n display: flex;\r\n justify-content: center;\r\n height: 600px;\r\n position: relative;\r\n }\r\n}\r\niframe {\r\n min-height: 500px;\r\n}\r\n</style>\r\n",".dept-tree {\n width: 65%;\n}\n\n.process-def-name {\n font-weight: bold;\n margin-right: 20px;\n font-size: 16px;\n}\n\n.view-node-info {\n display: inline-block;\n cursor: pointer;\n color: #1389ff;\n font-size: 14px;\n margin: 0;\n}\n\n.create-form .el-form-item__label {\n padding-right: 18px;\n}\n.create-form .el-form-item {\n margin-bottom: 10px;\n}\n\n.node-list {\n max-height: 300px;\n overflow-y: scroll;\n}\n\n.track-view .el-dialog__body {\n display: flex;\n justify-content: center;\n height: 600px;\n position: relative;\n}\n\niframe {\n min-height: 500px;\n}\n\n/*# sourceMappingURL=beforeCreate.vue.map */"]}, media: undefined });
|
|
10544
10545
|
|
|
10545
10546
|
};
|
|
10546
10547
|
/* scoped */
|
|
10547
|
-
const __vue_scope_id__$2 = "data-v-
|
|
10548
|
+
const __vue_scope_id__$2 = "data-v-13407194";
|
|
10548
10549
|
/* module identifier */
|
|
10549
10550
|
const __vue_module_identifier__$2 = undefined;
|
|
10550
10551
|
/* functional template */
|