t-o-news-tab-2 - 副本.vue 15 KB

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