Browse Source

首页折线图的legend高度调整,省满意度调查列表

feature
mk 2 years ago
parent
commit
5693a514ef
  1. 4
      src/views/modules/home/index.vue
  2. 453
      src/views/modules/satisfaction/satisfactionProvince/index.vue

4
src/views/modules/home/index.vue

@ -274,7 +274,7 @@ export default {
},
legend: {
data: data.series.map((item) => item.name),
bottom: "10%",
bottom: "5%",
icon: "rect",
itemWidth: 20,
itemHeight: 5,
@ -283,7 +283,7 @@ export default {
grid: {
left: "3%",
right: "4%",
bottom: "25%",
bottom: "30%",
containLabel: true,
},
toolbox: {

453
src/views/modules/satisfaction/satisfactionProvince/index.vue

@ -3,65 +3,240 @@
<div class="g-main">
<div>
<div class="m-search">
<el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'100px'">
<el-form
:inline="true"
:model="formData"
ref="ref_searchform"
:label-width="'100px'"
>
<el-form-item label="自评周期">
<el-date-picker v-model="formData.periodStart" type="month" value-format="yyyy-MM" placeholder="选择日期"
style="width: 202px" clearable>
<el-date-picker
v-model="formData.periodStart"
type="month"
value-format="yyyy-MM"
placeholder="选择日期"
style="width: 202px"
clearable
>
</el-date-picker>
</el-form-item>
<div style="float: right; margin-top:5px">
<el-button style="margin-left: 30px" size="small" type="primary "
@click="handleSearch">查询</el-button>
<el-button style="margin-left: 10px" is-plain class="diy-button--white el-button--default"
size="small" @click="resetSearch">重置</el-button>
<div style="float: right; margin-top: 5px">
<el-button
style="margin-left: 30px"
size="small"
type="primary "
@click="handleSearch"
>查询</el-button
>
<el-button
style="margin-left: 10px"
is-plain
class="diy-button--white el-button--default"
size="small"
@click="resetSearch"
>重置</el-button
>
</div>
</el-form>
</div>
<div class="m-table">
<div class="div_btn">
<el-upload :headers="$getElUploadHeaders()" ref="upload" class="upload-btn" action="uploadUlr"
:limit="1" :accept="'.xls,.xlsx'" :with-credentials="true" :show-file-list="false"
:auto-upload="true" :before-upload="beforeExcelUpload" :http-request="uploadHttpRequest">
<el-button type="primary" size="small" class="diy-button--white el-button--default"
:loading="importLoading">导入</el-button>
<el-upload
:headers="$getElUploadHeaders()"
ref="upload"
class="upload-btn"
action="uploadUlr"
:limit="1"
:accept="'.xls,.xlsx'"
:with-credentials="true"
:show-file-list="false"
:auto-upload="true"
:before-upload="beforeExcelUpload"
:http-request="uploadHttpRequest"
>
<el-button
type="primary"
size="small"
class="diy-button--white el-button--default"
:loading="importLoading"
>导入</el-button
>
</el-upload>
<el-button type="primary" style="margin-left:10px" size="small"
class="diy-button--white el-button--default" @click="handleExportModule">下载模板</el-button>
<el-button
type="primary"
style="margin-left: 10px"
size="small"
class="diy-button--white el-button--default"
@click="handleExportModule"
>下载模板</el-button
>
</div>
<el-radio-group v-model="formData.orgCategoryCode" @change="handelChangeCategory" style="margin: 20px 0 0;">
<el-radio-group
v-model="formData.orgCategoryCode"
@change="handelChangeCategory"
style="margin: 20px 0 0"
>
<el-radio-button label="province">省满意度调查</el-radio-button>
<el-radio-button label="city">市满意度调查</el-radio-button>
<el-radio-button label="district">区满意度调查</el-radio-button>
</el-radio-group>
<div class="m-table-item" :style="{ height: maxTableHeight + 'px', width: '100%' }">
<div
class="m-table-item"
v-if="user.level == 'community'"
:style="{ height: maxTableHeight + 'px', width: '100%' }"
>
<div id="myCharts"></div>
</div>
<div v-else>
<section class="content_box">
<div class="left">
<img
src="../../../../assets/img/satisfaction/zhdf.png"
alt="Image"
/>
<div class="left_right">
<!-- <div>{{ synthesisScore }}</div> -->
<div>综合得分</div>
</div>
</div>
<div class="right">
<div class="box" v-for="(item, index) in badList" :key="index">
<div class="card">
<img :src="item.imgUrl" alt="Image" />
<div class="right_right">
<div>{{ item.badNum }}</div>
<div>{{ item.satisfactionCategoryName }}</div>
</div>
</div>
</div>
</div>
<el-dialog v-if="showFormList" :visible.sync="showFormList" :close-on-click-modal="false"
:close-on-press-escape="false" title="省满意度调查列表" :modal-append-to-body="false" width="820px" top="5vh"
class="dialog-h" @closed="showFormList = false">
<form-list ref="ref_form_list" @handleClose="handleClose" :satisfactionCategoryStr="satisfactionCategoryStr"
:formObj="formData" @handelClickDetail="handelClickDetail"
@handelClickEdit="handelClickEdit"></form-list>
<el-dialog width="820px" class="dialog-h" title="省满意度调查详情" :close-on-click-modal="false"
v-if="showProvinceFollowUpDetail" :visible.sync="showProvinceFollowUpDetail" append-to-body>
<follow-detail :detailObj="detailObj" :formType="formType"
@handleCancle="showProvinceFollowUpDetail = false" @handleComfirm="handleComfirm"></follow-detail>
</section>
<el-table :data="tableList" :height="maxTableHeight">
<el-table-column label="序号" type="index" width="80" />
<el-table-column
label="社区"
show-overflow-tooltip
prop="communityName"
width=""
/>
<el-table-column label="不满意总数" prop="badTotal" width="100" />
<el-table-column
label="文化设施"
prop="culturalFacility"
width="100"
/>
<el-table-column
label="基础教育"
prop="basicEducation"
width="100"
/>
<el-table-column
label="体育设施"
prop="sportsFacility"
width="100"
/>
<el-table-column
label="生态环境"
prop="ecologicalEnv"
width="100"
/>
<el-table-column
label="社会治安"
prop="socialSecurity"
width="100"
/>
<el-table-column
label="社会救助"
prop="socialAssistance"
width="100"
/>
<el-table-column
label="老有所养"
prop="oldPeopleProvide"
width="100"
/>
<el-table-column label="病有所医" prop="medical" width="100" />
<el-table-column
label="操作"
width="90"
align="center"
fixed="right"
>
<template slot-scope="data">
<el-button type="text" @click="handleView(data.row)"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
<el-row type="flex">
<el-col :span="12" align="left">
<div style="margin-top: 25px">{{ shengTotal }}</div>
</el-col>
<el-col :span="12" align="right">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-size="pageSize"
layout="prev, pager, next,jumper"
:total="shengTotal"
>
</el-pagination
></el-col>
</el-row>
</div>
</div>
</div>
<el-dialog
v-if="showFormList"
:visible.sync="showFormList"
:close-on-click-modal="false"
:close-on-press-escape="false"
title="省满意度调查列表"
:modal-append-to-body="false"
width="820px"
top="5vh"
class="dialog-h"
@closed="showFormList = false"
>
<form-list
ref="ref_form_list"
@handleClose="handleClose"
:satisfactionCategoryStr="satisfactionCategoryStr"
:formObj="formData"
@handelClickDetail="handelClickDetail"
@handelClickEdit="handelClickEdit"
></form-list>
<el-dialog
width="820px"
class="dialog-h"
title="省满意度调查详情"
:close-on-click-modal="false"
v-if="showProvinceFollowUpDetail"
:visible.sync="showProvinceFollowUpDetail"
append-to-body
>
<follow-detail
:detailObj="detailObj"
:formType="formType"
@handleCancle="showProvinceFollowUpDetail = false"
@handleComfirm="handleComfirm"
></follow-detail>
</el-dialog>
</el-dialog>
</div>
</template>
<script>
<script>
import { requestPost, requestGet } from "@/js/dai/request";
import { mapGetters } from "vuex";
import axios from "axios";
import * as echarts from 'echarts'
import * as echarts from "echarts";
import formList from "./formList";
import util from "@js/util.js";
import followDetail from "./followDetail"
import followDetail from "./followDetail";
export default {
components: { formList, followDetail },
@ -71,114 +246,122 @@ export default {
showFormList: false,
formData: {
periodStart: "",
orgCategoryCode:"province"
orgCategoryCode: "province",
},
multiSelection: [], //
importLoading: false,
dicts: {
satisfaction_category: []
satisfaction_category: [],
}, //
myChart: {},
satisfactionCategoryName: [],
satisfactionCategory: [],
score: [],
showProvinceFollowUpDetail: false,
option: {
tooltip: {
trigger: 'axis'
trigger: "axis",
},
legend: {
data: ['不满意'],
bottom: '10%',
icon: 'rect',
data: ["不满意"],
bottom: "10%",
icon: "rect",
itemWidth: 20,
itemHeight: 5,
itemGap: 20,
},
grid: {
left: '3%',
right: '4%',
bottom: '25%',
containLabel: true
left: "3%",
right: "4%",
bottom: "25%",
containLabel: true,
},
toolbox: {},
xAxis: {
type: 'category',
type: "category",
boundaryGap: true,
data: [],
},
yAxis: {
type: 'value',
name: '单位(个)',
type: "value",
name: "单位(个)",
min: 0,
},
series: [
{
name: '不满意',
type: 'bar',
name: "不满意",
type: "bar",
data: [],
barWidth: 24, //
barCategoryGap: 0, // 0
itemStyle: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{ offset: 0, color: '#2c7cf2' }, //
{ offset: 1, color: '#80b3ff' } //
]
)
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#2c7cf2" }, //
{ offset: 1, color: "#80b3ff" }, //
]),
},
showBackground: true,
backgroundStyle: {
color: '#fafbfc',
opacity: "0.5"
}
color: "#fafbfc",
opacity: "0.5",
},
]
},
satisfactionCategoryName: [],
satisfactionCategory: [],
score: [],
showProvinceFollowUpDetail: false,
],
},
detailObj: {},
formType: ''
formType: "",
echartsData: [],
tableList: [],
shengTotal: 0,
badList: [],
searchH: 86,
pageSize: 20,
pageNo: 1,
user: {},
};
},
computed: {
maxTableHeight() {
const h = this.clientHeight - this.searchH - 330 + this.iframeHeight;
const _h = this.clientHeight - 330 - this.searchH;
return this.$store.state.inIframe ? h : _h;
const _h = this.clientHeight - 520 - this.searchH;
return _h;
},
...mapGetters(["clientHeight", "iframeHeight"]),
...mapGetters(["clientHeight"]),
},
created() {
let date = new Date()
this.formData.periodStart = util.formatDate(date, 'yyyy-MM')
let date = new Date();
this.formData.periodStart = util.formatDate(date, "yyyy-MM");
this.user = this.$store.state.user;
console.log(this.user);
},
async mounted() {
this.user = this.$store.state.user;
this.agencyId = this.user.agencyId;
await this.getDicts();
await this.getTableData();
await this.initEcharts()
await this.getTableData(this.user.level);
if (this.user.level == "community") {
await this.initEcharts();
} else {
}
},
methods: {
// --------------------------------------------------------------------------------
async getDicts() {
try {
const requests = [
this.$http.post("sys/dict/data/dictlist", {
dictType: "satisfaction_category",
}),
];
const dictKeys = ['satisfaction_category']; //
const dictKeys = ["satisfaction_category"]; //
const results = await Promise.all(requests);
results.forEach((result, index) => {
@ -194,15 +377,14 @@ export default {
},
// ------------------------------------------------------------------------------
initEcharts() {
this.myChart = echarts.init(document.getElementById('myCharts'));
this.myChart.setOption(this.option)
let than = this
this.myChart.on('click', function (params) {
than.handelClickChart(params.name)
this.myChart = echarts.init(document.getElementById("myCharts"));
this.myChart.setOption(this.option);
let than = this;
this.myChart.on("click", function (params) {
than.handelClickChart(params.name);
});
window.addEventListener('resize', this.handleWindowResize);
window.addEventListener("resize", this.handleWindowResize);
},
handleWindowResize() {
if (this.myChart) {
@ -210,39 +392,42 @@ export default {
}
},
handelClickChart(name) {
this.showFormList = true
this.satisfactionCategoryStr = this.dicts.satisfaction_category.filter(item => item.label == name)[0].value
this.showFormList = true;
this.satisfactionCategoryStr = this.dicts.satisfaction_category.filter(
(item) => item.label == name
)[0].value;
},
handleClose() {
this.showFormList = false
this.showFormList = false;
},
handelClickDetail(row) {
this.formType = 'detail'
this.showProvinceFollowUpDetail = true
this.detailObj = row || {}
this.formType = "detail";
this.showProvinceFollowUpDetail = true;
this.detailObj = row || {};
},
handelClickEdit(row) {
this.formType = 'edit'
this.showProvinceFollowUpDetail = true
this.detailObj = row || {}
this.formType = "edit";
this.showProvinceFollowUpDetail = true;
this.detailObj = row || {};
},
handelChangeCategory(){
this.getTableData()
handelChangeCategory() {
this.getTableData();
},
handleComfirm(form) {
this.showProvinceFollowUpDetail = false
this.save(form)
this.showProvinceFollowUpDetail = false;
this.save(form);
},
async save(form) {
try {
const url = '/governance/provinceEvaluationRecord/updateInfo'
form.periodName = null
const { code } = await requestPost(url, form)
const url = "/governance/provinceEvaluationRecord/updateInfo";
form.periodName = null;
const { code } = await requestPost(url, form);
if (code == 0) {
this.getTableData()
this.$refs['ref_form_list'].getTableData()
this.$message.success('保存成功')
this.showProvinceFollowUpDetail = false
this.getTableData();
this.$refs["ref_form_list"].getTableData();
this.$message.success("保存成功");
this.showProvinceFollowUpDetail = false;
}
} catch (err) {
console.log(err);
@ -253,31 +438,50 @@ export default {
console.log(this.formData);
this.getTableData();
},
//
async getTableData() {
async getTableData(level) {
try {
const allowedCategories = this.dicts.satisfaction_category.map(item => item.value)
const { data } = await this.$http.post(
if (level == "community") {
const allowedCategories = this.dicts.satisfaction_category.map(
(item) => item.value
);
const { data,code,msg } = await this.$http.post(
`/governance/provinceEvaluationRecord/staticPeopleNum`,
{ ...this.formData }
);
this.option.series[0].data = []
this.option.xAxis.data = []
this.tableData = data
this.tableData.forEach(item => {
if(code == 0){
this.option.series[0].data = [];
this.option.xAxis.data = [];
this.echartsData = data;
this.echartsData.forEach((item) => {
if (allowedCategories.includes(item.scopeId)) {
this.option.series[0].data.push(item.peopleNum)
this.option.xAxis.data.push(item.scopeName)
this.option.series[0].data.push(item.peopleNum);
this.option.xAxis.data.push(item.scopeName);
}
});
this.myChart.setOption(this.option)
this.myChart.setOption(this.option);
}else{
this.$message.error(msg);
}
} else {
const { data,code,msg } = await this.$http.post(
`/governance/provinceEvaluationRecord/staticStreetPeopleNum`,
{ ...this.formData }
);
if(code == 0){
console.log(data);
}else {
this.$message.error(msg);
}
}
} catch (error) {
console.log(error);
}
},
async handleExportModule() {
let url = "/governance/provinceEvaluationRecord/provinceStatis/downloadImportTemplate";
let url =
"/governance/provinceEvaluationRecord/provinceStatis/downloadImportTemplate";
let params = {};
await this.$http({
method: "get",
@ -343,9 +547,12 @@ export default {
});
const formData = new FormData(); //FormDataappend('key', value)
formData.append("file", file.file); //
formData.append("orgCategory",than.formData.orgCategoryCode); //
formData.append("orgCategory", than.formData.orgCategoryCode); //
await this.$http
.post(`/governance/provinceEvaluationRecord/importDataByExcel`, formData)
.post(
`/governance/provinceEvaluationRecord/importDataByExcel`,
formData
)
.then((res) => {
console.log("res-up", res);
if (res.data.code == 0 && res.data.msg == "success") {
@ -357,9 +564,11 @@ export default {
.catch((err) => {
console.log("失败", err);
file.onError(); //
this.$message.error('导入失败')
this.$message.error("导入失败");
});
},
handleCurrentChange() {},
handleSizeChange() {},
//
resetSearch() {
this.formData = {};
@ -367,17 +576,17 @@ export default {
},
},
activated() {
this.handleWindowResize()
this.handleWindowResize();
},
props: {},
};
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
@import "@/assets/scss/buttonstyle.scss";
@import "@/assets/scss/modules/management/list-main.scss";
@import "@/assets/scss/modules/shequzhili/event-info.scss";
.div_btn_left>* {
.div_btn_left > * {
margin-right: 10px;
}
@ -389,7 +598,7 @@ export default {
.content_box {
display: flex;
height: 160px;
margin-top: 24px;
margin: 24px 0;
.left {
background: #f7faff;
@ -409,7 +618,6 @@ export default {
width: 50px;
height: 50px;
margin-right: 15px;
}
.left_right,
@ -450,7 +658,6 @@ export default {
border-radius: 5px;
padding: 20px;
box-sizing: border-box;
}
}
}

Loading…
Cancel
Save