t-o-news-tab-1.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view>
  3. <scroll-view scroll-x>
  4. <view class="tab">
  5. <view class="item" @click="change_active(index,item)" v-for="(item,index) in fiveFixedCategory"
  6. :key="index">
  7. <view class="text" :class="active == index?'active':''">{{item}}</view>
  8. </view>
  9. </view>
  10. </scroll-view>
  11. <view class="list">
  12. <view class="item" v-for="(item,index) in list" :key="index" v-if="item.table_data.length > 0">
  13. <view class="title">{{item.title}}</view>
  14. <view class="tubiao">
  15. <view class="tubiao_box">
  16. <view class="charts-box">
  17. <qiun-data-charts type="pie" :opts="pie_1" :chartData="item.chartData" @getIndex="legend_click($event,item.title,item.table,item.num,index)" tooltipFormat="column_1" />
  18. </view>
  19. </view>
  20. <view class="tubiao_line">
  21. <view class="line">
  22. <view class="lable">起始时间</view>
  23. <picker mode="date" :value="item.date_start" @change="bindDateChange_start($event,index,item.table)">
  24. <view class="text">
  25. <view>{{item.date_start}}</view>
  26. <view>
  27. <uni-icons type="arrowdown" size="14" color="#999"></uni-icons>
  28. </view>
  29. </view>
  30. </picker>
  31. </view>
  32. <view class="line">
  33. <view class="lable">结束时间</view>
  34. <picker mode="date" :value="item.date_end" @change="bindDateChange_end($event,index,item.table)">
  35. <view class="text">
  36. <view>{{item.date_end}}</view>
  37. <view>
  38. <uni-icons type="arrowdown" size="14" color="#999"></uni-icons>
  39. </view>
  40. </view>
  41. </picker>
  42. </view>
  43. </view>
  44. </view>
  45. <uni-table border emptyText="暂无更多数据">
  46. <!-- 表头行 -->
  47. <uni-tr>
  48. <uni-th align="center" width="60">序号</uni-th>
  49. <uni-th align="center" v-for="(item_2,index_2) in item.name">{{item_2}}</uni-th>
  50. </uni-tr>
  51. <!-- 表格数据行 -->
  52. <uni-tr v-for="(item_2,index_2) in item.table_data" :key="index_2" @row-click="go_detail(item.num,item_2.id)">
  53. <uni-td style="vertical-align: middle;" align="center">
  54. <view class="icon">
  55. <image v-if="index_2 < 3" src="./icon/new.png" mode=""></image> <text
  56. style="margin-left: 10rpx;">{{index_2+1}}</text>
  57. <!-- <text style="margin-left: 10rpx;">{{index_2+1}}</text> -->
  58. </view>
  59. </uni-td>
  60. <uni-td style="vertical-align: middle;" align="center" v-for="(item_3,index_3) in item_2"
  61. :key="index_3" v-if="typeof(item_3) == 'string' || typeof(item_3) == 'object'">
  62. <view v-if="typeof(item_3) == 'object'" style="display: flex;align-items: center;">
  63. <image style="margin-right: 10rpx;" v-for="(item_4,index_4) in item_3" :src="item_4"
  64. :key="index_4">
  65. </image>
  66. </view>
  67. <view v-else>{{item_3}}</view>
  68. </uni-td>
  69. </uni-tr>
  70. </uni-table>
  71. <view class="btn">
  72. <view class="icon">
  73. <image src="./icon/btn.png" mode=""></image>
  74. </view>
  75. <view class="btn_text" @click="go_all_list(item.title,item.table,item.num)">点击查看全部信息</view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. getNextDate
  84. } from "@/common/time.js"
  85. export default {
  86. name: "t-o-news-tab-1",
  87. data() {
  88. const currentDate_end = this.getDate({
  89. format: true
  90. })
  91. return {
  92. active: 0,
  93. // 五定表分类
  94. fiveFixedCategory: [],
  95. // 五定表列表
  96. list: [],
  97. // 图表数据
  98. // chartData: {
  99. // "series": [{
  100. // "data": [{
  101. // "name": "已完成",
  102. // "value": 23
  103. // }, {
  104. // "name": "未完成",
  105. // "value": 30
  106. // }]
  107. // }]
  108. // },
  109. pie_1: {
  110. "color": [
  111. "#1890FF",
  112. "#EE6666"
  113. ],
  114. "dataLabel": true,
  115. "legend": {
  116. // "show":false,
  117. "position": "bottom",
  118. "float": "center",
  119. "lineHeight": 20,
  120. },
  121. "title": {
  122. "name": " "
  123. },
  124. "subtitle": {
  125. "name": " "
  126. },
  127. },
  128. // 起始时间
  129. date_start: "",
  130. // 结束时间
  131. date_end: currentDate_end,
  132. };
  133. },
  134. mounted() {
  135. this.date_start = getNextDate(this.date_end, -30)
  136. this.get_five_fixed_fiveFixedCategory()
  137. },
  138. methods: {
  139. change_active(index, item) {
  140. this.active = index
  141. this.get_list(item)
  142. },
  143. // 五定表分类
  144. get_five_fixed_fiveFixedCategory() {
  145. this.$api.five_fixed_fiveFixedCategory({
  146. }).then((res) => {
  147. // console.log(res)
  148. this.fiveFixedCategory = res.data.content.data
  149. this.get_list(res.data.content.data[0])
  150. })
  151. },
  152. // 五定表列表
  153. get_list(category_name) {
  154. uni.showLoading({
  155. mask: true
  156. })
  157. this.$api.five_fixed_fiveFixed({
  158. category_name: category_name
  159. }).then((res) => {
  160. uni.hideLoading()
  161. this.list = res.data.content.data
  162. })
  163. },
  164. go_all_list(title, table, num) {
  165. uni.navigateTo({
  166. url: "../../origanization/news/tab_1/all_list/all_list?title=" + title + "&table=" + table + "&num=" + num + "&status=" + ''
  167. })
  168. },
  169. bindDateChange_start($event,index,table){
  170. // console.log($event.detail.value,index,table)
  171. this.date_start = $event.detail.value
  172. this.list[index].date_start = $event.detail.value
  173. this.get_five_fixed_getYesOrNoDataByTableName(index,table)
  174. },
  175. bindDateChange_end($event,index,table){
  176. // console.log($event.detail.value,index,table)
  177. this.date_end = $event.detail.value
  178. this.list[index].date_end = $event.detail.value
  179. this.get_five_fixed_getYesOrNoDataByTableName(index,table)
  180. },
  181. getDate(type) {
  182. const date = new Date();
  183. let year = date.getFullYear();
  184. let month = date.getMonth() + 1;
  185. let day = date.getDate();
  186. if (type === 'start') {
  187. year = year - 60;
  188. } else if (type === 'end') {
  189. year = year + 2;
  190. }
  191. month = month > 9 ? month : '0' + month;
  192. day = day > 9 ? day : '0' + day;
  193. return `${year}-${month}-${day}`;
  194. },
  195. // 刷新获取图表数据
  196. get_five_fixed_getYesOrNoDataByTableName(index,table) {
  197. this.$api.five_fixed_getYesOrNoDataByTableName({
  198. table_name: table,
  199. date_start: this.date_start,
  200. date_end: this.date_end
  201. }).then((res) => {
  202. console.log(res)
  203. this.list[index].chartData = res.data.content.data[0].chartData
  204. })
  205. },
  206. go_detail(num,id){
  207. console.log(num,id)
  208. uni.navigateTo({
  209. url:"../../origanization/news/tab_2/all_list/detail/detail?table=" + num + "&id=" + id
  210. })
  211. },
  212. legend_click($event,title,table,num,index){
  213. console.log($event.currentIndex)
  214. let status = $event.currentIndex+1
  215. uni.navigateTo({
  216. url: "../../origanization/news/tab_1/all_list/all_list?title=" + title + "&table=" + table + "&num=" + num + "&status=" + status + "&date_start=" + this.list[index].date_start + "&date_end=" + this.list[index].date_end
  217. })
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang="scss">
  223. .uni-table-th.table--border {
  224. color: #000000;
  225. background-color: #D8D8D8;
  226. }
  227. .uni-table-td.table--border {
  228. color: #666666;
  229. }
  230. .tab {
  231. display: flex;
  232. margin-bottom: 20rpx;
  233. background-color: #FFFFFF;
  234. box-sizing: border-box;
  235. padding: 0 20rpx;
  236. .item {
  237. background-color: #FFFFFF;
  238. .text {
  239. box-sizing: border-box;
  240. height: 90rpx;
  241. line-height: 90rpx;
  242. width: 188rpx;
  243. text-align: center;
  244. overflow: hidden;
  245. white-space: nowrap;
  246. text-overflow: ellipsis;
  247. font-size: 30rpx;
  248. color: #666666;
  249. }
  250. .active {
  251. font-weight: 700;
  252. color: #000000;
  253. border-bottom: 4rpx solid #009FE8;
  254. }
  255. }
  256. }
  257. .list {
  258. box-sizing: border-box;
  259. padding: 0 25rpx;
  260. .item {
  261. position: relative;
  262. margin-bottom: 20rpx;
  263. width: 700rpx;
  264. background-color: #FFFFFF;
  265. border-radius: 20rpx;
  266. box-sizing: border-box;
  267. padding: 0 25rpx;
  268. padding-bottom: 20rpx;
  269. .title {
  270. text-align: center;
  271. height: 120rpx;
  272. line-height: 120rpx;
  273. font-size: 40rpx;
  274. font-weight: 700;
  275. overflow: hidden;
  276. white-space: nowrap;
  277. text-overflow: ellipsis;
  278. }
  279. .btn {
  280. margin: 20rpx auto;
  281. width: 400rpx;
  282. height: 50rpx;
  283. background-color: #69BBFA;
  284. border-radius: 50rpx;
  285. display: flex;
  286. align-items: center;
  287. justify-content: center;
  288. .icon {
  289. image {
  290. width: 23rpx;
  291. height: 24rpx;
  292. display: block;
  293. }
  294. }
  295. .btn_text {
  296. margin-left: 10rpx;
  297. font-size: 28rpx;
  298. color: #FFFFFF;
  299. }
  300. }
  301. }
  302. }
  303. .icon {
  304. position: relative;
  305. top: 0;
  306. right: 0;
  307. image {
  308. width: 33rpx;
  309. height: 18rpx;
  310. }
  311. }
  312. image {
  313. width: 80rpx;
  314. height: 80rpx;
  315. display: block;
  316. }
  317. .tubiao {
  318. position: relative;
  319. width: 640rpx;
  320. background-color: #FFFFFF;
  321. // height: 900rpx;
  322. border-radius: 20rpx;
  323. box-sizing: border-box;
  324. padding: 25rpx;
  325. .tubiao_box {
  326. width: 640rpx;
  327. height: 640rpx;
  328. display: flex;
  329. justify-content: center;
  330. align-items: top;
  331. .charts-box {
  332. width: 100%;
  333. height: 640rpx;
  334. }
  335. }
  336. .tubiao_line {
  337. padding-top: 20rpx;
  338. width: 650rpx;
  339. border-top: 2rpx solid #f7f7f7;
  340. .line {
  341. display: flex;
  342. align-items: center;
  343. font-size: 30rpx;
  344. margin-bottom: 10rpx;
  345. .lable {
  346. color: #666666;
  347. width: 200rpx;
  348. }
  349. .text {
  350. width: 400rpx;
  351. border-radius: 8rpx;
  352. border: 2rpx solid #E9EBF2;
  353. box-sizing: border-box;
  354. padding: 10rpx 25rpx;
  355. display: flex;
  356. justify-content: space-between;
  357. }
  358. }
  359. }
  360. }
  361. </style>