|
|
|
@ -218,7 +218,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
new THeadSetLayer(metaListTable, layui); |
|
|
|
|
new THeadSetLayer(layui, metaListTable, [...sourceTableConfigMap.values()]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function initFileSearchTable(id) { |
|
|
|
@ -290,7 +290,7 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop |
|
|
|
|
openMaxLayerWithURL(`${ctx}/sys/file/view?fileId=${obj.id}`) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
new THeadSetLayer(dirFileTable, layui); |
|
|
|
|
new THeadSetLayer(layui, dirFileTable, [...fileTableConfigMap.values()]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -520,12 +520,13 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop |
|
|
|
|
* 表格表头配置组件 |
|
|
|
|
*/ |
|
|
|
|
class THeadSetLayer { |
|
|
|
|
constructor(pageTable, lay) { |
|
|
|
|
constructor(lay, pageTable, configData) { |
|
|
|
|
this.layer = lay.layer; |
|
|
|
|
this.form = lay.form; |
|
|
|
|
this.gtable = lay.gtable; |
|
|
|
|
this.pageTable = pageTable; |
|
|
|
|
this.id = pageTable.id + 'Set'; |
|
|
|
|
this.id = pageTable.table.id + 'Set'; |
|
|
|
|
this.configData = configData; |
|
|
|
|
this.pageTable.addTableRowEvent('theadSet', () => this.show()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -557,7 +558,7 @@ class THeadSetLayer { |
|
|
|
|
const {gtable, form, id} = this; |
|
|
|
|
gtable.init({ |
|
|
|
|
id, |
|
|
|
|
data: [...sourceTableConfigMap.values()], |
|
|
|
|
data: this.configData, |
|
|
|
|
method: 'get', |
|
|
|
|
toolbar: false, |
|
|
|
|
height: 'full-310', |
|
|
|
@ -581,13 +582,23 @@ class THeadSetLayer { |
|
|
|
|
]], |
|
|
|
|
}); |
|
|
|
|
gtable.on(`edit(${id})`, ({field, value, data}) => { |
|
|
|
|
this._setData(data.id, field, value); |
|
|
|
|
if (this.id.startsWith('dirMetadataTable')) { |
|
|
|
|
sourceTableConfigMap.get(data.id)[field] = value; |
|
|
|
|
} else if (this.id.startsWith('dirFileTable')) { |
|
|
|
|
fileTableConfigMap.get(data.id)[field] = value; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 监听switch按钮
|
|
|
|
|
form.on(`switch(${id}-switch)`, ({elem}) => { |
|
|
|
|
const id = $(elem).attr('id'), name = $(elem).attr('name'); |
|
|
|
|
if (this.id.startsWith('dirMetadataTable')) { |
|
|
|
|
const value = sourceTableConfigMap.get(id)[name]; |
|
|
|
|
sourceTableConfigMap.get(id)[name] = !value; |
|
|
|
|
} else if (this.id.startsWith('dirFileTable')) { |
|
|
|
|
const value = fileTableConfigMap.get(id)[name]; |
|
|
|
|
fileTableConfigMap.get(id)[name] = !value; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function renderSwitch(colName, data) { |
|
|
|
@ -596,9 +607,17 @@ class THeadSetLayer { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_setData(id, name, value) { |
|
|
|
|
if (this.id.startsWith('dirMetadataTable')) { |
|
|
|
|
sourceTableConfigMap.get(id)[name] = value; |
|
|
|
|
} else if (this.id.startsWith('dirFileTable')) { |
|
|
|
|
fileTableConfigMap.get(id)[name] = value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_saveTheadSet() { |
|
|
|
|
return new Promise(resolve => { |
|
|
|
|
Util.post(`/sys/thead/config/api/save`, {params: JSON.stringify([...sourceTableConfigMap.values()])}).then(res=>{ |
|
|
|
|
Util.post(`/sys/thead/config/api/save`, {params: JSON.stringify([...sourceTableConfigMap.values(), ...fileTableConfigMap.values()])}).then(res => { |
|
|
|
|
if (res.flag) { |
|
|
|
|
showOkMsg('保存成功') |
|
|
|
|
} else { |
|
|
|
|