pull/1/head
LiuJiaNan 2024-01-22 17:15:27 +08:00
parent 1812d05ec3
commit 0a76bcbdf0
2 changed files with 21 additions and 31 deletions

View File

@ -193,8 +193,7 @@
v-model:curriculum-list="data.form.curriculumList" v-model:curriculum-list="data.form.curriculumList"
/> />
<examination <examination
v-model:visible="data.examinationDialog.visible" v-model:visible="data.examinationDialogVisible"
v-model:form="data.examinationDialog.form"
v-model:examination-list="data.form.examinationList" v-model:examination-list="data.form.examinationList"
:peixue-time="data.form.PEIXUE_TIME" :peixue-time="data.form.PEIXUE_TIME"
/> />
@ -220,7 +219,7 @@
<script setup> <script setup>
import LayoutLearningTrainType from "@/components/learning_train_type/index.vue"; import LayoutLearningTrainType from "@/components/learning_train_type/index.vue";
import { nextTick, reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { setTaskAdd } from "@/request/online_learn_exam.js"; import { setTaskAdd } from "@/request/online_learn_exam.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { debounce } from "throttle-debounce"; import { debounce } from "throttle-debounce";
@ -229,7 +228,6 @@ import useFormValidate from "@/assets/js/useFormValidate.js";
import { useUserStore } from "@/pinia/user.js"; import { useUserStore } from "@/pinia/user.js";
import Curriculum from "./components/curriculum.vue"; import Curriculum from "./components/curriculum.vue";
import Examination from "./components/examination.vue"; import Examination from "./components/examination.vue";
import { cloneDeep } from "lodash-es";
import User from "./components/user.vue"; import User from "./components/user.vue";
const router = useRouter(); const router = useRouter();
@ -286,15 +284,7 @@ const data = reactive({
examinationUserDialogVisible: false, examinationUserDialogVisible: false,
recordUserDialogVisible: false, recordUserDialogVisible: false,
responsibilityUserDialogVisible: false, responsibilityUserDialogVisible: false,
examinationDialog: { examinationDialogVisible: false,
visible: false,
form: {
kaoshoName: "",
ANSWERSHEETTIME: 1,
NUMBER_OF_EXAMINATIONS: "",
examType: "",
},
},
}); });
const fnRecordUserDialogSubmit = (selectionData) => { const fnRecordUserDialogSubmit = (selectionData) => {
const USER_IDS = selectionData.map((item) => item.USER_ID).join(","); const USER_IDS = selectionData.map((item) => item.USER_ID).join(",");
@ -310,10 +300,7 @@ const fnResponsibilityUserDialogSubmit = (selectionData) => {
}; };
const fnExamination = async () => { const fnExamination = async () => {
if (data.form.PEIXUE_TIME?.length === 2) { if (data.form.PEIXUE_TIME?.length === 2) {
data.examinationDialog.visible = true; data.examinationDialogVisible = true;
await nextTick();
if (data.form.examinationList.length === 1)
data.examinationDialog.form = cloneDeep(data.form.examinationList[0]);
} else ElMessage.warning("请选择培训时间"); } else ElMessage.warning("请选择培训时间");
}; };
const fnSubmit = debounce( const fnSubmit = debounce(

View File

@ -107,11 +107,6 @@ const props = defineProps({
required: true, required: true,
default: false, default: false,
}, },
form: {
type: Object,
required: true,
default: () => ({}),
},
peixueTime: { peixueTime: {
type: Array, type: Array,
required: true, required: true,
@ -123,12 +118,8 @@ const props = defineProps({
default: () => [], default: () => [],
}, },
}); });
const emits = defineEmits([ const emits = defineEmits(["update:visible", "update:examinationList"]);
"update:visible", const { visible, examinationList } = useVModels(props, emits);
"update:form",
"update:examinationList",
]);
const { visible, form, examinationList } = useVModels(props, emits);
const { list, pagination, fnGetData } = useListData(getPaperList, { const { list, pagination, fnGetData } = useListData(getPaperList, {
otherParams: { STATE: "0" }, otherParams: { STATE: "0" },
immediate: false, immediate: false,
@ -149,10 +140,22 @@ const rules = {
}; };
const formRef = ref(null); const formRef = ref(null);
const currentCheck = ref({}); const currentCheck = ref({});
const form = ref({
kaoshoName: "",
ANSWERSHEETTIME: 1,
NUMBER_OF_EXAMINATIONS: "",
examType: "",
});
const fnInit = () => { const fnInit = () => {
if (props.examinationList[0]) if (props.examinationList[0]) {
currentCheck.value = cloneDeep(props.examinationList[0]); currentCheck.value = cloneDeep(props.examinationList[0]);
else currentCheck.value = {}; form.value = {
kaoshoName: props.examinationList[0].kaoshoName,
ANSWERSHEETTIME: props.examinationList[0].ANSWERSHEETTIME,
NUMBER_OF_EXAMINATIONS: props.examinationList[0].NUMBER_OF_EXAMINATIONS,
examType: props.examinationList[0].examType,
};
}
list.value.length === 0 && fnGetData(); list.value.length === 0 && fnGetData();
}; };
const fnClose = () => { const fnClose = () => {
@ -174,7 +177,7 @@ const fnSubmit = async () => {
ElMessage.error("请选择试卷"); ElMessage.error("请选择试卷");
return; return;
} }
examinationList.value = [{ ...form.value, ...currentCheck.value }]; examinationList.value = [{ ...currentCheck.value, ...form.value }];
visible.value = false; visible.value = false;
}; };
watch( watch(