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