taskBoardAddress.vue 7.0 KB

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