Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
shidongli 2024-03-06 15:50:05 +08:00
commit 9504ac13a9
5 changed files with 289 additions and 130 deletions

View File

@ -20,7 +20,7 @@ export function getQuestion(id) {
// 新增问卷基本信息 // 新增问卷基本信息
export function addQuestion(data) { export function addQuestion(data) {
return request({ return request({
url: '/system/question', url: '/system/question/add',
method: 'post', method: 'post',
data: data data: data
}) })
@ -29,8 +29,8 @@ export function addQuestion(data) {
// 修改问卷基本信息 // 修改问卷基本信息
export function updateQuestion(data) { export function updateQuestion(data) {
return request({ return request({
url: '/system/question', url: '/system/question/edit',
method: 'put', method: 'post',
data: data data: data
}) })
} }

View File

@ -227,17 +227,16 @@
prop="serviceWayFrequencyList" prop="serviceWayFrequencyList"
:key="keyTable" :key="keyTable"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <div <!-- <div
v-for="(itemx, index) in scope.row.serviceWayFrequencyList" v-for="(itemx, index) in scope.row.serviceWayFrequencyList"
:key="index" :key="index"
> --> > -->
<div v-if="scope.row.serviceWayFrequencyList[0].serviceFrequencyType == 'TEXT'"> <!-- <div v-if="scope.row.serviceWayFrequencyList[0].serviceFrequencyType == 'TEXT'">
<el-select <el-select
size="mini" size="mini"
@click="getSuppliers()" @click="getSuppliers()"
@change="blurInputs()" @change="blurInputs()"
v-model="scope.row.valuePlusMax" v-model="scope.row.valuePlusMax"
clearable clearable
placeholder="请选择" placeholder="请选择"
@ -250,32 +249,43 @@
> >
</el-option> </el-option>
</el-select> </el-select>
</div> </div> -->
<div v-if="scope.row.serviceWayFrequencyList[0].serviceFrequencyType == 'DIGIT'"> <!-- <div v-if="scope.row.serviceWayFrequencyList[0].serviceFrequencyType == 'DIGIT'"> -->
<el-select <el-select
size="mini" size="mini"
@click="getSuppliers()" @click="getSuppliers()"
@change="blurInputs(scope.row.valuePlusMax)" @change="blurInputs(scope.row.valuePlusMax)"
v-model="scope.row.valuePlusMax"
v-model="scope.row.valuePlusMax" clearable
clearable placeholder="请选择"
placeholder="请选择" >
> <!-- :label="item.serviceFrequencyType == 'TEXT'?item.serviceFrequencyText:JSON.parse(item.serviceFrequencyStart) +
<!-- label里面就是展示的值 value是选中的 value是拼接的 这里处理一下为null的情况 为null咋显示呀以后应该不会有null 是必填的 那就先不用管了好-->
<el-option
v-for="item in scope.row.serviceWayFrequencyList"
:key="item.id"
:label="JSON.parse(item.serviceFrequencyStart) +
'~' + '~' +
JSON.parse(item.serviceFrequencyEnd)" JSON.parse(item.serviceFrequencyEnd)"
:value=" -->
item.id <!-- label里面就是展示的值 value是选中的 value是拼接的-->
"
> <!-- :label="item.serviceFrequencyType == 'TEXT'?item.serviceFrequencyText:JSON.parse(item.serviceFrequencyStart) +
</el-option> '~' +
</el-select> JSON.parse(item.serviceFrequencyEnd) : item.serviceFrequencyType == 'DIGIT'?"
</div> == text 不变 ==big 拼接的那个 -->
<el-option
v-for="item in scope.row.serviceWayFrequencyList"
:key="item.id"
:label="
item.serviceFrequencyType == 'TEXT'
? item.serviceFrequencyText
: item.serviceFrequencyType == 'DIGIT'
? JSON.parse(item.serviceFrequencyStart) +
'~' +
JSON.parse(item.serviceFrequencyEnd)
: ''
"
:value="item.id"
>
</el-option>
</el-select>
<!-- </div> -->
<!-- </div> --> <!-- </div> -->
</template> </template>
@ -336,19 +346,35 @@
<!-- 添加或修改服务方式内容对话框 --> <!-- 添加或修改服务方式内容对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="70px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<!-- <el-form-item label="服务方式名称" prop="serviceWayName"> <!-- <el-form-item label="服务方式名称" prop="serviceWayName">
<el-input v-model="form.serviceWayName" placeholder="请输入服务方式名称" /> <el-input v-model="form.serviceWayName" placeholder="请输入服务方式名称" />
</el-form-item> </el-form-item>
<el-form-item label="服务方式编码" prop="serviceWayCode"> <el-form-item label="服务方式编码" prop="serviceWayCode">
<el-input v-model="form.serviceWayCode" placeholder="请输入服务方式编码" /> <el-input v-model="form.serviceWayCode" placeholder="请输入服务方式编码" />
</el-form-item>
<el-form-item label="所属服务方式id" prop="serviceWayId">
<el-input v-model="form.serviceWayId" placeholder="请输入所属服务方式id" />
</el-form-item> --> </el-form-item> -->
<el-form-item label="所属服务方式" prop="serviceWayId">
<el-select
v-model="form.serviceWayId"
clearable
:disabled="disableedit"
placeholder="请选择服务方式"
style="width: 250px"
@change="change"
>
<el-option
v-for="item in DepartmentoList"
:key="item.id"
:label="item.serviceWayName"
:value="item.id"
></el-option>
</el-select>
<!-- <el-input v-model="form.serviceWayId" placeholder="请输入所属服务方式id" /> -->
</el-form-item>
<el-form-item label="服务内容" prop="serviceContent" label-width="80"> <el-form-item label="服务内容" prop="serviceContent" label-width="80">
<el-input <el-input
type="textarea" type="textarea"
:disabled="disabledcontent"
style="width: 400px" style="width: 400px"
placeholder="请输入服务内容" placeholder="请输入服务内容"
v-model="form.serviceContent" v-model="form.serviceContent"
@ -447,10 +473,12 @@ export default {
data() { data() {
return { return {
list: [], list: [],
disableedit:false,
serviceFrequencyStart: "", serviceFrequencyStart: "",
serviceFrequencyEnd: "", serviceFrequencyEnd: "",
serviceFrequencyType: "", serviceFrequencyType: "",
// disabled: "", // disabled: "",
disabledcontent:false,
titles: "", titles: "",
DIGIT: true, DIGIT: true,
TEXT: false, TEXT: false,
@ -506,23 +534,24 @@ export default {
serviceFrequencyType: [ serviceFrequencyType: [
{ required: true, message: "请选中服务频次", trigger: "blur" }, { required: true, message: "请选中服务频次", trigger: "blur" },
], ],
serviceContent:[ serviceContent: [
{ required: true, message: "请输入服务内容", trigger: "blur" }, { required: true, message: "请输入服务内容", trigger: "blur" },
], ],
// serviceFrequencyEnd:[ // serviceFrequencyEnd:[
// { required: true, message: "", trigger: "blur" }, // { required: true, message: "", trigger: "blur" },
// ], // ],
}, },
itemname: null, itemname: null,
serviceWayName: null,
querydepartmen: { querydepartmen: {
serviceWayName: "", serviceWayName: "",
}, },
disabled: true, disabled: true,
disabledb: false, disabledb: false,
disableda: false, disableda: false,
valuePlus:'', valuePlus: "",
serviceFrequencyText:'', serviceFrequencyText: "",
keyTable:'', keyTable: "",
}; };
}, },
watch: { watch: {
@ -540,13 +569,10 @@ export default {
console.log(e); console.log(e);
}, },
blurInput(val) { blurInput(val) {
// this.servicewaycontentList.serviceFrequencyText=val // this.servicewaycontentList.serviceFrequencyText=val
}, },
blurInputs() { blurInputs() {
this.keyTable = Math.random() this.keyTable = Math.random();
// console.log(val, "666");
// this.form.id = val;
}, },
textlist(e) { textlist(e) {
if (e == true) { if (e == true) {
@ -605,11 +631,15 @@ export default {
this.DepartmentoList = response.data; this.DepartmentoList = response.data;
// this.count=this.DepartmentoList.length // this.count=this.DepartmentoList.length
console.log(this.DepartmentoList); console.log(this.DepartmentoList);
// this.Option
// this.total = response.total; // this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
change(e) {
console.log(e);
// this.form.serviceWayId=e
},
// //
itemdata(item) { itemdata(item) {
if (item) { if (item) {
@ -620,10 +650,12 @@ export default {
// this.disabled=true // this.disabled=true
// } // }
this.itemname = item.id; this.itemname = item.id;
this.serviceWayName = item.serviceWayName;
this.form.serviceWayId = item.id;
// this.departmentName = item.serviceWayName; // this.departmentName = item.serviceWayName;
this.loading = true; this.loading = true;
this.queryParams.serviceWayId = item.id; this.queryParams.serviceWayId = item.id;
this.form.serviceWayId=item.id
this.getList(); this.getList();
} else { } else {
this.queryParams.serviceWayId = ""; this.queryParams.serviceWayId = "";
@ -637,30 +669,26 @@ export default {
listServicewaycontent(this.queryParams).then((response) => { listServicewaycontent(this.queryParams).then((response) => {
this.servicewaycontentList = response.rows; this.servicewaycontentList = response.rows;
// this.serviceFrequencyText= this.servicewaycontentList[0].serviceFrequencyText // this.serviceFrequencyText= this.servicewaycontentList[0].serviceFrequencyText
console.log(this.servicewaycontentList,'****') console.log(this.servicewaycontentList, "****");
// if(e.serviceWayFrequencyList[0].serviceFrequencyType == 'TEXT'){ // if(e.serviceWayFrequencyList[0].serviceFrequencyType == 'TEXT'){
this.servicewaycontentList.forEach((e) => { this.servicewaycontentList.forEach((e) => {
e.valuePlusMax = e.serviceWayFrequencyList[0].id e.valuePlusMax = e.serviceWayFrequencyList[0].id;
}); });
// } // }
// if(e.serviceWayFrequencyList[0].serviceFrequencyType == 'DIGIT'){ // if(e.serviceWayFrequencyList[0].serviceFrequencyType == 'DIGIT'){
// e.serviceFrequencyText = JSON.parse(e.serviceWayFrequencyList[0].serviceFrequencyStart) + // e.serviceFrequencyText = JSON.parse(e.serviceWayFrequencyList[0].serviceFrequencyStart) +
// '~' + // '~' +
// JSON.parse(e.serviceWayFrequencyList[0].serviceFrequencyEnd) // JSON.parse(e.serviceWayFrequencyList[0].serviceFrequencyEnd)
// } // }
// e.serviceWayFrequencyList[0].forEach(el=>{
// console.log(el)
// // this.serviceFrequencyText = el.serviceFrequencyText;
// })
// e.serviceWayFrequencyList[0].forEach(el=>{
// console.log(el)
// // this.serviceFrequencyText = el.serviceFrequencyText;
// })
// this.serviceFrequencyText= this.servicewaycontentList[0].serviceFrequencyText // this.serviceFrequencyText= this.servicewaycontentList[0].serviceFrequencyText
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
@ -712,28 +740,46 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.disableedit=false
this.disabledcontent=false
console.log(this.itemname, "itemname");
if (this.itemname) {
this.form.serviceWayName = this.serviceWayName;
this.form.serviceWayId = this.itemname;
console.log(this.form, " this.form");
}
// else if (this.itemname == null) {
// this.form.serviceWayId = ""
// }
this.form.serviceFrequencyType = "DIGIT"; this.form.serviceFrequencyType = "DIGIT";
this.open = true; this.open = true;
this.title = "添加服务方式内容"; this.title = "添加服务方式内容";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
console.log(row,'99999'); this.disableedit=true
this.disabledcontent=true
console.log(row, "99999");
this.reset(); this.reset();
// const id = row.id
getServicewaycontent(row.valuePlusMax).then((response) => { getServicewaycontent(row.valuePlusMax).then((response) => {
this.form = response.data; this.form = response.data;
// this.form.serviceWayId=row.serviceWayId
this.form.id = response.data.serviceFrequencyId; this.form.id = response.data.serviceFrequencyId;
this.form.serviceWayId = response.data.serviceWayId;
// ---------- // ----------
if (response.data.serviceFrequencyType == "DIGIT") { if (response.data.serviceFrequencyType == "DIGIT") {
this.DIGIT = true; this.DIGIT = true;
this.TEXT = false; this.TEXT = false;
this.disableda = false;
}else{ this.disabledb = false;
this.TEXT=true this.disabled = true;
} else {
this.TEXT = true;
this.DIGIT = false; this.DIGIT = false;
this.disableda = true;
this.disabledb = true;
this.disabled = false;
} }
// --------------- // ---------------
@ -744,42 +790,56 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log(this.form) this.$refs["form"].validate((valid) => {
this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if(this.form.serviceFrequencyType=="DIGIT"&&this.form.serviceFrequencyStart==null&&this.form.serviceFrequencyEnd==null){ if (
this.$message.error("请输入服务频次起始值和结束值") this.form.serviceFrequencyType == "DIGIT" &&
}else if(this.form.serviceFrequencyType=="DIGIT"&&this.form.serviceFrequencyStart==null){ this.form.serviceFrequencyStart == null &&
this.$message.error("请输入服务频次起始值") this.form.serviceFrequencyEnd == null
) {
}else if(this.form.serviceFrequencyType=="DIGIT"&&this.form.serviceFrequencyEnd==null){ this.$message.error("请输入服务频次起始值和结束值");
this.$message.error("请输入服务频次结束值") } else if (
this.form.serviceFrequencyType == "DIGIT" &&
}else if(this.form.serviceFrequencyType=="TEXT"&&this.form.serviceFrequencyText==null){ this.form.serviceFrequencyStart == null
this.$message.error("请输入服务频次文本") ) {
this.$message.error("请输入服务频次起始值");
}else if(this.form.serviceFrequencyType!="TEXT"&&this.form.serviceFrequencyType!="DIGIT"){ } else if (
this.$message.error("请选择数字还是文本")}else{ this.form.serviceFrequencyType == "DIGIT" &&
console.log(this.form.id, "555555"); this.form.serviceFrequencyEnd == null
if (this.form.serviceContentId != null) { ) {
updateServicewaycontent(this.form).then((response) => { this.$message.error("请输入服务频次结束值");
this.$modal.msgSuccess("修改成功"); } else if (
this.open = false; this.form.serviceFrequencyType == "TEXT" &&
this.getList(); this.form.serviceFrequencyText == null
}); ) {
this.$message.error("请输入服务频次文本");
} else if (
this.form.serviceFrequencyType != "TEXT" &&
this.form.serviceFrequencyType != "DIGIT"
) {
this.$message.error("请选择数字还是文本");
} else { } else {
addServicewaycontent(this.form).then((response) => { console.log(this.form, "555555");
this.$modal.msgSuccess("新增成功"); console.log(this.form.serviceWayId);
this.open = false;
this.getList(); if (this.form.serviceContentId != null) {
}); updateServicewaycontent(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
this.mentlist();
});
} else {
addServicewaycontent(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.mentlist();
});
}
} }
} }
}
}); });
}, },
// //
handleedit() { handleedit() {

View File

@ -151,7 +151,7 @@
<div class="options"> <div class="options">
<span>选项 </span> <span>选项 </span>
<div> <div>
<el-select v-model="item.optionNumber" placeholder="请选择" <el-select v-model="item.optionCount" placeholder="请选择"
@change="selectchange($event, item)" style="padding-left:10px"> @change="selectchange($event, item)" style="padding-left:10px">
<el-option v-for="item in optionlist" :key="item.value" <el-option v-for="item in optionlist" :key="item.value"
:label="item.label" :value="item.value"> :label="item.label" :value="item.value">
@ -161,11 +161,11 @@
</div> </div>
<div class="more"> <div class="more">
<el-radio-group> <el-radio-group>
<el-radio :label="1" disabled v-if="item.optionNumber > 0">1</el-radio> <el-radio :label="1" disabled v-if="item.optionCount > 0">1</el-radio>
<el-radio :label="2" disabled v-if="item.optionNumber > 1">2</el-radio> <el-radio :label="2" disabled v-if="item.optionCount > 1">2</el-radio>
<el-radio :label="3" disabled v-if="item.optionNumber > 2">3</el-radio> <el-radio :label="3" disabled v-if="item.optionCount > 2">3</el-radio>
<el-radio :label="4" disabled v-if="item.optionNumber > 3">4</el-radio> <el-radio :label="4" disabled v-if="item.optionCount > 3">4</el-radio>
<el-radio :label="5" disabled v-if="item.optionNumber > 4">5</el-radio> <el-radio :label="5" disabled v-if="item.optionCount > 4">5</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
</div> </div>
@ -237,7 +237,7 @@
<span>选项 </span> <span>选项 </span>
<div> <div>
<div v-for="(uitem, uindex) in aitem.questionSubjectOptionList" <div v-for="(uitem, uindex) in aitem.questionSubjectOptionList"
:key="uindex" style="display:flex"> :key="uindex" style="display:flex;margin-bottom:10px">
<el-input placeholder="请输入内容" v-model="uitem.optionName" <el-input placeholder="请输入内容" v-model="uitem.optionName"
clearable> clearable>
</el-input> </el-input>
@ -311,7 +311,7 @@
<div class="options"> <div class="options">
<span>选项 </span> <span>选项 </span>
<div> <div>
<el-select v-model="aitem.optionNumber" placeholder="请选择" <el-select v-model="aitem.optionCount" placeholder="请选择"
@change="selectchange($event, aitem)" style="padding-left:10px"> @change="selectchange($event, aitem)" style="padding-left:10px">
<el-option v-for="yitem in optionlist" :key="yitem.value" <el-option v-for="yitem in optionlist" :key="yitem.value"
:label="yitem.label" :value="yitem.value"> :label="yitem.label" :value="yitem.value">
@ -322,15 +322,15 @@
<div class="more"> <div class="more">
<el-radio-group> <el-radio-group>
<el-radio :label="1" disabled <el-radio :label="1" disabled
v-if="aitem.optionNumber > 0">1</el-radio> v-if="aitem.optionCount > 0">1</el-radio>
<el-radio :label="2" disabled <el-radio :label="2" disabled
v-if="aitem.optionNumber > 1">2</el-radio> v-if="aitem.optionCount > 1">2</el-radio>
<el-radio :label="3" disabled <el-radio :label="3" disabled
v-if="aitem.optionNumber > 2">3</el-radio> v-if="aitem.optionCount > 2">3</el-radio>
<el-radio :label="4" disabled <el-radio :label="4" disabled
v-if="aitem.optionNumber > 3">4</el-radio> v-if="aitem.optionCount > 3">4</el-radio>
<el-radio :label="5" disabled <el-radio :label="5" disabled
v-if="aitem.optionNumber > 4">5</el-radio> v-if="aitem.optionCount > 4">5</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
</div> </div>
@ -384,7 +384,7 @@
</div> </div>
<div class="totalScore"> <div class="totalScore">
<div class="totalscore-title"> <div class="totalscore-title">
总分0 总分{{ questionnaireTotalScore }}
</div> </div>
<div class="totalscore-title" style="font-size:14px"> <div class="totalscore-title" style="font-size:14px">
Q{{ questionitem.index + 1 }} Q{{ questionitem.index + 1 }}
@ -443,7 +443,7 @@
</template> </template>
<script> <script>
import { getQuestion } from "@/api/system/question"; import { getQuestion, addQuestion, updateQuestion } from "@/api/system/question";
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
export default { export default {
name: "addQuestionnaire", name: "addQuestionnaire",
@ -514,7 +514,7 @@ export default {
list: { list: {
questionnaireName: undefined, questionnaireName: undefined,
questionnaireDescription: undefined, questionnaireDescription: undefined,
questionnaireTotalScore: undefined, // questionnaireTotalScore: 0, //
questionSubjectList: [], questionSubjectList: [],
}, },
//arr //arr
@ -545,15 +545,45 @@ export default {
watch: { watch: {
}, },
created() { created() {
if(this.$route.query.id){ if (this.$route.query.id) {
this.info(); this.info();
} }
}, },
computed: {
questionnaireTotalScore: function () {
var score = 0
this.questionlist.forEach(e => {
if (!e.list) {
if (e.questionSubjectOptionList.length > 0) {
e.questionScore = e.questionSubjectOptionList[0].optionScore
e.questionSubjectOptionList.forEach(el => {
if (el.optionScore > e.questionScore) {
e.questionScore = el.optionScore
}
})
score += e.questionScore
}
} else {
e.list.forEach(el => {
el.questionScore = el.questionSubjectOptionList[0].optionScore
el.questionSubjectOptionList.forEach(ele => {
if (ele.optionScore > el.questionScore) {
el.questionScore = ele.optionScore
}
})
score += el.questionScore
})
}
})
this.list.questionnaireTotalScore = score
return score
},
},
methods: { methods: {
addquestion(item) { addquestion(item) {
this.id++ this.id++
if (this.questionlist.length > 0) { if (this.questionlist.length > 0) {
if (this.questionlist[this.questionlist.length - 1].questionName == '') { if (this.questionlist[this.questionlist.length - 1].questionName == '' || this.questionlist[this.questionlist.length - 1].questionDescription == '') {
return this.$message.error('请填写完在继续添加'); return this.$message.error('请填写完在继续添加');
} }
} }
@ -569,7 +599,6 @@ export default {
disabled: false, disabled: false,
// //
scoringMethod: '', scoringMethod: '',
optionCount: 0, //
questionSubjectOptionList: [{ questionSubjectOptionList: [{
optionid: ++this.optionid, optionid: ++this.optionid,
optionName: '', optionName: '',
@ -640,6 +669,7 @@ export default {
// //
whetherScore: false, whetherScore: false,
disabled: false, disabled: false,
optionCount: '',
// //
scoringMethod: '', scoringMethod: '',
questionSubjectOptionList: [], questionSubjectOptionList: [],
@ -828,7 +858,7 @@ export default {
id: this.id++, id: this.id++,
questionName: '', questionName: '',
questionDescription: '', questionDescription: '',
optionNumber: '', optionCount: '',
title: '打分题', title: '打分题',
// //
whetherScore: false, whetherScore: false,
@ -840,7 +870,7 @@ export default {
questionType: 'COMBINATION_SCORING_SUBJECT', questionType: 'COMBINATION_SCORING_SUBJECT',
id: this.id++, id: this.id++,
questionDescription: '', questionDescription: '',
optionNumber: '', optionCount: '',
questionName: '', questionName: '',
title: '打分题', title: '打分题',
// //
@ -861,7 +891,6 @@ export default {
title: '日期填空题', title: '日期填空题',
// //
whetherScore: false, whetherScore: false,
optionCount: 0, //
disabled: true, disabled: true,
}) })
} else if (item.id == 'TIME_BLANKS_SUBJECT') { } else if (item.id == 'TIME_BLANKS_SUBJECT') {
@ -872,7 +901,6 @@ export default {
questionName: '', questionName: '',
title: '时间填空题', title: '时间填空题',
// //
optionCount: 0, //
whetherScore: false, whetherScore: false,
disabled: true, disabled: true,
}) })
@ -991,11 +1019,71 @@ export default {
this.list.questionSubjectList.push(e) this.list.questionSubjectList.push(e)
} }
}) })
console.log(this.list) this.list.questionSubjectList.forEach(e => {
e.questionNumber = Number(e.questionNumber)
e.questionSubjectOptionList.forEach(el => {
el.questionNumber = Number(el.questionNumber)
})
})
this.list.questionCount = this.questionlist.length
if (this.$route.query.id) {
updateQuestion(this.list).then(res => {
})
} else {
addQuestion(this.list).then(res => {
})
}
}, },
info() { info() {
getQuestion(this.$route.query.id).then(res => { getQuestion(this.$route.query.id).then(res => {
this.list = res.data
res.data.questionSubjectList.forEach(e => {
if (e.questionType == 'MULTIPLE_CHOICE') {
e.title = '单选题'
this.questionlist.push(e)
} else if (e.questionType == 'MULTIPLE_CHOICE_QUESTIONS') {
e.title = '多选题'
this.questionlist.push(e)
} else if (e.questionType == 'FILL_IN_THE_BLANKS') {
e.title = '填空题'
this.questionlist.push(e)
} else if (e.questionType == 'SCORING_QUESTIONS') {
e.title = '打分题'
this.questionlist.push(e)
} else if (e.questionType == 'DATE_BLANKS_SUBJECT') {
e.title = '日期填空题'
this.questionlist.push(e)
} else if (e.questionType == 'TIME_BLANKS_SUBJECT') {
e.title = '时间填空题'
this.questionlist.push(e)
} else if (e.questionType == 'COMBINATION_RADIO_SUBJECT') {
e.title = '单选题'
} else if (e.questionType == 'COMBINATION_MULTIPLE_SUBJECT') {
e.title = '多选题'
} else if (e.questionType == 'COMBINATION_BLANKS_SUBJECT') {
e.title = '填空题'
} else if (e.questionType == 'COMBINATION_SCORING_SUBJECT') {
e.title = '打分题'
}
})
var data = res.data.questionSubjectList
var echararr = [];
for (var i = 0; i < data.length; i++) {
var arrindex = echararr.findIndex((item, index, arr) => { return item.questionDescription === data[i].questionDescription })//
if (arrindex == -1) {//
echararr.push({
title: data[i].questionType == 'COMBINATION_RADIO_SUBJECT' ? '组合单选题' : data[i].questionType == 'COMBINATION_MULTIPLE_SUBJECT' ? '组合多选题' : data[i].questionType == 'COMBINATION_BLANKS_SUBJECT' ? '组合填空题' : data[i].questionType == 'COMBINATION_SCORING_SUBJECT' ? '组合打分题' : '',
questionType: data[i].questionType,
id: this.id++,
questionDescription: data[i].questionDescription,
list: [data[i]]
});
} else {//
echararr[arrindex].list.push(data[i])
}
}
this.questionlist = [...this.questionlist, ...echararr]
}) })
}, },
} }

View File

@ -642,8 +642,8 @@ export default {
agencyName: [ agencyName: [
{ required: true, message: "机构名称能为空", trigger: "blur" }, { required: true, message: "机构名称能为空", trigger: "blur" },
], ],
// areaCode:[{ required: true, message: "", trigger: "blur" }, areaCode:[{ required: true, message: "行政区划不能为空", trigger: "blur" },
// ], ],
}, },
treeOptionsagencyCategoryId: [], treeOptionsagencyCategoryId: [],
treeOptions: [], treeOptions: [],
@ -747,7 +747,7 @@ export default {
// //
clickstreet(item) { clickstreet(item) {
// this.form.areaCode = item.areaCode; this.form.communityName =''
getSecondaryLevelInfo(item.id).then((res) => { getSecondaryLevelInfo(item.id).then((res) => {
this.streetlists = res.data; this.streetlists = res.data;
}); });
@ -760,6 +760,9 @@ export default {
clickarea(item) { clickarea(item) {
this.form.areaCode = ""; this.form.areaCode = "";
this.form.streetCode = ""; this.form.streetCode = "";
// this.form.streetName=''
this.form.communityCode =''
getSecondaryLevelInfo(item.id).then((res) => { getSecondaryLevelInfo(item.id).then((res) => {
this.streetlist = res.data; this.streetlist = res.data;
}); });
@ -769,6 +772,10 @@ export default {
this.form.regionName = ""; this.form.regionName = "";
this.form.areaCode = ""; this.form.areaCode = "";
this.form.streetCode = ""; this.form.streetCode = "";
this.form.streetName = "";
this.form.communityCode =''
getSecondaryLevelInfo(item.id).then((res) => { getSecondaryLevelInfo(item.id).then((res) => {
this.arealist = res.data; this.arealist = res.data;
}); });
@ -782,7 +789,8 @@ export default {
// //
province(item) { province(item) {
this.form.cityName = ""; this.form.cityName = "";
this.form.streeName = ""; // this.form.streeName = "";
// this.form.communityCode =''
this.form.areaName = ""; this.form.areaName = "";
this.form.communityName = ""; this.form.communityName = "";

View File

@ -154,6 +154,9 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$router.push({
path: "/question/addQuestionnaire",
});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {