提交 2a269a0a 编写于 作者: yubinCloud's avatar yubinCloud

8-9 将文档内容变成左右布局,方便文档内容的编辑

上级 171c98a9
...@@ -43,7 +43,7 @@ export interface CategoryQueryForm { ...@@ -43,7 +43,7 @@ export interface CategoryQueryForm {
*/ */
export interface Doc { export interface Doc {
id: string; id: string;
ebookId: string; ebookId: string|null;
parent: string; parent: string;
name: string; name: string;
sort: number; sort: number;
......
...@@ -3,81 +3,89 @@ ...@@ -3,81 +3,89 @@
<a-layout-content <a-layout-content
:style="{ background: '#fff', padding: '24px', margin: 0, minHeight: '280px' }" :style="{ background: '#fff', padding: '24px', margin: 0, minHeight: '280px' }"
> >
<p> <a-row>
<a-form layout="inline" :model="docQueryForm"> <a-col :span="8">
<a-form-item> <p>
<a-button type="primary"> <a-form layout="inline" :model="docQueryForm">
查询 <a-form-item>
</a-button> <a-button type="primary" @click="handleQueryFormSubmit">
</a-form-item> 查询
<a-form-item> </a-button>
<a-button type="primary" @click="add()"> </a-form-item>
新增 <a-form-item>
</a-button> <a-button type="primary" @click="add()">
</a-form-item> 新增
</a-form> </a-button>
</p> </a-form-item>
<a-table </a-form>
:columns="columns" </p>
:row-key="record => record.id" <a-table
:data-source="level1" :columns="columns"
:loading="loading" :row-key="record => record.id"
:pagination="false" :data-source="level1"
> :loading="loading"
<template #cover="{ text: cover }"> :pagination="false"
<img v-if="cover" :src="cover" alt="avatar" /> >
</template> <template #cover="{ text: cover }">
<template v-slot:action="{ text, record }"> <img v-if="cover" :src="cover" alt="avatar" />
<a-space size="small"> </template>
<a-button type="primary" @click="edit(record)"> <template v-slot:action="{ text, record }">
编辑 <a-space size="small">
</a-button> <a-button type="primary" @click="edit(record)">
<a-popconfirm 编辑
title="删除后不可恢复,确认删除?" </a-button>
ok-text="是" <a-popconfirm
cancel-text="否" title="删除后不可恢复,确认删除?"
@confirm="handleDeleteDoc(record.id)" ok-text="是"
> cancel-text="否"
<a-button type="danger"> @confirm="handleDeleteDoc(record.id)"
删除 >
</a-button> <a-button type="danger">
</a-popconfirm> 删除
</a-space> </a-button>
</template> </a-popconfirm>
</a-table> </a-space>
</template>
</a-table>
</a-col>
<a-col :span="16">
<a-form :model="doc" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-form-item label="名称">
<a-input v-model:value="doc.name"/>
</a-form-item>
<a-form-item label="父文档">
<a-tree-select
v-model:value="doc.parent"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeSelectData"
placeholder="请选择父文档"
tree-default-expand-all
:replaceFields="{title: 'name', key: 'id', value: 'id'}"
>
</a-tree-select>
</a-form-item>
<a-form-item label="顺序">
<a-input v-model:value="doc.sort" />
</a-form-item>
<a-form-item label="内容">
<div id="content"></div>
</a-form-item>
</a-form>
</a-col>
</a-row>
</a-layout-content> </a-layout-content>
</a-layout> </a-layout>
<a-modal <!--<a-modal-->
title="文档表单" <!-- title="文档表单"-->
v-model:visible="modalVisible" <!-- v-model:visible="modalVisible"-->
:confirm-loading="modalLoading" <!-- :confirm-loading="modalLoading"-->
@ok="handleModalOk" <!-- @ok="handleModalOk"-->
> <!--&gt;-->
<a-form :model="doc" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }"> <!-- -->
<a-form-item label="名称"> <!--</a-modal>-->
<a-input v-model:value="doc.name" />
</a-form-item>
<a-form-item label="父文档">
<a-tree-select
v-model:value="doc.parent"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeSelectData"
placeholder="请选择父文档"
tree-default-expand-all
:replaceFields="{title: 'name', key: 'id', value: 'id'}"
>
</a-tree-select>
</a-form-item>
<a-form-item label="顺序">
<a-input v-model:value="doc.sort" />
</a-form-item>
<a-form-item label="内容">
<div id="content"></div>
</a-form-item>
</a-form>
</a-modal>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -174,7 +182,7 @@ export default defineComponent({ ...@@ -174,7 +182,7 @@ export default defineComponent({
// -------- 表单 --------- // -------- 表单 ---------
const treeSelectData = ref(); // 因为树选择组件的属性状态,会随当前编辑的节点而变化,所以单独声明一个响应式变量 const treeSelectData = ref(); // 因为树选择组件的属性状态,会随当前编辑的节点而变化,所以单独声明一个响应式变量
treeSelectData.value = []; treeSelectData.value = [];
const doc = ref(); const doc = ref({});
const modalVisible = ref(false); const modalVisible = ref(false);
const modalLoading = ref(false); const modalLoading = ref(false);
let textEditor: E; let textEditor: E;
...@@ -257,6 +265,7 @@ export default defineComponent({ ...@@ -257,6 +265,7 @@ export default defineComponent({
*/ */
const add = () => { const add = () => {
modalVisible.value = true; modalVisible.value = true;
let ebookId: string;
doc.value = { doc.value = {
ebookId: route.query.ebookId ebookId: route.query.ebookId
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册