|
|
@@ -80,50 +80,50 @@ class Contract {
|
|
|
}
|
|
|
|
|
|
// 增加行
|
|
|
- @action addRowTree(id: string) {
|
|
|
- const newTree = lookupNode(id, this.tree)
|
|
|
- this.tree = newTree
|
|
|
- }
|
|
|
+ // @action addRowTree(id: string) {
|
|
|
+ // const newTree = lookupNode(id, this.tree)
|
|
|
+ // this.tree = newTree
|
|
|
+ // }
|
|
|
|
|
|
// 行点击
|
|
|
- @action rowChange(id: string) {
|
|
|
- const newTree = nodeCheck(id, this.tree)
|
|
|
- this.tree = newTree
|
|
|
- }
|
|
|
+ // @action rowChange(id: string) {
|
|
|
+ // const newTree = nodeCheck(id, this.tree)
|
|
|
+ // this.tree = newTree
|
|
|
+ // }
|
|
|
@computed get showTable() {
|
|
|
return this.tree && this.tree.length > 1
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export function lookupNode(id: string, tree: ContractTree[]) {
|
|
|
- return tree.map((item:ContractTree) => {
|
|
|
- item.isEdit = false
|
|
|
- if (item.id === id) {
|
|
|
- if (Array.isArray(item.children)) {
|
|
|
- item.children.push({ ...initData[0], isNew: true, code: item.code + `-${item.children.length + 1 }`, parentId: item.id, bidsectionId: item.bidsectionId, attribution: item.code + '-', serial: 1, children: [] })
|
|
|
- } else {
|
|
|
- item.children = [ { ...initData[0], isNew: true, code: item.code + '-1', parentId: item.id, bidsectionId: item.bidsectionId, attribution: item.code + '-', serial: 1, children: [] } ]
|
|
|
- }
|
|
|
- return item
|
|
|
- } else if(item.children && item.children.length) {
|
|
|
- item.children = lookupNode(id, item.children)
|
|
|
- }
|
|
|
- return item
|
|
|
- })
|
|
|
-}
|
|
|
+// export function lookupNode(id: string, tree: ContractTree[]) {
|
|
|
+// return tree.map((item:ContractTree) => {
|
|
|
+// item.isEdit = false
|
|
|
+// if (item.id === id) {
|
|
|
+// if (Array.isArray(item.children)) {
|
|
|
+// item.children.push({ ...initData[0], isNew: true, code: item.code + `-${item.children.length + 1 }`, parentId: item.id, bidsectionId: item.bidsectionId, attribution: item.code + '-', serial: 1, children: [] })
|
|
|
+// } else {
|
|
|
+// item.children = [ { ...initData[0], isNew: true, code: item.code + '-1', parentId: item.id, bidsectionId: item.bidsectionId, attribution: item.code + '-', serial: 1, children: [] } ]
|
|
|
+// }
|
|
|
+// return item
|
|
|
+// } else if(item.children && item.children.length) {
|
|
|
+// item.children = lookupNode(id, item.children)
|
|
|
+// }
|
|
|
+// return item
|
|
|
+// })
|
|
|
+// }
|
|
|
|
|
|
// 项目节被选中更改isEdit的值
|
|
|
-export function nodeCheck(id: string, tree: ContractTree[]) {
|
|
|
- return tree.map((item: ContractTree) => {
|
|
|
- item.isEdit = false
|
|
|
- if (item.id === id) {
|
|
|
- item.isEdit = true
|
|
|
+// export function nodeCheck(id: string, tree: ContractTree[]) {
|
|
|
+// return tree.map((item: ContractTree) => {
|
|
|
+// item.isEdit = false
|
|
|
+// if (item.id === id) {
|
|
|
+// item.isEdit = true
|
|
|
|
|
|
- } else if(Array.isArray(item.children)) {
|
|
|
- item.children = nodeCheck(id, item.children)
|
|
|
- }
|
|
|
- return item
|
|
|
- })
|
|
|
-}
|
|
|
+// } else if(Array.isArray(item.children)) {
|
|
|
+// item.children = nodeCheck(id, item.children)
|
|
|
+// }
|
|
|
+// return item
|
|
|
+// })
|
|
|
+// }
|
|
|
|
|
|
export default new Contract()
|