t-o-news-tab-2 - 一二级分类没有矿区选择.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <view>
  3. <!-- 标题 -->
  4. <view class="title" @click="open_menu()">
  5. <view class="left">
  6. <view class="icon">
  7. <image src="./icon/menu.png" mode=""></image>
  8. </view>
  9. <view class="text">{{title}}</view>
  10. </view>
  11. <view class="right">
  12. <view class="icon">
  13. <image src="./icon/right_icon.png" mode=""></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="menu" v-show="menu">
  18. <view class="menu_item">
  19. <view class="left">
  20. <view class="item" v-for="(item,index) in menu_1" :key="index" @click="change_active_1(index)"
  21. :class="active_1 == index ? 'active' : ''">{{item}}</view>
  22. </view>
  23. <view class="right">
  24. <view class="item" v-for="(item,index) in menu_2" :key="index" @click="change_active_2(index)">
  25. <view class="icon" v-if="active_2 == index">
  26. <image src="./icon/active.png" mode=""></image>
  27. </view>
  28. <view class="text" :style="{color: active_2 == index ? '#000' : ''}">{{item.title}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="list">
  34. <view class="tubiao" v-if="title != '全部'">
  35. <view class="tubiao_title">
  36. <view class="text">{{tubiao_title}}</view>
  37. </view>
  38. <view class="tubiao_box">
  39. <view class="charts-box">
  40. <qiun-data-charts type="pie" :opts="pie_1" :chartData="chartData"
  41. @getIndex="legend_click($event)" tooltipFormat="column_1" />
  42. </view>
  43. </view>
  44. <view class="tubiao_line">
  45. <view class="line">
  46. <view class="lable">起始时间</view>
  47. <picker mode="date" :value="date_start" @change="bindDateChange_start">
  48. <view class="text">
  49. <view>{{date_start}}</view>
  50. <view>
  51. <uni-icons type="arrowdown" size="14" color="#999"></uni-icons>
  52. </view>
  53. </view>
  54. </picker>
  55. </view>
  56. <view class="line">
  57. <view class="lable">结束时间</view>
  58. <picker mode="date" :value="date_end" @change="bindDateChange_end">
  59. <view class="text">
  60. <view>{{date_end}}</view>
  61. <view>
  62. <uni-icons type="arrowdown" size="14" color="#999"></uni-icons>
  63. </view>
  64. </view>
  65. </picker>
  66. </view>
  67. <view class="line">
  68. <view class="lable">统计项</view>
  69. <view class="text" @click="change_census_type()">
  70. <view>
  71. {{tubiao_census_type}}
  72. </view>
  73. <view>
  74. <uni-icons type="arrowdown" size="14" color="#999"></uni-icons>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="item" v-for="(item,index) in data" :key="index" @click="go_detail(item.num,item.id)">
  81. <view class="inner">
  82. <view class="left">
  83. <view class="user"
  84. v-if="item.face != 'http://localhost/storage/avatar/avatar_15042504.png' && item.face != 'upload/face/1.jpg'">
  85. <image :src="item.face" mode="aspectFill"></image>
  86. </view>
  87. <view class="user"
  88. v-if="item.face == 'http://localhost/storage/avatar/avatar_15042504.png' || item.face == 'upload/face/1.jpg'">
  89. <view class="avatar">{{item.optname.split('')[0]}}</view>
  90. </view>
  91. </view>
  92. <view class="right">
  93. <view class="name">{{item.optname}}<text>{{item.depart}}</text><text
  94. style="font-size: 36rpx;font-weight: 700;">隐患排查记录</text></view>
  95. <view class="text">
  96. <view v-html="item.str"></view>
  97. </view>
  98. <view class="img_box">
  99. <!-- <view v-for="(item_2,index_2) in item.picture" :key="index_2">
  100. <view class="img" v-for="(item_3,index_3) in item_2" :key="index_3">
  101. <image :src="item_3" mode="aspectFill" @click.stop="img_chakan(item_3)"></image>
  102. </view>
  103. </view> -->
  104. <view class="img_box" v-for="(item_2,index_2) in item.picture" :key="index_2">
  105. <view class="img" v-for="(item_3,index_3) in item_2" :key="index_3"
  106. @click.stop="img_chakan(item_2,index_3)">
  107. <image :src="item_3" mode="aspectFill"></image>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="time">{{item.optdt}}</view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. import {
  120. getNextDate
  121. } from "@/common/time.js"
  122. export default {
  123. name: "t-o-news-tab-2",
  124. data() {
  125. const currentDate_end = this.getDate({
  126. format: true
  127. })
  128. return {
  129. title: "全部",
  130. menu: false,
  131. menu_1: [],
  132. menu_2: [],
  133. active_1: 0,
  134. active_2: 0,
  135. // list
  136. table: "",
  137. page: 1,
  138. pageSize: 20,
  139. name: [],
  140. data: [],
  141. // 图表数据
  142. tubiao_title: "",
  143. // 图表数据
  144. chartData: {
  145. "series": [{
  146. "data": []
  147. }]
  148. },
  149. pie_1: {
  150. "dataLabel": true,
  151. "legend": {
  152. // "show":false,
  153. "position": "bottom",
  154. "float": "center",
  155. "lineHeight": 20,
  156. },
  157. "title": {
  158. "name": " "
  159. },
  160. "subtitle": {
  161. "name": " "
  162. },
  163. },
  164. // 起始时间
  165. date_start: "",
  166. // 结束时间
  167. date_end: currentDate_end,
  168. // 图标统计项
  169. tubiao_census_type: "",
  170. tubiao_census_type_fields: "",
  171. // 统计项配置参数
  172. TableFiledRemark: [],
  173. TableFiledRemark_name: []
  174. };
  175. },
  176. mounted() {
  177. this.get_five_fixed_fiveFixedCategory()
  178. this.get_five_fixed_getRecordDataByTableName()
  179. this.date_start = getNextDate(this.date_end, -30)
  180. },
  181. methods: {
  182. // 翻页
  183. nextPage() {
  184. this.page++
  185. this.get_five_fixed_getRecordDataByTableName()
  186. },
  187. open_menu() {
  188. this.menu = !this.menu
  189. },
  190. change_active_1(index) {
  191. this.active_1 = index
  192. this.active_2 = 0
  193. this.title = this.menu_1[index]
  194. this.get_five_fixed_getRecordDataByCategoryName(this.menu_1[index])
  195. },
  196. change_active_2(index) {
  197. this.active_2 = index
  198. this.title = this.menu_2[index].title
  199. this.tubiao_title = this.menu_2[index].title
  200. // 当前详情参数
  201. this.table = this.menu_2[index].table
  202. // 获取图表数据
  203. this.date_end = this.getDate()
  204. this.date_start = getNextDate(this.date_end, -30)
  205. this.get_five_fixed_getTableFiledRemark()
  206. // 获取列表
  207. this.page = 1
  208. this.data = []
  209. this.get_five_fixed_getRecordDataByTableName()
  210. this.open_menu()
  211. },
  212. // 记录管理分类
  213. get_five_fixed_fiveFixedCategory() {
  214. this.$api.five_fixed_fiveFixedCategory({
  215. }).then((res) => {
  216. this.menu_1 = res.data.content.data
  217. this.get_five_fixed_getRecordDataByCategoryName(res.data.content.data[0])
  218. })
  219. },
  220. // 获取记录管理列表
  221. get_five_fixed_getRecordDataByCategoryName(category_name) {
  222. uni.showLoading({
  223. mask: true
  224. })
  225. this.$api.five_fixed_getRecordDataByCategoryName({
  226. category_name: category_name
  227. }).then((res) => {
  228. uni.hideLoading()
  229. this.menu_2 = res.data.content.data
  230. })
  231. },
  232. // 获取该分类下的列表详情
  233. get_five_fixed_getRecordDataByTableName() {
  234. console.log(this.table)
  235. this.$api.five_fixed_getRecordDataByTableName({
  236. table_name: this.table,
  237. page: this.page,
  238. pageSize: this.pageSize
  239. }).then((res) => {
  240. console.log(res.data.content.data.table_data.data)
  241. this.data = this.data.concat(res.data.content.data.table_data.data)
  242. })
  243. },
  244. img_chakan(url, index) {
  245. // let data = []
  246. // data[0] = url
  247. // uni.previewImage({
  248. // urls: data
  249. // });
  250. console.log(url, index)
  251. uni.previewImage({
  252. current: index,
  253. urls: url,
  254. loop: true,
  255. longPressActions: true
  256. });
  257. },
  258. go_detail(num, id) {
  259. uni.navigateTo({
  260. url: "../../origanization/news/tab_2/all_list/detail/detail?table=" + num + "&id=" + id
  261. })
  262. },
  263. bindDateChange_start: function(e) {
  264. this.date_start = e.target.value
  265. this.get_five_fixed_getTableFiledTotalNumber()
  266. },
  267. bindDateChange_end: function(e) {
  268. this.date_end = e.target.value
  269. this.get_five_fixed_getTableFiledTotalNumber()
  270. },
  271. getDate(type) {
  272. const date = new Date();
  273. let year = date.getFullYear();
  274. let month = date.getMonth() + 1;
  275. let day = date.getDate();
  276. if (type === 'start') {
  277. year = year - 60;
  278. } else if (type === 'end') {
  279. year = year + 2;
  280. }
  281. month = month > 9 ? month : '0' + month;
  282. day = day > 9 ? day : '0' + day;
  283. return `${year}-${month}-${day}`;
  284. },
  285. // 获取统计项参数配置
  286. get_five_fixed_getTableFiledRemark() {
  287. uni.showLoading({
  288. mask: true
  289. })
  290. this.TableFiledRemark_name = []
  291. this.$api.five_fixed_getTableFiledRemark({
  292. table_name: this.table
  293. }).then((res) => {
  294. uni.hideLoading()
  295. this.TableFiledRemark = res.data.content.data
  296. let data = res.data.content.data
  297. data.forEach((item, index) => {
  298. this.TableFiledRemark_name.push(item.name)
  299. })
  300. this.tubiao_census_type = this.TableFiledRemark[0].name
  301. this.tubiao_census_type_fields = this.TableFiledRemark[0].fields
  302. this.get_five_fixed_getTableFiledTotalNumber()
  303. })
  304. },
  305. // 改变统计项
  306. change_census_type() {
  307. uni.showActionSheet({
  308. itemList: this.TableFiledRemark_name,
  309. success: (res) => {
  310. this.tubiao_census_type = this.TableFiledRemark[res.tapIndex].name
  311. this.tubiao_census_type_fields = this.TableFiledRemark[res.tapIndex].fields
  312. this.get_five_fixed_getTableFiledTotalNumber()
  313. }
  314. });
  315. },
  316. // 获取图表数据
  317. get_five_fixed_getTableFiledTotalNumber() {
  318. this.$api.five_fixed_getTableFiledTotalNumber({
  319. table_name: this.table,
  320. field_name: this.tubiao_census_type_fields,
  321. start_date: this.date_start,
  322. end_date: this.date_end
  323. }).then((res) => {
  324. this.chartData.series[0].data = res.data.content.data
  325. })
  326. },
  327. legend_click($event) {
  328. let _this = this;
  329. let curTime = new Date().getTime();
  330. let lastTime = _this.lastTapDiffTime;
  331. _this.lastTapDiffTime = curTime;
  332. //两次点击间隔小于300ms, 认为是双击
  333. let diff = curTime - lastTime;
  334. if (diff < 300) {
  335. console.log("双击")
  336. //_this.handleVideo('screen',index)自定义事件
  337. clearTimeout(_this.lastTapTimeoutFunc); // 成功触发双击事件时,取消单击事件的执行
  338. uni.navigateTo({
  339. url: "../../origanization/news/tab_2/all_list/all_list?title=" + this.title + "&table=" + this
  340. .table + "&tubiao_census_type_fields=" + this.tubiao_census_type_fields +
  341. "&tubiao_census_type_fields_value=" + this.chartData.series[0].data[$event.currentIndex]
  342. .name.split('(')[0] + "&date_start=" + this.date_start + "&date_end=" + this.date_end
  343. })
  344. } else {
  345. // 单击事件延时300毫秒执行
  346. _this.lastTapTimeoutFunc = setTimeout(function() {
  347. console.log("单击")
  348. //_this.handleVideo('playOrStop',index)自定义事件
  349. }, 300);
  350. }
  351. }
  352. }
  353. }
  354. </script>
  355. <style lang="scss">
  356. .title {
  357. box-sizing: border-box;
  358. padding: 0 25rpx;
  359. height: 90rpx;
  360. display: flex;
  361. justify-content: space-between;
  362. align-items: center;
  363. .left {
  364. display: flex;
  365. .icon {
  366. image {
  367. width: 30rpx;
  368. height: 30rpx;
  369. }
  370. }
  371. .text {
  372. margin-left: 18rpx;
  373. font-size: 30rpx;
  374. color: #009fe8;
  375. }
  376. }
  377. .right {
  378. text-align: right;
  379. width: 50rpx;
  380. .icon {
  381. image {
  382. width: 18rpx;
  383. height: 18rpx;
  384. }
  385. }
  386. }
  387. }
  388. .menu {
  389. background-color: #FFFFFF;
  390. border-radius: 20rpx;
  391. margin: 0 25rpx;
  392. width: 700rpx;
  393. margin-bottom: 40rpx;
  394. overflow: hidden;
  395. .menu_item {
  396. display: flex;
  397. .left {
  398. .item {
  399. width: 260rpx;
  400. text-align: center;
  401. line-height: 120rpx;
  402. color: #8C8C8C;
  403. box-sizing: border-box;
  404. }
  405. .active {
  406. background-color: #F8FDFF;
  407. color: #00A0E8;
  408. border-left: 4rpx solid #00A0E8;
  409. }
  410. }
  411. .right {
  412. width: 420rpx;
  413. box-sizing: border-box;
  414. border-left: 4rpx solid #EEEEEE;
  415. .item {
  416. position: relative;
  417. line-height: 120rpx;
  418. display: flex;
  419. .icon {
  420. position: absolute;
  421. left: 0;
  422. top: 0;
  423. image {
  424. width: 14rpx;
  425. height: 26rpx;
  426. }
  427. }
  428. .text {
  429. margin-left: 48rpx;
  430. color: #8C8C8C;
  431. white-space: nowrap;
  432. overflow: hidden;
  433. text-overflow: ellipsis;
  434. }
  435. }
  436. }
  437. }
  438. }
  439. .list {
  440. background-color: #FFFFFF;
  441. box-sizing: border-box;
  442. padding: 25rpx;
  443. .item {
  444. border-bottom: 1rpx solid #f0f0f0;
  445. margin-bottom: 40rpx;
  446. .inner {
  447. margin-bottom: 40rpx;
  448. width: 700rpx;
  449. display: flex;
  450. .left {
  451. .user {
  452. image {
  453. width: 90rpx;
  454. height: 90rpx;
  455. border-radius: 50%;
  456. }
  457. .avatar {
  458. width: 90rpx;
  459. height: 90rpx;
  460. text-align: center;
  461. line-height: 90rpx;
  462. border-radius: 50%;
  463. background-color: #7EB1A0;
  464. color: #FFFFFF;
  465. font-size: 36rpx;
  466. font-weight: 700;
  467. }
  468. }
  469. }
  470. .right {
  471. margin-left: 20rpx;
  472. width: 650rpx;
  473. .name {
  474. margin-top: 5rpx;
  475. font-size: 32rpx;
  476. text {
  477. margin-left: 20rpx;
  478. font-size: 28rpx;
  479. color: #3a3a3a;
  480. }
  481. }
  482. .text {
  483. width: 600rpx;
  484. margin-top: 10rpx;
  485. margin-bottom: 20rpx;
  486. font-size: 30rpx;
  487. }
  488. .img_box {
  489. width: 550rpx;
  490. overflow: hidden;
  491. .img {
  492. margin-bottom: 10rpx;
  493. float: left;
  494. margin-right: 20rpx;
  495. image {
  496. width: 170rpx;
  497. height: 170rpx;
  498. border-radius: 10rpx;
  499. }
  500. }
  501. .img:nth-child(3n) {
  502. margin-right: 0;
  503. }
  504. }
  505. .time {
  506. font-size: 26rpx;
  507. color: #999999;
  508. }
  509. }
  510. }
  511. }
  512. }
  513. .tubiao {
  514. position: relative;
  515. width: 700rpx;
  516. background-color: #FFFFFF;
  517. // height: 900rpx;
  518. border-radius: 20rpx;
  519. box-sizing: border-box;
  520. padding: 25rpx;
  521. border-bottom: 2rpx solid #EEEEEE;
  522. margin-bottom: 40rpx;
  523. .tubiao_title {
  524. text-align: center;
  525. // height: 90rpx;
  526. .text {
  527. font-size: 38rpx;
  528. font-weight: 700;
  529. }
  530. }
  531. .tubiao_box {
  532. width: 650rpx;
  533. height: 640rpx;
  534. display: flex;
  535. justify-content: center;
  536. align-items: top;
  537. .charts-box {
  538. width: 100%;
  539. height: 640rpx;
  540. }
  541. }
  542. .tubiao_line {
  543. padding-top: 20rpx;
  544. width: 650rpx;
  545. border-top: 2rpx solid #f7f7f7;
  546. .line {
  547. display: flex;
  548. align-items: center;
  549. font-size: 30rpx;
  550. margin-bottom: 10rpx;
  551. .lable {
  552. color: #666666;
  553. width: 200rpx;
  554. }
  555. .text {
  556. width: 400rpx;
  557. border-radius: 8rpx;
  558. border: 2rpx solid #E9EBF2;
  559. box-sizing: border-box;
  560. padding: 10rpx 25rpx;
  561. display: flex;
  562. justify-content: space-between;
  563. }
  564. }
  565. }
  566. }
  567. </style>