张雄 2 years ago
parent 5d58cb6627
commit e69000485d

@ -0,0 +1,73 @@
import httpService from "@/request"
// 查询所有问卷调查信息
export function getQuestionList(params) {
return httpService({
url: `/user/questionnaire/list`,
method: 'get',
params: params,
})
}
// 添加问卷调查表信息
export function addQuestion(params) {
return httpService({
url: `/user/questionnaire/insert`,
method: 'post',
data: params,
})
}
// 更新问卷调查表信息
export function updateQuestion(params) {
return httpService({
url: `/user/questionnaire/update`,
method: 'post',
data: params,
})
}
// 删除问卷调查信息
export function delQuestion(params) {
return httpService({
url: `/user/questionnaire/delete`,
method: 'post',
data: params,
})
}
// 发布下架问卷调查
export function releaseQuestion(params) {
return httpService({
url: `/user/questionnaire/isRelease`,
method: 'get',
params: params,
})
}
// 根据问卷调查主键ID查询问卷调查信息
export function findQuestion(params) {
return httpService({
url: `/user/questionnaire/findById`,
method: 'get',
params: params,
})
}
// 根据问卷调查主键id查询报表分析信息
export function getReport(params) {
return httpService({
url: `/user/questionnaire/reportAnalysis`,
method: 'get',
params: params,
})
}
// 根据题目主键id查询开放题内容信息列表
export function getAnswerList(params) {
return httpService({
url: `/user/questionnaire/shortAnswerList`,
method: 'get',
params: params,
})
}

@ -261,4 +261,47 @@ export default [
component: resolve => require(['@/views/Operation/Commission'], resolve),
meta: {title: '业委会'},
},
{
path: '/Scroll',
name: "Scroll",
title: "问卷调查",
icon: 'container',
hide: false,
component: resolve => require(['@/views/Operation/Scroll'], resolve),
meta: {title: '问卷调查'},
// children: [
// {
// path: '/Scroll/_addScroll',
// name: "_addScroll",
// title: "新增问卷调查",
// hide: true,
// component: resolve => require(['@/views/Operation/Scroll/_addScroll'], resolve),
// meta: {title: '新增问卷调查'},
// },
// ]
},
{
path: '/Scroll/addScroll',
name: "addScroll",
title: "新增问卷调查",
hide: true,
component: resolve => require(['@/views/Operation/Scroll/addScroll'], resolve),
meta: {title: '新增问卷调查'},
},
{
path: '/Scroll/editScroll',
name: "editScroll",
title: "编辑问卷调查",
hide: true,
component: resolve => require(['@/views/Operation/Scroll/editScroll'], resolve),
meta: {title: '编辑问卷调查'},
},
{
path: '/Scroll/analyze',
name: "analyze",
title: "问卷调查报表分析",
hide: true,
component: resolve => require(['@/views/Operation/Scroll/analyze'], resolve),
meta: {title: '问卷调查报表分析'},
},
]

@ -247,7 +247,7 @@ export default {
this.applicantIds = data;
})
},
//
//
addConfirm() {
if(this.mode == 1) {
addIndustryCom(this.addForm).then(res => {

@ -0,0 +1,317 @@
<template>
<div>
<div class="cardTitle">
<a-space size="large">
<span>新增问卷调查</span>
</a-space>
</div>
<div class="top-button">
<a-button type="primary" @click="save"></a-button>
<!-- <a-button style="margin-left: 10px">预览</a-button> -->
<a-button style="margin-left: 10px" @click="cancel"></a-button>
</div>
<div class="main-area">
<div class="type-choose">
<div class="type-title">题型选择</div>
<div><a-button class="type-button" @click="addQuestion(1)"><a-icon type="check-circle" />单选题</a-button></div>
<div><a-button class="type-button" @click="addQuestion(2)"><a-icon type="check-square" />多选题</a-button></div>
<div><a-button class="type-button" @click="addQuestion(3)"><a-icon type="unordered-list" />下拉单选</a-button></div>
<div><a-button class="type-button" @click="addQuestion(4)"><a-icon type="check" />判断题</a-button></div>
<div><a-button class="type-button" @click="addQuestion(5)"><a-icon type="question" />开放题</a-button></div>
</div>
<div class="question-area">
<div class="question-area-top">
<a-input v-model="form.title" style="margin: 20px;width: 980px" placeholder="问卷标题(限40字)"></a-input>
<a-textarea v-model="form.description" style="margin: 0px 20px 20px 20px;width: 980px;height:88px" placeholder="问卷说明"></a-textarea>
</div>
<div class="question-area-top" style="margin-top: 20px" v-for="(item,index) in form.questionnaireInsertTopicDTOList" :key="index">
<div class="question-list">
<h4>{{index+1}}.{{item.topic}}</h4><a-tag>{{item.type==1?'单选题':item.type==2?'多选题':item.type==3?'下拉单选':item.type==4?'判断题':'开放题'}}</a-tag>
</div>
<div style="margin-left: 40px" v-if="item.type==1 || item.type==3">
<a-radio disabled v-for="(it,id) in item.questionnaireInsertTopicChoiceDTOList" :key="id">{{it.answer}}</a-radio>
</div>
<div style="margin-left: 40px" v-if="item.type==2">
<a-checkbox disabled v-for="(it,id) in item.questionnaireInsertTopicChoiceDTOList" :key="id">{{it.answer}}</a-checkbox>
</div>
<div style="padding: 20px">
<a-button type="primary" style="margin-left: 20px" @click="editQuestionItem(item,index)"></a-button>
<a-button style="margin-left: 20px" @click="deleteQuestionItem(index)"></a-button>
</div>
</div>
<div class="question-item">
<div style="padding: 20px;display: flex">
<div style="width: 80%" v-if="questionCard.type == 1 || questionCard.type == 2 || questionCard.type == 3">
<a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item label="题目">
<a-input v-model="questionCard.topic"></a-input>
<a-button @click="addchoice"></a-button>
</a-form-model-item>
<a-form-model-item :label="'选项'+(index+1)" v-for="(item,index) in questionChoice" :key="index">
<div style="display: flex">
<a-input v-model="item.answer"></a-input>
<a-button @click="deleteChoice(index)" shape="circle" icon="close" />
</div>
</a-form-model-item>
</a-form-model>
<div>
<a-button type="primary" style="margin-left: 20px" @click="questionComfirm(questionCard.type)">{{isEdit==true?'':''}}</a-button>
<a-button style="margin-left: 20px" @click="questionCancel"></a-button>
</div>
</div>
<div style="width: 80%" v-else-if="questionCard.type == 4 || questionCard.type == 5">
<a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item label="题目">
<a-input v-model="questionCard.topic"></a-input>
</a-form-model-item>
</a-form-model>
<div>
<a-button type="primary" style="margin-left: 20px" @click="questionComfirm(questionCard.type)">{{isEdit==true?'':''}}</a-button>
<a-button style="margin-left: 20px" @click="questionCancel"></a-button>
</div>
</div>
<div style="padding: 20px" v-else>
请点击左侧按钮添加题目
</div>
<div style="width: 20%" v-if="questionCard.type == 1 || questionCard.type == 2 || questionCard.type == 3 || questionCard.type == 4|| questionCard.type == 5">
<a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item>
<a-select v-model="questionCard.type">
<a-select-option :value="1">单选题</a-select-option>
<a-select-option :value="2">多选题</a-select-option>
<a-select-option :value="3">下拉单选</a-select-option>
<a-select-option :value="4">判断题</a-select-option>
<a-select-option :value="5">开放题</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</div>
</div>
</div>
</div>
<div class="question-setting">
<div style="padding: 20px">
<a-form-model>
<a-form-model-item label="封面图片设置">
</a-form-model-item>
<a-form-model-item label="开始日期">
<a-date-picker v-model="form.beginDate" value-format="YYYY-MM-DD HH:mm:ss"></a-date-picker>
</a-form-model-item>
<a-form-model-item label="截止日期">
<a-date-picker v-model="form.endDate" value-format="YYYY-MM-DD HH:mm:ss"></a-date-picker>
</a-form-model-item>
<a-form-model-item label="问卷对象">
<a-select v-model="form.answerType">
<a-select-option :value="1">无限制</a-select-option>
<a-select-option :value="2">业主</a-select-option>
<a-select-option :value="3">业主亲属</a-select-option>
<a-select-option :value="4">租户</a-select-option>
<a-select-option :value="5">租户亲属</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="是否立即发布">
<a-select v-model="form.isRelease">
<a-select-option :value="1">发布</a-select-option>
<a-select-option :value="0">不发布</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</div>
</div>
</div>
</div>
</template>
<script>
import {addQuestion} from "@/api/operation/scroll"
export default {
name: "addScroll",
data() {
return {
labelCol: { span: 2 },
wrapperCol: { span: 14 },
letters: ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
form: {
title: '',
description: '',
answerType: undefined,
beginDate: '',
endDate: '',
questionnaireInsertTopicDTOList: [],
isRelease: 0,
imgUrls: [],
},
id: undefined,
questionCard: {
type: undefined,
topic: '',
},
questionChoice: [],
//
isEdit: false,
activeIndex: undefined,
}
},
methods: {
//
addQuestion(type) {
this.isEdit = false;
this.activeIndex = undefined;
let obj = {
type: type,
topic: '',
questionnaireInsertTopicChoiceDTOList: [],
};
this.questionCard = obj
},
//,
questionComfirm(type) {
if(this.isEdit == false) {
if(type == 1 || type == 2 || type == 3) {
for(let i = 0;i<this.questionChoice.length;i++) {
this.questionChoice[i].options = this.letters[i]
};
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
questionnaireInsertTopicChoiceDTOList: this.questionChoice
};
this.form.questionnaireInsertTopicDTOList.push(obj)
} else {
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
questionnaireInsertTopicChoiceDTOList: []
};
this.form.questionnaireInsertTopicDTOList.push(obj)
}
} else if (this.isEdit == true) {
if(type == 1 || type == 2 || type == 3) {
for(let i = 0;i<this.questionChoice.length;i++) {
this.questionChoice[i].options = this.letters[i]
};
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
questionnaireInsertTopicChoiceDTOList: this.questionChoice
};
this.form.questionnaireInsertTopicDTOList[this.activeIndex] = obj
} else {
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
questionnaireInsertTopicChoiceDTOList: []
};
this.form.questionnaireInsertTopicDTOList[this.activeIndex] = obj
}
}
this.questionCancel()
},
questionCancel() {
this.isEdit = false;
this.activeIndex = undefined;
this.questionChoice = [];
this.questionCard = {
type: undefined,
topic: '',
}
},
//
addchoice() {
let obj = {
answer: '',
options: '',
};
this.questionChoice.push(obj)
},
//
deleteChoice(index) {
this.questionChoice.splice(index,1)
},
//
editQuestionItem(item,index) {
this.isEdit = true;
this.activeIndex = index;
this.questionCard.type = item.type;
this.questionCard.topic = item.topic;
if(item.questionnaireInsertTopicChoiceDTOList) {
this.questionChoice = item.questionnaireInsertTopicChoiceDTOList
}
},
//
deleteQuestionItem(index) {
this.form.questionnaireInsertTopicDTOList.splice(index,1)
},
//
save() {
addQuestion(this.form).then(res => {
if (res.code === 200) {
this.$message.success(res.msg);
this.$router.go(-1);
} else {
this.$message.error(res.msg);
}
})
},
//
cancel() {
this.questionList = [];
this.$router.go(-1);
},
}
}
</script>
<style lang="less">
.top-button {
padding: 8px 0px 20px 10px
}
.main-area {
display: flex;
padding: 0px 20px 20px 10px;
.type-choose {
height: 837px;
width: 220px;
border: 2px solid #E7E7E7;
.type-title {
font-size: 14px;
font-weight: 500;
line-height: 20px;
padding: 18px 18px 18px 18px
}
.type-button {
height: 40px;
width: 180px;
margin-left: 18px;
margin-bottom: 20px;
}
}
.question-area {
margin-left: 20px;
.question-area-top {
// height: 184px;
width: 1020px;
border: 2px solid #E7E7E7
}
.question-item {
width: 1020px;
border: 2px solid #E7E7E7;
margin-top: 20px;
background: #F5F5F5;
}
}
.question-setting {
height: 837px;
width: 230px;
margin-left: 20px;
border: 2px solid #E7E7E7;
}
}
.question-list {
display: flex;
justify-content: space-between;
padding: 20px 20px 20px 40px
}
</style>

@ -0,0 +1,67 @@
<template>
<div>
<div class="cardTitle">
<a-space size="large">
<span>问卷调查报表分析</span>
</a-space>
</div>
<div class="rep-title">物业服务满意度调查问卷</div>
<div class="rep-time">{{reportData.beginDate}} {{reportData.endDate}}</div>
<div class="rep-number">共收集到<span style="color: rgb(49,98,188)"> {{reportData.answerNum}} </span>份问卷</div>
</div>
</template>
<script>
import {getReport, getAnswerList} from "@/api/operation/scroll"
export default {
name: "analyze",
data() {
return {
id: undefined,
reportData: {
// title: '',
beginDate: '',
endDate: '',
answerNum: 0,
}
}
},
created() {
this.id = this.$route.params.id;
getReport({questionnaireId: this.id}).then(res => {
let data = res.data;
this.reportData = {
beginDate: data.beginDate,
endDate: data.endDate,
answerNum: data.answerNum
}
console.log(data)
})
}
}
</script>
<style lang="less">
.rep-title {
font-family: PingFang SC;
font-size: 18px;
font-weight: 500;
line-height: 25px;
padding: 0px 10px 10px 10px;
}
.rep-time {
font-family: PingFang SC;
font-size: 12px;
font-weight: 400;
line-height: 17px;
color: #999999;
padding: 0px 10px 10px 10px;
}
.rep-number {
font-family: PingFang SC;
font-size: 14px;
font-weight: 400;
line-height: 20px;
padding: 0px 10px 10px 10px;
}
</style>

@ -0,0 +1,161 @@
<template>
<div>
<a-drawer title="职位设置" :width="540" :visible="show" :body-style="{ paddingBottom: '80px' }" @close="addClose">
<div class="drawer-content" style="padding: 16px">
职位类型
<a-divider></a-divider>
<!-- tags -->
<span v-for="item,index in typeList" :key="item.id">
<a-input
v-if="item.show==true"
ref="input"
v-focus
type="text"
size="small"
:style="{ width: '78px','padding-bottom':'3px','margin-right':'7px' }"
v-model="item.name"
@blur="editType(item)"
@keyup.enter="editType(item)"
/>
<a-tag
v-else-if="item.show==false" closable @close.prevent="delType(item.id)"
@click="editInput(item,index)" >
{{item.name}}
</a-tag>
</span>
<!-- addTag -->
<span>
<a-input
v-if="inputVisible"
ref="addInput"
type="text"
size="small"
:style="{ width: '78px','padding-bottom':'3px'}"
:value="typeForm.name"
@change="handleInputChange"
@blur="handleInputConfirm"
@keyup.enter="handleInputConfirm"
/>
<a-tag v-else style="background: #fff; borderStyle: dashed;" @click="addShow">
<a-icon type="plus" /> 新增类型
</a-tag>
</span>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose">
关闭
</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
// import {getPhontTypeList, addPhontType, delPhontType,updatePhontType} from "@/api/operation/suggestion"
import {getComList, addComType, updateComType, delComType} from "@/api/operation/commission"
export default {
props: {
show: {
type: Boolean,
default: false,
},
},
data() {
return {
typeForm: {
name: ''
},
typeList: [],
inputVisible: false
}
},
created() {
this.getData()
},
methods: {
async getData() {
this.typeList = []
const res = await getComList();
const arr = res.data;
arr.forEach(ele => {
ele.show = false;
})
this.typeList = arr;
this.$emit("refresh");
},
//
editInput(obj, i) {
this.$set(this.typeList[i],'show',true)
this.$forceUpdate()
},
//
addShow(){
this.inputVisible = true;
this.$nextTick(function() {
this.$refs.addInput.focus();
});
},
//
async editType(item){
let res = await updateComType({
id: item.id,
name: item.name
})
if(res.code === 200){
item.show = false
this.$forceUpdate()
this.$message.success(res.msg)
}else{
this.$message.error(res.msg)
}
},
handleInputChange(e) {
this.typeForm.name = e.target.value;
},
//
async handleInputConfirm() {
if(this.typeForm.name === ''){
this.inputVisible = false;
return
}
let res = await addComType({
name:this.typeForm.name,
})
if(res.code === 200){
this.$message.success(res.msg);
this.inputVisible = false;
this.typeForm.name = '';
this.getData()
}else{
this.$message.error(res.msg);
}
},
//
delType(id){
this.$confirm({
title: "是否删除",
icon:'delete',
onOk:async()=>{
let res = await delComType({industryCommitteeTypeId: id})
if(res.code=== 200){
this.$message.success(res.msg);
this.getData()
}else{
this.$message.error(res.msg);
}
},
})
},
addClose() {
this.$emit("addClose");
},
},
watch: {
},
}
</script>
<style lang="less">
</style>

@ -0,0 +1,67 @@
export const columns = [
{
title: "问卷标题",
width: "15%",
dataIndex: "title",
},
{
title: "问卷对象",
width: "9%",
dataIndex: "answerType",
customRender: function(answerType) {
switch(answerType) {
case 1: return '无限制';
case 2: return '业主';
case 3: return '业主亲属';
case 4: return '租户';
case 5: return '租户亲属';
}
}
},
{
title: "状态",
width: "9%",
dataIndex: "status",
customRender: function(status) {
switch(status) {
case 1: return '未开始';
case 2: return '正在进行';
case 3: return '已结束';
}
}
},
{
title: "开始时间",
width: "15%",
dataIndex: "beginDate",
},
{
title: "结束时间",
width: "15%",
dataIndex: "endDate",
},
{
title: "答题人数",
width: "8%",
dataIndex: "answerNum",
},
{
title: "是否发布",
width: "10%",
dataIndex: "isRelease",
scopedSlots: { customRender: "release" },
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "240",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const rules = {
appUserId: [{ required: true, message: "请选择住户", trigger: "change" }],
industryCommitteeTypeId: [{ required: true, message: "请选择职位", trigger: "change" }],
}

@ -0,0 +1,363 @@
<template>
<div>
<div class="cardTitle">
<a-space size="large">
<span>编辑问卷调查</span>
</a-space>
</div>
<div class="top-button">
<a-button type="primary" @click="save"></a-button>
<!-- <a-button style="margin-left: 10px">预览</a-button> -->
<a-button style="margin-left: 10px" @click="cancel"></a-button>
</div>
<div class="main-area">
<div class="type-choose">
<div class="type-title">题型选择</div>
<div><a-button class="type-button" @click="addQuestion(1)"><a-icon type="check-circle" />单选题</a-button></div>
<div><a-button class="type-button" @click="addQuestion(2)"><a-icon type="check-square" />多选题</a-button></div>
<div><a-button class="type-button" @click="addQuestion(3)"><a-icon type="check-square" />下拉单选</a-button></div>
<div><a-button class="type-button" @click="addQuestion(4)"><a-icon type="check" />判断题</a-button></div>
<div><a-button class="type-button" @click="addQuestion(5)"><a-icon type="question" />开放题</a-button></div>
</div>
<div class="question-area">
<div class="question-area-top">
<a-input v-model="form.title" style="margin: 20px;width: 980px" placeholder="问卷标题(限40字)"></a-input>
<a-textarea v-model="form.description" style="margin: 0px 20px 20px 20px;width: 980px;height:88px" placeholder="问卷说明"></a-textarea>
</div>
<div class="question-area-top" style="margin-top: 20px" v-for="(item,index) in form.questionnaireInsertTopicDTOList" :key="index">
<div class="question-list">
<h4>{{index+1}}.{{item.topic}}</h4><a-tag>{{item.type==1?'单选题':item.type==2?'多选题':item.type==3?'下拉单选':item.type==4?'判断题':'开放题'}}</a-tag>
</div>
<div style="margin-left: 40px" v-if="item.type==1||item.type==3">
<a-radio disabled v-for="(it,id) in item.questionnaireInsertTopicChoiceDTOList" :key="id">{{it.answer}}</a-radio>
</div>
<div style="margin-left: 40px" v-if="item.type==2">
<a-checkbox disabled v-for="(it,id) in item.questionnaireInsertTopicChoiceDTOList" :key="id">{{it.answer}}</a-checkbox>
</div>
<div style="padding: 20px">
<a-button type="primary" style="margin-left: 20px" @click="editQuestionItem(item,index)"></a-button>
<a-button style="margin-left: 20px" @click="deleteQuestionItem(index)"></a-button>
</div>
</div>
<div class="question-item">
<div style="padding: 20px;display: flex">
<div style="width: 80%" v-if="questionCard.type == 1 || questionCard.type == 2 || questionCard.type == 3">
<a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item label="题目">
<a-input v-model="questionCard.topic"></a-input>
<a-button @click="addchoice"></a-button>
</a-form-model-item>
<a-form-model-item :label="'选项'+(index+1)" v-for="(item,index) in questionChoice" :key="index">
<div style="display: flex">
<a-input v-model="item.answer"></a-input>
<a-button @click="deleteChoice(index)" shape="circle" icon="close" />
</div>
</a-form-model-item>
</a-form-model>
<div>
<a-button type="primary" style="margin-left: 20px" @click="questionComfirm(questionCard.type)">{{isEdit==true?'':''}}</a-button>
<a-button style="margin-left: 20px" @click="questionCancel"></a-button>
</div>
</div>
<div style="width: 80%" v-else-if="questionCard.type == 4 || questionCard.type == 5">
<a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item label="题目">
<a-input v-model="questionCard.topic"></a-input>
</a-form-model-item>
</a-form-model>
<div>
<a-button type="primary" style="margin-left: 20px" @click="questionComfirm(questionCard.type)">{{isEdit==true?'':''}}</a-button>
<a-button style="margin-left: 20px" @click="questionCancel"></a-button>
</div>
</div>
<div style="padding: 20px" v-else>
请点击左侧按钮添加题目
</div>
<div style="width: 20%" v-if="questionCard.type == 1 || questionCard.type == 2 || questionCard.type == 3 || questionCard.type == 4|| questionCard.type == 5">
<a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item>
<a-select v-model="questionCard.type">
<a-select-option :value="1">单选题</a-select-option>
<a-select-option :value="2">多选题</a-select-option>
<a-select-option :value="3">下拉单选</a-select-option>
<a-select-option :value="4">判断题</a-select-option>
<a-select-option :value="5">开放题</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</div>
</div>
</div>
</div>
<div class="question-setting">
<div style="padding: 20px">
<a-form-model>
<a-form-model-item label="封面图片设置">
</a-form-model-item>
<a-form-model-item label="开始日期">
<a-date-picker v-model="form.beginDate" value-format="YYYY-MM-DD HH:mm:ss"></a-date-picker>
</a-form-model-item>
<a-form-model-item label="截止日期">
<a-date-picker v-model="form.endDate" value-format="YYYY-MM-DD HH:mm:ss"></a-date-picker>
</a-form-model-item>
<a-form-model-item label="问卷对象">
<a-select v-model="form.answerType">
<a-select-option :value="1">无限制</a-select-option>
<a-select-option :value="2">业主</a-select-option>
<a-select-option :value="3">业主亲属</a-select-option>
<a-select-option :value="4">租户</a-select-option>
<a-select-option :value="5">租户亲属</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="是否立即发布">
<a-select v-model="form.isRelease">
<a-select-option :value="1">发布</a-select-option>
<a-select-option :value="0">不发布</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</div>
</div>
</div>
</div>
</template>
<script>
import {updateQuestion, findQuestion} from "@/api/operation/scroll"
export default {
name: "addScroll",
data() {
return {
labelCol: { span: 2 },
wrapperCol: { span: 14 },
letters: ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
form: {
id: undefined,
title: '',
description: '',
answerType: undefined,
beginDate: '',
endDate: '',
questionnaireInsertTopicDTOList: [],
isRelease: 0,
imgUrls: [],
deleteTopicIds: [],
},
id: undefined,
questionCard: {
type: undefined,
topic: '',
id: null,
deleteTopicChoiceIds: []
},
questionChoice: [],
//
isEdit: false,
activeIndex: undefined,
}
},
created() {
this.id = this.$route.params.id;
if(this.id != undefined) {
findQuestion({questionnaireId: this.id}).then(res => {
let data = res.data;
this.form.id = data.id;
this.form.title = data.title;
this.form.description = data.description;
this.form.answerType = data.answerType;
this.form.beginDate = data.beginDate;
this.form.endDate = data.endDate;
this.form.isRelease = data.isRelease;
// this.form.questionnaireInsertTopicDTOList = data.questionnaireFBITopicVoList;
let arr = [];
data.questionnaireFBITopicVoList.forEach(ele => {
ele.deleteTopicChoiceIds = []
let obj = {
id: ele.id,
type: ele.type,
topic: ele.topic,
deleteTopicChoiceIds: [],
questionnaireInsertTopicChoiceDTOList: ele.questionnaireFBITopicChoiceVoList
};
arr.push(obj)
});
this.form.questionnaireInsertTopicDTOList = arr
})
}
},
methods: {
//
addQuestion(type) {
this.isEdit = false;
this.activeIndex = undefined;
let obj = {
type: type,
topic: '',
id: null,
questionnaireInsertTopicChoiceDTOList: [],
deleteTopicChoiceIds:[]
};
this.questionCard = obj
},
//,
questionComfirm(type) {
if(this.isEdit == false) {
if(type == 1 || type == 2 || type == 3) {
for(let i = 0;i<this.questionChoice.length;i++) {
this.questionChoice[i].options = this.letters[i]
};
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
id: null,
questionnaireInsertTopicChoiceDTOList: this.questionChoice,
deleteTopicChoiceIds: [],
};
this.form.questionnaireInsertTopicDTOList.push(obj)
} else {
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
id: null,
questionnaireInsertTopicChoiceDTOList: [],
deleteTopicChoiceIds: []
};
this.form.questionnaireInsertTopicDTOList.push(obj)
}
} else if (this.isEdit == true) {
if(type == 1 || type == 2 || type == 3) {
for(let i = 0;i<this.questionChoice.length;i++) {
this.questionChoice[i].options = this.letters[i]
};
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
id: this.questionCard.id,
questionnaireInsertTopicChoiceDTOList: this.questionChoice,
deleteTopicChoiceIds: []
};
this.form.questionnaireInsertTopicDTOList[this.activeIndex] = obj
} else {
let obj = {
type: this.questionCard.type,
topic: this.questionCard.topic,
id: this.questionCard.id,
questionnaireInsertTopicChoiceDTOList: [],
deleteTopicChoiceIds: []
};
this.form.questionnaireInsertTopicDTOList[this.activeIndex] = obj
}
}
this.questionCancel()
},
questionCancel() {
this.isEdit = false;
this.activeIndex = undefined;
this.questionChoice = [];
this.questionCard = {
type: undefined,
topic: '',
}
},
//
addchoice() {
let obj = {
answer: '',
options: '',
id: null
};
this.questionChoice.push(obj)
},
//
deleteChoice(index) {
this.questionChoice.splice(index,1)
},
//
editQuestionItem(item,index) {
this.isEdit = true;
this.activeIndex = index;
this.questionCard.type = item.type;
this.questionCard.topic = item.topic;
this.questionCard.id = item.id;
if(item.questionnaireInsertTopicChoiceDTOList) {
this.questionChoice = item.questionnaireInsertTopicChoiceDTOList
}
},
//
deleteQuestionItem(index) {
this.form.questionnaireInsertTopicDTOList.splice(index,1)
},
//
save() {
console.log(this.form)
updateQuestion(this.form).then(res => {
if (res.code === 200) {
this.$message.success(res.msg);
this.$router.go(-1);
} else {
this.$message.error(res.msg);
}
})
},
//
cancel() {
this.questionList = [];
this.$router.go(-1);
},
}
}
</script>
<style lang="less">
.top-button {
padding: 8px 0px 20px 10px
}
.main-area {
display: flex;
padding: 0px 20px 20px 10px;
.type-choose {
height: 837px;
width: 220px;
border: 2px solid #E7E7E7;
.type-title {
font-size: 14px;
font-weight: 500;
line-height: 20px;
padding: 18px 18px 18px 18px
}
.type-button {
height: 40px;
width: 180px;
margin-left: 18px;
margin-bottom: 20px;
}
}
.question-area {
margin-left: 20px;
.question-area-top {
// height: 184px;
width: 1020px;
border: 2px solid #E7E7E7
}
.question-item {
width: 1020px;
border: 2px solid #E7E7E7;
margin-top: 20px;
background: #F5F5F5;
}
}
.question-setting {
height: 837px;
width: 230px;
margin-left: 20px;
border: 2px solid #E7E7E7;
}
}
.question-list {
display: flex;
justify-content: space-between;
padding: 20px 20px 20px 40px
}
</style>

@ -0,0 +1,197 @@
<template>
<div>
<div class="cardTitle">
<a-space size="large">
<span>问卷调查</span>
</a-space>
</div>
<div class="search-box">
<a-row>
<a-col :span="20">
<a-space size="large">
<a-input v-model="form.title" style="width: 200px" placeholder="问卷标题"></a-input>
<a-select v-model="form.status" style="width: 200px" placeholder="问卷状态">
<a-select-option :value="1">未开始</a-select-option>
<a-select-option :value="2">正在进行</a-select-option>
<a-select-option :value="3">已结束</a-select-option>
</a-select>
<a-select v-model="form.answerType" style="width: 200px" placeholder="问卷对象">
<a-select-option :value="1">无限制</a-select-option>
<a-select-option :value="2">业主</a-select-option>
<a-select-option :value="3">业主亲属</a-select-option>
<a-select-option :value="4">租户</a-select-option>
<a-select-option :value="5">租户亲属</a-select-option>
</a-select>
<a-button type="primary" @click='getData'> </a-button>
<a-button @click='reset'> </a-button>
</a-space>
</a-col>
</a-row>
</div>
<a-button style="margin: 10px" class="add-btn" @click="addScroll"></a-button>
<div class="main">
<a-table :columns="columns" :data-source="tableData"
:pagination="pagination" @change="handlerChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}">
<template slot="release" slot-scope="text,record">
<a-switch checked-children=""
un-checked-children="未发布"
:checked="record.isRelease == 1"
@change="handleRelease(record)">
</a-switch>
</template>
<template slot="action" slot-scope="text,record">
<span><a @click=analize(record)>分析报表</a></span>
<span><a style="margin-left: 8px" @click=edit(record)>编辑</a></span>
<span><a style="margin-left: 8px;color:red" @click=del(record)>删除</a></span>
</template>
</a-table>
<div class="action">
<a-dropdown :disabled="!hasSelected">
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="del"> 批量删除 </a-menu-item>
</a-menu>
<a-button> 批量操作 <a-icon type="down" /> </a-button>
</a-dropdown>
<span style="margin-left: 8px">
<template v-if="hasSelected">
{{ `已选择 ${selectedRowKeys.length}` }}
</template>
</span>
</div>
</div>
</div>
</template>
<script>
import { rules, columns } from "./depend/config";
import {getQuestionList, delQuestion, releaseQuestion} from "@/api/operation/scroll"
export default {
data() {
return {
form: {
title: '',
status: undefined,
answerType: undefined
},
rules: rules,
columns: columns,
tableData: [],
pagination: {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
},
//
selectedRowKeys: [],
}
},
created() {
this.getData()
},
methods: {
getData() {
let obj = Object.assign(this.form, {pageNum: this.pagination.current,size: this.pagination.pageSize})
getQuestionList(obj).then(res => {
this.tableData = res.data.rows;
this.pagination.total = res.data.total
})
},
reset() {
this.form = {
title: '',
status: undefined,
answerType: undefined
},
this.getData()
},
handlerChange() {
this.pagination.current = val.current;
this.pagination.pageSize = val.pageSize;
this.getData()
},
//
analize(val) {
this.$router.push({name:'analyze',params:{id:val.id}})
},
//
edit(val) {
this.$router.push({name:'editScroll',params:{id:val.id}})
},
//
handleRelease(val) {
releaseQuestion({questionnaireId: val.id}).then(res => {
if(res.code === 200){
this.$message.success(res.msg);
this.getData()
} else {
this.$message.error(res.msg);
}
})
},
//
del(val) {
this.$confirm({
title: "是否删除该问卷?",
icon:'delete',
onOk:async()=>{
let res = await delQuestion({questionnaireIds: [val.id]})
if(res.code === 200){
this.$message.success(res.msg);
this.getData()
} else {
this.$message.error(res.msg);
}
},
})
},
//
selectionChoosed(val) {
this.selectedRowKeys = val
},
handleMenuClick(data) {
if (data.key === "del") {
this.$confirm({
title: "是否删除选中的问卷?",
icon:'delete',
onOk:async()=>{
let res = await delQuestion({questionnaireIds: this.selectedRowKeys})
if(res.code === 200){
this.$message.success(res.msg);
this.selectedRowKeys = [];
this.getData()
} else {
this.$message.error(res.msg);
}
},
})
}
},
//
addScroll() {
this.$router.push({name:'addScroll'})
}
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
},
},
}
</script>
<style lang="less">
.drawer-content {
padding: 16px;
}
</style>

Binary file not shown.
Loading…
Cancel
Save