123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <template>
- <div class="subPage">
- <div class="system-table-search">
- <div class="flex-h">
- <div class="flex-item flex-h">
- <el-button size="mini" type="success" @click='addChannel'>新增渠道</el-button>
- </div>
- <ul>
- <li>
- <!-- <span>选择案场:</span> -->
- <el-select v-model="CaseId" placeholder="请选择">
- <el-option
- v-for="item in cases"
- :key="item.CaseId"
- :label="item.CaseName"
- :value="item.CaseId">
- </el-option>
- </el-select>
- </li>
- </ul>
- <el-button
- size="mini"
- type="primary" @click="search">搜索</el-button>
- </div>
- <div class="moreFilter"></div>
- </div>
- <div class="system-table-box">
- <el-table
- :data="currentList"
- stripe
- style="width: 100%">
- <el-table-column
- prop="CaseName"
- label="案场">
- </el-table-column>
- <el-table-column
- prop="ChannelName"
- label="渠道名称">
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="warning"
- @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
- <el-button
- size="mini"
- type="danger"
- @click="handleDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page.sync="postData.page"
- :page-size="postData.pagesize"
- layout="prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </template>
-
- <script>
- import { mapState } from 'vuex'
-
- export default {
- name: '',
- data () {
- return {
- total: 0,
- postData: { // 表格搜索条件
- caseid: '', // 案场id
- page: 1, // 当前页码
- pagesize: 10, // 请求数据量
- },
- currentList: []
- }
- },
- mounted () {
- this.$nextTick(function () {
- this.getList()
- })
- },
- computed: {
- ...mapState({
- cases: x => x.app.cases.list,
- defaultCaseId: x => x.app.cases.default
- }),
- CaseId: {
- get () {
- return this.postData.caseid || this.defaultCaseId
- },
- set (val) {
- this.postData.caseid = val
- }
- }
- },
- methods: {
- search () { // 搜索
- this.postData.page = 1
- this.currentList = []
- this.getList()
- },
- getList () { // 获取列表
- this.$ajax(this.$api.channelManager.getChannelList.url, {
- method: this.$api.channelManager.getChannelList.method,
- queryData: { ...this.postData, caseid: this.CaseId }
- }).then(res => {
- this.currentList = res.list
- this.postData.page = res.page
- this.total = res.pagenum
- })
- },
- handleCurrentChange (val) { // 跳转到分页
- this.getList()
- },
- handleEdit (index, row) { // 编辑
- this.$router.push({ name: 'editChannel', query: { id: row.ChannelId } })
- },
- handleDelete (index, row) { // 删除
- let name = '确认删除渠道“' + row.ChannelName + '”?'
- this.$confirm(name, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$ajax(this.$api.channelManager.deleteChannel.url, {
- method: this.$api.channelManager.deleteChannel.method,
- urlData: { channelId: row.ChannelId }
- }).then(res => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- })
- this.search()
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- },
- addChannel () {
- this.$router.push({ name: 'addChannel' })
- }
- }
- }
- </script>
-
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style lang="scss" scoped>
- @import "page.scss";
- </style>
|