保时捷target setting 流程控制开发

main
youHong.ai 2022-12-08 15:32:28 +08:00
parent 01014bda04
commit a85e0777e3
4 changed files with 195 additions and 22 deletions

View File

@ -0,0 +1,40 @@
$(() => {
/**
* @author youhong.ai
* @desc 获取react组件实例
*/
function findReact(dom, traverseUp = 0) {
const key = Object.keys(dom).find(key => {
return key.startsWith("__reactFiber$") // react 17+
|| key.startsWith("__reactInternalInstance$") // react <17
});
const domFiber = dom[key];
if (domFiber == null) return null;
// react <16
if (domFiber._currentElement) {
let compFiber = domFiber._currentElement._owner;
for (let i = 0; i < traverseUp; i++) {
compFiber = compFiber._currentElement._owner;
}
return compFiber._instance;
}
// react 16+
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;
}
window.Utils = {
findReact,
}
})

View File

@ -0,0 +1,78 @@
const WfForm = {
isMobile: () => {
// true表示是eMobile、微信、钉钉等移动终端false代表PC端
},
}
WfForm.OPER_SAVE = '保存'
WfForm.OPER_SUBMIT = '提交/批准/提交需反馈/不需反馈等'
WfForm.OPER_SUBMITCONFIRM = '提交至确认页面如果是确认界面点确认触发的是SUBMIT'
WfForm.OPER_REJECT = '退回'
WfForm.OPER_REMARK = '批注提交'
WfForm.OPER_INTERVENE = '干预'
WfForm.OPER_FORWARD = '转发'
WfForm.OPER_TAKEBACK = '强制收回'
WfForm.OPER_DELETE = '删除'
WfForm.OPER_ADDROW = '添加明细行,需拼明细表序号'
WfForm.OPER_DELROW = '删除明细行,需拼明细表序号'
WfForm.OPER_PRINTPREVIEW = '打印预览 KB900190501'
WfForm.OPER_EDITDETAILROW = '移动端-编辑明细 KB900191101'
WfForm.OPER_BEFOREVERIFY = '校验必填前触发事件 KB900191201'
WfForm.OPER_TURNHANDLE = '转办 KB900201101'
WfForm.OPER_ASKOPINION = '意见征询 KB900201101'
WfForm.OPER_TAKFROWARD = '征询转办 KB900201101'
WfForm.OPER_TURNREAD = '传阅 KB900201101'
WfForm.OPER_FORCEOVER = '强制归档 KB900201101'
WfForm.OPER_BEFORECLICKBTN = '点右键按钮前 KB900201101'
WfForm.OPER_SAVECOMPLETE = '保存后页面跳转前 KB900210501'
WfForm.OPER_WITHDRAW = '撤回 KB900201101'
WfForm.OPER_CLOSE = '页面关闭'
WfForm.registerCheckEvent = (type, callback) => {
// WfForm.registerCheckEvent(WfForm.OPER_SAVE+","+WfForm.OPER_SUBMIT,function(callback){
// //... 执行自定义逻辑
// callback();
// });
}
WfForm.ACTION_ADDROW = '添加明细行,需拼明细表序号 KB900190407'
WfForm.ACTION_DELROW = '删除明细行,需拼明细表序号 KB900190407'
WfForm.ACTION_EDITDETAILROW = '移动端-编辑明细行,需拼明细表序号 KB900190501'
WfForm.ACTION_SWITCHDETAILPAGING = '切换明细分页 KB900191201'
WfForm.ACTION_SWITCHTABLAYOUT = '切换模板布局标签页 KB900191201'
WfForm.registerAction = (type, callback) => {
// WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){
// alert("添加行下标是"+index);
// }); //下标从1开始明细1添加行触发事件注册函数入参为新添加行下标
// WfForm.registerAction(WfForm.ACTION_DELROW+"2", function(arg){
// alert("删除行下标集合是"+arg.join(","));
// }); //下标从1开始明细2删除行触发事件
// WfForm.registerAction(WfForm.ACTION_SWITCHDETAILPAGING, function(groupid){
// alert("切换明细表"+(groupid+1)+"的页码触发事件");
// });
// WfForm.registerAction(WfForm.ACTION_SWITCHTABLAYOUT, function(tabid){
// alert("切换到标签项"+tabid+"触发事件");
// });
}
WfForm.convertFieldNameToId = (fieldName, table, flag) => {
// var fieldid = WfForm.convertFieldNameToId("zs");
// var fieldid = WfForm.convertFieldNameToId("zs_mx", "detail_1");
// var fieldid = WfForm.convertFieldNameToId("zs_mx", "detail_1", false);
}
WfForm.getFieldValue = function (fieldMark) {
// fieldMark String 是 字段标示格式field${字段ID}_${明细行号}
// var fieldvalue = WfForm.getFieldValue("field110");
}
WfForm.bindFieldChangeEvent = function (fieldMarkStr, funobj) {
// fieldMarkStr String 是 绑定字段标示可多个拼接逗号隔开例如field110(主字段),field111_2(明细字段)……
// funobj Function 是 字段值变化触发的自定义函数函数默认传递以下三个参数参数1触发字段的DOM对象参数2触发字段的标示(field27555等)参数3修改后的值
// WfForm.bindFieldChangeEvent("field27555,field27556", function (obj, id, value) {
// console.log("WfForm.bindFieldChangeEvent--", obj, id, value);
// });
}

View File

@ -1 +1,77 @@
// 流程代码块
/* ******************* 保时捷target setting流程提交控制 start ******************* */
/**
* @author youhong.ai
* @desc 禁止点击提交按钮
*/
function doNotClickSubmit() {
let submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="Submit "]')
if (submitButton.length === 0) {
submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="提交"]')
}
if (submitButton.length === 0) {
submitButton = $("#weareqtop_9v5e5i_1670481049632 div.ant-row.wea-new-top-req div.ant-col-xs-18.ant-col-sm-18.ant-col-md-16.ant-col-lg-14 button[title='提交'],[title='Submit '],[title='Submit']")
}
if (submitButton.length !== 0) {
let buttonReact = window.Utils.findReact(submitButton[0])
console.log(buttonReact)
buttonReact.props.disabled = true
buttonReact.setState({disabled: true})
}
}
/**
* @author youhong.ai
* @desc 允许点击按钮
*/
function allowClickSubmit() {
let submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="Submit "]')
if (submitButton.length === 0) {
submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="提交"]')
}
if (submitButton.length === 0) {
submitButton = $("#weareqtop_9v5e5i_1670481049632 div.ant-row.wea-new-top-req div.ant-col-xs-18.ant-col-sm-18.ant-col-md-16.ant-col-lg-14 button[title='提交'],[title='Submit '],[title='Submit']")
}
if (submitButton.length !== 0) {
let buttonReact = window.Utils.findReact(submitButton[0])
console.log(buttonReact)
buttonReact.props.disabled = false
buttonReact.setState({disabled: false})
}
}
/**
* 监听qzhj字段值改变
* @param id 字段id
* @param value 字段值
* @param obj 字段值对象
*/
function onQzhjFieldChangeValue(id, value, obj) {
console.log(value)
if (value != '100') {
doNotClickSubmit()
} else {
allowClickSubmit()
}
}
/**
* 检查qzhj字段值
* @param fieldId qzhj字段id
*/
function checkOnQzhJfiedlChangeValue(fieldId) {
let value = WfForm.getFieldValue(fieldId);
onQzhjFieldChangeValue(null, value)
}
$(() => {
let qzhjFieldId = WfForm.convertFieldNameToId("qzhj")
checkOnQzhJfiedlChangeValue(qzhjFieldId)
WfForm.bindFieldChangeEvent(qzhjFieldId, onQzhjFieldChangeValue)
})
/* ******************* 保时捷target setting流程提交控制 end ******************* */

View File

@ -5,7 +5,6 @@ import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils;
import basetest.BaseTest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.youhong.ai.pcn.organization.orgchart.service.OrgChartService;
import com.api.youhong.ai.pcn.organization.orgchart.vo.OrgChartNodeVo;
import com.fasterxml.jackson.core.JsonProcessingException;
@ -224,24 +223,4 @@ public class TestOrganization extends BaseTest {
System.out.println(JSON.toJSONString(orgChartTree));
}
@Test
public void testDownload() throws IOException {
HttpUtils httpUtils = new HttpUtils();
// String url = "http://e-sign-dev-yace-web-alb-1694614450.cn-north-1.elb.amazonaws.com.cn:8070/contract/download?appId=100000&signType=SHA256&sign=OEI4RDA5RjMwRTE3Qzk1ODI0RkM3OENCQTA3QzZEQUFBQTgwRjM5MDdDMkIzQTIxNDFERDkyNUI5RDVFRjc4Qg==&timestamp=2022-12-07%2014:32:08&bizContent=JTdCJTIyZG9jTm8lMjIlM0ElMjJjMGY5YzhjYTk5OTQ0MzZjYThjY2Y0MWVmMTZkMDUzYSUyMiU3RA==";
String url = "https://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/download";
String heard = "{\"apikey\":\"TulQxnZSRKeHoQfmeZzOUzGn6KpTDkDK\",\"appId\":\"100001\",\"bizContent\":\"JTdCJTIyY29udHJhY3RObyUyMiUzQSUyMjAwZDBkNmFlYzFkOTQzNGE4YjFlZjc5YzZjODcwNWFmJTIyJTdE\",\"sign\":\"M0I2NjhGRjgwNDY2RjM4MjRBMTg4RUQ0QUU0MkEzOUVEQTAxNTZCRTgwRDE3NzQ3RkQxMzZGOEE1M0FCODRGOA==\",\"signType\":\"SHA256\",\"Content-Type\":\"application/json\",\"timestamp\":\"2022-12-07 17:38:07\"} ";
Map<String, String> map = JSONObject.parseObject(heard, Map.class);
FaRequestUtils.downContract(new HashMap<String, Object>() {{
put("contractNo", "00d0d6aec1d9434a8b1ef79c6c8705af");
}}, (map1, response) -> {
getFileName(response);
Header[] allHeaders = response.getAllHeaders();
for (Header allHeader : allHeaders) {
System.out.println(allHeader);
}
return null;
}, url);
}
}