projects/mesxc-zhp #304
							
								
								
									
										6
									
								
								.env.dev
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								.env.dev
									
									
									
									
									
								
							@@ -1,8 +1,8 @@
 | 
			
		||||
###
 | 
			
		||||
 # @Author: Do not edit
 | 
			
		||||
 # @Date: 2023-08-29 09:40:39
 | 
			
		||||
 # @LastEditTime: 2024-04-01 08:31:57
 | 
			
		||||
 # @LastEditors: zhp
 | 
			
		||||
 # @LastEditTime: 2024-04-03 11:22:19
 | 
			
		||||
 # @LastEditors: DY
 | 
			
		||||
 # @Description:
 | 
			
		||||
###
 | 
			
		||||
# 开发环境配置
 | 
			
		||||
@@ -18,7 +18,7 @@ VUE_APP_TITLE = MES系统
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.4.173:48082'
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.1.104:48082'
 | 
			
		||||
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
 | 
			
		||||
# VUE_APP_BASE_API = 'http://192.168.1.62:48082'
 | 
			
		||||
 
 | 
			
		||||
@@ -34,4 +34,22 @@ export function getQoq(data) {
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获取能源设备树
 | 
			
		||||
export function getTree() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/analysis/energy-analysis/getTree',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 导出(走势分析)
 | 
			
		||||
export function exportTrend(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/analysis/energy-analysis/exportTrend',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    responseType: 'blob',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
@@ -68,3 +68,4 @@ export function exportEnergyTypeExcel(query) {
 | 
			
		||||
    responseType: 'blob'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ export default {
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
 | 
			
		||||
		window.addEventListener('resize', this._setTableHeight);
 | 
			
		||||
	},
 | 
			
		||||
	destroyed() {
 | 
			
		||||
@@ -12,7 +13,8 @@ export default {
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		_setTableHeight() {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
			this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
 | 
			
		||||
			// this.tableH = this.tableHeight(260);
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -97,6 +97,8 @@ export const DICT_TYPE = {
 | 
			
		||||
  TABLE_NAME: 'table_name',
 | 
			
		||||
  METHOD: 'method',
 | 
			
		||||
  PUSH: 'push',
 | 
			
		||||
  ENERGY_TYPE: 'energy_type',
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // ============== ORDER - 订单模块 =============
 | 
			
		||||
  ORDER_STATUS: 'order_status',
 | 
			
		||||
@@ -117,7 +119,7 @@ export const DICT_TYPE = {
 | 
			
		||||
 | 
			
		||||
  // ============== GROUP - 班组模块 =============
 | 
			
		||||
  WORK_SHOP: 'workshop',
 | 
			
		||||
    // ============== GROUP - 质量模块 =============
 | 
			
		||||
  // ============== GROUP - 质量模块 =============
 | 
			
		||||
  MATERIAL_GRADE: 'material_grade'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -33,38 +34,49 @@ import {
 | 
			
		||||
	getcoreAlarmLogPage
 | 
			
		||||
} from '@/api/base/coreAlarmLog';
 | 
			
		||||
import {DICT_TYPE, getDictDatas, publicFormatter } from "@/utils/dict";
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'alarmTime',
 | 
			
		||||
		label: '报警时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'alarmSource',
 | 
			
		||||
		label: '报警来源'
 | 
			
		||||
		label: '报警来源',
 | 
			
		||||
		width: 200,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'alarmType',
 | 
			
		||||
		label: '报警类型'
 | 
			
		||||
		label: '报警类型',
 | 
			
		||||
		width: 180,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'alarmGrade',
 | 
			
		||||
		label: '报警级别',
 | 
			
		||||
		filter: publicFormatter(DICT_TYPE.EQU_ALARM_LEVEL)
 | 
			
		||||
		filter: publicFormatter(DICT_TYPE.EQU_ALARM_LEVEL),
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'alarmReason',
 | 
			
		||||
		label: '报警原因'
 | 
			
		||||
		label: '报警原因',
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'alarmContent',
 | 
			
		||||
		label: '报警详细'
 | 
			
		||||
		label: '报警详细',
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
@@ -74,7 +86,7 @@ export default {
 | 
			
		||||
			tableBtn: [].filter((v)=>v),
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			listQuery: {
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        total: 0,
 | 
			
		||||
				alarmSource: undefined,
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2021-11-18 14:16:25
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @LastEditTime: 2024-03-20 16:20:39
 | 
			
		||||
 * @LastEditTime: 2024-04-02 16:46:17
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
@@ -96,7 +96,7 @@ export default {
 | 
			
		||||
			dataRule: {
 | 
			
		||||
        code: [{ required: true, message: "客户编号不能为空", trigger: "blur" }],
 | 
			
		||||
        name: [{ required: true, message: "客户名称不能为空", trigger: "blur" }],
 | 
			
		||||
				contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
 | 
			
		||||
				// contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
 | 
			
		||||
				telephone: [
 | 
			
		||||
					{ required: false, trigger: "blur", message: "手机号不能为空" },
 | 
			
		||||
          {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -45,41 +46,56 @@ import {
 | 
			
		||||
	getCustomerPage,
 | 
			
		||||
	deleteCustomer
 | 
			
		||||
} from '@/api/base/coreCustomer';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '添加时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '客户名称'
 | 
			
		||||
		label: '客户名称',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '客户编码'
 | 
			
		||||
		label: '客户编码',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'contact',
 | 
			
		||||
		label: '联系人'
 | 
			
		||||
		label: '联系人',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'telephone',
 | 
			
		||||
		label: '联系电话'
 | 
			
		||||
		label: '联系电话',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'address',
 | 
			
		||||
		label: '地址'
 | 
			
		||||
		label: '地址',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -45,6 +46,7 @@ import {
 | 
			
		||||
	getCoreDepartmentPage,
 | 
			
		||||
	deleteCoreDepartment
 | 
			
		||||
} from '@/api/base/coreDepartment';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
@@ -71,7 +73,7 @@ const tableProps = [
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -64,8 +64,8 @@
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item label="进场日期" prop="enterTime" :rules="[]">
 | 
			
		||||
					<el-date-picker v-model="form.enterTime" :disabled="disabled" type="datetime" placeholder="请选择进场日期"
 | 
			
		||||
				<el-form-item label="进厂日期" prop="enterTime" :rules="[]">
 | 
			
		||||
					<el-date-picker v-model="form.enterTime" :disabled="disabled" type="datetime" placeholder="请选择进厂日期"
 | 
			
		||||
						value-format="timestamp"></el-date-picker>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -78,7 +79,7 @@
 | 
			
		||||
					queryParams: {
 | 
			
		||||
						equipmentId: form.id,
 | 
			
		||||
						pageNo: 1,
 | 
			
		||||
						pageSize: 10,
 | 
			
		||||
						pageSize: 20,
 | 
			
		||||
					},
 | 
			
		||||
					tableBtn: [
 | 
			
		||||
						this.$auth.hasPermi('base:core-equipment-attr:update')
 | 
			
		||||
@@ -118,6 +119,7 @@ import {
 | 
			
		||||
} from '@/api/base/equipment';
 | 
			
		||||
import Editor from '@/components/Editor';
 | 
			
		||||
import AssetsUpload from './components/AssetsUpload.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'Equipment',
 | 
			
		||||
@@ -125,7 +127,7 @@ export default {
 | 
			
		||||
		Editor,
 | 
			
		||||
		EquipmentDrawer,
 | 
			
		||||
	},
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: ['name', 'code'],
 | 
			
		||||
@@ -157,8 +159,8 @@ export default {
 | 
			
		||||
					width: 180,
 | 
			
		||||
					filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'name', label: '设备名称' },
 | 
			
		||||
				{ width: 256, prop: 'code', label: '设备编码' },
 | 
			
		||||
				{ prop: 'name', label: '设备名称', width: 180, showOverflowtooltip: true },
 | 
			
		||||
				{ width: 250, prop: 'code', label: '设备编码' },
 | 
			
		||||
				{ prop: 'equipmentTypeName', label: '设备类型' },
 | 
			
		||||
				{ prop: 'enName', label: '英文名称' },
 | 
			
		||||
				{ prop: 'abbr', label: '缩写' },
 | 
			
		||||
@@ -484,7 +486,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				code: '',
 | 
			
		||||
				name: '',
 | 
			
		||||
				special: false
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -51,13 +52,13 @@
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import DialogForm from './dialogForm.vue';
 | 
			
		||||
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
// import { getAccessToken } from '@/utils/auth';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentLineBind',
 | 
			
		||||
	components: { DialogForm },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			basePath: '/base/core-equipment-bind-section',
 | 
			
		||||
@@ -81,12 +82,13 @@ export default {
 | 
			
		||||
					prop: 'createTime',
 | 
			
		||||
					label: '添加时间',
 | 
			
		||||
					fixed: true,
 | 
			
		||||
					width: 180,
 | 
			
		||||
					width: 150,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
					filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'productionLineName', label: '产线名称' },
 | 
			
		||||
				{ prop: 'workshopSectionName', label: '工段名称' },
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备名称' },
 | 
			
		||||
				{ prop: 'productionLineName', label: '产线名称', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'workshopSectionName', label: '工段名称', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备名称', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'sort', label: '工段中排序' },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'lineDataType',
 | 
			
		||||
@@ -236,7 +238,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				equipmentName: null,
 | 
			
		||||
				productionLineId: null,
 | 
			
		||||
			},
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -50,6 +51,7 @@
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
import {
 | 
			
		||||
	createEquipmentType,
 | 
			
		||||
@@ -65,7 +67,7 @@ import {
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentType',
 | 
			
		||||
	components: {},
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: ['name'],
 | 
			
		||||
@@ -171,7 +173,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				name: '',
 | 
			
		||||
			},
 | 
			
		||||
			// 表单参数
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -43,38 +44,51 @@ import basicPage from '../../core/mixins/basic-page';
 | 
			
		||||
import { parseTime } from '../../core/mixins/code-filter';
 | 
			
		||||
import { getHotMaterialPage, deleteHotMaterial } from '@/api/base/coreHotMaterial';
 | 
			
		||||
import { publicFormatter } from "@/utils/dict";
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '添加时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 180,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '原料名称'
 | 
			
		||||
		label: '原料名称',
 | 
			
		||||
		minWidth: 250,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '原料编码'
 | 
			
		||||
		label: '原料编码',
 | 
			
		||||
		width: 250,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
		label: '单位',
 | 
			
		||||
		filter: publicFormatter('unit_dict')
 | 
			
		||||
		filter: publicFormatter('unit_dict'),
 | 
			
		||||
		width: 90,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'dailyCost',
 | 
			
		||||
		label: '每日消耗量'
 | 
			
		||||
		label: '每日消耗量',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -45,6 +46,7 @@ import {
 | 
			
		||||
	getCoreMajorPage,
 | 
			
		||||
	deleteCoreMajor
 | 
			
		||||
} from '@/api/base/coreMajor';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
@@ -71,7 +73,7 @@ const tableProps = [
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,15 +2,17 @@
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2021-11-18 14:16:25
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @LastEditTime: 2024-03-13 13:54:01
 | 
			
		||||
 * @LastEditTime: 2024-03-27 13:47:24
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<el-drawer
 | 
			
		||||
		:visible.sync="visible"
 | 
			
		||||
		:show-close="false"
 | 
			
		||||
		:wrapper-closable="isdetail"
 | 
			
		||||
		:wrapper-closable="true"
 | 
			
		||||
		class="drawer"
 | 
			
		||||
		:before-close="beforeClose"
 | 
			
		||||
		@closed="$emit('destroy')"
 | 
			
		||||
		size="60%">
 | 
			
		||||
		<small-title slot="title" :no-padding="true">
 | 
			
		||||
			{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
 | 
			
		||||
@@ -262,6 +264,15 @@ export default {
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {},
 | 
			
		||||
	methods: {
 | 
			
		||||
		beforeClose(done) {
 | 
			
		||||
			if (!this.isdetail) {
 | 
			
		||||
				this.$confirm('确认关闭?')
 | 
			
		||||
					.then(_ => {
 | 
			
		||||
						done();
 | 
			
		||||
					})
 | 
			
		||||
					.catch(_ => {});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		clearArea() {
 | 
			
		||||
			this.$set(this.dataForm, 'area', 0)
 | 
			
		||||
			this.$set(this.dataForm, 'weight', 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -26,7 +27,8 @@
 | 
			
		||||
		<add-or-update
 | 
			
		||||
			v-if="addOrUpdateVisible"
 | 
			
		||||
			ref="addOrUpdate"
 | 
			
		||||
			@refreshDataList="getDataList" />
 | 
			
		||||
			@refreshDataList="getDataList"
 | 
			
		||||
			@destroy="addOrUpdateVisible = false" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -39,43 +41,58 @@ import {
 | 
			
		||||
	getCoreProductPage,
 | 
			
		||||
	deleteCoreProduct
 | 
			
		||||
} from '@/api/base/coreProduct';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '添加时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '产品名称'
 | 
			
		||||
		label: '产品名称',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '产品编码'
 | 
			
		||||
		label: '产品编码',
 | 
			
		||||
		width: 190,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'productType',
 | 
			
		||||
		label: '产品类型',
 | 
			
		||||
		filter: publicFormatter('product_type')
 | 
			
		||||
		filter: publicFormatter('product_type'),
 | 
			
		||||
		width: 180,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'specifications',
 | 
			
		||||
		label: '规格'
 | 
			
		||||
		label: '规格',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
		label: '单位',
 | 
			
		||||
		filter: publicFormatter('unit_dict')
 | 
			
		||||
		filter: publicFormatter('unit_dict'),
 | 
			
		||||
		width: 90,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -48,34 +49,47 @@ import {
 | 
			
		||||
import { getStatus } from '@/api/core/base/productionLine';
 | 
			
		||||
import codeFilter from '../../core/mixins/code-filter';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '添加时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'factoryName',
 | 
			
		||||
		label: '工厂'
 | 
			
		||||
		label: '工厂',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'roomNameDict',
 | 
			
		||||
		label: '车间名称',
 | 
			
		||||
		filter: publicFormatter('workshop')
 | 
			
		||||
		filter: publicFormatter('workshop'),
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '产线名称'
 | 
			
		||||
		label: '产线名称',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '产线编码'
 | 
			
		||||
		label: '产线编码',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'enabled',
 | 
			
		||||
		label: '当前状态',
 | 
			
		||||
		filter: codeFilter('lineStatus')
 | 
			
		||||
		filter: codeFilter('lineStatus'),
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	// {
 | 
			
		||||
	// 	prop: 'tvalue',
 | 
			
		||||
@@ -83,16 +97,20 @@ const tableProps = [
 | 
			
		||||
	// },
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'description',
 | 
			
		||||
		label: '描述'
 | 
			
		||||
		label: '描述',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2021-11-18 14:16:25
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @LastEditTime: 2023-11-22 10:27:43
 | 
			
		||||
 * @LastEditTime: 2024-04-02 16:46:49
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
@@ -79,7 +79,7 @@ export default {
 | 
			
		||||
			dataRule: {
 | 
			
		||||
        code: [{ required: true, message: "供应商编号不能为空", trigger: "blur" }],
 | 
			
		||||
        name: [{ required: true, message: "供应商名称不能为空", trigger: "blur" }],
 | 
			
		||||
				contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
 | 
			
		||||
				// contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
 | 
			
		||||
				telephone: [
 | 
			
		||||
					{ required: false, trigger: "blur", message: "手机号不能为空" },
 | 
			
		||||
          {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -45,41 +46,56 @@ import {
 | 
			
		||||
	getCoreSupplierPage,
 | 
			
		||||
	deleteCoreSupplier
 | 
			
		||||
} from '@/api/base/coreSupplier';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '添加时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '供应商编码'
 | 
			
		||||
		label: '供应商编码',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '供应商名称'
 | 
			
		||||
		label: '供应商名称',
 | 
			
		||||
		width: 180,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'contact',
 | 
			
		||||
		label: '联系人'
 | 
			
		||||
		label: '联系人',
 | 
			
		||||
		width: 180,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'telephone',
 | 
			
		||||
		label: '联系电话'
 | 
			
		||||
		label: '联系电话',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'address',
 | 
			
		||||
		label: '地址'
 | 
			
		||||
		label: '地址',
 | 
			
		||||
		width: 180,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		minWidth: 90,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -46,20 +47,27 @@ import {
 | 
			
		||||
	deleteCoreWorker
 | 
			
		||||
} from '@/api/base/coreWorker';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '创建时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '姓名'
 | 
			
		||||
		label: '姓名',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '员工号'
 | 
			
		||||
		label: '员工号',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'sex',
 | 
			
		||||
@@ -70,32 +78,44 @@ const tableProps = [
 | 
			
		||||
		prop: 'entryTime',
 | 
			
		||||
		label: '入职时间',
 | 
			
		||||
		filter: (val) => val ? moment(val).format('yyyy-MM-DD') : '',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'telephone',
 | 
			
		||||
		label: '联系电话'
 | 
			
		||||
		label: '联系电话',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'status',
 | 
			
		||||
		label: '状态',
 | 
			
		||||
		filter: (val) => ['', '在职', '离职'][val]
 | 
			
		||||
		filter: (val) => ['', '在职', '离职'][val],
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'departmentName',
 | 
			
		||||
		label: '部门'
 | 
			
		||||
		label: '部门',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'majorName',
 | 
			
		||||
		label: '专业'
 | 
			
		||||
		label: '专业',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -45,12 +46,14 @@ import {
 | 
			
		||||
	getCWSectionPage,
 | 
			
		||||
	deleteCWSection
 | 
			
		||||
} from '@/api/base/coreWorkshopSection';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		label: '添加时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
@@ -70,12 +73,13 @@ const tableProps = [
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -40,6 +41,7 @@ import {
 | 
			
		||||
} from '@/api/base/material';
 | 
			
		||||
import { listData } from "@/api/system/dict/data";
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
@@ -75,7 +77,7 @@ const tableProps = [
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -38,6 +39,7 @@ import {
 | 
			
		||||
	getMaterialPBPage,
 | 
			
		||||
	deleteMaterialPB
 | 
			
		||||
} from '@/api/base/materialProductBom';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
@@ -55,7 +57,7 @@ const tableProps = [
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	components: {
 | 
			
		||||
		AddOrUpdate,
 | 
			
		||||
	},
 | 
			
		||||
 
 | 
			
		||||
@@ -106,6 +106,10 @@ export default {
 | 
			
		||||
		activeIndex(val) {
 | 
			
		||||
			this.initChart(val);
 | 
			
		||||
		},
 | 
			
		||||
		daterange(val) {
 | 
			
		||||
			console.log('222', val)
 | 
			
		||||
			this.templateOption.xAxis.data = val
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		/**
 | 
			
		||||
@@ -124,8 +128,8 @@ export default {
 | 
			
		||||
		},
 | 
			
		||||
		/** 初始化/设置 图表 */
 | 
			
		||||
		initChart(val) {
 | 
			
		||||
			console.log('tableData', this.tableData);
 | 
			
		||||
			if (!this.chart) this.chart = echarts.init(this.$refs.chartDiv);
 | 
			
		||||
			this.chart.clear();
 | 
			
		||||
			switch (val) {
 | 
			
		||||
				case 0:
 | 
			
		||||
					const eqCt = this.tableData.map((row) => ({
 | 
			
		||||
@@ -139,7 +143,7 @@ export default {
 | 
			
		||||
						...this.templateOption,
 | 
			
		||||
						yAxis: { ...this.templateOption.yAxis, name: '设备CT' },
 | 
			
		||||
						series: eqCt,
 | 
			
		||||
					});
 | 
			
		||||
					}, true);
 | 
			
		||||
					break;
 | 
			
		||||
				case 1:
 | 
			
		||||
					const eqTt = this.tableData.map((row) => ({
 | 
			
		||||
@@ -153,7 +157,7 @@ export default {
 | 
			
		||||
						...this.templateOption,
 | 
			
		||||
						yAxis: { ...this.templateOption.yAxis, name: '设备TT' },
 | 
			
		||||
						series: eqTt,
 | 
			
		||||
					});
 | 
			
		||||
					}, true);
 | 
			
		||||
					break;
 | 
			
		||||
				case 2:
 | 
			
		||||
					const plCt = this.tableData.map((row) => ({
 | 
			
		||||
@@ -167,7 +171,7 @@ export default {
 | 
			
		||||
						...this.templateOption,
 | 
			
		||||
						yAxis: { ...this.templateOption.yAxis, name: '产线CT' },
 | 
			
		||||
						series: plCt,
 | 
			
		||||
					});
 | 
			
		||||
					}, true);
 | 
			
		||||
					break;
 | 
			
		||||
				case 3:
 | 
			
		||||
					const plTt = this.tableData.map((row) => ({
 | 
			
		||||
@@ -181,9 +185,10 @@ export default {
 | 
			
		||||
						...this.templateOption,
 | 
			
		||||
						yAxis: { ...this.templateOption.yAxis, name: '产线TT' },
 | 
			
		||||
						series: plTt,
 | 
			
		||||
					});
 | 
			
		||||
					}, true);
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.activeIndex = 0
 | 
			
		||||
					const eqCt2 = this.tableData.map((row) => ({
 | 
			
		||||
						name: row.equName,
 | 
			
		||||
						type: 'line',
 | 
			
		||||
@@ -195,7 +200,7 @@ export default {
 | 
			
		||||
						...this.templateOption,
 | 
			
		||||
						yAxis: { ...this.templateOption.yAxis, name: '设备CT' },
 | 
			
		||||
						series: eqCt2,
 | 
			
		||||
					});
 | 
			
		||||
					}, true);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
 
 | 
			
		||||
@@ -18,13 +18,15 @@
 | 
			
		||||
						:page="1"
 | 
			
		||||
						:limit="999"
 | 
			
		||||
						:table-props="tableProps"
 | 
			
		||||
						:table-data="tableData" />
 | 
			
		||||
						:table-data="tableData"
 | 
			
		||||
						:max-height="tableH" />
 | 
			
		||||
					<div v-if="tableData.length == 0" class="no-data-bg"></div>
 | 
			
		||||
				</el-tab-pane>
 | 
			
		||||
				<el-tab-pane :label="'\u3000产线平衡分析图\u3000'" name="graph">
 | 
			
		||||
					<div class="graph" style="height: 800px">
 | 
			
		||||
						<!-- graph  -->
 | 
			
		||||
						<AnalysisChart
 | 
			
		||||
							ref="analysisChart"
 | 
			
		||||
							v-if="activeName == 'graph'"
 | 
			
		||||
							:table-data="tableData"
 | 
			
		||||
							:daterange="dateArr"></AnalysisChart>
 | 
			
		||||
@@ -47,13 +49,14 @@ import BalanceChart from '../balanceChart';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import AnalysisChart from './chart.vue';
 | 
			
		||||
import { parseTime } from '@/utils/ruoyi'
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	components: {
 | 
			
		||||
		BalanceChart,
 | 
			
		||||
		AnalysisChart,
 | 
			
		||||
	},
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			activeName: 'table',
 | 
			
		||||
@@ -176,6 +179,11 @@ export default {
 | 
			
		||||
			// const p = this.tableProps
 | 
			
		||||
			// const d = this.tableData
 | 
			
		||||
			// debugger;
 | 
			
		||||
			if (this.activeName == 'graph') {
 | 
			
		||||
				this.$nextTick(() => {
 | 
			
		||||
					this.$refs['analysisChart'].initChart()
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			this.ready = true;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -41,6 +42,7 @@
 | 
			
		||||
import AddOrUpdate from './add-or-updata';
 | 
			
		||||
import basicPage from '../../mixins/basic-page';
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
import {
 | 
			
		||||
	deleteFactory,
 | 
			
		||||
	getFactoryPage
 | 
			
		||||
@@ -71,7 +73,7 @@ const tableProps = [
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ export default {
 | 
			
		||||
      },
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        total: 1,
 | 
			
		||||
      },
 | 
			
		||||
 
 | 
			
		||||
@@ -27,13 +27,16 @@
 | 
			
		||||
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import { getSchedulingMonitoringRecord1 } from '@/api/monitoring/teamProduction'
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'productionLineData24',
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			heightNum: 240,
 | 
			
		||||
      urlOptions: {
 | 
			
		||||
				getDataListURL: getPdlDataOneDay
 | 
			
		||||
			},
 | 
			
		||||
@@ -56,9 +59,9 @@ export default {
 | 
			
		||||
	},
 | 
			
		||||
	computed: {},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(240)
 | 
			
		||||
    })
 | 
			
		||||
		// window.addEventListener('resize', () => {
 | 
			
		||||
    //   this.tableH = this.tableHeight(240)
 | 
			
		||||
    // })
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
@@ -115,7 +118,7 @@ export default {
 | 
			
		||||
		/** 把 list 里的数据转换成 tableProps 对应的格式 */
 | 
			
		||||
		convertList(list) {
 | 
			
		||||
			// let sectionArr= []
 | 
			
		||||
			let temp = Object.values(list.datamap)                             
 | 
			
		||||
			let temp = list.datamap ? Object.values(list?.datamap) : []
 | 
			
		||||
			console.log('111', temp)
 | 
			
		||||
 | 
			
		||||
			temp.forEach(item => {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,148 +1,149 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div 
 | 
			
		||||
    id="analysischartBar"
 | 
			
		||||
    style="width: 100%"
 | 
			
		||||
    :style="{ height: chartHeight + 'px' }"
 | 
			
		||||
  ></div>
 | 
			
		||||
	<div
 | 
			
		||||
		id="analysischartBar"
 | 
			
		||||
		style="width: 100%"
 | 
			
		||||
		:style="{ height: chartHeight + 'px' }"></div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import * as echarts from 'echarts'
 | 
			
		||||
import resize from '@/utils/chartMixins/resize'
 | 
			
		||||
import * as echarts from 'echarts';
 | 
			
		||||
import resize from '@/utils/chartMixins/resize';
 | 
			
		||||
export default {
 | 
			
		||||
  name: "BarChart",
 | 
			
		||||
  mixins: [resize],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      chartDom: '',
 | 
			
		||||
      chart: '',
 | 
			
		||||
      chartHeight: this.tableHeight(214) - 70
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  props: {
 | 
			
		||||
    chartData: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    timeDim: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    chartData: function () {
 | 
			
		||||
      this.getChart()
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.chartHeight = this.tableHeight(214) - 70
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getChart() {
 | 
			
		||||
      if (
 | 
			
		||||
        this.chart !== null &&
 | 
			
		||||
        this.chart !== '' &&
 | 
			
		||||
        this.chart !== undefined
 | 
			
		||||
      ) {
 | 
			
		||||
        this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
 | 
			
		||||
      }
 | 
			
		||||
      this.chartDom = document.getElementById('analysischartBar')
 | 
			
		||||
      this.chart = echarts.init(this.chartDom)
 | 
			
		||||
      let tempArr = []
 | 
			
		||||
      let xData = []
 | 
			
		||||
      let yData = []
 | 
			
		||||
      let legendData = []
 | 
			
		||||
      if (this.chartData.length === 0) {
 | 
			
		||||
        return false
 | 
			
		||||
      } else {
 | 
			
		||||
        tempArr = this.chartData[0].trendRespVOList
 | 
			
		||||
      }
 | 
			
		||||
      for (let k = 0; k < tempArr.length; k++) {
 | 
			
		||||
        let time = ''
 | 
			
		||||
        if (this.timeDim === '3') {
 | 
			
		||||
          let year = tempArr[k].time.slice(0,4)
 | 
			
		||||
          let weak = tempArr[k].time.slice(4,6)
 | 
			
		||||
          time = year+' 第 '+weak+' 周'
 | 
			
		||||
        } else {
 | 
			
		||||
          time = tempArr[k].time
 | 
			
		||||
        }
 | 
			
		||||
        xData.push(time)
 | 
			
		||||
      }
 | 
			
		||||
      for (let i = 0; i < this.chartData.length; i++) {
 | 
			
		||||
        let obj = {
 | 
			
		||||
          name: this.chartData[i].objName + this.chartData[i].objCode,
 | 
			
		||||
          type: 'bar',
 | 
			
		||||
          barMaxWidth: 20,
 | 
			
		||||
          label: {
 | 
			
		||||
            show: true,
 | 
			
		||||
            position: 'top'
 | 
			
		||||
          },
 | 
			
		||||
          data: []
 | 
			
		||||
        }
 | 
			
		||||
        legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
 | 
			
		||||
        let temp = this.chartData[i].trendRespVOList
 | 
			
		||||
        for (let j = 0; j < temp.length; j++) {
 | 
			
		||||
          let num = temp[j].useNum ? temp[j].useNum : ''
 | 
			
		||||
          obj.data.push(num)
 | 
			
		||||
        }
 | 
			
		||||
        yData.push(obj)
 | 
			
		||||
      }
 | 
			
		||||
      var option = {
 | 
			
		||||
        color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
 | 
			
		||||
        tooltip: {
 | 
			
		||||
          trigger: 'axis',
 | 
			
		||||
          axisPointer: {
 | 
			
		||||
            type: 'shadow'
 | 
			
		||||
          },
 | 
			
		||||
          formatter: function(params) {
 | 
			
		||||
            return (
 | 
			
		||||
              params[0].axisValue + 
 | 
			
		||||
              `<br>` +
 | 
			
		||||
              params.map((item) => {
 | 
			
		||||
                let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`
 | 
			
		||||
                let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`
 | 
			
		||||
						let value = item.value ? item.value : '-'
 | 
			
		||||
						let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`
 | 
			
		||||
						return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px">
 | 
			
		||||
	name: 'BarChart',
 | 
			
		||||
	mixins: [resize],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			chartDom: '',
 | 
			
		||||
			chart: '',
 | 
			
		||||
			chartHeight: this.tableHeight(250) / 2,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	props: {
 | 
			
		||||
		chartData: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			required: true,
 | 
			
		||||
			default: () => {
 | 
			
		||||
				return [];
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		timeDim: {
 | 
			
		||||
			type: String,
 | 
			
		||||
			default: '',
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
		chartData: function () {
 | 
			
		||||
			this.getChart();
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.chartHeight = this.tableHeight(250) / 2;
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getChart() {
 | 
			
		||||
			if (
 | 
			
		||||
				this.chart !== null &&
 | 
			
		||||
				this.chart !== '' &&
 | 
			
		||||
				this.chart !== undefined
 | 
			
		||||
			) {
 | 
			
		||||
				this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
 | 
			
		||||
			}
 | 
			
		||||
			this.chartDom = document.getElementById('analysischartBar');
 | 
			
		||||
			this.chart = echarts.init(this.chartDom);
 | 
			
		||||
			let tempArr = [];
 | 
			
		||||
			let xData = [];
 | 
			
		||||
			let yData = [];
 | 
			
		||||
			let legendData = [];
 | 
			
		||||
			if (this.chartData.length === 0) {
 | 
			
		||||
				return false;
 | 
			
		||||
			} else {
 | 
			
		||||
				tempArr = this.chartData[0].trendRespVOList;
 | 
			
		||||
			}
 | 
			
		||||
			for (let k = 0; k < tempArr.length; k++) {
 | 
			
		||||
				let time = '';
 | 
			
		||||
				if (this.timeDim === '3') {
 | 
			
		||||
					let year = tempArr[k].time.slice(0, 4);
 | 
			
		||||
					let weak = tempArr[k].time.slice(4, 6);
 | 
			
		||||
					time = year + ' 第 ' + weak + ' 周';
 | 
			
		||||
				} else {
 | 
			
		||||
					time = tempArr[k].time;
 | 
			
		||||
				}
 | 
			
		||||
				xData.push(time);
 | 
			
		||||
			}
 | 
			
		||||
			for (let i = 0; i < this.chartData.length; i++) {
 | 
			
		||||
				let obj = {
 | 
			
		||||
					name: this.chartData[i].objName + this.chartData[i].objCode,
 | 
			
		||||
					type: 'bar',
 | 
			
		||||
					barMaxWidth: 20,
 | 
			
		||||
					label: {
 | 
			
		||||
						show: true,
 | 
			
		||||
						position: 'top',
 | 
			
		||||
					},
 | 
			
		||||
					data: [],
 | 
			
		||||
				};
 | 
			
		||||
				legendData.push(this.chartData[i].objName + this.chartData[i].objCode);
 | 
			
		||||
				let temp = this.chartData[i].trendRespVOList;
 | 
			
		||||
				for (let j = 0; j < temp.length; j++) {
 | 
			
		||||
					let num = temp[j].useNum ? temp[j].useNum.toFixed(2) : '';
 | 
			
		||||
					obj.data.push(num);
 | 
			
		||||
				}
 | 
			
		||||
				yData.push(obj);
 | 
			
		||||
			}
 | 
			
		||||
			var option = {
 | 
			
		||||
				color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF'],
 | 
			
		||||
				tooltip: {
 | 
			
		||||
					trigger: 'axis',
 | 
			
		||||
					axisPointer: {
 | 
			
		||||
						type: 'shadow',
 | 
			
		||||
					},
 | 
			
		||||
					formatter: function (params) {
 | 
			
		||||
						return (
 | 
			
		||||
							params[0].axisValue +
 | 
			
		||||
							`<br>` +
 | 
			
		||||
							params
 | 
			
		||||
								.map((item) => {
 | 
			
		||||
									let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`;
 | 
			
		||||
									let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`;
 | 
			
		||||
									let value = item.value ? item.value : '-';
 | 
			
		||||
									let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`;
 | 
			
		||||
									return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px">
 | 
			
		||||
									<span>${str}${seriesNameStr}</span>
 | 
			
		||||
									<span>${valueStr}</span>
 | 
			
		||||
								</span>`
 | 
			
		||||
              }).join(``)
 | 
			
		||||
            )
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        grid: {
 | 
			
		||||
          left: '4%',
 | 
			
		||||
          right: '1%',
 | 
			
		||||
          bottom: '1%',
 | 
			
		||||
          containLabel: true
 | 
			
		||||
        },
 | 
			
		||||
        legend: {
 | 
			
		||||
          data: legendData,
 | 
			
		||||
          right: '1%',
 | 
			
		||||
          icon: 'rect',
 | 
			
		||||
          itemHeight: 8,
 | 
			
		||||
          itemWidth: 8
 | 
			
		||||
        },
 | 
			
		||||
        xAxis: {
 | 
			
		||||
          type: 'category',
 | 
			
		||||
          data: xData,
 | 
			
		||||
          axisLabel: {
 | 
			
		||||
            rotate: "45"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        yAxis: {
 | 
			
		||||
          type: 'value'
 | 
			
		||||
        },
 | 
			
		||||
        series: yData
 | 
			
		||||
      };
 | 
			
		||||
								</span>`;
 | 
			
		||||
								})
 | 
			
		||||
								.join(``)
 | 
			
		||||
						);
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				grid: {
 | 
			
		||||
					left: '4%',
 | 
			
		||||
					right: '1%',
 | 
			
		||||
					bottom: '1%',
 | 
			
		||||
					containLabel: true,
 | 
			
		||||
				},
 | 
			
		||||
				legend: {
 | 
			
		||||
					data: legendData,
 | 
			
		||||
					right: '1%',
 | 
			
		||||
					icon: 'rect',
 | 
			
		||||
					itemHeight: 8,
 | 
			
		||||
					itemWidth: 8,
 | 
			
		||||
				},
 | 
			
		||||
				xAxis: {
 | 
			
		||||
					type: 'category',
 | 
			
		||||
					data: xData,
 | 
			
		||||
					axisLabel: {
 | 
			
		||||
						rotate: '45',
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				yAxis: {
 | 
			
		||||
					type: 'value',
 | 
			
		||||
				},
 | 
			
		||||
				series: yData,
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
      option && this.chart.setOption(option);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
			option && this.chart.setOption(option);
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
@@ -1,126 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div 
 | 
			
		||||
    id="analysischartLine"
 | 
			
		||||
    style="width: 100%"
 | 
			
		||||
    :style="{ height: chartHeight + 'px' }"
 | 
			
		||||
  ></div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import * as echarts from 'echarts'
 | 
			
		||||
import resize from '@/utils/chartMixins/resize'
 | 
			
		||||
export default {
 | 
			
		||||
  name: "LineChart",
 | 
			
		||||
  mixins: [resize],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      chartDom: '',
 | 
			
		||||
      chart: '',
 | 
			
		||||
      chartHeight: this.tableHeight(214) - 70
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  props: {
 | 
			
		||||
    chartData: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    timeDim: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    chartData: function () {
 | 
			
		||||
      this.getChart()
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.chartHeight = this.tableHeight(214) - 70
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getChart() {
 | 
			
		||||
      if (
 | 
			
		||||
        this.chart !== null &&
 | 
			
		||||
        this.chart !== '' &&
 | 
			
		||||
        this.chart !== undefined
 | 
			
		||||
      ) {
 | 
			
		||||
        this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
 | 
			
		||||
      }
 | 
			
		||||
      this.chartDom = document.getElementById('analysischartLine')
 | 
			
		||||
      this.chart = echarts.init(this.chartDom)
 | 
			
		||||
      let tempArr = []
 | 
			
		||||
      let xData = []
 | 
			
		||||
      let yData = []
 | 
			
		||||
      let legendData = []
 | 
			
		||||
      if (this.chartData.length === 0) {
 | 
			
		||||
        return false
 | 
			
		||||
      } else {
 | 
			
		||||
        tempArr = this.chartData[0].trendRespVOList
 | 
			
		||||
      }
 | 
			
		||||
      for (let k = 0; k < tempArr.length; k++) {
 | 
			
		||||
        let time = ''
 | 
			
		||||
        if (this.timeDim === '3') {
 | 
			
		||||
          let year = tempArr[k].time.slice(0,4)
 | 
			
		||||
          let weak = tempArr[k].time.slice(4,6)
 | 
			
		||||
          time = year+' 第 '+weak+' 周'
 | 
			
		||||
        } else {
 | 
			
		||||
          time = tempArr[k].time
 | 
			
		||||
        }
 | 
			
		||||
        xData.push(time)
 | 
			
		||||
      }
 | 
			
		||||
      for (let i = 0; i < this.chartData.length; i++) {
 | 
			
		||||
        let obj = {
 | 
			
		||||
          name: this.chartData[i].objName + this.chartData[i].objCode,
 | 
			
		||||
          type: 'line',
 | 
			
		||||
          stack: 'Total',
 | 
			
		||||
          data: []
 | 
			
		||||
        }
 | 
			
		||||
        legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
 | 
			
		||||
        let temp = this.chartData[i].trendRespVOList
 | 
			
		||||
        for (let j = 0; j < temp.length; j++) {
 | 
			
		||||
          let num = temp[j].useNum ? temp[j].useNum : ''
 | 
			
		||||
          obj.data.push(num)
 | 
			
		||||
        }
 | 
			
		||||
        yData.push(obj)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var option = {
 | 
			
		||||
        color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
 | 
			
		||||
        tooltip: {
 | 
			
		||||
          trigger: 'axis',
 | 
			
		||||
          axisPointer: {
 | 
			
		||||
            type: 'cross'
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        grid: {
 | 
			
		||||
          left: '4%',
 | 
			
		||||
          right: '1%',
 | 
			
		||||
          bottom: '1%',
 | 
			
		||||
          containLabel: true
 | 
			
		||||
        },
 | 
			
		||||
        legend: {
 | 
			
		||||
          data: legendData,
 | 
			
		||||
          right: '1%'
 | 
			
		||||
        },
 | 
			
		||||
        xAxis: {
 | 
			
		||||
          type: 'category',
 | 
			
		||||
          data: xData,
 | 
			
		||||
          axisLabel: {
 | 
			
		||||
            rotate: "45"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        yAxis: {
 | 
			
		||||
          type: 'value'
 | 
			
		||||
        },
 | 
			
		||||
        series: yData
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      option && this.chart.setOption(option);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,96 +1,129 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-area  :isFold="isFold" @submit="getList"/>
 | 
			
		||||
    <el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
 | 
			
		||||
      <el-tab-pane label="柱状图" name="bar">
 | 
			
		||||
        <bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim" />
 | 
			
		||||
      </el-tab-pane>
 | 
			
		||||
      <el-tab-pane label="折线图" name="line">
 | 
			
		||||
        <line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
 | 
			
		||||
      </el-tab-pane>
 | 
			
		||||
    </el-tabs>
 | 
			
		||||
    <!-- 没有数据 -->
 | 
			
		||||
    <div class="no-data-bg" v-show='!chartData.length'></div>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div
 | 
			
		||||
		class="app-container contrastAnalysisBox"
 | 
			
		||||
		id="contrastAnalysisBox">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<search-area
 | 
			
		||||
			:isFold="isFold"
 | 
			
		||||
			@submit="getList"
 | 
			
		||||
			@export="exportExl" />
 | 
			
		||||
		<div v-show="chartData.length">
 | 
			
		||||
			<bar-chart
 | 
			
		||||
				ref="analysisBarChart"
 | 
			
		||||
				:chartData="chartData"
 | 
			
		||||
				:timeDim="timeDim" />
 | 
			
		||||
			<base-table
 | 
			
		||||
				:table-props="tableProps"
 | 
			
		||||
				:table-data="list"
 | 
			
		||||
				:max-height="tableH"
 | 
			
		||||
				class="contrast-out-table" />
 | 
			
		||||
		</div>
 | 
			
		||||
		<!-- 没有数据 -->
 | 
			
		||||
		<div
 | 
			
		||||
			class="no-data-bg"
 | 
			
		||||
			v-show="!chartData.length"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getCompare } from "@/api/analysis/energyAnalysis"
 | 
			
		||||
import SearchArea from "./components/searchArea"
 | 
			
		||||
import BarChart from "./components/barChart"
 | 
			
		||||
import LineChart from "./components/lineChart"
 | 
			
		||||
import { getCompare } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import SearchArea from './components/searchArea';
 | 
			
		||||
import BarChart from './components/barChart';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
import FileSaver from 'file-saver';
 | 
			
		||||
import * as XLSX from 'xlsx/xlsx.mjs';
 | 
			
		||||
// import moment from 'moment'
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'ContrastAnalysis',
 | 
			
		||||
  components: { SearchArea, BarChart, LineChart },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      isFold: false,
 | 
			
		||||
      activeName: 'bar',
 | 
			
		||||
      chartData: [],
 | 
			
		||||
      timeDim: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
      this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
 | 
			
		||||
      // console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
 | 
			
		||||
    })
 | 
			
		||||
    this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getList(params) {
 | 
			
		||||
      this.timeDim = params.timeDim
 | 
			
		||||
      getCompare({ ...params }).then((res) => {
 | 
			
		||||
        console.log(res)
 | 
			
		||||
        if (res.code === 0) {
 | 
			
		||||
          this.chartData = res.data || []
 | 
			
		||||
        } else {
 | 
			
		||||
          this.chartData = []
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    switchChart() {
 | 
			
		||||
      if (this.activeName === 'bar') {
 | 
			
		||||
        this.$nextTick((res) => {
 | 
			
		||||
          this.$refs.analysisBarChart.getChart()
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$nextTick((res) => {
 | 
			
		||||
          this.$refs.analysisLineChart.getChart()
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'ContrastAnalysis',
 | 
			
		||||
	components: { SearchArea, BarChart },
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			isFold: false,
 | 
			
		||||
			chartData: [],
 | 
			
		||||
			timeDim: '',
 | 
			
		||||
			tableProps: [],
 | 
			
		||||
			list: [],
 | 
			
		||||
			tableH: this.tableHeight(250) / 2,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
 | 
			
		||||
			// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
 | 
			
		||||
		});
 | 
			
		||||
		this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		_setTableHeight() {
 | 
			
		||||
			this.tableH = this.tableHeight(250) / 2;
 | 
			
		||||
		},
 | 
			
		||||
		getList(params) {
 | 
			
		||||
			this.timeDim = params.timeDim;
 | 
			
		||||
			getCompare({ ...params }).then((res) => {
 | 
			
		||||
				if (res.code === 0) {
 | 
			
		||||
					this.getTableList(res.data || []);
 | 
			
		||||
					this.chartData = res.data || [];
 | 
			
		||||
				} else {
 | 
			
		||||
					this.chartData = [];
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		getTableList(arr) {
 | 
			
		||||
			this.tableProps = [];
 | 
			
		||||
			this.list = [];
 | 
			
		||||
			let tempX = [];
 | 
			
		||||
			let timeArr = arr[0].trendRespVOList || [];
 | 
			
		||||
			this.list = timeArr.map((item) => {
 | 
			
		||||
				return { time: item.time };
 | 
			
		||||
			});
 | 
			
		||||
			for (let i = 0; i < arr.length; i++) {
 | 
			
		||||
				let obj = {};
 | 
			
		||||
				obj.prop = arr[i].objId;
 | 
			
		||||
				obj.label = arr[i].objName;
 | 
			
		||||
				obj.minWidth = 100;
 | 
			
		||||
				tempX.push(obj);
 | 
			
		||||
				let tiemList = arr[i].trendRespVOList;
 | 
			
		||||
				for (let j = 0; j < tiemList.length; j++) {
 | 
			
		||||
					this.list[j][arr[i].objId] = tiemList[j].useNum
 | 
			
		||||
						? tiemList[j].useNum.toFixed(2)
 | 
			
		||||
						: null;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
 | 
			
		||||
		},
 | 
			
		||||
		// 导出
 | 
			
		||||
		exportExl() {
 | 
			
		||||
			if (this.list.length > 0) {
 | 
			
		||||
				var wb = XLSX.utils.table_to_book(
 | 
			
		||||
					document.querySelector('.contrast-out-table')
 | 
			
		||||
				);
 | 
			
		||||
				let fileName = '对比分析.xlsx';
 | 
			
		||||
				var wbout = XLSX.write(wb, {
 | 
			
		||||
					bookType: 'xlsx',
 | 
			
		||||
					bookSST: true,
 | 
			
		||||
					type: 'array',
 | 
			
		||||
				});
 | 
			
		||||
				try {
 | 
			
		||||
					FileSaver.saveAs(
 | 
			
		||||
						new Blob([wbout], { type: 'application/octet-stream' }),
 | 
			
		||||
						fileName
 | 
			
		||||
					);
 | 
			
		||||
					this.$message.success('导出成功');
 | 
			
		||||
				} catch (e) {
 | 
			
		||||
					if (typeof console !== 'undefined') console.log(e, wbout);
 | 
			
		||||
				}
 | 
			
		||||
				return wbout;
 | 
			
		||||
			} else {
 | 
			
		||||
				this.$modal.msgWarning('暂无数据导出');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang='scss'>
 | 
			
		||||
.contrastAnalysisBox {
 | 
			
		||||
  .el-tabs__nav::after {
 | 
			
		||||
    content: "";
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    bottom: 0;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 2px;
 | 
			
		||||
    background-color: #e4e7ed;
 | 
			
		||||
    /* z-index: 1; */
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__nav-wrap::after {
 | 
			
		||||
    width: 0;
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item {
 | 
			
		||||
    padding: 0 10px;
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item:hover {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item.is-active {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.45);
 | 
			
		||||
  }
 | 
			
		||||
	.contrast-out-table {
 | 
			
		||||
		margin-top: 20px;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,232 +1,253 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <el-form :inline="true" class="demo-form-inline">
 | 
			
		||||
    <span class="blue-block"></span>
 | 
			
		||||
    <el-form-item label="对象选择" required>
 | 
			
		||||
      <el-cascader
 | 
			
		||||
        v-model="objArr"
 | 
			
		||||
        :options="objList"
 | 
			
		||||
        :props="{ checkStrictly: true, value: 'id', label: 'name' }"
 | 
			
		||||
        popper-class="cascaderParent"
 | 
			
		||||
        size="small"
 | 
			
		||||
        style="width: 250px;"
 | 
			
		||||
        clearable></el-cascader>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item label="时间维度" required>
 | 
			
		||||
      <el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
 | 
			
		||||
        <el-option
 | 
			
		||||
          v-for="item in timeType"
 | 
			
		||||
          :key="item.id"
 | 
			
		||||
          :label="item.name"
 | 
			
		||||
          :value="item.id"
 | 
			
		||||
          :clearable="false">
 | 
			
		||||
        </el-option>
 | 
			
		||||
      </el-select>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item label="时间" required>
 | 
			
		||||
      <div v-show="queryParams.type === 1">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="monthValue"
 | 
			
		||||
          type="month"
 | 
			
		||||
          :picker-options="pickerOptions"
 | 
			
		||||
          @change="selectTime"
 | 
			
		||||
          :clearable="false"
 | 
			
		||||
          size="small"
 | 
			
		||||
          placeholder="选择月">
 | 
			
		||||
        </el-date-picker>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div v-show="queryParams.type === 2">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="weekValue"
 | 
			
		||||
          type="week"
 | 
			
		||||
          format="yyyy 第 WW 周"
 | 
			
		||||
          :picker-options="pickerOptionsWeek"
 | 
			
		||||
          @change="selectTime"
 | 
			
		||||
          :clearable="false"
 | 
			
		||||
          size="small"
 | 
			
		||||
          placeholder="选择周">
 | 
			
		||||
        </el-date-picker>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div v-show="queryParams.type === 3">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="dateValue"
 | 
			
		||||
          type="date"
 | 
			
		||||
          :picker-options="pickerOptions"
 | 
			
		||||
          @change="selectTime"
 | 
			
		||||
          :clearable="false"
 | 
			
		||||
          size="small"
 | 
			
		||||
          placeholder="选择日">
 | 
			
		||||
        </el-date-picker>
 | 
			
		||||
      </div>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item>
 | 
			
		||||
      <el-button type="primary" size="small" @click="search">查询</el-button>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item>
 | 
			
		||||
      <span class="separateStyle"></span>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item>
 | 
			
		||||
      <el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
  </el-form>
 | 
			
		||||
	<el-form
 | 
			
		||||
		:inline="true"
 | 
			
		||||
		class="demo-form-inline">
 | 
			
		||||
		<span class="blue-block"></span>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="对象选择"
 | 
			
		||||
			required>
 | 
			
		||||
			<el-select
 | 
			
		||||
				v-model="queryParams.objId"
 | 
			
		||||
				placeholder="请选择"
 | 
			
		||||
				style="width: 250px"
 | 
			
		||||
				filterable
 | 
			
		||||
				size="small">
 | 
			
		||||
				<el-option
 | 
			
		||||
					v-for="item in objList"
 | 
			
		||||
					:key="item.id"
 | 
			
		||||
					:label="item.name"
 | 
			
		||||
					:value="item.id"
 | 
			
		||||
					:clearable="false"></el-option>
 | 
			
		||||
			</el-select>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="时间维度"
 | 
			
		||||
			required>
 | 
			
		||||
			<el-select
 | 
			
		||||
				v-model="queryParams.type"
 | 
			
		||||
				placeholder="请选择"
 | 
			
		||||
				style="width: 80px"
 | 
			
		||||
				size="small">
 | 
			
		||||
				<el-option
 | 
			
		||||
					v-for="item in timeType"
 | 
			
		||||
					:key="item.id"
 | 
			
		||||
					:label="item.name"
 | 
			
		||||
					:value="item.id"
 | 
			
		||||
					:clearable="false"></el-option>
 | 
			
		||||
			</el-select>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="时间"
 | 
			
		||||
			required>
 | 
			
		||||
			<div v-show="queryParams.type === 1">
 | 
			
		||||
				<el-date-picker
 | 
			
		||||
					v-model="monthValue"
 | 
			
		||||
					type="month"
 | 
			
		||||
					:picker-options="pickerOptions"
 | 
			
		||||
					@change="selectTime"
 | 
			
		||||
					:clearable="false"
 | 
			
		||||
					size="small"
 | 
			
		||||
					placeholder="选择月"></el-date-picker>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div v-show="queryParams.type === 2">
 | 
			
		||||
				<el-date-picker
 | 
			
		||||
					v-model="weekValue"
 | 
			
		||||
					type="week"
 | 
			
		||||
					format="yyyy 第 WW 周"
 | 
			
		||||
					:picker-options="pickerOptionsWeek"
 | 
			
		||||
					@change="selectTime"
 | 
			
		||||
					:clearable="false"
 | 
			
		||||
					size="small"
 | 
			
		||||
					placeholder="选择周"></el-date-picker>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div v-show="queryParams.type === 3">
 | 
			
		||||
				<el-date-picker
 | 
			
		||||
					v-model="dateValue"
 | 
			
		||||
					type="date"
 | 
			
		||||
					:picker-options="pickerOptions"
 | 
			
		||||
					@change="selectTime"
 | 
			
		||||
					:clearable="false"
 | 
			
		||||
					size="small"
 | 
			
		||||
					placeholder="选择日"></el-date-picker>
 | 
			
		||||
			</div>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<el-button
 | 
			
		||||
				type="primary"
 | 
			
		||||
				size="small"
 | 
			
		||||
				@click="search">
 | 
			
		||||
				查询
 | 
			
		||||
			</el-button>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<span class="separateStyle"></span>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<el-button
 | 
			
		||||
				type="primary"
 | 
			
		||||
				size="small"
 | 
			
		||||
				@click="exportData"
 | 
			
		||||
				plain>
 | 
			
		||||
				导出
 | 
			
		||||
			</el-button>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getTree } from '@/api/base/factory'
 | 
			
		||||
import moment from 'moment'
 | 
			
		||||
import { getTree } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'searchArea',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        type: 1,
 | 
			
		||||
        searchTime: null,
 | 
			
		||||
        objId: null
 | 
			
		||||
      },
 | 
			
		||||
      timeType: [
 | 
			
		||||
        {id: 1, name: '月'},
 | 
			
		||||
        {id: 2, name: '周'},
 | 
			
		||||
        {id: 3, name: '日'}
 | 
			
		||||
      ],
 | 
			
		||||
      monthValue: '',
 | 
			
		||||
      weekValue: '',
 | 
			
		||||
      dateValue: '',
 | 
			
		||||
      objArr: [],
 | 
			
		||||
      objList: [],
 | 
			
		||||
      pickerOptions: {
 | 
			
		||||
        disabledDate(date) {
 | 
			
		||||
          return date.getTime() > Date.now()
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      pickerOptionsWeek: {
 | 
			
		||||
        disabledDate(time) {
 | 
			
		||||
          let day = Date.now()
 | 
			
		||||
          let limitTime = moment(day).day(-1)
 | 
			
		||||
          return time.getTime() > new Date(limitTime).getTime()
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.getObjTree()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getObjTree() {
 | 
			
		||||
      getTree().then(res => {
 | 
			
		||||
        this.objList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    selectTime() {
 | 
			
		||||
      switch (this.queryParams.type) {
 | 
			
		||||
        case 1:
 | 
			
		||||
          this.queryParams.searchTime = this.monthValue
 | 
			
		||||
          break;
 | 
			
		||||
        case 2:
 | 
			
		||||
          this.queryParams.searchTime = this.weekValue
 | 
			
		||||
          break;
 | 
			
		||||
        default:
 | 
			
		||||
          this.queryParams.searchTime = this.dateValue
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 查询
 | 
			
		||||
    search() {
 | 
			
		||||
      if (this.objArr.length === 0) {
 | 
			
		||||
        this.$modal.msgError('请选择对象')
 | 
			
		||||
        return false
 | 
			
		||||
      } else {
 | 
			
		||||
        this.queryParams.objId = this.objArr[this.objArr.length-1]
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.queryParams.type) {
 | 
			
		||||
        this.$modal.msgError('请选择时间维度')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.queryParams.searchTime) {
 | 
			
		||||
        this.$modal.msgError('请选择时间')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      switch (this.queryParams.type) {
 | 
			
		||||
        case 1:
 | 
			
		||||
          this.queryParams.searchTime = this.transformTime(this.monthValue)
 | 
			
		||||
          break;
 | 
			
		||||
        case 2:
 | 
			
		||||
          let value = moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59'
 | 
			
		||||
          this.queryParams.searchTime = new Date(value).getTime()
 | 
			
		||||
          break;
 | 
			
		||||
        default:
 | 
			
		||||
           let value2 = moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59'
 | 
			
		||||
           this.queryParams.searchTime = new Date(value2).getTime()
 | 
			
		||||
      }
 | 
			
		||||
      this.$emit('submit', this.queryParams)
 | 
			
		||||
    },
 | 
			
		||||
    exportData() {
 | 
			
		||||
      let name
 | 
			
		||||
      if (this.queryParams.objId) {
 | 
			
		||||
        name = this.getObjName(this.objList, this.queryParams.objId)
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$modal.msgWarning("对象不能为空")
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      this.$emit('exportD', {name: name})
 | 
			
		||||
    },
 | 
			
		||||
    // 递归取对象name
 | 
			
		||||
    getObjName(list, id) {
 | 
			
		||||
      let _this = this
 | 
			
		||||
      for (let i = 0; i < list.length; i++) {
 | 
			
		||||
        let a = list[i]
 | 
			
		||||
        if (a.id === id) {
 | 
			
		||||
          return a.name
 | 
			
		||||
        } else {
 | 
			
		||||
          if (a.children && a.children.length > 0) {
 | 
			
		||||
            let res = _this.getObjName(a.children, id)
 | 
			
		||||
            if (res) {
 | 
			
		||||
              return res
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    transformTime(timeStamp) {// 本月最后一天
 | 
			
		||||
      let year = moment(timeStamp).format('YYYY')
 | 
			
		||||
      let month = moment(timeStamp).format('MM')
 | 
			
		||||
      let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
 | 
			
		||||
      let value = new Date(newData).getTime()
 | 
			
		||||
      return value
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'searchArea',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				type: 1,
 | 
			
		||||
				searchTime: null,
 | 
			
		||||
				objId: null,
 | 
			
		||||
				objType: 1,
 | 
			
		||||
			},
 | 
			
		||||
			timeType: [
 | 
			
		||||
				{ id: 1, name: '月' },
 | 
			
		||||
				{ id: 2, name: '周' },
 | 
			
		||||
				{ id: 3, name: '日' },
 | 
			
		||||
			],
 | 
			
		||||
			monthValue: '',
 | 
			
		||||
			weekValue: '',
 | 
			
		||||
			dateValue: '',
 | 
			
		||||
			objList: [],
 | 
			
		||||
			pickerOptions: {
 | 
			
		||||
				disabledDate(date) {
 | 
			
		||||
					return date.getTime() > Date.now();
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			pickerOptionsWeek: {
 | 
			
		||||
				disabledDate(time) {
 | 
			
		||||
					let day = Date.now();
 | 
			
		||||
					let limitTime = moment(day).day(-1);
 | 
			
		||||
					return time.getTime() > new Date(limitTime).getTime();
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getObjTree();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getObjTree() {
 | 
			
		||||
			getTree().then((res) => {
 | 
			
		||||
				this.objList = res.data || [];
 | 
			
		||||
				if (this.objList.length > 0) {
 | 
			
		||||
					this.queryParams.objId = this.objList[0].id;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		selectTime() {
 | 
			
		||||
			switch (this.queryParams.type) {
 | 
			
		||||
				case 1:
 | 
			
		||||
					this.queryParams.searchTime = this.monthValue;
 | 
			
		||||
					break;
 | 
			
		||||
				case 2:
 | 
			
		||||
					this.queryParams.searchTime = this.weekValue;
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.queryParams.searchTime = this.dateValue;
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 查询
 | 
			
		||||
		search() {
 | 
			
		||||
			if (!this.queryParams.objId) {
 | 
			
		||||
				this.$modal.msgError('请选择对象');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (!this.queryParams.type) {
 | 
			
		||||
				this.$modal.msgError('请选择时间维度');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (!this.queryParams.searchTime) {
 | 
			
		||||
				this.$modal.msgError('请选择时间');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			switch (this.queryParams.type) {
 | 
			
		||||
				case 1:
 | 
			
		||||
					this.queryParams.searchTime = this.transformTime(this.monthValue);
 | 
			
		||||
					break;
 | 
			
		||||
				case 2:
 | 
			
		||||
					let value =
 | 
			
		||||
						moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59';
 | 
			
		||||
					this.queryParams.searchTime = new Date(value).getTime();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					let value2 =
 | 
			
		||||
						moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59';
 | 
			
		||||
					this.queryParams.searchTime = new Date(value2).getTime();
 | 
			
		||||
			}
 | 
			
		||||
			this.$emit('submit', this.queryParams);
 | 
			
		||||
		},
 | 
			
		||||
		exportData() {
 | 
			
		||||
			let name;
 | 
			
		||||
			if (this.queryParams.objId) {
 | 
			
		||||
				name = this.getObjName(this.objList, this.queryParams.objId);
 | 
			
		||||
			} else {
 | 
			
		||||
				this.$modal.msgWarning('对象不能为空');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			this.$emit('exportD', { name: name });
 | 
			
		||||
		},
 | 
			
		||||
		// 递归取对象name
 | 
			
		||||
		getObjName(list, id) {
 | 
			
		||||
			for (let i = 0; i < list.length; i++) {
 | 
			
		||||
				let a = list[i];
 | 
			
		||||
				if (a.id === id) {
 | 
			
		||||
					return a.name;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		transformTime(timeStamp) {
 | 
			
		||||
			// 本月最后一天
 | 
			
		||||
			let year = moment(timeStamp).format('YYYY');
 | 
			
		||||
			let month = moment(timeStamp).format('MM');
 | 
			
		||||
			let newData =
 | 
			
		||||
				moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
 | 
			
		||||
			let value = new Date(newData).getTime();
 | 
			
		||||
			return value;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang='scss'>
 | 
			
		||||
/* 级联选择器 */
 | 
			
		||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
.demo-form-inline {
 | 
			
		||||
  .el-date-editor .el-range__icon {
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    color: #0B58FF;
 | 
			
		||||
  }
 | 
			
		||||
  .el-input__prefix .el-icon-date {
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    color: #0B58FF;
 | 
			
		||||
  }
 | 
			
		||||
	.el-date-editor .el-range__icon {
 | 
			
		||||
		font-size: 16px;
 | 
			
		||||
		color: #0b58ff;
 | 
			
		||||
	}
 | 
			
		||||
	.el-input__prefix .el-icon-date {
 | 
			
		||||
		font-size: 16px;
 | 
			
		||||
		color: #0b58ff;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.separateStyle {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 1px;
 | 
			
		||||
  height: 24px;
 | 
			
		||||
  background: #E8E8E8;
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	width: 1px;
 | 
			
		||||
	height: 24px;
 | 
			
		||||
	background: #e8e8e8;
 | 
			
		||||
	vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
.demo-form-inline {
 | 
			
		||||
  .blue-block {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: 4px;
 | 
			
		||||
    height: 16px;
 | 
			
		||||
    background-color: #0B58FF;
 | 
			
		||||
    border-radius: 1px;
 | 
			
		||||
    margin-right: 8px;
 | 
			
		||||
    margin-top: 10px;
 | 
			
		||||
  }
 | 
			
		||||
	.blue-block {
 | 
			
		||||
		display: inline-block;
 | 
			
		||||
		width: 4px;
 | 
			
		||||
		height: 16px;
 | 
			
		||||
		background-color: #0b58ff;
 | 
			
		||||
		border-radius: 1px;
 | 
			
		||||
		margin-right: 8px;
 | 
			
		||||
		margin-top: 10px;
 | 
			
		||||
	}
 | 
			
		||||
	.el-form-item {
 | 
			
		||||
		margin-right: 10px;
 | 
			
		||||
		margin-bottom: 4px;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,132 +1,140 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-area @submit="getList" @exportD="exportData"/>
 | 
			
		||||
    <!-- 表格 -->
 | 
			
		||||
    <div v-show="chartData.length">
 | 
			
		||||
      <base-table
 | 
			
		||||
        :table-props="tableProps"
 | 
			
		||||
        :table-data="list"
 | 
			
		||||
        class="qoq-out-table"
 | 
			
		||||
      />
 | 
			
		||||
      <div class="chartTitle">环比分析图</div>
 | 
			
		||||
      <div style='width: 100%'>
 | 
			
		||||
        <line-chart ref="analysisLineChart" :chartData="chartData"/>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- 没有数据 -->
 | 
			
		||||
    <div class="no-data-bg" v-show='!chartData.length'></div>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<search-area
 | 
			
		||||
			@submit="getList"
 | 
			
		||||
			@exportD="exportData" />
 | 
			
		||||
		<!-- 表格 -->
 | 
			
		||||
		<div v-show="chartData.length">
 | 
			
		||||
			<base-table
 | 
			
		||||
				:table-props="tableProps"
 | 
			
		||||
				:table-data="list"
 | 
			
		||||
				class="qoq-out-table" />
 | 
			
		||||
			<div class="chartTitle">环比分析图</div>
 | 
			
		||||
			<div style="width: 100%">
 | 
			
		||||
				<line-chart
 | 
			
		||||
					ref="analysisLineChart"
 | 
			
		||||
					:chartData="chartData" />
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<!-- 没有数据 -->
 | 
			
		||||
		<div
 | 
			
		||||
			class="no-data-bg"
 | 
			
		||||
			v-show="!chartData.length"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getQoq } from "@/api/analysis/energyAnalysis"
 | 
			
		||||
import SearchArea from "./components/searchArea"
 | 
			
		||||
import LineChart from "./components/lineChart"
 | 
			
		||||
import FileSaver from "file-saver"
 | 
			
		||||
import * as XLSX from 'xlsx/xlsx.mjs'
 | 
			
		||||
import { getQoq } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import SearchArea from './components/searchArea';
 | 
			
		||||
import LineChart from './components/lineChart';
 | 
			
		||||
import FileSaver from 'file-saver';
 | 
			
		||||
import * as XLSX from 'xlsx/xlsx.mjs';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'QoqAnalysis',
 | 
			
		||||
  components: { SearchArea, LineChart },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      chartData: [],
 | 
			
		||||
      tableProps: [],
 | 
			
		||||
      list: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getList(params) {
 | 
			
		||||
      getQoq({ ...params }).then((res) => {
 | 
			
		||||
        if (res.code === 0 && res.data) {
 | 
			
		||||
          this.getTableList(res.data)
 | 
			
		||||
        } else {
 | 
			
		||||
          this.chartData = []
 | 
			
		||||
          this.list = []
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    getTableList(arr) {
 | 
			
		||||
      let data = arr.data
 | 
			
		||||
      let nameData = arr.nameData
 | 
			
		||||
      let tempX = []
 | 
			
		||||
      data[0].data.map((item) => {
 | 
			
		||||
        let obj = {}
 | 
			
		||||
        obj.prop = item.dynamicName
 | 
			
		||||
        obj.label = item.dynamicName
 | 
			
		||||
        obj.id = item.id
 | 
			
		||||
        obj.children = []
 | 
			
		||||
        tempX.push(obj)
 | 
			
		||||
      })
 | 
			
		||||
      for (let i = 0; i < nameData.length; i++) {
 | 
			
		||||
        for (let j = 0; j < tempX.length; j++) {
 | 
			
		||||
          if (tempX[j].id === nameData[i].parentId) {
 | 
			
		||||
            let obj = {}
 | 
			
		||||
            obj.prop = tempX[j].prop + '_' + nameData[i].name
 | 
			
		||||
            obj.label = nameData[i].name
 | 
			
		||||
            tempX[j].children.push(obj)
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      this.tableProps = [{prop: 'time',label: '时间'}].concat(tempX)
 | 
			
		||||
      // 数据
 | 
			
		||||
      this.list = []
 | 
			
		||||
      for (let k = 0; k < data.length; k++) {
 | 
			
		||||
        let obj = {}
 | 
			
		||||
        obj.time = data[k].time
 | 
			
		||||
        let arr1 = data[k].data
 | 
			
		||||
        obj.type = []
 | 
			
		||||
        for (let q = 0; q < arr1.length; q++) {
 | 
			
		||||
          let name = arr1[q].dynamicName
 | 
			
		||||
          obj.type.push(name)
 | 
			
		||||
          let arr2 = arr1[q].children
 | 
			
		||||
          for (let p = 0; p < arr2.length; p++) {
 | 
			
		||||
            let prop = name + '_' + arr2[p].dynamicName
 | 
			
		||||
            obj[prop] = arr2[p].dynamicValue
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        this.list.push(obj)
 | 
			
		||||
      }
 | 
			
		||||
      this.chartData = this.list
 | 
			
		||||
    },
 | 
			
		||||
    exportData(val) {
 | 
			
		||||
      if (this.list.length > 0) {
 | 
			
		||||
        var wb = XLSX.utils.table_to_book(document.querySelector(".qoq-out-table"))
 | 
			
		||||
        let fileName = val.name + "环比分析.xlsx"
 | 
			
		||||
        var wbout = XLSX.write(wb, {
 | 
			
		||||
            bookType: "xlsx",
 | 
			
		||||
            bookSST: true,
 | 
			
		||||
            type: "array"
 | 
			
		||||
        })
 | 
			
		||||
        try {
 | 
			
		||||
            FileSaver.saveAs(
 | 
			
		||||
            new Blob([wbout], { type: "application/octet-stream" }),
 | 
			
		||||
            fileName
 | 
			
		||||
            )
 | 
			
		||||
        } catch (e) {
 | 
			
		||||
            if (typeof console !== "undefined") console.log(e, wbout);
 | 
			
		||||
        }
 | 
			
		||||
        return wbout
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$modal.msgWarning("暂无数据导出")
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'QoqAnalysis',
 | 
			
		||||
	components: { SearchArea, LineChart },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			chartData: [],
 | 
			
		||||
			tableProps: [],
 | 
			
		||||
			list: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getList(params) {
 | 
			
		||||
			getQoq({ ...params }).then((res) => {
 | 
			
		||||
				if (res.code === 0 && res.data) {
 | 
			
		||||
					this.getTableList(res.data);
 | 
			
		||||
				} else {
 | 
			
		||||
					this.chartData = [];
 | 
			
		||||
					this.list = [];
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		getTableList(arr) {
 | 
			
		||||
			let data = arr.data;
 | 
			
		||||
			let nameData = arr.nameData;
 | 
			
		||||
			let tempX = [];
 | 
			
		||||
			data[0].data.map((item) => {
 | 
			
		||||
				let obj = {};
 | 
			
		||||
				obj.prop = item.dynamicName;
 | 
			
		||||
				obj.label = item.dynamicName;
 | 
			
		||||
				obj.id = item.id;
 | 
			
		||||
				obj.children = [];
 | 
			
		||||
				tempX.push(obj);
 | 
			
		||||
			});
 | 
			
		||||
			for (let i = 0; i < nameData.length; i++) {
 | 
			
		||||
				for (let j = 0; j < tempX.length; j++) {
 | 
			
		||||
					if (tempX[j].id === nameData[i].parentId) {
 | 
			
		||||
						let obj = {};
 | 
			
		||||
						obj.prop = tempX[j].prop + '_' + nameData[i].name;
 | 
			
		||||
						obj.label = nameData[i].name;
 | 
			
		||||
						tempX[j].children.push(obj);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
 | 
			
		||||
			// 数据
 | 
			
		||||
			this.list = [];
 | 
			
		||||
			for (let k = 0; k < data.length; k++) {
 | 
			
		||||
				let obj = {};
 | 
			
		||||
				obj.time = data[k].time;
 | 
			
		||||
				let arr1 = data[k].data;
 | 
			
		||||
				obj.type = [];
 | 
			
		||||
				for (let q = 0; q < arr1.length; q++) {
 | 
			
		||||
					let name = arr1[q].dynamicName;
 | 
			
		||||
					obj.type.push(name);
 | 
			
		||||
					let arr2 = arr1[q].children;
 | 
			
		||||
					for (let p = 0; p < arr2.length; p++) {
 | 
			
		||||
						let prop = name + '_' + arr2[p].dynamicName;
 | 
			
		||||
						obj[prop] = arr2[p].dynamicValue;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				this.list.push(obj);
 | 
			
		||||
			}
 | 
			
		||||
			this.chartData = this.list;
 | 
			
		||||
		},
 | 
			
		||||
		exportData(val) {
 | 
			
		||||
			if (this.list.length > 0) {
 | 
			
		||||
				var wb = XLSX.utils.table_to_book(
 | 
			
		||||
					document.querySelector('.qoq-out-table')
 | 
			
		||||
				);
 | 
			
		||||
				let fileName = val.name + '环比分析.xlsx';
 | 
			
		||||
				var wbout = XLSX.write(wb, {
 | 
			
		||||
					bookType: 'xlsx',
 | 
			
		||||
					bookSST: true,
 | 
			
		||||
					type: 'array',
 | 
			
		||||
				});
 | 
			
		||||
				try {
 | 
			
		||||
					FileSaver.saveAs(
 | 
			
		||||
						new Blob([wbout], { type: 'application/octet-stream' }),
 | 
			
		||||
						fileName
 | 
			
		||||
					);
 | 
			
		||||
					this.$message.success('导出成功');
 | 
			
		||||
				} catch (e) {
 | 
			
		||||
					if (typeof console !== 'undefined') console.log(e, wbout);
 | 
			
		||||
				}
 | 
			
		||||
				return wbout;
 | 
			
		||||
			} else {
 | 
			
		||||
				this.$modal.msgWarning('暂无数据导出');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang='scss' scoped>
 | 
			
		||||
.chartTitle {
 | 
			
		||||
  font-size: 16px;
 | 
			
		||||
  color: #000;
 | 
			
		||||
  margin-top: 20px;
 | 
			
		||||
	font-size: 16px;
 | 
			
		||||
	color: #000;
 | 
			
		||||
	margin-top: 20px;
 | 
			
		||||
}
 | 
			
		||||
.chartTitle::before {
 | 
			
		||||
  content: '';
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 4px;
 | 
			
		||||
  height: 18px;
 | 
			
		||||
  background-color: #0B58FF;
 | 
			
		||||
  border-radius: 1px;
 | 
			
		||||
  margin-right: 8px;
 | 
			
		||||
  vertical-align: bottom;
 | 
			
		||||
	content: '';
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	width: 4px;
 | 
			
		||||
	height: 18px;
 | 
			
		||||
	background-color: #0b58ff;
 | 
			
		||||
	border-radius: 1px;
 | 
			
		||||
	margin-right: 8px;
 | 
			
		||||
	vertical-align: bottom;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,103 +1,102 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div 
 | 
			
		||||
    id="analysischartLine"
 | 
			
		||||
    style="width: 100%"
 | 
			
		||||
    :style="{ height: chartHeight + 'px' }"
 | 
			
		||||
  ></div>
 | 
			
		||||
	<div
 | 
			
		||||
		id="analysischartLine"
 | 
			
		||||
		style="width: 100%"
 | 
			
		||||
		:style="{ height: chartHeight + 'px' }"></div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import * as echarts from 'echarts'
 | 
			
		||||
import resize from '@/utils/chartMixins/resize'
 | 
			
		||||
import * as echarts from 'echarts';
 | 
			
		||||
import resize from '@/utils/chartMixins/resize';
 | 
			
		||||
export default {
 | 
			
		||||
  name: "LineChart",
 | 
			
		||||
  mixins: [resize],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      chartDom: '',
 | 
			
		||||
      chart: '',
 | 
			
		||||
      chartHeight: this.tableHeight(214) - 70
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  props: {
 | 
			
		||||
    chartData: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    timeDim: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    chartData: function () {
 | 
			
		||||
      this.getChart()
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.chartHeight = this.tableHeight(214) - 70
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getChart() {
 | 
			
		||||
      if (
 | 
			
		||||
        this.chart !== null &&
 | 
			
		||||
        this.chart !== '' &&
 | 
			
		||||
        this.chart !== undefined
 | 
			
		||||
      ) {
 | 
			
		||||
        this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
 | 
			
		||||
      }
 | 
			
		||||
      this.chartDom = document.getElementById('analysischartLine')
 | 
			
		||||
      this.chart = echarts.init(this.chartDom)
 | 
			
		||||
      let xData = []
 | 
			
		||||
      let yData = []
 | 
			
		||||
      for (let i = 0; i < this.chartData.length; i++) {
 | 
			
		||||
        let time = ""
 | 
			
		||||
        if (this.timeDim === '3') {
 | 
			
		||||
          let year = this.chartData[i].time.slice(0,4)
 | 
			
		||||
          let weak = this.chartData[i].time.slice(4,6)
 | 
			
		||||
          time = year+' 第 '+weak+' 周'
 | 
			
		||||
        } else {
 | 
			
		||||
          time = this.chartData[i].time
 | 
			
		||||
        }
 | 
			
		||||
        xData.push(time)
 | 
			
		||||
        yData.push(this.chartData[i].useNum)
 | 
			
		||||
      }
 | 
			
		||||
	name: 'LineChart',
 | 
			
		||||
	mixins: [resize],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			chartDom: '',
 | 
			
		||||
			chart: '',
 | 
			
		||||
			chartHeight: this.tableHeight(214) - 100,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	props: {
 | 
			
		||||
		chartData: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			required: true,
 | 
			
		||||
			default: () => {
 | 
			
		||||
				return [];
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		timeDim: {
 | 
			
		||||
			type: String,
 | 
			
		||||
			default: '',
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
		chartData: function () {
 | 
			
		||||
			this.getChart();
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.chartHeight = this.tableHeight(214) - 70;
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getChart() {
 | 
			
		||||
			if (
 | 
			
		||||
				this.chart !== null &&
 | 
			
		||||
				this.chart !== '' &&
 | 
			
		||||
				this.chart !== undefined
 | 
			
		||||
			) {
 | 
			
		||||
				this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
 | 
			
		||||
			}
 | 
			
		||||
			this.chartDom = document.getElementById('analysischartLine');
 | 
			
		||||
			this.chart = echarts.init(this.chartDom);
 | 
			
		||||
			let xData = [];
 | 
			
		||||
			let yData = [];
 | 
			
		||||
			for (let i = 0; i < this.chartData.length; i++) {
 | 
			
		||||
				let time = '';
 | 
			
		||||
				if (this.timeDim === '3') {
 | 
			
		||||
					let year = this.chartData[i].time.slice(0, 4);
 | 
			
		||||
					let weak = this.chartData[i].time.slice(4, 6);
 | 
			
		||||
					time = year + ' 第 ' + weak + ' 周';
 | 
			
		||||
				} else {
 | 
			
		||||
					time = this.chartData[i].time;
 | 
			
		||||
				}
 | 
			
		||||
				xData.push(time);
 | 
			
		||||
				yData.push(this.chartData[i].useNum);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
      var option = {
 | 
			
		||||
        color:['#288AFF'],
 | 
			
		||||
        // tooltip: {
 | 
			
		||||
        //   trigger: 'axis'
 | 
			
		||||
        // },
 | 
			
		||||
        grid: {
 | 
			
		||||
          left: '4%',
 | 
			
		||||
          right: '1%',
 | 
			
		||||
          bottom: '1%',
 | 
			
		||||
          containLabel: true
 | 
			
		||||
        },
 | 
			
		||||
        xAxis: {
 | 
			
		||||
          type: 'category',
 | 
			
		||||
          data: xData,
 | 
			
		||||
          axisLabel: {
 | 
			
		||||
            rotate: "45"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        yAxis: {
 | 
			
		||||
          type: 'value'
 | 
			
		||||
        },
 | 
			
		||||
        series: [
 | 
			
		||||
          {
 | 
			
		||||
            data: yData,
 | 
			
		||||
            type: 'line'
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      };
 | 
			
		||||
			var option = {
 | 
			
		||||
				color: ['#288AFF'],
 | 
			
		||||
				// tooltip: {
 | 
			
		||||
				//   trigger: 'axis'
 | 
			
		||||
				// },
 | 
			
		||||
				grid: {
 | 
			
		||||
					left: '4%',
 | 
			
		||||
					right: '1%',
 | 
			
		||||
					bottom: '1%',
 | 
			
		||||
					containLabel: true,
 | 
			
		||||
				},
 | 
			
		||||
				xAxis: {
 | 
			
		||||
					type: 'category',
 | 
			
		||||
					data: xData,
 | 
			
		||||
					axisLabel: {
 | 
			
		||||
						rotate: '45',
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				yAxis: {
 | 
			
		||||
					type: 'value',
 | 
			
		||||
				},
 | 
			
		||||
				series: [
 | 
			
		||||
					{
 | 
			
		||||
						data: yData,
 | 
			
		||||
						type: 'line',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
      option && this.chart.setOption(option);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
			option && this.chart.setOption(option);
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,94 +1,113 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container trendAnalysisBox" id="trendAnalysisBox">
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-area :isFold="isFold" @submit="getList"/>
 | 
			
		||||
    <el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
 | 
			
		||||
      <el-tab-pane label="柱状图" name="bar">
 | 
			
		||||
        <bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim"/>
 | 
			
		||||
      </el-tab-pane>
 | 
			
		||||
      <el-tab-pane label="折线图" name="line">
 | 
			
		||||
        <line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
 | 
			
		||||
      </el-tab-pane>
 | 
			
		||||
    </el-tabs>
 | 
			
		||||
    <!-- 没有数据 -->
 | 
			
		||||
    <div class="no-data-bg" v-show='!chartData.length'></div>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div
 | 
			
		||||
		class="app-container trendAnalysisBox"
 | 
			
		||||
		id="trendAnalysisBox">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<search-area
 | 
			
		||||
			:isFold="isFold"
 | 
			
		||||
			@submit="getList"
 | 
			
		||||
			@export="exportExl" />
 | 
			
		||||
		<div v-show="chartData.length">
 | 
			
		||||
			<base-table
 | 
			
		||||
				:table-props="tableProps"
 | 
			
		||||
				:table-data="list"
 | 
			
		||||
				class="trend-out-table" />
 | 
			
		||||
			<line-chart
 | 
			
		||||
				ref="analysisLineChart"
 | 
			
		||||
				:chartData="chartData"
 | 
			
		||||
				:timeDim="timeDim" />
 | 
			
		||||
		</div>
 | 
			
		||||
		<!-- 没有数据 -->
 | 
			
		||||
		<div
 | 
			
		||||
			class="no-data-bg"
 | 
			
		||||
			v-show="!chartData.length"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyTrend } from "@/api/analysis/energyAnalysis"
 | 
			
		||||
import SearchArea from "./components/searchArea"
 | 
			
		||||
import BarChart from "./components/barChart"
 | 
			
		||||
import LineChart from "./components/lineChart"
 | 
			
		||||
import { getEnergyTrend, exportTrend } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import SearchArea from './components/searchArea';
 | 
			
		||||
import LineChart from './components/lineChart';
 | 
			
		||||
// import moment from 'moment'
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'TrendAnalysis',
 | 
			
		||||
  components: { SearchArea, BarChart, LineChart },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      isFold: false,
 | 
			
		||||
      activeName: 'bar',
 | 
			
		||||
      chartData: [],
 | 
			
		||||
      timeDim: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
      this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
 | 
			
		||||
    })
 | 
			
		||||
    this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getList(params) {
 | 
			
		||||
      this.timeDim = params.timeDim
 | 
			
		||||
      getEnergyTrend({ ...params }).then((res) => {
 | 
			
		||||
        if (res.code === 0) {
 | 
			
		||||
          this.chartData = res.data
 | 
			
		||||
        } else {
 | 
			
		||||
          this.chartData = []
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    switchChart() {
 | 
			
		||||
      if (this.activeName === 'bar') {
 | 
			
		||||
        this.$nextTick((res) => {
 | 
			
		||||
          this.$refs.analysisBarChart.getChart()
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$nextTick((res) => {
 | 
			
		||||
          this.$refs.analysisLineChart.getChart()
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'TrendAnalysis',
 | 
			
		||||
	components: { SearchArea, LineChart },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			isFold: false,
 | 
			
		||||
			chartData: [],
 | 
			
		||||
			timeDim: '',
 | 
			
		||||
			tableProps: [],
 | 
			
		||||
			list: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
			this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
 | 
			
		||||
		});
 | 
			
		||||
		this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getList(params) {
 | 
			
		||||
			this.timeDim = params.timeDim;
 | 
			
		||||
			getEnergyTrend({ ...params }).then((res) => {
 | 
			
		||||
				if (res.code === 0) {
 | 
			
		||||
					this.getTableList(res.data || []);
 | 
			
		||||
					this.chartData = res.data || [];
 | 
			
		||||
				} else {
 | 
			
		||||
					this.chartData = [];
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		getTableList(arr) {
 | 
			
		||||
			this.tableProps = [];
 | 
			
		||||
			this.list = [];
 | 
			
		||||
			let tempX = [];
 | 
			
		||||
			let listObj = { useNum: '消耗量' }; // 数据
 | 
			
		||||
			for (let i = 0; i < arr.length; i++) {
 | 
			
		||||
				let obj = {};
 | 
			
		||||
				obj.prop = arr[i].time;
 | 
			
		||||
				obj.label = arr[i].time;
 | 
			
		||||
				obj.minWidth = 100;
 | 
			
		||||
				tempX.push(obj);
 | 
			
		||||
				listObj[arr[i].time] = arr[i].useNum || null;
 | 
			
		||||
			}
 | 
			
		||||
			this.tableProps = [{ prop: 'useNum', label: '时间' }].concat(tempX);
 | 
			
		||||
			this.list.push(listObj);
 | 
			
		||||
		},
 | 
			
		||||
		// 导出excel
 | 
			
		||||
		exportExl(params) {
 | 
			
		||||
			exportTrend({ ...params }).then((res) => {
 | 
			
		||||
				// let fileName = '';
 | 
			
		||||
				// const contentDisposition = res.headers['content-disposition'];
 | 
			
		||||
				// if (contentDisposition) {
 | 
			
		||||
				// 	fileName = decodeURIComponent(
 | 
			
		||||
				// 		contentDisposition.slice(
 | 
			
		||||
				// 			contentDisposition.indexOf('filename=') + 9
 | 
			
		||||
				// 		)
 | 
			
		||||
				// 	);
 | 
			
		||||
				// }
 | 
			
		||||
				const blob = new Blob([res.data]);
 | 
			
		||||
				const reader = new FileReader();
 | 
			
		||||
				reader.readAsDataURL(blob);
 | 
			
		||||
				reader.onload = (e) => {
 | 
			
		||||
					const a = document.createElement('a');
 | 
			
		||||
					a.download = '走势分析';
 | 
			
		||||
					a.href = e.target.result;
 | 
			
		||||
					document.body.appendChild(a);
 | 
			
		||||
					a.click();
 | 
			
		||||
					document.body.removeChild(a);
 | 
			
		||||
					this.$message.success('导出成功');
 | 
			
		||||
				};
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang='scss'>
 | 
			
		||||
.trendAnalysisBox {
 | 
			
		||||
  .el-tabs__nav::after {
 | 
			
		||||
    content: "";
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    bottom: 0;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 2px;
 | 
			
		||||
    background-color: #e4e7ed;
 | 
			
		||||
    /* z-index: 1; */
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__nav-wrap::after {
 | 
			
		||||
    width: 0;
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item {
 | 
			
		||||
    padding: 0 10px;
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item:hover {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item.is-active {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
  }
 | 
			
		||||
  .el-tabs__item {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.45);
 | 
			
		||||
  }
 | 
			
		||||
	.trend-out-table {
 | 
			
		||||
		margin-bottom: 15px;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,205 +1,227 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <el-form :inline="true" class="demo-form-inline">
 | 
			
		||||
    <span class="blue-block"></span>
 | 
			
		||||
    <el-form-item label="对象选择" required>
 | 
			
		||||
      <el-cascader
 | 
			
		||||
        v-model="objArr"
 | 
			
		||||
        :options="objList"
 | 
			
		||||
        :props="{ checkStrictly: true, value: 'id', label: 'name' }"
 | 
			
		||||
        popper-class="cascaderParent"
 | 
			
		||||
        size="small"
 | 
			
		||||
        clearable></el-cascader>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item label="时间维度" required>
 | 
			
		||||
      <el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
 | 
			
		||||
        <el-option
 | 
			
		||||
          v-for="item in timeType"
 | 
			
		||||
          :key="item.id"
 | 
			
		||||
          :label="item.name"
 | 
			
		||||
          :value="item.id"
 | 
			
		||||
          :clearable="false">
 | 
			
		||||
        </el-option>
 | 
			
		||||
      </el-select>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item label="时间" required>
 | 
			
		||||
      <div v-show="queryParams.type === 1 || queryParams.type === 2">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="yearValue"
 | 
			
		||||
          type="year"
 | 
			
		||||
          :picker-options="pickerOptions"
 | 
			
		||||
          @change="selectTime"
 | 
			
		||||
          :clearable="false"
 | 
			
		||||
          size="small"
 | 
			
		||||
          placeholder="选择年">
 | 
			
		||||
        </el-date-picker>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div v-show="queryParams.type === 3">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="yearMonth"
 | 
			
		||||
          type="month"
 | 
			
		||||
          :picker-options="pickerOptions"
 | 
			
		||||
          @change="selectTime"
 | 
			
		||||
          :clearable="false"
 | 
			
		||||
          size="small"
 | 
			
		||||
          placeholder="选择月">
 | 
			
		||||
        </el-date-picker>
 | 
			
		||||
      </div>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item>
 | 
			
		||||
      <el-button type="primary" size="small" @click="search">查询</el-button>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item>
 | 
			
		||||
      <span class="separateStyle"></span>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item>
 | 
			
		||||
      <el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
  </el-form>
 | 
			
		||||
	<el-form
 | 
			
		||||
		:inline="true"
 | 
			
		||||
		class="demo-form-inline">
 | 
			
		||||
		<span class="blue-block"></span>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="对象选择"
 | 
			
		||||
			required>
 | 
			
		||||
			<el-select
 | 
			
		||||
				v-model="queryParams.objId"
 | 
			
		||||
				placeholder="请选择"
 | 
			
		||||
				style="width: 250px"
 | 
			
		||||
				filterable
 | 
			
		||||
				size="small">
 | 
			
		||||
				<el-option
 | 
			
		||||
					v-for="item in objList"
 | 
			
		||||
					:key="item.id"
 | 
			
		||||
					:label="item.name"
 | 
			
		||||
					:value="item.id"
 | 
			
		||||
					:clearable="false"></el-option>
 | 
			
		||||
			</el-select>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="时间维度"
 | 
			
		||||
			required>
 | 
			
		||||
			<el-select
 | 
			
		||||
				v-model="queryParams.type"
 | 
			
		||||
				placeholder="请选择"
 | 
			
		||||
				style="width: 80px"
 | 
			
		||||
				size="small">
 | 
			
		||||
				<el-option
 | 
			
		||||
					v-for="item in timeType"
 | 
			
		||||
					:key="item.id"
 | 
			
		||||
					:label="item.name"
 | 
			
		||||
					:value="item.id"
 | 
			
		||||
					:clearable="false"></el-option>
 | 
			
		||||
			</el-select>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="时间"
 | 
			
		||||
			required>
 | 
			
		||||
			<div v-show="queryParams.type === 1 || queryParams.type === 2">
 | 
			
		||||
				<el-date-picker
 | 
			
		||||
					v-model="yearValue"
 | 
			
		||||
					type="year"
 | 
			
		||||
					:picker-options="pickerOptions"
 | 
			
		||||
					@change="selectTime"
 | 
			
		||||
					:clearable="false"
 | 
			
		||||
					size="small"
 | 
			
		||||
					placeholder="选择年"></el-date-picker>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div v-show="queryParams.type === 3">
 | 
			
		||||
				<el-date-picker
 | 
			
		||||
					v-model="yearMonth"
 | 
			
		||||
					type="month"
 | 
			
		||||
					:picker-options="pickerOptions"
 | 
			
		||||
					@change="selectTime"
 | 
			
		||||
					:clearable="false"
 | 
			
		||||
					size="small"
 | 
			
		||||
					placeholder="选择月"></el-date-picker>
 | 
			
		||||
			</div>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<el-button
 | 
			
		||||
				type="primary"
 | 
			
		||||
				size="small"
 | 
			
		||||
				@click="search">
 | 
			
		||||
				查询
 | 
			
		||||
			</el-button>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<span class="separateStyle"></span>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item>
 | 
			
		||||
			<el-button
 | 
			
		||||
				type="primary"
 | 
			
		||||
				size="small"
 | 
			
		||||
				@click="exportData"
 | 
			
		||||
				plain>
 | 
			
		||||
				导出
 | 
			
		||||
			</el-button>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getTree } from '@/api/base/factory'
 | 
			
		||||
import moment from 'moment'
 | 
			
		||||
import { getTree } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'searchArea',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        type: 1, // 1季度2月3日
 | 
			
		||||
        searchTime: null,
 | 
			
		||||
        objId: null
 | 
			
		||||
      },
 | 
			
		||||
      timeType: [
 | 
			
		||||
        {id: 1, name: '季度'},
 | 
			
		||||
        {id: 2, name: '月'},
 | 
			
		||||
        {id: 3, name: '日'}
 | 
			
		||||
      ],
 | 
			
		||||
      yearValue: '',
 | 
			
		||||
      yearMonth: '',
 | 
			
		||||
      objArr: [],
 | 
			
		||||
      objList: [],
 | 
			
		||||
      pickerOptions: {
 | 
			
		||||
        disabledDate(date) {
 | 
			
		||||
          return date.getTime() > Date.now()
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.getObjTree()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getObjTree() {
 | 
			
		||||
      getTree().then(res => {
 | 
			
		||||
        this.objList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    selectTime() {
 | 
			
		||||
      if (this.queryParams.type === 3) {
 | 
			
		||||
        this.queryParams.searchTime = this.yearMonth
 | 
			
		||||
      } else {
 | 
			
		||||
        this.queryParams.searchTime = this.yearValue
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 查询
 | 
			
		||||
    search() {
 | 
			
		||||
      if (this.objArr.length === 0) {
 | 
			
		||||
        this.$modal.msgError('请选择对象')
 | 
			
		||||
        return false
 | 
			
		||||
      } else {
 | 
			
		||||
        this.queryParams.objId = this.objArr[this.objArr.length-1]
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.queryParams.type) {
 | 
			
		||||
        this.$modal.msgError('请选择时间维度')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.queryParams.searchTime) {
 | 
			
		||||
        this.$modal.msgError('请选择时间')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      if (this.queryParams.type === 3) {
 | 
			
		||||
        this.queryParams.searchTime = this.transformTime(this.yearMonth) + ''
 | 
			
		||||
      } else {
 | 
			
		||||
        this.queryParams.searchTime = this.transformYear(this.yearValue) + ''
 | 
			
		||||
      }
 | 
			
		||||
      this.$emit('submit', this.queryParams)
 | 
			
		||||
    },
 | 
			
		||||
    exportData() {
 | 
			
		||||
      let name
 | 
			
		||||
      if (this.queryParams.objId) {
 | 
			
		||||
        name = this.getObjName(this.objList, this.queryParams.objId)
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$modal.msgWarning("对象不能为空")
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      this.$emit('exportD', {name: name})
 | 
			
		||||
    },
 | 
			
		||||
    // 递归取对象name
 | 
			
		||||
    getObjName(list, id) {
 | 
			
		||||
      let _this = this
 | 
			
		||||
      for (let i = 0; i < list.length; i++) {
 | 
			
		||||
        let a = list[i]
 | 
			
		||||
        if (a.id === id) {
 | 
			
		||||
          return a.name
 | 
			
		||||
        } else {
 | 
			
		||||
          if (a.children && a.children.length > 0) {
 | 
			
		||||
            let res = _this.getObjName(a.children, id)
 | 
			
		||||
            if (res) {
 | 
			
		||||
              return res
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    transformTime(timeStamp) {// 本月最后一天
 | 
			
		||||
      let year = moment(timeStamp).format('YYYY')
 | 
			
		||||
      let month = moment(timeStamp).format('MM')
 | 
			
		||||
      let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
 | 
			
		||||
      let value = new Date(newData).getTime()
 | 
			
		||||
      return value
 | 
			
		||||
    },
 | 
			
		||||
    transformYear(timeStamp) {// 本年最后一天
 | 
			
		||||
      let year = moment(timeStamp).format('YYYY')
 | 
			
		||||
      let newData = year+'-12-31 23:59:59'
 | 
			
		||||
      let value = new Date(newData).getTime()
 | 
			
		||||
      return value
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'searchArea',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				type: 1, // 1季度2月3日
 | 
			
		||||
				searchTime: null,
 | 
			
		||||
				objId: null,
 | 
			
		||||
				objType: 1,
 | 
			
		||||
			},
 | 
			
		||||
			timeType: [
 | 
			
		||||
				{ id: 1, name: '季度' },
 | 
			
		||||
				{ id: 2, name: '月' },
 | 
			
		||||
				{ id: 3, name: '日' },
 | 
			
		||||
			],
 | 
			
		||||
			yearValue: '',
 | 
			
		||||
			yearMonth: '',
 | 
			
		||||
			objList: [],
 | 
			
		||||
			pickerOptions: {
 | 
			
		||||
				disabledDate(date) {
 | 
			
		||||
					return date.getTime() > Date.now();
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getObjTree();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getObjTree() {
 | 
			
		||||
			getTree().then((res) => {
 | 
			
		||||
				this.objList = res.data || [];
 | 
			
		||||
				if (this.objList.length > 0) {
 | 
			
		||||
					this.queryParams.objId = this.objList[0].id;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		selectTime() {
 | 
			
		||||
			if (this.queryParams.type === 3) {
 | 
			
		||||
				this.queryParams.searchTime = this.yearMonth;
 | 
			
		||||
			} else {
 | 
			
		||||
				this.queryParams.searchTime = this.yearValue;
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 查询
 | 
			
		||||
		search() {
 | 
			
		||||
			if (!this.queryParams.objId) {
 | 
			
		||||
				this.$modal.msgError('请选择对象');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (!this.queryParams.type) {
 | 
			
		||||
				this.$modal.msgError('请选择时间维度');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (!this.queryParams.searchTime) {
 | 
			
		||||
				this.$modal.msgError('请选择时间');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (this.queryParams.type === 3) {
 | 
			
		||||
				this.queryParams.searchTime = this.transformTime(this.yearMonth) + '';
 | 
			
		||||
			} else {
 | 
			
		||||
				this.queryParams.searchTime = this.transformYear(this.yearValue) + '';
 | 
			
		||||
			}
 | 
			
		||||
			this.$emit('submit', this.queryParams);
 | 
			
		||||
		},
 | 
			
		||||
		exportData() {
 | 
			
		||||
			let name;
 | 
			
		||||
			if (this.queryParams.objId) {
 | 
			
		||||
				name = this.getObjName(this.objList, this.queryParams.objId);
 | 
			
		||||
			} else {
 | 
			
		||||
				this.$modal.msgWarning('对象不能为空');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			this.$emit('exportD', { name: name });
 | 
			
		||||
		},
 | 
			
		||||
		// 递归取对象name
 | 
			
		||||
		getObjName(list, id) {
 | 
			
		||||
			for (let i = 0; i < list.length; i++) {
 | 
			
		||||
				let a = list[i];
 | 
			
		||||
				if (a.id === id) {
 | 
			
		||||
					return a.name;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		transformTime(timeStamp) {
 | 
			
		||||
			// 本月最后一天
 | 
			
		||||
			let year = moment(timeStamp).format('YYYY');
 | 
			
		||||
			let month = moment(timeStamp).format('MM');
 | 
			
		||||
			let newData =
 | 
			
		||||
				moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
 | 
			
		||||
			let value = new Date(newData).getTime();
 | 
			
		||||
			return value;
 | 
			
		||||
		},
 | 
			
		||||
		transformYear(timeStamp) {
 | 
			
		||||
			// 本年最后一天
 | 
			
		||||
			let year = moment(timeStamp).format('YYYY');
 | 
			
		||||
			let newData = year + '-12-31 23:59:59';
 | 
			
		||||
			let value = new Date(newData).getTime();
 | 
			
		||||
			return value;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang='scss'>
 | 
			
		||||
/* 级联选择器 */
 | 
			
		||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
.demo-form-inline {
 | 
			
		||||
  .el-date-editor .el-range__icon {
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    color: #0B58FF;
 | 
			
		||||
  }
 | 
			
		||||
  .el-input__prefix .el-icon-date {
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    color: #0B58FF;
 | 
			
		||||
  }
 | 
			
		||||
	.el-date-editor .el-range__icon {
 | 
			
		||||
		font-size: 16px;
 | 
			
		||||
		color: #0b58ff;
 | 
			
		||||
	}
 | 
			
		||||
	.el-input__prefix .el-icon-date {
 | 
			
		||||
		font-size: 16px;
 | 
			
		||||
		color: #0b58ff;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.demo-form-inline {
 | 
			
		||||
  .blue-block {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: 4px;
 | 
			
		||||
    height: 16px;
 | 
			
		||||
    background-color: #0B58FF;
 | 
			
		||||
    border-radius: 1px;
 | 
			
		||||
    margin-right: 8px;
 | 
			
		||||
    margin-top: 10px;
 | 
			
		||||
  }
 | 
			
		||||
	.blue-block {
 | 
			
		||||
		display: inline-block;
 | 
			
		||||
		width: 4px;
 | 
			
		||||
		height: 16px;
 | 
			
		||||
		background-color: #0b58ff;
 | 
			
		||||
		border-radius: 1px;
 | 
			
		||||
		margin-right: 8px;
 | 
			
		||||
		margin-top: 10px;
 | 
			
		||||
	}
 | 
			
		||||
	.el-form-item {
 | 
			
		||||
		margin-right: 10px;
 | 
			
		||||
		margin-bottom: 4px;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
.separateStyle {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 1px;
 | 
			
		||||
  height: 24px;
 | 
			
		||||
  background: #E8E8E8;
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	width: 1px;
 | 
			
		||||
	height: 24px;
 | 
			
		||||
	background: #e8e8e8;
 | 
			
		||||
	vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,139 +1,155 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <el-form ref="form" :rules="rules" label-width="100px" :model="form">
 | 
			
		||||
    <el-form-item label="关联表名" prop="plcId">
 | 
			
		||||
      <el-select v-model="form.plcId" placeholder="请选择" style="width: 100%;" filterable>
 | 
			
		||||
        <el-option
 | 
			
		||||
          v-for="item in plcList"
 | 
			
		||||
          :key="item.id"
 | 
			
		||||
          :label="item.plcTableName"
 | 
			
		||||
          :value="item.id">
 | 
			
		||||
        </el-option>
 | 
			
		||||
      </el-select>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
    <el-form-item label="对象" prop="bindObjectId">
 | 
			
		||||
      <el-cascader
 | 
			
		||||
        style='width: 100%;'
 | 
			
		||||
        v-model="objIds"
 | 
			
		||||
        :options="objList"
 | 
			
		||||
        :props="{ checkStrictly: true, value: 'id', label: 'name' }"
 | 
			
		||||
        popper-class="cascaderParent"
 | 
			
		||||
        @change="selectObj"
 | 
			
		||||
        clearable></el-cascader>
 | 
			
		||||
    </el-form-item>
 | 
			
		||||
  </el-form>
 | 
			
		||||
	<el-form
 | 
			
		||||
		ref="form"
 | 
			
		||||
		:rules="rules"
 | 
			
		||||
		label-width="100px"
 | 
			
		||||
		:model="form">
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="关联表名"
 | 
			
		||||
			prop="plcId">
 | 
			
		||||
			<el-select
 | 
			
		||||
				v-model="form.plcId"
 | 
			
		||||
				placeholder="请选择"
 | 
			
		||||
				style="width: 100%"
 | 
			
		||||
				filterable>
 | 
			
		||||
				<el-option
 | 
			
		||||
					v-for="item in plcList"
 | 
			
		||||
					:key="item.id"
 | 
			
		||||
					:label="item.plcTableName"
 | 
			
		||||
					:value="item.id"></el-option>
 | 
			
		||||
			</el-select>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
		<el-form-item
 | 
			
		||||
			label="对象"
 | 
			
		||||
			prop="bindObjectId">
 | 
			
		||||
			<el-cascader
 | 
			
		||||
				style="width: 100%"
 | 
			
		||||
				v-model="objIds"
 | 
			
		||||
				:options="objList"
 | 
			
		||||
				:props="{ checkStrictly: true, value: 'id', label: 'name' }"
 | 
			
		||||
				@change="selectObj"
 | 
			
		||||
				clearable></el-cascader>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyPlcConnect, updateEnergyPlcConnect, createEnergyPlcConnect } from '@/api/base/energyPlcConnect'
 | 
			
		||||
import { getEnergyPlcAll } from '@/api/base/energyPlc'
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyPlcConnect,
 | 
			
		||||
	updateEnergyPlcConnect,
 | 
			
		||||
	createEnergyPlcConnect,
 | 
			
		||||
} from '@/api/base/energyPlcConnect';
 | 
			
		||||
import { getEnergyPlcAll } from '@/api/base/energyPlc';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'EnergyPlcConnectAdd',
 | 
			
		||||
  props: {
 | 
			
		||||
    objList: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: () => []
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      form: {
 | 
			
		||||
        id: '',
 | 
			
		||||
        plcId: '',
 | 
			
		||||
        bindObjectId: '',
 | 
			
		||||
        bindObjectType: ''
 | 
			
		||||
      },
 | 
			
		||||
      objIds: [],// 回显数组
 | 
			
		||||
      plcList: [],
 | 
			
		||||
      isEdit: false, //是否是编辑
 | 
			
		||||
      rules: {
 | 
			
		||||
        plcId: [{ required: true, message: '关联表名不能为空', trigger: 'change' }],
 | 
			
		||||
        bindObjectId: [{ required: true, message: '对象不能为空', trigger: 'change' }]
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    init(id) {
 | 
			
		||||
      getEnergyPlcAll().then((res) => {
 | 
			
		||||
        this.plcList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
      if (id) {
 | 
			
		||||
        this.isEdit = true
 | 
			
		||||
        this.form.id = id
 | 
			
		||||
        getEnergyPlcConnect( id ).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.form = res.data
 | 
			
		||||
            this.objIds = this.changeDetSelect(this.form.bindObjectId, this.objList)
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.isEdit = false
 | 
			
		||||
        this.form.id = ''
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 递归处理分类回显问题
 | 
			
		||||
    changeDetSelect(key, treeData) {
 | 
			
		||||
      let arr = [] // 递归时操作的数组
 | 
			
		||||
      let returnArr = [] // 存放结果的数组
 | 
			
		||||
      let depth = 0 // 定义全局层级
 | 
			
		||||
      // 定义递归函数
 | 
			
		||||
      function childrenEach(childrendData, depthN) {
 | 
			
		||||
        for (var j = 0; j < childrendData.length; j++) {
 | 
			
		||||
          depth = depthN
 | 
			
		||||
          arr[depthN] = childrendData[j].id
 | 
			
		||||
          if (childrendData[j].id == key) {
 | 
			
		||||
            returnArr = arr.slice(0, depthN + 1)
 | 
			
		||||
            break
 | 
			
		||||
          } else {
 | 
			
		||||
            if (childrendData[j].children) {
 | 
			
		||||
              depth++
 | 
			
		||||
              childrenEach(childrendData[j].children, depth)
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return returnArr
 | 
			
		||||
      }
 | 
			
		||||
      return childrenEach(treeData, depth)
 | 
			
		||||
    },
 | 
			
		||||
    selectObj(val) {
 | 
			
		||||
      this.form.bindObjectId = val[val.length-1]
 | 
			
		||||
      this.form.bindObjectType = val.length-1
 | 
			
		||||
    },
 | 
			
		||||
    submitForm() {
 | 
			
		||||
      this.$refs['form'].validate((valid) => {
 | 
			
		||||
        if (valid) {
 | 
			
		||||
          if (this.isEdit) {
 | 
			
		||||
            // 编辑
 | 
			
		||||
            updateEnergyPlcConnect({...this.form}).then((res) => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                this.$modal.msgSuccess("操作成功");
 | 
			
		||||
                this.$emit('successSubmit')
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          } else {
 | 
			
		||||
            createEnergyPlcConnect({...this.form}).then((res) => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                this.$modal.msgSuccess("操作成功");
 | 
			
		||||
                this.$emit('successSubmit')
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    formClear() {
 | 
			
		||||
      this.form.id = ''
 | 
			
		||||
      this.form.plcId = ''
 | 
			
		||||
      this.form.bindObjectId = ''
 | 
			
		||||
      this.form.bindObjectType = ''
 | 
			
		||||
      this.objIds = []
 | 
			
		||||
      this.isEdit = false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
<style>
 | 
			
		||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
	name: 'EnergyPlcConnectAdd',
 | 
			
		||||
	props: {
 | 
			
		||||
		objList: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			default: () => [],
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			form: {
 | 
			
		||||
				id: '',
 | 
			
		||||
				plcId: '',
 | 
			
		||||
				bindObjectId: '',
 | 
			
		||||
				bindObjectType: '',
 | 
			
		||||
			},
 | 
			
		||||
			objIds: [], // 回显数组
 | 
			
		||||
			plcList: [],
 | 
			
		||||
			isEdit: false, //是否是编辑
 | 
			
		||||
			rules: {
 | 
			
		||||
				plcId: [
 | 
			
		||||
					{ required: true, message: '关联表名不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				bindObjectId: [
 | 
			
		||||
					{ required: true, message: '对象不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(id) {
 | 
			
		||||
			getEnergyPlcAll().then((res) => {
 | 
			
		||||
				this.plcList = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
			if (id) {
 | 
			
		||||
				this.isEdit = true;
 | 
			
		||||
				this.form.id = id;
 | 
			
		||||
				getEnergyPlcConnect(id).then((res) => {
 | 
			
		||||
					if (res.code === 0) {
 | 
			
		||||
						this.form = res.data;
 | 
			
		||||
						this.objIds = this.changeDetSelect(
 | 
			
		||||
							this.form.bindObjectId,
 | 
			
		||||
							this.objList
 | 
			
		||||
						);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			} else {
 | 
			
		||||
				this.isEdit = false;
 | 
			
		||||
				this.form.id = '';
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 递归处理分类回显问题
 | 
			
		||||
		changeDetSelect(key, treeData) {
 | 
			
		||||
			let arr = []; // 递归时操作的数组
 | 
			
		||||
			let returnArr = []; // 存放结果的数组
 | 
			
		||||
			let depth = 0; // 定义全局层级
 | 
			
		||||
			// 定义递归函数
 | 
			
		||||
			function childrenEach(childrendData, depthN) {
 | 
			
		||||
				for (var j = 0; j < childrendData.length; j++) {
 | 
			
		||||
					depth = depthN;
 | 
			
		||||
					arr[depthN] = childrendData[j].id;
 | 
			
		||||
					if (childrendData[j].id == key) {
 | 
			
		||||
						returnArr = arr.slice(0, depthN + 1);
 | 
			
		||||
						break;
 | 
			
		||||
					} else {
 | 
			
		||||
						if (childrendData[j].children) {
 | 
			
		||||
							depth++;
 | 
			
		||||
							childrenEach(childrendData[j].children, depth);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				return returnArr;
 | 
			
		||||
			}
 | 
			
		||||
			return childrenEach(treeData, depth);
 | 
			
		||||
		},
 | 
			
		||||
		selectObj(val) {
 | 
			
		||||
			this.form.bindObjectId = val[val.length - 1];
 | 
			
		||||
			this.form.bindObjectType = val.length - 1;
 | 
			
		||||
		},
 | 
			
		||||
		submitForm() {
 | 
			
		||||
			this.$refs['form'].validate((valid) => {
 | 
			
		||||
				if (valid) {
 | 
			
		||||
					if (this.isEdit) {
 | 
			
		||||
						// 编辑
 | 
			
		||||
						updateEnergyPlcConnect({ ...this.form }).then((res) => {
 | 
			
		||||
							if (res.code === 0) {
 | 
			
		||||
								this.$modal.msgSuccess('操作成功');
 | 
			
		||||
								this.$emit('successSubmit');
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					} else {
 | 
			
		||||
						createEnergyPlcConnect({ ...this.form }).then((res) => {
 | 
			
		||||
							if (res.code === 0) {
 | 
			
		||||
								this.$modal.msgSuccess('操作成功');
 | 
			
		||||
								this.$emit('successSubmit');
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		formClear() {
 | 
			
		||||
			this.form.id = '';
 | 
			
		||||
			this.form.plcId = '';
 | 
			
		||||
			this.form.bindObjectId = '';
 | 
			
		||||
			this.form.bindObjectType = '';
 | 
			
		||||
			this.objIds = [];
 | 
			
		||||
			this.isEdit = false;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
@@ -1,236 +1,270 @@
 | 
			
		||||
<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="160" 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" width='30%'>
 | 
			
		||||
      <energy-plc-connect-add ref="energyPlcConnect" :objList="objList" @successSubmit="successSubmit" />
 | 
			
		||||
    </base-dialog>
 | 
			
		||||
    <!-- 参数绑定/查看 -->
 | 
			
		||||
    <energy-plc-param v-if="paramVisible" ref="plcParam" @closeDrawer="closeDrawer"
 | 
			
		||||
      :energyTypeList="energyTypeList"></energy-plc-param>
 | 
			
		||||
  </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="160"
 | 
			
		||||
				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"
 | 
			
		||||
			width="30%">
 | 
			
		||||
			<energy-plc-connect-add
 | 
			
		||||
				ref="energyPlcConnect"
 | 
			
		||||
				:objList="objList"
 | 
			
		||||
				@successSubmit="successSubmit" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
		<!-- 参数绑定/查看 -->
 | 
			
		||||
		<energy-plc-param
 | 
			
		||||
			v-if="paramVisible"
 | 
			
		||||
			ref="plcParam"
 | 
			
		||||
			@closeDrawer="closeDrawer"
 | 
			
		||||
			:energyTypeList="energyTypeList"></energy-plc-param>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyPlcConnectPage, deleteEnergyPlcConnect } from "@/api/base/energyPlcConnect";
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyPlcConnectPage,
 | 
			
		||||
	deleteEnergyPlcConnect,
 | 
			
		||||
} from '@/api/base/energyPlcConnect';
 | 
			
		||||
// import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import { getTree } from '@/api/base/factory'
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType'
 | 
			
		||||
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd'
 | 
			
		||||
import EnergyPlcParam from './components/energyPlcParam'
 | 
			
		||||
import { getTree } from '@/api/analysis/energyAnalysis';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd';
 | 
			
		||||
import EnergyPlcParam from './components/energyPlcParam';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '对象'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'plcTableName',
 | 
			
		||||
    label: '关联表名'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'plcTableCode',
 | 
			
		||||
    label: '关联表编码',
 | 
			
		||||
    minWidth: 150,
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'cnName',
 | 
			
		||||
    label: '标识名',
 | 
			
		||||
    minWidth: 150,
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'varNum',
 | 
			
		||||
    label: '绑定参数数量'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '对象',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'plcTableName',
 | 
			
		||||
		label: '关联表名',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'plcTableCode',
 | 
			
		||||
		label: '关联表编码',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'cnName',
 | 
			
		||||
		label: '标识名',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'varNum',
 | 
			
		||||
		label: '绑定参数数量',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyPlcConnect",
 | 
			
		||||
  components: { EnergyPlcConnectAdd, EnergyPlcParam },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'input',
 | 
			
		||||
          label: '标识名',
 | 
			
		||||
          placeholder: '标识名',
 | 
			
		||||
          param: 'cnName'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separate'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('base:energy-plc-connect:create') ? 'button' : '',
 | 
			
		||||
          btnName: '新增',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'success',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableBtn: [
 | 
			
		||||
        this.$auth.hasPermi('base:energy-plc-connect:bind')
 | 
			
		||||
          ? {
 | 
			
		||||
            type: 'connect',
 | 
			
		||||
            btnName: '绑定'
 | 
			
		||||
          }
 | 
			
		||||
          : undefined,
 | 
			
		||||
        {
 | 
			
		||||
          type: 'detail',
 | 
			
		||||
          btnName: '详情'
 | 
			
		||||
        },
 | 
			
		||||
        this.$auth.hasPermi('base:energy-plc-connect:update')
 | 
			
		||||
          ? {
 | 
			
		||||
            type: 'edit',
 | 
			
		||||
            btnName: '编辑'
 | 
			
		||||
          }
 | 
			
		||||
          : undefined,
 | 
			
		||||
        this.$auth.hasPermi('base:energy-plc-connect:delete')
 | 
			
		||||
          ? {
 | 
			
		||||
            type: 'delete',
 | 
			
		||||
            btnName: '删除'
 | 
			
		||||
          }
 | 
			
		||||
          : undefined
 | 
			
		||||
      ].filter((v) => v),
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      addOrEditTitle: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        cnName: null
 | 
			
		||||
      },
 | 
			
		||||
      paramVisible: false,
 | 
			
		||||
      energyTypeList: [],
 | 
			
		||||
      objList: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
    this.getList();
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    // 获取能源列表
 | 
			
		||||
    this.getEnergyTypeList()
 | 
			
		||||
    // 获取对象树形结构
 | 
			
		||||
    this.getObjTree()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.queryParams.cnName = val.cnName
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.addOrEditTitle = '新增'
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyPlcConnect.init()
 | 
			
		||||
          })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      getEnergyPlcConnectPage(this.queryParams).then(response => {
 | 
			
		||||
        let arr = response.data.list || [];
 | 
			
		||||
        this.list = arr
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      switch (val.type) {
 | 
			
		||||
        case 'edit':
 | 
			
		||||
          this.addOrEditTitle = '编辑'
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyPlcConnect.init(val.data.id)
 | 
			
		||||
          })
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          break
 | 
			
		||||
        case 'delete':
 | 
			
		||||
          this.handleDelete(val.data)
 | 
			
		||||
          break
 | 
			
		||||
        case 'detail':
 | 
			
		||||
          this.paramVisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.plcParam.init(val.data, 'detail')
 | 
			
		||||
          })
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.paramVisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.plcParam.init(val.data, 'connect')
 | 
			
		||||
          })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    handleCancel() {
 | 
			
		||||
      this.$refs.energyPlcConnect.formClear()
 | 
			
		||||
      this.centervisible = false
 | 
			
		||||
      this.addOrEditTitle = ''
 | 
			
		||||
    },
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.energyPlcConnect.submitForm()
 | 
			
		||||
    },
 | 
			
		||||
    successSubmit() {
 | 
			
		||||
      this.handleCancel()
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      this.$modal.confirm('是否确认删除对象为"' + row.objName + '"的数据项?').then(function () {
 | 
			
		||||
        return deleteEnergyPlcConnect(row.id);
 | 
			
		||||
      }).then(() => {
 | 
			
		||||
        this.queryParams.pageNo = 1;
 | 
			
		||||
        this.getList();
 | 
			
		||||
        this.$modal.msgSuccess("删除成功");
 | 
			
		||||
      }).catch(() => { });
 | 
			
		||||
    },
 | 
			
		||||
    closeDrawer() {
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    getEnergyTypeList() {
 | 
			
		||||
      getEnergyTypeListAll().then((res) => {
 | 
			
		||||
        this.energyTypeList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    getObjTree() {
 | 
			
		||||
      getTree().then(res => {
 | 
			
		||||
        this.objList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyPlcConnect',
 | 
			
		||||
	components: { EnergyPlcConnectAdd, EnergyPlcParam },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '标识名',
 | 
			
		||||
					placeholder: '标识名',
 | 
			
		||||
					param: 'cnName',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('base:energy-plc-connect:create')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'success',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('base:energy-plc-connect:bind')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'connect',
 | 
			
		||||
							btnName: '绑定',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				{
 | 
			
		||||
					type: 'detail',
 | 
			
		||||
					btnName: '详情',
 | 
			
		||||
				},
 | 
			
		||||
				this.$auth.hasPermi('base:energy-plc-connect:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '编辑',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('base:energy-plc-connect:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 弹出层标题
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				cnName: null,
 | 
			
		||||
			},
 | 
			
		||||
			paramVisible: false,
 | 
			
		||||
			energyTypeList: [],
 | 
			
		||||
			objList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		// 获取能源列表
 | 
			
		||||
		this.getEnergyTypeList();
 | 
			
		||||
		// 获取对象树形结构
 | 
			
		||||
		this.getObjTree();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.queryParams.cnName = val.cnName;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.addOrEditTitle = '新增';
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyPlcConnect.init();
 | 
			
		||||
					});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyPlcConnectPage(this.queryParams).then((response) => {
 | 
			
		||||
				let arr = response.data.list || [];
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(val) {
 | 
			
		||||
			console.log(val);
 | 
			
		||||
			switch (val.type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.addOrEditTitle = '编辑';
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyPlcConnect.init(val.data.id);
 | 
			
		||||
					});
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					break;
 | 
			
		||||
				case 'delete':
 | 
			
		||||
					this.handleDelete(val.data);
 | 
			
		||||
					break;
 | 
			
		||||
				case 'detail':
 | 
			
		||||
					this.paramVisible = true;
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.plcParam.init(val.data, 'detail');
 | 
			
		||||
					});
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.paramVisible = true;
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.plcParam.init(val.data, 'connect');
 | 
			
		||||
					});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.$refs.energyPlcConnect.formClear();
 | 
			
		||||
			this.centervisible = false;
 | 
			
		||||
			this.addOrEditTitle = '';
 | 
			
		||||
		},
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.energyPlcConnect.submitForm();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.handleCancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除对象为"' + row.objName + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyPlcConnect(row.id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		closeDrawer() {
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		getEnergyTypeList() {
 | 
			
		||||
			getEnergyTypeListAll().then((res) => {
 | 
			
		||||
				this.energyTypeList = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		getObjTree() {
 | 
			
		||||
			getTree().then((res) => {
 | 
			
		||||
				this.objList = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,329 +1,422 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <el-form ref="form" :rules="rules" label-width="100px" :model="form">
 | 
			
		||||
    <el-row>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="能源类型" prop="name">
 | 
			
		||||
          <el-input v-model="form.name"></el-input>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="类型编码" prop="code">
 | 
			
		||||
          <el-input v-model="form.code" disabled></el-input>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
    <el-row>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="单位" prop="unit">
 | 
			
		||||
          <el-select v-model="form.unit" placeholder="请选择" style="width: 100%;">
 | 
			
		||||
            <el-option v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)" :key="item.value" :label="item.label"
 | 
			
		||||
              :value="item.value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="计价方式" prop="pricingMethod">
 | 
			
		||||
          <el-select v-model="form.pricingMethod" placeholder="请选择" style="width: 100%;">
 | 
			
		||||
            <el-option label="时间段" :value='0'></el-option>
 | 
			
		||||
            <el-option label="使用量" :value='1'></el-option>
 | 
			
		||||
            <el-option label="固定价位" :value='2'></el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
    <el-row>
 | 
			
		||||
      <el-col :span="12" v-show="form.pricingMethod === 2">
 | 
			
		||||
        <el-form-item label="单价(元)" prop="pricingMethod">
 | 
			
		||||
          <el-input-number v-model="form.singlePrice" :precision="2" :min="0" :max="999999999"
 | 
			
		||||
            style="width: 100%;"></el-input-number>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12" v-show="form.pricingMethod === 1">
 | 
			
		||||
        <el-form-item label="计量维度" prop="dim">
 | 
			
		||||
          <el-select v-model="form.dim" placeholder="请选择" style="width: 100%;">
 | 
			
		||||
            <el-option label="月" :value='4'></el-option>
 | 
			
		||||
            <el-option label="年" :value='5'></el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="24" v-show="form.pricingMethod === 0">
 | 
			
		||||
        <el-form-item label="时间段" prop="pricingMethod">
 | 
			
		||||
          <base-table :key='timeKye' :table-props="tableProps1" :table-data="tableData1"
 | 
			
		||||
            :add-button-show="addButtonShow" @emitButtonClick="emitButtonClick1" @emitFun="inputChange1">
 | 
			
		||||
            <method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
 | 
			
		||||
              @clickBtn="handleClick1" />
 | 
			
		||||
          </base-table>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="24" v-show="form.pricingMethod === 1">
 | 
			
		||||
        <el-form-item label="使用量" prop="pricingMethod">
 | 
			
		||||
          <base-table :key='usedKye' :table-props="tableProps2" :table-data="tableData2"
 | 
			
		||||
            :add-button-show="addButtonShow" @emitButtonClick="emitButtonClick2" @emitFun="inputChange2">
 | 
			
		||||
            <method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
 | 
			
		||||
              @clickBtn="handleClick2" />
 | 
			
		||||
          </base-table>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
    <el-row>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="是否推送" prop="push">
 | 
			
		||||
          <el-switch v-model="form.push"></el-switch>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="描述" prop="description">
 | 
			
		||||
          <el-input v-model="form.description"></el-input>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
  </el-form>
 | 
			
		||||
	<el-form
 | 
			
		||||
		ref="form"
 | 
			
		||||
		:rules="rules"
 | 
			
		||||
		label-width="100px"
 | 
			
		||||
		:model="form">
 | 
			
		||||
		<el-row>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="能源类型"
 | 
			
		||||
					prop="name">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.name"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in getDictDatas(DICT_TYPE.ENERGY_TYPE)"
 | 
			
		||||
							:key="item.value"
 | 
			
		||||
							:label="item.label"
 | 
			
		||||
							:value="item.value"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="类型编码"
 | 
			
		||||
					prop="code">
 | 
			
		||||
					<el-input
 | 
			
		||||
						v-model="form.code"
 | 
			
		||||
						disabled></el-input>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
		<el-row>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="单位"
 | 
			
		||||
					prop="unit">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.unit"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						filterable
 | 
			
		||||
						style="width: 100%">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in getDictDatas(DICT_TYPE.UNIT_DICT)"
 | 
			
		||||
							:key="item.value"
 | 
			
		||||
							:label="item.label"
 | 
			
		||||
							:value="item.value"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="计价方式"
 | 
			
		||||
					prop="pricingMethod">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.pricingMethod"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%">
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="时间段"
 | 
			
		||||
							:value="0"></el-option>
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="使用量"
 | 
			
		||||
							:value="1"></el-option>
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="固定价位"
 | 
			
		||||
							:value="2"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
		<el-row>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="12"
 | 
			
		||||
				v-show="form.pricingMethod === 2">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="单价(元)"
 | 
			
		||||
					prop="pricingMethod">
 | 
			
		||||
					<el-input-number
 | 
			
		||||
						v-model="form.singlePrice"
 | 
			
		||||
						:precision="2"
 | 
			
		||||
						:min="0"
 | 
			
		||||
						:max="999999999"
 | 
			
		||||
						style="width: 100%"></el-input-number>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="12"
 | 
			
		||||
				v-show="form.pricingMethod === 1">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="计量维度"
 | 
			
		||||
					prop="dim">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.dim"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%">
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="月"
 | 
			
		||||
							:value="4"></el-option>
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="年"
 | 
			
		||||
							:value="5"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="24"
 | 
			
		||||
				v-show="form.pricingMethod === 0">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="时间段"
 | 
			
		||||
					prop="pricingMethod">
 | 
			
		||||
					<base-table
 | 
			
		||||
						:key="timeKye"
 | 
			
		||||
						:table-props="tableProps1"
 | 
			
		||||
						:table-data="tableData1"
 | 
			
		||||
						:add-button-show="addButtonShow"
 | 
			
		||||
						@emitButtonClick="emitButtonClick1"
 | 
			
		||||
						@emitFun="inputChange1">
 | 
			
		||||
						<method-btn
 | 
			
		||||
							v-if="tableBtn.length"
 | 
			
		||||
							slot="handleBtn"
 | 
			
		||||
							:width="80"
 | 
			
		||||
							label="操作"
 | 
			
		||||
							:method-list="tableBtn"
 | 
			
		||||
							@clickBtn="handleClick1" />
 | 
			
		||||
					</base-table>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="24"
 | 
			
		||||
				v-show="form.pricingMethod === 1">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="使用量"
 | 
			
		||||
					prop="pricingMethod">
 | 
			
		||||
					<base-table
 | 
			
		||||
						:key="usedKye"
 | 
			
		||||
						:table-props="tableProps2"
 | 
			
		||||
						:table-data="tableData2"
 | 
			
		||||
						:add-button-show="addButtonShow"
 | 
			
		||||
						@emitButtonClick="emitButtonClick2"
 | 
			
		||||
						@emitFun="inputChange2">
 | 
			
		||||
						<method-btn
 | 
			
		||||
							v-if="tableBtn.length"
 | 
			
		||||
							slot="handleBtn"
 | 
			
		||||
							:width="80"
 | 
			
		||||
							label="操作"
 | 
			
		||||
							:method-list="tableBtn"
 | 
			
		||||
							@clickBtn="handleClick2" />
 | 
			
		||||
					</base-table>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
		<el-row>
 | 
			
		||||
			<el-col :span="24">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="描述"
 | 
			
		||||
					prop="description">
 | 
			
		||||
					<el-input v-model="form.description"></el-input>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyType, updateEnergyType, createEnergyType, getEnergyTypeCode } from '@/api/base/energyType'
 | 
			
		||||
import inputArea from './InputArea.vue'
 | 
			
		||||
import timePickerArea from './TimePickerArea.vue'
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyType,
 | 
			
		||||
	updateEnergyType,
 | 
			
		||||
	createEnergyType,
 | 
			
		||||
	getEnergyTypeCode,
 | 
			
		||||
} from '@/api/base/energyType';
 | 
			
		||||
import inputArea from './InputArea.vue';
 | 
			
		||||
import timePickerArea from './TimePickerArea.vue';
 | 
			
		||||
const tableProps1 = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startTime',
 | 
			
		||||
    label: '开始时间',
 | 
			
		||||
    subcomponent: timePickerArea
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endTime',
 | 
			
		||||
    label: '结束时间',
 | 
			
		||||
    subcomponent: timePickerArea
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'price',
 | 
			
		||||
    label: '单价(元)',
 | 
			
		||||
    subcomponent: inputArea
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startTime',
 | 
			
		||||
		label: '开始时间',
 | 
			
		||||
		subcomponent: timePickerArea,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endTime',
 | 
			
		||||
		label: '结束时间',
 | 
			
		||||
		subcomponent: timePickerArea,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'price',
 | 
			
		||||
		label: '单价(元)',
 | 
			
		||||
		subcomponent: inputArea,
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
const tableProps2 = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startUsed',
 | 
			
		||||
    label: '下限值',
 | 
			
		||||
    // subcomponent: inputArea
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endUsed',
 | 
			
		||||
    label: '上限量',
 | 
			
		||||
    subcomponent: inputArea
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'price',
 | 
			
		||||
    label: '单价(元)',
 | 
			
		||||
    subcomponent: inputArea
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startUsed',
 | 
			
		||||
		label: '下限值',
 | 
			
		||||
		// subcomponent: inputArea
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endUsed',
 | 
			
		||||
		label: '上限量',
 | 
			
		||||
		subcomponent: inputArea,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'price',
 | 
			
		||||
		label: '单价(元)',
 | 
			
		||||
		subcomponent: inputArea,
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'energyTypeAdd',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      form: {
 | 
			
		||||
        id: '',
 | 
			
		||||
        name: '',
 | 
			
		||||
        code: '',
 | 
			
		||||
        unit: '',
 | 
			
		||||
        singlePrice: 0,
 | 
			
		||||
        pricingMethod: 2,
 | 
			
		||||
        dim: '',
 | 
			
		||||
        push: false,
 | 
			
		||||
        description: ''
 | 
			
		||||
      },
 | 
			
		||||
      isEdit: false, //是否是编辑
 | 
			
		||||
      rules: {
 | 
			
		||||
        name: [{ required: true, message: '能源类型不能为空', trigger: 'blur' }],
 | 
			
		||||
        pricingMethod: [{ required: true, message: '计价方式不能为空', trigger: 'change' }]
 | 
			
		||||
      },
 | 
			
		||||
      timeKye: 0,
 | 
			
		||||
      usedKye: 0,
 | 
			
		||||
      tableProps1,
 | 
			
		||||
      tableProps2,
 | 
			
		||||
      tableData1: [],
 | 
			
		||||
      tableData2: [],
 | 
			
		||||
      tableBtn: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'delete',
 | 
			
		||||
          name: '删除'
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      addButtonShow: '新增'
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    init(id) {
 | 
			
		||||
      if (id) {
 | 
			
		||||
        this.isEdit = true
 | 
			
		||||
        this.form.id = id
 | 
			
		||||
        getEnergyType(id).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.form.name = res.data.name
 | 
			
		||||
            this.form.code = res.data.code
 | 
			
		||||
            this.form.unit = res.data.unit
 | 
			
		||||
            this.form.pricingMethod = res.data.pricingMethod
 | 
			
		||||
            this.form.push = res.data.push ? true : false
 | 
			
		||||
            this.form.description = res.data.description
 | 
			
		||||
            switch (this.form.pricingMethod) {
 | 
			
		||||
              case 0:
 | 
			
		||||
                this.tableData1 = res.data.segPriceList || []
 | 
			
		||||
                break;
 | 
			
		||||
              case 1:
 | 
			
		||||
                this.tableData2 = res.data.usedPriceList || []
 | 
			
		||||
                this.form.dim = res.data.dim
 | 
			
		||||
                break;
 | 
			
		||||
              default:
 | 
			
		||||
                this.form.singlePrice = res.data.singlePrice || 0
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        console.log(this.form)
 | 
			
		||||
      } else {
 | 
			
		||||
        this.isEdit = false
 | 
			
		||||
        this.form.id = ''
 | 
			
		||||
        getEnergyTypeCode().then((res) => {
 | 
			
		||||
          this.form.code = res.data
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 输入框失去焦点
 | 
			
		||||
    inputChange1(val) {
 | 
			
		||||
      this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop]
 | 
			
		||||
      if ((this.tableData1.length > val._pageIndex) && val.prop === 'endTime') {
 | 
			
		||||
        this.tableData1[val._pageIndex].startTime = val[val.prop]
 | 
			
		||||
      }
 | 
			
		||||
      this.timeKye++
 | 
			
		||||
    },
 | 
			
		||||
    inputChange2(val) {
 | 
			
		||||
      // 上限值必须大于下限值
 | 
			
		||||
      if (!!val.endUsed && (val.endUsed <= val.startUsed)) {
 | 
			
		||||
        this.$modal.msgError('上限值不能等于或者小于下限值')
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop]
 | 
			
		||||
      if ((this.tableData2.length > val._pageIndex) && val.prop === 'endUsed') {
 | 
			
		||||
        this.tableData2[val._pageIndex].startUsed = val[val.prop]
 | 
			
		||||
      }
 | 
			
		||||
      this.usedKye++
 | 
			
		||||
    },
 | 
			
		||||
    // 增加
 | 
			
		||||
    emitButtonClick1() {
 | 
			
		||||
      let n = this.tableData1.length
 | 
			
		||||
      let obj = {}
 | 
			
		||||
      obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime
 | 
			
		||||
      obj.endTime = ''
 | 
			
		||||
      obj.price = 0
 | 
			
		||||
      this.tableData1.push(obj)
 | 
			
		||||
    },
 | 
			
		||||
    emitButtonClick2() {
 | 
			
		||||
      let n = this.tableData2.length
 | 
			
		||||
      let obj = {}
 | 
			
		||||
      obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed
 | 
			
		||||
      obj.endUsed = 0
 | 
			
		||||
      obj.price = 0
 | 
			
		||||
      this.tableData2.push(obj)
 | 
			
		||||
    },
 | 
			
		||||
    // 删除
 | 
			
		||||
    handleClick1(val) {
 | 
			
		||||
      this.tableData1.splice(val.data._pageIndex - 1, 1)
 | 
			
		||||
      this.timeKye++
 | 
			
		||||
    },
 | 
			
		||||
    handleClick2(val) {
 | 
			
		||||
      this.tableData2.splice(val.data._pageIndex - 1, 1)
 | 
			
		||||
      this.usedKye++
 | 
			
		||||
    },
 | 
			
		||||
    submitForm() {
 | 
			
		||||
      this.$refs['form'].validate((valid) => {
 | 
			
		||||
        if (valid) {
 | 
			
		||||
          switch (this.form.pricingMethod) {
 | 
			
		||||
            case 0:// 时间段
 | 
			
		||||
              if (this.tableData1.length === 0) {
 | 
			
		||||
                this.$modal.msgError('时间段表格数据不能为空')
 | 
			
		||||
                return false
 | 
			
		||||
              } else {
 | 
			
		||||
                this.tableData1.map(item => {
 | 
			
		||||
                  if (item.price <= 0) {
 | 
			
		||||
                    this.$modal.msgError('单价有误请检查,请检查')
 | 
			
		||||
                    return false
 | 
			
		||||
                  }
 | 
			
		||||
                })
 | 
			
		||||
              }
 | 
			
		||||
              break;
 | 
			
		||||
            case 1:// 使用量
 | 
			
		||||
              if (this.tableData2.length === 0) {
 | 
			
		||||
                this.$modal.msgError('使用量表格数据不能为空')
 | 
			
		||||
                return false
 | 
			
		||||
              } else {
 | 
			
		||||
                this.tableData1.map(item => {
 | 
			
		||||
                  if (item.price <= 0) {
 | 
			
		||||
                    this.$modal.msgError('单价有误请检查,请检查')
 | 
			
		||||
                    return false
 | 
			
		||||
                  }
 | 
			
		||||
                })
 | 
			
		||||
              }
 | 
			
		||||
              break;
 | 
			
		||||
            default:// 固定单价
 | 
			
		||||
              if (!this.form.singlePrice) {
 | 
			
		||||
                this.$modal.msgError('单价有误请检查,请检查')
 | 
			
		||||
                return false
 | 
			
		||||
              }
 | 
			
		||||
          }
 | 
			
		||||
          console.log(this.form)
 | 
			
		||||
          if (this.isEdit) {
 | 
			
		||||
            // 编辑
 | 
			
		||||
            updateEnergyType({
 | 
			
		||||
              id: this.form.id,
 | 
			
		||||
              code: this.form.code,
 | 
			
		||||
              name: this.form.name,
 | 
			
		||||
              unit: this.form.unit,
 | 
			
		||||
              pricingMethod: this.form.pricingMethod,
 | 
			
		||||
              description: this.form.description,
 | 
			
		||||
              dim: this.form.pricingMethod === 1 ? this.form.dim : '',
 | 
			
		||||
              singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
 | 
			
		||||
              segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [],
 | 
			
		||||
              usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [],
 | 
			
		||||
              push: this.form.push ? 1 : 0
 | 
			
		||||
            }).then((res) => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                this.$modal.msgSuccess("操作成功");
 | 
			
		||||
                this.$emit('successSubmit')
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          } else {
 | 
			
		||||
            createEnergyType({
 | 
			
		||||
              code: this.form.code,
 | 
			
		||||
              name: this.form.name,
 | 
			
		||||
              unit: this.form.unit,
 | 
			
		||||
              pricingMethod: this.form.pricingMethod,
 | 
			
		||||
              description: this.form.description,
 | 
			
		||||
              dim: this.form.pricingMethod === 1 ? this.form.dim : '',
 | 
			
		||||
              singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
 | 
			
		||||
              segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [],
 | 
			
		||||
              usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [],
 | 
			
		||||
              push: this.form.push ? 1 : 0
 | 
			
		||||
            }).then((res) => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                this.$modal.msgSuccess("操作成功");
 | 
			
		||||
                this.$emit('successSubmit')
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    formClear() {
 | 
			
		||||
      this.$refs.form.resetFields()
 | 
			
		||||
      this.form.singlePrice = 0
 | 
			
		||||
      this.isEdit = false
 | 
			
		||||
      this.timeKye = 0
 | 
			
		||||
      this.usedKye = 0
 | 
			
		||||
      this.tableData1 = []
 | 
			
		||||
      this.tableData2 = []
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'energyTypeAdd',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			form: {
 | 
			
		||||
				id: '',
 | 
			
		||||
				name: '',
 | 
			
		||||
				code: '',
 | 
			
		||||
				unit: '',
 | 
			
		||||
				singlePrice: 0,
 | 
			
		||||
				pricingMethod: 2,
 | 
			
		||||
				dim: '',
 | 
			
		||||
				description: '',
 | 
			
		||||
			},
 | 
			
		||||
			isEdit: false, //是否是编辑
 | 
			
		||||
			rules: {
 | 
			
		||||
				name: [
 | 
			
		||||
					{ required: true, message: '能源类型不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
				pricingMethod: [
 | 
			
		||||
					{ required: true, message: '计价方式不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
			},
 | 
			
		||||
			timeKye: 0,
 | 
			
		||||
			usedKye: 0,
 | 
			
		||||
			tableProps1,
 | 
			
		||||
			tableProps2,
 | 
			
		||||
			tableData1: [],
 | 
			
		||||
			tableData2: [],
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'delete',
 | 
			
		||||
					name: '删除',
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			addButtonShow: '新增',
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(id) {
 | 
			
		||||
			if (id) {
 | 
			
		||||
				this.isEdit = true;
 | 
			
		||||
				this.form.id = id;
 | 
			
		||||
				getEnergyType(id).then((res) => {
 | 
			
		||||
					if (res.code === 0) {
 | 
			
		||||
						this.form.name = res.data.name;
 | 
			
		||||
						this.form.code = res.data.code;
 | 
			
		||||
						this.form.unit = res.data.unit;
 | 
			
		||||
						this.form.pricingMethod = res.data.pricingMethod;
 | 
			
		||||
						this.form.description = res.data.description;
 | 
			
		||||
						switch (this.form.pricingMethod) {
 | 
			
		||||
							case 0:
 | 
			
		||||
								this.tableData1 = res.data.segPriceList || [];
 | 
			
		||||
								break;
 | 
			
		||||
							case 1:
 | 
			
		||||
								this.tableData2 = res.data.usedPriceList || [];
 | 
			
		||||
								this.form.dim = res.data.dim;
 | 
			
		||||
								break;
 | 
			
		||||
							default:
 | 
			
		||||
								this.form.singlePrice = res.data.singlePrice || 0;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
				console.log(this.form);
 | 
			
		||||
			} else {
 | 
			
		||||
				this.isEdit = false;
 | 
			
		||||
				this.form.id = '';
 | 
			
		||||
				getEnergyTypeCode().then((res) => {
 | 
			
		||||
					this.form.code = res.data;
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 输入框失去焦点
 | 
			
		||||
		inputChange1(val) {
 | 
			
		||||
			this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop];
 | 
			
		||||
			if (this.tableData1.length > val._pageIndex && val.prop === 'endTime') {
 | 
			
		||||
				this.tableData1[val._pageIndex].startTime = val[val.prop];
 | 
			
		||||
			}
 | 
			
		||||
			this.timeKye++;
 | 
			
		||||
		},
 | 
			
		||||
		inputChange2(val) {
 | 
			
		||||
			// 上限值必须大于下限值
 | 
			
		||||
			if (!!val.endUsed && val.endUsed <= val.startUsed) {
 | 
			
		||||
				this.$modal.msgError('上限值不能等于或者小于下限值');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop];
 | 
			
		||||
			if (this.tableData2.length > val._pageIndex && val.prop === 'endUsed') {
 | 
			
		||||
				this.tableData2[val._pageIndex].startUsed = val[val.prop];
 | 
			
		||||
			}
 | 
			
		||||
			this.usedKye++;
 | 
			
		||||
		},
 | 
			
		||||
		// 增加
 | 
			
		||||
		emitButtonClick1() {
 | 
			
		||||
			let n = this.tableData1.length;
 | 
			
		||||
			let obj = {};
 | 
			
		||||
			obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime;
 | 
			
		||||
			obj.endTime = '';
 | 
			
		||||
			obj.price = 0;
 | 
			
		||||
			this.tableData1.push(obj);
 | 
			
		||||
		},
 | 
			
		||||
		emitButtonClick2() {
 | 
			
		||||
			let n = this.tableData2.length;
 | 
			
		||||
			let obj = {};
 | 
			
		||||
			obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed;
 | 
			
		||||
			obj.endUsed = 0;
 | 
			
		||||
			obj.price = 0;
 | 
			
		||||
			this.tableData2.push(obj);
 | 
			
		||||
		},
 | 
			
		||||
		// 删除
 | 
			
		||||
		handleClick1(val) {
 | 
			
		||||
			this.tableData1.splice(val.data._pageIndex - 1, 1);
 | 
			
		||||
			this.timeKye++;
 | 
			
		||||
		},
 | 
			
		||||
		handleClick2(val) {
 | 
			
		||||
			this.tableData2.splice(val.data._pageIndex - 1, 1);
 | 
			
		||||
			this.usedKye++;
 | 
			
		||||
		},
 | 
			
		||||
		submitForm() {
 | 
			
		||||
			this.$refs['form'].validate((valid) => {
 | 
			
		||||
				if (valid) {
 | 
			
		||||
					switch (this.form.pricingMethod) {
 | 
			
		||||
						case 0: // 时间段
 | 
			
		||||
							if (this.tableData1.length === 0) {
 | 
			
		||||
								this.$modal.msgError('时间段表格数据不能为空');
 | 
			
		||||
								return false;
 | 
			
		||||
							} else {
 | 
			
		||||
								this.tableData1.map((item) => {
 | 
			
		||||
									if (item.price <= 0) {
 | 
			
		||||
										this.$modal.msgError('单价有误请检查,请检查');
 | 
			
		||||
										return false;
 | 
			
		||||
									}
 | 
			
		||||
								});
 | 
			
		||||
							}
 | 
			
		||||
							break;
 | 
			
		||||
						case 1: // 使用量
 | 
			
		||||
							if (this.tableData2.length === 0) {
 | 
			
		||||
								this.$modal.msgError('使用量表格数据不能为空');
 | 
			
		||||
								return false;
 | 
			
		||||
							} else {
 | 
			
		||||
								this.tableData1.map((item) => {
 | 
			
		||||
									if (item.price <= 0) {
 | 
			
		||||
										this.$modal.msgError('单价有误请检查,请检查');
 | 
			
		||||
										return false;
 | 
			
		||||
									}
 | 
			
		||||
								});
 | 
			
		||||
							}
 | 
			
		||||
							break;
 | 
			
		||||
						default: // 固定单价
 | 
			
		||||
							if (!this.form.singlePrice) {
 | 
			
		||||
								this.$modal.msgError('单价有误请检查,请检查');
 | 
			
		||||
								return false;
 | 
			
		||||
							}
 | 
			
		||||
					}
 | 
			
		||||
					console.log(this.form);
 | 
			
		||||
					if (this.isEdit) {
 | 
			
		||||
						// 编辑
 | 
			
		||||
						updateEnergyType({
 | 
			
		||||
							id: this.form.id,
 | 
			
		||||
							code: this.form.code,
 | 
			
		||||
							name: this.form.name,
 | 
			
		||||
							unit: this.form.unit,
 | 
			
		||||
							pricingMethod: this.form.pricingMethod,
 | 
			
		||||
							description: this.form.description,
 | 
			
		||||
							dim: this.form.pricingMethod === 1 ? this.form.dim : '',
 | 
			
		||||
							singlePrice:
 | 
			
		||||
								this.form.pricingMethod === 2 ? this.form.singlePrice : '',
 | 
			
		||||
							segPriceList:
 | 
			
		||||
								this.form.pricingMethod === 0 ? this.tableData1 : [],
 | 
			
		||||
							usedPriceList:
 | 
			
		||||
								this.form.pricingMethod === 1 ? this.tableData2 : [],
 | 
			
		||||
						}).then((res) => {
 | 
			
		||||
							if (res.code === 0) {
 | 
			
		||||
								this.$modal.msgSuccess('操作成功');
 | 
			
		||||
								this.$emit('successSubmit');
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					} else {
 | 
			
		||||
						createEnergyType({
 | 
			
		||||
							code: this.form.code,
 | 
			
		||||
							name: this.form.name,
 | 
			
		||||
							unit: this.form.unit,
 | 
			
		||||
							pricingMethod: this.form.pricingMethod,
 | 
			
		||||
							description: this.form.description,
 | 
			
		||||
							dim: this.form.pricingMethod === 1 ? this.form.dim : '',
 | 
			
		||||
							singlePrice:
 | 
			
		||||
								this.form.pricingMethod === 2 ? this.form.singlePrice : '',
 | 
			
		||||
							segPriceList:
 | 
			
		||||
								this.form.pricingMethod === 0 ? this.tableData1 : [],
 | 
			
		||||
							usedPriceList:
 | 
			
		||||
								this.form.pricingMethod === 1 ? this.tableData2 : [],
 | 
			
		||||
						}).then((res) => {
 | 
			
		||||
							if (res.code === 0) {
 | 
			
		||||
								this.$modal.msgSuccess('操作成功');
 | 
			
		||||
								this.$emit('successSubmit');
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		formClear() {
 | 
			
		||||
			this.$refs.form.resetFields();
 | 
			
		||||
			this.form.singlePrice = 0;
 | 
			
		||||
			this.isEdit = false;
 | 
			
		||||
			this.timeKye = 0;
 | 
			
		||||
			this.usedKye = 0;
 | 
			
		||||
			this.tableData1 = [];
 | 
			
		||||
			this.tableData2 = [];
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,224 +1,191 @@
 | 
			
		||||
<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-type-add ref="energyType" @successSubmit="successSubmit" />
 | 
			
		||||
    </base-dialog>
 | 
			
		||||
  </div>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<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">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
				:width="80"
 | 
			
		||||
				label="操作"
 | 
			
		||||
				:method-list="tableBtn"
 | 
			
		||||
				@clickBtn="handleClick" />
 | 
			
		||||
		</base-table>
 | 
			
		||||
		<!-- 新增 -->
 | 
			
		||||
		<base-dialog
 | 
			
		||||
			:dialogTitle="addOrEditTitle"
 | 
			
		||||
			:dialogVisible="centervisible"
 | 
			
		||||
			@cancel="handleCancel"
 | 
			
		||||
			@confirm="handleConfirm"
 | 
			
		||||
			:before-close="handleCancel">
 | 
			
		||||
			<energy-type-add
 | 
			
		||||
				ref="energyType"
 | 
			
		||||
				@successSubmit="successSubmit" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyTypePage, deleteEnergyType } from "@/api/base/energyType";
 | 
			
		||||
import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import InnerTable from './components/InnerTable'
 | 
			
		||||
import EnergyTypeAdd from './components/energyTypeAdd'
 | 
			
		||||
import { getEnergyTypePage, deleteEnergyType } from '@/api/base/energyType';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import InnerTable from './components/InnerTable';
 | 
			
		||||
import EnergyTypeAdd from './components/energyTypeAdd';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'code',
 | 
			
		||||
    label: '类型编码',
 | 
			
		||||
    showOverflowtooltip: true,
 | 
			
		||||
    minWidth: 150
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'name',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'unit',
 | 
			
		||||
    label: '单位',
 | 
			
		||||
    filter: publicFormatter('energy_unit')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'pricingMethod',
 | 
			
		||||
    label: '计价方式'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'push',
 | 
			
		||||
    label: '是否推送',
 | 
			
		||||
    filter: publicFormatter('push')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'price',
 | 
			
		||||
    label: '价格(元)',
 | 
			
		||||
    subcomponent: InnerTable
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '类型编码',
 | 
			
		||||
		showOverflowtooltip: true,
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'unit',
 | 
			
		||||
		label: '单位',
 | 
			
		||||
		filter: publicFormatter('unit_dict'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'pricingMethod',
 | 
			
		||||
		label: '计价方式',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'price',
 | 
			
		||||
		label: '价格(元)',
 | 
			
		||||
		subcomponent: InnerTable,
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyType",
 | 
			
		||||
  components: { EnergyTypeAdd },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'input',
 | 
			
		||||
          label: '能源类型',
 | 
			
		||||
          placeholder: '能源类型',
 | 
			
		||||
          param: 'name'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('base:energy-type:create') ? 'separate' : '',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
 | 
			
		||||
          btnName: '新增',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'success',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableBtn: [
 | 
			
		||||
        this.$auth.hasPermi('base:energy-type:update')
 | 
			
		||||
          ? {
 | 
			
		||||
              type: 'edit',
 | 
			
		||||
              btnName: '编辑'
 | 
			
		||||
            }
 | 
			
		||||
          : undefined,
 | 
			
		||||
        this.$auth.hasPermi('base:energy-type:delete')
 | 
			
		||||
          ? {
 | 
			
		||||
              type: 'delete',
 | 
			
		||||
              btnName: '删除'
 | 
			
		||||
            }
 | 
			
		||||
          : undefined
 | 
			
		||||
      ].filter((v) => v),
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      pricingMethodList: [
 | 
			
		||||
        {value: 0,label: '分时间段计价'},
 | 
			
		||||
        {value: 1,label: '分使用量计价'},
 | 
			
		||||
        {value: 2,label: '单一计价'}
 | 
			
		||||
      ],
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      addOrEditTitle: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        name: null,
 | 
			
		||||
        code: 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.queryParams.code = val.code
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.addOrEditTitle = '新增'
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyType.init()
 | 
			
		||||
          })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      getEnergyTypePage(this.queryParams).then(response => {
 | 
			
		||||
        let arr = response.data.list || [];
 | 
			
		||||
        arr&&arr.map(item => {
 | 
			
		||||
          this.pricingMethodList.map(i => {
 | 
			
		||||
            if (item.pricingMethod === i.value) {
 | 
			
		||||
              item.pricingMethod = i.label
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        })
 | 
			
		||||
        this.list = arr
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      switch (val.type) {
 | 
			
		||||
        case 'edit':
 | 
			
		||||
          this.addOrEditTitle = '编辑'
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyType.init(val.data.id)
 | 
			
		||||
          })
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
        this.handleDelete(val.data)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    handleCancel() {
 | 
			
		||||
      this.$refs.energyType.formClear()
 | 
			
		||||
      this.centervisible = false
 | 
			
		||||
      this.addOrEditTitle = ''
 | 
			
		||||
    },
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.energyType.submitForm()
 | 
			
		||||
    },
 | 
			
		||||
    successSubmit() {
 | 
			
		||||
      this.handleCancel()
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() {
 | 
			
		||||
          return deleteEnergyType(row.id);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.getList();
 | 
			
		||||
          this.$modal.msgSuccess("删除成功");
 | 
			
		||||
        }).catch(() => {});
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyType',
 | 
			
		||||
	components: { EnergyTypeAdd },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'success',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('base:energy-type:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '编辑',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('base:energy-type:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(220),
 | 
			
		||||
			pricingMethodList: [
 | 
			
		||||
				{ value: 0, label: '分时间段计价' },
 | 
			
		||||
				{ value: 1, label: '分使用量计价' },
 | 
			
		||||
				{ value: 2, label: '单一计价' },
 | 
			
		||||
			],
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 弹出层标题
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 100,
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(220);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		buttonClick() {
 | 
			
		||||
			this.addOrEditTitle = '新增';
 | 
			
		||||
			this.centervisible = true;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.energyType.init();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyTypePage(this.queryParams).then((response) => {
 | 
			
		||||
				let arr = response.data.list || [];
 | 
			
		||||
				arr &&
 | 
			
		||||
					arr.map((item) => {
 | 
			
		||||
						this.pricingMethodList.map((i) => {
 | 
			
		||||
							if (item.pricingMethod === i.value) {
 | 
			
		||||
								item.pricingMethod = i.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(val) {
 | 
			
		||||
			switch (val.type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.addOrEditTitle = '编辑';
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyType.init(val.data.id);
 | 
			
		||||
					});
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.handleDelete(val.data);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.$refs.energyType.formClear();
 | 
			
		||||
			this.centervisible = false;
 | 
			
		||||
			this.addOrEditTitle = '';
 | 
			
		||||
		},
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.energyType.submitForm();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.handleCancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyType(row.id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,282 +1,360 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <el-form ref="form" :rules="rules" label-width="110px" :model="form">
 | 
			
		||||
    <el-row>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="抄表方式" prop="method">
 | 
			
		||||
          <el-select v-model="form.method" placeholder="请选择" style="width: 100%;" @change="changeMethod">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in getDictDatas(DICT_TYPE.METHOD)"
 | 
			
		||||
              :key="item.value"
 | 
			
		||||
              :label="item.label"
 | 
			
		||||
              :value="item.value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12" v-if='form.method == 1'>
 | 
			
		||||
        <el-form-item label="监控对象" prop="objectId">
 | 
			
		||||
          <el-cascader
 | 
			
		||||
            style='width: 100%;'
 | 
			
		||||
            v-model="objIds"
 | 
			
		||||
            :options="objList"
 | 
			
		||||
            :props="{ checkStrictly: true, value: 'id', label: 'name' }"
 | 
			
		||||
            popper-class="cascaderParent"
 | 
			
		||||
            @change="selectObj"
 | 
			
		||||
            clearable></el-cascader>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12" v-if='form.method == 2'>
 | 
			
		||||
        <el-form-item label="水/气表名" prop="tableName">
 | 
			
		||||
          <el-select v-model="form.tableName" placeholder="请选择" style="width: 100%;">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
 | 
			
		||||
              :key="item.value"
 | 
			
		||||
              :label="item.label"
 | 
			
		||||
              :value="item.value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="监控能源类型" prop="energyTypeId">
 | 
			
		||||
          <el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable @change="toggleType">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in this.energyTypeList"
 | 
			
		||||
              :key="item.id"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12" v-if='form.method == 1'>
 | 
			
		||||
        <el-form-item label="监控模式" prop="type">
 | 
			
		||||
          <el-select v-model="form.type" placeholder="请选择" style="width: 100%;" @change="typeChange">
 | 
			
		||||
            <el-option label="合并" :value= "1" ></el-option>
 | 
			
		||||
            <el-option label="详细" :value= "2" ></el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12" v-if='form.method == 1'>
 | 
			
		||||
        <el-form-item label="监控详细参数" prop="type" v-if="form.type === 2">
 | 
			
		||||
          <el-select v-model="form.plcParamId" placeholder="请选择" style="width: 100%;" @change="selectDetail">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in detailList"
 | 
			
		||||
              :key="item.id"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="指标类型" prop="limitType">
 | 
			
		||||
          <el-select v-model="form.limitType" placeholder="请选择" style="width: 100%;" :disabled='form.method == 2'>
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in getDictDatas(DICT_TYPE.MONITOR_INDEX_TYPE)"
 | 
			
		||||
              :key="item.value"
 | 
			
		||||
              :label="item.label"
 | 
			
		||||
              :value="item.value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="12">
 | 
			
		||||
        <el-form-item label="消耗量阈值">
 | 
			
		||||
          <el-input-number v-model="form.minValue" placeholder="最小值" :max="9999999" style="width: 50%;"></el-input-number>
 | 
			
		||||
          <el-input-number v-model="form.maxValue" placeholder="最大值" :max="9999999" style="width: 50%;"></el-input-number>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
  </el-form>
 | 
			
		||||
	<el-form
 | 
			
		||||
		ref="form"
 | 
			
		||||
		:rules="rules"
 | 
			
		||||
		label-width="110px"
 | 
			
		||||
		:model="form">
 | 
			
		||||
		<el-row>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="抄表方式"
 | 
			
		||||
					prop="method">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.method"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						@change="changeMethod">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in getDictDatas(DICT_TYPE.METHOD)"
 | 
			
		||||
							:key="item.value"
 | 
			
		||||
							:label="item.label"
 | 
			
		||||
							:value="item.value"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="12"
 | 
			
		||||
				v-if="form.method == 1">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="监控对象"
 | 
			
		||||
					prop="objectId">
 | 
			
		||||
					<el-cascader
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						v-model="objIds"
 | 
			
		||||
						:options="objList"
 | 
			
		||||
						:props="{ checkStrictly: true, value: 'id', label: 'name' }"
 | 
			
		||||
						popper-class="cascaderParent"
 | 
			
		||||
						@change="selectObj"
 | 
			
		||||
						clearable></el-cascader>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="12"
 | 
			
		||||
				v-if="form.method == 2">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="能源表名"
 | 
			
		||||
					prop="tableName">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.tableName"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
 | 
			
		||||
							:key="item.value"
 | 
			
		||||
							:label="item.label"
 | 
			
		||||
							:value="item.value"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="监控能源类型"
 | 
			
		||||
					prop="energyTypeId">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.energyTypeId"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						filterable
 | 
			
		||||
						@change="toggleType">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in this.energyTypeList"
 | 
			
		||||
							:key="item.id"
 | 
			
		||||
							:label="item.name"
 | 
			
		||||
							:value="item.id"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="12"
 | 
			
		||||
				v-if="form.method == 1">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="监控模式"
 | 
			
		||||
					prop="type">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.type"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						@change="typeChange">
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="合并"
 | 
			
		||||
							:value="1"></el-option>
 | 
			
		||||
						<el-option
 | 
			
		||||
							label="详细"
 | 
			
		||||
							:value="2"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col
 | 
			
		||||
				:span="12"
 | 
			
		||||
				v-if="form.method == 1">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="监控详细参数"
 | 
			
		||||
					prop="type"
 | 
			
		||||
					v-if="form.type === 2">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.plcParamId"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						@change="selectDetail">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in detailList"
 | 
			
		||||
							:key="item.id"
 | 
			
		||||
							:label="item.name"
 | 
			
		||||
							:value="item.id"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="指标类型"
 | 
			
		||||
					prop="limitType">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.limitType"
 | 
			
		||||
						placeholder="请选择"
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						:disabled="form.method == 2">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="item in getDictDatas(DICT_TYPE.MONITOR_INDEX_TYPE)"
 | 
			
		||||
							:key="item.value"
 | 
			
		||||
							:label="item.label"
 | 
			
		||||
							:value="item.value"></el-option>
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="消耗量阈值">
 | 
			
		||||
					<el-input-number
 | 
			
		||||
						v-model="form.minValue"
 | 
			
		||||
						placeholder="最小值"
 | 
			
		||||
						:max="9999999"
 | 
			
		||||
						style="width: 50%"></el-input-number>
 | 
			
		||||
					<el-input-number
 | 
			
		||||
						v-model="form.maxValue"
 | 
			
		||||
						placeholder="最大值"
 | 
			
		||||
						:max="9999999"
 | 
			
		||||
						style="width: 50%"></el-input-number>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyLimit, updateEnergyLimit, createEnergyLimit, getEnergyParamList } from '@/api/monitoring/energyLimit'
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyLimit,
 | 
			
		||||
	updateEnergyLimit,
 | 
			
		||||
	createEnergyLimit,
 | 
			
		||||
	getEnergyParamList,
 | 
			
		||||
} from '@/api/monitoring/energyLimit';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'energyLimitAdd',
 | 
			
		||||
  props: {
 | 
			
		||||
    energyTypeList: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    objList: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: () => []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      form: {
 | 
			
		||||
        id: '',
 | 
			
		||||
        method: '1',
 | 
			
		||||
        objectId: '',
 | 
			
		||||
        objectType: '',
 | 
			
		||||
        energyTypeId: '',
 | 
			
		||||
        type: '',
 | 
			
		||||
        plcParamId: '',
 | 
			
		||||
        limitType: '',
 | 
			
		||||
        minValue: 0,
 | 
			
		||||
        maxValue: 0
 | 
			
		||||
      },
 | 
			
		||||
      objIds: [],// 回显数组
 | 
			
		||||
      isEdit: false, //是否是编辑
 | 
			
		||||
      rules: {
 | 
			
		||||
        method: [{ required: true, message: '抄表方式不能为空', trigger: 'change' }],
 | 
			
		||||
        objectId: [{ required: true, message: '监控对象不能为空', trigger: 'change' }],
 | 
			
		||||
        energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
 | 
			
		||||
        type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }],
 | 
			
		||||
        limitType: [{ required: true, message: '指标类型不能为空', trigger: 'change' }]
 | 
			
		||||
      },
 | 
			
		||||
      detailList: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    init(id) {
 | 
			
		||||
      if (id) {
 | 
			
		||||
        this.isEdit = true
 | 
			
		||||
        this.form.id = id
 | 
			
		||||
        getEnergyLimit( id ).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.form = res.data
 | 
			
		||||
            this.form.plcParamId = res.data.plcParamId || ''
 | 
			
		||||
            this.form.method = this.form.method ? this.form.method + '' : ''
 | 
			
		||||
            this.form.limitType = this.form.limitType ? this.form.limitType + '' : ''
 | 
			
		||||
            this.objIds = this.changeDetSelect(this.form.objectId, this.objList)
 | 
			
		||||
            if (this.form.type === 2) {
 | 
			
		||||
              this.getDetailList()
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.isEdit = false
 | 
			
		||||
        this.form.id = ''
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 切换方式
 | 
			
		||||
    changeMethod() {
 | 
			
		||||
      if(this.form.method === '2'){
 | 
			
		||||
        this.form.limitType = "2"
 | 
			
		||||
      }else{
 | 
			
		||||
        this.form.limitType = ''
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 监控详细参数
 | 
			
		||||
    getDetailList() {
 | 
			
		||||
      getEnergyParamList({
 | 
			
		||||
        objId: this.form.objectId,
 | 
			
		||||
        energyTypeId: this.form.energyTypeId
 | 
			
		||||
      }).then((res) => {
 | 
			
		||||
        if (res.code === 0) {
 | 
			
		||||
          this.detailList = res.data
 | 
			
		||||
        } else {
 | 
			
		||||
          this.detailList = []
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    typeChange(val) {
 | 
			
		||||
      console.log(this.form)
 | 
			
		||||
      this.form.plcParamId = ''
 | 
			
		||||
      if (val === 2) {
 | 
			
		||||
        if (this.form.objectId && this.form.energyTypeId) {
 | 
			
		||||
          this.getDetailList()
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    toggleType() {
 | 
			
		||||
      if (this.form.energyTypeId && this.form.type) {
 | 
			
		||||
        this.getDetailList()
 | 
			
		||||
        this.form.plcParamId = ''
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 递归处理分类回显问题
 | 
			
		||||
    changeDetSelect(key, treeData) {
 | 
			
		||||
      let arr = [] // 递归时操作的数组
 | 
			
		||||
      let returnArr = [] // 存放结果的数组
 | 
			
		||||
      let depth = 0 // 定义全局层级
 | 
			
		||||
      // 定义递归函数
 | 
			
		||||
      function childrenEach(childrendData, depthN) {
 | 
			
		||||
        for (var j = 0; j < childrendData.length; j++) {
 | 
			
		||||
          depth = depthN
 | 
			
		||||
          arr[depthN] = childrendData[j].id
 | 
			
		||||
          if (childrendData[j].id == key) {
 | 
			
		||||
            returnArr = arr.slice(0, depthN + 1)
 | 
			
		||||
            break
 | 
			
		||||
          } else {
 | 
			
		||||
            if (childrendData[j].children) {
 | 
			
		||||
              depth++
 | 
			
		||||
              childrenEach(childrendData[j].children, depth)
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return returnArr
 | 
			
		||||
      }
 | 
			
		||||
      return childrenEach(treeData, depth)
 | 
			
		||||
    },
 | 
			
		||||
    selectObj(val) {
 | 
			
		||||
      this.form.objectId = val[val.length-1]
 | 
			
		||||
      this.form.objectType = val.length-1
 | 
			
		||||
      if (this.form.energyTypeId && this.form.type) {
 | 
			
		||||
        this.getDetailList()
 | 
			
		||||
        this.form.plcParamId = ''
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    selectDetail() {
 | 
			
		||||
      this.$forceUpdate()
 | 
			
		||||
    },
 | 
			
		||||
    submitForm() {
 | 
			
		||||
      this.$refs['form'].validate((valid) => {
 | 
			
		||||
        if (valid) {
 | 
			
		||||
          if (this.form.type === 2 && !this.form.plcParamId) {
 | 
			
		||||
            this.$modal.msgError("监控模式为详细时,详细参数为必填");
 | 
			
		||||
            return false
 | 
			
		||||
          }
 | 
			
		||||
          if (this.form.minValue && this.form.maxValue) {
 | 
			
		||||
            if (this.form.minValue > this.form.maxValue) {
 | 
			
		||||
              this.$modal.msgError("消耗量阈值,最小值不能大于最大值");
 | 
			
		||||
              return false
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          this.form.minValue = this.form.minValue || 0
 | 
			
		||||
          this.form.maxValue = this.form.maxValue || 0
 | 
			
		||||
          if (this.isEdit) {
 | 
			
		||||
            // 编辑
 | 
			
		||||
            updateEnergyLimit({...this.form}).then((res) => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                this.$modal.msgSuccess("操作成功");
 | 
			
		||||
                this.$emit('successSubmit')
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          } else {
 | 
			
		||||
            createEnergyLimit({...this.form}).then((res) => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                this.$modal.msgSuccess("操作成功");
 | 
			
		||||
                this.$emit('successSubmit')
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    formClear() {
 | 
			
		||||
      this.$refs.form.resetFields()
 | 
			
		||||
      this.form.type = ''
 | 
			
		||||
      this.form.plcParamId = ''
 | 
			
		||||
      this.form.minValue = null
 | 
			
		||||
      this.form.maxValue = null
 | 
			
		||||
      this.objIds = ''
 | 
			
		||||
      this.detailList = []
 | 
			
		||||
      this.isEdit = false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
	name: 'energyLimitAdd',
 | 
			
		||||
	props: {
 | 
			
		||||
		energyTypeList: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			required: true,
 | 
			
		||||
			default: () => {
 | 
			
		||||
				return [];
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		objList: {
 | 
			
		||||
			type: Array,
 | 
			
		||||
			default: () => [],
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			form: {
 | 
			
		||||
				id: '',
 | 
			
		||||
				method: '1',
 | 
			
		||||
				objectId: '',
 | 
			
		||||
				objectType: '',
 | 
			
		||||
				energyTypeId: '',
 | 
			
		||||
				type: '',
 | 
			
		||||
				plcParamId: '',
 | 
			
		||||
				limitType: '',
 | 
			
		||||
				minValue: 0,
 | 
			
		||||
				maxValue: 0,
 | 
			
		||||
			},
 | 
			
		||||
			objIds: [], // 回显数组
 | 
			
		||||
			isEdit: false, //是否是编辑
 | 
			
		||||
			rules: {
 | 
			
		||||
				method: [
 | 
			
		||||
					{ required: true, message: '抄表方式不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				objectId: [
 | 
			
		||||
					{ required: true, message: '监控对象不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				energyTypeId: [
 | 
			
		||||
					{ required: true, message: '能源类型不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				type: [
 | 
			
		||||
					{ required: true, message: '监控模式不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				limitType: [
 | 
			
		||||
					{ required: true, message: '指标类型不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
			},
 | 
			
		||||
			detailList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(id) {
 | 
			
		||||
			if (id) {
 | 
			
		||||
				this.isEdit = true;
 | 
			
		||||
				this.form.id = id;
 | 
			
		||||
				getEnergyLimit(id).then((res) => {
 | 
			
		||||
					if (res.code === 0) {
 | 
			
		||||
						this.form = res.data;
 | 
			
		||||
						this.form.plcParamId = res.data.plcParamId || '';
 | 
			
		||||
						this.form.method = this.form.method ? this.form.method + '' : '';
 | 
			
		||||
						this.form.limitType = this.form.limitType
 | 
			
		||||
							? this.form.limitType + ''
 | 
			
		||||
							: '';
 | 
			
		||||
						this.objIds = this.changeDetSelect(
 | 
			
		||||
							this.form.objectId,
 | 
			
		||||
							this.objList
 | 
			
		||||
						);
 | 
			
		||||
						if (this.form.type === 2) {
 | 
			
		||||
							this.getDetailList();
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			} else {
 | 
			
		||||
				this.isEdit = false;
 | 
			
		||||
				this.form.id = '';
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 切换方式
 | 
			
		||||
		changeMethod() {
 | 
			
		||||
			if (this.form.method === '2') {
 | 
			
		||||
				this.form.limitType = '2';
 | 
			
		||||
			} else {
 | 
			
		||||
				this.form.limitType = '';
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 监控详细参数
 | 
			
		||||
		getDetailList() {
 | 
			
		||||
			getEnergyParamList({
 | 
			
		||||
				objId: this.form.objectId,
 | 
			
		||||
				energyTypeId: this.form.energyTypeId,
 | 
			
		||||
			}).then((res) => {
 | 
			
		||||
				if (res.code === 0) {
 | 
			
		||||
					this.detailList = res.data;
 | 
			
		||||
				} else {
 | 
			
		||||
					this.detailList = [];
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		typeChange(val) {
 | 
			
		||||
			console.log(this.form);
 | 
			
		||||
			this.form.plcParamId = '';
 | 
			
		||||
			if (val === 2) {
 | 
			
		||||
				if (this.form.objectId && this.form.energyTypeId) {
 | 
			
		||||
					this.getDetailList();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		toggleType() {
 | 
			
		||||
			if (this.form.energyTypeId && this.form.type) {
 | 
			
		||||
				this.getDetailList();
 | 
			
		||||
				this.form.plcParamId = '';
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		// 递归处理分类回显问题
 | 
			
		||||
		changeDetSelect(key, treeData) {
 | 
			
		||||
			let arr = []; // 递归时操作的数组
 | 
			
		||||
			let returnArr = []; // 存放结果的数组
 | 
			
		||||
			let depth = 0; // 定义全局层级
 | 
			
		||||
			// 定义递归函数
 | 
			
		||||
			function childrenEach(childrendData, depthN) {
 | 
			
		||||
				for (var j = 0; j < childrendData.length; j++) {
 | 
			
		||||
					depth = depthN;
 | 
			
		||||
					arr[depthN] = childrendData[j].id;
 | 
			
		||||
					if (childrendData[j].id == key) {
 | 
			
		||||
						returnArr = arr.slice(0, depthN + 1);
 | 
			
		||||
						break;
 | 
			
		||||
					} else {
 | 
			
		||||
						if (childrendData[j].children) {
 | 
			
		||||
							depth++;
 | 
			
		||||
							childrenEach(childrendData[j].children, depth);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				return returnArr;
 | 
			
		||||
			}
 | 
			
		||||
			return childrenEach(treeData, depth);
 | 
			
		||||
		},
 | 
			
		||||
		selectObj(val) {
 | 
			
		||||
			this.form.objectId = val[val.length - 1];
 | 
			
		||||
			this.form.objectType = val.length - 1;
 | 
			
		||||
			if (this.form.energyTypeId && this.form.type) {
 | 
			
		||||
				this.getDetailList();
 | 
			
		||||
				this.form.plcParamId = '';
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		selectDetail() {
 | 
			
		||||
			this.$forceUpdate();
 | 
			
		||||
		},
 | 
			
		||||
		submitForm() {
 | 
			
		||||
			this.$refs['form'].validate((valid) => {
 | 
			
		||||
				if (valid) {
 | 
			
		||||
					if (this.form.type === 2 && !this.form.plcParamId) {
 | 
			
		||||
						this.$modal.msgError('监控模式为详细时,详细参数为必填');
 | 
			
		||||
						return false;
 | 
			
		||||
					}
 | 
			
		||||
					if (this.form.minValue && this.form.maxValue) {
 | 
			
		||||
						if (this.form.minValue > this.form.maxValue) {
 | 
			
		||||
							this.$modal.msgError('消耗量阈值,最小值不能大于最大值');
 | 
			
		||||
							return false;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					this.form.minValue = this.form.minValue || 0;
 | 
			
		||||
					this.form.maxValue = this.form.maxValue || 0;
 | 
			
		||||
					if (this.isEdit) {
 | 
			
		||||
						// 编辑
 | 
			
		||||
						updateEnergyLimit({ ...this.form }).then((res) => {
 | 
			
		||||
							if (res.code === 0) {
 | 
			
		||||
								this.$modal.msgSuccess('操作成功');
 | 
			
		||||
								this.$emit('successSubmit');
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					} else {
 | 
			
		||||
						createEnergyLimit({ ...this.form }).then((res) => {
 | 
			
		||||
							if (res.code === 0) {
 | 
			
		||||
								this.$modal.msgSuccess('操作成功');
 | 
			
		||||
								this.$emit('successSubmit');
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		formClear() {
 | 
			
		||||
			this.$refs.form.resetFields();
 | 
			
		||||
			this.form.type = '';
 | 
			
		||||
			this.form.plcParamId = '';
 | 
			
		||||
			this.form.minValue = null;
 | 
			
		||||
			this.form.maxValue = null;
 | 
			
		||||
			this.objIds = '';
 | 
			
		||||
			this.detailList = [];
 | 
			
		||||
			this.isEdit = false;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style>
 | 
			
		||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
 | 
			
		||||
  display: none;
 | 
			
		||||
	display: none;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,269 +1,278 @@
 | 
			
		||||
<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"
 | 
			
		||||
      width='50%'
 | 
			
		||||
    >
 | 
			
		||||
      <energy-limit-add ref="energyLimit" @successSubmit="successSubmit" :energyTypeList="energyTypeList" :objList="objList"/>
 | 
			
		||||
    </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"
 | 
			
		||||
			width="50%">
 | 
			
		||||
			<energy-limit-add
 | 
			
		||||
				ref="energyLimit"
 | 
			
		||||
				@successSubmit="successSubmit"
 | 
			
		||||
				:energyTypeList="energyTypeList"
 | 
			
		||||
				:objList="objList" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getEnergyLimitPage, deleteEnergyLimit } from "@/api/monitoring/energyLimit";
 | 
			
		||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
 | 
			
		||||
import { getTree } from '@/api/base/factory'
 | 
			
		||||
import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import EnergyLimitAdd from './components/energyLimitAdd'
 | 
			
		||||
import {
 | 
			
		||||
	getEnergyLimitPage,
 | 
			
		||||
	deleteEnergyLimit,
 | 
			
		||||
} from '@/api/monitoring/energyLimit';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import { getTree } from '@/api/base/factory';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import EnergyLimitAdd from './components/energyLimitAdd';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'method',
 | 
			
		||||
    label: '抄表方式',
 | 
			
		||||
    filter: publicFormatter('method')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '监控对象'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'tableName',
 | 
			
		||||
    label: '水/气表名',
 | 
			
		||||
    filter: publicFormatter('table_name')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'energyType',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'type',
 | 
			
		||||
    label: '监控模式',
 | 
			
		||||
    filter: (val) => (val != null ? ['合并', '详细'][val-1] : '-'),
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'plcParamName',
 | 
			
		||||
    label: '监控参数'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'limitType',
 | 
			
		||||
    label: '指标类型',
 | 
			
		||||
    filter: publicFormatter('monitor_index_type')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'limitValue',
 | 
			
		||||
    label: '阈值'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'method',
 | 
			
		||||
		label: '抄表方式',
 | 
			
		||||
		filter: publicFormatter('method'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objName',
 | 
			
		||||
		label: '监控对象',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'objCode',
 | 
			
		||||
		label: '对象编码',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'tableName',
 | 
			
		||||
		label: '能源表名',
 | 
			
		||||
		filter: publicFormatter('table_name'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
		filter: publicFormatter('energy_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'type',
 | 
			
		||||
		label: '监控模式',
 | 
			
		||||
		filter: (val) => (val != null ? ['合并', '详细'][val - 1] : '-'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'plcParamName',
 | 
			
		||||
		label: '监控参数',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'limitType',
 | 
			
		||||
		label: '指标类型',
 | 
			
		||||
		filter: publicFormatter('monitor_index_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'limitValue',
 | 
			
		||||
		label: '阈值',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyLimit",
 | 
			
		||||
  components: { EnergyLimitAdd },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '能源类型',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'energyTypeId'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '指标类型',
 | 
			
		||||
          selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
 | 
			
		||||
          labelField: 'label',
 | 
			
		||||
          valueField: 'value',
 | 
			
		||||
          param: 'limitType'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '查询',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separate'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: this.$auth.hasPermi('monitoring:energy-limit:create') ? 'button' : '',
 | 
			
		||||
          btnName: '新增',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'success',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableBtn: [
 | 
			
		||||
        this.$auth.hasPermi('monitoring:energy-limit:update')
 | 
			
		||||
          ? {
 | 
			
		||||
              type: 'edit',
 | 
			
		||||
              btnName: '编辑'
 | 
			
		||||
            }
 | 
			
		||||
          : undefined,
 | 
			
		||||
        this.$auth.hasPermi('monitoring:energy-limit:delete')
 | 
			
		||||
          ? {
 | 
			
		||||
              type: 'delete',
 | 
			
		||||
              btnName: '删除'
 | 
			
		||||
            }
 | 
			
		||||
          : undefined
 | 
			
		||||
      ].filter((v) => v),
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      addOrEditTitle: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      centervisible: false,
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        energyTypeId: null,
 | 
			
		||||
        limitType: null
 | 
			
		||||
      },
 | 
			
		||||
      energyTypeList: [],
 | 
			
		||||
      typeList: [
 | 
			
		||||
        {label: '合并', value: '1'},
 | 
			
		||||
        {label: '详细', value: '2'}
 | 
			
		||||
      ],
 | 
			
		||||
      objList: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
    this.getList();
 | 
			
		||||
    this.getTypeList()
 | 
			
		||||
    // 获取对象树形结构
 | 
			
		||||
    this.getObjTree()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getTypeList() {
 | 
			
		||||
      getEnergyTypeListAll().then((res) => {
 | 
			
		||||
        this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
        this.energyTypeList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.queryParams.energyTypeId = val.energyTypeId
 | 
			
		||||
          this.queryParams.limitType = val.limitType
 | 
			
		||||
          this.getList()
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
          this.addOrEditTitle = '新增'
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyLimit.init()
 | 
			
		||||
          })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      getEnergyLimitPage(this.queryParams).then(response => {
 | 
			
		||||
        let arr = response.data.list || [];
 | 
			
		||||
        arr&&arr.map(item => {
 | 
			
		||||
          this.typeList.map(i => {
 | 
			
		||||
            if (item.type === i.value) {
 | 
			
		||||
              item.type = i.label
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          if (item.minValue && item.maxValue) {
 | 
			
		||||
            item.limitValue = item.minValue + '-' + item.maxValue
 | 
			
		||||
          } else if(item.minValue){
 | 
			
		||||
            item.limitValue = '最小值' + item.minValue
 | 
			
		||||
          }else if(item.maxValue){
 | 
			
		||||
            item.limitValue = '最大值' + item.maxValue
 | 
			
		||||
          } else {
 | 
			
		||||
            item.limitValue = ''
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        this.list = arr
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      switch (val.type) {
 | 
			
		||||
        case 'edit':
 | 
			
		||||
          this.addOrEditTitle = '编辑'
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.$refs.energyLimit.init(val.data.id)
 | 
			
		||||
          })
 | 
			
		||||
          this.centervisible = true
 | 
			
		||||
          break
 | 
			
		||||
        default:
 | 
			
		||||
        this.handleDelete(val.data)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    handleCancel() {
 | 
			
		||||
      this.$refs.energyLimit.formClear()
 | 
			
		||||
      this.centervisible = false
 | 
			
		||||
      this.addOrEditTitle = ''
 | 
			
		||||
    },
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.energyLimit.submitForm()
 | 
			
		||||
    },
 | 
			
		||||
    successSubmit() {
 | 
			
		||||
      this.handleCancel()
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      this.$modal.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?').then(function() {
 | 
			
		||||
          return deleteEnergyLimit(row.id);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.queryParams.pageNo = 1;
 | 
			
		||||
          this.getList();
 | 
			
		||||
          this.$modal.msgSuccess("删除成功");
 | 
			
		||||
        }).catch(() => {});
 | 
			
		||||
    },
 | 
			
		||||
    getObjTree() {
 | 
			
		||||
      getTree().then(res => {
 | 
			
		||||
        this.objList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyLimit',
 | 
			
		||||
	components: { EnergyLimitAdd },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '能源类型',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'energyTypeId',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '指标类型',
 | 
			
		||||
					selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
 | 
			
		||||
					labelField: 'label',
 | 
			
		||||
					valueField: 'value',
 | 
			
		||||
					param: 'limitType',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('monitoring:energy-limit:create')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'success',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('monitoring:energy-limit:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '编辑',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('monitoring:energy-limit:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 弹出层标题
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			centervisible: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				energyTypeId: null,
 | 
			
		||||
				limitType: null,
 | 
			
		||||
			},
 | 
			
		||||
			energyTypeList: [],
 | 
			
		||||
			typeList: [
 | 
			
		||||
				{ label: '合并', value: '1' },
 | 
			
		||||
				{ label: '详细', value: '2' },
 | 
			
		||||
			],
 | 
			
		||||
			objList: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
		});
 | 
			
		||||
		this.getList();
 | 
			
		||||
		this.getTypeList();
 | 
			
		||||
		// 获取对象树形结构
 | 
			
		||||
		this.getObjTree();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getTypeList() {
 | 
			
		||||
			getEnergyTypeListAll().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || [];
 | 
			
		||||
				this.energyTypeList = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.queryParams.energyTypeId = val.energyTypeId;
 | 
			
		||||
					this.queryParams.limitType = val.limitType;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.addOrEditTitle = '新增';
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyLimit.init();
 | 
			
		||||
					});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			getEnergyLimitPage(this.queryParams).then((response) => {
 | 
			
		||||
				let arr = response.data.list || [];
 | 
			
		||||
				arr &&
 | 
			
		||||
					arr.map((item) => {
 | 
			
		||||
						this.typeList.map((i) => {
 | 
			
		||||
							if (item.type === i.value) {
 | 
			
		||||
								item.type = i.label;
 | 
			
		||||
							}
 | 
			
		||||
						});
 | 
			
		||||
						if (item.minValue && item.maxValue) {
 | 
			
		||||
							item.limitValue = item.minValue + '-' + item.maxValue;
 | 
			
		||||
						} else if (item.minValue) {
 | 
			
		||||
							item.limitValue = '最小值' + item.minValue;
 | 
			
		||||
						} else if (item.maxValue) {
 | 
			
		||||
							item.limitValue = '最大值' + item.maxValue;
 | 
			
		||||
						} else {
 | 
			
		||||
							item.limitValue = '';
 | 
			
		||||
						}
 | 
			
		||||
					});
 | 
			
		||||
				this.list = arr;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(val) {
 | 
			
		||||
			switch (val.type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.addOrEditTitle = '编辑';
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.$refs.energyLimit.init(val.data.id);
 | 
			
		||||
					});
 | 
			
		||||
					this.centervisible = true;
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.handleDelete(val.data);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.$refs.energyLimit.formClear();
 | 
			
		||||
			this.centervisible = false;
 | 
			
		||||
			this.addOrEditTitle = '';
 | 
			
		||||
		},
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.energyLimit.submitForm();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.handleCancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEnergyLimit(row.id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		getObjTree() {
 | 
			
		||||
			getTree().then((res) => {
 | 
			
		||||
				this.objList = res.data || [];
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,185 +1,196 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container" id='energyReportBox'>
 | 
			
		||||
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <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="energyReportBox">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<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 { energyReportPageAuto, energyReportPageExportAuto } from "@/api/monitoring/energyReport"
 | 
			
		||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
 | 
			
		||||
import { publicFormatter } from '@/utils/dict'
 | 
			
		||||
import { parseTime } from '@/utils/ruoyi'
 | 
			
		||||
import {
 | 
			
		||||
	energyReportPageAuto,
 | 
			
		||||
	energyReportPageExportAuto,
 | 
			
		||||
} from '@/api/monitoring/energyReport';
 | 
			
		||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import { parseTime } from '@/utils/ruoyi';
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'statisticType',
 | 
			
		||||
    label: '统计类型',
 | 
			
		||||
    filter: publicFormatter('statistic_type')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startTime',
 | 
			
		||||
    label: '开始时间',
 | 
			
		||||
    filter: parseTime,
 | 
			
		||||
    minWidth: 160
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endTime',
 | 
			
		||||
    label: '结束时间',
 | 
			
		||||
    filter: parseTime,
 | 
			
		||||
    minWidth: 160
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'statisticName',
 | 
			
		||||
    label: '统计方案'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'energyType',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startNum',
 | 
			
		||||
    label: '抄表数(起始)'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'endNum',
 | 
			
		||||
    label: '抄表数(结束)'
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'useNum',
 | 
			
		||||
    label: '消耗量'
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'statisticType',
 | 
			
		||||
		label: '统计类型',
 | 
			
		||||
		filter: publicFormatter('statistic_type'),
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startTime',
 | 
			
		||||
		label: '开始时间',
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		minWidth: 160,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endTime',
 | 
			
		||||
		label: '结束时间',
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		minWidth: 160,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'statisticName',
 | 
			
		||||
		label: '统计方案',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'energyType',
 | 
			
		||||
		label: '能源类型',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'startNum',
 | 
			
		||||
		label: '抄表数(起始)',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'endNum',
 | 
			
		||||
		label: '抄表数(结束)',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'useNum',
 | 
			
		||||
		label: '消耗量',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
export default {
 | 
			
		||||
  name: "EnergyLimit",
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      isFold: false,
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '能源类型',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'energyTypeId',
 | 
			
		||||
          filterable: true
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '统计类型',
 | 
			
		||||
          selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
 | 
			
		||||
          labelField: 'label',
 | 
			
		||||
          valueField: 'value',
 | 
			
		||||
          param: 'statisticType'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          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('monitoring:energy-report:export') ? 'button' : '',
 | 
			
		||||
          btnName: '导出',
 | 
			
		||||
          name: 'add',
 | 
			
		||||
          color: 'primary',
 | 
			
		||||
          plain: true
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      tableProps,
 | 
			
		||||
      tableH: this.tableHeight(260),
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 班次基础信息列表
 | 
			
		||||
      list: [],
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        energyTypeId: null,
 | 
			
		||||
        statisticType: null,
 | 
			
		||||
        startTime: null,
 | 
			
		||||
        endTime: null
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
      this.isFold = this.searchBarWidth('energyReportBox', 1198)
 | 
			
		||||
    })
 | 
			
		||||
    this.getList()
 | 
			
		||||
    this.getTypeList()
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.isFold = this.searchBarWidth('energyReportBox', 1198)
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getTypeList() {
 | 
			
		||||
      getEnergyTypeListAll().then((res) => {
 | 
			
		||||
        this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
        // this.energyTypeList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.queryParams.pageNo = 1
 | 
			
		||||
          this.queryParams.energyTypeId = val.energyTypeId
 | 
			
		||||
          this.queryParams.statisticType = val.statisticType
 | 
			
		||||
          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 energyReportPageExportAuto({...this.queryParams});
 | 
			
		||||
            }).then(response => {
 | 
			
		||||
              this.$download.excel(response, '能源统计报表.xls');
 | 
			
		||||
            }).catch(() => {})
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      energyReportPageAuto(this.queryParams).then(response => {
 | 
			
		||||
        this.list = response.data.list || [];
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	name: 'EnergyLimit',
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			isFold: false,
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '能源类型',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'energyTypeId',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '统计类型',
 | 
			
		||||
					selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
 | 
			
		||||
					labelField: 'label',
 | 
			
		||||
					valueField: 'value',
 | 
			
		||||
					param: 'statisticType',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					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('monitoring:energy-report:export')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '导出',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
					plain: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			// 总条数
 | 
			
		||||
			total: 0,
 | 
			
		||||
			// 班次基础信息列表
 | 
			
		||||
			list: [],
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				energyTypeId: null,
 | 
			
		||||
				statisticType: null,
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				endTime: null,
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', this._eventListeners);
 | 
			
		||||
		this.getList();
 | 
			
		||||
		this.getTypeList();
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.isFold = this.searchBarWidth('energyReportBox', 1198);
 | 
			
		||||
	},
 | 
			
		||||
	destroyed() {
 | 
			
		||||
		window.removeEventListener('resize', this._eventListeners);
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		_eventListeners() {
 | 
			
		||||
			this.tableH = this.tableHeight(260);
 | 
			
		||||
			this.isFold = this.searchBarWidth('energyReportBox', 1198);
 | 
			
		||||
		},
 | 
			
		||||
		getTypeList() {
 | 
			
		||||
			getEnergyTypeListAll().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || [];
 | 
			
		||||
				// this.energyTypeList = res.data || []
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.queryParams.pageNo = 1;
 | 
			
		||||
					this.queryParams.energyTypeId = val.energyTypeId;
 | 
			
		||||
					this.queryParams.statisticType = val.statisticType;
 | 
			
		||||
					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 energyReportPageExportAuto({ ...this.queryParams });
 | 
			
		||||
						})
 | 
			
		||||
						.then((response) => {
 | 
			
		||||
							this.$download.excel(response, '能源统计报表.xls');
 | 
			
		||||
						})
 | 
			
		||||
						.catch(() => {});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			energyReportPageAuto(this.queryParams).then((response) => {
 | 
			
		||||
				this.list = response.data.list || [];
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -33,6 +34,7 @@ import {
 | 
			
		||||
	getEqAnalysis,
 | 
			
		||||
	exportEqAnalysisExcel,
 | 
			
		||||
} from '@/api/equipment/analysis/statistics';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	// {
 | 
			
		||||
@@ -52,35 +54,49 @@ const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'lineName',
 | 
			
		||||
		label: '产线',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'sectionName',
 | 
			
		||||
		label: '工段',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'equipmentName',
 | 
			
		||||
		label: '设备名称',
 | 
			
		||||
		minWidth: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'equipmentType',
 | 
			
		||||
		label: '设备类型',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'workTime',
 | 
			
		||||
		label: '工作时间累积(h)',
 | 
			
		||||
		width: 160,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'repairCount',
 | 
			
		||||
		label: '维修次数',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'maintainCount',
 | 
			
		||||
		label: '保养次数',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		const today = new Date();
 | 
			
		||||
 | 
			
		||||
@@ -110,7 +126,7 @@ export default {
 | 
			
		||||
			tableBtn: [].filter((v) => v),
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			listQuery: {
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				total: 1,
 | 
			
		||||
				recordTime: [
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,12 @@ export default {
 | 
			
		||||
				},
 | 
			
		||||
				tooltip: {
 | 
			
		||||
					trigger: 'item',
 | 
			
		||||
					formatter: (v) => {
 | 
			
		||||
						const num = String(v.value)?.split('.').length === 2 ? v.value?.toFixed(2) : v.value
 | 
			
		||||
						return `<div>
 | 
			
		||||
						<span>${v.name}: ${num}</span>
 | 
			
		||||
						</div>`
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
				legend: {
 | 
			
		||||
					show: false,
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			max-height="600"
 | 
			
		||||
			:max-height="tableH"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			<!-- <method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
@@ -42,14 +42,16 @@
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'ExceptionAnalysis',
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			heightNum: 220,
 | 
			
		||||
			searchBarKeys: ['name', 'code'],
 | 
			
		||||
			// tableBtn: [
 | 
			
		||||
			// 	this.$auth.hasPermi('base:equipment-group:update')
 | 
			
		||||
 
 | 
			
		||||
@@ -48,9 +48,11 @@
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import LineChart from './components/lineChart.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'QualityAnalysis',
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	components: { LineChart },
 | 
			
		||||
	props: {},
 | 
			
		||||
	data() {
 | 
			
		||||
@@ -58,7 +60,6 @@ export default {
 | 
			
		||||
		const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()];
 | 
			
		||||
		return {
 | 
			
		||||
			dialogVisible: false,
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
			urls: {
 | 
			
		||||
				page: '/analysis/equipment-analysis/quality',
 | 
			
		||||
			},
 | 
			
		||||
@@ -254,9 +255,9 @@ export default {
 | 
			
		||||
		this.fillProductOptions();
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
		// window.addEventListener('resize', () => {
 | 
			
		||||
    //   this.tableH = this.tableHeight(260)
 | 
			
		||||
    // })
 | 
			
		||||
		this.$refs['search-bar'].headBtnClick('search');
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -61,6 +62,8 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import AddOrUpdate from './AddOrUpdate.vue';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
 | 
			
		||||
 | 
			
		||||
const btn = {
 | 
			
		||||
@@ -89,7 +92,7 @@ const btn = {
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'Record',
 | 
			
		||||
	components: { AddOrUpdate },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			readOnly: false,
 | 
			
		||||
@@ -116,17 +119,17 @@ export default {
 | 
			
		||||
				// 	: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableProps: [
 | 
			
		||||
				{ prop: 'productionLine', label: '产线' },
 | 
			
		||||
				{ prop: 'workshopSection', label: '工段' },
 | 
			
		||||
				{ prop: 'equipment', label: '设备名称' },
 | 
			
		||||
				{ prop: 'productionLine', label: '产线', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'workshopSection', label: '工段', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'equipment', label: '设备名称', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'alarmGrade',
 | 
			
		||||
					label: '报警级别',
 | 
			
		||||
					filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'createTime', label: '报警时间', filter: timeFilter },
 | 
			
		||||
				{ prop: 'alarmCode', label: '设备报警码' },
 | 
			
		||||
				{ prop: 'alarmContent', label: '报警内容' },
 | 
			
		||||
				{ prop: 'createTime', label: '报警时间', filter: timeFilter, width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'alarmCode', label: '设备报警码', width: 180, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'alarmContent', label: '报警内容', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn },
 | 
			
		||||
				{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn },
 | 
			
		||||
				// { prop: 'remark', label: '备注' },
 | 
			
		||||
@@ -203,7 +206,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				lineId: null,
 | 
			
		||||
				equipmentId: null,
 | 
			
		||||
				recordTime: [],
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -70,7 +71,7 @@
 | 
			
		||||
					queryParams: {
 | 
			
		||||
						equipmentGroupId: alarmForm.id,
 | 
			
		||||
						pageNo: 1,
 | 
			
		||||
						pageSize: 10,
 | 
			
		||||
						pageSize: 20,
 | 
			
		||||
					},
 | 
			
		||||
					tableBtn: [
 | 
			
		||||
						this.$auth.hasPermi('equipment:alarm-group:update')
 | 
			
		||||
@@ -109,10 +110,11 @@ import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
// import { getAccessToken } from '@/utils/auth';
 | 
			
		||||
import BasicDrawer from './components/BasicDrawer.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentGroup',
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	components: { BasicDrawer },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -72,7 +73,7 @@
 | 
			
		||||
					queryParams: {
 | 
			
		||||
						equipmentGroupId: alarmForm.id,
 | 
			
		||||
						pageNo: 1,
 | 
			
		||||
						pageSize: 10,
 | 
			
		||||
						pageSize: 20,
 | 
			
		||||
					},
 | 
			
		||||
					tableBtn: [
 | 
			
		||||
						this.$auth.hasPermi('base:equipment-group:update')
 | 
			
		||||
@@ -112,11 +113,12 @@ import moment from 'moment';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import BasicDrawer from './components/BasicDrawer.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentBindGroup',
 | 
			
		||||
	components: { BasicDrawer },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: ['groupId', 'equipmentName'],
 | 
			
		||||
@@ -254,7 +256,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				equipmentName: null,
 | 
			
		||||
				groupId: null,
 | 
			
		||||
			},
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -127,10 +128,11 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import BasicDrawer from './components/BasicDrawer.vue';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import AddOrUpdate from './add-or-updata';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentPlcConnect',
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	components: { BasicDrawer, AddOrUpdate },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
@@ -156,14 +158,14 @@ export default {
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableProps: [
 | 
			
		||||
				{ prop: 'productionLine', label: '产线' },
 | 
			
		||||
				{ prop: 'workshopSection', label: '工段' },
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备名' },
 | 
			
		||||
				{ prop: 'equipmentCode', label: '设备编码' },
 | 
			
		||||
				{ prop: 'plcCode', label: '关联表编码' },
 | 
			
		||||
				{ prop: 'plcTableName', label: '关联表名' },
 | 
			
		||||
				{ prop: 'plcName', label: '标识名称' },
 | 
			
		||||
				{ prop: 'bindingParameters', label: '绑定参数数量' },
 | 
			
		||||
				{ prop: 'productionLine', label: '产线', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'workshopSection', label: '工段', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备名', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'equipmentCode', label: '设备编码', width: 200, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'plcCode', label: '关联表编码', width: 220, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'plcTableName', label: '关联表名', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'plcName', label: '标识名称', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'bindingParameters', label: '绑定参数数量', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				// {
 | 
			
		||||
				// 	_action: 'params-bind',
 | 
			
		||||
				// 	label: '查看绑定',
 | 
			
		||||
@@ -269,7 +271,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				plcId: null,
 | 
			
		||||
				equipmentId: null,
 | 
			
		||||
			},
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,8 @@
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			ref="pageTable"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -60,6 +61,7 @@ import {
 | 
			
		||||
	exportEquipmentPlcExcel,
 | 
			
		||||
} from '@/api/base/equipmentPlc';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const switchBtn = {
 | 
			
		||||
	name: 'SwitchBtn',
 | 
			
		||||
@@ -99,7 +101,7 @@ const switchBtn = {
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentPlc',
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	components: {},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
@@ -127,16 +129,16 @@ export default {
 | 
			
		||||
				// 	width: 180,
 | 
			
		||||
				// 	filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
			
		||||
				// },
 | 
			
		||||
				{ prop: 'code', label: '编码' },
 | 
			
		||||
				{ prop: 'plcTableName', label: '关联表名' },
 | 
			
		||||
				{ prop: 'name', label: '标识名称' },
 | 
			
		||||
				{ prop: 'enName', label: '英文名称' },
 | 
			
		||||
				{ prop: 'code', label: '编码', width: 180, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'plcTableName', label: '关联表名', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'name', label: '标识名称', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'enName', label: '英文名称', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'collection',
 | 
			
		||||
					label: '是否采集',
 | 
			
		||||
					subcomponent: switchBtn,
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'description', label: '描述' },
 | 
			
		||||
				{ prop: 'description', label: '描述', minWidth: 150, showOverflowtooltip: true },
 | 
			
		||||
			],
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
@@ -240,7 +242,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				plcTableName: null,
 | 
			
		||||
				name: null,
 | 
			
		||||
			},
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@
 | 
			
		||||
			background: '#f2f4f9',
 | 
			
		||||
			color: '#606266',
 | 
			
		||||
		}"
 | 
			
		||||
		:max-height="tableH"
 | 
			
		||||
		class="waiting-list-table">
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			type="selection"
 | 
			
		||||
@@ -37,8 +38,9 @@
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			v-if="selectedBox[0]"
 | 
			
		||||
			label="巡检单名称"
 | 
			
		||||
			:show-overflow-tooltip="true"
 | 
			
		||||
			prop="name"></el-table-column>
 | 
			
		||||
		<el-table-column v-if="selectedBox[1]" label="部门" prop="planName">
 | 
			
		||||
		<el-table-column v-if="selectedBox[1]" label="部门" :show-overflow-tooltip="true" prop="planName">
 | 
			
		||||
			<template slot-scope="scope">
 | 
			
		||||
				{{ scope.row.department || '---' }}
 | 
			
		||||
			</template>
 | 
			
		||||
@@ -46,6 +48,7 @@
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			v-if="selectedBox[2]"
 | 
			
		||||
			label="巡检时间"
 | 
			
		||||
			width="150"
 | 
			
		||||
			prop="actualCheckTime">
 | 
			
		||||
			<template slot-scope="scope">
 | 
			
		||||
				{{ scope.row.actualCheckTime | timeFilter }}
 | 
			
		||||
@@ -54,6 +57,8 @@
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			v-if="selectedBox[3]"
 | 
			
		||||
			label="班次"
 | 
			
		||||
			width="180"
 | 
			
		||||
			:show-overflow-tooltip="true"
 | 
			
		||||
			prop="groupClass">
 | 
			
		||||
			<template slot-scope="scope">
 | 
			
		||||
				{{ scope.row.groupClass || '---' }}
 | 
			
		||||
@@ -62,6 +67,7 @@
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			v-if="selectedBox[4]"
 | 
			
		||||
			label="确认截止时间"
 | 
			
		||||
			width="150"
 | 
			
		||||
			prop="confirmDueTime">
 | 
			
		||||
			<template slot-scope="scope">
 | 
			
		||||
				{{ scope.row.confirmDueTime | timeFilter }}
 | 
			
		||||
@@ -70,6 +76,7 @@
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			v-if="selectedBox[5]"
 | 
			
		||||
			width="150"
 | 
			
		||||
			:show-overflow-tooltip="true"
 | 
			
		||||
			label="备注"
 | 
			
		||||
			prop="remark">
 | 
			
		||||
			<template slot-scope="scope">
 | 
			
		||||
@@ -172,6 +179,7 @@ export default {
 | 
			
		||||
				true
 | 
			
		||||
			],
 | 
			
		||||
			selectedPlan: [],
 | 
			
		||||
			tableH: this.tableHeight(260)
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	computed: {
 | 
			
		||||
@@ -182,6 +190,16 @@ export default {
 | 
			
		||||
			}));
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
	},
 | 
			
		||||
	destroyed() {
 | 
			
		||||
		window.removeEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260)
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		checkSelectable(row, index) {
 | 
			
		||||
			return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -139,7 +139,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				special: false,
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -65,6 +66,7 @@ import addRecord from './addRecord.vue';
 | 
			
		||||
import AddContent from './addContent.vue';
 | 
			
		||||
import { exportCheckOrderExcel, deleteEqCheckLog } from '@/api/equipment/base/inspection/record'
 | 
			
		||||
import { parseTime } from '../../../../core/mixins/code-filter';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
 | 
			
		||||
 | 
			
		||||
@@ -91,7 +93,7 @@ const btn = {
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentInspectionRecord',
 | 
			
		||||
	components: { addRecord, AddContent },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			addOrUpdateVisible: false,
 | 
			
		||||
@@ -250,7 +252,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				special: false,
 | 
			
		||||
				name: null,
 | 
			
		||||
				actualCheckTime: null,
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -53,13 +54,14 @@ import addOrUpdata from './add-or-updata.vue';
 | 
			
		||||
import add from './add.vue';
 | 
			
		||||
import { parseTime } from '../../../../core/mixins/code-filter';
 | 
			
		||||
import { groupClassesListAll } from '@/api/monitoring/teamProduction';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
// import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentCheckSetting',
 | 
			
		||||
	components: { addOrUpdata, add },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			addOrUpdateVisible: false,
 | 
			
		||||
@@ -102,7 +104,7 @@ export default {
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'code',
 | 
			
		||||
					label: '巡检单编码',
 | 
			
		||||
					minWidth: 150,
 | 
			
		||||
					minWidth: 170,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'department', label: '部门', showOverflowtooltip: true },
 | 
			
		||||
@@ -225,7 +227,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				equipmentId: null,
 | 
			
		||||
				name: null,
 | 
			
		||||
				special: false,
 | 
			
		||||
 
 | 
			
		||||
@@ -7,12 +7,13 @@
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<el-drawer
 | 
			
		||||
		:visible="visible"
 | 
			
		||||
		:visible.sync="visible"
 | 
			
		||||
		:show-close="false"
 | 
			
		||||
		:wrapper-closable="false"
 | 
			
		||||
		:wrapper-closable="true"
 | 
			
		||||
		class="drawer"
 | 
			
		||||
		custom-class="mes-drawer"
 | 
			
		||||
		size="60%"
 | 
			
		||||
		:before-close="beforeClose"
 | 
			
		||||
		@closed="$emit('destroy')">
 | 
			
		||||
		<SmallTitle slot="title">编辑</SmallTitle>
 | 
			
		||||
 | 
			
		||||
@@ -344,6 +345,7 @@ export default {
 | 
			
		||||
						label: '设备名称',
 | 
			
		||||
						prop: 'equipmentId',
 | 
			
		||||
						url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=false',
 | 
			
		||||
						bind: { clearable: true, filterable: true },
 | 
			
		||||
						// method: 'post',
 | 
			
		||||
						// queryParams: {
 | 
			
		||||
						// 	pageNo: 1,
 | 
			
		||||
@@ -443,6 +445,15 @@ export default {
 | 
			
		||||
		this.getList('line');
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		beforeClose(done) {
 | 
			
		||||
			// if (!this.isdetail) {
 | 
			
		||||
			this.$confirm('确认关闭?')
 | 
			
		||||
				.then(_ => {
 | 
			
		||||
					done();
 | 
			
		||||
				})
 | 
			
		||||
				.catch(_ => {});
 | 
			
		||||
			// }
 | 
			
		||||
		},
 | 
			
		||||
		handleSearchBarBtnClick(btn) {
 | 
			
		||||
			switch (btn.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@
 | 
			
		||||
			background: '#f2f4f9',
 | 
			
		||||
			color: '#606266',
 | 
			
		||||
		}"
 | 
			
		||||
		:max-height="tableH"
 | 
			
		||||
		class="waiting-list-table">
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			type="selection"
 | 
			
		||||
@@ -36,8 +37,9 @@
 | 
			
		||||
		</el-table-column>
 | 
			
		||||
		<el-table-column
 | 
			
		||||
			v-if="selectedBox[0]"
 | 
			
		||||
			width="128"
 | 
			
		||||
			width="160"
 | 
			
		||||
			label="设备保养单号"
 | 
			
		||||
			:show-overflow-tooltip="true"
 | 
			
		||||
			prop="maintainOrderNumber"></el-table-column>
 | 
			
		||||
		<el-table-column v-if="selectedBox[1]" width="128" label="保养计划名称" prop="planName">
 | 
			
		||||
			<template slot-scope="scope">
 | 
			
		||||
@@ -224,6 +226,7 @@ export default {
 | 
			
		||||
				true,
 | 
			
		||||
			],
 | 
			
		||||
			selectedPlan: [],
 | 
			
		||||
			tableH: this.tableHeight(260),
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	computed: {
 | 
			
		||||
@@ -234,6 +237,16 @@ export default {
 | 
			
		||||
			}));
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		window.addEventListener('resize', () => {
 | 
			
		||||
      this.tableH = this.tableHeight(260)
 | 
			
		||||
    })
 | 
			
		||||
	},
 | 
			
		||||
	destroyed() {
 | 
			
		||||
		window.removeEventListener('resize', () => {
 | 
			
		||||
			this.tableH = this.tableHeight(260)
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		checkSelectable(row, index) {
 | 
			
		||||
			return (
 | 
			
		||||
 
 | 
			
		||||
@@ -335,6 +335,7 @@ export default {
 | 
			
		||||
						label: '设备名称',
 | 
			
		||||
						prop: 'equipmentId',
 | 
			
		||||
						url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=false',
 | 
			
		||||
						bind: { clearable: true, filterable: true },
 | 
			
		||||
						// method: 'post',
 | 
			
		||||
						// queryParams: {
 | 
			
		||||
						// 	pageNo: 1,
 | 
			
		||||
 
 | 
			
		||||
@@ -197,7 +197,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				special: false,
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<!-- <method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -59,6 +60,7 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import { exportMaintainMonitorExcel } from '@/api/equipment/base/maintain/record'
 | 
			
		||||
import { parseTime } from '@/utils/ruoyi'
 | 
			
		||||
import AddContent from '../PlanConfig/addContent.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const remainBox = {
 | 
			
		||||
	name: 'RemainBox',
 | 
			
		||||
@@ -116,7 +118,7 @@ const btn = {
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'Monitor',
 | 
			
		||||
	components: { AddContent },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			addContent: false,
 | 
			
		||||
@@ -129,7 +131,7 @@ export default {
 | 
			
		||||
				// 	width: 180,
 | 
			
		||||
				// 	filter: parseTime(createTime),
 | 
			
		||||
				// },
 | 
			
		||||
				{ prop: 'code', label: '保养计划单号', minWidth: 118, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'code', label: '保养计划单号', width: 150, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'name', label: '保养计划名称', minWidth: 118, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'departmentName', label: '部门', minWidth: 100, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'lineName', label: '产线名', minWidth: 100, showOverflowtooltip: true },
 | 
			
		||||
@@ -205,7 +207,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				special: false,
 | 
			
		||||
				equipmentName: null,
 | 
			
		||||
				createTime: null,
 | 
			
		||||
 
 | 
			
		||||
@@ -9,11 +9,12 @@
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData">
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
				:width="150"
 | 
			
		||||
				:width="120"
 | 
			
		||||
				label="操作"
 | 
			
		||||
				:method-list="tableBtn"
 | 
			
		||||
				@clickBtn="handleClick" />
 | 
			
		||||
@@ -53,6 +54,7 @@ import { parseTime, toDay } from '../../../../core/mixins/code-filter';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import { getPlanPage } from '@/api/equipment/base/maintain/planconfig';
 | 
			
		||||
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	// {
 | 
			
		||||
@@ -62,46 +64,64 @@ const tableProps = [
 | 
			
		||||
	// },
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '保养计划名称'
 | 
			
		||||
		label: '保养计划名称',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'departmentName',
 | 
			
		||||
		label: '部门'
 | 
			
		||||
		label: '部门',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
		prop: 'lineName',
 | 
			
		||||
		label: '产线名'
 | 
			
		||||
		label: '产线名',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
		prop: 'maintenancePeriod',
 | 
			
		||||
		label: '保养频率(天/次)'
 | 
			
		||||
		label: '保养频率(天/次)',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
		prop: 'firstMaintenanceTime',
 | 
			
		||||
		label: '首次保养时间',
 | 
			
		||||
		filter: parseTime
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
		prop: 'maintainDuration',
 | 
			
		||||
		label: '保养时长'
 | 
			
		||||
		label: '保养时长',
 | 
			
		||||
		width: 120,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
		prop: 'maintainer',
 | 
			
		||||
		label: '计划保养人员'
 | 
			
		||||
		label: '计划保养人员',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
		prop: 'confirmTimeLimit',
 | 
			
		||||
		label: '确认时限',
 | 
			
		||||
		filter: toDay
 | 
			
		||||
		filter: toDay,
 | 
			
		||||
		width: 130,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark',
 | 
			
		||||
		label: '备注'
 | 
			
		||||
		label: '备注',
 | 
			
		||||
		width: 150,
 | 
			
		||||
		showOverflowtooltip: true
 | 
			
		||||
	}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	mixins: [basicPage, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
@@ -111,7 +131,7 @@ export default {
 | 
			
		||||
			tableProps,
 | 
			
		||||
			addContent: false,
 | 
			
		||||
			listQuery: {
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
        pageSize: 20,
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        total: 0,
 | 
			
		||||
				special: false,
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -65,6 +66,7 @@ import Editor from '@/components/Editor';
 | 
			
		||||
import { deleteEqMaintainLog, exportMaintainLogExcel } from '@/api/equipment/base/maintain/record';
 | 
			
		||||
import AddContent from './addContent.vue';
 | 
			
		||||
import { parseTime } from '../../../../core/mixins/code-filter';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
 | 
			
		||||
 | 
			
		||||
@@ -91,7 +93,7 @@ const btn = {
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentMaintainRecord',
 | 
			
		||||
	components: { AddContent },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			addContent: false,
 | 
			
		||||
@@ -337,7 +339,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				special: false,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,8 @@
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			@emitFun="handleEmitFun"
 | 
			
		||||
			:max-height="tableH">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
@@ -58,12 +59,13 @@ import { deleteRepair, exportRepairLogExcel } from '@/api/equipment/base/repair'
 | 
			
		||||
import { parseTime } from '@/utils/ruoyi'
 | 
			
		||||
import htmls from './htmls.vue'
 | 
			
		||||
import DialogForm from './Repair--add.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentRepair',
 | 
			
		||||
	components: { CustomDialogForm, DialogForm },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	mixins: [basicPageMixin, tableHeightMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			addOrUpdateVisible: false,
 | 
			
		||||
@@ -102,16 +104,16 @@ export default {
 | 
			
		||||
				// 	width: 180,
 | 
			
		||||
				// 	filter: parseTime,
 | 
			
		||||
				// },
 | 
			
		||||
				{ prop: 'repairOrderNumber', label: '维修单号' },
 | 
			
		||||
				{ prop: 'lineName', label: '产线名' },
 | 
			
		||||
				{ prop: 'sectionName', label: '工段名' },
 | 
			
		||||
				{ prop: 'repairOrderNumber', label: '维修单号', width: 180, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'lineName', label: '产线名', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'sectionName', label: '工段名', width: 120, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'faultDetail', label: '故障明细', subcomponent: htmls },
 | 
			
		||||
				{ prop: 'faultDetail', label: '故障明细', subcomponent: htmls, width: 180, showOverflowtooltip: true },
 | 
			
		||||
				// { prop: 'maintenanceDetail', label: '维修明细', subcomponent: htmls, minWidth: 100, showOverflowtooltip: true },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'maintenanceStartTime',
 | 
			
		||||
					label: '维修开始时间',
 | 
			
		||||
					width: 150, 
 | 
			
		||||
					width: 150,
 | 
			
		||||
					filter: parseTime,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
@@ -193,7 +195,7 @@ export default {
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageSize: 20,
 | 
			
		||||
				special: false,
 | 
			
		||||
				maintenanceResult: null,
 | 
			
		||||
				createTime: null,
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,8 @@
 | 
			
		||||
									:page="1"
 | 
			
		||||
									:limit="999"
 | 
			
		||||
									:table-data="list"
 | 
			
		||||
									@emitFun="handleEmitFun">
 | 
			
		||||
									@emitFun="handleEmitFun"
 | 
			
		||||
									:max-height="tableH">
 | 
			
		||||
									<!-- <method-btn
 | 
			
		||||
							v-if="tableBtn.length"
 | 
			
		||||
						slot="handleBtn"
 | 
			
		||||
@@ -119,9 +120,11 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import Graph from './graph.vue';
 | 
			
		||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentProcessAmount',
 | 
			
		||||
	mixins: [tableHeightMixin],
 | 
			
		||||
	components: { Graph },
 | 
			
		||||
	props: {},
 | 
			
		||||
	data() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user