index.vue 12 KB

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