|
|
@ -5,25 +5,63 @@ |
|
|
|
:key="index"> |
|
|
|
<div class="content"> |
|
|
|
<div class="title"> |
|
|
|
<span style="font-size: 16px">Q:{{ item.label }}({{ item.type }})</span> |
|
|
|
<span style="font-size: 16px; font-weight: bold;">Q{{ index + 1 }} :{{ item.label }}({{ item.type }})</span> |
|
|
|
|
|
|
|
<div> |
|
|
|
<!-- <div> |
|
|
|
<span>图表类型:</span> |
|
|
|
<el-select v-model="item.chartType" |
|
|
|
placeholder="请选择"> |
|
|
|
<el-option v-for="subItem in options" |
|
|
|
<el-select v-model="item.chartType" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
v-for="subItem in options" |
|
|
|
:key="subItem.value" |
|
|
|
:label="subItem.label" |
|
|
|
:value="subItem.value" /> |
|
|
|
:value="subItem.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
<!-- <line-chart |
|
|
|
class="chart" |
|
|
|
:chart-option="getCharData(item)" |
|
|
|
:width="'90vw'" |
|
|
|
/> --> |
|
|
|
<div v-if="computedCount(item.type)" |
|
|
|
class="cell-type"> |
|
|
|
<span>共收集 {{ item.detail.collectionTotal }} 条,</span> |
|
|
|
<span>有效 {{ item.detail.validTotal }} 条</span> |
|
|
|
<span v-if="item.type === 'NUMBER_INPUT'">,总计 {{ item.detail.sumTotal }} </span> |
|
|
|
<span v-if="item.type === 'SWITCH'">,开 {{ item.detail.openTotal }} 条,关 {{ item.detail.closedTotal }} 条</span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div v-else-if="item.type === 'RADIO' || item.type === 'CHECKBOX' || item.type === 'SELECT'" |
|
|
|
class="cell-wrapper"> |
|
|
|
<div v-for="(n, i) in item.detail.options" |
|
|
|
:key="i" |
|
|
|
class="cell"> |
|
|
|
<div class="cell-label">{{ n.label }}</div> |
|
|
|
<div class="cell-value"> |
|
|
|
<div class="cell-progress"> |
|
|
|
<el-progress :stroke-width="20" |
|
|
|
:show-text="false" |
|
|
|
:percentage="computedPercent(n.currentCount, item.detail.totalCount)" /> |
|
|
|
</div> |
|
|
|
<div class="cell-percent"> |
|
|
|
{{ computedPercent(n.currentCount, item.detail.totalCount).toFixed(2) }}% |
|
|
|
</div> |
|
|
|
<div class="cell-num">{{ n.currentCount }}次</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-divider /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<line-chart class="chart" |
|
|
|
:chart-option="getCharData(item)" |
|
|
|
:width="'90vw'" /> |
|
|
|
</div> |
|
|
|
<el-divider /> |
|
|
|
</div> |
|
|
|
<data-empty v-else |
|
|
|
style="padding: 20px" |
|
|
|
desc="暂无数据分析" /> |
|
|
|
</div> |
|
|
|
<data-empty v-else |
|
|
|
style="padding: 20px" |
|
|
@ -116,16 +154,20 @@ export default { |
|
|
|
this.list = res.data |
|
|
|
}) |
|
|
|
}, |
|
|
|
getCharData (data) { |
|
|
|
const config = { |
|
|
|
tooltip: { |
|
|
|
backgroundColor: 'rgba(255,255,255,0.8)', // 通过设置rgba调节背景颜色与透明度 |
|
|
|
color: 'black', |
|
|
|
borderWidth: '1', |
|
|
|
borderColor: 'rgb(156,209,255)', |
|
|
|
textStyle: { |
|
|
|
color: 'black' |
|
|
|
} |
|
|
|
mounted () { |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getData () { |
|
|
|
// `${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/analysis` |
|
|
|
// params: { projectKey: this.$route.query.key } |
|
|
|
this.$api |
|
|
|
.post('/data/aggregator/questionnaire/analysisreport', { |
|
|
|
projectKey: this.$route.query.key |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
this.list = res.data |
|
|
|
}) |
|
|
|
}, |
|
|
|
grid: { |
|
|
|
left: '3%', |
|
|
@ -139,24 +181,14 @@ export default { |
|
|
|
axisTick: { |
|
|
|
alignWithLabel: true |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
yAxis: [ |
|
|
|
{ |
|
|
|
type: 'value' |
|
|
|
} |
|
|
|
], |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
name: '数量', |
|
|
|
type: 'pie', |
|
|
|
barWidth: '40%' |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
if (['bar', 'line'].includes(data.chartType)) { |
|
|
|
config.tooltip.axisPointer = { |
|
|
|
type: 'line' |
|
|
|
return config |
|
|
|
}, |
|
|
|
computedCount(type) { |
|
|
|
const arr = ['PROVINCE_CITY', 'NUMBER_INPUT', 'SWITCH', 'INPUT', 'TEXTAREA', 'INPUT_MAP', 'TIME', 'DATE_RANGE', 'DATE', 'TIME_RANGE'] |
|
|
|
return arr.includes(type) |
|
|
|
}, |
|
|
|
computedPercent(num, count) { |
|
|
|
return ((num * 100) / count) |
|
|
|
} |
|
|
|
config.tooltip.trigger = 'axis' |
|
|
|
config.xAxis[0].data = data.fieldName |
|
|
@ -165,18 +197,18 @@ export default { |
|
|
|
} else { |
|
|
|
// 环形图暂时不用 无法切换到饼图 |
|
|
|
/* if ("ring" === data.chartType) { |
|
|
|
config.series[0].radius = ["40%", "70%"]; |
|
|
|
config.series[0].radius = ["40%", "70%"]; |
|
|
|
|
|
|
|
config.series[0].emphasis = { |
|
|
|
config.series[0].emphasis = { |
|
|
|
label: { |
|
|
|
show: true, |
|
|
|
fontSize: '25', |
|
|
|
fontWeight: 'bold' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
delete config.series[0].radius |
|
|
|
delete config.series[0].label |
|
|
|
delete config.series[0].radius |
|
|
|
delete config.series[0].label |
|
|
|
} */ |
|
|
|
config.series[0].data = [] |
|
|
|
Object.keys(data.map).forEach(key => { |
|
|
@ -185,7 +217,7 @@ export default { |
|
|
|
// config.series[0].data = data.map |
|
|
|
} |
|
|
|
return config |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -199,7 +231,7 @@ export default { |
|
|
|
width: 100%; |
|
|
|
.title { |
|
|
|
font-size: 14px; |
|
|
|
padding: 0 30px; |
|
|
|
// padding: 0 30px; |
|
|
|
height: 54px; |
|
|
|
line-height: 54px; |
|
|
|
width: 100%; |
|
|
@ -212,3 +244,50 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
.cell-type { |
|
|
|
padding-left: 10px; |
|
|
|
font-size: 14px; |
|
|
|
} |
|
|
|
.cell-wrapper { |
|
|
|
width: 100%; |
|
|
|
border: 1px solid #eee; |
|
|
|
.cell, |
|
|
|
.cell-value { |
|
|
|
widows: 100%; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
} |
|
|
|
.cell { |
|
|
|
justify-content: space-between; |
|
|
|
padding: 10px 0; |
|
|
|
font-size: 14px; |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
.cell-label { |
|
|
|
width: 60%; |
|
|
|
box-sizing: border-box; |
|
|
|
padding-left: 10px; |
|
|
|
} |
|
|
|
.cell-value { |
|
|
|
width: 40%; |
|
|
|
.cell-progress { |
|
|
|
// flex: 1; |
|
|
|
width: 180px; |
|
|
|
} |
|
|
|
.cell-percent { |
|
|
|
margin-left: 10px; |
|
|
|
} |
|
|
|
.cell-num { |
|
|
|
width: 40%; |
|
|
|
flex-shrink: 0; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.cell:last-child { |
|
|
|
border-bottom: 0; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
|
|
|
|