Merge branch 'new-1.0' of http://62.234.217.137:3000/Big-Data-Lab/CEES-manage into new-1.0
This commit is contained in:
commit
ea8e4c842f
|
@ -1,5 +1,5 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
|
@ -11,7 +11,15 @@ enum Api {
|
|||
deleteBatch = '/CEES/ceesDormitoryInfo/deleteBatch',
|
||||
importExcel = '/CEES/ceesDormitoryInfo/importExcel',
|
||||
exportXls = '/CEES/ceesDormitoryInfo/exportXls',
|
||||
selectBySex = '/CEES/ceesDormitoryInfo/selectBySex',
|
||||
}
|
||||
/**
|
||||
* 根据性别查询住宿信息
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export const selectBySex = (params) => defHttp.get({ url: Api.selectBySex, params });
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
|
@ -25,8 +33,7 @@ export const getImportUrl = Api.importExcel;
|
|||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
|
@ -35,7 +42,7 @@ export const deleteOne = (params,handleSuccess) => {
|
|||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
|
@ -51,14 +58,14 @@ export const batchDelete = (params, handleSuccess) => {
|
|||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
|
@ -12,8 +12,11 @@ enum Api {
|
|||
importExcel = '/cees/ceesWaiTeacher/importExcel',
|
||||
exportXls = '/cees/ceesWaiTeacher/exportXls',
|
||||
updateGroupUser = '/cees/ceesGroup/updateGroupUser',
|
||||
updataDormitory = 'cees/ceesWaiTeacher/updataDormitory',
|
||||
}
|
||||
|
||||
export const updataDormitory = (id, dormitory) => defHttp.get({ url: Api.updataDormitory, params: { id, dormitory } }); // ✅ 将参数包装为独立的对象 });
|
||||
|
||||
//获取分组
|
||||
export const getGroup = () =>
|
||||
defHttp.get({ url: '/cees/ceesGroup/list' }).then((res) => {
|
||||
|
@ -32,8 +35,7 @@ export const getImportUrl = Api.importExcel;
|
|||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
|
@ -42,7 +44,7 @@ export const deleteOne = (params,handleSuccess) => {
|
|||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
|
@ -58,25 +60,25 @@ export const batchDelete = (params, handleSuccess) => {
|
|||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//更新分组中间表
|
||||
export const updateGroupUser = (params) => {
|
||||
return defHttp.post({ url: Api.updateGroupUser, params });
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
// 更新分组中间表
|
||||
const groupUserParams = {
|
||||
userId: params.userId,
|
||||
groupId: params.groupId
|
||||
}
|
||||
groupId: params.groupId,
|
||||
};
|
||||
updateGroupUser(groupUserParams);
|
||||
return defHttp.post({ url: url, params });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ const filterMajor = (value, row) => {
|
|||
return row === value;
|
||||
};
|
||||
|
||||
const groupOptions=ref()
|
||||
const groupOptions = ref();
|
||||
|
||||
// 创建一个简单的事件总线
|
||||
export const updateGroupOptions = reactive({
|
||||
|
@ -75,7 +75,7 @@ export const columns: BasicColumn[] = [
|
|||
align: 'center',
|
||||
//dataIndex: 'groupId',
|
||||
customRender: ({ text }) => {
|
||||
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||
const group = groupOptions.value.find((item) => item.value === text.groupId);
|
||||
if (group) {
|
||||
return group.label;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,29 @@
|
|||
<span v-if="column.dataIndex === 'majorId'">
|
||||
<span>{{ record.majorIdDescription }}</span>
|
||||
</span>
|
||||
<span v-if="column.dataIndex === 'dormitory'">
|
||||
<!-- 选择逻辑存在问题使placeholder没办法显示 -->
|
||||
<a-select
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
style="width: 120px"
|
||||
v-model:value="record.dormitory"
|
||||
:disabled="record.dormitory !== ''"
|
||||
@focus="handleFocus(record.sex, record)"
|
||||
@change="handleChange(record.userId, record.dormitory, record)"
|
||||
filterables
|
||||
>
|
||||
<template v-if="dormOptions.length === 0">
|
||||
<a-option value="" label="加载中..." disabled />
|
||||
</template>
|
||||
|
||||
<a-option v-for="item in dormOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
|
||||
<template v-if="dormOptions.length === 0">
|
||||
<a-option value="" label="暂无数据" disabled />
|
||||
</template>
|
||||
</a-select>
|
||||
</span>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
|
@ -71,12 +94,20 @@
|
|||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesWaiTeacher.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getGroup } from './CeesWaiTeacher.api';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getGroup, updataDormitory } from './CeesWaiTeacher.api';
|
||||
import { selectBySex } from '/@/views/cees/dormitory/CeesDormitoryInfo.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
import { configStyleImportPlugin } from 'build/vite/plugin/styleImport';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { registerCoordinateSystem } from 'echarts';
|
||||
|
||||
// 定义响应式数据
|
||||
const dormOptions = ref([]);
|
||||
|
||||
//注册model
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
//注册table数据
|
||||
|
@ -250,6 +281,55 @@
|
|||
},
|
||||
];
|
||||
}
|
||||
|
||||
// 定义 handleFocus 函数
|
||||
async function handleFocus(sex, record) {
|
||||
console.log('dormitory:', record.dormitory);
|
||||
console.log('性别:', sex);
|
||||
try {
|
||||
const response = await selectBySex({ sex });
|
||||
console.log('响应:', response);
|
||||
// 检查响应是否为数组
|
||||
if (Array.isArray(response)) {
|
||||
//response.forEach((dormitory, index) => {
|
||||
// console.log(`宿舍 ${index + 1}:`);
|
||||
// console.log(' 宿舍状态:', dormitory.dormitoryStatus);
|
||||
// console.log(' 宿舍类型:', dormitory.dormitoryType);
|
||||
// console.log(' 宿舍名称:', dormitory.dormitory);
|
||||
// console.log(' 组织代码:', dormitory.sysOrgCode);
|
||||
// console.log(' 宿舍编号:', dormitory.dormitoryNum);
|
||||
//});
|
||||
dormOptions.value = response.map((dormitory) => ({
|
||||
label: dormitory.dormitory,
|
||||
value: dormitory.dormitory,
|
||||
}));
|
||||
} else {
|
||||
console.error('预期的响应应该是一个数组。');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('在 handleFocus 中发生错误:', error);
|
||||
}
|
||||
}
|
||||
// 定义 handleFocus 函数
|
||||
async function handleChange(userId, dormitory, record) {
|
||||
console.log('userId', userId);
|
||||
console.log('dormitory', dormitory);
|
||||
let params = {
|
||||
id: userId,
|
||||
dormitory: dormitory,
|
||||
};
|
||||
try {
|
||||
// 正确调用方式(传递独立参数)
|
||||
const response = await updataDormitory(userId, dormitory);
|
||||
console.log('响应:', response);
|
||||
} catch (error) {
|
||||
console.error('在 handleFocus 中发生错误:', error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.ant-select .ant-input__inner::placeholder {
|
||||
color: #999 !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div style="min-height: 400px">
|
||||
<BasicForm @register="registerForm"></BasicForm>
|
||||
<BasicForm @register="registerForm" />
|
||||
<div style="width: 100%; text-align: center" v-if="!formDisabled">
|
||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
|
@ -16,9 +16,9 @@
|
|||
import { saveOrUpdate } from '../CeesWaiTeacher.api';
|
||||
|
||||
export default defineComponent({
|
||||
name: "CeesWaiTeacherForm",
|
||||
name: 'CeesWaiTeacherForm',
|
||||
components: {
|
||||
BasicForm
|
||||
BasicForm,
|
||||
},
|
||||
props: {
|
||||
formData: propTypes.object.def({}),
|
||||
|
@ -29,7 +29,7 @@
|
|||
labelWidth: 150,
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const formDisabled = computed(() => {
|
||||
|
@ -44,18 +44,18 @@
|
|||
async function initFormData() {
|
||||
let params = { id: props.formData.dataId };
|
||||
const data = await defHttp.get({ url: queryByIdUrl, params });
|
||||
formData = {...data}
|
||||
formData = { ...data };
|
||||
//设置表单的值
|
||||
await setFieldsValue(formData);
|
||||
//默认是禁用
|
||||
await setProps({disabled: formDisabled.value})
|
||||
await setProps({ disabled: formDisabled.value });
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
let data = getFieldsValue();
|
||||
let params = Object.assign({}, formData, data);
|
||||
console.log('表单数据', params)
|
||||
await saveOrUpdate(params, true)
|
||||
console.log('表单数据', params);
|
||||
await saveOrUpdate(params, true);
|
||||
}
|
||||
|
||||
initFormData();
|
||||
|
@ -64,7 +64,7 @@
|
|||
registerForm,
|
||||
formDisabled,
|
||||
submitForm,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -18,7 +18,7 @@
|
|||
//labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
|
@ -33,7 +33,7 @@
|
|||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter })
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
|
@ -57,10 +57,10 @@
|
|||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue