@ -17,7 +17,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
DataLabel = layui . datalabel ;
const tHeadSetLayer = new THeadSetLayer ( layui ) ;
let metaListTable , dirFileTable , tagSelector , tags = [ ] , conditions = [ ] ;
let metaListTable , dirFileTable , tagSelector , tags = [ ] , conditions = [ ] , preciseQuery = '' ;
const unchecked _tags = new Set ( ) ;
// 初始化
initDirectoryTree ( ) ;
@ -152,6 +152,9 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
if ( _table . where . conditions && _table . where . conditions . length > 0 ) {
let formVal = form . val ( 'search-form' ) ;
formVal = Object . assign ( formVal , whereConditionToFormValue ( _table . where ) ) ;
if ( preciseQuery === 'eq' ) {
formVal [ 'preciseQuery' ] = 'eq' ;
}
form . val ( 'search-form' , formVal ) ;
// $('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 } ` ,
height : 'full-110' ,
request : { pageName : 'page' , limitName : 'size' } ,
defaultToolbar : [
{ title : '列表配置' , layEvent : 'theadSet2' , icon : 'layui-icon-cols' }
] ,
defaultToolbar : [ { title : '列表配置' , layEvent : 'theadSet2' , icon : 'layui-icon-cols' } ] ,
autoSort : false ,
limit : 30 ,
method : 'get' ,
@ -319,17 +320,26 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
, 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 ( ) {
let value = $ ( this ) . val ( ) ;
setSearchKeyCondition ( value , preciseQuery === 'eq' ? 'eq' : 'like' ) ;
} )
function setSearchKeyCondition ( value , logic ) {
let where = metaListTable . where || { } ;
let conditions = where . conditions || [ ] ;
let value = $ ( this ) . val ( ) ;
conditions = conditions . filter ( item => item . fieldName !== 'metadataName' )
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 ;
metaListTable . where = where ;
} )
}
}
function setMarkTagInputValue ( ) {
@ -364,7 +374,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
if ( key === 'searchKeyInput' ) continue ;
let fieldName = key , fieldValue = formVal [ key ] , logicJudgement ;
// 如果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 ( ) ;
if ( hasText ) {
@ -565,7 +575,7 @@ class THeadSetLayer {
} )
}
static filterConfigData ( tableId ) {
static filterConfigData ( tableId ) {
return theadConfig . filter ( item => item . tableId === tableId ) ;
}
@ -583,7 +593,9 @@ class THeadSetLayer {
targetNumber : data => DICT . getText ( 'target_type' , data . targetNumber ) || data . targetNumber || '' ,
secretLevel : data => DICT . getText ( 'secret_level' , data . secretLevel ) || data . secretLevel || '' ,
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 width = ! colWidth ? undefined : ( Number . isInteger ( colWidth ) ? parseInt ( colWidth ) : colWidth ) ;
let col = { field : colName , title : colTitle , width , sort : isSort , hide : ! isShow }
if ( templets [ colName ] ) {
if ( templets [ colName ] ) {
col [ 'templet' ] = templets [ colName ] ;
}
return col ;
@ -599,9 +611,9 @@ class THeadSetLayer {
// 设置操作列
let operateCol = { fixed : 'right' , title : '操作' , toolbar : '' , width : 100 , align : 'center' } ;
if ( tableId === 'dirMetadataTable' ) {
if ( tableId === 'dirMetadataTable' ) {
operateCol . toolbar = '#rowToolBar'
} else if ( tableId === 'dirFileTable' ) {
} else if ( tableId === 'dirFileTable' ) {
operateCol . toolbar = '#fileRowToolBar'
}
cols . push ( operateCol ) ;