评估删除、添加、修改保存报错处理,新增meta清缓存

This commit is contained in:
zhangsir
2024-11-29 14:23:02 +08:00
parent 69fc77b678
commit d3acdae5fc
4 changed files with 27 additions and 12 deletions

View File

@@ -12,6 +12,9 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>京东方大学堂</title>

View File

@@ -87,7 +87,7 @@ const canSubmit = computed(() => {
data.value.scoringQuestionVoList
];
return lists.some(list => Array.isArray(list) && list.length > 0);
return lists.some(list => Array.isArray(list) && list?.filter(item=>!item.deleted).length > 0);
});
// const orderList = computed(()=>[...data.value.singleStemVoList.filter(t=>!t.deleted),...data.value.multipleStemVoList.filter(t=>!t.deleted),...data.value.essayQuestionVoList.filter(t=>!t.deleted),...data.value.scoringQuestionVoList.filter(t=>!t.deleted)].sort((a,b)=>a.orderNumber-b.orderNumber))
const orderList = computed(() => {
@@ -103,7 +103,13 @@ const orderList = computed(() => {
.sort((a, b) => a.orderNumber - b.orderNumber);
});
watch(()=>orderList.value.length,()=> orderList.value.forEach((t,i)=>t.orderNumber = i + 1))
watchEffect(() => id && request(ASSESSMENT_DETAIL(id), {}).then((res) => data.value = res.data));
watchEffect(() => id && request(ASSESSMENT_DETAIL(id), {}).then((res) =>{
res.data.singleStemVoList = res.data.singleStemVoList || []
res.data.multipleStemVoList = res.data.multipleStemVoList || []
res.data.essayQuestionVoList = res.data.essayQuestionVoList || []
res.data.scoringQuestionVoList = res.data.scoringQuestionVoList || []
data.value = res.data
}));
const handleSave = () => {
console.log(data);
loading.value = true;
@@ -112,12 +118,12 @@ const handleSave = () => {
loading.value = false;
return false;
}
const listsss = data.value.scoringQuestionVoList.map((item) => ({
minimumEvaluation: item.minimumEvaluation || '非常不满意',
highestEvaluation: item.highestEvaluation || '非常满意',
orderNumber: item.orderNumber,
assessmentId: id,
}));
// const listsss = data.value.scoringQuestionVoList.map((item) => ({
// minimumEvaluation: item.minimumEvaluation || '非常不满意',
// highestEvaluation: item.highestEvaluation || '非常满意',
// orderNumber: item.orderNumber,
// assessmentId: id,
// }));
// // 如果 assessmentId 有值调用
// if(id){
// request('/activitySubmit/editAssessmentScore post',listsss).then((res)=>{
@@ -238,11 +244,11 @@ const checkVal = () => {
return false;
}
// 评分
if (data.value.scoringQuestionVoList.length && data.value.scoringQuestionVoList?.some((item) => !item.deleted && (!item.assessmentScTitle))) {
if (data.value.scoringQuestionVoList?.length && data.value.scoringQuestionVoList?.some((item) => !item.deleted && (!item.assessmentScTitle))) {
message.error("评分题干为必填 请确认!");
return false;
}
if (data.value.scoringQuestionVoList.length && data.value.scoringQuestionVoList.reduce((pre, cur) => pre + parseInt(cur.weightScale), 0) !== 100) {
if (data.value.scoringQuestionVoList?.filter(item=>!item.deleted)?.length && data.value.scoringQuestionVoList?.filter(item=>!item.deleted)?.reduce((pre, cur) => pre + parseInt(cur.weightScale), 0) !== 100) {
message.error("当前权重设置是百分制 请重新配置");
return false;
}

View File

@@ -43,7 +43,10 @@
</template>
<script setup>
const props = defineProps({ index: Number, list: Array, item: Object});
const del = () => props.item.id?(props.item.deleted = true):(props.list.splice(props.index, 1));
const del = () => {
const index = props.list.findIndex(t => t.orderNumber==props.item.orderNumber)||0
props.item.id?(props.item.deleted = true):(props.list.splice(index, 1))
};
</script>
<style lang="scss">
.researchadd {

View File

@@ -102,7 +102,10 @@ import {computed} from "vue";
import {message} from "ant-design-vue";
const props = defineProps({ index: Number, list: Array, item: Object });
const del = () => props.item.id ? (props.item.deleted = true) : (props.list.splice(props.index, 1));
const del = () => {
const index = props.list.findIndex(t => t.orderNumber==props.item.orderNumber)||0
props.item.id ? (props.item.deleted = true) : (props.list.splice(index, 1))
};
const scoreList = computed(() => new Array(props.item.assessmentMaxScore - props.item.assessmentMinScore + 1).fill(0).map((value, index) => ({ id: index + 1, text: props.item.assessmentMinScore + index })));
const minChange = (e) => {
if (e > props.item.assessmentMaxScore) return message.warning("最低分不能超过最高分");