Ecology-Dev-chaofa/LuWeiGuangDian/interface.lwgd/WorkflowTest.jsp

500 lines
25 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.Map,java.util.HashMap" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="net.sf.json.JSONArray" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="bb" class="weaver.general.BaseBean" />
<%
int nodeid = Util.getIntValue(request.getParameter("nodeid"));//流程的节点id
bb.writeLog("==========成品/样机出库单 nodeid ============"+ nodeid);
String sql = "select isstart from workflow_nodebase where id = " + nodeid;
rs.execute(sql);
rs.next();
int isstart = Util.getIntValue(rs.getString("isstart"));//判断是否是流程创建节点 1是 0
%>
<script type="text/javascript">
window.canculate = () =>{
let year_id = WfForm.convertFieldNameToId("khnf");
let year = WfForm.getFieldValue(year_id);
let dept_id = WfForm.convertFieldNameToId("bkhbm");
let dept = WfForm.getFieldValue(dept_id);
let khzq_id = WfForm.convertFieldNameToId("khzq");
let khzq = WfForm.getFieldValue(khzq_id);
var zbmc_id = WfForm.convertFieldNameToId("zbmc", "detail_2");
var wcz_id = WfForm.convertFieldNameToId("wcz", "detail_2");
let xh_detail2 = WfForm.getDetailAllRowIndexStr("detail_2");
var xhs2 = xh_detail2.split(',');
for(let i=0;i<xhs2.length;i++){
let rowIndex = xhs2[i];
let zbmc = WfForm.getFieldValue(zbmc_id+"_"+rowIndex);
let datas = {"indexId":zbmc,"deptId":dept,"year":year,"checkCycle":khzq};
jQuery.ajax({
type:"POST",
url:"/api/lwgd/indexformula/canculate",
data:JSON.stringify(datas),
async:false,
contentType: 'application/json',
success:function(res) {
console.log('res', res);
WfForm.changeFieldValue(wcz_id+"_"+rowIndex, {value:res.data});
},
complete:function(XMLHttpRequest, textStatus) {
},
error:function(e){
alert(e);
}
});
}
}
jQuery(document).ready(function() {
var zbmc_id = WfForm.convertFieldNameToId("zbmc", "detail_1");
let zbqz_id = WfForm.convertFieldNameToId("zbqz", "detail_1");
let jldw_id = WfForm.convertFieldNameToId("jldw", "detail_1");
let dxz_id = WfForm.convertFieldNameToId("dxz", "detail_1");
let mbz_id = WfForm.convertFieldNameToId("mbz", "detail_1");
let tzz_id = WfForm.convertFieldNameToId("tzz", "detail_1");
let wczsd_id = WfForm.convertFieldNameToId("wczsd", "detail_1");
let pfsd_id = WfForm.convertFieldNameToId("pfsd", "detail_1");
var zbgs_id = WfForm.convertFieldNameToId("zbgs", "detail_1");
var wczbgs_id = WfForm.convertFieldNameToId("wczbgs", "detail_1");
var wcz_id = WfForm.convertFieldNameToId("wcz", "detail_1");
var fsjsdf_id = WfForm.convertFieldNameToId("fsjsdf", "detail_1");
let jxfamc_id = WfForm.convertFieldNameToId("jxfamc");
let jyzbqz_id = WfForm.convertFieldNameToId("jyzbqz");
let glzbqz_id = WfForm.convertFieldNameToId("glzbqz");
WfForm.bindFieldChangeEvent(jxfamc_id, function (obj, id, value) {
if (value) {
var options = {
url: '/interface/lwgd/getBusinessIndicators.jsp',
method: 'POST',
params: {
indexPlanId: value,
zbmc_id: zbmc_id,
zbqz_id: zbqz_id,
jldw_id: jldw_id,
dxz_id: dxz_id,
mbz_id: mbz_id,
tzz_id: tzz_id,
wczsd_id: wczsd_id,
pfsd_id: pfsd_id,
zbgs_id: zbgs_id,
wczbgs_id: wczbgs_id
}
};
window.weaJs.callApi(options).then(function (res) {
console.log(res);
let jyzbqz = res.jyzbqz;
let glzbqz = res.glzbqz;
let resdata = res.mxdata;
WfForm.changeFieldValue(jyzbqz_id, {value: jyzbqz});
WfForm.changeFieldValue(glzbqz_id, {value: glzbqz});
WfForm.delDetailRow("detail_1", "all");
for (var i = 0; i < resdata.length; i++) {
WfForm.addDetailRow("detail_1", resdata[i]);
}
});
} else {
WfForm.delDetailRow("detail_1", "all");
}
});
var zbmc2_id = WfForm.convertFieldNameToId("zbmc", "detail_2");
var zbgs2_id = WfForm.convertFieldNameToId("zbgs", "detail_2");
var wczbgs2_id = WfForm.convertFieldNameToId("wczbgs", "detail_2");
WfForm.bindDetailFieldChangeEvent(zbmc2_id, function (id, rowIndex, value) {
if (value) {
var options = {
url: '/interface/lwgd/getIndexFormulaInfo.jsp',
method: 'POST',
params: {indexId: value}
};
window.weaJs.callApi(options).then(function (res) {
var zbgs = res.zbgs;
var wczbgs = res.wczbgs;
WfForm.changeFieldValue(wczbgs2_id + "_" + rowIndex, {value: wczbgs});
WfForm.changeFieldValue(zbgs2_id + "_" + rowIndex, {value: zbgs});
});
}
});
})
jQuery(document).ready(function(){
// =========== ecode ========================
let year_id = WfForm.convertFieldNameToId("khnf");
let year = WfForm.getFieldValue(year_id);
let dept_id = WfForm.convertFieldNameToId("bkhbm");
let dept = WfForm.getFieldValue(dept_id);
let khzq_id = WfForm.convertFieldNameToId("khzq");
let khzq = WfForm.getFieldValue(khzq_id);
var wcz_id = WfForm.convertFieldNameToId("wcz", "detail_1");
var wczsd_id = WfForm.convertFieldNameToId("wczsd", "detail_1");
let pfsd_id = WfForm.convertFieldNameToId("pfsd", "detail_1");
var fsjsdf_id = WfForm.convertFieldNameToId("fsjsdf", "detail_1");
var zbgs_id = WfForm.convertFieldNameToId("zbgs", "detail_1");
var wczbgs_id = WfForm.convertFieldNameToId("wczbgs", "detail_1");
let xhs1_detail = WfForm.getDetailAllRowIndexStr("detail_1");
if(xhs1_detail != '') {
let xhs1 = xhs1_detail.split(',');
for (let i = 0; i < xhs1.length; i++) {
let param = "{\"indexId\":";
let rowIndex = xhs1[i];
let zbmc = WfForm.getFieldValue(zbmc_id + "_" + rowIndex);
let wczsd = WfForm.getFieldValue(wczsd_id + "_" + rowIndex);
let pfsd = WfForm.getFieldValue(pfsd_id + "_" + rowIndex);
param += "\"" + zbmc + "\",\"deptId\":\""+dept+"\",\"year\":\""+year+"\",\"checkCycle\":\""+khzq+"\"";
let zbgs = WfForm.getFieldValue(zbgs_id + "_" + rowIndex);
let wczbgs = WfForm.getFieldValue(wczbgs_id + "_" + rowIndex);
if(wczbgs != ''){
param += ",\"indexFormulaVars\":[";
let wczbgsids = wczbgs.split(',');
for (let j = 0; j < wczbgsids.length; j++) {
let wczbgs = wczbgsids[j];
let tabletype = wczbgs.split('_')[0];
let fieldname = wczbgs.split('_')[1];
let table = '';
let field_id = '';
let field_value = '';
param += "{";
if (tabletype == 'main') {
table = 'examinationTableMainTable_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname);
field_value = WfForm.getFieldValue(field_id);
} else if (tabletype == 'dt1') {
table = 'examinationTableBusinessIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_1');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt2') {
table = 'examinationTableManagementIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_2');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt3') {
table = 'examinationTableImportantWork_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_3');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt5') {
table = 'examinationTableReservedTable1_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_5');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt6') {
table = 'examinationTableReservedTable2_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_6');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
}
param += "\"fieldId\":\"" + table + "\",\"content\":\"" + field_value + "\"";
param += "},";
}
param = param.substring(0, param.length - 1);
param += "]";
param += "}";
}else{
param += "}";
}
let datas = {"indexId": zbmc, "deptId": dept, "year": year, "checkCycle": khzq};
if(wczsd=='1'){
jQuery.ajax({
type: "POST",
url: "/api/lwgd/indexformula/canculateComplete",
data: param,
async: false,
contentType: 'application/json',
success: function (res) {
console.log('res', res);
if(res.status){
WfForm.changeFieldValue(wcz_id + "_" + rowIndex, {value: res.data});
}else{
window.weaJs.alert("经营指标,第"+(i+1)+"行 "+ res.data);
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function (e) {
alert(e);
}
});
}
param += "\"indexFormulaVars\":[";
if(zbgs!='') {
let zbgsids = zbgs.split(',');
for (let j = 0; j < zbgsids.length; j++) {
let zzbgs = zbgsids[j];
let tabletype = zzbgs.split('_')[0];
let fieldname = zzbgs.split('_')[1];
let table = '';
let field_id = '';
let field_value = '';
param += "{";
if (tabletype == 'main') {
table = 'examinationTableMainTable_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname);
field_value = WfForm.getFieldValue(field_id);
} else if (tabletype == 'dt1') {
table = 'examinationTableBusinessIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_1');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt2') {
table = 'examinationTableManagementIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_2');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt3') {
table = 'examinationTableImportantWork_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_3');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt5') {
table = 'examinationTableReservedTable1_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_5');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt6') {
table = 'examinationTableReservedTable2_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_6');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
}
param += "\"fieldId\":\"" + table + "\",\"content\":\"" + field_value + "\"";
param += "},";
}
param = param.substring(0, param.length - 1);
param += "]}";
if (pfsd == '1') {
jQuery.ajax({
type: "POST",
url: "/api/lwgd/indexformula/canculateScore",
data: param,
async: false,
contentType: 'application/json',
success: function (res) {
console.log('res', res);
if (res.status) {
WfForm.changeFieldValue(fsjsdf_id + "_" + rowIndex, {value: res.data});
} else {
window.weaJs.alert("经营指标,第" + (i + 1) + "行 " + res.data);
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function (e) {
alert(e);
}
});
}
}
}
}
var wcz2_id = WfForm.convertFieldNameToId("wcz", "detail_2");
var fsjsdf2_id = WfForm.convertFieldNameToId("fsjsdf", "detail_2");
let xhs2_detail = WfForm.getDetailAllRowIndexStr("detail_2");
if(xhs2_detail != '') {
let xhs2 = xhs2_detail.split(",");
for (let i = 0; i < xhs2.length; i++) {
let param2 = "{\"indexId\":";
let rowIndex = xhs2[i];
let zbmc = WfForm.getFieldValue(zbmc2_id + "_" + rowIndex);
param2 += "\"" + zbmc + "\"";
let zbgs = WfForm.getFieldValue(zbgs2_id + "_" + rowIndex);
let wczbgs = WfForm.getFieldValue(wczbgs_id + "_" + rowIndex);
if(wczbgs != ''){
param2 += ",\"deptId\":\""+dept+"\",\"year\":\""+year+"\",\"checkCycle\":\""+khzq+"\"";
param2 += ",\"indexFormulaVars\":[";
let wczbgsids = wczbgs.split(',');
for (let j = 0; j < wczbgsids.length; j++) {
let wczbgs = wczbgsids[j];
let tabletype = wczbgs.split('_')[0];
let fieldname = wczbgs.split('_')[1];
let table = '';
let field_id = '';
let field_value = '';
param2 += "{";
if (tabletype == 'main') {
table = 'examinationTableMainTable_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname);
field_value = WfForm.getFieldValue(field_id);
} else if (tabletype == 'dt1') {
table = 'examinationTableBusinessIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_1');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt2') {
table = 'examinationTableManagementIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_2');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt3') {
table = 'examinationTableImportantWork_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_3');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt5') {
table = 'examinationTableReservedTable1_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_5');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt6') {
table = 'examinationTableReservedTable2_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_6');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
}
param2 += "\"fieldId\":\"" + table + "\",\"content\":\"" + field_value + "\"";
param2 += "},";
}
param2 = param.substring(0, param.length - 1);
param2 += "]";
param2 += "}";
}else{
param2 += "}";
}
let datas = {"indexId": zbmc, "deptId": dept, "year": year, "checkCycle": khzq};
jQuery.ajax({
type: "POST",
url: "/api/lwgd/indexformula/canculateComplete",
data: param2,
async: false,
contentType: 'application/json',
success: function (res) {
console.log('res', res);
if(res.status){
WfForm.changeFieldValue(wcz2_id + "_" + rowIndex, {value: res.data});
}else{
window.weaJs.alert("管理指标,第"+(i+1)+"行 "+ res.data);
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function (e) {
alert(e);
}
});
if(zbgs != '') {
param2 += ",\"indexFormulaVars\":[";
let zbgsids = zbgs.split(',');
for (let j = 0; j < zbgsids.length; j++) {
let zzbgs = zbgsids[j];
let tabletype = zzbgs.split('_')[0];
let fieldname = zzbgs.split('_')[1];
let table = '';
let field_id = '';
let field_value = '';
param2 += "{";
if (tabletype == 'main') {
table = 'examinationTableMainTable_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname);
field_value = WfForm.getFieldValue(field_id);
} else if (tabletype == 'dt1') {
table = 'examinationTableBusinessIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_1');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt2') {
table = 'examinationTableManagementIndicators_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_2');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt3') {
table = 'examinationTableImportantWork_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_3');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt5') {
table = 'examinationTableReservedTable1_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_5');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
} else if (tabletype == 'dt6') {
table = 'examinationTableReservedTable2_' + fieldname;
field_id = WfForm.convertFieldNameToId(fieldname, 'detail_6');
field_value = WfForm.getFieldValue(field_id + "_" + rowIndex);
}
param2 += "\"fieldId\":\"" + table + "\",\"content\":\"" + field_value + "\"";
param2 += "},";
}
param2 = param2.substring(0, param2.length - 1);
param2 += "]";
param2 += "}";
setTimeout(function () {
jQuery.ajax({
type: "POST",
url: "/api/lwgd/indexformula/canculateScore",
data: param2,
async: false,
contentType: 'application/json',
success: function (res) {
console.log('res', res);
if (res.status) {
WfForm.changeFieldValue(fsjsdf2_id + "_" + rowIndex, {value: res.data});
} else {
window.weaJs.alert("管理指标,第" + (i + 1) + "行 " + res.data);
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function (e) {
alert(e);
}
});
}, 1500);
}
}
}
// =========== ecode ========================
let kcxxyldz_id = WfForm.convertFieldNameToId("kcxxyldz");
let kcxxyldz = WfForm.getFieldValue(kcxxyldz_id);
let aa = "<Button type='button' class='ant-btn ant-btn-primary' onclick='window.open(\""+kcxxyldz+"\")'>课程预览</Button>";
WfForm.proxyFieldComp(kcxxyldz_id, aa);
let kcxxydyldz_id = WfForm.convertFieldNameToId("kcxxydyldz");
let kcxxydyldz = WfForm.getFieldValue(kcxxydyldz_id);
let bb = "<Button type='button' class='ant-btn ant-btn-primary' onclick='window.open(\""+kcxxydyldz+"\")'>课程预览</Button>";
WfForm.proxyFieldComp(kcxxydyldz_id, bb);
let ksxxpcyldz_id = WfForm.convertFieldNameToId("ksxxpcyldz");
let ksxxpcyldz = WfForm.getFieldValue(ksxxpcyldz_id);
let cc = "<Button type='button' class='ant-btn ant-btn-primary' onclick='window.open(\""+ksxxpcyldz+"\")'>考试预览</Button>";
WfForm.proxyFieldComp(ksxxpcyldz_id, cc);
let ksxxyddyldz_id = WfForm.convertFieldNameToId("ksxxyddyldz");
let ksxxyddyldz = WfForm.getFieldValue(ksxxyddyldz_id);
let dd = "<Button type='button' class='ant-btn ant-btn-primary' onclick='window.open(\""+ksxxyddyldz+"\")'>考试预览</Button>";
WfForm.proxyFieldComp(ksxxyddyldz_id, dd);
});
</script>