examineFile.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view>
  3. <fileCard :gwId="gwId"></fileCard>
  4. <view class="office_main">
  5. <view class="office_title">
  6. <uni-section v-if="istransmit" titleColor="#36a7f3" class="mb-10" title="承办转发"
  7. type="line"></uni-section>
  8. <uni-section v-if="isoffice" titleColor="#36a7f3" class="mb-10" title="办公室拟办" type="line"></uni-section>
  9. <uni-section v-if="isleader" titleColor="#36a7f3" class="mb-10" title="领导批示" type="line"></uni-section>
  10. <uni-section v-if="isundertake" titleColor="#36a7f3" class="mb-10" title="承办科室"
  11. type="line"></uni-section>
  12. </view>
  13. <view class="office_info">
  14. <u--form v-if="istransmit" :model="auditForm" labelWidth="130px" class="u-form default_title"
  15. labelPosition="left" ref="auditForm">
  16. <u-form-item label="转发领导" borderBottom prop="nextLeadUser">
  17. <jp-picker v-model="auditForm.nextLeadUser" placeholder="请选择转发领导" :range="leaderList"
  18. rangeKey="name" rangeValue="loginName"></jp-picker>
  19. </u-form-item>
  20. <u-form-item label="科室承办" borderBottom prop="nextDepUser">
  21. <office-user-select v-model="auditForm.nextDepUser" placeholder="请选择科室承办" title="科室承办" multiple
  22. types="3"></office-user-select>
  23. </u-form-item>
  24. <u-form-item label="备注" borderBottom prop="remark">
  25. <u--input v-model="auditForm.remark" placeholder="请输入备注" border="none"></u--input>
  26. </u-form-item>
  27. <view class="submit_btn flex ">
  28. <u-button v-if="isAll" @click="formSubmit" type="success" text="归档"></u-button>
  29. <u-button v-if="!loading" type="primary" :disabled="auditForm.nextLeadUser==''" text="确认签字"
  30. @click="doSubmit"></u-button>
  31. <u-button v-if="loading" :loading="loading" type="primary" text="加载中"></u-button>
  32. </view>
  33. </u--form>
  34. </view>
  35. <view class="office_info">
  36. <u--form v-if="isoffice" :model="auditForm" labelWidth="130px" class="u-form default_title"
  37. labelPosition="left" ref="auditForm">
  38. <u-form-item label="办公室拟办" borderBottom prop="content">
  39. <u--textarea v-model="auditForm.content" placeholder=""></u--textarea>
  40. </u-form-item>
  41. <view class="submit_btn flex ">
  42. <u-button v-if="!loading" type="primary" text="确认签字" @click="doSubmit"></u-button>
  43. <u-button v-if="loading" :loading="loading" type="primary" text="加载中"></u-button>
  44. </view>
  45. </u--form>
  46. <u--form v-if="isleader" :model="auditForm" labelWidth="130px" class="u-form default_title"
  47. labelPosition="left" ref="auditForm">
  48. <u-form-item label="领导批示" borderBottom prop="content">
  49. <u--textarea v-model="auditForm.content" placeholder=""></u--textarea>
  50. </u-form-item>
  51. <!-- <u-form-item v-if="show" label="签字" borderBottom prop="signfj">
  52. <signInput ref="sign" canvasId="twoDrowCanvas" canvasIds="twoRotateCanvas" :header="header"
  53. :action="action" @signToUrl="signToUrl">
  54. </signInput>
  55. </u-form-item> -->
  56. <view class="submit_btn flex ">
  57. <!-- <u-button v-if="!show" type="primary" text="确认签字" @click="show = true"></u-button> -->
  58. <u-button v-if="!loading" type="primary" text="确认签字" @click="doSubmit"></u-button>
  59. <u-button v-if="loading" :loading="loading" type="primary" text="加载中"></u-button>
  60. </view>
  61. </u--form>
  62. <u--form v-if="isundertake" :model="auditForm" labelWidth="130px" class="u-form default_title"
  63. labelPosition="left" ref="auditForm">
  64. <u-form-item label="承办科室" borderBottom prop="content">
  65. <u--textarea v-model="auditForm.content" placeholder=""></u--textarea>
  66. </u-form-item>
  67. <view class="submit_btn flex ">
  68. <u-button v-if="loading" :loading="loading" type="primary" text="加载中"></u-button>
  69. <u-button v-if="!loading" type="primary" text="确认签字" @click="doSubmit"></u-button>
  70. </view>
  71. </u--form>
  72. </view>
  73. </view>
  74. <u-toast ref="uToast"></u-toast>
  75. <u-overlay :show="loading">
  76. <view class="warp">
  77. <view class="rect"><u-button plain loading loadingText="加载中"></u-button></view>
  78. </view>
  79. </u-overlay>
  80. </view>
  81. </template>
  82. <script>
  83. import fileCard from "./fileCard.vue"
  84. import BASE_URL from '@/config.js'
  85. import moment from "moment"
  86. import signInput from "@/components/am-sign-input/am-sign-input.vue"
  87. import officeUserSelect from "@/components/office-user-select/office-user-select.vue"
  88. import userService from "@/api/sys/userService"
  89. import gwFlowService from '@/api/circulation/gwFlowService.js'
  90. import gwCirculationCard2Service from '@/api/circulation/gwCirculationCard2.js'
  91. import * as $auth from "@/common/auth.js"
  92. export default {
  93. onLoad(option) {
  94. this.gwId = option.id
  95. gwFlowService.queryByGwId(this.gwId).then(data => {
  96. let down = data.filter(item => item.state == 0)
  97. userService.leaderList("1773547256256622594").then(data => {
  98. this.leaderList = data
  99. if (this.one) this.auditForm.nextLeadUser = data[0].loginName
  100. if (!this.auditForm.content) this.auditForm.content = '已阅'
  101. })
  102. let user = $auth.getUserInfo()
  103. let role = $auth.getUserInfo().roleNames
  104. let gw = data.filter(item => {
  105. return item.nextUser == user.id && item.state == 1
  106. })
  107. if (gw.length > 0) {
  108. this.auditForm = gw[0]
  109. if (gw[0].which == '4') this.isAll = true
  110. if (!this.auditForm.content) this.auditForm.content = '已阅'
  111. }
  112. if (role == '办公室管理员') {
  113. this.istransmit = true
  114. if (gw.length == 0) {
  115. let gw1 = data.filter(item => {
  116. return item.which == 3
  117. })
  118. gw1.sort((a, b) => b.createTime.localeCompare(a.createTime) || b.createTime.localeCompare(a
  119. .createTime));
  120. this.auditForm = gw1[0]
  121. // if (!this.auditForm.content) this.auditForm.content = '已阅'
  122. }
  123. }
  124. if (role == '局领导' && gw.length > 0) this.isleader = true
  125. if (role == '办公室主任' && gw.length > 0) this.isoffice = true
  126. if (role == '分管领导' && gw.length > 0) this.isleader = true
  127. if (role == '科室负责人' && gw.length > 0) this.isundertake = true
  128. })
  129. },
  130. components: {
  131. fileCard,
  132. signInput,
  133. officeUserSelect
  134. },
  135. data() {
  136. return {
  137. loading: false,
  138. isAll: false,
  139. show: false,
  140. action: this.BASE_URL + '/gwfile/upload?uploadPath=sign', //上传服务器的地址
  141. header: {
  142. "token": $auth.getUserToken()
  143. }, //图片上传携带头部信息
  144. auditForm: {
  145. id: '',
  146. gwId: '',
  147. content: '已阅',
  148. signfj: '',
  149. createTruename: '',
  150. nextTruename: '',
  151. nextUser: '',
  152. which: '0',
  153. state: '0',
  154. next: '',
  155. nextLeadUser: '',
  156. nextDepUser: '',
  157. remark: '',
  158. },
  159. gwForm: {},
  160. gwId: "",
  161. isoffice: false,
  162. isleader: false,
  163. isundertake: false,
  164. istransmit: false,
  165. leaderList: [],
  166. tablePage: {
  167. total: 0,
  168. currentPage: 1,
  169. pageSize: 1000,
  170. orders: [{
  171. column: "a.create_time",
  172. asc: false
  173. }],
  174. },
  175. }
  176. },
  177. methods: {
  178. showToast(params) {
  179. this.loading = false
  180. this.$refs.uToast.show({
  181. ...params,
  182. complete() {
  183. params.url && uni.redirectTo({
  184. url: params.url
  185. })
  186. }
  187. })
  188. },
  189. /**
  190. * @param {Object} e
  191. * 签名完成回调
  192. */
  193. signToUrl(e) {
  194. this.auditForm.signfj = e.data
  195. if (e.error_code && e.error_code === '201') {
  196. uni.showToast({
  197. title: e.msg,
  198. icon: 'none'
  199. })
  200. return
  201. }
  202. },
  203. // 提交表单
  204. doSubmit() {
  205. let inputForm = this.auditForm;
  206. this.loading = true
  207. if (this.istransmit) {
  208. inputForm.next = '1'
  209. if (!this.one) inputForm.which = '3'
  210. }
  211. inputForm.state = "0"
  212. inputForm.gwId = this.gwId
  213. const date = moment().format('YYYY-MM-DD HH:mm:ss');
  214. inputForm.updateTime = date
  215. gwFlowService.save(inputForm).then(data => {
  216. let param = {
  217. type: 'success',
  218. message: data,
  219. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  220. }
  221. this.showToast(param);
  222. setTimeout(() => {
  223. // uni.$emit('refresh', {
  224. // type: 1
  225. // })
  226. // 先获取页面栈
  227. let pages = getCurrentPages();
  228. // 当前页面的前一个页面
  229. let prevPage = pages[pages.length - 2];
  230. // 如果 prevPage 存在,则重定向到上一页
  231. if (prevPage) {
  232. // 重定向到上一页
  233. uni.redirectTo({
  234. url: `/pages/fileTransmit/fileInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  235. });
  236. }
  237. }, 500)
  238. }).catch(() => {
  239. let param = {
  240. type: 'error',
  241. message: data,
  242. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png',
  243. }
  244. this.showToast(param);
  245. })
  246. },
  247. // 归档
  248. formSubmit() {
  249. this.loading = true
  250. let inputForm = Object.assign({}, this.auditForm);;
  251. inputForm.state = '0'
  252. inputForm.next = "0"
  253. gwFlowService.save(inputForm).then(data1 => {
  254. let param = {
  255. type: 'success',
  256. message: "已归档",
  257. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  258. }
  259. this.showToast(param);
  260. setTimeout(() => {
  261. // uni.$emit('refresh', {
  262. // type: 3
  263. // })
  264. // 先获取页面栈
  265. let pages = getCurrentPages();
  266. // 当前页面的前一个页面
  267. let prevPage = pages[pages.length - 2];
  268. // 如果 prevPage 存在,则重定向到上一页
  269. if (prevPage) {
  270. // 重定向到上一页
  271. uni.redirectTo({
  272. url: `/pages/fileTransmit/fileInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  273. });
  274. }
  275. }, 500)
  276. })
  277. }
  278. }
  279. }
  280. </script>
  281. <style>
  282. .warp {
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. height: 100%;
  287. }
  288. .office_main {
  289. width: 100%;
  290. margin: 5px 0;
  291. padding: 0 20px;
  292. background-color: #fefefe;
  293. }
  294. .office_main .office_title {
  295. width: 100%;
  296. border-bottom: 1px solid #eee;
  297. }
  298. .submit_btn {
  299. background-color: #fefefe;
  300. bottom: 10px;
  301. box-shadow: none;
  302. padding: 20px 0;
  303. }
  304. .submit_btn button {
  305. height: 40px;
  306. /* #ifdef H5 */
  307. width: 40%;
  308. /* #endif */
  309. /* #ifdef APP-PLUS */
  310. width: 30vw !important;
  311. /* #endif */
  312. border-radius: 50px;
  313. }
  314. </style>