|
@@ -100,7 +100,7 @@
|
|
|
<!-- 产能额度上浮区间 -->
|
|
|
<template slot="capacitySection" slot-scope="text, record, index" >
|
|
|
<a-form-model-item prop="capacitySection" :rules="rules.capacitySection" v-if="record.status == '0'">
|
|
|
- <a-input style="width:100%" type="text" v-model="record.capacitySection" />
|
|
|
+ <a-input style="width:100%" type="text" v-model="record.capacitySection" @change="changeCapacitySection(record)"/>
|
|
|
</a-form-model-item>
|
|
|
<a-form-model-item prop="capacitySection" :rules="rules.capacitySection" v-if="record.status == '1'">
|
|
|
<span>{{record.capacitySection}}</span>
|
|
@@ -260,7 +260,14 @@ export default {
|
|
|
},
|
|
|
|
|
|
addLine(){
|
|
|
- var line ={
|
|
|
+ var operation = 0
|
|
|
+ this.suplierListData.map(item=>{
|
|
|
+ if(item.status == 0){
|
|
|
+ operation +=1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(operation == 0){
|
|
|
+ var line ={
|
|
|
supplierCode:'',
|
|
|
supplier:'',
|
|
|
capacityQuota:'',
|
|
@@ -270,17 +277,29 @@ export default {
|
|
|
status : '0'
|
|
|
}
|
|
|
this.suplierListData.unshift(line)
|
|
|
+ }else{
|
|
|
+ this.$message.error('当前有操作未完成');
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
editLine(){
|
|
|
+ var operation = 0
|
|
|
+ this.suplierListData.map(item=>{
|
|
|
+ if(item.status == 0){
|
|
|
+ operation +=1
|
|
|
+ }
|
|
|
+ })
|
|
|
if(this.selectedRowKeys.length == '0'){
|
|
|
this.$message.error('请勾选需要修改的数据');
|
|
|
}else if(this.selectedRowKeys.length > 1){
|
|
|
this.$message.error('一次只允许修改一行数据');
|
|
|
}else if(this.selectedRows[0].state =='1'){
|
|
|
this.$message.error('已提交数据不可修改');
|
|
|
+ }else if(operation !== 0){
|
|
|
+ this.$message.error('当前有操作未完成');
|
|
|
}else{
|
|
|
this.suplierListData.map(item =>{
|
|
|
- if(item.supplierState == this.selectedRows[0].supplierState){
|
|
|
+ if(item.id == this.selectedRows[0].id){
|
|
|
item.status = '0'
|
|
|
}
|
|
|
})
|
|
@@ -296,6 +315,12 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ changeCapacitySection(record){
|
|
|
+ if(record.capacitySection < 0 || record.capacitySection>100){
|
|
|
+ this.$message.destroy();
|
|
|
+ this.$message.error('产能额度上浮区间必须是大于0小于100',1);
|
|
|
+ }
|
|
|
+ },
|
|
|
delectLLine(){
|
|
|
if(this.selectedRowKeys.length == '0'){
|
|
|
this.$message.error('请勾选需要删除的数据');
|
|
@@ -319,45 +344,53 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
saveLine(){
|
|
|
- if(this.defaultMode == 'add'){
|
|
|
- var syCapacityControl = this.suplierListData[0]
|
|
|
- syCapacityControl.state = '0'
|
|
|
- addSupplierList(syCapacityControl).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.$message.success('新增成功');
|
|
|
- this.getSupplierList()
|
|
|
- }else{
|
|
|
- this.$message.error(res.message);
|
|
|
- }
|
|
|
- })
|
|
|
- }else {
|
|
|
- var newObj = this.selectedRows[0]
|
|
|
- editSupplierList(newObj).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.$message.success('修改成功');
|
|
|
- this.getSupplierList()
|
|
|
- this.selectedRowKeys = []
|
|
|
- this.selectedRows = []
|
|
|
- }else{
|
|
|
- this.$message.error(res.message);
|
|
|
- }
|
|
|
- //清空勾选恢复默认
|
|
|
- this.selectedRowKeys = []
|
|
|
- this.selectedRows = []
|
|
|
- this.defaultMode = 'add'
|
|
|
- })
|
|
|
+ var newObj = {}
|
|
|
+ //获取修改的数据
|
|
|
+ this.suplierListData.map(item =>{
|
|
|
+ if(item.status == 0){
|
|
|
+ newObj = item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //校验产能额度上浮区间
|
|
|
+ if(newObj.capacitySection == '' || !newObj.capacitySection){
|
|
|
+ this.$message.error('产能额度上浮区间为必填',1);
|
|
|
+ }else if(newObj.capacitySection < 0 || newObj.capacitySection>100){
|
|
|
+ this.$message.error('产能额度上浮区间必须是大于0小于100',1);
|
|
|
+ }else{
|
|
|
+ if(this.defaultMode == 'add'){
|
|
|
+ newObj.state = '0'
|
|
|
+ addSupplierList(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('新增成功');
|
|
|
+ this.getSupplierList()
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ editSupplierList(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('修改成功');
|
|
|
+ this.getSupplierList()
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.selectedRows = []
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ //清空勾选恢复默认
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.selectedRows = []
|
|
|
+ this.defaultMode = 'add'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
},
|
|
|
cancelLine(){
|
|
|
- if(this.defaultMode == 'add'){
|
|
|
- this.suplierListData.shift()
|
|
|
- }else {
|
|
|
this.getSupplierList()
|
|
|
this.defaultMode ='add'
|
|
|
this.selectedRowKeys=[]
|
|
|
- this.selectedRows = []
|
|
|
- }
|
|
|
+ this.selectedRows = []
|
|
|
},
|
|
|
subitLine(){
|
|
|
if(this.selectedRowKeys.length ==0){
|
|
@@ -408,7 +441,6 @@ export default {
|
|
|
onSelectChange(keys, rows) {
|
|
|
this.selectedRowKeys = keys
|
|
|
this.selectedRows = rows
|
|
|
-
|
|
|
},
|
|
|
// 分页、排序、筛选变化时触发
|
|
|
handleTableChange(pagination, filters, sorter) {
|