deal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  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. debugger
  251. // this.$prompt('请输入审批意见', '审批拒绝', {
  252. // confirmButtonText: '确定',
  253. // cancelButtonText: '取消',
  254. // type: 'warning'
  255. // }).then((value) => {
  256. var formData = null;
  257. if (this.type == '0') {
  258. formData = JSON.stringify(this.$refs.parserRef[this.$refs.parserRef.formConf.formModel]);
  259. } else {
  260. debugger
  261. try{
  262. let callBackData = window.frames['customWindow'].callBack("refuse");
  263. if(callBackData != null){
  264. if (callBackData.code != 200) {
  265. this.$message({
  266. message:callBackData.msg,
  267. type: 'warning'
  268. });
  269. return;
  270. } else {
  271. formData = JSON.stringify(callBackData.formData);
  272. }
  273. }
  274. }catch(e){
  275. console.log(e);
  276. if ("SecurityError" != e.name) {
  277. return;
  278. }
  279. }
  280. }
  281. if(this.messageCant){
  282. this.fileData = new FormData();
  283. this.fileData.append("processInstanceId", this.tempRow.instId);
  284. this.fileData.append("reason", this.messageCant);
  285. this.fileData.append("formData", formData);
  286. this.Axios.post('/api/flow/deleteProcessInstanceById', this.fileData).then(response => {
  287. if (response.data.code == "200") {
  288. this.tempRow = null;
  289. this.message = '';
  290. this.messageCant = '';
  291. this.fileData = new FormData();
  292. this.$message({
  293. message: '保存成功!',
  294. type: 'success',
  295. offset : 70
  296. });
  297. this.cantVisible = false;
  298. this.closeDeal();
  299. } else {
  300. this.$message.error({message : response.data.message, offset : 70});
  301. }
  302. }
  303. ).catch(err => {
  304. console.log(err)
  305. this.$message.error({message : '请求失败!', offset : 70});
  306. })
  307. }else{
  308. this.$message.error({message : '审批意见不能为空!', offset : 70});
  309. }
  310. // }
  311. // ).catch(() => {
  312. // });
  313. },
  314. /* 办结提交 */
  315. completeTask (r) {
  316. this.tableloading = true
  317. var formData = null;
  318. if (this.type == '0') {
  319. formData = JSON.stringify(this.$refs.parserRef[this.$refs.parserRef.formConf.formModel]);
  320. } else {
  321. try{
  322. let callBackData = window.frames['customWindow'].callBack("adopt");
  323. if(callBackData != null){
  324. if (callBackData.code != 200) {
  325. this.$message({
  326. message:callBackData.msg,
  327. type: 'warning'
  328. });
  329. this.tableloading = false;
  330. return;
  331. } else {
  332. formData = JSON.stringify(callBackData.formData);
  333. }
  334. }
  335. }catch(e){
  336. console.log(e);
  337. if ("SecurityError" != e.name) {
  338. return;
  339. }
  340. this.tableloading = false;
  341. }
  342. }
  343. //this.submitUpload();
  344. this.fileData = new FormData();
  345. this.fileData.append('taskId', this.tempRow.taskId)
  346. this.fileData.append('message', this.message)
  347. this.fileData.append('type', "通过")
  348. this.fileData.append("formData", formData);
  349. this.Axios.post('/api/flow/completeTask', this.fileData).then(response => {
  350. if (!!response.data) {
  351. if (response.data.code == "200") {
  352. this.tempRow = null;
  353. this.message = '';
  354. this.messageCant = '';
  355. this.fileData = new FormData();
  356. this.$message({
  357. message: '保存成功!',
  358. type: 'success',
  359. offset : 70
  360. });
  361. this.attachmentVisible = false;
  362. this.tableloading = false;
  363. this.closeDeal();
  364. } else {
  365. this.$message.error({message : response.data.message, offset : 70});
  366. this.tableloading = false;
  367. }
  368. }
  369. }).catch(err => {
  370. console.log(err)
  371. this.$message.error({message : '请求失败!', offset : 70});
  372. this.tableloading = false;
  373. })
  374. },
  375. /** 重写上传方法 */
  376. uploadFile(file) {
  377. this.fileData = new FormData();
  378. this.fileData.append('files', file.file); // append增加数据
  379. console.log(this.fileData);
  380. },
  381. // 文件移除提醒
  382. beforeRemove(file, fileList) {
  383. return this.$confirm(`确定删除 ${ file.name }?`);
  384. },
  385. // 文件移除
  386. handleRemove(file, fileList) {
  387. console.log(file);
  388. console.log(fileList);
  389. this.Axios.post('/api/flow/deleteAttachment', 'attachmentId=' + file.id).then(response => {
  390. if (!!response.data) {
  391. this.$message({
  392. message: '操作成功!',
  393. type: 'success',
  394. offset : 70
  395. });
  396. }
  397. }).catch(err => {
  398. console.log(err)
  399. this.$message.error({message : '请求失败!'});
  400. })
  401. },
  402. // 触发文件上传
  403. /* submitUpload() {
  404. this.$refs.upload.submit();
  405. }, */
  406. // 挂起流程
  407. activateProcessInstance (r) {
  408. this.$confirm('是否恢复被挂起的流程?', '提示', {
  409. confirmButtonText: '确定',
  410. cancelButtonText: '取消',
  411. type: 'warning'
  412. }).then(() => {
  413. this.Axios.post('/api/flow/activateProcessInstance', 'taskId=' + r.taskId).then(response => {
  414. if (!!response.data) {
  415. this.$message({
  416. message: '操作成功!',
  417. type: 'success',
  418. offset : 70
  419. });
  420. }
  421. }).catch(err => {
  422. console.log(err)
  423. this.$message.error({message : '请求失败!', offset : 70});
  424. })
  425. }).catch(() => {
  426. });
  427. },
  428. // 可驳回节点列表
  429. findReturnUserTask(){
  430. this.findReturnUserTaskVisible = true;
  431. this.Axios.post('/api/flow/findReturnUserTask', 'taskId=' + this.tempRow.taskId).then(response => {
  432. if (!!response.data) {
  433. this.userTaskList = response.data;
  434. }
  435. }).catch(err => {
  436. console.log(err)
  437. this.$message.error({message : '请求失败!', offset : 70});
  438. })
  439. },
  440. // 任务退回
  441. flowReturn(){
  442. this.Axios.post('/api/flow/flowReturn', 'taskId=' + this.tempRow.taskId + '&targetKey=' + this.backNode).then(response => {
  443. if (!!response.data) {
  444. if (response.data.code != '200') {
  445. this.$message.error({message : response.data.message, offset : 70});
  446. } else {
  447. this.$message({
  448. message: '操作成功!',
  449. type: 'success',
  450. offset : 70
  451. });
  452. this.findReturnUserTaskVisible = false;
  453. this.closeDeal();
  454. }
  455. }
  456. }).catch(err => {
  457. console.log(err)
  458. this.$message.error({message : '请求失败!', offset : 70});
  459. })
  460. },
  461. closeDeal () {
  462. this.iframeUrl="";
  463. this.parentDom.closeDealVue();
  464. }
  465. }
  466. }
  467. </script>
  468. <style>
  469. .el-message-box{
  470. margin-top: -29%;
  471. width: 40%;
  472. height: 28%;
  473. }
  474. </style>