Przeglądaj źródła

feat: Shao Gen is my son of dog.

jinx 1 tydzień temu
rodzic
commit
dfcae0436f

+ 9 - 0
src/components/MyTable/index.module.scss

@@ -20,6 +20,15 @@
           color: var(--themeColor);
         }
       }
+      .MTscrollCell {
+        width: 100%;
+        overflow-x: auto;
+        overflow-y: hidden;
+      }
+      .MTscrollCellInner {
+        min-width: max-content;
+        white-space: nowrap;
+      }
       // .MTclickAc {
       //   color: var(--themeColor);
       // }

+ 8 - 0
src/components/MyTable/index.tsx

@@ -151,6 +151,14 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
             ) : (
               isNull
             ),
+          txtScroll: (item: any) => {
+            const value = item[v[2]] === 0 ? 0 : item[v[2]] || isNull
+            return (
+              <div className='MTscrollCell' title={`${value}`}>
+                <div className='MTscrollCellInner'>{value}</div>
+              </div>
+            )
+          },
           txtArr: (item: any) => (
             <div dangerouslySetInnerHTML={{ __html: (item[v[2]] || []).join('<br/>') }}></div>
           ),

+ 56 - 65
src/pages/A1check/A2manage/A2add/index.tsx

@@ -66,17 +66,8 @@ type Props = {
 const emptyTxt = '(空)'
 const requestBaseURL = envFlag ? '/api/' : `${baseUrlTemp}/api/`
 const saveApi = 'cms/checkFirmVersion/save'
-const submitApiCandidates = [
-  'cms/checkFirmVersion/submit',
-  'cms/checkFirmVersion/commit',
-  'cms/checkFirmVersion/effect',
-  'cms/checkFirmVersion/publish'
-]
-const deleteApiCandidates = [
-  'cms/checkFirmVersion/delete',
-  'cms/checkFirmVersion/remove',
-  'cms/checkFirmVersion/del'
-]
+const updateSubmitApi = 'cms/checkFirmVersion/updateSubmit'
+const deleteApi = 'cms/checkFirmVersion/delete'
 const goodsTotalCandidates = [
   'ledgerRegister',
   'ledgerTotal',
@@ -291,9 +282,11 @@ const resolveUserNameText = (
   return joinDisplayText(parseNameList(fallback))
 }
 
-const normalizeGoodsRow = (item: GoodsRowType, index: number, handlerName?: string) => {
+const normalizeGoodsRow = (item: GoodsRowType, index: number) => {
   const unInfoList = parseInventoryMultiValue(item.unInfoList || item.unInfo)
   const reasonInfoList = parseInventoryMultiValue(item.reasonInfoList || item.reasonInfo)
+  const rowHandler = pickValue(item, ['handler', 'handlerName'], emptyTxt)
+  const rowHandleTime = pickValue(item, ['handleTime'], emptyTxt)
 
   return {
     ...item,
@@ -308,14 +301,15 @@ const normalizeGoodsRow = (item: GoodsRowType, index: number, handlerName?: stri
     reasonInfoList,
     unInfo: unInfoList.join(multiValueSeparator),
     reasonInfo: reasonInfoList.join(multiValueSeparator),
-    handler: item.handler || handlerName || emptyTxt,
+    handler: rowHandler,
     status: pickValue(item, ['status', 'checkStatus', 'inventoryStatus'], ''),
-    updateTime: item.updateTime || item.createTime || dayjs().format('YYYY-MM-DD HH:mm:ss')
+    handleTime: rowHandleTime,
+    updateTime: rowHandleTime
   }
 }
 
-const normalizeRangeGoodsRow = (item: GoodsRowType, index: number, handlerName?: string) => {
-  const { id, ...rest } = normalizeGoodsRow(item, index, handlerName)
+const normalizeRangeGoodsRow = (item: GoodsRowType, index: number) => {
+  const { id, ...rest } = normalizeGoodsRow(item, index)
   return rest
 }
 
@@ -363,6 +357,18 @@ const resolveSubmitStatusText = (value: any) => {
 const resolveSubmitStatus = (info: any) =>
   resolveSubmitStatusText(pickValue(info, ['submitStatus'], ''))
 
+const sanitizePlaceholderValue = (value: any): any => {
+  if (value === emptyTxt) return ''
+  if (Array.isArray(value)) return value.map(item => sanitizePlaceholderValue(item))
+  if (value && typeof value === 'object') {
+    return Object.keys(value).reduce((prev, key) => {
+      prev[key] = sanitizePlaceholderValue(value[key])
+      return prev
+    }, {} as Record<string, any>)
+  }
+  return value
+}
+
 const buildBasePayload = (
   formData: AddFormType,
   userMap: Record<string, string>,
@@ -381,7 +387,7 @@ const buildBasePayload = (
     owner: ownerName,
     handlerIds,
     handler: handlerName,
-    firms: list
+    firms: sanitizePlaceholderValue(list)
   }
 }
 
@@ -481,8 +487,8 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
 
     return {
       all: pickNumber(detailInfo, ['count']) ?? localCount.all,
-      pending: pickNumber(detailInfo, ['checkedCount']) ?? localCount.pending,
-      done: pickNumber(detailInfo, ['unCheckedCount']) ?? localCount.done
+      pending: pickNumber(detailInfo, ['unCheckedCount']) ?? localCount.pending,
+      done: pickNumber(detailInfo, ['checkedCount']) ?? localCount.done
     }
   }, [detailInfo, pageMode, selectedList])
 
@@ -630,10 +636,8 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
     syncTableList(activeRangeForm, selectedList, goodsTab)
   }, [activeRangeForm, goodsTab, selectedList, syncTableList])
 
-  const getDetailGoodsListFu = useCallback((info: any, handlerName?: string) => {
-    return getDetailGoodsRecords(info).map((item: any, index: number) =>
-      normalizeGoodsRow(item, index, handlerName)
-    )
+  const getDetailGoodsListFu = useCallback((info: any) => {
+    return getDetailGoodsRecords(info).map((item: any, index: number) => normalizeGoodsRow(item, index))
   }, [])
 
   const getDetailFu = useCallback(async () => {
@@ -643,7 +647,7 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
       const res = await A2_APIgetInfo(detailId)
       if (res.code === 0) {
         const info = res.data || {}
-        const list = getDetailGoodsListFu(info, info.handler || info.handlerName)
+        const list = getDetailGoodsListFu(info)
         setDetailInfo(info)
         setFormData(buildDetailForm(info))
         setSelectedList(list)
@@ -674,7 +678,7 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
         const res = await http.post('cms/importLedger/pageList', buildRangePayload(query))
         if (res.code === 0) {
           const list = (res.data.records || []).map((item: any, index: number) =>
-            normalizeRangeGoodsRow(item, index, formData.handlerName)
+            normalizeRangeGoodsRow(item, index)
           )
           setRangeModalList(list)
         }
@@ -682,7 +686,7 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
         setRangeModalLoading(false)
       }
     },
-    [formData.handlerName]
+    []
   )
 
   const openRangeModalFu = useCallback(() => {
@@ -862,14 +866,6 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
     setRemarkValue('')
   }, [currentRemarkKey, remarkValue, saveFillGoodsFu, selectedList])
 
-  const requestByCandidates = useCallback(async (apiList: string[], payload: any) => {
-    for (const api of apiList) {
-      const res = await silentPost(api, payload)
-      if (res) return res
-    }
-    return null
-  }, [])
-
   const buildValidateList = useCallback(() => {
     return selectedList
       .map((item, index) => {
@@ -909,19 +905,20 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
     if (!detailId) return
     setSubmitLoading(true)
     try {
-      const res = await requestByCandidates(submitApiCandidates, { id: detailId })
-      if (res) {
-        setValidateModalOpen(false)
-        MessageFu.success(res.msg || '提交成功')
-        if (saveSuccessFu) saveSuccessFu()
-        await getDetailFu()
+      const res = await silentPost(updateSubmitApi, { id: detailId, submitStatus: 1 })
+      if (!res) {
+        MessageFu.warning('提交失败,请稍后重试')
         return
       }
-      MessageFu.warning('暂未匹配到提交盘点单接口,请联系管理员确认')
+
+      setValidateModalOpen(false)
+      MessageFu.success(res.msg || '提交成功')
+      if (saveSuccessFu) saveSuccessFu()
+      await getDetailFu()
     } finally {
       setSubmitLoading(false)
     }
-  }, [detailId, getDetailFu, requestByCandidates, saveSuccessFu])
+  }, [detailId, getDetailFu, saveSuccessFu])
 
   const saveFu = useCallback(async () => {
     if (!formData.name.trim()) return MessageFu.warning('请填写盘点名称')
@@ -988,26 +985,19 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
     if (!detailId) return
     setSubmitLoading(true)
     try {
-      const res = await requestByCandidates(
-        [
-          'cms/checkFirmVersion/recall',
-          'cms/checkFirmVersion/revoke',
-          'cms/checkFirmVersion/withdraw',
-          'cms/checkFirmVersion/cancelSubmit'
-        ],
-        { id: detailId }
-      )
-      if (res) {
-        MessageFu.success(res.msg || '撤回成功')
-        if (saveSuccessFu) saveSuccessFu()
-        await getDetailFu()
+      const res = await silentPost(updateSubmitApi, { id: detailId, submitStatus: 0 })
+      if (!res) {
+        MessageFu.warning('撤回失败,请稍后重试')
         return
       }
-      MessageFu.warning('暂未匹配到撤回盘点单接口,请联系管理员确认')
+
+      MessageFu.success(res.msg || '撤回成功')
+      if (saveSuccessFu) saveSuccessFu()
+      await getDetailFu()
     } finally {
       setSubmitLoading(false)
     }
-  }, [detailId, getDetailFu, requestByCandidates, saveSuccessFu])
+  }, [detailId, getDetailFu, saveSuccessFu])
 
   const exportValidateFu = useCallback(() => {
     if (!validateList.length) return
@@ -1043,20 +1033,21 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
       onOk: async () => {
         setDeleteLoading(true)
         try {
-          const res = await requestByCandidates(deleteApiCandidates, { id: detailId })
-          if (res) {
-            MessageFu.success(res.msg || '删除成功')
-            if (saveSuccessFu) saveSuccessFu()
-            if (closeFu) closeFu()
+          const res = await silentPost(deleteApi, { id: detailId })
+          if (!res) {
+            MessageFu.warning('删除失败,请稍后重试')
             return
           }
-          MessageFu.warning('暂未匹配到删除盘点单接口,请联系管理员确认')
+
+          MessageFu.success(res.msg || '删除成功')
+          if (saveSuccessFu) saveSuccessFu()
+          if (closeFu) closeFu()
         } finally {
           setDeleteLoading(false)
         }
       }
     })
-  }, [closeFu, detailId, requestByCandidates, saveSuccessFu])
+  }, [closeFu, detailId, saveSuccessFu])
 
   const rangeRowSelection = useMemo(
     () => ({
@@ -1321,7 +1312,7 @@ function A2add({ closeFu, saveSuccessFu, detailId, mode = 'add' }: Props) {
       },
       {
         title: '编辑时间',
-        dataIndex: 'updateTime',
+        dataIndex: 'handleTime',
         width: 180
       }
     ],

+ 1 - 1
src/pages/A1check/A2manage/data.ts

@@ -65,7 +65,7 @@ export const A2columns = (val: '列表' | '详情', lookFu?: (id: any) => void)
     ['txt', '不符原因', 'reasonInfo'],
     ['txt', '备注', 'remark'],
     ['txt', '经办人', 'handler'],
-    ['txt', '编辑时间', 'updateTime']
+    ['txt', '编辑时间', 'handleTime']
   ]
   const arr2 = [
     ['text', '盘点名称', 'name', 20, 'S', lookFu, 'firmVersionId'],

+ 20 - 3
src/pages/A1check/A2manage/index.tsx

@@ -1,8 +1,8 @@
-import React, { useCallback, useMemo, useRef, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { Button } from 'antd'
 import AAbtn from '@/pages/ZcomPage/AAbtn'
-import { openLink } from '@/utils/history'
+import history, { openLink, useQuery } from '@/utils/history'
 import A2tab1 from './A2tab1'
 import TopSearch from '@/pages/ZcomPage/TopSearch'
 import { A2columns, A2topArr } from './data'
@@ -21,6 +21,7 @@ const resolveSubmitStatusText = (value: any) => {
 }
 
 function A2manage() {
+  const query = useQuery()
   const [tabAc, setTabAc] = useState('按盘点批次')
 
   const tab1Ref = useRef<any>(null)
@@ -66,6 +67,22 @@ function A2manage() {
     setLookId(tempId)
   }, [])
 
+  useEffect(() => {
+    const tempId = Number(query.lookId || 0)
+    if (!tempId) return
+    setTabAc(tabArr[0])
+    setLookId(tempId)
+  }, [query.lookId])
+
+  const closeLookFu = useCallback(() => {
+    if (query.lookId) {
+      setLookId(0)
+      history.push('/manage')
+      return
+    }
+    setLookId(0)
+  }, [query.lookId])
+
   return (
     <div className={styles.A2manage}>
       {!lookId && !addFlag ? <div className='pageTitle'>库内盘点结果</div> : null}
@@ -134,7 +151,7 @@ function A2manage() {
 
       {/* 按盘点批次-点击查看详情页 */}
       {lookId ? (
-        <A2info sId={lookId} closeFu={() => setLookId(0)} saveSuccessFu={lookSuccessFu} />
+        <A2info sId={lookId} closeFu={closeLookFu} saveSuccessFu={lookSuccessFu} />
       ) : null}
 
       {addFlag ? <A2add closeFu={closeAddFu} saveSuccessFu={addSuccessFu} /> : null}

+ 8 - 2
src/pages/A1check/A3result/data.ts

@@ -33,13 +33,19 @@ export const A3topArr = [
     key: 'status',
     placeholder: '盘点状态',
     type: 'Select',
-    options: resDictStr('盘点状态')
+    options: [
+      { label: '未盘点', value: 0 },
+      { label: '已盘点', value: 1 }
+    ]
   },
   {
     key: 'conform',
     placeholder: '相符情况',
     type: 'Select',
-    options: resDictStr('相符情况')
+    options: [
+      { label: '不相符', value: 0 },
+      { label: '相符', value: 1 }
+    ]
   },
   {
     key: 'unInfo',

+ 6 - 0
src/pages/A1check/A3result/index.module.scss

@@ -7,6 +7,12 @@
   // }
 }
 
+.A3resultLink {
+  // color: #1677ff;
+  cursor: pointer;
+  text-decoration: underline;
+}
+
 .A3resultExportMenu {
   :global {
     .ant-dropdown-menu-item {

+ 52 - 5
src/pages/A1check/A3result/index.tsx

@@ -1,4 +1,4 @@
-import React, { useMemo, useRef } from 'react'
+import React, { useCallback, useMemo, useRef } from 'react'
 import styles from './index.module.scss'
 import TopSearch from '@/pages/ZcomPage/TopSearch'
 import AAbtn from '@/pages/ZcomPage/AAbtn'
@@ -7,10 +7,10 @@ import { A3_APIgetList } from '@/store/action/A1check/A3result'
 import { useSelector } from 'react-redux'
 import { RootState } from '@/store'
 import { Button, Dropdown } from 'antd'
-import { openLink } from '@/utils/history'
+import history, { openLink } from '@/utils/history'
 import dayjs from 'dayjs'
 
-const columnsTemp = [
+const columnsBaseTemp = [
   ['index', '序号', 100],
   ['txt2', '编号类型', 'numName', 150],
   ['txt2', '编号', 'num', 150],
@@ -84,10 +84,56 @@ const exportMenuItems = [
   { key: 'summarySheet', label: '清点结果统计表' }
 ]
 
+const resolveStatusText = (value: any) => {
+  if (value === 1 || `${value}` === '1') return '已盘点'
+  if (value === 0 || `${value}` === '0') return '未盘点'
+  return value
+}
+
+const resolveConformText = (value: any) => {
+  if (value === 1 || `${value}` === '1') return '相符'
+  if (value === 0 || `${value}` === '0') return '不相符'
+  return value
+}
+
 function A3result() {
   const topDomRef = useRef<any>(null)
 
   const tableInfo = useSelector((state: RootState) => state.A3result.tableInfo)
+  const openCheckDetailFu = useCallback((id: any) => {
+    const tempId = Number(id || 0)
+    if (!tempId) return
+    history.push(`/manage?lookId=${tempId}`)
+  }, [])
+  const tableInfoTemp = useMemo(
+    () => ({
+      ...tableInfo,
+      list: (tableInfo.list || []).map((item: any, index: number) => ({
+        ...item,
+        id: `a3-row-${index}`,
+        firmVersionId:
+          item.firmVersionId || item.checkFirmVersionId || item.versionId || item.waiId || 0,
+        status: resolveStatusText(item.status),
+        conform: resolveConformText(item.conform),
+        checkName:
+          item.checkName && (item.firmVersionId || item.checkFirmVersionId || item.versionId || item.waiId)
+            ? (
+                <span
+                  className={styles.A3resultLink}
+                  onClick={() =>
+                    openCheckDetailFu(
+                      item.firmVersionId || item.checkFirmVersionId || item.versionId || item.waiId
+                    )
+                  }
+                >
+                  {item.checkName}
+                </span>
+              )
+            : '\u00A0'
+      }))
+    }),
+    [openCheckDetailFu, tableInfo]
+  )
 
   // --------------右侧按钮
   const rightBtn = useMemo(() => {
@@ -102,6 +148,7 @@ function A3result() {
       <>
         <Dropdown
           trigger={['click']}
+          placement='bottomCenter'
           overlayClassName={styles.A3resultExportMenu}
           menu={{
             items: exportMenuItems,
@@ -134,8 +181,8 @@ function A3result() {
         waiWidth={280}
         sonWidth='9.6%'
         getListAPI={A3_APIgetList}
-        tableInfo={tableInfo}
-        columnsTemp={columnsTemp}
+        tableInfo={tableInfoTemp}
+        columnsTemp={columnsBaseTemp}
         tableLastBtn={[
           {
             title: '操作',

+ 2 - 2
src/pages/A1check/A4collect/data.ts

@@ -1,4 +1,4 @@
-import { resDictStr } from '@/utils/select'
+import { resDictStr } from '@/utils/select'
 
 export const A4topArr = [
   {
@@ -64,7 +64,7 @@ export const A4topArr = [
 export const A4columnsTemp = [
   ['index', '序号', 90],
   ['txt', '省、自治区、直辖市', 'province', 160],
-  ['txt', '收藏单位', 'collectionUnit'],
+  ['txt', '收藏单位', 'collectionUnit', 180],
   ['txt', '藏品总登记账登记的馆藏文物总数(件/套)', 'totalCount'],
   ['txt', '账物相符馆藏文件总数(件)', 'conformCount'],
   ['txt', '账物不符差异总数(件)', 'diffCount'],

+ 1 - 1
src/pages/ZcomPage/TopSearch/index.tsx

@@ -176,7 +176,7 @@ function TopSearch(
                   placeholder={item.placeholder}
                   options={item.options}
                   allowClear
-                  value={formData[item.key] || null}
+                  value={formData[item.key] === 0 ? 0 : formData[item.key] || null}
                   onChange={e => fromFu(item.key, e)}
                 />
               ) : item.type === 'Input' ? (

+ 2 - 2
src/store/action/A1check/A3result.ts

@@ -5,10 +5,10 @@ import http from '@/utils/http'
  * 馆内盘点结果 - 获取分页列表
  */
 export const A3_APIgetList = (data: any, exportFlag?: boolean): any => {
-  if (exportFlag) return http.post('cms/checkMatch/pageList', data)
+  if (exportFlag) return http.post('cms/checkMatch/page', data)
   else {
     return async (dispatch: AppDispatch) => {
-      const res = await http.post('cms/checkMatch/pageList', data)
+      const res = await http.post('cms/checkMatch/page', data)
       if (res.code === 0) {
         const obj = {
           list: res.data.records,