Explorar o código

Merge branch 'fix' into dev

hkshu12 %!s(int64=5) %!d(string=hai) anos
pai
achega
55f6b55ed0

+ 9 - 9
mock/routers/tree.js

@@ -32,7 +32,7 @@ router.get('/node/type/task/:projectId', (req, res) => {
         endTime: Random.datetime(),
         'id|+1': 1,
         leaf: false,
-        parent: null,
+        parentId: null,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
         processorName: 'Jinyao',
@@ -72,7 +72,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 1,
       leaf: false,
-      parent: null,
+      parentId: null,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -98,7 +98,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 2,
       leaf: false,
-      parent: 1,
+      parentId: 1,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -124,7 +124,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 3,
       leaf: false,
-      parent: 1,
+      parentId: 1,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -150,7 +150,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 4,
       leaf: false,
-      parent: 3,
+      parentId: 3,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -176,7 +176,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 5,
       leaf: false,
-      parent: 3,
+      parentId: 3,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -202,7 +202,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 6,
       leaf: false,
-      parent: 5,
+      parentId: 5,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -229,7 +229,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 7,
       leaf: false,
-      parent: 5,
+      parentId: 5,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',
@@ -255,7 +255,7 @@ router.get('/:projectId', (req, res) => {
       endTime: Random.datetime(),
       id: 8,
       leaf: false,
-      parent: 5,
+      parentId: 5,
       'priority|1': ['紧急', '一般', '宽松'],
       processorId: 101,
       processorName: 'Jinyao',

+ 1 - 1
src/components/CommonDrawer.vue

@@ -208,7 +208,7 @@ export default {
     startTime: String,
     endTime: String,
     childs: Array,
-    parent: Number,
+    parentId: Number,
     commits: Array,
     showSons: {
       type: Boolean,

+ 12 - 3
src/components/RequirementDrawer.vue

@@ -100,7 +100,7 @@
                       <el-tag>{{processorName}}</el-tag>
                     </div>
                     <div v-else>
-                      <el-select style="width: 160px" size="mini" v-model="editedRequirement.userId" >
+                      <el-select style="width: 160px" size="mini" v-model="editedRequirement.processorId" >
                         <el-option
                           v-for="item in  userOptions"
                           :key="item.value"
@@ -208,7 +208,7 @@ export default {
     startTime: String,
     endTime: String,
     childs: Array,
-    parent: Number,
+    parentId: Number,
     commits: Array,
     showSons: {
       type: Boolean,
@@ -253,10 +253,19 @@ export default {
       this.editedRequirement.processorName = this.processorName;
     },
     submitEdit() {
-      const param = { id: this.id, ...this.editedRequirement };
+      const param = {
+        id: this.id,
+        title: this.editedRequirement.title,
+        description: this.editedRequirement.description,
+        state: this.editedRequirement.state,
+        timeToTake: this.editedRequirement.timeToTake,
+        priority: this.editedRequirement.priority,
+        processorId: this.editedRequirement.processorId,
+      };
       RequirementAPI.updateTreeNode(param).then((res) => {
         this.isEditing = false;
         this.$emit('requirement-update');
+        this.showDrawer = false;
       });
     },
     cancelEdit() {

+ 4 - 4
src/components/Tree.vue

@@ -72,7 +72,7 @@ export default {
         } else {
           console.warn('需求树数据有误,树高度错误');
         }
-        if (!item.parent) rootNode = item;
+        if (!item.parentId) rootNode = item;
         // if (item.parent) {
         //   const tempParent = nodeMap.get(item.parent);
         //   if (!tempParent.childs) {
@@ -98,7 +98,7 @@ export default {
       for (let i = 1; i < TREE_MAX_HEIGHT; i += 1) {
         let sum = 0;
         colList[i].forEach((item) => {
-          item.positionY = nodeMap.get(item.parent).positionY + sum;
+          item.positionY = nodeMap.get(item.parentId).positionY + sum;
           sum += item.contentHeight;
         });
       }
@@ -161,7 +161,7 @@ export default {
     },
     addChild(id) {
       this.$emit('change', {
-        type: 'addChild',
+        type: 'addChildNode',
         id,
       });
     },
@@ -172,7 +172,7 @@ export default {
         type: 'warning',
       }).then(() => {
         this.$emit('change', {
-          type: 'deleteNode',
+          type: 'deleteTreeNode',
           id,
         });
       }).catch(() => {

+ 1 - 1
src/components/TreeNode.vue

@@ -43,7 +43,7 @@ export default {
     containerStyle() {
       return {
         top: `${this.positionY * 130}px`,
-        left: `${280 * this.positionX}px`,
+        left: `${280 * this.positionX - 100}px`,
         width: `${this.nodeStyle.width + this.nodeStyle.padding * 2}px`,
         height: `${this.nodeStyle.height + this.nodeStyle.padding * 2}px`,
       };

+ 2 - 2
src/typings/project.d.ts

@@ -18,10 +18,10 @@ declare interface TreeNode {
   id: number;
   leaf?: boolean;
   parentId?: number;
-  priority?: number;
+  priority?: RecordPriority;
   projectId?: number;
   startTime?: string;
-  state?: TreeNodeState;
+  state?: RecordState;
   timeToTake?: number;
   title?: string;
   type?: TreeNodeType;

+ 2 - 2
src/views/Project/Schedule.vue

@@ -49,8 +49,8 @@ export default {
       const nodeMap = new Map();
       array.forEach((item) => nodeMap.set(item.id, item));
       array.forEach((item) => {
-        if (item.parent) {
-          const tempParent = nodeMap.get(item.parent);
+        if (item.parentId) {
+          const tempParent = nodeMap.get(item.parentId);
           if (!tempParent.childs) {
             tempParent.childs = [];
           }