test #47
@@ -15,17 +15,18 @@
 | 
			
		||||
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
		<base-table
 | 
			
		||||
			class="base-table__margin"
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			<method-btn
 | 
			
		||||
			<!-- <method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
				label="操作"
 | 
			
		||||
				:method-list="tableBtn"
 | 
			
		||||
				@clickBtn="handleTableBtnClick" />
 | 
			
		||||
				@clickBtn="handleTableBtnClick" /> -->
 | 
			
		||||
		</base-table>
 | 
			
		||||
 | 
			
		||||
		<!-- 分页组件 -->
 | 
			
		||||
@@ -44,7 +45,7 @@
 | 
			
		||||
			@close="cancel"
 | 
			
		||||
			@cancel="cancel"
 | 
			
		||||
			@confirm="submitForm">
 | 
			
		||||
			<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
 | 
			
		||||
			<!-- some thing ... -->
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
@@ -61,34 +62,99 @@ export default {
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: ['name', 'code'],
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('base:equipment-group:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '修改',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('base:equipment-group:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			// tableBtn: [
 | 
			
		||||
			// 	this.$auth.hasPermi('base:equipment-group:update')
 | 
			
		||||
			// 		? {
 | 
			
		||||
			// 				type: 'edit',
 | 
			
		||||
			// 				btnName: '修改',
 | 
			
		||||
			// 		  }
 | 
			
		||||
			// 		: undefined,
 | 
			
		||||
			// 	this.$auth.hasPermi('base:equipment-group:delete')
 | 
			
		||||
			// 		? {
 | 
			
		||||
			// 				type: 'delete',
 | 
			
		||||
			// 				btnName: '删除',
 | 
			
		||||
			// 		  }
 | 
			
		||||
			// 		: undefined,
 | 
			
		||||
			// ].filter((v) => v),
 | 
			
		||||
			tableProps: [
 | 
			
		||||
				{ prop: 'duration', label: '工厂', align: 'center' },
 | 
			
		||||
				{ prop: 'duration', label: '产线', align: 'center' },
 | 
			
		||||
				{ prop: 'duration', label: '工段', align: 'center' },
 | 
			
		||||
				{ prop: 'duration', label: '设备', align: 'center' },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'createTime',
 | 
			
		||||
					label: '添加时间',
 | 
			
		||||
					fixed: true,
 | 
			
		||||
					width: 180,
 | 
			
		||||
					filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
			
		||||
					label: '有效时间',
 | 
			
		||||
					align: 'center',
 | 
			
		||||
					children: [
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration',
 | 
			
		||||
							label: '工作时长',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
						{ width: 128, prop: 'duration1', label: '百分比', align: 'center' },
 | 
			
		||||
					],
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'name', label: '设备分组名称', align: 'center' },
 | 
			
		||||
				{ prop: 'code', label: '检测分组编码', align: 'center' },
 | 
			
		||||
				{ prop: 'remark', label: '备注', align: 'center' },
 | 
			
		||||
				{
 | 
			
		||||
					_action: 'equipment-group-show-alert',
 | 
			
		||||
					label: '报警',
 | 
			
		||||
					label: '关机时间',
 | 
			
		||||
					align: 'center',
 | 
			
		||||
					children: [
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration',
 | 
			
		||||
							label: '停机时长',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
						{ width: 128, prop: 'duration1', label: '百分比', align: 'center' },
 | 
			
		||||
					],
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					label: '中断损失',
 | 
			
		||||
					align: 'center',
 | 
			
		||||
					children: [
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration',
 | 
			
		||||
							label: '故障时长',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
						{ width: 128, prop: 'duration1', label: '百分比', align: 'center' },
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration1',
 | 
			
		||||
							label: '时间开动率',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
					],
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					label: '速度损失',
 | 
			
		||||
					align: 'center',
 | 
			
		||||
					children: [
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration',
 | 
			
		||||
							label: '实际加工速度',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration1',
 | 
			
		||||
							label: '理论加工速度',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							width: 128,
 | 
			
		||||
							prop: 'duration1',
 | 
			
		||||
							label: '速度开动率',
 | 
			
		||||
							align: 'center',
 | 
			
		||||
						},
 | 
			
		||||
					],
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'duration1', label: 'OEE', align: 'center' },
 | 
			
		||||
				{ prop: 'duration1', label: 'TEEP', align: 'center' },
 | 
			
		||||
				{
 | 
			
		||||
					_action: 'view-trend',
 | 
			
		||||
					label: '趋势',
 | 
			
		||||
					align: 'center',
 | 
			
		||||
					subcomponent: {
 | 
			
		||||
						props: ['injectData'],
 | 
			
		||||
@@ -109,7 +175,7 @@ export default {
 | 
			
		||||
										},
 | 
			
		||||
									},
 | 
			
		||||
								},
 | 
			
		||||
								'查看报警'
 | 
			
		||||
								'查看趋势'
 | 
			
		||||
							);
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
@@ -117,16 +183,30 @@ export default {
 | 
			
		||||
			],
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '分组名称',
 | 
			
		||||
					placeholder: '请输入设备分组名称',
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '工厂',
 | 
			
		||||
					placeholder: '请选择工厂',
 | 
			
		||||
					param: 'name',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '分组编码',
 | 
			
		||||
					placeholder: '请输入设备分组编码',
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '产线',
 | 
			
		||||
					placeholder: '请选择产线',
 | 
			
		||||
					param: 'codes',
 | 
			
		||||
					selectOptions: [],
 | 
			
		||||
				},
 | 
			
		||||
				// 选项切换
 | 
			
		||||
				{
 | 
			
		||||
					type: 'datePicker',
 | 
			
		||||
					label: '时间',
 | 
			
		||||
					dateType: 'daterange',
 | 
			
		||||
					format: 'yyyy-MM-dd',
 | 
			
		||||
					valueFormat: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始时间',
 | 
			
		||||
					endPlaceholder: '结束时间',
 | 
			
		||||
					param: 'createTime',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
@@ -138,52 +218,19 @@ export default {
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('base:equipment-group:create')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: 'OEE',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					plain: true,
 | 
			
		||||
					color: 'success',
 | 
			
		||||
				},
 | 
			
		||||
				// {
 | 
			
		||||
				// 	type: this.$auth.hasPermi('base:equipment-group:export') ? 'button' : '',
 | 
			
		||||
				// 	btnName: '导出',
 | 
			
		||||
				// 	name: 'export',
 | 
			
		||||
				// 	color: 'warning',
 | 
			
		||||
				// },
 | 
			
		||||
			],
 | 
			
		||||
			rows: [
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '分组名称',
 | 
			
		||||
						prop: 'name',
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
						// bind: {
 | 
			
		||||
						// 	disabled: true, // some condition, like detail mode...
 | 
			
		||||
						// }
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '分组编码',
 | 
			
		||||
						prop: 'code',
 | 
			
		||||
						url: '/base/equipment-group/getCode',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '备注',
 | 
			
		||||
						prop: 'remark',
 | 
			
		||||
						// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
						bind: {
 | 
			
		||||
							placeholder: '请输入备注',
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: 'TEEP',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					plain: true,
 | 
			
		||||
					color: 'warning',
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			open: false,
 | 
			
		||||
@@ -264,16 +311,6 @@ export default {
 | 
			
		||||
			this.open = true;
 | 
			
		||||
			this.title = '添加设备分组(用于同类型不同厂家的设备区分)';
 | 
			
		||||
		},
 | 
			
		||||
		/** 修改按钮操作 */
 | 
			
		||||
		handleUpdate(row) {
 | 
			
		||||
			this.reset();
 | 
			
		||||
			const id = row.id;
 | 
			
		||||
			getEquipmentGroup(id).then((response) => {
 | 
			
		||||
				this.form = response.data;
 | 
			
		||||
				this.open = true;
 | 
			
		||||
				this.title = '修改设备分组(用于同类型不同厂家的设备区分)';
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 提交按钮 */
 | 
			
		||||
		submitForm() {
 | 
			
		||||
			this.$refs['form'].validate((valid) => {
 | 
			
		||||
@@ -297,47 +334,6 @@ export default {
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			const id = row.id;
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm(
 | 
			
		||||
					'是否确认删除设备分组(用于同类型不同厂家的设备区分)编号为"' +
 | 
			
		||||
						id +
 | 
			
		||||
						'"的数据项?'
 | 
			
		||||
				)
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEquipmentGroup(id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		/** 导出按钮操作 */
 | 
			
		||||
		handleExport() {
 | 
			
		||||
			// 处理查询参数
 | 
			
		||||
			let params = { ...this.queryParams };
 | 
			
		||||
			params.pageNo = undefined;
 | 
			
		||||
			params.pageSize = undefined;
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm(
 | 
			
		||||
					'是否确认导出所有设备分组(用于同类型不同厂家的设备区分)数据项?'
 | 
			
		||||
				)
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.exportLoading = true;
 | 
			
		||||
					return exportEquipmentGroupExcel(params);
 | 
			
		||||
				})
 | 
			
		||||
				.then((response) => {
 | 
			
		||||
					this.$download.excel(
 | 
			
		||||
						response,
 | 
			
		||||
						'设备分组(用于同类型不同厂家的设备区分).xls'
 | 
			
		||||
					);
 | 
			
		||||
					this.exportLoading = false;
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user