This commit is contained in:
liushuai
2020-02-18 08:50:00 +08:00
2 changed files with 143 additions and 318 deletions

View File

@@ -2,33 +2,6 @@ import request from '@/utils/request'
import state from '@/store' import state from '@/store'
import router from '@/router' import router from '@/router'
// 初始化项目(全部)
export function getProject() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_传递后_项目名称_查询数据_工艺定额任务分配',
param: '考核状态=3&工艺任务分配状态=1&定额任务分配状态=1'
}
})
}
// 初始化项目(当天)
export function getProject0() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_零件工艺计划_工艺任务分配_项目查询'
}
})
}
// 获取机床图号(全部) // 获取机床图号(全部)
export function getGraphNum() { export function getGraphNum() {
return request({ return request({
@@ -43,20 +16,6 @@ export function getGraphNum() {
} }
}) })
} }
// 获取机床图号(当天)//////////////
export function getGraphNum0(num) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_零件工艺计划_工艺任务分配_机床查询',
param: '项目流水号=' + num
}
})
}
// 获取组号(全部) // 获取组号(全部)
export function getGroupNum(num) { export function getGroupNum(num) {
return request({ return request({
@@ -71,50 +30,6 @@ export function getGroupNum(num) {
} }
}) })
} }
// 获取组号(当天)/////////
export function getGroupNum0(num) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_零件工艺计划_工艺任务分配_组件查询',
param: '机床流水号=' + num
}
})
}
// 获取工艺计划,填充主表
export function getTable0(PageCurrent, PageSize, num) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_零件工艺计划_已制定计划_按组查',
param: '组件流水号=' + num,
Pagination: PageCurrent + '&' + PageSize
}
})
}
// 查询主表(当天)////////
export function getTable00(PageCurrent, PageSize, num) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_零件工艺计划_工艺任务分配_零件查询',
param: '组件流水号=' + num,
Pagination: PageCurrent + '&' + PageSize
}
})
}
// 工艺定额人员查询 // 工艺定额人员查询
export function initPerson() { export function initPerson() {
return request({ return request({
@@ -129,6 +44,22 @@ export function initPerson() {
} }
}) })
} }
// 获取工艺计划,填充主表
export function getTable(PageCurrent, PageSize, num) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_零件工艺计划_已制定计划_按组查',
param: '组件流水号=' + num,
Pagination: PageCurrent + '&' + PageSize
}
})
}
// 保存 // 保存
export function save(num1, num2, num3) { export function save(num1, num2, num3) {
return request({ return request({
@@ -138,8 +69,8 @@ export function save(num1, num2, num3) {
UserID: state.state.user.id, UserID: state.state.user.id,
ModularID: router.currentRoute.path, ModularID: router.currentRoute.path,
type: '2', type: '2',
name: '车间生产管理工艺_工艺任务分配_保存数据', name: '车间生产管理工艺_工艺任务分配_保存数据_循环执行',
param: '工艺计划流水号=' + num1 + '&人员编号=' + num2 + '&零件图号=' + num3 param: '工艺计划流水号=' + num1 + '&零件图号组=' + num2 + '&工艺员流水号组=' + num3
} }
}) })
} }
@@ -157,3 +88,17 @@ export function save2(num1, num2, num3, num4) {
} }
}) })
} }
// 查询已完工艺详细内容
export function selectTechnology(num1, num2) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_工艺任务分配_查询已完工艺',
param: '零件图号=' + num1 + '&规格=' + num2
}
})
}

View File

@@ -1,10 +1,6 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<el-radio-group v-show="false" v-model="radio" size="small" style="margin: 10px;" @change="radioChange()">
<el-radio :label="1">当天</el-radio>
<el-radio :label="2">全部</el-radio>
</el-radio-group>
<el-select v-model="graphNumValue" filterable size="small" style="margin:3px 10px;width: 180px" placeholder="机床图号" @change="getGroupNum()"> <el-select v-model="graphNumValue" filterable size="small" style="margin:3px 10px;width: 180px" placeholder="机床图号" @change="getGroupNum()">
<el-option <el-option
v-for="item in graphNum" v-for="item in graphNum"
@@ -23,24 +19,15 @@
:value="item.value"/> :value="item.value"/>
</el-select> </el-select>
<el-button type="primary" size="small" icon="el-icon-bangzhu" style="margin-left: 10px" plain @click="selectAll(tableData)">全选</el-button> <el-button type="primary" size="small" icon="el-icon-bangzhu" style="margin-left: 10px" plain @click="selectAll(tableData)">全选</el-button>
<el-button type="success" size="small" icon="el-icon-upload" style="margin-left: 10px" plain @click="save">保存</el-button> <el-button :loading="loading" type="success" size="small" icon="el-icon-upload" style="margin-left: 10px" plain @click="save">保存</el-button>
<el-button type="success" size="small" icon="el-icon-upload" style="margin-left: 300px" plain @click="currency">通用件保存</el-button> <el-button :loading="loading" type="success" size="small" icon="el-icon-upload" style="margin-left: 300px" plain @click="currency">通用件保存</el-button>
</el-card> </el-card>
<el-card> <el-card>
<el-table <el-table ref="multipleTable" :data="tableData" style="width: 1000px;" size="mini" height="750" highlight-current-row border @selection-change="handleSelectionChange" @row-click="rowClick">
ref="multipleTable"
:data="tableData"
:row-class-name="tableRowClassName"
style="width: 1000px;"
size="mini"
height="750"
highlight-current-row
border
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection"/> <el-table-column align="center" type="selection"/>
<el-table-column align="center" label="零件号" prop="零件号" width="160"> <el-table-column align="center" label="零件号" prop="零件号">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.零件号 }} {{ scope.row.零件 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="零件名称" label="零件名称" width="150"> <el-table-column align="center" prop="零件名称" label="零件名称" width="150">
@@ -60,7 +47,6 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="工艺员" width="180px"> <el-table-column align="center" label="工艺员" width="180px">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-input v-model="tableData[scope.$index].工艺员" size="mini" style="width:150px" placeholder="工艺员" @click.native="selectPerson(scope.$index)"/>-->
<el-select v-model="tableData[scope.$index].工艺员" filterable clearable size="small" placeholder="工艺员" style="margin:3px 10px;width: 150px"> <el-select v-model="tableData[scope.$index].工艺员" filterable clearable size="small" placeholder="工艺员" style="margin:3px 10px;width: 150px">
<el-option <el-option
v-for="item in Craftsmens" v-for="item in Craftsmens"
@@ -94,69 +80,53 @@
</div> </div>
</el-card> </el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" title="选择工艺定额人员" center> <el-dialog :visible.sync="dialogFormVisible" :title="title" center width="400px">
<el-table <el-table ref="multipleTable" :data="tableData2" size="mini" height="400" border>
:data="tableData2" <el-table-column align="center" label="序号" width="80">
style="width: 100%;max-height: 200px"
size="mini"
border
stripe
height="200px"
highlight-current-row
@row-click="confirmPerson">
<el-table-column align="center" label="考勤编号">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.考勤编号 }} {{ scope.row.工序顺序 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="姓名"> <el-table-column align="center" label="工艺名称">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.姓名 }} {{ scope.row.工艺名称 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="性别"> <el-table-column align="center" label="单件" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.性别 }} {{ scope.row.单件定额工时 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="工作岗位"> <el-table-column align="center" label="准结" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.岗位名称 }} {{ scope.row.准结定额工时 }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="tijiao()">提交</el-button>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getProject0, getProject, getGraphNum, getGroupNum, getTable0, getGraphNum0, getGroupNum0, getTable00, save, initPerson, save2 } from '@/api/ManufacturingCenter/ProcessTaskAssignment' import { getGraphNum, getGroupNum, getTable, save, save2, initPerson, selectTechnology } from '@/api/ManufacturingCenter/ProcessTaskAssignment'
export default { export default {
data() { data() {
return { return {
num1: '', // 工艺员中间变量
num2: '', // 工艺员流水号中间变量
loading: false, loading: false,
loading0: false, loading0: false,
projectNameValue: '', projectNameValue: '',
projectName: [], projectName: [],
// machineToolNum: '',
radio: 2,
graphNumValue: '', graphNumValue: '',
graphNum: [], graphNum: [],
GroupNumValue: '', GroupNumValue: '',
GroupNum: [], GroupNum: [],
tableData: [], tableData: [],
dialogFormVisible: false, dialogFormVisible: false,
title: '',
tableData2: [], tableData2: [],
dialogPerson: '',
index: '', index: '',
multipleSelection: [], multipleSelection: [],
result: 0,
PageCurrent: 1, PageCurrent: 1,
PageSize: 50, PageSize: 50,
total: 0, total: 0,
@@ -172,19 +142,9 @@ export default {
this.initPerson() this.initPerson()
}, },
methods: { methods: {
fetchData() { // 初始化工艺员
getProject().then(response => { initPerson() {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
initPerson() { // 初始化工艺员
initPerson().then(response => { initPerson().then(response => {
this.tableData2 = response.data
for (let i = 0; i < response.data.length; i++) { for (let i = 0; i < response.data.length; i++) {
this.Craftsmens.push({ this.Craftsmens.push({
label: response.data[i].姓名, label: response.data[i].姓名,
@@ -193,166 +153,81 @@ export default {
} }
}) })
}, },
radioChange() { // radio改变 // 获取下拉图号
this.loading = true getGraphNum() {
this.projectName = []
this.projectNameValue = ''
this.graphNumValue = ''
this.GroupNumValue = ''
this.GroupNum = []
this.tableData = []
this.total = 0
if (this.radio === 1) {
getProject0().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
this.loading = false
})
} else {
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
this.loading = false
})
}
},
getGraphNum() { // 获取下拉图号
this.graphNumValue = '' this.graphNumValue = ''
this.graphNum = [] this.graphNum = []
this.tableData = [] this.tableData = []
this.total = 0 this.total = 0
this.GroupNumValue = '' this.GroupNumValue = ''
this.GroupNum = [] this.GroupNum = []
if (this.radio === 2) { // 全部 getGraphNum().then(response => {
getGraphNum().then(response => { for (let i = 0; i < response.data.length; i++) {
for (let i = 0; i < response.data.length; i++) { this.graphNum.push({
this.graphNum.push({ label: response.data[i].机床图号,
label: response.data[i].机床, value: response.data[i].机床流水,
value: response.data[i].机床流水号, value2: response.data[i].项目名称
value2: response.data[i].项目名称 })
}) }
} })
})
} else { // 当天
getGraphNum0(this.projectNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.graphNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
}
}, },
getGroupNum() { // 获取下拉组号 // 获取下拉组号
getGroupNum() {
this.tableData = [] this.tableData = []
this.total = 0 this.total = 0
this.GroupNum = [] this.GroupNum = []
this.GroupNumValue = '' this.GroupNumValue = ''
if (this.radio === 2) { // 全部 getGroupNum(this.graphNumValue).then(response => {
getGroupNum(this.graphNumValue).then(response => { for (let i = 0; i < response.data.length; i++) {
for (let i = 0; i < response.data.length; i++) { this.GroupNum.push({
this.GroupNum.push({ label: response.data[i].组号,
label: response.data[i].组号, value: response.data[i].件流水
value: response.data[i].组件流水号 })
}) }
} })
})
} else { // 当天
getGroupNum0(this.graphNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
}
}, },
getTable() { // 获取主表 // 获取主表
getTable() {
if (this.GroupNumValue === null) { if (this.GroupNumValue === null) {
this.tableData = [] this.tableData = []
} else { } else {
this.loading0 = true this.loading0 = true
this.tableData = [] this.tableData = []
if (this.radio === 2) { // 全部 getTable(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => {
getTable0(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => { this.total = response.data.total
this.total = response.data.total for (let i = 0; i < response.data.rows.length; i++) {
for (let i = 0; i < response.data.rows.length; i++) { this.tableData.push({
response.data.rows[i].工艺计划开始时间 = response.data.rows[i].工艺计划开始时间.split(' ')[0] 零件图号: response.data.rows[i].零件图号,
response.data.rows[i].工艺计划结束时间 = response.data.rows[i].工艺计划结束时间.split(' ')[0] 零件名称: response.data.rows[i].零件名称,
response.data.rows[i].操作时间 = response.data.rows[i].操作时间.split(' ')[0] 工艺开始时间: response.data.rows[i].工艺计划开始时间,
} 工艺结束时间: response.data.rows[i].工艺计划结束时间,
for (let i = 0; i < response.data.rows.length; i++) { 数量: response.data.rows[i].批次数量,
this.tableData.push({ 投产时间: response.data.rows[i].操作时间,
零件号: response.data.rows[i].零件图号, 规格: response.data.rows[i].规格,
零件名称: response.data.rows[i].零件名称, 是否加急: response.data.rows[i].是否加急,
工艺开始时间: response.data.rows[i].工艺计划开始时间, 工艺: '',
工艺结束时间: response.data.rows[i].工艺计划结束时间, 人员编号: '',
数量: response.data.rows[i].批次数量, 工艺计划流水号: response.data.rows[i].工艺计划流水号
投产时间: response.data.rows[i].操作时间, })
规格: response.data.rows[i].规格, }
是否加急: response.data.rows[i].是否加急, this.loading0 = false
工艺员: '', })
人员编号: '',
工艺计划流水号: response.data.rows[i].工艺计划流水号
})
}
this.loading0 = false
})
} else { // 当天
getTable00(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => {
this.total = response.data.total
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData.push({
零件号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
工艺开始时间: response.data.rows[i].工艺计划开始时间,
工艺结束时间: response.data.rows[i].工艺计划结束时间,
数量: response.data.rows[i].批次数量,
投产时间: response.data.rows[i].操作时间,
规格: response.data.rows[i].规格,
是否加急: response.data.rows[i].是否加急,
工艺员: '',
人员编号: '',
工艺计划流水号: response.data.rows[i].工艺计划流水号
})
}
this.loading0 = false
})
}
} }
}, },
handleSizeChange(val) { rowClick(row) {
this.PageCurrent = 1 this.tableData2 = []
this.PageSize = val selectTechnology(row.零件图号, row.规格).then(response => {
this.getTable() if (response.data[0].结果 === 1) {
this.title = response.data[0].机床图号
this.tableData2 = response.data
this.dialogFormVisible = true
}
})
}, },
handleCurrentChange(val) { handleSelectionChange(val) {
this.PageCurrent = val this.multipleSelection = val
this.getTable()
},
selectPerson(index) { // 点击查询按钮
this.index = index
this.dialogFormVisible = true
},
confirmPerson(row) { // 选择一行
this.num1 = row.姓名
this.num2 = row.人员编号
},
tijiao() {
this.tableData[this.index].工艺员 = this.num1
this.tableData[this.index].人员编号 = this.num2
this.dialogFormVisible = false
}, },
// 全选
selectAll(rows) { selectAll(rows) {
if (this.tableData[0].工艺员 !== '') { if (this.tableData[0].工艺员 !== '') {
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
@@ -365,32 +240,30 @@ export default {
}) })
} else { this.$message.error('请在第一行中填写工艺员姓名') } } else { this.$message.error('请在第一行中填写工艺员姓名') }
}, },
handleSelectionChange(val) {
this.multipleSelection = val
},
save() { save() {
for (let i = 0; i < this.multipleSelection.length; i++) { this.loading = true
if (this.multipleSelection[i].工艺员 === '') { this.工艺计划流水号组 = []
this.$message.error('请选择工艺员') this.通用件图号 = []
} else { this.工艺员 = []
this.result = 0 var check = 1
save(this.multipleSelection[i].工艺计划流水号, this.multipleSelection[i].工艺员, this.multipleSelection[i].零件号).then(response => { this.multipleSelection.map(v => {
this.result += parseInt(response.data[0].result) if (!v.工艺员) {
if (this.result === this.multipleSelection.length) { check = 0
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
} else if (i === this.multipleSelection.length - 1 && this.result !== this.multipleSelection.length) {
this.$message.error('存在保存失败项')
}
})
} }
} this.工艺计划流水号组.push(v.工艺计划流水号)
}, this.通用件图号.push(v.零件图号)
tableRowClassName({ row }) { this.工艺员.push(v.工艺员)
console.log(row.是否加急) })
if (row.是否加急 === '1') { if (check === 1) {
return 'UrgentItem' save(this.工艺计划流水号组, this.通用件图号, this.工艺员).then(response => {
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
this.loading = false
})
} else {
this.loading = false
this.$message.error('请选择工艺员')
} }
}, },
// 直接保存工艺 // 直接保存工艺
@@ -398,6 +271,7 @@ export default {
if (this.multipleSelection.length === 0) { if (this.multipleSelection.length === 0) {
this.$message.error('请先选择零件') this.$message.error('请先选择零件')
} else { } else {
this.loading = true
this.工艺计划流水号组 = [] this.工艺计划流水号组 = []
this.通用件图号 = [] this.通用件图号 = []
this.通用件规格 = [] this.通用件规格 = []
@@ -408,30 +282,41 @@ export default {
check = 0 check = 0
} }
this.工艺计划流水号组.push(v.工艺计划流水号) this.工艺计划流水号组.push(v.工艺计划流水号)
this.通用件图号.push(v.零件号) this.通用件图号.push(v.零件)
this.通用件规格.push(v.规格) this.通用件规格.push(v.规格)
this.工艺员.push(v.工艺员) this.工艺员.push(v.工艺员)
}) })
if (check === 1) { if (check === 1) {
console.log(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员) console.log(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员)
save2(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员).then(response => { save2(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员).then(response => {
console.log(response.data, 231)
if (response.data[0].结果 === 'success') { if (response.data[0].结果 === 'success') {
this.$message.success('保存成功') this.$message.success('保存成功')
this.PageCurrent = 1 this.PageCurrent = 1
this.getTable() this.getTable()
this.loading = false
} else { } else {
var messages = [] var messages = []
messages = response.data[0].结果.split('||||') messages = response.data[0].结果.split('||||')
messages.shift() messages.shift()
console.log(messages) this.$message.error(`图号${messages}无已完成工艺`)
this.$message.error(`图号${messages}无已完成`) this.loading = false
} }
}) })
} else { } else {
this.$message.error('请选择工艺员') this.$message.error('请选择工艺员')
this.loading = false
} }
} }
},
// 分页
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.getTable()
},
handleCurrentChange(val) {
this.PageCurrent = val
this.getTable()
} }
} }
} }
@@ -442,8 +327,3 @@ export default {
margin-right: 10px; margin-right: 10px;
} }
</style> </style>
<style>
.el-table .UrgentItem{
background: #ff7575;
}
</style>