diff --git a/Web/src/assets/style/main.less b/Web/src/assets/style/main.less
index 8d37c66..ca5c019 100644
--- a/Web/src/assets/style/main.less
+++ b/Web/src/assets/style/main.less
@@ -194,6 +194,20 @@
}
}
}
+ .yo-layout-tab-subtitle {
+ line-height: 1;
+
+ display: inline-block;
+ overflow: hidden;
+
+ max-width: 150px;
+
+ transform: translateY(1px);
+ white-space: nowrap;
+ text-overflow: ellipsis;
+
+ opacity: .75;
+ }
+.ant-tabs-tab {
margin-left: 0;
}
diff --git a/Web/src/common/api/requests/business/houseCode.js b/Web/src/common/api/requests/business/houseCode.js
index cc586a6..4322594 100644
--- a/Web/src/common/api/requests/business/houseCode.js
+++ b/Web/src/common/api/requests/business/houseCode.js
@@ -1,5 +1,6 @@
export default {
houseCodeAdd: ['/houseCode/add', 'post'],
+ houseCodeEdit: ['/houseCode/edit', 'post'],
houseCodePage: ['/houseCode/page', 'post'],
houseCodeNo: '/houseCode/getNextNoByCode',
}
\ No newline at end of file
diff --git a/Web/src/pages/business/house/houseCode/form/index.vue b/Web/src/pages/business/house/houseCode/form/index.vue
index 797531e..9f23fa5 100644
--- a/Web/src/pages/business/house/houseCode/form/index.vue
+++ b/Web/src/pages/business/house/houseCode/form/index.vue
@@ -96,25 +96,47 @@ export default {
* 对表单提交进行处理
*/
this.saving = true;
- this.$api
- .houseCodeAdd(formData)
- .then(({ success }) => {
- if (success) {
- this.$message.success('保存成功');
- this.$confirm({
- content: '已添加成功,是否继续添加?',
- onOk: () => {
- this.$refs.forms[0].onProjectChange();
- },
- onCancel: () => {
- this.closeContentWindow();
- },
- });
- }
- })
- .finally(() => {
- this.saving = false;
- });
+ if (!this.param.record) {
+ this.$api
+ .houseCodeAdd(formData)
+ .then(({ success }) => {
+ if (success) {
+ this.$message.success('保存成功');
+ this.$confirm({
+ content: '已添加成功,是否继续添加?',
+ onOk: () => {
+ this.$refs.forms[0].onProjectChange();
+ },
+ onCancel: () => {
+ this.closeContentWindow();
+ },
+ });
+ }
+ })
+ .finally(() => {
+ this.saving = false;
+ });
+ } else {
+ this.$api
+ .houseCodeEdit(formData)
+ .then(({ success }) => {
+ if (success) {
+ this.$message.success('保存成功');
+ this.$confirm({
+ content: '编辑成功,是否继续保留当前页?',
+ onOk: () => {
+ this.$refs.forms[0].onProjectChange();
+ },
+ onCancel: () => {
+ this.closeContentWindow();
+ },
+ });
+ }
+ })
+ .finally(() => {
+ this.saving = false;
+ });
+ }
},
},
};
diff --git a/Web/src/pages/business/house/houseCode/form/part.vue b/Web/src/pages/business/house/houseCode/form/part.vue
index 665ae22..7d2da8b 100644
--- a/Web/src/pages/business/house/houseCode/form/part.vue
+++ b/Web/src/pages/business/house/houseCode/form/part.vue
@@ -251,10 +251,6 @@ export default {
this.onFillData();
},
- mounted() {
- this.onMapInit();
- },
-
beforeDestroy() {
if (this.map) this.map.destroy();
},
@@ -289,6 +285,14 @@ export default {
if (this.form.id) {
this.onAreaCodeChange(true);
}
+
+ this.$nextTick(async () => {
+ await this.onMapInit();
+ if (this.form.lng && this.form.lat) {
+ this.setMarker([this.form.lng, this.form.lat]);
+ this.map.setCenter([this.form.lng, this.form.lat]);
+ }
+ });
},
/**
@@ -362,95 +366,102 @@ export default {
},
onMapInit() {
- const city = '宁波市';
+ return new Promise((resolve) => {
+ const city = '宁波市';
- const district = new AMap.DistrictSearch({
- subdistrict: 0,
- extensions: 'all',
- level: 'city',
- });
-
- district.search(city, (status, result) => {
- const bounds = result.districtList[0].boundaries;
- const mask = [];
- for (let i = 0; i < bounds.length; i += 1) {
- mask.push([bounds[i]]);
- }
-
- // 挂载map到this,但不监听
- this.map = new AMap.Map(this.$refs.map, {
- city,
- viewMode: '3D',
- mask,
- zoom: 12,
+ const district = new AMap.DistrictSearch({
+ subdistrict: 0,
+ extensions: 'all',
+ level: 'city',
});
- const geocoder = new AMap.Geocoder({ city });
-
- let marker;
- const setMarker = (position) => {
- if (marker) {
- marker.setPosition(position);
- } else {
- marker = new AMap.Marker({
- map: this.map,
- icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
- position,
- offset: new AMap.Pixel(-13, -30),
- });
+ district.search(city, (status, result) => {
+ const bounds = result.districtList[0].boundaries;
+ const mask = [];
+ for (let i = 0; i < bounds.length; i += 1) {
+ mask.push([bounds[i]]);
}
- geocoder.getAddress(position, (status, result) => {
- if (status === 'complete' && result.regeocode) {
- this.onSetPosition(result.regeocode.formattedAddress, position);
- } else {
- console.error('根据经纬度查询地址失败');
- }
+ // 挂载map到this,但不监听
+ this.map = new AMap.Map(this.$refs.map, {
+ city,
+ viewMode: '3D',
+ mask,
+ zoom: 12,
});
- };
- this.map.on('click', (e) => {
- setMarker(e.lnglat);
- });
+ const geocoder = new AMap.Geocoder({ city });
- const auto = new AMap.AutoComplete({
- input: this.$refs['map-search'].$el.querySelector('input'),
- city,
- citylimit: true,
- });
+ this.map.on('click', (e) => {
+ this.setMarker(e.lnglat, geocoder);
+ });
- const placeSearch = new AMap.PlaceSearch({
- city,
- citylimit: true,
- pageSize: 1,
- });
+ this.map.on('complete', () => {
+ resolve();
+ });
- auto.on('select', ({ poi: { name: keywords, adcode } }) => {
- this.map.clearMap();
- marker = null;
- placeSearch.search(keywords, (status, result) => {
- const {
- poiList: { pois },
- } = result;
- pois.forEach((p) => {
- setMarker(p.location);
+ const auto = new AMap.AutoComplete({
+ input: this.$refs['map-search'].$el.querySelector('input'),
+ city,
+ citylimit: true,
+ });
+
+ const placeSearch = new AMap.PlaceSearch({
+ city,
+ citylimit: true,
+ pageSize: 1,
+ });
+
+ auto.on('select', ({ poi: { name: keywords, adcode } }) => {
+ this.map.clearMap();
+ marker = null;
+ placeSearch.search(keywords, (status, result) => {
+ const {
+ poiList: { pois },
+ } = result;
+ pois.forEach((p) => {
+ this.setMarker(p.location, geocoder);
+ });
+
+ this.map.setFitView();
});
-
- this.map.setFitView();
});
+
+ for (let i = 0; i < bounds.length; i += 1) {
+ new AMap.Polyline({
+ path: bounds[i],
+ strokeColor: '#ccc',
+ strokeWeight: 4,
+ map: this.map,
+ });
+ }
});
-
- for (let i = 0; i < bounds.length; i += 1) {
- new AMap.Polyline({
- path: bounds[i],
- strokeColor: '#ccc',
- strokeWeight: 4,
- map: this.map,
- });
- }
});
},
+ setMarker(position, geocoder) {
+ if (this.marker) {
+ this.marker.setPosition(position);
+ } else {
+ this.marker = new AMap.Marker({
+ map: this.map,
+ icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
+ position,
+ offset: new AMap.Pixel(-13, -30),
+ });
+ }
+
+ if (geocoder) {
+ geocoder.getAddress(position, (status, result) => {
+ if (status === 'complete' && result.regeocode) {
+ this.onSetPosition(result.regeocode.formattedAddress, position);
+ } else {
+ console.error('根据经纬度查询地址失败');
+ }
+ });
+ }
+ },
+
onSetPosition(address, { lng, lat }) {
this.$set(this.form, 'address', address);
this.$set(this.form, 'lng', lng);
diff --git a/Web/src/pages/business/house/houseCode/index.vue b/Web/src/pages/business/house/houseCode/index.vue
index 122ca14..1e884ea 100644
--- a/Web/src/pages/business/house/houseCode/index.vue
+++ b/Web/src/pages/business/house/houseCode/index.vue
@@ -64,7 +64,7 @@