facilitiesDetails.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <scroll-view class="scroll-height" :scroll-y="true" :data-theme="'theme-' + proxy.$settingStore.themeColor.name">
  3. <view class="facilitiesDetails-container">
  4. <view class="flex bg-white p15 mb15">
  5. <image style="width: 40px; height: 40px; margin: auto 15px auto 0" :src="dataArray.imagesUrl ? dataArray.imagesUrl : '/static/images/404.png'" mode="aspectFill"></image>
  6. <view style="margin: auto auto auto 0">
  7. <view style="font-size: 15px"> {{ dataArray.facilityName }} </view>
  8. </view>
  9. <view style="margin: auto 0 auto 0">
  10. <!-- {{ siteList.siteStatus == null }} -->
  11. <view style="font-size: 15px; color: #30bb00" :style="{ color: dataArray.status == 0 ? '#30bb00' : dataArray.status == 1 ? '#FF6000' : '#797979' }">
  12. {{ dataArray.status == 0 ? "正常" : dataArray.status == 1 ? "维修" : "关闭" }}
  13. </view>
  14. <!-- #f07d28 -->
  15. </view>
  16. </view>
  17. <view class="bg-white p15 mb15">
  18. <uni-section class="block mb10" title="基本信息" type="line"></uni-section>
  19. <view class="tableType3 p0">
  20. <u-empty v-if="dataList.length <= 0" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
  21. <u-row v-for="po in dataList" :key="po">
  22. <u-col span="4">
  23. <view style="text-align: right; padding: 0px 5px 0px 5px">{{ po.title }}</view>
  24. </u-col>
  25. <u-col span="8">
  26. <view style="text-align: left; padding: 0px 5px 0px 5px">{{ po.value }}</view>
  27. </u-col>
  28. </u-row>
  29. </view>
  30. </view>
  31. <view class="bg-white p15 mb15">
  32. <uni-section class="block mb10" title="关联设备" type="line"></uni-section>
  33. <view class="flex mb10" style="height: 35px; line-height: 35px">
  34. <u-input v-model="deviceId" placeholder="设备编号" @change="deviceInfoApi()" disabledColor="transparent" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" clearable />
  35. </view>
  36. <view class="tableType1">
  37. <u-row>
  38. <u-col span="1.5">
  39. <view>序号</view>
  40. </u-col>
  41. <u-col span="3">
  42. <view>设备编号</view>
  43. </u-col>
  44. <u-col span="3">
  45. <view>设备名称</view>
  46. </u-col>
  47. <u-col span="4.5">
  48. <view>设备地址</view>
  49. </u-col>
  50. </u-row>
  51. <u-row v-for="(co, index) in dataList1" :key="index">
  52. <u-col span="1.5">
  53. <view>{{ index + 1 }}</view>
  54. </u-col>
  55. <u-col span="3">
  56. <view>{{ co.deviceId }}</view>
  57. </u-col>
  58. <u-col span="3">
  59. <view>{{ co.deviceName }}</view>
  60. </u-col>
  61. <u-col span="4.5">
  62. <view>{{ co.installAddress }}</view>
  63. </u-col>
  64. </u-row>
  65. </view>
  66. </view>
  67. <view class="bg-white p15 mb15">
  68. <uni-section class="block mb10" title="关联建筑" type="line"></uni-section>
  69. <view class="flex mb10" style="height: 35px; line-height: 35px">
  70. <u-input v-model="buildNum" placeholder="建筑编号" @change="buildInfoApi()" disabledColor="transparent" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" clearable />
  71. </view>
  72. <view class="tableType1">
  73. <u-row>
  74. <u-col span="1.5">
  75. <view>序号</view>
  76. </u-col>
  77. <u-col span="3">
  78. <view>建筑编号</view>
  79. </u-col>
  80. <u-col span="3">
  81. <view>建筑名称</view>
  82. </u-col>
  83. <u-col span="4.5">
  84. <view>建筑地址</view>
  85. </u-col>
  86. </u-row>
  87. <u-row v-for="(co, index) in dataList2" :key="index">
  88. <u-col span="1.5">
  89. <view>{{ index + 1 }}</view>
  90. </u-col>
  91. <u-col span="3">
  92. <view>{{ co.buildNum }}</view>
  93. </u-col>
  94. <u-col span="3">
  95. <view>{{ co.buildName }}</view>
  96. </u-col>
  97. <u-col span="4.5">
  98. <view>{{ co.address }}</view>
  99. </u-col>
  100. </u-row>
  101. </view>
  102. </view>
  103. </view>
  104. </scroll-view>
  105. </template>
  106. <script setup>
  107. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  108. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  109. import { useStores, commonStores } from "@/store/modules/index";
  110. import { facilityInfo, deviceInfo, buildInfo } from "@/api/business/fireIot/facilitiesManage.js";
  111. const { proxy } = getCurrentInstance();
  112. const id = ref(undefined);
  113. const deviceId = ref(undefined);
  114. const buildNum = ref(undefined);
  115. const dataArray = ref({});
  116. const dataList = ref([
  117. { title: "设施类型", value: "" },
  118. { title: "设施编号", value: "" },
  119. { title: "设施位置", value: "" },
  120. { title: "创建时间", value: "" },
  121. ]);
  122. const dataList1 = ref([]);
  123. const dataList2 = ref([]);
  124. /**
  125. * @页面初始化
  126. */
  127. function init() {
  128. facilityInfo({ id: id.value }).then((requset) => {
  129. if (requset.status === "SUCCESS") {
  130. dataArray.value = requset.data[0];
  131. dataList.value[1].value = requset.data[0].facilityNum ? requset.data[0].facilityNum : "无";
  132. dataList.value[2].value = requset.data[0].address ? requset.data[0].address : "无";
  133. dataList.value[3].value = requset.data[0].createTime ? requset.data[0].createTime.replace("T", " ") : requset.data[0].createTime;
  134. }
  135. });
  136. deviceInfoApi();
  137. buildInfoApi();
  138. }
  139. /**
  140. * @设施详情关联设备接口请求
  141. * @api接口请求
  142. */
  143. function deviceInfoApi() {
  144. deviceInfo({ id: id.value, deviceId: deviceId.value, current: 1, size: 1000 }).then((requset) => {
  145. if (requset.status === "SUCCESS") {
  146. dataList1.value = requset.data.records;
  147. }
  148. });
  149. }
  150. /**
  151. * @设施详情关联建筑接口请求
  152. * @api接口请求
  153. */
  154. function buildInfoApi() {
  155. buildInfo({ id: id.value, buildNum: buildNum.value, current: 1, size: 1000 }).then((requset) => {
  156. if (requset.status === "SUCCESS") {
  157. dataList2.value = requset.data.records;
  158. }
  159. });
  160. }
  161. onReady(() => {});
  162. onShow(() => {
  163. //调用系统主题颜色
  164. proxy.$settingStore.systemThemeColor([1]);
  165. });
  166. onLoad((options) => {
  167. if ("typeName" in options) {
  168. dataList.value[0].value = options.typeName;
  169. }
  170. if ("id" in options) {
  171. id.value = parseInt(options.id);
  172. init();
  173. }
  174. });
  175. </script>
  176. <style lang="scss" scoped></style>