Преглед изворни кода

菜单配置项添加静态页面相关配置

code4eat пре 2 година
родитељ
комит
a8be74b7be

+ 1 - 1
config/proxy.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-07 10:00:52
- * @LastEditTime: 2023-04-18 10:39:00
+ * @LastEditTime: 2023-04-27 10:25:47
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/config/proxy.ts

+ 5 - 1
src/pages/platform/setting/menuManage/modals/modal.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-12 17:11:11
- * @LastEditTime: 2022-07-21 16:56:55
+ * @LastEditTime: 2023-05-10 10:52:16
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/userManage/modal.tsx
@@ -294,6 +294,10 @@ const ActModal: React.FC<ActModalProps> = ({
                             label: '空白',
                             value: 4,
                           },
+                          {
+                            label: '静态',
+                            value: 5,
+                          },
                         ]}
                         rules={[
                           {

+ 42 - 16
src/pages/platform/setting/systemNavMana/index.tsx

@@ -4,7 +4,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-16 09:42:52
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-04-18 11:00:35
+ * @LastEditTime: 2023-05-10 15:12:52
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -24,7 +24,7 @@ import closeIcon from '../../../../../public/images/treenode_collapse.png';
 import type { ColumnsType, TableRowSelection } from 'antd/es/table/interface';
 
 import { createFromIconfontCN } from '@ant-design/icons';
-import { addData, delData, editData, getMenuRelaActDic, getTableDataRequest, getTreeData, getTreeDataRespType, updateFuncDic } from './service';
+import { addData, delData, editData, getMenuContentType, getMenuRelaActDic, getTableDataRequest, getTreeData, getTreeDataRespType, updateFuncDic } from './service';
 import { TransferDirection, TransferItem } from 'antd/es/transfer';
 
 import difference from 'lodash/difference';
@@ -37,7 +37,7 @@ import DirectoryTree from 'antd/es/tree/DirectoryTree';
 import { ActionType, ProColumns } from '@ant-design/pro-table';
 import KCTable from '@/components/kcTable';
 import { getDeepestTreeData } from '@/utils';
-import ProForm, { ModalForm, ProFormDependency, ProFormDigit, ProFormItem, ProFormRadio, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
+import ProForm, { ModalForm, ProFormDependency, ProFormDigit, ProFormInstance, ProFormItem, ProFormRadio, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
 import { KCInput } from '@/components/KCInput';
 import { UserRelaSeletDataListType } from '@/service/user';
 
@@ -76,11 +76,13 @@ const MonthlyInfoCheck: React.FC = () => {
     const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
 
     const [currentOperateRow, set_currentOperateRow] = useState<any | undefined>(undefined);  //当前操作的表格行数据
-
+    
+    const [contentType, set_contentType] = useState<any[]>([]); //菜单内容类型列表
 
     const tableRef = useRef<ActionType>();
 
-
+    const formRef = useRef<ProFormInstance>();
+    
     const transferTableColumn = [
         {
             title: '功能名称',
@@ -147,7 +149,8 @@ const MonthlyInfoCheck: React.FC = () => {
                 1: '报告',
                 2: '大屏',
                 3: '填报',
-                4: '空白'
+                4: '空白',
+                5: '静态'
             }
 
         },
@@ -204,6 +207,13 @@ const MonthlyInfoCheck: React.FC = () => {
         set_currentSelectedTreeNode(node);
     };
 
+    const getContentType = async () => {
+        const resp = await getMenuContentType();
+        if (resp) {
+            set_contentType(resp.list);
+        }
+    }
+
 
     const getTableData = async (params: any, sort: any, filter: any) => {
         set_reload(false);
@@ -492,7 +502,6 @@ const MonthlyInfoCheck: React.FC = () => {
 
 
     const UpDataActBtn = ({ record, type }: { record: any, type: 'EDIT' | 'ADD' }) => {
-
         return (
 
             <ModalForm
@@ -503,13 +512,12 @@ const MonthlyInfoCheck: React.FC = () => {
                 trigger={
                     type == 'EDIT' ? <a key="edit" >编辑</a> : record ? <a className='add'>添加</a> : <span>新增</span>
                 }
+                formRef={formRef}
                 grid={true}
 
                 onFinish={(val) => {
                     set_currentOperateRow(record);
-
                     return updateTable(type, val, record)
-
                 }}
             >
                 <ProFormText
@@ -594,13 +602,30 @@ const MonthlyInfoCheck: React.FC = () => {
                                     placeholder="请输入"
                                     width={100}
                                     colProps={{ span: 8 }}
-                                    options={[
-                                        { label: '一般', value: 0 },
-                                        { label: '报告', value: 1 },
-                                        { label: '大屏', value: 2 },
-                                        { label: '填报', value: 3 },
-                                        { label: '空白', value: 4 },
-                                    ]}
+                                    request={async () => {
+                                        if(contentType){
+                                              return contentType.map((a:any)=>({label:a.name,value:Number(a.code)}))
+                                        }
+                                        return []
+                                    }}
+                                    fieldProps={{
+                                        onChange(value, option) {
+                                            if (value == 1) {
+                                                //报告页面
+                                                const need = contentType.filter((item:any)=>item.code == `${value}`);
+                                                if(need.length>0)
+                                                formRef.current?.setFieldValue('url',need[0].value);
+                                            }
+                                        },
+                                    }}
+                                    // options={[
+                                    //     { label: '一般', value: 0 },
+                                    //     { label: '报告', value: 1 },
+                                    //     { label: '大屏', value: 2 },
+                                    //     { label: '填报', value: 3 },
+                                    //     { label: '空白', value: 4 },
+                                    //     { label: '静态', value: 5 },
+                                    // ]}
                                     rules={[{ required: true, message: '类型不能为空!' }]}
                                 />
                                 <ProFormDependency name={['contentType']}>
@@ -683,6 +708,7 @@ const MonthlyInfoCheck: React.FC = () => {
 
     useEffect(() => {
         getTreeReqFunc();
+        getContentType();
     }, []);
 
 

+ 10 - 1
src/pages/platform/setting/systemNavMana/service.ts

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-21 11:13:51
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-03-15 16:40:17
+ * @LastEditTime: 2023-05-10 14:52:54
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlyInfoCheck/service.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -32,6 +32,15 @@ export const getTreeData = (name?:string) => {
 }
 
 
+//获取菜单内容类型列表
+
+export const getMenuContentType = (name?:string) => {
+
+    return request('/centerSys/sysdictdata/getDictDataList?current=1&pageSize=1000&dictType=MENU_CONTENT_TYPE', {
+        method: 'GET',
+    })
+}
+
 
 
 //获取表格数据