|
@@ -41,7 +41,7 @@
|
|
|
<a-button type="primary" icon="plus" @click="delectLLine">删除</a-button>
|
|
|
<a-button type="primary" icon="plus" @click="saveLine">保存</a-button>
|
|
|
<a-button type="primary" icon="plus" @click="cancelLine">取消</a-button>
|
|
|
- <a-button type="primary" icon="plus" @change="subitLine">提交</a-button>
|
|
|
+ <a-button type="primary" icon="plus" @click="subitLine">提交</a-button>
|
|
|
<a-button type="primary" icon="plus" @click="cancelSubitLine">取消提交</a-button>
|
|
|
</div>
|
|
|
|
|
@@ -109,7 +109,7 @@
|
|
|
<!-- 供应商状态 -->
|
|
|
<template slot="supplierState" slot-scope="text, record, index" >
|
|
|
<a-form-model-item prop="supplierState" :rules="rules.supplierState" v-if="record.status == '0'">
|
|
|
- <a-select v-model="record.supplierState1" style="width: 200px" placeholder="请选择发货情况" >
|
|
|
+ <a-select v-model="record.supplierState" style="width: 200px" placeholder="请选择发货情况" >
|
|
|
<a-select-option value="正常">正常</a-select-option>
|
|
|
<a-select-option value="关闭">关闭</a-select-option>
|
|
|
</a-select>
|
|
@@ -223,7 +223,6 @@ export default {
|
|
|
this.getSupplierList()
|
|
|
option().then(res => {
|
|
|
this.option = res
|
|
|
- debugger
|
|
|
})
|
|
|
},
|
|
|
computed: {},
|
|
@@ -232,19 +231,22 @@ export default {
|
|
|
// 分页查询
|
|
|
getSupplierList(){
|
|
|
this.$nextTick(() => {
|
|
|
- this.queryParam.pageSize = 20
|
|
|
- supplierList(this.queryParam).then(res => {
|
|
|
+ // this.queryParam.pageSize = 20
|
|
|
+ supplierList({supplier:this.queryParam.supplier}).then(res => {
|
|
|
if (res.success) {
|
|
|
- this.suplierListData = res.result.records;
|
|
|
+ this.suplierListData = res.result;
|
|
|
this.loading = false
|
|
|
this.pagination = {
|
|
|
total: res.result.total,
|
|
|
current: res.result.current,
|
|
|
pageSize: res.result.size
|
|
|
}
|
|
|
- this.suplierListData.map(item=>{
|
|
|
- item.status = '1'
|
|
|
- })
|
|
|
+ if(this.suplierListData.length !== 0){
|
|
|
+ this.suplierListData.map(item=>{
|
|
|
+ item.status = '1'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}else{
|
|
|
this.$message.error(res.message);
|
|
|
}
|
|
@@ -274,6 +276,8 @@ export default {
|
|
|
this.$message.error('请勾选需要修改的数据');
|
|
|
}else if(this.selectedRowKeys.length > 1){
|
|
|
this.$message.error('一次只允许修改一行数据');
|
|
|
+ }else if(this.selectedRows[0].state =='1'){
|
|
|
+ this.$message.error('已提交数据不可修改');
|
|
|
}else{
|
|
|
this.suplierListData.map(item =>{
|
|
|
if(item.supplierState == this.selectedRows[0].supplierState){
|
|
@@ -286,7 +290,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
changeSuplier(val,record){
|
|
|
- debugger
|
|
|
this.option.map(item =>{
|
|
|
if(item.supplier == val) {
|
|
|
record.supplierCode = item.supplier_code
|
|
@@ -294,19 +297,31 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
delectLLine(){
|
|
|
- var ids = this.selectedRowKeys.toString()
|
|
|
- deleteSupplierList({ids}).then(res => {
|
|
|
+ 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{
|
|
|
+ var objNew = this.selectedRows[0]
|
|
|
+ objNew.state = '-1'
|
|
|
+ editSupplierList(objNew).then(res => {
|
|
|
if (res.success) {
|
|
|
this.$message.success('删除成功');
|
|
|
this.getSupplierList()
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.selectedRows = []
|
|
|
}else{
|
|
|
this.$message.error(res.message);
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
saveLine(){
|
|
|
if(this.defaultMode == 'add'){
|
|
|
var syCapacityControl = this.suplierListData[0]
|
|
|
+ syCapacityControl.state = '0'
|
|
|
addSupplierList(syCapacityControl).then(res => {
|
|
|
if (res.success) {
|
|
|
this.$message.success('新增成功');
|
|
@@ -345,10 +360,49 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
subitLine(){
|
|
|
+ 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 {
|
|
|
+ var objNew = this.selectedRows[0]
|
|
|
+ objNew.state = '1'
|
|
|
+ editSupplierList(objNew).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('提交成功');
|
|
|
+ this.getSupplierList()
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.selectedRows = []
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
},
|
|
|
cancelSubitLine(){
|
|
|
-
|
|
|
+ if(this.selectedRowKeys.length ==0){
|
|
|
+ this.$message.error('请勾选需要取消提交的数据');
|
|
|
+ }else if(this.selectedRowKeys.length > 1){
|
|
|
+ this.$message.error('一次只可取消一行');
|
|
|
+ }else if(this.selectedRows[0].state == '0'){
|
|
|
+ this.$message.error('选择的数据未提交');
|
|
|
+ }else{
|
|
|
+ var objNew = this.selectedRows[0]
|
|
|
+ objNew.state = '0'
|
|
|
+ editSupplierList(objNew).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('取消提交成功');
|
|
|
+ this.getSupplierList()
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.selectedRows = []
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 选中行
|
|
|
onSelectChange(keys, rows) {
|