|
|
@@ -1,7 +1,7 @@ |
|
|
|
<!-- |
|
|
|
* @Date: 2021-11-30 09:28:55 |
|
|
|
* @LastEditors: JinxuChen |
|
|
|
* @LastEditTime: 2021-11-30 09:29:14 |
|
|
|
* @LastEditors: Please set LastEditors |
|
|
|
* @LastEditTime: 2021-12-02 11:09:15 |
|
|
|
* @FilePath: \GpsCardAdmin\src\views\off-limits-manage\off-limits-main\off-limits-type\index.vue |
|
|
|
* @description: |
|
|
|
--> |
|
|
@@ -51,17 +51,31 @@ |
|
|
|
|
|
|
|
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
<el-dialog |
|
|
|
title="新增场景" |
|
|
|
:visible.sync="dialogVisible" |
|
|
|
width="50%" |
|
|
|
> |
|
|
|
<el-form :model="currentAddScenes" ref="currentAddScenes"> |
|
|
|
<el-form-item label="场景" |
|
|
|
prop="inputNew" |
|
|
|
:rules="[ |
|
|
|
{ required: true, message: '场景不能为空'} |
|
|
|
]" |
|
|
|
> |
|
|
|
<el-input v-model="currentAddScenes.inputNew" placeholder="请输入场景"></el-input> |
|
|
|
|
|
|
|
<el-input v-model="inputNew" placeholder="请输入场景"></el-input> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> |
|
|
|
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> |
|
|
|
</span> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
|
|
|
|
<el-button type="primary" @click="submitScenesForm('currentAddScenes')">提交</el-button> |
|
|
|
<el-button @click="resetForm('currentAddScenes')">重置</el-button> |
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
</el-form> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog |
|
|
@@ -80,18 +94,13 @@ |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<!-- <el-button type="primary" @click="()=>addType()">提交</el-button> --> |
|
|
|
|
|
|
|
<el-button type="primary" @click="submitForm('currentAddType')">提交</el-button> |
|
|
|
<el-button @click="resetForm('currentAddType')">重置</el-button> |
|
|
|
<el-button @click="dialogVisibleType = false">取 消</el-button> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<!-- <span slot="footer" class="dialog-footer"> --> |
|
|
|
<!-- <el-form-item> |
|
|
|
|
|
|
|
<el-button type="primary" @click="()=>addType()">确 定</el-button> |
|
|
|
</el-form-item> --> |
|
|
|
<!-- </span> --> |
|
|
|
|
|
|
|
|
|
|
|
</el-form> |
|
|
|
</el-dialog> |
|
|
@@ -152,6 +161,9 @@ export default { |
|
|
|
dialogVisibleM: false, |
|
|
|
currentData:{}, |
|
|
|
currentParentData:{}, |
|
|
|
currentAddScenes:{ |
|
|
|
inputNew:"", |
|
|
|
}, |
|
|
|
currentAddType:{ |
|
|
|
typeLabel:"" |
|
|
|
}, |
|
|
@@ -160,6 +172,18 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
submitScenesForm(formName) { |
|
|
|
this.$refs[formName].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
//alert('submit!'); |
|
|
|
this.addScenes(); |
|
|
|
|
|
|
|
} else { |
|
|
|
console.log('error submit!!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
submitForm(formName) { |
|
|
|
this.$refs[formName].validate((valid) => { |
|
|
|
if (valid) { |
|
|
@@ -192,6 +216,21 @@ export default { |
|
|
|
this.resetForm('currentAddType'); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
addScenes(){ |
|
|
|
this.dialogVisible=false; |
|
|
|
let no=this.data[this.data.length-1].no+1; |
|
|
|
let id=this.data[this.data.length-1].id+1; |
|
|
|
|
|
|
|
this.data.push( { |
|
|
|
id: id, |
|
|
|
no:no, |
|
|
|
label: this.currentAddScenes.inputNew, |
|
|
|
children: [] |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
addType(){ |
|
|
|
|
|
|
@@ -202,9 +241,17 @@ export default { |
|
|
|
|
|
|
|
if(i.id==this.currentParentData.id) |
|
|
|
{ |
|
|
|
//console.log(i.children[i.children.length-1]); |
|
|
|
let no=i.children[i.children.length-1].no+1; |
|
|
|
let id=i.children[i.children.length-1].id+1; |
|
|
|
|
|
|
|
let no,id; |
|
|
|
if(i.children && i.children.length>0){ |
|
|
|
no=i.children[i.children.length-1].no+1; |
|
|
|
id=i.children[i.children.length-1].id+1; |
|
|
|
} |
|
|
|
else{ |
|
|
|
no=i.no+'001'; |
|
|
|
id=i.id+'001'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
i.children.push({ |
|
|
|
id:id, |
|
|
|