Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
| | |
| | | /** |
| | | * @description 校正windows页面在系统进行缩放后导致页面被放大的问题,通常放大比例是125%、150% |
| | | * **/ |
| | | |
| | | class DevicePixelRatio { |
| | | constructor() { |
| | | this.bodyElement = document.getElementsByTagName('body')[0]; // 缓存 body 元素 |
| | | } |
| | | |
| | | //获取系统类型 |
| | | _getSystem() { |
| | | let flag = false; |
| | | var agent = navigator.userAgent.toLowerCase(); |
| | | if (agent.indexOf("windows") >= 0) { |
| | | return true; |
| | | } |
| | | // 判断是否为 Windows 系统 |
| | | isWindowsSystem() { |
| | | const agent = navigator.userAgent.toLowerCase(); |
| | | return agent.indexOf("windows") >= 0; |
| | | } |
| | | |
| | | //获取页面缩放比例 |
| | | _addHandler(element, type, handler) { |
| | | // 通用事件绑定工具 |
| | | addHandler(element, type, handler) { |
| | | if (element.addEventListener) { |
| | | element.addEventListener(type, handler, false); |
| | | } else if (element.attachEvent) { |
| | |
| | | } |
| | | |
| | | //校正浏览器缩放比例 |
| | | _correct() { |
| | | let t = this; |
| | | //页面devicePixelRatio(设备像素比例)变化后,计算页面body标签zoom修改其大小,来抵消devicePixelRatio带来的变化。 |
| | | document.getElementsByTagName('body')[0].style.zoom = 1 / window.devicePixelRatio; |
| | | correctZoom() { |
| | | if (this.bodyElement) { |
| | | // 使用 1 / window.devicePixelRatio 来调整 zoom |
| | | this.bodyElement.style.zoom = 1 / window.devicePixelRatio; |
| | | } |
| | | } |
| | | |
| | | //监听页面缩放 |
| | | _watch() { |
| | | let t = this; |
| | | t._addHandler(window, 'resize', function () { //注意这个方法是解决全局有两个window.resize |
| | | //重新校正 |
| | | t._correct() |
| | | }) |
| | | // 监听页面缩放(使用防抖优化) |
| | | watchResize() { |
| | | let timer = null; |
| | | this.addHandler(window, 'resize', () => { |
| | | if (timer) clearTimeout(timer); |
| | | timer = setTimeout(() => { |
| | | this.correctZoom(); |
| | | }, 200); // 延迟 200ms 执行,避免频繁触发 |
| | | }); |
| | | } |
| | | |
| | | //初始化页面比例 |
| | | // 初始化页面比例校正 |
| | | init() { |
| | | let t = this; |
| | | if (t._getSystem()) { //判断设备,目前只在windows系统下校正浏览器缩放比例 |
| | | //初始化页面校正浏览器缩放比例 |
| | | t._correct(); |
| | | //开启监听页面缩放 |
| | | t._watch(); |
| | | if (this.isWindowsSystem()) { |
| | | // 初始化校正 |
| | | this.correctZoom(); |
| | | // 开启监听 |
| | | this.watchResize(); |
| | | } |
| | | } |
| | | } |
| | |
| | | }; |
| | | const handlePageChange2 = (newPage) => { |
| | | currentPage2.value = newPage; |
| | | fetchFlowBind(currentRow.projectNumber, currentRow.layer, currentPage2.value); |
| | | fetchFlowBind(currentRow.flowCardId, currentPage2.value); |
| | | }; |
| | | const handleMessage = (data) => { |
| | | try { |
| | |
| | | // 缺片详情 |
| | | const handleBindRack = (row) => { |
| | | currentPage2.value = 1; |
| | | const { projectNumber, layer } = row; |
| | | currentRow.projectNumber = row.projectNumber; |
| | | const { flowCardId } = row; |
| | | currentRow.flowCardId = row.flowCardId; |
| | | dialogFormVisibleb.value = true; |
| | | fetchFlowBind(projectNumber, layer,currentPage2.value); |
| | | fetchFlowBind(flowCardId,currentPage2.value); |
| | | }; |
| | | // 领取任务 |
| | | const handletake = (row) => { |
| | |
| | | }; |
| | | }); |
| | | }; |
| | | const fetchFlowBind = async (flowCardId, layer, page) => { |
| | | const fetchFlowBind = async (flowCardId, page) => { |
| | | try { |
| | | var url="/hollowGlass/hollowGlassRelationInfo/queryLackByFlowCard?flowCardId="+flowCardId + "&layer=" + layer; |
| | | var url="/hollowGlass/hollowGlassRelationInfo/queryLackByFlowCard?flowCardId="+flowCardId + "&layer=" + 1; |
| | | const response = await request.post(url) |
| | | if (response.code == 200) { |
| | | tableDatac.value = response.data[page]; |
| | |
| | | }; |
| | | const handlePageChange2 = (newPage) => { |
| | | currentPage2.value = newPage; |
| | | fetchFlowBind(currentRow.projectNumber, currentRow.layer, currentPage2.value); |
| | | fetchFlowBind(currentRow.flowCardId, currentPage2.value); |
| | | }; |
| | | const handleMessage = (data) => { |
| | | try { |
| | |
| | | // 缺片详情 |
| | | const handleBindRack = (row) => { |
| | | currentPage2.value = 1; |
| | | const { projectNumber, layer } = row; |
| | | currentRow.projectNumber = row.projectNumber; |
| | | const { flowCardId} = row; |
| | | currentRow.flowCardId = row.flowCardId; |
| | | dialogFormVisibleb.value = true; |
| | | fetchFlowBind(projectNumber, layer,currentPage2.value); |
| | | fetchFlowBind(flowCardId, currentPage2.value); |
| | | }; |
| | | // 领取任务 |
| | | const handletake = (row) => { |
| | |
| | | }; |
| | | }); |
| | | }; |
| | | const fetchFlowBind = async (flowCardId, layer, page) => { |
| | | const fetchFlowBind = async (flowCardId, page) => { |
| | | try { |
| | | var url="/hollowGlass/hollowGlassRelationInfo/queryLackByFlowCard?flowCardId="+flowCardId + "&layer=" + layer; |
| | | var url="/hollowGlass/hollowGlassRelationInfo/queryLackByFlowCard?flowCardId="+flowCardId + "&layer=" + 1; |
| | | const response = await request.post(url) |
| | | if (response.code == 200) { |
| | | tableDatac.value = response.data[page]; |
| | |
| | | }; |
| | | const handlePageChange2 = (newPage) => { |
| | | currentPage2.value = newPage; |
| | | fetchFlowBind(currentRow.projectNumber, currentRow.layer, currentPage2.value); |
| | | fetchFlowBind(currentRow.flowCardId, currentPage2.value); |
| | | }; |
| | | const handleMessage = (data) => { |
| | | try { |
| | |
| | | // 缺片详情 |
| | | const handleBindRack = (row) => { |
| | | currentPage2.value = 1; |
| | | const { projectNumber, layer } = row; |
| | | currentRow.projectNumber = row.projectNumber; |
| | | const { flowCardId } = row; |
| | | currentRow.flowCardId = row.flowCardId; |
| | | dialogFormVisibleb.value = true; |
| | | fetchFlowBind(projectNumber, layer,currentPage2.value); |
| | | fetchFlowBind(flowCardId,currentPage2.value); |
| | | }; |
| | | // 领取任务 |
| | | const handletake = (row) => { |
| | |
| | | }; |
| | | }); |
| | | }; |
| | | const fetchFlowBind = async (flowCardId, layer, page) => { |
| | | const fetchFlowBind = async (flowCardId, page) => { |
| | | try { |
| | | var url="/hollowGlass/hollowGlassRelationInfo/queryLackByFlowCard?flowCardId="+flowCardId + "&layer=" + layer; |
| | | var url="/hollowGlass/hollowGlassRelationInfo/queryLackByFlowCard?flowCardId="+flowCardId + "&layer=" + 1; |
| | | const response = await request.post(url) |
| | | if (response.code == 200) { |
| | | tableDatac.value = response.data[page]; |