deal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <div>
  3. <el-container>
  4. <el-header style = "margin-bottom: -1%;">
  5. <div style = "float: right;">
  6. <el-button @click="closeDeal()">取 消</el-button>
  7. <el-button @click="showTransferTask()" v-if="purview5">转办</el-button>
  8. <el-button @click="handUpProcessInstance()" v-if="purview4">补充资料挂起</el-button>
  9. <el-button @click="findReturnUserTask()" v-if="purview3">退回</el-button>
  10. <el-button @click="cantVisible=true">审批拒绝</el-button>
  11. <el-button type="primary" @click="attachmentVisible=true">审批通过</el-button>
  12. </div>
  13. </el-header>
  14. <el-main>
  15. <el-tabs type="border-card" >
  16. <el-tab-pane>
  17. <span slot="label"><i class="el-icon-date"></i> 任务详情</span>
  18. <parser :form-conf="formConf" @submit="sumbitForm" ref="parserRef" v-if="type == '0'"/>
  19. <iframe :src="iframeUrl" ref="iframe" v-if="type == '1'" width="100%" height="500px" name = "customWindow" style = "border: none;"></iframe>
  20. </el-tab-pane>
  21. <el-tab-pane label="流程跟踪" style="overflow: scroll; height: 500px;">
  22. <div>
  23. <el-steps direction="vertical" :active="histaskList[histaskList.length-1] && histaskList[histaskList.length-1].activityType == 'endEvent' ? histaskList.length : histaskList.length-1" finish-status="success" space = "60px">
  24. <el-step :title="item.name" v-for="item in histaskList" :key="item.id">
  25. <template slot="description">
  26. <span v-if="item.activityType == 'userTask'">办理人: {{item.displayName}}</span> 节点名称: {{item.activityName}} 任务接收时间 {{item.startTime}} 任务办结时间 {{item.endTime}}
  27. <div v-for="comment in item.commentList" class="text item" :key="comment.id">
  28. {{'审批通过: ' + comment.message }}
  29. </div>
  30. </template>
  31. </el-step>
  32. </el-steps>
  33. <el-image :src="processImgUrl">
  34. </el-image>
  35. </div>
  36. </el-tab-pane>
  37. </el-tabs>
  38. </el-main>
  39. </el-container>
  40. <el-dialog title="审批通过" :visible.sync="attachmentVisible" :modal="false" v-loading="tableloading" style="width: 80%;margin-left:10%;">
  41. <el-form>
  42. <el-form-item label="请输入审批意见">
  43. <el-input v-model="message" :rows= "6" maxlength="200"
  44. autocomplete="off" type = "textarea"></el-input>
  45. </el-form-item>
  46. <!-- <el-upload
  47. class="upload-demo"
  48. action="123"
  49. ref="upload"
  50. :on-remove="handleRemove"
  51. :before-remove="beforeRemove"
  52. :auto-upload = false
  53. :file-list="fileList"
  54. :limit="3"
  55. :http-request="uploadFile"
  56. >
  57. <el-button size="small" type="primary">点击上传附件</el-button>
  58. </el-upload> -->
  59. <el-form-item style="margin-left:60%">
  60. <el-button @click="attachmentVisible = false">取消</el-button>
  61. <el-button type="primary" @click="completeTask">确定</el-button>
  62. </el-form-item>
  63. </el-form>
  64. </el-dialog>
  65. <el-dialog title="审批拒绝" :visible.sync="cantVisible" :modal="false" v-loading="tableloading" style="width: 80%;margin-left:10%;">
  66. <el-form>
  67. <el-form-item label="请输入审批意见">
  68. <el-input v-model="messageCant" :rows= "6" maxlength="200"
  69. autocomplete="off" type = "textarea"></el-input>
  70. </el-form-item>
  71. <!-- <el-upload
  72. class="upload-demo"
  73. action="123"
  74. ref="upload"
  75. :on-remove="handleRemove"
  76. :before-remove="beforeRemove"
  77. :auto-upload = false
  78. :file-list="fileList"
  79. :limit="3"
  80. :http-request="uploadFile"
  81. >
  82. <el-button size="small" type="primary">点击上传附件</el-button>
  83. </el-upload> -->
  84. <el-form-item style="margin-left:60%">
  85. <el-button @click="cantVisible = false">取消</el-button>
  86. <el-button type="primary" @click="deleteProcess">确定</el-button>
  87. </el-form-item>
  88. </el-form>
  89. </el-dialog>
  90. <!-- 转办弹窗 -->
  91. <el-dialog title="选择转办人员" :visible.sync="transferTaskVisible">
  92. <el-form ref="form" label-width="80px">
  93. <el-form-item label="转办人">
  94. <el-select v-model="acceptUserId" placeholder="请选择">
  95. <el-option
  96. v-for="item in users"
  97. :key="item.id"
  98. :label="item.displayName"
  99. :value="item.id">
  100. </el-option>
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item>
  104. <el-button @click="transferTaskVisible = false">取消</el-button>
  105. <el-button type="primary" @click="transferTask">确定</el-button>
  106. </el-form-item>
  107. </el-form>
  108. </el-dialog>
  109. <!-- 退回弹窗 -->
  110. <el-dialog title="选择退回节点" :visible.sync="findReturnUserTaskVisible">
  111. <el-form ref="form" label-width="80px">
  112. <el-form-item label="退回节点">
  113. <el-select v-model="backNode" placeholder="请选择">
  114. <el-option
  115. v-for="item in userTaskList"
  116. :key="item.id"
  117. :label="item.name"
  118. :value="item.id">
  119. </el-option>
  120. </el-select>
  121. </el-form-item>
  122. <el-form-item>
  123. <el-button @click="findReturnUserTaskVisible = false">取消</el-button>
  124. <el-button type="primary" @click="flowReturn">确定</el-button>
  125. </el-form-item>
  126. </el-form>
  127. </el-dialog>
  128. </div>
  129. </template>
  130. <script>
  131. import Parser from '../parser/Parser'
  132. export default {
  133. components : {
  134. Parser
  135. },
  136. props : ["formConf", "histaskList", "fileList", "purviews","type", "customUrl", "tempRow", "parentDom"],
  137. data() {
  138. return {
  139. /** 转办弹窗显示标识 */
  140. transferTaskVisible : false,
  141. findReturnUserTaskVisible : false,
  142. /** 转办指定人id */
  143. acceptUserId : '',
  144. /** 表单提交 */
  145. fileData : new FormData(),
  146. /** 回退节点列表 */
  147. userTaskList : [],
  148. /** 审批意见 */
  149. message : '',
  150. messageCant : '',
  151. /** 退回节点 */
  152. backNode : '',
  153. purview3 : false,
  154. purview4 : false,
  155. purview5 : false,
  156. processImgUrl : '',
  157. attachmentVisible : false,
  158. cantVisible : false,
  159. tableloading:false,
  160. iframeUrl : '',
  161. users : []
  162. }
  163. },
  164. mounted() {
  165. // 操作按钮权限控制
  166. if (!!this.purviews) {
  167. let nodePurviewList = this.purviews.split(",");
  168. for (let p of nodePurviewList) {
  169. if (p == "3") {
  170. this.purview3 = true;
  171. } else if (p == "4") {
  172. this.purview4 = true;
  173. } else if (p == "5") {
  174. this.purview5 = true;
  175. }
  176. }
  177. }
  178. this.processImgUrl = '/api/flow/genProcessDiagram?processId=' + this.tempRow.instId;
  179. if (this.customUrl.indexOf("http") != -1 || this.customUrl.indexOf("HTTP") != -1) {
  180. this.iframeUrl = this.customUrl;
  181. } else {
  182. this.iframeUrl = window.location.protocol + "//" + window.location.host + this.customUrl;
  183. }
  184. console.log("this.iframeUrl")
  185. console.log(this.iframeUrl)
  186. },
  187. methods : {
  188. getUsers() {
  189. this.Axios.post('/api/flow/getUserInf').then(response => {
  190. if (!!response.data) {
  191. this.users = response.data.userList;
  192. } else {
  193. this.users = [];
  194. }
  195. }).catch(err => {
  196. console.log(err)
  197. this.$message.error({message : '请求失败!', offset : 70});
  198. })
  199. },
  200. sumbitForm(data) {
  201. console.log('sumbitForm1提交数据:', data)
  202. },
  203. /** 转办弹窗 */
  204. showTransferTask () {
  205. this.transferTaskVisible = true;
  206. },
  207. /** 转办任务 */
  208. transferTask () {
  209. this.Axios.post('/api/flow/transferTask', 'taskId='+this.tempRow.taskId + '&acceptUserId=' + this.acceptUserId).then(response => {
  210. if (!!response.data) {
  211. if(response.data.code == "200") {
  212. this.transferTaskVisible = false;
  213. this.getMystartFlow();
  214. this.$message({
  215. message: '操作成功!',
  216. type: 'success',
  217. offset : 70
  218. });
  219. } else {
  220. this.$message.error({message : response.data.message, offset : 70});
  221. }
  222. }
  223. }).catch(err => {
  224. console.log(err)
  225. this.$message.error({message : err.message, offset : 70});
  226. })
  227. },
  228. /** 补充资料挂起任务*/
  229. handUpProcessInstance () {
  230. //this.submitUpload();
  231. this.fileData.set('taskId', this.tempRow.taskId)
  232. this.Axios.post('/api/flow/handUpProcessInstance', this.fileData).then(response => {
  233. if (!!response.data) {
  234. this.tempRow = null;
  235. this.fileData = new FormData();
  236. this.getMystartFlow();
  237. this.$message({
  238. message: '保存成功!',
  239. type: 'success',
  240. offset : 70
  241. });
  242. }
  243. }).catch(err => {
  244. console.log(err)
  245. this.$message.error({message : '请求失败!', offset : 70});
  246. })
  247. },
  248. /* 终止任务 */
  249. deleteProcess (r) {
  250. this.tableloading = true
  251. debugger
  252. // this.$prompt('请输入审批意见', '审批拒绝', {
  253. // confirmButtonText: '确定',
  254. // cancelButtonText: '取消',
  255. // type: 'warning'
  256. // }).then((value) => {
  257. var formData = null;
  258. if (this.type == '0') {
  259. formData = JSON.stringify(this.$refs.parserRef[this.$refs.parserRef.formConf.formModel]);
  260. } else {
  261. debugger
  262. try{
  263. let callBackData = window.frames['customWindow'].callBack("refuse");
  264. if(callBackData != null){
  265. if (callBackData.code != 200) {
  266. this.$message({
  267. message:callBackData.msg,
  268. type: 'warning'
  269. });
  270. this.tableloading = false;
  271. return;
  272. } else {
  273. formData = JSON.stringify(callBackData.formData);
  274. }
  275. }
  276. }catch(e){
  277. console.log(e);
  278. if ("SecurityError" != e.name) {
  279. return;
  280. }
  281. this.tableloading = false;
  282. }
  283. }
  284. if(this.messageCant){
  285. this.fileData = new FormData();
  286. this.fileData.append("processInstanceId", this.tempRow.instId);
  287. this.fileData.append("reason", this.messageCant);
  288. this.fileData.append("formData", formData);
  289. this.Axios.post('/api/flow/deleteProcessInstanceById', this.fileData).then(response => {
  290. if (response.data.code == "200") {
  291. this.tempRow = null;
  292. this.message = '';
  293. this.messageCant = '';
  294. this.fileData = new FormData();
  295. this.$message({
  296. message: '保存成功!',
  297. type: 'success',
  298. offset : 70
  299. });
  300. this.cantVisible = false;
  301. this.tableloading = false;
  302. this.closeDeal();
  303. } else {
  304. this.$message.error({message : response.data.message, offset : 70});
  305. this.tableloading = false;
  306. }
  307. }
  308. ).catch(err => {
  309. console.log(err)
  310. this.$message.error({message : '请求失败!', offset : 70});
  311. this.tableloading = false;
  312. })
  313. }else{
  314. this.$message.error({message : '审批意见不能为空!', offset : 70});
  315. }
  316. // }
  317. // ).catch(() => {
  318. // });
  319. },
  320. /* 办结提交 */
  321. completeTask (r) {
  322. this.tableloading = true
  323. var formData = null;
  324. if (this.type == '0') {
  325. formData = JSON.stringify(this.$refs.parserRef[this.$refs.parserRef.formConf.formModel]);
  326. } else {
  327. try{
  328. let callBackData = window.frames['customWindow'].callBack("adopt");
  329. if(callBackData != null){
  330. if (callBackData.code != 200) {
  331. this.$message({
  332. message:callBackData.msg,
  333. type: 'warning'
  334. });
  335. this.tableloading = false;
  336. return;
  337. } else {
  338. formData = JSON.stringify(callBackData.formData);
  339. }
  340. }
  341. }catch(e){
  342. console.log(e);
  343. if ("SecurityError" != e.name) {
  344. return;
  345. }
  346. this.tableloading = false;
  347. }
  348. }
  349. //this.submitUpload();
  350. this.fileData = new FormData();
  351. this.fileData.append('taskId', this.tempRow.taskId)
  352. this.fileData.append('message', this.message)
  353. this.fileData.append('type', "通过")
  354. this.fileData.append("formData", formData);
  355. this.Axios.post('/api/flow/completeTask', this.fileData).then(response => {
  356. if (!!response.data) {
  357. if (response.data.code == "200") {
  358. this.tempRow = null;
  359. this.message = '';
  360. this.messageCant = '';
  361. this.fileData = new FormData();
  362. this.$message({
  363. message: '保存成功!',
  364. type: 'success',
  365. offset : 70
  366. });
  367. this.attachmentVisible = false;
  368. this.tableloading = false;
  369. this.closeDeal();
  370. } else {
  371. this.$message.error({message : response.data.message, offset : 70});
  372. this.tableloading = false;
  373. }
  374. }
  375. }).catch(err => {
  376. console.log(err)
  377. this.$message.error({message : '请求失败!', offset : 70});
  378. this.tableloading = false;
  379. })
  380. },
  381. /** 重写上传方法 */
  382. uploadFile(file) {
  383. this.fileData = new FormData();
  384. this.fileData.append('files', file.file); // append增加数据
  385. console.log(this.fileData);
  386. },
  387. // 文件移除提醒
  388. beforeRemove(file, fileList) {
  389. return this.$confirm(`确定删除 ${ file.name }?`);
  390. },
  391. // 文件移除
  392. handleRemove(file, fileList) {
  393. console.log(file);
  394. console.log(fileList);
  395. this.Axios.post('/api/flow/deleteAttachment', 'attachmentId=' + file.id).then(response => {
  396. if (!!response.data) {
  397. this.$message({
  398. message: '操作成功!',
  399. type: 'success',
  400. offset : 70
  401. });
  402. }
  403. }).catch(err => {
  404. console.log(err)
  405. this.$message.error({message : '请求失败!'});
  406. })
  407. },
  408. // 触发文件上传
  409. /* submitUpload() {
  410. this.$refs.upload.submit();
  411. }, */
  412. // 挂起流程
  413. activateProcessInstance (r) {
  414. this.$confirm('是否恢复被挂起的流程?', '提示', {
  415. confirmButtonText: '确定',
  416. cancelButtonText: '取消',
  417. type: 'warning'
  418. }).then(() => {
  419. this.Axios.post('/api/flow/activateProcessInstance', 'taskId=' + r.taskId).then(response => {
  420. if (!!response.data) {
  421. this.$message({
  422. message: '操作成功!',
  423. type: 'success',
  424. offset : 70
  425. });
  426. }
  427. }).catch(err => {
  428. console.log(err)
  429. this.$message.error({message : '请求失败!', offset : 70});
  430. })
  431. }).catch(() => {
  432. });
  433. },
  434. // 可驳回节点列表
  435. findReturnUserTask(){
  436. this.findReturnUserTaskVisible = true;
  437. this.Axios.post('/api/flow/findReturnUserTask', 'taskId=' + this.tempRow.taskId).then(response => {
  438. if (!!response.data) {
  439. this.userTaskList = response.data;
  440. }
  441. }).catch(err => {
  442. console.log(err)
  443. this.$message.error({message : '请求失败!', offset : 70});
  444. })
  445. },
  446. // 任务退回
  447. flowReturn(){
  448. this.Axios.post('/api/flow/flowReturn', 'taskId=' + this.tempRow.taskId + '&targetKey=' + this.backNode).then(response => {
  449. if (!!response.data) {
  450. if (response.data.code != '200') {
  451. this.$message.error({message : response.data.message, offset : 70});
  452. } else {
  453. this.$message({
  454. message: '操作成功!',
  455. type: 'success',
  456. offset : 70
  457. });
  458. this.findReturnUserTaskVisible = false;
  459. this.closeDeal();
  460. }
  461. }
  462. }).catch(err => {
  463. console.log(err)
  464. this.$message.error({message : '请求失败!', offset : 70});
  465. })
  466. },
  467. closeDeal () {
  468. this.iframeUrl="";
  469. this.parentDom.closeDealVue();
  470. }
  471. }
  472. }
  473. </script>
  474. <style>
  475. .el-message-box{
  476. margin-top: -29%;
  477. width: 40%;
  478. height: 28%;
  479. }
  480. </style>