From fedcd1f4cd065b1c5d4631993e88946ce262bc64 Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Mon, 19 May 2025 18:36:54 +0800 Subject: [PATCH 1/2] 1 --- admin/components.d.ts | 2 + admin/src/app/api/communication_records.ts | 26 +- admin/src/app/api/student_courses.ts | 29 +- admin/src/app/api/sys.ts | 11 + ...ication_records.communication_records.json | 50 +- .../student_courses.student_courses.json | 38 +- .../campus_person_role/campus_person_role.vue | 4 +- .../communication_records.vue | 582 +++++++---------- .../components/communication-records-edit.vue | 584 ++++++++---------- admin/src/app/views/setting/pay.vue | 2 +- .../components/student-courses-edit.vue | 467 +++++++------- .../views/student_courses/student_courses.vue | 468 ++++++-------- admin/src/app/views/xsyj/xsyj.vue | 212 +++++++ .../CommunicationRecords.php | 37 +- .../student_courses/StudentCourses.php | 22 +- .../app/adminapi/controller/sys/System.php | 14 + .../adminapi/route/communication_records.php | 3 + .../app/adminapi/route/student_courses.php | 6 + niucloud/app/adminapi/route/sys.php | 5 + .../CommunicationRecords.php | 130 +--- niucloud/app/model/course/Course.php | 20 +- niucloud/app/model/student/Student.php | 55 ++ .../model/student_courses/StudentCourses.php | 74 +-- .../CommunicationRecordsService.php | 29 +- .../student_courses/StudentCoursesService.php | 45 +- .../app/service/admin/sys/SystemService.php | 20 + .../CommunicationRecords.php | 6 +- 27 files changed, 1431 insertions(+), 1510 deletions(-) create mode 100644 admin/src/app/views/xsyj/xsyj.vue create mode 100644 niucloud/app/model/student/Student.php diff --git a/admin/components.d.ts b/admin/components.d.ts index 9ea57b0a..21ccdf88 100644 --- a/admin/components.d.ts +++ b/admin/components.d.ts @@ -19,6 +19,8 @@ declare module '@vue/runtime-core' { ElCard: typeof import('element-plus/es')['ElCard'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCol: typeof import('element-plus/es')['ElCol'] + ElCollapse: typeof import('element-plus/es')['ElCollapse'] + ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElContainer: typeof import('element-plus/es')['ElContainer'] diff --git a/admin/src/app/api/communication_records.ts b/admin/src/app/api/communication_records.ts index d0113748..3118791c 100644 --- a/admin/src/app/api/communication_records.ts +++ b/admin/src/app/api/communication_records.ts @@ -1,5 +1,7 @@ import request from '@/utils/request' + + // USER_CODE_BEGIN -- communication_records /** * 获取沟通记录列表 @@ -7,7 +9,7 @@ import request from '@/utils/request' * @returns */ export function getCommunicationRecordsList(params: Record) { - return request.get(`communication_records/communication_records`, { params }) + return request.get(`communication_records/communication_records`, {params}) } /** @@ -16,7 +18,7 @@ export function getCommunicationRecordsList(params: Record) { * @returns */ export function getCommunicationRecordsInfo(id: number) { - return request.get(`communication_records/communication_records/${id}`) + return request.get(`communication_records/communication_records/${id}`); } /** @@ -25,10 +27,7 @@ export function getCommunicationRecordsInfo(id: number) { * @returns */ export function addCommunicationRecords(params: Record) { - return request.post('communication_records/communication_records', params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.post('communication_records/communication_records', params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -38,11 +37,7 @@ export function addCommunicationRecords(params: Record) { * @returns */ export function editCommunicationRecords(params: Record) { - return request.put( - `communication_records/communication_records/${params.id}`, - params, - { showErrorMessage: true, showSuccessMessage: true } - ) + return request.put(`communication_records/communication_records/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -51,10 +46,11 @@ export function editCommunicationRecords(params: Record) { * @returns */ export function deleteCommunicationRecords(id: number) { - return request.delete(`communication_records/communication_records/${id}`, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.delete(`communication_records/communication_records/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithCustomerResourcesList(params: Record){ + return request.get('communication_records/customer_resources_all', {params}) } // USER_CODE_END -- communication_records diff --git a/admin/src/app/api/student_courses.ts b/admin/src/app/api/student_courses.ts index 3315bc9f..17c263cb 100644 --- a/admin/src/app/api/student_courses.ts +++ b/admin/src/app/api/student_courses.ts @@ -1,5 +1,9 @@ import request from '@/utils/request' + + + + // USER_CODE_BEGIN -- student_courses /** * 获取学员课程列表 @@ -7,7 +11,7 @@ import request from '@/utils/request' * @returns */ export function getStudentCoursesList(params: Record) { - return request.get(`student_courses/student_courses`, { params }) + return request.get(`student_courses/student_courses`, {params}) } /** @@ -16,7 +20,7 @@ export function getStudentCoursesList(params: Record) { * @returns */ export function getStudentCoursesInfo(id: number) { - return request.get(`student_courses/student_courses/${id}`) + return request.get(`student_courses/student_courses/${id}`); } /** @@ -25,10 +29,7 @@ export function getStudentCoursesInfo(id: number) { * @returns */ export function addStudentCourses(params: Record) { - return request.post('student_courses/student_courses', params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.post('student_courses/student_courses', params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -38,10 +39,7 @@ export function addStudentCourses(params: Record) { * @returns */ export function editStudentCourses(params: Record) { - return request.put(`student_courses/student_courses/${params.id}`, params, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.put(`student_courses/student_courses/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) } /** @@ -50,10 +48,13 @@ export function editStudentCourses(params: Record) { * @returns */ export function deleteStudentCourses(id: number) { - return request.delete(`student_courses/student_courses/${id}`, { - showErrorMessage: true, - showSuccessMessage: true, - }) + return request.delete(`student_courses/student_courses/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithStudentList(params: Record){ + return request.get('student_courses/student_all', {params}) +}export function getWithCourseList(params: Record){ + return request.get('student_courses/course_all', {params}) } // USER_CODE_END -- student_courses diff --git a/admin/src/app/api/sys.ts b/admin/src/app/api/sys.ts index 2ae8b5b0..89375afa 100644 --- a/admin/src/app/api/sys.ts +++ b/admin/src/app/api/sys.ts @@ -732,3 +732,14 @@ export function getYjpzConfig() { export function yjpzConfig(params: Record) { return request.post(`sys/yjpz_config`, params) } + + +export function xsyjConfig(params: Record) { + return request.post(`sys/xsyj_config`, params) +} + +export function getXsyjConfig() { + return request.get('sys/get_xsyj_config') +} + + diff --git a/admin/src/app/lang/zh-cn/communication_records.communication_records.json b/admin/src/app/lang/zh-cn/communication_records.communication_records.json index ea85c4fe..32866c01 100644 --- a/admin/src/app/lang/zh-cn/communication_records.communication_records.json +++ b/admin/src/app/lang/zh-cn/communication_records.communication_records.json @@ -1,31 +1,21 @@ { - "id": "沟通记录编号", - "idPlaceholder": "请输入沟通记录编号", - "staffId": "员工ID", - "staffIdPlaceholder": "请输入员工ID", - "resourceId": "资源ID", - "resourceIdPlaceholder": "请输入资源ID", - "resourceType": "资源类型(如设备、文件、系统等)", - "resourceTypePlaceholder": "请输入资源类型(如设备、文件、系统等)", - "communicationType": "沟通类型: phone-电话, email-邮件, meeting-会议, other-其他", - "communicationTypePlaceholder": "请输入沟通类型: phone-电话, email-邮件, meeting-会议, other-其他", - "communicationResult": "沟通结果: success-成功, failure-失败, pending-待定", - "communicationResultPlaceholder": "请输入沟通结果: success-成功, failure-失败, pending-待定", - "communicationTime": "沟通时间", - "communicationTimePlaceholder": "请输入沟通时间", - "remarks": "备注", - "remarksPlaceholder": "请输入备注", - "tag": "标签: high-高, medium-中, low-低", - "tagPlaceholder": "请输入标签: high-高, medium-中, low-低", - "businessId": "关联的业务ID", - "businessIdPlaceholder": "请输入关联的业务ID", - "createdAt": "创建时间", - "createdAtPlaceholder": "请输入创建时间", - "updatedAt": "修改时间", - "updatedAtPlaceholder": "请输入修改时间", - "addCommunicationRecords": "添加沟通记录", - "updateCommunicationRecords": "编辑沟通记录", - "communicationRecordsDeleteTips": "确定要删除该数据吗?", - "startDate": "请选择开始时间", - "endDate": "请选择结束时间" -} + "resourceId":"资源", + "resourceIdPlaceholder":"全部", + "resourceType":"资源类型", + "resourceTypePlaceholder":"请输入资源类型", + "communicationType":"沟通类型", + "communicationTypePlaceholder":"请输入沟通类型", + "communicationResult":"沟通结果", + "communicationResultPlaceholder":"请输入沟通结果", + "communicationTime":"沟通时间", + "communicationTimePlaceholder":"请输入沟通时间", + "remarks":"备注", + "remarksPlaceholder":"请输入备注", + "tag":"标签", + "tagPlaceholder":"请输入标签", + "addCommunicationRecords":"添加沟通记录", + "updateCommunicationRecords":"编辑沟通记录", + "communicationRecordsDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/app/lang/zh-cn/student_courses.student_courses.json b/admin/src/app/lang/zh-cn/student_courses.student_courses.json index 04c9f51f..e93df48d 100644 --- a/admin/src/app/lang/zh-cn/student_courses.student_courses.json +++ b/admin/src/app/lang/zh-cn/student_courses.student_courses.json @@ -1,21 +1,19 @@ { - "id": "记录编号", - "idPlaceholder": "请输入记录编号", - "studentId": "学员ID", - "studentIdPlaceholder": "请输入学员ID", - "courseId": "课程ID", - "courseIdPlaceholder": "请输入课程ID", - "totalHours": "总正式课时数", - "totalHoursPlaceholder": "请输入总正式课时数", - "giftHours": "赠送课时数", - "giftHoursPlaceholder": "请输入赠送课时数", - "startDate": "课程开始日期", - "startDatePlaceholder": "请输入课程开始日期", - "endDate": "课程结束日期", - "endDatePlaceholder": "请输入课程结束日期", - "addStudentCourses": "添加学员课程", - "updateStudentCourses": "编辑学员课程", - "studentCoursesDeleteTips": "确定要删除该数据吗?", - "startDate": "请选择开始时间", - "endDate": "请选择结束时间" -} + "studentId":"学员", + "studentIdPlaceholder":"全部", + "courseId":"课程", + "courseIdPlaceholder":"全部", + "totalHours":"总正式课时数", + "totalHoursPlaceholder":"请输入总正式课时数", + "giftHours":"赠送课时数", + "giftHoursPlaceholder":"请输入赠送课时数", + "startDate":"课程开始日期", + "startDatePlaceholder":"请输入课程开始日期", + "endDate":"课程结束日期", + "endDatePlaceholder":"请输入课程结束日期", + "addStudentCourses":"添加学员课程", + "updateStudentCourses":"编辑学员课程", + "studentCoursesDeleteTips":"确定要删除该数据吗?", + "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 2ad6f913..32add873 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 @@ -184,7 +184,9 @@ import Edit from '@/app/views/campus_person_role/components/campus-person-role-e import { useRoute } from 'vue-router' const route = useRoute() const pageName = route.meta.title +// ?dept_id=1 +const dept_id = pageName == '市场人员列表' ? 1 : 2; let campusPersonRoleTable = reactive({ page: 1, limit: 10, @@ -195,7 +197,7 @@ let campusPersonRoleTable = reactive({ campus_id: '', person_id: '', role_id: '', - dept_id: '', + dept_id: dept_id, }, }) diff --git a/admin/src/app/views/communication_records/communication_records.vue b/admin/src/app/views/communication_records/communication_records.vue index 18fc2957..4c5b9abb 100644 --- a/admin/src/app/views/communication_records/communication_records.vue +++ b/admin/src/app/views/communication_records/communication_records.vue @@ -1,351 +1,231 @@ - - - - - + + + + + diff --git a/admin/src/app/views/communication_records/components/communication-records-edit.vue b/admin/src/app/views/communication_records/components/communication-records-edit.vue index bc7a21fc..9529c239 100644 --- a/admin/src/app/views/communication_records/components/communication-records-edit.vue +++ b/admin/src/app/views/communication_records/components/communication-records-edit.vue @@ -1,322 +1,262 @@ - - - - - - + + + + + + diff --git a/admin/src/app/views/setting/pay.vue b/admin/src/app/views/setting/pay.vue index 711ceec0..2d84acd4 100644 --- a/admin/src/app/views/setting/pay.vue +++ b/admin/src/app/views/setting/pay.vue @@ -8,7 +8,7 @@ {{ t('setConfig') }} - +

{{ payItems.name }}

diff --git a/admin/src/app/views/student_courses/components/student-courses-edit.vue b/admin/src/app/views/student_courses/components/student-courses-edit.vue index 4138ba7c..924f5eee 100644 --- a/admin/src/app/views/student_courses/components/student-courses-edit.vue +++ b/admin/src/app/views/student_courses/components/student-courses-edit.vue @@ -1,236 +1,231 @@ - - - - - - + + + + + + diff --git a/admin/src/app/views/student_courses/student_courses.vue b/admin/src/app/views/student_courses/student_courses.vue index b00d6457..5756e596 100644 --- a/admin/src/app/views/student_courses/student_courses.vue +++ b/admin/src/app/views/student_courses/student_courses.vue @@ -1,267 +1,201 @@ - - - - - + + + + + diff --git a/admin/src/app/views/xsyj/xsyj.vue b/admin/src/app/views/xsyj/xsyj.vue new file mode 100644 index 00000000..7b1a5338 --- /dev/null +++ b/admin/src/app/views/xsyj/xsyj.vue @@ -0,0 +1,212 @@ + + + + + diff --git a/niucloud/app/adminapi/controller/communication_records/CommunicationRecords.php b/niucloud/app/adminapi/controller/communication_records/CommunicationRecords.php index 8f8ec08c..61581bab 100644 --- a/niucloud/app/adminapi/controller/communication_records/CommunicationRecords.php +++ b/niucloud/app/adminapi/controller/communication_records/CommunicationRecords.php @@ -28,17 +28,8 @@ class CommunicationRecords extends BaseAdminController */ public function lists(){ $data = $this->request->params([ - ["staff_id",""], ["resource_id",""], - ["resource_type",""], - ["communication_type",""], - ["communication_result",""], - ["communication_time",""], - ["remarks",""], - ["tag",""], - ["business_id",""], - ["created_at",""], - ["updated_at",""] + ["communication_type",""] ]); return success((new CommunicationRecordsService())->getPage($data)); } @@ -58,21 +49,17 @@ class CommunicationRecords extends BaseAdminController */ public function add(){ $data = $this->request->params([ - ["staff_id",0], ["resource_id",0], ["resource_type",""], ["communication_type",""], ["communication_result",""], - ["communication_time","2025-05-16 17:20:44"], + ["communication_time","2025-05-19 13:11:39"], ["remarks",""], ["tag",""], - ["business_id",0], - ["created_at",1747387244], - ["updated_at",1747387244] + ]); $this->validate($data, 'app\validate\communication_records\CommunicationRecords.add'); - $id = (new CommunicationRecordsService())->add($data); - return success('ADD_SUCCESS', ['id' => $id]); + return (new CommunicationRecordsService())->add($data); } /** @@ -82,21 +69,17 @@ class CommunicationRecords extends BaseAdminController */ public function edit(int $id){ $data = $this->request->params([ - ["staff_id",0], ["resource_id",0], ["resource_type",""], ["communication_type",""], ["communication_result",""], - ["communication_time","2025-05-16 17:20:44"], + ["communication_time","2025-05-19 13:11:39"], ["remarks",""], ["tag",""], - ["business_id",0], - ["created_at",1747387244], - ["updated_at",1747387244] + ]); $this->validate($data, 'app\validate\communication_records\CommunicationRecords.edit'); - (new CommunicationRecordsService())->edit($id, $data); - return success('EDIT_SUCCESS'); + return (new CommunicationRecordsService())->edit($id, $data); } /** @@ -109,5 +92,9 @@ class CommunicationRecords extends BaseAdminController return success('DELETE_SUCCESS'); } - + + public function getCustomerResourcesAll(){ + return success(( new CommunicationRecordsService())->getCustomerResourcesAll()); + } + } diff --git a/niucloud/app/adminapi/controller/student_courses/StudentCourses.php b/niucloud/app/adminapi/controller/student_courses/StudentCourses.php index 95317db6..f587dc21 100644 --- a/niucloud/app/adminapi/controller/student_courses/StudentCourses.php +++ b/niucloud/app/adminapi/controller/student_courses/StudentCourses.php @@ -29,11 +29,7 @@ class StudentCourses extends BaseAdminController public function lists(){ $data = $this->request->params([ ["student_id",""], - ["course_id",""], - ["total_hours",""], - ["gift_hours",""], - ["start_date",""], - ["end_date",""] + ["course_id",""] ]); return success((new StudentCoursesService())->getPage($data)); } @@ -57,8 +53,8 @@ class StudentCourses extends BaseAdminController ["course_id",0], ["total_hours",0], ["gift_hours",0], - ["start_date","2025-05-16 18:02:13"], - ["end_date","2025-05-16 18:02:13"], + ["start_date","2025-05-19 15:41:16"], + ["end_date","2025-05-19 15:41:16"], ]); $this->validate($data, 'app\validate\student_courses\StudentCourses.add'); @@ -77,8 +73,8 @@ class StudentCourses extends BaseAdminController ["course_id",0], ["total_hours",0], ["gift_hours",0], - ["start_date","2025-05-16 18:02:13"], - ["end_date","2025-05-16 18:02:13"], + ["start_date","2025-05-19 15:41:16"], + ["end_date","2025-05-19 15:41:16"], ]); $this->validate($data, 'app\validate\student_courses\StudentCourses.edit'); @@ -97,4 +93,12 @@ class StudentCourses extends BaseAdminController } + public function getStudentAll(){ + return success(( new StudentCoursesService())->getStudentAll()); + } + + public function getCourseAll(){ + return success(( new StudentCoursesService())->getCourseAll()); + } + } diff --git a/niucloud/app/adminapi/controller/sys/System.php b/niucloud/app/adminapi/controller/sys/System.php index d28fac35..261d7c32 100644 --- a/niucloud/app/adminapi/controller/sys/System.php +++ b/niucloud/app/adminapi/controller/sys/System.php @@ -124,4 +124,18 @@ class System extends BaseAdminController } + public function xsyj_config(){ + $data = $this->request->post(); + + return success(data: (new SystemService())->xsyj_config($data)); + + } + + + public function get_xsyj_config(){ + return success(data: (new SystemService())->get_xsyj_config()); + + } + + } diff --git a/niucloud/app/adminapi/route/communication_records.php b/niucloud/app/adminapi/route/communication_records.php index 17181785..3376a715 100644 --- a/niucloud/app/adminapi/route/communication_records.php +++ b/niucloud/app/adminapi/route/communication_records.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 -- communication_records Route::group('communication_records', function () { @@ -29,6 +30,8 @@ Route::group('communication_records', function () { //删除沟通记录 Route::delete('communication_records/:id', 'communication_records.CommunicationRecords/del'); + Route::get('customer_resources_all','communication_records.CommunicationRecords/getCustomerResourcesAll'); + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/adminapi/route/student_courses.php b/niucloud/app/adminapi/route/student_courses.php index dc1ec878..049e660e 100644 --- a/niucloud/app/adminapi/route/student_courses.php +++ b/niucloud/app/adminapi/route/student_courses.php @@ -14,6 +14,8 @@ use think\facade\Route; use app\adminapi\middleware\AdminCheckRole; use app\adminapi\middleware\AdminCheckToken; use app\adminapi\middleware\AdminLog; + + // USER_CODE_BEGIN -- student_courses Route::group('student_courses', function () { @@ -29,6 +31,10 @@ Route::group('student_courses', function () { //删除学员课程 Route::delete('student_courses/:id', 'student_courses.StudentCourses/del'); + Route::get('student_all','student_courses.StudentCourses/getStudentAll'); + + Route::get('course_all','student_courses.StudentCourses/getCourseAll'); + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/adminapi/route/sys.php b/niucloud/app/adminapi/route/sys.php index bc399348..d9c29b2b 100644 --- a/niucloud/app/adminapi/route/sys.php +++ b/niucloud/app/adminapi/route/sys.php @@ -330,6 +330,11 @@ Route::group('sys', function() { Route::get('get_yjpz_config', 'sys.System/get_yjpz_config'); Route::post('yjpz_config', 'sys.System/yjpz_config'); + //销售业绩配置 + Route::post('xsyj_config', 'sys.System/xsyj_config'); + Route::get('get_xsyj_config', 'sys.System/get_xsyj_config'); + + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/model/communication_records/CommunicationRecords.php b/niucloud/app/model/communication_records/CommunicationRecords.php index 371dfa7d..2e5fb6ca 100644 --- a/niucloud/app/model/communication_records/CommunicationRecords.php +++ b/niucloud/app/model/communication_records/CommunicationRecords.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 CommunicationRecords @@ -43,31 +45,7 @@ class CommunicationRecords 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 searchStaffIdAttr($query, $value, $data) - { - if ($value) { - $query->where("staff_id", $value); - } - } - - /** - * 搜索器:沟通记录资源ID + * 搜索器:沟通记录资源 * @param $value * @param $data */ @@ -79,19 +57,7 @@ class CommunicationRecords extends BaseModel } /** - * 搜索器:沟通记录资源类型(如设备、文件、系统等) - * @param $value - * @param $data - */ - public function searchResourceTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("resource_type", $value); - } - } - - /** - * 搜索器:沟通记录沟通类型: phone-电话, email-邮件, meeting-会议, other-其他 + * 搜索器:沟通记录沟通类型 * @param $value * @param $data */ @@ -102,93 +68,13 @@ class CommunicationRecords extends BaseModel } } - /** - * 搜索器:沟通记录沟通结果: success-成功, failure-失败, pending-待定 - * @param $value - * @param $data - */ - public function searchCommunicationResultAttr($query, $value, $data) - { - if ($value) { - $query->where("communication_result", $value); - } - } - - /** - * 搜索器:沟通记录沟通时间 - * @param $value - * @param $data - */ - public function searchCommunicationTimeAttr($query, $value, $data) - { - if ($value) { - $query->where("communication_time", $value); - } - } - - /** - * 搜索器:沟通记录备注 - * @param $value - * @param $data - */ - public function searchRemarksAttr($query, $value, $data) - { - if ($value) { - $query->where("remarks", $value); - } - } - - /** - * 搜索器:沟通记录标签: high-高, medium-中, low-低 - * @param $value - * @param $data - */ - public function searchTagAttr($query, $value, $data) - { - if ($value) { - $query->where("tag", $value); - } - } - - /** - * 搜索器:沟通记录关联的业务ID - * @param $value - * @param $data - */ - public function searchBusinessIdAttr($query, $value, $data) - { - if ($value) { - $query->where("business_id", $value); - } - } - - /** - * 搜索器:沟通记录创建时间 - * @param $value - * @param $data - */ - public function searchCreatedAtAttr($query, $value, $data) - { - if ($value) { - $query->where("created_at", $value); - } - } - - /** - * 搜索器:沟通记录修改时间 - * @param $value - * @param $data - */ - public function searchUpdatedAtAttr($query, $value, $data) - { - if ($value) { - $query->where("updated_at", $value); - } - } - + public function customerResources(){ + return $this->hasOne(CustomerResources::class, 'id', 'resource_id')->joinType('left')->withField('name,id')->bind(['resource_id_name'=>'name']); + } + } diff --git a/niucloud/app/model/course/Course.php b/niucloud/app/model/course/Course.php index 0f5e48e3..6b567338 100644 --- a/niucloud/app/model/course/Course.php +++ b/niucloud/app/model/course/Course.php @@ -9,7 +9,7 @@ // | Author: Niucloud Team // +---------------------------------------------------------------------- -namespace app\model\campus; +namespace app\model\course; use core\base\BaseModel; use think\model\concern\SoftDelete; @@ -21,7 +21,7 @@ use think\model\relation\HasOne; * Class Campus * @package app\model\campus */ -class Campus extends BaseModel +class Course extends BaseModel { use SoftDelete; @@ -36,13 +36,13 @@ class Campus extends BaseModel * 模型名称 * @var string */ - protected $name = 'campus'; + protected $name = 'course'; /** * 定义软删除标记字段. * @var string */ - protected $deleteTime = 'delete_time'; + protected $deleteTime = 'deleted_at'; /** * 定义软删除字段的默认值. @@ -61,7 +61,7 @@ class Campus extends BaseModel $query->where("campus_name", "like", "%".$value."%"); } } - + /** * 搜索器:校区校区地址 * @param $value @@ -73,7 +73,7 @@ class Campus extends BaseModel $query->where("campus_address", $value); } } - + /** * 搜索器:校区校区状态 * @param $value @@ -85,10 +85,10 @@ class Campus extends BaseModel $query->where("campus_status", $value); } } - - - - + + + + } diff --git a/niucloud/app/model/student/Student.php b/niucloud/app/model/student/Student.php new file mode 100644 index 00000000..026edee0 --- /dev/null +++ b/niucloud/app/model/student/Student.php @@ -0,0 +1,55 @@ +where("id", $value); - } - } - - /** - * 搜索器:学员课程学员ID + * 搜索器:学员课程学员 * @param $value * @param $data */ @@ -67,7 +59,7 @@ class StudentCourses extends BaseModel } /** - * 搜索器:学员课程课程ID + * 搜索器:学员课程课程 * @param $value * @param $data */ @@ -78,57 +70,17 @@ class StudentCourses extends BaseModel } } - /** - * 搜索器:学员课程总正式课时数 - * @param $value - * @param $data - */ - public function searchTotalHoursAttr($query, $value, $data) - { - if ($value) { - $query->where("total_hours", $value); - } - } - /** - * 搜索器:学员课程赠送课时数 - * @param $value - * @param $data - */ - public function searchGiftHoursAttr($query, $value, $data) - { - if ($value) { - $query->where("gift_hours", $value); - } - } + - /** - * 搜索器:学员课程课程开始日期 - * @param $value - * @param $data - */ - public function searchStartDateAttr($query, $value, $data) - { - if ($value) { - $query->where("start_date", $value); - } - } + - /** - * 搜索器:学员课程课程结束日期 - * @param $value - * @param $data - */ - public function searchEndDateAttr($query, $value, $data) - { - if ($value) { - $query->where("end_date", $value); - } + public function student(){ + return $this->hasOne(Student::class, 'id', 'student_id')->joinType('left')->withField('name,id')->bind(['student_id_name'=>'name']); } - - - + public function course(){ + return $this->hasOne(Course::class, 'id', 'course_id')->joinType('left')->withField('course_name,id')->bind(['course_id_name'=>'course_name']); + } - } diff --git a/niucloud/app/service/admin/communication_records/CommunicationRecordsService.php b/niucloud/app/service/admin/communication_records/CommunicationRecordsService.php index 5633e649..11334ea9 100644 --- a/niucloud/app/service/admin/communication_records/CommunicationRecordsService.php +++ b/niucloud/app/service/admin/communication_records/CommunicationRecordsService.php @@ -12,7 +12,9 @@ namespace app\service\admin\communication_records; use app\model\communication_records\CommunicationRecords; +use app\model\customer_resources\CustomerResources; +use app\model\personnel\Personnel; use core\base\BaseAdminService; @@ -39,7 +41,7 @@ class CommunicationRecordsService extends BaseAdminService $field = 'id,staff_id,resource_id,resource_type,communication_type,communication_result,communication_time,remarks,tag,business_id,created_at,updated_at'; $order = 'id desc'; - $search_model = $this->model->withSearch(["id","staff_id","resource_id","resource_type","communication_type","communication_result","communication_time","remarks","tag","business_id","created_at","updated_at"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["resource_id","communication_type"], $where)->with(['customerResources'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } @@ -53,7 +55,7 @@ class CommunicationRecordsService extends BaseAdminService { $field = 'id,staff_id,resource_id,resource_type,communication_type,communication_result,communication_time,remarks,tag,business_id,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; } @@ -64,8 +66,15 @@ class CommunicationRecordsService 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("操作失败"); + } + $res = $this->model->create($data); - return $res->id; + return success("操作成功"); } @@ -77,9 +86,14 @@ class CommunicationRecordsService extends BaseAdminService */ public function edit(int $id, array $data) { + $personnel = new Personnel(); + $data['staff_id'] = $personnel->where(['sys_user_id' => $this->uid])->value("id"); + if(!$data['staff_id']){ + return fail("操作失败"); + } $this->model->where([['id', '=', $id]])->update($data); - return true; + return success("操作成功"); } /** @@ -94,6 +108,11 @@ class CommunicationRecordsService extends BaseAdminService return $res; } - + + public function getCustomerResourcesAll(){ + $customerResourcesModel = new CustomerResources(); + return $customerResourcesModel->select()->toArray(); + } + } diff --git a/niucloud/app/service/admin/student_courses/StudentCoursesService.php b/niucloud/app/service/admin/student_courses/StudentCoursesService.php index 2aab388d..78fa013e 100644 --- a/niucloud/app/service/admin/student_courses/StudentCoursesService.php +++ b/niucloud/app/service/admin/student_courses/StudentCoursesService.php @@ -9,57 +9,58 @@ // | Author: Niucloud Team // +---------------------------------------------------------------------- -namespace app\service\admin\campus; +namespace app\service\admin\student_courses; -use app\model\campus\Campus; +use app\model\student_courses\StudentCourses; +use app\model\student\Student; +use app\model\course\Course; use core\base\BaseAdminService; /** - * 校区服务层 - * Class CampusService - * @package app\service\admin\campus + * 学员课程服务层 + * Class StudentCoursesService + * @package app\service\admin\student_courses */ class StudentCoursesService extends BaseAdminService { public function __construct() { parent::__construct(); - $this->model = new Campus(); + $this->model = new StudentCourses(); } /** - * 获取校区列表 + * 获取学员课程列表 * @param array $where * @return array */ public function getPage(array $where = []) { - $field = 'id,campus_name,campus_address,campus_preview_image,campus_coordinates,campus_introduction,campus_status,create_time,update_time,delete_time'; - $order = ''; + $field = 'id,student_id,course_id,total_hours,gift_hours,start_date,end_date,created_at,updated_at'; + $order = 'id desc'; - $search_model = $this->model->withSearch(["campus_name","campus_address","campus_status"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["student_id","course_id"], $where)->with(['student','course'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } /** - * 获取校区信息 + * 获取学员课程信息 * @param int $id * @return array */ public function getInfo(int $id) { - $field = 'id,campus_name,campus_address,campus_preview_image,campus_coordinates,campus_introduction,campus_status,create_time,update_time,delete_time'; + $field = 'id,student_id,course_id,total_hours,gift_hours,start_date,end_date,created_at,updated_at'; - $info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); - $info['campus_status'] = strval($info['campus_status']); + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['student','course'])->findOrEmpty()->toArray(); return $info; } /** - * 添加校区 + * 添加学员课程 * @param array $data * @return mixed */ @@ -71,7 +72,7 @@ class StudentCoursesService extends BaseAdminService } /** - * 校区编辑 + * 学员课程编辑 * @param int $id * @param array $data * @return bool @@ -84,7 +85,7 @@ class StudentCoursesService extends BaseAdminService } /** - * 删除校区 + * 删除学员课程 * @param int $id * @return bool */ @@ -96,5 +97,15 @@ class StudentCoursesService extends BaseAdminService } + public function getStudentAll(){ + $studentModel = new Student(); + return $studentModel->select()->toArray(); + } + + public function getCourseAll(){ + $courseModel = new Course(); + return $courseModel->select()->toArray(); + } + } diff --git a/niucloud/app/service/admin/sys/SystemService.php b/niucloud/app/service/admin/sys/SystemService.php index 51ad7fd6..cb8f2efe 100644 --- a/niucloud/app/service/admin/sys/SystemService.php +++ b/niucloud/app/service/admin/sys/SystemService.php @@ -188,4 +188,24 @@ class SystemService extends BaseAdminService return true; } + + + public function xsyj_config(array $data){ + $config = new SysConfig(); + + $config->where(['config_key' => 'XSYJ'])->update([ + 'value' => json_encode($data) + ]); + + return true; + } + + + public function get_xsyj_config(){ + $config = new SysConfig(); + + $data = $config->where(['config_key' => 'XSYJ'])->value("value"); + + return $data; + } } diff --git a/niucloud/app/validate/communication_records/CommunicationRecords.php b/niucloud/app/validate/communication_records/CommunicationRecords.php index 179acdc0..87d11426 100644 --- a/niucloud/app/validate/communication_records/CommunicationRecords.php +++ b/niucloud/app/validate/communication_records/CommunicationRecords.php @@ -20,7 +20,6 @@ class CommunicationRecords extends BaseValidate { protected $rule = [ - 'staff_id' => 'require', 'resource_id' => 'require', 'resource_type' => 'require', 'communication_type' => 'require', @@ -29,7 +28,6 @@ class CommunicationRecords extends BaseValidate ]; protected $message = [ - 'staff_id.require' => ['common_validate.require', ['staff_id']], 'resource_id.require' => ['common_validate.require', ['resource_id']], 'resource_type.require' => ['common_validate.require', ['resource_type']], 'communication_type.require' => ['common_validate.require', ['communication_type']], @@ -38,8 +36,8 @@ class CommunicationRecords extends BaseValidate ]; protected $scene = [ - "add" => ['staff_id', 'resource_id', 'resource_type', 'communication_type', 'communication_result', 'communication_time', 'remarks', 'tag', 'business_id', 'created_at', 'updated_at'], - "edit" => ['staff_id', 'resource_id', 'resource_type', 'communication_type', 'communication_result', 'communication_time', 'remarks', 'tag', 'business_id', 'created_at', 'updated_at'] + "add" => ['resource_id', 'resource_type', 'communication_type', 'communication_result', 'communication_time', 'remarks', 'tag'], + "edit" => ['resource_id', 'resource_type', 'communication_type', 'communication_result', 'communication_time', 'remarks', 'tag'] ]; } From 93e7e7769a34e7c41d8ed054b9ae20378086160c Mon Sep 17 00:00:00 2001 From: wangzeyan <258785420@qq.com> Date: Mon, 19 May 2025 19:21:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8E=92=E8=AF=BE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/app/lang/zh-cn/course.course.json | 4 +- .../views/course/components/course-edit.vue | 22 +- admin/src/app/views/course/course.vue | 13 +- admin/src/app/views/timetables/timetables.vue | 269 +++++++++++------- .../app/adminapi/controller/course/Course.php | 1 - niucloud/app/model/course/Course.php | 116 ++++++-- 6 files changed, 300 insertions(+), 125 deletions(-) diff --git a/admin/src/app/lang/zh-cn/course.course.json b/admin/src/app/lang/zh-cn/course.course.json index 87e24f74..ee23f55d 100644 --- a/admin/src/app/lang/zh-cn/course.course.json +++ b/admin/src/app/lang/zh-cn/course.course.json @@ -9,8 +9,8 @@ "durationPlaceholder": "请输入课程时长", "sessionCount": "课时数量", "sessionCountPlaceholder": "请输入课时数量", - "singleSessionCount": "单次逍客数量", - "singleSessionCountPlaceholder": "请输入单次逍客数量", + "singleSessionCount": "单次消课数量", + "singleSessionCountPlaceholder": "请输入单次消课数量", "price": "课程价格", "pricePlaceholder": "请输入课程价格", "internalReminder": "内部提醒课时", diff --git a/admin/src/app/views/course/components/course-edit.vue b/admin/src/app/views/course/components/course-edit.vue index b1d3d780..07e8534e 100644 --- a/admin/src/app/views/course/components/course-edit.vue +++ b/admin/src/app/views/course/components/course-edit.vue @@ -24,14 +24,19 @@ - + > + + - { const emit = defineEmits(['complete']) +const courseTypeList = ref([]) +const getcourseTypeList = async () => { + courseTypeList.value = await ( + await useDictionary('course_type') + ).data.dictionary +} +getcourseTypeList() /** * 确认 * @param formEl diff --git a/admin/src/app/views/course/course.vue b/admin/src/app/views/course/course.vue index 6ce6185c..aed2b754 100644 --- a/admin/src/app/views/course/course.vue +++ b/admin/src/app/views/course/course.vue @@ -24,10 +24,17 @@ /> - + > + + () // 选中数据 diff --git a/admin/src/app/views/timetables/timetables.vue b/admin/src/app/views/timetables/timetables.vue index 33d5d982..07c18c89 100644 --- a/admin/src/app/views/timetables/timetables.vue +++ b/admin/src/app/views/timetables/timetables.vue @@ -1,125 +1,198 @@ - diff --git a/niucloud/app/adminapi/controller/course/Course.php b/niucloud/app/adminapi/controller/course/Course.php index d8634497..6385816d 100644 --- a/niucloud/app/adminapi/controller/course/Course.php +++ b/niucloud/app/adminapi/controller/course/Course.php @@ -105,5 +105,4 @@ class Course extends BaseAdminController return success('DELETE_SUCCESS'); } - } diff --git a/niucloud/app/model/course/Course.php b/niucloud/app/model/course/Course.php index 0f5e48e3..ace8ac7d 100644 --- a/niucloud/app/model/course/Course.php +++ b/niucloud/app/model/course/Course.php @@ -9,7 +9,7 @@ // | Author: Niucloud Team // +---------------------------------------------------------------------- -namespace app\model\campus; +namespace app\model\course; use core\base\BaseModel; use think\model\concern\SoftDelete; @@ -17,11 +17,11 @@ use think\model\relation\HasMany; use think\model\relation\HasOne; /** - * 校区模型 - * Class Campus - * @package app\model\campus + * 课程模型 + * Class Course + * @package app\model\course */ -class Campus extends BaseModel +class Course extends BaseModel { use SoftDelete; @@ -36,13 +36,13 @@ class Campus extends BaseModel * 模型名称 * @var string */ - protected $name = 'campus'; + protected $name = 'course'; /** * 定义软删除标记字段. * @var string */ - protected $deleteTime = 'delete_time'; + protected $deleteTime = 'deleted_at'; /** * 定义软删除字段的默认值. @@ -51,38 +51,122 @@ class Campus extends BaseModel protected $defaultSoftDelete = 0; /** - * 搜索器:校区校区名称 + * 搜索器:课程课程编号 * @param $value * @param $data */ - public function searchCampusNameAttr($query, $value, $data) + public function searchIdAttr($query, $value, $data) { if ($value) { - $query->where("campus_name", "like", "%".$value."%"); + $query->where("id", $value); } } /** - * 搜索器:校区校区地址 + * 搜索器:课程课程名称 * @param $value * @param $data */ - public function searchCampusAddressAttr($query, $value, $data) + public function searchCourseNameAttr($query, $value, $data) { if ($value) { - $query->where("campus_address", $value); + $query->where("course_name", $value); } } /** - * 搜索器:校区校区状态 + * 搜索器:课程课程类型 * @param $value * @param $data */ - public function searchCampusStatusAttr($query, $value, $data) + public function searchCourseTypeAttr($query, $value, $data) { if ($value) { - $query->where("campus_status", $value); + $query->where("course_type", $value); + } + } + + /** + * 搜索器:课程课程时长 + * @param $value + * @param $data + */ + public function searchDurationAttr($query, $value, $data) + { + if ($value) { + $query->where("duration", $value); + } + } + + /** + * 搜索器:课程课时数量 + * @param $value + * @param $data + */ + public function searchSessionCountAttr($query, $value, $data) + { + if ($value) { + $query->where("session_count", $value); + } + } + + /** + * 搜索器:课程单次逍客数量 + * @param $value + * @param $data + */ + public function searchSingleSessionCountAttr($query, $value, $data) + { + if ($value) { + $query->where("single_session_count", $value); + } + } + + /** + * 搜索器:课程课程价格 + * @param $value + * @param $data + */ + public function searchPriceAttr($query, $value, $data) + { + if ($value) { + $query->where("price", $value); + } + } + + /** + * 搜索器:课程内部提醒课时 + * @param $value + * @param $data + */ + public function searchInternalReminderAttr($query, $value, $data) + { + if ($value) { + $query->where("internal_reminder", $value); + } + } + + /** + * 搜索器:课程客户提醒课时 + * @param $value + * @param $data + */ + public function searchCustomerReminderAttr($query, $value, $data) + { + if ($value) { + $query->where("customer_reminder", $value); + } + } + + /** + * 搜索器:课程课程备注 + * @param $value + * @param $data + */ + public function searchRemarksAttr($query, $value, $data) + { + if ($value) { + $query->where("remarks", $value); } }