Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
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
fukai
vue-gjjs
Commits
ae937b4f
Commit
ae937b4f
authored
Oct 31, 2023
by
yangxiaolei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
快照对比用户操作记录功能实现
parent
c06eb519
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
2 deletions
+112
-2
DatePicker.vue
src/components/DatePicker.vue
+38
-1
Input.vue
src/components/Input.vue
+37
-1
Select.vue
src/components/Select.vue
+37
-0
No files found.
src/components/DatePicker.vue
View file @
ae937b4f
<
template
>
<el-date-picker
:id=
"id"
:class=
"
{'highlight': highlight}" v-model="model" v-bind="attrs" v-on="$listeners" v-bind:disabled="isDisable" :value-format="valueFormat" :format="format">
</el-date-picker>
<el-date-picker
v-storeModify
:id=
"id"
:class=
"
{'highlight': highlight}" v-model="model" v-bind="attrs" v-on="$listeners" v-bind:disabled="isDisable" :value-format="valueFormat" :format="format">
</el-date-picker>
</
template
>
<
script
>
export
default
{
inject
:
[
"root"
],
directives
:{
storeModify
:{
bind
(
el
,
bind
,
vnode
){
let
target
=
el
.
querySelector
(
'.el-input__inner'
)
target
.
onfocus
=
(...
args
)
=>
{
let
_this
=
vnode
.
context
let
key
=
vnode
.
parent
.
data
.
model
.
expression
let
keyArray
=
key
.
split
(
'.'
)
let
curKey
=
keyArray
.
pop
()
let
resultKey
=
keyArray
.
join
(
"."
)
let
deepData
=
_this
.
getProperty
(
resultKey
,
_this
.
root
)
if
(
deepData
.
modify
){
if
(
Array
.
isArray
(
deepData
.
modify
)){
if
(
deepData
.
modify
.
includes
(
curKey
)){
return
}
deepData
.
modify
.
push
(
curKey
)
}
}
else
{
deepData
.
modify
=
[
curKey
]
}
}
}
}
},
props
:
{
value
:
{
default
:
''
...
...
@@ -53,6 +79,17 @@ export default {
}
return
this
.
$attrs
}
},
methods
:{
getProperty
(
str
,
value
)
{
let
keys
=
str
?.
split
(
'.'
)
for
(
let
key
of
keys
)
{
if
(
value
)
{
value
=
value
[
key
]
}
}
return
value
}
}
}
</
script
>
...
...
src/components/Input.vue
View file @
ae937b4f
<
template
>
<el-input
:id=
"id"
ref=
"form-item"
v-model=
"model"
v-bind=
"attrs"
v-on=
"$listeners"
v-bind:disabled=
"isDisable"
>
<el-input
v-storeModify
:id=
"id"
ref=
"form-item"
v-model=
"model"
v-bind=
"attrs"
v-on=
"$listeners"
v-bind:disabled=
"isDisable"
>
<template
v-slot:suffix
>
<slot
name=
"suffix"
></slot>
</
template
>
...
...
@@ -8,6 +8,7 @@
<
script
>
export
default
{
inject
:
[
"root"
],
props
:
{
value
:
{
type
:
[
String
,
Number
],
...
...
@@ -22,6 +23,30 @@ export default {
default
:
undefined
}
},
directives
:{
storeModify
:{
bind
(
el
,
bind
,
vnode
){
el
.
onchange
=
(...
args
)
=>
{
let
_this
=
vnode
.
context
let
key
=
vnode
.
parent
.
data
.
model
.
expression
let
keyArray
=
key
.
split
(
'.'
)
let
curKey
=
keyArray
.
pop
()
let
resultKey
=
keyArray
.
join
(
"."
)
let
deepData
=
_this
.
getProperty
(
resultKey
,
_this
.
root
)
if
(
deepData
.
modify
){
if
(
Array
.
isArray
(
deepData
.
modify
)){
if
(
deepData
.
modify
.
includes
(
curKey
)){
return
}
deepData
.
modify
.
push
(
curKey
)
}
}
else
{
deepData
.
modify
=
[
curKey
]
}
}
}
}
},
computed
:
{
model
:
{
get
()
{
...
...
@@ -53,6 +78,17 @@ export default {
}
return
this
.
$attrs
}
},
methods
:{
getProperty
(
str
,
value
)
{
let
keys
=
str
?.
split
(
'.'
)
for
(
let
key
of
keys
)
{
if
(
value
)
{
value
=
value
[
key
]
}
}
return
value
}
}
}
</
script
>
...
...
src/components/Select.vue
View file @
ae937b4f
<
template
>
<el-select
:id=
"id"
v-storeModify
v-model=
"model"
v-bind=
"$attrs"
v-on=
"$listeners"
...
...
@@ -34,6 +35,33 @@
import
{
getCodetable
}
from
"~/service/business/codeTable"
export
default
{
inject
:
[
"root"
],
directives
:{
storeModify
:{
bind
(
el
,
bind
,
vnode
){
let
target
=
el
.
querySelector
(
'.el-input'
)
// 绑定不上change事件,只能绑定上click、sroll,用户点击了下拉框就会记录改该操作
target
.
addEventListener
(
"click"
,()
=>
{
let
_this
=
vnode
.
context
let
key
=
vnode
.
parent
.
data
.
model
.
expression
let
keyArray
=
key
.
split
(
'.'
)
let
curKey
=
keyArray
.
pop
()
let
resultKey
=
keyArray
.
join
(
"."
)
let
deepData
=
_this
.
getProperty
(
resultKey
,
_this
.
root
)
if
(
deepData
.
modify
){
if
(
Array
.
isArray
(
deepData
.
modify
)){
if
(
deepData
.
modify
.
includes
(
curKey
)){
return
}
deepData
.
modify
.
push
(
curKey
)
}
}
else
{
deepData
.
modify
=
[
curKey
]
}
})
}
}
},
props
:
{
value
:
{
type
:
[
String
,
Array
,
Number
],
...
...
@@ -138,6 +166,15 @@ export default {
this
.
dbCodeList
=
rtnmsg
.
data
}
})
},
getProperty
(
str
,
value
)
{
let
keys
=
str
?.
split
(
'.'
)
for
(
let
key
of
keys
)
{
if
(
value
)
{
value
=
value
[
key
]
}
}
return
value
}
},
mounted
(){
...
...
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