| | |
| | | <template> |
| | | <el-dialog |
| | | title="选择模板" |
| | | title="选择飞行模板" |
| | | :visible.sync="dialogVisible" |
| | | @close="cancel" |
| | | width="20%"> |
| | | <el-form ref="form" :model="form" label-width="80px" :rules="rules"> |
| | | <el-form-item label="模板"> |
| | | <el-select v-model="form.modelObj" placeholder="请选择模板"> |
| | | <el-form-item label="飞行模板"> |
| | | <el-select v-model="form.modelObj" placeholder="请选择飞行模板" @change="handleChange"> |
| | | <el-option |
| | | v-for="item in templateArr" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item"> |
| | | :label="item.templateName" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </el-form> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { flyDataInfo} from "@/api/system/template" |
| | | export default { |
| | | name:'chooseModelDialog', |
| | | components: { |
| | |
| | | }, |
| | | ], |
| | | selectArr:[], |
| | | form:{}, |
| | | templateArr:[ |
| | | { |
| | | id:111, |
| | | name:'模板1' |
| | | }, |
| | | { |
| | | id:222, |
| | | name:'模板2' |
| | | }, |
| | | { |
| | | id:333, |
| | | name:'模板3' |
| | | } |
| | | ], |
| | | form:{ |
| | | }, |
| | | templateArr:[], |
| | | rules:{ |
| | | modelObj: [ |
| | | { required: true, message: '请选择模板', trigger: 'change' } |
| | |
| | | mounted() { |
| | | console.log(this.deviceId) |
| | | if(this.deviceId){ |
| | | flyDataInfo(this.deviceId).then(res=>{ |
| | | console.log(res) |
| | | if(res.code == 200 ) { |
| | | this.templateArr = res.rows |
| | | } |
| | | }) |
| | | //点击模板查询设备下的关联模型的所有模板 |
| | | } |
| | | }, |
| | |
| | | cancel(){ |
| | | this.$emit('cancelModel') |
| | | }, |
| | | handleChange(value){ |
| | | this.form.deviceId = this.deviceId |
| | | this.form.modelObj =this.templateArr.find(item => item.id === value) |
| | | }, |
| | | submit(){ |
| | | // this.selectArr |
| | | //反显参数传递option对象 |
| | | this.form.deviceId = this.deviceId |
| | | console.log(this.form) |
| | | // //反显参数传递option对象 |
| | | // this.form.deviceId = this.deviceId |
| | | // console.log(this.form) |
| | | this.$emit('receiveModel',this.form) |
| | | this.$emit('cancelModel') |
| | | }, |