${file.filename}${file.fileext}
${moveHtml}${editHtml}${viewHtml}${downHtml}${delHtml}
`;
}
_getEditFileNameHtml(file) {
const inputHtml = ``);
html.push(`
添加单位下全部用户
`);
for (const u of c.users) {
html.push(`
`);
html.push(`${u.name}${u.mobile}
`);
html.push(`${u.role}`);
html.push(``);
}
html.push('
');
}
$('#puList').html(html.join(''));
}
_convertData(sourceTree) {
const data = [];
for (const node of sourceTree.nodes) {
if (!node.is_fixed) continue;
const parent = node.tree_pid === '-1' ? undefined : data.find(x => { return x.id === node.tree_pid; });
const child = sourceTree.nodes.find(x => { return x.tree_pid === node.id; });
data.push({
id: node.id,
tree_id: data.length + 1,
tree_pid: parent ? parent.tree_id : -1,
order: node.tree_order + 1,
level: node.tree_level,
is_leaf: !child || !child.is_fixed,
full_path: '',
name: node.name,
is_fixed: node.is_fixed,
filing_type: node.filing_type + '',
tips: node.tips,
file_count: node.file_count,
});
}
return data;
}
loadPermission() {
this.permissionTree.loadDatas(this._convertData(filingObj.dragTree));
SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.permissionTree);
const self = this;
postData('permission', {}, function(result) {
self.analysisFiling(result);
if (!self.curFiling) {
const node = SpreadJsObj.getSelectObject(self.sheet);
self.setCurFiling(node.filing_type);
} else {
self.loadCurFiling();
}
self.loadPermissionUser();
});
}
syncFiling(sourceId, targetIds) {
for (const pu of this.permissionUser) {
if (pu.filing_type.indexOf(sourceId) >= 0) {
targetIds.forEach(id => {
if (pu.filing_type.indexOf(id) < 0) pu.filing_type.push(id);
});
} else {
targetIds.forEach(id => {
if (pu.filing_type.indexOf(id) >= 0) pu.filing_type.splice(pu.filing_type.indexOf(id), 1);
})
}
}
}
delFiling(filingId, userId) {
const userIds = userId instanceof Array ? userId : [userId];
for (const id of userIds) {
const pu = this.permissionUser.find(x => { return x.id === id });
if (!pu) continue;
if (pu.filing_type.indexOf(filingId) >= 0) pu.filing_type.splice(pu.filing_type.indexOf(filingId), 1);
}
}
batchAddFiling(filingIds, userId) {
for (const pu of this.permissionUser) {
if (userId.indexOf(pu.id) < 0) continue;
filingIds.forEach(fid => {
if (pu.filing_type.indexOf(fid) < 0) pu.filing_type.push(fid);
});
}
}
savePermission() {
const self = this;
const data = this.permissionUser.map(x => {
return { id: x.id, filing_type: x.filing_type.join(',') };
});
postData('permission/save', data, function(result) {
$(self.setting.modal).modal('hide');
});
}
}
const filingPermission = new FilingPermission({
modal: '#filing-permission',
list: '#filing-valid',
spread: '#permission-spread',
});
class FileSearch {
constructor() {
this.searchResult = [];
this.initSearch();
}
getOperateHtml(file) {
const locateHtml = `