|
@@ -10,8 +10,8 @@
|
|
|
:total="total"
|
|
|
@page-change="onPageChange"
|
|
|
>
|
|
|
- <template #status="{ row }">
|
|
|
- <el-tag size="small" :type="row.status === 1 ? 'success' : 'danger'">{{ row.status === 1 ? '启用' : '停用'}}</el-tag>
|
|
|
+ <template #permission="{ row }">
|
|
|
+ <el-tag size="small" :type="row.permission === 1 ? 'success' : 'warning'">{{ row.permission === 1 ? '已发布' : '未发布' }}</el-tag>
|
|
|
</template>
|
|
|
<template #card-tools>
|
|
|
<m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
|
|
@@ -20,8 +20,8 @@
|
|
|
<m-button type="primary" text @click="onEdit(row)">编辑</m-button>
|
|
|
<m-button type="primary" text @click="onConfiguration(row)">配置图表</m-button>
|
|
|
<m-button type="danger" text @click="onDelete(row)">删除</m-button>
|
|
|
- <m-button :type="row.status === 1 ? 'danger' : 'success'" text @click="onStatus(row)">
|
|
|
- {{ row.status === 1 ? '停用' : '启用' }}
|
|
|
+ <m-button :type="row.permission === 1 ? 'danger' : 'success'" text @click="onStatus(row)">
|
|
|
+ {{ row.permission === 1 ? '取消发布' : '发布' }}
|
|
|
</m-button>
|
|
|
</template>
|
|
|
</m-table>
|
|
@@ -35,7 +35,8 @@ import PrivateChartEdit from './privateChartEdit.vue'
|
|
|
import PrivateEdit from './privateEdit.vue'
|
|
|
import {
|
|
|
webSettingList,
|
|
|
- deleteWebSetting
|
|
|
+ deleteWebSetting,
|
|
|
+ saveWebSetting
|
|
|
} from '@/api/system'
|
|
|
export default {
|
|
|
name: 'PrivateChart',
|
|
@@ -48,7 +49,7 @@ export default {
|
|
|
searchItems: [
|
|
|
{
|
|
|
label: '名称',
|
|
|
- prop: 'name',
|
|
|
+ prop: 'searchName',
|
|
|
type: 'input',
|
|
|
options: {
|
|
|
placeholder: '请输入名称'
|
|
@@ -56,14 +57,13 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
searchValues: {
|
|
|
- name: null
|
|
|
+ searchName: null
|
|
|
},
|
|
|
headers: [
|
|
|
{ label: '名称', prop: 'name' },
|
|
|
- { label: '制作者', prop: 'author' },
|
|
|
+ { label: '状态', prop: 'permission', align: 'center' },
|
|
|
+ { label: '描述', prop: 'description' },
|
|
|
{ label: '制作时间', prop: 'createDate' },
|
|
|
- { label: '状态', prop: 'status' },
|
|
|
- { label: '描述', prop: 'desc' },
|
|
|
{ label: '操作', prop: 'actions' }
|
|
|
],
|
|
|
items: [],
|
|
@@ -84,12 +84,17 @@ export default {
|
|
|
...this.pageInfo
|
|
|
},
|
|
|
entity: {
|
|
|
- // ...this.searchValues,
|
|
|
- webSettingCategory: 'shareChart', // 自定义图表
|
|
|
- permission: 0 // 私有
|
|
|
+ webSettingCategory: 'shareChart' // 自定义图表
|
|
|
+ },
|
|
|
+ ...this.searchValues,
|
|
|
+ dataType: 0 // 私有
|
|
|
+ })
|
|
|
+ this.items = data.records.map(e => {
|
|
|
+ return {
|
|
|
+ ...e.entity,
|
|
|
+ ...e.entity.content
|
|
|
}
|
|
|
})
|
|
|
- this.items = data.records
|
|
|
this.total = data.total
|
|
|
} catch (error) {
|
|
|
this.$message.error(error)
|
|
@@ -119,8 +124,18 @@ export default {
|
|
|
})
|
|
|
.catch(_ => {})
|
|
|
},
|
|
|
- onStatus (item) {
|
|
|
- item.status = item.status === 1 ? 0 : 1
|
|
|
+ async onStatus (item) {
|
|
|
+ try {
|
|
|
+ await saveWebSetting({
|
|
|
+ webSettingId: item.webSettingId,
|
|
|
+ permission: item.permission === 1 ? 0 : 1
|
|
|
+
|
|
|
+ })
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.onInit()
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error)
|
|
|
+ }
|
|
|
},
|
|
|
onSearch () {
|
|
|
this.pageInfo.current = 1
|