diff --git a/ruoyi-admin/src/main/resources/templates/system/newdev/apply/add.html b/ruoyi-admin/src/main/resources/templates/system/newdev/apply/add.html index 25b81fdf..0267ac4e 100644 --- a/ruoyi-admin/src/main/resources/templates/system/newdev/apply/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/newdev/apply/add.html @@ -1,4 +1,3 @@ - @@ -255,26 +254,38 @@ placeholder="请输入单位及职务职称"> +
- - - - + + + + +
+ +
+
- - - - + + + + +
+ +
@@ -314,8 +325,8 @@ permanentAddress: '', residentBureau: '', positionCapacity: '', - smPost: '', - smGrade: '', + smPost: '', // 下拉框选中值 + smGrade: '', // 下拉框选中值 photoUrl: '', applyId: '', }, @@ -332,6 +343,11 @@ uploadSuccess: false, uploadSuccessMessage: '', prefix: ctx + "system/applyList", + // 新增下拉框数据 + postOptions: [], // 已(拟)任涉密岗位选项 + levelOptions: [], // 涉密等级选项 + isLoadingPosts: false, + isLoadingLevels: false }, computed: { previewUrl() { @@ -498,11 +514,43 @@ }); }); }, + // 新增获取下拉框数据的方法 + fetchPostOptions() { + this.isLoadingPosts = true; + axios.post('/system/classifiedPost/getPostNames') + .then(response => { + // 直接使用返回的字符串数组 + this.postOptions = response.data.data || []; + this.isLoadingPosts = false; + }) + .catch(error => { + console.error('获取涉密岗位数据失败:', error); + this.isLoadingPosts = false; + this.$message.error('获取涉密岗位数据失败,请刷新页面重试'); + }); + }, + fetchLevelOptions() { + this.isLoadingLevels = true; + axios.post('/system/classifiedPost/getClassifiedLevels') + .then(response => { + // 直接使用返回的字符串数组 + this.levelOptions = response.data.data || []; + this.isLoadingLevels = false; + }) + .catch(error => { + console.error('获取涉密等级数据失败:', error); + this.isLoadingLevels = false; + this.$message.error('获取涉密等级数据失败,请刷新页面重试'); + }); + } }, mounted() { + // 页面加载时获取下拉框数据 + this.fetchPostOptions(); + this.fetchLevelOptions(); } }); - + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/newdev/apply/edit.html b/ruoyi-admin/src/main/resources/templates/system/newdev/apply/edit.html index 47d05b15..8c5e28b4 100644 --- a/ruoyi-admin/src/main/resources/templates/system/newdev/apply/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/newdev/apply/edit.html @@ -254,26 +254,38 @@ placeholder="请输入单位及职务职称"> +
- - - - + + + + +
+ +
+
- - - - + + + + +
+ +
@@ -313,8 +325,8 @@ permanentAddress: '', residentBureau: '', positionCapacity: '', - smPost: '', - smGrade: '', + smPost: '', // 下拉框选中值 + smGrade: '', // 下拉框选中值 photoUrl: '', applyId: '', }, @@ -331,6 +343,11 @@ uploadSuccess: false, uploadSuccessMessage: '', prefix: ctx + "system/applyList", + // 新增下拉框数据 + postOptions: [], // 已(拟)任涉密岗位选项 + levelOptions: [], // 涉密等级选项 + isLoadingPosts: false, + isLoadingLevels: false }, computed: { previewUrl() { @@ -485,6 +502,10 @@ type: 'warning' }).then(() => { $.operate.saveTab(`${this.prefix}/edit`,this.formData); + this.$message({ + type: 'success', + message: '提交成功!' + }); }).catch(() => { this.$message({ type: 'info', @@ -492,6 +513,53 @@ }); }); }, + // 新增获取下拉框数据的方法 + fetchPostOptions() { + this.isLoadingPosts = true; + axios.post('/system/classifiedPost/getPostNames') + .then(response => { + // 直接使用返回的字符串数组 + this.postOptions = response.data.data || []; + this.isLoadingPosts = false; + // 数据加载完成后,检查是否需要设置选中值 + this.setSelectedValues(); + }) + .catch(error => { + console.error('获取涉密岗位数据失败:', error); + this.isLoadingPosts = false; + this.$message.error('获取涉密岗位数据失败,请刷新页面重试'); + }); + }, + fetchLevelOptions() { + this.isLoadingLevels = true; + axios.post('/system/classifiedPost/getClassifiedLevels') + .then(response => { + // 直接使用返回的字符串数组 + this.levelOptions = response.data.data || []; + this.isLoadingLevels = false; + // 数据加载完成后,检查是否需要设置选中值 + this.setSelectedValues(); + }) + .catch(error => { + console.error('获取涉密等级数据失败:', error); + this.isLoadingLevels = false; + this.$message.error('获取涉密等级数据失败,请刷新页面重试'); + }); + }, + // 设置下拉框的选中值 + setSelectedValues() { + // 只有当两个下拉框的数据都加载完成后才设置选中值 + if (this.postOptions.length > 0 && this.levelOptions.length > 0) { + // 如果从后端获取的数据中有 smPost 值,并且该值存在于选项中,则设置为选中 + if (this.formData.smPost && this.postOptions.includes(this.formData.smPost)) { + this.formData.smPost = this.formData.smPost; + } + // 如果从后端获取的数据中有 smGrade 值,并且该值存在于选项中,则设置为选中 + if (this.formData.smGrade && this.levelOptions.includes(this.formData.smGrade)) { + this.formData.smGrade = this.formData.smGrade; + } + } + } }, mounted() { // 从后端获取转义后的 JSON 字符串 @@ -507,6 +575,9 @@ .catch(error => console.error('处理图片时出错:', error)); } } + // 页面加载时获取下拉框数据 + this.fetchPostOptions(); + this.fetchLevelOptions(); } }); //图片上传 diff --git a/ruoyi-admin/src/main/resources/templates/system/newdev/apply/editFile.html b/ruoyi-admin/src/main/resources/templates/system/newdev/apply/editFile.html index 313cb04e..2f325358 100644 --- a/ruoyi-admin/src/main/resources/templates/system/newdev/apply/editFile.html +++ b/ruoyi-admin/src/main/resources/templates/system/newdev/apply/editFile.html @@ -76,7 +76,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -125,7 +125,7 @@

JPG, PNG (最大 2MB) @@ -135,9 +135,9 @@

预览图 - + + +
@@ -147,7 +147,7 @@ - @@ -158,7 +158,7 @@ - @@ -170,7 +170,7 @@ - @@ -181,7 +181,7 @@ - @@ -192,7 +192,7 @@ - @@ -203,7 +203,7 @@ - @@ -214,7 +214,7 @@ - @@ -225,7 +225,7 @@ - @@ -236,7 +236,7 @@ - @@ -247,7 +247,7 @@ - @@ -258,7 +258,7 @@ - @@ -269,7 +269,7 @@ -