Commit 0682c3eb authored by 沈翠玲's avatar 沈翠玲

大屏增加动态变化

parent 0dcaefb2
......@@ -45,7 +45,6 @@
const draw = () => {
if (chartInstance.value) {
console.log('props.option', props.option);
chartInstance.value.setOption(props.option);
}
};
......
......@@ -9,6 +9,7 @@ export const useUserStore = defineStore({
userInfo: null,
isTenant: false, // 是否操作了调解中心
tenant: null, // 当前调解中心
time: null, // 本地时间
}),
getters: {
getUserTenants() {
......@@ -26,6 +27,9 @@ export const useUserStore = defineStore({
setToken(token) {
this.token = token;
},
setTime(time) {
this.time = time;
},
// Set setUserInfo
setUserInfo(userInfo) {
this.userInfo = userInfo;
......
......@@ -15,9 +15,11 @@
<script setup>
import { getSecurityTotal } from '@/api/dataScreenMock';
import dayjs from 'dayjs';
import { useUserStore } from '@/stores/modules/user';
import { reactive, ref, watch, computed, onBeforeUnmount } from 'vue';
const load = ref(false);
const timer1 = ref();
const userStore = useUserStore();
const datas = ref({});
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
......@@ -25,27 +27,22 @@
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => {
load.value = true;
getSecurityTotal().then(res=> {
load.value = false;
if (res.success && res.result && res.result.length) {
datas.value.securityDays = (datas.value.securityDays || res.result[0].securityDays) + getRandomIntInclusive(0, 1)
datas.value.interceptAttackDays = (datas.value.interceptAttackDays || res.result[0].interceptAttackDays) + getRandomIntInclusive(0, 3)
datas.value.securityDays = dayjs().diff('2025-03-28', 'day')
if (dayjs(userStore.time).format('mm:ss') === '00:00' || !datas.value.interceptAttackDays) {
if (!datas.value.interceptAttackDays) {
datas.value.interceptAttackDays = 78
} else {
datas.value.interceptAttackDays = datas.value.interceptAttackDays + getRandomIntInclusive(10, 30)
}
})
}
}
query();
timer1.value = setInterval(() => {
watch(() => userStore.time, () => {
if (!load.value) {
query();
}
}, 6000);
onBeforeUnmount(() => {
if (timer1.value) {
clearInterval(timer1.value);
timer1.value = null;
}
});
})
</script>
<style lang="scss" scoped>
.box {
......
......@@ -6,13 +6,14 @@
</template>
<script setup>
import dayjs from 'dayjs';
import ECharts from '@/components/ECharts/index.vue';
import echarts from '@/components/ECharts/config';
import { getAISecurityTotal } from '@/api/dataScreenMock';
import { useUserStore } from '@/stores/modules/user';
import { reactive, ref, watch, computed, onBeforeUnmount } from 'vue';
const userStore = useUserStore();
const load = ref(false);
const timer1 = ref();
const datas = ref([]);
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
......@@ -20,26 +21,38 @@
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => {
load.value = true;
getAISecurityTotal().then(res=> {
load.value = false;
if (res.success) {
res.result.forEach(v => {
const num = (v.total + getRandomIntInclusive(-10, 20))
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal + getRandomIntInclusive(-10, 50))
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = res.result
}
})
if ((dayjs(userStore.time).diff('2025-03-28 10:00:00', 'day') % 30 === 0 && dayjs(userStore.time).format('HH:mm:ss') === '10:00:00') || !datas.value || !datas.value.length) {
load.value = true;
getAISecurityTotal().then(res=> {
load.value = false;
if (res.success) {
if(datas.value && datas.value.length) {
datas.value.forEach(v => {
const num = (v.total + getRandomIntInclusive(0, 20))
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal + getRandomIntInclusive(0, 20))
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = datas.value
} else {
datas.value.forEach(v => {
const num = (v.total)
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal)
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = res.result
}
}
})
}
}
onBeforeUnmount(() => {
if (timer1.value) {
clearInterval(timer1.value);
timer1.value = null;
watch(() => userStore.time, () => {
if (!load.value) {
query();
}
});
})
const option = computed(() => {
return {
tooltip: {},
......@@ -214,11 +227,6 @@
};
});
query();
timer1.value = setInterval(() => {
if (!load.value) {
query();
}
}, 6000);
</script>
<style lang="scss" scoped>
.echarts {
......
......@@ -49,7 +49,6 @@
label: {
normal: {
formatter: (a) => {
console.log('sadsa4444', a);
let html = '';
html += a.name + '\n' + a.seriesName + ':' + a.data.value+ '%';
return html;
......
......@@ -195,7 +195,7 @@
}
const num = Number(number);
if (num > 100000000) {
return Decimal(num).div(Decimal(100000000)).toNumber().toFixed(2) + '亿';
return Decimal(num).div(Decimal(100000000)).toNumber().toFixed(3) + '亿';
} else if (num > 10000) {
return Decimal(num).div(Decimal(10000)).toNumber().toFixed(2) + '万';
} else if (num > 1000) {
......@@ -249,7 +249,9 @@
}
getLoanKanBanTotal(params).then((res) => {
if (res.success) {
staticNumber.value = res.result;
staticNumber.value.caseNum = res.result.caseNum;
staticNumber.value.amount = res.result.amount;
staticNumber.value.borrowerNum = res.result.borrowerNum;
}
});
};
......@@ -264,6 +266,15 @@
let time = ref(dayjs().format('YYYY年MM月DD HH:mm:ss'));
timer = setInterval(() => {
time.value = dayjs().format('YYYY年MM月DD HH:mm:ss');
let timest = dayjs().valueOf();
userStore.setTime(timest);
if (dayjs(timest).diff('2025-03-28 10:00:00', 'day') % 7 === 0 && dayjs(timest).format('HH:mm:ss') === '10:00:00' && staticNumber.value.sumRepayTotal) {
staticNumber.value.sumRepayTotal = staticNumber.value.sumRepayTotal + ( staticNumber.value.sumRepayTotal * 0.0001)
staticNumber.value.rate = staticNumber.value.rate + 0.1
} else if (!staticNumber.value.sumRepayTotal){
staticNumber.value.sumRepayTotal = 122600000
staticNumber.value.rate = 0.52
}
}, 1000);
onBeforeUnmount(() => {
......
......@@ -15,6 +15,7 @@
<script setup>
import { getSecurityTotal } from '@/api/dataScreenMock';
import dayjs from 'dayjs';
import { reactive, ref, watch, computed, onBeforeUnmount } from 'vue';
const load = ref(false);
const timer1 = ref();
......@@ -25,21 +26,19 @@
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => {
load.value = true;
getSecurityTotal().then(res=> {
load.value = false;
if (res.success && res.result && res.result.length) {
datas.value.securityDays = (datas.value.securityDays || res.result[0].securityDays) + getRandomIntInclusive(0, 1)
datas.value.interceptAttackDays = (datas.value.interceptAttackDays || res.result[0].interceptAttackDays) + getRandomIntInclusive(0, 3)
}
})
datas.value.securityDays = dayjs().diff('2025-03-28', 'day')
if (!datas.value.interceptAttackDays) {
datas.value.interceptAttackDays = 78
} else {
datas.value.interceptAttackDays = datas.value.interceptAttackDays + getRandomIntInclusive(10, 30)
}
}
query();
timer1.value = setInterval(() => {
if (!load.value) {
query();
}
}, 6000);
}, 3600000);
onBeforeUnmount(() => {
if (timer1.value) {
clearInterval(timer1.value);
......
......@@ -8,10 +8,12 @@
<script setup>
import ECharts from '@/components/ECharts/index.vue';
import echarts from '@/components/ECharts/config';
import dayjs from 'dayjs';
import { getAISecurityTotal } from '@/api/dataScreenMock';
import { useUserStore } from '@/stores/modules/user';
import { reactive, ref, watch, computed, onBeforeUnmount } from 'vue';
const userStore = useUserStore();
const load = ref(false);
const timer1 = ref();
const datas = ref([]);
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
......@@ -19,26 +21,33 @@
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => {
load.value = true;
getAISecurityTotal().then(res=> {
load.value = false;
if (res.success) {
res.result.forEach(v => {
const num = (v.total + getRandomIntInclusive(-10, 20))
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal + getRandomIntInclusive(-10, 50))
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = res.result
}
})
}
onBeforeUnmount(() => {
if (timer1.value) {
clearInterval(timer1.value);
timer1.value = null;
if ((dayjs(userStore.time).diff('2025-03-28 10:00:00', 'day') % 30 === 0 && dayjs(userStore.time).format('HH:mm:ss') === '10:00:00') || !datas.value || !datas.value.length) {
load.value = true;
getAISecurityTotal().then(res=> {
load.value = false;
if (res.success) {
if(datas.value && datas.value.length) {
datas.value.forEach(v => {
const num = (v.total + getRandomIntInclusive(0, 20))
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal + getRandomIntInclusive(0, 20))
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = datas.value
} else {
datas.value.forEach(v => {
const num = (v.total)
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal)
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = res.result
}
}
})
}
});
}
const option = computed(() => {
return {
tooltip: {},
......@@ -213,11 +222,11 @@
};
});
query();
timer1.value = setInterval(() => {
watch(() => userStore.time, () => {
if (!load.value) {
query();
}
}, 6000);
})
</script>
<style lang="scss" scoped>
.echarts {
......
......@@ -263,6 +263,8 @@
let time = ref(dayjs().format('YYYY年MM月DD HH:mm:ss'));
timer = setInterval(() => {
time.value = dayjs().format('YYYY年MM月DD HH:mm:ss');
let timest = dayjs().valueOf();
userStore.setTime(timest);
}, 1000);
onBeforeUnmount(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment