136 lines
5.9 KiB
JavaScript
136 lines
5.9 KiB
JavaScript
(function runJs() {
|
||
function findReact(dom, traverseUp = 0) {
|
||
const key = Object.keys(dom).find(key => {
|
||
return key.startsWith("__reactFiber$")
|
||
|| key.startsWith("__reactInternalInstance$")
|
||
|| key.startsWith("__reactEventHandlers$");
|
||
});
|
||
const domFiber = dom[key];
|
||
if (domFiber == null) return null;
|
||
if (domFiber._currentElement) {
|
||
let compFiber = domFiber._currentElement._owner;
|
||
for (let i = 0; i < traverseUp; i++) {
|
||
compFiber = compFiber._currentElement._owner;
|
||
}
|
||
return compFiber._instance;
|
||
}
|
||
const GetCompFiber = fiber => {
|
||
let parentFiber = fiber.return;
|
||
while (typeof parentFiber.type == "string") {
|
||
parentFiber = parentFiber.return;
|
||
}
|
||
return parentFiber;
|
||
};
|
||
let compFiber = GetCompFiber(domFiber);
|
||
for (let i = 0; i < traverseUp; i++) {
|
||
compFiber = GetCompFiber(compFiber);
|
||
}
|
||
return compFiber.stateNode;
|
||
}
|
||
|
||
let currentYear = new Date().getFullYear();
|
||
let currentMonth = new Date().getMonth() + 1;
|
||
let currentDate = new Date().getDate();
|
||
|
||
let month = prompt("请输入月份(1-12):", currentMonth);
|
||
let day = prompt("请输入日期(1-31):", currentDate);
|
||
|
||
let dateInput = new Date(currentYear, month - 1, day);
|
||
|
||
let year = dateInput.getFullYear();
|
||
let formattedMonth = ("0" + (dateInput.getMonth() + 1)).slice(-2);
|
||
let formattedDay = ("0" + dateInput.getDate()).slice(-2);
|
||
|
||
let date = year + "-" + formattedMonth + "-" + formattedDay;
|
||
|
||
let todate = date + " 23:00";
|
||
let fromDate = date + " 08:00";
|
||
let wf = WeFormSDK.getWeFormInstance();
|
||
wf.changeFieldValue("100003720000000607", {value: fromDate});
|
||
wf.changeFieldValue("100003720000000609", {value: todate});
|
||
wf.changeFieldValue("100003720000030038", {value: '0'});
|
||
wf.changeFieldValue("100003720000000611", {value: "外出技术支持"});
|
||
wf.changeFieldValue("100003720000008715", {value: '2'});
|
||
wf.changeFieldValue("877132351682273302", {value: '1'});
|
||
let workflowTitleObj = document.querySelector('.weapp-form-flowpage-content-FlowPageSysFieldReqName input');
|
||
let workflowTitle = workflowTitleObj.value;
|
||
let newValue = workflowTitle.substring(0, workflowTitle.length - 5) + formattedMonth + "-" + formattedDay;
|
||
workflowTitleObj.setAttribute("value", newValue);
|
||
workflowTitleObj.value = newValue;
|
||
let input = findReact(workflowTitleObj);
|
||
input.props.onChange(newValue);
|
||
const container = document.getElementById("widget_100003720000000664");
|
||
const svgIcon = container.querySelector(".associative-search-icon svg");
|
||
if (svgIcon) {
|
||
svgIcon.dispatchEvent(new MouseEvent('click', {
|
||
bubbles: true,
|
||
cancelable: true,
|
||
view: window
|
||
}));
|
||
}
|
||
let closeTab = window.close;
|
||
window.close = () => {
|
||
window.open('/sp/workflow/flowpage/fullCreate/100003460000000746?workflowId=100003460000000746&isCreate=1', "_blank");
|
||
closeTab()
|
||
}
|
||
})()
|
||
|
||
(function runJs() {
|
||
function findReact(dom, traverseUp = 0) {
|
||
const key = Object.keys(dom).find(key => {
|
||
return key.startsWith("__reactFiber$")
|
||
|| key.startsWith("__reactInternalInstance$")
|
||
|| key.startsWith("__reactEventHandlers$");
|
||
});
|
||
const domFiber = dom[key];
|
||
if (domFiber == null) return null;
|
||
if (domFiber._currentElement) {
|
||
let compFiber = domFiber._currentElement._owner;
|
||
for (let i = 0; i < traverseUp; i++) {
|
||
compFiber = compFiber._currentElement._owner;
|
||
}
|
||
return compFiber._instance;
|
||
}
|
||
const GetCompFiber = fiber => {
|
||
let parentFiber = fiber.return;
|
||
while (typeof parentFiber.type == "string") {
|
||
parentFiber = parentFiber.return;
|
||
}
|
||
return parentFiber;
|
||
};
|
||
let compFiber = GetCompFiber(domFiber);
|
||
for (let i = 0; i < traverseUp; i++) {
|
||
compFiber = GetCompFiber(compFiber);
|
||
}
|
||
return compFiber.stateNode;
|
||
}
|
||
|
||
let currentYear = new Date().getFullYear();
|
||
let currentMonth = new Date().getMonth() + 1;
|
||
let currentDate = new Date().getDate();
|
||
let month = prompt("请输入月份(1-12):", currentMonth);
|
||
let day = prompt("请输入日期(1-31):", currentDate);
|
||
let dateInput = new Date(currentYear, month - 1, day);
|
||
let year = dateInput.getFullYear();
|
||
let formattedMonth = ("0" + (dateInput.getMonth() + 1)).slice(-2);
|
||
let formattedDay = ("0" + dateInput.getDate()).slice(-2);
|
||
let date = year + "-" + formattedMonth + "-" + formattedDay;
|
||
let todate = date + " 23:00";
|
||
let fromDate = date + " 08:00";
|
||
let wf = WeFormSDK.getWeFormInstance();
|
||
wf.changeFieldValue("100003720000000607", {value: fromDate});
|
||
wf.changeFieldValue("100003720000000609", {value: todate});
|
||
wf.changeFieldValue("100003720000030038", {value: '0'});
|
||
wf.changeFieldValue("100003720000000611", {value: "外出技术支持"});
|
||
wf.changeFieldValue("100003720000008715", {value: '4'});
|
||
wf.changeFieldValue("877132351682273302", {value: '1'});
|
||
let workflowTitleObj = document.querySelector('.weapp-form-flowpage-content-FlowPageSysFieldReqName input');
|
||
let workflowTitle = workflowTitleObj.value;
|
||
let newValue = workflowTitle.substring(0, workflowTitle.length - 5) + formattedMonth + "-" + formattedDay;
|
||
workflowTitleObj.setAttribute("value", newValue);
|
||
workflowTitleObj.value = newValue;
|
||
let input = findReact(workflowTitleObj);
|
||
input.props.onChange(newValue);
|
||
window.open("/sp/workflow/flowpage/fullCreate/100003460000000746?workflowId=100003460000000746&isCreate=1", "_blank");
|
||
document.querySelector("button[weid='3rdcst_oxa9w7_i8bbvp_vc1wev_kc1m3l_r1vh81_t03ihg@0_xomsa1@0']").click();
|
||
})() |