topjui.common.js
function getTabWindow() {
var curTabWin = null;
if (topJUI.config.aloneUse) {
curTabWin = window;
} else {
var curTab = parent.$('#index_tabs').tabs('getSelected');
// var curTab = $('#index_tabs').tabs('getSelected');
if (curTab && curTab.find('iframe').length > ) {
curTabWin = curTab.find('iframe')[].contentWindow;
}
}
return curTabWin;
} //采用jquery easyui loading css效果
function showMask() {
$("<div class=\"datagrid-mask\"></div>").css({
display: "block",
width: "100%",
height: $(window).height()
}).appendTo("body");
$("<div class=\"datagrid-mask-msg\"></div>").html("正在处理,请稍候。。。").appendTo("body").css({
display: "block",
left: ($(document.body).outerWidth(true) - ) / ,
top: ($(window).height() - ) /
});
} function hideMask() {
$(".datagrid-mask").remove();
$(".datagrid-mask-msg").remove();
} //在主框架内打开Tab页,如点击左边的菜单打开Tab窗口
function addTab(params) {
var iframe = '<iframe src="' + params.url + '" scrolling="auto" frameborder="0" style="width:100%;height:100%;"></iframe>';
var t = $('#index_tabs');
var opts = {
id: Math.random(),
title: params.text,
closable: typeof(params.closable) != "undefined" ? params.closable : true,
iconCls: params.iconCls ? params.iconCls : 'fa fa-page',
content: iframe,
//href: params.url,
border: params.border || false,
fit: true
//cls: 'leftBottomBorder'
};
if (t.tabs('exists', opts.title)) {
t.tabs('select', opts.title);
} else {
var lastMenuClickTime = $.cookie("menuClickTime");
var nowTime = new Date().getTime();
if ((nowTime - lastMenuClickTime) >= ) {
$.cookie("menuClickTime", new Date().getTime());
t.tabs('myAdd', opts);
} else {
$.messager.show({
title: '温馨提示',
msg: '操作过快,请稍后重试!'
});
}
}
} addParentTab = function (options) { var src, title;
if (typeof options.grid == "object") {
if (options.grid.checkboxSelect == true) {
var rows = getCheckedRowsData(options.grid.type, options.grid.id);
if (rows.length == ) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.checkSelfGrid,
topJUI.language.message.icon.warning
);
return;
}
if (rows[]["UUID"]) {
src = options.tab.href.indexOf("?") >= ? options.tab.href + "&UUID=" + getMultiRowsFieldValue(rows, "UUID") : options.tab.href + "?UUID=" + getMultiRowsFieldValue(rows, "UUID");
} else {
src = options.tab.href.indexOf("?") >= ? options.tab.href + "&uuid=" + getMultiRowsFieldValue(rows, "uuid") : options.tab.href + "?uuid=" + getMultiRowsFieldValue(rows, "uuid");
}
} else {
//var unselectedMsg = options.grid.unselectedMsg;
var row = getSelectedRowData(options.grid.type, options.grid.id);
if (!row) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.selectSelfGrid,
topJUI.language.message.icon.warning
);
return;
}
src = replaceUrlParamValueByBrace(options.tab.href, row);
}
title = options.tab.title;
} else {
src = options.href;
title = options.title;
} var iframe = '<iframe src="' + src + '" frameborder="0" style="border:0;width:100%;height:100%;"></iframe>';
parent.$('#index_tabs').tabs("add", {
title: title,
content: iframe,
closable: true,
iconCls: 'fa fa-th'
}); } /**
* 打开新窗口
* @param options
*/
openWindow = function (options) {
var href;
if (typeof options.grid == "object") {
if (options.grid.checkboxSelect == true) {
var rows = getCheckedRowsData(options.grid.type, options.grid.id);
if (rows.length == ) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.checkSelfGrid,
topJUI.language.message.icon.warning
);
return;
}
href = replaceUrlParamValueByBrace(options.href, rows, "multiple");
} else {
var row = getSelectedRowData(options.grid.type, options.grid.id);
if (!row) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.selectSelfGrid,
topJUI.language.message.icon.warning
);
return;
}
href = replaceUrlParamValueByBrace(options.href, row);
}
} else {
href = options.href;
}
window.open(href);
} /**
* 绑定按钮点击事件
* @param options
*/
function bindMenuClickEvent($element, options) {
//if (typeof options.grid != "object") {
var toolbarOptions = getOptionsJson($element.closest("div"));
options = $.extend(true, toolbarOptions, options);
//}
var defaults = {};
// 打开dialog事件
if (options.clickEvent == "openDialog") {
defaults = {
iconCls: 'fa fa-plus',
parentGridUnselectedMsg: '请先选中一条主表数据!',
dialog: {
title: '数据详情',
width: ,
height:
}
}
options.dialog.width = options.dialog.width ? options.dialog.width : ;
options.dialog.height = options.dialog.height ? options.dialog.height : 'auto';
options = $.extend(defaults, options); if (typeof options.dialog == "object") {
generateDialogDoc(options);
} /*var extendDoc = "";
// 判断是否存在父grid
if (typeof options.parentGrid == "object") {
extendDoc += ',parentGrid:{type:\'' + options.parentGrid.type + '\',id:\'' + options.parentGrid.id + '\',params:\'' + options.parentGrid.params + '\',unselectedMsg:\'' + options.parentGrid.unselectedMsg + '\'}';
}
// 判断是否存在自身grid
if (typeof options.grid == "object") {
extendDoc += ',grid:{type:\'' + options.grid.type + '\',id:\'' + options.grid.id + '\',pkName:\'' + options.grid.pkName + '\',parentIdField:\'' + options.grid.parentIdField + '\',unselectedMsg:\'' + options.grid.unselectedMsg + '\',uncheckedMsg:\'' + options.grid.uncheckedMsg + '\'}';
}
// 判断dialog中是否存在editor编辑器
if (typeof options.dialog.editor == "object") {
var editorStr = "";
var dh = "";
for (var i = 0; i < options.dialog.editor.length; i++) {
if (i != options.dialog.editor.length - 1)
dh = ",";
editorStr += '{id:\'' + options.dialog.editor[i].id + '\',type:\'' + options.dialog.editor[i].type + '\',field:\'' + options.dialog.editor[i].field + '\'}' + dh;
}
extendDoc += ',editor:[' + editorStr + ']';
} // 如果未设置dialog标题,直接调用按钮名称
!options.dialog.title ? options.dialog.title = $element.text().replace(/[\r\n]/g, "") : '';
!options.dialog.url ? options.dialog.url = "" : '';
!options.dialog.beforeOpenCheckUrl ? options.dialog.beforeOpenCheckUrl = "" : options.dialog.beforeOpenCheckUrl; var userDefineDialogId = true;
if (options.dialog.id == "" || options.dialog.id == null) {
userDefineDialogId = false;
options.dialog.id = "dialog-" + parseInt(Math.random() * 99999999 + 1);
} var dialogDom = "";
var divOrForm = options.form == false ? "div" : "form";
dialogDom = '<' + divOrForm + ' data-toggle="topjui-dialog" data-options="id:\'' + options.dialog.id + '\',href:\'' + options.dialog.href + '\',url:\'' + options.dialog.url + '\',title:\'' + options.dialog.title + '\',beforeOpenCheckUrl:\'' + options.dialog.beforeOpenCheckUrl + '\'' + extendDoc + '"></' + divOrForm + '>'; // 判断dialog是否存在linkbutton按钮组
var buttonsDom = "";
if (typeof options.dialog.buttonsGroup == "object") {
var buttonsArr = options.dialog.buttonsGroup;
var btLength = buttonsArr.length;
if (btLength > 0) {
for (var i = 0; i < btLength; i++) {
// 默认为ajaxForm提交方式
if (!buttonsArr[i].handler) {
buttonsArr[i].handler = 'ajaxForm';
}
// 传递本grid参数
var gridDoc = "";
if (typeof options.grid == "object") {
gridDoc = ',grid:{type:\'' + options.grid.type + '\',id:\'' + options.grid.id + '\'}';
}
// 传递其它grid参数
if (typeof buttonsArr[i].reload == "object") {
var reloadStr = "";
var dh2 = "";
for (var j = 0; j < buttonsArr[i].reload.length; j++) {
if (j != buttonsArr[i].reload.length - 1)
dh2 = ","; reloadStr += '{type:\'' + buttonsArr[i].reload[j].type + '\', id:\'' + buttonsArr[i].reload[j].id + '\', clearQueryParams:\'' + buttonsArr[i].reload[j].clearQueryParams + '\'}' + dh2;
}
extendDoc += ',reload:[' + reloadStr + ']';
}
buttonsDom += '<a href="#" data-toggle="topjui-linkbutton" data-options="handlerBefore:\'' + buttonsArr[i].handlerBefore + '\',handler:\'' + buttonsArr[i].handler + '\',dialog:{id:\'' + options.dialog.id + '\'},url:\'' + buttonsArr[i].url + '\',iconCls:\'' + buttonsArr[i].iconCls + '\'' + extendDoc + '">' + buttonsArr[i].text + '</a>';
}
}
} getTabWindow().$('body').append(
dialogDom +
'<div id="' + options.dialog.id + '-buttons" style="display:none">' +
buttonsDom +
'<a href="#" data-toggle="topjui-linkbutton" data-options="iconCls:\'icon-no\'" onclick="javascript:$(\'#' + options.dialog.id + '\').dialog(\'close\')">关闭</a>' +
'</div>'
)*/ /*$element.on("click", function () { options.dialog.leftMargin = ($(document.body).width() * 0.5) - (options.dialog.width * 0.5);
options.dialog.topMargin = ($(document.body).height() * 0.5) - (options.dialog.height * 0.5); if (typeof options.parentGrid == "object") {
openDialogAndloadDataByParentGrid(options);
} else if (options.dialog.url) {
openDialogAndloadDataByUrl(options);
} else {
if (options.grid.uncheckedMsg) {
var rows = getCheckedRowsData(options.grid.type, options.grid.id);
if (rows.length == 0) {
$.messager.alert(
topJUI.language.message.title.operationTips,
options.grid.uncheckedMsg,
topJUI.language.message.icon.warning
);
return;
}
}
if (options.dialog.onBeforeOpen != "undefined") {
// 回调执行传入的自定义函数
executeCallBackFun(options.dialog.onBeforeOpen, options);
}
var $dialogObj = $("#" + options.dialog.id);
$dialogObj.dialog({
width: options.dialog.width,
height: options.dialog.height,
maximized: options.dialog.maximized,
maximizable: options.dialog.maximizable,
left: options.dialog.leftMargin,
top: options.dialog.topMargin,
buttons: options.dialog.buttons
});
//$dialogObj.dialog('refresh', appendSourceUrlParam(options.dialog.href)); //加载两次href指定的页面
$dialogObj.dialog({
href: appendSourceUrlParam(options.dialog.href)
});
$dialogObj.dialog('open');
}
});*/
} else if (options.clickEvent == "openTab") {
defaults = {
iconCls: 'fa fa-th'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
addParentTab(options);
});*/
} else if (options.clickEvent == "openWindow") {
defaults = {
iconCls: 'fa fa-link'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
openWindow(options);
});*/
} else if (options.clickEvent == "edatagrid") {
defaults = {
iconCls: 'fa fa-plus'
}
options = $.extend(defaults, options); $element.on("click", function () {
if (options.type == "addRow")
$('#' + options.grid.id).edatagrid('addRow', );
if (options.type == "saveRow")
$('#' + options.grid.id).edatagrid('saveRow');
if (options.type == "cancelRow")
$('#' + options.grid.id).edatagrid('cancelRow');
});
} else if (options.clickEvent == "doAjax") {
defaults = {
iconCls: 'fa fa-cog'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
//doAjaxHandler(options);
});*/
} else if (options.clickEvent == "request") {
defaults = {
iconCls: 'fa fa-cog'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
requestHandler(options);
});*/
} else if (options.clickEvent == "delete") {
defaults = {
iconCls: 'fa fa-trash'
}
options = $.extend(defaults, options); /* $element.on("click", function () {
deleteHandler(options);
});*/
} else if (options.clickEvent == "filter") {
defaults = {
iconCls: 'fa fa-filter'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
filterHandler(options);
});*/
} else if (options.clickEvent == "search") {
defaults = {
iconCls: 'fa fa-search'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
searchHandler(options);
});*/
} else if (options.clickEvent == "export") {
defaults = {
iconCls: 'fa fa-file'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
exportHandler(options);
});*/
} else if (options.clickEvent == "import") {
defaults = {
iconCls: 'fa fa-file',
href: '/system/excel/excelImport'
}
options = $.extend(defaults, options); /*$element.on("click", function () {
importHandler(options);
});*/
}
return options;
} /**
* 打开dialog,加载选中的表格数据到dialog中
* @param options
*/
function openDialogAndloadDataByParentGrid(options) {
var parentGridUnselectedMsg = "";
var parentGridParam = "";
if (typeof options.parentGrid == "object") {
parentGridUnselectedMsg = options.parentGrid.unselectedMsg;
parentGridParam = options.parentGrid.params;
if (options.parentGrid.type == "datagrid") { } else if (options.parentGrid.type == "treegrid") { }
} //判断父表数据是否被选中
var parentRow = getSelectedRowData(options.parentGrid.type, options.parentGrid.id);
if (!parentRow) {
$.messager.alert(
topJUI.language.message.title.operationTips,
options.parentGrid.unselectedMsg || topJUI.language.message.msg.selectParentGrid,
topJUI.language.message.icon.warning
);
return;
} //打开dialog前判断是否还有其它操作限制
if (options.dialog.beforeOpenCheckUrl) {
if (!beforeOpenCheck(replaceUrlParamValueByBrace(options.dialog.beforeOpenCheckUrl, parentRow))) return;
} var $dialogObj = $("#" + options.dialog.id);
$dialogObj.iDialog(options); // 保存原始href,以便在占位参数替换后还原
var oriHref = options.dialog.href;
var newHref = oriHref;
if (options.dialog.href.indexOf("{") != -) {
if (options.dialog.href.indexOf("{parent.") != -) {
// 替换父表中选中行占位值
newHref = replaceUrlParamValueByBrace(appendSourceUrlParam(oriHref), parentRow, "parent");
}
if (newHref.indexOf("{") != -) {
// 替换本表中选中行占位值
var row = getSelectedRowData(options.grid.type, options.grid.id);
newHref = replaceUrlParamValueByBrace(appendSourceUrlParam(newHref), row);
}
$dialogObj.dialog({
href: newHref
});
$dialogObj.dialog('open');
} else {
$dialogObj.dialog('open');
}
} /**
* 通过dialog的url参数加载数据到dialog中
* @param options
*/
function openDialogAndloadDataByUrl(options) {
//判断本表数据是否被选中
var row = getSelectedRowData(options.grid.type, options.grid.id);
if (!row) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.selectSelfGrid,
topJUI.language.message.icon.warning
);
return;
} //打开dialog前判断是否还有其它操作限制
if (options.dialog.beforeOpenCheckUrl) {
if (!beforeOpenCheck(replaceUrlParamValueByBrace(options.dialog.beforeOpenCheckUrl, row))) return;
} var $dialogObj = $("#" + options.dialog.id);
$dialogObj.iDialog(options); // 保存原始url,以便在占位参数替换后还原
var oriHref = options.dialog.href;
if (options.dialog.href.indexOf("{") != -) {
// 替换本表中选中行占位值
var newHref = replaceUrlParamValueByBrace(appendSourceUrlParam(oriHref), row);
$dialogObj.dialog({
href: newHref
});
//$dialogObj.dialog('open').dialog("refresh", newHref); //加载两次href指定的页面
$dialogObj.dialog('open');
} else {
$dialogObj.dialog('open');
} } /**
* 打开一个对话框窗口
* @param options
*/
function dialogHandler(options) {
if (options.component == "loadData") {
editHandler(options);
} else if (options.action == "loadParentData") {
addChildHandler(options);
} else {
addHandler(options);
}
} /**
* 新增表格数据
* @param options
*/
function addHandler(options) {
var controllerUrl = getUrl("controller");
var defaults = {
gridId: 'datagrid'
//dialogId : 'addDialog',
//dialogHref : options.dialogHref ? options.dialogHref : controllerUrl + "edit"
};
options = $.extend(defaults, options); //clearDialogHrefKeyValue(options.addDialogId, "action,uuid");
var dialogObj = $("#" + options.dialogId);
dialogObj.dialog({
//title : '新增数据',
iconCls: 'fa fa-plus',
toolbar: '#' + options.dialogId + '-toolbar',
buttons: '#' + options.dialogId + '-buttons'
}); if (options.dialogHref != undefined) {
dialogObj.dialog('refresh', options.dialogHref);
}
dialogObj.dialog('open'); } /**
* 检查授权
* @param resource 资源值,可以是url也可以是标识
*/
function authCheck(resource) {
if (topJUI.config.authUrl == "") {
return true;
} else {
var isAuth = false;
$.ajax({
type: 'post',
url: ctx + "/system/authAccess/getAuthByRoleIdAndUrl",
data: {url: resource},
async: false,
success: function (data) {
if (data == ) {
var msgJson = {
title: topJUI.language.message.title.operationTips,
msg: topJUI.language.message.msg.permissionDenied,
icon: topJUI.language.message.icon.warning
};
$.messager.alert(msgJson);
isAuth = false;
} else {
isAuth = true;
}
}
});
return isAuth;
}
} function beforeOpenCheck($checkUrl) {
var isAuth = false;
$.ajax({
type: 'get',
url: $checkUrl,
async: false,
success: function (data) {
if (data.statusCode == ) {
var msgJson = {
title: topJUI.language.message.title.operationTips,
msg: data.message
};
$.messager.alert(msgJson);
isAuth = false;
} else {
isAuth = true;
}
}
});
return isAuth;
} //新增子表数据
function addChildHandler(options) { var row = $("#" + options.parentGridId).treegrid('getSelected') ? $("#" + options.parentGridId).treegrid('getSelected') : $("#" + options.parentGridId).datagrid('getSelected');
if (row) {
var controllerUrl = getUrl("controller");
var defaults = {
gridId: 'datagrid',
//dialogId : 'addDialog',
dialogHref: options.dialogHref ? options.dialogHref : controllerUrl + "edit"
}
options = $.extend(defaults, options); //clearDialogHrefKeyValue(options.addDialogId, "action,uuid");
var dialogObj = $("#" + options.dialogId);
dialogObj.dialog({
//title : '新增数据',
iconCls: 'fa fa-plus',
toolbar: '#' + options.dialogId + '-toolbar',
buttons: '#' + options.dialogId + '-buttons'
}); if (options.dialogHref != undefined) {
dialogObj.dialog('refresh', options.dialogHref);
}
dialogObj.dialog('open');
setTimeout(function () {
getTabWindow().$("#" + options.dialogId + " iframe").each(function (i) {
this.contentWindow.document.body.innerHTML = '';
}); var jsonData = {};
if (options.gridParam) {
var gridParamArr = options.gridParam.split(",");
//传递给dialog输入框的参数
for (var i = ; i < gridParamArr.length; i++) {
jsonData[gridParamArr[i]] = row[gridParamArr[i]];
}
}
jsonData.puuid = row.uuid; dialogObj.form('load', jsonData);
}, );
} else {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.selectParentGrid,
topJUI.language.message.icon.warning
);
}
} //编辑表格数据
function editHandler(options) {
var controllerUrl = getUrl("controller");
var defaults = {
gridId: 'datagrid',
//dialogId : 'editDialog',
dialogHref: options.dialogHref ? options.dialogHref : controllerUrl + "edit",
dialogUrl: options.dialogUrl ? options.dialogUrl : controllerUrl + "getDetailByUuid?uuid={uuid}"
}
options = $.extend(defaults, options); loadDialogData(options);
} /**
* 在复选框被选中的时候返回所有行
* @param gridType
* @param gridId
* @returns {jQuery}
*/
function getCheckedRowsData(gridType, gridId) {
return $("#" + gridId).treegrid('getChecked');
} /**
* 获得选中的datagrid或treegrid一行数据
* @param options
* @returns {*}
*/
function getSelectedRowData(gridType, gridId) {
return getRowsDataBySelected(gridType, gridId, false);
} /**
* 获得选中的datagrid或treegrid多行数据
* @param options
* @returns {*}
*/
function getSelectedRowsData(gridType, gridId) {
return getRowsDataBySelected(gridType, gridId, true);
} /**
* 获得选中的datagrid或treegrid一行或多行数据
* @param options
* @returns {*}
*/
function getRowsDataBySelected(gridType, gridId, multiple) {
var rows = multiple ? $("#" + gridId).datagrid('getSelections') : $("#" + gridId).datagrid('getSelected');
/*
var rows;
if (gridType == "datagrid") {
rows = multiple ? $("#" + gridId).datagrid('getSelections') : $("#" + gridId).datagrid('getSelected');
} else if (gridType == "treegrid") {
rows = multiple ? $("#" + gridId).treegrid('getSelections') : $("#" + gridId).treegrid('getSelected');
}
*/
return rows;
} function getRowsDataBySelected2(options, multiple) {
var rows;
var gridId; if (typeof options.parentGrid == "object") {
gridId = options.parentGrid.id;
if (options.parentGrid.type == "datagrid") {
rows = multiple ? $("#" + gridId).datagrid('getSelections') : $("#" + gridId).datagrid('getSelected');
} else if (options.parentGrid.type == "treegrid") {
rows = multiple ? $("#" + gridId).treegrid('getSelections') : $("#" + gridId).treegrid('getSelected');
}
} else if (typeof options.grid == "object") {
gridId = options.grid.id;
if (options.grid.type == "datagrid") {
rows = multiple ? $("#" + gridId).datagrid('getSelections') : $("#" + gridId).datagrid('getSelected');
} else if (options.grid.type == "treegrid") {
rows = multiple ? $("#" + gridId).treegrid('getSelections') : $("#" + gridId).treegrid('getSelected');
}
}
return rows;
} /**
* 刷新多个表格
* @param gridObj
*/
function refreshGrids(gridObj) {
// 重新加载Grid数据
if (typeof gridObj == 'object') {
for (var i = ; i < gridObj.length; i++) {
var obj = gridObj[i];
// 通过闭包嵌套和不同时序的执行来刷新grid
(function (i) {
setTimeout(function () {
refreshGrid(obj.type, obj.id, obj.clearQueryParams);
}, i * );
})(i);
}
}
} /**
* 刷新一个datagrid或treegrid
* @param options
*/
function refreshGrid(gridType, gridId, clearQueryParams) {
if (gridType == "datagrid") {
if (clearQueryParams == true) {
$("#" + gridId).datagrid({
queryParams: {
clearQueryParams: ''
}
});
}
$("#" + gridId).datagrid('reload');
$("#" + gridId).datagrid('unselectAll');
} else if (gridType == "treegrid") {
// 刷新整合表格
//$("#" + options.treegrid.id).treegrid('reload');
// 只刷新当前节点
$("#" + gridId).treegrid('reload');
$("#" + gridId).treegrid('unselectAll');
}
} /**
* Ajax操作
* @param options
*/
function doAjaxHandler(options) {
var defaults = {
gridId: 'datagrid',
iconCls: 'fa fa-cog',
comfirmMsg: topJUI.language.message.msg.comfirmMsg,
grid: {
uncheckedMsg: topJUI.language.message.msg.checkSelfGrid
}
}
options = $.extend({}, defaults, options);
options.url = appendSourceUrlParam(options.url); // 替换父表的占位数据
if (options.url.indexOf("{parent") != -) {
var parentRow = getSelectedRowData(options.parentGrid.type, options.parentGrid.id);
if (!parentRow) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.selectParentGrid,
topJUI.language.message.icon.warning
);
return;
}
options.url = replaceUrlParamValueByBrace(options.url, parentRow, "parent");
} if (typeof options.grid == "object") {
var dgOpts = $("#" + options.grid.id).datagrid('options'); if (options.grid.multiCheck == true || options.grid.uncheckedMsg != undefined) {
// 勾选复选框提交多条数据
$("#" + options.grid.id).datagrid('multiCheckedAjax', options);
} else {
if (dgOpts.singleSelect == false) {
$("#" + options.grid.id).datagrid('multiSelectedAjax', options);
} else { // 提交单条记录
$("#" + options.grid.id).datagrid('singleSelectedAjax', options);
}
}
} } /**
* 普通请求操作
* @param options
*/
function requestHandler(options) {
options.url = appendSourceUrlParam(options.url); if (typeof options.grid == "object") {
// 替换本表的占位数据
var row = getSelectedRowData(options.grid.type, options.grid.id);
if (row == null) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.selectSelfGrid,
topJUI.language.message.icon.warning
);
return;
}
// 替换本表中选择的单行字段值
options.newUrl = replaceUrlParamValueByBrace(options.url, row);
} else {
options.newUrl = options.url;
} window.location.href = options.newUrl;
} /**
* 删除表格数据
* @param options
*/
function deleteHandler(options) {
// 权限控制
var oriUrl = options.url ? options.url : getUrl("controller") + "delete" var defaults = {
gridId: 'datagrid',
url: options.url ? appendSourceUrlParam(options.url) : getUrl("controller") + "delete" + location.search
}
options = $.extend(defaults, options); var rows = getCheckedRowsData(options.grid.type, options.grid.id);
if (rows.length == ) {
$.messager.alert(
topJUI.language.message.title.operationTips,
topJUI.language.message.msg.checkSelfGrid,
topJUI.language.message.icon.warning
);
return;
}
$.messager.confirm(
topJUI.language.message.title.confirmTips,
topJUI.language.message.msg.confirmDelete,
function (flag) {
if (flag) {
options.ajaxData = {
uuid: getMultiRowsFieldValue(rows, "uuid"),
uuids: getMultiRowsFieldValue(rows, "uuid")
}; if (doAjax(options)) {
refreshGrid(options.grid.type, options.grid.id);
}
}
});
} /**
* 过滤表格数据
* @param options
*/
function filterHandler(options) {
if (typeof options.grid == "object") {
var gridId = options.grid.id;
var gridOptions = $("#" + gridId).datagrid("options");
var filter = gridOptions.filter ? gridOptions.filter : [];
if (options.grid.type == "datagrid") {
if ($(".datagrid-filter-row").length > ) {
$("#" + gridId).datagrid('disableFilter');
} else {
$("#" + gridId).datagrid('enableFilter', filter);
}
} else if (options.grid.type == "treegrid") {
if ($(".datagrid-filter-row").length > ) {
$("#" + gridId).treegrid('disableFilter');
} else {
$("#" + gridId).treegrid('enableFilter', filter);
}
}
}
} /**
* 高级查询表格数据
* @param options
*/
function searchHandler(options) {
// 获得查询字段信息
if (typeof options.grid == "object") {
getColumnsNameAndField(options.grid.type, options.grid.id);
} // 组合查询对话框内容
var searchContent = '<table id="advanceSearchTable" class="editTable">';
searchContent += '<tr>';
searchContent += '<td style="font-weight: bold;">方式</td>';
searchContent += '<td style="font-weight: bold;">左括号</td>';
searchContent += '<td style="font-weight: bold;">字段</td>';
searchContent += '<td style="font-weight: bold;">条件</td>';
searchContent += '<td style="font-weight: bold;">数值</td>';
searchContent += '<td style="font-weight: bold;">右括号</td>';
searchContent += '<td style="font-weight: bold;">操作</td>';
searchContent += '</tr>';
searchContent += '<tr>';
searchContent += '<td><input type="text" class="join" name="join"></td>';
searchContent += '<td><input type="text" class="lb" name="lb"></td>';
searchContent += '<td><input type="text" class="field" name="field"></td>';
searchContent += '<td><input type="text" class="op" name="op"></td>';
searchContent += '<td><input type="text" class="value" name="value"></td>';
searchContent += '<td><input type="text" class="rb" name="rb"></td>';
searchContent += '<td><a id="addCondition" href="javascript:void(0)"></a>';
searchContent += '</td>';
searchContent += '</tr>';
searchContent += '</table>'; // 组合查询对话框默认属性
var defaults = {
dialog: {
id: 'advanceSearchDialog',
title: '组合查询',
width: ,
height: ,
modal: false,
collapsible: true,
minimizable: false,
maximized: false,
resizable: true,
closed: false,
closable: true,
zIndex: ,
iconCls: 'fa fa-search',
//href: '/html/search/form.html',
content: searchContent,
buttons: '#advanceSearchDialog-buttons',
onOpen: function () {
//窗口打开时,触发事件
$(this).trigger(topJUI.eventType.initUI.advanceSearchForm);
}
}
};
options = $.extend(defaults, options); // 组合查询对话框
var searchForm = '<form id="advanceSearchDialog"></form>';
searchForm += '<div id="advanceSearchDialog-buttons" style="display:none">';
searchForm += '<a href="#" id="resetAdvanceSearchForm" data-toggle="easyui-linkbutton" data-options="iconCls:\'icon-reload\'">清空</a>';
searchForm += '<a href="#" id="submitAdvanceSearchForm" data-toggle="topjui-linkbutton" data-options="iconCls:\'icon-search\'">查询</a>';
searchForm += '<a href="#" id="closeAdvanceSearchDialog">关闭</a>';
searchForm += '</div>';
getTabWindow().$('body').append(searchForm); // 打开组合查询对话框
var dialogObj = $("#" + options.dialog.id);
dialogObj.dialog(options.dialog); // 重置查询条件
$('#resetAdvanceSearchForm').linkbutton({
iconCls: 'fa fa-refresh',
onClick: function () {
var formDataArr = [];
loadGrid(formDataArr);
}
}); // 提交查询请求
$('#submitAdvanceSearchForm').linkbutton({
iconCls: 'fa fa-search',
onClick: function () {
var formDataArr = [];
var formData = $("#" + options.dialog.id).serializeArray();
var num = formData.length / ;
for (var i = ; i < num; i++) {
var join = formData[i * + ].name;
var joinValue = formData[i * + ].value;
var lb = formData[i * + ].name;
var lbValue = formData[i * + ].value;
var field = formData[i * + ].name;
var fieldValue = formData[i * + ].value;
var op = formData[i * + ].name;
var opValue = formData[i * + ].value;
var value = formData[i * + ].name;
var valValue = formData[i * + ].value;
var rb = formData[i * + ].name;
var rbValue = formData[i * + ].value; formDataArr.push({
join: joinValue,
lb: lbValue,
field: fieldValue,
op: opValue,
value: valValue,
rb: rbValue
});
}
// console.log(JSON.stringify(formDataArr));
loadGrid(formDataArr);
}
}); // 关闭查询对话框
$('#closeAdvanceSearchDialog').linkbutton({
iconCls: 'fa fa-close',
onClick: function () {
$("#" + options.dialog.id).dialog('close');
//$(this).closest(".window-body").dialog("destroy");
}
}); // 新增查询条件
var html = '<tr>';
html += '<td><input type="text" class="join" name="join"></td>';
html += '<td><input type="text" class="lb" name="lb"></td>';
html += '<td><input type="text" class="field" name="field"></td>';
html += '<td><input type="text" class="op" name="op"></td>';
html += '<td><input type="text" class="value" name="value"></td>';
html += '<td><input type="text" class="rb" name="rb"></td>';
html += '<td><a class="deleteCondition" href="javascript:void(0)"></a></td></tr>';
$("#addCondition").on('click', function () {
$("#advanceSearchTable").append(html);
$(this).trigger(topJUI.eventType.initUI.advanceSearchForm);
});
} /**
* 导入表格数据
* @param options
*/
function importHandler(options) {
if (typeof options.grid == "object") {
getColumnsNameAndField(options.grid.type, options.grid.id); var dialogObj = $("#importExcelDialog");
dialogObj.dialog({
title: '导入Excel数据',
iconCls: 'icon-find',
toolbar: '#importDialog-toolbar',
buttons: '#importDialog-buttons'
}); dialogObj.dialog('open');
}
} /**
* 获得grid的中文列名及字段名
* @param gridType
* @param gridId
*/
function getColumnsNameAndField(gridType, gridId) {
var frozenFieldName = [];
var liveFieldName = [];
var fieldName = [];
var colName = []; if (gridType == "datagrid") {
frozenFieldName = $("#" + gridId).datagrid('getColumnFields', true);
liveFieldName = $("#" + gridId).datagrid('getColumnFields');
fieldName = frozenFieldName.concat(liveFieldName);
for (var i = ; i < fieldName.length; i++) {
var col = $("#" + gridId).datagrid("getColumnOption", fieldName[i]);
colName.push(col.title);
}
} else if (gridType == "treegrid") {
frozenFieldName = $("#" + gridId).treegrid('getColumnFields', true);
liveFieldName = $("#" + gridId).treegrid('getColumnFields');
fieldName = frozenFieldName.concat(liveFieldName);
for (var j = ; j < fieldName.length; j++) {
var col = $("#" + gridId).treegrid("getColumnOption", fieldName[j]);
colName.push(col.title);
}
} var colNameStr = colName.join(',').replace(/,操作/g, "").replace(/操作,/g, "");
var fieldNameStr = fieldName.join(',').replace(/,handle/g, "").replace(/handle,/g, ""); $.cookie('gridId', gridId);
$.cookie('gridType', gridType);
$.cookie('colNameStr', colNameStr);
$.cookie('fieldNameStr', fieldNameStr);
} /**
* 导出表格数据
* @param options
*/
function exportHandler(options) {
var controllerUrl = getUrl("controller");
var defaults = {
gridId: 'datagrid',
//url: '/system/index/requestSuccess',
excelTitle: parent.$('#index_tabs').tabs('getSelected').panel('options').title + "_导出数据_" + getCurrentDatetime("YmdHis"),
url: options.url ? options.url : controllerUrl + "exportExcel"
}
options = $.extend(defaults, options); var gridId;
var frozenFieldName;
var liveFieldName;
var fieldName;
var columnOption;
var colName = [];
var hiddenMark = []; if (typeof options.grid == "object") {
gridId = options.grid.id;
if (options.grid.type == "datagrid") {
frozenFieldName = $("#" + gridId).datagrid('getColumnFields', true);
liveFieldName = $("#" + gridId).datagrid('getColumnFields');
fieldName = frozenFieldName.concat(liveFieldName);
for (var i = ; i < fieldName.length; i++) {
columnOption = $("#" + gridId).datagrid("getColumnOption", fieldName[i]);
colName.push(columnOption.title);
if (columnOption.hidden == true || columnOption.checkbox == true)
hiddenMark.push(true);
else
hiddenMark.push(false);
}
} else if (options.grid.type == "treegrid") {
frozenFieldName = $("#" + gridId).treegrid('getColumnFields', true);
liveFieldName = $("#" + gridId).treegrid('getColumnFields');
fieldName = frozenFieldName.concat(liveFieldName);
for (var j = ; j < fieldName.length; j++) {
columnOption = $("#" + gridId).treegrid("getColumnOption", fieldName[j]);
colName.push(columnOption.title);
if (columnOption.hidden == true || columnOption.checkbox == true)
hiddenMark.push(true);
else
hiddenMark.push(false);
}
}
} // 去除隐藏的列
for (var h = ; h < hiddenMark.length; h++) {
if (hiddenMark[h]) {
colName.splice(h, );
fieldName.splice(h, );
hiddenMark.splice(h, );
h--;
}
} var colNameStr = colName.join(',').replace(/,操作/g, "").replace(/操作,/g, "");
var fieldNameStr = fieldName.join(',').replace(/,handle/g, "").replace(/handle,/g, ""); options.ajaxData = {
excelTitle: options.excelTitle,
colName: colNameStr,
fieldName: fieldNameStr
}; //if (doAjax(options)) {
window.location.href = options.url + '?excelTitle=' + options.excelTitle + '&colName=' + colNameStr + '&fieldName=' + fieldNameStr;
//}
} //撤销表格数据
function redoHandler() {
$(options.gridId).datagrid('rejectChanges');
$(options.gridId).datagrid('unselectAll');
} // ajax操作
function doAjax(options) {
var result = false; var defaults = {
//confirmMsg: '确定要进行该操作吗?'
}
options = $.extend(defaults, options); $.ajax({
//url: options.url + location.search,
url: options.url,
type: 'post',
data: options.ajaxData,
dataType: "json",
async: false,
contentType: "application/x-www-form-urlencoded;charset=utf-8",
beforeSend: function () {
$.messager.progress({text: '正在操作...'});
},
success: function (data, response, status) {
$.messager.progress('close');
showMessage(data); // 重新加载指定的Grid数据
refreshGrids(options.reload); if (data.statusCode == || data.statusCode == || data.statusCode == ) {
result = true;
} else {
result = false;
}
}
}); return result;
} /**
* 设置对话框href附加参数及值
* @param dialogId
*/
function setDialogHrefKeyValue(dialogId, paramStr, paramValueStr) { var paramArr = paramStr.split(",");
var paramValueArr = paramValueStr.split(","); var dialogHref = $(dialogId).dialog('options').href;
var keyValue = "";
for (i = ; i < paramArr.length; i++) {
if (dialogHref.indexOf("?") > ) {
if (dialogHref.indexOf(paramArr[i] + "=" + paramValueArr[i]) == -) {
keyValue += "&" + paramArr[i] + "=" + paramValueArr[i];
}
} else {
if (i == ) {
keyValue = "?" + paramArr[i] + "=" + paramValueArr[i];
} else {
keyValue += "&" + paramArr[i] + "=" + paramValueArr[i];
} }
}
$(dialogId).dialog('options').href = dialogHref + keyValue;
} function clearDialogHrefKeyValue(dialogId, paramStr) { var paramArr = paramStr.split(",");
var dialogHref = $(dialogId).dialog('options').href;
if (dialogHref.indexOf("?") > ) {
var newUrlParam = ""
var urlMain = dialogHref.substring(, dialogHref.indexOf("?") + );
var urlParam = dialogHref.substring(dialogHref.indexOf("?") + );
var urlParamArray = urlParam.split("&");
for (i = ; i < urlParamArray.length; i++) {
for (j = ; j < paramArr.length; j++) {
if (urlParamArray[i].indexOf(paramArr[j] + "=") >= ) {
urlParamArray.remove(i);
}
}
}
if (urlParamArray.length == ) {
newUrlParam = urlParamArray[];
} else if (urlParamArray.length > ) {
newUrlParam = urlParamArray.join("&");
} var newUrl = "";
newUrl = urlMain + newUrlParam;
var lastStr = newUrl.substring(newUrl.length - );
if (lastStr == "?") {
newUrl = newUrl.substring(, newUrl.length - );
} } else {
newUrl = dialogHref;
} $(dialogId).dialog('options').href = newUrl;
} // 表单提交返回提示信息判断
// msgCode为1或200时,右下弹出自动关闭提示
// msgCode为100时,中间弹出手动关闭提示
function msgFn(data) {
var msgJson = {};
var msgCode = "";
if (typeof(data) == "object") {
msgCode = data.code;
msgJson = {
title: data.title,
msg: data.message
};
} else {
msgCode = data;
if (data == ) {
msgJson = {
title: '温馨提示',
msg: '操作成功'
};
} else {
msgJson = {
title: '温馨提示',
msg: '操作失败!未知错误,请重试!'
};
}
}
if (msgCode == || msgCode == || msgCode == ) {
if (msgCode == || msgCode == )
$.messager.show(msgJson);
else
$.messager.alert(msgJson);
//$(options.currentDialogId).dialog('close').form('reset');
//$(options.gridId).datagrid('reload'); /*if(options.refreshTreeId) {
var node = $(options.refreshTreeId).tree('getSelected');
var parentNode = $(options.refreshTreeId).tree('getParent', node.target);
$(options.refreshTreeId).tree('reload', parentNode.target);
//$(options.refreshTreeId).tree('reload', node.target);
}*/ } else {
$.messager.alert(msgJson);
}
} /**
* 显示提供信息
* @param data
*/
function showMessage(data) {
var messageJson = {};
var statusCode = "";
if (typeof(data) == "object") {
statusCode = data.statusCode;
if (data.icon == undefined) {
data.icon = topJUI.language.message.icon.info;
}
messageJson = {
showType: topJUI.language.message.showType.slide,
title: data.title,
msg: data.message,
icon: data.icon
};
} else {
statusCode = data;
if (data == ) {
messageJson = {
showType: topJUI.language.message.showType.slide,
title: topJUI.language.message.title.operationTips,
msg: topJUI.language.message.msg.success,
icon: topJUI.language.message.icon.info
};
} else {
messageJson = {
showType: topJUI.language.message.showType.slide,
title: topJUI.language.message.title.operationTips,
msg: topJUI.language.message.msg.failed,
icon: topJUI.language.message.icon.error
};
}
} if (statusCode == || statusCode == || statusCode == ) {
if (statusCode == || statusCode == ) {
//showMask();
//setTimeout(hideMask, 1000);
messageJson.timeout = ;
$.messager.show(messageJson); //状态码为1和200时,屏幕中上部弹出操作成功提示框
} else {
$.messager.alert(messageJson); //状态码为100时,屏幕中央弹出操作成功提示框
}
} else {
$.messager.alert(messageJson); //状态码为300时,屏幕中央弹出操作失败提示框
}
} /**
* 替换url中的{}占位符值
* @param url
* @param dataObj
* @param prefix
* @returns {*}
*/
function replaceUrlParamValueByBrace(url, dataObj, prefix) {
var newUrl = url;
if (url && url.indexOf("{") >= ) { // 如果是多维对象,则取第一条记录,用于替换选中的单选记录值
var newDataObj = isMultiObj(dataObj) ? dataObj[] : dataObj; // var regExp = /{([\s\S]*?)}/g;
var newPrefix = isNull(prefix) ? "" : prefix + ".";
var regExp = new RegExp("{" + newPrefix + "(.*?)}", "g");
var paramArr = url.match(regExp);
if (paramArr.length > ) {
for (var i = ; i < paramArr.length; i++) {
var field = paramArr[i].replace("{" + newPrefix, "").replace("}", "");
if (prefix == "multiple") {
newUrl = newUrl.replace(paramArr[i], getMultiRowsFieldValue(dataObj, field));
} else {
newUrl = newUrl.replace(paramArr[i], newDataObj[field]);
}
}
}
}
return newUrl;
} function convertParamValue2Object(url, dataObj, prefix) {
var newUrl = url;
if (url && url.indexOf("{") >= ) {
var obj = {};
// 如果是多维对象,则取第一条记录,用于替换选中的单选记录值
var newDataObj = isMultiObj(dataObj) ? dataObj[] : dataObj; // var regExp = /{([\s\S]*?)}/g;
var newPrefix = isNull(prefix) ? "" : prefix + ".";
var regExp = new RegExp("{" + newPrefix + "(.*?)}", "g");
var paramArr = url.match(regExp);
if (paramArr.length > ) {
for (var i = ; i < paramArr.length; i++) {
var field = paramArr[i].replace("{" + newPrefix, "").replace("}", "");
if (prefix == "multiple") {
obj[field] = newUrl.replace(paramArr[i], getMultiRowsFieldValue(dataObj, field));
} else {
obj[field] = newUrl.replace(paramArr[i], newDataObj[field]);
}
}
}
}
return obj;
} /**
* 根据传递过来的paramObj,替换其中对应的值
* @param paramObj
* @param dataObj
* @returns {{}} 返回带实际值的对象数据
*/
function convertParamObj2ObjData(paramObj, dataObj) {
var obj = {};
var param, field;
for (param in paramObj) {
field = paramObj[param];
if (isMultiObj(dataObj)) {
obj[param] = getMultiRowsFieldValue(dataObj, field);
} else {
obj[param] = "'" + dataObj[field] + "'";
}
}
return obj;
} /**
* 根据选中的多行记录,获得多行记录的以逗号分隔的某个字段值组合
* @param rowsData
* @param field
* @returns {string}
*/
function getMultiRowsFieldValue(rowsData, field) {
var fieldArr = [];
for (var i = ; i < rowsData.length; i++) {
fieldArr.push("'" + rowsData[i][field] + "'");
}
return fieldArr.join(',');
} /**
* 将表单数据序列化为json数据
* $("#form").serializeObject();
* @returns {{}}
*/
$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function () {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
topjui.common.js的更多相关文章
- angularjs 1 开发简单案例(包含common.js,service.js,controller.js,page)
common.js var app = angular.module('app', ['ngFileUpload']) .factory('SV_Common', function ($http) { ...
- 封装自己的Common.js工具库
Code/** * Created by LT on 2013/6/16. * Common.js * 对原生JS对象的扩展 * Object.Array.String.Date.Ajax.Cooki ...
- vue.common.js?e881:433 TypeError: Cannot read property 'nodeName' of undefined
我觉得吧,是这么个原因,就是响应式要找这个node改它的内容,没找着,就报错了. 用computed监控vuex的state属性,绑定到页面上,如果这个属性改了,因为响应式,那么就要更改页面,如果页面 ...
- 常用js方法整理common.js
项目中常用js方法整理成了common.js var h = {}; h.get = function (url, data, ok, error) { $.ajax({ url: url, data ...
- 项目中常用js方法整理common.js
抽空把项目中常用js方法整理成了common.js,都是网上搜集而来的,大家一起分享吧. var h = {}; h.get = function (url, data, ok, error) { $ ...
- 模块化规范Common.js,AMD,CMD
随着网站规模的不断扩大,嵌入网页中的javascript代码越来越大,开发过程中存在大量问题,如:协同开发,代码复用,大量文件引入,命名冲突,文件依赖. 模块化编程称为迫切的需求. 所谓的模块,就是实 ...
- 如何调用common.js
第一步 页面需要引用此js 第二步 var loginJs = { //登录 goLogin: function () { var _userinfo = { name: "夏小沫" ...
- visual studio 2005提示脚本错误 /VC/VCWizards/2052/Common.js
今天在做OCX添加接口的时候,莫名其妙的遇到visual studio 2005提示脚本错误,/VC/VCWizards/2052/Common.js. 网上找了很多资料,多数介绍修改注册表“vs20 ...
- JQuery Easyui/TopJUI 用JS创建数据表格并实现增删改查功能
JQuery Easyui/TopJUI 用JS创建数据表格并实现增删改查功能 html <table id="productDg"></table> &l ...
随机推荐
- cookie和session 的初步介绍
Cookie和Session http协议不保存用户状态(信息) Cookie和Session都是为了能够保存用户信息 Cookie: 本质:保存在浏览器上的键值对 用途:标识当前用户信息 cooki ...
- 逆向思维——cf1241D
/* 给定一个序列a,每次可以把值为x的所有元素放到a的首部或尾部,问将a变为lis的最少操作步数 对原序列离散化后重新打标记, 可以反着来考虑这个问题:即固定连续的元素值为[l,r]的点不动,那么剩 ...
- Linux网卡驱动(4)—DM9000网卡驱动程序完全分析
1.硬件连接 mini2440开发板上DM9000的电气连接和mach-mini2440.c文件的关系 其中片选信号AEN使用了nGCS4,所以网卡的内存区域在BANK4,也就是从地址0x200000 ...
- sklearn中standardscaler中fit_transform()和transform()有什么区别,应该怎么使用?
在根据机器学习书中提供的实例中,看到需要对训练和测试的特征数据进行标准化. 但是使用的是有两个函数, 对于训练数据,使用的是fit_transform()函数 对于测试数据,使用的是tansform( ...
- RF中alert的处理
那么在robotframework中如何处理呢? 我在测试过程中遇到了这么一个窗口: 这种应该是属于Confirm 类型,是无法定位到的,在robotframework中需要这样处理: 1.虽然无法定 ...
- 使用并行ssh提高工作效率
我们经常需要ssh到多个主机上执行相同的命令,为了提高效率,我们通常会自己写个脚本,循环遍历执行我们的命令,比如: for host in `cat hosts.txt`;do ssh usernam ...
- Zabbix 历史数据存储到 Elasticsearch
Zabbix 历史数据存储到 Elasticsearch Zabbix 3.4.6 版本开始支持历史数据存储到 Elasticsearch, 早就想测试这个功能,最近有个需求需保存 zabbix 的历 ...
- HTML5自定义属性的设置与获取
<div id="box" aaa="bbb" data-info="hello"></div> <body& ...
- 解决Office 2010 每次打开word时出现配置进度框
来自百度经验 装好Office 2010后,每次打开都会出现配置进度框,很烦人,怎么办呢 确认你的10版Office已激活,激活状态如图(激活工具一般在你下载的安装包里都有) 直接在”开始“运行框里输 ...
- PAT_A1081#Rational Sum
Source: PAT A1081 Rational Sum (20 分) Description: Given N rational numbers in the form numerator/de ...