AppPopup.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <u-popup
  3. :show="layerVisible"
  4. :safeAreaInsetBottom="true"
  5. @close="layerClose"
  6. :round="8"
  7. @open="layerOpen"
  8. >
  9. <view class="layer-popup">
  10. <view class="layer-popup__header" @click="layerClose">
  11. <u-icon
  12. name="arrow-down"
  13. size="36rpx"
  14. color="#4e6961"
  15. class="layer-popup__close"
  16. ></u-icon>
  17. </view>
  18. <view class="layer-popup__content">
  19. <u-row :gutter="12">
  20. <u-col :span="3" v-for="item in appList" :key="item.menuId">
  21. <view class="app-card" @click="toNativePage(item)">
  22. <image
  23. mode="aspectFit"
  24. :src="getDeviceTypeIcon(item)"
  25. class="app-card__img"
  26. />
  27. <view class="app-card__text">{{ item.menuName || '' }}</view>
  28. </view>
  29. </u-col>
  30. </u-row>
  31. <view
  32. @click="handleSetting"
  33. v-if="!appList.length"
  34. class="layer-popup__empty"
  35. ><text>暂无应用,请先去</text><text class="primary">设置</text></view
  36. >
  37. </view>
  38. <view class="layer-popup__placeholder"></view>
  39. </view>
  40. </u-popup>
  41. </template>
  42. <script>
  43. // 玉米大斑病
  44. import cornLeafBlight from '../../assets/cornLeafBlight.png';
  45. // 水肥
  46. import facilitystatenew from '../../assets/facilitystatenew.png';
  47. // 高空测报灯
  48. import highInsectLamp from '../../assets/highInsectLamp.png';
  49. // 中捷四方性诱
  50. import inducer from '../../assets/inducer.png';
  51. // 性诱2
  52. import inducer2 from '../../assets/inducer2.png';
  53. // 性诱3
  54. import inducer3 from '../../assets/inducer3.png';
  55. // 杀虫灯
  56. import insecticidalLamp from '../../assets/insecticidalLamp.png';
  57. // 虫情测报灯
  58. import insectLamp from '../../assets/insectLamp.png';
  59. // 虫情信息采集VI
  60. import insectLampvi from '../../assets/insectLampvi.png';
  61. // 墒情站
  62. import moisture from '../../assets/moisture.png';
  63. // 管式墒情站
  64. import moisturegssq from '../../assets/moisturegssq.png';
  65. // 管式墒情站1
  66. import moisturegssq1 from '../../assets/moisturegssq1.png';
  67. // 监控
  68. import monitor from '../../assets/monitor.png';
  69. // 水稻稻瘟病
  70. import riceBlast from '../../assets/riceBlast.png';
  71. // 水稻测报灯
  72. import riceInsectLamp from '../../assets/riceInsectLamp.png';
  73. // 孢子仪
  74. import sporograph from '../../assets/sporograph.png';
  75. // 风吸式杀虫灯
  76. import suctionKillinglamp from '../../assets/suctionKillinglamp.png';
  77. // 景观式杀虫灯
  78. import suctionKillinglampJg from '../../assets/suctionKillinglampJg.png';
  79. // 吸虫塔
  80. import trematodeTower from '../../assets/trematodeTower.png';
  81. // 气象站
  82. import weatherStation from '../../assets/weatherStation.png';
  83. // 小麦赤霉病
  84. import wheatScab from '../../assets/wheatScab.png';
  85. // 水位计
  86. import waterMeasure from '../../assets/water-measure.png';
  87. // 大闸门
  88. import waterGate from '../../assets/water-gate.png';
  89. // 农事作业
  90. import fms from '../../assets/fms.png';
  91. // 采收作业
  92. import harvestingoperation from '../../assets/harvestingoperation.png';
  93. // 智能孢子仪1.0
  94. import sporographnew from '../../assets/sporographnew.png';
  95. // 基地图标
  96. import landIcon from '../../assets/landIcon.png';
  97. // 地块列表图标
  98. import blockIcon from '../../assets/blockIcon.png';
  99. // 气象预警
  100. import weatherWarning from '../../assets/weatherWarning.png';
  101. import weatherMenuIcon from '../../assets/weather.png';
  102. // 农技服务
  103. import atsIcon from '../../assets/ats.png';
  104. // 巡检管护
  105. import inspectionManage from '../../assets/inspectionManage.png';
  106. export default {
  107. name: 'DevicePopup',
  108. components: {},
  109. props: {
  110. visible: {
  111. type: Boolean,
  112. default: false
  113. },
  114. dataSource: {
  115. type: Object,
  116. default: () => ({})
  117. }
  118. },
  119. data() {
  120. return {
  121. layerVisible: false,
  122. appList: []
  123. };
  124. },
  125. watch: {
  126. visible(newVal) {
  127. if (newVal !== this.layerVisible) {
  128. this.layerVisible = newVal;
  129. if (newVal) {
  130. this.initData();
  131. }
  132. }
  133. }
  134. },
  135. methods: {
  136. initData() {
  137. },
  138. layerClose() {
  139. this.$emit('update:visible', false);
  140. this.$emit('close');
  141. },
  142. layerOpen() {
  143. this.$emit('layerOpen');
  144. },
  145. handleSetting() {
  146. this.layerClose();
  147. uni.setStorageSync('serverType', 'setting');
  148. uni.switchTab({
  149. url: '/pages/iotm/server'
  150. });
  151. },
  152. toNativePage(item) {
  153. console.log(item, 'item');
  154. const menuRemark = JSON.parse(item?.menuRemark || "{}");
  155. const typeCode = menuRemark?.typeCode || '';
  156. if(typeCode === 'pis'){
  157. uni.setStorageSync('serverType', 'pis');
  158. uni.switchTab({
  159. url: '/pages/iotm/server'
  160. });
  161. return
  162. }
  163. uni.navigateTo({
  164. url:
  165. `${item.menuPath}?menuId=${item.menuOrginPid}&currentMenuId=${item.menuOrginid}&title=${item.menuOrginPname}` ||
  166. ''
  167. });
  168. },
  169. getDeviceTypeIcon(row) {
  170. console.log(row, 'row');
  171. const menuRemark = row?.menuRemark && JSON.parse(row?.menuRemark || '');
  172. let typeCodeArr = menuRemark?.typeCode || '';
  173. const typeCode = typeCodeArr.split(',')[0];
  174. const iconMap = {
  175. HS_YBQ_DBB00001: cornLeafBlight,
  176. SF00001: facilitystatenew,
  177. SF00002: facilitystatenew,
  178. CQCBD00003: highInsectLamp,
  179. XYCB00005: inducer,
  180. XYCB00004: inducer2,
  181. XYCB00003: inducer3,
  182. SCD00001: insecticidalLamp,
  183. CQCBD00001: insectLamp,
  184. CQCBD00005: insectLamp,
  185. CQCBD00006: insectLampvi,
  186. SQZ00001: moisture,
  187. SQZ00002: moisture,
  188. SQZ00003: moisturegssq,
  189. SQZ00004: moisturegssq1,
  190. JK00001: monitor,
  191. JK00002: monitor,
  192. HS_YBQ_DWB00001: riceBlast,
  193. CQCBD00002: riceInsectLamp,
  194. BZY00001: sporograph,
  195. BZY00002: sporographnew,
  196. SCD00002: suctionKillinglamp,
  197. SCD00003: suctionKillinglampJg,
  198. CQCBD00004: trematodeTower,
  199. QXZ00001: weatherStation,
  200. QXZ00002: weatherStation,
  201. HS_YBQ_CMB00001: wheatScab,
  202. HS_YBQ_TXB00001: wheatScab,
  203. SWJ00001: waterMeasure,
  204. SZ00001: waterGate,
  205. SZ00002: waterGate,
  206. SZ00003: waterGate,
  207. FM00001: fms,
  208. CS00001: harvestingoperation,
  209. land00001: landIcon,
  210. block00001: blockIcon,
  211. QX00001: weatherWarning,
  212. QX00002: weatherMenuIcon,
  213. ATS00001: atsIcon,
  214. pis: inspectionManage
  215. };
  216. return iconMap[typeCode] || '';
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. .layer-popup {
  223. background-color: #fff;
  224. &__header {
  225. position: relative;
  226. width: 180rpx;
  227. height: 60rpx;
  228. display: flex;
  229. align-items: center;
  230. justify-content: center;
  231. margin: 0 auto;
  232. margin-top: -60rpx;
  233. background-color: #fff;
  234. border-radius: 16rpx 16rpx 0 0;
  235. }
  236. &__close {
  237. }
  238. &__content {
  239. padding: 32rpx;
  240. background-color: #fff;
  241. }
  242. &__placeholder {
  243. height: var(--window-bottom);
  244. }
  245. &__empty {
  246. display: flex;
  247. align-items: center;
  248. justify-content: center;
  249. text-align: center;
  250. font-size: 32rpx;
  251. padding: 32rpx;
  252. color: #9ba6a3;
  253. .primary {
  254. color: #14a478;
  255. }
  256. }
  257. }
  258. .app-card {
  259. text-align: center;
  260. &__img {
  261. width: 112rpx;
  262. height: 112rpx;
  263. margin: 0 auto;
  264. border-radius: 16rpx;
  265. margin-bottom: 16rpx;
  266. }
  267. &__text {
  268. font-size: 28rpx;
  269. color: #042118;
  270. text-align: center;
  271. }
  272. }
  273. </style>