perf: 添加任务弹窗
This commit is contained in:
parent
162c6e95d3
commit
7171d1d6b2
@ -58,7 +58,7 @@
|
|||||||
"stylus-loader": "^6.2.0",
|
"stylus-loader": "^6.2.0",
|
||||||
"tinymce": "^5.10.2",
|
"tinymce": "^5.10.2",
|
||||||
"tui-calendar-hi": "^1.15.1-1",
|
"tui-calendar-hi": "^1.15.1-1",
|
||||||
"view-design-hi": "^4.7.0-2",
|
"view-design-hi": "^4.7.0-3",
|
||||||
"vue": "^2.6.14",
|
"vue": "^2.6.14",
|
||||||
"vue-clipboard2": "^0.3.3",
|
"vue-clipboard2": "^0.3.3",
|
||||||
"vue-emoji-picker": "^1.0.3",
|
"vue-emoji-picker": "^1.0.3",
|
||||||
|
@ -123,6 +123,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<!--添加任务-->
|
||||||
|
<Modal
|
||||||
|
v-model="addTaskShow"
|
||||||
|
:title="$L('添加任务')"
|
||||||
|
:styles="{
|
||||||
|
width: '90%',
|
||||||
|
maxWidth: '640px'
|
||||||
|
}"
|
||||||
|
:mask-closable="false"
|
||||||
|
footer-hide>
|
||||||
|
<TaskAdd ref="addTask" v-model="addTaskShow"/>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<!--任务详情-->
|
<!--任务详情-->
|
||||||
<Modal
|
<Modal
|
||||||
:value="taskId > 0"
|
:value="taskId > 0"
|
||||||
@ -181,9 +194,13 @@ import TeamManagement from "./manage/components/TeamManagement";
|
|||||||
import ProjectManagement from "./manage/components/ProjectManagement";
|
import ProjectManagement from "./manage/components/ProjectManagement";
|
||||||
import DrawerOverlay from "../components/DrawerOverlay";
|
import DrawerOverlay from "../components/DrawerOverlay";
|
||||||
import DragBallComponent from "../components/DragBallComponent";
|
import DragBallComponent from "../components/DragBallComponent";
|
||||||
|
import TaskAdd from "./manage/components/TaskAdd";
|
||||||
|
import {Store} from "le5le-store";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {DragBallComponent, DrawerOverlay, ProjectManagement, TeamManagement, ProjectArchived, TaskDetail},
|
components: {
|
||||||
|
TaskAdd,
|
||||||
|
DragBallComponent, DrawerOverlay, ProjectManagement, TeamManagement, ProjectArchived, TaskDetail},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
@ -197,6 +214,9 @@ export default {
|
|||||||
},
|
},
|
||||||
addRule: {},
|
addRule: {},
|
||||||
|
|
||||||
|
addTaskShow: false,
|
||||||
|
addTaskSubscribe: null,
|
||||||
|
|
||||||
columns: [],
|
columns: [],
|
||||||
|
|
||||||
projectKeyValue: '',
|
projectKeyValue: '',
|
||||||
@ -229,11 +249,34 @@ export default {
|
|||||||
this.notificationInit();
|
this.notificationInit();
|
||||||
this.onVisibilityChange();
|
this.onVisibilityChange();
|
||||||
//
|
//
|
||||||
|
this.addTaskSubscribe = Store.subscribe('addTask', (data) => {
|
||||||
|
this.$refs.addTask.defaultPriority();
|
||||||
|
this.$refs.addTask.setData($A.isJson(data) ? data : {
|
||||||
|
'owner': this.userId,
|
||||||
|
'column_id': data,
|
||||||
|
});
|
||||||
|
this.addTaskShow = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addTask.$refs.input.focus();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
//
|
||||||
|
document.addEventListener('keydown', this.shortcutEvent);
|
||||||
|
//
|
||||||
if (this.isElectron) {
|
if (this.isElectron) {
|
||||||
this.$electron.ipcRenderer.send('setDockBadge', 0);
|
this.$electron.ipcRenderer.send('setDockBadge', 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
if (this.addTaskSubscribe) {
|
||||||
|
this.addTaskSubscribe.unsubscribe();
|
||||||
|
this.addTaskSubscribe = null;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
document.removeEventListener('keydown', this.shortcutEvent);
|
||||||
|
},
|
||||||
|
|
||||||
deactivated() {
|
deactivated() {
|
||||||
this.addShow = false;
|
this.addShow = false;
|
||||||
},
|
},
|
||||||
@ -526,6 +569,15 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
shortcutEvent(e) {
|
||||||
|
if (e.keyCode === 75 || e.keyCode === 78) {
|
||||||
|
if (e.metaKey || e.ctrlKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
Store.set('addTask', 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
taskVisibleChange(visible) {
|
taskVisibleChange(visible) {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
this.$store.dispatch('openTask', 0)
|
this.$store.dispatch('openTask', 0)
|
||||||
|
@ -315,23 +315,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--添加任务-->
|
|
||||||
<Modal
|
|
||||||
v-model="addShow"
|
|
||||||
:title="$L('添加任务')"
|
|
||||||
:styles="{
|
|
||||||
width: '90%',
|
|
||||||
maxWidth: '640px'
|
|
||||||
}"
|
|
||||||
:mask-closable="false">
|
|
||||||
<TaskAdd ref="add" @on-add="onAddTask"/>
|
|
||||||
<div slot="footer">
|
|
||||||
<Button type="default" @click="addShow=false">{{$L('取消')}}</Button>
|
|
||||||
<Button type="primary" :loading="addLoad > 0" @click="onAddTask">{{$L('添加')}}</Button>
|
|
||||||
<Button type="primary" :loading="addLoad > 0" @click="onAddTask(true)">{{$L('添加并继续')}}</Button>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<!--项目设置-->
|
<!--项目设置-->
|
||||||
<Modal
|
<Modal
|
||||||
v-model="settingShow"
|
v-model="settingShow"
|
||||||
@ -454,9 +437,6 @@ export default {
|
|||||||
|
|
||||||
searchText: '',
|
searchText: '',
|
||||||
|
|
||||||
addShow: false,
|
|
||||||
addLoad: 0,
|
|
||||||
|
|
||||||
addColumnShow: false,
|
addColumnShow: false,
|
||||||
addColumnName: '',
|
addColumnName: '',
|
||||||
|
|
||||||
@ -490,12 +470,6 @@ export default {
|
|||||||
this.projectDialogsubscribe = Store.subscribe('onProjectDialogBack', () => {
|
this.projectDialogsubscribe = Store.subscribe('onProjectDialogBack', () => {
|
||||||
this.$store.dispatch('toggleTablePanel', 'chat');
|
this.$store.dispatch('toggleTablePanel', 'chat');
|
||||||
});
|
});
|
||||||
//
|
|
||||||
document.addEventListener('keydown', this.shortcutAdd);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy () {
|
|
||||||
document.removeEventListener('keydown', this.shortcutAdd);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
@ -749,16 +723,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onAddTask(again) {
|
|
||||||
this.addLoad++;
|
|
||||||
this.$refs.add.onAdd((success) => {
|
|
||||||
this.addLoad--;
|
|
||||||
if (success && again !== true) {
|
|
||||||
this.addShow = false;
|
|
||||||
}
|
|
||||||
}, again)
|
|
||||||
},
|
|
||||||
|
|
||||||
addTopShow(id, show) {
|
addTopShow(id, show) {
|
||||||
this.$set(this.columnTopShow, id, show);
|
this.$set(this.columnTopShow, id, show);
|
||||||
if (show) {
|
if (show) {
|
||||||
@ -767,16 +731,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addTaskOpen(column_id) {
|
addTaskOpen(column_id) {
|
||||||
this.$refs.add.defaultPriority();
|
Store.set('addTask', column_id);
|
||||||
this.$refs.add.setData($A.isJson(column_id) ? column_id : {
|
|
||||||
'owner': this.userId,
|
|
||||||
'column_id': column_id,
|
|
||||||
});
|
|
||||||
this.$Modal.resetIndex();
|
|
||||||
this.addShow = true;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.add.$refs.input.focus();
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addColumnOpen() {
|
addColumnOpen() {
|
||||||
@ -1188,17 +1143,6 @@ export default {
|
|||||||
this.completeJust = [];
|
this.completeJust = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
shortcutAdd(e) {
|
|
||||||
if (this.projectId && this.projectId == this.$route.params.id) {
|
|
||||||
if (e.keyCode === 75 || e.keyCode === 78) {
|
|
||||||
if (e.metaKey || e.ctrlKey) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.addTaskOpen(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
formatTime(date) {
|
formatTime(date) {
|
||||||
let time = Math.round($A.Date(date).getTime() / 1000),
|
let time = Math.round($A.Date(date).getTime() / 1000),
|
||||||
string = '';
|
string = '';
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Form v-if="advanced" class="task-add-advanced" label-width="auto" @submit.native.prevent>
|
<Form v-if="advanced" class="task-add-advanced" label-width="auto" @submit.native.prevent>
|
||||||
<FormItem :label="$L('任务列表')">
|
<FormItem :label="$L('任务列表')">
|
||||||
<Select
|
<Select
|
||||||
@ -113,6 +114,21 @@
|
|||||||
:placeholder="$L('+ 输入子任务,回车添加子任务')"/>
|
:placeholder="$L('+ 输入子任务,回车添加子任务')"/>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
<div class="ivu-modal-footer">
|
||||||
|
<Button type="default" @click="close">{{$L('取消')}}</Button>
|
||||||
|
<ButtonGroup class="page-manage-add-task-button-group">
|
||||||
|
<Button type="primary" :loading="loadIng > 0" @click="onAdd">{{$L('添加')}}</Button>
|
||||||
|
<Dropdown @on-click="onAdd(true)">
|
||||||
|
<Button type="primary" :loading="loadIng > 0">
|
||||||
|
<Icon type="ios-arrow-down"></Icon>
|
||||||
|
</Button>
|
||||||
|
<DropdownMenu slot="list">
|
||||||
|
<DropdownItem>{{$L('添加并继续')}}</DropdownItem>
|
||||||
|
</DropdownMenu>
|
||||||
|
</Dropdown>
|
||||||
|
</ButtonGroup>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -124,6 +140,12 @@ import UserInput from "../../../components/UserInput";
|
|||||||
export default {
|
export default {
|
||||||
name: "TaskAdd",
|
name: "TaskAdd",
|
||||||
components: {UserInput, TEditor},
|
components: {UserInput, TEditor},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
addData: {
|
addData: {
|
||||||
@ -168,10 +190,12 @@ export default {
|
|||||||
timeOptions: {
|
timeOptions: {
|
||||||
shortcuts: []
|
shortcuts: []
|
||||||
},
|
},
|
||||||
|
|
||||||
|
loadIng: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$refs.input.focus();
|
//
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userId', 'projectId', 'columns', 'taskPriority']),
|
...mapState(['userId', 'projectId', 'columns', 'taskPriority']),
|
||||||
@ -232,6 +256,9 @@ export default {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit("input", !this.value)
|
||||||
|
},
|
||||||
columnCreate(val) {
|
columnCreate(val) {
|
||||||
if (!this.columnAdd.find(({id}) => id == val)) {
|
if (!this.columnAdd.find(({id}) => id == val)) {
|
||||||
this.columnAdd.push({
|
this.columnAdd.push({
|
||||||
@ -254,7 +281,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.$emit("on-add")
|
this.onAdd();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addSubTask() {
|
addSubTask() {
|
||||||
@ -287,15 +314,16 @@ export default {
|
|||||||
setData(data) {
|
setData(data) {
|
||||||
this.addData = Object.assign({}, this.addData, data);
|
this.addData = Object.assign({}, this.addData, data);
|
||||||
},
|
},
|
||||||
onAdd(callback, again) {
|
onAdd(again) {
|
||||||
if (!this.addData.name) {
|
if (!this.addData.name) {
|
||||||
$A.messageError("任务描述不能为空");
|
$A.messageError("任务描述不能为空");
|
||||||
callback(false)
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.loadIng++;
|
||||||
this.$store.dispatch("taskAdd", Object.assign(this.addData, {
|
this.$store.dispatch("taskAdd", Object.assign(this.addData, {
|
||||||
project_id: this.projectId
|
project_id: this.projectId
|
||||||
})).then(({msg}) => {
|
})).then(({msg}) => {
|
||||||
|
this.loadIng--;
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
if (again === true) {
|
if (again === true) {
|
||||||
this.addData = Object.assign({}, this.addData, {
|
this.addData = Object.assign({}, this.addData, {
|
||||||
@ -316,11 +344,11 @@ export default {
|
|||||||
p_name: '',
|
p_name: '',
|
||||||
p_color: '',
|
p_color: '',
|
||||||
};
|
};
|
||||||
|
this.close()
|
||||||
}
|
}
|
||||||
callback(true)
|
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
|
this.loadIng--;
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
callback(false)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
.task-add {
|
.task-add {
|
||||||
margin-bottom: 6px;
|
|
||||||
.task-add-form,
|
.task-add-form,
|
||||||
.task-add-advanced {
|
.task-add-advanced {
|
||||||
.title {
|
.title {
|
||||||
@ -25,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.advanced-option {
|
.advanced-option {
|
||||||
margin-top: 24px;
|
margin-top: 42px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -56,7 +55,7 @@
|
|||||||
}
|
}
|
||||||
.task-add-advanced {
|
.task-add-advanced {
|
||||||
margin: -16px 0 0;
|
margin: -16px 0 0;
|
||||||
padding: 34px 32px 6px;
|
padding: 46px 32px 6px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px solid #e8e8e8;
|
border: 1px solid #e8e8e8;
|
||||||
.subtasks {
|
.subtasks {
|
||||||
@ -92,6 +91,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.ivu-modal-footer {
|
||||||
|
padding: 26px 0 22px !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.task-add-advanced-transfer {
|
.task-add-advanced-transfer {
|
||||||
.task-drop-prepend {
|
.task-drop-prepend {
|
||||||
|
11
resources/assets/sass/pages/page-manage.scss
vendored
11
resources/assets/sass/pages/page-manage.scss
vendored
@ -271,6 +271,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-manage-add-task-button-group {
|
||||||
|
margin-left: 8px !important;
|
||||||
|
.ivu-dropdown {
|
||||||
|
.ivu-btn {
|
||||||
|
min-width: auto !important;
|
||||||
|
padding: 0 4px;
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.page-manage {
|
.page-manage {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user