examineFile.vue 11 KB

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