5 Commits

Author SHA1 Message Date
tk
06b7aa4ae8 chore(release): 2.3.1 2024-12-13 16:15:37 +08:00
tk
b1678e2537 refactor: ♻️ 前端体验优化
[skip ci]
2024-12-13 16:15:02 +08:00
442a69f90d fix: 🐛 修复一些样式问题 2024-12-12 23:23:39 +08:00
f1fd53f72b build: 📦 git.config
[skip ci]
2024-12-12 20:12:04 +08:00
tk
ae4ed8b3ef chore(release): 2.3.0 2024-12-12 18:16:03 +08:00
23 changed files with 473 additions and 298 deletions

View File

@ -2,6 +2,59 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [2.3.1](https://github.com/nsnail/NetAdmin/compare/v2.1.0...v2.3.1) (2024-12-13)
### Features
* ✨ 菜单复制 ([#214](https://github.com/nsnail/NetAdmin/issues/214)) ([81d9b0b](https://github.com/nsnail/NetAdmin/commit/81d9b0b3bb280661ceffa61aa6e9d612fb7ec52c))
* ✨ 分组统计功能 ([0b036e9](https://github.com/nsnail/NetAdmin/commit/0b036e9d67ffdf7a07c772606009f02744e6a3c3))
* ✨ 框架代码同步 ([098cfc1](https://github.com/nsnail/NetAdmin/commit/098cfc135e781a0cf172cd1289e5e871c7a76419))
* ✨ 框架代码同步 ([7256626](https://github.com/nsnail/NetAdmin/commit/725662693b7b47f6fae4c1917dd8d80220c7640a))
* ✨ 文档管理 ([#221](https://github.com/nsnail/NetAdmin/issues/221)) ([7ed3040](https://github.com/nsnail/NetAdmin/commit/7ed30406c9f721a12f0b756ec8884a1882242b93))
* ✨ select-filter badge icon ([#217](https://github.com/nsnail/NetAdmin/issues/217)) ([4d857f1](https://github.com/nsnail/NetAdmin/commit/4d857f1861b1256980e7cc59e2ab6a5f7d966da2))
### Bug Fixes
* 🐛 按钮文字提示 ([#227](https://github.com/nsnail/NetAdmin/issues/227)) ([c88c8d2](https://github.com/nsnail/NetAdmin/commit/c88c8d293d44f2707f3b5232e6a40a141af9981c))
* 🐛 导出界面报错 ([#213](https://github.com/nsnail/NetAdmin/issues/213)) ([ef2f0de](https://github.com/nsnail/NetAdmin/commit/ef2f0de095e314f34bec21c0a2ccdb51423a163b))
* 🐛 导出文件的responseType ([#205](https://github.com/nsnail/NetAdmin/issues/205)) ([841a419](https://github.com/nsnail/NetAdmin/commit/841a4195e77aa96e3c6c72626c1add3f71a310aa))
* 🐛 个性主题色冲突 ([4e4a1d0](https://github.com/nsnail/NetAdmin/commit/4e4a1d0dff7f3698e9a9cfcf46368260cfd70cbd))
* 🐛 请求日志批量插入,漏写了登录日志 ([#210](https://github.com/nsnail/NetAdmin/issues/210)) ([6c71c74](https://github.com/nsnail/NetAdmin/commit/6c71c74a27617c7d0530a5f6eaff650ecfd4eaec))
* 🐛 修复一些样式问题 ([442a69f](https://github.com/nsnail/NetAdmin/commit/442a69f90de179539f78c01d967572f83bd2eff8))
* 🐛 用户选择器报错 ([#220](https://github.com/nsnail/NetAdmin/issues/220)) ([71bfdaa](https://github.com/nsnail/NetAdmin/commit/71bfdaafa8176cf686b03244ee758de058080a71))
* 🐛 editUser ([ef2a0c3](https://github.com/nsnail/NetAdmin/commit/ef2a0c3280532ac24889279e4780a1b1a2561a6b))
* 🐛 idd ([#208](https://github.com/nsnail/NetAdmin/issues/208)) ([4e9f605](https://github.com/nsnail/NetAdmin/commit/4e9f605ea2cc6fe394068cfea5638e51920b9096))
* 🐛 version 条件重复指定 ([01058ba](https://github.com/nsnail/NetAdmin/commit/01058ba7288bcc645f66de2f78e1d659d55333cf))
* 🐛 version lock ([4eecc0b](https://github.com/nsnail/NetAdmin/commit/4eecc0b4ce09f620f83109949e4c2b67b7f8ba90))
## [2.3.0](https://github.com/nsnail/NetAdmin/compare/v2.1.0...v2.3.0) (2024-12-12)
### Features
* ✨ 菜单复制 ([#214](https://github.com/nsnail/NetAdmin/issues/214)) ([81d9b0b](https://github.com/nsnail/NetAdmin/commit/81d9b0b3bb280661ceffa61aa6e9d612fb7ec52c))
* ✨ 分组统计功能 ([0b036e9](https://github.com/nsnail/NetAdmin/commit/0b036e9d67ffdf7a07c772606009f02744e6a3c3))
* ✨ 框架代码同步 ([098cfc1](https://github.com/nsnail/NetAdmin/commit/098cfc135e781a0cf172cd1289e5e871c7a76419))
* ✨ 框架代码同步 ([7256626](https://github.com/nsnail/NetAdmin/commit/725662693b7b47f6fae4c1917dd8d80220c7640a))
* ✨ 文档管理 ([#221](https://github.com/nsnail/NetAdmin/issues/221)) ([7ed3040](https://github.com/nsnail/NetAdmin/commit/7ed30406c9f721a12f0b756ec8884a1882242b93))
* ✨ select-filter badge icon ([#217](https://github.com/nsnail/NetAdmin/issues/217)) ([4d857f1](https://github.com/nsnail/NetAdmin/commit/4d857f1861b1256980e7cc59e2ab6a5f7d966da2))
### Bug Fixes
* 🐛 按钮文字提示 ([#227](https://github.com/nsnail/NetAdmin/issues/227)) ([c88c8d2](https://github.com/nsnail/NetAdmin/commit/c88c8d293d44f2707f3b5232e6a40a141af9981c))
* 🐛 导出界面报错 ([#213](https://github.com/nsnail/NetAdmin/issues/213)) ([ef2f0de](https://github.com/nsnail/NetAdmin/commit/ef2f0de095e314f34bec21c0a2ccdb51423a163b))
* 🐛 导出文件的responseType ([#205](https://github.com/nsnail/NetAdmin/issues/205)) ([841a419](https://github.com/nsnail/NetAdmin/commit/841a4195e77aa96e3c6c72626c1add3f71a310aa))
* 🐛 个性主题色冲突 ([4e4a1d0](https://github.com/nsnail/NetAdmin/commit/4e4a1d0dff7f3698e9a9cfcf46368260cfd70cbd))
* 🐛 请求日志批量插入,漏写了登录日志 ([#210](https://github.com/nsnail/NetAdmin/issues/210)) ([6c71c74](https://github.com/nsnail/NetAdmin/commit/6c71c74a27617c7d0530a5f6eaff650ecfd4eaec))
* 🐛 用户选择器报错 ([#220](https://github.com/nsnail/NetAdmin/issues/220)) ([71bfdaa](https://github.com/nsnail/NetAdmin/commit/71bfdaafa8176cf686b03244ee758de058080a71))
* 🐛 editUser ([ef2a0c3](https://github.com/nsnail/NetAdmin/commit/ef2a0c3280532ac24889279e4780a1b1a2561a6b))
* 🐛 idd ([#208](https://github.com/nsnail/NetAdmin/issues/208)) ([4e9f605](https://github.com/nsnail/NetAdmin/commit/4e9f605ea2cc6fe394068cfea5638e51920b9096))
* 🐛 version 条件重复指定 ([01058ba](https://github.com/nsnail/NetAdmin/commit/01058ba7288bcc645f66de2f78e1d659d55333cf))
* 🐛 version lock ([4eecc0b](https://github.com/nsnail/NetAdmin/commit/4eecc0b4ce09f620f83109949e4c2b67b7f8ba90))
### [2.2.1](https://github.com/nsnail/NetAdmin/compare/v2.1.0...v2.2.1) (2024-12-04) ### [2.2.1](https://github.com/nsnail/NetAdmin/compare/v2.1.0...v2.2.1) (2024-12-04)

View File

@ -1,5 +1,5 @@
{ {
"version": "2.2.1", "version": "2.3.1",
"devDependencies": { "devDependencies": {
"cz-git": "^1.11.0", "cz-git": "^1.11.0",
"commitizen": "^4.3.1", "commitizen": "^4.3.1",

4
scripts/git.config.cmd Normal file
View File

@ -0,0 +1,4 @@
git config --local core.eol lf
git config --local core.autocrlf false
git config --local core.longpaths true
git config --local pull.rebase false

View File

@ -92,8 +92,8 @@ export default {
// 设置语言 // 设置语言
this.$i18n.locale = this.$TOOL.data.get('APP_SET_LANG') || this.$CONFIG.APP_SET_LANG this.$i18n.locale = this.$TOOL.data.get('APP_SET_LANG') || this.$CONFIG.APP_SET_LANG
//ctrl + enter 触发主按钮点击事件
document.onkeydown = (e) => { document.onkeydown = (e) => {
//ctrl + enter 触发主按钮点击事件
if (e.ctrlKey && e.keyCode === 13) { if (e.ctrlKey && e.keyCode === 13) {
document document
.getElementsByClassName('el-dialog__footer')[0] .getElementsByClassName('el-dialog__footer')[0]
@ -118,9 +118,23 @@ export default {
break break
} }
} }
} else if (e.altKey && e.keyCode === 81) { } else if (e.altKey) {
if (e.keyCode === 81) {
if (e.ctrlKey) {
UseTabs.closeOther()
} else {
UseTabs.close() UseTabs.close()
} }
} else if (e.keyCode === 65) {
document.getElementsByClassName('userbar-btn-search')[0]?.dispatchEvent(
new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: false,
}),
)
}
}
} }
}, },
} }

View File

@ -1,11 +1,16 @@
import colorTool from '@/utils/color' import colorTool from '@/utils/color'
const style = getComputedStyle(document.documentElement)
const el_color_primary = style.getPropertyValue('--el-color-primary')
const el_color_info = style.getPropertyValue('--el-color-info')
const el_text_color_primary = style.getPropertyValue('--el-text-color-primary')
const el_border_color_lighter = style.getPropertyValue('--el-border-color-lighter')
const T = { export default {
async build() {
const style = getComputedStyle(document.documentElement)
let el_color_primary
while ((el_color_primary = style.getPropertyValue('--el-color-primary')) === 'rgba(0, 0, 0, 0)') {
await new Promise((x) => setTimeout(x, 100))
}
const el_color_info = style.getPropertyValue('--el-color-info')
const el_text_color_primary = style.getPropertyValue('--el-text-color-primary')
const el_border_color_lighter = style.getPropertyValue('--el-border-color-lighter')
return {
color: [el_color_primary, colorTool.lighten(el_color_primary, 0.5), ...colorTool.colorSets], color: [el_color_primary, colorTool.lighten(el_color_primary, 0.5), ...colorTool.colorSets],
grid: { grid: {
left: '3%', left: '3%',
@ -87,6 +92,6 @@ const T = {
}, },
}, },
}, },
}
},
} }
export default T

View File

@ -5,8 +5,6 @@
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import T from './echarts-theme-T.js' import T from './echarts-theme-T.js'
echarts.registerTheme('T', T)
const unwarp = (obj) => obj && (obj.__v_raw || obj.valueOf() || obj) const unwarp = (obj) => obj && (obj.__v_raw || obj.valueOf() || obj)
export default { export default {
@ -31,7 +29,7 @@ export default {
option: { option: {
deep: true, deep: true,
handler(v) { handler(v) {
unwarp(this.myChart).setOption(v, { notMerge: true }) unwarp(this.myChart)?.setOption(v, { notMerge: true })
}, },
}, },
}, },
@ -50,11 +48,11 @@ export default {
deactivated() { deactivated() {
this.isActivat = false this.isActivat = false
}, },
mounted() { async mounted() {
this.isActivat = true this.isActivat = true
this.$nextTick(() => { await this.$nextTick()
echarts.registerTheme('T', await T.build())
this.draw() this.draw()
})
}, },
methods: { methods: {
draw() { draw() {

View File

@ -1,64 +1,5 @@
import tool from '@/utils/tool' import tool from '@/utils/tool'
const Time = {
//获取当前时间戳
getUnix: function () {
const date = new Date()
return date.getTime()
},
//获取今天0点0分0秒的时间戳
getTodayUnix: function () {
const date = new Date()
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
date.setMilliseconds(0)
return date.getTime()
},
//获取今年1月1日0点0秒的时间戳
getYearUnix: function () {
const date = new Date()
date.setMonth(0)
date.setDate(1)
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
date.setMilliseconds(0)
return date.getTime()
},
//获取标准年月日
getLastDate: function (time) {
const date = new Date(time)
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return date.getFullYear() + '-' + month + '-' + day
},
//转换时间
getFormatTime: function (timestamp) {
timestamp = new Date(timestamp)
const now = this.getUnix()
const today = this.getTodayUnix()
//var year = this.getYearUnix();
const timer = (now - timestamp) / 1000
let tip
if (timer <= 0) {
tip = '刚刚'
} else if (Math.floor(timer / 60) <= 0) {
tip = '刚刚'
} else if (timer < 3600) {
tip = Math.floor(timer / 60) + '分钟前'
} else if (timer >= 3600 && (timestamp - today >= 0 || Math.floor(timer / 86400) <= 0)) {
tip = Math.floor(timer / 3600) + '小时前'
} else if (timer / 86400 <= 31) {
tip = Math.floor(timer / 86400) + '天前'
} else {
tip = this.getLastDate(timestamp)
}
return tip
},
}
export default (el, binding) => { export default (el, binding) => {
let { value, modifiers } = binding let { value, modifiers } = binding
if (!value) { if (!value) {
@ -68,9 +9,9 @@ export default (el, binding) => {
value = value * 1000 value = value * 1000
} }
if (modifiers.tip) { if (modifiers.tip) {
el.innerHTML = Time.getFormatTime(value) el.innerHTML = tool.time.getFormatTime(value)
el.__timeout__ = setInterval(() => { el.__timeout__ = setInterval(() => {
el.innerHTML = Time.getFormatTime(value) el.innerHTML = tool.time.getFormatTime(value)
}, 60000) }, 60000)
} else { } else {
const format = el.getAttribute('format') || undefined const format = el.getAttribute('format') || undefined

View File

@ -5,6 +5,8 @@
:placeholder="$t('搜索')" :placeholder="$t('搜索')"
:trigger-on-focus="false" :trigger-on-focus="false"
@input="inputChange" @input="inputChange"
@keydown="inputKeyDown"
autofocus
clearable clearable
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
ref="input" ref="input"
@ -25,7 +27,11 @@
<div v-if="result.length <= 0" class="sc-search-no-result">{{ $t('暂无搜索结果') }}</div> <div v-if="result.length <= 0" class="sc-search-no-result">{{ $t('暂无搜索结果') }}</div>
<ul v-else> <ul v-else>
<el-scrollbar max-height="30rem"> <el-scrollbar max-height="30rem">
<li v-for="item in result" :key="item.path" @click="to(item)"> <li
v-for="(item, i) in result"
:class="{ 'sc-search-result-li-hover': this.cursor.index === i }"
:key="item.path"
@click="to(item)">
<el-icon> <el-icon>
<component :is="item.icon || 'el-icon-menu'" /> <component :is="item.icon || 'el-icon-menu'" />
</el-icon> </el-icon>
@ -41,18 +47,55 @@
export default { export default {
data() { data() {
return { return {
cursor: {
position: 0,
index: 0,
},
input: '', input: '',
menu: [], menu: [],
result: [], result: [],
history: [], history: [],
} }
}, },
mounted() { watch: {
result() {
this.cursor.position = 0
this.cursor.index = 0
},
},
async mounted() {
this.history = this.$TOOL.data.get('SEARCH_HISTORY') || [] this.history = this.$TOOL.data.get('SEARCH_HISTORY') || []
this.filterMenu(this.$GLOBAL.menu) this.filterMenu(this.$GLOBAL.menu)
await this.$nextTick()
await new Promise((x) => setTimeout(x, 200))
this.$refs.input.focus() this.$refs.input.focus()
}, },
methods: { methods: {
inputKeyDown(e) {
if (e.keyCode === 13) {
document
.getElementsByClassName('sc-search-result')[0]
?.getElementsByClassName('el-scrollbar__view')[0]
?.children[this.cursor.index]?.dispatchEvent(
new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: false,
}),
)
return
}
if (e.keyCode === 40) {
this.cursor.index = Math.abs(++this.cursor.position % this.result.length)
e.preventDefault()
return
}
if (e.keyCode === 38) {
this.cursor.index = Math.abs(--this.cursor.position % this.result.length)
e.preventDefault()
return
}
},
inputChange(value) { inputChange(value) {
if (value) { if (value) {
this.result = this.menuFilter(value) this.result = this.menuFilter(value)
@ -152,6 +195,9 @@ export default {
} }
.sc-search-history { .sc-search-history {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 1rem; margin-top: 1rem;
} }
@ -182,9 +228,10 @@ export default {
margin-right: 1rem; margin-right: 1rem;
} }
.sc-search-result-li-hover,
.sc-search-result li:hover { .sc-search-result li:hover {
background: var(--el-color-primary); background: var(--el-color-primary) !important;
color: var(--el-color-white); color: var(--el-color-white) !important;
border-color: var(--el-color-primary); border-color: var(--el-color-primary) !important;
} }
</style> </style>

View File

@ -14,11 +14,7 @@
</el-header> </el-header>
<el-main> <el-main>
<el-scrollbar> <el-scrollbar>
<el-menu <el-menu :default-active="$route.meta.active || $route.fullPath" @select="select" router>
:active-text-color="DEFAULT_CONFIG.APP_SET_COLOR"
:default-active="$route.meta.active || $route.fullPath"
@select="select"
router>
<NavMenu :navMenus="menu"></NavMenu> <NavMenu :navMenus="menu"></NavMenu>
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>

View File

@ -10,6 +10,43 @@
</p> </p>
</el-empty> </el-empty>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="12">
<el-empty v-if="!failJobs">
<template #description>
<p>{{ $TOOL.time.getFormatTime(new Date(failJobViewTime).getTime()) }}</p>
<p>至今</p>
<p>未发现新的异常作业</p>
</template>
</el-empty>
<el-card v-else v-for="job in failJobs" :class="`user-bar-jobs-item alert`" :key="job.job.id" shadow="hover">
<div class="user-bar-jobs-item-body">
<div class="jobIcon">
{{ job.httpStatusCode.toUpperCase().slice(0, 2) }}
</div>
<div class="jobMain">
<div class="title">
<h2>{{ job.job.jobName }}</h2>
<p>{{ $t('出错时间:') }}<span v-time.tip="job.createdTime" :title="job.createdTime"></span></p>
<p>
执行耗时<span>{{ $TOOL.groupSeparator(job.duration) }} ms</span>
</p>
</div>
<div class="bottom">
<div class="status failJobs">
{{ job.responseBody }}
</div>
<div class="handler">
<el-button
@click="dialog.jobRecordSave = { mode: 'view', row: { id: job.id } }"
circle
icon="el-icon-view"
type="danger"></el-button>
</div>
</div>
</div>
</div>
</el-card>
</el-col>
<el-col :lg="12"> <el-col :lg="12">
<el-card <el-card
v-for="job in jobs" v-for="job in jobs"
@ -47,49 +84,36 @@
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12">
<el-empty v-if="!failJobs" description="未发现新的异常作业"></el-empty>
<el-card v-else v-for="job in failJobs" :class="`user-bar-jobs-item alert`" :key="job.job.id" shadow="hover">
<div class="user-bar-jobs-item-body">
<div class="jobIcon">
{{ job.httpStatusCode.toUpperCase().slice(0, 2) }}
</div>
<div class="jobMain">
<div class="title">
<h2>{{ job.job.jobName }}</h2>
<p>{{ $t('出错时间:') }}<span v-time.tip="job.createdTime" :title="job.createdTime"></span></p>
<p>
执行耗时<span>{{ $TOOL.groupSeparator(job.duration) }} ms</span>
</p>
</div>
<div class="bottom">
<div class="status failJobs">
{{ job.responseBody }}
</div>
<div class="handler">
<el-button
@click="dialog.jobRecordSave = { mode: 'view', row: { id: job.id } }"
circle
icon="el-icon-view"
type="danger"></el-button>
</div>
</div>
</div>
</div>
</el-card>
</el-col>
</el-row> </el-row>
</el-main> </el-main>
<el-footer class="flex" style="justify-content: space-evenly; height: unset"> <el-footer class="flex" style="justify-content: space-evenly; height: unset">
<div> <div v-if="failJobs">
<el-badge :hidden="jobsCnt === 0" :value="jobsCnt"> <el-badge :hidden="fail === 0" :value="`${$TOOL.time.getFormatTime(new Date(failJobViewTime).getTime())} 至今 ${fail}个`">
<el-button @click="dialog.save = { tabId: 'all' }">{{ $t('作业管理') }}</el-button> <el-button
@click="
() => {
this.$router.push({ path: '/sys/job', query: { view: 'fail' } })
this.$emit('closed')
}
"
plain
type="danger"
>{{ $t('异常日志') }}</el-button
>
</el-badge> </el-badge>
</div> </div>
<el-button @click="refresh" circle icon="el-icon-refresh"></el-button> <el-button @click="refresh" circle icon="el-icon-refresh"></el-button>
<div v-if="failJobs"> <div>
<el-badge :hidden="fail === 0" :value="fail"> <el-badge :hidden="jobsCnt === 0" :value="jobsCnt">
<el-button @click="dialog.save = { tabId: 'fail' }" plain type="danger">{{ $t('异常日志') }}</el-button> <el-button
@click="
() => {
this.$router.push({ path: '/sys/job' })
this.$emit('closed')
}
"
>{{ $t('作业管理') }}</el-button
>
</el-badge> </el-badge>
</div> </div>
</el-footer> </el-footer>
@ -105,7 +129,6 @@
@closed="dialog.jobRecordSave = null" @closed="dialog.jobRecordSave = null"
@mounted="$refs.jobRecordSaveDialog.open(dialog.jobRecordSave)" @mounted="$refs.jobRecordSaveDialog.open(dialog.jobRecordSave)"
ref="jobRecordSaveDialog"></jobRecordSaveDialog> ref="jobRecordSaveDialog"></jobRecordSaveDialog>
<saveDialog v-if="dialog.save" @closed="dialog.save = null" @mounted="$refs.saveDialog.open(dialog.save)" ref="saveDialog"></saveDialog>
</template> </template>
<script> <script>
@ -113,12 +136,16 @@ import { defineAsyncComponent } from 'vue'
const jobSaveDialog = defineAsyncComponent(() => import('@/views/sys/job/all/save.vue')) const jobSaveDialog = defineAsyncComponent(() => import('@/views/sys/job/all/save.vue'))
const jobRecordSaveDialog = defineAsyncComponent(() => import('@/views/sys/job/record/save.vue')) const jobRecordSaveDialog = defineAsyncComponent(() => import('@/views/sys/job/record/save.vue'))
const saveDialog = defineAsyncComponent(() => import('./save.vue'))
export default { export default {
computed: {
failJobViewTime() {
return this.$TOOL.data.get('APP_SET_FAIL_JOB_VIEW_TIME') ?? this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd')
},
},
components: { components: {
jobSaveDialog, jobSaveDialog,
jobRecordSaveDialog, jobRecordSaveDialog,
saveDialog,
}, },
data() { data() {
return { return {
@ -175,7 +202,7 @@ export default {
], ],
field: 'createdTime', field: 'createdTime',
operator: 'greaterThan', operator: 'greaterThan',
value: this.$TOOL.data.get('APP_SET_FAIL_JOB_VIEW_TIME') ?? this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd'), value: this.failJobViewTime,
}, },
}), }),
]) ])

View File

@ -1,44 +0,0 @@
<template>
<sc-dialog v-model="visible" :title="$t('作业中心')" @closed="$emit('closed')" append-to-body destroy-on-close full-screen>
<job v-if="tabId" :statusCodes="statusCodes" :tab="tabId" />
<template #footer>
<el-button @click="visible = false">{{ $t('取消') }}</el-button>
</template>
</sc-dialog>
</template>
<script>
import { defineAsyncComponent } from 'vue'
const job = defineAsyncComponent(() => import('@/views/sys/job/index.vue'))
export default {
components: { job },
data() {
return {
statusCodes: null,
tabId: null,
loading: true,
visible: false,
}
},
emits: ['success', 'closed', 'mounted'],
methods: {
//显示
async open(data) {
this.visible = true
if (data.tabId === 'fail') {
data.tabId = 'log'
this.statusCodes = ['300,399', '400,499', '500,599', '900,999']
await this.$TOOL.data.set('APP_SET_FAIL_JOB_VIEW_TIME', this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'))
}
this.tabId = data.tabId
return this
},
//表单提交方法
async submit() {},
},
mounted() {
this.$emit('mounted')
},
}
</script>
<style scoped></style>

View File

@ -83,7 +83,7 @@
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import avatar from '../../utils/avatar' import avatar from '../../utils/avatar'
const search = defineAsyncComponent(() => import('./search.vue')) const search = defineAsyncComponent(() => import('./search.vue'))
const tasks = defineAsyncComponent(() => import('./tasks/index.vue')) const tasks = defineAsyncComponent(() => import('./tasks.vue'))
const message = defineAsyncComponent(() => import('@/views/profile/message/components/list.vue')) const message = defineAsyncComponent(() => import('@/views/profile/message/components/list.vue'))
export default { export default {
components: { components: {

View File

@ -498,4 +498,7 @@ export default {
本页: '本页', 本页: '本页',
'JSON 格式化': 'JSON 格式化', 'JSON 格式化': 'JSON 格式化',
格式错误: '格式错误', 格式错误: '格式错误',
'按下 {key} 可关闭当前标签页': '按下 {key} 可关闭当前标签页',
'按下 {key} 可关闭其它标签页': '按下 {key} 可关闭其它标签页',
'按下 {key} 快速查找菜单功能': '按下 {key} 快速查找菜单功能',
} }

View File

@ -7,10 +7,6 @@
--el-menu-horizontal-height: 4rem; --el-menu-horizontal-height: 4rem;
} }
.el-menu--inline {
--el-menu-active-color: var(--el-color-primary) !important;
}
.el-form-item--default { .el-form-item--default {
--font-size: 1rem; --font-size: 1rem;
} }
@ -333,3 +329,7 @@
max-width: 90%; max-width: 90%;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} }
.el-collapse-item__header {
color: var(--el-text-color-regular);
}

View File

@ -12,19 +12,16 @@ export function permissionAll(permissions) {
* @returns {boolean} * @returns {boolean}
*/ */
export function judementSameArr(news, old) { export function judementSameArr(news, old) {
// console.log(news)
// console.log(old)
let count = 0 let count = 0
const len = news.length const len = news.length
for (let i in news) { for (let i in news) {
for (let j in old) { for (let j in old) {
if (news[i] === old[j]) { if (news[i] === old[j]) {
count++ count++
// console.log(news[i])
} }
} }
} }
// console.log('相同的数量', count)
return count === len return count === len
} }

View File

@ -3,6 +3,65 @@ import sysConfig from '@/config'
const tool = {} const tool = {}
tool.time = {
//获取当前时间戳
getUnix: function () {
const date = new Date()
return date.getTime()
},
//获取今天0点0分0秒的时间戳
getTodayUnix: function () {
const date = new Date()
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
date.setMilliseconds(0)
return date.getTime()
},
//获取今年1月1日0点0秒的时间戳
getYearUnix: function () {
const date = new Date()
date.setMonth(0)
date.setDate(1)
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
date.setMilliseconds(0)
return date.getTime()
},
//获取标准年月日
getLastDate: function (time) {
const date = new Date(time)
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return date.getFullYear() + '-' + month + '-' + day
},
//转换时间
getFormatTime: function (timestamp) {
timestamp = new Date(timestamp)
const now = this.getUnix()
const today = this.getTodayUnix()
//var year = this.getYearUnix();
const timer = (now - timestamp) / 1000
let tip
if (timer <= 0) {
tip = '刚刚'
} else if (Math.floor(timer / 60) <= 0) {
tip = '刚刚'
} else if (timer < 3600) {
tip = Math.floor(timer / 60) + '分钟前'
} else if (timer >= 3600 && (timestamp - today >= 0 || Math.floor(timer / 86400) <= 0)) {
tip = Math.floor(timer / 3600) + '小时前'
} else if (timer / 86400 <= 31) {
tip = Math.floor(timer / 86400) + '天前'
} else {
tip = this.getLastDate(timestamp)
}
return tip
},
}
/* localStorage */ /* localStorage */
tool.data = { tool.data = {
configJson: null, configJson: null,

View File

@ -1,14 +1,17 @@
<template> <template>
<div v-if="loading" v-loading="true" style="height: 100%"></div> <el-main v-loading="loading" :style="{ height: mainHeight, minHeight: '100%' }">
<el-main v-else :style="{ height: mainHeight }"> <widgets v-if="dashboard" @on-customizing="onCustomizing" @on-mounted="this.loading = false"></widgets>
<widgets v-if="dashboard" @on-customizing="onCustomizing"></widgets> <work v-if="myapp" @on-mounted="this.loading = false"></work>
<work v-else></work>
</el-main> </el-main>
<el-tour v-model="tour.open" @close="$TOOL.data.set('TOUR_TIP_READ_INDEX', true)"> <el-tour v-model="tour.open" @close="$TOOL.data.set('TOUR_TIP_READ_INDEX', true)">
<el-tour-step :target="tour.targets.tags" :title="$t('操作指引')"> {{ $t('按下 ALT+Q 可快速关闭当前标签页') }} </el-tour-step> <el-tour-step :target="tour.targets.tags" :title="$t('操作指引')">
<el-tour-step :target="tour.targets.search" :title="$t('操作指引')"> {{ $t('快速查找菜单功能') }} </el-tour-step> <p v-html="$t('按下 {key} 可关闭当前标签页', { key: '<b>Alt+Q</b>' })"></p>
<el-tour-step :target="tour.targets.userCenter" :title="$t('操作指引')"> {{ $t('修改个人信息和密码') }} </el-tour-step> <p v-html="$t('按下 {key} 可关闭其它标签页', { key: '<b>Ctrl+Alt+Q</b>' })"></p>
</el-tour-step>
<el-tour-step :target="tour.targets.search" :title="$t('操作指引')">
<p v-html="$t('按下 {key} 快速查找菜单功能', { key: '<b>Alt+A</b>' })"></p>
</el-tour-step>
<el-tour-step v-if="dashboard" :target="tour.targets.layoutSetting" :title="$t('操作指引')"> <el-tour-step v-if="dashboard" :target="tour.targets.layoutSetting" :title="$t('操作指引')">
{{ $t('自定义首页布局') }} {{ $t('自定义首页布局') }}
</el-tour-step> </el-tour-step>
@ -34,13 +37,14 @@ export default {
loading: true, loading: true,
mainHeight: 'auto', mainHeight: 'auto',
dashboard: false, dashboard: false,
myapp: false,
} }
}, },
async created() { async created() {
//下载配置 //下载配置
await this.$TOOL.data.downloadConfig() await this.$TOOL.data.downloadConfig()
this.dashboard = this.$GLOBAL.user.roles.findIndex((x) => x.displayDashboard) >= 0 this.dashboard = this.$GLOBAL.user.roles.findIndex((x) => x.displayDashboard) >= 0
this.loading = false this.myapp = !this.dashboard
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -153,7 +153,7 @@ export default {
this.loadGrid() this.loadGrid()
}, },
mounted() { mounted() {
this.$emit('on-mounted') this.$nextTick(() => this.$emit('on-mounted'))
}, },
computed: { computed: {
allCompsList() { allCompsList() {

View File

@ -15,7 +15,7 @@ export default {
return {} return {}
}, },
mounted() { mounted() {
this.$emit('on-mounted') this.$nextTick(() => this.$emit('on-mounted'))
}, },
methods: {}, methods: {},
} }

View File

@ -245,7 +245,7 @@
</template> </template>
<script> <script>
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent, h } from 'vue'
import table from '@/config/table' import table from '@/config/table'
import naColOperation from '@/config/naColOperation' import naColOperation from '@/config/naColOperation'
import naIndicator from '@/components/naIndicator/index.vue' import naIndicator from '@/components/naIndicator/index.vue'
@ -380,7 +380,7 @@ export default {
await this.$API.sys_job.execute.post({ id: row.id }) await this.$API.sys_job.execute.post({ id: row.id })
this.$notify.success({ this.$notify.success({
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: `<div id="countdown">${this.$t('已发起执行请求5 秒后弹出执行结果')}</div>`, message: h('div', { id: 'countdown' }, this.$t('已发起执行请求5 秒后弹出执行结果')),
onClose: async () => { onClose: async () => {
clearInterval(this.timer) clearInterval(this.timer)
this.dialog.save = { row, mode: 'view', tabId: 'record' } this.dialog.save = { row, mode: 'view', tabId: 'record' }

View File

@ -7,7 +7,7 @@
</el-tabs> </el-tabs>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<component :is="tabId" :status-codes="statusCodes" /> <component :is="tabId" :status-codes="statusCodes || dataStatusCode" />
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
@ -20,9 +20,20 @@ const all = defineAsyncComponent(() => import('@/views/sys/job/all/index.vue'))
export default { export default {
components: { all, log }, components: { all, log },
computed: {}, computed: {},
created() {}, created() {
if (this.$route.query.view === 'log') {
this.tabId = 'log'
}
if (this.$route.query.view === 'fail') {
this.tabId = 'log'
this.dataStatusCode = ['300,399', '400,499', '500,599', '900,999']
this.$TOOL.data.set('APP_SET_FAIL_JOB_VIEW_TIME', this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'))
}
},
data() { data() {
return { return {
dataStatusCode: null,
tabId: 'all', tabId: 'all',
} }
}, },

View File

@ -2,12 +2,12 @@
<el-container> <el-container>
<el-header v-loading="statistics.total === '...'" class="el-header-statistics"> <el-header v-loading="statistics.total === '...'" class="el-header-statistics">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :lg="12"> <el-col :span="12">
<el-card shadow="never"> <el-card shadow="never">
<sc-statistic :value="statistics.total" group-separator title="总数"></sc-statistic> <sc-statistic :value="statistics.total" group-separator title="总数"></sc-statistic>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12"> <el-col :span="12">
<el-card shadow="never"> <el-card shadow="never">
<sc-statistic :value="statistics.rate" suffix="%" title="成功率"></sc-statistic> <sc-statistic :value="statistics.rate" suffix="%" title="成功率"></sc-statistic>
</el-card> </el-card>

View File

@ -10,22 +10,82 @@
ref="dialogForm"> ref="dialogForm">
<el-tabs tab-position="top"> <el-tabs tab-position="top">
<el-tab-pane :label="$t('基本信息')"> <el-tab-pane :label="$t('基本信息')">
<el-form-item :label="$t('唯一编码')" prop="id"><el-input v-model="form.id" clearable /></el-form-item <el-row :gutter="10">
><el-form-item :label="$t('执行耗时(毫秒)')" prop="duration"><el-input v-model="form.duration" clearable /></el-form-item <el-col :lg="8">
><el-form-item :label="$t('请求方法')" prop="httpMethod"><el-input v-model="form.httpMethod" clearable /></el-form-item <el-form-item :label="$t('唯一编码')" prop="id">
><el-form-item :label="$t('响应状态码')" prop="httpStatusCode"><el-input v-model="form.httpStatusCode" clearable /></el-form-item <el-input v-model="form.id" clearable />
><el-form-item :label="$t('作业编号')" prop="jobId"><el-input v-model="form.jobId" clearable /></el-form-item </el-form-item>
><el-form-item :label="$t('请求体')" prop="requestBody" <el-form-item :label="$t('执行耗时(毫秒)')" prop="duration">
><el-input v-model="form.requestBody" clearable rows="5" type="textarea" /></el-form-item <el-input v-model="form.duration" clearable />
><el-form-item :label="$t('请求头')" prop="requestHeader"> </el-form-item>
<el-input v-model="form.requestHeader" clearable rows="5" type="textarea" /></el-form-item <el-form-item :label="$t('请求方法')" prop="httpMethod">
><el-form-item :label="$t('请求的网络地址')" prop="requestUrl"><el-input v-model="form.requestUrl" clearable /></el-form-item <el-input v-model="form.httpMethod" clearable />
><el-form-item :label="$t('响应体')" prop="responseBody" </el-form-item>
><el-input v-model="form.responseBody" clearable rows="5" type="textarea" /></el-form-item <el-form-item :label="$t('响应状态码')" prop="httpStatusCode">
><el-form-item :label="$t('响应头')" prop="responseHeader"> <el-input v-model="form.httpStatusCode" clearable />
<el-input v-model="form.responseHeader" clearable rows="5" type="textarea" /></el-form-item </el-form-item>
><el-form-item :label="$t('执行时间编号')" prop="timeId"><el-input v-model="form.timeId" clearable /></el-form-item <el-form-item :label="$t('作业编号')" prop="jobId">
><el-form-item :label="$t('创建时间')" prop="createdTime"><el-input v-model="form.createdTime" clearable /></el-form-item> <el-input v-model="form.jobId" clearable />
</el-form-item>
<el-form-item :label="$t('请求的网络地址')" prop="requestUrl">
<el-input v-model="form.requestUrl" clearable />
</el-form-item>
<el-form-item :label="$t('执行时间编号')" prop="timeId">
<el-input v-model="form.timeId" clearable />
</el-form-item>
<el-form-item :label="$t('创建时间')" prop="createdTime">
<el-input v-model="form.createdTime" clearable />
</el-form-item>
</el-col>
<el-col :lg="16">
<el-form-item v-if="form.requestHeader" :label="$t('请求头')" prop="requestHeader">
<json-viewer
v-if="mode === 'view'"
:expand-depth="1"
:theme="this.$TOOL.data.get('APP_SET_DARK') || this.$CONFIG.APP_SET_DARK ? 'dark' : 'light'"
:value="JSON.parse(form.requestHeader)"
copyable
expanded
sort></json-viewer>
<el-input v-else v-model="form.requestHeader" clearable rows="5" type="textarea" />
</el-form-item>
<el-form-item v-if="form.requestBody" :label="$t('请求体')" prop="requestBody">
<json-viewer
v-if="mode === 'view'"
:expand-depth="5"
:theme="this.$TOOL.data.get('APP_SET_DARK') || this.$CONFIG.APP_SET_DARK ? 'dark' : 'light'"
:value="JSON.parse(form.requestBody)"
copyable
expanded
sort></json-viewer>
<el-input v-else v-model="form.requestBody" clearable rows="5" type="textarea" />
</el-form-item>
<el-form-item v-if="form.responseHeader" :label="$t('响应头')" prop="responseHeader">
<json-viewer
v-if="mode === 'view'"
:expand-depth="1"
:theme="this.$TOOL.data.get('APP_SET_DARK') || this.$CONFIG.APP_SET_DARK ? 'dark' : 'light'"
:value="JSON.parse(form.responseHeader)"
copyable
expanded
sort></json-viewer>
<el-input v-else v-model="form.responseHeader" clearable rows="5" type="textarea" />
</el-form-item>
<el-form-item v-if="form.responseBody" :label="$t('响应体')" prop="responseBody">
<json-viewer
v-if="mode === 'view'"
:expand-depth="5"
:theme="this.$TOOL.data.get('APP_SET_DARK') || this.$CONFIG.APP_SET_DARK ? 'dark' : 'light'"
:value="JSON.parse(form.responseBody)"
copyable
expanded
sort>
</json-viewer>
<el-input v-else v-model="form.responseBody" clearable rows="5" type="textarea" />
</el-form-item>
</el-col>
</el-row>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="mode === 'view'" :label="$t('原始数据')"> <el-tab-pane v-if="mode === 'view'" :label="$t('原始数据')">
<json-viewer <json-viewer