修改3d模型

master
夜笙歌 4 months ago
parent f1c5b4f5c4
commit 20278d28e9

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

Loading…
Cancel
Save