|
|
@@ -55,24 +55,23 @@
|
|
|
methods:{
|
|
|
destroy(id,index){
|
|
|
if (!confirm('是否删除当前供应商')) return;
|
|
|
+ tempTip.setIndex(1009);
|
|
|
+ tempTip.setDuration(3000);
|
|
|
axios.delete('{{url('apiLocal/supplier')}}/'+id).then(res=>{
|
|
|
if(res.data.success){
|
|
|
- tempTip.setIndex(100);
|
|
|
- tempTip.setDuration(3000);
|
|
|
tempTip.showSuccess('删除成功');
|
|
|
this.$delete(this.suppliers,index);
|
|
|
return ;
|
|
|
}
|
|
|
- tempTip.setDuration(3000);
|
|
|
tempTip.show(res.data.message);
|
|
|
}).catch(err=>{
|
|
|
- tempTip.setDuration(3000);
|
|
|
tempTip.show('删除当前项目耗材失败:'+err);
|
|
|
});
|
|
|
},
|
|
|
edit(supplier,i){
|
|
|
this.editSupplier = JSON.parse(JSON.stringify(supplier));
|
|
|
- this.supplierErrors = {material_id:[]};
|
|
|
+ this.editSupplier.material_id = [];
|
|
|
+ this.supplierErrors = {material_id:[]}; // 重置异常信息
|
|
|
supplier.material.forEach((item)=>{
|
|
|
this.editSupplier.material_id.push(item.id);
|
|
|
});
|
|
|
@@ -85,11 +84,10 @@
|
|
|
window.tempTip.setDuration(2000);
|
|
|
window.axios.post(url,editSupplier).then(res=>{
|
|
|
if(res.data.success){
|
|
|
- this.$set(this.suppliers,index,res.data);
|
|
|
- this.index = null;
|
|
|
- this.editSupplier = {};
|
|
|
- this.material_id = [];
|
|
|
- $("#edit-supplier").modal('hiupdatede');
|
|
|
+ this.$set(this.suppliers,index,res.data.data);
|
|
|
+ this.selectIndex = null;
|
|
|
+ this.editSupplier = {material_id:[]};
|
|
|
+ $("#edit-supplier").modal('hide');
|
|
|
window.tempTip.showSuccess("修改成功")
|
|
|
return;
|
|
|
}else if(res.data.errors){
|
|
|
@@ -102,8 +100,8 @@
|
|
|
});
|
|
|
},
|
|
|
store(){
|
|
|
- this.addSupplier = {};
|
|
|
- this.supplierErrors = {material_id:[]};
|
|
|
+ this.addSupplier = {material_id:[]};
|
|
|
+ this.supplierErrors = {material_id:null};
|
|
|
$('#add-supplier').modal('show');
|
|
|
},
|
|
|
create(supplier){
|
|
|
@@ -113,8 +111,7 @@
|
|
|
window.axios.post(url,supplier).then(res=>{
|
|
|
if(res.data.success){
|
|
|
this.suppliers.unshift(res.data.data);
|
|
|
- this.addSupplier = {};
|
|
|
- this.material_id = [];
|
|
|
+ this.addSupplier = {material_id:[]};
|
|
|
$("#edit-supplier").modal('hide');
|
|
|
window.tempTip.showSuccess("创建成功")
|
|
|
return;
|