From 03ad85478f4480e12081dab41b8ab3b4de9fce06 Mon Sep 17 00:00:00 2001 From: YuNan <3194726156@qq.com> Date: Thu, 24 Oct 2024 18:56:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97=E6=AE=B5id?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BAcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cet/cet-location/CetLocation.data.ts | 59 +++-- .../cet/cet-location/CetLocationList.vue | 6 +- .../components/CetLocationForm.vue | 124 +++++----- src/views/cet/cet-student-query.vue | 14 +- src/views/cet/cet-student/Cet4MajorList.vue | 2 +- .../cet/data-import/cet6-data-import.vue | 233 ++++++++++++++++++ 6 files changed, 335 insertions(+), 103 deletions(-) diff --git a/src/views/cet/cet-location/CetLocation.data.ts b/src/views/cet/cet-location/CetLocation.data.ts index 8ae7cd9..9320f36 100644 --- a/src/views/cet/cet-location/CetLocation.data.ts +++ b/src/views/cet/cet-location/CetLocation.data.ts @@ -1,24 +1,24 @@ -import {BasicColumn} from '/@/components/Table'; -import {FormSchema} from '/@/components/Table'; -import { rules} from '/@/utils/helper/validator'; +import { BasicColumn } from '/@/components/Table'; +import { FormSchema } from '/@/components/Table'; +import { rules } from '/@/utils/helper/validator'; import { render } from '/@/utils/common/renderUtils'; //列表数据 export const columns: BasicColumn[] = [ - { + { title: '考场名称', - align:"center", - dataIndex: 'locationName' - }, + align: 'center', + dataIndex: 'locationName', + }, // { // title: '父节点id', // align:"center", // dataIndex: 'parentLocationId' // }, - { + { title: '考场人数', - align:"center", - dataIndex: 'personNumber' - }, + align: 'center', + dataIndex: 'personNumber', + }, // { // title: '排序号', // align:"center", @@ -47,37 +47,36 @@ export const formSchema: FormSchema[] = [ }, { label: '考场人数', - field: 'personNumber', - component: 'Input', - + field: 'personNumber', + component: 'Input', }, { label: '排序号', field: 'sortNumber', component: 'InputNumber', - show: false + show: false, + }, + // TODO 主键隐藏字段,目前写死为ID + { + label: '', + field: 'id', + component: 'Input', + show: false, }, - // TODO 主键隐藏字段,目前写死为ID - { - label: '', - field: 'id', - component: 'Input', - show: false - }, ]; // 高级查询数据 export const superQuerySchema = { - locationName: {title: '存放地名称',order: 0,view: 'text', type: 'string',}, - parentLocationId: {title: '父节点id',order: 1,view: 'text', type: 'string',}, - sortNumber: {title: '排序号',order: 2,view: 'number', type: 'number',}, + locationName: { title: '存放地名称', order: 0, view: 'text', type: 'string' }, + parentLocationId: { title: '父节点id', order: 1, view: 'text', type: 'string' }, + sortNumber: { title: '排序号', order: 2, view: 'number', type: 'number' }, }; /** -* 流程表单调用这个方法获取formSchema -* @param param -*/ -export function getBpmFormSchema(_formData): FormSchema[]{ + * 流程表单调用这个方法获取formSchema + * @param param + */ +export function getBpmFormSchema(_formData): FormSchema[] { // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema return formSchema; -} \ No newline at end of file +} diff --git a/src/views/cet/cet-location/CetLocationList.vue b/src/views/cet/cet-location/CetLocationList.vue index 9b5064a..95749a3 100644 --- a/src/views/cet/cet-location/CetLocationList.vue +++ b/src/views/cet/cet-location/CetLocationList.vue @@ -118,7 +118,7 @@ //将其切分为字符串 selectedRowKeys = selectedRowKeys.join(','); console.log(selectedRowKeys); - queryParam.id = selectedRowKeys; + queryParam.code = selectedRowKeys; reload(); } /** @@ -154,13 +154,13 @@ * 删除事件 */ async function handleDelete(record) { - await deleteOne({ id: record.id }, handleSuccess); + await deleteOne({ code: record.code }, handleSuccess); } /** * 批量删除事件 */ async function batchHandleDelete() { - await batchDelete({ ids: selectedRowKeys.value }, handleSuccess); + await batchDelete({ codes: selectedRowKeys.value }, handleSuccess); } /** * 成功回调 diff --git a/src/views/cet/cet-location/components/CetLocationForm.vue b/src/views/cet/cet-location/components/CetLocationForm.vue index a715383..ccd1637 100644 --- a/src/views/cet/cet-location/components/CetLocationForm.vue +++ b/src/views/cet/cet-location/components/CetLocationForm.vue @@ -1,70 +1,70 @@ \ No newline at end of file + return true; + }); + + let formData = {}; + const queryByIdUrl = '/CET/cetLocation/queryById'; + async function initFormData() { + let params = { code: props.formData.dataId }; + const data = await defHttp.get({ url: queryByIdUrl, params }); + formData = { ...data }; + //设置表单的值 + await setFieldsValue(formData); + //默认是禁用 + await setProps({ disabled: formDisabled.value }); + } + + async function submitForm() { + let data = getFieldsValue(); + let params = Object.assign({}, formData, data); + console.log('表单数据', params); + await saveOrUpdate(params, true); + } + + initFormData(); + + return { + registerForm, + formDisabled, + submitForm, + }; + }, + }); + diff --git a/src/views/cet/cet-student-query.vue b/src/views/cet/cet-student-query.vue index ef222fb..6c77eba 100644 --- a/src/views/cet/cet-student-query.vue +++ b/src/views/cet/cet-student-query.vue @@ -6,8 +6,8 @@ - - + + 查询 @@ -23,7 +23,7 @@ 学生姓名:{{ tableData[tableData.length - 1]?.name }} - 学生学号:{{ tableData[tableData.length - 1]?.id }} + 学生学号:{{ tableData[tableData.length - 1]?.code }} 所在学院:{{ tableData[tableData.length - 1]?.college }} @@ -46,12 +46,12 @@ import type { Rule } from 'ant-design-vue/es/form'; interface FormState { name: string; - id: string; + code: string; } const search: UnwrapRef = reactive({ name: '', - id: '', + code: '', }); const isShow = ref(false); const loading = ref(false); @@ -90,7 +90,7 @@ ]); const rules: Record = { name: [{ required: true, message: '请输入学生姓名', trigger: 'change' }], - id: [{ required: true, message: '请输入学生学号', trigger: 'change' }], + code: [{ required: true, message: '请输入学生学号', trigger: 'change' }], }; const url = ref({ getData: '/cet_4/getDataByStudent', @@ -116,7 +116,7 @@ }; const handleClear = () => { search.name = ''; - search.id = ''; + search.code = ''; isShow.value = false; tableData.value = []; }; diff --git a/src/views/cet/cet-student/Cet4MajorList.vue b/src/views/cet/cet-student/Cet4MajorList.vue index 78114a9..bac8fd6 100644 --- a/src/views/cet/cet-student/Cet4MajorList.vue +++ b/src/views/cet/cet-student/Cet4MajorList.vue @@ -1,6 +1,6 @@