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
bfa84478
Commit
bfa84478
authored
Apr 24, 2020
by
康振飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
左侧树
parent
5dac8ef0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
196 additions
and
1 deletion
+196
-1
technologyTree.vue
components/modalTree/technologyTree.vue
+193
-0
index.vue
pages/technology/index.vue
+3
-1
No files found.
components/modalTree/technologyTree.vue
0 → 100644
View file @
bfa84478
<
template
>
<div>
<h3
class=
"title"
>
<Input
search
placeholder=
"请输入查询条件"
clearable
v-model=
"treeInputSearch"
/>
<ButtonGroup
class=
"fr"
size=
"small"
>
<Button>
<Icon
:type=
"expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
size=
"16"
@
click=
"toggle"
title=
"展开/合并"
/>
</Button>
<Button>
<Icon
type=
"md-refresh"
size=
"16"
@
click=
"loadTree"
title=
"刷新"
/>
</Button>
</ButtonGroup>
</h3>
<div
class=
"tree"
:style=
"
{height:divHeight}">
<Tree
:data=
"searchList"
@
on-select-change=
"selectTreeNode"
/>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'technologyTree'
,
data
()
{
return
{
expand
:
false
,
treeData
:
[],
treeInputSearch
:
''
,
}
},
props
:
{
type
:
{
type
:
Number
,
default
:
0
}
},
computed
:{
searchList
()
{
let
nodeList
=
this
.
treeData
var
text
=
this
.
treeInputSearch
var
newNodeList
=
[]
function
searchTree
(
nodeLists
,
value
)
{
for
(
let
i
=
0
;
i
<
nodeLists
.
length
;
i
++
)
{
if
(
nodeLists
[
i
].
title
.
indexOf
(
value
)
!=
-
1
)
{
newNodeList
.
push
(
nodeLists
[
i
])
}
else
if
(
nodeLists
[
i
].
children
.
length
>
0
)
{
searchTree
(
nodeLists
[
i
].
children
,
value
)
}
}
}
if
(
text
!=
''
)
{
searchTree
(
nodeList
,
text
)
}
else
{
return
nodeList
}
return
newNodeList
}
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
divHeight
=
window
.
innerHeight
-
260
+
"px"
;
})();
};
},
created
()
{
this
.
loadTree
()
var
theight
=
window
.
innerHeight
-
260
+
'px'
this
.
divHeight
=
theight
},
methods
:
{
toggle
()
{
this
.
expand
=
!
this
.
expand
this
.
loadTree
()
},
async
loadTree
()
{
var
sumData
=
[]
this
.
$http
.
order
.
getallselecttree
().
then
((
res
)
=>
{
if
(
res
.
result
)
{
for
(
var
i
=
0
;
i
<
res
.
result
.
length
;
i
++
)
{
sumData
=
sumData
.
concat
(
res
.
result
[
i
])
}
this
.
treeData
=
sumData
}
else
{
this
.
$Message
.
error
(
'加载产品树失败!'
)
}
})
},
selectTreeNode
(
value
)
{
if
(
value
!=
null
&&
value
.
length
>
0
)
{
this
.
ProductSelected
=
value
}
if
(
value
.
length
>
0
)
{
this
.
ids
=
[]
this
.
getAllIds
(
value
)
if
(
this
.
ids
.
length
>
0
)
{
this
.
productid
=
this
.
ids
.
join
(
','
)
}
else
{
this
.
productid
=
'-1'
}
this
.
pageindex
=
1
this
.
loaddata
()
}
},
//重构左侧树
getTrees
(
trees
)
{
var
expand
=
this
.
expand
trees
.
forEach
((
data
,
index
)
=>
{
var
that
=
this
data
.
expand
=
expand
if
(
data
.
children
.
length
>
0
)
{
this
.
getTrees
(
data
.
children
)
}
})
return
trees
},
renderContent
(
h
,
{
root
,
node
,
data
})
{
return
h
(
'span'
,
{
style
:
{
color
:
data
.
isClick
?
'#000'
:
'#bbb'
,
//根据选中状态设置样式
cursor
:
data
.
isClick
?
'pointer'
:
''
,
background
:
node
.
node
.
selected
&&
data
.
isClick
?
'#AAD8D4'
:
'#ffffff'
,
paddingLeft
:
'10px'
,
paddingRight
:
'10px'
,
paddingTop
:
'3px'
,
paddingBottom
:
'3px'
},
on
:
{
// click: () => {
// if (!node.node.selected) {
// this.$refs.tree.handleSelect(node.nodeKey) //手动选择树节点
// }
// }
}
},
data
.
title
)
},
//得到此树节点下所有是产品的Id
getAllIds
(
trees
)
{
trees
.
forEach
((
data
,
index
)
=>
{
var
that
=
this
if
(
data
.
isClick
)
{
this
.
ids
.
push
(
data
.
id
)
}
if
(
data
.
children
.
length
>
0
)
{
this
.
getAllIds
(
data
.
children
)
}
})
},
change
(
value
)
{
if
(
value
.
length
>
0
)
{
if
(
value
[
0
].
isClick
)
{
this
.
ids
=
[]
this
.
getAllIds
(
value
)
if
(
this
.
ids
.
length
>
0
)
{
this
.
$emit
(
'storeIds'
,
this
.
ids
)
//this.easySearch.storeId.value = this.ids
}
else
{
this
.
$emit
(
'storeIds'
,
[
-
1
])
}
}
else
{
this
.
$Message
.
error
(
'当前操作用户无此库位的权限'
)
this
.
$emit
(
'storeIds'
,
[
-
1
])
}
}
},
change1
(
value
)
{
if
(
value
.
length
>
0
)
{
this
.
ids
=
[]
this
.
getAllIds
(
value
)
if
(
this
.
ids
.
length
>
0
)
{
this
.
$emit
(
'storeIds'
,
this
.
ids
)
}
else
{
this
.
$emit
(
'storeIds'
,
[
-
1
])
}
}
}
}
}
</
script
>
pages/technology/index.vue
View file @
bfa84478
...
...
@@ -11,6 +11,7 @@
<Icon
type=
"ios-arrow-back"
size=
"24"
/>
</a>
</h4>
<StoreHouseLeft
@
storeIds=
"storeIds"
:type=
"4"
></StoreHouseLeft>
</div>
</Sider>
<div
v-if=
"!showMenu"
class=
"show_menu"
>
...
...
@@ -27,8 +28,9 @@
</
template
>
<
script
>
import
StoreHouseLeft
from
"@/components/modalTree/storeHouseLeft.vue"
;
export
default
{
components
:
{},
components
:
{
StoreHouseLeft
},
data
()
{
return
{
showMenu
:
true
,
...
...
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