Compare commits
1 Commits
zzl
..
0a2e0f1784
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a2e0f1784 |
@@ -312,31 +312,50 @@ export default {
|
||||
this.form.siteCodeDisplay = source.siteCode;
|
||||
this.form.detailAddress = source.detailAddress;
|
||||
this.form.regionName = source.regionName;
|
||||
this.form.regionCode = source.regionCode;
|
||||
this.form.longitude = source.longitude;
|
||||
this.form.latitude = source.latitude;
|
||||
},
|
||||
handleAddressTypeChange(value, reset = true) {
|
||||
const sourceColumn = this.findColumn(this.option.column, 'sourceId');
|
||||
sourceColumn.rules = value === '常规地址' ? [] : [{ required: true, message: '请选择来源主数据', trigger: 'change' }];
|
||||
if (sourceColumn) {
|
||||
sourceColumn.rules =
|
||||
value === '常规地址' ? [] : [{ required: true, message: '请选择来源主数据', trigger: 'change' }];
|
||||
}
|
||||
const sourceDisabled = value === '常规地址';
|
||||
this.findColumn(this.option.column, 'longitude').disabled = !sourceDisabled;
|
||||
this.findColumn(this.option.column, 'latitude').disabled = !sourceDisabled;
|
||||
const longitudeColumn = this.findColumn(this.option.column, 'longitude');
|
||||
const latitudeColumn = this.findColumn(this.option.column, 'latitude');
|
||||
if (longitudeColumn) longitudeColumn.disabled = !sourceDisabled;
|
||||
if (latitudeColumn) latitudeColumn.disabled = !sourceDisabled;
|
||||
if (value === '常规地址') {
|
||||
if (reset) {
|
||||
this.form.sourceId = undefined;
|
||||
this.form.siteCode = '/';
|
||||
this.form.siteCodeDisplay = '/';
|
||||
this.sourceOptions = [];
|
||||
this.resetTypeRelatedFields();
|
||||
}
|
||||
this.form.siteCode = '/';
|
||||
this.form.siteCodeDisplay = '/';
|
||||
this.sourceOptions = [];
|
||||
return;
|
||||
}
|
||||
if (reset) {
|
||||
this.form.sourceId = undefined;
|
||||
this.form.siteCode = '';
|
||||
this.form.siteCodeDisplay = '';
|
||||
this.resetTypeRelatedFields();
|
||||
}
|
||||
this.loadSourceOptions();
|
||||
},
|
||||
resetTypeRelatedFields() {
|
||||
this.form.addressName = '';
|
||||
this.form.sourceId = undefined;
|
||||
this.form.siteCode = '';
|
||||
this.form.siteCodeDisplay = '';
|
||||
this.form.detailAddress = '';
|
||||
this.form.regionName = '';
|
||||
this.form.regionCode = '';
|
||||
this.form.longitude = undefined;
|
||||
this.form.latitude = undefined;
|
||||
this.mapBox = false;
|
||||
this.mapKeyword = '';
|
||||
this.mapStatus = '可搜索地址或点击地图选点';
|
||||
this.mapSelected = {};
|
||||
},
|
||||
normalizeRow(row) {
|
||||
const submitRow = {
|
||||
...row,
|
||||
@@ -344,6 +363,7 @@ export default {
|
||||
addressType: String(row.addressType || '').trim(),
|
||||
detailAddress: String(row.detailAddress || '').trim(),
|
||||
regionName: String(row.regionName || '').trim(),
|
||||
regionCode: String(row.regionCode || '').trim(),
|
||||
contactName: String(row.contactName || '').trim(),
|
||||
contactPhone: String(row.contactPhone || '').trim(),
|
||||
remark: String(row.remark || '').trim(),
|
||||
@@ -359,6 +379,10 @@ export default {
|
||||
this.$message.warning('请选择类型');
|
||||
return false;
|
||||
}
|
||||
if (row.addressType !== '常规地址' && !row.sourceId) {
|
||||
this.$message.warning('请选择来源主数据');
|
||||
return false;
|
||||
}
|
||||
if (!row.addressName) {
|
||||
this.$message.warning('请输入地址名称');
|
||||
return false;
|
||||
@@ -367,8 +391,16 @@ export default {
|
||||
this.$message.warning('请输入详细地址');
|
||||
return false;
|
||||
}
|
||||
if (row.addressType !== '常规地址' && !row.sourceId) {
|
||||
this.$message.warning('请选择来源主数据');
|
||||
if (!row.regionName) {
|
||||
this.$message.warning('请输入行政区划');
|
||||
return false;
|
||||
}
|
||||
if (row.longitude === undefined || row.longitude === null || row.longitude === '') {
|
||||
this.$message.warning('请输入经度');
|
||||
return false;
|
||||
}
|
||||
if (row.latitude === undefined || row.latitude === null || row.latitude === '') {
|
||||
this.$message.warning('请输入纬度');
|
||||
return false;
|
||||
}
|
||||
if (row.remark && row.remark.length > 200) {
|
||||
@@ -479,9 +511,8 @@ export default {
|
||||
const addressTypeColumn = this.findColumn(this.option.column, 'addressType');
|
||||
addressTypeColumn.change = ({ value }) => this.handleAddressTypeChange(value);
|
||||
if (type === 'add') {
|
||||
this.form.addressType = this.form.addressType || '常规地址';
|
||||
this.form.siteCode = '/';
|
||||
this.form.siteCodeDisplay = '/';
|
||||
this.resetTypeRelatedFields();
|
||||
this.form.addressType = '常规地址';
|
||||
this.handleAddressTypeChange(this.form.addressType);
|
||||
done();
|
||||
return;
|
||||
@@ -498,10 +529,13 @@ export default {
|
||||
siteCode: this.form.siteCode,
|
||||
detailAddress: this.form.detailAddress,
|
||||
regionName: this.form.regionName,
|
||||
regionCode: this.form.regionCode,
|
||||
longitude: this.form.longitude,
|
||||
latitude: this.form.latitude,
|
||||
},
|
||||
];
|
||||
} else {
|
||||
this.sourceOptions = [];
|
||||
}
|
||||
done();
|
||||
});
|
||||
@@ -583,6 +617,7 @@ export default {
|
||||
lat: this.form.latitude,
|
||||
address: this.form.detailAddress,
|
||||
regionName: this.form.regionName,
|
||||
regionCode: this.form.regionCode,
|
||||
});
|
||||
this.mapStatus = this.mapSelected.longitude ? '已加载当前经纬度,可重新选点' : '可搜索地址或点击地图选点';
|
||||
this.mapBox = true;
|
||||
@@ -813,3 +848,6 @@ export default {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user