|
|
@@ -31,12 +31,14 @@
|
|
|
{name: 0, value: '需求'}, {name: 1, value: '问题'}
|
|
|
],
|
|
|
selectTr: null,
|
|
|
- uploadError:[],
|
|
|
+ uploadError:null,
|
|
|
+ selectDemand:null,
|
|
|
+ selectIndex:null,
|
|
|
},
|
|
|
created() {
|
|
|
let that = this;
|
|
|
this.demands.forEach(function (item,index,self){
|
|
|
- self[index]['status'] = that.status[item['status']].value ?? '';
|
|
|
+ self[index]['status'] = that.status[item['status']]['value'] ?? '';
|
|
|
self[index]['type'] = that.types[item['type']]['value'] ?? '';
|
|
|
});
|
|
|
},
|
|
|
@@ -70,7 +72,7 @@
|
|
|
demand.status = '已处理'
|
|
|
return ;
|
|
|
}
|
|
|
- window.tempTip.show('需求完结失败'+res.data.message);
|
|
|
+ window.tempTip.show('需求完结失败'+res.data.data);
|
|
|
}).catch(err=>{
|
|
|
window.tempTip.show('需求完结异常'+err);
|
|
|
});
|
|
|
@@ -88,38 +90,97 @@
|
|
|
this.$delete(this.demands,index);
|
|
|
return ;
|
|
|
}
|
|
|
- window.tempTip.show(res.data.message);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
}).catch(err=>{
|
|
|
window.tempTip.show('删除出现异常'+err);
|
|
|
});
|
|
|
},
|
|
|
/** 添加处理过程 */
|
|
|
- addProcess(demand,explain){
|
|
|
+ addProcess(demand,$e){
|
|
|
+ let url = '{{url('apiLocal/demand/process/store')}}';
|
|
|
+ let data = {'demand_id':demand['id'],'explain':$($e.target).val()};
|
|
|
+
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.axios.post(url,data).then(res=>{
|
|
|
+ if(res.data.success){
|
|
|
+ demand['processes'].unshfit(res.data.data);
|
|
|
+ this.$forceUpdate();
|
|
|
+
|
|
|
+ window.tempTip.showSuccess('添加处理过程成功')
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ window.tempTip.show('添加处理过程失败')
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.show('添加处理过程异常:'+err);
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
/** 文件上传 */
|
|
|
uploadFile(){
|
|
|
+ let fileInput = document.querySelector('#upLoadFile-input');
|
|
|
+ let url = '{{url('apiLocal/demand/uploadFile')}}';
|
|
|
+
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append('id',this.selectDemand);
|
|
|
+ let file = fileInput.files[0];
|
|
|
+ formData.append('file',file);
|
|
|
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.axios.post(url,formData).then(res=>{
|
|
|
+ if(res.data.success){
|
|
|
+ this.initDemand(res.data.data);
|
|
|
+ this.$set(this.demands,this.selectIndex,res.data.data);
|
|
|
+ $('#uploadFile').modal('hide');
|
|
|
+ window.tempTip.showSuccess('文件上传成功');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.show('文件上传失败');
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.show('文件上传异常:'+err);
|
|
|
+ });
|
|
|
},
|
|
|
/** 修改需求描述 */
|
|
|
- updateDemand(demand,$e){
|
|
|
+ updateDemand(demand,column,$e){
|
|
|
+ let url = '{{url('apiLocal/demand/update')}}';
|
|
|
+ let data = {'id':demand['id']};
|
|
|
+ let value = $($e.target).val();
|
|
|
+ data[column] = value;
|
|
|
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.axios.post(url,data).then(res=>{
|
|
|
+ if(res.data.success){
|
|
|
+ demand[column] = value;
|
|
|
+ this.$forceUpdate();
|
|
|
+ window.tempTip.showSuccess('修改需求成功');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.show('修改需求描述异常:'+err);
|
|
|
+ });
|
|
|
},
|
|
|
/** 问题认领 */
|
|
|
claimDemand(demand,index){
|
|
|
+ console.log(demand);
|
|
|
let url = '{{url('apiLocal/demand/claim')}}';
|
|
|
window.tempTip.setDuration(3000);
|
|
|
window.axios.post(url,{id:demand['id']}).then(res=>{
|
|
|
if(res.data.success){
|
|
|
- window.tempTip.showSuccess('认领成功!');
|
|
|
this.initDemand(res.data.data);
|
|
|
this.$set(this.demands,index,res.data.data);
|
|
|
+ window.tempTip.showSuccess('认领成功!');
|
|
|
return ;
|
|
|
}
|
|
|
- window.tempTip.show(res.data.message);
|
|
|
+ if(res.data.errors)window.tempTip.show(res.data.errors);
|
|
|
+ else window.tempTip.show(res.data.data);
|
|
|
}).catch(err=>{
|
|
|
window.tempTip.show('认领出现异常'+err);
|
|
|
});
|
|
|
+ },
|
|
|
+ showUploadDiv(demand,index){
|
|
|
+ this.selectDemand = demand['id'];
|
|
|
+ this.selectIndex = index;
|
|
|
+ $('#uploadFile').modal('show');
|
|
|
}
|
|
|
}
|
|
|
});
|