数据对接
Showing
2 changed files
with
158 additions
and
30 deletions
| ... | @@ -97,6 +97,7 @@ import * as api from "@/apiPc/common" | ... | @@ -97,6 +97,7 @@ import * as api from "@/apiPc/common" |
| 97 | import {onMounted, ref} from 'vue' | 97 | import {onMounted, ref} from 'vue' |
| 98 | import {dayjs} from 'element-plus' | 98 | import {dayjs} from 'element-plus' |
| 99 | import {getYS001, getYS002, getYS003, getYS004, getYS005} from '@/api/server.js' | 99 | import {getYS001, getYS002, getYS003, getYS004, getYS005} from '@/api/server.js' |
| 100 | import {getLocalList} from "/@/apiPc/local"; | ||
| 100 | 101 | ||
| 101 | 102 | ||
| 102 | const dataItems = ref([]); | 103 | const dataItems = ref([]); |
| ... | @@ -178,7 +179,106 @@ async function handelGetYS003() { | ... | @@ -178,7 +179,106 @@ async function handelGetYS003() { |
| 178 | 179 | ||
| 179 | async function handelGetYS004() { | 180 | async function handelGetYS004() { |
| 180 | const res = await getYS004() | 181 | const res = await getYS004() |
| 181 | handelZhu4(res.data.blockgroup[0], res.data.blockgroup[1]) | 182 | console.log(res) |
| 183 | // let arrList = res.data.blockgroup | ||
| 184 | let arrList = [ | ||
| 185 | { | ||
| 186 | BLOCK: '海上', | ||
| 187 | list: [ | ||
| 188 | { | ||
| 189 | BASE: '上海', | ||
| 190 | DAYS: '6', | ||
| 191 | DSO: '20' | ||
| 192 | }, | ||
| 193 | { | ||
| 194 | BASE: '浙江', | ||
| 195 | DAYS: '3', | ||
| 196 | DSO: '202' | ||
| 197 | }, | ||
| 198 | { | ||
| 199 | BASE: '青岛', | ||
| 200 | DAYS: '61', | ||
| 201 | DSO: '230' | ||
| 202 | } | ||
| 203 | ] | ||
| 204 | }, | ||
| 205 | { | ||
| 206 | BLOCK: '陆地', | ||
| 207 | list: [ | ||
| 208 | { | ||
| 209 | BASE: '合肥', | ||
| 210 | DAYS: '61', | ||
| 211 | DSO: '20' | ||
| 212 | }, | ||
| 213 | { | ||
| 214 | BASE: '北京', | ||
| 215 | DAYS: '33', | ||
| 216 | DSO: '202' | ||
| 217 | }, | ||
| 218 | { | ||
| 219 | BASE: '河南', | ||
| 220 | DAYS: '61', | ||
| 221 | DSO: '230' | ||
| 222 | } | ||
| 223 | ] | ||
| 224 | } | ||
| 225 | ] | ||
| 226 | let haishang | ||
| 227 | let dalu | ||
| 228 | for (const v of arrList) { | ||
| 229 | if (v.BLOCK === '海上') { | ||
| 230 | haishang = v | ||
| 231 | } else { | ||
| 232 | dalu = v | ||
| 233 | } | ||
| 234 | } | ||
| 235 | let haishangArr = haishang.list.map(v => ({ | ||
| 236 | ...v, | ||
| 237 | type: 1 | ||
| 238 | })) | ||
| 239 | let daluArr = dalu.list.map(v => ({ | ||
| 240 | ...v, | ||
| 241 | type: 2 | ||
| 242 | })) | ||
| 243 | |||
| 244 | let arr = [...haishangArr, ...daluArr] | ||
| 245 | let listX = arr.map(v => v.BASE) | ||
| 246 | |||
| 247 | let styleItem1 = { | ||
| 248 | color: { | ||
| 249 | type: 'linear', | ||
| 250 | x: 0, y: 0, x2: 1, y2: 1, // 垂直渐变 | ||
| 251 | colorStops: [ | ||
| 252 | {offset: 0, color: 'rgba(21, 219, 203, 1)'}, // 顶部颜色 | ||
| 253 | {offset: 1, color: 'rgba(106, 235, 228, 1)'} // 底部颜色 | ||
| 254 | ] | ||
| 255 | }, | ||
| 256 | borderColor: 'rgba(0, 255, 190, 1)', | ||
| 257 | borderWidth: 1 | ||
| 258 | } | ||
| 259 | let styleItem2 = { | ||
| 260 | color: { | ||
| 261 | type: 'linear', | ||
| 262 | x: 0, y: 0, x2: 1, y2: 1, // 垂直渐变 | ||
| 263 | colorStops: [ | ||
| 264 | {offset: 0, color: 'rgba(0, 168, 255, 1)'}, // 顶部颜色 | ||
| 265 | {offset: 1, color: 'rgba(77, 197, 243, 1)'} // 底部颜色 | ||
| 266 | ] | ||
| 267 | }, | ||
| 268 | borderColor: 'rgba(0, 255, 190, 1)', | ||
| 269 | borderWidth: 1 | ||
| 270 | } | ||
| 271 | |||
| 272 | let dataList = arr.map(v => ({ | ||
| 273 | value: v.DSO, | ||
| 274 | itemStyle: v.type == 2 ? styleItem1 : styleItem2, | ||
| 275 | name: v.type == 2 ? "陆地" : '海上' | ||
| 276 | })) | ||
| 277 | |||
| 278 | let listHai = arr.map(v => v.type === 1 ? v.DSO : 0) | ||
| 279 | let listLu = arr.map(v => v.type === 2 ? v.DSO : 0) | ||
| 280 | |||
| 281 | handelZhu4(listX, dataList) | ||
| 182 | } | 282 | } |
| 183 | 283 | ||
| 184 | async function handelGetYS005() { | 284 | async function handelGetYS005() { |
| ... | @@ -856,26 +956,26 @@ const handelZhu3 = (row1, row2) => { | ... | @@ -856,26 +956,26 @@ const handelZhu3 = (row1, row2) => { |
| 856 | chart33.setOption(option) | 956 | chart33.setOption(option) |
| 857 | autoHover(chart33, option, 0, 2000) | 957 | autoHover(chart33, option, 0, 2000) |
| 858 | } | 958 | } |
| 859 | const handelZhu4 = (row1, row2) => { | 959 | const handelZhu4 = (listX, dataList) => { |
| 860 | let name1 = row1.BLOCK | 960 | // let name1 = row1.BLOCK |
| 861 | let name2 = row2.BLOCK | 961 | // let name2 = row2.BLOCK |
| 862 | 962 | // console.log(name1, name2) | |
| 863 | let x1 = row1.list.forEach(val => val.type = 1) || [] | 963 | // let x1 = row1.list.forEach(val => val.type = 1) || [] |
| 864 | let x2 = row2.list.forEach(val => val.type = 2) || [] | 964 | // let x2 = row2.list.forEach(val => val.type = 2) || [] |
| 865 | let list = [...x1, ...x2].map(val => val.BASE) | 965 | // let list = [...x1, ...x2].map(val => val.BASE) |
| 866 | let listX = [] | 966 | // let listX = [] |
| 867 | let listL = [] | 967 | // let listL = [] |
| 868 | let listH = [] | 968 | // let listH = [] |
| 869 | for (const val of list) { | 969 | // for (const val of list) { |
| 870 | listX.push(val.BASE) | 970 | // listX.push(val.BASE) |
| 871 | if (val.type == 1) { | 971 | // if (val.type == 1) { |
| 872 | listL.push(val.DSO) | 972 | // listL.push(val.DSO) |
| 873 | listH.push(0) | 973 | // listH.push(0) |
| 874 | } else { | 974 | // } else { |
| 875 | listL.push(0) | 975 | // listL.push(0) |
| 876 | listH.push(val.DSO) | 976 | // listH.push(val.DSO) |
| 877 | } | 977 | // } |
| 878 | } | 978 | // } |
| 879 | 979 | ||
| 880 | chart44 = echarts.init(zhuRef4.value) | 980 | chart44 = echarts.init(zhuRef4.value) |
| 881 | const option = { | 981 | const option = { |
| ... | @@ -928,14 +1028,14 @@ const handelZhu4 = (row1, row2) => { | ... | @@ -928,14 +1028,14 @@ const handelZhu4 = (row1, row2) => { |
| 928 | ], | 1028 | ], |
| 929 | series: [ | 1029 | series: [ |
| 930 | { | 1030 | { |
| 931 | name: name1, | 1031 | name: '陆地', |
| 932 | type: 'bar', | 1032 | type: 'bar', |
| 933 | barGap: 0, | 1033 | barGap: 0, |
| 934 | emphasis: { | 1034 | emphasis: { |
| 935 | focus: 'series' | 1035 | focus: 'series' |
| 936 | }, | 1036 | }, |
| 937 | // data: [320, 332, 301, 334, 390, 330, 320, 320, 332, 301, 334, 390], | 1037 | // data: [320, 332, 301, 334, 390, 330, 320, 320, 332, 301, 334, 390], |
| 938 | data: listL, | 1038 | data: dataList, |
| 939 | itemStyle: { | 1039 | itemStyle: { |
| 940 | color: { | 1040 | color: { |
| 941 | type: 'linear', | 1041 | type: 'linear', |
| ... | @@ -951,14 +1051,14 @@ const handelZhu4 = (row1, row2) => { | ... | @@ -951,14 +1051,14 @@ const handelZhu4 = (row1, row2) => { |
| 951 | barWidth: '30%', | 1051 | barWidth: '30%', |
| 952 | }, | 1052 | }, |
| 953 | { | 1053 | { |
| 954 | name: name2, | 1054 | name: '海上', |
| 955 | type: 'bar', | 1055 | type: 'bar', |
| 956 | barGap: 0, | 1056 | barGap: 0, |
| 957 | emphasis: { | 1057 | emphasis: { |
| 958 | focus: 'series' | 1058 | focus: 'series' |
| 959 | }, | 1059 | }, |
| 960 | // data: [30, 332, 301, 334, 390, 330, 320, 320, 332, 301, 334, 390], | 1060 | // data: [30, 332, 301, 334, 390, 330, 320, 320, 332, 301, 334, 390], |
| 961 | data: listH, | 1061 | // data: listHai, |
| 962 | itemStyle: { | 1062 | itemStyle: { |
| 963 | color: { | 1063 | color: { |
| 964 | type: 'linear', | 1064 | type: 'linear', | ... | ... |
| ... | @@ -22,8 +22,16 @@ | ... | @@ -22,8 +22,16 @@ |
| 22 | </el-select> | 22 | </el-select> |
| 23 | </div> | 23 | </div> |
| 24 | <div class="itemBox"> | 24 | <div class="itemBox"> |
| 25 | <el-select v-model="queryParams.select2" class="select" placeholder="数据因素(可多选)" size="small"> | 25 | <el-select |
| 26 | <el-option label="数据因素(可多选)" value="month"/> | 26 | v-model="type1" |
| 27 | class="select" | ||
| 28 | collapse-tags | ||
| 29 | multiple | ||
| 30 | placeholder="数据因素" | ||
| 31 | size="small" | ||
| 32 | @change="handelSelect1"> | ||
| 33 | <el-option label="收入" value="1"/> | ||
| 34 | <el-option label="应收账款余额" value="2"/> | ||
| 27 | </el-select> | 35 | </el-select> |
| 28 | </div> | 36 | </div> |
| 29 | </div> | 37 | </div> |
| ... | @@ -74,6 +82,7 @@ const radioB = ref('month') | ... | @@ -74,6 +82,7 @@ const radioB = ref('month') |
| 74 | 82 | ||
| 75 | const type3 = ref('0') | 83 | const type3 = ref('0') |
| 76 | const type2 = ref([]) | 84 | const type2 = ref([]) |
| 85 | const type1 = ref(['1', '2']) | ||
| 77 | 86 | ||
| 78 | const list = ref([]) | 87 | const list = ref([]) |
| 79 | 88 | ||
| ... | @@ -133,7 +142,6 @@ async function handelGetYS006() { | ... | @@ -133,7 +142,6 @@ async function handelGetYS006() { |
| 133 | s2.value[i2] += v2.LASTINCOME || 0; | 142 | s2.value[i2] += v2.LASTINCOME || 0; |
| 134 | s3.value[i2] += v2.LASTYSBALANCE || 0; | 143 | s3.value[i2] += v2.LASTYSBALANCE || 0; |
| 135 | s4.value[i2] += v2.YSBALANCE || 0; | 144 | s4.value[i2] += v2.YSBALANCE || 0; |
| 136 | |||
| 137 | } | 145 | } |
| 138 | } | 146 | } |
| 139 | 147 | ||
| ... | @@ -159,10 +167,24 @@ async function handelGetYS006() { | ... | @@ -159,10 +167,24 @@ async function handelGetYS006() { |
| 159 | // | 167 | // |
| 160 | 168 | ||
| 161 | setA(set1.value) | 169 | setA(set1.value) |
| 162 | setB(s1.value, s2.value, s3.value, s4.value) | 170 | setB( |
| 171 | type1.value.includes('1') ? s1.value : [], | ||
| 172 | type1.value.includes('1') ? s2.value : [], | ||
| 173 | type1.value.includes('2') ? s3.value : [], | ||
| 174 | type1.value.includes('2') ? s4.value : [] | ||
| 175 | ) | ||
| 163 | setC(h1.value, h2.value, h3.value) | 176 | setC(h1.value, h2.value, h3.value) |
| 164 | } | 177 | } |
| 165 | 178 | ||
| 179 | function handelSelect1() { | ||
| 180 | setB( | ||
| 181 | type1.value.includes('1') ? s1.value : [], | ||
| 182 | type1.value.includes('1') ? s2.value : [], | ||
| 183 | type1.value.includes('2') ? s3.value : [], | ||
| 184 | type1.value.includes('2') ? s4.value : [] | ||
| 185 | ) | ||
| 186 | } | ||
| 187 | |||
| 166 | function handelSelect2() { | 188 | function handelSelect2() { |
| 167 | console.log(type2.value) | 189 | console.log(type2.value) |
| 168 | let arr = type2.value.map(val => list.value.find(item => item.BASE === val)) | 190 | let arr = type2.value.map(val => list.value.find(item => item.BASE === val)) |
| ... | @@ -175,7 +197,13 @@ function handelSelect2() { | ... | @@ -175,7 +197,13 @@ function handelSelect2() { |
| 175 | s4.value[i2] += v2.YSBALANCE || 0; | 197 | s4.value[i2] += v2.YSBALANCE || 0; |
| 176 | } | 198 | } |
| 177 | } | 199 | } |
| 178 | setB(s1.value, s2.value, s3.value, s4.value) | 200 | |
| 201 | setB( | ||
| 202 | type1.value.includes('1') ? s1.value : [], | ||
| 203 | type1.value.includes('1') ? s2.value : [], | ||
| 204 | type1.value.includes('2') ? s3.value : [], | ||
| 205 | type1.value.includes('2') ? s4.value : [] | ||
| 206 | ) | ||
| 179 | } | 207 | } |
| 180 | 208 | ||
| 181 | function handelSelect3() { | 209 | function handelSelect3() { | ... | ... |
-
Please register or sign in to post a comment