【新增】监控管理试卷任务监控、细节优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<Dialog v-model="visible" :title="'添加试卷任务'" width="460" @open="handleOpen" center>
|
||||
<Dialog v-model="visible" :title="'添加试卷任务'" width="460" center>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
@@ -8,6 +8,10 @@
|
||||
label-width="80px"
|
||||
@submit.prevent=""
|
||||
>
|
||||
|
||||
<el-form-item label="任务编号" prop="taskNum">
|
||||
<el-input clearable v-model="form.taskNum" placeholder="请输入编号" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input
|
||||
clearable
|
||||
@@ -124,6 +128,7 @@ const specialtyOptions = ref([]);
|
||||
const [form, resetFields, assignFields] = useFormData({
|
||||
taskId: void 0,
|
||||
taskName: '',
|
||||
taskNum:'',
|
||||
taskSpecialty: '',
|
||||
taskType: '0',
|
||||
isTemplate: '',
|
||||
@@ -178,6 +183,7 @@ const fetchSpecialtyOptions = async () => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
visible.value = true;
|
||||
loading.value = true;
|
||||
const saveOrUpdate = isUpdate.value ? updateTask : addTask;
|
||||
saveOrUpdate(form)
|
||||
@@ -195,14 +201,31 @@ const fetchSpecialtyOptions = async () => {
|
||||
};
|
||||
|
||||
/** 弹窗打开事件 */
|
||||
const handleOpen = () => {
|
||||
if (props.data) {
|
||||
assignFields(props.data);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
resetFields();
|
||||
isUpdate.value = false;
|
||||
}
|
||||
const open = async (type, row) => {
|
||||
// if (props.data) {
|
||||
// assignFields(props.data);
|
||||
// isUpdate.value = true;
|
||||
// } else {
|
||||
// resetFields();
|
||||
// isUpdate.value = false;
|
||||
// }
|
||||
// 设置批次为 当前时间 + 5位随机数
|
||||
const now = new Date();
|
||||
const pad = (n) => n.toString().padStart(2, '0');
|
||||
const datetimeStr = [
|
||||
now.getFullYear(),
|
||||
pad(now.getMonth() + 1),
|
||||
pad(now.getDate()),
|
||||
pad(now.getHours()),
|
||||
pad(now.getMinutes()),
|
||||
pad(now.getSeconds())
|
||||
].join('');
|
||||
|
||||
const randomNum = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
|
||||
//taskNum 赋值 randomNum
|
||||
|
||||
// 把 taskNum 设置为当前时间+随机数
|
||||
form.taskNum = `${datetimeStr}${randomNum}`;
|
||||
nextTick(() => {
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate?.();
|
||||
@@ -210,7 +233,8 @@ const fetchSpecialtyOptions = async () => {
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
|
||||
fetchSpecialtyOptions();
|
||||
});
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
Reference in New Issue
Block a user