siteDetails.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <scroll-view scroll-y>
  3. <view>
  4. <view class="whiteBackgroundColor" style="display: flex; padding: 15px; margin-bottom: 15px">
  5. <view style="margin-right: 15px; display: flex">
  6. <u-image style="margin: auto" width="40" height="40" src="@/static/images/xunjian/scan.png" v-if="siteList.siteType == 1" shape="circle"></u-image>
  7. <u-image style="margin: auto" width="40" height="40" src="@/static/images/xunjian/NFC.png" v-if="siteList.siteType == 2" shape="circle"></u-image>
  8. </view>
  9. <view>
  10. <view style="font-size: 15px; margin-bottom: 2px">
  11. {{ siteList.siteName }}
  12. </view>
  13. <view style="font-size: 13px; color: #a1a1a1"> {{ siteList.contentCount }}项内容 </view>
  14. </view>
  15. <view style="margin: auto"></view>
  16. <view style="margin: auto 0">
  17. <!-- {{ siteList.siteStatus == null }} -->
  18. <view style="font-size: 15px; color: #30bb00">已定位</view>
  19. <!-- #f07d28 -->
  20. </view>
  21. </view>
  22. <view class="whiteBackgroundColor" style="margin-bottom: 15px; padding: 15px">
  23. <view class="siteHeader">
  24. <uni-section title="上报现场" type="line"></uni-section>
  25. </view>
  26. <view style="display: flex; flex-wrap: wrap">
  27. <view class="uploadView" v-for="record in siteList.recordPictureList" :key="record">
  28. <view class="uploadUimage">
  29. <u-image width="100%" height="100%" :src="record.pictureUrl"></u-image>
  30. </view>
  31. <view v-if="siteList.inspectionStatus == 1" class="uploadViewClose" @click="uploadViewClose(record)">
  32. <u-icon name="close" color="#ffffff" size="12"></u-icon>
  33. </view>
  34. </view>
  35. <view :class="siteList.inspectionStatus == 2 ? 'uploadView upload-buttom uploadDisabled' : 'uploadView upload-buttom'" @click="uploadClick">
  36. <u-icon style="margin: auto" name="plus" color="#909399" size="28"></u-icon>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="whiteBackgroundColor" style="margin-bottom: 15px; padding: 15px; height: 170px; max-height: 170px">
  41. <view class="siteHeader">
  42. <uni-section title="备注" type="line"></uni-section>
  43. </view>
  44. <view style="height: calc(100% - 25px)">
  45. <span v-if="siteList.inspectionStatus == 2">
  46. {{ siteList.remarks }}
  47. </span>
  48. <u-textarea v-if="siteList.inspectionStatus == 1" style="height: 100%" v-model="siteList.remarks" placeholder="请输入备注" maxlength="50"></u-textarea>
  49. </view>
  50. </view>
  51. <view class="whiteBackgroundColor" style="padding: 15px">
  52. <view class="siteHeader">
  53. <uni-section title="消防设施分布图" type="line"></uni-section>
  54. </view>
  55. <view>
  56. <u-image width="100%" :src="siteList.pictureUrl"></u-image>
  57. </view>
  58. </view>
  59. <view style="margin-bottom: 70px"></view>
  60. </view>
  61. <view style="position: fixed; left: 0; right: 0; bottom: 0; padding: 15px">
  62. <view>
  63. <u-button v-if="siteList.inspectionStatus == 1" type="primary" style="width: 100%; height: 40px; font-size: 14px" @click="buttonClick()" shape="circle"> 下一步 </u-button>
  64. <u-button v-if="siteList.inspectionStatus == 2" type="primary" style="width: 100%; height: 40px; font-size: 14px" @click="buttonClick()" shape="circle"> 查看巡检项 </u-button>
  65. </view>
  66. </view>
  67. </scroll-view>
  68. </template>
  69. <script setup>
  70. import { onLoad, onShow } from "@dcloudio/uni-app";
  71. import { ref, onMounted, inject, shallowRef, reactive } from "vue";
  72. import useXunJianStore from "@/store/modules/xunJian";
  73. import { uploadAvatar, siteDetails } from "@/api/business/mhxf/xunJian/plan.js";
  74. const settingsStore = useXunJianStore(); //全局变量值Store
  75. /**
  76. * @站点详情
  77. * @api接口查询
  78. * @siteList站点详情信息存储
  79. * @contentList内容详情信息存储
  80. */
  81. const siteList = ref([]);
  82. const contentList = ref([]);
  83. function selectAPI() {
  84. siteDetails({
  85. siteId: settingsStore.siteId,
  86. siteNubmber: settingsStore.siteNubmber,
  87. planSonId: settingsStore.planSonId,
  88. }).then((res) => {
  89. if (res.status == "SUCCESS") {
  90. contentList.value = res.data.contentList;
  91. siteList.value = res.data.siteList[0];
  92. siteList.value.recordPictureList = [];
  93. contentList.value.forEach((el) => {
  94. el.remarksBool = false;
  95. el.contentOptionListValue = "";
  96. el.contentOptionListValue1 = [];
  97. });
  98. } else {
  99. }
  100. });
  101. }
  102. /**
  103. * @按钮点击事件
  104. * @下一步
  105. * @查看巡检项
  106. */
  107. function buttonClick() {
  108. settingsStore.contentArray = {
  109. contentList: contentList.value,
  110. siteList: siteList.value,
  111. };
  112. uni.navigateTo({
  113. url: "/pages/business/mhxf/xunJian/plan/components/content",
  114. });
  115. }
  116. /**
  117. * @upload图片上传
  118. * @点击事件
  119. */
  120. function uploadClick() {
  121. uni.chooseImage({
  122. count: 1, //默认9
  123. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  124. sourceType: ["album", "camera"], //从相册选择、摄像头
  125. success: function (res) {
  126. uploadApi(res);
  127. },
  128. });
  129. }
  130. /**
  131. * @upload图片上传
  132. * @api接口请求
  133. */
  134. async function uploadApi(res) {
  135. let data = { name: "file", filePath: res.tempFilePaths[0] };
  136. uploadAvatar(data).then((response) => {
  137. siteList.value.recordPictureList.push({
  138. name: response.data.name,
  139. pictureUrl: response.data.url,
  140. });
  141. });
  142. }
  143. /**
  144. * @upload图片上传
  145. * @点击事件
  146. * @删除事件
  147. */
  148. function uploadViewClose(el) {
  149. siteList.value.recordPictureList.splice(siteList.value.recordPictureList.indexOf(el), 1);
  150. }
  151. onLoad((options) => {
  152. if (JSON.stringify(settingsStore.contentArray) == "{}") {
  153. selectAPI();
  154. } else {
  155. contentList.value = settingsStore.contentArray.contentList[0];
  156. siteList.value = settingsStore.contentArray.siteList;
  157. }
  158. });
  159. onMounted(() => {});
  160. </script>
  161. <style scoped>
  162. .siteHeader {
  163. display: flex;
  164. height: 20px;
  165. line-height: 20px;
  166. margin-bottom: 10px;
  167. }
  168. </style>
  169. <!--自定义图片上传功能样式-->
  170. <style scoped>
  171. .uploadView {
  172. position: relative;
  173. overflow: hidden;
  174. width: calc(33% - 10px);
  175. height: 110px;
  176. margin: 0 15px 15px 0;
  177. border: 1px solid #d9d9d9;
  178. border-radius: 6px;
  179. cursor: pointer;
  180. }
  181. .uploadView .uploadUimage {
  182. height: 100%;
  183. }
  184. .uploadView .uploadUimage > uni-view {
  185. height: 100%;
  186. }
  187. .uploadViewClose {
  188. position: absolute;
  189. background-color: #409eff;
  190. transform: rotate(45deg);
  191. width: 40px;
  192. height: 24px;
  193. text-align: center;
  194. right: -15px;
  195. top: -6px;
  196. cursor: pointer;
  197. }
  198. .uploadViewClose .u-icon,
  199. .uploadViewClose .el-icon {
  200. font-size: 12px;
  201. margin-top: 4px;
  202. margin-left: 10px;
  203. transform: rotate(-45deg);
  204. color: #ffffff;
  205. }
  206. .uploadView img {
  207. width: 100%;
  208. }
  209. .upload-buttom {
  210. display: flex;
  211. font-size: 28px;
  212. color: #909399;
  213. border: 1px dashed #d9d9d9;
  214. background-color: #fafafa;
  215. }
  216. .uploadView:nth-child(3n) {
  217. margin: 0 !important;
  218. }
  219. .upload-buttom:hover {
  220. border: 1px dashed #409eff;
  221. }
  222. :deep(.uploadDisabled) {
  223. display: none !important;
  224. }
  225. </style>