This commit is contained in:
manchuwork
2025-11-21 14:03:35 +08:00
parent e830b707d8
commit a1ac43d4e1

View File

@@ -5,6 +5,7 @@
// @description 从剪贴板读取JSON数据并自动填写表单
// @author You
// @match https://intraecrm.yw.zj.chinamobile.com/page/newGroupAddCustome*
// @match https://intraecrm.yw.zj.chinamobile.com/page/*/pc/page/changeGroupCustomer*
// @grant none
// ==/UserScript==
@@ -79,7 +80,7 @@
alertBox.style.top = "50%";
alertBox.style.left = "50%";
alertBox.style.transform = "translate(-50%, -50%)";
// 根据消息类型设置不同颜色
if (type === "success") {
alertBox.style.backgroundColor = "#52c41a";
@@ -88,16 +89,16 @@
} else {
alertBox.style.backgroundColor = "#1890ff";
}
alertBox.style.color = "white";
alertBox.style.padding = "10px 20px";
alertBox.style.borderRadius = "4px";
alertBox.style.zIndex = "10001";
alertBox.style.boxShadow = "0 2px 8px rgba(0,0,0,0.15)";
alertBox.style.transition = "opacity 0.3s";
document.body.appendChild(alertBox);
// 2秒后自动关闭
setTimeout(() => {
if (document.body.contains(alertBox)) {
@@ -337,7 +338,7 @@
if (value !== undefined) {
const businessTerm = value;
const endDate = parseEndDate(businessTerm);
// 检查是否需要设置为20年后的日期
if (!endDate || endDate === "9999-01-01" || endDate === "9999-1-1") {
const currentDate = new Date();
@@ -353,18 +354,18 @@
// 添加营业期限解析函数
function parseEndDate(businessTerm) {
if (!businessTerm || typeof businessTerm !== "string") return null;
// 分割"至"前后的日期
const parts = businessTerm.split('至').map(part => part.trim());
if (parts.length < 2) return null;
const endDateStr = parts[1];
// 验证日期格式并补全位数
if (/^\d{4}(-\d{1,2}){2}$/.test(endDateStr)) {
const [year, month, day] = endDateStr.split('-').map(Number);
return `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
}
return null;
}