geLetterDispose.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <view class="geHeight">
  3. <view style="height: 100%;">
  4. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  5. <view class="desc">
  6. <uni-row>
  7. <uni-col :span="5">
  8. <view class="desc">
  9. 申请人
  10. </view>
  11. </uni-col>
  12. <uni-col :span="18">
  13. <view class="desc">
  14. {{data.formData.apply_user_name}}
  15. </view>
  16. </uni-col>
  17. </uni-row>
  18. </view>
  19. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  20. <view class="desc">
  21. <uni-row>
  22. <uni-col :span="5">
  23. <view class="desc">
  24. 标题
  25. </view>
  26. </uni-col>
  27. <uni-col :span="18">
  28. <view class="desc">
  29. {{data.formData.title}}
  30. </view>
  31. </uni-col>
  32. </uni-row>
  33. </view>
  34. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  35. <!-- <view class="desc">
  36. <uni-row>
  37. <uni-col :span="5">
  38. <view class="desc">
  39. 文件
  40. </view>
  41. </uni-col>
  42. <uni-col :span="18">
  43. <view class="u-demo-block">
  44. <text class="u-demo-block__title">点击下方文件名查看</text>
  45. <view class="u-demo-block__content">
  46. <view v-for="item in fileList" class="yyButton" style="border: 1rpx solid rgb(10, 185, 156);color: rgb(10, 185, 156);font-size: 22rpx; padding: 5rpx 15rpx;
  47. border-radius: 10rpx;" @click="previewFile(item.url)">
  48. {{item.name?item.name : "无名称"}}
  49. </view>
  50. </view>
  51. </view>
  52. </uni-col>
  53. </uni-row>
  54. </view> -->
  55. <!-- <u-gap height="10" bgColor="#f5f5f5"></u-gap> -->
  56. <view class="desc">
  57. <view class="desc">
  58. 图片
  59. </view>
  60. <view class="desc">
  61. <uni-file-picker :value="imgList" file-mediatype="image" readonly>
  62. </uni-file-picker>
  63. </view>
  64. </view>
  65. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  66. <hs-show label="备注" :data="data.formData.update_by"></hs-show>
  67. <view v-if="data.pageType !== 1 || data.isEnd === '1' || data.baseName === '分管领导核查'">
  68. <hs-show label="处理结果" :data="data.formData.dispose_result"></hs-show>
  69. <hs-show label="是否解决" :data="data.formData.is_solve" mode="dict" dictKey="hs_letter_dispose"></hs-show>
  70. <hs-show label="处理评价" :data="data.formData.remark"></hs-show>
  71. </view>
  72. <view v-if="data.pageType === 1 && data.isEnd === '0' && data.baseName === '科长处理' "
  73. style="padding: 10px;color: #ffaa00;">
  74. 请您在下方补充处理结果
  75. <hs-input label="处理结果" v-model="form.disposeResult" :value="form.disposeResult"
  76. model="textarea"></hs-input>
  77. <hs-dict-select label="是否解决" @input="submitMaintenanceRecord()" dictKey="hs_letter_dispose"
  78. v-model="form.isSolve" />
  79. <hs-input label="处理评价" @input="submitMaintenanceRecord()" v-model="form.remark"
  80. model="textarea"></hs-input>
  81. </view>
  82. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  83. <view class="desc">
  84. <view>
  85. <uni-steps :options="list1" :active="active" direction="column" active-color="rgb(55,186,189)" />
  86. </view>
  87. </view>
  88. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  89. <view v-if="data.pageType === 1" class="desc">
  90. <view class="desc" style="color: #bababa;">
  91. 批注:
  92. </view>
  93. <view class="desc">
  94. <u--textarea v-model="pz" border="bottom"></u--textarea>
  95. </view>
  96. </view>
  97. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  98. </view>
  99. <view v-if="data.pageType == 3" class="bomButtonBody" style="height: 10%;">
  100. <uni-row v-if="list1 && list1.length === 1">
  101. <uni-col>
  102. <view class="desc">
  103. <u-button :disabled="isDisabled" color="rgb(55,186,189)" shape="circle" size="large"
  104. @click="revoke">撤销
  105. </u-button>
  106. </view>
  107. </uni-col>
  108. </uni-row>
  109. <uni-row>
  110. <uni-col>
  111. <view class="desc">
  112. <!-- <u-button :disabled="isDisabled" color="rgb(55,186,189)" shape="circle" size="large"
  113. @click="againLaunch">再次发起
  114. </u-button> -->
  115. </view>
  116. </uni-col>
  117. </uni-row>
  118. </view>
  119. <u-gap height="110" bgColor="#f5f5f5"></u-gap>
  120. <view v-if="data.pageType === 1 && zindeButtion === 1 && data.isEnd === '0'" class="bomButtonBody"
  121. style="position: fixed;bottom: 0">
  122. <uni-row>
  123. <uni-col :span="10">
  124. <view class="desc">
  125. <u-button color="rgb(55,186,189)" shape="circle" size="large"
  126. @click="passTrue('同意','RESULT_TRUE','bottom')">同意,下一步
  127. </u-button>
  128. </view>
  129. </uni-col>
  130. <uni-col :span="7.5">
  131. <view class="desc">
  132. <u-button color="rgb(188, 188, 188)" shape="circle" size="large"
  133. @click="passTrue('驳回','RESULT_FALSE','bottom')">驳回</u-button>
  134. </view>
  135. </uni-col>
  136. <uni-col :span="7.5">
  137. <view class="desc">
  138. <u-button color="rgb(136, 188, 160)" shape="circle" size="large"
  139. @click="passTrue('驳回','RESULT_CASE_OF','bottom')">转交</u-button>
  140. </view>
  141. </uni-col>
  142. </uni-row>
  143. </view>
  144. <view>
  145. <!-- 普通弹窗 -->
  146. <uni-popup ref="popup" background-color="#fff" @change="propChange">
  147. <view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
  148. <view class="desc">
  149. <uni-row>
  150. <uni-col :span="8">
  151. <view style="font-size: 40rpx;color: rgb(145, 145, 145);">
  152. </view>
  153. </uni-col>
  154. <uni-col :span="13">
  155. <view style="font-size: 40rpx;color: rgb(98, 98, 98);">
  156. {{nextTitle}}
  157. </view>
  158. </uni-col>
  159. <uni-col :span="3">
  160. <view @click="submitPass" style="font-size: 40rpx;color: rgb(55,186,189);">
  161. 确认
  162. </view>
  163. </uni-col>
  164. </uni-row>
  165. </view>
  166. <view class="desc">
  167. <uni-row>
  168. <uni-col>
  169. <view class="desc">
  170. <uni-data-picker ref="picker" placeholder="请选择" :popup-title="selectTitle"
  171. :localdata="dataTree" v-model="nextUserName" @change="nextApprovalChange">
  172. </uni-data-picker>
  173. </view>
  174. </uni-col>
  175. </uni-row>
  176. </view>
  177. </view>
  178. </uni-popup>
  179. </view>
  180. <view>
  181. <!-- 驳回选择弹窗 -->
  182. <uni-popup ref="popup2" background-color="#fff" @change="propChange">
  183. <view style="height: 800rpx;">
  184. <view class="desc">
  185. <view style="text-align: center;font-size: 30rpx;color: rgb(98, 98, 98);">
  186. 驳回至以下任意流程
  187. </view>
  188. </view>
  189. <view style="padding: 20rpx 10rpx;">
  190. <uni-list v-for="item in rejectHistoryData">
  191. <uni-list-item :clickable="true" @click="rejectSubmit(item)" :title="item.comment" />
  192. </uni-list>
  193. </view>
  194. </view>
  195. </uni-popup>
  196. </view>
  197. </view>
  198. </template>
  199. <script>
  200. export default {
  201. data() {
  202. return {
  203. pz: '',
  204. nextApproval: '',
  205. nextUserName: '',
  206. app_vacate_type: uni.getStorageSync('app_vacate_type'),
  207. data: uni.getStorageSync("approval"),
  208. form: {
  209. id: '',
  210. disposeResult: '**月**日上午/下午**时**分,由我单位**部门/科室的经办人***,对来电人所反映的情况进行核实,填写处理过程和结果,并在回复结束时询问诉求人对此次回复做出评价',
  211. isSolve: '',
  212. remark: ''
  213. },
  214. dataTree: [],
  215. queryParams: {},
  216. historyData: [],
  217. nextTitle: '',
  218. selectTitle: '',
  219. active: 0,
  220. list1: [],
  221. isDisabled: false,
  222. actions: [],
  223. type: 'center',
  224. zindeButtion: 1,
  225. rejectHistoryData: [],
  226. fileList: [],
  227. imgList: []
  228. }
  229. },
  230. onLoad() {
  231. uni.showLoading({
  232. title: '正在加载'
  233. })
  234. setTimeout(() => {
  235. let start = new Date().getTime()
  236. if (this.data.formData.img_list) {
  237. this.imgList = JSON.parse(this.data.formData.img_list)
  238. }
  239. }, 10)
  240. this.getHouXuanZu()
  241. this.getListHistory()
  242. this.readTask()
  243. if (this.data.baseName && this.data.pageType === 1) {
  244. uni.setNavigationBarTitle({
  245. title: this.data.baseName
  246. })
  247. }
  248. if (this.data.formData.remark) {
  249. this.form.remark = this.data.formData.remark
  250. }
  251. if (this.data.formData.is_solve) {
  252. this.form.isSolve = this.data.formData.is_solve
  253. }
  254. if (this.data.formData.dispose_result) {
  255. this.form.disposeResult = this.data.formData.dispose_result
  256. }
  257. },
  258. methods: {
  259. submitMaintenanceRecord() {
  260. if (this.data.baseName === '科长处理') {
  261. this.form.id = this.data.formData.id
  262. this.$httpRequest({
  263. url: '/app/letterDisposeSubmit',
  264. method: 'post',
  265. data: this.form,
  266. urlType: this.$getUrlType()
  267. }).then(res => {
  268. })
  269. }
  270. },
  271. rejectSubmit(item) {
  272. this.form.rejectBaseId = item.baseId
  273. this.nextApproval = item.operator
  274. this.submitPass()
  275. },
  276. nextApprovalChange(e) {
  277. console.log('onchange:', e.detail.value[1]);
  278. this.nextUserName = e.detail.value[1].text
  279. this.nextApproval = e.detail.value[1].value
  280. },
  281. propChange(e) {
  282. if (e.show) {
  283. this.zindeButtion = 0
  284. } else {
  285. this.zindeButtion = 1
  286. }
  287. },
  288. againLaunch() {
  289. this.$goto('../hr/leave')
  290. },
  291. async revoke() {
  292. const {
  293. data: res
  294. } = await this.$httpRequest({
  295. url: '/app/revoke?taskId=' + this.data.taskId,
  296. method: 'get'
  297. });
  298. if (res.code === 200) {
  299. uni.showModal({
  300. title: "撤销成功",
  301. icon: "OK",
  302. showCancel: false,
  303. success() {
  304. uni.navigateBack()
  305. }
  306. })
  307. } else {
  308. uni.showModal({
  309. title: "撤销失败",
  310. content: res.msg,
  311. showCancel: false,
  312. success() {
  313. uni.navigateBack()
  314. }
  315. })
  316. }
  317. },
  318. previewFile(fileUrl) {
  319. uni.showLoading({
  320. title: '加载中'
  321. })
  322. uni.downloadFile({
  323. url: fileUrl, //后端返回的文件地址
  324. // filePath: wx.env.USER_DATA_PATH + '/' + item.name + '.' + item.value.split('.')[item.value.split('.').length - 1],
  325. success: function(res) {
  326. if (res.statusCode === 200) {
  327. uni.openDocument({
  328. showMenu: true,
  329. filePath: res.tempFilePath,
  330. success: function(res) {
  331. console.log(res, '打开文件成功')
  332. },
  333. fail: (err) => {
  334. uni.showToast({
  335. title: '打开文件失败请重试',
  336. icon: 'none'
  337. })
  338. }
  339. })
  340. } else {
  341. uni.showToast({
  342. title: '打开文件失败请重试',
  343. icon: 'none'
  344. })
  345. }
  346. uni.hideLoading()
  347. },
  348. fail: (err) => {
  349. uni.hideLoading()
  350. uni.showToast({
  351. title: '加载失败请重试',
  352. icon: "none"
  353. })
  354. }
  355. })
  356. },
  357. async readTask() {
  358. if (this.data.msgIsRead === '0') {
  359. const {
  360. data: res
  361. } = await this.$httpRequest({
  362. url: '/app/rt?taskId=' + this.data.id,
  363. method: 'get'
  364. });
  365. if (res.code === 200) {
  366. let msgData = uni.getStorageSync("msgData")
  367. if (this.pageType === 1) {
  368. --msgData.m1
  369. } else if (this.pageType === 3) {
  370. --msgData.m4
  371. } else if (this.pageType === 4) {
  372. --msgData.m7
  373. }
  374. uni.setStorageSync("msgData", msgData)
  375. }
  376. }
  377. },
  378. async getHouXuanZu() {
  379. const {
  380. data: res
  381. } = await this.$httpRequest({
  382. url: '/app/pL?taskId=' + this.data.id + '&groupId=' + this.data.baseGroupId + '&baseId=' +
  383. this.data.baseId,
  384. method: 'get'
  385. });
  386. if (res.code === 200) {
  387. this.dataTree = res.data
  388. }
  389. uni.hideLoading()
  390. },
  391. async getListHistory() {
  392. let id = this.data.taskId ? this.data.taskId : this.data.id
  393. const {
  394. data: res
  395. } = await this.$httpRequest({
  396. url: '/app/ctr?taskId=' + id,
  397. method: 'get',
  398. data: this.queryParams
  399. });
  400. if (res.code === 200) {
  401. uni.hideLoading()
  402. this.historyData = res.data
  403. this.list1
  404. if (0 != this.historyData.length) {
  405. for (var i = 0; i < this.historyData.length; i++) {
  406. if (this.historyData[i].comment && this.historyData[i].comment === "自动结束" ||
  407. this.historyData[i].comment === "流程结束") {
  408. this.list1.push({
  409. title: this.historyData[i].comment,
  410. desc: this.historyData[i].createTime
  411. })
  412. } else {
  413. this.list1.push({
  414. title: this.historyData[i].operator + ' ' + this.historyData[i].comment,
  415. desc: this.historyData[i].createTime
  416. })
  417. }
  418. }
  419. } else {
  420. this.list1.push({
  421. title: "待审批"
  422. })
  423. }
  424. if (this.historyData[this.historyData.length - 1]) {
  425. if (!(this.historyData[this.historyData.length - 1].comment === "同意并结束") &&
  426. !(this.historyData[this.historyData.length - 1].comment === "自动结束") &&
  427. !(this.historyData[this.historyData.length - 1].comment === "流程结束")) {
  428. this.list1.push({
  429. title: "待审批"
  430. })
  431. }
  432. }
  433. this.active = this.list1.length - 1
  434. }
  435. },
  436. dataForm(comment, pass) {
  437. this.form.comment = this.pz ? this.pz : comment
  438. this.form.result = pass
  439. this.form.baseId = this.data.baseId
  440. this.form.taskId = this.data.id
  441. this.form.nextApproval = this.nextApproval
  442. this.form.nextUserName = this.nextUserName
  443. this.form.formData = this.data.formData
  444. },
  445. passTrue(comment, pass, type) {
  446. this.dataForm(comment, pass)
  447. this.submitMaintenanceRecord()
  448. if (pass === 'RESULT_TRUE' && this.data.isCandidate == "1") {
  449. this.submitPass()
  450. return
  451. }
  452. if (pass === 'RESULT_FALSE') {
  453. this.getRejectListHistory()
  454. return
  455. }
  456. if (pass === 'RESULT_CASE_OF') {
  457. this.getCurrentHouXuanZu()
  458. this.selectTitle = '请选择转交人'
  459. this.nextTitle = '请选择转交人'
  460. this.$refs.popup.open(type)
  461. return
  462. }
  463. this.getHouXuanZu()
  464. this.nextTitle = '下一步审批人'
  465. this.type = type
  466. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  467. this.$refs.popup.open(type)
  468. },
  469. async getRejectListHistory() {
  470. uni.showLoading({
  471. title: '加载中',
  472. mask: true
  473. })
  474. let id = this.data.taskId ? this.data.taskId : this.data.id
  475. const {
  476. data: res
  477. } = await this.$httpRequest({
  478. url: '/app/reject/ctr?taskId=' + id,
  479. method: 'get',
  480. data: this.queryParams
  481. });
  482. if (res.code === 200) {
  483. if (res.data.length == 0) {
  484. this.submitPass()
  485. return
  486. }
  487. this.$refs.popup2.open('bottom')
  488. this.rejectHistoryData = res.data
  489. uni.hideLoading()
  490. }
  491. },
  492. async getCurrentHouXuanZu() {
  493. uni.showLoading({
  494. title: '加载中',
  495. mask: true
  496. })
  497. const {
  498. data: res
  499. } = await this.$httpRequest({
  500. url: '/app/currentPL?taskId=' + this.data.id + '&groupId=' + this.data.baseGroupId +
  501. '&baseId=' + this.data.baseId,
  502. method: 'get'
  503. });
  504. if (res.code === 200) {
  505. this.dataTree = res.data
  506. uni.hideLoading()
  507. }
  508. },
  509. async submitPass() {
  510. uni.showLoading({
  511. mask: true,
  512. title: '正在提交'
  513. })
  514. if (this.form.result !== 'RESULT_FALSE' && this.data.isCandidate == "0" && 2.0 < parseFloat(this.data
  515. .formData.total_time)) {
  516. if (!this.nextApproval) {
  517. uni.showModal({
  518. content: '请选择批准人',
  519. title: '提交失败',
  520. showCancel: false
  521. })
  522. this.isDisabled = false
  523. return
  524. }
  525. }
  526. this.form.nextApproval = this.nextApproval
  527. this.form.nextUserName = this.nextUserName
  528. const {
  529. data: res
  530. } = await this.$httpRequest({
  531. url: '/app/nextStep',
  532. method: 'post',
  533. data: this.form
  534. });
  535. if (res.code === 200) {
  536. uni.hideLoading()
  537. uni.showModal({
  538. title: "提交成功",
  539. icon: "OK",
  540. showCancel: false,
  541. success() {
  542. setTimeout(() => {
  543. this.isDisabled = false
  544. }, 1000)
  545. uni.navigateBack()
  546. }
  547. })
  548. } else {
  549. uni.showModal({
  550. title: "提交失败",
  551. icon: "ERROR",
  552. showCancel: false,
  553. content: res.msg
  554. })
  555. }
  556. setTimeout(() => {
  557. this.isDisabled = false
  558. }, 1000)
  559. setTimeout(() => {
  560. this.isDisabled = false
  561. uni.hideLoading()
  562. }, 1000)
  563. },
  564. dateFormat(time) {
  565. let date = new Date(time);
  566. let year = date.getFullYear();
  567. // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  568. let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  569. let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  570. let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  571. let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  572. let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  573. // 拼接
  574. // return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  575. return year + "/" + month + "/" + day;
  576. }
  577. }
  578. }
  579. </script>
  580. <style lang="scss" scoped>
  581. .desc {
  582. padding: 10rpx;
  583. }
  584. .u-page {
  585. &__button-item {
  586. margin: 0 15px 5px 0;
  587. }
  588. }
  589. .u-demo-block__content {
  590. flex-direction: row;
  591. flex-wrap: wrap;
  592. align-items: center;
  593. }
  594. .popup-content {
  595. height: 800rpx;
  596. }
  597. .geHeight {
  598. height: 100%;
  599. position: relative;
  600. }
  601. .bomButtonBody {
  602. border-top: 5rpx #f5f5f5 solid;
  603. padding: 30rpx 0 50rpx 0;
  604. width: 100%;
  605. background-color: #ffffff;
  606. }
  607. .status-btn {
  608. /* #ifndef APP-NVUE */
  609. display: flex;
  610. /* #endif */
  611. flex-direction: row;
  612. align-items: center;
  613. justify-content: center;
  614. height: 92rpx;
  615. margin: 30rpx;
  616. background-color: #007AFF;
  617. }
  618. .example-body {
  619. /* #ifndef APP-NVUE */
  620. display: block;
  621. /* #endif */
  622. padding: 15px;
  623. flex-direction: row;
  624. }
  625. .check-btn {
  626. display: flex;
  627. justify-content: space-between;
  628. margin-bottom: 10px;
  629. }
  630. </style>