From 0aee3da7de4666a5ed2322447ac801ef3b8f8943 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Wed, 21 May 2025 18:01:43 +0800 Subject: [PATCH 1/7] =?UTF-8?q?(customerfeat-resources):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AE=A2=E6=88=B7=E8=B5=84=E6=BA=90=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 getEditLogList 接口,用于获取客户资源和六要素的修改记录列表 - 实现 getCustomerResourceChangesEditLog 和 getSixSpeedModificationEditLog 方法,分别用于获取客户资源和六要素的修改记录 - 在模型中添加字段中文映射常量,用于展示修改记录时的字段名称 -优化修改记录的数据处理,将字典值和人员信息转换为中文名称 --- .../apiController/CustomerResources.php | 28 ++ niucloud/app/api/route/route.php | 3 + .../customer_resources/CustomerResources.php | 27 ++ niucloud/app/model/six_speed/SixSpeed.php | 21 +- .../apiService/CustomerResourcesService.php | 258 ++++++++++++++++++ 5 files changed, 336 insertions(+), 1 deletion(-) diff --git a/niucloud/app/api/controller/apiController/CustomerResources.php b/niucloud/app/api/controller/apiController/CustomerResources.php index 29f2cf13..7cfb3f3c 100644 --- a/niucloud/app/api/controller/apiController/CustomerResources.php +++ b/niucloud/app/api/controller/apiController/CustomerResources.php @@ -152,5 +152,33 @@ class CustomerResources extends BaseApiService return success([]); } + //客户资源-修改记录列表 + public function getEditLogList(Request $request){ + //前端要传递分页(page,limit)参数 + $customer_resource_id = $request->param('customer_resource_id',''); + $type = $request->param('type','resource');//查询类型|resource=客户资源,six_speed=六要素 + + if(empty($customer_resource_id) || empty($type)){ + return fail('缺少必要参数'); + } + + if(!in_array($type,['resource','six_speed'])){ + return fail('类型不正确'); + } + + $where = [ + 'customer_resource_id' =>$customer_resource_id + ]; + + if($type == 'resource'){ + //resource=客户资源 + $res =(new CustomerResourcesService())->getCustomerResourceChangesEditLog($where); + }else{ + $res =(new CustomerResourcesService())->getSixSpeedModificationEditLog($where); + } + + return success($res); + } + } diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 9e03f657..1e0e64e6 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -208,6 +208,9 @@ Route::group(function () { Route::post('customerResources/add', 'apiController.CustomerResources/add'); //客户资源-编辑 Route::post('customerResources/edit', 'apiController.CustomerResources/edit'); + //客户资源-修改记录列表 + Route::get('customerResources/getEditLogList', 'apiController.CustomerResources/getEditLogList'); + //资源共享-列表 Route::get('resourceSharing/index', 'apiController.ResourceSharing/index'); diff --git a/niucloud/app/model/customer_resources/CustomerResources.php b/niucloud/app/model/customer_resources/CustomerResources.php index b3c0aae6..bfcc6515 100644 --- a/niucloud/app/model/customer_resources/CustomerResources.php +++ b/niucloud/app/model/customer_resources/CustomerResources.php @@ -57,6 +57,33 @@ class CustomerResources extends BaseModel */ protected $defaultSoftDelete = 0; + //定义一个常量数组-字段中文映射 + const FieldZh = [ + 'id' => '编号', + 'create_year_month' => '创建年月', + 'create_date' => '创建日期', + 'source_channel' => '来源渠道', + 'source' => '来源', + 'consultant' => '顾问', + 'name' => '姓名', + 'age' => '年龄', + 'gender' => '性别', + 'phone_number' => '联系电话', + 'demand' => '需求', + 'purchasing_power' => '购买力', + 'cognitive_idea' => '认知理念', + 'optional_class_time' => '可选上课时间', + 'distance' => '距离', + 'decision_maker' => '决策人', + 'initial_intent' => '客户初步意向度', + 'campus' => '所属校区', + 'trial_class_count' => '体验课次数', + 'created_at' => '创建时间', + 'updated_at' => '更新时间', + 'deleted_at' => '逻辑删除时间', + 'status' => '客户状态', + ]; + /** * 搜索器:客户资源姓名 * @param $value diff --git a/niucloud/app/model/six_speed/SixSpeed.php b/niucloud/app/model/six_speed/SixSpeed.php index b7fde1a2..0911fb2c 100644 --- a/niucloud/app/model/six_speed/SixSpeed.php +++ b/niucloud/app/model/six_speed/SixSpeed.php @@ -57,7 +57,26 @@ class SixSpeed extends BaseModel - + //定义一个常量数组-字段中文映射 + const FieldZh = [ + 'id' => '编号', + 'purchase_power' => '需求购买力', + 'concept_awareness' => '认知理念', + 'preferred_class_time' => '可选上课时间', + 'distance' => '距离', + 'communication' => '沟通备注', + 'promised_visit_time' => '承诺到访时间', + 'actual_visit_time' => '实际到访时间', + 'call_intent' => '电话后的意向程度', + 'first_visit_status' => '一访情况', + 'second_visit_status' => '二访情况', + 'is_closed' => '是否关单', + 'staff_id' => '人员ID', + 'resource_id' => '资源ID', + 'created_at' => '创建时间', + 'updated_at' => '更新时间', + 'deleted_at' => '逻辑删除时间' + ]; public function personnel(){ diff --git a/niucloud/app/service/api/apiService/CustomerResourcesService.php b/niucloud/app/service/api/apiService/CustomerResourcesService.php index 1cc0bb86..90e32d42 100644 --- a/niucloud/app/service/api/apiService/CustomerResourcesService.php +++ b/niucloud/app/service/api/apiService/CustomerResourcesService.php @@ -14,6 +14,7 @@ namespace app\service\api\apiService; use app\model\campus_person_role\CampusPersonRole; use app\model\customer_resource_changes\CustomerResourceChanges; use app\model\customer_resources\CustomerResources; +use app\model\dict\Dict; use app\model\personnel\Personnel; use app\model\resource_sharing\ResourceSharing; use app\model\six_speed\SixSpeed; @@ -205,6 +206,263 @@ class CustomerResourcesService extends BaseApiService } } + //客户资源-获取客户资源修改记录列表 + public function getCustomerResourceChangesEditLog(array $where) + { + $page_params = $this->getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + + //客户资源修改记录表 + $data = CustomerResourceChanges::where('customer_resource_id', $where['customer_resource_id']) + ->order('created_at', 'desc') + ->with([ + 'personnel' => function ($query) { + } + ]) + ->paginate([ + 'list_rows' => $limit, + 'page' => $page, + ]) + ->toArray(); + + + $fieldZhArr = CustomerResources::FieldZh;//字段中文映射常量 + //需要获取字段与字典key的映射关系数组 + $fieldDictArr = [ + 'source_channel'=>'SourceChannel',//field=>dict_key(来源渠道) + 'source'=>'source',//field=>dict_key(来源) + 'gender'=>'zy_sex',//field=>dict_key(性别) + 'purchasing_power'=>'customer_purchasing_power',//field=>dict_key(购买力) + 'cognitive_idea'=>'cognitive_concept',//field=>dict_key(认知理念) + 'initial_intent'=>'preliminarycustomerintention',//field=>dict_key(客户初步意向度) + 'status'=>'kh_status',//field=>dict_key(客户状态) + ]; + $dict_arr = $this->getFieldDictionary($fieldDictArr);//字段与字典值列表的映射关系 + + $consultant_id_arr = []; + foreach ($data['data'] as $v) { + $modified_fields_arr = json_decode($v['modified_fields'], true); + $old_values_arr = json_decode($v['old_values'], true); + $new_values_arr = json_decode($v['new_values'], true); + + //判断有没有修改过"顾问"字段 + if(in_array('consultant',$modified_fields_arr)){ + $consultant_id_arr[] = $old_values_arr['consultant']; + $consultant_id_arr[] = $new_values_arr['consultant']; + } + } + $consultant_id_arr = array_unique($consultant_id_arr);//去重 + $dict_arr['consultant'] = [];//获取员工信息列表 + if($consultant_id_arr){ + $personnel = Personnel::whereIn('id',$consultant_id_arr)->field('id,name')->select()->toArray(); + foreach($personnel as $v){ + $dict_arr['consultant'][] = [ + "name" => $v['name'], + "value" => $v['id'], + "sort" => 0, + "memo" => "", + ]; + } + } + + + $fieldDictKeyArr = array_keys($fieldDictArr); + $list = []; + foreach ($data['data'] as $v) { + $modified_fields_arr = json_decode($v['modified_fields'], true); + $old_values_arr = json_decode($v['old_values'], true); + $new_values_arr = json_decode($v['new_values'], true); + + + $update_arr = []; + foreach ($modified_fields_arr as $m_v) { + $old_value = $old_values_arr[$m_v] ?? ''; + $new_value = $new_values_arr[$m_v] ?? ''; + + if(in_array($m_v,$fieldDictKeyArr)){ + $dict = $dict_arr[$m_v]; + foreach($dict as $d_v){ + if($d_v['value'] == $old_value){ + $old_value = $d_v['name']; + } + if($d_v['value'] == $new_value){ + $new_value = $d_v['name']; + } + } + } + + + //一些字典和外键相关的字段值处理 + $update_arr[] = [ + 'field_name_en' => $m_v, + 'field_name_zh' => $fieldZhArr[$m_v] ?? $m_v, + 'old_value' => $old_value, + 'new_value' => $new_value, + ]; + } + + $list[] = [ + 'id' => $v['id'],//日志id + 'modification_time' => $v['modification_time'],//修改时间 + 'staff_id_name' => $v['staff_id_name'],//修改人的名字 + 'update_arr' => $update_arr,//数据变更数组 + ]; + } + + + $data['data'] = $list; + return $data; + } + + //客户资源-获取六要素修改记录列表 + public function getSixSpeedModificationEditLog(array $where) + { + $page_params = $this->getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + + //六要素修改记录表 + $data = SixSpeedModificationLog::where('operator_id', $where['customer_resource_id']) + ->order('created_at', 'desc') + ->with([ + 'personnel' => function ($query) { + } + ]) + ->paginate([ + 'list_rows' => $limit, + 'page' => $page, + ]) + ->toArray(); + + + $fieldZhArr = SixSpeed::FieldZh;//字段中文映射常量 + //需要获取字段与字典key的映射关系数组 + $fieldDictArr = [ + 'purchase_power'=>'customer_purchasing_power',//field=>dict_key(需求购买力) + 'concept_awareness'=>'cognitive_concept',//field=>dict_key(认知理念) + 'call_intent'=>'preliminarycustomerintention',//field=>dict_key(电话后的意向程度) + 'is_closed'=>'global_true_or_false',//field=>dict_key(是否关单: 1-是, 0-否) + ]; + $dict_arr = $this->getFieldDictionary($fieldDictArr);//字段与字典值列表的映射关系 + + $consultant_id_arr = [];//顾问(人员)id数组 + foreach ($data['data'] as $v) { + $modified_fields_arr = json_decode($v['modified_field'], true); + $old_values_arr = json_decode($v['old_value'], true); + $new_values_arr = json_decode($v['new_value'], true); + + //判断有没有修改过"顾问(人员)"字段 + if(in_array('staff_id',$modified_fields_arr)){ + $consultant_id_arr[] = $old_values_arr['staff_id']; + $consultant_id_arr[] = $new_values_arr['staff_id']; + } + } + $consultant_id_arr = array_unique($consultant_id_arr);//去重 + $dict_arr['consultant'] = [];//获取员工信息列表 + if($consultant_id_arr){ + $personnel = Personnel::whereIn('id',$consultant_id_arr)->field('id,name')->select()->toArray(); + foreach($personnel as $v){ + $dict_arr['consultant'][] = [ + "name" => $v['name'], + "value" => $v['id'], + "sort" => 0, + "memo" => "", + ]; + } + } + + + $fieldDictKeyArr = array_keys($fieldDictArr); + $list = []; + foreach ($data['data'] as $v) { + $modified_fields_arr = json_decode($v['modified_field'], true); + $old_values_arr = json_decode($v['old_value'], true); + $new_values_arr = json_decode($v['new_value'], true); + + + $update_arr = []; + foreach ($modified_fields_arr as $m_v) { + $old_value = $old_values_arr[$m_v] ?? ''; + $new_value = $new_values_arr[$m_v] ?? ''; + + if(in_array($m_v,$fieldDictKeyArr)){ + $dict = $dict_arr[$m_v]; + foreach($dict as $d_v){ + if($d_v['value'] == $old_value){ + $old_value = $d_v['name']; + } + if($d_v['value'] == $new_value){ + $new_value = $d_v['name']; + } + } + } + + + //一些字典和外键相关的字段值处理 + $update_arr[] = [ + 'field_name_en' => $m_v, + 'field_name_zh' => $fieldZhArr[$m_v] ?? $m_v, + 'old_value' => $old_value, + 'new_value' => $new_value, + ]; + } + + $list[] = [ + 'id' => $v['id'],//日志id + 'modification_time' => $v['updated_at'],//修改时间 + 'staff_id_name' => $v['staff_id_name'],//修改人的名字 + 'update_arr' => $update_arr,//数据变更数组 + ]; + } + + + $data['data'] = $list; + return $data; + } + + + /** + * 根据字段和字典键映射关系,获取字段对应字典项 + * + * @param array $fieldDictMapping 字段 => 字典 key 映射数组 + * @return array 字段 => 字典列表 + */ + public function getFieldDictionary(array $fieldDictMapping): array + { + // 获取所有需要的字典 key 列表 + $dictKeys = array_values($fieldDictMapping); + + if (empty($dictKeys)) { + return []; + } + + // 查询字典数据 + $dictData = Dict::whereIn('key', $dictKeys)->select()->toArray(); + + //使用 array_column 构建 key => dict 的映射 + $dictMap = array_column($dictData, null, 'key'); // 以 key 字段为索引 + + + // 构建字段 => 字典项的映射 + $result = []; + foreach ($fieldDictMapping as $field => $key) { + $result[$field] = $dictMap[$key]['dictionary'] ?? []; + //判断是不是获取的"来源渠道"的字典 + if($field == 'source_channel'){ + $append_arr = [ + "name" => "线下", + "value" => "0", + "sort" => 0, + "memo" => "", + ]; + //插入到数组头部 + array_unshift($result[$field],$append_arr); + } + } + + return $result; + } } From 157d4e9512c95050dfc293178b651023b1ff0627 Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Wed, 21 May 2025 18:02:29 +0800 Subject: [PATCH 2/7] 1 --- admin/src/app/views/auth/components/edit-role.vue | 12 ++++++++++++ admin/src/app/views/auth/role.vue | 9 +++++++++ niucloud/app/adminapi/controller/sys/Role.php | 2 ++ niucloud/app/service/admin/sys/RoleService.php | 4 ++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/admin/src/app/views/auth/components/edit-role.vue b/admin/src/app/views/auth/components/edit-role.vue index 63fc0285..ff85f573 100644 --- a/admin/src/app/views/auth/components/edit-role.vue +++ b/admin/src/app/views/auth/components/edit-role.vue @@ -24,6 +24,17 @@ :show-word-limit="true" /> + + + + + + 销售 + 老师 + 主管 + + + @@ -142,6 +153,7 @@ const initialFormData = { role_id: 0, role_name: '', status: 1, + role_key:'', rules: [], } const formData: Record = reactive({ ...initialFormData }) diff --git a/admin/src/app/views/auth/role.vue b/admin/src/app/views/auth/role.vue index 6193b95d..69a5b9ba 100644 --- a/admin/src/app/views/auth/role.vue +++ b/admin/src/app/views/auth/role.vue @@ -56,6 +56,15 @@ }} + + + + + request->params([ ['role_name', ''], ['rules', []], + ['role_key',''], ['status', RoleStatusDict::ON], ]); $this->validate($data, 'app\validate\sys\Role.add'); @@ -73,6 +74,7 @@ class Role extends BaseAdminController $data = $this->request->params([ ['role_name', ''], ['rules', []], + ['role_key',''], ['status', RoleStatusDict::ON], ]); $this->validate($data, 'app\validate\sys\Role.edit'); diff --git a/niucloud/app/service/admin/sys/RoleService.php b/niucloud/app/service/admin/sys/RoleService.php index 8474b493..b4c11dc5 100644 --- a/niucloud/app/service/admin/sys/RoleService.php +++ b/niucloud/app/service/admin/sys/RoleService.php @@ -46,7 +46,7 @@ class RoleService extends BaseAdminService if(isset($data['role_name']) && $data['role_name'] !== '') { $where[] = ['role_name', 'like', "%".$this->model->handelSpecialCharacter($data['role_name'])."%"]; } - $field = 'role_id,role_name,status,create_time'; + $field = 'role_id,role_name,role_key,status,create_time'; $search_model = $this->model->where($where)->field($field)->order('create_time desc')->append(['status_name']); return $this->pageQuery($search_model); } @@ -71,7 +71,7 @@ class RoleService extends BaseAdminService $where = array( ['status', '=', 1] ); - return $this->model->where($where)->field('role_id,role_name,status,create_time')->select()->toArray(); + return $this->model->where($where)->field('role_id,role_name,role_key,status,create_time')->select()->toArray(); } /** From f33ba89f9f1fbe318e95fb0c79225992ab423a2c Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Wed, 21 May 2025 19:25:44 +0800 Subject: [PATCH 3/7] 1 --- admin/src/app/api/service.ts | 23 +- admin/src/app/api/user_feedback.ts | 25 +- admin/src/app/lang/zh-cn/service.service.json | 54 +- .../zh-cn/user_feedback.user_feedback.json | 26 +- .../components/customer-resources-edit.vue | 31 + .../customer_resources/customer_resources.vue | 48 +- .../src/app/views/departments/departments.vue | 4 +- .../views/member/components/edit-member.vue | 3 + .../components/order-table-edit.vue | 54 +- .../views/service/components/service-edit.vue | 599 +++++++++--------- admin/src/app/views/service/service.vue | 531 ++++++---------- .../components/user-feedback-edit.vue | 380 +++++------ .../app/views/user_feedback/user_feedback.vue | 400 ++++++------ .../customer_resources/CustomerResources.php | 4 + .../controller/departments/Departments.php | 8 +- .../controller/order_table/OrderTable.php | 9 +- .../adminapi/controller/service/Service.php | 7 - .../controller/user_feedback/UserFeedback.php | 8 +- niucloud/app/adminapi/route/service.php | 1 + niucloud/app/adminapi/route/user_feedback.php | 3 + .../customer_resources/CustomerResources.php | 13 + niucloud/app/model/service/Service.php | 96 --- .../app/model/user_feedback/UserFeedback.php | 44 +- .../CustomerResourcesService.php | 32 +- .../admin/departments/DepartmentsService.php | 13 +- .../admin/order_table/OrderTableService.php | 12 +- .../service/admin/service/ServiceService.php | 2 +- .../user_feedback/UserFeedbackService.php | 10 +- .../app/validate/order_table/OrderTable.php | 4 +- .../validate/user_feedback/UserFeedback.php | 6 +- 30 files changed, 1108 insertions(+), 1342 deletions(-) diff --git a/admin/src/app/api/service.ts b/admin/src/app/api/service.ts index 9fcbb5e4..a9b01e82 100644 --- a/admin/src/app/api/service.ts +++ b/admin/src/app/api/service.ts @@ -1,5 +1,7 @@ import request from '@/utils/request' + + // USER_CODE_BEGIN -- service /** * 获取服务列表 @@ -7,7 +9,7 @@ import request from '@/utils/request' * @returns */ export function getServiceList(params: Record) { - return request.get(`service/service`, { params }) + return request.get(`service/service`, {params}) } /** @@ -16,7 +18,7 @@ export function getServiceList(params: Record) { * @returns */ export function getServiceInfo(id: number) { - return request.get(`service/service/${id}`) + return request.get(`service/service/${id}`); } /** @@ -25,10 +27,7 @@ export function getServiceInfo(id: number) { * @returns */ export function addService(params: Record) { - return request.post('service/service', params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.post('service/service', params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -38,10 +37,7 @@ export function addService(params: Record) { * @returns */ export function editService(params: Record) { - return request.put(`service/service/${params.id}`, params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.put(`service/service/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -50,10 +46,9 @@ export function editService(params: Record) { * @returns */ export function deleteService(id: number) { - return request.delete(`service/service/${id}`, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.delete(`service/service/${id}`, { showErrorMessage: true, showSuccessMessage: true }) } + + // USER_CODE_END -- service diff --git a/admin/src/app/api/user_feedback.ts b/admin/src/app/api/user_feedback.ts index c6a55bfc..68e0cabf 100644 --- a/admin/src/app/api/user_feedback.ts +++ b/admin/src/app/api/user_feedback.ts @@ -1,5 +1,7 @@ import request from '@/utils/request' + + // USER_CODE_BEGIN -- user_feedback /** * 获取用户反馈信息列表 @@ -7,7 +9,7 @@ import request from '@/utils/request' * @returns */ export function getUserFeedbackList(params: Record) { - return request.get(`user_feedback/user_feedback`, { params }) + return request.get(`user_feedback/user_feedback`, {params}) } /** @@ -16,7 +18,7 @@ export function getUserFeedbackList(params: Record) { * @returns */ export function getUserFeedbackInfo(id: number) { - return request.get(`user_feedback/user_feedback/${id}`) + return request.get(`user_feedback/user_feedback/${id}`); } /** @@ -25,10 +27,7 @@ export function getUserFeedbackInfo(id: number) { * @returns */ export function addUserFeedback(params: Record) { - return request.post('user_feedback/user_feedback', params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.post('user_feedback/user_feedback', params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -38,10 +37,7 @@ export function addUserFeedback(params: Record) { * @returns */ export function editUserFeedback(params: Record) { - return request.put(`user_feedback/user_feedback/${params.id}`, params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.put(`user_feedback/user_feedback/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -50,10 +46,11 @@ export function editUserFeedback(params: Record) { * @returns */ export function deleteUserFeedback(id: number) { - return request.delete(`user_feedback/user_feedback/${id}`, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.delete(`user_feedback/user_feedback/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithCustomerResourcesList(params: Record){ + return request.get('user_feedback/customer_resources_all', {params}) } // USER_CODE_END -- user_feedback diff --git a/admin/src/app/lang/zh-cn/service.service.json b/admin/src/app/lang/zh-cn/service.service.json index ff1a2f8e..5110f729 100644 --- a/admin/src/app/lang/zh-cn/service.service.json +++ b/admin/src/app/lang/zh-cn/service.service.json @@ -1,29 +1,27 @@ { - "id": "服务编号", - "idPlaceholder": "请输入服务编号", - "serviceName": "服务名称", - "serviceNamePlaceholder": "请输入服务名称", - "previewImageUrl": "服务预览图URL", - "previewImageUrlPlaceholder": "请输入服务预览图URL", - "description": "服务描述", - "descriptionPlaceholder": "请输入服务描述", - "serviceType": "服务类型", - "serviceTypePlaceholder": "请输入服务类型", - "executionRules": "服务执行规则", - "executionRulesPlaceholder": "请输入服务执行规则", - "staffReminder": "是否员工提醒: 1-是, 0-否", - "staffReminderPlaceholder": "请输入是否员工提醒: 1-是, 0-否", - "customerReminder": "是否客户提醒: 1-是, 0-否", - "customerReminderPlaceholder": "请输入是否客户提醒: 1-是, 0-否", - "customerConfirmation": "是否客户确认: 1-是, 0-否", - "customerConfirmationPlaceholder": "请输入是否客户确认: 1-是, 0-否", - "customerFeedback": "客户反馈内容", - "customerFeedbackPlaceholder": "请输入客户反馈内容", - "status": "状态", - "statusPlaceholder": "请输入状态", - "addService": "添加服务", - "updateService": "编辑服务", - "serviceDeleteTips": "确定要删除该数据吗?", - "startDate": "请选择开始时间", - "endDate": "请选择结束时间" -} + "serviceName":"服务名称", + "serviceNamePlaceholder":"请输入服务名称", + "previewImageUrl":"服务预览图", + "previewImageUrlPlaceholder":"请输入服务预览图", + "description":"服务描述", + "descriptionPlaceholder":"请输入服务描述", + "serviceType":"服务类型", + "serviceTypePlaceholder":"请输入服务类型", + "executionRules":"服务执行规则", + "executionRulesPlaceholder":"请输入服务执行规则", + "staffReminder":"是否员工提醒", + "staffReminderPlaceholder":"请输入是否员工提醒", + "customerReminder":"是否客户提醒", + "customerReminderPlaceholder":"请输入是否客户提醒", + "customerConfirmation":"是否客户确认", + "customerConfirmationPlaceholder":"请输入是否客户确认", + "customerFeedback":"客户反馈内容", + "customerFeedbackPlaceholder":"请输入客户反馈内容", + "status":"状态", + "statusPlaceholder":"请输入状态", + "addService":"添加服务", + "updateService":"编辑服务", + "serviceDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/app/lang/zh-cn/user_feedback.user_feedback.json b/admin/src/app/lang/zh-cn/user_feedback.user_feedback.json index 034d20f5..37a9ed22 100644 --- a/admin/src/app/lang/zh-cn/user_feedback.user_feedback.json +++ b/admin/src/app/lang/zh-cn/user_feedback.user_feedback.json @@ -1,15 +1,13 @@ { - "id": "反馈编号", - "idPlaceholder": "请输入反馈编号", - "userId": "用户ID", - "userIdPlaceholder": "请输入用户ID", - "feedbackText": "反馈内容", - "feedbackTextPlaceholder": "请输入反馈内容", - "attachmentUrl": "附件URL(OSS对象存储)", - "attachmentUrlPlaceholder": "请输入附件URL(OSS对象存储)", - "addUserFeedback": "添加用户反馈信息", - "updateUserFeedback": "编辑用户反馈信息", - "userFeedbackDeleteTips": "确定要删除该数据吗?", - "startDate": "请选择开始时间", - "endDate": "请选择结束时间" -} + "userId":"客户名称", + "userIdPlaceholder":"全部", + "feedbackText":"反馈内容", + "feedbackTextPlaceholder":"请输入反馈内容", + "attachmentUrl":"附件", + "attachmentUrlPlaceholder":"请输入附件", + "addUserFeedback":"添加用户反馈信息", + "updateUserFeedback":"查看用户反馈信息", + "userFeedbackDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/app/views/customer_resources/components/customer-resources-edit.vue b/admin/src/app/views/customer_resources/components/customer-resources-edit.vue index 26f5dc1f..6bccbc65 100644 --- a/admin/src/app/views/customer_resources/components/customer-resources-edit.vue +++ b/admin/src/app/views/customer_resources/components/customer-resources-edit.vue @@ -230,6 +230,26 @@ /> + + + + + + + + + @@ -410,6 +430,7 @@ import { ref, reactive, computed, watch } from 'vue' import { useDictionary } from '@/app/api/dict' import { t } from '@/lang' import type { FormInstance } from 'element-plus' +import { getMemberLabelAll } from '@/app/api/member' import { addCustomerResources, editCustomerResources, @@ -448,6 +469,7 @@ const initialFormData = { initial_intent: '', campus: '', status: '', + member_label:'', purchase_power: '', concept_awareness: '', @@ -461,6 +483,15 @@ const initialFormData = { second_visit_status: '', is_closed: '', } + + +const labelSelectData: any = ref(null) +// 获取全部标签 +const getMemberLabelAllFn = async () => { + labelSelectData.value = await (await getMemberLabelAll()).data +} +getMemberLabelAllFn() + const formData: Record = reactive({ ...initialFormData }) const formRef = ref() diff --git a/admin/src/app/views/customer_resources/customer_resources.vue b/admin/src/app/views/customer_resources/customer_resources.vue index ca1df18a..d6fa22ac 100644 --- a/admin/src/app/views/customer_resources/customer_resources.vue +++ b/admin/src/app/views/customer_resources/customer_resources.vue @@ -35,6 +35,24 @@ + + + + + + + @@ -93,6 +111,26 @@ :show-overflow-tooltip="true" /> + + + + + @@ -160,8 +198,9 @@ import Edit from '@/app/views/customer_resources/components/customer-resources-edit.vue' import Fp from '@/app/views/customer_resources/components/fp.vue' import Order from '@/app/views/order_table/components/order-table-edit.vue' - import Tc from '@/app/views/tc_dialog/tc_dialog.vue' + + import { getMemberLabelAll } from '@/app/api/member' import { useRouter, useRoute } from 'vue-router' const route = useRoute() @@ -179,6 +218,7 @@ "age": "", "gender": "", "phone_number": "", + "member_label" : "", 'type': '', "created_at" : "", "updated_at" : "" @@ -195,6 +235,12 @@ // const type = pageName == '业绩分配' ? 'yjfp' : 'khzy'; + // 获取全部标签 + const labelSelectData = ref([]) + const getMemberLabelAllFn = async () => { + labelSelectData.value = await (await getMemberLabelAll()).data + } + getMemberLabelAllFn() const modificationLog = (id : number) => { diff --git a/admin/src/app/views/departments/departments.vue b/admin/src/app/views/departments/departments.vue index ea937571..28c98635 100644 --- a/admin/src/app/views/departments/departments.vue +++ b/admin/src/app/views/departments/departments.vue @@ -25,7 +25,7 @@ diff --git a/admin/src/app/views/member/components/edit-member.vue b/admin/src/app/views/member/components/edit-member.vue index de5606e1..f2b76285 100644 --- a/admin/src/app/views/member/components/edit-member.vue +++ b/admin/src/app/views/member/components/edit-member.vue @@ -47,6 +47,7 @@ /> + + +
- + @@ -36,22 +36,25 @@ /> + + + + + + + + - + - - - - - - + @@ -88,13 +91,17 @@ import { addOrderTable, editOrderTable, getOrderTableInfo, getWithCustomerResour let showDialog = ref(false) const loading = ref(false) +function handleCourseChange(selectedId) { + const selectedCourse = courseIdList.value.find(item => item.id === selectedId) + formData.order_amount = selectedCourse ? selectedCourse.price : '' +} /** * 表单数据 */ const initialFormData = { id: '', resource_id: '', - order_status: '', + // order_status: '', payment_type: '', order_amount: '', course_id: '', @@ -110,11 +117,6 @@ const formRules = computed(() => { resource_id: [ { required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' }, - ] -, - order_status: [ - { required: true, message: t('orderStatusPlaceholder'), trigger: 'blur' }, - ] , payment_type: [ @@ -168,12 +170,12 @@ const confirm = async (formEl: FormInstance | undefined) => { } // 获取字典数据 - let order_statusList = ref([]) - const order_statusDictList = async () => { - order_statusList.value = await (await useDictionary('order_status')).data.dictionary - } - order_statusDictList(); - watch(() => order_statusList.value, () => { formData.order_status = order_statusList.value[0].value }) + // let order_statusList = ref([]) + // const order_statusDictList = async () => { + // order_statusList.value = await (await useDictionary('order_status')).data.dictionary + // } + // order_statusDictList(); + // watch(() => order_statusList.value, () => { formData.order_status = order_statusList.value[0].value }) let payment_typeList = ref([]) const payment_typeDictList = async () => { payment_typeList.value = await (await useDictionary('payment_type')).data.dictionary diff --git a/admin/src/app/views/service/components/service-edit.vue b/admin/src/app/views/service/components/service-edit.vue index b9903723..dceef127 100644 --- a/admin/src/app/views/service/components/service-edit.vue +++ b/admin/src/app/views/service/components/service-edit.vue @@ -1,311 +1,288 @@ - - - - - - + + + + + + diff --git a/admin/src/app/views/service/service.vue b/admin/src/app/views/service/service.vue index a5044402..1abbdbe8 100644 --- a/admin/src/app/views/service/service.vue +++ b/admin/src/app/views/service/service.vue @@ -1,321 +1,210 @@ - - - - - + + + + + diff --git a/admin/src/app/views/user_feedback/components/user-feedback-edit.vue b/admin/src/app/views/user_feedback/components/user-feedback-edit.vue index 063f268f..62f6b012 100644 --- a/admin/src/app/views/user_feedback/components/user-feedback-edit.vue +++ b/admin/src/app/views/user_feedback/components/user-feedback-edit.vue @@ -1,205 +1,175 @@ - - - - - - + + + + + + diff --git a/admin/src/app/views/user_feedback/user_feedback.vue b/admin/src/app/views/user_feedback/user_feedback.vue index 33442ab3..d65c4151 100644 --- a/admin/src/app/views/user_feedback/user_feedback.vue +++ b/admin/src/app/views/user_feedback/user_feedback.vue @@ -1,223 +1,177 @@ - - - - - + + + + + diff --git a/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php b/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php index 0564a1e4..f72cee5b 100644 --- a/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php +++ b/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php @@ -32,6 +32,7 @@ class CustomerResources extends BaseAdminController ["age",""], ["gender",""], ["phone_number",""], + ['member_label', 0], ["type","khzy"], ["created_at",[]], ["updated_at",[]], @@ -69,6 +70,8 @@ class CustomerResources extends BaseAdminController ["initial_intent",""], ["campus",""], ["status",""], + ['member_label', []], + ["create_year_month",date("Y-m")], ["create_date",date("Y-m-d")], ["purchase_power",""], @@ -110,6 +113,7 @@ class CustomerResources extends BaseAdminController ["initial_intent",""], ["campus",""], ["status",""], + ['member_label', []], ["create_year_month",date("Y-m")], ["create_date",date("Y-m-d")], diff --git a/niucloud/app/adminapi/controller/departments/Departments.php b/niucloud/app/adminapi/controller/departments/Departments.php index 66bd8e7f..c445c87f 100644 --- a/niucloud/app/adminapi/controller/departments/Departments.php +++ b/niucloud/app/adminapi/controller/departments/Departments.php @@ -54,8 +54,7 @@ class Departments extends BaseAdminController ]); $this->validate($data, 'app\validate\departments\Departments.add'); - $id = (new DepartmentsService())->add($data); - return success('ADD_SUCCESS', ['id' => $id]); + return (new DepartmentsService())->add($data); } /** @@ -70,8 +69,7 @@ class Departments extends BaseAdminController ]); $this->validate($data, 'app\validate\departments\Departments.edit'); - (new DepartmentsService())->edit($id, $data); - return success('EDIT_SUCCESS'); + return (new DepartmentsService())->edit($id, $data); } /** @@ -84,7 +82,7 @@ class Departments extends BaseAdminController return success('DELETE_SUCCESS'); } - + public function getDepartmentsAll(){ return success(( new DepartmentsService())->getDepartmentsAll()); } diff --git a/niucloud/app/adminapi/controller/order_table/OrderTable.php b/niucloud/app/adminapi/controller/order_table/OrderTable.php index 567bc89f..195b0d8c 100644 --- a/niucloud/app/adminapi/controller/order_table/OrderTable.php +++ b/niucloud/app/adminapi/controller/order_table/OrderTable.php @@ -50,7 +50,7 @@ class OrderTable extends BaseAdminController public function add(){ $data = $this->request->params([ ["resource_id",0], - ["order_status",""], +// ["order_status",""], ["payment_type",""], ["order_amount",0.00], ["course_id",0], @@ -58,8 +58,7 @@ class OrderTable extends BaseAdminController ]); $this->validate($data, 'app\validate\order_table\OrderTable.add'); - $id = (new OrderTableService())->add($data); - return success('ADD_SUCCESS', ['id' => $id]); + return (new OrderTableService())->add($data); } /** @@ -70,7 +69,7 @@ class OrderTable extends BaseAdminController public function edit(int $id){ $data = $this->request->params([ ["resource_id",0], - ["order_status",""], +// ["order_status",""], ["payment_type",""], ["order_amount",0.00], ["course_id",0], @@ -92,7 +91,7 @@ class OrderTable extends BaseAdminController return success('DELETE_SUCCESS'); } - + public function getCustomerResourcesAll(){ return success(( new OrderTableService())->getCustomerResourcesAll()); } diff --git a/niucloud/app/adminapi/controller/service/Service.php b/niucloud/app/adminapi/controller/service/Service.php index b13f7c9f..7f141dbe 100644 --- a/niucloud/app/adminapi/controller/service/Service.php +++ b/niucloud/app/adminapi/controller/service/Service.php @@ -29,14 +29,7 @@ class Service extends BaseAdminController public function lists(){ $data = $this->request->params([ ["service_name",""], - ["preview_image_url",""], - ["description",""], ["service_type",""], - ["execution_rules",""], - ["staff_reminder",""], - ["customer_reminder",""], - ["customer_confirmation",""], - ["customer_feedback",""], ["status",""] ]); return success((new ServiceService())->getPage($data)); diff --git a/niucloud/app/adminapi/controller/user_feedback/UserFeedback.php b/niucloud/app/adminapi/controller/user_feedback/UserFeedback.php index d68abfef..d2d5bcb4 100644 --- a/niucloud/app/adminapi/controller/user_feedback/UserFeedback.php +++ b/niucloud/app/adminapi/controller/user_feedback/UserFeedback.php @@ -28,9 +28,7 @@ class UserFeedback extends BaseAdminController */ public function lists(){ $data = $this->request->params([ - ["user_id",""], - ["feedback_text",""], - ["attachment_url",""] + ["user_id",""] ]); return success((new UserFeedbackService())->getPage($data)); } @@ -88,4 +86,8 @@ class UserFeedback extends BaseAdminController } + public function getCustomerResourcesAll(){ + return success(( new UserFeedbackService())->getCustomerResourcesAll()); + } + } diff --git a/niucloud/app/adminapi/route/service.php b/niucloud/app/adminapi/route/service.php index 84c5ee4f..e810689f 100644 --- a/niucloud/app/adminapi/route/service.php +++ b/niucloud/app/adminapi/route/service.php @@ -15,6 +15,7 @@ use app\adminapi\middleware\AdminCheckRole; use app\adminapi\middleware\AdminCheckToken; use app\adminapi\middleware\AdminLog; + // USER_CODE_BEGIN -- service Route::group('service', function () { diff --git a/niucloud/app/adminapi/route/user_feedback.php b/niucloud/app/adminapi/route/user_feedback.php index f8a6d6c7..3213d812 100644 --- a/niucloud/app/adminapi/route/user_feedback.php +++ b/niucloud/app/adminapi/route/user_feedback.php @@ -14,6 +14,7 @@ use think\facade\Route; use app\adminapi\middleware\AdminCheckRole; use app\adminapi\middleware\AdminCheckToken; use app\adminapi\middleware\AdminLog; + // USER_CODE_BEGIN -- user_feedback Route::group('user_feedback', function () { @@ -29,6 +30,8 @@ Route::group('user_feedback', function () { //删除用户反馈信息 Route::delete('user_feedback/:id', 'user_feedback.UserFeedback/del'); + Route::get('customer_resources_all','user_feedback.UserFeedback/getCustomerResourcesAll'); + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/model/customer_resources/CustomerResources.php b/niucloud/app/model/customer_resources/CustomerResources.php index bfcc6515..6183d5c8 100644 --- a/niucloud/app/model/customer_resources/CustomerResources.php +++ b/niucloud/app/model/customer_resources/CustomerResources.php @@ -15,6 +15,7 @@ use app\model\dict\Dict; use app\model\resource_sharing\ResourceSharing; use app\model\six_speed\SixSpeed; use core\base\BaseModel; +use think\db\Query; use think\model\concern\SoftDelete; use think\model\relation\HasMany; use think\model\relation\HasOne; @@ -57,6 +58,10 @@ class CustomerResources extends BaseModel */ protected $defaultSoftDelete = 0; + protected $json = [ 'member_label' ]; + + protected $jsonAssoc = true; + //定义一个常量数组-字段中文映射 const FieldZh = [ 'id' => '编号', @@ -96,6 +101,14 @@ class CustomerResources extends BaseModel } } + public function searchMemberLabelAttr(Query $query, $value, $data) + { + if ($value) { + $query->whereLike('member_label', '%"' . $value . '"%'); + } + } + + /** * 搜索器:客户资源联系电话 * @param $value diff --git a/niucloud/app/model/service/Service.php b/niucloud/app/model/service/Service.php index 0ad8b2f4..5ea59fbe 100644 --- a/niucloud/app/model/service/Service.php +++ b/niucloud/app/model/service/Service.php @@ -50,18 +50,6 @@ class Service extends BaseModel */ protected $defaultSoftDelete = 0; - /** - * 搜索器:服务服务编号 - * @param $value - * @param $data - */ - public function searchIdAttr($query, $value, $data) - { - if ($value) { - $query->where("id", $value); - } - } - /** * 搜索器:服务服务名称 * @param $value @@ -74,30 +62,6 @@ class Service extends BaseModel } } - /** - * 搜索器:服务服务预览图URL - * @param $value - * @param $data - */ - public function searchPreviewImageUrlAttr($query, $value, $data) - { - if ($value) { - $query->where("preview_image_url", $value); - } - } - - /** - * 搜索器:服务服务描述 - * @param $value - * @param $data - */ - public function searchDescriptionAttr($query, $value, $data) - { - if ($value) { - $query->where("description", $value); - } - } - /** * 搜索器:服务服务类型 * @param $value @@ -110,66 +74,6 @@ class Service extends BaseModel } } - /** - * 搜索器:服务服务执行规则 - * @param $value - * @param $data - */ - public function searchExecutionRulesAttr($query, $value, $data) - { - if ($value) { - $query->where("execution_rules", $value); - } - } - - /** - * 搜索器:服务是否员工提醒: 1-是, 0-否 - * @param $value - * @param $data - */ - public function searchStaffReminderAttr($query, $value, $data) - { - if ($value) { - $query->where("staff_reminder", $value); - } - } - - /** - * 搜索器:服务是否客户提醒: 1-是, 0-否 - * @param $value - * @param $data - */ - public function searchCustomerReminderAttr($query, $value, $data) - { - if ($value) { - $query->where("customer_reminder", $value); - } - } - - /** - * 搜索器:服务是否客户确认: 1-是, 0-否 - * @param $value - * @param $data - */ - public function searchCustomerConfirmationAttr($query, $value, $data) - { - if ($value) { - $query->where("customer_confirmation", $value); - } - } - - /** - * 搜索器:服务客户反馈内容 - * @param $value - * @param $data - */ - public function searchCustomerFeedbackAttr($query, $value, $data) - { - if ($value) { - $query->where("customer_feedback", $value); - } - } - /** * 搜索器:服务状态 * @param $value diff --git a/niucloud/app/model/user_feedback/UserFeedback.php b/niucloud/app/model/user_feedback/UserFeedback.php index 30dc4904..1248b8e3 100644 --- a/niucloud/app/model/user_feedback/UserFeedback.php +++ b/niucloud/app/model/user_feedback/UserFeedback.php @@ -16,6 +16,8 @@ use think\model\concern\SoftDelete; use think\model\relation\HasMany; use think\model\relation\HasOne; +use app\model\customer_resources\CustomerResources; + /** * 用户反馈信息模型 * Class UserFeedback @@ -43,19 +45,7 @@ class UserFeedback extends BaseModel /** - * 搜索器:用户反馈信息反馈编号 - * @param $value - * @param $data - */ - public function searchIdAttr($query, $value, $data) - { - if ($value) { - $query->where("id", $value); - } - } - - /** - * 搜索器:用户反馈信息用户ID + * 搜索器:用户反馈信息客户名称 * @param $value * @param $data */ @@ -66,33 +56,13 @@ class UserFeedback extends BaseModel } } - /** - * 搜索器:用户反馈信息反馈内容 - * @param $value - * @param $data - */ - public function searchFeedbackTextAttr($query, $value, $data) - { - if ($value) { - $query->where("feedback_text", $value); - } - } - - /** - * 搜索器:用户反馈信息附件URL(OSS对象存储) - * @param $value - * @param $data - */ - public function searchAttachmentUrlAttr($query, $value, $data) - { - if ($value) { - $query->where("attachment_url", $value); - } - } - + public function customerResources(){ + return $this->hasOne(CustomerResources::class, 'id', 'user_id')->joinType('left')->withField('name,id')->bind(['user_id_name'=>'name']); + } + } diff --git a/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php b/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php index 6f549033..52fdd479 100644 --- a/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php +++ b/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php @@ -19,6 +19,7 @@ use app\model\campus\Campus; use app\model\resource_sharing\ResourceSharing; use app\model\six_speed\SixSpeed; use app\model\six_speed_modification_log\SixSpeedModificationLog; +use app\service\admin\member\MemberLabelService; use core\base\BaseAdminService; @@ -66,9 +67,9 @@ class CustomerResourcesService extends BaseAdminService $where[] = ['b.shared_by','=',0]; } - - - + if($data['member_label']){ + $where[] = ['a.member_label','like',"%".$data['member_label']."%"]; + } $search_model = $this->model @@ -87,11 +88,9 @@ class CustomerResourcesService extends BaseAdminService } - $list = $this->pageQuery($search_model); - - - - return $list; + return $this->pageQuery($search_model, function ($item, $key) { + $item = $this->makeUp($item); + }); } /** @@ -101,7 +100,7 @@ class CustomerResourcesService extends BaseAdminService */ public function getInfo(int $id) { - $field = 'id,create_year_month,create_date,source,source_channel,consultant,name,age,gender,phone_number,demand,purchasing_power,cognitive_idea,optional_class_time,distance,decision_maker,initial_intent,campus,created_at,updated_at,deleted_at,status'; + $field = 'id,create_year_month,create_date,source,source_channel,member_label,consultant,name,age,gender,phone_number,demand,purchasing_power,cognitive_idea,optional_class_time,distance,decision_maker,initial_intent,campus,created_at,updated_at,deleted_at,status'; $info = $this->model->field($field)->where([['id', "=", $id]])->with(['personnel'])->findOrEmpty()->toArray(); @@ -109,7 +108,16 @@ class CustomerResourcesService extends BaseAdminService $data = $sixSpeed->where(['resource_id' => $id])->field("*,distance as distance_tow")->findOrEmpty()->toArray(); $info = $info+$data; - return $info; + return $this->makeUp($info); + } + + + public function makeUp($data){ + //会员标签 + if(!empty($data['member_label'])){ + $data['member_label_array'] = (new MemberLabelService())->getMemberLabelListByLabelIds($data['member_label']); + } + return $data; } /** @@ -128,6 +136,8 @@ class CustomerResourcesService extends BaseAdminService } $sixSpeed = new SixSpeed(); +// $data['member_label'] = json_encode($data['member_label']); + $res = $this->model->create($data); @@ -188,7 +198,7 @@ class CustomerResourcesService extends BaseAdminService $this->model->where([['id', '=', $id]])->update([ 'source' => $data['source'], 'source_channel' => $data['source_channel'], -// 'consultant' => $data['consultant'], + 'member_label' => $data['member_label'], 'name' => $data['name'], 'age' => $data['age'], 'gender' => $data['gender'], diff --git a/niucloud/app/service/admin/departments/DepartmentsService.php b/niucloud/app/service/admin/departments/DepartmentsService.php index 19001566..4cd99018 100644 --- a/niucloud/app/service/admin/departments/DepartmentsService.php +++ b/niucloud/app/service/admin/departments/DepartmentsService.php @@ -65,8 +65,12 @@ class DepartmentsService extends BaseAdminService */ public function add(array $data) { + + if($this->model->where(['department_name' => $data['department_name']])->find()){ + return fail("部门名称不能重复"); + } $res = $this->model->create($data); - return $res->id; + return success("操作成功"); } @@ -74,13 +78,14 @@ class DepartmentsService extends BaseAdminService * 部门编辑 * @param int $id * @param array $data - * @return bool */ public function edit(int $id, array $data) { - + if($this->model->where([['id', '<>', $id]])->where(['department_name' => $data['department_name']])->find()){ + return fail("部门名称不能重复"); + } $this->model->where([['id', '=', $id]])->update($data); - return true; + return success("操作成功"); } /** diff --git a/niucloud/app/service/admin/order_table/OrderTableService.php b/niucloud/app/service/admin/order_table/OrderTableService.php index 82adfc4a..cfd54c7b 100644 --- a/niucloud/app/service/admin/order_table/OrderTableService.php +++ b/niucloud/app/service/admin/order_table/OrderTableService.php @@ -69,15 +69,15 @@ class OrderTableService extends BaseAdminService public function add(array $data) { $personnel = new Personnel(); - $data['staff_id'] = $personnel->where(['sys_user_id' => $this->uid])->value("id"); - if(!$data['staff_id']){ - return fail("操作失败"); - } +// $data['staff_id'] = $personnel->where(['sys_user_id' => $this->uid])->value("id"); +// if(!$data['staff_id']){ +// return fail("操作失败"); +// } -// $data['staff_id'] = 1; + $data['staff_id'] = 1; $res = $this->model->create($data); - return $res->id; + return success("操作成功"); } diff --git a/niucloud/app/service/admin/service/ServiceService.php b/niucloud/app/service/admin/service/ServiceService.php index 25fee84d..92e73d81 100644 --- a/niucloud/app/service/admin/service/ServiceService.php +++ b/niucloud/app/service/admin/service/ServiceService.php @@ -39,7 +39,7 @@ class ServiceService extends BaseAdminService $field = 'id,service_name,preview_image_url,description,service_type,execution_rules,staff_reminder,customer_reminder,customer_confirmation,customer_feedback,status,created_at,updated_at,deleted_at'; $order = 'id desc'; - $search_model = $this->model->withSearch(["id","service_name","preview_image_url","description","service_type","execution_rules","staff_reminder","customer_reminder","customer_confirmation","customer_feedback","status"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["service_name","service_type","status"], $where)->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } diff --git a/niucloud/app/service/admin/user_feedback/UserFeedbackService.php b/niucloud/app/service/admin/user_feedback/UserFeedbackService.php index 5cb4d753..0a5d0034 100644 --- a/niucloud/app/service/admin/user_feedback/UserFeedbackService.php +++ b/niucloud/app/service/admin/user_feedback/UserFeedbackService.php @@ -12,6 +12,7 @@ namespace app\service\admin\user_feedback; use app\model\user_feedback\UserFeedback; +use app\model\customer_resources\CustomerResources; use core\base\BaseAdminService; @@ -39,7 +40,7 @@ class UserFeedbackService extends BaseAdminService $field = 'id,user_id,feedback_text,attachment_url,created_at,updated_at'; $order = 'id desc'; - $search_model = $this->model->withSearch(["id","user_id","feedback_text","attachment_url"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["user_id"], $where)->with(['customerResources'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } @@ -53,7 +54,7 @@ class UserFeedbackService extends BaseAdminService { $field = 'id,user_id,feedback_text,attachment_url,created_at,updated_at'; - $info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['customerResources'])->findOrEmpty()->toArray(); return $info; } @@ -95,5 +96,10 @@ class UserFeedbackService extends BaseAdminService } + public function getCustomerResourcesAll(){ + $customerResourcesModel = new CustomerResources(); + return $customerResourcesModel->select()->toArray(); + } + } diff --git a/niucloud/app/validate/order_table/OrderTable.php b/niucloud/app/validate/order_table/OrderTable.php index e027bebf..2c4087f8 100644 --- a/niucloud/app/validate/order_table/OrderTable.php +++ b/niucloud/app/validate/order_table/OrderTable.php @@ -38,8 +38,8 @@ class OrderTable extends BaseValidate ]; protected $scene = [ - "add" => ['resource_id', 'order_status', 'payment_type', 'order_amount', 'course_id', 'class_id'], - "edit" => ['resource_id', 'order_status', 'payment_type', 'order_amount', 'course_id', 'class_id'] + "add" => ['resource_id', 'payment_type', 'order_amount', 'course_id', 'class_id'], + "edit" => ['resource_id', 'payment_type', 'order_amount', 'course_id', 'class_id'] ]; } diff --git a/niucloud/app/validate/user_feedback/UserFeedback.php b/niucloud/app/validate/user_feedback/UserFeedback.php index 580c8ad8..e8a06258 100644 --- a/niucloud/app/validate/user_feedback/UserFeedback.php +++ b/niucloud/app/validate/user_feedback/UserFeedback.php @@ -20,13 +20,11 @@ class UserFeedback extends BaseValidate { protected $rule = [ - 'user_id' => 'require', - 'feedback_text' => 'require', + ]; protected $message = [ - 'user_id.require' => ['common_validate.require', ['user_id']], - 'feedback_text.require' => ['common_validate.require', ['feedback_text']], + ]; protected $scene = [ From 0ed8684db6f684363efdd212e3ad86e37204e3e0 Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Thu, 22 May 2025 18:39:09 +0800 Subject: [PATCH 4/7] 1 --- admin/src/app/api/reimbursement.ts | 31 +- admin/src/app/api/salary.ts | 33 +- .../zh-cn/reimbursement.reimbursement.json | 39 +- admin/src/app/lang/zh-cn/salary.salary.json | 62 +- .../campus_person_role/campus_person_role.vue | 16 +- .../views/course/components/course-edit.vue | 2 +- admin/src/app/views/course/course.vue | 62 +- .../components/reimbursement-edit.vue | 445 ++++++------- .../app/views/reimbursement/reimbursement.vue | 465 ++++++------- .../views/salary/components/salary-edit.vue | 621 ++++++++---------- admin/src/app/views/salary/salary.vue | 592 +++++++---------- .../reimbursement/Reimbursement.php | 12 +- .../app/adminapi/controller/salary/Salary.php | 32 +- niucloud/app/adminapi/route/reimbursement.php | 6 + niucloud/app/adminapi/route/salary.php | 8 + .../app/model/reimbursement/Reimbursement.php | 80 +-- niucloud/app/model/salary/Salary.php | 140 +--- .../reimbursement/ReimbursementService.php | 10 +- .../service/admin/salary/SalaryService.php | 20 +- .../validate/reimbursement/Reimbursement.php | 6 +- niucloud/app/validate/salary/Salary.php | 10 +- 21 files changed, 1166 insertions(+), 1526 deletions(-) diff --git a/admin/src/app/api/reimbursement.ts b/admin/src/app/api/reimbursement.ts index b39e5216..dbe9d5b9 100644 --- a/admin/src/app/api/reimbursement.ts +++ b/admin/src/app/api/reimbursement.ts @@ -1,5 +1,13 @@ import request from '@/utils/request' + + + + + + + + // USER_CODE_BEGIN -- reimbursement /** * 获取报销记录列表 @@ -7,7 +15,7 @@ import request from '@/utils/request' * @returns */ export function getReimbursementList(params: Record) { - return request.get(`reimbursement/reimbursement`, { params }) + return request.get(`reimbursement/reimbursement`, {params}) } /** @@ -16,7 +24,7 @@ export function getReimbursementList(params: Record) { * @returns */ export function getReimbursementInfo(id: number) { - return request.get(`reimbursement/reimbursement/${id}`) + return request.get(`reimbursement/reimbursement/${id}`); } /** @@ -25,10 +33,7 @@ export function getReimbursementInfo(id: number) { * @returns */ export function addReimbursement(params: Record) { - return request.post('reimbursement/reimbursement', params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.post('reimbursement/reimbursement', params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -38,10 +43,7 @@ export function addReimbursement(params: Record) { * @returns */ export function editReimbursement(params: Record) { - return request.put(`reimbursement/reimbursement/${params.id}`, params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.put(`reimbursement/reimbursement/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -50,10 +52,11 @@ export function editReimbursement(params: Record) { * @returns */ export function deleteReimbursement(id: number) { - return request.delete(`reimbursement/reimbursement/${id}`, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.delete(`reimbursement/reimbursement/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithPersonnelList(params: Record){ + return request.get('reimbursement/personnel_all', {params}) } // USER_CODE_END -- reimbursement diff --git a/admin/src/app/api/salary.ts b/admin/src/app/api/salary.ts index 832f43ef..1595835c 100644 --- a/admin/src/app/api/salary.ts +++ b/admin/src/app/api/salary.ts @@ -1,5 +1,13 @@ import request from '@/utils/request' + + + + + + + + // USER_CODE_BEGIN -- salary /** * 获取工资列表 @@ -7,7 +15,7 @@ import request from '@/utils/request' * @returns */ export function getSalaryList(params: Record) { - return request.get(`salary/salary`, { params }) + return request.get(`salary/salary`, {params}) } /** @@ -16,7 +24,7 @@ export function getSalaryList(params: Record) { * @returns */ export function getSalaryInfo(id: number) { - return request.get(`salary/salary/${id}`) + return request.get(`salary/salary/${id}`); } /** @@ -25,10 +33,7 @@ export function getSalaryInfo(id: number) { * @returns */ export function addSalary(params: Record) { - return request.post('salary/salary', params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.post('salary/salary', params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -38,10 +43,7 @@ export function addSalary(params: Record) { * @returns */ export function editSalary(params: Record) { - return request.put(`salary/salary/${params.id}`, params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.put(`salary/salary/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -50,10 +52,13 @@ export function editSalary(params: Record) { * @returns */ export function deleteSalary(id: number) { - return request.delete(`salary/salary/${id}`, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.delete(`salary/salary/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithPersonnelList(params: Record){ + return request.get('salary/personnel_all', {params}) +}export function getWithDepartmentsList(params: Record){ + return request.get('salary/departments_all', {params}) } // USER_CODE_END -- salary diff --git a/admin/src/app/lang/zh-cn/reimbursement.reimbursement.json b/admin/src/app/lang/zh-cn/reimbursement.reimbursement.json index 04005c96..2354c226 100644 --- a/admin/src/app/lang/zh-cn/reimbursement.reimbursement.json +++ b/admin/src/app/lang/zh-cn/reimbursement.reimbursement.json @@ -1,21 +1,20 @@ { - "id": "报销编号", - "idPlaceholder": "请输入报销编号", - "applicantId": "申请人ID", - "applicantIdPlaceholder": "请输入申请人ID", - "amount": "报销金额", - "amountPlaceholder": "请输入报销金额", - "description": "报销描述", - "descriptionPlaceholder": "请输入报销描述", - "receiptUrl": "发票或收据URL", - "receiptUrlPlaceholder": "请输入发票或收据URL", - "status": "状态", - "statusPlaceholder": "请输入状态", - "processId": "关联的审批流程ID", - "processIdPlaceholder": "请输入关联的审批流程ID", - "addReimbursement": "添加报销记录", - "updateReimbursement": "编辑报销记录", - "reimbursementDeleteTips": "确定要删除该数据吗?", - "startDate": "请选择开始时间", - "endDate": "请选择结束时间" -} + "applicantId":"申请人", + "applicantIdPlaceholder":"请输入申请人", + "amount":"报销金额", + "amountPlaceholder":"请输入报销金额", + "description":"报销描述", + "descriptionPlaceholder":"请输入报销描述", + "receiptUrl":"发票或收据", + "receiptUrlPlaceholder":"请输入发票或收据", + "status":"状态", + "statusPlaceholder":"请输入状态", + "createdAt":"创建时间", + "createdAtPlaceholder":"请输入创建时间", + "updatedAt":"修改时间", + "addReimbursement":"添加报销记录", + "updateReimbursement":"编辑报销记录", + "reimbursementDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/app/lang/zh-cn/salary.salary.json b/admin/src/app/lang/zh-cn/salary.salary.json index 731b2352..43426578 100644 --- a/admin/src/app/lang/zh-cn/salary.salary.json +++ b/admin/src/app/lang/zh-cn/salary.salary.json @@ -1,33 +1,31 @@ { - "id": "工资编号", - "idPlaceholder": "请输入工资编号", - "staffId": "员工ID", - "staffIdPlaceholder": "请输入员工ID", - "baseSalary": "底薪", - "baseSalaryPlaceholder": "请输入底薪", - "performanceBonus": "绩效", - "performanceBonusPlaceholder": "请输入绩效", - "deductions": "扣款", - "deductionsPlaceholder": "请输入扣款", - "otherSubsidies": "其他补贴", - "otherSubsidiesPlaceholder": "请输入其他补贴", - "netSalary": "实发工资", - "netSalaryPlaceholder": "请输入实发工资", - "paymentStatus": "发放状态", - "paymentStatusPlaceholder": "请输入发放状态", - "paymentMethod": "发放方式", - "paymentMethodPlaceholder": "请输入发放方式", - "remarks": "备注", - "remarksPlaceholder": "请输入备注", - "salaryMonth": "工资月份", - "salaryMonthPlaceholder": "请输入工资月份", - "departmentId": "部门ID", - "departmentIdPlaceholder": "请输入部门ID", - "processId": "关联的审批流程ID", - "processIdPlaceholder": "请输入关联的审批流程ID", - "addSalary": "添加工资", - "updateSalary": "编辑工资", - "salaryDeleteTips": "确定要删除该数据吗?", - "startDate": "请选择开始时间", - "endDate": "请选择结束时间" -} + "staffId":"员工", + "staffIdPlaceholder":"全部", + "departmentId":"部门", + "departmentIdPlaceholder":"全部", + "baseSalary":"底薪", + "baseSalaryPlaceholder":"请输入底薪", + "performanceBonus":"绩效", + "performanceBonusPlaceholder":"请输入绩效", + "deductions":"扣款", + "deductionsPlaceholder":"请输入扣款", + "otherSubsidies":"其他补贴", + "otherSubsidiesPlaceholder":"请输入其他补贴", + "netSalary":"实发工资", + "paymentStatus":"发放状态", + "paymentStatusPlaceholder":"请输入发放状态", + "paymentMethod":"发放方式", + "paymentMethodPlaceholder":"请输入发放方式", + "remarks":"备注", + "remarksPlaceholder":"请输入备注", + "salaryMonth":"工资月份", + "salaryMonthPlaceholder":"请输入工资月份", + "createdAt":"创建时间", + "createdAtPlaceholder":"请输入创建时间", + "updatedAt":"修改时间", + "addSalary":"添加工资", + "updateSalary":"编辑工资", + "salaryDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/app/views/campus_person_role/campus_person_role.vue b/admin/src/app/views/campus_person_role/campus_person_role.vue index 32add873..7802c064 100644 --- a/admin/src/app/views/campus_person_role/campus_person_role.vue +++ b/admin/src/app/views/campus_person_role/campus_person_role.vue @@ -65,7 +65,7 @@ - + {{ @@ -186,7 +186,6 @@ const route = useRoute() const pageName = route.meta.title // ?dept_id=1 -const dept_id = pageName == '市场人员列表' ? 1 : 2; let campusPersonRoleTable = reactive({ page: 1, limit: 10, @@ -197,10 +196,19 @@ let campusPersonRoleTable = reactive({ campus_id: '', person_id: '', role_id: '', - dept_id: dept_id, + dept_id: '', }, }) + +if(pageName == '市场人员列表'){ + campusPersonRoleTable.searchParam.dept_id = 1; +}else if(pageName == '销售人员列表'){ + campusPersonRoleTable.searchParam.dept_id = 2; +}else if(pageName == '教练管理'){ + campusPersonRoleTable.searchParam.role_id = 5; +} + const searchFormRef = ref() // 选中数据 diff --git a/admin/src/app/views/course/components/course-edit.vue b/admin/src/app/views/course/components/course-edit.vue index 07e8534e..9221ca72 100644 --- a/admin/src/app/views/course/components/course-edit.vue +++ b/admin/src/app/views/course/components/course-edit.vue @@ -33,7 +33,7 @@ v-for="(item, index) in courseTypeList" :key="index" :label="item.name" - :value="item.value" + :value="item.name" /> diff --git a/admin/src/app/views/course/course.vue b/admin/src/app/views/course/course.vue index aed2b754..0ebc564e 100644 --- a/admin/src/app/views/course/course.vue +++ b/admin/src/app/views/course/course.vue @@ -31,56 +31,12 @@ - - - - - - - - - - - - - - - - - - - - - + {{ @@ -227,7 +183,17 @@ let courseTable = reactive({ remarks: '', }, }) -const courseTypeList = useDictionary('course_type') +// const courseTypeList = useDictionary('course_type') + + +const courseTypeList = ref([]) +const getcourseTypeList = async () => { + courseTypeList.value = await ( + await useDictionary('course_type') + ).data.dictionary +} +getcourseTypeList() + const searchFormRef = ref() // 选中数据 diff --git a/admin/src/app/views/reimbursement/components/reimbursement-edit.vue b/admin/src/app/views/reimbursement/components/reimbursement-edit.vue index f20cdcc4..2f87bfcf 100644 --- a/admin/src/app/views/reimbursement/components/reimbursement-edit.vue +++ b/admin/src/app/views/reimbursement/components/reimbursement-edit.vue @@ -1,236 +1,209 @@ - - - - - - + + + + + + diff --git a/admin/src/app/views/reimbursement/reimbursement.vue b/admin/src/app/views/reimbursement/reimbursement.vue index 1837ae03..1e087d1a 100644 --- a/admin/src/app/views/reimbursement/reimbursement.vue +++ b/admin/src/app/views/reimbursement/reimbursement.vue @@ -1,265 +1,200 @@ - - - - - + + + + + diff --git a/admin/src/app/views/salary/components/salary-edit.vue b/admin/src/app/views/salary/components/salary-edit.vue index d1c3dccc..c7915efa 100644 --- a/admin/src/app/views/salary/components/salary-edit.vue +++ b/admin/src/app/views/salary/components/salary-edit.vue @@ -1,330 +1,291 @@ - - - - - - + + + + + + diff --git a/admin/src/app/views/salary/salary.vue b/admin/src/app/views/salary/salary.vue index 947e5823..359b9ff5 100644 --- a/admin/src/app/views/salary/salary.vue +++ b/admin/src/app/views/salary/salary.vue @@ -1,346 +1,246 @@ - - - - - + + + + + diff --git a/niucloud/app/adminapi/controller/reimbursement/Reimbursement.php b/niucloud/app/adminapi/controller/reimbursement/Reimbursement.php index f718b119..5a5292a5 100644 --- a/niucloud/app/adminapi/controller/reimbursement/Reimbursement.php +++ b/niucloud/app/adminapi/controller/reimbursement/Reimbursement.php @@ -28,12 +28,8 @@ class Reimbursement extends BaseAdminController */ public function lists(){ $data = $this->request->params([ - ["applicant_id",""], - ["amount",""], - ["description",""], - ["receipt_url",""], ["status",""], - ["process_id",""] + ["created_at",["",""]] ]); return success((new ReimbursementService())->getPage($data)); } @@ -58,7 +54,6 @@ class Reimbursement extends BaseAdminController ["description",""], ["receipt_url",""], ["status",""], - ["process_id",0], ]); $this->validate($data, 'app\validate\reimbursement\Reimbursement.add'); @@ -78,7 +73,6 @@ class Reimbursement extends BaseAdminController ["description",""], ["receipt_url",""], ["status",""], - ["process_id",0], ]); $this->validate($data, 'app\validate\reimbursement\Reimbursement.edit'); @@ -97,4 +91,8 @@ class Reimbursement extends BaseAdminController } + public function getPersonnelAll(){ + return success(( new ReimbursementService())->getPersonnelAll()); + } + } diff --git a/niucloud/app/adminapi/controller/salary/Salary.php b/niucloud/app/adminapi/controller/salary/Salary.php index 55746ace..1d251f6a 100644 --- a/niucloud/app/adminapi/controller/salary/Salary.php +++ b/niucloud/app/adminapi/controller/salary/Salary.php @@ -29,17 +29,9 @@ class Salary extends BaseAdminController public function lists(){ $data = $this->request->params([ ["staff_id",""], - ["base_salary",""], - ["performance_bonus",""], - ["deductions",""], - ["other_subsidies",""], - ["net_salary",""], - ["payment_status",""], - ["payment_method",""], - ["remarks",""], - ["salary_month",""], ["department_id",""], - ["process_id",""] + ["payment_status",""], + ["created_at",["",""]] ]); return success((new SalaryService())->getPage($data)); } @@ -60,17 +52,15 @@ class Salary extends BaseAdminController public function add(){ $data = $this->request->params([ ["staff_id",0], + ["department_id",0], ["base_salary",0.00], ["performance_bonus",0.00], ["deductions",0.00], ["other_subsidies",0.00], - ["net_salary",0.00], ["payment_status",""], ["payment_method",""], ["remarks",""], - ["salary_month","2025-05-16 17:53:32"], - ["department_id",0], - ["process_id",0], + ["salary_month","2025-05-22 18:20:42"], ]); $this->validate($data, 'app\validate\salary\Salary.add'); @@ -86,17 +76,15 @@ class Salary extends BaseAdminController public function edit(int $id){ $data = $this->request->params([ ["staff_id",0], + ["department_id",0], ["base_salary",0.00], ["performance_bonus",0.00], ["deductions",0.00], ["other_subsidies",0.00], - ["net_salary",0.00], ["payment_status",""], ["payment_method",""], ["remarks",""], - ["salary_month","2025-05-16 17:53:32"], - ["department_id",0], - ["process_id",0], + ["salary_month","2025-05-22 18:20:42"], ]); $this->validate($data, 'app\validate\salary\Salary.edit'); @@ -115,4 +103,12 @@ class Salary extends BaseAdminController } + public function getPersonnelAll(){ + return success(( new SalaryService())->getPersonnelAll()); + } + + public function getDepartmentsAll(){ + return success(( new SalaryService())->getDepartmentsAll()); + } + } diff --git a/niucloud/app/adminapi/route/reimbursement.php b/niucloud/app/adminapi/route/reimbursement.php index eb7ca140..451916c0 100644 --- a/niucloud/app/adminapi/route/reimbursement.php +++ b/niucloud/app/adminapi/route/reimbursement.php @@ -14,6 +14,10 @@ use think\facade\Route; use app\adminapi\middleware\AdminCheckRole; use app\adminapi\middleware\AdminCheckToken; use app\adminapi\middleware\AdminLog; + + + + // USER_CODE_BEGIN -- reimbursement Route::group('reimbursement', function () { @@ -29,6 +33,8 @@ Route::group('reimbursement', function () { //删除报销记录 Route::delete('reimbursement/:id', 'reimbursement.Reimbursement/del'); + Route::get('personnel_all','reimbursement.Reimbursement/getPersonnelAll'); + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/adminapi/route/salary.php b/niucloud/app/adminapi/route/salary.php index 48389bb8..adb6de61 100644 --- a/niucloud/app/adminapi/route/salary.php +++ b/niucloud/app/adminapi/route/salary.php @@ -14,6 +14,10 @@ use think\facade\Route; use app\adminapi\middleware\AdminCheckRole; use app\adminapi\middleware\AdminCheckToken; use app\adminapi\middleware\AdminLog; + + + + // USER_CODE_BEGIN -- salary Route::group('salary', function () { @@ -29,6 +33,10 @@ Route::group('salary', function () { //删除工资 Route::delete('salary/:id', 'salary.Salary/del'); + Route::get('personnel_all','salary.Salary/getPersonnelAll'); + + Route::get('departments_all','salary.Salary/getDepartmentsAll'); + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/model/reimbursement/Reimbursement.php b/niucloud/app/model/reimbursement/Reimbursement.php index 6884ddbb..10d5fc4c 100644 --- a/niucloud/app/model/reimbursement/Reimbursement.php +++ b/niucloud/app/model/reimbursement/Reimbursement.php @@ -16,6 +16,8 @@ use think\model\concern\SoftDelete; use think\model\relation\HasMany; use think\model\relation\HasOne; +use app\model\personnel\Personnel; + /** * 报销记录模型 * Class Reimbursement @@ -42,66 +44,6 @@ class Reimbursement extends BaseModel - /** - * 搜索器:报销记录报销编号 - * @param $value - * @param $data - */ - public function searchIdAttr($query, $value, $data) - { - if ($value) { - $query->where("id", $value); - } - } - - /** - * 搜索器:报销记录申请人ID - * @param $value - * @param $data - */ - public function searchApplicantIdAttr($query, $value, $data) - { - if ($value) { - $query->where("applicant_id", $value); - } - } - - /** - * 搜索器:报销记录报销金额 - * @param $value - * @param $data - */ - public function searchAmountAttr($query, $value, $data) - { - if ($value) { - $query->where("amount", $value); - } - } - - /** - * 搜索器:报销记录报销描述 - * @param $value - * @param $data - */ - public function searchDescriptionAttr($query, $value, $data) - { - if ($value) { - $query->where("description", $value); - } - } - - /** - * 搜索器:报销记录发票或收据URL - * @param $value - * @param $data - */ - public function searchReceiptUrlAttr($query, $value, $data) - { - if ($value) { - $query->where("receipt_url", $value); - } - } - /** * 搜索器:报销记录状态 * @param $value @@ -115,14 +57,20 @@ class Reimbursement extends BaseModel } /** - * 搜索器:报销记录关联的审批流程ID + * 搜索器:报销记录创建时间 * @param $value * @param $data */ - public function searchProcessIdAttr($query, $value, $data) + public function searchCreatedAtAttr($query, $value, $data) { - if ($value) { - $query->where("process_id", $value); + $start = empty($value[0]) ? 0 : strtotime($value[0]); + $end = empty($value[1]) ? 0 : strtotime($value[1]); + if ($start > 0 && $end > 0) { + $query->where([["created_at", "between", [$start, $end]]]); + } else if ($start > 0 && $end == 0) { + $query->where([["created_at", ">=", $start]]); + } else if ($start == 0 && $end > 0) { + $query->where([["created_at", "<=", $end]]); } } @@ -131,4 +79,8 @@ class Reimbursement extends BaseModel + public function personnel(){ + return $this->hasOne(Personnel::class, 'id', 'applicant_id')->joinType('left')->withField('name,id')->bind(['applicant_id_name'=>'name']); + } + } diff --git a/niucloud/app/model/salary/Salary.php b/niucloud/app/model/salary/Salary.php index f7106bed..b16e4a4f 100644 --- a/niucloud/app/model/salary/Salary.php +++ b/niucloud/app/model/salary/Salary.php @@ -16,6 +16,10 @@ use think\model\concern\SoftDelete; use think\model\relation\HasMany; use think\model\relation\HasOne; +use app\model\personnel\Personnel; + +use app\model\departments\Departments; + /** * 工资模型 * Class Salary @@ -43,19 +47,7 @@ class Salary extends BaseModel /** - * 搜索器:工资工资编号 - * @param $value - * @param $data - */ - public function searchIdAttr($query, $value, $data) - { - if ($value) { - $query->where("id", $value); - } - } - - /** - * 搜索器:工资员工ID + * 搜索器:工资员工 * @param $value * @param $data */ @@ -67,62 +59,14 @@ class Salary extends BaseModel } /** - * 搜索器:工资底薪 - * @param $value - * @param $data - */ - public function searchBaseSalaryAttr($query, $value, $data) - { - if ($value) { - $query->where("base_salary", $value); - } - } - - /** - * 搜索器:工资绩效 - * @param $value - * @param $data - */ - public function searchPerformanceBonusAttr($query, $value, $data) - { - if ($value) { - $query->where("performance_bonus", $value); - } - } - - /** - * 搜索器:工资扣款 - * @param $value - * @param $data - */ - public function searchDeductionsAttr($query, $value, $data) - { - if ($value) { - $query->where("deductions", $value); - } - } - - /** - * 搜索器:工资其他补贴 - * @param $value - * @param $data - */ - public function searchOtherSubsidiesAttr($query, $value, $data) - { - if ($value) { - $query->where("other_subsidies", $value); - } - } - - /** - * 搜索器:工资实发工资 + * 搜索器:工资部门 * @param $value * @param $data */ - public function searchNetSalaryAttr($query, $value, $data) + public function searchDepartmentIdAttr($query, $value, $data) { if ($value) { - $query->where("net_salary", $value); + $query->where("department_id", $value); } } @@ -139,68 +83,34 @@ class Salary extends BaseModel } /** - * 搜索器:工资发放方式 + * 搜索器:工资创建时间 * @param $value * @param $data */ - public function searchPaymentMethodAttr($query, $value, $data) + public function searchCreatedAtAttr($query, $value, $data) { - if ($value) { - $query->where("payment_method", $value); + $start = empty($value[0]) ? 0 : strtotime($value[0]); + $end = empty($value[1]) ? 0 : strtotime($value[1]); + if ($start > 0 && $end > 0) { + $query->where([["created_at", "between", [$start, $end]]]); + } else if ($start > 0 && $end == 0) { + $query->where([["created_at", ">=", $start]]); + } else if ($start == 0 && $end > 0) { + $query->where([["created_at", "<=", $end]]); } } - /** - * 搜索器:工资备注 - * @param $value - * @param $data - */ - public function searchRemarksAttr($query, $value, $data) - { - if ($value) { - $query->where("remarks", $value); - } - } - /** - * 搜索器:工资工资月份 - * @param $value - * @param $data - */ - public function searchSalaryMonthAttr($query, $value, $data) - { - if ($value) { - $query->where("salary_month", $value); - } - } + - /** - * 搜索器:工资部门ID - * @param $value - * @param $data - */ - public function searchDepartmentIdAttr($query, $value, $data) - { - if ($value) { - $query->where("department_id", $value); - } - } + - /** - * 搜索器:工资关联的审批流程ID - * @param $value - * @param $data - */ - public function searchProcessIdAttr($query, $value, $data) - { - if ($value) { - $query->where("process_id", $value); - } + public function personnel(){ + return $this->hasOne(Personnel::class, 'id', 'staff_id')->joinType('left')->withField('name,id')->bind(['staff_id_name'=>'name']); } - - - + public function departments(){ + return $this->hasOne(Departments::class, 'id', 'department_id')->joinType('left')->withField('department_name,id')->bind(['department_id_name'=>'department_name']); + } - } diff --git a/niucloud/app/service/admin/reimbursement/ReimbursementService.php b/niucloud/app/service/admin/reimbursement/ReimbursementService.php index 88fab040..8669cc94 100644 --- a/niucloud/app/service/admin/reimbursement/ReimbursementService.php +++ b/niucloud/app/service/admin/reimbursement/ReimbursementService.php @@ -12,6 +12,7 @@ namespace app\service\admin\reimbursement; use app\model\reimbursement\Reimbursement; +use app\model\personnel\Personnel; use core\base\BaseAdminService; @@ -39,7 +40,7 @@ class ReimbursementService extends BaseAdminService $field = 'id,applicant_id,amount,description,receipt_url,status,process_id,created_at,updated_at'; $order = 'id desc'; - $search_model = $this->model->withSearch(["id","applicant_id","amount","description","receipt_url","status","process_id"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["status","created_at"], $where)->with(['personnel'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } @@ -53,7 +54,7 @@ class ReimbursementService extends BaseAdminService { $field = 'id,applicant_id,amount,description,receipt_url,status,process_id,created_at,updated_at'; - $info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['personnel'])->findOrEmpty()->toArray(); return $info; } @@ -95,5 +96,10 @@ class ReimbursementService extends BaseAdminService } + public function getPersonnelAll(){ + $personnelModel = new Personnel(); + return $personnelModel->select()->toArray(); + } + } diff --git a/niucloud/app/service/admin/salary/SalaryService.php b/niucloud/app/service/admin/salary/SalaryService.php index 5218ee1c..ba4797eb 100644 --- a/niucloud/app/service/admin/salary/SalaryService.php +++ b/niucloud/app/service/admin/salary/SalaryService.php @@ -12,6 +12,8 @@ namespace app\service\admin\salary; use app\model\salary\Salary; +use app\model\personnel\Personnel; +use app\model\departments\Departments; use core\base\BaseAdminService; @@ -36,10 +38,10 @@ class SalaryService extends BaseAdminService */ public function getPage(array $where = []) { - $field = 'id,staff_id,base_salary,performance_bonus,deductions,other_subsidies,net_salary,payment_status,payment_method,remarks,salary_month,department_id,process_id,created_at,updated_at'; + $field = 'id,staff_id,department_id,base_salary,performance_bonus,deductions,other_subsidies,net_salary,payment_status,payment_method,remarks,salary_month,process_id,created_at,updated_at'; $order = 'id desc'; - $search_model = $this->model->withSearch(["id","staff_id","base_salary","performance_bonus","deductions","other_subsidies","net_salary","payment_status","payment_method","remarks","salary_month","department_id","process_id"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["staff_id","department_id","payment_status","created_at"], $where)->with(['personnel','departments'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } @@ -51,9 +53,9 @@ class SalaryService extends BaseAdminService */ public function getInfo(int $id) { - $field = 'id,staff_id,base_salary,performance_bonus,deductions,other_subsidies,net_salary,payment_status,payment_method,remarks,salary_month,department_id,process_id,created_at,updated_at'; + $field = 'id,staff_id,department_id,base_salary,performance_bonus,deductions,other_subsidies,net_salary,payment_status,payment_method,remarks,salary_month,process_id,created_at,updated_at'; - $info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['personnel','departments'])->findOrEmpty()->toArray(); return $info; } @@ -95,5 +97,15 @@ class SalaryService extends BaseAdminService } + public function getPersonnelAll(){ + $personnelModel = new Personnel(); + return $personnelModel->select()->toArray(); + } + + public function getDepartmentsAll(){ + $departmentsModel = new Departments(); + return $departmentsModel->select()->toArray(); + } + } diff --git a/niucloud/app/validate/reimbursement/Reimbursement.php b/niucloud/app/validate/reimbursement/Reimbursement.php index 0a054837..fe36912c 100644 --- a/niucloud/app/validate/reimbursement/Reimbursement.php +++ b/niucloud/app/validate/reimbursement/Reimbursement.php @@ -24,7 +24,6 @@ class Reimbursement extends BaseValidate 'amount' => 'require', 'description' => 'require', 'status' => 'require', - 'process_id' => 'require', ]; protected $message = [ @@ -32,12 +31,11 @@ class Reimbursement extends BaseValidate 'amount.require' => ['common_validate.require', ['amount']], 'description.require' => ['common_validate.require', ['description']], 'status.require' => ['common_validate.require', ['status']], - 'process_id.require' => ['common_validate.require', ['process_id']], ]; protected $scene = [ - "add" => ['applicant_id', 'amount', 'description', 'receipt_url', 'status', 'process_id'], - "edit" => ['applicant_id', 'amount', 'description', 'receipt_url', 'status', 'process_id'] + "add" => ['applicant_id', 'amount', 'description', 'receipt_url', 'status'], + "edit" => ['applicant_id', 'amount', 'description', 'receipt_url', 'status'] ]; } diff --git a/niucloud/app/validate/salary/Salary.php b/niucloud/app/validate/salary/Salary.php index ed9320bd..2efbb85d 100644 --- a/niucloud/app/validate/salary/Salary.php +++ b/niucloud/app/validate/salary/Salary.php @@ -21,25 +21,31 @@ class Salary extends BaseValidate protected $rule = [ 'staff_id' => 'require', + 'department_id' => 'require', 'base_salary' => 'require', 'performance_bonus' => 'require', 'deductions' => 'require', + 'other_subsidies' => 'require', 'payment_status' => 'require', + 'payment_method' => 'require', 'salary_month' => 'require', ]; protected $message = [ 'staff_id.require' => ['common_validate.require', ['staff_id']], + 'department_id.require' => ['common_validate.require', ['department_id']], 'base_salary.require' => ['common_validate.require', ['base_salary']], 'performance_bonus.require' => ['common_validate.require', ['performance_bonus']], 'deductions.require' => ['common_validate.require', ['deductions']], + 'other_subsidies.require' => ['common_validate.require', ['other_subsidies']], 'payment_status.require' => ['common_validate.require', ['payment_status']], + 'payment_method.require' => ['common_validate.require', ['payment_method']], 'salary_month.require' => ['common_validate.require', ['salary_month']], ]; protected $scene = [ - "add" => ['staff_id', 'base_salary', 'performance_bonus', 'deductions', 'other_subsidies', 'net_salary', 'payment_status', 'payment_method', 'remarks', 'salary_month', 'department_id', 'process_id'], - "edit" => ['staff_id', 'base_salary', 'performance_bonus', 'deductions', 'other_subsidies', 'net_salary', 'payment_status', 'payment_method', 'remarks', 'salary_month', 'department_id', 'process_id'] + "add" => ['staff_id', 'department_id', 'base_salary', 'performance_bonus', 'deductions', 'other_subsidies', 'payment_status', 'payment_method', 'remarks', 'salary_month'], + "edit" => ['staff_id', 'department_id', 'base_salary', 'performance_bonus', 'deductions', 'other_subsidies', 'payment_status', 'payment_method', 'remarks', 'salary_month'] ]; } From 74cd9cf1ebfbe488f40fdeeb5b27f8de76378f74 Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Thu, 22 May 2025 20:04:16 +0800 Subject: [PATCH 5/7] 1 --- admin/src/app/api/campus_pay.ts | 60 +++++ .../app/lang/zh-cn/campus_pay.campus_pay.json | 25 ++ admin/src/app/views/campus_pay/campus_pay.vue | 183 +++++++++++++++ .../campus_pay/components/campus-pay-edit.vue | 216 ++++++++++++++++++ .../setting/components/pay-wechatpay.vue | 9 +- admin/src/app/views/setting/pay.vue | 131 ++++++----- .../controller/campus_pay/CampusPay.php | 102 +++++++++ niucloud/app/adminapi/route/campus_pay.php | 42 ++++ niucloud/app/dict/common/ChannelDict.php | 8 +- niucloud/app/dict/pay/PayDict.php | 48 ++-- niucloud/app/model/campus_pay/CampusPay.php | 98 ++++++++ .../admin/campus_pay/CampusPayService.php | 105 +++++++++ .../service/admin/pay/PayChannelService.php | 55 +++-- .../app/validate/campus_pay/CampusPay.php | 47 ++++ 14 files changed, 1021 insertions(+), 108 deletions(-) create mode 100644 admin/src/app/api/campus_pay.ts create mode 100644 admin/src/app/lang/zh-cn/campus_pay.campus_pay.json create mode 100644 admin/src/app/views/campus_pay/campus_pay.vue create mode 100644 admin/src/app/views/campus_pay/components/campus-pay-edit.vue create mode 100644 niucloud/app/adminapi/controller/campus_pay/CampusPay.php create mode 100644 niucloud/app/adminapi/route/campus_pay.php create mode 100644 niucloud/app/model/campus_pay/CampusPay.php create mode 100644 niucloud/app/service/admin/campus_pay/CampusPayService.php create mode 100644 niucloud/app/validate/campus_pay/CampusPay.php diff --git a/admin/src/app/api/campus_pay.ts b/admin/src/app/api/campus_pay.ts new file mode 100644 index 00000000..127684bf --- /dev/null +++ b/admin/src/app/api/campus_pay.ts @@ -0,0 +1,60 @@ +import request from '@/utils/request' + + + + + + + +// USER_CODE_BEGIN -- campus_pay +/** + * 获取账户及资金管理列表 + * @param params + * @returns + */ +export function getCampusPayList(params: Record) { + return request.get(`campus_pay/campus_pay`, {params}) +} + +/** + * 获取账户及资金管理详情 + * @param id 账户及资金管理id + * @returns + */ +export function getCampusPayInfo(id: number) { + return request.get(`campus_pay/campus_pay/${id}`); +} + +/** + * 添加账户及资金管理 + * @param params + * @returns + */ +export function addCampusPay(params: Record) { + return request.post('campus_pay/campus_pay', params, { showErrorMessage: true, showSuccessMessage: true }) +} + +/** + * 编辑账户及资金管理 + * @param id + * @param params + * @returns + */ +export function editCampusPay(params: Record) { + return request.put(`campus_pay/campus_pay/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) +} + +/** + * 删除账户及资金管理 + * @param id + * @returns + */ +export function deleteCampusPay(id: number) { + return request.delete(`campus_pay/campus_pay/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithCampusList(params: Record){ + return request.get('campus_pay/campus_all', {params}) +} + +// USER_CODE_END -- campus_pay diff --git a/admin/src/app/lang/zh-cn/campus_pay.campus_pay.json b/admin/src/app/lang/zh-cn/campus_pay.campus_pay.json new file mode 100644 index 00000000..ab017ebf --- /dev/null +++ b/admin/src/app/lang/zh-cn/campus_pay.campus_pay.json @@ -0,0 +1,25 @@ +{ + "id":"", + "idPlaceholder":"请输入", + "campusId":"校区", + "campusIdPlaceholder":"全部", + "mchid":"商户号", + "mchidPlaceholder":"请输入商户号", + "paySignKey":"APIv3密钥", + "paySignKeyPlaceholder":"请输入APIv3密钥", + "apiclientKey":"商户私钥", + "apiclientKeyPlaceholder":"请输入商户私钥", + "apiclientCert":"商户公钥", + "apiclientCertPlaceholder":"请输入商户公钥", + "wxPayKey":"微信支付公钥", + "wxPayKeyPlaceholder":"请输入微信支付公钥", + "wxPayKeyId":"微信支付公钥ID", + "wxPayKeyIdPlaceholder":"请输入微信支付公钥ID", + "createdAt":"创建时间", + "createdAtPlaceholder":"请输入创建时间", + "addCampusPay":"添加账户及资金管理", + "updateCampusPay":"编辑账户及资金管理", + "campusPayDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/app/views/campus_pay/campus_pay.vue b/admin/src/app/views/campus_pay/campus_pay.vue new file mode 100644 index 00000000..9d321afe --- /dev/null +++ b/admin/src/app/views/campus_pay/campus_pay.vue @@ -0,0 +1,183 @@ + + + + + diff --git a/admin/src/app/views/campus_pay/components/campus-pay-edit.vue b/admin/src/app/views/campus_pay/components/campus-pay-edit.vue new file mode 100644 index 00000000..5ac15558 --- /dev/null +++ b/admin/src/app/views/campus_pay/components/campus-pay-edit.vue @@ -0,0 +1,216 @@ + + + + + + diff --git a/admin/src/app/views/setting/components/pay-wechatpay.vue b/admin/src/app/views/setting/components/pay-wechatpay.vue index dab18f57..7c741b4d 100644 --- a/admin/src/app/views/setting/components/pay-wechatpay.vue +++ b/admin/src/app/views/setting/components/pay-wechatpay.vue @@ -257,6 +257,8 @@ const confirm = async (formEl: FormInstance | undefined) => { const cancel = () => { Object.assign(formData, initialFormData) + + if (initData.value) { Object.keys(formData).forEach((key: string) => { if (initData.value[key] != undefined) formData[key] = initData.value[key] @@ -271,13 +273,18 @@ const setFormData = async (data: any = null) => { initData.value = cloneDeep(data) loading.value = true Object.assign(formData, initialFormData) + + + if (data) { Object.keys(formData).forEach((key: string) => { if (data[key] != undefined) formData[key] = data[key] }) - formData.channel = data.redio_key.split('_')[0] + formData.channel = data.radio_key.split('_')[0] formData.status = Number(formData.status) } + + initData.value = formData; loading.value = false } diff --git a/admin/src/app/views/setting/pay.vue b/admin/src/app/views/setting/pay.vue index 2d84acd4..670538ad 100644 --- a/admin/src/app/views/setting/pay.vue +++ b/admin/src/app/views/setting/pay.vue @@ -9,42 +9,47 @@
- -

{{ payItems.name }}

- -
-
- {{ t('payType') }} - {{ t('onState') }} - {{ t('templateName') }} -
- -
-
-
- -
-
- -
- {{ childrenItem.name }} -
-
-
- -
- {{ t('open') }} - {{ t('notOpen') }} -
-
-
- - -
-
-
-
-
+ + +

{{ payItems.campus_name }}

+ +
+
+ {{ t('payType') }} + {{ t('onState') }} + {{ t('templateName') }} +
+ +
+
+
+ +
+
+ +
+ {{ childrenItem.name }} +
+
+
+ +
+ {{ t('open') }} + {{ t('notOpen') }} +
+
+
+ + +
+
+
+
+ +
+ + +
-