mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-03 22:40:26 +08:00
refactor: code review
This commit is contained in:
@@ -10,11 +10,13 @@
|
|||||||
<el-card>
|
<el-card>
|
||||||
<div class="query" ref="queryRef">
|
<div class="query" ref="queryRef">
|
||||||
<div>
|
<div>
|
||||||
<div v-if="props.query.length > 0" class="query-head">
|
<div v-if="props.query.length > 0">
|
||||||
<div style="display: flex; align-items: center;">
|
<el-form :model="props.queryForm" label-width="auto">
|
||||||
<el-form :model="props.queryForm" label-width="auto" style="display: flex;">
|
<el-row v-for="i in Math.ceil((props.query.length + 1) / (defaultQueryCount + 1))" :key="i"
|
||||||
<el-form-item :label="item.label" style="margin-right: 20px; margin-bottom: 0px;"
|
v-show="i == 1 || isOpenMoreQuery" :class="i > 1 && isOpenMoreQuery ? 'is-open' : ''">
|
||||||
v-for="item in props.query?.slice(0, defaultQueryCount)" :key="item.prop">
|
|
||||||
|
<el-form-item :label="item.label" style="margin-right: 12px; margin-bottom: 0px;"
|
||||||
|
v-for="item in getRowQueryItem(i)" :key="item.prop">
|
||||||
<!-- 这里只获取指定个数的筛选条件 -->
|
<!-- 这里只获取指定个数的筛选条件 -->
|
||||||
<el-input v-model="queryForm[item.prop]" :placeholder="'输入' + item.label + '关键字'"
|
<el-input v-model="queryForm[item.prop]" :placeholder="'输入' + item.label + '关键字'"
|
||||||
clearable v-if="item.type == 'text'"></el-input>
|
clearable v-if="item.type == 'text'"></el-input>
|
||||||
@@ -26,10 +28,7 @@
|
|||||||
format="YYYY-MM-DD hh:mm:ss" value-format="x" range-separator="至"
|
format="YYYY-MM-DD hh:mm:ss" value-format="x" range-separator="至"
|
||||||
start-placeholder="开始时间" end-placeholder="结束时间" v-else-if="item.type == 'date'" />
|
start-placeholder="开始时间" end-placeholder="结束时间" v-else-if="item.type == 'date'" />
|
||||||
|
|
||||||
<slot :name="item.slot"></slot>
|
<template v-else-if="item.slot == 'queryBtns'">
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<template v-if="props.query?.length > defaultQueryCount">
|
<template v-if="props.query?.length > defaultQueryCount">
|
||||||
<el-button @click="isOpenMoreQuery = !isOpenMoreQuery" v-if="!isOpenMoreQuery"
|
<el-button @click="isOpenMoreQuery = !isOpenMoreQuery" v-if="!isOpenMoreQuery"
|
||||||
icon="ArrowDownBold" circle></el-button>
|
icon="ArrowDownBold" circle></el-button>
|
||||||
@@ -37,29 +36,14 @@
|
|||||||
circle></el-button>
|
circle></el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-button @click="queryData()" type="primary" plain>查询</el-button>
|
<el-button @click="queryData()" type="primary" icon="search" plain>查询</el-button>
|
||||||
<el-button @click="reset()">重置</el-button>
|
<el-button @click="reset()" icon="RefreshRight">重置</el-button>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
|
||||||
<!-- 这里做的是一个类似于折叠面板的功能 -->
|
|
||||||
<div class="query-content" :class="isOpenMoreQuery ? 'is-open' : ''">
|
|
||||||
<el-form :model="props.queryForm" label-width="auto" style="display: flex; flex-wrap: wrap;">
|
|
||||||
<el-form-item :label="item.label" style="margin-right: 20px; margin-bottom: 0px;"
|
|
||||||
v-for="item in props.query?.slice(defaultQueryCount)" :key="item.prop">
|
|
||||||
|
|
||||||
<!-- 这里获取除前两个以外所有的筛选条件 -->
|
|
||||||
<el-input v-model="queryForm[item.prop]" :placeholder="'输入' + item.label + '关键字'" clearable
|
|
||||||
v-if="item.type == 'text'"></el-input>
|
|
||||||
|
|
||||||
<el-select-v2 v-model="queryForm[item.prop]" :options="item.options" clearable
|
|
||||||
:placeholder="'选择' + item.label + '关键字'" v-else-if="item.type == 'select'" />
|
|
||||||
|
|
||||||
<el-date-picker v-model="queryForm[item.prop]" clearable type="datetimerange"
|
|
||||||
format="YYYY-MM-DD hh:mm:ss" value-format="x" range-separator="至"
|
|
||||||
start-placeholder="开始时间" end-placeholder="结束时间" v-else-if="item.type == 'date'" />
|
|
||||||
|
|
||||||
<slot :name="item.slot"></slot>
|
<slot :name="item.slot"></slot>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,8 +76,8 @@
|
|||||||
|
|
||||||
<template v-for="(item, index) in columns">
|
<template v-for="(item, index) in columns">
|
||||||
<el-table-column :key="index" v-if="item.show" :prop="item.prop" :label="item.label" :fixed="item.fixed"
|
<el-table-column :key="index" v-if="item.show" :prop="item.prop" :label="item.label" :fixed="item.fixed"
|
||||||
:align="item.align" :show-overflow-tooltip="item.showOverflowTooltip"
|
:align="item.align" :show-overflow-tooltip="item.showOverflowTooltip" :min-width="item.minWidth"
|
||||||
:min-width="item.minWidth" :sortable="item.sortable || false" :type="item.type" :width="item.width">
|
:sortable="item.sortable || false" :type="item.type" :width="item.width">
|
||||||
|
|
||||||
<!-- 插槽:预留功能 -->
|
<!-- 插槽:预留功能 -->
|
||||||
<template #default="scope" v-if="item.slot">
|
<template #default="scope" v-if="item.slot">
|
||||||
@@ -179,7 +163,7 @@ const state = reactive({
|
|||||||
chooseData: null as any,
|
chooseData: null as any,
|
||||||
chooseId: 0 as any,
|
chooseId: 0 as any,
|
||||||
isOpenMoreQuery: false,
|
isOpenMoreQuery: false,
|
||||||
defaultQueryCount: 2, // 默认显示的查询参数个数
|
defaultQueryCount: 2, // 默认显示的查询参数个数,展开后每行显示个数为该值加1。第一行用最后一列来占用按钮
|
||||||
queryForm: {} as any,
|
queryForm: {} as any,
|
||||||
loadingData: false,
|
loadingData: false,
|
||||||
})
|
})
|
||||||
@@ -220,6 +204,18 @@ onMounted(() => {
|
|||||||
state.queryForm = props.queryForm;
|
state.queryForm = props.queryForm;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getRowQueryItem = (row: number) => {
|
||||||
|
// 第一行需要加个查询等按钮列
|
||||||
|
if (row === 1) {
|
||||||
|
const res = props.query.slice(row - 1, defaultQueryCount.value)
|
||||||
|
// 查询等按钮列
|
||||||
|
res.push(TableQuery.slot("", "", "queryBtns"))
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
const columnCount = defaultQueryCount.value + 1;
|
||||||
|
return props.query.slice((row - 1) * columnCount - 1, row * columnCount - 1)
|
||||||
|
}
|
||||||
|
|
||||||
const handleSelectionChange = (val: any) => {
|
const handleSelectionChange = (val: any) => {
|
||||||
emit('update:selectionData', val);
|
emit('update:selectionData', val);
|
||||||
}
|
}
|
||||||
@@ -265,44 +261,19 @@ defineExpose({ loading })
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.query-head {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.query-content {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 0px;
|
|
||||||
transition: all 0.8s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-open {
|
.is-open {
|
||||||
padding: 10px 0;
|
// padding: 10px 0;
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 10px;
|
|
||||||
|
|
||||||
.query-content {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
|
|
||||||
.query-form {
|
|
||||||
.el-form-item {
|
|
||||||
margin: 0px;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.slot {
|
.slot {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding-right: 20px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,9 +130,9 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch, toRefs, reactive, ref } from 'vue';
|
import { watch, toRefs, reactive, ref } from 'vue';
|
||||||
import { TYPE_LIST, CHARACTER_SET_NAME_LIST, COLLATION_SUFFIX_LIST } from './service.ts';
|
import { TYPE_LIST, CHARACTER_SET_NAME_LIST, COLLATION_SUFFIX_LIST } from './service';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import SqlExecBox from './component/SqlExecBox.ts';
|
import SqlExecBox from './component/SqlExecBox';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
visible: {
|
visible: {
|
||||||
@@ -336,7 +336,7 @@ const submit = async () => {
|
|||||||
SqlExecBox({
|
SqlExecBox({
|
||||||
sql: sql,
|
sql: sql,
|
||||||
dbId: props.dbId as any,
|
dbId: props.dbId as any,
|
||||||
db: props.db,
|
db: props.db as any,
|
||||||
runSuccessCallback: () => {
|
runSuccessCallback: () => {
|
||||||
emit('submit-sql', {tableName: state.tableData.tableName });
|
emit('submit-sql', {tableName: state.tableData.tableName });
|
||||||
// cancel();
|
// cancel();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-dialog :title="title" v-model="dialogVisible" :before-close="cancel" :close-on-click-modal="false"
|
<el-dialog :title="title" v-model="dialogVisible" :before-close="cancel" :close-on-click-modal="false"
|
||||||
:destroy-on-close="true" width="38%">
|
:destroy-on-close="true" width="38%">
|
||||||
<el-form :model="form" ref="dbForm" :rules="rules" label-width="95px">
|
<el-form :model="form" ref="dbForm" :rules="rules" label-width="auto">
|
||||||
<el-tabs v-model="tabActiveName">
|
<el-tabs v-model="tabActiveName">
|
||||||
<el-tab-pane label="基础信息" name="basic">
|
<el-tab-pane label="基础信息" name="basic">
|
||||||
<el-form-item prop="tagId" label="标签:" required>
|
<el-form-item prop="tagId" label="标签:" required>
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ const queryConfig = [
|
|||||||
TableQuery.slot("tagPath", "标签", "tagPathSelect"),
|
TableQuery.slot("tagPath", "标签", "tagPathSelect"),
|
||||||
]
|
]
|
||||||
|
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
||||||
TableColumn.new("name", "名称"),
|
TableColumn.new("name", "名称"),
|
||||||
TableColumn.new("host", "host:port").setFormatFunc((data: any, _prop: string) => `${data.host}:${data.port}`),
|
TableColumn.new("host", "host:port").setFormatFunc((data: any, _prop: string) => `${data.host}:${data.port}`),
|
||||||
@@ -300,11 +300,11 @@ const columns = [
|
|||||||
TableColumn.new("username", "用户名"),
|
TableColumn.new("username", "用户名"),
|
||||||
TableColumn.new("remark", "备注"),
|
TableColumn.new("remark", "备注"),
|
||||||
TableColumn.new("more", "更多").isSlot().setMinWidth(165).fixedRight(),
|
TableColumn.new("more", "更多").isSlot().setMinWidth(165).fixedRight(),
|
||||||
]
|
])
|
||||||
|
|
||||||
// 该用户拥有的的操作列按钮权限
|
// 该用户拥有的的操作列按钮权限
|
||||||
const actionBtns = hasPerms([perms.saveDb,])
|
const actionBtns = hasPerms([perms.saveDb,])
|
||||||
const actionColumn = TableColumn.new("action", "操作").isSlot().setMinWidth(65).fixedRight();
|
const actionColumn = TableColumn.new("action", "操作").isSlot().setMinWidth(65).fixedRight()
|
||||||
|
|
||||||
const pageTableRef: any = ref(null)
|
const pageTableRef: any = ref(null)
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ const {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (Object.keys(actionBtns).length > 0) {
|
if (Object.keys(actionBtns).length > 0) {
|
||||||
columns.push(actionColumn);
|
columns.value.push(actionColumn);
|
||||||
}
|
}
|
||||||
search();
|
search();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog v-model="addDataDialog.visible" :title="addDataDialog.title" :destroy-on-close="true" width="600px">
|
<el-dialog v-model="addDataDialog.visible" :title="addDataDialog.title" :destroy-on-close="true" width="600px">
|
||||||
<el-form ref="dataForm" :model="addDataDialog.data" label-width="160px" size="small">
|
<el-form ref="dataForm" :model="addDataDialog.data" label-width="auto" size="small">
|
||||||
<el-form-item v-for="column in columns" class="w100" :prop="column.columnName" :label="column.columnName"
|
<el-form-item v-for="column in columns" class="w100" :prop="column.columnName" :label="column.columnName"
|
||||||
:required="column.nullable != 'YES' && column.columnKey != 'PRI'">
|
:required="column.nullable != 'YES' && column.columnKey != 'PRI'">
|
||||||
<el-input-number v-if="DbInst.isNumber(column.columnType)"
|
<el-input-number v-if="DbInst.isNumber(column.columnType)"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-dialog :title="title" v-model="dialogVisible" :close-on-click-modal="false" :destroy-on-close="true"
|
<el-dialog :title="title" v-model="dialogVisible" :close-on-click-modal="false" :destroy-on-close="true"
|
||||||
:before-close="cancel" width="650px">
|
:before-close="cancel" width="650px">
|
||||||
<el-form :model="form" ref="machineForm" :rules="rules" label-width="85px">
|
<el-form :model="form" ref="machineForm" :rules="rules" label-width="auto">
|
||||||
<el-tabs v-model="tabActiveName">
|
<el-tabs v-model="tabActiveName">
|
||||||
<el-tab-pane label="基础信息" name="basic">
|
<el-tab-pane label="基础信息" name="basic">
|
||||||
<el-form-item prop="tagId" label="标签:">
|
<el-form-item prop="tagId" label="标签:">
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ const queryConfig = [
|
|||||||
TableQuery.text("name", "名称"),
|
TableQuery.text("name", "名称"),
|
||||||
]
|
]
|
||||||
|
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
||||||
TableColumn.new("name", "名称"),
|
TableColumn.new("name", "名称"),
|
||||||
TableColumn.new("ipPort", "ip:port").isSlot().setAddWidth(35),
|
TableColumn.new("ipPort", "ip:port").isSlot().setAddWidth(35),
|
||||||
@@ -187,7 +187,7 @@ const columns = [
|
|||||||
TableColumn.new("status", "状态").isSlot().setMinWidth(85),
|
TableColumn.new("status", "状态").isSlot().setMinWidth(85),
|
||||||
TableColumn.new("remark", "备注"),
|
TableColumn.new("remark", "备注"),
|
||||||
TableColumn.new("action", "操作").isSlot().setMinWidth(238).fixedRight(),
|
TableColumn.new("action", "操作").isSlot().setMinWidth(238).fixedRight(),
|
||||||
]
|
])
|
||||||
// 该用户拥有的的操作列按钮权限,使用v-if进行判断,v-auth对el-dropdown-item无效
|
// 该用户拥有的的操作列按钮权限,使用v-if进行判断,v-auth对el-dropdown-item无效
|
||||||
const actionBtns = hasPerms([perms.updateMachine, perms.closeCli])
|
const actionBtns = hasPerms([perms.updateMachine, perms.closeCli])
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="mock-data-dialog">
|
<div class="mock-data-dialog">
|
||||||
<el-dialog :title="title" v-model="dialogVisible" :close-on-click-modal="false" :before-close="cancel"
|
<el-dialog :title="title" v-model="dialogVisible" :close-on-click-modal="false" :before-close="cancel"
|
||||||
:show-close="true" :destroy-on-close="true" width="900px">
|
:show-close="true" :destroy-on-close="true" width="900px">
|
||||||
<el-form :model="form" ref="scriptForm" label-width="50px" size="small">
|
<el-form :model="form" ref="scriptForm" label-width="auto" size="small">
|
||||||
<el-form-item prop="method" label="名称">
|
<el-form-item prop="method" label="名称">
|
||||||
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog title="脚本参数" v-model="scriptParamsDialog.visible" width="400px">
|
<el-dialog title="脚本参数" v-model="scriptParamsDialog.visible" width="400px">
|
||||||
<el-form ref="paramsForm" :model="scriptParamsDialog.params" label-width="70px" size="small">
|
<el-form ref="paramsForm" :model="scriptParamsDialog.params" label-width="auto" size="small">
|
||||||
<el-form-item v-for="item in scriptParamsDialog.paramsFormItem as any" :key="item.name" :prop="item.model"
|
<el-form-item v-for="item in scriptParamsDialog.paramsFormItem as any" :key="item.name" :prop="item.model"
|
||||||
:label="item.name" required>
|
:label="item.name" required>
|
||||||
<el-input v-if="!item.options" v-model="scriptParamsDialog.params[item.model]"
|
<el-input v-if="!item.options" v-model="scriptParamsDialog.params[item.model]"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="500px"
|
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="500px"
|
||||||
:destroy-on-close="true">
|
:destroy-on-close="true">
|
||||||
<el-form ref="acForm" :rules="rules" :model="form" label-width="90px">
|
<el-form ref="acForm" :rules="rules" :model="form" label-width="auto">
|
||||||
<el-form-item prop="name" label="名称:" required>
|
<el-form-item prop="name" label="名称:" required>
|
||||||
<el-input v-model="form.name"></el-input>
|
<el-input v-model="form.name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-dialog width="600px" title="find参数" v-model="findDialog.visible">
|
<el-dialog width="600px" title="find参数" v-model="findDialog.visible">
|
||||||
<el-form label-width="70px">
|
<el-form label-width="auto">
|
||||||
<el-form-item label="filter">
|
<el-form-item label="filter">
|
||||||
<monaco-editor style="width: 100%;" height="150px" ref="monacoEditorRef"
|
<monaco-editor style="width: 100%;" height="150px" ref="monacoEditorRef"
|
||||||
v-model="findDialog.findParam.filter" language="json" />
|
v-model="findDialog.findParam.filter" language="json" />
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog width="400px" title="新建集合" v-model="createCollectionDialog.visible" :destroy-on-close="true">
|
<el-dialog width="400px" title="新建集合" v-model="createCollectionDialog.visible" :destroy-on-close="true">
|
||||||
<el-form :model="createCollectionDialog.form" label-width="70px">
|
<el-form :model="createCollectionDialog.form" label-width="auto">
|
||||||
<el-form-item prop="name" label="集合名" required>
|
<el-form-item prop="name" label="集合名" required>
|
||||||
<el-input v-model="createCollectionDialog.form.name" clearable></el-input>
|
<el-input v-model="createCollectionDialog.form.name" clearable></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -183,14 +183,14 @@ const pageTableRef: any = ref(null)
|
|||||||
const queryConfig = [
|
const queryConfig = [
|
||||||
TableQuery.slot("tagPath", "标签", "tagPathSelect"),
|
TableQuery.slot("tagPath", "标签", "tagPathSelect"),
|
||||||
]
|
]
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
||||||
TableColumn.new("name", "名称"),
|
TableColumn.new("name", "名称"),
|
||||||
TableColumn.new("uri", "连接uri"),
|
TableColumn.new("uri", "连接uri"),
|
||||||
TableColumn.new("createTime", "创建时间").isTime(),
|
TableColumn.new("createTime", "创建时间").isTime(),
|
||||||
TableColumn.new("creator", "创建人"),
|
TableColumn.new("creator", "创建人"),
|
||||||
TableColumn.new("action", "操作").isSlot().setMinWidth(100).fixedRight(),
|
TableColumn.new("action", "操作").isSlot().setMinWidth(100).fixedRight(),
|
||||||
]
|
])
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
tags: [],
|
tags: [],
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<SvgIcon name="iconfont icon-op-redis" :size="18" />
|
<SvgIcon name="iconfont icon-op-redis" :size="18" />
|
||||||
</template>
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<el-form class="instances-pop-form" label-width="50px" :size="'small'">
|
<el-form class="instances-pop-form" label-width="auto" :size="'small'">
|
||||||
<el-form-item label="名称:">{{ data.params.name }}</el-form-item>
|
<el-form-item label="名称:">{{ data.params.name }}</el-form-item>
|
||||||
<el-form-item label="模式:">{{ data.params.mode }}</el-form-item>
|
<el-form-item label="模式:">{{ data.params.mode }}</el-form-item>
|
||||||
<el-form-item label="链接:">{{ data.params.host }}</el-form-item>
|
<el-form-item label="链接:">{{ data.params.host }}</el-form-item>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<el-col :span="20" style="border-left: 1px solid var(--el-card-border-color);">
|
<el-col :span="20" style="border-left: 1px solid var(--el-card-border-color);">
|
||||||
<div class="mt10 ml5">
|
<div class="mt10 ml5">
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-form class="search-form" label-position="right" :inline="true" label-width="60px">
|
<el-form class="search-form" label-position="right" :inline="true" label-width="auto">
|
||||||
<el-form-item label="key" label-width="40px">
|
<el-form-item label="key" label-width="40px">
|
||||||
<el-input placeholder="match 支持*模糊key" style="width: 250px" v-model="scanParam.match"
|
<el-input placeholder="match 支持*模糊key" style="width: 250px" v-model="scanParam.match"
|
||||||
@clear="clear()" clearable></el-input>
|
@clear="clear()" clearable></el-input>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-form class='key-content-string' label-width="85px">
|
<el-form class='key-content-string' label-width="auto">
|
||||||
<div>
|
<div>
|
||||||
<format-viewer ref="formatViewerRef" :content="string.value"></format-viewer>
|
<format-viewer ref="formatViewerRef" :content="string.value"></format-viewer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-dialog :title="title" v-model="dialogVisible" :before-close="cancel" :close-on-click-modal="false"
|
<el-dialog :title="title" v-model="dialogVisible" :before-close="cancel" :close-on-click-modal="false"
|
||||||
:destroy-on-close="true" width="38%">
|
:destroy-on-close="true" width="38%">
|
||||||
<el-form :model="form" ref="redisForm" :rules="rules" label-width="85px">
|
<el-form :model="form" ref="redisForm" :rules="rules" label-width="auto">
|
||||||
<el-tabs v-model="tabActiveName">
|
<el-tabs v-model="tabActiveName">
|
||||||
<el-tab-pane label="基础信息" name="basic">
|
<el-tab-pane label="基础信息" name="basic">
|
||||||
<el-form-item prop="tagId" label="标签:" required>
|
<el-form-item prop="tagId" label="标签:" required>
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ const pageTableRef: any = ref(null)
|
|||||||
const queryConfig = [
|
const queryConfig = [
|
||||||
TableQuery.slot("tagPath", "标签", "tagPathSelect"),
|
TableQuery.slot("tagPath", "标签", "tagPathSelect"),
|
||||||
]
|
]
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
TableColumn.new("tagPath", "标签路径").isSlot().setAddWidth(20),
|
||||||
TableColumn.new("name", "名称"),
|
TableColumn.new("name", "名称"),
|
||||||
TableColumn.new("host", "host:port"),
|
TableColumn.new("host", "host:port"),
|
||||||
@@ -165,7 +165,7 @@ const columns = [
|
|||||||
TableColumn.new("remark", "备注"),
|
TableColumn.new("remark", "备注"),
|
||||||
TableColumn.new("more", "更多").isSlot().setMinWidth(155).fixedRight(),
|
TableColumn.new("more", "更多").isSlot().setMinWidth(155).fixedRight(),
|
||||||
TableColumn.new("action", "操作").isSlot().setMinWidth(65).fixedRight(),
|
TableColumn.new("action", "操作").isSlot().setMinWidth(65).fixedRight(),
|
||||||
]
|
])
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
tags: [],
|
tags: [],
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<el-dialog width="500px" :title="saveTabDialog.title" :before-close="cancelSaveTag"
|
<el-dialog width="500px" :title="saveTabDialog.title" :before-close="cancelSaveTag"
|
||||||
v-model="saveTabDialog.visible">
|
v-model="saveTabDialog.visible">
|
||||||
<el-form ref="tagForm" :rules="rules" :model="saveTabDialog.form" label-width="70px">
|
<el-form ref="tagForm" :rules="rules" :model="saveTabDialog.form" label-width="auto">
|
||||||
<el-form-item prop="code" label="标识:" required>
|
<el-form-item prop="code" label="标识:" required>
|
||||||
<el-input :disabled="saveTabDialog.form.id ? true : false" v-model="saveTabDialog.form.code"
|
<el-input :disabled="saveTabDialog.form.id ? true : false" v-model="saveTabDialog.form.code"
|
||||||
auto-complete="off"></el-input>
|
auto-complete="off"></el-input>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</page-table>
|
</page-table>
|
||||||
|
|
||||||
<el-dialog width="400px" title="团队编辑" :before-close="cancelSaveTeam" v-model="addTeamDialog.visible">
|
<el-dialog width="400px" title="团队编辑" :before-close="cancelSaveTeam" v-model="addTeamDialog.visible">
|
||||||
<el-form ref="teamForm" :model="addTeamDialog.form" label-width="70px">
|
<el-form ref="teamForm" :model="addTeamDialog.form" label-width="auto">
|
||||||
<el-form-item prop="name" label="团队名:" required>
|
<el-form-item prop="name" label="团队名:" required>
|
||||||
<el-input v-model="addTeamDialog.form.name" auto-complete="off"></el-input>
|
<el-input v-model="addTeamDialog.form.name" auto-complete="off"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
<el-dialog width="500px" :title="showTagDialog.title" :before-close="closeTagDialog"
|
<el-dialog width="500px" :title="showTagDialog.title" :before-close="closeTagDialog"
|
||||||
v-model="showTagDialog.visible">
|
v-model="showTagDialog.visible">
|
||||||
<el-form label-width="70px">
|
<el-form label-width="auto">
|
||||||
<el-form-item prop="tag" label="标签:">
|
<el-form-item prop="tag" label="标签:">
|
||||||
<el-tree-select ref="tagTreeRef" style="width: 100%" v-model="showTagDialog.tagTreeTeams"
|
<el-tree-select ref="tagTreeRef" style="width: 100%" v-model="showTagDialog.tagTreeTeams"
|
||||||
:data="showTagDialog.tags" :default-expanded-keys="showTagDialog.tagTreeTeams" multiple
|
:data="showTagDialog.tags" :default-expanded-keys="showTagDialog.tagTreeTeams" multiple
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ import Api from '@/common/Api';
|
|||||||
export const personApi = {
|
export const personApi = {
|
||||||
accountInfo: Api.newGet("/sys/accounts/self"),
|
accountInfo: Api.newGet("/sys/accounts/self"),
|
||||||
updateAccount: Api.newPut("/sys/accounts/self"),
|
updateAccount: Api.newPut("/sys/accounts/self"),
|
||||||
getMsgs: Api.newGet("/sys/accounts/msgs"),
|
getMsgs: Api.newGet("/msgs/self"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-card shadow="hover" class="mt15 personal-edit" header="更新信息">
|
<el-card shadow="hover" class="mt15 personal-edit" header="更新信息">
|
||||||
<div class="personal-edit-title">基本信息</div>
|
<div class="personal-edit-title">基本信息</div>
|
||||||
<el-form :model="accountForm" label-width="40px" class="mt35 mb35">
|
<el-form :model="accountForm" label-width="auto" class="mt35 mb35">
|
||||||
<el-row :gutter="35">
|
<el-row :gutter="35">
|
||||||
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
|
||||||
<el-form-item label="密码">
|
<el-form-item label="密码">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="account-dialog">
|
<div class="account-dialog">
|
||||||
<el-dialog :title="title" v-model="dialogVisible" :before-close="cancel" :show-close="false" width="35%"
|
<el-dialog :title="title" v-model="dialogVisible" :before-close="cancel" :show-close="false" width="35%"
|
||||||
:destroy-on-close="true">
|
:destroy-on-close="true">
|
||||||
<el-form :model="form" ref="accountForm" :rules="rules" label-width="85px">
|
<el-form :model="form" ref="accountForm" :rules="rules" label-width="auto">
|
||||||
<el-form-item prop="name" label="姓名:" required>
|
<el-form-item prop="name" label="姓名:" required>
|
||||||
<el-input v-model.trim="form.name" placeholder="请输入姓名" auto-complete="off"></el-input>
|
<el-input v-model.trim="form.name" placeholder="请输入姓名" auto-complete="off"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -5,10 +5,9 @@
|
|||||||
v-model:page-size="query.pageSize" v-model:page-num="query.pageNum" @pageChange="search()">
|
v-model:page-size="query.pageSize" v-model:page-num="query.pageNum" @pageChange="search()">
|
||||||
|
|
||||||
<template #queryRight>
|
<template #queryRight>
|
||||||
<el-button v-auth="perms.addAccount" type="primary" icon="plus"
|
<el-button v-auth="perms.addAccount" type="primary" icon="plus" @click="editAccount(false)">添加</el-button>
|
||||||
@click="editAccount(true)">添加</el-button>
|
<el-button v-auth="perms.delAccount" :disabled="state.selectionData.length < 1" @click="deleteAccount()"
|
||||||
<el-button v-auth="perms.delAccount" :disabled="state.selectionData.length < 1"
|
type="danger" icon="delete">删除</el-button>
|
||||||
@click="deleteAccount()" type="danger" icon="delete">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #status="{ data }">
|
<template #status="{ data }">
|
||||||
@@ -23,21 +22,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #action="{ data }">
|
<template #action="{ data }">
|
||||||
<el-button link v-if="actionBtns[perms.addAccount]" @click="editAccount(data)"
|
<el-button link v-if="actionBtns[perms.addAccount]" @click="editAccount(data)" type="primary">编辑</el-button>
|
||||||
type="primary">编辑</el-button>
|
|
||||||
|
|
||||||
<el-button link v-if="actionBtns[perms.saveAccountRole]" @click="showRoleEdit(data)"
|
<el-button link v-if="actionBtns[perms.saveAccountRole]" @click="showRoleEdit(data)"
|
||||||
type="success">角色分配</el-button>
|
type="success">角色分配</el-button>
|
||||||
|
|
||||||
<el-button link v-if="actionBtns[perms.changeAccountStatus] && data.status == 1"
|
<el-button link v-if="actionBtns[perms.changeAccountStatus] && data.status == 1" @click="changeStatus(data)"
|
||||||
@click="changeStatus(data)" type="danger">禁用</el-button>
|
type="danger">禁用</el-button>
|
||||||
|
|
||||||
<el-button link v-if="actionBtns[perms.changeAccountStatus] && data.status == -1" type="success"
|
<el-button link v-if="actionBtns[perms.changeAccountStatus] && data.status == -1" type="success"
|
||||||
@click="changeStatus(data)">启用</el-button>
|
@click="changeStatus(data)">启用</el-button>
|
||||||
|
|
||||||
<el-button link v-if="actionBtns[perms.addAccount]"
|
<el-button link v-if="actionBtns[perms.addAccount]" :disabled="!data.otpSecret || data.otpSecret == '-'"
|
||||||
:disabled="!data.otpSecret || data.otpSecret == '-'" @click="resetOtpSecret(data)"
|
@click="resetOtpSecret(data)" type="warning">重置OTP</el-button>
|
||||||
type="warning">重置OTP</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</page-table>
|
</page-table>
|
||||||
|
|
||||||
@@ -97,7 +94,7 @@ const perms = {
|
|||||||
const queryConfig = [
|
const queryConfig = [
|
||||||
TableQuery.text("username", "用户名"),
|
TableQuery.text("username", "用户名"),
|
||||||
]
|
]
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("name", "姓名"),
|
TableColumn.new("name", "姓名"),
|
||||||
TableColumn.new("username", "用户名"),
|
TableColumn.new("username", "用户名"),
|
||||||
TableColumn.new("status", "状态").isSlot(),
|
TableColumn.new("status", "状态").isSlot(),
|
||||||
@@ -107,7 +104,7 @@ const columns = [
|
|||||||
TableColumn.new("createTime", "创建时间").isTime(),
|
TableColumn.new("createTime", "创建时间").isTime(),
|
||||||
TableColumn.new("modifier", "更新账号"),
|
TableColumn.new("modifier", "更新账号"),
|
||||||
TableColumn.new("updateTime", "更新时间").isTime(),
|
TableColumn.new("updateTime", "更新时间").isTime(),
|
||||||
]
|
])
|
||||||
|
|
||||||
// 该用户拥有的的操作列按钮权限
|
// 该用户拥有的的操作列按钮权限
|
||||||
const actionBtns = hasPerms([perms.addAccount, perms.saveAccountRole, perms.changeAccountStatus])
|
const actionBtns = hasPerms([perms.addAccount, perms.saveAccountRole, perms.changeAccountStatus])
|
||||||
@@ -166,7 +163,7 @@ const {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (Object.keys(actionBtns).length > 0) {
|
if (Object.keys(actionBtns).length > 0) {
|
||||||
columns.push(actionColumn);
|
columns.value.push(actionColumn);
|
||||||
}
|
}
|
||||||
search();
|
search();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="750px"
|
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="750px"
|
||||||
:destroy-on-close="true">
|
:destroy-on-close="true">
|
||||||
<el-form ref="configForm" :model="form" label-width="90px">
|
<el-form ref="configForm" :model="form" label-width="auto">
|
||||||
<el-form-item prop="name" label="配置项:" required>
|
<el-form-item prop="name" label="配置项:" required>
|
||||||
<el-input v-model="form.name"></el-input>
|
<el-input v-model="form.name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
:total="total" v-model:page-size="query.pageSize" v-model:page-num="query.pageNum" @pageChange="search()">
|
:total="total" v-model:page-size="query.pageSize" v-model:page-num="query.pageNum" @pageChange="search()">
|
||||||
|
|
||||||
<template #queryRight>
|
<template #queryRight>
|
||||||
<el-button v-auth="perms.saveConfig" type="primary" icon="plus"
|
<el-button v-auth="perms.saveConfig" type="primary" icon="plus" @click="editConfig(false)">添加</el-button>
|
||||||
@click="editConfig(false)">添加</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #status="{ data }">
|
<template #status="{ data }">
|
||||||
@@ -23,7 +22,7 @@
|
|||||||
|
|
||||||
<el-dialog :before-close="closeSetConfigDialog" title="配置项设置" v-model="paramsDialog.visible" width="500px">
|
<el-dialog :before-close="closeSetConfigDialog" title="配置项设置" v-model="paramsDialog.visible" width="500px">
|
||||||
<el-form v-if="paramsDialog.paramsFormItem.length > 0" ref="paramsFormRef" :model="paramsDialog.params"
|
<el-form v-if="paramsDialog.paramsFormItem.length > 0" ref="paramsFormRef" :model="paramsDialog.params"
|
||||||
label-width="130px">
|
label-width="auto">
|
||||||
<el-form-item v-for="item in paramsDialog.paramsFormItem" :key="item.name" :prop="item.model"
|
<el-form-item v-for="item in paramsDialog.paramsFormItem" :key="item.name" :prop="item.model"
|
||||||
:label="item.name" required>
|
:label="item.name" required>
|
||||||
<el-input v-if="!item.options" v-model="paramsDialog.params[item.model]" :placeholder="item.placeholder"
|
<el-input v-if="!item.options" v-model="paramsDialog.params[item.model]" :placeholder="item.placeholder"
|
||||||
@@ -35,7 +34,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-form v-else ref="paramsFormRef" label-width="90px">
|
<el-form v-else ref="paramsFormRef" label-width="auto">
|
||||||
<el-form-item label="配置值" required>
|
<el-form-item label="配置值" required>
|
||||||
<el-input v-model="paramsDialog.params" :placeholder="paramsDialog.config.remark" autocomplete="off"
|
<el-input v-model="paramsDialog.params" :placeholder="paramsDialog.config.remark" autocomplete="off"
|
||||||
clearable></el-input>
|
clearable></el-input>
|
||||||
@@ -66,14 +65,14 @@ import { hasPerms } from '@/components/auth/auth';
|
|||||||
const perms = {
|
const perms = {
|
||||||
saveConfig: "config:save"
|
saveConfig: "config:save"
|
||||||
}
|
}
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("name", "配置项"),
|
TableColumn.new("name", "配置项"),
|
||||||
TableColumn.new("key", "配置key"),
|
TableColumn.new("key", "配置key"),
|
||||||
TableColumn.new("value", "配置值"),
|
TableColumn.new("value", "配置值"),
|
||||||
TableColumn.new("remark", "备注"),
|
TableColumn.new("remark", "备注"),
|
||||||
TableColumn.new("modifier", "更新账号"),
|
TableColumn.new("modifier", "更新账号"),
|
||||||
TableColumn.new("updateTime", "更新时间").isTime(),
|
TableColumn.new("updateTime", "更新时间").isTime(),
|
||||||
]
|
])
|
||||||
const actionColumn = TableColumn.new("action", "操作").isSlot().fixedRight().setMinWidth(130).noShowOverflowTooltip();
|
const actionColumn = TableColumn.new("action", "操作").isSlot().fixedRight().setMinWidth(130).noShowOverflowTooltip();
|
||||||
const actionBtns = hasPerms([perms.saveConfig])
|
const actionBtns = hasPerms([perms.saveConfig])
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ const {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (Object.keys(actionBtns).length > 0) {
|
if (Object.keys(actionBtns).length > 0) {
|
||||||
columns.push(actionColumn);
|
columns.value.push(actionColumn);
|
||||||
}
|
}
|
||||||
search();
|
search();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="system-menu-dialog-container layout-pd">
|
<div class="system-menu-dialog-container layout-pd">
|
||||||
<el-dialog :title="title" :destroy-on-close="true" v-model="dialogVisible" width="800px">
|
<el-dialog :title="title" :destroy-on-close="true" v-model="dialogVisible" width="800px">
|
||||||
<el-form :model="form" :inline="true" ref="menuForm" :rules="rules" label-width="100px">
|
<el-form :model="form" :inline="true" ref="menuForm" :rules="rules" label-width="auto">
|
||||||
<el-row :gutter="35">
|
<el-row :gutter="35">
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item class="w100" prop="type" label="类型" required>
|
<el-form-item class="w100" prop="type" label="类型" required>
|
||||||
@@ -67,7 +67,8 @@
|
|||||||
<el-form-item class="w100" prop="isKeepAlive">
|
<el-form-item class="w100" prop="isKeepAlive">
|
||||||
<template #label>
|
<template #label>
|
||||||
是否缓存
|
是否缓存
|
||||||
<el-tooltip effect="dark" content="选择是则会被`keep-alive`缓存(重新进入页面不会刷新页面及重新请求数据),需要路由名与vue的组件名一致" placement="top">
|
<el-tooltip effect="dark"
|
||||||
|
content="选择是则会被`keep-alive`缓存(重新进入页面不会刷新页面及重新请求数据),需要路由名与vue的组件名一致" placement="top">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<question-filled />
|
<question-filled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="role-dialog">
|
<div class="role-dialog">
|
||||||
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="500px"
|
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="500px"
|
||||||
:destroy-on-close="true">
|
:destroy-on-close="true">
|
||||||
<el-form ref="roleForm" :model="form" label-width="90px">
|
<el-form ref="roleForm" :model="form" label-width="auto">
|
||||||
<el-form-item prop="name" label="角色名称:" required>
|
<el-form-item prop="name" label="角色名称:" required>
|
||||||
<el-input v-model="form.name" auto-complete="off"></el-input>
|
<el-input v-model="form.name" auto-complete="off"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ const perms = {
|
|||||||
const queryConfig = [
|
const queryConfig = [
|
||||||
TableQuery.text("name", "角色名"),
|
TableQuery.text("name", "角色名"),
|
||||||
]
|
]
|
||||||
const columns = [
|
const columns = ref([
|
||||||
TableColumn.new("name", "角色名称"),
|
TableColumn.new("name", "角色名称"),
|
||||||
TableColumn.new("code", "角色code"),
|
TableColumn.new("code", "角色code"),
|
||||||
TableColumn.new("remark", "备注"),
|
TableColumn.new("remark", "备注"),
|
||||||
@@ -70,7 +70,7 @@ const columns = [
|
|||||||
TableColumn.new("modifier", "更新账号"),
|
TableColumn.new("modifier", "更新账号"),
|
||||||
TableColumn.new("updateTime", "更新时间").isTime(),
|
TableColumn.new("updateTime", "更新时间").isTime(),
|
||||||
TableColumn.new("showmore", "查看更多").isSlot().setMinWidth(150),
|
TableColumn.new("showmore", "查看更多").isSlot().setMinWidth(150),
|
||||||
]
|
])
|
||||||
|
|
||||||
const actionBtns = hasPerms([perms.updateRole, perms.saveRoleResource])
|
const actionBtns = hasPerms([perms.updateRole, perms.saveRoleResource])
|
||||||
const actionColumn = TableColumn.new("action", "操作").isSlot().setMinWidth(160).fixedRight()
|
const actionColumn = TableColumn.new("action", "操作").isSlot().setMinWidth(160).fixedRight()
|
||||||
@@ -114,7 +114,7 @@ const {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (Object.keys(actionBtns).length > 0) {
|
if (Object.keys(actionBtns).length > 0) {
|
||||||
columns.push(actionColumn);
|
columns.value.push(actionColumn);
|
||||||
}
|
}
|
||||||
search();
|
search();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
db_router "mayfly-go/internal/db/router"
|
db_router "mayfly-go/internal/db/router"
|
||||||
machine_router "mayfly-go/internal/machine/router"
|
machine_router "mayfly-go/internal/machine/router"
|
||||||
mongo_router "mayfly-go/internal/mongo/router"
|
mongo_router "mayfly-go/internal/mongo/router"
|
||||||
|
msg_router "mayfly-go/internal/msg/router"
|
||||||
redis_router "mayfly-go/internal/redis/router"
|
redis_router "mayfly-go/internal/redis/router"
|
||||||
sys_router "mayfly-go/internal/sys/router"
|
sys_router "mayfly-go/internal/sys/router"
|
||||||
tag_router "mayfly-go/internal/tag/router"
|
tag_router "mayfly-go/internal/tag/router"
|
||||||
@@ -73,6 +74,7 @@ func InitRouter() *gin.Engine {
|
|||||||
common_router.InitCommonRouter(api)
|
common_router.InitCommonRouter(api)
|
||||||
|
|
||||||
sys_router.Init(api)
|
sys_router.Init(api)
|
||||||
|
msg_router.Init(api)
|
||||||
|
|
||||||
tag_router.Init(api)
|
tag_router.Init(api)
|
||||||
machine_router.Init(api)
|
machine_router.Init(api)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"mayfly-go/internal/db/api/vo"
|
"mayfly-go/internal/db/api/vo"
|
||||||
"mayfly-go/internal/db/application"
|
"mayfly-go/internal/db/application"
|
||||||
"mayfly-go/internal/db/domain/entity"
|
"mayfly-go/internal/db/domain/entity"
|
||||||
sysapp "mayfly-go/internal/sys/application"
|
msgapp "mayfly-go/internal/msg/application"
|
||||||
tagapp "mayfly-go/internal/tag/application"
|
tagapp "mayfly-go/internal/tag/application"
|
||||||
"mayfly-go/pkg/biz"
|
"mayfly-go/pkg/biz"
|
||||||
"mayfly-go/pkg/ginx"
|
"mayfly-go/pkg/ginx"
|
||||||
@@ -27,7 +27,7 @@ import (
|
|||||||
type Db struct {
|
type Db struct {
|
||||||
DbApp application.Db
|
DbApp application.Db
|
||||||
DbSqlExecApp application.DbSqlExec
|
DbSqlExecApp application.DbSqlExec
|
||||||
MsgApp sysapp.Msg
|
MsgApp msgapp.Msg
|
||||||
TagApp tagapp.TagTree
|
TagApp tagapp.TagTree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package router
|
|||||||
import (
|
import (
|
||||||
"mayfly-go/internal/db/api"
|
"mayfly-go/internal/db/api"
|
||||||
"mayfly-go/internal/db/application"
|
"mayfly-go/internal/db/application"
|
||||||
sysapp "mayfly-go/internal/sys/application"
|
msgapp "mayfly-go/internal/msg/application"
|
||||||
tagapp "mayfly-go/internal/tag/application"
|
tagapp "mayfly-go/internal/tag/application"
|
||||||
"mayfly-go/pkg/req"
|
"mayfly-go/pkg/req"
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ func InitDbRouter(router *gin.RouterGroup) {
|
|||||||
d := &api.Db{
|
d := &api.Db{
|
||||||
DbApp: application.GetDbApp(),
|
DbApp: application.GetDbApp(),
|
||||||
DbSqlExecApp: application.GetDbSqlExecApp(),
|
DbSqlExecApp: application.GetDbSqlExecApp(),
|
||||||
MsgApp: sysapp.GetMsgApp(),
|
MsgApp: msgapp.GetMsgApp(),
|
||||||
TagApp: tagapp.GetTagTreeApp(),
|
TagApp: tagapp.GetTagTreeApp(),
|
||||||
}
|
}
|
||||||
// 获取所有数据库列表
|
// 获取所有数据库列表
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"mayfly-go/internal/machine/api/vo"
|
"mayfly-go/internal/machine/api/vo"
|
||||||
"mayfly-go/internal/machine/application"
|
"mayfly-go/internal/machine/application"
|
||||||
"mayfly-go/internal/machine/domain/entity"
|
"mayfly-go/internal/machine/domain/entity"
|
||||||
sysApplication "mayfly-go/internal/sys/application"
|
msgapp "mayfly-go/internal/msg/application"
|
||||||
"mayfly-go/pkg/biz"
|
"mayfly-go/pkg/biz"
|
||||||
"mayfly-go/pkg/ginx"
|
"mayfly-go/pkg/ginx"
|
||||||
"mayfly-go/pkg/req"
|
"mayfly-go/pkg/req"
|
||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
type MachineFile struct {
|
type MachineFile struct {
|
||||||
MachineFileApp application.MachineFile
|
MachineFileApp application.MachineFile
|
||||||
MsgApp sysApplication.Msg
|
MsgApp msgapp.Msg
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package router
|
|||||||
import (
|
import (
|
||||||
"mayfly-go/internal/machine/api"
|
"mayfly-go/internal/machine/api"
|
||||||
"mayfly-go/internal/machine/application"
|
"mayfly-go/internal/machine/application"
|
||||||
sysApplication "mayfly-go/internal/sys/application"
|
msgapp "mayfly-go/internal/msg/application"
|
||||||
"mayfly-go/pkg/req"
|
"mayfly-go/pkg/req"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -14,7 +14,7 @@ func InitMachineFileRouter(router *gin.RouterGroup) {
|
|||||||
{
|
{
|
||||||
mf := &api.MachineFile{
|
mf := &api.MachineFile{
|
||||||
MachineFileApp: application.GetMachineFileApp(),
|
MachineFileApp: application.GetMachineFileApp(),
|
||||||
MsgApp: sysApplication.GetMsgApp(),
|
MsgApp: msgapp.GetMsgApp(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取指定机器文件列表
|
// 获取指定机器文件列表
|
||||||
|
|||||||
20
server/internal/msg/api/msg.go
Normal file
20
server/internal/msg/api/msg.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mayfly-go/internal/msg/application"
|
||||||
|
"mayfly-go/internal/msg/domain/entity"
|
||||||
|
"mayfly-go/pkg/ginx"
|
||||||
|
"mayfly-go/pkg/req"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Msg struct {
|
||||||
|
MsgApp application.Msg
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取账号接收的消息列表
|
||||||
|
func (m *Msg) GetMsgs(rc *req.Ctx) {
|
||||||
|
condition := &entity.Msg{
|
||||||
|
RecipientId: int64(rc.LoginAccount.Id),
|
||||||
|
}
|
||||||
|
rc.ResData = m.MsgApp.GetPageList(condition, ginx.GetPageParam(rc.GinCtx), new([]entity.Msg))
|
||||||
|
}
|
||||||
13
server/internal/msg/application/application.go
Normal file
13
server/internal/msg/application/application.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package application
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mayfly-go/internal/msg/infrastructure/persistence"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
msgApp = newMsgApp(persistence.GetMsgRepo())
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetMsgApp() Msg {
|
||||||
|
return msgApp
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package application
|
package application
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mayfly-go/internal/sys/domain/entity"
|
"mayfly-go/internal/msg/domain/entity"
|
||||||
"mayfly-go/internal/sys/domain/repository"
|
"mayfly-go/internal/msg/domain/repository"
|
||||||
"mayfly-go/pkg/model"
|
"mayfly-go/pkg/model"
|
||||||
"mayfly-go/pkg/ws"
|
"mayfly-go/pkg/ws"
|
||||||
"time"
|
"time"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mayfly-go/internal/sys/domain/entity"
|
"mayfly-go/internal/msg/domain/entity"
|
||||||
"mayfly-go/pkg/model"
|
"mayfly-go/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package persistence
|
package persistence
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mayfly-go/internal/sys/domain/entity"
|
"mayfly-go/internal/msg/domain/entity"
|
||||||
"mayfly-go/internal/sys/domain/repository"
|
"mayfly-go/internal/msg/domain/repository"
|
||||||
"mayfly-go/pkg/biz"
|
"mayfly-go/pkg/biz"
|
||||||
"mayfly-go/pkg/gormx"
|
"mayfly-go/pkg/gormx"
|
||||||
"mayfly-go/pkg/model"
|
"mayfly-go/pkg/model"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package persistence
|
||||||
|
|
||||||
|
import "mayfly-go/internal/msg/domain/repository"
|
||||||
|
|
||||||
|
var (
|
||||||
|
msgRepo = newMsgRepo()
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetMsgRepo() repository.Msg {
|
||||||
|
return msgRepo
|
||||||
|
}
|
||||||
21
server/internal/msg/router/msg.go
Normal file
21
server/internal/msg/router/msg.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mayfly-go/internal/msg/api"
|
||||||
|
"mayfly-go/internal/msg/application"
|
||||||
|
"mayfly-go/pkg/req"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitMsgRouter(router *gin.RouterGroup) {
|
||||||
|
msg := router.Group("msgs")
|
||||||
|
a := &api.Msg{
|
||||||
|
MsgApp: application.GetMsgApp(),
|
||||||
|
}
|
||||||
|
{
|
||||||
|
msg.GET("/self", func(c *gin.Context) {
|
||||||
|
req.NewCtxWithGin(c).Handle(a.GetMsgs)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
7
server/internal/msg/router/router.go
Normal file
7
server/internal/msg/router/router.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package router
|
||||||
|
|
||||||
|
import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
func Init(router *gin.RouterGroup) {
|
||||||
|
InitMsgRouter(router)
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package api
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
msgapp "mayfly-go/internal/msg/application"
|
||||||
|
msgentity "mayfly-go/internal/msg/domain/entity"
|
||||||
"mayfly-go/internal/sys/api/form"
|
"mayfly-go/internal/sys/api/form"
|
||||||
"mayfly-go/internal/sys/api/vo"
|
"mayfly-go/internal/sys/api/vo"
|
||||||
"mayfly-go/internal/sys/application"
|
"mayfly-go/internal/sys/application"
|
||||||
@@ -31,7 +33,7 @@ type Account struct {
|
|||||||
AccountApp application.Account
|
AccountApp application.Account
|
||||||
ResourceApp application.Resource
|
ResourceApp application.Resource
|
||||||
RoleApp application.Role
|
RoleApp application.Role
|
||||||
MsgApp application.Msg
|
MsgApp msgapp.Msg
|
||||||
ConfigApp application.Config
|
ConfigApp application.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +259,7 @@ func (a *Account) saveLogin(account *entity.Account, ip string) {
|
|||||||
a.AccountApp.Update(updateAccount)
|
a.AccountApp.Update(updateAccount)
|
||||||
|
|
||||||
// 创建登录消息
|
// 创建登录消息
|
||||||
loginMsg := &entity.Msg{
|
loginMsg := &msgentity.Msg{
|
||||||
RecipientId: int64(account.Id),
|
RecipientId: int64(account.Id),
|
||||||
Msg: fmt.Sprintf("于[%s]-[%s]登录", ip, now.Format("2006-01-02 15:04:05")),
|
Msg: fmt.Sprintf("于[%s]-[%s]登录", ip, now.Format("2006-01-02 15:04:05")),
|
||||||
Type: 1,
|
Type: 1,
|
||||||
@@ -296,14 +298,6 @@ func (a *Account) UpdateAccount(rc *req.Ctx) {
|
|||||||
a.AccountApp.Update(updateAccount)
|
a.AccountApp.Update(updateAccount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取账号接收的消息列表
|
|
||||||
func (a *Account) GetMsgs(rc *req.Ctx) {
|
|
||||||
condition := &entity.Msg{
|
|
||||||
RecipientId: int64(rc.LoginAccount.Id),
|
|
||||||
}
|
|
||||||
rc.ResData = a.MsgApp.GetPageList(condition, ginx.GetPageParam(rc.GinCtx), new([]entity.Msg))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 后台账号操作 **/
|
/** 后台账号操作 **/
|
||||||
|
|
||||||
// @router /accounts [get]
|
// @router /accounts [get]
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
var (
|
var (
|
||||||
accountApp = newAccountApp(persistence.GetAccountRepo())
|
accountApp = newAccountApp(persistence.GetAccountRepo())
|
||||||
configApp = newConfigApp(persistence.GetConfigRepo())
|
configApp = newConfigApp(persistence.GetConfigRepo())
|
||||||
msgApp = newMsgApp(persistence.GetMsgRepo())
|
|
||||||
resourceApp = newResourceApp(persistence.GetResourceRepo())
|
resourceApp = newResourceApp(persistence.GetResourceRepo())
|
||||||
roleApp = newRoleApp(persistence.GetRoleRepo())
|
roleApp = newRoleApp(persistence.GetRoleRepo())
|
||||||
syslogApp = newSyslogApp(persistence.GetSyslogRepo())
|
syslogApp = newSyslogApp(persistence.GetSyslogRepo())
|
||||||
@@ -21,10 +20,6 @@ func GetConfigApp() Config {
|
|||||||
return configApp
|
return configApp
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMsgApp() Msg {
|
|
||||||
return msgApp
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetResourceApp() Resource {
|
func GetResourceApp() Resource {
|
||||||
return resourceApp
|
return resourceApp
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func (m *syslogAppImpl) GetPageList(condition *entity.Syslog, pageParam *model.P
|
|||||||
func (m *syslogAppImpl) SaveFromReq(req *req.Ctx) {
|
func (m *syslogAppImpl) SaveFromReq(req *req.Ctx) {
|
||||||
lg := req.LoginAccount
|
lg := req.LoginAccount
|
||||||
if lg == nil {
|
if lg == nil {
|
||||||
return
|
lg = &model.LoginAccount{Id: 0, Username: "-"}
|
||||||
}
|
}
|
||||||
syslog := new(entity.Syslog)
|
syslog := new(entity.Syslog)
|
||||||
syslog.CreateTime = time.Now()
|
syslog.CreateTime = time.Now()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import "mayfly-go/internal/sys/domain/repository"
|
|||||||
var (
|
var (
|
||||||
accountRepo = newAccountRepo()
|
accountRepo = newAccountRepo()
|
||||||
configRepo = newConfigRepo()
|
configRepo = newConfigRepo()
|
||||||
msgRepo = newMsgRepo()
|
|
||||||
resourceRepo = newResourceRepo()
|
resourceRepo = newResourceRepo()
|
||||||
roleRepo = newRoleRepo()
|
roleRepo = newRoleRepo()
|
||||||
syslogRepo = newSyslogRepo()
|
syslogRepo = newSyslogRepo()
|
||||||
@@ -19,10 +18,6 @@ func GetConfigRepo() repository.Config {
|
|||||||
return configRepo
|
return configRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMsgRepo() repository.Msg {
|
|
||||||
return msgRepo
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetResourceRepo() repository.Resource {
|
func GetResourceRepo() repository.Resource {
|
||||||
return resourceRepo
|
return resourceRepo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
msgapp "mayfly-go/internal/msg/application"
|
||||||
"mayfly-go/internal/sys/api"
|
"mayfly-go/internal/sys/api"
|
||||||
"mayfly-go/internal/sys/application"
|
"mayfly-go/internal/sys/application"
|
||||||
"mayfly-go/pkg/req"
|
"mayfly-go/pkg/req"
|
||||||
@@ -14,7 +15,7 @@ func InitAccountRouter(router *gin.RouterGroup) {
|
|||||||
AccountApp: application.GetAccountApp(),
|
AccountApp: application.GetAccountApp(),
|
||||||
ResourceApp: application.GetResourceApp(),
|
ResourceApp: application.GetResourceApp(),
|
||||||
RoleApp: application.GetRoleApp(),
|
RoleApp: application.GetRoleApp(),
|
||||||
MsgApp: application.GetMsgApp(),
|
MsgApp: msgapp.GetMsgApp(),
|
||||||
ConfigApp: application.GetConfigApp(),
|
ConfigApp: application.GetConfigApp(),
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -56,10 +57,6 @@ func InitAccountRouter(router *gin.RouterGroup) {
|
|||||||
req.NewCtxWithGin(c).Handle(a.UpdateAccount)
|
req.NewCtxWithGin(c).Handle(a.UpdateAccount)
|
||||||
})
|
})
|
||||||
|
|
||||||
account.GET("/msgs", func(c *gin.Context) {
|
|
||||||
req.NewCtxWithGin(c).Handle(a.GetMsgs)
|
|
||||||
})
|
|
||||||
|
|
||||||
/** 后台管理接口 **/
|
/** 后台管理接口 **/
|
||||||
|
|
||||||
// 获取所有用户列表
|
// 获取所有用户列表
|
||||||
|
|||||||
Reference in New Issue
Block a user