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

增加定时器

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