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

View File

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