能源
This commit is contained in:
		@@ -187,8 +187,11 @@
 | 
			
		||||
					@click="resetBtn">
 | 
			
		||||
					重置
 | 
			
		||||
				</el-button>
 | 
			
		||||
				<span class="separateStyle"></span>
 | 
			
		||||
				<span
 | 
			
		||||
					class="separateStyle"
 | 
			
		||||
					v-hasPermi="['analysis:contrast-analysis:export']"></span>
 | 
			
		||||
				<el-button
 | 
			
		||||
					v-hasPermi="['analysis:contrast-analysis:export']"
 | 
			
		||||
					type="primary"
 | 
			
		||||
					size="small"
 | 
			
		||||
					plain
 | 
			
		||||
 
 | 
			
		||||
@@ -80,10 +80,13 @@
 | 
			
		||||
			</el-button>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<span class="separateStyle"></span>
 | 
			
		||||
			<span
 | 
			
		||||
				class="separateStyle"
 | 
			
		||||
				v-hasPermi="['analysis:qoq-analysis:export']"></span>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<el-button
 | 
			
		||||
				v-hasPermi="['analysis:qoq-analysis:export']"
 | 
			
		||||
				type="primary"
 | 
			
		||||
				size="small"
 | 
			
		||||
				@click="exportData"
 | 
			
		||||
 
 | 
			
		||||
@@ -170,8 +170,11 @@
 | 
			
		||||
					@click="resetBtn">
 | 
			
		||||
					重置
 | 
			
		||||
				</el-button>
 | 
			
		||||
				<span class="separateStyle"></span>
 | 
			
		||||
				<span
 | 
			
		||||
					class="separateStyle"
 | 
			
		||||
					v-hasPermi="['analysis:trend-analysis:export']"></span>
 | 
			
		||||
				<el-button
 | 
			
		||||
					v-hasPermi="['analysis:trend-analysis:export']"
 | 
			
		||||
					type="primary"
 | 
			
		||||
					size="small"
 | 
			
		||||
					plain
 | 
			
		||||
 
 | 
			
		||||
@@ -69,10 +69,13 @@
 | 
			
		||||
			</el-button>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<span class="separateStyle"></span>
 | 
			
		||||
			<span
 | 
			
		||||
				class="separateStyle"
 | 
			
		||||
				v-hasPermi="['analysis:yoy-analysis:export']"></span>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<el-button
 | 
			
		||||
				v-hasPermi="['analysis:yoy-analysis:export']"
 | 
			
		||||
				type="primary"
 | 
			
		||||
				size="small"
 | 
			
		||||
				@click="exportData"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,197 +1,219 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
 | 
			
		||||
      :max-height="tableH">
 | 
			
		||||
      <method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
 | 
			
		||||
        @clickBtn="handleClick" />
 | 
			
		||||
    </base-table>
 | 
			
		||||
    <pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
 | 
			
		||||
      @pagination="getList" />
 | 
			
		||||
    <!-- 新增 -->
 | 
			
		||||
    <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel"
 | 
			
		||||
      @confirm="handleConfirm" :before-close="handleCancel">
 | 
			
		||||
      <energy-plc-add ref="energyPlc" @successSubmit="successSubmit" />
 | 
			
		||||
    </base-dialog>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<search-bar
 | 
			
		||||
			:formConfigs="formConfig"
 | 
			
		||||
			ref="searchBarForm"
 | 
			
		||||
			@headBtnClick="buttonClick" />
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
		<base-table
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
				:width="80"
 | 
			
		||||
				label="操作"
 | 
			
		||||
				:method-list="tableBtn"
 | 
			
		||||
				@clickBtn="handleClick" />
 | 
			
		||||
		</base-table>
 | 
			
		||||
		<pagination
 | 
			
		||||
			:page.sync="queryParams.pageNo"
 | 
			
		||||
			:limit.sync="queryParams.pageSize"
 | 
			
		||||
			:total="total"
 | 
			
		||||
			@pagination="getList" />
 | 
			
		||||
		<!-- 新增 -->
 | 
			
		||||
		<base-dialog
 | 
			
		||||
			:dialogTitle="addOrEditTitle"
 | 
			
		||||
			:dialogVisible="centervisible"
 | 
			
		||||
			@cancel="handleCancel"
 | 
			
		||||
			@confirm="handleConfirm"
 | 
			
		||||
			:before-close="handleCancel">
 | 
			
		||||
			<energy-plc-add
 | 
			
		||||
				ref="energyPlc"
 | 
			
		||||
				@successSubmit="successSubmit" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc";
 | 
			
		||||
// import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import EnergyPlcAdd from './components/energyPlcAdd.vue'
 | 
			
		||||
import { getEnergyPlcPage, deleteEnergyPlc } from '@/api/base/energyPlc';
 | 
			
		||||
import EnergyPlcAdd from './components/energyPlcAdd.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'plcTableName',
 | 
			
		||||
    label: '关联表名',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'code',
 | 
			
		||||
    label: '关联表编码',
 | 
			
		||||
    minWidth: 150,
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'name',
 | 
			
		||||
    label: '标识名',
 | 
			
		||||
    minWidth: 150,
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'enName',
 | 
			
		||||
    label: '英文标识名'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'collection',
 | 
			
		||||
    label: '是否采集'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'description',
 | 
			
		||||
    label: '描述',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'plcTableName',
 | 
			
		||||
		label: '关联表名',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '关联表编码',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '标识名',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'enName',
 | 
			
		||||
		label: '英文标识名',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'collection',
 | 
			
		||||
		label: '是否采集',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'description',
 | 
			
		||||
		label: '描述',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyPlc",
 | 
			
		||||
  components: { EnergyPlcAdd },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'input',
 | 
			
		||||
          label: '标识名',
 | 
			
		||||
          placeholder: '标识名',
 | 
			
		||||
          param: 'name'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separate'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
 | 
			
		||||
          btnName: '新增',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'success',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableBtn: [
 | 
			
		||||
        this.$auth.hasPermi('base:energy-plc:update')
 | 
			
		||||
          ? {
 | 
			
		||||
            type: 'edit',
 | 
			
		||||
            btnName: '编辑'
 | 
			
		||||
          }
 | 
			
		||||
          : undefined,
 | 
			
		||||
        this.$auth.hasPermi('base:energy-plc:delete')
 | 
			
		||||
          ? {
 | 
			
		||||
            type: 'delete',
 | 
			
		||||
            btnName: '删除'
 | 
			
		||||
          }
 | 
			
		||||
          : undefined
 | 
			
		||||
      ].filter((v) => v),
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      collectionList: [
 | 
			
		||||
        { value: 0, label: '否' },
 | 
			
		||||
        { value: 1, label: '是' }
 | 
			
		||||
      ],
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      addOrEditTitle: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        name: null
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
    this.getList();
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.queryParams.name = val.name
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.addOrEditTitle = '新增'
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyPlc.init()
 | 
			
		||||
          })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      getEnergyPlcPage(this.queryParams).then(response => {
 | 
			
		||||
        let arr = response.data.list || [];
 | 
			
		||||
        arr && arr.map(item => {
 | 
			
		||||
          this.collectionList.map(i => {
 | 
			
		||||
            if (item.collection === i.value) {
 | 
			
		||||
              item.collection = i.label
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        })
 | 
			
		||||
        this.list = arr
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      switch (val.type) {
 | 
			
		||||
        case 'edit':
 | 
			
		||||
          this.addOrEditTitle = '编辑'
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyPlc.init(val.data.id)
 | 
			
		||||
          })
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.handleDelete(val.data)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    handleCancel() {
 | 
			
		||||
      this.$refs.energyPlc.formClear()
 | 
			
		||||
      this.centervisible = false
 | 
			
		||||
      this.addOrEditTitle = ''
 | 
			
		||||
    },
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.energyPlc.submitForm()
 | 
			
		||||
    },
 | 
			
		||||
    successSubmit() {
 | 
			
		||||
      this.handleCancel()
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function () {
 | 
			
		||||
        return deleteEnergyPlc(row.id);
 | 
			
		||||
      }).then(() => {
 | 
			
		||||
        this.queryParams.pageNo = 1;
 | 
			
		||||
        this.getList();
 | 
			
		||||
        this.$modal.msgSuccess("删除成功");
 | 
			
		||||
      }).catch(() => { });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyPlc',
 | 
			
		||||
	components: { EnergyPlcAdd },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '标识名',
 | 
			
		||||
					placeholder: '标识名',
 | 
			
		||||
					param: 'name',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'success',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('base:energy-plc:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '编辑',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('base:energy-plc:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			collectionList: [
 | 
			
		||||
				{ value: 0, label: '否' },
 | 
			
		||||
				{ value: 1, label: '是' },
 | 
			
		||||
			],
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 弹出层标题
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				name: null,
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.queryParams.name = val.name;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.addOrEditTitle = '新增';
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyPlc.init();
 | 
			
		||||
					});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyPlcPage(this.queryParams).then((response) => {
 | 
			
		||||
				let arr = response.data.list || [];
 | 
			
		||||
				arr &&
 | 
			
		||||
					arr.map((item) => {
 | 
			
		||||
						this.collectionList.map((i) => {
 | 
			
		||||
							if (item.collection === i.value) {
 | 
			
		||||
								item.collection = i.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(val) {
 | 
			
		||||
			switch (val.type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.addOrEditTitle = '编辑';
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyPlc.init(val.data.id);
 | 
			
		||||
					});
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.handleDelete(val.data);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.$refs.energyPlc.formClear();
 | 
			
		||||
			this.centervisible = false;
 | 
			
		||||
			this.addOrEditTitle = '';
 | 
			
		||||
		},
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.energyPlc.submitForm();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.handleCancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyPlc(row.id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,226 +1,258 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <el-drawer :title="drawerTitle" :visible.sync="visible" size="70%" @close='closeD' :show-close='false'>
 | 
			
		||||
      <div class="box">
 | 
			
		||||
        <el-form :inline="true">
 | 
			
		||||
          <el-form-item label="关联表名">
 | 
			
		||||
            <el-input v-model="plcTableName" size='small' readonly></el-input>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="对象">
 | 
			
		||||
            <el-input v-model="objName" size='small' readonly></el-input>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item v-if="showBtn">
 | 
			
		||||
            <el-button type="success" size='small' plain @click="addNew">新增</el-button>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
        </el-form>
 | 
			
		||||
        <base-table
 | 
			
		||||
          :page="queryParams.pageNo"
 | 
			
		||||
          :limit="queryParams.pageSize"
 | 
			
		||||
          :table-props="tableProps"
 | 
			
		||||
          :table-data="tableData"
 | 
			
		||||
          :max-height="tableH"
 | 
			
		||||
        >
 | 
			
		||||
          <method-btn
 | 
			
		||||
            v-if="tableBtn.length"
 | 
			
		||||
            slot="handleBtn"
 | 
			
		||||
            :width="100"
 | 
			
		||||
            label="操作"
 | 
			
		||||
            :method-list="tableBtn"
 | 
			
		||||
            @clickBtn="handleClick"
 | 
			
		||||
          />
 | 
			
		||||
        </base-table>
 | 
			
		||||
        <pagination
 | 
			
		||||
          :page.sync="queryParams.pageNo"
 | 
			
		||||
          :limit.sync="queryParams.pageSize"
 | 
			
		||||
          :total="total"
 | 
			
		||||
          @pagination="getList"
 | 
			
		||||
        />
 | 
			
		||||
      </div>
 | 
			
		||||
    </el-drawer>
 | 
			
		||||
    <!-- 新增 -->
 | 
			
		||||
    <base-dialog
 | 
			
		||||
      :dialogTitle="addOrEditTitle"
 | 
			
		||||
      :dialogVisible="centervisible"
 | 
			
		||||
      @cancel="handleCancel"
 | 
			
		||||
      @confirm="handleConfirm"
 | 
			
		||||
      :before-close="handleCancel"
 | 
			
		||||
    >
 | 
			
		||||
      <energy-plc-param-add ref="energyPlcParam" @successSubmit="successSubmit" />
 | 
			
		||||
    </base-dialog>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div>
 | 
			
		||||
		<el-drawer
 | 
			
		||||
			:title="drawerTitle"
 | 
			
		||||
			:visible.sync="visible"
 | 
			
		||||
			size="70%"
 | 
			
		||||
			@close="closeD"
 | 
			
		||||
			:show-close="false">
 | 
			
		||||
			<div class="box">
 | 
			
		||||
				<el-form :inline="true">
 | 
			
		||||
					<el-form-item label="关联表名">
 | 
			
		||||
						<el-input
 | 
			
		||||
							v-model="plcTableName"
 | 
			
		||||
							size="small"
 | 
			
		||||
							readonly
 | 
			
		||||
							style="width: 250px"></el-input>
 | 
			
		||||
					</el-form-item>
 | 
			
		||||
					<el-form-item label="对象">
 | 
			
		||||
						<el-input
 | 
			
		||||
							v-model="objName"
 | 
			
		||||
							size="small"
 | 
			
		||||
							readonly
 | 
			
		||||
							style="width: 250px"></el-input>
 | 
			
		||||
					</el-form-item>
 | 
			
		||||
					<el-form-item v-if="showBtn">
 | 
			
		||||
						<el-button
 | 
			
		||||
							type="success"
 | 
			
		||||
							size="small"
 | 
			
		||||
							plain
 | 
			
		||||
							@click="addNew">
 | 
			
		||||
							新增
 | 
			
		||||
						</el-button>
 | 
			
		||||
					</el-form-item>
 | 
			
		||||
				</el-form>
 | 
			
		||||
				<base-table
 | 
			
		||||
					:page="queryParams.pageNo"
 | 
			
		||||
					:limit="queryParams.pageSize"
 | 
			
		||||
					:table-props="tableProps"
 | 
			
		||||
					:table-data="tableData"
 | 
			
		||||
					:max-height="tableH">
 | 
			
		||||
					<method-btn
 | 
			
		||||
						v-if="tableBtn.length"
 | 
			
		||||
						slot="handleBtn"
 | 
			
		||||
						:width="100"
 | 
			
		||||
						label="操作"
 | 
			
		||||
						:method-list="tableBtn"
 | 
			
		||||
						@clickBtn="handleClick" />
 | 
			
		||||
				</base-table>
 | 
			
		||||
				<pagination
 | 
			
		||||
					:page.sync="queryParams.pageNo"
 | 
			
		||||
					:limit.sync="queryParams.pageSize"
 | 
			
		||||
					:total="total"
 | 
			
		||||
					@pagination="getList" />
 | 
			
		||||
			</div>
 | 
			
		||||
		</el-drawer>
 | 
			
		||||
		<!-- 新增 -->
 | 
			
		||||
		<base-dialog
 | 
			
		||||
			:dialogTitle="addOrEditTitle"
 | 
			
		||||
			:dialogVisible="centervisible"
 | 
			
		||||
			@cancel="handleCancel"
 | 
			
		||||
			@confirm="handleConfirm"
 | 
			
		||||
			:before-close="handleCancel">
 | 
			
		||||
			<energy-plc-param-add
 | 
			
		||||
				ref="energyPlcParam"
 | 
			
		||||
				@successSubmit="successSubmit" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyPlcParamPage, deleteEnergyPlcParam } from '@/api/base/energyPlcParam'
 | 
			
		||||
import EnergyPlcParamAdd from './energyPlcParamAdd'
 | 
			
		||||
import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyPlcParamPage,
 | 
			
		||||
	deleteEnergyPlcParam,
 | 
			
		||||
} from '@/api/base/energyPlcParam';
 | 
			
		||||
import EnergyPlcParamAdd from './energyPlcParamAdd';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'typeId',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'plcParamName',
 | 
			
		||||
    label: '参数列名'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'name',
 | 
			
		||||
    label: '参数名称'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'unit',
 | 
			
		||||
    label: '单位',
 | 
			
		||||
    filter: publicFormatter('energy_unit')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'collection',
 | 
			
		||||
    label: '是否采集'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'description',
 | 
			
		||||
    label: '描述'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'typeId',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'plcParamName',
 | 
			
		||||
		label: '参数列名',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '参数名称',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
		label: '单位',
 | 
			
		||||
		filter: publicFormatter('unit_dict'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'collection',
 | 
			
		||||
		label: '是否采集',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'description',
 | 
			
		||||
		label: '描述',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'EnergyPlcParam',
 | 
			
		||||
  props: {
 | 
			
		||||
    energyTypeList: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      visible: false,
 | 
			
		||||
      drawerTitle: '',
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      tableBtn: [],
 | 
			
		||||
      tableH: this.tableHeight(115),
 | 
			
		||||
      total: 0,
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 30,
 | 
			
		||||
        connectId: null
 | 
			
		||||
      },
 | 
			
		||||
      plcTableName: '',
 | 
			
		||||
      objName: '',
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      addOrEditTitle: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      collectionList: [
 | 
			
		||||
        {value: 0,label: '否'},
 | 
			
		||||
        {value: 1,label: '是'}
 | 
			
		||||
      ],
 | 
			
		||||
      showBtn: true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  components: { EnergyPlcParamAdd },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(115)
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    init(data,title) {
 | 
			
		||||
      this.visible = true
 | 
			
		||||
      this.queryParams.connectId = data.id
 | 
			
		||||
      this.plcTableName = data.plcTableName
 | 
			
		||||
      this.objName = data.objName
 | 
			
		||||
      this.getList()
 | 
			
		||||
      if (title === 'detail') {
 | 
			
		||||
        this.drawerTitle = '查看参数'
 | 
			
		||||
        this.showBtn = false
 | 
			
		||||
        this.tableBtn = []
 | 
			
		||||
      } else {
 | 
			
		||||
        this.drawerTitle = '参数绑定'
 | 
			
		||||
        this.showBtn = true
 | 
			
		||||
        this.tableBtn = [
 | 
			
		||||
          {
 | 
			
		||||
            type: 'edit',
 | 
			
		||||
            btnName: '编辑'
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            type: 'delete',
 | 
			
		||||
            btnName: '删除'
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    getList() {
 | 
			
		||||
      getEnergyPlcParamPage({...this.queryParams}).then((res) => {
 | 
			
		||||
        let arr = res.data.list || []
 | 
			
		||||
        arr&&arr.map(item => {
 | 
			
		||||
          this.collectionList.map(i => {
 | 
			
		||||
            if (item.collection === i.value) {
 | 
			
		||||
              item.collection = i.label
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          this.energyTypeList.map(j => {
 | 
			
		||||
            if (item.typeId === j.id) {
 | 
			
		||||
              item.typeId = j.name
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        })
 | 
			
		||||
        this.tableData = arr
 | 
			
		||||
        this.total = res.data.total;
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    // 新增
 | 
			
		||||
    addNew() {
 | 
			
		||||
      this.addOrEditTitle = '新增'
 | 
			
		||||
      this.centervisible = true
 | 
			
		||||
      this.$nextTick(() => {
 | 
			
		||||
        this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: ''})
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    handleCancel() {
 | 
			
		||||
      this.$refs.energyPlcParam.formClear()
 | 
			
		||||
      this.centervisible = false
 | 
			
		||||
      this.addOrEditTitle = ''
 | 
			
		||||
    },
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.energyPlcParam.submitForm()
 | 
			
		||||
    },
 | 
			
		||||
    successSubmit() {
 | 
			
		||||
      this.handleCancel()
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      switch (val.type) {
 | 
			
		||||
        case 'edit':
 | 
			
		||||
          this.addOrEditTitle = '编辑'
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: val.data.id})
 | 
			
		||||
          })
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.handleDelete(val.data)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      this.$modal.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?').then(function() {
 | 
			
		||||
          return deleteEnergyPlcParam(row.id);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.getList();
 | 
			
		||||
          this.$modal.msgSuccess("删除成功");
 | 
			
		||||
        }).catch(() => {});
 | 
			
		||||
    },
 | 
			
		||||
    closeD() {
 | 
			
		||||
      this.$emit('closeDrawer')
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'EnergyPlcParam',
 | 
			
		||||
	props: {
 | 
			
		||||
		energyTypeList: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			required: true,
 | 
			
		||||
			default: () => {
 | 
			
		||||
				return [];
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			visible: false,
 | 
			
		||||
			drawerTitle: '',
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			tableBtn: [],
 | 
			
		||||
			tableH: this.tableHeight(115),
 | 
			
		||||
			total: 0,
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 30,
 | 
			
		||||
				connectId: null,
 | 
			
		||||
			},
 | 
			
		||||
			plcTableName: '',
 | 
			
		||||
			objName: '',
 | 
			
		||||
			// 弹出层标题
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			collectionList: [
 | 
			
		||||
				{ value: 0, label: '否' },
 | 
			
		||||
				{ value: 1, label: '是' },
 | 
			
		||||
			],
 | 
			
		||||
			showBtn: true,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	components: { EnergyPlcParamAdd },
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(115);
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(data, title) {
 | 
			
		||||
			this.visible = true;
 | 
			
		||||
			this.queryParams.connectId = data.id;
 | 
			
		||||
			this.plcTableName = data.plcTableName;
 | 
			
		||||
			this.objName = data.objName;
 | 
			
		||||
			this.getList();
 | 
			
		||||
			if (title === 'detail') {
 | 
			
		||||
				this.drawerTitle = '查看参数';
 | 
			
		||||
				this.showBtn = false;
 | 
			
		||||
				this.tableBtn = [];
 | 
			
		||||
			} else {
 | 
			
		||||
				this.drawerTitle = '参数绑定';
 | 
			
		||||
				this.showBtn = true;
 | 
			
		||||
				this.tableBtn = [
 | 
			
		||||
					{
 | 
			
		||||
						type: 'edit',
 | 
			
		||||
						btnName: '编辑',
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						type: 'delete',
 | 
			
		||||
						btnName: '删除',
 | 
			
		||||
					},
 | 
			
		||||
				];
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyPlcParamPage({ ...this.queryParams }).then((res) => {
 | 
			
		||||
				let arr = res.data.list || [];
 | 
			
		||||
				arr &&
 | 
			
		||||
					arr.map((item) => {
 | 
			
		||||
						this.collectionList.map((i) => {
 | 
			
		||||
							if (item.collection === i.value) {
 | 
			
		||||
								item.collection = i.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
						this.energyTypeList.map((j) => {
 | 
			
		||||
							if (item.typeId === j.id) {
 | 
			
		||||
								item.typeId = j.name;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.tableData = arr;
 | 
			
		||||
				this.total = res.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		// 新增
 | 
			
		||||
		addNew() {
 | 
			
		||||
			this.addOrEditTitle = '新增';
 | 
			
		||||
			this.centervisible = true;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.energyPlcParam.init({
 | 
			
		||||
					connectId: this.queryParams.connectId,
 | 
			
		||||
					id: '',
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.$refs.energyPlcParam.formClear();
 | 
			
		||||
			this.centervisible = false;
 | 
			
		||||
			this.addOrEditTitle = '';
 | 
			
		||||
		},
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.energyPlcParam.submitForm();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.handleCancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(val) {
 | 
			
		||||
			console.log(val);
 | 
			
		||||
			switch (val.type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.addOrEditTitle = '编辑';
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyPlcParam.init({
 | 
			
		||||
							connectId: this.queryParams.connectId,
 | 
			
		||||
							id: val.data.id,
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.handleDelete(val.data);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyPlcParam(row.id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		closeD() {
 | 
			
		||||
			this.$emit('closeDrawer');
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.box {
 | 
			
		||||
  padding: 0 32px;
 | 
			
		||||
	padding: 0 32px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -57,14 +57,18 @@ import { getTree } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd';
 | 
			
		||||
import EnergyPlcParam from './components/energyPlcParam';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '对象',
 | 
			
		||||
		minWidth: 130,
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
@@ -86,11 +90,13 @@ const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'varNum',
 | 
			
		||||
		label: '绑定参数数量',
 | 
			
		||||
		width: 110,
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyPlcConnect',
 | 
			
		||||
	components: { EnergyPlcConnectAdd, EnergyPlcParam },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
@@ -144,7 +150,6 @@ export default {
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
@@ -165,9 +170,6 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,38 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="tableInner">
 | 
			
		||||
    <!-- <el-input v-model="list[itemProp]" @blur="changeInput" /> -->
 | 
			
		||||
    <el-input-number v-model="list[itemProp]" @change="changeInput" :min="0" :max="999999999" style='width: 100%;' :controls='false' :precision='2'></el-input-number>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'InputArea',
 | 
			
		||||
  props: {
 | 
			
		||||
    injectData: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => ({})
 | 
			
		||||
    },
 | 
			
		||||
    itemProp: {
 | 
			
		||||
      type: String
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      list: this.injectData
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    changeInput() {
 | 
			
		||||
      console.log(this.list)
 | 
			
		||||
      this.$emit('emitData', this.list)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.tableInner .el-input__inner {
 | 
			
		||||
  border: none;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
  height: 33px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="tableInner">
 | 
			
		||||
    <el-select v-model="list[itemProp]" placeholder="请选择" style="width: 100%;" @change="changeSelect">
 | 
			
		||||
      <el-option
 | 
			
		||||
        v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
 | 
			
		||||
        :key="item.value"
 | 
			
		||||
        :label="item.label"
 | 
			
		||||
        :value="item.value">
 | 
			
		||||
      </el-option>
 | 
			
		||||
    </el-select>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'SelectArea',
 | 
			
		||||
  props: {
 | 
			
		||||
    injectData: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => ({})
 | 
			
		||||
    },
 | 
			
		||||
    itemProp: {
 | 
			
		||||
      type: String
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      list: this.injectData
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    changeSelect() {
 | 
			
		||||
      console.log(this.list)
 | 
			
		||||
      this.$emit('emitData', this.list)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.tableInner .el-input__inner {
 | 
			
		||||
  border: none;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
  height: 33px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -40,18 +40,10 @@
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<el-col :span="24">
 | 
			
		||||
				<add-table
 | 
			
		||||
					:table-props="tableProps"
 | 
			
		||||
					:table-data="tableData"
 | 
			
		||||
					:table-name-list="tableNameList"
 | 
			
		||||
					@emitFun="inputChange"
 | 
			
		||||
					@emitButtonClick="emitButtonClick" />
 | 
			
		||||
				<!-- <base-table
 | 
			
		||||
					border
 | 
			
		||||
					:table-props="tableProps"
 | 
			
		||||
					:table-data="tableData"
 | 
			
		||||
					:add-button-show="addButtonShow"
 | 
			
		||||
					@emitFun="inputChange"
 | 
			
		||||
					@emitButtonClick="emitButtonClick" /> -->
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-form>
 | 
			
		||||
@@ -64,21 +56,7 @@ import {
 | 
			
		||||
} from '@/api/base/energyQuantityManual';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import AddTable from './AddTable';
 | 
			
		||||
import InputArea from './InputArea';
 | 
			
		||||
import SelectArea from './SelectArea';
 | 
			
		||||
import { energyTableGet } from '@/api/base/energyQuantityManual';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'tableName',
 | 
			
		||||
		label: '表名*',
 | 
			
		||||
		subcomponent: SelectArea,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'readingQuantity',
 | 
			
		||||
		label: '抄表数*',
 | 
			
		||||
		subcomponent: InputArea,
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyQuantityManualAdd',
 | 
			
		||||
	props: {
 | 
			
		||||
@@ -92,7 +70,6 @@ export default {
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			tableNameList: [], //表名list
 | 
			
		||||
			addButtonShow: '新增',
 | 
			
		||||
@@ -122,6 +99,7 @@ export default {
 | 
			
		||||
			} else if (params.type === 'meterReading') {
 | 
			
		||||
				this.isEdit = false;
 | 
			
		||||
				this.form.energyTypeId = params.energyTypeId;
 | 
			
		||||
				this.selEnergyType(this.form.energyTypeId);
 | 
			
		||||
				let obj = {};
 | 
			
		||||
				obj.tableName = params.tableName + '';
 | 
			
		||||
				obj.readingQuantity = 0;
 | 
			
		||||
@@ -133,6 +111,7 @@ export default {
 | 
			
		||||
				energyQuantityManualGet({ id: this.form.id }).then((res) => {
 | 
			
		||||
					if (res.code === 0) {
 | 
			
		||||
						this.form.energyTypeId = res.data.energyTypeId;
 | 
			
		||||
						this.selEnergyType(this.form.energyTypeId);
 | 
			
		||||
						this.form.recordTime = res.data.recordTime
 | 
			
		||||
							? res.data.recordTime
 | 
			
		||||
							: null;
 | 
			
		||||
@@ -164,6 +143,11 @@ export default {
 | 
			
		||||
			this.tableNameList = [];
 | 
			
		||||
			energyTableGet({ energyTypeId: id }).then((res) => {
 | 
			
		||||
				this.tableNameList = res.data.tableObjs || [];
 | 
			
		||||
				if (this.tableNameList.length === 0) {
 | 
			
		||||
					this.$modal.msgWarning(
 | 
			
		||||
						'当前能源类型暂无配置表名,请先到《表名配置》页面配置'
 | 
			
		||||
					);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		submitForm() {
 | 
			
		||||
 
 | 
			
		||||
@@ -52,12 +52,12 @@ import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import { parseTimeTable } from '@/utils/ruoyi';
 | 
			
		||||
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
		prop: 'energyTypeLabel',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		minWidth: 110,
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
@@ -142,7 +142,6 @@ export default {
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
@@ -181,10 +180,8 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	components: { EnergyQuantityManualAdd },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf();
 | 
			
		||||
		let start = moment(
 | 
			
		||||
			moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
 | 
			
		||||
@@ -244,6 +241,11 @@ export default {
 | 
			
		||||
								? item.amount.toFixed(2)
 | 
			
		||||
								: ''
 | 
			
		||||
							: '';
 | 
			
		||||
						this.getDictDatas('energy_type').map((subItem) => {
 | 
			
		||||
							if (item.energyType === subItem.value) {
 | 
			
		||||
								item.energyTypeLabel = subItem.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
@@ -305,7 +307,7 @@ export default {
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			console.log(row.id);
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除能源类型为"' + row.energyType + '"的数据项?')
 | 
			
		||||
				.confirm('是否确认删除能源类型为"' + row.energyTypeLabel + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return energyQuantityManualDelete({ id: row.id });
 | 
			
		||||
				})
 | 
			
		||||
 
 | 
			
		||||
@@ -1,220 +1,254 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
 | 
			
		||||
      :selectWidth="55" :max-height="tableH" @selection-change="selectChange" />
 | 
			
		||||
    <pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
 | 
			
		||||
      @pagination="getList" />
 | 
			
		||||
  </div>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<search-bar
 | 
			
		||||
			:formConfigs="formConfig"
 | 
			
		||||
			ref="searchBarForm"
 | 
			
		||||
			@headBtnClick="buttonClick" />
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
		<base-table
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			:selectWidth="55"
 | 
			
		||||
			:max-height="tableH"
 | 
			
		||||
			@selection-change="selectChange" />
 | 
			
		||||
		<pagination
 | 
			
		||||
			:page.sync="queryParams.pageNo"
 | 
			
		||||
			:limit.sync="queryParams.pageSize"
 | 
			
		||||
			:total="total"
 | 
			
		||||
			@pagination="getList" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyQuantityRealtimePage } from "@/api/base/energyQuantityRealtime"
 | 
			
		||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
 | 
			
		||||
// import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import FileSaver from "file-saver"
 | 
			
		||||
import * as XLSX from 'xlsx/xlsx.mjs'
 | 
			
		||||
import { getEnergyQuantityRealtimePage } from '@/api/base/energyQuantityRealtime';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
// import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import FileSaver from 'file-saver';
 | 
			
		||||
import * as XLSX from 'xlsx/xlsx.mjs';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '统计对象',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'energyTypeName',
 | 
			
		||||
    label: '能源类型',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startValue',
 | 
			
		||||
    label: '初始值'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endValue',
 | 
			
		||||
    label: '当前值'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'diffValue',
 | 
			
		||||
    label: '差值'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'amount',
 | 
			
		||||
    label: '金额'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '统计对象',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyTypeLabel',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startValue',
 | 
			
		||||
		label: '初始值',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endValue',
 | 
			
		||||
		label: '当前值',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'diffValue',
 | 
			
		||||
		label: '差值',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'amount',
 | 
			
		||||
		label: '金额',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyQuantityRealtime",
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '能源类型',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'energyTypeId',
 | 
			
		||||
          filterable: true
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'datePicker',
 | 
			
		||||
          label: '时间',
 | 
			
		||||
          dateType: 'datetimerange',
 | 
			
		||||
          format: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
          valueFormat: "timestamp",
 | 
			
		||||
          rangeSeparator: '-',
 | 
			
		||||
          startPlaceholder: '开始时间',
 | 
			
		||||
          endPlaceholder: '结束时间',
 | 
			
		||||
          param: 'timeVal',
 | 
			
		||||
          defaultSelect: [],
 | 
			
		||||
          width: 350
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separate'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('base:energy-quantity-realtime:export') ? 'button' : '',
 | 
			
		||||
          btnName: '导出',
 | 
			
		||||
          name: 'export',
 | 
			
		||||
          color: 'primary',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        energyTypeId: '',
 | 
			
		||||
        startTime: null,
 | 
			
		||||
        endTime: null
 | 
			
		||||
      },
 | 
			
		||||
      energyTypeList: [],
 | 
			
		||||
      exportList: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
    if (location.href.indexOf('?') > 0) {
 | 
			
		||||
      let arr = location.href.split('?')[1].split('&')
 | 
			
		||||
      this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
 | 
			
		||||
    } else {
 | 
			
		||||
      this.formConfig[1].defaultSelect = [Date.now() - 7 * 24 * 3600000, Date.now()]
 | 
			
		||||
    }
 | 
			
		||||
    this.queryParams.startTime = this.formConfig[1].defaultSelect[0]
 | 
			
		||||
    this.queryParams.endTime = this.formConfig[1].defaultSelect[1]
 | 
			
		||||
    this.getList();
 | 
			
		||||
    this.getTypeList()
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    $route: 'initData'
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    initData(to) {
 | 
			
		||||
      if (to.name === 'EnergyQuantityRealtime') {
 | 
			
		||||
        if (location.href.indexOf('?') > 0) {
 | 
			
		||||
          let arr = location.href.split('?')[1].split('&')
 | 
			
		||||
          this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
 | 
			
		||||
        } else {
 | 
			
		||||
          this.formConfig[1].defaultSelect = [Date.now() - 7 * 24 * 3600000, Date.now()]
 | 
			
		||||
        }
 | 
			
		||||
        this.queryParams.startTime = this.formConfig[1].defaultSelect[0]
 | 
			
		||||
        this.queryParams.endTime = this.formConfig[1].defaultSelect[1]
 | 
			
		||||
        this.getList()
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      this.queryParams.pageNo = 1;
 | 
			
		||||
      this.queryParams.energyTypeId = val.energyTypeId
 | 
			
		||||
      this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
 | 
			
		||||
      this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.exportTable()
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      getEnergyQuantityRealtimePage(this.queryParams).then(response => {
 | 
			
		||||
        let arr = response.data.list || []
 | 
			
		||||
        arr && arr.map(item => {
 | 
			
		||||
          item.amount = item.amount ? (!isNaN(parseFloat(item.amount)) && isFinite(item.amount) ? item.amount.toFixed(2) : '') : ''
 | 
			
		||||
        })
 | 
			
		||||
        this.list = arr
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
        this.exportList = []
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    getTypeList() {
 | 
			
		||||
      getEnergyTypeListAll().then((res) => {
 | 
			
		||||
        this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
        this.energyTypeList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    selectChange(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      this.exportList = val
 | 
			
		||||
    },
 | 
			
		||||
    // 勾选导出
 | 
			
		||||
    exportTable() {
 | 
			
		||||
      if (this.exportList.length > 0) {
 | 
			
		||||
        let body = this.exportList.map((x) => [
 | 
			
		||||
          x.objName,
 | 
			
		||||
          x.objCode,
 | 
			
		||||
          x.energyTypeName,
 | 
			
		||||
          x.startValue,
 | 
			
		||||
          x.endValue,
 | 
			
		||||
          x.diffValue,
 | 
			
		||||
          x.amount
 | 
			
		||||
        ])
 | 
			
		||||
        let header = []
 | 
			
		||||
        this.tableProps.map((y) => {
 | 
			
		||||
          header.push(y.label)
 | 
			
		||||
        })
 | 
			
		||||
        body.unshift(header)
 | 
			
		||||
        console.log(body)
 | 
			
		||||
        const filename = '能源抄表.xlsx'
 | 
			
		||||
        const ws_name = 'Sheet1'
 | 
			
		||||
        const wb = XLSX.utils.book_new()
 | 
			
		||||
        const ws = XLSX.utils.aoa_to_sheet(body)
 | 
			
		||||
        XLSX.utils.book_append_sheet(wb, ws, ws_name)
 | 
			
		||||
        let wbout = XLSX.write(wb, {
 | 
			
		||||
          bookType: 'xlsx',
 | 
			
		||||
          bookSST: false,
 | 
			
		||||
          type: 'array'
 | 
			
		||||
        })
 | 
			
		||||
        FileSaver.saveAs(
 | 
			
		||||
          new Blob([wbout], {
 | 
			
		||||
            type: 'application/octet-stream'
 | 
			
		||||
          }),
 | 
			
		||||
          filename
 | 
			
		||||
        )
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$modal.msgWarning('请勾选需要导出的数据')
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyQuantityRealtime',
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '能源类型',
 | 
			
		||||
					labelField: 'labelName',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'energyTypeId',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'datePicker',
 | 
			
		||||
					label: '时间',
 | 
			
		||||
					dateType: 'datetimerange',
 | 
			
		||||
					format: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
					valueFormat: 'timestamp',
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始时间',
 | 
			
		||||
					endPlaceholder: '结束时间',
 | 
			
		||||
					param: 'timeVal',
 | 
			
		||||
					defaultSelect: [],
 | 
			
		||||
					width: 350,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('base:energy-quantity-realtime:export')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '导出',
 | 
			
		||||
					name: 'export',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				energyTypeId: '',
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				endTime: null,
 | 
			
		||||
			},
 | 
			
		||||
			energyTypeList: [],
 | 
			
		||||
			exportList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		if (location.href.indexOf('?') > 0) {
 | 
			
		||||
			let arr = location.href.split('?')[1].split('&');
 | 
			
		||||
			this.formConfig[1].defaultSelect = [
 | 
			
		||||
				arr[0].split('=')[1],
 | 
			
		||||
				arr[1].split('=')[1],
 | 
			
		||||
			];
 | 
			
		||||
		} else {
 | 
			
		||||
			this.formConfig[1].defaultSelect = [
 | 
			
		||||
				Date.now() - 7 * 24 * 3600000,
 | 
			
		||||
				Date.now(),
 | 
			
		||||
			];
 | 
			
		||||
		}
 | 
			
		||||
		this.queryParams.startTime = this.formConfig[1].defaultSelect[0];
 | 
			
		||||
		this.queryParams.endTime = this.formConfig[1].defaultSelect[1];
 | 
			
		||||
		this.getList();
 | 
			
		||||
		this.getTypeList();
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
		$route: 'initData',
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		initData(to) {
 | 
			
		||||
			if (to.name === 'EnergyQuantityRealtime') {
 | 
			
		||||
				if (location.href.indexOf('?') > 0) {
 | 
			
		||||
					let arr = location.href.split('?')[1].split('&');
 | 
			
		||||
					this.formConfig[1].defaultSelect = [
 | 
			
		||||
						arr[0].split('=')[1],
 | 
			
		||||
						arr[1].split('=')[1],
 | 
			
		||||
					];
 | 
			
		||||
				} else {
 | 
			
		||||
					this.formConfig[1].defaultSelect = [
 | 
			
		||||
						Date.now() - 7 * 24 * 3600000,
 | 
			
		||||
						Date.now(),
 | 
			
		||||
					];
 | 
			
		||||
				}
 | 
			
		||||
				this.queryParams.startTime = this.formConfig[1].defaultSelect[0];
 | 
			
		||||
				this.queryParams.endTime = this.formConfig[1].defaultSelect[1];
 | 
			
		||||
				this.getList();
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			this.queryParams.pageNo = 1;
 | 
			
		||||
			this.queryParams.energyTypeId = val.energyTypeId;
 | 
			
		||||
			this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
 | 
			
		||||
			this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.getList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.exportTable();
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyQuantityRealtimePage(this.queryParams).then((response) => {
 | 
			
		||||
				let arr = response.data.list || [];
 | 
			
		||||
				arr &&
 | 
			
		||||
					arr.map((item) => {
 | 
			
		||||
						item.amount = item.amount
 | 
			
		||||
							? !isNaN(parseFloat(item.amount)) && isFinite(item.amount)
 | 
			
		||||
								? item.amount.toFixed(2)
 | 
			
		||||
								: ''
 | 
			
		||||
							: '';
 | 
			
		||||
						this.getDictDatas('energy_type').map((subItem) => {
 | 
			
		||||
							if (item.energyTypeName === subItem.value) {
 | 
			
		||||
								item.energyTypeLabel = subItem.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
				this.exportList = [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		getTypeList() {
 | 
			
		||||
			getEnergyTypeListAll().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || [];
 | 
			
		||||
				this.energyTypeList = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		selectChange(val) {
 | 
			
		||||
			console.log(val);
 | 
			
		||||
			this.exportList = val;
 | 
			
		||||
		},
 | 
			
		||||
		// 勾选导出
 | 
			
		||||
		exportTable() {
 | 
			
		||||
			if (this.exportList.length > 0) {
 | 
			
		||||
				let body = this.exportList.map((x) => [
 | 
			
		||||
					x.objName,
 | 
			
		||||
					x.objCode,
 | 
			
		||||
					x.energyTypeLabel,
 | 
			
		||||
					x.startValue,
 | 
			
		||||
					x.endValue,
 | 
			
		||||
					x.diffValue,
 | 
			
		||||
					x.amount,
 | 
			
		||||
				]);
 | 
			
		||||
				let header = [];
 | 
			
		||||
				this.tableProps.map((y) => {
 | 
			
		||||
					header.push(y.label);
 | 
			
		||||
				});
 | 
			
		||||
				body.unshift(header);
 | 
			
		||||
				console.log(body);
 | 
			
		||||
				const filename = '能源抄表.xlsx';
 | 
			
		||||
				const ws_name = 'Sheet1';
 | 
			
		||||
				const wb = XLSX.utils.book_new();
 | 
			
		||||
				const ws = XLSX.utils.aoa_to_sheet(body);
 | 
			
		||||
				XLSX.utils.book_append_sheet(wb, ws, ws_name);
 | 
			
		||||
				let wbout = XLSX.write(wb, {
 | 
			
		||||
					bookType: 'xlsx',
 | 
			
		||||
					bookSST: false,
 | 
			
		||||
					type: 'array',
 | 
			
		||||
				});
 | 
			
		||||
				FileSaver.saveAs(
 | 
			
		||||
					new Blob([wbout], {
 | 
			
		||||
						type: 'application/octet-stream',
 | 
			
		||||
					}),
 | 
			
		||||
					filename
 | 
			
		||||
				);
 | 
			
		||||
			} else {
 | 
			
		||||
				this.$modal.msgWarning('请勾选需要导出的数据');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,7 @@ import { getEnergyTypePage, deleteEnergyType } from '@/api/base/energyType';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import InnerTable from './components/InnerTable';
 | 
			
		||||
import EnergyTypeAdd from './components/energyTypeAdd';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
@@ -48,9 +49,8 @@ const tableProps = [
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		prop: 'energyTypeLabel',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
@@ -70,6 +70,7 @@ const tableProps = [
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyType',
 | 
			
		||||
	components: { EnergyTypeAdd },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
@@ -96,7 +97,7 @@ export default {
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(220),
 | 
			
		||||
			heightNum: 220,
 | 
			
		||||
			pricingMethodList: [
 | 
			
		||||
				{ value: 0, label: '分时间段计价' },
 | 
			
		||||
				{ value: 1, label: '分使用量计价' },
 | 
			
		||||
@@ -118,9 +119,6 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(220);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
@@ -142,6 +140,11 @@ export default {
 | 
			
		||||
								item.pricingMethod = i.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
						this.getDictDatas('energy_type').map((subItem) => {
 | 
			
		||||
							if (item.name === subItem.value) {
 | 
			
		||||
								item.energyTypeLabel = subItem.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
@@ -174,8 +177,9 @@ export default {
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			console.log(row);
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?')
 | 
			
		||||
				.confirm('是否确认删除能源类型为"' + row.energyTypeLabel + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyType(row.id);
 | 
			
		||||
				})
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,7 @@
 | 
			
		||||
import { energyTablePage } from '@/api/base/energyQuantityManual';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import tableNameConfigUpdate from './components/tableNameConfigUpdate.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
@@ -63,10 +64,11 @@ export default {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 100,
 | 
			
		||||
			},
 | 
			
		||||
			tableH: this.tableHeight(165),
 | 
			
		||||
			heightNum: 165,
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
 
 | 
			
		||||
@@ -182,6 +182,7 @@ export default {
 | 
			
		||||
				limitType: '',
 | 
			
		||||
				minValue: 0,
 | 
			
		||||
				maxValue: 0,
 | 
			
		||||
				tableName: '',
 | 
			
		||||
			},
 | 
			
		||||
			objIds: [], // 回显数组
 | 
			
		||||
			isEdit: false, //是否是编辑
 | 
			
		||||
@@ -214,6 +215,9 @@ export default {
 | 
			
		||||
					if (res.code === 0) {
 | 
			
		||||
						this.form = res.data;
 | 
			
		||||
						this.form.plcParamId = res.data.plcParamId || '';
 | 
			
		||||
						this.form.tableName = this.form.tableName
 | 
			
		||||
							? this.form.tableName + ''
 | 
			
		||||
							: '';
 | 
			
		||||
						this.form.method = this.form.method ? this.form.method + '' : '';
 | 
			
		||||
						this.form.limitType = this.form.limitType
 | 
			
		||||
							? this.form.limitType + ''
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,7 @@ import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import { getTree } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import EnergyLimitAdd from './components/energyLimitAdd';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'method',
 | 
			
		||||
@@ -104,6 +105,7 @@ const tableProps = [
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyLimit',
 | 
			
		||||
	components: { EnergyLimitAdd },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
@@ -156,7 +158,6 @@ export default {
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
@@ -181,9 +182,6 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
		this.getTypeList();
 | 
			
		||||
		// 获取对象树形结构
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,7 @@ import { getEnergyOverlimitLogPage } from '@/api/monitoring/energyOverlimitLog';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import { parseTime } from '@/utils/ruoyi';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
@@ -123,6 +124,7 @@ const tableProps2 = [
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyOverlimitLog',
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
@@ -151,10 +153,10 @@ export default {
 | 
			
		||||
			activeName: 'auto',
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableProps2,
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			total: 0,
 | 
			
		||||
			list: [],
 | 
			
		||||
			list2: [],
 | 
			
		||||
			heightNum: 300,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
@@ -170,9 +172,6 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
		this.getTypeList();
 | 
			
		||||
	},
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ const tableProps = [
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyLimit',
 | 
			
		||||
	name: 'EnergyReport',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			isFold: false,
 | 
			
		||||
@@ -181,7 +181,7 @@ export default {
 | 
			
		||||
							return energyReportPageExportAuto({ ...this.queryParams });
 | 
			
		||||
						})
 | 
			
		||||
						.then((response) => {
 | 
			
		||||
							this.$download.excel(response, '能源统计报表.xls');
 | 
			
		||||
							this.$download.excel(response, '能耗统计报表.xls');
 | 
			
		||||
						})
 | 
			
		||||
						.catch(() => {});
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,161 +1,171 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container" id='energyReportSearchBox'>
 | 
			
		||||
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-bar
 | 
			
		||||
      :formConfigs="formConfig"
 | 
			
		||||
      ref="searchBarForm"
 | 
			
		||||
      :isFold="isFold"
 | 
			
		||||
      @headBtnClick="buttonClick"
 | 
			
		||||
    />
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <base-table
 | 
			
		||||
      :page="queryParams.pageNo"
 | 
			
		||||
      :limit="queryParams.pageSize"
 | 
			
		||||
      :table-props="tableProps"
 | 
			
		||||
      :table-data="list"
 | 
			
		||||
      :max-height="tableH"
 | 
			
		||||
    />
 | 
			
		||||
    <pagination
 | 
			
		||||
      :page.sync="queryParams.pageNo"
 | 
			
		||||
      :limit.sync="queryParams.pageSize"
 | 
			
		||||
      :total="total"
 | 
			
		||||
      @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
  </div>
 | 
			
		||||
	<div
 | 
			
		||||
		class="app-container"
 | 
			
		||||
		id="energyReportSearchBox">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<search-bar
 | 
			
		||||
			:formConfigs="formConfig"
 | 
			
		||||
			ref="searchBarForm"
 | 
			
		||||
			:isFold="isFold"
 | 
			
		||||
			@headBtnClick="buttonClick" />
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
		<base-table
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			:max-height="tableH" />
 | 
			
		||||
		<pagination
 | 
			
		||||
			:page.sync="queryParams.pageNo"
 | 
			
		||||
			:limit.sync="queryParams.pageSize"
 | 
			
		||||
			:total="total"
 | 
			
		||||
			@pagination="getList" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { energyReportPage, energyReportPageExport } from "@/api/monitoring/energyReport";
 | 
			
		||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
 | 
			
		||||
import {
 | 
			
		||||
	energyReportPage,
 | 
			
		||||
	energyReportPageExport,
 | 
			
		||||
} from '@/api/monitoring/energyReport';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'statisticName',
 | 
			
		||||
    label: '统计方案'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'energyType',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startValue',
 | 
			
		||||
    label: '抄表数(起始)'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endValue',
 | 
			
		||||
    label: '抄表数(结束)'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'diffValue',
 | 
			
		||||
    label: '消耗量'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'statisticName',
 | 
			
		||||
		label: '统计方案',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startValue',
 | 
			
		||||
		label: '抄表数(起始)',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endValue',
 | 
			
		||||
		label: '抄表数(结束)',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'diffValue',
 | 
			
		||||
		label: '消耗量',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyReportSearch",
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      isFold: false,
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'input',
 | 
			
		||||
          label: '统计方案',
 | 
			
		||||
          param: 'statisticName'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '能源类型',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'energyTypeId',
 | 
			
		||||
          filterable: true
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'datePicker',
 | 
			
		||||
          label: '时间',
 | 
			
		||||
          dateType: 'datetimerange',
 | 
			
		||||
          format: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
          valueFormat: "timestamp",
 | 
			
		||||
          rangeSeparator: '-',
 | 
			
		||||
          startPlaceholder: '开始时间',
 | 
			
		||||
          endPlaceholder: '结束时间',
 | 
			
		||||
          param: 'timeVal',
 | 
			
		||||
          defaultSelect: [],
 | 
			
		||||
          width: 350,
 | 
			
		||||
          clearable: false
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separate'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('monitoring:energy-report-search:export') ? 'button' : '',
 | 
			
		||||
          btnName: '导出',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'primary',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        statisticName: null,
 | 
			
		||||
        startTime: null,
 | 
			
		||||
        endTime: null
 | 
			
		||||
      },
 | 
			
		||||
      energyTypeList: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
      this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
 | 
			
		||||
    })
 | 
			
		||||
    this.getList()
 | 
			
		||||
    this.getTypeList()
 | 
			
		||||
    this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getTypeList() {
 | 
			
		||||
      getEnergyTypeListAll().then((res) => {
 | 
			
		||||
        this.formConfig[1].selectOptions = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.queryParams.pageNo = 1
 | 
			
		||||
          this.queryParams.statisticName = val.statisticName
 | 
			
		||||
          this.queryParams.energyTypeId = val.energyTypeId
 | 
			
		||||
          this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
 | 
			
		||||
          this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.$modal.confirm('是否确认导出').then(() => {
 | 
			
		||||
                return energyReportPageExport({...this.queryParams});
 | 
			
		||||
              }).then(response => {
 | 
			
		||||
                this.$download.excel(response, '能源统计查询报表.xls');
 | 
			
		||||
              }).catch(() => {})
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      energyReportPage({...this.queryParams}).then(response => {
 | 
			
		||||
        this.list = response.data.list || [];
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyReportSearch',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			isFold: false,
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '统计方案',
 | 
			
		||||
					param: 'statisticName',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '能源类型',
 | 
			
		||||
					labelField: 'labelName',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'energyTypeId',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'datePicker',
 | 
			
		||||
					label: '时间',
 | 
			
		||||
					dateType: 'datetimerange',
 | 
			
		||||
					format: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
					valueFormat: 'timestamp',
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始时间',
 | 
			
		||||
					endPlaceholder: '结束时间',
 | 
			
		||||
					param: 'timeVal',
 | 
			
		||||
					defaultSelect: [],
 | 
			
		||||
					width: 350,
 | 
			
		||||
					clearable: false,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('monitoring:energy-report-search:export')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '导出',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				statisticName: null,
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				endTime: null,
 | 
			
		||||
			},
 | 
			
		||||
			energyTypeList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
			this.isFold = this.searchBarWidth('energyReportSearchBox', 1180);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
		this.getTypeList();
 | 
			
		||||
		this.isFold = this.searchBarWidth('energyReportSearchBox', 1180);
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getTypeList() {
 | 
			
		||||
			getEnergyTypeListAll().then((res) => {
 | 
			
		||||
				this.formConfig[1].selectOptions = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.queryParams.statisticName = val.statisticName;
 | 
			
		||||
					this.queryParams.energyTypeId = val.energyTypeId;
 | 
			
		||||
					this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
 | 
			
		||||
					this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.$modal
 | 
			
		||||
						.confirm('是否确认导出')
 | 
			
		||||
						.then(() => {
 | 
			
		||||
							return energyReportPageExport({ ...this.queryParams });
 | 
			
		||||
						})
 | 
			
		||||
						.then((response) => {
 | 
			
		||||
							this.$download.excel(response, '能源统计查询报表.xls');
 | 
			
		||||
						})
 | 
			
		||||
						.catch(() => {});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			energyReportPage({ ...this.queryParams }).then((response) => {
 | 
			
		||||
				this.list = response.data.list || [];
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,230 +1,271 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <el-drawer :title="drawerTitle" :visible.sync="visible" size="70%" @close='closeD' :show-close='false'>
 | 
			
		||||
      <div class="box">
 | 
			
		||||
        <el-form :inline="true">
 | 
			
		||||
          <el-form-item label="方案名称">
 | 
			
		||||
            <el-input v-model="name" size='small' readonly></el-input>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="能源类型">
 | 
			
		||||
            <el-input v-model="energyType" size='small' readonly></el-input>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item>
 | 
			
		||||
            <el-button type="success" size='small' v-if="showBtn" plain @click="addNew">新增</el-button>
 | 
			
		||||
            <el-button type="danger" size='small' v-if="showBtn" plain @click="deleteAll">批量删除</el-button>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
        </el-form>
 | 
			
		||||
        <base-table
 | 
			
		||||
          :page="queryParams.pageNo"
 | 
			
		||||
          :limit="queryParams.pageSize"
 | 
			
		||||
          :table-props="tableProps"
 | 
			
		||||
          :table-data="tableData"
 | 
			
		||||
          :max-height="tableH"
 | 
			
		||||
          :selectWidth="55"
 | 
			
		||||
          @selection-change="selectChange"
 | 
			
		||||
        >
 | 
			
		||||
          <method-btn
 | 
			
		||||
            v-if="tableBtn.length"
 | 
			
		||||
            slot="handleBtn"
 | 
			
		||||
            :width="80"
 | 
			
		||||
            label="操作"
 | 
			
		||||
            :method-list="tableBtn"
 | 
			
		||||
            @clickBtn="handleClick"
 | 
			
		||||
          />
 | 
			
		||||
        </base-table>
 | 
			
		||||
        <pagination
 | 
			
		||||
          :page.sync="queryParams.pageNo"
 | 
			
		||||
          :limit.sync="queryParams.pageSize"
 | 
			
		||||
          :total="total"
 | 
			
		||||
          @pagination="getList"
 | 
			
		||||
        />
 | 
			
		||||
      </div>
 | 
			
		||||
    </el-drawer>
 | 
			
		||||
    <!-- 新增 -->
 | 
			
		||||
    <energy-statistics-det-add ref="energyStatistics" @closeDet="closeDet" />
 | 
			
		||||
  </div>
 | 
			
		||||
	<div>
 | 
			
		||||
		<el-drawer
 | 
			
		||||
			:title="drawerTitle"
 | 
			
		||||
			:visible.sync="visible"
 | 
			
		||||
			size="70%"
 | 
			
		||||
			@close="closeD"
 | 
			
		||||
			:show-close="false">
 | 
			
		||||
			<div class="box">
 | 
			
		||||
				<el-form :inline="true">
 | 
			
		||||
					<el-form-item label="方案名称">
 | 
			
		||||
						<el-input
 | 
			
		||||
							v-model="name"
 | 
			
		||||
							size="small"
 | 
			
		||||
							readonly></el-input>
 | 
			
		||||
					</el-form-item>
 | 
			
		||||
					<el-form-item label="能源类型">
 | 
			
		||||
						<el-input
 | 
			
		||||
							v-model="energyTypeLabel"
 | 
			
		||||
							size="small"
 | 
			
		||||
							readonly></el-input>
 | 
			
		||||
					</el-form-item>
 | 
			
		||||
					<el-form-item>
 | 
			
		||||
						<el-button
 | 
			
		||||
							type="success"
 | 
			
		||||
							size="small"
 | 
			
		||||
							v-if="showBtn"
 | 
			
		||||
							plain
 | 
			
		||||
							@click="addNew">
 | 
			
		||||
							新增
 | 
			
		||||
						</el-button>
 | 
			
		||||
						<el-button
 | 
			
		||||
							type="danger"
 | 
			
		||||
							size="small"
 | 
			
		||||
							v-if="showBtn"
 | 
			
		||||
							plain
 | 
			
		||||
							@click="deleteAll">
 | 
			
		||||
							批量删除
 | 
			
		||||
						</el-button>
 | 
			
		||||
					</el-form-item>
 | 
			
		||||
				</el-form>
 | 
			
		||||
				<base-table
 | 
			
		||||
					:page="queryParams.pageNo"
 | 
			
		||||
					:limit="queryParams.pageSize"
 | 
			
		||||
					:table-props="tableProps"
 | 
			
		||||
					:table-data="tableData"
 | 
			
		||||
					:max-height="tableH"
 | 
			
		||||
					:selectWidth="55"
 | 
			
		||||
					@selection-change="selectChange">
 | 
			
		||||
					<method-btn
 | 
			
		||||
						v-if="tableBtn.length"
 | 
			
		||||
						slot="handleBtn"
 | 
			
		||||
						:width="80"
 | 
			
		||||
						label="操作"
 | 
			
		||||
						:method-list="tableBtn"
 | 
			
		||||
						@clickBtn="handleClick" />
 | 
			
		||||
				</base-table>
 | 
			
		||||
				<pagination
 | 
			
		||||
					:page.sync="queryParams.pageNo"
 | 
			
		||||
					:limit.sync="queryParams.pageSize"
 | 
			
		||||
					:total="total"
 | 
			
		||||
					@pagination="getList" />
 | 
			
		||||
			</div>
 | 
			
		||||
		</el-drawer>
 | 
			
		||||
		<!-- 新增 -->
 | 
			
		||||
		<energy-statistics-det-add
 | 
			
		||||
			ref="energyStatistics"
 | 
			
		||||
			@closeDet="closeDet" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyStatisticsDetPage, deleteEnergyStatisticsDet, deleteMany } from '@/api/monitoring/energyStatisticsDet'
 | 
			
		||||
import EnergyStatisticsDetAdd from './energyStatisticsDetAdd'
 | 
			
		||||
import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyStatisticsDetPage,
 | 
			
		||||
	deleteEnergyStatisticsDet,
 | 
			
		||||
	deleteMany,
 | 
			
		||||
} from '@/api/monitoring/energyStatisticsDet';
 | 
			
		||||
import EnergyStatisticsDetAdd from './energyStatisticsDetAdd';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '所属对象'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'paramName',
 | 
			
		||||
    label: '参数名称'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'unit',
 | 
			
		||||
    label: '单位',
 | 
			
		||||
    filter: publicFormatter('energy_unit')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'desc',
 | 
			
		||||
    label: '描述'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '所属对象',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'paramName',
 | 
			
		||||
		label: '参数名称',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
		label: '单位',
 | 
			
		||||
		filter: publicFormatter('unit_dict'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'desc',
 | 
			
		||||
		label: '描述',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'EnergyStatisticsDet',
 | 
			
		||||
  props: {
 | 
			
		||||
    energyTypeList: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      visible: false,
 | 
			
		||||
      drawerTitle: '',
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      tableBtn: [],
 | 
			
		||||
      tableH: this.tableHeight(115),
 | 
			
		||||
      total: 0,
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 30,
 | 
			
		||||
        statisticsId: null
 | 
			
		||||
      },
 | 
			
		||||
      name: '',
 | 
			
		||||
      energyType: '',
 | 
			
		||||
      energyTypeId: '',
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      addOrEditTitle: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      collectionList: [
 | 
			
		||||
        {value: 0,label: '否'},
 | 
			
		||||
        {value: 1,label: '是'}
 | 
			
		||||
      ],
 | 
			
		||||
      showBtn: true,
 | 
			
		||||
      selectedList: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  components: { EnergyStatisticsDetAdd },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(115)
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    init(data,title) {
 | 
			
		||||
      this.visible = true
 | 
			
		||||
      this.queryParams.statisticsId = data.id
 | 
			
		||||
      this.name = data.name
 | 
			
		||||
      this.energyType = data.energyType
 | 
			
		||||
      this.energyTypeId = data.energyTypeId
 | 
			
		||||
      this.getList()
 | 
			
		||||
      if (title === 'detail') {
 | 
			
		||||
        this.drawerTitle = '查看参数'
 | 
			
		||||
        this.showBtn = false
 | 
			
		||||
        this.tableBtn = []
 | 
			
		||||
      } else {
 | 
			
		||||
        this.drawerTitle = '参数绑定'
 | 
			
		||||
        this.showBtn = true
 | 
			
		||||
        this.tableBtn = [
 | 
			
		||||
          {
 | 
			
		||||
            type: 'delete',
 | 
			
		||||
            btnName: '删除'
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    getList() {
 | 
			
		||||
      console.log(this.queryParams)
 | 
			
		||||
      getEnergyStatisticsDetPage({...this.queryParams}).then((res) => {
 | 
			
		||||
        let arr = res.data.list || []
 | 
			
		||||
        arr&&arr.map(item => {
 | 
			
		||||
          this.collectionList.map(i => {
 | 
			
		||||
            if (item.collection === i.value) {
 | 
			
		||||
              item.collection = i.label
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          this.energyTypeList.map(j => {
 | 
			
		||||
            if (item.typeId === j.id) {
 | 
			
		||||
              item.typeId = j.name
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        })
 | 
			
		||||
        this.tableData = arr
 | 
			
		||||
        this.total = res.data.total;
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    // 新增
 | 
			
		||||
    addNew() {
 | 
			
		||||
      this.$nextTick(() => {
 | 
			
		||||
        this.$refs.energyStatistics.init({'statisticsId': this.queryParams.statisticsId, energyTypeId:this.energyTypeId})
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    selectChange(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      this.selectedList = val
 | 
			
		||||
    },
 | 
			
		||||
    // 批量删除
 | 
			
		||||
    deleteAll() {
 | 
			
		||||
      let arr = []
 | 
			
		||||
      if (this.selectedList.length === 0) {
 | 
			
		||||
        this.$modal.msgWarning("请选勾选数据")
 | 
			
		||||
        return false
 | 
			
		||||
      } else {
 | 
			
		||||
        this.selectedList.map((item) => {
 | 
			
		||||
          arr.push(item.id)
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      this.$modal.confirm('是否确认删除所有勾选的数据项?').then(function() {
 | 
			
		||||
          return deleteMany(arr);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.queryParams.pageNo = 1
 | 
			
		||||
          this.getList()
 | 
			
		||||
          this.$modal.msgSuccess("删除成功")
 | 
			
		||||
        }).catch(() => {})
 | 
			
		||||
    },
 | 
			
		||||
    handleCancel() {
 | 
			
		||||
      this.$refs.energyStatistics.formClear()
 | 
			
		||||
      this.centervisible = false
 | 
			
		||||
      this.addOrEditTitle = ''
 | 
			
		||||
    },
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.energyStatistics.submitForm()
 | 
			
		||||
    },
 | 
			
		||||
    successSubmit() {
 | 
			
		||||
      this.handleCancel()
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      this.handleDelete(val.data)
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      this.$modal.confirm('是否确认删除参数列名为"' + row.paramName + '"的数据项?').then(function() {
 | 
			
		||||
          return deleteEnergyStatisticsDet(row.id);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.queryParams.pageNo = 1
 | 
			
		||||
          this.getList()
 | 
			
		||||
          this.$modal.msgSuccess("删除成功")
 | 
			
		||||
        }).catch(() => {})
 | 
			
		||||
    },
 | 
			
		||||
    closeD() {
 | 
			
		||||
      this.$emit('closeDrawer')
 | 
			
		||||
    },
 | 
			
		||||
    closeDet() {  // 关闭新增框
 | 
			
		||||
      this.getList()
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'EnergyStatisticsDet',
 | 
			
		||||
	props: {
 | 
			
		||||
		energyTypeList: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			required: true,
 | 
			
		||||
			default: () => {
 | 
			
		||||
				return [];
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			visible: false,
 | 
			
		||||
			drawerTitle: '',
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			tableBtn: [],
 | 
			
		||||
			tableH: this.tableHeight(115),
 | 
			
		||||
			total: 0,
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 30,
 | 
			
		||||
				statisticsId: null,
 | 
			
		||||
			},
 | 
			
		||||
			name: '',
 | 
			
		||||
			energyTypeLabel: '',
 | 
			
		||||
			energyTypeId: '',
 | 
			
		||||
			// 弹出层标题
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			collectionList: [
 | 
			
		||||
				{ value: 0, label: '否' },
 | 
			
		||||
				{ value: 1, label: '是' },
 | 
			
		||||
			],
 | 
			
		||||
			showBtn: true,
 | 
			
		||||
			selectedList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	components: { EnergyStatisticsDetAdd },
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(115);
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(data, title) {
 | 
			
		||||
			this.visible = true;
 | 
			
		||||
			this.queryParams.statisticsId = data.id;
 | 
			
		||||
			this.name = data.name;
 | 
			
		||||
			this.energyTypeLabel = data.energyTypeLabel;
 | 
			
		||||
			this.energyTypeId = data.energyTypeId;
 | 
			
		||||
			this.getList();
 | 
			
		||||
			if (title === 'detail') {
 | 
			
		||||
				this.drawerTitle = '查看参数';
 | 
			
		||||
				this.showBtn = false;
 | 
			
		||||
				this.tableBtn = [];
 | 
			
		||||
			} else {
 | 
			
		||||
				this.drawerTitle = '参数绑定';
 | 
			
		||||
				this.showBtn = true;
 | 
			
		||||
				this.tableBtn = [
 | 
			
		||||
					{
 | 
			
		||||
						type: 'delete',
 | 
			
		||||
						btnName: '删除',
 | 
			
		||||
					},
 | 
			
		||||
				];
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		getList() {
 | 
			
		||||
			console.log(this.queryParams);
 | 
			
		||||
			getEnergyStatisticsDetPage({ ...this.queryParams }).then((res) => {
 | 
			
		||||
				let arr = res.data.list || [];
 | 
			
		||||
				arr &&
 | 
			
		||||
					arr.map((item) => {
 | 
			
		||||
						this.collectionList.map((i) => {
 | 
			
		||||
							if (item.collection === i.value) {
 | 
			
		||||
								item.collection = i.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
						this.energyTypeList.map((j) => {
 | 
			
		||||
							if (item.typeId === j.id) {
 | 
			
		||||
								item.typeId = j.name;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.tableData = arr;
 | 
			
		||||
				this.total = res.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		// 新增
 | 
			
		||||
		addNew() {
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.energyStatistics.init({
 | 
			
		||||
					statisticsId: this.queryParams.statisticsId,
 | 
			
		||||
					energyTypeId: this.energyTypeId,
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		selectChange(val) {
 | 
			
		||||
			console.log(val);
 | 
			
		||||
			this.selectedList = val;
 | 
			
		||||
		},
 | 
			
		||||
		// 批量删除
 | 
			
		||||
		deleteAll() {
 | 
			
		||||
			let arr = [];
 | 
			
		||||
			if (this.selectedList.length === 0) {
 | 
			
		||||
				this.$modal.msgWarning('请选勾选数据');
 | 
			
		||||
				return false;
 | 
			
		||||
			} else {
 | 
			
		||||
				this.selectedList.map((item) => {
 | 
			
		||||
					arr.push(item.id);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除所有勾选的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteMany(arr);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.$refs.energyStatistics.formClear();
 | 
			
		||||
			this.centervisible = false;
 | 
			
		||||
			this.addOrEditTitle = '';
 | 
			
		||||
		},
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.energyStatistics.submitForm();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.handleCancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(val) {
 | 
			
		||||
			this.handleDelete(val.data);
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除参数列名为"' + row.paramName + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyStatisticsDet(row.id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		closeD() {
 | 
			
		||||
			this.$emit('closeDrawer');
 | 
			
		||||
		},
 | 
			
		||||
		closeDet() {
 | 
			
		||||
			// 关闭新增框
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.box {
 | 
			
		||||
  padding: 0 32px;
 | 
			
		||||
	padding: 0 32px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,179 +1,178 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <el-drawer
 | 
			
		||||
    title="新增"
 | 
			
		||||
    :visible.sync="centervisible"
 | 
			
		||||
    size="60%"
 | 
			
		||||
    @close='closeA'
 | 
			
		||||
    :show-close='false'>
 | 
			
		||||
    <div class="box">
 | 
			
		||||
      <!-- 搜索工作栏 -->
 | 
			
		||||
      <search-bar
 | 
			
		||||
        :formConfigs="formConfig"
 | 
			
		||||
        ref="searchBarForm"
 | 
			
		||||
        :removeBlue='true'
 | 
			
		||||
        @headBtnClick="buttonClick"
 | 
			
		||||
      />
 | 
			
		||||
      <!-- 列表 -->
 | 
			
		||||
      <base-table
 | 
			
		||||
        :page="queryParams.pageNo"
 | 
			
		||||
        :limit="queryParams.pageSize"
 | 
			
		||||
        :table-props="tableProps"
 | 
			
		||||
        :table-data="list"
 | 
			
		||||
        :max-height="tableH"
 | 
			
		||||
        :selectWidth="55"
 | 
			
		||||
        @selection-change="selectChange"
 | 
			
		||||
      >
 | 
			
		||||
      </base-table>
 | 
			
		||||
      <pagination
 | 
			
		||||
        :page.sync="queryParams.pageNo"
 | 
			
		||||
        :limit.sync="queryParams.pageSize"
 | 
			
		||||
        :total="total"
 | 
			
		||||
        @pagination="getList"
 | 
			
		||||
      />
 | 
			
		||||
    </div>
 | 
			
		||||
  </el-drawer>
 | 
			
		||||
	<el-drawer
 | 
			
		||||
		title="新增"
 | 
			
		||||
		:visible.sync="centervisible"
 | 
			
		||||
		size="60%"
 | 
			
		||||
		@close="closeA"
 | 
			
		||||
		:show-close="false">
 | 
			
		||||
		<div class="box">
 | 
			
		||||
			<!-- 搜索工作栏 -->
 | 
			
		||||
			<search-bar
 | 
			
		||||
				:formConfigs="formConfig"
 | 
			
		||||
				ref="searchBarForm"
 | 
			
		||||
				:removeBlue="true"
 | 
			
		||||
				@headBtnClick="buttonClick" />
 | 
			
		||||
			<!-- 列表 -->
 | 
			
		||||
			<base-table
 | 
			
		||||
				:page="queryParams.pageNo"
 | 
			
		||||
				:limit="queryParams.pageSize"
 | 
			
		||||
				:table-props="tableProps"
 | 
			
		||||
				:table-data="list"
 | 
			
		||||
				:max-height="tableH"
 | 
			
		||||
				:selectWidth="55"
 | 
			
		||||
				@selection-change="selectChange"></base-table>
 | 
			
		||||
			<pagination
 | 
			
		||||
				:page.sync="queryParams.pageNo"
 | 
			
		||||
				:limit.sync="queryParams.pageSize"
 | 
			
		||||
				:total="total"
 | 
			
		||||
				@pagination="getList" />
 | 
			
		||||
		</div>
 | 
			
		||||
	</el-drawer>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { addParamPage, createEnergyStatisticsDet } from '@/api/monitoring/energyStatisticsDet'
 | 
			
		||||
import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import {
 | 
			
		||||
	addParamPage,
 | 
			
		||||
	createEnergyStatisticsDet,
 | 
			
		||||
} from '@/api/monitoring/energyStatisticsDet';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '所属对象'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'paramName',
 | 
			
		||||
    label: '参数名称'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'unit',
 | 
			
		||||
    label: '单位',
 | 
			
		||||
    filter: publicFormatter('energy_unit')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'desc',
 | 
			
		||||
    label: '描述'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '所属对象',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'paramName',
 | 
			
		||||
		label: '参数名称',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
		label: '单位',
 | 
			
		||||
		filter: publicFormatter('unit_dict'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'desc',
 | 
			
		||||
		label: '描述',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'EnergyStatisticsDetAdd',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '对象类型',
 | 
			
		||||
          selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
 | 
			
		||||
          labelField: 'label',
 | 
			
		||||
          valueField: 'value',
 | 
			
		||||
          param: 'objType'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'input',
 | 
			
		||||
          label: '参数名称',
 | 
			
		||||
          placeholder: '参数名称',
 | 
			
		||||
          param: 'paramName'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separate'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '关联',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'primary',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        energyTypeId: null,
 | 
			
		||||
        statisticId: null,
 | 
			
		||||
        paramName: '',
 | 
			
		||||
        objType: ''
 | 
			
		||||
      },
 | 
			
		||||
      tableProps,
 | 
			
		||||
      list: [],
 | 
			
		||||
      total: 0,
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      selectedList: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    init(param) {
 | 
			
		||||
      this.queryParams.statisticId = param.statisticsId
 | 
			
		||||
      this.queryParams.energyTypeId = param.energyTypeId
 | 
			
		||||
      window.addEventListener('resize', () => {
 | 
			
		||||
        this.tableH = this.tableHeight(260)
 | 
			
		||||
      })
 | 
			
		||||
      this.centervisible = true
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    getList() {
 | 
			
		||||
      addParamPage({...this.queryParams}).then((res) => {
 | 
			
		||||
        this.list = res.data.list || []
 | 
			
		||||
        this.total = res.data.total
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.queryParams.objType = val.objType
 | 
			
		||||
          this.queryParams.paramName = val.paramName
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          // 关联
 | 
			
		||||
          this.connectParam()
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 选中数据
 | 
			
		||||
    selectChange(val) {
 | 
			
		||||
      this.selectedList = val
 | 
			
		||||
    },
 | 
			
		||||
    // 关联
 | 
			
		||||
    connectParam() {
 | 
			
		||||
      let param = {
 | 
			
		||||
        statisticsId: this.queryParams.statisticId,
 | 
			
		||||
        plcParamIds: []
 | 
			
		||||
      }
 | 
			
		||||
      if (this.selectedList.length === 0) {
 | 
			
		||||
        this.$modal.msgWarning("请选勾选数据")
 | 
			
		||||
        return false
 | 
			
		||||
      } else {
 | 
			
		||||
        this.selectedList.map((item) => {
 | 
			
		||||
          param.plcParamIds.push(item.id)
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      createEnergyStatisticsDet({...param}).then((res) => {
 | 
			
		||||
        if (res.code === 0) {
 | 
			
		||||
          this.$modal.msgSuccess("操作成功");
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.getList()
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    closeA() {
 | 
			
		||||
      this.$emit('closeDet')
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'EnergyStatisticsDetAdd',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '对象类型',
 | 
			
		||||
					selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
 | 
			
		||||
					labelField: 'label',
 | 
			
		||||
					valueField: 'value',
 | 
			
		||||
					param: 'objType',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '参数名称',
 | 
			
		||||
					placeholder: '参数名称',
 | 
			
		||||
					param: 'paramName',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '关联',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				energyTypeId: null,
 | 
			
		||||
				statisticId: null,
 | 
			
		||||
				paramName: '',
 | 
			
		||||
				objType: '',
 | 
			
		||||
			},
 | 
			
		||||
			tableProps,
 | 
			
		||||
			list: [],
 | 
			
		||||
			total: 0,
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			selectedList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(param) {
 | 
			
		||||
			this.queryParams.statisticId = param.statisticsId;
 | 
			
		||||
			this.queryParams.energyTypeId = param.energyTypeId;
 | 
			
		||||
			window.addEventListener('resize', () => {
 | 
			
		||||
				this.tableH = this.tableHeight(260);
 | 
			
		||||
			});
 | 
			
		||||
			this.centervisible = true;
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		getList() {
 | 
			
		||||
			addParamPage({ ...this.queryParams }).then((res) => {
 | 
			
		||||
				this.list = res.data.list || [];
 | 
			
		||||
				this.total = res.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.queryParams.objType = val.objType;
 | 
			
		||||
					this.queryParams.paramName = val.paramName;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					// 关联
 | 
			
		||||
					this.connectParam();
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 选中数据
 | 
			
		||||
		selectChange(val) {
 | 
			
		||||
			this.selectedList = val;
 | 
			
		||||
		},
 | 
			
		||||
		// 关联
 | 
			
		||||
		connectParam() {
 | 
			
		||||
			let param = {
 | 
			
		||||
				statisticsId: this.queryParams.statisticId,
 | 
			
		||||
				plcParamIds: [],
 | 
			
		||||
			};
 | 
			
		||||
			if (this.selectedList.length === 0) {
 | 
			
		||||
				this.$modal.msgWarning('请选勾选数据');
 | 
			
		||||
				return false;
 | 
			
		||||
			} else {
 | 
			
		||||
				this.selectedList.map((item) => {
 | 
			
		||||
					param.plcParamIds.push(item.id);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			createEnergyStatisticsDet({ ...param }).then((res) => {
 | 
			
		||||
				if (res.code === 0) {
 | 
			
		||||
					this.$modal.msgSuccess('操作成功');
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		closeA() {
 | 
			
		||||
			this.$emit('closeDet');
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.box {
 | 
			
		||||
  padding: 0 32px;
 | 
			
		||||
	padding: 0 32px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,7 @@ import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import EnergyStatisticsAdd from './components/energyStatisticsAdd';
 | 
			
		||||
import EnergyStatisticsDet from './components/energyStatisticsDet';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
@@ -70,9 +71,9 @@ const tableProps = [
 | 
			
		||||
		filter: publicFormatter('statistic_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
		prop: 'energyTypeLabel',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'paramNum',
 | 
			
		||||
@@ -86,6 +87,7 @@ const tableProps = [
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EnergyStatistics',
 | 
			
		||||
	components: { EnergyStatisticsAdd, EnergyStatisticsDet },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
@@ -139,7 +141,6 @@ export default {
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
@@ -158,9 +159,6 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
@@ -187,6 +185,13 @@ export default {
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyStatisticsPage(this.queryParams).then((response) => {
 | 
			
		||||
				let arr = response.data.list || [];
 | 
			
		||||
				arr.map((item) => {
 | 
			
		||||
					this.getDictDatas('energy_type').map((subItem) => {
 | 
			
		||||
						if (item.energyType === subItem.value) {
 | 
			
		||||
							item.energyTypeLabel = subItem.label;
 | 
			
		||||
						}
 | 
			
		||||
					});
 | 
			
		||||
				});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,271 +1,289 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="orderEnergyContainer">
 | 
			
		||||
    <div class="box1">
 | 
			
		||||
      <!-- 搜索工作栏 -->
 | 
			
		||||
      <search-bar
 | 
			
		||||
        :formConfigs="formConfig"
 | 
			
		||||
        ref="searchBarForm"
 | 
			
		||||
        @headBtnClick="buttonClick"
 | 
			
		||||
      />
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="box2">
 | 
			
		||||
      <div class="boxTitle">
 | 
			
		||||
        <span class="blueTitle"></span>
 | 
			
		||||
        <span>工单信息</span>
 | 
			
		||||
      </div>
 | 
			
		||||
      <el-row>
 | 
			
		||||
        <el-col :span='4'>
 | 
			
		||||
          <div class="blodTip">工单名称</div>
 | 
			
		||||
          <div class="lightTip">{{ orderMsg.name }}</div>
 | 
			
		||||
        </el-col>
 | 
			
		||||
        <el-col :span='4'>
 | 
			
		||||
          <div class="blodTip">产品名称</div>
 | 
			
		||||
          <div class="lightTip">{{orderMsg.productName }}</div>
 | 
			
		||||
        </el-col>
 | 
			
		||||
        <el-col :span='4'>
 | 
			
		||||
          <div class="blodTip">计划完成数量</div>
 | 
			
		||||
          <div class="lightTip">{{orderMsg.planQuantity }}</div>
 | 
			
		||||
        </el-col>
 | 
			
		||||
        <el-col :span='4'>
 | 
			
		||||
          <div class="blodTip">实际开始时间</div>
 | 
			
		||||
          <div class="lightTip">{{ parseTime(orderMsg.startProduceTime) }}</div>
 | 
			
		||||
        </el-col>
 | 
			
		||||
        <el-col :span='4'>
 | 
			
		||||
          <div class="blodTip">实际完成时间</div>
 | 
			
		||||
          <div class="lightTip">{{ parseTime(orderMsg.finishProduceTime) }}</div>
 | 
			
		||||
        </el-col>
 | 
			
		||||
        <el-col :span='4'>
 | 
			
		||||
          <div class="blodTip">实际加工数量</div>
 | 
			
		||||
          <div class="lightTip">{{orderMsg.actualQuantity }}</div>
 | 
			
		||||
        </el-col>
 | 
			
		||||
      </el-row>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="box3">
 | 
			
		||||
      <div class="boxTitle">
 | 
			
		||||
        <span class="blueTitle"></span>
 | 
			
		||||
        <span>能耗信息</span>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="toggleTabBox">
 | 
			
		||||
        <div :class="{ active: activeModule === 'dataList' }" @click="toggleTab('dataList')">数据列表</div>
 | 
			
		||||
        <div :class="{ active: activeModule === 'barChart' }" @click="toggleTab('barChart')">柱状图</div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div>
 | 
			
		||||
        <div  v-show="activeModule === 'dataList'">
 | 
			
		||||
          <!-- 表格 -->
 | 
			
		||||
          <base-table
 | 
			
		||||
            :page="queryParams.pageNo"
 | 
			
		||||
            :limit="queryParams.pageSize"
 | 
			
		||||
            :table-props="tableProps"
 | 
			
		||||
            :table-data="tableData"
 | 
			
		||||
            :max-height="tableH"
 | 
			
		||||
          />
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- 图形 -->
 | 
			
		||||
        <div v-show="activeModule === 'barChart'">
 | 
			
		||||
          <bar-chart ref="orderEnergyChart" :chartData="chartData"/>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div class="orderEnergyContainer">
 | 
			
		||||
		<div class="box1">
 | 
			
		||||
			<!-- 搜索工作栏 -->
 | 
			
		||||
			<search-bar
 | 
			
		||||
				:formConfigs="formConfig"
 | 
			
		||||
				ref="searchBarForm"
 | 
			
		||||
				@headBtnClick="buttonClick" />
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="box2">
 | 
			
		||||
			<div class="boxTitle">
 | 
			
		||||
				<span class="blueTitle"></span>
 | 
			
		||||
				<span>工单信息</span>
 | 
			
		||||
			</div>
 | 
			
		||||
			<el-row>
 | 
			
		||||
				<el-col :span="4">
 | 
			
		||||
					<div class="blodTip">工单名称</div>
 | 
			
		||||
					<div class="lightTip">{{ orderMsg.name }}</div>
 | 
			
		||||
				</el-col>
 | 
			
		||||
				<el-col :span="4">
 | 
			
		||||
					<div class="blodTip">产品名称</div>
 | 
			
		||||
					<div class="lightTip">{{ orderMsg.productName }}</div>
 | 
			
		||||
				</el-col>
 | 
			
		||||
				<el-col :span="4">
 | 
			
		||||
					<div class="blodTip">计划完成数量</div>
 | 
			
		||||
					<div class="lightTip">{{ orderMsg.planQuantity }}</div>
 | 
			
		||||
				</el-col>
 | 
			
		||||
				<el-col :span="4">
 | 
			
		||||
					<div class="blodTip">实际开始时间</div>
 | 
			
		||||
					<div class="lightTip">{{ parseTime(orderMsg.startProduceTime) }}</div>
 | 
			
		||||
				</el-col>
 | 
			
		||||
				<el-col :span="4">
 | 
			
		||||
					<div class="blodTip">实际完成时间</div>
 | 
			
		||||
					<div class="lightTip">
 | 
			
		||||
						{{ parseTime(orderMsg.finishProduceTime) }}
 | 
			
		||||
					</div>
 | 
			
		||||
				</el-col>
 | 
			
		||||
				<el-col :span="4">
 | 
			
		||||
					<div class="blodTip">实际加工数量</div>
 | 
			
		||||
					<div class="lightTip">{{ orderMsg.actualQuantity }}</div>
 | 
			
		||||
				</el-col>
 | 
			
		||||
			</el-row>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="box3">
 | 
			
		||||
			<div class="boxTitle">
 | 
			
		||||
				<span class="blueTitle"></span>
 | 
			
		||||
				<span>能耗信息</span>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="toggleTabBox">
 | 
			
		||||
				<div
 | 
			
		||||
					:class="{ active: activeModule === 'dataList' }"
 | 
			
		||||
					@click="toggleTab('dataList')">
 | 
			
		||||
					数据列表
 | 
			
		||||
				</div>
 | 
			
		||||
				<div
 | 
			
		||||
					:class="{ active: activeModule === 'barChart' }"
 | 
			
		||||
					@click="toggleTab('barChart')">
 | 
			
		||||
					柱状图
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div>
 | 
			
		||||
				<div v-show="activeModule === 'dataList'">
 | 
			
		||||
					<!-- 表格 -->
 | 
			
		||||
					<base-table
 | 
			
		||||
						:page="queryParams.pageNo"
 | 
			
		||||
						:limit="queryParams.pageSize"
 | 
			
		||||
						:table-props="tableProps"
 | 
			
		||||
						:table-data="tableData"
 | 
			
		||||
						:max-height="tableH" />
 | 
			
		||||
				</div>
 | 
			
		||||
				<!-- 图形 -->
 | 
			
		||||
				<div v-show="activeModule === 'barChart'">
 | 
			
		||||
					<bar-chart
 | 
			
		||||
						ref="orderEnergyChart"
 | 
			
		||||
						:chartData="chartData" />
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '对象名称'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'energyType',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startNum',
 | 
			
		||||
    label: '工单开始值'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endNum',
 | 
			
		||||
    label: '工单结束值/当前值'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'useNum',
 | 
			
		||||
    label: '使用量'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType'
 | 
			
		||||
import { workOrderList } from '@/api/base/orderManage'
 | 
			
		||||
import { getWorkOrderMsg, getOrderEnergyData } from '@/api/monitoring/orderEnergy'
 | 
			
		||||
import BarChart from "./components/barChart"
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '对象名称',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startNum',
 | 
			
		||||
		label: '工单开始值',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endNum',
 | 
			
		||||
		label: '工单结束值/当前值',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'useNum',
 | 
			
		||||
		label: '使用量',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import { workOrderList } from '@/api/base/orderManage';
 | 
			
		||||
import {
 | 
			
		||||
	getWorkOrderMsg,
 | 
			
		||||
	getOrderEnergyData,
 | 
			
		||||
} from '@/api/monitoring/orderEnergy';
 | 
			
		||||
import BarChart from './components/barChart';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'OrderEnergy',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '工单',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'workOrderId',
 | 
			
		||||
          clearable: false
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '能源类型',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'energyTypeId',
 | 
			
		||||
          filterable: true,
 | 
			
		||||
          width: 120,
 | 
			
		||||
          clearable: false
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '对象维度',
 | 
			
		||||
          selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
 | 
			
		||||
          labelField: 'label',
 | 
			
		||||
          valueField: 'value',
 | 
			
		||||
          param: 'objType',
 | 
			
		||||
          width: 100,
 | 
			
		||||
          clearable: false
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      tableH: this.tableHeight(400),
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        workOrderId: '',
 | 
			
		||||
        objType: '',
 | 
			
		||||
        energyTypeId: ''
 | 
			
		||||
      },
 | 
			
		||||
      orderMsg: {},
 | 
			
		||||
      chartData: [],
 | 
			
		||||
      activeModule: 'dataList'
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  components: { BarChart },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(400)
 | 
			
		||||
    })
 | 
			
		||||
    this.getListArr()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getListArr() {
 | 
			
		||||
      workOrderList().then(res => {
 | 
			
		||||
        this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
      getEnergyTypeListAll().then(res => {
 | 
			
		||||
        this.formConfig[1].selectOptions = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      if (!val.workOrderId) {
 | 
			
		||||
        this.$modal.msgWarning('工单不能为空')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      if (!val.energyTypeId) {
 | 
			
		||||
        this.$modal.msgWarning('能源类型不能为空')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      if (!val.objType) {
 | 
			
		||||
        this.$modal.msgWarning('对象维度不能为空')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      this.queryParams.workOrderId = val.workOrderId
 | 
			
		||||
      this.queryParams.objType = val.objType
 | 
			
		||||
      this.queryParams.energyTypeId = val.energyTypeId
 | 
			
		||||
      getWorkOrderMsg({ ...this.queryParams }).then(res => {
 | 
			
		||||
        this.orderMsg = res.data || {}
 | 
			
		||||
        getOrderEnergyData({
 | 
			
		||||
          ...this.queryParams,
 | 
			
		||||
          startProduceTime: res.data.startProduceTime	 || '',
 | 
			
		||||
          finishProduceTime: res.data.finishProduceTime || ''
 | 
			
		||||
        }).then(result => {
 | 
			
		||||
          this.tableData = result.data || []
 | 
			
		||||
          this.chartData = result.data || []
 | 
			
		||||
        })
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    toggleTab(val) {
 | 
			
		||||
      this.activeModule = val
 | 
			
		||||
      if (this.activeModule === 'barChart') {
 | 
			
		||||
        this.$nextTick((res) => {
 | 
			
		||||
          this.$refs.orderEnergyChart.getChart()
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    headBtnClick() {}
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'OrderEnergy',
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '工单',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'workOrderId',
 | 
			
		||||
					clearable: false,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '能源类型',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'energyTypeId',
 | 
			
		||||
					labelField: 'labelName',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
					width: 120,
 | 
			
		||||
					clearable: false,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '对象维度',
 | 
			
		||||
					selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
 | 
			
		||||
					labelField: 'label',
 | 
			
		||||
					valueField: 'value',
 | 
			
		||||
					param: 'objType',
 | 
			
		||||
					width: 100,
 | 
			
		||||
					clearable: false,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			heightNum: 400,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				workOrderId: '',
 | 
			
		||||
				objType: '',
 | 
			
		||||
				energyTypeId: '',
 | 
			
		||||
			},
 | 
			
		||||
			orderMsg: {},
 | 
			
		||||
			chartData: [],
 | 
			
		||||
			activeModule: 'dataList',
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	components: { BarChart },
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getListArr();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getListArr() {
 | 
			
		||||
			workOrderList().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
			getEnergyTypeListAll().then((res) => {
 | 
			
		||||
				this.formConfig[1].selectOptions = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			if (!val.workOrderId) {
 | 
			
		||||
				this.$modal.msgWarning('工单不能为空');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (!val.energyTypeId) {
 | 
			
		||||
				this.$modal.msgWarning('能源类型不能为空');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (!val.objType) {
 | 
			
		||||
				this.$modal.msgWarning('对象维度不能为空');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			this.queryParams.workOrderId = val.workOrderId;
 | 
			
		||||
			this.queryParams.objType = val.objType;
 | 
			
		||||
			this.queryParams.energyTypeId = val.energyTypeId;
 | 
			
		||||
			getWorkOrderMsg({ ...this.queryParams }).then((res) => {
 | 
			
		||||
				this.orderMsg = res.data || {};
 | 
			
		||||
				getOrderEnergyData({
 | 
			
		||||
					...this.queryParams,
 | 
			
		||||
					startProduceTime: res.data.startProduceTime || '',
 | 
			
		||||
					finishProduceTime: res.data.finishProduceTime || '',
 | 
			
		||||
				}).then((result) => {
 | 
			
		||||
					this.tableData = result.data || [];
 | 
			
		||||
					this.chartData = result.data || [];
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		toggleTab(val) {
 | 
			
		||||
			this.activeModule = val;
 | 
			
		||||
			if (this.activeModule === 'barChart') {
 | 
			
		||||
				this.$nextTick((res) => {
 | 
			
		||||
					this.$refs.orderEnergyChart.getChart();
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		headBtnClick() {},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang='scss' scoped>
 | 
			
		||||
.orderEnergyContainer {
 | 
			
		||||
  background-color: rgb(242, 244, 249);
 | 
			
		||||
  .box1, .box2, .box3 {
 | 
			
		||||
    background-color: #fff;
 | 
			
		||||
    border-radius: 9px;
 | 
			
		||||
  }
 | 
			
		||||
  .box1 {
 | 
			
		||||
    height: 64px;
 | 
			
		||||
    padding: 12px 16px 0;
 | 
			
		||||
  }
 | 
			
		||||
  .box2 {
 | 
			
		||||
    height: 122px;
 | 
			
		||||
    margin: 8px 0;
 | 
			
		||||
    padding: 16px;
 | 
			
		||||
    .blodTip {
 | 
			
		||||
      font-weight: 600;
 | 
			
		||||
      color: rgba(0,0,0,0.85);
 | 
			
		||||
      margin-bottom: 8px;
 | 
			
		||||
    }
 | 
			
		||||
    .lightTip {
 | 
			
		||||
      font-weight: 400;
 | 
			
		||||
      color: rgba(102,102,102,0.75);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  .box3 {
 | 
			
		||||
    padding: 16px;
 | 
			
		||||
    height: calc(100vh - 330px);
 | 
			
		||||
    .toggleTabBox {
 | 
			
		||||
      display: inline-block;
 | 
			
		||||
      div {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        padding:0 8px 4px;
 | 
			
		||||
        color: rgba(102, 102, 102, 0.5);
 | 
			
		||||
        border-bottom: 2px solid rgba(242, 244, 249, 1);
 | 
			
		||||
        cursor: pointer;
 | 
			
		||||
      }
 | 
			
		||||
      .active {
 | 
			
		||||
        color: rgba(0,0,0,0.85);
 | 
			
		||||
        border-bottom-color: #0B58FF;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  .boxTitle {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    font-weight: 400;
 | 
			
		||||
    color: #000000;
 | 
			
		||||
    margin:0 10px 20px 0;
 | 
			
		||||
  }
 | 
			
		||||
  .blueTitle {
 | 
			
		||||
    content: '';
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: 4px;
 | 
			
		||||
    height: 18px;
 | 
			
		||||
    background-color: #0B58FF;
 | 
			
		||||
    border-radius: 1px;
 | 
			
		||||
    margin-right: 8px;
 | 
			
		||||
    vertical-align: bottom;
 | 
			
		||||
  }
 | 
			
		||||
	background-color: rgb(242, 244, 249);
 | 
			
		||||
	.box1,
 | 
			
		||||
	.box2,
 | 
			
		||||
	.box3 {
 | 
			
		||||
		background-color: #fff;
 | 
			
		||||
		border-radius: 9px;
 | 
			
		||||
	}
 | 
			
		||||
	.box1 {
 | 
			
		||||
		height: 64px;
 | 
			
		||||
		padding: 12px 16px 0;
 | 
			
		||||
	}
 | 
			
		||||
	.box2 {
 | 
			
		||||
		height: 122px;
 | 
			
		||||
		margin: 8px 0;
 | 
			
		||||
		padding: 16px;
 | 
			
		||||
		.blodTip {
 | 
			
		||||
			font-weight: 600;
 | 
			
		||||
			color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
			margin-bottom: 8px;
 | 
			
		||||
		}
 | 
			
		||||
		.lightTip {
 | 
			
		||||
			font-weight: 400;
 | 
			
		||||
			color: rgba(102, 102, 102, 0.75);
 | 
			
		||||
			overflow: hidden;
 | 
			
		||||
			white-space: nowrap;
 | 
			
		||||
			text-overflow: ellipsis;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	.box3 {
 | 
			
		||||
		padding: 16px;
 | 
			
		||||
		height: calc(100vh - 330px);
 | 
			
		||||
		.toggleTabBox {
 | 
			
		||||
			display: inline-block;
 | 
			
		||||
			div {
 | 
			
		||||
				display: inline-block;
 | 
			
		||||
				padding: 0 8px 4px;
 | 
			
		||||
				color: rgba(102, 102, 102, 0.5);
 | 
			
		||||
				border-bottom: 2px solid rgba(242, 244, 249, 1);
 | 
			
		||||
				cursor: pointer;
 | 
			
		||||
			}
 | 
			
		||||
			.active {
 | 
			
		||||
				color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
				border-bottom-color: #0b58ff;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	.boxTitle {
 | 
			
		||||
		display: inline-block;
 | 
			
		||||
		font-size: 16px;
 | 
			
		||||
		font-weight: 400;
 | 
			
		||||
		color: #000000;
 | 
			
		||||
		margin: 0 10px 20px 0;
 | 
			
		||||
	}
 | 
			
		||||
	.blueTitle {
 | 
			
		||||
		content: '';
 | 
			
		||||
		display: inline-block;
 | 
			
		||||
		width: 4px;
 | 
			
		||||
		height: 18px;
 | 
			
		||||
		background-color: #0b58ff;
 | 
			
		||||
		border-radius: 1px;
 | 
			
		||||
		margin-right: 8px;
 | 
			
		||||
		vertical-align: bottom;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -290,6 +290,7 @@ export default {
 | 
			
		||||
								sunNum += item.orderMonitorVOS[i].actualquantity || 0;
 | 
			
		||||
								arr3.push(subObj);
 | 
			
		||||
							}
 | 
			
		||||
							woIdString = woIdString.slice(0, -1);
 | 
			
		||||
						}
 | 
			
		||||
						item.woIdString = woIdString;
 | 
			
		||||
						arr3.push({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user