wjx 7 ماه پیش
والد
کامیت
ace5f49306

+ 17 - 3
src/pages/iaaSystem/manage/application/index.tsx

@@ -9,6 +9,16 @@ import { getAppAllApi, getAppListApi } from "@/services/iaaSystem/application";
 import { DefaultOptionType } from "antd/lib/select";
 import ModalApp from "./modalApp";
 
+const apptypeEnum = {
+    APP_TYPE_TENCENT_GAME: "微信小游戏",
+    APP_TYPE_OCENAENGINE_GAME: "抖音小游戏",
+    APP_TYPE_TENCENT_MP: "微信小程序",
+    APP_TYPE_OCENAENGINE_MP: "抖音小程序",
+    APP_TYPE_ANDROID_APP: "Android 应用 APP",
+    APP_TYPE_IOS_APP: "ios 应用 APP",
+    APP_TYPE_WEB_H5: '网页 H5应用'
+}
+
 /**
  * 应用管理
  * @returns 
@@ -48,8 +58,8 @@ const Application: React.FC = () => {
             if (res?.data) {
                 let newAppList: DefaultOptionType[] = []
                 let newAppObj: any = {}
-                res.data.forEach((item: { name: any; id: any; mediaPlatform: string }) => {
-                    newAppList.push({ label: item.name + `(${item.mediaPlatform === 'MEDIA_PLATFORM_OCENAENGINE' ? '头条' : '腾讯'})`, value: item.id })
+                res.data.forEach((item: { name: any; id: any; mediaPlatform: string; appType: string }) => {
+                    newAppList.push({ label: item.name + `(${item.mediaPlatform === 'MEDIA_PLATFORM_OCENAENGINE' ? '头条' : '腾讯'})`, value: item.id, appType: item.appType })
                     newAppObj[item.id] = {
                         text: item.name + `(${item.mediaPlatform === 'MEDIA_PLATFORM_OCENAENGINE' ? '头条' : '腾讯'})`
                     }
@@ -72,7 +82,10 @@ const Application: React.FC = () => {
 
     return <>
         <ProTable<any>
-            columns={tableConfig(handleEdit, userObj, appObj)}
+            columns={tableConfig(handleEdit, userObj, appObj, Object.keys(apptypeEnum).reduce((curs: any, key) => {
+                curs[key] = { text: apptypeEnum[key as keyof typeof apptypeEnum] }
+                return curs
+            }, {}))}
             actionRef={actionRef}
             cardBordered
             request={async (params, sort, filter) => {
@@ -108,6 +121,7 @@ const Application: React.FC = () => {
                 setInitialValues(undefined)
                 actionRef.current?.reload()
             }}
+            apptypeEnum={apptypeEnum}
             onClose={() => {
                 setVisible(false)
                 setInitialValues(undefined)

+ 23 - 5
src/pages/iaaSystem/manage/application/modalApp.tsx

@@ -9,6 +9,7 @@ import React from "react"
 interface Props {
     appAllList: DefaultOptionType[]
     userList: DefaultOptionType[]
+    apptypeEnum: { [x: string]: string }
     onChange?: () => void
     visible?: boolean
     onClose?: () => void
@@ -19,12 +20,11 @@ interface Props {
  * 新增修改应用权限
  * @returns 
  */
-const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, onClose, initialValues }) => {
+const ModalApp: React.FC<Props> = ({ appAllList, userList, apptypeEnum, onChange, visible, onClose, initialValues }) => {
 
     /*******************************/
     const [form] = Form.useForm();
-
-    console.log(appAllList)
+    const authMemberAppList = Form.useWatch('authMemberAppList', form)
 
     const addApp = useAjax((params) => addAppApi(params))
     const updateApp = useAjax((params) => updateAppApi(params))
@@ -58,6 +58,7 @@ const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, on
         onCancel={onClose}
         onOk={handleOk}
         confirmLoading={addApp.loading || updateApp.loading}
+        width={600}
     >
         <Form
             name="basicApp"
@@ -108,6 +109,23 @@ const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, on
                         return <>
                             {fields.map(({ key, name, ...restField }) => (
                                 <Space key={key} style={{ display: 'flex', marginBottom: 8, width: '100%' }} align="center">
+                                    <Form.Item
+                                        {...restField}
+                                        label={<strong>应用类型</strong>}
+                                        name={[name, 'appType']}
+                                        rules={[{ required: true, message: '请选选择应用' }]}
+                                    >
+                                        <Select
+                                            style={{ width: 130 }}
+                                            showSearch
+                                            allowClear
+                                            placeholder="选择应用类型"
+                                            filterOption={(input, option) =>
+                                                (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                                            }
+                                            options={Object.keys(apptypeEnum).map(key => ({ label: apptypeEnum[key], value: key }))}
+                                        />
+                                    </Form.Item>
                                     <Form.Item
                                         {...restField}
                                         label={<strong>应用</strong>}
@@ -115,14 +133,14 @@ const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, on
                                         rules={[{ required: true, message: '请选选择应用' }]}
                                     >
                                         <Select
-                                            style={{ width: 300 }}
+                                            style={{ width: 280 }}
                                             showSearch
                                             allowClear
                                             placeholder="选择应用"
                                             filterOption={(input, option) =>
                                                 (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                             }
-                                            options={appAllList}
+                                            options={appAllList?.filter(item => authMemberAppList?.[key]?.appType ? item.appType === authMemberAppList[key]?.appType : true)}
                                         />
                                     </Form.Item>
                                     <Form.Item

+ 16 - 2
src/pages/iaaSystem/manage/application/tableConfig.tsx

@@ -3,7 +3,7 @@ import React from "react";
 import DelApp from "./delApp";
 
 
-const tableConfig = (handleEdit: (data: any) => void, userObj: any, appObj: any) => {
+const tableConfig = (handleEdit: (data: any) => void, userObj: any, appObj: any, apptypeEnum: any) => {
 
     const columns: ProColumns<any>[] = [
         {
@@ -26,12 +26,25 @@ const tableConfig = (handleEdit: (data: any) => void, userObj: any, appObj: any)
             key: 'iaaAppId',
             dataIndex: 'iaaAppId',
             align: 'center',
-            width: 110,
+            width: 200,
+            ellipsis: true,
             valueEnum: appObj,
             fieldProps: {
                 showSearch: true
             }
         },
+        {
+            title: '应用类型',
+            key: 'appType',
+            dataIndex: 'appType',
+            align: 'center',
+            width: 150,
+            valueEnum: apptypeEnum,
+            search: false
+            // fieldProps: {
+            //     showSearch: false
+            // }
+        },
         {
             title: '是否包含自然量',
             dataIndex: 'defaultAgent',
@@ -74,6 +87,7 @@ const tableConfig = (handleEdit: (data: any) => void, userObj: any, appObj: any)
             title: '操作',
             key: 'option',
             valueType: 'option',
+            // @ts-ignore
             render: (_: any, row: { id: number; }, index: any, action: { reload: () => void; }) => [
                 <a key={'xg'} onClick={() => { handleEdit(row); }} >编辑</a>,
                 <div key={'delete'}><DelApp

+ 2 - 1
src/pages/iaaSystem/manage/channel/modalChannel.tsx

@@ -129,6 +129,7 @@ const ModalChannel: React.FC<Props> = ({ onChange, visible, onClose, initialValu
                     onSearch={(val) => {
                         setAccSearch(val)
                     }}
+                    loading={getAllOfOwnerUser.loading}
                     dropdownRender={menu => (
                         <>
                             {menu}
@@ -148,7 +149,7 @@ const ModalChannel: React.FC<Props> = ({ onChange, visible, onClose, initialValu
                             </Space>
                         </>
                     )}
-                    options={getAllOfOwnerUser?.data?.data?.map((item: { memo: string; accountId: any; }) => ({
+                    options={getAllOfOwnerUser?.data?.data?.filter((item: { adUnitType: any; }) => item.adUnitType.includes('IAA'))?.map((item: { memo: string; accountId: any; }) => ({
                         value: item.accountId,
                         label: item.accountId + (item.memo ? '_' + item.memo : '')
                     }))}