隱藏: visible: false,
顯示:visible: true,
visible屬性沒有true或者false,是visible,invisible和gone。
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;
}
}