This commit is contained in:
liushuai
2019-08-03 17:56:04 +08:00
parent 9fca6ce1c3
commit 3e99728b53
3 changed files with 93 additions and 57 deletions

View File

@@ -3,7 +3,7 @@
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1()">
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1();machineChange()">
<el-option
v-for="item in machineNumber"
:key="item.value"
@@ -32,6 +32,7 @@
</div>
</el-card>
<el-card>
<h3 style="text-align: center;">机床信息</h3>
<el-table :data="tableData1" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="200px">
<el-table-column label="项目名称" align="center">
<template slot-scope="scope">
@@ -98,8 +99,8 @@
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-else type="primary" size="small" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
<el-button type="delete" size="small" @click="deleteData">删除</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="cancel(scope.row)">取消</el-button>
<el-button type="danger" size="small" @click="deleteData(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -144,9 +145,12 @@ export default {
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
this.groupNumberValue = ''
this.tableData2[index].任务名称 = ''
if (row.组件流水号 !== '' && row.组件流水号 !== null) {
searchgroupName(row.组件流水号).then(response => {
this.groupNumberValue = row.组号
console.log(row, 22222)
this.groupNumberValue = response.data[0].组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
@@ -173,23 +177,32 @@ export default {
})
}
})
this.getFileData(this.machineNumberValue)
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
if (response.data[0].response === 1) {
if (response.data[0].result === '1') {
row.edit = false
this.searchTable2()
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
},
cancel(row) {
row.edit = !row.edit
this.searchTable2()
},
deleteData(row) {
console.log(row.计划流水号)
this.deleteRow(deletedata, row.计划流水号, function() { this.searchTable2() })
},
addTable() {
if (this.machineNumberValue !== '') {
addData(this.machineNumberValue, 3).then(response => {
if (response.data[0].response === 1) {
console.log(response)
if (response.data[0].result === '1') {
this.searchTable2()
this.$message.success('增加成功')
} else {
@@ -219,19 +232,18 @@ export default {
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) {
this.check2 = 1
searchTable2(this.machineNumberValue, 3).then(response => {
console.log(response.data, 111)
this.tableData2 = response.data
this.tableData2.map(v => {
if (v.是否工作 === null || v.是否工作 === 0) {
this.$set(v, 'buttonStatus', 1)
} else if (v.是否工作 === 1) {
this.$set(v, 'buttonStatus', 2)
} else {
this.$set(v, 'buttonStatus', 3)
for (let i = 0; i < response.data.length; i++) {
this.tableData2.push({
计划流水号: response.data[i].计划流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
计划工时: response.data[i].计划工时,
edit: false
})
}
return v
})
})
console.log(this.tableData2, 222222)
} else { this.check2 = 0 }
}
}

View File

@@ -3,7 +3,7 @@
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1()">
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1();machineChange()">
<el-option
v-for="item in machineNumber"
:key="item.value"
@@ -32,6 +32,7 @@
</div>
</el-card>
<el-card>
<h3 style="text-align: center;">机床信息</h3>
<el-table :data="tableData1" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="200px">
<el-table-column label="项目名称" align="center">
<template slot-scope="scope">
@@ -98,8 +99,8 @@
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-else type="primary" size="small" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
<el-button type="delete" size="small" @click="deleteData">删除</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="cancel(scope.row)">取消</el-button>
<el-button type="danger" size="small" @click="deleteData(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -144,9 +145,12 @@ export default {
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
this.groupNumberValue = ''
this.tableData2[index].任务名称 = ''
if (row.组件流水号 !== '' && row.组件流水号 !== null) {
searchgroupName(row.组件流水号).then(response => {
this.groupNumberValue = row.组号
console.log(row, 22222)
this.groupNumberValue = response.data[0].组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
@@ -173,23 +177,32 @@ export default {
})
}
})
this.getFileData(this.machineNumberValue)
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
if (response.data[0].response === 1) {
if (response.data[0].result === '1') {
row.edit = false
this.searchTable2()
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
},
cancel(row) {
row.edit = !row.edit
this.searchTable2()
},
deleteData(row) {
console.log(row.计划流水号)
this.deleteRow(deletedata, row.计划流水号, function() { this.searchTable2() })
},
addTable() {
if (this.machineNumberValue !== '') {
addData(this.machineNumberValue, 2).then(response => {
if (response.data[0].response === 1) {
console.log(response)
if (response.data[0].result === '1') {
this.searchTable2()
this.$message.success('增加成功')
} else {
@@ -219,19 +232,18 @@ export default {
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) {
this.check2 = 1
searchTable2(this.machineNumberValue, 2).then(response => {
console.log(response.data, 111)
this.tableData2 = response.data
this.tableData2.map(v => {
if (v.是否工作 === null || v.是否工作 === 0) {
this.$set(v, 'buttonStatus', 1)
} else if (v.是否工作 === 1) {
this.$set(v, 'buttonStatus', 2)
} else {
this.$set(v, 'buttonStatus', 3)
for (let i = 0; i < response.data.length; i++) {
this.tableData2.push({
计划流水号: response.data[i].计划流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
计划工时: response.data[i].计划工时,
edit: false
})
}
return v
})
})
console.log(this.tableData2, 222222)
} else { this.check2 = 0 }
}
}

View File

@@ -3,7 +3,7 @@
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1()">
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1();machineChange()">
<el-option
v-for="item in machineNumber"
:key="item.value"
@@ -32,6 +32,7 @@
</div>
</el-card>
<el-card>
<h3 style="text-align: center;">机床信息</h3>
<el-table :data="tableData1" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="200px">
<el-table-column label="项目名称" align="center">
<template slot-scope="scope">
@@ -98,8 +99,8 @@
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-else type="primary" size="small" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
<el-button type="delete" size="small" @click="deleteData">删除</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="cancel(scope.row)">取消</el-button>
<el-button type="danger" size="small" @click="deleteData(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -144,9 +145,12 @@ export default {
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
this.groupNumberValue = ''
this.tableData2[index].任务名称 = ''
if (row.组件流水号 !== '' && row.组件流水号 !== null) {
searchgroupName(row.组件流水号).then(response => {
this.groupNumberValue = row.组号
console.log(row, 22222)
this.groupNumberValue = response.data[0].组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
@@ -173,23 +177,32 @@ export default {
})
}
})
this.getFileData(this.machineNumberValue)
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
if (response.data[0].response === 1) {
if (response.data[0].result === '1') {
row.edit = false
this.searchTable2()
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
},
cancel(row) {
row.edit = !row.edit
this.searchTable2()
},
deleteData(row) {
console.log(row.计划流水号)
this.deleteRow(deletedata, row.计划流水号, function() { this.searchTable2() })
},
addTable() {
if (this.machineNumberValue !== '') {
addData(this.machineNumberValue, 4).then(response => {
if (response.data[0].response === 1) {
console.log(response)
if (response.data[0].result === '1') {
this.searchTable2()
this.$message.success('增加成功')
} else {
@@ -219,19 +232,18 @@ export default {
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) {
this.check2 = 1
searchTable2(this.machineNumberValue, 4).then(response => {
console.log(response.data, 111)
this.tableData2 = response.data
this.tableData2.map(v => {
if (v.是否工作 === null || v.是否工作 === 0) {
this.$set(v, 'buttonStatus', 1)
} else if (v.是否工作 === 1) {
this.$set(v, 'buttonStatus', 2)
} else {
this.$set(v, 'buttonStatus', 3)
for (let i = 0; i < response.data.length; i++) {
this.tableData2.push({
计划流水号: response.data[i].计划流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
计划工时: response.data[i].计划工时,
edit: false
})
}
return v
})
})
console.log(this.tableData2, 222222)
} else { this.check2 = 0 }
}
}