123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <template>
- <a-card :bordered="false" class="cleanDetail-container">
- <!-- 搜索条件 -->
- <div class="cleanDetail-container-searchForm">
- <a-form-model
- ref="queryParam"
- :model="queryParam"
- layout="inline"
- @keyup.enter.native="refresh"
- v-bind="formItemLayout">
- <a-row :gutter="24">
- <a-col :xs="24" :sm="12" :md="6" :lg="5">
- <a-form-model-item label="清运时间:" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-range-picker
- :disabledDate="disabledDate"
- v-model="time"
- id="cleanDetail-time"
- :format="dateFormat"
- :placeholder="['开始时间', '结束时间']" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="12" :md="6" :lg="5">
- <a-form-model-item label="网点名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-select
- id="cleanDetail-stationNo"
- placeholder="请选择网点名称"
- allowClear
- v-model="queryParam.stationNo"
- showSearch
- option-filter-prop="children"
- :filter-option="filterOption">
- <a-select-option v-for="item in optionData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="12" :md="6" :lg="5">
- <a-form-model-item label="网点标签" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-select
- style="max-height: 50px;overflow: auto;margin-top: 3px;"
- id="cleanDetail-labelNoList"
- placeholder="请选择网点标签"
- mode="multiple"
- allowClear
- v-model="queryParam.labelNoList"
- :showSearch="true"
- option-filter-prop="children"
- :filter-option="filterOption"
- >
- <a-select-option v-for="item in lableData" :key="item.labelNo" :value="item.labelNo">{{ item.labelName }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="12" :md="6" :lg="5">
- <a-form-model-item label="设备编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-input allowClear placeholder="请输入设备编号" v-model.trim="queryParam.srcDeviceCode" id="cleanDetail-srcDeviceCode" />
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="12" :md="6" :lg="4">
- <a-button type="primary" @click="refresh" style="margin: 4px 10px 0 20px" id="cleanDetail-refresh">查询</a-button>
- <a-button type="" @click="reset" style="margin-top: 4px" id="cleanDetail-reset">重置</a-button>
- </a-col>
- </a-row>
- <a-row :gutter="24">
- <a-col :xs="24" :sm="12" :md="6" :lg="5">
- <a-form-model-item label="清运司机" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-select
- id="cleanDetail-dirverUserId"
- placeholder="请选择清运司机"
- allowClear
- v-model="queryParam.dirverUserId"
- showSearch
- option-filter-prop="children"
- :filter-option="filterOption">
- <a-select-option v-for="item in cleanUserData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- <!-- 合计 -->
- <a-alert type="info" showIcon style="margin-bottom:15px">
- <div class="ftext" slot="message">总计<span> {{ totalNum }} </span>条,可回收物清运量总计<span> {{ cleanWeightTotal }} </span>kg</div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- ref="table"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- bordered
- >
- <span slot="action" slot-scope="text,record">
- <a-button type="primary" @click="handleDetail(record)" v-hasPermission="'B_cleanDetail'" id="cleanDetail-handleDetail">查看清运明细</a-button>
- <span v-if="!$hasPermissions('B_cleanDetail')">--</span>
- </span>
- </s-table>
- <!-- 详情弹窗 -->
- <cleanDetailModal :deviceNo="itemDeviceNo" :cleanTime="itemCleanTime" :visible="isOpenModal" @close="isOpenModal=false"></cleanDetailModal>
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import { stationList } from '@/api/releaseRecord.js'
- import cleanDetailModal from './cleanDetailModal.vue'
- import { cleanDetailsList, getCleanDetailsTotal, cleanUserList } from '@/api/cleanManage.js'
- import { lableSeleteList } from '@/api/labelSetting.js'
- import moment from 'moment'
- export default {
- components: { STable, VSelect, cleanDetailModal },
- data () {
- return {
- formItemLayout: {
- labelCol: {
- span: 7
- },
- wrapperCol: {
- span: 17
- }
- },
- isOpenModal: false, // 默认弹窗关闭
- itemDeviceNo: '', // 每行设备编号
- itemCleanTime: '', // 每行清运时间
- // 查询参数
- queryParam: {
- dirverUserId: undefined, // 操作人id
- stationNo: undefined, // 网点编号
- srcDeviceCode: null, // 设备编号
- beginDate: null, // 开始时间
- endDate: null, // 结束时间
- labelNoList: [] // 网点标签
- },
- optionData: [], // 网点名称数据
- lableData: [], // 网点标签数据
- cleanUserData: [], // 操作人数据
- // 将默认当天时间日期回显在时间选择框中
- time: [],
- dateFormat: 'YYYY-MM-DD', // 日期格式
- totalNum: 0, // 总条数
- cleanWeightTotal: 0, // 可回收物清运量总计
- columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
- { title: '清运时间', dataIndex: 'cleanTime', width: 100, align: 'center' },
- { title: '网点名称', dataIndex: 'stationName', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
- { title: '网点标签', dataIndex: 'labelName', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
- { title: '设备编号', dataIndex: 'srcDeviceCode', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
- { title: '可回收物清运量(kg)', dataIndex: 'cleanWeight', width: 100, align: 'center', sorter: true, customRender: (text) => { return text || 0 } },
- { title: '清运司机', dataIndex: 'driverName', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
- { title: '操作人', dataIndex: 'operatorName', width: 100, align: 'center' },
- { title: '备注', dataIndex: 'remarks', width: 100, align: 'center', ellipsis: true, customRender: (text) => { return text || '--' } },
- { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- const searchData = Object.assign(parameter, this.queryParam)
- if (this.time && this.time.length) {
- searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
- searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
- } else {
- searchData.beginDate = null
- searchData.endDate = null
- }
- return cleanDetailsList(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(3)
- }
- }
- this.totalNum = res.data.count
- return res.data
- } else {
- this.totalNum = 0
- }
- })
- }
- }
- },
- mounted () {
- this.getStationList()
- this.getTotal()
- this.getCleanUserList()
- this.getlableSeleteList()
- },
- methods: {
- // 不可选日期
- disabledDate (date, dateStrings) {
- return date && date.valueOf() > Date.now()
- },
- // 创建时间change
- onChange (dates, dateStrings) {
- if ((dates, dateStrings)) {
- this.queryParam.beginDate = dateStrings[0]
- this.queryParam.endDate = dateStrings[1]
- }
- },
- filterOption (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- // 获取标签数据
- getlableSeleteList () {
- lableSeleteList().then(res => {
- if (res.status == 200) {
- this.lableData = res.data || []
- }
- })
- },
- // 获取操作人数据
- getCleanUserList () {
- cleanUserList().then(res => {
- if (res.status == 200) {
- this.cleanUserData = res.data || []
- }
- })
- },
- // 获取合作商数据
- getStationList () {
- stationList().then(res => {
- if (res.status == 200) {
- this.optionData = res.data || []
- }
- })
- },
- // 获取网点标签数据
- getLableList () {
- stationList().then(res => {
- if (res.status == 200) {
- this.lableData = res.data || []
- }
- })
- },
- // 合计
- getTotal () {
- const params = this.queryParam
- if (this.time && this.time.length) {
- params.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
- params.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
- } else {
- params.beginDate = null
- params.endDate = null
- }
- getCleanDetailsTotal(params).then(res => {
- if (res.status == 200) {
- if (res.data != 0 || null) {
- this.cleanWeightTotal = (res.data.cleanWeight / 1000).toFixed(3)
- }
- } else {
- this.cleanWeightTotal = 0
- }
- })
- },
- // 查询
- refresh () {
- this.$refs.table.refresh(true)
- this.getTotal()
- },
- // 重置
- reset () {
- this.queryParam = {
- dirverUserId: undefined, // 操作人id
- stationNo: undefined, // 网点编号
- srcDeviceCode: null, // 设备编号
- beginDate: null, // 开始时间
- endDate: null, // 结束时间
- labelNoList: []
- }
- this.time = []
- this.refresh()
- },
- // 查看清运详情
- handleDetail (record) {
- this.itemDeviceNo = record.deviceNo
- this.itemCleanTime = record.cleanTime
- this.isOpenModal = true
- }
- }
- }
- </script>
- <style lang='less' scoped>
- .cleanDetail-container {
- .cleanDetail-container-searchForm {
- .ant-form-inline .ant-form-item {
- width: 100%;
- margin-bottom: 15px;
- }
- }
- }
- </style>
|