1、完善项目

2、完善合同
3、完善费用项
4、司机管理对接OCR
5、完善运输计划
6、完善临时额度
This commit is contained in:
2026-08-04 12:17:49 +08:00
parent 81c98f6ad8
commit f9f8221870
34 changed files with 7887 additions and 983 deletions

View File

@@ -129,7 +129,7 @@ import { exportBlob } from '@/api/common';
import { mapGetters } from 'vuex';
import { downloadXls } from '@/utils/util';
import { openImportDialog } from '@/utils/import-excel';
import { getToken } from '@/utils/auth';
import { getUploadHeaders } from '@/utils/upload';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { Plus, Upload, Download, Delete } from '@element-plus/icons-vue';
@@ -265,9 +265,7 @@ export default {
propsHttp: {
res: 'data',
},
headers: {
'Blade-Auth': `bearer ${getToken()}`,
},
headers: getUploadHeaders(),
tip: '请上传 .xls,.xlsx 标准格式文件',
action: '/blade-system/cargo-type/import-cargo-type',
},

View File

@@ -1,5 +1,5 @@
<template>
<basic-container>
<basic-container class="fee-item-page">
<avue-crud
:option="option"
:table-loading="loading"
@@ -14,20 +14,20 @@
@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
type="danger"
icon="el-icon-delete"
plain
v-if="permission.fee_item_delete"
@click="handleDelete"
>批量删除
<el-button type="primary" plain v-if="permission.fee_item_import" @click="handleImport">
<el-icon class="el-icon--left"><Upload /></el-icon>批量导入
</el-button>
<el-button type="primary" plain v-if="permission.fee_item_template" @click="handleTemplate">
<el-icon class="el-icon--left"><Download /></el-icon>下载模板
</el-button>
<el-button type="primary" plain v-if="permission.fee_item_export" @click="handleExport">
<el-icon class="el-icon--left"><Download /></el-icon>批量导出
</el-button>
</template>
<template #status="{ row }">
@@ -35,6 +35,35 @@
{{ row.status === 1 ? '启用' : '停用' }}
</el-tag>
</template>
<template #feeCategory-form>
<el-select
v-model="form.feeCategory"
class="fee-item-form-control"
clearable
filterable
placeholder="请选择费用类型"
@change="handleFeeCategoryChange"
>
<el-option
v-for="item in feeCategoryOptions"
:key="item.id || item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</template>
<template #englishName-form>
<el-input
v-model="form.englishName"
:maxlength="feeItemCodeMaxlength"
class="fee-item-form-control"
clearable
placeholder="请输入费用项代码"
@change="handleFeeItemCodeChange"
>
<template #prepend>{{ feeCategoryPrefix || '费用类型' }}</template>
</el-input>
</template>
<template #menu="{ row, index }">
<el-button
type="primary"
@@ -44,41 +73,60 @@
>
编辑
</el-button>
<el-button
type="primary"
text
v-if="permission.fee_item_status"
@click="handleStatus(row)"
>
<el-button type="primary" text v-if="permission.fee_item_status" @click="handleStatus(row)">
{{ row.status === 1 ? '停用' : '启用' }}
</el-button>
</template>
</avue-crud>
<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">
点击下载<i class="el-icon-download el-icon--right"></i>
</el-button>
</template>
</avue-form>
</el-dialog>
</basic-container>
</template>
<script>
import { getList, getDetail, submit, remove, changeStatus } from '@/api/base/fee-item';
import { exportBlob } from '@/api/common';
import { getDictionary } from '@/api/system/dictbiz';
import { getDeptTree } from '@/api/system/dept';
import { downloadXls } from '@/utils/util';
import { openImportDialog } from '@/utils/import-excel';
import { getToken } from '@/utils/auth';
import { getUploadHeaders } from '@/utils/upload';
import { Upload, Download } from '@element-plus/icons-vue';
import { mapGetters } from 'vuex';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
export default {
components: { Upload, Download },
data() {
return {
form: {},
query: {},
loading: true,
data: [],
excelBox: false,
excelForm: {},
feeCategoryOptions: [],
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
selectionList: [],
option: {
height: 'auto',
calcHeight: 32,
dialogWidth: 680,
dialogWidth: 980,
labelPosition: 'right',
labelWidth: 'auto',
tip: false,
searchShow: true,
searchMenuSpan: 24,
@@ -88,10 +136,11 @@ export default {
border: true,
index: true,
indexLabel: '序号',
indexWidth: 70,
viewBtn: false,
delBtn: false,
editBtn: false,
selection: true,
selection: false,
dialogClickModal: false,
menuWidth: 160,
column: [
@@ -100,8 +149,11 @@ export default {
prop: 'feeCategory',
type: 'select',
search: true,
searchOrder: 3,
filterable: true,
dicUrl: '/blade-system/dict/dictionary?code=fee_category',
formslot: true,
span: 12,
dicData: [],
props: {
label: 'dictValue',
value: 'dictKey',
@@ -109,35 +161,56 @@ export default {
minWidth: 120,
rules: [{ required: true, message: '请选择费用类型', trigger: 'change' }],
},
{
label: '费用项代码',
prop: 'englishName',
formslot: true,
span: 12,
minWidth: 160,
maxlength: 100,
rules: [{ required: true, message: '请输入费用项代码', trigger: 'blur' }],
},
{
label: '费用项',
prop: 'name',
minWidth: 140,
search: true,
searchOrder: 4,
span: 12,
maxlength: 50,
rules: [{ required: true, message: '请输入费用项', trigger: 'blur' }],
},
{
label: '费用项代码',
prop: 'englishName',
label: '组织',
prop: 'createDeptName',
minWidth: 160,
search: true,
maxlength: 100,
},
{
label: '状态',
prop: 'status',
type: 'select',
search: true,
slot: true,
dataType: 'number',
dicData: [
{ label: '启用', value: 1 },
{ label: '停用', value: 2 },
],
addDisplay: false,
editDisplay: false,
value: 1,
viewDisplay: false,
},
{
label: '组织',
prop: 'createDept',
type: 'select',
search: true,
searchOrder: 1,
hide: true,
display: false,
filterable: true,
dicData: [],
props: {
label: 'label',
value: 'value',
},
},
{
label: '更新人',
prop: 'updateUserName',
minWidth: 120,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
display: false,
},
{
label: '更新时间',
@@ -161,32 +234,135 @@ export default {
display: false,
minWidth: 160,
},
{
label: '状态',
prop: 'status',
type: 'select',
search: true,
searchOrder: 2,
slot: true,
dataType: 'number',
dicData: [
{ label: '启用', value: 1 },
{ label: '停用', value: 2 },
],
addDisplay: false,
editDisplay: false,
value: 1,
minWidth: 100,
},
],
},
excelOption: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: '模板上传',
prop: 'excelFile',
type: 'upload',
drag: true,
loadText: '模板上传中,请稍等',
span: 24,
propsHttp: {
res: 'data',
},
headers: getUploadHeaders(),
tip: '请上传 .xls,.xlsx 标准格式文件',
action: '/blade-system/fee-item/import-fee-item',
},
{
label: '模板下载',
prop: 'excelTemplate',
formslot: true,
span: 24,
},
],
},
};
},
created() {
this.initFeeCategoryOptions();
this.initDeptTree();
},
computed: {
...mapGetters(['permission']),
...mapGetters(['permission', 'userInfo']),
feeCategoryPrefix() {
return this.getFeeCategoryPrefix(this.form.feeCategory);
},
feeItemCodeMaxlength() {
return Math.max(1, 100 - this.feeCategoryPrefix.length);
},
permissionList() {
return {
addBtn: this.validData(this.permission.fee_item_add, false),
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
},
},
methods: {
initFeeCategoryOptions() {
getDictionary({ code: 'fee_category' }).then(res => {
this.feeCategoryOptions = res.data.data || [];
const column = this.findColumn(this.option.column, 'feeCategory');
column.dicData = this.feeCategoryOptions;
});
},
initDeptTree() {
getDeptTree(this.userInfo.tenantId).then(res => {
const column = this.findColumn(this.option.column, 'createDept');
column.dicData = this.flattenDept(res.data.data || []);
});
},
flattenDept(tree, level = 0) {
const result = [];
tree.forEach(item => {
result.push({
label: `${' '.repeat(level)}${item.title || item.deptName || item.name}`,
value: item.id,
});
if (item.children && item.children.length) {
result.push(...this.flattenDept(item.children, level + 1));
}
});
return result;
},
getFeeCategoryPrefix(value) {
const feeCategory = String(value || '').trim();
const option = this.feeCategoryOptions.find(
item => String(item.dictKey || '') === feeCategory
);
return String((option && option.dictKey) || feeCategory);
},
getFeeItemCodeSuffix(code, feeCategory) {
const value = String(code || '').trim();
const prefix = this.getFeeCategoryPrefix(feeCategory);
if (prefix && value.startsWith(prefix)) {
return value.slice(prefix.length);
}
return value;
},
handleFeeCategoryChange(value) {
this.form.feeCategory = value;
this.form.englishName = this.getFeeItemCodeSuffix(this.form.englishName, value);
},
handleFeeItemCodeChange(value) {
this.form.englishName = this.getFeeItemCodeSuffix(value, this.form.feeCategory);
},
normalizeRow(row) {
row.feeCategory = String(row.feeCategory || '').trim();
row.name = String(row.name || '').trim();
row.englishName = String(row.englishName || '').trim();
if (!row.status) row.status = 1;
return row;
const values = { ...row };
const prefix = this.getFeeCategoryPrefix(values.feeCategory);
const code = this.getFeeItemCodeSuffix(values.englishName, values.feeCategory);
values.feeCategory = String(values.feeCategory || '').trim();
values.name = String(values.name || '').trim();
values.englishName = prefix ? `${prefix}${code}` : code;
if (!values.status) values.status = 1;
return values;
},
normalizeFormForEdit(row) {
const values = { ...row };
values.feeCategory = String(values.feeCategory || '').trim();
values.englishName = this.getFeeItemCodeSuffix(values.englishName, values.feeCategory);
return values;
},
rowSave(row, done, loading) {
submit(this.normalizeRow(row)).then(
@@ -226,23 +402,6 @@ export default {
this.$message({ type: 'success', message: '操作成功!' });
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => remove(this.ids))
.then(() => {
this.onLoad(this.page);
this.$message({ type: 'success', message: '操作成功!' });
this.$refs.crud.toggleSelection();
});
},
handleStatus(row) {
const nextStatus = row.status === 1 ? 2 : 1;
const actionName = nextStatus === 1 ? '启用' : '停用';
@@ -260,12 +419,13 @@ export default {
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
this.form = this.normalizeFormForEdit(res.data.data || {});
done();
});
return;
}
this.form.status = 1;
this.form.englishName = '';
done();
},
searchReset() {
@@ -278,13 +438,6 @@ export default {
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
@@ -294,6 +447,42 @@ export default {
refreshChange() {
this.onLoad(this.page, this.query);
},
handleImport() {
openImportDialog(this, '费用项');
},
buildExportParams() {
return {
...this.query,
[this.website.tokenHeader]: getToken(),
};
},
handleExport() {
this.$confirm('是否导出费用项数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
NProgress.start();
exportBlob('/blade-system/fee-item/export-fee-item', this.buildExportParams(), {
feedback: true,
})
.then(res => {
downloadXls(res.data, `费用项${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
})
.finally(() => {
NProgress.done();
});
});
},
handleTemplate() {
exportBlob(
`/blade-system/fee-item/export-template?${this.website.tokenHeader}=${getToken()}`,
undefined,
{ feedback: true }
).then(res => {
downloadXls(res.data, '费用项模板.xlsx');
});
},
onLoad(page, params = {}) {
this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
@@ -301,9 +490,25 @@ export default {
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
},
},
};
</script>
<style scoped>
.fee-item-page :deep(.avue-crud__dialog .avue-form__row),
.fee-item-page :deep(.avue-crud__dialog .el-row) {
margin-left: -36px;
margin-right: -36px;
}
.fee-item-page :deep(.avue-crud__dialog .el-col) {
padding-left: 36px;
padding-right: 36px;
}
.fee-item-form-control {
width: 100%;
}
</style>