t-o-news-tab-2.vue 13 KB

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