updates
This commit is contained in:
parent
525ba6f454
commit
dd189f26a6
|
|
@ -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=
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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: '',
|
||||||
|
|
|
||||||
|
|
@ -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[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -261,11 +240,12 @@ export const formSchema: FormSchema[] = [
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程表单调用这个方法获取formSchema
|
* 流程表单调用这个方法获取formSchema
|
||||||
* @param param
|
* @param param
|
||||||
*/
|
*/
|
||||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
export function getBpmFormSchema(_formData): FormSchema[]{
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||||
return formSchema;
|
return formSchema;
|
||||||
}
|
}
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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>
|
|
||||||
|
|
@ -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},
|
||||||
|
});
|
||||||
|
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:{
|
tableProps:{
|
||||||
title: '历年录取数据表',
|
title: '历年录取数据表',
|
||||||
api: list,
|
|
||||||
columns,
|
|
||||||
canResize:false,
|
canResize:false,
|
||||||
formConfig: {
|
|
||||||
//labelWidth: 120,
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter:true,
|
|
||||||
showAdvancedButton:true,
|
|
||||||
fieldMapToNumber: [
|
|
||||||
],
|
|
||||||
fieldMapToTime: [
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
actionColumn: {
|
importConfig:{
|
||||||
width: 120,
|
|
||||||
fixed:'right'
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exportConfig: {
|
|
||||||
name:"历年录取数据表",
|
|
||||||
url: getExportUrl,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
url: getImportUrl,
|
||||||
success: handleSuccess
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
//刷新省控线
|
||||||
|
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')
|
||||||
function handleAdd() {
|
return new Promise((resolve, reject) => {
|
||||||
openModal(true, {
|
defHttp
|
||||||
isUpdate: false,
|
.post({
|
||||||
showFooter: true,
|
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 handleEdit(record: Recordable) {
|
// 触发单元格删除事件
|
||||||
openModal(true, {
|
function handleTableRemove(event) {
|
||||||
record,
|
// 把 event.deleteRows 传给后台进行删除(注意:这里不会传递前端逻辑新增的数据,因为不需要请求后台删除)
|
||||||
isUpdate: true,
|
console.log('待删除的数据: ', event.deleteRows);
|
||||||
showFooter: true,
|
// 也可以只传ID,因为可以根据ID删除
|
||||||
|
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 handleDetail(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
}
|
||||||
* 删除事件
|
|
||||||
*/
|
// 当分页参数变化时触发的事件
|
||||||
async function handleDelete(record) {
|
function handlePageChange(event) {
|
||||||
await deleteOne({id: record.id}, handleSuccess);
|
// 重新赋值
|
||||||
}
|
pagination.current = event.current;
|
||||||
/**
|
pagination.pageSize = event.pageSize;
|
||||||
* 批量删除事件
|
// 查询数据
|
||||||
*/
|
loadData();
|
||||||
async function batchHandleDelete() {
|
}
|
||||||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
|
/**
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 成功回调
|
* 成功回调
|
||||||
*/
|
*/
|
||||||
function handleSuccess() {
|
function handleSuccess() {
|
||||||
(selectedRowKeys.value = []) && reload();
|
loadData();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 操作栏
|
|
||||||
*/
|
|
||||||
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 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>
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
// 也可以只传ID,因为可以根据ID删除
|
||||||
|
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>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -5,40 +5,124 @@ 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: 'detail'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '科类(文科/理科)',
|
||||||
|
align:"center",
|
||||||
|
dataIndex: 'category'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '录取方式',
|
||||||
|
align:"center",
|
||||||
|
dataIndex: 'rulesEnrollProbability'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '批次',
|
title: '批次',
|
||||||
align:"center",
|
align:"center",
|
||||||
dataIndex: 'batch'
|
dataIndex: 'batch'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '(文科)专业代码',
|
title: '录取概率计算规则运算符',
|
||||||
align:"center",
|
align:"center",
|
||||||
dataIndex: 'artsMajorCode'
|
dataIndex: 'probabilityOperator'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '(理科)专业代码',
|
title: '文化分省控线',
|
||||||
align:"center",
|
align:"center",
|
||||||
dataIndex: 'scienceMajorCode'
|
dataIndex: 'culturalControlLine'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '备注',
|
title: '专项分数线',
|
||||||
align:"center",
|
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[] = [
|
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',
|
|
||||||
},
|
},
|
||||||
dynamicRules: () => {
|
{
|
||||||
return [{ required: true, message: '请选择专业!' }];
|
label: '专业名称',
|
||||||
}
|
field: 'majorName',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '招生代码',
|
||||||
|
field: 'enrollmentCode',
|
||||||
|
component: 'Input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '学费',
|
label: '学费',
|
||||||
|
|
@ -76,48 +156,98 @@ 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
|
||||||
|
|
@ -129,6 +259,8 @@ export const formSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程表单调用这个方法获取formSchema
|
* 流程表单调用这个方法获取formSchema
|
||||||
* @param param
|
* @param param
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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-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>
|
||||||
</a-dropdown>
|
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||||
</template>
|
style="margin-left: 8px">重置
|
||||||
<!--操作栏-->
|
</a-button>
|
||||||
<template #action="{ record }">
|
</a-col>
|
||||||
|
</a-row>
|
||||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
</a-form>
|
||||||
</template>
|
<!--
|
||||||
<!--字段回显插槽-->
|
【即时保存大体思路】:
|
||||||
<template #htmlSlot="{text}">
|
1. JVxeTable 上必须加 keep-source 属性
|
||||||
<div v-html="text"></div>
|
2. 监听 edit-closed事件,这个事件是在编辑完成后触发
|
||||||
</template>
|
3. 在这个事件里面判断数据是否更改,如果更改了就调用接口进行保存操作
|
||||||
<!--省市区字段回显插槽-->
|
-->
|
||||||
<template #pcaSlot="{text}">
|
<JVxeTable
|
||||||
{{getAreaTextByCode(text)}}
|
toolbar
|
||||||
</template>
|
:toolbarConfig="toolbarConfig"
|
||||||
<template #fileSlot="{text}">
|
rowNumber
|
||||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
rowSelection
|
||||||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
|
keepSource
|
||||||
</template>
|
asyncRemove
|
||||||
</BasicTable>
|
:height="500"
|
||||||
<!-- 表单区域 -->
|
:loading="loading"
|
||||||
<YxSchoolMajorModal @register="registerModal" @success="handleSuccess"></YxSchoolMajorModal>
|
:columns="columns"
|
||||||
</div>
|
: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: {
|
|
||||||
width: 120,
|
|
||||||
fixed:'right'
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
exportConfig: {
|
exportConfig: {
|
||||||
name:"学校专业关联表",
|
name: '示例列表',
|
||||||
url: getExportUrl,
|
url: '/test/jeecgDemo/exportXls',
|
||||||
},
|
},
|
||||||
importConfig: {
|
importConfig: {
|
||||||
url: getImportUrl,
|
url: '/test/jeecgDemo/importExcel',
|
||||||
success: handleSuccess
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 是否正在加载
|
||||||
|
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,
|
||||||
|
// 如果加上了该属性,就代表当前单元格是可编辑的,type就是表单的类型,input就是简单的输入框
|
||||||
|
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,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
.then((result) => {
|
||||||
|
// 后台查询回来的 total,数据总数量
|
||||||
|
pagination.total = result.total;
|
||||||
|
// 将查询的数据赋值给 dataSource
|
||||||
|
dataSource.value = result.records;
|
||||||
|
// 重置选择
|
||||||
|
selectedRows.value = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// 这里是无论成功或失败都会执行的方法,在这里关闭loading
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
// 【整体保存】点击保存按钮时触发的事件
|
||||||
|
function handleTableSave({$table, target}) {
|
||||||
/**
|
// 校验整个表格
|
||||||
* 新增事件
|
$table.validate().then((errMap) => {
|
||||||
*/
|
// 校验通过
|
||||||
function handleAdd() {
|
if (!errMap) {
|
||||||
openModal(true, {
|
// 获取所有数据
|
||||||
title:'ava',
|
let tableData = target.getTableData();
|
||||||
isUpdate: false,
|
console.log('当前保存的数据是:', tableData);
|
||||||
showFooter: true,
|
// 获取新增的数据
|
||||||
|
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 handleEdit(record: Recordable) {
|
// 触发单元格删除事件
|
||||||
openModal(true, {
|
function handleTableRemove(event) {
|
||||||
record,
|
// 把 event.deleteRows 传给后台进行删除(注意:这里不会传递前端逻辑新增的数据,因为不需要请求后台删除)
|
||||||
isUpdate: true,
|
console.log('待删除的数据: ', event.deleteRows);
|
||||||
showFooter: true,
|
// 也可以只传ID,因为可以根据ID删除
|
||||||
|
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 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>
|
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,18 @@ export const columns: BasicColumn[] = [
|
||||||
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',
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Loading…
Reference in New Issue