15 changed files with 1367 additions and 1101 deletions
@ -1,43 +1,37 @@ |
|||
{ |
|||
"id": "体测编号", |
|||
"idPlaceholder": "请输入体测编号", |
|||
"resourceId": "资源ID", |
|||
"resourceIdPlaceholder": "请输入资源ID", |
|||
"studentId": "学员ID", |
|||
"studentIdPlaceholder": "请输入学员ID", |
|||
"height": "身高", |
|||
"heightPlaceholder": "请输入身高", |
|||
"weight": "体重", |
|||
"weightPlaceholder": "请输入体重", |
|||
"coachId": "教练ID", |
|||
"coachIdPlaceholder": "请输入教练ID", |
|||
"createdAt": "创建时间", |
|||
"createdAtPlaceholder": "请输入创建时间", |
|||
"updatedAt": "修改时间", |
|||
"updatedAtPlaceholder": "请输入修改时间", |
|||
"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":"请选择结束时间" |
|||
} |
|||
@ -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":"请选择结束时间" |
|||
} |
|||
@ -1,399 +1,324 @@ |
|||
<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-input |
|||
v-model="formData.resource_id" |
|||
clearable |
|||
:placeholder="t('resourceIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('studentId')" prop="student_id"> |
|||
<el-input |
|||
v-model="formData.student_id" |
|||
clearable |
|||
:placeholder="t('studentIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</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-input |
|||
v-model="formData.coach_id" |
|||
clearable |
|||
:placeholder="t('coachIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</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> |
|||
|
|||
<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, |
|||
} from '@/app/api/physical_test' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
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 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' }, |
|||
], |
|||
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 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 setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
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> |
|||
|
|||
@ -1,428 +1,204 @@ |
|||
<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-input |
|||
v-model="physicalTestTable.searchParam.resource_id" |
|||
:placeholder="t('resourceIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('studentId')" prop="student_id"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.student_id" |
|||
:placeholder="t('studentIdPlaceholder')" |
|||
/> |
|||
</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 :label="t('weight')" prop="weight"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.weight" |
|||
:placeholder="t('weightPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('coachId')" prop="coach_id"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.coach_id" |
|||
:placeholder="t('coachIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('createdAt')" prop="created_at"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.created_at" |
|||
:placeholder="t('createdAtPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('updatedAt')" prop="updated_at"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.updated_at" |
|||
:placeholder="t('updatedAtPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item |
|||
:label="t('seatedForwardBend')" |
|||
prop="seated_forward_bend" |
|||
> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.seated_forward_bend" |
|||
:placeholder="t('seatedForwardBendPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('sitUps')" prop="sit_ups"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.sit_ups" |
|||
:placeholder="t('sitUpsPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('pushUps')" prop="push_ups"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.push_ups" |
|||
:placeholder="t('pushUpsPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('flamingoBalance')" prop="flamingo_balance"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.flamingo_balance" |
|||
:placeholder="t('flamingoBalancePlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('thirtySecJump')" prop="thirty_sec_jump"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.thirty_sec_jump" |
|||
:placeholder="t('thirtySecJumpPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item |
|||
:label="t('standingLongJump')" |
|||
prop="standing_long_jump" |
|||
> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.standing_long_jump" |
|||
:placeholder="t('standingLongJumpPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('agilityRun')" prop="agility_run"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.agility_run" |
|||
:placeholder="t('agilityRunPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('balanceBeam')" prop="balance_beam"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.balance_beam" |
|||
:placeholder="t('balanceBeamPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('tennisThrow')" prop="tennis_throw"> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.tennis_throw" |
|||
:placeholder="t('tennisThrowPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item |
|||
:label="t('tenMeterShuttleRun')" |
|||
prop="ten_meter_shuttle_run" |
|||
> |
|||
<el-input |
|||
v-model="physicalTestTable.searchParam.ten_meter_shuttle_run" |
|||
:placeholder="t('tenMeterShuttleRunPlaceholder')" |
|||
/> |
|||
</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" |
|||
:label="t('resourceId')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="student_id" |
|||
: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" |
|||
:label="t('coachId')" |
|||
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 |
|||
prop="seated_forward_bend" |
|||
:label="t('seatedForwardBend')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="sit_ups" |
|||
:label="t('sitUps')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="push_ups" |
|||
:label="t('pushUps')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="flamingo_balance" |
|||
:label="t('flamingoBalance')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="thirty_sec_jump" |
|||
:label="t('thirtySecJump')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="standing_long_jump" |
|||
:label="t('standingLongJump')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="agility_run" |
|||
:label="t('agilityRun')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="balance_beam" |
|||
:label="t('balanceBeam')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="tennis_throw" |
|||
:label="t('tennisThrow')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="ten_meter_shuttle_run" |
|||
:label="t('tenMeterShuttleRun')" |
|||
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, |
|||
} 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: '', |
|||
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 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 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> |
|||
|
|||
@ -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