增加 LayTable done 参数

This commit is contained in:
Anyon 2022-04-15 11:52:46 +08:00
parent 1d1484b01b
commit 8a96cb971c
3 changed files with 139 additions and 32 deletions

View File

@ -703,6 +703,7 @@ $(function () {
} }
// 动态计算最大页数 // 动态计算最大页数
option.done = function () { option.done = function () {
typeof params.done === 'function' && params.done.call(this);
layui.sessionData('pages', {key: table.id, value: this.page.curr || 1}); layui.sessionData('pages', {key: table.id, value: this.page.curr || 1});
$.form.reInit($table.next()).find('[data-load],[data-queue],[data-action],[data-iframe]').not('[data-table-id]').attr('data-table-id', table.id); $.form.reInit($table.next()).find('[data-load],[data-queue],[data-action],[data-iframe]').not('[data-table-id]').attr('data-table-id', table.id);
(option.loading = this.loading = true) && $table.data('next', this).next().find(cls.join(',')).animate({opacity: 1}); (option.loading = this.loading = true) && $table.data('next', this).next().find(cls.join(',')).animate({opacity: 1});

View File

@ -1,30 +1,83 @@
/* PCAS (Province City Area Selector 省、市、地区联动选择JS封装类) Ver 2.02 完整版 *\ /********************************************************
*** 加载脚本文件 ***
<script src="pcasunzip.js"></script>
制作时间:2005-12-30 *** 省市联动 ***
更新时间:2006-01-24
数据修正:2012-01-17截止2011年10月31日
演示地址:http://www.popub.net/script/pcasunzip.html
下载地址:http://www.popub.net/script/pcasunzip.js
应用说明:页面包含<script type="text/javascript" src="pcasunzip.js" charset="gb2312"></script>
省市联动
new PCAS("Province","City") new PCAS("Province","City")
new PCAS("Province","City","吉林省") new PCAS("Province","City","吉林省")
new PCAS("Province","City","吉林省","吉林市") new PCAS("Province","City","吉林省","吉林市")
省市地区联动
*** 省市区联动 ***
new PCAS("Province","City","Area") new PCAS("Province","City","Area")
new PCAS("Province","City","Area","吉林省") new PCAS("Province","City","Area","吉林省")
new PCAS("Province","City","Area","吉林省","松原市") new PCAS("Province","City","Area","吉林省","松原市")
new PCAS("Province","City","Area","吉林省","松原市","宁江区") new PCAS("Province","City","Area","吉林省","松原市","宁江区")
省、市、地区对象取得的值均为实际值。 省、市、地区对象取得的值均为实际值。
注:省、市、地区提示信息选项的值为""(空字符串) 注:省、市、地区提示信息选项的值为""(空字符串)
*********************************************************/
\*** 程序制作/版权所有:崔永祥(333) E-Mail:zhadan007@21cn.com 网址:http://www.popub.net ***/
SPT = window.SPT || "-省份-"; SPT = window.SPT || "-省份-";
SCT = window.SCT || "-城市-"; SCT = window.SCT || "-城市-";
SAT = window.SAT || "-地区-"; SAT = window.SAT || "-地区-";
ShowT = window.ShowT || 0; /* 提示文字 0:不显示 1:显示 */ SWT = window.SWT || 0; // 提示文字 0:不显示 1:显示
PCAD = "__STRING__";
if (ShowT)PCAD = SPT + "$" + SCT + "," + SAT + "#" + PCAD; PCAArea = []; PCAP = []; PCAC = []; PCAA = []; PCAN = PCAD.split("#"); for (i = 0; i < PCAN.length; i++){PCAA[i] = []; TArea = PCAN[i].split("$")[1].split("|"); for (j = 0; j < TArea.length; j++){PCAA[i][j] = TArea[j].split(","); if (PCAA[i][j].length == 1)PCAA[i][j][1] = SAT; TArea[j] = TArea[j].split(",")[0]}PCAArea[i] = PCAN[i].split("$")[0] + "," + TArea.join(","); PCAP[i] = PCAArea[i].split(",")[0]; PCAC[i] = PCAArea[i].split(',')}function PCAS(){this.SelP = document.getElementsByName(arguments[0])[0]; this.SelC = document.getElementsByName(arguments[1])[0]; this.SelA = document.getElementsByName(arguments[2])[0]; this.DefP = this.SelA?arguments[3]:arguments[2]; this.DefC = this.SelA?arguments[4]:arguments[3]; this.DefA = this.SelA?arguments[5]:arguments[4]; this.SelP.PCA = this; this.SelC.PCA = this; this.SelP.onchange = function(){PCAS.SetC(this.PCA)}; if (this.SelA)this.SelC.onchange = function(){PCAS.SetA(this.PCA)}; PCAS.SetP(this)}; PCAS.SetP = function(PCA){for (i = 0; i < PCAP.length; i++){PCAPT = PCAPV = PCAP[i]; if (PCAPT == SPT)PCAPV = ""; PCA.SelP.options.add(new Option(PCAPT, PCAPV)); if (PCA.DefP == PCAPV)PCA.SelP[i].selected = true}PCAS.SetC(PCA)}; PCAS.SetC = function(PCA){PI = PCA.SelP.selectedIndex; PCA.SelC.length = 0; for (i = 1; i < PCAC[PI].length; i++){PCACT = PCACV = PCAC[PI][i]; if (PCACT == SCT)PCACV = ""; PCA.SelC.options.add(new Option(PCACT, PCACV)); if (PCA.DefC == PCACV)PCA.SelC[i - 1].selected = true}if (PCA.SelA)PCAS.SetA(PCA)}; PCAS.SetA = function(PCA){PI = PCA.SelP.selectedIndex; CI = PCA.SelC.selectedIndex; PCA.SelA.length = 0; for (i = 1; i < PCAA[PI][CI].length; i++){PCAAT = PCAAV = PCAA[PI][CI][i]; if (PCAAT == SAT)PCAAV = ""; PCA.SelA.options.add(new Option(PCAAT, PCAAV)); if (PCA.DefA == PCAAV)PCA.SelA[i - 1].selected = true} try{$(PCA.SelA).trigger('change')} catch (e){}} function PCAS() {
this.SelP = document.getElementsByName(arguments[0])[0];
this.SelC = document.getElementsByName(arguments[1])[0];
this.SelA = document.getElementsByName(arguments[2])[0];
this.DefP = this.SelA ? arguments[3] : arguments[2];
this.DefC = this.SelA ? arguments[4] : arguments[3];
this.DefA = this.SelA ? arguments[5] : arguments[4];
if (this.SelP) this.SelP.PCA = this;
if (this.SelC) this.SelC.PCA = this;
if (this.SelA) this.SelA.PCA = this;
if (this.SelP && this.SelC) {
this.SelP.onchange = function () {
PCAS.SetC(this.PCA)
};
if (this.SelA) this.SelC.onchange = function () {
PCAS.SetA(this.PCA)
};
}
PCAS.init(this).SetP(this)
}
PCAS.init = function (PCA) {
PCA.PCAP = [], PCA.PCAC = [], PCA.PCAA = [], PCA.PCAD = "__STRING__";
if (SWT) PCA.PCAD = SPT + "$" + SCT + "," + SAT + "#" + PCA.PCAD;
PCA.PCAD.split("#").forEach(function (VAL1, ID1) {
PCA.PCAP[ID1] = VAL1.split("$")[0], PCA.PCAC[ID1] = [], PCA.PCAA[ID1] = [];
VAL1.split("$")[1].split("|").forEach(function (VAL2, ID2) {
PCA.PCAC[ID1].push((PCA.PCAR = VAL2.split(",")).shift()), PCA.PCAA[ID1][ID2] = PCA.PCAR;
if (PCA.PCAA[ID1][ID2].length === 1) PCA.PCAA[ID1][ID2][1] = SAT;
});
});
return this;
};
PCAS.SetP = function (PCA) {
PCA.PCAP.forEach(function (VAL, IDX) {
PCA.PCAT = PCA.PCAV = VAL;
if (PCA.PCAT === SPT) PCA.PCAV = "";
PCA.SelP.options.add(new Option(PCA.PCAT, PCA.PCAV));
if (PCA.DefP === PCA.PCAV) PCA.SelP[IDX].selected = true
}), PCA.SelC ? PCAS.SetC(PCA) : $(PCA.SelP).trigger('change');
};
PCAS.SetC = function (PCA) {
PCA.SelC.length = 0;
PCA.PCAC[PCA.SelP.selectedIndex].forEach(function (VAL, IDX) {
PCA.PCAT = PCA.PCAV = VAL;
if (PCA.PCAT === SCT) PCA.PCAV = "";
PCA.SelC.options.add(new Option(PCA.PCAT, PCA.PCAV));
if (PCA.DefC === PCA.PCAV) PCA.SelC[IDX].selected = true
}), PCA.SelA ? PCAS.SetA(PCA) : $(PCA.SelC).trigger('change');
};
PCAS.SetA = function (PCA) {
PCA.SelA.length = 0;
PCA.PCAA[PCA.SelP.selectedIndex][PCA.SelC.selectedIndex].forEach(function (VAL, IDX) {
PCA.PCAT = PCA.PCAV = VAL;
if (PCA.PCAT === SAT) PCA.PCAV = "";
PCA.SelA.options.add(new Option(PCA.PCAT, PCA.PCAV));
if (PCA.DefA === PCA.PCAV) PCA.SelA[IDX].selected = true
}), $(PCA.SelA).trigger('change')
};

File diff suppressed because one or more lines are too long