mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
-- fix bug
This commit is contained in:
@@ -18,43 +18,25 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; flex-direction: row; padding-top: 0px; margin-top: 20px; margin-left: 32px;">
|
<div style="display: flex; flex-direction: row; padding-top: 0px; margin-top: 20px; margin-left: 32px;">
|
||||||
<div v-if="taskIndex >= 0">
|
<div>
|
||||||
<button
|
|
||||||
v-if="isOuter==1"
|
|
||||||
style="width: 100px; cursor: pointer;"
|
|
||||||
@click="changeOuter(1)"
|
|
||||||
:class="isOuter == 1 ? 'outer' : 'notOuter'"
|
|
||||||
>
|
|
||||||
系统考试
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
v-else
|
|
||||||
style="width: 100px; cursor: pointer;"
|
|
||||||
@click="changeOuter(2)"
|
|
||||||
:class="isOuter == 2 ? 'outer' : 'notOuter'"
|
|
||||||
>
|
|
||||||
外部考试
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<button
|
<button
|
||||||
style="width: 100px; cursor: pointer;"
|
style="width: 100px; cursor: pointer;"
|
||||||
@click="changeOuter(1)"
|
@click="changeOuter(1)"
|
||||||
:class="isOuter == 1 ? 'outer' : 'notOuter'"
|
:class="formData.examType === 1 ? 'outer' : 'notOuter'"
|
||||||
>
|
>
|
||||||
系统考试
|
系统考试
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
style="width: 100px; cursor: pointer;"
|
style="width: 100px; cursor: pointer;"
|
||||||
@click="changeOuter(2)"
|
@click="changeOuter(2)"
|
||||||
:class="isOuter == 2 ? 'outer' : 'notOuter'"
|
:class="formData.examType === 2 ? 'outer' : 'notOuter'"
|
||||||
>
|
>
|
||||||
外部考试
|
外部考试
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="isOuter===1" class="contentMain">
|
<div v-if="formData.examType===1" class="contentMain">
|
||||||
<div class="main_left">
|
<div class="main_left">
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
<div class="signbox">
|
<div class="signbox">
|
||||||
@@ -68,7 +50,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-input
|
<a-input
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
v-model:value="formData.examinationName"
|
v-model:value="formData.examinationName"
|
||||||
style="width: 400px; height: 40px; border-radius: 8px"
|
style="width: 400px; height: 40px; border-radius: 8px"
|
||||||
placeholder="请输入考试名称"
|
placeholder="请输入考试名称"
|
||||||
@@ -89,13 +70,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<s-test v-model:id="formData.examinationTestId" v-model:name="formData.examinationTestName">
|
<s-test v-model:id="formData.examinationTestId" v-model:name="formData.examinationTestName">
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<button class="xkbtn" @click="selectTest" :disabled="taskIndex >= 0">
|
<button class="xkbtn" style="margin:0">
|
||||||
{{ formData.examinationTestId ? "重选" : "选择" }}试卷
|
{{ formData.examinationTestId ? "重选" : "选择" }}试卷
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</s-test>
|
</s-test>
|
||||||
<div v-if="formData.examinationTestId">
|
<div v-if="formData.examinationTestId">
|
||||||
<a-tag closable color="processing" @close="delTag" :closeIcon="taskIndex >= 0">
|
<a-tag closable color="processing" @close="delTag" :closeIcon="true">
|
||||||
<span style="font-size: 14px; line-height: 33px">{{ formData.examinationTestName }}</span>
|
<span style="font-size: 14px; line-height: 33px">{{ formData.examinationTestName }}</span>
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,8 +97,8 @@
|
|||||||
style="width: 400px; height: 40px; border-radius: 8px"
|
style="width: 400px; height: 40px; border-radius: 8px"
|
||||||
:show-time="{format:'hh:mm'}"
|
:show-time="{format:'hh:mm'}"
|
||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
:disabled-time="disabledRangeTime"
|
format="YYYY-MM-DD HH:mm"
|
||||||
format="YYYY/MM/DD HH:mm"
|
valueFormat="YYYY-MM-DD HH:mm"
|
||||||
v-model:value="dateTime"
|
v-model:value="dateTime"
|
||||||
@change="timeChange"
|
@change="timeChange"
|
||||||
:placeholder="[' 开始时间', ' 结束时间']"
|
:placeholder="[' 开始时间', ' 结束时间']"
|
||||||
@@ -136,7 +117,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<a-input-number
|
<a-input-number
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="300"
|
:max="300"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
@@ -158,7 +138,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-input
|
<a-input
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
v-model:value="formData.passLine"
|
v-model:value="formData.passLine"
|
||||||
type="number"
|
type="number"
|
||||||
style="width: 400px; height: 40px; border-radius: 8px"
|
style="width: 400px; height: 40px; border-radius: 8px"
|
||||||
@@ -173,7 +152,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="textarea">
|
<div class="textarea">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
v-model:value="formData.examinationExplain"
|
v-model:value="formData.examinationExplain"
|
||||||
placeholder="请输入考试说明"
|
placeholder="请输入考试说明"
|
||||||
allow-clear
|
allow-clear
|
||||||
@@ -192,7 +170,6 @@
|
|||||||
<div class="timerbox">
|
<div class="timerbox">
|
||||||
<span>允许重复考试:</span>
|
<span>允许重复考试:</span>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
:min="-1"
|
:min="-1"
|
||||||
:max="300"
|
:max="300"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
@@ -217,7 +194,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-radio-group
|
<a-radio-group
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
style="margin-right: 12px"
|
style="margin-right: 12px"
|
||||||
v-model:value="formData.showAnswers"
|
v-model:value="formData.showAnswers"
|
||||||
>
|
>
|
||||||
@@ -232,7 +208,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-radio-group
|
<a-radio-group
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
style="margin-right: 12px"
|
style="margin-right: 12px"
|
||||||
v-model:value="formData.showAnalysis"
|
v-model:value="formData.showAnalysis"
|
||||||
>
|
>
|
||||||
@@ -247,7 +222,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-radio-group
|
<a-radio-group
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
style="margin-right: 12px"
|
style="margin-right: 12px"
|
||||||
v-model:value="formData.scoringModel"
|
v-model:value="formData.scoringModel"
|
||||||
>
|
>
|
||||||
@@ -264,7 +238,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-radio-group
|
<a-radio-group
|
||||||
:disabled="taskIndex >= 0"
|
|
||||||
style="margin-right: 12px"
|
style="margin-right: 12px"
|
||||||
v-model:value="formData.questionArrangement"
|
v-model:value="formData.questionArrangement"
|
||||||
>
|
>
|
||||||
@@ -292,7 +265,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-input
|
<a-input
|
||||||
v-model:value="formDataOuter.examinationName"
|
v-model:value="formData.examinationName"
|
||||||
style="width: 400px; height: 40px; border-radius: 8px"
|
style="width: 400px; height: 40px; border-radius: 8px"
|
||||||
placeholder="请输入考试名称"
|
placeholder="请输入考试名称"
|
||||||
:maxlength="20"
|
:maxlength="20"
|
||||||
@@ -311,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-input
|
<a-input
|
||||||
v-model:value="formDataOuter.source"
|
v-model:value="formData.source"
|
||||||
style="width: 400px; height: 40px; border-radius: 8px"
|
style="width: 400px; height: 40px; border-radius: 8px"
|
||||||
placeholder="请输入数据来源"
|
placeholder="请输入数据来源"
|
||||||
:maxlength="20"
|
:maxlength="20"
|
||||||
@@ -324,7 +297,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="textarea">
|
<div class="textarea">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
v-model:value="formDataOuter.externalExplain"
|
v-model:value="formData.externalExplain"
|
||||||
placeholder="请输入考试说明"
|
placeholder="请输入考试说明"
|
||||||
allow-clear
|
allow-clear
|
||||||
show-count
|
show-count
|
||||||
@@ -337,75 +310,109 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<a-button class="btn1" @click="closeDrawer">取消</a-button>
|
<a-button class="btn1" @click="closeDrawer">取消</a-button>
|
||||||
<a-button v-if="isOuter==1" class="btn2" @click="confirm">确定</a-button>
|
<a-button class="btn2" @click="confirm">确定</a-button>
|
||||||
<a-button v-else class="btn2" @click="confirmouter">确定</a-button>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 加载动画 -->
|
|
||||||
<div class="aeLoading" :style="{ display: addLoading ? 'flex' : 'none' }">
|
|
||||||
<a-spin :spinning="addLoading" tip=""/>
|
|
||||||
</div>
|
|
||||||
<!-- 选择考试抽屉 -->
|
|
||||||
<s-test v-model:STvisible="STvisible" @getSTData="getData"/>
|
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {defineEmits, defineProps, ref} from "vue";
|
import {defineEmits, defineProps, ref, watch} from "vue";
|
||||||
import STest from "./SelectTest.vue";
|
import STest from "./SelectTest.vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {message} from "ant-design-vue";
|
import {Form, message} from "ant-design-vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
taskList: []
|
taskList: []
|
||||||
})
|
})
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const formData = ref({
|
const initValue = {
|
||||||
|
examinationName: '',
|
||||||
|
examinationTestId: '',
|
||||||
|
examinationStartTime: '',
|
||||||
|
examinationEndTime: '',
|
||||||
|
examinationDuration: '',
|
||||||
|
passLine: '',
|
||||||
examType: 1,
|
examType: 1,
|
||||||
|
source: "",
|
||||||
showAnswers: 2,
|
showAnswers: 2,
|
||||||
showAnalysis: 2,
|
showAnalysis: 2,
|
||||||
scoringModel: 2,
|
scoringModel: 2,
|
||||||
questionArrangement: 4
|
questionArrangement: 4,
|
||||||
})
|
externalExplain: ""
|
||||||
|
}
|
||||||
const formDataOuter = ref({
|
const formData = ref(initValue)
|
||||||
examType: 2,
|
const innerRule = {
|
||||||
examinationName:"",
|
examinationName: [
|
||||||
source:"",
|
{
|
||||||
externalExplain:""
|
required: true,
|
||||||
})
|
message: '请输入考试名称',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examinationTestId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入选择试卷',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examinationStartTime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入开始开始时间',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examinationEndTime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入开始结束时间',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examinationDuration: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入考试时长',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
passLine: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入及格线',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
const outerRule = {
|
||||||
|
examinationName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入考试名称',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
source: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入数据来源',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
const rulesRef = ref(innerRule);
|
||||||
|
|
||||||
const emit = defineEmits({})
|
const emit = defineEmits({})
|
||||||
const taskIndex = ref(-1);
|
const taskIndex = ref(-1);
|
||||||
const dateTime = ref([]);
|
const dateTime = ref([]);
|
||||||
const isOuter = ref(1);
|
|
||||||
|
const {resetFields, validate} = Form.useForm(formData, rulesRef);
|
||||||
|
|
||||||
|
watch(() => formData.value.examType, () => {
|
||||||
|
formData.value.examType === 1 ? rulesRef.value = innerRule : rulesRef.value = outerRule
|
||||||
|
})
|
||||||
|
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
visible.value = false
|
visible.value = false
|
||||||
taskIndex.value = -1
|
taskIndex.value = -1
|
||||||
formData.value = {
|
resetFields()
|
||||||
examType: 1,
|
|
||||||
showAnswers: 2,
|
|
||||||
showAnalysis: 2,
|
|
||||||
scoringModel: 2,
|
|
||||||
questionArrangement: 4
|
|
||||||
}
|
|
||||||
formDataOuter.value = ref({
|
|
||||||
examType: 2,
|
|
||||||
examinationName:"",
|
|
||||||
source:"",
|
|
||||||
externalExplain:""
|
|
||||||
})
|
|
||||||
dateTime.value = []
|
dateTime.value = []
|
||||||
};
|
};
|
||||||
|
|
||||||
// const range = (start, end) => {
|
|
||||||
// const result = [];
|
|
||||||
// for (let i = start; i < end; i++) {
|
|
||||||
// result.push(i);
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// };
|
|
||||||
|
|
||||||
function timeChange(time, timeStr) {
|
function timeChange(time, timeStr) {
|
||||||
formData.value.examinationStartTime = timeStr[0]
|
formData.value.examinationStartTime = timeStr[0]
|
||||||
@@ -416,39 +423,13 @@ const disabledDate = (current) => {
|
|||||||
return current && current < dayjs().startOf('day');
|
return current && current < dayjs().startOf('day');
|
||||||
};
|
};
|
||||||
|
|
||||||
const disabledRangeTime = () => ({
|
|
||||||
// disabledHours: () => range(0, 24).splice(4, 20),
|
|
||||||
// disabledMinutes: () => range(30, 60),
|
|
||||||
// disabledSeconds: () => [55, 56],
|
|
||||||
});
|
|
||||||
|
|
||||||
// 系统考试
|
// 系统考试
|
||||||
function confirm() {
|
async function confirm() {
|
||||||
if (!formData.value.examinationName) {
|
await validate().catch(({errorFields}) => {
|
||||||
message.warning("请输入考试名称");
|
message.warning(errorFields[0].errors.join());
|
||||||
return
|
throw Error("数据校验不通过")
|
||||||
}
|
});
|
||||||
if (!formData.value.examinationTestId) {
|
|
||||||
message.warning("请输入选择试卷");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!formData.value.examinationStartTime) {
|
|
||||||
message.warning("请输入开始结束时间");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!formData.value.examinationEndTime) {
|
|
||||||
message.warning("请输入开始结束时间");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!formData.value.examinationDuration) {
|
|
||||||
message.warning("请输入考试时长");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!formData.value.passLine) {
|
|
||||||
message.warning("请输入及格线");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// debugger
|
|
||||||
if (taskIndex.value === -1) {
|
if (taskIndex.value === -1) {
|
||||||
const list = props.taskList
|
const list = props.taskList
|
||||||
list.push({name: formData.value.examinationName, type: props.type, info: {...formData.value}})
|
list.push({name: formData.value.examinationName, type: props.type, info: {...formData.value}})
|
||||||
@@ -456,44 +437,17 @@ function confirm() {
|
|||||||
const data = props.taskList[taskIndex.value]
|
const data = props.taskList[taskIndex.value]
|
||||||
data.name = formData.value.examinationName
|
data.name = formData.value.examinationName
|
||||||
data.info = formData.value
|
data.info = formData.value
|
||||||
data.examType = formData.value == 1 ? 1 : 2
|
|
||||||
}
|
}
|
||||||
emit('update:taskList', [...props.taskList])
|
emit('update:taskList', [...props.taskList])
|
||||||
closeDrawer()
|
closeDrawer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 外部考试
|
|
||||||
function confirmouter() {
|
|
||||||
if (!formDataOuter.value.examinationName) {
|
|
||||||
message.warning("请输入考试名称");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!formDataOuter.value.source) {
|
|
||||||
message.warning("请输入数据来源");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taskIndex.value === -1) {
|
|
||||||
const list = props.taskList
|
|
||||||
list.push({name: formDataOuter.value.examinationName,duration:dayjs(formData.value.examinationEndTime).diff(formData.value.examinationStartTime,'minutes'), type: props.type, info: {...formDataOuter.value}})
|
|
||||||
} else {
|
|
||||||
const data = props.taskList[taskIndex.value]
|
|
||||||
data.name = formDataOuter.value.examinationName
|
|
||||||
data.info = formDataOuter.value
|
|
||||||
data.examType = 2
|
|
||||||
data.duration = dayjs(formData.value.examinationEndTime).diff(formData.value.examinationStartTime,'minutes')
|
|
||||||
}
|
|
||||||
emit('update:taskList', [...props.taskList])
|
|
||||||
closeDrawer()
|
|
||||||
}
|
|
||||||
|
|
||||||
function openDrawer(i, row) {
|
function openDrawer(i, row) {
|
||||||
row && row.info.examType == 1 ? row && (formData.value = row.info) : row && (formDataOuter.value = row.info);
|
row && resetFields(row.info);
|
||||||
row ? isOuter.value = row.info.examType : isOuter.value = 1;
|
row && (dateTime.value = [row.info.examinationStartTime, row.info.examinationEndTime]);
|
||||||
row && row.info.examType == 1 && (dateTime.value = [dayjs(row.info.examinationStartTime, "YYYY-MM-DD HH:mm"), dayjs(row.info.examinationEndTime, "YYYY-MM-DD HH:mm")]);
|
|
||||||
(i >= 0) && (taskIndex.value = i);
|
(i >= 0) && (taskIndex.value = i);
|
||||||
visible.value = true
|
visible.value = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const delTag = () => {
|
const delTag = () => {
|
||||||
@@ -502,7 +456,7 @@ const delTag = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeOuter(v) {
|
function changeOuter(v) {
|
||||||
isOuter.value = v;
|
formData.value.examType = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({openDrawer})
|
defineExpose({openDrawer})
|
||||||
|
|||||||
Reference in New Issue
Block a user