deal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  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. this.tableloading = false;
  316. }
  317. // }
  318. // ).catch(() => {
  319. // });
  320. },
  321. /* 办结提交 */
  322. completeTask (r) {
  323. this.tableloading = true
  324. var formData = null;
  325. if (this.type == '0') {
  326. formData = JSON.stringify(this.$refs.parserRef[this.$refs.parserRef.formConf.formModel]);
  327. } else {
  328. try{
  329. let callBackData = window.frames['customWindow'].callBack("adopt");
  330. if(callBackData != null){
  331. if (callBackData.code != 200) {
  332. this.$message({
  333. message:callBackData.msg,
  334. type: 'warning'
  335. });
  336. this.tableloading = false;
  337. return;
  338. } else {
  339. formData = JSON.stringify(callBackData.formData);
  340. }
  341. }
  342. }catch(e){
  343. console.log(e);
  344. if ("SecurityError" != e.name) {
  345. return;
  346. }
  347. this.tableloading = false;
  348. }
  349. }
  350. //this.submitUpload();
  351. this.fileData = new FormData();
  352. this.fileData.append('taskId', this.tempRow.taskId)
  353. this.fileData.append('message', this.message)
  354. this.fileData.append('type', "通过")
  355. this.fileData.append("formData", formData);
  356. this.Axios.post('/api/flow/completeTask', this.fileData).then(response => {
  357. if (!!response.data) {
  358. if (response.data.code == "200") {
  359. this.tempRow = null;
  360. this.message = '';
  361. this.messageCant = '';
  362. this.fileData = new FormData();
  363. this.$message({
  364. message: '保存成功!',
  365. type: 'success',
  366. offset : 70
  367. });
  368. this.attachmentVisible = false;
  369. this.tableloading = false;
  370. window.parent.goParent();
  371. // this.closeDeal();
  372. } else {
  373. this.$message.error({message : response.data.message, offset : 70});
  374. this.tableloading = false;
  375. }
  376. }
  377. }).catch(err => {
  378. console.log(err)
  379. this.$message.error({message : '请求失败!', offset : 70});
  380. this.tableloading = false;
  381. })
  382. },
  383. /** 重写上传方法 */
  384. uploadFile(file) {
  385. this.fileData = new FormData();
  386. this.fileData.append('files', file.file); // append增加数据
  387. console.log(this.fileData);
  388. },
  389. // 文件移除提醒
  390. beforeRemove(file, fileList) {
  391. return this.$confirm(`确定删除 ${ file.name }?`);
  392. },
  393. // 文件移除
  394. handleRemove(file, fileList) {
  395. console.log(file);
  396. console.log(fileList);
  397. this.Axios.post('/api/flow/deleteAttachment', 'attachmentId=' + file.id).then(response => {
  398. if (!!response.data) {
  399. this.$message({
  400. message: '操作成功!',
  401. type: 'success',
  402. offset : 70
  403. });
  404. }
  405. }).catch(err => {
  406. console.log(err)
  407. this.$message.error({message : '请求失败!'});
  408. })
  409. },
  410. // 触发文件上传
  411. /* submitUpload() {
  412. this.$refs.upload.submit();
  413. }, */
  414. // 挂起流程
  415. activateProcessInstance (r) {
  416. this.$confirm('是否恢复被挂起的流程?', '提示', {
  417. confirmButtonText: '确定',
  418. cancelButtonText: '取消',
  419. type: 'warning'
  420. }).then(() => {
  421. this.Axios.post('/api/flow/activateProcessInstance', 'taskId=' + r.taskId).then(response => {
  422. if (!!response.data) {
  423. this.$message({
  424. message: '操作成功!',
  425. type: 'success',
  426. offset : 70
  427. });
  428. }
  429. }).catch(err => {
  430. console.log(err)
  431. this.$message.error({message : '请求失败!', offset : 70});
  432. })
  433. }).catch(() => {
  434. });
  435. },
  436. // 可驳回节点列表
  437. findReturnUserTask(){
  438. this.findReturnUserTaskVisible = true;
  439. this.Axios.post('/api/flow/findReturnUserTask', 'taskId=' + this.tempRow.taskId).then(response => {
  440. if (!!response.data) {
  441. this.userTaskList = response.data;
  442. }
  443. }).catch(err => {
  444. console.log(err)
  445. this.$message.error({message : '请求失败!', offset : 70});
  446. })
  447. },
  448. // 任务退回
  449. flowReturn(){
  450. this.Axios.post('/api/flow/flowReturn', 'taskId=' + this.tempRow.taskId + '&targetKey=' + this.backNode).then(response => {
  451. if (!!response.data) {
  452. if (response.data.code != '200') {
  453. this.$message.error({message : response.data.message, offset : 70});
  454. } else {
  455. this.$message({
  456. message: '操作成功!',
  457. type: 'success',
  458. offset : 70
  459. });
  460. this.findReturnUserTaskVisible = false;
  461. this.closeDeal();
  462. }
  463. }
  464. }).catch(err => {
  465. console.log(err)
  466. this.$message.error({message : '请求失败!', offset : 70});
  467. })
  468. },
  469. closeDeal () {
  470. this.iframeUrl="";
  471. this.parentDom.closeDealVue();
  472. }
  473. }
  474. }
  475. </script>
  476. <style>
  477. .el-message-box{
  478. margin-top: -29%;
  479. width: 40%;
  480. height: 28%;
  481. }
  482. </style>