调整商城案例代码;表格由reload改为reloadData

This commit is contained in:
2022-08-24 15:53:57 +08:00
parent 930d0f77bf
commit 377cc49d0b
2 changed files with 39 additions and 14 deletions

View File

@@ -93,4 +93,29 @@ class Goods extends AdminController
return $this->fetch(); return $this->fetch();
} }
/**
* @NodeAnotation(title="导出")
*/
public function export()
{
list($page, $limit, $where) = $this->buildTableParames();
$this->model = $this->model
->withJoin('cate', 'LEFT');
$fields = $this->request->param('fields', '{}', null);
$image_fields = $this->request->param('image_fields', '{}', null);
$select_fields = $this->request->param('select_fields', '{}', null);
$date_fields = $this->request->param('date_fields', '{}', null);
$fields = json_decode($fields, true);
$image_fields = json_decode($image_fields, true);
$select_fields = json_decode($select_fields, true);
$date_fields = json_decode($date_fields, true);
$content = \app\common\tools\ExportTools::excel($this->model, $where, $fields, $image_fields, $select_fields, $date_fields);
return download($content, $this->model->getName() . date('YmdHis') . '.xlsx', true);
}
} }

View File

@@ -1180,7 +1180,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
op: JSON.stringify(formatOp) op: JSON.stringify(formatOp)
} }
lastTableWhere[tableId] = where lastTableWhere[tableId] = where
table.reload(tableId, { table.reloadData(tableId, {
page: { page: {
curr: 1 curr: 1
} }
@@ -1214,14 +1214,14 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
data: data, data: data,
}, function (res) { }, function (res) {
if (option.modifyReload) { if (option.modifyReload) {
table.reload(option.tableId); table.reloadData(option.tableId);
} }
}, function (res) { }, function (res) {
admin.msg.error(res.msg, function () { admin.msg.error(res.msg, function () {
table.reload(option.tableId); table.reloadData(option.tableId);
}); });
}, function () { }, function () {
table.reload(option.tableId); table.reloadData(option.tableId);
}); });
} }
}); });
@@ -1235,7 +1235,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
lastWhere.sort = {} lastWhere.sort = {}
lastWhere.sort[obj.field] = obj.type; lastWhere.sort[obj.field] = obj.type;
table.reload(option.id, { table.reloadData(option.id, {
initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。 initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。
, where: lastWhere , where: lastWhere
}); });
@@ -1280,14 +1280,14 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
data: _data, data: _data,
}, function (res) { }, function (res) {
if (modifyReload) { if (modifyReload) {
table.reload(tableId); table.reloadData(tableId);
} }
}, function (res) { }, function (res) {
admin.msg.error(res.msg, function () { admin.msg.error(res.msg, function () {
table.reload(tableId); table.reloadData(tableId);
}); });
}, function () { }, function () {
table.reload(tableId); table.reloadData(tableId);
}); });
}); });
} }
@@ -1619,7 +1619,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
if (tableId === undefined || tableId === '' || tableId == null) { if (tableId === undefined || tableId === '' || tableId == null) {
tableId = init.table_render_id; tableId = init.table_render_id;
} }
table.reload(tableId); table.reloadData(tableId);
}); });
// 监听搜索表格重置 // 监听搜索表格重置
@@ -1632,7 +1632,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
filter: '{}', filter: '{}',
op: '{}' op: '{}'
}; };
table.reload(tableId, { table.reloadData(tableId, {
page: { page: {
curr: 1 curr: 1
} }
@@ -1684,7 +1684,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
data: postData, data: postData,
}, function (res) { }, function (res) {
admin.msg.success(res.msg, function () { admin.msg.success(res.msg, function () {
table.reload(tableId); table.reloadData(tableId);
}); });
}) })
}); });
@@ -1717,7 +1717,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
}, },
}, function (res) { }, function (res) {
admin.msg.success(res.msg, function () { admin.msg.success(res.msg, function () {
table.reload(tableId); table.reloadData(tableId);
}); });
}); });
}); });
@@ -1760,7 +1760,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index); parent.layer.close(index);
if (option.refreshTable !== false) { if (option.refreshTable !== false) {
parent.layui.table.reload(option.refreshTable); parent.layui.table.reloadData(option.refreshTable);
} }
if (option.refreshFrame) { if (option.refreshFrame) {
parent.location.reload(); parent.location.reload();
@@ -1773,7 +1773,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
}, },
refreshTable: function (tableName) { refreshTable: function (tableName) {
tableName = tableName || 'currentTableRenderId'; tableName = tableName || 'currentTableRenderId';
table.reload(tableName); table.reloadData(tableName);
}, },
formRequired: function () { formRequired: function () {
var verifyList = document.querySelectorAll("[lay-verify]"); var verifyList = document.querySelectorAll("[lay-verify]");