examineFile.vue 11 KB

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