test #47
@@ -116,6 +116,10 @@ export default {
 | 
			
		||||
			type: Object,
 | 
			
		||||
			default: () => ({}),
 | 
			
		||||
		},
 | 
			
		||||
		disabled: {
 | 
			
		||||
			type: Boolean,
 | 
			
		||||
			default: false,
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										482
									
								
								src/views/base/equipmentBindGroup/components/BasicDrawer.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										482
									
								
								src/views/base/equipmentBindGroup/components/BasicDrawer.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,482 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: EquipmentDrawer.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2023-08-22 14:38:56
 | 
			
		||||
    description: 
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<el-drawer
 | 
			
		||||
		:visible="visible"
 | 
			
		||||
		:show-close="false"
 | 
			
		||||
		:wrapper-closable="false"
 | 
			
		||||
		class="drawer"
 | 
			
		||||
		custom-class="mes-drawer"
 | 
			
		||||
		size="60%"
 | 
			
		||||
		@closed="$emit('destroy')">
 | 
			
		||||
		<SmallTitle slot="title">
 | 
			
		||||
			{{
 | 
			
		||||
				mode.includes('detail')
 | 
			
		||||
					? '详情'
 | 
			
		||||
					: mode.includes('edit')
 | 
			
		||||
					? '编辑'
 | 
			
		||||
					: '新增'
 | 
			
		||||
			}}
 | 
			
		||||
		</SmallTitle>
 | 
			
		||||
 | 
			
		||||
		<div class="drawer-body flex">
 | 
			
		||||
			<div class="drawer-body__content">
 | 
			
		||||
				<section v-for="(section, index) in sections" :key="section.key">
 | 
			
		||||
					<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
 | 
			
		||||
 | 
			
		||||
					<div class="form-part" v-if="section.key == 'base'">
 | 
			
		||||
						<el-skeleton v-if="!showForm" animated />
 | 
			
		||||
						<BaseInfoForm
 | 
			
		||||
							key="drawer-dialog-form"
 | 
			
		||||
							v-if="showForm"
 | 
			
		||||
							ref="form"
 | 
			
		||||
							:disabled="true"
 | 
			
		||||
							:dataForm="form"
 | 
			
		||||
							:rows="formRows" />
 | 
			
		||||
					</div>
 | 
			
		||||
 | 
			
		||||
					<div v-if="section.key == 'attrs'" style="margin-top: 12px">
 | 
			
		||||
						<base-table
 | 
			
		||||
							v-loading="attrListLoading"
 | 
			
		||||
							:table-props="section.props"
 | 
			
		||||
							:page="attrQuery?.params.pageNo || 1"
 | 
			
		||||
							:limit="attrQuery?.params.pageSize || 10"
 | 
			
		||||
							:table-data="list"
 | 
			
		||||
							:add-button-show="mode.includes('detail') ? null : '添加属性'"
 | 
			
		||||
							@emitButtonClick="handleAddAttr"
 | 
			
		||||
							@emitFun="handleEmitFun">
 | 
			
		||||
							<method-btn
 | 
			
		||||
								v-if="section.tableBtn"
 | 
			
		||||
								slot="handleBtn"
 | 
			
		||||
								label="操作"
 | 
			
		||||
								:method-list="tableBtn"
 | 
			
		||||
								@clickBtn="handleTableBtnClick" />
 | 
			
		||||
						</base-table>
 | 
			
		||||
 | 
			
		||||
						<!-- 分页组件 -->
 | 
			
		||||
						<pagination
 | 
			
		||||
							v-show="total > 0"
 | 
			
		||||
							:total="total"
 | 
			
		||||
							:page.sync="attrQuery.params.pageNo"
 | 
			
		||||
							:limit.sync="attrQuery.params.pageSize"
 | 
			
		||||
							@pagination="getAttrList" />
 | 
			
		||||
					</div>
 | 
			
		||||
				</section>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<div class="drawer-body__footer">
 | 
			
		||||
				<el-button style="" @click="handleCancel">取消</el-button>
 | 
			
		||||
				<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
 | 
			
		||||
					编辑
 | 
			
		||||
				</el-button>
 | 
			
		||||
				<el-button v-else type="primary" @click="handleCancel">确定</el-button>
 | 
			
		||||
				<!-- sections的第二项必须是 属性列表  -->
 | 
			
		||||
				<!-- <el-button
 | 
			
		||||
						v-if="sections[1].allowAdd"
 | 
			
		||||
						type="primary"
 | 
			
		||||
						@click="handleAddAttr">
 | 
			
		||||
						添加属性
 | 
			
		||||
					</el-button> -->
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<!-- 属性对话框 -->
 | 
			
		||||
		<base-dialog
 | 
			
		||||
			v-if="sections[1].allowAdd"
 | 
			
		||||
			:dialogTitle="attrTitle"
 | 
			
		||||
			:dialogVisible="attrFormVisible"
 | 
			
		||||
			width="45%"
 | 
			
		||||
			:append-to-body="true"
 | 
			
		||||
			custom-class="baseDialog"
 | 
			
		||||
			@close="closeAttrForm"
 | 
			
		||||
			@cancel="closeAttrForm"
 | 
			
		||||
			@confirm="submitAttrForm">
 | 
			
		||||
			<DialogForm
 | 
			
		||||
				v-if="attrFormVisible"
 | 
			
		||||
				ref="attrForm"
 | 
			
		||||
				:disabled="mode.includes('detail')"
 | 
			
		||||
				v-model="attrForm"
 | 
			
		||||
				:rows="attrRows" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</el-drawer>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import BaseInfoForm from '@/components/DialogForm';
 | 
			
		||||
import DialogForm from './dialogForm';
 | 
			
		||||
 | 
			
		||||
const SmallTitle = {
 | 
			
		||||
	name: 'SmallTitle',
 | 
			
		||||
	props: ['size'],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {},
 | 
			
		||||
	render: function (h) {
 | 
			
		||||
		return h(
 | 
			
		||||
			'span',
 | 
			
		||||
			{
 | 
			
		||||
				class: 'small-title',
 | 
			
		||||
				style: {
 | 
			
		||||
					fontSize: '18px',
 | 
			
		||||
					lineHeight:
 | 
			
		||||
						this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
 | 
			
		||||
					fontWeight: 500,
 | 
			
		||||
					fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			this.$slots.default
 | 
			
		||||
		);
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	components: { SmallTitle, DialogForm, BaseInfoForm },
 | 
			
		||||
	props: ['sections', 'defaultMode', 'dataId'], // dataId 作为一个通用的存放id的字段
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			mode: '',
 | 
			
		||||
			visible: false,
 | 
			
		||||
			showForm: false,
 | 
			
		||||
			total: 0,
 | 
			
		||||
			form: {},
 | 
			
		||||
			list: [],
 | 
			
		||||
			attrTitle: '',
 | 
			
		||||
			attrForm: {
 | 
			
		||||
				id: null,
 | 
			
		||||
				equipmentGroupId: '',
 | 
			
		||||
				code: '',
 | 
			
		||||
				type: '',
 | 
			
		||||
				grade: '',
 | 
			
		||||
				alarmCode: '',
 | 
			
		||||
				alarmContent: '',
 | 
			
		||||
				plcParamName: '',
 | 
			
		||||
			},
 | 
			
		||||
			attrFormVisible: false,
 | 
			
		||||
			attrRows: [
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '报警编码', // 自动生成
 | 
			
		||||
						prop: 'code',
 | 
			
		||||
						url: '/base/equipment-group-alarm/getCode',
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '报警类型', // 固定选项
 | 
			
		||||
						prop: 'type',
 | 
			
		||||
						options: [
 | 
			
		||||
							{ label: '布尔型', value: 2 },
 | 
			
		||||
							{ label: '字符型', value: 1 },
 | 
			
		||||
						],
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '报警级别', // 字典
 | 
			
		||||
						prop: 'grade',
 | 
			
		||||
						options: this.getDictDatas(this.DICT_TYPE.EQU_ALARM_LEVEL),
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '设备报警编码', // 对应到设备实际的报警编码
 | 
			
		||||
						prop: 'alarmCode',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '参数列名', // 在实时数据库的列名
 | 
			
		||||
						prop: 'plcParamName',
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '报警内容',
 | 
			
		||||
						prop: 'alarmContent',
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
			],
 | 
			
		||||
			attrQuery: {
 | 
			
		||||
				params: {
 | 
			
		||||
					pageNo: 1,
 | 
			
		||||
					pageSize: 10,
 | 
			
		||||
				},
 | 
			
		||||
			}, // 属性列表的请求
 | 
			
		||||
			infoQuery: null, // 基本信息的请求
 | 
			
		||||
			attrFormSubmitting: false,
 | 
			
		||||
			attrListLoading: false,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	computed: {
 | 
			
		||||
		formRows() {
 | 
			
		||||
			return this.sections[0].rows.map((row) => {
 | 
			
		||||
				return row.map((col) => {
 | 
			
		||||
					return {
 | 
			
		||||
						...col,
 | 
			
		||||
						bind: {
 | 
			
		||||
							// 详情 模式下,禁用各种输入
 | 
			
		||||
							// disabled: this.mode == 'detail',
 | 
			
		||||
							disabled: true,
 | 
			
		||||
						},
 | 
			
		||||
					};
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		tableBtn() {
 | 
			
		||||
			return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.mode = this.defaultMode || 'detail';
 | 
			
		||||
		for (const section of this.sections) {
 | 
			
		||||
			// 请求具体信息
 | 
			
		||||
			if ('url' in section) {
 | 
			
		||||
				const query = {
 | 
			
		||||
					url: section.url,
 | 
			
		||||
					method: section.method || 'get',
 | 
			
		||||
					params: section.queryParams || null,
 | 
			
		||||
					data: section.data || null,
 | 
			
		||||
				};
 | 
			
		||||
				// debugger;
 | 
			
		||||
				this.$axios(query).then(({ data }) => {
 | 
			
		||||
					if (section.key == 'base') {
 | 
			
		||||
						this.form = data;
 | 
			
		||||
						this.showForm = true;
 | 
			
		||||
						this.infoQuery = query;
 | 
			
		||||
					} else if (section.key == 'attrs') {
 | 
			
		||||
						this.attrQuery = query;
 | 
			
		||||
						this.list = data.list;
 | 
			
		||||
						this.total = data.total;
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		handleTableBtnClick({ type, data }) {
 | 
			
		||||
			switch (type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.handleEditAttr(data.id);
 | 
			
		||||
					break;
 | 
			
		||||
				case 'delete':
 | 
			
		||||
					this.handleDeleteAttr(data.id);
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		handleEmitFun(val) {
 | 
			
		||||
			console.log('handleEmitFun', val);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		init() {
 | 
			
		||||
			this.visible = true;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		async getAttrList() {
 | 
			
		||||
			this.attrListLoading = true;
 | 
			
		||||
			const res = await this.$axios(this.attrQuery);
 | 
			
		||||
			if (res.code == 0) {
 | 
			
		||||
				this.list = res.data.list;
 | 
			
		||||
				this.total = res.data.total;
 | 
			
		||||
			}
 | 
			
		||||
			this.attrListLoading = false;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// 保存表单
 | 
			
		||||
		handleSave() {
 | 
			
		||||
			this.$refs['form'][0].validate(async (valid) => {
 | 
			
		||||
				if (valid) {
 | 
			
		||||
					const isEdit = this.mode == 'edit';
 | 
			
		||||
					await this.$axios({
 | 
			
		||||
						url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
 | 
			
		||||
						method: isEdit ? 'put' : 'post',
 | 
			
		||||
						data: this.form,
 | 
			
		||||
					});
 | 
			
		||||
					this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
 | 
			
		||||
					this.visible = false;
 | 
			
		||||
					this.$emit('refreshDataList');
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		handleCancel() {
 | 
			
		||||
			this.visible = false;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// 开启编辑
 | 
			
		||||
		toggleEdit() {
 | 
			
		||||
			this.mode = 'edit';
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// 新增属性
 | 
			
		||||
		handleAddAttr() {
 | 
			
		||||
			if (!this.dataId) return this.$message.error('请先创建设备分组信息');
 | 
			
		||||
			this.attrForm = {
 | 
			
		||||
				id: null,
 | 
			
		||||
				equipmentGroupId: this.dataId,
 | 
			
		||||
				code: '',
 | 
			
		||||
				type: '',
 | 
			
		||||
				grade: '',
 | 
			
		||||
				alarmCode: '',
 | 
			
		||||
				alarmContent: '',
 | 
			
		||||
				plcParamName: '',
 | 
			
		||||
			};
 | 
			
		||||
			this.attrTitle = '添加设备分组报警';
 | 
			
		||||
			this.attrFormVisible = true;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// 编辑属性
 | 
			
		||||
		async handleEditAttr(attrId) {
 | 
			
		||||
			const res = await this.$axios({
 | 
			
		||||
				url: this.sections[1].urlDetail,
 | 
			
		||||
				method: 'get',
 | 
			
		||||
				params: { id: attrId },
 | 
			
		||||
			});
 | 
			
		||||
			if (res.code == 0) {
 | 
			
		||||
				this.attrForm = res.data;
 | 
			
		||||
				this.attrTitle = '编辑设备分组报警';
 | 
			
		||||
				this.attrFormVisible = true;
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// 删除属性
 | 
			
		||||
		handleDeleteAttr(attrId) {
 | 
			
		||||
			this.$confirm('确定删除该分组报警?', '提示', {
 | 
			
		||||
				confirmButtonText: '确定',
 | 
			
		||||
				cancelButtonText: '取消',
 | 
			
		||||
				type: 'warning',
 | 
			
		||||
			})
 | 
			
		||||
				.then(async () => {
 | 
			
		||||
					const res = await this.$axios({
 | 
			
		||||
						url: this.sections[1].urlDelete,
 | 
			
		||||
						method: 'delete',
 | 
			
		||||
						params: { id: attrId },
 | 
			
		||||
					});
 | 
			
		||||
					if (res.code == 0) {
 | 
			
		||||
						this.$message({
 | 
			
		||||
							message: '删除成功',
 | 
			
		||||
							type: 'success',
 | 
			
		||||
							duration: 1500,
 | 
			
		||||
							onClose: () => {
 | 
			
		||||
								this.getAttrList();
 | 
			
		||||
							},
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// 提交属性表
 | 
			
		||||
		async submitAttrForm() {
 | 
			
		||||
			this.$refs['attrForm'].validate((valid) => {
 | 
			
		||||
				if (!valid) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			console.log('this.attrform', this.attrForm);
 | 
			
		||||
			const isEdit = this.attrForm.id != null;
 | 
			
		||||
			this.attrFormSubmitting = true;
 | 
			
		||||
			const res = await this.$axios({
 | 
			
		||||
				url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
 | 
			
		||||
				method: isEdit ? 'put' : 'post',
 | 
			
		||||
				data: this.attrForm,
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			if (res.code == 0) {
 | 
			
		||||
				this.closeAttrForm();
 | 
			
		||||
				this.$message({
 | 
			
		||||
					message: `${isEdit ? '更新' : '创建'}成功`,
 | 
			
		||||
					type: 'success',
 | 
			
		||||
					duration: 1500,
 | 
			
		||||
					onClose: () => {
 | 
			
		||||
						this.getAttrList();
 | 
			
		||||
					},
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			this.attrFormSubmitting = false;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		closeAttrForm() {
 | 
			
		||||
			this.attrFormVisible = false;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		handleClick(raw) {
 | 
			
		||||
			if (raw.type === 'delete') {
 | 
			
		||||
				this.$confirm(`确定删除该报警?`, '提示', {
 | 
			
		||||
					confirmButtonText: '确定',
 | 
			
		||||
					cancelButtonText: '取消',
 | 
			
		||||
					type: 'warning',
 | 
			
		||||
				})
 | 
			
		||||
					.then(() => {
 | 
			
		||||
						deleteProductAttr(raw.data.id).then(({ data }) => {
 | 
			
		||||
							this.$message({
 | 
			
		||||
								message: '操作成功',
 | 
			
		||||
								type: 'success',
 | 
			
		||||
								duration: 1500,
 | 
			
		||||
								onClose: () => {
 | 
			
		||||
									this.getList();
 | 
			
		||||
								},
 | 
			
		||||
							});
 | 
			
		||||
						});
 | 
			
		||||
					})
 | 
			
		||||
					.catch(() => {});
 | 
			
		||||
			} else {
 | 
			
		||||
				this.addNew(raw.data.id);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.drawer >>> .el-drawer {
 | 
			
		||||
	border-radius: 8px 0 0 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer >>> .el-drawer__header {
 | 
			
		||||
	margin: 0;
 | 
			
		||||
	padding: 32px 32px 24px;
 | 
			
		||||
	border-bottom: 1px solid #dcdfe6;
 | 
			
		||||
	margin-bottom: 0px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.small-title::before {
 | 
			
		||||
	content: '';
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	vertical-align: top;
 | 
			
		||||
	width: 4px;
 | 
			
		||||
	height: 22px;
 | 
			
		||||
	border-radius: 1px;
 | 
			
		||||
	margin-right: 8px;
 | 
			
		||||
	background-color: #0b58ff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer-body {
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
	height: 100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer-body__content {
 | 
			
		||||
	flex: 1;
 | 
			
		||||
	/* background: #eee; */
 | 
			
		||||
	padding: 20px 30px;
 | 
			
		||||
	overflow-y: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer-body__footer {
 | 
			
		||||
	display: flex;
 | 
			
		||||
	justify-content: flex-end;
 | 
			
		||||
	padding: 18px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										186
									
								
								src/views/base/equipmentBindGroup/components/dialogForm.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										186
									
								
								src/views/base/equipmentBindGroup/components/dialogForm.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,186 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    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="code"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-input
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.code"
 | 
			
		||||
						@change="$emit('update', dataForm)"
 | 
			
		||||
						placeholder="请输入工段排序" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
				<!-- 				
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="报警编码"
 | 
			
		||||
					prop="code"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.code"
 | 
			
		||||
						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="type"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.type"
 | 
			
		||||
						placeholder="请选择报警类型"
 | 
			
		||||
						@change="handleTypeChange">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in [
 | 
			
		||||
								{ label: '布尔型', value: 2 },
 | 
			
		||||
								{ label: '字符型', value: 1 },
 | 
			
		||||
							]"
 | 
			
		||||
							: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="grade"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.grade"
 | 
			
		||||
						placeholder="请选择报警级别"
 | 
			
		||||
						@change="$emit('update', dataForm)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in getDictDatas(DICT_TYPE.EQU_ALARM_LEVEL)"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					v-if="+dataForm.type == 1"
 | 
			
		||||
					label="设备报警编码"
 | 
			
		||||
					prop="alarmCode">
 | 
			
		||||
					<el-input
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.alarmCode"
 | 
			
		||||
						@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="plcParamName"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-input
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.plcParamName"
 | 
			
		||||
						placeholder="请输入参数列名"
 | 
			
		||||
						@change="$emit('update', dataForm)"></el-input>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="报警内容"
 | 
			
		||||
					prop="alarmContent"
 | 
			
		||||
					:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
 | 
			
		||||
					<el-input
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.alarmContent"
 | 
			
		||||
						placeholder="请输入报警内容"
 | 
			
		||||
						@change="$emit('update', dataForm)"></el-input>
 | 
			
		||||
				</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: () => ({}),
 | 
			
		||||
		},
 | 
			
		||||
		disabled: {
 | 
			
		||||
			type: Boolean,
 | 
			
		||||
			default: false,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			formLoading: true,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
 | 
			
		||||
			this.formLoading = false;
 | 
			
		||||
			this.$emit('update', {
 | 
			
		||||
				...this.dataForm,
 | 
			
		||||
				code,
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		/** 模拟透传 ref  */
 | 
			
		||||
		validate(cb) {
 | 
			
		||||
			return this.$refs.form.validate(cb);
 | 
			
		||||
		},
 | 
			
		||||
		resetFields(args) {
 | 
			
		||||
			return this.$refs.form.resetFields(args);
 | 
			
		||||
		},
 | 
			
		||||
		async handleTypeChange(id) {
 | 
			
		||||
			this.dataForm.alarmCode = '';
 | 
			
		||||
			this.$emit('update', this.dataForm);
 | 
			
		||||
		},
 | 
			
		||||
		async getCode(url) {
 | 
			
		||||
			const response = await this.$axios(url);
 | 
			
		||||
			return response.data;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.el-date-editor,
 | 
			
		||||
.el-select {
 | 
			
		||||
	width: 100%;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -40,6 +40,57 @@
 | 
			
		||||
			@confirm="submitForm">
 | 
			
		||||
			<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
 | 
			
		||||
		<!-- 抽屉 详情 -->
 | 
			
		||||
		<BasicDrawer
 | 
			
		||||
			v-if="editVisible"
 | 
			
		||||
			ref="drawer"
 | 
			
		||||
			:default-mode="editMode"
 | 
			
		||||
			:data-id="alarmForm.id"
 | 
			
		||||
			:sections="[
 | 
			
		||||
				{
 | 
			
		||||
					name: '基本信息',
 | 
			
		||||
					key: 'base',
 | 
			
		||||
					rows: drawerBaseInfoRows,
 | 
			
		||||
					url: '/base/equipment-group/get',
 | 
			
		||||
					urlUpdate: '/base/equipment-group/update',
 | 
			
		||||
					urlCreate: '/base/equipment-group/create',
 | 
			
		||||
					queryParams: { id: alarmForm.id },
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					name: '属性列表',
 | 
			
		||||
					key: 'attrs',
 | 
			
		||||
					props: drawerListProps,
 | 
			
		||||
					url: '/base/equipment-group-alarm/page',
 | 
			
		||||
					urlCreate: '/base/equipment-group-alarm/create',
 | 
			
		||||
					urlUpdate: '/base/equipment-group-alarm/update',
 | 
			
		||||
					urlDelete: '/base/equipment-group-alarm/delete',
 | 
			
		||||
					urlDetail: '/base/equipment-group-alarm/get',
 | 
			
		||||
					queryParams: {
 | 
			
		||||
						equipmentGroupId: alarmForm.id,
 | 
			
		||||
						pageNo: 1,
 | 
			
		||||
						pageSize: 10,
 | 
			
		||||
					},
 | 
			
		||||
					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),
 | 
			
		||||
					allowAdd: true,
 | 
			
		||||
				},
 | 
			
		||||
			]"
 | 
			
		||||
			@refreshDataList="getList"
 | 
			
		||||
			@cancel="editVisible = false"
 | 
			
		||||
			@destroy="editVisible = false" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -55,16 +106,24 @@ import {
 | 
			
		||||
 | 
			
		||||
import { getEquipmentGroupPage } from '@/api/base/equipmentGroup';
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import { publicFormatter } from '@/utils/dict';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import BasicDrawer from './components/BasicDrawer.vue';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'EquipmentBindGroup',
 | 
			
		||||
	components: {},
 | 
			
		||||
	components: { BasicDrawer },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: ['groupId', 'equipmentName'],
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('base:equipment-bind-group:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'detail',
 | 
			
		||||
							btnName: '查看报警',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('base:equipment-bind-group:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
@@ -88,32 +147,32 @@ export default {
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备' },
 | 
			
		||||
				{ prop: 'groupName', label: '分组' },
 | 
			
		||||
				{
 | 
			
		||||
					_action: 'equipment-bind-group-show-alert',
 | 
			
		||||
					label: '分组报警',
 | 
			
		||||
					subcomponent: {
 | 
			
		||||
						props: ['injectData'],
 | 
			
		||||
						render: function (h) {
 | 
			
		||||
							const _this = this;
 | 
			
		||||
							return h(
 | 
			
		||||
								'el-button',
 | 
			
		||||
								{
 | 
			
		||||
									props: { type: 'text' },
 | 
			
		||||
									on: {
 | 
			
		||||
										click: function () {
 | 
			
		||||
											console.log('inejctdata', _this.injectData);
 | 
			
		||||
											_this.$emit('emitData', {
 | 
			
		||||
												action: _this.injectData._action,
 | 
			
		||||
												value: _this.injectData,
 | 
			
		||||
											});
 | 
			
		||||
										},
 | 
			
		||||
									},
 | 
			
		||||
								},
 | 
			
		||||
								'查看报警'
 | 
			
		||||
							);
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				// {
 | 
			
		||||
				// 	_action: 'equipment-bind-group-show-alert',
 | 
			
		||||
				// 	label: '分组报警',
 | 
			
		||||
				// 	subcomponent: {
 | 
			
		||||
				// 		props: ['injectData'],
 | 
			
		||||
				// 		render: function (h) {
 | 
			
		||||
				// 			const _this = this;
 | 
			
		||||
				// 			return h(
 | 
			
		||||
				// 				'el-button',
 | 
			
		||||
				// 				{
 | 
			
		||||
				// 					props: { type: 'text' },
 | 
			
		||||
				// 					on: {
 | 
			
		||||
				// 						click: function () {
 | 
			
		||||
				// 							console.log('inejctdata', _this.injectData);
 | 
			
		||||
				// 							_this.$emit('emitData', {
 | 
			
		||||
				// 								action: _this.injectData._action,
 | 
			
		||||
				// 								value: _this.injectData,
 | 
			
		||||
				// 							});
 | 
			
		||||
				// 						},
 | 
			
		||||
				// 					},
 | 
			
		||||
				// 				},
 | 
			
		||||
				// 				'查看报警'
 | 
			
		||||
				// 			);
 | 
			
		||||
				// 		},
 | 
			
		||||
				// 	},
 | 
			
		||||
				// },
 | 
			
		||||
			],
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
@@ -196,6 +255,59 @@ export default {
 | 
			
		||||
			form: {},
 | 
			
		||||
			// 表单校验
 | 
			
		||||
			rules: {},
 | 
			
		||||
			//
 | 
			
		||||
			alarmForm: {
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				equipmentGroupCode: undefined,
 | 
			
		||||
				equipmentGroupName: undefined,
 | 
			
		||||
			},
 | 
			
		||||
			editVisible: false,
 | 
			
		||||
			editMode: '',
 | 
			
		||||
			drawerBaseInfoRows: [
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '设备分组名称',
 | 
			
		||||
						prop: 'name',
 | 
			
		||||
						rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
			
		||||
						// bind: {
 | 
			
		||||
						// 	disabled: this.editMode == 'detail', // some condition, like detail mode...
 | 
			
		||||
						// }
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '设备分组编码',
 | 
			
		||||
						prop: 'code',
 | 
			
		||||
						// url: '/base/equipment/getCode',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
			],
 | 
			
		||||
			drawerListProps: [
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'createTime',
 | 
			
		||||
					label: '添加时间',
 | 
			
		||||
					fixed: true,
 | 
			
		||||
					width: 180,
 | 
			
		||||
					filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
			
		||||
				},
 | 
			
		||||
				{ width: 240, prop: 'code', label: '报警编码' },
 | 
			
		||||
				{
 | 
			
		||||
					width: 100,
 | 
			
		||||
					prop: 'type',
 | 
			
		||||
					label: '报警类型',
 | 
			
		||||
					filter: (val) =>
 | 
			
		||||
						val != null ? ['-', '字符型', '布尔型', '-'][val] : '-',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					width: 90,
 | 
			
		||||
					prop: 'grade',
 | 
			
		||||
					label: '报警级别',
 | 
			
		||||
					filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
 | 
			
		||||
				},
 | 
			
		||||
				{ width: 180, prop: 'alarmCode', label: '设备报警编码' },
 | 
			
		||||
				{ width: 128, prop: 'plcParamName', label: '参数列名' },
 | 
			
		||||
				{ width: 128, prop: 'alarmContent', label: '报警内容' },
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
@@ -229,7 +341,6 @@ export default {
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			this.loading = true;
 | 
			
		||||
			_; // 执行查询
 | 
			
		||||
			getEquipmentBindGroupPage(this.queryParams).then((response) => {
 | 
			
		||||
				this.list = response.data.list;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
@@ -299,6 +410,20 @@ export default {
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		// 查看报警
 | 
			
		||||
		handleDetail(row) {
 | 
			
		||||
			const { equipmentId, equipmentName, groupCode, groupId, groupName, id } =
 | 
			
		||||
				row;
 | 
			
		||||
			// 打开抽屉
 | 
			
		||||
			this.editMode = 'detail';
 | 
			
		||||
			this.alarmForm.id = groupId;
 | 
			
		||||
			this.alarmForm.equipmentGroupCode = groupCode;
 | 
			
		||||
			this.alarmForm.equipmentGroupName = groupName;
 | 
			
		||||
			this.editVisible = true;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs['drawer'].init();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			const id = row.id;
 | 
			
		||||
 
 | 
			
		||||
@@ -70,13 +70,11 @@
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<div class="drawer-body__footer">
 | 
			
		||||
				<el-button style="" @click="handleCancel">
 | 
			
		||||
					取消
 | 
			
		||||
				</el-button>
 | 
			
		||||
				<el-button style="" @click="handleCancel">取消</el-button>
 | 
			
		||||
				<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
 | 
			
		||||
					编辑
 | 
			
		||||
				</el-button>
 | 
			
		||||
				<el-button v-else type="primary" @click="handleSave">保存</el-button>
 | 
			
		||||
				<el-button v-else type="primary" @click="handleCancel">确定</el-button>
 | 
			
		||||
				<!-- sections的第二项必须是 属性列表  -->
 | 
			
		||||
				<!-- <el-button
 | 
			
		||||
						v-if="sections[1].allowAdd"
 | 
			
		||||
@@ -227,7 +225,8 @@ export default {
 | 
			
		||||
						...col,
 | 
			
		||||
						bind: {
 | 
			
		||||
							// 详情 模式下,禁用各种输入
 | 
			
		||||
							disabled: this.mode == 'detail',
 | 
			
		||||
							// disabled: this.mode == 'detail',
 | 
			
		||||
							disabled: true
 | 
			
		||||
						},
 | 
			
		||||
					};
 | 
			
		||||
				});
 | 
			
		||||
@@ -254,7 +253,6 @@ export default {
 | 
			
		||||
						this.form = data;
 | 
			
		||||
						this.showForm = true;
 | 
			
		||||
						this.infoQuery = query;
 | 
			
		||||
						console.log('setting form: ', this.form, data);
 | 
			
		||||
					} else if (section.key == 'attrs') {
 | 
			
		||||
						this.attrQuery = query;
 | 
			
		||||
						this.list = data.list;
 | 
			
		||||
@@ -385,7 +383,6 @@ export default {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			console.log('this.attrform', this.attrForm);
 | 
			
		||||
			const isEdit = this.attrForm.id != null;
 | 
			
		||||
			this.attrFormSubmitting = true;
 | 
			
		||||
			const res = await this.$axios({
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						v-model="dataForm.type"
 | 
			
		||||
						placeholder="请选择报警类型"
 | 
			
		||||
						@change="$emit('update', dataForm)">
 | 
			
		||||
						@change="handleTypeChange">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in [
 | 
			
		||||
								{ label: '布尔型', value: 2 },
 | 
			
		||||
@@ -166,9 +166,9 @@ export default {
 | 
			
		||||
		resetFields(args) {
 | 
			
		||||
			return this.$refs.form.resetFields(args);
 | 
			
		||||
		},
 | 
			
		||||
		async handleProductlineChange(id) {
 | 
			
		||||
			await this.getWorksectionList(id);
 | 
			
		||||
			this.dataForm.workshopSectionId = null;
 | 
			
		||||
		async handleTypeChange(id) {
 | 
			
		||||
			// debugger;
 | 
			
		||||
			this.dataForm.alarmCode = '';
 | 
			
		||||
			this.$emit('update', this.dataForm);
 | 
			
		||||
		},
 | 
			
		||||
		async getCode(url) {
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@
 | 
			
		||||
			v-if="editVisible"
 | 
			
		||||
			ref="drawer"
 | 
			
		||||
			:default-mode="editMode"
 | 
			
		||||
			:data-id="form.id"
 | 
			
		||||
			:data-id="alarmForm.id"
 | 
			
		||||
			:sections="[
 | 
			
		||||
				{
 | 
			
		||||
					name: '基本信息',
 | 
			
		||||
@@ -55,7 +55,7 @@
 | 
			
		||||
					url: '/base/equipment-group/get',
 | 
			
		||||
					urlUpdate: '/base/equipment-group/update',
 | 
			
		||||
					urlCreate: '/base/equipment-group/create',
 | 
			
		||||
					queryParams: { id: form.id },
 | 
			
		||||
					queryParams: { id: alarmForm.id },
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					name: '属性列表',
 | 
			
		||||
@@ -67,7 +67,7 @@
 | 
			
		||||
					urlDelete: '/base/equipment-group-alarm/delete',
 | 
			
		||||
					urlDetail: '/base/equipment-group-alarm/get',
 | 
			
		||||
					queryParams: {
 | 
			
		||||
						id: form.id,
 | 
			
		||||
						equipmentGroupId: alarmForm.id,
 | 
			
		||||
						pageNo: 1,
 | 
			
		||||
						pageSize: 10,
 | 
			
		||||
					},
 | 
			
		||||
@@ -222,6 +222,11 @@ export default {
 | 
			
		||||
				{ width: 128, prop: 'plcParamName', label: '参数列名' },
 | 
			
		||||
				{ width: 128, prop: 'alarmContent', label: '报警内容' },
 | 
			
		||||
			],
 | 
			
		||||
			alarmForm: {
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				equipmentGroupCode: undefined,
 | 
			
		||||
				equipmentGroupName: undefined,
 | 
			
		||||
			},
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
@@ -405,12 +410,15 @@ export default {
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		// 查看报警
 | 
			
		||||
		handleDetail(row) {
 | 
			
		||||
			// debugger;
 | 
			
		||||
			const { id, code, name, createTime } = row;
 | 
			
		||||
 | 
			
		||||
			// 打开抽屉
 | 
			
		||||
			this.editMode = 'detail';
 | 
			
		||||
			this.form.id = id;
 | 
			
		||||
			this.alarmForm.id = id;
 | 
			
		||||
			this.alarmForm.equipmentGroupCode = code;
 | 
			
		||||
			this.alarmForm.equipmentGroupName = name;
 | 
			
		||||
			this.editVisible = true;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs['drawer'].init();
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,7 @@
 | 
			
		||||
					" />
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div v-else style="margin-top: 20px; color: #c7c7c7; text-align: center">
 | 
			
		||||
			暂无数据
 | 
			
		||||
		<div v-else class="no-data-bg">
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ export default {
 | 
			
		||||
					axisLine: {
 | 
			
		||||
						show: true,
 | 
			
		||||
						lineStyle: {
 | 
			
		||||
							color: '#ccc',
 | 
			
		||||
							color: '#777',
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					axisTick: {
 | 
			
		||||
@@ -63,7 +63,7 @@ export default {
 | 
			
		||||
					axisLine: {
 | 
			
		||||
						show: true,
 | 
			
		||||
						lineStyle: {
 | 
			
		||||
							color: '#ccc',
 | 
			
		||||
							color: '#777',
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					name: '数量',
 | 
			
		||||
 
 | 
			
		||||
@@ -93,15 +93,7 @@
 | 
			
		||||
										v-if="list.length"
 | 
			
		||||
										:equipment-list="list"
 | 
			
		||||
										:render="renderKey" />
 | 
			
		||||
									<div
 | 
			
		||||
										v-if="list.length == 0"
 | 
			
		||||
										style="
 | 
			
		||||
											color: #c7c7c7;
 | 
			
		||||
											text-align: center;
 | 
			
		||||
											margin-top: 20px;
 | 
			
		||||
										">
 | 
			
		||||
										没有设备
 | 
			
		||||
									</div>
 | 
			
		||||
									<div v-if="list.length == 0" class="no-data-bg"></div>
 | 
			
		||||
								</div>
 | 
			
		||||
							</el-tab-pane>
 | 
			
		||||
						</el-tabs>
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ export default {
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					_action: 'params-monitor',
 | 
			
		||||
					label: '参数监控',
 | 
			
		||||
					label: '操作',
 | 
			
		||||
					subcomponent: {
 | 
			
		||||
						props: ['injectData'],
 | 
			
		||||
						render: function (h) {
 | 
			
		||||
@@ -136,7 +136,7 @@ export default {
 | 
			
		||||
										},
 | 
			
		||||
									},
 | 
			
		||||
								},
 | 
			
		||||
								'查看监控'
 | 
			
		||||
								'查看详情'
 | 
			
		||||
							);
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user