dgpImagelist.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <view>
  3. <view class="" style="position: relative; top: 5px">
  4. <!-- <view style="position: fixed;z-index: 100;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="查看图片"></uni-nav-bar>
  6. </view> -->
  7. <p class="tishi" v-if="tishi">暂无数据</p>
  8. <view style="position: fixed; z-index: 100;">
  9. <view class="tab-box">
  10. <u-tabs :list="equipArr" :current="active" active-color="#14A478" @change="tabClick"></u-tabs>
  11. </view>
  12. <view class="selecttimes" @click="tiemshow = !tiemshow">
  13. <view class="timesbox">
  14. <image
  15. :src="
  16. $imageURL+ '/bigdata_app' +
  17. '/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'
  18. "
  19. mode=""
  20. ></image>
  21. <p>{{ timetab(timestate) }}</p>
  22. <p class="or">~</p>
  23. <p>{{ timetab(timeend) }}</p>
  24. <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
  25. </view>
  26. <u-calendar
  27. v-model="tiemshow"
  28. mode="range"
  29. @change="tiemchange"
  30. range-color="#999"
  31. btn-type="success"
  32. active-bg-color="#0BBC58"
  33. range-bg-color="rgba(11,188,88,0.13)"
  34. ></u-calendar>
  35. </view>
  36. </view>
  37. <view class="imglist">
  38. <view
  39. class="imglist_box"
  40. v-for="(item, index) in imglists"
  41. :key="index"
  42. >
  43. <view class="imglist_left">
  44. <image
  45. :src="
  46. $imageURL+ '/bigdata_app' +
  47. '/image/cb/jiazai.ui.gif'
  48. "
  49. mode=""
  50. >
  51. </image>
  52. <image :src="item.photo" mode="" @click="examine(item.photo)"></image>
  53. </view>
  54. <view class="imglist_right">
  55. <view class="icon_box" @click="delimg(item.photo_id)">
  56. <i class="yficonfont icon-shanchu"></i>
  57. </view>
  58. <p>设备名称:{{ item.device_name }}</p>
  59. <p>所属场景:{{ item.index_name }}</p>
  60. <p>类型:{{ item.index_type }}</p>
  61. <p>指数:{{ item.index_value }}</p>
  62. <p >{{ item.addtime | timeFormat() }}</p>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="top" v-if="isTop" @click="top">
  68. <image
  69. :src="
  70. $imageURL+ '/bigdata_app' +
  71. '/image/6209a98f0cb3b5086f2ca36152c9269.png'
  72. "
  73. mode=""
  74. ></image>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. page: 1,
  83. imglists: [],
  84. tishi: true,
  85. d_id: '',
  86. timeend: '', //当前时间 也是搜索的结束时间
  87. timestate: '',
  88. timeshow: false,
  89. params: {
  90. year: true,
  91. month: true,
  92. day: true,
  93. hour: true,
  94. minute: true,
  95. second: false,
  96. },
  97. flag: 1,
  98. self: true,
  99. isTop: false,
  100. resultdata: {},
  101. titletext: ['24小时', '近一个月', '近半年', '近一年'],
  102. titleidnex: 0,
  103. tiemshow: false, //时间选择器
  104. disable: '',
  105. device_type: '',
  106. myuid: '',
  107. active:0,
  108. equipArr:[
  109. { name: '全部', value: '全部' },
  110. { name: 'NDVI(归一化差值植被指数)', value: 'NDVI' },
  111. { name: 'GNDVI(绿度归一化差值植被指数)', value: 'GNDVI' },
  112. { name: 'OSAVI(优化土壤调节植被指数)', value: 'OSAVI' },
  113. { name: 'LCI(叶叶绿素指数)', value: 'LCI' },
  114. { name: 'NDRE(红边归一化差值植被指数)', value: 'NDRE' }
  115. ],
  116. device_type:''
  117. };
  118. },
  119. methods: {
  120. examine(url) {
  121. var imgarr =[]
  122. imgarr.push(url)
  123. console.log(imgarr)
  124. uni.previewImage({
  125. urls: imgarr
  126. });
  127. },
  128. tabClick(index) {
  129. this.page = 1
  130. this.imglists = []
  131. this.active = index;
  132. this.device_type = this.equipArr[index].value
  133. if (this.timestate != '') {
  134. this.timestate = parseInt(this.timestate);
  135. }
  136. if (this.timeend != '') {
  137. this.timeend = parseInt(this.timeend);
  138. }
  139. this.imglistdata(this.timestate, this.timeend);
  140. },
  141. async imglistdata(time_begin, time_end) {
  142. //获取图片列表
  143. const res = await this.$myRequest({
  144. url: '/api/api_gateway?method=camera.camera_manage.multi_camera_photo',
  145. data: {
  146. device_id: this.device_id,
  147. page: this.page,
  148. page_size: 8,
  149. start: time_begin, //开始时间
  150. end: time_end, //结束时间
  151. index_type: this.device_type === '全部' ? '' : this.device_type
  152. },
  153. });
  154. this.imglists = this.imglists.concat(res.data);
  155. console.log(this.imglists);
  156. if (this.imglists.length == 0) {
  157. this.tishi = true;
  158. } else {
  159. this.tishi = false;
  160. }
  161. },
  162. //forecast.forecast_system.equip_photo_del
  163. async del(id) {
  164. //删除图片
  165. const res = await this.$myRequest({
  166. url: '/api/api_gateway?method=camera.camera_manage.multi_camera_photo_delete',
  167. data: {
  168. // device_id: this.device_id,
  169. photo_id: id,
  170. },
  171. });
  172. if (res) {
  173. uni.showToast({
  174. title: '删除成功!',
  175. duration: 2000,
  176. });
  177. this.page = 1;
  178. this.imglists = [];
  179. if (this.timestate != '') {
  180. this.timestate = parseInt(this.timestate);
  181. }
  182. if (this.timeend != '') {
  183. this.timeend = parseInt(this.timeend);
  184. }
  185. this.imglistdata(this.timestate, this.timeend);
  186. } else {
  187. uni.showToast({
  188. title: '删除失败!',
  189. duration: 2000,
  190. icon: 'none',
  191. });
  192. }
  193. },
  194. //forecast.forecast_system.equip_photo_species pest_list
  195. //forecast.forecast_system.equip_photo_species统计
  196. //forecast.send_control.admin_device_control 拍照
  197. clickLeft() {
  198. uni.navigateBack({
  199. delta: 1,
  200. });
  201. },
  202. delimg(id) {
  203. //删除图片
  204. uni.showModal({
  205. title: '提示',
  206. content: '是否删除此图片?',
  207. success: (res) => {
  208. if (res.confirm) {
  209. this.del(id);
  210. console.log('用户点击确定');
  211. } else if (res.cancel) {
  212. console.log('用户点击取消');
  213. }
  214. },
  215. });
  216. },
  217. top() {
  218. uni.pageScrollTo({
  219. scrollTop: 0,
  220. duration: 500,
  221. });
  222. },
  223. tiemchange(e) {
  224. this.imglists = [];
  225. this.page = 1;
  226. console.log(e);
  227. this.timestate = +new Date(e.startDate) / 1000 - 8 * 60 * 60;
  228. this.timeend = +new Date(e.endDate) / 1000 + 16 * 60 * 60;
  229. this.imglistdata(parseInt(this.timestate), parseInt(this.timeend));
  230. },
  231. timetab(e) {
  232. if (!e) return '请选择';
  233. e = new Date(e * 1000);
  234. var year = e.getFullYear();
  235. var month =
  236. e.getMonth() + 1 < 10 ? '0' + (e.getMonth() + 1) : e.getMonth() + 1;
  237. var day = e.getDate() < 10 ? '0' + e.getDate() : e.getDate();
  238. var time = year + '/' + month + '/' + day;
  239. return time;
  240. },
  241. },
  242. onLoad(option) {
  243. uni.getStorage({
  244. key: 'myuid',
  245. success: (res) => {
  246. this.myuid = res.data;
  247. console.log(this.myuid);
  248. },
  249. });
  250. // this.timeend = +new Date() / 1000
  251. // this.timestate = this.timeend - 60 * 60 * 24
  252. console.log(option);
  253. this.device_id = option.id;
  254. console.log(this.timestate);
  255. this.imglistdata('', '');
  256. },
  257. onShow() {},
  258. onReachBottom() {
  259. this.page++;
  260. console.log(this.timestate);
  261. if (this.timestate != '') {
  262. this.timestate = parseInt(this.timestate);
  263. }
  264. if (this.timeend != '') {
  265. this.timeend = parseInt(this.timeend);
  266. }
  267. this.imglistdata(this.timestate, this.timeend);
  268. },
  269. onPageScroll(e) {
  270. //nvue暂不支持滚动监听,可用bindingx代替
  271. if (e.scrollTop > 200) {
  272. //距离大于200时显示
  273. this.isTop = true;
  274. } else {
  275. //距离小于200时隐藏
  276. this.isTop = false;
  277. }
  278. },
  279. };
  280. </script>
  281. <style lang="scss">
  282. .tishi {
  283. position: absolute;
  284. top: 45%;
  285. width: 95%;
  286. left: 2.5%;
  287. text-align: center;
  288. font-size: 40rpx;
  289. }
  290. .selecttimes {
  291. width: 100%;
  292. // position: fixed;
  293. // top: 0;
  294. // left: 0;
  295. z-index: 100;
  296. background-color: #fff;
  297. padding: 10rpx 20rpx;
  298. box-sizing: border-box;
  299. .timesbox {
  300. display: flex;
  301. width:100%;
  302. margin: 0 auto;
  303. justify-content: space-around;
  304. box-shadow: 0 0 10rpx #bcb9ca;
  305. padding: 10rpx 20rpx;
  306. box-sizing: border-box;
  307. image {
  308. width: 30rpx;
  309. height: 30rpx;
  310. margin-top: 6rpx;
  311. }
  312. .icon {
  313. color: #949494;
  314. text-align: right;
  315. margin-left: 30rpx;
  316. }
  317. }
  318. ::v-deep .u-calendar__action {
  319. display: flex;
  320. justify-content: space-around;
  321. .u-calendar__action__text {
  322. line-height: 25px;
  323. }
  324. }
  325. }
  326. .timeshow {
  327. width: 96%;
  328. height: 50rpx;
  329. background-color: #ffffff;
  330. position: fixed;
  331. top: 10px;
  332. left: 2.5%;
  333. display: flex;
  334. z-index: 100;
  335. padding-top: 10px;
  336. .shuju_one_title {
  337. width: 70%;
  338. margin: 0 auto;
  339. display: flex;
  340. .tltle_text {
  341. width: 25%;
  342. border: 2rpx solid #b2b2b2;
  343. color: #b2b2b2;
  344. text-align: center;
  345. font-size: 24rpx;
  346. height: 50rpx;
  347. line-height: 50rpx;
  348. }
  349. .title_text_color {
  350. width: 25%;
  351. border: 2rpx solid #28ae4f;
  352. color: #28ae4f;
  353. text-align: center;
  354. font-size: 24rpx;
  355. height: 50rpx;
  356. line-height: 50rpx;
  357. }
  358. }
  359. .timeshow_tate,
  360. .timeshow_end {
  361. height: 50rpx;
  362. width: 45%;
  363. line-height: 50rpx;
  364. text-align: center;
  365. margin-right: 10rpx;
  366. background-color: #56c877;
  367. color: #ffffff;
  368. }
  369. }
  370. .imglist {
  371. position: absolute;
  372. top: 95px;
  373. width: 100%;
  374. padding: 0 20rpx;
  375. box-sizing: border-box;
  376. .imglist_box {
  377. display: flex;
  378. box-shadow: 0 0 10rpx #bcb9ca;
  379. padding: 20rpx;
  380. margin-bottom: 20rpx;
  381. height: 140px;
  382. }
  383. .imglist_left {
  384. width: 50%;
  385. position: relative;
  386. image {
  387. position: absolute;
  388. top: 0;
  389. left: 0;
  390. width: 100%;
  391. height: 100%;
  392. }
  393. }
  394. .imglist_right {
  395. margin-left: 40rpx;
  396. padding-top: 26rpx;
  397. position: relative;
  398. p{
  399. line-height: 24px;
  400. }
  401. .icon_box {
  402. position: absolute;
  403. top: -12rpx;
  404. right: -42rpx;
  405. // margin-bottom: 12rpx;
  406. font-size: 24rpx;
  407. .yficonfont {
  408. margin-right: 20rpx;
  409. color: #ff5951;
  410. font-size: 32rpx;
  411. }
  412. }
  413. p:last-child {
  414. margin-bottom: 0;
  415. }
  416. }
  417. }
  418. .top {
  419. position: fixed;
  420. right: 30px;
  421. bottom: 100px;
  422. z-index: 100;
  423. image {
  424. width: 100rpx;
  425. height: 100rpx;
  426. }
  427. }
  428. .tab-box {
  429. font-size: 30rpx;
  430. line-height: 80rpx;
  431. background-color: #ffffff;
  432. width: 100vw;
  433. z-index: 2;
  434. margin-top: -10rpx;
  435. }
  436. </style>