Merge remote-tracking branch 'origin/master'
# Conflicts: # src/views/system/dept.vue
This commit is contained in:
@@ -70,6 +70,28 @@
|
||||
class="accident-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #directEconomicLossForm>
|
||||
<el-input
|
||||
v-model="form.directEconomicLoss"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('directEconomicLoss', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #insuranceClaimAmountForm>
|
||||
<el-input
|
||||
v-model="form.insuranceClaimAmount"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('insuranceClaimAmount', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
@@ -256,6 +278,13 @@ export default {
|
||||
if (!value || typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
|
||||
@@ -70,6 +70,17 @@
|
||||
class="annual-inspection-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #feeForm>
|
||||
<el-input
|
||||
v-model="form.fee"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('fee', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
@@ -256,6 +267,13 @@ export default {
|
||||
if (!value || typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
|
||||
@@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<basic-container class="equipment-ledger-page">
|
||||
<avue-crud
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
v-model:page="page"
|
||||
:option="option"
|
||||
:data="data"
|
||||
:permission="permissionList"
|
||||
:table-loading="loading"
|
||||
:before-open="beforeOpen"
|
||||
@row-save="rowSave"
|
||||
@row-update="rowUpdate"
|
||||
@row-del="rowDel"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template #menu-left>
|
||||
<el-button
|
||||
v-if="hasPermission('equipment_ledger_import')"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleImport"
|
||||
>
|
||||
批量导入
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasPermission('equipment_ledger_template')"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleTemplate"
|
||||
>
|
||||
下载模板
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasPermission('equipment_ledger_export')"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleExport"
|
||||
>
|
||||
批量导出
|
||||
</el-button>
|
||||
</template>
|
||||
<template #vehicleNo="{ row, index }">
|
||||
<el-link type="primary" @click="$refs.crud.rowView(row, index)">{{
|
||||
row.vehicleNo
|
||||
}}</el-link>
|
||||
</template>
|
||||
<template #vehicleNoForm>
|
||||
<el-autocomplete
|
||||
v-model="form.vehicleNo"
|
||||
:disabled="boxType === 'view'"
|
||||
:fetch-suggestions="fetchVehicleOptions"
|
||||
:placeholder="vehicleNoPlaceholder"
|
||||
clearable
|
||||
value-key="value"
|
||||
/>
|
||||
</template>
|
||||
<template #equipmentCodeForm>
|
||||
<el-input v-model="form.equipmentCode" disabled />
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
<template #attachmentsForm>
|
||||
<vehicle-attachment-upload v-model="form.attachments" :readonly="boxType === 'view'" />
|
||||
</template>
|
||||
<template #attachments-form>
|
||||
<vehicle-attachment-upload v-model="form.attachments" :readonly="boxType === 'view'" />
|
||||
</template>
|
||||
</avue-crud>
|
||||
<empty-pagination
|
||||
:page="page"
|
||||
@size-change="sizeChange"
|
||||
@current-change="currentChange"
|
||||
@load="onLoad(page, query)"
|
||||
/>
|
||||
<el-dialog title="设备台账数据导入" append-to-body v-model="excelBox" width="555px">
|
||||
<avue-form :option="excelOption" v-model="excelForm">
|
||||
<template #excelTemplate>
|
||||
<el-button type="primary" @click="handleTemplate">点击下载</el-button>
|
||||
</template>
|
||||
</avue-form>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
add,
|
||||
getDetail,
|
||||
getList,
|
||||
getNextEquipmentCode,
|
||||
remove,
|
||||
update,
|
||||
} from '@/api/vehicle/equipment-ledger';
|
||||
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
|
||||
import { getList as getShipList } from '@/api/transportCapacity/transport-ship';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { excelOption, option } from '@/option/vehicle/equipment-ledger';
|
||||
import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
loading: true,
|
||||
excelBox: false,
|
||||
excelForm: {},
|
||||
boxType: '',
|
||||
option,
|
||||
excelOption,
|
||||
data: [],
|
||||
selectionList: [],
|
||||
page: { pageSize: 10, pageSizes: [10, 20, 50, 100], currentPage: 1, total: 0 },
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
isAdmin() {
|
||||
return (this.userInfo.authority || '').includes('admin');
|
||||
},
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.hasPermission('equipment_ledger_add'),
|
||||
viewBtn: this.hasPermission('equipment_ledger_view'),
|
||||
editBtn: this.hasPermission('equipment_ledger_edit'),
|
||||
delBtn: this.hasPermission('equipment_ledger_delete'),
|
||||
};
|
||||
},
|
||||
vehicleNoPlaceholder() {
|
||||
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择';
|
||||
},
|
||||
ids() {
|
||||
return this.selectionList.map(item => item.id).join(',');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.initDeptTree();
|
||||
this.initEquipmentTypeOptions();
|
||||
},
|
||||
methods: {
|
||||
hasPermission(code) {
|
||||
return this.isAdmin || this.validData(this.permission[code], false);
|
||||
},
|
||||
initDeptTree() {
|
||||
getDeptTree(this.userInfo.tenantId).then(res => {
|
||||
this.findColumn(this.option.column, 'createDept').dicData = res.data.data || [];
|
||||
});
|
||||
},
|
||||
initEquipmentTypeOptions() {
|
||||
getDictionary({ code: 'equip_type' }).then(res => {
|
||||
this.findColumn(this.option.column, 'equipmentType').dicData = (res.data.data || []).map(
|
||||
item => ({
|
||||
label: item.dictValue,
|
||||
value: item.dictValue,
|
||||
})
|
||||
);
|
||||
});
|
||||
},
|
||||
fetchVehicleOptions(queryString, callback) {
|
||||
const isShip = this.form.vehicleType === '船舶';
|
||||
const request = isShip ? getShipList : getVehicleList;
|
||||
const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
|
||||
request(1, 20, params)
|
||||
.then(res => {
|
||||
callback(
|
||||
(res.data.data.records || []).map(item => ({
|
||||
value: isShip ? item.shipIdentifierNo || item.shipName : item.plateNo,
|
||||
}))
|
||||
);
|
||||
})
|
||||
.catch(() => callback([]));
|
||||
},
|
||||
formatAttachments(value) {
|
||||
if (!value) return '';
|
||||
if (Array.isArray(value)) return `${value.length} 个`;
|
||||
try {
|
||||
const attachments = JSON.parse(value);
|
||||
return Array.isArray(attachments) ? `${attachments.length} 个` : '1 个';
|
||||
} catch (error) {
|
||||
return `${value.split(',').filter(Boolean).length} 个`;
|
||||
}
|
||||
},
|
||||
parseAttachments(value) {
|
||||
if (!value || Array.isArray(value)) return value;
|
||||
try {
|
||||
const attachments = JSON.parse(value);
|
||||
return Array.isArray(attachments) ? attachments : [];
|
||||
} catch (error) {
|
||||
return value
|
||||
.split(',')
|
||||
.filter(Boolean)
|
||||
.map(url => ({ name: url, url }));
|
||||
}
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
values.vehicleNo = (values.vehicleNo || '').trim();
|
||||
if (values.vehicleType === '车辆') values.vehicleNo = values.vehicleNo.toUpperCase();
|
||||
values.attachments = Array.isArray(values.attachments)
|
||||
? JSON.stringify(values.attachments)
|
||||
: values.attachments;
|
||||
return values;
|
||||
},
|
||||
rowSave(row, done, loading) {
|
||||
add(this.normalizeRow(row)).then(
|
||||
() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message.success('操作成功');
|
||||
done();
|
||||
},
|
||||
() => loading()
|
||||
);
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(this.normalizeRow(row)).then(
|
||||
() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message.success('操作成功');
|
||||
done();
|
||||
},
|
||||
() => loading()
|
||||
);
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm('确认删除该条数据?删除后将不可恢复!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => remove(row.id))
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message.success('操作成功');
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
this.boxType = type;
|
||||
if (type === 'add') {
|
||||
getNextEquipmentCode().then(res => {
|
||||
this.form = { vehicleType: '车辆', equipmentCode: res.data.data };
|
||||
done();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (['edit', 'view'].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = {
|
||||
...res.data.data,
|
||||
attachments: this.parseAttachments(res.data.data.attachments),
|
||||
};
|
||||
done();
|
||||
});
|
||||
return;
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, { ...this.query, ...params })
|
||||
.then(res => {
|
||||
const result = res.data.data;
|
||||
this.page.total = result.total;
|
||||
this.data = result.records;
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleImport() {
|
||||
openImportDialog(this, '设备台账');
|
||||
},
|
||||
handleExport() {
|
||||
this.$confirm('是否导出设备台账数据?', '提示', { type: 'warning' }).then(() => {
|
||||
NProgress.start();
|
||||
exportBlob(
|
||||
'/blade-transport/equipment-ledger/export-equipment-ledger',
|
||||
{ ...this.query, ids: this.ids, [this.website.tokenHeader]: getToken() },
|
||||
{ feedback: true }
|
||||
)
|
||||
.then(res =>
|
||||
downloadXls(res.data, `设备台账${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`)
|
||||
)
|
||||
.finally(() => NProgress.done());
|
||||
});
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
`/blade-transport/equipment-ledger/export-template?${
|
||||
this.website.tokenHeader
|
||||
}=${getToken()}`,
|
||||
{ feedback: true }
|
||||
).then(res => downloadXls(res.data, '设备台账模板.xlsx'));
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.equipment-ledger-page {
|
||||
:deep(.el-table th .cell),
|
||||
:deep(.el-table td .cell) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -70,6 +70,17 @@
|
||||
class="etc-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #transactionAmountForm>
|
||||
<el-input
|
||||
v-model="form.transactionAmount"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('transactionAmount', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
@@ -209,6 +220,13 @@ export default {
|
||||
isEmpty(value) {
|
||||
return value === undefined || value === null || value === '';
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.dataSource = values.dataSource || '手工录入';
|
||||
@@ -379,11 +397,9 @@ export default {
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
NProgress.start();
|
||||
exportBlob(
|
||||
'/blade-transport/etc-record/export-etc-record',
|
||||
this.buildExportParams(),
|
||||
{ feedback: true }
|
||||
)
|
||||
exportBlob('/blade-transport/etc-record/export-etc-record', this.buildExportParams(), {
|
||||
feedback: true,
|
||||
})
|
||||
.then(res => {
|
||||
downloadXls(res.data, `ETC记录${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
|
||||
})
|
||||
|
||||
@@ -69,6 +69,28 @@
|
||||
class="insurance-record-page__vehicle-input"
|
||||
/>
|
||||
</template>
|
||||
<template #insuredAmountForm>
|
||||
<el-input
|
||||
v-model="form.insuredAmount"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('insuredAmount', value)"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #premiumForm>
|
||||
<el-input
|
||||
v-model="form.premium"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('premium', value)"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #policyFileForm>
|
||||
<div class="insurance-record-page__upload">
|
||||
<div class="insurance-record-page__upload-info">
|
||||
@@ -177,6 +199,7 @@ export default {
|
||||
excelBox: false,
|
||||
excelForm: {},
|
||||
isDetailLoading: false,
|
||||
boxType: '',
|
||||
option,
|
||||
excelOption,
|
||||
page: {
|
||||
@@ -285,6 +308,13 @@ export default {
|
||||
}
|
||||
return values;
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
buildQuery(params = {}) {
|
||||
return normalizeSearchRangeParams({ ...params, ...this.query }, createTimeRangeMap);
|
||||
},
|
||||
@@ -369,6 +399,7 @@ export default {
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
this.boxType = type;
|
||||
if (type === 'add') {
|
||||
this.form.vehicleType = '车辆';
|
||||
this.form.ocrTemplate = '紫金-机动车交强险';
|
||||
|
||||
@@ -70,6 +70,39 @@
|
||||
class="maintenance-plan-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #mileageForm>
|
||||
<el-input
|
||||
v-model="form.mileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('mileage', value)"
|
||||
>
|
||||
<template #append>{{ form.mileageUnit || '公里' }}</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #costForm>
|
||||
<el-input
|
||||
v-model="form.cost"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('cost', value)"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #nextMaintenanceMileageForm>
|
||||
<el-input
|
||||
v-model="form.nextMaintenanceMileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('nextMaintenanceMileage', value)"
|
||||
>
|
||||
<template #append>{{ form.mileageUnit || '公里' }}</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #mileage="{ row }">
|
||||
<span>{{ formatMileage(row.mileage, row.mileageUnit) }}</span>
|
||||
</template>
|
||||
@@ -169,6 +202,7 @@ export default {
|
||||
searchMenuPosition: 'right',
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: '序号',
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
dialogClickModal: false,
|
||||
@@ -223,12 +257,10 @@ export default {
|
||||
{
|
||||
label: '里程/航程数',
|
||||
prop: 'mileage',
|
||||
type: 'number',
|
||||
precision: 2,
|
||||
type: 'input',
|
||||
minWidth: 130,
|
||||
slot: true,
|
||||
span: 12,
|
||||
append: '公里',
|
||||
placeholder: '请输入',
|
||||
rules: [{ validator: validateNonNegative, trigger: 'blur' }],
|
||||
},
|
||||
@@ -255,9 +287,8 @@ export default {
|
||||
{
|
||||
label: '费用',
|
||||
prop: 'cost',
|
||||
type: 'number',
|
||||
precision: 2,
|
||||
append: '元',
|
||||
type: 'input',
|
||||
slot: true,
|
||||
span: 12,
|
||||
placeholder: '请输入',
|
||||
rules: [
|
||||
@@ -302,12 +333,10 @@ export default {
|
||||
{
|
||||
label: '下次保养里程/航程',
|
||||
prop: 'nextMaintenanceMileage',
|
||||
type: 'number',
|
||||
precision: 2,
|
||||
type: 'input',
|
||||
minWidth: 170,
|
||||
slot: true,
|
||||
span: 12,
|
||||
append: '公里',
|
||||
placeholder: '请输入',
|
||||
rules: [{ validator: validateNonNegative, trigger: 'blur' }],
|
||||
},
|
||||
@@ -531,6 +560,13 @@ export default {
|
||||
if (!value || typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
initDeptTree() {
|
||||
getDeptTree(this.userInfo.tenantId).then(res => {
|
||||
const column = this.findColumn(this.option.column, 'createDept');
|
||||
|
||||
@@ -70,6 +70,28 @@
|
||||
class="maintenance-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #costForm>
|
||||
<el-input
|
||||
v-model="form.cost"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('cost', value)"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #mileageForm>
|
||||
<el-input
|
||||
v-model="form.mileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('mileage', value)"
|
||||
>
|
||||
<template #append>{{ form.mileageUnit || '公里' }}</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #mileage="{ row }">
|
||||
<span>{{ formatMileage(row.mileage, row.mileageUnit) }}</span>
|
||||
</template>
|
||||
@@ -167,6 +189,7 @@ export default {
|
||||
searchMenuPosition: 'right',
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: '序号',
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
dialogClickModal: false,
|
||||
@@ -239,9 +262,8 @@ export default {
|
||||
{
|
||||
label: '费用',
|
||||
prop: 'cost',
|
||||
type: 'number',
|
||||
precision: 2,
|
||||
append: '元',
|
||||
type: 'input',
|
||||
slot: true,
|
||||
span: 12,
|
||||
placeholder: '请输入',
|
||||
rules: [
|
||||
@@ -287,10 +309,8 @@ export default {
|
||||
{
|
||||
label: '里程/航程数',
|
||||
prop: 'mileage',
|
||||
type: 'number',
|
||||
precision: 2,
|
||||
type: 'input',
|
||||
minWidth: 130,
|
||||
append: '公里',
|
||||
slot: true,
|
||||
span: 12,
|
||||
placeholder: '请输入',
|
||||
@@ -526,6 +546,13 @@ export default {
|
||||
if (!value || typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
initDeptTree() {
|
||||
getDeptTree(this.userInfo.tenantId).then(res => {
|
||||
const column = this.findColumn(this.option.column, 'createDept');
|
||||
|
||||
@@ -82,6 +82,50 @@
|
||||
class="mileage-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #previousMonthMileageForm>
|
||||
<el-input
|
||||
v-model="form.previousMonthMileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="numeric"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeIntegerInput('previousMonthMileage', value)"
|
||||
>
|
||||
<template #suffix>km</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #currentMonthMileageForm>
|
||||
<el-input
|
||||
v-model="form.currentMonthMileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="numeric"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeIntegerInput('currentMonthMileage', value)"
|
||||
>
|
||||
<template #suffix>km</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #monthlyMileageForm>
|
||||
<el-input
|
||||
v-model="form.monthlyMileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="numeric"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeIntegerInput('monthlyMileage', value)"
|
||||
>
|
||||
<template #suffix>km</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #totalMileageForm>
|
||||
<el-input
|
||||
v-model="form.totalMileage"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="numeric"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeIntegerInput('totalMileage', value)"
|
||||
>
|
||||
<template #suffix>km</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #totalMileageStart-search="{ row }">
|
||||
<div class="mileage-record-page__range">
|
||||
<el-input
|
||||
@@ -224,7 +268,6 @@ export default {
|
||||
Object.keys(labelMap).forEach(prop => {
|
||||
const column = this.findColumn(this.option.column, prop);
|
||||
column.label = labelMap[prop];
|
||||
column.append = unit;
|
||||
});
|
||||
vehicleTypeColumn.disabled = Boolean(this.form.id);
|
||||
const unitColumn = this.findColumn(this.option.column, 'mileageUnit');
|
||||
@@ -304,6 +347,9 @@ export default {
|
||||
toMoney(value) {
|
||||
return Math.round(Number(value) * 100) / 100;
|
||||
},
|
||||
normalizeIntegerInput(prop, value) {
|
||||
this.form[prop] = String(value ?? '').replace(/\D/g, '');
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
|
||||
@@ -70,6 +70,48 @@
|
||||
class="oil-electric-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #quantityForm>
|
||||
<el-input
|
||||
v-model="form.quantity"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('quantity', value)"
|
||||
/>
|
||||
</template>
|
||||
<template #unitPriceForm>
|
||||
<el-input
|
||||
v-model="form.unitPrice"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('unitPrice', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #transactionAmountForm>
|
||||
<el-input
|
||||
v-model="form.transactionAmount"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('transactionAmount', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #balanceForm>
|
||||
<el-input
|
||||
v-model="form.balance"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('balance', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
@@ -190,9 +232,7 @@ export default {
|
||||
},
|
||||
updateFeeType(feeType) {
|
||||
const oilProductColumn = this.findColumn(this.option.column, 'oilProduct');
|
||||
const unitPriceColumn = this.findColumn(this.option.column, 'unitPrice');
|
||||
oilProductColumn.display = feeType !== '充电';
|
||||
unitPriceColumn.append = feeType === '充电' ? '元/度' : '元/升';
|
||||
if (feeType === '充电') {
|
||||
this.form.oilProduct = undefined;
|
||||
}
|
||||
@@ -249,6 +289,13 @@ export default {
|
||||
isEmpty(value) {
|
||||
return value === undefined || value === null || value === '';
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
|
||||
@@ -70,6 +70,17 @@
|
||||
class="other-expense-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #amountForm>
|
||||
<el-input
|
||||
v-model="form.amount"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('amount', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
@@ -234,6 +245,13 @@ export default {
|
||||
isEmpty(value) {
|
||||
return value === undefined || value === null || value === '';
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
|
||||
@@ -70,6 +70,26 @@
|
||||
class="tire-replacement-record-page__input"
|
||||
/>
|
||||
</template>
|
||||
<template #tireQuantityForm>
|
||||
<el-input
|
||||
v-model="form.tireQuantity"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="numeric"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeIntegerInput('tireQuantity', value)"
|
||||
/>
|
||||
</template>
|
||||
<template #replacementCostForm>
|
||||
<el-input
|
||||
v-model="form.replacementCost"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('replacementCost', value)"
|
||||
>
|
||||
<template #suffix>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
@@ -225,6 +245,16 @@ export default {
|
||||
if (!value || typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeIntegerInput(prop, value) {
|
||||
this.form[prop] = String(value ?? '').replace(/\D/g, '');
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
if (values.vehicleNo) {
|
||||
|
||||
@@ -90,6 +90,26 @@
|
||||
placeholder="请输入船长"
|
||||
/>
|
||||
</template>
|
||||
<template #fineAmountForm>
|
||||
<el-input
|
||||
v-model="form.fineAmount"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeDecimalInput('fineAmount', value)"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #deductPointsForm>
|
||||
<el-input
|
||||
v-model="form.deductPoints"
|
||||
:disabled="boxType === 'view'"
|
||||
inputmode="numeric"
|
||||
placeholder="请输入"
|
||||
@input="value => normalizeIntegerInput('deductPoints', value)"
|
||||
/>
|
||||
</template>
|
||||
<template #processStatus="{ row }">
|
||||
<span :class="row.processStatus === '未处理' ? 'violation-record-page__danger' : ''">
|
||||
{{ row.processStatus }}
|
||||
@@ -141,6 +161,7 @@ import { getList as getVehicleList } from '@/api/transportCapacity/transport-veh
|
||||
import { getList as getShipList } from '@/api/transportCapacity/transport-ship';
|
||||
import { getList as getDriverList } from '@/api/transportCapacity/driver';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
@@ -179,6 +200,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.initDeptTree();
|
||||
this.initViolationTypeOptions();
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
@@ -229,6 +251,15 @@ export default {
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
initViolationTypeOptions() {
|
||||
getDictionary({ code: 'type_of_traffic_violation' }).then(res => {
|
||||
const column = this.findColumn(this.option.column, 'violationType');
|
||||
column.dicData = (res.data.data || []).map(item => ({
|
||||
label: item.dictValue,
|
||||
value: item.dictValue,
|
||||
}));
|
||||
});
|
||||
},
|
||||
updateVehicleTypeDisplays(vehicleType, oldValue) {
|
||||
const vehicleTypeColumn = this.findColumn(this.option.column, 'vehicleType');
|
||||
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
|
||||
@@ -240,6 +271,17 @@ export default {
|
||||
driverColumn.label = vehicleType === '船舶' ? '船长' : '驾驶人';
|
||||
typeColumn.display = vehicleType !== '船舶';
|
||||
itemColumn.display = vehicleType === '船舶';
|
||||
typeColumn.rules =
|
||||
vehicleType === '船舶'
|
||||
? []
|
||||
: [{ required: true, message: '请选择类型', trigger: 'change' }];
|
||||
itemColumn.rules =
|
||||
vehicleType === '船舶'
|
||||
? [
|
||||
{ required: true, message: '请输入事项', trigger: 'blur' },
|
||||
{ max: 100, message: '最多 100 个字符', trigger: 'blur' },
|
||||
]
|
||||
: [{ max: 100, message: '最多 100 个字符', trigger: 'blur' }];
|
||||
vehicleTypeColumn.disabled = Boolean(this.form.id);
|
||||
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
|
||||
this.form.vehicleNo = '';
|
||||
@@ -315,6 +357,16 @@ export default {
|
||||
if (!value || typeof value === 'string') return value;
|
||||
return JSON.stringify(value);
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
this.form[prop] = decimalParts.length
|
||||
? `${integerPart || '0'}.${decimalParts.join('').slice(0, 2)}`
|
||||
: integerPart;
|
||||
},
|
||||
normalizeIntegerInput(prop, value) {
|
||||
this.form[prop] = String(value ?? '').replace(/\D/g, '');
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
@@ -337,6 +389,14 @@ export default {
|
||||
return values;
|
||||
},
|
||||
validateRow(row) {
|
||||
if (row.vehicleType === '船舶' && !row.violationItem) {
|
||||
this.$message.warning('请输入事项');
|
||||
return false;
|
||||
}
|
||||
if (row.vehicleType !== '船舶' && !row.violationType) {
|
||||
this.$message.warning('请选择类型');
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
row.violationTime &&
|
||||
new Date(row.violationTime.replace(/-/g, '/')).getTime() > Date.now()
|
||||
|
||||
Reference in New Issue
Block a user