matterPop.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. mattList: {
  53. type: Array,
  54. default: () => {}
  55. }
  56. },
  57. data() {
  58. return {
  59. show: true,
  60. mode: 'right',
  61. memoList: [],
  62. list: []
  63. }
  64. },
  65. computed: {
  66. ListData() {
  67. console.log(this.mattList)
  68. let list = []
  69. list.push(
  70. ...this.DTOList.map(i => {
  71. const checked =
  72. this.mattList.findIndex(itm => itm.id == i.id) > -1
  73. console.log(checked)
  74. return {
  75. checked,
  76. ...i
  77. }
  78. })
  79. )
  80. this.list = list
  81. return list
  82. }
  83. },
  84. methods: {
  85. scrolltolower() {},
  86. save() {
  87. this.$emit('mattSave', this.memoList, this.matterId)
  88. },
  89. //勾选
  90. selectVal(e, val, index) {
  91. this.list[index].checked = !this.list[index].checked
  92. const idx = this.memoList.findIndex(
  93. item => item.code === this.list[index].code
  94. )
  95. if (this.list[index].checked) {
  96. if (idx === -1) {
  97. this.memoList.push(this.list[index])
  98. }
  99. } else {
  100. if (idx > -1) {
  101. this.memoList.splice(idx, 1)
  102. }
  103. }
  104. },
  105. tableH(type) {
  106. return tableHeader(type)
  107. },
  108. handleClose() {
  109. this.$emit('close')
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .content-box {
  116. width: 80vw;
  117. height: 100vh;
  118. overflow: hidden;
  119. display: flex;
  120. flex-direction: column;
  121. background-color: $page-bg;
  122. }
  123. .list_box {
  124. flex: 1;
  125. overflow: hidden;
  126. padding: 4rpx 0;
  127. .u-list {
  128. height: 100% !important;
  129. }
  130. }
  131. .listBox {
  132. margin-top: 8rpx;
  133. padding: 8rpx 24rpx;
  134. background: #fff;
  135. /deep/ .uni-checkbox-input-checked {
  136. background-color: $theme-color !important;
  137. border-color: $theme-color !important;
  138. }
  139. .listBox-con {
  140. width: 650rpx;
  141. font-weight: 400;
  142. }
  143. .listBox-top {
  144. margin-top: 6rpx;
  145. color: #090A0A;
  146. font-size: 28rpx;
  147. font-style: normal;
  148. }
  149. .listBox-bottom {
  150. color: #090A0A;
  151. font-size: 24rpx;
  152. font-style: normal;
  153. flex-wrap: wrap;
  154. .item100 {
  155. width: 100%;
  156. margin-top: 8rpx;
  157. }
  158. .items {
  159. width: 50%;
  160. margin-top: 8rpx;
  161. }
  162. }
  163. }
  164. .operate_box {
  165. background-color: #fff;
  166. padding: 10rpx 100rpx;
  167. /deep/ .u-button {
  168. width: 160rpx;
  169. }
  170. }
  171. </style>