|
@@ -1,7 +1,7 @@
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
import { useEffect, useRef, useState } from "react";
|
|
|
import { useIntl } from "react-intl";
|
|
import { useIntl } from "react-intl";
|
|
|
import { ActionType, ProList } from "@ant-design/pro-components";
|
|
import { ActionType, ProList } from "@ant-design/pro-components";
|
|
|
-import { Button } from "antd";
|
|
|
|
|
|
|
+import { Alert, Button } from "antd";
|
|
|
import { Badge, Dropdown, Space, Table, Typography } from "antd";
|
|
import { Badge, Dropdown, Space, Table, Typography } from "antd";
|
|
|
import {
|
|
import {
|
|
|
GlobalOutlined,
|
|
GlobalOutlined,
|
|
@@ -23,7 +23,7 @@ import CopyToModal from "./CopyToModal";
|
|
|
import { useAppSelector } from "../../hooks";
|
|
import { useAppSelector } from "../../hooks";
|
|
|
import { currentUser as _currentUser } from "../../reducers/current-user";
|
|
import { currentUser as _currentUser } from "../../reducers/current-user";
|
|
|
|
|
|
|
|
-const { Link } = Typography;
|
|
|
|
|
|
|
+const { Link, Text } = Typography;
|
|
|
|
|
|
|
|
interface IParams {
|
|
interface IParams {
|
|
|
owner?: string;
|
|
owner?: string;
|
|
@@ -54,6 +54,7 @@ interface IWidget {
|
|
|
selectedKeys?: string[];
|
|
selectedKeys?: string[];
|
|
|
reload?: boolean;
|
|
reload?: boolean;
|
|
|
disableChannelId?: string;
|
|
disableChannelId?: string;
|
|
|
|
|
+ defaultOwner?: string;
|
|
|
onSelect?: Function;
|
|
onSelect?: Function;
|
|
|
}
|
|
}
|
|
|
const ChannelPickerTableWidget = ({
|
|
const ChannelPickerTableWidget = ({
|
|
@@ -63,6 +64,7 @@ const ChannelPickerTableWidget = ({
|
|
|
selectedKeys = [],
|
|
selectedKeys = [],
|
|
|
onSelect,
|
|
onSelect,
|
|
|
disableChannelId,
|
|
disableChannelId,
|
|
|
|
|
+ defaultOwner = "all",
|
|
|
reload = false,
|
|
reload = false,
|
|
|
}: IWidget) => {
|
|
}: IWidget) => {
|
|
|
const intl = useIntl();
|
|
const intl = useIntl();
|
|
@@ -71,6 +73,8 @@ const ChannelPickerTableWidget = ({
|
|
|
const [showCheckBox, setShowCheckBox] = useState<boolean>(false);
|
|
const [showCheckBox, setShowCheckBox] = useState<boolean>(false);
|
|
|
const [copyChannel, setCopyChannel] = useState<IChannel>();
|
|
const [copyChannel, setCopyChannel] = useState<IChannel>();
|
|
|
const [copyOpen, setCopyOpen] = useState<boolean>(false);
|
|
const [copyOpen, setCopyOpen] = useState<boolean>(false);
|
|
|
|
|
+ const [ownerChanged, setOwnerChanged] = useState<boolean>(false);
|
|
|
|
|
+
|
|
|
const user = useAppSelector(_currentUser);
|
|
const user = useAppSelector(_currentUser);
|
|
|
const ref = useRef<ActionType>();
|
|
const ref = useRef<ActionType>();
|
|
|
|
|
|
|
@@ -81,7 +85,24 @@ const ChannelPickerTableWidget = ({
|
|
|
}, [reload]);
|
|
}, [reload]);
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <>
|
|
|
|
|
|
|
+ <Space direction="vertical" style={{ width: "100%" }}>
|
|
|
|
|
+ {defaultOwner !== "all" && ownerChanged === false ? (
|
|
|
|
|
+ <Alert
|
|
|
|
|
+ message={
|
|
|
|
|
+ <>
|
|
|
|
|
+ {"目前仅显示了版本"}
|
|
|
|
|
+ <Text keyboard>
|
|
|
|
|
+ {intl.formatMessage({ id: `buttons.channel.${defaultOwner}` })}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ {"可以点"}
|
|
|
|
|
+ <Text keyboard>{"版本筛选"}</Text>
|
|
|
|
|
+ {"显示其他版本"}
|
|
|
|
|
+ </>
|
|
|
|
|
+ }
|
|
|
|
|
+ type="success"
|
|
|
|
|
+ closable
|
|
|
|
|
+ />
|
|
|
|
|
+ ) : undefined}
|
|
|
<ProList<IItem, IParams>
|
|
<ProList<IItem, IParams>
|
|
|
actionRef={ref}
|
|
actionRef={ref}
|
|
|
rowSelection={
|
|
rowSelection={
|
|
@@ -162,11 +183,16 @@ const ChannelPickerTableWidget = ({
|
|
|
const id = element.id.split("_")[1];
|
|
const id = element.id.split("_")[1];
|
|
|
sentList.push(id);
|
|
sentList.push(id);
|
|
|
}
|
|
}
|
|
|
|
|
+ const currOwner = params.owner ? params.owner : defaultOwner;
|
|
|
|
|
+ if (params.owner) {
|
|
|
|
|
+ setOwnerChanged(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log("owner", currOwner);
|
|
|
const res = await post<IProgressRequest, IApiResponseChannelList>(
|
|
const res = await post<IProgressRequest, IApiResponseChannelList>(
|
|
|
`/v2/channel-progress`,
|
|
`/v2/channel-progress`,
|
|
|
{
|
|
{
|
|
|
sentence: sentList,
|
|
sentence: sentList,
|
|
|
- owner: params.owner,
|
|
|
|
|
|
|
+ owner: currOwner,
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
console.log("progress data", res.data.rows);
|
|
console.log("progress data", res.data.rows);
|
|
@@ -361,15 +387,17 @@ const ChannelPickerTableWidget = ({
|
|
|
title: "版本筛选",
|
|
title: "版本筛选",
|
|
|
valueType: "select",
|
|
valueType: "select",
|
|
|
valueEnum: {
|
|
valueEnum: {
|
|
|
- all: { text: "全部", status: "Default" },
|
|
|
|
|
|
|
+ all: { text: intl.formatMessage({ id: "buttons.channel.all" }) },
|
|
|
my: {
|
|
my: {
|
|
|
- text: "我的",
|
|
|
|
|
|
|
+ text: intl.formatMessage({ id: "buttons.channel.my" }),
|
|
|
},
|
|
},
|
|
|
- cooperator: {
|
|
|
|
|
- text: "协作",
|
|
|
|
|
|
|
+ collaborator: {
|
|
|
|
|
+ text: intl.formatMessage({
|
|
|
|
|
+ id: "buttons.channel.collaborator",
|
|
|
|
|
+ }),
|
|
|
},
|
|
},
|
|
|
public: {
|
|
public: {
|
|
|
- text: "社区公开",
|
|
|
|
|
|
|
+ text: intl.formatMessage({ id: "buttons.channel.public" }),
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -380,7 +408,7 @@ const ChannelPickerTableWidget = ({
|
|
|
open={copyOpen}
|
|
open={copyOpen}
|
|
|
onClose={() => setCopyOpen(false)}
|
|
onClose={() => setCopyOpen(false)}
|
|
|
/>
|
|
/>
|
|
|
- </>
|
|
|
|
|
|
|
+ </Space>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|