index.vue 13 KB

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