|
@@ -32,6 +32,11 @@ function TranslateText(arr) {
|
|
|
return arr?.[0];
|
|
return arr?.[0];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const getPaginationTotalText = (total) => {
|
|
|
|
|
+ const dtLanguage = localStorage.getItem("dtLanguage");
|
|
|
|
|
+ return dtLanguage === "en" ? `${total} items` : `共${total}条`;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const Complex = (props, ref) => {
|
|
const Complex = (props, ref) => {
|
|
|
const { message } = App.useApp();
|
|
const { message } = App.useApp();
|
|
|
const { editId, groupList = [], showList, formula } = props;
|
|
const { editId, groupList = [], showList, formula } = props;
|
|
@@ -50,7 +55,7 @@ const Complex = (props, ref) => {
|
|
|
const [paginationProps, setPaginationProps] = useState({
|
|
const [paginationProps, setPaginationProps] = useState({
|
|
|
pageSize: 15,
|
|
pageSize: 15,
|
|
|
current: 1,
|
|
current: 1,
|
|
|
- showTotal: (total) => `共${total}条`,
|
|
|
|
|
|
|
+ showTotal: (total) => getPaginationTotalText(total),
|
|
|
// showQuickJumper: true,
|
|
// showQuickJumper: true,
|
|
|
// showSizeChanger:true,
|
|
// showSizeChanger:true,
|
|
|
// size:'Large',
|
|
// size:'Large',
|
|
@@ -60,7 +65,10 @@ const Complex = (props, ref) => {
|
|
|
const [ruleOptions, setRuleOptions] = useState([]);
|
|
const [ruleOptions, setRuleOptions] = useState([]);
|
|
|
|
|
|
|
|
const handleTableChange = async (pagination) => {
|
|
const handleTableChange = async (pagination) => {
|
|
|
- setPaginationProps({ ...pagination, showTotal: (total) => `共${total}条` });
|
|
|
|
|
|
|
+ setPaginationProps({
|
|
|
|
|
+ ...pagination,
|
|
|
|
|
+ showTotal: (total) => getPaginationTotalText(total),
|
|
|
|
|
+ });
|
|
|
// setCurrentPage(pagination.current);
|
|
// setCurrentPage(pagination.current);
|
|
|
// setPageSize(pagination.pageSize)
|
|
// setPageSize(pagination.pageSize)
|
|
|
};
|
|
};
|
|
@@ -117,7 +125,7 @@ const Complex = (props, ref) => {
|
|
|
if (state === 0) {
|
|
if (state === 0) {
|
|
|
props?.onConfirm?.(data?.id);
|
|
props?.onConfirm?.(data?.id);
|
|
|
form.resetFields();
|
|
form.resetFields();
|
|
|
- message.success("保存成功");
|
|
|
|
|
|
|
+ message.success(TranslateText(["保存成功", "Seted"]));
|
|
|
} else {
|
|
} else {
|
|
|
message.error(state_info);
|
|
message.error(state_info);
|
|
|
}
|
|
}
|
|
@@ -140,7 +148,7 @@ const Complex = (props, ref) => {
|
|
|
if (state === 0) {
|
|
if (state === 0) {
|
|
|
props?.onConfirm?.(data.id);
|
|
props?.onConfirm?.(data.id);
|
|
|
form.resetFields();
|
|
form.resetFields();
|
|
|
- message.success("保存成功");
|
|
|
|
|
|
|
+ message.success(TranslateText(["保存成功", "Seted"]));
|
|
|
} else {
|
|
} else {
|
|
|
message.error(state_info);
|
|
message.error(state_info);
|
|
|
}
|
|
}
|
|
@@ -278,9 +286,7 @@ const Complex = (props, ref) => {
|
|
|
>
|
|
>
|
|
|
{showList && (
|
|
{showList && (
|
|
|
<>
|
|
<>
|
|
|
- <Form.Item
|
|
|
|
|
- label={TranslateText(["告警类型", "Alarm type"])}
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <Form.Item label={TranslateText(["告警类型", "Alarm type"])}>
|
|
|
<Radio.Group
|
|
<Radio.Group
|
|
|
value={type}
|
|
value={type}
|
|
|
onChange={(e) => setType(e.target.value)}
|
|
onChange={(e) => setType(e.target.value)}
|
|
@@ -302,10 +308,7 @@ const Complex = (props, ref) => {
|
|
|
rules={[
|
|
rules={[
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
- message: TranslateText([
|
|
|
|
|
- "请选择规则",
|
|
|
|
|
- "Please choose",
|
|
|
|
|
- ]),
|
|
|
|
|
|
|
+ message: TranslateText(["请选择规则", "Please choose rule"]),
|
|
|
validator: () => {
|
|
validator: () => {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
if (alarmId) {
|
|
if (alarmId) {
|
|
@@ -324,7 +327,7 @@ const Complex = (props, ref) => {
|
|
|
onChange={setAlarmId}
|
|
onChange={setAlarmId}
|
|
|
style={{ width: 320 }}
|
|
style={{ width: 320 }}
|
|
|
options={ruleOptions}
|
|
options={ruleOptions}
|
|
|
- placeholder={TranslateText(["请选择", "Please choose"])}
|
|
|
|
|
|
|
+ placeholder={TranslateText(["请选择规则", "Please choose rule"])}
|
|
|
/>
|
|
/>
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
)}
|
|
)}
|
|
@@ -455,7 +458,10 @@ const Complex = (props, ref) => {
|
|
|
rules={[
|
|
rules={[
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
- message: "请输入条件",
|
|
|
|
|
|
|
+ message: TranslateText([
|
|
|
|
|
+ "请输入条件",
|
|
|
|
|
+ "Please input condition",
|
|
|
|
|
+ ]),
|
|
|
validator: () => {
|
|
validator: () => {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
if (formuRef.current.getFinalStr()) {
|
|
if (formuRef.current.getFinalStr()) {
|
|
@@ -535,7 +541,7 @@ const Complex = (props, ref) => {
|
|
|
["", undefined, null].indexOf(dateTime) !== -1 &&
|
|
["", undefined, null].indexOf(dateTime) !== -1 &&
|
|
|
status === 1 && (
|
|
status === 1 && (
|
|
|
<div style={{ color: "var(--dt-error-color1)" }}>
|
|
<div style={{ color: "var(--dt-error-color1)" }}>
|
|
|
- 请输入数字
|
|
|
|
|
|
|
+ {TranslateText(["请输入数字", "Please input number"])}
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|