file.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view style="background-color: #fff;padding-bottom: 110rpx;" v-if="loading == true">
  3. <u-radio-group v-model="value" iconPlacement="right" placement="colum" @change="change">
  4. <u-collapse accordion >
  5. <view v-for="v in gdDept" :key="v.archiveTypeId">
  6. <u-collapse-item :title="v.name" :name="v.archiveTypeId" v-if="v.children != undefined">
  7. <view class="checkitem" v-for=" i in v.children" :key="i.archiveTypeId">
  8. <u-radio :label="i.name" :name="i.archiveTypeId+','+i.name"></u-radio>
  9. </view>
  10. </u-collapse-item>
  11. <view class="checkitem" style="padding: 20rpx;" v-else>
  12. <u-radio :label="v.name" :name="v.archiveTypeId+','+v.name"></u-radio>
  13. </view>
  14. </view>
  15. </u-collapse>
  16. </u-radio-group>
  17. <view style="position: fixed;bottom: 0;left: 0;width: 100%;height: 100rpx;background-color: #fff;box-sizing: border-box;padding: 20rpx;">
  18. <u-button type="primary" text="确认" @click="submit"></u-button>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {handleTree} from "@/utils/wjw.js"
  24. export default {
  25. data() {
  26. return {
  27. //归档部门
  28. gdDept:null,
  29. value:null,
  30. loading:false
  31. }
  32. },
  33. onLoad(){
  34. uni.showLoading({
  35. title:"加载中...",
  36. })
  37. this.getGdList()
  38. },
  39. onNavigationBarButtonTap(e) {
  40. if(this.value == null){
  41. uni.showToast({
  42. title:"请选择归档分类",
  43. icon:"none"
  44. })
  45. }else{
  46. getApp().globalData.gdId = this.value
  47. uni.$emit('query' , {a : 2})
  48. uni.navigateBack()
  49. }
  50. },
  51. methods: {
  52. //查询归档部门
  53. getGdList(){
  54. uni.$u.http.get("/archive/type/list").then(res=>{
  55. uni.hideLoading()
  56. this.$nextTick(()=>{
  57. this.gdDept = handleTree(res.data,"archiveTypeId","parentId")
  58. // console.log(this.gdDept)
  59. })
  60. setTimeout(()=>{
  61. this.$forceUpdate()
  62. this.loading = true
  63. },500)
  64. })
  65. },
  66. //选中
  67. change(e){
  68. },
  69. submit(){
  70. if(this.value == null){
  71. uni.showToast({
  72. title:"请选择归档分类",
  73. icon:"none"
  74. })
  75. }else{
  76. getApp().globalData.gdId = this.value
  77. uni.$emit('query' , {a : 2})
  78. uni.navigateBack()
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .checkitem{
  86. font-size: 32rpx;
  87. padding: 20rpx 0;
  88. border-bottom: 1px solid #eaeaea;
  89. }
  90. </style>