首页日程增加删除按钮
This commit is contained in:
parent
772e018126
commit
9cd0ce6647
@ -111,7 +111,7 @@ const openAddSchedule = () => {
|
|||||||
// 打开编辑页面
|
// 打开编辑页面
|
||||||
const openEditSchedule = async (row: any) => {
|
const openEditSchedule = async (row: any) => {
|
||||||
state.editTitle = '编辑日程';
|
state.editTitle = '编辑日程';
|
||||||
editScheduleRef.value?.openDialog(row);
|
editScheduleRef.value?.openDialog(row, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 点击日历中的日期
|
// 点击日历中的日期
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
|
<el-button v-if="state.showRemove" @click="remove">删除</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
<el-button type="primary" @click="submit">确 定</el-button>
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
@ -47,6 +48,7 @@ const emits = defineEmits(['handleQuery']);
|
|||||||
const ruleFormRef = ref();
|
const ruleFormRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
|
showRemove: false,
|
||||||
ruleForm: {} as any,
|
ruleForm: {} as any,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -54,8 +56,9 @@ const state = reactive({
|
|||||||
onMounted(async () => {});
|
onMounted(async () => {});
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (row: any) => {
|
const openDialog = (row: any, showRemove: boolean = false) => {
|
||||||
ruleFormRef.value?.resetFields();
|
ruleFormRef.value?.resetFields();
|
||||||
|
state.showRemove = showRemove;
|
||||||
|
|
||||||
state.ruleForm = JSON.parse(JSON.stringify(row));
|
state.ruleForm = JSON.parse(JSON.stringify(row));
|
||||||
state.ruleForm.scheduleTime = dayjs(state.ruleForm.scheduleTime ?? new Date()).format('YYYY-MM-DD HH:mm:ss');
|
state.ruleForm.scheduleTime = dayjs(state.ruleForm.scheduleTime ?? new Date()).format('YYYY-MM-DD HH:mm:ss');
|
||||||
@ -88,6 +91,17 @@ const submit = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const remove = () => {
|
||||||
|
console.log(JSON.stringify(state.ruleForm));
|
||||||
|
|
||||||
|
ruleFormRef.value.validate(async (valid: boolean) => {
|
||||||
|
await getAPI(SysScheduleApi).apiSysScheduleDeletePost(state.ruleForm);
|
||||||
|
|
||||||
|
closeDialog();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user