<template>
|
<a-row :gutter="24">
|
<a-col :md="24">
|
<a-card :style="cardStyle" :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :md="6" :sm="24">
|
<a-form-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入标题查询" v-model="queryParam.title"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="24">
|
<a-form-item label="内容类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select placeholder="请选择内容类型" v-model="queryParam.type" allowClear>
|
<a-select-option value="privacy_policy">隐私政策</a-select-option>
|
<a-select-option value="user_guide">用户指南</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="24">
|
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select placeholder="请选择状态" v-model="queryParam.status" allowClear>
|
<a-select-option :value="0">草稿</a-select-option>
|
<a-select-option :value="1">已发布</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
<a-col :md="6" :sm="24">
|
<a-button type="primary" @click="searchQuery">查询</a-button>
|
<a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
|
</a-col>
|
</span>
|
</a-row>
|
</a-form>
|
</div>
|
<!-- 操作按钮区域 -->
|
<div class="table-operator" style="margin-top: 5px">
|
<a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
|
<a-button type="primary" icon="delete" @click="batchDel">删除</a-button>
|
</div>
|
<!-- table区域-begin -->
|
<div>
|
<a-table
|
ref="table"
|
size="middle"
|
bordered
|
rowKey="id"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
@change="handleTableChange">
|
<span slot="action" slot-scope="text, record">
|
<a @click="handleEdit(record)">编辑</a>
|
<a-divider type="vertical" />
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a>删除</a>
|
</a-popconfirm>
|
</span>
|
<template slot="statusSlot" slot-scope="text">
|
<a-tag :color="text === 1 ? 'green' : 'orange'">
|
{{ text === 1 ? '已发布' : '草稿' }}
|
</a-tag>
|
</template>
|
<template slot="typeSlot" slot-scope="text">
|
{{ text === 'privacy_policy' ? '隐私政策' : '用户指南' }}
|
</template>
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
|
<!-- 表单区域 -->
|
<cloud-content-modal ref="modalForm" @ok="modalFormOk"></cloud-content-modal>
|
</a-card>
|
</a-col>
|
</a-row>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import CloudContentModal from './modules/CloudContentModal'
|
import { deleteAction, getAction } from '@/api/manage'
|
|
export default {
|
name: "CloudContentList",
|
mixins:[JeecgListMixin],
|
components: {
|
CloudContentModal
|
},
|
data () {
|
return {
|
description: '云内容管理页面',
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 },
|
},
|
// 查询条件
|
queryParam: {
|
title: '',
|
type: '',
|
status: undefined
|
},
|
// 表头
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key:'rowIndex',
|
width:60,
|
align:"center",
|
customRender:function (t,r,index) {
|
return parseInt(index)+1;
|
}
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width:120,
|
align:"center",
|
scopedSlots: { customRender: 'action' }
|
},
|
{
|
title: '标题',
|
align:"left",
|
dataIndex: 'title'
|
},
|
{
|
title: '内容类型',
|
align:"center",
|
dataIndex: 'type',
|
scopedSlots: { customRender: 'typeSlot' }
|
},
|
{
|
title: '版本号',
|
align:"center",
|
dataIndex: 'version'
|
},
|
{
|
title: '状态',
|
align:"center",
|
dataIndex: 'status',
|
scopedSlots: { customRender: 'statusSlot' }
|
},
|
{
|
title: '创建时间',
|
align:"center",
|
dataIndex: 'createTime',
|
width: 180
|
}
|
],
|
url: {
|
list: "/cloudContent/list",
|
delete: "/cloudContent/delete",
|
deleteBatch: "/cloudContent/deleteBatch",
|
exportXlsUrl: "/cloudContent/exportXls",
|
importExcelUrl: "/cloudContent/importExcel",
|
},
|
btnEnableList: [],
|
cardStyle: {
|
height: '100%'
|
}
|
}
|
},
|
computed: {
|
importExcelUrl: function(){
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
}
|
},
|
methods: {
|
searchReset() {
|
this.queryParam = {
|
title: '',
|
type: '',
|
status: undefined
|
}
|
this.loadData(1);
|
},
|
handleEdit: function (record) {
|
this.$refs.modalForm.edit(record);
|
this.$refs.modalForm.title = "编辑";
|
this.$refs.modalForm.disableSubmit = false;
|
if(this.btnEnableList.indexOf(1)===-1) {
|
this.$refs.modalForm.isReadOnly = true
|
}
|
},
|
handleAdd: function () {
|
this.$refs.modalForm.add();
|
this.$refs.modalForm.title = "新增";
|
this.$refs.modalForm.disableSubmit = false;
|
},
|
handleDelete(id) {
|
deleteAction(this.url.delete, {id: id}).then((res) => {
|
if (res.success) {
|
this.$message.success(res.message);
|
this.loadData();
|
} else {
|
this.$message.warning(res.message);
|
}
|
});
|
},
|
batchDel() {
|
if (this.selectedRowKeys.length <= 0) {
|
this.$message.warning('请选择一条记录!');
|
return;
|
}
|
let ids = "";
|
this.selectedRowKeys.forEach(function(val) {
|
ids+=val+",";
|
});
|
ids = ids.substring(0,ids.length-1);
|
deleteAction(this.url.deleteBatch, {ids: ids}).then((res) => {
|
if (res.success) {
|
this.$message.success(res.message);
|
this.loadData();
|
this.selectedRowKeys = [];
|
} else {
|
this.$message.warning(res.message);
|
}
|
});
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less'
|
</style>
|