|
@@ -116,7 +116,17 @@
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
<el-input v-model="dialogForm.name" placeholder="请输入名称" maxLength="10" style="width:320px;"/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="标识" prop="code">
|
|
|
+ <el-form-item label="标识" prop="code" v-if="dialogAttrType">
|
|
|
+ <el-select v-model="dialogForm.code" clearable placeholder="请选择" style="width: 320px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in attrTypeOptions"
|
|
|
+ :key="dict.code"
|
|
|
+ :label="dict.name"
|
|
|
+ :value="dict.code"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="标识" prop="code" v-if="!dialogAttrType">
|
|
|
<el-input v-model="dialogForm.code" placeholder="请输入标识" maxLength="20" style="width:320px;"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="属性" prop="attrName">
|
|
@@ -209,7 +219,7 @@
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
import { iotAttributeList,iotAttributeAdd,iotNetworkInfo,
|
|
|
iotAttributeUpdate,iotAttributeDelete,iotAttributeDetail,
|
|
|
- iotAttributeMoveUp,iotAttributeMoveDown } from "@/api/iotDevice/index";
|
|
|
+ iotAttributeMoveUp,iotAttributeMoveDown,iotAttributeAttrType } from "@/api/iotDevice/index";
|
|
|
export default {
|
|
|
name: 'attributePage',
|
|
|
data(){
|
|
@@ -222,6 +232,10 @@
|
|
|
loading:false,
|
|
|
options:[{label:'启用',value:true},{label:'停用',value:false}],
|
|
|
networkOptions:[],
|
|
|
+ //子标识列表
|
|
|
+ attrTypeOptions:[],
|
|
|
+ //原始数据
|
|
|
+ attrTypeOptionsList:[],
|
|
|
queryParams:{
|
|
|
typeId:this.$parent.propsData.typeId,
|
|
|
page:1,
|
|
@@ -234,6 +248,8 @@
|
|
|
//弹层
|
|
|
dialogTitle:null,
|
|
|
dialogType:false,
|
|
|
+ //标识状态(列表或者输入)
|
|
|
+ dialogAttrType:true,
|
|
|
dialogForm:{
|
|
|
name:"",
|
|
|
code:"",
|
|
@@ -274,6 +290,7 @@
|
|
|
mounted(){
|
|
|
this.getList();
|
|
|
this.iotNetworkInfo();
|
|
|
+ this.iotAttributeAttrType();
|
|
|
},
|
|
|
methods:{
|
|
|
//获取网络组件列表
|
|
@@ -282,6 +299,11 @@
|
|
|
this.$set(this,'networkOptions',response.data);
|
|
|
});
|
|
|
},
|
|
|
+ iotAttributeAttrType(){
|
|
|
+ iotAttributeAttrType({typeKey:this.$parent.propsData.typeKey}).then(response => {
|
|
|
+ this.$set(this,'attrTypeOptionsList',response.data);
|
|
|
+ });
|
|
|
+ },
|
|
|
//属性
|
|
|
getList(){
|
|
|
let obj = JSON.parse(JSON.stringify(this.queryParams))
|
|
@@ -313,6 +335,11 @@
|
|
|
//弹层开启
|
|
|
dialogOpen(){
|
|
|
this.dialogFormReset();
|
|
|
+ if(this.attrTypeOptionsList[0]){
|
|
|
+ this.$set(this,'attrTypeOptions',JSON.parse(JSON.stringify(this.attrTypeOptionsList)));
|
|
|
+ }else{
|
|
|
+ this.$set(this,'dialogAttrType',false);
|
|
|
+ }
|
|
|
this.$set(this,'dialogTitle','新增');
|
|
|
this.$set(this,'dialogType',true);
|
|
|
},
|
|
@@ -389,6 +416,28 @@
|
|
|
exceptionIcon:row.exceptionIcon,
|
|
|
state:row.state,
|
|
|
}
|
|
|
+ //子标识判定
|
|
|
+ if(this.attrTypeOptionsList[0]){
|
|
|
+ if(obj.code[0]){
|
|
|
+ let num = 0;
|
|
|
+ for(let i=0;i<self.attrTypeOptionsList.length;i++){
|
|
|
+ if(obj.code == self.attrTypeOptionsList[i].code){
|
|
|
+ num++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(num == 0){
|
|
|
+ obj.code = '';
|
|
|
+ }
|
|
|
+ this.$set(this,'dialogAttrType',true);
|
|
|
+ this.$set(this,'attrTypeOptions',JSON.parse(JSON.stringify(this.attrTypeOptionsList)));
|
|
|
+ }else{
|
|
|
+ this.$set(this,'dialogAttrType',true);
|
|
|
+ this.$set(this,'attrTypeOptions',JSON.parse(JSON.stringify(this.attrTypeOptionsList)));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$set(this,'dialogAttrType',false);
|
|
|
+ this.$set(this,'attrTypeOptions',[]);
|
|
|
+ }
|
|
|
this.$set(this,'dialogForm',obj);
|
|
|
this.$set(this,'dialogTitle','编辑');
|
|
|
this.$set(this,'dialogType',true);
|