|
@@ -1,88 +1,225 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-row :gutter="20">
|
|
|
+ <!-- 左侧树形选择器 -->
|
|
|
<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" />
|
|
|
+ <el-input
|
|
|
+ v-model="areaName"
|
|
|
+ placeholder="请输入区域名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ prefix-icon="el-icon-search"
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ @input="filterTree"
|
|
|
+ />
|
|
|
</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" />
|
|
|
+ <div class="head-container tree-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"
|
|
|
+ >
|
|
|
+ <template #default="{ node, data }">
|
|
|
+ <div class="tree-node" :class="{ 'device-node': data.type === 'device', 'area-node': data.type === 'area' }">
|
|
|
+ <i v-if="data.type === 'area'" class="el-icon-folder node-icon area-icon"></i>
|
|
|
+ <i v-if="data.type === 'device'" class="el-icon-monitor node-icon device-icon"></i>
|
|
|
+ <span class="node-label">{{ data.label }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 无数据提示 -->
|
|
|
+ <div v-if="showEmptyTip" class="empty-tip">
|
|
|
+ <el-empty description="当前没有手动抄表设备" :image-size="100"></el-empty>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
+
|
|
|
+ <!-- 右侧内容区域 -->
|
|
|
<el-col :span="20" :xs="24">
|
|
|
+ <!-- Tab切换 -->
|
|
|
<el-tabs v-model="activeTab" @tab-click="handleTabChange">
|
|
|
- <el-tab-pane label="电表抄报" name="first">
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="水表抄报" name="second">
|
|
|
- </el-tab-pane>
|
|
|
+ <el-tab-pane label="电表抄报" name="first"></el-tab-pane>
|
|
|
+ <el-tab-pane label="水表抄报" name="second"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
|
|
|
- <!-- 填报按钮 -->
|
|
|
- <el-button type="primary" icon="el-icon-info" size="mini" @click="handleRecord">填报</el-button>
|
|
|
- <!-- 历史抄表记录 -->
|
|
|
- <el-form ref="recListForm" :model="recListForm" label-width="80px">
|
|
|
- <el-form-item label="年份" prop="year">
|
|
|
- <el-date-picker v-model="recListForm.year" :clearable="false" @change="getHistoryList" value-format="yyyy" type="year"
|
|
|
- placeholder="选择年份">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="计量设备" prop="year">
|
|
|
- <el-input disabled :value="recListForm.deviceCode" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="抄表历史" prop="recList">
|
|
|
- <el-table v-loading="loading" :data="recListForm.recList" max-height="280px">
|
|
|
- <el-table-column label="年份" align="center" prop="year" />
|
|
|
- <el-table-column label="月份" align="center" prop="meterMonth" >
|
|
|
- <template slot-scope="scope">
|
|
|
- <!-- 使用 JavaScript 字符串方法截取月份部分 -->
|
|
|
- {{ scope.row.meterMonth.slice(-2) }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="抄表示数" align="center" prop="meterReading" />
|
|
|
- <el-table-column label="用量" align="center" prop="increase" />
|
|
|
- <el-table-column label="抄表日期" align="center" prop="meterTime" />
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="!canEdit(scope.row.meterMonth)"
|
|
|
- @click="updateRecord(scope.row)">修改</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <!-- 填报 -->
|
|
|
- <el-dialog :title="fillTitle" :visible.sync="fillFormOpen" width="500px" append-to-body>
|
|
|
- <el-form ref="fillForm" :model="fillForm" label-width="150px">
|
|
|
+ <!-- 有设备时显示操作区域 -->
|
|
|
+ <div v-if="hasManualDevices">
|
|
|
+ <!-- 填报按钮 -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="mini"
|
|
|
+ @click="handleRecord"
|
|
|
+ :disabled="!currentDevice"
|
|
|
+ >
|
|
|
+ 填报
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <!-- 历史抄表记录 -->
|
|
|
+ <el-form ref="recListForm" :model="recListForm" label-width="100px" style="margin-top: 20px">
|
|
|
+ <el-form-item label="年份" prop="year">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="recListForm.year"
|
|
|
+ :clearable="false"
|
|
|
+ @change="getHistoryList"
|
|
|
+ value-format="yyyy"
|
|
|
+ type="year"
|
|
|
+ placeholder="选择年份"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="计量设备" prop="deviceCode">
|
|
|
+ <el-input disabled :value="currentDeviceName" placeholder="请选择左侧设备" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="抄表历史" prop="recList">
|
|
|
+ <el-table v-loading="loading" :data="recListForm.recList" max-height="400px">
|
|
|
+ <el-table-column label="年份" align="center" prop="year" width="80" />
|
|
|
+ <el-table-column label="月份" align="center" prop="meterMonth" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.meterMonth ? scope.row.meterMonth.slice(-2) : '-' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="抄表示数" align="center" prop="meterReading">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ formatNumber(scope.row.meterReading) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="用量" align="center" prop="increase">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span :class="{ 'text-success': scope.row.increase > 0 }">
|
|
|
+ {{ formatNumber(scope.row.increase) }}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="抄表日期" align="center" prop="meterTime" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ formatDate(scope.row.meterTime) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="mini"
|
|
|
+ :disabled="!canEdit(scope.row.meterMonth)"
|
|
|
+ @click="updateRecord(scope.row)"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <!-- 无数据提示 -->
|
|
|
+ <div v-if="recListForm.recList.length === 0 && !loading" class="table-empty">
|
|
|
+ <el-empty description="暂无抄表记录" :image-size="60"></el-empty>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 无设备提示 -->
|
|
|
+ <div v-else class="no-device-container">
|
|
|
+ <el-empty
|
|
|
+ :description="emptyDescription"
|
|
|
+ :image-size="200"
|
|
|
+ >
|
|
|
+ <template v-if="activeTab === 'first'">
|
|
|
+ <div class="empty-footer">
|
|
|
+ <p>当前没有配置手动抄表的电表设备</p>
|
|
|
+ <p class="sub-text">如需添加,请联系系统管理员</p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="empty-footer">
|
|
|
+ <p>当前没有配置手动抄表的水表设备</p>
|
|
|
+ <p class="sub-text">如需添加,请联系系统管理员</p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-empty>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 填报对话框 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="fillTitle"
|
|
|
+ :visible.sync="fillFormOpen"
|
|
|
+ width="500px"
|
|
|
+ append-to-body
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <el-form ref="fillForm" :model="fillForm" :rules="fillRules" label-width="120px">
|
|
|
<el-form-item label="表计编号">
|
|
|
<el-input disabled :value="fillForm.deviceCode" />
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="上次抄表日期">
|
|
|
- <el-input disabled :value="fillForm.lastTime" />
|
|
|
+ <el-input disabled :value="formatDate(fillForm.lastTime) || '无'" />
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="上次抄表示数">
|
|
|
- <el-input disabled :value="fillForm.lastReading" />
|
|
|
+ <el-input disabled :value="formatNumber(fillForm.lastReading) || '0'" />
|
|
|
</el-form-item>
|
|
|
- <hr>
|
|
|
- <el-form-item label="本次抄表月份">
|
|
|
- <el-input disabled :value="currentMonth" />
|
|
|
+
|
|
|
+ <el-divider></el-divider>
|
|
|
+
|
|
|
+ <el-form-item label="抄表月份" prop="selectedMonth">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="fillForm.selectedMonth"
|
|
|
+ :disabled="!ifAdd"
|
|
|
+ :clearable="false"
|
|
|
+ type="month"
|
|
|
+ value-format="yyyyMM"
|
|
|
+ format="yyyy年MM月"
|
|
|
+ placeholder="选择抄表月份"
|
|
|
+ :picker-options="monthPickerOptions"
|
|
|
+ @change="handleMonthChange"
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ <div v-if="monthWarning" class="warning-text">
|
|
|
+ <i class="el-icon-warning"></i>
|
|
|
+ {{ monthWarning }}
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item required :rules="[{required:true,message:'请输入本次抄表示数'}]" label="本次抄表示数" prop="meterReading">
|
|
|
- <el-input v-model="fillForm.meterReading" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入本次抄表示数" />
|
|
|
+
|
|
|
+ <el-form-item label="本次抄表示数" prop="meterReading">
|
|
|
+ <el-input
|
|
|
+ v-model="fillForm.meterReading"
|
|
|
+ placeholder="请输入本次抄表示数"
|
|
|
+ @input="handleMeterReadingInput"
|
|
|
+ >
|
|
|
+ <template slot="append">{{ activeTab === 'first' ? 'kWh' : 'm³' }}</template>
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="综合倍率" prop="magnification">
|
|
|
- <el-input disabled :value="fillForm.magnification" />
|
|
|
+
|
|
|
+ <el-form-item label="综合倍率">
|
|
|
+ <el-input disabled :value="fillForm.magnification || 1" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="`参考增量(${activeTab==='first'?'度':'吨'})`">
|
|
|
- <el-input disabled :value="increase" />
|
|
|
+
|
|
|
+ <el-form-item :label="`参考增量`">
|
|
|
+ <el-input disabled :value="formatNumber(increase)">
|
|
|
+ <template slot="append">{{ activeTab === 'first' ? 'kWh' : 'm³' }}</template>
|
|
|
+ </el-input>
|
|
|
+ <div v-if="increaseWarning" class="warning-text">
|
|
|
+ <i class="el-icon-warning"></i>
|
|
|
+ {{ increaseWarning }}
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitFillForm">确 定</el-button>
|
|
|
<el-button @click="fillCancel">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitFillForm" :loading="submitLoading">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</el-col>
|
|
@@ -91,60 +228,51 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listDevice } from '@/api/device/meterDevice'
|
|
|
import { listMeterReadingByParam, getLastRecord, addMeterReading, updateMeterReading } from '@/api/device/meterRead'
|
|
|
import { getDeviceTree } from '@/api/device/meterDevice'
|
|
|
-import Treeselect from '@riophae/vue-treeselect'
|
|
|
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
import { dateFormat } from '@/utils/index.js'
|
|
|
+
|
|
|
export default {
|
|
|
- name: 'Device',
|
|
|
- components: { Treeselect },
|
|
|
+ name: 'ManualMeterReading',
|
|
|
data() {
|
|
|
const nowDay = new Date()
|
|
|
return {
|
|
|
+ // 当前月份
|
|
|
currentMonth: dateFormat(nowDay, 'yyyyMM'),
|
|
|
+ // 当前激活的标签页
|
|
|
activeTab: 'first',
|
|
|
// 遮罩层
|
|
|
- loading: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 计量设备表格数据
|
|
|
- deviceList: [],
|
|
|
- // 弹出层标题
|
|
|
- title: '',
|
|
|
- // 记录表单开启
|
|
|
- recListOpen: false,
|
|
|
+ loading: false,
|
|
|
+ // 提交中
|
|
|
+ submitLoading: false,
|
|
|
// 填报表单开启
|
|
|
fillFormOpen: false,
|
|
|
// 区域名称
|
|
|
- areaName: undefined,
|
|
|
+ areaName: '',
|
|
|
+ // 树形数据
|
|
|
areaOptions: [],
|
|
|
+ // 树形控件配置
|
|
|
defaultProps: {
|
|
|
children: 'children',
|
|
|
label: 'label'
|
|
|
},
|
|
|
- // 能源分类树
|
|
|
- emsClsOptions: [
|
|
|
- { code: 45, name: '电表' },
|
|
|
- { code: 70, name: '水表' }
|
|
|
- ],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- areaCode: null,
|
|
|
- deviceCode: null,
|
|
|
- deviceName: null,
|
|
|
- meterCls: 45
|
|
|
+ meterCls: 45 // 45-电表,70-水表
|
|
|
},
|
|
|
- // 电表表单参数
|
|
|
+ // 当前选中的设备
|
|
|
+ currentDevice: null,
|
|
|
+ // 当前设备名称
|
|
|
+ currentDeviceName: '',
|
|
|
+ // 抄表历史表单
|
|
|
recListForm: {
|
|
|
- year: '',
|
|
|
+ year: dateFormat(nowDay, 'yyyy'),
|
|
|
deviceCode: '',
|
|
|
recList: []
|
|
|
},
|
|
|
+ // 填报表单标题
|
|
|
fillTitle: '',
|
|
|
+ // 填报表单
|
|
|
fillForm: {
|
|
|
id: '',
|
|
|
deviceCode: '',
|
|
@@ -154,265 +282,626 @@ export default {
|
|
|
meterTime: '',
|
|
|
meterReading: '',
|
|
|
increase: '',
|
|
|
- magnification: 1
|
|
|
+ magnification: 1,
|
|
|
+ selectedMonth: '' // 新增:选择的抄表月份
|
|
|
},
|
|
|
- curRow: {},
|
|
|
- ifAdd: true // 判断 新增还是修改
|
|
|
+ // 填报表单校验规则
|
|
|
+ fillRules: {
|
|
|
+ selectedMonth: [
|
|
|
+ { required: true, message: '请选择抄表月份', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ meterReading: [
|
|
|
+ { required: true, message: '请输入本次抄表示数', trigger: 'blur' },
|
|
|
+ { validator: this.validateMeterReading, trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ // 是否新增
|
|
|
+ ifAdd: true,
|
|
|
+ // 是否有手动抄表设备
|
|
|
+ hasManualDevices: false,
|
|
|
+ // 显示空提示
|
|
|
+ showEmptyTip: false,
|
|
|
+ // 月份选择器配置
|
|
|
+ monthPickerOptions: {
|
|
|
+ disabledDate: (date) => {
|
|
|
+ // 禁用未来月份(超过当前月份的不允许选择)
|
|
|
+ const currentDate = new Date()
|
|
|
+ const currentYear = currentDate.getFullYear()
|
|
|
+ const currentMonth = currentDate.getMonth()
|
|
|
+
|
|
|
+ return date.getTime() > new Date(currentYear, currentMonth).getTime()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 月份警告信息
|
|
|
+ monthWarning: '',
|
|
|
+ // 已存在的月份记录(用于检查冲突)
|
|
|
+ existingMonths: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 计算增量
|
|
|
increase() {
|
|
|
const { meterReading, magnification, lastReading } = this.fillForm
|
|
|
if (meterReading && magnification) {
|
|
|
- return (meterReading - (lastReading || 0)) * magnification
|
|
|
+ const reading = parseFloat(meterReading) || 0
|
|
|
+ const last = parseFloat(lastReading) || 0
|
|
|
+ const mag = parseFloat(magnification) || 1
|
|
|
+ return (reading - last) * mag
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+ },
|
|
|
+ // 增量警告
|
|
|
+ increaseWarning() {
|
|
|
+ if (this.increase < 0) {
|
|
|
+ return '增量为负数,请检查抄表示数是否正确'
|
|
|
+ }
|
|
|
+ if (this.increase === 0 && this.fillForm.meterReading) {
|
|
|
+ return '增量为0,请确认是否正常'
|
|
|
}
|
|
|
return ''
|
|
|
+ },
|
|
|
+ // 空提示描述
|
|
|
+ emptyDescription() {
|
|
|
+ return this.activeTab === 'first'
|
|
|
+ ? '暂无手动抄表电表设备'
|
|
|
+ : '暂无手动抄表水表设备'
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getAreaTreeSelect().then(() => {
|
|
|
- this.getList();
|
|
|
- /** 自动触发第一个 id 非 null 的树节点*/
|
|
|
- this.$nextTick(() => {
|
|
|
- const firstValidNode = this.findFirstValidNode(this.areaOptions);
|
|
|
- if (firstValidNode) {
|
|
|
- this.handleNodeClick(firstValidNode);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
+ this.init()
|
|
|
},
|
|
|
methods: {
|
|
|
- /** 查询计量设备列表 */
|
|
|
- getList() {
|
|
|
+ // 初始化
|
|
|
+ async init() {
|
|
|
+ await this.getAreaTreeSelect()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取设备树
|
|
|
+ async getAreaTreeSelect() {
|
|
|
this.loading = true
|
|
|
- listDevice(this.queryParams).then(response => {
|
|
|
- this.deviceList = response.rows.map(item=>({
|
|
|
- ...item,
|
|
|
- meterMonth:'',
|
|
|
- lastTime:'',
|
|
|
- lastReading:'',
|
|
|
- }))
|
|
|
- this.total = response.total
|
|
|
- this.loading = false
|
|
|
- this.deviceList.forEach(async item => {
|
|
|
- await getLastRecord(item.areaCode, item.deviceCode).then(({ data }) => {
|
|
|
- if (data) {
|
|
|
- item.lastTime = data.meterTime
|
|
|
- item.meterMonth = data.meterMonth
|
|
|
- item.lastReading = data.meterReading
|
|
|
+ try {
|
|
|
+ // colMode=1 表示获取手动抄表类型的设备
|
|
|
+ const response = await getDeviceTree(0, this.queryParams.meterCls, 1)
|
|
|
+ this.areaOptions = response.data || []
|
|
|
+
|
|
|
+ // 判断是否有手动抄表设备
|
|
|
+ this.hasManualDevices = this.hasDevicesInTree(this.areaOptions)
|
|
|
+ this.showEmptyTip = !this.hasManualDevices
|
|
|
+
|
|
|
+ if (this.hasManualDevices) {
|
|
|
+ // 自动选择第一个设备节点
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const firstDeviceNode = this.findFirstDeviceNode(this.areaOptions)
|
|
|
+ if (firstDeviceNode) {
|
|
|
+ this.handleNodeClick(firstDeviceNode)
|
|
|
+ // 高亮选中的节点
|
|
|
+ this.$refs.tree.setCurrentKey(firstDeviceNode.id)
|
|
|
}
|
|
|
})
|
|
|
- })
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1
|
|
|
- this.getList()
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- this.resetForm('queryForm')
|
|
|
- this.handleQuery()
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取设备树失败:', error)
|
|
|
+ this.$message.error('获取设备数据失败')
|
|
|
+ this.areaOptions = []
|
|
|
+ this.hasManualDevices = false
|
|
|
+ this.showEmptyTip = true
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
},
|
|
|
- handleTabChange() {
|
|
|
- if (this.activeTab === 'first') {
|
|
|
- // 电表抄表
|
|
|
- this.queryParams.meterCls = '45'
|
|
|
- } else if (this.activeTab === 'second') {
|
|
|
- // 水表抄表
|
|
|
- this.queryParams.meterCls = '70'
|
|
|
+
|
|
|
+ // 检查树中是否有设备
|
|
|
+ hasDevicesInTree(nodes) {
|
|
|
+ for (const node of nodes) {
|
|
|
+ if (node.type === 'device') {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ if (this.hasDevicesInTree(node.children)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- /** 清理数据*/
|
|
|
- this.recListForm = {
|
|
|
- year: '',
|
|
|
- deviceCode: '',
|
|
|
- recList: []
|
|
|
- };
|
|
|
- this.fillForm = this.$options.data().fillForm;
|
|
|
- this.fillFormOpen = false;
|
|
|
- this.getAreaTreeSelect() // 重新加载设备树
|
|
|
- this.handleQuery()
|
|
|
+ return false
|
|
|
},
|
|
|
|
|
|
- async getAreaTreeSelect() {
|
|
|
- await getDeviceTree(0, this.queryParams.meterCls, 1).then(response => {
|
|
|
- this.areaOptions = response.data || []
|
|
|
- }).catch(error => {
|
|
|
- console.error('获取设备树失败:', error)
|
|
|
- })
|
|
|
+ // 查找第一个设备节点
|
|
|
+ findFirstDeviceNode(nodes) {
|
|
|
+ for (const node of nodes) {
|
|
|
+ if (node.type === 'device') {
|
|
|
+ return node
|
|
|
+ }
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ const foundNode = this.findFirstDeviceNode(node.children)
|
|
|
+ if (foundNode) return foundNode
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null
|
|
|
},
|
|
|
|
|
|
- // 筛选节点
|
|
|
+ // 筛选树节点
|
|
|
filterNode(value, data) {
|
|
|
if (!value) return true
|
|
|
return data.label.indexOf(value) !== -1
|
|
|
},
|
|
|
- // 节点单击事件
|
|
|
+
|
|
|
+ // 过滤树
|
|
|
+ filterTree() {
|
|
|
+ this.$refs.tree.filter(this.areaName)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 节点点击事件
|
|
|
handleNodeClick(data) {
|
|
|
- if (data.id === null) {
|
|
|
- this.$message.warning('该节点不是设备不可点击');
|
|
|
- return;
|
|
|
+ // 只处理设备节点
|
|
|
+ if (data.type !== 'device') {
|
|
|
+ return
|
|
|
}
|
|
|
- this.recListForm.year = dateFormat(new Date(), 'yyyy')
|
|
|
+
|
|
|
+ this.currentDevice = data
|
|
|
+ this.currentDeviceName = data.label
|
|
|
this.recListForm.deviceCode = data.id
|
|
|
- listMeterReadingByParam({
|
|
|
- deviceCode: data.id,
|
|
|
- year: dateFormat(new Date(), 'yyyy'),
|
|
|
- orderFlag: 'desc'
|
|
|
- }).then(response => {
|
|
|
- this.recListForm.recList = response.data || []
|
|
|
- this.curRow = this.recListForm.recList;
|
|
|
- })
|
|
|
- },
|
|
|
- /** 第一个 id 非 null 的节点*/
|
|
|
- findFirstValidNode(nodes) {
|
|
|
- for (const node of nodes) {
|
|
|
- if (node.id !== null) {
|
|
|
- return node;
|
|
|
- }
|
|
|
- if (node.children && node.children.length > 0) {
|
|
|
- const foundNode = this.findFirstValidNode(node.children);
|
|
|
- if (foundNode) return foundNode;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
+
|
|
|
+ // 获取该设备的抄表历史
|
|
|
+ this.getHistoryList()
|
|
|
},
|
|
|
|
|
|
- getHistoryList() {
|
|
|
+ // 获取历史记录列表
|
|
|
+ async getHistoryList() {
|
|
|
+ if (!this.recListForm.deviceCode) {
|
|
|
+ this.recListForm.recList = []
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- listMeterReadingByParam({
|
|
|
- deviceCode: this.recListForm.deviceCode,
|
|
|
- year: this.recListForm.year,
|
|
|
- orderFlag: 'desc'
|
|
|
- }).then(response => {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ const response = await listMeterReadingByParam({
|
|
|
+ deviceCode: this.recListForm.deviceCode,
|
|
|
+ year: this.recListForm.year,
|
|
|
+ orderFlag: 'desc'
|
|
|
+ })
|
|
|
this.recListForm.recList = response.data || []
|
|
|
- })
|
|
|
+
|
|
|
+ // 更新已存在的月份列表
|
|
|
+ this.existingMonths = this.recListForm.recList.map(item => item.meterMonth)
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取历史记录失败:', error)
|
|
|
+ this.$message.error('获取历史记录失败')
|
|
|
+ this.recListForm.recList = []
|
|
|
+ this.existingMonths = []
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
- /** 新填报*/
|
|
|
- handleRecord() {
|
|
|
- this.fillForm = this.$options.data().fillForm;
|
|
|
- this.resetForm('fillForm');
|
|
|
- this.fillTitle = '填报抄表记录';
|
|
|
-
|
|
|
- /** 获取最新抄表记录*/
|
|
|
- const latestRecord = this.recListForm.recList[0];
|
|
|
- if (!latestRecord) {
|
|
|
- this.$modal.msgError('没有可填报的记录');
|
|
|
- return;
|
|
|
+ // Tab切换处理
|
|
|
+ async handleTabChange() {
|
|
|
+ // 切换计量类型
|
|
|
+ this.queryParams = {
|
|
|
+ meterCls: this.activeTab === 'first' ? '45' : '70'
|
|
|
}
|
|
|
|
|
|
- // 填充填报表单数据
|
|
|
- this.fillForm.deviceCode = this.recListForm.deviceCode;
|
|
|
- this.fillForm.areaCode = latestRecord.areaCode;
|
|
|
- this.fillForm.magnification = latestRecord.magnification || 1;
|
|
|
- this.fillForm.lastTime = latestRecord.meterTime;
|
|
|
- this.fillForm.lastReading = latestRecord.meterReading;
|
|
|
- this.fillFormOpen = true; // 打开填报表单
|
|
|
+ // 重置数据
|
|
|
+ this.currentDevice = null
|
|
|
+ this.currentDeviceName = ''
|
|
|
+ this.recListForm.deviceCode = ''
|
|
|
+ this.recListForm.recList = []
|
|
|
+ this.fillForm = this.$options.data().fillForm
|
|
|
+ this.fillFormOpen = false
|
|
|
+ this.existingMonths = []
|
|
|
+
|
|
|
+ // 重新加载设备树
|
|
|
+ await this.getAreaTreeSelect()
|
|
|
},
|
|
|
- // async handleRecord(row) {
|
|
|
- // this.fillForm = this.$options.data().fillForm
|
|
|
- // this.resetForm('fillForm')
|
|
|
- // this.fillTitle = row.deviceName
|
|
|
- // this.fillForm.deviceCode = row.deviceCode
|
|
|
- // this.fillForm.areaCode = row.areaCode
|
|
|
- // this.fillForm.magnification = row.magnification
|
|
|
- // this.fillForm.lastTime = row.lastTime
|
|
|
- // this.fillForm.lastReading = row.lastReading
|
|
|
- // this.ifAdd = true
|
|
|
- // let existFlag = false
|
|
|
- // // 获取上次填报记录
|
|
|
- // await getLastRecord(row.areaCode, row.deviceCode).then(({ data }) => {
|
|
|
- // if (data) {
|
|
|
- // if (data.meterMonth === this.currentMonth) {
|
|
|
- // existFlag = true
|
|
|
- // } else {
|
|
|
- // this.fillForm.lastTime = data.meterTime
|
|
|
- // this.fillForm.lastReading = data.meterReading
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // if (row.meterMonth===this.currentMonth) {
|
|
|
- // this.$modal.msgError('当前月份已填报')
|
|
|
- // } else {
|
|
|
- // this.fillFormOpen = true
|
|
|
- // // }
|
|
|
- // },
|
|
|
+
|
|
|
+ // 判断是否可以编辑(只能编辑当月记录)
|
|
|
canEdit(meterMonth) {
|
|
|
return meterMonth === this.currentMonth
|
|
|
},
|
|
|
- canFill (lastTime) {
|
|
|
- return dateFormat(new Date(lastTime),'yyyyMM')!==this.currentMonth
|
|
|
+
|
|
|
+ // 新增填报
|
|
|
+ async handleRecord() {
|
|
|
+ if (!this.currentDevice) {
|
|
|
+ this.$message.warning('请先选择设备')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.ifAdd = true
|
|
|
+ this.fillForm = this.$options.data().fillForm
|
|
|
+ this.fillTitle = `填报抄表记录 - ${this.currentDeviceName}`
|
|
|
+ this.monthWarning = ''
|
|
|
+
|
|
|
+ // 设置基础信息
|
|
|
+ this.fillForm.deviceCode = this.currentDevice.id
|
|
|
+ this.fillForm.areaCode = this.getAreaCode(this.currentDevice)
|
|
|
+
|
|
|
+ // 默认选择当前月份(但用户可以修改)
|
|
|
+ this.fillForm.selectedMonth = this.currentMonth
|
|
|
+
|
|
|
+ // 获取最新的抄表记录作为上次记录
|
|
|
+ this.updateLastReadingInfo()
|
|
|
+
|
|
|
+ this.fillFormOpen = true
|
|
|
},
|
|
|
- /**新修改*/
|
|
|
+
|
|
|
+ // 修改记录
|
|
|
updateRecord(row) {
|
|
|
- this.ifAdd = false;
|
|
|
- this.fillFormOpen = true;
|
|
|
- this.fillForm = this.$options.data().fillForm;
|
|
|
- this.resetForm('fillForm');
|
|
|
- this.fillTitle = `修改抄表记录 - ${row.deviceCode}`;
|
|
|
-
|
|
|
- // 获取当前选中的设备信息
|
|
|
- const currentDevice = this.recListForm.recList.find(
|
|
|
- (item) => item.deviceCode === row.deviceCode
|
|
|
- );
|
|
|
- this.fillForm.deviceCode = row.deviceCode;
|
|
|
- this.fillForm.areaCode = currentDevice.areaCode;
|
|
|
- this.fillForm.magnification = currentDevice.magnification || 1;
|
|
|
- this.fillForm.id = row.id;
|
|
|
- this.fillForm.lastTime = row.meterTime;
|
|
|
- this.fillForm.lastReading = row.meterReading;
|
|
|
- this.fillForm.meterReading = row.meterReading;
|
|
|
+ if (!this.canEdit(row.meterMonth)) {
|
|
|
+ this.$message.warning('只能修改当月的抄表记录')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.ifAdd = false
|
|
|
+ this.fillForm = this.$options.data().fillForm
|
|
|
+ this.fillTitle = `修改抄表记录 - ${this.currentDeviceName}`
|
|
|
+ this.monthWarning = ''
|
|
|
+
|
|
|
+ // 填充表单数据
|
|
|
+ this.fillForm.id = row.id
|
|
|
+ this.fillForm.deviceCode = row.deviceCode
|
|
|
+ this.fillForm.areaCode = row.areaCode
|
|
|
+ this.fillForm.magnification = row.magnification || 1
|
|
|
+ this.fillForm.meterReading = row.meterReading
|
|
|
+ this.fillForm.selectedMonth = row.meterMonth
|
|
|
+
|
|
|
+ // 查找该记录月份之前最近的一条记录作为上次抄表信息
|
|
|
+ this.findPreviousRecord(row.meterMonth)
|
|
|
+
|
|
|
+ this.fillFormOpen = true
|
|
|
},
|
|
|
- // updateRecord(row) {
|
|
|
- // this.ifAdd = false
|
|
|
- // this.fillFormOpen = true
|
|
|
- // this.fillForm = this.$options.data().fillForm
|
|
|
- // this.resetForm('fillForm')
|
|
|
- // this.fillTitle = this.curRow.objName
|
|
|
- // this.fillForm.deviceCode = this.curRow.deviceCode
|
|
|
- // this.fillForm.areaCode = this.curRow.areaCode
|
|
|
- // this.fillForm.magnification = this.curRow.magnification
|
|
|
- // this.fillForm.id = row.id
|
|
|
- // this.fillForm.lastTime = row.lastTime
|
|
|
- // this.fillForm.lastReading = row.lastReading
|
|
|
- // this.fillForm.meterReading = row.meterReading
|
|
|
- // },
|
|
|
+
|
|
|
+ // 处理月份选择变化
|
|
|
+ handleMonthChange(selectedMonth) {
|
|
|
+ if (!selectedMonth) return
|
|
|
+
|
|
|
+ this.monthWarning = ''
|
|
|
+
|
|
|
+ // 检查是否与已存在的记录冲突
|
|
|
+ if (this.ifAdd && this.existingMonths.includes(selectedMonth)) {
|
|
|
+ this.monthWarning = '该月份已存在抄表记录,请选择其他月份或进行修改操作'
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据选择的月份更新上次抄表信息
|
|
|
+ this.updateLastReadingInfo(selectedMonth)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更新上次抄表信息
|
|
|
+ updateLastReadingInfo(selectedMonth = null) {
|
|
|
+ const targetMonth = selectedMonth || this.fillForm.selectedMonth
|
|
|
+ if (!targetMonth || !this.recListForm.recList.length) {
|
|
|
+ // 没有历史记录时
|
|
|
+ this.fillForm.lastTime = ''
|
|
|
+ this.fillForm.lastReading = ''
|
|
|
+ this.fillForm.magnification = 1
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.findPreviousRecord(targetMonth)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 查找指定月份之前的记录作为上次抄表信息
|
|
|
+ findPreviousRecord(targetMonth) {
|
|
|
+ if (!targetMonth || !this.recListForm.recList.length) {
|
|
|
+ this.fillForm.lastTime = ''
|
|
|
+ this.fillForm.lastReading = ''
|
|
|
+ this.fillForm.magnification = this.fillForm.magnification || 1
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查找目标月份之前最近的一条记录
|
|
|
+ const sortedRecords = [...this.recListForm.recList].sort((a, b) => {
|
|
|
+ return b.meterMonth.localeCompare(a.meterMonth)
|
|
|
+ })
|
|
|
+
|
|
|
+ let lastRecord = null
|
|
|
+ for (const record of sortedRecords) {
|
|
|
+ // 跳过当前正在修改的记录(如果是修改操作)
|
|
|
+ if (!this.ifAdd && record.meterMonth === targetMonth) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ if (record.meterMonth < targetMonth) {
|
|
|
+ lastRecord = record
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (lastRecord) {
|
|
|
+ this.fillForm.lastTime = lastRecord.meterTime
|
|
|
+ this.fillForm.lastReading = lastRecord.meterReading
|
|
|
+ // 如果当前记录没有设置倍率,使用上次记录的倍率
|
|
|
+ if (!this.fillForm.magnification) {
|
|
|
+ this.fillForm.magnification = lastRecord.magnification || 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果没找到更早的记录,说明这是最早的记录
|
|
|
+ this.fillForm.lastTime = ''
|
|
|
+ this.fillForm.lastReading = '0'
|
|
|
+ this.fillForm.magnification = this.fillForm.magnification || 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 提交填报表单
|
|
|
submitFillForm() {
|
|
|
- this.$refs['fillForm'].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- this.fillForm.increase = this.increase
|
|
|
+ this.$refs['fillForm'].validate(async valid => {
|
|
|
+ if (!valid) return
|
|
|
+
|
|
|
+ // 检查月份冲突
|
|
|
+ if (this.ifAdd && this.existingMonths.includes(this.fillForm.selectedMonth)) {
|
|
|
+ this.$message.error('该月份已存在抄表记录,请选择其他月份')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.submitLoading = true
|
|
|
+
|
|
|
+ // 设置提交数据
|
|
|
+ const submitData = {
|
|
|
+ ...this.fillForm,
|
|
|
+ increase: this.increase,
|
|
|
+ meterMonth: this.fillForm.selectedMonth, // 使用选择的月份
|
|
|
+ meterTime: this.generateMeterTime(this.fillForm.selectedMonth) // 根据月份生成抄表时间
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
if (this.ifAdd) {
|
|
|
- addMeterReading(this.fillForm).then(({ code, msg }) => {
|
|
|
- if (code === 200) {
|
|
|
- this.$modal.msgSuccess('填报成功')
|
|
|
- this.fillFormOpen = false
|
|
|
- } else {
|
|
|
- this.$modal.msgError(msg)
|
|
|
- }
|
|
|
- })
|
|
|
+ const response = await addMeterReading(submitData)
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.$message.success('填报成功')
|
|
|
+ this.fillFormOpen = false
|
|
|
+ this.getHistoryList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '填报失败')
|
|
|
+ }
|
|
|
} else {
|
|
|
- updateMeterReading(this.fillForm).then(({ code, msg }) => {
|
|
|
- if (code === 200) {
|
|
|
- this.$modal.msgSuccess('修改成功')
|
|
|
- this.getHistoryList()
|
|
|
- this.fillFormOpen = false
|
|
|
- } else {
|
|
|
- this.$modal.msgError(msg)
|
|
|
- }
|
|
|
- })
|
|
|
+ const response = await updateMeterReading(submitData)
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.fillFormOpen = false
|
|
|
+ this.getHistoryList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '修改失败')
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (error) {
|
|
|
+ console.error('提交失败:', error)
|
|
|
+ this.$message.error('操作失败')
|
|
|
+ } finally {
|
|
|
+ this.submitLoading = false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ // 根据月份生成抄表时间(月末日期)
|
|
|
+ generateMeterTime(monthStr) {
|
|
|
+ if (!monthStr || monthStr.length !== 6) return ''
|
|
|
+
|
|
|
+ const year = parseInt(monthStr.substring(0, 4))
|
|
|
+ const month = parseInt(monthStr.substring(4, 6))
|
|
|
+
|
|
|
+ // 获取该月的最后一天
|
|
|
+ const lastDay = new Date(year, month, 0).getDate()
|
|
|
+ return `${year}-${month.toString().padStart(2, '0')}-${lastDay}`
|
|
|
+ },
|
|
|
+
|
|
|
+ // 取消填报
|
|
|
fillCancel() {
|
|
|
this.fillFormOpen = false
|
|
|
+ this.monthWarning = ''
|
|
|
+ this.resetForm('fillForm')
|
|
|
+ },
|
|
|
+
|
|
|
+ // 重置表单
|
|
|
+ resetForm(formName) {
|
|
|
+ if (this.$refs[formName]) {
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 处理抄表示数输入
|
|
|
+ handleMeterReadingInput(value) {
|
|
|
+ // 只允许输入数字和小数点
|
|
|
+ this.fillForm.meterReading = value.replace(/[^\d.]/g, '')
|
|
|
+ },
|
|
|
+
|
|
|
+ // 验证抄表示数
|
|
|
+ validateMeterReading(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('请输入抄表示数'))
|
|
|
+ } else if (isNaN(value)) {
|
|
|
+ callback(new Error('请输入有效的数字'))
|
|
|
+ } else if (parseFloat(value) < 0) {
|
|
|
+ callback(new Error('抄表示数不能为负数'))
|
|
|
+ } else if (this.fillForm.lastReading && parseFloat(value) < parseFloat(this.fillForm.lastReading)) {
|
|
|
+ callback(new Error('本次抄表示数不能小于上次抄表示数'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取区域编码
|
|
|
+ getAreaCode(node) {
|
|
|
+ // 从节点向上查找区域编码
|
|
|
+ // 这里简化处理,实际可能需要递归查找父节点
|
|
|
+ return node.areaCode || node.parentCode || ''
|
|
|
+ },
|
|
|
+
|
|
|
+ // 格式化数字
|
|
|
+ formatNumber(value, decimals = 2) {
|
|
|
+ if (value === null || value === undefined || value === '') return '-'
|
|
|
+ const num = parseFloat(value)
|
|
|
+ if (isNaN(num)) return '-'
|
|
|
+ return num.toFixed(decimals)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 格式化日期
|
|
|
+ formatDate(date) {
|
|
|
+ if (!date) return '-'
|
|
|
+ return dateFormat(new Date(date), 'yyyy-MM-dd')
|
|
|
},
|
|
|
- closeRecList() {
|
|
|
- this.recListOpen = false
|
|
|
+
|
|
|
+ // 格式化月份
|
|
|
+ formatMonth(month) {
|
|
|
+ if (!month || month.length !== 6) return month
|
|
|
+ return `${month.substring(0, 4)}年${month.substring(4, 6)}月`
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+/* 树容器样式 */
|
|
|
+.tree-container {
|
|
|
+ height: calc(100vh - 250px);
|
|
|
+ overflow-y: auto;
|
|
|
+ border: 1px solid #e8e8e8;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 10px;
|
|
|
+ background-color: #fafafa;
|
|
|
+}
|
|
|
+
|
|
|
+/* 树节点样式 */
|
|
|
+.tree-node {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ padding: 4px 0;
|
|
|
+ transition: all 0.3s;
|
|
|
+}
|
|
|
+
|
|
|
+.node-icon {
|
|
|
+ margin-right: 8px;
|
|
|
+ font-size: 16px;
|
|
|
+ transition: color 0.3s;
|
|
|
+}
|
|
|
+
|
|
|
+.area-icon {
|
|
|
+ color: #909399;
|
|
|
+}
|
|
|
+
|
|
|
+.device-icon {
|
|
|
+ color: #409EFF;
|
|
|
+}
|
|
|
+
|
|
|
+.node-label {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
+
|
|
|
+/* 区域节点样式 */
|
|
|
+.area-node {
|
|
|
+ cursor: default;
|
|
|
+ opacity: 0.8;
|
|
|
+}
|
|
|
+
|
|
|
+/* 设备节点样式 */
|
|
|
+.device-node {
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.device-node:hover {
|
|
|
+ background-color: #f0f7ff;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding-left: 4px;
|
|
|
+}
|
|
|
+
|
|
|
+.device-node:hover .device-icon {
|
|
|
+ color: #2b7bff;
|
|
|
+ transform: scale(1.1);
|
|
|
+}
|
|
|
+
|
|
|
+/* 高亮当前选中的节点 */
|
|
|
+.el-tree-node.is-current > .el-tree-node__content .device-node {
|
|
|
+ background-color: #e6f7ff;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding-left: 4px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tree-node.is-current > .el-tree-node__content .device-icon {
|
|
|
+ color: #1890ff;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+
|
|
|
+/* 空提示样式 */
|
|
|
+.empty-tip {
|
|
|
+ margin-top: 20px;
|
|
|
+ text-align: center;
|
|
|
+ color: #909399;
|
|
|
+}
|
|
|
+
|
|
|
+.no-device-container {
|
|
|
+ margin-top: 100px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.empty-footer {
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.empty-footer p {
|
|
|
+ margin: 5px 0;
|
|
|
+ color: #606266;
|
|
|
+}
|
|
|
+
|
|
|
+.empty-footer .sub-text {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #909399;
|
|
|
+}
|
|
|
+
|
|
|
+/* 表格空数据 */
|
|
|
+.table-empty {
|
|
|
+ padding: 40px 0;
|
|
|
+}
|
|
|
+
|
|
|
+/* 警告文字 */
|
|
|
+.warning-text {
|
|
|
+ color: #E6A23C;
|
|
|
+ font-size: 12px;
|
|
|
+ margin-top: 5px;
|
|
|
+}
|
|
|
+
|
|
|
+.warning-text i {
|
|
|
+ margin-right: 4px;
|
|
|
+}
|
|
|
+
|
|
|
+/* 成功文字 */
|
|
|
+.text-success {
|
|
|
+ color: #67C23A;
|
|
|
+ font-weight: 500;
|
|
|
+}
|
|
|
+
|
|
|
+/* 对话框底部 */
|
|
|
+.dialog-footer {
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+
|
|
|
+/* 分隔线样式 */
|
|
|
+.el-divider {
|
|
|
+ margin: 15px 0;
|
|
|
+}
|
|
|
+
|
|
|
+/* 表单项间距调整 */
|
|
|
+.el-form-item {
|
|
|
+ margin-bottom: 18px;
|
|
|
+}
|
|
|
+
|
|
|
+/* 按钮组样式 */
|
|
|
+.button-group {
|
|
|
+ margin-bottom: 15px;
|
|
|
+}
|
|
|
+
|
|
|
+/* 月份选择器样式 */
|
|
|
+ .el-date-editor.el-input {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+/* 响应式布局 */
|
|
|
+@media (max-width: 768px) {
|
|
|
+ .tree-container {
|
|
|
+ height: 200px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-col-xs-24 {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|