fancy 5 лет назад
Родитель
Сommit
382caa915b

+ 18 - 7
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/calendar/CalendarMainActivity.kt

@@ -80,8 +80,7 @@ class CalendarMainActivity : BaseO2Activity() {
                 checkBox.setOnClickListener {
                     toggleCheck(checkBox.isChecked, child.id)
                 }
-                //@date 2018-8-8 暂时不修改组织日历
-                if (child.manageable && child.type == "PERSON") {
+                if (child.manageable) {
                     editBtn.visible()
                     editBtn.setOnClickListener {
                         XLog.info("点击编辑日历。。。。。。${child.name}.........")
@@ -210,9 +209,16 @@ class CalendarMainActivity : BaseO2Activity() {
      * 修改日程事件
      */
     fun editEvent(event: CalendarEventInfoData) {
-        val arr = ArrayList<CalendarInfoPickViewData>()
-        groups[0].children.forEach { arr.add(it) }
-        go<CreateEventActivity>(CreateEventActivity.startEdit(event, arr))
+        if (groups.isNotEmpty()) {
+            val arr = ArrayList<CalendarInfoPickViewData>()
+            if (groups.size > 1) {
+                groups[0].children.forEach { arr.add(it) }
+                groups[1].children.forEach { arr.add(it) }
+            }else {
+                groups[0].children.forEach { arr.add(it) }
+            }
+            go<CreateEventActivity>(CreateEventActivity.startEdit(event, arr))
+        }
     }
 
     /**
@@ -228,9 +234,14 @@ class CalendarMainActivity : BaseO2Activity() {
      * 创建日程事件
      */
     private fun createCalendarEvent() {
-        if (groups.isNotEmpty() && groups[0].children.isNotEmpty()) {
+        if (groups.isNotEmpty()) {
             val arr = ArrayList<CalendarInfoPickViewData>()
-            groups[0].children.forEach { arr.add(it) }
+            if (groups.size > 1) {
+                groups[0].children.forEach { arr.add(it) }
+                groups[1].children.forEach { arr.add(it) }
+            }else {
+                groups[0].children.forEach { arr.add(it) }
+            }
             go<CreateEventActivity>(CreateEventActivity.startCreate(arr))
         } else {
             XToast.toastShort(this, "日历数据为空!!!!")

+ 78 - 17
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/calendar/CreateCalendarActivity.kt

@@ -15,12 +15,15 @@ import android.widget.ImageView
 import android.widget.LinearLayout
 import com.bigkoo.pickerview.OptionsPickerView
 import com.readystatesoftware.systembartint.SystemBarTintManager
+import com.wugang.activityresult.library.ActivityResult
 import kotlinx.android.synthetic.main.activity_create_calendar.*
 import net.muliba.changeskin.FancySkinManager
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.R
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.calendar.vm.CreateCalendarViewModel
+import net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.o2.organization.ContactPickerActivity
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.databinding.ActivityCreateCalendarBinding
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.model.vo.CalendarPickerOption
+import net.zoneland.x.bpm.mobile.v1.zoneXBPM.model.vo.ContactPickerResult
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.ImmersedStatusBarUtils
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.XLog
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.XToast
@@ -87,22 +90,80 @@ class CreateCalendarActivity : AppCompatActivity() {
 
     /**
      * 日历类型 选择
-     * @2018-8-8 先删除这个事件 暂时不能选择类型 因为组织类型还有其他字段问题。。。。
      */
-//    fun chooseType(view: View) {
-//        val picker = OptionsPickerView.Builder(this, OptionsPickerView.OnOptionsSelectListener { option1, _, _, _ ->
-//            viewModel.setCalendarType(typeList[option1])
-//        }).setTitleText(getString(R.string.calendar_type_choose))
-//                .isDialog(true)
-//                .build()
-//        picker.setPicker(typeList)
-//        var selectIndex = typeList.indexOfFirst { it.name == viewModel.calendarType.value }
-//        if (selectIndex < 0) {
-//            selectIndex = 0
-//        }
-//        picker.setSelectOptions(selectIndex)
-//        picker.showDialog()
-//    }
+    fun chooseType(view: View) {
+        val picker = OptionsPickerView.Builder(this, OptionsPickerView.OnOptionsSelectListener { option1, _, _, _ ->
+            viewModel.setCalendarType(typeList[option1])
+        }).setTitleText(getString(R.string.calendar_type_choose))
+                .isDialog(true)
+                .build()
+        picker.setPicker(typeList)
+        var selectIndex = typeList.indexOfFirst { it.name == viewModel.calendarType.value }
+        if (selectIndex < 0) {
+            selectIndex = 0
+        }
+        picker.setSelectOptions(selectIndex)
+        picker.showDialog()
+    }
+
+    //选择所属组织
+    fun chooseOrgTarget(view: View) {
+        val bundle = ContactPickerActivity.startPickerBundle(arrayListOf("departmentPicker"),multiple=false)
+        ActivityResult.of(this)
+                .className(ContactPickerActivity::class.java)
+                .params(bundle)
+                .greenChannel().forResult { _, data ->
+                    val result = data?.getParcelableExtra<ContactPickerResult>(ContactPickerActivity.CONTACT_PICKED_RESULT)
+                    if (result != null) {
+                         viewModel.target.value = result.departments.firstOrNull()?.distinguishedName
+                    }
+                }
+    }
+
+    //选择管理者
+    fun chooseManageablePersonList(view: View) {
+        val bundle = ContactPickerActivity.startPickerBundle(arrayListOf("personPicker"),multiple=true)
+        ActivityResult.of(this)
+                .className(ContactPickerActivity::class.java)
+                .params(bundle)
+                .greenChannel().forResult { _, data ->
+                    val result = data?.getParcelableExtra<ContactPickerResult>(ContactPickerActivity.CONTACT_PICKED_RESULT)
+                    if (result != null) {
+                        viewModel.manageablePersonList.value = result.users.map { it.distinguishedName }
+                    }
+                }
+    }
+    //选择可见范围
+    fun chooseViewableList(view: View) {
+        val bundle = ContactPickerActivity.startPickerBundle(arrayListOf("personPicker", "departmentPicker","groupPicker"), multiple=true)
+        ActivityResult.of(this)
+                .className(ContactPickerActivity::class.java)
+                .params(bundle)
+                .greenChannel().forResult { _, data ->
+                    val result = data?.getParcelableExtra<ContactPickerResult>(ContactPickerActivity.CONTACT_PICKED_RESULT)
+                    if (result != null) {
+                        viewModel.viewablePersonList.value = result.users.map { it.distinguishedName }
+                        viewModel.viewableUnitList.value = result.departments.map { it.distinguishedName }
+                        viewModel.viewableGroupList.value = result.groups.map { it.distinguishedName }
+                    }
+                }
+    }
+    //选择可新建日程范围
+    fun choosePublishableList(view: View) {
+        val bundle = ContactPickerActivity.startPickerBundle(arrayListOf("personPicker", "departmentPicker","groupPicker"), multiple=true)
+        ActivityResult.of(this)
+                .className(ContactPickerActivity::class.java)
+                .params(bundle)
+                .greenChannel().forResult { _, data ->
+                    val result = data?.getParcelableExtra<ContactPickerResult>(ContactPickerActivity.CONTACT_PICKED_RESULT)
+                    if (result != null) {
+                        viewModel.publishablePersonList.value = result.users.map { it.distinguishedName }
+                        viewModel.publishableUnitList.value = result.departments.map { it.distinguishedName }
+                        viewModel.publishableGroupList.value = result.groups.map { it.distinguishedName }
+                    }
+                }
+    }
+
 
 
     /************* MARK private ************/
@@ -160,9 +221,9 @@ class CreateCalendarActivity : AppCompatActivity() {
         CalendarOB.deepColor.forEach { (_, value) ->
             val card = CardView(this@CreateCalendarActivity)
             card.setCardBackgroundColor(Color.parseColor(value))
-            card.radius = dip(11).toFloat()
+            card.radius = dip(15).toFloat()
             card.tag = value
-            val lp = LinearLayout.LayoutParams(dip(22), dip(22))
+            val lp = LinearLayout.LayoutParams(dip(30), dip(30))
             val margin = dip(8)
             lp.setMargins(margin, margin, margin, margin)
             ll_create_calendar_color_layout.addView(card, lp)

+ 171 - 10
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/calendar/vm/CreateCalendarViewModel.kt

@@ -6,7 +6,6 @@ import android.arch.lifecycle.MediatorLiveData
 import android.arch.lifecycle.MutableLiveData
 import android.arch.lifecycle.Transformations
 import android.text.TextUtils
-import net.zoneland.x.bpm.mobile.v1.zoneXBPM.O2App
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.O2SDKManager
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.base.BaseO2ViewModel
 import net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.calendar.CalendarOB
@@ -32,18 +31,34 @@ class CreateCalendarViewModel(app: Application) : BaseO2ViewModel(app) {
     val calendarColor: MutableLiveData<String> by lazy { MutableLiveData<String>() }
     val comment: MutableLiveData<String> by lazy { MutableLiveData<String>() }
     val isPublic: MutableLiveData<Boolean> by lazy { MutableLiveData<Boolean>() }
+    val isOrgCalendar: MutableLiveData<Boolean> by lazy { MutableLiveData<Boolean>() }
     val calendarType:  MutableLiveData<String> by lazy { MutableLiveData<String>() }
     //id 触发查询Calendar对象
-    val oldCalendar: LiveData<CalendarPostData> = Transformations.switchMap(calendarId, { id ->
+    val oldCalendar: LiveData<CalendarPostData> = Transformations.switchMap(calendarId) { id ->
         val calendarData = MutableLiveData<CalendarPostData>()
         loadFromNet(id, calendarData)
         calendarData
+    }
 
-    })
-
-    val deleteBtnVisibleable: MediatorLiveData<Boolean> = MediatorLiveData()
+    //所属组织、人员
+    val target:  MutableLiveData<String> by lazy { MutableLiveData<String>() }
+    val targetName: MediatorLiveData<String> by lazy { MediatorLiveData<String>() }
+    //管理者
+    val manageablePersonList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val manageablePersonName: MediatorLiveData<String> by lazy { MediatorLiveData<String>() }
+    //可见范围
+    val viewablePersonList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val viewableUnitList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val viewableGroupList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val viewableName: MediatorLiveData<String> by lazy { MediatorLiveData<String>() }
+    //可新建日程的范围
+    val publishablePersonList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val publishableUnitList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val publishableGroupList:  MutableLiveData<List<String>> by lazy { MutableLiveData<List<String>>() }
+    val publishableName: MediatorLiveData<String> by lazy { MediatorLiveData<String>() }
 
 
+    val deleteBtnVisibleable: MediatorLiveData<Boolean> = MediatorLiveData()
 
     private val isLoading: MutableLiveData<Boolean> by lazy { MutableLiveData<Boolean>() }
     //网络操作反馈结果
@@ -53,9 +68,111 @@ class CreateCalendarViewModel(app: Application) : BaseO2ViewModel(app) {
 
     init {
         isPublic.value = false
-        deleteBtnVisibleable.addSource(calendarId, { id->
+        isOrgCalendar.value = false
+        deleteBtnVisibleable.addSource(calendarId) { id->
             deleteBtnVisibleable.value = !TextUtils.isEmpty(id)
-        })
+        }
+
+        targetName.addSource(target) { value ->
+            targetName.value = if (value?.contains("@") == true) {
+                value.split("@").first()
+            }else {
+                ""
+            }
+        }
+        manageablePersonName.addSource(manageablePersonList) { value ->
+            if (value != null && value.isNotEmpty()) {
+                manageablePersonName.value = value.joinToString {
+                    if (it.contains("@")) {
+                        it.split("@").first()
+                    } else {
+                        it
+                    }
+                }
+            }else {
+                manageablePersonName.value = ""
+            }
+        }
+        viewableName.addSource(viewablePersonList) { viewableNameSetup() }
+        viewableName.addSource(viewableUnitList) { viewableNameSetup() }
+        viewableName.addSource(viewableGroupList) { viewableNameSetup() }
+        publishableName.addSource(publishablePersonList) {
+            publishableNameSetup()
+        }
+        publishableName.addSource(publishableUnitList) {
+            publishableNameSetup()
+        }
+        publishableName.addSource(publishableGroupList) {
+            publishableNameSetup()
+        }
+    }
+    private fun viewableNameSetup() {
+        val personList = viewablePersonList.value
+        val unitList = viewableUnitList.value
+        val groupList = viewableGroupList.value
+        var name = ""
+        if (personList != null && personList.isNotEmpty()) {
+            name += personList.joinToString {
+                if (it.contains("@")) {
+                    it.split("@").first()
+                } else {
+                    it
+                }
+            } + " "
+        }
+        if (unitList != null && unitList.isNotEmpty()) {
+            name += unitList.joinToString {
+                if (it.contains("@")) {
+                    it.split("@").first()
+                } else {
+                    it
+                }
+            } + " "
+        }
+        if (groupList != null && groupList.isNotEmpty()) {
+            name += groupList.joinToString {
+                if (it.contains("@")) {
+                    it.split("@").first()
+                } else {
+                    it
+                }
+            } + " "
+        }
+        viewableName.value = name
+    }
+    private fun publishableNameSetup() {
+        val personList = publishablePersonList.value
+        val unitList = publishableUnitList.value
+        val groupList = publishableGroupList.value
+        var name = ""
+        if (personList != null && personList.isNotEmpty()) {
+            name += personList.joinToString {
+                if (it.contains("@")) {
+                    it.split("@").first()
+                } else {
+                    it
+                }
+            } + " "
+        }
+        if (unitList != null && unitList.isNotEmpty()) {
+            name += unitList.joinToString {
+                if (it.contains("@")) {
+                    it.split("@").first()
+                } else {
+                    it
+                }
+            } + " "
+        }
+        if (groupList != null && groupList.isNotEmpty()) {
+            name += groupList.joinToString {
+                if (it.contains("@")) {
+                    it.split("@").first()
+                } else {
+                    it
+                }
+            } + " "
+        }
+        publishableName.value = name
     }
 
 
@@ -67,7 +184,18 @@ class CreateCalendarViewModel(app: Application) : BaseO2ViewModel(app) {
         post.isPublic = isPublic.value ?:false
         post.status = "OPEN"
         post.description = comment.value ?:""
-        post.target = O2SDKManager.instance().distinguishedName
+        if (TextUtils.isEmpty(target.value)) {
+            post.target = O2SDKManager.instance().distinguishedName
+        }else {
+            post.target = target.value!!
+        }
+        post.manageablePersonList = manageablePersonList.value ?: ArrayList()
+        post.viewablePersonList = viewablePersonList.value ?: ArrayList()
+        post.viewableUnitList = viewableUnitList.value ?: ArrayList()
+        post.viewableGroupList = viewableGroupList.value ?: ArrayList()
+        post.publishablePersonList = publishablePersonList.value ?: ArrayList()
+        post.publishableUnitList = publishableUnitList.value ?: ArrayList()
+        post.publishableGroupList = publishableGroupList.value ?: ArrayList()
 
         XLog.info("$post")
         isLoading.value = true
@@ -103,7 +231,19 @@ class CreateCalendarViewModel(app: Application) : BaseO2ViewModel(app) {
         post.isPublic = isPublic.value ?:false
         post.status = "OPEN"
         post.description = comment.value ?:""
-        post.target = O2SDKManager.instance().distinguishedName
+
+        if (TextUtils.isEmpty(target.value)) {
+            post.target = O2SDKManager.instance().distinguishedName
+        }else {
+            post.target = target.value!!
+        }
+        post.manageablePersonList = manageablePersonList.value ?: ArrayList()
+        post.viewablePersonList = viewablePersonList.value ?: ArrayList()
+        post.viewableUnitList = viewableUnitList.value ?: ArrayList()
+        post.viewableGroupList = viewableGroupList.value ?: ArrayList()
+        post.publishablePersonList = publishablePersonList.value ?: ArrayList()
+        post.publishableUnitList = publishableUnitList.value ?: ArrayList()
+        post.publishableGroupList = publishableGroupList.value ?: ArrayList()
         XLog.info("update calendar: $post")
         isLoading.value = true
         getCalendarAssembleService()?.saveCalendar(post)
@@ -159,18 +299,39 @@ class CreateCalendarViewModel(app: Application) : BaseO2ViewModel(app) {
     fun setCalendarType(type: CalendarPickerOption) {
         calendarTypeKey.value = type.value
         calendarType.value = type.name
+        val isOrg = type.value == "UNIT"
+        isOrgCalendar.value = isOrg
+        if (isOrg) {
+            target.value = ""
+            manageablePersonList.value = ArrayList()
+            viewablePersonList.value = ArrayList()
+            viewableUnitList.value = ArrayList()
+            viewableGroupList.value = ArrayList()
+            publishablePersonList.value = ArrayList()
+            publishableUnitList.value = ArrayList()
+            publishableGroupList.value = ArrayList()
+        }
     }
 
     fun setBackCalendarInfo(info: CalendarPostData) {
-        calendarTitle.value = info.name
         var type = CalendarOB.calendarTypes[info.type]
         if (type == null) {
             type = CalendarOB.calendarTypes["PERSON"]!!
         }
         setCalendarType(CalendarPickerOption(type, info.type))
+
+        calendarTitle.value = info.name
         calendarColor.value = info.color
         isPublic.value = info.isPublic
         comment.value = info.description
+        target.value = info.target
+        manageablePersonList.value = info.manageablePersonList
+        viewablePersonList.value = info.viewablePersonList
+        viewableUnitList.value = info.viewableUnitList
+        viewableGroupList.value = info.viewableGroupList
+        publishablePersonList.value = info.publishablePersonList
+        publishableUnitList.value = info.publishableUnitList
+        publishableGroupList.value = info.publishableGroupList
     }
 
 

+ 5 - 1
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/core/service/CollectLogJobService.kt

@@ -34,7 +34,11 @@ class CollectLogJobService : JobService() {
     private var collectService: CollectService? = null
 
     override fun onStartJob(params: JobParameters?): Boolean {
-        collectService = RetrofitClient.instance().collectApi()
+        try {
+            collectService = RetrofitClient.instance().collectApi()
+        } catch (e: Exception) {
+            XLog.error("中心服务器获取失败", e)
+        }
         XLog.info("onStartJob :" + params?.jobId)
         executeTask(params)
         return false//true还在执行,任务执行完成后需要手动调用jobFinished, false 表示任务执行完了

+ 196 - 19
o2android/app/src/main/res/layout/activity_create_calendar.xml

@@ -1,17 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    xmlns:app="http://schemas.android.com/apk/res-auto">
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
     <data>
+
         <variable
             name="viewmodel"
-            type="net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.calendar.vm.CreateCalendarViewModel"/>
+            type="net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.calendar.vm.CreateCalendarViewModel" />
     </data>
+
     <android.support.constraint.ConstraintLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@color/z_color_background"
         tools:context=".app.calendar.CreateCalendarActivity">
+
         <RelativeLayout
             android:id="@+id/rl_create_calendar_top"
             android:layout_width="match_parent"
@@ -48,10 +52,10 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/image_create_calendar_close_btn"
-                android:layout_marginBottom="@dimen/spacing_small"
-                android:layout_marginEnd="@dimen/spacing_small"
                 android:layout_marginStart="@dimen/spacing_small"
                 android:layout_marginTop="@dimen/spacing_large"
+                android:layout_marginEnd="@dimen/spacing_small"
+                android:layout_marginBottom="@dimen/spacing_small"
                 android:background="@null"
                 android:hint="@string/calendar_title_hint"
                 android:text="@={viewmodel.calendarTitle}"
@@ -66,11 +70,11 @@
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/spacing_normal"
             android:layout_marginTop="@dimen/spacing_normal"
-            android:checked="@={viewmodel.isPublic()}"
-            android:text="@string/calendar_is_open"
             android:button="@drawable/o2_checkbox"
+            android:checked="@={viewmodel.isPublic()}"
             android:paddingStart="10dp"
             android:paddingEnd="10dp"
+            android:text="@string/calendar_is_open"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/rl_create_calendar_top" />
@@ -111,13 +115,14 @@
 
         <TextView
             android:id="@+id/tv_create_calendar_type"
-            android:layout_width="335dp"
+            android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/spacing_normal"
             android:layout_marginTop="@dimen/spacing_normal"
             android:text="@={viewmodel.calendarType}"
             android:textColor="@color/z_color_text_primary_dark"
             android:textSize="@dimen/font_large"
+            android:onClick="chooseType"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/view_create_calendar_color_divider"
@@ -126,15 +131,188 @@
         <ImageView
             android:layout_width="18dp"
             android:layout_height="18dp"
-            android:layout_marginEnd="@dimen/spacing_normal"
             android:layout_marginTop="@dimen/spacing_normal"
+            android:layout_marginEnd="@dimen/spacing_normal"
             android:src="@mipmap/icon_arrow_22dp"
-            android:visibility="invisible"
+            android:visibility="visible"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_bias="1"
             app:layout_constraintStart_toEndOf="@+id/tv_create_calendar_type"
             app:layout_constraintTop_toBottomOf="@+id/view_create_calendar_color_divider" />
 
+
+        <LinearLayout
+            android:id="@+id/ll_create_calendar_org_args"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            visibleOrGone="@{viewmodel.isOrgCalendar}"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tv_create_calendar_type">
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1px"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:background="@color/divider" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/spacing_normal"
+                android:layout_marginEnd="@dimen/spacing_normal"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:orientation="horizontal"
+                android:onClick="chooseOrgTarget">
+
+                <TextView
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="@dimen/spacing_small"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_large"
+                    android:text="所属组织" />
+                <TextView
+                    android:id="@+id/tv_create_calendar_target_name"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_normal"
+                    tools:text="组织1"
+                    android:text="@={viewmodel.targetName}"/>
+
+                <ImageView
+                    android:layout_width="18dp"
+                    android:layout_height="18dp"
+                    android:layout_gravity="center_vertical"
+                    android:src="@mipmap/icon_arrow_22dp" />
+            </LinearLayout>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1px"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:background="@color/divider" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/spacing_normal"
+                android:layout_marginEnd="@dimen/spacing_normal"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:orientation="horizontal"
+                android:onClick="chooseManageablePersonList">
+
+                <TextView
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="@dimen/spacing_small"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_large"
+                    android:text="管理者" />
+                <TextView
+                    android:id="@+id/tv_create_calendar_manager_name"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_normal"
+                    tools:text="组织1"
+                    android:text="@={viewmodel.manageablePersonName}"/>
+
+                <ImageView
+                    android:layout_width="18dp"
+                    android:layout_height="18dp"
+                    android:layout_gravity="center_vertical"
+                    android:src="@mipmap/icon_arrow_22dp" />
+
+            </LinearLayout>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1px"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:background="@color/divider" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/spacing_normal"
+                android:layout_marginEnd="@dimen/spacing_normal"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:orientation="horizontal"
+                android:onClick="chooseViewableList">
+
+                <TextView
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="@dimen/spacing_small"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_large"
+                    android:text="可见范围" />
+                <TextView
+                    android:id="@+id/tv_create_calendar_viewable_name"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_normal"
+                    tools:text="组织1"
+                    android:text="@={viewmodel.viewableName}"/>
+
+                <ImageView
+                    android:layout_width="18dp"
+                    android:layout_height="18dp"
+                    android:layout_gravity="center_vertical"
+                    android:src="@mipmap/icon_arrow_22dp" />
+
+            </LinearLayout>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1px"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:background="@color/divider" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/spacing_normal"
+                android:layout_marginEnd="@dimen/spacing_normal"
+                android:layout_marginTop="@dimen/spacing_normal"
+                android:orientation="horizontal"
+                android:onClick="choosePublishableList">
+
+                <TextView
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_large"
+                    android:text="可新建范围"
+                    android:layout_marginEnd="@dimen/spacing_small"/>
+                <TextView
+                    android:id="@+id/tv_create_calendar_publishable_name"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:textColor="@color/z_color_text_primary_dark"
+                    android:textSize="@dimen/font_normal"
+                    tools:text="组织1"
+                    android:text="@={viewmodel.publishableName}"/>
+
+                <ImageView
+                    android:layout_width="18dp"
+                    android:layout_height="18dp"
+                    android:layout_gravity="center_vertical"
+                    android:src="@mipmap/icon_arrow_22dp" />
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+
         <View
             android:id="@+id/view_create_calendar_type_divider"
             android:layout_width="match_parent"
@@ -143,7 +321,7 @@
             android:background="@color/divider"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/tv_create_calendar_type" />
+            app:layout_constraintTop_toBottomOf="@+id/ll_create_calendar_org_args" />
 
         <EditText
             android:id="@+id/et_create_calendar_comment"
@@ -152,9 +330,9 @@
             android:layout_marginStart="@dimen/spacing_small"
             android:layout_marginTop="@dimen/spacing_normal"
             android:background="@null"
-            android:minLines="3"
-            android:hint="@string/calendar_comment"
             android:gravity="top"
+            android:hint="@string/calendar_comment"
+            android:minLines="3"
             android:text="@={viewmodel.comment}"
             android:textColor="@color/z_color_text_primary"
             android:textColorHint="@color/z_color_text_hint"
@@ -165,20 +343,19 @@
 
         <Button
             android:id="@+id/btn_login_submit"
+            visibleOrGone="@{viewmodel.deleteBtnVisibleable}"
             android:layout_width="325dp"
             android:layout_height="44dp"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/et_create_calendar_comment"
             android:layout_marginTop="@dimen/spacing_normal"
             android:layout_marginBottom="@dimen/spacing_normal"
             android:background="@drawable/button_background_44dp"
+            android:onClick="clickDeleteBtn"
             android:text="@string/calendar_delete_calendar"
             android:textColor="@android:color/white"
             android:textSize="18sp"
-            visibleOrGone="@{viewmodel.deleteBtnVisibleable}"
-            android:onClick="clickDeleteBtn"
-            />
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/et_create_calendar_comment" />
 
     </android.support.constraint.ConstraintLayout>
 </layout>

+ 1 - 1
o2android/app/src/main/res/layout/activity_create_event.xml

@@ -320,7 +320,7 @@
                 android:orientation="horizontal"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toBottomOf="@+id/tv_create_calendar_event_repeat_name"></LinearLayout>
+                app:layout_constraintTop_toBottomOf="@+id/tv_create_calendar_event_repeat_name"/>
 
             <LinearLayout
                 android:id="@+id/ll_create_calendar_event_repeat_until_date"

+ 13 - 2
o2android/o2_auth_sdk/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/model/bo/api/calendar/CalendarPostData.kt

@@ -12,8 +12,19 @@ data class CalendarPostData (
         var color: String = "",
         var isPublic: Boolean = false,
         var followed: Boolean = false,
-        var target: String = "",
         var description: String = "",
         var status: String = "",
-        var createor: String = ""
+        var createor: String = "",
+        //所属组织、人员
+        var target: String = "",
+        //管理者
+        var manageablePersonList: List<String> = ArrayList(),
+        //可见范围
+        var viewablePersonList: List<String> = ArrayList(),
+        var viewableUnitList: List<String> = ArrayList(),
+        var viewableGroupList: List<String> = ArrayList(),
+        //可新建日程的范围
+        var publishablePersonList: List<String> = ArrayList(),
+        var publishableUnitList: List<String> = ArrayList(),
+        var publishableGroupList: List<String> = ArrayList()
 )