@ -17,7 +17,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
DataLabel = layui . datalabel ;
DataLabel = layui . datalabel ;
const tHeadSetLayer = new THeadSetLayer ( layui ) ;
const tHeadSetLayer = new THeadSetLayer ( layui ) ;
let metaListTable , dirFileTable , tagSelector , tags = [ ] , conditions = [ ] ;
let metaListTable , dirFileTable , tagSelector , tags = [ ] , conditions = [ ] , preciseQuery = '' ;
const unchecked _tags = new Set ( ) ;
const unchecked _tags = new Set ( ) ;
// 初始化
// 初始化
initDirectoryTree ( ) ;
initDirectoryTree ( ) ;
@ -152,6 +152,9 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
if ( _table . where . conditions && _table . where . conditions . length > 0 ) {
if ( _table . where . conditions && _table . where . conditions . length > 0 ) {
let formVal = form . val ( 'search-form' ) ;
let formVal = form . val ( 'search-form' ) ;
formVal = Object . assign ( formVal , whereConditionToFormValue ( _table . where ) ) ;
formVal = Object . assign ( formVal , whereConditionToFormValue ( _table . where ) ) ;
if ( preciseQuery === 'eq' ) {
formVal [ 'preciseQuery' ] = 'eq' ;
}
form . val ( 'search-form' , formVal ) ;
form . val ( 'search-form' , formVal ) ;
// $('div[lay-event="export"]').show();
// $('div[lay-event="export"]').show();
}
}
@ -219,9 +222,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
url : ` ${ ctx } /search/full/file?metaId= ${ id } ` ,
url : ` ${ ctx } /search/full/file?metaId= ${ id } ` ,
height : 'full-110' ,
height : 'full-110' ,
request : { pageName : 'page' , limitName : 'size' } ,
request : { pageName : 'page' , limitName : 'size' } ,
defaultToolbar : [
defaultToolbar : [ { title : '列表配置' , layEvent : 'theadSet2' , icon : 'layui-icon-cols' } ] ,
{ title : '列表配置' , layEvent : 'theadSet2' , icon : 'layui-icon-cols' }
] ,
autoSort : false ,
autoSort : false ,
limit : 30 ,
limit : 30 ,
method : 'get' ,
method : 'get' ,
@ -319,17 +320,26 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
, range : '至'
, range : '至'
} ) ;
} ) ;
form . on ( 'checkbox(precise-query)' , function ( { value , othis } ) {
preciseQuery = othis . hasClass ( 'layui-form-checked' ) ? value : '' ;
setSearchKeyCondition ( $ ( '#searchKeyInput' ) . val ( ) , preciseQuery === 'eq' ? 'eq' : 'like' ) ;
} ) ;
$ ( '#searchKeyInput' ) . on ( 'change' , function ( ) {
$ ( '#searchKeyInput' ) . on ( 'change' , function ( ) {
let value = $ ( this ) . val ( ) ;
setSearchKeyCondition ( value , preciseQuery === 'eq' ? 'eq' : 'like' ) ;
} )
function setSearchKeyCondition ( value , logic ) {
let where = metaListTable . where || { } ;
let where = metaListTable . where || { } ;
let conditions = where . conditions || [ ] ;
let conditions = where . conditions || [ ] ;
let value = $ ( this ) . val ( ) ;
conditions = conditions . filter ( item => item . fieldName !== 'metadataName' )
conditions = conditions . filter ( item => item . fieldName !== 'metadataName' )
if ( value && value . trim ( ) ) {
if ( value && value . trim ( ) ) {
conditions . push ( { fieldName : 'metadataName' , fieldValue : value . trim ( ) , logicJudgement : 'like' } )
conditions . push ( { fieldName : 'metadataName' , fieldValue : value . trim ( ) , logicJudgement : logic } )
}
}
where . conditions = conditions ;
where . conditions = conditions ;
metaListTable . where = where ;
metaListTable . where = where ;
} )
}
}
}
function setMarkTagInputValue ( ) {
function setMarkTagInputValue ( ) {
@ -364,7 +374,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
if ( key === 'searchKeyInput' ) continue ;
if ( key === 'searchKeyInput' ) continue ;
let fieldName = key , fieldValue = formVal [ key ] , logicJudgement ;
let fieldName = key , fieldValue = formVal [ key ] , logicJudgement ;
// 如果fieldName是条件下拉框,则跳过
// 如果fieldName是条件下拉框,则跳过
if ( fieldName . startsWith ( 'logic-' ) || fieldName === 'directoryId' || fieldName === 'metadataId' ) continue ;
if ( fieldName . startsWith ( 'logic-' ) || fieldName === 'directoryId' || fieldName === 'metadataId' || fieldName === 'preciseQuery' ) continue ;
let hasText = fieldValue . trim ( ) ;
let hasText = fieldValue . trim ( ) ;
if ( hasText ) {
if ( hasText ) {
@ -565,7 +575,7 @@ class THeadSetLayer {
} )
} )
}
}
static filterConfigData ( tableId ) {
static filterConfigData ( tableId ) {
return theadConfig . filter ( item => item . tableId === tableId ) ;
return theadConfig . filter ( item => item . tableId === tableId ) ;
}
}
@ -583,7 +593,9 @@ class THeadSetLayer {
targetNumber : data => DICT . getText ( 'target_type' , data . targetNumber ) || data . targetNumber || '' ,
targetNumber : data => DICT . getText ( 'target_type' , data . targetNumber ) || data . targetNumber || '' ,
secretLevel : data => DICT . getText ( 'secret_level' , data . secretLevel ) || data . secretLevel || '' ,
secretLevel : data => DICT . getText ( 'secret_level' , data . secretLevel ) || data . secretLevel || '' ,
exerciseData : data => data . exerciseData ? '是' : '否' ,
exerciseData : data => data . exerciseData ? '是' : '否' ,
resourceType : data => data . resourceType === 'file' ? '文件' : '数据库表'
resourceType : data => data . resourceType === 'file' ? '文件' : '数据库表' ,
fileSize : data => {
}
}
}
// 遍历配置项转换为列
// 遍历配置项转换为列
@ -591,7 +603,7 @@ class THeadSetLayer {
const { colName , colTitle , colWidth , isShow , isSort } = conf ;
const { colName , colTitle , colWidth , isShow , isSort } = conf ;
const width = ! colWidth ? undefined : ( Number . isInteger ( colWidth ) ? parseInt ( colWidth ) : colWidth ) ;
const width = ! colWidth ? undefined : ( Number . isInteger ( colWidth ) ? parseInt ( colWidth ) : colWidth ) ;
let col = { field : colName , title : colTitle , width , sort : isSort , hide : ! isShow }
let col = { field : colName , title : colTitle , width , sort : isSort , hide : ! isShow }
if ( templets [ colName ] ) {
if ( templets [ colName ] ) {
col [ 'templet' ] = templets [ colName ] ;
col [ 'templet' ] = templets [ colName ] ;
}
}
return col ;
return col ;
@ -599,9 +611,9 @@ class THeadSetLayer {
// 设置操作列
// 设置操作列
let operateCol = { fixed : 'right' , title : '操作' , toolbar : '' , width : 100 , align : 'center' } ;
let operateCol = { fixed : 'right' , title : '操作' , toolbar : '' , width : 100 , align : 'center' } ;
if ( tableId === 'dirMetadataTable' ) {
if ( tableId === 'dirMetadataTable' ) {
operateCol . toolbar = '#rowToolBar'
operateCol . toolbar = '#rowToolBar'
} else if ( tableId === 'dirFileTable' ) {
} else if ( tableId === 'dirFileTable' ) {
operateCol . toolbar = '#fileRowToolBar'
operateCol . toolbar = '#fileRowToolBar'
}
}
cols . push ( operateCol ) ;
cols . push ( operateCol ) ;