master
fanluyan 1 year ago
parent cfa6f732f1
commit 73f448a7d5

@ -570,6 +570,15 @@ export function batchUpdateApi(data) {
data,
});
}
//从modev表导入
export function importFromModevApi(data) {
return request({
url: "/nsensor/importFromModev",
method: "post",
data,
});
}
//属性相关接口
//新增
export function modevtypepointAddApi(data) {

@ -0,0 +1,256 @@
<template>
<div class="attributeList">
<el-dialog
class="attributesDialogBox"
title="属性配置"
:visible.sync="attributeshow"
width="620px"
:close-on-click-modal="false"
>
<div class="attBox" v-loading="attLoading">
<el-button
class="addAtt"
type="primary"
icon="el-icon-plus"
@click="handleAddAttClick"
>添加属性</el-button
>
<el-table
:data="attributesData"
stripe
border
style="width: 100%"
height="404px"
>
<el-table-column prop="field" label="字段名" width="180">
</el-table-column>
<el-table-column prop="fieldDesc" label="字段描述" width="180">
</el-table-column>
<el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column label="操作" class-name="editClass">
<template slot-scope="scope">
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
size="small"
icon="el-icon-delete"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog
width="450px"
title="新增"
:visible.sync="innerVisible"
append-to-body
class="attaddDialog"
>
<el-form
label-position="left"
ref="formInfo"
label-width="104px"
:rules="rules"
:model="formInfo"
>
<el-form-item label="属性名:">
<el-select v-model="formInfo.name" @change="changeName">
<el-option
v-for="item in attOptions"
:key="item.name"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="属性描述:" prop="comment">
<el-input v-model="formInfo.comment"></el-input>
</el-form-item>
<el-form-item label="类型:">
<el-select v-model="formInfo.typeVal" @change="changeName">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="innerVisible = false"> </el-button>
<el-button type="primary" @click="submitAddForm()"> </el-button>
</div>
</el-dialog>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="hide"> </el-button> -->
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
modevtypepointAddApi,
modevtypepointListApi,
modevtypepointDeleteApi,
colListApi,
} from "@/utils/api/index";
export default {
props: ["title"],
data() {
return {
rowData: "",
attributeshow: false,
innerVisible: false,
attLoading: false,
attributesData: [],
attOptions: [],
typeOptions: [
{
value: 1,
label: "遥信",
},
{
value: 2,
label: "遥测",
},
],
formInfo: {
name: "",
comment: "",
typeVal: 2,
},
rules: {},
};
},
created() {},
mounted() {},
watch: {},
methods: {
changeName(val) {
console.log(val);
this.formInfo.name = val;
console.log(this.attOptions.find((item) => item.name === val));
this.formInfo.comment = this.attOptions.find(
(item) => item.name === val
).comment;
},
display(val) {
//
this.rowData = val;
console.log(this.rowData);
this.attributeshow = true;
this.getListAll();
},
getListAll() {
this.attLoading = true;
modevtypepointListApi({
modevtypeId: this.rowData.id,
})
.then((res) => {
console.log(res);
this.attributesData = res.data;
this.attLoading = false;
})
.catch((err) => {
console.log(err); //
});
},
//
handleAddAttClick() {
this.innerVisible = true;
this.getcolList();
},
//colList
getcolList() {
colListApi({
tableName: this.rowData.tableName,
})
.then((res) => {
console.log(res);
this.attOptions = res.data;
this.formInfo.name = res.data[0].name;
this.formInfo.comment = res.data[0].comment;
})
.catch((err) => {
console.log(err); //
});
},
//
submitAddForm() {
console.log(this.formInfo);
modevtypepointAddApi({
sensorId: this.rowData.id,
field: this.formInfo.name,
fieldDesc: this.formInfo.comment,
type: this.formInfo.typeVal,
})
.then((res) => {
console.log(res);
this.innerVisible = false;
this.getListAll();
})
.catch((err) => {
console.log(err); //
});
},
//
handleDeleteClick(val) {
console.log(val);
this.$confirm("确定要删除记录吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
modevtypepointDeleteApi({ id: val.id }).then((res) => {
if (res.success) {
this.$message({
duration: 1500,
showClose: true,
type: "success",
message: "删除成功",
});
this.getListAll(); //
} else {
this.$message({
duration: 1500,
showClose: true,
type: "error",
message: res.errorMsg,
});
}
});
})
.catch(() => {});
},
submitForm() {
this.attributeshow = false;
},
hide() {
this.attributeshow = false;
},
},
};
</script>
<style lang="less">
.attributeList {
.attributesDialogBox {
.attBox {
.addAtt {
margin-bottom: 16px;
}
}
}
}
.attaddDialog {
.el-select {
width: 306px;
}
}
</style>

@ -33,6 +33,31 @@
@click="submitUpload"
>上传到服务器</el-button
>
<div class="toolTip">
<el-tooltip
v-if="modevInfo != ''"
class="item"
effect="dark"
:content="modevInfo"
placement="bottom"
>
<el-button
size="small"
type="primary"
@click="modevHandleClick"
:loading="modevBtnLoding"
>从modev表导入</el-button
>
</el-tooltip>
<el-button
size="small"
type="primary"
@click="modevHandleClick"
:loading="modevBtnLoding"
v-else
>从modev表导入</el-button
>
</div>
</div>
<div class="monitoringTableBox">
<div class="bindBox" v-if="multipleSelection.length > 0">
@ -109,7 +134,11 @@
</div>
</template>
<script>
import { monitoringListApi, modevDeleteApi } from "@/utils/api/index";
import {
monitoringListApi,
modevDeleteApi,
importFromModevApi,
} from "@/utils/api/index";
import bindingDialog from "./components/bindingDialog";
import addmonitoringDialog from "./components/addmonitoringDialog";
@ -129,6 +158,8 @@ export default {
page: 1, //
pageSize: 20, //
total: 0, //
modevInfo: "",
modevBtnLoding: false,
};
},
created() {},
@ -137,6 +168,28 @@ export default {
},
watch: {},
methods: {
//modev
modevHandleClick() {
this.modevBtnLoding = true;
this.modevInfo = "";
importFromModevApi()
.then((res) => {
console.log(res);
if (res.success) {
this.modevBtnLoding = false;
this.modevInfo = res.data;
this.$message({
duration: 1500,
showClose: true,
type: "success",
message: res.data,
});
}
})
.catch((err) => {
console.log(err); //
});
},
//
beforeAvatarUpload(file) {
console.log(this.reportData.title);
@ -156,16 +209,16 @@ export default {
type: "success",
});
//this.$refs.upload.clearFiles();
this.$refs.upload.clearFiles();
this.getmonitoringAllList(); //iedName
} else {
this.$message({
duration: 1500,
duration: 3000,
showClose: true,
message: res.errorMsg,
type: "error",
});
// this.$refs.upload.clearFiles();
this.$refs.upload.clearFiles();
}
},
getmonitoringAllList() {
@ -301,6 +354,9 @@ export default {
}
.uploadBtn {
}
.toolTip {
margin-left: auto;
}
.clearBtn {
margin-left: auto;
}

Loading…
Cancel
Save