123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <a-modal
- title="清运详情"
- :footer="null"
- v-model="isShow"
- @cancel="isShow=false"
- :centered="true"
- width="60%">
- <s-table
- ref="table"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- bordered
- :scroll="{ y: 400 }">
- </s-table>
- </a-modal>
- </template>
- <script>
- import { STable } from '@/components'
- import { networkDetail } from '@/api/cleanManage.js'
- import moment from 'moment'
- export default {
- name: 'CleanDetailModal',
- components: {
- STable
- },
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- stationNo: {
- type: [Number, String],
- default: ''
- },
- searchDate: {
- type: Array,
- default: function () {
- return []
- }
- }
- },
- data () {
- return {
- isShow: this.visible, // 弹窗的状态
- columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
- { title: '清运时间', dataIndex: 'cleanTime', width: 100, align: 'center' },
- { title: '设备编号', dataIndex: 'deviceNo', width: 100, align: 'center' },
- { title: '清运重量(kg)', dataIndex: 'cleanWeight', width: 100, align: 'center' },
- { title: '清运司机', dataIndex: 'driverName', width: 100, align: 'center' }],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- const searchDateModal = this.searchDate
- if (this.searchDate && this.searchDate.length) {
- searchDateModal.beginDate = moment(this.searchDate[0]).format('YYYY-MM-DD')
- searchDateModal.endDate = moment(this.searchDate[1]).format('YYYY-MM-DD')
- } else {
- searchDateModal.beginDate = null
- searchDateModal.endDate = null
- }
- const searchData = Object.assign(parameter, { stationNo: this.stationNo }, { beginDate: searchDateModal.beginDate }, { endDate: searchDateModal.endDate })
- console.log(searchData, '----------详情参数')
- return networkDetail(searchData).then(res => {
- if (res.status == 200) {
- const no = (res.data.pageNo - 1) * res.data.pageSize
- for (let i = 0; i < res.data.list.length; i++) {
- const _item = res.data.list[i]
- _item.no = no + i + 1
- if (_item.cleanWeight != null || 0) {
- _item.cleanWeight = (_item.cleanWeight / 1000).toFixed(2)
- }
- }
- return res.data
- }
- })
- }
- }
- },
- watch: {
- visible (newValue, oldValue) {
- this.isShow = newValue
- },
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- }
- },
- stationNo (newValue, oldValue) {
- if (newValue && this.isShow) {
- this.$refs.table.refresh(true)
- }
- }
- }
- }
- </script>
- <style lang="less" scoped="scoped">
- .detail-item {
- text-align: center;
- margin: 10px 0;
- letter-spacing: 0.5px;
- }
- </style>
|