|
@@ -1,34 +1,53 @@
|
|
|
<template>
|
|
|
<BasicModal v-bind="$attrs" @register="register" @ok="confirm" title="添加xxx">
|
|
|
<BasicForm @register="registerForm" :model="model" />
|
|
|
+ <!-- <MenuTree /> -->
|
|
|
+ <div style="display: flex;">
|
|
|
+ <p class="tree-label">菜单</p>
|
|
|
+ <Tree :treeData="treeData" :arr="arr" />
|
|
|
+ </div>
|
|
|
</BasicModal>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { defineComponent, ref } from 'vue';
|
|
|
+ import { defineComponent, ref, } from 'vue';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
|
+ import { treeData } from './data';
|
|
|
+ import Tree from './tree.vue'
|
|
|
import { adapt } from '/@/utils/adapt'
|
|
|
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
- components: { BasicModal, BasicForm },
|
|
|
+ components: { BasicModal, BasicForm, Tree },
|
|
|
setup() {
|
|
|
const modelRef = ref({});
|
|
|
const adaptWidth = adapt()
|
|
|
+ const arr:string[] = ['0-0-0-1', '0-0-0']
|
|
|
|
|
|
const schemas: FormSchema[] = [
|
|
|
{
|
|
|
field: 'name',
|
|
|
component: 'Input',
|
|
|
- label: '姓名',
|
|
|
+ label: '账户名',
|
|
|
labelWidth: adaptWidth.labelWidth,
|
|
|
colProps: {
|
|
|
span: adaptWidth.elContainer,
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- field: 'addr',
|
|
|
+ field: 'password',
|
|
|
+ component: 'Input',
|
|
|
+ label: '密码',
|
|
|
+ labelWidth: adaptWidth.labelWidth,
|
|
|
+
|
|
|
+ colProps: {
|
|
|
+ span: adaptWidth.elContainer,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'detail',
|
|
|
component: 'Input',
|
|
|
- label: '地址',
|
|
|
+ label: '详情',
|
|
|
labelWidth: adaptWidth.labelWidth,
|
|
|
|
|
|
colProps: {
|
|
@@ -59,7 +78,7 @@
|
|
|
// });
|
|
|
|
|
|
// 方式2
|
|
|
- modelRef.value = { name: data.data, addr: data.info };
|
|
|
+ modelRef.value = { name: data.name, password: data.password, detail: data.detail };
|
|
|
|
|
|
// setProps({
|
|
|
// model:{ field2: data.data, field1: data.info }
|
|
@@ -69,10 +88,18 @@
|
|
|
function confirm() {
|
|
|
console.log('确定')
|
|
|
console.log(getFieldsValue()) // 表单数据
|
|
|
-
|
|
|
closeModal() // 关闭弹窗
|
|
|
}
|
|
|
- return { register, schemas, registerForm, model: modelRef,confirm, adaptWidth };
|
|
|
+ return {
|
|
|
+ register,
|
|
|
+ schemas,
|
|
|
+ registerForm,
|
|
|
+ model: modelRef,
|
|
|
+ confirm,
|
|
|
+ adaptWidth,
|
|
|
+ treeData,
|
|
|
+ arr
|
|
|
+ };
|
|
|
},
|
|
|
});
|
|
|
</script>
|
|
@@ -80,10 +107,25 @@
|
|
|
.ant-form-item-label {
|
|
|
text-align: center !important;
|
|
|
}
|
|
|
+
|
|
|
+.tree-label {
|
|
|
+ width: 20.6%;
|
|
|
+ margin-top: 8px;
|
|
|
+ margin-bottom: 1em;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
@media (max-width: 639px) {
|
|
|
.ant-form-item-label {
|
|
|
line-height: 2.5715 !important;
|
|
|
text-align: center !important;
|
|
|
}
|
|
|
+
|
|
|
+ .tree-label {
|
|
|
+ width: 33%;
|
|
|
+ margin-top: 8px;
|
|
|
+ margin-bottom: 1em;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
}
|
|
|
</style>
|