dmCheckboxView.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <dm-pop-view ref='popView' title="更多筛选" :isShowConfirm='false'>
  3. <view class="screen_container" >
  4. <text class="screen_item_title">{{title}}</text>
  5. <view class="level_tag_view">
  6. <text class="level_tag" v-for="(item, i) in curOptions" :key="i" :style="{ color: item.isSelected ? '#fff' : '#666', 'background-color': item.isSelected ? themeColor : '#fff' }"
  7. @click="chooseTags(item, i)">
  8. {{item.name}}
  9. </text>
  10. </view>
  11. <view class="bottom_btn">
  12. <text class="reset_btn" :style="{'background-color':themeColor25}" @click="resetAction">重置</text>
  13. <text class="pop_btn" :style="{'background-color':themeColor}" @click="popConfirm">确定</text>
  14. </view>
  15. </view>
  16. </dm-pop-view>
  17. </template>
  18. <script>
  19. import dmPopView from './dmPopView.vue'
  20. export default {
  21. props: {
  22. options: Array,
  23. curItem: Array,
  24. items:Array,
  25. value: [String, Number],
  26. title:{
  27. type:String,
  28. default:'请选择'
  29. },
  30. },
  31. data() {
  32. return {
  33. oldSelectItem: [],
  34. selectItem: [],
  35. curOptions: [],
  36. selIdx: 0,
  37. themeColor:'',
  38. themeColor25:''
  39. }
  40. },
  41. watch:{
  42. items(newVal,oldVal){
  43. if(this.curOptions.length==0){
  44. this.curOptions = newVal;
  45. }
  46. },
  47. selectItem(newVal,oldVal){
  48. var tempOptions = [];
  49. for(let index in this.curOptions){
  50. var option = this.curOptions[index];
  51. const temp = newVal.findIndex(item=> option.id==item.dicDataId);
  52. option.isSelected = (temp != -1 ? true : false);
  53. tempOptions.push(option);
  54. }
  55. this.curOptions = tempOptions;
  56. }
  57. },
  58. mounted() {
  59. let globalData = getApp().globalData
  60. this.themeColor = globalData.themeColor
  61. this.themeColor25 = globalData.themeColor25
  62. },
  63. methods: {
  64. show() {
  65. this.$refs.popView.show()
  66. var oldItemTemp = JSON.stringify(this.curItem);
  67. var oldItem = JSON.parse(oldItemTemp);
  68. // console.log("XXXXXXXX", oldItemTemp, oldItem)
  69. this.selectItem = oldItem;
  70. this.oldSelectItem = oldItem;
  71. },
  72. popConfirm() { // 确定
  73. // console.log("确定",this.selectItem)
  74. this.$emit('confirm', {
  75. 'selItems': this.selectItem,
  76. })
  77. this.$refs.popView.hide()
  78. },
  79. resetAction(e) { // 重置
  80. var oldItemTemp = JSON.stringify(this.curItem);
  81. var oldItem = JSON.parse(oldItemTemp);
  82. this.selectItem = [];
  83. },
  84. chooseTags(subitem, idx){ // 选择
  85. this.seltag = idx;
  86. const temp = this.selectItem.findIndex(item=> subitem.id==item.dicDataId);
  87. if(temp!=-1){
  88. this.selectItem.splice(temp, 1)
  89. }else{
  90. this.selectItem.push({"dicDataId":subitem.id, "dicDataName":subitem.name});
  91. }
  92. }
  93. },
  94. components: {
  95. dmPopView
  96. }
  97. }
  98. </script>
  99. <style scoped lang="scss">
  100. .pop-pickerView {
  101. margin: 40rpx 0;
  102. width: 750rpx;
  103. height: 300rpx;
  104. .column-item {
  105. height: 80rpx;
  106. display: flex;
  107. box-sizing: border-box;
  108. white-space: nowrap;
  109. overflow: hidden;
  110. flex-direction: row;
  111. align-items: center;
  112. justify-content: center;
  113. }
  114. }
  115. .screen_container {
  116. display: flex;
  117. flex-direction: column;
  118. width: 750rpx;
  119. .screen_item_title {
  120. margin-left: 30rpx;
  121. margin-top: 54rpx;
  122. line-height: 44rpx;
  123. font-size: 32rpx;
  124. font-family: Verdana, Verdana-Bold;
  125. font-weight: 700;
  126. text-align: left;
  127. color: #454545;
  128. }
  129. .level_tag_view {
  130. margin-left: 30rpx;
  131. margin-top: 20rpx;
  132. margin-bottom: 100rpx;
  133. display: flex;
  134. flex-wrap: wrap;
  135. .level_tag {
  136. margin-bottom: 20rpx;
  137. padding: 0rpx 20rpx;
  138. margin-right: 30rpx;
  139. min-width: 116rpx;
  140. height: 56rpx;
  141. border-radius: 8rpx;
  142. font-size: 28rpx;
  143. font-family: Verdana, Verdana-Regular;
  144. font-weight: 400;
  145. text-align: center;
  146. line-height: 56rpx;
  147. }
  148. }
  149. .screen_item_sub {
  150. margin-top: 8rpx;
  151. margin-bottom: 40rpx;
  152. margin-left: 30rpx;
  153. line-height: 34rpx;
  154. font-size: 24rpx;
  155. font-family: Verdana, Verdana-Regular;
  156. font-weight: 400;
  157. text-align: left;
  158. color: #999999;
  159. }
  160. .score_view {
  161. margin-top: 30rpx;
  162. margin-bottom: 120rpx;
  163. display: flex;
  164. justify-content: center;
  165. align-items: center;
  166. height: 82rpx;
  167. .score_text {
  168. font-size: 70rpx;
  169. font-family: 'DIN Alternate', 'DIN Alternate-Bold';
  170. font-weight: 700;
  171. }
  172. .score_unit {
  173. padding-top: 25rpx;
  174. font-size: 28rpx;
  175. font-family: Verdana, Verdana-Regular;
  176. font-weight: 400;
  177. }
  178. }
  179. .bottom_btn {
  180. display: flex;
  181. justify-content: center;
  182. margin-bottom: 60rpx;
  183. .reset_btn {
  184. width: 156rpx;
  185. height: 80rpx;
  186. border-radius: 40rpx;
  187. font-size: 28rpx;
  188. font-family: Verdana, Verdana-Bold;
  189. font-weight: 700;
  190. text-align: center;
  191. line-height: 80rpx;
  192. color: #666666;
  193. }
  194. .pop_btn {
  195. margin-left: 30rpx;
  196. width: 444rpx;
  197. height: 80rpx;
  198. border-radius: 40rpx;
  199. font-size: 28rpx;
  200. font-family: Verdana, Verdana-Bold;
  201. font-weight: 700;
  202. text-align: center;
  203. line-height: 80rpx;
  204. color: #ffffff;
  205. }
  206. }
  207. }
  208. </style>