|
|
@@ -1,462 +1,497 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <div class="filters-container">
|
|
|
-
|
|
|
- <el-input placeholder="关键字" size="small" v-model="filter1" clearable class="filter-item"></el-input>
|
|
|
- <el-button @click="searchData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
|
|
|
- </el-button>
|
|
|
- <el-button @click="showAdvancedQueryDialog = !showAdvancedQueryDialog" type="primary" size="small"
|
|
|
- icon="el-icon-search" class="filter-item">高级查询
|
|
|
- </el-button>
|
|
|
- <el-button @click="showTableSortDialog = !showTableSortDialog" type="primary" size="small"
|
|
|
- icon="el-icon-sort" class="filter-item">排序
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- @click="$router.push({path:'/fileInfo',query:{column:$route.query.column,type:$route.query.type}})"
|
|
|
- type="primary"
|
|
|
- size="small" icon="el-icon-edit"
|
|
|
- class="filter-item">添加
|
|
|
- </el-button>
|
|
|
- <el-button @click="exportExcel" type="primary" size="small" icon="el-icon-share" class="filter-item">导出EXCEL
|
|
|
- </el-button>
|
|
|
- <el-dropdown trigger="click" size="medium" class="table-column-filter">
|
|
|
- <span>
|
|
|
- 筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
- </span>
|
|
|
- <el-dropdown-menu slot="dropdown" class="table-column-filter-wrapper">
|
|
|
- <el-checkbox v-for="item in tableColumns" :key="item.value" v-model="item.show">{{item.label}}
|
|
|
- </el-checkbox>
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
- </div>
|
|
|
- <el-table
|
|
|
- :data="tableData"
|
|
|
- :height="tableHeight"
|
|
|
- row-key="id"
|
|
|
- ref="table">
|
|
|
- <el-table-column
|
|
|
- v-if="multipleMode"
|
|
|
- align="center"
|
|
|
- type="selection"
|
|
|
- width="50">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- type="index"
|
|
|
- min-width="50"
|
|
|
- align="center">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- v-if="isColumnShow('url')"
|
|
|
- prop="url"
|
|
|
- label="文件地址"
|
|
|
- min-width="100">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- v-if="isColumnShow('uploadTime')"
|
|
|
- prop="uploadTime"
|
|
|
- label="上传时间"
|
|
|
- :formatter="DateFormatter"
|
|
|
- min-width="100">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- v-if="isColumnShow('type')"
|
|
|
- prop="type"
|
|
|
- label="类型:0:data_video 1:data_app"
|
|
|
- min-width="100">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- v-if="isColumnShow('fatherId')"
|
|
|
- prop="fatherId"
|
|
|
- label="父类id"
|
|
|
- min-width="100">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- fixed="right"
|
|
|
- min-width="150"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
|
|
|
- <el-button @click="deleteRow(scope.row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <div class="pagination-wrapper">
|
|
|
- <div class="multiple-mode-wrapper" v-if="0">
|
|
|
- <el-button size="small" v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
|
|
|
- <el-button-group v-else>
|
|
|
- <el-button size="small" @click="operation1">批量操作1</el-button>
|
|
|
- <el-button size="small" @click="operation2">批量操作2</el-button>
|
|
|
- <el-button size="small" @click="toggleMultipleMode(false)">取消</el-button>
|
|
|
- </el-button-group>
|
|
|
- </div>
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- @size-change="pageSizeChange"
|
|
|
- @current-change="currentPageChange"
|
|
|
- :current-page="currentPage"
|
|
|
- :page-sizes="[10, 20, 30, 40, 50]"
|
|
|
- :page-size="pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="totalNumber">
|
|
|
- </el-pagination>
|
|
|
- </div>
|
|
|
- <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
|
|
|
- <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
- <el-table :data="advancedQueryFields">
|
|
|
-
|
|
|
- <el-table-column prop="link" label="链接符" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select placeholder="链接" size="small" v-model="row.link" class="filter-item">
|
|
|
- <el-option label="AND" value="AND">
|
|
|
- </el-option>
|
|
|
- <el-option label="OR" value="OR">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="name" label="字段" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.name">
|
|
|
-
|
|
|
- <el-option v-for="item in advancedQueryColumns" :label="item.label" :value="item.value"
|
|
|
- :key="item.value"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.searchMethod">
|
|
|
- <el-option v-for="item in searchMethods" :label="item" :value="item"
|
|
|
- :key="item"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="value" label="参数" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.value"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="60" align="center">
|
|
|
- <template slot-scope="{ row, column, $index }">
|
|
|
- <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
-
|
|
|
- <el-button @click="advancedQuery" :loading="$store.state.fetchingData">确定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog title="排序" :visible.sync="showTableSortDialog">
|
|
|
- <el-button @click="addSortField" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
- <el-table :data="tableSortFields">
|
|
|
-
|
|
|
- <el-table-column prop="name" label="字段" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.name">
|
|
|
-
|
|
|
- <el-option v-for="item in advancedQueryColumns" :label="item.label" :value="item.value"
|
|
|
- :key="item.value"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="order" label="排序" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.order">
|
|
|
- <el-option label="降序" value="desc">
|
|
|
- </el-option>
|
|
|
- <el-option label="升序" value="asc">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="60" align="center">
|
|
|
- <template slot-scope="{ row, column, $index }">
|
|
|
- <el-button @click="removeSortField($index)" size="small" type="text">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
-
|
|
|
- <el-button @click="tableSortQuery" :loading="$store.state.fetchingData">确定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog title="查看图片" :visible.sync="imageDialogVisible" size="small">
|
|
|
- <img width="100%" :src="imgSrc" alt="">
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
+ <div>
|
|
|
+ <div class="filters-container">
|
|
|
+ <el-input placeholder="关键字" size="small" v-model="filter1" clearable class="filter-item"></el-input>
|
|
|
+ <el-button
|
|
|
+ @click="searchData"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-search"
|
|
|
+ class="filter-item"
|
|
|
+ >搜索</el-button>
|
|
|
+ <el-button
|
|
|
+ @click="showAdvancedQueryDialog = !showAdvancedQueryDialog"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-search"
|
|
|
+ class="filter-item"
|
|
|
+ >高级查询</el-button>
|
|
|
+ <el-button
|
|
|
+ @click="showTableSortDialog = !showTableSortDialog"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-sort"
|
|
|
+ class="filter-item"
|
|
|
+ >排序</el-button>
|
|
|
+ <el-button
|
|
|
+ @click="$router.push({path:'/fileInfo',query:{column:$route.query.column,type:$route.query.type}})"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ class="filter-item"
|
|
|
+ >添加</el-button>
|
|
|
+ <el-button
|
|
|
+ @click="exportExcel"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-share"
|
|
|
+ class="filter-item"
|
|
|
+ >导出EXCEL</el-button>
|
|
|
+ <el-dropdown trigger="click" size="medium" class="table-column-filter">
|
|
|
+ <span>
|
|
|
+ 筛选数据
|
|
|
+ <i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </span>
|
|
|
+ <el-dropdown-menu slot="dropdown" class="table-column-filter-wrapper">
|
|
|
+ <el-checkbox
|
|
|
+ v-for="item in tableColumns"
|
|
|
+ :key="item.value"
|
|
|
+ v-model="item.show"
|
|
|
+ >{{item.label}}</el-checkbox>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
</div>
|
|
|
+ <el-table :data="tableData" :height="tableHeight" row-key="id" ref="table">
|
|
|
+ <el-table-column v-if="multipleMode" align="center" type="selection" width="50"></el-table-column>
|
|
|
+ <el-table-column type="index" min-width="50" align="center"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column v-if="isColumnShow('url')" prop="url" label="文件地址" min-width="100">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span @click="showFile(row.url)" style="cursor: pointer;">{{row.url}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ v-if="isColumnShow('uploadTime')"
|
|
|
+ prop="uploadTime"
|
|
|
+ label="上传时间"
|
|
|
+ :formatter="DateFormatter"
|
|
|
+ min-width="100"
|
|
|
+ ></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ v-if="isColumnShow('type')"
|
|
|
+ prop="type"
|
|
|
+ label="类型:0:data_video 1:data_app"
|
|
|
+ :formatter="TypeFormatter"
|
|
|
+ min-width="100"
|
|
|
+ ></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column v-if="isColumnShow('fatherId')" prop="fatherId" label="父类id" min-width="100"></el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" min-width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
|
|
|
+ <el-button @click="deleteRow(scope.row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="pagination-wrapper">
|
|
|
+ <div class="multiple-mode-wrapper" v-if="0">
|
|
|
+ <el-button size="small" v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
|
|
|
+ <el-button-group v-else>
|
|
|
+ <el-button size="small" @click="operation1">批量操作1</el-button>
|
|
|
+ <el-button size="small" @click="operation2">批量操作2</el-button>
|
|
|
+ <el-button size="small" @click="toggleMultipleMode(false)">取消</el-button>
|
|
|
+ </el-button-group>
|
|
|
+ </div>
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @size-change="pageSizeChange"
|
|
|
+ @current-change="currentPageChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[10, 20, 30, 40, 50]"
|
|
|
+ :page-size="pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="totalNumber"
|
|
|
+ ></el-pagination>
|
|
|
+ </div>
|
|
|
+ <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
|
|
|
+ <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
+ <el-table :data="advancedQueryFields">
|
|
|
+ <el-table-column prop="link" label="链接符" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select placeholder="链接" size="small" v-model="row.link" class="filter-item">
|
|
|
+ <el-option label="AND" value="AND"></el-option>
|
|
|
+ <el-option label="OR" value="OR"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="字段" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.name">
|
|
|
+ <el-option
|
|
|
+ v-for="item in advancedQueryColumns"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :key="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.searchMethod">
|
|
|
+ <el-option v-for="item in searchMethods" :label="item" :value="item" :key="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="value" label="参数" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.value"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="60" align="center">
|
|
|
+ <template slot-scope="{ row, column, $index }">
|
|
|
+ <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="advancedQuery" :loading="$store.state.fetchingData">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="排序" :visible.sync="showTableSortDialog">
|
|
|
+ <el-button @click="addSortField" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
+ <el-table :data="tableSortFields">
|
|
|
+ <el-table-column prop="name" label="字段" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.name">
|
|
|
+ <el-option
|
|
|
+ v-for="item in advancedQueryColumns"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :key="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="order" label="排序" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.order">
|
|
|
+ <el-option label="降序" value="desc"></el-option>
|
|
|
+ <el-option label="升序" value="asc"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="60" align="center">
|
|
|
+ <template slot-scope="{ row, column, $index }">
|
|
|
+ <el-button @click="removeSortField($index)" size="small" type="text">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="tableSortQuery" :loading="$store.state.fetchingData">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="查看图片" :visible.sync="imageDialogVisible" size="small">
|
|
|
+ <img width="100%" :src="imgSrc" alt>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="播放音频" :visible.sync="audioDialogVisible" size="small">
|
|
|
+ <audio :src="audioSrc" controls="controls" autoplay>您的浏览器不支持 audio 标签。</audio>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {mapState} from 'vuex'
|
|
|
- import {format} from 'date-fns'
|
|
|
- import zh from 'date-fns/locale/zh_cn'
|
|
|
-
|
|
|
- export default {
|
|
|
- created() {
|
|
|
- this.getData();
|
|
|
+import { mapState } from "vuex";
|
|
|
+import { format } from "date-fns";
|
|
|
+import zh from "date-fns/locale/zh_cn";
|
|
|
+
|
|
|
+export default {
|
|
|
+ created() {
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ audioSrc: "",
|
|
|
+ totalNumber: 0,
|
|
|
+ totalPage: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ tableData: [],
|
|
|
+ filter1: "",
|
|
|
+ filter2: "",
|
|
|
+ tableColumns: [
|
|
|
+ {
|
|
|
+ label: "文件地址",
|
|
|
+ value: "url",
|
|
|
+ show: true
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- totalNumber: 0,
|
|
|
- totalPage: 10,
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 20,
|
|
|
- tableData: [],
|
|
|
- filter1: '',
|
|
|
- filter2: '',
|
|
|
- tableColumns: [
|
|
|
- {
|
|
|
- label: '文件地址',
|
|
|
- value: 'url',
|
|
|
- show: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: '上传时间',
|
|
|
- value: 'uploadTime',
|
|
|
- show: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: '类型:0:data_video 1:data_app',
|
|
|
- value: 'type',
|
|
|
- show: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: '父类id',
|
|
|
- value: 'fatherId',
|
|
|
- show: true
|
|
|
- },
|
|
|
- ],
|
|
|
- multipleMode: false,
|
|
|
- showAdvancedQueryDialog: false,
|
|
|
- advancedQueryFields: [],
|
|
|
- showTableSortDialog: false,
|
|
|
- tableSortFields: [],
|
|
|
- searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
|
|
|
- advancedQueryColumns: [
|
|
|
- {
|
|
|
- label: '文件地址',
|
|
|
- value: 'url'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '上传时间',
|
|
|
- value: 'upload_time'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '类型:0:data_video 1:data_app',
|
|
|
- value: 'type'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '父类id',
|
|
|
- value: 'father_id'
|
|
|
- },
|
|
|
- ],
|
|
|
- advancedQuerySearchKey: '',
|
|
|
- orderByStr: '',
|
|
|
- imgSrc: '',
|
|
|
- imageDialogVisible: false,
|
|
|
- }
|
|
|
+ {
|
|
|
+ label: "上传时间",
|
|
|
+ value: "uploadTime",
|
|
|
+ show: true
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(['tableHeight']),
|
|
|
- selection() {
|
|
|
- return this.$refs.table.selection.map(i => i.id);
|
|
|
- }
|
|
|
+ {
|
|
|
+ label: "类型:0:data_video 1:data_app",
|
|
|
+ value: "type",
|
|
|
+ show: true
|
|
|
},
|
|
|
- methods: {
|
|
|
- pageSizeChange(size) {
|
|
|
- this.currentPage = 1;
|
|
|
- this.pageSize = size;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- currentPageChange(page) {
|
|
|
- this.currentPage = page;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- getData() {
|
|
|
-
|
|
|
- var data = {
|
|
|
- currentPage: this.currentPage,
|
|
|
- pageNumber: this.pageSize,
|
|
|
- searchKey: this.filter1,
|
|
|
- advancedQuery: this.advancedQuerySearchKey,
|
|
|
- orderByStr: this.orderByStr,
|
|
|
- }
|
|
|
-
|
|
|
- if (this.$route.query.column) {
|
|
|
- var tempColumn = this.$route.query.column;
|
|
|
- data[tempColumn.split(',')[1]] = tempColumn.split(',')[0];
|
|
|
- }
|
|
|
-
|
|
|
- if (this.$route.query.type >= 0) {
|
|
|
- data.type = Number(this.$route.query.type);
|
|
|
- }
|
|
|
-
|
|
|
- this.$http.get({
|
|
|
- url: '/fileInfo/page',
|
|
|
- data: data
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.totalNumber = res.data.page.totalNumber;
|
|
|
- this.tableData = res.data.pp;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- isColumnShow(column) {
|
|
|
- var row = this.tableColumns.find(i => i.value === column);
|
|
|
- return row ? row.show : false;
|
|
|
- },
|
|
|
- toggleMultipleMode(multipleMode) {
|
|
|
- this.multipleMode = multipleMode;
|
|
|
- if (!multipleMode) {
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- }
|
|
|
- },
|
|
|
- editRow(row) {
|
|
|
- this.$router.push({
|
|
|
- path: '/fileInfo',
|
|
|
- query: {
|
|
|
- id: row.id,
|
|
|
- column: this.$route.query.column,
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- operation1() {
|
|
|
- this.$notify({
|
|
|
- title: '提示',
|
|
|
- message: this.selection
|
|
|
- });
|
|
|
- },
|
|
|
- operation2() {
|
|
|
- this.$message('操作2');
|
|
|
- },
|
|
|
- addField() {
|
|
|
- this.advancedQueryFields.push({
|
|
|
- link: 'AND',
|
|
|
- name: '',
|
|
|
- searchMethod: '=',
|
|
|
- value: '',
|
|
|
- });
|
|
|
- },
|
|
|
- removeField(i) {
|
|
|
- if (this.advancedQueryFields.length > 0) {
|
|
|
- this.advancedQueryFields.splice(i, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- advancedQuery() {
|
|
|
-
|
|
|
- this.advancedQuerySearchKey = '';
|
|
|
-
|
|
|
- if (this.advancedQueryFields.length > 0) {
|
|
|
-
|
|
|
- var templist = [];
|
|
|
-
|
|
|
- this.advancedQueryFields.forEach(item => {
|
|
|
- if (item.link && item.name && item.searchMethod && item.value) {
|
|
|
- var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
|
|
|
- templist.push(tempItem);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- if (templist.length > 0) {
|
|
|
-
|
|
|
- this.advancedQuerySearchKey = templist.join('_;');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.getData();
|
|
|
- this.showAdvancedQueryDialog = false;
|
|
|
- },
|
|
|
- addSortField() {
|
|
|
- this.tableSortFields.push({
|
|
|
- name: '',
|
|
|
- order: 'asc',
|
|
|
- });
|
|
|
- },
|
|
|
- removeSortField(i) {
|
|
|
- if (this.tableSortFields.length > 0) {
|
|
|
- this.tableSortFields.splice(i, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- tableSortQuery() {
|
|
|
-
|
|
|
- this.orderByStr = '';
|
|
|
-
|
|
|
- if (this.tableSortFields.length > 0) {
|
|
|
-
|
|
|
- var templist = [];
|
|
|
-
|
|
|
- this.tableSortFields.forEach(item => {
|
|
|
- if (item.name && item.order) {
|
|
|
- var tempItem = item.name + '_,' + item.order;
|
|
|
- templist.push(tempItem);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- if (templist.length > 0) {
|
|
|
-
|
|
|
- this.orderByStr = templist.join('_;');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.getData();
|
|
|
- this.showTableSortDialog = false;
|
|
|
- },
|
|
|
- exportExcel() {
|
|
|
- window.location.href = this.$baseUrl + "/fileInfo/exportExcel?searchKey="
|
|
|
- + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey + "&orderByStr=" + this.orderByStr;
|
|
|
- },
|
|
|
- searchData() {
|
|
|
- this.currentPage = 1;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- deleteRow(row) {
|
|
|
- this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
|
|
|
- return this.$http.post({
|
|
|
- url: '/fileInfo/del',
|
|
|
- data: {id: row.id}
|
|
|
- })
|
|
|
- }).then(() => {
|
|
|
- this.$message.success('删除成功');
|
|
|
- this.getData();
|
|
|
- }).catch(action => {
|
|
|
- if (action === 'cancel') {
|
|
|
- this.$message.info('删除取消');
|
|
|
- } else {
|
|
|
- this.$message.error('删除失败');
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- DateTimeFormatter(row, column, cellValue) {
|
|
|
- if (cellValue) {
|
|
|
- return format(cellValue, 'YYYY/MM/DD HH:mm', {locale: zh})
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- DateFormatter(row, column, cellValue) {
|
|
|
- if (cellValue) {
|
|
|
- return format(cellValue, 'YYYY/MM/DD', {locale: zh})
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- showImg(img) {
|
|
|
- this.imgSrc = img;
|
|
|
- this.imageDialogVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
+ {
|
|
|
+ label: "父类id",
|
|
|
+ value: "fatherId",
|
|
|
+ show: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ multipleMode: false,
|
|
|
+ showAdvancedQueryDialog: false,
|
|
|
+ advancedQueryFields: [],
|
|
|
+ showTableSortDialog: false,
|
|
|
+ tableSortFields: [],
|
|
|
+ searchMethods: ["=", "!=", ">", ">=", "<", "<=", "like"],
|
|
|
+ advancedQueryColumns: [
|
|
|
+ {
|
|
|
+ label: "文件地址",
|
|
|
+ value: "url"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "上传时间",
|
|
|
+ value: "upload_time"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "类型:0:data_video 1:data_app",
|
|
|
+ value: "type"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "父类id",
|
|
|
+ value: "father_id"
|
|
|
}
|
|
|
+ ],
|
|
|
+ advancedQuerySearchKey: "",
|
|
|
+ orderByStr: "",
|
|
|
+ imgSrc: "",
|
|
|
+ imageDialogVisible: false,
|
|
|
+ audioDialogVisible: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(["tableHeight"]),
|
|
|
+ selection() {
|
|
|
+ return this.$refs.table.selection.map(i => i.id);
|
|
|
}
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ pageSizeChange(size) {
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.pageSize = size;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ currentPageChange(page) {
|
|
|
+ this.currentPage = page;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ var data = {
|
|
|
+ currentPage: this.currentPage,
|
|
|
+ pageNumber: this.pageSize,
|
|
|
+ searchKey: this.filter1,
|
|
|
+ advancedQuery: this.advancedQuerySearchKey,
|
|
|
+ orderByStr: this.orderByStr
|
|
|
+ };
|
|
|
+
|
|
|
+ if (this.$route.query.column) {
|
|
|
+ var tempColumn = this.$route.query.column;
|
|
|
+ data[tempColumn.split(",")[1]] = tempColumn.split(",")[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.$route.query.type >= 0) {
|
|
|
+ data.type = Number(this.$route.query.type);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$http
|
|
|
+ .get({
|
|
|
+ url: "/fileInfo/page",
|
|
|
+ data: data
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.totalNumber = res.data.page.totalNumber;
|
|
|
+ this.tableData = res.data.pp;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ isColumnShow(column) {
|
|
|
+ var row = this.tableColumns.find(i => i.value === column);
|
|
|
+ return row ? row.show : false;
|
|
|
+ },
|
|
|
+ toggleMultipleMode(multipleMode) {
|
|
|
+ this.multipleMode = multipleMode;
|
|
|
+ if (!multipleMode) {
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editRow(row) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/fileInfo",
|
|
|
+ query: {
|
|
|
+ id: row.id,
|
|
|
+ column: this.$route.query.column
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ operation1() {
|
|
|
+ this.$notify({
|
|
|
+ title: "提示",
|
|
|
+ message: this.selection
|
|
|
+ });
|
|
|
+ },
|
|
|
+ operation2() {
|
|
|
+ this.$message("操作2");
|
|
|
+ },
|
|
|
+ addField() {
|
|
|
+ this.advancedQueryFields.push({
|
|
|
+ link: "AND",
|
|
|
+ name: "",
|
|
|
+ searchMethod: "=",
|
|
|
+ value: ""
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeField(i) {
|
|
|
+ if (this.advancedQueryFields.length > 0) {
|
|
|
+ this.advancedQueryFields.splice(i, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ advancedQuery() {
|
|
|
+ this.advancedQuerySearchKey = "";
|
|
|
+
|
|
|
+ if (this.advancedQueryFields.length > 0) {
|
|
|
+ var templist = [];
|
|
|
+
|
|
|
+ this.advancedQueryFields.forEach(item => {
|
|
|
+ if (item.link && item.name && item.searchMethod && item.value) {
|
|
|
+ var tempItem =
|
|
|
+ item.link +
|
|
|
+ "_," +
|
|
|
+ item.name +
|
|
|
+ "_," +
|
|
|
+ item.searchMethod +
|
|
|
+ "_," +
|
|
|
+ item.value;
|
|
|
+ templist.push(tempItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (templist.length > 0) {
|
|
|
+ this.advancedQuerySearchKey = templist.join("_;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getData();
|
|
|
+ this.showAdvancedQueryDialog = false;
|
|
|
+ },
|
|
|
+ addSortField() {
|
|
|
+ this.tableSortFields.push({
|
|
|
+ name: "",
|
|
|
+ order: "asc"
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeSortField(i) {
|
|
|
+ if (this.tableSortFields.length > 0) {
|
|
|
+ this.tableSortFields.splice(i, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tableSortQuery() {
|
|
|
+ this.orderByStr = "";
|
|
|
+
|
|
|
+ if (this.tableSortFields.length > 0) {
|
|
|
+ var templist = [];
|
|
|
+
|
|
|
+ this.tableSortFields.forEach(item => {
|
|
|
+ if (item.name && item.order) {
|
|
|
+ var tempItem = item.name + "_," + item.order;
|
|
|
+ templist.push(tempItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (templist.length > 0) {
|
|
|
+ this.orderByStr = templist.join("_;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getData();
|
|
|
+ this.showTableSortDialog = false;
|
|
|
+ },
|
|
|
+ exportExcel() {
|
|
|
+ window.location.href =
|
|
|
+ this.$baseUrl +
|
|
|
+ "/fileInfo/exportExcel?searchKey=" +
|
|
|
+ this.filter1 +
|
|
|
+ "&advancedQuery=" +
|
|
|
+ this.advancedQuerySearchKey +
|
|
|
+ "&orderByStr=" +
|
|
|
+ this.orderByStr;
|
|
|
+ },
|
|
|
+ searchData() {
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ deleteRow(row) {
|
|
|
+ this.$alert("删除将无法恢复,确认要删除么?", "警告", { type: "error" })
|
|
|
+ .then(() => {
|
|
|
+ return this.$http.post({
|
|
|
+ url: "/fileInfo/del",
|
|
|
+ data: { id: row.id }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ this.getData();
|
|
|
+ })
|
|
|
+ .catch(action => {
|
|
|
+ if (action === "cancel") {
|
|
|
+ this.$message.info("删除取消");
|
|
|
+ } else {
|
|
|
+ this.$message.error("删除失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ DateTimeFormatter(row, column, cellValue) {
|
|
|
+ if (cellValue) {
|
|
|
+ return format(cellValue, "YYYY/MM/DD HH:mm", { locale: zh });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ DateFormatter(row, column, cellValue) {
|
|
|
+ if (cellValue) {
|
|
|
+ return format(cellValue, "YYYY/MM/DD", { locale: zh });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ TypeFormatter(row, column, cellValue) {
|
|
|
+
|
|
|
+ // if (cellValue) {
|
|
|
+
|
|
|
+ var type = "";
|
|
|
+ switch (Number(cellValue)) {
|
|
|
+ case 0:
|
|
|
+ type = "data_video";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ type = "data_app";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return type;
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ showImg(img) {
|
|
|
+ this.imgSrc = img;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.imageDialogVisible = true;
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ showFile(url) {
|
|
|
+ var data = url.split(".");
|
|
|
+ if (data[data.length - 1] == "mp3") {
|
|
|
+ this.audioSrc = url;
|
|
|
+ this.audioDialogVisible = true;
|
|
|
+ } else {
|
|
|
+ this.showImg(url);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
-
|
|
|
</style>
|