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

View File

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

View File

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