update:大屏调整

This commit is contained in:
zk
2024-01-22 15:49:00 +08:00
parent 84dfa935ea
commit 5cf32ce40e
16 changed files with 298 additions and 138 deletions
@@ -10,7 +10,10 @@
import ItemD from '/@/components/item-d/item-d.vue';
import { getWatchDataByOrgCode } from '/@/components/secondaryScreen/commonApi.ts';
import { useSpin } from '/@/components/body-d-left/bodyLeftHooks.ts';
import { useSession, caching } from '/@/hooks/autoRefresh/caching.ts';
const { setSession, getSession } = useSession();
const { PAGE2_LEFT } = caching;
const { spinning, setSpin } = useSpin();
const dataList = ref([
{
@@ -74,23 +77,32 @@
});
async function init() {
const { code, result } = await getWatchDataByOrgCode(props);
// debugger;
if (code == 200) {
let data = cloneDeep(dataList.value);
data.forEach((item) => {
let resData = result.find((v) => v.type == item.type);
item.userCount = resData.userCount;
item.data.forEach((val) => {
val.value = resData[val.key];
});
});
dataList.value = data;
setSpin(!spinning.value);
setSpin(true);
try {
const { code, result } = await getWatchDataByOrgCode(props);
if (code == 200) {
setValue(result);
setSession(PAGE2_LEFT, JSON.stringify(result));
}
} catch {
const result = JSON.parse(getSession(PAGE2_LEFT));
setValue(result);
}
}
function setValue(result) {
setSpin(false);
let data = cloneDeep(dataList.value);
data.forEach((item) => {
let resData = result.find((v) => v.type == item.type);
item.userCount = resData.userCount;
item.data.forEach((val) => {
val.value = resData[val.key];
});
});
dataList.value = data;
}
defineExpose({
init,
});