feat(xq0002): 新增HR自动导入功能,优化花名册源表新鲜度校验
``` 或者更贴合中文项目习惯的表述: ```msg feat(xq0002): 新增HR自动导入,优化花名册源表新鲜度校验
This commit is contained in:
@@ -89,30 +89,30 @@
|
||||
<div v-if="form.mode === '日+月'" class="grid">
|
||||
<el-form-item label="按日导出">
|
||||
<el-date-picker v-model="form.day_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期(默认昨天)" :disabled="running"
|
||||
placeholder="选择日期(留空=昨天)" :disabled="running"
|
||||
:disabled-date="disableFuture" class="wide" />
|
||||
<div class="tip">默认昨天;区间=所选日 00:00 ~ 次日 24:00(跨 2 天)</div>
|
||||
<div class="tip">留空=昨天(执行时按当天推算);区间=所选日 00:00 ~ 次日 24:00(跨 2 天)</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="按月导出">
|
||||
<el-date-picker v-model="form.month_date" type="month" value-format="YYYY-MM"
|
||||
placeholder="选择月份(默认上月)" :disabled="running"
|
||||
placeholder="选择月份(留空=上月)" :disabled="running"
|
||||
:disabled-date="disableFutureMonth" class="wide" />
|
||||
<div class="tip">默认上月;区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日)</div>
|
||||
<div class="tip">留空=上月(执行时按当天推算);区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日)</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item v-else-if="form.mode === '日'" label="按日导出">
|
||||
<el-date-picker v-model="form.day_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期(默认昨天)" :disabled="running"
|
||||
placeholder="选择日期(留空=昨天)" :disabled="running"
|
||||
:disabled-date="disableFuture" class="wide" />
|
||||
<div class="tip">默认昨天;区间=所选日 00:00 ~ 次日 24:00(跨 2 天);账单 = 所选日账单</div>
|
||||
<div class="tip">留空=昨天(执行时按当天推算);区间=所选日 00:00 ~ 次日 24:00(跨 2 天);账单 = 所选日账单</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-else label="按月导出">
|
||||
<el-date-picker v-model="form.month_date" type="month" value-format="YYYY-MM"
|
||||
placeholder="选择月份(默认上月)" :disabled="running"
|
||||
placeholder="选择月份(留空=上月)" :disabled="running"
|
||||
:disabled-date="disableFutureMonth" class="wide" />
|
||||
<div class="tip">默认上月;区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日);账单 = 该月账单</div>
|
||||
<div class="tip">留空=上月(执行时按当天推算);区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日);账单 = 该月账单</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="保存目录">
|
||||
@@ -154,41 +154,15 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { usePluginUI } from './usePluginUI'
|
||||
|
||||
function fmtDate(d) {
|
||||
const y = d.getFullYear()
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${y}-${m}-${day}`
|
||||
}
|
||||
|
||||
function fmtMonth(d) {
|
||||
const y = d.getFullYear()
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||||
return `${y}-${m}`
|
||||
}
|
||||
|
||||
function lastMonthStr(now) {
|
||||
const d = new Date(now.getFullYear(), now.getMonth() - 1, 1)
|
||||
return fmtMonth(d)
|
||||
}
|
||||
|
||||
function yesterdayStr(now) {
|
||||
const d = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1)
|
||||
return fmtDate(d)
|
||||
}
|
||||
|
||||
const DEFAULTS = () => {
|
||||
const now = new Date()
|
||||
return {
|
||||
mode: '日+月',
|
||||
content: '两个都导',
|
||||
day_date: yesterdayStr(now), // 默认昨天
|
||||
month_date: lastMonthStr(now), // 默认上月
|
||||
tl_username: '',
|
||||
tl_password: '',
|
||||
save_dir: '',
|
||||
}
|
||||
}
|
||||
const DEFAULTS = () => ({
|
||||
mode: '日+月',
|
||||
content: '两个都导',
|
||||
day_date: '', // 留空=插件按执行日推算昨日(定时任务无需固定日期)
|
||||
month_date: '', // 留空=插件按执行日推算上月
|
||||
tl_username: '',
|
||||
tl_password: '',
|
||||
save_dir: '',
|
||||
})
|
||||
|
||||
function disableFuture(date) {
|
||||
return date.getTime() > Date.now() + 86400000 // 今天及以前可选
|
||||
@@ -211,8 +185,6 @@ const {
|
||||
ElMessage.warning('请先填写通联登录账号和密码')
|
||||
return false
|
||||
}
|
||||
if (form.mode !== '月' && !form.day_date) { ElMessage.warning('请选择按日导出的日期'); return false }
|
||||
if (form.mode !== '日' && !form.month_date) { ElMessage.warning('请选择按月导出的月份'); return false }
|
||||
return true
|
||||
},
|
||||
// 提交参数按执行模式裁剪:按日不带月份、按月不带日期
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// 插件 UI 公共 kit(vendored 进各插件 ui-src,构建期内联进产物,运行零外部依赖)。
|
||||
// 插件 UI 公共 kit(vendored 进各插件 ui-src,构建期内联进产物,运行零外部依赖)。
|
||||
// 收敛三块通用逻辑,App.vue 只保留各插件差异部分(表单字段/校验/布局):
|
||||
// 1. 本机当前配置:加载、防抖自动保存、恢复默认(/api/plugin-config/<id>)
|
||||
// 2. 多配置方案:列表/应用/存为方案/删除(/api/plugin-configs,同名覆盖、密码字段
|
||||
// 不落盘;供壳子「定时任务」按 config_id 引用,到点自动取方案最新参数)
|
||||
// 2. 多配置方案:列表/应用/存为方案/删除(/api/plugin-configs,同名覆盖、密码明文保存;
|
||||
// 供壳子「定时任务」按 config_id 引用,到点自动取方案最新参数)
|
||||
// 3. 执行状态机:一键执行、强制停止、WS 实时进度 + 轮询兜底、未登录重试
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -165,7 +165,7 @@ export function usePluginUI(opts = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
// 应用方案:载入方案字段(密码不入方案,沿用当前表单)→ 防抖自动保存固化为当前配置;
|
||||
// 应用方案:载入方案字段(密码随方案明文保存)→ 防抖自动保存固化为当前配置;
|
||||
// 执行永远提交表单当前值,方案本身只作为定时任务的参数快照源
|
||||
function onSchemeChange(id) {
|
||||
if (!id) return // 切回「当前配置」:表单即当前配置,无需动作
|
||||
@@ -180,7 +180,7 @@ export function usePluginUI(opts = {}) {
|
||||
let name = ''
|
||||
try {
|
||||
({ value: name } = await ElMessageBox.prompt(
|
||||
'方案保存到本机(同名覆盖,密码加密落盘,每套方案可绑定不同账号),供「定时任务」引用:到点自动取该方案的最新参数执行。',
|
||||
'方案保存到本机(同名覆盖,密码明文保存,每套方案可绑定不同账号),供「定时任务」引用:到点自动取该方案的最新参数执行。',
|
||||
'存为配置方案',
|
||||
{
|
||||
inputValue: cur ? cur.name : '',
|
||||
|
||||
Reference in New Issue
Block a user