integrate delete supplier

This commit is contained in:
Too
2018-07-04 14:35:42 +08:00
parent 080851675c
commit 55455b89d7
2 changed files with 48 additions and 24 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ class Kernel extends HttpKernel
],
'api' => [
'throttle:60,1',
// 'throttle:60,1',
'bindings',
],
];
@@ -10,7 +10,7 @@
<el-table-column label="Action">
<template slot-scope="scope">
<el-button type="text" size="small" @click="EditSupplierdialogVisible = true">Edit</el-button>
<el-button type="text" size="small" @click="DeleteSupplierdialogVisible = true">Delete</el-button>
<el-button type="text" size="small" @click="DeleteSupplier(tableData[scope.$index].id)">Delete</el-button>
</template>
</el-table-column>
</el-table><br>
@@ -77,29 +77,29 @@ var client = require('./client');
data() {
return {
tableData: [],
AddNewSupplierdialogVisible: false,
EditSupplierdialogVisible: false,
DoneAddSupplierdialogVisible: false,
DoneUpdateSupplierdialogVisible: false,
DeleteSupplierdialogVisible: false,
supplierForm : {
company_name: '',
supplier_reg_no: '',
gst_no: '',
bank_name: '',
acc_no: '',
}
},
AddNewSupplierdialogVisible: false,
EditSupplierdialogVisible: false,
DoneAddSupplierdialogVisible: false,
DoneUpdateSupplierdialogVisible: false,
DeleteSupplierdialogVisible: false,
}
},
beforeMount(){
this.GetTableData();
this.UpdateTableData();
},
methods:{
CreateSupplier : function(){
this.DoneAddSupplierdialogVisible = false;
client.post('api/setting-supplier', this.supplierForm)
.then((response) => {
// anything
this.ClearSupplierForm();
})
.catch((error) => {
console.log(error);
@@ -111,21 +111,45 @@ var client = require('./client');
});
})
},
GetTableData : function(){
UpdateTableData : function(){
client.get('api/setting-supplier', this.supplierForm)
.then((response) => {
this.tableData = response.data;
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
})
.then((response) => {
this.tableData = response.data;
this.UpdateTableData();
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
})
},
DeleteSupplier : function(supplier_id){
this.DeleteSupplierdialogVisible = true;
client.delete('api/setting-supplier/' + supplier_id)
.then((response) => {
this.UpdateTableData();
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Delete data fail',
type: 'error',
duration: 10000
});
})
},
ClearSupplierForm : function(){
supplierForm.company_name = '';
supplierForm.supplier_reg_no = '';
supplierForm.gst_no = '';
supplierForm.bank_name = '';
supplierForm.companacc_noy_name = '';
}
}
}
</script>
</script>