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.
### [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)

View File

@ -1,5 +1,5 @@
{
"version": "2.2.1",
"version": "2.3.1",
"devDependencies": {
"cz-git": "^1.11.0",
"commitizen": "^4.3.1",
@ -11,4 +11,4 @@
"path": "node_modules/cz-git"
}
}
}
}

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
//ctrl + enter 触发主按钮点击事件
document.onkeydown = (e) => {
//ctrl + enter 触发主按钮点击事件
if (e.ctrlKey && e.keyCode === 13) {
document
.getElementsByClassName('el-dialog__footer')[0]
@ -118,8 +118,22 @@ export default {
break
}
}
} else if (e.altKey && e.keyCode === 81) {
UseTabs.close()
} else if (e.altKey) {
if (e.keyCode === 81) {
if (e.ctrlKey) {
UseTabs.closeOther()
} else {
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,92 +1,97 @@
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 = {
color: [el_color_primary, colorTool.lighten(el_color_primary, 0.5), ...colorTool.colorSets],
grid: {
left: '3%',
right: '3%',
bottom: '10',
top: '40',
containLabel: true,
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],
grid: {
left: '3%',
right: '3%',
bottom: '10',
top: '40',
containLabel: true,
},
pie: {
label: {
color: el_color_info,
},
},
gauge: {
axisTick: {
lineStyle: {
color: el_color_info,
},
},
splitLine: {
lineStyle: {
color: el_color_info,
},
},
axisLabel: {
color: el_color_info,
},
title: {
color: el_color_info,
},
},
legend: {
textStyle: {
color: el_color_info,
},
inactiveColor: 'rgba(128,128,128,0.4)',
},
categoryAxis: {
axisLine: {
show: true,
lineStyle: {
color: 'rgba(128,128,128,0.2)',
width: 1,
},
},
axisTick: {
show: false,
lineStyle: {
color: el_text_color_primary,
},
},
axisLabel: {
color: el_color_info,
},
splitLine: {
show: false,
lineStyle: {
color: [el_border_color_lighter],
},
},
splitArea: {
show: false,
areaStyle: {
color: ['rgba(255,255,255,0.01)', 'rgba(0,0,0,0.01)'],
},
},
},
valueAxis: {
axisLine: {
show: false,
lineStyle: {
color: el_color_info,
},
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(128,128,128,0.2)',
},
},
},
}
},
pie: {
label: {
color: el_color_info,
},
},
gauge: {
axisTick: {
lineStyle: {
color: el_color_info,
},
},
splitLine: {
lineStyle: {
color: el_color_info,
},
},
axisLabel: {
color: el_color_info,
},
title: {
color: el_color_info,
},
},
legend: {
textStyle: {
color: el_color_info,
},
inactiveColor: 'rgba(128,128,128,0.4)',
},
categoryAxis: {
axisLine: {
show: true,
lineStyle: {
color: 'rgba(128,128,128,0.2)',
width: 1,
},
},
axisTick: {
show: false,
lineStyle: {
color: el_text_color_primary,
},
},
axisLabel: {
color: el_color_info,
},
splitLine: {
show: false,
lineStyle: {
color: [el_border_color_lighter],
},
},
splitArea: {
show: false,
areaStyle: {
color: ['rgba(255,255,255,0.01)', 'rgba(0,0,0,0.01)'],
},
},
},
valueAxis: {
axisLine: {
show: false,
lineStyle: {
color: el_color_info,
},
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(128,128,128,0.2)',
},
},
},
}
export default T
}

View File

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

View File

@ -1,64 +1,5 @@
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) => {
let { value, modifiers } = binding
if (!value) {
@ -68,9 +9,9 @@ export default (el, binding) => {
value = value * 1000
}
if (modifiers.tip) {
el.innerHTML = Time.getFormatTime(value)
el.innerHTML = tool.time.getFormatTime(value)
el.__timeout__ = setInterval(() => {
el.innerHTML = Time.getFormatTime(value)
el.innerHTML = tool.time.getFormatTime(value)
}, 60000)
} else {
const format = el.getAttribute('format') || undefined

View File

@ -5,6 +5,8 @@
:placeholder="$t('搜索')"
:trigger-on-focus="false"
@input="inputChange"
@keydown="inputKeyDown"
autofocus
clearable
prefix-icon="el-icon-search"
ref="input"
@ -25,7 +27,11 @@
<div v-if="result.length <= 0" class="sc-search-no-result">{{ $t('暂无搜索结果') }}</div>
<ul v-else>
<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>
<component :is="item.icon || 'el-icon-menu'" />
</el-icon>
@ -41,18 +47,55 @@
export default {
data() {
return {
cursor: {
position: 0,
index: 0,
},
input: '',
menu: [],
result: [],
history: [],
}
},
mounted() {
watch: {
result() {
this.cursor.position = 0
this.cursor.index = 0
},
},
async mounted() {
this.history = this.$TOOL.data.get('SEARCH_HISTORY') || []
this.filterMenu(this.$GLOBAL.menu)
await this.$nextTick()
await new Promise((x) => setTimeout(x, 200))
this.$refs.input.focus()
},
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) {
if (value) {
this.result = this.menuFilter(value)
@ -152,6 +195,9 @@ export default {
}
.sc-search-history {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 1rem;
}
@ -182,9 +228,10 @@ export default {
margin-right: 1rem;
}
.sc-search-result-li-hover,
.sc-search-result li:hover {
background: var(--el-color-primary);
color: var(--el-color-white);
border-color: var(--el-color-primary);
background: var(--el-color-primary) !important;
color: var(--el-color-white) !important;
border-color: var(--el-color-primary) !important;
}
</style>

View File

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

View File

@ -10,6 +10,43 @@
</p>
</el-empty>
<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-card
v-for="job in jobs"
@ -47,49 +84,36 @@
</div>
</el-card>
</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-main>
<el-footer class="flex" style="justify-content: space-evenly; height: unset">
<div>
<el-badge :hidden="jobsCnt === 0" :value="jobsCnt">
<el-button @click="dialog.save = { tabId: 'all' }">{{ $t('作业管理') }}</el-button>
<div v-if="failJobs">
<el-badge :hidden="fail === 0" :value="`${$TOOL.time.getFormatTime(new Date(failJobViewTime).getTime())} 至今 ${fail}个`">
<el-button
@click="
() => {
this.$router.push({ path: '/sys/job', query: { view: 'fail' } })
this.$emit('closed')
}
"
plain
type="danger"
>{{ $t('异常日志') }}</el-button
>
</el-badge>
</div>
<el-button @click="refresh" circle icon="el-icon-refresh"></el-button>
<div v-if="failJobs">
<el-badge :hidden="fail === 0" :value="fail">
<el-button @click="dialog.save = { tabId: 'fail' }" plain type="danger">{{ $t('异常日志') }}</el-button>
<div>
<el-badge :hidden="jobsCnt === 0" :value="jobsCnt">
<el-button
@click="
() => {
this.$router.push({ path: '/sys/job' })
this.$emit('closed')
}
"
>{{ $t('作业管理') }}</el-button
>
</el-badge>
</div>
</el-footer>
@ -105,7 +129,6 @@
@closed="dialog.jobRecordSave = null"
@mounted="$refs.jobRecordSaveDialog.open(dialog.jobRecordSave)"
ref="jobRecordSaveDialog"></jobRecordSaveDialog>
<saveDialog v-if="dialog.save" @closed="dialog.save = null" @mounted="$refs.saveDialog.open(dialog.save)" ref="saveDialog"></saveDialog>
</template>
<script>
@ -113,12 +136,16 @@ import { defineAsyncComponent } from 'vue'
const jobSaveDialog = defineAsyncComponent(() => import('@/views/sys/job/all/save.vue'))
const jobRecordSaveDialog = defineAsyncComponent(() => import('@/views/sys/job/record/save.vue'))
const saveDialog = defineAsyncComponent(() => import('./save.vue'))
export default {
computed: {
failJobViewTime() {
return this.$TOOL.data.get('APP_SET_FAIL_JOB_VIEW_TIME') ?? this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd')
},
},
components: {
jobSaveDialog,
jobRecordSaveDialog,
saveDialog,
},
data() {
return {
@ -175,7 +202,7 @@ export default {
],
field: 'createdTime',
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 avatar from '../../utils/avatar'
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'))
export default {
components: {

View File

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

View File

@ -7,10 +7,6 @@
--el-menu-horizontal-height: 4rem;
}
.el-menu--inline {
--el-menu-active-color: var(--el-color-primary) !important;
}
.el-form-item--default {
--font-size: 1rem;
}
@ -332,4 +328,8 @@
.el-popper {
max-width: 90%;
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}
*/
export function judementSameArr(news, old) {
// console.log(news)
// console.log(old)
let count = 0
const len = news.length
for (let i in news) {
for (let j in old) {
if (news[i] === old[j]) {
count++
// console.log(news[i])
}
}
}
// console.log('相同的数量', count)
return count === len
}

View File

@ -3,6 +3,65 @@ import sysConfig from '@/config'
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 */
tool.data = {
configJson: null,

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
</el-tabs>
</el-header>
<el-main class="nopadding">
<component :is="tabId" :status-codes="statusCodes" />
<component :is="tabId" :status-codes="statusCodes || dataStatusCode" />
</el-main>
</el-container>
</template>
@ -20,9 +20,20 @@ const all = defineAsyncComponent(() => import('@/views/sys/job/all/index.vue'))
export default {
components: { all, log },
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() {
return {
dataStatusCode: null,
tabId: 'all',
}
},

View File

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

View File

@ -10,22 +10,82 @@
ref="dialogForm">
<el-tabs tab-position="top">
<el-tab-pane :label="$t('基本信息')">
<el-form-item :label="$t('唯一编码')" prop="id"><el-input v-model="form.id" clearable /></el-form-item
><el-form-item :label="$t('执行耗时(毫秒)')" prop="duration"><el-input v-model="form.duration" clearable /></el-form-item
><el-form-item :label="$t('请求方法')" prop="httpMethod"><el-input v-model="form.httpMethod" clearable /></el-form-item
><el-form-item :label="$t('响应状态码')" prop="httpStatusCode"><el-input v-model="form.httpStatusCode" clearable /></el-form-item
><el-form-item :label="$t('作业编号')" prop="jobId"><el-input v-model="form.jobId" clearable /></el-form-item
><el-form-item :label="$t('请求体')" prop="requestBody"
><el-input v-model="form.requestBody" clearable rows="5" type="textarea" /></el-form-item
><el-form-item :label="$t('请求头')" prop="requestHeader">
<el-input v-model="form.requestHeader" clearable rows="5" type="textarea" /></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="responseBody"
><el-input v-model="form.responseBody" clearable rows="5" type="textarea" /></el-form-item
><el-form-item :label="$t('响应头')" prop="responseHeader">
<el-input v-model="form.responseHeader" clearable rows="5" type="textarea" /></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-row :gutter="10">
<el-col :lg="8">
<el-form-item :label="$t('唯一编码')" prop="id">
<el-input v-model="form.id" clearable />
</el-form-item>
<el-form-item :label="$t('执行耗时(毫秒)')" prop="duration">
<el-input v-model="form.duration" clearable />
</el-form-item>
<el-form-item :label="$t('请求方法')" prop="httpMethod">
<el-input v-model="form.httpMethod" clearable />
</el-form-item>
<el-form-item :label="$t('响应状态码')" prop="httpStatusCode">
<el-input v-model="form.httpStatusCode" clearable />
</el-form-item>
<el-form-item :label="$t('作业编号')" prop="jobId">
<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 v-if="mode === 'view'" :label="$t('原始数据')">
<json-viewer