mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-11-02 10:28:21 +08:00
feat(table): 装载 reloadData shim 与 checkStatus 分发
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
<script src="__STATIC__/plugs/clipboard.js/clipboard.min.js?t={:get_site_version_key()}"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/admin-core.js?t={:get_site_version_key()}"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/admin-utils.js?t={:get_site_version_key()}"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/admin-table-store.js?t={:get_site_version_key()}"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/admin-table.js?t={:get_site_version_key()}"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/admin-api.js?t={:get_site_version_key()}"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/admin-listen.js?t={:get_site_version_key()}"></script>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
if (checkbox === 'true') {
|
||||
tableId = tableId || init.tableRenderId;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
var checkStatus = ua.table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
ua.msg.error('请勾选需要操作的数据');
|
||||
@@ -245,7 +245,7 @@
|
||||
var postData = {};
|
||||
if (checkbox === 'true') {
|
||||
tableId = tableId || init.tableRenderId;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
var checkStatus = ua.table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
ua.msg.error('请勾选需要操作的数据');
|
||||
@@ -286,7 +286,7 @@
|
||||
url = $(this).attr('data-url');
|
||||
tableId = tableId || init.tableRenderId;
|
||||
url = url !== undefined ? ua.url(url) : window.location.href;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
var checkStatus = ua.table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
ua.msg.error('请勾选需要删除的数据');
|
||||
|
||||
@@ -10,7 +10,36 @@
|
||||
var lastTableWhere = {};
|
||||
var selectMode, selectConfirmCallback;
|
||||
|
||||
// reloadData 引擎接线(加载期执行一次):受控表(UA_TABLE_STORE 已注册)的数据
|
||||
// 重载分流到 store,非受控表透传原引擎调用。原引用只备份一次,防止重复加载时
|
||||
// 把包装层当原引用再包一层;透传用 arguments 保真,reloadData(id, opts, type)
|
||||
// 三参形态的 type 语义不变。
|
||||
if (table.__uaOriginalReloadData === undefined) {
|
||||
table.__uaOriginalReloadData = table.reloadData;
|
||||
}
|
||||
var originalTableReloadData = table.__uaOriginalReloadData;
|
||||
table.reloadData = function (tableId, opts) {
|
||||
if (window.UA_TABLE_STORE.has(tableId)) {
|
||||
return window.UA_TABLE_STORE.reload(tableId, opts);
|
||||
}
|
||||
return originalTableReloadData.apply(this, arguments);
|
||||
};
|
||||
|
||||
ua.table = {
|
||||
// 受控/非受控分发入口(后续任务直呼改造的定义点):非受控路径走备份的
|
||||
// 原引擎引用,不经过上方已包装的 table.reloadData,避免递归
|
||||
reloadData: function (tableId, opts) {
|
||||
if (window.UA_TABLE_STORE.has(tableId)) {
|
||||
return window.UA_TABLE_STORE.reload(tableId, opts);
|
||||
}
|
||||
return originalTableReloadData.apply(this, arguments);
|
||||
},
|
||||
checkStatus: function (tableId) {
|
||||
if (window.UA_TABLE_STORE.has(tableId)) {
|
||||
return window.UA_TABLE_STORE.checkStatus(tableId);
|
||||
}
|
||||
return table.checkStatus(tableId);
|
||||
},
|
||||
render: function (options) {
|
||||
options.init = options.init || ua.init;
|
||||
options.modifyReload = ua.parame(options.modifyReload, true);
|
||||
@@ -1218,7 +1247,7 @@
|
||||
},
|
||||
listenTableSelectConfirm(options) {
|
||||
$('.select-confirm').click(function () {
|
||||
var checkStatus = table.checkStatus(options.id);
|
||||
var checkStatus = ua.table.checkStatus(options.id);
|
||||
|
||||
if (checkStatus.data.length == 0) {
|
||||
layer.msg('请选择数据');
|
||||
|
||||
Reference in New Issue
Block a user