<template>
|
<TableLayout :permissions="['business:activity:query']">
|
<!-- 搜索表单 -->
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="标题" prop="name">
|
<el-input v-model="searchForm.name" placeholder="请输入标题" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<el-form-item label="发布人" prop="realName">
|
<el-input v-model="searchForm.realName" placeholder="请输入发布人" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<el-form-item label="所属分类" prop="labelId">
|
<el-select
|
v-model="searchForm.labelId"
|
placeholder="请选择所属分类"
|
style="width: 150px"
|
clearable
|
@change="search"
|
>
|
<el-option
|
v-for="item in labels"
|
:key="item.id"
|
:value="item.id"
|
:label="item.name"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="所属品牌" prop="brandId">
|
<el-select
|
v-model="searchForm.brandId"
|
style="width: 150px"
|
placeholder="请选择所属品牌"
|
clearable
|
@change="search"
|
>
|
<el-option
|
v-for="item in brands"
|
:key="item.id"
|
:value="item.id"
|
:label="item.name"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<!-- 表格和分页 -->
|
<template v-slot:table-wrap>
|
<ul class="toolbar" v-permissions="['business:activity:create', 'business:activity:delete']">
|
<li><el-button type="primary" @click="$refs.operaInformationWindow.open('新建')" icon="el-icon-plus" v-permissions="['business:activity:create']">新建</el-button></li>
|
<li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:activity:delete']">删除</el-button></li>
|
</ul>
|
<el-table
|
v-loading="isWorking.search"
|
:data="tableData.list"
|
stripe
|
border
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="selection" width="55" ></el-table-column>
|
<el-table-column prop="imgurlfull" label="主图" align="center" min-width="100px">
|
<template slot-scope="{row}">
|
<el-image style="width: 50px;height: 50px;" v-if="row.imgurl && row.imgurl!=''" :src="row.imgurlfull" :preview-src-list="[row.imgurlfull]"></el-image>
|
</template>
|
</el-table-column>
|
<el-table-column prop="name" label="标题" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="lablesName" label="所属分类" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="brandName" label="所属品牌" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="content" label="数据值" min-width="100px">
|
<template slot-scope="{row}">
|
<div v-if="row.content">
|
<el-button v-if="row.contentType == 1" title="点击跳转外链查看" type="text" @click="openUrl(row)" >点击跳转</el-button>
|
<el-button v-else title="点击查看详情" type="text" @click="showCode(row)" >点击查看</el-button>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="looknum" label="浏览量" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="zanCount" label="点赞数" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="collectCount" label="收藏数" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="realName" label="发布人" align="center" min-width="140px"></el-table-column>
|
<el-table-column prop="editDate" label="发布时间" align="center" min-width="140px"></el-table-column>
|
<el-table-column prop="status" label="状态" min-width="80px" align="center">
|
<template slot-scope="{row}">
|
<el-switch
|
v-model="row.status"
|
:active-value="1"
|
:inactive-value="0"
|
active-color="#13ce66"
|
fixed="right"
|
inactive-color="#ff4949"
|
@change="statusChange(row)"
|
></el-switch>
|
</template>
|
</el-table-column>
|
<el-table-column
|
v-if="containPermissions(['business:activity:update', 'business:activity:delete'])"
|
label="操作"
|
min-width="120"
|
fixed="right"
|
>
|
<template slot-scope="{row}">
|
<el-button type="text" @click="$refs.operaInformationWindow.open('编辑', row)" icon="el-icon-edit" v-permissions="['business:activity:update']">编辑</el-button>
|
<el-button type="text" style="color: red;" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:activity:delete']">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
>
|
</pagination>
|
</template>
|
<!-- 新建/修改 -->
|
<OperaInformationWindow ref="operaInformationWindow" @success="handlePageChange"/>
|
<el-dialog
|
class="center-title"
|
:title="'内容详情【'+curTitle+'】'"
|
width="70%"
|
height="70%"
|
text="字典值"
|
:visible.sync="visible1"
|
append-to-body
|
>
|
<div class="agree-list" v-html="agreement">
|
</div>
|
<template v-slot:footer>
|
<el-button @click="visible1=false">返回</el-button>
|
</template>
|
</el-dialog>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import OperaInformationWindow from '@/components/business/OperaInformationWindow'
|
import { findAll as labelList } from '@/api/business/labels'
|
export default {
|
name: 'Information',
|
extends: BaseTable,
|
components: { TableLayout, Pagination, OperaInformationWindow },
|
data () {
|
return {
|
// 搜索
|
searchForm: {
|
name: '',
|
realName: '',
|
brandId: null,
|
labelId: null,
|
contentType: '',
|
type: 3 // 类型0商家活动 1平台活动 2探店 3资讯
|
},
|
agreement: null,
|
curTitle:'',
|
visible1: false,
|
labels: [],
|
brands: []
|
}
|
},
|
provide () {
|
return {
|
labels: () => this.labels,
|
brands: () => this.brands
|
}
|
},
|
created: function () {
|
this.config({
|
module: '资讯信息表',
|
api: '/business/activity',
|
'field.id': 'id',
|
'field.main': 'id'
|
})
|
this.search()
|
labelList({
|
type: 0 // 商品分类
|
}).then(res => {
|
this.labels = res
|
})
|
labelList({
|
type: 1 // 商品品牌
|
})
|
.then(res => {
|
this.brands = res
|
})
|
},
|
methods: {
|
showCode(row){
|
this.curTitle =row.name
|
this.agreement=row.content
|
this.visible1=true
|
},
|
openUrl(row){
|
window.open(row.content)
|
},
|
statusChange (row) {
|
this.api.updateStatusById({ id: row.id, status: row.status })
|
.then(() => {
|
this.$message.success('操作成功')
|
})
|
.catch(e => {
|
this.$message.error('操作成功')
|
})
|
.then(() => {
|
this.handlePageChange()
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.agree-list{
|
height: 550px;
|
//max-height: 50%;
|
overflow: auto;
|
}
|
.no-scroll {
|
overflow: hidden !important;
|
}
|
/deep/ .window__body {
|
.table-content {
|
padding: 0;
|
.table-wrap {
|
padding-top: 0;
|
}
|
}
|
|
}
|
</style>
|