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 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() {
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) {
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() {
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) {
return request({
@@ -138,8 +69,8 @@ export function save(num1, num2, num3) {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: '车间生产管理工艺_工艺任务分配_保存数据',
param: '工艺计划流水号=' + num1 + '&人员编号=' + num2 + '&零件图号=' + num3
name: '车间生产管理工艺_工艺任务分配_保存数据_循环执行',
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>
<div class="app-container">
<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-option
v-for="item in graphNum"
@@ -23,24 +19,15 @@
:value="item.value"/>
</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="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: 10px" plain @click="save">保存</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-table
ref="multipleTable"
:data="tableData"
:row-class-name="tableRowClassName"
style="width: 1000px;"
size="mini"
height="750"
highlight-current-row
border
@selection-change="handleSelectionChange">
<el-table ref="multipleTable" :data="tableData" style="width: 1000px;" size="mini" height="750" highlight-current-row border @selection-change="handleSelectionChange" @row-click="rowClick">
<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">
{{ scope.row.零件号 }}
{{ scope.row.零件 }}
</template>
</el-table-column>
<el-table-column align="center" prop="零件名称" label="零件名称" width="150">
@@ -60,7 +47,6 @@
</el-table-column>
<el-table-column align="center" label="工艺员" width="180px">
<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-option
v-for="item in Craftsmens"
@@ -94,69 +80,53 @@
</div>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" title="选择工艺定额人员" center>
<el-table
:data="tableData2"
style="width: 100%;max-height: 200px"
size="mini"
border
stripe
height="200px"
highlight-current-row
@row-click="confirmPerson">
<el-table-column align="center" label="考勤编号">
<el-dialog :visible.sync="dialogFormVisible" :title="title" center width="400px">
<el-table ref="multipleTable" :data="tableData2" size="mini" height="400" border>
<el-table-column align="center" label="序号" width="80">
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="姓名">
<el-table-column align="center" label="工艺名称">
<template slot-scope="scope">
{{ scope.row.姓名 }}
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="性别">
<el-table-column align="center" label="单件" width="80">
<template slot-scope="scope">
{{ scope.row.性别 }}
{{ scope.row.单件定额工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="工作岗位">
<el-table-column align="center" label="准结" width="80">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
{{ scope.row.准结定额工时 }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="tijiao()">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<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 {
data() {
return {
num1: '', // 工艺员中间变量
num2: '', // 工艺员流水号中间变量
loading: false,
loading0: false,
projectNameValue: '',
projectName: [],
// machineToolNum: '',
radio: 2,
graphNumValue: '',
graphNum: [],
GroupNumValue: '',
GroupNum: [],
tableData: [],
dialogFormVisible: false,
title: '',
tableData2: [],
dialogPerson: '',
index: '',
multipleSelection: [],
result: 0,
PageCurrent: 1,
PageSize: 50,
total: 0,
@@ -172,19 +142,9 @@ export default {
this.initPerson()
},
methods: {
fetchData() {
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
initPerson() { // 初始化工艺员
// 初始化工艺员
initPerson() {
initPerson().then(response => {
this.tableData2 = response.data
for (let i = 0; i < response.data.length; i++) {
this.Craftsmens.push({
label: response.data[i].姓名,
@@ -193,166 +153,81 @@ export default {
}
})
},
radioChange() { // radio改变
this.loading = true
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() { // 获取下拉图号
// 获取下拉图号
getGraphNum() {
this.graphNumValue = ''
this.graphNum = []
this.tableData = []
this.total = 0
this.GroupNumValue = ''
this.GroupNum = []
if (this.radio === 2) { // 全部
getGraphNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.graphNum.push({
label: response.data[i].机床,
value: 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].机床流水号
})
}
})
}
getGraphNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.graphNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水,
value2: response.data[i].项目名称
})
}
})
},
getGroupNum() { // 获取下拉组号
// 获取下拉组号
getGroupNum() {
this.tableData = []
this.total = 0
this.GroupNum = []
this.GroupNumValue = ''
if (this.radio === 2) { // 全部
getGroupNum(this.graphNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: 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].组件流水号
})
}
})
}
getGroupNum(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) {
this.tableData = []
} else {
this.loading0 = true
this.tableData = []
if (this.radio === 2) { // 全部
getTable0(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => {
this.total = response.data.total
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].工艺计划开始时间 = response.data.rows[i].工艺计划开始时间.split(' ')[0]
response.data.rows[i].工艺计划结束时间 = response.data.rows[i].工艺计划结束时间.split(' ')[0]
response.data.rows[i].操作时间 = response.data.rows[i].操作时间.split(' ')[0]
}
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
})
} 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
})
}
getTable(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) {
this.PageCurrent = 1
this.PageSize = val
this.getTable()
rowClick(row) {
this.tableData2 = []
selectTechnology(row.零件图号, row.规格).then(response => {
if (response.data[0].结果 === 1) {
this.title = response.data[0].机床图号
this.tableData2 = response.data
this.dialogFormVisible = true
}
})
},
handleCurrentChange(val) {
this.PageCurrent = 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
handleSelectionChange(val) {
this.multipleSelection = val
},
// 全选
selectAll(rows) {
if (this.tableData[0].工艺员 !== '') {
for (let i = 0; i < rows.length; i++) {
@@ -365,32 +240,30 @@ export default {
})
} else { this.$message.error('请在第一行中填写工艺员姓名') }
},
handleSelectionChange(val) {
this.multipleSelection = val
},
save() {
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].工艺员 === '') {
this.$message.error('请选择工艺员')
} else {
this.result = 0
save(this.multipleSelection[i].工艺计划流水号, this.multipleSelection[i].工艺员, this.multipleSelection[i].零件号).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
} else if (i === this.multipleSelection.length - 1 && this.result !== this.multipleSelection.length) {
this.$message.error('存在保存失败项')
}
})
this.loading = true
this.工艺计划流水号组 = []
this.通用件图号 = []
this.工艺员 = []
var check = 1
this.multipleSelection.map(v => {
if (!v.工艺员) {
check = 0
}
}
},
tableRowClassName({ row }) {
console.log(row.是否加急)
if (row.是否加急 === '1') {
return 'UrgentItem'
this.工艺计划流水号组.push(v.工艺计划流水号)
this.通用件图号.push(v.零件图号)
this.工艺员.push(v.工艺员)
})
if (check === 1) {
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) {
this.$message.error('请先选择零件')
} else {
this.loading = true
this.工艺计划流水号组 = []
this.通用件图号 = []
this.通用件规格 = []
@@ -408,30 +282,41 @@ export default {
check = 0
}
this.工艺计划流水号组.push(v.工艺计划流水号)
this.通用件图号.push(v.零件号)
this.通用件图号.push(v.零件)
this.通用件规格.push(v.规格)
this.工艺员.push(v.工艺员)
})
if (check === 1) {
console.log(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员)
save2(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员).then(response => {
console.log(response.data, 231)
if (response.data[0].结果 === 'success') {
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
this.loading = false
} else {
var messages = []
messages = response.data[0].结果.split('||||')
messages.shift()
console.log(messages)
this.$message.error(`图号${messages}无已完成`)
this.$message.error(`图号${messages}无已完成工艺`)
this.loading = false
}
})
} else {
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;
}
</style>
<style>
.el-table .UrgentItem{
background: #ff7575;
}
</style>