fileCard.vue 10 KB

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