liulingling.177216
2024-08-26 349f1cfc5fa77fbc636d542df0d8050fddec48c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<template>
  <div class="app-container" style="padding:0">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" class="query-form">
      <el-form-item label="指标编码" prop="code">
        <el-input
          v-model="queryParams.code"
          placeholder="请输入指标编码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
          style="width:160px"
        />
      </el-form-item>
 
      <el-form-item label="指标名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入指标名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
          style="width:160px"
        />
      </el-form-item>
      <el-form-item label="时间">
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click=""
          v-hasPermi="['']"
        >导出
        </el-button>
      </el-col>
    </el-row>
    <el-table :data="tableData" v-loading="loading" border @selection-change=""  @cell-click="openDlg" >
      <el-table-column label="指标编码" align="center" prop="name"/>
      <el-table-column label="指标名称" align="center" prop="number"/>
      <el-table-column label="实际值" align="center" prop="value"/>
      <el-table-column label="下限值" align="center" prop="values"/>
      <el-table-column label="上限值" align="center" prop="code"/>
      <el-table-column label="报警次数" align="center" prop="what">
        <template slot-scope="scope">
          <div style="color:blue;text-decoration:underline ;cursor:pointer">{{scope.row.what}}</div>
        </template>
      </el-table-column>
    </el-table>
    <!--弹框-->
    <el-dialog :title="title" :visible.sync="open" width="1000px" :close-on-click-modal="false"  >
      <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
        <line-chart :chart-data="lineChartData" />
      </el-row>
      <el-table  :data="tableData"   :show-header="hiddenTableHeader"  border="1px" >
        <el-table-column label="报警时间"prop="one"  />
        <el-table-column label="报警值"  prop="two"  />
        <el-table-column label="实际值"  prop="three"  />
        <el-table-column label="实际值"  prop="four"  />
        <el-table-column label="实际值"  prop="five"  />
        <el-table-column label="实际值"  prop="six"  />
        <el-table-column label="实际值"  prop="seven"  />
        <el-table-column label="实际值"  prop="eieght"  />
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
 
  </div>
</template>
 
 
<script>
  const lineChartData = {
    newVisitis: {
    }
  }
  import {
    addEnergyindex,
    delEnergyindex,
    exportEnergyindex,
    getEnergyindex,
    listEnergyindex,
    updateEnergyindex
  } from "@/api/basicsetting/energyindex";
  import LineChart from './LiChart'
 
 
 
  export default {
    name: 'energyIndex',
    components: {
      LineChart
    },
    data() {
      return {
        hiddenTableHeader:false,
        lineChartData: lineChartData.newVisitis,
        // 遮罩层
        loading: false,
        // 选中数组
        ids: [],
        dateRange: [],
        names: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 总条数
        total: 0,
        // 指标信息表格数据
        List: [],
        energyindexList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 主键字典
        indexIdOptions: [],
        // 指标名称字典
        nameOptions: [],
        // 指标编码字典
        codeOptions: [],
        // 系统指标分类,1-能源类,2-产品类,3-能效类,4-经营类,5-其他字典
        indexCategoryOptions: [],
        // 备注字典
        remarkOptions: [],
        // 单位字典
        unitIdOptions: [],
        // 查询参数
        lineChartData:{
          newVisitis:null,
        },
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          name: undefined,
          code: undefined,
          indexCategory: undefined,
          nodeId: undefined
        },
 
        tableData: [],
        datas: [{
          name: 'BUG',
          number: '98013',
          value: '500',
          values: '450',
          code: '480',
          what: '5',
          one: '报警时间',
          two: '0点',
          three: '1点',
          four : '2点',
          five :'3点',
          six : '4点',
          seven :'5点',
          eieght:'6点',
        },
          {
            name: 'BUG',
            number: '98013',
            value : '500',
            values : '450',
            code : '480',
            what: '5',
            one :'报警限值',
            two :'210',
            three :'172',
            four : '181',
            five :'224',
            six : '280',
            seven :'310',
            eieght:'300',
        },
       {
         name: 'BUG',
           number: '98013',
         value : '500',
         values : '450',
         code : '480' ,
         what: '5',
         one :'报警时值',
         two :'300',
         three :'182',
         four : '191',
         five :'234',
         six : '290',
         seven :'330',
         eieght:'310',
       }
        ],
 
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          name: [
            {required: true, message: "指标名称不能为空", trigger: "blur"},
            {min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur'}
          ], code: [
            {required: true, message: "指标编码不能为空", trigger: "blur"},
            {min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur'},
            {pattern: /^[a-zA-Z][A-Za-z0-9_-]+$/, message: '必须为数字、字母、- 或_ ,且首字符只能为字母'}
          ], indexCategory: [
            {required: true, message: "请选择指标分类", trigger: "blur"}
          ]
        },
        currentNode: undefined,
        indexCategoryDefaultVal: undefined,
        unitDefaultVal: undefined
      };
    },
 
    created() {
      /*  this.getList();*/
      this.getDicts("sys_index_category").then(response => {
        this.indexCategoryOptions = response.data;
        this.indexCategoryDefaultVal = this.indexCategoryOptions.find(f => f.isDefault === 'Y');
      });
      this.getDicts("sys_unit").then(response => {
        this.unitIdOptions = response.data;
        this.unitDefaultVal = this.unitIdOptions.find(f => f.isDefault === 'Y');
      });
      setInterval(this.getList(), 30000);
 
      this.bpy()
 
    },
    methods: {
      /** 查询指标信息列表 */
      getList(modelNode) {
        this.currentNode = modelNode;
        if (modelNode) {
          this.loading = true;
          this.queryParams.nodeId = modelNode.id;
          listEnergyindex(this.queryParams).then(response => {
            this.energyindexList = response.rows;
            this.total = response.total;
            this.loading = false;
          });
        } else {
          this.energyindexList = [];
        }
 
      },
      bpy() {
        this.tableData = this.datas;
      },
      /** 查看按钮操作 */
      handleUpdate(row) {
        this.reset();
        const indexId = row.indexId || this.ids;
        /*  getEnergyindex(indexId).then(response => {
            this.form = response.data;
    this.title = "异常信息"+  response.data.name ;
          });*/
 
        this.open = true;
      /*  this.title = "报警明细";*/
      },
      // 系统指标分类,1-能源类,2-产品类,3-能效类,4-经营类,5-其他字典翻译
      indexCategoryFormat(row, column) {
        return this.selectDictLabel(this.indexCategoryOptions, row.indexCategory);
      },
 
      // 单位字典翻译
      unitIdFormat(row, column) {
        return this.selectDictLabel(this.unitIdOptions, row.unitId);
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          indexId: undefined,
          name: undefined,
          code: undefined,
          indexCategory: undefined,
          remark: undefined,
          unitId: undefined
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList(this.currentNode);
      },
      openDlg (){
        this.open=true;
      }
    }
 
  };
</script>