This commit is contained in:
liushuai
2020-06-13 17:15:04 +08:00
parent fa5f12d664
commit 810b198282
26 changed files with 1476 additions and 238 deletions

View File

@@ -15,17 +15,16 @@
</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">
<el-table v-loading="loading" :data="tableData" :row-class-name="tableData1ClassName" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="720px">
<el-table-column label="机床组号" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.机床组号 }}
</template>
</el-table-column>
<el-table-column label="部件名称" align="center" width="100px">
<el-table-column label="部件名称" align="center" width="90px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.部件名称 }}
</template>
@@ -35,90 +34,80 @@
{{ 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">
<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="65px">
<template slot-scope="scope">
{{ scope.row.自制件入库率 }}
</template>
</el-table-column>
<el-table-column label="外购件入库" align="center" width="95px">
<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="90px">
<el-table-column label="成组配套" align="center" width="80px">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openDialog(scope.row)">查看详情</el-button>
<el-button :disabled="!scope.row.组件流水号" type="text" size="mini" @click="openDialog(scope.row)">查看详情</el-button>
</template>
</el-table-column>
<el-table-column label="分配时间" align="center" width="90px">
<el-table-column label="装配工" align="center" width="125px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.装配工 }}
</template>
</el-table-column>
<el-table-column label="分配时间" align="center" width="85px">
<template slot-scope="scope">
{{ scope.row.分配时间 ? scope.row.分配时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="90px">
<el-table-column label="操作" align="center" width="80px">
<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)"/>
<el-button :disabled="Number(scope.row.是否工作) !== 0" type="text" size="mini" @click="openPeople(scope.row)">分配</el-button>
<el-button :disabled="Number(scope.row.是否工作) !== 0" 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">
<el-card style="width: 39%; float: left">
<el-table :data="tableData2" :row-class-name="tableData1ClassName" border size="mini" highlight-current-row style="width: 100%;margin-top: 15px" height="720px">
<el-table-column label="状态" align="center" width="60px">
<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>
{{ scope.row.状态 }}
</template>
</el-table-column>
<el-table-column label="部件" align="center" width="120px">
<el-table-column label="部件名称" align="center" width="110px" show-overflow-tooltip>
<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>
{{ scope.row.组件名称 }}
</template>
</el-table-column>
<el-table-column label="装配" align="center" width="70px" prop="计划工时">
<el-table-column label="装配" align="center" width="120px" show-overflow-tooltip>
<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>
{{ scope.row.装配工 }}
</template>
</el-table-column>
<el-table-column label="装配开始" align="center" width="110px">
<el-table-column label="装配开始" align="center" width="85px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
{{ scope.row.开始时间 ? scope.row.开始时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="装配暂停" align="center" width="110px">
<el-table-column label="装配暂停" align="center" width="85px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
{{ scope.row.暂停开始时间 ? scope.row.暂停开始时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="装配结束" align="center" width="110px">
<el-table-column label="装配结束" align="center" width="85px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
{{ scope.row.结束时间 ? scope.row.结束时间.split(' ')[0] : '' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80px">
<template slot-scope="scope">
<el-button :disabled="Number(scope.row.是否工作) !== 0" type="text" size="mini" @click="outPeople(scope.row)">移出</el-button>
<el-button :disabled="Number(scope.row.是否工作) !== 0" type="text" icon="el-icon-delete" size="mini" @click="deleteTask(scope.row)"/>
</template>
</el-table-column>
</el-table>
@@ -143,25 +132,97 @@
:visible.sync="dialogFormVisible1"
title="装配任务"
center
width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="120px">
width="300px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="80px">
<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"
:disabled="addTaskName_disable"
type="primary"
size="small"
icon="el-icon-check"
@click="submitTaskName">确定</el-button>
</div>
</el-dialog>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogFormVisible2"
title="分配装配任务"
center
width="340px">
<el-table
ref="multipleTable"
:data="List"
stripe
tooltip-effect="dark"
style="width: 100%"
height="500"
highlight-current-row
border
size="mini"
@selection-change="handleSelectionChange">
<el-table-column
:selectable="selectable"
align="center"
type="selection"
width="50"/>
<el-table-column align="center" label="装配工" min-width="200">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button
:disabled="addPeople_disable"
type="primary"
size="small"
icon="el-icon-check"
@click="submitPeople">确定</el-button>
</div>
</el-dialog>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogFormVisible3"
title="移出装配工"
center
width="340px">
<el-table
ref="multipleTable"
:data="List1"
stripe
tooltip-effect="dark"
style="width: 100%"
highlight-current-row
border
size="mini"
@selection-change="handleSelectionChange1">
<el-table-column
align="center"
type="selection"
width="50"/>
<el-table-column align="center" label="装配工" min-width="200">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button
:disabled="outPeople_disable"
type="primary"
size="small"
icon="el-icon-check"
@click="submitOutPeople">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>import { initProject, searchTable, getMachineNames, selectParts, addData, deletedata } from '@/api/Assembly/AssemblyTaskAssignment'
<script>import { initProject, searchTable, getMachineNames, selectParts, addData, deletedata, searchPeople, submitPeople, searchTable2, searchName, submitOutPeople, deleteTask } from '@/api/Assembly/AssemblyTaskAssignment'
// import { mapGetters } from 'vuex'
export default {
data() {
@@ -171,15 +232,25 @@ export default {
machineNum: '',
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
groupNumberValue: '',
groupNum: [],
loading: false,
tableData: [],
tableData2: [],
hadFile: [],
option: [],
plan: '',
addPurchaseOrder_disable: false,
List: [],
List1: [],
Name: [],
peopleGroup: [],
outPeopleGroup: [],
multipleSelection: [],
multipleSelection1: [],
addTaskName_disable: false,
addPeople_disable: false,
outPeople_disable: false,
form: {
任务名称: ''
},
@@ -189,9 +260,9 @@ export default {
departmentData: [] // 树状数据
}
},
// created() {
// this.searchTable1()
// },
created() {
this.searchPeople()
},
mounted() {
this.initProject()
},
@@ -207,11 +278,19 @@ export default {
}
})
},
searchPeople() {
searchPeople().then(response => {
this.List = response.data
})
},
searchTable() {
this.loading = true
getMachineNames(this.machineNumberValue).then(response => {
this.machineNum = response.data[0].机床数量
})
searchTable2(this.machineNumberValue).then(response => {
this.tableData2 = response.data
})
searchTable(this.machineNumberValue).then(response => {
this.tableData = response.data
}).then(() => {
@@ -249,26 +328,102 @@ export default {
}
})
},
openPeople(row) {},
openPeople(row) {
this.Name = []
searchName(row.计划流水号).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Name.push(Number(response.data[i].考勤编号))
}
})
this.searchPeople()
this.addPeople_disable = false
this.dialogFormVisible2 = true
this.groupNumberValue = row.计划流水号
},
handleSelectionChange(val) {
this.multipleSelection = val
},
selectable(row, index) { // 控制某行是否可选
console.log(this.Name.indexOf(Number(row.考勤编号)))
return this.Name.indexOf(Number(row.考勤编号)) === -1 // 未采购&&确认物料修改
},
submitPeople() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请选择装配工')
} else {
this.peopleGroup = []
this.addPeople_disable = true
for (let i = 0; i < this.multipleSelection.length; i++) {
this.peopleGroup.push(this.multipleSelection[i].人员编号)
}
submitPeople(this.groupNumberValue, this.peopleGroup).then(response => {
if (response.data[0].result !== '0') {
this.$message.success('分配成功')
this.dialogFormVisible2 = false
this.multipleSelection = []
this.searchTable()
} else {
this.$message.error('分配失败')
this.addPeople_disable = false
}
})
}
},
outPeople(row) {
this.outPeople_disable = false
this.dialogFormVisible3 = true
this.groupNumberValue = row.计划流水号
searchName(this.groupNumberValue).then(response => {
this.List1 = response.data
})
},
handleSelectionChange1(val) {
this.multipleSelection1 = val
},
submitOutPeople() {
if (this.multipleSelection1.length === 0) {
this.$message.warning('请选择装配工')
} else {
this.outPeopleGroup = []
this.outPeople_disable = true
for (let i = 0; i < this.multipleSelection1.length; i++) {
this.outPeopleGroup.push(this.multipleSelection1[i].任务分配流水号)
}
submitOutPeople(this.groupNumberValue, this.outPeopleGroup).then(response => {
if (response.data[0].result !== '0') {
this.$message.success('移出成功')
this.dialogFormVisible3 = false
this.searchTable()
this.multipleSelection1 = []
} else {
this.$message.error('移出失败')
this.outPeople_disable = false
}
})
}
},
addTaskName() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.任务名称 = ''
this.addPurchaseOrder_disable = false
this.addTaskName_disable = false
this.dialogFormVisible1 = true
},
submitTaskName() {
if (this.machineNumberValue) {
this.$refs['form'].validate((valid) => {
if (valid) {
this.addPurchaseOrder_disable = true
this.addTaskName_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 {
this.$message.error('新建装配任务失败')
this.addTaskName_disable = false
}
})
} else {
return false
@@ -296,6 +451,36 @@ export default {
message: '已取消删除'
})
})
},
deleteTask(row) {
this.$confirm('确认删除该分配任务', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTask(row.计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable()
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
tableData1ClassName({ row, rowIndex }) {
if (Number(row.是否工作) === 0 && row.分配时间) {
return 'weizhuangpei'
} else if (Number(row.是否工作) === 1 && Number(row.是否暂停) === 0) {
return 'zhuangpeizhong'
} else if (Number(row.是否工作) === 1 && Number(row.是否暂停) === 1) {
return 'zanting'
} else if (Number(row.是否工作) === 2) {
return 'wancheng'
}
}
}
}
@@ -345,3 +530,17 @@ export default {
margin-bottom: 13px;
}
</style>
<style>
.weizhuangpei {
background: #e9c5d1 !important;
}
.zhuangpeizhong {
background: #E6EAEE !important;
}
.zanting {
background: #D8E5F6 !important;
}
.wancheng {
background: #c6d7b3 !important;
}
</style>