123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703 |
- <template>
- <!-- 异常数据维护 -->
- <div class="AbnormalDataMaintenance">
- <div class="box">
- <div class="box-top">
- <el-form
- style="overflow: hidden;"
- :style="filterForm.show ? null : { height: '0px' }"
- size="mini"
- label-width="80px"
- >
- <el-row>
- <el-col :span="6">
- <el-form-item label="日期">
- <zj-timegran-date
- v-model="filterForm.data.clock"
- style="width: 100%;"
- :type="'daterange'"
- :timegranId="filterForm.data.timegranid"
- :oneFoo="getTableData"
- :defaultOffset="-1"
- :custom="1"
- ></zj-timegran-date>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="能介类型">
- <el-select
- filterable
- clearable
- v-model="filterForm.data.energytypeid"
- placeholder="能介类型"
- style="width: 100%;"
- >
- <el-option
- v-for="item of energytypeid.arr"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="能介">
- <el-select
- filterable
- clearable
- v-model="filterForm.data.energyid"
- multiple
- collapse-tags
- placeholder="能介"
- style="width: 100%;"
- >
- <el-option
- v-for="item of nameObj.energyid.arr"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="位置">
- <el-select
- filterable clearable
- v-model="filterForm.data.locateid"
- placeholder="位置"
- multiple
- collapse-tags
- style="width: 100%;"
- >
- <el-option
- v-for="item of nameObj.locateid.arr"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="计量点编号">
- <el-input
- clearable
- v-model.trim="filterForm.data.itemid"
- placeholder="计量点编号"
- style="width: 100%;"
- @keyup.enter.native="getTableData(1)"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="计量点名称">
- <el-input
- clearable
- v-model.trim="filterForm.data.itemname"
- placeholder="计量点名称"
- style="width: 100%;"
- @keyup.enter.native="getTableData(1)"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="box-top-gjl">
- <div style="float:right; text-align: right;">
- <el-button
- class="button"
- type="primary"
- size="mini"
- icon="el-icon-search"
- v-privilege="activeMenu + 'QUERY'"
- @click="getTableData(1)"
- >查询</el-button>
- <el-button
- class="button"
- type="primary"
- size="mini"
- icon="el-icon-refresh"
- v-privilege="activeMenu + 'QUERY'"
- @click="tableDataCancel();"
- >重置</el-button>
- <el-button
- size="mini"
- :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
- :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
- @click="filterForm.show = !filterForm.show;
- $nextTick(() => {
- singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
- }
- );"
- >{{ filterForm.show ? '收起' : '展开' }}</el-button>
- </div>
- </div>
- </div>
- <div class="box-bottom">
- <el-form
- size="mini"
- ref="dialog_form_arr"
- label-width="0px"
- :model="tableFormDataObj"
- >
- <el-table
- stripe
- id="singleTable"
- ref="singleTable"
- :data="tableData"
- v-loading="tableLoading"
- style="width: 100%;"
- :height="singleTableHeight"
- border
- size="mini"
- highlight-current-row
- show-summary
- :summary-method="getSummaries"
- >
- <!-- <el-table-column
- sortable
- type="selection"
- width="40"
- align="center"
- fixed="left"
- ></el-table-column> -->
- <el-table-column
- sortable
- prop="clock"
- label="时间"
- width="140px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="itemid"
- label="计量点编号"
- min-width="100px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="itemname"
- label="计量点名称"
- min-width="120px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="energyid"
- label="能介"
- min-width="100px"
- :show-overflow-tooltip="true"
- > <template slot-scope="scope">
- <span>{{nameObj.energyid.obj[scope.row.energyid] ? nameObj.energyid.obj[scope.row.energyid] : scope.row.energyid }}</span>
- </template>
- </el-table-column>
- <el-table-column
- sortable
- prop="energytypeid"
- label="能介类型"
- width="80px"
- :show-overflow-tooltip="true"
- > <template slot-scope="scope">
- <span>{{energytypeid.obj[scope.row.energytypeid] ? energytypeid.obj[scope.row.energytypeid] : scope.row.energytypeid }}</span>
- </template>
- </el-table-column>
- <el-table-column
- sortable
- prop="extype"
- label="异常数据类型"
- width="100px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="locateid"
- label="位置"
- min-width="80px"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="scope">
- <span>{{nameObj.locateid.obj[scope.row.locateid] ? nameObj.locateid.obj[scope.row.locateid] : scope.row.locateid }}</span>
- </template>
- </el-table-column>
- <el-table-column
- sortable
- prop="maxvalue"
- label="日最大值"
- min-width="90px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="minvalue"
- label="日最小值"
- width="90px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable prop="apportvalue"
- label="最终值"
- width="90px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="befvalue"
- label="仪表变小前值"
- min-width="70px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="curvalue"
- label="仪表当前值"
- min-width="70px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="createtime"
- label="创建时间"
- min-width="100px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="bz"
- label="备注"
- min-width="140px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- </el-table>
- </el-form>
- <el-pagination
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- :page-sizes="[10, 20, 50, 100, 500, 1000]"
- :page-size="pageSize"
- :current-page.sync="pageNum"
- @size-change="tableSizeChange"
- @current-change="getTableData()"
- style="text-align: right;margin-top: 10px;"
- ></el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { zCheckNumber1 } from '~/utils/validator.js'
- import store from '@/store/index.js';
- import timegranDate from '@/components/zg/timegranDate.vue'
- import { formatDate, XtcommonSummaries } from '@/utils/util.js';
- export default {
- name: 'AbnormalDataMaintenance',
- components: {
- 'zj-timegran-date': timegranDate
- },
- data () {
- return {
- multipleSelection: [],
- tableFormDataObj: {},
- store,
- userInfo: {
- data: null
- },
- activeMenu: '',
- filterForm: {
- show: true,
- data: {
- id: '',
- clock: '',
- itemid: '',
- extype: '',
- maxvalue: '',
- minvalue: '',
- apportvalue: '',
- befvalue: '',
- curvalue: '',
- createtime: '',
- itemname: '',
- energyid: '',
- energytypeid: '',
- locateid: '',
- bz: ''
- },
- disabled: {
- locateid: false,
- energyid: false
- },
- rules: {
- }
- },
- pageNum: 1,
- pageSize: 20,
- total: 0,
- singleTableHeight: 200,
- tableData: [],
- loading: false,
- tableLoading: false,
- energytypeid: {
- obj: {
- 'W': '水',
- 'E': '电',
- 'P': '动力'
- },
- arr: [
- {
- id: 'W',
- name: '水'
- },
- {
- id: 'E',
- name: '电'
- },
- {
- id: 'P',
- name: '动力'
- }
- ]
- },
- nameObj: {
- locateid: {
- obj: {},
- arr: []
- },
- energyid: {
- obj: {},
- arr: []
- }
- },
- dialog: {
- editorBox: {
- show: false,
- type: '',
- form: {
- data: {
- locateid: '',
- energyid: ''
- }
- }
- },
- trendChart: {
- show: false,
- size: 7,
- form: {
- data: {
- chartSeriesType: 'bar'
- }
- },
- chart: {
- show: true,
- option: {
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: []
- },
- toolbox: {
- feature: {
- saveAsImage: {}
- }
- },
- xAxis: {
- type: 'category',
- data: []
- },
- yAxis: {
- type: 'value'
- },
- series: [
- ]
- }
- }
- }
- }
- }
- },
- created () {
- this.activeMenu = window.localStorage.getItem('activeMenu');
- },
- mounted () {
- let that = this;
- window.PEDataObj = {
- // 将数据绑定到window上,供main页面使用
- vm: that,
- // tableArr:用于导出成Excel的表格的信息
- tableArr: [
- {
- name: '',
- id: 'singleTable'
- }
- ]
- };
- that.$nextTick(() => {
- // 立即获取的height有一定偏差,通过setTimeout延迟来解决
- setTimeout(() => {
- that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
- }, 1);
- });
- that.store.dispatch('getUserInfo').then((res) => {
- that.userInfo.data = res.data;
- });
- // 接收路由参数
- if (that.$route.query.locateid) {
- that.filterForm.disabled.locateid = true;
- that.filterForm.data.locateid = that.$route.query.locateid;
- }
- if (that.$route.query.energyid) {
- that.filterForm.disabled.energyid = true;
- that.filterForm.data.energyid = that.$route.query.energyid;
- }
- if (that.$route.query.itemtype) {
- that.filterForm.data.itemtype = that.$route.query.itemtype;
- }
- // that.getTableData();
- that.getlocateid();
- that.getenergyid();
- },
- methods: {
- // 计算树区域高度
- getRoleHeight (dom) {
- return window.innerHeight - dom.offsetTop;
- },
- // 自定义的表格合计方法:只给指定列进行合计
- getSummaries (param) {
- const prop = []; // 合计列绑定的prop
- return XtcommonSummaries(param, prop);
- },
- // 获取表格中的数据
- getTableData (pageNum) {
- let that = this,
- params = {
- id: that.filterForm.data.id,
- clock: that.filterForm.data.clock[0],
- clocke: that.filterForm.data.clock[1],
- itemid: that.filterForm.data.itemid,
- itemname: that.filterForm.data.itemname,
- extype: that.filterForm.data.extype,
- maxvalue: that.filterForm.data.maxvalue,
- minvalue: that.filterForm.data.minvalue,
- apportvalue: that.filterForm.data.apportvalue,
- befvalue: that.filterForm.data.befvalue,
- curvalue: that.filterForm.data.curvalue,
- createtime: that.filterForm.data.createtime,
- energytypeid: that.filterForm.data.energytypeid,
- energyid: that.filterForm.data.energyid.toString(),
- locateid: that.filterForm.data.locateid.toString(),
- bz: that.filterForm.data.bz
- };
- that.pageNum = pageNum || that.pageNum;
- that.tableLoading = true;
- let url = 'pass/ems/v1/trmcalpointexvalues/getExData?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
- that.axios.get(url, {
- params: params
- })
- .then(function (res) {
- if (res.code === '0') {
- let arr = [];
- for (let item of res.data.list) {
- arr.push({
- id: item.ID,
- clock: item.CLOCK,
- itemid: item.ITEMID,
- itemname: item.ITEMNAME,
- extype: item.EXTYPE,
- maxvalue: item.MAXVALUE,
- minvalue: item.MINVALUE,
- apportvalue: item.APPORTVALUE,
- befvalue: item.BEFVALUE,
- curvalue: item.CURVALUE,
- createtime: item.CREATETIME,
- energytypeid: item.ENERGYTYPEID,
- energyid: item.ENERGYID,
- locateid: item.LOCATEID,
- bz: item.BZ
- })
- }
- that.tableData = arr;
- that.total = res.data.total;
- } else {
- that.$message.error(res.message);
- }
- that.tableLoading = false;
- that.$nextTick(() => {
- setTimeout(() => {
- that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
- }, 1);
- });
- }).catch(function () {
- that.tableLoading = false;
- });
- },
- // 改变表格显示条数
- tableSizeChange (val) {
- let that = this;
- that.pageSize = val;
- that.getTableData(1);
- },
- // 重置搜索
- tableDataCancel () {
- let that = this;
- for (let key in that.filterForm.data) {
- if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
- if (that.filterForm.data[key] instanceof Array) {
- that.filterForm.data[key] = [];
- } else {
- that.filterForm.data[key] = '';
- }
- }
- }
- that.getTableData(1);
- },
- // 获取位置
- getlocateid () {
- let that = this
- let url = 'pass/ems/v1/trmlocations/getidandname/';
- that.axios.get(url)
- .then(function (res) {
- if (res.code === '0') {
- let arr = [];
- let obj = {};
- for (let item of res.data) {
- arr.push({
- id: item.id,
- name: item.name
- })
- obj[item.id] = item.name;
- }
- that.nameObj.locateid.arr = arr;
- that.nameObj.locateid.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取能介
- getenergyid () {
- let that = this;
- let url = 'pass/ems/v1/trmenergys/selectNameAndId/';
- that.axios.get(url)
- .then(function (res) {
- if (res.code === '0') {
- let arr = [];
- let obj = {};
- for (let item of res.data) {
- arr.push({
- id: item.id,
- name: item.name,
- energytypeid: item.energytypeid,
- unitid: item.unitid
- })
- obj[item.id] = item.name
- }
- that.nameObj.energyid.arr = arr;
- that.nameObj.energyid.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 表格中多选按钮的相关方法
- handleSelectionChange (val) {
- let that = this;
- let tableFormDataObj = {};
- for (let item of that.tableData) {
- item.isSelection = false;
- }
- for (let item of val) {
- let obj = {};
- let xId = item.itemid + '-' + item.clock + '-' + item.timegranid;
- if (that.tableFormDataObj[xId]) {
- tableFormDataObj[xId] = that.tableFormDataObj[xId];
- } else {
- for (let key in item) {
- obj[key] = item[key];
- }
- tableFormDataObj[xId] = obj;
- }
- item.isSelection = true;
- }
- that.tableFormDataObj = tableFormDataObj;
- that.multipleSelection = val;
- },
- look_trendChart () {
- let that = this;
- if (this.multipleSelection && this.multipleSelection.length > 0) {
- that.getTrendChart();
- that.dialog.trendChart.show = true;
- } else {
- this.$message.error('请选择计量点');
- }
- },
- chartSeriesType () {
- let that = this;
- for (let item of that.dialog.trendChart.chart.option.series) {
- item.type = that.dialog.trendChart.form.data.chartSeriesType;
- }
- // that.dialog.trendChart.chart.show = false;
- // setTimeout(() => {
- // that.dialog.trendChart.chart.show = true;
- // }, 100);
- that.$refs['graphical'].setGraphical();
- }
- }
- }
- </script>
- <style lang="less">
- .AbnormalDataMaintenance {
- min-width: 700px;
- height: 100%;
- .box {
- height: 100%;
- padding: 15px 15px 0 15px;
- .box-top {
- .el-form-item {
- margin-bottom: 7px;
- }
- .box-top-gjl {
- overflow: hidden;
- padding: 7px 0;
- border-top: 1px solid #ccc;
- // border-bottom: 1px solid #ccc;
- // margin-bottom: 6px;
- }
- }
- .el-table .el-table__row {
- height: 35px;
- }
- .el-table__body .el-form-item--mini.el-form-item {
- margin: 0px;
- .error {
- overflow: hidden;
- color: #f56c6c;
- font-size: 12px;
- line-height: 1;
- }
- }
- }
- .attribute-box {
- .item {
- border: #ccc 1px solid;
- padding: 5px;
- margin-bottom: 6px;
- .bt {
- font-size: 14px;
- font-weight: 600;
- color: #000;
- padding-left: 10px;
- border-left: #008fe0 5px solid;
- }
- }
- }
- }
- </style>
|