feat: 章节增加修改功能
This commit is contained in:
@@ -9,6 +9,48 @@ import {
|
||||
time,
|
||||
} from '../../util/amis.tsx'
|
||||
|
||||
const detailDialog = (bookId: string | undefined) => {
|
||||
return {
|
||||
title: '添加书架',
|
||||
size: 'md',
|
||||
body: {
|
||||
debug: commonInfo.debug,
|
||||
type: 'form',
|
||||
api: `${commonInfo.baseUrl}/chapter/save`,
|
||||
initApi: `${commonInfo.baseUrl}/chapter/detail/\${id}`,
|
||||
initFetchOn: '${id}',
|
||||
...horizontalFormOptions(),
|
||||
canAccessSuperData: false,
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'bookId',
|
||||
value: bookId,
|
||||
},
|
||||
{
|
||||
type: 'input-number',
|
||||
name: 'sequence',
|
||||
label: '序号',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'name',
|
||||
label: '名称',
|
||||
required: true,
|
||||
clearable: true,
|
||||
},
|
||||
{
|
||||
type: 'textarea',
|
||||
name: 'description',
|
||||
label: '描述',
|
||||
clearable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function Book() {
|
||||
const navigate = useNavigate()
|
||||
const {id} = useParams()
|
||||
@@ -49,11 +91,11 @@ function Book() {
|
||||
sort: [
|
||||
{
|
||||
column: 'sequence',
|
||||
direction: 'ASC',
|
||||
direction: 'DESC',
|
||||
},
|
||||
{
|
||||
column: 'modifiedTime',
|
||||
direction: 'DESC',
|
||||
direction: 'ASC',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -70,7 +112,9 @@ function Book() {
|
||||
actionType: 'ajax',
|
||||
tooltip: '序号重排',
|
||||
tooltipPlacement: 'top',
|
||||
api: `get:${commonInfo.baseUrl}/chapter/generate_sequence`
|
||||
api: `get:${commonInfo.baseUrl}/chapter/generate_sequence`,
|
||||
confirmText: '确认重排序号?',
|
||||
confirmTitle: '序号重拍',
|
||||
},
|
||||
{
|
||||
type: 'action',
|
||||
@@ -142,7 +186,7 @@ function Book() {
|
||||
actionType: 'dialog',
|
||||
dialog: detailDialog(),
|
||||
},*/
|
||||
]
|
||||
],
|
||||
),
|
||||
columns: [
|
||||
{
|
||||
@@ -193,14 +237,14 @@ function Book() {
|
||||
},
|
||||
},
|
||||
},
|
||||
/*{
|
||||
{
|
||||
type: 'action',
|
||||
label: '修改',
|
||||
level: 'link',
|
||||
size: 'sm',
|
||||
actionType: 'dialog',
|
||||
dialog: detailDialog(),
|
||||
},*/
|
||||
dialog: detailDialog(id),
|
||||
},
|
||||
{
|
||||
className: 'text-danger btn-deleted',
|
||||
type: 'action',
|
||||
|
||||
@@ -96,7 +96,7 @@ function Bookshelf() {
|
||||
{
|
||||
name: 'name',
|
||||
label: '书名',
|
||||
width: 150,
|
||||
width: 120,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
@@ -112,7 +112,7 @@ function Bookshelf() {
|
||||
{
|
||||
name: 'source',
|
||||
label: '来源',
|
||||
width: 150,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import React from 'react'
|
||||
import {useParams} from 'react-router'
|
||||
import {amisRender, commonInfo, crudCommonOptions, horizontalFormOptions, paginationTemplate} from '../../util/amis.tsx'
|
||||
import {
|
||||
amisRender,
|
||||
commonInfo,
|
||||
crudCommonOptions,
|
||||
horizontalFormOptions,
|
||||
paginationTemplate,
|
||||
readOnlyDialogOptions,
|
||||
} from '../../util/amis.tsx'
|
||||
|
||||
function Chapter() {
|
||||
// const navigate = useNavigate()
|
||||
@@ -52,19 +59,46 @@ function Chapter() {
|
||||
},
|
||||
...crudCommonOptions(),
|
||||
...paginationTemplate(
|
||||
undefined,
|
||||
50,
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
type: 'action',
|
||||
label: '',
|
||||
icon: 'fa fa-rotate-right',
|
||||
icon: 'fa fa-book-open-reader',
|
||||
actionType: 'ajax',
|
||||
tooltip: '序号重排',
|
||||
tooltipPlacement: 'top',
|
||||
api: `get:${commonInfo.baseUrl}/line/generate_sequence/${id}`
|
||||
}
|
||||
]
|
||||
api: `get:${commonInfo.baseUrl}/line/generate_sequence/${id}`,
|
||||
confirmText: '确认重排序号?',
|
||||
confirmTitle: '序号重拍',
|
||||
},
|
||||
{
|
||||
type: 'action',
|
||||
label: '',
|
||||
icon: 'fa fa-glasses',
|
||||
actionType: 'dialog',
|
||||
tooltip: '全文阅读',
|
||||
tooltipPlacement: 'top',
|
||||
dialog: {
|
||||
title: '全文查看',
|
||||
size: 'md',
|
||||
...readOnlyDialogOptions(),
|
||||
body: {
|
||||
type: 'service',
|
||||
size: 'none',
|
||||
api: `${commonInfo.baseUrl}/chapter/content/${id}`,
|
||||
body: {
|
||||
type: 'markdown',
|
||||
value: '${detail}',
|
||||
options: {
|
||||
breaks: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
),
|
||||
columns: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user