This commit is contained in:
parent
a5db38b3c8
commit
5b719b9542
|
|
@ -181,7 +181,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ export default {
|
|||
for (let i in this.searchRules) { // 遍历搜索规则
|
||||
if (this.searchRules[i].key == k) return this.searchRules[i].mode; // 如果找到了就返回搜索模式
|
||||
}
|
||||
return "equal"; // 如果没有找到就返回等于
|
||||
return "="; // 如果没有找到就返回等于
|
||||
};
|
||||
|
||||
for (let key in this.searchFormData) { // 遍历搜索表单数据
|
||||
|
|
|
|||
|
|
@ -177,11 +177,11 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'code', sortable: true, title: '编码', width: 250}, // 编码
|
||||
{field: 'code', sortable: true, title: '编码', width: 120}, // 编码
|
||||
{field: 'staff_name', sortable: true, title: '员工姓名', width: 250}, // 员工姓名
|
||||
{field: 'staff_code', sortable: true, title: '员工编号', width: 250}, // 员工编号
|
||||
{field: 'staff_phone', sortable: true, title: '员工手机号', width: 250}, // 员工手机号
|
||||
{field: 'wages_date', sortable: true, title: '工资日期', width: 250}, // 工资日期
|
||||
{field: 'wages_date', sortable: true, title: '工资日期', width: 120}, // 工资日期
|
||||
{field: 'wages_year', sortable: true, title: '工资年份', width: 250}, // 工资年份
|
||||
{field: 'wages_month', sortable: true, title: '工资月份', width: 250}, // 工资月份
|
||||
{field: 'wages_type', sortable: true, title: '工资类型', width: 250}, // 工资类型
|
||||
|
|
@ -203,7 +203,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'code', sortable: true, title: '编码', width: 250}, // 编码
|
||||
{field: 'code', sortable: true, title: '编码', width: 120}, // 编码
|
||||
{field: 'staff_uid', sortable: true, title: '员工uid', width: 250}, // 员工uid
|
||||
{field: 'balance_type', sortable: true, title: '结余类型', width: 250}, // 结余类型:1增加,2减少
|
||||
{field: 'balance_amount', sortable: true, title: '修改金额', width: 250}, // 修改金额
|
||||
|
|
@ -187,7 +187,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,8 +181,8 @@ export default {
|
|||
|
||||
|
||||
{field: 'staff_uid', sortable: true, title: '员工uid', width: 250}, // 员工uid
|
||||
{field: 'transport_mileage', sortable: true, title: '运输总公里数', width: 250}, // 运输总公里数
|
||||
{field: 'month_mileage', sortable: true, title: '本月份总公里数', width: 250}, // 本月份总公里数
|
||||
{field: 'transport_mileage', sortable: true, title: '运输总公里数', width: 120}, // 运输总公里数
|
||||
{field: 'month_mileage', sortable: true, title: '本月份总公里数', width: 120}, // 本月份总公里数
|
||||
{field: 'wages_balance', sortable: true, title: '工资结余', width: 250}, // 工资结余
|
||||
{
|
||||
field: 'status',
|
||||
|
|
@ -206,7 +206,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'code', sortable: true, title: '编码', width: 250}, // 编码
|
||||
{field: 'code', sortable: true, title: '编码', width: 120}, // 编码
|
||||
{field: 'name', sortable: true, title: '名称', width: 250}, // 名称
|
||||
{field: 'description', sortable: true, title: '描述', width: 250}, // 描述
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +1,36 @@
|
|||
<template>
|
||||
<page-layout>
|
||||
<div class="page-body">
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
<div class="page-body">
|
||||
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
|
||||
</div>
|
||||
</page-layout>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BASE_URL from '@/services/Middle/transport/Maintenance/api.js';
|
||||
import PageLayout from '@/layouts/PageLayout'
|
||||
// import PageLayout from '@/layouts/PageLayout'
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
name: 'MaintenanceGiornaleLogUpdate',
|
||||
i18n: require('./i18n'),
|
||||
components: {PageLayout},
|
||||
// components: { PageLayout },
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
|
|
@ -97,8 +96,11 @@ export default {
|
|||
truck_code: "",
|
||||
truck_name: "",
|
||||
truck_number: "",
|
||||
other_expenses_name: "",
|
||||
other_expenses_remark: "",
|
||||
maintenance_id: 0,
|
||||
maintenance_name: "",
|
||||
maintenance_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||
maintenance_price: 0,
|
||||
maintenance_remark: "",
|
||||
create_uid: 0,
|
||||
update_uid: 0,
|
||||
create_time: new Date(2100, 1, 1).getTime() / 10000,
|
||||
|
|
@ -117,31 +119,34 @@ export default {
|
|||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
|
||||
truck_number_id: [
|
||||
{message: '请输入车次id'}
|
||||
{ message: '请输入车次id' }
|
||||
],
|
||||
truck_number_code: [
|
||||
{message: '请输入车次单号'}
|
||||
{ message: '请输入车次单号' }
|
||||
],
|
||||
truck_id: [
|
||||
{message: '请输入车辆id'}
|
||||
{ message: '请输入车辆id' }
|
||||
],
|
||||
truck_code: [
|
||||
{message: '请输入车辆编码'}
|
||||
{ message: '请输入车辆编码' }
|
||||
],
|
||||
truck_name: [
|
||||
{message: '请输入车辆名称'}
|
||||
{ message: '请输入车辆名称' }
|
||||
],
|
||||
truck_number: [
|
||||
{message: '请输入车牌号'}
|
||||
{ message: '请输入车牌号' }
|
||||
],
|
||||
other_expenses_name: [
|
||||
{message: '请输入其他费用名称'}
|
||||
maintenance_id: [
|
||||
{ message: '请输入维修项目' }
|
||||
],
|
||||
other_expenses_remark: [
|
||||
{message: '请输入其他费用备注'}
|
||||
maintenance_date:[
|
||||
{ message: '请输入维修日期' }
|
||||
],
|
||||
other_expenses_amount: [
|
||||
{message: '请输入其他费用金额'}
|
||||
maintenance_remark: [
|
||||
{ message: '请输入维修备注' }
|
||||
],
|
||||
maintenance_price: [
|
||||
{ message: '请输入维修金额' }
|
||||
],
|
||||
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
|
|
@ -150,15 +155,63 @@ export default {
|
|||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
|
||||
{field: 'truck_number_id', title: '车次id', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number_code', title: '车次单号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'other_expenses_name', title: '其他费用名称', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'other_expenses_remark', title: '其他费用备注', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'other_expenses_amount', title: '其他费用金额', span: 12, itemRender: {name: '$input'}},
|
||||
{
|
||||
title: '车辆', span: 6,
|
||||
field: 'Truck',
|
||||
dataRule: {
|
||||
fromField: "name",
|
||||
saveField: "name"
|
||||
},
|
||||
itemRender: {
|
||||
name: 'MkFormDataSelector', props: {
|
||||
params: {
|
||||
dataType: "string",
|
||||
valueField: "id",
|
||||
textField: "name",
|
||||
listdataFieldName: 'Truck',
|
||||
dataUrl: `${BASE_URL.BASE_URL}/Truck/v1/truck/list`,
|
||||
onDataChanged: ({ data }) => {
|
||||
console.log(data)
|
||||
this.formOptions.data.truck_id = data.id;
|
||||
this.formOptions.data.truck_code = data.code;
|
||||
this.formOptions.data.truck_name = data.name;
|
||||
this.formOptions.data.truck_number = data.plate_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '维修项目', span: 6,
|
||||
field: 'Maintenance',
|
||||
dataRule: {
|
||||
fromField: "name",
|
||||
saveField: "name"
|
||||
},
|
||||
itemRender: {
|
||||
name: 'MkFormDataSelector', props: {
|
||||
params: {
|
||||
dataType: "string",
|
||||
valueField: "id",
|
||||
textField: "name",
|
||||
listdataFieldName: 'Maintenance',
|
||||
dataUrl: `${BASE_URL.BASE_URL}/Maintenance/v1/maintenance/list`,
|
||||
onDataChanged: ({ data }) => {
|
||||
console.log(data)
|
||||
this.formOptions.data.maintenance_id = data.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'maintenance_date', dataRule: { type: 'timestamp' }, title: '维修日期', span: 6, itemRender: { name: '$input', props: { type: "date" } } },
|
||||
{
|
||||
field: 'maintenance_price', title: '维修金额', span: 6, itemRender: {
|
||||
name: '$input', props: { type: 'number' }
|
||||
}
|
||||
},
|
||||
{ field: 'maintenance_remark', title: '维修备注', span: 24, itemRender: { name: '$textarea' } },
|
||||
|
||||
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
|
|
@ -269,7 +322,9 @@ export default {
|
|||
|
||||
let save = () => {
|
||||
|
||||
// this.formOptions.data.maintenance_price 转换为数字
|
||||
|
||||
this.formOptions.data.maintenance_price = Number(this.formOptions.data.maintenance_price);
|
||||
// 如果是新增模式,提交新增接口 如果是编辑模式,提交编辑接口
|
||||
let action = !this.isEdit ? this.actions.MaintenanceGiornaleLogCreate : this.actions.MaintenanceGiornaleLogUpdate;
|
||||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||
|
|
@ -279,7 +334,7 @@ export default {
|
|||
// postdata = { MaintenanceGiornaleLog: postdata }
|
||||
}
|
||||
// 格式化提交的数据
|
||||
this.$mk.formatFormData({data: postdata, rules: this.formOptions.items});
|
||||
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
|
||||
|
||||
|
||||
// 提交数据
|
||||
|
|
@ -302,7 +357,7 @@ export default {
|
|||
|
||||
|
||||
// 验证表单
|
||||
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { // 验证表单
|
||||
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { // 验证表单
|
||||
save(); // 提交保存
|
||||
}).catch(count => { // 验证失败
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ export default {
|
|||
},
|
||||
data() {
|
||||
|
||||
const listFieldName = 'Maintenance';
|
||||
const listFieldName = 'MaintenanceGiornaleLog';
|
||||
// 页面数据
|
||||
var pageData = { // 页面数据变量
|
||||
|
||||
keyName: 'id', // 主键字段名
|
||||
listFieldName: 'maintenance_giornale_log',
|
||||
listFieldName: 'MaintenanceGiornaleLog',
|
||||
|
||||
|
||||
// 接口动作
|
||||
|
|
@ -179,30 +179,40 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
||||
{field: 'other_expenses_name', sortable: true, title: '其他费用名称', width: 250}, // 其他费用名称
|
||||
{field: 'other_expenses_remark', sortable: true, title: '其他费用备注', width: 250}, // 其他费用备注
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'maintenance_name', sortable: true, title: '维修项目名称', width: 150}, // 维修项目名称
|
||||
{field: 'maintenance_code', sortable: true, title: '维修项目编码', width: 140}, // 维修项目编码
|
||||
{field: 'last_maintenance_date', sortable: true, title: '上次维修日期', width: 130}, // 上次维修日期
|
||||
{field: 'last_mileage', sortable: true, title: '上次维修公里数', width: 140}, // 上次维修公里数
|
||||
{field: 'mileage', sortable: true, title: '维修公里数记录', width: 140}, // 维修公里数记录
|
||||
{field: 'maintenance_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: 'create_time',
|
||||
field: 'maintenance_date',
|
||||
formatter: 'formatDate',
|
||||
width: 100,
|
||||
sortable: true,
|
||||
title: '创建时间',
|
||||
title: '维修日期',
|
||||
showHeaderOverflow: true
|
||||
}, // 创建时间
|
||||
}, // 维修日期
|
||||
|
||||
{field: 'maintenance_remark', sortable: true, title: '维修备注', width: 250}, // 维修备注
|
||||
|
||||
|
||||
|
||||
|
||||
{field: 'other_expenses_amount', sortable: true, title: '其他费用金额', width: 250}, // 其他费用金额
|
||||
|
||||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +1,35 @@
|
|||
<template>
|
||||
<page-layout :desc="desc">
|
||||
<div class="page-body">
|
||||
<div class="page-body">
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
|
||||
</div>
|
||||
</page-layout>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BASE_URL from '@/services/Middle/transport/Maintenance/api.js';
|
||||
import PageLayout from '@/layouts/PageLayout'
|
||||
// import PageLayout from '@/layouts/PageLayout'
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
name: 'OtherExpensesLogUpdate',
|
||||
i18n: require('./i18n'),
|
||||
components: {PageLayout},
|
||||
// components: {PageLayout},
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
|
|
@ -150,15 +148,35 @@ export default {
|
|||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
|
||||
{field: 'truck_number_id', title: '车次id', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number_code', title: '车次单号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
||||
{
|
||||
title: '车辆', span: 6,
|
||||
field: 'Truck',
|
||||
dataRule: {
|
||||
fromField: "name",
|
||||
saveField: "name"
|
||||
},
|
||||
itemRender: {
|
||||
name: 'MkFormDataSelector', props: {
|
||||
params: {
|
||||
dataType: "string",
|
||||
valueField: "id",
|
||||
textField: "name",
|
||||
listdataFieldName: 'Truck',
|
||||
dataUrl: `${BASE_URL.BASE_URL}/Truck/v1/truck/list`,
|
||||
onDataChanged: ({ data }) => {
|
||||
console.log(data)
|
||||
this.formOptions.data.truck_id = data.id;
|
||||
this.formOptions.data.truck_code = data.code;
|
||||
this.formOptions.data.truck_name = data.name;
|
||||
this.formOptions.data.truck_number = data.plate_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{field: 'other_expenses_name', title: '其他费用名称', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'other_expenses_remark', title: '其他费用备注', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'other_expenses_amount', title: '其他费用金额', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'other_expenses_amount', title: '其他费用金额', span: 12, itemRender: {name: '$input', props: { type: 'number' }}},
|
||||
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
|
|
@ -270,8 +288,12 @@ export default {
|
|||
let save = () => {
|
||||
|
||||
|
||||
// 将this.formOptions.data.other_expenses_amount转换为数字类型
|
||||
this.formOptions.data.other_expenses_amount = parseFloat(this.formOptions.data.other_expenses_amount);
|
||||
|
||||
|
||||
// 如果是新增模式,提交新增接口 如果是编辑模式,提交编辑接口
|
||||
let action = !this.isEdit ? this.actions.create : this.actions.update;
|
||||
let action = !this.isEdit ? this.actions.OtherExpensesLogCreate : this.actions.OtherExpensesLogUpdate;
|
||||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
// 如果是编辑模式
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
|
||||
const listFieldName = 'other_expenses_log';
|
||||
const listFieldName = 'OtherExpensesLog';
|
||||
// 页面数据
|
||||
var pageData = { // 页面数据变量
|
||||
|
||||
|
|
@ -178,12 +178,11 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 120}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'other_expenses_name', sortable: true, title: '其他费用名称', width: 250}, // 其他费用名称
|
||||
{field: 'other_expenses_remark', sortable: true, title: '其他费用备注', width: 250}, // 其他费用备注
|
||||
|
||||
|
|
@ -201,7 +200,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,65 +1,58 @@
|
|||
<template>
|
||||
<basic-page-edit :desc="desc" :dataId="getDataId()" :options="pageOptions"></basic-page-edit>
|
||||
<div class="page-body">
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BASE_URL from '@/services/Middle/transport/OilConsumption/api.js';
|
||||
// import PageLayout from '@/layouts/PageLayout'
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
name: 'OilConsumptionUpdate',
|
||||
i18n: require('./i18n'),
|
||||
components: {},
|
||||
// components: {PageLayout},
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
default: "edit"
|
||||
},
|
||||
dataId: {}
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
return {
|
||||
pageOptions: {}
|
||||
};
|
||||
},
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
// 当前项目名称
|
||||
currentConfigName: "",
|
||||
// 当前项目ID
|
||||
currentBeid: 0,
|
||||
|
||||
computed: {
|
||||
// desc() {
|
||||
// return this.$t('editPageDesc')
|
||||
// }
|
||||
},
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "OilConsumption",
|
||||
|
||||
|
||||
created() {
|
||||
|
||||
this.optionsInit();
|
||||
this.dataInit();
|
||||
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
||||
optionsInit() {
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
// 当前项目名称
|
||||
currentConfigName: "",
|
||||
// 当前项目ID
|
||||
currentBeid: 0,
|
||||
|
||||
addPageUrl: "/OilConsumption/OilConsumptionCreate",
|
||||
editPageUrl: "/OilConsumption/OilConsumptionUpdate/",
|
||||
listPageUrl: "/OilConsumption/OilConsumptionList",
|
||||
|
||||
|
||||
uploadDefaultImg: null, // 上传默认图片
|
||||
detailDataFieldName: "OilConsumption", // 详情数据字段名称
|
||||
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
OilConsumptionList: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/list`, // 油耗列表
|
||||
OilConsumptionSearch: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/search`, // 油耗搜索
|
||||
OilConsumptionDetail: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/detail`, // 油耗详情
|
||||
|
|
@ -70,17 +63,16 @@ export default {
|
|||
OilConsumptionBatchUpdate: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchUpdate`, // 批量更新油耗
|
||||
OilConsumptionBatchCreate: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchCreate`, // 批量创建油耗
|
||||
OilConsumptionBatchHandle: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchHandle`, // 批量处理油耗
|
||||
// =============================== 接口地址 自动生成 End ===============================
|
||||
},
|
||||
|
||||
|
||||
// =============================== 接口地址 自动生成 End ===============================
|
||||
},
|
||||
|
||||
keyName: 'id',
|
||||
// 是否编辑模式
|
||||
isEdit: false,
|
||||
// 表单数据
|
||||
formOptions: {
|
||||
data: {
|
||||
keyName: 'id',
|
||||
// 是否编辑模式
|
||||
isEdit: false,
|
||||
// 表单数据
|
||||
formOptions: {
|
||||
data: {
|
||||
// =============================== 表单数据 自动生成 Start ===============================
|
||||
|
||||
id: 0,
|
||||
truck_number_id: 0,
|
||||
|
|
@ -100,112 +92,163 @@ export default {
|
|||
oil_consumption_remark: "",
|
||||
create_uid: 0,
|
||||
update_uid: 0,
|
||||
},
|
||||
// 标题宽度
|
||||
titleWidth: 150,
|
||||
// 标题对齐方式
|
||||
titleAlign: 'right',
|
||||
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
// =============================== 表单数据 自动生成 End ===============================
|
||||
},
|
||||
// 标题宽度
|
||||
titleWidth: 150,
|
||||
// 标题对齐方式
|
||||
titleAlign: 'right',
|
||||
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
|
||||
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
},
|
||||
// 表单项
|
||||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
|
||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number_before_mileage', title: '出车前总公里数', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number_after_mileage', title: '回车后总公里数', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'oil_consumption_number', title: '油耗数量', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'oil_consumption_price', title: '油耗单价', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'oil_consumption_total_price', title: '油耗总价', span: 12, itemRender: {name: '$input'}},
|
||||
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
},
|
||||
// 表单项
|
||||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
// {
|
||||
// title: '车次', span: 6,
|
||||
// field: 'TrainNumber',
|
||||
// dataRule: {
|
||||
// fromField: "TrainNumber",
|
||||
// saveField: "TrainNumber"
|
||||
// },
|
||||
// itemRender: {
|
||||
// name: 'MkFormDataSelector', props: {
|
||||
// params: {
|
||||
// dataType: "string",
|
||||
// valueField: "truck_number_id",
|
||||
// textField: "truck_number_code",
|
||||
// listdataFieldName: 'TrainNumber',
|
||||
// dataUrl: `${BASE_URL.BASE_URL}/TrainNumber/v1/train/number/list`,
|
||||
// onDataChanged: ({ data }) => {
|
||||
// console.log(data)
|
||||
// this.formOptions.data.truck_number_id = data.id;
|
||||
// this.formOptions.data.truck_number_code = data.code;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: '车辆', span: 6,
|
||||
field: 'Truck',
|
||||
dataRule: {
|
||||
fromField: "name",
|
||||
saveField: "name"
|
||||
},
|
||||
itemRender: {
|
||||
name: 'MkFormDataSelector', props: {
|
||||
params: {
|
||||
dataType: "string",
|
||||
valueField: "id",
|
||||
textField: "name",
|
||||
listdataFieldName: 'Truck',
|
||||
dataUrl: `${BASE_URL.BASE_URL}/Truck/v1/truck/list`,
|
||||
onDataChanged: ({ data }) => {
|
||||
console.log(data)
|
||||
this.formOptions.data.truck_id = data.id;
|
||||
this.formOptions.data.truck_code = data.code;
|
||||
this.formOptions.data.truck_name = data.name;
|
||||
this.formOptions.data.truck_number = data.plate_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'oil_consumption_date',
|
||||
dataRule: {type: "timestamp"},
|
||||
title: '油耗日期',
|
||||
span: 12,
|
||||
span: 6,
|
||||
itemRender: {name: '$input', props: {type: "date"}}
|
||||
},
|
||||
{field: 'oil_consumption_hundred', title: '百公里油耗', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'oil_consumption_remark', title: '油耗备注', span: 12, 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: 'oil_consumption_number', title: '油耗数量', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_price', title: '油耗单价', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_total_price', title: '油耗总价', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_hundred', title: '百公里油耗', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
|
||||
{field: 'oil_consumption_remark', title: '油耗备注', span: 24, itemRender: {name: '$textarea'}},
|
||||
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [],
|
||||
|
||||
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [],
|
||||
};
|
||||
|
||||
pageData.actions.get = pageData.actions.OilConsumptionDetail;
|
||||
pageData.actions.create = pageData.actions.OilConsumptionCreate;
|
||||
pageData.actions.update = pageData.actions.OilConsumptionUpdate;
|
||||
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
||||
return pageData;
|
||||
},
|
||||
|
||||
computed: {
|
||||
// desc() {
|
||||
// return this.$t('editPageDesc')
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
created() {
|
||||
|
||||
pageData.actions.get = pageData.actions.OilConsumptionDetail;
|
||||
pageData.actions.create = pageData.actions.OilConsumptionCreate;
|
||||
pageData.actions.update = pageData.actions.OilConsumptionUpdate;
|
||||
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
|
||||
this.pageOptions = pageData;
|
||||
},
|
||||
|
||||
dataInit() {
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
// 如果有id参数,说明是编辑模式
|
||||
if (dataId) {
|
||||
const json = `{"id":${dataId}}`;
|
||||
this.$mk.post({
|
||||
url: this.pageOptions.actions.get,
|
||||
loading: "加载中...",
|
||||
data: json,
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
// 如果有id参数,说明是编辑模式
|
||||
if (dataId) {
|
||||
const json = `{"id":${dataId}}`;
|
||||
this.$mk.post({
|
||||
url: this.actions.get,
|
||||
loading: "加载中...",
|
||||
data: json,
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(a => {
|
||||
}
|
||||
}).then(a => {
|
||||
// =============================== 时间字段判断 自动生成 Start ===============================
|
||||
|
||||
let detailDataFieldName = this.pageOptions.detailDataFieldName;
|
||||
if (a.data[this.detailDataFieldName].create_time) {
|
||||
a.data[this.detailDataFieldName].create_time = new Date(a.data[this.detailDataFieldName].create_time * 1000);
|
||||
}
|
||||
if (a.data[this.detailDataFieldName].update_time) {
|
||||
a.data[this.detailDataFieldName].update_time = new Date(a.data[this.detailDataFieldName].update_time * 1000);
|
||||
}
|
||||
|
||||
let rules = [
|
||||
{field: "warehouse_effective_date", dataRule: "timestamp"},
|
||||
{field: "warehouse_invalid_date", dataRule: "timestamp"},
|
||||
{field: "create_time", dataRule: "timestamp"},
|
||||
{field: "update_time", dataRule: "timestamp"},
|
||||
];
|
||||
rules = []; //上面几个字段如果不需要在表单显示,可以不转换(不转换的话,表单拿到的是什么数据,提交的时候就是什么数据)
|
||||
this.$mk.formatInitFormData({
|
||||
data: a.data[detailDataFieldName],
|
||||
rules: [...this.pageOptions.formOptions.items, ...rules]
|
||||
}); //建议固定格式化写法
|
||||
// =============================== 时间字段判断 自动生成 End ===============================
|
||||
this.formOptions.data = a.data[this.detailDataFieldName];
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
|
||||
this.pageOptions.formOptions.data = a.data[detailDataFieldName];
|
||||
this.isEdit = true;
|
||||
} else {
|
||||
// 如果没有id参数,说明是新增模式
|
||||
this.addModeItems.forEach(item => {
|
||||
this.formOptions.items.push(item);
|
||||
})
|
||||
|
||||
this.$forceUpdate()
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
this.pageOptions.isEdit = true;
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
this.$forceUpdate()
|
||||
} else {
|
||||
// 如果没有id参数,说明是新增模式
|
||||
this.addModeItems.forEach(item => {
|
||||
this.pageOptions.formOptions.items.push(item);
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 获取路由的id参数
|
||||
getDataId() {
|
||||
|
|
@ -217,6 +260,86 @@ export default {
|
|||
dataId = 0;
|
||||
}
|
||||
return dataId;
|
||||
},
|
||||
|
||||
|
||||
// 返回
|
||||
back() {
|
||||
// 如果是新增模式,关闭当前页面
|
||||
if (!this.isEdit) {
|
||||
this.$closePage({
|
||||
closeRoute: "/OilConsumption/OilConsumptionCreate"
|
||||
});
|
||||
} else {
|
||||
// 如果是编辑模式,关闭当前页面
|
||||
this.$closePage({
|
||||
closeRoute: "/OilConsumption/OilConsumptionUpdate"
|
||||
});
|
||||
}
|
||||
// 打开列表页面
|
||||
this.$openPage('/OilConsumption/OilConsumptionList')
|
||||
},
|
||||
|
||||
// 保存
|
||||
ok() {
|
||||
|
||||
let save = () => {
|
||||
|
||||
|
||||
// 将this.formOptions.data.tire_count
|
||||
this.formOptions.data.oil_consumption_number = parseFloat(this.formOptions.data.oil_consumption_number);
|
||||
this.formOptions.data.oil_consumption_price = parseFloat(this.formOptions.data.oil_consumption_price);
|
||||
this.formOptions.data.oil_consumption_total_price = parseFloat(this.formOptions.data.oil_consumption_total_price);
|
||||
this.formOptions.data.oil_consumption_hundred = parseFloat(this.formOptions.data.oil_consumption_hundred);
|
||||
this.formOptions.data. truck_number_before_mileage = parseFloat(this.formOptions.data. truck_number_before_mileage);
|
||||
this.formOptions.data. truck_number_after_mileage = parseFloat(this.formOptions.data. truck_number_after_mileage);
|
||||
|
||||
|
||||
// 如果是新增模式,提交新增接口 如果是编辑模式,提交编辑接口
|
||||
let action = !this.isEdit ? this.actions.OilConsumptionCreate : this.actions.OilConsumptionUpdate;
|
||||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
// 如果是编辑模式
|
||||
if (this.isEdit) {
|
||||
// postdata = { OilConsumption: postdata }
|
||||
}
|
||||
// 格式化提交的数据
|
||||
this.$mk.formatFormData({data: postdata, rules: this.formOptions.items});
|
||||
|
||||
|
||||
// 提交数据
|
||||
this.$mk.post({
|
||||
url: action,
|
||||
loading: "保存中...",
|
||||
data: postdata,
|
||||
useBigInt: true,
|
||||
}).then(() => { // 成功回调
|
||||
this.$mk.success("保存成功");
|
||||
if (!this.isEdit) { // 如果是新增模式,关闭当前页面
|
||||
this.back();
|
||||
}
|
||||
}).catch((a) => { // 失败回调
|
||||
this.$mk.error(a.data.msg); // 显示错误信息
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 验证表单
|
||||
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { // 验证表单
|
||||
save(); // 提交保存
|
||||
}).catch(count => { // 验证失败
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
// 取消 返回
|
||||
cancel() {
|
||||
this.back();
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
|
|
@ -224,3 +347,35 @@ export default {
|
|||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="less">
|
||||
.page-body {
|
||||
padding: 30px;
|
||||
background: @base-bg-color;
|
||||
}
|
||||
|
||||
.formtabs .ant-tabs-tabpane {
|
||||
/* background: white; */
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.gridPanel {
|
||||
height: calc(100vh - 600px);
|
||||
}
|
||||
|
||||
.footerbar {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.imagePanel {
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
width: 100px;
|
||||
|
||||
img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -165,16 +165,15 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 120}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'oil_consumption_number', sortable: true, title: '油耗数量', width: 250}, // 油耗数量
|
||||
{field: 'oil_consumption_price', sortable: true, title: '油耗单价', width: 250}, // 油耗单价
|
||||
{field: 'oil_consumption_total_price', sortable: true, title: '油耗总价', width: 250}, // 油耗总价
|
||||
{field: 'oil_consumption_date', sortable: true, title: '油耗日期', width: 250}, // 油耗日期
|
||||
{field: 'oil_consumption_date', sortable: true, title: '油耗日期', width: 120}, // 油耗日期
|
||||
{field: 'oil_consumption_hundred', sortable: true, title: '百公里油耗', width: 250}, // 百公里油耗
|
||||
{field: 'oil_consumption_remark', sortable: true, title: '油耗备注', width: 250}, // 油耗备注
|
||||
|
||||
|
|
@ -191,7 +190,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,64 +1,58 @@
|
|||
<template>
|
||||
<basic-page-edit :desc="desc" :dataId="getDataId()" :options="pageOptions"></basic-page-edit>
|
||||
<div class="page-body">
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BASE_URL from '@/services/Middle/transport/Tire/api.js';
|
||||
// import PageLayout from '@/layouts/PageLayout'
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
name: 'TireUpdate',
|
||||
i18n: require('./i18n'),
|
||||
components: {},
|
||||
// components: {PageLayout},
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
default: "edit"
|
||||
},
|
||||
dataId: {}
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
return {
|
||||
pageOptions: {}
|
||||
};
|
||||
},
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
// 当前项目名称
|
||||
currentConfigName: "",
|
||||
// 当前项目ID
|
||||
currentBeid: 0,
|
||||
|
||||
computed: {
|
||||
// desc() {
|
||||
// return this.$t('editPageDesc')
|
||||
// }
|
||||
},
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "Tire",
|
||||
|
||||
|
||||
created() {
|
||||
|
||||
this.optionsInit();
|
||||
this.dataInit();
|
||||
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
||||
optionsInit() {
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
// 当前项目名称
|
||||
currentConfigName: "",
|
||||
// 当前项目ID
|
||||
currentBeid: 0,
|
||||
|
||||
addPageUrl: "/Truck/TruckCreate",
|
||||
editPageUrl: "/Truck/TruckUpdate/",
|
||||
listPageUrl: "/Truck/TruckList",
|
||||
|
||||
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "mes_warehouse",
|
||||
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
TireList: `${BASE_URL.BASE_URL}/Tire/v1/tire/list`, // 轮胎列表
|
||||
TireSearch: `${BASE_URL.BASE_URL}/Tire/v1/tire/search`, // 轮胎搜索
|
||||
TireDetail: `${BASE_URL.BASE_URL}/Tire/v1/tire/detail`, // 轮胎详情
|
||||
|
|
@ -70,17 +64,16 @@ export default {
|
|||
TireBatchCreate: `${BASE_URL.BASE_URL}/Tire/v1/tire/batchCreate`, // 批量创建轮胎
|
||||
TireBatchHandle: `${BASE_URL.BASE_URL}/Tire/v1/tire/batchHandle`, // 批量处理轮胎
|
||||
TireAbolish: `${BASE_URL.BASE_URL}/Tire/v1/tire/abolish`, // 轮胎作废
|
||||
// =============================== 接口地址 自动生成 End ===============================
|
||||
},
|
||||
|
||||
// =============================== 接口地址 自动生成 End ===============================
|
||||
},
|
||||
|
||||
keyName: 'id',
|
||||
// 是否编辑模式
|
||||
isEdit: false,
|
||||
// 表单数据
|
||||
formOptions: {
|
||||
data: {
|
||||
|
||||
keyName: 'id',
|
||||
// 是否编辑模式
|
||||
isEdit: false,
|
||||
// 表单数据
|
||||
formOptions: {
|
||||
data: {
|
||||
// =============================== 表单数据 自动生成 Start ===============================
|
||||
truck_number_id: 0,
|
||||
truck_number_code: "",
|
||||
truck_id: 0,
|
||||
|
|
@ -105,109 +98,173 @@ export default {
|
|||
create_uid: 0,
|
||||
update_uid: 0,
|
||||
tire_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||
},
|
||||
// 标题宽度
|
||||
titleWidth: 150,
|
||||
// 标题对齐方式
|
||||
titleAlign: 'right',
|
||||
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
// =============================== 表单数据 自动生成 End ===============================
|
||||
},
|
||||
// 标题宽度
|
||||
titleWidth: 100,
|
||||
// 标题对齐方式
|
||||
titleAlign: 'right',
|
||||
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
|
||||
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
},
|
||||
// 表单项
|
||||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_type', title: '轮胎更换类型', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_brand', title: '轮胎品牌', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_model', title: '轮胎型号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_count', title: '轮胎更换数量', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_price', title: '轮胎更换价格', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_number', title: '轮胎胎号', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'tire_remark', title: '轮胎更换备注', span: 12, itemRender: {name: '$input'}},
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
},
|
||||
// 表单项
|
||||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
// {
|
||||
// title: '车次', span: 6,
|
||||
// field: 'TrainNumber',
|
||||
// dataRule: {
|
||||
// fromField: "TrainNumber",
|
||||
// saveField: "TrainNumber"
|
||||
// },
|
||||
// itemRender: {
|
||||
// name: 'MkFormDataSelector', props: {
|
||||
// params: {
|
||||
// dataType: "string",
|
||||
// valueField: "truck_number_id",
|
||||
// textField: "truck_number_code",
|
||||
// listdataFieldName: 'TrainNumber',
|
||||
// dataUrl: `${BASE_URL.BASE_URL}/TrainNumber/v1/train/number/list`,
|
||||
// onDataChanged: ({ data }) => {
|
||||
// console.log(data)
|
||||
// this.formOptions.data.truck_number_id = data.id;
|
||||
// this.formOptions.data.truck_number_code = data.code;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: '车辆', span: 6,
|
||||
field: 'Truck',
|
||||
dataRule: {
|
||||
fromField: "name",
|
||||
saveField: "name"
|
||||
},
|
||||
itemRender: {
|
||||
name: 'MkFormDataSelector', props: {
|
||||
params: {
|
||||
dataType: "string",
|
||||
valueField: "id",
|
||||
textField: "name",
|
||||
listdataFieldName: 'Truck',
|
||||
dataUrl: `${BASE_URL.BASE_URL}/Truck/v1/truck/list`,
|
||||
onDataChanged: ({ data }) => {
|
||||
console.log(data)
|
||||
this.formOptions.data.truck_id = data.id;
|
||||
this.formOptions.data.truck_code = data.code;
|
||||
this.formOptions.data.truck_name = data.name;
|
||||
this.formOptions.data.truck_number = data.plate_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'tire_type', title: '类型', span: 12,
|
||||
itemRender: {
|
||||
name: '$select',
|
||||
props: {
|
||||
options: [
|
||||
{ label: '更换', value: '1' },
|
||||
{ label: '补胎', value: '2' },
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'tire_brand', title: '品牌', span: 12, itemRender: { name: '$input' } },
|
||||
{ field: 'tire_model', title: '型号', span: 12, itemRender: { name: '$input' } },
|
||||
{ field: 'tire_count', title: '数量', span: 12, itemRender: { name: '$input' , props: { type: 'number' }} },
|
||||
{ field: 'tire_price', title: '价格', span: 12, itemRender: { name: '$input', props: { type: 'number' } } },
|
||||
{ field: 'tire_number', title: '胎号', span: 12, itemRender: { name: '$input' } },
|
||||
{ field: 'tire_remark', title: '备注', span: 12, itemRender: { name: '$input' } },
|
||||
{
|
||||
field: 'tire_date',
|
||||
dataRule: {type: "timestamp"},
|
||||
title: '轮胎更换日期',
|
||||
dataRule: { type: "timestamp" },
|
||||
title: '日期',
|
||||
span: 12,
|
||||
itemRender: {name: '$input', props: {type: "date"}}
|
||||
itemRender: { name: '$input', props: { type: "date" } }
|
||||
},
|
||||
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [],
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [],
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
pageData.actions.get = pageData.actions.TruckDetail;
|
||||
pageData.actions.create = pageData.actions.TruckCreate;
|
||||
pageData.actions.update = pageData.actions.TruckUpdate;
|
||||
pageData.actions.get = pageData.actions.TireDetail;
|
||||
pageData.actions.create = pageData.actions.TireCreate;
|
||||
pageData.actions.update = pageData.actions.TireUpdate;
|
||||
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
||||
this.pageOptions = pageData;
|
||||
},
|
||||
return pageData;
|
||||
},
|
||||
|
||||
dataInit() {
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
// 如果有id参数,说明是编辑模式
|
||||
if (dataId) {
|
||||
const json = `{"id":${dataId}}`;
|
||||
this.$mk.post({
|
||||
url: this.pageOptions.actions.get,
|
||||
loading: "加载中...",
|
||||
data: json,
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
computed: {
|
||||
// desc() {
|
||||
// return this.$t('editPageDesc')
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
created() {
|
||||
|
||||
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
|
||||
// 如果有id参数,说明是编辑模式
|
||||
if (dataId) {
|
||||
const json = `{"id":${dataId}}`;
|
||||
this.$mk.post({
|
||||
url: this.actions.get,
|
||||
loading: "加载中...",
|
||||
data: json,
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(a => {
|
||||
}
|
||||
}).then(a => {
|
||||
// =============================== 时间字段判断 自动生成 Start ===============================
|
||||
|
||||
let detailDataFieldName = this.pageOptions.detailDataFieldName;
|
||||
if (a.data[this.detailDataFieldName].create_time) {
|
||||
a.data[this.detailDataFieldName].create_time = new Date(a.data[this.detailDataFieldName].create_time * 1000);
|
||||
}
|
||||
if (a.data[this.detailDataFieldName].update_time) {
|
||||
a.data[this.detailDataFieldName].update_time = new Date(a.data[this.detailDataFieldName].update_time * 1000);
|
||||
}
|
||||
|
||||
let rules = [
|
||||
{field: "warehouse_effective_date", dataRule: "timestamp"},
|
||||
{field: "warehouse_invalid_date", dataRule: "timestamp"},
|
||||
{field: "create_time", dataRule: "timestamp"},
|
||||
{field: "update_time", dataRule: "timestamp"},
|
||||
];
|
||||
rules = []; //上面几个字段如果不需要在表单显示,可以不转换(不转换的话,表单拿到的是什么数据,提交的时候就是什么数据)
|
||||
this.$mk.formatInitFormData({
|
||||
data: a.data[detailDataFieldName],
|
||||
rules: [...this.pageOptions.formOptions.items, ...rules]
|
||||
}); //建议固定格式化写法
|
||||
// =============================== 时间字段判断 自动生成 End ===============================
|
||||
this.formOptions.data = a.data[this.detailDataFieldName];
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
|
||||
this.pageOptions.formOptions.data = a.data[detailDataFieldName];
|
||||
this.isEdit = true;
|
||||
} else {
|
||||
// 如果没有id参数,说明是新增模式
|
||||
this.addModeItems.forEach(item => {
|
||||
this.formOptions.items.push(item);
|
||||
})
|
||||
|
||||
this.$forceUpdate()
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
this.pageOptions.isEdit = true;
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
this.$forceUpdate()
|
||||
} else {
|
||||
// 如果没有id参数,说明是新增模式
|
||||
this.addModeItems.forEach(item => {
|
||||
this.pageOptions.formOptions.items.push(item);
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 获取路由的id参数
|
||||
getDataId() {
|
||||
|
|
@ -219,6 +276,83 @@ export default {
|
|||
dataId = 0;
|
||||
}
|
||||
return dataId;
|
||||
},
|
||||
|
||||
|
||||
// 返回
|
||||
back() {
|
||||
// 如果是新增模式,关闭当前页面
|
||||
if (!this.isEdit) {
|
||||
this.$closePage({
|
||||
closeRoute: "/Tire/TireAdd"
|
||||
});
|
||||
} else {
|
||||
// 如果是编辑模式,关闭当前页面
|
||||
this.$closePage({
|
||||
closeRoute: "/Tire/TireUpdate"
|
||||
});
|
||||
}
|
||||
// 打开列表页面
|
||||
this.$openPage('/Tire/TireList')
|
||||
},
|
||||
|
||||
// 保存
|
||||
ok() {
|
||||
|
||||
let save = () => {
|
||||
|
||||
|
||||
// 将this.formOptions.data.tire_count
|
||||
this.formOptions.data.tire_count = parseFloat(this.formOptions.data.tire_count);
|
||||
this.formOptions.data.tire_price = parseFloat(this.formOptions.data.tire_price);
|
||||
|
||||
|
||||
|
||||
// 如果是新增模式,提交新增接口 如果是编辑模式,提交编辑接口
|
||||
let action = !this.isEdit ? this.actions.TireCreate : this.actions.TireUpdate;
|
||||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
// 如果是编辑模式
|
||||
if (this.isEdit) {
|
||||
// postdata = { Tire: postdata }
|
||||
}
|
||||
// 格式化提交的数据
|
||||
this.$mk.formatFormData({data: postdata, rules: this.formOptions.items});
|
||||
|
||||
|
||||
// 提交数据
|
||||
this.$mk.post({
|
||||
url: action,
|
||||
loading: "保存中...",
|
||||
data: postdata,
|
||||
useBigInt: true,
|
||||
}).then(() => { // 成功回调
|
||||
this.$mk.success("保存成功");
|
||||
if (!this.isEdit) { // 如果是新增模式,关闭当前页面
|
||||
this.back();
|
||||
}
|
||||
}).catch((a) => { // 失败回调
|
||||
this.$mk.error(a.data.msg); // 显示错误信息
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 验证表单
|
||||
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { // 验证表单
|
||||
save(); // 提交保存
|
||||
}).catch(count => { // 验证失败
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
// 取消 返回
|
||||
cancel() {
|
||||
this.back();
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
|
|
@ -226,3 +360,35 @@ export default {
|
|||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="less">
|
||||
.page-body {
|
||||
padding: 30px;
|
||||
background: @base-bg-color;
|
||||
}
|
||||
|
||||
.formtabs .ant-tabs-tabpane {
|
||||
/* background: white; */
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.gridPanel {
|
||||
height: calc(100vh - 600px);
|
||||
}
|
||||
|
||||
.footerbar {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.imagePanel {
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
width: 100px;
|
||||
|
||||
img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -166,27 +166,25 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
||||
{field: 'tire_type', sortable: true, title: '轮胎更换类型', width: 250}, // 轮胎更换类型: 1.更换,2.补胎
|
||||
{field: 'tire_brand', sortable: true, title: '轮胎品牌', width: 250}, // 轮胎品牌
|
||||
{field: 'tire_model', sortable: true, title: '轮胎型号', width: 250}, // 轮胎型号
|
||||
{field: 'tire_count', sortable: true, title: '轮胎更换数量', width: 250}, // 轮胎更换数量
|
||||
{field: 'tire_price', sortable: true, title: '轮胎更换价格', width: 250}, // 轮胎更换价格
|
||||
{field: 'old_tire_number', sortable: true, title: '轮胎更换旧胎号', width: 250}, // 轮胎更换旧胎号
|
||||
{field: 'last_mileage', sortable: true, title: '更换公里数', width: 250}, // 更换公里数
|
||||
{field: 'tire_number', sortable: true, title: '轮胎胎号', width: 250}, // 轮胎胎号
|
||||
{field: 'mileage', sortable: true, title: '轮胎使用公里数', width: 250}, // 轮胎使用公里数
|
||||
{field: 'tire_change_date', sortable: true, title: '轮胎更换日期间隔', width: 250}, // 轮胎更换日期间隔
|
||||
{field: 'tire_change_mileage', sortable: true, title: '轮胎更换公里数间隔', width: 250}, // 轮胎更换公里数间隔
|
||||
{field: 'tire_abolish_date', sortable: true, title: '轮胎作废日期', width: 250}, // 轮胎作废日期
|
||||
{field: 'tire_abolish_mileage', sortable: true, title: '轮胎作废公里数', width: 250}, // 轮胎作废公里数
|
||||
{field: 'tire_mileage', sortable: true, title: '轮胎使用公里数', width: 250}, // 轮胎使用公里数
|
||||
{field: 'tire_remark', sortable: true, title: '轮胎更换备注', width: 250}, // 轮胎更换备注
|
||||
// {field: 'truck_number_id', sortable: true, title: '车次id', width: 120}, // 车次id
|
||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'tire_type', sortable: true, title: '类型', width: 70}, // 轮胎更换类型: 1.更换,2.补胎
|
||||
{field: 'tire_brand', sortable: true, title: '品牌', width: 100}, // 轮胎品牌
|
||||
{field: 'tire_model', sortable: true, title: '型号', width: 100}, // 轮胎型号
|
||||
{field: 'tire_count', sortable: true, title: '更换数量', width: 100}, // 轮胎更换数量
|
||||
{field: 'tire_price', sortable: true, title: '价格', width: 120}, // 轮胎更换价格
|
||||
{field: '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: 'create_time',
|
||||
|
|
@ -201,7 +199,7 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,15 +192,15 @@ export default {
|
|||
outsourcing_driver_name: "",
|
||||
outsourcing_driver_phone: "",
|
||||
is_need_outbound: 0,
|
||||
truck_name: null,
|
||||
truck_id: null,
|
||||
driver_id: null,
|
||||
truck_name: "",
|
||||
truck_id: 0,
|
||||
driver_id: 0,
|
||||
outbound_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||
return_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||
end_mileage: 0,
|
||||
driver_subsidy_remark: "",
|
||||
is_change_tire: 0,
|
||||
tire_id: null,
|
||||
tire_id: 0,
|
||||
is_repair: 0,
|
||||
repair_id: 0,
|
||||
is_oil: 0,
|
||||
|
|
@ -361,7 +361,7 @@ export default {
|
|||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
{field:'',title:'',span:24,isTitle:true,Htitle:'车辆信息',itemRender:{}},//分割线
|
||||
{field: 'is_outsourcing', title: '是否委外', span: 3, itemRender: { name: '$switch', props: { openLabel: '是', openValue: 1, closeValue: 0, closeLabel: '否' } }},
|
||||
{field: 'is_outsourcing', title: '是否委外', span: 24, itemRender: { name: '$switch', props: { openLabel: '是', openValue: 1, closeValue: 0, closeLabel: '否' } }},
|
||||
{field: 'outsourcing_truck_number',isOutsourcing:true, title: '委外车牌号', span: 7, itemRender: {name: '$input'}},
|
||||
{field: 'outsourcing_driver_name',isOutsourcing:true, title: '委外司机姓名', span: 7, itemRender: {name: '$input'}},
|
||||
{
|
||||
|
|
@ -401,14 +401,14 @@ export default {
|
|||
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
|
||||
onDataChanged: ({data}) => {
|
||||
console.log(data)
|
||||
this.formOptions.data.warehouse_mobile = data.phone;
|
||||
this.formOptions.data.driver_id = data.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{field: 'driver_salary', title: '司机工资', span: 6, itemRender: {name: '$input', props: {type: "number"}, events: { input: this.handleInputNumber }}},
|
||||
{field: 'is_need_outbound', title: '是否需要出车', span: 6, itemRender: { name: '$switch', props: { openLabel: '是', openValue: 1, closeValue: 0, closeLabel: '否' } }},
|
||||
{field: 'is_need_outbound', title: '是否需要出车', span: 24, itemRender: { name: '$switch', props: { openLabel: '是', openValue: 1, closeValue: 0, closeLabel: '否' } }},
|
||||
{
|
||||
field: 'outbound_date',
|
||||
dataRule: {type: "timestamp"},
|
||||
|
|
@ -718,6 +718,7 @@ export default {
|
|||
this.formOptions.data.other_expenses_log.forEach(item => {
|
||||
console.log(item)
|
||||
item.other_expenses_amount = Number(item.other_expenses_amount)
|
||||
console.log("item.driver_id",item.driver_id)
|
||||
})
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
// 如果是编辑模式
|
||||
|
|
|
|||
|
|
@ -31,7 +31,47 @@
|
|||
<vxe-grid ref='xGrid' v-bind="gridOptions">
|
||||
|
||||
<!-- =============================== 表格列 自动生成 Start =============================== -->
|
||||
<template #truck_id="{ row }">
|
||||
{{ row.truck_name }}
|
||||
</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>
|
||||
<!-- =============================== 表格列 自动生成 End =============================== -->
|
||||
|
||||
<template #op="{ row }">
|
||||
|
|
@ -103,7 +143,12 @@ export default {
|
|||
],
|
||||
//搜索区
|
||||
searchFormItems: [ // 子项
|
||||
{field: 'code', title: '车次单号', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入车次单号'}}},
|
||||
{
|
||||
field: 'code',
|
||||
title: '车次单号',
|
||||
span: 5,
|
||||
itemRender: {name: '$input', props: {placeholder: '请输入车次单号'}}
|
||||
},
|
||||
// {field: 'desc', title: '描述', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入描述'}}},
|
||||
{span: 8, slots: {default: 'date'}}, // 自定义列
|
||||
{
|
||||
|
|
@ -162,59 +207,66 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{field: 'code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
||||
{field: 'code',align: 'center', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||
{field: 'truck_id', align: 'center',sortable: true, title: '车辆', width: 150,
|
||||
slots: {default: 'truck_id'}}, // 车辆id
|
||||
{field: 'driver_id',align: 'center', sortable: true, title: '司机', width: 150,
|
||||
slots: {default: 'driver_id'}}, // 司机id
|
||||
// {field: 'custom_id', sortable: true, title: '客户id', width: 250}, // 客户id
|
||||
{field: 'custom_name', sortable: true, title: '客户名称', width: 250}, // 客户名称
|
||||
{field: 'custom_name', align: 'center',sortable: true, title: '客户名称', width: 200}, // 客户名称
|
||||
// {field: 'supplier_id', sortable: true, title: '供应商id', width: 250}, // 供应商id
|
||||
{field: 'supplier_name', sortable: true, title: '供应商名称', width: 250}, // 客户名称
|
||||
{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: 'is_outsourcing', sortable: true, title: '是否委外', width: 250}, // 是否委外
|
||||
{field: 'outsourcing_truck_number', sortable: true, title: '委外车牌号', width: 250}, // 委外车牌号
|
||||
{field: 'outsourcing_driver_name', sortable: true, title: '委外司机姓名', width: 250}, // 委外司机姓名
|
||||
{field: 'outsourcing_driver_phone', sortable: true, title: '委外司机手机号', width: 250}, // 委外司机手机号
|
||||
{field: 'is_need_outbound', sortable: true, title: '是否需要出车', width: 250}, // 是否需要出车
|
||||
{field: 'truck_id', sortable: true, title: '车辆', width: 250}, // 车辆id
|
||||
{field: 'driver_id', sortable: true, title: '司机id', width: 250}, // 司机id
|
||||
{field: 'outbound_date', sortable: true, title: '出车日期', width: 250}, // 出车日期
|
||||
{field: 'return_date', sortable: true, title: '回车日期', width: 250}, // 回车日期
|
||||
{field: 'outbound_remark', sortable: true, title: '出车备注', width: 250}, // 出车备注
|
||||
{field: 'end_mileage', sortable: true, title: '结束公里数', width: 250}, // 结束公里数
|
||||
{field: 'driver_subsidy_remark', sortable: true, title: '司机补贴备注', width: 250}, // 司机补贴备注
|
||||
{field: 'is_change_tire', sortable: true, title: '是否更换轮胎', width: 250}, // 是否更换轮胎
|
||||
{field: 'tire_id', sortable: true, title: '轮胎id', width: 250}, // 轮胎id
|
||||
{field: 'is_repair', sortable: true, title: '是否维修', width: 250}, // 是否维修
|
||||
{field: 'repair_id', sortable: true, title: '维修id', width: 250}, // 维修id
|
||||
{field: 'is_oil', sortable: true, title: '是否加油', width: 250}, // 是否加油
|
||||
{field: 'oil_id', sortable: true, title: '加油id', width: 250}, // 加油id
|
||||
{field: 'other_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: 'create_time',
|
||||
formatter: 'formatDate',
|
||||
width: 100,
|
||||
sortable: true,
|
||||
title: '创建时间',
|
||||
showHeaderOverflow: true
|
||||
}, // 创建时间
|
||||
field: 'is_change_tire', align: 'center',sortable: true, title: '更换轮胎', width: 100,
|
||||
slots: {default: 'is_change_tire'}
|
||||
}, // 是否更换轮胎
|
||||
{field: 'is_repair', align: 'center',sortable: true, title: '维修', width: 70,
|
||||
slots: {default: 'is_repair'}
|
||||
}, // 是否维修
|
||||
{field: 'is_oil',align: 'center', sortable: true, title: '加油', width: 70,
|
||||
slots: {default: 'is_oil'}
|
||||
}, // 是否加油
|
||||
|
||||
{field: 'outbound_mileage', sortable: true, title: '出车公里数', width: 250}, // 出车公里数
|
||||
{field: 'income', sortable: true, title: '收入', width: 250}, // 收入
|
||||
{field: 'cost', sortable: true, title: '成本', width: 250}, // 成本
|
||||
{field: 'profit', sortable: true, title: '利润', width: 250}, // 利润
|
||||
{field: 'unit_price', sortable: true, title: '单价', width: 250}, // 单价
|
||||
{field: 'total_price', sortable: true, title: '总价', width: 250}, // 总价
|
||||
{field: 'supplier_outbound_tonnage', sortable: true, title: '供应商出库吨位', width: 250}, // 供应商出库吨位
|
||||
{field: 'customer_warehousing_tonnage', sortable: true, title: '客户入库吨位', width: 250}, // 客户入库吨位
|
||||
{field: 'driver_salary', sortable: true, title: '司机工资', width: 250}, // 司机工资
|
||||
{field: 'driver_subsidy', sortable: true, title: '司机补贴', width: 250}, // 司机补贴
|
||||
// {
|
||||
// field: 'create_time',
|
||||
// formatter: 'formatDate',
|
||||
// width: 100,
|
||||
// sortable: true,
|
||||
// title: '创建时间',
|
||||
// showHeaderOverflow: true
|
||||
// }, // 创建时间
|
||||
|
||||
{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 ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
||||
{title: '操作', slots: {default: 'op'}, width: 120, fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,72 +1,78 @@
|
|||
<template>
|
||||
<div>
|
||||
<basic-page-edit :dataId="getDataId()" :options="pageOptions" @afterSave="afterSave"></basic-page-edit>
|
||||
<div class="page-body">
|
||||
|
||||
<div class="page-header">
|
||||
<a-descriptions title="User Info">
|
||||
<a-descriptions-item label="UserName">
|
||||
Zhou Maomao
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="Telephone">
|
||||
1810000000
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="Live">
|
||||
Hangzhou, Zhejiang
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="Remark">
|
||||
empty
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="Address">
|
||||
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</div>
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
<!-- =========================== 自定义区域 Start ======================= -->
|
||||
|
||||
<!-- =========================== 自定义区域 End ======================= -->
|
||||
</vxe-form>
|
||||
|
||||
<div class="mk-toolbar" v-if="isEdit">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
<!-- <Update :options="pageOptions"></Update> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import BASE_URL from '@/services/Middle/transport/Truck/api.js';
|
||||
// import PageLayout from '@/layouts/PageLayout'
|
||||
|
||||
// import Update from "@/pages/Middle/transport/Truck/Truck/Update.vue";
|
||||
|
||||
export default {
|
||||
|
||||
// i18n: require('./i18n'),
|
||||
components: {
|
||||
// Update
|
||||
},
|
||||
name: 'TruckUpdate',
|
||||
i18n: require('./i18n'),
|
||||
// components: {PageLayout},
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
default: "edit"
|
||||
},
|
||||
dataId: {}
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
return {
|
||||
pageOptions: {}
|
||||
};
|
||||
},
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
// 当前项目名称
|
||||
currentConfigName: "",
|
||||
// 当前项目ID
|
||||
currentBeid: 0,
|
||||
|
||||
computed: {
|
||||
// desc() {
|
||||
// return this.$t('editPageDesc')
|
||||
// }
|
||||
},
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "truck",
|
||||
|
||||
|
||||
created() {
|
||||
|
||||
this.optionsInit();
|
||||
this.dataInit();
|
||||
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
||||
optionsInit() {
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
// 当前项目名称
|
||||
currentConfigName: "",
|
||||
// 当前项目ID
|
||||
currentBeid: 0,
|
||||
|
||||
addPageUrl: "/Truck/TruckCreate",
|
||||
editPageUrl: "/Truck/TruckUpdate/",
|
||||
listPageUrl: "/Truck/TruckList",
|
||||
|
||||
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "truck",
|
||||
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
TruckList: `${this.$BASE_URL}/Truck/v1/truck/list`, // 货车列表
|
||||
TruckSearch: `${this.$BASE_URL}/Truck/v1/truck/search`, // 货车搜索
|
||||
TruckDetail: `${this.$BASE_URL}/Truck/v1/truck/detail`, // 货车详情
|
||||
|
|
@ -78,18 +84,18 @@ export default {
|
|||
TruckBatchCreate: `${this.$BASE_URL}/Truck/v1/truck/batchCreate`, // 批量创建货车
|
||||
TruckBatchHandle: `${this.$BASE_URL}/Truck/v1/truck/batchHandle`, // 批量处理货车
|
||||
|
||||
// =============================== 接口地址 自动生成 End ===============================
|
||||
},
|
||||
// =============================== 接口地址 自动生成 End ===============================
|
||||
},
|
||||
|
||||
keyName: 'id',
|
||||
// 是否编辑模式
|
||||
isEdit: false,
|
||||
// 表单数据
|
||||
formOptions: {
|
||||
data: {
|
||||
keyName: 'id',
|
||||
// 是否编辑模式
|
||||
isEdit: false,
|
||||
// 表单数据
|
||||
formOptions: {
|
||||
data: {
|
||||
// =============================== 表单数据 自动生成 Start ===============================
|
||||
|
||||
|
||||
id: 0,
|
||||
id: 0,
|
||||
code: "",
|
||||
name: "",
|
||||
plate_number: "",
|
||||
|
|
@ -111,17 +117,20 @@ export default {
|
|||
remark: "",
|
||||
create_uid: 0,
|
||||
update_uid: 0,
|
||||
},
|
||||
// 标题宽度
|
||||
titleWidth: 125,
|
||||
// 标题对齐方式
|
||||
titleAlign: 'right',
|
||||
current_distance:0,
|
||||
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
// =============================== 表单数据 自动生成 End ===============================
|
||||
},
|
||||
// 标题宽度
|
||||
titleWidth: 150,
|
||||
// 标题对齐方式
|
||||
titleAlign: 'right',
|
||||
|
||||
code: [
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
// =============================== 表单校验 自动生成 Start ===============================
|
||||
|
||||
code: [
|
||||
{message: '请输入编码'}
|
||||
],
|
||||
name: [
|
||||
|
|
@ -160,11 +169,15 @@ export default {
|
|||
remark: [
|
||||
{message: '请输入车辆备注'}
|
||||
],
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
},
|
||||
// 表单项
|
||||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
current_distance: [
|
||||
{message: '请输入当前公里数'}
|
||||
|
||||
],
|
||||
// =============================== 表单校验 自动生成 End ===============================
|
||||
},
|
||||
// 表单项
|
||||
items: [
|
||||
// =============================== 表单项 自动生成 Start ===============================
|
||||
{field:'',title:'',span:24,isTitle:true,Htitle:'车辆信息',itemRender:{}},//分割线
|
||||
{field: 'code', title: '编码', span: 12, itemRender: {name: '$input'}},
|
||||
{field: 'name', title: '名称', span: 12, itemRender: {name: '$input'}},
|
||||
|
|
@ -172,79 +185,82 @@ export default {
|
|||
{field: 'type', title: '类型', span: 6, itemRender: {name: '$input'}},
|
||||
{field: 'manager_name', title: '负责人姓名', span: 6, itemRender: {name: '$input'}},
|
||||
{field: 'manager_phone', title: '负责人电话', span: 6, itemRender: {name: '$input'}},
|
||||
{field: 'remark', title: '备注', span: 24, itemRender: {name: '$input'}},
|
||||
{field: 'current_distance', title: '车辆当前公里数', span: 6, itemRender: {name: '$input',props:{type:'number'}}},
|
||||
{field: 'remark', title: '备注', span: 24, itemRender: {name: '$textarea'}},
|
||||
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [],
|
||||
// =============================== 表单项 自动生成 End ===============================
|
||||
]
|
||||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [],
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
pageData.actions.get = pageData.actions.TruckDetail;
|
||||
pageData.actions.create = pageData.actions.TruckCreate;
|
||||
pageData.actions.update = pageData.actions.TruckUpdate;
|
||||
pageData.actions.get = pageData.actions.TruckDetail;
|
||||
pageData.actions.create = pageData.actions.TruckCreate;
|
||||
pageData.actions.update = pageData.actions.TruckUpdate;
|
||||
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
||||
this.pageOptions = pageData;
|
||||
},
|
||||
return pageData;
|
||||
},
|
||||
|
||||
// 初始化数据
|
||||
dataInit() {
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
// 如果有id参数,说明是编辑模式
|
||||
if (dataId) {
|
||||
const json = `{"id":${dataId}}`;
|
||||
this.$mk.post({
|
||||
url: this.pageOptions.actions.get,
|
||||
loading: "加载中...",
|
||||
data: json,
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
computed: {
|
||||
// desc() {
|
||||
// return this.$t('editPageDesc')
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
created() {
|
||||
|
||||
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
|
||||
// 如果有id参数,说明是编辑模式
|
||||
if (dataId) {
|
||||
const json = `{"id":${dataId}}`;
|
||||
this.$mk.post({
|
||||
url: this.actions.get,
|
||||
loading: "加载中...",
|
||||
data: json,
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(a => {
|
||||
}
|
||||
}).then(a => {
|
||||
// =============================== 时间字段判断 自动生成 Start ===============================
|
||||
|
||||
let detailDataFieldName = this.pageOptions.detailDataFieldName;
|
||||
|
||||
let rules = [
|
||||
{field: "warehouse_effective_date", dataRule: "timestamp"},
|
||||
{field: "warehouse_invalid_date", dataRule: "timestamp"},
|
||||
{field: "create_time", dataRule: "timestamp"},
|
||||
{field: "update_time", dataRule: "timestamp"},
|
||||
];
|
||||
rules = []; //上面几个字段如果不需要在表单显示,可以不转换(不转换的话,表单拿到的是什么数据,提交的时候就是什么数据)
|
||||
this.$mk.formatInitFormData({
|
||||
data: a.data[detailDataFieldName],
|
||||
rules: [...this.pageOptions.formOptions.items, ...rules]
|
||||
}); //建议固定格式化写法
|
||||
|
||||
this.pageOptions.formOptions.data = a.data[detailDataFieldName];
|
||||
|
||||
this.$forceUpdate()
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
|
||||
this.pageOptions.isEdit = true;
|
||||
|
||||
this.$forceUpdate()
|
||||
} else {
|
||||
// 如果没有id参数,说明是新增模式
|
||||
if (this.pageOptions.addModeItems.length > 0) {
|
||||
this.addModeItems.forEach(item => {
|
||||
this.pageOptions.formOptions.items.push(item);
|
||||
})
|
||||
if (a.data[this.detailDataFieldName].create_time) {
|
||||
a.data[this.detailDataFieldName].create_time = new Date(a.data[this.detailDataFieldName].create_time * 1000);
|
||||
}
|
||||
if (a.data[this.detailDataFieldName].update_time) {
|
||||
a.data[this.detailDataFieldName].update_time = new Date(a.data[this.detailDataFieldName].update_time * 1000);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
// =============================== 时间字段判断 自动生成 End ===============================
|
||||
this.formOptions.data = a.data[this.detailDataFieldName];
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
|
||||
this.isEdit = true;
|
||||
} else {
|
||||
// 如果没有id参数,说明是新增模式
|
||||
this.addModeItems.forEach(item => {
|
||||
this.formOptions.items.push(item);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
||||
// 获取路由的id参数
|
||||
getDataId() {
|
||||
|
|
@ -257,8 +273,80 @@ export default {
|
|||
}
|
||||
return dataId;
|
||||
},
|
||||
afterSave(data) {
|
||||
console.log("afterSave:", data);
|
||||
|
||||
|
||||
// 返回
|
||||
back() {
|
||||
// 如果是新增模式,关闭当前页面
|
||||
if (!this.isEdit) {
|
||||
this.$closePage({
|
||||
closeRoute: "/Truck/TruckCreate"
|
||||
});
|
||||
} else {
|
||||
// 如果是编辑模式,关闭当前页面
|
||||
this.$closePage({
|
||||
closeRoute: "/Truck/TruckUpdate"
|
||||
});
|
||||
}
|
||||
// 打开列表页面
|
||||
this.$openPage('/Truck/TruckList')
|
||||
},
|
||||
|
||||
// 保存
|
||||
ok() {
|
||||
|
||||
let save = () => {
|
||||
|
||||
|
||||
// 将this.formOptions.data.tire_count
|
||||
this.formOptions.data.current_distance = Number(this.formOptions.data.current_distance);
|
||||
|
||||
|
||||
// 如果是新增模式,提交新增接口 如果是编辑模式,提交编辑接口
|
||||
let action = !this.isEdit ? this.actions.TruckCreate : this.actions.TruckUpdate;
|
||||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
// 如果是编辑模式
|
||||
if (this.isEdit) {
|
||||
// postdata = { Truck: postdata }
|
||||
}
|
||||
// 格式化提交的数据
|
||||
this.$mk.formatFormData({data: postdata, rules: this.formOptions.items});
|
||||
|
||||
|
||||
// 提交数据
|
||||
this.$mk.post({
|
||||
url: action,
|
||||
loading: "保存中...",
|
||||
data: postdata,
|
||||
useBigInt: true,
|
||||
}).then(() => { // 成功回调
|
||||
this.$mk.success("保存成功");
|
||||
if (!this.isEdit) { // 如果是新增模式,关闭当前页面
|
||||
this.back();
|
||||
}
|
||||
}).catch((a) => { // 失败回调
|
||||
this.$mk.error(a.data.msg); // 显示错误信息
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 验证表单
|
||||
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { // 验证表单
|
||||
save(); // 提交保存
|
||||
}).catch(count => { // 验证失败
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
// 取消 返回
|
||||
cancel() {
|
||||
this.back();
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
|
|
@ -266,3 +354,35 @@ export default {
|
|||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="less">
|
||||
.page-body {
|
||||
padding: 30px;
|
||||
background: @base-bg-color;
|
||||
}
|
||||
|
||||
.formtabs .ant-tabs-tabpane {
|
||||
/* background: white; */
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.gridPanel {
|
||||
height: calc(100vh - 600px);
|
||||
}
|
||||
|
||||
.footerbar {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.imagePanel {
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
width: 100px;
|
||||
|
||||
img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ export default {
|
|||
{field: 'code', sortable: true, title: '编码', width: 120}, // 编码
|
||||
{field: 'plate_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'type', sortable: true, title: '车辆类型', width: 120}, // 车辆类型
|
||||
{field: 'current_distance', sortable: true, title: '当前公里数', width: 150}, // 当前公里数
|
||||
{field: 'manager_name', sortable: true, title: '负责人姓名', width: 120}, // 负责人姓名
|
||||
{field: 'manager_phone', sortable: true, title: '负责人电话', width: 150}, // 负责人电话
|
||||
{field: 'out_count', sortable: true, title: '出车次数', width: 120}, // 出车次数
|
||||
|
|
|
|||
Loading…
Reference in New Issue