diff --git a/back/application/api/controller/Customer.php b/back/application/api/controller/Customer.php index 9106e64..d77d433 100644 --- a/back/application/api/controller/Customer.php +++ b/back/application/api/controller/Customer.php @@ -129,4 +129,46 @@ class Customer extends Common return $this->sendSuccess($ret); } + // 客户检索 - 分页查询合作伙伴公司 + public function SearchPartnerCompany() + { + $param = request()->post(); + + $currPage = isset($param['page']) ? $param['page'] : 1; + $pageSize = isset($param['limit']) ? $param['limit'] : 10; + $company_name = isset($param['company_name']) ? $param['company_name'] : ''; + + // 构建查询条件 + $query = db('partner_company'); + + // 查询客户类型 + $query->whereIn('company_type', [1, 5]); + + if (!empty($company_name)) { + $query->where('company_name', 'like', '%' . $company_name . '%'); + } + + // 查询列表数据 + $list = $query->page($currPage, $pageSize) + ->order('company_id desc') + ->select(); + + // 查询总记录数 + $totalQuery = db('partner_company'); + $totalQuery->whereIn('company_type', [1, 5]); + + if (!empty($company_name)) { + $totalQuery->where('company_name', 'like', '%' . $company_name . '%'); + } + + $total = $totalQuery->count(); + + $result = [ + 'list' => $list, + 'total' => $total + ]; + + return $this->sendSuccess($result); + } + } \ No newline at end of file diff --git a/back/application/api/controller/Work.php b/back/application/api/controller/Work.php index 8a28741..19b348f 100644 --- a/back/application/api/controller/Work.php +++ b/back/application/api/controller/Work.php @@ -831,9 +831,10 @@ class Work extends Common $user_id = $param['user_id']; $currPage = isset($param['currPage']) ? $param['currPage'] : 1; $pageSize = isset($param['pageSize']) ? $param['pageSize'] : 10; + $project_name = isset($param['project_name']) ? $param['project_name'] : ''; $user = new User(); - $project_work = $this->GetProjectListPaginated($user_id, $currPage, $pageSize); + $project_work = $this->GetProjectListPaginated($user_id, $currPage, $pageSize, $project_name); for ($i = 0; $i < count($project_work['list']); $i++) { $involve_manager = $project_work['list'][$i]['involve_manager']; @@ -849,7 +850,7 @@ class Work extends Common } //获取参与的客户项目列表 - 分页版本 - public function GetProjectListPaginated($user_id, $currPage, $pageSize) + public function GetProjectListPaginated($user_id, $currPage, $pageSize, $project_name = '') { //判断登录用户的角色,如果是管理员,就获取所有的项目信息 $user_info = db('system_user')->where('id', $user_id)->find(); @@ -859,6 +860,11 @@ class Work extends Common ->where('p.project_state', '<', 10) //未关闭的项目 ->field('p.*, s.desp as project_state_name,1 as project_types'); + // 添加项目名称模糊查询 + if (!empty($project_name)) { + $query->where('p.project_name', 'like', '%' . $project_name . '%'); + } + if (1 != $user_info['user_role']) { $query->where(function ($query) use ($user_id) { $query->where('p.involve_manager', $user_id) @@ -877,6 +883,11 @@ class Work extends Common ->join('project_state s', 's.id =p.project_state', 'left') ->where('p.project_state', '<', 10); + // 添加项目名称模糊查询到总数查询 + if (!empty($project_name)) { + $totalQuery->where('p.project_name', 'like', '%' . $project_name . '%'); + } + if (1 != $user_info['user_role']) { $totalQuery->where(function ($query) use ($user_id) { $query->where('p.involve_manager', $user_id) diff --git a/front/src/api/customer.js b/front/src/api/customer.js index 01f9646..f7407d8 100644 --- a/front/src/api/customer.js +++ b/front/src/api/customer.js @@ -1,76 +1,89 @@ import request from '@/utils/request' -export default { - - //获取客户信息列表 - GetCustomerList(param) { - return request({ - url: `/Customer/GetCustomerList`, - method: 'post', - data: param - }) - }, - - //添加客户信息 - AddCustomerInfo(param) { - return request({ - url: `/Customer/AddCustomerInfo`, - method: 'post', - data: param - }) - }, - - GetProjectInfoList(param) { - return request({ - url: `/Project/GetProjectInfoList`, - method: 'post', - data: param - }) - }, - - - AddProjectInfo(param) { - return request({ - url: `/Project/AddProjectInfo`, - method: 'post', - data: param - }) - }, - - UpdateProjectInfo(param) { - return request({ - url: `/Project/updateProjectInfo`, - method: 'post', - data: param - }) - }, - - //添加客户联系人 - AddCustomerMemberInfo(param) { - return request({ - url: `/Customer/AddCustomerMemberInfo`, - method: 'post', - data: param - }) - }, - - GetCustomerMemberList(param) { - return request({ - url: `/Customer/GetCustomerMemberList`, - method: 'post', - data: param - }) - }, - - GetCustomerInfo(param) { - return request({ - url: `/Customer/GetCustomerInfo`, - method: 'post', - data: param - }) - }, - - - - +// 获取客户信息列表 +export function GetCustomerList(param) { + return request({ + url: `/Customer/GetCustomerList`, + method: 'post', + data: param + }) +} + +// 添加客户信息 +export function AddCustomerInfo(param) { + return request({ + url: `/Customer/AddCustomerInfo`, + method: 'post', + data: param + }) +} + +export function GetProjectInfoList(param) { + return request({ + url: `/Project/GetProjectInfoList`, + method: 'post', + data: param + }) +} + +export function AddProjectInfo(param) { + return request({ + url: `/Project/AddProjectInfo`, + method: 'post', + data: param + }) +} + +export function UpdateProjectInfo(param) { + return request({ + url: `/Project/updateProjectInfo`, + method: 'post', + data: param + }) +} + +// 添加客户联系人 +export function AddCustomerMemberInfo(param) { + return request({ + url: `/Customer/AddCustomerMemberInfo`, + method: 'post', + data: param + }) +} + +export function GetCustomerMemberList(param) { + return request({ + url: `/Customer/GetCustomerMemberList`, + method: 'post', + data: param + }) +} + +export function GetCustomerInfo(param) { + return request({ + url: `/Customer/GetCustomerInfo`, + method: 'post', + data: param + }) +} + +// 客户检索 - 搜索合作伙伴公司 +export function searchPartnerCompany(param) { + return request({ + url: `/Customer/SearchPartnerCompany`, + method: 'post', + data: param + }) +} + +export default { + GetCustomerList, + AddCustomerInfo, + GetProjectInfoList, + AddProjectInfo, + UpdateProjectInfo, + AddCustomerMemberInfo, + GetCustomerMemberList, + GetCustomerInfo, + searchPartnerCompany } diff --git a/front/src/views/customer-mgr/customersearch.vue b/front/src/views/customer-mgr/customersearch.vue index 96f08b2..3c2b078 100644 --- a/front/src/views/customer-mgr/customersearch.vue +++ b/front/src/views/customer-mgr/customersearch.vue @@ -1,30 +1,140 @@ @@ -34,4 +144,12 @@ export default { height: 100%; } +.search-form { + margin-bottom: 20px; +} + +.pagination-container { + margin-top: 20px; + text-align: right; +} diff --git a/front/src/views/workbench/inner/inner.vue b/front/src/views/workbench/inner/inner.vue index a699771..cdc38b6 100644 --- a/front/src/views/workbench/inner/inner.vue +++ b/front/src/views/workbench/inner/inner.vue @@ -87,6 +87,21 @@
我参与的项目
+ + + + + + + 搜索 + + @@ -254,6 +269,7 @@ export default { work_info_total: 0, work_info_pageNum: 1, work_info_pageSize: 10, + work_info_project_name: '', // 添加项目名称搜索变量 work_story_list: [], work_story_total: 0, work_story_pageNum: 1, @@ -599,7 +615,8 @@ export default { var param = { user_id: localStorage.getItem('user_id'), currPage: this.work_info_pageNum, - pageSize: this.work_info_pageSize + pageSize: this.work_info_pageSize, + project_name: this.work_info_project_name } work.GetWorkInfoByLoginIdPaginated(param).then(res => { this.work_info_list = res.data.data.list @@ -620,6 +637,11 @@ export default { }) }, + handleProjectSearch() { + this.work_info_pageNum = 1 // 重置到第一页 + this.get_work_info_list() + }, + showWorkTask(storyId) { this.story_id = storyId this.dialogVisibleShowWorkTask = true