@ued_fpi/data-visual 1.4.4 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,15 +15,22 @@ const __default__ = {
15
15
  };
16
16
  const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  ...__default__,
18
+ props: {
19
+ url: {
20
+ type: String,
21
+ default: "/ipes-srip-server/api/v4/hazard-source/evaluate/gis/stat"
22
+ }
23
+ },
18
24
  setup(__props) {
25
+ const props = __props;
19
26
  const countData = ref({
20
- special: 0,
21
- keyPoint: 0,
27
+ control: 0,
28
+ focus: 0,
22
29
  general: 0
23
30
  });
24
31
  const countPercent = ref({
25
- specialPercent: 0,
26
- keyPointPercent: 0,
32
+ controlPercent: 0,
33
+ focusPercent: 0,
27
34
  generalPercent: 0
28
35
  });
29
36
  function getShowData(value) {
@@ -33,14 +40,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
40
  try {
34
41
  const res = await requestControl({
35
42
  method: "get",
36
- url: "/ipes-company-epcode-server/api/v2/gis/stat/company-rule-color"
43
+ url: props.url
37
44
  });
38
- const { special, keyPoint, general } = res.data;
45
+ const { control, focus, general } = res.data;
39
46
  countData.value = res.data || {};
40
- const total = special + keyPoint + general;
47
+ const total = control + focus + general;
41
48
  countPercent.value = {
42
- specialPercent: total === 0 ? 0 : special / total * 100,
43
- keyPointPercent: total === 0 ? 0 : keyPoint / total * 100,
49
+ controlPercent: total === 0 ? 0 : control / total * 100,
50
+ focusPercent: total === 0 ? 0 : focus / total * 100,
44
51
  generalPercent: total === 0 ? 100 : general / total * 100
45
52
  };
46
53
  } catch (error) {
@@ -55,20 +62,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
55
62
  createElementVNode("div", _hoisted_2, [
56
63
  _hoisted_3,
57
64
  createElementVNode("div", _hoisted_4, [
58
- createElementVNode("span", null, toDisplayString(getShowData(countData.value.special)) + "家 ", 1),
65
+ createElementVNode("span", null, toDisplayString(getShowData(countData.value.control)) + "家 ", 1),
59
66
  _hoisted_5,
60
- createElementVNode("span", null, toDisplayString(getShowData(countData.value.keyPoint)) + "家 ", 1),
67
+ createElementVNode("span", null, toDisplayString(getShowData(countData.value.focus)) + "家 ", 1),
61
68
  _hoisted_6,
62
69
  createElementVNode("span", null, toDisplayString(getShowData(countData.value.general)) + "家 ", 1)
63
70
  ])
64
71
  ]),
65
72
  createElementVNode("div", _hoisted_7, [
66
73
  createVNode(BarItem, {
67
- percent: countPercent.value.specialPercent,
74
+ percent: countPercent.value.controlPercent,
68
75
  "class-name": "red"
69
76
  }, null, 8, ["percent"]),
70
77
  createVNode(BarItem, {
71
- percent: countPercent.value.keyPointPercent,
78
+ percent: countPercent.value.focusPercent,
72
79
  "class-name": "yellow"
73
80
  }, null, 8, ["percent"]),
74
81
  createVNode(BarItem, {
@@ -1,4 +1,5 @@
1
- import { defineComponent, ref, onMounted, openBlock, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeStyle } from 'vue';
1
+ import { defineComponent, ref, computed, onMounted, openBlock, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeStyle } from 'vue';
2
+ import requestControl from '../../service/request.mjs';
2
3
 
3
4
  const _hoisted_1 = { class: "dv-ipes-dual-prevention-mechanism" };
4
5
  const _hoisted_2 = { class: "name" };
@@ -9,33 +10,52 @@ const __default__ = {
9
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
10
11
  ...__default__,
11
12
  props: {
12
- data: {
13
- type: Object,
14
- default: () => ({
15
- veryGood: null,
16
- good: null,
17
- medium: null,
18
- bad: null,
19
- unconstructed: null
20
- })
13
+ dataList: {
14
+ type: Array,
15
+ default: () => ["excellentCount", "fineCount", "middlingCount", "badCount"]
21
16
  }
22
17
  },
23
18
  setup(__props) {
19
+ const props = __props;
20
+ const data = ref({
21
+ excellentCount: null,
22
+ fineCount: null,
23
+ middlingCount: null,
24
+ badCount: null,
25
+ nodBuildCount: null
26
+ });
24
27
  const levels = ref([
25
- { name: "优", key: "veryGood", color: "--dv-color-success" },
26
- { name: "良", key: "good", color: "--dv-color-warning" },
27
- { name: "中", key: "medium", color: "--dv-color-index" },
28
- { name: "差", key: "bad", color: "--dv-color-danger" },
29
- { name: "未建设", key: "unconstructed", color: "--dv-color-text-primary" }
28
+ { name: "优", key: "excellentCount", color: "--dv-color-success" },
29
+ { name: "良", key: "fineCount", color: "--dv-color-warning" },
30
+ { name: "中", key: "middlingCount", color: "--dv-color-index" },
31
+ { name: "差", key: "badCount", color: "--dv-color-danger" },
32
+ { name: "未建设", key: "nodBuildCount", color: "--dv-color-text-primary" }
30
33
  ]);
34
+ const levelsView = computed(() => {
35
+ return levels.value.filter((item) => {
36
+ return props.dataList.includes(item.key);
37
+ });
38
+ });
31
39
  function getShowData(value) {
32
40
  return value == null || isNaN(+value) ? "--" : value;
33
41
  }
42
+ async function getData() {
43
+ try {
44
+ const res = await requestControl({
45
+ method: "get",
46
+ url: "/ipes-srip-server/api/v4/statistics/mechanism-operation"
47
+ });
48
+ data.value = res.data;
49
+ } catch (error) {
50
+ console.log(error);
51
+ }
52
+ }
34
53
  onMounted(() => {
54
+ getData();
35
55
  });
36
56
  return (_ctx, _cache) => {
37
57
  return openBlock(), createElementBlock("div", _hoisted_1, [
38
- (openBlock(true), createElementBlock(Fragment, null, renderList(levels.value, (item) => {
58
+ (openBlock(true), createElementBlock(Fragment, null, renderList(levelsView.value, (item) => {
39
59
  return openBlock(), createElementBlock("div", {
40
60
  key: item.key,
41
61
  class: "level-item"
@@ -44,7 +64,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
44
64
  createElementVNode("div", {
45
65
  class: "value",
46
66
  style: normalizeStyle({ color: `var(${item.color})` })
47
- }, toDisplayString(getShowData(__props.data[item.key])), 5)
67
+ }, toDisplayString(getShowData(data.value[item.key])), 5)
48
68
  ]);
49
69
  }), 128))
50
70
  ]);
@@ -23,26 +23,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  const colors = ["var(--dv-color-danger)", "var(--dv-color-warning)", "var(--dv-color-index)", "var(--dv-color-success)"];
24
24
  const totalCount = ref(0);
25
25
  const legendData = ref([
26
- {
27
- name: "管委会",
28
- key: "managePeopleNum",
29
- count: 0
30
- },
31
- {
32
- name: "企业",
33
- key: "companyPeopleNum",
34
- count: 0
35
- },
36
- {
37
- name: "第三方",
38
- key: "thirdPeopleNum",
39
- count: 0
40
- },
41
- {
42
- name: "访客",
43
- key: "visitorNum",
44
- count: 0
45
- }
26
+ // {
27
+ // name: '管委会',
28
+ // key: 'managePeopleNum',
29
+ // count: 0
30
+ // },
31
+ // {
32
+ // name: '企业',
33
+ // key: 'companyPeopleNum',
34
+ // count: 0
35
+ // },
36
+ // {
37
+ // name: '第三方',
38
+ // key: 'thirdPeopleNum',
39
+ // count: 0
40
+ // },
41
+ // {
42
+ // name: '访客',
43
+ // key: 'visitorNum',
44
+ // count: 0
45
+ // }
46
46
  ]);
47
47
  const personnelChart = ref();
48
48
  function drawChart(data) {
@@ -99,10 +99,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
99
  url: "/ipes-pcip-server/api/v2/gis/stat-people-online"
100
100
  });
101
101
  const seriesData = [];
102
- legendData.value.forEach((item) => {
103
- item.count = data[item.key] || 0;
104
- seriesData.push([item.name, data[item.key] || 0]);
102
+ const dataList = data?.dataList || [
103
+ // {
104
+ // num: 200,
105
+ // name: '管委会'
106
+ // },
107
+ // {
108
+ // num: 100,
109
+ // name: '1管委会2'
110
+ // }
111
+ ];
112
+ dataList.forEach((item) => {
113
+ seriesData.push([item.name, item.num || 0]);
105
114
  });
115
+ legendData.value = dataList;
106
116
  totalCount.value = data?.total || 0;
107
117
  drawChart(seriesData);
108
118
  } catch (error) {
@@ -140,7 +150,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
140
150
  style: normalizeStyle({ background: colors[index] })
141
151
  }, null, 4),
142
152
  createElementVNode("div", _hoisted_10, toDisplayString(item.name), 1),
143
- createElementVNode("div", _hoisted_11, toDisplayString(item.count || 0), 1)
153
+ createElementVNode("div", _hoisted_11, toDisplayString(item.num || 0), 1)
144
154
  ]);
145
155
  }), 128))
146
156
  ])
@@ -27,7 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
27
  method: "get",
28
28
  url: "/ipes-srip-server/api/v1/vehicle-statistical/car-today"
29
29
  });
30
- basicInfoData.value = res;
30
+ basicInfoData.value = res.data;
31
31
  } catch (error) {
32
32
  console.log(error);
33
33
  }