taskBoardAddress.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. if (that.recognitionData.length != 0) {
  122. uni.showLoading({
  123. title: '批量识别中...',
  124. mask: true
  125. });
  126. }
  127. },
  128. //批量识别后跳转到填报页面
  129. getRepport(param) {
  130. let that = this
  131. that.sbShow = false
  132. that.showBtn = false
  133. console.log(param, 'param------')
  134. that.Ids = param.id
  135. that.checkNum = param.checkNum
  136. that.classType = param.classType_dictText
  137. that.checkState = param.checkState
  138. that.isSensor = param.isSensor
  139. that.deviceID = param.deviceId
  140. that.deviceName = param.deviceName
  141. that.sbData = param.sbList
  142. that.urlData = param.img
  143. that.toComponent = 'gasImgIdentify'
  144. },
  145. getBoradAddress(item, index) {
  146. let that = this
  147. that.activeIndex = index
  148. that.isShow = false
  149. that.showBtn = false
  150. if (item.checkState == '0') {
  151. that.Ids = item.id
  152. that.isSensor = item.isSensor
  153. }
  154. that.checkNum = item.checkNum
  155. that.classType = item.classType_dictText
  156. that.checkState = item.checkState
  157. that.deviceID = item.deviceId
  158. that.deviceName = item.deviceName
  159. that.saveImg = uni.getStorageSync(item.deviceId)
  160. that.toComponent = 'gasImgIdentify'
  161. },
  162. getBackAddress() {
  163. this.isShow = true
  164. this.showBtn = true
  165. this.sbShow = false
  166. this.toComponent = ''
  167. this.topH = 39 * this.activeIndex
  168. this.taskDetailsLists()
  169. },
  170. taskDetailsLists() {
  171. let that = this
  172. new Promise((resolve, reject) => {
  173. api
  174. .taskDetailsList({ pageNo: 1, pageSize: 100, taskId: that.taskId, taskTime: that.searchTime })
  175. .then((response) => {
  176. if (response.data.code == 200) {
  177. console.log(response, '地点列表---')
  178. that.indexList = response.data.result.records || []
  179. if (that.indexList.length != 0) {
  180. that.indexList.forEach(el => {
  181. if (uni.getStorageSync(el.deviceId)) {
  182. el.zcShow = true
  183. } else {
  184. el.zcShow = false
  185. }
  186. })
  187. }
  188. } else {
  189. reject(response);
  190. }
  191. })
  192. .catch((error) => {
  193. console.log("catch===>response", response);
  194. reject(error);
  195. });
  196. });
  197. }
  198. }
  199. };
  200. </script>
  201. <style lang="scss" scoped>
  202. .taskBoardAddress {
  203. position: relative;
  204. width: 100%;
  205. height: 100%;
  206. background-color: #fff;
  207. padding: 0px 10px;
  208. box-sizing: border-box;
  209. }
  210. ::v-deep .u-slot-title {
  211. display: flex;
  212. }
  213. </style>