mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-10-26 19:00:51 +08:00
refactor: 优化系统监控、代码生成、任务调度相关代码
This commit is contained in:
@@ -25,7 +25,7 @@ appStore.initTheme()
|
||||
appStore.initSiteConfig()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.loading-icon {
|
||||
animation: arco-loading-circle 1s infinite cubic-bezier(0,0,1,1);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { LabelValueState } from '@/types/global'
|
||||
|
||||
export type * from './type'
|
||||
|
||||
const BASE_URL = '/generator'
|
||||
const BASE_URL = '/code/generator'
|
||||
|
||||
/** @desc 查询代码生成列表 */
|
||||
export function listGenConfig(query: T.GenConfigPageQuery) {
|
||||
@@ -3,7 +3,7 @@ export * from './auth'
|
||||
export * from './common'
|
||||
export * from './monitor'
|
||||
export * from './system'
|
||||
export * from './tool'
|
||||
export * from './code'
|
||||
export * from './schedule'
|
||||
|
||||
export * from './area/type'
|
||||
@@ -11,5 +11,5 @@ export * from './auth/type'
|
||||
export * from './common/type'
|
||||
export * from './monitor/type'
|
||||
export * from './system/type'
|
||||
export * from './tool/type'
|
||||
export * from './code/type'
|
||||
export * from './schedule/type'
|
||||
|
||||
@@ -58,7 +58,7 @@ function handleLink(item: RouteLocationMatched) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.breadcrumb-item-title {
|
||||
transition: all 0.3s;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -47,4 +47,4 @@ interface Props {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -24,4 +24,4 @@ interface Props {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -21,4 +21,4 @@ interface Props {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -33,4 +33,4 @@ const dictItem = computed((): LabelValueState => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -30,4 +30,4 @@ interface Props {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -50,7 +50,7 @@ const extensions = computed(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.ͼ1 .cm-scroller) {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ const style = computed(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi-flexible-box {
|
||||
transition: all 0.36s;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ defineOptions({ name: 'GiFooter' })
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi-footer {
|
||||
height: 40px;
|
||||
font-size: 13px;
|
||||
|
||||
@@ -215,7 +215,7 @@ watch(cloneForm as any, (newVal, oldVal) => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-form-item-layout-inline) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ const handleSelectedIcon = async (icon: string) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
width: 300px;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
defineOptions({ name: 'GiOption' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi-option {
|
||||
width: 100%;
|
||||
min-width: 120px;
|
||||
|
||||
@@ -44,7 +44,7 @@ const handleClick = () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi-option-item {
|
||||
padding: 0 5px 0 10px;
|
||||
height: 34px;
|
||||
|
||||
@@ -29,4 +29,4 @@ interface Props {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -41,7 +41,7 @@ const svgClass = computed(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.svg-icon {
|
||||
width: auto;
|
||||
height: auto;
|
||||
|
||||
@@ -219,7 +219,7 @@ const _columns = computed(() => {
|
||||
defineExpose({ tableRef })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi-table {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
|
||||
@@ -24,7 +24,7 @@ const onCopy = (data: object) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.json_pretty_container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -16,4 +16,4 @@ defineOptions({ name: 'ParentView' })
|
||||
const tabsStore = useTabsStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -895,4 +895,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -502,4 +502,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -1335,4 +1335,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -12,4 +12,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -24,7 +24,7 @@ const appStore = useAppStore()
|
||||
const { isMobile } = useDevice()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.layout {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ watch(
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-menu-pop) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ const handleCollapse = (isCollapsed: boolean) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-menu.arco-menu-vertical.arco-menu-collapsed) {
|
||||
|
||||
// Menu菜单组件修改
|
||||
|
||||
@@ -23,7 +23,7 @@ import MenuFoldBtn from '../MenuFoldBtn.vue'
|
||||
defineOptions({ name: 'LayoutHeader' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.arco-dropdown-open .arco-icon-down {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.message {
|
||||
height: auto;
|
||||
max-height: calc(100% - 51px);
|
||||
|
||||
@@ -141,7 +141,7 @@ const changeColor = (colorObj: ColorObj) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-descriptions-item-label-block) {
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ withDefaults(defineProps<Props>(), {})
|
||||
const emit = defineEmits(['click'])
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.layout-item {
|
||||
width: 60px;
|
||||
height: 50px;
|
||||
|
||||
@@ -149,7 +149,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.arco-dropdown-open .arco-icon-down {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const toHome = () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.system-logo {
|
||||
height: 56px;
|
||||
padding: 0 12px;
|
||||
|
||||
@@ -18,7 +18,7 @@ const appStore = useAppStore()
|
||||
const tabsStore = useTabsStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -10,4 +10,4 @@ interface Props {
|
||||
const props = withDefaults(defineProps<Props>(), {})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -83,4 +83,4 @@ const onCollapse = (collapsed: boolean) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -49,7 +49,7 @@ const onClick = () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.menu-fold-btn {
|
||||
background-color: var(--color-secondary-hover) !important;
|
||||
flex-shrink: 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi-more-icon-wrap {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
@@ -133,7 +133,7 @@ const handleContextMenu = (e: MouseEvent, path: string) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-tabs-nav-tab) {
|
||||
.arco-tabs-tab {
|
||||
svg {
|
||||
|
||||
@@ -12,4 +12,4 @@ defineOptions({ name: 'Layout' })
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<script setup lang="ts">
|
||||
import { Message } from '@arco-design/web-vue'
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { type FieldConfigResp, type GeneratorConfigResp, getGenConfig, listFieldConfig, listFieldConfigDict, saveGenConfig } from '@/apis/tool'
|
||||
import { type FieldConfigResp, type GeneratorConfigResp, getGenConfig, listFieldConfig, listFieldConfigDict, saveGenConfig } from '@/apis/code/generator'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
||||
import { type Columns, GiForm, type Options } from '@/components/GiForm'
|
||||
@@ -131,8 +131,15 @@ import { useDict } from '@/hooks/app'
|
||||
const emit = defineEmits<{
|
||||
(e: 'save-success'): void
|
||||
}>()
|
||||
|
||||
const { width } = useWindowSize()
|
||||
|
||||
const title = ref('')
|
||||
const visible = ref(false)
|
||||
const activeKey = ref('1')
|
||||
const formRef = ref<InstanceType<typeof GiForm>>()
|
||||
const { form_type_enum, query_type_enum } = useDict('form_type_enum', 'query_type_enum')
|
||||
const dictList = ref<LabelValueState[]>([])
|
||||
|
||||
const options: Options = {
|
||||
form: { size: 'large' },
|
||||
@@ -188,14 +195,30 @@ const formColumns: Columns = reactive([
|
||||
{
|
||||
label: '是否覆盖',
|
||||
field: 'isOverride',
|
||||
type: 'radio-group',
|
||||
options: [{ label: '是', value: true }, { label: '否', value: false }],
|
||||
type: 'switch',
|
||||
props: {
|
||||
type: 'button',
|
||||
type: 'round',
|
||||
checkedValue: 1,
|
||||
uncheckedValue: 2,
|
||||
checkedText: '是',
|
||||
uncheckedText: '否',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
const dataList = ref<FieldConfigResp[]>([])
|
||||
const loading = ref(false)
|
||||
// 查询列表数据
|
||||
const getDataList = async (tableName: string, requireSync: boolean) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = await listFieldConfig(tableName, requireSync)
|
||||
dataList.value = data
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Table 字段配置
|
||||
const columns: TableInstanceColumns[] = [
|
||||
{ title: '名称', slotName: 'fieldName' },
|
||||
@@ -210,23 +233,6 @@ const columns: TableInstanceColumns[] = [
|
||||
{ title: '关联字典', slotName: 'dictCode' },
|
||||
]
|
||||
|
||||
const dictList = ref<LabelValueState[]>([])
|
||||
const dataList = ref<FieldConfigResp[]>([])
|
||||
const loading = ref(false)
|
||||
// 查询列表数据
|
||||
const getDataList = async (tableName: string, requireSync: boolean) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await listFieldConfig(tableName, requireSync)
|
||||
dataList.value = res.data
|
||||
const { data } = await listFieldConfigDict()
|
||||
dictList.value = data
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const formRef = ref<InstanceType<typeof GiForm>>()
|
||||
const { form, resetForm } = useForm({
|
||||
isOverride: false,
|
||||
})
|
||||
@@ -237,21 +243,6 @@ const reset = () => {
|
||||
resetForm()
|
||||
}
|
||||
|
||||
const title = ref('')
|
||||
const visible = ref(false)
|
||||
// 配置
|
||||
const onConfig = async (tableName: string, comment: string) => {
|
||||
comment = comment ? `(${comment})` : ' '
|
||||
title.value = `${tableName}${comment}配置`
|
||||
visible.value = true
|
||||
// 查询字段配置
|
||||
await getDataList(tableName, false)
|
||||
// 查询生成配置
|
||||
const { data } = await getGenConfig(tableName)
|
||||
Object.assign(form, data)
|
||||
form.isOverride = false
|
||||
}
|
||||
|
||||
// 同步
|
||||
const handleRefresh = async (tableName: string) => {
|
||||
await getDataList(tableName, true)
|
||||
@@ -262,7 +253,6 @@ const handleChangeSort = (newDataList: FieldConfigResp[]) => {
|
||||
dataList.value = newDataList
|
||||
}
|
||||
|
||||
const activeKey = ref('1')
|
||||
// 保存
|
||||
const save = async () => {
|
||||
try {
|
||||
@@ -283,10 +273,25 @@ const save = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ onConfig })
|
||||
// 打开
|
||||
const onOpen = async (tableName: string, comment: string) => {
|
||||
reset()
|
||||
comment = comment ? `(${comment})` : ' '
|
||||
title.value = `${tableName}${comment}配置`
|
||||
// 查询生成配置
|
||||
const { data } = await getGenConfig(tableName)
|
||||
Object.assign(form, data)
|
||||
visible.value = true
|
||||
// 查询字段配置
|
||||
await getDataList(tableName, false)
|
||||
const res = await listFieldConfigDict()
|
||||
dictList.value = res.data
|
||||
}
|
||||
|
||||
defineExpose({ onOpen })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.gen-config.arco-form) {
|
||||
width: 50%;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<a-modal v-model:visible="visible" width="90%" :footer="false">
|
||||
<template #title>
|
||||
{{ `生成 ${previewTableName} 表预览` }}
|
||||
<a-link style="margin-left: 10px" icon @click="onDownload">下载源码</a-link>
|
||||
<a-link v-permission="['code:generator:generate']" style="margin-left: 10px" icon @click="onDownload">下载源码</a-link>
|
||||
</template>
|
||||
<div class="preview-content">
|
||||
<a-layout :has-sider="true">
|
||||
@@ -50,11 +50,9 @@
|
||||
</a-typography-title>
|
||||
</template>
|
||||
<a-scrollbar style="height: 650px; overflow: auto">
|
||||
<a-link style="position: absolute; right: 20px; z-index: 999" @click="onCopy">
|
||||
<template #icon>
|
||||
<icon-copy size="large" />
|
||||
</template>
|
||||
复制
|
||||
<a-link style="position: absolute; right: 20px; z-index: 999" title="复制" @click="onCopy">
|
||||
<template #icon><icon-copy size="large" /></template>
|
||||
<template #default>复制</template>
|
||||
</a-link>
|
||||
<GiCodeView
|
||||
:type="'vue' === currentPreview?.fileName.split('.')[1] ? 'vue' : 'javascript'"
|
||||
@@ -71,14 +69,13 @@
|
||||
<script setup lang="ts">
|
||||
import { Message, type TreeNodeData } from '@arco-design/web-vue'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import { type GeneratePreviewResp, genPreview } from '@/apis/tool'
|
||||
import { type GeneratePreviewResp, genPreview } from '@/apis/code/generator'
|
||||
|
||||
// 生成
|
||||
const emit = defineEmits<{ (e: 'generate', tableNames: string[]): void }>()
|
||||
const { copy, copied } = useClipboard()
|
||||
const currentPreview = ref<GeneratePreviewResp>()
|
||||
const genPreviewList = ref<GeneratePreviewResp[]>([])
|
||||
|
||||
const genPreviewList = ref<GeneratePreviewResp[]>([])
|
||||
const currentPreview = ref<GeneratePreviewResp>()
|
||||
const visible = ref(false)
|
||||
const previewTableName = ref<string>('')
|
||||
const treeRef = ref()
|
||||
@@ -129,9 +126,41 @@ const assembleTree = (genPreview: GeneratePreviewResp) => {
|
||||
tempChildren?.push({ title: genPreview.fileName, key: genPreview.fileName, children: new Array<TreeNodeData>() })
|
||||
}
|
||||
|
||||
// 下载
|
||||
const onDownload = () => {
|
||||
emit('generate', [previewTableName.value])
|
||||
}
|
||||
// 校验文件类型
|
||||
const checkFileType = (title: string, type: string) => {
|
||||
return title.endsWith(type)
|
||||
}
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
if (currentPreview.value) {
|
||||
copy(currentPreview.value?.content)
|
||||
}
|
||||
}
|
||||
watch(copied, () => {
|
||||
if (copied.value) {
|
||||
Message.success('复制成功')
|
||||
}
|
||||
})
|
||||
|
||||
const selectedKeys = ref()
|
||||
// 选择文件预览
|
||||
const onSelectPreview = (keys: (string | number)[]) => {
|
||||
if (typeof keys[0] === 'string') {
|
||||
currentPreview.value = genPreviewList.value.filter((p) => p.fileName === keys[0])[0]
|
||||
selectedKeys.value = keys
|
||||
} else {
|
||||
const expandedKeys = treeRef.value.getExpandedNodes().map((node) => node.key)
|
||||
treeRef.value.expandNode(keys[0], !expandedKeys.includes(keys[0]))
|
||||
}
|
||||
}
|
||||
|
||||
// 打开
|
||||
const onPreview = async (tableName: string) => {
|
||||
const onOpen = async (tableName: string) => {
|
||||
treeData.value = []
|
||||
previewTableName.value = tableName
|
||||
const { data } = await genPreview(tableName)
|
||||
@@ -150,42 +179,10 @@ const onPreview = async (tableName: string) => {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 选择文件预览
|
||||
const onSelectPreview = (keys: (string | number)[]) => {
|
||||
if (typeof keys[0] === 'string') {
|
||||
currentPreview.value = genPreviewList.value.filter((p) => p.fileName === keys[0])[0]
|
||||
selectedKeys.value = keys
|
||||
} else {
|
||||
const expandedKeys = treeRef.value.getExpandedNodes().map((node) => node.key)
|
||||
treeRef.value.expandNode(keys[0], !expandedKeys.includes(keys[0]))
|
||||
}
|
||||
}
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
if (currentPreview.value) {
|
||||
copy(currentPreview.value?.content)
|
||||
}
|
||||
}
|
||||
watch(copied, () => {
|
||||
if (copied.value) {
|
||||
Message.success('复制成功')
|
||||
}
|
||||
})
|
||||
|
||||
// 下载
|
||||
const onDownload = () => {
|
||||
emit('generate', [previewTableName.value])
|
||||
}
|
||||
// 校验文件类型
|
||||
const checkFileType = (title: string, type: string) => {
|
||||
return title.endsWith(type)
|
||||
}
|
||||
|
||||
defineExpose({ onPreview })
|
||||
defineExpose({ onOpen })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-tree-show-line .arco-tree-node-is-leaf:not(.arco-tree-node-is-tail) .arco-tree-node-indent::after) {
|
||||
content: none;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="table-page">
|
||||
<GiTable
|
||||
row-key="tableName"
|
||||
title="代码生成"
|
||||
row-key="tableName"
|
||||
:data="dataList"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
@@ -23,10 +23,11 @@
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link @click="onConfig(record.tableName, record.comment)">配置</a-link>
|
||||
<a-link v-permission="['code:generator:config']" title="配置" @click="onConfig(record.tableName, record.comment)">配置</a-link>
|
||||
<a-link
|
||||
:title="record.createTime ? '生成' : '请先进行生成配置'"
|
||||
v-permission="['code:generator:preview']"
|
||||
:disabled="!record.createTime"
|
||||
:title="record.createTime ? '生成' : '请先进行生成配置'"
|
||||
@click="onPreview(record.tableName)"
|
||||
>
|
||||
生成
|
||||
@@ -42,12 +43,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import GenConfigDrawer from './GenConfigDrawer.vue'
|
||||
import { generate, listGenConfig } from '@/apis/tool'
|
||||
import { generate, listGenConfig } from '@/apis/code/generator'
|
||||
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
||||
import { useTable } from '@/hooks'
|
||||
import { isMobile } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'Generator' })
|
||||
defineOptions({ name: 'CodeGenerator' })
|
||||
const GenPreviewModal = defineAsyncComponent(() => import('./GenPreviewModal.vue'))
|
||||
|
||||
const queryForm = reactive({
|
||||
@@ -60,7 +61,6 @@ const {
|
||||
pagination,
|
||||
search,
|
||||
} = useTable((page) => listGenConfig({ ...queryForm, ...page }), { immediate: true })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -76,7 +76,7 @@ const columns: TableInstanceColumns[] = [
|
||||
{ title: '模块包名', dataIndex: 'packageName', ellipsis: true, tooltip: true },
|
||||
{ title: '配置时间', dataIndex: 'createTime', width: 180 },
|
||||
{ title: '修改时间', dataIndex: 'updateTime', width: 180 },
|
||||
{ title: '操作', slotName: 'action', width: 180, align: 'center', fixed: !isMobile() ? 'right' : undefined },
|
||||
{ title: '操作', dataIndex: 'action', slotName: 'action', width: 160, align: 'center', fixed: !isMobile() ? 'right' : undefined },
|
||||
]
|
||||
|
||||
// 重置
|
||||
@@ -88,13 +88,13 @@ const reset = () => {
|
||||
const GenConfigDrawerRef = ref<InstanceType<typeof GenConfigDrawer>>()
|
||||
// 配置
|
||||
const onConfig = (tableName: string, comment: string) => {
|
||||
GenConfigDrawerRef.value?.onConfig(tableName, comment)
|
||||
GenConfigDrawerRef.value?.onOpen(tableName, comment)
|
||||
}
|
||||
|
||||
const GenPreviewModalRef = ref<InstanceType<typeof GenPreviewModal>>()
|
||||
// 预览
|
||||
const onPreview = (tableName: string) => {
|
||||
GenPreviewModalRef.value?.onPreview(tableName)
|
||||
GenPreviewModalRef.value?.onOpen(tableName)
|
||||
}
|
||||
|
||||
// 生成
|
||||
@@ -123,4 +123,4 @@ const onGenerate = async (tableNames: Array<string>) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -200,7 +200,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-card-body) {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -40,4 +40,4 @@ import AccessTimeslot from '@/views/dashboard/analysis/components/AccessTimeslot
|
||||
defineOptions({ name: 'Analysis' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -19,7 +19,7 @@ import { goodTimeText } from '@/utils'
|
||||
const userStore = useUserStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-statistic-title) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ import Docs from './components/Docs.vue'
|
||||
defineOptions({ name: 'Workplace' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ import ErrorPage from './components/ErrorPage.vue'
|
||||
defineOptions({ name: 'Error403' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -8,4 +8,4 @@ import ErrorPage from './components/ErrorPage.vue'
|
||||
defineOptions({ name: 'Error404' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -8,4 +8,4 @@ import ErrorPage from './components/ErrorPage.vue'
|
||||
defineOptions({ name: 'Error500' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -42,7 +42,7 @@ const back = () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.error-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -135,7 +135,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.arco-input-wrapper,
|
||||
:deep(.arco-select-view-single) {
|
||||
height: 40px;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.login-bg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -138,7 +138,7 @@ const getCaptcha = async (captchaReq: BehaviorCaptchaReq) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.arco-input-wrapper,
|
||||
:deep(.arco-select-view-single) {
|
||||
height: 40px;
|
||||
|
||||
@@ -90,7 +90,7 @@ const onModify = async () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.arco-input-wrapper,
|
||||
:deep(.arco-select-view-single) {
|
||||
height: 40px;
|
||||
|
||||
@@ -137,7 +137,7 @@ const getCaptcha = async (captchaReq: BehaviorCaptchaReq) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.arco-input-wrapper,
|
||||
:deep(.arco-select-view-single) {
|
||||
height: 40px;
|
||||
|
||||
@@ -117,7 +117,7 @@ const onOauth = async (source: string) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
@media screen and (max-width: 570px) {
|
||||
.pc {
|
||||
display: none !important;
|
||||
|
||||
@@ -76,7 +76,7 @@ const title = computed(() => appStore.getTitle())
|
||||
const logo = computed(() => appStore.getLogo())
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
@media screen and (max-width: 570px) {
|
||||
.pc {
|
||||
display: none !important;
|
||||
|
||||
@@ -44,7 +44,7 @@ const change = (key: string | number) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-tabs .arco-tabs-nav-type-card-gutter .arco-tabs-tab-active) {
|
||||
box-shadow: inset 0 2px 0 rgb(var(--primary-6)), inset -1px 0 0 var(--color-border-2),
|
||||
inset 1px 0 0 var(--color-border-2);
|
||||
|
||||
@@ -135,4 +135,4 @@ const onExport = () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -68,29 +68,29 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { type LogDetailResp, getLog } from '@/apis/monitor'
|
||||
import { type LogDetailResp, getLog as getData } from '@/apis/monitor'
|
||||
|
||||
const dataId = ref('')
|
||||
const dataDetail = ref<LogDetailResp>()
|
||||
const visible = ref(false)
|
||||
|
||||
// 查询详情
|
||||
const getDataDetail = async () => {
|
||||
const res = await getLog(dataId.value)
|
||||
dataDetail.value = res.data
|
||||
const { data } = await getData(dataId.value)
|
||||
dataDetail.value = data
|
||||
}
|
||||
|
||||
const visible = ref(false)
|
||||
// 详情
|
||||
const onDetail = async (id: string) => {
|
||||
// 打开
|
||||
const onOpen = async (id: string) => {
|
||||
dataId.value = id
|
||||
await getDataDetail()
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
defineExpose({ onDetail })
|
||||
defineExpose({ onOpen })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.http :deep(.arco-descriptions-item-label-block) {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<template #default>导出</template>
|
||||
</a-button>
|
||||
</template>
|
||||
<template #createTime="{ record }">
|
||||
<template v-if="has.hasPermOr(['monitor:log:detail'])" #createTime="{ record }">
|
||||
<a-link @click="onDetail(record)">{{ record.createTime }}</a-link>
|
||||
</template>
|
||||
<template #status="{ record }">
|
||||
@@ -62,6 +62,7 @@ import { type LogQuery, type LogResp, exportOperationLog, listLog } from '@/apis
|
||||
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
||||
import DateRangePicker from '@/components/DateRangePicker/index.vue'
|
||||
import { useDownload, useTable } from '@/hooks'
|
||||
import has from '@/utils/has'
|
||||
|
||||
defineOptions({ name: 'OperationLog' })
|
||||
|
||||
@@ -79,7 +80,6 @@ const {
|
||||
pagination,
|
||||
search,
|
||||
} = useTable((page) => listLog({ ...queryForm, ...page }), { immediate: true })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -87,12 +87,13 @@ const columns: TableInstanceColumns[] = [
|
||||
align: 'center',
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize),
|
||||
},
|
||||
{ title: '操作时间', slotName: 'createTime', width: 180 },
|
||||
{ title: '操作时间', dataIndex: 'createTime', slotName: 'createTime', width: 180 },
|
||||
{ title: '操作人', dataIndex: 'createUserString', ellipsis: true, tooltip: true },
|
||||
{ title: '操作内容', dataIndex: 'description', ellipsis: true, tooltip: true },
|
||||
{ title: '所属模块', dataIndex: 'module', align: 'center', ellipsis: true, tooltip: true },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'center',
|
||||
filterable: {
|
||||
@@ -112,7 +113,7 @@ const columns: TableInstanceColumns[] = [
|
||||
},
|
||||
{ title: '操作 IP', dataIndex: 'ip', ellipsis: true, tooltip: true },
|
||||
{ title: '操作地点', dataIndex: 'address', ellipsis: true, tooltip: true },
|
||||
{ title: '耗时', slotName: 'timeTaken', align: 'center' },
|
||||
{ title: '耗时', dataIndex: 'timeTaken', slotName: 'timeTaken', align: 'center' },
|
||||
{ title: '浏览器', dataIndex: 'browser', ellipsis: true, tooltip: true },
|
||||
{ title: '终端系统', dataIndex: 'os', ellipsis: true, tooltip: true },
|
||||
]
|
||||
@@ -149,8 +150,8 @@ const onExport = () => {
|
||||
const OperationLogDetailDrawerRef = ref<InstanceType<typeof OperationLogDetailDrawer>>()
|
||||
// 详情
|
||||
const onDetail = (item: LogResp) => {
|
||||
OperationLogDetailDrawerRef.value?.onDetail(item.id)
|
||||
OperationLogDetailDrawerRef.value?.onOpen(item.id)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="table-page">
|
||||
<GiTable
|
||||
row-key="id"
|
||||
title="在线用户"
|
||||
row-key="id"
|
||||
:data="dataList"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
@@ -21,7 +21,7 @@
|
||||
<template #default>重置</template>
|
||||
</a-button>
|
||||
</template>
|
||||
<template #nickname="{ record }">{{ record.nickname }}({{ record.username }})</template>
|
||||
<template #nickname="{ record }">{{ record.nickname }}({{ record.username }})</template>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-popconfirm
|
||||
@@ -70,7 +70,6 @@ const {
|
||||
pagination,
|
||||
search,
|
||||
} = useTable((page) => listOnlineUser({ ...queryForm, ...page }), { immediate: true })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -78,7 +77,7 @@ const columns: TableInstanceColumns[] = [
|
||||
align: 'center',
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize),
|
||||
},
|
||||
{ title: '用户昵称', slotName: 'nickname', ellipsis: true, tooltip: true },
|
||||
{ title: '用户昵称', dataIndex: 'nickname', slotName: 'nickname', ellipsis: true, tooltip: true },
|
||||
{ title: '登录 IP', dataIndex: 'ip', ellipsis: true, tooltip: true },
|
||||
{ title: '登录地点', dataIndex: 'address', ellipsis: true, tooltip: true },
|
||||
{ title: '浏览器', dataIndex: 'browser', ellipsis: true, tooltip: true },
|
||||
@@ -87,6 +86,7 @@ const columns: TableInstanceColumns[] = [
|
||||
{ title: '最后活跃时间', dataIndex: 'lastActiveTime', width: 180 },
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slotName: 'action',
|
||||
align: 'center',
|
||||
fixed: !isMobile() ? 'right' : undefined,
|
||||
@@ -110,4 +110,4 @@ const handleKickout = (token: string) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -41,4 +41,4 @@ const onDetail = async (id: string) => {
|
||||
defineExpose({ onDetail })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -166,4 +166,4 @@ const onRefreshAK = async (record: AppResp) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
:title="title"
|
||||
:mask-closable="false"
|
||||
:esc-to-close="false"
|
||||
:modal-style="{ maxWidth: '700px' }"
|
||||
:body-style="{ maxHeight: width >= 700 ? '76vh' : '100vh' }"
|
||||
:width="width >= 700 ? '90%' : '100%'"
|
||||
:width="width >= 600 ? 600 : '100%'"
|
||||
@before-ok="save"
|
||||
@close="reset"
|
||||
>
|
||||
@@ -172,6 +170,7 @@
|
||||
</a-row>
|
||||
</fieldset>
|
||||
</a-form>
|
||||
|
||||
<CronGeneratorModal ref="genModal" @ok="(e) => form.triggerInterval = e" />
|
||||
</a-modal>
|
||||
</template>
|
||||
@@ -179,7 +178,7 @@
|
||||
<script setup lang="ts">
|
||||
import { type ColProps, type FormInstance, Message } from '@arco-design/web-vue'
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { addJob, listGroup, updateJob } from '@/apis/schedule'
|
||||
import { addJob, listGroup, updateJob } from '@/apis/schedule/job'
|
||||
import { useForm } from '@/hooks'
|
||||
import { useDict } from '@/hooks/app'
|
||||
import CronGeneratorModal from '@/components/GenCron/CronModel/index.vue'
|
||||
@@ -187,8 +186,18 @@ import CronGeneratorModal from '@/components/GenCron/CronModel/index.vue'
|
||||
const emit = defineEmits<{
|
||||
(e: 'save-success'): void
|
||||
}>()
|
||||
const colProps: ColProps = { xs: 24, sm: 24, md: 12, lg: 12, xl: 12, xxl: 12 }
|
||||
|
||||
const { width } = useWindowSize()
|
||||
|
||||
const colProps: ColProps = { xs: 24, sm: 24, md: 12, lg: 12, xl: 12, xxl: 12 }
|
||||
|
||||
const dataId = ref()
|
||||
const visible = ref(false)
|
||||
const isUpdate = computed(() => !!dataId.value)
|
||||
const title = computed(() => (isUpdate.value ? '修改任务' : '新增任务'))
|
||||
const formRef = ref<FormInstance>()
|
||||
const groupList = ref()
|
||||
const genModal = ref()
|
||||
const { job_trigger_type_enum, job_task_type_enum, job_route_strategy_enum, job_block_strategy_enum } = useDict(
|
||||
'job_trigger_type_enum',
|
||||
'job_task_type_enum',
|
||||
@@ -196,11 +205,6 @@ const { job_trigger_type_enum, job_task_type_enum, job_route_strategy_enum, job_
|
||||
'job_block_strategy_enum',
|
||||
)
|
||||
|
||||
const dataId = ref()
|
||||
const isUpdate = computed(() => !!dataId.value)
|
||||
const title = computed(() => (isUpdate.value ? '修改任务' : '新增任务'))
|
||||
const formRef = ref<FormInstance>()
|
||||
const genModal = ref()
|
||||
const rules: FormInstance['rules'] = {
|
||||
groupName: [{ required: true, message: '请选择任务组' }],
|
||||
jobName: [{ required: true, message: '请输入任务名称' }],
|
||||
@@ -235,41 +239,31 @@ const reset = () => {
|
||||
resetForm()
|
||||
}
|
||||
|
||||
const groupList = ref()
|
||||
// 查询任务组列表
|
||||
const getGroupList = async () => {
|
||||
const { data } = await listGroup()
|
||||
groupList.value = data?.map((item: string) => ({
|
||||
label: item,
|
||||
value: item,
|
||||
}))
|
||||
}
|
||||
|
||||
const visible = ref(false)
|
||||
// 新增
|
||||
const onAdd = () => {
|
||||
reset()
|
||||
getGroupList()
|
||||
dataId.value = undefined
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 修改
|
||||
const onUpdate = async (record: any) => {
|
||||
await getGroupList()
|
||||
reset()
|
||||
dataId.value = record.id
|
||||
Object.assign(form, record)
|
||||
// 切片任务,解析 argsStr 并赋值给 args
|
||||
if (form.taskType === 3 && form.argsStr) {
|
||||
try {
|
||||
const parsedArgs = JSON.parse(form.argsStr)
|
||||
args.value = parsedArgs.map((arg: any) => ({ value: arg }))
|
||||
} catch (error: any) {
|
||||
Message.error(error)
|
||||
}
|
||||
// 触发类型切换
|
||||
const triggerTypeChange = () => {
|
||||
switch (form.triggerType) {
|
||||
case 2:
|
||||
form.triggerInterval = 60
|
||||
break
|
||||
case 3:
|
||||
form.triggerInterval = ''
|
||||
break
|
||||
}
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 新增切片参数
|
||||
const onAddArgs = () => {
|
||||
args.value.push({ value: '' })
|
||||
}
|
||||
|
||||
// 删除切片参数
|
||||
const onDeleteArgs = (index) => {
|
||||
args.value.splice(index, 1)
|
||||
}
|
||||
|
||||
// 打开生成表达式
|
||||
const openGeneratorCron = (cron: string) => {
|
||||
genModal.value.open(cron)
|
||||
}
|
||||
|
||||
// 保存
|
||||
@@ -295,30 +289,43 @@ const save = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 触发类型切换
|
||||
const triggerTypeChange = () => {
|
||||
switch (form.triggerType) {
|
||||
case 2:
|
||||
form.triggerInterval = 60
|
||||
break
|
||||
case 3:
|
||||
form.triggerInterval = ''
|
||||
break
|
||||
// 查询任务组列表
|
||||
const getGroupList = async () => {
|
||||
const { data } = await listGroup()
|
||||
groupList.value = data?.map((item: string) => ({
|
||||
label: item,
|
||||
value: item,
|
||||
}))
|
||||
}
|
||||
|
||||
// 新增
|
||||
const onAdd = async () => {
|
||||
reset()
|
||||
dataId.value = undefined
|
||||
if (!groupList.value.length) {
|
||||
await getGroupList()
|
||||
}
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 新增切片参数
|
||||
const onAddArgs = () => {
|
||||
args.value.push({ value: '' })
|
||||
}
|
||||
// 删除切片参数
|
||||
const onDeleteArgs = (index) => {
|
||||
args.value.splice(index, 1)
|
||||
}
|
||||
|
||||
// 打开生成表达式
|
||||
const openGeneratorCron = (cron: string) => {
|
||||
genModal.value.open(cron)
|
||||
// 修改
|
||||
const onUpdate = async (record: any) => {
|
||||
reset()
|
||||
dataId.value = record.id
|
||||
if (!groupList.value.length) {
|
||||
await getGroupList()
|
||||
}
|
||||
Object.assign(form, record)
|
||||
// 切片任务,解析 argsStr 并赋值给 args
|
||||
if (form.taskType === 3 && form.argsStr) {
|
||||
try {
|
||||
const parsedArgs = JSON.parse(form.argsStr)
|
||||
args.value = parsedArgs.map((arg: any) => ({ value: arg }))
|
||||
} catch (error: any) {
|
||||
Message.error(error)
|
||||
}
|
||||
}
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
defineExpose({ onAdd, onUpdate })
|
||||
|
||||
@@ -40,6 +40,9 @@ import type { JobResp } from '@/apis/schedule'
|
||||
import { useDict } from '@/hooks/app'
|
||||
|
||||
const { width } = useWindowSize()
|
||||
|
||||
const dataDetail = ref<JobResp>()
|
||||
const visible = ref(false)
|
||||
const { job_status_enum, job_trigger_type_enum, job_task_type_enum, job_route_strategy_enum, job_block_strategy_enum } = useDict(
|
||||
'job_status_enum',
|
||||
'job_trigger_type_enum',
|
||||
@@ -48,13 +51,11 @@ const { job_status_enum, job_trigger_type_enum, job_task_type_enum, job_route_st
|
||||
'job_block_strategy_enum',
|
||||
)
|
||||
|
||||
const visible = ref(false)
|
||||
const dataDetail = ref<JobResp>()
|
||||
// 详情
|
||||
const onDetail = (record: JobResp) => {
|
||||
// 打开
|
||||
const onOpen = (record: JobResp) => {
|
||||
dataDetail.value = record
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
defineExpose({ onDetail })
|
||||
defineExpose({ onOpen })
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:data="dataList"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1500 }"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1300 }"
|
||||
:pagination="pagination"
|
||||
:disabled-tools="['size']"
|
||||
:disabled-column-keys="['name']"
|
||||
@@ -33,7 +33,7 @@
|
||||
<template #default>新增</template>
|
||||
</a-button>
|
||||
</template>
|
||||
<template #jobName="{ record }">
|
||||
<template v-if="has.hasPermOr(['schedule:job:detail'])" #jobName="{ record }">
|
||||
<a-link @click="onDetail(record)">{{ record.jobName }}</a-link>
|
||||
</template>
|
||||
<template #triggerType="{ record }">
|
||||
@@ -63,12 +63,12 @@
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link @click="onLog(record)">日志</a-link>
|
||||
<a-link v-permission="['schedule:log:list']" title="日志" @click="onLog(record)">日志</a-link>
|
||||
<a-popconfirm content="是否确定立即执行一次任务?" type="warning" @ok="onTrigger(record)">
|
||||
<a-link v-permission="['schedule:job:trigger']">执行</a-link>
|
||||
<a-link v-permission="['schedule:job:trigger']" title="执行">执行</a-link>
|
||||
</a-popconfirm>
|
||||
<a-link v-permission="['schedule:job:update']" @click="onUpdate(record)">修改</a-link>
|
||||
<a-link v-permission="['schedule:job:delete']" status="danger" @click="onDelete(record)">删除</a-link>
|
||||
<a-link v-permission="['schedule:job:update']" title="修改" @click="onUpdate(record)">修改</a-link>
|
||||
<a-link v-permission="['schedule:job:delete']" status="danger" title="删除" @click="onDelete(record)">删除</a-link>
|
||||
</a-space>
|
||||
</template>
|
||||
</GiTable>
|
||||
@@ -97,6 +97,7 @@ const { job_status_enum, job_trigger_type_enum, job_task_type_enum } = useDict('
|
||||
const queryForm = reactive<JobQuery>({
|
||||
groupName: '',
|
||||
})
|
||||
|
||||
const {
|
||||
tableData: dataList,
|
||||
loading,
|
||||
@@ -104,7 +105,6 @@ const {
|
||||
search,
|
||||
handleDelete,
|
||||
} = useTable((page) => listJob({ ...queryForm, ...page }), { immediate: false })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -115,17 +115,22 @@ const columns: TableInstanceColumns[] = [
|
||||
{ title: '任务名称', dataIndex: 'jobName', slotName: 'jobName', minWidth: 100, ellipsis: true, tooltip: true },
|
||||
{ title: '调度类型', dataIndex: 'triggerType', slotName: 'triggerType', minWidth: 130 },
|
||||
{ title: '任务类型', dataIndex: 'taskType', slotName: 'taskType', minWidth: 130, ellipsis: true, tooltip: true },
|
||||
{ title: '状态', dataIndex: 'jobStatus', align: 'center', slotName: 'jobStatus' },
|
||||
{ title: '状态', dataIndex: 'jobStatus', slotName: 'jobStatus', align: 'center' },
|
||||
{ title: '描述', dataIndex: 'description', minWidth: 130, ellipsis: true, tooltip: true },
|
||||
{ title: '创建时间', dataIndex: 'createDt', width: 180 },
|
||||
{ title: '修改时间', dataIndex: 'updateDt', width: 180, show: false },
|
||||
{
|
||||
title: '操作',
|
||||
slotName: 'action',
|
||||
width: 130,
|
||||
width: 200,
|
||||
align: 'center',
|
||||
fixed: !isMobile() ? 'right' : undefined,
|
||||
show: has.hasPermOr(['schedule:job:trigger', 'schedule:job:update', 'schedule:job:delete']),
|
||||
show: has.hasPermOr([
|
||||
'schedule:log:list',
|
||||
'schedule:job:trigger',
|
||||
'schedule:job:update',
|
||||
'schedule:job:delete',
|
||||
]),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -151,7 +156,7 @@ const reset = () => {
|
||||
// 删除
|
||||
const onDelete = (record: JobResp) => {
|
||||
return handleDelete(() => deleteJob(record.id), {
|
||||
content: `是否确定删除任务 [${record.jobName}]?`,
|
||||
content: `是否确定删除任务「${record.jobName}」?`,
|
||||
showModal: true,
|
||||
})
|
||||
}
|
||||
@@ -188,13 +193,15 @@ const onUpdate = (record: JobResp) => {
|
||||
const JobDetailDrawerRef = ref<InstanceType<typeof JobDetailDrawer>>()
|
||||
// 详情
|
||||
const onDetail = (record: JobResp) => {
|
||||
JobDetailDrawerRef.value?.onDetail(record)
|
||||
JobDetailDrawerRef.value?.onOpen(record)
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
// 日志
|
||||
const onLog = (record: JobResp) => {
|
||||
router.push({ path: '/schedule/log', query: { jobId: record.id, jobName: record.jobName, groupName: record.groupName } })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getGroupList()
|
||||
})
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible" title="任务日志详情" :body-style="{ maxHeight: '80vh', overflow: 'auto' }"
|
||||
:width="width >= 1500 ? 1500 : '100%'" :footer="false" @close="closed"
|
||||
<a-drawer
|
||||
v-model:visible="visible"
|
||||
title="任务日志详情"
|
||||
:width="width >= 1300 ? 1300 : '100%'"
|
||||
:footer="false"
|
||||
@close="closed"
|
||||
>
|
||||
<div style="display: flex;">
|
||||
<div style="padding: 10px 10px;">
|
||||
<div class="job_list">
|
||||
<div
|
||||
v-for="item in dataList" :key="item.id" :class="`job_list_item ${item.id === activeId ? 'active' : ''}`"
|
||||
v-for="item in dataList"
|
||||
:key="item.id"
|
||||
:class="`job_list_item ${item.id === activeId ? 'active' : ''}`"
|
||||
@click="onStartInfo(item)"
|
||||
>
|
||||
<div class="content">
|
||||
<span class="title">{{ item.clientInfo.split('@')[1] }}</span>
|
||||
<span class="status">
|
||||
<a-tag bordered :color="statusList[item.taskStatus].color">{{ statusList[item.taskStatus].title
|
||||
}}</a-tag>
|
||||
<a-tag bordered :color="statusList[item.taskStatus].color">{{ statusList[item.taskStatus].title }}</a-tag>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,17 +28,19 @@
|
||||
<GiCodeView :code-json="content" />
|
||||
</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import dayjs from 'dayjs'
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { type JobInstanceQuery, type JobInstanceResp, type JobLogResp, listJobInstance, listJobInstanceLog } from '@/apis/schedule'
|
||||
|
||||
const { width } = useWindowSize()
|
||||
|
||||
const queryForm = reactive<JobInstanceQuery>({})
|
||||
const dataList = ref<JobInstanceResp[]>([])
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const activeId = ref<string | number>('')
|
||||
const statusList = {
|
||||
@@ -70,8 +76,6 @@ const statusList = {
|
||||
},
|
||||
}
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
// 格式化日志
|
||||
const formatLog = (log: any) => {
|
||||
const date = new Date(Number.parseInt(log.time_stamp))
|
||||
@@ -131,22 +135,23 @@ const getInstanceList = async (query: JobInstanceQuery = { ...queryForm }) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 详情
|
||||
const onDetail = (record: JobLogResp) => {
|
||||
visible.value = true
|
||||
// 更新 queryForm
|
||||
queryForm.jobId = record.jobId
|
||||
queryForm.taskBatchId = record.id
|
||||
getInstanceList()
|
||||
}
|
||||
|
||||
const closed = () => {
|
||||
clearInterval(setIntervalNode.value)
|
||||
}
|
||||
onUnmounted(() => {
|
||||
clearInterval(setIntervalNode.value)
|
||||
})
|
||||
defineExpose({ onDetail })
|
||||
|
||||
// 打开
|
||||
const onOpen = async (record: JobLogResp) => {
|
||||
// 更新 queryForm
|
||||
queryForm.jobId = record.jobId
|
||||
queryForm.taskBatchId = record.id
|
||||
visible.value = true
|
||||
await getInstanceList()
|
||||
}
|
||||
|
||||
defineExpose({ onOpen })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -6,7 +6,7 @@
|
||||
:data="dataList"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1500 }"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1300 }"
|
||||
:pagination="pagination"
|
||||
:disabled-tools="['size']"
|
||||
@refresh="search"
|
||||
@@ -42,15 +42,16 @@
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link @click="onDetail(record)">详情</a-link>
|
||||
<a-link v-permission="['schedule:log:detail']" title="详情" @click="onDetail(record)">详情</a-link>
|
||||
<a-popconfirm content="是否确定停止本次执行?" type="warning" @ok="onStop(record)">
|
||||
<a-link v-if="record.taskBatchStatus === 2" v-permission="['schedule:log:stop']" status="danger">停止</a-link>
|
||||
<a-link v-if="record.taskBatchStatus === 2" v-permission="['schedule:log:stop']" status="danger" title="停止">停止</a-link>
|
||||
</a-popconfirm>
|
||||
<a-popconfirm content="是否确定重试本次执行?" type="warning" @ok="onRetry(record)">
|
||||
<a-link
|
||||
v-if="record.taskBatchStatus === 4 || record.taskBatchStatus === 5 || record.taskBatchStatus === 6"
|
||||
v-permission="['schedule:log:retry']"
|
||||
status="danger"
|
||||
title="重试"
|
||||
>
|
||||
重试
|
||||
</a-link>
|
||||
@@ -59,7 +60,7 @@
|
||||
</template>
|
||||
</GiTable>
|
||||
|
||||
<JobLogDetailModal ref="JobLogDetailModalRef" />
|
||||
<LogDetailDrawer ref="LogDetailDrawerRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -67,7 +68,7 @@
|
||||
import { Message } from '@arco-design/web-vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import dayjs from 'dayjs'
|
||||
import JobLogDetailModal from './LogDetailModal.vue'
|
||||
import LogDetailDrawer from './LogDetailDrawer.vue'
|
||||
import { type JobLogQuery, type JobLogResp, listGroup, listJobLog, retryJob, stopJob } from '@/apis/schedule'
|
||||
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
||||
import { useTable } from '@/hooks'
|
||||
@@ -85,13 +86,13 @@ const queryForm = reactive<JobLogQuery>({
|
||||
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||
],
|
||||
})
|
||||
|
||||
const {
|
||||
tableData: dataList,
|
||||
pagination,
|
||||
loading,
|
||||
search,
|
||||
} = useTable((page) => listJobLog({ ...queryForm, ...page }), { immediate: false })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -108,10 +109,10 @@ const columns: TableInstanceColumns[] = [
|
||||
{
|
||||
title: '操作',
|
||||
slotName: 'action',
|
||||
width: 60,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: !isMobile() ? 'right' : undefined,
|
||||
show: has.hasPermOr(['schedule:log:stop', 'schedule:log:retry']),
|
||||
show: has.hasPermOr(['schedule:log:detail', 'schedule:log:stop', 'schedule:log:retry']),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -149,10 +150,10 @@ const onRetry = (record: JobLogResp) => {
|
||||
})
|
||||
}
|
||||
|
||||
const JobLogDetailModalRef = ref<InstanceType<typeof JobLogDetailModal>>()
|
||||
// 查看日志详情
|
||||
const LogDetailDrawerRef = ref<InstanceType<typeof LogDetailDrawer>>()
|
||||
// 详情
|
||||
const onDetail = (record: JobLogResp) => {
|
||||
JobLogDetailModalRef.value?.onDetail(record)
|
||||
LogDetailDrawerRef.value?.onOpen(record)
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
@@ -276,7 +276,7 @@ const open = (type: string) => {
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.captcha-btn {
|
||||
margin-left: 12px;
|
||||
min-width: 98px;
|
||||
|
||||
@@ -141,4 +141,4 @@ const onReadAll = async () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -82,4 +82,4 @@ const onUpdate = (type: string) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -102,4 +102,4 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -24,7 +24,7 @@ import PasswordPolicy from './Security.vue'
|
||||
defineOptions({ name: 'SettingProfile' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.gi_page {
|
||||
background-color: var(--color-bg-1);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.logo {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
|
||||
@@ -172,7 +172,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-form-item.arco-form-item-has-help) {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.input-width {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
@@ -168,4 +168,4 @@ const onUpdate = async (id: string) => {
|
||||
defineExpose({ onAdd, onUpdate })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -169,4 +169,4 @@ const onUpdate = (record: DeptResp) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -130,4 +130,4 @@ const onUpdate = async (id: string) => {
|
||||
defineExpose({ onAdd, onUpdate })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -129,7 +129,10 @@ const reset = () => {
|
||||
|
||||
// 删除
|
||||
const onDelete = (record: DictItemResp) => {
|
||||
return handleDelete(() => deleteDictItem(record.id), { content: `是否确定删除 [${record.label}]?`, showModal: true })
|
||||
return handleDelete(() => deleteDictItem(record.id), {
|
||||
content: `是否确定删除字典「${record.label}」?`,
|
||||
showModal: true,
|
||||
})
|
||||
}
|
||||
|
||||
// 根据选中字典查询
|
||||
@@ -150,7 +153,7 @@ const onUpdate = (record: DictItemResp) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.page_header {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
@@ -97,4 +97,4 @@ const onUpdate = async (id: string) => {
|
||||
defineExpose({ onAdd, onUpdate })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -34,7 +34,7 @@ const onClick = (mode: string) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-menu-inner) {
|
||||
padding: 4px;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-tree-node) {
|
||||
line-height: normal;
|
||||
border-radius: var(--border-radius-medium);
|
||||
|
||||
@@ -82,7 +82,7 @@ const close = () => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.audio-box {
|
||||
width: 300px;
|
||||
position: fixed;
|
||||
|
||||
@@ -30,4 +30,4 @@ const form = reactive({
|
||||
defineExpose({ formRef })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -23,4 +23,4 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -16,7 +16,7 @@ import FileMain from './main/FileMain/index.vue'
|
||||
defineOptions({ name: 'SystemFile' })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.file-manage {
|
||||
flex: 1;
|
||||
padding: $margin;
|
||||
|
||||
@@ -46,7 +46,7 @@ const onClickItem = (item: FileTypeListItem) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
:deep(.arco-card) {
|
||||
.arco-card-header {
|
||||
border-bottom-style: dashed;
|
||||
|
||||
@@ -109,7 +109,7 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.statistic-space {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -84,7 +84,7 @@ const handleRightMenuClick = (mode: string, item: FileItem) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.file-grid {
|
||||
flex: 1;
|
||||
margin-top: 12px;
|
||||
|
||||
@@ -32,7 +32,7 @@ const getFileImg = computed<string>(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.file-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user