jiangping
2024-10-10 d7c484c2f5ff13b000b38cc2d078bfe752d3dad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<template>
  <div class="main_app">
    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @changeForm='changeForm' @handleQuery="getList(1)"
      @clear="clear">
      <template #fastdate>
        <el-radio-group v-model="filters.fastdate" size="small" @input="changeRadio">
          <el-radio-button label="0">当天</el-radio-button>
          <el-radio-button label="6">近7天</el-radio-button>
          <el-radio-button label="29">近30天</el-radio-button>
        </el-radio-group>
      </template>
    </QueryForm>
    <div class="pt16">
      <el-button :loading="exLoading" @click="handleEx"
        v-permissions="['business:platformjob:exportExcel']">导出</el-button>
    </div>
    <el-table class="mb20" v-loading="loading" :data="list" stripe>
      <el-table-column type="index" label="序号" width="70" show-overflow-tooltip />
      <el-table-column prop="billCode" label="运单号/合同号" min-width="100" show-overflow-tooltip>
        <template v-slot="scope">
          <span>{{ scope.row.billCode || scope.row.contractNum }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="totalNum" label="总作业量(万支)" min-width="100" show-overflow-tooltip /> -->
      <el-table-column prop="carCodeFront" label="车牌号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="carCodeBack" label="电子锁状态" min-width="100" show-overflow-tooltip>
        <template v-slot="scope">
          <span class="red" v-if="scope.row.lockStatus == 0">未上锁</span>
          <span class="red" v-if="scope.row.lockStatus == 1">部分上锁</span>
          <span v-if="scope.row.lockStatus == 2">全部上锁</span>
        </template>
      </el-table-column>
      <el-table-column prop="carrierName" label="运输公司" min-width="100" show-overflow-tooltip />
      <el-table-column prop="driverName" label="驾驶员" min-width="120" show-overflow-tooltip>
        <template v-slot="scope">
          <span>{{ scope.row.driverName }} {{ scope.row.drivierPhone }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="drivierPhone" label="联系方式" min-width="100" show-overflow-tooltip /> -->
 
      <el-table-column prop="doneDate" label="作业完成时间" min-width="150" show-overflow-tooltip />
      <el-table-column prop="workTime" label="授权状态" min-width="100" show-overflow-tooltip>
        <template v-slot="scope">
          <span v-if="scope.row.status == 9 || scope.row.status == 10">已授权</span>
          <span class="red" v-if="scope.row.status == 6">未授权</span>
        </template>
      </el-table-column>
      <el-table-column prop="outUserName" label="操作员" min-width="100" show-overflow-tooltip />
      <el-table-column prop="outHkdate" label="操作时间" min-width="150" show-overflow-tooltip />
      <el-table-column prop="remark" label="备注" min-width="150" show-overflow-tooltip />
      <el-table-column label="操作" align="center" fixed="right" min-width="100" show-overflow-tooltip>
        <template v-slot="scope">
          <el-button v-if="scope.row.status == 6" type="text" v-permissions="['business:platformbooks:detail']"
            @click="handleAuth(scope.row)">离园授权</el-button>
            <span v-else>-</span>
        </template>
      </el-table-column>
    </el-table>
    <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
    <!--  -->
    <!--  -->
    <DriverDetail v-if="isShowDriver" ref="DriverDetailRef" />
  </div>
</template>
 
<script>
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import { platformJobPage, platformJobExport, platformPowerLevel } from '@/api'
import { statusMap } from '../config'
import DriverDetail from "@/views/task/driverDetail"
import GlobalWindow from '@/components/common/GlobalWindow'
import UploadFaceImg from '@/components/common/UploadFaceImg'
import { Message } from 'element-ui'
import dayjs from 'dayjs'
export default {
  components: {
    Pagination,
    QueryForm,
    DriverDetail,
    GlobalWindow,
    UploadFaceImg
  },
  data() {
    return {
      statusMap,
      isShowDriver: false,
      exLoading: false,
      loading: false,
      pagination: {
        pageSize: 10,
        page: 1,
        total: 0
      },
      filters: {
        selDate: [],
        fastdate: 0
      },
      list: [],
      queryFormConfig: {
        formItems: [
          {
            filed: 'contractNum',
            type: 'input',
            label: '合同号'
          },
          {
            filed: 'billCode',
            type: 'input',
            label: '运单号'
          },
          {
            filed: 'carCodeFront',
            type: 'input',
            label: '车牌号'
          },
          {
            filed: 'driverName',
            type: 'input',
            label: '驾驶员'
          },
          {
            filed: 'selDate',
            type: 'datetimerange',
            label: '作业完成时间搜索',
            pickerOptions: {}
          },
          {
            type: 'slot',
            filed: 'fastdate',
            label: ''
          }
        ],
        online: true
      },
    }
  },
  created() {
    this.changeRadio('0')
    this.getList()
  },
  methods: {
    changeRadio(day) {
      const arr = [dayjs().subtract(day, 'day').format('YYYY-MM-DD') + ' 00:00:00', dayjs().format('YYYY-MM-DD') + ' 23:59:59']
      this.$set(this.filters, 'selDate', arr)
      this.getList()
    },
    changeForm(str) {
      if (str === 'selDate') {
        this.$set(this.filters, 'fastdate', null)
        this.getList()
      }
    },
    getList(page) {
      const { pagination, filters } = this
      this.loading = true
      platformJobPage({
        model: {
          ...filters,
          queryStatus: '6,9,10,2,3,4',
          beginWorkDateStart: filters.selDate && filters.selDate.length > 0 ? filters.selDate[0] : null,
          beginWorkDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null,
        },
        capacity: pagination.pageSize,
        page: page || pagination.page,
      }).then(res => {
        this.loading = false
        this.list = res.records || []
        this.list.forEach(item => {
          item.inTypeTemp = item.inType == 0 ? '整托盘' : '件烟'
          item.taskOrigin = 'WMS获取'
        })
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false
      })
    },
    handleAuth(row) {
      this.$prompt('备注', '离园授权', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(({ value }) => {
        platformPowerLevel({ jobId: row.id, remark: value }).then(res => {
          Message.success('离园授权成功')
          this.getList()
        })
      })
    },
    handleEx() {
      this.$dialog.exportConfirm('确认导出吗?')
        .then(() => {
          this.exLoading = true
          platformJobExport({
            page: this.pagination.page,
            capacity: 1000000,
            queryStatus: '6,9,10',
            model: this.filters
          })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.exLoading = false
            })
        })
    },
    clear() {
      this.pagination.page = 1
      this.filters = {
        selDate: [],
        fastdate: 0
      }
      this.getList()
    },
    handleDetail(row) {
      this.isShowDriver = true
      this.$nextTick(() => {
        this.$refs.DriverDetailRef.id = row.id
        this.$refs.DriverDetailRef.type = 6
        this.$refs.DriverDetailRef.getDetail()
        this.$refs.DriverDetailRef.isShowModal = true
      })
    },
    handleSizeChange(capacity) {
      this.pagination.pageSize = capacity
    }
  }
}
</script>
<style lang="scss" scoped>
.param_title {
  font-size: 18px;
  font-weight: 600;
  color: #000000;
  margin-bottom: 15px;
}
</style>