1、基础数据修复bug
2、客商模块修复bug
This commit is contained in:
@@ -24,10 +24,9 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
plain
|
||||
v-if="hasPermission('common_cargo_add')"
|
||||
@click="$refs.crud.rowAdd()"
|
||||
>新增
|
||||
>新建常用货物
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -113,7 +112,7 @@
|
||||
clearable
|
||||
maxlength="20"
|
||||
show-word-limit
|
||||
placeholder="请输入货物编号"
|
||||
placeholder="请输入"
|
||||
:disabled="dialogReadonly || dialogType === 'edit'"
|
||||
@input="handleCargoCodeInput"
|
||||
/>
|
||||
@@ -144,6 +143,10 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #packageBrand="{ row }">
|
||||
{{ [row.packageType, row.brand].filter(Boolean).join(' / ') || '-' }}
|
||||
</template>
|
||||
|
||||
<template #menu="{ row, index }">
|
||||
<el-link
|
||||
type="primary"
|
||||
@@ -192,6 +195,7 @@
|
||||
import * as api from '@/api/business/common-cargo';
|
||||
import { getList as getCargoTypeList } from '@/api/base/cargo-type';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { config, excelOption, option } from '@/option/business/common-cargo';
|
||||
import { priceUnitOptions } from '@/option/business/common';
|
||||
import { getToken } from '@/utils/auth';
|
||||
@@ -221,6 +225,7 @@ export default {
|
||||
secondCargoTypeLoading: false,
|
||||
firstCargoTypeOptions: [],
|
||||
secondCargoTypeOptions: [],
|
||||
deptOptions: [],
|
||||
page: {
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
@@ -247,6 +252,9 @@ export default {
|
||||
return this.selectionList.map(item => item.id).join(',');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.initDeptTree();
|
||||
},
|
||||
methods: {
|
||||
hasPermission(code) {
|
||||
return this.isAdmin || this.validData(this.permission && this.permission[code], false);
|
||||
@@ -256,6 +264,28 @@ export default {
|
||||
if (Array.isArray(data)) return data;
|
||||
return (data && data.records) || [];
|
||||
},
|
||||
initDeptTree() {
|
||||
getDeptTree(this.userInfo.tenantId).then(res => {
|
||||
this.deptOptions = this.flattenDept(res.data.data || []);
|
||||
const deptColumn = this.findColumn(this.option.column, 'searchDeptId');
|
||||
if (deptColumn) {
|
||||
deptColumn.dicData = this.deptOptions;
|
||||
}
|
||||
});
|
||||
},
|
||||
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;
|
||||
},
|
||||
normalizeCargoTypeOptions(list = []) {
|
||||
return list
|
||||
.map(item => ({
|
||||
@@ -319,11 +349,12 @@ export default {
|
||||
const second = this.secondCargoTypeOptions.find(item => item.cargoCode === value);
|
||||
this.form.secondCargoTypeName = second ? second.cargoName : '';
|
||||
this.form.secondCargoTypeCode = second ? second.cargoCode : '';
|
||||
this.form.cargoCode = second ? String(second.cargoCode).slice(0, 4) : '';
|
||||
this.syncCargoCodePrefix();
|
||||
},
|
||||
getCargoCodePrefix() {
|
||||
return this.form.secondCargoTypeCode && this.form.firstCargoTypeCode
|
||||
? this.form.firstCargoTypeCode
|
||||
return this.form.secondCargoTypeCode
|
||||
? String(this.form.secondCargoTypeCode).slice(0, 4)
|
||||
: '';
|
||||
},
|
||||
syncCargoCodePrefix() {
|
||||
@@ -383,13 +414,13 @@ export default {
|
||||
return false;
|
||||
}
|
||||
const cargoCode = String(row.cargoCode || '');
|
||||
const prefix = row.firstCargoTypeCode;
|
||||
const prefix = String(row.secondCargoTypeCode || '').slice(0, 4);
|
||||
if (!cargoCode || cargoCode === prefix) {
|
||||
this.$message.warning('请输入货物编号');
|
||||
return false;
|
||||
}
|
||||
if (!cargoCode.startsWith(prefix)) {
|
||||
this.$message.warning('货物编号需拼接一级货物类型编号在前面');
|
||||
this.$message.warning('货物编号需拼接二级货物类型编号在前面');
|
||||
return false;
|
||||
}
|
||||
if (cargoCode.length > 20) {
|
||||
|
||||
Reference in New Issue
Block a user