matterPop.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view>
  3. <u-popup :show="show" duration='300' :mode='mode' :closeOnClickOverlay='false'>
  4. <view class="content-box">
  5. <view class="list_box">
  6. <u-list @scrolltolower="scrolltolower">
  7. <checkbox-group v-for="(item, index) in ListData" :key="index"
  8. @change="e => selectVal(e, item, index)">
  9. <label class="listBox rx-bs">
  10. <view class="listBox-sel">
  11. <checkbox :value="item.code" color="#fff" :disabled="item.disabled"
  12. :checked="item.checked" />
  13. </view>
  14. <view class="listBox-con">
  15. <view class="listBox-top rx-bc">
  16. <view> {{ item.name }}</view>
  17. <view class="code">{{ item.code}}</view>
  18. </view>
  19. <view class="listBox-bottom rx">
  20. <view v-for="(itm, index) in tableH(1)" :key="index" class="item100">
  21. {{ itm.label }}:{{ item[itm.prop] }}
  22. </view>
  23. </view>
  24. </view>
  25. </label>
  26. </checkbox-group>
  27. <view style='margin-top: 20vh;' v-if='DTOList.length == 0'>
  28. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  29. </u-empty>
  30. </view>
  31. </u-list>
  32. </view>
  33. <view class="operate_box rx-sc">
  34. <u-button size="small" class="u-reset-button" @click="handleClose">取消</u-button>
  35. <u-button size="small" class="u-reset-button" type="success" @click="save">确认 </u-button>
  36. </view>
  37. </view>
  38. </u-popup>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. tableHeader
  44. } from '../../common.js'
  45. export default {
  46. props: {
  47. matterId: [String, Number],
  48. DTOList: {
  49. type: Array,
  50. default: () => {}
  51. }
  52. },
  53. data() {
  54. return {
  55. show: true,
  56. mode: 'right',
  57. memoList: [],
  58. list: []
  59. }
  60. },
  61. computed: {
  62. ListData() {
  63. const data = this.DTOList.map(m => {
  64. m.checked = false
  65. return {
  66. ...m
  67. }
  68. })
  69. this.list = data
  70. return data
  71. }
  72. },
  73. methods: {
  74. scrolltolower() {},
  75. save() {
  76. this.$emit('mattSave', this.memoList, this.matterId)
  77. },
  78. //勾选
  79. selectVal(e, val, index) {
  80. this.list[index].checked = !this.list[index].checked
  81. const idx = this.memoList.findIndex(
  82. item => item.code === this.list[index].code
  83. )
  84. if (this.list[index].checked) {
  85. if (idx === -1) {
  86. this.memoList.push(this.list[index])
  87. }
  88. } else {
  89. if (idx > -1) {
  90. this.memoList.splice(idx, 1)
  91. }
  92. }
  93. },
  94. tableH(type) {
  95. return tableHeader(type)
  96. },
  97. handleClose() {
  98. this.$emit('close')
  99. },
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .content-box {
  105. width: 80vw;
  106. height: 100vh;
  107. overflow: hidden;
  108. display: flex;
  109. flex-direction: column;
  110. background-color: $page-bg;
  111. }
  112. .list_box {
  113. flex: 1;
  114. overflow: hidden;
  115. padding: 4rpx 0;
  116. .u-list {
  117. height: 100% !important;
  118. }
  119. }
  120. .listBox {
  121. margin-top: 8rpx;
  122. padding: 8rpx 24rpx;
  123. background: #fff;
  124. /deep/ .uni-checkbox-input-checked {
  125. background-color: $theme-color !important;
  126. border-color: $theme-color !important;
  127. }
  128. .listBox-con {
  129. width: 650rpx;
  130. font-weight: 400;
  131. }
  132. .listBox-top {
  133. margin-top: 6rpx;
  134. color: #090A0A;
  135. font-size: 28rpx;
  136. font-style: normal;
  137. }
  138. .listBox-bottom {
  139. color: #090A0A;
  140. font-size: 24rpx;
  141. font-style: normal;
  142. flex-wrap: wrap;
  143. .item100 {
  144. width: 100%;
  145. margin-top: 8rpx;
  146. }
  147. .items {
  148. width: 50%;
  149. margin-top: 8rpx;
  150. }
  151. }
  152. }
  153. .operate_box {
  154. background-color: #fff;
  155. padding: 10rpx 100rpx;
  156. /deep/ .u-button {
  157. width: 160rpx;
  158. }
  159. }
  160. </style>