This commit is contained in:
zxx 2024-04-02 11:40:05 +08:00
parent 9e2c8933ed
commit 94b10b3fee
8 changed files with 455 additions and 45 deletions

View File

@ -50,7 +50,7 @@ export default {
currentBeid: 0, currentBeid: 0,
uploadDefaultImg: null, uploadDefaultImg: null,
detailDataFieldName: "maintenance", detailDataFieldName: "maintenance_giornale_log",
actions: { actions: {
// =============================== Start =============================== // =============================== Start ===============================
@ -224,9 +224,9 @@ export default {
}; };
pageData.actions.get = pageData.actions.MaintenanceDetail; pageData.actions.get = pageData.actions.MaintenanceGiornaleLogDetail;
pageData.actions.create = pageData.actions.MaintenanceCreate; pageData.actions.create = pageData.actions.MaintenanceGiornaleLogCreate;
pageData.actions.update = pageData.actions.MaintenanceUpdate; pageData.actions.update = pageData.actions.MaintenanceGiornaleLogUpdate;
// //
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions); pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);

View File

@ -214,18 +214,14 @@ export default {
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // {field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, //
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // {field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, //
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // {field: 'truck_number', sortable: true, title: '车牌号', width: 120}, //
{field: 'maintenance_name', sortable: true, title: '维修项目名称', width: 150}, // {field: 'maintenance_name', sortable: true, title: '项目名称', width: 150}, //
{field: 'maintenance_code', sortable: true, title: '维修项目编码', width: 140}, // {field: 'maintenance_code', sortable: true, title: '项目编码', width: 140}, //
{field: 'last_maintenance_date', sortable: true, title: '上次维修日期', width: 130}, // {field: 'last_maintenance_date', sortable: true, title: '上次维修日期', width: 130}, //
{field: 'last_mileage', sortable: true, title: '上次维修公里数', width: 140}, // // {field: 'last_mileage', sortable: true, title: '', width: 140}, //
{field: 'mileage', sortable: true, title: '维修公里数记录', width: 140}, // {field: 'mileage', sortable: true, title: '维修公里数记录', width: 140}, //
{field: 'maintenance_interval', sortable: true, title: '维修时间间隔', width: 140}, // {field: 'maintenance_interval', sortable: true, title: '维修时间间隔', width: 140}, //
{field: 'mileage_interval', sortable: true, title: '维修公里数间隔', width: 140}, // {field: 'mileage_interval', sortable: true, title: '维修公里数间隔', width: 140}, //
{field: 'maintenance_abolish_date', sortable: true, title: '维修作废日期', width: 140}, //
{field: 'maintenance_abolish_mileage', sortable: true, title: '维修作废公里数', width: 140}, //
{field: 'maintenance_mileage', sortable: true, title: '维修公里数', width: 120}, // {field: 'maintenance_mileage', sortable: true, title: '维修公里数', width: 120}, //
{ {
field: 'maintenance_date', field: 'maintenance_date',
formatter: 'formatDate', formatter: 'formatDate',
@ -236,6 +232,10 @@ export default {
}, // }, //
{field: 'maintenance_remark', sortable: true, title: '维修备注', width: 250}, // {field: 'maintenance_remark', sortable: true, title: '维修备注', width: 250}, //
// {field: 'maintenance_abolish_date', sortable: true, title: '', width: 140}, //
// {field: 'maintenance_abolish_mileage', sortable: true, title: '', width: 140}, //

View File

@ -49,7 +49,7 @@ export default {
currentBeid: 0, currentBeid: 0,
uploadDefaultImg: null, uploadDefaultImg: null,
detailDataFieldName: "maintenance", detailDataFieldName: "other_expenses_log",
actions: { actions: {
// =============================== Start =============================== // =============================== Start ===============================
@ -190,9 +190,9 @@ export default {
}; };
pageData.actions.get = pageData.actions.MaintenanceDetail; pageData.actions.get = pageData.actions.OtherExpensesLogDetail;
pageData.actions.create = pageData.actions.MaintenanceCreate; pageData.actions.create = pageData.actions.OtherExpensesLogCreate;
pageData.actions.update = pageData.actions.MaintenanceUpdate; pageData.actions.update = pageData.actions.OtherExpensesLogUpdate;
// //
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions); pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);

View File

@ -168,11 +168,11 @@ export default {
itemRender: {name: '$input', props: {type: "date"}} itemRender: {name: '$input', props: {type: "date"}}
}, },
{field: 'truck_number_before_mileage', title: '出车前总公里数', span: 6, itemRender: {name: '$input'}}, {field: 'truck_number_before_mileage', title: '出车前总公里数', span: 6, itemRender: {name: '$input'}},
{field: 'truck_number_after_mileage', title: '回车后总公里数', span: 6, itemRender: {name: '$input'}}, {field: 'truck_number_after_mileage', title: '车辆总公里数', span: 6, itemRender: {name: '$input'}},
{field: 'oil_consumption_number', title: '油耗数量', span: 12, itemRender: {name: '$input', props: { type: 'number'}}}, {field: 'oil_consumption_price', title: '油耗单价', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
{field: 'oil_consumption_price', title: '油耗单价', span: 12, itemRender: {name: '$input', props: { type: 'number'}}}, {field: 'oil_consumption_number', title: '油耗数量', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
{field: 'oil_consumption_total_price', title: '油耗总价', span: 12, itemRender: {name: '$input', props: { type: 'number'}}}, {field: 'oil_consumption_total_price', title: '油耗总价', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
{field: 'oil_consumption_hundred', title: '百公里油耗', span: 12, itemRender: {name: '$input', props: { type: 'number'}}}, {field: 'oil_consumption_hundred', title: '百公里油耗', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
{field: 'oil_consumption_remark', title: '油耗备注', span: 24, itemRender: {name: '$textarea'}}, {field: 'oil_consumption_remark', title: '油耗备注', span: 24, itemRender: {name: '$textarea'}},

View File

@ -41,13 +41,20 @@
<template #tire_type="{row}"> <template #tire_type="{row}">
{{row.tire_type == 1 ? '更换' : '补胎'}} {{row.tire_type == 1 ? '更换' : '补胎'}}
</template>" </template>"
<template #tire_change_date="{row}">
{{ row.tire_change_date }}
</template>
<!-- =============================== 表格列 自动生成 End =============================== --> <!-- =============================== 表格列 自动生成 End =============================== -->
<template #op="{ row }"> <template #op1="{ row }">
<div class="oplinks"> <div class="oplinks">
<a @click.stop="pageEdit(row)" title="编辑"> <a v-if="row.tire_abolish_date === 0" @click.stop="pageEdit(row)" title="轮胎作废">
<a-button type="primary">轮胎作废</a-button> <a-button type="primary">轮胎作废</a-button>
</a> </a>
</div>
</template>
<template #op="{ row }">
<div class="oplinks">
<a @click.stop="pageDelete(row)" title="删除"> <a @click.stop="pageDelete(row)" title="删除">
<a-icon type="delete"/> <a-icon type="delete"/>
</a> </a>
@ -204,19 +211,20 @@ export default {
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // {field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, //
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // {field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, //
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // {field: 'truck_number', sortable: true, title: '车牌号', width: 120}, //
{field: 'tire_type', sortable: true, title: '类型', width: 70 ,slots:{ default:"tire_type"}}, // : 1.,2. // {field: 'tire_type', sortable: true, title: '', width: 70 ,slots:{ default:"tire_type"}}, // : 1.,2.
{field: 'tire_brand', sortable: true, title: '品牌', width: 100}, // // {field: 'tire_brand', sortable: true, title: '', width: 100}, //
{field: 'tire_model', sortable: true, title: '型号', width: 100}, // // {field: 'tire_model', sortable: true, title: '', width: 100}, //
{field: 'tire_date', sortable: true, title: '更换日期', formatter: 'formatDate',width: 120}, //
{field: 'last_mileage', sortable: true, title: '更换时公里数', width: 130}, //
{field: 'mileage', sortable: true, title: '使用公里数', width: 120}, // 使
{field: 'tire_change_date', sortable: true, title: '更换日期间隔',width: 150,slots:{ default:"tire_change_date"}}, //
{field: 'tire_change_mileage', sortable: true, title: '更换间隔(公里数)', width: 150}, //
{field: 'tire_abolish_date', sortable: true, title: '作废日期',formatter: 'formatDate', width: 120}, //
{field: 'tire_abolish_mileage', sortable: true, title: '作废公里数', width: 120}, //
{field: 'tire_count', sortable: true, title: '更换数量', width: 100}, // {field: 'tire_count', sortable: true, title: '更换数量', width: 100}, //
{field: 'tire_price', sortable: true, title: '价格(元)', width: 120}, // {field: 'tire_price', sortable: true, title: '价格(元)', width: 120}, //
{field: 'tire_number', sortable: true, title: '胎号', width: 150}, // {field: 'tire_number', sortable: true, title: '胎号', width: 150}, //
{field: 'old_tire_number', sortable: true, title: '旧胎号', width: 150}, // {field: 'old_tire_number', sortable: true, title: '旧胎号', width: 150}, //
{field: 'last_mileage', sortable: true, title: '更换时公里数', width: 130}, //
{field: 'mileage', sortable: true, title: '使用公里数', width: 120}, // 使
{field: 'tire_change_date', sortable: true, title: '更换日期间隔',formatter: 'formatDate', width: 150}, //
{field: 'tire_change_mileage', sortable: true, title: '更换公里数间隔', width: 150}, //
{field: 'tire_abolish_date', sortable: true, title: '作废日期',formatter: 'formatDate', width: 120}, //
{field: 'tire_abolish_mileage', sortable: true, title: '作废公里数', width: 120}, //
{field: 'tire_remark', sortable: true, title: '备注', width: 250}, // {field: 'tire_remark', sortable: true, title: '备注', width: 250}, //
{ {
@ -232,7 +240,8 @@ export default {
// =============================== Start =============================== // =============================== Start ===============================
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'} {title: '轮胎作废', slots: {default: 'op1'}, width: 110,fixed: 'right'},
{title: '操作', slots: {default: 'op'}, width: 80,fixed: 'right'}
] ]
} }
@ -250,6 +259,10 @@ export default {
// desc() { // desc() {
// return this.$t('pageDesc') // return this.$t('pageDesc')
// } // }
currentTime() {
//
return Math.floor(Date.now() / 1000);
}
}, },
// //
@ -334,11 +347,34 @@ export default {
// //
pageEdit(row) { pageEdit(row) {
if (!row) { // // let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); //
this.$mk.msg("请选择行"); // // let ids = []; // id
return; // // rows.forEach((row) => { //
// ids.push(row[this.keyName]); // idid
// });
// if (!ids.length) { //
// this.$mk.error(""); //
// return;
// }
this.$mk.confirm('您确定要将轮胎作废吗?').then(type => { //
if (type == 'confirm') { //
this.$mk.post({
url: this.actions.TireAbolish, //
loading: "处理中...", //
data: {
id: row.id // id
},
useBigInt: true
}).then(() => { //
this.$mk.success("轮胎作废成功"); //
this.onSearch(); //
}).catch((a) => { //
this.$mk.error(a.data.msg); //
});
} }
this.$openPage("/Tire/TireUpdate/" + row[this.keyName]); // });
}, },
// //
@ -357,7 +393,7 @@ export default {
this.$mk.confirm('您确定要删除吗?').then(type => { // this.$mk.confirm('您确定要删除吗?').then(type => { //
if (type == 'confirm') { // if (type == 'confirm') { //
this.$mk.post({ this.$mk.post({
url: this.actions.delete, // url: this.actions.TireBatchDelete, //
loading: "删除中...", // loading: "删除中...", //
data: { data: {
ids: ids // id ids: ids // id

View File

@ -733,6 +733,8 @@ export default {
let save = () => { let save = () => {
// this.formOptions.data.outsourcing_driver_phone
this.formOptions.data.outsourcing_driver_phone = String(this.formOptions.data.outsourcing_driver_phone)
// //
let action = !this.isEdit ? this.actions.create : this.actions.update; let action = !this.isEdit ? this.actions.create : this.actions.update;

View File

@ -4,11 +4,7 @@
<!-- <div class="header">--> <!-- <div class="header">-->
<!-- <h1>详情</h1>--> <!-- <h1>详情</h1>-->
<!-- </div>--> <!-- </div>-->
<a-descriptions <a-descriptions size="small" :title="pageOptions.title" bordered>
size="small"
:title="pageOptions.title"
bordered
>
<a-descriptions-item label="编码"> <a-descriptions-item label="编码">
{{ data.code }} {{ data.code }}
</a-descriptions-item> </a-descriptions-item>
@ -54,14 +50,28 @@
</a-descriptions> </a-descriptions>
<div class="train-number">
<h2>
出车记录
</h2>
<zkTableList :ListUrl="TrainNumberList" :ListUrlData="zkSelectData" :ListFieldName="zkSelectDataFieldName"
:Columns="this.$data.columns">
</zkTableList>
</div>
</div> </div>
</template> </template>
<script> <script>
// import ZkTable from "@/components/zk/zkTable.vue"; import zkTableList from "./TrainNumberList.vue";
export default { export default {
components: { components: {
// ZkTable zkTableList
}, },
props: { props: {
dataId: { dataId: {
@ -80,6 +90,61 @@ export default {
}, },
data() { data() {
return { return {
TrainNumberList: `${this.$BASE_URL}/TrainNumber/v1/train/number/list`, //
zkSelectData:{
},
zkSelectDataFieldName:"TrainNumber",
//
columns: [
{ type: 'seq', width: 60 },
{ type: 'checkbox', width: 42 },
// =============================== Start ===============================
{ field: 'code', align: 'center', sortable: true, title: '车次单号', width: 120 }, //
{
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: 'soil_quality_material_id', sortable: true, title: 'id', width: 250}, // id
// {field: 'outbound_soil_quality_material_id', sortable: true, title: 'id', width: 250}, // id
// {field: 'warehousing_soil_quality_material_id', sortable: true, title: 'id', width: 250}, // id
// {field: 'unit_price', sortable: true, title: '', width: 120}, //
// {field: 'total_price', sortable: true, title: '', width: 120}, //
{
field: 'is_outsourcing', align: 'center', sortable: true, title: '类型', width: 80,
slots: { default: 'is_outsourcing' }
}, //
// {field: 'is_need_outbound', sortable: true, title: '', width: 70}, //
{ field: 'outbound_date', align: 'center', sortable: true, formatter: 'formatDate', title: '出车日期', width: 100 }, //
{ field: 'return_date', align: 'center', sortable: true, formatter: 'formatDate', title: '回车日期', width: 100 }, //
{ field: 'outbound_mileage', align: 'center', sortable: true, title: '出车公里数', width: 120 }, //
{ field: 'outbound_remark', align: 'center', sortable: true, title: '出车备注', width: 250 }, //
// {
// field: 'income', sortable: true, title: '', width: 80, fixed: 'right',
// align: 'center',
// }, //
// {
// field: 'cost', sortable: true, title: '', width: 80, fixed: 'right',
// align: 'center',
// }, //
// {
// field: 'profit', sortable: true, title: '', width: 80, fixed: 'right',
// align: 'center',
// }, //
// =============================== Start ===============================
],
data: {}, data: {},
} }
}, },
@ -120,4 +185,9 @@ export default {
margin: 10px; margin: 10px;
} }
.train-number {
margin-top: 20px;
margin-bottom: 10px;
}
</style> </style>

View File

@ -0,0 +1,302 @@
<template>
<vxe-grid ref='xGrid' v-bind="gridOptions" @form-submit="initListData" @page-change="handlePageChange">
<!-- 工具栏 -->
<template #toolbar_buttons>
<a-button @click="pageDelete()">批量删除</a-button>
</template>
<!-- 时间选择 -->
<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
},
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.$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>