checkRent.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="check-rent">
  3. <view class="title">请指定负责查核的查核组</view>
  4. <view class="list">
  5. <view class="item"
  6. v-for="(item, index) in checkRent.list"
  7. :key="index"
  8. @click="openItemHandle(item.id)">
  9. <view class="img-wrap">
  10. <image :src="`../../static/list-${openItems.includes(item.id)
  11. ?'close':'open'}.png`"></image>
  12. </view>
  13. <view class="content">
  14. <view class="info">
  15. <view class="text">
  16. <view>{{item.name}}</view>
  17. <view>组长:{{item.groupManagerName}}</view>
  18. </view>
  19. <view class="icon" @click="checkedHandle($event, item)">
  20. <image :src="`../../static/check-${checkRent.checkedItem.id === item.id ? 'radio' : 'no'}.png`"></image>
  21. </view>
  22. </view>
  23. <view class="chidren" v-if="openItems.includes(item.id)">
  24. <view class="chid-item">
  25. <view>小组成员</view>
  26. <view>{{item.members.join('、')}}</view>
  27. </view>
  28. <view class="chid-item">
  29. <view>负责要点</view>
  30. <view>
  31. <text v-for="(point, c) in item.points" :key="c">
  32. {{point.name}};
  33. </text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import { mapState } from "vuex";
  44. import {_stopPropagation} from "../../../utils/compatible.js";
  45. import {arrFilter} from "../../../utils/arrFilter.js";
  46. export default {
  47. data() {
  48. return {
  49. openItems: []
  50. }
  51. },
  52. computed: {
  53. ...mapState({
  54. checkRent: state => state.creatingSituations.checkRent,
  55. condition: state => state.creatingSituations.condition,
  56. needReload: state => state.creatingSituations.needReload,
  57. })
  58. },
  59. created:function(){
  60. if(this.needReload) { // 点击上一步不用获取数据
  61. this.$store.dispatch({
  62. type: 'creatingSituations/commActions',
  63. key: 'checkGroupList',
  64. data: { conditionIds: this.condition.conditionIds}
  65. }).then((data)=> {
  66. if(data) this.myCommit('list', data);
  67. });
  68. }
  69. },
  70. methods: {
  71. openItemHandle: function(key) {
  72. this.openItems = arrFilter(key, this.openItems);
  73. },
  74. checkedHandle: function(e, item) {
  75. _stopPropagation(e);
  76. this.myCommit('checkedItem', item);
  77. },
  78. /**
  79. * 更新condition数据
  80. * @param {Object} key 要更新的属性
  81. * @param {Object} value 值
  82. */
  83. myCommit: function(key, value) {
  84. let data = {...this.checkRent};
  85. data[key] = value;
  86. this.$store.commit({
  87. type: 'creatingSituations/comChangeState',
  88. key: 'checkRent',
  89. data
  90. });
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="less">
  96. .check-rent {
  97. .list {
  98. .item {
  99. display: flex;
  100. flex-direction: row;
  101. justify-content: space-between;
  102. margin-bottom: 15rpx;
  103. padding: 25rpx;
  104. padding-right: 0;
  105. width: 100%;
  106. background-color: #fff;
  107. .img-wrap {
  108. width: 36.25rpx;
  109. image {
  110. width: 21.25rpx;
  111. height: 12.5rpx;
  112. }
  113. }
  114. .content {
  115. width: calc(100% - 36.25rpx);
  116. font-size: 20rpx;
  117. line-height: 30rpx;
  118. color: #666E80;
  119. .info {
  120. display: flex;
  121. flex-direction: row;
  122. justify-content: space-between;
  123. margin-top: -25rpx;
  124. .text {
  125. padding-top: 25rpx;
  126. view:first-child {
  127. margin-bottom: 25rpx;
  128. font-size: 25rpx;
  129. line-height: 37.5rpx;
  130. color: #292C33;
  131. }
  132. }
  133. .icon { // 图标样式,用view包裹img防止挤压变形
  134. padding-top: 25rpx;
  135. padding-left: 25rpx;
  136. width: 75rpx;
  137. height: inherit;
  138. image {
  139. width: 25rpx;
  140. height: 25rpx;
  141. }
  142. }
  143. }
  144. .chidren {
  145. margin-top: 25rpx;
  146. border-top: 1px solid #DADEE6;
  147. width: 100%;
  148. .chid-item {
  149. padding-top: 25rpx;
  150. padding-right: 25rpx;
  151. view {
  152. overflow: hidden;
  153. white-space: nowrap;
  154. text-overflow: ellipsis;
  155. &:first-child {
  156. padding-bottom: 15rpx;
  157. font-weight: bold;
  158. color: #292C33;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. </style>