ccfc71b94aaf80b2d755b418a0a2706f10ea06a8.svn-base 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <!-- -->
  2. <template>
  3. <div>
  4. <!-- <el-row style="text-align:right;">
  5. <el-button type="text" icon="el-icon-circle-plus-outline">添加资料</el-button>
  6. </el-row> -->
  7. <el-row style="margin-top:27px" v-if="!isShow">
  8. <el-col :span="12">
  9. <h5 style="margin-top:10px;">会议资料:</h5>
  10. </el-col>
  11. <el-col :span="12" style="text-align: right;">
  12. <!-- <el-button style="padding: 5px;" size="mini" type="success" icon="el-icon-plus" circle></el-button> -->
  13. <!-- <el-button type="text" icon="el-icon-circle-plus-outline" @click="toAddFile">添加资料</el-button> -->
  14. <el-button style="padding: 5px;" size="mini" type="success" icon="el-icon-plus" circle @click="toAddFile"></el-button>
  15. </el-col>
  16. </el-row>
  17. <el-table
  18. :show-header="!isShow"
  19. :data="tableData"
  20. :height="zlTableHeight"
  21. stripe
  22. :border="!isShow"
  23. style="width: 100%;margin-top:10px;">
  24. <el-table-column
  25. prop="fileName"
  26. show-overflow-tooltip
  27. label="资料名称"
  28. >
  29. </el-table-column>
  30. <el-table-column
  31. v-if="!isShow"
  32. prop="createDate"
  33. show-overflow-tooltip
  34. label="上传时间"
  35. width="180">
  36. </el-table-column>
  37. <el-table-column
  38. v-if="!isShow"
  39. prop="fileExt"
  40. show-overflow-tooltip
  41. label="资料类型"
  42. width="90">
  43. </el-table-column>
  44. <el-table-column
  45. v-if="!isShow"
  46. prop="download"
  47. show-overflow-tooltip
  48. label="下载量"
  49. width="90">
  50. </el-table-column>
  51. <el-table-column
  52. v-if="isShow"
  53. prop="download"
  54. show-overflow-tooltip
  55. label="下载量"
  56. width="200"
  57. >
  58. <template slot-scope="scope">
  59. <!-- <el-progress
  60. :text-inside="true"
  61. :stroke-width="18"
  62. :percentage="60"
  63. :format="format">
  64. </el-progress> -->
  65. <el-progress :percentage="scope.row.download" :format="formatPro"></el-progress>
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. v-if="!isShow"
  70. width="130"
  71. label="操作">
  72. <template slot-scope="scope">
  73. <el-button
  74. style="color:#67c23a"
  75. size="mini"
  76. type="text"
  77. icon="el-icon-download"
  78. @click.stop="download(scope.$index, scope.row)">下载</el-button>
  79. <el-button
  80. style="color:#e6a23c"
  81. size="mini"
  82. type="text"
  83. icon="el-icon-delete"
  84. @click.stop="removeFile(scope.$index, scope.row)">删除</el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <!-- <el-pagination
  89. style="text-align:center;"
  90. @size-change="handleSizeChange"
  91. @current-change="handleCurrentChange"
  92. :current-page.sync="pageNum"
  93. :page-sizes="[10, 20, 30, 40, 50, 100]"
  94. :page-size="pageSize"
  95. layout="total, sizes, prev, pager, next, jumper"
  96. :total="total">
  97. </el-pagination> -->
  98. <addMeetingFiles
  99. v-if="addFileVisiual"
  100. :meetingInfoRow="meetingInfoRow"
  101. @cancelHandler="cancelHandler"
  102. ></addMeetingFiles>
  103. </div>
  104. </template>
  105. <script>
  106. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  107. //例如:import 《组件名称》 from '《组件路径》';
  108. import { getFilesLists } from "../../api/meetingAPI.js";
  109. import { deleteFileById } from "../../api/duChaAPI.js";
  110. import addMeetingFiles from './addMeetingFiles'
  111. export default {
  112. //import引入的组件需要注入到对象中才能使用
  113. components: {
  114. addMeetingFiles
  115. },
  116. props:['meetingInfoRow','isShow'],
  117. data() {
  118. //这里存放数据
  119. return {
  120. // zlTableHeight:window.innerHeight - 500,
  121. tableData: [],
  122. addFileVisiual:false,
  123. pageNum:1,
  124. pageSize:10,
  125. total:0,
  126. };
  127. },
  128. //监听属性 类似于data概念
  129. computed: {
  130. zlTableHeight(){
  131. if(window.innerWidth <= 1366){
  132. return window.innerHeight - 500;
  133. }else{
  134. return window.innerHeight - 660;
  135. }
  136. },
  137. },
  138. //监控data中的数据变化
  139. watch: {},
  140. //方法集合
  141. methods: {
  142. // format(percentage) {
  143. // return percentage === 100 ? '满' : `${percentage}`;
  144. // },
  145. formatPro(percentage) {
  146. return `${percentage}`;
  147. },
  148. handleSizeChange(val) {
  149. console.log(`每页 ${val} 条`);
  150. this.pageSize = val;
  151. this.getFilesTableData();
  152. },
  153. handleCurrentChange(val) {
  154. console.log(`当前页: ${val}`);
  155. this.pageNum = val;
  156. this.getFilesTableData();
  157. },
  158. //展示添加资料弹窗
  159. toAddFile(){
  160. this.addFileVisiual = true
  161. },
  162. cancelHandler(){
  163. this.addFileVisiual = false;
  164. this.getFilesTableData();
  165. },
  166. getFilesTableData(){
  167. var _self = this;
  168. let obj = {
  169. "pageNum":_self.pageNum,
  170. "pageSize":_self.pageSize,
  171. "id":_self.meetingInfoRow.id,
  172. }
  173. getFilesLists(obj).then(response => {
  174. _self.tableData = response.data;
  175. _self.total = response.data.length;
  176. });
  177. },
  178. download(index,row){
  179. window.open('/pdcApi/'+ row.filePath);
  180. },
  181. removeFile(index,row){
  182. var _self = this;
  183. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  184. confirmButtonText: "确定",
  185. cancelButtonText: "返回",
  186. type: "warning"
  187. }).then(
  188. res => {
  189. if (res === "confirm") {
  190. deleteFileById(row.id).then(res => {
  191. if (res.success) {
  192. this.$message.success('操作成功!');
  193. this.getFilesTableData();
  194. } else {
  195. this.$message.error(res.message);
  196. }
  197. });
  198. }
  199. },
  200. res => {
  201. console.log("返回");
  202. }
  203. );
  204. }
  205. },
  206. //生命周期 - 创建完成(可以访问当前this实例)
  207. created() {
  208. },
  209. //生命周期 - 挂载完成(可以访问DOM元素)
  210. mounted() {
  211. this.getFilesTableData();
  212. this.formatPro();
  213. },
  214. beforeCreate() {}, //生命周期 - 创建之前
  215. beforeMount() {}, //生命周期 - 挂载之前
  216. beforeUpdate() {}, //生命周期 - 更新之前
  217. updated() {}, //生命周期 - 更新之后
  218. beforeDestroy() {}, //生命周期 - 销毁之前
  219. destroyed() {}, //生命周期 - 销毁完成
  220. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  221. }
  222. </script>
  223. <style scoped>
  224. </style>