examineFile.vue 10 KB

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