Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
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
1
Merge Requests
1
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
杨秀秀
HBHAndroid
Commits
5a0f73fb
Commit
5a0f73fb
authored
Aug 11, 2023
by
小费同学阿
💬
Committed by
杨秀秀
Nov 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业App 编写新建反馈-反馈部门基本回显
parent
150e9df0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
71 deletions
+104
-71
AppealDeptListDialog.kt
...in/java/com/xx/hbhbcompany/dialog/AppealDeptListDialog.kt
+21
-13
AppealDeptListAdapter.kt
...om/xx/hbhbcompany/dialog/adapter/AppealDeptListAdapter.kt
+33
-15
AppealViewModel.java
...in/java/com/xx/hbhbcompany/ui/appeal/AppealViewModel.java
+50
-43
No files found.
hbhbcompany/src/main/java/com/xx/hbhbcompany/dialog/AppealDeptListDialog.kt
View file @
5a0f73fb
...
@@ -13,31 +13,39 @@ import com.xx.xxviewlibrary.base.xxBaseDialog
...
@@ -13,31 +13,39 @@ import com.xx.xxviewlibrary.base.xxBaseDialog
import
me.jessyan.autosize.utils.AutoSizeUtils
import
me.jessyan.autosize.utils.AutoSizeUtils
class
AppealDeptListDialog
(
context
:
Context
,
val
list
:
MutableList
<
DeptBean
>):
xxBaseDialog
<
DialogAppealDeptListBinding
>(
context
){
class
AppealDeptListDialog
(
context
:
Context
,
val
list
:
MutableList
<
DeptBean
>)
:
xxBaseDialog
<
DialogAppealDeptListBinding
>(
context
)
{
lateinit
var
adpter
:
AppealDeptListAdapter
;
lateinit
var
adpter
:
AppealDeptListAdapter
;
override
fun
InitView
():
DialogSet
{
override
fun
InitView
():
DialogSet
{
return
DialogSet
(
return
DialogSet
(
R
.
layout
.
dialog_appeal_dept_list
,
true
,
R
.
layout
.
dialog_appeal_dept_list
,
true
,
Gravity
.
BOTTOM
,
true
,
WindowManager
.
LayoutParams
.
MATCH_PARENT
,
AutoSizeUtils
.
dp2px
(
context
,
Gravity
.
BOTTOM
,
true
,
WindowManager
.
LayoutParams
.
MATCH_PARENT
,
AutoSizeUtils
.
dp2px
(
321.0F
context
,
));
321.0F
)
);
}
}
override
fun
InitData
()
{
override
fun
InitData
()
{
binding
.
dialog
=
this
;
adpter
=
AppealDeptListAdapter
(
context
);
adpter
.
mList
=
list
as
List
<
TextListProvider
>?
binding
.
rvDblList
.
adapter
=
adpter
;
}
/*22222*/
binding
.
dialog
=
this
;
adpter
=
AppealDeptListAdapter
(
context
);
/*下方根据回调回显参数给列表挑勾*/
adpter
.
mList
=
list
as
List
<
TextListProvider
>?
binding
.
rvDblList
.
adapter
=
adpter
;
/*上方都是数据字典遍历列表选项!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
}
fun
typeClickDialog
(
view
:
View
)
{
fun
typeClickDialog
(
view
:
View
)
{
if
(
DialogClickListener
!=
null
)
{
if
(
DialogClickListener
!=
null
)
{
DialogClickListener
.
dialogClickBack
(
view
.
id
,
adpter
.
getBuuthBusinessId
())
/*先获取这个ids列表再将id一个个遍历进去*/
val
selectedTypesList
=
adpter
.
getSelectedTypesList
()
for
(
typeId
in
selectedTypesList
)
{
DialogClickListener
.
dialogClickBack
(
view
.
id
,
typeId
)
}
}
}
dismiss
()
dismiss
()
}
}
}
}
\ No newline at end of file
hbhbcompany/src/main/java/com/xx/hbhbcompany/dialog/adapter/AppealDeptListAdapter.kt
View file @
5a0f73fb
package
com.xx.hbhbcompany.dialog.adapter
package
com.xx.hbhbcompany.dialog.adapter
import
android.content.Context
import
android.content.Context
import
android.util.Log
import
android.view.View
import
android.view.View
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.xx.hbhbcompany.R
import
com.xx.hbhbcompany.R
...
@@ -12,42 +13,59 @@ import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter
...
@@ -12,42 +13,59 @@ import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter
class
AppealDeptListAdapter
(
context
:
Context
?)
:
class
AppealDeptListAdapter
(
context
:
Context
?)
:
xxBaseRecyclerViewAdapter
<
ItemDialogTypeBinding
,
TextListProvider
>(
context
),
xxBaseRecyclerViewAdapter
<
ItemDialogTypeBinding
,
TextListProvider
>(
context
),
xxBaseRecyclerViewAdapter
.
OnItemClick
<
TextListProvider
>
{
xxBaseRecyclerViewAdapter
.
OnItemClick
<
TextListProvider
>
{
/*1,把type变成数组列表用来盛放ids*/
var
selectedTypes
:
ArrayList
<
TextListProvider
>
=
ArrayList
()
var
type
:
TextListProvider
?
=
null
init
{
init
{
itemClick
=
this
;
itemClick
=
this
;
}
}
/*绑定选择器弹窗列表子布局*/
/*绑定选择器弹窗列表子布局*/
override
fun
initLayout
():
Int
{
override
fun
initLayout
():
Int
{
return
R
.
layout
.
item_dialog_type
return
R
.
layout
.
item_dialog_type
}
}
override
fun
covert
(
dataBind
:
ItemDialogTypeBinding
?,
data
:
TextListProvider
?,
position
:
Int
)
{
override
fun
covert
(
dataBind
:
ItemDialogTypeBinding
?,
data
:
TextListProvider
?,
position
:
Int
)
{
dataBind
?.
textprovider
=
data
;
dataBind
?.
textprovider
=
data
/*44444*/
LinearLayoutManager
.
VERTICAL
LinearLayoutManager
.
VERTICAL
if
(
data
?.
ProviderId
()
?.
equals
(
type
?.
ProviderId
())
==
true
)
/*使用包含方法,不适用equals了*/
{
if
(
selectedTypes
.
contains
(
data
))
{
dataBind
?.
tvIdbNo
?.
setTextColor
(
mContext
.
getColor
(
R
.
color
.
foreground
))
dataBind
?.
tvIdbNo
?.
setTextColor
(
mContext
.
getColor
(
R
.
color
.
foreground
))
dataBind
?.
ivIdbSelect
?.
visibility
=
View
.
VISIBLE
dataBind
?.
ivIdbSelect
?.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
/*点击了哪个就打钩*/
dataBind
?.
tvIdbNo
?.
setTextColor
(
mContext
.
getColor
(
R
.
color
.
black
))
dataBind
?.
tvIdbNo
?.
setTextColor
(
mContext
.
getColor
(
R
.
color
.
black
))
dataBind
?.
ivIdbSelect
?.
visibility
=
View
.
GONE
dataBind
?.
ivIdbSelect
?.
visibility
=
View
.
GONE
}
}
}
}
fun
getBuuthBusinessId
():
TextListProvider
?
{
/*获取数组*/
return
type
/*然后debug这一步就报类型异常了*/
fun
getSelectedTypesList
():
ArrayList
<
TextListProvider
>
{
/*error!!!!!!!!走这步没走通*/
return
ArrayList
(
selectedTypes
)
/*控制台未打印*/
Log
.
v
(
"这是取决于走没走数组,"
,
selectedTypes
.
toString
())
}
fun
setSelectedTypesList
(
selectedTypesList
:
ArrayList
<
TextListProvider
>)
{
selectedTypes
=
selectedTypesList
notifyDataSetChanged
()
}
}
/*选择时的item 移除和添加*/
override
fun
itemClickCalBack
(
position
:
Int
,
data
:
TextListProvider
?)
{
override
fun
itemClickCalBack
(
position
:
Int
,
data
:
TextListProvider
?)
{
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
type
=
data
if
(
selectedTypes
.
contains
(
data
))
{
selectedTypes
.
remove
(
data
)
}
else
{
selectedTypes
.
add
(
data
)
}
}
}
/*5555555*/
notifyDataSetChanged
()
notifyDataSetChanged
()
}
}
}
}
\ No newline at end of file
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/appeal/AppealViewModel.java
View file @
5a0f73fb
...
@@ -36,10 +36,16 @@ import me.goldze.mvvmhabit.http.ApiDisposableObserver;
...
@@ -36,10 +36,16 @@ import me.goldze.mvvmhabit.http.ApiDisposableObserver;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
public
class
AppealViewModel
extends
BaseViewModel
<
AppealRequest
>
{
public
class
AppealViewModel
extends
BaseViewModel
<
AppealRequest
>
{
/*多选的ids集合*/
private
List
<
String
>
idList
=
new
ArrayList
<
String
>();
/*多选的labels集合*/
private
List
<
String
>
labelList
=
new
ArrayList
<
String
>();
/*创建反馈类型数据字典实体对象*/
/*创建反馈类型数据字典实体对象*/
public
List
<
AppealTypeBean
>
appealTypeBeanList
=
new
ArrayList
<>();
public
List
<
AppealTypeBean
>
appealTypeBeanList
=
new
ArrayList
<>();
/*创建部门列表数据字典实体对象*/
/*创建部门列表数据字典实体对象*/
public
List
<
DeptBean
>
deptList
=
new
ArrayList
<>();
public
List
<
DeptBean
>
deptList
=
new
ArrayList
<>();
/*创建反馈类型的label*/
/*创建反馈类型的label*/
public
ObservableField
<
String
>
dictLabel
=
new
ObservableField
<>(
""
);
public
ObservableField
<
String
>
dictLabel
=
new
ObservableField
<>(
""
);
/*创建反馈类型的sort*/
/*创建反馈类型的sort*/
...
@@ -230,66 +236,67 @@ public class AppealViewModel extends BaseViewModel<AppealRequest> {
...
@@ -230,66 +236,67 @@ public class AppealViewModel extends BaseViewModel<AppealRequest> {
}
}
/*获取部门选择框列表(数据字典)*/
/*获取部门选择框列表(数据字典)*/
public
void
getDeptList
()
public
void
getDeptList
()
{
{
model
.
getDeptList
().
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
model
.
getDeptList
().
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
AppealViewModel
.
this
)
.
doOnSubscribe
(
AppealViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}
}).
subscribe
(
new
ApiDisposableObserver
<
List
<
DeptBean
>>()
{
}).
subscribe
(
new
ApiDisposableObserver
<
List
<
DeptBean
>>()
{
@Override
@Override
public
void
onSuccess
(
List
<
DeptBean
>
resultBean
)
{
public
void
onSuccess
(
List
<
DeptBean
>
resultBean
)
{
deptList
.
clear
();
deptList
.
clear
();
traverseDept
(
resultBean
);
traverseDept
(
resultBean
);
deptList
.
size
();
deptList
.
size
();
/*在初始页面的时候要给选择器(反馈类型)一个初始值*/
/*在初始页面的时候要给选择器(反馈类型)一个初始值*/
label
.
set
(
resultBean
.
get
(
0
).
getLabel
());
label
.
set
(
resultBean
.
get
(
0
).
getLabel
());
id
=
String
.
valueOf
(
resultBean
.
get
(
0
).
getId
());
id
=
String
.
valueOf
(
resultBean
.
get
(
0
).
getId
());
}
}
@Override
@Override
public
void
onError
(
String
Error
)
{
public
void
onError
(
String
Error
)
{
}
}
});
});
}
}
/*反馈部门选择*/
/*反馈部门选择*/
public
void
openDept
(
View
view
)
{
public
void
openDept
(
View
view
)
{
/*创建弹窗的adapter遍历*/
AppealDeptListDialog
dialoh
=
new
AppealDeptListDialog
(
view
.
getContext
(),
deptList
);
/*1111111111*/
dialoh
.
setDialogClickListener
(
new
xxBaseDialog
.
onDialogClickListener
<
TextListProvider
>()
{
AppealDeptListDialog
dialog
=
new
AppealDeptListDialog
(
view
.
getContext
(),
deptList
);
/*最后点击确定以后执行set*/
dialog
.
setDialogClickListener
(
new
xxBaseDialog
.
onDialogClickListener
<
TextListProvider
>()
{
@Override
@Override
public
void
dialogClickBack
(
int
code
,
TextListProvider
data
)
{
public
void
dialogClickBack
(
int
code
,
TextListProvider
data
)
{
/*选择以后把所在的label给set进去*/
label
.
set
(
data
.
providerText
());
if
(
data
!=
null
)
{
/*选择以后把所在的value给set进去*/
// 添加选中的部门id到idList中
id
=
data
.
ProviderId
();
idList
.
add
(
data
.
ProviderId
());
labelList
.
add
(
data
.
providerText
());
// 更新label显示的文本,可以将idList转换为逗号分隔的字符串显示
label
.
set
(
TextUtils
.
join
(
", "
,
labelList
));
}
}
}
});
});
/*
展示弹窗
*/
/*
3333333333
*/
dialo
h
.
show
();
dialo
g
.
show
();
}
/*清空回显列表重新赋值*/
labelList
.
clear
();
}
public
void
traverseDept
(
List
<
DeptBean
>
resultBean
)
public
void
traverseDept
(
List
<
DeptBean
>
resultBean
)
{
{
for
(
DeptBean
bean
:
resultBean
)
{
for
(
DeptBean
bean:
resultBean
)
if
(
bean
.
getChildren
()
==
null
)
{
{
if
(
bean
.
getChildren
()==
null
)
{
deptList
.
add
(
bean
);
deptList
.
add
(
bean
);
}
else
if
(
bean
.
getChildren
().
size
()<=
0
)
}
else
if
(
bean
.
getChildren
().
size
()
<=
0
)
{
{
deptList
.
add
(
bean
);
deptList
.
add
(
bean
);
}
else
{
}
else
{
traverseDept
(
bean
.
getChildren
());
traverseDept
(
bean
.
getChildren
());
}
}
}
}
...
...
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