fix:项目管理功能需求
This commit is contained in:
@@ -87,6 +87,56 @@ class Hr extends Common
|
||||
|
||||
return $this->sendSuccess($StaffList);
|
||||
}
|
||||
public function GetStaffPage()
|
||||
{
|
||||
|
||||
$param = request()->post();
|
||||
|
||||
$currPage = isset($param['currPage']) ? $param['currPage'] : 1;
|
||||
$pageSize = isset($param['pageSize']) ? $param['pageSize'] : 20;
|
||||
|
||||
$result = db('hr_staff')->alias('i')
|
||||
->join('hr_staff_type t', 'i.staff_type=t.id', 'left')
|
||||
->where('i.del_time',null)
|
||||
->field('i.*, t.desp as staff_type_desp')
|
||||
->page($currPage, $pageSize)
|
||||
->select();
|
||||
|
||||
|
||||
$total = db('hr_staff')->alias('i')
|
||||
->join('hr_staff_type t', 'i.staff_type=t.id', 'left')
|
||||
->where('i.del_time',null)
|
||||
->field('i.*, t.desp as staff_type_desp')
|
||||
->count();
|
||||
//查找员工所属部门信息
|
||||
for ($i=0; $i<count($result); $i++)
|
||||
{
|
||||
$dept_arr = explode(",", $result[$i]['staff_dept']);
|
||||
$dept_desp = db('hr_dept')->where('dept_id', 'in', $dept_arr)->column('dept_name');
|
||||
$result[$i]['staff_dept_desp'] = implode(',', $dept_desp);
|
||||
}
|
||||
|
||||
|
||||
$StaffList = [];
|
||||
if (isset($param['type']))
|
||||
{
|
||||
for ($i=0; $i<count($result); $i++)
|
||||
{
|
||||
$dept_arr = explode(",", $result[$i]['staff_dept']);
|
||||
if (in_array($param['type'], $dept_arr))
|
||||
{
|
||||
$StaffList[] = $result[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$StaffList = $result;
|
||||
}
|
||||
$res['list'] = $StaffList;
|
||||
$res['total'] = $total;
|
||||
return $this->sendSuccess($res);
|
||||
}
|
||||
|
||||
//获取项目部门所有的员工信息
|
||||
public function GetProjectDeptStaffList()
|
||||
|
||||
@@ -197,7 +197,18 @@ class Project extends Common
|
||||
{
|
||||
$ProjectInfo['project_manager'] = $ret['staff_name'];
|
||||
}
|
||||
|
||||
$ProjectInfo['sale_name'] = '';
|
||||
if (!empty($ProjectInfo['sale_manager'])){
|
||||
$retSale = db('system_user')->alias('u')
|
||||
->join('hr_staff s','s.staff_id=u.user_id', 'left')
|
||||
->where('u.user_type', 1)
|
||||
->where('u.id', $ProjectInfo['sale_manager'])
|
||||
->find();
|
||||
if (null != $retSale)
|
||||
{
|
||||
$ProjectInfo['sale_name'] = $retSale['staff_name'];
|
||||
}
|
||||
}
|
||||
return $this->sendSuccess($ProjectInfo);
|
||||
}
|
||||
|
||||
@@ -260,32 +271,40 @@ class Project extends Common
|
||||
|
||||
$project_id = $param['project_id'];
|
||||
$remove_member = $param['staff_id'].'';
|
||||
|
||||
|
||||
|
||||
|
||||
$ret = db('project_info')->where('project_id', $project_id)->find();
|
||||
$member_arr = explode(',', $ret['involve_members']);
|
||||
|
||||
|
||||
// 使用array_filter()函数删除指定值
|
||||
$resultArray = array_filter($member_arr, function ($value) use ($remove_member) {
|
||||
return $value !== $remove_member;
|
||||
});
|
||||
|
||||
|
||||
$update['involve_members'] = implode(',', $resultArray);
|
||||
|
||||
$update['involve_members'] = implode(',', $resultArray);
|
||||
$ret = db('project_info')->where('project_id',$project_id)->update($update);
|
||||
|
||||
|
||||
return $this->sendSuccess('移除成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function UpdateProjectMember()
|
||||
{
|
||||
$param = request()->post();
|
||||
|
||||
|
||||
$update['involve_members'] = implode(',', $param['involve_members']); //数组转字符串
|
||||
$ret = db('project_info')->where('project_id',$param['project_id'])->update($update);
|
||||
return $this->sendSuccess('更新成功');
|
||||
}
|
||||
public function UpdateSaleManager()
|
||||
{
|
||||
$param = request()->post();
|
||||
|
||||
$update['sale_manager'] = $param['sale_manager']; //数组转字符串
|
||||
$ret = db('project_info')->where('project_id',$param['project_id'])->update($update);
|
||||
return $this->sendSuccess('更新成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,23 +49,31 @@ class Story extends Common
|
||||
$members = explode(',', $opStory['story_member']);
|
||||
$opStory['story_members'] = '';
|
||||
|
||||
$ret = [];
|
||||
for ($i=0; $i<count($members); $i++)
|
||||
{
|
||||
$user_info = $user->GetUserInfoByLoginId($members[$i]);
|
||||
if ($user_info && isset($user_info['name'])) {
|
||||
$ret[] = $user_info['name'];
|
||||
}
|
||||
}
|
||||
$opStory['story_members'] = implode(',', $ret);
|
||||
|
||||
$opStory['story_managers'] = '';
|
||||
if ($opStory['story_manager'] !== null) {
|
||||
$user_info = $user->GetUserInfoByLoginId($opStory['story_manager']);
|
||||
if ($user_info && isset($user_info['name'])) {
|
||||
$opStory['story_managers'] = $user_info['name'];
|
||||
}
|
||||
$opStory['story_members'] = '';
|
||||
if (count($members)>0)
|
||||
{
|
||||
$ret = db('system_user')->alias('u')
|
||||
->join('hr_staff s','s.staff_id=u.user_id', 'left')
|
||||
->where('u.user_type', 1)
|
||||
->where('u.id', 'in', $members)
|
||||
->column('s.staff_name');
|
||||
|
||||
$opStory['story_members'] = implode(',', $ret); //数组转字符串
|
||||
}
|
||||
$opStory['story_managername'] = '';
|
||||
|
||||
$ret = db('system_user')->alias('u')
|
||||
->join('hr_staff s','s.staff_id=u.user_id', 'left')
|
||||
->where('u.user_type', 1)
|
||||
->where('u.id', $opStory['story_manager'])
|
||||
->find();
|
||||
|
||||
if (null != $ret)
|
||||
{
|
||||
$opStory['story_managername'] = $ret['staff_name'];
|
||||
}
|
||||
|
||||
|
||||
$result[] = $opStory;
|
||||
}
|
||||
@@ -185,12 +193,12 @@ class Story extends Common
|
||||
->where('story_id', $param['story_id'])
|
||||
->find();
|
||||
if ($story_info) {
|
||||
|
||||
|
||||
$user = new User();
|
||||
|
||||
|
||||
$story_info_member = explode(',', $story_info['story_member']);
|
||||
foreach ($story_info_member as $memberId) {
|
||||
|
||||
|
||||
$user_info = $user->GetUserInfoByLoginId($memberId);
|
||||
$item['id'] = $user_info['id'];
|
||||
$item['staff_name'] = $user_info['name'];
|
||||
|
||||
@@ -42,7 +42,7 @@ class User extends Common
|
||||
->find();
|
||||
if ($ret != null)
|
||||
{
|
||||
$ret['company'] = "苏州维达奇智能科技有限公司";
|
||||
$ret['company'] = "上海诺力智能科技有限公司";
|
||||
}
|
||||
}
|
||||
//客户
|
||||
@@ -318,7 +318,7 @@ class User extends Common
|
||||
->find();
|
||||
if ($ret != null)
|
||||
{
|
||||
$ret['company'] = "苏州维达奇智能科技有限公司";
|
||||
$ret['company'] = "上海诺力智能科技有限公司";
|
||||
}
|
||||
$ret['id'] = $login_id;
|
||||
$ret['name'] = $res['user_name'];
|
||||
|
||||
@@ -297,6 +297,15 @@ class Project extends Common
|
||||
$ret = db('project_info')->where('project_id',$param['project_id'])->update($update);
|
||||
return $this->sendSuccess('更新成功');
|
||||
}
|
||||
|
||||
public function UpdateSaleManager()
|
||||
{
|
||||
$param = request()->post();
|
||||
|
||||
$update['sale_manager'] = $param['sale_manager']; //数组转字符串
|
||||
$ret = db('project_info')->where('project_id',$param['project_id'])->update($update);
|
||||
return $this->sendSuccess('更新成功');
|
||||
}
|
||||
|
||||
//添加项目外部成员
|
||||
public function AddProjectExternalMember()
|
||||
|
||||
@@ -42,7 +42,7 @@ class User extends Common
|
||||
->find();
|
||||
if ($ret != null)
|
||||
{
|
||||
$ret['company'] = "苏州维达奇智能科技有限公司";
|
||||
$ret['company'] = "上海诺力智能科技有限公司";
|
||||
}
|
||||
}
|
||||
//客户
|
||||
@@ -318,7 +318,7 @@ class User extends Common
|
||||
->find();
|
||||
if ($ret != null)
|
||||
{
|
||||
$ret['company'] = "苏州维达奇智能科技有限公司";
|
||||
$ret['company'] = "上海诺力智能科技有限公司";
|
||||
}
|
||||
$ret['id'] = $login_id;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ return [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
// 服务器地址
|
||||
'hostname' => '127.0.0.1',
|
||||
'hostname' => '192.168.81.251',
|
||||
// 数据库名
|
||||
'database' => 'oms',
|
||||
// 用户名
|
||||
'username' => 'root',
|
||||
// 密码
|
||||
'password' => '12356',
|
||||
'password' => 'P@ssw0rd.',
|
||||
// 端口
|
||||
'hostport' => '',
|
||||
// 连接dsn
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"topthink/think-oracle": "1.*",
|
||||
"phpoffice/phpexcel": "^1.8",
|
||||
"aliyuncs/oss-sdk-php": "^2.3",
|
||||
"topthink/think-worker": "^3.0"
|
||||
"topthink/think-worker": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -37,6 +37,9 @@
|
||||
"think-path": "thinkphp"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist"
|
||||
"preferred-install": "dist",
|
||||
"allow-plugins": {
|
||||
"topthink/think-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user