|
@@ -0,0 +1,361 @@
|
|
|
|
+<template>
|
|
|
|
+ <div>
|
|
|
|
+ <el-card class="box-card">
|
|
|
|
+
|
|
|
|
+ <div style="margin-bottom: 1%">
|
|
|
|
+ <div class="conditionOne">
|
|
|
|
+ <span>设备:</span>
|
|
|
|
+ <el-select v-model="equipmentId" placeholder="请选择">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in equipmentInfo"
|
|
|
|
+ :key="item.weatherLookNo"
|
|
|
|
+ :label="item.weatherLookName"
|
|
|
|
+ :value="item.weatherLookNo">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <el-button size="small" type="primary" @click="getInfo" icon="el-icon-search" class="el-but"
|
|
|
|
+ :loading="btuLoading">搜索
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button size="small" type="primary" @click="insertData" icon="el-icon-plus" class="el-but"
|
|
|
|
+ :loading="btuLoading">新增
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <el-table v-loading="loading" border
|
|
|
|
+ :data="tableData.slice((page.currentPage-1)*page.pageSize,page.currentPage*page.pageSize)">
|
|
|
|
+ <el-table-column type="index" label="序号" width="55" align="center"/>
|
|
|
|
+ <el-table-column label="设备名称" align="center" prop="equipmentId" :formatter="formatEquipmentNo"/>
|
|
|
|
+ <el-table-column label="设备属性" align="center" prop="equipmentAttributeId" :formatter="formatEquipmentAtt"/>
|
|
|
|
+ <el-table-column label="倍率" align="center" prop="magnification"/>
|
|
|
|
+ <el-table-column label="通道名称" align="center" prop="tunnelId" :formatter="formatTunnel"/>
|
|
|
|
+ <el-table-column label="通道点位" align="center" prop="pointNo"/>
|
|
|
|
+ <el-table-column label="通道类型" align="center" prop="pointType" :formatter="formatDataFormat"/>
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-edit"
|
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
|
+
|
|
|
|
+ >修改
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
|
+
|
|
|
|
+ >删除
|
|
|
|
+ </el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div class="block" style="float: right">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
+ :current-page=page.currentPage
|
|
|
|
+ :page-sizes="[10, 15, 30, 50]"
|
|
|
|
+ :page-size=page.pageSize
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
+ :total=page.total>
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="40%" style="margin-top: 10%" append-to-body>
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="设备名:" prop="equipmentId">
|
|
|
|
+ <el-select v-model="form.equipmentId" placeholder="请选择设备" style="width: 100%" clearable>
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,index) in equipmentInfo"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.weatherLookName"
|
|
|
|
+ :value="item.weatherLookNo">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="设备属性:" prop="equipmentAttributeId">
|
|
|
|
+ <el-select v-model="form.equipmentAttributeId" placeholder="请选择设备" style="width: 100%" clearable>
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,index) in equipmentAttribute"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.explanation"
|
|
|
|
+ :value="item.id">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="倍率:" prop="magnification">
|
|
|
|
+ <el-input-number v-model="form.magnification" controls-position="right" style="width: 100%"></el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="使用通道:" prop="tunnelId">
|
|
|
|
+ <el-select v-model="form.tunnelId" placeholder="请选择设备" style="width: 100%" clearable>
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,index) in tunnelInfo"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.tunnelName"
|
|
|
|
+ :value="item.id">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="通道点位:" prop="pointNo">
|
|
|
|
+ <el-input-number v-model="form.pointNo" controls-position="right" style="width: 100%"></el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="通道数据类型:" prop="pointType" label-width="120px">
|
|
|
|
+ <el-select v-model="form.pointType" placeholder="请输入数据类型" style="width: 100%" clearable>
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,index) in protocolDataType"
|
|
|
|
+ :key="item.key"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </el-card>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import {list as weatherLookList} from "@/api/biz/dataQuery/weatherLook";
|
|
|
|
+import {list as tunnelInfo} from "@/api/biz/dataQuery/tunnelInfo";
|
|
|
|
+import {
|
|
|
|
+ list,
|
|
|
|
+ updateGatherDataPoint,
|
|
|
|
+ addGatherDataPoint,
|
|
|
|
+ delGatherDataPoint,
|
|
|
|
+ getEquipmentAttribute
|
|
|
|
+} from "@/api/biz/dataQuery/gatherDataPoint";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: "index",
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ loading: false,
|
|
|
|
+ btuLoading: true,
|
|
|
|
+ tableData: [],
|
|
|
|
+ equipmentInfo: [],
|
|
|
|
+ tunnelInfo: [],
|
|
|
|
+ page: {
|
|
|
|
+ total: 0, // 总页数
|
|
|
|
+ currentPage: 1, // 当前页数
|
|
|
|
+ pageSize: 10 // 每页显示多少条
|
|
|
|
+ },
|
|
|
|
+ title: '新增&保存',
|
|
|
|
+ editFlag: 'add',
|
|
|
|
+ open: false,
|
|
|
|
+ form: {},
|
|
|
|
+ rules: {
|
|
|
|
+ equipmentAttributeId: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
|
|
|
|
+ equipmentId: [{ required: true, message: '请选择设备', trigger: 'change' }],
|
|
|
|
+ magnification: [{ required: true, message: '请填写倍率', trigger: 'blur' }],
|
|
|
|
+ pointNo: [{ required: true, message: '请填写通道点位', trigger: 'blur' }],
|
|
|
|
+ pointType: [{ required: true, message: '请选择通道类型', trigger: 'change' }],
|
|
|
|
+ tunnelId: [{ required: true, message: '请选择通道', trigger: 'change' }]
|
|
|
|
+ },
|
|
|
|
+ modId: '',//备用id
|
|
|
|
+ equipmentId: '',
|
|
|
|
+ equipmentAttribute: [],
|
|
|
|
+ protocolDataType: [{label: '遥信开关量', value: 'A', key: 0},
|
|
|
|
+ {label: '+AB 无符号整型', value: 'P_AB', key: 1},
|
|
|
|
+ {label: '±AB 有符号整型', value: 'PM_AB', key: 2},
|
|
|
|
+ {label: '+BA 无符号整型反转', value: 'P_BA', key: 3},
|
|
|
|
+ {label: '±BA 有符号整型反转', value: 'PM_BA', key: 4},
|
|
|
|
+ {label: '+AABB', value: 'P_AABB', key: 5},
|
|
|
|
+ {label: '±AABB', value: 'PM_AABB', key: 6},
|
|
|
|
+ {label: '+BBAA', value: 'P_BBAA', key: 7},
|
|
|
|
+ {label: '±BBAA', value: 'PM_BBAA', key: 8},
|
|
|
|
+ {label: 'ABCD', value: 'ABCD', key: 9},
|
|
|
|
+ {label: 'CDAB', value: 'CDAB', key: 10},
|
|
|
|
+ {label: 'DCBA', value: 'DCBA', key: 11},
|
|
|
|
+ {label: 'BADC', value: 'BADC', key: 13}
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.init()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ init() {
|
|
|
|
+ this.getEquipmentInfo()
|
|
|
|
+ this.getTunneInfo()
|
|
|
|
+ this.getEquipmentAttribute()
|
|
|
|
+ this.getInfo()
|
|
|
|
+ },
|
|
|
|
+ /*获取采集点表信息*/
|
|
|
|
+ getInfo() {
|
|
|
|
+ this.loading = true
|
|
|
|
+ this.btuLoading = true
|
|
|
|
+ if (this.equipmentId === '' || this.equipmentId === null || this.equipmentId === undefined) {
|
|
|
|
+ this.equipmentId = ''
|
|
|
|
+ }
|
|
|
|
+ list({equipmentId: this.equipmentId}).then(res => {
|
|
|
|
+ this.tableData = res.rows
|
|
|
|
+ this.page.total = this.tableData.length
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.btuLoading = false
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.btuLoading = false
|
|
|
|
+ console.log('获取采集点表信息异常:' + err)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /*获取设备信息*/
|
|
|
|
+ getEquipmentInfo() {
|
|
|
|
+ weatherLookList().then(res => {
|
|
|
|
+ this.equipmentInfo = res.rows
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ console.log('获取设备信息异常:' + err)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /*获取通道信息*/
|
|
|
|
+ getTunneInfo() {
|
|
|
|
+ tunnelInfo().then(res => {
|
|
|
|
+ this.tunnelInfo = res.rows
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ console.log('获取通道信息异常:' + err)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /*获取设备属性*/
|
|
|
|
+ getEquipmentAttribute() {
|
|
|
|
+ getEquipmentAttribute().then(res => {
|
|
|
|
+ this.equipmentAttribute = res.data
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ console.log('获取设备属性异常:' + err)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /*新增*/
|
|
|
|
+ insertData() {
|
|
|
|
+ this.editFlag = 'add'
|
|
|
|
+ this.title = '新增&保存'
|
|
|
|
+ this.resetForm()
|
|
|
|
+ this.open = true
|
|
|
|
+ },
|
|
|
|
+ /*编辑*/
|
|
|
|
+ handleUpdate(row) {
|
|
|
|
+ this.editFlag = 'edit'
|
|
|
|
+ this.title = '修改&保存'
|
|
|
|
+ this.modId = row.id
|
|
|
|
+ this.form = {
|
|
|
|
+ id: row.id,
|
|
|
|
+ equipmentAttributeId: row.equipmentAttributeId,
|
|
|
|
+ equipmentId: row.equipmentId,
|
|
|
|
+ magnification: row.magnification,
|
|
|
|
+ pointNo: row.pointNo,
|
|
|
|
+ pointType: row.pointType,
|
|
|
|
+ tunnelId: row.tunnelId
|
|
|
|
+ }
|
|
|
|
+ this.open = true
|
|
|
|
+ },
|
|
|
|
+ /*删除*/
|
|
|
|
+ handleDelete(row) {
|
|
|
|
+ const ids = row.id;
|
|
|
|
+ this.$modal.confirm('是否确认删除"' + row.equipmentAttributeId + '"属性点表?').then(function () {
|
|
|
|
+ return delGatherDataPoint(ids);
|
|
|
|
+ }).then(() => {
|
|
|
|
+ this.getInfo();
|
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /*保存*/
|
|
|
|
+ submitForm(){
|
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (this.editFlag === 'edit') {
|
|
|
|
+ updateGatherDataPoint(this.form).then(response => {
|
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getInfo();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ addGatherDataPoint(this.form).then(response => {
|
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getInfo();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ resetForm() {
|
|
|
|
+ this.form = {
|
|
|
|
+ id: null,
|
|
|
|
+ equipmentAttributeId: null,
|
|
|
|
+ equipmentId: null,
|
|
|
|
+ magnification: null,
|
|
|
|
+ pointNo: null,
|
|
|
|
+ pointType: "P_AB",
|
|
|
|
+ tunnelId: null
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /*取消*/
|
|
|
|
+ cancel(){
|
|
|
|
+ this.open = false
|
|
|
|
+ this.resetForm()
|
|
|
|
+ },
|
|
|
|
+ /*设备编号转换*/
|
|
|
|
+ formatEquipmentNo(row) {
|
|
|
|
+ let equipmentInfo = this.equipmentInfo.find(w => w.weatherLookNo === row.equipmentId)
|
|
|
|
+ return equipmentInfo !== undefined ? equipmentInfo.weatherLookName : row.equipmentId
|
|
|
|
+ },
|
|
|
|
+ formatDataFormat(row) {
|
|
|
|
+ let protocolDataType = this.protocolDataType.find(w => w.value === row.pointType)
|
|
|
|
+ return protocolDataType !== undefined ? protocolDataType.label : row.pointType
|
|
|
|
+ },
|
|
|
|
+ formatEquipmentAtt(row) {
|
|
|
|
+ let equipmentAttribute = this.equipmentAttribute.find(w => w.id === row.equipmentAttributeId)
|
|
|
|
+ return equipmentAttribute !== undefined ? equipmentAttribute.explanation : row.equipmentAttributeId
|
|
|
|
+ },
|
|
|
|
+ formatTunnel(row) {
|
|
|
|
+ let tunnelInfo = this.tunnelInfo.find(w => w.id === row.tunnelId)
|
|
|
|
+ return tunnelInfo !== undefined ? tunnelInfo.tunnelName : row.tunnelId
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /*pageSize改变*/
|
|
|
|
+ handleSizeChange(val) {
|
|
|
|
+ this.page.pageSize = val
|
|
|
|
+ this.page.currentPage = 1
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ /*currentPage改变*/
|
|
|
|
+ handleCurrentChange(val) {
|
|
|
|
+ this.page.currentPage = val
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.conditionOne {
|
|
|
|
+ display: inline-block;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.el-but {
|
|
|
|
+ margin-left: .5%;
|
|
|
|
+}
|
|
|
|
+</style>
|