mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 批量设置定时,支持清除定时
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useFormWrapper } from "@fast-crud/fast-crud";
|
||||
import { compute, dict, useFormWrapper } from "@fast-crud/fast-crud";
|
||||
import * as api from "../api";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { computed } from "vue";
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -20,7 +21,7 @@ async function batchUpdateRequest(form: any) {
|
||||
await api.BatchUpdateTrigger(props.selectedRowKeys, {
|
||||
title: "定时触发",
|
||||
type: "timer",
|
||||
props: form.props,
|
||||
props: form.clear ? false : form.props,
|
||||
});
|
||||
emit("change");
|
||||
}
|
||||
@@ -33,6 +34,28 @@ async function openFormDialog() {
|
||||
settingStore.checkPlus();
|
||||
const crudOptions: any = {
|
||||
columns: {
|
||||
clear: {
|
||||
title: "设置/清空",
|
||||
form: {
|
||||
value: false,
|
||||
component: {
|
||||
name: "fs-dict-switch",
|
||||
vModel: "checked",
|
||||
dict: dict({
|
||||
data: [
|
||||
{
|
||||
label: "设置定时",
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
label: "清空定时",
|
||||
value: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
"props.cron": {
|
||||
title: t("certd.schedule"),
|
||||
form: {
|
||||
@@ -40,12 +63,18 @@ async function openFormDialog() {
|
||||
name: "cron-editor",
|
||||
vModel: "modelValue",
|
||||
},
|
||||
show: compute(({ form }) => {
|
||||
return form.clear !== true;
|
||||
}),
|
||||
rules: [{ required: true, message: t("certd.selectCron") }],
|
||||
},
|
||||
},
|
||||
},
|
||||
form: {
|
||||
mode: "edit",
|
||||
initialForm: {
|
||||
clear: false,
|
||||
},
|
||||
//@ts-ignore
|
||||
async doSubmit({ form }) {
|
||||
await batchUpdateRequest(form);
|
||||
|
||||
Reference in New Issue
Block a user