This commit is contained in:
parent
a5db38b3c8
commit
5b719b9542
|
|
@ -181,7 +181,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 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) { // 遍历搜索规则
|
for (let i in this.searchRules) { // 遍历搜索规则
|
||||||
if (this.searchRules[i].key == k) return this.searchRules[i].mode; // 如果找到了就返回搜索模式
|
if (this.searchRules[i].key == k) return this.searchRules[i].mode; // 如果找到了就返回搜索模式
|
||||||
}
|
}
|
||||||
return "equal"; // 如果没有找到就返回等于
|
return "="; // 如果没有找到就返回等于
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let key in this.searchFormData) { // 遍历搜索表单数据
|
for (let key in this.searchFormData) { // 遍历搜索表单数据
|
||||||
|
|
|
||||||
|
|
@ -177,11 +177,11 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 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_name', sortable: true, title: '员工姓名', width: 250}, // 员工姓名
|
||||||
{field: 'staff_code', sortable: true, title: '员工编号', width: 250}, // 员工编号
|
{field: 'staff_code', sortable: true, title: '员工编号', width: 250}, // 员工编号
|
||||||
{field: 'staff_phone', 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_year', sortable: true, title: '工资年份', width: 250}, // 工资年份
|
||||||
{field: 'wages_month', sortable: true, title: '工资月份', width: 250}, // 工资月份
|
{field: 'wages_month', sortable: true, title: '工资月份', width: 250}, // 工资月份
|
||||||
{field: 'wages_type', sortable: true, title: '工资类型', width: 250}, // 工资类型
|
{field: 'wages_type', sortable: true, title: '工资类型', width: 250}, // 工资类型
|
||||||
|
|
@ -203,7 +203,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 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: 'staff_uid', sortable: true, title: '员工uid', width: 250}, // 员工uid
|
||||||
{field: 'balance_type', sortable: true, title: '结余类型', width: 250}, // 结余类型:1增加,2减少
|
{field: 'balance_type', sortable: true, title: '结余类型', width: 250}, // 结余类型:1增加,2减少
|
||||||
{field: 'balance_amount', sortable: true, title: '修改金额', width: 250}, // 修改金额
|
{field: 'balance_amount', sortable: true, title: '修改金额', width: 250}, // 修改金额
|
||||||
|
|
@ -187,7 +187,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 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: 'staff_uid', sortable: true, title: '员工uid', width: 250}, // 员工uid
|
||||||
{field: 'transport_mileage', sortable: true, title: '运输总公里数', width: 250}, // 运输总公里数
|
{field: 'transport_mileage', sortable: true, title: '运输总公里数', width: 120}, // 运输总公里数
|
||||||
{field: 'month_mileage', sortable: true, title: '本月份总公里数', width: 250}, // 本月份总公里数
|
{field: 'month_mileage', sortable: true, title: '本月份总公里数', width: 120}, // 本月份总公里数
|
||||||
{field: 'wages_balance', sortable: true, title: '工资结余', width: 250}, // 工资结余
|
{field: 'wages_balance', sortable: true, title: '工资结余', width: 250}, // 工资结余
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
|
|
@ -206,7 +206,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{field: 'code', sortable: true, title: '编码', width: 250}, // 编码
|
{field: 'code', sortable: true, title: '编码', width: 120}, // 编码
|
||||||
{field: 'name', sortable: true, title: '名称', width: 250}, // 名称
|
{field: 'name', sortable: true, title: '名称', width: 250}, // 名称
|
||||||
{field: 'description', sortable: true, title: '描述', width: 250}, // 描述
|
{field: 'description', sortable: true, title: '描述', width: 250}, // 描述
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<page-layout>
|
|
||||||
<div class="page-body">
|
<div class="page-body">
|
||||||
|
|
||||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||||
|
|
@ -19,19 +19,18 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</page-layout>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BASE_URL from '@/services/Middle/transport/Maintenance/api.js';
|
import BASE_URL from '@/services/Middle/transport/Maintenance/api.js';
|
||||||
import PageLayout from '@/layouts/PageLayout'
|
// import PageLayout from '@/layouts/PageLayout'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
name: 'MaintenanceGiornaleLogUpdate',
|
name: 'MaintenanceGiornaleLogUpdate',
|
||||||
i18n: require('./i18n'),
|
i18n: require('./i18n'),
|
||||||
components: {PageLayout},
|
// components: { PageLayout },
|
||||||
props: {
|
props: {
|
||||||
pageMode: {
|
pageMode: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -97,8 +96,11 @@ export default {
|
||||||
truck_code: "",
|
truck_code: "",
|
||||||
truck_name: "",
|
truck_name: "",
|
||||||
truck_number: "",
|
truck_number: "",
|
||||||
other_expenses_name: "",
|
maintenance_id: 0,
|
||||||
other_expenses_remark: "",
|
maintenance_name: "",
|
||||||
|
maintenance_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||||
|
maintenance_price: 0,
|
||||||
|
maintenance_remark: "",
|
||||||
create_uid: 0,
|
create_uid: 0,
|
||||||
update_uid: 0,
|
update_uid: 0,
|
||||||
create_time: new Date(2100, 1, 1).getTime() / 10000,
|
create_time: new Date(2100, 1, 1).getTime() / 10000,
|
||||||
|
|
@ -134,14 +136,17 @@ export default {
|
||||||
truck_number: [
|
truck_number: [
|
||||||
{ message: '请输入车牌号' }
|
{ message: '请输入车牌号' }
|
||||||
],
|
],
|
||||||
other_expenses_name: [
|
maintenance_id: [
|
||||||
{message: '请输入其他费用名称'}
|
{ message: '请输入维修项目' }
|
||||||
],
|
],
|
||||||
other_expenses_remark: [
|
maintenance_date:[
|
||||||
{message: '请输入其他费用备注'}
|
{ message: '请输入维修日期' }
|
||||||
],
|
],
|
||||||
other_expenses_amount: [
|
maintenance_remark: [
|
||||||
{message: '请输入其他费用金额'}
|
{ message: '请输入维修备注' }
|
||||||
|
],
|
||||||
|
maintenance_price: [
|
||||||
|
{ message: '请输入维修金额' }
|
||||||
],
|
],
|
||||||
|
|
||||||
// =============================== 表单校验 自动生成 End ===============================
|
// =============================== 表单校验 自动生成 End ===============================
|
||||||
|
|
@ -150,15 +155,63 @@ export default {
|
||||||
items: [
|
items: [
|
||||||
// =============================== 表单项 自动生成 Start ===============================
|
// =============================== 表单项 自动生成 Start ===============================
|
||||||
|
|
||||||
{field: 'truck_number_id', title: '车次id', span: 12, itemRender: {name: '$input'}},
|
{
|
||||||
{field: 'truck_number_code', title: '车次单号', span: 12, itemRender: {name: '$input'}},
|
title: '车辆', span: 6,
|
||||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
field: 'Truck',
|
||||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
dataRule: {
|
||||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
fromField: "name",
|
||||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
saveField: "name"
|
||||||
{field: 'other_expenses_name', title: '其他费用名称', span: 12, itemRender: {name: '$input'}},
|
},
|
||||||
{field: 'other_expenses_remark', title: '其他费用备注', span: 12, itemRender: {name: '$input'}},
|
itemRender: {
|
||||||
{field: 'other_expenses_amount', title: '其他费用金额', span: 12, itemRender: {name: '$input'}},
|
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 ===============================
|
// =============================== 表单项 自动生成 End ===============================
|
||||||
]
|
]
|
||||||
|
|
@ -269,7 +322,9 @@ export default {
|
||||||
|
|
||||||
let save = () => {
|
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;
|
let action = !this.isEdit ? this.actions.MaintenanceGiornaleLogCreate : this.actions.MaintenanceGiornaleLogUpdate;
|
||||||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,12 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
const listFieldName = 'Maintenance';
|
const listFieldName = 'MaintenanceGiornaleLog';
|
||||||
// 页面数据
|
// 页面数据
|
||||||
var pageData = { // 页面数据变量
|
var pageData = { // 页面数据变量
|
||||||
|
|
||||||
keyName: 'id', // 主键字段名
|
keyName: 'id', // 主键字段名
|
||||||
listFieldName: 'maintenance_giornale_log',
|
listFieldName: 'MaintenanceGiornaleLog',
|
||||||
|
|
||||||
|
|
||||||
// 接口动作
|
// 接口动作
|
||||||
|
|
@ -179,30 +179,40 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
{field: 'maintenance_name', sortable: true, title: '维修项目名称', width: 150}, // 维修项目名称
|
||||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
{field: 'maintenance_code', sortable: true, title: '维修项目编码', width: 140}, // 维修项目编码
|
||||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
{field: 'last_maintenance_date', sortable: true, title: '上次维修日期', width: 130}, // 上次维修日期
|
||||||
{field: 'other_expenses_name', sortable: true, title: '其他费用名称', width: 250}, // 其他费用名称
|
{field: 'last_mileage', sortable: true, title: '上次维修公里数', width: 140}, // 上次维修公里数
|
||||||
{field: 'other_expenses_remark', sortable: true, title: '其他费用备注', width: 250}, // 其他费用备注
|
{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',
|
formatter: 'formatDate',
|
||||||
width: 100,
|
width: 100,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
title: '创建时间',
|
title: '维修日期',
|
||||||
showHeaderOverflow: true
|
showHeaderOverflow: true
|
||||||
}, // 创建时间
|
}, // 维修日期
|
||||||
|
|
||||||
|
{field: 'maintenance_remark', sortable: true, title: '维修备注', width: 250}, // 维修备注
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{field: 'other_expenses_amount', sortable: true, title: '其他费用金额', width: 250}, // 其他费用金额
|
|
||||||
|
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<template>
|
<template>
|
||||||
<page-layout :desc="desc">
|
|
||||||
<div class="page-body">
|
<div class="page-body">
|
||||||
|
|
||||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||||
|
|
@ -19,19 +18,18 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</page-layout>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BASE_URL from '@/services/Middle/transport/Maintenance/api.js';
|
import BASE_URL from '@/services/Middle/transport/Maintenance/api.js';
|
||||||
import PageLayout from '@/layouts/PageLayout'
|
// import PageLayout from '@/layouts/PageLayout'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
name: 'OtherExpensesLogUpdate',
|
name: 'OtherExpensesLogUpdate',
|
||||||
i18n: require('./i18n'),
|
i18n: require('./i18n'),
|
||||||
components: {PageLayout},
|
// components: {PageLayout},
|
||||||
props: {
|
props: {
|
||||||
pageMode: {
|
pageMode: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -150,15 +148,35 @@ export default {
|
||||||
items: [
|
items: [
|
||||||
// =============================== 表单项 自动生成 Start ===============================
|
// =============================== 表单项 自动生成 Start ===============================
|
||||||
|
|
||||||
{field: 'truck_number_id', title: '车次id', span: 12, itemRender: {name: '$input'}},
|
{
|
||||||
{field: 'truck_number_code', title: '车次单号', span: 12, itemRender: {name: '$input'}},
|
title: '车辆', span: 6,
|
||||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
field: 'Truck',
|
||||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
dataRule: {
|
||||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
fromField: "name",
|
||||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
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_name', title: '其他费用名称', span: 12, itemRender: {name: '$input'}},
|
||||||
{field: 'other_expenses_remark', 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 ===============================
|
// =============================== 表单项 自动生成 End ===============================
|
||||||
]
|
]
|
||||||
|
|
@ -270,8 +288,12 @@ export default {
|
||||||
let save = () => {
|
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
|
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||||
let postdata = Object.assign({}, this.formOptions.data);
|
let postdata = Object.assign({}, this.formOptions.data);
|
||||||
// 如果是编辑模式
|
// 如果是编辑模式
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
const listFieldName = 'other_expenses_log';
|
const listFieldName = 'OtherExpensesLog';
|
||||||
// 页面数据
|
// 页面数据
|
||||||
var pageData = { // 页面数据变量
|
var pageData = { // 页面数据变量
|
||||||
|
|
||||||
|
|
@ -178,12 +178,11 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
{field: 'truck_number_id', sortable: true, title: '车次id', width: 120}, // 车次id
|
||||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
|
||||||
{field: 'other_expenses_name', sortable: true, title: '其他费用名称', width: 250}, // 其他费用名称
|
{field: 'other_expenses_name', sortable: true, title: '其他费用名称', width: 250}, // 其他费用名称
|
||||||
{field: 'other_expenses_remark', sortable: true, title: '其他费用备注', width: 250}, // 其他费用备注
|
{field: 'other_expenses_remark', sortable: true, title: '其他费用备注', width: 250}, // 其他费用备注
|
||||||
|
|
||||||
|
|
@ -201,7 +200,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,46 @@
|
||||||
<template>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BASE_URL from '@/services/Middle/transport/OilConsumption/api.js';
|
import BASE_URL from '@/services/Middle/transport/OilConsumption/api.js';
|
||||||
|
// import PageLayout from '@/layouts/PageLayout'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
name: 'OilConsumptionUpdate',
|
||||||
i18n: require('./i18n'),
|
i18n: require('./i18n'),
|
||||||
components: {},
|
// components: {PageLayout},
|
||||||
props: {
|
props: {
|
||||||
pageMode: {
|
pageMode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "edit"
|
default: "edit"
|
||||||
},
|
},
|
||||||
dataId: {}
|
dataId: {}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
return {
|
|
||||||
pageOptions: {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
// desc() {
|
|
||||||
// return this.$t('editPageDesc')
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
created() {
|
|
||||||
|
|
||||||
this.optionsInit();
|
|
||||||
this.dataInit();
|
|
||||||
|
|
||||||
},
|
|
||||||
// 函数
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
|
|
||||||
optionsInit() {
|
|
||||||
// 页面数据变量
|
// 页面数据变量
|
||||||
var pageData = {
|
var pageData = {
|
||||||
// 当前项目名称
|
// 当前项目名称
|
||||||
|
|
@ -50,13 +48,8 @@ export default {
|
||||||
// 当前项目ID
|
// 当前项目ID
|
||||||
currentBeid: 0,
|
currentBeid: 0,
|
||||||
|
|
||||||
addPageUrl: "/OilConsumption/OilConsumptionCreate",
|
uploadDefaultImg: null,
|
||||||
editPageUrl: "/OilConsumption/OilConsumptionUpdate/",
|
detailDataFieldName: "OilConsumption",
|
||||||
listPageUrl: "/OilConsumption/OilConsumptionList",
|
|
||||||
|
|
||||||
|
|
||||||
uploadDefaultImg: null, // 上传默认图片
|
|
||||||
detailDataFieldName: "OilConsumption", // 详情数据字段名称
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// =============================== 接口地址 自动生成 Start ===============================
|
// =============================== 接口地址 自动生成 Start ===============================
|
||||||
|
|
@ -70,8 +63,6 @@ export default {
|
||||||
OilConsumptionBatchUpdate: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchUpdate`, // 批量更新油耗
|
OilConsumptionBatchUpdate: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchUpdate`, // 批量更新油耗
|
||||||
OilConsumptionBatchCreate: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchCreate`, // 批量创建油耗
|
OilConsumptionBatchCreate: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchCreate`, // 批量创建油耗
|
||||||
OilConsumptionBatchHandle: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchHandle`, // 批量处理油耗
|
OilConsumptionBatchHandle: `${BASE_URL.BASE_URL}/OilConsumption/v1/oil/consumption/batchHandle`, // 批量处理油耗
|
||||||
|
|
||||||
|
|
||||||
// =============================== 接口地址 自动生成 End ===============================
|
// =============================== 接口地址 自动生成 End ===============================
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -81,6 +72,7 @@ export default {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
formOptions: {
|
formOptions: {
|
||||||
data: {
|
data: {
|
||||||
|
// =============================== 表单数据 自动生成 Start ===============================
|
||||||
|
|
||||||
id: 0,
|
id: 0,
|
||||||
truck_number_id: 0,
|
truck_number_id: 0,
|
||||||
|
|
@ -100,6 +92,8 @@ export default {
|
||||||
oil_consumption_remark: "",
|
oil_consumption_remark: "",
|
||||||
create_uid: 0,
|
create_uid: 0,
|
||||||
update_uid: 0,
|
update_uid: 0,
|
||||||
|
|
||||||
|
// =============================== 表单数据 自动生成 End ===============================
|
||||||
},
|
},
|
||||||
// 标题宽度
|
// 标题宽度
|
||||||
titleWidth: 150,
|
titleWidth: 150,
|
||||||
|
|
@ -116,27 +110,71 @@ export default {
|
||||||
// 表单项
|
// 表单项
|
||||||
items: [
|
items: [
|
||||||
// =============================== 表单项 自动生成 Start ===============================
|
// =============================== 表单项 自动生成 Start ===============================
|
||||||
|
// {
|
||||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
// title: '车次', span: 6,
|
||||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
// field: 'TrainNumber',
|
||||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
// dataRule: {
|
||||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
// fromField: "TrainNumber",
|
||||||
{field: 'truck_number_before_mileage', title: '出车前总公里数', span: 12, itemRender: {name: '$input'}},
|
// saveField: "TrainNumber"
|
||||||
{field: 'truck_number_after_mileage', title: '回车后总公里数', span: 12, itemRender: {name: '$input'}},
|
// },
|
||||||
{field: 'oil_consumption_number', title: '油耗数量', span: 12, itemRender: {name: '$input'}},
|
// itemRender: {
|
||||||
{field: 'oil_consumption_price', title: '油耗单价', span: 12, itemRender: {name: '$input'}},
|
// name: 'MkFormDataSelector', props: {
|
||||||
{field: 'oil_consumption_total_price', title: '油耗总价', span: 12, itemRender: {name: '$input'}},
|
// 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',
|
field: 'oil_consumption_date',
|
||||||
dataRule: {type: "timestamp"},
|
dataRule: {type: "timestamp"},
|
||||||
title: '油耗日期',
|
title: '油耗日期',
|
||||||
span: 12,
|
span: 6,
|
||||||
itemRender: {name: '$input', props: {type: "date"}}
|
itemRender: {name: '$input', props: {type: "date"}}
|
||||||
},
|
},
|
||||||
{field: 'oil_consumption_hundred', title: '百公里油耗', span: 12, itemRender: {name: '$input'}},
|
{field: 'truck_number_before_mileage', title: '出车前总公里数', span: 6, itemRender: {name: '$input'}},
|
||||||
{field: 'oil_consumption_remark', title: '油耗备注', span: 12, 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 ===============================
|
// =============================== 表单项 自动生成 End ===============================
|
||||||
]
|
]
|
||||||
|
|
@ -154,17 +192,27 @@ export default {
|
||||||
// 合并表单数据及配置
|
// 合并表单数据及配置
|
||||||
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() {
|
computed: {
|
||||||
|
// desc() {
|
||||||
|
// return this.$t('editPageDesc')
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
created() {
|
||||||
|
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
let dataId = this.getDataId();
|
let dataId = this.getDataId();
|
||||||
|
|
||||||
// 如果有id参数,说明是编辑模式
|
// 如果有id参数,说明是编辑模式
|
||||||
if (dataId) {
|
if (dataId) {
|
||||||
const json = `{"id":${dataId}}`;
|
const json = `{"id":${dataId}}`;
|
||||||
this.$mk.post({
|
this.$mk.post({
|
||||||
url: this.pageOptions.actions.get,
|
url: this.actions.get,
|
||||||
loading: "加载中...",
|
loading: "加载中...",
|
||||||
data: json,
|
data: json,
|
||||||
config: {
|
config: {
|
||||||
|
|
@ -173,39 +221,34 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).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 = [
|
// =============================== 时间字段判断 自动生成 End ===============================
|
||||||
{field: "warehouse_effective_date", dataRule: "timestamp"},
|
this.formOptions.data = a.data[this.detailDataFieldName];
|
||||||
{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) => {
|
}).catch((a) => {
|
||||||
this.$mk.error(a.data.msg);
|
this.$mk.error(a.data.msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pageOptions.isEdit = true;
|
this.isEdit = true;
|
||||||
|
|
||||||
this.$forceUpdate()
|
|
||||||
} else {
|
} else {
|
||||||
// 如果没有id参数,说明是新增模式
|
// 如果没有id参数,说明是新增模式
|
||||||
this.addModeItems.forEach(item => {
|
this.addModeItems.forEach(item => {
|
||||||
this.pageOptions.formOptions.items.push(item);
|
this.formOptions.items.push(item);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 函数
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
getDataId() {
|
getDataId() {
|
||||||
|
|
@ -217,6 +260,86 @@ export default {
|
||||||
dataId = 0;
|
dataId = 0;
|
||||||
}
|
}
|
||||||
return dataId;
|
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>
|
</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 ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
{field: 'truck_number_id', sortable: true, title: '车次id', width: 120}, // 车次id
|
||||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
|
||||||
{field: 'oil_consumption_number', sortable: true, title: '油耗数量', width: 250}, // 油耗数量
|
{field: 'oil_consumption_number', sortable: true, title: '油耗数量', width: 250}, // 油耗数量
|
||||||
{field: 'oil_consumption_price', 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_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_hundred', sortable: true, title: '百公里油耗', width: 250}, // 百公里油耗
|
||||||
{field: 'oil_consumption_remark', sortable: true, title: '油耗备注', width: 250}, // 油耗备注
|
{field: 'oil_consumption_remark', sortable: true, title: '油耗备注', width: 250}, // 油耗备注
|
||||||
|
|
||||||
|
|
@ -191,7 +190,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,46 @@
|
||||||
<template>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BASE_URL from '@/services/Middle/transport/Tire/api.js';
|
import BASE_URL from '@/services/Middle/transport/Tire/api.js';
|
||||||
|
// import PageLayout from '@/layouts/PageLayout'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
name: 'TireUpdate',
|
||||||
i18n: require('./i18n'),
|
i18n: require('./i18n'),
|
||||||
components: {},
|
// components: {PageLayout},
|
||||||
props: {
|
props: {
|
||||||
pageMode: {
|
pageMode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "edit"
|
default: "edit"
|
||||||
},
|
},
|
||||||
dataId: {}
|
dataId: {}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
return {
|
|
||||||
pageOptions: {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
// desc() {
|
|
||||||
// return this.$t('editPageDesc')
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
created() {
|
|
||||||
|
|
||||||
this.optionsInit();
|
|
||||||
this.dataInit();
|
|
||||||
|
|
||||||
},
|
|
||||||
// 函数
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
|
|
||||||
optionsInit() {
|
|
||||||
// 页面数据变量
|
// 页面数据变量
|
||||||
var pageData = {
|
var pageData = {
|
||||||
// 当前项目名称
|
// 当前项目名称
|
||||||
|
|
@ -49,13 +48,8 @@ export default {
|
||||||
// 当前项目ID
|
// 当前项目ID
|
||||||
currentBeid: 0,
|
currentBeid: 0,
|
||||||
|
|
||||||
addPageUrl: "/Truck/TruckCreate",
|
|
||||||
editPageUrl: "/Truck/TruckUpdate/",
|
|
||||||
listPageUrl: "/Truck/TruckList",
|
|
||||||
|
|
||||||
|
|
||||||
uploadDefaultImg: null,
|
uploadDefaultImg: null,
|
||||||
detailDataFieldName: "mes_warehouse",
|
detailDataFieldName: "Tire",
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// =============================== 接口地址 自动生成 Start ===============================
|
// =============================== 接口地址 自动生成 Start ===============================
|
||||||
|
|
@ -70,7 +64,6 @@ export default {
|
||||||
TireBatchCreate: `${BASE_URL.BASE_URL}/Tire/v1/tire/batchCreate`, // 批量创建轮胎
|
TireBatchCreate: `${BASE_URL.BASE_URL}/Tire/v1/tire/batchCreate`, // 批量创建轮胎
|
||||||
TireBatchHandle: `${BASE_URL.BASE_URL}/Tire/v1/tire/batchHandle`, // 批量处理轮胎
|
TireBatchHandle: `${BASE_URL.BASE_URL}/Tire/v1/tire/batchHandle`, // 批量处理轮胎
|
||||||
TireAbolish: `${BASE_URL.BASE_URL}/Tire/v1/tire/abolish`, // 轮胎作废
|
TireAbolish: `${BASE_URL.BASE_URL}/Tire/v1/tire/abolish`, // 轮胎作废
|
||||||
|
|
||||||
// =============================== 接口地址 自动生成 End ===============================
|
// =============================== 接口地址 自动生成 End ===============================
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -80,7 +73,7 @@ export default {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
formOptions: {
|
formOptions: {
|
||||||
data: {
|
data: {
|
||||||
|
// =============================== 表单数据 自动生成 Start ===============================
|
||||||
truck_number_id: 0,
|
truck_number_id: 0,
|
||||||
truck_number_code: "",
|
truck_number_code: "",
|
||||||
truck_id: 0,
|
truck_id: 0,
|
||||||
|
|
@ -105,9 +98,11 @@ export default {
|
||||||
create_uid: 0,
|
create_uid: 0,
|
||||||
update_uid: 0,
|
update_uid: 0,
|
||||||
tire_date: new Date(2100, 1, 1).getTime() / 10000,
|
tire_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||||
|
|
||||||
|
// =============================== 表单数据 自动生成 End ===============================
|
||||||
},
|
},
|
||||||
// 标题宽度
|
// 标题宽度
|
||||||
titleWidth: 150,
|
titleWidth: 100,
|
||||||
// 标题对齐方式
|
// 标题对齐方式
|
||||||
titleAlign: 'right',
|
titleAlign: 'right',
|
||||||
|
|
||||||
|
|
@ -121,21 +116,78 @@ export default {
|
||||||
// 表单项
|
// 表单项
|
||||||
items: [
|
items: [
|
||||||
// =============================== 表单项 自动生成 Start ===============================
|
// =============================== 表单项 自动生成 Start ===============================
|
||||||
{field: 'truck_id', title: '车辆id', span: 12, itemRender: {name: '$input'}},
|
// {
|
||||||
{field: 'truck_code', title: '车辆编码', span: 12, itemRender: {name: '$input'}},
|
// title: '车次', span: 6,
|
||||||
{field: 'truck_name', title: '车辆名称', span: 12, itemRender: {name: '$input'}},
|
// field: 'TrainNumber',
|
||||||
{field: 'truck_number', title: '车牌号', span: 12, itemRender: {name: '$input'}},
|
// dataRule: {
|
||||||
{field: 'tire_type', title: '轮胎更换类型', span: 12, itemRender: {name: '$input'}},
|
// fromField: "TrainNumber",
|
||||||
{field: 'tire_brand', title: '轮胎品牌', span: 12, itemRender: {name: '$input'}},
|
// saveField: "TrainNumber"
|
||||||
{field: 'tire_model', title: '轮胎型号', span: 12, itemRender: {name: '$input'}},
|
// },
|
||||||
{field: 'tire_count', title: '轮胎更换数量', span: 12, itemRender: {name: '$input'}},
|
// itemRender: {
|
||||||
{field: 'tire_price', title: '轮胎更换价格', span: 12, itemRender: {name: '$input'}},
|
// name: 'MkFormDataSelector', props: {
|
||||||
{field: 'tire_number', title: '轮胎胎号', span: 12, itemRender: {name: '$input'}},
|
// params: {
|
||||||
{field: 'tire_remark', title: '轮胎更换备注', span: 12, itemRender: {name: '$input'}},
|
// 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',
|
field: 'tire_date',
|
||||||
dataRule: { type: "timestamp" },
|
dataRule: { type: "timestamp" },
|
||||||
title: '轮胎更换日期',
|
title: '日期',
|
||||||
span: 12,
|
span: 12,
|
||||||
itemRender: { name: '$input', props: { type: "date" } }
|
itemRender: { name: '$input', props: { type: "date" } }
|
||||||
},
|
},
|
||||||
|
|
@ -149,24 +201,34 @@ export default {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pageData.actions.get = pageData.actions.TruckDetail;
|
pageData.actions.get = pageData.actions.TireDetail;
|
||||||
pageData.actions.create = pageData.actions.TruckCreate;
|
pageData.actions.create = pageData.actions.TireCreate;
|
||||||
pageData.actions.update = pageData.actions.TruckUpdate;
|
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() {
|
computed: {
|
||||||
|
// desc() {
|
||||||
|
// return this.$t('editPageDesc')
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
created() {
|
||||||
|
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
let dataId = this.getDataId();
|
let dataId = this.getDataId();
|
||||||
|
|
||||||
// 如果有id参数,说明是编辑模式
|
// 如果有id参数,说明是编辑模式
|
||||||
if (dataId) {
|
if (dataId) {
|
||||||
const json = `{"id":${dataId}}`;
|
const json = `{"id":${dataId}}`;
|
||||||
this.$mk.post({
|
this.$mk.post({
|
||||||
url: this.pageOptions.actions.get,
|
url: this.actions.get,
|
||||||
loading: "加载中...",
|
loading: "加载中...",
|
||||||
data: json,
|
data: json,
|
||||||
config: {
|
config: {
|
||||||
|
|
@ -175,39 +237,34 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).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 = [
|
// =============================== 时间字段判断 自动生成 End ===============================
|
||||||
{field: "warehouse_effective_date", dataRule: "timestamp"},
|
this.formOptions.data = a.data[this.detailDataFieldName];
|
||||||
{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) => {
|
}).catch((a) => {
|
||||||
this.$mk.error(a.data.msg);
|
this.$mk.error(a.data.msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pageOptions.isEdit = true;
|
this.isEdit = true;
|
||||||
|
|
||||||
this.$forceUpdate()
|
|
||||||
} else {
|
} else {
|
||||||
// 如果没有id参数,说明是新增模式
|
// 如果没有id参数,说明是新增模式
|
||||||
this.addModeItems.forEach(item => {
|
this.addModeItems.forEach(item => {
|
||||||
this.pageOptions.formOptions.items.push(item);
|
this.formOptions.items.push(item);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 函数
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
getDataId() {
|
getDataId() {
|
||||||
|
|
@ -219,6 +276,83 @@ export default {
|
||||||
dataId = 0;
|
dataId = 0;
|
||||||
}
|
}
|
||||||
return dataId;
|
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>
|
</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 ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{field: 'truck_number_id', sortable: true, title: '车次id', width: 250}, // 车次id
|
// {field: 'truck_number_id', sortable: true, title: '车次id', width: 120}, // 车次id
|
||||||
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 250}, // 车次单号
|
{field: 'truck_number_code', sortable: true, title: '车次单号', width: 120}, // 车次单号
|
||||||
{field: 'truck_id', sortable: true, title: '车辆id', width: 250}, // 车辆id
|
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 250}, // 车辆编码
|
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 250}, // 车辆名称
|
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 250}, // 车牌号
|
{field: 'tire_type', sortable: true, title: '类型', width: 70}, // 轮胎更换类型: 1.更换,2.补胎
|
||||||
{field: 'tire_type', sortable: true, title: '轮胎更换类型', width: 250}, // 轮胎更换类型: 1.更换,2.补胎
|
{field: 'tire_brand', sortable: true, title: '品牌', width: 100}, // 轮胎品牌
|
||||||
{field: 'tire_brand', sortable: true, title: '轮胎品牌', width: 250}, // 轮胎品牌
|
{field: 'tire_model', sortable: true, title: '型号', width: 100}, // 轮胎型号
|
||||||
{field: 'tire_model', sortable: true, title: '轮胎型号', width: 250}, // 轮胎型号
|
{field: 'tire_count', sortable: true, title: '更换数量', width: 100}, // 轮胎更换数量
|
||||||
{field: 'tire_count', sortable: true, title: '轮胎更换数量', width: 250}, // 轮胎更换数量
|
{field: 'tire_price', sortable: true, title: '价格', width: 120}, // 轮胎更换价格
|
||||||
{field: 'tire_price', sortable: true, title: '轮胎更换价格', width: 250}, // 轮胎更换价格
|
{field: 'tire_number', sortable: true, title: '胎号', width: 150}, // 轮胎胎号
|
||||||
{field: 'old_tire_number', sortable: true, title: '轮胎更换旧胎号', width: 250}, // 轮胎更换旧胎号
|
{field: 'old_tire_number', sortable: true, title: '旧胎号', width: 150}, // 轮胎更换旧胎号
|
||||||
{field: 'last_mileage', sortable: true, title: '更换公里数', width: 250}, // 更换公里数
|
{field: 'last_mileage', sortable: true, title: '更换时公里数', width: 130}, // 更换公里数
|
||||||
{field: 'tire_number', sortable: true, title: '轮胎胎号', width: 250}, // 轮胎胎号
|
{field: 'mileage', sortable: true, title: '使用公里数', width: 120}, // 轮胎使用公里数
|
||||||
{field: 'mileage', sortable: true, title: '轮胎使用公里数', width: 250}, // 轮胎使用公里数
|
{field: 'tire_change_date', sortable: true, title: '更换日期间隔',formatter: 'formatDate', width: 150}, // 轮胎更换日期间隔
|
||||||
{field: 'tire_change_date', sortable: true, title: '轮胎更换日期间隔', width: 250}, // 轮胎更换日期间隔
|
{field: 'tire_change_mileage', sortable: true, title: '更换公里数间隔', width: 150}, // 轮胎更换公里数间隔
|
||||||
{field: 'tire_change_mileage', sortable: true, title: '轮胎更换公里数间隔', width: 250}, // 轮胎更换公里数间隔
|
{field: 'tire_abolish_date', sortable: true, title: '作废日期',formatter: 'formatDate', width: 120}, // 轮胎作废日期
|
||||||
{field: 'tire_abolish_date', sortable: true, title: '轮胎作废日期', width: 250}, // 轮胎作废日期
|
{field: 'tire_abolish_mileage', sortable: true, title: '作废公里数', width: 120}, // 轮胎作废公里数
|
||||||
{field: 'tire_abolish_mileage', sortable: true, title: '轮胎作废公里数', width: 250}, // 轮胎作废公里数
|
{field: 'tire_remark', sortable: true, title: '备注', width: 250}, // 轮胎更换备注
|
||||||
{field: 'tire_mileage', sortable: true, title: '轮胎使用公里数', width: 250}, // 轮胎使用公里数
|
|
||||||
{field: 'tire_remark', sortable: true, title: '轮胎更换备注', width: 250}, // 轮胎更换备注
|
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'create_time',
|
field: 'create_time',
|
||||||
|
|
@ -201,7 +199,7 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 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_name: "",
|
||||||
outsourcing_driver_phone: "",
|
outsourcing_driver_phone: "",
|
||||||
is_need_outbound: 0,
|
is_need_outbound: 0,
|
||||||
truck_name: null,
|
truck_name: "",
|
||||||
truck_id: null,
|
truck_id: 0,
|
||||||
driver_id: null,
|
driver_id: 0,
|
||||||
outbound_date: new Date(2100, 1, 1).getTime() / 10000,
|
outbound_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||||
return_date: new Date(2100, 1, 1).getTime() / 10000,
|
return_date: new Date(2100, 1, 1).getTime() / 10000,
|
||||||
end_mileage: 0,
|
end_mileage: 0,
|
||||||
driver_subsidy_remark: "",
|
driver_subsidy_remark: "",
|
||||||
is_change_tire: 0,
|
is_change_tire: 0,
|
||||||
tire_id: null,
|
tire_id: 0,
|
||||||
is_repair: 0,
|
is_repair: 0,
|
||||||
repair_id: 0,
|
repair_id: 0,
|
||||||
is_oil: 0,
|
is_oil: 0,
|
||||||
|
|
@ -361,7 +361,7 @@ export default {
|
||||||
items: [
|
items: [
|
||||||
// =============================== 表单项 自动生成 Start ===============================
|
// =============================== 表单项 自动生成 Start ===============================
|
||||||
{field:'',title:'',span:24,isTitle:true,Htitle:'车辆信息',itemRender:{}},//分割线
|
{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_truck_number',isOutsourcing:true, title: '委外车牌号', span: 7, itemRender: {name: '$input'}},
|
||||||
{field: 'outsourcing_driver_name',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`,
|
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
|
||||||
onDataChanged: ({data}) => {
|
onDataChanged: ({data}) => {
|
||||||
console.log(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: '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',
|
field: 'outbound_date',
|
||||||
dataRule: {type: "timestamp"},
|
dataRule: {type: "timestamp"},
|
||||||
|
|
@ -718,6 +718,7 @@ export default {
|
||||||
this.formOptions.data.other_expenses_log.forEach(item => {
|
this.formOptions.data.other_expenses_log.forEach(item => {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
item.other_expenses_amount = Number(item.other_expenses_amount)
|
item.other_expenses_amount = Number(item.other_expenses_amount)
|
||||||
|
console.log("item.driver_id",item.driver_id)
|
||||||
})
|
})
|
||||||
let postdata = Object.assign({}, this.formOptions.data);
|
let postdata = Object.assign({}, this.formOptions.data);
|
||||||
// 如果是编辑模式
|
// 如果是编辑模式
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,47 @@
|
||||||
<vxe-grid ref='xGrid' v-bind="gridOptions">
|
<vxe-grid ref='xGrid' v-bind="gridOptions">
|
||||||
|
|
||||||
<!-- =============================== 表格列 自动生成 Start =============================== -->
|
<!-- =============================== 表格列 自动生成 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 =============================== -->
|
<!-- =============================== 表格列 自动生成 End =============================== -->
|
||||||
|
|
||||||
<template #op="{ row }">
|
<template #op="{ row }">
|
||||||
|
|
@ -103,7 +143,12 @@ export default {
|
||||||
],
|
],
|
||||||
//搜索区
|
//搜索区
|
||||||
searchFormItems: [ // 子项
|
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: '请输入描述'}}},
|
// {field: 'desc', title: '描述', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入描述'}}},
|
||||||
{span: 8, slots: {default: 'date'}}, // 自定义列
|
{span: 8, slots: {default: 'date'}}, // 自定义列
|
||||||
{
|
{
|
||||||
|
|
@ -162,59 +207,66 @@ export default {
|
||||||
// =============================== 表格列 自动生成 Start ===============================
|
// =============================== 表格列 自动生成 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_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_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: '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: '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: 'warehousing_soil_quality_material_id', sortable: true, title: '入库物料土质id', width: 250}, // 入库物料土质id
|
||||||
|
|
||||||
{field: 'is_outsourcing', sortable: true, title: '是否委外', width: 250}, // 是否委外
|
// {field: 'unit_price', sortable: true, title: '单价', width: 120}, // 单价
|
||||||
{field: 'outsourcing_truck_number', sortable: true, title: '委外车牌号', width: 250}, // 委外车牌号
|
// {field: 'total_price', sortable: true, title: '总价', width: 120}, // 总价
|
||||||
{field: 'outsourcing_driver_name', sortable: true, title: '委外司机姓名', width: 250}, // 委外司机姓名
|
{field: 'is_outsourcing', align: 'center',sortable: true, title: '类型', width: 80,
|
||||||
{field: 'outsourcing_driver_phone', sortable: true, title: '委外司机手机号', width: 250}, // 委外司机手机号
|
slots: {default: 'is_outsourcing'}
|
||||||
{field: 'is_need_outbound', sortable: true, title: '是否需要出车', width: 250}, // 是否需要出车
|
}, // 是否委外
|
||||||
{field: 'truck_id', sortable: true, title: '车辆', width: 250}, // 车辆id
|
// {field: 'is_need_outbound', sortable: true, title: '出车', width: 70}, // 是否需要出车
|
||||||
{field: 'driver_id', sortable: true, title: '司机id', width: 250}, // 司机id
|
{field: 'outbound_date', align: 'center',sortable: true, formatter: 'formatDate', title: '出车日期', width: 100}, // 出车日期
|
||||||
{field: 'outbound_date', sortable: true, title: '出车日期', width: 250}, // 出车日期
|
{field: 'return_date', align: 'center',sortable: true, formatter: 'formatDate', title: '回车日期', width: 100}, // 回车日期
|
||||||
{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: 'create_time',
|
field: 'is_change_tire', align: 'center',sortable: true, title: '更换轮胎', width: 100,
|
||||||
formatter: 'formatDate',
|
slots: {default: 'is_change_tire'}
|
||||||
width: 100,
|
}, // 是否更换轮胎
|
||||||
sortable: true,
|
{field: 'is_repair', align: 'center',sortable: true, title: '维修', width: 70,
|
||||||
title: '创建时间',
|
slots: {default: 'is_repair'}
|
||||||
showHeaderOverflow: true
|
}, // 是否维修
|
||||||
}, // 创建时间
|
{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: 'create_time',
|
||||||
{field: 'cost', sortable: true, title: '成本', width: 250}, // 成本
|
// formatter: 'formatDate',
|
||||||
{field: 'profit', sortable: true, title: '利润', width: 250}, // 利润
|
// width: 100,
|
||||||
{field: 'unit_price', sortable: true, title: '单价', width: 250}, // 单价
|
// sortable: true,
|
||||||
{field: 'total_price', sortable: true, title: '总价', width: 250}, // 总价
|
// title: '创建时间',
|
||||||
{field: 'supplier_outbound_tonnage', sortable: true, title: '供应商出库吨位', width: 250}, // 供应商出库吨位
|
// showHeaderOverflow: true
|
||||||
{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: '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 ===============================
|
// =============================== 表格列 自动生成 Start ===============================
|
||||||
|
|
||||||
|
|
||||||
{title: '操作', slots: {default: 'op'}, width: 120}
|
{title: '操作', slots: {default: 'op'}, width: 120, fixed: 'right'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,66 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="page-body">
|
||||||
<basic-page-edit :dataId="getDataId()" :options="pageOptions" @afterSave="afterSave"></basic-page-edit>
|
|
||||||
|
|
||||||
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 {
|
export default {
|
||||||
|
|
||||||
// i18n: require('./i18n'),
|
name: 'TruckUpdate',
|
||||||
components: {
|
i18n: require('./i18n'),
|
||||||
// Update
|
// components: {PageLayout},
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
pageMode: {
|
pageMode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "edit"
|
default: "edit"
|
||||||
},
|
},
|
||||||
dataId: {}
|
dataId: {}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
return {
|
|
||||||
pageOptions: {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
// desc() {
|
|
||||||
// return this.$t('editPageDesc')
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
created() {
|
|
||||||
|
|
||||||
this.optionsInit();
|
|
||||||
this.dataInit();
|
|
||||||
|
|
||||||
},
|
|
||||||
// 函数
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
|
|
||||||
optionsInit() {
|
|
||||||
// 页面数据变量
|
// 页面数据变量
|
||||||
var pageData = {
|
var pageData = {
|
||||||
// 当前项目名称
|
// 当前项目名称
|
||||||
|
|
@ -57,11 +68,6 @@ export default {
|
||||||
// 当前项目ID
|
// 当前项目ID
|
||||||
currentBeid: 0,
|
currentBeid: 0,
|
||||||
|
|
||||||
addPageUrl: "/Truck/TruckCreate",
|
|
||||||
editPageUrl: "/Truck/TruckUpdate/",
|
|
||||||
listPageUrl: "/Truck/TruckList",
|
|
||||||
|
|
||||||
|
|
||||||
uploadDefaultImg: null,
|
uploadDefaultImg: null,
|
||||||
detailDataFieldName: "truck",
|
detailDataFieldName: "truck",
|
||||||
|
|
||||||
|
|
@ -87,7 +93,7 @@ export default {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
formOptions: {
|
formOptions: {
|
||||||
data: {
|
data: {
|
||||||
|
// =============================== 表单数据 自动生成 Start ===============================
|
||||||
|
|
||||||
id: 0,
|
id: 0,
|
||||||
code: "",
|
code: "",
|
||||||
|
|
@ -111,9 +117,12 @@ export default {
|
||||||
remark: "",
|
remark: "",
|
||||||
create_uid: 0,
|
create_uid: 0,
|
||||||
update_uid: 0,
|
update_uid: 0,
|
||||||
|
current_distance:0,
|
||||||
|
|
||||||
|
// =============================== 表单数据 自动生成 End ===============================
|
||||||
},
|
},
|
||||||
// 标题宽度
|
// 标题宽度
|
||||||
titleWidth: 125,
|
titleWidth: 150,
|
||||||
// 标题对齐方式
|
// 标题对齐方式
|
||||||
titleAlign: 'right',
|
titleAlign: 'right',
|
||||||
|
|
||||||
|
|
@ -160,6 +169,10 @@ export default {
|
||||||
remark: [
|
remark: [
|
||||||
{message: '请输入车辆备注'}
|
{message: '请输入车辆备注'}
|
||||||
],
|
],
|
||||||
|
current_distance: [
|
||||||
|
{message: '请输入当前公里数'}
|
||||||
|
|
||||||
|
],
|
||||||
// =============================== 表单校验 自动生成 End ===============================
|
// =============================== 表单校验 自动生成 End ===============================
|
||||||
},
|
},
|
||||||
// 表单项
|
// 表单项
|
||||||
|
|
@ -172,7 +185,8 @@ export default {
|
||||||
{field: 'type', title: '类型', span: 6, itemRender: {name: '$input'}},
|
{field: 'type', title: '类型', span: 6, itemRender: {name: '$input'}},
|
||||||
{field: 'manager_name', 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: '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 ===============================
|
// =============================== 表单项 自动生成 End ===============================
|
||||||
]
|
]
|
||||||
|
|
@ -190,18 +204,27 @@ export default {
|
||||||
// 合并表单数据及配置
|
// 合并表单数据及配置
|
||||||
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;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 初始化数据
|
computed: {
|
||||||
dataInit() {
|
// desc() {
|
||||||
|
// return this.$t('editPageDesc')
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
created() {
|
||||||
|
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
let dataId = this.getDataId();
|
let dataId = this.getDataId();
|
||||||
|
|
||||||
// 如果有id参数,说明是编辑模式
|
// 如果有id参数,说明是编辑模式
|
||||||
if (dataId) {
|
if (dataId) {
|
||||||
const json = `{"id":${dataId}}`;
|
const json = `{"id":${dataId}}`;
|
||||||
this.$mk.post({
|
this.$mk.post({
|
||||||
url: this.pageOptions.actions.get,
|
url: this.actions.get,
|
||||||
loading: "加载中...",
|
loading: "加载中...",
|
||||||
data: json,
|
data: json,
|
||||||
config: {
|
config: {
|
||||||
|
|
@ -210,41 +233,34 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).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 = [
|
// =============================== 时间字段判断 自动生成 End ===============================
|
||||||
{field: "warehouse_effective_date", dataRule: "timestamp"},
|
this.formOptions.data = a.data[this.detailDataFieldName];
|
||||||
{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) => {
|
}).catch((a) => {
|
||||||
this.$mk.error(a.data.msg);
|
this.$mk.error(a.data.msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pageOptions.isEdit = true;
|
this.isEdit = true;
|
||||||
|
|
||||||
this.$forceUpdate()
|
|
||||||
} else {
|
} else {
|
||||||
// 如果没有id参数,说明是新增模式
|
// 如果没有id参数,说明是新增模式
|
||||||
if (this.pageOptions.addModeItems.length > 0) {
|
|
||||||
this.addModeItems.forEach(item => {
|
this.addModeItems.forEach(item => {
|
||||||
this.pageOptions.formOptions.items.push(item);
|
this.formOptions.items.push(item);
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 函数
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
getDataId() {
|
getDataId() {
|
||||||
|
|
@ -257,8 +273,80 @@ export default {
|
||||||
}
|
}
|
||||||
return dataId;
|
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>
|
</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: 'code', sortable: true, title: '编码', width: 120}, // 编码
|
||||||
{field: 'plate_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
{field: 'plate_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||||
{field: 'type', 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_name', sortable: true, title: '负责人姓名', width: 120}, // 负责人姓名
|
||||||
{field: 'manager_phone', sortable: true, title: '负责人电话', width: 150}, // 负责人电话
|
{field: 'manager_phone', sortable: true, title: '负责人电话', width: 150}, // 负责人电话
|
||||||
{field: 'out_count', sortable: true, title: '出车次数', width: 120}, // 出车次数
|
{field: 'out_count', sortable: true, title: '出车次数', width: 120}, // 出车次数
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue