1
This commit is contained in:
@@ -1,179 +0,0 @@
|
||||
/// ===================== 大屏宽高自定义(百度搜索结果) ============================
|
||||
import {
|
||||
getCurrentInstance,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
const screenWidth = ref(null)
|
||||
const screenHeight = ref(null)
|
||||
onMounted(() => {
|
||||
proxy.$nextTick(() => {
|
||||
// 监控屏幕尺寸变化
|
||||
var bodyStyle = document.createElement('style')
|
||||
// 这里根据具体的设计稿尺寸来定
|
||||
bodyStyle.innerHTML = `body{width:1920px; height:1080px!important;}`
|
||||
document.documentElement.firstElementChild.appendChild(bodyStyle)
|
||||
screenWidth.value = document.body.clientWidth
|
||||
screenHeight.value = document.body.clientHeight
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
screenWidth.value = document.documentElement.clientWidth
|
||||
screenHeight.value = document.documentElement.clientHeight
|
||||
})()
|
||||
}
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.code == 'F11') {
|
||||
screenWidth.value = document.documentElement.clientWidth
|
||||
screenHeight.value = document.documentElement.clientHeight
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
watch(
|
||||
screenWidth,
|
||||
(newValue, oldValue) => {
|
||||
// console.log("val", val);
|
||||
let docWidth = document.documentElement.clientWidth
|
||||
let docHeight = document.documentElement.clientHeight
|
||||
var designWidth = 1920, // 这里根据具体的设计稿尺寸来定
|
||||
designHeight = 1080, // 这里根据具体的设计稿尺寸来定
|
||||
widthRatio = docWidth / designWidth,
|
||||
heightRatio = docHeight / designHeight
|
||||
document.body.style =
|
||||
`transform:scale(${widthRatio},${heightRatio});transform-origin:left top;overflow: hidden;`
|
||||
// 应对浏览器全屏切换前后窗口因短暂滚动条问题出现未占满情况
|
||||
setTimeout(function() {
|
||||
var lateWidth = document.documentElement.clientWidth,
|
||||
lateHeight = document.documentElement.clientHeight
|
||||
if (lateWidth === docWidth) return
|
||||
|
||||
widthRatio = lateWidth / designWidth
|
||||
heightRatio = lateHeight / designHeight
|
||||
document.body.style = 'transform:scale(' + widthRatio + ',' + heightRatio +
|
||||
');transform-origin:left top;overflow: hidden;'
|
||||
}, 0)
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
watch(
|
||||
screenHeight,
|
||||
(newValue, oldValue) => {
|
||||
// console.log("val", val);
|
||||
let docWidth = document.documentElement.clientWidth
|
||||
let docHeight = document.documentElement.clientHeight
|
||||
var designWidth = 1920, // 这里根据具体的设计稿尺寸来定
|
||||
designHeight = 1080, // 这里根据具体的设计稿尺寸来定
|
||||
widthRatio = docWidth / designWidth,
|
||||
heightRatio = docHeight / designHeight
|
||||
document.body.style =
|
||||
`transform:scale(${widthRatio},${heightRatio});transform-origin:left top;overflow: hidden;`
|
||||
// 应对浏览器全屏切换前后窗口因短暂滚动条问题出现未占满情况
|
||||
setTimeout(function() {
|
||||
var lateWidth = document.documentElement.clientWidth,
|
||||
lateHeight = document.documentElement.clientHeight
|
||||
if (lateWidth === docWidth) return
|
||||
|
||||
widthRatio = lateWidth / designWidth
|
||||
heightRatio = lateHeight / designHeight
|
||||
document.body.style = 'transform:scale(' + widthRatio + ',' + heightRatio +
|
||||
');transform-origin:left top;overflow: hidden;'
|
||||
}, 0)
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
window.addEventListener('resize', () => {
|
||||
window.location.reload()
|
||||
})
|
||||
/// ================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// ===================== AI智能优化自适应结果(1.0) ===========================
|
||||
import {
|
||||
getCurrentInstance,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref
|
||||
} from 'vue';
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
const screenWidth = ref(null);
|
||||
const screenHeight = ref(null);
|
||||
const resizeObserver = new ResizeObserver((entries) => {
|
||||
if (entries.length > 0) {
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = entries[0].contentRect;
|
||||
// 更新屏幕尺寸
|
||||
screenWidth.value = width;
|
||||
screenHeight.value = height;
|
||||
|
||||
// 调用debounce函数
|
||||
updateStyleDebounced();
|
||||
}
|
||||
});
|
||||
// debounce函数
|
||||
const resizeTimeout = ref(null);
|
||||
|
||||
function debounce(func, wait) {
|
||||
return function() {
|
||||
clearTimeout(resizeTimeout.value);
|
||||
resizeTimeout.value = setTimeout(func, wait);
|
||||
};
|
||||
}
|
||||
// 用于更新页面的transform样式
|
||||
function updateStyle() {
|
||||
const docWidth = document.documentElement.clientWidth;
|
||||
const docHeight = document.documentElement.clientHeight;
|
||||
const designWidth = 1920; // 设计稿宽度
|
||||
const designHeight = 1080; // 设计稿高度
|
||||
const widthRatio = docWidth / designWidth;
|
||||
const heightRatio = docHeight / designHeight;
|
||||
document.body.style.transform = `scale(${widthRatio},${heightRatio})`;
|
||||
document.body.style.transformOrigin = 'left top';
|
||||
document.body.style.overflow = 'hidden';
|
||||
// 处理浏览器全屏切换前后窗口因短暂滚动条问题出现未占满情况
|
||||
setTimeout(function() {
|
||||
const lateWidth = document.documentElement.clientWidth;
|
||||
const lateHeight = document.documentElement.clientHeight;
|
||||
if (lateWidth !== docWidth) {
|
||||
const lateWidthRatio = lateWidth / designWidth;
|
||||
const lateHeightRatio = lateHeight / designHeight;
|
||||
document.body.style.transform = `scale(${lateWidthRatio},${lateHeightRatio})`;
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
const updateStyleDebounced = debounce(updateStyle, 150);
|
||||
onMounted(() => {
|
||||
proxy.$nextTick(() => {
|
||||
// 监控屏幕尺寸变化
|
||||
resizeObserver.observe(document.documentElement);
|
||||
|
||||
// 初始化屏幕尺寸
|
||||
screenWidth.value = document.documentElement.clientWidth;
|
||||
screenHeight.value = document.documentElement.clientHeight;
|
||||
});
|
||||
});
|
||||
onUnmounted(() => {
|
||||
// 清除监听
|
||||
resizeObserver.disconnect();
|
||||
// 清除debounce函数中设置的timeout
|
||||
clearTimeout(resizeTimeout.value);
|
||||
// resizeObserver.unobserve(document.documentElement);
|
||||
});
|
||||
|
||||
/// ===============================================================
|
||||
@@ -496,7 +496,6 @@ export default {
|
||||
data.isShowDetail = isShowDetail
|
||||
let fileName = this.reportType_options[this.search.reportType].label + (isShowDetail ? '-缺陷详情' : '-日生产报表') + '.xlsx'
|
||||
downloadStatisticsTableExcel(data).then((res) => {
|
||||
console.log(res)
|
||||
let blobURL = URL.createObjectURL(res.data)
|
||||
//创建标签
|
||||
let link = document.createElement('a')
|
||||
|
||||
Reference in New Issue
Block a user