feat: 系统化待办负责人改为下拉选择
This commit is contained in:
parent
e79f6f76dc
commit
9bb37afa83
@ -28,7 +28,23 @@ class SystemizationTodos extends Controller
|
||||
'pending' => '时间待定',
|
||||
'none' => '已完成',
|
||||
];
|
||||
private const OWNER_OPTIONS = ['人参', '晨曦', '常仪', '待定'];
|
||||
private const OWNER_OPTIONS = ['人参', '常仪', '晨曦', '待定'];
|
||||
private const ASSIGNEE_OPTIONS = [
|
||||
'人参',
|
||||
'苏木',
|
||||
'李斯',
|
||||
'周生辰',
|
||||
'常仪',
|
||||
'玉兔',
|
||||
'山时',
|
||||
'杳杳',
|
||||
'林冲',
|
||||
'惠兰',
|
||||
'晨曦',
|
||||
'栎阳',
|
||||
'秋香',
|
||||
'待定',
|
||||
];
|
||||
private const COLUMN_WIDTHS_SETTING = 'business.systemization_todos.column_widths';
|
||||
private const COLUMN_WIDTH_KEYS = [
|
||||
'type',
|
||||
@ -108,6 +124,7 @@ class SystemizationTodos extends Controller
|
||||
'todoContentOptions' => $this->contentOptions(),
|
||||
'todoOwners' => collect(self::OWNER_OPTIONS),
|
||||
'todoAssignees' => $todoAssignees,
|
||||
'todoAssigneeOptions' => collect(self::ASSIGNEE_OPTIONS),
|
||||
'todoAssigneeOwners' => $this->assigneeOwnerMap($todoAssignees),
|
||||
'todoStatuses' => SystemizationTodo::STATUSES,
|
||||
'todoStatusOptions' => $statusOptions,
|
||||
|
||||
@ -1528,7 +1528,7 @@
|
||||
if (persist) {
|
||||
persistColumnWidths(columnWidths);
|
||||
}
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
scheduleScrollRailSync();
|
||||
}
|
||||
|
||||
function columnWidthsFromPreference(preference) {
|
||||
@ -2577,6 +2577,8 @@
|
||||
var pendingGridRefreshTimer = null;
|
||||
var uploadUrl = '';
|
||||
var uploadRowId = '';
|
||||
var ownerOptions = @json($todoOwners->values()->all(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
var assigneeOptions = @json($todoAssigneeOptions->values()->all(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
var pasteFields = [
|
||||
'category',
|
||||
'section',
|
||||
@ -3058,15 +3060,24 @@
|
||||
return;
|
||||
}
|
||||
var editor;
|
||||
if (field === 'status') {
|
||||
if (field === 'status' || field === 'owner' || field === 'assignee') {
|
||||
editor = document.createElement('select');
|
||||
['未完成', '已完成'].forEach(function (value) {
|
||||
var choices = field === 'status'
|
||||
? ['未完成', '已完成']
|
||||
: (field === 'owner' ? ownerOptions : assigneeOptions).slice();
|
||||
if (field === 'assignee') {
|
||||
choices.unshift('');
|
||||
}
|
||||
if (original !== '' && choices.indexOf(original) === -1) {
|
||||
choices.unshift(original);
|
||||
}
|
||||
choices.forEach(function (value) {
|
||||
var option = document.createElement('option');
|
||||
option.value = value;
|
||||
option.textContent = value;
|
||||
option.textContent = value || '未指定';
|
||||
editor.appendChild(option);
|
||||
});
|
||||
editor.value = original || '未完成';
|
||||
editor.value = original || (field === 'assignee' ? '' : '待定');
|
||||
} else if (field === 'title' || field === 'progress') {
|
||||
editor = document.createElement('textarea');
|
||||
editor.rows = field === 'title' ? 2 : 3;
|
||||
@ -3092,7 +3103,7 @@
|
||||
cell.classList.add('is-dirty');
|
||||
});
|
||||
editor.addEventListener('change', function () {
|
||||
if (field === 'status') closeEditor(true);
|
||||
if (field === 'status' || field === 'owner' || field === 'assignee') closeEditor(true);
|
||||
});
|
||||
editor.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Escape') {
|
||||
@ -3463,7 +3474,7 @@
|
||||
focusCell.focus({preventScroll: true});
|
||||
}
|
||||
}
|
||||
scheduleScrollRailSync();
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
}
|
||||
|
||||
function queueGridRefresh(grid, focus) {
|
||||
|
||||
@ -98,6 +98,9 @@ class SystemizationTodosTest extends FeatureTestCase
|
||||
->assertSee('nextGridRefresh = payload.grid', false)
|
||||
->assertSee('applyGridRefresh()', false)
|
||||
->assertDontSee('reloadAfterSave', false)
|
||||
->assertSee('var ownerOptions =', false)
|
||||
->assertSee('var assigneeOptions =', false)
|
||||
->assertSee("field === 'status' || field === 'owner' || field === 'assignee'", false)
|
||||
->assertSee("if (field === 'start_date' || field === 'due_date')", false)
|
||||
->assertSee('sys-todo-grid-date-editor__pending', false)
|
||||
->assertSee('window.CaiWuDatePicker.setup(wrapper)', false)
|
||||
@ -400,10 +403,23 @@ class SystemizationTodosTest extends FeatureTestCase
|
||||
'page' => 'systemization-todos',
|
||||
]))->assertOk()->viewData('content');
|
||||
|
||||
$this->assertSame(
|
||||
['人参', '晨曦', '常仪', '待定'],
|
||||
$content['todoOwners']->all(),
|
||||
);
|
||||
$this->assertSame(['人参', '常仪', '晨曦', '待定'], $content['todoOwners']->all());
|
||||
$this->assertSame([
|
||||
'人参',
|
||||
'苏木',
|
||||
'李斯',
|
||||
'周生辰',
|
||||
'常仪',
|
||||
'玉兔',
|
||||
'山时',
|
||||
'杳杳',
|
||||
'林冲',
|
||||
'惠兰',
|
||||
'晨曦',
|
||||
'栎阳',
|
||||
'秋香',
|
||||
'待定',
|
||||
], $content['todoAssigneeOptions']->all());
|
||||
$this->assertContains('人参', $content['todoAssignees']);
|
||||
$this->assertContains('周生辰', $content['todoAssignees']);
|
||||
$this->assertNotContains('人参 / 周生辰', $content['todoAssignees']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user