point.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="点位管理"></u-navbar>
  5. <view class="total">
  6. <view class="total-item">
  7. <view class="num">
  8. {{total.regionNum||'0'}}
  9. </view>
  10. <view class="name">
  11. 区域总数
  12. </view>
  13. </view>
  14. <view class="total-item">
  15. <view class="num">
  16. {{total.lineNum||'0'}}
  17. </view>
  18. <view class="name">
  19. 线路总数
  20. </view>
  21. </view>
  22. <view class="total-item">
  23. <view class="num">
  24. {{total.placeNum||'0'}}
  25. </view>
  26. <view class="name">
  27. 点位总数
  28. </view>
  29. </view>
  30. </view>
  31. <!-- <view class="search">
  32. <u-search animation placeholder="请输入区域/线路搜索" :showAction="false">
  33. </u-search>
  34. </view> -->
  35. <view class="content">
  36. <view class="xy-card" v-for="(item,index) in list" :key="item.mercRegionId">
  37. <view class="flex justify-between">
  38. <view class="eq-line-title">
  39. {{item.mergename}}
  40. </view>
  41. <xbutton size="mini" @click="addLine(item.name)">新增线路</xbutton>
  42. </view>
  43. <view v-if="item.lineList&&item.lineList.length>0">
  44. <block v-for="(item1,index1) in item.lineList" :key="item1.id">
  45. <view class="eq-wrap eq-item"
  46. @click="$tab.navigateTo(`/pages/point/lineDetail?id=${item1.id}&lineName=${item1.lineName}`)">
  47. <view class="eq-name flex justify-between">
  48. <view class="eq-title" v-if="item1.lineName">{{item1.lineName}}<text
  49. style="color: #666;">({{item1.id}})</text></view>
  50. <view class="eq-title" v-else>{{item1.lineName}}</view>
  51. </view>
  52. <view class="eqeq-type">
  53. <view>
  54. 线路管理员:
  55. </view>
  56. <view>
  57. {{item1.userInfoName||'/'}}
  58. </view>
  59. </view>
  60. <view class="arrow-right">
  61. <u-icon name="arrow-right" size="14"></u-icon>
  62. </view>
  63. </view>
  64. </block>
  65. </view>
  66. <view class="none" v-else>
  67. <u-empty text="当前区域没有线路" mode="search"></u-empty>
  68. </view>
  69. <!-- <view class="more" @click="$tab.navigateTo('/pages/equipment/search')">
  70. 查看全部
  71. </view> -->
  72. </view>
  73. <view class="empty" v-if="list.length==0">
  74. <u-empty></u-empty>
  75. </view>
  76. </view>
  77. <view class="btn safe-bottom">
  78. <xbutton size="large" @click="lotusAddressData.visible=true">新增区域</xbutton>
  79. </view>
  80. <!-- 级联地址 -->
  81. <lotus-address v-on:choseVal="addressConfirm" @close="addressClose" :lotusAddressData="lotusAddressData">
  82. </lotus-address>
  83. <!-- 弹框 -->
  84. <xpopup :show="popShow" @close="close" @confirm="submit" showBtn title="新增线路">
  85. <!-- 线路新增 -->
  86. <view class="popup-content">
  87. <view>线路名称:</view>
  88. <view>
  89. <u--input placeholder="请输入内容" border="surround" v-model="lineName"></u--input>
  90. </view>
  91. </view>
  92. </xpopup>
  93. </view>
  94. </template>
  95. <script>
  96. import {
  97. allLineWithRegion,
  98. areaSave
  99. } from "@/api/point/area.js"
  100. import {
  101. lineSave,
  102. } from "@/api/point/line"
  103. import lotusAddress from "./components/Winglau14-lotusAddress/Winglau14-lotusAddress.vue";
  104. export default {
  105. components: {
  106. lotusAddress
  107. },
  108. data() {
  109. return {
  110. list: [],
  111. total: {
  112. lineNum: 0,
  113. placeNum: 0,
  114. regionNum: 0,
  115. },
  116. lotusAddressData: {
  117. visible: false,
  118. provinceName: '',
  119. cityName: '',
  120. townName: '',
  121. },
  122. popShow: false,
  123. lineName: '',
  124. regionName: ''
  125. }
  126. },
  127. created() {
  128. // this.getTotalData()
  129. this.getList()
  130. },
  131. methods: {
  132. onshow() {
  133. this.getList()
  134. },
  135. search() {
  136. },
  137. getList() {
  138. allLineWithRegion({}).then(res => {
  139. this.list = res.data.data;
  140. this.total = {
  141. lineNum: res.data.lineNum,
  142. placeNum: res.data.placeNum,
  143. regionNum: res.data.regionNum,
  144. }
  145. })
  146. },
  147. //级联地址选择确认
  148. addressConfirm(res) {
  149. if (res.id === null) {
  150. this.$modal.msg('请选择区域!');
  151. return
  152. }
  153. this.addArea(res.id)
  154. this.addressClose() //关闭弹框
  155. },
  156. // 级联地址取消
  157. addressClose() {
  158. this.lotusAddressData.visible = false;
  159. },
  160. //新增区域
  161. addArea(id) {
  162. areaSave({
  163. ids: [id]
  164. }).then(res => {
  165. this.$modal.msg('新增成功~')
  166. this.getList()
  167. })
  168. },
  169. addLine(e) {
  170. this.regionName = e
  171. this.popShow = true
  172. },
  173. //弹框关闭
  174. close() {
  175. this.popShow = false
  176. },
  177. //弹框提交
  178. submit() {
  179. lineSave({
  180. regionName: this.regionName,
  181. lineName: this.lineName
  182. }).then(res => {
  183. this.$modal.msg('新增成功~')
  184. this.lineName = '';
  185. this.getList();
  186. })
  187. this.close()
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss">
  193. .container {
  194. .nav-style {
  195. font-size: 32rpx;
  196. font-weight: bold;
  197. color: #fff;
  198. }
  199. .search {
  200. padding: 24rpx 24rpx;
  201. background-color: #fff;
  202. }
  203. .total {
  204. display: flex;
  205. flex-flow: row nowrap;
  206. justify-content: space-around;
  207. align-items: center;
  208. text-align: center;
  209. color: #fff;
  210. background-color: #2C6FF3;
  211. padding: 40rpx 24rpx;
  212. .total-item {
  213. .num {
  214. font-weight: bold;
  215. font-size: 52rpx;
  216. }
  217. .name {
  218. font-size: 26rpx;
  219. }
  220. }
  221. }
  222. .content {
  223. padding: 24rpx;
  224. padding-bottom: calc(106rpx + env(safe-area-inset-bottom) / 2);
  225. .xy-card {
  226. margin-bottom: 24rpx;
  227. }
  228. .eq-line-title {
  229. font-size: 32rpx;
  230. padding-bottom: 24rpx;
  231. position: relative;
  232. }
  233. .eq-item {
  234. &+.eq-item {
  235. margin-top: 12rpx;
  236. }
  237. }
  238. .eq-wrap {
  239. border-radius: 8rpx;
  240. background-color: rgb(245, 248, 251);
  241. box-sizing: border-box;
  242. padding: 24rpx 12rpx;
  243. font-size: 26rpx;
  244. position: relative;
  245. .arrow-right {
  246. position: absolute;
  247. right: 12rpx;
  248. top: 24rpx;
  249. }
  250. .eq-name {
  251. font-size: 32rpx;
  252. font-weight: bold;
  253. margin-bottom: 24rpx;
  254. position: relative;
  255. >.eq-title {
  256. width: 420rpx;
  257. >text {
  258. font-size: 30rpx;
  259. color: #666;
  260. font-weight: normal;
  261. }
  262. }
  263. .eq-status-box {
  264. float: right;
  265. position: absolute;
  266. right: 0;
  267. top: 0;
  268. }
  269. .eq-status {
  270. font-size: 28rpx;
  271. color: #666;
  272. font-weight: normal;
  273. margin-left: 12rpx;
  274. >text {
  275. display: inline-block;
  276. background-color: #666;
  277. width: 16rpx;
  278. height: 16rpx;
  279. border-radius: 16rpx;
  280. margin-right: 12rpx;
  281. }
  282. &.online {
  283. color: #f56c6c;
  284. >text {
  285. background-color: green;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. .eqeq-type {
  292. display: flex;
  293. flex-direction: row;
  294. align-items: center;
  295. font-size: 28rpx;
  296. >view:nth-child(1) {
  297. color: #000;
  298. width: 200rpx;
  299. }
  300. >view:nth-child(2) {
  301. color: #666;
  302. padding-left: 6rpx;
  303. }
  304. }
  305. .eqeq-type+.eqeq-type {
  306. margin-top: 16rpx;
  307. }
  308. .status {
  309. width: 130rpx;
  310. height: 120rpx;
  311. box-sizing: border-box;
  312. border-radius: 120rpx;
  313. // border: 6rpx solid #2C6FF3;
  314. text-align: center;
  315. display: flex;
  316. flex-flow: column;
  317. justify-content: space-around;
  318. align-items: center;
  319. position: absolute;
  320. right: 12rpx;
  321. bottom: 24rpx;
  322. .s-name {
  323. font-size: 28rpx;
  324. padding-top: 20rpx;
  325. font-weight: bold;
  326. }
  327. .s-num {
  328. font-size: 32rpx;
  329. padding-bottom: 20rpx;
  330. }
  331. }
  332. }
  333. .empty {
  334. margin: 40% auto 0;
  335. }
  336. .btn {
  337. width: 100%;
  338. position: fixed;
  339. left: 0;
  340. bottom: 24rpx;
  341. padding: 0 24rpx;
  342. }
  343. .popup-content {
  344. padding: 36rpx 24rpx;
  345. display: flex;
  346. flex-flow: row nowrap;
  347. justify-content: flex-start;
  348. align-items: center;
  349. >view:nth-child(1){
  350. width:150rpx;
  351. }
  352. >view:nth-child(2){
  353. width: 600rpx;
  354. }
  355. }
  356. }
  357. </style>