This commit is contained in:
zhouwentao 2024-03-26 19:34:43 +08:00
parent 525ba6f454
commit dd189f26a6
22 changed files with 2942 additions and 765 deletions

View File

@ -10,8 +10,10 @@ VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http
#后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot/
#VITE_GLOB_DOMAIN_URL=http://localhost:9999
#后台接口父地址(必填)
VITE_GLOB_API_URL=http://localhost:8080/jeecg-boot/
#VITE_GLOB_API_URL=http://localhost:9999
# 接口前缀
VITE_GLOB_API_URL_PREFIX=

View File

@ -167,7 +167,8 @@
</div>
<script type="module" src="/src/main.ts"></script>
<!-- 百度统计 -->
<script>
<!--去除百度统计-->
<!-- <script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
@ -175,7 +176,7 @@
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</script>-->
</body>
</html>

View File

@ -10,8 +10,11 @@ export const columns: BasicColumn[] = [
dataIndex: 'title'
},
{
title: '文章类型(1.招生章程)',
title: '文章类型',
align: "center",
customRender:({text}) =>{
return !text?"":(text==='1'?'招生章程':text==='2'?'高考动态':'校内资讯')
},
dataIndex: 'type'
},
{

View File

@ -9,9 +9,12 @@
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="文章类型(1.招生章程)" v-bind="validateInfos.type">
<a-input v-model:value="formData.type" placeholder="请输入文章类型(1.招生章程)"
:disabled="disabled"></a-input>
<a-form-item label="文章类型">
<a-radio-group v-model:value="formData.type" button-style="solid" :disabled="disabled">
<a-radio-button value="1">招生章程</a-radio-button>
<a-radio-button value="2">高考动态</a-radio-button>
<a-radio-button value="3">校内资讯</a-radio-button>
</a-radio-group>
</a-form-item>
</a-col>
<a-col :span="24">
@ -84,7 +87,7 @@ const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
title: '',
type: '',
type: '1',
schoolId: '',
schoolName: '',
author: '',

View File

@ -7,138 +7,117 @@ export const columns: BasicColumn[] = [
{
title: '学校代码',
align:"center",
dataIndex: 'schoolCode',
width: 150
dataIndex: 'schoolCode'
},
{
title: '院校代码',
align:"center",
dataIndex: 'institutionCode',
width: 150
dataIndex: 'institutionCode'
},
{
title: '学校名称',
align:"center",
dataIndex: 'schoolName',
width: 150
dataIndex: 'schoolName'
},
{
title: '专业代码',
align:"center",
dataIndex: 'majorCode',
width: 150
dataIndex: 'majorCode'
},
{
title: '专业名称',
align:"center",
dataIndex: 'majorName',
width: 150
dataIndex: 'majorName'
},
{
title: '专业类型',
align:"center",
dataIndex: 'majorType',
width: 150
dataIndex: 'majorType'
},
{
title: '专业类别子级',
align:"center",
dataIndex: 'majorTypeChild',
width: 150
dataIndex: 'majorTypeChild'
},
{
title: '年份',
align:"center",
dataIndex: 'year',
width: 150
dataIndex: 'year'
},
{
title: '科类(文科/理科)',
align:"center",
dataIndex: 'category',
width: 150
dataIndex: 'category'
},
{
title: '录取方式',
align:"center",
dataIndex: 'rulesEnrollProbability',
width: 150
dataIndex: 'rulesEnrollProbability'
},
{
title: '录取概率计算规则运算符',
align:"center",
dataIndex: 'probabilityOperator',
width: 150
dataIndex: 'probabilityOperator'
},
{
title: '省控线',
align:"center",
dataIndex: 'controlLine',
width: 150
dataIndex: 'controlLine'
},
{
title: '录取线',
align:"center",
dataIndex: 'admissionLine',
width: 150
dataIndex: 'admissionLine'
},
{
title: '招生人数',
align:"center",
dataIndex: 'enrollNum',
width: 150
dataIndex: 'enrollNum'
},
{
title: '实际投档人数',
align:"center",
dataIndex: 'actualPitcherNum',
width: 150
dataIndex: 'actualPitcherNum'
},
{
title: '录取数',
align:"center",
dataIndex: 'admissionNum',
width: 150
dataIndex: 'admissionNum'
},
{
title: '一志愿录取数',
align:"center",
dataIndex: 'oneVolunteerAdmissionNum',
width: 150
dataIndex: 'oneVolunteerAdmissionNum'
},
{
title: '最低分数差',
align:"center",
dataIndex: 'scoreLineDifference',
width: 150
dataIndex: 'scoreLineDifference'
},
{
title: '备注',
align:"center",
dataIndex: 'detail',
width: 150
dataIndex: 'detail'
},
{
title: '批次',
align:"center",
dataIndex: 'batch',
width: 150
dataIndex: 'batch'
},
{
title: '招生代码',
align:"center",
dataIndex: 'enrollmentCode',
width: 150
dataIndex: 'enrollmentCode'
},
{
title: '是否使用主项成绩',
align:"center",
dataIndex: 'checkMaster',
width: 150
dataIndex: 'checkMaster'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
@ -261,6 +240,7 @@ export const formSchema: FormSchema[] = [
];
/**
* formSchema
* @param param

View File

@ -0,0 +1,315 @@
<template>
<a-card title="" :bordered="false">
<BasicTable @register="registerTable" @edit-change="onEditChange">
<template #action="{ record, column }">
<TableAction :actions="createActions(record, column)" />
</template>
</BasicTable>
</a-card>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { BasicTable, useTable, TableAction, BasicColumn, ActionItem, EditRecordRow } from '/@/components/Table';
import { optionsListApi } from '/@/api/demo/select';
import { treeOptionsListApi } from '/@/api/demo/tree';
import { cloneDeep } from 'lodash-es';
import { useMessage } from '/@/hooks/web/useMessage';
import {DemoListGetResultModel, DemoParams} from "@/api/demo/model/tableModel";
import {defHttp} from "@/utils/http/axios";
const columns: BasicColumn[] = [
{
title: '学校代码',
align:"center",
dataIndex: 'schoolCode',
editRow: true,
editRule: true,
editComponent: 'InputNumber',
/*editRule: async (text) => {
if (text === '2') {
return '不能输入该值';
}
return '';
},*/
width: 150,
},
{
title: '学校名称',
align:"center",
dataIndex: 'schoolName',
editRow: true,
editRule: true,
width: 150,
},
{
title: '专业代码',
align:"center",
dataIndex: 'majorCode',
editRow: true,
editRule: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '专业名称',
align:"center",
dataIndex: 'majorName'
},
{
title: '招生代码',
align:"center",
dataIndex: 'enrollmentCode',
editRow: true,
editRule: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '专业类型',
align:"center",
dataIndex: 'majorType'
},
{
title: '专业类别子级',
align:"center",
dataIndex: 'majorTypeChild'
},
{
title: '批次',
align:"center",
dataIndex: 'batch',
editRow: true,
editRule: true,
editComponent: 'Input',
width: 150,
},
{
title: '年份',
align:"center",
dataIndex: 'year'
},
{
title: '科类(文科/理科)',
align:"center",
dataIndex: 'category'
},
{
title: '录取方式',
align:"center",
dataIndex: 'rulesEnrollProbability'
},
{
title: '录取概率计算规则运算符',
align:"center",
dataIndex: 'probabilityOperator'
},
{
title: '省控线',
align:"center",
dataIndex: 'controlLine',
editRow: true,
editRule: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '录取线',
align:"center",
dataIndex: 'admissionLine',
editRow: true,
editRule: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '招生人数',
align:"center",
dataIndex: 'enrollNum',
editRow: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '录取数',
align:"center",
dataIndex: 'admissionNum',
editRow: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '一志愿录取数',
align:"center",
dataIndex: 'oneVolunteerAdmissionNum',
editRow: true,
editComponent: 'InputNumber',
width: 150,
},
{
title: '备注',
align:"center",
dataIndex: 'detail',
editRow: true,
editComponent: 'Input',
width: 150,
},
//=================================
/*{
title: '下拉框',
dataIndex: 'name3',
editRow: true,
editComponent: 'Select',
editComponentProps: {options: [{label: 'Option1', value: '1',},{label: 'Option3', value: '3',},],},
width: 200,
},*/
/*{
title: '远程下拉',
dataIndex: 'name4',
editRow: true,
editComponent: 'ApiSelect',
editComponentProps: {api: optionsListApi, resultField: 'list', labelField: 'name', valueField: 'id',},
width: 200,
},*/
{
title: '勾选框',
dataIndex: 'name5',
editRow: true,
editComponent: 'Checkbox',
editValueMap: (value) => {
return value ? '是' : '否';
},
width: 100,
},
{
title: '开关',
dataIndex: 'name6',
editRow: true,
editComponent: 'Switch',
editValueMap: (value) => {
return value ? '开' : '关';
},
width: 100,
},
];
// url
enum Api {
getData = '/yx/yxHistoryMajorEnroll/list',
//
saveRow = '/yx/yxHistoryMajorEnroll/edit',
//
saveAll = '/yx/yxHistoryMajorEnroll/saveBatch',
deleteBatch = '/yx/yxHistoryMajorEnroll/deleteBatch',
importExcel = '/yx/yxHistoryMajorEnroll/importExcel',
exportXls = '/yx/yxHistoryMajorEnroll/exportXls',
}
export const demoListApi = (params: DemoParams) =>
defHttp.get<DemoListGetResultModel>({
url: Api.getData,
params,
headers: {
ignoreCancelToken: true,
},
});
export default defineComponent({
components: { BasicTable, TableAction },
setup() {
const { createMessage: msg } = useMessage();
const currentEditKeyRef = ref('');
const [registerTable] = useTable({
title: '可编辑行示例',
titleHelpMessage: ['本例中修改[数字输入框]这一列时,同一行的[远程下拉]列的当前编辑数据也会同步发生改变'],
api: demoListApi,
columns: columns,
showIndexColumn: false,
showTableSetting: true,
tableSetting: { fullScreen: true },
actionColumn: {
width: 160,
title: 'Action',
dataIndex: 'action',
slots: { customRender: 'action' },
},
});
function handleEdit(record: EditRecordRow) {
currentEditKeyRef.value = record.key;
record.onEdit?.(true);
}
function handleCancel(record: EditRecordRow) {
currentEditKeyRef.value = '';
record.onEdit?.(false, false);
}
async function handleSave(record: EditRecordRow) {
//
msg.loading({ content: '正在保存...', duration: 0, key: 'saving' });
const valid = await record.onValid?.();
if (valid) {
try {
const data = cloneDeep(record.editValueRefs);
console.log(data);
//TODO
// ...
//
const pass = await record.onEdit?.(false, true);
if (pass) {
currentEditKeyRef.value = '';
}
msg.success({ content: '数据已保存', key: 'saving' });
} catch (error) {
msg.error({ content: '保存失败', key: 'saving' });
}
} else {
msg.error({ content: '请填写正确的数据', key: 'saving' });
}
}
function createActions(record: EditRecordRow, column: BasicColumn): ActionItem[] {
if (!record.editable) {
return [
{
label: '编辑',
disabled: currentEditKeyRef.value ? currentEditKeyRef.value !== record.key : false,
onClick: handleEdit.bind(null, record),
},
];
}
return [
{
label: '保存',
onClick: handleSave.bind(null, record, column),
},
{
label: '取消',
popConfirm: {
title: '是否取消编辑',
confirm: handleCancel.bind(null, record, column),
},
},
];
}
function onEditChange({ column, value, record }) {
//
if (column.dataIndex === 'id') {
record.editValueRefs.name4.value = `${value}`;
}
console.log(column, value, record);
}
return {
registerTable,
handleEdit,
createActions,
onEditChange,
};
},
});
</script>

View File

@ -0,0 +1,173 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<YxHistoryMajorEnrollModal @register="registerModal" @success="handleSuccess"></YxHistoryMajorEnrollModal>
</div>
</template>
<script lang="ts" name="yx-yxHistoryMajorEnroll" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import YxHistoryMajorEnrollModal from './components/YxHistoryMajorEnrollModal.vue'
import {columns, searchFormSchema} from './YxHistoryMajorEnroll.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxHistoryMajorEnroll.api';
import { downloadFile } from '/@/utils/common/renderUtils';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '历年录取数据表',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
fixed:'right'
},
},
exportConfig: {
name:"历年录取数据表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

View File

@ -1,223 +0,0 @@
<template>
<div>
<a-table :columns="listColumns" :data-source="dataSource" bordered :scroll="{ x: 1500, y: 1000 }">
<template #bodyCell="{ column, text, record }">
<template v-if="['schoolCode', 'institutionCode', 'schoolName'].includes(column.dataIndex)">
<div>
<a-input
v-if="editableData[record.key]"
v-model:value="editableData[record.key][column.dataIndex]"
style="margin: -5px 0"
/>
<template v-else>
{{ text }}
</template>
</div>
</template>
<template v-else-if="column.dataIndex === 'operation'" >
<div class="editable-row-operations">
<span v-if="editableData[record.key]">
<a-typography-link @click="save(record.key)">确认</a-typography-link>
<a-popconfirm title="确认取消?" @confirm="cancel(record.key)">
<a>取消</a>
</a-popconfirm>
</span>
<span v-else>
<a @click="edit(record.id)">编辑</a>
</span>
</div>
</template>
</template>
</a-table>
<!-- 表单区域 -->
<YxHistoryMajorEnrollModal @register="registerModal"
@success="handleSuccess"></YxHistoryMajorEnrollModal>
</div>
</template>
<script lang="ts" name="yx-yxHistoryMajorEnroll" setup>
import {cloneDeep} from 'lodash-es';
import {reactive, ref, onMounted} from 'vue';
import type {UnwrapRef} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import {useListPage} from '/@/hooks/system/useListPage'
import YxHistoryMajorEnrollModal from './components/YxHistoryMajorEnrollModal.vue'
import {columns, searchFormSchema} from './YxHistoryMajorEnroll.data';
import {list, deleteOne, batchDelete, getImportUrl, getExportUrl} from './YxHistoryMajorEnroll.api';
import {downloadFile} from '/@/utils/common/renderUtils';
import {defHttp} from "@/utils/http/axios";
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const {prefixCls, tableContext, onExportXls, onImportXls} = useListPage({
tableProps: {
title: '历年录取数据表',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right'
},
},
exportConfig: {
name: "历年录取数据表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, {reload}, {rowSelection, selectedRowKeys}] = tableContext
interface DataItem {
key: string;
name: string;
age: number;
address: string;
}
const listColumns = [
...columns, ...[{
title: '操作',
dataIndex: 'operation',
fixed: 'right',
width: 150
},]
]
const editableData: UnwrapRef<Record<string, DataItem>> = reactive({});
const dataSource = ref();
onMounted(() => {
getData()
})
const getData = () => {
dataSource.value = []
defHttp.get({url: '/yx/yxHistoryMajorEnroll/list'})
.then((res) => {
console.log(res)
dataSource.value = res.records
});
}
const edit = (key: string) => {
editableData[key] = cloneDeep(dataSource.value.filter(item => key === item.id)[0]);
};
const save = (key: string) => {
Object.assign(dataSource.value.filter(item => key === item.key)[0], editableData[key]);
delete editableData[key];
};
const cancel = (key: string) => {
delete editableData[key];
};
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

View File

@ -1,173 +1,557 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<YxHistoryMajorEnrollModal @register="registerModal" @success="handleSuccess"></YxHistoryMajorEnrollModal>
</div>
<a-card title="" :bordered="false">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam"
:label-col="labelCol" :wrapper-col="wrapperCol">
<a-row>
<a-col :span="3">
<a-form-item label="年份">
<a-input v-model:value="queryParam.year" placeholder="请输入年份" allowClear/>
</a-form-item>
</a-col>
<a-col :span="4">
<a-form-item label="学校代码">
<a-input v-model:value="queryParam.schoolCode" placeholder="请输入学校代码" allowClear/>
</a-form-item>
</a-col>
<a-col :span="4">
<a-form-item label="专业名称">
<a-input v-model:value="queryParam.majorName" placeholder="请输入专业名称" allowClear/>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="专业类别" name="majorType">
<a-select v-model:value="queryParam.majorType" show-search allow-clear
placeholder="请选择专业类别">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="音乐类">音乐类</a-select-option>
<a-select-option value="表演类">表演类</a-select-option>
<a-select-option value="书法类">书法类</a-select-option>
<a-select-option value="舞蹈类">舞蹈类</a-select-option>
<a-select-option value="体育类">体育类</a-select-option>
<a-select-option value="美术与设计类">美术与设计类</a-select-option>
<a-select-option value="播音与主持类">播音与主持类</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="文理分科">
<a-select v-model:value="queryParam.category" show-search allow-clear
placeholder="请选择[文科/理科]">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="文科">文科</a-select-option>
<a-select-option value="理科">理科</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="批次">
<a-select v-model:value="queryParam.batch" show-search allow-clear
placeholder="请选择批次">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="提前批">提前批</a-select-option>
<a-select-option value="本科A段">本科A段</a-select-option>
<a-select-option value="本科B段">本科B段</a-select-option>
<a-select-option value="本科">体育本科</a-select-option>
<a-select-option value="高职高专">高职高专</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="renewControlLine" style="margin-left: 8px">刷新省控线</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="exportXls" style="margin: 8px">导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls" style="margin-left: 8px">导入</j-upload-button>
</a-col>
</a-row>
</a-form>
<JVxeTable
toolbar
:toolbarConfig="toolbarConfig"
rowNumber
rowSelection
keepSource
asyncRemove
:height="500"
:loading="loading"
:columns="columns"
:dataSource="dataSource"
:pagination="pagination"
@save="handleTableSave"
@removed="handleTableRemove"
@edit-closed="handleEditClosed"
@pageChange="handlePageChange"
@selectRowChange="handleSelectRowChange"
/>
</a-card>
</template>
<script lang="ts" name="yx-yxHistoryMajorEnroll" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import YxHistoryMajorEnrollModal from './components/YxHistoryMajorEnrollModal.vue'
import {columns, searchFormSchema} from './YxHistoryMajorEnroll.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxHistoryMajorEnroll.api';
import { downloadFile } from '/@/utils/common/renderUtils';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
<script lang="ts" setup>
//
import {reactive, ref} from 'vue';
import { message } from 'ant-design-vue';
import {defHttp} from '/@/utils/http/axios';
import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types';
import {useMessage} from '/@/hooks/web/useMessage';
import {useListPage} from "@/hooks/system/useListPage";
import {getExportUrl, getImportUrl, list} from "@/views/yx/yxHistoryMajorEnroll/YxHistoryMajorEnroll.api";
import {XLSX_FILE_SUFFIX, XLSX_MIME_TYPE} from "@/hooks/system/useMethods";
const { createMessage, createConfirm, createSuccessModal, createInfoModal, createErrorModal, createWarningModal, notification } = useMessage();
const labelCol = reactive({
xs: {span: 24},
sm: {span: 7},
});
const wrapperCol = reactive({
xs: {span: 24},
sm: {span: 16},
});
//
const toolbarConfig = reactive({
// add remove clearSelection
btn: ['add', 'save', 'remove', 'clearSelection'],
});
//
const loading = ref(false);
//
const queryParam = reactive({
schoolCode: '',//
majorName: '',//
majorType: '',//
category: '',//
year: '',//
})
//
const pagination = reactive({
//
current: 1,
//
pageSize: 10,
//
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0
total: 0,
});
//
const selectedRows = ref<Recordable[]>([]);
//
const dataSource = ref<Recordable[]>([]);
//
const columns = ref<JVxeColumn[]>([
/*{ key: 'num', title: '序号', width: 80, type: JVxeTypes.normal },*/
{
title: '学校代码',
key: 'schoolCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '院校代码',
key: 'institutionCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '学校名称',
key: 'schoolName',
width: 150,
type: JVxeTypes.input,
},
{
title: '专业代码',
key: 'majorCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '专业名称',
key: 'majorName',
width: 200,
type: JVxeTypes.textarea,
},
{
title: '招生代码',
key: 'enrollmentCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '专业类型',
key: 'majorType',
width: 130,
type: JVxeTypes.input,
},
{
title: '专业类别子级',
key: 'majorTypeChild',
width: 130,
type: JVxeTypes.input,
},
{
title: '主考科目',
key: 'mainSubjects',
width: 130,
type: JVxeTypes.input,
},
{
title: '年份',
key: 'year',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '科类(文科/理科)',
key: 'category',
width: 100,
type: JVxeTypes.input,
},
{
title: '批次',
key: 'batch',
width: 100,
type: JVxeTypes.input,
},
{
title: '录取方式(文*x+专*y)',
key: 'rulesEnrollProbability',
width: 150,
type: JVxeTypes.input,
},
{
title: '录取概率计算规则运算符',
key: 'probabilityOperator',
width: 150,
type: JVxeTypes.input,
},
{
title: '省控线',
key: 'controlLine',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '录取线',
key: 'admissionLine',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '招生人数',
key: 'enrollNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '实际投档人数',
key: 'actualPitcherNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '录取数',
key: 'admissionNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '一志愿录取数',
key: 'oneVolunteerAdmissionNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '最低分数差',
key: 'scoreLineDifference',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '学费',
key: 'tuition',
width: 200,
type: JVxeTypes.input,
},
{
title: '备注',
key: 'detail',
width: 200,
type: JVxeTypes.textarea,
}
]);
const [messageApi, contextHolder] = message.useMessage();
const { prefixCls,tableContext,onImportXls } = useListPage({
tableProps:{
title: '历年录取数据表',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
fixed:'right'
},
},
exportConfig: {
name:"历年录取数据表",
url: getExportUrl,
},
importConfig:{
url: getImportUrl,
success: handleSuccess
},
}
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
// url
enum Api {
getData = '/yx/yxHistoryMajorEnroll/list',
//
saveRow = '/yx/yxHistoryMajorEnroll/edit',
//
saveAll = '/yx/yxHistoryMajorEnroll/saveBatch',
deleteBatch = '/yx/yxHistoryMajorEnroll/deleteBatch',
importExcel = '/yx/yxHistoryMajorEnroll/importExcel',
exportXls = '/yx/yxHistoryMajorEnroll/exportXls',
renewControlLine = '/yx/yxHistoryMajorEnroll/renewControlLine'
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
loadData();
async function searchQuery() {
pagination.current = 1
loadData()
}
async function searchReset() {
pagination.current = 1
queryParam.schoolCode = ''
queryParam.majorName = ''
queryParam.majorType = ''//
queryParam.category = ''//
queryParam.year = ''
loadData()
}
//
async function loadData() {
loading.value = true;
//
await defHttp
.get({
//
url: Api.getData,
//
params: {
schoolCode: queryParam.schoolCode ? '*' + queryParam.schoolCode + '*' : '',
majorName: queryParam.majorName ? '*' + queryParam.majorName + '*' : '',
majorType: queryParam.majorType,
category: queryParam.category,
year: queryParam.year,
pageNo: pagination.current,
pageSize: pagination.pageSize,
},
})
.then((result) => {
// total
pagination.total = result.total;
// dataSource
dataSource.value = result.records;
//
selectedRows.value = [];
})
.finally(() => {
// loading
loading.value = false;
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
//线
async function renewControlLine(){
console.log('刷新省控线')
let selections = ''
if (selectedRows.value) {
selectedRows.value.forEach(i=>{
selections+=i.id+","
})
console.log(selectedRows.value)
}
createConfirm({
iconType: 'info',
title: '刷新省控线',
content: '将在后台异步执行,根据对应的批次省控线按照录取方式运算符刷新省控线,确认是否执行操作',
onCancel(){
},
onOk() {
console.log('qvq')
return new Promise((resolve, reject) => {
defHttp
.post({
url: Api.renewControlLine,
params: {id:selections},
})
.then((res) => {
if (res.success) {
messageApi.info(res.message);
}else{
messageApi.error(res.message);
}
})
.finally(() => {
setTimeout(Math.random() > 0.5 ? resolve : reject, 800);
});
/*setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);*/
}).catch(() => console.log('Oops errors!'));
/*return new Promise((resolve, reject) => {
}).catch(() => console.log('Oops errors!'));*/
},
});
}
//
function handleTableSave({$table, target}) {
//
$table.validate().then((errMap) => {
//
if (!errMap) {
//
let tableData = target.getTableData();
console.log('当前保存的数据是:', tableData);
//
let newData = target.getNewData();
console.log('-- 新增的数据:', newData);
//
let deleteData = target.getDeleteData();
console.log('-- 删除的数据:', deleteData);
//
loading.value = true;
defHttp
.post({
url: Api.saveAll,
params: tableData,
})
.then(() => {
createMessage.success(`保存成功!`);
})
.finally(() => {
loading.value = false;
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
//
function handleTableRemove(event) {
// event.deleteRows
console.log('待删除的数据: ', event.deleteRows);
// IDID
let deleteIds = event.deleteRows.map((row) => row.id);
console.log('待删除的数据ids: ', deleteIds);
//
loading.value = true;
window.setTimeout(() => {
defHttp
.delete({
url: Api.deleteBatch, data: {ids: deleteIds.join(',')}
}, {joinParamsToUrl: true})
.then((res) => {
createMessage.success('删除成功');
//// confirmRemove()
event.confirmRemove();
})
.finally(() => {
loading.value = false;
});
}, 1000);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
//
function handleEditClosed(event) {
let {$table, row, column} = event;
let field = column.property;
//
if ($table.isUpdateByRow(row, field)) {
//
$table.validate(row).then((errMap) => {
//
if (!errMap) {
//
let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0);
console.log('即时保存数据:', row);
defHttp
.put({
url: Api.saveRow,
params: row,
})
.then((res) => {
createMessage.success(`"${column.title}"保存成功!`);
//
$table.reloadRow(row, null, field);
})
.finally(() => {
hideLoading();
});
}
});
}
}
//
function handlePageChange(event) {
//
pagination.current = event.current;
pagination.pageSize = event.pageSize;
//
loadData();
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
loadData();
}
//
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
/**
* 导出xls
* @param name
* @param url
*/
async function exportXls(isXlsx = false) {
let name = ''
let selections = ''
if (selectedRows.value) {
selectedRows.value.forEach(i=>{
selections+=i.id+","
})
console.log(selectedRows.value)
}
const data = await defHttp.get({ url: Api.exportXls, params: {selections:selections}, responseType: 'blob', timeout: 60000 }, { isTransformResponse: false });
if (!data) {
createMessage.warning('文件下载失败');
return;
}
if (!name || typeof name != 'string') {
name = '导出文件';
}
let blobOptions = { type: 'application/vnd.ms-excel' };
let fileSuffix = '.xls';
if (isXlsx === true) {
blobOptions['type'] = XLSX_MIME_TYPE;
fileSuffix = XLSX_FILE_SUFFIX;
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], blobOptions), name + fileSuffix);
} else {
let url = window.URL.createObjectURL(new Blob([data], blobOptions));
let link = document.createElement('a');
link.style.display = 'none';
link.href = url;
link.setAttribute('download', name + fileSuffix);
document.body.appendChild(link);
link.click();
document.body.removeChild(link); //
window.URL.revokeObjectURL(url); //blob
}
}
</script>
<style scoped>
</style>
<style scoped></style>

View File

@ -0,0 +1,432 @@
<template>
<a-card title="" :bordered="false">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam"
:label-col="labelCol" :wrapper-col="wrapperCol">
<a-row>
<a-col :span="3">
<a-form-item label="年份">
<a-input v-model:value="queryParam.year" placeholder="请输入年份" allowClear/>
</a-form-item>
</a-col>
<a-col :span="4">
<a-form-item label="学校代码">
<a-input v-model:value="queryParam.schoolCode" placeholder="请输入学校代码" allowClear/>
</a-form-item>
</a-col>
<a-col :span="4">
<a-form-item label="专业名称">
<a-input v-model:value="queryParam.majorName" placeholder="请输入专业名称" allowClear/>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="专业类别" name="majorType">
<a-select v-model:value="queryParam.majorType" show-search allow-clear
placeholder="请选择专业类别">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="音乐类">音乐类</a-select-option>
<a-select-option value="表演类">表演类</a-select-option>
<a-select-option value="书法类">书法类</a-select-option>
<a-select-option value="舞蹈类">舞蹈类</a-select-option>
<a-select-option value="体育类">体育类</a-select-option>
<a-select-option value="美术与设计类">美术与设计类</a-select-option>
<a-select-option value="播音与主持类">播音与主持类</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="文理分科">
<a-select v-model:value="queryParam.category" show-search allow-clear
placeholder="请选择[文科/理科]">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="文科">文科</a-select-option>
<a-select-option value="理科">理科</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="批次">
<a-select v-model:value="queryParam.batch" show-search allow-clear
placeholder="请选择批次">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="提前批">提前批</a-select-option>
<a-select-option value="本科A段">本科A段</a-select-option>
<a-select-option value="本科B段">本科B段</a-select-option>
<a-select-option value="本科">体育本科</a-select-option>
<a-select-option value="高职高专">高职高专</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询
</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置
</a-button>
</a-col>
</a-row>
</a-form>
<JVxeTable
toolbar
:toolbarConfig="toolbarConfig"
rowNumber
rowSelection
keepSource
asyncRemove
:height="500"
:loading="loading"
:columns="columns"
:dataSource="dataSource"
:pagination="pagination"
@save="handleTableSave"
@removed="handleTableRemove"
@edit-closed="handleEditClosed"
@pageChange="handlePageChange"
@selectRowChange="handleSelectRowChange"
/>
</a-card>
</template>
<script lang="ts" setup>
//
import {reactive, ref} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types';
import {useMessage} from '/@/hooks/web/useMessage';
const labelCol = reactive({
xs: {span: 24},
sm: {span: 7},
});
const wrapperCol = reactive({
xs: {span: 24},
sm: {span: 16},
});
const {createMessage} = useMessage();
//
const toolbarConfig = reactive({
// add remove clearSelection
btn: ['add', 'save', 'remove', 'clearSelection'],
});
//
const loading = ref(false);
//
const queryParam = reactive({
schoolCode: '',//
majorName: '',//
majorType: '',//
category: '',//
year: '',//
})
//
const pagination = reactive({
//
current: 1,
//
pageSize: 10,
//
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0
total: 0,
});
//
const selectedRows = ref<Recordable[]>([]);
//
const dataSource = ref<Recordable[]>([]);
//
const columns = ref<JVxeColumn[]>([
/*{ key: 'num', title: '序号', width: 80, type: JVxeTypes.normal },*/
{
title: '学校代码',
key: 'schoolCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '院校代码',
key: 'institutionCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '学校名称',
key: 'schoolName',
width: 150,
type: JVxeTypes.input,
},
{
title: '专业代码',
key: 'majorCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '专业名称',
key: 'majorName',
width: 200,
type: JVxeTypes.textarea,
},
{
title: '招生代码',
key: 'enrollmentCode',
width: 100,
type: JVxeTypes.input,
},
{
title: '专业类型',
key: 'majorType',
width: 130,
type: JVxeTypes.input,
},
{
title: '专业类别子级',
key: 'majorTypeChild',
width: 130,
type: JVxeTypes.input,
},
{
title: '年份',
key: 'year',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '科类(文科/理科)',
key: 'category',
width: 100,
type: JVxeTypes.input,
},
{
title: '批次',
key: 'batch',
width: 100,
type: JVxeTypes.input,
},
{
title: '录取方式(文*x+专*y)',
key: 'rulesEnrollProbability',
width: 150,
type: JVxeTypes.input,
},
{
title: '录取概率计算规则运算符',
key: 'probabilityOperator',
width: 150,
type: JVxeTypes.input,
},
{
title: '省控线',
key: 'controlLine',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '录取线',
key: 'admissionLine',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '招生人数',
key: 'enrollNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '实际投档人数',
key: 'actualPitcherNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '录取数',
key: 'admissionNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '一志愿录取数',
key: 'oneVolunteerAdmissionNum',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '最低分数差',
key: 'scoreLineDifference',
width: 100,
type: JVxeTypes.inputNumber,
},
{
title: '备注',
key: 'detail',
width: 200,
type: JVxeTypes.textarea,
}
]);
// url
enum Api {
getData = '/yx/yxHistoryMajorEnroll/list',
//
saveRow = '/yx/yxHistoryMajorEnroll/edit',
//
saveAll = '/yx/yxHistoryMajorEnroll/saveBatch',
deleteBatch = '/yx/yxHistoryMajorEnroll/deleteBatch',
importExcel = '/yx/yxHistoryMajorEnroll/importExcel',
exportXls = '/yx/yxHistoryMajorEnroll/exportXls',
}
loadData();
async function searchQuery() {
pagination.current = 1
loadData()
}
async function searchReset() {
pagination.current = 1
queryParam.schoolCode = ''
queryParam.majorName = ''
queryParam.majorType = ''//
queryParam.category = ''//
queryParam.year = ''
loadData()
}
//
async function loadData() {
loading.value = true;
//
await defHttp
.get({
//
url: Api.getData,
//
params: {
schoolCode: queryParam.schoolCode ? '*' + queryParam.schoolCode + '*' : '',
majorName: queryParam.majorName ? '*' + queryParam.majorName + '*' : '',
majorType: queryParam.majorType,
category: queryParam.category,
year: queryParam.year,
pageNo: pagination.current,
pageSize: pagination.pageSize,
},
})
.then((result) => {
// total
pagination.total = result.total;
// dataSource
dataSource.value = result.records;
//
selectedRows.value = [];
})
.finally(() => {
// loading
loading.value = false;
});
}
//
function handleTableSave({$table, target}) {
//
$table.validate().then((errMap) => {
//
if (!errMap) {
//
let tableData = target.getTableData();
console.log('当前保存的数据是:', tableData);
//
let newData = target.getNewData();
console.log('-- 新增的数据:', newData);
//
let deleteData = target.getDeleteData();
console.log('-- 删除的数据:', deleteData);
//
loading.value = true;
defHttp
.post({
url: Api.saveAll,
params: tableData,
})
.then(() => {
createMessage.success(`保存成功!`);
})
.finally(() => {
loading.value = false;
});
}
});
}
//
function handleTableRemove(event) {
// event.deleteRows
console.log('待删除的数据: ', event.deleteRows);
// IDID
let deleteIds = event.deleteRows.map((row) => row.id);
console.log('待删除的数据ids: ', deleteIds);
//
loading.value = true;
window.setTimeout(() => {
defHttp
.delete({
url: Api.deleteBatch, data: {ids: deleteIds.join(',')}
}, {joinParamsToUrl: true})
.then((res) => {
createMessage.success('删除成功');
//// confirmRemove()
event.confirmRemove();
})
.finally(() => {
loading.value = false;
});
}, 1000);
}
//
function handleEditClosed(event) {
let {$table, row, column} = event;
let field = column.property;
//
if ($table.isUpdateByRow(row, field)) {
//
$table.validate(row).then((errMap) => {
//
if (!errMap) {
//
let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0);
console.log('即时保存数据:', row);
defHttp
.put({
url: Api.saveRow,
params: row,
})
.then((res) => {
createMessage.success(`"${column.title}"保存成功!`);
//
$table.reloadRow(row, null, field);
})
.finally(() => {
hideLoading();
});
}
});
}
}
//
function handlePageChange(event) {
//
pagination.current = event.current;
pagination.pageSize = event.pageSize;
//
loadData();
}
//
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
</script>
<style scoped></style>

View File

@ -0,0 +1,173 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<YxHistoryScoreControlLineModal @register="registerModal" @success="handleSuccess"></YxHistoryScoreControlLineModal>
</div>
</template>
<script lang="ts" name="yx-yxHistoryScoreControlLine" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import YxHistoryScoreControlLineModal from './components/YxHistoryScoreControlLineModal.vue'
import {columns, searchFormSchema} from './YxHistoryScoreControlLine.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxHistoryScoreControlLine.api';
import { downloadFile } from '/@/utils/common/renderUtils';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '历年省控线',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
fixed:'right'
},
},
exportConfig: {
name:"历年省控线",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

View File

@ -5,40 +5,124 @@ import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '学校',
title: '学校代码',
align:"center",
dataIndex: 'schoolCode_dictText'
dataIndex: 'schoolCode'
},
{
title: '专业',
title: '专业代码',
align:"center",
dataIndex: 'majorCode_dictText'
dataIndex: 'majorCode'
},
{
title: '专业名称',
align:"center",
dataIndex: 'majorName'
},
{
title: '招生代码',
align:"center",
dataIndex: 'enrollmentCode'
},
{
title: '学费',
align:"center",
dataIndex: 'tuition'
},
{
title: '备注',
align:"center",
dataIndex: 'detail'
},
{
title: '科类(文科/理科)',
align:"center",
dataIndex: 'category'
},
{
title: '录取方式',
align:"center",
dataIndex: 'rulesEnrollProbability'
},
{
title: '批次',
align:"center",
dataIndex: 'batch'
},
{
title: '(文科)专业代码',
title: '录取概率计算规则运算符',
align:"center",
dataIndex: 'artsMajorCode'
dataIndex: 'probabilityOperator'
},
{
title: '(理科)专业代码',
title: '文化分省控线',
align:"center",
dataIndex: 'scienceMajorCode'
dataIndex: 'culturalControlLine'
},
{
title: '备注',
title: '专项分数线',
align:"center",
dataIndex: 'detail'
dataIndex: 'specialControlLine'
},
{
title: '专业类型',
align:"center",
dataIndex: 'majorType'
},
{
title: '二级专业类型',
align:"center",
dataIndex: 'majorTypeChild'
},
{
title: '计划招生人数',
align:"center",
dataIndex: 'planNum'
},
{
title: '是否使用主项成绩',
align:"center",
dataIndex: 'checkMaster'
},
{
title: '主考科目',
align:"center",
dataIndex: 'mainSubjects'
},
{
title: '学制',
align:"center",
dataIndex: 'semester'
},
{
title: '院校限制',
align:"center",
dataIndex: 'limitation'
},
{
title: '文化分数限制',
align:"center",
dataIndex: 'culturalScoreLimitation'
},
{
title: '专业分数限制',
align:"center",
dataIndex: 'professionalScoreLimitation'
},
{
title: '语文成绩限制',
align:"center",
dataIndex: 'chineseScoreLimitation'
},
{
title: '英语成绩限制',
align:"center",
dataIndex: 'englishScoreLimitation'
},
{
title: '录取方式缩写',
align:"center",
dataIndex: 'rulesEnrollProbabilitySx'
},
];
//查询数据
@ -47,28 +131,24 @@ export const searchFormSchema: FormSchema[] = [
//表单数据
export const formSchema: FormSchema[] = [
{
label: '学校',
label: '学校代码',
field: 'schoolCode',
component: 'JSearchSelect',
colProps: { sm: 24 },
componentProps: {
dict: 'yx_school,school_name,school_code',
},
dynamicRules: () => {
return [{ required: true, message: '请选择学校!' }];
},
component: 'Input',
},
{
label: '专业',
label: '专业代码',
field: 'majorCode',
colProps: { sm: 24 },
component: 'JSearchSelect',
componentProps: {
dict: 'yx_major,major_name,major_code',
component: 'Input',
},
dynamicRules: () => {
return [{ required: true, message: '请选择专业!' }];
}
{
label: '专业名称',
field: 'majorName',
component: 'Input',
},
{
label: '招生代码',
field: 'enrollmentCode',
component: 'Input',
},
{
label: '学费',
@ -76,48 +156,98 @@ export const formSchema: FormSchema[] = [
component: 'InputNumber',
},
{
label: '文科-省控线',
field: 'artsControlLine',
component: 'InputNumber',
label: '备注',
field: 'detail',
component: 'Input',
},
{
label: '理科-省控线',
field: 'scienceControlLine',
component: 'InputNumber',
},
{
label:'专项分数线',
field:'specialControlLine',
component: 'InputNumber',
label: '科类(文科/理科)',
field: 'category',
component: 'Input',
},
{
label: '录取方式',
field: 'rulesEnrollProbability',
component: 'Input',
},
{
label: '录取概率计算规则运算符',
field: 'probabilityOperator',
component: 'Input',
},
{
label: '备注',
field: 'detail',
component: 'Input',
},
{
label: '批次',
field: 'batch',
component: 'Input',
},
{
label: '(文科)专业代码',
field: 'artsMajorCode',
label: '录取概率计算规则运算符',
field: 'probabilityOperator',
component: 'Input',
},
{
label: '(理科)专业代码',
field: 'scienceMajorCode',
label: '文化分省控线',
field: 'culturalControlLine',
component: 'InputNumber',
},
{
label: '专项分数线',
field: 'specialControlLine',
component: 'InputNumber',
},
{
label: '专业类型',
field: 'majorType',
component: 'Input',
},
{
label: '二级专业类型',
field: 'majorTypeChild',
component: 'Input',
},
{
label: '计划招生人数',
field: 'planNum',
component: 'InputNumber',
},
{
label: '是否使用主项成绩',
field: 'checkMaster',
component: 'Input',
},
{
label: '主考科目',
field: 'mainSubjects',
component: 'Input',
},
{
label: '学制',
field: 'semester',
component: 'Input',
},
{
label: '院校限制',
field: 'limitation',
component: 'Input',
},
{
label: '文化分数限制',
field: 'culturalScoreLimitation',
component: 'InputNumber',
},
{
label: '专业分数限制',
field: 'professionalScoreLimitation',
component: 'InputNumber',
},
{
label: '语文成绩限制',
field: 'chineseScoreLimitation',
component: 'InputNumber',
},
{
label: '英语成绩限制',
field: 'englishScoreLimitation',
component: 'InputNumber',
},
{
label: '录取方式缩写',
field: 'rulesEnrollProbabilitySx',
component: 'Input',
},
// TODO 主键隐藏字段目前写死为ID
@ -129,6 +259,8 @@ export const formSchema: FormSchema[] = [
},
];
/**
* formSchema
* @param param

View File

@ -0,0 +1,175 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{getAreaTextByCode(text)}}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<YxSchoolMajorModal @register="registerModal" @success="handleSuccess"></YxSchoolMajorModal>
</div>
</template>
<script lang="ts" name="yx-yxSchoolMajor" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import YxSchoolMajorModal from './components/YxSchoolMajorModal.vue'
import {columns, searchFormSchema} from './YxSchoolMajor.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxSchoolMajor.api';
import { downloadFile } from '/@/utils/common/renderUtils';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '学校专业关联表',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
fixed:'right'
},
},
exportConfig: {
name:"学校专业关联表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
title:'ava',
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

View File

@ -1,175 +1,470 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
<a-card title="" :bordered="false">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam"
:label-col="labelCol" :wrapper-col="wrapperCol">
<a-row>
<a-col :span="4">
<a-form-item label="学校代码">
<a-input v-model:value="queryParam.schoolCode" placeholder="请输入学校代码" allowClear/>
</a-form-item>
</a-col>
<a-col :span="4">
<a-form-item label="专业名称">
<a-input v-model:value="queryParam.majorName" placeholder="请输入专业名称" allowClear/>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="专业类别" name="majorType">
<a-select v-model:value="queryParam.majorType" show-search allow-clear
placeholder="请选择专业类别">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="音乐类">音乐类</a-select-option>
<a-select-option value="表演类">表演类</a-select-option>
<a-select-option value="书法类">书法类</a-select-option>
<a-select-option value="舞蹈类">舞蹈类</a-select-option>
<a-select-option value="体育类">体育类</a-select-option>
<a-select-option value="美术与设计类">美术与设计类</a-select-option>
<a-select-option value="播音与主持类">播音与主持类</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="文理分科">
<a-select v-model:value="queryParam.category" show-search allow-clear
placeholder="请选择[文科/理科]">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="文科">文科</a-select-option>
<a-select-option value="理科">理科</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="批次">
<a-select v-model:value="queryParam.batch" show-search allow-clear
placeholder="请选择批次">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="提前批">提前批</a-select-option>
<a-select-option value="本科A段">本科A段</a-select-option>
<a-select-option value="本科B段">本科B段</a-select-option>
<a-select-option value="本科">体育本科</a-select-option>
<a-select-option value="高职高专">高职高专</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{getAreaTextByCode(text)}}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<YxSchoolMajorModal @register="registerModal" @success="handleSuccess"></YxSchoolMajorModal>
</div>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置
</a-button>
</a-col>
</a-row>
</a-form>
<!--
即时保存大体思路
1. JVxeTable 上必须加 keep-source 属性
2. 监听 edit-closed事件这个事件是在编辑完成后触发
3. 在这个事件里面判断数据是否更改如果更改了就调用接口进行保存操作
-->
<JVxeTable
toolbar
:toolbarConfig="toolbarConfig"
rowNumber
rowSelection
keepSource
asyncRemove
:height="500"
:loading="loading"
:columns="columns"
:dataSource="dataSource"
:pagination="pagination"
@save="handleTableSave"
@removed="handleTableRemove"
@edit-closed="handleEditClosed"
@pageChange="handlePageChange"
@selectRowChange="handleSelectRowChange"
/>
</a-card>
</template>
<script lang="ts" name="yx-yxSchoolMajor" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import YxSchoolMajorModal from './components/YxSchoolMajorModal.vue'
import {columns, searchFormSchema} from './YxSchoolMajor.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxSchoolMajor.api';
import { downloadFile } from '/@/utils/common/renderUtils';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
<script lang="ts" setup>
//
import {reactive, ref} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types';
import {useMessage} from '/@/hooks/web/useMessage';
import { useListPage } from '/@/hooks/system/useListPage';
const labelCol = reactive({
xs: {span: 24},
sm: {span: 7},
});
const wrapperCol = reactive({
xs: {span: 24},
sm: {span: 16},
});
const {createMessage} = useMessage();
//
const toolbarConfig = reactive({
// add remove clearSelection
btn: ['add', 'save', 'remove', 'clearSelection'],
});
//
const { onExportXls, onImportXls } = useListPage({
designScope: 'basic-table',
tableProps: {
title: '学校专业关联表',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
fixed:'right'
},
showActionColumn: false,
useSearchForm: false,
},
exportConfig: {
name:"学校专业关联表",
url: getExportUrl,
name: '示例列表',
url: '/test/jeecgDemo/exportXls',
},
importConfig: {
url: getImportUrl,
success: handleSuccess
url: '/test/jeecgDemo/importExcel',
},
});
//
const loading = ref(false);
//
const queryParam = reactive({
schoolCode: '',//
majorName: '',//
majorType: '',//
category: '',//
batch:'',//
})
//
const pagination = reactive({
//
current: 1,
//
pageSize: 10,
//
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0
total: 0,
});
//
const selectedRows = ref<Recordable[]>([]);
//
const dataSource = ref<Recordable[]>([]);
//
const columns = ref<JVxeColumn[]>([
/*{ key: 'num', title: '序号', width: 80, type: JVxeTypes.normal },*/
{
//
title: '学校代码',
// key
key: 'schoolCode',
//
width: 100,
// typeinput
type: JVxeTypes.input
},
{
title: '专业代码',
key: 'majorCode',
width: 100,
type: JVxeTypes.input
},
{
title: '专业名称',
key: 'majorName',
width: 200,
type: JVxeTypes.textarea
},
{
title: '招生代码',
key: 'enrollmentCode',
width: 100,
type: JVxeTypes.input
},
{
title: '学费',
key: 'tuition',
width: 80,
type: JVxeTypes.inputNumber,
},
{
title: '备注',
key: 'detail',
width: 300,
type: JVxeTypes.textarea,
},
{
title: '科类(文科/理科)',
key: 'category',
width: 100,
type: JVxeTypes.input,
},
{
title: '录取方式缩写(文x专y)',
key: 'rulesEnrollProbabilitySx',
width: 150,
type: JVxeTypes.input,
},
{
title: '录取方式(文*x+专*y)',
key: 'rulesEnrollProbability',
width: 150,
type: JVxeTypes.input,
},
{
title: '录取概率计算规则运算符',
key: 'probabilityOperator',
width: 150,
type: JVxeTypes.input,
},
{
title: '批次',
key: 'batch',
width: 100,
type: JVxeTypes.input,
},
/* {
title: '文化分省控线',
key: 'culturalControlLine',
width:100,
type: JVxeTypes.inputNumber,
},
{
title: '专项分数线',
key: 'specialControlLine',
width:100,
type: JVxeTypes.inputNumber,
},*/
{
title: '专业类型',
key: 'majorType',
width: 110,
type: JVxeTypes.input,
},
{
title: '二级专业类型',
key: 'majorTypeChild',
width: 130,
type: JVxeTypes.input,
},
{
title: '计划招生(人)',
key: 'planNum',
width: 100,
type: JVxeTypes.inputNumber,
},
/*{
title: '是否使用主项成绩',
key: 'checkMaster',
width:100,
type: JVxeTypes.input,
},*/
{
title: '主考科目',
key: 'mainSubjects',
width: 150,
type: JVxeTypes.input,
},
{
title: '学制',
key: 'semester',
width: 100,
type: JVxeTypes.input,
},
{
title: '院校限制',
key: 'limitation',
width: 150,
type: JVxeTypes.textarea,
},
{
title: '文化分数限制',
key: 'culturalScoreLimitation',
width: 130,
type: JVxeTypes.inputNumber,
},
{
title: '专业分数限制',
key: 'professionalScoreLimitation',
width: 130,
type: JVxeTypes.inputNumber,
},
{
title: '语文成绩限制',
key: 'chineseScoreLimitation',
width: 130,
type: JVxeTypes.inputNumber,
},
{
title: '英语成绩限制',
key: 'englishScoreLimitation',
width: 130,
type: JVxeTypes.inputNumber,
},
]);
// url
enum Api {
getData = '/yx/yxSchoolMajor/list',
//
saveRow = '/yx/yxSchoolMajor/edit',
//
saveAll = '/yx/yxSchoolMajor/saveBatch',
deleteBatch = '/yx/yxSchoolMajor/deleteBatch',
}
loadData();
async function searchQuery() {
pagination.current = 1
loadData()
}
async function searchReset() {
pagination.current = 1
queryParam.schoolCode = ''
queryParam.majorName = ''
queryParam.majorType = ''
queryParam.category = ''
queryParam.batch = ''
loadData()
}
//
async function loadData() {
loading.value = true;
//
await defHttp
.get({
//
url: Api.getData,
//
params: {
schoolCode: queryParam.schoolCode ? '*' + queryParam.schoolCode + '*' : '',
majorName: queryParam.majorName ? '*' + queryParam.majorName + '*' : '',
majorType:queryParam.majorType,
category:queryParam.category,
batch:queryParam.batch,
pageNo: pagination.current,
pageSize: pagination.pageSize,
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
title:'ava',
isUpdate: false,
showFooter: true,
.then((result) => {
// total
pagination.total = result.total;
// dataSource
dataSource.value = result.records;
//
selectedRows.value = [];
})
.finally(() => {
// loading
loading.value = false;
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
//
function handleTableSave({$table, target}) {
//
$table.validate().then((errMap) => {
//
if (!errMap) {
//
let tableData = target.getTableData();
console.log('当前保存的数据是:', tableData);
//
let newData = target.getNewData();
console.log('-- 新增的数据:', newData);
//
let deleteData = target.getDeleteData();
console.log('-- 删除的数据:', deleteData);
//
loading.value = true;
defHttp
.post({
url: Api.saveAll,
params: tableData,
})
.then(() => {
createMessage.success(`保存成功!`);
})
.finally(() => {
loading.value = false;
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
//
function handleTableRemove(event) {
// event.deleteRows
console.log('待删除的数据: ', event.deleteRows);
// IDID
let deleteIds = event.deleteRows.map((row) => row.id);
console.log('待删除的数据ids: ', deleteIds);
//
loading.value = true;
window.setTimeout(() => {
defHttp
.delete({
url: Api.deleteBatch, data: {ids: deleteIds.join(',')}
}, {joinParamsToUrl: true})
.then((res) => {
createMessage.success('删除成功');
//// confirmRemove()
event.confirmRemove();
})
.finally(() => {
loading.value = false;
});
}, 1000);
}
//
function handleEditClosed(event) {
let {$table, row, column} = event;
let field = column.property;
//
if ($table.isUpdateByRow(row, field)) {
//
$table.validate(row).then((errMap) => {
//
if (!errMap) {
//
let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0);
console.log('即时保存数据:', row);
defHttp
.put({
url: Api.saveRow,
params: row,
})
.then((res) => {
createMessage.success(`"${column.title}"保存成功!`);
//
$table.reloadRow(row, null, field);
})
.finally(() => {
hideLoading();
});
}
});
}
}
//
function handlePageChange(event) {
//
pagination.current = event.current;
pagination.pageSize = event.pageSize;
//
loadData();
}
//
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
</script>
<style scoped>
</style>
<style scoped></style>

View File

@ -10,13 +10,18 @@ export const columns: BasicColumn[] = [
dataIndex: 'cardNum'
},
{
title: '有效时长(天)',
dataIndex: 'validTime',
align: 'center',
},
/*{
title: '有效日期',
align:"center",
dataIndex: 'validDate',
customRender:({text}) =>{
return !text?"":(text.length>10?text.substr(0,10):text)
},
},
},*/
{
title: '对应商品',
align:"center",
@ -37,12 +42,20 @@ export const formSchema: FormSchema[] = [
label: '卡号',
field: 'cardNum',
component: 'Input',
componentProps:{
disabled: true
},
},
{
label: '有效时长(天)',
field: 'validTime',
component: 'InputNumber',
},
/*{
label: '有效日期',
field: 'validDate',
component: 'DatePicker',
},
},*/
{
label: '对应商品',
field: 'skuCode',

View File

@ -0,0 +1,196 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增
</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出
</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">
导入
</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)"
:dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined"
size="small" @click="downloadFile(text)">下载
</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<YxVipCardModal @register="registerModal" @success="handleSuccess"></YxVipCardModal>
</div>
</template>
<script lang="ts" name="yx-yxVipCard" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import {useListPage} from '/@/hooks/system/useListPage'
import YxVipCardModal from './components/YxVipCardModal.vue'
import {columns, searchFormSchema} from './YxVipCard.data';
import {list, deleteOne, batchDelete, getImportUrl, getExportUrl} from './YxVipCard.api';
import {downloadFile} from '/@/utils/common/renderUtils';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const {prefixCls, tableContext, onExportXls, onImportXls} = useListPage({
tableProps: {
title: 'VIP卡密表',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right'
},
},
exportConfig: {
name: "VIP卡密表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, {reload}, {rowSelection, selectedRowKeys}] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
if (!record.userId) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
} else {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}
]
}
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
if (!record.userId) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}]
}
}
</script>
<style scoped>
</style>

BIN
wechat/header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

63
wechat/test.html Normal file

File diff suppressed because one or more lines are too long

60
wechat/test2.html Normal file

File diff suppressed because one or more lines are too long

BIN
wechat/取消.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB