taskBoardAddress.vue 7.3 KB

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