fileCard.vue 11 KB

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