Merge branch 'dev' of http://60.209.125.238:20010/lijingjia/ds-wms-client-web into dev
commit
71a9af34d9
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* @Desc: 水印hooks
|
||||
* @Author: lijj
|
||||
* @Date: 2024-11-14 09:57:21
|
||||
*/
|
||||
const domSymbol = Symbol('watermark-dom')
|
||||
|
||||
export function useWatermark(
|
||||
op = 0.15,
|
||||
appendEl: HTMLElement | null = document.body
|
||||
) {
|
||||
let func: any = () => {}
|
||||
const id = domSymbol.toString()
|
||||
const clear = () => {
|
||||
const domId = document.getElementById(id)
|
||||
if (domId) {
|
||||
const el = appendEl
|
||||
el && el.removeChild(domId)
|
||||
}
|
||||
window.removeEventListener('resize', func)
|
||||
}
|
||||
const createWatermark = (str: string) => {
|
||||
clear()
|
||||
|
||||
const can = document.createElement('canvas')
|
||||
can.width = 300
|
||||
can.height = 240
|
||||
|
||||
const cans = can.getContext('2d')
|
||||
if (cans) {
|
||||
cans.rotate((-25 * Math.PI) / 120)
|
||||
cans.font = '15px Vedana'
|
||||
cans.fillStyle = `rgba(0, 0, 0, ${op})`
|
||||
cans.textAlign = 'left'
|
||||
cans.textBaseline = 'middle'
|
||||
cans.fillText(str, can.width / 20, can.height)
|
||||
}
|
||||
|
||||
const div = document.createElement('div')
|
||||
div.id = id
|
||||
div.style.pointerEvents = 'none'
|
||||
div.style.top = '0px'
|
||||
div.style.left = '0px'
|
||||
div.style.position = 'absolute'
|
||||
div.style.zIndex = '100000000'
|
||||
div.style.width = document.documentElement.clientWidth + 'px'
|
||||
div.style.height = document.documentElement.clientHeight - 80 + 'px'
|
||||
div.style.background =
|
||||
'url(' + can.toDataURL('image/png') + ') left top repeat'
|
||||
const el = appendEl
|
||||
el && el.appendChild(div)
|
||||
return id
|
||||
}
|
||||
|
||||
function setWatermark(str: string) {
|
||||
createWatermark(str)
|
||||
func = () => {
|
||||
createWatermark(str)
|
||||
}
|
||||
window.addEventListener('resize', func)
|
||||
}
|
||||
|
||||
return { setWatermark, clear }
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
[
|
||||
{ "label": "船公司", "value": "isCarrier" },
|
||||
{ "label": "订舱口", "value": "isBooking" },
|
||||
{ "label": "场站", "value": "isYard" },
|
||||
{ "label": "车队", "value": "isTruck" },
|
||||
{ "label": "委托单位", "value": "isController" },
|
||||
{ "label": "报关行", "value": "isCustom" },
|
||||
{ "label": "代理(国外)", "value": "isAgent" },
|
||||
{ "label": "代理(国内)", "value": "isAgentCn" },
|
||||
{ "label": "快递公司", "value": "isExpress" },
|
||||
{ "label": "航空公司", "value": "isAirLines" },
|
||||
{ "label": "国外发货人", "value": "isShipper" },
|
||||
{ "label": "通知人", "value": "isNotifyParty" },
|
||||
{ "label": "仓库", "value": "isWareHouse" },
|
||||
{ "label": "码头", "value": "isWharf" },
|
||||
{ "label": "保险公司", "value": "isInsurer" },
|
||||
{ "label": "租箱公司", "value": "isLeasing" },
|
||||
{ "label": "贸易代理", "value": "isTradingAgency" },
|
||||
{ "label": "其他", "value": "isOther" },
|
||||
{ "label": "船代", "value": "isShipAgency" },
|
||||
{ "label": "经营单位", "value": "isEnterprise" },
|
||||
{ "label": "国内发货人", "value": "isShipperCn" }
|
||||
]
|
Loading…
Reference in New Issue