mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-07-05 10:08:15 +08:00
feat: ✨ cron表达式的自然语言表达 (#156)
Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
@ -3,7 +3,10 @@
|
||||
<template #default="{ row }">
|
||||
<div class="flex">
|
||||
<template v-for="(item, i) in Array.isArray(row[prop]) ? row[prop] : [row[prop]]" :key="i">
|
||||
<el-tag v-if="item" @click="$emit('click', item)">
|
||||
<el-tag
|
||||
v-if="item"
|
||||
:type="['success', 'danger', 'info', 'primary', 'warning'][$TOOL.crypto.hashCode(item[field]) % 5]"
|
||||
@click="$emit('click', item)">
|
||||
{{ item ? item[field] : '' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
@ -34,7 +34,7 @@ const Time = {
|
||||
return date.getFullYear() + '-' + month + '-' + day
|
||||
},
|
||||
//转换时间
|
||||
getFormateTime: function (timestamp) {
|
||||
getFormatTime: function (timestamp) {
|
||||
timestamp = new Date(timestamp)
|
||||
const now = this.getUnix()
|
||||
const today = this.getTodayUnix()
|
||||
@ -48,10 +48,10 @@ const Time = {
|
||||
tip = '刚刚'
|
||||
} else if (timer < 3600) {
|
||||
tip = Math.floor(timer / 60) + '分钟前'
|
||||
} else if (timer >= 3600 && timestamp - today >= 0) {
|
||||
} else if (timer >= 3600 && (timestamp - today >= 0 || Math.floor(timer / 86400) <= 0)) {
|
||||
tip = Math.floor(timer / 3600) + '小时前'
|
||||
} else if (timer / 86400 <= 31) {
|
||||
tip = Math.ceil(timer / 86400) + '天前'
|
||||
tip = Math.floor(timer / 86400) + '天前'
|
||||
} else {
|
||||
tip = this.getLastDate(timestamp)
|
||||
}
|
||||
@ -68,9 +68,9 @@ export default (el, binding) => {
|
||||
value = value * 1000
|
||||
}
|
||||
if (modifiers.tip) {
|
||||
el.innerHTML = Time.getFormateTime(value)
|
||||
el.innerHTML = Time.getFormatTime(value)
|
||||
el.__timeout__ = setInterval(() => {
|
||||
el.innerHTML = Time.getFormateTime(value)
|
||||
el.innerHTML = Time.getFormatTime(value)
|
||||
}, 60000)
|
||||
} else {
|
||||
const format = el.getAttribute('format') || undefined
|
||||
|
@ -17,7 +17,7 @@
|
||||
<div class="jobMain">
|
||||
<div class="title">
|
||||
<h2>{{ job.jobName }}</h2>
|
||||
<p>{{ $t('上次执行:') }}<span v-time.tip="job.lastExecTime"></span></p>
|
||||
<p>{{ $t('上次执行:') }}<span v-time.tip="job.lastExecTime" :title="job.lastExecTime"></span></p>
|
||||
<p>
|
||||
下次执行:<span>{{ job.nextExecTime }}</span>
|
||||
</p>
|
||||
|
@ -151,6 +151,10 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const roleDefaultGrid = this.$GLOBAL.user.roles.filter((x) => x.displayDashboard).sort((x, y) => y.id - x.id)[0].dashboardLayout
|
||||
if (roleDefaultGrid) {
|
||||
this.defaultGrid = JSON.parse(roleDefaultGrid)
|
||||
}
|
||||
this.loadGrid()
|
||||
},
|
||||
mounted() {
|
||||
|
@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ msg.sender.userName }}</p>
|
||||
<p v-time.tip="msg.createdTime"></p>
|
||||
<p v-time.tip="msg.createdTime" :title="msg.createdTime"></p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -15,7 +15,6 @@
|
||||
label: 'name',
|
||||
}"
|
||||
@node-click="click"
|
||||
default-expand-all
|
||||
node-key="id"
|
||||
ref="dic">
|
||||
<template #default="{ _, data }">
|
||||
|
@ -113,7 +113,12 @@
|
||||
<el-table-column type="selection" />
|
||||
<na-col-id :label="$t('作业编号')" prop="id" sortable="custom" width="170" />
|
||||
<el-table-column :label="$t('作业名称')" prop="jobName" show-overflow-tooltip sortable="custom" />
|
||||
<el-table-column :label="$t('执行计划')" align="right" prop="executionCron" sortable="custom" width="150" />
|
||||
<el-table-column :label="$t('执行计划')" align="right" prop="executionCron" sortable="custom" width="150">
|
||||
<template #default="{ row }">
|
||||
<p>{{ row.cronDescription }}</p>
|
||||
<p>{{ row.executionCron }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<na-col-indicator
|
||||
:label="$t('作业状态')"
|
||||
:options="
|
||||
@ -151,7 +156,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('时间')" align="right" prop="lastExecTime" sortable="custom" width="100">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.lastExecTime" v-time.tip="row.lastExecTime"></span>
|
||||
<span v-if="row.lastExecTime" v-time.tip="row.lastExecTime" :title="row.lastExecTime"></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
Reference in New Issue
Block a user