Esempio n. 1
0
 public function getAttribute()
 {
     $process_id = Request::get('id', null);
     $op = Request::get('op', 'basic');
     try {
         $process = FlowProcess::findOrFail($process_id);
     } catch (ModelNotFoundException $exc) {
         return response('未找到步骤信息');
     }
     $flow = $process->flow;
     if ($flow->flow_type == 1) {
         return response('自由流程不用设置步骤');
     }
     try {
         $form = Form::findOrFail($flow->form_id);
     } catch (ModelNotFoundException $exc) {
         return response('未找到表单信息');
     }
     //转出条件 但没 process_to
     if ($op == 'judge' && !$process['process_to']) {
         return response('请先设置属性 -> 选择下一步步骤');
     }
     $process['out_condition'] = $process->getOutCondition($form);
     //json
     $map = array('flow_id' => $flow->id);
     $process_list = DB::table('flow_process')->where($map)->get(explode(',', 'id,process_name,process_type'));
     $flow_list = DB::table('flow')->get(explode(',', 'id,flow_name'));
     $data = ['op' => $op, 'one' => $process->toArray(), 'form_one' => $form->toArray(), 'form_plugin' => config('design.flow'), 'process_to_list' => $process_list, 'child_flow_list' => $flow_list];
     return view('admin.flow.attribute', $data);
 }
Esempio n. 2
0
 public function postSubmit()
 {
     $id = Request::get('form_id');
     try {
         $obj = Form::findOrFail($id);
     } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $exc) {
         return response('not found');
     }
     $conn = Schema::getConnection();
     $manager = $conn->getDoctrineSchemaManager();
     $data = new FormData();
     $data->setTable($id);
     $list = $manager->listTableColumns($conn->getTablePrefix() . $data->getTable());
     $all = Request::all();
     foreach ($list as $k => $v) {
         if (!strstr($k, 'form_') && !strstr($k, 'data_')) {
             continue;
         }
         if (array_key_exists($k, $all)) {
             $data->{$k} = $all[$k];
         }
     }
     $data->user_id = Request::user()->id;
     $ret = $data->save();
     return redirect('/admin/form/submit?id=' . $id);
 }