ApproveComment.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. <template>
  2. <div>
  3. <div
  4. v-if="processInstanceDescription != undefined"
  5. class="panel panel-default"
  6. >
  7. <div class="panel-heading">
  8. {{ $t("lang.approveComment.approveStatus") }}
  9. <span class="label label-primary m-label">
  10. {{
  11. !processInstanceDescription.suspended
  12. ? $t("lang.approveComment.running")
  13. : $t("lang.approveComment.finished")
  14. }}
  15. </span>
  16. <span class="label label-info m-label">
  17. {{ $t("lang.approveComment.needApprove") }}:
  18. {{
  19. processInstanceDescription.taskDescriptions == undefined
  20. ? "0"
  21. : processInstanceDescription.taskDescriptions.length
  22. }}
  23. </span>
  24. <span class="label label-success m-label">
  25. {{ $t("lang.approveComment.approved") }}:
  26. {{
  27. processInstanceDescription.historicTaskInstanceDescriptions == undefined
  28. ? "0"
  29. : processInstanceDescription.historicTaskInstanceDescriptions.length
  30. }}
  31. </span>
  32. </div>
  33. <div class="panel-body">
  34. <div v-if="showChoiceButton && isActiveTask" class="form">
  35. <PreviousNodeSelectUser
  36. ref="previousNodeSelectUser"
  37. :process-instance-id="processInstanceId"
  38. :model-data="modelData"
  39. :work-flow="workFlow"
  40. :task-id="taskInfoId"
  41. :approve-form-value="approveFormValue"
  42. />
  43. <div class="form-group" style="margin-top: 10px">
  44. <div
  45. class="btn-group btn-group-justified"
  46. role="group"
  47. aria-label="..."
  48. >
  49. <div class="btn-group" role="group">
  50. <button
  51. type="button"
  52. class="btn btn-primary"
  53. @click="modal3 = true"
  54. >
  55. {{ $t("lang.approveComment.approve") }}<br />
  56. <font v-if="$i18n.locale == 'zh-CN'">Approve</font>
  57. </button>
  58. </div>
  59. <div class="btn-group" role="group">
  60. <button type="button" class="btn btn-secondary" @click="transfer">
  61. {{ $t("lang.approveComment.transfer") }}
  62. <br />
  63. <font v-if="$i18n.locale == 'zh-CN'">Forward</font>
  64. </button>
  65. </div>
  66. <div class="btn-group" role="group">
  67. <button type="button" class="btn btn-danger" @click="reject">
  68. {{ $t("lang.approveComment.reject") }}
  69. <br />
  70. <font v-if="$i18n.locale == 'zh-CN'">Reject</font>
  71. </button>
  72. </div>
  73. <div class="btn-group" role="group">
  74. <button type="button" class="btn btn-warning" @click="withdraw">
  75. {{ $t("lang.approveComment.return") }}
  76. <br />
  77. <font v-if="$i18n.locale == 'zh-CN'">Return</font>
  78. </button>
  79. </div>
  80. <div class="btn-group" role="group">
  81. <button
  82. type="button"
  83. class="btn btn-info"
  84. @click="addComment"
  85. >
  86. {{ $t("lang.approveComment.comment") }}
  87. <br />
  88. <font v-if="$i18n.locale == 'zh-CN'">Comments</font>
  89. </button>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- 表单属性 -->
  94. <ApproveForm
  95. ref="approveForm"
  96. :process-instance-id="processInstanceId"
  97. :workflow="workFlow"
  98. :task-id="taskInfoId"
  99. @value-changed="approveFormValueChanged"
  100. />
  101. <div class="form-group">
  102. <label class="control-label">{{ $t("lang.approveComment.opinion") }}</label>
  103. <textarea v-model="comment" class="form-control" rows="3" />
  104. </div>
  105. <ApproveTaskAttachmentEdit :task-id="taskInfoId" />
  106. </div>
  107. <ul class="media-list">
  108. <li class="media">
  109. <div class="media-left">
  110. <a>
  111. <AuthImage
  112. id="image202002281140001"
  113. :auth-src="
  114. Common.getThumbnailImageSrc(
  115. 'com.leanwo.prodog.base.model.User',
  116. processInstanceDescription.startUserImage
  117. )
  118. "
  119. class="media-object thumbnail m-image"
  120. />
  121. </a>
  122. </div>
  123. <div class="media-body">
  124. <h4 class="media-heading">
  125. {{ processInstanceDescription.startUserName }}
  126. <small class="badge alert-success">{{
  127. $t("lang.approveComment.submitUser")
  128. }}</small>
  129. </h4>
  130. <h5 class="m-h5">{{ processInstanceDescription.startTime }}</h5>
  131. <p class="comment-text">{{ $t("lang.approveComment.submitApprove") }}</p>
  132. </div>
  133. </li>
  134. <template v-if="processInstanceDescription.historicTaskInstanceDescriptions != undefined">
  135. <li
  136. v-for="historicTaskInstanceDescription in processInstanceDescription.historicTaskInstanceDescriptions"
  137. :key="historicTaskInstanceDescription.id"
  138. class="media"
  139. >
  140. <div class="media-left">
  141. <a>
  142. <AuthImage
  143. :auth-src="
  144. Common.getThumbnailImageSrc(
  145. 'com.leanwo.prodog.base.model.User',
  146. historicTaskInstanceDescription.assigneeImageUrl
  147. )
  148. "
  149. class="media-object thumbnail m-image"
  150. />
  151. </a>
  152. </div>
  153. <div class="media-body">
  154. <h4 class="media-heading">
  155. {{ historicTaskInstanceDescription.assigneeName }}
  156. <small class="badge alert-success">{{
  157. historicTaskInstanceDescription.name
  158. }}</small>
  159. </h4>
  160. <div v-if="historicTaskInstanceDescription.comments != undefined">
  161. <div
  162. v-for="commentItem in historicTaskInstanceDescription.comments"
  163. :key="commentItem.id"
  164. >
  165. <h5 class="m-h5">{{ commentItem.time }}</h5>
  166. <p class="comment-text">{{ commentItem.message }}</p>
  167. </div>
  168. </div>
  169. <ApproveTaskAttachmentView :enable-delete="false" :attachments="historicTaskInstanceDescription.attachments" />
  170. </div>
  171. </li>
  172. </template>
  173. <template v-for="activeTask in processInstanceDescription.taskDescriptions" :key="activeTask.id">
  174. <li
  175. v-if="
  176. processInstanceDescription.taskDescriptions != undefined
  177. "
  178. class="media"
  179. >
  180. <div class="media-left">
  181. <a>
  182. <AuthImage
  183. :auth-src="
  184. Common.getThumbnailImageSrc(
  185. 'com.leanwo.prodog.base.model.User',
  186. activeTask.assigneeImageUrl
  187. )
  188. "
  189. class="media-object thumbnail m-image"
  190. />
  191. </a>
  192. </div>
  193. <div class="media-body">
  194. <h4 class="media-heading">
  195. {{ activeTask.assigneeName }}
  196. <small class="badge alert-info">{{ activeTask.name }}</small>
  197. </h4>
  198. <h5 class="m-h5">{{ activeTask.startTime }}</h5>
  199. <p class="comment-text">{{ $t("lang.approveComment.processing") }}</p>
  200. <div v-if="activeTask.comments != undefined">
  201. <div
  202. v-for="commentItem in activeTask.comments"
  203. :key="commentItem.id"
  204. >
  205. <h5 class="m-h5">{{ commentItem.time }}</h5>
  206. <p class="comment-text">{{ commentItem.message }}</p>
  207. </div>
  208. </div>
  209. <ApproveTaskAttachmentView :enable-delete="activeTask.id == taskInfoId" :attachments="activeTask.attachments" />
  210. </div>
  211. </li>
  212. </template>
  213. </ul>
  214. </div>
  215. </div>
  216. <Modal
  217. v-model:show="modal3"
  218. :small="true"
  219. :show-ok-button="false"
  220. :show-canel-button="false"
  221. >
  222. <template #header>
  223. <h3>{{ $t("lang.approveComment.notice") }}</h3>
  224. </template>
  225. <div class="row">
  226. <div class="col-md-12">
  227. <h3>{{ $t("lang.approveComment.confirmSubmit") }}</h3>
  228. </div>
  229. <div class="col-md-6">
  230. <button
  231. type="button"
  232. class="btn btn-success btn-lg"
  233. style="margin-top: 20px; width: 100%"
  234. @click="confirmApprove"
  235. >
  236. {{ $t("lang.approveComment.confirm") }}
  237. </button>
  238. </div>
  239. <div class="col-md-6">
  240. <button
  241. type="button"
  242. class="btn btn-default btn-lg"
  243. style="margin-top: 20px; width: 100%"
  244. @click="modal3 = false"
  245. >
  246. {{ $t("lang.approveComment.cancel") }}
  247. </button>
  248. </div>
  249. </div>
  250. </Modal>
  251. <Modal
  252. v-model:show="modal4"
  253. :small="true"
  254. :show-ok-button="false"
  255. :show-canel-button="false"
  256. >
  257. <template #header>
  258. <h3>{{ $t("lang.approveComment.notice") }}</h3>
  259. </template>
  260. <div class="row">
  261. <div class="col-md-12">
  262. <h3>{{ $t("lang.approveComment.rejectConfirm") }}</h3>
  263. </div>
  264. <div class="col-md-6">
  265. <button
  266. type="button"
  267. class="btn btn-success btn-lg"
  268. style="margin-top: 20px; width: 100%"
  269. @click="confirmReject"
  270. >
  271. {{ $t("lang.approveComment.confirm") }}
  272. </button>
  273. </div>
  274. <div class="col-md-6">
  275. <button
  276. type="button"
  277. class="btn btn-default btn-lg"
  278. style="margin-top: 20px; width: 100%"
  279. @click="modal4 = false"
  280. >
  281. {{ $t("lang.approveComment.cancel") }}
  282. </button>
  283. </div>
  284. </div>
  285. </Modal>
  286. <Modal v-model:show="modal5" :full="true">
  287. <InfoWindow
  288. ref="info"
  289. :info-window-no="infoWindowNo"
  290. :where-clause-source="whereClauseSource"
  291. @data-selected="transferSelectedUser"
  292. />
  293. <template #header>
  294. {{ $t("lang.approveComment.chooseTransferUser") }}
  295. </template>
  296. </Modal>
  297. <Modal v-model:show="modal6" :full="true" @ok="transferSave">
  298. <textarea
  299. v-model="transferText"
  300. width="100%"
  301. class="form-control"
  302. :placeholder="$t('lang.approveComment.inputComment')"
  303. />
  304. <template #header>
  305. {{ $t("lang.approveComment.transferTo") }}{{ transferUserName }}
  306. </template>
  307. </Modal>
  308. <Modal
  309. v-model:show="modal7"
  310. :small="true"
  311. :show-ok-button="false"
  312. :show-canel-button="false"
  313. >
  314. <template #header>
  315. <h3>{{ $t("lang.approveComment.notice") }}</h3>
  316. </template>
  317. <div class="row">
  318. <div class="col-md-12">
  319. <h3>{{ $t("lang.approveComment.returnConfirm") }}</h3>
  320. </div>
  321. <div class="col-md-6">
  322. <button
  323. type="button"
  324. class="btn btn-success btn-lg"
  325. style="margin-top: 20px; width: 100%"
  326. @click="confirmReturn"
  327. >
  328. {{ $t("lang.approveComment.confirm") }}
  329. </button>
  330. </div>
  331. <div class="col-md-6">
  332. <button
  333. type="button"
  334. class="btn btn-default btn-lg"
  335. style="margin-top: 20px; width: 100%"
  336. @click="modal7 = false"
  337. >
  338. {{ $t("lang.approveComment.cancel") }}
  339. </button>
  340. </div>
  341. </div>
  342. </Modal>
  343. <Loading v-if="loading" />
  344. </div>
  345. </template>
  346. <script>
  347. import Common from '../common/Common.js';
  348. import WindowService from '../common/WindowService.js';
  349. import CustomerWindowResource from '../resource/dictionary/CustomerWindowResource.js';
  350. import UserStorageResource from '../api/base/UserStorageResource.js';
  351. import UserResource from '../api/base/UserResource.js';
  352. import WorkflowResource from '../api/workflow/WorkflowResource.js';
  353. import PreviousNodeSelectUser from './PreviousNodeSelectUser.vue';
  354. import AuthImage from '../widget/AuthImage.vue';
  355. import ApproveForm from './ApproveForm.vue';
  356. import vSelect from 'vue-select';
  357. import 'vue-select/dist/vue-select.css';
  358. import { Notify, Uuid } from 'pc-component-v3';
  359. import ApproveTaskAttachmentEdit from './ApproveTaskAttachmentEdit.vue';
  360. import ApproveTaskAttachmentView from './ApproveTaskAttachmentView.vue';
  361. export default {
  362. components: {
  363. AuthImage,
  364. vSelect,
  365. PreviousNodeSelectUser,
  366. ApproveForm,
  367. ApproveTaskAttachmentEdit,
  368. ApproveTaskAttachmentView,
  369. },
  370. props: {
  371. windowNo: {
  372. type: String,
  373. default: null,
  374. },
  375. processInstanceId: {
  376. type: String,
  377. default: null,
  378. },
  379. taskInfoId: {
  380. type: String,
  381. default: null,
  382. },
  383. showChoiceButton: {
  384. type: Boolean,
  385. default: null,
  386. },
  387. recordId: {
  388. type: Number,
  389. default: null,
  390. },
  391. workFlow: {
  392. type: Object,
  393. default : function(){
  394. return null;
  395. },
  396. },
  397. workflowType: {
  398. type: String,
  399. default: null,
  400. },
  401. modelData: {
  402. type: Object,
  403. default : function(){
  404. return null;
  405. },
  406. },
  407. uuid: {
  408. type: String,
  409. default: null,
  410. },
  411. parentWidget: {
  412. type: String,
  413. default: null,
  414. },
  415. workflowClassName: {
  416. type: String,
  417. default: null,
  418. },
  419. },
  420. emits: ['saveData'],
  421. data: function () {
  422. this.Common = Common;
  423. return {
  424. processInstanceDescription: {},
  425. comment: '',
  426. className: 'WorkFlow',
  427. infoWindowNo: '050408',
  428. className1: 'com.leanwo.prodog.base.model.User',
  429. copyUsers: [],
  430. currentUser: '',
  431. whereClauseSource: {
  432. customWhere: null,
  433. },
  434. selectedUserTaskDto: '',
  435. currentUsers: [],
  436. transferUserId: undefined,
  437. transferUserName: undefined,
  438. transferText: undefined,
  439. userName: undefined,
  440. organizationName: undefined,
  441. userItem: undefined,
  442. isActiveTask: false, // 是否是有效的任务(任务未结束,任务属于登录人员)
  443. approveFormValue: null, // 自定义表单的数据
  444. loading: false,
  445. modal3: false,
  446. modal4: false,
  447. modal5: false,
  448. modal6: false,
  449. modal7: false,
  450. };
  451. },
  452. watch: {
  453. processInstanceId: function (currentValue, oldValue) {
  454. this.refresh();
  455. },
  456. taskInfoId: function (currentValue, oldValue) {
  457. this.checkIsActiveTask();
  458. },
  459. },
  460. mounted: function () {
  461. var _self = this;
  462. this.refresh();
  463. this.checkIsActiveTask();
  464. },
  465. methods: {
  466. /**
  467. * 获取图片路径
  468. * @param {String} imageName 图片名称
  469. * @return {void}
  470. */
  471. getImgSrc: function (imageName) {
  472. var _self = this;
  473. if (imageName == undefined || imageName == '') {
  474. return '/static/assets/client-base-v4/image/noImage.jpg';
  475. }
  476. return Common.getImageSrc(_self.className, imageName);
  477. },
  478. /**
  479. * 转交保存
  480. */
  481. transferSave: function () {
  482. var _self = this;
  483. _self.loading=true;
  484. var transferTask = new Object();
  485. transferTask.workflowType = _self.workFlow.workflowType;
  486. transferTask.taskId = _self.taskInfoId;
  487. transferTask.comment = _self.transferText;
  488. transferTask.transferUserName = _self.transferUserName;
  489. transferTask.transferUserId = _self.transferUserId;
  490. transferTask.className = _self.workflowClassName;
  491. transferTask.recordId = _self.recordId;
  492. console.log(_self.workflowClassName);
  493. $.ajax({
  494. url: Common.getApiURL('WorkflowResource/transfer'),
  495. type: 'post',
  496. beforeSend: function (request) {
  497. Common.addTokenToRequest(request);
  498. },
  499. contentType: 'application/json',
  500. data: JSON.stringify(transferTask),
  501. success: function (data) {
  502. _self.loading=false;
  503. Notify.success('通知', '数据提交成功', true);
  504. setTimeout(function () {
  505. window.close();
  506. }, 1000);
  507. },
  508. error: function (XMLHttpRequest, textStatus, errorThrown) {
  509. _self.loading=false;
  510. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  511. },
  512. });
  513. },
  514. /**
  515. * 选择用户后
  516. * @param {Object} modelData 用户信息
  517. * @return {void}
  518. */
  519. transferSelectedUser: function (modelData) {
  520. var _self = this;
  521. this.modal5 = false;
  522. var userId = modelData.id;
  523. _self.loading=true;
  524. $.ajax({
  525. url: Common.getApiURL('userResource/getUser'),
  526. type: 'get',
  527. beforeSend: function (request) {
  528. Common.addTokenToRequest(request);
  529. },
  530. data: {
  531. userId: userId,
  532. },
  533. success: function (data) {
  534. _self.loading=false;
  535. _self.transferUserId = data.id;
  536. _self.transferUserName = data.name;
  537. _self.modal6 = true;
  538. },
  539. error: function (XMLHttpRequest, textStatus, errorThrown) {
  540. _self.loading=false;
  541. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  542. },
  543. });
  544. },
  545. /**
  546. * 转批
  547. * @author GuoZhiBo 20200611
  548. */
  549. transfer: function () {
  550. var _self = this;
  551. _self.initData();
  552. if(_self.windowNo != null && (_self.windowNo == '20220707_162600' || _self.windowNo == '20220703_174047')){
  553. _self.infoWindowNo = '20220928_175733';
  554. let areaId = _self.modelData.data.area.id;
  555. _self.whereClauseSource.customWhere = ' fm.areaId = ' + areaId;
  556. }else{
  557. _self.infoWindowNo = '050408';
  558. let customerDataDimensions = [{
  559. fieldName: 'client.id',
  560. dataDimensionTypeNo: '202201191757',
  561. defaultDataDimensionTypeValueNo: '4',
  562. }];
  563. _self.whereClauseSource.customerDataDimensions = customerDataDimensions;
  564. }
  565. _self.modal5 = true;
  566. },
  567. /**
  568. * 确认审批通过
  569. */
  570. confirmApprove: function () {
  571. var _self = this;
  572. _self.modal3 = false;
  573. if (_self.parentWidget == 'TabFormEdit') {
  574. this.$emit('saveData', 'APPROVE');
  575. } else {
  576. this.saveData('APPROVE');
  577. }
  578. },
  579. /**
  580. * 确认审批不通过
  581. */
  582. confirmReject: function () {
  583. var _self = this;
  584. _self.modal4 = false;
  585. this.saveData('REJECT');
  586. },
  587. /**
  588. * 初始化数据
  589. * @return {void}
  590. */
  591. initData: function () {
  592. var _self = this;
  593. },
  594. /**
  595. * 生成文件属性
  596. */
  597. generateFileProperty: function (item) {
  598. return {
  599. fileName: item,
  600. };
  601. },
  602. /**
  603. * 表单搜索框数据发生改变
  604. */
  605. valueChanged: function (newFieldValue, item) {
  606. item.value = newFieldValue.id;
  607. },
  608. /**
  609. * 刷新流程信息
  610. */
  611. refresh: function () {
  612. var _self = this;
  613. _self.loading=true;
  614. if (
  615. _self.processInstanceId == undefined ||
  616. _self.processInstanceId.length == 0
  617. ) {
  618. _self.processInstanceDescription = {};
  619. return;
  620. }
  621. $.ajax({
  622. url: Common.getApiURL('WorkflowResource/ProcessInstanceDescription'),
  623. type: 'GET',
  624. dataType: 'json',
  625. data: {
  626. processInstanceId: _self.processInstanceId,
  627. recordId: _self.recordId,
  628. },
  629. beforeSend: function (request) {
  630. Common.addTokenToRequest(request);
  631. },
  632. success: function (data) {
  633. _self.loading=false;
  634. _self.processInstanceDescription = data;
  635. },
  636. error: function (XMLHttpRequest, textStatus, errorThrown) {
  637. _self.loading=false;
  638. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  639. },
  640. });
  641. },
  642. /**
  643. * 拒绝
  644. */
  645. reject: function () {
  646. var _self = this;
  647. if (_self.comment == undefined || _self.comment.length == 0) {
  648. Notify.error('没有理由', '请填写拒绝的理由。', false);
  649. return;
  650. }
  651. _self.modal4 = true;
  652. },
  653. /**
  654. * 退回审批
  655. */
  656. withdraw: function () {
  657. var _self = this;
  658. if (_self.comment == undefined || _self.comment.length == 0) {
  659. Notify.error('没有理由', '请填写退回的理由。', false);
  660. return;
  661. }
  662. _self.modal7 = true;
  663. },
  664. /**
  665. * 确认退回
  666. */
  667. confirmReturn: function () {
  668. var _self = this;
  669. _self.modal7 = false;
  670. this.saveData('WITHDRAW');
  671. },
  672. /**
  673. * 添加评论
  674. */
  675. addComment: function () {
  676. var _self = this;
  677. if (_self.comment == undefined || _self.comment.length == 0) {
  678. Notify.error('无评论', '请填写评论。', false);
  679. return;
  680. }
  681. var addCommentRequest = {
  682. taskId: _self.taskInfoId,
  683. comment: _self.comment,
  684. };
  685. _self.loading=true;
  686. $.ajax({
  687. url: Common.getApiURL('WorkflowResource/addComment'),
  688. type: 'post',
  689. beforeSend: function (request) {
  690. Common.addTokenToRequest(request);
  691. },
  692. contentType: 'application/json',
  693. data: JSON.stringify(addCommentRequest),
  694. success: function (data) {
  695. _self.loading = false;
  696. _self.comment = '';
  697. _self.refresh();
  698. },
  699. error: function (XMLHttpRequest, textStatus, errorThrown) {
  700. _self.loading=false;
  701. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  702. },
  703. });
  704. },
  705. /**
  706. * 提交审批结果
  707. */
  708. saveData: function (command, modelData) {
  709. var _self = this;
  710. var chooseTask = new Object();
  711. chooseTask.workflowType = _self.workFlow.workflowType;
  712. chooseTask.taskId = _self.taskInfoId;
  713. chooseTask.command = command;
  714. chooseTask.comment = _self.comment;
  715. chooseTask.processInstanceId = _self.processInstanceId;
  716. chooseTask.windowNo = _self.windowNo;
  717. chooseTask.tabIndex = 0;
  718. chooseTask.recordId = _self.recordId;
  719. chooseTask.modelData = modelData;
  720. chooseTask.className = _self.workflowClassName;
  721. if (command === 'APPROVE') {
  722. try {
  723. chooseTask.keyValueObjects = this.$refs.approveForm.getData();
  724. } catch (exception) {
  725. console.log(exception);
  726. return;
  727. }
  728. try {
  729. const param = this.$refs.previousNodeSelectUser.getData();
  730. chooseTask.copyUserIds = param.copyUsers;
  731. chooseTask.userSelectDtos = param.userSelectDtos;
  732. } catch (exception) {
  733. Notify.error('存在未设置的审批人', exception.message, false);
  734. return;
  735. }
  736. }
  737. _self.loading=true;
  738. $.ajax({
  739. url: Common.getApiURL('WorkflowResource/SetChoice'),
  740. type: 'post',
  741. beforeSend: function (request) {
  742. Common.addTokenToRequest(request);
  743. },
  744. contentType: 'application/json',
  745. data: JSON.stringify(chooseTask),
  746. success: function (data) {
  747. _self.loading=false;
  748. Notify.success('通知', '数据提交成功', true);
  749. setTimeout(function () {
  750. window.location.reload();
  751. WindowService.close();
  752. }, 1000);
  753. },
  754. error: function (XMLHttpRequest, textStatus, errorThrown) {
  755. _self.loading=false;
  756. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  757. },
  758. });
  759. },
  760. /**
  761. * 获取评论的图片
  762. * @param {[type]} imageUrl [description]
  763. * @return {[type]} [description]
  764. */
  765. getCommentImageSrc: function (imageUrl) {
  766. console.log(imageUrl);
  767. var realImageUrl = Common.getImageSrc(
  768. this.className,
  769. 'thumbnail/' + imageUrl,
  770. );
  771. return realImageUrl;
  772. },
  773. /**
  774. * 打开图片附件的功能
  775. * @param {[type]} imageName [description]
  776. * @return {[type]} [description]
  777. */
  778. openImageAttachment: function (imageName) {
  779. if (imageName == undefined) {
  780. return;
  781. }
  782. var fullPath = Common.getImageSrc(this.className, imageName);
  783. window.open(fullPath);
  784. },
  785. /**
  786. * 打开自定义窗口
  787. */
  788. openCustomerWindow: function (customerWindowId) {
  789. var _self = this;
  790. CustomerWindowResource.getById(customerWindowId).then(
  791. successData => {
  792. if (successData == null) {
  793. Notify.error(
  794. '自定义窗口',
  795. 'id=' + customerWindowId + '的自定义窗口已经被删除。',
  796. true,
  797. );
  798. return;
  799. }
  800. var routeDate = {
  801. path: successData.routeUrl,
  802. params: {
  803. modelData: _self.modelData,
  804. },
  805. };
  806. // 请勿修改,会影响生单的功能
  807. let key = _self.uuid + '_modelData';
  808. let userStorageDtos = [
  809. {
  810. key: key,
  811. value: JSON.stringify(_self.modelData),
  812. },
  813. ];
  814. // 组装查询条件,然后放到后台数据库当中
  815. _self.saveToUserStorage(userStorageDtos);
  816. // localStorage.setItem(uuid + "_modelDatas", JSON.stringify(this.modelDatas));
  817. routeDate.path = routeDate.path + '/' + _self.uuid;
  818. _self.$emit('saveView');
  819. _self.$router.push(routeDate);
  820. },
  821. errorData => {
  822. Common.processException(errorData);
  823. },
  824. );
  825. },
  826. /**
  827. * 保存到userStorage中
  828. * @author LeiGuoXian
  829. * @date 2020-09-17
  830. */
  831. saveToUserStorage: function (userStorageDtos) {
  832. var _self = this;
  833. // 组装查询条件,然后放到后台数据库当中
  834. UserStorageResource.uploadUserStorage(userStorageDtos).then(
  835. successData => {},
  836. errorData => {
  837. Common.processException(errorData);
  838. },
  839. );
  840. },
  841. /**
  842. * 检查是否是有效的任务
  843. * 1. 任务仍然存在
  844. * 2. 任务属于登录人
  845. */
  846. checkIsActiveTask: function () {
  847. if (this.taskInfoId == null) {
  848. this.isActiveTask = false;
  849. return;
  850. }
  851. WorkflowResource.uniqueTaskInfoByTaskIdUserId(this.taskInfoId).then(
  852. successData => {
  853. if (successData == null) {
  854. this.isActiveTask = false;
  855. } else {
  856. this.isActiveTask = true;
  857. }
  858. },
  859. errorData => {
  860. Common.processException(errorData);
  861. },
  862. );
  863. },
  864. /**
  865. * 自定义表单的数据发生变化
  866. */
  867. approveFormValueChanged: function (newApproveFormValue) {
  868. this.approveFormValue = newApproveFormValue;
  869. },
  870. },
  871. };
  872. </script>
  873. <style scoped>
  874. .m-label {
  875. margin-left: 10px;
  876. }
  877. .m-h5 {
  878. display: inline;
  879. }
  880. .m-image {
  881. width: 64px;
  882. height: 64px;
  883. margin-bottom: 0px;
  884. }
  885. .m-image1 {
  886. display: inline !important;
  887. width: 64px;
  888. height: 64px;
  889. cursor: pointer;
  890. margin-right: 5px;
  891. }
  892. .file-box {
  893. width: 150px;
  894. position: relative;
  895. display: table-cell;
  896. }
  897. .file-remove {
  898. position: absolute;
  899. right: 0px;
  900. color: #43a51e;
  901. cursor: pointer;
  902. }
  903. .img-label {
  904. height: 80px;
  905. line-height: 80px;
  906. padding-top: 0px !important;
  907. }
  908. .img-box {
  909. width: 60px;
  910. height: 80px;
  911. float: left;
  912. text-align: center;
  913. margin-right: 20px;
  914. }
  915. .img-box div img {
  916. width: 60px;
  917. height: 60px;
  918. }
  919. .add-box {
  920. width: 60px;
  921. height: 60px;
  922. float: left;
  923. border-radius: 30px;
  924. border: 1px #999 dashed;
  925. text-align: center;
  926. margin-top: 20px;
  927. }
  928. .add-box:hover {
  929. cursor: pointer;
  930. background-color: #ccc;
  931. }
  932. .add-icon {
  933. width: 60px;
  934. height: 60px;
  935. color: #aaa;
  936. font-size: 40px;
  937. line-height: 60px;
  938. position: relative;
  939. top: -1px;
  940. }
  941. .remove-icon {
  942. color: red;
  943. position: relative;
  944. top: 10px;
  945. right: -30px;
  946. cursor: pointer;
  947. }
  948. .table-box td,
  949. th {
  950. text-align: center;
  951. }
  952. @keyframes go {
  953. 0% {
  954. transform: scale(1);
  955. }
  956. /* 25% {
  957. transform: scale(1.2);
  958. } */
  959. 50% {
  960. transform: scale(1.2);
  961. }
  962. /* 75% {
  963. transform: scale(1.2);
  964. } */
  965. 100% {
  966. transform: scale(1);
  967. }
  968. }
  969. button.forSaleOrder {
  970. animation: go 3s infinite;
  971. text-shadow: 1px 1px 1px black;
  972. }
  973. .comment-text{
  974. margin-bottom: 0px;
  975. }
  976. </style>