shaogen1995 2 hafta önce
ebeveyn
işleme
33aa0c13a6

+ 0 - 6
src/pages/Benter/B4enterCang/B4edit/index.tsx

@@ -24,15 +24,9 @@ function B4edit() {
 
           {/* 藏品清单 */}
           <SonGoodsList
-            fileUpInfo={{ myUrl: 'cms/order/hide/son/upload', dirCode: 'enterCangGoods' }}
             selectApi={B4_APIgetClueList}
-            // 这里其实不用传,为了类型更具体,先这样。咱不设置为可选参数
-            addGoodsApi=''
-            // 不是从线索中拿数据,是从已入馆中拿
             isClueSelect={false}
-            // 选择藏品字符串
             btnTxt='从已入馆藏品中添加'
-            // 没有新增和编辑
             addShow={false}
           />
 

+ 4 - 0
src/pages/Dmanage/D3writeOff/D3edit/index.module.scss

@@ -0,0 +1,4 @@
+// .D3edit {
+//   :global {
+//   }
+// }

+ 43 - 0
src/pages/Dmanage/D3writeOff/D3edit/index.tsx

@@ -0,0 +1,43 @@
+import React from 'react'
+import styles from './index.module.scss'
+import { rowArrTemp } from '@/pages/Zother/data'
+import { InfoProvider } from '@/pages/Zother/InfoContext'
+import EditTop from '@/pages/Zother/EditTop'
+import { D3_APIgetClueList, D3API_obj } from '@/store/action/Dmanage/D3writeOff'
+import SonGoodsList from '@/pages/Zother/SonGoodsList'
+import EditBtn from '@/pages/Zother/EditBtn'
+
+const rowArr = rowArrTemp('注销')
+
+function D3edit() {
+  return (
+    <InfoProvider>
+      <div className={styles.D3edit} id='editBox'>
+        <div className='editMain'>
+          {/* 顶部 */}
+          <EditTop
+            pageTxt='藏品注销'
+            rowArr={rowArr}
+            APIobj={D3API_obj}
+            fileUpInfo={{ myUrl: 'cms/orderLogout/upload', dirCode: 'writeOff' }}
+          />
+
+          {/* 藏品清单 */}
+          <SonGoodsList
+            selectApi={D3_APIgetClueList}
+            isClueSelect={false}
+            btnTxt='选择藏品'
+            addShow={false}
+          />
+
+          {/* 底部按钮 */}
+          <EditBtn path='/writeOff' APIobj={D3API_obj} checkListTxt='藏品' />
+        </div>
+      </div>
+    </InfoProvider>
+  )
+}
+
+const MemoD3edit = React.memo(D3edit)
+
+export default MemoD3edit

+ 4 - 4
src/pages/Dmanage/D3writeOff/index.module.scss

@@ -1,4 +1,4 @@
-.D3writeOff {
-  :global {
-  }
-}
+// .D3writeOff {
+//   :global {
+//   }
+// }

+ 24 - 0
src/pages/Dmanage/D3writeOff/index.tsx

@@ -1,9 +1,33 @@
 import React from 'react'
 import styles from './index.module.scss'
+import { baseFormData, topSearch } from '@/pages/Zother/data'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import TableList from '@/pages/Zother/TableList'
+import { D3_APIgetList } from '@/store/action/Dmanage/D3writeOff'
+import { baseTableC } from '@/utils/tableData'
+
+const search = topSearch('注销')
+
+const baseFormDataRes = baseFormData()
+
 function D3writeOff() {
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.D3writeOff.tableInfo)
+
   return (
     <div className={styles.D3writeOff}>
       <div className='pageTitle'>藏品注销</div>
+
+      <TableList
+        baseFormData={baseFormDataRes}
+        getListAPI={D3_APIgetList}
+        pageKey='writeOff'
+        tableInfo={tableInfo}
+        columnsTemp={baseTableC('注销')}
+        yHeight={585}
+        searchDom={search}
+      />
     </div>
   )
 }

+ 6 - 0
src/pages/Layout/data.ts

@@ -341,6 +341,12 @@ export const routerSon: RouterTypeRow[] = [
     path: '/register_edit/:key/:id',
     Com: React.lazy(() => import('../Dmanage/D1register/D1edit'))
   },
+  {
+    id: 430,
+    name: '藏品注销-详情页',
+    path: '/writeOff_edit/:key/:id',
+    Com: React.lazy(() => import('../Dmanage/D3writeOff/D3edit'))
+  },
 
   {
     id: 602,

+ 3 - 2
src/pages/Zother/EditBtn/index.tsx

@@ -11,6 +11,7 @@ import { fileIdsResFu } from '@/utils'
 import { API_objType } from '@/store/action/Dmanage/D1register'
 import AuditList from '../AuditList'
 import { GoodsType } from '../SonGoodsList/data'
+import { Typetable } from '../data'
 
 type Props = {
   path: string
@@ -20,7 +21,7 @@ type Props = {
   // 需要校验的字段和提示
   verifyArr?: { key: string; txt: string }[]
   // 其他需要校验的回调函数,返回 flag为true 表示校验不通过,txt为提示语
-  verifyBackFu?: () => { flag: true; txt: string; info?: any }
+  verifyBackFu?: (info: Typetable) => { flag: true; txt: string; info?: any }
 }
 
 function EditBtn({
@@ -180,7 +181,7 @@ function EditBtn({
 
           // 其他自己制定的校验函数
           if (verifyBackFu) {
-            const flagObj = verifyBackFu()
+            const flagObj = verifyBackFu(info)
             if (flagObj.flag) {
               if (isLook) history.replace(`${path}_edit/2/${info.id}`)
               MessageFu.warning(flagObj.txt + txt)

+ 6 - 6
src/pages/Zother/SonGoodsList/index.tsx

@@ -20,13 +20,13 @@ import SelectGoods from '../SelectGoods'
 import AddClues from '../AddClues'
 
 type Props = {
-  // 上传附件的信息
-  fileUpInfo: FileUpInfoType
+  // 上传附件的信息(不需要新增藏品的不用传)
+  fileUpInfo?: FileUpInfoType
   // 从征集中添加的api
   selectApi: any
-  // 新增藏品的api
-  addGoodsApi: any
-  // 需要从征集里面选择数据(现在是藏品登记/藏品入馆 需要 藏品入藏不需要)
+  // 新增藏品的api(不需要新增藏品的不用传)
+  addGoodsApi?: any
+  // 拿线索为true,拿藏品为false
   isClueSelect: boolean
   // 选择藏品的按钮字符串
   btnTxt?: string
@@ -126,7 +126,7 @@ function SonGoodsList({
       </div>
       {openInfo.id ? (
         <AddGoods
-          fileUpInfo={fileUpInfo}
+          fileUpInfo={fileUpInfo!}
           APIsave={addGoodsApi}
           info={openInfo}
           isEdit={false}

+ 38 - 0
src/store/action/Dmanage/D3writeOff.ts

@@ -0,0 +1,38 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+import { APIbase } from '../layout'
+
+/**
+ * 藏品注销 -获取分页列表
+ */
+export const D3_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/orderLogout/page', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'D3/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 藏品注销-选择藏品
+ */
+export const D3_APIgetClueList = (data: any) => {
+  return http.post('cms/orderLogout/good/getList', data)
+}
+
+export const D3API_obj = {
+  创建订单: () => APIbase('get', 'cms/orderLogout/create'),
+  获取详情: (id: number) => APIbase('get', `cms/orderLogout/detail/${id}`),
+  草稿: (data: any) => APIbase('post', `cms/orderLogout/saveDraft`, data),
+  发起: (data: any) => APIbase('post', `cms/orderLogout/saveApply`, data),
+  重新发起: (id: number) => APIbase('get', `cms/orderLogout/reissue/${id}`),
+  审批: (data: any) => APIbase('post', `cms/orderLogout/audit`, data),
+  撤回: (id: number) => APIbase('get', `cms/orderLogout/revocation/${id}`),
+  删除: (id: number) => APIbase('get', `cms/orderLogout/remove/${id}`)
+}

+ 28 - 0
src/store/reducer/Dmanage/D3writeOff.ts

@@ -0,0 +1,28 @@
+import { Typetable } from '@/pages/Zother/data'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as Typetable[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'D3/getList'
+  payload: { list: Typetable[]; total: number }
+}
+
+// reducer
+export default function Reducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'D3/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 2 - 0
src/store/reducer/index.ts

@@ -7,6 +7,7 @@ import B1collect from './Benter/B1collect'
 import B2enterGuan from './Benter/B2enterGuan'
 import B4enterCang from './Benter/B4enterCang'
 import D1register from './Dmanage/D1register'
+import D3writeOff from './Dmanage/D3writeOff'
 import E1tag from './Eculture/E1tag'
 import E2story from './Eculture/E2story'
 
@@ -25,6 +26,7 @@ const rootReducer = combineReducers({
   B2enterGuan,
   B4enterCang,
   D1register,
+  D3writeOff,
   E1tag,
   E2story,