shenwu před 5 měsíci
rodič
revize
2e85f92dfd

+ 3 - 3
src/pages/book/bookManage/longbookList/index.tsx

@@ -59,7 +59,7 @@ const Page: React.FC = () => {
   let BookContentLongBookInfoDel = useAjax((id) => apiBookContentLongBookInfoDel(id)); //单个删除书籍
   let BookContentLongBookInfoDels = useAjax((ids) => apiBookContentLongBookInfoDels(ids)); //批量删除书籍
   let BookContentLongBookInfoBatch = useAjax((params) => apiBookContentLongBookInfoBatch(params)); //批量上下架
-  let LongBookParagraph = useAjax((id) => apiLongBookParagraph(id)); //查询单个章节
+  let LongBookParagraph = useAjax((params) => apiLongBookParagraph(params)); //查询单个章节
   let LongBookInfoChapterAllList = useAjax((id) => apiLongBookInfoChapterAllList(id)); //全部章节无分页
   const formRef = useRef<ProFormInstance>();
   const actionRef = useRef<ActionType>();
@@ -77,8 +77,8 @@ const Page: React.FC = () => {
   };
   // 看小说
   const lookBook = (params: any) => {
-    let { chapterNo } = params;
-    return LongBookParagraph.run(chapterNo).then((res) => {
+    let { chapterNo,bookId } = params;
+    return LongBookParagraph.run({chapterNo,bookId}).then((res) => {
       // setOpneBook({ ...res.data, ...params })
       return res.data;
     });

+ 2 - 2
src/pages/book/bookManage/longbookList/item.tsx

@@ -32,7 +32,7 @@ const Page: React.FC<Props> = (props) => {
   let LongBookParagraphAdd = useAjax((params) => apiLongBookParagraphAdd(params)); //小说章节新增
   let LongBookParagraphEdit = useAjax((params) => apiLongBookParagraphEdit(params)); //小说章节编辑
   let LongBookParagraphDel = useAjax((params) => apiLongBookParagraphDel(params)); //小说章节删除
-  let LongBookParagraph = useAjax((id) => apiLongBookParagraph(id)); //查询单个章节
+  let LongBookParagraph = useAjax((params) => apiLongBookParagraph(params)); //查询单个章节
   const formRef = useRef<ProFormInstance>();
   const actionRef = useRef<ActionType>();
 
@@ -68,7 +68,7 @@ const Page: React.FC<Props> = (props) => {
       setOpen(b);
     } else {
       setEditValues(values);
-      LongBookParagraph.run(values.id).then((res: any) => {
+      LongBookParagraph.run({chapterNo:values.chapterNo,bookId:values.bookId}).then((res: any) => {
         if (res.code === 200) {
           formRef?.current?.setFieldsValue(res.data);
         }

+ 99 - 5
src/pages/distribution/book/longBook/index.tsx

@@ -14,28 +14,35 @@ import {
   ProTable,
 } from '@ant-design/pro-components';
 import { useModel } from '@umijs/max';
-import { message } from 'antd';
+import { Button, message, Popconfirm, Space, Tag } from 'antd';
 import { useEffect, useRef, useState } from 'react';
 import formConfig from './formConfig';
 import { columns } from './tableConfig';
+import { removeBook } from '@/services/distribution/weChatInfo';
 
 type DataItem = {
   name: string;
   state: string;
 };
-const Page: React.FC = () => {
+type Porps = {
+  wechatAppId?: string
+}
+const Page: React.FC<Porps> = (props) => {
+  let { wechatAppId } = props
   let { state, getLabelAndClassList } = useModel('global');
   const formRef = useRef<ProFormInstance>();
   const actionRef = useRef<ActionType>();
   let [workDirection, setWorkDirection] = useState<any>(null);
   let [open, setOpen] = useState<any>(null); //新增作者
   let [editValues, setEditValues] = useState<any>({});
+  const [editSelectedRow, setEditSelectedRow] = useState<any[]>([]); //小说列表选择
   // ======================API=======================
   let DistributorInfoList = useAjax((params) => apiDistributorInfoList(params)); //分销商列表
   let BookInfoList = useAjax((params) => apiLongBookInfoList(params), { type: 'table' }); //获取书籍列表
   let BookInfoBookConfig = useAjax((params) => apiLongBookInfoBookConfig(params)); //小说信息配置
   let BookInfoChapterAllList = useAjax((id) => apiLongBookInfoChapterAllList(id)); //全部列表无分页
   let BookInfoConfigDetail = useAjax((id) => apiLongBookInfoConfigDetail(id)); //小说配置详情
+  let RemoveBook = useAjax((params) => removeBook(params)); //移除小程序中的书籍
   // 获取标签和分类
   useEffect(() => {
     getLabelAndClassList({ workDirection });
@@ -83,10 +90,25 @@ const Page: React.FC = () => {
     } else {
     }
   };
+  // 组件模式小说移除
+  const delBook = () => {
+    let bookIds = editSelectedRow?.map(item => item.bookId)
+    RemoveBook.run({ bookIds, appId: wechatAppId }).then(res => {
+      if (res.code === 200) {
+        actionRef.current?.reload()
+        message.success("移除成功")
+        setEditSelectedRow([])
+      }
+      console.log(res)
+    })
+  }
   return (
-    <PageContainer>
+    <PageContainer
+      header={wechatAppId ? { title: "", breadcrumb: {} } : {}}
+      childrenContentStyle={wechatAppId ? { paddingBlockStart: 0 } : {}}
+    >
       <ProTable<any, any>
-        headerTitle={'长篇小说配置信息列表'}
+        headerTitle={wechatAppId ? "长篇小说列表" : '长篇小说配置信息列表'}
         actionRef={actionRef}
         rowKey={(r) => r.bookId}
         // 搜索的配置
@@ -95,7 +117,7 @@ const Page: React.FC = () => {
           searchGutter: [10, 15],
         }}
         request={async (params) => {
-          return await BookInfoList.run(params);
+          return await BookInfoList.run(wechatAppId ? { ...params, appId: wechatAppId } : params);
         }}
         scroll={{ x: 'auto' }}
         columns={columns({
@@ -105,8 +127,80 @@ const Page: React.FC = () => {
           enumList: state?.enumList,
           setWorkDirection,
           edit,
+          wechatAppId
         })}
         // bordered
+        // 组件模式多选
+        rowSelection={wechatAppId ? {
+          type: 'checkbox',
+          selectedRowKeys: editSelectedRow?.map((item: { bookId: any }) => item.bookId),
+          onSelect: (record, selected) => {
+            if (selected) {
+              setEditSelectedRow([...editSelectedRow, record]);
+            } else {
+              setEditSelectedRow(
+                editSelectedRow?.filter((item: { bookId: any }) => item.bookId !== record.bookId),
+              );
+            }
+          },
+          onSelectAll: (selected, rows, changeRows) => {
+            if (selected) {
+              setEditSelectedRow([...editSelectedRow, ...changeRows]);
+            } else {
+              let newArr = editSelectedRow?.filter((item: { bookId: any }) =>
+                changeRows.every((i) => i?.bookId !== item?.bookId),
+              );
+              setEditSelectedRow(newArr);
+            }
+          },
+        } : {
+          alwaysShowAlert: true,//总是展示 alert,默认无选择不展示
+          hideSelectAll: true,// 隐藏全选框
+          renderCell: () => null,  // 隐藏选择列中的勾选框
+          columnTitle: '',  // 去掉选择列的表头
+          columnWidth: 0,  // 设置选择列宽度为 0
+        }}
+        //多选展示栏
+        tableAlertRender={wechatAppId?({ selectedRowKeys, selectedRows }) => {
+          return (
+            <Space size={24}>
+              <span style={{ width: 90, display: 'inline-block' }}>
+                已选 {selectedRowKeys.length} 项
+              </span>
+              <span style={{ color: 'red' }}>
+                {selectedRows
+                  ?.map((item: { shortBookInfo?: any, longBookInfo?: any, bookId: any }) => <Tag
+                    closable
+                    key={item?.bookId}
+                    onClose={() => {
+                      let newArr = selectedRows?.filter((i) => i?.bookId != item?.bookId)
+                      setEditSelectedRow(newArr)
+                    }}>{item?.shortBookInfo?.bookName || item?.longBookInfo?.bookName}</Tag>)
+                }
+              </span>
+            </Space>
+          );
+        }:false}
+        // 添加取消选择按钮
+        tableAlertOptionRender={() => {
+          return (
+            <>
+              <Popconfirm
+                title="当前选中的书籍将从小程序中移除!"
+                onConfirm={delBook}
+              >
+                <Button type="link" danger >
+                  批量移除
+                </Button>
+              </Popconfirm>
+              <Button type="link" onClick={() => {
+                setEditSelectedRow([])
+              }}>
+                取消选择
+              </Button>
+            </>
+          );
+        }}
       />
       <BetaSchemaForm<DataItem>
         title={"信息配置"}

+ 3 - 13
src/pages/distribution/book/longBook/tableConfig.tsx

@@ -34,8 +34,9 @@ export const columns = (props: {
   categoryList?: any[];
   setWorkDirection: (w: any) => void;
   edit: (v: any) => void;
+  wechatAppId: any
 }): ProColumns<any>[] => {
-  let { authList, labelList, categoryList, enumList, setWorkDirection, edit } = props;
+  let { authList, labelList, categoryList, enumList, setWorkDirection, edit,wechatAppId } = props;
   let { styles } = useStyles();
   return [
     {
@@ -177,18 +178,6 @@ export const columns = (props: {
         return arr.get(source);
       },
     },
-    // {
-    //   title: 'configId',
-    //   dataIndex: 'configId',
-    //   key: 'configId',
-    //   align: 'center',
-    //   width: 70,
-    //   ellipsis: true,
-    //   hideInSearch: true,
-    //   render: (a) => {
-    //     return a;
-    //   },
-    // },
     {
       title: '是否开放给所有分销商',
       dataIndex: 'publicDistributor',
@@ -305,6 +294,7 @@ export const columns = (props: {
       align: 'center',
       className: 'table_fixed',
       hideInSearch: true,
+      hideInTable: !!wechatAppId,
       render: (a: any, b: any) => {
         return (
           <Space>

+ 16 - 1
src/pages/distribution/book/shortBook/formConfig.tsx

@@ -4,11 +4,12 @@ function formConfig(props: {
   enumList?: { [key: string]: any };
   bookList?: any[];
   distributorInfoList?: any[];
+  wxAppInfoList?:any[]
 }): ProFormColumnsType<{
   name: string;
   state: string;
 }>[] {
-  let { enumList, bookList, distributorInfoList } = props;
+  let { enumList, bookList, distributorInfoList,wxAppInfoList } = props;
   return [
     {
       title: 'VIP免费',
@@ -215,6 +216,20 @@ function formConfig(props: {
         ],
       },
     },
+    {
+      title: '不允许展示的小程序',
+      dataIndex: 'appIds',
+      valueType: 'select',
+      fieldProps:{
+        mode:"multiple",
+      },
+      valueEnum: () => {
+        return new Map(wxAppInfoList?.map(item=>[item.id,item.appName]))
+      },
+      formItemProps: {
+        style: { marginBottom: 10 },
+      },
+    },
     {
       dataIndex: 'bookDistributorConfig',
       valueType: 'formList',

+ 103 - 7
src/pages/distribution/book/shortBook/index.tsx

@@ -14,29 +14,36 @@ import {
   ProTable,
 } from '@ant-design/pro-components';
 import { useModel } from '@umijs/max';
-import { message } from 'antd';
+import { Button, message, Popconfirm, Space, Tag } from 'antd';
 import { useEffect, useRef, useState } from 'react';
 import formConfig from './formConfig';
 import { columns } from './tableConfig';
+import { apiWxAppInfoList, removeBook } from '@/services/distribution/weChatInfo';
 
 type DataItem = {
   name: string;
   state: string;
 };
-const Page: React.FC = () => {
+type Porps = {
+  wechatAppId?: string
+}
+const Page: React.FC<Porps> = (props) => {
+  let { wechatAppId } = props
   let { state, getLabelAndClassList } = useModel('global');
   const formRef = useRef<ProFormInstance>();
   const actionRef = useRef<ActionType>();
   let [workDirection, setWorkDirection] = useState<any>(null);
   let [open, setOpen] = useState<any>(null); //新增作者
   let [editValues, setEditValues] = useState<any>({});
+  const [editSelectedRow, setEditSelectedRow] = useState<any[]>([]); //小说列表选择
   // ======================API=======================
   let DistributorInfoList = useAjax((params) => apiDistributorInfoList(params)); //分销商列表
   let BookInfoList = useAjax((params) => apiShortBookInfoList(params), { type: 'table' }); //获取书籍列表
   let BookInfoBookConfig = useAjax((params) => apiShortBookInfoBookConfig(params)); //小说信息配置
   let BookInfoChapterAllList = useAjax((id) => apiShortBookInfoAllList(id)); //全部列表无分页
   let BookInfoConfigDetail = useAjax((id) => apiShortBookInfoConfigDetail(id)); //小说配置详情
-
+  let RemoveBook = useAjax((params) => removeBook(params)); //移除小程序中的书籍
+  let WxAppInfoList = useAjax(() => apiWxAppInfoList()); //全部小程序
   // 获取标签和分类
   useEffect(() => {
     getLabelAndClassList({ workDirection });
@@ -44,6 +51,7 @@ const Page: React.FC = () => {
   // 编辑
   const edit = (item: any) => {
     DistributorInfoList.run();
+    WxAppInfoList.run();
     BookInfoChapterAllList.run(item.bookId).then((res) => {
       setOpen(true);
       BookInfoConfigDetail.run(item.bookId).then((dres) => {
@@ -84,10 +92,25 @@ const Page: React.FC = () => {
     } else {
     }
   };
+    // 组件模式小说移除
+    const delBook=()=>{
+      let bookIds = editSelectedRow?.map(item=>item.bookId)
+      RemoveBook.run({bookIds,appId:wechatAppId}).then(res=>{
+        if(res.code === 200){
+          actionRef.current?.reload()
+          message.success("移除成功")
+          setEditSelectedRow([])
+        }
+        console.log(res)
+      })
+    }
   return (
-    <PageContainer>
+    <PageContainer
+      header={wechatAppId ? { title: "", breadcrumb: {} } : {}}
+      childrenContentStyle={wechatAppId ? { paddingBlockStart: 0 } : {}}
+    >
       <ProTable<any, any>
-        headerTitle={'短篇小说配置信息列表'}
+        headerTitle={wechatAppId ? "短篇小说列表" : '短篇小说配置信息列表'}
         actionRef={actionRef}
         rowKey={(r) => r.bookId}
         // 搜索的配置
@@ -96,7 +119,7 @@ const Page: React.FC = () => {
           searchGutter: [10, 15],
         }}
         request={async (params) => {
-          return await BookInfoList.run(params);
+          return await BookInfoList.run(wechatAppId ? { ...params, appId:wechatAppId } : params);
         }}
         scroll={{ x: 'auto' }}
         columns={columns({
@@ -106,8 +129,80 @@ const Page: React.FC = () => {
           enumList: state?.enumList,
           setWorkDirection,
           edit,
+          wechatAppId
         })}
-      // bordered
+        // bordered
+        // 组件模式多选
+        rowSelection={wechatAppId ? {
+          type: 'checkbox',
+          selectedRowKeys: editSelectedRow?.map((item: { bookId: any }) => item.bookId),
+          onSelect: (record, selected) => {
+            if (selected) {
+              setEditSelectedRow([...editSelectedRow, record]);
+            } else {
+              setEditSelectedRow(
+                editSelectedRow?.filter((item: { bookId: any }) => item.bookId !== record.bookId),
+              );
+            }
+          },
+          onSelectAll: (selected, rows, changeRows) => {
+            if (selected) {
+              setEditSelectedRow([...editSelectedRow, ...changeRows]);
+            } else {
+              let newArr = editSelectedRow?.filter((item: { bookId: any }) =>
+                changeRows.every((i) => i?.bookId !== item?.bookId),
+              );
+              setEditSelectedRow(newArr);
+            }
+          },
+        } : {
+          alwaysShowAlert: true,//总是展示 alert,默认无选择不展示
+          hideSelectAll: true,// 隐藏全选框
+          renderCell: () => null,  // 隐藏选择列中的勾选框
+          columnTitle: '',  // 去掉选择列的表头
+          columnWidth: 0,  // 设置选择列宽度为 0
+        }}
+      //多选展示栏
+      tableAlertRender={wechatAppId?({ selectedRowKeys, selectedRows }) => {
+        return (
+          <Space size={24}>
+            <span style={{ width: 90, display: 'inline-block' }}>
+              已选 {selectedRowKeys.length} 项
+            </span>
+            <span style={{ color: 'red' }}>
+              {selectedRows
+                ?.map((item: { shortBookInfo?: any, longBookInfo?: any, bookId: any }) => <Tag
+                  closable
+                  key={item?.bookId}
+                  onClose={() => {
+                    let newArr = selectedRows?.filter((i) => i?.bookId != item?.bookId)
+                    setEditSelectedRow(newArr)
+                  }}>{item?.shortBookInfo?.bookName || item?.longBookInfo?.bookName}</Tag>)
+              }
+            </span>
+          </Space>
+        );
+      }:false}
+        // 添加取消选择按钮
+        tableAlertOptionRender={() => {
+          return (
+            <>
+              <Popconfirm
+                title="当前选中的书籍将从小程序中移除!"
+                onConfirm={delBook}
+              >
+                <Button type="link" danger >
+                  批量移除
+                </Button>
+              </Popconfirm>
+              <Button type="link" onClick={() => {
+                setEditSelectedRow([])
+              }}>
+                取消选择
+              </Button>
+            </>
+          );
+        }}
       />
       <BetaSchemaForm<DataItem>
         title={"信息配置"}
@@ -127,6 +222,7 @@ const Page: React.FC = () => {
           enumList: state?.enumList,
           bookList: BookInfoChapterAllList?.data?.data,
           distributorInfoList: DistributorInfoList?.data?.data,
+          wxAppInfoList:WxAppInfoList?.data?.data
         })}
         loading={BookInfoBookConfig?.loading}
       />

+ 33 - 43
src/pages/distribution/book/shortBook/tableConfig.tsx

@@ -34,8 +34,9 @@ export const columns = (props: {
   categoryList?: any[];
   setWorkDirection: (w: any) => void;
   edit: (v: any) => void;
+  wechatAppId: any
 }): ProColumns<any>[] => {
-  let { authList, labelList, categoryList, enumList, setWorkDirection, edit } = props;
+  let { authList, labelList, categoryList, enumList, setWorkDirection, edit, wechatAppId } = props;
   let { styles } = useStyles();
   return [
     {
@@ -177,18 +178,6 @@ export const columns = (props: {
         return arr.get(source);
       },
     },
-    // {
-    //   title: 'configId',
-    //   dataIndex: 'configId',
-    //   key: 'configId',
-    //   align: 'center',
-    //   width: 70,
-    //   ellipsis: true,
-    //   hideInSearch: true,
-    //   render: (a) => {
-    //     return a;
-    //   },
-    // },
     {
       title: '是否开放给所有分销商',
       dataIndex: 'publicDistributor',
@@ -305,6 +294,7 @@ export const columns = (props: {
       align: 'center',
       className: 'table_fixed',
       hideInSearch: true,
+      hideInTable: !!wechatAppId,
       render: (a: any, b: any) => {
         return (
           <Space>
@@ -356,11 +346,11 @@ export const columns = (props: {
         let arr = enumList?.WORK_DIRECTION?.values;
         return arr
           ? new Map(
-              [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
-                value,
-                description,
-              ]),
-            )
+            [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
+              value,
+              description,
+            ]),
+          )
           : {};
       },
     },
@@ -404,11 +394,11 @@ export const columns = (props: {
         let arr = enumList?.SOURCE?.values;
         return arr
           ? new Map(
-              [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
-                value,
-                description,
-              ]),
-            )
+            [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
+              value,
+              description,
+            ]),
+          )
           : {};
       },
     },
@@ -424,11 +414,11 @@ export const columns = (props: {
         let arr = enumList?.BOOK_STATUS?.values;
         return arr
           ? new Map(
-              [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
-                value,
-                description,
-              ]),
-            )
+            [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
+              value,
+              description,
+            ]),
+          )
           : {};
       },
     },
@@ -444,11 +434,11 @@ export const columns = (props: {
         let arr = enumList?.SHELVE_STATUS?.values;
         return arr
           ? new Map(
-              [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
-                value,
-                description,
-              ]),
-            )
+            [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
+              value,
+              description,
+            ]),
+          )
           : {};
       },
     },
@@ -464,11 +454,11 @@ export const columns = (props: {
         let arr = enumList?.PAYMENT_TYPE?.values;
         return arr
           ? new Map(
-              [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
-                value,
-                description,
-              ]),
-            )
+            [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
+              value,
+              description,
+            ]),
+          )
           : {};
       },
     },
@@ -484,11 +474,11 @@ export const columns = (props: {
         let arr = enumList?.VIP_FREE?.values;
         return arr
           ? new Map(
-              [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
-                value,
-                description,
-              ]),
-            )
+            [{ value: '', description: '全部' }, ...arr]?.map(({ value, description }: any) => [
+              value,
+              description,
+            ]),
+          )
           : {};
       },
     },

+ 20 - 1
src/pages/distribution/miniprogram/weChatInfo/formConfig.tsx

@@ -2,7 +2,8 @@ import { ProFormColumnsType } from '@ant-design/pro-components';
 function formConfig(
   enumList?: { [key: string]: any },
   getWechatMchAll?: any[],
-  pageList?: any[]
+  pageList?: any[],
+  distributorInfoList?:any[]
 ): ProFormColumnsType<{
   name: string;
   state: string;
@@ -122,6 +123,24 @@ function formConfig(
           : {};
       },
     },
+    {
+      title: '自然量归属',
+      tooltip:"自然量用户的默认归属分销商",
+      dataIndex: 'naturalDistributorId',
+      valueType: 'select',
+      formItemProps: {
+        style: { marginBottom: 10 },
+        rules: [
+          {
+            required: true,
+            message: '此项为必填项',
+          },
+        ],
+      },
+      valueEnum: () => {
+        return new Map(distributorInfoList?.map(({ id, companyName }: any) => [id, companyName]));
+      },
+    },
     {
       title: '小程序页面模板',
       dataIndex: 'templateName',

+ 26 - 9
src/pages/distribution/miniprogram/weChatInfo/index.tsx

@@ -18,12 +18,13 @@ import {
   ProTable,
 } from '@ant-design/pro-components';
 import { useModel } from '@umijs/max';
-import { Button, message } from 'antd';
+import { Button, Drawer, message } from 'antd';
 import { useCallback, useEffect, useRef, useState } from 'react';
 import formConfig from './formConfig';
 import { columns } from './tableConfig';
 import { appPageList } from '@/services/distribution/pagesManage';
-
+import LongBook from '@/pages/distribution/book/longBook'
+import ShortBook from '@/pages/distribution/book/shortBook'
 type DataItem = {
   name: string;
   state: string;
@@ -36,6 +37,7 @@ const Page: React.FC = () => {
   let [open, setOpen] = useState<any>(null); //新增
   let [assignOpen, setAssignOpen] = useState(false);
   let [editValues, setEditValues] = useState<any>({});
+  let [bookManage, setBookManage] = useState<any>(null);
   let WxAppInfoUpdateEnabled = useAjax((params) => apiWxAppInfoUpdateEnabled(params)); //微信小程序状态更新
   let WxAppInfoUpdate = useAjax((params) => apiWxAppInfoUpdate(params)); //微信小程序信息更新
   let WxAppInfo = useAjax((params) => apiWxAppInfo(params)); //微信小程序信息新增
@@ -50,6 +52,7 @@ const Page: React.FC = () => {
   useEffect(() => {
     appPageListApi.run()
     getWechatMchAll.run();
+    DistributorInfoList.run();
   }, []);
   // 删除
   const del = (id: any) => {
@@ -72,12 +75,11 @@ const Page: React.FC = () => {
   // 指派
   const mimiAssign = useCallback(
     (params?: any) => {
-      DistributorInfoList.run();
       setEditValues(params);
       setAssignOpen(true);
-      setTimeout(()=>{
-        assignRormRef?.current?.setFieldsValue({ distributorId: params?.distributorInfo?.id, advertisingChannels: params?.advertisingChannels });
-      },50)
+      setTimeout(() => {
+        assignRormRef?.current?.setFieldsValue({ distributorIds: params?.distributorIds, advertisingChannels: params?.advertisingChannels });
+      }, 50)
     },
     [WxAppInfoPageList],
   );
@@ -129,6 +131,7 @@ const Page: React.FC = () => {
         rowKey={(r) => r.id}
         search={{
           labelWidth: 120,
+          span: 5
         }}
         scroll={{ x: 'auto' }}
         request={async (params) => {
@@ -147,7 +150,7 @@ const Page: React.FC = () => {
             </Button>,
           ];
         }}
-        columns={columns(closeForm, del, stateUpdata, mimiAssign)}
+        columns={columns(closeForm, del, stateUpdata, mimiAssign, setBookManage)}
       // bordered
       />
       {/* 新增修改 */}
@@ -166,7 +169,7 @@ const Page: React.FC = () => {
         rowProps={{ gutter: [10, 10] }}
         layout="horizontal"
         onFinish={submit}
-        columns={formConfig(state?.enumList, getWechatMchAll?.data?.data, appPageListApi?.data?.data)}
+        columns={formConfig(state?.enumList, getWechatMchAll?.data?.data, appPageListApi?.data?.data, DistributorInfoList?.data?.data)}
         loading={WxAppInfoUpdate?.loading || WxAppInfo?.loading}
       />
       {/*指派  */}
@@ -193,7 +196,10 @@ const Page: React.FC = () => {
         columns={[
           {
             title: '分销商',
-            dataIndex: 'distributorId',
+            dataIndex: 'distributorIds',
+            fieldProps:{
+              mode: "multiple",
+            },
             formItemProps: {
               style: { marginBottom: 10 },
               rules: [
@@ -226,6 +232,17 @@ const Page: React.FC = () => {
         ]}
         loading={WxAppInfoWxAppConfigAddOrEdit?.loading}
       />
+      {/* 小说管理 */}
+      <Drawer
+        title={`《${bookManage?.appName}》` + "小说批量移除管理"}
+        open={!!bookManage}
+        destroyOnClose
+        onClose={() => { setBookManage(null) }}
+        footer={null}
+        width={'90vw'}
+      >
+        {bookManage?.appCategory === 1 ? <LongBook wechatAppId={bookManage?.id} /> : <ShortBook wechatAppId={bookManage?.id} />}
+      </Drawer>
     </PageContainer>
   );
 };

+ 25 - 12
src/pages/distribution/miniprogram/weChatInfo/tableConfig.tsx

@@ -7,6 +7,7 @@ export const columns = (
   del: (id: any) => void,
   stateUpdata: (id: any, ck: boolean) => void,
   mimiAssign: (b: any) => void,
+  setBookManage: (b: any) => void
 ): ProColumns<any>[] => {
   let { getEnum } = useModel('global');
   return [
@@ -27,15 +28,6 @@ export const columns = (
       width: 70,
       ellipsis: true,
     },
-    // {
-    //   title: '小程序秘钥',
-    //   dataIndex: 'appSecret',
-    //   key: 'appSecret',
-    //   align: 'center',
-    //   width: 80,
-    //   ellipsis: true,
-    //   hideInSearch: true,
-    // },
     {
       title: '小程序名称',
       dataIndex: 'appName',
@@ -44,6 +36,18 @@ export const columns = (
       ellipsis: true,
       align: 'center',
     },
+    {
+      title: '小程序类别',
+      dataIndex: 'appCategory',
+      key: 'appCategory',
+      width: 80,
+      ellipsis: true,
+      align: 'center',
+      valueEnum: () => {
+        let arr = [{ value: 1, text: "长篇" }, { value: 2, text: "短篇" }]
+        return new Map(arr.map(item => [item.value, item.text]))
+      },
+    },
     {
       title: '小程序页面模板',
       dataIndex: 'templateName',
@@ -115,13 +119,13 @@ export const columns = (
     },
     {
       title: '已指派(分销商)',
-      dataIndex: 'distributorInfo',
+      dataIndex: 'distributorInfos',
       width: 80,
       align: 'center',
       ellipsis: true,
       hideInSearch: true,
       render: (a, b: any) => {
-        return <a>{b?.distributorInfo?.companyName}</a>;
+        return b?.distributorInfos?.map((item: any) => <Tag color={"geekblue"} bordered={false} key={item.id}> {item?.companyName} </Tag>);
       },
     },
     {
@@ -133,7 +137,7 @@ export const columns = (
       hideInSearch: true,
       render: (a, b: any) => {
         let map = getEnum("ADVERTISING_CHANNEL", 'map')
-        return b?.advertisingChannels?.map((n: any) => <Tag  color={"processing"} bordered={false}> {map.get(n)} </Tag>)
+        return b?.advertisingChannels?.map((n: any) => <Tag color={"processing"} bordered={false} key={n}> {map.get(n)} </Tag>)
       },
     },
     {
@@ -190,6 +194,15 @@ export const columns = (
               指派
             </Button>
             <Users data={b} />
+            <Button
+              onClick={() => {
+                setBookManage(b);
+              }}
+              size="small"
+              type="link"
+            >
+              小说管理
+            </Button>
           </Space>
         );
       },

+ 4 - 2
src/services/book/longbookList/index.tsx

@@ -110,9 +110,11 @@ export async function apiLongBookParagraphList(params: any) {
  * @param sort
  * @param isPayment
  * */
-export async function apiLongBookParagraph(id: any) {
-  return request(api + `/bookContent/admin/longBookChapter/one/${id}`, {
+export async function apiLongBookParagraph(params:any) {
+  let {chapterNo,bookId} = params
+  return request(api + `/bookContent/admin/longBookChapter/one/${bookId}`, {
     method: 'GET',
+    params:{chapterNo}
   });
 }
 

+ 10 - 0
src/services/distribution/weChatInfo/index.tsx

@@ -104,3 +104,13 @@ export async function wechatMchAll() {
     method: 'POST',
   });
 }
+/**
+ * 移除小程序书籍
+ * */ 
+export async function removeBook(params:any){
+  let {appId,bookIds} = params
+  return request(api+`/bookDistributionPlatform/admin/wechatMiniapp/removeBook?appId=${appId}`,{
+    method: 'POST',
+    data:bookIds
+  })
+}