| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <!-- -->
- <template>
- <div>
- <!-- <el-row style="text-align:right;">
- <el-button type="text" icon="el-icon-circle-plus-outline">添加资料</el-button>
- </el-row> -->
- <el-row style="margin-top:27px" v-if="!isShow">
- <el-col :span="12">
- <h5 style="margin-top:10px;">会议资料:</h5>
- </el-col>
- <el-col :span="12" style="text-align: right;">
- <!-- <el-button style="padding: 5px;" size="mini" type="success" icon="el-icon-plus" circle></el-button> -->
- <!-- <el-button type="text" icon="el-icon-circle-plus-outline" @click="toAddFile">添加资料</el-button> -->
- <el-button style="padding: 5px;" size="mini" type="success" icon="el-icon-plus" circle @click="toAddFile"></el-button>
- </el-col>
- </el-row>
-
- <el-table
- :show-header="!isShow"
- :data="tableData"
- :height="zlTableHeight"
- stripe
- :border="!isShow"
- style="width: 100%;margin-top:10px;">
- <el-table-column
- prop="fileName"
- show-overflow-tooltip
- label="资料名称"
- >
- </el-table-column>
- <el-table-column
- v-if="!isShow"
- prop="createDate"
- show-overflow-tooltip
- label="上传时间"
- width="180">
- </el-table-column>
- <el-table-column
- v-if="!isShow"
- prop="fileExt"
- show-overflow-tooltip
- label="资料类型"
- width="90">
- </el-table-column>
- <el-table-column
- v-if="!isShow"
- prop="download"
- show-overflow-tooltip
- label="下载量"
- width="90">
- </el-table-column>
- <el-table-column
- v-if="isShow"
- prop="download"
- show-overflow-tooltip
- label="下载量"
- width="200"
- >
- <template slot-scope="scope">
- <!-- <el-progress
- :text-inside="true"
- :stroke-width="18"
- :percentage="60"
- :format="format">
- </el-progress> -->
- <el-progress :percentage="scope.row.download" :format="formatPro"></el-progress>
- </template>
- </el-table-column>
- <el-table-column
- v-if="!isShow"
- width="130"
- label="操作">
- <template slot-scope="scope">
- <el-button
- style="color:#67c23a"
- size="mini"
- type="text"
- icon="el-icon-download"
- @click.stop="download(scope.$index, scope.row)">下载</el-button>
- <el-button
- style="color:#e6a23c"
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click.stop="removeFile(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- <el-pagination
- style="text-align:center;"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page.sync="pageNum"
- :page-sizes="[10, 20, 30, 40, 50, 100]"
- :page-size="pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination> -->
- <addMeetingFiles
- v-if="addFileVisiual"
- :meetingInfoRow="meetingInfoRow"
- @cancelHandler="cancelHandler"
- ></addMeetingFiles>
- </div>
- </template>
- <script>
- //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》 from '《组件路径》';
- import { getFilesLists } from "../../api/meetingAPI.js";
- import { deleteFileById } from "../../api/duChaAPI.js";
- import addMeetingFiles from './addMeetingFiles'
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {
- addMeetingFiles
- },
- props:['meetingInfoRow','isShow'],
- data() {
- //这里存放数据
- return {
- // zlTableHeight:window.innerHeight - 500,
- tableData: [],
- addFileVisiual:false,
- pageNum:1,
- pageSize:10,
- total:0,
- };
- },
- //监听属性 类似于data概念
- computed: {
- zlTableHeight(){
- if(window.innerWidth <= 1366){
- return window.innerHeight - 500;
- }else{
- return window.innerHeight - 660;
- }
- },
- },
- //监控data中的数据变化
- watch: {},
- //方法集合
- methods: {
- // format(percentage) {
- // return percentage === 100 ? '满' : `${percentage}`;
- // },
- formatPro(percentage) {
- return `${percentage}`;
- },
- handleSizeChange(val) {
- console.log(`每页 ${val} 条`);
- this.pageSize = val;
- this.getFilesTableData();
- },
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- this.pageNum = val;
- this.getFilesTableData();
- },
- //展示添加资料弹窗
- toAddFile(){
- this.addFileVisiual = true
- },
- cancelHandler(){
- this.addFileVisiual = false;
- this.getFilesTableData();
- },
- getFilesTableData(){
- var _self = this;
- let obj = {
- "pageNum":_self.pageNum,
- "pageSize":_self.pageSize,
- "id":_self.meetingInfoRow.id,
- }
- getFilesLists(obj).then(response => {
- _self.tableData = response.data;
- _self.total = response.data.length;
- });
- },
- download(index,row){
- window.open('/pdcApi/'+ row.filePath);
- },
- removeFile(index,row){
- var _self = this;
- this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "返回",
- type: "warning"
- }).then(
- res => {
- if (res === "confirm") {
- deleteFileById(row.id).then(res => {
- if (res.success) {
- this.$message.success('操作成功!');
- this.getFilesTableData();
- } else {
- this.$message.error(res.message);
- }
- });
- }
- },
- res => {
- console.log("返回");
- }
- );
- }
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- this.getFilesTableData();
- this.formatPro();
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- }
- </script>
- <style scoped>
- </style>
|