|
@@ -4,21 +4,18 @@
|
|
|
<el-col :span="24" class="linksData">
|
|
|
<el-table :data="tableData" style="width: 100%" border>
|
|
|
<el-table-column label="序号" type="index" width="50" align="left"> </el-table-column>
|
|
|
- <el-table-column prop="title" label="名称" width="80" align="left"> </el-table-column>
|
|
|
- <el-table-column prop="url" label="相关链接" width="180" align="left"> </el-table-column>
|
|
|
+ <el-table-column prop="name" label="名称" width="215" align="left"> </el-table-column>
|
|
|
+ <el-table-column prop="url" label="相关链接" width="215" align="left"> </el-table-column>
|
|
|
<el-table-column prop="pic" label="图片地址" width="365" align="left"> </el-table-column>
|
|
|
- <el-table-column prop="state" label="目前状态" width="80" align="left"> </el-table-column>
|
|
|
- <el-table-column label="状态操作" width="90" align="left">
|
|
|
- <template slot-scope="">
|
|
|
- <el-link :underline="false">开启</el-link>
|
|
|
- <el-link :underline="false">关闭</el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column label="操作" width="200" align="left">
|
|
|
<template slot-scope="scoped">
|
|
|
- <el-button size="mini" type="primary" icon="el-icon-view" @click="openDialog(scoped.$index)"></el-button>
|
|
|
- <el-button size="mini" type="primary" icon="el-icon-edit" @click="addData(scoped.$index)"></el-button>
|
|
|
- <el-button size="mini" type="danger" icon="el-icon-delete" @click.native.prevent="deleteRow(scoped.$index, tableData)"></el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="$router.push({ path: '/links/detail', query: { id: scoped.row.id } })"
|
|
|
+ ></el-button>
|
|
|
+ <el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scoped.row)"></el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -28,18 +25,12 @@
|
|
|
@current-change="handleCurrentChange"
|
|
|
:current-page="currentPage"
|
|
|
layout="total, prev, pager, next, jumper"
|
|
|
- :total="1"
|
|
|
+ :total="total"
|
|
|
>
|
|
|
</el-pagination>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-dialog title="详细信息" :visible.sync="dialog">
|
|
|
- <p class="text">名称:{{ info.title }}</p>
|
|
|
- <p class="text">相关链接:{{ info.url }}</p>
|
|
|
- <p class="text">图片地址:{{ info.pic }}</p>
|
|
|
- <p class="text">状态:{{ info.state }}</p>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -48,13 +39,11 @@ export default {
|
|
|
name: 'linksData',
|
|
|
props: {
|
|
|
tableData: null,
|
|
|
+ total: null,
|
|
|
},
|
|
|
components: {},
|
|
|
data: () => ({
|
|
|
currentPage: 1,
|
|
|
- dialog: false,
|
|
|
- info: {},
|
|
|
- pic: require('@/assets/logo.png'),
|
|
|
}),
|
|
|
created() {},
|
|
|
computed: {},
|
|
@@ -65,24 +54,8 @@ export default {
|
|
|
handleCurrentChange(val) {
|
|
|
console.log(`当前页: ${val}`);
|
|
|
},
|
|
|
- addData(index) {
|
|
|
- if (index !== undefined) {
|
|
|
- let data = this.tableData[index];
|
|
|
- } else {
|
|
|
- this.form = {};
|
|
|
- }
|
|
|
- this.$router.push({ path: './detail' });
|
|
|
- },
|
|
|
- deleteRow(index, rows) {
|
|
|
- rows.splice(index, 1);
|
|
|
- },
|
|
|
- openDialog(index) {
|
|
|
- if (index !== undefined) {
|
|
|
- let data = JSON.parse(JSON.stringify(this.tableData[index]));
|
|
|
- data[`index`] = index;
|
|
|
- this.$set(this, `info`, data);
|
|
|
- }
|
|
|
- this.dialog = true;
|
|
|
+ handleDelete(item) {
|
|
|
+ this.$emit('delete', item);
|
|
|
},
|
|
|
},
|
|
|
};
|