Skip to content

Commit

Permalink
新增业务选择
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchuncheng committed Feb 27, 2019
1 parent 0786f14 commit e86cf9d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
16 changes: 15 additions & 1 deletion Admin/Lib/Action/DailyTaskAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function index() {
}
$model = new DailyTaskViewModel();
$this->_list($model, $map, 'task_date', false, 'DailyTask.id');

$this->display();
}

Expand All @@ -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 ();
Expand All @@ -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('不能修改其它部门工作日志');
Expand All @@ -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'];
Expand All @@ -84,6 +97,7 @@ function update() {
$this->error ( $model->getError () );
}

$model->btmp_title = $res['title'];
$list = $model->save ();
}

Expand Down
5 changes: 3 additions & 2 deletions Admin/Lib/Model/DailyTaskViewModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
);
}
?>
14 changes: 13 additions & 1 deletion Admin/Tpl/DailyTask/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ <h2 class="contentTitle">编写工作日志</h2>
<dt>昵称:</dt>
<dd><input type="text" name="nickname" value="{$vo.user_id|attrById='user','nickname',###}" disabled></dd>
</dl>

<dl>
<dt>日期:</dt>
<dd>
Expand All @@ -19,12 +20,23 @@ <h2 class="contentTitle">编写工作日志</h2>
<a class="unit" style="font-weight: bold; color:red;" href="__URL__/edit/user_id/{$vo.user_id}/task_date/{dailyTask_taskDate}" target="navTab" rel="DailyTaskOpt" title="写工作日志"><span>Reload</span></a>
</dd>
</dl>

<dl>
<dt>业务:</dt>
<dd>
<select name="bid" class="required">
<option value="">请选择</option>
<voList name="branch" id="br" key="$key">
<option value="{$br.id}" <?php if ($br['id']==$vo['bid']){ ?>selected<?php };?>>{$br.title}||{$br.username}</option>
</voList>
</select>
</dd>
</dl>
<dl class="nowrap">
<dt>内容:</dt>
<dd><textarea class="required" name="content" rows="10" cols="85" onkeydown="checkTextareaFormSubmit(this)">{$vo.content}</textarea>
<span class="info">内容:纯文本,一行写一个工作任务,提交快捷键Ctrl+Enter</span></dd>
</dl>

</div>
<div class="formBar">
<ul>
Expand Down
4 changes: 4 additions & 0 deletions Admin/Tpl/DailyTask/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
<th width="80" orderField="nickname" <if condition="$_REQUEST._order eq 'nickname'">class="{$_REQUEST._sort}"</if>>昵称</th>
<th width="80" orderField="department" <if condition="$_REQUEST._order eq 'department'">class="{$_REQUEST._sort}"</if>>部门</th>
<th>内容</th>
<th width="80" orderField="btmp_title" <if condition="$_REQUEST._order eq 'btmp_title'">class="{$_REQUEST._sort}"</if>>业务</th>
<th width="80" orderField="username" <if condition="$_REQUEST._order eq 'username'">class="{$_REQUEST._sort}"</if>>产品经理</th>
<th width="80" orderField="task_date" <if condition="$_REQUEST._order eq 'task_date'">class="{$_REQUEST._sort}"</if>>日期</th>
<th width="130" orderField="create_time" <if condition="$_REQUEST._order eq 'create_time'">class="{$_REQUEST._sort}"</if>>添加时间</th>
</tr>
Expand All @@ -57,6 +59,8 @@
<td>{$vo['nickname']}</td>
<td>{$vo['department']|C='departments.'.###}</td>
<td><?php echo str_replace($search, $replace, $vo['content']) ?></td>
<td>{$vo['btmp_title']}</td>
<td>{$vo['username']}</td>
<td>{$vo['task_date']}</td>
<td>{$vo['create_time']|date="Y-m-d H:i:s",###}</td>
</tr>
Expand Down

1 comment on commit e86cf9d

@zhanghuihua
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码和表结构sql语句全部提交了吗?
我看到php代码中 M('branch');
没看到提交表结构sql脚本

Please sign in to comment.