|
|
|
@ -92,98 +92,22 @@ |
|
|
|
|
</a-row> |
|
|
|
|
|
|
|
|
|
<a-row> |
|
|
|
|
|
|
|
|
|
<a-col :span="12" v-if="formData.entryForm==='Y'"> |
|
|
|
|
<a-form-item label="队伍人数" v-bind="validateInfos.teamNumber"> |
|
|
|
|
<a-input-number v-model:value="formData.teamNumber" placeholder="请输入队伍人数" |
|
|
|
|
style="width: 100%" :disabled="disabled"/> |
|
|
|
|
<a-button @click="showModel">队伍比值配置</a-button> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
<a-col :span="12" v-if="formData.entryForm==='Y'"> |
|
|
|
|
<a-form-item label="指导老师人数" v-bind="validateInfos.teacherNumber"> |
|
|
|
|
<a-input-number v-model:value="formData.teacherNumber" placeholder="请输入指导老师人数" |
|
|
|
|
style="width: 100%" :disabled="disabled"/> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
</a-row> |
|
|
|
|
|
|
|
|
|
<!-- |
|
|
|
|
<a-row v-if="formData.entryForm ==='Y'"> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="队伍第1编号" > |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqFirst" placeholder="请输入队伍第1编号" style="width: 100%" disabled/> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="第1编号比值" v-bind="formData.teamSeqFirstVal"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqFirstVal" placeholder="请输入第1编号比值" |
|
|
|
|
style="width: 100%" /> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
</a-row> |
|
|
|
|
|
|
|
|
|
<a-row v-if="formData.entryForm ==='Y'"> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="队伍第2编号" v-bind="formData.teamSeqSecond"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqSecond" placeholder="请输入队伍第2编号" style="width: 100%" disabled/> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="第2编号比值" v-bind="formData.teamSeqSecondVal"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqSecondVal" placeholder="请输入第2编号比值" |
|
|
|
|
style="width: 100%" /> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
</a-row> |
|
|
|
|
|
|
|
|
|
<a-row v-if="formData.entryForm ==='Y'"> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="队伍第3编号" v-bind="formData.teamSeqThird"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqThird" placeholder="请输入队伍第3编号" style="width: 100%" disabled/> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="第3编号比值" v-bind="formData.teamSeqThirdVal"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqThirdVal" placeholder="请输入第3编号比值" |
|
|
|
|
style="width: 100%" /> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
</a-row> |
|
|
|
|
<a-row v-if="formData.entryForm ==='Y'"> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="队伍第4编号" v-bind="formData.teamSeqFourth"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqFourth" placeholder="请输入队伍第4编号" style="width: 100%" disabled/> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="第4编号比值" v-bind="formData.teamSeqFourthVal"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqFourthVal" placeholder="请输入第4编号比值" |
|
|
|
|
style="width: 100%" /> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
</a-row> |
|
|
|
|
<a-row v-if="formData.entryForm ==='Y'"> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="队伍第5编号" v-bind="formData.teamSeqFifth"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqFifth" placeholder="请输入队伍第5编号" style="width: 100%" disabled/> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
<a-col :span="12"> |
|
|
|
|
<a-form-item label="第5编号比值" v-bind="formData.teamSeqFifthVal"> |
|
|
|
|
<a-input-number v-model:value="formData.teamSeqFifthVal" placeholder="请输入第5编号比值" |
|
|
|
|
style="width: 100%" /> |
|
|
|
|
<a-col :span="12" v-if="formData.entryForm==='Y'"> |
|
|
|
|
<a-form-item label="队伍人数" v-bind="validateInfos.teamNumber"> |
|
|
|
|
<a-input-number v-model:value="formData.teamNumber" placeholder="请输入队伍人数" |
|
|
|
|
style="width: 100%" :disabled="disabled"/> |
|
|
|
|
<a-button @click="showModel" type="primary">配置队伍位次比值</a-button> |
|
|
|
|
</a-form-item> |
|
|
|
|
</a-col> |
|
|
|
|
</a-row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--> |
|
|
|
|
|
|
|
|
|
<a-row> |
|
|
|
|
|
|
|
|
|
<a-col :span="5"> |
|
|
|
|
<a-form-item label="是否报名" v-bind="validateInfos.requireApply" :labelCol="labelCol4" |
|
|
|
|
:wrapperCol="wrapperCol4"> |
|
|
|
@ -319,7 +243,8 @@ |
|
|
|
|
@register="register" |
|
|
|
|
title="比值配置" |
|
|
|
|
:height="800" |
|
|
|
|
@ok="handleOk" |
|
|
|
|
:width="800" |
|
|
|
|
:footer="null" |
|
|
|
|
> |
|
|
|
|
<!-- <div v-for="(item,index) in num" :key="index">--> |
|
|
|
|
<!-- <a-input-number v-model="item.index"></a-input-number>--> |
|
|
|
@ -330,17 +255,18 @@ |
|
|
|
|
|
|
|
|
|
<!-- <a-button type="primary" @click="setModalProps">从内部修改title</a-button>--> |
|
|
|
|
<JVxeTable |
|
|
|
|
ref="tableRef" |
|
|
|
|
stripe |
|
|
|
|
toolbar |
|
|
|
|
:toolbarConfig="toolbarConfig" |
|
|
|
|
rowNumber |
|
|
|
|
rowSelection |
|
|
|
|
rowExpand |
|
|
|
|
resizable |
|
|
|
|
:maxHeight="480" |
|
|
|
|
keepSource |
|
|
|
|
asyncRemove |
|
|
|
|
:height="340" |
|
|
|
|
:loading="loading" |
|
|
|
|
:columns="columns" |
|
|
|
|
:dataSource="dataSource" |
|
|
|
|
@save="handleTableSave" |
|
|
|
|
@removed="handleTableRemove" |
|
|
|
|
/> |
|
|
|
|
</BasicModal> |
|
|
|
|
</template> |
|
|
|
@ -364,62 +290,43 @@ const disableSubmit = ref<boolean>(false); |
|
|
|
|
const realForm = ref(); |
|
|
|
|
import {JVxeTable} from '/@/components/jeecg/JVxeTable'; |
|
|
|
|
import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types'; |
|
|
|
|
import {result} from "lodash-es"; |
|
|
|
|
// 是否正在加载 |
|
|
|
|
const loading = ref(false); |
|
|
|
|
// 分页器参数 |
|
|
|
|
const pagination = reactive({ |
|
|
|
|
// 当前页码 |
|
|
|
|
current: 1, |
|
|
|
|
// 每页的条数 |
|
|
|
|
pageSize: 200, |
|
|
|
|
// 可切换的条数 |
|
|
|
|
pageSizeOptions: ['10', '20', '30', '100', '200'], |
|
|
|
|
// 数据总数(目前并不知道真实的总数,所以先填写0,在后台查出来后再赋值) |
|
|
|
|
total: 0, |
|
|
|
|
}); |
|
|
|
|
// 选择的行 |
|
|
|
|
const selectedRows = ref<Recordable[]>([]); |
|
|
|
|
// 数据源,控制表格的数据 |
|
|
|
|
const dataSource = ref<Recordable[]>([]); |
|
|
|
|
// 工具栏的按钮配置 |
|
|
|
|
const toolbarConfig = reactive({ |
|
|
|
|
// add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮 |
|
|
|
|
btn: ['add', 'save', 'remove', 'clearSelection'], |
|
|
|
|
}); |
|
|
|
|
// 列配置,控制表格显示的列 |
|
|
|
|
const columns = ref<JVxeColumn[]>([ |
|
|
|
|
// { key: 'num', title: '序号', width: 80, type: JVxeTypes.normal }, |
|
|
|
|
{ key: 'teamSeqFirst', title: '序号1', width: 80, type: JVxeTypes.normal }, |
|
|
|
|
// { key: 'pointId', title: '项目id', width: 80, type: JVxeTypes.hidden,}, |
|
|
|
|
{ key: 'teamSeq', title: '位次号', width: 180, type: JVxeTypes.inputNumber, |
|
|
|
|
placeholder: '请输入${title}', |
|
|
|
|
validateRules: [ |
|
|
|
|
{ |
|
|
|
|
required: true, // 必填 |
|
|
|
|
message: '请输入${title}', // 显示的文本 |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '比值', |
|
|
|
|
key: 'teamSeqFirstVal', |
|
|
|
|
type: JVxeTypes.input, |
|
|
|
|
key: 'teamSeqVal', |
|
|
|
|
type: JVxeTypes.inputNumber, |
|
|
|
|
width: 180, |
|
|
|
|
defaultValue: '', |
|
|
|
|
defaultValue: 100, |
|
|
|
|
placeholder: '请输入${title}', |
|
|
|
|
validateRules: [ |
|
|
|
|
{ |
|
|
|
|
required: true, // 必填 |
|
|
|
|
message: '请输入${title}', // 显示的文本 |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// pattern: /^[a-z|A-Z][a-z|A-Z\d_-]*$/, // 正则 |
|
|
|
|
// message: '必须以字母开头,可包含数字、下划线、横杠', |
|
|
|
|
// }, |
|
|
|
|
// { |
|
|
|
|
// unique: true, |
|
|
|
|
// message: '${title}不能重复', |
|
|
|
|
// }, |
|
|
|
|
{ |
|
|
|
|
handler({cellValue, row, column}, callback, target) { |
|
|
|
|
// cellValue 当前校验的值 |
|
|
|
|
// callback(flag, message) 方法必须执行且只能执行一次 |
|
|
|
|
// flag = 是否通过了校验,不填写或者填写 null 代表不进行任何操作 |
|
|
|
|
// message = 提示的类型,默认使用配置的 message |
|
|
|
|
// target 行编辑的实例对象 |
|
|
|
|
if (cellValue === 'abc') { |
|
|
|
|
callback(false, '${title}不能是abc') // false = 未通过校验 |
|
|
|
|
} else { |
|
|
|
|
callback(true) // true = 通过验证 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
message: '${title}默认提示', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
]) |
|
|
|
@ -434,12 +341,11 @@ enum Api { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 加载数据 |
|
|
|
|
async function loadData() { |
|
|
|
|
alert(formData.id) |
|
|
|
|
function loadData() { |
|
|
|
|
// alert(formData.id) |
|
|
|
|
// loading.value = true; |
|
|
|
|
// 调用查询数据接口 |
|
|
|
|
await defHttp |
|
|
|
|
.get({ |
|
|
|
|
defHttp.get({ |
|
|
|
|
// 请求地址 |
|
|
|
|
url: Api.getData, |
|
|
|
|
// // 封装查询条件 |
|
|
|
@ -448,25 +354,19 @@ async function loadData() { |
|
|
|
|
// pageNo: pagination.current, |
|
|
|
|
// pageSize: pagination.pageSize, |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
.then((result) => { |
|
|
|
|
}).then((result) => { |
|
|
|
|
// 后台查询回来的 total,数据总数量 |
|
|
|
|
// pagination.total = result.total; |
|
|
|
|
// 将查询的数据赋值给 dataSource |
|
|
|
|
dataSource.value = result.records; |
|
|
|
|
// 重置选择 |
|
|
|
|
selectedRows.value = []; |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
}).finally(() => { |
|
|
|
|
// 这里是无论成功或失败都会执行的方法,在这里关闭loading |
|
|
|
|
loading.value = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function handleOk() { |
|
|
|
|
alert("handleOk") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function handleTableSave({$table, target}) { |
|
|
|
|
// 校验整个表格 |
|
|
|
|
$table.validate().then((errMap) => { |
|
|
|
@ -474,30 +374,53 @@ function handleTableSave({$table, target}) { |
|
|
|
|
if (!errMap) { |
|
|
|
|
// 获取所有数据 |
|
|
|
|
let tableData = target.getTableData(); |
|
|
|
|
console.log('当前保存的数据是:', tableData); |
|
|
|
|
// console.log('$table:', $table); |
|
|
|
|
// console.log('target:', target); |
|
|
|
|
console.log('当前保存的数据(tableData)是:', JSON.stringify(tableData)); |
|
|
|
|
tableData.forEach(item => { |
|
|
|
|
item.pointId = formData.id |
|
|
|
|
}) |
|
|
|
|
// 获取新增的数据 |
|
|
|
|
let newData = target.getNewData(); |
|
|
|
|
console.log('-- 新增的数据:', newData); |
|
|
|
|
// 获取删除的数据 |
|
|
|
|
let deleteData = target.getDeleteData(); |
|
|
|
|
console.log('-- 删除的数据:', deleteData); |
|
|
|
|
// let newData = target.getNewData(); |
|
|
|
|
// console.log('-- 新增的数据:', newData); |
|
|
|
|
// for (let itemindex = 0; itemindex < newData.length; itemindex++) { |
|
|
|
|
// this.$set(jsonObject, newData[itemindex].key+"", newData[itemindex].value+""); |
|
|
|
|
// } |
|
|
|
|
// 【模拟保存】 |
|
|
|
|
loading.value = true; |
|
|
|
|
// loading.value = true; |
|
|
|
|
defHttp |
|
|
|
|
.post({ |
|
|
|
|
url: Api.saveAll, |
|
|
|
|
params: tableData, |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
createMessage.success(`保存成功!`); |
|
|
|
|
// createMessage.success(`保存成功!`); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
loading.value = false; |
|
|
|
|
// loading.value = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 触发单元格删除事件 |
|
|
|
|
function handleTableRemove(event) { |
|
|
|
|
// 把 event.deleteRows 传给后台进行删除(注意:这里不会传递前端逻辑新增的数据,因为不需要请求后台删除) |
|
|
|
|
console.log('待删除的数据: ', event.deleteRows); |
|
|
|
|
// 也可以只传ID,因为可以根据ID删除 |
|
|
|
|
let deleteIds = event.deleteRows.map((row) => row.id); |
|
|
|
|
console.log('待删除的数据ids: ', deleteIds); |
|
|
|
|
|
|
|
|
|
// 模拟请求后台删除 |
|
|
|
|
loading.value = true; |
|
|
|
|
window.setTimeout(() => { |
|
|
|
|
loading.value = false; |
|
|
|
|
createMessage.success('删除成功'); |
|
|
|
|
// 假设后台返回删除成功,必须要调用 confirmRemove() 方法,才会真正在表格里移除(会同时删除选中的逻辑新增的数据) |
|
|
|
|
event.confirmRemove(); |
|
|
|
|
}, 1000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
|
// objLevelll: { type: Array, default: () => [] }, |
|
|
|
|
formDisabled: {type: Boolean, default: false}, |
|
|
|
@ -511,10 +434,7 @@ const [register, {openModal}] = useModal(); |
|
|
|
|
// const [register, { closeModal, setModalProps,openModal }] = useModalInner(); |
|
|
|
|
const showModel = () => { |
|
|
|
|
loadData(); |
|
|
|
|
|
|
|
|
|
openModal() |
|
|
|
|
|
|
|
|
|
// console.log(1111) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let num = ref([ |
|
|
|
@ -567,16 +487,6 @@ const formData = reactive<Record<string, any>>({ |
|
|
|
|
uploadEndTime: '', |
|
|
|
|
scoreStartTime: '', |
|
|
|
|
scoreEndTime: '', |
|
|
|
|
teamSeqFirst: 1, |
|
|
|
|
teamSeqSecond: 2, |
|
|
|
|
teamSeqThird: 3, |
|
|
|
|
teamSeqFourth: 4, |
|
|
|
|
teamSeqFifth: 5, |
|
|
|
|
teamSeqFifthVal: '', |
|
|
|
|
teamSeqFourthVal: '', |
|
|
|
|
teamSeqThirdVal: '', |
|
|
|
|
teamSeqSecondVal: '', |
|
|
|
|
teamSeqFirstVal: '', |
|
|
|
|
}); |
|
|
|
|
const {createMessage} = useMessage(); |
|
|
|
|
const labelCol = ref<any>({xs: {span: 24}, sm: {span: 6}}); |
|
|
|
|