revokeForm.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <view class="flowBefore-v">
  3. <div class="flow-urgent-value" :style="{'background-color':flowUrgentList[selectflowUrgent.extra].bgColor}"
  4. @click="handleShowSelect">
  5. <span :style="{'color':flowUrgentList[selectflowUrgent.extra].color}">{{selectflowUrgent.label}}</span>
  6. </div>
  7. <view class="flowBefore-box">
  8. <view class="scroll-v" scroll-y>
  9. <childForm ref="child" :config="config" v-if="!loading" :key="childFormKey" />
  10. <RecordTimeList :progressList="progressList" :taskInfo="taskInfo" v-if="!loading"
  11. :commentList="commentList" :taskId="config.id" ref="RecordTimeList" @handleReply="goWriteComment"
  12. :hasComment="hasComment" :dataLog="dataLog" :opType="config.opType" :formID="config?.formData?.id"
  13. :dataLogList="dataLogList">
  14. </RecordTimeList>
  15. </view>
  16. </view>
  17. <flowBtn :actionList="actionList" :btnInfo="btnInfo" :opType="config.opType" :hideSaveBtn="config.hideSaveBtn"
  18. @handleBtn="handleBtn" :btnLoading="btnLoading" v-if="formLoding" :rightBtnList="rightBtnList"
  19. :saveBtnText="properties.saveBtnText" :hasComment="hasComment"
  20. :hasSignFor="flowInfo?.flowNodes?.global?.hasSignFor">
  21. </flowBtn>
  22. <u-select :list="flowUrgentList" v-model="showFlowUrgent" @confirm="seltConfirm"
  23. :default-value="defaultValue" />
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. getDelegateUser
  29. } from '@/api/workFlow/entrust.js'
  30. import {
  31. Create,
  32. Update
  33. } from '@/api/workFlow/workFlowForm'
  34. import {
  35. FlowTask,
  36. } from '@/api/workFlow/flowBefore'
  37. import {
  38. Revoke,
  39. Press
  40. } from '@/api/workFlow/flowLaunch'
  41. import {
  42. getOnlineLog
  43. } from '@/api/apply/visualDev'
  44. import {
  45. createComment
  46. } from '@/api/workFlow/flowEngine'
  47. import resources from '@/libs/resources.js'
  48. import childForm from './form.vue'
  49. import flowBtn from '../components/flowBtn'
  50. import RecordTimeList from '../components/RecordTimeList'
  51. import {
  52. useUserStore
  53. } from '@/store/modules/user'
  54. const sysConfigInfo = uni.getStorageSync('sysConfigInfo')
  55. export default {
  56. components: {
  57. childForm,
  58. flowBtn,
  59. RecordTimeList
  60. },
  61. data() {
  62. return {
  63. dataLogList: [],
  64. dataLog: false,
  65. childFormKey: +new Date(),
  66. formLoding: false,
  67. loading: false,
  68. taskInfo: {},
  69. btnInfo: [],
  70. show: false,
  71. config: {},
  72. formData: {},
  73. properties: {},
  74. btnLoading: false,
  75. commentList: [],
  76. tabsName: '表单信息',
  77. title: '',
  78. selectflowUrgent: {
  79. extra: '0',
  80. label: '普通',
  81. value: 1,
  82. },
  83. showFlowUrgent: false,
  84. defaultValue: [0],
  85. flowUrgent: 1,
  86. flowUrgentList: [{
  87. label: '普通',
  88. color: '#409EFF',
  89. bgColor: '#e5f3fe',
  90. value: 1,
  91. extra: '0'
  92. },
  93. {
  94. label: '重要',
  95. color: '#E6A23C',
  96. bgColor: '#fef6e5',
  97. value: 2,
  98. extra: '1'
  99. },
  100. {
  101. label: '紧急',
  102. color: '#F56C6C',
  103. bgColor: '#fee5e5',
  104. value: 3,
  105. extra: '2'
  106. },
  107. ],
  108. showAction: false,
  109. actionList: [],
  110. hasComment: false,
  111. progressList: [],
  112. rightBtnList: [],
  113. };
  114. },
  115. computed: {
  116. baseURL() {
  117. return this.define.baseURL
  118. },
  119. getShowExtraPanel() {
  120. return this.dataLog && this.config?.formData?.id || (this.config.opType != '-1' && !this.loading)
  121. }
  122. },
  123. onUnload() {
  124. uni.$off('comment')
  125. },
  126. onShow() {
  127. uni.$on('comment', data => {
  128. this.commentList = [];
  129. this.current = 0;
  130. this.addComment(data)
  131. })
  132. },
  133. onLoad(e) {
  134. this.config = JSON.parse(this.jnpf.base64.decode(e.config))
  135. this.$nextTick(() => {
  136. this.getBeforeInfo(this.config)
  137. })
  138. },
  139. methods: {
  140. addComment(query) {
  141. query.taskId = this.config.id
  142. createComment(query).then(res => {
  143. this.$nextTick(() => {
  144. this.$refs.RecordTimeList.change(1)
  145. })
  146. })
  147. },
  148. //流程按钮事件
  149. handleBtn(type, dataForm = {}) {
  150. if ('comment'.includes(type)) this.goWriteComment();
  151. },
  152. goWriteComment(replyId) {
  153. let data = {
  154. taskId: this.config.id
  155. };
  156. if (replyId) data.replyId = replyId;
  157. data = encodeURIComponent(JSON.stringify(data));
  158. uni.navigateTo({
  159. url: '/pages/workFlow/comment/index?data=' + data
  160. })
  161. },
  162. getBeforeInfo() {
  163. let config = this.config;
  164. this.formData.flowId = config.flowId;
  165. this.loading = true;
  166. const query = {
  167. flowId: config.flowId, // 流程大Id
  168. opType: config.opType == 2 ? 3 : config.opType, //特殊:待办点击开始办理需要跳到在办页面
  169. };
  170. if (config.opType != "-1" && config.opType != '0') query.operatorId = config.operatorId;
  171. FlowTask(config?.taskId || config?.id || 0, query).then((res) => {
  172. this.flowInfo = res.data.flowInfo || {};
  173. this.properties = res.data.nodeProperties || {};
  174. this.formInfo = res.data.formInfo || {};
  175. this.taskInfo = res.data.taskInfo || {};
  176. this.btnInfo = res.data.btnInfo || [];
  177. this.progressList = res.data.progressList || [];
  178. config.formOperates = res.data.formOperates || [];
  179. config.formType = this.formInfo.type
  180. const fullName =
  181. config.opType == "-1" ?
  182. this.flowInfo.fullName :
  183. this.taskInfo.fullName;
  184. config.fullName = fullName;
  185. this.title = this.flowInfo.fullName;
  186. this.thisStep = this.taskInfo.thisStep || "";
  187. if (config.status !== 0 && config.status !== 3) {
  188. this.title = this.thisStep ?
  189. config.fullName + "/" + this.thisStep :
  190. config.fullName;
  191. }
  192. config.type = this.flowInfo.type;
  193. config.draftData = res.data.draftData || null;
  194. config.formData = res.data.formData || {};
  195. let dataId = config.formData.id
  196. config.formEnCode = this.formInfo.enCode;
  197. this.recordList = (res.data.recordList || []).reverse();
  198. config.formConf = this.formInfo.formData;
  199. if (config.formConf) {
  200. this.dataLog = JSON.parse(config.formConf).dataLog
  201. if (this.dataLog) this.getOnlineLog(dataId)
  202. }
  203. this.hasComment = this.flowInfo.flowNodes.global.hasComment;
  204. this.formLoding = true;
  205. // 设置表单标题
  206. uni.setNavigationBarTitle({
  207. title: this.config.formEnCode === "revoke" ? `${this.flowInfo.fullName}撤销申请` : this
  208. .flowInfo.fullName,
  209. });
  210. if (config.formRecords && config.title) {
  211. uni.setNavigationBarTitle({
  212. title: config.title,
  213. });
  214. }
  215. this.flowUrgent = this.taskInfo.flowUrgent || 1;
  216. const getSelectInfo = () => {
  217. var obj = {
  218. value: this.flowUrgent,
  219. extra: "0",
  220. label: "普通",
  221. };
  222. this.flowUrgentList.forEach((e, i) => {
  223. if (e.value == this.flowUrgent) {
  224. obj.extra = i;
  225. obj.label = e.label;
  226. }
  227. });
  228. return obj;
  229. };
  230. this.selectflowUrgent = getSelectInfo();
  231. if (config.opType != "-1" && config.opType != "3") config.readonly =
  232. true;
  233. config.formOperates = [];
  234. if (config.opType == 0) {
  235. if (this.properties && this.properties && this.properties.formOperates) config
  236. .formOperates = this.properties.formOperates || [];
  237. } else {
  238. config.formOperates = res.data.formOperates || [];
  239. }
  240. setTimeout(() => {
  241. this.$nextTick(() => {
  242. if (!this.$refs.child || !this.$refs.child.$refs.form) {
  243. uni.showToast({
  244. title: "暂无此流程表单",
  245. icon: "none",
  246. complete: () => {
  247. setTimeout(() => {
  248. uni.navigateBack();
  249. }, 1500);
  250. },
  251. });
  252. return;
  253. }
  254. this.$refs.child.$refs.form.init(config)
  255. });
  256. }, 100);
  257. this.loading = false;
  258. this.config = config;
  259. });
  260. },
  261. //获取修改记录
  262. getOnlineLog(dataId) {
  263. let modelId = this.formInfo.id
  264. getOnlineLog(modelId, dataId).then(res => {
  265. let list = res.data.list || []
  266. //倒序转正
  267. this.dataLogList = [...list].reverse()
  268. })
  269. },
  270. initBtnList() {
  271. const list = [];
  272. const properties = this.properties;
  273. const btnInfo = this.btnInfo;
  274. // 流程审批
  275. if (this.hasComment && this.config.opType != '-1' && this.rightBtnList.length) list.push({
  276. id: 'comment',
  277. text: '评论'
  278. });
  279. this.actionList = list;
  280. },
  281. // 撤销操作
  282. handleShowSelect() {
  283. if (this.config.opType == '-1') this.showFlowUrgent = true
  284. },
  285. seltConfirm(e) {
  286. this.flowUrgent = e[0].value
  287. this.selectflowUrgent = e[0]
  288. this.defaultValue = [this.flowUrgentList.findIndex(item => item.value === e[0].value)] || [0]
  289. }
  290. }
  291. }
  292. </script>
  293. <style lang="scss">
  294. page {
  295. background-color: #f0f2f6;
  296. height: 100%;
  297. }
  298. .flow-urgent-value {
  299. position: fixed;
  300. top: var(--window-top);
  301. width: 100%;
  302. z-index: 99;
  303. display: flex;
  304. align-items: center;
  305. justify-content: center;
  306. height: 60rpx;
  307. font-size: 28rpx;
  308. }
  309. .flowBefore-v {
  310. display: flex;
  311. flex-direction: column;
  312. margin-top: 60rpx;
  313. .workFlowTitle {
  314. width: 100%;
  315. padding: 0 32rpx 32rpx 32rpx;
  316. background-color: #FFFFFF;
  317. font-size: 32rpx;
  318. font-weight: 700;
  319. white-space: pre-wrap;
  320. text-align: left;
  321. }
  322. .flowBefore-box {
  323. height: 100%;
  324. flex: 1;
  325. display: flex;
  326. flex-direction: column;
  327. overflow: hidden;
  328. padding-bottom: 3.3rem;
  329. .sticky-box {
  330. z-index: 500;
  331. }
  332. }
  333. .swiper-box {
  334. height: 100vh;
  335. }
  336. .swiper-item {
  337. flex: 1;
  338. flex-direction: row;
  339. }
  340. .scroll-v {
  341. flex: 1;
  342. /* #ifndef MP-ALIPAY */
  343. flex-direction: column;
  344. /* #endif */
  345. width: 100%;
  346. height: 100%;
  347. }
  348. .flowStatus {
  349. position: absolute;
  350. top: 90rpx;
  351. right: 0;
  352. border: 0;
  353. margin: 20rpx;
  354. opacity: 0.7;
  355. z-index: 999;
  356. image {
  357. width: 200rpx;
  358. }
  359. }
  360. .discuss_btn {
  361. background-color: #fff;
  362. position: fixed;
  363. bottom: 0;
  364. display: flex;
  365. width: 100%;
  366. // height: 88rpx;
  367. // box-shadow: 0 -2rpx 8rpx #e1e5ec;
  368. z-index: 20;
  369. .custom-style {
  370. background-color: #2979ff;
  371. color: #FFFFFF;
  372. width: 100%;
  373. border-radius: 0 !important;
  374. &::after {
  375. border: none !important;
  376. }
  377. }
  378. .content {
  379. padding: 24rpx;
  380. text-align: center;
  381. .confrim-btn {
  382. display: flex;
  383. flex-direction: row;
  384. .send {
  385. flex: 1;
  386. background-color: #2979ff;
  387. color: #FFFFFF;
  388. }
  389. .cancel {
  390. flex: 1;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. .approverContent {
  397. height: 1000rpx;
  398. overflow-y: scroll;
  399. padding: 0 20rpx;
  400. .notice-warp {
  401. top: 0;
  402. height: 5.6rem;
  403. .close-icon {
  404. height: 60rpx;
  405. padding: 10rpx 20rpx;
  406. justify-content: flex-end;
  407. }
  408. }
  409. .popup {
  410. margin-top: 5.65rem;
  411. .list-box {
  412. .item {
  413. border-bottom: 1rpx solid #f0f0f0;
  414. padding: 20rpx 0;
  415. }
  416. }
  417. }
  418. }
  419. .nodeList-v {
  420. background-color: #fff;
  421. }
  422. .record-v {
  423. padding: 32rpx 32rpx 10rpx;
  424. background-color: #fff;
  425. }
  426. .discuss_box {
  427. .discuss_list {
  428. .time_button {
  429. padding-left: 110rpx;
  430. margin-top: 20rpx;
  431. padding-right: 10rpx;
  432. }
  433. .discuss_txt {
  434. width: 100%;
  435. justify-content: space-between;
  436. .discuss_txt_left {
  437. .uName {
  438. margin-left: 8px;
  439. font-size: 14px;
  440. font-family: PingFang SC;
  441. line-height: 17rpx;
  442. .replyText {
  443. margin-left: 8px;
  444. }
  445. }
  446. }
  447. .del {
  448. color: red;
  449. margin-left: 20px;
  450. }
  451. .reply {
  452. margin-left: 20px;
  453. }
  454. }
  455. .discuss_content {
  456. font-size: 12px;
  457. padding-left: 70rpx;
  458. .img_box {
  459. margin: 40rpx 0;
  460. }
  461. }
  462. }
  463. }
  464. .comment-creator-time {
  465. font-size: 12px;
  466. color: #999999;
  467. font-family: PingFang SC;
  468. line-height: 17rpx;
  469. }
  470. .comment-content-color {
  471. color: #606266;
  472. }
  473. .comment-header-color {
  474. color: #303133;
  475. }
  476. </style>