diff --git a/src/pages/view/hr/teacherProfile/index.vue b/src/pages/view/hr/teacherProfile/index.vue
index ddbeba6..a5cb1c1 100644
--- a/src/pages/view/hr/teacherProfile/index.vue
+++ b/src/pages/view/hr/teacherProfile/index.vue
@@ -78,7 +78,7 @@ const [register, { getValue, setValue, setSchema }] = useForm({
component: "BasicDataPicker",
componentProps: {
api: findDicTreeByPidApi,
- param: { pid: 100 },
+ param: { pid: 88 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
onChange: (e: any) => {
diff --git a/src/pages/view/routine/qd/publish.vue b/src/pages/view/routine/qd/publish.vue
index cbd69b8..637db3e 100644
--- a/src/pages/view/routine/qd/publish.vue
+++ b/src/pages/view/routine/qd/publish.vue
@@ -128,6 +128,15 @@
+
+
+
+
+ 发布中...
+ 请勿关闭页面或进行其他操作
+
+
+
-
+
{{ getSecondSelectLabel() }}
@@ -54,6 +54,11 @@
+
+
+
+ 💡 提示:选择"所有老师"将直接加载所有教师数据
+
@@ -175,9 +180,10 @@ const showModal = ref(false); // 控制多选弹窗的显示
// 选择类别选项
const selectTypeOptions = [
{ value: 1, label: '所有老师' },
- { value: 2, label: '科目' },
- { value: 3, label: '班主任' },
- { value: 4, label: '职务' }
+ { value: 2, label: '按科目' },
+ { value: 3, label: '按班主任' },
+ { value: 4, label: '按职务' },
+ { value: 5, label: '按年级' }
];
// 职务类型选项
@@ -209,6 +215,8 @@ const getSecondSelectLabel = () => {
return '年级';
case 4:
return '具体职务';
+ case 5:
+ return '年级/班级';
default:
return '请选择';
}
@@ -234,7 +242,13 @@ const onSelectTypeChange = async (e: any) => {
selectTwoType.value = [];
selectedTeachers.value = [];
- if (selectType.value === 1 || selectType.value === 3) {
+ // 如果选择"所有老师",直接加载所有教师数据
+ if (selectType.value === 1) {
+ await loadAllTeachersFromStorage();
+ return;
+ }
+
+ if (selectType.value === 1 || selectType.value === 3 || selectType.value === 5) {
await loadNjData();
} else if (selectType.value === 2) {
await loadKmData();
@@ -274,6 +288,321 @@ const confirmMultiSelect = () => {
loadTeachers();
};
+// 从localStorage加载所有教师数据
+const loadAllTeachersFromStorage = async () => {
+ try {
+ isLoading.value = true;
+
+ console.log('=== 开始从localStorage加载所有教师数据 ===');
+
+ // 从localStorage获取所有教师数据
+ const storageData = uni.getStorageSync('app-common');
+ console.log('localStorage原始数据:', storageData);
+ console.log('storageData的类型:', typeof storageData);
+
+ if (!storageData) {
+ console.warn('localStorage中没有找到app-common数据');
+ uni.showToast({ title: '未找到app-common数据', icon: 'none' });
+ return;
+ }
+
+ // 如果storageData是字符串,需要先解析成对象
+ let parsedData;
+ if (typeof storageData === 'string') {
+ try {
+ parsedData = JSON.parse(storageData);
+ console.log('解析后的数据:', parsedData);
+ } catch (parseError) {
+ console.error('解析localStorage数据失败:', parseError);
+ uni.showToast({ title: '数据格式错误', icon: 'none' });
+ return;
+ }
+ } else {
+ parsedData = storageData;
+ }
+
+ console.log('parsedData的类型:', typeof parsedData);
+ console.log('parsedData是否为对象:', typeof parsedData === 'object');
+ console.log('parsedData的所有属性:', Object.keys(parsedData || {}));
+ console.log('parsedData的data属性:', parsedData?.data);
+ console.log('parsedData的allJs属性:', parsedData?.allJs);
+
+ // 检查数据结构,可能allJs直接在parsedData下
+ let allJsData;
+ if (parsedData.data && parsedData.data.allJs) {
+ allJsData = parsedData.data.allJs;
+ console.log('从parsedData.data.allJs获取数据');
+ } else if (parsedData.allJs) {
+ allJsData = parsedData.allJs;
+ console.log('从parsedData.allJs获取数据');
+ } else {
+ console.warn('localStorage中没有找到allJs数据');
+ console.warn('可用的属性:', Object.keys(parsedData));
+ uni.showToast({ title: '未找到教师数据(allJs)', icon: 'none' });
+ return;
+ }
+
+ console.log('allJs数据结构:', allJsData);
+
+ // 检查allJs是否有result字段
+ if (!allJsData.result) {
+ console.warn('allJs中没有result字段');
+ uni.showToast({ title: '教师数据结构错误', icon: 'none' });
+ return;
+ }
+
+ const allTeachers = allJsData.result;
+ console.log('从localStorage加载的所有教师数据:', allTeachers);
+ console.log('教师数据长度:', allTeachers.length);
+ console.log('教师数据类型:', typeof allTeachers);
+ console.log('是否为数组:', Array.isArray(allTeachers));
+
+ if (!Array.isArray(allTeachers)) {
+ console.warn('allJs.result不是数组格式');
+ uni.showToast({ title: '教师数据格式错误', icon: 'none' });
+ return;
+ }
+
+ if (allTeachers.length === 0) {
+ console.warn('allJs.result数组为空');
+ uni.showToast({ title: '教师数据为空', icon: 'none' });
+ return;
+ }
+
+ // 打印前几个教师数据的结构
+ console.log('第一个教师数据结构:', allTeachers[0]);
+ console.log('第二个教师数据结构:', allTeachers[1]);
+
+ // 处理教师数据格式
+ selectedTeachers.value = allTeachers.map((item: any, index: number) => {
+ const teacher = {
+ id: item.id || item.jsId,
+ jsxm: item.jsxm || item.name || item.label,
+ jsId: item.id || item.jsId,
+ dzzw: item.dzzw || '',
+ qtzw: item.qtzw || ''
+ };
+
+ // 打印每个教师处理后的数据
+ console.log(`教师${index + 1}处理后数据:`, teacher);
+
+ return teacher;
+ });
+
+ console.log('=== 从localStorage加载教师数据完成 ===');
+ console.log('处理后的所有教师数据:', selectedTeachers.value);
+ console.log('最终教师数量:', selectedTeachers.value.length);
+
+ } catch (error: any) {
+ console.error('从localStorage加载教师数据失败:', error);
+ console.error('错误详情:', error.message);
+ console.error('错误堆栈:', error.stack);
+ uni.showToast({ title: '加载教师数据失败', icon: 'none' });
+ } finally {
+ isLoading.value = false;
+ }
+};
+
+// 从localStorage按年级ID加载教师数据
+const loadTeachersByNjIdFromStorage = async () => {
+ try {
+ isLoading.value = true;
+
+ console.log('=== 开始从localStorage按年级加载教师数据 ===');
+ console.log('选中的年级ID:', selectTwoType.value);
+
+ // 从localStorage获取所有教师数据
+ const storageData = uni.getStorageSync('app-common');
+ console.log('localStorage原始数据:', storageData);
+
+ if (!storageData) {
+ console.warn('localStorage中没有找到app-common数据');
+ uni.showToast({ title: '未找到app-common数据', icon: 'none' });
+ return;
+ }
+
+ // 如果storageData是字符串,需要先解析成对象
+ let parsedData;
+ if (typeof storageData === 'string') {
+ try {
+ parsedData = JSON.parse(storageData);
+ console.log('解析后的数据:', parsedData);
+ } catch (parseError) {
+ console.error('解析localStorage数据失败:', parseError);
+ uni.showToast({ title: '数据格式错误', icon: 'none' });
+ return;
+ }
+ } else {
+ parsedData = storageData;
+ }
+
+ // 检查数据结构,可能allJs直接在parsedData下
+ let allJsData;
+ if (parsedData.data && parsedData.data.allJs) {
+ allJsData = parsedData.data.allJs;
+ console.log('从parsedData.data.allJs获取数据');
+ } else if (parsedData.allJs) {
+ allJsData = parsedData.allJs;
+ console.log('从parsedData.allJs获取数据');
+ } else {
+ console.warn('localStorage中没有找到allJs数据');
+ console.warn('可用的属性:', Object.keys(parsedData));
+ uni.showToast({ title: '未找到教师数据(allJs)', icon: 'none' });
+ return;
+ }
+
+ console.log('从localStorage加载的所有教师数据:', allJsData);
+ console.log('教师数据长度:', allJsData.length);
+
+ // 检查allJs是否有result字段
+ if (!allJsData.result) {
+ console.warn('allJs中没有result字段');
+ uni.showToast({ title: '教师数据结构错误', icon: 'none' });
+ return;
+ }
+
+ const teacherArray = allJsData.result;
+ console.log('教师数组数据:', teacherArray);
+ console.log('教师数组长度:', teacherArray.length);
+
+ // 根据选中的年级ID过滤教师
+ const filteredTeachers = teacherArray.filter((teacher: any) => {
+ const hasNjId = selectTwoType.value.includes(teacher.njId);
+ console.log(`教师${teacher.jsxm || teacher.name}的年级ID:`, teacher.njId, '是否匹配:', hasNjId);
+ return hasNjId;
+ });
+
+ console.log('按年级过滤后的教师数据:', filteredTeachers);
+ console.log('过滤后教师数量:', filteredTeachers.length);
+
+ // 处理教师数据格式
+ selectedTeachers.value = filteredTeachers.map((item: any) => ({
+ id: item.id || item.jsId,
+ jsxm: item.jsxm || item.name || item.label,
+ jsId: item.id || item.jsId,
+ dzzw: item.dzzw || '',
+ qtzw: item.qtzw || ''
+ }));
+
+ console.log('=== 从localStorage按年级加载教师数据完成 ===');
+ console.log('最终处理后的年级教师数据:', selectedTeachers.value);
+ console.log('最终教师数量:', selectedTeachers.value.length);
+
+ } catch (error: any) {
+ console.error('从localStorage按年级加载教师数据失败:', error);
+ console.error('错误详情:', error.message);
+ console.error('错误堆栈:', error.stack);
+ uni.showToast({ title: '加载教师数据失败', icon: 'none' });
+ } finally {
+ isLoading.value = false;
+ }
+};
+
+// 从localStorage按职务ID加载教师数据
+const loadTeachersByZwIdFromStorage = async () => {
+ try {
+ isLoading.value = true;
+ console.log('=== 开始从localStorage按职务加载教师数据 ===');
+ console.log('选中的职务ID:', selectTwoType.value);
+ console.log('职务类型:', zwType.value === 1 ? '党政职务' : '其他职务');
+
+ // 从localStorage获取所有教师数据
+ const storageData = uni.getStorageSync('app-common');
+ console.log('localStorage原始数据:', storageData);
+
+ if (!storageData) {
+ console.warn('localStorage中没有找到app-common数据');
+ uni.showToast({ title: '未找到app-common数据', icon: 'none' });
+ return;
+ }
+
+ // 如果storageData是字符串,需要先解析成对象
+ let parsedData;
+ if (typeof storageData === 'string') {
+ try {
+ parsedData = JSON.parse(storageData);
+ console.log('解析后的数据:', parsedData);
+ } catch (parseError) {
+ console.error('解析localStorage数据失败:', parseError);
+ uni.showToast({ title: '数据格式错误', icon: 'none' });
+ return;
+ }
+ } else {
+ parsedData = storageData;
+ }
+
+ // 检查数据结构,从parsedData.data.allJs获取教师数据
+ if (!parsedData.data || !parsedData.data.allJs) {
+ console.warn('localStorage中没有找到教师数据');
+ console.warn('可用的属性:', Object.keys(parsedData || {}));
+ uni.showToast({ title: '未找到教师数据', icon: 'none' });
+ return;
+ }
+
+ const allJsData = parsedData.data.allJs;
+ console.log('allJs数据结构:', allJsData);
+
+ // 检查allJs是否有result字段
+ if (!allJsData.result) {
+ console.warn('allJs中没有result字段');
+ uni.showToast({ title: '教师数据结构错误', icon: 'none' });
+ return;
+ }
+
+ const teacherArray = allJsData.result;
+ console.log('教师数组数据:', teacherArray);
+ console.log('教师数组长度:', teacherArray.length);
+
+ // 根据职务类型和选中的职务ID过滤教师
+ const selectedZwId = selectTwoType.value[0]; // 假设只选择一个职务
+ const filteredTeachers = teacherArray.filter((teacher: any) => {
+ let hasZwId = false;
+
+ if (zwType.value === 1) {
+ // 党政职务:检查dzzw字段
+ if (teacher.dzzw) {
+ const dzzwArray = teacher.dzzw.split(',');
+ hasZwId = dzzwArray.includes(selectedZwId);
+ }
+ console.log(`教师${teacher.jsxm || teacher.name}的党政职务:`, teacher.dzzw, '是否匹配职务ID:', selectedZwId, '结果:', hasZwId);
+ } else if (zwType.value === 2) {
+ // 其他职务:检查qtzw字段
+ if (teacher.qtzw) {
+ const qtzwArray = teacher.qtzw.split(',');
+ hasZwId = qtzwArray.includes(selectedZwId);
+ }
+ console.log(`教师${teacher.jsxm || teacher.name}的其他职务:`, teacher.qtzw, '是否匹配职务ID:', selectedZwId, '结果:', hasZwId);
+ }
+
+ return hasZwId;
+ });
+
+ console.log('按职务过滤后的教师数据:', filteredTeachers);
+ console.log('过滤后教师数量:', filteredTeachers.length);
+
+ // 处理教师数据格式
+ selectedTeachers.value = filteredTeachers.map((item: any) => ({
+ id: item.id || item.jsId,
+ jsxm: item.jsxm || item.name || item.label,
+ jsId: item.id || item.jsId,
+ dzzw: item.dzzw || '',
+ qtzw: item.qtzw || ''
+ }));
+
+ console.log('=== 从localStorage按职务加载教师数据完成 ===');
+ console.log('最终处理后的职务教师数据:', selectedTeachers.value);
+ console.log('最终教师数量:', selectedTeachers.value.length);
+
+ } catch (error: any) {
+ console.error('从localStorage按职务加载教师数据失败:', error);
+ console.error('错误详情:', error.message);
+ console.error('错误堆栈:', error.stack);
+ uni.showToast({ title: '加载教师数据失败', icon: 'none' });
+ } finally {
+ isLoading.value = false;
+ }
+};
+
// 加载年级数据
const loadNjData = async () => {
try {
@@ -367,39 +696,68 @@ const loadKmData = async () => {
// 加载职务数据
const loadZwData = async () => {
try {
- const result:any = await zwFindAllApi();
- console.log('职务API返回结果:', result);
+ console.log('=== 开始从localStorage加载职务数据 ===');
- // 处理不同的返回格式
- let allZwData = [];
- if (Array.isArray(result)) {
- allZwData = result;
- } else if (result && typeof result === 'object') {
- // 检查各种可能的属性
- if (Array.isArray(result.result)) {
- allZwData = result.result;
- } else if (result.resultCode === 1 && Array.isArray(result.result)) {
- allZwData = result.result;
- } else if (Array.isArray(result.data)) {
- allZwData = result.data;
- } else {
- console.warn('职务数据格式异常:', result);
- allZwData = [];
- }
- } else {
- console.warn('职务数据格式异常:', result);
- allZwData = [];
+ // 从localStorage获取职务数据
+ const storageData = uni.getStorageSync('app-common');
+ console.log('localStorage原始数据:', storageData);
+
+ if (!storageData) {
+ console.warn('localStorage中没有找到app-common数据');
+ uni.showToast({ title: '未找到app-common数据', icon: 'none' });
+ return;
}
- // 根据职务类型过滤数据
- const filteredData = allZwData.filter((item: any) => {
- if (zwType.value === 1) {
- return item.zwlx === '1' || item.zwlx === '党政职务' || item.zwlx === 'A' || item.zwlx === 'dzzw';
- } else if (zwType.value === 2) {
- return item.zwlx === '2' || item.zwlx === '其他职务' || item.zwlx === 'B' || item.zwlx === 'qtzw';
+ // 如果storageData是字符串,需要先解析成对象
+ let parsedData;
+ if (typeof storageData === 'string') {
+ try {
+ parsedData = JSON.parse(storageData);
+ console.log('解析后的数据:', parsedData);
+ } catch (parseError) {
+ console.error('解析localStorage数据失败:', parseError);
+ uni.showToast({ title: '数据格式错误', icon: 'none' });
+ return;
}
- return true;
- });
+ } else {
+ parsedData = storageData;
+ }
+
+ console.log('parsedData的data属性:', parsedData?.data);
+ console.log('parsedData.data.zw:', parsedData?.data?.zw);
+
+ // 检查数据结构,从parsedData.data.zw获取职务数据
+ if (!parsedData.data || !parsedData.data.zw) {
+ console.warn('localStorage中没有找到职务数据');
+ console.warn('可用的属性:', Object.keys(parsedData || {}));
+ uni.showToast({ title: '未找到职务数据', icon: 'none' });
+ return;
+ }
+
+ const zwData = parsedData.data.zw;
+ console.log('职务数据结构:', zwData);
+
+ // 根据职务类型过滤数据
+ let filteredData = [];
+ if (zwType.value === 1) {
+ // 党政职务
+ if (zwData['党政职务'] && zwData['党政职务'].result) {
+ filteredData = zwData['党政职务'].result;
+ console.log('党政职务数据:', filteredData);
+ }
+ } else if (zwType.value === 2) {
+ // 其他职务
+ if (zwData['其他职务'] && zwData['其他职务'].result) {
+ filteredData = zwData['其他职务'].result;
+ console.log('其他职务数据:', filteredData);
+ }
+ }
+
+ if (filteredData.length === 0) {
+ console.warn('没有找到对应类型的职务数据');
+ uni.showToast({ title: '未找到对应类型的职务数据', icon: 'none' });
+ return;
+ }
// 前端排序:按sort字段排序,如果没有sort字段则按名称排序
const sortedData = filteredData.sort((a: any, b: any) => {
@@ -417,6 +775,7 @@ const loadZwData = async () => {
value: item.id || item.value
}));
+ console.log('=== 从localStorage加载职务数据完成 ===');
console.log('处理后的职务数据:', datas.value);
} catch (error) {
console.error('加载职务数据失败:', error);
@@ -426,7 +785,21 @@ const loadZwData = async () => {
// 加载教师数据
const loadTeachers = async () => {
- if (!selectType.value || !selectTwoType.value.length) return;
+ if (!selectType.value) return;
+
+ // 如果是"按年级"且选择了年级,从localStorage加载该年级的教师
+ if (selectType.value === 5 && selectTwoType.value.length > 0) {
+ await loadTeachersByNjIdFromStorage();
+ return;
+ }
+
+ // 如果是"按职务"且选择了职务,从localStorage查询教师
+ if (selectType.value === 4 && selectTwoType.value.length > 0) {
+ await loadTeachersByZwIdFromStorage();
+ return;
+ }
+
+ if (!selectTwoType.value.length) return;
isLoading.value = true;
try {
@@ -436,11 +809,7 @@ const loadTeachers = async () => {
for (const selectedValue of selectTwoType.value) {
let result:any;
- if (selectType.value === 1) {
- result = await jsFindByNjIdOrBjIdApi({
- njOrBjId: selectedValue
- });
- } else if (selectType.value === 2) {
+ if (selectType.value === 2) {
result = await jsFindByKmIdApi({
kmId: selectedValue
});
@@ -448,11 +817,6 @@ const loadTeachers = async () => {
result = await jsFindByBzrNjIdApi({
njId: selectedValue
});
- } else if (selectType.value === 4) {
- result = await jsFindByZwIdApi({
- zwId: selectedValue,
- zwType: zwType.value.toString()
- });
}
console.log('教师API返回结果:', result);
@@ -640,6 +1004,22 @@ onMounted(() => {
cursor: pointer;
}
+.filter-tip {
+ margin-top: 10px;
+ padding: 8px 12px;
+ background-color: #e6f7ff;
+ border: 1px solid #91d5ff;
+ border-radius: 6px;
+ font-size: 13px;
+ color: #1890ff;
+ display: flex;
+ align-items: center;
+}
+
+.tip-text {
+ margin-left: 5px;
+}
+
.modal-overlay {
position: fixed;
top: 0;