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

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

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

Loading…
Cancel
Save