Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
ERP 供应商搜索工具脚本信息
基本信息
功能描述
该脚本是一个为ERP系统设计的供应商搜索工具,提供了以下核心功能:
1. 浮动搜索窗口
2. 窗口交互功能
3. 供应商搜索功能
4. 供应商备注获取
5. 表格复制按钮
6. 自动选择表格行
技术实现
1. 界面构建
// 创建搜索容器 const searchContainer = document.createElement('div'); searchContainer.style.cssText = ` position: fixed; top: 10px; right: auto; z-index: 9999; display: flex; flex-direction: column; gap: 0; background: white; padding: 0; border: 2px solid #4A90E2; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); user-select: none; font-family: Arial, sans-serif; `;2. 拖拽实现
dragHeader.addEventListener('mousedown', (e) => { isDragging = true; startX = e.clientX - searchContainer.offsetLeft; startY = e.clientY - searchContainer.offsetTop; searchContainer.style.zIndex = '10000'; // 拖动时提高层级 // 如果窗口处于折叠状态,先展开 if (isCollapsed) { expandWindow(); } });3. 边缘吸附检查
function checkEdgeSnap() { const threshold = 10; // 距离边缘的阈值 const currentLeft = parseInt(searchContainer.style.left); const currentTop = parseInt(searchContainer.style.top); // 保存原始位置 originalPosition = { left: searchContainer.style.left, top: searchContainer.style.top }; openStatePosition = { left: searchContainer.style.left, top: searchContainer.style.top }; // 检查是否靠近左侧边缘 if (currentLeft <= threshold) { collapseWindow('left'); } // 检查是否靠近右侧边缘 else if (currentLeft >= window.innerWidth - searchContainer.offsetWidth - threshold) { collapseWindow('right'); } }4. 数据持久化
// 保存位置到本地存储 const position = { left: searchContainer.style.left, top: searchContainer.style.top }; localStorage.setItem('erpSearchPosition', JSON.stringify(position)); // 保存折叠状态 const collapseState = { isCollapsed: true, side: edge, position: collapseStatePosition }; localStorage.setItem('erpSearchCollapseState', JSON.stringify(collapseState));5. API调用
// 发送供应商搜索请求 const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify(requestData), credentials: 'include' // 包含cookie });使用说明
注意事项
更新日志
版本 2.3:修复供应商名称处理
/[()()][^()()]*新[^()()]*[()()]/gi版本 2.2:优化复制按钮功能
版本 2.1:OpenUserJS平台适配
版本 2.0:增强功能版本
版本 1.0:核心功能完善
版本 0.1:初始版本发布
ERP 退货单据图片上传工具脚本信息
基本信息
功能描述
该脚本是一个为ERP系统设计的退货单据图片上传工具,提供了以下核心功能:
1. 浮动图片上传窗口
2. 窗口交互功能
3. 图片拖放上传
4. 自动输入和搜索
5. 自动选择表格行
6. 质检报告创建和图片上传
技术实现
1. 界面构建
// 创建可拖动的悬浮窗口 function createDragWindow() { const dragWindow = document.createElement('div'); dragWindow.id = 'image-drag-window'; dragWindow.innerHTML = ` <div class="drag-header"> <span>退货单据上传</span> </div> <div class="drag-content"> <div class="drop-area"> <p>将图片拖放到此处</p> <p class="hint">支持 PNG、JPG、GIF 格式</p> </div> </div> `; // 添加CSS样式和事件监听 // ... }2. 拖放功能实现
// 处理文件拖放 function handleDrop(e) { const dt = e.dataTransfer; const files = dt.files; processFiles(files); }3. 自动输入和搜索
// 自动输入退货单号并点击搜索按钮 async function autoInputAndSearch(ioId) { // 查找并填充退货单号输入框 // 点击搜索按钮 // ... }4. 自动选择表格行
// 独立的行选择和复选框勾选函数 function selectFirstRowAndCheckbox(doc) { // 查找表格 // 识别表头和数据行 // 选择并勾选第一行 // ... }5. API调用和数据处理
// 发送HTTP请求获取SKU数据 async function fetchSkuData(returnOrderId, orderId) { // 构建请求URL和参数 // 发送请求并处理响应 // ... }使用说明
注意事项
更新日志
版本 1.2:增强功能版本
版本 1.1:OpenUserJS平台适配
版本 1.0:初始版本发布