| xqd
@@ -91,14 +91,43 @@ class TableController extends CommonController
|
|
|
// $v = json_encode($request->all());
|
|
|
// 解析json为对象
|
|
|
// $a = json_decode($v);
|
|
|
-
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
- public function submit($user_id)
|
|
|
+// $table_id表格自增id
|
|
|
+// 完成表单提交
|
|
|
+ public function submit(Request $request,$table_id)
|
|
|
{
|
|
|
+ $user = session('user');
|
|
|
+ $input = $request->only('project_name','bzc_name','bzc_cardid','bzc_addr','bzc_area','house_type','bzc_tel','used','num','table_time');
|
|
|
+ $data = $input;
|
|
|
+
|
|
|
+ $data['user_id'] = $user->id;
|
|
|
+ if($data['bzc_area'] == null){
|
|
|
+ $data['bzc_area'] = 0;
|
|
|
+ }
|
|
|
+ if($data['house_type'] == null){
|
|
|
+ $data['house_type'] = '默认:住房';
|
|
|
+ }
|
|
|
// 0:未提交 1已核算 2已复核 3已提交 4:已初审 5:已复审 6已监审
|
|
|
- return 1;
|
|
|
+ $find = Tablelist::find($table_id);
|
|
|
+ if($find){
|
|
|
+ //提交一次,在原status值上加1
|
|
|
+ $data['status'] = $find['status'] + 1;
|
|
|
+ $re = Tablelist::where('id',$table_id)->update($data);
|
|
|
+ if($re){
|
|
|
+ return redirect('/on_table');
|
|
|
+ }else{
|
|
|
+ return back()->with('errors','提交失败,请检查重试!');
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $re = Tablelist::create($data);
|
|
|
+ $data['status'] = '0';
|
|
|
+ if($re){
|
|
|
+ return redirect('/on_table');
|
|
|
+ }else{
|
|
|
+ return back()->with('errors','提交失败,请检查重试!');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function delete($table_id)
|
| xqd
@@ -174,7 +203,7 @@ class TableController extends CommonController
|
|
|
if($re){
|
|
|
return redirect('/on_table/');
|
|
|
}else{
|
|
|
- return back()->with('msg','保存更新错误,请稍后重试!');
|
|
|
+ return back()->with('errors','保存更新错误,请稍后重试!');
|
|
|
}
|
|
|
}
|
|
|
|