
2、新增:企业员工管理新增离职状态查询; 3、新增:离职档案新增一键资料转移功能,把项目、任务、客户、合同等资料交接到交接人上; 4、新增:任务新增前置任务,如果存在前置任务的,需要把前置任务完成后才能完成当前任务; 5、新增:任务新增子任务功能; 6、修复:新增项目文档成功后,跳转报错的问题; 7、优化:任务进度与任务状态联动,任务完成时,进度默认设置为100%,任务设置进度时,如果任务未开始,状态默认设置为进行中; 8、删除:去除项目选择项目时间周期的联动操作; 9、优化:项目选择弹层操作; 10、修复:修复自定义tab打开时,左侧二级菜单宽度未收回的问题; 11、优化:客户选择弹层添加‘新增客户’的按钮,方便快捷新建客户; 12、优化:工作台项目、任务、知识位置调整优化; 注意:本次数据结构更新代码如下: ALTER TABLE `oa_personal_quit` ADD COLUMN `connect_id` int(11) NOT NULL DEFAULT 0 COMMENT '资料交接人' AFTER `connect_uids`; ALTER TABLE `oa_personal_quit` ADD COLUMN `connect_time` int(11) NOT NULL DEFAULT 0 COMMENT '资料交接时间' AFTER `connect_id`; ALTER TABLE `oa_personal_quit` MODIFY COLUMN `connect_uids` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '参与交接人,多' AFTER `lead_admin_id`; ALTER TABLE `oa_project_task` ADD COLUMN `pid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '父任务id' AFTER `title`; ALTER TABLE `oa_project_task` ADD COLUMN `before_task` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '前置任务id' AFTER `priority`; ALTER TABLE `oa_project_task` MODIFY COLUMN `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '任务类型(预留字段)' AFTER `cate`;
249 lines
12 KiB
PHP
249 lines
12 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2022 勾股工作室
|
|
* @license https://opensource.org/licenses/GPL-3.0
|
|
* @link https://www.gougucms.com
|
|
*/
|
|
|
|
declare (strict_types = 1);
|
|
namespace app\project\model;
|
|
|
|
use think\facade\Db;
|
|
use think\Model;
|
|
|
|
class ProjectLog extends Model
|
|
{
|
|
public static $Sourse = [
|
|
'project' => [
|
|
'status' => ['','未开始', '进行中', '已完成', '已关闭'],
|
|
'field_array' => [
|
|
'director_uid' => array('icon' => 'icon-xueshengzhuce', 'title' => '负责人'),
|
|
'start_time' => array('icon' => 'icon-kaoshijihua', 'title' => '预计开始时间'),
|
|
'end_time' => array('icon' => 'icon-kaoshijihua', 'title' => '预计结束时间'),
|
|
'name' => array('icon' => 'icon-wodedianping', 'title' => '标题'),
|
|
'status' => array('icon' => 'icon-wodedianping', 'title' => '状态'),
|
|
'content' => array('icon' => 'icon-wodedianping', 'title' => '描述'),
|
|
'file' => array('icon' => 'icon-sucaiziyuan', 'title' => '文件'),
|
|
'contract_id' => array('icon' => 'icon-hetongguanli', 'title' => '合同'),
|
|
'customer_id' => array('icon' => 'icon-jiaoshiguanli', 'title' => '客户'),
|
|
'link' => array('icon' => 'icon-sucaiziyuan', 'title' => '链接'),
|
|
'user' => array('icon' => 'icon-xueshengzhuce', 'title' => '成员'),
|
|
'new' => array('icon' => 'icon-zidingyishezhi', 'title' => '项目'),
|
|
'delete' => array('icon' => 'icon-shanchu', 'title' => '项目'),
|
|
]],
|
|
'task' => [
|
|
'priority' => ['', '低', '中', '高', '紧急'],
|
|
'flow_status' => ['', '未开始', '进行中', '已完成', '已拒绝', '已关闭'],
|
|
'type' => ['', '需求', '设计', '研发', '缺陷'],
|
|
'field_array' => [
|
|
'director_uid' => array('icon' => 'icon-xueshengzhuce', 'title' => '负责人'),
|
|
'assist_admin_ids' => array('icon' => 'icon-xueshengbaoming', 'title' => '协作人'),
|
|
'end_time' => array('icon' => 'icon-kaoshijihua', 'title' => '预计结束时间'),
|
|
'title' => array('icon' => 'icon-wodedianping', 'title' => '标题'),
|
|
'flow_status' => array('icon' => 'icon-wodedianping', 'title' => '任务状态'),
|
|
'plan_hours' => array('icon' => 'icon-wodedianping', 'title' => '工时'),
|
|
'priority' => array('icon' => 'icon-wodedianping', 'title' => '等级'),
|
|
'type' => array('icon' => 'icon-wodedianping', 'title' => '任务类型'),
|
|
'cate' => array('icon' => 'icon-wodedianping', 'title' => '任务类别'),
|
|
'done_ratio' => array('icon' => 'icon-wodedianping', 'title' => '完成进度'),
|
|
'project_id' => array('icon' => 'icon-wodedianping', 'title' => '关联项目'),
|
|
'before_task' => array('icon' => 'icon-wodedianping', 'title' => '前置任务'),
|
|
'content' => array('icon' => 'icon-wodedianping', 'title' => '描述'),
|
|
'file' => array('icon' => 'icon-sucaiziyuan', 'title' => '文件'),
|
|
'new' => array('icon' => 'icon-zidingyishezhi', 'title' => '任务'),
|
|
'delete' => array('icon' => 'icon-shanchu', 'title' => '任务'),
|
|
]],
|
|
'document' => [
|
|
'field_array' => [
|
|
'title' => array('icon' => 'icon-wodedianping', 'title' => '标题'),
|
|
'project_id' => array('icon' => 'icon-wodedianping', 'title' => '关联项目'),
|
|
'content' => array('icon' => 'icon-wodedianping', 'title' => '描述'),
|
|
'new' => array('icon' => 'icon-zidingyishezhi', 'title' => '任务'),
|
|
'delete' => array('icon' => 'icon-shanchu', 'title' => '任务'),
|
|
]]
|
|
];
|
|
|
|
public function get_list($param = [])
|
|
{
|
|
$where = array();
|
|
$where['a.module'] = $param['m'];
|
|
$where['a.' . $param['m'] . '_id'] = $param['tid'];
|
|
$content = Db::name('ProjectLog')
|
|
->field('a.*,u.name')
|
|
->alias('a')
|
|
->join('Admin u', 'u.id = a.admin_id')
|
|
->order('a.create_time desc')
|
|
->where($where)
|
|
->select()->toArray();
|
|
$sourse = self::$Sourse[$param['m']];
|
|
$action = get_config('log.type_action');
|
|
$field_array = $sourse['field_array'];
|
|
$data = [];
|
|
foreach ($content as $k => $v) {
|
|
if (isset($sourse[$v['field']])) {
|
|
$v['old_content'] = $sourse[$v['field']][$v['old_content']];
|
|
$v['new_content'] = $sourse[$v['field']][$v['new_content']];
|
|
}
|
|
if (strpos($v['field'], '_time') !== false) {
|
|
if ($v['old_content'] == '') {
|
|
$v['old_content'] = '未设置';
|
|
}
|
|
$v['new_content'] = date('Y-m-d', (int) $v['new_content']);
|
|
}
|
|
if (strpos($v['field'], '_uid') !== false) {
|
|
$v['old_content'] = Db::name('Admin')->where(['id' => $v['old_content']])->value('name');
|
|
$v['new_content'] = Db::name('Admin')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'user') {
|
|
$v['new_content'] = Db::name('Admin')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'project_id') {
|
|
$v['old_content'] = Db::name('Project')->where(['id' => $v['old_content']])->value('name');
|
|
$v['new_content'] = Db::name('Project')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'before_task') {
|
|
$v['old_content'] = Db::name('ProjectTask')->where(['id' => $v['old_content']])->value('title');
|
|
$v['new_content'] = Db::name('ProjectTask')->where(['id' => $v['new_content']])->value('title');
|
|
}
|
|
if ($v['field'] == 'cate') {
|
|
$v['old_content'] = Db::name('WorkCate')->where(['id' => $v['old_content']])->value('title');
|
|
$v['new_content'] = Db::name('WorkCate')->where(['id' => $v['new_content']])->value('title');
|
|
}
|
|
if ($v['field'] == 'done_ratio') {
|
|
$v['old_content'] = $v['old_content'] . '%';
|
|
$v['new_content'] = $v['new_content'] . '%';
|
|
}
|
|
if (strpos($v['field'], '_ids') !== false) {
|
|
$old_ids = Db::name('Admin')->where('id', 'in', $v['old_content'])->column('name');
|
|
$v['old_content'] = implode(',', $old_ids);
|
|
$new_ids = Db::name('Admin')->where('id', 'in', $v['new_content'])->column('name');
|
|
$v['new_content'] = implode(',', $new_ids);
|
|
}
|
|
if ($v['old_content'] == '' || $v['old_content'] == null) {
|
|
$v['old_content'] = '未设置';
|
|
}
|
|
if ($v['new_content'] == '' || $v['new_content'] == null) {
|
|
$v['new_content'] = '未设置';
|
|
}
|
|
$v['action'] = $action[$v['action']];
|
|
$v['icon'] = $field_array[$v['field']]['icon'];
|
|
$v['title'] = $field_array[$v['field']]['title'];
|
|
$v['times'] = time_trans($v['create_time']);
|
|
$v['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
|
|
$data[] = $v;
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
public function project_log($param = [])
|
|
{
|
|
$task_ids = Db::name('ProjectTask')->where(['project_id' => $param['topic_id'], 'delete_time' => 0])->column('id');
|
|
$document_ids = Db::name('ProjectDocument')->where(['project_id' => $param['topic_id'], 'delete_time' => 0])->column('id');
|
|
|
|
$where1 = [];
|
|
$where2 = [];
|
|
$where3 = [];
|
|
|
|
$where1[] = ['a.module', '=', 'project'];
|
|
$where1[] = ['a.project_id', '=', $param['topic_id']];
|
|
|
|
$where2[] = ['a.module', '=', 'task'];
|
|
$where2[] = ['a.task_id', 'in', $task_ids];
|
|
|
|
$where3[] = ['a.module', '=', 'document'];
|
|
$where3[] = ['a.document_id', 'in', $document_ids];
|
|
$page = intval($param['page']);
|
|
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
|
$content = Db::name('ProjectLog')
|
|
->field('a.*,u.name,u.thumb')
|
|
->alias('a')
|
|
->join('Admin u', 'u.id = a.admin_id')
|
|
->order('a.create_time desc')
|
|
->whereOr([$where1, $where2, $where3])
|
|
->page($page, $rows)
|
|
->select()->toArray();
|
|
|
|
$module = [
|
|
'project' => '',
|
|
'task' => '任务',
|
|
'document' => '文档',
|
|
];
|
|
$action = get_config('log.type_action');
|
|
$data = [];
|
|
foreach ($content as $k => $v) {
|
|
$sourse = self::$Sourse[$v['module']];
|
|
$field_array = $sourse['field_array'];
|
|
if (isset($sourse[$v['field']])) {
|
|
$v['old_content'] = $sourse[$v['field']][$v['old_content']];
|
|
$v['new_content'] = $sourse[$v['field']][$v['new_content']];
|
|
}
|
|
if (strpos($v['field'], '_time') !== false) {
|
|
if ($v['old_content'] == '') {
|
|
$v['old_content'] = '未设置';
|
|
}
|
|
else{
|
|
$v['old_content'] = date('Y-m-d', (int) $v['old_content']);
|
|
}
|
|
$v['new_content'] = date('Y-m-d', (int) $v['new_content']);
|
|
}
|
|
if (strpos($v['field'], '_uid') !== false) {
|
|
$v['old_content'] = Db::name('Admin')->where(['id' => $v['old_content']])->value('name');
|
|
$v['new_content'] = Db::name('Admin')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'user') {
|
|
$v['new_content'] = Db::name('Admin')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'project_id') {
|
|
$v['old_content'] = Db::name('Project')->where(['id' => $v['old_content']])->value('name');
|
|
$v['new_content'] = Db::name('Project')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'cate') {
|
|
$v['old_content'] = Db::name('WorkCate')->where(['id' => $v['old_content']])->value('title');
|
|
$v['new_content'] = Db::name('WorkCate')->where(['id' => $v['new_content']])->value('title');
|
|
}
|
|
if ($v['field'] == 'contract_id') {
|
|
$v['old_content'] = Db::name('Contract')->where(['id' => $v['old_content']])->value('name');
|
|
$v['new_content'] = Db::name('Contract')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'customer_id') {
|
|
$v['old_content'] = Db::name('Customer')->where(['id' => $v['old_content']])->value('name');
|
|
$v['new_content'] = Db::name('Customer')->where(['id' => $v['new_content']])->value('name');
|
|
}
|
|
if ($v['field'] == 'done_ratio') {
|
|
$v['old_content'] = $v['old_content'] . '%';
|
|
$v['new_content'] = $v['new_content'] . '%';
|
|
}
|
|
if (strpos($v['field'], '_ids') !== false) {
|
|
$old_ids = Db::name('Admin')->where('id', 'in', $v['old_content'])->column('name');
|
|
$v['old_content'] = implode(',', $old_ids);
|
|
$new_ids = Db::name('Admin')->where('id', 'in', $v['new_content'])->column('name');
|
|
$v['new_content'] = implode(',', $new_ids);
|
|
}
|
|
if ($v['old_content'] == '' || $v['old_content'] == null) {
|
|
$v['old_content'] = '未设置';
|
|
}
|
|
if ($v['new_content'] == '' || $v['new_content'] == null) {
|
|
$v['new_content'] = '未设置';
|
|
}
|
|
$v['module_name'] = $module[$v['module']];
|
|
|
|
$v['topic'] = '';
|
|
$v['topic_title'] = '';
|
|
$v['url'] = '';
|
|
if ($v['module'] == 'task') {
|
|
$v['topic'] = 'T' . $v['task_id'];
|
|
$v['topic_title'] = Db::name('ProjectTask')->where('id', $v['task_id'])->value('title');
|
|
$v['url'] = '/project/task/view/id/' . $v['task_id'];
|
|
}
|
|
|
|
$v['action'] = $action[$v['action']];
|
|
$v['icon'] = $field_array[$v['field']]['icon'];
|
|
$v['title'] = $field_array[$v['field']]['title'];
|
|
$v['times'] = time_trans($v['create_time']);
|
|
$v['create_time'] = date('Y-m-d', $v['create_time']);
|
|
$data[] = $v;
|
|
}
|
|
return $data;
|
|
}
|
|
}
|