report.vue 6.3 KB

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