index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view v-if="showProduct" class="popupbox" @tap.stop="closePopup" >
  3. <view class="popup_warp">
  4. <view class="popup_title">选择设备</view>
  5. <scroll-view scroll-y class="scrollbox" @tap.stop.prevent>
  6. <view class="pop_list">
  7. <view class="pop_li" v-for="(item,index) in list" :key="index">
  8. <view class="pop_info" @tap.stop="changeSelect(index)">
  9. <view class="pop_radio">
  10. <radio color='#ff7800' :checked="item.select" ></radio>
  11. </view>
  12. <view class="pop_info_right">
  13. <view class="pop_info_cen">
  14. <view class="pop_info_text">设备名称:{{item.name}}</view>
  15. <view class="pop_info_text">所属系统:{{item.cate_id_text}}</view>
  16. <view class="pop_info_text">安装时间:{{item.w_time_text}}</view>
  17. <view class="pop_info_text">安装位置:{{item.address}}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view v-if="list.length == 0 || !list" class="noData">{{i18n['暂无更多']}}</view>
  23. </view>
  24. </scroll-view>
  25. <view class="popup_bottom" @tap.stop.prevent>
  26. <view class="pp_left">
  27. <radio color="#ff7800" :checked="isAll" @click="selectAll"></radio>{{i18n['全选']}}
  28. </view>
  29. <view class="pp_right">
  30. <view class="right_btn remove" @click="closePopup">{{i18n['取消']}}</view>
  31. <view class="right_btn sure" @click="sureSelectData">{{i18n['确定']}}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { netWorkOrderProduct } from '@/api/api.js'
  39. export default{
  40. props:{
  41. showProduct:{
  42. type:Boolean,
  43. default:false
  44. }
  45. },
  46. data(){
  47. return{
  48. name:'',
  49. list:[],
  50. isAll:false,
  51. }
  52. },
  53. computed:{
  54. i18n() {
  55. return this.$t("server")
  56. }
  57. },
  58. methods:{
  59. init(id,status) {
  60. this.list = []
  61. this.getProductList()
  62. },
  63. getProductList() {
  64. netWorkOrderProduct().then(res=>{
  65. if(res.data) {
  66. this.list = res.data
  67. this.handleData()
  68. }else{
  69. uni.showToast({
  70. title:res.msg,
  71. icon:'none',
  72. duration:3000
  73. })
  74. }
  75. })
  76. },
  77. handleData() {
  78. let arr = this.list
  79. arr.forEach(ele=>{
  80. ele.select = false
  81. })
  82. this.list = arr
  83. },
  84. changeNumber(e,index) {
  85. let obj = this.list[index]
  86. if(e.detail > 1){
  87. obj.select = true
  88. }
  89. obj.number = e.detail
  90. this.$set(this.list,index,obj)
  91. },
  92. //选择
  93. changeSelect(index) {
  94. console.log(index,'选择')
  95. let obj = this.list[index]
  96. obj.select = !obj.select
  97. this.$set(this.list,index,obj)
  98. },
  99. //全选
  100. selectAll() {
  101. this.isAll = !this.isAll
  102. let arr = this.list
  103. if(this.isAll){
  104. arr.forEach(ele=>{
  105. ele.select = true
  106. })
  107. }else{
  108. arr.forEach(ele=>{
  109. ele.select = false
  110. })
  111. }
  112. this.list = arr
  113. },
  114. closePopup() {
  115. this.$emit('close')
  116. },
  117. //确定
  118. sureSelectData() {
  119. let arr = this.list
  120. let newarr = []
  121. arr.forEach(ele=>{
  122. if(ele.select){
  123. newarr.push(ele)
  124. }
  125. })
  126. this.$emit('selectList',newarr)
  127. }
  128. }
  129. }
  130. </script>
  131. <style>
  132. </style>
  133. <style lang="scss" scoped>
  134. .conright{
  135. display: flex;
  136. justify-content: flex-end;
  137. align-items: center;
  138. .conAdd, .reduce{
  139. width:40rpx;
  140. height:40rpx;
  141. border-radius: 8rpx;
  142. background:#f5f5f5;
  143. font-size:34rpx;
  144. text-align: center;
  145. line-height: 40rpx;
  146. }
  147. .numberinput{
  148. width:60rpx;
  149. height:40rpx;
  150. border-radius: 8rpx;
  151. background:#f5f5f5;
  152. font-size:34rpx;
  153. text-align: center;
  154. line-height: 40rpx;
  155. margin:0 10rpx;
  156. }
  157. }
  158. .popupbox{
  159. position: fixed;
  160. left:0;
  161. top:0;
  162. bottom:0;
  163. right:0;
  164. background:rgba(0,0,0,0.5);
  165. z-index: 9;
  166. .popup_warp{
  167. width:750rpx;
  168. background:#fff;
  169. position: absolute;
  170. left:0;
  171. bottom:0;
  172. z-index: 10;
  173. }
  174. .popup_title{
  175. text-align: center;
  176. font-size:34rpx;
  177. color:#333;
  178. padding:24rpx;
  179. }
  180. .searbox{
  181. padding:0 24rpx;
  182. }
  183. .scrollbox{
  184. width:100%;
  185. height:700rpx;
  186. .pop_list{
  187. padding:24rpx;
  188. .pop_li{
  189. background:#f5f5f5;
  190. border-radius: 8rpx;
  191. margin-bottom:24rpx;
  192. .pop_title{
  193. font-size:32rpx;
  194. color:#333;
  195. padding:24rpx;
  196. border-bottom:1rpx solid #d0d0d0;
  197. margin-bottom:24rpx;
  198. }
  199. .pop_info{
  200. display: flex;
  201. justify-content: flex-start;
  202. align-items: center;
  203. padding:24rpx;
  204. .pop_radio{
  205. margin-right:24rpx;
  206. radio{
  207. transform: scale(0.7);
  208. }
  209. }
  210. .pop_info_right{
  211. display: flex;
  212. justify-content: flex-start;
  213. .infoimg{
  214. width:90rpx;
  215. height:90rpx;
  216. margin-right:24rpx;
  217. flex-shrink: 0;
  218. }
  219. .pop_info_cen{
  220. .pop_info_text{
  221. font-size:26rpx;
  222. color:#666;
  223. margin-bottom:15rpx;
  224. }
  225. }
  226. }
  227. }
  228. .pop_bottom{
  229. padding:0 24rpx 24rpx;
  230. display: flex;
  231. justify-content: flex-end;
  232. .conright{
  233. .conAdd, .reduce, .numberinput{
  234. background:#fff;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. .popup_bottom{
  242. width:100%;
  243. padding:0 24rpx;
  244. height:100rpx;
  245. border-top:1rpx solid #f5f5f5;
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. .pp_left{
  250. display: flex;
  251. justify-content: flex-start;
  252. align-items: center;
  253. font-size:26rpx;
  254. color:3333;
  255. radio{
  256. transform: scale(0.7);
  257. }
  258. }
  259. .pp_right{
  260. display: flex;
  261. justify-content: flex-end;
  262. align-items: center;
  263. .right_btn{
  264. height:80rpx;
  265. font-size:26rpx;
  266. text-align: center;
  267. border-radius: 10rpx;
  268. }
  269. .remove{
  270. width:140rpx;
  271. border:1rpx solid #f5f5f5;
  272. color:#333;
  273. line-height: 78rpx;
  274. margin-right:24rpx;
  275. }
  276. .sure{
  277. width:200rpx;
  278. background:#14C2C1;
  279. color:#fff;
  280. line-height: 80rpx;
  281. }
  282. }
  283. }
  284. }
  285. </style>