You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
3.5 KiB

<template>
<div>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
<el-button type="primary" size="small" @click="editInfo('add')"></el-button>
</div>
</lx-header>
</div>
</div>
<div>
<xy-table :list="list" :total="total" :isShowPage="false" :table-item="table_item">
<template v-slot:value>
<el-table-column align='left' label="配置值" min-width="600" header-align="center">
<template slot-scope="scope">
<el-table
:data="parseValueData(scope.row.value)"
border
size="mini"
style="width: 100%;"
:show-header="true"
>
<el-table-column prop="name" label="名称" align="center"></el-table-column>
<el-table-column prop="key" label="英文标识" align="center"></el-table-column>
<el-table-column prop="path" label="路径" align="center"></el-table-column>
</el-table>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' fixed="right" label="操作" width="180" header-align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editInfo('editor',scope.row.id)"></el-button>
</template>
</el-table-column>
</template>
</xy-table>
</div>
<add-info ref="addInfo" @refresh="getList()"></add-info>
</div>
</template>
<script>
import addInfo from './components/addInfo.vue';
import {
index,
destroy
} from "@/api/info/configs.js"
export default {
components: {
addInfo
},
data() {
return {
select: {
name: '',
page: 1,
page_size: 10,
},
list: [],
total: 0,
table_item: [{
prop: 'name',
label: '配置名称',
align: 'center',
width: 180
}, {
prop: 'key',
label: '英文标识',
align: 'center',
width: 180,
}, {
prop: 'value',
label: '配置值',
align: 'left',
}]
}
},
created() {
this.getList()
},
methods: {
parseValueData(value) {
if (!value) {
return []
}
try {
const data = JSON.parse(value)
return Array.isArray(data) ? data : []
} catch (e) {
console.error('解析配置值失败:', e)
return []
}
},
async getList() {
const res = await index({
page: this.select.page,
page_size: this.select.page_size,
filter: [{
key: 'key',
op: 'eq',
value: "dataConfig"
}]
})
this.list = res.data
this.total = res.total
},
editInfo(type, id) {
if (id) {
this.$refs.addInfo.id = id
}
this.$refs.addInfo.type = type
this.$refs.addInfo.isShow = true
},
}
}
</script>
<style lang="scss" scoped>
.searchwrap {
display: flex;
align-items: center;
&>div {
display: flex;
align-items: center;
margin-right: 10px;
span {
min-width: 70px;
}
}
}
</style>