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: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:8080/jeecg-boot/
#VITE_GLOB_API_URL=http://localhost:9999
# 接口前缀 # 接口前缀
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=

View File

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

View File

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

View File

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

View File

@ -1,144 +1,123 @@
import {BasicColumn} from '/@/components/Table'; import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table'; import {FormSchema} from '/@/components/Table';
import {rules} from '/@/utils/helper/validator'; import { rules} from '/@/utils/helper/validator';
import {render} from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '学校代码', title: '学校代码',
align: "center", align:"center",
dataIndex: 'schoolCode', dataIndex: 'schoolCode'
width: 150 },
}, {
{
title: '院校代码', title: '院校代码',
align: "center", align:"center",
dataIndex: 'institutionCode', dataIndex: 'institutionCode'
width: 150 },
}, {
{
title: '学校名称', title: '学校名称',
align: "center", align:"center",
dataIndex: 'schoolName', dataIndex: 'schoolName'
width: 150 },
}, {
{
title: '专业代码', title: '专业代码',
align: "center", align:"center",
dataIndex: 'majorCode', dataIndex: 'majorCode'
width: 150 },
}, {
{
title: '专业名称', title: '专业名称',
align: "center", align:"center",
dataIndex: 'majorName', dataIndex: 'majorName'
width: 150 },
}, {
{
title: '专业类型', title: '专业类型',
align: "center", align:"center",
dataIndex: 'majorType', dataIndex: 'majorType'
width: 150 },
}, {
{
title: '专业类别子级', title: '专业类别子级',
align: "center", align:"center",
dataIndex: 'majorTypeChild', dataIndex: 'majorTypeChild'
width: 150 },
}, {
{
title: '年份', title: '年份',
align: "center", align:"center",
dataIndex: 'year', dataIndex: 'year'
width: 150 },
}, {
{
title: '科类(文科/理科)', title: '科类(文科/理科)',
align: "center", align:"center",
dataIndex: 'category', dataIndex: 'category'
width: 150 },
}, {
{
title: '录取方式', title: '录取方式',
align: "center", align:"center",
dataIndex: 'rulesEnrollProbability', dataIndex: 'rulesEnrollProbability'
width: 150 },
}, {
{
title: '录取概率计算规则运算符', title: '录取概率计算规则运算符',
align: "center", align:"center",
dataIndex: 'probabilityOperator', dataIndex: 'probabilityOperator'
width: 150 },
}, {
{
title: '省控线', title: '省控线',
align: "center", align:"center",
dataIndex: 'controlLine', dataIndex: 'controlLine'
width: 150 },
}, {
{
title: '录取线', title: '录取线',
align: "center", align:"center",
dataIndex: 'admissionLine', dataIndex: 'admissionLine'
width: 150 },
}, {
{
title: '招生人数', title: '招生人数',
align: "center", align:"center",
dataIndex: 'enrollNum', dataIndex: 'enrollNum'
width: 150 },
}, {
{
title: '实际投档人数', title: '实际投档人数',
align: "center", align:"center",
dataIndex: 'actualPitcherNum', dataIndex: 'actualPitcherNum'
width: 150 },
}, {
{
title: '录取数', title: '录取数',
align: "center", align:"center",
dataIndex: 'admissionNum', dataIndex: 'admissionNum'
width: 150 },
}, {
{
title: '一志愿录取数', title: '一志愿录取数',
align: "center", align:"center",
dataIndex: 'oneVolunteerAdmissionNum', dataIndex: 'oneVolunteerAdmissionNum'
width: 150 },
}, {
{
title: '最低分数差', title: '最低分数差',
align: "center", align:"center",
dataIndex: 'scoreLineDifference', dataIndex: 'scoreLineDifference'
width: 150 },
}, {
{
title: '备注', title: '备注',
align: "center", align:"center",
dataIndex: 'detail', dataIndex: 'detail'
width: 150 },
}, {
{
title: '批次', title: '批次',
align: "center", align:"center",
dataIndex: 'batch', dataIndex: 'batch'
width: 150 },
}, {
{
title: '招生代码', title: '招生代码',
align: "center", align:"center",
dataIndex: 'enrollmentCode', dataIndex: 'enrollmentCode'
width: 150 },
}, {
{
title: '是否使用主项成绩', title: '是否使用主项成绩',
align: "center", align:"center",
dataIndex: 'checkMaster', dataIndex: 'checkMaster'
width: 150 },
},
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = []; export const searchFormSchema: FormSchema[] = [
];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
@ -251,21 +230,22 @@ export const formSchema: FormSchema[] = [
field: 'checkMaster', field: 'checkMaster',
component: 'Input', component: 'Input',
}, },
// TODO 主键隐藏字段目前写死为ID // TODO 主键隐藏字段目前写死为ID
{ {
label: '', label: '',
field: 'id', field: 'id',
component: 'Input', component: 'Input',
show: false show: false
}, },
]; ];
/** /**
* formSchema * formSchema
* @param param * @param param
*/ */
export function getBpmFormSchema(_formData): FormSchema[] { export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema // 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema
return formSchema; return formSchema;
} }

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> <template>
<div> <a-card title="" :bordered="false">
<!--引用表格--> <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam"
<BasicTable @register="registerTable" :rowSelection="rowSelection"> :label-col="labelCol" :wrapper-col="wrapperCol">
<!--插槽:table标题--> <a-row>
<template #tableTitle> <a-col :span="3">
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-form-item label="年份">
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> <a-input v-model:value="queryParam.year" placeholder="请输入年份" allowClear/>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> </a-form-item>
<a-dropdown v-if="selectedRowKeys.length > 0"> </a-col>
<template #overlay> <a-col :span="4">
<a-menu> <a-form-item label="学校代码">
<a-menu-item key="1" @click="batchHandleDelete"> <a-input v-model:value="queryParam.schoolCode" placeholder="请输入学校代码" allowClear/>
<Icon icon="ant-design:delete-outlined"></Icon> </a-form-item>
删除 </a-col>
</a-menu-item> <a-col :span="4">
</a-menu> <a-form-item label="专业名称">
</template> <a-input v-model:value="queryParam.majorName" placeholder="请输入专业名称" allowClear/>
<a-button>批量操作 </a-form-item>
<Icon icon="mdi:chevron-down"></Icon> </a-col>
</a-button> <a-col :span="3">
</a-dropdown> <a-form-item label="专业类别" name="majorType">
</template> <a-select v-model:value="queryParam.majorType" show-search allow-clear
<!--操作栏--> placeholder="请选择专业类别">
<template #action="{ record }"> <a-select-option value="">请选择</a-select-option>
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> <a-select-option value="音乐类">音乐类</a-select-option>
</template> <a-select-option value="表演类">表演类</a-select-option>
<!--字段回显插槽--> <a-select-option value="书法类">书法类</a-select-option>
<template #htmlSlot="{text}"> <a-select-option value="舞蹈类">舞蹈类</a-select-option>
<div v-html="text"></div> <a-select-option value="体育类">体育类</a-select-option>
</template> <a-select-option value="美术与设计类">美术与设计类</a-select-option>
<!--省市区字段回显插槽--> <a-select-option value="播音与主持类">播音与主持类</a-select-option>
<template #pcaSlot="{text}"> </a-select>
{{ getAreaTextByCode(text) }} </a-form-item>
</template> </a-col>
<template #fileSlot="{text}"> <a-col :span="3">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> <a-form-item label="文理分科">
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> <a-select v-model:value="queryParam.category" show-search allow-clear
</template> placeholder="请选择[文科/理科]">
</BasicTable> <a-select-option value="">请选择</a-select-option>
<!-- 表单区域 --> <a-select-option value="文科">文科</a-select-option>
<YxHistoryMajorEnrollModal @register="registerModal" @success="handleSuccess"></YxHistoryMajorEnrollModal> <a-select-option value="理科">理科</a-select-option>
</div> </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> </template>
<script lang="ts" name="yx-yxHistoryMajorEnroll" setup> <script lang="ts" setup>
import {ref, computed, unref} from 'vue'; //
import {BasicTable, useTable, TableAction} from '/@/components/Table'; import {reactive, ref} from 'vue';
import {useModal} from '/@/components/Modal'; import { message } from 'ant-design-vue';
import { useListPage } from '/@/hooks/system/useListPage' import {defHttp} from '/@/utils/http/axios';
import YxHistoryMajorEnrollModal from './components/YxHistoryMajorEnrollModal.vue' import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types';
import {columns, searchFormSchema} from './YxHistoryMajorEnroll.data'; import {useMessage} from '/@/hooks/web/useMessage';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxHistoryMajorEnroll.api'; import {useListPage} from "@/hooks/system/useListPage";
import { downloadFile } from '/@/utils/common/renderUtils'; import {getExportUrl, getImportUrl, list} from "@/views/yx/yxHistoryMajorEnroll/YxHistoryMajorEnroll.api";
const checkedKeys = ref<Array<string | number>>([]); import {XLSX_FILE_SUFFIX, XLSX_MIME_TYPE} from "@/hooks/system/useMethods";
//model const { createMessage, createConfirm, createSuccessModal, createInfoModal, createErrorModal, createWarningModal, notification } = useMessage();
const [registerModal, {openModal}] = useModal(); const labelCol = reactive({
//table xs: {span: 24},
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ sm: {span: 7},
tableProps:{ });
title: '历年录取数据表', const wrapperCol = reactive({
api: list, xs: {span: 24},
columns, sm: {span: 16},
canResize:false, });
formConfig: { //
//labelWidth: 120, const toolbarConfig = reactive({
schemas: searchFormSchema, // add remove clearSelection
autoSubmitOnEnter:true, btn: ['add', 'save', 'remove', 'clearSelection'],
showAdvancedButton:true, });
fieldMapToNumber: [ //
], const loading = ref(false);
fieldMapToTime: [ //
], const queryParam = reactive({
}, schoolCode: '',//
actionColumn: { majorName: '',//
width: 120, majorType: '',//
fixed:'right' category: '',//
}, year: '',//
}, })
exportConfig: { //
name:"历年录取数据表", const pagination = reactive({
url: getExportUrl, //
}, current: 1,
importConfig: { //
url: getImportUrl, pageSize: 10,
success: handleSuccess //
}, pageSizeOptions: ['10', '20', '30', '100', '200'],
}) // 0
total: 0,
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext });
//
/** const selectedRows = ref<Recordable[]>([]);
* 新增事件 //
*/ const dataSource = ref<Recordable[]>([]);
function handleAdd() { //
openModal(true, { const columns = ref<JVxeColumn[]>([
isUpdate: false, /*{ key: 'num', title: '序号', width: 80, type: JVxeTypes.normal },*/
showFooter: true, {
}); 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,
} }
/**
* 编辑事件
*/
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),
}
}
]
}
]);
const [messageApi, contextHolder] = message.useMessage();
const { prefixCls,tableContext,onImportXls } = useListPage({
tableProps:{
title: '历年录取数据表',
canResize:false,
},
importConfig:{
url: getImportUrl,
success: handleSuccess
}
})
// 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'
}
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;
});
}
//线
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 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 handleSuccess() {
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> </script>
<style scoped> <style scoped></style>
</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,41 +5,125 @@ import { render } from '/@/utils/common/renderUtils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '学校', title: '学校代码',
align:"center", align:"center",
dataIndex: 'schoolCode_dictText' dataIndex: 'schoolCode'
}, },
{ {
title: '专业', title: '专业代码',
align:"center", align:"center",
dataIndex: 'majorCode_dictText' dataIndex: 'majorCode'
},
{
title: '专业名称',
align:"center",
dataIndex: 'majorName'
},
{
title: '招生代码',
align:"center",
dataIndex: 'enrollmentCode'
}, },
{ {
title: '学费', title: '学费',
align:"center", align:"center",
dataIndex: 'tuition' dataIndex: 'tuition'
}, },
{
title: '批次',
align:"center",
dataIndex: 'batch'
},
{
title: '(文科)专业代码',
align:"center",
dataIndex: 'artsMajorCode'
},
{
title: '(理科)专业代码',
align:"center",
dataIndex: 'scienceMajorCode'
},
{ {
title: '备注', title: '备注',
align:"center", align:"center",
dataIndex: 'detail' dataIndex: 'detail'
}, },
{
title: '科类(文科/理科)',
align:"center",
dataIndex: 'category'
},
{
title: '录取方式',
align:"center",
dataIndex: 'rulesEnrollProbability'
},
{
title: '批次',
align:"center",
dataIndex: 'batch'
},
{
title: '录取概率计算规则运算符',
align:"center",
dataIndex: 'probabilityOperator'
},
{
title: '文化分省控线',
align:"center",
dataIndex: 'culturalControlLine'
},
{
title: '专项分数线',
align:"center",
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'
},
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
@ -47,28 +131,24 @@ export const searchFormSchema: FormSchema[] = [
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
label: '学校', label: '学校代码',
field: 'schoolCode', field: 'schoolCode',
component: 'JSearchSelect', component: 'Input',
colProps: { sm: 24 },
componentProps: {
dict: 'yx_school,school_name,school_code',
},
dynamicRules: () => {
return [{ required: true, message: '请选择学校!' }];
},
}, },
{ {
label: '专业', label: '专业代码',
field: 'majorCode', field: 'majorCode',
colProps: { sm: 24 }, component: 'Input',
component: 'JSearchSelect', },
componentProps: { {
dict: 'yx_major,major_name,major_code', label: '专业名称',
}, field: 'majorName',
dynamicRules: () => { component: 'Input',
return [{ required: true, message: '请选择专业!' }]; },
} {
label: '招生代码',
field: 'enrollmentCode',
component: 'Input',
}, },
{ {
label: '学费', label: '学费',
@ -76,59 +156,111 @@ export const formSchema: FormSchema[] = [
component: 'InputNumber', component: 'InputNumber',
}, },
{ {
label: '文科-省控线', label: '备注',
field: 'artsControlLine', field: 'detail',
component: 'InputNumber', component: 'Input',
}, },
{ {
label: '理科-省控线', label: '科类(文科/理科)',
field: 'scienceControlLine', field: 'category',
component: 'InputNumber', component: 'Input',
},
{
label:'专项分数线',
field:'specialControlLine',
component: 'InputNumber',
}, },
{ {
label: '录取方式', label: '录取方式',
field: 'rulesEnrollProbability', field: 'rulesEnrollProbability',
component: 'Input', component: 'Input',
}, },
{
label: '录取概率计算规则运算符',
field: 'probabilityOperator',
component: 'Input',
},
{
label: '备注',
field: 'detail',
component: 'Input',
},
{ {
label: '批次', label: '批次',
field: 'batch', field: 'batch',
component: 'Input', component: 'Input',
}, },
{ {
label: '(文科)专业代码', label: '录取概率计算规则运算符',
field: 'artsMajorCode', field: 'probabilityOperator',
component: 'Input', component: 'Input',
}, },
{ {
label: '(理科)专业代码', label: '文化分省控线',
field: 'scienceMajorCode', 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', component: 'Input',
}, },
// TODO 主键隐藏字段目前写死为ID // TODO 主键隐藏字段目前写死为ID
{ {
label: '', label: '',
field: 'id', field: 'id',
component: 'Input', component: 'Input',
show: false show: false
}, },
]; ];
/** /**
* formSchema * formSchema
* @param param * @param param
@ -136,4 +268,4 @@ export const formSchema: FormSchema[] = [
export function getBpmFormSchema(_formData): FormSchema[]{ export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema // 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema
return formSchema; return formSchema;
} }

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> <template>
<div> <a-card title="" :bordered="false">
<!--引用表格--> <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam"
<BasicTable @register="registerTable" :rowSelection="rowSelection"> :label-col="labelCol" :wrapper-col="wrapperCol">
<!--插槽:table标题--> <a-row>
<template #tableTitle> <a-col :span="4">
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-form-item label="学校代码">
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> <a-input v-model:value="queryParam.schoolCode" placeholder="请输入学校代码" allowClear/>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> </a-form-item>
<a-dropdown v-if="selectedRowKeys.length > 0"> </a-col>
<template #overlay> <a-col :span="4">
<a-menu> <a-form-item label="专业名称">
<a-menu-item key="1" @click="batchHandleDelete"> <a-input v-model:value="queryParam.majorName" placeholder="请输入专业名称" allowClear/>
<Icon icon="ant-design:delete-outlined"></Icon> </a-form-item>
删除 </a-col>
</a-menu-item> <a-col :span="3">
</a-menu> <a-form-item label="专业类别" name="majorType">
</template> <a-select v-model:value="queryParam.majorType" show-search allow-clear
<a-button>批量操作 placeholder="请选择专业类别">
<Icon icon="mdi:chevron-down"></Icon> <a-select-option value="">请选择</a-select-option>
</a-button> <a-select-option value="音乐类">音乐类</a-select-option>
</a-dropdown> <a-select-option value="表演类">表演类</a-select-option>
</template> <a-select-option value="书法类">书法类</a-select-option>
<!--操作栏--> <a-select-option value="舞蹈类">舞蹈类</a-select-option>
<template #action="{ record }"> <a-select-option value="体育类">体育类</a-select-option>
<a-select-option value="美术与设计类">美术与设计类</a-select-option>
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> <a-select-option value="播音与主持类">播音与主持类</a-select-option>
</template> </a-select>
<!--字段回显插槽--> </a-form-item>
<template #htmlSlot="{text}"> </a-col>
<div v-html="text"></div> <a-col :span="3">
</template> <a-form-item label="文理分科">
<!--省市区字段回显插槽--> <a-select v-model:value="queryParam.category" show-search allow-clear
<template #pcaSlot="{text}"> placeholder="请选择[文科/理科]">
{{getAreaTextByCode(text)}} <a-select-option value="">请选择</a-select-option>
</template> <a-select-option value="文科">文科</a-select-option>
<template #fileSlot="{text}"> <a-select-option value="理科">理科</a-select-option>
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> </a-select>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> </a-form-item>
</template> </a-col>
</BasicTable> <a-col :span="3">
<!-- 表单区域 --> <a-form-item label="批次">
<YxSchoolMajorModal @register="registerModal" @success="handleSuccess"></YxSchoolMajorModal> <a-select v-model:value="queryParam.batch" show-search allow-clear
</div> 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>
<!--
即时保存大体思路
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> </template>
<script lang="ts" name="yx-yxSchoolMajor" setup> <script lang="ts" setup>
import {ref, computed, unref} from 'vue'; //
import {BasicTable, useTable, TableAction} from '/@/components/Table'; import {reactive, ref} from 'vue';
import {useModal} from '/@/components/Modal'; import {defHttp} from '/@/utils/http/axios';
import { useListPage } from '/@/hooks/system/useListPage' import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types';
import YxSchoolMajorModal from './components/YxSchoolMajorModal.vue' import {useMessage} from '/@/hooks/web/useMessage';
import {columns, searchFormSchema} from './YxSchoolMajor.data'; import { useListPage } from '/@/hooks/system/useListPage';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './YxSchoolMajor.api';
import { downloadFile } from '/@/utils/common/renderUtils'; const labelCol = reactive({
const checkedKeys = ref<Array<string | number>>([]); xs: {span: 24},
//model sm: {span: 7},
const [registerModal, {openModal}] = useModal(); });
//table const wrapperCol = reactive({
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ xs: {span: 24},
tableProps:{ sm: {span: 16},
title: '学校专业关联表', });
api: list, const {createMessage} = useMessage();
columns, //
canResize:false, const toolbarConfig = reactive({
formConfig: { // add remove clearSelection
//labelWidth: 120, btn: ['add', 'save', 'remove', 'clearSelection'],
schemas: searchFormSchema, });
autoSubmitOnEnter:true, //
showAdvancedButton:true, const { onExportXls, onImportXls } = useListPage({
fieldMapToNumber: [ designScope: 'basic-table',
], tableProps: {
fieldMapToTime: [ showActionColumn: false,
], useSearchForm: false,
}, },
actionColumn: { exportConfig: {
width: 120, name: '示例列表',
fixed:'right' url: '/test/jeecgDemo/exportXls',
}, },
importConfig: {
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,
}, },
exportConfig: { })
name:"学校专业关联表", .then((result) => {
url: getExportUrl, // total
}, pagination.total = result.total;
importConfig: { // dataSource
url: getImportUrl, dataSource.value = result.records;
success: handleSuccess //
}, selectedRows.value = [];
}) })
.finally(() => {
// loading
loading.value = false;
});
}
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext //
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
function handleAdd() { console.log('待删除的数据: ', event.deleteRows);
openModal(true, { // IDID
title:'ava', let deleteIds = event.deleteRows.map((row) => row.id);
isUpdate: false, console.log('待删除的数据ids: ', deleteIds);
showFooter: true, //
}); 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 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),
}
}
]
}
//
function handlePageChange(event) {
//
pagination.current = event.current;
pagination.pageSize = event.pageSize;
//
loadData();
}
//
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
</script> </script>
<style scoped> <style scoped></style>
</style>

View File

@ -2,7 +2,7 @@
<div style="min-height: 400px"> <div style="min-height: 400px">
<BasicForm @register="registerForm"></BasicForm> <BasicForm @register="registerForm"></BasicForm>
<div style="width: 100%;text-align: center" v-if="!formDisabled"> <div style="width: 100%;text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button> <a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div> </div>
</div> </div>
</template> </template>
@ -67,4 +67,4 @@
} }
} }
}); });
</script> </script>

View File

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

View File

@ -160,12 +160,12 @@ function getTableAction(record) {
} }
] ]
} else { } else {
return [ return [
{ {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
} }
] ]
} }
} }

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