* [bug#50953,done,2.5h] modify the way to get values.

This commit is contained in:
tianshujie
2024-06-12 14:09:14 +08:00
parent 5127876f18
commit 48ae1940e5
2 changed files with 16 additions and 14 deletions
+9 -7
View File
@@ -120,24 +120,26 @@ window.locateNewLib = function(type, objectID, libID)
window.rendDocCell = function(result, {col, row})
{
const dtable = zui.DTable.query('#docTable');
if(!dtable) return;
if(col.name == 'title')
{
let docNameHtml = `<div data-status='${row.data.status}' class='flex w-full doc-title'>`;
const docType = iconList[row.data.type];
const docType = dtable.options.iconList[row.data.type];
const docIcon = `<img src='static/svg/${docType}.svg' class='file-icon mr-1'>`;
if(canViewDoc)
if(dtable.options.canViewDoc)
{
docNameHtml += `<a class="doc-name flex" data-app="${currentTab}" href="` + $.createLink('doc', 'view', 'docID=' + row.data.id) + '">' + docIcon + ' ' + row.data.title + '</a>';
docNameHtml += `<a class="doc-name flex" data-app="${dtable.options.currentTab}" href="` + $.createLink('doc', 'view', 'docID=' + row.data.id) + '">' + docIcon + ' ' + row.data.title + '</a>';
}
else
{
docNameHtml += `<span class='doc-name flex'>${docIcon} ${row.data.title}</span>`;
}
if(row.data.status == 'draft') docNameHtml += `<span class="label special-pale rounded-full ml-1">${draftText}</span>`;
if(canCollect)
if(row.data.status == 'draft') docNameHtml += `<span class="label special-pale rounded-full ml-1">${dtable.options.draftText}</span>`;
if(dtable.options.canCollect)
{
const starIcon = row.data.collector.indexOf(',' + currentAccount + ',') >= 0 ? 'star' : 'star-empty';
const starIcon = row.data.collector.indexOf(',' + dtable.options.currentAccount + ',') >= 0 ? 'star' : 'star-empty';
docNameHtml += `<a class='ajaxCollect ajax-submit' href="` + $.createLink('doc', 'collect', `objectID=${row.data.id}&objectType=doc`) + `"><img src='static/svg/${starIcon}.svg' class='${starIcon} ml-1'></a>`;
}
@@ -159,7 +161,7 @@ window.rendDocCell = function(result, {col, row})
if(['product', 'project', 'execution', 'custom'].indexOf(row.data.objectType) !== -1) spaceParams = `objectID=${row.data.objectID}&${spaceParams}`;
if(row.data.objectType == 'mine') spaceParams = `type=${row.data.objectType}&${spaceParams}`;
moduleHtml = `<a data-app='${currentTab}' href="` + $.createLink('doc', spaceMethod, spaceParams) + '">' + moduleName + '</a>';
moduleHtml = `<a data-app='${dtable.options.currentTab}' href="` + $.createLink('doc', spaceMethod, spaceParams) + '">' + moduleName + '</a>';
}
else
{
+7 -7
View File
@@ -10,13 +10,6 @@ declare(strict_types=1);
*/
namespace zin;
jsVar('iconList', $config->doc->iconList);
jsVar('draftText', $lang->doc->draft);
jsVar('canViewDoc', common::hasPriv('doc', 'view'));
jsVar('canCollect', common::hasPriv('doc', 'collect') && $libType && $libType != 'api');
jsVar('currentAccount', $app->user->account);
jsVar('currentTab', $app->tab);
$cols = array();
foreach($config->doc->dtable->fieldList as $colName => $col)
{
@@ -31,6 +24,13 @@ $tableData = empty($docs) ? array() : initTableData($docs, $cols);
$createDocLink = '';
if($browseType != 'bysearch' && $libID && common::hasPriv('doc', 'create')) $createDocLink = createLink('doc', 'create', "objectType={$type}&objectID={$objectID}&libID={$lib->id}&moduleID={$moduleID}&type=html");
$docContent = dtable(
setID('docTable'),
set::iconList($config->doc->iconList),
set::draftText($lang->doc->draft),
set::canViewDoc(common::hasPriv('doc', 'view')),
set::canCollect(common::hasPriv('doc', 'collect') && $libType && $libType != 'api'),
set::currentAccount($app->user->account),
set::currentTab($app->tab),
set::module($this->app->moduleName),
set::userMap($users),
set::cols($cols),