Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周远喜
mes-ui
Commits
ce54ed22
Commit
ce54ed22
authored
Aug 26, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datagrid
parent
a10adea4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
233 additions
and
228 deletions
+233
-228
dataGrid.vue
components/page/dataGrid.vue
+233
-228
No files found.
components/page/dataGrid.vue
View file @
ce54ed22
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
</Form>
</Form>
</slot>
</slot>
</div>
</div>
<div
class=
"searchBack"
>
<div
class=
"searchBack"
>
<slot
name=
"searchBack"
></slot>
<slot
name=
"searchBack"
></slot>
</div>
</div>
...
@@ -298,242 +299,246 @@ export default {
...
@@ -298,242 +299,246 @@ export default {
this
.
columnsCur
=
curColumns
;
this
.
columnsCur
=
curColumns
;
}
}
}
}
}
},
});
loadUserConfig
()
{
}
var
query
=
{
this
.
search
.
pageIndex
=
1
;
conditions
:
[{
this
.
search
.
conditions
=
where
;
fieldName
:
"creatorUserId"
,
this
.
load
();
fieldValue
:
this
.
userId
,
},
conditionalType
:
"Equal"
,
pageChange
(
page
)
{
},
this
.
search
.
page
=
page
;
{
this
.
search
.
pageIndex
=
page
;
fieldName
:
"component"
,
this
.
load
();
fieldValue
:
"Grid"
,
},
conditionalType
:
"Equal"
,
pageSizeChange
(
size
)
{
},
this
.
search
.
pageSize
=
size
;
{
this
.
search
.
pageIndex
=
1
;
fieldName
:
"page"
,
this
.
load
();
fieldValue
:
window
.
location
.
pathname
,
},
conditionalType
:
"Equal"
,
columnChange
(
item
,
i
)
{
},
item
.
hide
=
!
item
.
hide
;
],
this
.
$set
(
this
.
columnsCur
,
item
,
i
);
pageSize
:
1
,
this
.
saveUserconfig
();
};
},
this
.
$api
.
post
(
`
${
window
.
systemUrl
}
/config/list`
,
query
).
then
((
r
)
=>
{
selectionChange
(
items
)
{
if
(
r
.
success
)
{
this
.
$emit
(
"on-selection-change"
,
items
);
if
(
r
.
result
.
length
==
1
)
{
this
.
selectItems
=
items
;
this
.
userConfig
=
r
.
result
[
0
];
this
.
footerToolbar
=
items
.
length
>
0
;
this
.
columnInit
();
},
}
onSelect
(
rows
,
row
)
{
if
(
!
this
.
configLoad
)
{
this
.
$emit
(
"on-change"
,
rows
,
row
);
this
.
easySearch
();
},
}
allChange
(
items
)
{
this
.
configLoad
=
true
;
this
.
$emit
(
"all-change"
,
items
);
}
},
});
intY
()
{
},
if
(
this
.
$refs
.
table
!=
undefined
)
{
saveUserconfig
()
{
this
.
firstY
=
this
.
$refs
.
table
.
$el
.
getBoundingClientRect
().
top
;
let
url
=
`
${
window
.
systemUrl
}
/config/update`
;
}
var
content
=
[];
},
this
.
columnsCur
.
map
((
u
)
=>
{
selectAll
(
status
)
{
content
.
push
({
this
.
$refs
.
table
.
selectAll
(
status
);
key
:
u
.
key
,
},
hide
:
u
.
hide
,
//批量取消
});
cancelBatch
()
{
});
this
.
footerToolbar
=
false
;
if
(
!
this
.
userConfig
)
{
this
.
$refs
.
table
.
selectAll
(
false
);
url
=
`
${
window
.
systemUrl
}
/config/create`
;
var
data
=
{
page
:
window
.
location
.
pathname
,
component
:
"Grid"
,
key
:
this
.
$u
.
guid
(),
content
:
JSON
.
stringify
(
content
),
};
this
.
$api
.
post
(
url
,
data
).
then
((
r
)
=>
{
this
.
loadUserConfig
();
});
}
else
{
this
.
userConfig
.
content
=
JSON
.
stringify
(
content
);
this
.
$api
.
post
(
url
,
this
.
userConfig
);
}
},
//展开
expand
(
row
,
status
)
{
this
.
$emit
(
"on-expand"
,
row
,
status
);
},
//拖拽
onDragDrop
(
a
,
b
)
{
this
.
$emit
(
"on-drag-drop"
,
a
,
b
);
},
easySearch
()
{
if
(
this
.
conditions
&&
this
.
conditions
.
keys
&&
this
.
conditions
.
keys
.
default
)
{
//判断没有传入条件的用默认的查询
this
.
conditions
.
keys
.
value
=
this
.
keys
;
}
this
.
reload
(
this
.
conditions
);
},
undoConfig
()
{
//列设置恢复初始化
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
this
.
saveUserconfig
();
},
complexSearch
()
{
var
search
=
this
.
$refs
.
search
.
$children
.
filter
((
u
)
=>
{
return
u
.
condition
;
});
if
(
search
)
{
var
conditions
=
search
[
0
].
condition
;
this
.
reload
(
conditions
);
}
},
reload
(
conditions
)
{
var
where
=
[];
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
&&
Array
.
isArray
(
v
))
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
}
});
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
&&
Array
.
isArray
(
v
))
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
}
}
});
}
this
.
search
.
pageIndex
=
1
;
this
.
search
.
conditions
=
where
;
this
.
load
();
},
pageChange
(
page
)
{
this
.
search
.
page
=
page
;
this
.
search
.
pageIndex
=
page
;
this
.
load
();
},
pageSizeChange
(
size
)
{
this
.
search
.
pageSize
=
size
;
this
.
search
.
pageIndex
=
1
;
this
.
load
();
},
columnChange
(
item
,
i
)
{
item
.
hide
=
!
item
.
hide
;
this
.
$set
(
this
.
columnsCur
,
item
,
i
);
this
.
saveUserconfig
();
},
selectionChange
(
items
)
{
this
.
$emit
(
"on-selection-change"
,
items
);
this
.
selectItems
=
items
;
this
.
footerToolbar
=
items
.
length
>
0
;
},
onSelect
(
rows
,
row
)
{
this
.
$emit
(
"on-change"
,
rows
,
row
);
},
allChange
(
items
)
{
this
.
$emit
(
"all-change"
,
items
);
},
intY
()
{
if
(
this
.
$refs
.
table
!=
undefined
)
{
this
.
firstY
=
this
.
$refs
.
table
.
$el
.
getBoundingClientRect
().
top
;
}
},
selectAll
(
status
)
{
this
.
$refs
.
table
.
selectAll
(
status
);
},
//批量取消
cancelBatch
()
{
this
.
footerToolbar
=
false
;
this
.
$refs
.
table
.
selectAll
(
false
);
},
},
},
},
computed
:
{
computed
:
{
columnsNow
()
{
columnsNow
()
{
var
cols
=
this
.
columnsCur
.
filter
((
u
)
=>
{
var
cols
=
this
.
columnsCur
.
filter
((
u
)
=>
{
if
(
u
.
code
)
{
if
(
u
.
code
)
{
u
.
render
=
(
h
,
params
)
=>
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
let
values
=
u
.
key
;
let
type
=
"text"
;
let
type
=
"text"
;
if
(
u
.
category
)
{
if
(
u
.
category
)
{
type
=
u
.
category
;
type
=
u
.
category
;
}
}
},
return
h
(
"state"
,
{
//展开
props
:
{
expand
(
row
,
status
)
{
code
:
u
.
code
,
this
.
$emit
(
"on-expand"
,
row
,
status
);
type
:
type
,
},
value
:
params
.
row
[
values
]
+
""
,
//拖拽
onDragDrop
(
a
,
b
)
{
this
.
$emit
(
"on-drag-drop"
,
a
,
b
);
},
easySearch
()
{
if
(
this
.
conditions
&&
this
.
conditions
.
keys
&&
this
.
conditions
.
keys
.
default
)
{
//判断没有传入条件的用默认的查询
this
.
conditions
.
keys
.
value
=
this
.
keys
;
}
this
.
reload
(
this
.
conditions
);
},
undoConfig
()
{
//列设置恢复初始化
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
this
.
saveUserconfig
();
},
complexSearch
()
{
var
search
=
this
.
$refs
.
search
.
$children
.
filter
((
u
)
=>
{
return
u
.
condition
;
});
if
(
search
)
{
var
conditions
=
search
[
0
].
condition
;
this
.
reload
(
conditions
);
}
},
reload
(
conditions
)
{
var
where
=
[];
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
&&
Array
.
isArray
(
v
))
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
}
});
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
&&
Array
.
isArray
(
v
))
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
}
}
});
}
this
.
search
.
pageIndex
=
1
;
this
.
search
.
conditions
=
where
;
this
.
load
();
},
pageChange
(
page
)
{
this
.
search
.
page
=
page
;
this
.
search
.
pageIndex
=
page
;
this
.
load
();
},
pageSizeChange
(
size
)
{
this
.
search
.
pageSize
=
size
;
this
.
search
.
pageIndex
=
1
;
this
.
load
();
},
columnChange
(
item
,
i
)
{
item
.
hide
=
!
item
.
hide
;
this
.
$set
(
this
.
columnsCur
,
item
,
i
);
this
.
saveUserconfig
();
},
selectionChange
(
items
)
{
this
.
$emit
(
"on-selection-change"
,
items
);
this
.
selectItems
=
items
;
this
.
footerToolbar
=
items
.
length
>
0
;
},
onSelect
(
rows
,
row
)
{
this
.
$emit
(
"on-selection-change"
,
rows
,
row
);
},
intY
()
{
if
(
this
.
$refs
.
table
!=
undefined
)
{
this
.
firstY
=
this
.
$refs
.
table
.
$el
.
getBoundingClientRect
().
top
;
}
},
selectAll
(
status
)
{
this
.
$refs
.
table
.
selectAll
(
status
);
},
//批量取消
cancelBatch
()
{
this
.
footerToolbar
=
false
;
this
.
$refs
.
table
.
selectAll
(
false
);
},
},
computed
:
{
columnsNow
()
{
var
cols
=
this
.
columnsCur
.
filter
((
u
)
=>
{
if
(
u
.
code
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
let
type
=
"text"
;
if
(
u
.
category
)
{
type
=
u
.
category
;
}
return
h
(
"state"
,
{
props
:
{
code
:
u
.
code
,
type
:
type
,
value
:
params
.
row
[
values
]
+
""
,
},
});
};
}
if
(
u
.
type
==
"user"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
if
(
params
.
row
[
values
])
{
return
h
(
"User"
,
{
props
:
{
value
:
params
.
row
[
values
],
},
});
}
};
}
if
(
u
.
type
==
"workShopName"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
if
(
params
.
row
[
values
])
{
return
h
(
"WorkShopName"
,
{
props
:
{
value
:
params
.
row
[
values
],
},
});
}
};
}
if
(
u
.
type
==
"date"
||
u
.
type
==
"dateTime"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
return
h
(
"DTSpan"
,
{
props
:
{
type
:
u
.
type
,
value
:
params
.
row
[
values
],
},
});
};
}
return
!
u
.
hide
;
});
return
cols
;
},
},
},
watch
:
{
});
"data"
()
{
};
this
.
list
=
this
.
data
;
}
},
if
(
u
.
type
==
"user"
)
{
height
()
{
u
.
render
=
(
h
,
params
)
=>
{
this
.
tableHeight
=
this
.
height
;
let
values
=
u
.
key
;
if
(
params
.
row
[
values
])
{
return
h
(
"User"
,
{
props
:
{
value
:
params
.
row
[
values
],
},
},
"columns"
()
{
});
this
.
columns
.
forEach
((
u
)
=>
{
}
if
(
!
u
.
hide
)
{
};
u
.
hide
=
false
;
}
}
if
(
u
.
type
==
"workShopName"
)
{
});
u
.
render
=
(
h
,
params
)
=>
{
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
let
values
=
u
.
key
;
if
(
params
.
row
[
values
])
{
return
h
(
"WorkShopName"
,
{
props
:
{
value
:
params
.
row
[
values
],
},
},
});
}
};
}
if
(
u
.
type
==
"date"
||
u
.
type
==
"dateTime"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
return
h
(
"DTSpan"
,
{
props
:
{
type
:
u
.
type
,
value
:
params
.
row
[
values
],
},
},
});
};
};
}
return
!
u
.
hide
;
});
return
cols
;
},
},
watch
:
{
"data"
()
{
this
.
list
=
this
.
data
;
},
height
()
{
this
.
tableHeight
=
this
.
height
;
},
"columns"
()
{
this
.
columns
.
forEach
((
u
)
=>
{
if
(
!
u
.
hide
)
{
u
.
hide
=
false
;
}
});
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
},
},
};
</
script
>
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment