lb #19

Merged
g7hoo merged 80 commits from lb into test 2023-09-11 15:05:16 +08:00
2 changed files with 120 additions and 151 deletions
Showing only changes of commit fc2037a10a - Show all commits

View File

@ -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"
<!-- <div class="attr-list"> :rows="section.rows" />
<div v-if="section.key == 'attrs'">
<base-table <base-table
:table-props="tableProps" :table-props="section.props"
:page="listQuery.pageNo" :page="section.pageNo || 1"
:limit="listQuery.pageSize" :limit="section.pageSize || 10"
:table-data="productAttributeList"> :table-data="list"
@emitFun="handleEmitFun">
<method-btn <method-btn
v-if="!isdetail" v-if="section.tableBtn"
slot="handleBtn" slot="handleBtn"
:width="120"
label="操作" label="操作"
:method-list="tableBtn" :method-list="section.tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </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>
</section>
</div> </div>
<div style="position: absolute; bottom: 24px; right: 24px"> <div class="drawer-body__footer">
<el-button style="margin-right: 10px" @click="goback()">返回</el-button> <el-button style="margin-right: 10px" @click="goback()">返回</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()"> <el-button v-if="mode == 'detail'" type="primary" @click="goEdit()">
编辑 编辑
</el-button> </el-button>
<span v-if="!isdetail"> <span v-else>
<el-button type="primary" @click="dataFormSubmit()">保存</el-button> <el-button type="primary" @click="dataFormSubmit()">保存</el-button>
<el-button <el-button type="primary" @click="addNew()">添加属性</el-button>
v-if="dataForm.id && !isdetail"
type="primary"
@click="addNew()">
添加属性
</el-button>
</span> </span>
</div> </div>
</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,
productAttributeList: [],
dataForm: {
id: null,
name: '', //
code: '', //
area: 0, // (float only)
typeDictValue: null, // id
processTime: null, // (s)
specifications: '', //
unitDictValue: '', // id
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0, total: 0,
}, form: {},
dataRule: { list: []
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>

View File

@ -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':