فهرست منبع

feat: 藏品故事-编辑/查看/新增

lanxin 2 هفته پیش
والد
کامیت
c1e8ee93e4

+ 4 - 4
src/pages/Eculture/E2story/E2edit/index.tsx

@@ -12,7 +12,7 @@ import { Button, Input } from 'antd'
 import { backPageFu } from '@/utils/history'
 import { useParams } from 'react-router-dom'
 import { API_getFileListByIds } from '@/store/action/Cledger/C4file'
-import { API_getGoodsList } from '@/store/action/Cledger/C1ledger'
+import { API_getGoodsLists } from '@/store/action/Cledger/C1ledger'
 import SelectGoods from '@/pages/Zother/SelectGoods'
 import { sgBaseFormDataGood, sgTopSelectDomGood } from '@/pages/Zother/SonGoodsList/data'
 
@@ -165,7 +165,7 @@ function E2edit() {
             {showSelectGoods && (
               <SelectGoods
                 myType='藏品'
-                API_getList={API_getGoodsList}
+                API_getList={API_getGoodsLists}
                 closeFu={() => setShowSelectGoods(false)}
                 baseFormData={sgBaseFormDataGood}
                 topSelectDom={sgTopSelectDomGood}
@@ -219,7 +219,7 @@ function E2edit() {
         <div className={styles.EditBtn}>
           {isView ? (
             <div>
-              <Button type='default' onClick={() => backPageFu('-1')}>
+              <Button type='default' onClick={() => backPageFu('story')}>
                 返回
               </Button>
             </div>
@@ -228,7 +228,7 @@ function E2edit() {
               <Button type='primary' onClick={() => submitFu()}>
                 提交
               </Button>
-              <MyPopconfirm txtK='取消' onConfirm={() => backPageFu('-1')} />
+              <MyPopconfirm txtK='取消' onConfirm={() => backPageFu('story')} />
             </div>
           )}
         </div>

+ 21 - 3
src/pages/Eculture/E2story/index.tsx

@@ -2,13 +2,15 @@ import React, { useMemo, useCallback } from 'react'
 import styles from './index.module.scss'
 import { useSelector } from 'react-redux'
 import { RootState } from '@/store'
-import { E2_APIgetList } from '@/store/action/Eculture/E2story'
+import { E2_APIgetList, E2_APIdel } from '@/store/action/Eculture/E2story'
+import { MessageFu } from '@/utils/message'
 import TableList from '@/pages/Zother/TableList'
 import { baseFormData } from '@/pages/Zother/data'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { storyTableC } from '@/utils/tableData'
 import { Button } from 'antd'
 import history from '@/utils/history'
+import { useDispatch } from 'react-redux'
 
 const E2topSearch = [
   {
@@ -35,9 +37,25 @@ const dataExport = () => {
 }
 
 function D1register() {
+  const dispatch = useDispatch()
   // 从仓库拿数据
   const tableInfo = useSelector((state: RootState) => state.E2story.tableInfo)
 
+  const getListFu = useCallback(() => {
+    dispatch(E2_APIgetList(D1baseFormData))
+  }, [dispatch])
+
+  const delFu = useCallback(
+    async (id: string) => {
+      const res = await E2_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
   // 故事管理定制右侧内容
   const storyTableListToprr = ({
     clickSearch,
@@ -79,12 +97,12 @@ function D1register() {
             <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '2')}>
               编辑
             </Button>
-            <MyPopconfirm txtK='删除' onConfirm={() => console.log('del')} />
+            <MyPopconfirm txtK='删除' onConfirm={() => delFu(item.id)} />
           </>
         )
       }
     ]
-  }, [tableBtnFu])
+  }, [delFu, tableBtnFu])
 
   return (
     <div className={styles.E2story}>

+ 1 - 0
src/pages/Zother/SelectGoods/index.tsx

@@ -77,6 +77,7 @@ function SelectGoods({
     if (timeKey === 0) obj.pageSize = 99999
 
     const res = await API_getList(obj)
+    console.log(res)
     if (res.code === 0) {
       let resArr: any[] = res.data.records || []
 

+ 8 - 1
src/store/action/Cledger/C1ledger.ts

@@ -9,7 +9,7 @@ export const API_getGoodsInfo = (id: number) => {
 }
 
 /**
- * 藏品总账-获取藏品列表
+ * 藏品总账-获取藏品分页列表
  */
 export const API_getGoodsList = (data: any): any => {
   return async (dispatch: AppDispatch) => {
@@ -26,6 +26,13 @@ export const API_getGoodsList = (data: any): any => {
 }
 
 /**
+ * 藏品总账-获取藏品列表
+ */
+export const API_getGoodsLists = (data: any): any => {
+  return http.post(`cms/good/ledger/page`, data)
+}
+
+/**
  * 藏品-附件-根据藏品Id查询
  */
 type GetGoodsByGoodIdReq = {

+ 3 - 2
src/store/action/Eculture/E2story.ts

@@ -21,8 +21,9 @@ export const E2_APIgetList = (data: any): any => {
 /**
  * 故事 - 删除
  */
-export const E2_APIdel = (id: string) => {
-  return http.post(`cms/story/removes/`, { ids: [id] })
+export const E2_APIdel = (id: string | string[]) => {
+  const ids = Array.isArray(id) ? id : [id]
+  return http.post('/cms/story/removes', ids) // 直接传数组
 }
 
 /**