This commit is contained in:
chenjianan
2019-08-03 17:45:15 +08:00
5 changed files with 894 additions and 129 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>
@@ -107,7 +108,8 @@
</div>
</template>
<script>import { initProject, searchgroup, searchgroupName } from '@/api/Assembly/MakeAssemblyPlan'
<script>import { initProject, searchgroup, searchgroupName, getFileData, searchTable1, searchTable2, deletedata, editData, addData } from '@/api/Assembly/MakeAssemblyPlan'
import { ServerIP } from '@/utils/request'
// import { mapGetters } from 'vuex'
export default {
data() {
@@ -117,7 +119,8 @@ export default {
groupNumberValue: '',
groupNum: [],
tableData1: [],
tableData2: []
tableData2: [],
hadFile: []
}
},
created() {
@@ -126,58 +129,32 @@ export default {
this.initProject()
},
methods: {
getFileData(machineValue) {
this.hadFile = []
getFileData(machineValue).then(res => {
if (res.data.length > 0) {
res.data.map(item => {
this.hadFile.push({
url: `${ServerIP}${item.文件标识}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
this.groupNumberValue = ''
this.tableData2[index].任务名称 = ''
if (row.组件流水号 !== '' && row.组件流水号 !== null) {
searchgroupName(row.组件流水号).then(response => {
console.log(response.data)
console.log(row, 22222)
this.groupNumberValue = response.data[0].组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
},
// // 取消开始总装
// handleCancelStart_1(row) {
// MachineToolStateUpdate(row.机床流水号, 3).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 取消结束总装
// handleCancelEnd_1(row) {
// MachineToolStateUpdate(row.机床流水号, 4).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 取消开始调试
// handleCancelStart_2(row) {
// DebugStatusUpdate(row.机床流水号, 3).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 取消结束调试
// handleCancelEnd_2(row) {
// DebugStatusUpdate(row.机床流水号, 4).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 取消开始部装
// handleCancelStart_3(row) {
// ComponentStateUpdate(row.组件流水号, 3).then(response => {
// this.searchTable1()
// row.buttonStatus = 1
// // this.searchTable2()
// })
// },
// // 取消结束部装
// handleCancelEnd_3(row) {
// ComponentStateUpdate(row.组件流水号, 4).then(response => {
// this.searchTable1()
// row.buttonStatus = 2
// // this.searchTable2()
// })
// },
initProject() {
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
@@ -200,87 +177,75 @@ export default {
})
}
})
this.getFileData(this.machineNumberValue)
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
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, 1).then(response => {
console.log(response)
if (response.data[0].result === '1') {
this.searchTable2()
this.$message.success('增加成功')
} else {
this.$message.error('增加失败')
}
})
} else {
this.$message.warning('请选择机床')
}
},
searchTable1() {
this.tableData1 = []
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check2 = 1 } else { this.check2 = 0 }
if (this.check2 === 0) {
this.tableData1 = []
this.tableData2 = []
} else {
searchTable1(this.machineNumberValue, this.check2).then(response => {
this.tableData1 = response.data
}).then(() => {
this.searchTable2()
})
}
},
searchTable2() {
this.tableData2 = []
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) {
this.check2 = 1
searchTable2(this.machineNumberValue, 1).then(response => {
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
})
}
})
console.log(this.tableData2, 222222)
} else { this.check2 = 0 }
}
// searchTable1() {
// this.tableData1 = []
// if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check2 = 1 } else { this.check2 = 0 }
// if (this.check2 === 0) {
// this.tableData1 = []
// this.tableData2 = []
// } else {
// searchTable1(this.machineNumberValue, this.check2).then(response => {
// this.tableData1 = response.data
// }).then(() => {
// this.searchTable2()
// })
// }
// },
// searchTable2() {
// this.tableData2 = []
// if (this.machineNumberValue !== '' && this.machineNumberValue !== null) {
// this.check2 = 1
// searchTable2(this.machineNumberValue, this.check2).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)
// }
// return v
// })
// })
// } else { this.check2 = 0 }
// },
// // 总装开始装配
// handlestart_1(row) { // 弹出单据编辑
// MachineToolStateUpdate(row.机床流水号, 1).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 总装结束装配
// handleend_1(row) { // 弹出单据编辑
// MachineToolStateUpdate(row.机床流水号, 2).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 总装开始调试
// handlestart_2(row) { // 弹出单据编辑
// DebugStatusUpdate(row.机床流水号, 1).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 总装结束调试
// handleend_2(row) { // 弹出单据编辑
// DebugStatusUpdate(row.机床流水号, 2).then(response => {
// this.searchTable1()
// this.searchTable2()
// })
// },
// // 部装开始装配
// handlestart_3(row) { // 弹出单据编辑
// ComponentStateUpdate(row.组件流水号, 1).then(response => {
// this.searchTable1()
// row.buttonStatus = 2
// // this.searchTable2()
// })
// },
// // 部装结束装配
// handleend_3(row) { // 弹出单据编辑
// ComponentStateUpdate(row.组件流水号, 2).then(response => {
// this.searchTable1()
// row.buttonStatus = 3
// // this.searchTable2()
// })
// }
}
}

View File

@@ -0,0 +1,244 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1()">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
</el-row>
</el-card>
<el-card>
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action"/>
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
<div v-else class="icon"><svg-icon icon-class="file" /></div>
<a :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
</div>
</div>
</div>
</el-card>
<el-card>
<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">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床编号" align="center">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<el-button size="small" icon="el-icon-circle-plus" type="primary" style="float:left;margin: 7px 0 0 0" @click="addTable()">增加</el-button>
<el-table :data="tableData2" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="380px">
<el-table-column label="组号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-select v-model="scope.row.组件流水号" filterable clearable size="small" style="width: 100px" @change="groupChange(scope.row, scope.$index)">
<el-option
v-for="item in groupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.组号 }}
</template>
</template>
</el-table-column>
<el-table-column label="任务名称" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.任务名称" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务名称 }}
</template>
</template>
</el-table-column>
<el-table-column label="计划工时" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.计划工时" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.计划工时 }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="250px" fixed="right">
<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>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>import { initProject, searchgroup, searchgroupName, getFileData, searchTable1, searchTable2, deletedata, editData, addData } from '@/api/Assembly/MakeAssemblyPlan'
import { ServerIP } from '@/utils/request'
// import { mapGetters } from 'vuex'
export default {
data() {
return {
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNum: [],
tableData1: [],
tableData2: [],
hadFile: []
}
},
created() {
},
mounted() {
this.initProject()
},
methods: {
getFileData(machineValue) {
this.hadFile = []
getFileData(machineValue).then(res => {
if (res.data.length > 0) {
res.data.map(item => {
this.hadFile.push({
url: `${ServerIP}${item.文件标识}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
searchgroupName(row.组件流水号).then(response => {
this.groupNumberValue = row.组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
},
initProject() {
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNum = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
if (response.data[0].response === 1) {
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
},
deleteData(row) {
this.deleteRow(deletedata, row.计划流水号, function() { this.searchTable2() })
},
addTable() {
if (this.machineNumberValue !== '') {
addData(this.machineNumberValue, 3).then(response => {
if (response.data[0].response === 1) {
this.searchTable2()
this.$message.success('增加成功')
} else {
this.$message.error('增加失败')
}
})
} else {
this.$message.warning('请选择机床')
}
},
searchTable1() {
this.tableData1 = []
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check2 = 1 } else { this.check2 = 0 }
if (this.check2 === 0) {
this.tableData1 = []
this.tableData2 = []
} else {
searchTable1(this.machineNumberValue, this.check2).then(response => {
this.tableData1 = response.data
}).then(() => {
this.searchTable2()
})
}
},
searchTable2() {
this.tableData2 = []
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)
}
return v
})
})
} else { this.check2 = 0 }
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,244 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1()">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
</el-row>
</el-card>
<el-card>
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action"/>
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
<div v-else class="icon"><svg-icon icon-class="file" /></div>
<a :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
</div>
</div>
</div>
</el-card>
<el-card>
<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">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床编号" align="center">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<el-button size="small" icon="el-icon-circle-plus" type="primary" style="float:left;margin: 7px 0 0 0" @click="addTable()">增加</el-button>
<el-table :data="tableData2" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="380px">
<el-table-column label="组号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-select v-model="scope.row.组件流水号" filterable clearable size="small" style="width: 100px" @change="groupChange(scope.row, scope.$index)">
<el-option
v-for="item in groupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.组号 }}
</template>
</template>
</el-table-column>
<el-table-column label="任务名称" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.任务名称" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务名称 }}
</template>
</template>
</el-table-column>
<el-table-column label="计划工时" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.计划工时" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.计划工时 }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="250px" fixed="right">
<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>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>import { initProject, searchgroup, searchgroupName, getFileData, searchTable1, searchTable2, deletedata, editData, addData } from '@/api/Assembly/MakeAssemblyPlan'
import { ServerIP } from '@/utils/request'
// import { mapGetters } from 'vuex'
export default {
data() {
return {
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNum: [],
tableData1: [],
tableData2: [],
hadFile: []
}
},
created() {
},
mounted() {
this.initProject()
},
methods: {
getFileData(machineValue) {
this.hadFile = []
getFileData(machineValue).then(res => {
if (res.data.length > 0) {
res.data.map(item => {
this.hadFile.push({
url: `${ServerIP}${item.文件标识}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
searchgroupName(row.组件流水号).then(response => {
this.groupNumberValue = row.组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
},
initProject() {
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNum = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
if (response.data[0].response === 1) {
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
},
deleteData(row) {
this.deleteRow(deletedata, row.计划流水号, function() { this.searchTable2() })
},
addTable() {
if (this.machineNumberValue !== '') {
addData(this.machineNumberValue, 2).then(response => {
if (response.data[0].response === 1) {
this.searchTable2()
this.$message.success('增加成功')
} else {
this.$message.error('增加失败')
}
})
} else {
this.$message.warning('请选择机床')
}
},
searchTable1() {
this.tableData1 = []
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check2 = 1 } else { this.check2 = 0 }
if (this.check2 === 0) {
this.tableData1 = []
this.tableData2 = []
} else {
searchTable1(this.machineNumberValue, this.check2).then(response => {
this.tableData1 = response.data
}).then(() => {
this.searchTable2()
})
}
},
searchTable2() {
this.tableData2 = []
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)
}
return v
})
})
} else { this.check2 = 0 }
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,244 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable1()">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
</el-row>
</el-card>
<el-card>
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action"/>
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
<div v-else class="icon"><svg-icon icon-class="file" /></div>
<a :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
</div>
</div>
</div>
</el-card>
<el-card>
<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">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床编号" align="center">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<el-button size="small" icon="el-icon-circle-plus" type="primary" style="float:left;margin: 7px 0 0 0" @click="addTable()">增加</el-button>
<el-table :data="tableData2" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="380px">
<el-table-column label="组号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-select v-model="scope.row.组件流水号" filterable clearable size="small" style="width: 100px" @change="groupChange(scope.row, scope.$index)">
<el-option
v-for="item in groupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.组号 }}
</template>
</template>
</el-table-column>
<el-table-column label="任务名称" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.任务名称" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务名称 }}
</template>
</template>
</el-table-column>
<el-table-column label="计划工时" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.计划工时" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.计划工时 }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="250px" fixed="right">
<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>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>import { initProject, searchgroup, searchgroupName, getFileData, searchTable1, searchTable2, deletedata, editData, addData } from '@/api/Assembly/MakeAssemblyPlan'
import { ServerIP } from '@/utils/request'
// import { mapGetters } from 'vuex'
export default {
data() {
return {
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNum: [],
tableData1: [],
tableData2: [],
hadFile: []
}
},
created() {
},
mounted() {
this.initProject()
},
methods: {
getFileData(machineValue) {
this.hadFile = []
getFileData(machineValue).then(res => {
if (res.data.length > 0) {
res.data.map(item => {
this.hadFile.push({
url: `${ServerIP}${item.文件标识}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
searchgroupName(row.组件流水号).then(response => {
this.groupNumberValue = row.组号
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
},
initProject() {
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNum = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
confirmEdit(row) {
editData(row.计划流水号, row.组件流水号, this.groupNumberValue, row.任务名称, row.计划工时).then(response => {
if (response.data[0].response === 1) {
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
},
deleteData(row) {
this.deleteRow(deletedata, row.计划流水号, function() { this.searchTable2() })
},
addTable() {
if (this.machineNumberValue !== '') {
addData(this.machineNumberValue, 4).then(response => {
if (response.data[0].response === 1) {
this.searchTable2()
this.$message.success('增加成功')
} else {
this.$message.error('增加失败')
}
})
} else {
this.$message.warning('请选择机床')
}
},
searchTable1() {
this.tableData1 = []
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check2 = 1 } else { this.check2 = 0 }
if (this.check2 === 0) {
this.tableData1 = []
this.tableData2 = []
} else {
searchTable1(this.machineNumberValue, this.check2).then(response => {
this.tableData1 = response.data
}).then(() => {
this.searchTable2()
})
}
},
searchTable2() {
this.tableData2 = []
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)
}
return v
})
})
} else { this.check2 = 0 }
}
}
}
</script>
<style scoped>
</style>