projectSettlementDetailConclusion.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <!-- 项目管理 项目结题附件 -->
  3. <div class="ProjectManagement5" v-loading="loading">
  4. <div class="pmInp">
  5. <!-- <el-button type="primary" class="btn" @click="addFile" size="mini">上传文件</el-button> -->
  6. <!-- <beUpload @getFile="getFile" :navName="'上传文件'" :accept="accept"></beUpload> -->
  7. </div>
  8. <!-- 表格部分开始 -->
  9. <el-table
  10. :data="tableData"
  11. tooltip-effect="dark"
  12. stripe
  13. height="550px"
  14. class="fontSize"
  15. :header-cell-style="{ background: '#f2f2f2',color:'#000' }"
  16. >
  17. <!-- <el-table-column
  18. prop="projectTitle"
  19. label="项目名称"
  20. align="center"
  21. >
  22. <template>
  23. <span>{{ title }}</span>
  24. </template>
  25. </el-table-column> -->
  26. <el-table-column
  27. prop="fileName"
  28. label="项目结题附件"
  29. align="center"
  30. >
  31. </el-table-column>
  32. <el-table-column
  33. prop="size"
  34. label="大小"
  35. align="center"
  36. >
  37. </el-table-column>
  38. <el-table-column
  39. prop="uploadTime"
  40. label="时间"
  41. align="center"
  42. >
  43. </el-table-column>
  44. <el-table-column
  45. prop="operation"
  46. align="center"
  47. label="操作"
  48. >
  49. <template #default="scope">
  50. <div class="operations">
  51. <el-button type="primary" size="mini" @click="checkFile(scope.row.url)" style="background: #477edd">明细查看</el-button>
  52. </div>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. <!-- 展示文档开始 -->
  57. <el-dialog
  58. title="展示文件"
  59. :visible.sync="showFile"
  60. width="80vw"
  61. class="addDialog showDialog"
  62. >
  63. <div class="showFileArea">
  64. <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
  65. <vword
  66. style="width: 100%; height: 100%; overflow: auto"
  67. class="fullStyle"
  68. v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
  69. :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
  70. ></vword>
  71. <vpdf
  72. style="width: 100%; height: 100%; overflow: auto"
  73. class="fullStyle"
  74. :pdfUrl="showFileUrl"
  75. v-if="Wordss['type']=='pdf'"
  76. ></vpdf>
  77. <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
  78. </div>
  79. </el-dialog>
  80. <!-- 展示文档结束 -->
  81. <!-- 分页 -->
  82. <!-- <el-pagination
  83. @current-change="handleCurrentChange"
  84. :current-page="table.currentPage"
  85. :page-size="table.packageSize"
  86. layout=" prev, pager, next"
  87. background
  88. class="paginations"
  89. :total="table.total">
  90. </el-pagination> -->
  91. <!-- 分页结束 -->
  92. </div>
  93. </template>
  94. <script>
  95. import beUpload from '@/components/tool/beUpload'
  96. import vpdf from "@/components/vpdf.vue";
  97. import vword from "@/components/vword.vue";
  98. export default {
  99. components: { beUpload, vpdf, vword },
  100. data() {
  101. return {
  102. accept:".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  103. // table:{ // 分页数据
  104. // total:0,
  105. // packageSize:8,
  106. // currentPage:1
  107. // },
  108. showFileType: 0,
  109. loading:false,
  110. tableData:[], //附件列表
  111. file:'', //上传文件数据
  112. showFile: false,
  113. showFileUrl: "",
  114. Wordss:{type:"",name:""},
  115. canonical:{
  116. Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
  117. File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
  118. },
  119. }
  120. },
  121. methods:{
  122. //展示文件
  123. checkFile(url) {
  124. this.showFileUrl = url;
  125. this.showFile = true;
  126. if(typeof url=='undefined')return {type:"",name:""};
  127. let urlSplit = url.split(".");
  128. const type = urlSplit[urlSplit.length-1]
  129. if(this.canonical.Image.test(url)){
  130. this.Wordss={type:type,name:"图片"}
  131. return console.log(this.Wordss);
  132. }
  133. if(this.canonical.File.test(url)){
  134. this.Wordss={type:type,name:"文档"}
  135. return console.log(this.Wordss);
  136. }
  137. else return this.Wordss={type:type,name:type}
  138. },
  139. getFile(val) { //上传文件
  140. this.file = val;
  141. let oldData = [];
  142. this.tableData.forEach(item=>oldData.push(item))
  143. oldData.push(val);
  144. let param={
  145. uid:this.$store.state.userInfo.userid,
  146. cid:this.$route.query['pid'],
  147. projectFile:JSON.stringify(oldData)
  148. }
  149. this.ajax
  150. .post(this.$store.state.api+'/AddProjectManageFile',param)
  151. .then(res=>{
  152. console.log(res);
  153. if (res.data==1) {
  154. this.getData()
  155. this.$message.success('上传成功')
  156. }else{
  157. this.$message.error('上传失败')
  158. }
  159. },err=>{
  160. console.log(err);
  161. })
  162. },
  163. handleCurrentChange(val) { //当页数发生改变的时候调用获取列表数据请求
  164. // console.log(`当前页: ${val}`);
  165. this.table.currentPage=val
  166. this.getData()
  167. },
  168. getData(){ //获取基础信息
  169. this.loading = true;
  170. let param={
  171. uid:this.$store.state.userInfo.userid,
  172. pid:this.$route.query['pid'],
  173. }
  174. this.ajax
  175. .get(this.$store.state.api+'/SelectProjectManageFile',param)
  176. .then(res=>{
  177. this.tableData=JSON.parse(res.data[0][0]['endFile'])
  178. this.loading = false;
  179. },err=>{
  180. console.log(err);
  181. })
  182. },
  183. },
  184. mounted(){
  185. this.getData()
  186. }
  187. }
  188. </script>
  189. <style lang="less">
  190. .ProjectManagement5{
  191. .pagination{
  192. float: right;
  193. margin: 20px 55px 10px;
  194. }
  195. .addDialog {
  196. font-size: 18px;
  197. .el-dialog {
  198. border-radius: 5px;
  199. overflow: hidden;
  200. }
  201. .deleteContent {
  202. width: 100%;
  203. margin: 30px 0;
  204. font-size: 22px;
  205. color: #000;
  206. }
  207. .addDialogLogo {
  208. width: 60px;
  209. height: 30px;
  210. display: flex;
  211. justify-content: center;
  212. line-height: 30px;
  213. border-radius: 5px;
  214. background: #f2f2f2;
  215. position: absolute;
  216. left: 20px; top: 15px;
  217. }
  218. .el-dialog__header {
  219. display: flex;
  220. justify-content: center;
  221. background: #32455b;
  222. }
  223. .el-dialog__title {
  224. color:#fff;
  225. display: flex;
  226. justify-content: center;
  227. font-size: 18px;
  228. position: relative;
  229. top: -2px;
  230. }
  231. .addDialogMid {
  232. box-sizing: border-box;
  233. padding: 0 60px 0 10px;
  234. .addDialogTit {
  235. display: flex;
  236. span {
  237. width: 80px;
  238. font-size: 16px;
  239. line-height: 40px;
  240. text-align: left;
  241. }
  242. }
  243. .addDialogTit1 {
  244. display: flex;
  245. justify-content: space-between;
  246. margin-bottom: 15px;
  247. }
  248. .addDialogTit2 {
  249. margin-top: 10px;
  250. font-size: 16px;
  251. color: #000;
  252. text-indent: 2em;
  253. }
  254. .addDialogCon {
  255. margin-top: 20px;
  256. }
  257. }
  258. .dialog-footer {
  259. display: flex;
  260. justify-content: center;
  261. box-sizing: border-box;
  262. // .btn5 {
  263. // font-size: 16px;
  264. // }
  265. }
  266. }
  267. .pmInp{
  268. width: 100%;
  269. margin: 10px 0 10px 0;
  270. display: flex;
  271. justify-content: flex-end;
  272. .btn{
  273. height: 30px;
  274. width: 100px;
  275. font-size: 16px;
  276. background: #477edd;
  277. // margin-left: 10px;
  278. }
  279. }
  280. }
  281. </style>