|
@@ -0,0 +1,167 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div class="filter-container">
|
|
|
+ <el-input v-model="listQuery.channel_name" placeholder="城市名" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
|
|
|
+ <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
|
|
|
+ 搜索
|
|
|
+ </el-button>
|
|
|
+ <router-link :to="{ path: '/setting/create' }">
|
|
|
+ <el-button v-waves class="filter-item" type="primary" icon="el-icon-edit">
|
|
|
+ 新建
|
|
|
+ </el-button>
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+ <el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
|
|
|
+ <el-table-column align="center" label="ID" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.id }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column width="180px" align="center" label="日期">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.create_time }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="siteId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.site_id }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column class-name="status-col" label="uniqueKey">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.unique_key }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="频道id">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.channel_id }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column min-width="300px" label="频道名字">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.channel_name }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column min-width="200px" label="频道授权码">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.channel_auth_code }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <router-link :to="'/setting/edit/'+scope.row.id">
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-edit">
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
+ </router-link>
|
|
|
+ <!--<el-button type="danger" size="mini" icon="el-icon-s-check" style="margin-left: 10px;" :disabled="scope.row.status == '1' ? false : true" @click="handleDelete(scope)">
|
|
|
+ {{ scope.row.status == '1' ? "隐藏 " : "已隐藏" }}
|
|
|
+ </el-button>-->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { fetchList } from '@/api/setting'
|
|
|
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
|
|
+import waves from '@/directive/waves'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'ArticleList',
|
|
|
+ components: { Pagination },
|
|
|
+ directives: { waves },
|
|
|
+ filters: {
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: null,
|
|
|
+ total: 0,
|
|
|
+ listLoading: true,
|
|
|
+ listQuery: {
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ temp: {
|
|
|
+ id: undefined,
|
|
|
+ mark: ''
|
|
|
+ },
|
|
|
+ dialogFormVisible: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList() {
|
|
|
+ this.listLoading = true
|
|
|
+ fetchList(this.listQuery).then(response => {
|
|
|
+ this.list = response.data.list
|
|
|
+ this.total = response.data.count
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleFilter() {
|
|
|
+ this.listLoading = true
|
|
|
+ fetchList(this.listQuery).then(response => {
|
|
|
+ this.list = response.data.list
|
|
|
+ this.total = response.data.count
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelete({ $index, row }) {
|
|
|
+ // this.temp = Object.assign({}, row) // copy obj
|
|
|
+ // this.dialogFormVisible = true
|
|
|
+ const type = row.status === 1 ? '隐藏' : '开启'
|
|
|
+ this.$confirm('您确定要隐藏吗', '警告', {
|
|
|
+ confirmButtonText: '是的',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(async() => {
|
|
|
+ await deleteHome(row.id)
|
|
|
+ const rs = await fetchHome(row.id)
|
|
|
+ this.list.splice($index, 1, rs.data.info)
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: type + '成功'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async updateData() {
|
|
|
+ const tempData = Object.assign({}, this.temp)
|
|
|
+ const index = this.list.findIndex(v => v.id === this.temp.id)
|
|
|
+ await updateHome(tempData)
|
|
|
+ const rs = await fetchHome(tempData.id)
|
|
|
+ this.list.splice(index, 1, rs.data.info)
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '处理成功'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.edit-input {
|
|
|
+ padding-right: 100px;
|
|
|
+}
|
|
|
+.cancel-btn {
|
|
|
+ position: absolute;
|
|
|
+ right: 15px;
|
|
|
+ top: 10px;
|
|
|
+}
|
|
|
+.filter-container{
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
+.filter-item {
|
|
|
+ margin-right: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|