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