list.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view>
  3. <!-- 第一种样式 人员管理-->
  4. <block v-if="datainfo.length>0">
  5. <!-- 人员管理 -->
  6. <block v-if="type=='people'">
  7. <view class="carlist" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail">
  8. <view class="ctop flexc">
  9. <image :src="hicoa" class="imgs" v-if="ite.type==1"></image>
  10. <image :src="hicob" class="imgs" v-if="ite.type==2"></image>
  11. <view class="tit">一号楼3单元1101</view>
  12. <view class="flex1"></view>
  13. <view class="txt ca" v-if="ite.type==1">业主</view>
  14. <view class="txt cb" v-if="ite.type==2">租户</view>
  15. </view>
  16. <view class="plists">
  17. <view class="plist">
  18. <image :src="man" class="head" v-if="ite.sex==0"></image>
  19. <image :src="woman" class="head" v-else></image>
  20. <view class="flex1">
  21. <view class="ptit">张伟<view class="btn btnc ml10" v-if="ite.hzflag">户主</view></view>
  22. <view class="ptxt">身份证号 | 41072719880603022X</view>
  23. <view class="flexc">
  24. <view class="ptxt">性别 | {{ite.sex==0?'男':'女'}}</view>
  25. <view class="ptxt">年龄 | 36岁</view>
  26. </view>
  27. <view class="flexc">
  28. <view class="ptxt">身高 | 165cm</view>
  29. <view class="ptxt">体重 | 67kg</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="plist" v-if="ite.zhanflag">
  34. <image :src="man" class="head" v-if="ite.sex==0"></image>
  35. <image :src="woman" class="head" v-else></image>
  36. <view class="flex1">
  37. <view class="ptit">张伟<view class="btn btnc ml10" v-if="ite.hzflag">户主</view></view>
  38. <view class="ptxt">身份证号 | 41072719880603022X</view>
  39. <view class="flexc">
  40. <view class="ptxt">性别 | {{ite.sex==0?'男':'女'}}</view>
  41. <view class="ptxt">年龄 | 36岁</view>
  42. </view>
  43. <view class="flexc">
  44. <view class="ptxt">身高 | 165cm</view>
  45. <view class="ptxt">体重 | 67kg</view>
  46. </view>
  47. </view>
  48. </view>
  49. <image :src="upimg" :class="ite.zhanflag?'act':''" class="upimg" @click="getZhan(idx)"></image>
  50. </view>
  51. </view>
  52. </block>
  53. <view class="shax">{{wtdt}}</view>
  54. </block>
  55. <!-- 无数据 -->
  56. <view class="nodata" v-else>
  57. <image :src="noiconpimg"></image>
  58. <view>
  59. 暂无数据
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  66. import config from '@/config'
  67. export default{
  68. props:{
  69. datainfo: {
  70. type: Array,
  71. default () {
  72. return []
  73. }
  74. },
  75. wtdt:{
  76. type:String,
  77. default () {
  78. return ''
  79. }
  80. },
  81. type:{
  82. type:String,
  83. default () {
  84. return 0
  85. }
  86. },
  87. topval:{
  88. type:String,
  89. default () {
  90. return ''
  91. }
  92. }
  93. },
  94. data(){
  95. return{
  96. noiconpimg:require("@/static/nodata.png"),
  97. hicoa:require("@/health/static/health/hicoa.png"),
  98. hicob:require("@/health/static/health/hicob.png"),
  99. man:require("@/people/static/people/man.png"),
  100. woman:require("@/people/static/people/woman.png"),
  101. upimg:require("@/static/images/home/up.png"),
  102. baseUrl:config.baseUrl,
  103. delBtnWidth:66,//左滑默认宽度
  104. }
  105. },
  106. mounted() {
  107. },
  108. methods:{
  109. checkPermi, checkRole,
  110. getDetail(e){
  111. this.$emit('getDetail',e)
  112. },
  113. getAddFn(e){
  114. this.$emit('getAddFn',e)
  115. },
  116. getReadlist(e){
  117. this.$emit('getReadlist',e)
  118. },
  119. getZhan(idx){
  120. // var obj=JSON.parse(JSON.stringify(this.datainfo))[idx]
  121. // obj.zhanflag=!obj.zhanflag;
  122. // this.datainfo.splice(idx,1,obj);
  123. this.datainfo[idx].zhanflag=!this.datainfo[idx].zhanflag
  124. },
  125. getPreview(idx,arr) {
  126. var newArr=[];
  127. arr.forEach(ite=>{
  128. var ds=this.baseUrl+ite
  129. newArr.push(ds)
  130. })
  131. uni.previewImage({
  132. urls: newArr,
  133. current:idx,
  134. success: function(data) {},
  135. fail: function(err) {}
  136. });
  137. },
  138. //开始触摸滑动
  139. drawStart(e) {
  140. // console.log("开始触发");
  141. var touch = e.touches[0];
  142. this.startX = touch.clientX;
  143. },
  144. //触摸滑动
  145. drawMove(e) {
  146. // console.log("滑动");
  147. for (var index in this.datainfo) {
  148. // this.csListArrl[index].right=0
  149. this.$set(this.datainfo[index],'right',0);
  150. }
  151. var idx=e.currentTarget.dataset.idx
  152. var touch = e.touches[0];
  153. var item = this.datainfo[idx];
  154. var disX = this.startX - touch.clientX;
  155. if (disX >= 20) {
  156. if (disX > this.delBtnWidth) {
  157. disX = this.delBtnWidth;
  158. }
  159. // this.csListArrl[idx].right=disX
  160. this.$set(this.datainfo[idx],'right',disX);
  161. } else {
  162. // this.csListArrl[idx].right=0
  163. this.$set(this.datainfo[idx],'right',0);
  164. }
  165. },
  166. //触摸滑动结束
  167. drawEnd(e) {
  168. // console.log("滑动结束");
  169. var idx=e.currentTarget.dataset.idx
  170. var item = this.datainfo[idx];
  171. if (item.right >= this.delBtnWidth / 2) {
  172. // this.datainfo[idx].right=this.delBtnWidth
  173. this.$set(this.datainfo[idx],'right',this.delBtnWidth);
  174. } else {
  175. this.datainfo[idx].right=0
  176. }
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. .flex{display: flex;}
  183. .flexc{display: flex;align-items: center;}
  184. .mb10{margin-bottom: 20rpx;}
  185. .carlist{background: #FFFFFF;border-radius: 20rpx;margin-bottom: 24rpx;
  186. .ctop{border-bottom: 2rpx solid #E5E5E5;padding: 24rpx 24rpx 22rpx;
  187. .imgs{width: 40rpx;height: 42rpx;margin-right: 32rpx;}
  188. .tit{font-size: 30rpx;color: #272727;font-weight: bold;margin-right: 20rpx;}
  189. .txt{font-weight: 500;font-size: 26rpx;
  190. &.ca{color: #3565ED;}
  191. &.cb{color: #FE5A0E;}
  192. &.cc{color: #28C529;}
  193. }
  194. .txta{font-weight: 500;font-size: 24rpx;color: #AAAAAA;}
  195. .num{font-size: 24rpx;color: #AAAAAA;}
  196. }
  197. .plists{padding: 30rpx 24rpx 6rpx;
  198. .plist{background: linear-gradient(-90deg, #F2F5FF 0%, #FBFDFF 100%);border-radius: 20rpx;border: 2rpx solid #E6E6E6;margin-bottom: 24rpx;padding: 18rpx 26rpx 4rpx;display: flex;
  199. .head{width: 96rpx;height: 98rpx;margin-right: 32rpx;flex: 0 0 auto;margin-top: 36rpx;}
  200. .ptit{font-weight: bold;font-size: 30rpx;color: #272727;display: flex;align-items: center;margin-bottom: 14rpx;}
  201. .ptxt{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;margin-bottom: 14rpx;min-width: 176rpx;}
  202. }
  203. }
  204. .upimg{width: 26rpx;height: 22rpx;display: block;transform: rotate(180deg);transition: all 0.3s;margin: 0 auto 18rpx;
  205. &.act{transform: rotate(0deg);}
  206. }
  207. .btn{height: 34rpx;border-radius: 18rpx;display: flex;align-items: center;justify-content: center;padding: 0 10rpx;font-size: 22rpx;margin-right: 24rpx;
  208. &.btna{border: 2rpx solid #06C770;color: #06C770;}
  209. &.btnb{border: 2rpx solid #3565ED;color: #3565ED;}
  210. &.btnc{border: 2rpx solid #FE5A0E;color: #FE5A0E;}
  211. &.btnbga{border: 1px solid #0156FE;color: #3565ED;background: #DFEAFF;height: 36rpx;}
  212. &.btnbgb{border: 1px solid #C1C1C1;color: #666666;background: #F1F1F1;height: 36rpx;}
  213. &.btnbgc{border: 1px solid #FE5A0E;color:#FE5A0E;background:#FFEEE6;height: 36rpx;}
  214. }
  215. }
  216. // 无数据
  217. .nodata{display: flex;flex-direction: column;align-items: center;
  218. image{width: 440rpx;height: 440rpx;}
  219. view{font-size: 30rpx;color: #666666;font-weight: bold;}
  220. }
  221. </style>