index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view class="page-wrap">
  3. <uni-section title="铜川市印台区应急管理局">
  4. <template v-slot:decoration>
  5. <view class="decoration">
  6. <image class="icon" src="/static/images/admin_icon.png"></image>
  7. </view>
  8. </template>
  9. <view class="tab-container">
  10. <view class="item" @click="linkTo('duty')">
  11. <view class="icon">
  12. <image src="/static/images/duty.png" mode=""></image>
  13. </view>
  14. <view class="name">应急值守</view>
  15. </view>
  16. <view class="item" @click="linkTo('team')">
  17. <view class="icon">
  18. <image src="/static/images/team.png" mode=""></image>
  19. </view>
  20. <view class="name">队伍建设</view>
  21. </view>
  22. <view class="item" @click="linkTo('goods')">
  23. <view class="icon">
  24. <image src="/static/images/goods.png" mode=""></image>
  25. </view>
  26. <view class="name">物资储备</view>
  27. </view>
  28. <view class="item" @click="linkTo('industry')">
  29. <view class="icon">
  30. <image src="/static/images/industry.png" mode=""></image>
  31. </view>
  32. <view class="name">行业管理</view>
  33. </view>
  34. <view class="item" @click="linkTo('danger')">
  35. <view class="icon">
  36. <image src="/static/images/danger.png" mode=""></image>
  37. </view>
  38. <view class="name">隐患管理</view>
  39. </view>
  40. <view class="item" @click="linkTo('disaster')">
  41. <view class="icon">
  42. <image src="/static/images/disaster.png" mode=""></image>
  43. </view>
  44. <view class="name">自然灾害</view>
  45. </view>
  46. </view>
  47. </uni-section>
  48. <div class="duty-conatiner">
  49. <uni-section title="值班情况">
  50. <template v-slot:decoration>
  51. <view class="decoration">
  52. <image class="icon" src="/static/images/duty_icon.png"></image>
  53. </view>
  54. </template>
  55. <view class="filter-box">
  56. <view class="bt lf" @click="changeDate(-1)">
  57. <uni-icons type="left" color="#777" size="30"></uni-icons>
  58. </view>
  59. <view class="time">{{dutyDate}}</view>
  60. <view class="bt rt" @click="changeDate(1)">
  61. <uni-icons type="right" color="#777" size="30"></uni-icons>
  62. </view>
  63. </view>
  64. <view class="duty-item" v-for="(duty,index) in dutys" :key="duty.accountId">
  65. <view class="avatar">
  66. <image class="icon" src="/static/images/avatar.png" mode=""></image>
  67. </view>
  68. <view class="info">
  69. <view class="top">
  70. <view class="posName">
  71. <text>{{duty.posName}}</text>
  72. </view>
  73. <view class="posbox">
  74. <view class="positionName">
  75. <uni-tag :inverted="true" :text="duty.positionName" type="success" size="small"></uni-tag>
  76. </view>
  77. <view class="groupName">
  78. <uni-tag :inverted="true" :text="duty.groupName" type="primary" size="small"></uni-tag>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="bottom">
  83. <view class="user">
  84. <div class="userinfo">
  85. <image class="icon" src="/static/images/user.png"></image>
  86. <view class="name">{{duty.accountName}}</view>
  87. </div>
  88. </view>
  89. <view class="phone" @click="callPhone(duty.accountPhone)">
  90. <image class="icon" src="/static/images/phone.png"></image>
  91. <view class="phoneNumber">{{duty.accountPhone||'未填写'}}</view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="isEmpty" v-if="dutys.length<1">
  97. 暂无数据
  98. </view>
  99. </uni-section>
  100. </div>
  101. <div class="item-conatiner">
  102. <uni-section title="统计分析">
  103. <template v-slot:decoration>
  104. <view class="decoration">
  105. <image class="icon" src="/static/images/statistics_icon.png"></image>
  106. </view>
  107. </template>
  108. <view class="statisticsTabs">
  109. <uni-segmented-control :current="statisticsIdx" :values="statisticsTabs" style-type="text" active-color="#007aff" @clickItem="changeStatics" />
  110. </view>
  111. <view class="statisticscont">
  112. <uni-table border stripe emptyText="暂无更多数据" >
  113. <uni-tr>
  114. <uni-th align="center" width='50'>序号</uni-th>
  115. <uni-th align="center">{{statisticsData.name}}</uni-th>
  116. <uni-th align="center">{{statisticsData.unit}}</uni-th>
  117. </uni-tr>
  118. <uni-tr v-for="(item,idx) in statisticsData.items" :key="idx">
  119. <uni-td align="center">{{idx+1}}</uni-td>
  120. <uni-td align="center">{{item.name}}</uni-td>
  121. <uni-td align="center">{{item.num}}</uni-td>
  122. </uni-tr>
  123. </uni-table>
  124. </view>
  125. <uni-card margin='10px 0' padding='0'>
  126. <StatisticsChart :data='chartdata'></StatisticsChart>
  127. </uni-card>
  128. </uni-section>
  129. </div>
  130. </view>
  131. </template>
  132. <script>
  133. import StatisticsChart from '@/components/IndexBarChart.vue'
  134. import Echart from '@/components/Echart.vue'
  135. import dutyApi from '@/api/duty.js'
  136. import teamApi from '@/api/team.js'
  137. import goodsApi from '@/api/goods.js'
  138. import industryApi from '@/api/industry.js'
  139. import dangerApi from '@/api/danger.js'
  140. import {parseTime} from '@/libs/index.js'
  141. export default {
  142. components:{
  143. StatisticsChart
  144. },
  145. data() {
  146. return {
  147. dutys: [],
  148. statisticsIdx:0,
  149. dutyDate:parseTime(new Date(),'{y}-{m}-{d}'),
  150. statisticsTabs: ['队伍建设', '物资储备', '行业管理', '隐患管理'],
  151. statisticsData:{
  152. name:"救援队",unit:"人数",
  153. items:[]
  154. },
  155. chartdata:{yData:[],xData:[]}
  156. }
  157. },
  158. onShow() {
  159. this.init()
  160. },
  161. methods: {
  162. init(){
  163. this.getdutyData();
  164. this.getStatisticsData()
  165. },
  166. changeDate(step){
  167. let date=new Date(this.dutyDate)
  168. date.setDate(date.getDate()+step)
  169. this.dutyDate=parseTime(date,'{y}-{m}-{d}')
  170. this.getdutyData()
  171. },
  172. getdutyData(){
  173. dutyApi.getAllByList({dutyDate:this.dutyDate}).then((res)=>{
  174. this.dutys=res.data
  175. })
  176. },
  177. getStatisticsData(){
  178. if(this.statisticsIdx===0){
  179. teamApi.counterByMember().then((res)=>{
  180. let data=res.data;
  181. this.statisticsData.items=data.map(item=>{
  182. return{
  183. name:item.teamName,
  184. num:item.count
  185. }
  186. });
  187. })
  188. teamApi.counterByCat().then((res)=>{
  189. let data=res.data;
  190. this.chartdata={
  191. yData:data.map(item=>item.count),
  192. xData:data.map(item=>item.teamCatTitle),
  193. name:"队伍建设"
  194. }
  195. })
  196. }
  197. if(this.statisticsIdx===1){
  198. goodsApi.totalByCat().then((res)=>{
  199. let data=res.data;
  200. this.statisticsData.items=data.map(item=>{
  201. return{
  202. name:item.goodsCatTitle,
  203. num:item.total
  204. }
  205. });
  206. this.chartdata={
  207. yData:data.map(item=>item.total),
  208. xData:data.map(item=>item.goodsCatTitle),
  209. name:"数量"
  210. }
  211. })
  212. }
  213. if(this.statisticsIdx===2){
  214. industryApi.counterByGroup().then((res)=>{
  215. let data=res.data;
  216. this.statisticsData.items=data.map(item=>{
  217. return{
  218. name:item.groupName,
  219. num:item.count
  220. }
  221. });
  222. })
  223. industryApi.counterByCat().then((res)=>{
  224. let data=res.data;
  225. this.chartdata={
  226. yData:data.map(item=>item.count),
  227. xData:data.map(item=>item.entCatTitle),
  228. name:"企业/单位数目"
  229. }
  230. })
  231. }
  232. if(this.statisticsIdx===3){
  233. dangerApi.counterByGroup().then((res)=>{
  234. let data=res.data;
  235. this.statisticsData.items=data.map(item=>{
  236. return{
  237. name:item.groupName,
  238. num:item.count
  239. }
  240. });
  241. })
  242. dangerApi.counterByCat().then((res)=>{
  243. let data=res.data;
  244. this.chartdata={
  245. yData:data.map(item=>item.count),
  246. xData:data.map(item=>item.dangerCatTitle),
  247. name:"隐患数目"
  248. }
  249. })
  250. }
  251. },
  252. linkTo(type){
  253. uni.navigateTo({
  254. url:`/packageA/pages/${type}/index`
  255. })
  256. },
  257. changeStatics({currentIndex}) {
  258. if (this.statisticsIdx !== currentIndex) {
  259. this.statisticsIdx = currentIndex
  260. let ths=[{name:"救援队",unit:"人数"},{name:"物资分类",unit:"数量"},{name:"监管单位",unit:"企业/单位数目"},{name:"监管单位",unit:"隐患数目"}]
  261. this.statisticsData={
  262. name:ths[currentIndex].name,unit:ths[currentIndex].unit,
  263. items:[]
  264. },
  265. this.getStatisticsData()
  266. }
  267. },
  268. callPhone(phoneNumber) {
  269. if(!phoneNumber)return
  270. wx.makePhoneCall({
  271. phoneNumber
  272. })
  273. }
  274. }
  275. }
  276. </script>
  277. <style lang="scss" scoped>
  278. .page-wrap{
  279. padding: 20rpx;
  280. background-color: #f5f5f5;
  281. .decoration{
  282. padding-right: 6rpx;
  283. image{
  284. display: block;
  285. width: 30rpx;
  286. height: 30rpx;
  287. }
  288. }
  289. .tab-container{
  290. background: #fff;
  291. display: flex;
  292. justify-content: space-between;
  293. align-items: center;
  294. flex-wrap: wrap;
  295. padding-bottom: 20rpx;
  296. .item{
  297. width: 33.33%;
  298. display: flex;
  299. justify-content: space-between;
  300. align-items: center;
  301. flex-direction: column;
  302. padding: 0 10rpx 20rpx;
  303. box-sizing: border-box;
  304. .icon{
  305. width: 80rpx;
  306. height: 80rpx;
  307. image{
  308. display: block;
  309. width: 80rpx;
  310. height: 80rpx;
  311. }
  312. }
  313. .name{
  314. padding-top: 16rpx;
  315. line-height: 1;
  316. font-size: 28rpx;
  317. color: #222222;
  318. text-align: center;
  319. }
  320. }
  321. }
  322. .duty-conatiner{
  323. margin-top: 40rpx;
  324. padding-bottom: 10rpx;
  325. background-color: #fff;
  326. .filter-box{
  327. display: flex;
  328. justify-content: center;
  329. align-items: center;
  330. padding-bottom: 20rpx;
  331. .time{
  332. padding:16rpx 20rpx;
  333. width: 260rpx;
  334. border: 1px solid #ddd;
  335. text-align: center;
  336. border-radius: 6px;
  337. margin: 0 40rpx;
  338. font-size: 32rpx;
  339. line-height: 1;
  340. color: #424242;
  341. font-weight: 600;
  342. box-shadow:0 0 4px rgba(0, 0, 0, 0.2);
  343. }
  344. }
  345. .isEmpty{
  346. text-align: center;
  347. font-size: 36rpx;
  348. line-height: 1;
  349. padding: 36rpx;
  350. color: #999999;
  351. background-color: #f8f8f8;
  352. }
  353. .duty-item{
  354. display: flex;
  355. justify-content: space-between;
  356. align-items: center;
  357. position: relative;
  358. box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
  359. padding: 20rpx 14rpx;
  360. margin: 20rpx;
  361. .icon,.icon image{
  362. display: block;
  363. width: 30rpx;
  364. height: 30rpx;
  365. flex-shrink: 0;
  366. }
  367. .avatar {
  368. image{
  369. width: 60rpx;
  370. height: 60rpx;
  371. }
  372. }
  373. .posbox{
  374. // display: flex;
  375. // align-items: center;
  376. // justify-content: space-between;
  377. padding: 20rpx 0;
  378. // .groupName,.positionName{
  379. // width: 45%;
  380. // overflow: hidden;
  381. // text-overflow: ellipsis;
  382. // &.positionName{
  383. // display: flex;
  384. // align-items: center;
  385. // justify-content: flex-end;
  386. // }
  387. // }
  388. .groupName{
  389. margin-top: 16rpx;
  390. }
  391. }
  392. .info{
  393. flex: 1;
  394. padding:0 14rpx;
  395. .user,.phone{
  396. display: flex;
  397. align-items: center;
  398. .name,.phoneNumber{
  399. color: #999;
  400. font-size: 12px;
  401. font-weight: normal;
  402. // overflow: hidden;
  403. line-height: 1;
  404. }
  405. }
  406. .user{
  407. padding: 10rpx 0;
  408. .userinfo{
  409. display: flex;
  410. align-items: center;
  411. }
  412. }
  413. .bottom {
  414. display: flex;
  415. justify-content: space-between;
  416. align-items: center;
  417. }
  418. }
  419. }
  420. }
  421. .statisticsTabs{
  422. padding: 0 16rpx 40rpx 16rpx;
  423. }
  424. .statisticscont{
  425. padding:0 16rpx;
  426. }
  427. }
  428. </style>