Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
cd9ab746
Commit
cd9ab746
authored
Apr 10, 2020
by
满振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改子空间
parent
0880a177
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
index.js
components/DataView/index.js
+21
-10
index.js
components/SearchView/index.js
+3
-0
No files found.
components/DataView/index.js
View file @
cd9ab746
...
@@ -24,6 +24,10 @@ import { getOptionName, replacePageNum } from '@/utils/utils';
...
@@ -24,6 +24,10 @@ import { getOptionName, replacePageNum } from '@/utils/utils';
import
{
SIFT_TYPE
}
from
'@/utils/enum'
;
import
{
SIFT_TYPE
}
from
'@/utils/enum'
;
import
storage
from
'@/utils/storage'
;
/* eslint-disable react/sort-comp */
// 关闭下划线变量检测 // 关闭方法排序检测 // 多维数组降维成一维数组
import
storage
from
'@/utils/storage'
;
/* eslint-disable react/sort-comp */
// 关闭下划线变量检测 // 关闭方法排序检测 // 多维数组降维成一维数组
/**
*
* @param {initView} fun 用于数据初始化之后的数据处理,每个自控可单独处理回调
*/
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-underscore-dangle */
function
reduceDimension
(
arr
)
{
function
reduceDimension
(
arr
)
{
return
Array
.
prototype
.
concat
.
apply
([],
arr
);
return
Array
.
prototype
.
concat
.
apply
([],
arr
);
...
@@ -118,7 +122,7 @@ function formarRange(data) {
...
@@ -118,7 +122,7 @@ function formarRange(data) {
// 日期区间格式化(时间部分为00:00:00-23:59:59)
// 日期区间格式化(时间部分为00:00:00-23:59:59)
function
changeDateRange
(
props
,
changedValues
,
allValues
)
{
function
changeDateRange
(
props
,
changedValues
,
allValues
)
{
const
key
=
Object
.
keys
(
changedValues
)[
0
];
const
key
=
Object
.
keys
(
changedValues
)[
0
];
const
cols
=
reduceDimension
([...
props
.
searchCols
,
...
props
.
advancedSearchCols
]);
const
cols
=
reduceDimension
([...
(
props
.
searchCols
||
[]),
...(
props
.
advancedSearchCols
||
[])
]);
const
col
=
cols
.
find
((
item
)
=>
{
const
col
=
cols
.
find
((
item
)
=>
{
return
item
.
key
===
key
;
return
item
.
key
===
key
;
});
});
...
@@ -149,12 +153,10 @@ export function formatSelect(val, options) {
...
@@ -149,12 +153,10 @@ export function formatSelect(val, options) {
if
(
Array
.
isArray
(
val
)
&&
val
.
length
===
0
)
{
if
(
Array
.
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
[];
return
[];
}
}
return
{
const
selectObj
=
options
.
find
((
item
)
=>
{
id
:
val
,
return
item
.
id
===
val
;
name
:
options
.
find
((
item
)
=>
{
})
||
{}
return
item
.
id
===
val
;
return
selectObj
;
}).
name
,
};
}
}
function
formatForm
(
formData
,
searchCols
)
{
function
formatForm
(
formData
,
searchCols
)
{
...
@@ -295,8 +297,9 @@ export default class DataView extends React.Component {
...
@@ -295,8 +297,9 @@ export default class DataView extends React.Component {
// this.getDefaultSift();
// this.getDefaultSift();
}
}
componentDidMount
()
{
async
componentDidMount
()
{
this
.
getSiftData
();
await
this
.
getSiftData
();
await
this
.
initView
();
replacePageNum
(
'pageNum'
,
this
.
state
.
current
,
this
.
fetchPage
);
// 当url里面有pageNum参数时,获取url里面的参数进行请求
replacePageNum
(
'pageNum'
,
this
.
state
.
current
,
this
.
fetchPage
);
// 当url里面有pageNum参数时,获取url里面的参数进行请求
}
}
...
@@ -381,6 +384,14 @@ export default class DataView extends React.Component {
...
@@ -381,6 +384,14 @@ export default class DataView extends React.Component {
message
.
error
(
res
&&
res
.
message
);
message
.
error
(
res
&&
res
.
message
);
}
}
}
}
initView
=
()
=>
{
// 该方法用于回调子空间的initView方法,只会执行一次
const
{
initView
}
=
this
.
props
;
const
{
searchForm
}
=
this
.
state
;
if
(
initView
)
{
initView
({
searchForm
,
instance
:
this
,
form
:
this
.
props
.
form
});
}
}
// eslint-disable-next-line react/sort-comp
// eslint-disable-next-line react/sort-comp
_beforeFetch
()
{
_beforeFetch
()
{
...
@@ -651,7 +662,7 @@ export default class DataView extends React.Component {
...
@@ -651,7 +662,7 @@ export default class DataView extends React.Component {
// 渲染查询条件按钮组件
// 渲染查询条件按钮组件
_renderFilterBtn
=
()
=>
{
_renderFilterBtn
=
()
=>
{
let
{
searchCols
,
advancedSearchCols
}
=
this
.
props
;
let
{
searchCols
,
advancedSearchCols
}
=
this
.
props
;
searchCols
=
[...
searchCols
,
...
advancedSearchCols
];
searchCols
=
[...
(
searchCols
||
[]),
...(
advancedSearchCols
||
[])
];
const
{
searchForm
,
siftDataArr
,
currentSiftNum
}
=
this
.
state
;
const
{
searchForm
,
siftDataArr
,
currentSiftNum
}
=
this
.
state
;
if
(
searchCols
===
null
||
searchCols
.
length
<=
0
)
return
null
;
if
(
searchCols
===
null
||
searchCols
.
length
<=
0
)
return
null
;
const
chooseItems
=
formatForm
(
searchForm
,
searchCols
);
const
chooseItems
=
formatForm
(
searchForm
,
searchCols
);
...
...
components/SearchView/index.js
View file @
cd9ab746
...
@@ -23,6 +23,9 @@ import styles from './index.less';
...
@@ -23,6 +23,9 @@ import styles from './index.less';
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-underscore-dangle */
// 基础搜索组件
// 基础搜索组件
// mode分为page 为页面模式下的搜索框, modal 弹框模式下搜索组件
// mode分为page 为页面模式下的搜索框, modal 弹框模式下搜索组件
/**
* select 拓展参数,将options 设置成function,用于基于业务处理options回调
*/
const
formItemLayout
=
{
const
formItemLayout
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment