var panMain = {};// 存放多个面板集合键为panIndx
|
var panIndex = "0";// 面板索引,作为全局变量 已确定执行哪一个面板
|
var gridToPanel = true;// 解决grid之后不触发事件
|
var getBackBool = true;// 解决面板带值之后不触发带出值事件
|
var getBackElse = false;// 不是回车或tab键也触发
|
var openTree = true;
|
var musChoies = false;// 是否为多选
|
var setPanel301 = false;// 值发生改变时
|
var hasShezhiZiduan = true;
|
var pbId = "";
|
var hasButton = false;// 是否有通过驳回按钮
|
var isAddLong = true;
|
var no_load_first = false;//只有加载时触发此事件,表明其为加载时,防止程序未知处把其值改了
|
var gtss="0";
|
var panelFormId="0";//当前面板的功能号
|
var isInspection = false;//是否禁止必录检查。
|
var seltboo=false;
|
var pandex496="0";//解决496多个面板正在执行的那个面板panIndex
|
var maxCols=[];//默认面板有4列
|
// var select2Options=[];//43控件调用31控件查询值存放的集合
|
var fileupload_config={};
|
var qrCode;//单据二维码
|
var OAButonEvnt=null;//新的OA审核界面用到
|
fileupload_config.browseOnZoneClick=false;
|
//----------------------------------------
|
( function() {// 处理json 待处理
|
String.prototype.Trim = function() {
|
return this.replace(/(^\s*)|(\s*$)/g, "");
|
}
|
String.prototype.LTrim = function() {
|
return this.replace(/(^\s*)/g, "");
|
}
|
String.prototype.RTrim = function() {
|
return this.replace(/(\s*$)/g, "");
|
}
|
pbjson = {
|
toJson : function(jsonStr, fen) {
|
jsonStr = jsonStr.Trim();
|
if (jsonStr.indexOf("{") == 0) {
|
jsonStr = jsonStr.substring(1, jsonStr.length - 1);
|
}
|
var map = {};
|
var vsd = jsonStr.split(fen);
|
var vs = (":").split(":");
|
for ( var i = 0; i < vsd.length; i++) {
|
vs[0] = vsd[i].substring(0, vsd[i].indexOf(":"));
|
vs[1] = vsd[i].substring(vsd[i].indexOf(":") + 1);
|
if (vs[0].indexOf("\"") == 0 || vs[0].indexOf("'") == 0) {
|
vs[0] = vs[0].substring(1, vs[0].length - 1);
|
}
|
if (vs[1].indexOf("\"") == 0 || vs[1].indexOf("'") == 0) {
|
vs[1] = vs[1].substring(1, vs[1].length - 1);
|
}
|
map[vs[0]] = vs[1];
|
}
|
return map;
|
}
|
};
|
pb = {
|
json :pbjson
|
};
|
sortObj=function (obj) {
|
const keys = Object.keys(obj).sort(function(a, b) { return (obj[a]> obj[b]?1:-1) })
|
// const keysss = keys.sort(function(a, b) { return (obj[a]> obj[b]?1:-1) })
|
var newObj = {}
|
for (var i = 0; i < keys.length; i++) {
|
const key = keys[i]
|
newObj[key] = obj[key]
|
}
|
return newObj
|
};
|
//EasyUI Tabs 标签页/选项卡(496窗体用的多 ,没用 需要删除)
|
getTabs = function(id,falg,isp,creates,num){
|
|
}
|
//EasyUI Tabs 标签页/选项卡(496窗体用的多) xin 2019-10-8 15:50:10
|
Tabs = function(falg,isp){
|
try{
|
var only={};//选中集合
|
$('.istabs').each(function(){//遍历面板上的tabs
|
var evn=this;
|
$(this).tabs({
|
width:top.tabWidth,//这里获取外层tab的宽度,如果不设置有时候会出现页卡宽度为0。
|
onSelect:function(title,index){//当用户选择一个标签页面板(tab panel)时触发。
|
var id= $(this).tabs('getSelected').attr('id');//获取选中的标签页面板;
|
if(only[id]) return;
|
if(id.indexOf('create')!=-1){//页卡里面是格线
|
eval(id+'("'+js_where[id]+'",falg,iscp)');
|
}
|
if(id.indexOf('panl')!=-1){//面板
|
//panIndex=id.split('-')[1];//当前面板索引
|
}
|
only[id]=true;//已经被选中返回true
|
//页卡里带有下拉菜单按钮
|
try{
|
if($('#mb'+id).html().Trim()!=''){
|
var mb = $(this).tabs('tabs')[index].panel('options').tab.find('a.tabs-inner');
|
mb.menubutton({
|
menu:'#mb'+id
|
// iconCls:''//带图标
|
}).click(function(){//单击
|
$(evn).tabs('select',index);
|
});
|
}
|
}catch(e){$.messager.alert('子功能号超链接获取出错:'+e);}
|
}
|
});
|
});
|
//这里是为了页卡有格线但是第一次加载一次也没选中到
|
for(var w in js_where){//格线条件结合
|
if(only[w]==null){//选中集合里没有格线,js_where里有值。这时候需要加载一个,不加载会导致保存时候grid获取不到数据。
|
eval(w+'("'+js_where[w]+'",falg,iscp)');
|
}else{
|
break;
|
}
|
}
|
}catch(e){
|
$.messager.alert("操作提示","选项卡加载格线数据出现了错误,尝试重新生成!"+e,"warning");
|
}
|
}
|
//旧的单据信息
|
showInfo=function(){
|
|
}
|
|
/**
|
* 复制链接 2018-9-4 17:51:14 xin
|
*/
|
copyLink=function(){
|
var oInput = document.createElement('input');
|
oInput.value = top.copyLink[top.tabindex];
|
document.body.appendChild(oInput);oInput.select(); // 选择对象
|
document.execCommand("Copy"); // 执行浏览器复制命令 oInput.className =
|
// 'oInput';
|
oInput.style.display='none';
|
$.messager.show({
|
height:60,
|
msg:'<div align=\"center\"><span style=\"color:green;\"><b>链接复制成功?</b></span></div>',
|
showType:'fade',
|
timeout:2000,
|
style:{}
|
});
|
}
|
|
//31控件新的加载方式 xin 2020-9-18 16:45:00
|
getSelect31=function(id){//id为面板上的控件id
|
var initial = panIndex;
|
for (var p in panMain) {//多面板的情况需要遍历(496窗体)
|
var json = panMain[p].select;//得到有关联的字段集合
|
if (json[id] != null) {
|
var filed = json[id].split(";");
|
for (var i = 0; i < filed.length; i++) {
|
let type=31;
|
if(panMain[p].panInfo[filed[i]]){
|
type = panMain[p].panInfo[filed[i]].controltype
|
}
|
type = type != null ? parseInt(type) : 31;
|
panPar.getControlValue(filed[i], type, filed[i], 0, p);
|
}
|
}
|
}
|
panIndex = initial;
|
}
|
|
$doc = function(id) {
|
var d = {
|
doc :$('#panIndex' + panIndex).find('#' + id)[0],
|
onPropertyChange : function(v) {
|
let to = ((v == null) ? false : ((v == "value") ? true : false));
|
if ($.browser != null && !$.browser.msie && to) {// 不是IE浏览器 js赋值也触发函数
|
pro = $(this.doc).attr("onPropertyChange");
|
if (typeof pro != "undefined") {
|
eval(pro.replace("event", "null"));
|
}
|
}
|
},
|
css : function(style, v) {
|
$(this.doc).css(style, v);
|
},
|
src : function(v){//40控件类型 -xin 2020-6-15 17:19:20
|
if (v == null) {
|
let value = $(this.doc).data('value');
|
if (value == null) {
|
value = $(this.doc).val();
|
}
|
return value || '';//$(this.doc)[0].src;
|
}
|
// if (!v.toLowerCase().startsWith('https:') && !v.toLowerCase().startsWith('http:')) {
|
// $(this.doc).attr('src', '/getImage.do?type=1&uuid=' + v);
|
// } else {
|
// $(this.doc).attr('src', v);
|
// }
|
},
|
attr : function(attr, v) {
|
$(this.doc).attr(attr, v);
|
this.onPropertyChange(attr);
|
},
|
disabled:function(v){
|
if (this.doc == null) {//加载多表类型时候有可能获取不到控件对象导致获取不到控件状态值(加载时候多表的panIndex值是最后一个值) xin 2022-6-30 09:49:23
|
this.doc = $("#" + id)[0];
|
}
|
if (v == null) {
|
return ($(this.doc).is(":disabled") ? 1 : 0);
|
} else {
|
$(this.doc).prop("disabled", v);
|
}
|
},
|
html : function(v) {
|
if (v == null) {
|
return $(this.doc).html();
|
} else {
|
$(this.doc).html(v);
|
}
|
},
|
val : function(v) {
|
if (v == null) {
|
return $(this.doc).val();
|
} else {
|
$(this.doc).val(v);
|
this.onPropertyChange("value");
|
}
|
},
|
optionsAdd : function(text, value) {
|
if (this.doc.options != null) {
|
this.doc.options.add(new Option(text, value));
|
}
|
}
|
};
|
return d;
|
}
|
})();
|
|
//--------------------【panPar】
|
//包含面板信息,与必要函数
|
var panPar = {
|
getOrder : function(id) {// 得到本来应该的字段,单独为10类型增加
|
var col_ = id;
|
if(typeof(gridInt)!='undefined'){
|
if (gridInt != null && gridInt.InitValue != '') {
|
var cols_ = gridInt.InitValue;
|
var cols = cols_.split("&p&");
|
var c = null;// 当前字段信息
|
for (var i = 0; i < cols.length; i++) {
|
c = cols[i].split("#");
|
if (c[1] != "" && c[1].toLowerCase() == id.toLowerCase()) {
|
col_ = c[0];
|
let code = id + ',' + col_ + ':';
|
if (gridInt.mastercode.indexOf(code) == -1) {
|
gridInt.mastercode += code;
|
}
|
break;
|
}
|
}
|
}
|
}
|
return col_;
|
},
|
id :"",
|
value :"",
|
noCopy : function(col) {// 不要复制的字段
|
col += ";EnterCode;EnterName;EnterDate;ModifyName;ModifyDate;PostName;PostDate;CreateUsercode;CreateUsername";// 添加默认去除的字段
|
col = col.toLowerCase();
|
var cols = col.split(";");
|
for (i = 0; i < cols.length; i++) { // 字段为空需排除,不然报错
|
if (cols[i] != "" && cols[i] != 'docstatus') {
|
if (getDoc(cols[i], '') != null) { // 添加默认字段的屏蔽措施
|
setDoc(cols[i], ".value='"
|
+ this.panInfo[cols[i]].initValue + "'");
|
}
|
}
|
var link = getDoc(cols[i] + '_show_link', '');
|
if (link != null) {
|
var vvv = getDoc(cols[i], '.value');
|
$('#' + cols[i] + '_Link').html(vvv);
|
$('#' + cols[i] + '_show_link').hide();
|
$('#' + cols[i] + '_show_type').show();
|
}
|
}
|
setInvDate();
|
},
|
// SQL参数下拉控件,获得动态控件数据
|
getControlValue : function(field, fieldtype, targetControl, callback, pindex) {
|
try{
|
var arrType=[2,31,35];//只查询这几个控件类型
|
if ($.inArray(fieldtype, arrType) != -1) {
|
this.select2PostValue(field, fieldtype, callback, pindex, false, function (option) {
|
let isSuppressBlankLineForDropDown = 0;
|
if (panMain[panIndex].panInfo[field] != null) {
|
isSuppressBlankLineForDropDown = panMain[panIndex].panInfo[field].isSuppressBlankLineForDropDown;
|
}
|
field = (fieldtype == 35 ? field + '_35' : field);
|
var Evn = $doc(field);//获取控件对象
|
if($(Evn.doc).attr('type')=="hidden"){//隐藏的执行返回
|
return false;
|
}
|
// 原先的值 2019-4-2 14:50:53
|
var original = $doc(field + 'text').val();
|
if (original == '' || original == null) {
|
//有值的情况赋值
|
original = $(Evn.doc).val();
|
//针对38特殊窗体 xin 2019-11-21 09:38:05
|
if (original == '' && formType == 38) {
|
original = panMain[panIndex].SpecialType[field];
|
}
|
}
|
Evn.doc.length = 0;
|
if (isSuppressBlankLineForDropDown != 1) {
|
Evn.optionsAdd('', '');// 添加一个空值
|
}
|
// 下拉控件赋值 xin 2019-5-24 17:55:31
|
var isEm = false;
|
let isempty = true;//这属性用来判断是否匹配到下拉值,没有那个就清空
|
for (var o = 0; o < option.length; o++) {
|
Evn.optionsAdd(option[o].text, option[o].id);
|
//匹配key 和value
|
if (original == option[o].id) {//|| original == option[o].text) {
|
original = option[o].id;
|
$doc(field + 'text').val(original);
|
isempty = false;//匹配到时候改为false
|
}
|
if (option[o].id == '') {
|
isEm = true;
|
}
|
}
|
if (isEm && isSuppressBlankLineForDropDown != 1) {
|
document.getElementById(field).options.remove(0);
|
}
|
if (option.length == 0 || isempty) {//如果下拉都没有或匹配不到下拉值,那么field+'text'隐藏的字段值也清空去 xin 2022-11-29 10:17:16
|
$doc(field + 'text').val('');
|
}
|
//选中之前的值
|
$(Evn.doc).val(original);
|
// 取得浏览器的userAgent字符串 xin 2018-12-18 09:49:53
|
var userAgent = navigator.userAgent;
|
if (userAgent.indexOf("Chrome") > -1) {// 针对谷歌浏览器
|
Evn.doc.blur();
|
}
|
})
|
}
|
if (fieldtype == 43) {//43控件特殊处理
|
panPar.select2PostValue(field, fieldtype, "", pindex, true, function (json) {
|
let select2Evt=$("#"+field);
|
if (select2Evt) {
|
$(select2Evt).empty();//清空之前的option值
|
for (var i = 0; i < json.length; i++) {
|
$(select2Evt).append('<option value="' + json[i].id + '">' + json[i].text + '</option>');
|
}
|
//有值的情况赋值
|
panIndex=pindex;
|
var valt = $doc(field + 'text').val();
|
valt = (valt == null ? "" : valt);
|
if (valt == '' && formType == 38) {
|
valt = panMain[panIndex].SpecialType[field] != null ? panMain[panIndex].SpecialType[field] : '';
|
}
|
if (valt != '') {
|
valt = valt.replace(/,/g, ";").split(';');
|
}
|
$(select2Evt).val(valt).trigger('change');
|
}
|
});
|
}
|
}catch(e){
|
$.messager.alert("操作提示","获取31控件下拉数据出错!"+e,"warning");
|
}
|
},
|
//下拉数据请求 xin 2023-7-18 16:12:54
|
select2PostValue:function (field, fieldtype, addOptin, pindex,isAsync,callback){
|
url = document.URL;
|
url = url.substring(0, url.lastIndexOf("/") + 1);
|
let params = panPar.getParameter()//获取面板控件所有值
|
let state = $doc(field).disabled();//当前控件的状态 如:1只读 ,0可编辑
|
let fieldName = '';
|
panIndex = pindex;//还原当前控件所在的索引
|
if (panMain[panIndex].panInfo[field] != null) {
|
fieldName = panMain[panIndex].panInfo[field].title;
|
}
|
$.ajax({
|
url: url + panMain[panIndex].controlUrl,// 跳转到对应功能号的panelControlxxxxxx.jsp
|
data: {
|
'field': field,//控件ID
|
'fieldname': fieldName || '',//控件名称
|
'fieldtype': fieldtype,//控件类型
|
'callback' :addOptin,
|
'params': params,//页面控件值(全部)
|
'state': state//当前状态值
|
},
|
type: "POST",
|
async:isAsync,
|
dataType: 'json',
|
success: function (data) {
|
if (data.status == 0) {
|
callback(data.info);
|
}else{
|
if (data.info != "") {
|
$.messager.alert("操作提示",data.info,"warning");
|
}
|
}
|
}
|
});
|
},
|
//43控件渲染数据-xin 2017-11-2 14:59:44
|
getSelect2 : function(field, fieldtype, targetControl, callback, pindex,css){
|
panIndex = pindex;//还原当前控件所在的索引
|
try {
|
let that = this;
|
let allValue = [];//全选的值
|
let Evn = $doc(field);//获取控件对象
|
let select2Evt = $(Evn.doc).select2({//43控件初始化
|
placeholder: "---请选择---",
|
allowClear: true,
|
language: "zh-CN",
|
tags: true,//这个参数的效果应该是,自定义内容选项卡
|
closeOnSelect: false,
|
multiple: true,
|
containerCssClass: css, //自定义css
|
minimumResultsForSearch: 3//当下拉数量大于等于10时显示刷选框,设置了multiple=true无效
|
}).on('select2:open', function (e) {//43控件单击事件
|
//查询
|
that.select2PostValue(field, fieldtype, "", pindex, true,function (json) {
|
// 原先的值 2019-4-2 14:50:53
|
var original = $(select2Evt).select2('val');
|
$(select2Evt).empty();//清空之前的option值
|
//循环option赋值
|
for (var i = 0; i < json.length; i++) {
|
$(select2Evt).append('<option value="' + json[i].id + '">' + json[i].text + '</option>');
|
if (json[i].id != -1) {
|
allValue.push(json[i].id);
|
}
|
}
|
//选中之前的值
|
$(select2Evt).val(original).trigger('change');
|
});
|
}).on("select2:select", function (evt) {
|
var data =evt.params.data;
|
if (data.id == -1) { //新增全部 xin 2023-6-2 14:29:54
|
$(this).select2("val", [-1]); //清空其他选项
|
$(this).val(allValue).trigger("change");
|
return;
|
}
|
var original = $(this).select2('val') || [];//已经被选中的值.不存在就实例化
|
original.push(data.id);//添加进去
|
$(this).val(original).trigger("change");
|
getSelect31(field);//43控件关联31控件 xin 2022-4-1 17:06:04
|
panMain[panIndex].isChange = 1;
|
}).on("select2:unselect", function (evt) {
|
var original = $(this).select2('val');//已经被选中的值
|
if (original == null) {
|
return;
|
}
|
var data =evt.params.data;
|
if (data.id == -1) { //新增全部 xin 2023-6-2 14:29:54
|
$(this).select2("val", [-1]); //清空其他选项
|
$(this).val([]).trigger("change");
|
return;
|
}
|
original = $.grep(original, function (value) {
|
return value !== data.id; // 删除值为data.id的元素
|
})
|
$(this).val(original).trigger("change");//
|
panMain[panIndex].isChange = 1;
|
});
|
//这里异步加载数据回来填充 xin 2023-7-18 15:41:13
|
let async = (formType != 18 ? true : false);//默认是异步请求,18窗体特殊处理下 xin 2023-7-19 17:25:05
|
let selectId = panMain[pindex].select;//存在级联问题 就同步加载
|
async = selectId[field] != null ? false : async;
|
that.select2PostValue(field, fieldtype, "", pindex, async, function (json) {
|
if (select2Evt) {
|
$(select2Evt).empty();//清空之前的option值
|
for (var i = 0; i < json.length; i++) {
|
$(select2Evt).append('<option value="' + json[i].id + '">' + json[i].text + '</option>');
|
}
|
//有值的情况赋值
|
panIndex=pindex;
|
var valt = $doc(field + 'text').val();
|
if (valt == '' && formType == 38) {
|
valt = panMain[panIndex].SpecialType[field] != null ? panMain[panIndex].SpecialType[field] : '';
|
}
|
if (valt != '') {
|
valt = valt.replace(/,/g, ";").split(';');
|
}
|
$(select2Evt).val(valt).trigger('change');
|
}
|
});
|
} catch (e) {
|
$.messager.alert("操作提示", "获取43控件下拉数据出错!" + e, "warning");
|
}
|
},
|
getColors46:function(filed){
|
let evnt=$("#"+filed);
|
evnt.css("background-color",evnt.val());
|
evnt.css("color",evnt.val());
|
},
|
// 针对多面板情况进行获取参数值
|
getParameter : function(){
|
var item={};
|
var info=[];
|
try{
|
// 循环页面面板
|
for(var p in panMain ){
|
panIndex=p;
|
this.panInfo=panMain[p].panInfo;//获取每一个面板控件集合
|
info.push(this.getPanMap_All());
|
}
|
// 有相同的属性则略过
|
if(info.length>1){
|
for (var i = 0; i < info.length; i++) {
|
for (var k in info[i]) {
|
if (item.hasOwnProperty(k)) {
|
continue;
|
}
|
item[k] = info[i][k];
|
}
|
}
|
}else{
|
item=info[0];
|
}
|
return obj2str(item);
|
}catch(e){
|
$.messager.alert("操作提示","31控件下拉查询参数出错"+e,"warning");
|
return;
|
}
|
},
|
getWhere : function(ben, wai, zi, g, p, id) {
|
var where = this.getOutWhere(ben, wai, zi, ' and ', id, true);
|
var where2 = "";
|
if (where.indexOf("|") == -1 && openTree) {
|
where2 = this.getOutWhere(g, p, '', ' and ', id, false);
|
}
|
where += where2;
|
return where;
|
},
|
// 条件(本身,外表,自定义,连接符,是否强制录入)
|
getOutWhere : function(ben, wai, zi, addFuHao, id, qianzhi) {
|
openTree = true;
|
var bens = ben.split(";");
|
var wais = wai.split(";");
|
var where = "";
|
var col = "";
|
var value = "";
|
var colDan = "";
|
for (i = 0; i < bens.length; i++) {
|
col = bens[i].toLowerCase();
|
if (col.Trim() != "") {
|
value = getDoc(col, ".value");
|
// 针对 300029 资金帐户
|
if (value == null) {
|
value = col;
|
}
|
if (qianzhi) { // 强制判断
|
// if (id != col) { //注释 注释原因:在18窗体执行三点弹出过到另一个18窗体会导致获取字段在另一个18窗体查询不到 xin 2023-6-7 16:24:32
|
// if (value != "") {//注释原因:强制判断进入时候 值是空值也进行组装,空值不应该出现页面提示 xin 2024-7-2 14:52:27
|
if (value != null) {
|
where += wais[i] + " like '" + "@~" + value + "@~'"
|
+ addFuHao;// and
|
} else {
|
// $.messager.alert("操作提示", this.panInfo[col].title + "没有录入!", "warning");
|
$.messager.alert("操作提示", this.panInfo[col].title + "控件不存在,请检查。", "warning");
|
openTree = false;
|
break;
|
}
|
// } else {
|
// // by danaus 2017-7-21 替换^
|
// colDan = "@G@" + wais[i] + " like '" + "@~"+ value + "@~'";
|
// }
|
} else {
|
if (id == col && value != "" && value != "pb_xinzen") { // 是当前字段且不为空才操作
|
colDan = "@G@" + wais[i].toLowerCase() + " like '"+ "@~"+ value + "@~'";
|
}
|
}
|
}
|
}
|
if (zi.Trim() != "") {
|
where += zi + addFuHao;// 追加自定义条件
|
}
|
where = where.substring(0, where.length - addFuHao.length);
|
where += colDan;
|
return where;
|
},
|
//38;238;18;7;19;77窗体进入where条件取值查询
|
keyWhere : function(boo, cols, colsInDate) {
|
var where = "";//组装语句
|
var fieldId=null;//字段Id
|
var value = null;//字段值
|
var fieldType=0;//控件类型 xin 2019-12-9 16:54:53
|
let keyinput=0;
|
try{
|
for (var i = 0; i < cols.length; i++) {
|
if (cols[i] != "") {
|
fieldId = cols[i];
|
if (panMain[panIndex] != null && panMain[panIndex].panInfo[fieldId] != null) {
|
fieldType = panMain[panIndex].panInfo[fieldId].controltype;//获取类型
|
keyinput=panMain[panIndex].panInfo[fieldId].keyinput;
|
}
|
value = doc(fieldId).value.Trim();//获取值
|
|
// 43控件获值
|
if (fieldType == 43) {
|
value = $("#" + fieldId).val();
|
if (value != null && value != "") {
|
if (value instanceof Array) {
|
value = value.join(";");
|
}
|
}
|
}
|
//19窗体xxxDate获值
|
if (parent.form_type == 19) {
|
if (doc(fieldId + "Date") != null) {
|
value = value.split(" ")[0] + " 00:00:00";
|
}
|
}
|
//客户说看到很烦,暂时注释 xin 2023-11-24 17:25:49
|
// if (value == "" && keyinput == 1) {//必录提示 xin 2023-9-18 16:52:21
|
// let isHiden = $("#" + fieldId).prop("type");
|
// if (isHiden && isHiden != "hidden") {//不是隐藏字段的必录就要提示出来
|
// layer.msg('页面有必录字段没有录入,可能会导致数据出错。');
|
// }
|
// }
|
where += colsInDate[i] + "='" + value + "' and ";
|
}
|
}
|
try{
|
//窗体18设置外条件 xin 2022-7-27 15:51:54
|
if (typeof where18 != 'undefined' && where18 != null && where18 != 'null') {
|
where = where.substring(0, where.lastIndexOf("and"));
|
where += "!" + where18 + " and ";
|
}
|
}catch (e) {
|
console.log(e);
|
}
|
}catch(e){
|
$.messager.alert("操作提示", "字段:"+fieldId+"在获取值进行查询的时候出现了错误。检查页面是否存在这个字段或检查设置是否出现控件位置重叠。","warning");
|
}
|
return where;
|
},
|
// 获得sql参数 这个函数应该是为了31,43等类型控件获取动态sql调用的,但好像又不调用这个函数反而调用下面面板的了。
|
getSqlMap : function() {//获取是496窗体这里获取不到全部面板控件的值 调用getPanMap_All比较好
|
var value = "";
|
var item = {};
|
var inMap = null;
|
var noCol = "";
|
var panInfo = this.panInfo;
|
for ( var i = 0; i < panMain[panIndex].sqlParam.length; i++) {
|
inMap = panInfo[panMain[panIndex].sqlParam[i]];
|
switch (parseInt(inMap.controltype)) {// 针对不同类型有不同的货值方法?赋值方法!
|
case 37:
|
value = get37Value(key);
|
// 添加触发空间值
|
set_37ckChang(key);
|
break;
|
case 34:
|
case 38:
|
value = "******";// 借助这个值不保存
|
break;
|
case 43:
|
value=$("#"+key).val();
|
if(value!=null && value!=""){
|
if(value instanceof Array){
|
value=value.join(";");
|
}
|
}
|
break;
|
default:
|
value = getDoc(key, '.value');
|
break;
|
}
|
if (typeof value == 'undefined') {
|
noCol += key + ","
|
}
|
value = (value != null) ? value.Trim() : null;
|
item[key] = value;
|
// 权限控制是否能修改 xin 2018-12-9 11:23:32
|
if($('#'+key+'_expr').length>0 && $('#'+key+'_expr').val()=='0'){
|
delete item[key];
|
}
|
}
|
if (noCol != "") {
|
$.messager.alert("操作提示", noCol + "这些字段在页面上没有,区分大小写,请检查!","warning");
|
}
|
return item;
|
},
|
// 获得面板集合 参数获取面板值都在这里执行
|
getPanMap_All : function() {
|
var value = "";
|
var item = {};
|
var inMap = null;
|
var noCol = "";
|
var panInfo =this.panInfo;
|
try{
|
for ( var key in panInfo) {
|
inMap = panInfo[key];
|
switch (parseInt(inMap.controltype)) {// 针对不同类型有不同的货值方法
|
case 6://复选框
|
value=$('#'+key).val();
|
break;
|
case 37:
|
value = get37Value(key);
|
// 添加触发空间值
|
set_37ckChang(key);
|
break;
|
case 34:
|
case 38:
|
value = "******";// 借助这个值不保存
|
break;
|
case 40://图片浏览控件获取值 -xin 2020-6-15 17:25:30
|
value = $doc(key).src();
|
break;
|
case 41:
|
continue;
|
case 43:
|
value=$("#"+key).val();
|
if(value!=null && value!=""){
|
if(value instanceof Array){
|
value=value.join(";");
|
}
|
}else{
|
value="";
|
}
|
break;
|
default:
|
//有索引是1表示为多表的情况
|
if(panMain[1] != undefined){
|
value = $doc(key).val();// 根据索引控件来取值
|
if (value == '' && key != 'docversion') {//把子功能面板的版本号字段排除 xin 2022-5-30 09:56:24
|
value = getDoc(key, '.value');
|
}
|
} else {
|
value = getDoc(key, '.value');
|
if (typeof value == 'undefined') {//上面的取值如果出现两个相同的key但不相同的标签时候就会导致获取失败,用JQ方法在获取一次 xin 2022-6-1 09:35:23
|
// value = $("#" + key).val();
|
value = $doc(key).val();
|
}
|
}
|
break;
|
}
|
if (typeof value == 'undefined') {
|
noCol += key + ","
|
}
|
value = (value != null) ? value.Trim() : null;
|
item[key] = value;
|
//感应字段或特殊字段不需要提交到后台的处理 xin 2021-3-10 09:40:42
|
this.specialInductionFields(item,key,inMap.datalink);
|
}
|
}catch(e){
|
$.messager.alert("操作提示", '获得面板集合出现字段获取错误:'+e,"warning");
|
return;
|
}
|
if (noCol != "") {
|
$.messager.alert("操作提示", noCol + "这些字段在页面上未能发现,检查是否区分大小写或检查是否重叠了控件位置!","warning");
|
}
|
return item;
|
},
|
//这个函数对单据类型窗体的一些感应字段或特殊字段不需要提交到后台的处理;xin 2021-3-10 09:28:52
|
specialInductionFields : function(item,key,datalink){
|
try {
|
//处理不勾选感应的字段(个别窗体如:22类型 10类型需要排除)
|
// 0表示不需要对该字段进行提交处理
|
// 1表示需要提交该字段。
|
if (datalink != null && datalink == 0 && formType != 22 && formType != 10) {
|
delete item[key];
|
}
|
// 权限控制是否能修改 xin 2018-12-9 11:23:32
|
if ($('#' + key + '_expr').length > 0 && $('#' + key + '_expr').val() == '0') {
|
if ($('#' + key + '_expr_val') != null) {//是加密的需要提交
|
item[key] = $('#' + key + '_expr_val').val();
|
item[key + '_expr'] = 0;
|
} else {
|
delete item[key];
|
}
|
}
|
//是单据类型窗体进入(特殊字段处理)xin 2021-3-10 10:00:26
|
if (';5;8;16;496;'.indexOf(';' + formType + ';') != -1) {
|
key = key.toLowerCase();//转小写
|
switch (key) {
|
case 'qrcode' ://特殊字段,如果还有其他字段则在这个下面添加
|
// case 'xxx' :
|
delete item[key];
|
break;
|
default:
|
break;
|
}
|
}
|
} catch (e) {
|
$.messager.alert("操作提示", key + "字段进行感应过滤时出现问题。", "warning");
|
}
|
},
|
getBack : function(e, id) {
|
if (getBackBool) {
|
var pi = this.panInfo[id];
|
var biao = pi.ft;
|
var col = id;
|
var waiziduan = pi.fk;
|
var benziduan = pi.seekgroupid.toLowerCase();
|
var tjz = pi.spremissfield;
|
var tjw = pi.dpremissfield;
|
var tjd = pi.efilter;
|
var event = $.event.fix(e);
|
var v_ = getDoc(col, '.value');
|
if (this.id != id || this.value != v_ || event.keyCode ==13 ) {
|
this.id = id;
|
this.value = v_;
|
if ((";8;".indexOf(";" + event.keyCode + ";") == -1)) {// 不是退格键
|
if ((getBackElse && v_ != "")
|
|| (";13;9;".indexOf(";" + event.keyCode + ";") != -1)) {// 是三点弹出,非MASTERCODE只有这两种情况触发
|
var tiaojian = this.getWhere(tjz, tjw, tjd, benziduan,
|
waiziduan, col);
|
var url = "/inv.do?id=" + biao + "&where="
|
+ replacePageValue(tiaojian) + "&sel="
|
+ waiziduan + "&get=" + benziduan;
|
// 添加event.keyCode==13是为了防止三点弹出进入两次页卡。-2017-4-26 -xin
|
if (openTree && event.keyCode ==13) {
|
url = encodeURI(encodeURI(url));// 必须两次
|
$.post(url, '', function(date) {
|
getBackElse = false;
|
callBack(col, date);
|
getSelect31(col);//关联有31需要执行
|
});
|
}
|
}
|
}
|
getBackElse = false;
|
}
|
}
|
},
|
getBackAll : function(e, id) {
|
if (getBackBool) {
|
var pi = this.panInfo[id];
|
var biao = pi.ft;
|
var col = id;
|
var waiziduan = pi.fk;
|
var benziduan = pi.seekgroupid;
|
var tjz = pi.spremissfield;
|
var tjw = pi.dpremissfield;
|
var tjd = pi.efilter;
|
var event = $.event.fix(e);
|
var v_ = getDoc(col, '.value');
|
if (this.id != id || this.value != v_) {
|
this.id = id;
|
this.value = v_;
|
if ((";8;".indexOf(";" + event.keyCode + ";") == -1)) {// 不是退格键
|
if ((getBackElse && v_ != "")
|
|| (";13;9;".indexOf(";" + event.keyCode + ";") != -1)) {// 是MASTERCODE可以让其多出一种方式带出值
|
var tiaojian = this.getWhere(tjz, tjw, tjd, benziduan,
|
waiziduan, col);
|
var url = "/invAll.do?id=" + biao + "&where="
|
+ replacePageValue(tiaojian);
|
if (openTree) {
|
url = encodeURI(encodeURI(url));// 必须两次
|
$.ajaxSettings.async = false;//同步
|
$.post(url, '', function(date) {
|
getBackElse = false;
|
callBack(col, date,waiziduan,benziduan);
|
if(panMain[panIndex].formtypeOne==10 && event.keyCode ==13){//针对10窗体个别操作不保存 xin 2020-10-13 14:38:01
|
panMain[panIndex].isChange=0;
|
}
|
if(event.keyCode ==13){
|
getSelect31(id);
|
}
|
});
|
$.ajaxSettings.async = true;
|
}
|
}
|
}
|
getBackElse = false;
|
}
|
}
|
},
|
// 非加载才进入//,colStr,guanColStr
|
////每一个控件的onChang事件进入
|
set_upSub : function(op) {
|
var pi = this.panInfo[op];
|
if(pi==undefined){
|
pi=panMain[gtss].panInfo[op];
|
}
|
shx=true;
|
top.myFresh.panel[top.tabindex+'-t']=true;// 页卡关闭获取面板是否有内容改变。
|
var xinzen_v = $doc(op).val();
|
if (xinzen_v == "pb_xinzen") {// 为下拉控件的<<新增>>处理 (2控件或31控件)
|
if (pi.ft < 0) {
|
parent.addTab("", 9815, 10, "wherePan=dictid=" + pi.ft);
|
} else {
|
this.windowOpen(pi, true);// 三点回带值
|
}
|
} else {//
|
if (no_load_first) {
|
this.isChange = 1;// 分为两个面板,可有是在另个面板赋值给第个面板(已经加载完) 则会触发
|
// 要不让起触发
|
var value = "";
|
var pi = this.panInfo[op];
|
if(pi==undefined){
|
pi=panMain[gtss].panInfo[op];
|
}
|
var guanCol = "";
|
if(pi!=undefined){
|
guanCol= pi.emptyrefdata.toLowerCase();
|
if(pi.controltype==31){//31类型特殊处理。
|
value=$doc(op).val();
|
$doc(op+'text').val(value);
|
}
|
if(pi.controltype==2){//处理2类型关联字段问题 xin 2021-4-19 15:52:10
|
if (this.select[op]!=null){//有关联字段
|
getSelect31(op);
|
}
|
}
|
}
|
var szc = null;
|
// 后添加与表格的处理
|
var hasB = null;
|
value = getDoc(op, ".value");
|
if (this.formtypeOne == 1) {
|
setPanel301 = true;
|
}
|
if (setPanel301 && gridToPanel) {
|
var st = [];
|
var val = [];
|
st.push(op);
|
val.push(value);
|
if (Grids.length > 0) {
|
mygrid.recalPanel301(st, val);
|
}
|
setPanel301 = false;
|
}
|
if (guanCol != "") {
|
if (guanCol.indexOf('|') != -1) {// 后加
|
hasB = guanCol.split('|');
|
if (hasB[0] == 'recalcuitem' && gridToPanel) {
|
// mygrid.recalcuitem(cols[i],value);//改变时调用
|
}
|
szc = hasB[1].split(";"); // 多加判断
|
} else {
|
if (guanCol == 'recalcuitem#' && gridToPanel) {// #号是特别加
|
// 的,以此判断页面是否有这个变量
|
// mygrid.recalcuitem(cols[i],value);//改变时调用
|
szc = "".split(";");
|
} else {
|
szc = guanCol.split(";");
|
}
|
}
|
if (value == "") {
|
for ( var j = 0; j < szc.length; j++) {
|
if (szc[j].indexOf("#") == -1) {// 是3类型控件才执行
|
no_load_first = false;// 不要让底下赋值再进入此方法,避免死循环
|
// if (formType != 496)// 这条件是如果496的其他页卡文本框填写信息后,光标离开导致主面板42类型控件的信息清空。(已不需这样排除)
|
setDoc(szc[j], ".value=''");// 解决三点弹出清空关联
|
} else {
|
$.messager.alert("操作提示", cols[i]
|
+ "字段的清空关联字段"
|
+ szc[j]
|
.substring(0, szc[j].length - 1)
|
+ "在页面上没有!", "warning");
|
}
|
}
|
no_load_first = true;// 但还是还原,以被后面程序使用
|
}
|
}
|
}
|
}
|
},
|
// 设置只读,加载用(加载9802设置的内容)
|
set_read_load : function(readList, docstatePan, isnew, db, info) {
|
// reads拆分0:【0不是只读;pb#用docstatus控制是否可编辑|多值用分号(;)隔开;pb#字段Id;pb#是否设置了按钮;pb#控件类型】
|
// redds拆分1:【1是只读;pb#字段Id;pb#控件类型】
|
// redds拆分2:【2是OA审核按钮;pb#有按钮的字段Id;pb#buttonID按钮的Id;pb#OA审核按钮设置用docstatus控制是否可显示|多值用分号(;)隔开】
|
// var readList = reads;//reads.split(";fen#");
|
var readIs = null;
|
var buttonHid = false;// 按钮隐藏
|
var pan = false;
|
var buttonId = "";
|
var oacopy="";
|
var getBool = no_load_first;
|
no_load_first = false;// 只有加载时触发此事件,表明其为加载时,防止程序未知处把其值改了
|
var filedIs = null;
|
var bzc = true;
|
var hasExpr = false;//表达式值
|
//如果是496类型的话,docstatePan有可能在子表的时候获取不到值,导致状态值不对,所以在这样获取主表里的docstaePan值 xin 2021-12-20 10:22:33
|
docstatePan=getDoc("docstatus",".value");// 获取单据的单据状态
|
docstatePan=(docstatePan==""?0:docstatePan);
|
if (readList != null && readList.length > 0) {
|
for ( var i = 0; i < readList.length; i++) {
|
hasExpr = false;
|
if (readList[i] != "") {
|
readIs = readList[i];// .split(";pb#");
|
// readIs[0]的值:0是可编辑 ,1是只读,2有OA审核按钮设置
|
switch (parseInt(readIs[0])) {
|
case 0://可编辑状态
|
if (this.formtypeOne != 1) {
|
let exprValue = getDoc(readIs[2] + '_expr', '.value');//权限表达式 0隐藏,1显示,2可编辑
|
if (exprValue != null) {//有设置到表达式
|
if (exprValue == "") {
|
hasExpr = true;//可编辑状态
|
} else if (exprValue == 2) {
|
hasExpr = true;//可编辑状态
|
}
|
} else {
|
hasExpr = true
|
}
|
if (hasExpr) {//权限表达式 true可编辑状态
|
//这个curchecker字段表示当前审核人字段
|
this.setRead(readIs[1], docstatePan, isnew, readIs[2], readIs[3], 'curchecker', db, parseInt(readIs[4]));
|
} else {//false表示只读
|
this.setReadOnly(readIs[2], parseInt(readIs[4]));// readIs[3]
|
}
|
this.hasStyleCss(readIs[2]);//stylecss处理
|
}
|
break;
|
case 1:// 只读设置
|
this.setReadOnly(readIs[1],readIs[2]);
|
this.hasStyleCss(readIs[1]);//stylecss处理
|
break;
|
case 2:// 逐一按钮设置(按钮)
|
// 增加info信息判断按钮,为1继续,否则隐藏跳开
|
filedIs = readIs[2];// readIs[1]+readIs[2]+'Button';
|
if (info != null && info.length > 0) {
|
for ( var j = 0; j < info.length; j++) {
|
if (info[j].filed == filedIs) {// 查看此按钮的设置
|
bzc = (info[j].value == "1") ? true : false;
|
if (info[j].value == "1") {//这里判断把,放在下面bzc判断有问题。xin 2021-11-20 11:19:03
|
//显示审核按钮 xin 2021-10-21 17:23:17
|
$(".OAVerify").css("display", "inline-block");
|
//显示下一单按钮 xin 2022-7-30 11:47:49
|
$(".nextDocIco").css("display", "inline-block");
|
}
|
break;
|
}
|
}
|
}
|
if (bzc) {
|
// pan = this.zhuYi(filedIs, readIs[3],
|
// docstatePan,
|
// 'curchecked', db);
|
} else {
|
bzc = true;
|
pan = true;// 则为隐藏
|
setDoc(filedIs, ".style.display='none'");
|
}
|
if (buttonId == readIs[1]) {// 第一个判断按钮是不会进入的
|
buttonHid = buttonHid ? pan : false;// 当有一个按钮显示,则控件为原长
|
} else {
|
set_buttonHid(buttonHid, buttonId);// 进入这为第二个控件按钮了
|
buttonId = readIs[1];
|
buttonHid = pan;// 这总为是控件的第一个按钮
|
}
|
// 处理不是审核人 这个id还是显示的是可编辑状态
|
// 。不是审核人,有OA审核的控件应该是只读状态
|
if(!isNaN(readIs[2])){
|
if(readIs[1]!=oacopy){
|
// 查找面板在这个id里面是否有审核按钮ID没有说明这个id在这个账号没权限编辑 只能是只读状态
|
if(doc(readIs[2]) == null){
|
setDoc(readIs[1], ".readOnly =true");// 设置为只读
|
setDoc(readIs[1], ".style.backgroundColor ='#CCC'");
|
}else{
|
setDoc(readIs[1], ".readOnly =false");
|
setDoc(readIs[1], ".style.backgroundColor ='#FFFFFF'");
|
oacopy=readIs[1];
|
//审核按钮过长情况,设置控件宽度
|
var widthId=$("#"+readIs[1]).width();
|
if(widthId!=null && widthId>0){
|
$("#"+readIs[1]).width(widthId/2+200);
|
}
|
}
|
}
|
}
|
break;
|
}
|
}
|
}
|
set_buttonHid(buttonHid, buttonId);// 按钮全隐藏的
|
// 这可能是最后一个有按钮的控件没有判断到
|
}
|
//31控件新的加载方式 xin 2020-9-18 16:45:00
|
try{
|
var panc = panMain[panIndex].panInfo;
|
if (panc != undefined) {
|
for (var k in panc) {//遍历每一个控件是否关联有下拉需要到的替换值
|
//if(panc[k].controltype==31 || panc[k].controltype==2){
|
var v = $doc(k).val();
|
if (v != null) {
|
getSelect31(k);
|
}
|
//}
|
}
|
}
|
}catch(e){}
|
if(top.myFresh!=null){
|
top.myFresh.panel[top.tabindex+'-t']=false;// 页卡关闭获取面板是否有内容改变。
|
}
|
no_load_first = getBool;// 当然事情完了,还是还原其本来值
|
},
|
hasStyleCss:function(id){//处理stylecss
|
let cssArray = "";
|
let css = getDoc(id, ".style");// 控件样式
|
if (getDoc(id + '_css', '') != null && getDoc(id + '_css', '.value') != "") {// css样式
|
for (var r = 0; r < css.length; r++) {
|
cssArray += css[r] + ":" + css[css[r]] + ";";// 组装
|
}
|
cssArray += getDoc(id + '_css', '.value');
|
setDoc(id, ".style='" + cssArray + "'");// 赋值最新的控件样式css
|
} else {
|
let cssm = panMain[panIndex].panInfo[id];
|
if (cssm != null) {
|
cssm = cssm.stylecss;
|
}
|
if (cssm != null && cssm != '') {
|
for (var r = 0; r < css.length; r++) {
|
cssArray += css[r] + ":" + css[css[r]] + ";";// 组装
|
}
|
cssArray += cssm;
|
setDoc(id, ".style='" + cssArray + "'");// 赋值最新的控件样式css
|
}
|
}
|
},
|
hasIn : function(str, strs) {
|
var strti;
|
for ( var j = 0; j < strs.length; j++) {
|
strti = strs[j].toLowerCase().Trim();// alert(strti+"----"+usercode);
|
if (strti != "" && strti == str) {
|
return true;
|
}
|
}
|
return false;
|
},
|
zhuYi : function(id, statepan, docstatePan, curchecker, usercode) {// ,NeedRelease,CurChecked,CurChecker
|
var states = statepan.split(";");
|
var may = true;
|
var mayHas = this.isHasTo(curchecker, usercode, false);// 是否检查过
|
var curHas = false;// 是否是检查人
|
if (getDoc('curchecker', '.value') == "all") {
|
curHas = true;
|
} else {
|
// curHas = this.isHasTo('curchecker', usercode, false);//
|
// 是否是检查人 注释时间:2014-6-12 10:13:03
|
}
|
for ( var i = 0; i < states.length; i++) {// isNewOpen参数已经没有作用,程序未改动(保留)
|
if (states[i] != "" && docstatePan == parseInt(states[i])) {// 符合一个状态就进入
|
var isZhu = (getDoc('needrelease', "") == null || getDoc(
|
'needrelease', ".value") == "1") ? true : false;
|
var cured = (getDoc('curchecked', "") == null) ? "" : getDoc(
|
'curchecked', ".value");
|
var cur = (getDoc('curchecker', "") == null) ? "" : getDoc(
|
'curchecker', ".value");
|
if (isZhu && curHas) {// 如果是逐一审核,并且是检查人
|
var shenS = cur.split(',');
|
for ( var i = 0; i < shenS.length; i++) {
|
if (cured.indexOf(shenS[i]) == -1) {// 需审核人在已审核人中不存在则未全部审核
|
may = false;// 返回假停留,显示按钮
|
// setDoc(id,".style.display = 'block'");//
|
break;
|
}
|
}
|
} else {// 不是逐一审核默认就可以吧
|
// 后加让当前状态,属于可以检查的人时的按钮显示
|
if (curHas) {// 是检查人
|
may = false;
|
// setDoc(id,".style.display = 'block'");//
|
}
|
}
|
break;// 有一个符合就可了,不跳出可能又把它隐藏了
|
}
|
}
|
if (id != '') {
|
if (may) {// 不符合还是把它隐藏
|
setDoc(id, ".style.display = 'none'");//
|
} else {
|
setDoc(id, ".style.display = 'block'");
|
}
|
} else {
|
if (statepan == "") {
|
may = false;
|
}
|
}
|
return may;
|
},
|
// 1,登陆人状态2为控件状态3是否新单4是否有按钮
|
setRead : function(statepan, docstatePan, isNewOpen, id, hasbutton, curchecker,
|
usercode, type) {// 判断按钮以及是否可以输入状态(301101)
|
hasButton = hasbutton;
|
var states = statepan.split(";");
|
var may = false;// false就执行匹配
|
//获取当前审核人字段值
|
if (getDoc(curchecker, '.value') == "all") {
|
may = true;
|
} else {
|
may = this.isHasTo(curchecker, usercode, false);//审核填写审核信息。
|
}
|
// var creater = this.isHasTo('createusercode', usercode, false);
|
// false就执行匹配 //注释掉是因为已经没了那个字段。
|
for ( var i = 0; i < states.length; i++) {// isNewOpen参数已经没有作用,程序未改动(保留)
|
if (docstatePan == states[i]) {
|
this.setNotReadOnly(id, type);// 不为只读
|
setDoc(id, ".disabled =false");// 没有被设置就启用
|
if (docstatePan != 0 && !may) {// 这等于已经还原按钮之后,看看当前人是否为可以使用按钮
|
seltboo=true;// 修改权限 2015-5-19 18:05:41 --- xin
|
this.setReadOnly(id, type);// 这中无审核权力的也为只读
|
if (doc('tpSave') != null) {
|
doc('tpSave').style.display = 'none';// 保存按钮隐藏
|
}
|
}
|
break;
|
} else {
|
this.setReadOnly(id, type); // 设置只读,里面包含控制按钮
|
}
|
}
|
if (docstatePan < 0) {// 驳回时,隐藏保存按钮
|
if (document.getElementById('tpSave') != null) {
|
document.getElementById('tpSave').style.display = 'none';// 保存按钮隐藏
|
}
|
}
|
hasButton = false;// 还原,这样写这是为在生成静态页面避免传太多参数
|
},// id 与控件类型 只读
|
setReadOnly : function(id, type) {// 添加一个在生成静态页面时的只读,(很多在生成页面考虑不完全,直接到js中添加吧)
|
this.setReadOK(id, type, true)
|
},// id 与控件类型 反过来设置为不为只读
|
setNotReadOnly : function(id, type) {// 添加一个在生成静态页面时的只读,(很多在生成页面考虑不完全,直接到js中添加吧)
|
this.setReadOK(id, type, false)
|
},
|
checkDocStatus : function(id,boo,type) {
|
if (formType && (formType == 5 || formType == 9
|
|| formType == 15 || formType == 8
|
|| formType == 496 || formType == 497
|
|| formType == 16 || formType == 17)) {
|
docstatePan = getDoc("docstatus", ".value");// 获取单据的单据状态
|
var stats = panMain[panIndex].picState[id];
|
if (stats) {
|
var temp = stats.split("pb#");
|
|
if ((";" + temp[1] + ";").indexOf(";" + docstatePan + ";") > -1)
|
boo = false;
|
else
|
boo = true;
|
}
|
}
|
if (boo) {
|
try {
|
fileupload_config.browseOnZoneClick = false; // true为只读状态
|
} catch (e) {
|
alert(e);
|
}
|
$("#" + id).attr("data-readonly", boo);//是否只读
|
}
|
if (type == 19) {
|
var container = $("#" + id + "_dynamic"); // 隐藏上传浏览框
|
var uploadDiv = container.find(".file-caption-main");
|
if (uploadDiv != null && uploadDiv != undefined) {
|
uploadDiv.hide();
|
}
|
}
|
return boo;
|
},
|
setReadOK : function(id, type, boo) {
|
// 后加把 *****显示的变只读
|
// boo = (getDoc(id, '.value') == "******") ? true :
|
// boo;//如果值就是******的话这写法不成立。 xin 2019-5-25 14:30:54
|
switch (parseInt(type)) {
|
case 6:// 复选框
|
this.setNotReadOnly(id + "CheckBox", "");
|
setDoc(id + "CheckBox", ".disabled =" + boo);// 没办法只能用这个了
|
break;
|
case 2:// 下拉
|
case 31:// 下拉
|
var setl=getDoc(id, '.readOnly');
|
if(typeof setl =='undefined'){ // 修改权限 2015-5-19
|
// 18:05:41 ---
|
// xin
|
if(boo && !seltboo){setDoc(id, ".disabled =true");
|
}else{setDoc(id, ".disabled =false");seltboo=false;
|
}
|
}else{
|
setDoc(id, ".disabled =" + boo);
|
}
|
break;
|
case 3:// 三点弹出
|
setDoc(id + "Tree", ".value = " + (boo ? "0" : "1"));
|
break;
|
case 5:// 日期控件
|
setDoc(id + "Date", ".value = " + (boo ? "0" : "1"));
|
break;
|
case 7:// 多文本控件
|
setDoc(id + "Text", ".value = " + (boo ? "0" : "1"));
|
break;
|
case 9:// 图片类型
|
seltboo=this.checkDocStatus(id,boo,9);
|
break;
|
case 19:// 上传附件
|
seltboo=this.checkDocStatus(id,boo,19);
|
break;
|
case 30:// 多选复选框
|
setDoc(id + "Span", ".disabled = " + boo);
|
checkboxDisabled(id,boo);
|
break;
|
case 32:// 单选按钮组
|
var radios = document.getElementsByName(id + 'Radio');
|
for ( var i = 0; i < radios.length; i++) {
|
setDoc(radios[i].id, ".disabled = " + boo);
|
}
|
break;
|
case 35:// 下拉加可输入
|
setDoc(id + "_35", ".disabled = " + boo);
|
break;
|
case 37:// 富文本
|
setDoc(id + "_spanHid2", ".style.display=" + boo ? "'none'"
|
: "'block'");
|
// setHidOrNot(id+'_hid',id+'_spanHid');
|
break;
|
case 42://
|
setDoc(id, ".disabled = " + boo);
|
break;
|
case 43://
|
$(".js-"+id).prop("disabled", boo);
|
break;
|
case 46://
|
setDoc(id, ".disabled = " + boo);
|
break;
|
default:
|
break;
|
}
|
if(getDoc(id, '.style.backgroundColor')=="" && parseInt(type) !=46){
|
setDoc(id, ".style.backgroundColor =" + (boo ? "'#CCC'" : "'#FFFFFF'")); // 设置背景色
|
}
|
setDoc(id, ".style.color ='#000000'");// 设置字体颜色
|
setDoc(id, ".readOnly = " + boo);// 设置为只读
|
if(seltboo){
|
setDoc(id, ".readOnly =false");// 设置为只读 特殊 前人是否为可以使用按钮2015-5-20
|
// 10:50:26 --xin
|
if(parseInt(type) !=46) {
|
setDoc(id, ".style.backgroundColor ='#FFFFFF'");
|
}
|
seltboo=false;
|
}
|
if (boo) {
|
setDoc(id, ".style.backgroundColor ='#CCC'"); // 设置背景色 xin 2022-6-8 16:49:40
|
setDoc(id+"_click",".style.display='none'");// 设置控件只读的时候右边图标隐藏
|
var link = getDoc(id + '_show_link', '');
|
if (link != null) {
|
var vvv = getDoc(id, '.value');
|
if (vvv != "") {
|
$doc(id + '_Link').html(vvv);
|
$('#' + id + '_show_link').show();
|
$('#' + id + '_show_type').hide();
|
}
|
}
|
}else{
|
setDoc(id+"_click",".style.display='inline'");// 复单的时候右边图标显示
|
if(parseInt(type) !=46){
|
setDoc(id, ".style.backgroundColor ='#FFFFFF'"); // 不是只读状态,设置背景色 xin 2022-6-8 16:49:40
|
}
|
}
|
},// 设置读者域:1.读者域(按个人)2.读者域(按角色)3.读者域(按组织架构)4.登录usercode
|
isReadTo : function(ReaderUsercodes, ReaderRoles, ReaderOrganizations) {
|
if (isNew != 1 && ";" == panMain[panIndex].upDoc
|
&& ";" == panMain[panIndex].nextDoc) {// 不为新开单,且无数据为无权限
|
// closeme("抱歉您没有权限查看该单据!");
|
return;
|
}
|
var mayOpen = false;
|
// 检查注释时间 2014-7-4 10:37:46
|
mayOpen = this.isHasTo('readerusercodes', ReaderUsercodes, mayOpen);
|
// 注释时间 2014-7-4 10:37:46
|
mayOpen = this.isHasTo('readerroles', ReaderRoles, mayOpen);
|
// 检查注释时间 2014-7-4 10:37:46
|
mayOpen = this.isHasTo('readerorganizations', ReaderOrganizations,mayOpen);
|
if (hasShezhiZiduan) {
|
var reUsercode = getDoc('readerusercodes', ".value");
|
var reRol = getDoc('readerroles', ".value");
|
var regan = getDoc('readerorganizations', ".value");
|
if (reUsercode == "" && reRol == "" && regan == "") {
|
mayOpen = true;
|
}
|
} else {// 无权限设置字段默认也可看此文档
|
mayOpen = true;
|
}
|
if (isSuperUser!=null){//超级管理员
|
mayOpen = (isSuperUser=='1'?true:mayOpen);
|
if(mayOpen){//是超级管理员但是readerusercodes没有值也不能查看 xin 2023-12-4 09:03:59
|
mayOpen = this.isHasTo('readerusercodes', ReaderUsercodes, mayOpen);
|
}
|
}
|
if (!mayOpen) {// 没有权限看的人直接关闭当前页面,不再提示
|
hasShezhiZiduan = true;
|
Close = true;// 让页面可以直接关闭
|
document.getElementById("scroller").style.display="none";// 隐藏
|
$.messager.alert('提示','你没有权限查看!','info',function(){
|
// 返回
|
top.$('#home-tabs').tabs('close',top.tabindex);
|
});
|
$(".panel-tool-close").css("display","none");
|
}
|
return mayOpen;
|
},
|
//加载初始值 新单进入
|
setDefaultAll : function() {
|
var info =panMain[panIndex].panInfo;//this.panInfo;注释:多表情况
|
var hcol = this.html_Col;//复单后字段
|
var colid = null;
|
var type = null;
|
var initv = "";
|
var dat=[];
|
var typ=[];
|
var t=0;
|
var d=0;
|
let format="";
|
for ( var i = 0; i < hcol.length; i++) {
|
colid = hcol[i].fileid;
|
type = info[colid].controltype;
|
if (info[colid].initValue != "") {
|
initv = info[colid].initValue;
|
}
|
format = info[colid].format;
|
format = format == null ? "" : format;
|
if(initv.indexOf("!") == 0){//出现在最开头0位置就执行查询
|
dat[t]=colid;
|
typ[t]=type;
|
t++;
|
// by danaus 2018-4-22 修改提交方式,适应新tomcat
|
$.ajax({
|
url:"/gtGrid.do",
|
type:"post",
|
async:false,
|
data:"m=heand&_pop_json={"+"'parm':\"" + encodeText(initv.replace(/\\/g,"").replace("!",""))+"\"}" +
|
"&controltype="+type+"&format="+format,
|
dataType:'text',
|
success :function(data){
|
if (data.indexOf("error")!=-1 ) {
|
$.messager.alert("操作提示", data,"warning");
|
} else {
|
if(data==null){data="";}
|
if($doc(colid).val()==''){//解决18窗体传31控件值过来,被有!号的初始值替换了的问题。xin 2020-3-11 14:52:31
|
setDoc(dat[d], ".value='" + data + "'");
|
}
|
if(parseInt(typ[d])==31 || parseInt(typ[d])==2){
|
if($("#"+colid).find("option:selected").val()==undefined){
|
setDoc(dat[d], ".value='" + data + "'");
|
}
|
}
|
if(type==43){
|
if($("#"+dat[d]+"text")){
|
$("#"+dat[d]+"text").val(eval('('+data+')'));
|
}
|
$("#"+dat[d]).val(eval('('+data+')')).trigger('change');
|
panMain[panIndex].panInfo[colid].initValue=eval('('+data+')');
|
}
|
setLoadEven(dat[d], parseInt(typ[d]));
|
d++;
|
}
|
}});
|
}else{
|
switch(parseInt(type)) {
|
case 2:
|
case 31:
|
if (getDoc(colid, ".length") == 0) {
|
setDoc(colid, ".length=0");
|
$doc(colid).optionsAdd(initv,initv);
|
}
|
if (getDoc(colid, ".value") == "") {
|
select_toValue(initv, colid)
|
setLoadEven(colid, parseInt(type));
|
}
|
if($doc(colid+'text').val()==''){//多表
|
$doc(colid+'text').val(initv);
|
}
|
break;
|
case 5:
|
if (format != "") {
|
if (initv != "" && format.split(' ').length == 1) {
|
$doc(colid).val(initv.split(' ')[0]);
|
}
|
}
|
break;
|
case 41:
|
if($doc(colid).html()==''){
|
$doc(colid).html(initv);
|
}
|
break;
|
case 43:
|
if($doc(colid+'text').val()==''){
|
$doc(colid + 'text').val(initv);
|
if (initv != null && initv != "") {
|
try {
|
let value = "";
|
if (initv.indexOf(";") != -1) {
|
value = initv.split(";");
|
} else {
|
value = eval('(' + initv + ')');
|
}
|
$("#" + colid).val(value).trigger('change');//43控件初始值的赋值 xin 2021-10-19 11:40:30
|
} catch (e) {
|
break;
|
}
|
}
|
}
|
if (initv != null && initv != '' && $('#' + colid).prop('type') == 'hidden') {//有可能是隐藏字段 hidden
|
$doc(colid).val(initv);
|
}
|
break;
|
default:
|
if(panMain[1] != undefined){//多表
|
if($doc(colid).val()==''){
|
$doc(colid).val(initv);
|
setLoadEven(colid, parseInt(type));
|
}
|
}else{
|
if (getDoc(colid, ".value") == "") {
|
setDoc(colid, ".value='" + initv + "'");
|
setLoadEven(colid, parseInt(type));
|
}
|
}
|
break;
|
}
|
}
|
initv='';//清空
|
}
|
},
|
htmlGet : function(id) {
|
var valCol = null;
|
var hc = this.html_Col;
|
if (hc != "") {
|
var col = null;
|
for ( var i = 0; i < hc.length; i++) {
|
col = hc[i].fileid;
|
if (id == col) {
|
if (doc(col) != null) {
|
valCol = doc(col).value;
|
}
|
break;
|
}
|
}
|
}
|
return valCol;
|
},
|
panInfoSet : function(c, vS, boo) {
|
var p = this.panInfo;
|
if (c != "") {
|
var valueS = vS;
|
if (boo) {
|
valueS = vS.split(";pb#");
|
}
|
var v_ = "";
|
var col = "";
|
var type = null;
|
var colCom = null;
|
for ( var i = 0; i < c.length; i++) {
|
col = c[i].fileid;
|
type = p[col].controltype
|
if (boo) {
|
v_ = valueS[i];
|
} else {
|
v_ = valueS[col].toString();
|
}
|
v_ = v_.replace(/'+/g, "\\'").Trim();
|
if ((type == "2" || type == "31") && getDoc(col, ".length") == 0) {
|
setDoc(col, ".length=0");
|
$doc(col).optionsAdd(v_, v_);
|
}
|
setDoc(col, ".value='" + v_ + "'");
|
setLoadEven(col, type);
|
}
|
}
|
},
|
windowLink : function(id) {
|
id = id.toLowerCase();
|
var pm =this.panInfo[id];
|
if(pm==undefined){
|
// 循环p是针对选项卡嵌套多个面板里面的值。
|
for(var p=1;p<7;p++){
|
pm=panMain[p].panInfo[id];
|
if(pm!=undefined){break; }
|
}
|
}
|
var bh = pm.hyperlinkft;
|
var bx = pm.hyperlinkftformtype;
|
var bb = pm.hyperlinkspremissfield.split(';');
|
var wb = pm.hyperlinkdpremissfield.split(';');
|
var linkmode=pm.Hyperlinkmode;//操作模式
|
var isAutoRefresh=pm.isAutoRefresh;//执行后刷新
|
var zd = pm.hyperlinkefilter;
|
var paUs = parent.document.URL.split("/");
|
// by danaus 2016-3-29
|
if(bh==""||bh==undefined){$.messager.alert("操作提示", "9802的超链接|外表功能号不能为空","warning");return;};
|
bh = isNaN(bh) ? getDoc(bh.toLowerCase(), '.value') : bh;
|
bx = isNaN(bx) ? getDoc(bx.toLowerCase(), '.value') : bx;
|
var no1=new Array();
|
// by danaus 2019-7-4,解决bb[n].toLowerCase()不是字段名,而是值的情况
|
for(var n=0;n<bb.length;n++){
|
try {
|
if ($("#" + bb[n].toLowerCase()).length > 0) {
|
no1[n] = getDoc(bb[n].toLowerCase(), '.value');
|
} else {// 不存在表示传原值
|
no1[n] = bb[n].toLowerCase();
|
}
|
}catch (e) {
|
no1[n] = bb[n].toLowerCase();
|
}
|
}
|
if(linkmode==1){//直接执行
|
///execProc.do
|
$.post('/execProcV2.do',{'formid':bh,'param':no1.join(';'),'disableDuplicateSubmitUUID':systemUuid.uuid },function(data){
|
if(data.state!=null && data.state==0){
|
let info = data.data;
|
let doc = info.linkdocinfo;
|
let msg = info.memo;
|
if (doc == null || doc == '') {
|
$.messager.show({
|
title: '提示',
|
msg: '<div align="center">' + (msg || '执行完毕!') + '</div>',
|
showType: 'fade',
|
timeout: 1000,
|
style: {
|
right: '',
|
bottom: ''
|
}
|
});
|
// return;
|
}else{
|
$.messager.alert("操作提示", msg, "warning");
|
}
|
}else if(data.state!=null && data.state==-1){
|
let msg = data.error || data.msg;
|
$.messager.alert('提示', msg || '出现错误', "info");
|
}else{
|
$.messager.alert('提示', data.msg || '状态无法识别:' + data.state, "info");
|
}
|
// if(data == null || data == ""){
|
// $.messager.show({
|
// title: '提示',
|
// msg: '<div align="center">' + msg + '</div>',
|
// showType: 'fade',
|
// timeout: 1000,
|
// style: {
|
// right: '',
|
// bottom: ''
|
// }
|
// });
|
// }else{
|
// if (data.error != null && data.error != '') {
|
// $.messager.alert("操作提示", data.error, "warning");
|
// return;
|
// }
|
// let ts = data.data.memo || msg;
|
// $.messager.alert("操作提示", ts, "warning");
|
// return;
|
// }
|
if(isAutoRefresh){
|
setTimeout(function(){location.reload();}, 3000);//三秒后自动刷新
|
}
|
})
|
return;
|
}
|
if(wb!=""){
|
var wh_ = "wherePan=" + wb[0] + "='" + no1[0] + "' and " + (wb[1]!=null?wb[1]:wb[0]) + "='" + (no1[1]!=null?no1[1]:no1[0]) + "'";
|
}
|
if(zd!=""){
|
wh_+=" and ("+zd+")";
|
}
|
if(linkmode==3){//弹出执行界面
|
var url = "/app" + spellPath + bh + "/" + bx + "/index.jsp?"+encodeURL(wh_);
|
showLayerGrid(url,null);
|
return;
|
}
|
//跳转页面
|
// by danaus 2016-3-29
|
if(bh==""||bh==null||bh==undefined){$.messager.alert("操作提示", "页面找不到"+pm.hyperlinkft+",请查看它所在9802中的[加载到页面]选项是否已选上","warning");return;};
|
parent.formNum(getDoc(bb[0].toLowerCase(),'.value'));
|
parent.addTab("", bh, bx, wh_);
|
},
|
// 3类型弹出框
|
windowOpen : function(obj, showBoo,onlyOne) {
|
var pi = null;
|
var id = "";
|
shx=true;
|
top.myFresh.panel[top.tabindex+'-t']=true;// 页卡关闭获取面板是否有内容改变。
|
var flag = checkSession();// session失效后弹出登录框,flag为true时表示已经失效
|
if(flag){
|
return;
|
}
|
var panelObj={};
|
panelObj.panel_onlyOne = onlyOne;
|
panelObj.frameName=parent.jQuery(parent.jQuery(parent.jQuery('#home-tabs').tabs('getSelected'))).attr("id");
|
if(typeof obj =='string'){
|
var flcode = $('#' + obj).data('flcode');
|
var flag = $('#' + obj).data('flag');
|
// 是否有会计科目设置
|
if (flcode != undefined && flag != undefined) {
|
var code = $('#' + flcode).val();
|
if (code == undefined || code == '') {
|
$.messager.alert("操作提示", panMain[panIndex].panInfo[flcode].title + ",不能为空!", "warning");
|
return false;
|
}
|
//根据会计科目取得辅助核算信息
|
$.post('/gtGrid.do?m=gl', {
|
'_pop_json': JSON.stringify({
|
'parm': code,
|
'flag': flag
|
})
|
}, function (data) {
|
if (data != undefined && data != '') {
|
var st = data.split(",");
|
var sf = "";
|
if (st[3] != "" && st[3] != "null" && st[2] != "" && st[2] != "null") {
|
var fk = st[2].split(";");
|
var sd = st[3].split(";");
|
for (var i = 0; i < fk.length; i++) {
|
if (sd[i] != undefined) {
|
var v = $("#" + fk[i]).val();
|
sf += sd[i] + "=" + (v != undefined ? v : "");
|
if ((i + 1) < fk.length) {
|
sf += " or ";
|
}
|
}
|
}
|
}
|
//会计科目需要的信息 xin 2023-7-14 15:20:14
|
panelObj.postToThis = obj + ";" + obj + "name";//操作的三点弹出控件页面的自身字段(固定写法,如:cv1;cv1name)
|
panelObj.panelToPost = st[2] || "";//外表字段 用来取外表值(查询后台得到外表里的外表字段,如 hrcode;hrname)
|
sf = sf != '' ? "?" + encodeText("where=" + sf) : "";
|
var path = "/app" + spellPath + st[0] + "/" + st[1] + "/index.jsp";
|
parent.addTab("", st[0], st[1], "", path + sf, null, null, null, panelObj);
|
} else {
|
$.messager.alert("操作提示", panMain[panIndex].panInfo[flcode].title + code + ",找不到此辅助核算项", "warning");
|
}
|
}, 'text');
|
return false;
|
}
|
}
|
if (typeof (obj) == "object") {
|
pi = obj;
|
} else {
|
id = obj;
|
pi = panMain[showBoo].panInfo[id];// this.panInfo[id];
|
}
|
var mU = "";
|
var p = pi.fk;
|
var g = pi.seekgroupid;
|
var ben = pi.spremissfield;
|
var wai = pi.dpremissfield;
|
var zi = pi.efilter;
|
g = g.toLowerCase();// 必须小写形式
|
if (p.split(';').length != g.split(';').length) {
|
$.messager.alert("操作提示", "自身字段和外表字段设置的个数不同,请检查设置","warning");
|
return;
|
}
|
if (id != "") {// 如果不为空则为三点弹出
|
var isShow = getDoc(id + "Tree", ".value");
|
openTree = (isShow == "1") ? true : false;// 处理三点弹出控件的只读设置,禁止点击事件
|
}
|
if (showBoo != null) {
|
openTree = showBoo;
|
}
|
if (openTree) {
|
var where = this.getWhere(ben, wai, zi, g, p, id);
|
where = replacePageValue(where);
|
var fidt=getDoc(id,".value");
|
if(fidt!=null && fidt !="" && where == "" && fidt !="pb_xinzen"){
|
where+=id+"='"+fidt+"'";
|
}
|
mU += "wherePan=" + where;
|
var r = Math.round(Math.random() * 10000);
|
mU = mU + "&r=" + r;
|
if (pi.ftformtype == '18' && zi != '') {//针对18窗体的外表条件 xin 2022-7-27 14:19:06
|
zi=this.regexp(zi);
|
mU = mU + "&where18=" + zi;
|
}
|
mU = mU.replace(/%+/g, "@~");
|
if (openTree) {// 决定是否打开窗,这个必须,虽然上面有一个,但意义不同
|
// parent.panelToPost = p;
|
// parent.postToThis = g;
|
// parent.panel_onlyOne = onlyOne;
|
// parent.changFrame = inThisFrame;
|
//by danaus 2022/8/1 11:25 用新方法取当前页面的frameid,全局变量在未完全加载就马上切换到其他页面再切换回来会有问题
|
panelObj.panelToPost = p;
|
panelObj.postToThis = g;
|
parent.addTab("", pi.ft, pi.ftformtype, mU,null,null,null,null,panelObj);
|
}
|
}
|
openTree = true;
|
return false;
|
},
|
regexp:function(w){//正则表达式获取&符合会话值
|
let str = w;
|
let reg = "&\\b.*?\\b&";
|
let v = str.match(reg);
|
if (v != null && v.length > 0) {
|
let id = v[0].replaceAll("&", "").toLowerCase();
|
let value = getDoc(id, ".value");
|
if (value == null || value == "") {
|
let reg1 = "'" + v[0] + "'";
|
let v1 = str.match(reg1);
|
if (v1 == null && value == "") {
|
value = "''";
|
}
|
if (v1 != null && value == null) {
|
value = "";
|
}
|
}
|
str = str.replaceAll(v[0], value);
|
str = this.regexp(str);
|
}
|
return str;
|
},
|
isHasTo : function(id, usercode, toIs) {// id内容中含有usercode就为true,tois进行判断是否匹配
|
var mayOpen = toIs;// 要执行就传false,为true就没必要执行了
|
if (!toIs) {
|
usercode = usercode.toLowerCase();
|
var dbi = "";//当前审核人值
|
if (getDoc(id, '') != null) {// 确定有无此控件
|
dbi = getDoc(id, ".value");
|
} else {
|
if (hasShezhiZiduan && (id != "readerusercodes" && id != "readerroles" && id != "readerorganizations" && id != "curchecker")) {// 只弹出第一次筛选出的字段错误。部分字段已经不需要,在这里做判断处理。
|
$.messager.alert("操作提示", "没有设置" + id + "这个字段!", "warning");
|
}
|
hasShezhiZiduan = false;
|
}
|
var no = dbi.indexOf(";");
|
if (no != -1 && (pbId.indexOf("[" + id + "]") == -1)) {
|
pbId = pbId + "[" + id + "]";
|
$.messager.alert("操作提示", pbId + "的设置不要以;分割!要以,分割。","warning");
|
} else {
|
var str = dbi.split(",");
|
var strs = usercode.split(";");// 后加以分号分隔
|
var strti;
|
for (i = 0; i < str.length; i++) {
|
strti = str[i].toLowerCase().Trim();// alert(strti+"----"+usercode);
|
if (strti != "" && this.hasIn(strti, strs)) {// strti
|
// ==
|
// usercode
|
mayOpen = true;
|
break;
|
}
|
}
|
}
|
}
|
return mayOpen;
|
},
|
//每一个控件的onChang事件进入(公式处理)
|
upSub_gongsi : function(op, gongSiCo, gongSi) {
|
if (no_load_first) {
|
//这里是判断是否有!+sql情况 xin 2022-12-27 15:19:30
|
if(this.formula_function(op,gongSi)){
|
return;
|
}
|
var gongcols = gongSiCo.split(";");
|
for (var i = 0; i < gongcols.length; i++) {
|
//判断当前控件(op)是否设置有级联或非级联
|
if (gongcols[i] != "" && op.toLowerCase() == gongcols[i].toLowerCase()) {
|
var gongshiS = gongSi.split("@#@");
|
var RPolishArray = null;
|
var val = "";
|
var chuFa = false;
|
var qiIj = 0;
|
for (var j = 0; j < gongshiS.length; j++) {
|
qiIj = 0;
|
val = "";// 为空
|
chuFa = false;
|
if (gongshiS[j] != "") {
|
var vSet = gongshiS[j].split("=");
|
rpA = vSet[1].split(" ");
|
if (rpA.length % 2 == 0) {
|
qiIj = 1;
|
}
|
RPolishArray = new Array(rpA.length - qiIj);
|
for (var ij = qiIj; ij < rpA.length; ij++) {
|
var col = rpA[ij].Trim();
|
if (col != "") {
|
if (("*+-/").indexOf(col) == -1) {
|
val = getDoc(col.toLowerCase(), '.value');
|
RPolishArray[ij - qiIj] = val;
|
if (op.toLowerCase() == col.toLowerCase()) {
|
chuFa = true;
|
}
|
} else {
|
RPolishArray[ij - qiIj] = col;
|
}
|
}
|
}
|
// val = eval(gongcols[i] + "(" +
|
// ((col.replace("!","")).split("|"))[0] + ");")
|
if (chuFa) {
|
val = RPolish(RPolishArray);
|
if (qiIj == 1) {
|
if (rpA[0].indexOf("!") != -1) {// 格式化
|
val = val.toFixed(rpA[0].replace("!",
|
"").replace("format", "")
|
.Trim())
|
} else {// 函数处理
|
val = eval(rpA[0] + "(" + val + ");")
|
}
|
}
|
if (val != "" && !isNaN(val)) {
|
setDoc(vSet[0].Trim(), ".value='" + val
|
+ "'");
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
},
|
formula_function:function(id,gongSi){//公式请求方法
|
let bol=false;
|
if(gongSi){
|
var that=this;
|
let gongshi=gongSi.split("@#@");
|
if(gongshi.length>0){
|
for(let g=0;g<gongshi.length;g++){
|
let shi=gongshi[g];
|
let filed=shi.split("=");
|
if(id.toLowerCase()!=filed[0].toLowerCase()){
|
continue;
|
}
|
let sql=filed[1];
|
if(sql){
|
let fieldId = sql.split("|");
|
let s = fieldId[0];
|
let p = that.regexp(s);
|
if (p.indexOf("!") != -1) {
|
//执行公式请求
|
$.ajax({
|
url: '/getPanelFormula.do?value=' + p,
|
type: "get",
|
dataType: 'json',
|
success: function (res) {
|
if (res != null && res.code == 0) {
|
let data = res.data;
|
data = data[0];
|
let id=fieldId[1].split(";");
|
for(let i=0;i<id.length;i++){
|
setDoc(id[i].toLowerCase(),'.value='+that.formatHand(data,id[i]));
|
}
|
}
|
}
|
})
|
}
|
bol=true;
|
}
|
}
|
}
|
}
|
return bol;
|
},
|
formatHand:function(data,id){//处理设置的格式
|
let value = data[id.toLowerCase()];
|
let format;
|
if (panMain[panIndex].panInfo != null) {//是否有设置格式
|
format = panMain[panIndex].panInfo[id.toLowerCase()].format;
|
}
|
if (format == null || format == '') {
|
return value;
|
} else {
|
format = format.toLowerCase();
|
}
|
if (format.indexOf('yyyy') != -1 && format.indexOf('hh') == -1) {//时间格式
|
return value.split(' ')[0];
|
}
|
return value;
|
},
|
// 必须录入检查colsd:
|
mustCheck : function(colsd, miaoshu, statu) {
|
if(!isInspection){// 是否禁止必录检查
|
var revoke=false;
|
if(typeof (isrevokeProc) != 'undefined'){
|
revoke=isrevokeProc;
|
if(!revoke && typeof (mygrid) != 'undefined'){
|
try {
|
revoke=mygrid.isrevokeProc;
|
} catch (e) {
|
// TODO: handle exception
|
}
|
|
}
|
isInspection=revoke;// 撤回用到
|
}else{
|
|
if(!revoke && typeof (mygrid) != 'undefined'){
|
try {
|
revoke=mygrid.isrevokeProc;
|
} catch (e) {
|
// TODO: handle exception
|
}
|
|
}
|
isInspection=revoke;// 撤回用到
|
}
|
if(!revoke){// 禁止撤回
|
if (colsd == "")
|
return true;
|
var sta_ = getDoc('docstatus', '.value');
|
statu = ((statu != sta_) ? sta_ : statu);
|
var col = "";
|
var cols = colsd.split(";pb#");
|
var cms = miaoshu.split(";pb#");
|
var hasSta = true;
|
for ( var i = 0; i < cols.length; i++) {
|
if (cols[i] != "") {
|
col = cols[i].split(";sta#");
|
hasSta = (col.length > 1) ? true : false;
|
// 解决多面板如496多个分页存在相同input标签ID的控件
|
if(panMain[1]!=undefined){//表示多表情况
|
value = $doc(col[0]).val();// 根据索引控件来取值
|
}else{
|
value = getDoc(col[0], '.value');
|
}
|
if(this.panInfo[col[0]]!=null ){
|
var type = this.panInfo[col[0]].controltype;//控件类型
|
if (type == 37) {
|
value = get37Value(col[0]);
|
}
|
if (value == "") {
|
if (type == 43) {
|
value = ($("#" + col[0]).val() == null || $("#" + col[0]).val() == "") ? ""
|
: (($("#" + col[0]).val() instanceof Array) ? $("#" + col[0]).val().join(";") : $("#" + col[0]).val());// 43控件集合
|
}
|
}
|
}
|
if ((value == "" || value == "null" || value == null || value=="pb_xinzen")) {
|
// 在编辑状态下必录
|
if ((hasSta && isHasValue(col[1], "" + statu + "", ";")) || !hasSta) {
|
if (this.panInfo[col[0]] == null) {//没有检查到此字段的存在。
|
$.messager.alert("操作提示",'页面存在必录字段没有录入,必录的字段是:' + col[0]);
|
return false;
|
}
|
let title = this.panInfo[col[0]].title;
|
if (title.indexOf("!") != -1) {
|
title = col[0];//是动态的描述直接显示id好了。
|
}
|
// try {
|
$.messager.alert("操作提示",'<div style="text-align: center">'+title + '-不能为空!</div>');
|
// } catch (e) {
|
// $.messager.alert("操作提示",title + '--不能为空!');
|
// }
|
// try{
|
// $.messager.show({
|
// height:50,
|
// msg:'<div align=\"center\"><span style=\"color:red;\"><b>'+this.panInfo[col[0]].title +'--不能为空!</b></span></div>',
|
// showType:'fade',
|
// timeout:2000,
|
// style:{}
|
// });
|
// }catch(e){
|
// $.messager.alert('设置了'+col[0]+'必录,但是没有在panInfo(设置加载到页面)里找到'+col[0]);
|
// }
|
return false;
|
}
|
}
|
}
|
}
|
}
|
}
|
return true;
|
},
|
upImage : function(id, el) { // 图片控件处理
|
var url = "";
|
var th = id + "_UpImage";
|
if(el==3){
|
var bol=window.confirm("是否真的删除?");
|
if(!bol){return;}
|
}
|
switch (el) {
|
case 1:
|
url = "/general/picupload.jsp";
|
break;
|
case 2:
|
url = "/general/picupdate.jsp";
|
break;
|
case 3:
|
url = "/picDelete.do";
|
break;
|
case 4:
|
url = "/general/picshow.jsp";
|
break;
|
}
|
var open = true;
|
var formid = getDoc('formid', '.value');
|
if (formid == "" || formid==null) {
|
formid = getDoc('formIdHid', '.value');
|
}
|
if(pandex496 !=0){
|
if(isNaN(pandex496)){
|
pandex496=0;
|
}
|
var bolpan=false;
|
for(var p in panMain ){
|
if(bolpan)break;
|
for(var c in panMain[p].html_Col ){
|
bolpan=panMain[p].html_Col[c].fileid==id;
|
pandex496=(bolpan?p:pandex496);
|
if(bolpan)break;
|
}
|
}
|
formid = panMain[pandex496].tableIs.split(";")[0];
|
}
|
var doccode = getDoc('doccode', '.value');
|
var entercode = getDoc('entercode', '.value');
|
var usercode = getDoc('createusercode', '.value');
|
var rowId=getDoc('rowid', '.value');
|
rowId=((el==4||el==2)?getDoc(id, '.value'):rowId);// 4类型的页面是查看大图片。只需要对应id值
|
// 不需要rowid.
|
var code = entercode;
|
if (code == "")
|
code = usercode;
|
var bens ="";
|
try{
|
bens= this.panInfo[id].seekgroupid.split(";");
|
}catch(e){
|
if(pandex496!=0){// 496特殊有多个面板 pandex496为当前执行的面板
|
try{
|
bens=panMain[pandex496].panInfo[id].seekgroupid.split(";");
|
}catch(e1){
|
bens="";
|
}
|
}
|
}
|
var where = "";
|
var col = "";
|
var value = "";
|
for (i = 0; i < bens.length; i++) {
|
col = bens[i].toLowerCase();
|
if (col != "") {
|
where += getDoc(col, '.value') + ";";
|
}
|
}
|
where = where.substring(0, where.length - 1);
|
url += "?ishd=" + this.isPrimaryPan + "&fieldid=" + id + "&formid="
|
+ formid + "&doccode=" + doccode + "&usercode=" + code+"&rowid="+rowId;
|
|
showWindow_Grid(url, '', function(obj) {
|
if (obj != "" && obj != undefined) {
|
setDoc(id, ".value='" + obj + "'");// 赋字段值
|
setDoc(th, ".src='" + obj + "'");
|
}
|
}, {
|
dialogWidth :375,
|
dialogHeight :375
|
},null,{pid:id,th:id + "_UpImage"});
|
},
|
loadingSelect2Data:function () {//加载31控件数据和控件 xin 2022-7-18 14:59:17
|
let option = {
|
jsonId: {},
|
loading: function () {
|
let ent = this;
|
$(".isSelect-31").each(function () {
|
let index = $(this).data("index");//获取面板索引
|
if (index == null || isNaN(index)) {
|
index = 0;
|
}
|
ent.select2(this, index);
|
ent.ajax(this, index);
|
ent.jsonId[this.id] = this;
|
})
|
},
|
select2: function (thant, index) {
|
let ent = this;
|
$(thant).select2({
|
language: "zh-CN",
|
tags: true,//这个参数的效果应该是,自定义内容选项卡
|
containerCssClass: $doc(thant.id).disabled() == 1 ? "isdisabled31" : "", //自定义css
|
}).on('select2:select', function (e) {//43控件单击事件
|
let array = ent.jiLian(thant.id, index);
|
if (array.length > 0) {
|
ent.reset(array);
|
}
|
})
|
},
|
ajax: function (thant, index) {
|
$(thant).empty();
|
let id = thant.id;
|
let url = document.URL;
|
url = url.substring(0, url.lastIndexOf("/") + 1);
|
$.ajax({
|
url: url + panMain[index].controlUrl,
|
data: this.parm(id),
|
type: "POST",
|
async: false,
|
dataType: 'json',
|
success: function (data) {
|
let json = data;//'(' + data + ')');
|
if (json != null && json.info != null) {
|
data = json.info;
|
$(thant).append(new Option("", "", "", ""));//空值
|
let val = $("#" + id + 'text').val();
|
$.each(data, function (i) {
|
let isSelect = false;
|
isSelect = (val == data[i].id ? true : isSelect);
|
var option = new Option(data[i].text, data[i].id, isSelect, isSelect);//后面两个true分别表示默认被选中和有效!
|
$(thant).append(option);
|
});
|
panIndex=index;
|
$(thant).trigger("change");
|
}
|
|
}
|
})
|
},
|
parm: function (id) {
|
let data = {
|
'field': id,//控件ID
|
'fieldname': '',//控件名称
|
'fieldtype': 31,//控件类型
|
'callback': 0,//是否需要 <<新增>> 下拉进入((是31控件||2控件)&&不是空值&&不是1)添加 xin 2022-7-13 16:57:58
|
'params': panPar.getParameter(),//页面控件值(全部)
|
'state': $doc(id).disabled()//当前状态值
|
}
|
return data;
|
},
|
reset: function (array) {
|
let ent = this;
|
for (let i = 0; i < array.length; i++) {
|
let id = array[i];
|
let thant = ent.jsonId[id];
|
let index = 0;
|
if (thant != null) {//是31控件内
|
index = $(thant).data("index");//获取面板索引
|
if (index == null || isNaN(index)) {
|
index = 0;
|
}
|
ent.ajax(thant, index);
|
} else {//不是31控件内
|
|
}
|
let ar = ent.jiLian(id, index)
|
if (ar.length > 0) {
|
ent.reset(ar);
|
}
|
}
|
},
|
jiLian: function (id, index) {
|
let array = [];
|
let jilian = panMain[index].select;
|
if (jilian[id] != null) {//有级联
|
array = jilian[id].split(";");
|
}
|
return array;
|
}
|
}
|
return option;
|
},
|
nextDocIco:function (callback) {//审核下一单 xin 2022-7-30 11:47:23
|
let thant = this;
|
let docCode = $("#doccode").val() || "";//当前单号
|
if (docCode == "") {
|
layer.msg("获取不到这张被排除的单据单号");
|
return;
|
}
|
let formIds = $("#formid").val() || 0;
|
let excludeDoc = top.approvedDoc.excludeDocs || "";
|
let parm = "excludeSelectNextDocument=" + excludeDoc;
|
if (docCode != "") {
|
if (excludeDoc != "") {
|
parm += ";" + docCode;
|
// parm += excludeDoc.indexOf(docCode) != -1 ? "" : ";" + docCode;
|
} else {
|
parm += docCode;
|
}
|
}
|
parm += "&formid=" + (formIds == 0 ? formId : formIds) + "&docCode=" + docCode;
|
$.get("/app/v2/nextDoc.do?" + parm, function (data) {
|
if (data != null && data.msg == "success") {
|
let value = data.data;
|
if (value == null || value == "") {
|
callback("没有更多的待审核单据");//回调提示
|
return;
|
}
|
if (excludeDoc != "") {
|
let docs = excludeDoc.split(";");
|
if ($.inArray(docCode, docs) == -1) {//不存在就添加进去
|
docs.push(docCode);
|
top.approvedDoc.excludeDocs = docs.join(";");
|
}
|
} else {
|
top.approvedDoc.excludeDocs = docCode;
|
}
|
thant.nextDocLink(value);//刷新连接
|
}
|
})
|
}, nextDocLink: function (value,isCode) {//组装功能号单据连接数据 xin 2022-7-30 17:03:40
|
if(isCode){//isCode是经过编码需要解析
|
value=value.replaceAll("%2B", "+").replaceAll("%2F", "/").replaceAll("%3D", "=");
|
value=new Base64().decode(value);
|
}
|
var formInfo = value.split(";");//formid;formtype;doccode;formName
|
var pageUrl = document.URL.split("/");
|
for (var i = 0; i < pageUrl.length; i++) {
|
if (i == pageUrl.length - 3) {
|
pageUrl[i] = formInfo[0];
|
} else if (i == pageUrl.length - 2) {
|
pageUrl[i] = formInfo[1];
|
} else if (i == pageUrl.length - 1) {
|
pageUrl[i] = "index.jsp?" + (new Base64().encode("where=doccode='" + formInfo[2] + "'"));
|
}
|
}
|
//标题显示处理 xin 2022-11-30 11:21:50
|
let title=formInfo[3] + "-" + formInfo[0] + "-" + formInfo[2];
|
if(title.length>10){
|
title=title.substring(0,10)+'..';
|
}
|
parent.jQuery(parent.jQuery("#home-tabs").find("li.tabs-selected > a > span.tabs-title")).attr("title",formInfo[3] + "-" + formInfo[0] + "-" + formInfo[2]);
|
parent.jQuery(parent.jQuery("#home-tabs").find("li.tabs-selected > a > span.tabs-title")).html(title);
|
location.href = pageUrl.join("/");
|
}
|
};
|
panPar.isChange = 0;
|
//--------------------【panPar】
|
//--------------------------------------------------------------------function---------------------------------------------------------------------
|
|
function closeme(fun) {
|
document.body.style.display = "none";
|
parent.closeTab(fun); // 添加关页卡
|
}
|
function setHidOrNot(hidId, notId) {// 这个放最前吧 //添加注释时间:2012-07-04 曾文杰 显示/隐藏指定控件.
|
setDoc(hidId, ".style.display='none'");
|
setDoc(notId, ".style.display='block'");
|
}
|
|
//9802 style css样式字段设置
|
function stylecss(v,d,t,dat,typ,col,type){
|
if(v!=undefined&&v.indexOf("!")!=-1){
|
if(v.indexOf("&")!=-1){// 判断是否存在&xxx&
|
var vv="";
|
var v2="";
|
while (v.indexOf("&") != -1) {// 循环v中的&xxx&会话值进行替换。
|
vv=v.substring(0,v.indexOf("&"));// 第一个&前面的信息
|
v = v.substring(v.indexOf("&") + 1);// 第一个&后面的信息
|
if (v.indexOf("&") != -1) {// 第二个&判断
|
// 获取两个&中间的字段名 &xxx&中的xxx
|
v2 = v.substring(0, v.indexOf("&"));
|
if (v2!="") {
|
var vVal;
|
try{
|
vVal = getValue(v2);// 获取页面值,面板没有到格线获取。
|
}catch(e){// 当找不到getValue()方法时直接用getDoc获取值。
|
vVal= getDoc(v2.toLowerCase(), '.value');// 获取页面值。
|
}
|
if(typeof (vVal) !='undefined'){
|
if(isNaN(vVal) && vVal!=null){
|
vVal="'"+vVal+"'";// 判断不是数字值的处理。
|
}
|
v = vv+vVal+v.substring(v.indexOf("&") + 1);
|
// 重新把第一个&前面的信息+字段获取值(xxx的页面值)+第二个&后面的信息组装起来
|
// 然后再次while寻找v是否还有第二个&xxx&的会话值。
|
}else{
|
$.messager.alert("操作提示", "该界面没有发现你写的会话字段"+v2+",请检查9802是否设置了该字段。","warning");
|
return;
|
}
|
}
|
}
|
}
|
}else{
|
v=v.substring(1,v.length);// 没有会话值就直接传
|
}
|
dat[t]=col;
|
typ[t]=type;
|
var D = "{";
|
D +="'parm':\"" + encodeText(v.replace(/\\/g,"").replace("!",""))+"\"}";
|
var cur="/gtGrid.do?m=heand&_pop_json="+D;
|
// $.post()方法调用不能同步所以改成了$.ajax()来执行。async: false时作为同步 2014-9-15
|
$.ajax({url:cur,type:"POST",async:false,dataType:'text',success :function(data){
|
if (data.indexOf("error")!=-1 ) {
|
$.messager.alert("操作提示", data,"warning");
|
} else {
|
if(data==null){data="";}
|
var wdcss="width:"+getDoc(dat[d],".style.width")+";";
|
var htcss="height:"+getDoc(dat[d],".style.height")+";";
|
if(data.indexOf(";")!=-1){}else{data=data+";";}
|
data=data+wdcss+htcss;
|
setDoc(dat[d], ".style='" + data+"'");
|
}
|
}
|
});
|
}
|
}
|
|
function getImage(id) {//9类型上传图片显示事件
|
var UpImage=doc(id+'_UpImage');
|
if(typeof (UpImage) != 'undefined'){
|
var uuid=getDoc(id,'.value');
|
if(typeof (uuid) != 'undefined'&& uuid!=""){
|
if(uuid.indexOf('uploads')!=-1){
|
document.getElementById(id+'_UpImage').src =uuid;
|
}else{
|
document.getElementById(id+'_UpImage').src ="/getImage.do?type=0&uuid="+uuid; //小图片
|
}
|
}else{
|
document.getElementById(id+'_UpImage').src ="";
|
}
|
UpImage.onerror=null; //控制不要一直跳动
|
}
|
}
|
|
function clone(myObj) {
|
if (typeof (myObj) != 'object')
|
return myObj;
|
if (myObj == null)
|
return myObj;
|
var myNewObj = new Object();
|
for ( var i in myObj)
|
myNewObj[i] = clone(myObj[i]);
|
return myNewObj;
|
}
|
//对象 xin 2019-11-15 10:58:00
|
function doc(id) {
|
return document.getElementById(id);
|
}
|
// 获得对象值 xin 2019-11-15 10:58:08
|
function getDoc(id, property) {
|
var rv_ = null;
|
try{
|
if (doc(id) != null) {
|
rv_ = eval("document.getElementById('" + id + "')" + property);
|
}
|
}catch (e) {
|
//ipad上不兼容eval和 document.get..(id)+property(property是需要获取的属性值如:.value或.style.color等)。所以用到下面的方法取值
|
//循环控件对象获取属性值 ,针对ipad上获值的问题
|
if(property!=""){
|
var prop=property.split(".");
|
try{
|
for(var s in doc(id)){
|
if(property.indexOf(s)!=-1){
|
rv_=doc(id)[s];
|
if(prop.length>2){
|
rv_=rv_[prop[2]];
|
}
|
break; }
|
}
|
}catch(e){
|
rv_="";
|
}
|
}else{
|
rv_=doc(id);
|
}
|
}
|
return rv_;
|
}
|
// 赋值对象 xin 2019-11-15 10:58:44
|
function setDoc(id, property) {
|
if (doc(id) != null) {
|
var s = "";
|
var v = null;
|
var p = property.split("=");
|
var t = p[0].substring(1, p[0].length).split(".");
|
var v_ = "";
|
//=========lqc=======
|
for ( var i = 1; i < p.length; i++) {
|
if (i == p.length - 1) {
|
let pv = p[i].Trim();
|
if (pv.indexOf("'") == 0 && pv.lastIndexOf("'") == pv.length - 1) {//在第一个位置
|
pv = pv.substring(1, pv.length);
|
pv = pv.substring(0, pv.length - 1);
|
if (pv.indexOf("'") == 0 && pv.lastIndexOf("'") == pv.length - 1) {//去掉后还在第一个位置
|
pv = pv.substring(1, pv.length);
|
pv = pv.substring(0, pv.length - 1);
|
}
|
// v_ += pv;
|
// } else {
|
// v_ += pv;//.replace(/'+/g, "");
|
}
|
//处理值里有”=“的情况
|
if (v_ != "" && v_.indexOf("=") != -1 && pv.lastIndexOf("'") == pv.length - 1) {
|
pv = pv.substring(0, pv.length - 1);
|
}
|
v_ += pv;
|
} else {
|
v_ += p[i].Trim().replace(/'+/g, "") + "=";
|
}
|
}//==========end========
|
//var v_ = p[1].Trim().replace(/'+/g, "");
|
if (t.length > 1) {
|
s = t[1];
|
v = v_;
|
try{
|
$('#panIndex' + panIndex).find('#' + id).css($.trim(s), v);
|
}catch(e){
|
$.messager.alert("操作提示", id+"字段样式出错:"+e,"warning");
|
}
|
} else {
|
s = t[0];
|
if (v_ == "false" || v_ == "true") {
|
v = eval(v_)
|
} else {
|
v = v_;
|
}
|
try{
|
$('#panIndex' + panIndex).find('#' + id).attr($.trim(s), v);
|
}catch(e){
|
$.messager.alert("操作提示", id+"字段赋值出错:"+e,"warning");
|
}
|
}
|
|
if ($.browser!=null && !$.browser.msie && property.indexOf(".value") != -1) { // 不是IE浏览器
|
pro = $("#" + id, document).attr("onPropertyChange");
|
if (typeof pro != "undefined"&& pro.indexOf("event")!=-1) { // && pro.indexOf("event")!=-1
|
eval(pro.replace("event", "null"));
|
}
|
}
|
}
|
}
|
|
var set_buttonHid = function(buttonHid, buttonId) {
|
if (buttonHid) {// 按钮全隐藏的
|
if (!no_load_first && isAddLong) {
|
// var chan=getDoc(buttonId,".style.width");
|
// if(chan!=""){//居然有上下面板都没有的,多做个判断吧
|
// //topIs=topIsTi;
|
// //setDoc(buttonId,".style.width="+(parseInt(chan)+110)+";");
|
// // topIs=2;
|
// }
|
}
|
}
|
}
|
function RPolish(RPolishArray) {// 计算逆波兰表达式的值
|
var result = 0;
|
var tempArray = new Array(100);
|
var tempNum = -1;
|
for (i = 0; i < RPolishArray.length; i++) {
|
if (RPolishArray[i].match(/\d/)) {
|
tempNum++;
|
tempArray[tempNum] = RPolishArray[i];
|
} else {
|
switch (RPolishArray[i]) {
|
case '+':
|
result = (tempArray[tempNum - 1] * 1)
|
+ (tempArray[tempNum] * 1);
|
tempNum--;
|
tempArray[tempNum] = result;
|
break;
|
case '-':
|
result = (tempArray[tempNum - 1] * 1)
|
- (tempArray[tempNum] * 1);
|
tempNum--;
|
tempArray[tempNum] = result;
|
break;
|
case '*':
|
let left=tempArray[tempNum - 1] * 10000;
|
let right=tempArray[tempNum] * 10000;
|
result = left * right;
|
result=result/10000;
|
result=result/10000;
|
tempNum--;
|
tempArray[tempNum] = result;
|
break;
|
case '/':
|
result = (tempArray[tempNum - 1] * 1)
|
/ (tempArray[tempNum] * 1);
|
tempNum--;
|
tempArray[tempNum] = result;
|
break;
|
}
|
}
|
}
|
result = tempArray[tempNum];
|
return result;
|
}
|
function callBack(col, data,waiziduan,benziduan) {
|
if (data == "many") {
|
var pro = null;
|
if (getDoc(col, '') != null) {
|
pro = $("#" + col + "_click", document).click();
|
}
|
} else {
|
getBackBool = false;// 改为假先,避免触发
|
var strs = data.split(";pb#");
|
var colVal = getDoc(col, '.value');
|
var xinxi;
|
for (i = 0; i < strs.length; i++) {
|
xinxi = strs[i].split(";fen#"); // 必须用特殊的
|
if (xinxi[0] != "") {
|
if (xinxi[0] == col && xinxi[1] == "") {
|
setDoc(xinxi[0], ".value= '" + colVal + "'");// 当触发列无值时,必须还原啊,(如用户还没输入完就触发没了)
|
} else {
|
setDoc(xinxi[0], ".value= '" + xinxi[1] + "'");
|
}
|
panMain[panIndex].isChange=1;
|
}
|
if( waiziduan!=undefined && benziduan!=undefined){//自身字段和外表字段不相同的时候进行判断赋值 2015-6-2 17:55:15 --xin
|
if(waiziduan!=benziduan){
|
var ben10=benziduan.split(";");
|
var bwai10=waiziduan.split(";");
|
if(ben10.length==bwai10.length){
|
for(j = 0; j < ben10.length; j++){
|
if(xinxi[0] == bwai10[j] && xinxi[1] != ""){
|
setDoc(ben10[j], ".value= '" + xinxi[1] + "'");
|
}
|
}
|
}else{//抛出提示
|
$.messager.alert("操作提示", "9082的接收数据里【外表字段】和【自身字段】不对应或缺少 请检查修改。","warning");
|
return
|
}
|
}
|
}
|
}
|
getBackBool = true;// 还原让程序继续运作
|
}
|
}
|
//触发相应控件事件,js赋值时不触发,直接调用一次
|
function setLoadEven(id, type) {
|
if (type == null) {// 考虑对方不知道type的情况 可以不用
|
pi = panMain[panIndex].panInfo[id];
|
type = pi.controltype;
|
}
|
switch (parseInt(type)) {
|
case 6:// 复选框单选
|
cheeckValueChan(id);// 以初始值控制复选框的勾选
|
break;
|
case 9:// 图片占位显示
|
// upImageChange(id);
|
break;
|
case 30:// 复选框多选
|
cheeckSValueChan(id);// 以初始值控制复选框的勾选
|
break;
|
case 32:// 单选按钮
|
radioValueChan(id);// 以初始值控制单选按钮的勾选
|
break;
|
case 35:
|
toSelect35(id);//
|
break;
|
case 37:// 富文本
|
set_37ck(id);
|
break;
|
default:
|
break;
|
}
|
}
|
function get37Value(id) {
|
try{
|
var ck_html =CKEDITOR.instances[id].getData();
|
ck_html = ck_html.replace(/(\r|\n|\r\n)+/g, '').replace(new RegExp( '&' , 'g' ),'&');// 替换换行
|
}catch(e){
|
ck_html=null;
|
}
|
return ck_html;
|
}
|
function set_37ckChang(id) {
|
var v = get37Value(id);
|
$doc(id + '_spanHid').html(v);
|
$doc(id).val(v);
|
}
|
function set_37ck(id) {// 给富文本框赋值
|
try {
|
if (no_load_first) {
|
panMain[panIndex].isChange = 1;
|
}
|
setHidOrNot(id + '_spanHid', id + '_hid');
|
var ck_html = $doc(id).val();
|
ck_html=ck_html.replace(/<img/g,"<img class=\"thumbnail contentImg\" ");// by danaus 15-1-19
|
var ck_html_text = ck_html;
|
$doc(id + '_spanHid').html(ck_html_text);
|
eval(id + '_ck').setData(ck_html);
|
if (docstatuPan != parseInt(predocstatus)) {
|
setHidOrNot(id + '_hid', id + '_spanHid');
|
}
|
} catch (e) {
|
}
|
}
|
// 分页面板显示
|
function showPan(qz, hz, siz) {
|
for ( var i = 1; i <= siz; i++) {
|
doc(qz + i).style.display = 'none';
|
}
|
doc(qz + hz).style.display = 'block';
|
}
|
//31控件设置值进入。避免出错,转接一个函数
|
function seletMorenOrValue(value, id) {
|
//是否新单
|
if (value == "" && panMain[panIndex].isNew!=null && panMain[panIndex].isNew==1) {
|
select_toValue(panMain[panIndex].panInfo[id].initValue, id);
|
} else {
|
select_toValue(value, id);
|
}
|
}
|
// 类型函数
|
// 判断下拉控件的选择项(value/text)
|
function select_toValue(value, id) {
|
var sel_options ;
|
//多表情况防止出现相同ID
|
if(panMain[1]!=undefined){
|
sel_options = $doc(id).options;
|
}else{
|
sel_options = getDoc(id, ".options");
|
}
|
var sel_value = value.toLowerCase().Trim();
|
var notHas = true;
|
if (typeof sel_options != "undefined" && sel_options != null) {
|
for (var i = 0; i < sel_options.length; i++) {
|
if (sel_options[i].value.toLowerCase() == sel_value
|
|| sel_options[i].text.toLowerCase() == sel_value) {
|
sel_options[i].selected = true;
|
notHas = false;
|
if (panMain[panIndex].panInfo[id] != null && panMain[panIndex].panInfo[id].controltype == 46) {
|
setDoc(id, ".value='" + value + "'");
|
setDoc(id, ".style.backgroundColor ='" + value + "'");
|
}
|
break;
|
}
|
}
|
}
|
if (notHas) {
|
setDoc(id, ".selectedIndex=-1");
|
let envt = $("#" + id).prop("type")//拿到控件属性 hidden的话就赋值 xin 2022-10-26 11:47:13
|
if (envt == "hidden" || typeof sel_options == "undefined") {
|
setDoc(id, ".value='" + value + "'");
|
} else {
|
setDoc(id, ".value=''");//如果notHas是true并且envt的值不是hidden说明上面的匹配不到下拉的值,这个value就不是在下拉值范围里,不需要添加进去 直接空值 xin 2022-10-25 17:09:47
|
}
|
}
|
}
|
|
function key_Delete_Selete(e, id) {// 下拉del键清除
|
var event = $.event.fix(e);
|
if (event.keyCode == 46) {
|
setDoc(id, ".selectedIndex = -1");
|
upSub(id);
|
}
|
}
|
// 判断确定状态,因为不知道所有的窗体是否判断状态一样,顾多加个窗体类型参数,可以后随时更改
|
// 1.状态值2.确认前状态值3.窗体类型值
|
function getStatu(sta, preSta, formType) {
|
if (sta == "") {
|
sta = 0;
|
}
|
if (sta != preSta && preSta!="") {
|
if (doc('tpConfirm') != null) {
|
doc('tpConfirm').style.display = 'none';// 隐藏确定按钮
|
}
|
if((sta==100 || sta==200)){
|
$('#importXls').hide();//已确定的单据 隐藏导入按钮 100是确定状态,200是关闭订单状态,都是不能再操作修改单据的状态
|
}
|
setDocStatuInfo('已确定');
|
} else {
|
setDocStatuInfo('未确定');
|
}
|
// 在有新的做法时,为:
|
if (typeof (panMain[panIndex].stas) != "undefined") {// stas在生成页面中有
|
setDocStatuInfo(panMain[panIndex].stas[sta]);
|
}else{
|
if(typeof (panMain[0].stas) != "undefined"){
|
setDocStatuInfo(panMain[0].stas[sta]); // 496多个panIndex时状态值出错问题。
|
}
|
}
|
}
|
// 单选按钮组
|
function getRad(id) {// pan1.jsp中getRadid(id)区分开此为赋值
|
var rads = document.getElementsByName(id + "Radio");
|
for (i = 0; i < rads.length; i++) {
|
if (rads[i].checked) {
|
setDoc(id, ".value='" + rads[i].value + "'");
|
break;
|
}
|
}
|
}
|
//function upImageChange(id) {// 显示头像等
|
// var value = getDoc(id, ".value");
|
// if (value != "") {
|
// setDoc(id + "UpImage", ".src='" + value + "'");
|
// // setDoc(id + "Upload", ".style.display='none'");//上传后显示更新按钮 2015-4-29
|
// // 18:26:37
|
// // setDoc(id + "Upload", ".value = '更新'");
|
// setDoc(id + "Upload", ".style.display='none'");
|
// setDoc(id + "Update", ".style.display='block'");
|
// setDoc(id + "Delete", ".style.display='block'");
|
// } else {
|
// setDoc(id + "UpImage", ".src=''");// uploads/moren.png
|
// setDoc(id + "Upload", ".style.display='block'");
|
// setDoc(id + "Update", ".style.display='none'");
|
// setDoc(id + "Delete", ".style.display='none'");
|
// }
|
// if(typeof(predocstatus)!="undefined"){// 判断是否是空指针 不然会报错误
|
// if (docstatuPan != predocstatus) {// 已经确认
|
// setDoc(id + "Delete", ".style.display='none'");
|
// setDoc(id + "Update", ".style.display='none'");
|
// } else {
|
// if (value != "") {// 字段id没值 删除字段必须隐藏 否则显示出来
|
// setDoc(id + "Delete", ".style.display='block'");
|
// }
|
// }
|
// }
|
//}
|
// 日期控件显示
|
function showDate(id, shWeek, frmat) {// 显示选择日期控件
|
var isShow = (getDoc(id + "Date", ".value") == "1") ? true : false;
|
if (isShow) {
|
if (frmat == '') {
|
WdatePicker( {
|
el:id,
|
isShowWeek :shWeek
|
});
|
} else {
|
WdatePicker( {
|
el:id,
|
isShowWeek :shWeek,
|
dateFmt :frmat
|
});
|
}
|
}
|
}
|
// 7类型
|
function show(id,max) {
|
if (parent.errShow != null) {
|
parent.errShow.frame = parent.frames[inThisFrame];
|
parent.errShow.show(id, max);
|
} else {
|
//弹出层时候有调用 xin 2022-9-26 16:29:56
|
top.parent.errShow.frame = parent.frames[1];//inThisFrame;
|
top.parent.errShow.show(id, max || 400);
|
}
|
}
|
// 35
|
function set35(id) {
|
var val = getDoc(id + "_35", ".value");
|
if (val != "") {
|
setDoc(id, ".value='" + val + "'");
|
}
|
}
|
function toSelect35(id) {
|
var val = getDoc(id, ".value");
|
setDoc(id + "_35", ".value='" + val + "'")
|
}
|
// 复选框单选初始值
|
function cheeckValueChan(id) {
|
var checkTrue = (getDoc(id, ".value") == "1") ? true : false;
|
setDoc(id + "CheckBox", ".checked = " + checkTrue);
|
}
|
// 多选框初始值------至显示
|
function cheeckSValueChan(id) {
|
var checks = document.getElementsByName(id + "Check");
|
var values = getDoc(id, ".value");
|
var vaS = values.split(',');
|
var vaIs = "";
|
for (i = 0; i < checks.length; i++) {// 先默认为未勾上
|
checks[i].checked = false;
|
}
|
for (j = 0; j < vaS.length; j++) {// 含有的初始值
|
vaIs = vaS[j];
|
for (i = 0; i < checks.length; i++) {
|
if (checks[i].value == vaIs) {// 将该勾上的先勾上
|
checks[i].checked = true;
|
}
|
}
|
}
|
}
|
//多选框设置状态 xin 2018-10-24 14:41:31
|
function checkboxDisabled (id,boo){
|
var checks = document.getElementsByName(id + "Check");
|
for (var c = 0; c < checks.length; c++) {
|
if (boo) {// 只读
|
checks[c].onclick=function(){return false;};
|
//checks[c].disabled = boo;
|
}
|
}
|
}
|
// 多选框显示(勾选情况)----至插入值(进数据库信息)
|
function cheeckSToValue(id) {
|
var checks = document.getElementsByName(id + "Check");
|
var vaIs = "";
|
for (i = 0; i < checks.length; i++) {
|
if (checks[i].checked) {
|
vaIs += checks[i].value + ",";
|
}
|
}
|
vaIs = vaIs.substring(0, vaIs.length - 1);
|
setDoc(id, ".value='" + vaIs + "'");
|
}
|
function radioValueChan(id) {// 设置选择按钮事件
|
var value = getDoc(id, ".value");
|
var rads = document.getElementsByName(id + "Radio");
|
for (i = 0; i < rads.length; i++) {
|
if (rads[i].value == value) {
|
rads[i].checked = true;// 要重新考虑了
|
break;
|
}
|
}
|
}
|
// 1. 值集合2.匹配值3.值集合分割符
|
function isHasValue(inValue, value, fen) {// 看看值中是否已经含有当前value,有则不追加,返回true
|
var boolreturn = false;
|
var strs = inValue.toLowerCase().split(fen);
|
value = value.toLowerCase();
|
for (i = 0; i < strs.length; i++) {
|
if (strs[i] == value) {
|
boolreturn = true;
|
break;
|
}
|
}
|
return boolreturn;
|
}
|
// 1.数组2.自身字段(数组值与自身字段一一匹配)3true替换,反之则为追加
|
//newExpr是弹出页面返回的数据,表示里面的字段内容是密文,需要根据当前页面是否需要解密做相应的处理
|
//格式:newExpr={"字段名称":"密文"} by danaus 2024-06-28 17:08
|
function openSetValue(st, get, boo,newExpr) {
|
var col;
|
if (st != undefined && st != null) {
|
var encrypt = new JSEncrypt();
|
encrypt.setPublicKey(rsakey.pubkey);
|
var dataJson=null;
|
if (newExpr != null && JSON.stringify(newExpr) !== "{}"){//&& typeof newExpr == 'object') {//有密文
|
$.ajax({
|
url: "/api/decrypt.do",
|
type: "POST",
|
data: JSON.stringify(newExpr),
|
async: false,
|
dataType: 'json',
|
contentType: 'application/json',
|
success: function (res) {
|
if (res.state == 0) {
|
//获取明文
|
dataJson = res.data;
|
}
|
}
|
})
|
}
|
for ( var n = 0; n < st.length; n++) {
|
if (getDoc(get[n], "") == null) {
|
console.log("三点弹出设置的自身字段:" + get[n] + "在页面上不存在!");
|
// $.messager.alert("操作提示", "返回字段设置" + get[n] + "在页面上没有!","error");
|
} else {
|
st[n] = st[n] != undefined ? st[n] : "";
|
getBackElse = true;// 允许触发带出值
|
if (boo) {
|
var pi = panMain[panIndex].panInfo[get[n]];
|
if(pi==undefined){
|
pi=panMain[gtss].panInfo[get[n]];
|
}
|
if (typeof(pi)!='undefined') {// 是否是31控件
|
if(pi.controltype == 31){
|
var options = document.getElementById(get[n]).options;
|
var hasSel = false;
|
if (options != null) {
|
hasSel = true;
|
for ( var i = 0; i < options.length; i++) {
|
if (st[n] == options[i].value) {
|
hasSel = false;
|
}
|
}
|
}
|
if (hasSel) {
|
document.getElementById(get[n]).options.add(new Option(st[n+1], st[n]));
|
}
|
}
|
}
|
var v = (st[n] == "undefined" ? "" : st[n]);
|
if (dataJson != null) {//有解密的明文值
|
v = dataJson[get[n]];
|
}
|
if (getDoc(n + "_expr", ".value") != "" && getDoc(n + "_expr", ".value") == 0) {//权限控制 显示星号 xin 2024-6-24 10:22:43
|
setDoc(n + "_expr_val", ".value='" + encrypt.encrypt(v) + "'");//加密值
|
v = "******";
|
}
|
setDoc(get[n], ".value ='" + v + "'");
|
} else {
|
col = getDoc(get[n], ".value");
|
if (!isHasValue(col, st[n], ",")) {// 在有的情况下不追加
|
setDoc(get[n], ".value = '" + (col + "," + st[n]) + "'");
|
}
|
}
|
if(st[n]!=''){//针对31控件级联
|
getSelect31(get[n]);
|
}
|
getBackElse = false;// 禁止触发带出值
|
}
|
}
|
panMain[panIndex].isChange=1;
|
top.myFresh.Type=panMain[panIndex].formtypeOne;
|
if(panMain[panIndex].formtypeOne==10 || panMain[panIndex].formtypeOne==20 || panMain[panIndex].formtypeOne==30){//10 20 30类型
|
panMain[panIndex].keyDown('123','');//三点弹出返回后 再次触发回车事件 组装where条件。2014-11-14
|
panMain[panIndex].isChange=0;//10窗体返回的值不在保存防范,所以isChange改为0
|
}
|
} else {
|
$.messager.alert("操作提示", "是否设置接收字段!","question");
|
}
|
excOABtnFunction();
|
}
|
// 上传
|
//function upLoad(http, fild, el, th) {
|
// th.disabled = true;
|
// var formid = getDoc('formid', ".value");
|
// var doccode = getDoc('doccode', ".value");
|
// var uuid = getDoc(fild, ".value");
|
// var fildat=getDoc(fild+'Up',".disabled");//attchmentShow.jsp界面控制 上传附件 按钮问题
|
// if (doccode == "") {
|
// $.messager.alert("操作提示", "请先保存,然后再上传附件。","warning");
|
// th.disabled = false;
|
// return;
|
// }
|
// $.post("/uprand.do", "", function(data) {
|
// var toSend = (el == 1) ? "/general/attaUpload.jsp" : "/general/attchmentShow.jsp";
|
// var url = http + toSend + "?formid=" + formid + "&doccode=" + doccode + "&fieldid=" + fild +
|
// "&uuid="+uuid+ "&r=" + data+((el==2)?"&di="+fildat:"");//el如果进入的是attchmentShow.jsp就传di这个参数过去
|
// url = encodeURI(url);
|
// url = encodeURI(url);// 必须两次
|
// var st;
|
// if (el == 1) {
|
// showWindow(url, '', function(t) {
|
// st = t;
|
// }, {
|
// fieldid:fild,
|
// dialogWidth :720,
|
// dialogHeight :430
|
// });
|
// } else {
|
// var s = getDoc("docstatus", ".value");
|
// var f = $("title", document).html();
|
// url += "&docstatus=" + s;
|
// parent.addTab(f + ':' + doccode, '', '', '', url, '', {
|
// isFlowChart :true
|
// });
|
// }
|
// th.disabled = false;
|
// });
|
//}
|
|
// 验证函数
|
// 正则表达式 比较的内容的id 弹出的消息 这三个数
|
function math(regular, testId, message) {
|
var filter = regular;
|
var testValue = getDoc(testId, ".value");
|
if (!filter.test(testValue)) {
|
$.messager.alert("操作提示", message,"warning");
|
setDoc(testId, ".value=''");
|
return false;
|
}
|
return true;
|
}
|
function obj2str(o) {
|
var r = [];
|
if (typeof o == "string")
|
return "\""
|
+ o.replace(/([\'\"\\])/g, "\\$1").replace(/(\n)/g, " \\n")
|
.replace(/(\r)/g, "\\r").replace(/(\t)/g, "\\t") + "\"";
|
if (typeof o == "undefined")
|
return "";
|
if (typeof o == "object") {
|
if (o === null)
|
return "null";
|
else if (!o.sort) {
|
for ( var i in o){
|
if(i==''){
|
$.messager.alert("操作提示", "字段名不能设置为空,查看9802是否加载了一个空的字段名。","warning");
|
return;
|
}
|
r.push(i + ":" + obj2str(o[i]))
|
}
|
r = "{" + r.join() + "}"
|
} else {
|
for ( var i = 0; i < o.length; i++)
|
r.push(obj2str(o[i]))
|
r = "[" + r.join() + "]"
|
}
|
return r;
|
}
|
return o.toString();
|
}
|
/**
|
*
|
* 通过,驳回
|
*/
|
var this_id = null;
|
var External=false;
|
function getBtn(hasPaw, formid, url, th,isi,ExternalURL,UrlShowLocation,buttonID) {
|
if (th != null) {
|
//th.disabled = true;//注释原因 如果disabled禁止 前台输入好了的话需要刷新才能再次通过 不方法 ,所以注释了该参数 或者写成false;
|
btnId = th.id;
|
this_id = th;
|
}// 禁用
|
btnSave = false;// 还原上面的变量
|
panelHasSave = false;// 还原面板状态为未保存
|
External=(ExternalURL==""?false:true);
|
typeof isi=='undefined'?false:isi;//判断是否有值 防止错误
|
isInspection =isi;//是否禁止必录检查,这个isi是OA设置里面的一个字段值 通过后台生成审核按钮时传送过来
|
if (checkUp()) {
|
// 添加按钮检查
|
if(External && UrlShowLocation==0){
|
if(this.getExternalURL(ExternalURL,buttonID,formid)){
|
return;
|
}
|
}
|
if (hasPaw) {// 是否要弹出密码框
|
centerPopup(3, function() {
|
save(2);
|
}, url);
|
} else {// 回调
|
save(2);
|
}
|
if(External && UrlShowLocation==1){
|
if(this.getExternalURL(ExternalURL,buttonID,formid)){
|
return;
|
}
|
}
|
} else {
|
if (th != null) {
|
th.disabled = false;
|
}
|
btnId = null;
|
}
|
//这里是新OA审核界面用到 xin 2021-2-23 15:48:07
|
if(OAButonEvnt!=null){
|
//关闭
|
layer.close(OAButonEvnt);
|
$("body").removeClass("bodyScrollOA");
|
}
|
}
|
|
/**
|
* 通过或者驳回前后执行的xxxx.do程序
|
* @param External
|
* @returns
|
*/
|
function getExternalURL(External,buttonID,formid){
|
var doccode = getDoc('doccode', ".value");
|
var docstatus= getDoc('docstatus', ".value");
|
var bool=false;
|
if(External.indexOf('?') != -1) {
|
if(External.match(/&.*?&/)){
|
var rep=External.match(/&.*?&/);
|
for(var r=0;r<rep.length;r++){
|
var val=rep[r].replace(/&/g,"");
|
External=External.replace(rep[r],getDoc(val,".value"));
|
}
|
}
|
External=External+"&buttonID="+buttonID+"&doccode='"+doccode+"'&formid="+formid+"&docstatus="+docstatus;
|
}else{
|
External=External+"?buttonID="+buttonID+"&doccode='"+doccode+"'&formid="+formid+"&docstatus="+docstatus;
|
}
|
$.ajax({url:External,//跳转到External
|
type:"POST",
|
async:false,
|
dataType:'text',
|
success:function(data) {
|
if(data.indexOf('error')!=-1){
|
$.messager.alert("操作提示", data,"warning");
|
bool=true;
|
}
|
|
//--------Start Added by Johns Wang,2020-04-04 ------------------
|
try {
|
var obj = JSON.parse(data);
|
if (obj["state"]!=undefined && obj["state"]==-1 && obj["msg"] !=undefined && obj["msg"] && obj["msg"] != "") {
|
//$.messager.alert("操作提示", obj.msg,"warning");
|
alert(obj["msg"]) ;
|
bool=true;
|
}
|
if (obj["state"] !=undefined && obj["state"] == 0 && obj["msg"] !=undefined && obj["msg"] && obj["msg"] != "") {
|
alert(obj["msg"] ) ;
|
bool=true;
|
}
|
}catch(e) {
|
console.log(e);
|
}
|
//----------- end Added by Johns Wang,2020-04-04 -----------------------
|
|
}
|
// error:function (XMLHttpRequest, textStatus, errorThrown) {
|
// alert(textStatus);
|
// bool=true;
|
// }
|
});
|
return bool;
|
// data:{//参数
|
// 'field' :field,
|
// 'fieldtype' :fieldtype,
|
// 'callback' :callback,
|
// 'params' :params
|
// },
|
}
|
|
|
function btn_OK(op) {// 启用被禁用的按钮
|
if (op != 'ok' && this_id != null) {
|
this_id.disabled = false;
|
this_id = null;
|
}
|
}
|
// huicode:回填到页面上审核人code的ID;huiname:回填到页面审核人name的ID;getPaw:true 则为通过驳回,值是替换
|
function popupSet(leaderHRcode, name, huicode, huiname, getPaw) {
|
// 执行赋值
|
huicode = huicode.toLowerCase();
|
huiname = huiname.toLowerCase();
|
var value = "";
|
if (huicode != "") {// 如果未设置其中一个,这样处理免得报错
|
value = getDoc(huicode, ".value");
|
if (!isHasValue(value, leaderHRcode, ',')) {// 让其不要追加相同的
|
value = value.substring(0, value.length - 1);
|
if (getPaw) {
|
setDoc(huicode, ".value = '" + leaderHRcode + "'");// 替换
|
} else {
|
setDoc(huicode, ".value = '" + (value + "," + leaderHRcode + ",") + "'");// 追加
|
}
|
}
|
}
|
if (huiname != "") {
|
value = getDoc(huiname, ".value");
|
if (!isHasValue(value, name, ',')) {// 让其不要追加相同的
|
value = value.substring(0, value.length - 1);// 却掉最后一个,号
|
if (getPaw) {
|
setDoc(huiname, ".value = '" + name + "'");// 替换
|
} else {
|
setDoc(huiname, ".value = '" + (value + "," + name + ",") + "'");// 更改以上值,底下会做保存
|
}
|
}
|
}
|
// 执行密码按钮操作
|
if (getPaw) {// 这个后加必须
|
getBtn(hasPawBtn, formidBtn, urlBtn, null,false);
|
}
|
if (selBtnOk) {// 默认不进入
|
selBtnOk = false;
|
// 添加按钮检查
|
save(3);
|
}
|
}
|
var topPan = {
|
h :0,
|
ref : function() {
|
this.h = parseInt(getDoc('panel_' + formId, '.style.height'))
|
+ parseInt(doc('h_top').style.height);
|
if (isNaN(this.h)) {// 没设置的帮处理下
|
var tits=document.getElementById("title_top");
|
if(tits){//判断是否有大标题 根据大标题修改top高度
|
this.h = 105;
|
doc('h_top').style.height ="68px";
|
}else{
|
this.h=105;
|
}
|
}
|
doc('h_all').style.height = this.h + "px";
|
}
|
}
|
var setOa = function(op) {// 保存前处理信息,如通过按钮的取得条件
|
if (typeof mygrid != "undefined" && mygrid != null) {
|
mygrid.setOA(op);
|
} else {
|
OA = op;
|
}
|
}
|
$(document).ready( function() {
|
no_load_first = true;
|
});
|
var timeStart = null;
|
function start_dibang(op) {
|
var v_ = "";
|
if (parent.ActiveXDrive) {
|
v_ = parent.ActiveXDrive.getDiBangValue();
|
}
|
setDoc(op, ".value='" + v_ + "'")
|
// timeStart=setInterval(start_dibang(op),1000);
|
timeStart = setTimeout("start_dibang('" + op + "')", 200);
|
|
}
|
function stopOrStartBegin(th, op) {
|
stopOrStart(th, op);
|
}
|
function stopOrStart(th, op) {
|
var v_ = th.value;
|
if (v_ == "解锁") {
|
start_dibang(op);
|
} else {
|
stop_dibang();
|
}
|
th.value = (v_ == "解锁") ? "锁定" : "解锁";
|
}
|
function stop_dibang() {
|
clearTimeout(timeStart);
|
}
|
var panFiled = {
|
replace : function(fieldformid, tiformid) {
|
var filedHtmlId = 'panel_' + fieldformid + '_' + tiformid;
|
var tiHtmlId = tiformid + '_panel';
|
var pan_ = $('#' + filedHtmlId).html();
|
$('#' + filedHtmlId).html('');
|
$('#' + tiHtmlId).html(pan_);
|
}
|
}
|
var btnCall;// 按钮回调
|
function excOABtnFunction() {
|
if (typeof btnCall == "function") {// 在有的情况回调
|
btnCall();
|
btnCall = null;// 清楚函数
|
}
|
if (typeof (excBtnOkCall) == "function") {// 当 确定按钮触发选择部门必须执行里面函数
|
excBtnOkCall();// 执行确定按钮为执行的事件
|
}
|
}
|
// 面板按钮 旧项目移过了的方法
|
function mulChoice2(linkField, selfField, ben, wai, zi, url1, hasPaw, formid,
|
url, th,ExternalURL,UrlShowLocation) {
|
musChoies = true;
|
th.disabled = true;
|
if (checkUp()) {
|
windowOpenOld(url1, linkField, selfField, ben, wai, zi, '');
|
btnCall = function() {
|
btnId = th.id;
|
getBtn(hasPaw, formid, url, th,false);// 按钮执行存储过程 必须在执行上面操作后才允许执行 暂没法做到
|
musChoies = false;
|
}
|
} else {
|
th.disabled = false;
|
btnId = null;
|
}
|
//这里是新OA审核界面用到 xin 2021-2-23 15:48:07
|
if(OAButonEvnt!=null){
|
//关闭
|
layer.close(OAButonEvnt);
|
$("body").removeClass("bodyScrollOA");
|
}
|
}
|
function windowOpenOld(url, p, g, ben, wai, zi, id) {
|
g = g.toLowerCase();// 必须小写形式
|
if (p.split(';').length != g.split(';').length) {
|
parent.message('请检查外表字段与自身字段是否设置正确。', '<%=URL%>');
|
return;
|
}
|
if (id != "") {// 如果不为空则为三点弹出
|
var isShow = getDoc(id + "Tree", ".value");
|
openTree = (isShow == "1") ? true : false;// 处理三点弹出控件的只读设置,禁止点击事件
|
}
|
if (openTree) {
|
var where = getWhere(ben, wai, zi, g, p, id);
|
if (url.indexOf('?') != -1) {
|
url = url + "&wherePan=" + where;
|
} else {
|
url = url + "?wherePan=" + where;
|
}
|
var r = Math.round(Math.random() * 10000);
|
url = url + "&r=" + r;
|
url = url.replace(/%+/g, "@~");
|
url = encodeURI(url);
|
url = encodeURI(url);// 必须两次
|
if (openTree) {// 决定是否打开窗,这个必须,虽然上面有一个,但意义不同
|
// parent.panelToPost = p;
|
// parent.postToThis = g;
|
// parent.changFrame = inThisFrame;
|
//by danaus 2022/8/1 11:25 用新方法取当前页面的frameid,全局变量在未完全加载就马上切换到其他页面再切换回来会有问题
|
var panelObj={};
|
panelObj.panelToPost = p;
|
panelObj.postToThis = g;
|
panelObj.frameName=parent.jQuery(parent.jQuery(parent.jQuery('#home-tabs').tabs('getSelected'))).attr("id");
|
parent.addTab('按钮事件', '', '', '', url, '', {
|
isFlowChart :true
|
},null,panelObj);
|
}
|
}
|
openTree = true;
|
}
|
|
|
var urlBtn;
|
// huicode:回填到页面上审核人code的ID;huiname:回填到页面审核人name的ID,hasPaw
|
// :是否包含按钮;formid:功能号IDurl:项目路径
|
function createPopSelect(huicode, huiname, hasPaw, formid, url, th,ExternalURL,UrlShowLocation) {// 这里包含要弹出密码,解决执行速度需要提出全局参数
|
hasPawBtn = hasPaw;
|
formidBtn = formid;
|
// execSqlBtn = execSql;
|
th.disabled = true;
|
urlBtn = url;
|
var formID1 = getDoc('formid', ".value");
|
var doccode = getDoc('doccode', ".value");
|
createPopSelect(formID1, formid, doccode, function(leaderHRcode, name) {
|
parent.btnId = th.id;
|
popupSet(leaderHRcode, name, huicode, huiname, true);
|
th.disabled = false;
|
}, url);
|
//这里是新OA审核界面用到 xin 2021-2-23 15:48:07
|
if(OAButonEvnt!=null){
|
//关闭
|
layer.close(OAButonEvnt);
|
$("body").removeClass("bodyScrollOA");
|
}
|
}
|
|
//审计功能处理 操作时间:2014-3-26 15:52:04 ——辛煜波
|
function shenji(panIndex,plane,doc,type){// panindex为面板元素,plane为面板信息,doc为单号,type参数针对2类型考虑的(具体看2类型js里面的simple.tree.js)
|
var newValue = [];// 需要审计的字段 修改后的值
|
var oldValue = panMain[panIndex].panelAuditValue;// 原始字段值(没改过前的字段值)
|
var auditFormId = formId;//审计的功能号
|
if (this.formType == 496) {
|
plane = $.isFunction(plane.getPanMap) ? plane.getPanMap(panIndex) : plane;
|
auditFormId = oldValue.formid;
|
// oldValue = [];
|
}
|
if (oldValue != null) {// 处理是否是审计的字段 。操作时间: 2014-3-25 :辛煜波
|
var auditField = panMain[panIndex].auditFiled;// 9802设置需要审计的字段名
|
try {
|
for (var i = 0; i < auditField.length; i++) {
|
var type = auditField[i][1];//类型(1:审计+查询。2:审计)
|
if (type == 1) {//单单是(审计+查询)不计算到表里面去
|
continue;
|
}
|
var name = auditField[i][0];//字段名
|
var old = (oldValue[name] != null ? oldValue[name] : '');//旧值
|
var news = (plane[name] != null ? plane[name] : '');//新值
|
if (type == 2 && (old != news)) {
|
var auditJson = {};
|
var array = [];//添加(审计+查询)
|
for (var a = 0; a < auditField.length; a++) {//把是 1(审计+查询)类型的字段添加到集合里
|
if (auditField[a][1] == 1) {
|
array.push((plane[auditField[a][0]] != null ? plane[auditField[a][0]] : ''));
|
}
|
}
|
auditJson.auditIndex = news + ',' + old + ',' + array.join(',');
|
let auditType="update";
|
if (isNew == 1 && doc == "") {
|
auditType = 'add';
|
}
|
if (typeof (type) != 'undefined' && type == '2add') {
|
auditType = "add";
|
}
|
auditJson.auditType = auditType;
|
auditJson.usercode = '';
|
auditJson.username = '';
|
auditJson.fieldId = name;
|
auditJson.fieldname = auditField[i][2];
|
auditJson.oldvalue = old;
|
auditJson.newvalue = news;
|
auditJson.formid = auditFormId;
|
auditJson.doccode = doc;
|
auditJson.mainFormId = formId;//主功能号,在三表或多表时MainFormId取主功能号,其他情况取值和formid相同取当前功能号
|
auditJson.headFlag = 0;//主表为0 从表为1
|
if ($doc(name + "_expr").val() != null && $doc(name + "_expr").val() == 0) {
|
var encrypt = new JSEncrypt();
|
encrypt.setPublicKey(rsakey.pubkey);
|
news=encrypt.encrypt(news);//加密
|
auditJson.oldvalue_expr = 0;
|
auditJson.newvalue_expr = 0;
|
auditJson.oldvalue = $doc(name + "_expr_val").val();
|
auditJson.newvalue = news;
|
auditJson.auditIndex_expr = news;//处理加密
|
}
|
newValue.push(auditJson);
|
}
|
}
|
} catch (e) {
|
$.messager.alert("操作提示", "审计出现异常,审计字段未能记录", "warning");
|
}
|
return newValue;
|
}
|
}
|
|
//9810面板大图标控件的选择按钮界面
|
function bigimages(){
|
var url="/FangYuanAdmin/myImagejsp/bigImage.jsp";
|
parent.deskTopShow('大图标图片',url,500,520,function(obj){
|
if(!obj)return;
|
if(obj.code=="error"){
|
$.messager.alert("操作提示", obj.info,"warning");return;
|
}
|
})
|
}
|
|
//解决面板控件自适应宽度问题
|
function autoColWidthByTable(rightWidth, leftWidth) {
|
try{
|
// rightWidth, leftWidth 适用于2,20类型窗体的左边和右边的宽度
|
var width = document.body.clientWidth - 50 - (leftWidth > 0?leftWidth:0); //网页可见区域宽
|
width=(rightWidth > 0)?rightWidth:width;//针对2,20窗体
|
width=(maxCols.length>1?width-20:width);//针对多面板。
|
var maxColss=Math.max.apply(null, maxCols);
|
for(var i=0;i<maxColss;i++) {
|
//计算每列的宽度公式: 屏幕宽度/ 总列数 - 标签宽度 - 必录标志宽度 - td padding 宽度 + 合并占用padding
|
var componentLength = Math.floor(width / maxColss) * (i+1) - 116 - 12 - 6 + (i * 3) ;//var colsWidth = width / maxCols * (i+1) - 116 - 12 - 10 + i * 6 ;
|
$(".controlsc"+(i+1)).css("width", componentLength+"px");
|
$(".controlsm"+(i+1)).css("width", componentLength+116+"px");
|
$(".controls38c"+(i+1)).css("width", componentLength+126+"px");
|
$(".controlszh"+(i+1)).css("width", componentLength-20+"px");
|
}
|
}catch(e){}
|
}
|
|
// 解决项目更改,且要兼容前项目 为前项目的方法
|
function checkUp() {
|
return panMain[panIndex].checkUp();
|
}
|
function keyDown(a, b) {
|
panMain[panIndex].keyDown(a, b);
|
if(panMain[panIndex].formtypeOne==10 && event.keyCode ==13){//针对10窗体个别操作不保存 xin 2020-10-13 14:38:01
|
panMain[panIndex].isChange=0;
|
}
|
}
|
function upSub(a,set_panIndex) {
|
if (set_panIndex) {
|
set_panIndex = isNaN(set_panIndex) ? 0 : set_panIndex;
|
panIndex = set_panIndex;
|
}
|
panMain[panIndex].upSub(a);
|
if (doc(a + "-img44") != null) {//是44静态图标控件 xin 2022-1-24 15:32:21
|
let path = getDoc(a, ".value");
|
setDoc(a + "-img44", ".src='" + path + "'");
|
}
|
}
|
function getBackAll(a, b) {
|
panMain[panIndex].getBackAll(a, b);
|
}
|
function getBack(a, b,c) {
|
if(c>0&&c!=undefined){
|
gtss=c;
|
panMain[c].getBack(a, b);
|
}else{
|
panMain[panIndex].getBack(a, b);
|
}
|
}
|
function windowOpen(a,panindex,onlyOne) {
|
return panMain[panindex].windowOpen(a,panindex,onlyOne);
|
}
|
function copy() {
|
panMain[panIndex].copy();
|
}
|
function loadSet(a) {
|
panMain[panIndex].loadSet(a);
|
}
|
function windowLink(a) {
|
panMain[panIndex].windowLink(a);
|
}
|
function htmlGet(a) {
|
panMain[panIndex].htmlGet(a);
|
}
|
function upImage(id, el) {
|
panMain[panIndex].upImage(id, el);
|
}
|
function getControlValue(field, fieldtype, targetControl, callback, pindex) {
|
panMain[panIndex].getControlValue(field, fieldtype, targetControl, callback, pindex);
|
};
|
function getSelect2(field, fieldtype, targetControl, callback, pindex, css) {
|
panMain[panIndex].getSelect2(field, fieldtype, targetControl, callback, pindex, css);
|
};
|
function getColors46(field) {
|
panMain[panIndex].getColors46(field);
|
}
|
function getWhere(ben, wai, zi, g, p, id) {
|
return panMain[panIndex].getWhere(ben, wai, zi, g, p, id);
|
}
|
|
//新增的44控件:静态图标控件 xin 2022-1-24 17:11:20
|
function openIcon(id){
|
$.getScript("/layui/layui.js").done(function() {
|
layer.open({
|
type: 2,
|
area :['calc(100% - 400px)','calc(100% - 80px)'],
|
title: false,
|
content: '/general/bigIconControl.jsp?id='+id,
|
cancel :function(index, layero){
|
layer.close(index);
|
}
|
});
|
}).fail(function() {
|
$.messager.alert("操作提示","界面没找到","warning");
|
});
|
}
|
|
//新的OA审核按钮 xin 2021-1-30 10:01:56
|
function OAVerifyMethod(formId,docstate,doccode){
|
$.getScript("/layui/layui.js").done(function() {
|
OAButonEvnt=layer.open({
|
type: 2,
|
area :['calc(100% - 400px)','calc(100% - 80px)'],
|
title: false,
|
content: '/general/approval.jsp?formId='+formId+'&docstate='+docstate+'&doccode='+doccode,
|
success :function(){
|
$("body").addClass("bodyScrollOA");
|
},
|
cancel :function(index, layero){
|
layer.close(index);
|
$("body").removeClass("bodyScrollOA");
|
}
|
});
|
}).fail(function() {
|
$.messager.alert("操作提示","OA审核界面没找到","warning");
|
});
|
}
|
|
//获取自定义描述名称
|
function getCustomName(){
|
var json = {};
|
let paninfo = panMain[panIndex].panInfo;
|
if (paninfo != null) {
|
for (let id in paninfo) {
|
let title = paninfo[id].title;
|
if (title != null && title != "" && title.indexOf("!") != -1) {//有自定义名称
|
let dive = $("#"+id).closest(".panelControlTDDiv");//获取到id的祖元素
|
if(dive!=null){
|
let miao = dive.find(".miaoshu_pan").html();
|
if (miao != null && miao != "") {
|
json[id] = miao;
|
}
|
}
|
}
|
}
|
}
|
return json;
|
}
|
|
$(function(){
|
// panPar.loadingSelect2Data().loading();
|
if(panMain[panIndex]!=null) {
|
var panelValue = panMain[panIndex].panelAuditValue;
|
if (panelValue != null) {
|
var shippercode = panelValue.shippercode;
|
var logisticscode = panelValue.logisticscode;
|
if (shippercode != null && shippercode != '' && logisticscode != null && logisticscode != '') {
|
$('#Traces').css('display', 'inline-block');//显示物流信息图标
|
var shipperName = panelValue.shippername;
|
var receiptertelephone = panelValue.receiptertelephone;
|
receiptertelephone = (receiptertelephone != null ? receiptertelephone : "");
|
var logisticsstate = panelValue.logisticsstate;
|
logisticsstate = (logisticsstate != null ? logisticsstate : "");
|
var doccode = panelValue.doccode;
|
var formid = panelValue.formid;
|
var parm = 'shippercode=' + shippercode + '&logisticscode=' + logisticscode + '&shippername=' + shipperName +
|
'&receiptertelephone=' + receiptertelephone + '&logisticsstate=' + logisticsstate + '&doccode=' + doccode + '&formid=' + formid;
|
$('#Traces').on('click', function () {//点击事件
|
layer.open({
|
type: 2,
|
area: ['800px', '500px'],
|
title: false,
|
content: '/general/LogisticsDetails.jsp?' + encodeURL(parm),
|
cancel: function (index) {
|
layer.close(index);
|
}
|
});
|
})
|
}
|
}
|
}
|
if(qrCode!=null && qrCode!=''){
|
$.get('/qr/showQrCode.do?qrCode=' + qrCode, function (res) {
|
let ent = $('#tpqrCodeDoc');
|
if (ent.length > 0) {
|
try{
|
//bootstrap5版本
|
new bootstrap.Popover(ent[0], {
|
trigger: 'hover focus',//focus,click 触发方式
|
placement: 'bottom',//显示方向
|
html: true,
|
title: '',//设置 弹出框 的标题
|
customClass: 'qrCode-class',
|
content: '<img src="' + res.data + '" style="width:200px;height:200px;">'
|
})
|
}catch (e) {
|
ent.popover({
|
trigger: 'hover focus',//focus,click 触发方式
|
placement: 'bottom',//显示方向
|
html:true,
|
//title:'单据二维码',//设置 弹出框 的标题
|
content: '<img src="' + res.data + '" style="width:200px;height:200px;">'
|
});
|
}
|
}
|
}, 'json');
|
}else{
|
$('#tpqrCodeDoc').hide();
|
}
|
|
//top页面info按钮执行函数
|
try{
|
$.ajax({
|
url: '/showInfo.do',
|
data: {'formid': panelFormId, 'doccode': getDoc('doccode', '.value')},
|
type: "POST", async: true, dataType: 'text',
|
success: function (mes) {
|
if (mes == "") {
|
$("#tpinfoDoc").hide();
|
return;
|
}
|
let ent = $('#tpinfoDoc');
|
if (ent.length > 0) {
|
try{
|
//bootstrap5版本
|
new bootstrap.Popover(ent[0], {
|
trigger: 'hover focus',//manual,click 触发方式
|
placement: 'bottom',//显示方向
|
html: true,
|
customClass: 'info-class-panle',
|
title: '单据信息',//设置 弹出框 的标题
|
content: mes
|
})
|
}catch (e) {
|
ent.popover({
|
trigger: 'hover focus',//manual,click 触发方式
|
placement: 'bottom',//显示方向
|
html:true,
|
title: '单据信息',//设置 弹出框 的标题
|
content: mes
|
});
|
}finally {
|
//复制链接用到 xin
|
ent.on('shown.bs.popover', function () {
|
$('.info-class-panle .popover-body ul li a').on('click', function () {
|
copyLink();
|
});
|
$('#tpUpDownDoc .popover-content ul li a').on('click', function () {
|
copyLink();
|
});
|
})
|
}
|
}
|
}
|
});
|
}catch(e){
|
//options.content='加载信息失败【失败原因:'+e+'】';
|
}
|
//处理40控件浏览图片,遍历40控件
|
$('.isViewer40').each(function(){
|
var that = this;
|
var v = $(this).data('value');
|
var path = '/images/help/fenlei_right.png';
|
if (v != null && v != '') {
|
if (v.toLowerCase().startsWith('https:') && v.toLowerCase().startsWith('http:')) {
|
$(that).append('<li style="width:auto;display: inline-block; margin: 1%;">' +
|
'<img src="' + v + '" alt="" style="width: 100%;height: 150px"/></li>');
|
new Viewer(that, {
|
title: false,
|
// url: 'src',
|
shown: function () {
|
$('.viewer-container').css('margin-top', '70');
|
}
|
});
|
return;
|
}
|
var type = 9;
|
type = (v.split(';') != null ? (v.split(';').length > 2 ? 19 : type) : type);
|
var data = {
|
unid: v,
|
controltype: type,
|
fieldid: this.id,
|
formid: formId,
|
doccode: $("#doccode").val(),
|
headflag: 0
|
}
|
$.post('/attachment/getAttachmentList.do', {'pant': JSON.stringify(data)}, function (data) {
|
if (data != null) {
|
var width = '97%';
|
width = (data.length > 1 ? '150px' : width);
|
for (var i = 0; i < data.length; i++) {
|
path = data[i].domain + "/uploads/attachment/" + data[i].dbid + "/" + data[i].formid + "/" + data[i].unid + "@p@" + data[i].seq + "." + data[i].orgFileType;
|
$(that).append('<li style="width:' + width + ';display: inline-block; margin: 1%;"><img src="' + path + '" alt="" style="width: 100%;height: 150px"/></li>');
|
}
|
new Viewer(that, {
|
title: false,
|
// url: 'src',
|
shown: function () {
|
$('.viewer-container').css('margin-top', '70');
|
}
|
});
|
} else {
|
$(that).append('<li><img src="' + path + '" alt="" style="width: 100%;height: 150px"/></li>');
|
}
|
});
|
} else {
|
$(that).append('<li><img src="' + path + '" alt="" style="width: 100%;height: 150px"/></li>');
|
}
|
})
|
$(".nextDocIco a").on("click", function () {//下一单点击事件 xin 2022-7-29 10:19:30
|
panPar.nextDocIco(function (msg) {
|
layer.msg(msg || "没有更多的待审核单据");
|
})
|
})
|
})
|