Skip to content

修改两个小问题 #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/classes/IssueLogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class IssueLogic
'master_id' => '是否父任务',
'created' => '创建时间',
'updated' => '最后修改时间',
'description' => '描述',
];
/**
* 默认显示的字段
Expand Down
28 changes: 28 additions & 0 deletions app/ctrl/issue/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ public function filter()
}
// 表格显示头像还是名称
$projectId = isset($_GET['project']) ? intval($_GET['project']) : null;
$data['project_id']=$projectId;
$projectFlagModel = new ProjectFlagModel();
$isTableDisplayAvatar = $projectFlagModel->getValueByFlag($projectId, "is_table_display_avatar");
if(is_null($isTableDisplayAvatar)){
Expand Down Expand Up @@ -756,6 +757,7 @@ private function response($data, $total, $page, $pageSize)
foreach ($labelDataRows as $labelData) {
$labelDataArr[$labelData['issue_id']][] = $labelData['label_id'];
}

// 获取自定义字段值
$fieldsArr = (new FieldModel())->getCustomFields();
if ($fieldsArr) {
Expand All @@ -774,8 +776,34 @@ private function response($data, $total, $page, $pageSize)
$customValuesIssueArr[$issueId][$fieldName] = $fieldValue;
}
}
$customFieldInfo =[];
foreach ($fieldsArr as $field) {
$customfieldobj=[];
$customfieldobj['title']=$field['title'];
$customfieldobj['name']=$field['name'];
$customfieldobj['type']=$field['type'];
$customFieldInfo[] = $customfieldobj;
}

$data['custom_fields'] = $customFieldInfo; //array_column($fieldsArr, 'title', 'name');
}

$issueLogic = new IssueLogic();
$projectFlagModel = new ProjectFlagModel();
$isUserDisplayField = $projectFlagModel->getValueByFlag($data['project_id'], "is_user_display_field");
if(is_null($isUserDisplayField)){
$data['is_user_display_field'] = "1";
}else{
$data['is_user_display_field'] = $isUserDisplayField;
}
$data['user_display_fields'] = $issueLogic->getUserIssueDisplayFields(UserAuth::getId(), $data['project_id']);
if ($data['is_user_display_field'] !=="1"){
$data['display_fields'] = IssueLogic::fetchProjectDisplayFields($data['project_id']);
}else{
$data['display_fields'] = $data['user_display_fields'];
}


$userLogic = new UserLogic();
$users = $userLogic->getAllUser();
foreach ($data['issues'] as &$issue) {
Expand Down
2 changes: 1 addition & 1 deletion public/dev/js/admin/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var Project = (function() {
notify_success(resp.msg, '克隆成功');
$('#modal-project_clone').modal('hide');
} else {
notify_error('克隆失败,' + resp.msg);
notify_error('克隆失败,' + resp.msg + ": " + resp.data);
}
},
error: function (res) {
Expand Down
58 changes: 50 additions & 8 deletions public/dev/js/issue/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1236,12 +1236,14 @@ var IssueMain = (function () {
}
},
];

let column = {field: 'issue_num', title: '编 号', class: 'cursor_move', sortable: true, align: 'left', formatter: function (value, row, index) {
return '#'+value
}
}
columns.push( column)

if(isInArray(resp.data.display_fields,'issue_num')){
let column = {field: 'issue_num', title: '编 号', sortable: true, align: 'left', formatter: function (value, row, index) {
return '#'+value
}
}
columns.push( column)
}

if(isInArray(resp.data.display_fields,'issue_type')){
let column = {field: 'issue_type', title: '类 型', sortable: true, align: 'center', formatter: function (value, row, index) {
Expand Down Expand Up @@ -1446,6 +1448,45 @@ var IssueMain = (function () {
}
columns.push( column)
}

if(isInArray(resp.data.display_fields,'description')){
let column = {field: 'description', title: '描 述', sortable: true, align: 'left', formatter: function (value, row, index) {
let html = '<div id="xxx" class="description description-view markdown-body editormd-html-preview">' + marked.parse(value) + '</div>';
// html += '<script>editormd.markdownToHTML("description-view", {markdown:';
//html += value + '});</script>';
return html;
}
}
columns.push( column)
}
var customFileds=resp.data.custom_fields;
for(var i in customFileds)
{

console.log(customFileds[i].name + " " + customFileds[i].title);

if(isInArray(resp.data.display_fields,customFileds[i].name))
{
let column = {field: customFileds[i].name, title: customFileds[i].title, sortable: true, align: 'left', formatter: function (value, row, index)
{
if(customFileds[i].type=='MARKDOWN')
{
let html = '<div id="xxx" class="description description-view markdown-body editormd-html-preview">' + marked.parse(value) + '</div>';
// html += '<script>editormd.markdownToHTML("description-view", {markdown:';
//html += value + '});</script>';
return html;
}
else
return value;
}
}
columns.push( column);
}
}




let columnOpt = {field: 'operate', class:"min_width_80", title: '操 作', align: 'center',events : operateEvents, formatter: function (value, row, index) {
let html = '';
html += '<span class="summary_children">';
Expand All @@ -1464,6 +1505,7 @@ var IssueMain = (function () {
// bootstrap-table-treegrid.js 插件配置 -- start
//在哪一列展开树形
treeShowField: 'summary',

//指定父id列
parentIdField: 'master_id',
onResetView: function(data) {
Expand All @@ -1472,8 +1514,8 @@ var IssueMain = (function () {
initialState: 'expanded',// 所有节点都折叠 collapsed | expanded
// initialState: 'expanded',// 所有节点都展开,默认展开
treeColumn: 1,
// expanderExpandedClass: 'glyphicon glyphicon-minus', //图标样式
// expanderCollapsedClass: 'glyphicon glyphicon-plus',
//expanderExpandedClass: 'glyphicon glyphicon-minus', //图标样式
//expanderCollapsedClass: 'glyphicon glyphicon-plus',
onChange: function() {
$tree_table.bootstrapTable('resetWidth');
}
Expand Down