wjx 3 tygodni temu
rodzic
commit
95aca47110

+ 36 - 0
src/pages/launchSystemV3/tencenTasset/corpWechat/csgroup/components/group/closeSwitch.tsx

@@ -0,0 +1,36 @@
+import React from 'react';
+import { message, Switch } from 'antd';
+import { useAjax } from '@/Hook/useAjax';
+import { closeSwitchUpdateApi } from '@/services/adqV3/global';
+
+interface CloseSwitchProps {
+    id: number;
+    value?: boolean;
+    onChange?: () => void;
+}
+
+const CloseSwitch: React.FC<CloseSwitchProps> = ({ id, value, onChange }) => {
+
+    /***************************************/
+    const closeSwitchUpdate = useAjax((params) => closeSwitchUpdateApi(params))
+    /***************************************/
+
+    const handleSwitch = (checked: boolean) => {
+        closeSwitchUpdate.run({ id, closeSwitch: !checked }).then(res => {
+            if (res) {
+                onChange?.()
+            }
+        })
+    }
+
+    return (
+        <Switch
+            size='small'
+            checked={!value}
+            onChange={(e) => handleSwitch(e)}
+            loading={closeSwitchUpdate.loading}
+        />
+    );
+};
+
+export default CloseSwitch;

+ 15 - 1
src/pages/launchSystemV3/tencenTasset/corpWechat/csgroup/components/group/index.tsx

@@ -123,6 +123,20 @@ const Group: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
                 }}
                 options={[{ label: '是', value: 0 }, { label: '否', value: 1 }]}
             />
+            <Select
+                showSearch
+                placeholder="关闭状态开关"
+                filterOption={(input, option) =>
+                    ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
+                }
+                style={{ width: 130 }}
+                allowClear
+                value={queryParamsNew?.closeSwitch}
+                onChange={(e) => {
+                    setQueryParamsNew({ ...queryParamsNew, closeSwitch: e, pageNum: 1 })
+                }}
+                options={[{ label: '开启', value: false }, { label: '关闭', value: true }]}
+            />
             <Button type="primary" icon={<SearchOutlined />} loading={getCustomerServiceGroupList.loading} onClick={() => getCustomerServiceGroupList.refresh()}>刷新</Button>
             <Button
                 type="primary"
@@ -133,7 +147,7 @@ const Group: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
             >新增</Button>
         </div>
         <Table
-            columns={columns(handleEdit)}
+            columns={columns(handleEdit, () => getCustomerServiceGroupList.refresh())}
             dataSource={getCustomerServiceGroupList.data?.records}
             size="small"
             loading={getCustomerServiceGroupList?.loading}

+ 13 - 1
src/pages/launchSystemV3/tencenTasset/corpWechat/csgroup/components/group/tableConfig.tsx

@@ -2,8 +2,9 @@ import { Button, Space, TableProps } from "antd"
 import React from "react"
 import { EditOutlined } from "@ant-design/icons"
 import GroupUserInfo from "./groupUserInfo"
+import CloseSwitch from "./closeSwitch"
 
-const columns = (handleEdit: (data: any) => void): TableProps<any>['columns'] => {
+const columns = (handleEdit: (data: any) => void, refresh: () => void): TableProps<any>['columns'] => {
 
     return [
         {
@@ -125,6 +126,17 @@ const columns = (handleEdit: (data: any) => void): TableProps<any>['columns'] =>
                 return <span style={{ fontSize: 12 }}>{value}</span>
             }
         },
+        {
+            title: '关闭状态开关',
+            dataIndex: 'closeSwitch',
+            key: 'closeSwitch',
+            width: 70,
+            align: 'center',
+            fixed: 'right',
+            render(value, record) {
+                return <CloseSwitch id={record.id} value={value} onChange={refresh} />
+            }
+        },
         {
             title: '操作',
             dataIndex: 'cz',

+ 14 - 0
src/services/adqV3/global.ts

@@ -1047,6 +1047,7 @@ export interface GetCustomerServiceGroupListProps {
     parentId?: number, // 父级ID
     type?: 0 | 1, // 类型 0:客服组集,1:客服组,
     policyId?: number, // 轮换策略ID
+    closeSwitch?: boolean
 }
 /**
  * 查询企业微信组件客服组
@@ -1187,6 +1188,19 @@ export async function addLocalCorpCsgroupApi(data: AddLocalCorpCsgroupProps) {
     })
 }
 
+
+/**
+ * 开关更新接口
+ * @param params 
+ * @returns 
+ */
+export async function closeSwitchUpdateApi(params: { id: number, closeSwitch: boolean }) {
+    return request(api + `/adq/localCorpCsgroup/close/switch/update`, {
+        method: 'PATCH',
+        params
+    })
+}
+
 /**
  * 修改客服组
  * @param data 

+ 1 - 1
src/services/user.ts

@@ -16,7 +16,7 @@ export async function queryCurrent() {
 export async function getMenu(): Promise<any> {
   return request(api + '/erp/menu/getRouters', {
     method: 'PUT',
-    data: ["adq_put_v3", "adq_put", "ad_tt"]// "ad_monitor"
+    data: ["adq_put_v3"]// "ad_monitor", "adq_put", "ad_tt"
   })
 }