528071db by zhangmeng

看板

1 parent 0c42ffc8
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 placeholder="全部基地" 18 placeholder="全部基地"
19 size="small" 19 size="small"
20 @change="handelSelect2"> 20 @change="handelSelect2">
21 <el-option v-for="val in list" :key="val.BASE" :label="val.BASE" :value="val.BASE"/> 21 <el-option v-for="val in list" :key="val.BASE" :label="val.BASEJC" :value="val.BASEJC"/>
22 </el-select> 22 </el-select>
23 </div> 23 </div>
24 <div class="itemBox"> 24 <div class="itemBox">
...@@ -82,6 +82,8 @@ const type1 = ref(['1', '2']) ...@@ -82,6 +82,8 @@ const type1 = ref(['1', '2'])
82 const list = ref([]) 82 const list = ref([])
83 83
84 const set1 = ref([]) 84 const set1 = ref([])
85 const set2 = ref([])
86 const set3 = ref([])
85 87
86 const s1 = ref([]) 88 const s1 = ref([])
87 const s2 = ref([]) 89 const s2 = ref([])
...@@ -114,6 +116,8 @@ async function handelGetYS006() { ...@@ -114,6 +116,8 @@ async function handelGetYS006() {
114 const res = await getYS006() 116 const res = await getYS006()
115 list.value = res.data.baselist 117 list.value = res.data.baselist
116 set1.value = [] 118 set1.value = []
119 set2.value = []
120 set3.value = []
117 s1.value = new Array(12).fill(0) 121 s1.value = new Array(12).fill(0)
118 s2.value = new Array(12).fill(0) 122 s2.value = new Array(12).fill(0)
119 s3.value = new Array(12).fill(0) 123 s3.value = new Array(12).fill(0)
...@@ -126,9 +130,24 @@ async function handelGetYS006() { ...@@ -126,9 +130,24 @@ async function handelGetYS006() {
126 for (const v1 of list.value) { 130 for (const v1 of list.value) {
127 set1.value.push({ 131 set1.value.push({
128 value: v1.TOTAL, 132 value: v1.TOTAL,
129 name: v1.BASE 133 name: v1.BASEJC,
134 type: v1.BLOCK
135 })
136 if (v1.BLOCK == '海上') {
137 set2.value.push({
138 value: v1.TOTAL,
139 name: v1.BASEJC,
140 type: v1.BLOCK
130 }) 141 })
131 type2.value.push(v1.BASE) 142 } else {
143 set3.value.push({
144 value: v1.TOTAL,
145 name: v1.BASEJC,
146 type: v1.BLOCK
147 })
148 }
149
150 type2.value.push(v1.BASEJC)
132 for (const v2 of v1.list) { 151 for (const v2 of v1.list) {
133 const i2 = v2.MONTH - 1; // 转为 0~11 的索引 152 const i2 = v2.MONTH - 1; // 转为 0~11 的索引
134 h1.value[i2] += v2.YSDSK / 10000 || 0; 153 h1.value[i2] += v2.YSDSK / 10000 || 0;
...@@ -162,7 +181,7 @@ async function handelGetYS006() { ...@@ -162,7 +181,7 @@ async function handelGetYS006() {
162 // } 181 // }
163 // 182 //
164 183
165 setA(set1.value) 184 setA(set1.value, set2.value, set3.value)
166 setB( 185 setB(
167 type1.value.includes('1') ? s1.value : [], 186 type1.value.includes('1') ? s1.value : [],
168 type1.value.includes('1') ? s2.value : [], 187 type1.value.includes('1') ? s2.value : [],
...@@ -182,7 +201,7 @@ function handelSelect1() { ...@@ -182,7 +201,7 @@ function handelSelect1() {
182 } 201 }
183 202
184 function handelSelect2() { 203 function handelSelect2() {
185 let arr = type2.value.map(val => list.value.find(item => item.BASE === val)) 204 let arr = type2.value.map(val => list.value.find(item => item.BASEJC === val))
186 for (const v1 of arr) { 205 for (const v1 of arr) {
187 for (const v2 of v1.list) { 206 for (const v2 of v1.list) {
188 const i2 = v2.MONTH - 1; // 转为 0~11 的索引 207 const i2 = v2.MONTH - 1; // 转为 0~11 的索引
...@@ -278,7 +297,7 @@ const getBdata = () => { ...@@ -278,7 +297,7 @@ const getBdata = () => {
278 }) 297 })
279 } 298 }
280 299
281 const setA = (arr) => { 300 const setA = (arr, arr2, arr3) => {
282 chartA = echarts.init(zhuRef.value) 301 chartA = echarts.init(zhuRef.value)
283 const option = { 302 const option = {
284 tooltip: { 303 tooltip: {
...@@ -292,9 +311,11 @@ const setA = (arr) => { ...@@ -292,9 +311,11 @@ const setA = (arr) => {
292 fontSize: 12, // 文字大小 311 fontSize: 12, // 文字大小
293 } 312 }
294 }, 313 },
295 legend: { 314 legend: [
315 {
296 orient: 'vertical', 316 orient: 'vertical',
297 right: 20, 317 data: arr2,
318 right: '5%',
298 top: '12%', 319 top: '12%',
299 bottom: 20, 320 bottom: 20,
300 textStyle: { 321 textStyle: {
...@@ -314,6 +335,30 @@ const setA = (arr) => { ...@@ -314,6 +335,30 @@ const setA = (arr) => {
314 return name + ' ' + num2; 335 return name + ' ' + num2;
315 }, 336 },
316 }, 337 },
338 {
339 orient: 'vertical',
340 data: arr3,
341 right: '30%',
342 top: '12%',
343 bottom: 20,
344 textStyle: {
345 color: '#FFF'
346 },
347 formatter: function (name) {
348 let value = 0
349 for (let i = 0; i < option.series[2].data?.length; i++) {
350 if (option.series[2].data[i].name === name) {
351 value = option.series[2].data[i].value;
352 break;
353 }
354 }
355 // 计算百分比
356 let num1 = ((value / option.series[2].data.reduce((a, b) => a + b.value, 0)) * 100).toFixed(2);
357 let num2 = num1 > 0 ? num1 + '%' : 0 + '%'
358 return name + ' ' + num2;
359 },
360 }
361 ],
317 series: [ 362 series: [
318 { 363 {
319 type: 'pie', 364 type: 'pie',
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!