Commit 61d88aa9 authored by kaitly205422@163.com's avatar kaitly205422@163.com

添加验证楼层名称重复

parent 65a42085
......@@ -45,6 +45,10 @@ export default {
props: {
buildingId: {
type: String,
},
floorList: {
type: Array,
default: () => []
}
},
destroyed() {
......@@ -62,12 +66,25 @@ export default {
this.$emit('close', data)
},
onSubmit(values) {
console.log(this.buildingId)
if (!this.buildingId) {
return;
}
this.form.buildingId = this.buildingId
this.form.name = this.form.name + ''
const name = this.form.name + ''
/* 检测类型当前楼层是否已存在 */
const typeObj = this.floorList.find(item => item.text === this.form.type);
if (typeObj && typeObj.children.find(item => item.text === name)) {
this.$toast.fail({
message: "楼层已存在",
duration: 2000
});
return;
}
if (!this.form.name.endsWith('')) {
this.form.name = name
}
postFun('/risk/plan/floor', this.form)
.then(res => {
this.$toast.clear();
......
......@@ -324,7 +324,7 @@
</div>
</van-popup>
<div v-if="isFloor">
<addFloor @close="closeFloor" :buildingId="form.buildingIds" />
<addFloor @close="closeFloor" :buildingId="form.buildingIds" :floorList="floorSource" />
</div>
<!-- 管控责任人 -->
<van-popup v-model="showTrouble" position="bottom">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment