Commit bfb4ec8c authored by SQL_Mou's avatar SQL_Mou

修改生产计划

parent fcbbe8e9
......@@ -2267,6 +2267,24 @@ var HttpReq = function(){
params:param
})
},
//大屏数据分析——采区产量统计
AreaNewPlan: function(param){
return request({
url: '/api/AreaNew/plan',
method: 'get',
params:param
})
},
//大屏数据分析——采区产量统计
addOnePlan: function(data){
return request({
url: '/api/Plan/addOne',
method: 'POST',
data:data,
}).then((res) => {
return res
})
},
......
......@@ -37,27 +37,27 @@
<el-form-item label="生产计划月份" prop="month">
<el-date-picker v-model="form.item.month" type="month" placeholder="选择月份" style="width:280px;"></el-date-picker>
</el-form-item>
<el-table :data="formTable" style="width: 100%">
<el-table-column prop="id" label="采区">
<el-table :data="formTable" style="width: 100%;margin-bottom:5px;">
<el-table-column prop=" name" label="采区">
<template slot-scope="scope">
<el-input
size="small"
v-model="scope.row.id"
v-model="scope.row.name"
v-show="scope.row.showEdit"
placeholder="请输入内容"
></el-input>
<span v-show="!scope.row.showEdit">{{scope.row.id}}</span>
<span v-show="!scope.row.showEdit">{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column prop="name" label="计划量(kg)">
<el-table-column prop="plan" label="计划量(kg)">
<template slot-scope="scope">
<el-input
size="small"
v-model="scope.row.name"
v-model="scope.row.plan"
v-show="scope.row.showEdit"
placeholder="请输入内容"
></el-input>
<span v-show="!scope.row.showEdit">{{scope.row.name}}</span>
<span v-show="!scope.row.showEdit">{{scope.row.plan}}</span>
</template>
</el-table-column>
<el-table-column label="操作">
......@@ -71,7 +71,7 @@
</el-table-column>
</el-table>
<el-form-item label="总计划量(T)" prop="plan">
<el-input v-model="form.item.plan" style="width:280px;" placeholder="请输入总计划量(T)"/>
<el-input @input="onInput" v-model="form.item.plan" style="width:280px;" placeholder="请输入总计划量(T)"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -113,6 +113,9 @@
<el-form-item label="计划量(T)">
<el-input v-model="gradeFrom.item.plan" style="width:260px;" placeholder="请输入计划量(T)"></el-input>
</el-form-item>
<el-form-item label="今日计划(T)">
<el-input v-model="gradeFrom.item.nowPlan" style="width:260px;" placeholder="请输入今日计划量(T)"></el-input>
</el-form-item>
<el-form-item label="累计完成量(T)">
<el-input v-model="gradeFrom.item.total" style="width:260px;" placeholder="请输入累计完成量(T)"></el-input>
</el-form-item>
......@@ -133,22 +136,7 @@ export default {
components: {},
data() {
return {
formTable:[
{
id: '采区1',
name: '8000',
showEdit: false
},
{
id: '采区2',
name: '5000',
showEdit: false
},
{
id: '采区3',
name: '0',
showEdit: false
}],
formTable:[],
imgSrcStart:process.env.VUE_APP_LOCAL_API2,
loading: false,
page: 1,
......@@ -195,14 +183,23 @@ export default {
this.loadData();
})
},
methods: {
methods: {
onInput(e){
console.log(e);
this.formTable.forEach((v,i,a) => {
v.plan = 0
});
},
handleEdit(index, row) {
console.log(index, row);
var total = 0
row.showEdit = !row.showEdit;
if (!row.showEdit) {
console.log("提交");
console.log(row);
this.formTable.forEach((v,i,a) => {
total += Number(v.plan)
});
}
this.form.item.plan = total;
},
//获取生产计划数据
loadData() {
......@@ -248,9 +245,17 @@ export default {
this.form.visible = true;
this.form.reqType = 'add';
this.form.item = {};
HttpReq.truckDispatching.AreaNewPlan().then( (res) => {
if(res.code == 200){
this.formTable = res.data;
console.log(res);
}
})
},
toEdit(item) {
// 请除表单验证
var sort = 'id,desc';
var param = {};
this.$refs['form1'] && this.$refs['form1'].clearValidate();
this.form.title = '修改生产计划';
this.form.status.cu = 0;
......@@ -261,6 +266,14 @@ export default {
timePeriodCenter.push(this.form.item.startTime);
timePeriodCenter.push(this.form.item.endTime);
this.timePeriod = timePeriodCenter;
param.sort = sort;
param.planId = this.form.item.id;
HttpReq.truckDispatching.productionPlanNewAllQuery(param).then((res) => {
if(res.code == 200){
//this.gradeLoading = false;
this.formTable = res.data.content;
}
})
},
toDelete(item) {
var id = item.id;
......@@ -284,12 +297,16 @@ export default {
submitForm(validateName, item){
if(!this.form.status.cu){
this.form.status.cu = 2;
item.list = this.formTable
//return
this.$refs[validateName].validate(valid => {
if(valid){
if(this.form.reqType === 'add'){
this.reqAddItem(this.form, item)
this.formTable = []
}else{
this.reqUpdateItem(this.form, item)
this.formTable = []
}
}else{
this.form.status.cu = 0
......@@ -300,7 +317,7 @@ export default {
//新增生产计划
reqAddItem(form, item){
let lastData = {...item};
HttpReq.truckDispatching.productionPlanAllAdd(lastData).then((res) => {
HttpReq.truckDispatching.addOnePlan(item).then((res) => {
form.visible = false;
if(res.code == 200){
this.$notify({
......@@ -323,7 +340,7 @@ export default {
//修改生产计划
reqUpdateItem(form, item){
let lastData = {...item};
HttpReq.truckDispatching.productionPlanAllUpdate(lastData).then((res) => {
HttpReq.truckDispatching.addOnePlan(item).then((res) => {
form.visible = false;
if(res.code == 200){
this.$notify({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment