|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="pa-3 white">
|
|
|
- <m-search class="mb-3" :items="searchItems" v-model="searchValue" @search="onSearch"></m-search>
|
|
|
+ <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
|
|
|
<m-table
|
|
|
v-loading="loading"
|
|
|
:items="items"
|
|
@@ -10,20 +10,31 @@
|
|
|
:total="total"
|
|
|
@page-change="onPageChange"
|
|
|
>
|
|
|
+ <template #status="{ row }">
|
|
|
+ <el-tag size="small" :type="row.status === 1 ? 'success' : 'danger'">{{ row.status === 1 ? '启用' : '停用'}}</el-tag>
|
|
|
+ </template>
|
|
|
<template #card-tools>
|
|
|
<m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
|
|
|
</template>
|
|
|
<template #actions="{ row }">
|
|
|
<m-button type="primary" text @click="onEdit(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>
|
|
|
</template>
|
|
|
</m-table>
|
|
|
+ <PrivateChartEdit ref="privateChartEditRefs" fullscreen></PrivateChartEdit>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import PrivateChartEdit from './privateChartEdit.vue'
|
|
|
export default {
|
|
|
name: 'PrivateChart',
|
|
|
+ components: {
|
|
|
+ PrivateChartEdit
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
searchItems: [
|
|
@@ -41,10 +52,28 @@ export default {
|
|
|
},
|
|
|
headers: [
|
|
|
{ label: '名称', prop: 'name' },
|
|
|
+ { label: '制作者', prop: 'author' },
|
|
|
+ { label: '制作时间', prop: 'createDate' },
|
|
|
+ { label: '状态', prop: 'status' },
|
|
|
{ label: '描述', prop: 'desc' },
|
|
|
- { label: '操作', prop: 'actions', fixed: 'right', width: 300 }
|
|
|
+ { label: '操作', prop: 'actions' }
|
|
|
+ ],
|
|
|
+ items: [
|
|
|
+ {
|
|
|
+ name: '图表1',
|
|
|
+ author: '张三',
|
|
|
+ createDate: '2021-01-01',
|
|
|
+ status: 1,
|
|
|
+ desc: '这是一个图表'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '图表2',
|
|
|
+ author: '李四',
|
|
|
+ createDate: '2021-01-02',
|
|
|
+ status: 0,
|
|
|
+ desc: '这是另一个图表'
|
|
|
+ }
|
|
|
],
|
|
|
- items: [],
|
|
|
total: 0,
|
|
|
pageInfo: {
|
|
|
current: 1,
|
|
@@ -61,30 +90,33 @@ export default {
|
|
|
// this.items = data.list || []
|
|
|
// this.total = data.total || 0
|
|
|
} catch (error) {
|
|
|
- this.message.error(error.message || '请求失败')
|
|
|
+ this.$message.error(error)
|
|
|
} finally {
|
|
|
this.loading = false
|
|
|
}
|
|
|
},
|
|
|
onAdd () {
|
|
|
- this.refs.templateRefs.open()
|
|
|
+ this.$refs.privateChartEditRefs.open()
|
|
|
},
|
|
|
onEdit (item) {
|
|
|
- this.refs.templateRefs.open(item)
|
|
|
+ this.$refs.privateChartEditRefs.open(item)
|
|
|
},
|
|
|
onDelete (row) {
|
|
|
- this.confirm('确定删除吗?', '提示')
|
|
|
+ this.$confirm('确定删除吗?', '提示')
|
|
|
.then(async () => {
|
|
|
try {
|
|
|
// await ApiName({ id: row.id })
|
|
|
- this.message.success('删除成功')
|
|
|
+ this.$message.success('删除成功')
|
|
|
this.onInit()
|
|
|
} catch (error) {
|
|
|
- this.message.error(error.message || '删除失败')
|
|
|
+ this.$message.error(error)
|
|
|
}
|
|
|
})
|
|
|
.catch(_ => {})
|
|
|
},
|
|
|
+ onStatus (item) {
|
|
|
+ item.status = item.status === 1 ? 0 : 1
|
|
|
+ },
|
|
|
onSearch () {
|
|
|
this.pageInfo.current = 1
|
|
|
this.onInit()
|