index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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="groupName">
  75. <uni-tag :inverted="true" :text="duty.groupName" type="primary"></uni-tag>
  76. </view>
  77. <view class="positionName">
  78. <uni-tag :inverted="true" :text="duty.positionName" type="success"></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 dutyApi from '@/api/duty.js'
  135. import teamApi from '@/api/team.js'
  136. import goodsApi from '@/api/goods.js'
  137. import industryApi from '@/api/industry.js'
  138. import dangerApi from '@/api/danger.js'
  139. import {parseTime} from '@/libs/index.js'
  140. export default {
  141. components:{
  142. StatisticsChart
  143. },
  144. data() {
  145. return {
  146. dutys: [],
  147. statisticsIdx:0,
  148. dutyDate:parseTime(new Date(),'{y}-{m}-{d}'),
  149. statisticsTabs: ['队伍建设', '物资储备', '行业管理', '隐患管理'],
  150. statisticsData:{
  151. name:"救援队",unit:"人数",
  152. items:[]
  153. },
  154. chartdata:{yData:[],xData:[]}
  155. }
  156. },
  157. onShow() {
  158. this.init()
  159. },
  160. methods: {
  161. init(){
  162. this.getdutyData();
  163. this.getStatisticsData()
  164. },
  165. changeDate(step){
  166. let date=new Date(this.dutyDate)
  167. date.setDate(date.getDate()+step)
  168. this.dutyDate=parseTime(date,'{y}-{m}-{d}')
  169. this.getdutyData()
  170. },
  171. getdutyData(){
  172. dutyApi.getAllByList({dutyDate:this.dutyDate}).then((res)=>{
  173. this.dutys=res.data
  174. })
  175. },
  176. getStatisticsData(){
  177. if(this.statisticsIdx===0){
  178. teamApi.counterByMember().then((res)=>{
  179. let data=res.data;
  180. this.statisticsData.items=data.map(item=>{
  181. return{
  182. name:item.teamName,
  183. num:item.count
  184. }
  185. });
  186. })
  187. teamApi.counterByCat().then((res)=>{
  188. let data=res.data;
  189. this.chartdata={
  190. yData:data.map(item=>item.count),
  191. xData:data.map(item=>item.teamCatTitle),
  192. name:"队伍建设"
  193. }
  194. })
  195. }
  196. if(this.statisticsIdx===1){
  197. goodsApi.totalByCat().then((res)=>{
  198. let data=res.data;
  199. this.statisticsData.items=data.map(item=>{
  200. return{
  201. name:item.goodsCatTitle,
  202. num:item.total
  203. }
  204. });
  205. this.chartdata={
  206. yData:data.map(item=>item.total),
  207. xData:data.map(item=>item.goodsCatTitle),
  208. name:"数量"
  209. }
  210. })
  211. }
  212. if(this.statisticsIdx===2){
  213. industryApi.counterByGroup().then((res)=>{
  214. let data=res.data;
  215. this.statisticsData.items=data.map(item=>{
  216. return{
  217. name:item.groupName,
  218. num:item.count
  219. }
  220. });
  221. })
  222. industryApi.counterByCat().then((res)=>{
  223. let data=res.data;
  224. this.chartdata={
  225. yData:data.map(item=>item.count),
  226. xData:data.map(item=>item.entCatTitle),
  227. name:"企业/单位数目"
  228. }
  229. })
  230. }
  231. if(this.statisticsIdx===3){
  232. dangerApi.counterByGroup().then((res)=>{
  233. let data=res.data;
  234. this.statisticsData.items=data.map(item=>{
  235. return{
  236. name:item.groupName,
  237. num:item.count
  238. }
  239. });
  240. })
  241. dangerApi.counterByCat().then((res)=>{
  242. let data=res.data;
  243. this.chartdata={
  244. yData:data.map(item=>item.count),
  245. xData:data.map(item=>item.dangerCatTitle),
  246. name:"隐患数目"
  247. }
  248. })
  249. }
  250. },
  251. linkTo(type){
  252. uni.navigateTo({
  253. url:`/pages/${type}/index`
  254. })
  255. },
  256. changeStatics({currentIndex}) {
  257. if (this.statisticsIdx !== currentIndex) {
  258. this.statisticsIdx = currentIndex
  259. let ths=[{name:"救援队",unit:"人数"},{name:"物资分类",unit:"数量"},{name:"监管单位",unit:"企业/单位数目"},{name:"监管单位",unit:"隐患数目"}]
  260. this.statisticsData={
  261. name:ths[currentIndex].name,unit:ths[currentIndex].unit,
  262. items:[]
  263. },
  264. this.getStatisticsData()
  265. }
  266. },
  267. callPhone(phoneNumber) {
  268. if(!phoneNumber)return
  269. wx.makePhoneCall({
  270. phoneNumber
  271. })
  272. }
  273. }
  274. }
  275. </script>
  276. <style lang="scss" scoped>
  277. .page-wrap{
  278. padding: 20rpx;
  279. background-color: #f5f5f5;
  280. .decoration{
  281. padding-right: 6rpx;
  282. image{
  283. display: block;
  284. width: 30rpx;
  285. height: 30rpx;
  286. }
  287. }
  288. .tab-container{
  289. background: #fff;
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. flex-wrap: wrap;
  294. padding-bottom: 20rpx;
  295. .item{
  296. width: 33.33%;
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. flex-direction: column;
  301. padding: 0 10rpx 20rpx;
  302. box-sizing: border-box;
  303. .icon{
  304. width: 80rpx;
  305. height: 80rpx;
  306. image{
  307. display: block;
  308. width: 80rpx;
  309. height: 80rpx;
  310. }
  311. }
  312. .name{
  313. padding-top: 16rpx;
  314. line-height: 1;
  315. font-size: 28rpx;
  316. color: #222222;
  317. text-align: center;
  318. }
  319. }
  320. }
  321. .duty-conatiner{
  322. margin-top: 40rpx;
  323. padding-bottom: 10rpx;
  324. background-color: #fff;
  325. .filter-box{
  326. display: flex;
  327. justify-content: center;
  328. align-items: center;
  329. padding-bottom: 20rpx;
  330. .time{
  331. padding:16rpx 20rpx;
  332. width: 260rpx;
  333. border: 1px solid #ddd;
  334. text-align: center;
  335. border-radius: 6px;
  336. margin: 0 40rpx;
  337. font-size: 32rpx;
  338. line-height: 1;
  339. color: #424242;
  340. font-weight: 600;
  341. box-shadow:0 0 4px rgba(0, 0, 0, 0.2);
  342. }
  343. }
  344. .isEmpty{
  345. text-align: center;
  346. font-size: 36rpx;
  347. line-height: 1;
  348. padding: 36rpx;
  349. color: #999999;
  350. background-color: #f8f8f8;
  351. }
  352. .duty-item{
  353. display: flex;
  354. justify-content: space-between;
  355. align-items: center;
  356. position: relative;
  357. box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
  358. padding: 20rpx 14rpx;
  359. margin: 20rpx;
  360. .icon,.icon image{
  361. display: block;
  362. width: 30rpx;
  363. height: 30rpx;
  364. flex-shrink: 0;
  365. }
  366. .avatar {
  367. image{
  368. width: 60rpx;
  369. height: 60rpx;
  370. }
  371. }
  372. .posbox{
  373. display: flex;
  374. align-items: center;
  375. justify-content: space-between;
  376. padding: 20rpx 0;
  377. }
  378. .info{
  379. flex: 1;
  380. padding:0 14rpx;
  381. .user,.phone{
  382. display: flex;
  383. align-items: center;
  384. .name,.phoneNumber{
  385. color: #999;
  386. font-size: 12px;
  387. font-weight: normal;
  388. // overflow: hidden;
  389. line-height: 1;
  390. }
  391. }
  392. .user{
  393. padding: 10rpx 0;
  394. .userinfo{
  395. display: flex;
  396. align-items: center;
  397. }
  398. }
  399. .bottom {
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. }
  404. }
  405. }
  406. }
  407. .statisticsTabs{
  408. padding: 0 16rpx 40rpx 16rpx;
  409. }
  410. .statisticscont{
  411. padding:0 16rpx;
  412. }
  413. }
  414. </style>