Skip to content

Commit 1f4e02d

Browse files
committed
修改Grid select模式
1 parent 27e9987 commit 1f4e02d

File tree

10 files changed

+120956
-74
lines changed

10 files changed

+120956
-74
lines changed

public/app.js

Lines changed: 41655 additions & 1 deletion
Large diffs are not rendered by default.

public/manifest.js

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,154 @@
1-
!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=window.webpackJsonp=window.webpackJsonp||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([]);
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // install a JSONP callback for chunk loading
3+
/******/ function webpackJsonpCallback(data) {
4+
/******/ var chunkIds = data[0];
5+
/******/ var moreModules = data[1];
6+
/******/ var executeModules = data[2];
7+
/******/
8+
/******/ // add "moreModules" to the modules object,
9+
/******/ // then flag all "chunkIds" as loaded and fire callback
10+
/******/ var moduleId, chunkId, i = 0, resolves = [];
11+
/******/ for(;i < chunkIds.length; i++) {
12+
/******/ chunkId = chunkIds[i];
13+
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
14+
/******/ resolves.push(installedChunks[chunkId][0]);
15+
/******/ }
16+
/******/ installedChunks[chunkId] = 0;
17+
/******/ }
18+
/******/ for(moduleId in moreModules) {
19+
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
20+
/******/ modules[moduleId] = moreModules[moduleId];
21+
/******/ }
22+
/******/ }
23+
/******/ if(parentJsonpFunction) parentJsonpFunction(data);
24+
/******/
25+
/******/ while(resolves.length) {
26+
/******/ resolves.shift()();
27+
/******/ }
28+
/******/
29+
/******/ // add entry modules from loaded chunk to deferred list
30+
/******/ deferredModules.push.apply(deferredModules, executeModules || []);
31+
/******/
32+
/******/ // run deferred modules when all chunks ready
33+
/******/ return checkDeferredModules();
34+
/******/ };
35+
/******/ function checkDeferredModules() {
36+
/******/ var result;
37+
/******/ for(var i = 0; i < deferredModules.length; i++) {
38+
/******/ var deferredModule = deferredModules[i];
39+
/******/ var fulfilled = true;
40+
/******/ for(var j = 1; j < deferredModule.length; j++) {
41+
/******/ var depId = deferredModule[j];
42+
/******/ if(installedChunks[depId] !== 0) fulfilled = false;
43+
/******/ }
44+
/******/ if(fulfilled) {
45+
/******/ deferredModules.splice(i--, 1);
46+
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
47+
/******/ }
48+
/******/ }
49+
/******/
50+
/******/ return result;
51+
/******/ }
52+
/******/
53+
/******/ // The module cache
54+
/******/ var installedModules = {};
55+
/******/
56+
/******/ // object to store loaded and loading chunks
57+
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
58+
/******/ // Promise = chunk loading, 0 = chunk loaded
59+
/******/ var installedChunks = {
60+
/******/ "/manifest": 0
61+
/******/ };
62+
/******/
63+
/******/ var deferredModules = [];
64+
/******/
65+
/******/ // The require function
66+
/******/ function __webpack_require__(moduleId) {
67+
/******/
68+
/******/ // Check if module is in cache
69+
/******/ if(installedModules[moduleId]) {
70+
/******/ return installedModules[moduleId].exports;
71+
/******/ }
72+
/******/ // Create a new module (and put it into the cache)
73+
/******/ var module = installedModules[moduleId] = {
74+
/******/ i: moduleId,
75+
/******/ l: false,
76+
/******/ exports: {}
77+
/******/ };
78+
/******/
79+
/******/ // Execute the module function
80+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
81+
/******/
82+
/******/ // Flag the module as loaded
83+
/******/ module.l = true;
84+
/******/
85+
/******/ // Return the exports of the module
86+
/******/ return module.exports;
87+
/******/ }
88+
/******/
89+
/******/
90+
/******/ // expose the modules object (__webpack_modules__)
91+
/******/ __webpack_require__.m = modules;
92+
/******/
93+
/******/ // expose the module cache
94+
/******/ __webpack_require__.c = installedModules;
95+
/******/
96+
/******/ // define getter function for harmony exports
97+
/******/ __webpack_require__.d = function(exports, name, getter) {
98+
/******/ if(!__webpack_require__.o(exports, name)) {
99+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
100+
/******/ }
101+
/******/ };
102+
/******/
103+
/******/ // define __esModule on exports
104+
/******/ __webpack_require__.r = function(exports) {
105+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
106+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
107+
/******/ }
108+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
109+
/******/ };
110+
/******/
111+
/******/ // create a fake namespace object
112+
/******/ // mode & 1: value is a module id, require it
113+
/******/ // mode & 2: merge all properties of value into the ns
114+
/******/ // mode & 4: return value when already ns object
115+
/******/ // mode & 8|1: behave like require
116+
/******/ __webpack_require__.t = function(value, mode) {
117+
/******/ if(mode & 1) value = __webpack_require__(value);
118+
/******/ if(mode & 8) return value;
119+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
120+
/******/ var ns = Object.create(null);
121+
/******/ __webpack_require__.r(ns);
122+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
123+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
124+
/******/ return ns;
125+
/******/ };
126+
/******/
127+
/******/ // getDefaultExport function for compatibility with non-harmony modules
128+
/******/ __webpack_require__.n = function(module) {
129+
/******/ var getter = module && module.__esModule ?
130+
/******/ function getDefault() { return module['default']; } :
131+
/******/ function getModuleExports() { return module; };
132+
/******/ __webpack_require__.d(getter, 'a', getter);
133+
/******/ return getter;
134+
/******/ };
135+
/******/
136+
/******/ // Object.prototype.hasOwnProperty.call
137+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
138+
/******/
139+
/******/ // __webpack_public_path__
140+
/******/ __webpack_require__.p = "/";
141+
/******/
142+
/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || [];
143+
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
144+
/******/ jsonpArray.push = webpackJsonpCallback;
145+
/******/ jsonpArray = jsonpArray.slice();
146+
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
147+
/******/ var parentJsonpFunction = oldJsonpFunction;
148+
/******/
149+
/******/
150+
/******/ // run deferred modules from other chunks
151+
/******/ checkDeferredModules();
152+
/******/ })
153+
/************************************************************************/
154+
/******/ ([]);

public/mix-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=be0e1de324934e54f7a3",
3-
"/manifest.js": "/manifest.js?id=3c768977c2574a34506e",
4-
"/vendor.js": "/vendor.js?id=38a9d2f43b98aaf4f7dd"
2+
"/app.js": "/app.js?id=eb52df88a1b6de5b89bb",
3+
"/manifest.js": "/manifest.js?id=d9708e48a6c10ccee4bb",
4+
"/vendor.js": "/vendor.js?id=736997e66e11f6db997a"
55
}

public/vendor.js

Lines changed: 79107 additions & 1 deletion
Large diffs are not rendered by default.

resources/js/components/grid/Table.vue

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@
8686
:body-style="{ padding: 0 }"
8787
v-loading="loading"
8888
>
89-
<el-tabs v-if="false">
90-
<el-tab-pane label="全部" name="first"></el-tab-pane>
91-
<el-tab-pane label="代付款" name="second"></el-tab-pane>
92-
<el-tab-pane label="代发货" name="third"></el-tab-pane>
93-
<el-tab-pane label="待收货" name="third2"></el-tab-pane>
94-
<el-tab-pane label="已完成" name="third3"></el-tab-pane>
95-
<el-tab-pane label="已关闭" name="third4"></el-tab-pane>
96-
</el-tabs>
9789
<div class="filter-form" v-if="attrs.filter.filters.length > 0">
9890
<el-form
9991
:inline="true"
@@ -139,16 +131,10 @@
139131
@sort-change="onTableSortChange"
140132
@selection-change="onTableselectionChange"
141133
>
134+
<el-table-column v-if='attrs.attributes.selection' align="center" type="selection"></el-table-column>
135+
142136
<template v-for="column in attrs.columnAttributes">
143137
<el-table-column
144-
v-if="column.type == 'selection'"
145-
:type="column.type"
146-
:width="column.width"
147-
:align="column.align"
148-
:key="column.prop"
149-
></el-table-column>
150-
<el-table-column
151-
v-else
152138
:type="column.type"
153139
:key="column.prop"
154140
:column-key="column.columnKey"
@@ -165,8 +151,8 @@
165151
<span>{{ scope.column.label }}</span>
166152
<el-tooltip
167153
placement="top"
168-
v-if="attrs.columnAttributes[scope.$index].help"
169-
:content="attrs.columnAttributes[scope.$index].help"
154+
v-if="column.help"
155+
:content="column.help"
170156
>
171157
<i class="el-icon-question hover"></i>
172158
</el-tooltip>
@@ -238,7 +224,9 @@ export default {
238224
page: 1,
239225
quickSearch: null,
240226
selectionRows: [],
241-
filterFormData: null
227+
filterFormData: null,
228+
tabsSelectdata: {},
229+
tabsActiveName: "all"
242230
};
243231
},
244232
@@ -285,6 +273,12 @@ export default {
285273
} catch (e) {}
286274
},
287275
methods: {
276+
onTabClick(e) {
277+
const name = this._.split(e.name, "----");
278+
this.tabsSelectdata[name[0]] = name[1];
279+
280+
this.getData();
281+
},
288282
//表单过滤提交
289283
onFilterSubmit() {
290284
this.getData();
@@ -305,7 +299,8 @@ export default {
305299
per_page: this.pageData.pageSize,
306300
...this.sort,
307301
...this.q_search,
308-
...this.filterFormData
302+
...this.filterFormData,
303+
...this.tabsSelectdata
309304
}
310305
})
311306
.then(

src/Grid.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace SmallRuralDog\Admin;
55

66

7-
use Closure;
87
use Illuminate\Database\Eloquent\Builder;
98
use Illuminate\Database\Eloquent\Model as Eloquent;
109
use Illuminate\Database\Eloquent\Relations;
@@ -41,7 +40,6 @@ class Grid extends Component implements \JsonSerializable
4140

4241

4342
protected $keyName = 'id';
44-
protected $selection = false;
4543
protected $tree = false;
4644
protected $dataUrl;
4745
protected $isGetData = false;
@@ -89,18 +87,6 @@ public function with(array $withs)
8987
return $this;
9088
}
9189

92-
/**
93-
* 设置是否多选
94-
* @param bool $selection
95-
* @return $this
96-
*/
97-
public function selection($selection = true)
98-
{
99-
$this->selection = $selection;
100-
101-
return $this;
102-
}
103-
10490
/**
10591
* 设置树形表格
10692
* @param bool $tree
@@ -173,13 +159,13 @@ protected function addRelationColumn($name, $label = '')
173159
*/
174160
public function columns($columns)
175161
{
176-
if ($this->selection) {
162+
/*if ($this->selection) {
177163
$column = $this->addColumn($this->model->getModel()->getKey());
178164
$column->type("selection");
179165
$column->align("center");
180166
$column->width(50);
181167
$columns = collect($columns)->prepend($column)->all();
182-
}
168+
}*/
183169
$this->columnAttributes = collect($columns)->map(function (Column $column) {
184170
return $column->getAttributes();
185171
})->toArray();
@@ -196,6 +182,7 @@ protected function applyQuery()
196182
$this->applyQuickSearch();
197183

198184
$this->applyFilter(false);
185+
199186
}
200187

201188
/**
@@ -262,7 +249,7 @@ public function jsonSerialize()
262249
'resource' => url(request()->getPathInfo())
263250
];
264251
$viewData['keyName'] = $this->keyName;
265-
$viewData['selection'] = $this->selection;
252+
$viewData['selection'] = $this->attributes->selection;
266253
$viewData['tree'] = $this->tree;
267254
$viewData['defaultSort'] = $this->defaultSort;
268255
$viewData['columnAttributes'] = $this->columnAttributes;

src/Grid/Concerns/HasGridAttributes.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,12 @@ public function draggable($url)
147147
$this->attributes->draggableUrl = $url;
148148
return $this;
149149
}
150+
151+
public function selection($selection = true)
152+
{
153+
$this->attributes->selection = $selection;
154+
return $this;
155+
}
156+
157+
150158
}

src/Grid/Filter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function conditions()
105105
$conditions[] = $filter->condition($params);
106106
}
107107

108+
108109
return tap(array_filter($conditions), function ($conditions) {
109110
if (!empty($conditions)) {
110111
$this->expand();

0 commit comments

Comments
 (0)