fileCard.vue 11 KB

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