fileCard.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="card_main">
  3. <view class="card_banner"></view>
  4. <view class="card_info">
  5. <view class="card_info_title">
  6. 盐都区工信局文件传阅卡
  7. </view>
  8. <view class="card_table">
  9. <u-row justify="space-between">
  10. <u-col span="6">
  11. <view>年度: {{inputForm.yearNum}}</view>
  12. </u-col>
  13. <u-col span="6">
  14. <view style="text-align: right;">{{inputForm.cardNum}}</view>
  15. </u-col>
  16. </u-row>
  17. <u-row justify="space-between" class="card_row">
  18. <u-col span="3" textAlign="center" class="">
  19. <view>来文机关</view>
  20. </u-col>
  21. <u-col span="3" textAlign="center" class="card_col_1">
  22. <uni-tooltip :content="inputForm.sendingAgency" placement="top">
  23. <u--text size="14" align="center" lines="1" :text="inputForm.sendingAgency"></u--text>
  24. </uni-tooltip>
  25. </u-col>
  26. <u-col span="3" textAlign="center" class="card_col card_col_1">
  27. <view>来文字号</view>
  28. </u-col>
  29. <u-col span="3" textAlign="center">
  30. <uni-tooltip :content="inputForm.docFontSize" placement="top">
  31. <u--text size="14" align="center" lines="1" :text="inputForm.docFontSize"></u--text>
  32. </uni-tooltip>
  33. <!-- <u--text size="14" align="center" lines="1" :text="inputForm.docFontSize"></u--text> -->
  34. </u-col>
  35. </u-row>
  36. <u-row justify="space-between" class="card_row card_row_border">
  37. <u-col span="3" textAlign="center" class="">
  38. <view>收文时间</view>
  39. </u-col>
  40. <u-col span="3" textAlign="center" class="card_col_1">
  41. <u--text size="14" align="center" lines="1" :text="inputForm.receivingTime"></u--text>
  42. </u-col>
  43. <u-col span="3" textAlign="center" class="card_col card_col_1">
  44. <view>文件来源</view>
  45. </u-col>
  46. <u-col span="3" textAlign="center">
  47. <uni-tooltip :content="inputForm.fileSource" placement="top">
  48. <u--text size="14" align="center" lines="1" :text="inputForm.fileSource"></u--text>
  49. </uni-tooltip>
  50. <!-- <u--text size="14" align="center" lines="1" :text="inputForm.fileSource"></u--text> -->
  51. </u-col>
  52. </u-row>
  53. <u-row justify="space-between" class="card_row card_row_border">
  54. <u-col span="3" textAlign="center" align="center">
  55. <view>内容摘要</view>
  56. </u-col>
  57. <u-col span="9" class="info_abstract">
  58. <view class="info_abstract_v">
  59. {{inputForm.contentSummary}}
  60. </view>
  61. </u-col>
  62. </u-row>
  63. <u-row v-if="officeInfo.length>0" justify="space-between" class="card_row card_row_border">
  64. <u-col span="2" textAlign="center">
  65. <view class="vertical-text">办公室拟办</view>
  66. </u-col>
  67. <u-col span="10" class="info_abstract">
  68. <view v-for="item in officeInfo" class="info_abstract_v">
  69. <view>
  70. {{item.content}}
  71. </view>
  72. <view class="flex text-sm" style="line-height: 20px;">
  73. <u--image :src="item.signfj" width="80px" height="20px"></u--image>
  74. {{item.updateTime}}
  75. </view>
  76. </view>
  77. </u-col>
  78. </u-row>
  79. <u-row v-if="leaderInfo.length>0" justify="space-between" class="card_row card_row_border">
  80. <u-col span="2" textAlign="center">
  81. <view class="vertical-text">领导批示</view>
  82. </u-col>
  83. <u-col span="10" class="info_abstract">
  84. <view v-for="leader in leaderInfo" class="info_abstract_v">
  85. <view>
  86. {{leader.content}}
  87. </view>
  88. <view class="flex text-sm" style="line-height: 20px;">
  89. <u--image :src="leader.signfj" width="80px" height="20px"></u--image>
  90. {{leader.updateTime}}
  91. </view>
  92. </view>
  93. </u-col>
  94. </u-row>
  95. <u-row v-if="undertakeInfo.length>0" justify="space-between" class="card_row card_row_border">
  96. <u-col span="2" textAlign="center">
  97. <view class="vertical-text">承办情况</view>
  98. </u-col>
  99. <u-col span="10" class="info_abstract">
  100. <view v-for="item in undertakeInfo" class="info_abstract_v">
  101. <view>
  102. {{item.content}}
  103. </view>
  104. <view class="flex text-sm" style="line-height: 20px;">
  105. <u--image :src="item.signfj" width="80px" height="20px" mode="aspectFit"></u--image>
  106. {{item.updateTime}}
  107. </view>
  108. </view>
  109. </u-col>
  110. </u-row>
  111. <u-row justify="space-between" class="card_row card_row_border">
  112. <u-col span="3" textAlign="center" class="card_col">
  113. <view>备注</view>
  114. </u-col>
  115. <u-col span="9" textAlign="center">
  116. <view>{{inputForm.remark}}</view>
  117. </u-col>
  118. </u-row>
  119. <u--text style="margin: 10px;" size="10" type="error" text="所有涉密敏感信息不得上传"></u--text>
  120. <view class="card_other">
  121. 附件:
  122. <view class="other_info" v-for="item in fileList">
  123. <view class="other_pdf flex ">
  124. <u--text decoration='underline' color='#36a7f3' :text="item.name"
  125. @click="item.type=='pdf'?preview(item):download(item)"></u--text>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. <view style="margin-left: 20px;">
  132. <u-upload :fileList="imgList" multiple :maxCount="imgList.length" :previewFullImage="true"
  133. :deletable="false" ></u-upload>
  134. </view>
  135. <u-overlay :show="ismask">
  136. <view class="warp">
  137. <view class="rect"><u-button plain loading loadingText="加载中"></u-button></view>
  138. </view>
  139. </u-overlay>
  140. </view>
  141. </template>
  142. <script>
  143. import {
  144. isImageFormat
  145. } from "@/common/util.js"
  146. import BASE_URL from '@/config.js'
  147. import fileService from '@/api/file/fileService.js'
  148. import gwCirculationCard2Service from '@/api/circulation/gwCirculationCard2.js'
  149. import gwFlowService from '@/api/circulation/gwFlowService.js'
  150. export default {
  151. mounted() {
  152. gwCirculationCard2Service.queryById(this.gwId).then(data => {
  153. this.inputForm = data
  154. this.inputForm.receivingTime = this.inputForm.receivingTime.substring(5, 10)
  155. this.inputForm.cardNum = "[" + this.inputForm.yearNum + "]" + this.inputForm.cardNum + "号"
  156. this.fileLists = this.inputForm.attachedDocumentId.split(",")
  157. this.fileLists.forEach(item => {
  158. if (isImageFormat(item)) {
  159. let img = {
  160. url: item
  161. }
  162. if (!item.startsWith("http")) img.url = this.BASE_URL + item
  163. this.imgList.push(img)
  164. } else {
  165. const fileName = item.split(/[/\\=]/).pop();
  166. let type = ""
  167. const pdfFormats = /\.pdf$/i;
  168. if (pdfFormats.test(item)) type = "pdf";
  169. let a = {
  170. name: fileName,
  171. url: item,
  172. type: type
  173. }
  174. if (!item.startsWith("http")) a.url = this.BASE_URL + item
  175. this.fileList.push(a)
  176. }
  177. })
  178. })
  179. gwFlowService.queryByGwId(this.gwId).then(data => {
  180. data.forEach(item => {
  181. if (item.which == 0 && item.state == 0) {
  182. if (item.signfj && !item.signfj.startsWith("http")) item.signfj = this.BASE_URL +
  183. item.signfj
  184. this.officeInfo.push(item)
  185. } else if (item.which == 1 && item.state == 0) {
  186. if (item.signfj && !item.signfj.startsWith("http")) item.signfj = this.BASE_URL +
  187. item.signfj
  188. this.leaderInfo.push(item)
  189. } else if (item.which == 2 && item.state == 0) {
  190. if (item.signfj && !item.signfj.startsWith("http")) item.signfj = this.BASE_URL +
  191. item.signfj
  192. this.undertakeInfo.push(item)
  193. }
  194. })
  195. this.leaderInfo.sort((a, b) => a.updateTime.localeCompare(b.updateTime) || a.updateTime
  196. .localeCompare(b.updateTime));
  197. this.undertakeInfo.sort((a, b) => a.updateTime.localeCompare(b.updateTime) || a.updateTime
  198. .localeCompare(b.updateTime));
  199. this.officeInfo.sort((a, b) => a.updateTime.localeCompare(b.updateTime) || a.updateTime
  200. .localeCompare(b.updateTime));
  201. this.ismask = false
  202. })
  203. },
  204. data() {
  205. return {
  206. ismask: true,
  207. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  208. // 公文附件
  209. fileLists: [],
  210. fileList: [],
  211. imgList: [],
  212. // 办公室信息
  213. officeInfo: [],
  214. // 领导信息
  215. leaderInfo: [],
  216. // 承办信息
  217. undertakeInfo: [],
  218. inputForm: {
  219. id: '',
  220. yearNum: '',
  221. cardNum: '',
  222. sendingAgency: '',
  223. docFontSize: '',
  224. fileSource: '',
  225. writtenTime: '',
  226. receivingTime: '',
  227. contentSummary: '',
  228. attachedDocumentId: ''
  229. },
  230. gwflow: {
  231. id: '',
  232. gwId: '',
  233. content: '',
  234. signfj: '',
  235. createTruename: '',
  236. nextTruename: '',
  237. nextUser: '',
  238. which: '',
  239. state: '',
  240. next: '',
  241. nextLeadUser: '',
  242. nextDepUser: '',
  243. remark: '',
  244. },
  245. }
  246. },
  247. methods: {
  248. // 预览pdf
  249. preview(fileUrl) {
  250. uni.navigateTo({
  251. url: "/pages/pdfPreview/pdfPreview?url=" + encodeURIComponent(fileUrl.url)
  252. })
  253. },
  254. // 下载文件
  255. download(param) {
  256. uni.showLoading({
  257. title: "下载中"
  258. })
  259. uni.downloadFile({
  260. url: param.url, //调接口返回url
  261. success: (res) => {
  262. uni.hideLoading();
  263. if (res.statusCode == 200) {
  264. var tempFilePath = res.tempFilePath;
  265. this.saveFile(tempFilePath, param.name);
  266. } else {
  267. uni.showToast({
  268. icon: 'none',
  269. title: '报告下载失败'
  270. })
  271. }
  272. },
  273. fail: err => {
  274. uni.hideLoading();
  275. uni.showToast({
  276. icon: 'none',
  277. title: '报告下载失败'
  278. })
  279. reject(err);
  280. }
  281. })
  282. },
  283. saveFile(url, name) { //保存到本地
  284. try {
  285. const fileName = name;
  286. //new Blob 实例化文件流
  287. //let url = fileData
  288. //const url = window.URL.createObjectURL(new Blob([fileData],{type:'application/pdf'}))
  289. const link = document.createElement('a');
  290. link.style.display = 'none';
  291. link.href = url;
  292. link.setAttribute('download', fileName);
  293. link.setAttribute("target", "_blank");
  294. document.body.appendChild(link);
  295. link.click();
  296. //下载完成移除元素
  297. document.body.removeChild(link);
  298. //释放掉blob对象
  299. window.URL.revokeObjectURL(url)
  300. uni.showToast({
  301. title: '下载成功'
  302. })
  303. } catch (error) {
  304. uni.showToast({
  305. title: '下载失败'
  306. })
  307. }
  308. },
  309. },
  310. props: {
  311. isoffice: {
  312. type: Boolean,
  313. default: false
  314. },
  315. isleader: {
  316. type: Boolean,
  317. default: false
  318. },
  319. isinfo: {
  320. type: Boolean,
  321. default: false
  322. },
  323. gwId: {
  324. type: String,
  325. }
  326. },
  327. }
  328. </script>
  329. <style>
  330. .warp {
  331. display: flex;
  332. align-items: center;
  333. justify-content: center;
  334. height: 100%;
  335. }
  336. .card_main {
  337. width: 100%;
  338. background-color: #fefefe;
  339. }
  340. .card_banner {
  341. width: 100%;
  342. height: 60px;
  343. background-color: #36a7f3;
  344. }
  345. .card_info {
  346. width: 96%;
  347. /* height: 80vh; */
  348. margin: -40px 2% 0;
  349. background-color: #fefefe;
  350. border-radius: 15px;
  351. text-align: center;
  352. }
  353. .card_info_title {
  354. font-size: 20px;
  355. font-weight: 700;
  356. padding-top: 10px;
  357. color: #36a7f3;
  358. }
  359. .card_table {
  360. padding: 20px 20px;
  361. font-size: 18px;
  362. }
  363. .card_row {
  364. line-height: 50px;
  365. border: 1px solid;
  366. word-wrap: break-word;
  367. }
  368. .card_row_border {
  369. border-top: none;
  370. }
  371. .card_col {
  372. border-right: 1px solid;
  373. }
  374. .card_col_1 {
  375. border-left: 1px solid;
  376. }
  377. .info_abstract {
  378. line-height: 34px;
  379. font-size: 16px;
  380. word-wrap: break-word;
  381. border-left: 1px solid;
  382. }
  383. .info_abstract_v {
  384. margin: 18px;
  385. }
  386. .vertical-text {
  387. writing-mode: vertical-rl;
  388. /* 文字垂直排列,从右向左 */
  389. /* 或者使用vertical-lr; 从左向右 */
  390. }
  391. .card_other {
  392. text-align: left;
  393. }
  394. </style>