Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzou
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzou
提交
d36c2d26
提交
d36c2d26
编写于
5月 23, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lab_qyk 发布系统代码
上级
708b7013
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
98 行增加
和
29 行删除
+98
-29
app-department-select.vue
...omponents/app-department-select/app-department-select.vue
+74
-28
getters.ts
app_web/src/store/getters.ts
+10
-0
mutations.ts
app_web/src/store/mutations.ts
+13
-1
state.ts
app_web/src/store/state.ts
+1
-0
未找到文件。
app_web/src/components/app-department-select/app-department-select.vue
浏览文件 @
d36c2d26
<
template
>
<
template
>
<div
class=
"app-department-select"
>
<div
class=
"app-department-select"
>
<ibiz-select-tree
:NodesData=
"Nodesdata"
:value=
"v
alue"
:multiple=
"multiple"
@
select=
"onSelect"
></ibiz-select-tree>
<ibiz-select-tree
:NodesData=
"Nodesdata"
v-model=
"selectTreeV
alue"
:multiple=
"multiple"
@
select=
"onSelect"
></ibiz-select-tree>
</div>
</div>
</
template
>
</
template
>
...
@@ -43,14 +43,6 @@ export default class AppDepartmentSelect extends Vue {
...
@@ -43,14 +43,6 @@ export default class AppDepartmentSelect extends Vue {
*/
*/
@
Prop
({
default
:
false
})
public
multiple
?:
any
;
@
Prop
({
default
:
false
})
public
multiple
?:
any
;
/**
* 表单项名称
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@
Prop
()
public
name
!
:
any
;
/**
/**
* 表单数据
* 表单数据
*
*
...
@@ -60,20 +52,20 @@ export default class AppDepartmentSelect extends Vue {
...
@@ -60,20 +52,20 @@ export default class AppDepartmentSelect extends Vue {
@
Prop
()
public
data
!
:
any
;
@
Prop
()
public
data
!
:
any
;
/**
/**
*
表单项值
*
上下文变量
*
*
* @type {*}
* @type {*}
* @memberof AppDepartmentSelect
* @memberof AppDepartmentSelect
*/
*/
@
Prop
()
public
value
!
:
any
;
@
Prop
()
public
context
!
:
any
;
/**
/**
*
上下文变量
*
选中数值
*
*
* @type {*}
* @type {*}
* @memberof AppDepartmentSelect
* @memberof AppDepartmentSelect
*/
*/
@
Prop
()
public
context
!
:
any
;
public
selectTreeValue
:
any
=
""
;
/**
/**
* 树节点数据
* 树节点数据
...
@@ -96,26 +88,41 @@ export default class AppDepartmentSelect extends Vue {
...
@@ -96,26 +88,41 @@ export default class AppDepartmentSelect extends Vue {
*
*
* @memberof AppDepartmentSelect
* @memberof AppDepartmentSelect
*/
*/
public
searchNodesData
(){
public
handleFilter
(){
// 处理请求参数
let
param
=
''
if
(
this
.
filter
){
if
(
this
.
filter
){
if
(
this
.
data
&&
this
.
data
[
this
.
filter
]){
if
(
this
.
data
&&
this
.
data
[
this
.
filter
]){
param
=
this
.
data
[
this
.
filter
];
return
this
.
data
[
this
.
filter
];
}
else
if
(
this
.
context
&&
this
.
context
[
this
.
filter
]){
}
else
if
(
this
.
context
&&
this
.
context
[
this
.
filter
]){
param
=
this
.
context
[
this
.
filter
];
return
this
.
context
[
this
.
filter
];
}
}
}
else
{
}
else
{
param
=
this
.
context
.
srforgid
;
return
this
.
context
.
srforgid
;
}
}
}
/**
* 获取节点数据
*
* @memberof AppDepartmentSelect
*/
public
searchNodesData
(){
// 处理过滤参数,生成url
let
param
=
this
.
handleFilter
();
let
_url
=
this
.
url
.
replace
(
/{orgid}/
,
param
)
let
_url
=
this
.
url
.
replace
(
/{orgid}/
,
param
)
if
(
this
.
oldurl
===
_url
){
if
(
this
.
oldurl
===
_url
){
return
;
return
;
}
}
this
.
oldurl
=
_url
;
// 缓存机制
const
result
:
any
=
this
.
$store
.
getters
.
getCopyData
(
_url
);
if
(
result
){
this
.
Nodesdata
=
result
;
return
;
}
this
.
$http
.
get
(
_url
).
then
((
response
:
any
)
=>
{
this
.
$http
.
get
(
_url
).
then
((
response
:
any
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
this
.
Nodesdata
=
response
.
data
;
this
.
Nodesdata
=
response
.
data
;
this
.
oldurl
=
_url
;
this
.
$store
.
commit
(
'addDepData'
,
{
srfkey
:
this
.
filter
,
orgData
:
response
.
data
})
;
}).
catch
((
response
:
any
)
=>
{
}).
catch
((
response
:
any
)
=>
{
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常!'
});
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常!'
});
...
@@ -131,9 +138,53 @@ export default class AppDepartmentSelect extends Vue {
...
@@ -131,9 +138,53 @@ export default class AppDepartmentSelect extends Vue {
* @param {*} oldVal
* @param {*} oldVal
* @memberof AppDepartmentSelect
* @memberof AppDepartmentSelect
*/
*/
@
Watch
(
'data'
,{
deep
:
true
})
@
Watch
(
'data'
,{
immediate
:
true
,
deep
:
true
})
public
onValueChange
(
newVal
:
any
,
oldVal
:
any
)
{
public
onValueChange
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
this
.
computedSelectedData
();
this
.
$nextTick
(()
=>
{
this
.
searchNodesData
();
this
.
searchNodesData
();
});
}
}
/**
* 计算选中值
*
* @memberof AppOrgSelect
*/
public
computedSelectedData
(){
// 单选
if
(
!
this
.
multiple
){
if
(
this
.
fillMap
&&
Object
.
keys
(
this
.
fillMap
).
length
>
0
){
let
templateValue
=
{};
Object
.
keys
(
this
.
fillMap
).
forEach
((
item
:
any
)
=>
{
if
(
this
.
data
&&
this
.
data
[
this
.
fillMap
[
item
]]){
Object
.
assign
(
templateValue
,{[
item
]:
this
.
data
[
this
.
fillMap
[
item
]]});
}
})
this
.
selectTreeValue
=
JSON
.
stringify
([
templateValue
]);
}
}
else
{
// 多选
if
(
this
.
fillMap
&&
Object
.
keys
(
this
.
fillMap
).
length
>
0
){
let
tempArray
:
Array
<
any
>
=
[];
Object
.
keys
(
this
.
fillMap
).
forEach
((
item
:
any
)
=>
{
if
(
this
.
data
&&
this
.
data
[
this
.
fillMap
[
item
]]){
let
tempDataArray
:
Array
<
any
>
=
(
this
.
data
[
this
.
fillMap
[
item
]]).
split
(
","
);
tempDataArray
.
forEach
((
tempData
:
any
,
index
:
number
)
=>
{
if
(
tempArray
.
length
<
tempDataArray
.
length
){
let
singleData
:
any
=
{[
item
]:
tempData
};
tempArray
.
push
(
singleData
);
}
else
{
Object
.
assign
(
tempArray
[
index
],{[
item
]:
tempData
});
}
})
}
})
this
.
selectTreeValue
=
JSON
.
stringify
(
tempArray
);
}
}
}
}
/**
/**
...
@@ -145,17 +196,12 @@ export default class AppDepartmentSelect extends Vue {
...
@@ -145,17 +196,12 @@ export default class AppDepartmentSelect extends Vue {
public
onSelect
(
$event
:
any
){
public
onSelect
(
$event
:
any
){
// 组件自身抛值事件
// 组件自身抛值事件
let
selectArr
=
JSON
.
parse
(
$event
);
let
selectArr
=
JSON
.
parse
(
$event
);
if
(
selectArr
.
length
===
0
){
return
;
}
let
valueArr
=
selectArr
.
map
((
item
:
any
)
=>
{
return
{
id
:
item
.
id
,
label
:
item
.
label
}});
this
.
$emit
(
'select-change'
,
{
name
:
this
.
name
,
value
:
JSON
.
stringify
(
valueArr
)
});
// fillMap抛值事件
// fillMap抛值事件
if
(
this
.
fillMap
&&
Object
.
keys
(
this
.
fillMap
).
length
>
0
){
if
(
this
.
fillMap
&&
Object
.
keys
(
this
.
fillMap
).
length
>
0
){
Object
.
keys
(
this
.
fillMap
).
forEach
((
attribute
:
string
)
=>
{
Object
.
keys
(
this
.
fillMap
).
forEach
((
attribute
:
string
)
=>
{
let
_name
=
this
.
fillMap
[
attribute
];
let
_name
=
this
.
fillMap
[
attribute
];
let
_value
=
selectArr
.
map
((
item
:
any
)
=>
item
[
attribute
]);
let
_value
=
selectArr
.
map
((
item
:
any
)
=>
item
[
attribute
]);
this
.
$emit
(
'select-change'
,{
name
:
_name
,
value
:
_value
.
join
(
","
)})
this
.
$emit
(
'select-change'
,{
name
:
this
.
fillMap
[
attribute
]
,
value
:
_value
.
join
(
","
)})
});
});
}
}
...
...
app_web/src/store/getters.ts
浏览文件 @
d36c2d26
...
@@ -99,3 +99,13 @@ export const getOrgData = (state: any) => (srfkey: string) => {
...
@@ -99,3 +99,13 @@ export const getOrgData = (state: any) => (srfkey: string) => {
let
orgData
=
state
.
orgDataMap
[
srfkey
];
let
orgData
=
state
.
orgDataMap
[
srfkey
];
return
orgData
;
return
orgData
;
}
}
/**
* 获取部门数据
*
* @param state
*/
export
const
getDepData
=
(
state
:
any
)
=>
(
srfkey
:
string
)
=>
{
let
depData
=
state
.
depDataMap
[
srfkey
];
return
depData
;
}
\ No newline at end of file
app_web/src/store/mutations.ts
浏览文件 @
d36c2d26
...
@@ -278,3 +278,15 @@ export const addOrgData = (state: any, args: {srfkey: string,orgData: any}) => {
...
@@ -278,3 +278,15 @@ export const addOrgData = (state: any, args: {srfkey: string,orgData: any}) => {
state
.
orgDataMap
[
args
.
srfkey
]
=
JSON
.
parse
(
JSON
.
stringify
(
args
.
orgData
));
state
.
orgDataMap
[
args
.
srfkey
]
=
JSON
.
parse
(
JSON
.
stringify
(
args
.
orgData
));
}
}
}
}
/**
* 添加部门数据
*
* @param state
* @param args
*/
export
const
addDepData
=
(
state
:
any
,
args
:
{
srfkey
:
string
,
depData
:
any
})
=>
{
if
(
args
&&
args
.
srfkey
&&
args
.
depData
){
state
.
depDataMap
[
args
.
srfkey
]
=
JSON
.
parse
(
JSON
.
stringify
(
args
.
depData
));
}
}
\ No newline at end of file
app_web/src/store/state.ts
浏览文件 @
d36c2d26
...
@@ -15,4 +15,5 @@ export const rootstate: any = {
...
@@ -15,4 +15,5 @@ export const rootstate: any = {
viewSplit
:
{},
viewSplit
:
{},
copyDataMap
:{},
copyDataMap
:{},
orgDataMap
:{},
orgDataMap
:{},
depDataMap
:{},
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录