15 changed files with 1367 additions and 1101 deletions
@ -1,43 +1,37 @@ |
|||||
{ |
{ |
||||
"id": "体测编号", |
"resourceId":"客户姓名", |
||||
"idPlaceholder": "请输入体测编号", |
"resourceIdPlaceholder":"全部", |
||||
"resourceId": "资源ID", |
"studentId":"学员姓名", |
||||
"resourceIdPlaceholder": "请输入资源ID", |
"studentIdPlaceholder":"全部", |
||||
"studentId": "学员ID", |
"height":"身高", |
||||
"studentIdPlaceholder": "请输入学员ID", |
"heightPlaceholder":"请输入身高", |
||||
"height": "身高", |
"weight":"体重", |
||||
"heightPlaceholder": "请输入身高", |
"weightPlaceholder":"请输入体重", |
||||
"weight": "体重", |
"coachId":"教练", |
||||
"weightPlaceholder": "请输入体重", |
"coachIdPlaceholder":"请输入教练", |
||||
"coachId": "教练ID", |
"seatedForwardBend":"坐位体前屈", |
||||
"coachIdPlaceholder": "请输入教练ID", |
"seatedForwardBendPlaceholder":"请输入坐位体前屈", |
||||
"createdAt": "创建时间", |
"sitUps":"仰卧卷腹", |
||||
"createdAtPlaceholder": "请输入创建时间", |
"sitUpsPlaceholder":"请输入仰卧卷腹", |
||||
"updatedAt": "修改时间", |
"pushUps":"九十度仰卧撑", |
||||
"updatedAtPlaceholder": "请输入修改时间", |
"pushUpsPlaceholder":"请输入九十度仰卧撑", |
||||
"seatedForwardBend": "坐位体前屈", |
"flamingoBalance":"火烈鸟平衡测试", |
||||
"seatedForwardBendPlaceholder": "请输入坐位体前屈", |
"flamingoBalancePlaceholder":"请输入火烈鸟平衡测试", |
||||
"sitUps": "仰卧卷腹", |
"thirtySecJump":"三十秒双脚连续跳", |
||||
"sitUpsPlaceholder": "请输入仰卧卷腹", |
"thirtySecJumpPlaceholder":"请输入三十秒双脚连续跳", |
||||
"pushUps": "九十度仰卧撑", |
"standingLongJump":"立定跳远", |
||||
"pushUpsPlaceholder": "请输入九十度仰卧撑", |
"standingLongJumpPlaceholder":"请输入立定跳远", |
||||
"flamingoBalance": "火烈鸟平衡测试", |
"agilityRun":"4乘10m灵敏折返跑", |
||||
"flamingoBalancePlaceholder": "请输入火烈鸟平衡测试", |
"agilityRunPlaceholder":"请输入4乘10m灵敏折返跑", |
||||
"thirtySecJump": "三十秒双脚连续跳", |
"balanceBeam":"走平衡木", |
||||
"thirtySecJumpPlaceholder": "请输入三十秒双脚连续跳", |
"balanceBeamPlaceholder":"请输入走平衡木", |
||||
"standingLongJump": "立定跳远", |
"tennisThrow":"网球掷远", |
||||
"standingLongJumpPlaceholder": "请输入立定跳远", |
"tennisThrowPlaceholder":"请输入网球掷远", |
||||
"agilityRun": "4乘10m灵敏折返跑", |
"tenMeterShuttleRun":"十米往返跑", |
||||
"agilityRunPlaceholder": "请输入4乘10m灵敏折返跑", |
"tenMeterShuttleRunPlaceholder":"请输入十米往返跑", |
||||
"balanceBeam": "走平衡木", |
"addPhysicalTest":"添加体测", |
||||
"balanceBeamPlaceholder": "请输入走平衡木", |
"updatePhysicalTest":"编辑体测", |
||||
"tennisThrow": "网球掷远", |
"physicalTestDeleteTips":"确定要删除该数据吗?", |
||||
"tennisThrowPlaceholder": "请输入网球掷远", |
"startDate":"请选择开始时间", |
||||
"tenMeterShuttleRun": "十米往返跑", |
"endDate":"请选择结束时间" |
||||
"tenMeterShuttleRunPlaceholder": "请输入十米往返跑", |
|
||||
"addPhysicalTest": "添加体测", |
|
||||
"updatePhysicalTest": "编辑体测", |
|
||||
"physicalTestDeleteTips": "确定要删除该数据吗?", |
|
||||
"startDate": "请选择开始时间", |
|
||||
"endDate": "请选择结束时间" |
|
||||
} |
} |
||||
@ -0,0 +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":"确定要删除该体测吗?" |
||||
|
} |
||||
@ -0,0 +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":"请选择结束时间" |
||||
|
} |
||||
@ -0,0 +1,339 @@ |
|||||
|
<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> |
||||
@ -0,0 +1,239 @@ |
|||||
|
<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> |
||||
Loading…
Reference in new issue