index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="pdf" v-show="fileType === 'pdf'">
  3. <el-row :gutter="10" class="mb8">
  4. <el-col :span="1.5">
  5. <el-button
  6. type="primary"
  7. plain
  8. size="mini"
  9. @click="handleAdd"
  10. v-hasPermi="['system:menu:add']"
  11. >转收文</el-button>
  12. </el-col>
  13. <el-col :span="1.5">
  14. <el-button
  15. type="primary"
  16. plain
  17. size="mini"
  18. @click="handleAdd"
  19. v-hasPermi="['system:menu:add']"
  20. >转本部门</el-button>
  21. </el-col>
  22. <el-col :span="1.5">
  23. <el-button
  24. type="primary"
  25. plain
  26. size="mini"
  27. @click="handleAdd"
  28. v-hasPermi="['system:menu:add']"
  29. >分发范围</el-button>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-button
  33. type="primary"
  34. plain
  35. size="mini"
  36. @click="handleAdd"
  37. v-hasPermi="['system:menu:add']"
  38. >阅读情况</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="primary"
  43. plain
  44. size="mini"
  45. @click="handleAdd"
  46. v-hasPermi="['system:menu:add']"
  47. >收藏公文</el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button
  51. type="primary"
  52. plain
  53. size="mini"
  54. @click="pdfdele"
  55. v-hasPermi="['system:menu:add']"
  56. >退回</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="primary"
  61. plain
  62. size="mini"
  63. @click="handleAdd"
  64. v-hasPermi="['system:menu:add']"
  65. >收文签收</el-button>
  66. </el-col>
  67. </el-row>
  68. <div>
  69. <p style="font-size: 28px; font-weight: 700;">正文:</p>
  70. <a v-if="shouwe" :href="src" download="测试">{{name}}</a>
  71. <span v-if="!shouwe" @click="down">{{name}}</span>
  72. </div>
  73. <p style="font-size: 28px; font-weight: 700;">附件:</p>
  74. <p style="text-align: right; font-size: 20px; color: #1890FF;"><a :href="src" target="_blank" >全屏</a></p>
  75. <iframe :src="src" frameborder="0" style="width: 100%; height: 100vh;"></iframe>
  76. </div>
  77. </template>
  78. <script>
  79. import Pdf from 'vue-pdf'
  80. import { listRoles,pdfDwon,timeu,weit} from "@/api/system/isses";
  81. export default {
  82. components: {
  83. Pdf
  84. },
  85. data() {
  86. return {
  87. dialogVisible: true,
  88. // src: `${window.location.origin}/ceshi.pdf`,
  89. src:'',
  90. fileType:'pdf',
  91. name:'',
  92. forew:{
  93. table:'',
  94. fixedData:{
  95. id:-1
  96. }
  97. },
  98. juegh:{
  99. preview:false,
  100. absolutePath:''
  101. },
  102. shouwe:true,
  103. wfor:{
  104. table: "",
  105. objId:0,
  106. fixedData:{
  107. status:'Y',
  108. receive_time :''
  109. }
  110. }
  111. }
  112. },
  113. created() {
  114. console.log(this.$route.query.tables)
  115. this.forew.table = 'boman_message';
  116. this.forew.fixedData.id = this.$route.query.id - 0;
  117. this.wfor.objId = this.$route.query.index - 0;
  118. this.wfor.messageId = this.$route.query.id - 0;
  119. // this.wfor.table = this.$route.query.tables;
  120. // 获取当前时间戳
  121. var date1 =new Date();
  122. // let tmie = Date.parse(date1) / 1000
  123. let tmie = this.dateFormat()
  124. // console.log(tmie)
  125. this.wfor.receiveTime = tmie
  126. if(this.$route.query.teiwog == 'weidu'){
  127. this.weideu()
  128. }
  129. this.getList()
  130. this.timeta()
  131. },
  132. methods: {
  133. handleAdd(){},
  134. // 路径
  135. getList() {
  136. this.loading = true;
  137. console.log(this.forew)
  138. listRoles(this.forew).then(
  139. res => {
  140. console.log(34)
  141. console.log(res)
  142. let pdflis = []
  143. if(res.data !== undefined){
  144. if(res.data.message_upload !== null && res.data.message_upload !==''){
  145. pdflis = JSON.parse(res.data.message_upload)
  146. this.src = pdflis[0].url
  147. this.name = res.data.message_title
  148. this.juegh.absolutePath = pdflis[0].absolutePath
  149. }
  150. console.log(this.src.split('.'))
  151. }
  152. }
  153. );
  154. },
  155. pdfdele(){
  156. this.$router.go(-1)
  157. },
  158. // 下载
  159. down(){
  160. pdfDwon(this.juegh).then(response => {
  161. if (response.resultCode == 0) {
  162. this.msgSuccess('提交成功');
  163. }
  164. this.$store.dispatch('tagsView/delView', this.$route);
  165. // this.reload();
  166. });
  167. },
  168. // 判断时间是否在30分钟以内
  169. timeta(){
  170. timeu(this.forew.fixedData.id).then(response => {
  171. console.log(response)
  172. if(response.code == 200){
  173. this.shouwe = true
  174. }else{
  175. this.shouwe = false
  176. }
  177. // if (response.resultCode == 0) {
  178. // this.msgSuccess('提交成功');
  179. // }
  180. // this.$store.dispatch('tagsView/delView', this.$route);
  181. // this.reload();
  182. });
  183. },
  184. // 未读变已读
  185. weideu(){
  186. weit(this.wfor).then(response => {
  187. console.log(response)
  188. if(response.code == 200){
  189. this.msgSuccess('已读成功');
  190. // this.shouwe = true
  191. }else{
  192. // this.shouwe = false
  193. }
  194. })
  195. },
  196. // 时间转换
  197. dateFormat() {
  198. var date = new Date();
  199. var month = date.getMonth() + 1;
  200. var strDate = date.getDate();
  201. var hours = date.getHours()
  202. var minus = date.getMinutes()
  203. var secong = date.getSeconds()
  204. if (month >= 1 && month <= 9) {
  205. month = "0" + month;
  206. }
  207. if (strDate >= 0 && strDate <= 9) {
  208. strDate = "0" + strDate;
  209. }
  210. if (hours >= 0 && hours <= 9) {
  211. hours = "0" + hours;
  212. }
  213. if (minus >= 0 && minus <= 9) {
  214. minus = "0" + minus;
  215. }
  216. if (secong >= 0 && secong <= 9) {
  217. secong = "0" + secong;
  218. }
  219. var currentDate = date.getFullYear() + "-" + month + "-" + strDate
  220. + " " + hours + ":" + minus + ":" + secong;
  221. return currentDate;
  222. },
  223. }
  224. }
  225. </script>
  226. <style>
  227. .pdf{
  228. padding: 30px;
  229. }
  230. </style>