|
|
|
@ -21,22 +21,34 @@
|
|
|
|
|
label="工序"
|
|
|
|
|
width="180"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.process" placeholder="请输入内容"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
prop="procedure"
|
|
|
|
|
label="步骤"
|
|
|
|
|
width="180"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.procedure" placeholder="请输入内容"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
prop="staff"
|
|
|
|
|
label="人员"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.staff" placeholder="请输入内容"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
prop="time"
|
|
|
|
|
label="时间"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.time" placeholder="请输入内容"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
@ -48,35 +60,42 @@ let id = 0
|
|
|
|
|
let deepSearch = (arr, target) => {
|
|
|
|
|
let results = []
|
|
|
|
|
arr.forEach(element => {
|
|
|
|
|
id = Math.max(id,element.id)
|
|
|
|
|
if (Array.isArray(element.children)) {
|
|
|
|
|
results = results.concat(deepSearch(element.children, target))
|
|
|
|
|
} else if (element.id === target) {
|
|
|
|
|
console.log(element)
|
|
|
|
|
id = Math.max(id, element.id)
|
|
|
|
|
if (element.id === target) {
|
|
|
|
|
results.push(element)
|
|
|
|
|
} else if (Array.isArray(element.children)) {
|
|
|
|
|
results = results.concat(deepSearch(element.children, target))
|
|
|
|
|
}
|
|
|
|
|
// if (Array.isArray(element.children)) {
|
|
|
|
|
// results = results.concat(deepSearch(element.children, target))
|
|
|
|
|
// } else if (element.id === target) {
|
|
|
|
|
// results.push(element)
|
|
|
|
|
// }
|
|
|
|
|
})
|
|
|
|
|
return results
|
|
|
|
|
return results
|
|
|
|
|
}
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Demo',
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
show: true,
|
|
|
|
|
id:0,
|
|
|
|
|
tableData: [
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
process: 1,
|
|
|
|
|
procedure: '2016-05-02',
|
|
|
|
|
staff: '王小虎',
|
|
|
|
|
time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
process: 1,
|
|
|
|
|
procedure: '2016-05-02',
|
|
|
|
|
staff: '王小虎',
|
|
|
|
|
time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// id: 1,
|
|
|
|
|
// process: 1,
|
|
|
|
|
// procedure: '2016-05-02',
|
|
|
|
|
// staff: '王小虎',
|
|
|
|
|
// time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// id: 2,
|
|
|
|
|
// process: 1,
|
|
|
|
|
// procedure: '2016-05-02',
|
|
|
|
|
// staff: '王小虎',
|
|
|
|
|
// time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
id: 3,
|
|
|
|
|
process: 1,
|
|
|
|
@ -92,56 +111,53 @@ export default {
|
|
|
|
|
time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 5,
|
|
|
|
|
process: 1,
|
|
|
|
|
procedure: '2016-05-02',
|
|
|
|
|
staff: '王小虎',
|
|
|
|
|
time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
}
|
|
|
|
|
// {
|
|
|
|
|
// id: 5,
|
|
|
|
|
// process: 1,
|
|
|
|
|
// procedure: '2016-05-02',
|
|
|
|
|
// staff: '王小虎',
|
|
|
|
|
// time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
// }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getId(this.tableData)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getId(arr) {
|
|
|
|
|
arr.forEach(element => {
|
|
|
|
|
this.id = Math.max(this.id, element.id)
|
|
|
|
|
if (Array.isArray(element.children)) {
|
|
|
|
|
this.getId(element.children)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
add(e) {
|
|
|
|
|
let data = deepSearch(this.tableData, e.row.id)?.[0]
|
|
|
|
|
if (Array.isArray(data.children)) {
|
|
|
|
|
this.$set(data.children, data.children.length, {
|
|
|
|
|
id: id+1,
|
|
|
|
|
process: 1,
|
|
|
|
|
procedure: '2016-05-02',
|
|
|
|
|
staff: '王小虎',
|
|
|
|
|
time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
id: this.id + 1,
|
|
|
|
|
process: null,
|
|
|
|
|
procedure: null,
|
|
|
|
|
staff: null,
|
|
|
|
|
time: null
|
|
|
|
|
})
|
|
|
|
|
// data.children.push(
|
|
|
|
|
// )
|
|
|
|
|
} else {
|
|
|
|
|
this.$set(data, 'children', [
|
|
|
|
|
{
|
|
|
|
|
id: id+1,
|
|
|
|
|
process: 1,
|
|
|
|
|
procedure: '2016-05-02',
|
|
|
|
|
staff: '王小虎',
|
|
|
|
|
time: '上海市普陀区金沙江路 1518 弄'
|
|
|
|
|
id: this.id + 1,
|
|
|
|
|
process: null,
|
|
|
|
|
procedure: null,
|
|
|
|
|
staff: null,
|
|
|
|
|
time: null
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
// console.log(e)
|
|
|
|
|
// e.row = {}
|
|
|
|
|
// this.$set(e,'row',[
|
|
|
|
|
// {
|
|
|
|
|
// id: 6,
|
|
|
|
|
// process: 1,
|
|
|
|
|
// procedure: '2016-05-02',
|
|
|
|
|
// staff: '王小虎',
|
|
|
|
|
// time: '上海市普陀区金沙江路 1512138 弄'
|
|
|
|
|
// },
|
|
|
|
|
// ])
|
|
|
|
|
console.log(data)
|
|
|
|
|
console.log(this.tableData)
|
|
|
|
|
this.show = false
|
|
|
|
|
this.show = true
|
|
|
|
|
this.id += 1
|
|
|
|
|
// this.show = false
|
|
|
|
|
// this.show = true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
metaInfo() {
|
|
|
|
|