处理新建区域的时候出现的问题
This commit is contained in:
@@ -15,17 +15,16 @@
|
|||||||
<i class="mdi mdi-arrow-collapse-all"></i> 全部收起
|
<i class="mdi mdi-arrow-collapse-all"></i> 全部收起
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<nav v-if="form && selectedType==null">
|
<nav v-if="createRegionFlag">
|
||||||
<button class="btn btn-primary me-2" @click="saveRegion" type="button">
|
<button class="btn btn-primary me-2" @click="saveRegion" type="button">
|
||||||
<i class="bi bi-save me-1"></i> 儲存區域資料
|
<i class="bi bi-save me-1"></i> 儲存區域資料
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<nav class="btn-group mb-2 ps-3 pe-3" role="group" v-if="form && selectedType=='region'">
|
<nav class="btn-group mb-2 ps-3 pe-3" role="group" v-if="form && selectedType=='region' && !createRegionFlag">
|
||||||
|
|
||||||
<button class="btn btn-primary me-2" @click="saveRegion" type="button">
|
|
||||||
<i class="bi bi-save me-1"></i> 儲存區域資料
|
|
||||||
</button>
|
|
||||||
<div v-if="selectedRegionId">
|
<div v-if="selectedRegionId">
|
||||||
|
<button class="btn btn-primary me-2" @click="saveRegion" type="button">
|
||||||
|
<i class="bi bi-save me-1"></i> 儲存區域資料1
|
||||||
|
</button>
|
||||||
<button class="btn btn-success me-2" @click="createSubRegion" type="button" >
|
<button class="btn btn-success me-2" @click="createSubRegion" type="button" >
|
||||||
<i class="mdi mdi-arrow-down-right"></i> 新增下層區域
|
<i class="mdi mdi-arrow-down-right"></i> 新增下層區域
|
||||||
</button>
|
</button>
|
||||||
@@ -517,6 +516,7 @@
|
|||||||
regionTypes: [],
|
regionTypes: [],
|
||||||
currentSelectRegion: null,
|
currentSelectRegion: null,
|
||||||
currentSelectRoom: null,
|
currentSelectRoom: null,
|
||||||
|
createRegionFlag: false,
|
||||||
form: {
|
form: {
|
||||||
uuid: null,
|
uuid: null,
|
||||||
name: '',
|
name: '',
|
||||||
@@ -636,6 +636,8 @@
|
|||||||
this.disabledParentOptions = [];
|
this.disabledParentOptions = [];
|
||||||
this.currentSelectRegion = null;
|
this.currentSelectRegion = null;
|
||||||
this.currentSelectRoom = null;
|
this.currentSelectRoom = null;
|
||||||
|
this.createRegionFlag = true;
|
||||||
|
this.selectedType = null;
|
||||||
},
|
},
|
||||||
createSubRegion() {
|
createSubRegion() {
|
||||||
if (!this.selectedRegionId) return;
|
if (!this.selectedRegionId) return;
|
||||||
@@ -658,17 +660,18 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = this.form.uuid
|
const url = this.form.uuid
|
||||||
? HTTP_HOST + '/api/region/update'
|
? HTTP_HOST + 'api/region/update'
|
||||||
: HTTP_HOST + '/api/region/create';
|
: HTTP_HOST + 'api/region/create';
|
||||||
|
|
||||||
axios.post(url, this.form)
|
axios.post(url, this.form)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
//alert('儲存成功');
|
//alert('儲存成功');
|
||||||
this.loadRegions();
|
this.loadRegions();
|
||||||
//this.newRegion();
|
//this.newRegion();
|
||||||
this.form.uuid = res.data.uuid;
|
this.form.uuid = res.data.id;
|
||||||
this.selectedRegionId = res.data.uuid;
|
this.selectedRegionId = res.data.id;
|
||||||
this.currentSelectRegion = JSON.parse(JSON.stringify(this.form));
|
this.currentSelectRegion = JSON.parse(JSON.stringify(this.form));
|
||||||
|
this.createRegionFlag = false;
|
||||||
this.$refs.messageModal.open({
|
this.$refs.messageModal.open({
|
||||||
title: "更新",
|
title: "更新",
|
||||||
message: "更新成功",
|
message: "更新成功",
|
||||||
@@ -1000,7 +1003,16 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
currentSelectRegion(newVal) {
|
||||||
|
if (newVal !== null) {
|
||||||
|
this.createRegionFlag = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
currentSelectRoom(newVal) {
|
||||||
|
if (newVal !== null) {
|
||||||
|
this.createRegionFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadRegions();
|
this.loadRegions();
|
||||||
|
|||||||
Reference in New Issue
Block a user