Commit 355184c3 authored by 左玲玲's avatar 左玲玲 😬

1725

parent 7fc08338
...@@ -186,15 +186,15 @@ function Input({ item, colProps }) { ...@@ -186,15 +186,15 @@ function Input({ item, colProps }) {
const defaultrule = const defaultrule =
keys.indexOf('phone') != -1 keys.indexOf('phone') != -1
? { ? {
pattern: /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/, pattern: /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/,
message: item.title + '格式不正确', message: item.title + '格式不正确',
} }
: keys.indexOf('mail') != -1 : keys.indexOf('mail') != -1
? { ? {
pattern: /^[a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-z]{2,}$/, pattern: /^[a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-z]{2,}$/,
message: '邮箱格式不正确', message: '邮箱格式不正确',
} }
: {}; : {};
return ( return (
<> <>
...@@ -585,7 +585,7 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -585,7 +585,7 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
formRef?.current?.setFieldsValue({ [curkey]: ifclean }); formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
return res?.data?.dataList ?? []; return item.showAll && res?.data?.dataList?.length > 0 ? [{ label: '全部', key: 'all' }, ...res?.data?.dataList] : [];
}} }}
showSearch showSearch
/> />
...@@ -598,19 +598,19 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -598,19 +598,19 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
function NolinkSelect({ item, colProps }) { function NolinkSelect({ item, colProps }) {
let options = { let options = {
options: [], options: [],
}, },
curoption = item.options ?? null; curoption = item.options ?? null;
if (Array.isArray(curoption)) { if (Array.isArray(curoption)) {
options = { options = {
options: [...curoption], options: item.showAll && curoption?.length > 0 ? [{ label: '全部', key: 'all' }] : [...curoption],
}; };
} else if (curoption) { } else if (curoption) {
options = { options = {
request: async (params) => { request: async (params) => {
let list = await doFetch({ url: curoption?.path, params: curoption?.params }); let list = await doFetch({ url: curoption?.path, params: curoption?.params });
return list.data.dataList; return item.showAll && list?.data?.dataList?.length > 0 ? [{ label: '全部', key: 'all' }, ...list?.data?.dataList] : [];
}, },
}; };
} }
...@@ -720,8 +720,8 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) { ...@@ -720,8 +720,8 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) {
function NolinkTreeSelect({ item, colProps }) { function NolinkTreeSelect({ item, colProps }) {
let options = { let options = {
options: [], options: [],
}, },
curoption = item.options ?? null; curoption = item.options ?? null;
if (Array.isArray(curoption)) { if (Array.isArray(curoption)) {
...@@ -845,8 +845,8 @@ function LinkCheckbox({ item, colProps, formRef, name, curindex }) { ...@@ -845,8 +845,8 @@ function LinkCheckbox({ item, colProps, formRef, name, curindex }) {
function NolinkCheckbox({ item, colProps }) { function NolinkCheckbox({ item, colProps }) {
let options = { let options = {
options: [], options: [],
}, },
curoption = item.options ?? null; curoption = item.options ?? null;
if (Array.isArray(curoption)) { if (Array.isArray(curoption)) {
...@@ -965,8 +965,8 @@ function LinkRadio({ item, colProps, formRef, name, curindex }) { ...@@ -965,8 +965,8 @@ function LinkRadio({ item, colProps, formRef, name, curindex }) {
function NolinkRadio({ item, colProps }) { function NolinkRadio({ item, colProps }) {
let options = { let options = {
options: [], options: [],
}, },
curoption = item.options ?? null; curoption = item.options ?? null;
if (Array.isArray(curoption)) { if (Array.isArray(curoption)) {
...@@ -1079,8 +1079,8 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) { ...@@ -1079,8 +1079,8 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) {
function NolinkCascader({ item, colProps }) { function NolinkCascader({ item, colProps }) {
let options = { let options = {
options: [], options: [],
}, },
curoption = item.options ?? null; curoption = item.options ?? null;
if (Array.isArray(curoption)) { if (Array.isArray(curoption)) {
...@@ -1610,58 +1610,58 @@ function TableSelect({ item, value, onChange, params = {} }) { ...@@ -1610,58 +1610,58 @@ function TableSelect({ item, value, onChange, params = {} }) {
items={ items={
selectedRows.length > 0 selectedRows.length > 0
? selectedRows.map((it) => ({ ? selectedRows.map((it) => ({
key: it[rowKey], key: it[rowKey],
label: ( label: (
<div <div
className="spread" className="spread"
onClick={(e) => {
e.stopPropagation();
let key = it[rowKey];
setchooses((s) => {
let news = [...s];
if (s.includes(key)) {
news = news.filter((it) => {
return it != key;
});
} else {
news.push(key);
}
return news;
});
}}
>
<span
style={{
color: chooses.includes(it[rowKey]) ? '#1890ff' : '#333333',
transition: 'all 0.4s',
userSelect: 'none',
}}
>
{it[item.rowName]}
</span>
<CloseOutlined
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
let key = it[rowKey]; let newvalue = value.filter((its) => its[rowKey] != it[rowKey]);
onChange(newvalue);
setchooses((s) => { setchooses((s) => {
let news = [...s]; let news = [...s];
if (s.includes(key)) { news = news.filter((its) => {
news = news.filter((it) => { return its != it[rowKey];
return it != key; });
});
} else {
news.push(key);
}
return news; return news;
}); });
}} }}
> />
<span </div>
style={{ ),
color: chooses.includes(it[rowKey]) ? '#1890ff' : '#333333', }))
transition: 'all 0.4s',
userSelect: 'none',
}}
>
{it[item.rowName]}
</span>
<CloseOutlined
onClick={(e) => {
e.stopPropagation();
let newvalue = value.filter((its) => its[rowKey] != it[rowKey]);
onChange(newvalue);
setchooses((s) => {
let news = [...s];
news = news.filter((its) => {
return its != it[rowKey];
});
return news;
});
}}
/>
</div>
),
}))
: [ : [
{ {
key: -1, key: -1,
label: '请先选择', label: '请先选择',
}, },
] ]
} }
/> />
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment