Commit f2707f70 by yuwei

项目初始化

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