|
|
|
@ -6,24 +6,13 @@ import {
|
|
|
|
|
getPersonData,
|
|
|
|
|
} from "@/api/home";
|
|
|
|
|
import { getColorList } from "@/api/taicangpop/new.js";
|
|
|
|
|
const order = [
|
|
|
|
|
"HZ",
|
|
|
|
|
"HL",
|
|
|
|
|
"HO",
|
|
|
|
|
"HF",
|
|
|
|
|
"NZ",
|
|
|
|
|
"NL",
|
|
|
|
|
"NO",
|
|
|
|
|
"NF",
|
|
|
|
|
"户籍",
|
|
|
|
|
"流动",
|
|
|
|
|
"中共党员",
|
|
|
|
|
"帮扶对象",
|
|
|
|
|
"重点人群",
|
|
|
|
|
"退伍军人",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const taicang = {
|
|
|
|
|
state: {
|
|
|
|
|
queryParams: {
|
|
|
|
|
shequId: "",
|
|
|
|
|
xiaoquId: "",
|
|
|
|
|
},
|
|
|
|
|
yjTotal: 0,
|
|
|
|
|
leftColor: {
|
|
|
|
|
HZ: "#008c5e",
|
|
|
|
@ -64,6 +53,10 @@ const taicang = {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mutations: {
|
|
|
|
|
SET_QUERY_PARAMS: (state, query) => {
|
|
|
|
|
state.queryParams.shequId = query.shequId;
|
|
|
|
|
state.queryParams.xiaoquId = query.xiaoquId;
|
|
|
|
|
},
|
|
|
|
|
SET_YJ_TOTAL: (state, total) => {
|
|
|
|
|
state.yjTotal = total;
|
|
|
|
|
},
|
|
|
|
@ -71,8 +64,28 @@ const taicang = {
|
|
|
|
|
state.xiaoquIntroduce = introduce;
|
|
|
|
|
},
|
|
|
|
|
SET_COLOR_LIST: (state, list) => {
|
|
|
|
|
state.colorListL = handleColor(
|
|
|
|
|
list,
|
|
|
|
|
state.colorListL = handleColor(state.colorListL, list);
|
|
|
|
|
},
|
|
|
|
|
CLEAR_COLOR: (state) => {
|
|
|
|
|
let colorListL = [
|
|
|
|
|
{ name: "HZ", house: 0, person: 0 },
|
|
|
|
|
{ name: "HL", house: 0, person: 0 },
|
|
|
|
|
{ name: "HO", house: 0, person: 0 },
|
|
|
|
|
{ name: "HF", house: 0, person: 0 },
|
|
|
|
|
{ name: "NZ", house: 0, person: 0 },
|
|
|
|
|
{ name: "NL", house: 0, person: 0 },
|
|
|
|
|
{ name: "NO", house: 0, person: 0 },
|
|
|
|
|
{ name: "NF", house: 0, person: 0 },
|
|
|
|
|
{ name: "户籍", house: 0, person: 0 },
|
|
|
|
|
{ name: "流动", house: 0, person: 0 },
|
|
|
|
|
{ name: "中共党员", house: 0, person: 0 },
|
|
|
|
|
{ name: "帮扶对象", house: 0, person: 0 },
|
|
|
|
|
{ name: "重点人群", house: 0, person: 0 },
|
|
|
|
|
{ name: "退伍军人", house: 0, person: 0 },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
state.colorListL = resetColor(
|
|
|
|
|
colorListL,
|
|
|
|
|
state.leftColor,
|
|
|
|
|
state.rightTopColor
|
|
|
|
|
);
|
|
|
|
@ -119,7 +132,8 @@ const taicang = {
|
|
|
|
|
/**获取colorList */
|
|
|
|
|
GetcolorList({ commit }, queryParams) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
getColorList().then((res) => {
|
|
|
|
|
commit("CLEAR_COLOR");
|
|
|
|
|
getColorList(queryParams).then((res) => {
|
|
|
|
|
commit("SET_COLOR_LIST", res.data);
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
@ -130,7 +144,7 @@ const taicang = {
|
|
|
|
|
*/
|
|
|
|
|
getThreeCell({ commit }, queryParams) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
getTotaldata().then((res) => {
|
|
|
|
|
getTotaldata(queryParams).then((res) => {
|
|
|
|
|
commit("SET_THREE_CELL", res.data);
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
@ -142,12 +156,14 @@ const taicang = {
|
|
|
|
|
GetPie({ commit }, queryParams) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
if (queryParams.type == "house") {
|
|
|
|
|
echartsData().then((res) => {
|
|
|
|
|
delete queryParams.type;
|
|
|
|
|
echartsData(queryParams).then((res) => {
|
|
|
|
|
commit("SET_PIE", res.data);
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
getPersonData().then((res) => {
|
|
|
|
|
delete queryParams.type;
|
|
|
|
|
getPersonData(queryParams).then((res) => {
|
|
|
|
|
commit("SET_PIE", res.data);
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
@ -157,8 +173,20 @@ const taicang = {
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function handleColor(list, leftColor, rightTopColor) {
|
|
|
|
|
list.map((item) => {
|
|
|
|
|
function handleColor(colorList, list) {
|
|
|
|
|
colorList.map((item) => {
|
|
|
|
|
let index = list.findIndex((it) => it.name == item.name);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
item.house = list[index].house;
|
|
|
|
|
item.person = list[index].person;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return colorList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function resetColor(colorList, leftColor, rightTopColor) {
|
|
|
|
|
colorList.map((item) => {
|
|
|
|
|
let isColor = /^[a-zA-Z]+$/.test(item.name);
|
|
|
|
|
if (isColor) {
|
|
|
|
|
item.color = item.name;
|
|
|
|
@ -170,13 +198,7 @@ function handleColor(list, leftColor, rightTopColor) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
list = list.filter(
|
|
|
|
|
(obj, index, self) => index === self.findIndex((t) => t.name === obj.name)
|
|
|
|
|
);
|
|
|
|
|
list.sort((a, b) => {
|
|
|
|
|
return order.indexOf(a.name) - order.indexOf(b.name);
|
|
|
|
|
});
|
|
|
|
|
return list;
|
|
|
|
|
return colorList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default taicang;
|
|
|
|
|