Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
horse
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
向伟
horse
Commits
0b6be647
Commit
0b6be647
authored
Nov 22, 2021
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
a27c4cc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
27 deletions
+39
-27
departmentStaff.vue
src/components/common/departmentStaff.vue
+35
-25
editRuleModule.ts
src/module/editor/editRuleModule.ts
+4
-2
No files found.
src/components/common/departmentStaff.vue
View file @
0b6be647
...
@@ -41,13 +41,14 @@
...
@@ -41,13 +41,14 @@
no-connectors
no-connectors
v-model:ticked=
"defaultArray"
v-model:ticked=
"defaultArray"
@
update:ticked=
"tickedTree"
@
update:ticked=
"tickedTree"
/>
/>
</div>
</div>
<div
class=
"col-6 q-px-sm"
>
<div
class=
"col-6 q-px-sm"
>
<div
class=
"list-title"
>
已选择的部门或成员
</div>
<div
class=
"list-title"
>
已选择的部门或成员
</div>
<div
class=
"q-pb-none col-12 list-box"
>
<div
class=
"q-pb-none col-12 list-box"
>
<div
<div
v-for=
"(item,index) in
defaul
tArray"
v-for=
"(item,index) in
selec
tArray"
:key=
"index"
:key=
"index"
class=
"list-item"
class=
"list-item"
>
>
...
@@ -55,14 +56,14 @@
...
@@ -55,14 +56,14 @@
<q-icon
<q-icon
name=
"work"
name=
"work"
color=
"primary"
color=
"primary"
v-if=
"item.slice(0, 1) == 1"
v-if=
"item.
Id.
slice(0, 1) == 1"
/>
/>
<q-icon
<q-icon
name=
"person"
name=
"person"
color=
"accent"
color=
"accent"
v-if=
"item.slice(0, 1) == 2"
v-if=
"item.
Id.
slice(0, 1) == 2"
/>
/>
<span
class=
"q-ml-sm"
>
{{ item.
split('-')[1]
}}
</span>
<span
class=
"q-ml-sm"
>
{{ item.
Name
}}
</span>
</div>
</div>
<q-icon
name=
"cancel"
@
click=
"delItem(index)"
></q-icon>
<q-icon
name=
"cancel"
@
click=
"delItem(index)"
></q-icon>
</div>
</div>
...
@@ -84,6 +85,10 @@ import { ref } from 'vue'
...
@@ -84,6 +85,10 @@ import { ref } from 'vue'
interface
parmas
{
interface
parmas
{
[
key
:
string
]:
any
[
key
:
string
]:
any
}
}
interface
SelectParams
{
Id
:
number
,
Name
:
string
}
export
default
{
export
default
{
props
:
{
props
:
{
modelValue
:
{
modelValue
:
{
...
@@ -136,43 +141,48 @@ export default {
...
@@ -136,43 +141,48 @@ export default {
setup
(
props
,
ctx
)
{
setup
(
props
,
ctx
)
{
let
tree
=
ref
<
any
>
(
null
);
let
tree
=
ref
<
any
>
(
null
);
let
list
=
ref
<
Array
<
string
>>
([])
let
list
=
ref
<
Array
<
string
>>
([])
let
selectArray
=
ref
<
Array
<
SelectParams
>>
([])
let
hideDialog
=
()
=>
{
let
hideDialog
=
()
=>
{
ctx
.
emit
(
"update:modelValue"
,
false
)
ctx
.
emit
(
"update:modelValue"
,
false
)
}
}
let
findChild
=
(
arr
:
parmas
)
=>
{
arr
.
map
((
e
)
=>
{
const
getselectArray
=
(
arr
:
parmas
)
=>
{
if
(
e
[
props
.
childrenKey
]
&&
e
[
props
.
childrenKey
].
length
>
0
)
{
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
){
let
parentId
=
e
[
props
.
nodeKey
]
let
j
=
arr
[
i
]
let
flag
=
tree
.
value
.
isTicked
(
parentId
)
let
flag
=
tree
.
value
.
isTicked
(
j
.
newId
)
if
(
flag
==
true
){
// let childArr = e[props.childrenKey].map(_e => _e[props.nodeKey])
selectArray
.
value
.
push
({
Id
:
j
.
newId
,
Name
:
j
.
DeptName
})
// let flag2 = childArr.every(_e => {
}
else
{
// return props.defaultArray.toString().indexOf(_e) != -1
if
(
j
.
ChildList
&&
j
.
ChildList
.
length
>
0
){
// })
getselectArray
(
j
.
ChildList
)
}
console
.
log
(
147
,
parentId
,
flag
)
}
}
findChild
(
e
[
props
.
childrenKey
])
}
})
}
}
let
tickedTree
=
(
val
)
=>
{
let
tickedTree
=
(
val
)
=>
{
ctx
.
emit
(
"update:defaultArray"
,
val
)
ctx
.
emit
(
"update:defaultArray"
,
val
)
console
.
log
(
'defaultArray'
,
val
)
setTimeout
(()
=>
{
findChild
(
props
.
treeData
)
selectArray
.
value
=
[]
getselectArray
(
props
.
treeData
)
console
.
log
(
selectArray
.
value
,
'selectArray'
)
},
100
)
}
}
let
delItem
=
(
i
:
number
)
=>
{
let
delItem
=
(
i
:
number
)
=>
{
props
.
defaultArray
.
splice
(
i
,
1
)
props
.
defaultArray
.
splice
(
i
,
1
)
}
}
return
{
return
{
tree
,
tree
,
hideDialog
,
hideDialog
,
tickedTree
,
tickedTree
,
delItem
,
delItem
,
list
list
,
getselectArray
,
selectArray
}
}
}
}
}
}
...
...
src/module/editor/editRuleModule.ts
View file @
0b6be647
...
@@ -67,7 +67,8 @@ const editRuleModule = () => {
...
@@ -67,7 +67,8 @@ const editRuleModule = () => {
// 重组唯一id
// 重组唯一id
if
(
data
.
dataTree
.
length
==
0
)
return
if
(
data
.
dataTree
.
length
==
0
)
return
data
.
dataTree
.
forEach
(
x
=>
{
data
.
dataTree
.
forEach
(
x
=>
{
x
.
newId
=
x
.
DataType
+
'-'
+
x
.
DeptName
+
'-'
+
x
.
DeptId
// x.newId = x.DataType + '-' +x. DeptName + '-' + x.DeptId
x
.
newId
=
x
.
DataType
+
'-'
+
x
.
DeptId
if
(
x
.
ChildList
&&
x
.
ChildList
.
length
>
0
)
{
if
(
x
.
ChildList
&&
x
.
ChildList
.
length
>
0
)
{
getChildList
(
x
.
ChildList
)
getChildList
(
x
.
ChildList
)
}
}
...
@@ -76,7 +77,8 @@ const editRuleModule = () => {
...
@@ -76,7 +77,8 @@ const editRuleModule = () => {
}
}
const
getChildList
=
(
ChildList
:
Array
<
any
>
)
=>
{
const
getChildList
=
(
ChildList
:
Array
<
any
>
)
=>
{
ChildList
.
forEach
(
x
=>
{
ChildList
.
forEach
(
x
=>
{
x
.
newId
=
x
.
DataType
+
'-'
+
x
.
DeptName
+
'-'
+
x
.
DeptId
// x.newId = x.DataType + '-' + x.DeptName + '-' + x.DeptId
x
.
newId
=
x
.
DataType
+
'-'
+
x
.
DeptId
if
(
x
.
ChildList
&&
x
.
ChildList
.
length
>
0
)
{
if
(
x
.
ChildList
&&
x
.
ChildList
.
length
>
0
)
{
getChildList
(
x
.
ChildList
)
getChildList
(
x
.
ChildList
)
}
}
...
...
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