|
@@ -12,12 +12,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { ref, defineEmits, inject } from 'vue';
|
|
|
+ import { ref, defineEmits, inject, watch, nextTick } from 'vue';
|
|
|
import { getAssetURL } from '/@/utils/ui';
|
|
|
|
|
|
const emit = defineEmits(['showDetail']);
|
|
|
const globalConfig = inject('globalConfig');
|
|
|
-
|
|
|
+ let props = defineProps({
|
|
|
+ warningList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // const iconWarningList = ref([]);
|
|
|
const warningLevel1 = getAssetURL('company/home/point1.png'); // 低风险
|
|
|
const warningLevel2 = getAssetURL('company/home/point2.png'); // 中风险
|
|
|
const warningLevel3 = getAssetURL('company/home/point3.png'); // 高风险
|
|
@@ -156,6 +164,30 @@
|
|
|
function openModal(code, label, leftV, topV) {
|
|
|
emit('showDetail', code, label, leftV, topV);
|
|
|
}
|
|
|
+ watch(
|
|
|
+ () => props.warningList,
|
|
|
+ (newVal: any, oldVal: any) => {
|
|
|
+ let newPointList;
|
|
|
+ if (newVal && oldVal && newVal.length == oldVal.length) {
|
|
|
+ for (let i = 0; i < newVal.length; i++) {
|
|
|
+ if (newVal[i].isWarning !== oldVal[i].isWarning) {
|
|
|
+ if (!newPointList) newPointList = [...pointList.value];
|
|
|
+ const index = (newPointList as []).findIndex((item) => item['code'] === newVal[i]['orgcode']);
|
|
|
+ newPointList[index]['imgSrc'] = newVal[i].isWarning ? warningLevel4 : warningLevel1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ newPointList = [...pointList.value];
|
|
|
+ for (let i = 0; i < newVal.length; i++) {
|
|
|
+ const index = (newPointList as []).findIndex((item) => item['code'] === newVal[i]['orgcode']);
|
|
|
+ newPointList[index]['imgSrc'] = newVal[i].isWarning ? warningLevel4 : warningLevel1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (newPointList) {
|
|
|
+ pointList.value = newPointList;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|