taskBoardAddress.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 style="margin-left:10px" name="photo" size="16" @click="getView(item)"></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.checkNum = item.checkNum
  108. that.deviceID = item.deviceId
  109. that.classType = item.classType_dictText
  110. that.toComponent = 'gasImgIdentify'
  111. that.saveImg = uni.getStorageSync(item.deviceId)
  112. }
  113. },
  114. getBackAddress() {
  115. this.isShow = true
  116. this.toComponent = ''
  117. this.topH = 39 * this.activeIndex
  118. this.taskDetailsLists()
  119. },
  120. taskDetailsLists() {
  121. let that = this
  122. new Promise((resolve, reject) => {
  123. api
  124. .taskDetailsList({ pageNo: 1, pageSize: 100, taskId: that.taskId, taskTime: that.searchTime })
  125. .then((response) => {
  126. if (response.data.code == 200) {
  127. console.log(response, '地点列表---')
  128. that.indexList = response.data.result.records || []
  129. // that.indexList = [
  130. // { deviceName: '测试地址1' },
  131. // { deviceName: '测试地址2' },
  132. // { deviceName: '测试地址3' },
  133. // { deviceName: '测试地址4' },
  134. // { deviceName: '测试地址5' },
  135. // { deviceName: '测试地址6' },
  136. // { deviceName: '测试地址7' },
  137. // { deviceName: '测试地址8' },
  138. // { deviceName: '测试地址9' },
  139. // { deviceName: '测试地址10' },
  140. // { deviceName: '测试地址11' },
  141. // { deviceName: '测试地址12' },
  142. // { deviceName: '测试地址13' },
  143. // { deviceName: '测试地址14' },
  144. // { deviceName: '测试地址15' },
  145. // { deviceName: '测试地址16' },
  146. // { deviceName: '测试地址17' },
  147. // { deviceName: '测试地址18' },
  148. // { deviceName: '测试地址19' },
  149. // { deviceName: '测试地址20' },
  150. // { deviceName: '测试地址21' },
  151. // { deviceName: '测试地址22' },
  152. // { deviceName: '测试地址23' },
  153. // { deviceName: '测试地址24' },
  154. // { deviceName: '测试地址25' },
  155. // { deviceName: '测试地址26' },
  156. // { deviceName: '测试地址27' },
  157. // { deviceName: '测试地址28' },
  158. // { deviceName: '测试地址29' },
  159. // { deviceName: '测试地址30' },
  160. // ]
  161. } else {
  162. reject(response);
  163. }
  164. })
  165. .catch((error) => {
  166. console.log("catch===>response", response);
  167. reject(error);
  168. });
  169. });
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss" scoped>
  175. .taskBoardAddress {
  176. position: relative;
  177. width: 100%;
  178. height: 100%;
  179. background-color: #fff;
  180. }
  181. ::v-deep .u-slot-title {
  182. display: flex;
  183. }
  184. </style>