This commit is contained in:
parent
006eaa5631
commit
a913c9f8a7
|
|
@ -1,7 +1,10 @@
|
|||
import auth from "@/api/model/auth"
|
||||
import system from "@/api/model/system"
|
||||
import tools from "@/api/model/tools"
|
||||
|
||||
|
||||
export default {
|
||||
auth,
|
||||
system
|
||||
system,
|
||||
tools
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import http from "@/utils/request"
|
||||
|
||||
export default {
|
||||
gen_table: {
|
||||
list: async function (data = {}) {
|
||||
return await http.get("gen_table/list", data);
|
||||
},
|
||||
add: async function (data = {}) {
|
||||
return await http.post("gen_table/add", data);
|
||||
},
|
||||
edit: async function (data = {}) {
|
||||
return await http.put("gen_table/edit", data);
|
||||
},
|
||||
del: async function (data = {}) {
|
||||
return await http.delete("gen_table/del", data);
|
||||
},
|
||||
select: async function (data = {}) {
|
||||
return await http.get("gen_table/select", data);
|
||||
},
|
||||
build: async function (data = {}) {
|
||||
return await http.post("gen_table/build", data);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<template>
|
||||
<svg t="1762841750837" class="icon" viewBox="0 0 1027 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5235" width="256" height="256"><path d="M321.828571 226.742857c-14.628571-14.628571-36.571429-14.628571-51.2 0L7.314286 482.742857c-14.628571 14.628571-14.628571 36.571429 0 51.2l256 256c14.628571 14.628571 36.571429 14.628571 51.2 0 14.628571-14.628571 14.628571-36.571429 0-51.2L87.771429 512l234.057142-234.057143c7.314286-14.628571 7.314286-36.571429 0-51.2z m263.314286 0c-14.628571 0-36.571429 7.314286-43.885714 29.257143l-131.657143 497.371429c-7.314286 21.942857 7.314286 36.571429 29.257143 43.885714s36.571429-7.314286 43.885714-29.257143l131.657143-497.371429c7.314286-14.628571-7.314286-36.571429-29.257143-43.885714z m431.542857 256l-256-256c-14.628571-14.628571-36.571429-14.628571-51.2 0-14.628571 14.628571-14.628571 36.571429 0 51.2L936.228571 512l-234.057142 234.057143c-14.628571 14.628571-14.628571 36.571429 0 51.2 14.628571 14.628571 36.571429 14.628571 51.2 0l256-256c14.628571-14.628571 14.628571-43.885714 7.314285-58.514286z" p-id="5236"></path></svg>
|
||||
</template>
|
||||
|
|
@ -110,7 +110,7 @@ function show_log(row) {
|
|||
//删除
|
||||
async function del(row) {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.crontab.del({ids: row.crontab_id});
|
||||
const res = await api.system.crontab.del({ids: [row.crontab_id]});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
@ -122,7 +122,7 @@ async function batch_del() {
|
|||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.crontab.del({ids: selection.value.map(item => item.crontab_id).toString()});
|
||||
const res = await api.system.crontab.del({ids: selection.value.map(item => item.crontab_id)});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ async function batch_del() {
|
|||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.crontab_log.del({ids: selection.value.map(item => item.log_id).toString()});
|
||||
const res = await api.system.crontab_log.del({ids: selection.value.map(item => item.log_id)});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
@ -87,7 +87,7 @@ async function batch_del() {
|
|||
|
||||
async function del(row) {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.crontab_log.del({ids: row.log_id});
|
||||
const res = await api.system.crontab_log.del({ids: [row.log_id]});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,11 @@
|
|||
<el-table-column label="登录地点" prop="location"></el-table-column>
|
||||
<el-table-column label="浏览器" prop="os.browser"></el-table-column>
|
||||
<el-table-column label="操作系统" prop="os.os"></el-table-column>
|
||||
<el-table-column label="登录时间" prop="online_time"></el-table-column>
|
||||
<el-table-column label="最近上线时间" prop="online_time">
|
||||
<template #default="scope">
|
||||
{{scope.row.update_time||scope.row.online_time}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="right" width="100">
|
||||
<template #default="scope">
|
||||
<el-button-group>
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ function table_show(row){
|
|||
//删除
|
||||
async function table_del(row){
|
||||
const loading = proxy.$loading();
|
||||
var res = await api.system.account.del({ids: row.account_id});
|
||||
var res = await api.system.account.del({ids: [row.account_id]});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ function table_show(row) {
|
|||
|
||||
//删除
|
||||
async function table_del(row) {
|
||||
const res = await api.system.dept.del({ids: row.dept_id});
|
||||
const res = await api.system.dept.del({ids: [row.dept_id]});
|
||||
tableRef.value.refresh()
|
||||
proxy.$message.success(res.msg)
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ async function batch_del() {
|
|||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.dept.del({ids: selection.value.map(item => item.dept_id).toString()});
|
||||
const res = await api.system.dept.del({ids: selection.value.map(item => item.dept_id)});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
|
|||
|
|
@ -159,8 +159,7 @@ async function delMenu() {
|
|||
return false
|
||||
}
|
||||
menuloading.value = true
|
||||
var ids = CheckedNodes.map(item => item.menu_id)
|
||||
var res = await api.system.menu.del({ids: ids.toString()})
|
||||
var res = await api.system.menu.del({ids: CheckedNodes.map(item => item.menu_id)})
|
||||
menuloading.value = false
|
||||
proxy.$message.success(res.msg)
|
||||
CheckedNodes.forEach(item => {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ async function table_show(row) {
|
|||
//删除
|
||||
async function table_del(row) {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.post.del({ids: row.post_id});
|
||||
const res = await api.system.post.del({ids: [row.post_id]});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
@ -99,7 +99,7 @@ async function batch_del() {
|
|||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.post.del({ids: selection.value.map(item => item.post_id).toString()});
|
||||
const res = await api.system.post.del({ids: selection.value.map(item => item.post_id)});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ function table_show(row){
|
|||
//删除
|
||||
async function table_del(row){
|
||||
const loading = proxy.$loading();
|
||||
var res = await api.system.role.del({ids: row.role_id});
|
||||
var res = await api.system.role.del({ids: [row.role_id]});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
@ -92,7 +92,7 @@ async function batch_del(){
|
|||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.system.role.del({ids: selection.value.map(item => item.role_id).toString()});
|
||||
const res = await api.system.role.del({ids: selection.value.map(item => item.role_id)});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-tabs v-model="type">
|
||||
<el-tab-pane name="base" label="基本信息"></el-tab-pane>
|
||||
<el-tab-pane name="field" label="字段信息"></el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import api from "@/api/index";
|
||||
import {getCurrentInstance, nextTick, ref} from "vue";
|
||||
|
||||
defineOptions({
|
||||
name: "toolsGenEdit"
|
||||
})
|
||||
const type = ref("base")
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
<template>
|
||||
<pi-table ref="tableRef" :apiObj="api.tools.gen_table.list" @selection-change="selectionChange">
|
||||
<template #do>
|
||||
<el-button v-auth="'gen_table:add'" type="primary" icon="el-icon-plus" @click="add"></el-button>
|
||||
<el-button v-auth="'gen_table:edit'" type="success" icon="el-icon-edit" @click="edit()"
|
||||
:disabled="selection.length!==1"></el-button>
|
||||
<el-button v-auth="'gen_table:del'" type="danger" plain icon="el-icon-delete" :disabled="selection.length===0"
|
||||
@click="batch_del"></el-button>
|
||||
</template>
|
||||
<template #search>
|
||||
<el-input v-model="search.table_name" placeholder="表名称" clearable style="width: 200px;"
|
||||
@keydown.enter="upsearch"></el-input>
|
||||
<el-input v-model="search.table_comment" placeholder="表描述" clearable style="width: 200px;"
|
||||
@keydown.enter="upsearch"></el-input>
|
||||
<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
|
||||
</template>
|
||||
<el-table-column type="selection" width="50"></el-table-column>
|
||||
<el-table-column label="表编号" prop="table_id" width="80"></el-table-column>
|
||||
<el-table-column label="表名称" prop="table_name"></el-table-column>
|
||||
<el-table-column label="表描述" prop="table_comment"></el-table-column>
|
||||
<el-table-column label="模块名称" prop="module_name"></el-table-column>
|
||||
<el-table-column label="控制器名称" prop="controller_name"></el-table-column>
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
<el-table-column label="创建时间" prop="create_time"></el-table-column>
|
||||
<el-table-column label="更新时间" prop="update_time"></el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="right" width="120">
|
||||
<template #default="scope">
|
||||
<el-button-group>
|
||||
<el-button text type="primary" size="small" @click="show(scope.row, scope.$index)">预览</el-button>
|
||||
<el-button v-auth="'gen_table:edit'" text type="success" size="small"
|
||||
@click="edit(scope.row, scope.$index)">编辑
|
||||
</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="del(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
<el-button v-auth="'gen_table:del'" text type="danger" size="small">删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="del(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
<el-button v-auth="'gen_table:sync'" text type="warning" size="small">同步</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</pi-table>
|
||||
<save-dialog v-if="dialogShow" ref="dialogRef" @success="tableRef.refresh()"
|
||||
@closed="dialogShow=false"></save-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import saveDialog from './save'
|
||||
import api from "@/api/index";
|
||||
import {getCurrentInstance, nextTick, ref} from "vue";
|
||||
import router from "@/router/index"
|
||||
|
||||
defineOptions({
|
||||
name: "toolsGen"
|
||||
})
|
||||
|
||||
const {proxy} = getCurrentInstance()
|
||||
const tableRef = ref(null)
|
||||
const dialogRef = ref(null)
|
||||
|
||||
let dialogShow = ref(false)
|
||||
let selection = ref([])
|
||||
let search = ref({
|
||||
crontab_name: null,
|
||||
enable: null
|
||||
})
|
||||
|
||||
//添加
|
||||
function add() {
|
||||
dialogShow.value = true
|
||||
nextTick(() => {
|
||||
dialogRef.value.open()
|
||||
})
|
||||
}
|
||||
|
||||
//编辑
|
||||
async function edit(row) {
|
||||
router.push({
|
||||
path: "/tools/gen/edit",
|
||||
query: {
|
||||
id: row?.table_id ?? selection.value[0]?.table_id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//查看
|
||||
async function show(row) {
|
||||
dialogShow.value = true
|
||||
nextTick(() => {
|
||||
dialogRef.value.open('show', row)
|
||||
})
|
||||
}
|
||||
|
||||
function show_log(row) {
|
||||
router.push({
|
||||
path: "/monitor/crontab_log",
|
||||
query: {
|
||||
crontab_id: row?.crontab_id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//删除
|
||||
async function del(row) {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.tools.gen_table.del({ids: [row.table_id]});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
}
|
||||
|
||||
//批量删除
|
||||
async function batch_del() {
|
||||
proxy.$confirm(`确定删除选中的 ${selection.value.length} 项吗?如果删除项中含有子集将会被一并删除`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const loading = proxy.$loading();
|
||||
const res = await api.tools.gen_table.del({ids: selection.value.map(item => item.table_id)});
|
||||
tableRef.value.refresh()
|
||||
loading.close();
|
||||
proxy.$message.success(res.msg)
|
||||
})
|
||||
}
|
||||
|
||||
//表格选择后回调事件
|
||||
function selectionChange(e) {
|
||||
selection.value = e;
|
||||
}
|
||||
|
||||
//搜索
|
||||
function upsearch() {
|
||||
tableRef.value.upData(search.value)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<template>
|
||||
<el-dialog title="导入表" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
|
||||
<pi-table ref="tableRef" :api-obj="api.tools.gen_table.select" @selection-change="selectionChange"
|
||||
:page-size="10" hide-do>
|
||||
<template #do>
|
||||
<el-input v-model="search.table_name" placeholder="表名称" clearable style="width: 200px;"
|
||||
@keydown.enter="upsearch"></el-input>
|
||||
<el-input v-model="search.table_comment" placeholder="表描述" clearable style="width: 200px;"
|
||||
@keydown.enter="upsearch"></el-input>
|
||||
<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
|
||||
</template>
|
||||
<el-table-column type="selection" width="50"></el-table-column>
|
||||
<el-table-column label="表名称" prop="table_name"></el-table-column>
|
||||
<el-table-column label="表描述" prop="table_comment"></el-table-column>
|
||||
<el-table-column label="创建时间" prop="create_time"></el-table-column>
|
||||
<el-table-column label="更新时间" prop="update_time"></el-table-column>
|
||||
</pi-table>
|
||||
<template #footer>
|
||||
<el-button @click="visible=false">取 消</el-button>
|
||||
<el-button type="primary" :disabled="selection.length === 0" :loading="isSaveing" @click="submit()">生 成
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getCurrentInstance, ref} from 'vue'
|
||||
import api from "@/api/index.js"
|
||||
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
const emit = defineEmits(['success', 'closed'])
|
||||
const {proxy} = getCurrentInstance()
|
||||
const tableRef = ref(null)
|
||||
|
||||
let visible = ref(false)
|
||||
let isSaveing = ref(false)
|
||||
let selection = ref([])
|
||||
let search = ref({
|
||||
table_name: null,
|
||||
table_comment: null
|
||||
})
|
||||
|
||||
function open() {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
isSaveing.value = true;
|
||||
const res = await api.tools.gen_table.build({names: selection.value.map(i => i.table_name)});
|
||||
isSaveing.value = false;
|
||||
emit('success')
|
||||
visible.value = false;
|
||||
proxy.$message.success(res.msg)
|
||||
}
|
||||
|
||||
//表格选择后回调事件
|
||||
function selectionChange(e) {
|
||||
selection.value = e;
|
||||
}
|
||||
|
||||
//搜索
|
||||
function upsearch() {
|
||||
tableRef.value.upData(search.value)
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue