Browse Source

代码格式化

master
王泽彦 10 months ago
parent
commit
adf2ea85a9
  1. 4
      admin/components.d.ts
  2. 26
      admin/src/app/api/communication_records.ts
  3. 42
      admin/src/app/api/order_table.ts
  4. 39
      admin/src/app/api/physical_test.ts
  5. 32
      admin/src/app/api/student_courses.ts
  6. 3
      admin/src/app/api/sys.ts
  7. 40
      admin/src/app/lang/zh-cn/communication_records.communication_records.json
  8. 3
      admin/src/app/lang/zh-cn/customer_resource_changes.customer_resource_changes.json
  9. 210
      admin/src/app/lang/zh-cn/customer_resources.customer_resources.json
  10. 28
      admin/src/app/lang/zh-cn/exam_questions.exam_questions_edit.json
  11. 40
      admin/src/app/lang/zh-cn/order_table.order_table.json
  12. 72
      admin/src/app/lang/zh-cn/physical_test.physical_test.json
  13. 76
      admin/src/app/lang/zh-cn/physical_test.physical_test_edit.json
  14. 36
      admin/src/app/lang/zh-cn/student_courses.student_courses.json
  15. 72
      admin/src/app/lang/zh-cn/tc_dialog.physical_test_edit.json
  16. 2
      admin/src/app/views/campus_person_role/campus_person_role.vue
  17. 551
      admin/src/app/views/communication_records/communication_records.vue
  18. 614
      admin/src/app/views/communication_records/components/communication-records-edit.vue
  19. 850
      admin/src/app/views/customer_resources/customer_resources.vue
  20. 595
      admin/src/app/views/order_table/components/order-table-edit.vue
  21. 561
      admin/src/app/views/order_table/order_table.vue
  22. 740
      admin/src/app/views/physical_test/components/physical-test-edit.vue
  23. 472
      admin/src/app/views/physical_test/physical_test.vue
  24. 764
      admin/src/app/views/physical_test/physical_test_edit.vue
  25. 331
      admin/src/app/views/setting/pay.vue
  26. 504
      admin/src/app/views/student_courses/components/student-courses-edit.vue
  27. 472
      admin/src/app/views/student_courses/student_courses.vue
  28. 520
      admin/src/app/views/tc_dialog/tc_dialog.vue
  29. 25
      admin/src/app/views/timetables/timetables.vue
  30. 416
      admin/src/app/views/xsyj/xsyj.vue

4
admin/components.d.ts

@ -41,8 +41,6 @@ declare module '@vue/runtime-core' {
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
@ -52,9 +50,7 @@ declare module '@vue/runtime-core' {
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElUpload: typeof import('element-plus/es')['ElUpload']
ExportSure: typeof import('./src/components/export-sure/index.vue')['default']
HeatMap: typeof import('./src/components/heat-map/index.vue')['default']

26
admin/src/app/api/communication_records.ts

@ -1,7 +1,5 @@
import request from '@/utils/request'
// USER_CODE_BEGIN -- communication_records
/**
*
@ -9,7 +7,7 @@ import request from '@/utils/request'
* @returns
*/
export function getCommunicationRecordsList(params: Record<string, any>) {
return request.get(`communication_records/communication_records`, {params})
return request.get(`communication_records/communication_records`, { params })
}
/**
@ -18,7 +16,7 @@ export function getCommunicationRecordsList(params: Record<string, any>) {
* @returns
*/
export function getCommunicationRecordsInfo(id: number) {
return request.get(`communication_records/communication_records/${id}`);
return request.get(`communication_records/communication_records/${id}`)
}
/**
@ -27,7 +25,10 @@ export function getCommunicationRecordsInfo(id: number) {
* @returns
*/
export function addCommunicationRecords(params: Record<string, any>) {
return request.post('communication_records/communication_records', params, { showErrorMessage: true, showSuccessMessage: true })
return request.post('communication_records/communication_records', params, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
/**
@ -37,7 +38,11 @@ export function addCommunicationRecords(params: Record<string, any>) {
* @returns
*/
export function editCommunicationRecords(params: Record<string, any>) {
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 }
)
}
/**
@ -46,11 +51,14 @@ export function editCommunicationRecords(params: Record<string, any>) {
* @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<string,any>){
return request.get('communication_records/customer_resources_all', {params})
export function getWithCustomerResourcesList(params: Record<string, any>) {
return request.get('communication_records/customer_resources_all', { params })
}
// USER_CODE_END -- communication_records

42
admin/src/app/api/order_table.ts

@ -1,9 +1,5 @@
import request from '@/utils/request'
// USER_CODE_BEGIN -- order_table
/**
*
@ -11,7 +7,7 @@ import request from '@/utils/request'
* @returns
*/
export function getOrderTableList(params: Record<string, any>) {
return request.get(`order_table/order_table`, {params})
return request.get(`order_table/order_table`, { params })
}
/**
@ -20,7 +16,7 @@ export function getOrderTableList(params: Record<string, any>) {
* @returns
*/
export function getOrderTableInfo(id: number) {
return request.get(`order_table/order_table/${id}`);
return request.get(`order_table/order_table/${id}`)
}
/**
@ -29,7 +25,10 @@ export function getOrderTableInfo(id: number) {
* @returns
*/
export function addOrderTable(params: Record<string, any>) {
return request.post('order_table/order_table', params, { showErrorMessage: true, showSuccessMessage: true })
return request.post('order_table/order_table', params, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
/**
@ -39,7 +38,10 @@ export function addOrderTable(params: Record<string, any>) {
* @returns
*/
export function editOrderTable(params: Record<string, any>) {
return request.put(`order_table/order_table/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
return request.put(`order_table/order_table/${params.id}`, params, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
/**
@ -48,17 +50,23 @@ export function editOrderTable(params: Record<string, any>) {
* @returns
*/
export function deleteOrderTable(id: number) {
return request.delete(`order_table/order_table/${id}`, { showErrorMessage: true, showSuccessMessage: true })
return request.delete(`order_table/order_table/${id}`, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
export function getWithCustomerResourcesList(params: Record<string,any>){
return request.get('order_table/customer_resources_all', {params})
}export function getWithCourseList(params: Record<string,any>){
return request.get('order_table/course_all', {params})
}export function getWithClassGradeList(params: Record<string,any>){
return request.get('order_table/class_grade_all', {params})
}export function getWithPersonnelList(params: Record<string,any>){
return request.get('order_table/personnel_all', {params})
export function getWithCustomerResourcesList(params: Record<string, any>) {
return request.get('order_table/customer_resources_all', { params })
}
export function getWithCourseList(params: Record<string, any>) {
return request.get('order_table/course_all', { params })
}
export function getWithClassGradeList(params: Record<string, any>) {
return request.get('order_table/class_grade_all', { params })
}
export function getWithPersonnelList(params: Record<string, any>) {
return request.get('order_table/personnel_all', { params })
}
// USER_CODE_END -- order_table

39
admin/src/app/api/physical_test.ts

@ -1,11 +1,5 @@
import request from '@/utils/request'
// USER_CODE_BEGIN -- physical_test
/**
*
@ -13,7 +7,7 @@ import request from '@/utils/request'
* @returns
*/
export function getPhysicalTestList(params: Record<string, any>) {
return request.get(`physical_test/physical_test`, {params})
return request.get(`physical_test/physical_test`, { params })
}
/**
@ -22,7 +16,7 @@ export function getPhysicalTestList(params: Record<string, any>) {
* @returns
*/
export function getPhysicalTestInfo(id: number) {
return request.get(`physical_test/physical_test/${id}`);
return request.get(`physical_test/physical_test/${id}`)
}
/**
@ -31,7 +25,10 @@ export function getPhysicalTestInfo(id: number) {
* @returns
*/
export function addPhysicalTest(params: Record<string, any>) {
return request.post('physical_test/physical_test', params, { showErrorMessage: true, showSuccessMessage: true })
return request.post('physical_test/physical_test', params, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
/**
@ -41,7 +38,10 @@ export function addPhysicalTest(params: Record<string, any>) {
* @returns
*/
export function editPhysicalTest(params: Record<string, any>) {
return request.put(`physical_test/physical_test/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
return request.put(`physical_test/physical_test/${params.id}`, params, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
/**
@ -50,15 +50,20 @@ export function editPhysicalTest(params: Record<string, any>) {
* @returns
*/
export function deletePhysicalTest(id: number) {
return request.delete(`physical_test/physical_test/${id}`, { showErrorMessage: true, showSuccessMessage: true })
return request.delete(`physical_test/physical_test/${id}`, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
export function getWithCustomerResourcesList(params: Record<string,any>){
return request.get('physical_test/customer_resources_all', {params})
}export function getWithStudentList(params: Record<string,any>){
return request.get('physical_test/student_all', {params})
}export function getWithPersonnelList(params: Record<string,any>){
return request.get('physical_test/personnel_all', {params})
export function getWithCustomerResourcesList(params: Record<string, any>) {
return request.get('physical_test/customer_resources_all', { params })
}
export function getWithStudentList(params: Record<string, any>) {
return request.get('physical_test/student_all', { params })
}
export function getWithPersonnelList(params: Record<string, any>) {
return request.get('physical_test/personnel_all', { params })
}
// USER_CODE_END -- physical_test

32
admin/src/app/api/student_courses.ts

@ -1,9 +1,5 @@
import request from '@/utils/request'
// USER_CODE_BEGIN -- student_courses
/**
*
@ -11,7 +7,7 @@ import request from '@/utils/request'
* @returns
*/
export function getStudentCoursesList(params: Record<string, any>) {
return request.get(`student_courses/student_courses`, {params})
return request.get(`student_courses/student_courses`, { params })
}
/**
@ -20,7 +16,7 @@ export function getStudentCoursesList(params: Record<string, any>) {
* @returns
*/
export function getStudentCoursesInfo(id: number) {
return request.get(`student_courses/student_courses/${id}`);
return request.get(`student_courses/student_courses/${id}`)
}
/**
@ -29,7 +25,10 @@ export function getStudentCoursesInfo(id: number) {
* @returns
*/
export function addStudentCourses(params: Record<string, any>) {
return request.post('student_courses/student_courses', params, { showErrorMessage: true, showSuccessMessage: true })
return request.post('student_courses/student_courses', params, {
showErrorMessage: true,
showSuccessMessage: true,
})
}
/**
@ -39,7 +38,10 @@ export function addStudentCourses(params: Record<string, any>) {
* @returns
*/
export function editStudentCourses(params: Record<string, any>) {
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,
})
}
/**
@ -48,13 +50,17 @@ export function editStudentCourses(params: Record<string, any>) {
* @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<string,any>){
return request.get('student_courses/student_all', {params})
}export function getWithCourseList(params: Record<string,any>){
return request.get('student_courses/course_all', {params})
export function getWithStudentList(params: Record<string, any>) {
return request.get('student_courses/student_all', { params })
}
export function getWithCourseList(params: Record<string, any>) {
return request.get('student_courses/course_all', { params })
}
// USER_CODE_END -- student_courses

3
admin/src/app/api/sys.ts

@ -765,7 +765,6 @@ export function yjpzConfig(params: Record<string, any>) {
return request.post(`sys/yjpz_config`, params)
}
export function xsyjConfig(params: Record<string, any>) {
return request.post(`sys/xsyj_config`, params)
}
@ -773,5 +772,3 @@ export function xsyjConfig(params: Record<string, any>) {
export function getXsyjConfig() {
return request.get('sys/get_xsyj_config')
}

40
admin/src/app/lang/zh-cn/communication_records.communication_records.json

@ -1,21 +1,21 @@
{
"resourceId":"资源",
"resourceIdPlaceholder":"全部",
"resourceType":"资源类型",
"resourceTypePlaceholder":"请输入资源类型",
"communicationType":"沟通类型",
"communicationTypePlaceholder":"请输入沟通类型",
"communicationResult":"沟通结果",
"communicationResultPlaceholder":"请输入沟通结果",
"communicationTime":"沟通时间",
"communicationTimePlaceholder":"请输入沟通时间",
"remarks":"备注",
"remarksPlaceholder":"请输入备注",
"tag":"标签",
"tagPlaceholder":"请输入标签",
"addCommunicationRecords":"添加沟通记录",
"updateCommunicationRecords":"编辑沟通记录",
"communicationRecordsDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间"
}
"resourceId": "资源",
"resourceIdPlaceholder": "全部",
"resourceType": "资源类型",
"resourceTypePlaceholder": "请输入资源类型",
"communicationType": "沟通类型",
"communicationTypePlaceholder": "请输入沟通类型",
"communicationResult": "沟通结果",
"communicationResultPlaceholder": "请输入沟通结果",
"communicationTime": "沟通时间",
"communicationTimePlaceholder": "请输入沟通时间",
"remarks": "备注",
"remarksPlaceholder": "请输入备注",
"tag": "标签",
"tagPlaceholder": "请输入标签",
"addCommunicationRecords": "添加沟通记录",
"updateCommunicationRecords": "编辑沟通记录",
"communicationRecordsDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间"
}

3
admin/src/app/lang/zh-cn/customer_resource_changes.customer_resource_changes.json

@ -18,7 +18,4 @@
"customerResourceChangesDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间"
}

210
admin/src/app/lang/zh-cn/customer_resources.customer_resources.json

@ -1,107 +1,105 @@
{
"source":"来源",
"sourcePlaceholder":"请输入来源",
"sourceChannel":"来源渠道",
"sourceChannelPlaceholder":"请输入来源渠道",
"consultant":"顾问",
"name":"姓名",
"namePlaceholder":"请输入姓名",
"age":"年龄",
"agePlaceholder":"请输入年龄",
"gender":"性别",
"genderPlaceholder":"请输入性别",
"phoneNumber":"联系电话",
"phoneNumberPlaceholder":"请输入联系电话",
"demand":"需求",
"demandPlaceholder":"请输入需求",
"purchasingPower":"购买力",
"purchasingPowerPlaceholder":"请输入购买力",
"cognitiveIdea":"认知理念",
"cognitiveIdeaPlaceholder":"请输入认知理念",
"optionalClassTime":"可选上课时间",
"optionalClassTimePlaceholder":"请输入可选上课时间",
"distance":"距离",
"distancePlaceholder":"请输入距离",
"decisionMaker":"决策人",
"decisionMakerPlaceholder":"请输入决策人",
"initialIntent":"客户初步意向度",
"initialIntentPlaceholder":"请输入客户初步意向度",
"campus":"所属校区",
"campusPlaceholder":"请输入所属校区",
"status":"客户状态",
"statusPlaceholder":"请输入客户状态",
"addCustomerResources":"添加客户资源",
"updateCustomerResources":"编辑客户资源",
"customerResourcesDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间",
"resourceId":"资源",
"resourceIdPlaceholder":"请输入资源",
"orderStatus":"订单状态",
"orderStatusPlaceholder":"请输入订单状态",
"paymentType":"付款类型",
"paymentTypePlaceholder":"请输入付款类型",
"orderAmount":"订单金额",
"orderAmountPlaceholder":"请输入订单金额",
"courseId":"课程",
"courseIdPlaceholder":"请输入课程",
"classId":"班级",
"classIdPlaceholder":"请输入班级",
"staffId":"人员",
"paymentTime":"支付时间",
"addOrderTable":"添加订单",
"updateOrderTable":"编辑订单",
"resourceId":"客户姓名",
"resourceIdPlaceholder":"全部",
"studentId":"学员姓名",
"studentIdPlaceholder":"全部",
"height":"身高",
"heightPlaceholder":"请输入身高",
"createdAt":"创建时间",
"updatedAt":"修改时间",
"addPhysicalTest":"添加体测",
"updatePhysicalTest":"编辑体测",
"physicalTestDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间",
"resourceId":"客户姓名",
"resourceIdPlaceholder":"全部",
"studentId":"学员姓名",
"studentIdPlaceholder":"全部",
"height":"身高",
"heightPlaceholder":"请输入身高",
"weight":"体重",
"weightPlaceholder":"请输入体重",
"coachId":"教练",
"coachIdPlaceholder":"请输入教练",
"seatedForwardBend":"坐位体前屈",
"seatedForwardBendPlaceholder":"请输入坐位体前屈",
"sitUps":"仰卧卷腹",
"sitUpsPlaceholder":"请输入仰卧卷腹",
"pushUps":"九十度仰卧撑",
"pushUpsPlaceholder":"请输入九十度仰卧撑",
"flamingoBalance":"火烈鸟平衡测试",
"flamingoBalancePlaceholder":"请输入火烈鸟平衡测试",
"thirtySecJump":"三十秒双脚连续跳",
"thirtySecJumpPlaceholder":"请输入三十秒双脚连续跳",
"standingLongJump":"立定跳远",
"standingLongJumpPlaceholder":"请输入立定跳远",
"agilityRun":"4乘10m灵敏折返跑",
"agilityRunPlaceholder":"请输入4乘10m灵敏折返跑",
"balanceBeam":"走平衡木",
"balanceBeamPlaceholder":"请输入走平衡木",
"tennisThrow":"网球掷远",
"tennisThrowPlaceholder":"请输入网球掷远",
"tenMeterShuttleRun":"十米往返跑",
"tenMeterShuttleRunPlaceholder":"请输入十米往返跑",
"addPhysicalTest":"添加体测",
"updatePhysicalTest":"编辑体测",
"physicalTestDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间"
}
"source": "来源",
"sourcePlaceholder": "请输入来源",
"sourceChannel": "来源渠道",
"sourceChannelPlaceholder": "请输入来源渠道",
"consultant": "顾问",
"name": "姓名",
"namePlaceholder": "请输入姓名",
"age": "年龄",
"agePlaceholder": "请输入年龄",
"gender": "性别",
"genderPlaceholder": "请输入性别",
"phoneNumber": "联系电话",
"phoneNumberPlaceholder": "请输入联系电话",
"demand": "需求",
"demandPlaceholder": "请输入需求",
"purchasingPower": "购买力",
"purchasingPowerPlaceholder": "请输入购买力",
"cognitiveIdea": "认知理念",
"cognitiveIdeaPlaceholder": "请输入认知理念",
"optionalClassTime": "可选上课时间",
"optionalClassTimePlaceholder": "请输入可选上课时间",
"distance": "距离",
"distancePlaceholder": "请输入距离",
"decisionMaker": "决策人",
"decisionMakerPlaceholder": "请输入决策人",
"initialIntent": "客户初步意向度",
"initialIntentPlaceholder": "请输入客户初步意向度",
"campus": "所属校区",
"campusPlaceholder": "请输入所属校区",
"status": "客户状态",
"statusPlaceholder": "请输入客户状态",
"addCustomerResources": "添加客户资源",
"updateCustomerResources": "编辑客户资源",
"customerResourcesDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间",
"resourceId": "资源",
"resourceIdPlaceholder": "请输入资源",
"orderStatus": "订单状态",
"orderStatusPlaceholder": "请输入订单状态",
"paymentType": "付款类型",
"paymentTypePlaceholder": "请输入付款类型",
"orderAmount": "订单金额",
"orderAmountPlaceholder": "请输入订单金额",
"courseId": "课程",
"courseIdPlaceholder": "请输入课程",
"classId": "班级",
"classIdPlaceholder": "请输入班级",
"staffId": "人员",
"paymentTime": "支付时间",
"addOrderTable": "添加订单",
"updateOrderTable": "编辑订单",
"resourceId": "客户姓名",
"resourceIdPlaceholder": "全部",
"studentId": "学员姓名",
"studentIdPlaceholder": "全部",
"height": "身高",
"heightPlaceholder": "请输入身高",
"createdAt": "创建时间",
"updatedAt": "修改时间",
"addPhysicalTest": "添加体测",
"updatePhysicalTest": "编辑体测",
"physicalTestDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间",
"resourceId": "客户姓名",
"resourceIdPlaceholder": "全部",
"studentId": "学员姓名",
"studentIdPlaceholder": "全部",
"height": "身高",
"heightPlaceholder": "请输入身高",
"weight": "体重",
"weightPlaceholder": "请输入体重",
"coachId": "教练",
"coachIdPlaceholder": "请输入教练",
"seatedForwardBend": "坐位体前屈",
"seatedForwardBendPlaceholder": "请输入坐位体前屈",
"sitUps": "仰卧卷腹",
"sitUpsPlaceholder": "请输入仰卧卷腹",
"pushUps": "九十度仰卧撑",
"pushUpsPlaceholder": "请输入九十度仰卧撑",
"flamingoBalance": "火烈鸟平衡测试",
"flamingoBalancePlaceholder": "请输入火烈鸟平衡测试",
"thirtySecJump": "三十秒双脚连续跳",
"thirtySecJumpPlaceholder": "请输入三十秒双脚连续跳",
"standingLongJump": "立定跳远",
"standingLongJumpPlaceholder": "请输入立定跳远",
"agilityRun": "4乘10m灵敏折返跑",
"agilityRunPlaceholder": "请输入4乘10m灵敏折返跑",
"balanceBeam": "走平衡木",
"balanceBeamPlaceholder": "请输入走平衡木",
"tennisThrow": "网球掷远",
"tennisThrowPlaceholder": "请输入网球掷远",
"tenMeterShuttleRun": "十米往返跑",
"tenMeterShuttleRunPlaceholder": "请输入十米往返跑",
"addPhysicalTest": "添加体测",
"updatePhysicalTest": "编辑体测",
"physicalTestDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间"
}

28
admin/src/app/lang/zh-cn/exam_questions.exam_questions_edit.json

@ -1,15 +1,15 @@
{
"questionType":"题型",
"questionContentType":"题干",
"questionContent":"题干内容",
"optionAContentType":"选项类型",
"optionAContent":"选项内容",
"correctAnswer":"正确答案",
"questionTypePlaceholder":"请选择题型",
"questionContentTypePlaceholder":"请选择题干类型",
"questionContentPlaceholder":"请输入题干内容",
"correctAnswerPlaceholder":"请输入正确答案",
"addExamQuestions":"添加试题",
"updateExamQuestions":"编辑试题",
"examQuestionsDeleteTips":"确定要删除该试题吗?"
}
"questionType": "题型",
"questionContentType": "题干",
"questionContent": "题干内容",
"optionAContentType": "选项类型",
"optionAContent": "选项内容",
"correctAnswer": "正确答案",
"questionTypePlaceholder": "请选择题型",
"questionContentTypePlaceholder": "请选择题干类型",
"questionContentPlaceholder": "请输入题干内容",
"correctAnswerPlaceholder": "请输入正确答案",
"addExamQuestions": "添加试题",
"updateExamQuestions": "编辑试题",
"examQuestionsDeleteTips": "确定要删除该试题吗?"
}

40
admin/src/app/lang/zh-cn/order_table.order_table.json

@ -1,21 +1,21 @@
{
"resourceId":"资源",
"resourceIdPlaceholder":"请输入资源",
"orderStatus":"订单状态",
"orderStatusPlaceholder":"请输入订单状态",
"paymentType":"付款类型",
"paymentTypePlaceholder":"请输入付款类型",
"orderAmount":"订单金额",
"orderAmountPlaceholder":"请输入订单金额",
"courseId":"课程",
"courseIdPlaceholder":"请输入课程",
"classId":"班级",
"classIdPlaceholder":"请输入班级",
"staffId":"人员",
"paymentTime":"支付时间",
"addOrderTable":"添加订单",
"updateOrderTable":"编辑订单",
"orderTableDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间"
}
"resourceId": "资源",
"resourceIdPlaceholder": "请输入资源",
"orderStatus": "订单状态",
"orderStatusPlaceholder": "请输入订单状态",
"paymentType": "付款类型",
"paymentTypePlaceholder": "请输入付款类型",
"orderAmount": "订单金额",
"orderAmountPlaceholder": "请输入订单金额",
"courseId": "课程",
"courseIdPlaceholder": "请输入课程",
"classId": "班级",
"classIdPlaceholder": "请输入班级",
"staffId": "人员",
"paymentTime": "支付时间",
"addOrderTable": "添加订单",
"updateOrderTable": "编辑订单",
"orderTableDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间"
}

72
admin/src/app/lang/zh-cn/physical_test.physical_test.json

@ -1,37 +1,37 @@
{
"resourceId":"客户姓名",
"resourceIdPlaceholder":"全部",
"studentId":"学员姓名",
"studentIdPlaceholder":"全部",
"height":"身高",
"heightPlaceholder":"请输入身高",
"weight":"体重",
"weightPlaceholder":"请输入体重",
"coachId":"教练",
"coachIdPlaceholder":"请输入教练",
"seatedForwardBend":"坐位体前屈",
"seatedForwardBendPlaceholder":"请输入坐位体前屈",
"sitUps":"仰卧卷腹",
"sitUpsPlaceholder":"请输入仰卧卷腹",
"pushUps":"九十度仰卧撑",
"pushUpsPlaceholder":"请输入九十度仰卧撑",
"flamingoBalance":"火烈鸟平衡测试",
"flamingoBalancePlaceholder":"请输入火烈鸟平衡测试",
"thirtySecJump":"三十秒双脚连续跳",
"thirtySecJumpPlaceholder":"请输入三十秒双脚连续跳",
"standingLongJump":"立定跳远",
"standingLongJumpPlaceholder":"请输入立定跳远",
"agilityRun":"4乘10m灵敏折返跑",
"agilityRunPlaceholder":"请输入4乘10m灵敏折返跑",
"balanceBeam":"走平衡木",
"balanceBeamPlaceholder":"请输入走平衡木",
"tennisThrow":"网球掷远",
"tennisThrowPlaceholder":"请输入网球掷远",
"tenMeterShuttleRun":"十米往返跑",
"tenMeterShuttleRunPlaceholder":"请输入十米往返跑",
"addPhysicalTest":"添加体测",
"updatePhysicalTest":"编辑体测",
"physicalTestDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间"
}
"resourceId": "客户姓名",
"resourceIdPlaceholder": "全部",
"studentId": "学员姓名",
"studentIdPlaceholder": "全部",
"height": "身高",
"heightPlaceholder": "请输入身高",
"weight": "体重",
"weightPlaceholder": "请输入体重",
"coachId": "教练",
"coachIdPlaceholder": "请输入教练",
"seatedForwardBend": "坐位体前屈",
"seatedForwardBendPlaceholder": "请输入坐位体前屈",
"sitUps": "仰卧卷腹",
"sitUpsPlaceholder": "请输入仰卧卷腹",
"pushUps": "九十度仰卧撑",
"pushUpsPlaceholder": "请输入九十度仰卧撑",
"flamingoBalance": "火烈鸟平衡测试",
"flamingoBalancePlaceholder": "请输入火烈鸟平衡测试",
"thirtySecJump": "三十秒双脚连续跳",
"thirtySecJumpPlaceholder": "请输入三十秒双脚连续跳",
"standingLongJump": "立定跳远",
"standingLongJumpPlaceholder": "请输入立定跳远",
"agilityRun": "4乘10m灵敏折返跑",
"agilityRunPlaceholder": "请输入4乘10m灵敏折返跑",
"balanceBeam": "走平衡木",
"balanceBeamPlaceholder": "请输入走平衡木",
"tennisThrow": "网球掷远",
"tennisThrowPlaceholder": "请输入网球掷远",
"tenMeterShuttleRun": "十米往返跑",
"tenMeterShuttleRunPlaceholder": "请输入十米往返跑",
"addPhysicalTest": "添加体测",
"updatePhysicalTest": "编辑体测",
"physicalTestDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间"
}

76
admin/src/app/lang/zh-cn/physical_test.physical_test_edit.json

@ -1,39 +1,39 @@
{
"resourceId":"客户姓名",
"studentId":"学员姓名",
"height":"身高",
"weight":"体重",
"coachId":"教练",
"createdAt":"创建时间",
"updatedAt":"修改时间",
"seatedForwardBend":"坐位体前屈",
"sitUps":"仰卧卷腹",
"pushUps":"九十度仰卧撑",
"flamingoBalance":"火烈鸟平衡测试",
"thirtySecJump":"三十秒双脚连续跳",
"standingLongJump":"立定跳远",
"agilityRun":"4乘10m灵敏折返跑",
"balanceBeam":"走平衡木",
"tennisThrow":"网球掷远",
"tenMeterShuttleRun":"十米往返跑",
"resourceIdPlaceholder":"请选择客户姓名",
"studentIdPlaceholder":"请选择学员姓名",
"heightPlaceholder":"请输入身高",
"weightPlaceholder":"请输入体重",
"coachIdPlaceholder":"请选择教练",
"createdAtPlaceholder":"请输入创建时间",
"updatedAtPlaceholder":"请输入修改时间",
"seatedForwardBendPlaceholder":"请输入坐位体前屈",
"sitUpsPlaceholder":"请输入仰卧卷腹",
"pushUpsPlaceholder":"请输入九十度仰卧撑",
"flamingoBalancePlaceholder":"请输入火烈鸟平衡测试",
"thirtySecJumpPlaceholder":"请输入三十秒双脚连续跳",
"standingLongJumpPlaceholder":"请输入立定跳远",
"agilityRunPlaceholder":"请输入4乘10m灵敏折返跑",
"balanceBeamPlaceholder":"请输入走平衡木",
"tennisThrowPlaceholder":"请输入网球掷远",
"tenMeterShuttleRunPlaceholder":"请输入十米往返跑",
"addPhysicalTest":"添加体测",
"updatePhysicalTest":"编辑体测",
"physicalTestDeleteTips":"确定要删除该体测吗?"
}
"resourceId": "客户姓名",
"studentId": "学员姓名",
"height": "身高",
"weight": "体重",
"coachId": "教练",
"createdAt": "创建时间",
"updatedAt": "修改时间",
"seatedForwardBend": "坐位体前屈",
"sitUps": "仰卧卷腹",
"pushUps": "九十度仰卧撑",
"flamingoBalance": "火烈鸟平衡测试",
"thirtySecJump": "三十秒双脚连续跳",
"standingLongJump": "立定跳远",
"agilityRun": "4乘10m灵敏折返跑",
"balanceBeam": "走平衡木",
"tennisThrow": "网球掷远",
"tenMeterShuttleRun": "十米往返跑",
"resourceIdPlaceholder": "请选择客户姓名",
"studentIdPlaceholder": "请选择学员姓名",
"heightPlaceholder": "请输入身高",
"weightPlaceholder": "请输入体重",
"coachIdPlaceholder": "请选择教练",
"createdAtPlaceholder": "请输入创建时间",
"updatedAtPlaceholder": "请输入修改时间",
"seatedForwardBendPlaceholder": "请输入坐位体前屈",
"sitUpsPlaceholder": "请输入仰卧卷腹",
"pushUpsPlaceholder": "请输入九十度仰卧撑",
"flamingoBalancePlaceholder": "请输入火烈鸟平衡测试",
"thirtySecJumpPlaceholder": "请输入三十秒双脚连续跳",
"standingLongJumpPlaceholder": "请输入立定跳远",
"agilityRunPlaceholder": "请输入4乘10m灵敏折返跑",
"balanceBeamPlaceholder": "请输入走平衡木",
"tennisThrowPlaceholder": "请输入网球掷远",
"tenMeterShuttleRunPlaceholder": "请输入十米往返跑",
"addPhysicalTest": "添加体测",
"updatePhysicalTest": "编辑体测",
"physicalTestDeleteTips": "确定要删除该体测吗?"
}

36
admin/src/app/lang/zh-cn/student_courses.student_courses.json

@ -1,19 +1,19 @@
{
"studentId":"学员",
"studentIdPlaceholder":"全部",
"courseId":"课程",
"courseIdPlaceholder":"全部",
"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": "请选择结束时间"
}

72
admin/src/app/lang/zh-cn/tc_dialog.physical_test_edit.json

@ -1,37 +1,37 @@
{
"resourceId":"客户姓名",
"resourceIdPlaceholder":"全部",
"studentId":"学员姓名",
"studentIdPlaceholder":"全部",
"height":"身高",
"heightPlaceholder":"请输入身高",
"weight":"体重",
"weightPlaceholder":"请输入体重",
"coachId":"教练",
"coachIdPlaceholder":"请输入教练",
"seatedForwardBend":"坐位体前屈",
"seatedForwardBendPlaceholder":"请输入坐位体前屈",
"sitUps":"仰卧卷腹",
"sitUpsPlaceholder":"请输入仰卧卷腹",
"pushUps":"九十度仰卧撑",
"pushUpsPlaceholder":"请输入九十度仰卧撑",
"flamingoBalance":"火烈鸟平衡测试",
"flamingoBalancePlaceholder":"请输入火烈鸟平衡测试",
"thirtySecJump":"三十秒双脚连续跳",
"thirtySecJumpPlaceholder":"请输入三十秒双脚连续跳",
"standingLongJump":"立定跳远",
"standingLongJumpPlaceholder":"请输入立定跳远",
"agilityRun":"4乘10m灵敏折返跑",
"agilityRunPlaceholder":"请输入4乘10m灵敏折返跑",
"balanceBeam":"走平衡木",
"balanceBeamPlaceholder":"请输入走平衡木",
"tennisThrow":"网球掷远",
"tennisThrowPlaceholder":"请输入网球掷远",
"tenMeterShuttleRun":"十米往返跑",
"tenMeterShuttleRunPlaceholder":"请输入十米往返跑",
"addPhysicalTest":"添加体测",
"updatePhysicalTest":"编辑体测",
"physicalTestDeleteTips":"确定要删除该数据吗?",
"startDate":"请选择开始时间",
"endDate":"请选择结束时间"
}
"resourceId": "客户姓名",
"resourceIdPlaceholder": "全部",
"studentId": "学员姓名",
"studentIdPlaceholder": "全部",
"height": "身高",
"heightPlaceholder": "请输入身高",
"weight": "体重",
"weightPlaceholder": "请输入体重",
"coachId": "教练",
"coachIdPlaceholder": "请输入教练",
"seatedForwardBend": "坐位体前屈",
"seatedForwardBendPlaceholder": "请输入坐位体前屈",
"sitUps": "仰卧卷腹",
"sitUpsPlaceholder": "请输入仰卧卷腹",
"pushUps": "九十度仰卧撑",
"pushUpsPlaceholder": "请输入九十度仰卧撑",
"flamingoBalance": "火烈鸟平衡测试",
"flamingoBalancePlaceholder": "请输入火烈鸟平衡测试",
"thirtySecJump": "三十秒双脚连续跳",
"thirtySecJumpPlaceholder": "请输入三十秒双脚连续跳",
"standingLongJump": "立定跳远",
"standingLongJumpPlaceholder": "请输入立定跳远",
"agilityRun": "4乘10m灵敏折返跑",
"agilityRunPlaceholder": "请输入4乘10m灵敏折返跑",
"balanceBeam": "走平衡木",
"balanceBeamPlaceholder": "请输入走平衡木",
"tennisThrow": "网球掷远",
"tennisThrowPlaceholder": "请输入网球掷远",
"tenMeterShuttleRun": "十米往返跑",
"tenMeterShuttleRunPlaceholder": "请输入十米往返跑",
"addPhysicalTest": "添加体测",
"updatePhysicalTest": "编辑体测",
"physicalTestDeleteTips": "确定要删除该数据吗?",
"startDate": "请选择开始时间",
"endDate": "请选择结束时间"
}

2
admin/src/app/views/campus_person_role/campus_person_role.vue

@ -186,7 +186,7 @@ const route = useRoute()
const pageName = route.meta.title
// ?dept_id=1
const dept_id = pageName == '市场人员列表' ? 1 : 2;
const dept_id = pageName == '市场人员列表' ? 1 : 2
let campusPersonRoleTable = reactive({
page: 1,
limit: 10,

551
admin/src/app/views/communication_records/communication_records.vue

@ -1,231 +1,320 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{pageName}}</span>
<el-button type="primary" @click="addEvent">
{{ t('addCommunicationRecords') }}
</el-button>
</div>
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="communicationRecordsTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="w-[280px]" v-model="communicationRecordsTable.searchParam.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('communicationType')" prop="communication_type">
<el-select class="w-[280px]" v-model="communicationRecordsTable.searchParam.communication_type" clearable :placeholder="t('communicationTypePlaceholder')">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in communication_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadCommunicationRecordsList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table :data="communicationRecordsTable.data" size="large" v-loading="communicationRecordsTable.loading">
<template #empty>
<span>{{ !communicationRecordsTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="resource_type" :label="t('resourceType')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('communicationType')" min-width="180" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in communication_typeList">
<div v-if="item.value == row.communication_type">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column :label="t('communicationResult')" min-width="180" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in communication_resultList">
<div v-if="item.value == row.communication_result">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column prop="communication_time" :label="t('communicationTime')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="remarks" :label="t('remarks')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('tag')" min-width="180" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in tagList">
<div v-if="item.value == row.tag">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="communicationRecordsTable.page" v-model:page-size="communicationRecordsTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="communicationRecordsTable.total"
@size-change="loadCommunicationRecordsList()" @current-change="loadCommunicationRecordsList" />
</div>
</div>
<edit ref="editCommunicationRecordsDialog" @complete="loadCommunicationRecordsList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getCommunicationRecordsList, deleteCommunicationRecords, getWithCustomerResourcesList } from '@/app/api/communication_records'
import { img } from '@/utils/common'
import { ElMessageBox,FormInstance } from 'element-plus'
import Edit from '@/app/views/communication_records/components/communication-records-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title;
let communicationRecordsTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam:{
"resource_id":"",
"communication_type":""
}
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const communication_typeList = ref([] as any[])
const communication_typeDictList = async () => {
communication_typeList.value = await (await useDictionary('communication_type')).data.dictionary
}
communication_typeDictList();
const communication_resultList = ref([] as any[])
const communication_resultDictList = async () => {
communication_resultList.value = await (await useDictionary('communication_result')).data.dictionary
}
communication_resultDictList();
const tagList = ref([] as any[])
const tagDictList = async () => {
tagList.value = await (await useDictionary('tag')).data.dictionary
}
tagDictList();
/**
* 获取沟通记录列表
*/
const loadCommunicationRecordsList = (page: number = 1) => {
communicationRecordsTable.loading = true
communicationRecordsTable.page = page
getCommunicationRecordsList({
page: communicationRecordsTable.page,
limit: communicationRecordsTable.limit,
...communicationRecordsTable.searchParam
}).then(res => {
communicationRecordsTable.loading = false
communicationRecordsTable.data = res.data.data
communicationRecordsTable.total = res.data.total
}).catch(() => {
communicationRecordsTable.loading = false
})
}
loadCommunicationRecordsList()
const editCommunicationRecordsDialog: Record<string, any> | null = ref(null)
/**
* 添加沟通记录
*/
const addEvent = () => {
editCommunicationRecordsDialog.value.setFormData()
editCommunicationRecordsDialog.value.showDialog = true
}
/**
* 编辑沟通记录
* @param data
*/
const editEvent = (data: any) => {
editCommunicationRecordsDialog.value.setFormData(data)
editCommunicationRecordsDialog.value.showDialog = true
}
/**
* 删除沟通记录
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('communicationRecordsDeleteTips'), t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}
).then(() => {
deleteCommunicationRecords(id).then(() => {
loadCommunicationRecordsList()
}).catch(() => {
})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadCommunicationRecordsList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addEvent">
{{ t('addCommunicationRecords') }}
</el-button>
</div>
<el-card
class="box-card !border-none my-[10px] table-search-wrap"
shadow="never"
>
<el-form
:inline="true"
:model="communicationRecordsTable.searchParam"
ref="searchFormRef"
>
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select
class="w-[280px]"
v-model="communicationRecordsTable.searchParam.resource_id"
clearable
:placeholder="t('resourceIdPlaceholder')"
>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item
:label="t('communicationType')"
prop="communication_type"
>
<el-select
class="w-[280px]"
v-model="communicationRecordsTable.searchParam.communication_type"
clearable
:placeholder="t('communicationTypePlaceholder')"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in communication_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadCommunicationRecordsList()">{{
t('search')
}}</el-button>
<el-button @click="resetForm(searchFormRef)">{{
t('reset')
}}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table
:data="communicationRecordsTable.data"
size="large"
v-loading="communicationRecordsTable.loading"
>
<template #empty>
<span>{{
!communicationRecordsTable.loading ? t('emptyData') : ''
}}</span>
</template>
<el-table-column
prop="resource_id_name"
:label="t('resourceId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="resource_type"
:label="t('resourceType')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('communicationType')"
min-width="180"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in communication_typeList">
<div v-if="item.value == row.communication_type">
{{ item.name }}
</div>
</div>
</template>
</el-table-column>
<el-table-column
:label="t('communicationResult')"
min-width="180"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in communication_resultList">
<div v-if="item.value == row.communication_result">
{{ item.name }}
</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="communication_time"
:label="t('communicationTime')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="remarks"
:label="t('remarks')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('tag')"
min-width="180"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in tagList">
<div v-if="item.value == row.tag">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="120"
>
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete')
}}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination
v-model:current-page="communicationRecordsTable.page"
v-model:page-size="communicationRecordsTable.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="communicationRecordsTable.total"
@size-change="loadCommunicationRecordsList()"
@current-change="loadCommunicationRecordsList"
/>
</div>
</div>
<edit
ref="editCommunicationRecordsDialog"
@complete="loadCommunicationRecordsList"
/>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import {
getCommunicationRecordsList,
deleteCommunicationRecords,
getWithCustomerResourcesList,
} from '@/app/api/communication_records'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
import Edit from '@/app/views/communication_records/components/communication-records-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
let communicationRecordsTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
resource_id: '',
communication_type: '',
},
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const communication_typeList = ref([] as any[])
const communication_typeDictList = async () => {
communication_typeList.value = await (
await useDictionary('communication_type')
).data.dictionary
}
communication_typeDictList()
const communication_resultList = ref([] as any[])
const communication_resultDictList = async () => {
communication_resultList.value = await (
await useDictionary('communication_result')
).data.dictionary
}
communication_resultDictList()
const tagList = ref([] as any[])
const tagDictList = async () => {
tagList.value = await (await useDictionary('tag')).data.dictionary
}
tagDictList()
/**
* 获取沟通记录列表
*/
const loadCommunicationRecordsList = (page: number = 1) => {
communicationRecordsTable.loading = true
communicationRecordsTable.page = page
getCommunicationRecordsList({
page: communicationRecordsTable.page,
limit: communicationRecordsTable.limit,
...communicationRecordsTable.searchParam,
})
.then((res) => {
communicationRecordsTable.loading = false
communicationRecordsTable.data = res.data.data
communicationRecordsTable.total = res.data.total
})
.catch(() => {
communicationRecordsTable.loading = false
})
}
loadCommunicationRecordsList()
const editCommunicationRecordsDialog: Record<string, any> | null = ref(null)
/**
* 添加沟通记录
*/
const addEvent = () => {
editCommunicationRecordsDialog.value.setFormData()
editCommunicationRecordsDialog.value.showDialog = true
}
/**
* 编辑沟通记录
* @param data
*/
const editEvent = (data: any) => {
editCommunicationRecordsDialog.value.setFormData(data)
editCommunicationRecordsDialog.value.showDialog = true
}
/**
* 删除沟通记录
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('communicationRecordsDeleteTips'), t('warning'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}).then(() => {
deleteCommunicationRecords(id)
.then(() => {
loadCommunicationRecordsList()
})
.catch(() => {})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadCommunicationRecordsList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

614
admin/src/app/views/communication_records/components/communication-records-edit.vue

@ -1,262 +1,352 @@
<template>
<el-dialog v-model="showDialog" :title="formData.id ? t('updateCommunicationRecords') : t('addCommunicationRecords')" width="50%" class="diy-dialog-wrap" :destroy-on-close="true">
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="input-width" v-model="formData.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('resourceType')" prop="resource_type">
<el-input v-model="formData.resource_type" clearable :placeholder="t('resourceTypePlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('communicationType')" prop="communication_type">
<el-select class="input-width" v-model="formData.communication_type" clearable :placeholder="t('communicationTypePlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in communication_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('communicationResult')" prop="communication_result">
<el-select class="input-width" v-model="formData.communication_result" clearable :placeholder="t('communicationResultPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in communication_resultList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('communicationTime')" prop="communication_time" class="input-width">
<el-date-picker
class="flex-1 !flex"
v-model="formData.communication_time"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="t('communicationTimePlaceholder')">
</el-date-picker>
</el-form-item>
<el-form-item :label="t('remarks')" >
<el-input v-model="formData.remarks" type="textarea" rows="4" clearable :placeholder="t('remarksPlaceholder')" class="input-width"/>
</el-form-item>
<el-form-item :label="t('tag')" >
<el-select class="input-width" v-model="formData.tag" clearable :placeholder="t('tagPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in tagList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{
t('confirm')
}}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import { addCommunicationRecords, editCommunicationRecords, getCommunicationRecordsInfo, getWithCustomerResourcesList } from '@/app/api/communication_records'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
resource_id: '',
resource_type: '',
communication_type: '',
communication_result: '',
communication_time: '',
remarks: '',
tag: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
]
,
resource_type: [
{ required: true, message: t('resourceTypePlaceholder'), trigger: 'blur' },
]
,
communication_type: [
{ required: true, message: t('communicationTypePlaceholder'), trigger: 'blur' },
]
,
communication_result: [
{ required: true, message: t('communicationResultPlaceholder'), trigger: 'blur' },
]
,
communication_time: [
{ required: true, message: t('communicationTimePlaceholder'), trigger: 'blur' },
]
,
remarks: [
{ required: true, message: t('remarksPlaceholder'), trigger: 'blur' },
]
,
tag: [
{ required: true, message: t('tagPlaceholder'), trigger: 'blur' },
]
,
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editCommunicationRecords : addCommunicationRecords
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data).then(res => {
loading.value = false
showDialog.value = false
emit('complete')
}).catch(err => {
loading.value = false
})
}
})
}
//
let communication_typeList = ref([])
const communication_typeDictList = async () => {
communication_typeList.value = await (await useDictionary('communication_type')).data.dictionary
}
communication_typeDictList();
watch(() => communication_typeList.value, () => { formData.communication_type = communication_typeList.value[0].value })
let communication_resultList = ref([])
const communication_resultDictList = async () => {
communication_resultList.value = await (await useDictionary('communication_result')).data.dictionary
}
communication_resultDictList();
watch(() => communication_resultList.value, () => { formData.communication_result = communication_resultList.value[0].value })
let tagList = ref([])
const tagDictList = async () => {
tagList.value = await (await useDictionary('tag')).data.dictionary
}
tagDictList();
watch(() => tagList.value, () => { formData.tag = tagList.value[0].value })
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
if(row){
const data = await (await getCommunicationRecordsInfo(row.id)).data
if (data) Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label{
height: auto !important;
}
</style>
<template>
<el-dialog
v-model="showDialog"
:title="
formData.id
? t('updateCommunicationRecords')
: t('addCommunicationRecords')
"
width="50%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<el-form
:model="formData"
label-width="120px"
ref="formRef"
:rules="formRules"
class="page-form"
v-loading="loading"
>
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select
class="input-width"
v-model="formData.resource_id"
clearable
:placeholder="t('resourceIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('resourceType')" prop="resource_type">
<el-input
v-model="formData.resource_type"
clearable
:placeholder="t('resourceTypePlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('communicationType')" prop="communication_type">
<el-select
class="input-width"
v-model="formData.communication_type"
clearable
:placeholder="t('communicationTypePlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in communication_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item
:label="t('communicationResult')"
prop="communication_result"
>
<el-select
class="input-width"
v-model="formData.communication_result"
clearable
:placeholder="t('communicationResultPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in communication_resultList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item
:label="t('communicationTime')"
prop="communication_time"
class="input-width"
>
<el-date-picker
class="flex-1 !flex"
v-model="formData.communication_time"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="t('communicationTimePlaceholder')"
>
</el-date-picker>
</el-form-item>
<el-form-item :label="t('remarks')">
<el-input
v-model="formData.remarks"
type="textarea"
rows="4"
clearable
:placeholder="t('remarksPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('tag')">
<el-select
class="input-width"
v-model="formData.tag"
clearable
:placeholder="t('tagPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in tagList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button
type="primary"
:loading="loading"
@click="confirm(formRef)"
>{{ t('confirm') }}</el-button
>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import {
addCommunicationRecords,
editCommunicationRecords,
getCommunicationRecordsInfo,
getWithCustomerResourcesList,
} from '@/app/api/communication_records'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
resource_id: '',
resource_type: '',
communication_type: '',
communication_result: '',
communication_time: '',
remarks: '',
tag: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
],
resource_type: [
{
required: true,
message: t('resourceTypePlaceholder'),
trigger: 'blur',
},
],
communication_type: [
{
required: true,
message: t('communicationTypePlaceholder'),
trigger: 'blur',
},
],
communication_result: [
{
required: true,
message: t('communicationResultPlaceholder'),
trigger: 'blur',
},
],
communication_time: [
{
required: true,
message: t('communicationTimePlaceholder'),
trigger: 'blur',
},
],
remarks: [
{ required: true, message: t('remarksPlaceholder'), trigger: 'blur' },
],
tag: [{ required: true, message: t('tagPlaceholder'), trigger: 'blur' }],
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editCommunicationRecords : addCommunicationRecords
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data)
.then((res) => {
loading.value = false
showDialog.value = false
emit('complete')
})
.catch((err) => {
loading.value = false
})
}
})
}
//
let communication_typeList = ref([])
const communication_typeDictList = async () => {
communication_typeList.value = await (
await useDictionary('communication_type')
).data.dictionary
}
communication_typeDictList()
watch(
() => communication_typeList.value,
() => {
formData.communication_type = communication_typeList.value[0].value
}
)
let communication_resultList = ref([])
const communication_resultDictList = async () => {
communication_resultList.value = await (
await useDictionary('communication_result')
).data.dictionary
}
communication_resultDictList()
watch(
() => communication_resultList.value,
() => {
formData.communication_result = communication_resultList.value[0].value
}
)
let tagList = ref([])
const tagDictList = async () => {
tagList.value = await (await useDictionary('tag')).data.dictionary
}
tagDictList()
watch(
() => tagList.value,
() => {
formData.tag = tagList.value[0].value
}
)
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
if (row) {
const data = await (await getCommunicationRecordsInfo(row.id)).data
if (data)
Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (
value &&
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
value
)
) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData,
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label {
height: auto !important;
}
</style>

850
admin/src/app/views/customer_resources/customer_resources.vue

@ -1,368 +1,496 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{pageName}}</span>
<el-button type="primary" @click="addEvent" v-if="customerResourcesTable.searchParam.type == 'khzy'">
{{ t('addCustomerResources') }}
</el-button>
</div>
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="customerResourcesTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('name')" prop="name">
<el-input v-model="customerResourcesTable.searchParam.name"
:placeholder="t('namePlaceholder')" />
</el-form-item>
<el-form-item label="年龄" prop="age">
<el-input v-model="customerResourcesTable.searchParam.age" placeholder="请输入年龄" />
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="customerResourcesTable.searchParam.gender" placeholder="请选择性别">
<el-option label="男性" value="male" />
<el-option label="女性" value="female" />
<el-option label="其他" value="other" />
</el-select>
</el-form-item>
<el-form-item :label="t('phoneNumber')" prop="phone_number">
<el-input v-model="customerResourcesTable.searchParam.phone_number"
:placeholder="t('phoneNumberPlaceholder')" />
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="customerResourcesTable.searchParam.created_at" type="daterange" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" />
</el-form-item>
<!-- 更新时间 -->
<el-form-item label="更新时间">
<el-date-picker v-model="customerResourcesTable.searchParam.updated_at" type="daterange" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadCustomerResourcesList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table :data="customerResourcesTable.data" size="large" v-loading="customerResourcesTable.loading">
<template #empty>
<span>{{ !customerResourcesTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column :label="t('source')" min-width="180" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in sourceList">
<div v-if="item.value == row.source">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column prop="consultant_name" :label="t('consultant')" min-width="120"
:show-overflow-tooltip="true" />
<el-table-column prop="name" :label="t('name')" min-width="120" :show-overflow-tooltip="true" />
<el-table-column prop="age" :label="t('age')" min-width="50" :show-overflow-tooltip="true" />
<el-table-column :label="t('gender')" min-width="60" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in genderList">
<div v-if="item.value == row.gender">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column prop="phone_number" :label="t('phoneNumber')" min-width="120"
:show-overflow-tooltip="true" />
<el-table-column prop="decision_maker" :label="t('decisionMaker')" min-width="120"
:show-overflow-tooltip="true" />
<el-table-column prop="created_at" label="添加时间" min-width="120" :show-overflow-tooltip="true" />
<el-table-column prop="updated_at" label="修改时间" min-width="120" :show-overflow-tooltip="true" />
<el-table-column :label="t('operation')" fixed="right" min-width="200" v-if="customerResourcesTable.searchParam.type == 'khzy'">
<template #default="{ row }">
<el-button type="primary" link @click="modificationLog(row.id)">六要素修改记录</el-button>
<el-button type="primary" link @click="resourceChanges(row.id)">客户信息修改记录</el-button>
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button>
</template>
</el-table-column>
<el-table-column :label="t('operation')" fixed="right" min-width="200"
v-if="customerResourcesTable.searchParam.type == 'yjfp'">
<template #default="{ row }">
<el-button type="primary" link @click="fpEvent(row)">分配</el-button>
</template>
</el-table-column>
<el-table-column :label="t('operation')" fixed="right" min-width="200"
v-if="customerResourcesTable.searchParam.type == 'zylb'">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="addOrder({'resource_id':row.id})">添加订单</el-button>
<el-button type="primary" link @click="tcEvent({'resource_id':row.id})">体测</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="customerResourcesTable.page"
v-model:page-size="customerResourcesTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="customerResourcesTable.total"
@size-change="loadCustomerResourcesList()" @current-change="loadCustomerResourcesList" />
</div>
</div>
<edit ref="editCustomerResourcesDialog" @complete="loadCustomerResourcesList" />
<fp ref="fpCustomerResourcesDialog" @complete="loadCustomerResourcesList" />
<Order ref="editOrderTableDialog" @complete="loadCustomerResourcesList" />
<tc ref="TcCustomerResourcesDialog" @complete="loadCustomerResourcesList" />
</el-card>
</div>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button
type="primary"
@click="addEvent"
v-if="customerResourcesTable.searchParam.type == 'khzy'"
>
{{ t('addCustomerResources') }}
</el-button>
</div>
<el-card
class="box-card !border-none my-[10px] table-search-wrap"
shadow="never"
>
<el-form
:inline="true"
:model="customerResourcesTable.searchParam"
ref="searchFormRef"
>
<el-form-item :label="t('name')" prop="name">
<el-input
v-model="customerResourcesTable.searchParam.name"
:placeholder="t('namePlaceholder')"
/>
</el-form-item>
<el-form-item label="年龄" prop="age">
<el-input
v-model="customerResourcesTable.searchParam.age"
placeholder="请输入年龄"
/>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select
v-model="customerResourcesTable.searchParam.gender"
placeholder="请选择性别"
>
<el-option label="男性" value="male" />
<el-option label="女性" value="female" />
<el-option label="其他" value="other" />
</el-select>
</el-form-item>
<el-form-item :label="t('phoneNumber')" prop="phone_number">
<el-input
v-model="customerResourcesTable.searchParam.phone_number"
:placeholder="t('phoneNumberPlaceholder')"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="customerResourcesTable.searchParam.created_at"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<!-- 更新时间 -->
<el-form-item label="更新时间">
<el-date-picker
v-model="customerResourcesTable.searchParam.updated_at"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadCustomerResourcesList()">{{
t('search')
}}</el-button>
<el-button @click="resetForm(searchFormRef)">{{
t('reset')
}}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table
:data="customerResourcesTable.data"
size="large"
v-loading="customerResourcesTable.loading"
>
<template #empty>
<span>{{
!customerResourcesTable.loading ? t('emptyData') : ''
}}</span>
</template>
<el-table-column
:label="t('source')"
min-width="180"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in sourceList">
<div v-if="item.value == row.source">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="consultant_name"
:label="t('consultant')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="name"
:label="t('name')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="age"
:label="t('age')"
min-width="50"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('gender')"
min-width="60"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in genderList">
<div v-if="item.value == row.gender">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="phone_number"
:label="t('phoneNumber')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="decision_maker"
:label="t('decisionMaker')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="created_at"
label="添加时间"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="updated_at"
label="修改时间"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="200"
v-if="customerResourcesTable.searchParam.type == 'khzy'"
>
<template #default="{ row }">
<el-button type="primary" link @click="modificationLog(row.id)"
>六要素修改记录</el-button
>
<el-button type="primary" link @click="resourceChanges(row.id)"
>客户信息修改记录</el-button
>
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete')
}}</el-button>
</template>
</el-table-column>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="200"
v-if="customerResourcesTable.searchParam.type == 'yjfp'"
>
<template #default="{ row }">
<el-button type="primary" link @click="fpEvent(row)"
>分配</el-button
>
</template>
</el-table-column>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="200"
v-if="customerResourcesTable.searchParam.type == 'zylb'"
>
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<el-button
type="primary"
link
@click="addOrder({ resource_id: row.id })"
>添加订单</el-button
>
<el-button
type="primary"
link
@click="tcEvent({ resource_id: row.id })"
>体测</el-button
>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination
v-model:current-page="customerResourcesTable.page"
v-model:page-size="customerResourcesTable.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="customerResourcesTable.total"
@size-change="loadCustomerResourcesList()"
@current-change="loadCustomerResourcesList"
/>
</div>
</div>
<edit
ref="editCustomerResourcesDialog"
@complete="loadCustomerResourcesList"
/>
<fp
ref="fpCustomerResourcesDialog"
@complete="loadCustomerResourcesList"
/>
<Order ref="editOrderTableDialog" @complete="loadCustomerResourcesList" />
<tc
ref="TcCustomerResourcesDialog"
@complete="loadCustomerResourcesList"
/>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getCustomerResourcesList, deleteCustomerResources, getWithPersonnelList, getWithCampusList } from '@/app/api/customer_resources'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
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 { useRouter, useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title;
const router = useRouter()
let customerResourcesTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
"name": "",
"age": "",
"gender": "",
"phone_number": "",
'type': '',
"created_at" : "",
"updated_at" : ""
}
})
if (pageName == '业绩分配') {
customerResourcesTable.searchParam.type = 'yjfp';
} else if (pageName == '客户资源列表') {
customerResourcesTable.searchParam.type = 'khzy';
} else if (pageName == '资源列表') {
customerResourcesTable.searchParam.type = 'zylb';
}
// const type = pageName == '' ? 'yjfp' : 'khzy';
const modificationLog = (id : number) => {
router.push({ path: '/six_speed_modification_log/six_speed_modification_log', query: { id: id } })
}
const resourceChanges = (id : number) => {
router.push({ path: '/customer_resource_changes/customer_resource_changes', query: { id: id } })
}
/**
* 添加订单
*/
const editOrderTableDialog : Record<string, any> | null = ref(null)
const addOrder = (row : any) => {
console.log(row);
editOrderTableDialog.value.setFormData(row)
editOrderTableDialog.value.showDialog = true
}
const TcCustomerResourcesDialog : Record<string, any> | null = ref(null)
const tcEvent = (row : any) => {
TcCustomerResourcesDialog.value.setFormData(row)
TcCustomerResourcesDialog.value.showDialog = true
}
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const sourceList = ref([] as any[])
const sourceDictList = async () => {
sourceList.value = await (await useDictionary('source')).data.dictionary
}
sourceDictList();
const source_channelList = ref([] as any[])
const source_channelDictList = async () => {
source_channelList.value = await (await useDictionary('SourceChannel')).data.dictionary
}
source_channelDictList();
const genderList = ref([] as any[])
const genderDictList = async () => {
genderList.value = await (await useDictionary('zy_sex')).data.dictionary
}
genderDictList();
const purchasing_powerList = ref([] as any[])
const purchasing_powerDictList = async () => {
purchasing_powerList.value = await (await useDictionary('customer_purchasing_power')).data.dictionary
}
purchasing_powerDictList();
const cognitive_ideaList = ref([] as any[])
const cognitive_ideaDictList = async () => {
cognitive_ideaList.value = await (await useDictionary('cognitive_concept')).data.dictionary
}
cognitive_ideaDictList();
const initial_intentList = ref([] as any[])
const initial_intentDictList = async () => {
initial_intentList.value = await (await useDictionary('preliminarycustomerintention')).data.dictionary
}
initial_intentDictList();
const statusList = ref([] as any[])
const statusDictList = async () => {
statusList.value = await (await useDictionary('kh_status')).data.dictionary
}
statusDictList();
/**
* 获取客户资源列表
*/
const loadCustomerResourcesList = (page : number = 1) => {
customerResourcesTable.loading = true
customerResourcesTable.page = page
getCustomerResourcesList({
page: customerResourcesTable.page,
limit: customerResourcesTable.limit,
...customerResourcesTable.searchParam
}).then(res => {
customerResourcesTable.loading = false
customerResourcesTable.data = res.data.data
customerResourcesTable.total = res.data.total
}).catch(() => {
customerResourcesTable.loading = false
})
}
loadCustomerResourcesList()
const editCustomerResourcesDialog : Record<string, any> | null = ref(null)
const fpCustomerResourcesDialog : Record<string, any> | null = ref(null)
/**
* 添加客户资源
*/
const addEvent = () => {
editCustomerResourcesDialog.value.setFormData()
editCustomerResourcesDialog.value.showDialog = true
}
/**
* 编辑客户资源
* @param data
*/
const editEvent = (data : any) => {
editCustomerResourcesDialog.value.setFormData(data)
editCustomerResourcesDialog.value.showDialog = true
}
const fpEvent = (data : any) => {
fpCustomerResourcesDialog.value.setFormData(data)
fpCustomerResourcesDialog.value.showDialog = true
}
/**
* 删除客户资源
*/
const deleteEvent = (id : number) => {
ElMessageBox.confirm(t('customerResourcesDeleteTips'), t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}
).then(() => {
deleteCustomerResources(id).then(() => {
loadCustomerResourcesList()
}).catch(() => {
})
})
}
const consultantList = ref([])
const setConsultantList = async () => {
consultantList.value = await (await getWithPersonnelList({})).data
}
setConsultantList()
const campusList = ref([])
const setCampusList = async () => {
campusList.value = await (await getWithCampusList({})).data
}
setCampusList()
const resetForm = (formEl : FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadCustomerResourcesList()
}
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import {
getCustomerResourcesList,
deleteCustomerResources,
getWithPersonnelList,
getWithCampusList,
} from '@/app/api/customer_resources'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
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 { useRouter, useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
const router = useRouter()
let customerResourcesTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
name: '',
age: '',
gender: '',
phone_number: '',
type: '',
created_at: '',
updated_at: '',
},
})
if (pageName == '业绩分配') {
customerResourcesTable.searchParam.type = 'yjfp'
} else if (pageName == '客户资源列表') {
customerResourcesTable.searchParam.type = 'khzy'
} else if (pageName == '资源列表') {
customerResourcesTable.searchParam.type = 'zylb'
}
// const type = pageName == '' ? 'yjfp' : 'khzy';
const modificationLog = (id: number) => {
router.push({
path: '/six_speed_modification_log/six_speed_modification_log',
query: { id: id },
})
}
const resourceChanges = (id: number) => {
router.push({
path: '/customer_resource_changes/customer_resource_changes',
query: { id: id },
})
}
/**
* 添加订单
*/
const editOrderTableDialog: Record<string, any> | null = ref(null)
const addOrder = (row: any) => {
console.log(row)
editOrderTableDialog.value.setFormData(row)
editOrderTableDialog.value.showDialog = true
}
const TcCustomerResourcesDialog: Record<string, any> | null = ref(null)
const tcEvent = (row: any) => {
TcCustomerResourcesDialog.value.setFormData(row)
TcCustomerResourcesDialog.value.showDialog = true
}
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const sourceList = ref([] as any[])
const sourceDictList = async () => {
sourceList.value = await (await useDictionary('source')).data.dictionary
}
sourceDictList()
const source_channelList = ref([] as any[])
const source_channelDictList = async () => {
source_channelList.value = await (
await useDictionary('SourceChannel')
).data.dictionary
}
source_channelDictList()
const genderList = ref([] as any[])
const genderDictList = async () => {
genderList.value = await (await useDictionary('zy_sex')).data.dictionary
}
genderDictList()
const purchasing_powerList = ref([] as any[])
const purchasing_powerDictList = async () => {
purchasing_powerList.value = await (
await useDictionary('customer_purchasing_power')
).data.dictionary
}
purchasing_powerDictList()
const cognitive_ideaList = ref([] as any[])
const cognitive_ideaDictList = async () => {
cognitive_ideaList.value = await (
await useDictionary('cognitive_concept')
).data.dictionary
}
cognitive_ideaDictList()
const initial_intentList = ref([] as any[])
const initial_intentDictList = async () => {
initial_intentList.value = await (
await useDictionary('preliminarycustomerintention')
).data.dictionary
}
initial_intentDictList()
const statusList = ref([] as any[])
const statusDictList = async () => {
statusList.value = await (await useDictionary('kh_status')).data.dictionary
}
statusDictList()
/**
* 获取客户资源列表
*/
const loadCustomerResourcesList = (page: number = 1) => {
customerResourcesTable.loading = true
customerResourcesTable.page = page
getCustomerResourcesList({
page: customerResourcesTable.page,
limit: customerResourcesTable.limit,
...customerResourcesTable.searchParam,
})
.then((res) => {
customerResourcesTable.loading = false
customerResourcesTable.data = res.data.data
customerResourcesTable.total = res.data.total
})
.catch(() => {
customerResourcesTable.loading = false
})
}
loadCustomerResourcesList()
const editCustomerResourcesDialog: Record<string, any> | null = ref(null)
const fpCustomerResourcesDialog: Record<string, any> | null = ref(null)
/**
* 添加客户资源
*/
const addEvent = () => {
editCustomerResourcesDialog.value.setFormData()
editCustomerResourcesDialog.value.showDialog = true
}
/**
* 编辑客户资源
* @param data
*/
const editEvent = (data: any) => {
editCustomerResourcesDialog.value.setFormData(data)
editCustomerResourcesDialog.value.showDialog = true
}
const fpEvent = (data: any) => {
fpCustomerResourcesDialog.value.setFormData(data)
fpCustomerResourcesDialog.value.showDialog = true
}
/**
* 删除客户资源
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('customerResourcesDeleteTips'), t('warning'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}).then(() => {
deleteCustomerResources(id)
.then(() => {
loadCustomerResourcesList()
})
.catch(() => {})
})
}
const consultantList = ref([])
const setConsultantList = async () => {
consultantList.value = await (await getWithPersonnelList({})).data
}
setConsultantList()
const campusList = ref([])
const setCampusList = async () => {
campusList.value = await (await getWithCampusList({})).data
}
setCampusList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadCustomerResourcesList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

595
admin/src/app/views/order_table/components/order-table-edit.vue

@ -1,267 +1,328 @@
<template>
<el-dialog v-model="showDialog" :title="formData.id ? t('updateOrderTable') : t('addOrderTable')" width="50%" class="diy-dialog-wrap" :destroy-on-close="true">
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="input-width" v-model="formData.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('orderStatus')" prop="order_status">
<el-select class="input-width" v-model="formData.order_status" clearable :placeholder="t('orderStatusPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in order_statusList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('paymentType')" prop="payment_type">
<el-select class="input-width" v-model="formData.payment_type" clearable :placeholder="t('paymentTypePlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in payment_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('orderAmount')" prop="order_amount">
<el-input v-model="formData.order_amount" clearable :placeholder="t('orderAmountPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('courseId')" prop="course_id">
<el-select class="input-width" v-model="formData.course_id" clearable :placeholder="t('courseIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in courseIdList"
:key="index"
:label="item['course_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('classId')" prop="class_id">
<el-select class="input-width" v-model="formData.class_id" clearable :placeholder="t('classIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in classIdList"
:key="index"
:label="item['class_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{
t('confirm')
}}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import { addOrderTable, editOrderTable, getOrderTableInfo, getWithCustomerResourcesList, getWithCourseList, getWithClassGradeList, getWithPersonnelList } from '@/app/api/order_table'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
resource_id: '',
order_status: '',
payment_type: '',
order_amount: '',
course_id: '',
class_id: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
]
,
order_status: [
{ required: true, message: t('orderStatusPlaceholder'), trigger: 'blur' },
]
,
payment_type: [
{ required: true, message: t('paymentTypePlaceholder'), trigger: 'blur' },
]
,
order_amount: [
{ required: true, message: t('orderAmountPlaceholder'), trigger: 'blur' },
]
,
course_id: [
{ required: true, message: t('courseIdPlaceholder'), trigger: 'blur' },
]
,
class_id: [
{ required: true, message: t('classIdPlaceholder'), trigger: 'blur' },
]
,
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editOrderTable : addOrderTable
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data).then(res => {
loading.value = false
showDialog.value = false
emit('complete')
}).catch(err => {
loading.value = false
})
}
})
}
//
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
}
payment_typeDictList();
watch(() => payment_typeList.value, () => { formData.payment_type = payment_typeList.value[0].value })
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const courseIdList = ref([] as any[])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const classIdList = ref([] as any[])
const setClassIdList = async () => {
classIdList.value = await (await getWithClassGradeList({})).data
}
setClassIdList()
const staffIdList = ref([] as any[])
const setStaffIdList = async () => {
staffIdList.value = await (await getWithPersonnelList({})).data
}
setStaffIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
Object.assign(formData, row)
// formData.resource_id = row.resource_id;
// console.log(0)
// loading.value = true
// if(row){
// const data = await (await getOrderTableInfo(row.id)).data
// if (data) Object.keys(formData).forEach((key: string) => {
// if (data[key] != undefined) formData[key] = data[key]
// })
// }
// loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label{
height: auto !important;
}
</style>
<template>
<el-dialog
v-model="showDialog"
:title="formData.id ? t('updateOrderTable') : t('addOrderTable')"
width="50%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<el-form
:model="formData"
label-width="120px"
ref="formRef"
:rules="formRules"
class="page-form"
v-loading="loading"
>
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select
class="input-width"
v-model="formData.resource_id"
clearable
:placeholder="t('resourceIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('orderStatus')" prop="order_status">
<el-select
class="input-width"
v-model="formData.order_status"
clearable
:placeholder="t('orderStatusPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in order_statusList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('paymentType')" prop="payment_type">
<el-select
class="input-width"
v-model="formData.payment_type"
clearable
:placeholder="t('paymentTypePlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in payment_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('orderAmount')" prop="order_amount">
<el-input
v-model="formData.order_amount"
clearable
:placeholder="t('orderAmountPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('courseId')" prop="course_id">
<el-select
class="input-width"
v-model="formData.course_id"
clearable
:placeholder="t('courseIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in courseIdList"
:key="index"
:label="item['course_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('classId')" prop="class_id">
<el-select
class="input-width"
v-model="formData.class_id"
clearable
:placeholder="t('classIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in classIdList"
:key="index"
:label="item['class_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button
type="primary"
:loading="loading"
@click="confirm(formRef)"
>{{ t('confirm') }}</el-button
>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import {
addOrderTable,
editOrderTable,
getOrderTableInfo,
getWithCustomerResourcesList,
getWithCourseList,
getWithClassGradeList,
getWithPersonnelList,
} from '@/app/api/order_table'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
resource_id: '',
order_status: '',
payment_type: '',
order_amount: '',
course_id: '',
class_id: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
],
order_status: [
{ required: true, message: t('orderStatusPlaceholder'), trigger: 'blur' },
],
payment_type: [
{ required: true, message: t('paymentTypePlaceholder'), trigger: 'blur' },
],
order_amount: [
{ required: true, message: t('orderAmountPlaceholder'), trigger: 'blur' },
],
course_id: [
{ required: true, message: t('courseIdPlaceholder'), trigger: 'blur' },
],
class_id: [
{ required: true, message: t('classIdPlaceholder'), trigger: 'blur' },
],
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editOrderTable : addOrderTable
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data)
.then((res) => {
loading.value = false
showDialog.value = false
emit('complete')
})
.catch((err) => {
loading.value = false
})
}
})
}
//
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
}
payment_typeDictList()
watch(
() => payment_typeList.value,
() => {
formData.payment_type = payment_typeList.value[0].value
}
)
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const courseIdList = ref([] as any[])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const classIdList = ref([] as any[])
const setClassIdList = async () => {
classIdList.value = await (await getWithClassGradeList({})).data
}
setClassIdList()
const staffIdList = ref([] as any[])
const setStaffIdList = async () => {
staffIdList.value = await (await getWithPersonnelList({})).data
}
setStaffIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
Object.assign(formData, row)
// formData.resource_id = row.resource_id;
// console.log(0)
// loading.value = true
// if(row){
// const data = await (await getOrderTableInfo(row.id)).data
// if (data) Object.keys(formData).forEach((key: string) => {
// if (data[key] != undefined) formData[key] = data[key]
// })
// }
// loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (
value &&
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
value
)
) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData,
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label {
height: auto !important;
}
</style>

561
admin/src/app/views/order_table/order_table.vue

@ -1,238 +1,323 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{pageName}}</span>
<el-button type="primary" @click="addEvent">
{{ t('addOrderTable') }}
</el-button>
</div>
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="orderTableTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('orderStatus')" prop="order_status">
<el-select class="w-[280px]" v-model="orderTableTable.searchParam.order_status" clearable :placeholder="t('orderStatusPlaceholder')">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in order_statusList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('paymentType')" prop="payment_type">
<el-select class="w-[280px]" v-model="orderTableTable.searchParam.payment_type" clearable :placeholder="t('paymentTypePlaceholder')">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in payment_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadOrderTableList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table :data="orderTableTable.data" size="large" v-loading="orderTableTable.loading">
<template #empty>
<span>{{ !orderTableTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('orderStatus')" min-width="180" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in order_statusList">
<div v-if="item.value == row.order_status">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column :label="t('paymentType')" min-width="180" align="center" :show-overflow-tooltip="true">
<template #default="{ row }">
<div v-for="(item, index) in payment_typeList">
<div v-if="item.value == row.payment_type">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column prop="order_amount" :label="t('orderAmount')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="course_id_name" :label="t('courseId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="class_id_name" :label="t('classId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="staff_id_name" :label="t('staffId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="payment_time" :label="t('paymentTime')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="orderTableTable.page" v-model:page-size="orderTableTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="orderTableTable.total"
@size-change="loadOrderTableList()" @current-change="loadOrderTableList" />
</div>
</div>
<edit ref="editOrderTableDialog" @complete="loadOrderTableList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getOrderTableList, deleteOrderTable, getWithCustomerResourcesList, getWithCourseList, getWithClassGradeList, getWithPersonnelList } from '@/app/api/order_table'
import { img } from '@/utils/common'
import { ElMessageBox,FormInstance } from 'element-plus'
import Edit from '@/app/views/order_table/components/order-table-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title;
let orderTableTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam:{
"order_status":"",
"payment_type":""
}
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const order_statusList = ref([] as any[])
const order_statusDictList = async () => {
order_statusList.value = await (await useDictionary('order_status')).data.dictionary
}
order_statusDictList();
const payment_typeList = ref([] as any[])
const payment_typeDictList = async () => {
payment_typeList.value = await (await useDictionary('payment_type')).data.dictionary
}
payment_typeDictList();
/**
* 获取订单列表
*/
const loadOrderTableList = (page: number = 1) => {
orderTableTable.loading = true
orderTableTable.page = page
getOrderTableList({
page: orderTableTable.page,
limit: orderTableTable.limit,
...orderTableTable.searchParam
}).then(res => {
orderTableTable.loading = false
orderTableTable.data = res.data.data
orderTableTable.total = res.data.total
}).catch(() => {
orderTableTable.loading = false
})
}
loadOrderTableList()
const editOrderTableDialog: Record<string, any> | null = ref(null)
/**
* 添加订单
*/
const addEvent = () => {
editOrderTableDialog.value.setFormData()
editOrderTableDialog.value.showDialog = true
}
/**
* 编辑订单
* @param data
*/
const editEvent = (data: any) => {
editOrderTableDialog.value.setFormData(data)
editOrderTableDialog.value.showDialog = true
}
/**
* 删除订单
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('orderTableDeleteTips'), t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}
).then(() => {
deleteOrderTable(id).then(() => {
loadOrderTableList()
}).catch(() => {
})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const courseIdList = ref([])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const classIdList = ref([])
const setClassIdList = async () => {
classIdList.value = await (await getWithClassGradeList({})).data
}
setClassIdList()
const staffIdList = ref([])
const setStaffIdList = async () => {
staffIdList.value = await (await getWithPersonnelList({})).data
}
setStaffIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadOrderTableList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addEvent">
{{ t('addOrderTable') }}
</el-button>
</div>
<el-card
class="box-card !border-none my-[10px] table-search-wrap"
shadow="never"
>
<el-form
:inline="true"
:model="orderTableTable.searchParam"
ref="searchFormRef"
>
<el-form-item :label="t('orderStatus')" prop="order_status">
<el-select
class="w-[280px]"
v-model="orderTableTable.searchParam.order_status"
clearable
:placeholder="t('orderStatusPlaceholder')"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in order_statusList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('paymentType')" prop="payment_type">
<el-select
class="w-[280px]"
v-model="orderTableTable.searchParam.payment_type"
clearable
:placeholder="t('paymentTypePlaceholder')"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in payment_typeList"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadOrderTableList()">{{
t('search')
}}</el-button>
<el-button @click="resetForm(searchFormRef)">{{
t('reset')
}}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table
:data="orderTableTable.data"
size="large"
v-loading="orderTableTable.loading"
>
<template #empty>
<span>{{ !orderTableTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column
prop="resource_id_name"
:label="t('resourceId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('orderStatus')"
min-width="180"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in order_statusList">
<div v-if="item.value == row.order_status">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column
:label="t('paymentType')"
min-width="180"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row }">
<div v-for="(item, index) in payment_typeList">
<div v-if="item.value == row.payment_type">{{ item.name }}</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="order_amount"
:label="t('orderAmount')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="course_id_name"
:label="t('courseId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="class_id_name"
:label="t('classId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="staff_id_name"
:label="t('staffId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="payment_time"
:label="t('paymentTime')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="120"
>
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete')
}}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination
v-model:current-page="orderTableTable.page"
v-model:page-size="orderTableTable.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="orderTableTable.total"
@size-change="loadOrderTableList()"
@current-change="loadOrderTableList"
/>
</div>
</div>
<edit ref="editOrderTableDialog" @complete="loadOrderTableList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import {
getOrderTableList,
deleteOrderTable,
getWithCustomerResourcesList,
getWithCourseList,
getWithClassGradeList,
getWithPersonnelList,
} from '@/app/api/order_table'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
import Edit from '@/app/views/order_table/components/order-table-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
let orderTableTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
order_status: '',
payment_type: '',
},
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const order_statusList = ref([] as any[])
const order_statusDictList = async () => {
order_statusList.value = await (
await useDictionary('order_status')
).data.dictionary
}
order_statusDictList()
const payment_typeList = ref([] as any[])
const payment_typeDictList = async () => {
payment_typeList.value = await (
await useDictionary('payment_type')
).data.dictionary
}
payment_typeDictList()
/**
* 获取订单列表
*/
const loadOrderTableList = (page: number = 1) => {
orderTableTable.loading = true
orderTableTable.page = page
getOrderTableList({
page: orderTableTable.page,
limit: orderTableTable.limit,
...orderTableTable.searchParam,
})
.then((res) => {
orderTableTable.loading = false
orderTableTable.data = res.data.data
orderTableTable.total = res.data.total
})
.catch(() => {
orderTableTable.loading = false
})
}
loadOrderTableList()
const editOrderTableDialog: Record<string, any> | null = ref(null)
/**
* 添加订单
*/
const addEvent = () => {
editOrderTableDialog.value.setFormData()
editOrderTableDialog.value.showDialog = true
}
/**
* 编辑订单
* @param data
*/
const editEvent = (data: any) => {
editOrderTableDialog.value.setFormData(data)
editOrderTableDialog.value.showDialog = true
}
/**
* 删除订单
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('orderTableDeleteTips'), t('warning'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}).then(() => {
deleteOrderTable(id)
.then(() => {
loadOrderTableList()
})
.catch(() => {})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const courseIdList = ref([])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const classIdList = ref([])
const setClassIdList = async () => {
classIdList.value = await (await getWithClassGradeList({})).data
}
setClassIdList()
const staffIdList = ref([])
const setStaffIdList = async () => {
staffIdList.value = await (await getWithPersonnelList({})).data
}
setStaffIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadOrderTableList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

740
admin/src/app/views/physical_test/components/physical-test-edit.vue

@ -1,324 +1,416 @@
<template>
<el-dialog v-model="showDialog" :title="formData.id ? t('updatePhysicalTest') : t('addPhysicalTest')" width="50%" class="diy-dialog-wrap" :destroy-on-close="true">
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="input-width" v-model="formData.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="input-width" v-model="formData.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('height')" prop="height">
<el-input v-model="formData.height" clearable :placeholder="t('heightPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('weight')" prop="weight">
<el-input v-model="formData.weight" clearable :placeholder="t('weightPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('coachId')" prop="coach_id">
<el-select class="input-width" v-model="formData.coach_id" clearable :placeholder="t('coachIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in coachIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('seatedForwardBend')" >
<el-input v-model="formData.seated_forward_bend" clearable :placeholder="t('seatedForwardBendPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('sitUps')" >
<el-input v-model="formData.sit_ups" clearable :placeholder="t('sitUpsPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('pushUps')" >
<el-input v-model="formData.push_ups" clearable :placeholder="t('pushUpsPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('flamingoBalance')" >
<el-input v-model="formData.flamingo_balance" clearable :placeholder="t('flamingoBalancePlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('thirtySecJump')" >
<el-input v-model="formData.thirty_sec_jump" clearable :placeholder="t('thirtySecJumpPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('standingLongJump')" >
<el-input v-model="formData.standing_long_jump" clearable :placeholder="t('standingLongJumpPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('agilityRun')" >
<el-input v-model="formData.agility_run" clearable :placeholder="t('agilityRunPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('balanceBeam')" >
<el-input v-model="formData.balance_beam" clearable :placeholder="t('balanceBeamPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('tennisThrow')" >
<el-input v-model="formData.tennis_throw" clearable :placeholder="t('tennisThrowPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('tenMeterShuttleRun')" >
<el-input v-model="formData.ten_meter_shuttle_run" clearable :placeholder="t('tenMeterShuttleRunPlaceholder')" class="input-width" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{
t('confirm')
}}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import { addPhysicalTest, editPhysicalTest, getPhysicalTestInfo, getWithCustomerResourcesList, getWithStudentList, getWithPersonnelList } from '@/app/api/physical_test'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
resource_id: '',
student_id: '',
height: '',
weight: '',
coach_id: '',
seated_forward_bend: '',
sit_ups: '',
push_ups: '',
flamingo_balance: '',
thirty_sec_jump: '',
standing_long_jump: '',
agility_run: '',
balance_beam: '',
tennis_throw: '',
ten_meter_shuttle_run: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
]
,
student_id: [
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' },
]
,
height: [
{ required: true, message: t('heightPlaceholder'), trigger: 'blur' },
]
,
weight: [
{ required: true, message: t('weightPlaceholder'), trigger: 'blur' },
]
,
coach_id: [
{ required: true, message: t('coachIdPlaceholder'), trigger: 'blur' },
]
,
seated_forward_bend: [
{ required: true, message: t('seatedForwardBendPlaceholder'), trigger: 'blur' },
]
,
sit_ups: [
{ required: true, message: t('sitUpsPlaceholder'), trigger: 'blur' },
]
,
push_ups: [
{ required: true, message: t('pushUpsPlaceholder'), trigger: 'blur' },
]
,
flamingo_balance: [
{ required: true, message: t('flamingoBalancePlaceholder'), trigger: 'blur' },
]
,
thirty_sec_jump: [
{ required: true, message: t('thirtySecJumpPlaceholder'), trigger: 'blur' },
]
,
standing_long_jump: [
{ required: true, message: t('standingLongJumpPlaceholder'), trigger: 'blur' },
]
,
agility_run: [
{ required: true, message: t('agilityRunPlaceholder'), trigger: 'blur' },
]
,
balance_beam: [
{ required: true, message: t('balanceBeamPlaceholder'), trigger: 'blur' },
]
,
tennis_throw: [
{ required: true, message: t('tennisThrowPlaceholder'), trigger: 'blur' },
]
,
ten_meter_shuttle_run: [
{ required: true, message: t('tenMeterShuttleRunPlaceholder'), trigger: 'blur' },
]
,
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editPhysicalTest : addPhysicalTest
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data).then(res => {
loading.value = false
showDialog.value = false
emit('complete')
}).catch(err => {
loading.value = false
})
}
})
}
//
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([] as any[])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([] as any[])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
Object.assign(formData, row)
// if(row){
// const data = await (await getPhysicalTestInfo(row.id)).data
// if (data) Object.keys(formData).forEach((key: string) => {
// if (data[key] != undefined) formData[key] = data[key]
// })
// }
loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label{
height: auto !important;
}
</style>
<template>
<el-dialog
v-model="showDialog"
:title="formData.id ? t('updatePhysicalTest') : t('addPhysicalTest')"
width="50%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<el-form
:model="formData"
label-width="120px"
ref="formRef"
:rules="formRules"
class="page-form"
v-loading="loading"
>
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select
class="input-width"
v-model="formData.resource_id"
clearable
:placeholder="t('resourceIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select
class="input-width"
v-model="formData.student_id"
clearable
:placeholder="t('studentIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('height')" prop="height">
<el-input
v-model="formData.height"
clearable
:placeholder="t('heightPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('weight')" prop="weight">
<el-input
v-model="formData.weight"
clearable
:placeholder="t('weightPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('coachId')" prop="coach_id">
<el-select
class="input-width"
v-model="formData.coach_id"
clearable
:placeholder="t('coachIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in coachIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('seatedForwardBend')">
<el-input
v-model="formData.seated_forward_bend"
clearable
:placeholder="t('seatedForwardBendPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('sitUps')">
<el-input
v-model="formData.sit_ups"
clearable
:placeholder="t('sitUpsPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('pushUps')">
<el-input
v-model="formData.push_ups"
clearable
:placeholder="t('pushUpsPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('flamingoBalance')">
<el-input
v-model="formData.flamingo_balance"
clearable
:placeholder="t('flamingoBalancePlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('thirtySecJump')">
<el-input
v-model="formData.thirty_sec_jump"
clearable
:placeholder="t('thirtySecJumpPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('standingLongJump')">
<el-input
v-model="formData.standing_long_jump"
clearable
:placeholder="t('standingLongJumpPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('agilityRun')">
<el-input
v-model="formData.agility_run"
clearable
:placeholder="t('agilityRunPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('balanceBeam')">
<el-input
v-model="formData.balance_beam"
clearable
:placeholder="t('balanceBeamPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('tennisThrow')">
<el-input
v-model="formData.tennis_throw"
clearable
:placeholder="t('tennisThrowPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('tenMeterShuttleRun')">
<el-input
v-model="formData.ten_meter_shuttle_run"
clearable
:placeholder="t('tenMeterShuttleRunPlaceholder')"
class="input-width"
/>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button
type="primary"
:loading="loading"
@click="confirm(formRef)"
>{{ t('confirm') }}</el-button
>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import {
addPhysicalTest,
editPhysicalTest,
getPhysicalTestInfo,
getWithCustomerResourcesList,
getWithStudentList,
getWithPersonnelList,
} from '@/app/api/physical_test'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
resource_id: '',
student_id: '',
height: '',
weight: '',
coach_id: '',
seated_forward_bend: '',
sit_ups: '',
push_ups: '',
flamingo_balance: '',
thirty_sec_jump: '',
standing_long_jump: '',
agility_run: '',
balance_beam: '',
tennis_throw: '',
ten_meter_shuttle_run: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
],
student_id: [
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' },
],
height: [
{ required: true, message: t('heightPlaceholder'), trigger: 'blur' },
],
weight: [
{ required: true, message: t('weightPlaceholder'), trigger: 'blur' },
],
coach_id: [
{ required: true, message: t('coachIdPlaceholder'), trigger: 'blur' },
],
seated_forward_bend: [
{
required: true,
message: t('seatedForwardBendPlaceholder'),
trigger: 'blur',
},
],
sit_ups: [
{ required: true, message: t('sitUpsPlaceholder'), trigger: 'blur' },
],
push_ups: [
{ required: true, message: t('pushUpsPlaceholder'), trigger: 'blur' },
],
flamingo_balance: [
{
required: true,
message: t('flamingoBalancePlaceholder'),
trigger: 'blur',
},
],
thirty_sec_jump: [
{
required: true,
message: t('thirtySecJumpPlaceholder'),
trigger: 'blur',
},
],
standing_long_jump: [
{
required: true,
message: t('standingLongJumpPlaceholder'),
trigger: 'blur',
},
],
agility_run: [
{ required: true, message: t('agilityRunPlaceholder'), trigger: 'blur' },
],
balance_beam: [
{ required: true, message: t('balanceBeamPlaceholder'), trigger: 'blur' },
],
tennis_throw: [
{ required: true, message: t('tennisThrowPlaceholder'), trigger: 'blur' },
],
ten_meter_shuttle_run: [
{
required: true,
message: t('tenMeterShuttleRunPlaceholder'),
trigger: 'blur',
},
],
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editPhysicalTest : addPhysicalTest
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data)
.then((res) => {
loading.value = false
showDialog.value = false
emit('complete')
})
.catch((err) => {
loading.value = false
})
}
})
}
//
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([] as any[])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([] as any[])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
Object.assign(formData, row)
// if(row){
// const data = await (await getPhysicalTestInfo(row.id)).data
// if (data) Object.keys(formData).forEach((key: string) => {
// if (data[key] != undefined) formData[key] = data[key]
// })
// }
loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (
value &&
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
value
)
) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData,
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label {
height: auto !important;
}
</style>

472
admin/src/app/views/physical_test/physical_test.vue

@ -1,204 +1,268 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{pageName}}</span>
<el-button type="primary" @click="addEvent">
{{ t('addPhysicalTest') }}
</el-button>
</div>
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="physicalTestTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="w-[280px]" v-model="physicalTestTable.searchParam.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="w-[280px]" v-model="physicalTestTable.searchParam.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadPhysicalTestList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table :data="physicalTestTable.data" size="large" v-loading="physicalTestTable.loading">
<template #empty>
<span>{{ !physicalTestTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="student_id_name" :label="t('studentId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="height" :label="t('height')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="weight" :label="t('weight')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="coach_id_name" :label="t('coachId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="physicalTestTable.page" v-model:page-size="physicalTestTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="physicalTestTable.total"
@size-change="loadPhysicalTestList()" @current-change="loadPhysicalTestList" />
</div>
</div>
<edit ref="editPhysicalTestDialog" @complete="loadPhysicalTestList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getPhysicalTestList, deletePhysicalTest, getWithCustomerResourcesList, getWithStudentList, getWithPersonnelList } from '@/app/api/physical_test'
import { img } from '@/utils/common'
import { ElMessageBox,FormInstance } from 'element-plus'
import Edit from '@/app/views/physical_test/components/physical-test-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title;
let physicalTestTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam:{
"resource_id":"",
"student_id":""
}
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
/**
* 获取体测列表
*/
const loadPhysicalTestList = (page: number = 1) => {
physicalTestTable.loading = true
physicalTestTable.page = page
getPhysicalTestList({
page: physicalTestTable.page,
limit: physicalTestTable.limit,
...physicalTestTable.searchParam
}).then(res => {
physicalTestTable.loading = false
physicalTestTable.data = res.data.data
physicalTestTable.total = res.data.total
}).catch(() => {
physicalTestTable.loading = false
})
}
loadPhysicalTestList()
const editPhysicalTestDialog: Record<string, any> | null = ref(null)
/**
* 添加体测
*/
const addEvent = () => {
editPhysicalTestDialog.value.setFormData()
editPhysicalTestDialog.value.showDialog = true
}
/**
* 编辑体测
* @param data
*/
const editEvent = (data: any) => {
editPhysicalTestDialog.value.setFormData(data)
editPhysicalTestDialog.value.showDialog = true
}
/**
* 删除体测
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('physicalTestDeleteTips'), t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}
).then(() => {
deletePhysicalTest(id).then(() => {
loadPhysicalTestList()
}).catch(() => {
})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadPhysicalTestList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addEvent">
{{ t('addPhysicalTest') }}
</el-button>
</div>
<el-card
class="box-card !border-none my-[10px] table-search-wrap"
shadow="never"
>
<el-form
:inline="true"
:model="physicalTestTable.searchParam"
ref="searchFormRef"
>
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select
class="w-[280px]"
v-model="physicalTestTable.searchParam.resource_id"
clearable
:placeholder="t('resourceIdPlaceholder')"
>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select
class="w-[280px]"
v-model="physicalTestTable.searchParam.student_id"
clearable
:placeholder="t('studentIdPlaceholder')"
>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadPhysicalTestList()">{{
t('search')
}}</el-button>
<el-button @click="resetForm(searchFormRef)">{{
t('reset')
}}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table
:data="physicalTestTable.data"
size="large"
v-loading="physicalTestTable.loading"
>
<template #empty>
<span>{{ !physicalTestTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column
prop="resource_id_name"
:label="t('resourceId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="student_id_name"
:label="t('studentId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="height"
:label="t('height')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="weight"
:label="t('weight')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="coach_id_name"
:label="t('coachId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="120"
>
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete')
}}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination
v-model:current-page="physicalTestTable.page"
v-model:page-size="physicalTestTable.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="physicalTestTable.total"
@size-change="loadPhysicalTestList()"
@current-change="loadPhysicalTestList"
/>
</div>
</div>
<edit ref="editPhysicalTestDialog" @complete="loadPhysicalTestList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import {
getPhysicalTestList,
deletePhysicalTest,
getWithCustomerResourcesList,
getWithStudentList,
getWithPersonnelList,
} from '@/app/api/physical_test'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
import Edit from '@/app/views/physical_test/components/physical-test-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
let physicalTestTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
resource_id: '',
student_id: '',
},
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
/**
* 获取体测列表
*/
const loadPhysicalTestList = (page: number = 1) => {
physicalTestTable.loading = true
physicalTestTable.page = page
getPhysicalTestList({
page: physicalTestTable.page,
limit: physicalTestTable.limit,
...physicalTestTable.searchParam,
})
.then((res) => {
physicalTestTable.loading = false
physicalTestTable.data = res.data.data
physicalTestTable.total = res.data.total
})
.catch(() => {
physicalTestTable.loading = false
})
}
loadPhysicalTestList()
const editPhysicalTestDialog: Record<string, any> | null = ref(null)
/**
* 添加体测
*/
const addEvent = () => {
editPhysicalTestDialog.value.setFormData()
editPhysicalTestDialog.value.showDialog = true
}
/**
* 编辑体测
* @param data
*/
const editEvent = (data: any) => {
editPhysicalTestDialog.value.setFormData(data)
editPhysicalTestDialog.value.showDialog = true
}
/**
* 删除体测
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('physicalTestDeleteTips'), t('warning'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}).then(() => {
deletePhysicalTest(id)
.then(() => {
loadPhysicalTestList()
})
.catch(() => {})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadPhysicalTestList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

764
admin/src/app/views/physical_test/physical_test_edit.vue

@ -1,339 +1,425 @@
<template>
<div class="main-container">
<div class="detail-head">
<div class="left" @click="back()">
<span class="iconfont iconxiangzuojiantou !text-xs"></span>
<span class="ml-[1px]">{{t('returnToPreviousPage')}}</span>
</div>
<span class="adorn">|</span>
<span class="right">{{ pageName }}</span>
</div>
<el-card class="box-card !border-none" shadow="never">
<el-form :model="formData" label-width="90px" ref="formRef" :rules="formRules" class="page-form">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="input-width" v-model="formData.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="input-width" v-model="formData.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('height')" prop="height">
<el-input v-model="formData.height" clearable :placeholder="t('heightPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('weight')" prop="weight">
<el-input v-model="formData.weight" clearable :placeholder="t('weightPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('coachId')" prop="coach_id">
<el-select class="input-width" v-model="formData.coach_id" clearable :placeholder="t('coachIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in coachIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('createdAt')" >
<el-input v-model="formData.created_at" clearable :placeholder="t('createdAtPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('updatedAt')" >
<el-input v-model="formData.updated_at" clearable :placeholder="t('updatedAtPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('seatedForwardBend')" >
<el-input v-model="formData.seated_forward_bend" clearable :placeholder="t('seatedForwardBendPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('sitUps')" >
<el-input v-model="formData.sit_ups" clearable :placeholder="t('sitUpsPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('pushUps')" >
<el-input v-model="formData.push_ups" clearable :placeholder="t('pushUpsPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('flamingoBalance')" >
<el-input v-model="formData.flamingo_balance" clearable :placeholder="t('flamingoBalancePlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('thirtySecJump')" >
<el-input v-model="formData.thirty_sec_jump" clearable :placeholder="t('thirtySecJumpPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('standingLongJump')" >
<el-input v-model="formData.standing_long_jump" clearable :placeholder="t('standingLongJumpPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('agilityRun')" >
<el-input v-model="formData.agility_run" clearable :placeholder="t('agilityRunPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('balanceBeam')" >
<el-input v-model="formData.balance_beam" clearable :placeholder="t('balanceBeamPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('tennisThrow')" >
<el-input v-model="formData.tennis_throw" clearable :placeholder="t('tennisThrowPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('tenMeterShuttleRun')" >
<el-input v-model="formData.ten_meter_shuttle_run" clearable :placeholder="t('tenMeterShuttleRunPlaceholder')" class="input-width" />
</el-form-item>
</el-form>
</el-card>
<div class="fixed-footer-wrap">
<div class="fixed-footer">
<el-button type="primary" @click="onSave(formRef)">{{ t('save') }}</el-button>
<el-button @click="back()">{{ t('cancel') }}</el-button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import type { FormInstance } from 'element-plus'
import { getPhysicalTestInfo,addPhysicalTest,editPhysicalTest, getWithCustomerResourcesList, getWithStudentList, getWithPersonnelList } from '@/app/api/physical_test';
import { useRoute } from 'vue-router'
const route = useRoute()
const id:number = parseInt(route.query.id);
const loading = ref(false)
const pageName = route.meta.title
/**
* 表单数据
*/
const initialFormData = {
id: 0,
resource_id: '',
student_id: '',
height: '',
weight: '',
coach_id: '',
created_at: '',
updated_at: '',
seated_forward_bend: '',
sit_ups: '',
push_ups: '',
flamingo_balance: '',
thirty_sec_jump: '',
standing_long_jump: '',
agility_run: '',
balance_beam: '',
tennis_throw: '',
ten_meter_shuttle_run: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const setFormData = async (id:number = 0) => {
Object.assign(formData, initialFormData)
const data = await (await getPhysicalTestInfo(id)).data
Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
if(id) setFormData(id);
const formRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([] as any[])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([] as any[])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
]
,
student_id: [
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' },
]
,
height: [
{ required: true, message: t('heightPlaceholder'), trigger: 'blur' },
]
,
weight: [
{ required: true, message: t('weightPlaceholder'), trigger: 'blur' },
]
,
coach_id: [
{ required: true, message: t('coachIdPlaceholder'), trigger: 'blur' },
]
,
created_at: [
{ required: true, message: t('createdAtPlaceholder'), trigger: 'blur' },
]
,
updated_at: [
{ required: true, message: t('updatedAtPlaceholder'), trigger: 'blur' },
]
,
seated_forward_bend: [
{ required: true, message: t('seatedForwardBendPlaceholder'), trigger: 'blur' },
]
,
sit_ups: [
{ required: true, message: t('sitUpsPlaceholder'), trigger: 'blur' },
]
,
push_ups: [
{ required: true, message: t('pushUpsPlaceholder'), trigger: 'blur' },
]
,
flamingo_balance: [
{ required: true, message: t('flamingoBalancePlaceholder'), trigger: 'blur' },
]
,
thirty_sec_jump: [
{ required: true, message: t('thirtySecJumpPlaceholder'), trigger: 'blur' },
]
,
standing_long_jump: [
{ required: true, message: t('standingLongJumpPlaceholder'), trigger: 'blur' },
]
,
agility_run: [
{ required: true, message: t('agilityRunPlaceholder'), trigger: 'blur' },
]
,
balance_beam: [
{ required: true, message: t('balanceBeamPlaceholder'), trigger: 'blur' },
]
,
tennis_throw: [
{ required: true, message: t('tennisThrowPlaceholder'), trigger: 'blur' },
]
,
ten_meter_shuttle_run: [
{ required: true, message: t('tenMeterShuttleRunPlaceholder'), trigger: 'blur' },
]
,
}
})
const onSave = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
const save = id ? editPhysicalTest : addPhysicalTest
save(data).then(res => {
loading.value = false
history.back()
}).catch(err => {
loading.value = false
})
}
})
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
const back = () => {
history.back()
}
</script>
<style lang="scss" scoped></style>
<template>
<div class="main-container">
<div class="detail-head">
<div class="left" @click="back()">
<span class="iconfont iconxiangzuojiantou !text-xs"></span>
<span class="ml-[1px]">{{ t('returnToPreviousPage') }}</span>
</div>
<span class="adorn">|</span>
<span class="right">{{ pageName }}</span>
</div>
<el-card class="box-card !border-none" shadow="never">
<el-form
:model="formData"
label-width="90px"
ref="formRef"
:rules="formRules"
class="page-form"
>
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select
class="input-width"
v-model="formData.resource_id"
clearable
:placeholder="t('resourceIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select
class="input-width"
v-model="formData.student_id"
clearable
:placeholder="t('studentIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('height')" prop="height">
<el-input
v-model="formData.height"
clearable
:placeholder="t('heightPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('weight')" prop="weight">
<el-input
v-model="formData.weight"
clearable
:placeholder="t('weightPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('coachId')" prop="coach_id">
<el-select
class="input-width"
v-model="formData.coach_id"
clearable
:placeholder="t('coachIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in coachIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('createdAt')">
<el-input
v-model="formData.created_at"
clearable
:placeholder="t('createdAtPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('updatedAt')">
<el-input
v-model="formData.updated_at"
clearable
:placeholder="t('updatedAtPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('seatedForwardBend')">
<el-input
v-model="formData.seated_forward_bend"
clearable
:placeholder="t('seatedForwardBendPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('sitUps')">
<el-input
v-model="formData.sit_ups"
clearable
:placeholder="t('sitUpsPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('pushUps')">
<el-input
v-model="formData.push_ups"
clearable
:placeholder="t('pushUpsPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('flamingoBalance')">
<el-input
v-model="formData.flamingo_balance"
clearable
:placeholder="t('flamingoBalancePlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('thirtySecJump')">
<el-input
v-model="formData.thirty_sec_jump"
clearable
:placeholder="t('thirtySecJumpPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('standingLongJump')">
<el-input
v-model="formData.standing_long_jump"
clearable
:placeholder="t('standingLongJumpPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('agilityRun')">
<el-input
v-model="formData.agility_run"
clearable
:placeholder="t('agilityRunPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('balanceBeam')">
<el-input
v-model="formData.balance_beam"
clearable
:placeholder="t('balanceBeamPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('tennisThrow')">
<el-input
v-model="formData.tennis_throw"
clearable
:placeholder="t('tennisThrowPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('tenMeterShuttleRun')">
<el-input
v-model="formData.ten_meter_shuttle_run"
clearable
:placeholder="t('tenMeterShuttleRunPlaceholder')"
class="input-width"
/>
</el-form-item>
</el-form>
</el-card>
<div class="fixed-footer-wrap">
<div class="fixed-footer">
<el-button type="primary" @click="onSave(formRef)">{{
t('save')
}}</el-button>
<el-button @click="back()">{{ t('cancel') }}</el-button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import type { FormInstance } from 'element-plus'
import {
getPhysicalTestInfo,
addPhysicalTest,
editPhysicalTest,
getWithCustomerResourcesList,
getWithStudentList,
getWithPersonnelList,
} from '@/app/api/physical_test'
import { useRoute } from 'vue-router'
const route = useRoute()
const id: number = parseInt(route.query.id)
const loading = ref(false)
const pageName = route.meta.title
/**
* 表单数据
*/
const initialFormData = {
id: 0,
resource_id: '',
student_id: '',
height: '',
weight: '',
coach_id: '',
created_at: '',
updated_at: '',
seated_forward_bend: '',
sit_ups: '',
push_ups: '',
flamingo_balance: '',
thirty_sec_jump: '',
standing_long_jump: '',
agility_run: '',
balance_beam: '',
tennis_throw: '',
ten_meter_shuttle_run: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const setFormData = async (id: number = 0) => {
Object.assign(formData, initialFormData)
const data = await (await getPhysicalTestInfo(id)).data
Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
if (id) setFormData(id)
const formRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
const resourceIdList = ref([] as any[])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([] as any[])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([] as any[])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
//
const formRules = computed(() => {
return {
resource_id: [
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' },
],
student_id: [
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' },
],
height: [
{ required: true, message: t('heightPlaceholder'), trigger: 'blur' },
],
weight: [
{ required: true, message: t('weightPlaceholder'), trigger: 'blur' },
],
coach_id: [
{ required: true, message: t('coachIdPlaceholder'), trigger: 'blur' },
],
created_at: [
{ required: true, message: t('createdAtPlaceholder'), trigger: 'blur' },
],
updated_at: [
{ required: true, message: t('updatedAtPlaceholder'), trigger: 'blur' },
],
seated_forward_bend: [
{
required: true,
message: t('seatedForwardBendPlaceholder'),
trigger: 'blur',
},
],
sit_ups: [
{ required: true, message: t('sitUpsPlaceholder'), trigger: 'blur' },
],
push_ups: [
{ required: true, message: t('pushUpsPlaceholder'), trigger: 'blur' },
],
flamingo_balance: [
{
required: true,
message: t('flamingoBalancePlaceholder'),
trigger: 'blur',
},
],
thirty_sec_jump: [
{
required: true,
message: t('thirtySecJumpPlaceholder'),
trigger: 'blur',
},
],
standing_long_jump: [
{
required: true,
message: t('standingLongJumpPlaceholder'),
trigger: 'blur',
},
],
agility_run: [
{ required: true, message: t('agilityRunPlaceholder'), trigger: 'blur' },
],
balance_beam: [
{ required: true, message: t('balanceBeamPlaceholder'), trigger: 'blur' },
],
tennis_throw: [
{ required: true, message: t('tennisThrowPlaceholder'), trigger: 'blur' },
],
ten_meter_shuttle_run: [
{
required: true,
message: t('tenMeterShuttleRunPlaceholder'),
trigger: 'blur',
},
],
}
})
const onSave = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
const save = id ? editPhysicalTest : addPhysicalTest
save(data)
.then((res) => {
loading.value = false
history.back()
})
.catch((err) => {
loading.value = false
})
}
})
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (
value &&
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
value
)
) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
const back = () => {
history.back()
}
</script>
<style lang="scss" scoped></style>

331
admin/src/app/views/setting/pay.vue

@ -1,63 +1,116 @@
<template>
<!--支付设置-->
<div class="main-container" v-loading="payLoading">
<!--支付设置-->
<div class="main-container" v-loading="payLoading">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center" v-if="!payLoading">
<span class="text-page-title">{{ pageName }}</span>
<el-button type="primary" @click="isEdit = true" ref="setConfigBtn">{{
t('setConfig')
}}</el-button>
</div>
</el-card>
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center" v-if="!payLoading">
<span class="text-page-title">{{ pageName }}</span>
<el-button type="primary" @click="isEdit = true" ref="setConfigBtn">{{ t('setConfig') }}</el-button>
</div>
</el-card>
<el-card class="box-card mt-[15px] !border-none" shadow="never" v-for="(payItems, payKey) in payConfigData" :key="payKey">
<h3 class="panel-title !text-sm">{{ payItems.name }}</h3>
<div>
<div class="flex items-center justify-between p-[10px] table-item-border bg">
<span class="text-base w-[230px]">{{ t('payType') }}</span>
<span class="text-base w-[110px] text-center">{{ t('onState') }}</span>
<span class="text-base w-[80px] text-center" v-if="isEdit">{{ t('templateName') }}</span>
</div>
<el-card
class="box-card mt-[15px] !border-none"
shadow="never"
v-for="(payItems, payKey) in payConfigData"
:key="payKey"
>
<h3 class="panel-title !text-sm">{{ payItems.name }}</h3>
<div>
<div
class="flex items-center justify-between p-[10px] table-item-border bg"
>
<span class="text-base w-[230px]">{{ t('payType') }}</span>
<span class="text-base w-[110px] text-center">{{
t('onState')
}}</span>
<span class="text-base w-[80px] text-center" v-if="isEdit">{{
t('templateName')
}}</span>
</div>
<div ref="fieldBoxRefs" :data-key="payKey">
<div class="flex items-center justify-between p-[10px] table-item-border" v-for="(childrenItem, childrenIndex) in payItems.pay_type" :key="childrenItem.redio_key" :id="payKey + '_' + childrenIndex">
<div class="flex w-[230px] flex-shrink-0">
<span v-if="isEdit" class="iconfont icontuodong mr-2 handle cursor-pointer"></span>
<div class="flex items-center select-none">
<div class="mr-[15px] w-[30px] h-[30px] flex-shrink-0">
<img class="w-[30px]" :src="img(childrenItem.icon)" />
</div>
<span class="text-base text-[#666]">{{ childrenItem.name }}</span>
</div>
</div>
<div class="flex items-center justify-center w-[110px] select-none">
<el-switch v-if="isEdit" v-model="childrenItem.status" :active-value="1" :inactive-value="0" :active-text="t('isEnable')" @change="enablePaymentMode(childrenItem)" />
<div v-else>
<el-tag v-if="childrenItem.status" class="ml-2" type="success">{{ t('open') }}</el-tag>
<el-tag v-else class="ml-2" type="info">{{ t('notOpen') }}</el-tag>
</div>
</div>
<div class="flex items-center justify-center w-[80px] select-none" v-if="isEdit">
<button class="text-base" @click="configPayFn(childrenItem)" v-if="childrenItem.setting_component">{{ t('clickConfigure') }}</button>
<button v-else>--</button>
</div>
</div>
<div ref="fieldBoxRefs" :data-key="payKey">
<div
class="flex items-center justify-between p-[10px] table-item-border"
v-for="(childrenItem, childrenIndex) in payItems.pay_type"
:key="childrenItem.redio_key"
:id="payKey + '_' + childrenIndex"
>
<div class="flex w-[230px] flex-shrink-0">
<span
v-if="isEdit"
class="iconfont icontuodong mr-2 handle cursor-pointer"
></span>
<div class="flex items-center select-none">
<div class="mr-[15px] w-[30px] h-[30px] flex-shrink-0">
<img class="w-[30px]" :src="img(childrenItem.icon)" />
</div>
<span class="text-base text-[#666]">{{
childrenItem.name
}}</span>
</div>
</div>
</el-card>
<div class="fixed-footer-wrap" v-if="isEdit">
<div class="fixed-footer">
<el-button type="primary" :loading="loading" @click="cancelFn">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="saveFn(formRef)">{{ t('save') }}</el-button>
<div class="flex items-center justify-center w-[110px] select-none">
<el-switch
v-if="isEdit"
v-model="childrenItem.status"
:active-value="1"
:inactive-value="0"
:active-text="t('isEnable')"
@change="enablePaymentMode(childrenItem)"
/>
<div v-else>
<el-tag
v-if="childrenItem.status"
class="ml-2"
type="success"
>{{ t('open') }}</el-tag
>
<el-tag v-else class="ml-2" type="info">{{
t('notOpen')
}}</el-tag>
</div>
</div>
<div
class="flex items-center justify-center w-[80px] select-none"
v-if="isEdit"
>
<button
class="text-base"
@click="configPayFn(childrenItem)"
v-if="childrenItem.setting_component"
>
{{ t('clickConfigure') }}
</button>
<button v-else>--</button>
</div>
</div>
</div>
</div>
</el-card>
<template v-for="(item, index) in payTypeList">
<component :is="item.setting_component" :ref="(el) => setPayTypeRefs(el, item.key)" v-if="item.setting_component" @complete="setConfigInfo"/>
</template>
<div class="fixed-footer-wrap" v-if="isEdit">
<div class="fixed-footer">
<el-button type="primary" :loading="loading" @click="cancelFn">{{
t('cancel')
}}</el-button>
<el-button type="primary" :loading="loading" @click="saveFn(formRef)">{{
t('save')
}}</el-button>
</div>
</div>
<template v-for="(item, index) in payTypeList">
<component
:is="item.setting_component"
:ref="(el) => setPayTypeRefs(el, item.key)"
v-if="item.setting_component"
@complete="setConfigInfo"
/>
</template>
</div>
</template>
<script lang="ts" setup>
@ -79,14 +132,17 @@ const payTypeRefs = ref({})
const modules: any = import.meta.glob('@/**/*.vue')
getAllPayType().then(({ data }) => {
Object.keys(data).forEach((key: string) => {
data[key].setting_component && (data[key].setting_component = defineAsyncComponent(modules[data[key].setting_component]))
})
payTypeList.value = data
Object.keys(data).forEach((key: string) => {
data[key].setting_component &&
(data[key].setting_component = defineAsyncComponent(
modules[data[key].setting_component]
))
})
payTypeList.value = data
})
const setPayTypeRefs = (el: any, index: string) => {
payTypeRefs.value[index] = (el)
payTypeRefs.value[index] = el
}
const payLoading = ref(true)
@ -97,124 +153,127 @@ const setConfigBtn = ref()
//
const payConfigData = ref([])
const checkPayConfigList = () => {
getPayConfigList().then(res => {
const payData = res.data
for (const i in payData) {
const payType = payData[i].pay_type
const pay_type = []
let default_key = ''
payType.forEach((item, index) => {
item.redio_key = payData[i].key + '_' + item.key
item.defauit_key = ''
if (item.is_default == 1) {
default_key = item.redio_key
}
pay_type.push(item)
})
payData[payData[i].key].default_pay_type = default_key
payData[payData[i].key].pay_type = pay_type
getPayConfigList().then((res) => {
const payData = res.data
for (const i in payData) {
const payType = payData[i].pay_type
const pay_type = []
let default_key = ''
payType.forEach((item, index) => {
item.redio_key = payData[i].key + '_' + item.key
item.defauit_key = ''
if (item.is_default == 1) {
default_key = item.redio_key
}
payConfigData.value = payData
payLoading.value = false
nextTick(() => {
fieldBoxRefs.value.forEach((item, index) => {
sortableFn(item, index)
})
})
pay_type.push(item)
})
payData[payData[i].key].default_pay_type = default_key
payData[payData[i].key].pay_type = pay_type
}
payConfigData.value = payData
payLoading.value = false
nextTick(() => {
fieldBoxRefs.value.forEach((item, index) => {
sortableFn(item, index)
})
})
})
}
checkPayConfigList()
//
const setConfigInfo = (data:any) => {
payConfigData.value[data.channel].pay_type.forEach(element => {
if (element.key == data.type) {
element.config = data.config
}
})
console.log(payConfigData.value)
const setConfigInfo = (data: any) => {
payConfigData.value[data.channel].pay_type.forEach((element) => {
if (element.key == data.type) {
element.config = data.config
}
})
console.log(payConfigData.value)
}
//
const configPayFn = (data:any) => {
payTypeRefs.value[data.key].setFormData(data)
payTypeRefs.value[data.key].showDialog = true
const configPayFn = (data: any) => {
payTypeRefs.value[data.key].setFormData(data)
payTypeRefs.value[data.key].showDialog = true
}
//
const enablePaymentMode = async (data: any) => {
if (payTypeRefs.value[data.key] && typeof payTypeRefs.value[data.key].enableVerify == 'function') {
payTypeRefs.value[data.key].setFormData(data)
const verify = payTypeRefs.value[data.key].enableVerify()
if (!verify) {
data.status = 0
ElMessage(t('configurePaymentMethod'))
return false
}
if (
payTypeRefs.value[data.key] &&
typeof payTypeRefs.value[data.key].enableVerify == 'function'
) {
payTypeRefs.value[data.key].setFormData(data)
const verify = payTypeRefs.value[data.key].enableVerify()
if (!verify) {
data.status = 0
ElMessage(t('configurePaymentMethod'))
return false
}
}
}
interface SortableEvt extends SortableEvent {
originalEvent?: DragEvent
originalEvent?: DragEvent
}
//
const fieldBoxRefs = ref<any>([])
watch(isEdit, (newValue, oldValue) => {
if (newValue) {
nextTick(() => {
fieldBoxRefs.value.forEach((item:any, index:any) => {
sortableFn(item, index)
})
})
}
if (newValue) {
nextTick(() => {
fieldBoxRefs.value.forEach((item: any, index: any) => {
sortableFn(item, index)
})
})
}
})
// item=>index
const sortableFn = (item, index) => {
const sortable = Sortable.create(item, {
group: {
put: false //
},
handle: '.handle',
animation: 200,
disabled: false,
onEnd: (evt) => {
const key = evt.target.getAttribute('data-key')
const data = payConfigData.value[key].pay_type
data.splice(evt.newIndex, 0, ...data.splice(evt.oldIndex, 1))
}
})
const sortable = Sortable.create(item, {
group: {
put: false, //
},
handle: '.handle',
animation: 200,
disabled: false,
onEnd: (evt) => {
const key = evt.target.getAttribute('data-key')
const data = payConfigData.value[key].pay_type
data.splice(evt.newIndex, 0, ...data.splice(evt.oldIndex, 1))
},
})
}
//
const saveFn = () => {
payLoading.value = true
const data = cloneDeep(payConfigData.value)
Object.values(data).forEach((item, index) => {
item.pay_type.forEach((subItem:any, subIndex:any) => {
subItem.sort = subIndex
})
payLoading.value = true
const data = cloneDeep(payConfigData.value)
Object.values(data).forEach((item, index) => {
item.pay_type.forEach((subItem: any, subIndex: any) => {
subItem.sort = subIndex
})
})
setPatConfig({ config: data }).then(res => {
checkPayConfigList()
isEdit.value = false
payLoading.value = false
})
setPatConfig({ config: data }).then((res) => {
checkPayConfigList()
isEdit.value = false
payLoading.value = false
})
}
//
const cancelFn = () => {
location.reload()
location.reload()
}
</script>
<style lang="scss" scoped>
.table-item-border {
@apply border-b border-[var(--el-border-color)];
}
.table-item-border {
@apply border-b border-[var(--el-border-color)];
}
</style>

504
admin/src/app/views/student_courses/components/student-courses-edit.vue

@ -1,231 +1,273 @@
<template>
<el-dialog v-model="showDialog" :title="formData.id ? t('updateStudentCourses') : t('addStudentCourses')" width="50%" class="diy-dialog-wrap" :destroy-on-close="true">
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="input-width" v-model="formData.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('courseId')" prop="course_id">
<el-select class="input-width" v-model="formData.course_id" clearable :placeholder="t('courseIdPlaceholder')">
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in courseIdList"
:key="index"
:label="item['course_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('totalHours')" prop="total_hours">
<el-input v-model="formData.total_hours" clearable :placeholder="t('totalHoursPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('giftHours')" >
<el-input v-model="formData.gift_hours" clearable :placeholder="t('giftHoursPlaceholder')" class="input-width" />
</el-form-item>
<el-form-item :label="t('startDate')" prop="start_date" class="input-width">
<el-date-picker
class="flex-1 !flex"
v-model="formData.start_date"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="t('startDatePlaceholder')">
</el-date-picker>
</el-form-item>
<el-form-item :label="t('endDate')" prop="end_date" class="input-width">
<el-date-picker
class="flex-1 !flex"
v-model="formData.end_date"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="t('endDatePlaceholder')">
</el-date-picker>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{
t('confirm')
}}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import { addStudentCourses, editStudentCourses, getStudentCoursesInfo, getWithStudentList, getWithCourseList } from '@/app/api/student_courses'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
student_id: '',
course_id: '',
total_hours: '',
gift_hours: '',
start_date: '',
end_date: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
student_id: [
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' },
]
,
course_id: [
{ required: true, message: t('courseIdPlaceholder'), trigger: 'blur' },
]
,
total_hours: [
{ required: true, message: t('totalHoursPlaceholder'), trigger: 'blur' },
]
,
gift_hours: [
{ required: true, message: t('giftHoursPlaceholder'), trigger: 'blur' },
]
,
start_date: [
{ required: true, message: t('startDatePlaceholder'), trigger: 'blur' },
]
,
end_date: [
{ required: true, message: t('endDatePlaceholder'), trigger: 'blur' },
]
,
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editStudentCourses : addStudentCourses
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data).then(res => {
loading.value = false
showDialog.value = false
emit('complete')
}).catch(err => {
loading.value = false
})
}
})
}
//
const studentIdList = ref([] as any[])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const courseIdList = ref([] as any[])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
if(row){
const data = await (await getStudentCoursesInfo(row.id)).data
if (data) Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label{
height: auto !important;
}
</style>
<template>
<el-dialog
v-model="showDialog"
:title="formData.id ? t('updateStudentCourses') : t('addStudentCourses')"
width="50%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<el-form
:model="formData"
label-width="120px"
ref="formRef"
:rules="formRules"
class="page-form"
v-loading="loading"
>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select
class="input-width"
v-model="formData.student_id"
clearable
:placeholder="t('studentIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('courseId')" prop="course_id">
<el-select
class="input-width"
v-model="formData.course_id"
clearable
:placeholder="t('courseIdPlaceholder')"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in courseIdList"
:key="index"
:label="item['course_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('totalHours')" prop="total_hours">
<el-input
v-model="formData.total_hours"
clearable
:placeholder="t('totalHoursPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item :label="t('giftHours')">
<el-input
v-model="formData.gift_hours"
clearable
:placeholder="t('giftHoursPlaceholder')"
class="input-width"
/>
</el-form-item>
<el-form-item
:label="t('startDate')"
prop="start_date"
class="input-width"
>
<el-date-picker
class="flex-1 !flex"
v-model="formData.start_date"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="t('startDatePlaceholder')"
>
</el-date-picker>
</el-form-item>
<el-form-item :label="t('endDate')" prop="end_date" class="input-width">
<el-date-picker
class="flex-1 !flex"
v-model="formData.end_date"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="t('endDatePlaceholder')"
>
</el-date-picker>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button
type="primary"
:loading="loading"
@click="confirm(formRef)"
>{{ t('confirm') }}</el-button
>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import {
addStudentCourses,
editStudentCourses,
getStudentCoursesInfo,
getWithStudentList,
getWithCourseList,
} from '@/app/api/student_courses'
let showDialog = ref(false)
const loading = ref(false)
/**
* 表单数据
*/
const initialFormData = {
id: '',
student_id: '',
course_id: '',
total_hours: '',
gift_hours: '',
start_date: '',
end_date: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
student_id: [
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' },
],
course_id: [
{ required: true, message: t('courseIdPlaceholder'), trigger: 'blur' },
],
total_hours: [
{ required: true, message: t('totalHoursPlaceholder'), trigger: 'blur' },
],
gift_hours: [
{ required: true, message: t('giftHoursPlaceholder'), trigger: 'blur' },
],
start_date: [
{ required: true, message: t('startDatePlaceholder'), trigger: 'blur' },
],
end_date: [
{ required: true, message: t('endDatePlaceholder'), trigger: 'blur' },
],
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editStudentCourses : addStudentCourses
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data)
.then((res) => {
loading.value = false
showDialog.value = false
emit('complete')
})
.catch((err) => {
loading.value = false
})
}
})
}
//
const studentIdList = ref([] as any[])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const courseIdList = ref([] as any[])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
if (row) {
const data = await (await getStudentCoursesInfo(row.id)).data
if (data)
Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
loading.value = false
}
//
const mobileVerify = (rule: any, value: any, callback: any) => {
if (value && !/^1[3-9]\d{9}$/.test(value)) {
callback(new Error(t('generateMobile')))
} else {
callback()
}
}
//
const idCardVerify = (rule: any, value: any, callback: any) => {
if (
value &&
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
value
)
) {
callback(new Error(t('generateIdCard')))
} else {
callback()
}
}
//
const emailVerify = (rule: any, value: any, callback: any) => {
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) {
callback(new Error(t('generateEmail')))
} else {
callback()
}
}
//
const numberVerify = (rule: any, value: any, callback: any) => {
if (!Number.isInteger(value)) {
callback(new Error(t('generateNumber')))
} else {
callback()
}
}
defineExpose({
showDialog,
setFormData,
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label {
height: auto !important;
}
</style>

472
admin/src/app/views/student_courses/student_courses.vue

@ -1,201 +1,271 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{pageName}}</span>
<el-button type="primary" @click="addEvent">
{{ t('addStudentCourses') }}
</el-button>
</div>
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="studentCoursesTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="w-[280px]" v-model="studentCoursesTable.searchParam.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('courseId')" prop="course_id">
<el-select class="w-[280px]" v-model="studentCoursesTable.searchParam.course_id" clearable :placeholder="t('courseIdPlaceholder')">
<el-option
v-for="(item, index) in courseIdList"
:key="index"
:label="item['course_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadStudentCoursesList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table :data="studentCoursesTable.data" size="large" v-loading="studentCoursesTable.loading">
<template #empty>
<span>{{ !studentCoursesTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column prop="student_id_name" :label="t('studentId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="course_id_name" :label="t('courseId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="total_hours" :label="t('totalHours')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="gift_hours" :label="t('giftHours')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="start_date" :label="t('startDate')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="end_date" :label="t('endDate')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="studentCoursesTable.page" v-model:page-size="studentCoursesTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="studentCoursesTable.total"
@size-change="loadStudentCoursesList()" @current-change="loadStudentCoursesList" />
</div>
</div>
<edit ref="editStudentCoursesDialog" @complete="loadStudentCoursesList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getStudentCoursesList, deleteStudentCourses, getWithStudentList, getWithCourseList } from '@/app/api/student_courses'
import { img } from '@/utils/common'
import { ElMessageBox,FormInstance } from 'element-plus'
import Edit from '@/app/views/student_courses/components/student-courses-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title;
let studentCoursesTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam:{
"student_id":"",
"course_id":""
}
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
/**
* 获取学员课程列表
*/
const loadStudentCoursesList = (page: number = 1) => {
studentCoursesTable.loading = true
studentCoursesTable.page = page
getStudentCoursesList({
page: studentCoursesTable.page,
limit: studentCoursesTable.limit,
...studentCoursesTable.searchParam
}).then(res => {
studentCoursesTable.loading = false
studentCoursesTable.data = res.data.data
studentCoursesTable.total = res.data.total
}).catch(() => {
studentCoursesTable.loading = false
})
}
loadStudentCoursesList()
const editStudentCoursesDialog: Record<string, any> | null = ref(null)
/**
* 添加学员课程
*/
const addEvent = () => {
editStudentCoursesDialog.value.setFormData()
editStudentCoursesDialog.value.showDialog = true
}
/**
* 编辑学员课程
* @param data
*/
const editEvent = (data: any) => {
editStudentCoursesDialog.value.setFormData(data)
editStudentCoursesDialog.value.showDialog = true
}
/**
* 删除学员课程
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('studentCoursesDeleteTips'), t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}
).then(() => {
deleteStudentCourses(id).then(() => {
loadStudentCoursesList()
}).catch(() => {
})
})
}
const studentIdList = ref([])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const courseIdList = ref([])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadStudentCoursesList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addEvent">
{{ t('addStudentCourses') }}
</el-button>
</div>
<el-card
class="box-card !border-none my-[10px] table-search-wrap"
shadow="never"
>
<el-form
:inline="true"
:model="studentCoursesTable.searchParam"
ref="searchFormRef"
>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select
class="w-[280px]"
v-model="studentCoursesTable.searchParam.student_id"
clearable
:placeholder="t('studentIdPlaceholder')"
>
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('courseId')" prop="course_id">
<el-select
class="w-[280px]"
v-model="studentCoursesTable.searchParam.course_id"
clearable
:placeholder="t('courseIdPlaceholder')"
>
<el-option
v-for="(item, index) in courseIdList"
:key="index"
:label="item['course_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadStudentCoursesList()">{{
t('search')
}}</el-button>
<el-button @click="resetForm(searchFormRef)">{{
t('reset')
}}</el-button>
</el-form-item>
</el-form>
</el-card>
<div class="mt-[10px]">
<el-table
:data="studentCoursesTable.data"
size="large"
v-loading="studentCoursesTable.loading"
>
<template #empty>
<span>{{
!studentCoursesTable.loading ? t('emptyData') : ''
}}</span>
</template>
<el-table-column
prop="student_id_name"
:label="t('studentId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="course_id_name"
:label="t('courseId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="total_hours"
:label="t('totalHours')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="gift_hours"
:label="t('giftHours')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="start_date"
:label="t('startDate')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="end_date"
:label="t('endDate')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="120"
>
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete')
}}</el-button>
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination
v-model:current-page="studentCoursesTable.page"
v-model:page-size="studentCoursesTable.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="studentCoursesTable.total"
@size-change="loadStudentCoursesList()"
@current-change="loadStudentCoursesList"
/>
</div>
</div>
<edit ref="editStudentCoursesDialog" @complete="loadStudentCoursesList" />
</el-card>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import {
getStudentCoursesList,
deleteStudentCourses,
getWithStudentList,
getWithCourseList,
} from '@/app/api/student_courses'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
import Edit from '@/app/views/student_courses/components/student-courses-edit.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
let studentCoursesTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
student_id: '',
course_id: '',
},
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
/**
* 获取学员课程列表
*/
const loadStudentCoursesList = (page: number = 1) => {
studentCoursesTable.loading = true
studentCoursesTable.page = page
getStudentCoursesList({
page: studentCoursesTable.page,
limit: studentCoursesTable.limit,
...studentCoursesTable.searchParam,
})
.then((res) => {
studentCoursesTable.loading = false
studentCoursesTable.data = res.data.data
studentCoursesTable.total = res.data.total
})
.catch(() => {
studentCoursesTable.loading = false
})
}
loadStudentCoursesList()
const editStudentCoursesDialog: Record<string, any> | null = ref(null)
/**
* 添加学员课程
*/
const addEvent = () => {
editStudentCoursesDialog.value.setFormData()
editStudentCoursesDialog.value.showDialog = true
}
/**
* 编辑学员课程
* @param data
*/
const editEvent = (data: any) => {
editStudentCoursesDialog.value.setFormData(data)
editStudentCoursesDialog.value.showDialog = true
}
/**
* 删除学员课程
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('studentCoursesDeleteTips'), t('warning'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}).then(() => {
deleteStudentCourses(id)
.then(() => {
loadStudentCoursesList()
})
.catch(() => {})
})
}
const studentIdList = ref([])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const courseIdList = ref([])
const setCourseIdList = async () => {
courseIdList.value = await (await getWithCourseList({})).data
}
setCourseIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadStudentCoursesList()
}
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

520
admin/src/app/views/tc_dialog/tc_dialog.vue

@ -1,239 +1,281 @@
<template>
<el-dialog
v-model="showDialog"
title="体测列表"
width="80%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">体测列表</span>
<el-button type="primary" @click="addEvent">
{{ t('addPhysicalTest') }}
</el-button>
</div>
<!-- <el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="physicalTestTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="w-[280px]" v-model="physicalTestTable.searchParam.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="w-[280px]" v-model="physicalTestTable.searchParam.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('height')" prop="height">
<el-input v-model="physicalTestTable.searchParam.height" :placeholder="t('heightPlaceholder')" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadPhysicalTestList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card> -->
<div class="mt-[10px]">
<el-table :data="physicalTestTable.data" size="large" v-loading="physicalTestTable.loading">
<template #empty>
<span>{{ !physicalTestTable.loading ? t('emptyData') : '' }}</span>
</template>
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="student_id_name" :label="t('studentId')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="height" :label="t('height')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="created_at" :label="t('createdAt')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="updated_at" :label="t('updatedAt')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<!-- <el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button> -->
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="physicalTestTable.page" v-model:page-size="physicalTestTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="physicalTestTable.total"
@size-change="loadPhysicalTestList()" @current-change="loadPhysicalTestList" />
</div>
</div>
<edit ref="editPhysicalTestDialog" @complete="loadPhysicalTestList" />
</el-card>
</div>
</el-dialog>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getPhysicalTestList, deletePhysicalTest, getWithCustomerResourcesList, getWithStudentList, getWithPersonnelList } from '@/app/api/physical_test'
import { img } from '@/utils/common'
import { ElMessageBox,FormInstance } from 'element-plus'
import Edit from '@/app/views/physical_test/components/physical-test-edit.vue'
import { useRouter } from 'vue-router'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title;
let showDialog = ref(false)
let physicalTestTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam:{
"resource_id":"",
"student_id":"",
"height":""
}
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
/**
* 获取体测列表
*/
const loadPhysicalTestList = (page: number = 1) => {
physicalTestTable.loading = true
physicalTestTable.page = page
getPhysicalTestList({
page: physicalTestTable.page,
limit: physicalTestTable.limit,
...physicalTestTable.searchParam
}).then(res => {
physicalTestTable.loading = false
physicalTestTable.data = res.data.data
physicalTestTable.total = res.data.total
}).catch(() => {
physicalTestTable.loading = false
})
}
const router = useRouter()
const editPhysicalTestDialog: Record<string, any> | null = ref(null)
/**
* 添加体测
*/
const addEvent = () => {
editPhysicalTestDialog.value.setFormData({'resource_id':physicalTestTable.searchParam.resource_id})
editPhysicalTestDialog.value.showDialog = true
}
/**
* 编辑体测
* @param data
*/
const editEvent = (data: any) => {
// router.push('/physical_test/physical_test_edit?id='+data.id)
editPhysicalTestDialog.value.setFormData(data)
editPhysicalTestDialog.value.showDialog = true
}
/**
* 删除体测
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('physicalTestDeleteTips'), t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}
).then(() => {
deletePhysicalTest(id).then(() => {
loadPhysicalTestList()
}).catch(() => {
})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadPhysicalTestList()
}
const setFormData = async (row: any = null) => {
// Object.assign(formData, initialFormData)
physicalTestTable.searchParam.resource_id = row.resource_id
console.log(physicalTestTable.searchParam.resource_id);
loadPhysicalTestList()
}
defineExpose({
showDialog,
setFormData
})
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
<template>
<el-dialog
v-model="showDialog"
title="体测列表"
width="80%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-lg">体测列表</span>
<el-button type="primary" @click="addEvent">
{{ t('addPhysicalTest') }}
</el-button>
</div>
<!-- <el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="physicalTestTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-select class="w-[280px]" v-model="physicalTestTable.searchParam.resource_id" clearable :placeholder="t('resourceIdPlaceholder')">
<el-option
v-for="(item, index) in resourceIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('studentId')" prop="student_id">
<el-select class="w-[280px]" v-model="physicalTestTable.searchParam.student_id" clearable :placeholder="t('studentIdPlaceholder')">
<el-option
v-for="(item, index) in studentIdList"
:key="index"
:label="item['name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('height')" prop="height">
<el-input v-model="physicalTestTable.searchParam.height" :placeholder="t('heightPlaceholder')" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadPhysicalTestList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item>
</el-form>
</el-card> -->
<div class="mt-[10px]">
<el-table
:data="physicalTestTable.data"
size="large"
v-loading="physicalTestTable.loading"
>
<template #empty>
<span>{{
!physicalTestTable.loading ? t('emptyData') : ''
}}</span>
</template>
<el-table-column
prop="resource_id_name"
:label="t('resourceId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="student_id_name"
:label="t('studentId')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="height"
:label="t('height')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="created_at"
:label="t('createdAt')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="updated_at"
:label="t('updatedAt')"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column
:label="t('operation')"
fixed="right"
min-width="120"
>
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{
t('edit')
}}</el-button>
<!-- <el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button> -->
</template>
</el-table-column>
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination
v-model:current-page="physicalTestTable.page"
v-model:page-size="physicalTestTable.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="physicalTestTable.total"
@size-change="loadPhysicalTestList()"
@current-change="loadPhysicalTestList"
/>
</div>
</div>
<edit ref="editPhysicalTestDialog" @complete="loadPhysicalTestList" />
</el-card>
</div>
</el-dialog>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import {
getPhysicalTestList,
deletePhysicalTest,
getWithCustomerResourcesList,
getWithStudentList,
getWithPersonnelList,
} from '@/app/api/physical_test'
import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus'
import Edit from '@/app/views/physical_test/components/physical-test-edit.vue'
import { useRouter } from 'vue-router'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
let showDialog = ref(false)
let physicalTestTable = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [],
searchParam: {
resource_id: '',
student_id: '',
height: '',
},
})
const searchFormRef = ref<FormInstance>()
//
const selectData = ref<any[]>([])
//
/**
* 获取体测列表
*/
const loadPhysicalTestList = (page: number = 1) => {
physicalTestTable.loading = true
physicalTestTable.page = page
getPhysicalTestList({
page: physicalTestTable.page,
limit: physicalTestTable.limit,
...physicalTestTable.searchParam,
})
.then((res) => {
physicalTestTable.loading = false
physicalTestTable.data = res.data.data
physicalTestTable.total = res.data.total
})
.catch(() => {
physicalTestTable.loading = false
})
}
const router = useRouter()
const editPhysicalTestDialog: Record<string, any> | null = ref(null)
/**
* 添加体测
*/
const addEvent = () => {
editPhysicalTestDialog.value.setFormData({
resource_id: physicalTestTable.searchParam.resource_id,
})
editPhysicalTestDialog.value.showDialog = true
}
/**
* 编辑体测
* @param data
*/
const editEvent = (data: any) => {
// router.push('/physical_test/physical_test_edit?id='+data.id)
editPhysicalTestDialog.value.setFormData(data)
editPhysicalTestDialog.value.showDialog = true
}
/**
* 删除体测
*/
const deleteEvent = (id: number) => {
ElMessageBox.confirm(t('physicalTestDeleteTips'), t('warning'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning',
}).then(() => {
deletePhysicalTest(id)
.then(() => {
loadPhysicalTestList()
})
.catch(() => {})
})
}
const resourceIdList = ref([])
const setResourceIdList = async () => {
resourceIdList.value = await (await getWithCustomerResourcesList({})).data
}
setResourceIdList()
const studentIdList = ref([])
const setStudentIdList = async () => {
studentIdList.value = await (await getWithStudentList({})).data
}
setStudentIdList()
const coachIdList = ref([])
const setCoachIdList = async () => {
coachIdList.value = await (await getWithPersonnelList({})).data
}
setCoachIdList()
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
loadPhysicalTestList()
}
const setFormData = async (row: any = null) => {
// Object.assign(formData, initialFormData)
physicalTestTable.searchParam.resource_id = row.resource_id
console.log(physicalTestTable.searchParam.resource_id)
loadPhysicalTestList()
}
defineExpose({
showDialog,
setFormData,
})
</script>
<style lang="scss" scoped>
/* 多行超出隐藏 */
.multi-hidden {
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

25
admin/src/app/views/timetables/timetables.vue

@ -26,7 +26,9 @@
value-format="YYYY-MM-DD"
@change="handleDateRangeChange"
/>
<el-button type="primary" class="ml-2" @click="fetchData">查询</el-button>
<el-button type="primary" class="ml-2" @click="fetchData"
>查询</el-button
>
</div>
<el-button @click="addSchedule">添加课程</el-button>
</div>
@ -66,7 +68,9 @@
>
<template #default="{ row }">
<div v-if="row.course && row.course.classroom == classroom">
<div class="teacher-name">{{ getTeacherName(row.course.teacher) }}</div>
<div class="teacher-name">
{{ getTeacherName(row.course.teacher) }}
</div>
<div class="student-list">
<el-tag
v-for="student in row.course.students"
@ -88,8 +92,15 @@
<!-- 详情弹窗 -->
<el-dialog v-model="dialogVisible" title="课程详情">
<p><strong>教师:</strong> {{ getTeacherName(selectedCourse?.teacher) }}</p>
<p><strong>学员:</strong> {{ selectedCourse?.students.map(id => getStudentName(id)).join(', ') }}</p>
<p>
<strong>教师:</strong> {{ getTeacherName(selectedCourse?.teacher) }}
</p>
<p>
<strong>学员:</strong>
{{
selectedCourse?.students.map((id) => getStudentName(id)).join(', ')
}}
</p>
</el-dialog>
</div>
</el-card>
@ -107,7 +118,7 @@ const selectedCampus = ref('')
//
const dateRange = ref([
getMonday(new Date()).toISOString().split('T')[0],
getSunday(new Date()).toISOString().split('T')[0]
getSunday(new Date()).toISOString().split('T')[0],
])
//
@ -167,11 +178,11 @@ const fetchData = async () => {
params.start_date = dateRange.value[0]
params.end_date = dateRange.value[1]
}
if (selectedCampus.value) {
params.campus_id = selectedCampus.value
}
const response = await getTimetables(params)
if (response.data) {
days.value = response.data

416
admin/src/app/views/xsyj/xsyj.vue

@ -1,212 +1,228 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never" v-loading="loading">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addStage">
新增阶段
</el-button>
</div>
</el-card>
<el-card class="box-card !border-none" shadow="never" >
<div class="flex items-center justify-between p-[10px] table-item-border bg">
<span class="text-base w-[230px]">阶段名称</span>
<span class="text-base w-[110px] text-center">底薪</span>
</div>
<el-collapse v-model="activeNames" accordion >
<el-collapse-item v-for="(stage, index) in stages" :key="stage.id" :name="stage.id">
<template #title>
<div class="collapse-title">
<span class="title-name">{{ stage.name }}</span>
<span class="arrow">{{ stage.price }} </span>
<!-- <span class="arrow">&gt;</span> -->
</div>
</template>
<el-form label-width="100px" style="margin-bottom: 10px">
<el-form-item label="阶段名称">
<el-input v-model="stage.name" placeholder="请输入阶段名称" />
</el-form-item>
</el-form>
<el-form label-width="100px" style="margin-bottom: 10px">
<el-form-item label="阶段底薪">
<el-input v-model="stage.price" placeholder="请输入阶段底薪" />
</el-form-item>
</el-form>
<el-button type="success" size="small" @click="addRule(stage)">新增规则</el-button>
<el-table :data="stage.rules" border style="margin-top: 10px">
<el-table-column prop="renewal_standard_min" label="续费上限">
<template #default="{ row }">
<el-input v-model="row.renewal_standard_min" placeholder="请输入续费上限" />
</template>
</el-table-column>
<el-table-column prop="renewal_standard_max" label="续费下限">
<template #default="{ row }">
<el-input v-model="row.renewal_standard_max" placeholder="请输入续费下限" />
</template>
</el-table-column>
<el-table-column prop="renewal_commission" label="续费提成">
<template #default="{ row }">
<el-input v-model="row.renewal_commission" placeholder="%" />
</template>
</el-table-column>
<el-table-column prop="new_count_min" label="新单成交数上限">
<template #default="{ row }">
<el-input v-model="row.new_count_min" />
</template>
</el-table-column>
<el-table-column prop="new_count_max" label="新单成交数下限">
<template #default="{ row }">
<el-input v-model="row.new_count_max" />
</template>
</el-table-column>
<el-table-column prop="new_move_5" label="新招(5+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_5" />
</template>
</el-table-column>
<el-table-column prop="new_move_7" label="新招(7+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_7" />
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ $index }">
<el-button type="danger" size="small" @click="removeRule(stage, $index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-button type="danger" size="small" style="margin-top: 10px"
@click="removeStage(index)">删除该阶段</el-button>
</el-collapse-item>
</el-collapse>
<div style="text-align: right; margin-top: 20px;">
<el-button type="primary" @click="onSave">提交保存</el-button>
</div>
</el-card>
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addStage"> 新增阶段 </el-button>
</div>
</el-card>
<el-card class="box-card !border-none" shadow="never">
<div
class="flex items-center justify-between p-[10px] table-item-border bg"
>
<span class="text-base w-[230px]">阶段名称</span>
<span class="text-base w-[110px] text-center">底薪</span>
</div>
<el-collapse v-model="activeNames" accordion>
<el-collapse-item
v-for="(stage, index) in stages"
:key="stage.id"
:name="stage.id"
>
<template #title>
<div class="collapse-title">
<span class="title-name">{{ stage.name }}</span>
<span class="arrow">{{ stage.price }} </span>
<!-- <span class="arrow">&gt;</span> -->
</div>
</template>
<el-form label-width="100px" style="margin-bottom: 10px">
<el-form-item label="阶段名称">
<el-input v-model="stage.name" placeholder="请输入阶段名称" />
</el-form-item>
</el-form>
<el-form label-width="100px" style="margin-bottom: 10px">
<el-form-item label="阶段底薪">
<el-input v-model="stage.price" placeholder="请输入阶段底薪" />
</el-form-item>
</el-form>
<el-button type="success" size="small" @click="addRule(stage)"
>新增规则</el-button
>
<el-table :data="stage.rules" border style="margin-top: 10px">
<el-table-column prop="renewal_standard_min" label="续费上限">
<template #default="{ row }">
<el-input
v-model="row.renewal_standard_min"
placeholder="请输入续费上限"
/>
</template>
</el-table-column>
<el-table-column prop="renewal_standard_max" label="续费下限">
<template #default="{ row }">
<el-input
v-model="row.renewal_standard_max"
placeholder="请输入续费下限"
/>
</template>
</el-table-column>
<el-table-column prop="renewal_commission" label="续费提成">
<template #default="{ row }">
<el-input v-model="row.renewal_commission" placeholder="%" />
</template>
</el-table-column>
<el-table-column prop="new_count_min" label="新单成交数上限">
<template #default="{ row }">
<el-input v-model="row.new_count_min" />
</template>
</el-table-column>
<el-table-column prop="new_count_max" label="新单成交数下限">
<template #default="{ row }">
<el-input v-model="row.new_count_max" />
</template>
</el-table-column>
<el-table-column prop="new_move_5" label="新招(5+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_5" />
</template>
</el-table-column>
<el-table-column prop="new_move_7" label="新招(7+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_7" />
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ $index }">
<el-button
type="danger"
size="small"
@click="removeRule(stage, $index)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<el-button
type="danger"
size="small"
style="margin-top: 10px"
@click="removeStage(index)"
>删除该阶段</el-button
>
</el-collapse-item>
</el-collapse>
<div style="text-align: right; margin-top: 20px">
<el-button type="primary" @click="onSave">提交保存</el-button>
</div>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { xsyjConfig, getXsyjConfig } from '@/app/api/sys'
import { reactive, ref } from 'vue'
import {ElMessage} from 'element-plus'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
const loading = ref(true)
const stages = ref([])
const activeNames = ref(null)
function addStage() {
const newStage = {
name: '默认阶段',
price:0,
rules: [{
renewal_standard_min: '',
renewal_standard_max: '',
renewal_commission: '',
new_count_min: '',
new_count_max: '',
new_move_5: '',
new_move_7: ''
}]
}
stages.value.push(newStage)
activeNames.value = newStage.name
}
function removeStage(index) {
stages.value.splice(index, 1)
}
function addRule(stage) {
stage.rules.push({
renewal_standard_min: '',
renewal_standard_max: '',
renewal_commission: '',
new_count_min: '',
new_count_max: '',
new_move_5: '',
new_move_7: ''
})
}
function removeRule(stage, ruleIndex) {
if (stage.rules.length === 1) {
ElMessage.warning('至少保留一条规则')
return
}
stage.rules.splice(ruleIndex, 1)
}
const setFormData = async () => {
const data = await (await getXsyjConfig()).data
stages.value = data
loading.value = false
}
setFormData();
const onSave = async () => {
xsyjConfig(stages.value)
.then(() => {
loading.value = true
setFormData()
})
.catch(() => {
loading.value = false
})
}
import { xsyjConfig, getXsyjConfig } from '@/app/api/sys'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
const loading = ref(true)
const stages = ref([])
const activeNames = ref(null)
function addStage() {
const newStage = {
name: '默认阶段',
price: 0,
rules: [
{
renewal_standard_min: '',
renewal_standard_max: '',
renewal_commission: '',
new_count_min: '',
new_count_max: '',
new_move_5: '',
new_move_7: '',
},
],
}
stages.value.push(newStage)
activeNames.value = newStage.name
}
function removeStage(index) {
stages.value.splice(index, 1)
}
function addRule(stage) {
stage.rules.push({
renewal_standard_min: '',
renewal_standard_max: '',
renewal_commission: '',
new_count_min: '',
new_count_max: '',
new_move_5: '',
new_move_7: '',
})
}
function removeRule(stage, ruleIndex) {
if (stage.rules.length === 1) {
ElMessage.warning('至少保留一条规则')
return
}
stage.rules.splice(ruleIndex, 1)
}
const setFormData = async () => {
const data = await (await getXsyjConfig()).data
stages.value = data
loading.value = false
}
setFormData()
const onSave = async () => {
xsyjConfig(stages.value)
.then(() => {
loading.value = true
setFormData()
})
.catch(() => {
loading.value = false
})
}
</script>
<style lang="scss" scoped>
.collapse-title {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
font-size: 14px;
font-weight: 500;
padding-right: 10px;
color: #333;
padding: 10px;
}
.title-name {
width: 230px;
}
.title-salary {
width: 110px;
text-align: center;
color: #7438D5;
}
.arrow {
margin-left: auto;
color: #999;
font-size: 14px;
}
.collapse-title {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
font-size: 14px;
font-weight: 500;
padding-right: 10px;
color: #333;
padding: 10px;
}
.title-name {
width: 230px;
}
.title-salary {
width: 110px;
text-align: center;
color: #7438d5;
}
.arrow {
margin-left: auto;
color: #999;
font-size: 14px;
}
</style>

Loading…
Cancel
Save