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