This commit is contained in:
devezhao 2019-11-15 16:10:13 +08:00
parent 89f0870a95
commit 094774ab28
3 changed files with 67 additions and 10 deletions

View file

@ -286,6 +286,8 @@ public final class Application {
}
/**
* 业务实体服务专用
*
* @param entityCode
* @return
* @see #getGeneralEntityService()

View file

@ -236,9 +236,10 @@ class FolderTree extends React.Component {
confirm: function () {
this.disabled(true)
$.post(`${rb.baseUrl}/app/entity/record-delete?id=${id}`, (res) => {
if (res.error_code > 0) RbHighbar.error(res.error_msg)
this.hide()
that.loadData()
if (res.error_code === 0) {
this.hide()
that.loadData()
} else RbHighbar.error(res.error_msg)
})
}
})
@ -295,10 +296,11 @@ $(document).ready(() => {
__findPaths($('#navTree li.active'), paths)
let ol = $('.file-path ol').empty()
$(paths).each((idx, item) => {
let active = idx === paths.length - 1
let li = $(`<li class="breadcrumb-item ${active ? 'active' : ''}"></li>`).appendTo(ol)
if (active) li.text(item[0])
else $(`<a href="#!/Folder/${item[1]}">${item[0]}</a>`).appendTo(li)
// let active = idx === paths.length - 1
// let li = $(`<li class="breadcrumb-item ${active ? 'active' : ''}"></li>`).appendTo(ol)
// if (active) li.text(item[0])
// else $(`<a href="#!/Folder/${item[1]}">${item[0]}</a>`).appendTo(li)
$(`<li class="breadcrumb-item active">${item[0]}</li>`).appendTo(ol)
})
}
renderRbcomp(<FolderTree call={clickNav} />, 'navTree', function () { filesNav = this })
@ -317,9 +319,11 @@ $(document).ready(() => {
confirm: function () {
this.disabled(true)
$.post(`${rb.baseUrl}/files/delete-files?ids=${s}`, (res) => {
if (res.error_code > 0) RbHighbar.error(res.error_msg)
this.hide()
filesList.loadData()
if (res.error_code === 0) {
this.hide()
filesList.loadData()
} RbHighbar.error(res.error_msg)
})
}
})

View file

@ -0,0 +1,51 @@
/*
rebuild - Building your business-systems freely.
Copyright (C) 2019 devezhao <zhaofang123@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.rebuild.server.business.files;
import cn.devezhao.persist4j.Record;
import com.rebuild.server.Application;
import com.rebuild.server.TestSupportWithUser;
import com.rebuild.server.metadata.EntityHelper;
import org.junit.Test;
/**
* @author devezhao
* @since 2019/11/15
*/
public class FilesHelperTest extends TestSupportWithUser {
@Test
public void getFolders() {
Record folder = EntityHelper.forNew(EntityHelper.AttachmentFolder, getSessionUser());
folder.setString("name", "123456");
Application.getService(EntityHelper.AttachmentFolder).create(folder);
System.out.println(FilesHelper.getFolders(getSessionUser()));
}
@Test
public void getPrivateFolders() {
Record folder = EntityHelper.forNew(EntityHelper.AttachmentFolder, getSessionUser());
folder.setString("name", "abcdef");
folder.setString("scope", FilesHelper.SCOPE_SELF);
Application.getService(EntityHelper.AttachmentFolder).create(folder);
System.out.println(FilesHelper.getPrivateFolders(getSessionUser()));
}
}