隐藏: visible: false,
显示:visible: true, visible属性没有true或者false,是visible,invisible和gone。
visible:可见的;
invisible:不可见,但占空间;
gone:不可见,也不占空间,控件从布局上消失了。
/**
*定义前端js脚本类
*@author
*@since
*/
var toDo = function () {}
/**
*类方法定义
*/
toDo.prototype = {
$table: $("#toDoListTable"),
queryUrl: "toDoListQuery.jssp?open",
toDo: function () { //构造方法
},
show: function () { //用于页面解析绑定类的入口方法
/**
* this.srcElement 为当前对象 this.docWidget 为当前对象定义的_json数据
*/
},
init: function () {
//传的参数为offset从第几条开始,limit就是一页显示多少条
//访问url,返回的data的格式:{"total":"17","rows":[{"id":null,"defName":"公司发文"},{"id":null,"defName":"公司收文"}]}
var ssd = $("#SF_fileType").val()=="收文";
var b = false;
var d = true;
var _state = $("#taskStates").val().split(",")[0];
if (_state == "2") {
b = true;
d = false;
}
//获取templateId对应的文中类型。如果有必要可以放入session缓存。
var docTypes = JSON.parse(this.get("type.jssp"));
$_tableBoot = this.$table.bootstrapTable({
onLoadSuccess: function () { //加载成功时执行
},
url: this.queryUrl,
sidePagination: "server", //服务端设置分页
//totalRows:19, //总条数,当sidePagination为server时填写,不为server时,这个值等于data的长度;也可以根据url访问的数据回来的对象data中的total
pageSize: 15, //一页显示多少条
pagination: true, //可以进行分页
clickToSelect: true,
pageList: [15], //可以进行的分页条数选择
cache: false,
queryParams: this.queryParams,
columns: [{
field: 'applyTitle',
title: '标题',
width: '30%',
formatter: function (value, row, index) {
var valueShow = "";
if (value && value != "") {
//valueShow = value.length > 14 ? (value.substring(0, 13) + "...") : value;
valueShow = value;
} else {
// value = "无标题"
value = "";
valueShow = value;
}
return '<a class="stLink" οnclick="toDoObj.applyTitleFun(this)" title="' + value + '" href="javascript:void(0)" piid="' + row.piid + '" tiid="' + row.tiid + '">' + valueShow + '</a>';
}
},
{
field: 'templateId',
title: '类别(文种)',
width: '20%',
formatter: function (value, row, index) {
return docTypes[value];
}
},
{
//visible: (_state == "10" ? false : true),
visible: ssd,
field: 'nodeName',
title: b ? '处理状态' : '当前状态',
width: '20%',
formatter: function (value, row, index) {
var val = "";
if (value != undefined)
val = value;
return val;
}
}, {
visible: b,
field: 'nodeId',
title: '当前状态',
width: '20%',
formatter: function (value, row, index) {
if (b) {
var userId = "【docUser.userId】";
var url = "state.jssp?piid=" + row.piid + "&state=" + row.state + "&userId=" + userId;
var name = wish.get(url).trim();
if (row.applyTitle == undefined)
name = "";
return name;
}
return value;
}
}, {
visible: b,
field: 'owner',
title: '处理人',
width: '10%',
formatter: function (value, row, index) {
if (b) {
var url = "dealer.jssp?piid=" + row.piid + "&state=" + row.state;
var name = wish.get(url).trim();
return name;
}
return value;
}
}, {
visible: ssd,
field: 'sendDeptName',
title: '来文单位',
width: '15%',
formatter: function (value, row, index) {
if(ssd && row.piid) {
var url = "sendDept.jssp?open&piid=" + row.piid;
var name = wish.get(url).trim();
return name;
}
return value;
}
}, {
field: 'createTime',
title: '到达时间',
width: '20%',
formatter: this.dealWithDate
}, {
visible: d,
field: 'priority',
title: '紧急度',
width: '10%',
formatter: function (value, row, index) {
if (value == 1) {
var yb = "普通"
return yb;
} else if (value == 2) {
var jj = "急"
return jj;
} else if (value == 3) {
var tj = "特急"
return tj;
} else {
//var ybb = "普通";
var ybb = "";
return ybb;
}
}
}
]
});
// var formulaCode = uniflow.getFileTypeConf("qfw").get("serNumConf");
},
/**
* 查询所调用的参数
* @param params
* @returns {{defId: (*|jQuery), start: *, length: *}}
*/
queryParams: function (params) {
var temp = {
subject: $("#subject").val(),
taskStates: $("#taskStates").val(),
SF_fileType: $("#SF_fileType").val(),
start: params.offset + 1,
length: params.limit
}
//alert(JSON.stringify(temp))
return temp;
},
/**
* 点击查询按钮调用的方法
* @returns {boolean}
*/
selectToDoClick: function () {
var para = {
query: {
subject: $("#subject").val(),
taskStates: $("#taskStates").val(),
SF_fileType: $("#SF_fileType").val(),
start: 1,
length: 15
},
silent: true,
//url : this.processQueryUrl
};
this.$table.bootstrapTable('refresh', para);
return false;
},
applyTitleFun: function (ths) {
var task = $.create("wrdp.uniflowApp.Task");
var piid = $(ths).attr("piid");
var tiid = $(ths).attr("tiid");
//task.open({piid:piid,tiid:tiid,appSystem:$("#systemName").val()});
task.open({
piid: piid,
tiid: tiid
});
},
dealWithDate: function (value, row, index) {
var format = function (time, format) {
var t = new Date(time);
var tf = function (i) {
return (i < 10 ? '0' : '') + i
};
return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
switch (a) {
case 'yyyy':
return tf(t.getFullYear());
break;
case 'MM':
return tf(t.getMonth() + 1);
break;
case 'mm':
return tf(t.getMinutes());
break;
case 'dd':
return tf(t.getDate());
break;
case 'HH':
return tf(t.getHours());
break;
case 'ss':
return tf(t.getSeconds());
break;
};
});
};
if (value != undefined) {
var value = format(value, 'yyyy-MM-dd HH:mm:ss');
} else {
value = "";
}
return value;
}
}
梅花香自古寒来