examineFile.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 v-if="!one" label="科室承办" borderBottom prop="nextDepUser">
  21. <office-user-select v-model="auditForm.nextDepUser" placeholder="请选择科室承办"
  22. title="科室承办" multiple 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. if (down.length != 1) this.one = false
  98. if (this.one) {
  99. this.roleId = "1770353074553331713"
  100. } else {
  101. this.roleId = "1773547256256622594"
  102. }
  103. userService.leaderList(this.roleId).then(data => {
  104. this.leaderList = data
  105. if (this.one) this.auditForm.nextLeadUser = data[0].loginName
  106. if (!this.auditForm.content) this.auditForm.content = '已阅'
  107. })
  108. let user = $auth.getUserInfo()
  109. let role = $auth.getUserInfo().roleNames
  110. let gw = data.filter(item => {
  111. return item.nextUser == user.id && item.state == 1
  112. })
  113. if (gw.length > 0) {
  114. this.auditForm = gw[0]
  115. if (gw[0].which == '4') this.isAll = true
  116. if (!this.auditForm.content) this.auditForm.content = '已阅'
  117. }
  118. if (role == '办公室管理员') {
  119. this.istransmit = true
  120. if (gw.length == 0) {
  121. let gw1 = data.filter(item => {
  122. return item.which == 3
  123. })
  124. gw1.sort((a, b) => b.createTime.localeCompare(a.createTime) || b.createTime.localeCompare(a
  125. .createTime));
  126. this.auditForm = gw1[0]
  127. // if (!this.auditForm.content) this.auditForm.content = '已阅'
  128. }
  129. }
  130. if (role == '局领导' && gw.length > 0) this.isleader = true
  131. if (role == '办公室主任' && gw.length > 0) this.isoffice = true
  132. if (role == '分管领导' && gw.length > 0) this.isleader = true
  133. if (role == '科室负责人' && gw.length > 0) this.isundertake = true
  134. })
  135. },
  136. components: {
  137. fileCard,
  138. signInput,
  139. officeUserSelect
  140. },
  141. data() {
  142. return {
  143. loading: false,
  144. isAll: false,
  145. show: false,
  146. one: true,
  147. action: this.BASE_URL + '/gwfile/upload?uploadPath=sign', //上传服务器的地址
  148. header: {
  149. "token": $auth.getUserToken()
  150. }, //图片上传携带头部信息
  151. auditForm: {
  152. id: '',
  153. gwId: '',
  154. content: '已阅',
  155. signfj: '',
  156. createTruename: '',
  157. nextTruename: '',
  158. nextUser: '',
  159. which: '0',
  160. state: '0',
  161. next: '',
  162. nextLeadUser: '',
  163. nextDepUser: '',
  164. remark: '',
  165. },
  166. gwForm: {},
  167. gwId: "",
  168. isoffice: false,
  169. isleader: false,
  170. isundertake: false,
  171. istransmit: false,
  172. leaderList: [],
  173. tablePage: {
  174. total: 0,
  175. currentPage: 1,
  176. pageSize: 1000,
  177. orders: [{
  178. column: "a.create_time",
  179. asc: false
  180. }],
  181. },
  182. searchForm: {
  183. // loginName: "",
  184. // name: "",
  185. // companyDTO: {
  186. // id: "",
  187. // },
  188. // officeDTO: {
  189. // id: "",
  190. // },
  191. },
  192. roleId: ""
  193. }
  194. },
  195. methods: {
  196. showToast(params) {
  197. this.loading = false
  198. this.$refs.uToast.show({
  199. ...params,
  200. complete() {
  201. params.url && uni.redirectTo({
  202. url: params.url
  203. })
  204. }
  205. })
  206. },
  207. /**
  208. * @param {Object} e
  209. * 签名完成回调
  210. */
  211. signToUrl(e) {
  212. this.auditForm.signfj = e.data
  213. if (e.error_code && e.error_code === '201') {
  214. uni.showToast({
  215. title: e.msg,
  216. icon: 'none'
  217. })
  218. return
  219. }
  220. },
  221. // 提交表单
  222. doSubmit() {
  223. let inputForm = this.auditForm;
  224. this.loading = true
  225. if (this.istransmit) {
  226. inputForm.next = '1'
  227. if (!this.one) inputForm.which = '3'
  228. }
  229. inputForm.state = "0"
  230. inputForm.gwId = this.gwId
  231. const date = moment().format('YYYY-MM-DD HH:mm:ss');
  232. inputForm.updateTime = date
  233. gwFlowService.save(inputForm).then(data => {
  234. let param = {
  235. type: 'success',
  236. message: data,
  237. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  238. }
  239. this.showToast(param);
  240. setTimeout(() => {
  241. // uni.$emit('refresh', {
  242. // type: 1
  243. // })
  244. // 先获取页面栈
  245. let pages = getCurrentPages();
  246. // 当前页面的前一个页面
  247. let prevPage = pages[pages.length - 2];
  248. // 如果 prevPage 存在,则重定向到上一页
  249. if (prevPage) {
  250. // 重定向到上一页
  251. uni.redirectTo({
  252. url: `/pages/fileTransmit/fileInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  253. });
  254. }
  255. }, 500)
  256. }).catch(() => {
  257. let param = {
  258. type: 'error',
  259. message: data,
  260. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png',
  261. }
  262. this.showToast(param);
  263. })
  264. },
  265. // 归档
  266. formSubmit() {
  267. this.loading = true
  268. let inputForm = Object.assign({}, this.auditForm);;
  269. inputForm.state = '0'
  270. inputForm.next = "0"
  271. gwFlowService.save(inputForm).then(data1 => {
  272. let param = {
  273. type: 'success',
  274. message: "已归档",
  275. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  276. }
  277. this.showToast(param);
  278. setTimeout(() => {
  279. // uni.$emit('refresh', {
  280. // type: 3
  281. // })
  282. // 先获取页面栈
  283. let pages = getCurrentPages();
  284. // 当前页面的前一个页面
  285. let prevPage = pages[pages.length - 2];
  286. // 如果 prevPage 存在,则重定向到上一页
  287. if (prevPage) {
  288. // 重定向到上一页
  289. uni.redirectTo({
  290. url: `/pages/fileTransmit/fileInfo?id=${this.gwId}` // 注意此处可能需要加上参数保留
  291. });
  292. }
  293. }, 500)
  294. })
  295. }
  296. }
  297. }
  298. </script>
  299. <style>
  300. .warp {
  301. display: flex;
  302. align-items: center;
  303. justify-content: center;
  304. height: 100%;
  305. }
  306. .office_main {
  307. width: 100%;
  308. margin: 5px 0;
  309. padding: 0 20px;
  310. background-color: #fefefe;
  311. }
  312. .office_main .office_title {
  313. width: 100%;
  314. border-bottom: 1px solid #eee;
  315. }
  316. .submit_btn {
  317. background-color: #fefefe;
  318. bottom: 10px;
  319. box-shadow: none;
  320. padding: 20px 0;
  321. }
  322. .submit_btn button {
  323. height: 40px;
  324. /* #ifdef H5 */
  325. width: 40%;
  326. /* #endif */
  327. /* #ifdef APP-PLUS */
  328. width: 30vw!important;
  329. /* #endif */
  330. border-radius: 50px;
  331. }
  332. </style>