+ @on-keydown="onKeydown"/>
- {{$L('添加任务')}}
+ {{$L('添加' + typeName)}}
@@ -37,11 +75,17 @@ import {mapState} from "vuex";
export default {
name: "TaskAddSimple",
props: {
+ parentId: {
+ type: Number,
+ default: 0
+ },
projectId: {
- default: ''
+ type: Number,
+ default: 0
},
columnId: {
- default: ''
+ type: Number,
+ default: 0
},
addTop: {
type: Boolean,
@@ -50,6 +94,10 @@ export default {
autoActive: {
type: Boolean,
default: false
+ },
+ rowMode: {
+ type: Boolean,
+ default: false
}
},
data() {
@@ -77,7 +125,11 @@ export default {
},
computed: {
- ...mapState(['userId', 'taskPriority']),
+ ...mapState(['userId', 'taskPriority', 'projectDetail']),
+
+ typeName() {
+ return (this.parentId > 0 ? '子任务' : '任务');
+ }
},
watch: {
@@ -96,11 +148,18 @@ export default {
methods: {
getData() {
- this.addData.project_id = this.projectId;
- this.addData.column_id = this.columnId;
- this.addData.owner = [this.userId];
- this.addData.top = this.addTop ? 1 : 0;
- return $A.cloneJSON(this.addData);
+ if (this.parentId > 0) {
+ return {
+ task_id: this.parentId,
+ name: this.addData.name,
+ }
+ } else {
+ this.addData.project_id = this.projectId || this.projectDetail.id;
+ this.addData.column_id = this.columnId || '';
+ this.addData.owner = [this.userId];
+ this.addData.top = this.addTop ? 1 : 0;
+ return $A.cloneJSON(this.addData);
+ }
},
openAdd() {
@@ -141,7 +200,8 @@ export default {
return;
}
this.loadIng++;
- this.$store.dispatch("taskAdd", this.getData()).then(({msg}) => {
+ let type = this.parentId > 0 ? 'taskAddSub' : 'taskAdd';
+ this.$store.dispatch(type, this.getData()).then(({msg}) => {
$A.messageSuccess(msg);
this.loadIng--;
this.active = false;
@@ -167,7 +227,9 @@ export default {
this.$set(this.addData, 'p_level', item.priority)
this.$set(this.addData, 'p_name', item.name)
this.$set(this.addData, 'p_color', item.color)
- this.$refs.input.focus()
+ this.$nextTick(() => {
+ this.$refs.input.focus();
+ });
},
defaultPriority() {
diff --git a/resources/assets/js/pages/manage/components/TaskRow.vue b/resources/assets/js/pages/manage/components/TaskRow.vue
index dd37ffcb..20fa3a92 100644
--- a/resources/assets/js/pages/manage/components/TaskRow.vue
+++ b/resources/assets/js/pages/manage/components/TaskRow.vue
@@ -5,19 +5,18 @@
-
-
+