taskBoardAddress.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="taskBoardAddress">
  3. <!-- 查看巡检点详情时隐藏本页导航栏,由详情页展示自己的标题与返回键 -->
  4. <u-navbar
  5. v-if="!toComponent"
  6. :title="gasTitle"
  7. :safeAreaInsetTop="true"
  8. :fixed="true"
  9. height="50px"
  10. bgColor="#afc3fc"
  11. leftIcon="arrow-left"
  12. @leftClick="handlerToggle"
  13. >
  14. </u-navbar>
  15. <view>
  16. <u-button
  17. v-if="showBtn"
  18. icon="eye"
  19. type="primary"
  20. size="small"
  21. loadingText="识别中"
  22. style="width: 100%; margin-top: 20px"
  23. @click="getYjsb"
  24. >一键识别</u-button
  25. >
  26. </view>
  27. <u-list :height="666" :scrollTop="topH" v-if="isShow">
  28. <u-list-item v-for="(item, index) in indexList" :key="index">
  29. <u-cell icon="share">
  30. <view slot="title" class="u-slot-title">
  31. <text class="u-cell-text">{{
  32. `${item.deviceName} (${
  33. item.checkNum == "1"
  34. ? "第一次"
  35. : item.checkNum == "2"
  36. ? "第二次"
  37. : ""
  38. })`
  39. }}</text>
  40. <!-- <u-tag text="查看" plain size="mini" type="warning">
  41. </u-tag> -->
  42. </view>
  43. <view slot="value" style="display: flex; align-items: center">
  44. <u-icon
  45. :name="item.checkState == '0' ? 'plus' : 'checkmark'"
  46. size="16"
  47. @click="getBoradAddress(item, index)"
  48. ></u-icon>
  49. <u-icon
  50. v-if="item.zcShow"
  51. style="margin-left: 10px"
  52. name="photo"
  53. size="16"
  54. ></u-icon>
  55. </view>
  56. </u-cell>
  57. </u-list-item>
  58. </u-list>
  59. <!-- 一键识别List -->
  60. <view v-if="sbShow">
  61. <Recognition
  62. :recognitionData="recognitionData"
  63. @getRepport="getRepport"
  64. ></Recognition>
  65. </view>
  66. <component
  67. :is="toComponent"
  68. :Ids="Ids"
  69. :checkNum="checkNum"
  70. :classType="classType"
  71. :isSensor="isSensor"
  72. :deviceID="deviceID"
  73. :deviceName="deviceName"
  74. :saveImg="saveImg"
  75. :checkState="checkState"
  76. :sbData="sbData"
  77. :urlData="urlData"
  78. @getBackAddress="getBackAddress"
  79. @clearImg="clearImg"
  80. >
  81. </component>
  82. </view>
  83. </template>
  84. <script>
  85. import api from "@/api/api";
  86. import gasImgIdentify from "./gasImgIdentify.vue";
  87. import Recognition from "./Recognition.vue";
  88. export default {
  89. name: "taskBoardAddress",
  90. components: { gasImgIdentify, Recognition },
  91. props: {
  92. taskId: {
  93. type: String,
  94. default: "",
  95. },
  96. },
  97. data() {
  98. return {
  99. saveImg: "",
  100. // imgList: [],
  101. topH: 0,
  102. activeIndex: 0,
  103. Ids: "",
  104. checkNum: "", //巡检次数
  105. classType: "",
  106. isSensor: "",
  107. deviceID: "",
  108. deviceName: "",
  109. checkState: "",
  110. isShow: true,
  111. toComponent: "",
  112. indexList: [],
  113. gasTitle: "任务明细", //标题
  114. sbShow: false,
  115. sbData: [],
  116. urlData: "",
  117. showBtn: true,
  118. };
  119. },
  120. computed: {
  121. searchTime: function () {
  122. return uni.getStorageSync("searchTime");
  123. },
  124. //一键识别列表
  125. recognitionData: function () {
  126. let list = [];
  127. this.indexList.forEach((el) => {
  128. if (uni.getStorageSync(el.deviceId)) {
  129. el.img = uni.getStorageSync(el.deviceId);
  130. el.status = "";
  131. list.push(el);
  132. }
  133. });
  134. return list;
  135. },
  136. },
  137. mounted() {
  138. this.taskDetailsLists();
  139. },
  140. methods: {
  141. //点击返回上一级
  142. handlerToggle() {
  143. this.$emit("getBackBoard");
  144. },
  145. //暂存图片预览
  146. // getView(item) {
  147. // let imgList = []
  148. // imgList.push(uni.getStorageSync(item.deviceId))
  149. // // 预览图片
  150. // uni.previewImage({
  151. // urls: imgList,
  152. // current: 0
  153. // });
  154. // },
  155. //清除暂存图片
  156. clearImg(data) {
  157. if (data) {
  158. this.saveImg = "";
  159. }
  160. },
  161. //一键识别
  162. getYjsb() {
  163. let that = this;
  164. that.isShow = false;
  165. that.sbShow = true;
  166. that.showBtn = false;
  167. if (that.recognitionData.length != 0) {
  168. uni.showLoading({
  169. title: "批量识别中...",
  170. mask: true,
  171. });
  172. }
  173. },
  174. //批量识别后跳转到填报页面
  175. getRepport(param) {
  176. let that = this;
  177. that.sbShow = false;
  178. that.showBtn = false;
  179. console.log(param, "param------");
  180. that.Ids = param.id;
  181. that.checkNum = param.checkNum;
  182. that.classType = param.classType_dictText;
  183. that.checkState = param.checkState;
  184. that.isSensor = param.isSensor;
  185. that.deviceID = param.deviceId;
  186. that.deviceName = param.deviceName;
  187. that.sbData = param.sbList;
  188. that.urlData = param.img;
  189. that.toComponent = "gasImgIdentify";
  190. },
  191. getBoradAddress(item, index) {
  192. let that = this;
  193. that.activeIndex = index;
  194. that.isShow = false;
  195. that.showBtn = false;
  196. if (item.checkState == "0") {
  197. that.Ids = item.id;
  198. that.isSensor = item.isSensor;
  199. }
  200. that.checkNum = item.checkNum;
  201. that.classType = item.classType_dictText;
  202. that.checkState = item.checkState;
  203. that.deviceID = item.deviceId;
  204. that.deviceName = item.deviceName;
  205. that.saveImg = uni.getStorageSync(item.deviceId);
  206. that.toComponent = "gasImgIdentify";
  207. },
  208. getBackAddress() {
  209. this.isShow = true;
  210. this.showBtn = true;
  211. this.sbShow = false;
  212. this.toComponent = "";
  213. this.urlData = "";
  214. this.topH = 39 * this.activeIndex;
  215. this.taskDetailsLists();
  216. },
  217. taskDetailsLists() {
  218. let that = this;
  219. new Promise((resolve, reject) => {
  220. api
  221. .taskDetailsList({
  222. pageNo: 1,
  223. pageSize: 100,
  224. taskId: that.taskId,
  225. taskTime: that.searchTime,
  226. })
  227. .then((response) => {
  228. if (response.data.code == 200) {
  229. console.log(response, "地点列表---");
  230. that.indexList = response.data.result.records || [];
  231. if (that.indexList.length != 0) {
  232. that.indexList.forEach((el) => {
  233. if (uni.getStorageSync(el.deviceId)) {
  234. el.zcShow = true;
  235. } else {
  236. el.zcShow = false;
  237. }
  238. });
  239. }
  240. } else {
  241. reject(response);
  242. }
  243. })
  244. .catch((error) => {
  245. console.log("catch===>response", response);
  246. reject(error);
  247. });
  248. });
  249. },
  250. },
  251. };
  252. </script>
  253. <style lang="scss" scoped>
  254. .taskBoardAddress {
  255. position: relative;
  256. width: 100%;
  257. height: 100%;
  258. padding: 0px 10px;
  259. box-sizing: border-box;
  260. }
  261. ::v-deep .u-slot-title {
  262. display: flex;
  263. }
  264. </style>