report.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <scroll-view scroll-y>
  3. <view class="whiteBackgroundColor" style="display: flex; padding: 15px 0px 15px 15px; margin-bottom: 15px" v-for="cu in currentDateList" :key="cu">
  4. <view class="reportLeft" @click="pulicClick(cu)">
  5. <u-image style="margin: auto" width="40" height="40" src="@/static/images/xunjian/scan.png" v-if="cu.siteType == 1" shape="circle"></u-image>
  6. <u-image style="margin: auto" width="40" height="40" src="@/static/images/xunjian/NFC.png" v-if="cu.siteType == 2" shape="circle"></u-image>
  7. </view>
  8. <view class="reportCenter" @click="pulicClick(cu)">
  9. <view class="centerSiteName">
  10. {{ cu.siteName }}
  11. <view
  12. :style="{
  13. margin: 'auto auto auto 15px',
  14. fontSize: '5px',
  15. backgroundColor: cu.inspectionStatus == 1 ? '#ffbebb' : '#ABE399',
  16. color: cu.inspectionStatus == 1 ? '#FF3128' : '#189400',
  17. borderRadius: '10px',
  18. padding: '0px 5px',
  19. }"
  20. >
  21. {{ cu.inspectionStatus == 1 ? "未巡检" : "已巡检" }}
  22. </view>
  23. <!-- "inspectionStatus": 2 //巡检状态(1 未巡检,2 已巡检) -->
  24. </view>
  25. <view style="font-size: 13px; color: #a1a1a1; margin-bottom: 5px"> 描述:{{ cu.siteDescribe == "" || cu.siteDescribe == null ? "无" : cu.siteDescribe }} </view>
  26. <view style="font-size: 13px; color: #a1a1a1">
  27. 完成时间:
  28. {{ cu.inspectionTime == "" || cu.inspectionTime == null ? "无" : cu.inspectionTime }}
  29. </view>
  30. </view>
  31. <view style="margin: auto" @click="pulicClick(cu)"></view>
  32. <view class="reportRight">
  33. <view
  34. class="rightChild"
  35. :style="{
  36. color: cu.siteStatus == null || cu.siteStatus == 0 ? '#a0a0a0' : '#1989fa',
  37. }"
  38. >
  39. <text class="iconfont ucicon-map" style="font-size: 22px"></text>
  40. <view>定位</view>
  41. </view>
  42. <view
  43. class="rightChild"
  44. :style="{
  45. color: cu.siteStatus == null || cu.siteStatus == 0 ? '#a0a0a0' : '#1989fa',
  46. }"
  47. >
  48. <text class="iconfont ucicon-appstore" style="font-size: 22px"></text>
  49. <view>状态</view>
  50. </view>
  51. </view>
  52. </view>
  53. <view style="position: fixed; right: 0; bottom: 50px">
  54. <u-image width="67" height="67" src="@/static/images/xunjian/plan-scan.png" shape="circle" @click="scanClick()"></u-image>
  55. </view>
  56. </scroll-view>
  57. </template>
  58. <script setup>
  59. import { onLoad, onShow } from "@dcloudio/uni-app";
  60. import { ref, onMounted, inject, shallowRef } from "vue";
  61. import useXunJianStore from "@/store/modules/xunJian";
  62. import { recordList, recordOption, siteDetails, planSonSiteDetails } from "@/api/business/mhxf/xunJian/plan.js";
  63. const settingsStore = useXunJianStore(); //全局变量值Store
  64. function pulicClick(obj) {
  65. if (obj.inspectionStatus == 2) {
  66. recordList({
  67. siteId: obj.id,
  68. planSonId: settingsStore.planSonId,
  69. }).then((res) => {
  70. if (res.status == "SUCCESS") {
  71. if (res.data.length > 0) {
  72. recordOption({
  73. siteId: res.data[0].siteId,
  74. recordId: res.data[0].id,
  75. }).then((res1) => {
  76. res.data[0].inspectionStatus = 2;
  77. res.data[0].pictureUrl = obj.pictureUrl;
  78. settingsStore.contentArray = {
  79. contentList: [res1.data.contentList],
  80. siteList: res.data[0],
  81. };
  82. settingsStore.siteId = undefined;
  83. settingsStore.siteNubmber = undefined;
  84. });
  85. }
  86. } else {
  87. }
  88. });
  89. } else {
  90. settingsStore.contentArray = {};
  91. settingsStore.siteId = obj.id;
  92. settingsStore.siteNubmber = undefined;
  93. }
  94. uni.navigateTo({
  95. url: "/pages/business/mhxf/xunJian/plan/components/siteDetails",
  96. });
  97. }
  98. /**
  99. * @扫一扫
  100. * @点击事件
  101. */
  102. const scanArray = ref([]);
  103. const scanBool = ref(false);
  104. async function scanClick() {
  105. uni.scanCode({
  106. success: async (e) => {
  107. uni.showToast({
  108. title: "扫码成功",
  109. icon: "none",
  110. });
  111. settingsStore.contentArray = {};
  112. settingsStore.siteId = undefined;
  113. settingsStore.siteNubmber = e.result;
  114. siteDetails({
  115. siteId: settingsStore.siteId,
  116. siteNubmber: settingsStore.siteNubmber,
  117. planSonId: settingsStore.planSonId,
  118. }).then((res) => {
  119. if (res.status == "SUCCESS") {
  120. currentDateList.value.forEach((e) => {
  121. if (e.id == res.data.siteList[0].id) {
  122. uni.navigateTo({
  123. url: "/pages/business/mhxf/xunJian/plan/components/siteDetails",
  124. });
  125. }
  126. });
  127. } else {
  128. }
  129. });
  130. },
  131. fail: (err) => {
  132. uni.showToast({
  133. title: "扫码失败",
  134. icon: "none",
  135. });
  136. console.log("扫码失败", err);
  137. },
  138. complete: () => {
  139. console.log("扫码结束");
  140. },
  141. });
  142. }
  143. /**
  144. * @地点列表
  145. * @api接口请求
  146. */
  147. const currentDateList = ref([]); //地点列表list数据存储
  148. function currentApi() {
  149. planSonSiteDetails({
  150. planSonId: settingsStore.planSonId,
  151. }).then((res) => {
  152. if (res.status == "SUCCESS") {
  153. currentDateList.value = res.data;
  154. currentDateList.value.forEach((e) => {
  155. if (e.inspectionTime) {
  156. e.inspectionTime = e.inspectionTime.replace("T", " ");
  157. }
  158. });
  159. } else {
  160. }
  161. });
  162. }
  163. onLoad((options) => {
  164. currentApi();
  165. });
  166. onMounted(() => {});
  167. </script>
  168. <style lang="scss">
  169. .is-selected {
  170. color: #1989fa;
  171. }
  172. </style>
  173. <style scoped>
  174. .reportLeft {
  175. margin-right: 15px;
  176. display: flex;
  177. }
  178. .reportCenter {
  179. }
  180. .reportCenter .centerSiteName {
  181. font-size: 15px;
  182. margin-bottom: 5px;
  183. height: 20px;
  184. line-height: 20px;
  185. display: flex;
  186. }
  187. .reportRight {
  188. display: flex;
  189. background-color: rgba(238, 238, 238, 0.3);
  190. margin: -15px 0;
  191. }
  192. .reportRight .rightChild {
  193. margin: auto;
  194. text-align: center;
  195. padding: 10px;
  196. }
  197. .reportRight .rightChild .el-icon {
  198. font-size: 20px;
  199. margin: auto;
  200. font-weight: 600;
  201. }
  202. .reportRight .rightChild view {
  203. font-size: 12px;
  204. margin: auto;
  205. font-weight: 600;
  206. }
  207. </style>