facilitiesDetails.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 padding-0">
  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 margin-bottom-sm" 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 margin-bottom-sm" 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 { publicStores, useStores } 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. {
  118. title: "设施类型",
  119. value: "",
  120. },
  121. {
  122. title: "设施编号",
  123. value: "",
  124. },
  125. {
  126. title: "设施位置",
  127. value: "",
  128. },
  129. {
  130. title: "创建时间",
  131. value: "",
  132. },
  133. ]);
  134. const dataList1 = ref([]);
  135. const dataList2 = ref([]);
  136. /**
  137. * @页面初始化
  138. */
  139. function init() {
  140. facilityInfo({ id: id.value }).then((requset) => {
  141. if (requset.status === "SUCCESS") {
  142. dataArray.value = requset.data[0];
  143. dataList.value[1].value = requset.data[0].facilityNum ? requset.data[0].facilityNum : "无";
  144. dataList.value[2].value = requset.data[0].address ? requset.data[0].address : "无";
  145. dataList.value[3].value = requset.data[0].createTime ? requset.data[0].createTime.replace("T", " ") : requset.data[0].createTime;
  146. }
  147. });
  148. deviceInfoApi();
  149. buildInfoApi();
  150. }
  151. /**
  152. * @设施详情关联设备接口请求
  153. * @api接口请求
  154. */
  155. function deviceInfoApi() {
  156. deviceInfo({ id: id.value, deviceId: deviceId.value, current: 1, size: 1000 }).then((requset) => {
  157. if (requset.status === "SUCCESS") {
  158. dataList1.value = requset.data.records;
  159. }
  160. });
  161. }
  162. /**
  163. * @设施详情关联建筑接口请求
  164. * @api接口请求
  165. */
  166. function buildInfoApi() {
  167. buildInfo({ id: id.value, buildNum: buildNum.value, current: 1, size: 1000 }).then((requset) => {
  168. if (requset.status === "SUCCESS") {
  169. dataList2.value = requset.data.records;
  170. }
  171. });
  172. }
  173. onReady(() => {});
  174. onShow(() => {
  175. //调用系统主题颜色
  176. proxy.$settingStore.systemThemeColor([1]);
  177. });
  178. onLoad((options) => {
  179. if ("typeName" in options) {
  180. dataList.value[0].value = options.typeName;
  181. }
  182. if ("id" in options) {
  183. id.value = parseInt(options.id);
  184. init();
  185. }
  186. });
  187. </script>
  188. <style lang="scss" scoped></style>