taskBoardAddress.vue 8.0 KB

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