examineCommon.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view>
  3. <commonCard :gwId="gwId"></commonCard>
  4. <view class="office_main">
  5. <view class="office_title">
  6. <uni-section v-if="isoffice" titleColor="#36a7f3" class="mb-10" title="分管领导意见"
  7. type="line"></uni-section>
  8. <uni-section v-if="istransmit" titleColor="#36a7f3" class="mb-10" title="办公室意见"
  9. type="line"></uni-section>
  10. <uni-section v-if="isleader" titleColor="#36a7f3" class="mb-10" title="主要领导意见"
  11. type="line"></uni-section>
  12. <uni-section v-if="isundertake" titleColor="#36a7f3" class="mb-10" title="承办科(室)意见"
  13. type="line"></uni-section>
  14. </view>
  15. <view class="office_info">
  16. <u--form :model="auditForm" labelWidth="130px" class="u-form default_title" labelPosition="left"
  17. ref="auditForm">
  18. <u-form-item :label="istransmit?'办公室意见':isundertake?'承办科(室)意见':isoffice?'分管领导意见':'主要领导意见'"
  19. borderBottom prop="content">
  20. <u--textarea v-model="auditForm.content" placeholder=""></u--textarea>
  21. </u-form-item>
  22. <u-form-item v-if="!isleader" label="下一位审批人" borderBottom prop="neUser">
  23. <office-user-select v-model="auditForm.neUser" placeholder="请选择下一位审批人"
  24. title="审批人" :limit="isoffice?1000:1" :multiple="isoffice"></office-user-select>
  25. </u-form-item>
  26. <view class="submit_btn flex ">
  27. <u-button v-if="isAll" @click="formSubmit" type="success" text="归档"></u-button>
  28. <u-button v-if="!loading" type="primary" :disabled="auditForm.nextLeadUser==''" text="确认签字"
  29. @click="doSubmit"></u-button>
  30. <u-button v-if="loading" :loading="loading" type="primary" text="加载中"></u-button>
  31. </view>
  32. </u--form>
  33. </view>
  34. </view>
  35. <u-toast ref="uToast"></u-toast>
  36. <u-overlay :show="loading">
  37. <view class="warp">
  38. <view class="rect"><u-button plain loading loadingText="加载中"></u-button></view>
  39. </view>
  40. </u-overlay>
  41. </view>
  42. </template>
  43. <script>
  44. import commonCard from "./commonCard.vue"
  45. import BASE_URL from '@/config.js'
  46. import moment from "moment"
  47. import signInput from "@/components/am-sign-input/am-sign-input.vue"
  48. import officeUserSelect from "@/components/office-user-select/office-user-select.vue"
  49. import userService from "@/api/sys/userService"
  50. import yzFlowService from '@/api/commonseal/yzFlowService.js'
  51. import * as $auth from "@/common/auth.js"
  52. export default {
  53. onLoad(option) {
  54. this.gwId = option.id
  55. yzFlowService.queryByYzId(this.gwId).then(data => {
  56. let user = $auth.getUserInfo()
  57. let role = $auth.getUserInfo().roleNames
  58. let gw = data.filter(item => {
  59. return item.nextUser == user.id && item.state == 1
  60. })
  61. if (gw.length > 0) {
  62. this.auditForm = gw[0]
  63. if (gw[0].which == '4') this.isAll = true
  64. if (!this.auditForm.content) this.auditForm.content = '同意'
  65. }
  66. if (role == '办公室管理员') {
  67. this.istransmit = true
  68. }
  69. if (role == '局领导' && gw.length > 0) this.isleader = true
  70. if (role == '办公室主任' && gw.length > 0) this.istransmit = true
  71. if (role == '分管领导' && gw.length > 0) this.isoffice = true
  72. if (role == '科室负责人' && gw.length > 0) this.isundertake = true
  73. })
  74. },
  75. components: {
  76. commonCard,
  77. signInput,
  78. officeUserSelect
  79. },
  80. data() {
  81. return {
  82. loading: false,
  83. isAll: false,
  84. show: false,
  85. one: true,
  86. auditForm: {
  87. id: '',
  88. yzId: '',
  89. content: '同意',
  90. signfj: '',
  91. createTruename: '',
  92. nextTruename: '',
  93. nextUser: '',
  94. which: '0',
  95. state: '0',
  96. next: '',
  97. neUser: ''
  98. },
  99. gwId: "",
  100. isoffice: false,
  101. isleader: false,
  102. isundertake: false,
  103. istransmit: false,
  104. }
  105. },
  106. methods: {
  107. showToast(params) {
  108. this.loading = false
  109. this.$refs.uToast.show({
  110. ...params,
  111. complete() {
  112. params.url && uni.redirectTo({
  113. url: params.url
  114. })
  115. }
  116. })
  117. },
  118. /**
  119. * @param {Object} e
  120. * 签名完成回调
  121. */
  122. signToUrl(e) {
  123. this.auditForm.signfj = e.data
  124. if (e.error_code && e.error_code === '201') {
  125. uni.showToast({
  126. title: e.msg,
  127. icon: 'none'
  128. })
  129. return
  130. }
  131. },
  132. // 提交表单
  133. doSubmit() {
  134. let inputForm = this.auditForm;
  135. this.loading = true
  136. if (inputForm.neUser && inputForm.neUser != '') {
  137. inputForm.next = '1'
  138. }else {
  139. inputForm.next = ''
  140. }
  141. inputForm.state = "0"
  142. inputForm.gwId = this.gwId
  143. const date = moment().format('YYYY-MM-DD HH:mm:ss');
  144. inputForm.updateTime = date
  145. yzFlowService.save(inputForm).then(data => {
  146. let param = {
  147. type: 'success',
  148. message: data,
  149. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  150. }
  151. this.showToast(param);
  152. setTimeout(() => {
  153. // 重定向到上一页
  154. uni.redirectTo({
  155. url: `/pages/commonseal/commonInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  156. });
  157. }, 500)
  158. }).catch(() => {
  159. let param = {
  160. type: 'error',
  161. message: data,
  162. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png',
  163. }
  164. this.showToast(param);
  165. })
  166. },
  167. // 归档
  168. formSubmit() {
  169. this.loading = true
  170. let inputForm = Object.assign({}, this.auditForm);
  171. inputForm.state = '0'
  172. inputForm.next = "0"
  173. yzFlowService.save(inputForm).then(data1 => {
  174. let param = {
  175. type: 'success',
  176. message: "已归档",
  177. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  178. }
  179. this.showToast(param);
  180. setTimeout(() => {
  181. // 重定向到上一页
  182. uni.redirectTo({
  183. url: `/pages/commonseal/commonInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  184. });
  185. }, 500)
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style>
  192. .warp {
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. height: 100%;
  197. }
  198. .office_main {
  199. width: 100%;
  200. margin: 5px 0;
  201. padding: 0 20px;
  202. background-color: #fefefe;
  203. }
  204. .office_main .office_title {
  205. width: 100%;
  206. border-bottom: 1px solid #eee;
  207. }
  208. .submit_btn {
  209. background-color: #fefefe;
  210. bottom: 10px;
  211. box-shadow: none;
  212. padding: 20px 0;
  213. }
  214. .submit_btn button {
  215. height: 40px;
  216. width: 40%;
  217. border-radius: 30px;
  218. }
  219. </style>