examineFile.vue 9.6 KB

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