Commit f2707f70 by yuwei

项目初始化

parent 5eeb1819
import request from '@/utils/request' import request from '@/utils/request'
// 刷新参数缓存
export function refreshMetadata () {
return request({
url: '/data/metadata/sources/refresh',
method: 'get'
})
}
export function listDataSource (data) { export function listDataSource (data) {
return request({ return request({
url: '/data/metadata/sources/list', url: '/data/metadata/sources/list',
......
<template> <template>
<div> <div>
<el-card class="box-card" shadow="always"> <el-card class="box-card" shadow="always">
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="数据源名称" prop="sourceName"> <el-form-item label="数据源名称" prop="sourceName">
<el-input <el-input
v-model="queryParams.sourceName" v-model="queryParams.sourceName"
...@@ -47,6 +47,12 @@ ...@@ -47,6 +47,12 @@
:disabled="multiple" :disabled="multiple"
@click="handleBatchDelete" @click="handleBatchDelete"
>删除</el-button> >删除</el-button>
<el-button
type="warning"
icon="el-icon-refresh"
size="mini"
@click="handleCacheRefresh"
>刷新缓存</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -91,12 +97,12 @@ ...@@ -91,12 +97,12 @@
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="dataSourceList" :data="dataSourceList"
@selection-change="handleSelectionChange"
border border
tooltip-effect="dark" tooltip-effect="dark"
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -107,9 +113,9 @@ ...@@ -107,9 +113,9 @@
<template v-for="(item, index) in tableColumns"> <template v-for="(item, index) in tableColumns">
<el-table-column <el-table-column
v-if="item.show" v-if="item.show"
:key="index"
:prop="item.prop" :prop="item.prop"
:label="item.label" :label="item.label"
:key="index"
:formatter="item.formatter" :formatter="item.formatter"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
...@@ -119,7 +125,8 @@ ...@@ -119,7 +125,8 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
placement="left" placement="left"
trigger="click"> trigger="click"
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -147,22 +154,22 @@ ...@@ -147,22 +154,22 @@
<el-pagination <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="queryParams.pageNum" :current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize" :page-size.sync="queryParams.pageSize"
:total="total" :total="total"
></el-pagination> @size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import { pageDataSource, delDataSource, delDataSources } from '@/api/metadata/datasource' import { pageDataSource, delDataSource, delDataSources, refreshMetadata } from '@/api/metadata/datasource'
export default { export default {
name: 'DataSourceList', name: 'DataSourceList',
data () { data() {
return { return {
tableHeight: document.body.offsetHeight - 340 + 'px', tableHeight: document.body.offsetHeight - 340 + 'px',
// 展示切换 // 展示切换
...@@ -209,7 +216,7 @@ export default { ...@@ -209,7 +216,7 @@ export default {
} }
} }
}, },
created () { created() {
this.getDicts('sys_common_status').then(response => { this.getDicts('sys_common_status').then(response => {
if (response.success) { if (response.success) {
this.statusOptions = response.data this.statusOptions = response.data
...@@ -217,12 +224,12 @@ export default { ...@@ -217,12 +224,12 @@ export default {
}) })
this.getList() this.getList()
}, },
mounted () { mounted() {
this.initCols() this.initCols()
}, },
methods: { methods: {
/** 查询数据源列表 */ /** 查询数据源列表 */
getList () { getList() {
this.loading = true this.loading = true
pageDataSource(this.queryParams).then(response => { pageDataSource(this.queryParams).then(response => {
this.loading = false this.loading = false
...@@ -233,10 +240,10 @@ export default { ...@@ -233,10 +240,10 @@ export default {
} }
}) })
}, },
initCols () { initCols() {
this.checkedTableColumns = this.tableColumns.map(col => col.prop) this.checkedTableColumns = this.tableColumns.map(col => col.prop)
}, },
handleCheckedColsChange (val) { handleCheckedColsChange(val) {
this.tableColumns.forEach(col => { this.tableColumns.forEach(col => {
if (!this.checkedTableColumns.includes(col.prop)) { if (!this.checkedTableColumns.includes(col.prop)) {
col.show = false col.show = false
...@@ -245,31 +252,31 @@ export default { ...@@ -245,31 +252,31 @@ export default {
} }
}) })
}, },
handleCommand (command) { handleCommand(command) {
this.tableSize = command this.tableSize = command
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.getList() this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery() {
this.$refs['queryForm'].resetFields() this.$refs['queryForm'].resetFields()
this.handleQuery() this.handleQuery()
}, },
/** 刷新列表 */ /** 刷新列表 */
handleRefresh () { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange (selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = true this.showOptions.showAdd = true
...@@ -278,7 +285,7 @@ export default { ...@@ -278,7 +285,7 @@ export default {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit (row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id || this.ids[0]
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
...@@ -287,7 +294,7 @@ export default { ...@@ -287,7 +294,7 @@ export default {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail (row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id || this.ids[0]
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
...@@ -295,8 +302,18 @@ export default { ...@@ -295,8 +302,18 @@ export default {
this.showOptions.showDetail = true this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 刷新缓存 */
handleCacheRefresh() {
refreshMetadata().then(response => {
if (response.success) {
this.$message.success('刷新缓存成功')
} else {
this.$message.error('刷新缓存失败')
}
})
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete(row) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', { this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -309,7 +326,7 @@ export default { ...@@ -309,7 +326,7 @@ export default {
}) })
}, },
/** 批量删除按钮操作 */ /** 批量删除按钮操作 */
handleBatchDelete () { handleBatchDelete() {
if (!this.ids.length) { if (!this.ids.length) {
this.$message({ this.$message({
message: '请先选择需要操作的数据', message: '请先选择需要操作的数据',
...@@ -318,23 +335,23 @@ export default { ...@@ -318,23 +335,23 @@ export default {
} }
this.$message.warning('不支持批量删除') this.$message.warning('不支持批量删除')
}, },
handleSizeChange (val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.queryParams.pageSize = val this.queryParams.pageSize = val
this.getList() this.getList()
}, },
handleCurrentChange (val) { handleCurrentChange(val) {
console.log(`当前页: ${val}`) console.log(`当前页: ${val}`)
this.queryParams.pageNum = val this.queryParams.pageNum = val
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter(row, column, cellValue, index) {
let dictLabel = this.selectDictLabel(this.statusOptions, cellValue) const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') { if (cellValue === '1') {
return <el-tag type="success">{dictLabel}</el-tag> return <el-tag type='success'>{dictLabel}</el-tag>
} else { } else {
return <el-tag type="warning">{dictLabel}</el-tag> return <el-tag type='warning'>{dictLabel}</el-tag>
} }
} }
} }
......
<template> <template>
<div> <div>
<el-card class="box-card" shadow="always"> <el-card class="box-card" shadow="always">
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="参数名称" prop="configName"> <el-form-item label="参数名称" prop="configName">
<el-input <el-input
v-model="queryParams.configName" v-model="queryParams.configName"
...@@ -21,42 +21,42 @@ ...@@ -21,42 +21,42 @@
<el-col :span="12"> <el-col :span="12">
<el-button-group> <el-button-group>
<el-button <el-button
v-hasPerm="['system:config:add']"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPerm="['system:config:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
v-hasPerm="['system:config:edit']"
type="success" type="success"
icon="el-icon-edit-outline" icon="el-icon-edit-outline"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleEdit" @click="handleEdit"
v-hasPerm="['system:config:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
v-hasPerm="['system:config:detail']"
type="info" type="info"
icon="el-icon-view" icon="el-icon-view"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleDetail" @click="handleDetail"
v-hasPerm="['system:config:detail']"
>详情</el-button> >详情</el-button>
<el-button <el-button
v-hasPerm="['system:config:remove']"
type="danger" type="danger"
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleBatchDelete" @click="handleBatchDelete"
v-hasPerm="['system:config:remove']"
>删除</el-button> >删除</el-button>
<el-button <el-button
v-hasPerm="['system:config:refresh']"
type="warning" type="warning"
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
@click="handleConfigRefresh" @click="handleCacheRefresh"
v-hasPerm="['system:config:refresh']"
>刷新缓存</el-button> >刷新缓存</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
...@@ -102,12 +102,12 @@ ...@@ -102,12 +102,12 @@
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="configList" :data="configList"
@selection-change="handleSelectionChange"
border border
tooltip-effect="dark" tooltip-effect="dark"
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -118,9 +118,9 @@ ...@@ -118,9 +118,9 @@
<template v-for="(item, index) in tableColumns"> <template v-for="(item, index) in tableColumns">
<el-table-column <el-table-column
v-if="item.show" v-if="item.show"
:key="index"
:prop="item.prop" :prop="item.prop"
:label="item.label" :label="item.label"
:key="index"
:formatter="item.formatter" :formatter="item.formatter"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
...@@ -130,27 +130,28 @@ ...@@ -130,27 +130,28 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
placement="left" placement="left"
trigger="click"> trigger="click"
>
<el-button <el-button
v-hasPerm="['system:config:edit']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit-outline" icon="el-icon-edit-outline"
@click="handleEdit(scope.row)" @click="handleEdit(scope.row)"
v-hasPerm="['system:config:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
v-hasPerm="['system:config:detail']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handleDetail(scope.row)" @click="handleDetail(scope.row)"
v-hasPerm="['system:config:detail']"
>详情</el-button> >详情</el-button>
<el-button <el-button
v-hasPerm="['system:config:remove']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:config:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button> <el-button slot="reference">操作</el-button>
</el-popover> </el-popover>
...@@ -161,12 +162,12 @@ ...@@ -161,12 +162,12 @@
<el-pagination <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="queryParams.pageNum" :current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize" :page-size.sync="queryParams.pageSize"
:total="total" :total="total"
></el-pagination> @size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card> </el-card>
</div> </div>
</template> </template>
...@@ -176,7 +177,7 @@ import { pageConfig, delConfig, delConfigs, refreshConfig } from '@/api/system/c ...@@ -176,7 +177,7 @@ import { pageConfig, delConfig, delConfigs, refreshConfig } from '@/api/system/c
export default { export default {
name: 'ConfigList', name: 'ConfigList',
data () { data() {
return { return {
tableHeight: document.body.offsetHeight - 340 + 'px', tableHeight: document.body.offsetHeight - 340 + 'px',
// 展示切换 // 展示切换
...@@ -223,15 +224,15 @@ export default { ...@@ -223,15 +224,15 @@ export default {
} }
} }
}, },
created () { created() {
this.getList() this.getList()
}, },
mounted () { mounted() {
this.initCols() this.initCols()
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList () { getList() {
this.loading = true this.loading = true
pageConfig(this.queryParams).then(response => { pageConfig(this.queryParams).then(response => {
this.loading = false this.loading = false
...@@ -242,10 +243,10 @@ export default { ...@@ -242,10 +243,10 @@ export default {
} }
}) })
}, },
initCols () { initCols() {
this.checkedTableColumns = this.tableColumns.map(col => col.prop) this.checkedTableColumns = this.tableColumns.map(col => col.prop)
}, },
handleCheckedColsChange (val) { handleCheckedColsChange(val) {
this.tableColumns.forEach(col => { this.tableColumns.forEach(col => {
if (!this.checkedTableColumns.includes(col.prop)) { if (!this.checkedTableColumns.includes(col.prop)) {
col.show = false col.show = false
...@@ -254,31 +255,31 @@ export default { ...@@ -254,31 +255,31 @@ export default {
} }
}) })
}, },
handleCommand (command) { handleCommand(command) {
this.tableSize = command this.tableSize = command
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.getList() this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery() {
this.$refs['queryForm'].resetFields() this.$refs['queryForm'].resetFields()
this.handleQuery() this.handleQuery()
}, },
/** 刷新列表 */ /** 刷新列表 */
handleRefresh () { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange (selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = true this.showOptions.showAdd = true
...@@ -287,7 +288,7 @@ export default { ...@@ -287,7 +288,7 @@ export default {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit (row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id || this.ids[0]
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
...@@ -296,7 +297,7 @@ export default { ...@@ -296,7 +297,7 @@ export default {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail (row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id || this.ids[0]
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
...@@ -305,7 +306,7 @@ export default { ...@@ -305,7 +306,7 @@ export default {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete(row) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', { this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -318,7 +319,7 @@ export default { ...@@ -318,7 +319,7 @@ export default {
}) })
}, },
/** 批量删除按钮操作 */ /** 批量删除按钮操作 */
handleBatchDelete () { handleBatchDelete() {
if (!this.ids.length) { if (!this.ids.length) {
this.$message({ this.$message({
message: '请先选择需要操作的数据', message: '请先选择需要操作的数据',
...@@ -328,7 +329,7 @@ export default { ...@@ -328,7 +329,7 @@ export default {
this.$message.warning('不支持批量删除') this.$message.warning('不支持批量删除')
}, },
/** 刷新缓存 */ /** 刷新缓存 */
handleConfigRefresh () { handleCacheRefresh() {
refreshConfig().then(response => { refreshConfig().then(response => {
if (response.success) { if (response.success) {
this.$message.success('刷新缓存成功') this.$message.success('刷新缓存成功')
...@@ -337,23 +338,23 @@ export default { ...@@ -337,23 +338,23 @@ export default {
} }
}) })
}, },
handleSizeChange (val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.queryParams.pageSize = val this.queryParams.pageSize = val
this.getList() this.getList()
}, },
handleCurrentChange (val) { handleCurrentChange(val) {
console.log(`当前页: ${val}`) console.log(`当前页: ${val}`)
this.queryParams.pageNum = val this.queryParams.pageNum = val
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter(row, column, cellValue, index) {
let dictText = row.status_dictText const dictText = row.status_dictText
if (cellValue === '1') { if (cellValue === '1') {
return <el-tag type="success">{dictText}</el-tag> return <el-tag type='success'>{dictText}</el-tag>
} else { } else {
return <el-tag type="warning">{dictText}</el-tag> return <el-tag type='warning'>{dictText}</el-tag>
} }
} }
} }
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
type="warning" type="warning"
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
@click="handleDictRefresh" @click="handleCacheRefresh"
v-hasPerm="['system:dict:refresh']" v-hasPerm="['system:dict:refresh']"
>刷新缓存</el-button> >刷新缓存</el-button>
</el-button-group> </el-button-group>
...@@ -348,7 +348,7 @@ export default { ...@@ -348,7 +348,7 @@ export default {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 刷新缓存 */ /** 刷新缓存 */
handleDictRefresh () { handleCacheRefresh () {
refreshDict().then(response => { refreshDict().then(response => {
if (response.success) { if (response.success) {
this.$message.success('刷新缓存成功') this.$message.success('刷新缓存成功')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment