examineCommon.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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="审批人"></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. action: this.BASE_URL + '/gwfile/upload?uploadPath=sign', //上传服务器的地址
  87. header: {
  88. "token": $auth.getUserToken()
  89. }, //图片上传携带头部信息
  90. auditForm: {
  91. id: '',
  92. yzId: '',
  93. content: '已阅',
  94. signfj: '',
  95. createTruename: '',
  96. nextTruename: '',
  97. nextUser: '',
  98. which: '0',
  99. state: '0',
  100. next: '',
  101. neUser: ''
  102. },
  103. gwForm: {},
  104. gwId: "",
  105. isoffice: false,
  106. isleader: false,
  107. isundertake: false,
  108. istransmit: false,
  109. leaderList: [],
  110. tablePage: {
  111. total: 0,
  112. currentPage: 1,
  113. pageSize: 1000,
  114. orders: [{
  115. column: "a.create_time",
  116. asc: false
  117. }],
  118. },
  119. searchForm: {
  120. // loginName: "",
  121. // name: "",
  122. // companyDTO: {
  123. // id: "",
  124. // },
  125. // officeDTO: {
  126. // id: "",
  127. // },
  128. },
  129. roleId: ""
  130. }
  131. },
  132. methods: {
  133. showToast(params) {
  134. this.loading = false
  135. this.$refs.uToast.show({
  136. ...params,
  137. complete() {
  138. params.url && uni.redirectTo({
  139. url: params.url
  140. })
  141. }
  142. })
  143. },
  144. /**
  145. * @param {Object} e
  146. * 签名完成回调
  147. */
  148. signToUrl(e) {
  149. this.auditForm.signfj = e.data
  150. if (e.error_code && e.error_code === '201') {
  151. uni.showToast({
  152. title: e.msg,
  153. icon: 'none'
  154. })
  155. return
  156. }
  157. },
  158. // 提交表单
  159. doSubmit() {
  160. let inputForm = this.auditForm;
  161. this.loading = true
  162. console.log("inputForm.neUser",inputForm.neUser);
  163. if (inputForm.neUser && inputForm.neUser != '') {
  164. inputForm.next = '1'
  165. }else {
  166. inputForm.next = ''
  167. }
  168. inputForm.state = "0"
  169. inputForm.gwId = this.gwId
  170. const date = moment().format('YYYY-MM-DD HH:mm:ss');
  171. inputForm.updateTime = date
  172. yzFlowService.save(inputForm).then(data => {
  173. let param = {
  174. type: 'success',
  175. message: data,
  176. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  177. }
  178. this.showToast(param);
  179. setTimeout(() => {
  180. // 重定向到上一页
  181. uni.redirectTo({
  182. url: `/pages/commonseal/commonInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  183. });
  184. }, 500)
  185. }).catch(() => {
  186. let param = {
  187. type: 'error',
  188. message: data,
  189. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png',
  190. }
  191. this.showToast(param);
  192. })
  193. },
  194. // 归档
  195. formSubmit() {
  196. this.loading = true
  197. let inputForm = Object.assign({}, this.auditForm);;
  198. inputForm.state = '0'
  199. inputForm.next = "0"
  200. yzFlowService.save(inputForm).then(data1 => {
  201. let param = {
  202. type: 'success',
  203. message: "已归档",
  204. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  205. }
  206. this.showToast(param);
  207. setTimeout(() => {
  208. // 重定向到上一页
  209. uni.redirectTo({
  210. url: `/pages/commonseal/commonInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  211. });
  212. }, 500)
  213. })
  214. }
  215. }
  216. }
  217. </script>
  218. <style>
  219. .warp {
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. height: 100%;
  224. }
  225. .office_main {
  226. width: 100%;
  227. margin: 5px 0;
  228. padding: 0 20px;
  229. background-color: #fefefe;
  230. }
  231. .office_main .office_title {
  232. width: 100%;
  233. border-bottom: 1px solid #eee;
  234. }
  235. .submit_btn {
  236. background-color: #fefefe;
  237. bottom: 10px;
  238. box-shadow: none;
  239. padding: 20px 0;
  240. }
  241. .submit_btn button {
  242. height: 40px;
  243. width: 40%;
  244. border-radius: 30px;
  245. }
  246. </style>