|
@@ -5,6 +5,12 @@
|
|
|
</div>
|
|
|
<div class="c_wrap">
|
|
|
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
|
|
+ <el-form-item label="首选项">
|
|
|
+ <el-select v-model="selectPlan1" placeholder="请选择计划" @change="firstParamsHandle">
|
|
|
+ <el-option :label="计划" value="1"></el-option>
|
|
|
+ <el-option :label="组织" value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="计划名称">
|
|
|
<el-select v-model="selectPlan1" placeholder="请选择计划" @change="planSelectHandle1">
|
|
|
<el-option v-for="item in planList" :key="item.id" :label="item.planName" :value="item"></el-option>
|
|
@@ -22,7 +28,7 @@
|
|
|
<div id="my_chart" style="width: 100%;height: 500px;"></div>
|
|
|
</div>
|
|
|
<div class="c_main2">
|
|
|
- <table>
|
|
|
+ <table v-if="showTable">
|
|
|
<tr>
|
|
|
<th class="first">组织</th>
|
|
|
<th>一班</th>
|
|
@@ -30,82 +36,76 @@
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">总人数</td>
|
|
|
- <td v-if="comparePlanDate.length > 2">{{ comparePlanDate[1]['completeNum'] +
|
|
|
- comparePlanDate[1]['unComplete'] }}
|
|
|
+ <td>{{ unComplete1 + completeNum1 }}
|
|
|
</td>
|
|
|
- <td v-if="comparePlanDate.length > 2">{{ comparePlanDate[2]['completeNum'] +
|
|
|
- comparePlanDate[2]['completeNum'] }}
|
|
|
+ <td>{{ unComplete2 + completeNum2 }}
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">已完成人数</td>
|
|
|
- <td v-if="comparePlanDate.length > 2">{{ comparePlanDate[1].completeNum }}</td>
|
|
|
- <td v-if="comparePlanDate.length > 2">{{ comparePlanDate[2].completeNum }}</td>
|
|
|
+ <td>{{ completeNum1 }}</td>
|
|
|
+ <td>{{ completeNum2 }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">未完成人数</td>
|
|
|
- <td v-if="comparePlanDate.length > 2">{{ comparePlanDate[1].unComplete }}</td>
|
|
|
- <td v-if="comparePlanDate.length > 2">{{ comparePlanDate[2].unComplete }}</td>
|
|
|
+ <td>{{ unComplete1 }}</td>
|
|
|
+ <td>{{ unComplete2 }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td class="first">未完成人数占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td class="first">未完成占比</td>
|
|
|
+ <td>{{ getUnCompleteRate(1) }}</td>
|
|
|
+ <td>{{ getUnCompleteRate(2) }}</td>
|
|
|
</tr>
|
|
|
+
|
|
|
<tr>
|
|
|
<td class="first">焦虑人数</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ dimensionList1[0]['焦虑'] }}</td>
|
|
|
+ <td>{{ dimensionList2[0]['焦虑'] }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">焦虑占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ getOtherRate('焦虑', 1, 0) }}</td>
|
|
|
+ <td>{{ getOtherRate('焦虑', 2, 0) }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">抑郁人数</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td class="first">抑郁占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ dimensionList1[1]['抑郁'] }}</td>
|
|
|
+ <td>{{ dimensionList2[1]['抑郁'] }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">抑郁占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ getOtherRate('抑郁', 1, 1) }}</td>
|
|
|
+ <td>{{ getOtherRate('抑郁', 2, 1) }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">压力人数</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ dimensionList1[2]['压力'] }}</td>
|
|
|
+ <td>{{ dimensionList2[2]['压力'] }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">压力占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ getOtherRate('压力', 1, 2) }}</td>
|
|
|
+ <td>{{ getOtherRate('压力', 2, 2) }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">精神障碍人数</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ dimensionList1[3]['精神障碍'] }}</td>
|
|
|
+ <td>{{ dimensionList2[3]['精神障碍'] }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">精神障碍占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ getOtherRate('精神障碍', 1, 3) }}</td>
|
|
|
+ <td>{{ getOtherRate('精神障碍', 2, 3) }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">健康异常人数</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ unHealthNum1 }}</td>
|
|
|
+ <td>{{ unHealthNum2 }}</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="first">健康异常占比</td>
|
|
|
- <td>1</td>
|
|
|
- <td></td>
|
|
|
+ <td>{{ getUnHealthRate(1) }}</td>
|
|
|
+ <td>{{ getUnHealthRate(2) }}</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
@@ -114,14 +114,9 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import PieChart from "@/components/PieChart";
|
|
|
import * as echarts from 'echarts';
|
|
|
-import { options } from "less";
|
|
|
|
|
|
export default {
|
|
|
- components: {
|
|
|
- PieChart,
|
|
|
- },
|
|
|
data() {
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
@@ -137,18 +132,6 @@ export default {
|
|
|
pageSize: 10,
|
|
|
planName: '',
|
|
|
total: '',
|
|
|
- options1: [],
|
|
|
- options2: [],
|
|
|
- options3: [],
|
|
|
- options4: [],
|
|
|
- options5: [],
|
|
|
- options6: [],
|
|
|
- options7: [],
|
|
|
- options8: [],
|
|
|
- options9: [],
|
|
|
- options10: [],
|
|
|
- options11: [],
|
|
|
- options12: [],
|
|
|
options: {},
|
|
|
myChart: null,
|
|
|
userType: "",
|
|
@@ -156,11 +139,22 @@ export default {
|
|
|
organizationsList: [],
|
|
|
organizationsList2: [],
|
|
|
comparePlanList: [],
|
|
|
- comparePlanDate: [
|
|
|
- { 'unComplete': 0, 'completeNum': 0 }
|
|
|
- ],
|
|
|
+ unComplete1: 0,
|
|
|
+ unComplete2: 0,
|
|
|
+ completeNum1: 0,
|
|
|
+ completeNum2: 0,
|
|
|
+ dimensionList1: [],
|
|
|
+ dimensionList2: [],
|
|
|
+ unHealthNum1: 0,
|
|
|
+ unHealthNum2: 0
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ // 控制表格是否显示
|
|
|
+ showTable() {
|
|
|
+ return this.dimensionList1.length > 0 && this.dimensionList2.length > 0
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
let params = JSON.parse(sessionStorage.getItem('comparePlanInfo'));
|
|
|
this.selectPlan1 = params;
|
|
@@ -233,11 +227,9 @@ export default {
|
|
|
queryCompletePople(id, n, i) {
|
|
|
let url = `plan/countComplete?planId=${id}&orgList=${n}`;
|
|
|
this.$http.get(url, {}, (res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.getPlanDimNun(id, n, i);
|
|
|
- this.comparePlanDate.push({ 'unComplete': res.data[0], 'completeNum': res.data[1] });
|
|
|
- console.log(this.comparePlanDate.length)
|
|
|
- }
|
|
|
+ this[`unComplete${i}`] = res.data[0];
|
|
|
+ this[`completeNum${i}`] = res.data[1];
|
|
|
+ this.getPlanDimNun(id, n, i);
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -247,13 +239,13 @@ export default {
|
|
|
`userRecordScore/countNumByPlanDim?planId=${id}&orgList=${n}`,
|
|
|
{},
|
|
|
(res) => {
|
|
|
- console.log(res);
|
|
|
- let dimensionList = res.data;
|
|
|
- this.options['dataset']['source'][1][i] = (this.comparePlanDate[i].unComplete / (this.comparePlanDate[i].completeNum + this.comparePlanDate[i].unComplete)) * 100;
|
|
|
- this.options.dataset.source[2][i] = (parseInt(dimensionList[0]["焦虑"]) / this.comparePlanDate[i].completeNum) * 100;
|
|
|
- this.options.dataset.source[3][i] = (parseInt(dimensionList[1]["抑郁"]) / this.comparePlanDate[i].completeNum) * 100;
|
|
|
- this.options.dataset.source[4][i] = (parseInt(dimensionList[2]["压力"]) / this.comparePlanDate[i].completeNum) * 100;
|
|
|
- this.options.dataset.source[5][i] = (parseInt(dimensionList[3]["精神障碍"]) / this.comparePlanDate[i].completeNum) * 100;
|
|
|
+ let dimension = res.data;
|
|
|
+ this[`dimensionList${i}`] = res.data;
|
|
|
+ this.options['dataset']['source'][1][i] = (this[`unComplete${i}`] / (this[`completeNum${i}`] + this[`unComplete${i}`])) * 100;
|
|
|
+ this.options.dataset.source[2][i] = (parseInt(dimension[0]["焦虑"]) / this[`completeNum${i}`]) * 100;
|
|
|
+ this.options.dataset.source[3][i] = (parseInt(dimension[1]["抑郁"]) / this[`completeNum${i}`]) * 100;
|
|
|
+ this.options.dataset.source[4][i] = (parseInt(dimension[2]["压力"]) / this[`completeNum${i}`]) * 100;
|
|
|
+ this.options.dataset.source[5][i] = (parseInt(dimension[3]["精神障碍"]) / this[`completeNum${i}`]) * 100;
|
|
|
this.isAbnormal(id, n, i);
|
|
|
}
|
|
|
);
|
|
@@ -264,7 +256,8 @@ export default {
|
|
|
let url = `/planUser/countCompletedUserHighRisk?planId=${id}&orgList=${n}`;
|
|
|
this.$http.get(url, {}, (res) => {
|
|
|
if (res.code == 200) {
|
|
|
- this.options.dataset.source[6][i] = (parseInt(res.data) / this.comparePlanDate[i].completeNum) * 100;
|
|
|
+ this[`unHealthNum${i}`] = res.data;
|
|
|
+ this.options.dataset.source[6][i] = (parseInt(res.data) / this[`completeNum${i}`]) * 100;
|
|
|
this.options && this.myChart.setOption(this.options);
|
|
|
}
|
|
|
});
|
|
@@ -284,12 +277,32 @@ export default {
|
|
|
this.queryCompletePople(item.id, [this.orgInfo2.orgNo], 1);
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
orgSelectHandle1(item) {
|
|
|
this.queryCompletePople(this.selectPlan1.id, [item.orgNo], 0);
|
|
|
},
|
|
|
orgSelectHandle2(item) {
|
|
|
this.queryCompletePople(this.selectPlan2.id, [item.orgNo], 1);
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 未完成占比计算
|
|
|
+ getUnCompleteRate(i) {
|
|
|
+ let rate = parseInt((this[`unComplete${i}`] / (this[`unComplete${i}`] + this[`completeNum${i}`])) * 100);
|
|
|
+ return rate > 0 ? `${rate}%` : rate;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 健康异常占比计算
|
|
|
+ getUnHealthRate(i) {
|
|
|
+ let rate = parseInt((this[`unHealthNum${i}`] / (this[`unComplete${i}`] + this[`completeNum${i}`])) * 100);
|
|
|
+ return rate > 0 ? `${rate}%` : rate;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 其他占比计算
|
|
|
+ getOtherRate(name, i, m) {
|
|
|
+ let tempNum = this[`dimensionList${i}`][m][name];
|
|
|
+ let rate = parseInt((tempNum / this[`completeNum${i}`]) * 100)
|
|
|
+ return rate > 0 ? `${rate}%` : rate;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|