货车收入列表

This commit is contained in:
ljx 2024-04-30 17:11:38 +08:00
parent 350ca0374f
commit eaa6d0b59f
2 changed files with 345 additions and 14 deletions

View File

@ -49,18 +49,19 @@
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
<a-tabs default-active-key="1" size="large">
<div class="train-number"> <a-tab-pane key="1" tab="货车收入列表">
<h2> <TruckIncomeList :ListUrl="TruckIncomeList" :ListUrlData="TSelectData" :ListFieldName="TSelectDataFieldName"
出车记录 :Columns="this.$data.Tcolumns" :dataId ="dataId">
</h2> </TruckIncomeList>
</a-tab-pane>
<zkTableList :ListUrl="TrainNumberList" :ListUrlData="zkSelectData" :ListFieldName="zkSelectDataFieldName" <a-tab-pane key="2" tab="出车记录" force-render>
:Columns="this.$data.columns"> <zkTableList :ListUrl="TrainNumberList" :ListUrlData="zkSelectData" :ListFieldName="zkSelectDataFieldName"
:Columns="this.$data.columns" >
</zkTableList> </zkTableList>
</a-tab-pane>
</div> </a-tabs>
@ -68,10 +69,11 @@
</template> </template>
<script> <script>
import zkTableList from "./TrainNumberList.vue"; import zkTableList from "./TrainNumberList.vue";
import TruckIncomeList from "./TruckList.vue";
export default { export default {
components: { components: {
zkTableList zkTableList,
TruckIncomeList
}, },
props: { props: {
dataId: { dataId: {
@ -91,10 +93,16 @@ export default {
data() { data() {
return { return {
TrainNumberList: `${this.$BASE_URL}/TrainNumber/v1/train/number/list`, // TrainNumberList: `${this.$BASE_URL}/TrainNumber/v1/train/number/list`, //
TruckIncomeList: `${this.$BASE_URL}/Truck/v1/truck/income/list`, //
truckID:null,
zkSelectData:{ zkSelectData:{
},
TSelectData:{
}, },
zkSelectDataFieldName:"TrainNumber", zkSelectDataFieldName:"TrainNumber",
TSelectDataFieldName:"TruckIncome",
// //
columns: [ columns: [
{ type: 'seq', width: 60 }, { type: 'seq', width: 60 },
@ -144,6 +152,30 @@ export default {
// =============================== Start =============================== // =============================== Start ===============================
],
Tcolumns: [
{ type: 'seq', width: 60 },
// =============================== Start ===============================
{ field: 'train_number_code', align: 'center', sortable: true, title: '出车单号', width: 200 }, //
{ field: 'train_number_id', align: 'center', sortable: true, title: '出车单号id', width: 200 }, //
{ field: 'year', align: 'center', sortable: true, title: '年份', width: 120 }, //
{ field: 'month', align: 'center', sortable: true, title: '月份', width: 120 }, //
{ field: 'date_time', align: 'center', sortable: true, title: '日期', formatter: 'formatDate', width: 200 }, //
{
field: 'driver_id', align: 'center', sortable: true, title: '司机', width: 80,
slots: { default: 'driver_id' }
}, // id
// {field: 'custom_id', sortable: true, title: 'id', width: 250}, // id
// { field: 'custom_name', align: 'center', sortable: true, title: '', width: 200 }, //
// {field: 'supplier_id', sortable: true, title: 'id', width: 250}, // id
// { field: 'supplier_name', align: 'center', sortable: true, title: '', width: 200 }, //
{
field: 'income', sortable: true, title: '收入', minWidth: 80, fixed: 'right',
align: 'center',
}, //
// =============================== Start ===============================
], ],
data: {}, data: {},
} }
@ -169,8 +201,7 @@ export default {
} }
} }
}).then(a => { }).then(a => {
console.log("a", a)
console.log("this.pageOptions.ApiUrl", this.pageOptions.ApiUrl)
this.data = a.data[this.pageOptions.FieldName]; this.data = a.data[this.pageOptions.FieldName];
}).catch((a) => { }).catch((a) => {
this.$mk.error(a.msg, "aaa"); this.$mk.error(a.msg, "aaa");

View File

@ -0,0 +1,300 @@
<template>
<vxe-grid ref='xGrid' v-bind="gridOptions" @form-submit="initListData" @page-change="handlePageChange">
<!-- 时间选择 -->
<template #create_time_item>
<a-range-picker @change="onChangeCreatTime"/>
</template>
<!-- 表单区操作 -->
<template #operate_item>
<a-button type="primary" status="primary">查询</a-button>
<a-button
@click="() => {
gridOptions.formConfig.data.name = '';
gridOptions.formConfig.data.code = '';
gridOptions.formConfig.data.create_time = 0;
gridOptions.formConfig.data.end_time = 0;
}"
>重置
</a-button>
</template>
<template #driver_id="{ row }">
{{ row.driver_name }}
</template>
<template #is_outsourcing="{ row }">
<a-tag color="green" v-if="row.is_outsourcing === 1">
委外出车
</a-tag>
<a-tag color="blue" v-if="row.is_need_outbound === 1">
正常出车
</a-tag>
</template>
<template #is_change_tire="{ row }">
<a-tag color="green" v-if="row.is_change_tire === 0">
</a-tag>
<a-tag color="red" v-else>
</a-tag>
</template>
<template #is_repair="{ row }">
<a-tag color="green" v-if="row.is_repair === 0">
</a-tag>
<a-tag color="red" v-else>
</a-tag>
</template>
<template #is_oil="{ row }">
<a-tag color="green" v-if="row.is_oil === 0">
</a-tag>
<a-tag color="red" v-else>
</a-tag>
</template>
<template #empty>
<a-empty/>
</template>
</vxe-grid>
</template>
<script>
import ListMixin from "@/application/zk/mixins/ListComponents.js";
export default {
mixins: [ListMixin],
props: {
Columns: {
type: Array
},
dataId:{},
FormConfig: {
type: Object,
default: () => {
return {
data: {
name: '',
code: '',
create_time: 0
},
// items: [
// {
// field: 'name',
// title: '',
// slots: {default: 'name_item'} //
// },
// {
// field: 'code',
// title: '',
// slots: {default: 'code_item'} //
// },
// {
// field: 'create_time',
// title: '',
// slots: {default: 'create_time_item'} //
// },
// {slots: {default: 'operate_item'}}
// ]
}
}
},
},
data() {
return {
DeleteIds: [], // id
gridOptions: { //
resizable: true, //
border: true, //
showOverflow: true, //
loading: false, //
minHeight: '600', //
maxHeight: '1200', //
//
stripe: true,
exportConfig: { //
},
pagerConfig: {//
total: 0, //
currentPage: this.ListUrlData.page, //
pageSize: this.ListUrlData.limit, //
pageSizes: [10, 20, 30, 50, 100, 500, 1000, 2000] //
},
checkboxConfig: { //
// rowId
reserve: true,
//
trigger: 'row',
highlight: true
},
formConfig: this.FormConfig, //
toolbarConfig: { //
export: true, //
custom: true, //
slots: {
buttons: 'toolbar_buttons' //
}
},
columns: this.Columns, //
data: []
},
}
},
created() {
//
this.initListData()
},
methods: {
//
initListData() {
this.ListUrlData.order_bys = []
this.ListUrlData.order_bys.push({
column: "create_time",
order: "desc"
})
this.ListUrlData.search_rules = [];
// if (this.gridOptions.formConfig.data.name !== '') {
// this.ListUrlData.search_rules.push(
// {
// column: "name",
// mode: "like",
// value: this.gridOptions.formConfig.data.name
// }
// )
// }
// if (this.gridOptions.formConfig.data.code !== '') {
// this.ListUrlData.search_rules.push(
// {
// column: "code",
// mode: "like",
// value: this.gridOptions.formConfig.data.code
// }
// )
// }
this.ListUrlData.truck_id = this.$mk.toBigInt(this.dataId);
this.$zk.getPagedData({
url: this.ListUrl,
listFieldName: this.ListFieldName,
data: this.ListUrlData,
loading: "加载中...",
config: {
headers: {
'Content-Type': 'application/json'
}
}
}).then(a => {
if (a.total === 0) {
this.gridOptions.pagerConfig.currentPage = this.ListUrlData.page;
this.gridOptions.pagerConfig.pageSize = this.ListUrlData.limit;
this.gridOptions.pagerConfig.total = a.total;
this.gridOptions.data = a[this.ListFieldName];
return
}
this.gridOptions.data = a[this.ListFieldName];
// this.listid
this.gridOptions.data.forEach(item => {
item.id = item.id.toString();
});
this.gridOptions.pagerConfig.currentPage = this.ListUrlData.page;
this.gridOptions.pagerConfig.pageSize = this.ListUrlData.limit;
this.gridOptions.pagerConfig.total = a.total;
}).catch((a) => {
this.$mk.error(a.msg);
});
},
//
pageDelete: function (row) {
let ids = [];
if (row) {
ids.push(row.id);
}
this.$refs.xGrid.getCheckboxRecords().forEach(item => {
ids.push(item.id);
});
console.log(ids);
if (!ids.length) { //
this.$mk.error("请选择行"); //
return;
}
this.$mk.confirm('您确定要删除吗?').then(type => { //
if (type === 'confirm') { //
this.DeleteUrlData.ids = ids;
this.Delete()
this.$message.success("删除成功")
}
});
},
//
handlePageChange({currentPage, pageSize}) {
this.ListUrlData.page = currentPage
this.ListUrlData.limit = pageSize
this.initListData()
},
//
onChangeCreatTime(date, dateString) {
console.log("dateString:", dateString)
if (dateString[0] === '' && dateString[1] === '') {
this.ListUrlData.start_time = 0;
this.ListUrlData.end_time = 0;
this.initListData()
} else {
this.ListUrlData.start_time = dateString[0];
this.ListUrlData.end_time = dateString[1];
this.initListData()
}
},
//
Add() {
this.$openPage(this.CreateRouter);
},
//
pageEdit(row) {
console.log(row)
if (!row) { //
this.$mk.msg("请选择行"); //
return; //
}
this.$openPage(this.UpdateRouter + "/" + row.id); //
},
//
pageDetail(row) {
console.log(row)
if (!row) { //
this.$mk.msg("请选择行"); //
return; //
}
this.$mk.dialog.open({
height: 800,
width: 1200,
page: () => import(this.DetailVueComponent),
title: "详情",
dataId: row.id,
pageOptions: {
ApiUrl: this.DetailUrl,
ApiData: this.DetailUrlData,
FieldName: this.DetailFieldName,
title: "详情",
},
// callback: ({success}) => {
// success && this.initListData(); //
// }
})
}
}
}
</script>
<style scoped lang="less">
.ant-btn {
margin-right: 10px;
}
</style>