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

大屏增加动态变化

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