提交 a4db0386 作者: ZhangLingKun

功能:用户标签

上级 7a7bd083
...@@ -29,6 +29,14 @@ export type listAppUserType = InterListFunction< ...@@ -29,6 +29,14 @@ export type listAppUserType = InterListFunction<
cooperationTagId: number; cooperationTagId: number;
companyName: null; companyName: null;
tagName: null; tagName: null;
cooperationTagVOS: {
createTime: string;
id: number;
tagDescription: string;
tagImg: string;
tagName: string;
tagRequire: string;
}[];
} }
>; >;
// 加盟标签列表 // 加盟标签列表
...@@ -75,6 +83,14 @@ export type changeUserTagType = InterFunction< ...@@ -75,6 +83,14 @@ export type changeUserTagType = InterFunction<
}, },
NonNullable<unknown> NonNullable<unknown>
>; >;
// 后台设置小程序用户标签
export type changeUserTagNew = InterFunction<
{
cooperationTagIds: number[];
userAccountId: number;
},
NonNullable<unknown>
>;
// 加盟标签列表 // 加盟标签列表
export type cooperationListTag = InterFunction< export type cooperationListTag = InterFunction<
NonNullable<unknown>, NonNullable<unknown>,
......
...@@ -2,6 +2,7 @@ import axios from '../request'; ...@@ -2,6 +2,7 @@ import axios from '../request';
import { import {
applyTagDetails, applyTagDetails,
approvalApplyTag, approvalApplyTag,
changeUserTagNew,
changeUserTagType, changeUserTagType,
CompanyListTag, CompanyListTag,
cooperationListTag, cooperationListTag,
...@@ -24,7 +25,9 @@ export class CustomManageAPI { ...@@ -24,7 +25,9 @@ export class CustomManageAPI {
// 后台设置小程序用户标签 // 后台设置小程序用户标签
static changeUserTag: changeUserTagType = (params) => static changeUserTag: changeUserTagType = (params) =>
axios.get('/userapp/cooperation/changeUserTag', { params }); axios.get('/userapp/cooperation/changeUserTag', { params });
// 后台设置小程序用户标签
static changeUserTagNew: changeUserTagNew = (params) =>
axios.post('/userapp/cooperation/changeUserTag', params);
// 加盟标签列表 // 加盟标签列表
static cooperationListTag: cooperationListTag = (params) => static cooperationListTag: cooperationListTag = (params) =>
axios.get('/userapp/cooperation/listTag', { params }); axios.get('/userapp/cooperation/listTag', { params });
......
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { Form, Modal, Select } from 'antd'; import { Form, Modal, Select } from 'antd';
import { InterListType } from '~/api/interface'; import { InterListType, InterReqType } from '~/api/interface';
import { listAppUserType } from '~/api/interface/customManageType'; import { changeUserTagNew, listAppUserType } from '~/api/interface/customManageType';
import { CustomManageAPI } from '~/api'; import { CustomManageAPI } from '~/api';
// 表单参数
type ReqType = InterReqType<changeUserTagNew>;
// 表格数据类型 // 表格数据类型
type TableType = InterListType<listAppUserType>; type TableType = InterListType<listAppUserType>;
// 数据的类型 // 数据的类型
...@@ -13,11 +15,6 @@ interface PropsType { ...@@ -13,11 +15,6 @@ interface PropsType {
data?: TableType[0]; data?: TableType[0];
} }
// 修改等级标签
interface tagLevelForm {
cooperationTagId: number;
}
export const ChangeModal: FC<PropsType> = (props) => { export const ChangeModal: FC<PropsType> = (props) => {
ChangeModal.defaultProps = { ChangeModal.defaultProps = {
data: undefined, data: undefined,
...@@ -25,7 +22,7 @@ export const ChangeModal: FC<PropsType> = (props) => { ...@@ -25,7 +22,7 @@ export const ChangeModal: FC<PropsType> = (props) => {
// 父组件传参 // 父组件传参
const { open, closed, data } = props; const { open, closed, data } = props;
// 个人等级标签 // 个人等级标签
const [form] = Form.useForm<tagLevelForm>(); const [form] = Form.useForm<ReqType>();
// 相关运营列表 // 相关运营列表
const [operationList] = useState<{ value: number; label: string }[]>([]); const [operationList] = useState<{ value: number; label: string }[]>([]);
// 等级标签列表 // 等级标签列表
...@@ -40,9 +37,9 @@ export const ChangeModal: FC<PropsType> = (props) => { ...@@ -40,9 +37,9 @@ export const ChangeModal: FC<PropsType> = (props) => {
// 提交数据 // 提交数据
const handleSubmit = () => { const handleSubmit = () => {
form.validateFields().then(async (value) => { form.validateFields().then(async (value) => {
const res = await CustomManageAPI.changeUserTag({ const res = await CustomManageAPI.changeUserTagNew({
userAccountId: Number(data?.id), userAccountId: Number(data?.id),
cooperationTagId: value.cooperationTagId, cooperationTagIds: value?.cooperationTagIds || [],
}); });
if (res && res.code === '200') { if (res && res.code === '200') {
handleClosed(); handleClosed();
...@@ -62,18 +59,19 @@ export const ChangeModal: FC<PropsType> = (props) => { ...@@ -62,18 +59,19 @@ export const ChangeModal: FC<PropsType> = (props) => {
if (!data) return; if (!data) return;
getCompanyListTag().then(); getCompanyListTag().then();
form.setFieldsValue({ form.setFieldsValue({
cooperationTagId: data.cooperationTagId, cooperationTagIds: data.cooperationTagVOS?.map((i) => i.id),
}); });
}, [open]); }, [open]);
return ( return (
<Modal open={open} title='变更' onCancel={handleClosed} destroyOnClose onOk={handleSubmit}> <Modal open={open} title='变更' onCancel={handleClosed} destroyOnClose onOk={handleSubmit}>
<Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}> <Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}>
<Form.Item label='等级标签' name='cooperationTagId'> <Form.Item label='等级标签' name='cooperationTagIds'>
<Select <Select
placeholder='请选择等级标签' placeholder='请选择等级标签'
disabled={!data?.userName && !data?.companyName} disabled={!data?.userName && !data?.companyName}
allowClear allowClear
options={cooperationTagIdList} options={cooperationTagIdList}
mode='multiple'
/> />
</Form.Item> </Form.Item>
<Form.Item label='相关运营' name='mallOperator'> <Form.Item label='相关运营' name='mallOperator'>
......
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import SearchBox from '~/components/search-box'; import SearchBox from '~/components/search-box';
import { Button, message, Modal, Table } from 'antd'; import { Button, message, Modal, Table, Tag } from 'antd';
import { ColumnsType } from 'antd/es/table'; import { ColumnsType } from 'antd/es/table';
import { ChangeModal } from '~/pages/customManage/customList/comp/changeModal'; import { ChangeModal } from '~/pages/customManage/customList/comp/changeModal';
import { InterListType, InterReqType } from '~/api/interface'; import { InterListType, InterReqType } from '~/api/interface';
...@@ -25,10 +25,6 @@ const portTypeList = [ ...@@ -25,10 +25,6 @@ const portTypeList = [
function CustomListView() { function CustomListView() {
const { confirm } = Modal; const { confirm } = Modal;
// 等级标签列表
const [cooperationTagIdList, setCooperationTagIdList] = useState<
{ value: number; label: string }[]
>([]);
// 是否打开变更弹窗 // 是否打开变更弹窗
const [isChangeVisModal, setIsChangeVisModal] = useState<boolean>(false); const [isChangeVisModal, setIsChangeVisModal] = useState<boolean>(false);
// 表格分页配置 // 表格分页配置
...@@ -73,14 +69,6 @@ function CustomListView() { ...@@ -73,14 +69,6 @@ function CustomListView() {
query = data; query = data;
getTableList(data).then(); getTableList(data).then();
}; };
// 获取加盟列表
const getCompanyListTag = async () => {
const res = await CustomManageAPI.CompanyListTag({});
if (res && res.code === '200') {
setCooperationTagIdList(res.result.map((i) => ({ value: i.id, label: i.tagName })));
// console.log(res.result);
}
};
// 删除用户 // 删除用户
const handleDelete = (value: TableType[0]) => { const handleDelete = (value: TableType[0]) => {
confirm({ confirm({
...@@ -102,7 +90,6 @@ function CustomListView() { ...@@ -102,7 +90,6 @@ function CustomListView() {
useEffect(() => { useEffect(() => {
query = {}; query = {};
(async () => { (async () => {
await getCompanyListTag();
await getTableList(); await getTableList();
})(); })();
}, []); }, []);
...@@ -161,9 +148,14 @@ function CustomListView() { ...@@ -161,9 +148,14 @@ function CustomListView() {
}, },
{ {
title: '渠道等级', title: '渠道等级',
dataIndex: 'cooperationTagId', dataIndex: 'cooperationTagVOS',
align: 'center', align: 'center',
render: (text) => cooperationTagIdList.find((i) => i.value === text)?.label || text, render: (_text, record) =>
record.cooperationTagVOS?.map((i, j) => (
<Tag color='processing' key={j} style={{ marginBottom: '10px' }}>
{i.tagName}
</Tag>
)),
}, },
{ {
title: '上级推荐人', title: '上级推荐人',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论