lb #19
@@ -7,80 +7,71 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
	<el-drawer
 | 
						<el-drawer
 | 
				
			||||||
		:visible.sync="visible"
 | 
							:visible="visible"
 | 
				
			||||||
		:show-close="false"
 | 
							:show-close="false"
 | 
				
			||||||
		:wrapper-closable="false"
 | 
							:wrapper-closable="false"
 | 
				
			||||||
		class="drawer"
 | 
							class="drawer"
 | 
				
			||||||
 | 
							custom-class="mes-drawer"
 | 
				
			||||||
		size="60%">
 | 
							size="60%">
 | 
				
			||||||
		<SmallTitle slot="title">
 | 
							<SmallTitle slot="title">
 | 
				
			||||||
			{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
 | 
								{{
 | 
				
			||||||
 | 
									mode.includes('detail')
 | 
				
			||||||
 | 
										? '详情'
 | 
				
			||||||
 | 
										: mode.includes('edit')
 | 
				
			||||||
 | 
										? '编辑'
 | 
				
			||||||
 | 
										: '新增'
 | 
				
			||||||
 | 
								}}
 | 
				
			||||||
		</SmallTitle>
 | 
							</SmallTitle>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<div class="content">
 | 
							<div class="drawer-body flex">
 | 
				
			||||||
			<div class="visual-part">
 | 
								<div class="drawer-body__content">
 | 
				
			||||||
				<SmallTitle
 | 
									<section v-for="(section, index) in sections" :key="section.key">
 | 
				
			||||||
					style="margin: 16px 0; padding-left: 8px"
 | 
										<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
 | 
				
			||||||
					:no-padding="true">
 | 
										<DialogForm
 | 
				
			||||||
					产品属性列表
 | 
											v-if="section.key == 'base'"
 | 
				
			||||||
				</SmallTitle>
 | 
											ref="form"
 | 
				
			||||||
 | 
											:dataForm="form"
 | 
				
			||||||
 | 
											:rows="section.rows" />
 | 
				
			||||||
 | 
										<div v-if="section.key == 'attrs'">
 | 
				
			||||||
 | 
											<base-table
 | 
				
			||||||
 | 
												:table-props="section.props"
 | 
				
			||||||
 | 
												:page="section.pageNo || 1"
 | 
				
			||||||
 | 
												:limit="section.pageSize || 10"
 | 
				
			||||||
 | 
												:table-data="list"
 | 
				
			||||||
 | 
												@emitFun="handleEmitFun">
 | 
				
			||||||
 | 
												<method-btn
 | 
				
			||||||
 | 
													v-if="section.tableBtn"
 | 
				
			||||||
 | 
													slot="handleBtn"
 | 
				
			||||||
 | 
													label="操作"
 | 
				
			||||||
 | 
													:method-list="section.tableBtn"
 | 
				
			||||||
 | 
													@clickBtn="handleTableBtnClick" />
 | 
				
			||||||
 | 
											</base-table>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
 | 
									</section>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				<!-- <div class="attr-list">
 | 
								<div class="drawer-body__footer">
 | 
				
			||||||
					<base-table
 | 
									<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
 | 
				
			||||||
						:table-props="tableProps"
 | 
									<el-button v-if="mode == 'detail'" type="primary" @click="goEdit()">
 | 
				
			||||||
						:page="listQuery.pageNo"
 | 
										编辑
 | 
				
			||||||
						:limit="listQuery.pageSize"
 | 
									</el-button>
 | 
				
			||||||
						:table-data="productAttributeList">
 | 
									<span v-else>
 | 
				
			||||||
						<method-btn
 | 
										<el-button type="primary" @click="dataFormSubmit()">保存</el-button>
 | 
				
			||||||
							v-if="!isdetail"
 | 
										<el-button type="primary" @click="addNew()">添加属性</el-button>
 | 
				
			||||||
							slot="handleBtn"
 | 
									</span>
 | 
				
			||||||
							:width="120"
 | 
					 | 
				
			||||||
							label="操作"
 | 
					 | 
				
			||||||
							:method-list="tableBtn"
 | 
					 | 
				
			||||||
							@clickBtn="handleClick" />
 | 
					 | 
				
			||||||
					</base-table>
 | 
					 | 
				
			||||||
					<pagination
 | 
					 | 
				
			||||||
						v-show="listQuery.total > 0"
 | 
					 | 
				
			||||||
						:total="listQuery.total"
 | 
					 | 
				
			||||||
						:page.sync="listQuery.current"
 | 
					 | 
				
			||||||
						:limit.sync="listQuery.size"
 | 
					 | 
				
			||||||
						:page-sizes="[5, 10, 15]"
 | 
					 | 
				
			||||||
						@pagination="getList" />
 | 
					 | 
				
			||||||
				</div> -->
 | 
					 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
		<div style="position: absolute; bottom: 24px; right: 24px">
 | 
					 | 
				
			||||||
			<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
 | 
					 | 
				
			||||||
			<el-button v-if="isdetail" type="primary" @click="goEdit()">
 | 
					 | 
				
			||||||
				编辑
 | 
					 | 
				
			||||||
			</el-button>
 | 
					 | 
				
			||||||
			<span v-if="!isdetail">
 | 
					 | 
				
			||||||
				<el-button type="primary" @click="dataFormSubmit()">保存</el-button>
 | 
					 | 
				
			||||||
				<el-button
 | 
					 | 
				
			||||||
					v-if="dataForm.id && !isdetail"
 | 
					 | 
				
			||||||
					type="primary"
 | 
					 | 
				
			||||||
					@click="addNew()">
 | 
					 | 
				
			||||||
					添加属性
 | 
					 | 
				
			||||||
				</el-button>
 | 
					 | 
				
			||||||
			</span>
 | 
					 | 
				
			||||||
		</div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		<!-- <product-attr-add
 | 
					 | 
				
			||||||
			v-if="addOrUpdateVisible"
 | 
					 | 
				
			||||||
			ref="addOrUpdate"
 | 
					 | 
				
			||||||
			:product-id="dataForm.id"
 | 
					 | 
				
			||||||
			@refreshDataList="getList" /> -->
 | 
					 | 
				
			||||||
	</el-drawer>
 | 
						</el-drawer>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
 | 
					import DialogForm from '@/components/DialogForm';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const SmallTitle = {
 | 
					const SmallTitle = {
 | 
				
			||||||
	name: 'SmallTitle',
 | 
						name: 'SmallTitle',
 | 
				
			||||||
	props: ['size'],
 | 
						props: ['size'],
 | 
				
			||||||
	data() {
 | 
						data() {
 | 
				
			||||||
		return {
 | 
							return {};
 | 
				
			||||||
			title: 'Default title',
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {},
 | 
						methods: {},
 | 
				
			||||||
	render: function (h) {
 | 
						render: function (h) {
 | 
				
			||||||
@@ -96,96 +87,32 @@ const SmallTitle = {
 | 
				
			|||||||
					fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
 | 
										fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			this.title
 | 
								this.$slots.default
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
	components: { SmallTitle },
 | 
						components: { SmallTitle, DialogForm },
 | 
				
			||||||
 | 
						props: ['sections', 'mode', 'dataForm'],
 | 
				
			||||||
	data() {
 | 
						data() {
 | 
				
			||||||
		return {
 | 
							return {
 | 
				
			||||||
			visible: false,
 | 
								visible: false,
 | 
				
			||||||
			addOrUpdateVisible: false,
 | 
								total: 0,
 | 
				
			||||||
			productAttributeList: [],
 | 
								form: {},
 | 
				
			||||||
			dataForm: {
 | 
					            list: []
 | 
				
			||||||
				id: null,
 | 
					 | 
				
			||||||
				name: '', // 产品名称
 | 
					 | 
				
			||||||
				code: '', // 产品编码
 | 
					 | 
				
			||||||
				area: 0, // 单位平方数(float only)
 | 
					 | 
				
			||||||
				typeDictValue: null, // 产品类型id
 | 
					 | 
				
			||||||
				processTime: null, // 单位产品用时 (s)
 | 
					 | 
				
			||||||
				specifications: '', // 规格
 | 
					 | 
				
			||||||
				unitDictValue: '', // 单位id
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			listQuery: {
 | 
					 | 
				
			||||||
				pageSize: 10,
 | 
					 | 
				
			||||||
				pageNo: 1,
 | 
					 | 
				
			||||||
				total: 0,
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			dataRule: {
 | 
					 | 
				
			||||||
				code: [
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						required: true,
 | 
					 | 
				
			||||||
						message: '产品编码不能为空',
 | 
					 | 
				
			||||||
						trigger: 'blur',
 | 
					 | 
				
			||||||
					},
 | 
					 | 
				
			||||||
					// {
 | 
					 | 
				
			||||||
					// 	type: 'number',
 | 
					 | 
				
			||||||
					// 	message: '产品编码为数字类型',
 | 
					 | 
				
			||||||
					// 	trigger: 'blur',
 | 
					 | 
				
			||||||
					// 	transfom: 'val => Number(val)',
 | 
					 | 
				
			||||||
					// },
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				name: [
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						required: true,
 | 
					 | 
				
			||||||
						message: '产品名称不能为空',
 | 
					 | 
				
			||||||
						trigger: 'blur',
 | 
					 | 
				
			||||||
					},
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				typeDictValue: [
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						required: true,
 | 
					 | 
				
			||||||
						message: '产品类型不能为空',
 | 
					 | 
				
			||||||
						trigger: 'blur',
 | 
					 | 
				
			||||||
					},
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				area: [
 | 
					 | 
				
			||||||
					// {
 | 
					 | 
				
			||||||
					// 	type: 'float',
 | 
					 | 
				
			||||||
					// 	message: '单位平方数为浮点类型',
 | 
					 | 
				
			||||||
					// 	trigger: 'blur',
 | 
					 | 
				
			||||||
					// 	transfom: 'val => Float(val)',
 | 
					 | 
				
			||||||
					// },
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				processTime: [
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						required: true,
 | 
					 | 
				
			||||||
						message: '完成单位产品用时不能为空',
 | 
					 | 
				
			||||||
						trigger: 'blur',
 | 
					 | 
				
			||||||
					},
 | 
					 | 
				
			||||||
					// {
 | 
					 | 
				
			||||||
					// 	type: 'number',
 | 
					 | 
				
			||||||
					// 	message: '完成单位产品用时为浮点类型',
 | 
					 | 
				
			||||||
					// 	trigger: 'blur',
 | 
					 | 
				
			||||||
					// 	transfom: 'val => Number(val)',
 | 
					 | 
				
			||||||
					// },
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			isdetail: false,
 | 
					 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						methods: {
 | 
				
			||||||
		initData() {
 | 
					        handleTableBtnClick() {},
 | 
				
			||||||
			this.productAttributeList.splice(0);
 | 
					
 | 
				
			||||||
		},
 | 
					        handleEmitFun(){},
 | 
				
			||||||
		init(id, isdetail) {
 | 
					
 | 
				
			||||||
			this.initData();
 | 
							init(id) {
 | 
				
			||||||
			this.isdetail = isdetail || false;
 | 
					 | 
				
			||||||
			this.dataForm.id = id || null;
 | 
					 | 
				
			||||||
			this.visible = true;
 | 
								this.visible = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			this.$nextTick(() => {
 | 
								this.$nextTick(() => {
 | 
				
			||||||
				this.$refs['dataForm'].resetFields();
 | 
									this.$refs['dataForm'].resetFields();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -302,30 +229,40 @@ export default {
 | 
				
			|||||||
	margin: 0;
 | 
						margin: 0;
 | 
				
			||||||
	padding: 32px 32px 24px;
 | 
						padding: 32px 32px 24px;
 | 
				
			||||||
	border-bottom: 1px solid #dcdfe6;
 | 
						border-bottom: 1px solid #dcdfe6;
 | 
				
			||||||
	margin-bottom: 30px;
 | 
						margin-bottom: 0px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.drawer >>> .content {
 | 
					.small-title {
 | 
				
			||||||
	padding: 0 24px 30px;
 | 
						color: #000;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.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;
 | 
						display: flex;
 | 
				
			||||||
	flex-direction: column;
 | 
						flex-direction: column;
 | 
				
			||||||
	height: 100%;
 | 
						height: 100%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.drawer >>> .visual-part {
 | 
					.drawer-body__content {
 | 
				
			||||||
	flex: 1 auto;
 | 
						flex: 1;
 | 
				
			||||||
	max-height: 76vh;
 | 
						background: #eee;
 | 
				
			||||||
	overflow: hidden;
 | 
						padding: 20px 30px;
 | 
				
			||||||
	overflow-y: scroll;
 | 
						overflow-y: auto;
 | 
				
			||||||
	padding-right: 10px; /* 调整滚动条样式 */
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.drawer >>> .el-form,
 | 
					.drawer-body__footer {
 | 
				
			||||||
.drawer >>> .attr-list {
 | 
						display: flex;
 | 
				
			||||||
	padding: 0 16px;
 | 
						justify-content: flex-end;
 | 
				
			||||||
}
 | 
						padding: 18px;
 | 
				
			||||||
 | 
					 | 
				
			||||||
.small-title {
 | 
					 | 
				
			||||||
	color: red;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,24 @@
 | 
				
			|||||||
		<!-- 设备 详情 - 编辑 -->
 | 
							<!-- 设备 详情 - 编辑 -->
 | 
				
			||||||
		<EquipmentDrawer
 | 
							<EquipmentDrawer
 | 
				
			||||||
			v-if="editVisible"
 | 
								v-if="editVisible"
 | 
				
			||||||
 | 
								ref="drawer"
 | 
				
			||||||
			:mode="editMode"
 | 
								:mode="editMode"
 | 
				
			||||||
 | 
								:sections="[
 | 
				
			||||||
 | 
									{ name: '基本信息', key: 'base', rows: rows, dataForm: form },
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										name: '属性列表',
 | 
				
			||||||
 | 
										key: 'attrs',
 | 
				
			||||||
 | 
										props: drawerListProps,
 | 
				
			||||||
 | 
										url: '',
 | 
				
			||||||
 | 
										navigator: true, // 是否显示分页器
 | 
				
			||||||
 | 
										pageNo: null,
 | 
				
			||||||
 | 
										pageSize: null,
 | 
				
			||||||
 | 
										tableBtns: [
 | 
				
			||||||
 | 
											{ name: 'edit', url: '', permission: '' },
 | 
				
			||||||
 | 
											{ name: 'delete', url: '', permission: '' },
 | 
				
			||||||
 | 
										],
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								]"
 | 
				
			||||||
			@confirm="submitForm"
 | 
								@confirm="submitForm"
 | 
				
			||||||
			@cancel="editVisible = false"
 | 
								@cancel="editVisible = false"
 | 
				
			||||||
			@destroy="editVisible = false">
 | 
								@destroy="editVisible = false">
 | 
				
			||||||
@@ -322,10 +339,22 @@ export default {
 | 
				
			|||||||
					},
 | 
										},
 | 
				
			||||||
				],
 | 
									],
 | 
				
			||||||
			],
 | 
								],
 | 
				
			||||||
			// 是否显示弹出层
 | 
					 | 
				
			||||||
			open: false,
 | 
					 | 
				
			||||||
			editVisible: false,
 | 
								editVisible: false,
 | 
				
			||||||
			editMode: 'edit', // 'edit', 'detail'
 | 
								editMode: 'edit', // 'edit', 'detail'
 | 
				
			||||||
 | 
								// drawer 里的设备属性列表配置项
 | 
				
			||||||
 | 
								drawerListProps: [
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										prop: 'createTime',
 | 
				
			||||||
 | 
										label: '添加时间',
 | 
				
			||||||
 | 
										fixed: true,
 | 
				
			||||||
 | 
										width: 180,
 | 
				
			||||||
 | 
										filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{ prop: 'keyName', label: '属性名称', align: 'center' },
 | 
				
			||||||
 | 
									{ prop: 'keyValue', label: '属性值', align: 'center' },
 | 
				
			||||||
 | 
								],
 | 
				
			||||||
 | 
								// 是否显示弹出层
 | 
				
			||||||
 | 
								open: false,
 | 
				
			||||||
			// 查询参数
 | 
								// 查询参数
 | 
				
			||||||
			queryParams: {
 | 
								queryParams: {
 | 
				
			||||||
				pageNo: 1,
 | 
									pageNo: 1,
 | 
				
			||||||
@@ -468,6 +497,9 @@ export default {
 | 
				
			|||||||
					getEquipment(id).then((response) => {
 | 
										getEquipment(id).then((response) => {
 | 
				
			||||||
						this.form = response.data;
 | 
											this.form = response.data;
 | 
				
			||||||
						this.editVisible = true;
 | 
											this.editVisible = true;
 | 
				
			||||||
 | 
											this.$nextTick(() => {
 | 
				
			||||||
 | 
												this.$refs['drawer'].init();
 | 
				
			||||||
 | 
											});
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case 'delete':
 | 
									case 'delete':
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user