123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <div class="on-duty-today">
- <div class="on-duty-today__inner">
- <div class="on-duty-today__list">
- <div class="on-duty-today__item">
- <div class="on-duty-today__itemHeader">{{todayBeOnDuty.total || 0}}</div>
- <div class="on-duty-today__itemBody">总单数</div>
- </div>
- <div class="on-duty-today__item">
- <div class="on-duty-today__itemHeader">{{todayBeOnDuty.price || 0}}</div>
- <div class="on-duty-today__itemBody">总费用(元)</div>
- </div>
- <div class="on-duty-today__item">
- <div class="on-duty-today__itemHeader">{{todayBeOnDuty.avg_response | formatHourMinute}}</div>
- <div class="on-duty-today__itemBody">平均接单时间</div>
- </div>
- <div class="on-duty-today__item">
- <div class="on-duty-today__itemHeader">{{todayBeOnDuty.avg_handle | formatHourMinute}}</div>
- <div class="on-duty-today__itemBody">平均解决时间</div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { post, timerCommon } from './../http/http'
- export default {
- name: 'OnDutyToday',
- inject: ['parentDutyId', 'hosId', 'dutyId'],
- data () {
- return {
- sign: 'lastWeek',
- timer: null,
- todayBeOnDuty: {} // 头部总当班人数
- }
- },
- methods: {
- // 获取数据
- async getData () {
- this.$emit('signEmit', this.sign)
- let startTime
- let endTime
- if (this.sign === 'lastWeek') {
- startTime = this.$moment().subtract(1, 'week').startOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
- endTime = this.$moment().subtract(1, 'week').endOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
- } else if (this.sign === 'lastMonth') {
- startTime = this.$moment().subtract(1, 'month').startOf('month').format('YYYY-MM-DD HH:mm:ss')
- endTime = this.$moment().subtract(1, 'month').endOf('month').format('YYYY-MM-DD HH:mm:ss')
- }
- const result = await post(
- '/itsm/report/index',
- {
- parentDutyId: this.parentDutyId,
- hosId: this.hosId,
- dutyId: this.dutyId,
- startDate: startTime,
- endDate: endTime,
- type: 'itsmSummary'
- }
- )
- this.todayBeOnDuty = result.data ? result.data[0] : {}
- this.polling()
- },
- // 轮询请求
- polling () {
- clearTimeout(this.timer)
- this.timer = setTimeout(() => {
- if (this.sign === 'lastWeek') {
- this.sign = 'lastMonth'
- } else if (this.sign === 'lastMonth') {
- this.sign = 'lastWeek'
- }
- this.getData()
- }, timerCommon)
- }
- },
- mounted () {
- this.getData()
- },
- beforeDestroy () {
- clearTimeout(this.timer)
- }
- }
- </script>
- <style lang="less">
- .on-duty-today {
- overflow: hidden;
- height: 2.6625rem;
- .on-duty-today__inner {
- height: 100%;
- .on-duty-today__list {
- display: flex;
- justify-content: space-between;
- height: 100%;
- .on-duty-today__item {
- text-align: center;
- display: flex;
- flex-direction: column;
- justify-content: center;
- margin-right: .4rem;
- &:first-child {
- margin-left: .4rem;
- }
- &:last-child {
- margin-right: .4rem;
- }
- .on-duty-today__itemHeader{
- font-size: .65rem;
- color: #00D5EA;
- font-weight: bold;
- }
- .on-duty-today__itemBody{
- font-size: .2rem;
- color: #FFFFFF;
- margin-top: .1rem;
- }
- }
- }
- }
- }
- </style>
|