Przeglądaj źródła

资源表 未开启状态 也要查看

shaogen1995 2 miesięcy temu
rodzic
commit
c71b943998

+ 40 - 11
src/pages/Zother/Z0edit/index.tsx

@@ -270,6 +270,15 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
   const [loding, setLoding] = useState(false)
 
   const [kuTxt, setkuTxt] = useState('')
+
+  const closeFlag = useMemo(() => {
+    return kuTxt.includes('关闭状态')
+  }, [kuTxt])
+
+  useEffect(() => {
+    if (closeFlag) MessageFu.warning('该表为 关闭状态 无法编辑数据')
+  }, [closeFlag])
+
   const [kuList, setKuList] = useState<antdSelectType[]>([])
 
   useEffect(() => {
@@ -417,12 +426,16 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
             {isLook ? null : (
               <div>
                 {selectInfo ? (
-                  <Button type='primary' onClick={() => setOpenSelect(Number(fId))}>
+                  <Button
+                    disabled={closeFlag}
+                    type='primary'
+                    onClick={() => setOpenSelect(Number(fId))}
+                  >
                     {selectInfo.txt}
                   </Button>
                 ) : null}
                 {pageKey.txt === '入库' ? (
-                  <Button type='primary' onClick={() => setEditId(-1)}>
+                  <Button disabled={closeFlag} type='primary' onClick={() => setEditId(-1)}>
                     新增
                   </Button>
                 ) : null}
@@ -438,7 +451,7 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
             formZi={formZi}
             tableList={snaps}
             tableBtnFu={pageKey.txt === '入库' ? (val, id) => tableBtnFu(val, id) : undefined}
-            isLook={isLook}
+            isLook={isLook || closeFlag}
           />
 
           {/* -------------底部按钮 */}
@@ -446,22 +459,26 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
             <div>
               {['1', '2'].includes(key) ? (
                 <>
-                  <Button type='primary' onClick={() => sonClick('草稿')}>
+                  <Button disabled={closeFlag} type='primary' onClick={() => sonClick('草稿')}>
                     存草稿
                   </Button>
-                  <Button type='primary' onClick={() => sonClick('发起')}>
+                  <Button disabled={closeFlag} type='primary' onClick={() => sonClick('发起')}>
                     提交
                   </Button>
                   <MyPopconfirm txtK='取消' onConfirm={() => backPageFu(pageKey.key)} />
                 </>
               ) : key === '3' ? (
-                <Button type='primary' onClick={() => sonClick('审批')}>
+                <Button disabled={closeFlag} type='primary' onClick={() => sonClick('审批')}>
                   审批
                 </Button>
               ) : key === '4' ? (
                 <>
                   {editBtnShowFu(info.status, info.creatorId).includes('重新发起') ? (
-                    <Button type='primary' onClick={() => sonClick('重新发起')}>
+                    <Button
+                      disabled={closeFlag}
+                      type='primary'
+                      onClick={() => sonClick('重新发起')}
+                    >
                       重新发起
                     </Button>
                   ) : null}
@@ -469,16 +486,24 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
                     <MyPopconfirm
                       txtK='撤回'
                       onConfirm={() => sonClick('撤回')}
-                      Dom={<Button danger>撤回</Button>}
+                      Dom={
+                        <Button disabled={closeFlag} danger>
+                          撤回
+                        </Button>
+                      }
                     />
                   ) : null}
                   {editBtnShowFu(info.status, info.creatorId).includes('编辑') ? (
-                    <Button type='primary' onClick={() => sonClick('2', '编辑')}>
+                    <Button
+                      disabled={closeFlag}
+                      type='primary'
+                      onClick={() => sonClick('2', '编辑')}
+                    >
                       编辑
                     </Button>
                   ) : null}
                   {editBtnShowFu(info.status, info.creatorId).includes('发起') ? (
-                    <Button type='primary' onClick={() => sonClick('发起')}>
+                    <Button disabled={closeFlag} type='primary' onClick={() => sonClick('发起')}>
                       发起
                     </Button>
                   ) : null}
@@ -486,7 +511,11 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
                     <MyPopconfirm
                       txtK='删除2'
                       onConfirm={() => sonClick('删除')}
-                      Dom={<Button danger>删除</Button>}
+                      Dom={
+                        <Button disabled={closeFlag} danger>
+                          删除
+                        </Button>
+                      }
                     />
                   ) : null}
                 </>

+ 17 - 2
src/pages/Zother/Z0table/index.tsx

@@ -130,6 +130,15 @@ function Z0table({ topSearchArr, getListAPI, pageKey, yHeight = 660, tableInfo }
     [formData]
   )
 
+  // 表是否处于关闭状态
+  const biaoFlag = useMemo(() => {
+    let flag = false
+    const id = formData.formDefId
+    const findObj = kuList.find(v => v.value === id)
+    if (findObj?.label.includes('关闭状态')) flag = true
+    return flag
+  }, [formData.formDefId, kuList])
+
   // 点击各种操作按钮
   const tableBtnFu = useCallback(
     (id: number, key: string) => {
@@ -148,7 +157,12 @@ function Z0table({ topSearchArr, getListAPI, pageKey, yHeight = 660, tableInfo }
               查看
             </Button>
             {tableListAuditBtnFu(item) ? (
-              <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '3')}>
+              <Button
+                disabled={biaoFlag}
+                size='small'
+                type='text'
+                onClick={() => tableBtnFu(item.id, '3')}
+              >
                 审批
               </Button>
             ) : null}
@@ -156,7 +170,7 @@ function Z0table({ topSearchArr, getListAPI, pageKey, yHeight = 660, tableInfo }
         )
       }
     ]
-  }, [tableBtnFu])
+  }, [biaoFlag, tableBtnFu])
 
   return (
     <div className={styles.Z0table}>
@@ -221,6 +235,7 @@ function Z0table({ topSearchArr, getListAPI, pageKey, yHeight = 660, tableInfo }
               />
               &emsp;
               <Button
+                disabled={biaoFlag}
                 type='primary'
                 onClick={() => history.push(`/${pageKey.key}_edit/1/null/${formData.formDefId}`)}
               >

+ 1 - 1
src/pages/Zother/ZgoodsInfo/index.tsx

@@ -210,7 +210,7 @@ function ZgoodsInfo() {
             </div>
 
             <div>
-              {info.status_storage === 3
+              {info.status_storage === 3 && !kuTxt.includes('关闭状态')
                 ? tabArr2.map(item => (
                     <Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
                       <Button type='primary'>

+ 18 - 7
src/pages/Zother/data.tsx

@@ -34,11 +34,18 @@ export type Typetable = {
 export type GoodsType = any
 
 // 异步获取资源库列表--已开启状态
-export const getKuListByOpenFu = async (back: (data: any[]) => void) => {
+export const getKuListByOpenFu = async (back: (data: any[]) => void, flag?: boolean) => {
   const res = await Z1_APIgetAll({ pageNum: 1, pageSize: 99999 }, true)
   if (res.code === 0) {
     let list: any[] = res.data.records || []
-    list = list.filter(v => v.isEnabled === 1).map(v => ({ value: v.id, label: v.formName }))
+
+    if (flag) list = list.filter(v => v.isEnabled === 1)
+
+    list = list.map(v => ({
+      value: v.id,
+      label: v.formName + (v.isEnabled !== 1 ? '(关闭状态)' : ''),
+      isEnabled: v.isEnabled
+    }))
     back(list)
   }
 }
@@ -114,13 +121,17 @@ export const ziYuanShowFu = (ziYuanObj: any, kuList: any[]) => {
       arr.forEach((c: any) => {
         txtArr.push(c.name + ' / ' + c.create_by)
       })
-      const keyTxt = kuList.find(c => c.value === Number(k))!.label
 
-      const arrTemp = {
-        key: keyTxt,
-        sonTxt: txtArr.join(';')
+      const findObj = kuList.find(c => c.value === Number(k))
+      if (findObj) {
+        const keyTxt = kuList.find(c => c.value === Number(k))!.label
+
+        const arrTemp = {
+          key: keyTxt,
+          sonTxt: txtArr.join(';')
+        }
+        resArr.push(arrTemp)
       }
-      resArr.push(arrTemp)
     }
   }
   return resArr

+ 1 - 1
src/store/action/Zsystem/Z1sysSet.ts

@@ -27,7 +27,7 @@ export const Z1_APIgetAll = (data: any, flag?: boolean): any => {
       const res = await http.post(url, data)
       if (res.code === 0) {
         let list: any[] = res.data.records || []
-        list = list.filter(v => v.isEnabled === 1).map(v => ({ value: v.id, label: v.formName }))
+        list = list.map(v => ({ value: v.id, label: v.formName, isEnabled: v.isEnabled }))
         dispatch({ type: 'Z1/kList', payload: list })
       }
     }