diff --git a/Admin/Lib/Action/DailyTaskAction.class.php b/Admin/Lib/Action/DailyTaskAction.class.php index 25b2d51..7365bcf 100644 --- a/Admin/Lib/Action/DailyTaskAction.class.php +++ b/Admin/Lib/Action/DailyTaskAction.class.php @@ -29,7 +29,6 @@ public function index() { } $model = new DailyTaskViewModel(); $this->_list($model, $map, 'task_date', false, 'DailyTask.id'); - $this->display(); } @@ -49,6 +48,12 @@ function edit() { $vo = $map; } } + // 查询业务分组 + $branch = M('Branch'); + $map = array(); + $map['status'] = 1; + $sortList = $branch->where($map)->order('sort asc')->select(); + $this->assign("branch",$sortList); $this->assign ( 'vo', $vo ); $this->display (); @@ -57,9 +62,15 @@ function edit() { function update() { $user_id = $_REQUEST ['user_id']; $task_date = $_REQUEST ['task_date']; + $bid = $_REQUEST['bid']; if (empty($user_id)) $this->error('用户ID必须'); if (empty($task_date)) $this->error('Task日期必须'); + if (empty($bid)) $this->error('请选择业务'); + + $branch = M('branch'); + $where = array('id' => $bid, 'status' => 1); + $res = $branch->where($where)->field('id,title')->find(); if (! D('User')->isSameDepartment($user_id)) { $this->error('不能修改其它部门工作日志'); @@ -76,6 +87,8 @@ function update() { if (false === $model->create ()) { $this->error ( $model->getError () ); } + + $model->btmp_title = $res['title']; $list = $model->add (); } else { // 更新数据 $_POST ['id'] = $po['id']; @@ -84,6 +97,7 @@ function update() { $this->error ( $model->getError () ); } + $model->btmp_title = $res['title']; $list = $model->save (); } diff --git a/Admin/Lib/Model/DailyTaskViewModel.class.php b/Admin/Lib/Model/DailyTaskViewModel.class.php index 7b87c42..70f2f3a 100644 --- a/Admin/Lib/Model/DailyTaskViewModel.class.php +++ b/Admin/Lib/Model/DailyTaskViewModel.class.php @@ -3,8 +3,9 @@ class DailyTaskViewModel extends ViewModel { public $viewFields = array( 'User'=>array('nickname'=>'nickname','email'=>'email','account'=>'account', 'department'=>'department'), - 'DailyTask'=>array('id', 'user_id', 'content','task_date','create_time','day_num', - '_on'=>'User.id=DailyTask.user_id') + 'DailyTask'=>array('id', 'user_id', 'content','task_date','create_time','day_num','bid','btmp_title', + '_on'=>'User.id=DailyTask.user_id'), + 'Branch'=>array('id'=>'bid','username'=>'username','_on'=>'Branch.id=DailyTask.bid'), ); } ?> \ No newline at end of file diff --git a/Admin/Tpl/DailyTask/edit.html b/Admin/Tpl/DailyTask/edit.html index c9bea29..2b8d754 100644 --- a/Admin/Tpl/DailyTask/edit.html +++ b/Admin/Tpl/DailyTask/edit.html @@ -11,6 +11,7 @@