This commit is contained in:
liushuai
2020-06-08 17:57:49 +08:00
parent 6966adb952
commit fa5f12d664
16 changed files with 679 additions and 87 deletions

View File

@@ -0,0 +1,347 @@
<template>
<div class="app-container">
<el-card style="width: 91%">
<el-row style="margin-top: 10px; margin-bottom: 10px">
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable()">
<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>
<span>机床数量{{ machineNum }}</span>
<el-button size="small" icon="el-icon-circle-plus-outline" type="distribution" style="margin-left: 300px" @click="addTaskName()">增加装配任务</el-button>
<el-button type="danger" plain size="small" icon="el-icon-delete" style="margin-left: 300px" @click="deleteData()">删除</el-button>
</el-row>
</el-card>
<el-card style="width: 52%; float: left">
<el-table v-loading="loading" :data="tableData" border stripe size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="720px">
<el-table-column label="机床组号" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.机床组号 }}
</template>
</el-table-column>
<el-table-column label="部件名称" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.部件名称 }}
</template>
</el-table-column>
<el-table-column label="部件数" align="center" width="65px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.部件数 }}
</template>
</el-table-column>
<!--<el-table-column label="总数量" align="center" width="65px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.机床数量 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column label="自制件入库" align="center" width="95px">
<template slot-scope="scope">
{{ scope.row.自制件入库率 }}
</template>
</el-table-column>
<el-table-column label="外购件入库" align="center" width="95px">
<template slot-scope="scope">
{{ scope.row.外购件入库率 }}
</template>
</el-table-column>
<el-table-column label="成组配套" align="center" width="90px">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openDialog(scope.row)">查看详情</el-button>
</template>
</el-table-column>
<el-table-column label="分配时间" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.分配时间 ? scope.row.分配时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="90px">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openPeople(scope.row)">分配</el-button>
<el-button type="text" icon="el-icon-delete" size="mini" @click="deleteData(scope.row)"/>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card style="width: 38%; float: left">
<el-table :data="tableData2" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="720px">
<el-table-column label="状态" align="center" width="90px">
<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" width="120px">
<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="70px" prop="计划工时">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.计划工时" size="mini" style="width: 100%" props="" @input="filterNuber(scope.row.计划工时, scope.$index, '计划工时')"/>
</template>
<template v-else>
{{ scope.row.计划工时 }}
</template>
</template>
</el-table-column>
<el-table-column label="装配开始" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="装配暂停" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="装配结束" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogFormVisible"
title="零件完成情况"
width="40%">
<div style="margin: 10px 0 0 20px;height: 650px;overflow: auto">
<el-tree
:data="departmentData"
:indent="50"
:expand-on-click-node="false"
:render-content="renderContent"
node-key="机床流水号"
class="selectTree"/>
</div>
</el-dialog>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogFormVisible1"
title="装配任务"
center
width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="120px">
<el-form-item label="任务名称" prop="任务名称">
<el-input v-model="form.任务名称" size="small" style="width: 150px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
:disabled="addPurchaseOrder_disable"
type="primary"
size="small"
icon="el-icon-check"
@click="submitTaskName">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>import { initProject, searchTable, getMachineNames, selectParts, addData, deletedata } from '@/api/Assembly/AssemblyTaskAssignment'
// import { mapGetters } from 'vuex'
export default {
data() {
return {
machineNumberValue: '',
machineNumber: [],
machineNum: '',
dialogFormVisible: false,
dialogFormVisible1: false,
groupNumberValue: '',
groupNum: [],
loading: false,
tableData: [],
tableData2: [],
hadFile: [],
option: [],
plan: '',
addPurchaseOrder_disable: false,
form: {
任务名称: ''
},
rules: {
任务名称: [{ required: true, message: '请填写任务名称' }]
},
departmentData: [] // 树状数据
}
},
// created() {
// this.searchTable1()
// },
mounted() {
this.initProject()
},
methods: {
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].机床流水号
})
}
})
},
searchTable() {
this.loading = true
getMachineNames(this.machineNumberValue).then(response => {
this.machineNum = response.data[0].机床数量
})
searchTable(this.machineNumberValue).then(response => {
this.tableData = response.data
}).then(() => {
this.loading = false
})
},
renderContent(h, { node, data, store }) {
console.log(node, 11111)
if (node.data.零件类型 === 1) { // 自制
if (parseInt(node.data.考核状态) > 6) {
return (<span class='treeNotesComplate'>{node.label}</span>)
} else {
return (<span class='treeNotesUnComplate'>{node.label}</span>)
}
} else { // 外购
if (node.data.采购状态 === '已完成') {
return (<span class='treeNotesComplate'>{node.label}</span>)
} else {
return (<span class='treeNotesUnComplate'>{node.label}</span>)
}
}
},
openDialog(row) {
this.dialogFormVisible = true
this.departmentData = []
selectParts(1, row.组件流水号, 0, 0).then(response => {
for (let j = 0; j < response.data.length; j++) {
this.departmentData.push({
label: (response.data[j].零件图号 ? response.data[j].零件图号 : '无零件图号') + '\xa0\xa0\xa0\xa0\xa0\xa0' + (response.data[j].规格 ? response.data[j].规格 : '') + '\xa0\xa0\xa0\xa0\xa0\xa0' + (response.data[j].投产总数量 ? response.data[j].投产总数量 : '') + '..........' + (response.data[j].零件名称 ? response.data[j].零件名称 : '无零件名称') + (response.data[j].零件类型 === 1 ? '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0自制' + response.data[j].考核状态名称 : (response.data[j].零件类型 === 2 ? '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0制造采购' : '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0外购' + response.data[j].采购状态)),
value: response.data[j].工艺计划流水号,
考核状态: response.data[j].考核状态,
采购状态: response.data[j].采购状态,
零件类型: response.data[j].零件类型
})
}
})
},
openPeople(row) {},
addTaskName() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.任务名称 = ''
this.addPurchaseOrder_disable = false
this.dialogFormVisible1 = true
},
submitTaskName() {
if (this.machineNumberValue) {
this.$refs['form'].validate((valid) => {
if (valid) {
this.addPurchaseOrder_disable = true
addData(this.machineNumberValue, this.form.任务名称, 1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('新建装配任务成功')
this.searchTable()
this.dialogFormVisible1 = false
} else { this.$message.error('新建装配任务失败') }
})
} else {
return false
}
})
} else {
this.$message.warning('请先选择机床')
}
},
deleteData(row) {
this.$confirm('确认删除该装配任务', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletedata(row.计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable()
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style>
.el-table .cjzuwcqk_complet {
background: #9bd7fc !important;
}
</style>
<style lang="scss">
.selectTree{
.el-tree-node__content>.el-tree-node__expand-icon{
display: inline !important;
}
.el-tree-node:focus > .el-tree-node__content {
background-color: #ccc !important;
}
}
.treeNotesComplate {
color: black;
background-color: #9bd7fc !important;
}
.treeNotesUnComplate {
color: black;
}
</style>
<style scoped>
.el-form--label-left >>> .el-form-item__label {
text-align: right;
}
>>>.el-dialog--center .el-dialog__body {
text-align: initial;
padding: 20px 30px 20px
}
>>>.el-dialog__header {
padding: 20px 20px 0px;
}
>>>.el-dialog__footer {
padding: 0px 20px 20px;
/*text-align: right;*/
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
>>>.el-form-item {
margin-bottom: 13px;
}
</style>