merge test
This commit is contained in:
		
							
								
								
									
										24
									
								
								src/api/core/analysis/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/api/core/analysis/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2023-09-12 14:07:04
 | 
			
		||||
 * @LastEditTime: 2023-09-13 09:53:45
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
 */
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
export function getYieldAnalysisPageData(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/analysis/production-analysis/getOutput',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getCT(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/analysis/production-analysis/getCT',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								src/api/core/monitoring/auto.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/api/core/monitoring/auto.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-09-12 09:44:53
 | 
			
		||||
 * @LastEditTime: 2023-09-13 16:11:41
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 */
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 获得工厂分页
 | 
			
		||||
export function getPdlAutoReport(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/monitoring/production-monitor/getPdlAutoReport',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获得所有工厂产线列表
 | 
			
		||||
export function getPdList() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/base/production-line/listAll',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								src/api/core/monitoring/data.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/api/core/monitoring/data.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-09-12 09:44:53
 | 
			
		||||
 * @LastEditTime: 2023-09-14 10:25:46
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 */
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 获得产线统计数据查询
 | 
			
		||||
export function getPdlDataSearch(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/monitoring/production-monitor/getPdlDataSearch',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获得所有工厂产线列表
 | 
			
		||||
export function getPdList() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/base/production-line/listAll',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								src/api/core/monitoring/data24.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/api/core/monitoring/data24.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-09-12 09:44:53
 | 
			
		||||
 * @LastEditTime: 2023-09-15 14:12:26
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 */
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 获得近24小时产线生产数据
 | 
			
		||||
export function getPdlDataOneDay(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/monitoring/production-monitor/getPdlDataOneDay',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								src/api/core/monitoring/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/api/core/monitoring/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2023-09-12 14:07:04
 | 
			
		||||
 * @LastEditTime: 2023-09-13 09:46:44
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
 */
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
export function getSectionDataSearch(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/monitoring/production-monitor/getSectionDataSearch',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								src/api/core/monitoring/sectionStatistics.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/api/core/monitoring/sectionStatistics.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-09-12 09:44:53
 | 
			
		||||
 * @LastEditTime: 2023-09-14 14:01:12
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 */
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 获得工段自动统计数据查询
 | 
			
		||||
export function getSectionAutoReport(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/monitoring/production-monitor/getSectionAutoReport',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获得所有工厂产线列表
 | 
			
		||||
export function getPdList() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/base/production-line/listAll',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获得所有产线工段列表
 | 
			
		||||
export function getWorkshopSectionList() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/base/workshop-section/listAll',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
<svg t="1627279997305" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11904" width="40" height="40"><path d="M938.7008 669.525333L938.7008 249.412267c0-90.555733-73.5232-164.078933-164.1472-164.078933L249.378133 85.333333c-90.555733 0-164.078933 73.48906699-164.078933 164.078933l0 525.2096c0 90.555733 73.454933 164.078933 164.07893301 164.078933l525.20959999 0c80.725333 0 147.8656-58.368 161.553067-135.099733-43.52-18.8416-232.106667-100.283733-330.376533-147.182933-74.786133 90.589867-153.088 144.930133-271.121067 144.930133s-196.81279999-72.704-187.357867-161.655467c6.2464-58.402133 46.2848-153.9072 220.296533-137.5232 91.682133 8.6016 133.666133 25.736533 208.418133 50.414933 19.3536-35.4304 35.4304-74.513067 47.616-116.0192L292.0448 436.565333l0-32.8704 164.0448 0 0-58.9824L256 344.712533l1e-8-36.181333 200.12373299 0L456.123733 223.3344c0 0 1.809067-13.312 16.520533-13.31200001l82.056533 1e-8 0 98.474667 213.333333 0 0 36.181333-213.333333 1e-8 0 58.98239999 174.045867 0c-16.00853301 65.1264-40.277333 124.962133-70.690133 177.220267C708.608 599.176533 938.7008 669.525333 938.7008 669.525333L938.7008 669.525333 938.7008 669.525333 938.7008 669.525333zM321.57013299 744.994133c-124.7232 0-144.452267-78.7456-137.83039999-111.65013299 6.5536-32.733867 42.666667-75.502933 112.0256-75.50293301 79.6672 0 151.04 20.445867 236.714667 62.088533C472.302933 698.333867 398.370133 744.994133 321.57013299 744.994133L321.57013299 744.994133 321.57013299 744.994133zM321.57013299 744.994133" fill="#1296db" p-id="11905"></path></svg>
 | 
			
		||||
<svg t="1627279997305" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11904" width="40" height="40"><path d="M938.7008 669.525333L938.7008 249.412267c0-90.555733-73.5232-164.078933-164.1472-164.078933L249.378133 85.333333c-90.555733 0-164.078933 73.48906699-164.078933 164.078933l0 525.2096c0 90.555733 73.454933 164.078933 164.07893301 164.078933l525.20959999 0c80.725333 0 147.8656-58.368 161.553067-135.099733-43.52-18.8416-232.106667-100.283733-330.376533-147.182933-74.786133 90.589867-153.088 144.930133-271.121067 144.930133s-196.81279999-72.704-187.357867-161.655467c6.2464-58.402133 46.2848-153.9072 220.296533-137.5232 91.682133 8.6016 133.666133 25.736533 208.418133 50.414933 19.3536-35.4304 35.4304-74.513067 47.616-116.0192L292.0448 436.565333l0-32.8704 164.0448 0 0-58.9824L256 344.712533l1e-8-36.181333 200.12373299 0L456.123733 223.3344c0 0 1.809067-13.312 16.520533-13.31200001l82.056533 1e-8 0 98.474667 213.333333 0 0 36.181333-213.333333 1e-8 0 58.98239999 174.045867 0c-16.00853301 65.1264-40.277333 124.962133-70.690133 177.220267C708.608 599.176533 938.7008 669.525333 938.7008 669.525333L938.7008 669.525333 938.7008 669.525333 938.7008 669.525333zM321.57013299 744.994133c-124.7232 0-144.452267-78.7456-137.83039999-111.65013299 6.5536-32.733867 42.666667-75.502933 112.0256-75.50293301 79.6672 0 151.04 20.445867 236.714667 62.088533C472.302933 698.333867 398.370133 744.994133 321.57013299 744.994133L321.57013299 744.994133 321.57013299 744.994133zM321.57013299 744.994133" fill="#1296db" p-id="11905"></path></svg>
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB  | 
@@ -247,7 +247,7 @@ Router.prototype.push = function push(location) {
 | 
			
		||||
 | 
			
		||||
export default new Router({
 | 
			
		||||
  base: process.env.VUE_APP_APP_NAME ? process.env.VUE_APP_APP_NAME : "/",
 | 
			
		||||
  mode: 'history', // 去掉url中的#
 | 
			
		||||
  mode: 'hash', // 去掉url中的#
 | 
			
		||||
  scrollBehavior: () => ({y: 0}),
 | 
			
		||||
  routes: constantRoutes
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										219
									
								
								src/views/base/equipmentBindSection/dialogForm.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										219
									
								
								src/views/base/equipmentBindSection/dialogForm.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,219 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: dialogForm.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2023-09-11 15:55:13
 | 
			
		||||
    description: DialogForm for equipmentBindSection only
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<el-form
 | 
			
		||||
		ref="form"
 | 
			
		||||
		:model="dataForm"
 | 
			
		||||
		label-width="100px"
 | 
			
		||||
		v-loading="formLoading">
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="产线"
 | 
			
		||||
					prop="productionLineId"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.productionLineId"
 | 
			
		||||
						placeholder="请选择产线"
 | 
			
		||||
						@change="handleProductlineChange">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in productionLineList"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="工段"
 | 
			
		||||
					prop="workshopSectionId"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.workshopSectionId"
 | 
			
		||||
						placeholder="请选择工段"
 | 
			
		||||
						@change="$emit('update', dataForm)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in worksectionList"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="设备"
 | 
			
		||||
					prop="equipmentId"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.equipmentId"
 | 
			
		||||
						placeholder="请选择设备"
 | 
			
		||||
						@change="$emit('update', dataForm)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in equipmentList"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="工段排序" prop="sort">
 | 
			
		||||
					<el-input
 | 
			
		||||
						v-model="dataForm.sort"
 | 
			
		||||
						@change="$emit('update', dataForm)"
 | 
			
		||||
						placeholder="请输入工段排序" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="产线数据类型" prop="lineDataType">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.lineDataType"
 | 
			
		||||
						placeholder="请选择产线数据类型"
 | 
			
		||||
						@change="$emit('update', dataForm)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in [
 | 
			
		||||
								{ label: '无类型', value: 0 },
 | 
			
		||||
								{ label: '进口统计', value: 1 },
 | 
			
		||||
								{ label: '出口统计', value: 2 },
 | 
			
		||||
							]"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="工段数据类型" prop="sectionDataType">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.sectionDataType"
 | 
			
		||||
						placeholder="请选择工段数据类型"
 | 
			
		||||
						@change="$emit('update', dataForm)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in [
 | 
			
		||||
								{ label: '无类型', value: 0 },
 | 
			
		||||
								{ label: '进口统计', value: 1 },
 | 
			
		||||
								{ label: '出口统计', value: 2 },
 | 
			
		||||
							]"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'DialogForm',
 | 
			
		||||
	model: {
 | 
			
		||||
		prop: 'dataForm',
 | 
			
		||||
		event: 'update',
 | 
			
		||||
	},
 | 
			
		||||
	emits: ['update'],
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {
 | 
			
		||||
		dataForm: {
 | 
			
		||||
			type: Object,
 | 
			
		||||
			default: () => ({}),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formLoading: true,
 | 
			
		||||
			productionLineList: [],
 | 
			
		||||
			equipmentList: [],
 | 
			
		||||
			worksectionList: [],
 | 
			
		||||
			dataFormCache: null,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		Promise.all([this.getProductLineList(), this.getEquipmentList()]).then(
 | 
			
		||||
			() => {
 | 
			
		||||
				this.formLoading = false;
 | 
			
		||||
			}
 | 
			
		||||
		);
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
		'dataForm.productionLineId': {
 | 
			
		||||
			handler: async function (plId) {
 | 
			
		||||
				if (plId) await this.getWorksectionList(plId);
 | 
			
		||||
			},
 | 
			
		||||
			immediate: true,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		/** 模拟透传 ref  */
 | 
			
		||||
		validate(cb) {
 | 
			
		||||
			return this.$refs.form.validate(cb);
 | 
			
		||||
		},
 | 
			
		||||
		resetFields(args) {
 | 
			
		||||
			return this.$refs.form.resetFields(args);
 | 
			
		||||
		},
 | 
			
		||||
		async handleProductlineChange(id) {
 | 
			
		||||
			await this.getWorksectionList(id);
 | 
			
		||||
			this.dataForm.workshopSectionId = null;
 | 
			
		||||
			this.$emit('update', this.dataForm);
 | 
			
		||||
		},
 | 
			
		||||
		// getCode
 | 
			
		||||
		async getCode(url) {
 | 
			
		||||
			const response = await this.$axios(url);
 | 
			
		||||
			return response.data;
 | 
			
		||||
		},
 | 
			
		||||
		// 获取产线列表
 | 
			
		||||
		async getProductLineList() {
 | 
			
		||||
			const response = await this.$axios('/base/production-line/listAll');
 | 
			
		||||
			this.productionLineList = response.data.map((item) => ({
 | 
			
		||||
				label: item.name,
 | 
			
		||||
				value: item.id,
 | 
			
		||||
			}));
 | 
			
		||||
		},
 | 
			
		||||
		// 获取设备列表
 | 
			
		||||
		async getEquipmentList() {
 | 
			
		||||
			const response = await this.$axios(
 | 
			
		||||
				'/base/equipment/page?pageNo=1&pageSize=100'
 | 
			
		||||
			);
 | 
			
		||||
			this.equipmentList = response.data.list.map((item) => ({
 | 
			
		||||
				label: item.name,
 | 
			
		||||
				value: item.id,
 | 
			
		||||
			}));
 | 
			
		||||
		},
 | 
			
		||||
		// 获取工段列表
 | 
			
		||||
		async getWorksectionList(plId) {
 | 
			
		||||
			const response = await this.$axios(
 | 
			
		||||
				'/base/workshop-section/listByParentId',
 | 
			
		||||
				{
 | 
			
		||||
					params: {
 | 
			
		||||
						id: plId,
 | 
			
		||||
					},
 | 
			
		||||
				}
 | 
			
		||||
			);
 | 
			
		||||
			this.worksectionList = response.data.map((item) => ({
 | 
			
		||||
				label: item.name,
 | 
			
		||||
				value: item.id,
 | 
			
		||||
			}));
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.el-date-editor,
 | 
			
		||||
.el-select {
 | 
			
		||||
	width: 100%;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
			@close="cancel"
 | 
			
		||||
			@cancel="cancel"
 | 
			
		||||
			@confirm="submitForm">
 | 
			
		||||
			<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
 | 
			
		||||
			<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
@@ -53,10 +53,10 @@ import {
 | 
			
		||||
} from '@/api/base/equipmentBindSection';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
 | 
			
		||||
import DialogForm from './dialogForm.vue';
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentBindSection',
 | 
			
		||||
	components: {},
 | 
			
		||||
	components: { DialogForm },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
@@ -181,8 +181,8 @@ export default {
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '工段',
 | 
			
		||||
						url: '/base/workshop-section/listByParentId', // 根据产线获取
 | 
			
		||||
            // depends: '__product_line', // 依赖产线获取数据
 | 
			
		||||
            depends: 'productionLineId',
 | 
			
		||||
						// depends: '__product_line', // 依赖产线获取数据
 | 
			
		||||
						depends: 'productionLineId',
 | 
			
		||||
						prop: 'workshopSectionId',
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,13 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2023-09-11 16:18:44
 | 
			
		||||
 * @LastEditTime: 2023-09-12 14:25:01
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:  
 | 
			
		||||
 */
 | 
			
		||||
import Mock from 'mockjs';
 | 
			
		||||
 | 
			
		||||
const baseURL = 'http://192.168.1.49:48080/admin-api';
 | 
			
		||||
const baseURL = 'http://192.168.1.188:48080/admin-api';
 | 
			
		||||
 | 
			
		||||
Mock.setup({
 | 
			
		||||
	timeout: 200,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										93
									
								
								src/views/core/analysis/LineChart.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								src/views/core/analysis/LineChart.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2023-09-13 09:02:25
 | 
			
		||||
 * @LastEditTime: 2023-09-13 10:33:20
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
  <div :class="className" :style="{height:height,width:width}" />
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import * as echarts from 'echarts'
 | 
			
		||||
require('echarts/theme/macarons') // echarts theme
 | 
			
		||||
// import resize from './mixins/resize'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  // mixins: [resize],
 | 
			
		||||
  props: {
 | 
			
		||||
    className: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: 'chart'
 | 
			
		||||
    },
 | 
			
		||||
    width: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: '100%'
 | 
			
		||||
    },
 | 
			
		||||
    height: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: '350px'
 | 
			
		||||
    },
 | 
			
		||||
    // autoResize: {
 | 
			
		||||
    //   type: Boolean,
 | 
			
		||||
    //   default: true
 | 
			
		||||
    // }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      chart: null
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  // watch: {
 | 
			
		||||
  //   chartData: {
 | 
			
		||||
  //     deep: true,
 | 
			
		||||
  //     handler(val) {
 | 
			
		||||
  //       this.setOptions(val)
 | 
			
		||||
  //     }
 | 
			
		||||
  //   }
 | 
			
		||||
  // },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    // this.$nextTick(() => {
 | 
			
		||||
    //   this.initChart()
 | 
			
		||||
    // })
 | 
			
		||||
  },
 | 
			
		||||
  // beforeDestroy() {
 | 
			
		||||
  //   if (!this.chart) {
 | 
			
		||||
  //     return
 | 
			
		||||
  //   }
 | 
			
		||||
  //   this.chart.dispose()
 | 
			
		||||
  //   this.chart = null
 | 
			
		||||
  // },
 | 
			
		||||
  methods: {
 | 
			
		||||
    initChart(xData, yData,lineName) {
 | 
			
		||||
      console.log(xData,yData);
 | 
			
		||||
      this.chart = echarts.init(this.$el, 'macarons')
 | 
			
		||||
      this.setOptions(xData, yData, lineName)
 | 
			
		||||
    },
 | 
			
		||||
    setOptions(xData, yData, lineName) {
 | 
			
		||||
      let seriesData = []
 | 
			
		||||
        lineName.forEach((item,index) => {
 | 
			
		||||
          seriesData.push({
 | 
			
		||||
            name: item,
 | 
			
		||||
            data: yData[index],
 | 
			
		||||
            type: 'line',
 | 
			
		||||
          })
 | 
			
		||||
        })
 | 
			
		||||
      this.chart.setOption({
 | 
			
		||||
        xAxis: {
 | 
			
		||||
          type: 'category',
 | 
			
		||||
          data: xData
 | 
			
		||||
        },
 | 
			
		||||
        legend: {
 | 
			
		||||
          data:lineName
 | 
			
		||||
        },
 | 
			
		||||
        yAxis: {
 | 
			
		||||
          type: 'value'
 | 
			
		||||
        },
 | 
			
		||||
        series: seriesData
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
@@ -1,159 +1,245 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2023-09-11 14:21:21
 | 
			
		||||
 * @LastEditTime: 2023-09-11 14:26:04
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<search-bar
 | 
			
		||||
			:formConfigs="formConfig"
 | 
			
		||||
			ref="searchBarForm"
 | 
			
		||||
			@headBtnClick="buttonClick" />
 | 
			
		||||
		<base-table
 | 
			
		||||
			v-loading="dataListLoading"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData" />
 | 
			
		||||
		<pagination
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
 | 
			
		||||
    <base-table v-loading="dataListLoading" :span-method="mergeColumnHandler" :table-props="tableProps" :table-data="tableData" />
 | 
			
		||||
    <line-chart ref="lineChart" />
 | 
			
		||||
    <!-- <pagination
 | 
			
		||||
			:limit.sync="listQuery.pageSize"
 | 
			
		||||
			:page.sync="listQuery.pageNo"
 | 
			
		||||
			:total="listQuery.total"
 | 
			
		||||
			@pagination="getDataList" />
 | 
			
		||||
	</div>
 | 
			
		||||
			@pagination="getDataList" /> -->
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import basicPage from '../../mixins/basic-page';
 | 
			
		||||
// import basicPage from '../../mixins/basic-page';
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import { getLineBindProductLogPage } from '@/api/core/base/lineBindProductLog';
 | 
			
		||||
import { getCT } from '@/api/core/analysis/index';
 | 
			
		||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
 | 
			
		||||
import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
 | 
			
		||||
import lineChart from '../LineChart'
 | 
			
		||||
import { time } from 'echarts';
 | 
			
		||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'productionLineName',
 | 
			
		||||
		label: '产线名称',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '工段名称',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '进片数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '出片数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '损耗数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '损耗面积/m²',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '损耗比例/%',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
// const tableProps = [
 | 
			
		||||
// 	// {
 | 
			
		||||
//   //   prop: 'lineName',
 | 
			
		||||
// 	// 	label: '产线',
 | 
			
		||||
// 	// 	align: 'center',
 | 
			
		||||
// 	// },
 | 
			
		||||
//   // {
 | 
			
		||||
//   //   prop: 'sum',
 | 
			
		||||
//   //   label: '合计',
 | 
			
		||||
//   //   align: 'center',
 | 
			
		||||
//   // },
 | 
			
		||||
//   // {
 | 
			
		||||
//   //   prop: 'dynamicValue',
 | 
			
		||||
//   //   label: 'dynamicName',
 | 
			
		||||
//   //   align: 'center',
 | 
			
		||||
//   //   children:[
 | 
			
		||||
 | 
			
		||||
//   //   ]
 | 
			
		||||
//   // }
 | 
			
		||||
// ];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getLineBindProductLogPage,
 | 
			
		||||
			},
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
      optionArrUrl: [getProductionLinePage, getWorkshopSectionPage],
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '产线',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'productionLineId',
 | 
			
		||||
					defaultSelect: '',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'datePicker',
 | 
			
		||||
					label: '时间',
 | 
			
		||||
					dateType: 'daterange',
 | 
			
		||||
					format: 'yyyy-MM-dd',
 | 
			
		||||
					valueFormat: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始时间',
 | 
			
		||||
					endPlaceholder: '结束时间',
 | 
			
		||||
					param: 'createTime',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '搜索',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '导出',
 | 
			
		||||
					name: 'export',
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	components: {
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getArr();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getArr() {
 | 
			
		||||
			const params = {
 | 
			
		||||
				page: 1,
 | 
			
		||||
				limit: 500,
 | 
			
		||||
			};
 | 
			
		||||
			this.optionArrUrl.forEach((item, index) => {
 | 
			
		||||
				item(params).then((response) => {
 | 
			
		||||
					this.formConfig[index].selectOptions = response.data.list;
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.listQuery.pageNo = 1;
 | 
			
		||||
					this.listQuery.pageSize = 10;
 | 
			
		||||
					this.listQuery.productionLineId = val.productionLineId;
 | 
			
		||||
					this.listQuery.productId = val.productId;
 | 
			
		||||
					this.listQuery.createTime = val.createTime;
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
					break;
 | 
			
		||||
				case 'reset':
 | 
			
		||||
					this.$refs.searchBarForm.resetForm();
 | 
			
		||||
					this.listQuery = {
 | 
			
		||||
						pageSize: 10,
 | 
			
		||||
						pageNo: 1,
 | 
			
		||||
						total: 1,
 | 
			
		||||
					};
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					console.log(val);
 | 
			
		||||
  components: {
 | 
			
		||||
    lineChart,
 | 
			
		||||
  },
 | 
			
		||||
  // mixins: [basicPage],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      urlOptions: {
 | 
			
		||||
        getDataListURL: getCT,
 | 
			
		||||
      },
 | 
			
		||||
      tableProps: [],
 | 
			
		||||
      dataListLoading: false,
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        // time: ''
 | 
			
		||||
        endTime: undefined,
 | 
			
		||||
        lineId:undefined,
 | 
			
		||||
        startTime:undefined
 | 
			
		||||
      },
 | 
			
		||||
      timeList: [],
 | 
			
		||||
      spanArr: [], 
 | 
			
		||||
      xData: [],
 | 
			
		||||
      yData: [],
 | 
			
		||||
      optionArrUrl: [getProductionLinePage],
 | 
			
		||||
      formConfig: [
 | 
			
		||||
        {
 | 
			
		||||
          type: 'select',
 | 
			
		||||
          label: '产线',
 | 
			
		||||
          selectOptions: [],
 | 
			
		||||
          param: 'lineIds',
 | 
			
		||||
          defaultSelect: '',
 | 
			
		||||
          multiple: false,
 | 
			
		||||
          filterable: true,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'datePicker',
 | 
			
		||||
          label: '时间',
 | 
			
		||||
          dateType: 'datetimerange',
 | 
			
		||||
          format: 'yyyy-MM-dd',
 | 
			
		||||
          valueFormat: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
          rangeSeparator: '-',
 | 
			
		||||
          startPlaceholder: '开始时间',
 | 
			
		||||
          endPlaceholder: '结束时间',
 | 
			
		||||
          width: 350,
 | 
			
		||||
          param: 'time',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'button',
 | 
			
		||||
          btnName: '搜索',
 | 
			
		||||
          name: 'search',
 | 
			
		||||
          color: 'primary',
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getArr();
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getArr() {
 | 
			
		||||
      const params = {
 | 
			
		||||
        page: 1,
 | 
			
		||||
        limit: 500,
 | 
			
		||||
      };
 | 
			
		||||
      this.optionArrUrl.forEach((item, index) => {
 | 
			
		||||
        item(params).then((response) => {
 | 
			
		||||
          this.formConfig[index].selectOptions = response.data.list
 | 
			
		||||
        });
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    setRowSpan(arr) {
 | 
			
		||||
      let count = 0
 | 
			
		||||
      arr.forEach((item, index) => {
 | 
			
		||||
        if(index === 0) {
 | 
			
		||||
          this.spanArr.push(1)
 | 
			
		||||
        } else {
 | 
			
		||||
          if (item === arr[index - 1]) {
 | 
			
		||||
            this.spanArr[count] += 1
 | 
			
		||||
            this.spanArr.push(0)
 | 
			
		||||
          } else {
 | 
			
		||||
            count = index
 | 
			
		||||
            this.spanArr.push(1)
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      console.log('打印数组长度', this.spanArr)
 | 
			
		||||
    },
 | 
			
		||||
    /** 合并table列的规则 */
 | 
			
		||||
		mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
 | 
			
		||||
			if (columnIndex == 0) {
 | 
			
		||||
				if (this.spanArr[rowIndex]) {
 | 
			
		||||
					return [
 | 
			
		||||
						this.spanArr[rowIndex], // row span
 | 
			
		||||
						1, // col span
 | 
			
		||||
					];
 | 
			
		||||
				} else {
 | 
			
		||||
					return [0, 0];
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
    getData() {
 | 
			
		||||
      // this.listQuery.lineId = '1672847052717821953'
 | 
			
		||||
      // this.listQuery.startTime = '1693497600000';
 | 
			
		||||
      // this.listQuery.endTime = '1693843200000';
 | 
			
		||||
      this.urlOptions.getDataListURL(this.listQuery).then(res => {
 | 
			
		||||
        console.log(res)
 | 
			
		||||
        let arr = [
 | 
			
		||||
          {
 | 
			
		||||
            prop: 'sectionName',
 | 
			
		||||
            label: '工段',
 | 
			
		||||
            align: 'center',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            prop: 'equName',
 | 
			
		||||
            label: '设备',
 | 
			
		||||
            align: 'center',
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
        let sectionArr= []
 | 
			
		||||
        res.data.data.forEach((ele, index) => {
 | 
			
		||||
          let tempData = []
 | 
			
		||||
          ele.data.forEach(item => {
 | 
			
		||||
            item.children.forEach(params => {
 | 
			
		||||
              if (params.dynamicName === '设备CT') {
 | 
			
		||||
                tempData[item.dynamicName + '_eq'] = params.dynamicValue
 | 
			
		||||
              } else {
 | 
			
		||||
                tempData[item.dynamicName + '_pl'] = params.dynamicValue
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          })
 | 
			
		||||
          tempData['equName'] = ele.equName
 | 
			
		||||
          tempData['sectionName'] = ele.sectionName
 | 
			
		||||
          this.tableData.push(tempData)
 | 
			
		||||
          const { sectionName } = tempData
 | 
			
		||||
          sectionArr.push(sectionName)
 | 
			
		||||
        })
 | 
			
		||||
        this.setRowSpan(sectionArr)
 | 
			
		||||
        console.log('工段名称列表', sectionArr)
 | 
			
		||||
        res.data.nameData.forEach(item => {
 | 
			
		||||
          this.timeList.push(item.name)
 | 
			
		||||
        })
 | 
			
		||||
        const timeArray = Array.from(new Set(this.timeList))
 | 
			
		||||
        for (const times of timeArray) {
 | 
			
		||||
          if (times !== '设备CT' && times !== '产线CT') {
 | 
			
		||||
            const subprop = {
 | 
			
		||||
              label: times,
 | 
			
		||||
              align: 'center',
 | 
			
		||||
              children: [
 | 
			
		||||
                { prop: times + '_eq', label: '设备CT', align: 'center' },
 | 
			
		||||
                { prop: times + '_pl', label: '产线CT', align: 'center' }
 | 
			
		||||
              ]
 | 
			
		||||
            }
 | 
			
		||||
            arr.push(subprop)
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        this.tableProps = arr
 | 
			
		||||
 | 
			
		||||
        let xData = []
 | 
			
		||||
        res.data.nameData.forEach(item => {
 | 
			
		||||
          xData.push(item.name)
 | 
			
		||||
          // arr[2].children.push(props)
 | 
			
		||||
        })
 | 
			
		||||
        let yData = []
 | 
			
		||||
        res.data.data[0].data[0].children.forEach((item, index) => {
 | 
			
		||||
          // console.log(item)
 | 
			
		||||
          yData.push(item.dynamicValue)
 | 
			
		||||
          // let data = 'data' + Number(index+1)
 | 
			
		||||
          // obj['' + item.dynamicName + ''] = item.dynamicValue
 | 
			
		||||
        })
 | 
			
		||||
        console.log(this.yData)
 | 
			
		||||
        this.$refs.lineChart.initChart(xData, yData)
 | 
			
		||||
        // this.total = response.data.total;
 | 
			
		||||
        // this.dataListLoading = false;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      // console.log(val)
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          // this.listQuery.pageNo = 1;
 | 
			
		||||
          // this.listQuery.pageSize = 10;
 | 
			
		||||
          this.listQuery.lineId = val.lineIds
 | 
			
		||||
          this.listQuery.startTime = val.time ? String(new Date(val.time[0]).getTime()) : undefined;
 | 
			
		||||
          this.listQuery.endTime = val.time ? String(new Date(val.time[1]).getTime()) : undefined;
 | 
			
		||||
          this.getData()
 | 
			
		||||
          break;
 | 
			
		||||
        case 'reset':
 | 
			
		||||
          this.$refs.searchBarForm.resetForm();
 | 
			
		||||
          this.listQuery = {
 | 
			
		||||
            pageSize: 10,
 | 
			
		||||
            pageNo: 1,
 | 
			
		||||
            total: 1,
 | 
			
		||||
          };
 | 
			
		||||
          this.getDataList();
 | 
			
		||||
          break;
 | 
			
		||||
        default:
 | 
			
		||||
          console.log(val);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,114 +1,95 @@
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<search-bar
 | 
			
		||||
			:formConfigs="formConfig"
 | 
			
		||||
			ref="searchBarForm"
 | 
			
		||||
			@headBtnClick="buttonClick" />
 | 
			
		||||
		<base-table
 | 
			
		||||
			v-loading="dataListLoading"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData" />
 | 
			
		||||
		<pagination
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
 | 
			
		||||
    <base-table v-loading="dataListLoading" :table-props="tableProps" :table-data="tableData" />
 | 
			
		||||
    <line-chart ref="lineChart" />
 | 
			
		||||
    <!-- <pagination
 | 
			
		||||
			:limit.sync="listQuery.pageSize"
 | 
			
		||||
			:page.sync="listQuery.pageNo"
 | 
			
		||||
			:total="listQuery.total"
 | 
			
		||||
			@pagination="getDataList" />
 | 
			
		||||
	</div>
 | 
			
		||||
			@pagination="getDataList" /> -->
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import basicPage from '../../mixins/basic-page';
 | 
			
		||||
// import basicPage from '../../mixins/basic-page';
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import { getLineBindProductLogPage } from '@/api/core/base/lineBindProductLog';
 | 
			
		||||
import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
 | 
			
		||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
 | 
			
		||||
import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
 | 
			
		||||
import lineChart from '../LineChart'
 | 
			
		||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'productionLineName',
 | 
			
		||||
		label: '产线',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '合计',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '进片数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '出片数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '损耗数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '损耗面积/m²',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    label: '损耗比例/%',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
// const tableProps = [
 | 
			
		||||
// 	// {
 | 
			
		||||
//   //   prop: 'lineName',
 | 
			
		||||
// 	// 	label: '产线',
 | 
			
		||||
// 	// 	align: 'center',
 | 
			
		||||
// 	// },
 | 
			
		||||
//   // {
 | 
			
		||||
//   //   prop: 'sum',
 | 
			
		||||
//   //   label: '合计',
 | 
			
		||||
//   //   align: 'center',
 | 
			
		||||
//   // },
 | 
			
		||||
//   // {
 | 
			
		||||
//   //   prop: 'dynamicValue',
 | 
			
		||||
//   //   label: 'dynamicName',
 | 
			
		||||
//   //   align: 'center',
 | 
			
		||||
//   //   children:[
 | 
			
		||||
 | 
			
		||||
//   //   ]
 | 
			
		||||
//   // }
 | 
			
		||||
// ];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
  components: {
 | 
			
		||||
    lineChart,
 | 
			
		||||
  },
 | 
			
		||||
	// mixins: [basicPage],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getLineBindProductLogPage,
 | 
			
		||||
        getDataListURL: getYieldAnalysisPageData,
 | 
			
		||||
			},
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
      optionArrUrl: [getProductionLinePage, getWorkshopSectionPage],
 | 
			
		||||
      tableProps:[],
 | 
			
		||||
      dataListLoading:false,
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        lineIds: [],
 | 
			
		||||
        time: ''
 | 
			
		||||
      },
 | 
			
		||||
      xData: [],
 | 
			
		||||
      yData:[],
 | 
			
		||||
      optionArrUrl: [getProductionLinePage ],
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '产线',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'productionLineId',
 | 
			
		||||
					defaultSelect: '',
 | 
			
		||||
          param: 'lineIds',
 | 
			
		||||
          defaultSelect: '',
 | 
			
		||||
          multiple:true,
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'datePicker',
 | 
			
		||||
					label: '时间',
 | 
			
		||||
					dateType: 'daterange',
 | 
			
		||||
					dateType: 'datetime',
 | 
			
		||||
					format: 'yyyy-MM-dd',
 | 
			
		||||
					valueFormat: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始时间',
 | 
			
		||||
					endPlaceholder: '结束时间',
 | 
			
		||||
					param: 'createTime',
 | 
			
		||||
          param: 'time',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '搜索',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '导出',
 | 
			
		||||
					name: 'export',
 | 
			
		||||
				},
 | 
			
		||||
				}
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	components: {
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getArr();
 | 
			
		||||
	},
 | 
			
		||||
@@ -120,19 +101,109 @@ export default {
 | 
			
		||||
			};
 | 
			
		||||
			this.optionArrUrl.forEach((item, index) => {
 | 
			
		||||
				item(params).then((response) => {
 | 
			
		||||
					this.formConfig[index].selectOptions = response.data.list;
 | 
			
		||||
					this.formConfig[index].selectOptions = response.data.list
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
    },
 | 
			
		||||
    getData() {
 | 
			
		||||
      // this.listQuery.lineIds = ['1672847052717821953']
 | 
			
		||||
      // this.listQuery.productId = val.productId;
 | 
			
		||||
      // this.listQuery.time = '1694486098000';
 | 
			
		||||
      this.urlOptions.getDataListURL(this.listQuery).then(res => {
 | 
			
		||||
        let arr = [
 | 
			
		||||
          	{
 | 
			
		||||
              prop: 'lineName',
 | 
			
		||||
          		label: '产线',
 | 
			
		||||
          		align: 'center',
 | 
			
		||||
          	},
 | 
			
		||||
            {
 | 
			
		||||
              prop: 'sum',
 | 
			
		||||
              label: '合计',
 | 
			
		||||
              align: 'center',
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
              prop: res.data.nameData[0].name,
 | 
			
		||||
              label: res.data.nameData[0].name,
 | 
			
		||||
              align: 'center',
 | 
			
		||||
              children:[
 | 
			
		||||
 | 
			
		||||
              ]
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
        console.log(res.data.nameData.slice(1))
 | 
			
		||||
        res.data.nameData.slice(1).forEach(item => {
 | 
			
		||||
          const props = {
 | 
			
		||||
            'prop': item.name,
 | 
			
		||||
            'label': item.name,
 | 
			
		||||
            'align': 'center'
 | 
			
		||||
          }
 | 
			
		||||
          arr[2].children.push(props)
 | 
			
		||||
        })
 | 
			
		||||
        let tableDataArr =[]
 | 
			
		||||
        res.data.data.forEach(item => {
 | 
			
		||||
          let obj = {}
 | 
			
		||||
          obj.lineName= item.lineName,
 | 
			
		||||
           obj.sum= item.sum,
 | 
			
		||||
          item.data.forEach((ele, index) => {
 | 
			
		||||
            // console.log(ele)
 | 
			
		||||
            ele.children.forEach((e) => {
 | 
			
		||||
              console.log(e.dynamicName)
 | 
			
		||||
              obj['' + e.dynamicName + ''] = e.dynamicValue
 | 
			
		||||
              console.log(obj['' + e.dynamicName + '']);
 | 
			
		||||
            })
 | 
			
		||||
          })
 | 
			
		||||
          tableDataArr.push(obj)
 | 
			
		||||
        });
 | 
			
		||||
        this.tableData = tableDataArr
 | 
			
		||||
        console.log(this.tableData)
 | 
			
		||||
        console.log(arr)
 | 
			
		||||
        this.tableProps = arr
 | 
			
		||||
        let xData = []
 | 
			
		||||
 | 
			
		||||
        res.data.nameData.slice(1).forEach(item => {
 | 
			
		||||
          xData.push(item.name)
 | 
			
		||||
          // arr[2].children.push(props)
 | 
			
		||||
        })
 | 
			
		||||
        let yAllData = []
 | 
			
		||||
        let lineName = []
 | 
			
		||||
        res.data.data.forEach(item => {
 | 
			
		||||
          let yData = []
 | 
			
		||||
          lineName.push(item.lineName)
 | 
			
		||||
          // let obj = {}
 | 
			
		||||
          // obj.lineName = item.lineName,
 | 
			
		||||
          //   obj.sum = item.sum,
 | 
			
		||||
          item.data.forEach((ele, index) => {
 | 
			
		||||
              // console.log(ele)
 | 
			
		||||
            ele.children.forEach((e) => {
 | 
			
		||||
              // let yData = []
 | 
			
		||||
              yData.push(e.dynamicValue)
 | 
			
		||||
              })
 | 
			
		||||
            })
 | 
			
		||||
          yAllData.push(yData)
 | 
			
		||||
        });
 | 
			
		||||
        console.log(lineName)
 | 
			
		||||
        // res.data.data[0].data[0].children.forEach((item, index) => {
 | 
			
		||||
        //   // console.log(item)
 | 
			
		||||
        //   yData.push(item.dynamicValue)
 | 
			
		||||
        //   // let data = 'data' + Number(index+1)
 | 
			
		||||
        //   // obj['' + item.dynamicName + ''] = item.dynamicValue
 | 
			
		||||
        // })
 | 
			
		||||
        // console.log(this.yData)
 | 
			
		||||
        this.$refs.lineChart.initChart(xData, yAllData, lineName)
 | 
			
		||||
        // this.total = response.data.total;
 | 
			
		||||
        // this.dataListLoading = false;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      // console.log(val)
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.listQuery.pageNo = 1;
 | 
			
		||||
					this.listQuery.pageSize = 10;
 | 
			
		||||
					this.listQuery.productionLineId = val.productionLineId;
 | 
			
		||||
					this.listQuery.productId = val.productId;
 | 
			
		||||
					this.listQuery.createTime = val.createTime;
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
        case 'search':
 | 
			
		||||
          this.listQuery.lineIds = val.lineIds ? val.lineIds :undefined
 | 
			
		||||
          // this.listQuery.productId = val.productId;
 | 
			
		||||
          this.listQuery.time = val.time ? new Date(val.time).getTime() : undefined
 | 
			
		||||
					// this.listQuery.pageNo = 1;
 | 
			
		||||
          // this.listQuery.pageSize = 10;
 | 
			
		||||
          this.getData()
 | 
			
		||||
					break;
 | 
			
		||||
				case 'reset':
 | 
			
		||||
					this.$refs.searchBarForm.resetForm();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * @Date: 2020-12-29 16:49:28
 | 
			
		||||
 * @LastEditors: zwq
 | 
			
		||||
 * @LastEditTime: 2023-08-01 11:10:04
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @LastEditTime: 2023-09-12 11:13:34
 | 
			
		||||
 * @FilePath: \basic-admin\src\filters\basicData\index.js
 | 
			
		||||
 * @Description:
 | 
			
		||||
 */
 | 
			
		||||
@@ -13,6 +13,11 @@ const table = {
 | 
			
		||||
    2: '停止',
 | 
			
		||||
    3: '未知',
 | 
			
		||||
  },
 | 
			
		||||
  reportType: {
 | 
			
		||||
    1: '日',
 | 
			
		||||
    2: '周',
 | 
			
		||||
    3: '月'
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 日期格式化
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-08-29 14:59:29
 | 
			
		||||
 * @LastEditTime: 2023-09-11 15:52:20
 | 
			
		||||
 * @LastEditTime: 2023-09-16 17:34:17
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
-->
 | 
			
		||||
@@ -32,100 +32,104 @@
 | 
			
		||||
			:limit.sync="listQuery.pageSize"
 | 
			
		||||
			:page.sync="listQuery.pageNo"
 | 
			
		||||
			:total="listQuery.total"
 | 
			
		||||
			@pagination="getDataList" />
 | 
			
		||||
		<!-- <div>
 | 
			
		||||
			<el-button @click="down()">1111</el-button>
 | 
			
		||||
			<el-table :data="tableData1" stripe style="width: 100%">
 | 
			
		||||
				<el-table-column prop="date" label="日期" width="180" />
 | 
			
		||||
				<el-table-column prop="name" label="姓名" />
 | 
			
		||||
				<el-table-column prop="address" label="地址" />
 | 
			
		||||
			</el-table>
 | 
			
		||||
			@pagination="getDataList"
 | 
			
		||||
		/>
 | 
			
		||||
		<!-- <div v-show="false" ref="pdf">
 | 
			
		||||
			<base-table
 | 
			
		||||
				v-loading="dataListLoading"
 | 
			
		||||
				:table-props="tableProps"
 | 
			
		||||
				:page="listQuery.pageNo"
 | 
			
		||||
				:limit="listQuery.pageSize"
 | 
			
		||||
				:table-data="selectedList"
 | 
			
		||||
			/>
 | 
			
		||||
		</div> -->
 | 
			
		||||
		<div ref="pdf" v-show="false">
 | 
			
		||||
			<el-table :data="selectedList" stripe border style="width: 100%">
 | 
			
		||||
				<el-table-column prop="reportType" label="报表类型" />
 | 
			
		||||
				<el-table-column prop="reportStartTime" label="统计开始时间" />
 | 
			
		||||
				<el-table-column prop="reportEndTime" label="统计结束时间" />
 | 
			
		||||
				<el-table-column prop="proLineName" label="产线名称" />
 | 
			
		||||
				<el-table-column prop="inputNum" label="投入数量/片" />
 | 
			
		||||
				<el-table-column prop="outputNum" label="产出数量/片" />
 | 
			
		||||
				<el-table-column prop="outputArea" label="产出面积/㎡" />
 | 
			
		||||
				<el-table-column prop="lossArea" label="损耗面积/㎡" />
 | 
			
		||||
				<el-table-column prop="lossRatio" label="损耗比例%" />
 | 
			
		||||
			</el-table>
 | 
			
		||||
		</div>
 | 
			
		||||
		<el-dialog
 | 
			
		||||
			title="提示"
 | 
			
		||||
			:visible.sync="dialogVisible"
 | 
			
		||||
			width="30%"
 | 
			
		||||
			:before-close="handleClose">
 | 
			
		||||
			<el-button type="primary" @click="exportXlsx">xlsx</el-button>
 | 
			
		||||
  		<el-button type="success" @click="exportPdf">pdf</el-button>
 | 
			
		||||
			<span slot="footer" class="dialog-footer">
 | 
			
		||||
				<el-button @click="dialogVisible = false">取 消</el-button>
 | 
			
		||||
				<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
 | 
			
		||||
			</span>
 | 
			
		||||
		</el-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import {
 | 
			
		||||
	getFactoryPage,
 | 
			
		||||
	exportFactoryExcel,
 | 
			
		||||
} from '@/api/core/base/factory';
 | 
			
		||||
import { getPdlAutoReport, getPdList } from '@/api/core/monitoring/auto'
 | 
			
		||||
// import jsPDF from 'jspdf'
 | 
			
		||||
// import html2canvas from 'html2canvas'
 | 
			
		||||
// import codeFilter from '../../mixins/code-filter'
 | 
			
		||||
import * as XLSX from 'xlsx'
 | 
			
		||||
import FileSaver from 'file-saver'
 | 
			
		||||
 | 
			
		||||
const tableData1 = [
 | 
			
		||||
	{
 | 
			
		||||
		date: '2016-05-03',
 | 
			
		||||
		name: 'fom',
 | 
			
		||||
		address: 'No'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		date: '2016-05-02',
 | 
			
		||||
		name: 'fom',
 | 
			
		||||
		address: '189'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		date: '2016-0225-03',
 | 
			
		||||
		name: 'fom',
 | 
			
		||||
		address: 'Ndddo'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		date: '2016-04445-02',
 | 
			
		||||
		name: 'fom',
 | 
			
		||||
		address: '18edd9'
 | 
			
		||||
	}
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		prop: 'reportType',
 | 
			
		||||
		label: '报表类型',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		align: 'center'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		prop: 'reportStartTime',
 | 
			
		||||
		label: '统计开始时间',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime3',
 | 
			
		||||
		prop: 'reportEndTime',
 | 
			
		||||
		label: '统计结束时间',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		prop: 'proLineName',
 | 
			
		||||
		label: '产线名称',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'address',
 | 
			
		||||
		prop: 'inputNum',
 | 
			
		||||
		label: '投入数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark44',
 | 
			
		||||
		prop: 'outputNum',
 | 
			
		||||
		label: '产出数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark23',
 | 
			
		||||
		prop: 'outputArea',
 | 
			
		||||
		label: '产出面积/㎡',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark145',
 | 
			
		||||
		prop: 'lossNum',
 | 
			
		||||
		label: '损耗数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark22',
 | 
			
		||||
		prop: 'lossArea',
 | 
			
		||||
		label: '损耗面积/㎡',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark1',
 | 
			
		||||
		prop: 'lossRatio',
 | 
			
		||||
		label: '损耗比例%',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	}
 | 
			
		||||
@@ -135,16 +139,8 @@ export default {
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getFactoryPage,
 | 
			
		||||
				exportURL: exportFactoryExcel,
 | 
			
		||||
				getDataListURL: getPdlAutoReport
 | 
			
		||||
			},
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
        getDataListURL: '',
 | 
			
		||||
        deleteURL: '',
 | 
			
		||||
        statusUrl: '',
 | 
			
		||||
        exportURL: ''
 | 
			
		||||
      },
 | 
			
		||||
      tableData1,
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
@@ -152,10 +148,12 @@ export default {
 | 
			
		||||
      },
 | 
			
		||||
      exportLoading: false,
 | 
			
		||||
      dataListLoading: false,
 | 
			
		||||
			dialogVisible: false,
 | 
			
		||||
      addOrEditTitle: '',
 | 
			
		||||
      addOrUpdateVisible: false,
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [],
 | 
			
		||||
			selectedList: [],
 | 
			
		||||
			// tableBtn: [
 | 
			
		||||
			// 	this.$auth.hasPermi(`base:factory:update`)
 | 
			
		||||
			// 		? {
 | 
			
		||||
@@ -181,8 +179,21 @@ export default {
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '报表类型',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'name',
 | 
			
		||||
					selectOptions: [
 | 
			
		||||
						{
 | 
			
		||||
							id: 1,
 | 
			
		||||
							name: '日'
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							id: 2,
 | 
			
		||||
							name: '周'
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							id: 3,
 | 
			
		||||
							name: '月'
 | 
			
		||||
						}
 | 
			
		||||
					],
 | 
			
		||||
					param: 'reportType',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
          type: 'datePicker',
 | 
			
		||||
@@ -216,16 +227,63 @@ export default {
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getDataList()
 | 
			
		||||
		this.getPdLineList()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		exportPdf() {
 | 
			
		||||
			this.pdf()
 | 
			
		||||
			this.dialogVisible = false
 | 
			
		||||
		},
 | 
			
		||||
		exportXlsx() {
 | 
			
		||||
			this.down()
 | 
			
		||||
			this.dialogVisible = false
 | 
			
		||||
		},
 | 
			
		||||
		// imgDownload() {
 | 
			
		||||
		// 	let that = this
 | 
			
		||||
		// 	let img = this.$refs['pdf']
 | 
			
		||||
		// 	// 图片高度
 | 
			
		||||
		// 	var w = parseInt(window.getComputedStyle(img).width)
 | 
			
		||||
		// 	// 图片宽度
 | 
			
		||||
		// 	var h = parseInt(window.getComputedStyle(img).height)
 | 
			
		||||
		// 	// 滚轮置顶,避免留白
 | 
			
		||||
		// 	window.pageYOffset = 0
 | 
			
		||||
		// 	html2canvas(img).then(function(canvas) {
 | 
			
		||||
 | 
			
		||||
		// 	})
 | 
			
		||||
		// },
 | 
			
		||||
		pdf() {
 | 
			
		||||
			// console.log('打印看看[df]')
 | 
			
		||||
			// const pdf = new jsPDF()
 | 
			
		||||
			// const content = this.$refs.pdf.innerHTML
 | 
			
		||||
			// console.log('打印看看', content)
 | 
			
		||||
			// pdf.text(content, 15, 15)
 | 
			
		||||
			// // pdf.text('Hello world!', 10, 10)
 | 
			
		||||
			// pdf.save('test.pdf')
 | 
			
		||||
			// console.log('打印看看', pdf)
 | 
			
		||||
			const printWindow = window.open('', '_blank')
 | 
			
		||||
			const temp = this.$refs.pdf.innerHTML
 | 
			
		||||
			console.log(temp)
 | 
			
		||||
			printWindow.document.body.innerHTML = temp
 | 
			
		||||
			printWindow.focus()
 | 
			
		||||
			// printWindow.document.writeln(this.$refs.pdf.innerHTML)
 | 
			
		||||
			printWindow.document.close()
 | 
			
		||||
			printWindow.print()
 | 
			
		||||
		},
 | 
			
		||||
		handleClose(done) {
 | 
			
		||||
			this.$confirm('确认关闭?')
 | 
			
		||||
				.then(_ => {
 | 
			
		||||
					done();
 | 
			
		||||
				})
 | 
			
		||||
				.catch(_ => {});
 | 
			
		||||
		},
 | 
			
		||||
		down() {
 | 
			
		||||
			//选中导出时可更改此处数组
 | 
			
		||||
      const selectedData = this.tableData1.slice(0, 2)
 | 
			
		||||
			console.log('你好', selectedData, this.tableData1)
 | 
			
		||||
			//选中导出时可更改此处数组 选中的数组
 | 
			
		||||
			//构建导出的表格数据
 | 
			
		||||
			const exportData = [
 | 
			
		||||
				{date: '日期', name: '姓名', address: '地址'},
 | 
			
		||||
				...selectedData
 | 
			
		||||
				{reportType: '报表类型', reportStartTime: '统计开始时间', reportEndTime: '统计结束时间', proLineName: '产线名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' },
 | 
			
		||||
				...this.selectedList
 | 
			
		||||
			]
 | 
			
		||||
			//注意表格上绑定id, 获取dom元素
 | 
			
		||||
			const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
 | 
			
		||||
@@ -233,7 +291,7 @@ export default {
 | 
			
		||||
			XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
 | 
			
		||||
			const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
 | 
			
		||||
			try {
 | 
			
		||||
				FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), 'hihi.xlsx')
 | 
			
		||||
				FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '产线统计自动报表.xlsx')
 | 
			
		||||
			} catch (e) {
 | 
			
		||||
				console.log(e)
 | 
			
		||||
			}
 | 
			
		||||
@@ -241,14 +299,22 @@ export default {
 | 
			
		||||
		selectChange(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      this.selectedList = val
 | 
			
		||||
			console.log('勾选数据', this.selectedList)
 | 
			
		||||
    },
 | 
			
		||||
		getPdLineList() {
 | 
			
		||||
			getPdList().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.listQuery.pageNo = 1;
 | 
			
		||||
					this.listQuery.pageSize = 10;
 | 
			
		||||
					this.listQuery.name = val.name;
 | 
			
		||||
					this.listQuery.code = val.code;
 | 
			
		||||
					this.listQuery.lineId = val.line ? val.line : undefined;
 | 
			
		||||
					this.listQuery.reportType = val.reportType ? val.reportType : undefined;
 | 
			
		||||
					this.listQuery.reportStartTime = [new Date(val.timeVal[0]).getTime()];
 | 
			
		||||
					this.listQuery.reportEndTime = [new Date(val.timeVal[1]).getTime()];
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
					break;
 | 
			
		||||
				case 'export':
 | 
			
		||||
@@ -262,7 +328,10 @@ export default {
 | 
			
		||||
    getDataList() {
 | 
			
		||||
      this.dataListLoading = true;
 | 
			
		||||
      this.urlOptions.getDataListURL(this.listQuery).then(response => {
 | 
			
		||||
        this.tableData = response.data.list;
 | 
			
		||||
        this.tableData = response.data.list.map(item => {
 | 
			
		||||
					item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月'
 | 
			
		||||
					return item
 | 
			
		||||
				});
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
        this.dataListLoading = false;
 | 
			
		||||
      });
 | 
			
		||||
@@ -279,17 +348,15 @@ export default {
 | 
			
		||||
      this.getDataList();
 | 
			
		||||
    },
 | 
			
		||||
		handleExport() {
 | 
			
		||||
      // 处理查询参数
 | 
			
		||||
      let params = { ...this.queryParams };
 | 
			
		||||
      params.pageNo = undefined;
 | 
			
		||||
      params.pageSize = undefined;
 | 
			
		||||
      this.$modal.confirm('是否确认导出所有数据项?').then(() => {
 | 
			
		||||
        this.exportLoading = true;
 | 
			
		||||
        return this.urlOptions.exportURL(params);
 | 
			
		||||
      }).then(response => {
 | 
			
		||||
        this.$download.excel(response, '工厂.xls');
 | 
			
		||||
        this.exportLoading = false;
 | 
			
		||||
      }).catch(() => { });
 | 
			
		||||
			if (this.selectedList.length === 0) {
 | 
			
		||||
				this.selectedList = this.tableData
 | 
			
		||||
			}
 | 
			
		||||
			this.dialogVisible = true
 | 
			
		||||
      // this.$modal.confirm('是否确认导出所选数据项?').then(() => {
 | 
			
		||||
      //   this.exportLoading = true;
 | 
			
		||||
      //   // this.down()
 | 
			
		||||
			// 	this.pdf()
 | 
			
		||||
      // }).catch(() => { });
 | 
			
		||||
    }
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-08-29 14:59:29
 | 
			
		||||
 * @LastEditTime: 2023-08-31 15:15:31
 | 
			
		||||
 * @LastEditTime: 2023-09-16 17:42:37
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
-->
 | 
			
		||||
@@ -33,50 +33,65 @@
 | 
			
		||||
			:page.sync="listQuery.pageNo"
 | 
			
		||||
			:total="listQuery.total"
 | 
			
		||||
			@pagination="getDataList" />
 | 
			
		||||
		<div ref="pdf" v-show="false">
 | 
			
		||||
			<el-table :data="selectedList" stripe border style="width: 100%">
 | 
			
		||||
				<el-table-column prop="proLineName" label="产线名称" />
 | 
			
		||||
				<el-table-column prop="inputNum" label="投入数量/片" />
 | 
			
		||||
				<el-table-column prop="outputNum" label="产出数量/片" />
 | 
			
		||||
				<el-table-column prop="outputArea" label="产出面积/㎡" />
 | 
			
		||||
				<el-table-column prop="lossNum" label="损耗数量/片" />
 | 
			
		||||
				<el-table-column prop="lossArea" label="损耗面积/㎡" />
 | 
			
		||||
				<el-table-column prop="lossRatio" label="损耗比例%" />
 | 
			
		||||
			</el-table>
 | 
			
		||||
		</div>
 | 
			
		||||
		<el-dialog
 | 
			
		||||
			title="提示"
 | 
			
		||||
			:visible.sync="dialogVisible"
 | 
			
		||||
			width="30%"
 | 
			
		||||
			:before-close="handleClose">
 | 
			
		||||
			<el-button type="primary" @click="exportXlsx">xlsx</el-button>
 | 
			
		||||
  		<el-button type="success" @click="exportPdf">pdf</el-button>
 | 
			
		||||
			<span slot="footer" class="dialog-footer">
 | 
			
		||||
				<el-button @click="dialogVisible = false">取 消</el-button>
 | 
			
		||||
				<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
 | 
			
		||||
			</span>
 | 
			
		||||
		</el-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import {
 | 
			
		||||
	getFactoryPage,
 | 
			
		||||
	exportFactoryExcel,
 | 
			
		||||
} from '@/api/core/base/factory';
 | 
			
		||||
import { getPdlDataSearch, getPdList } from '@/api/core/monitoring/data'
 | 
			
		||||
import * as XLSX from 'xlsx'
 | 
			
		||||
import FileSaver from 'file-saver'
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '产线名称',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'proLineName',
 | 
			
		||||
		label: '产线名称'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'address',
 | 
			
		||||
		label: '投入数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'inputNum',
 | 
			
		||||
		label: '投入数量/片'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark44',
 | 
			
		||||
		label: '产出数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'outputNum',
 | 
			
		||||
		label: '产出数量/片'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark23',
 | 
			
		||||
		label: '产出面积/㎡',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'outputArea',
 | 
			
		||||
		label: '产出面积/㎡'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark145',
 | 
			
		||||
		label: '损耗数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lossNum',
 | 
			
		||||
		label: '损耗数量/片'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark22',
 | 
			
		||||
		label: '损耗面积/㎡',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lossArea',
 | 
			
		||||
		label: '损耗面积/㎡'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark1',
 | 
			
		||||
		label: '损耗比例%',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lossRate',
 | 
			
		||||
		label: '损耗比例%'
 | 
			
		||||
	}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -84,28 +99,24 @@ export default {
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getFactoryPage,
 | 
			
		||||
				exportURL: exportFactoryExcel,
 | 
			
		||||
				getDataListURL: getPdlDataSearch
 | 
			
		||||
			},
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
        getDataListURL: '',
 | 
			
		||||
        deleteURL: '',
 | 
			
		||||
        statusUrl: '',
 | 
			
		||||
        exportURL: ''
 | 
			
		||||
      },
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
        pageNo: 1,
 | 
			
		||||
        total: 1,
 | 
			
		||||
				proLineId: undefined
 | 
			
		||||
      },
 | 
			
		||||
      exportLoading: false,
 | 
			
		||||
      dataListLoading: false,
 | 
			
		||||
			dialogVisible: false,
 | 
			
		||||
      addOrEditTitle: '',
 | 
			
		||||
      addOrUpdateVisible: false,
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [],
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			selectedList: [],
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
@@ -145,8 +156,57 @@ export default {
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getDataList()
 | 
			
		||||
		this.getPdLineList()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		exportPdf() {
 | 
			
		||||
			this.pdf()
 | 
			
		||||
			this.dialogVisible = false
 | 
			
		||||
		},
 | 
			
		||||
		exportXlsx() {
 | 
			
		||||
			this.down()
 | 
			
		||||
			this.dialogVisible = false
 | 
			
		||||
		},
 | 
			
		||||
		pdf() {
 | 
			
		||||
			const printWindow = window.open('', '_blank')
 | 
			
		||||
			const temp = this.$refs.pdf.innerHTML
 | 
			
		||||
			console.log(temp)
 | 
			
		||||
			printWindow.document.body.innerHTML = temp
 | 
			
		||||
			printWindow.document.close()
 | 
			
		||||
			printWindow.print()
 | 
			
		||||
		},
 | 
			
		||||
		down() {
 | 
			
		||||
			//选中导出时可更改此处数组 选中的数组
 | 
			
		||||
			//构建导出的表格数据
 | 
			
		||||
			const exportData = [
 | 
			
		||||
				{proLineName: '产线名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' },
 | 
			
		||||
				...this.selectedList
 | 
			
		||||
			]
 | 
			
		||||
			//注意表格上绑定id, 获取dom元素
 | 
			
		||||
			const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
 | 
			
		||||
			const workbook = XLSX.utils.book_new()
 | 
			
		||||
			XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
 | 
			
		||||
			const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
 | 
			
		||||
			try {
 | 
			
		||||
				FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '产线统计数据查询.xlsx')
 | 
			
		||||
			} catch (e) {
 | 
			
		||||
				console.log(e)
 | 
			
		||||
			}
 | 
			
		||||
    },
 | 
			
		||||
		handleClose(done) {
 | 
			
		||||
			this.$confirm('确认关闭?')
 | 
			
		||||
				.then(_ => {
 | 
			
		||||
					done();
 | 
			
		||||
				})
 | 
			
		||||
				.catch(_ => {});
 | 
			
		||||
		},
 | 
			
		||||
		getPdLineList() {
 | 
			
		||||
			getPdList().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		selectChange(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      this.selectedList = val
 | 
			
		||||
@@ -156,8 +216,9 @@ export default {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.listQuery.pageNo = 1;
 | 
			
		||||
					this.listQuery.pageSize = 10;
 | 
			
		||||
					this.listQuery.name = val.name;
 | 
			
		||||
					this.listQuery.code = val.code;
 | 
			
		||||
					this.listQuery.proLineId = val.line ? val.line : undefined;
 | 
			
		||||
					this.listQuery.startTime = val.timeVal ? new Date(val.timeVal[0]).getTime() : undefined;
 | 
			
		||||
					this.listQuery.endTime = val.timeVal ? new Date(val.timeVal[1]).getTime() : undefined;
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
					break;
 | 
			
		||||
				case 'export':
 | 
			
		||||
@@ -171,7 +232,7 @@ export default {
 | 
			
		||||
    getDataList() {
 | 
			
		||||
      this.dataListLoading = true;
 | 
			
		||||
      this.urlOptions.getDataListURL(this.listQuery).then(response => {
 | 
			
		||||
        this.tableData = response.data.list;
 | 
			
		||||
        this.tableData = response.data;
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
        this.dataListLoading = false;
 | 
			
		||||
      });
 | 
			
		||||
@@ -188,17 +249,21 @@ export default {
 | 
			
		||||
      this.getDataList();
 | 
			
		||||
    },
 | 
			
		||||
		handleExport() {
 | 
			
		||||
			if (this.selectedList.length === 0) {
 | 
			
		||||
				this.selectedList = this.tableData
 | 
			
		||||
			}
 | 
			
		||||
			this.dialogVisible = true
 | 
			
		||||
      // 处理查询参数
 | 
			
		||||
      let params = { ...this.queryParams };
 | 
			
		||||
      params.pageNo = undefined;
 | 
			
		||||
      params.pageSize = undefined;
 | 
			
		||||
      this.$modal.confirm('是否确认导出所有数据项?').then(() => {
 | 
			
		||||
        this.exportLoading = true;
 | 
			
		||||
        return this.urlOptions.exportURL(params);
 | 
			
		||||
      }).then(response => {
 | 
			
		||||
        this.$download.excel(response, '工厂.xls');
 | 
			
		||||
        this.exportLoading = false;
 | 
			
		||||
      }).catch(() => { });
 | 
			
		||||
      // let params = { ...this.queryParams };
 | 
			
		||||
      // params.pageNo = undefined;
 | 
			
		||||
      // params.pageSize = undefined;
 | 
			
		||||
      // this.$modal.confirm('是否确认导出所有数据项?').then(() => {
 | 
			
		||||
      //   this.exportLoading = true;
 | 
			
		||||
      //   return this.urlOptions.exportURL(params);
 | 
			
		||||
      // }).then(response => {
 | 
			
		||||
      //   this.$download.excel(response, '工厂.xls');
 | 
			
		||||
      //   this.exportLoading = false;
 | 
			
		||||
      // }).catch(() => { });
 | 
			
		||||
    }
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										207
									
								
								src/views/core/monitoring/data24/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										207
									
								
								src/views/core/monitoring/data24/index.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,207 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: index.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2023-08-04 14:44:58
 | 
			
		||||
    description: 设备24小时生产记录
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<SearchBar
 | 
			
		||||
			:formConfigs="[{ label: '设备近24小时产线生产数据', type: 'title' }]"
 | 
			
		||||
			ref="search-bar" />
 | 
			
		||||
		<el-skeleton v-if="initing" :rows="6" animated />
 | 
			
		||||
		<base-table
 | 
			
		||||
			v-else
 | 
			
		||||
			:span-method="mergeColumnHandler"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:table-data="tableData"
 | 
			
		||||
			@emitFun="handleEmitFun"></base-table>
 | 
			
		||||
		<!-- :page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize" -->
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'productionLineData24',
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
      urlOptions: {
 | 
			
		||||
				getDataListURL: getPdlDataOneDay
 | 
			
		||||
			},
 | 
			
		||||
			initing: false,
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
			},
 | 
			
		||||
			list: [],
 | 
			
		||||
			arr: [],
 | 
			
		||||
			spanArr: [], 
 | 
			
		||||
			timeList: [],
 | 
			
		||||
			tableData: [],
 | 
			
		||||
			tableProps: [],
 | 
			
		||||
			spanInfo: {},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	computed: {},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		/** 构建tableProps - 依据第一个元素所提供的信息 */
 | 
			
		||||
		buildProps(plData) {
 | 
			
		||||
			plData.forEach(item => {
 | 
			
		||||
				this.timeList.push(item.name)
 | 
			
		||||
			})
 | 
			
		||||
			const timeArray = Array.from(new Set(this.timeList))
 | 
			
		||||
			console.log('nihc', timeArray)
 | 
			
		||||
			for (const times of timeArray) {
 | 
			
		||||
				if (times !== '投入数量' && times !== '产出数量' && times !== '报废数量' && times !== '产出面积') {
 | 
			
		||||
					const subprop = {
 | 
			
		||||
						label: times,
 | 
			
		||||
						align: 'center',
 | 
			
		||||
						children: [
 | 
			
		||||
							{ prop: times + '_in', label: '投入数量', align: 'center' },
 | 
			
		||||
							{ prop: times + '_out', label: '产出数量', align: 'center' },
 | 
			
		||||
							{ prop: times + '_junk', label: '报废数量', align: 'center' },
 | 
			
		||||
							{ prop: times + '_area', label: '产出面积', align: 'center' }
 | 
			
		||||
						]
 | 
			
		||||
					}
 | 
			
		||||
					this.arr.push(subprop)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			this.tableProps = this.arr
 | 
			
		||||
		},
 | 
			
		||||
		setRowSpan(arr) {
 | 
			
		||||
      let count = 0
 | 
			
		||||
      arr.forEach((item, index) => {
 | 
			
		||||
        if(index === 0) {
 | 
			
		||||
          this.spanArr.push(1)
 | 
			
		||||
        } else {
 | 
			
		||||
          if (item === arr[index - 1]) {
 | 
			
		||||
            this.spanArr[count] += 1
 | 
			
		||||
            this.spanArr.push(0)
 | 
			
		||||
          } else {
 | 
			
		||||
            count = index
 | 
			
		||||
            this.spanArr.push(1)
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      console.log('打印数组长度', this.spanArr)
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
		/** 把 list 里的数据转换成 tableProps 对应的格式 */
 | 
			
		||||
		convertList(list) {
 | 
			
		||||
			let sectionArr= []
 | 
			
		||||
			console.log('打印看下数据list', list)
 | 
			
		||||
			list.forEach((ele, index) => {
 | 
			
		||||
				let tempData = []
 | 
			
		||||
				ele.data.forEach(item => {
 | 
			
		||||
					item.children.forEach(params => {
 | 
			
		||||
						if (params.dynamicName === '投入数量') {
 | 
			
		||||
							tempData[item.dynamicName + '_in'] = params.dynamicValue
 | 
			
		||||
						} else if (params.dynamicName === '产出数量') {
 | 
			
		||||
							tempData[item.dynamicName + '_out'] = params.dynamicValue
 | 
			
		||||
						} else if (params.dynamicName === '报废数量') {
 | 
			
		||||
							tempData[item.dynamicName + '_junk'] = params.dynamicValue
 | 
			
		||||
						} else {
 | 
			
		||||
							tempData[item.dynamicName + '_area'] = params.dynamicValue
 | 
			
		||||
						}
 | 
			
		||||
					})
 | 
			
		||||
				})
 | 
			
		||||
				tempData['proLineName'] = ele.proLineName
 | 
			
		||||
				tempData['spec'] = ele.spec
 | 
			
		||||
				this.tableData.push(tempData)
 | 
			
		||||
				console.log('看看数据', this.tableData, tempData)
 | 
			
		||||
				const { sectionName } = tempData
 | 
			
		||||
				sectionArr.push(sectionName)
 | 
			
		||||
			})
 | 
			
		||||
			this.setRowSpan(sectionArr)
 | 
			
		||||
			console.log('工段名称列表', sectionArr)
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		buildData(data) {
 | 
			
		||||
			this.convertList(data);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		/** 合并table列的规则 */
 | 
			
		||||
		mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
 | 
			
		||||
			if (columnIndex == 0) {
 | 
			
		||||
				if (this.spanArr[rowIndex]) {
 | 
			
		||||
					return [
 | 
			
		||||
						this.spanArr[rowIndex], // row span
 | 
			
		||||
						1, // col span
 | 
			
		||||
					];
 | 
			
		||||
				} else {
 | 
			
		||||
					return [0, 0];
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		async getList() {
 | 
			
		||||
      this.urlOptions.getDataListURL().then(res => {
 | 
			
		||||
        console.log('看看数据', res)
 | 
			
		||||
				this.arr = [
 | 
			
		||||
          {
 | 
			
		||||
            prop: 'proLineName',
 | 
			
		||||
            label: '生产线',
 | 
			
		||||
            align: 'center',
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            prop: 'spec',
 | 
			
		||||
            label: '产品规格',
 | 
			
		||||
            align: 'center',
 | 
			
		||||
          }
 | 
			
		||||
				]
 | 
			
		||||
				this.buildProps(res.data.nameData);
 | 
			
		||||
				this.buildData(res.data.data);
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
			// // const data = this.res.data;
 | 
			
		||||
			// // console.log('recent-24', data);
 | 
			
		||||
 | 
			
		||||
			// this.initing = true;
 | 
			
		||||
			
 | 
			
		||||
			// this.queryParams.pageSize = this.list.length;
 | 
			
		||||
 | 
			
		||||
			// setTimeout(() => {
 | 
			
		||||
			// 	this.initing = false;
 | 
			
		||||
			// }, 1000);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		handleEmitFun(payload) {
 | 
			
		||||
			console.log('payload', payload);
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
::-webkit-scrollbar {
 | 
			
		||||
	display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pre {
 | 
			
		||||
	margin: 10px;
 | 
			
		||||
	background: #f6f8faf6;
 | 
			
		||||
	border: 1px solid #e1e4e8;
 | 
			
		||||
	padding: 12px;
 | 
			
		||||
	border-radius: 12px;
 | 
			
		||||
	position: fixed;
 | 
			
		||||
	// top: 15vh;
 | 
			
		||||
	top: 10vh;
 | 
			
		||||
	left: 0;
 | 
			
		||||
	max-height: 80vh;
 | 
			
		||||
	overflow-y: auto;
 | 
			
		||||
	z-index: 100000;
 | 
			
		||||
	box-shadow: 0 0 32px 12px #0001;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
code {
 | 
			
		||||
	font-family: 'IntelOne Mono', 'Ubuntu', 'Courier New', Courier, monospace;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-08-29 14:59:29
 | 
			
		||||
 * @LastEditTime: 2023-08-31 15:31:40
 | 
			
		||||
 * @LastEditTime: 2023-09-16 17:41:53
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description: 
 | 
			
		||||
-->
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<search-bar
 | 
			
		||||
			:formConfigs="formConfig"
 | 
			
		||||
			:isFold="true"
 | 
			
		||||
			ref="searchBarForm"
 | 
			
		||||
			@headBtnClick="buttonClick" />
 | 
			
		||||
		<base-table
 | 
			
		||||
@@ -33,73 +34,88 @@
 | 
			
		||||
			:page.sync="listQuery.pageNo"
 | 
			
		||||
			:total="listQuery.total"
 | 
			
		||||
			@pagination="getDataList" />
 | 
			
		||||
		<div ref="pdf" v-show="false">
 | 
			
		||||
			<el-table :data="selectedList" stripe border style="width: 100%">
 | 
			
		||||
				<el-table-column prop="reportType" label="产线类型" />
 | 
			
		||||
				<el-table-column prop="reportStartTime" label="统计开始时间" />
 | 
			
		||||
				<el-table-column prop="reportEndTime" label="统计结束时间" />
 | 
			
		||||
				<el-table-column prop="proLineName" label="产线名称" />
 | 
			
		||||
				<el-table-column prop="sectionName" label="工段名称" />
 | 
			
		||||
				<el-table-column prop="inputNum" label="投入数量/片" />
 | 
			
		||||
				<el-table-column prop="outputNum" label="产出数量/片" />
 | 
			
		||||
				<el-table-column prop="outputArea" label="产出面积/㎡" />
 | 
			
		||||
				<el-table-column prop="lossNum" label="损耗数量/片" />
 | 
			
		||||
				<el-table-column prop="lossArea" label="损耗面积/㎡" />
 | 
			
		||||
				<el-table-column prop="lossRatio" label="损耗比例%" />
 | 
			
		||||
			</el-table>
 | 
			
		||||
		</div>
 | 
			
		||||
		<el-dialog
 | 
			
		||||
			title="提示"
 | 
			
		||||
			:visible.sync="dialogVisible"
 | 
			
		||||
			width="30%"
 | 
			
		||||
			:before-close="handleClose">
 | 
			
		||||
			<el-button type="primary" @click="exportXlsx">xlsx</el-button>
 | 
			
		||||
  		<el-button type="success" @click="exportPdf">pdf</el-button>
 | 
			
		||||
			<span slot="footer" class="dialog-footer">
 | 
			
		||||
				<el-button @click="dialogVisible = false">取 消</el-button>
 | 
			
		||||
				<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
 | 
			
		||||
			</span>
 | 
			
		||||
		</el-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import {
 | 
			
		||||
	getFactoryPage,
 | 
			
		||||
	exportFactoryExcel,
 | 
			
		||||
} from '@/api/core/base/factory';
 | 
			
		||||
import { getWorkshopSectionList, getPdList, getSectionAutoReport  } from '@/api/core/monitoring/sectionStatistics'
 | 
			
		||||
import * as XLSX from 'xlsx'
 | 
			
		||||
import FileSaver from 'file-saver'
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '产线类型',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'reportType',
 | 
			
		||||
		label: '产线类型'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime',
 | 
			
		||||
		prop: 'reportStartTime',
 | 
			
		||||
		label: '统计开始时间',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'createTime3',
 | 
			
		||||
		prop: 'reportEndTime',
 | 
			
		||||
		label: '统计结束时间',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		filter: parseTime,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		label: '产线名称',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lineName',
 | 
			
		||||
		label: '产线名称'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name1',
 | 
			
		||||
		label: '工段名称',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'sectionName',
 | 
			
		||||
		label: '工段名称'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'address',
 | 
			
		||||
		label: '投入数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'inputNum',
 | 
			
		||||
		label: '投入数量/片'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark44',
 | 
			
		||||
		label: '产出数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'outputNum',
 | 
			
		||||
		label: '产出数量/片'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark23',
 | 
			
		||||
		label: '产出面积/㎡',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'outputArea',
 | 
			
		||||
		label: '产出面积/㎡'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark145',
 | 
			
		||||
		label: '损耗数量/片',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lossNum',
 | 
			
		||||
		label: '损耗数量/片'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark22',
 | 
			
		||||
		label: '损耗面积/㎡',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lossArea',
 | 
			
		||||
		label: '损耗面积/㎡'
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'remark1',
 | 
			
		||||
		label: '损耗比例%',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
		prop: 'lossRatio',
 | 
			
		||||
		label: '损耗比例%'
 | 
			
		||||
	}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -107,15 +123,8 @@ export default {
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getFactoryPage,
 | 
			
		||||
				exportURL: exportFactoryExcel,
 | 
			
		||||
				getDataListURL: getSectionAutoReport
 | 
			
		||||
			},
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
        getDataListURL: '',
 | 
			
		||||
        deleteURL: '',
 | 
			
		||||
        statusUrl: '',
 | 
			
		||||
        exportURL: ''
 | 
			
		||||
      },
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
@@ -124,6 +133,8 @@ export default {
 | 
			
		||||
      },
 | 
			
		||||
      exportLoading: false,
 | 
			
		||||
      dataListLoading: false,
 | 
			
		||||
			selectedList: [],
 | 
			
		||||
			dialogVisible: false,
 | 
			
		||||
      addOrEditTitle: '',
 | 
			
		||||
      addOrUpdateVisible: false,
 | 
			
		||||
			tableProps,
 | 
			
		||||
@@ -145,8 +156,21 @@ export default {
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '报表类型',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'name',
 | 
			
		||||
					selectOptions: [
 | 
			
		||||
						{
 | 
			
		||||
							id: 1,
 | 
			
		||||
							name: '日'
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							id: 2,
 | 
			
		||||
							name: '周'
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							id: 3,
 | 
			
		||||
							name: '月'
 | 
			
		||||
						}
 | 
			
		||||
					],
 | 
			
		||||
					param: 'reportType',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
          type: 'datePicker',
 | 
			
		||||
@@ -158,8 +182,7 @@ export default {
 | 
			
		||||
          startPlaceholder: '开始时间',
 | 
			
		||||
          endPlaceholder: '结束时间',
 | 
			
		||||
          param: 'timeVal',
 | 
			
		||||
          defaultSelect: [],
 | 
			
		||||
          width: 350
 | 
			
		||||
          defaultSelect: []
 | 
			
		||||
        },
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
@@ -180,8 +203,61 @@ export default {
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getDataList()
 | 
			
		||||
		this.getPdLineList()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		exportPdf() {
 | 
			
		||||
			this.pdf()
 | 
			
		||||
			this.dialogVisible = false
 | 
			
		||||
		},
 | 
			
		||||
		exportXlsx() {
 | 
			
		||||
			this.down()
 | 
			
		||||
			this.dialogVisible = false
 | 
			
		||||
		},
 | 
			
		||||
		pdf() {
 | 
			
		||||
			const printWindow = window.open('', '_blank')
 | 
			
		||||
			const temp = this.$refs.pdf.innerHTML
 | 
			
		||||
			console.log(temp)
 | 
			
		||||
			printWindow.document.body.innerHTML = temp
 | 
			
		||||
			printWindow.document.close()
 | 
			
		||||
			printWindow.print()
 | 
			
		||||
		},
 | 
			
		||||
		down() {
 | 
			
		||||
			//选中导出时可更改此处数组 选中的数组
 | 
			
		||||
			//构建导出的表格数据
 | 
			
		||||
			const exportData = [
 | 
			
		||||
				{reportType: '产线类型', reportStartTime: '统计开始时间', reportEndTime: '统计结束时间', lineName: '产线名称', sectionName: '工段名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' },
 | 
			
		||||
				...this.selectedList
 | 
			
		||||
			]
 | 
			
		||||
			//注意表格上绑定id, 获取dom元素
 | 
			
		||||
			const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
 | 
			
		||||
			const workbook = XLSX.utils.book_new()
 | 
			
		||||
			XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
 | 
			
		||||
			const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
 | 
			
		||||
			try {
 | 
			
		||||
				FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '工段统计自动报表.xlsx')
 | 
			
		||||
			} catch (e) {
 | 
			
		||||
				console.log(e)
 | 
			
		||||
			}
 | 
			
		||||
    },
 | 
			
		||||
		handleClose(done) {
 | 
			
		||||
			this.$confirm('确认关闭?')
 | 
			
		||||
				.then(_ => {
 | 
			
		||||
					done();
 | 
			
		||||
				})
 | 
			
		||||
				.catch(_ => {});
 | 
			
		||||
		},
 | 
			
		||||
		getPdLineList() {
 | 
			
		||||
			getPdList().then((res) => {
 | 
			
		||||
				this.formConfig[0].selectOptions = res.data || []
 | 
			
		||||
			})
 | 
			
		||||
			// 获取工段list
 | 
			
		||||
			getWorkshopSectionList().then((res) => {
 | 
			
		||||
				this.formConfig[1].selectOptions = res.data || []
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		selectChange(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      this.selectedList = val
 | 
			
		||||
@@ -191,8 +267,11 @@ export default {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.listQuery.pageNo = 1;
 | 
			
		||||
					this.listQuery.pageSize = 10;
 | 
			
		||||
					this.listQuery.name = val.name;
 | 
			
		||||
					this.listQuery.code = val.code;
 | 
			
		||||
					this.listQuery.lineId = val.line ? val.line : undefined;
 | 
			
		||||
					this.listQuery.sectionId = val.section ? val.section : undefined;
 | 
			
		||||
					this.listQuery.reportType = val.reportType ? val.reportType : undefined;
 | 
			
		||||
					this.listQuery.reportStartTime = [new Date(val.timeVal[0]).getTime()];
 | 
			
		||||
					this.listQuery.reportEndTime = [new Date(val.timeVal[1]).getTime()];
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
					break;
 | 
			
		||||
				case 'export':
 | 
			
		||||
@@ -206,7 +285,10 @@ export default {
 | 
			
		||||
    getDataList() {
 | 
			
		||||
      this.dataListLoading = true;
 | 
			
		||||
      this.urlOptions.getDataListURL(this.listQuery).then(response => {
 | 
			
		||||
        this.tableData = response.data.list;
 | 
			
		||||
        this.tableData = response.data.list.map(item => {
 | 
			
		||||
					item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月'
 | 
			
		||||
					return item
 | 
			
		||||
				});
 | 
			
		||||
        this.total = response.data.total;
 | 
			
		||||
        this.dataListLoading = false;
 | 
			
		||||
      });
 | 
			
		||||
@@ -223,17 +305,21 @@ export default {
 | 
			
		||||
      this.getDataList();
 | 
			
		||||
    },
 | 
			
		||||
		handleExport() {
 | 
			
		||||
			if (this.selectedList.length === 0) {
 | 
			
		||||
				this.selectedList = this.tableData
 | 
			
		||||
			}
 | 
			
		||||
			this.dialogVisible = true
 | 
			
		||||
      // 处理查询参数
 | 
			
		||||
      let params = { ...this.queryParams };
 | 
			
		||||
      params.pageNo = undefined;
 | 
			
		||||
      params.pageSize = undefined;
 | 
			
		||||
      this.$modal.confirm('是否确认导出所有数据项?').then(() => {
 | 
			
		||||
        this.exportLoading = true;
 | 
			
		||||
        return this.urlOptions.exportURL(params);
 | 
			
		||||
      }).then(response => {
 | 
			
		||||
        this.$download.excel(response, '工厂.xls');
 | 
			
		||||
        this.exportLoading = false;
 | 
			
		||||
      }).catch(() => { });
 | 
			
		||||
      // let params = { ...this.queryParams };
 | 
			
		||||
      // params.pageNo = undefined;
 | 
			
		||||
      // params.pageSize = undefined;
 | 
			
		||||
      // this.$modal.confirm('是否确认导出所有数据项?').then(() => {
 | 
			
		||||
      //   this.exportLoading = true;
 | 
			
		||||
      //   return this.urlOptions.exportURL(params);
 | 
			
		||||
      // }).then(response => {
 | 
			
		||||
      //   this.$download.excel(response, '工厂.xls');
 | 
			
		||||
      //   this.exportLoading = false;
 | 
			
		||||
      // }).catch(() => { });
 | 
			
		||||
    }
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -7,78 +7,82 @@
 | 
			
		||||
		<base-table
 | 
			
		||||
			v-loading="dataListLoading"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="listQuery.pageNo"
 | 
			
		||||
			:limit="listQuery.pageSize"
 | 
			
		||||
			:table-data="tableData" />
 | 
			
		||||
		<pagination
 | 
			
		||||
		<!-- <pagination
 | 
			
		||||
			:limit.sync="listQuery.pageSize"
 | 
			
		||||
			:page.sync="listQuery.pageNo"
 | 
			
		||||
			:total="listQuery.total"
 | 
			
		||||
			@pagination="getDataList" />
 | 
			
		||||
			@pagination="getDataList" /> -->
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import basicPage from '../../mixins/basic-page';
 | 
			
		||||
// import basicPage from '../../mixins/basic-page';
 | 
			
		||||
import { parseTime } from '../../mixins/code-filter';
 | 
			
		||||
import { getLineBindProductLogPage } from '@/api/core/base/lineBindProductLog';
 | 
			
		||||
import { getSectionDataSearch } from '@/api/core/monitoring';
 | 
			
		||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
 | 
			
		||||
import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'productionLineName',
 | 
			
		||||
    prop: 'proLineName',
 | 
			
		||||
		label: '产线名称',
 | 
			
		||||
		align: 'center',
 | 
			
		||||
	},
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    prop: 'sectionName',
 | 
			
		||||
    label: '工段名称',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    prop: 'inputNum',
 | 
			
		||||
    label: '进片数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    prop: 'outputNum',
 | 
			
		||||
    label: '出片数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    prop: 'lossNum',
 | 
			
		||||
    label: '损耗数量/片',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    prop: 'lossArea',
 | 
			
		||||
    label: '损耗面积/m²',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: '',
 | 
			
		||||
    prop: 'lossRate',
 | 
			
		||||
    label: '损耗比例/%',
 | 
			
		||||
    align: 'center',
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicPage],
 | 
			
		||||
	// mixins: [basicPage],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getLineBindProductLogPage,
 | 
			
		||||
        getDataListURL: getSectionDataSearch,
 | 
			
		||||
			},
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableData: [],
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      listQuery: {
 | 
			
		||||
        proLineId:undefined,
 | 
			
		||||
        sectionId: undefined,
 | 
			
		||||
        startTime: undefined,
 | 
			
		||||
        endTime: undefined,
 | 
			
		||||
      },
 | 
			
		||||
      optionArrUrl: [getProductionLinePage, getWorkshopSectionPage],
 | 
			
		||||
			formConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '产线',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'productionLineId',
 | 
			
		||||
          param: 'proLineId',
 | 
			
		||||
					defaultSelect: '',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
@@ -86,7 +90,7 @@ export default {
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '工段',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
					param: 'productId',
 | 
			
		||||
          param: 'sectionId',
 | 
			
		||||
					defaultSelect: '',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
@@ -99,7 +103,7 @@ export default {
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始时间',
 | 
			
		||||
					endPlaceholder: '结束时间',
 | 
			
		||||
					param: 'createTime',
 | 
			
		||||
					param: 'timeSlot',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
@@ -118,7 +122,8 @@ export default {
 | 
			
		||||
	components: {
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.getArr();
 | 
			
		||||
    this.getArr();
 | 
			
		||||
    this.getDataList()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getArr() {
 | 
			
		||||
@@ -131,16 +136,30 @@ export default {
 | 
			
		||||
					this.formConfig[index].selectOptions = response.data.list;
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		buttonClick(val) {
 | 
			
		||||
			switch (val.btnName) {
 | 
			
		||||
				case 'search':
 | 
			
		||||
					this.listQuery.pageNo = 1;
 | 
			
		||||
					this.listQuery.pageSize = 10;
 | 
			
		||||
					this.listQuery.productionLineId = val.productionLineId;
 | 
			
		||||
					this.listQuery.productId = val.productId;
 | 
			
		||||
					this.listQuery.createTime = val.createTime;
 | 
			
		||||
					this.getDataList();
 | 
			
		||||
    },
 | 
			
		||||
    getDataList() {
 | 
			
		||||
      // this.listQuery.proLineId = '1672847052717821953';
 | 
			
		||||
      // this.listQuery.startTime = '1690626657000'
 | 
			
		||||
      // this.listQuery.endTime = '1693564257000'
 | 
			
		||||
      this.urlOptions.getDataListURL(this.listQuery).then(res => {
 | 
			
		||||
        this.tableData = res.data
 | 
			
		||||
        // this.total = response.data.total;
 | 
			
		||||
        this.dataListLoading = false;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    buttonClick(val) {
 | 
			
		||||
      console.log(val)
 | 
			
		||||
      switch (val.btnName) {
 | 
			
		||||
        case 'search':
 | 
			
		||||
          console.log(val.timeSlot);
 | 
			
		||||
 | 
			
		||||
					// this.listQuery.pageNo = 1;
 | 
			
		||||
          // this.listQuery.pageSize = 10;
 | 
			
		||||
          this.listQuery.proLineId = val.proLineId ? val.proLineId : undefined
 | 
			
		||||
          this.listQuery.sectionId = val.sectionId ? val.sectionId : undefined
 | 
			
		||||
          this.listQuery.startTime = val.timeSlot ? new Date(val.timeSlot[0]).getTime() : undefined
 | 
			
		||||
          this.listQuery.endTime = val.timeSlot ? new Date(val.timeSlot[1]).getTime() : undefined
 | 
			
		||||
          this.getDataList();
 | 
			
		||||
					break;
 | 
			
		||||
				case 'reset':
 | 
			
		||||
					this.$refs.searchBarForm.resetForm();
 | 
			
		||||
 
 | 
			
		||||
@@ -12,31 +12,7 @@
 | 
			
		||||
			ref="search-bar"
 | 
			
		||||
			@headBtnClick="handleSearchBarBtnClick" />
 | 
			
		||||
 | 
			
		||||
		<!-- <base-table
 | 
			
		||||
			:table-props="[
 | 
			
		||||
				{ type: 'index', label: '序号' },
 | 
			
		||||
				{ prop: 'name', label: '设备名称', align: 'center' },
 | 
			
		||||
				{ prop: 'code', label: '设备代码', align: 'center' },
 | 
			
		||||
				{ prop: 'time', label: '时间', align: 'center' },
 | 
			
		||||
			]"
 | 
			
		||||
			:table-data="[
 | 
			
		||||
				{ index: 1, name: '1', code: 'c1', time: '2021-08-31 09:14:19' },
 | 
			
		||||
				{ index: 2, name: '2', code: 'c2', time: '2021-08-31 09:14:19' },
 | 
			
		||||
				{ index: 3, name: '3', code: 'c3', time: '2021-08-31 09:14:19' },
 | 
			
		||||
				{ index: 4, name: '4', code: 'c4', time: '2021-08-31 09:14:19' },
 | 
			
		||||
				{ index: 5, name: '5', code: 'c5', time: '2021-08-31 09:14:19' },
 | 
			
		||||
			]"
 | 
			
		||||
			:span-method="
 | 
			
		||||
				({ rowIndex, columnIndex }) => {
 | 
			
		||||
					if (rowIndex == 1 && columnIndex == 0) {
 | 
			
		||||
						return [1, 3];
 | 
			
		||||
					}
 | 
			
		||||
					return [1, 1];
 | 
			
		||||
				}
 | 
			
		||||
			"
 | 
			
		||||
			@emitFun="(val) => handleEmitFun(table, val)"></base-table> -->
 | 
			
		||||
 | 
			
		||||
		<div class="tables">
 | 
			
		||||
		<div v-if="tableList.length" class="tables">
 | 
			
		||||
			<div class="custom-table" v-for="table in tableList" :key="table.key">
 | 
			
		||||
				<!-- {{ JSON.stringify(spanMethod) }} -->
 | 
			
		||||
				<base-table
 | 
			
		||||
@@ -58,16 +34,14 @@
 | 
			
		||||
							getListFor(table, { page, limit, current })
 | 
			
		||||
					" />
 | 
			
		||||
			</div>
 | 
			
		||||
			<!-- v-show="table.dataManager?.total > 0"
 | 
			
		||||
				:total="table.dataManager?.total || 0" -->
 | 
			
		||||
			<!-- @size-change="($event) => handleSizeChange(table, $event)" -->
 | 
			
		||||
		</div>
 | 
			
		||||
		<div v-else style="margin-top: 20px; color: #c7c7c7; text-align: center;">暂无数据</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import LocalDataManager from './utils/local-data-manager';
 | 
			
		||||
import response from './response';
 | 
			
		||||
// import response from './response';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
@@ -123,14 +97,14 @@ export default {
 | 
			
		||||
				time: [new Date(aWeekAgo), new Date(today)],
 | 
			
		||||
			},
 | 
			
		||||
			tableList: [
 | 
			
		||||
				{
 | 
			
		||||
					key: 'base-table__key__1',
 | 
			
		||||
					tableProps: [],
 | 
			
		||||
					list: [],
 | 
			
		||||
					pageNo: 1,
 | 
			
		||||
					pageSize: 3,
 | 
			
		||||
					total: 0,
 | 
			
		||||
				},
 | 
			
		||||
				// {
 | 
			
		||||
				// 	key: 'base-table__key__1',
 | 
			
		||||
				// 	tableProps: [],
 | 
			
		||||
				// 	list: [],
 | 
			
		||||
				// 	pageNo: 1,
 | 
			
		||||
				// 	pageSize: 3,
 | 
			
		||||
				// 	total: 0,
 | 
			
		||||
				// },
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
@@ -152,7 +126,7 @@ export default {
 | 
			
		||||
		if (this.name)
 | 
			
		||||
			this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name);
 | 
			
		||||
 | 
			
		||||
		this.handleResponse();
 | 
			
		||||
		// this.handleResponse();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		buildProps(table) {
 | 
			
		||||
@@ -199,11 +173,9 @@ export default {
 | 
			
		||||
			return { props, firstLineData };
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		handleResponse() {
 | 
			
		||||
		handleResponse(response) {
 | 
			
		||||
			const { code, data } = response;
 | 
			
		||||
			if (code == 0) {
 | 
			
		||||
				console.log('response', code, data);
 | 
			
		||||
 | 
			
		||||
				// 处理一个表格
 | 
			
		||||
				data.forEach((table, index) => {
 | 
			
		||||
					console.log('handle index:', index, table);
 | 
			
		||||
@@ -220,26 +192,28 @@ export default {
 | 
			
		||||
 | 
			
		||||
					// 处理某一表格的各个行
 | 
			
		||||
					const { data } = table;
 | 
			
		||||
					data.forEach((row, idx) => {
 | 
			
		||||
						const listItem = {
 | 
			
		||||
							index: idx + 1,
 | 
			
		||||
							time: moment(+row.time).format('YYYY-MM-DD HH:mm:ss'),
 | 
			
		||||
							plcCode: row.plcCode,
 | 
			
		||||
						};
 | 
			
		||||
						row.data.forEach((column) => {
 | 
			
		||||
							listItem[column.dynamicName] = column.dynamicValue;
 | 
			
		||||
					if (data) {
 | 
			
		||||
						data.forEach((row, idx) => {
 | 
			
		||||
							const listItem = {
 | 
			
		||||
								index: idx + 1,
 | 
			
		||||
								time: moment(+row.time).format('YYYY-MM-DD HH:mm:ss'),
 | 
			
		||||
								plcCode: row.plcCode,
 | 
			
		||||
							};
 | 
			
		||||
							row.data.forEach((column) => {
 | 
			
		||||
								listItem[column.dynamicName] = column.dynamicValue;
 | 
			
		||||
							});
 | 
			
		||||
							this.tableList[index].list.push(listItem);
 | 
			
		||||
							this.tableList[index].total++;
 | 
			
		||||
						});
 | 
			
		||||
						this.tableList[index].list.push(listItem);
 | 
			
		||||
						this.tableList[index].total++;
 | 
			
		||||
					});
 | 
			
		||||
 | 
			
		||||
					// 处理分页
 | 
			
		||||
					const { pageNo, pageSize, list } = this.tableList[index];
 | 
			
		||||
					this.tableList[index].dataManager = new LocalDataManager(
 | 
			
		||||
						list,
 | 
			
		||||
						pageNo,
 | 
			
		||||
						pageSize
 | 
			
		||||
					);
 | 
			
		||||
						// 处理分页
 | 
			
		||||
						const { pageNo, pageSize, list } = this.tableList[index];
 | 
			
		||||
						this.tableList[index].dataManager = new LocalDataManager(
 | 
			
		||||
							list,
 | 
			
		||||
							pageNo,
 | 
			
		||||
							pageSize
 | 
			
		||||
						);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
@@ -255,12 +229,13 @@ export default {
 | 
			
		||||
 | 
			
		||||
		/** 查询 */
 | 
			
		||||
		async handleQuery() {
 | 
			
		||||
			const { data } = this.$axios({
 | 
			
		||||
				url: '/monitoring/equipment-monitor/runLog',
 | 
			
		||||
				method: 'get',
 | 
			
		||||
				params: this.queryParams,
 | 
			
		||||
			});
 | 
			
		||||
			console.log('data', data);
 | 
			
		||||
			this.handleResponse(
 | 
			
		||||
				await this.$axios({
 | 
			
		||||
					url: '/monitoring/equipment-monitor/runLog',
 | 
			
		||||
					method: 'get',
 | 
			
		||||
					params: this.queryParams,
 | 
			
		||||
				})
 | 
			
		||||
			);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		async handleSearchBarBtnClick({ btnName, timeVal }) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user