mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +08:00
--fix 评估重写
This commit is contained in:
@@ -22,4 +22,4 @@ export const WORK_DETAIL = workId => `/work/queryWorkDetailById?workId=${workId}
|
||||
//考试
|
||||
export const EXAM_DETAIL = examinationId => `/examination/queryExaminationDetailById?examinationId=${examinationId} post`;
|
||||
//评估
|
||||
export const ASSESSMENT_DETAIL = "/assessment/queryAssessmentDetailById post";
|
||||
export const ASSESSMENT_DETAIL = (assessmentId)=>`/assessment/queryAssessmentDetailById?assessmentId=${assessmentId} post`;
|
||||
|
||||
@@ -5,60 +5,24 @@
|
||||
<span class="title">创建评估</span>
|
||||
<router-link to="/researchmanage" class="goback">
|
||||
<span class="return"></span>
|
||||
<router-link class="returntext" to="/researchmanage">
|
||||
返回
|
||||
</router-link>
|
||||
<router-link class="returntext" to="/researchmanage">返回</router-link>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="addtype">
|
||||
<div class="addtypen">创建评估类型</div>
|
||||
<div class="types" @click="handleTypes(1)">单选题</div>
|
||||
<div class="types" @click="handleTypes(2)">多选题</div>
|
||||
<div class="types" @click="handleTypes(3)">问答题</div>
|
||||
<div class="types" @click="handleTypes(4)">评分题</div>
|
||||
<div class="types" @click="addSingleItem">单选题</div>
|
||||
<div class="types" @click="addMultipleItem">多选题</div>
|
||||
<div class="types" @click="addEssayQuestionItem">问答题</div>
|
||||
<div class="types" @click="addScoringQuestionItem">评分题</div>
|
||||
</div>
|
||||
<div
|
||||
v-for="(item, index) in allFormsData"
|
||||
:key="index + new Date().getTime()"
|
||||
>
|
||||
<ResearchAddSingle
|
||||
v-if="item.type === 1 && item.deleted!==true"
|
||||
:item="item"
|
||||
:assessmentId="assessmentId"
|
||||
@del="handleDel"
|
||||
/>
|
||||
<ResearchAddMulti
|
||||
v-if="item.type === 2 && item.deleted!==true"
|
||||
:item="item"
|
||||
:assessmentId="assessmentId"
|
||||
@del="handleDel"
|
||||
/>
|
||||
<ResearchAddAsk
|
||||
v-if="item.type === 3 && item.deleted!==true"
|
||||
:item="item"
|
||||
:assessmentId="assessmentId"
|
||||
@del="handleDel"
|
||||
/>
|
||||
<ResearchAddPin
|
||||
v-if="item.type === 4 && item.deleted!==true"
|
||||
:item="item"
|
||||
:assessmentId="assessmentId"
|
||||
@del="handleDel"
|
||||
/>
|
||||
<div v-if="orderList.length">
|
||||
<div v-for="(item, index) in orderList" :key="index + new Date().getTime()">
|
||||
<ResearchAddSingle v-if="item.questionType == 1" :index="item.orderNumber-1" :item="item" :list="data.singleStemVoList"/>
|
||||
<ResearchAddMulti v-else-if="item.questionType == 2" :index="item.orderNumber-1" :item="item" :list="data.multipleStemVoList"/>
|
||||
<ResearchAddAsk v-else-if="item.questionType == 3" :index="item.orderNumber-1" :item="item" :list="data.essayQuestionVoList"/>
|
||||
<ResearchAddPin v-else-if="item.questionType == 4" :index="item.orderNumber-1" :item="item" :list="data.scoringQuestionVoList"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="opinion name2">
|
||||
<div class="namebox">
|
||||
<div class="inname" style="margin-top: 13px">您的其他意见</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-textarea
|
||||
v-model:value="valueMore"
|
||||
style="height: 110px"
|
||||
show-count
|
||||
:maxlength="200"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="footer">
|
||||
<div class="btn">
|
||||
<a-button
|
||||
@@ -70,9 +34,9 @@
|
||||
background-color: #4ea6ff;
|
||||
"
|
||||
:loading="loading"
|
||||
:disabled="!canSubmit"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存
|
||||
>保存
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -86,639 +50,172 @@
|
||||
background-color: #4ea6ff;
|
||||
"
|
||||
@click="handleAllCancel"
|
||||
>
|
||||
取消
|
||||
>取消
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {reactive, toRefs} from "vue";
|
||||
<script setup>
|
||||
import {computed, ref, watch, watchEffect} from "vue";
|
||||
import ResearchAddSingle from "./components/ResearchAddSingle.vue";
|
||||
import ResearchAddMulti from "./components/ResearchAddMulti.vue";
|
||||
import ResearchAddAsk from "./components/ResearchAddAsk.vue";
|
||||
import ResearchAddPin from "./components/ResearchAddPin.vue";
|
||||
import {
|
||||
sortBy,
|
||||
traverseArr,
|
||||
filterCommon,
|
||||
deepCloneFilterString,
|
||||
} from "@/utils/utils";
|
||||
import {
|
||||
queryResearchDetailById,
|
||||
editResearchMessage,
|
||||
createResearch,
|
||||
// deleteChoiceQuestion,
|
||||
// deleteQuestionScAndQa,
|
||||
} from "@/api/indexResearch";
|
||||
import {editResearchMessage,} from "@/api/indexResearch";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import {message} from "ant-design-vue";
|
||||
import {ASSESSMENT_DETAIL} from "@/api/apis";
|
||||
import {request} from "@/api/request";
|
||||
|
||||
export default {
|
||||
name: "ResearchAdd",
|
||||
components: {
|
||||
ResearchAddSingle,
|
||||
ResearchAddMulti,
|
||||
ResearchAddAsk,
|
||||
ResearchAddPin,
|
||||
},
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const state = reactive({
|
||||
assessmentId: "", //编辑时候传
|
||||
assessmentName: "",
|
||||
assessmentNameNew: route.query.name,
|
||||
|
||||
allFormsData: [],
|
||||
valueMore: "",
|
||||
loading: false,
|
||||
});
|
||||
|
||||
// 详情
|
||||
const getInfoDate = async () => {
|
||||
let id = router.currentRoute.value.params.id;
|
||||
if (id) {
|
||||
state.assessmentId = id;
|
||||
let res = await queryResearchDetailById({
|
||||
assessmentId: state.assessmentId,
|
||||
}).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
return res.data.data;
|
||||
}
|
||||
});
|
||||
state.assessmentName = res.assessmentName;
|
||||
state.valueMore = res.assessmentMark;
|
||||
let renderArr = [
|
||||
...res.singleStemVoList,
|
||||
...res.multipleStemVoList,
|
||||
...res.essayQuestionVoList,
|
||||
...res.scoringQuestionVoList,
|
||||
];
|
||||
sortBy(renderArr, "orderNumber"); //序号
|
||||
console.log(renderArr)
|
||||
state.allFormsData = parseData(renderArr, "questionType"); //类型
|
||||
}
|
||||
};
|
||||
getInfoDate();
|
||||
|
||||
// 转换成前端格式
|
||||
const parseData = (arr, typeKey) => {
|
||||
const resultArr = [];
|
||||
arr.forEach((item) => {
|
||||
let key = Number(item[typeKey]);
|
||||
let obj = {};
|
||||
if (key === 1) {
|
||||
let restList = traverseArr(item.assessmentSingleChoiceVoList, {
|
||||
ids:"id",
|
||||
deleted:"deleted",
|
||||
inputVal: "singleOptionName",
|
||||
imgVal: "singleOptionPictureAddress",
|
||||
optionId: "singleOptionId",
|
||||
}).map((itm, idx) => {
|
||||
itm.id = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
|
||||
obj = {
|
||||
type: key,
|
||||
valueSingle: item.singleStemName,
|
||||
singleList: restList,
|
||||
orderNumber: item.orderNumber,
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
if (key === 2) {
|
||||
let restList = traverseArr(item.multipleChoiceVoList, {
|
||||
ids:"id",
|
||||
deleted:"deleted",
|
||||
inputVal: "multipleOptionName",
|
||||
imgVal: "multipleOptionPictureAddress",
|
||||
optionId: "multipleOptionId",
|
||||
}).map((itm, idx) => {
|
||||
itm.id = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
|
||||
obj = {
|
||||
type: key,
|
||||
valueMutil: item.multipleStemName,
|
||||
mutilList: restList,
|
||||
orderNumber: item.orderNumber,
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
if (key === 3) {
|
||||
obj = {
|
||||
ids: item.id,
|
||||
deleted:item.deleted,
|
||||
type: key,
|
||||
valueAsk: item.assessmentQaTitle,
|
||||
valueAskDesc: item.assessmentQaDescribe,
|
||||
optionId: item.assessmentQaId,
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
if (key === 4) {
|
||||
obj = {
|
||||
ids: item.id,
|
||||
deleted:item.deleted,
|
||||
type: key,
|
||||
valuePin: item.assessmentScTitle,
|
||||
minScore: item.assessmentMinScore,
|
||||
maxScore: item.assessmentMaxScore,
|
||||
pinQuan: item.weightScale,
|
||||
optionId: item.assessmentScId,
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
});
|
||||
resultArr.map((itm, idx) => {
|
||||
itm.id = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
console.log(resultArr)
|
||||
return resultArr;
|
||||
};
|
||||
// 转换成后端格式
|
||||
const restData = (arr, typeKey) => {
|
||||
const resultArr = [];
|
||||
arr.forEach((item) => {
|
||||
let obj = {};
|
||||
if (item[typeKey] === 1) {
|
||||
let restList = traverseArr(item.singleList, {
|
||||
id:"ids",
|
||||
deleted:"deleted",
|
||||
singleOptionName: "inputVal",
|
||||
singleOptionPictureAddress: "imgVal",
|
||||
singleOptionId: "optionId",
|
||||
}).map((itm, idx) => {
|
||||
itm.optionOrderNum = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
restList.forEach((item) => {
|
||||
item.singleOptionId = item.singleOptionId
|
||||
? item.singleOptionId
|
||||
: "";
|
||||
});
|
||||
|
||||
obj = {
|
||||
questionType: item[typeKey],
|
||||
singleStemName: item.valueSingle,
|
||||
singleList: restList,
|
||||
orderNumber: item.orderNumber,
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
if (item[typeKey] === 2) {
|
||||
let restList = traverseArr(item.mutilList, {
|
||||
id:"ids",
|
||||
deleted:"deleted",
|
||||
multipleOptionName: "inputVal",
|
||||
multipleOptionPictureAddress: "imgVal",
|
||||
multipleOptionId: "optionId",
|
||||
}).map((itm, idx) => {
|
||||
itm.optionOrderNum = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
restList.forEach((item) => {
|
||||
item.multipleOptionId = item.multipleOptionId
|
||||
? item.multipleOptionId
|
||||
: "";
|
||||
});
|
||||
|
||||
obj = {
|
||||
questionType: item[typeKey],
|
||||
multipleStemName: item.valueMutil,
|
||||
mutilList: restList,
|
||||
orderNumber: item.orderNumber,
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
if (item[typeKey] === 3) {
|
||||
obj = {
|
||||
id:item.ids,
|
||||
deleted:item.deleted,
|
||||
questionType: item[typeKey],
|
||||
assessmentQaTitle: item.valueAsk,
|
||||
assessmentQaDescribe: item.valueAskDesc,
|
||||
assessmentQaId: item.optionId ? item.optionId : "",
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
if (item[typeKey] === 4) {
|
||||
obj = {
|
||||
id:item.ids,
|
||||
deleted:item.deleted,
|
||||
questionType: item[typeKey],
|
||||
assessmentScTitle: item.valuePin,
|
||||
assessmentMinScore: item.minScore,
|
||||
assessmentMaxScore: item.maxScore,
|
||||
weightScale: item.pinQuan,
|
||||
assessmentScId: item.optionId ? item.optionId : "",
|
||||
};
|
||||
resultArr.push(obj);
|
||||
}
|
||||
});
|
||||
resultArr.map((itm, idx) => {
|
||||
itm.orderNumber = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
console.log(222);
|
||||
console.log(resultArr);
|
||||
return resultArr;
|
||||
};
|
||||
// 解散传值
|
||||
const parseItem = (arr) => {
|
||||
const filterComObj = filterCommon(arr, "questionType");
|
||||
console.log('filterComObj')
|
||||
console.log(filterComObj)
|
||||
let resultObj = {};
|
||||
for (let key in filterComObj) {
|
||||
if (key === "1") {
|
||||
let arrSingle = filterComObj[key];
|
||||
let arr = [];
|
||||
arrSingle.forEach((item) => {
|
||||
if (item.singleList.length) {
|
||||
item.singleList.forEach((itm) => {
|
||||
arr.push({
|
||||
...itm,
|
||||
singleStemName: item.singleStemName,
|
||||
orderNumber: item.orderNumber,
|
||||
questionType: item.questionType,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
resultObj.assessmentSingleChoiceDtoList = arr;
|
||||
}
|
||||
if (key === "2") {
|
||||
let arrMulti = filterComObj[key];
|
||||
let arr = [];
|
||||
arrMulti.forEach((item) => {
|
||||
if (item.mutilList.length) {
|
||||
item.mutilList.forEach((itm) => {
|
||||
arr.push({
|
||||
...itm,
|
||||
multipleStemName: item.multipleStemName,
|
||||
orderNumber: item.orderNumber,
|
||||
questionType: item.questionType,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
resultObj.assessmentMultipleChoiceDtoList = arr;
|
||||
}
|
||||
if (key === "3") {
|
||||
resultObj.assessmentEssayQuestionDtoList = filterComObj[key];
|
||||
}
|
||||
if (key === "4") {
|
||||
resultObj.assessmentScoringQuestionDtoList = filterComObj[key];
|
||||
}
|
||||
}
|
||||
return resultObj;
|
||||
};
|
||||
const creatFromData = (type) => {
|
||||
let obj = {};
|
||||
switch (type) {
|
||||
case 1:
|
||||
obj = {
|
||||
type,
|
||||
id: state.allFormsData.length + 1,
|
||||
valueSingle: "",
|
||||
deleted: false,
|
||||
singleList: [
|
||||
{
|
||||
id: 1,
|
||||
inputVal: "",
|
||||
imgVal: "",
|
||||
deleted: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
obj = {
|
||||
type,
|
||||
id: state.allFormsData.length + 1,
|
||||
valueMutil: "",
|
||||
deleted: false,
|
||||
mutilList: [
|
||||
{
|
||||
id: 1,
|
||||
inputVal: "",
|
||||
imgVal: "",
|
||||
deleted: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
obj = {
|
||||
type,
|
||||
id: state.allFormsData.length + 1,
|
||||
valueAsk: "",
|
||||
valueAskDesc: "",
|
||||
deleted: false,
|
||||
};
|
||||
break;
|
||||
case 4:
|
||||
obj = {
|
||||
type,
|
||||
id: state.allFormsData.length + 1,
|
||||
valuePin: "",
|
||||
minScore: 1,
|
||||
maxScore: 10,
|
||||
pinQuan: 100,
|
||||
deleted: false,
|
||||
};
|
||||
break;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
const handleTypes = (type) => {
|
||||
state.allFormsData.push(creatFromData(type));
|
||||
};
|
||||
|
||||
const handleDel = ({ id, type, curItem }) => {
|
||||
|
||||
// 接口删除
|
||||
// if (state.assessmentId && (curItem.orderNumber || curItem.optionId)) {
|
||||
// if (type === 1) {
|
||||
// deleteChoiceQuestion({
|
||||
// assessmentId: state.assessmentId,
|
||||
// questionType: "1",
|
||||
// orderNumber: curItem.orderNumber,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// if (type === 2) {
|
||||
// deleteChoiceQuestion({
|
||||
// assessmentId: state.assessmentId,
|
||||
// questionType: "2",
|
||||
// orderNumber: curItem.orderNumber,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// if (type === 3) {
|
||||
// deleteQuestionScAndQa({
|
||||
// assessmentId: state.assessmentId,
|
||||
// questionType: "3",
|
||||
// optionId: curItem.optionId,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// if (type === 4) {
|
||||
// deleteQuestionScAndQa({
|
||||
// assessmentId: state.assessmentId,
|
||||
// questionType: "4",
|
||||
// optionId: curItem.optionId,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
if (state.assessmentId && (curItem.orderNumber || curItem.optionId)) {
|
||||
if (type === 1) {
|
||||
virtualDel(id);
|
||||
}
|
||||
if (type === 2) {
|
||||
virtualDel(id);
|
||||
}
|
||||
if (type === 3) {
|
||||
virtualDel(id);
|
||||
}
|
||||
if (type === 4) {
|
||||
virtualDel(id);
|
||||
}
|
||||
} else {
|
||||
virtualDel(id);
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
// state.allFormsData.forEach((item, index) => {
|
||||
// if (item.id === id) {
|
||||
// state.allFormsData.splice(index, 1);
|
||||
// }
|
||||
// });
|
||||
// state.allFormsData.map((item, index) => {
|
||||
// item.id = index + 1;
|
||||
// return item;
|
||||
// });
|
||||
// 前端删除
|
||||
state.allFormsData.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
state.allFormsData[index].deleted = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 处理id为空的字段
|
||||
const formatID = (data) => {
|
||||
let obj = {}
|
||||
for(let i in data){
|
||||
if(i=="assessmentSingleChoiceDtoList"){
|
||||
let arr1 = []
|
||||
for(let k=0;k<data[i].length;k++){
|
||||
if(data[i][k].id!==undefined){
|
||||
arr1.push(data[i][k])
|
||||
}else{
|
||||
let obj1 = {...data[i][k]}
|
||||
delete obj1.id
|
||||
delete obj1.deleted
|
||||
arr1.push(obj1)
|
||||
}
|
||||
}
|
||||
obj.assessmentSingleChoiceDtoList = arr1;
|
||||
}
|
||||
if(i=="assessmentMultipleChoiceDtoList"){
|
||||
let arr1 = []
|
||||
for(let k=0;k<data[i].length;k++){
|
||||
if(data[i][k].id!==undefined){
|
||||
arr1.push(data[i][k])
|
||||
}else{
|
||||
let obj1 = {...data[i][k]}
|
||||
delete obj1.id
|
||||
arr1.push(obj1)
|
||||
}
|
||||
}
|
||||
obj.assessmentMultipleChoiceDtoList = arr1;
|
||||
}
|
||||
if(i=="assessmentEssayQuestionDtoList"){
|
||||
let arr1 = []
|
||||
for(let k=0;k<data[i].length;k++){
|
||||
if(data[i][k].id!==undefined){
|
||||
arr1.push(data[i][k])
|
||||
}else{
|
||||
let obj1 = {...data[i][k]}
|
||||
delete obj1.id
|
||||
arr1.push(obj1)
|
||||
}
|
||||
}
|
||||
obj.assessmentEssayQuestionDtoList = arr1;
|
||||
}
|
||||
if(i=="assessmentScoringQuestionDtoList"){
|
||||
let arr1 = []
|
||||
for(let k=0;k<data[i].length;k++){
|
||||
if(data[i][k].id!==undefined){
|
||||
arr1.push(data[i][k])
|
||||
}else{
|
||||
let obj1 = {...data[i][k]}
|
||||
delete obj1.id
|
||||
delete obj1.deleted
|
||||
arr1.push(obj1)
|
||||
}
|
||||
}
|
||||
obj.assessmentScoringQuestionDtoList = arr1;
|
||||
}
|
||||
}
|
||||
console.log(obj)
|
||||
return obj
|
||||
}
|
||||
const handleSave = () => {
|
||||
let resultPost = {};
|
||||
let filterData = formatID(parseItem(restData(state.allFormsData, "type")));
|
||||
// 处理id为undefined得字段
|
||||
console.log('mmmmmmmmm------->',filterData)
|
||||
// 校验
|
||||
if (!checkVal(filterData)) {
|
||||
return false;
|
||||
}
|
||||
state.loading = true;
|
||||
|
||||
if (state.assessmentId) {
|
||||
resultPost = {
|
||||
id: state.assessmentId,
|
||||
assessmentName: state.assessmentName,
|
||||
assessmentMark: state.valueMore,
|
||||
...filterData,
|
||||
};
|
||||
resultPost = deepCloneFilterString(resultPost, [
|
||||
"assessmentMaxScore",
|
||||
"assessmentMinScore",
|
||||
]);
|
||||
|
||||
editResearchMessage(resultPost).then((res) => {
|
||||
state.loading = false;
|
||||
if (res.data.code === 200) {
|
||||
message.success("编辑成功");
|
||||
router.push({
|
||||
path: "/researchmanage",
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
resultPost = {
|
||||
assessmentName: state.assessmentNameNew,
|
||||
assessmentMark: state.valueMore,
|
||||
...filterData,
|
||||
};
|
||||
resultPost = deepCloneFilterString(resultPost, [
|
||||
"assessmentMaxScore",
|
||||
"assessmentMinScore",
|
||||
]);
|
||||
createResearch(resultPost).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
message.success("创建成功");
|
||||
router.push({
|
||||
path: "/researchmanage",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const handleAllCancel = () => {
|
||||
state.allFormsData = [];
|
||||
router.push({
|
||||
path: "/researchmanage",
|
||||
});
|
||||
};
|
||||
const checkVal = (filterData) => {
|
||||
// 问答
|
||||
if (
|
||||
filterData.assessmentEssayQuestionDtoList &&
|
||||
filterData.assessmentEssayQuestionDtoList.length
|
||||
) {
|
||||
let arr = filterData.assessmentEssayQuestionDtoList;
|
||||
for (let item of arr) {
|
||||
if (!item.assessmentQaTitle) {
|
||||
message.error("问答题干为必填 请确认");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 多选
|
||||
console.log(filterData.assessmentMultipleChoiceDtoList);
|
||||
if(filterData.assessmentMultipleChoiceDtoList && !filterData.assessmentMultipleChoiceDtoList.some(t=>!t.deleted)){
|
||||
message.error("多选题最少添加一个选项!");
|
||||
return false;
|
||||
}
|
||||
if(filterData.assessmentMultipleChoiceDtoList?.some((item) => !item.deleted && (!item.multipleStemName || !item.multipleOptionName))){
|
||||
message.error("多选题干或选项为必填 请确认!");
|
||||
return false;
|
||||
}
|
||||
// 评分
|
||||
if (
|
||||
filterData.assessmentScoringQuestionDtoList &&
|
||||
filterData.assessmentScoringQuestionDtoList.length
|
||||
) {
|
||||
let CountNum = 0;
|
||||
let CountArr = filterData.assessmentScoringQuestionDtoList;
|
||||
for (let item of CountArr) {
|
||||
if (!item.assessmentScTitle) {
|
||||
message.error("评分题干为必填 请确认");
|
||||
return false;
|
||||
}
|
||||
CountNum += Number(item["weightScale"]);
|
||||
}
|
||||
// console.log("CountNum");
|
||||
// console.log(CountNum);
|
||||
// if(CountNum>100){
|
||||
// CountNum = 100;
|
||||
// }
|
||||
if (CountNum !== 100) {
|
||||
message.error("当前权重设置是百分制 请重新配置");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 单选
|
||||
if(filterData.assessmentSingleChoiceDtoList && !filterData.assessmentSingleChoiceDtoList.length){
|
||||
message.error("单选题最少添加一个选项!");
|
||||
return false;
|
||||
}
|
||||
if(filterData.assessmentSingleChoiceDtoList?.some((item) => !item.deleted && (!item.singleStemName || !item.singleOptionName))){
|
||||
message.error("单选题干或选项为必填 请确认!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
handleTypes,
|
||||
handleSave,
|
||||
handleAllCancel,
|
||||
handleDel,
|
||||
};
|
||||
},
|
||||
const router = useRouter();
|
||||
const loading = ref(false);
|
||||
const { params: { id }, query: { name:assessmentName } } = useRoute();
|
||||
const data = ref({
|
||||
assessmentName,
|
||||
singleStemVoList: [],
|
||||
multipleStemVoList: [],
|
||||
essayQuestionVoList: [],
|
||||
scoringQuestionVoList: []
|
||||
});
|
||||
const canSubmit = computed(()=>data.value.singleStemVoList.length || data.value.multipleStemVoList.length || data.value.essayQuestionVoList.length || data.value.scoringQuestionVoList.length)
|
||||
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))
|
||||
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));
|
||||
const handleSave = () => {
|
||||
console.log(data);
|
||||
loading.value = true;
|
||||
// 校验
|
||||
if (!checkVal()) {
|
||||
loading.value = false;
|
||||
return false;
|
||||
}
|
||||
editResearchMessage({
|
||||
id,
|
||||
assessmentName: data.value.assessmentName,
|
||||
assessmentSingleChoiceDtoList: data.value.singleStemVoList.flatMap(t=>t.assessmentSingleChoiceVoList.map(s=>({...s,deleted:(t.deleted || s.deleted),singleStemName:t.singleStemName}))),
|
||||
assessmentMultipleChoiceDtoList: data.value.multipleStemVoList.flatMap(t=>t.multipleChoiceVoList.map(s=>({...s,deleted:(t.deleted || s.deleted),multipleStemName:t.multipleStemName}))),
|
||||
assessmentEssayQuestionDtoList: data.value.essayQuestionVoList,
|
||||
assessmentScoringQuestionDtoList: data.value.scoringQuestionVoList
|
||||
}).then(() => {
|
||||
loading.value = false;
|
||||
message.success("编辑成功");
|
||||
router.push({ path: "/researchmanage"});
|
||||
});
|
||||
};
|
||||
const handleAllCancel = () => router.push({ path: "/researchmanage" });
|
||||
function addSingleItem() {
|
||||
data.value.singleStemVoList.push({
|
||||
questionType: 1,
|
||||
singleStemName: "",
|
||||
orderNumber: orderList.value?.length + 1,
|
||||
assessmentSingleChoiceVoList: [
|
||||
{
|
||||
questionType: 1,
|
||||
singleOptionName: "",
|
||||
singleOptionPictureAddress: "",
|
||||
singleStemName: "",
|
||||
deleted: false,
|
||||
orderNumber: (data.value?.singleStemVoList?.length || 0) + 1,
|
||||
optionOrderNum: 1
|
||||
},
|
||||
{
|
||||
questionType: 1,
|
||||
singleOptionName: "",
|
||||
singleOptionPictureAddress: "",
|
||||
singleStemName: "",
|
||||
deleted: false,
|
||||
orderNumber: (data.value?.singleStemVoList?.length || 0) + 1,
|
||||
optionOrderNum: 2
|
||||
}
|
||||
],
|
||||
deleted: false,
|
||||
});
|
||||
}
|
||||
|
||||
function addMultipleItem() {
|
||||
data.value.multipleStemVoList.push({
|
||||
questionType: 2,
|
||||
multipleStemName: "",
|
||||
orderNumber: orderList.value?.length + 1,
|
||||
multipleChoiceVoList: [
|
||||
{
|
||||
questionType: 2,
|
||||
multipleOptionName: "",
|
||||
multipleOptionPictureAddress: "",
|
||||
multipleStemName: "",
|
||||
deleted: false,
|
||||
orderNumber: (data.value?.multipleStemVoList?.length || 0) + 1,
|
||||
optionOrderNum: 1
|
||||
},
|
||||
{
|
||||
questionType: 2,
|
||||
multipleOptionName: "",
|
||||
multipleOptionPictureAddress: "",
|
||||
multipleStemName: "",
|
||||
deleted: false,
|
||||
orderNumber: (data.value?.multipleStemVoList?.length || 0) + 1,
|
||||
optionOrderNum: 2
|
||||
}
|
||||
],
|
||||
deleted: false,
|
||||
});
|
||||
}
|
||||
function addEssayQuestionItem() {
|
||||
data.value.essayQuestionVoList.push({
|
||||
questionType: 3,
|
||||
assessmentQaTitle: "",
|
||||
orderNumber: orderList.value?.length + 1,
|
||||
deleted: false,
|
||||
});
|
||||
}
|
||||
function addScoringQuestionItem() {
|
||||
data.value.scoringQuestionVoList.push({
|
||||
questionType: 4,
|
||||
assessmentScTitle: "",
|
||||
assessmentMaxScore: 10,
|
||||
assessmentMinScore: 1,
|
||||
weightScale: 100,
|
||||
orderNumber: orderList.value?.length + 1,
|
||||
deleted: false,
|
||||
});
|
||||
}
|
||||
const checkVal = () => {
|
||||
// 问答
|
||||
if (data.value.essayQuestionVoList.length && data.value.essayQuestionVoList?.some((item) => !item.deleted && (!item.assessmentQaTitle))) {
|
||||
message.error("问答题干为必填 请确认!");
|
||||
return false;
|
||||
}
|
||||
// 多选
|
||||
if (data.value.multipleStemVoList.length && data.value.multipleStemVoList.some(t => !t.deleted && t.multipleChoiceVoList.filter(s=>!s.deleted)?.length < 2)) {
|
||||
message.error("多选题最少添加两个选项!");
|
||||
return false;
|
||||
}
|
||||
if (data.value.multipleStemVoList.length && data.value.multipleStemVoList?.some((item) => !item.deleted && (!item.multipleStemName || item.multipleChoiceVoList?.some((t) => !t.deleted && !t.multipleOptionName)))) {
|
||||
message.error("多选题干或选项为必填 请确认!");
|
||||
return false;
|
||||
}
|
||||
// 评分
|
||||
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) {
|
||||
message.error("当前权重设置是百分制 请重新配置");
|
||||
return false;
|
||||
}
|
||||
// 单选
|
||||
if (data.value.singleStemVoList.length && data.value.singleStemVoList.some(t => !t.deleted && t.assessmentSingleChoiceVoList.filter(s=>!s.deleted)?.length < 2)) {
|
||||
message.error("单选题最少添加两个选项!");
|
||||
return false;
|
||||
}
|
||||
if (data.value.singleStemVoList.length && data.value.singleStemVoList?.some((item) => !item.deleted && (!item.singleStemName || item.assessmentSingleChoiceVoList.some(option=>!option.deleted && !option.singleOptionName)))) {
|
||||
message.error("单选题干或选项为必填 请确认!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.researchadd {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!-- 评估管理-创建评估页面 -->
|
||||
<template>
|
||||
<!-- 问答题 -->
|
||||
<div class="content">
|
||||
<div class="content" v-if="!item.deleted">
|
||||
<div class="tagbox">
|
||||
<div class="tagname">问答题</div>
|
||||
<div class="deleteop" @click="handleTypesDel(3)">
|
||||
<div class="deleteop" @click="del">
|
||||
<div><img src="../../../assets/images/projectadd/delete1.png" /></div>
|
||||
<div class="del_text">删除题目</div>
|
||||
</div>
|
||||
@@ -15,11 +15,11 @@
|
||||
class="nameimg"
|
||||
src="../../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">标题{{ curItem.id }}</div>
|
||||
<div class="inname">标题{{ index + 1 }}</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="curItem.valueAsk"
|
||||
v-model:value="item.assessmentQaTitle"
|
||||
placeholder="请输入标题名称"
|
||||
show-count
|
||||
:maxlength="100"
|
||||
@@ -34,48 +34,16 @@
|
||||
<div class="in">
|
||||
<a-textarea
|
||||
:maxlength="100"
|
||||
v-model:value="curItem.valueAskDesc"
|
||||
v-model:value="item.assessmentQaDescribe"
|
||||
style="height: 148px"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
|
||||
export default {
|
||||
name: "ResearchAddAsk",
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
assessmentId: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const curItem = ref(props.item);
|
||||
// const assessmentId = ref(props.assessmentId);
|
||||
|
||||
const handleTypesDel = (type) => {
|
||||
emit("del", { id: curItem.value.id, type, curItem: curItem.value });
|
||||
// if (state.typesCur.includes(types)) {
|
||||
// const arr = state.typesCur.filter((item) => item !== types);
|
||||
// state.typesCur = arr;
|
||||
// }
|
||||
};
|
||||
|
||||
return {
|
||||
curItem,
|
||||
handleTypesDel,
|
||||
};
|
||||
},
|
||||
};
|
||||
<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));
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.researchadd {
|
||||
|
||||
@@ -8,32 +8,32 @@
|
||||
class="nameimg"
|
||||
src="../../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">选项{{ curItem.id }}</div>
|
||||
<div class="inname">选项{{ index+1 }}</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="curItem.inputVal"
|
||||
v-model:value="item[nameKey]"
|
||||
show-count
|
||||
placeholder="请输入选项名称"
|
||||
:maxlength="100"
|
||||
style="border-radius: 8px"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="delete" @click="handleDel">删除</div>
|
||||
<div class="delete" @click="handleDel" v-if="list?.filter(t=>!t.deleted)?.length>2">删除</div>
|
||||
</div>
|
||||
|
||||
<div class="name uploadContent">
|
||||
<a-upload
|
||||
v-show="!curItem.imgVal"
|
||||
v-show="!item[imgKey]"
|
||||
class="in uploadBtn"
|
||||
:show-upload-list="false"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div class="addimg">+添加图片</div>
|
||||
</a-upload>
|
||||
<div v-show="curItem.imgVal" class="picture" style="position: relative">
|
||||
<img class="pictureimg" :src="VUE_APP_FILE_PATH + curItem.imgVal" />
|
||||
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
|
||||
<div v-show="item[imgKey]" class="picture" style="position: relative">
|
||||
<img class="pictureimg" :src="VUE_APP_FILE_PATH + item[imgKey]"/>
|
||||
<img
|
||||
style="
|
||||
cursor: pointer;
|
||||
@@ -50,103 +50,49 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import { fileUp } from "../../../api/indexEval";
|
||||
<script setup>
|
||||
import {message} from "ant-design-vue";
|
||||
import {fileUp} from "@/api/indexEval";
|
||||
|
||||
export default {
|
||||
name: "ResearchAddItem",
|
||||
props: {
|
||||
item: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const curItem = ref(props.item);
|
||||
const VUE_APP_FILE_PATH = ref(process.env.VUE_APP_FILE_PATH);
|
||||
// console.log(
|
||||
// "选项信息",
|
||||
// curItem.value,
|
||||
// curItem.value.imgVal.indexOf(process.env.VUE_APP_FILE_PATH)
|
||||
// );
|
||||
// if (
|
||||
// curItem.value.imgVal &&
|
||||
// curItem.value.imgVal.indexOf(process.env.VUE_APP_FILE_PATH) == -1
|
||||
// ) {
|
||||
// curItem.value.imgVal =
|
||||
// process.env.VUE_APP_FILE_PATH + curItem.value.imgVal;
|
||||
// }
|
||||
|
||||
const state = reactive({
|
||||
hasImgName: "",
|
||||
});
|
||||
|
||||
const handleCancel = () => {
|
||||
state.hasImgName = "";
|
||||
emit("delImg", { id: curItem.value.id });
|
||||
};
|
||||
const handleDel = () => {
|
||||
handleCancel();
|
||||
emit("del", {
|
||||
id: curItem.value.id,
|
||||
optionId: curItem.value.optionId,
|
||||
});
|
||||
};
|
||||
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng =
|
||||
file.type === "image/jpg" ||
|
||||
file.type === "image/jpeg" ||
|
||||
file.type === "image/png" ||
|
||||
file.type === "image/svg" ||
|
||||
file.type === "image/bmp" ||
|
||||
file.type === "image/gif";
|
||||
if (!isJpgOrPng) {
|
||||
message.error("仅支持jpg、gif、png、jpeg、svg、bmp格式!");
|
||||
return false;
|
||||
}
|
||||
|
||||
let isLt1M = file.size / 10240 / 10240 <= 1;
|
||||
if (!isLt1M) {
|
||||
this.$message.error("图片大小超过10MB!");
|
||||
return false;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
fileUp(formData).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
state.hasImgName = file.name;
|
||||
emit("src", { id: curItem.value.id, src: res.data.data });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
curItem,
|
||||
handleDel,
|
||||
handleCancel,
|
||||
beforeUpload,
|
||||
VUE_APP_FILE_PATH,
|
||||
};
|
||||
},
|
||||
const props = defineProps({ index: Number, list: Array, item: Object ,nameKey:String,imgKey:String});
|
||||
const VUE_APP_FILE_PATH = process.env.VUE_APP_FILE_PATH;
|
||||
const handleCancel = () => props.item[props.imgKey] = "";
|
||||
const handleDel = () => props.item.id?(props.item.deleted = true):(props.list.splice(props.index, 1))
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng =
|
||||
file.type === "image/jpg" ||
|
||||
file.type === "image/jpeg" ||
|
||||
file.type === "image/png" ||
|
||||
file.type === "image/svg" ||
|
||||
file.type === "image/bmp" ||
|
||||
file.type === "image/gif";
|
||||
if (!isJpgOrPng) {
|
||||
message.error("仅支持jpg、gif、png、jpeg、svg、bmp格式!");
|
||||
return false;
|
||||
}
|
||||
let isLt1M = file.size / 10240 / 10240 <= 1;
|
||||
if (!isLt1M) {
|
||||
this.$message.error("图片大小超过10MB!");
|
||||
return false;
|
||||
}
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
fileUp(formData).then((res) => props.item[props.imgKey] = res.data.data);
|
||||
return false;
|
||||
};
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.researchadd {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
color: #000000;
|
||||
font-size: 18px;
|
||||
@@ -155,10 +101,12 @@ export default {
|
||||
padding-left: 37px;
|
||||
//font-weight: 500;
|
||||
}
|
||||
|
||||
.goback {
|
||||
padding-right: 70px;
|
||||
//padding-top: 37px;
|
||||
position: relative;
|
||||
|
||||
.return {
|
||||
display: inline-block;
|
||||
width: 42px;
|
||||
@@ -167,6 +115,7 @@ export default {
|
||||
margin-right: 10px;
|
||||
background-image: url("../../../assets/images/projectadd/return.png");
|
||||
}
|
||||
|
||||
.returntext {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
@@ -176,16 +125,19 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.addtype {
|
||||
display: flex;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
margin-right: 20px;
|
||||
align-items: center;
|
||||
margin-left: 41px;
|
||||
|
||||
.addtypen {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.types {
|
||||
cursor: pointer;
|
||||
width: 80px;
|
||||
@@ -198,11 +150,13 @@ export default {
|
||||
align-items: center;
|
||||
margin: 20px 10px;
|
||||
}
|
||||
|
||||
.typesCur {
|
||||
color: #fff;
|
||||
background: #4ea6ff;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -211,9 +165,11 @@ export default {
|
||||
min-width: 690px;
|
||||
margin-left: 38px;
|
||||
margin-top: 20px;
|
||||
|
||||
.tagbox {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.tagname {
|
||||
width: 90px;
|
||||
height: 32px;
|
||||
@@ -227,6 +183,7 @@ export default {
|
||||
color: rgba(64, 158, 255, 1);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.deleteop {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -238,6 +195,7 @@ export default {
|
||||
border: 1px solid #4ea6ff;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
|
||||
.del_text {
|
||||
color: #4ea6ff;
|
||||
font-size: 14px;
|
||||
@@ -245,21 +203,25 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scorebox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
margin-left: 70px;
|
||||
|
||||
.scoretext {
|
||||
font-size: 14px;
|
||||
color: #56a3f9;
|
||||
}
|
||||
|
||||
.number {
|
||||
display: flex;
|
||||
border: 1px solid #d7e5fd;
|
||||
border-radius: 5px;
|
||||
margin: 0 10px;
|
||||
padding: 5px;
|
||||
|
||||
.btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
@@ -277,24 +239,29 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.picture {
|
||||
width: 100px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
margin-left: 133px;
|
||||
|
||||
.pictureimg {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.picturename {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.options {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.delete {
|
||||
cursor: pointer;
|
||||
margin-top: 32px;
|
||||
@@ -303,10 +270,12 @@ export default {
|
||||
color: #4ea6ff;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.name2 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.name {
|
||||
width: 60%;
|
||||
// background-color: lightcoral;
|
||||
@@ -321,20 +290,24 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
|
||||
.nameimg {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.inname {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
margin-left: 7px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.in {
|
||||
margin-left: 14px;
|
||||
flex: 1;
|
||||
|
||||
.assess {
|
||||
display: flex;
|
||||
width: 226px;
|
||||
@@ -349,6 +322,7 @@ export default {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.assesswhole {
|
||||
width: 50%;
|
||||
background: rgba(86, 163, 249, 0.1);
|
||||
@@ -358,6 +332,7 @@ export default {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ratio {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
@@ -366,24 +341,29 @@ export default {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.addimg {
|
||||
cursor: pointer;
|
||||
color: rgba(78, 166, 255, 1);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.text {
|
||||
color: rgba(109, 117, 132, 1);
|
||||
font-size: 14px;
|
||||
//line-height: 24px;
|
||||
}
|
||||
|
||||
.ant-radio-wrapper {
|
||||
}
|
||||
|
||||
.ant-input {
|
||||
border-radius: 5px;
|
||||
// height: 120%;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.ant-select-selector {
|
||||
border-radius: 5px;
|
||||
// height: 120%;
|
||||
@@ -391,26 +371,32 @@ export default {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.numberInp {
|
||||
width: 200px;
|
||||
|
||||
.ant-input-number {
|
||||
width: 200px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
// .ant-input-number-input-wrap {
|
||||
// width: 200px;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name2 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.opinion {
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
|
||||
.namebox {
|
||||
width: 120px;
|
||||
display: flex;
|
||||
@@ -418,27 +404,33 @@ export default {
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.in {
|
||||
margin-left: 14px;
|
||||
width: 500px;
|
||||
|
||||
.ant-input-textarea-show-count {
|
||||
position: relative;
|
||||
height: 110px;
|
||||
}
|
||||
|
||||
.ant-input-textarea-show-count::after {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
.ant-input {
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
margin-top: 31px;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
@@ -449,6 +441,7 @@ export default {
|
||||
|
||||
.uploadContent {
|
||||
display: block !important;
|
||||
|
||||
.uploadBtn {
|
||||
margin-left: 120px !important;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!-- 评估管理-创建评估页面 -->
|
||||
<template>
|
||||
<!-- 多选题 -->
|
||||
<div class="content">
|
||||
<div class="content" v-if="!item.deleted">
|
||||
<div class="tagbox">
|
||||
<div class="tagname">多选题</div>
|
||||
<div class="deleteop" @click="handleTypesDel(2)">
|
||||
<div class="deleteop" @click="del">
|
||||
<div><img src="../../../assets/images/projectadd/delete1.png" /></div>
|
||||
<div class="del_text">删除题目</div>
|
||||
</div>
|
||||
@@ -15,11 +15,11 @@
|
||||
class="nameimg"
|
||||
src="../../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">标题{{ curItem.id }}</div>
|
||||
<div class="inname">标题{{ index + 1 }}</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="curItem.valueMutil"
|
||||
v-model:value="item.multipleStemName"
|
||||
placeholder="请输入题干名称"
|
||||
show-count
|
||||
:maxlength="100"
|
||||
@@ -28,12 +28,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<ResearchAddItem
|
||||
v-for="(item, index) in curItem.mutilList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
@src="imgSrcMutil"
|
||||
@delImg="delImgMutil"
|
||||
@del="delMutil"
|
||||
v-for="(child, index) in item.multipleChoiceVoList"
|
||||
:key="index + new Date().getTime()"
|
||||
:item="child"
|
||||
:index="index"
|
||||
:list="item.multipleChoiceVoList"
|
||||
name-key="multipleOptionName"
|
||||
img-key="multipleOptionPictureAddress"
|
||||
/>
|
||||
<div class="name">
|
||||
<div class="in" style="margin-left: 85px; margin-bottom: 20px">
|
||||
@@ -46,116 +47,28 @@
|
||||
background-color: #4ea6ff;
|
||||
"
|
||||
@click="handleMutilAdd"
|
||||
>
|
||||
添加选项
|
||||
>添加选项
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
<script setup>
|
||||
import ResearchAddItem from "./ResearchAddItem.vue";
|
||||
// import { deleteChoiceQuestion } from "@/api/indexResearch";
|
||||
|
||||
export default {
|
||||
name: "ResearchAddMulti",
|
||||
components: {
|
||||
ResearchAddItem,
|
||||
},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
assessmentId: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const curItem = ref(props.item);
|
||||
const assessmentId = ref(props.assessmentId);
|
||||
|
||||
const handleTypesDel = (type) => {
|
||||
emit("del", { id: curItem.value.id, type, curItem: curItem.value });
|
||||
// if (state.typesCur.includes(types)) {
|
||||
// const arr = state.typesCur.filter((item) => item !== types);
|
||||
// state.typesCur = arr;
|
||||
// }
|
||||
};
|
||||
|
||||
const handleMutilAdd = () => {
|
||||
curItem.value.mutilList.push({
|
||||
id: curItem.value.mutilList.length + 1,
|
||||
inputVal: "",
|
||||
imgVal: "",
|
||||
deleted: false
|
||||
});
|
||||
};
|
||||
const imgSrcMutil = ({ id, src }) => {
|
||||
curItem.value.mutilList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
item.imgVal = src;
|
||||
}
|
||||
});
|
||||
};
|
||||
const delImgMutil = ({ id }) => {
|
||||
curItem.value.mutilList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
item.imgVal = "";
|
||||
}
|
||||
});
|
||||
};
|
||||
const delMutil = ({ id, optionId }) => {
|
||||
// 接口删除
|
||||
// if (assessmentId.value && optionId) {
|
||||
// deleteChoiceQuestion({
|
||||
// assessmentId: assessmentId.value,
|
||||
// questionType: "2",
|
||||
// optionId,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
if (assessmentId.value && optionId) {
|
||||
virtualDel(id);
|
||||
} else {
|
||||
virtualDel(id);
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
// curItem.value.mutilList.forEach((item, index) => {
|
||||
// if (item.id === id) {
|
||||
// curItem.value.mutilList.splice(index, 1);
|
||||
// }
|
||||
// });
|
||||
// curItem.value.mutilList.map((item, index) => {
|
||||
// item.id = index + 1;
|
||||
// });
|
||||
curItem.value.mutilList.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
curItem.value.mutilList[index].deleted = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
curItem,
|
||||
handleTypesDel,
|
||||
handleMutilAdd,
|
||||
imgSrcMutil,
|
||||
delImgMutil,
|
||||
delMutil,
|
||||
};
|
||||
},
|
||||
const props = defineProps({index: Number, list: Array,item:Object});
|
||||
const del = () => {
|
||||
props.item.deleted = true;
|
||||
props.item.multipleChoiceVoList.forEach((t,i)=>t.id?(t.deleted=true):(props.item.multipleChoiceVoList.splice(i,1)));
|
||||
};
|
||||
const handleMutilAdd = () => {
|
||||
props.item.multipleChoiceVoList.push({
|
||||
questionType: 2,
|
||||
multipleOptionName: "",
|
||||
multipleOptionPictureAddress: "",
|
||||
deleted: false,
|
||||
orderNumber: props.index + 1,
|
||||
optionOrderNum: (props.item?.multipleChoiceVoList?.length || 0) + 1,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!-- 评估管理-创建评估页面 -->
|
||||
<template>
|
||||
<!-- 评分题 -->
|
||||
<div class="content">
|
||||
<div class="content" v-if="!item.deleted">
|
||||
<div class="tagbox">
|
||||
<div class="tagname">评分题</div>
|
||||
<div class="deleteop" @click="handleTypesDel(4)">
|
||||
<div><img src="../../../assets/images/projectadd/delete1.png" /></div>
|
||||
<div class="deleteop" @click="del">
|
||||
<div><img src="../../../assets/images/projectadd/delete1.png"/></div>
|
||||
<div class="del_text">删除题目</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -15,11 +15,11 @@
|
||||
class="nameimg"
|
||||
src="../../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">标题{{ curItem.id }}</div>
|
||||
<div class="inname">标题{{ index }}</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="curItem.valuePin"
|
||||
v-model:value="item.assessmentScTitle"
|
||||
placeholder="请输入标题名称"
|
||||
show-count
|
||||
:maxlength="100"
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="in numberInp">
|
||||
<a-input-number
|
||||
:value="curItem.minScore"
|
||||
:value="item.assessmentMinScore"
|
||||
:min="1"
|
||||
:max="10"
|
||||
@change="minChange"
|
||||
@@ -44,7 +44,7 @@
|
||||
</div>
|
||||
<div class="in numberInp">
|
||||
<a-input-number
|
||||
:value="curItem.maxScore"
|
||||
:value="item.assessmentMaxScore"
|
||||
:min="1"
|
||||
:max="10"
|
||||
@change="maxChange"
|
||||
@@ -56,8 +56,8 @@
|
||||
<div class="number">
|
||||
<div
|
||||
style="margin-left: 10px"
|
||||
v-for="(value, index) in scoreList"
|
||||
:key="index"
|
||||
v-for="(value, i) in scoreList"
|
||||
:key="i"
|
||||
class="btn"
|
||||
>
|
||||
{{ value.text }}
|
||||
@@ -74,15 +74,11 @@
|
||||
<div class="inname">配置权重</div>
|
||||
</div>
|
||||
<div class="in" style="display: flex">
|
||||
<!-- <div class="assess">
|
||||
<div class="assesstype">评估类型</div>
|
||||
<div class="assesswhole">整体评估</div>
|
||||
</div> -->
|
||||
<div class="assess" style="position: relative">
|
||||
<div class="assesstype">权重比例</div>
|
||||
<div class="assesswhole" style="background: #ffffff">
|
||||
<a-input-number
|
||||
v-model:value="curItem.pinQuan"
|
||||
v-model:value="item.weightScale"
|
||||
:min="0"
|
||||
:max="100"
|
||||
/>
|
||||
@@ -93,156 +89,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
<script setup>
|
||||
import {computed} from "vue";
|
||||
import {message} from "ant-design-vue";
|
||||
|
||||
export default {
|
||||
name: "ResearchAddPin",
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
assessmentId: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const curItem = ref(props.item);
|
||||
// const assessmentId = ref(props.assessmentId);
|
||||
|
||||
const state = reactive({
|
||||
scoreList: [
|
||||
{
|
||||
id: 1,
|
||||
text: 1,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 2,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: 3,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
text: 4,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
text: 5,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
text: 6,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
text: 7,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
text: 8,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
text: 9,
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
text: 10,
|
||||
},
|
||||
],
|
||||
scoreListClone: [
|
||||
{
|
||||
id: 1,
|
||||
text: 1,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 2,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: 3,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
text: 4,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
text: 5,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
text: 6,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
text: 7,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
text: 8,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
text: 9,
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
text: 10,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const handleTypesDel = (type) => {
|
||||
emit("del", { id: curItem.value.id, type, curItem: curItem.value });
|
||||
// if (state.typesCur.includes(types)) {
|
||||
// const arr = state.typesCur.filter((item) => item !== types);
|
||||
// state.typesCur = arr;
|
||||
// }
|
||||
};
|
||||
|
||||
const minChange = (e) => {
|
||||
if (e > curItem.value.maxScore)
|
||||
return message.warning("最低分不能超过最高分");
|
||||
curItem.value.minScore = e;
|
||||
let arr = state.scoreListClone.concat([]);
|
||||
arr.map((value, index) => {
|
||||
if (value.id === e) {
|
||||
arr = arr.slice(index, curItem.value.maxScore);
|
||||
}
|
||||
});
|
||||
state.scoreList = arr;
|
||||
};
|
||||
const maxChange = (e) => {
|
||||
if (e < curItem.value.minScore)
|
||||
return message.warning("最高分不能低于最低分");
|
||||
curItem.value.maxScore = e;
|
||||
let arr = state.scoreListClone.concat([]);
|
||||
arr.map((value, index) => {
|
||||
if (value.id === e) {
|
||||
arr = arr.slice(curItem.value.minScore - 1, index + 1);
|
||||
}
|
||||
});
|
||||
state.scoreList = arr;
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
curItem,
|
||||
handleTypesDel,
|
||||
minChange,
|
||||
maxChange,
|
||||
};
|
||||
},
|
||||
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 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("最低分不能超过最高分");
|
||||
props.item.assessmentMinScore = e;
|
||||
};
|
||||
const maxChange = (e) => {
|
||||
if (e < props.item.assessmentMinScore) return message.warning("最高分不能低于最低分");
|
||||
props.item.assessmentMaxScore = e;
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@@ -250,10 +110,12 @@ export default {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
color: #000000;
|
||||
font-size: 18px;
|
||||
@@ -262,10 +124,12 @@ export default {
|
||||
padding-left: 37px;
|
||||
//font-weight: 500;
|
||||
}
|
||||
|
||||
.goback {
|
||||
padding-right: 70px;
|
||||
//padding-top: 37px;
|
||||
position: relative;
|
||||
|
||||
.return {
|
||||
display: inline-block;
|
||||
width: 42px;
|
||||
@@ -274,6 +138,7 @@ export default {
|
||||
margin-right: 10px;
|
||||
background-image: url("../../../assets/images/projectadd/return.png");
|
||||
}
|
||||
|
||||
.returntext {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
@@ -283,16 +148,19 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.addtype {
|
||||
display: flex;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
margin-right: 20px;
|
||||
align-items: center;
|
||||
margin-left: 41px;
|
||||
|
||||
.addtypen {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.types {
|
||||
cursor: pointer;
|
||||
width: 80px;
|
||||
@@ -305,11 +173,13 @@ export default {
|
||||
align-items: center;
|
||||
margin: 20px 10px;
|
||||
}
|
||||
|
||||
.typesCur {
|
||||
color: #fff;
|
||||
background: #4ea6ff;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -318,9 +188,11 @@ export default {
|
||||
min-width: 690px;
|
||||
margin-left: 38px;
|
||||
margin-top: 20px;
|
||||
|
||||
.tagbox {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.tagname {
|
||||
width: 90px;
|
||||
height: 32px;
|
||||
@@ -334,6 +206,7 @@ export default {
|
||||
color: rgba(64, 158, 255, 1);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.deleteop {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -345,6 +218,7 @@ export default {
|
||||
border: 1px solid #4ea6ff;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
|
||||
.del_text {
|
||||
color: #4ea6ff;
|
||||
font-size: 14px;
|
||||
@@ -352,21 +226,25 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scorebox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
margin-left: 70px;
|
||||
|
||||
.scoretext {
|
||||
font-size: 14px;
|
||||
color: #56a3f9;
|
||||
}
|
||||
|
||||
.number {
|
||||
display: flex;
|
||||
border: 1px solid #d7e5fd;
|
||||
border-radius: 5px;
|
||||
margin: 0 10px;
|
||||
padding: 5px;
|
||||
|
||||
.btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
@@ -382,30 +260,36 @@ export default {
|
||||
line-height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.curBtn {
|
||||
background: #56a3f9;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.picture {
|
||||
width: 100px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
margin-left: 133px;
|
||||
|
||||
.pictureimg {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.picturename {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.options {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.delete {
|
||||
cursor: pointer;
|
||||
margin-top: 32px;
|
||||
@@ -414,10 +298,12 @@ export default {
|
||||
color: #4ea6ff;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.name2 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.name {
|
||||
width: 60%;
|
||||
// background-color: lightcoral;
|
||||
@@ -432,20 +318,24 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
|
||||
.nameimg {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.inname {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
margin-left: 7px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.in {
|
||||
margin-left: 14px;
|
||||
flex: 1;
|
||||
|
||||
.assess {
|
||||
display: flex;
|
||||
width: 226px;
|
||||
@@ -460,6 +350,7 @@ export default {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.assesswhole {
|
||||
width: 50%;
|
||||
background: rgba(86, 163, 249, 0.1);
|
||||
@@ -469,6 +360,7 @@ export default {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ratio {
|
||||
position: absolute;
|
||||
right: -1px;
|
||||
@@ -477,24 +369,29 @@ export default {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.addimg {
|
||||
cursor: pointer;
|
||||
color: rgba(78, 166, 255, 1);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.text {
|
||||
color: rgba(109, 117, 132, 1);
|
||||
font-size: 14px;
|
||||
//line-height: 24px;
|
||||
}
|
||||
|
||||
.ant-radio-wrapper {
|
||||
}
|
||||
|
||||
.ant-input {
|
||||
border-radius: 5px;
|
||||
// height: 120%;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.ant-select-selector {
|
||||
border-radius: 5px;
|
||||
// height: 120%;
|
||||
@@ -502,26 +399,32 @@ export default {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.numberInp {
|
||||
width: 200px;
|
||||
|
||||
.ant-input-number {
|
||||
width: 200px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
// .ant-input-number-input-wrap {
|
||||
// width: 200px;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name2 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.opinion {
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
|
||||
.namebox {
|
||||
width: 120px;
|
||||
display: flex;
|
||||
@@ -529,27 +432,33 @@ export default {
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.in {
|
||||
margin-left: 14px;
|
||||
width: 500px;
|
||||
|
||||
.ant-input-textarea-show-count {
|
||||
position: relative;
|
||||
height: 110px;
|
||||
}
|
||||
|
||||
.ant-input-textarea-show-count::after {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
.ant-input {
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
margin-top: 31px;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
@@ -560,6 +469,7 @@ export default {
|
||||
|
||||
.uploadContent {
|
||||
display: block !important;
|
||||
|
||||
.uploadBtn {
|
||||
margin-left: 120px !important;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!-- 评估管理-创建评估页面 -->
|
||||
<template>
|
||||
<!-- 单选题 -->
|
||||
<div class="content">
|
||||
<div class="content" v-if="!item.deleted">
|
||||
<div class="tagbox">
|
||||
<div class="tagname">单选题</div>
|
||||
<div class="deleteop" @click="handleTypesDel(1)">
|
||||
<div class="deleteop" @click="del">
|
||||
<div><img src="../../../assets/images/projectadd/delete1.png" /></div>
|
||||
<div class="del_text">删除题目</div>
|
||||
</div>
|
||||
@@ -15,11 +15,11 @@
|
||||
class="nameimg"
|
||||
src="../../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">标题{{ curItem.id }}</div>
|
||||
<div class="inname">标题{{ index+1 }}</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="curItem.valueSingle"
|
||||
v-model:value="item.singleStemName"
|
||||
placeholder="请输入题干名称"
|
||||
show-count
|
||||
:maxlength="100"
|
||||
@@ -28,12 +28,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<ResearchAddItem
|
||||
v-for="(item, index) in curItem.singleList"
|
||||
v-for="(child, index) in item.assessmentSingleChoiceVoList"
|
||||
:key="index + new Date().getTime()"
|
||||
:item="item"
|
||||
@src="imgSrc"
|
||||
@delImg="delImg"
|
||||
@del="del"
|
||||
:item="child"
|
||||
:list="item.assessmentSingleChoiceVoList"
|
||||
:index="index"
|
||||
name-key="singleOptionName"
|
||||
img-key="singleOptionPictureAddress"
|
||||
/>
|
||||
<div class="name">
|
||||
<div class="in" style="margin-left: 85px; margin-bottom: 20px">
|
||||
@@ -53,108 +54,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
<script setup>
|
||||
import ResearchAddItem from "./ResearchAddItem.vue";
|
||||
// import { deleteChoiceQuestion } from "@/api/indexResearch";
|
||||
|
||||
export default {
|
||||
name: "ResearchAddSingle",
|
||||
components: {
|
||||
ResearchAddItem,
|
||||
},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
assessmentId: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const curItem = ref(props.item);
|
||||
const assessmentId = ref(props.assessmentId);
|
||||
|
||||
const handleTypesDel = (type) => {
|
||||
emit("del", { id: curItem.value.id, type, curItem: curItem.value });
|
||||
};
|
||||
|
||||
const handleSingleAdd = () => {
|
||||
curItem.value.singleList.push({
|
||||
id: curItem.value.singleList.length + 1,
|
||||
inputVal: "",
|
||||
imgVal: "",
|
||||
deleted: false
|
||||
const props = defineProps({index: Number, list: Array,item:Object});
|
||||
const handleSingleAdd = () => props.item.assessmentSingleChoiceVoList.push({
|
||||
questionType: 1,
|
||||
singleOptionName: "",
|
||||
singleOptionPictureAddress: "",
|
||||
singleStemName: "",
|
||||
deleted: false,
|
||||
orderNumber: props.index + 1,
|
||||
optionOrderNum: props.item.assessmentSingleChoiceVoList.length + 1,
|
||||
});
|
||||
const del = () => {
|
||||
props.item.deleted = true;
|
||||
props.item.assessmentSingleChoiceVoList.forEach((t,i)=>t.id?(t.deleted=true):(props.item.assessmentSingleChoiceVoList.splice(i,1)))
|
||||
};
|
||||
const imgSrc = ({ id, src }) => {
|
||||
curItem.value.singleList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
item.imgVal = src;
|
||||
}
|
||||
});
|
||||
};
|
||||
const delImg = ({ id }) => {
|
||||
curItem.value.singleList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
item.imgVal = "";
|
||||
}
|
||||
});
|
||||
};
|
||||
const del = ({ id, optionId}) => {
|
||||
// 接口删除
|
||||
// if (assessmentId.value && optionId) {
|
||||
// deleteChoiceQuestion({
|
||||
// assessmentId: assessmentId.value,
|
||||
// questionType: "1",
|
||||
// optionId,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// virtualDel(id);
|
||||
// }
|
||||
if (assessmentId.value && optionId) {
|
||||
virtualDel(id);
|
||||
} else {
|
||||
virtualDel(id);
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
// curItem.value.singleList.forEach((item, index) => {
|
||||
// if (item.id === id) {
|
||||
// curItem.value.singleList.splice(index, 1);
|
||||
// }
|
||||
// });
|
||||
// curItem.value.singleList.map((item, index) => {
|
||||
// item.id = index + 1;
|
||||
// });
|
||||
|
||||
// 前端删除
|
||||
curItem.value.singleList.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
curItem.value.singleList[index].deleted = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
curItem,
|
||||
handleTypesDel,
|
||||
handleSingleAdd,
|
||||
imgSrc,
|
||||
delImg,
|
||||
del,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.researchadd {
|
||||
|
||||
Reference in New Issue
Block a user