Commit d86b433a authored by 沈翠玲's avatar 沈翠玲

增加定时器

parent 8264bac4
......@@ -43,7 +43,11 @@ class RequestClient {
this.instance.interceptors.request.use(
(config) => {
if (window.location.href.includes('data-screen')) {
} else {
showLoading()
}
if (config.cancel == null) {
config.cancel = true;
}
......@@ -65,7 +69,11 @@ class RequestClient {
this.instance.interceptors.response.use(
(response) => {
if (window.location.href.includes('data-screen')) {
} else {
hideLoading()
}
const { data, config } = response;
axiosCanceler.removePending(config);
const userStore = useUserStore();
......@@ -104,7 +112,11 @@ class RequestClient {
return data;
},
(error) => {
if (window.location.href.includes('data-screen')) {
} else {
hideLoading()
}
const { response } = error;
// 请求超时 && 网络错误单独判断,没有 response
if (error.message.indexOf('timeout') !== -1)
......
......@@ -14,6 +14,8 @@ const router = useRouter();
import { computed } from "vue";
import { reactive, ref } from 'vue';
const salvProName =ref([]);
const load =ref(false);
const timer =ref(null);
const salvProValue =ref([]);
const dataZoom =ref({
startValue: 0,
......@@ -153,14 +155,21 @@ const param = {}
if (!props.isAdmin) {
param['tenant'] = props.tenantId
}
getReturn(param).then(res => {
const query = () => {
load.value = true
getReturn(param).then(res => {
if(res.result) {
const arr = res.result
arr.sort((a,b) => b.totalReturn - a.totalReturn)
salvProName.value = arr.map(v => v.name)
salvProValue.value = arr.map(v => ({name: v.name,value: v.totalReturn, tenantId: v.tenantId}))
load.value = false
if (salvProName.value.length > 6) {
const timer = setInterval(() => {
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
timer.value = setInterval(() => {
dataZoom.value.startValue++;
if (dataZoom.value.endValue++ >= salvProName.value.length - 1) {
dataZoom.value.startValue = 0;
......@@ -171,7 +180,15 @@ getReturn(param).then(res => {
}
}
})
})
}
query()
setInterval(() => {
if (!load.value) {
query()
}
}, 3000)
</script>
<style lang="scss" scoped>
.echarts {
......
......@@ -21,6 +21,7 @@ import tooltip from './tooltip.vue'
import { reactive, ref } from 'vue';
const mapData = ref([]);
const EChartsRef = ref();
const load =ref(false);
const tenantPos = ref([]);
onMounted(() => {
......@@ -90,9 +91,12 @@ const onClick = (e) => {
}
}
echarts.registerMap("china", mapJson);
getMapByTenant().then(res => {
const query = () => {
load.value = true
getMapByTenant().then(res => {
mapData.value = []
if (res.result) {
load.value = false
res.result.forEach(element => {
const findindex = mapData.value.findIndex(item => item.name === element.province)
if (findindex === -1) {
......@@ -109,9 +113,16 @@ getMapByTenant().then(res => {
});
}
EChartsRef.value.draw()
}).catch(() => {
}).catch(() => {
mapData.value = []
})
})
}
query()
setInterval(() => {
if (!load.value) {
query()
}
}, 3000)
// var geoCoordMap = {
// 台湾: [121.5135, 25.0308],
// 哈尔滨: [127.9688, 45.368],
......
......@@ -11,7 +11,8 @@ import echarts from "@/components/ECharts/config";
import { getReturnRateByPlatform } from '@/api/dataScreen';
import { computed } from "vue";
import { reactive, ref } from 'vue';
const load =ref(false);
const timer =ref(null);
const salvProName =ref([]);
const salvProValue =ref([]);
const dataZoom =ref({
......@@ -138,18 +139,26 @@ const option = computed(() => {
]
}
})
const param = {}
const query =() => {
const param = {}
if (!props.isAdmin) {
param['tenant'] = props.tenantId
}
load.value = true
getReturnRateByPlatform(param).then(res => {
if (res.result) {
const arr = res.result
arr.sort((a,b) => b.rate - a.rate)
load.value = false
salvProName.value = arr.map(v => v.loanPlatform)
salvProValue.value = arr.map(v => v.rate?.toFixed(2))
if (salvProName.value.length > 6) {
const timer = setInterval(() => {
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
timer.value = setInterval(() => {
dataZoom.value.startValue++;
if (dataZoom.value.endValue++ >= salvProName.value.length - 1) {
dataZoom.value.startValue = 0;
......@@ -159,7 +168,14 @@ getReturnRateByPlatform(param).then(res => {
}, 3000);
}
}
})
})
}
query()
setInterval(() => {
if (!load.value) {
query()
}
}, 3000)
</script>
<style lang="scss" scoped>
.echarts {
......
......@@ -11,6 +11,7 @@ import ECharts from "@/components/ECharts/index.vue";
import echarts from "@/components/ECharts/config";
import { reactive, ref, computed } from 'vue';
import { getFourFollowTypeTotal } from '@/api/dataScreen';
const load =ref(false);
const salvPro =ref([]);
const { FollowStatus } = useDict("FollowStatus");
const props = defineProps({
......@@ -68,11 +69,21 @@ echarts.graphic.registerShape('CubeTop', CubeTop)
const param = {
tenant: props.tenantId
}
getFourFollowTypeTotal(param).then(res => {
const query =() => {
load.value = true
getFourFollowTypeTotal(param).then(res => {
if(res.result) {
load.value = false
salvPro.value = res.result.map(v => ({name: v.followType, value: v.tractNum, flowStatusTotalList: v.flowStatusTotalList}))
}
})
})
}
query()
setInterval(() => {
if (!load.value) {
query()
}
}, 3000)
const option = computed(() => {
......
......@@ -13,6 +13,7 @@ import { getTractRecordThirtyDayTotal, getTractRecordDayHoursTotal } from '@/api
import echarts from "@/components/ECharts/config";
import ECharts from "@/components/ECharts/index.vue";
const { FollowStatus } = useDict("FollowStatus");
const load =ref(false);
const props = defineProps({
dayActiveName: String,
......@@ -27,12 +28,14 @@ const query = () => {
if (props.tenant !== '全部') {
param['tenantId'] = props.tenant
}
load.value = true
getTractRecordThirtyDayTotal(param).then(res => {
if (res.result) {
res.result.reverse()
datas.value = res.result.map(v => ({value: v.num, name: v.time, flowStatusTotalList: v.flowStatusTotalList}))
dates.value = res.result.map(v => v.time)
}
load.value = false
}).catch(() => {
datas.value = []
dates.value = []
......@@ -42,11 +45,13 @@ const query = () => {
if (props.tenant !== '全部') {
param['tenantId'] = props.tenant
}
load.value = true
getTractRecordDayHoursTotal(param).then(res => {
if (res.result) {
datas.value = res.result.map(v => ({value: v.num, name: v.time, flowStatusTotalList: v.flowStatusTotalList}))
dates.value = res.result.map(v => v.time)
}
load.value = false
}).catch(() => {
datas.value = []
dates.value = []
......@@ -56,6 +61,11 @@ const query = () => {
}
query()
setInterval(() => {
if (!load.value) {
query()
}
}, 3000)
watch(
() => props.dayActiveName,
(newValue, oldValue) => {
......
......@@ -125,6 +125,7 @@ const isAdmin = ref(false);
const tenant = ref('全部');
const tenantId = ref();
// userStore.tenant.id
const load =ref(false);
if (authButtonListGet.includes('admin_screen') && !route.query.tenantId) {
isAdmin.value = true
......@@ -180,27 +181,39 @@ const resize = () => {
dataScreenRef.value.style.transform = `scale(${getScale()}) translate(-50%, -50%)`;
}
};
const params = {}
if (!isAdmin.value) {
params['tenant'] = tenantId.value
}
getLoanKanBanTotal(params).then(res=> {
if (res.success) {
staticNumber.value = res.result
}
})
// 根据浏览器大小推断缩放比例
const getScale = (width = 1920, height = 1080) => {
let ww = window.innerWidth / width;
let wh = window.innerHeight / height;
return ww < wh ? ww : wh;
};
getTenantPage({ current: 1, size: 9999999, status: 'enable', tenantType:'mediate' }).then(res => {
const query =() => {
load.value = true
getTenantPage({ current: 1, size: 9999999, status: 'enable', tenantType:'mediate' }).then(res => {
if (res.success) {
load.value = false
Tenantlist.value = res.result.content
Tenantlist.value.unshift({name: '全部', id: '全部'})
}
})
})
const params = {}
if (!isAdmin.value) {
params['tenant'] = tenantId.value
}
getLoanKanBanTotal(params).then(res=> {
if (res.success) {
staticNumber.value = res.result
}
})
}
query()
setInterval(() => {
if (!load.value) {
query()
}
}, 3000)
// 获取当前时间
let timer = null;
let time = ref(dayjs().format("YYYY年MM月DD HH:mm:ss"));
......
......@@ -55,9 +55,9 @@ export default defineConfig(({ command, mode }) => {
port: VITE_PORT,
proxy: {
'/api': {
// target: 'http://192.168.31.189:8080',
target: 'http://192.168.31.188:8080',
// target: 'http://192.168.31.128:8080',
target: 'http://8.152.205.9:8080',
// target: 'http://8.152.205.9:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
......
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