2023年6月17日 修复问题
This commit is contained in:
parent
a65bd9fefc
commit
74c0ee65c7
|
@ -23,7 +23,8 @@ export interface LoginResultModel {
|
||||||
userId: string | number;
|
userId: string | number;
|
||||||
token: string;
|
token: string;
|
||||||
role: RoleInfo;
|
role: RoleInfo;
|
||||||
userInfo?: any
|
userInfo?: any;
|
||||||
|
roleList?: RoleInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +46,8 @@ export interface GetUserInfoModel {
|
||||||
userInfo?: any;
|
userInfo?: any;
|
||||||
// 缓存字典项
|
// 缓存字典项
|
||||||
sysAllDictItems?: any;
|
sysAllDictItems?: any;
|
||||||
|
|
||||||
|
roleList?: RoleInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -134,7 +134,8 @@ export const useUserStore = defineStore({
|
||||||
try {
|
try {
|
||||||
const { goHome = true, mode, ...loginParams } = params;
|
const { goHome = true, mode, ...loginParams } = params;
|
||||||
const data = await loginApi(loginParams, mode);
|
const data = await loginApi(loginParams, mode);
|
||||||
const { token, userInfo } = data;
|
const { token, userInfo, roleList } = data;
|
||||||
|
userInfo.roleList = roleList;
|
||||||
// save token
|
// save token
|
||||||
this.setToken(token);
|
this.setToken(token);
|
||||||
this.setTenant(userInfo.loginTenantId);
|
this.setTenant(userInfo.loginTenantId);
|
||||||
|
@ -213,8 +214,9 @@ export const useUserStore = defineStore({
|
||||||
if (!this.getToken) {
|
if (!this.getToken) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const { userInfo, sysAllDictItems } = <GetUserInfoModel> await getUserInfo();
|
const { userInfo, sysAllDictItems, roleList } = <GetUserInfoModel> await getUserInfo();
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
|
userInfo.roleList = roleList;
|
||||||
const { roles = [] } = userInfo;
|
const { roles = [] } = userInfo;
|
||||||
if (isArray(roles)) {
|
if (isArray(roles)) {
|
||||||
const roleList = roles.map((item) => item.value) as RoleEnum[];
|
const roleList = roles.map((item) => item.value) as RoleEnum[];
|
||||||
|
|
|
@ -53,7 +53,8 @@
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
<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="searchReset" style="margin-left: 8px">重置</a-button>
|
||||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()" style="margin-left: 8px"> 导出</a-button>
|
<a-button v-if="roleList.filter(x => x.roleCode == 'admin' ).length" type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()" style="margin-left: 8px">导出</a-button>
|
||||||
|
<a-button v-else type="primary" preIcon="ant-design:export-outlined" @click="onExportXls2()" style="margin-left: 8px">导出</a-button>
|
||||||
<!--<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
<!--<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
||||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||||
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'"/>
|
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'"/>
|
||||||
|
@ -79,7 +80,8 @@
|
||||||
<a-table-column title="听课教师工号" data-index="tkjgh"/>
|
<a-table-column title="听课教师工号" data-index="tkjgh"/>
|
||||||
<a-table-column title="听课教师姓名" data-index="tkjsxm"/>
|
<a-table-column title="听课教师姓名" data-index="tkjsxm"/>
|
||||||
<a-table-column title="听课身份" data-index="tksf"/>
|
<a-table-column title="听课身份" data-index="tksf"/>
|
||||||
<a-table-column title="听课评价结果(5分制)" data-index="tkpjjg"/>
|
<!-- 管理员才能看结果 -->
|
||||||
|
<a-table-column v-if="roleList.filter(x => x.roleCode == 'admin' ).length" title="听课评价结果(5分制)" data-index="tkpjjg"/>
|
||||||
<!-- <a-table-column title="评价量表" data-index="sourceName"/> -->
|
<!-- <a-table-column title="评价量表" data-index="sourceName"/> -->
|
||||||
<!-- 一般听课表、线上听课表、同行评价表
|
<!-- 一般听课表、线上听课表、同行评价表
|
||||||
evaluationver??? -->
|
evaluationver??? -->
|
||||||
|
@ -100,13 +102,14 @@
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="viewsKcStatisticsEvaluationListIndex">
|
<script lang="ts" setup name="viewsKcStatisticsEvaluationListIndex">
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { ref, onMounted, Ref, watch, reactive } from 'vue';
|
import { ref, onMounted, Ref, watch, reactive, computed } from 'vue';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { execAvyApi, getAvyCtrlLiveOpenOrCloseUrl } from "/@/views/site/utils/index";
|
import { execAvyApi, getAvyCtrlLiveOpenOrCloseUrl } from "/@/views/site/utils/index";
|
||||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
import { useMethods } from '/@/hooks/system/useMethods';
|
import { useMethods } from '/@/hooks/system/useMethods';
|
||||||
import { JInput } from '/@/components/Form';
|
import { JInput } from '/@/components/Form';
|
||||||
|
import { getUserInfo } from '/@/views/site/utils/index';
|
||||||
|
|
||||||
const showAllLiveRef = ref();
|
const showAllLiveRef = ref();
|
||||||
|
|
||||||
|
@ -123,6 +126,8 @@ onMounted(() => {
|
||||||
loadData();
|
loadData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const roleList = computed(() => getUserInfo()?.roleList??[]);
|
||||||
|
|
||||||
enum Api {
|
enum Api {
|
||||||
list = '/statistics/getEvaluationList',
|
list = '/statistics/getEvaluationList',
|
||||||
}
|
}
|
||||||
|
@ -219,6 +224,18 @@ function onExportXls() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出 excel
|
||||||
|
function onExportXls2() {
|
||||||
|
let url = '/statistics/exportEvaluationXls2';
|
||||||
|
if (url) {
|
||||||
|
let title = '评价量表统计';
|
||||||
|
return handleExportXls(title as string, url, queryParam.value);
|
||||||
|
} else {
|
||||||
|
createMessage.warn('没有传递 export.url 参数');
|
||||||
|
return Promise.reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/sys/jwms/list',
|
||||||
|
save='/sys/jwms/add',
|
||||||
|
edit='/sys/jwms/edit',
|
||||||
|
deleteOne = '/sys/jwms/delete',
|
||||||
|
deleteBatch = '/sys/jwms/deleteBatch',
|
||||||
|
importExcel = '/sys/jwms/importExcel',
|
||||||
|
exportXls = '/sys/jwms/exportXls',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出api
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入api
|
||||||
|
*/
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表接口
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const deleteOne = (params,handleSuccess) => {
|
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存或者更新
|
||||||
|
* @param params
|
||||||
|
* @param isUpdate
|
||||||
|
*/
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
import {BasicColumn} from '/@/components/Table';
|
||||||
|
import {FormSchema} from '/@/components/Table';
|
||||||
|
import { rules} from '/@/utils/helper/validator';
|
||||||
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
//列表数据
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
title: '账号',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'userid'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户名',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'username'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '范围',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'range'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '院校',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'college'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
//查询数据
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
];
|
||||||
|
|
||||||
|
//表单数据
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
label: '账号',
|
||||||
|
field: 'userid',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '用户名',
|
||||||
|
field: 'username',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '范围',
|
||||||
|
field: 'range',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '院校',
|
||||||
|
field: 'college',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
// TODO 主键隐藏字段,目前写死为ID
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
field: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
];
|
|
@ -0,0 +1,215 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!--查询区域-->
|
||||||
|
<div class="jeecg-basic-table-form-container">
|
||||||
|
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</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>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<JwmsModal ref="registerModal" @success="handleSuccess"></JwmsModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="sys-jwms" setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import { columns } from './Jwms.data';
|
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Jwms.api';
|
||||||
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
|
import JwmsModal from './components/JwmsModal.vue'
|
||||||
|
|
||||||
|
const queryParam = ref<any>({});
|
||||||
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
|
const registerModal = ref();
|
||||||
|
//注册table数据
|
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: '教务秘书',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize:false,
|
||||||
|
useSearchForm: false,
|
||||||
|
actionColumn: {
|
||||||
|
width: 120,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
beforeFetch: (params) => {
|
||||||
|
params.column = '',params.order = '';//新生成的默认不带排序
|
||||||
|
return Object.assign(params, queryParam.value);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: "教务秘书",
|
||||||
|
url: getExportUrl,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
const labelCol = reactive({
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 7 },
|
||||||
|
});
|
||||||
|
const wrapperCol = reactive({
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.add();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑事件
|
||||||
|
*/
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = true;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
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 searchQuery() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function searchReset() {
|
||||||
|
queryParam.value = {};
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
//刷新数据
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.jeecg-basic-table-form-container {
|
||||||
|
.table-page-search-submitButtons {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.query-group-cust{
|
||||||
|
width: calc(50% - 15px);
|
||||||
|
min-width: 100px !important;
|
||||||
|
}
|
||||||
|
.query-group-split-cust{
|
||||||
|
width: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,145 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="账号" v-bind="validateInfos.userid">
|
||||||
|
<a-input v-model:value="formData.userid" placeholder="请输入账号" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="用户名" v-bind="validateInfos.username">
|
||||||
|
<a-input v-model:value="formData.username" placeholder="请输入用户名" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="范围" v-bind="validateInfos.range">
|
||||||
|
<a-input v-model:value="formData.range" placeholder="请输入范围" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="院校" v-bind="validateInfos.college">
|
||||||
|
<a-input v-model:value="formData.college" placeholder="请输入院校" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { saveOrUpdate } from '../Jwms.api';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: ()=>{} },
|
||||||
|
formBpm: { type: Boolean, default: true }
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
userid: '',
|
||||||
|
username: '',
|
||||||
|
range: '',
|
||||||
|
college: '',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = {
|
||||||
|
};
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||||
|
|
||||||
|
// 表单禁用
|
||||||
|
const disabled = computed(()=>{
|
||||||
|
if(props.formBpm === true){
|
||||||
|
if(props.formData.disabled === false){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props.formDisabled;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
edit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
nextTick(() => {
|
||||||
|
resetFields();
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交数据
|
||||||
|
*/
|
||||||
|
async function submitForm() {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
confirmLoading.value = true;
|
||||||
|
const isUpdate = ref<boolean>(false);
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
if (model.id) {
|
||||||
|
isUpdate.value = true;
|
||||||
|
}
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await saveOrUpdate(model, isUpdate.value)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
createMessage.success(res.message);
|
||||||
|
emit('ok');
|
||||||
|
} else {
|
||||||
|
createMessage.warning(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
confirmLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
submitForm,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
min-height: 500px !important;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 24px 24px 24px 24px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||||
|
<JwmsForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></JwmsForm>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, nextTick, defineExpose } from 'vue';
|
||||||
|
import JwmsForm from './JwmsForm.vue'
|
||||||
|
|
||||||
|
const title = ref<string>('');
|
||||||
|
const width = ref<number>(800);
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const disableSubmit = ref<boolean>(false);
|
||||||
|
const registerForm = ref();
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
title.value = '新增';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.add();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.edit(record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定按钮点击事件
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
registerForm.value.submitForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* form保存回调事件
|
||||||
|
*/
|
||||||
|
function submitCallback() {
|
||||||
|
handleCancel();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消按钮回调事件
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
disableSubmit,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/**隐藏样式-modal确定按钮 */
|
||||||
|
.jee-hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -18,12 +18,12 @@ export const isOpenSSO = import.meta.env.VITE_GLOB_APP_OPEN_SSO == 'true'?true:f
|
||||||
export const getUserId = () => {
|
export const getUserId = () => {
|
||||||
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO:`, isOpenSSO)
|
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO:`, isOpenSSO)
|
||||||
if(isOpenSSO){
|
if(isOpenSSO){
|
||||||
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO1:`, isOpenSSO)
|
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ userInfo:`, isOpenSSO)
|
||||||
const { userInfo } = useUserStore();
|
const { userInfo } = useUserStore();
|
||||||
//正常取用户
|
//正常取用户
|
||||||
return userInfo?.username;
|
return userInfo?.username;
|
||||||
}else{
|
}else{
|
||||||
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO2:`, isOpenSSO)
|
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO2:`, isOpenSSO,getUserInfo())
|
||||||
//固定某值
|
//固定某值
|
||||||
return '2016900057';//教师//2016900057//2002900176//2001900153
|
return '2016900057';//教师//2016900057//2002900176//2001900153
|
||||||
// return '2022010920';//学生
|
// return '2022010920';//学生
|
||||||
|
@ -42,7 +42,7 @@ export const getUserSf = () => {
|
||||||
/**
|
/**
|
||||||
* 获取当前登录用户信息
|
* 获取当前登录用户信息
|
||||||
*/
|
*/
|
||||||
export const getUserInfo = () => {
|
export const getUserInfo = (): any => {
|
||||||
const { userInfo } = useUserStore();
|
const { userInfo } = useUserStore();
|
||||||
return userInfo??{};
|
return userInfo??{};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue