|
@@ -4,11 +4,14 @@
|
|
|
<el-col :span="4" :xs="24">
|
|
|
<div class="head-container">
|
|
|
<el-input v-model="areaName" placeholder="请输入区块名称" clearable size="small" prefix-icon="el-icon-search"
|
|
|
- style="margin-bottom: 20px" />
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="head-container">
|
|
|
- <el-tree :data="areaOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree"
|
|
|
- node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
|
|
|
+ <el-tree :data="areaOptions" :props="defaultProps" :expand-on-click-node="false"
|
|
|
+ :filter-node-method="filterNode" ref="tree"
|
|
|
+ node-key="id" default-expand-all highlight-current @node-click="handleNodeClick"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="20" :xs="24">
|
|
@@ -18,14 +21,18 @@
|
|
|
<el-tab-pane label="输能设施" name="W"></el-tab-pane>
|
|
|
<el-tab-pane label="用能设施" name="Z"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
<el-form-item label="设施子类" prop="facsSubtype">
|
|
|
<el-select v-model="queryParams.facsSubCategory">
|
|
|
- <el-option v-for="item in facsSubCategoryOptions" :label="item.name" :value="item.code" :key="item.code" />
|
|
|
+ <el-option v-for="item in facsSubCategoryOptions" :label="item.name" :value="item.code" :key="item.code"/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设施名称" prop="facsName">
|
|
|
- <el-input v-model="queryParams.facsName" placeholder="请输入设施名称" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ <el-input v-model="queryParams.facsName" placeholder="请输入设施名称" clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
@@ -35,27 +42,33 @@
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['basecfg:emsfacs:add']">新增
|
|
|
+ <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
|
|
+ v-hasPermi="['basecfg:emsfacs:add']"
|
|
|
+ >新增
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
|
|
|
- v-hasPermi="['basecfg:emsfacs:edit']">修改</el-button>
|
|
|
+ v-hasPermi="['basecfg:emsfacs:edit']"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
|
|
- v-hasPermi="['basecfg:emsfacs:remove']">删除</el-button>
|
|
|
+ v-hasPermi="['basecfg:emsfacs:remove']"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="facsList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="设施代码" align="center" prop="facsCode" />
|
|
|
- <el-table-column label="设施名称" align="center" prop="facsName" />
|
|
|
- <el-table-column label="设施分类" align="center" prop="facsCategoryName" />
|
|
|
- <el-table-column label="设施子类" align="center" prop="facsSubCategoryName" />
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="设施代码" align="center" prop="facsCode"/>
|
|
|
+ <el-table-column label="设施名称" align="center" prop="facsName"/>
|
|
|
+ <el-table-column label="设施分类" align="center" prop="facsCategoryName"/>
|
|
|
+ <el-table-column label="设施子类" align="center" prop="facsSubCategoryName"/>
|
|
|
<el-table-column label="启用状态" align="center" prop="enable">
|
|
|
<template slot-scope="scope">
|
|
|
<span
|
|
@@ -66,47 +79,62 @@
|
|
|
textAlign: 'center',
|
|
|
cursor: 'pointer',
|
|
|
color: scope.row.enable === 0 ? 'rgb(255,159,159)' : 'rgb(117,186,255)',
|
|
|
- backgroundColor: scope.row.enable === 0 ? 'rgb(255,235,235)' : 'rgb(232,244,255)'}">
|
|
|
-
|
|
|
- {{ scope.row.enable === 0 ? '关闭' : '启用' }}
|
|
|
+ backgroundColor: scope.row.enable === 0 ? 'rgb(255,235,235)' : 'rgb(232,244,255)'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ {{ scope.row.enable === 0 ? '关闭' : '启用' }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<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-info" @click="handleDetail(scope.row)" v-hasPermi="['basecfg:emsfacs:edit']">
|
|
|
- 详情</el-button>
|
|
|
- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['basecfg:emsfacs:edit']">
|
|
|
- 修改</el-button>
|
|
|
- <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn" @click="handleDelete(scope.row)" v-hasPermi="['basecfg:emsfacs:remove']">
|
|
|
- 删除</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
|
|
|
+ v-hasPermi="['basecfg:emsfacs:edit']"
|
|
|
+ >
|
|
|
+ 详情
|
|
|
+ </el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['basecfg:emsfacs:edit']"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
|
|
|
+ @click="handleDelete(scope.row)" v-hasPermi="['basecfg:emsfacs:remove']"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
- @pagination="getList" />
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
|
|
|
<!-- 添加或修改能源设施/系统对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="550px" append-to-body >
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px" >
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="归属区域" prop="refArea">
|
|
|
- <treeselect v-model="form.refArea" :options="areaOptions" :show-count="true" placeholder="请选择归属园区" />
|
|
|
+ <treeselect v-model="form.refArea" :options="areaOptions" :show-count="true"
|
|
|
+ placeholder="请选择归属园区"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设施代码" prop="facsCode">
|
|
|
- <el-input v-model="form.facsCode" placeholder="请输入设施代码" />
|
|
|
+ <el-input v-model="form.facsCode" placeholder="请输入设施代码"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设施名称" prop="facsName">
|
|
|
- <el-input v-model="form.facsName" placeholder="请输入设施名称" />
|
|
|
+ <el-input v-model="form.facsName" placeholder="请输入设施名称"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设施分类" prop="facsCategory">
|
|
|
- <el-select v-model="form.facsCategory" style="width:100%">
|
|
|
- <el-option v-for="item in facsCategoryOptions" :label="item.name" :value="item.code" :key="item.code" />
|
|
|
+ <el-select v-model="form.facsCategory" style="width:100%">
|
|
|
+ <el-option v-for="item in facsCategoryOptions" :label="item.name" :value="item.code" :key="item.code"/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设施子类" prop="facsSubCategory">
|
|
|
<el-select v-model="form.facsSubCategory" style="width:100%">
|
|
|
- <el-option v-for="item in facsSubCategoryOptions" :label="item.name" :value="item.code" :key="item.code" />
|
|
|
+ <el-option v-for="item in facsSubCategoryOptions" :label="item.name" :value="item.code"
|
|
|
+ :key="item.code"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -122,7 +150,7 @@
|
|
|
</el-form-item>
|
|
|
<!-- 这里可以展示属性名称和属性值 -->
|
|
|
<div v-if="attrList.length > 0" class="attr-list-container">
|
|
|
- <h3 >模型属性:</h3>
|
|
|
+ <h3>模型属性:</h3>
|
|
|
<ul>
|
|
|
<li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
|
|
|
<span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
|
|
@@ -131,42 +159,46 @@
|
|
|
v-model="attrValuesMap[attr.attrKey]"
|
|
|
placeholder="点击编辑"
|
|
|
size="small"
|
|
|
- @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])">
|
|
|
+ @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
|
|
|
+
|
|
|
+ >
|
|
|
</el-input>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
- <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
|
|
|
- <el-form-item label="" prop="attrList" >
|
|
|
- <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px" key="'customAttrs'" >
|
|
|
- <el-table-column label="标识" align="center" prop="attrKey">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input size="mini" v-model="scope.row.attrKey" placeholder="请输入标识" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="属性名" align="center" prop="attrName">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input size="mini" v-model="scope.row.attrName" placeholder="请输入属性名" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="属性值" align="center" prop="attrValue" >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input size="mini" v-model="scope.row.attrValue" placeholder="请输入属性值" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" label="操作">
|
|
|
- <template slot="header">
|
|
|
- <div class="operateBtns" @click="addCustomAttr" >
|
|
|
- <span>添加</span><i class="el-icon-circle-plus-outline"></i>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template slot-scope="scope">
|
|
|
- <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form-item>
|
|
|
+ <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
|
|
|
+ <el-form-item label="" prop="attrList">
|
|
|
+ <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
|
|
|
+ key="'customAttrs'"
|
|
|
+ >
|
|
|
+ <el-table-column label="标识" align="center" prop="attrKey">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input size="mini" v-model="scope.row.attrKey" placeholder="请输入标识"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="属性名" align="center" prop="attrName">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input size="mini" v-model="scope.row.attrName" placeholder="请输入属性名"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="属性值" align="center" prop="attrValue">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input size="mini" v-model="scope.row.attrValue" placeholder="请输入属性值"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作">
|
|
|
+ <template slot="header">
|
|
|
+ <div class="operateBtns" @click="addCustomAttr">
|
|
|
+ <span>添加</span><i class="el-icon-circle-plus-outline"></i>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
</h3>
|
|
|
|
|
|
<el-form-item label="启用状态" prop="enable">
|
|
@@ -174,7 +206,8 @@
|
|
|
<el-option v-for="item in enableOptions"
|
|
|
:label="item.name"
|
|
|
:value="item.code"
|
|
|
- :key="item.code" />
|
|
|
+ :key="item.code"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -186,68 +219,68 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
- <!-- 详情弹框 -->
|
|
|
- <el-dialog :visible.sync="showDrawer" title="设施详情">
|
|
|
- <div v-if="curRow">
|
|
|
- <!-- 设备基本信息 -->
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span class="section-title">设施基本信息</span>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <p>设施代码:{{ curRow.facsCode }}</p>
|
|
|
- <p>设施名称:{{ curRow.facsName }}</p>
|
|
|
- <p>设施名称:{{ curRow.facsCategoryName }}</p>
|
|
|
- <p>设施子类:{{ curRow.facsSubCategoryName }}</p>
|
|
|
- <p>归属区域:{{ curRow.refAreaName}}</p>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
+ <!-- 详情弹框 -->
|
|
|
+ <el-dialog :visible.sync="showDrawer" title="设施详情">
|
|
|
+ <div v-if="curRow">
|
|
|
+ <!-- 设备基本信息 -->
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span class="section-title">设施基本信息</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p>设施代码:{{ curRow.facsCode }}</p>
|
|
|
+ <p>设施名称:{{ curRow.facsName }}</p>
|
|
|
+ <p>设施名称:{{ curRow.facsCategoryName }}</p>
|
|
|
+ <p>设施子类:{{ curRow.facsSubCategoryName }}</p>
|
|
|
+ <p>归属区域:{{ curRow.refAreaName }}</p>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
|
|
|
- <!-- 属性信息 -->
|
|
|
- <el-card class="box-card" v-if="attrData.length > 0">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span class="section-title">属性定义</span>
|
|
|
- </div>
|
|
|
- <div v-for="(item, index) in attrData" :key="index">
|
|
|
- <p>属性名称:{{ item.attrName }}</p>
|
|
|
- <p>属性值:{{ item.attrValue }}</p>
|
|
|
- <p>属性单位:{{ item.attrUnit }}</p>
|
|
|
- <!-- 在每个条目之后添加横线,除了最后一个条目 -->
|
|
|
- <div v-if="index < attrData.length - 1" class="divider"></div>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
+ <!-- 属性信息 -->
|
|
|
+ <el-card class="box-card" v-if="attrData.length > 0">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span class="section-title">属性定义</span>
|
|
|
+ </div>
|
|
|
+ <div v-for="(item, index) in attrData" :key="index">
|
|
|
+ <p>属性名称:{{ item.attrName }}</p>
|
|
|
+ <p>属性值:{{ item.attrValue }}</p>
|
|
|
+ <p>属性单位:{{ item.attrUnit }}</p>
|
|
|
+ <!-- 在每个条目之后添加横线,除了最后一个条目 -->
|
|
|
+ <div v-if="index < attrData.length - 1" class="divider"></div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
|
|
|
- <!-- 能力信息 -->
|
|
|
- <el-card class="box-card" v-if="abilityData.length > 0">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span class="section-title">能力定义</span>
|
|
|
- </div>
|
|
|
- <div v-for="(item, index) in abilityData" :key="index">
|
|
|
- <p>能力名称:{{ item.abilityName }}</p>
|
|
|
- <p>能力键:{{ item.abilityKey }}</p>
|
|
|
- <p>能力参数:{{ item.abilityParam }}</p>
|
|
|
- <p>能力描述:{{ item.abilityDesc }}</p>
|
|
|
- <!-- 在每个条目之后添加横线,除了最后一个条目 -->
|
|
|
- <div v-if="index < abilityData.length - 1" class="divider"></div>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
+ <!-- 能力信息 -->
|
|
|
+ <el-card class="box-card" v-if="abilityData.length > 0">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span class="section-title">能力定义</span>
|
|
|
+ </div>
|
|
|
+ <div v-for="(item, index) in abilityData" :key="index">
|
|
|
+ <p>能力名称:{{ item.abilityName }}</p>
|
|
|
+ <p>能力键:{{ item.abilityKey }}</p>
|
|
|
+ <p>能力参数:{{ item.abilityParam }}</p>
|
|
|
+ <p>能力描述:{{ item.abilityDesc }}</p>
|
|
|
+ <!-- 在每个条目之后添加横线,除了最后一个条目 -->
|
|
|
+ <div v-if="index < abilityData.length - 1" class="divider"></div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
|
|
|
- <!-- 事件信息 -->
|
|
|
- <el-card class="box-card" v-if="eventData.length > 0">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span class="section-title">事件定义</span>
|
|
|
- </div>
|
|
|
- <div v-for="(item, index) in eventData" :key="index">
|
|
|
- <p>事件名称:{{ item.eventKey }}</p>
|
|
|
- <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
|
|
|
- <p>事件代码:{{ item.eventCode }}</p>
|
|
|
- <p>外部事件代码:{{ item.extEventCode }}</p>
|
|
|
- <!-- 在每个条目之后添加横线,除了最后一个条目 -->
|
|
|
- <div v-if="index < eventData.length - 1" class="divider"></div>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+ <!-- 事件信息 -->
|
|
|
+ <el-card class="box-card" v-if="eventData.length > 0">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span class="section-title">事件定义</span>
|
|
|
+ </div>
|
|
|
+ <div v-for="(item, index) in eventData" :key="index">
|
|
|
+ <p>事件名称:{{ item.eventKey }}</p>
|
|
|
+ <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
|
|
|
+ <p>事件代码:{{ item.eventCode }}</p>
|
|
|
+ <p>外部事件代码:{{ item.extEventCode }}</p>
|
|
|
+ <!-- 在每个条目之后添加横线,除了最后一个条目 -->
|
|
|
+ <div v-if="index < eventData.length - 1" class="divider"></div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -258,18 +291,19 @@ import {
|
|
|
delFacs,
|
|
|
addFacs,
|
|
|
updateFacs,
|
|
|
- getFacsCategorygetByCode,
|
|
|
+ getFacsCategorygetByCode
|
|
|
} from '@/api/basecfg/emsfacs'
|
|
|
import { listAllFacsCategory } from '@/api/basecfg/facscategory'
|
|
|
import { areaTreeSelect } from '@/api/basecfg/area'
|
|
|
+import { getModelByCode, listAllModel } from '@/api/basecfg/objModel'
|
|
|
+import { getObjAttr } from '@/api/basecfg/objAttribute'
|
|
|
+import { addAttrValueBatch } from '@/api/basecfg/objAttributeValue'
|
|
|
import Treeselect from '@riophae/vue-treeselect'
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
-import {getModelByCode, listAllModel, listModel} from '@/api/basecfg/objModel'
|
|
|
-import {getObjAttr} from "@/api/basecfg/objAttribute";
|
|
|
-import { addAttrValueBatch, getAttrValue, listAttrValue} from "@/api/basecfg/objAttributeValue";
|
|
|
+
|
|
|
export default {
|
|
|
name: 'Facs',
|
|
|
- components: {Treeselect},
|
|
|
+ components: { Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
attrList: [], // 属性模板数组
|
|
@@ -308,8 +342,8 @@ export default {
|
|
|
facsCategoryOptions: undefined,
|
|
|
facsSubCategoryOptions: undefined,
|
|
|
enableOptions: [
|
|
|
- {code: 0, name: '关闭'},
|
|
|
- {code: 1, name: '启用'}
|
|
|
+ { code: 0, name: '关闭' },
|
|
|
+ { code: 1, name: '启用' }
|
|
|
],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
@@ -339,14 +373,14 @@ export default {
|
|
|
},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
- facsCode: [{required: true, message: '设施代码不能为空', trigger: 'blur'}],
|
|
|
- facsName: [{required: true, message: '设施名称不能为空', trigger: 'blur'}],
|
|
|
- facsCategory: [{required: true, message: '设施分类不能为空', trigger: 'change'}],
|
|
|
- refArea: [{required: true, message: '归属区域代码不能为空', trigger: 'blur'}]
|
|
|
+ facsCode: [{ required: true, message: '设施代码不能为空', trigger: 'blur' }],
|
|
|
+ facsName: [{ required: true, message: '设施名称不能为空', trigger: 'blur' }],
|
|
|
+ facsCategory: [{ required: true, message: '设施分类不能为空', trigger: 'change' }],
|
|
|
+ refArea: [{ required: true, message: '归属区域代码不能为空', trigger: 'blur' }]
|
|
|
},
|
|
|
curRow: {},
|
|
|
attrData: [],
|
|
|
- attrUnits:[],
|
|
|
+ attrUnits: [],
|
|
|
abilityData: [],
|
|
|
eventData: [],
|
|
|
attrForm: {
|
|
@@ -380,8 +414,8 @@ export default {
|
|
|
watch: {
|
|
|
// 根据名称筛选区域树
|
|
|
areaName(val) {
|
|
|
- this.$refs.tree.filter(val);
|
|
|
- },
|
|
|
+ this.$refs.tree.filter(val)
|
|
|
+ }
|
|
|
|
|
|
},
|
|
|
created() {
|
|
@@ -390,9 +424,7 @@ export default {
|
|
|
this.getAllFacsCategory()
|
|
|
this.getSubCategorygetByCode()
|
|
|
this.getFacsModel()
|
|
|
- this.$set(this.form, 'customAttrs', []);
|
|
|
-
|
|
|
-
|
|
|
+ this.$set(this.form, 'customAttrs', [])
|
|
|
},
|
|
|
methods: {
|
|
|
/** 查询能源设施/系统列表 */
|
|
@@ -412,11 +444,10 @@ export default {
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = this.$options.data().form
|
|
|
- this.attrList = []; // 重置属性列表
|
|
|
- this.attrValuesMap = {}; // 重置属性值映射
|
|
|
- this.form.customAttrs = []; // 重置自定义属性
|
|
|
+ this.attrList = [] // 重置属性列表
|
|
|
+ this.attrValuesMap = {} // 重置属性值映射
|
|
|
+ this.form.customAttrs = [] // 重置自定义属性
|
|
|
this.resetForm('form')
|
|
|
-
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
@@ -452,23 +483,23 @@ export default {
|
|
|
this.title = '修改能源设施'
|
|
|
})
|
|
|
},
|
|
|
- /** 提交按钮 */
|
|
|
+ /** 提交按钮 */
|
|
|
submitForm() {
|
|
|
// 重置 attrList 和 form.customAttrs
|
|
|
if (!this.attrList) {
|
|
|
- this.attrList = [];
|
|
|
+ this.attrList = []
|
|
|
}
|
|
|
if (!this.form.customAttrs) {
|
|
|
- this.form.customAttrs = [];
|
|
|
+ this.form.customAttrs = []
|
|
|
}
|
|
|
// 准备要发送的数据
|
|
|
- let dataToSubmit = [];
|
|
|
+ let dataToSubmit = []
|
|
|
// 添加模型属性数据
|
|
|
this.attrList.forEach(attr => {
|
|
|
- const attrName=attr.attrName;
|
|
|
- const attrKey = attr.attrKey;
|
|
|
- const attrValue = this.attrValuesMap[attrKey];
|
|
|
- const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey);
|
|
|
+ const attrName = attr.attrName
|
|
|
+ const attrKey = attr.attrKey
|
|
|
+ const attrValue = this.attrValuesMap[attrKey]
|
|
|
+ const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
|
|
|
if (existingIndex === -1) {
|
|
|
// 如果attrKey不存在于dataToSubmit中,则添加
|
|
|
dataToSubmit.push({
|
|
@@ -479,27 +510,28 @@ export default {
|
|
|
attrValue: attrValue,
|
|
|
attrName: attrName
|
|
|
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
- // 添加自定义属性数据
|
|
|
- this.form.customAttrs.forEach(customAttr => {
|
|
|
- const attrName= customAttr.attrName;
|
|
|
- const attrKey = customAttr.attrKey;
|
|
|
- const attrValue = customAttr.attrValue;
|
|
|
- const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey);
|
|
|
- if (existingIndex === -1) {
|
|
|
- // 如果attrKey不存在于dataToSubmit中,则添加
|
|
|
- dataToSubmit.push({
|
|
|
- modelCode: '', // 这里填写模型代码
|
|
|
- objCode: this.form.facsCode, // 这里填写设备代码
|
|
|
- objType: 1, // 这里填写对象类型
|
|
|
- attrKey: attrKey,
|
|
|
- attrValue: attrValue,
|
|
|
- attrName:attrName
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ })
|
|
|
+
|
|
|
+ // 添加自定义属性数据
|
|
|
+ this.form.customAttrs.forEach(customAttr => {
|
|
|
+ const attrName = customAttr.attrName
|
|
|
+ const attrKey = customAttr.attrKey
|
|
|
+ const attrValue = customAttr.attrValue
|
|
|
+ const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
|
|
|
+ if (existingIndex === -1) {
|
|
|
+ // 如果attrKey不存在于dataToSubmit中,则添加
|
|
|
+ dataToSubmit.push({
|
|
|
+ modelCode: '', // 这里填写模型代码
|
|
|
+ objCode: this.form.facsCode, // 这里填写设备代码
|
|
|
+ objType: 1, // 这里填写对象类型
|
|
|
+ attrKey: attrKey,
|
|
|
+ attrValue: attrValue,
|
|
|
+ attrName: attrName
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
if (valid) {
|
|
@@ -509,24 +541,24 @@ export default {
|
|
|
this.open = false
|
|
|
this.getList()
|
|
|
}).catch(error => {
|
|
|
- console.error('修改失败:', error);
|
|
|
- this.$message.error('修改失败');
|
|
|
- });
|
|
|
+ console.error('修改失败:', error)
|
|
|
+ this.$message.error('修改失败')
|
|
|
+ })
|
|
|
|
|
|
if (dataToSubmit.length > 0) {
|
|
|
addAttrValueBatch(dataToSubmit)
|
|
|
.then(response => {
|
|
|
if (response.code === 200) {
|
|
|
- this.$message.success('属性添加成功');
|
|
|
+ this.$message.success('属性添加成功')
|
|
|
} else {
|
|
|
- this.$message.error('属性添加失败');
|
|
|
+ this.$message.error('属性添加失败')
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
- console.error('属性添加失败:', error);
|
|
|
- this.$message.error('属性添加失败');
|
|
|
- });
|
|
|
+ console.error('属性添加失败:', error)
|
|
|
+ this.$message.error('属性添加失败')
|
|
|
+ })
|
|
|
} else {
|
|
|
- // this.$message.info('没有属性需要添加');
|
|
|
+ // this.$message.info('没有属性需要添加');
|
|
|
}
|
|
|
} else {
|
|
|
addFacs(this.form).then(response => {
|
|
@@ -534,22 +566,22 @@ export default {
|
|
|
this.open = false
|
|
|
this.getList()
|
|
|
}).catch(error => {
|
|
|
- console.error('新增失败:', error);
|
|
|
- this.$message.error('新增失败');
|
|
|
- });
|
|
|
+ console.error('新增失败:', error)
|
|
|
+ this.$message.error('新增失败')
|
|
|
+ })
|
|
|
|
|
|
if (dataToSubmit.length > 0) {
|
|
|
addAttrValueBatch(dataToSubmit)
|
|
|
.then(response => {
|
|
|
if (response.code === 200) {
|
|
|
- this.$message.success('属性添加成功');
|
|
|
+ this.$message.success('属性添加成功')
|
|
|
} else {
|
|
|
- this.$message.error('属性添加失败');
|
|
|
+ this.$message.error('属性添加失败')
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
- console.error('属性添加失败:', error);
|
|
|
- this.$message.error('属性添加失败');
|
|
|
- });
|
|
|
+ console.error('属性添加失败:', error)
|
|
|
+ this.$message.error('属性添加失败')
|
|
|
+ })
|
|
|
} else {
|
|
|
// this.$message.info('没有属性需要添加');
|
|
|
}
|
|
@@ -561,32 +593,32 @@ export default {
|
|
|
handleDetail(row) {
|
|
|
this.showDrawer = true
|
|
|
this.curRow = row
|
|
|
- console.log("data", this.curRow)
|
|
|
+ console.log('data', this.curRow)
|
|
|
this.subKey = this.$options.data().subKey
|
|
|
getModelByCode(this.curRow.facsModel).then(response => {
|
|
|
const code = response.data
|
|
|
- console.log("code", code)
|
|
|
+ console.log('code', code)
|
|
|
this.eventData = response.data.eventList
|
|
|
this.abilityData = response.data.abilityList
|
|
|
|
|
|
})
|
|
|
|
|
|
getObjAttr(1, this.curRow.facsCode).then(response => {
|
|
|
- console.log("response值", response.data);
|
|
|
- const attrs = response.data.attrs;
|
|
|
- const attrValues = response.data.attrValues;
|
|
|
+ console.log('response值', response.data)
|
|
|
+ const attrs = response.data.attrs
|
|
|
+ const attrValues = response.data.attrValues
|
|
|
|
|
|
// 合并 attrs 和 attrValues 数组
|
|
|
const mergedData = attrValues.map(attrValue => {
|
|
|
- const attr = attrs.find(a => a.attrKey === attrValue.attrKey);
|
|
|
+ const attr = attrs.find(a => a.attrKey === attrValue.attrKey)
|
|
|
return {
|
|
|
...attrValue,
|
|
|
attrName: attr ? attr.attrName : attrValue.attrName,
|
|
|
attrUnit: attr ? attr.attrUnit : ''
|
|
|
- };
|
|
|
- });
|
|
|
- this.attrData = mergedData;
|
|
|
- });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.attrData = mergedData
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
@@ -594,7 +626,7 @@ export default {
|
|
|
const ids = row.id || this.ids
|
|
|
this.$modal
|
|
|
.confirm('是否确认删除能源设施编号为"' + ids + '"的数据项?')
|
|
|
- .then(function () {
|
|
|
+ .then(function() {
|
|
|
return delFacs(ids)
|
|
|
})
|
|
|
.then(() => {
|
|
@@ -617,7 +649,11 @@ export default {
|
|
|
/** 查询区域树结构 */
|
|
|
getAreaTree(tier) {
|
|
|
areaTreeSelect(tier).then(response => {
|
|
|
- this.areaOptions = response.data
|
|
|
+ this.areaOptions = [{
|
|
|
+ id: '-1',
|
|
|
+ label: '全部',
|
|
|
+ children: response.data
|
|
|
+ }]
|
|
|
})
|
|
|
},
|
|
|
// 筛选节点
|
|
@@ -638,7 +674,7 @@ export default {
|
|
|
},
|
|
|
getSubCategorygetByCode() {
|
|
|
getFacsCategorygetByCode(this.queryParams.facsCategory).then(response => {
|
|
|
- this.facsSubCategoryOptions = response.data.subtypeList || [];
|
|
|
+ this.facsSubCategoryOptions = response.data.subtypeList || []
|
|
|
})
|
|
|
},
|
|
|
facsCategoryChange() {
|
|
@@ -647,89 +683,90 @@ export default {
|
|
|
this.handleQuery()
|
|
|
},
|
|
|
|
|
|
-
|
|
|
/**自定义属性表格*/
|
|
|
addCustomAttr() {
|
|
|
// 添加一个新的自定义属性
|
|
|
if (!Array.isArray(this.form.customAttrs)) {
|
|
|
- this.form.customAttrs = [];
|
|
|
+ this.form.customAttrs = []
|
|
|
}
|
|
|
- this.form.customAttrs.push({
|
|
|
- attrKey: '',
|
|
|
- attrName: '',
|
|
|
- attrValue: ''
|
|
|
- });
|
|
|
- // 强制更新视图
|
|
|
- this.$forceUpdate();
|
|
|
+ this.form.customAttrs.push({
|
|
|
+ attrKey: '',
|
|
|
+ attrName: '',
|
|
|
+ attrValue: ''
|
|
|
+ })
|
|
|
+ // 强制更新视图
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
|
- },
|
|
|
- deleteCustomAttr(index) {
|
|
|
- // 删除指定索引的自定义属性
|
|
|
- if (this.form.customAttrs.length > 0) {
|
|
|
- this.form.customAttrs.splice(index, 1);
|
|
|
- }
|
|
|
- },
|
|
|
+ },
|
|
|
+ deleteCustomAttr(index) {
|
|
|
+ // 删除指定索引的自定义属性
|
|
|
+ if (this.form.customAttrs.length > 0) {
|
|
|
+ this.form.customAttrs.splice(index, 1)
|
|
|
+ }
|
|
|
|
|
|
- /**模型属性*/
|
|
|
- updateAttrValue(attrKey, newValue) {
|
|
|
- this.attrValuesMap[attrKey] = newValue;
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- getFacsModel() {
|
|
|
- listAllModel(1).then(response => {
|
|
|
- this.modelList = response.data;
|
|
|
- this.modelList.forEach(model => {
|
|
|
- console.log(model.modelCode);
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- handleModelChange(modelCode) {
|
|
|
- if (modelCode) {
|
|
|
- this.getModelByCode(modelCode);
|
|
|
- console.log("新增的界面进入",this.form.facsCode)
|
|
|
- this.getObjAttr(1, this.form.facsCode);
|
|
|
- }
|
|
|
- },
|
|
|
- getModelByCode(modelCode) {
|
|
|
- getModelByCode(modelCode).then(response => {
|
|
|
- // this.attrList = response.data.attrList;
|
|
|
- const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0);
|
|
|
- this.attrList = filteredAttrList;
|
|
|
+ /**模型属性*/
|
|
|
+ updateAttrValue(attrKey, newValue) {
|
|
|
+ this.attrValuesMap[attrKey] = newValue
|
|
|
+ },
|
|
|
|
|
|
- });
|
|
|
- },
|
|
|
- getObjAttr(objType, facsCode) {
|
|
|
- getObjAttr(objType, facsCode).then(response => {
|
|
|
- // const attrs = response.data.attrs;
|
|
|
- const attrs = response.data.attrs.filter(attr => attr.attrType === 0);
|
|
|
- console.log("attrs", attrs);
|
|
|
- const attrValues = response.data.attrValues || []; // 确保是一个数组
|
|
|
- console.log("attrValues", attrValues);
|
|
|
-
|
|
|
- // 创建一个映射对象,用于存储 attrKey 与对应的 attrValue
|
|
|
- const attrValuesMap = {};
|
|
|
-
|
|
|
- // 遍历 attrs 数组
|
|
|
- attrs.forEach(attr => {
|
|
|
- // 查找 attrValues 数组中是否有匹配的 attrKey
|
|
|
- const attrValueObj = attrValues.find(value => value.attrKey === attr.attrKey);
|
|
|
- // 如果找到匹配的 attrValue,更新 attrValuesMap
|
|
|
- if (attrValueObj) {
|
|
|
- attrValuesMap[attr.attrKey] = attrValueObj.attrValue;
|
|
|
- } else {
|
|
|
- // 如果没有找到匹配的 attrValue,则设置为 ' '
|
|
|
- attrValuesMap[attr.attrKey] = '';
|
|
|
- }
|
|
|
- });
|
|
|
+ getFacsModel() {
|
|
|
+ listAllModel(1).then(response => {
|
|
|
+ this.modelList = response.data
|
|
|
+ this.modelList.forEach(model => {
|
|
|
+ console.log(model.modelCode)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleModelChange(modelCode) {
|
|
|
+ console.log('新增的界面进入', modelCode)
|
|
|
+ if (modelCode) {
|
|
|
+ this.getModelByCode(modelCode)
|
|
|
+ console.log('新增的界面进入', this.form.facsCode)
|
|
|
+ this.getObjAttr(1, this.form.facsCode)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getModelByCode(modelCode) {
|
|
|
+ getModelByCode(modelCode).then(response => {
|
|
|
+ // this.attrList = response.data.attrList;
|
|
|
+ const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
|
|
|
+ this.attrList = filteredAttrList
|
|
|
|
|
|
- // 更新 attrValuesMap 到组件的数据中
|
|
|
- this.attrValuesMap = attrValuesMap;
|
|
|
- console.log("Updated attrValuesMap", this.attrValuesMap);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getObjAttr(objType, facsCode) {
|
|
|
+ getObjAttr(objType, facsCode).then(response => {
|
|
|
+ // const attrs = response.data.attrs;
|
|
|
+ const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
|
|
|
+ console.log('attrs', attrs)
|
|
|
+ const attrValues = response.data.attrValues || [] // 确保是一个数组
|
|
|
+ console.log('attrValues', attrValues)
|
|
|
+
|
|
|
+ // 创建一个映射对象,用于存储 attrKey 与对应的 attrValue
|
|
|
+ const attrValuesMap = {}
|
|
|
+
|
|
|
+ // 遍历 attrs 数组
|
|
|
+ attrs.forEach(attr => {
|
|
|
+ // 查找 attrValues 数组中是否有匹配的 attrKey
|
|
|
+ const attrValueObj = attrValues.find(value => value.attrKey === attr.attrKey)
|
|
|
+ // 如果找到匹配的 attrValue,更新 attrValuesMap
|
|
|
+ if (attrValueObj) {
|
|
|
+ attrValuesMap[attr.attrKey] = attrValueObj.attrValue
|
|
|
+ } else {
|
|
|
+ // 如果没有找到匹配的 attrValue,则设置为 '暂无数据'
|
|
|
+ attrValuesMap[attr.attrKey] = ''
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
+ // 更新 attrValuesMap 到组件的数据中
|
|
|
+ this.attrValuesMap = attrValuesMap
|
|
|
+ // 打印更新后的 attrValuesMap,用于调试
|
|
|
+ console.log('Updated attrValuesMap', this.attrValuesMap)
|
|
|
|
|
|
- });
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
}
|
|
|
</script>
|
|
@@ -741,33 +778,33 @@ export default {
|
|
|
}
|
|
|
|
|
|
.divider {
|
|
|
- border-bottom: 2px solid #ebeef5;
|
|
|
- margin: 10px 0;
|
|
|
+ border-bottom: 2px solid #ebeef5; /* 这是Element UI的默认边框颜色,你可以根据需要调整 */
|
|
|
+ margin: 10px 0; /* 这是横线与内容的间距,你可以根据需要调整 */
|
|
|
}
|
|
|
|
|
|
.section-title {
|
|
|
- font-size: 18px;
|
|
|
- font-weight: bold;
|
|
|
+ font-size: 18px; /* 标题字体大小 */
|
|
|
+ font-weight: bold; /* 字体加粗 */
|
|
|
}
|
|
|
|
|
|
.attr-list-container {
|
|
|
- border: 1px solid #ccc;
|
|
|
- padding: 10px;
|
|
|
- margin: 10px 0;
|
|
|
- font-weight: bold;
|
|
|
+ border: 1px solid #ccc; /* 给ul添加外框 */
|
|
|
+ padding: 10px; /* 内边距 */
|
|
|
+ margin: 10px 0; /* 外边距 */
|
|
|
+ font-weight: bold; /* 加粗标题 */
|
|
|
}
|
|
|
|
|
|
.attr-list-container h3 {
|
|
|
- font-weight: bold;
|
|
|
+ font-weight: bold; /* 加粗标题 */
|
|
|
}
|
|
|
|
|
|
.attr-item {
|
|
|
- list-style-type: none;
|
|
|
- margin-bottom: 5px;
|
|
|
+ list-style-type: none; /* 移除列表项前的默认符号 */
|
|
|
+ margin-bottom: 5px; /* 列表项之间的间距 */
|
|
|
}
|
|
|
|
|
|
.attr-name {
|
|
|
- font-weight: bold;
|
|
|
+ font-weight: bold; /* 加粗属性名称 */
|
|
|
}
|
|
|
|
|
|
|