2022-01-28 08:58:23 +08:00
|
|
|
|
<template>
|
2022-01-28 14:03:50 +08:00
|
|
|
|
<div class="statistical" v-if="pageShow">
|
2022-01-28 08:58:23 +08:00
|
|
|
|
<div class="statistical-tab">
|
|
|
|
|
|
<span :class="[currIndex === 0 ? 'active' : '']" @click="currIndex = 0">问卷统计</span>
|
|
|
|
|
|
<span :class="[currIndex === 1 ? 'active' : '']" @click="currIndex = 1">人员统计</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="statistical-content">
|
|
|
|
|
|
<div class="list-wrapper" v-show="currIndex === 0">
|
|
|
|
|
|
<div class="top">
|
|
|
|
|
|
<span>共</span>
|
2022-01-28 14:03:50 +08:00
|
|
|
|
<i>{{ subjectList.length }}</i>
|
|
|
|
|
|
<span>题,其中</span>
|
|
|
|
|
|
<span v-for="(item, index) in fieldTypeCount" :key="index">
|
|
|
|
|
|
{{ mapType(item.field_type) }}<i>{{ item.c }}</i>道{{ fieldTypeCount.length - 1 === index ? '' : ',' }}
|
|
|
|
|
|
</span>
|
2022-01-28 08:58:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="topic-list">
|
2022-02-07 13:52:43 +08:00
|
|
|
|
<div class="topic-item" :class="[['radio', 'checkbox', 'select'].indexOf(item.fieldType) === -1 ? 'topic-item__active' : '']" v-for="(item, index) in subjectList" :key="index">
|
|
|
|
|
|
<template v-if="['radio', 'checkbox', 'select'].indexOf(item.fieldType) > -1">
|
|
|
|
|
|
<h2>{{ item.fieldName }}({{ item.fixedLabel }})</h2>
|
|
|
|
|
|
<div class="topic-item__wrapper">
|
|
|
|
|
|
<div class="option-item" v-for="(filed, i) in item.options" :key="i">
|
|
|
|
|
|
<div class="option-item__left">
|
|
|
|
|
|
<h2>{{ filed.label }}:</h2>
|
|
|
|
|
|
<!-- <span>每周监测</span> -->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="option-item__right">
|
2022-02-10 14:04:08 +08:00
|
|
|
|
<span>{{ filed.c || 0}}票</span>
|
2022-02-07 13:52:43 +08:00
|
|
|
|
<span>{{ (((filed.c || 0) / fieldDataCount[`field_${index}`]) * 100).toFixed(2) }}%</span>
|
|
|
|
|
|
</div>
|
2022-01-28 08:58:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-02-07 13:52:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<h2 class="topic-item__left">{{ item.fieldName }}({{ item.fixedLabel }})</h2>
|
|
|
|
|
|
<span>共{{ fieldDataCount[`field_${index}`] }}条数据</span>
|
|
|
|
|
|
</template>
|
2022-01-28 08:58:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="user-list" v-show="currIndex === 1">
|
2022-02-07 13:52:43 +08:00
|
|
|
|
<div class="user-item" v-for="(item, index) in list" :key="index">
|
2022-01-28 08:58:23 +08:00
|
|
|
|
<div class="user-item__left">
|
2022-02-10 14:04:08 +08:00
|
|
|
|
<image src="./components/img/user-icon.png" />
|
2022-01-28 08:58:23 +08:00
|
|
|
|
<div class="right">
|
|
|
|
|
|
<div class="right-top">
|
2022-02-11 11:44:42 +08:00
|
|
|
|
<h2 v-if="item.userType === 'wxuser'">{{ item.nickName }}</h2>
|
|
|
|
|
|
<AiOpenData v-else type="userName" :openid="item.nickName"/>
|
2022-01-28 08:58:23 +08:00
|
|
|
|
</div>
|
2022-02-07 13:52:43 +08:00
|
|
|
|
<p>{{ item.commitTime }}</p>
|
2022-01-28 08:58:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="user-item__right">
|
2022-02-07 13:52:43 +08:00
|
|
|
|
<p>分值: {{ item.totalScore }}</p>
|
|
|
|
|
|
<div @click="toPreview(item.id)">查看表单</div>
|
2022-01-28 08:58:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
appName: '调查结果',
|
|
|
|
|
|
|
|
|
|
|
|
name: 'Statistical',
|
|
|
|
|
|
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2022-01-28 14:03:50 +08:00
|
|
|
|
id: '',
|
|
|
|
|
|
currIndex: 0,
|
|
|
|
|
|
targetList: [],
|
|
|
|
|
|
info: {},
|
|
|
|
|
|
subjectList: [],
|
|
|
|
|
|
tableData: [],
|
|
|
|
|
|
total: 0,
|
|
|
|
|
|
pageShow: false,
|
|
|
|
|
|
form: {},
|
2022-02-07 13:52:43 +08:00
|
|
|
|
search: {
|
|
|
|
|
|
size: 15,
|
|
|
|
|
|
current: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
isMore: false,
|
2022-01-28 14:03:50 +08:00
|
|
|
|
fieldTypeCount: [],
|
|
|
|
|
|
fieldValueDistribution: [],
|
|
|
|
|
|
fieldDataCount: {},
|
|
|
|
|
|
isShowForm: false,
|
|
|
|
|
|
targetList: [],
|
2022-02-07 13:52:43 +08:00
|
|
|
|
formInfo: {},
|
|
|
|
|
|
list: []
|
2022-01-28 08:58:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2022-01-28 14:03:50 +08:00
|
|
|
|
onLoad (query) {
|
|
|
|
|
|
this.$loading()
|
|
|
|
|
|
this.id = query.id
|
2022-01-28 08:58:23 +08:00
|
|
|
|
|
2022-01-28 14:03:50 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.getInfo()
|
|
|
|
|
|
this.getFormInfo()
|
2022-02-07 13:52:43 +08:00
|
|
|
|
|
|
|
|
|
|
this.$dict.load(['wxUserType']).then(() => {
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
})
|
2022-01-28 14:03:50 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getInfo () {
|
|
|
|
|
|
this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${this.id}`).then(res => {
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
this.info = res.data
|
|
|
|
|
|
this.targetList = res.data.fields.map(item => {
|
|
|
|
|
|
return JSON.parse(item.fieldInfo)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2022-02-07 13:52:43 +08:00
|
|
|
|
toPreview(id) {
|
|
|
|
|
|
localStorage.setItem("toPreviewForm", JSON.stringify({form: this.info, targetList: this.targetList}))
|
|
|
|
|
|
uni.navigateTo({url: `./PreviewForm?id=${id}&formId=${this.info.id}`})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getList() {
|
|
|
|
|
|
if (this.isMore) return
|
|
|
|
|
|
this.$http.post(`/app/appquestionnairetemplate/statisticsResident?id=${this.id}`, null, {
|
|
|
|
|
|
params: {
|
|
|
|
|
|
...this.search
|
|
|
|
|
|
}
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
if (this.search.current > 1) {
|
|
|
|
|
|
this.list = [...this.list, ...res.data.records]
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.list = res.data.records
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
|
|
|
|
|
|
if (res.data.records.length < 10) {
|
|
|
|
|
|
this.isMore = true
|
|
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.search.current = this.search.current + 1
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2022-01-28 14:03:50 +08:00
|
|
|
|
mapType(type) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
upload: '上传图片',
|
|
|
|
|
|
input: '单行填空',
|
|
|
|
|
|
textarea: '多行填空',
|
|
|
|
|
|
radio: '单选',
|
|
|
|
|
|
checkbox: '多选',
|
|
|
|
|
|
select: '单下拉框'
|
|
|
|
|
|
}[type]
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getFormInfo() {
|
|
|
|
|
|
this.$http.post(`/app/appquestionnairetemplate/statisticsTable?id=${this.id}`, null, {
|
|
|
|
|
|
params: {
|
|
|
|
|
|
...this.search
|
|
|
|
|
|
}
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
this.$hideLoading()
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
this.fieldDataCount = res.data.fieldDataCount
|
|
|
|
|
|
this.fieldTypeCount = res.data.fieldTypeCount
|
|
|
|
|
|
this.fieldValueDistribution = res.data.fieldValueDistribution
|
|
|
|
|
|
this.subjectList = res.data.appQuestionnaireTemplate.fields.map((item, index) => {
|
|
|
|
|
|
const fieldInfo = JSON.parse(item.fieldInfo)
|
|
|
|
|
|
let options = fieldInfo.options
|
|
|
|
|
|
if (['radio', 'checkbox', 'select'].indexOf(item.fieldType) > -1) {
|
|
|
|
|
|
options = fieldInfo.options.map(v => {
|
|
|
|
|
|
res.data.fieldValueDistribution[`field_${index}`].forEach(info => {
|
|
|
|
|
|
if (info.fieldValue === v.label) {
|
|
|
|
|
|
v.c = info.c
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return v
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
...fieldInfo,
|
|
|
|
|
|
options
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.pageShow = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-02-07 13:52:43 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
this.getList()
|
2022-01-28 08:58:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.statistical {
|
|
|
|
|
|
padding-top: 112px;
|
|
|
|
|
|
padding-bottom: 60px;
|
|
|
|
|
|
|
2022-01-28 14:03:50 +08:00
|
|
|
|
.user-list {
|
|
|
|
|
|
padding: 0 32px;
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
|
|
|
|
|
|
.user-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 160px;
|
|
|
|
|
|
margin-top: 24px;
|
|
|
|
|
|
padding: 32px;
|
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
|
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.02);
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
.user-item__right {
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
p {
|
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
div {
|
|
|
|
|
|
color: #1365DD;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.user-item__left {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
.right {
|
|
|
|
|
|
p {
|
|
|
|
|
|
color: #999999;
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.right-top {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
|
|
|
|
|
|
|
h2 {
|
2022-02-10 15:53:04 +08:00
|
|
|
|
max-width: 300px;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
2022-01-28 14:03:50 +08:00
|
|
|
|
margin-right: 20px;
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
color: #999999;
|
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image {
|
|
|
|
|
|
width: 96px;
|
|
|
|
|
|
height: 96px;
|
|
|
|
|
|
margin-right: 16px;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-28 08:58:23 +08:00
|
|
|
|
* {
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
i {
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.list-wrapper {
|
|
|
|
|
|
padding-bottom: 40px;
|
|
|
|
|
|
|
|
|
|
|
|
.top {
|
2022-01-28 14:03:50 +08:00
|
|
|
|
padding: 36px 32px 32px;
|
|
|
|
|
|
text-align: justify;
|
2022-01-28 08:58:23 +08:00
|
|
|
|
font-size: 34px;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
border-bottom: 4px solid #f3f6f9;
|
|
|
|
|
|
|
|
|
|
|
|
i {
|
|
|
|
|
|
color: #347FFF;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.topic-item {
|
|
|
|
|
|
padding: 40px 32px 0;
|
|
|
|
|
|
|
|
|
|
|
|
& > h2 {
|
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-02-07 13:52:43 +08:00
|
|
|
|
&.topic-item__active {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
margin: 40px 32px 0;
|
|
|
|
|
|
padding: 34px 32px;
|
|
|
|
|
|
background: #EFF7FF;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
border: 1px solid #CCCCCC;
|
|
|
|
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
margin-right: 9px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
color: #666666;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-28 08:58:23 +08:00
|
|
|
|
.option-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
margin-top: 24px;
|
|
|
|
|
|
padding: 34px 32px;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
border: 1px solid #CCCCCC;
|
|
|
|
|
|
background: #F5F5F5;
|
|
|
|
|
|
|
|
|
|
|
|
& > div {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.option-item__left {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
margin-right: 18px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
text-align: justify;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.option-item__right {
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
span {
|
|
|
|
|
|
color: #666666;
|
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
|
|
|
|
|
|
|
&:first-child {
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.statistical-content {
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.statistical-tab {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
z-index: 11;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 96px;
|
|
|
|
|
|
padding: 0 32px;
|
2022-01-28 14:03:50 +08:00
|
|
|
|
border-bottom: 1px solid #D4D4D4;
|
2022-01-28 08:58:23 +08:00
|
|
|
|
background: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
line-height: 96px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
color: #000;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
width: 192px;
|
|
|
|
|
|
height: 6px;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
|
content: ' ';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
color: #1365DD;
|
|
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
|
background: #1365DD;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|