计划完成

This commit is contained in:
qianhao.xu
2023-11-14 19:35:49 +08:00
parent 19ae3ef130
commit 2abd4e87ad
2 changed files with 90 additions and 39 deletions

View File

@@ -2,21 +2,34 @@ import request from '@/utils/request'
import { downFile } from '@/utils/request'
export function getWorkplanList(query) {
return request({
url: '/mes/pro/workplan/list',
method: 'get',
params: query,
})
}
return request({
url: '/mes/pro/workplan/list',
method: 'get',
params: query,
})
}
export function addNewworkplan(data) {
return request({
url: '/mes/pro/workplan/addworkplan',
method: 'post',
data: data,
contextType: 'application/json',
})
}
export function addNewworkplan(data) {
return request({
url: '/mes/pro/workplan/addworkplan',
method: 'post',
data: data,
contextType:"application/json"
})
}
export function deleteworkplan(id) {
return request({
url: '/mes/pro/workplan/deleteitem/' + id,
method: 'get',
})
}
export function updateworkplan(data) {
return request({
url: '/mes/pro/workplan/updateworkplan',
method: 'post',
data: data,
contextType: 'application/json',
})
}

View File

@@ -64,7 +64,7 @@
<el-table-column prop="remark" label="备注"> </el-table-column>
<el-table-column fixed="right" label="操作" width="280">
<template slot-scope="scope">
<el-button size="mini" @click="workplan_handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button size="mini" @click="workplan_handleUpdate(scope.$index, scope.row)">修改</el-button>
<el-button size="mini" type="danger" @click="workplan_handleDelete(scope.$index, scope.row)">删除</el-button>
<el-button size="mini" type="success">查看工单</el-button>
</template>
@@ -197,19 +197,19 @@
</template>
<script>
import { getWorkplanList, addNewworkplan } from '@/api/productManagement/workplan.js'
import { getWorkplanList, addNewworkplan, deleteworkplan, updateworkplan } from '@/api/productManagement/workplan.js'
export default {
name: 'workplan',
data() {
return {
flag: 'insert',
search: {
year: new Date().getFullYear(),
week: null,
partNumber: '',
color: '',
},
workplanList: [
], //生产计划列表
workplanList: [], //生产计划列表
pagination: {
total: 0,
pageNum: 1,
@@ -220,6 +220,7 @@ export default {
title: '新增生产计划',
open: false,
form: {
id: '',
year: new Date().getFullYear(),
week: null,
source: null,
@@ -254,10 +255,8 @@ export default {
methods: {
getList() {
const query = { ...this.search, ...this.pagination }
if(query.week==null||query.week==undefined||query.week=="")
query.week=-1;
if(query.year==null||query.year==undefined||query.year=="")
query.year=-1;
if (query.week == null || query.week == undefined || query.week == '') query.week = -1
if (query.year == null || query.year == undefined || query.year == '') query.year = -1
getWorkplanList(query).then((res) => {
if (res.code == 200) {
this.loading_1 = false
@@ -270,21 +269,35 @@ export default {
newplan() {
this.dialog_1.open = true
this.dialog_1.title = '新增生产计划'
this.flag = 'insert'
},
// 新增修改提交处理
submitForm_1() {
// 1.上传数据
this.$refs['dialog_1form'].validate((valid) => {
if (valid) {
addNewworkplan(this.dialog_1.form).then((res) => {
if (res.code == 200) {
this.$notify.success('新增成功')
this.getList()
this.dialog_1.open = false
}
})
}
})
if ((this.flag = 'insert')) {
this.$refs['dialog_1form'].validate((valid) => {
if (valid) {
addNewworkplan(this.dialog_1.form).then((res) => {
if (res.code == 200) {
this.$notify.success('新增成功')
this.getList()
this.dialog_1.open = false
}
})
}
})
} else if ((this.flag = 'update')) {
this.$refs['dialog_1form'].validate((valid) => {
if (valid) {
updateworkplan(this.dialog_1.form).then((res) => {
if (res.code == 200) {
this.$notify.success('修改成功')
this.getList()
this.dialog_1.open = false
}
})
}
})
}
},
cancel_1() {
@@ -292,15 +305,40 @@ export default {
// this.dialog_1reset();
this.resetForm('dialog_1form')
},
//修改生产计划
workplan_handleUpdate(index, row) {
this.flag = 'update'
this.dialog_1.open = true
this.dialog_1.title = '修改生产计划'
this.dialog_1.form.id = row.id
this.dialog_1.form.year = row.year
this.dialog_1.form.week = row.week
this.dialog_1.form.source = row.source
this.dialog_1.form.partnumber = row.partnumber
this.dialog_1.form.version = row.version
this.dialog_1.form.color = row.color
this.dialog_1.form.colorcode = row.colorcode
this.dialog_1.form.neednumber = row.neednumber
this.dialog_1.form.passpercent = row.passpercent
this.dialog_1.form.batchNumber = row.batchNumber
this.dialog_1.form.productionRhythm = row.productionRhythm
this.dialog_1.form.actualplanNumber = row.actualplanNumber
this.dialog_1.form.carNumber = row.carNumber
this.dialog_1.form.circleNumber = row.circleNumber
this.dialog_1.form.producttime = row.producttime
this.dialog_1.form.needcertainty = row.needcertainty
this.dialog_1.form.remark = row.remark
},
//删除生产计划
workplan_handleEdit(index, row) {
deleteworkplan().then((res) => {
workplan_handleDelete(index, row) {
deleteworkplan(row.id).then((res) => {
if (res.code == 200) {
if ((res.data = 1)) {
this.$notify.success('删除成功')
this.getList()
} else {
this.$notify.error('上传')
this.$notify.error('删除失败')
}
}
})