mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 05:16:45 +08:00
feat:在作业和考试drawer中新增编辑·查询.删除功能
fix: 时间栏显示bug
This commit is contained in:
@@ -8,7 +8,10 @@ export const createExamination = (obj) => http.post('/examination/createExaminat
|
|||||||
// 根据Id删除考试信息
|
// 根据Id删除考试信息
|
||||||
export const deleteExaminationById = (obj) => http.post('/examination/deleteExaminationById',obj);
|
export const deleteExaminationById = (obj) => http.post('/examination/deleteExaminationById',obj);
|
||||||
// 根据ID获取考试信息详情
|
// 根据ID获取考试信息详情
|
||||||
export const queryExaminationDetailById = (obj) => http.post('/examination/queryExaminationDetailById',obj);
|
export const queryExaminationDetailById = (obj) => http.post('/examination/queryExaminationDetailById',obj,{headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
||||||
|
}
|
||||||
|
});
|
||||||
// 创建考试信息接口
|
// 创建考试信息接口
|
||||||
export const updateExamination = (obj) => http.post('/examination/updateExamination',obj);
|
export const updateExamination = (obj) => http.post('/examination/updateExamination',obj);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ export const createWorkTask = (obj) => http.post('/work/createWorkTask',obj,{
|
|||||||
// 删除作业信息接口
|
// 删除作业信息接口
|
||||||
export const deleteWorkTask = (obj) => http.post('/work/deleteWorkTask',obj);
|
export const deleteWorkTask = (obj) => http.post('/work/deleteWorkTask',obj);
|
||||||
// 根据ID获取作业信息详情
|
// 根据ID获取作业信息详情
|
||||||
export const queryWorkDetailById = (obj) => http.post('/work/queryWorkDetailById',obj);
|
export const queryWorkDetailById = (obj) => http.post('/work/queryWorkDetailById',obj,{
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
||||||
|
}
|
||||||
|
});
|
||||||
// 修改作业信息接口
|
// 修改作业信息接口
|
||||||
export const updateWorkTaskUsing = (obj) => http.post('/work/updateWorkTask',obj);
|
export const updateWorkTaskUsing = (obj) => http.post('/work/updateWorkTask',obj);
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
:visible="addhomeworkVisible"
|
:visible="addhomeworkVisible"
|
||||||
class="drawerStyle addhomeworkDrawer"
|
class="drawerStyle addhomeworkDrawer"
|
||||||
width="80%"
|
width="80%"
|
||||||
title="添加作业"
|
|
||||||
placement="right"
|
placement="right"
|
||||||
@after-visible-change="afterVisibleChange"
|
@after-visible-change="afterVisibleChange"
|
||||||
>
|
>
|
||||||
<div class="drawerMain">
|
<div class="drawerMain">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="headerTitle">添加作业</div>
|
<div class="headerTitle">{{workId ? '编辑':'添加' }}作业</div>
|
||||||
<img
|
<img
|
||||||
style="width: 29px; height: 29px; cursor: pointer"
|
style="width: 29px; height: 29px; cursor: pointer"
|
||||||
src="../../assets/images/basicinfo/close.png"
|
src="../../assets/images/basicinfo/close.png"
|
||||||
@@ -17,7 +16,6 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<a-form
|
<a-form
|
||||||
|
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
name="custom-validation"
|
name="custom-validation"
|
||||||
:model="formState"
|
:model="formState"
|
||||||
@@ -59,6 +57,7 @@
|
|||||||
<a-range-picker
|
<a-range-picker
|
||||||
style="width: 424px;margin-left: 35px;"
|
style="width: 424px;margin-left: 35px;"
|
||||||
v-model:value="formState.choosedTime"
|
v-model:value="formState.choosedTime"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
:placeholder="[' 开始时间', ' 结束时间']"
|
:placeholder="[' 开始时间', ' 结束时间']"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -81,7 +80,7 @@
|
|||||||
action="/api/file/upload"
|
action="/api/file/upload"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
>
|
>
|
||||||
<button class="xkbtn">上传附件</button>
|
<button class="xkbtn" type="button">上传附件</button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,7 +105,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
import {message} from"ant-design-vue";
|
import {message} from"ant-design-vue";
|
||||||
import {createWorkTask} from "@/api/indexWork"
|
import { createWorkTask, queryWorkDetailById, updateWorkTaskUsing} from "@/api/indexWork";
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const rowSelection = ref({
|
const rowSelection = ref({
|
||||||
@@ -134,6 +133,10 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
workId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const formState = reactive({
|
const formState = reactive({
|
||||||
@@ -142,23 +145,22 @@ export default {
|
|||||||
choosedTime: '',
|
choosedTime: '',
|
||||||
});
|
});
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
|
||||||
|
|
||||||
let checkWorkName = async (_rule, value) => {
|
let checkWorkName = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入作业名称");
|
|
||||||
return Promise.reject('请输入作业名称');
|
return Promise.reject('请输入作业名称');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let checkWorkRequirement = async (_rule, value) => {
|
let checkWorkRequirement = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入作业要求");
|
|
||||||
return Promise.reject('请输入作业要求');
|
return Promise.reject('请输入作业要求');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let checkTime = async (_rule, value) => {
|
let checkTime = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value.length) {
|
||||||
message.warning("请选择时间");
|
|
||||||
return Promise.reject('请选择时间');
|
return Promise.reject('请选择时间');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -190,7 +192,7 @@ export default {
|
|||||||
// };
|
// };
|
||||||
const handleFinish = values => {
|
const handleFinish = values => {
|
||||||
console.log(values);
|
console.log(values);
|
||||||
addHomework()
|
updateWork(props.workId)
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFinishFailed = errors => {
|
const handleFinishFailed = errors => {
|
||||||
@@ -220,13 +222,29 @@ export default {
|
|||||||
const fileList = ref([]);
|
const fileList = ref([]);
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
resetForm();
|
resetForm();
|
||||||
|
fileList.value = [];
|
||||||
|
formState.choosedTime = '';
|
||||||
ctx.emit("update:addhomeworkVisible", false);
|
ctx.emit("update:addhomeworkVisible", false);
|
||||||
};
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
|
if(props.addhomeworkVisible && props.workId){
|
||||||
|
queryWork({workId: props.workId})
|
||||||
|
}
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
};
|
};
|
||||||
const addHomework = () => {
|
const queryWork = (data) => {
|
||||||
createWorkTask({
|
queryWorkDetailById(data).then((res) => {
|
||||||
|
console.log(dayjs(res.data.data.submitStartTime).format("YYYY-MM-DD"));
|
||||||
|
formState.workName = res.data.data.workName;
|
||||||
|
formState.workRequirement = res.data.data.workRequirement;
|
||||||
|
formState.choosedTime=[dayjs(res.data.data.submitStartTime,"YYYY-MM-DD"),dayjs(res.data.data.submitEndTime,"YYYY-MM-DD")]
|
||||||
|
console.log(res);
|
||||||
|
}).catch(() => {
|
||||||
|
message.error(`查询失败`)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
const updateWork = (id) => {
|
||||||
|
let obj = {
|
||||||
"createTime": "",
|
"createTime": "",
|
||||||
"createUser": 0,
|
"createUser": 0,
|
||||||
"submitEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
"submitEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
||||||
@@ -235,22 +253,32 @@ export default {
|
|||||||
"updateUser": 0,
|
"updateUser": 0,
|
||||||
"workEnclosureAddress": "",
|
"workEnclosureAddress": "",
|
||||||
"workFlag": "",
|
"workFlag": "",
|
||||||
"workId": 0,
|
"workId": id || 0,
|
||||||
"workName": formState.workName,
|
"workName": formState.workName,
|
||||||
"workRequirement": formState.workRequirement,
|
"workRequirement": formState.workRequirement,
|
||||||
"workTag": ""
|
"workTag": ""
|
||||||
}).then((res)=>{
|
}
|
||||||
|
if(id) {
|
||||||
|
updateWorkTaskUsing(obj).then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
message.success(`编辑成功`)
|
||||||
|
closeDrawer();
|
||||||
|
}).catch((err) => {
|
||||||
|
message.error(`编辑失败${err}`)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
createWorkTask(obj).then((res)=>{
|
||||||
message.success(`添加成功${res}`)
|
message.success(`添加成功${res}`)
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
}).catch((err)=>{
|
}).catch((err)=>{
|
||||||
message.error(`添加失败${err}`)
|
message.error(`添加失败${err}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
rowSelection,
|
rowSelection,
|
||||||
addHomework,
|
|
||||||
handleChange,
|
handleChange,
|
||||||
fileList,
|
fileList,
|
||||||
formState,
|
formState,
|
||||||
@@ -261,6 +289,8 @@ export default {
|
|||||||
formRef,
|
formRef,
|
||||||
// layout,
|
// layout,
|
||||||
rules,
|
rules,
|
||||||
|
queryWork,
|
||||||
|
updateWork,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
:visible="addtestVisible"
|
:visible="addtestVisible"
|
||||||
class="drawerStyle addtestDrawer"
|
class="drawerStyle addtestDrawer"
|
||||||
width="80%"
|
width="80%"
|
||||||
title="添加作业"
|
|
||||||
placement="right"
|
placement="right"
|
||||||
@after-visible-change="afterVisibleChange"
|
@after-visible-change="afterVisibleChange"
|
||||||
>
|
>
|
||||||
<div class="drawerMain">
|
<div class="drawerMain">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="headerTitle">添加考试</div>
|
<div class="headerTitle">{{examinationId ? "编辑" : "添加" }}考试</div>
|
||||||
<img
|
<img
|
||||||
style="width: 29px; height: 29px; cursor: pointer"
|
style="width: 29px; height: 29px; cursor: pointer"
|
||||||
src="../../assets/images/basicinfo/close.png"
|
src="../../assets/images/basicinfo/close.png"
|
||||||
@@ -73,6 +72,7 @@
|
|||||||
|
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
v-model:value="formState.choosedTime"
|
v-model:value="formState.choosedTime"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
style="width: 424px;margin-left: 35px;"
|
style="width: 424px;margin-left: 35px;"
|
||||||
:placeholder="[' 开始时间', ' 结束时间']"
|
:placeholder="[' 开始时间', ' 结束时间']"
|
||||||
/>
|
/>
|
||||||
@@ -88,8 +88,9 @@
|
|||||||
style="width: 388px; height: 32px;
|
style="width: 388px; height: 32px;
|
||||||
margin-left: 35px;"
|
margin-left: 35px;"
|
||||||
/>
|
/>
|
||||||
<span style="margin-left: 5px">分钟</span>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<span style="transform: translateY(-50%)">分钟</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
@@ -115,7 +116,7 @@
|
|||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-form-item has-feedback label="显示答案" name="showAnswers">
|
<a-form-item has-feedback label="显示答案" name="showAnswers">
|
||||||
|
|
||||||
<a-radio-group style="margin-left: 35px;" v-model:value="formState.showAnswers">
|
<a-radio-group style="margin-left: 35px;margin-right: 12px;" v-model:value="formState.showAnswers">
|
||||||
<a-radio v-model:checked="checked" :value="1" @click="cloradio1">允许查看</a-radio>
|
<a-radio v-model:checked="checked" :value="1" @click="cloradio1">允许查看</a-radio>
|
||||||
<a-radio v-model:checked="checked" :value="2" @click="cloradio1"
|
<a-radio v-model:checked="checked" :value="2" @click="cloradio1"
|
||||||
>不允许查看</a-radio
|
>不允许查看</a-radio
|
||||||
@@ -129,7 +130,7 @@
|
|||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-form-item has-feedback label="显示解析" name="showAnalysis">
|
<a-form-item has-feedback label="显示解析" name="showAnalysis">
|
||||||
|
|
||||||
<a-radio-group style="margin-left: 35px;" v-model:value="formState.showAnalysis">
|
<a-radio-group style="margin-left: 35px;margin-right: 12px;" v-model:value="formState.showAnalysis">
|
||||||
<a-radio v-model:checked="checked" :value="1" @click="cloradio2">允许查看</a-radio>
|
<a-radio v-model:checked="checked" :value="1" @click="cloradio2">允许查看</a-radio>
|
||||||
<a-radio v-model:checked="checked" :value="2" @click="cloradio2"
|
<a-radio v-model:checked="checked" :value="2" @click="cloradio2"
|
||||||
>不允许查看</a-radio
|
>不允许查看</a-radio
|
||||||
@@ -143,7 +144,7 @@
|
|||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-form-item has-feedback label="评分模式" name="scoringModel">
|
<a-form-item has-feedback label="评分模式" name="scoringModel">
|
||||||
|
|
||||||
<a-radio-group style="margin-left: 35px;" v-model:value="formState.scoringModel">
|
<a-radio-group style="margin-left: 35px;margin-right: 12px;" v-model:value="formState.scoringModel">
|
||||||
<a-radio v-model:checked="checked" :value="1" @click="cloradio3"
|
<a-radio v-model:checked="checked" :value="1" @click="cloradio3"
|
||||||
>最高一次</a-radio
|
>最高一次</a-radio
|
||||||
>
|
>
|
||||||
@@ -171,7 +172,9 @@
|
|||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-form-item has-feedback label="作业要求" name="questionArrangement">
|
<a-form-item has-feedback label="作业要求" name="questionArrangement">
|
||||||
|
|
||||||
<a-radio-group v-model:value="formState.questionArrangement">
|
<a-radio-group
|
||||||
|
style="margin-right:12px;"
|
||||||
|
v-model:value="formState.questionArrangement">
|
||||||
<a-radio v-model:checked="checked" :value="1" @click="cloradio4">试题乱序</a-radio>
|
<a-radio v-model:checked="checked" :value="1" @click="cloradio4">试题乱序</a-radio>
|
||||||
<a-radio v-model:checked="checked" :value="2" @click="cloradio4">试题排序</a-radio>
|
<a-radio v-model:checked="checked" :value="2" @click="cloradio4">试题排序</a-radio>
|
||||||
<a-radio v-model:checked="checked" :value="3" @click="cloradio4">全部乱序</a-radio>
|
<a-radio v-model:checked="checked" :value="3" @click="cloradio4">全部乱序</a-radio>
|
||||||
@@ -193,7 +196,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
import {message} from"ant-design-vue";
|
import {message} from"ant-design-vue";
|
||||||
import {createExamination} from "@/api/indexExam"
|
import {createExamination,queryExaminationDetailById,updateExamination} from "@/api/indexExam"
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
const rowSelection = ref({
|
const rowSelection = ref({
|
||||||
checkStrictly: false,
|
checkStrictly: false,
|
||||||
@@ -220,6 +223,10 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
examinationId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const formState = reactive({
|
const formState = reactive({
|
||||||
@@ -233,71 +240,61 @@ export default {
|
|||||||
scoringModel:2,
|
scoringModel:2,
|
||||||
showAnalysis:2,
|
showAnalysis:2,
|
||||||
showAnswers:2,
|
showAnswers:2,
|
||||||
|
choosedTime:'',
|
||||||
});
|
});
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
let checkExaminationName = async (_rule, value) => {
|
let checkExaminationName = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入考试名称");
|
|
||||||
return Promise.reject('请输入考试名称');
|
return Promise.reject('请输入考试名称');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkExaminationExplain = async (_rule, value) => {
|
let checkExaminationExplain = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入考试说明");
|
|
||||||
return Promise.reject('请输入考试说明');
|
return Promise.reject('请输入考试说明');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkChoosedTest = async (_rule, value) => {
|
let checkChoosedTest = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请选择考试");
|
|
||||||
return Promise.reject('请选择考试');
|
return Promise.reject('请选择考试');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkChoosedTime = async (_rule, value) => {
|
let checkChoosedTime = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value.length) {
|
||||||
message.warning("请选择时间");
|
|
||||||
return Promise.reject('请选择时间');
|
return Promise.reject('请选择时间');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkExaminationDuration = async (_rule, value) => {
|
let checkExaminationDuration = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入考试时长");
|
|
||||||
return Promise.reject('请输入考试时长');
|
return Promise.reject('请输入考试时长');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkLimit = async (_rule, value) => {
|
let checkLimit = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入考试限制");
|
|
||||||
return Promise.reject('请输入考试限制');
|
return Promise.reject('请输入考试限制');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkShowAnswers = async (_rule, value) => {
|
let checkShowAnswers = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入作业名称");
|
|
||||||
return Promise.reject('请输入作业名称');
|
return Promise.reject('请输入作业名称');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkShowAnalysis = async (_rule, value) => {
|
let checkShowAnalysis = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入作业名称");
|
|
||||||
return Promise.reject('请输入作业名称');
|
return Promise.reject('请输入作业名称');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkScoringModel = async (_rule, value) => {
|
let checkScoringModel = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入作业名称");
|
|
||||||
return Promise.reject('请输入作业名称');
|
return Promise.reject('请输入作业名称');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkPassLine = async (_rule, value) => {
|
let checkPassLine = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入及格线");
|
|
||||||
return Promise.reject('请输入及格线');
|
return Promise.reject('请输入及格线');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let checkQuestionArrangement = async (_rule, value) => {
|
let checkQuestionArrangement = async (_rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
message.warning("请输入作业名称");
|
|
||||||
return Promise.reject('请输入作业名称');
|
return Promise.reject('请输入作业名称');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -366,7 +363,7 @@ export default {
|
|||||||
])
|
])
|
||||||
const handleFinish = values => {
|
const handleFinish = values => {
|
||||||
console.log(values);
|
console.log(values);
|
||||||
addTest()
|
updateTest(props.examinationId)
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFinishFailed = errors => {
|
const handleFinishFailed = errors => {
|
||||||
@@ -383,17 +380,38 @@ export default {
|
|||||||
};
|
};
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
resetForm();
|
resetForm();
|
||||||
|
formState.choosedTime = '';
|
||||||
ctx.emit("update:addtestVisible", false);
|
ctx.emit("update:addtestVisible", false);
|
||||||
};
|
};
|
||||||
const addTest = () => {
|
const queryTest = (data) => {
|
||||||
createExamination({
|
queryExaminationDetailById(data).then((res) => {
|
||||||
|
formState.examinationName = res.data.data.examinationName;
|
||||||
|
formState.workRequirement = res.data.data.workRequirement;
|
||||||
|
formState.examinationDuration = res.data.data.examinationDuration;
|
||||||
|
formState.examinationLimit = res.data.data.examinationLimit || -1;
|
||||||
|
formState.passLine = res.data.data.passLine;
|
||||||
|
formState.examinationExplain = res.data.data.examinationExplain;
|
||||||
|
formState.questionArrangement = res.data.data.questionArrangement || 1;
|
||||||
|
formState.scoringModel = res.data.data.scoringModel || 1;
|
||||||
|
formState.showAnalysis = res.data.data.showAnalysis || 1;
|
||||||
|
formState.showAnswers = res.data.data.showAnswers || 1;
|
||||||
|
if(res.data.data.examinationEndTime && res.data.data.examinationStartTime){
|
||||||
|
formState.choosedTime= [dayjs(res.data.data.examinationStartTime,"YYYY-MM-DD"),dayjs(res.data.data.examinationEndTime,"YYYY-MM-DD")]
|
||||||
|
} else { formState.choosedTime=[] }
|
||||||
|
console.log(res);
|
||||||
|
}).catch(() => {
|
||||||
|
message.error(`查询失败`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const updateTest = (id) => {
|
||||||
|
let obj = {
|
||||||
"createTime": "",
|
"createTime": "",
|
||||||
"createUser": 0,
|
"createUser": 0,
|
||||||
"examinationDuration": formState.examinationDuration,
|
"examinationDuration": formState.examinationDuration,
|
||||||
"examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
"examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
||||||
"examinationExplain": formState.examinationExplain,
|
"examinationExplain": formState.examinationExplain,
|
||||||
"examinationFlag": "",
|
"examinationFlag": "",
|
||||||
"examinationId": 0,
|
"examinationId": id || 0,
|
||||||
"examinationLimit": formState.examinationLimit,
|
"examinationLimit": formState.examinationLimit,
|
||||||
"examinationName": formState.examinationName,
|
"examinationName": formState.examinationName,
|
||||||
"examinationPaperId": 0,
|
"examinationPaperId": 0,
|
||||||
@@ -407,16 +425,31 @@ export default {
|
|||||||
"showAnswers": formState.showAnswers,
|
"showAnswers": formState.showAnswers,
|
||||||
"updateTime": "",
|
"updateTime": "",
|
||||||
"updateUser": 0
|
"updateUser": 0
|
||||||
}).then((res)=>{
|
}
|
||||||
|
if(id) {
|
||||||
|
updateExamination(obj).then((res)=>{
|
||||||
|
console.log(res);
|
||||||
|
message.success(`编辑成功`)
|
||||||
|
closeDrawer();
|
||||||
|
}).catch(()=>{
|
||||||
|
message.error(`编辑失败`)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
createExamination(obj).then((res)=>{
|
||||||
message.success(`添加成功${res}`)
|
message.success(`添加成功${res}`)
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
}).catch((err)=>{
|
}).catch((err)=>{
|
||||||
message.error(`添加失败${err}`)
|
message.error(`添加失败${err}`)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("formState", bool);
|
console.log("formState", bool);
|
||||||
|
if(props.addtestVisible && props.examinationId){
|
||||||
|
queryTest({examinationId: props.examinationId})
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const cloradio1 = (value) => {
|
const cloradio1 = (value) => {
|
||||||
if (value != "") {
|
if (value != "") {
|
||||||
@@ -447,7 +480,6 @@ export default {
|
|||||||
cloradio2,
|
cloradio2,
|
||||||
cloradio3,
|
cloradio3,
|
||||||
cloradio4,
|
cloradio4,
|
||||||
addTest,
|
|
||||||
options1,
|
options1,
|
||||||
handleFinish,
|
handleFinish,
|
||||||
handleFinishFailed,
|
handleFinishFailed,
|
||||||
@@ -456,6 +488,8 @@ export default {
|
|||||||
formRef,
|
formRef,
|
||||||
// layout,
|
// layout,
|
||||||
rules,
|
rules,
|
||||||
|
updateTest,
|
||||||
|
queryTest,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user