From 7bc37528537e5265b1c6323029edb564d963bf6f Mon Sep 17 00:00:00 2001 From: dshclm <3321914460@qq.com> Date: Tue, 27 May 2025 09:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=99=BB=E8=AE=B0=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E3=80=81=E5=AF=86=E7=BA=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/system/newdev/apply/add.html | 80 ++++++++++++--- .../templates/system/newdev/apply/edit.html | 99 ++++++++++++++++--- .../system/newdev/apply/editFile.html | 40 ++++---- 3 files changed, 169 insertions(+), 50 deletions(-) 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 @@ - <!DOCTYPE html> <html lang="zh" xmlns:th="http://www.thymeleaf.org"> <head> @@ -255,26 +254,38 @@ placeholder="请输入单位及职务职称"> </div> </div> + <!-- 已(拟)任涉密岗位 - 修改为下拉框 --> <div class="space-y-3"> <label for="smPost" class="block text-sm font-medium text-gray-700 is-required control-label">已(拟)任涉密岗位</label> <div class="relative"> - <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> - <i class="fa-solid fa-shield-halved"></i> - </span> - <input required type="text" id="smPost" v-model="formData.smPost" - class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" - placeholder="请输入已(拟)任涉密岗位"> + <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> + <i class="fa-solid fa-shield-halved"></i> + </span> + <select required id="smPost" v-model="formData.smPost" + class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200 appearance-none"> + <option value="">请选择岗位</option> + <option v-for="post in postOptions" :value="post">{{ post }}</option> + </select> + <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"> + <i class="fa-solid fa-chevron-down text-gray-400"></i> + </div> </div> </div> + <!-- 涉密等级 - 修改为下拉框 --> <div class="space-y-3"> <label for="smGrade" class="block text-sm font-medium text-gray-700 is-required control-label">涉密等级</label> <div class="relative"> - <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> - <i class="fa-solid fa-lock"></i> - </span> - <input required type="text" id="smGrade" v-model="formData.smGrade" - class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" - placeholder="请输入涉密等级"> + <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> + <i class="fa-solid fa-lock"></i> + </span> + <select required id="smGrade" v-model="formData.smGrade" + class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200 appearance-none"> + <option value="">请选择等级</option> + <option v-for="level in levelOptions" :value="level">{{ level }}</option> + </select> + <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"> + <i class="fa-solid fa-chevron-down text-gray-400"></i> + </div> </div> </div> </div> @@ -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(); } }); </script> </body> -</html> +</html> \ 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="请输入单位及职务职称"> </div> </div> + <!-- 已(拟)任涉密岗位 - 修改为下拉框 --> <div class="space-y-3"> <label for="smPost" class="block text-sm font-medium text-gray-700 is-required control-label">已(拟)任涉密岗位</label> <div class="relative"> - <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> - <i class="fa-solid fa-shield-halved"></i> - </span> - <input required type="text" id="smPost" v-model="formData.smPost" - class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" - placeholder="请输入已(拟)任涉密岗位"> + <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> + <i class="fa-solid fa-shield-halved"></i> + </span> + <select required id="smPost" v-model="formData.smPost" + class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200 appearance-none"> + <option value="">请选择岗位</option> + <option v-for="post in postOptions" :value="post">{{ post }}</option> + </select> + <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"> + <i class="fa-solid fa-chevron-down text-gray-400"></i> + </div> </div> </div> + <!-- 涉密等级 - 修改为下拉框 --> <div class="space-y-3"> <label for="smGrade" class="block text-sm font-medium text-gray-700 is-required control-label">涉密等级</label> <div class="relative"> - <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> - <i class="fa-solid fa-lock"></i> - </span> - <input required type="text" id="smGrade" v-model="formData.smGrade" - class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" - placeholder="请输入涉密等级"> + <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> + <i class="fa-solid fa-lock"></i> + </span> + <select required id="smGrade" v-model="formData.smGrade" + class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200 appearance-none"> + <option value="">请选择等级</option> + <option v-for="level in levelOptions" :value="level">{{ level }}</option> + </select> + <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"> + <i class="fa-solid fa-chevron-down text-gray-400"></i> + </div> </div> </div> </div> @@ -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 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-user"></i> </span> - <input type="text" id="name" v-model="formData.name" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入姓名"> + <input disabled type="text" id="name" v-model="formData.name" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入姓名"> </div> </div> @@ -87,7 +87,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-venus-mars"></i> </span> - <input type="text" id="sex" v-model="formData.sex" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入性别"> + <input disabled type="text" id="sex" v-model="formData.sex" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入性别"> </div> </div> </div> @@ -100,7 +100,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-globe"></i> </span> - <input type="text" id="nationa" v-model="formData.nationa" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入国籍"> + <input disabled type="text" id="nationa" v-model="formData.nationa" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入国籍"> </div> </div> @@ -111,7 +111,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-user-tag"></i> </span> - <input type="text" id="formerName" v-model="formData.formerName" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入曾用名"> + <input disabled type="text" id="formerName" v-model="formData.formerName" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg" placeholder="请输入曾用名"> </div> </div> </div> @@ -125,7 +125,7 @@ <i class="fa-solid fa-cloud-upload text-4xl text-gray-400 mb-2"></i> <label for="photo" class="cursor-pointer bg-white rounded-md font-medium text-primary hover:text-primary/80"> <span>上传照片</span> - <input id="photo" name="photo" type="file" accept="image/jpeg,image/png" class="sr-only" @change="handleFileUpload"> + <input disabled id="photo" name="photo" type="file" accept="image/jpeg,image/png" class="sr-only" @change="handleFileUpload"> </label> <p class="text-xs text-gray-500"> JPG, PNG (最大 2MB) @@ -135,9 +135,9 @@ <!-- 预览区域(选中后显示) --> <div v-else class="h-full flex flex-col items-center justify-center p-3"> <img :src="previewUrl" alt="预览图" class="max-h-full max-w-full object-cover rounded-lg mb-2" style="max-height: 200px;"> - <button type="button" @click="clearFile" class="text-xs text-red-500 hover:text-red-700"> - <i class="fa-solid fa-times-circle mr-1"></i> 移除 - </button> +<!-- <button type="button" @click="clearFile" class="text-xs text-red-500 hover:text-red-700">--> +<!-- <i class="fa-solid fa-times-circle mr-1"></i> 移除--> +<!-- </button>--> </div> </div> </div> @@ -147,7 +147,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-people-group"></i> </span> - <input type="text" id="nationality" v-model="formData.nationality" + <input disabled type="text" id="nationality" v-model="formData.nationality" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入民族"> </div> @@ -158,7 +158,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-ring"></i> </span> - <input type="text" id="maritalStatus" v-model="formData.maritalStatus" + <input disabled type="text" id="maritalStatus" v-model="formData.maritalStatus" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入婚姻状况"> @@ -170,7 +170,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-user-tie"></i> </span> - <input type="text" id="political" v-model="formData.political" + <input disabled type="text" id="political" v-model="formData.political" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入政治面貌"> </div> @@ -181,7 +181,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-phone"></i> </span> - <input type="text" id="phone" v-model="formData.phone" + <input disabled type="text" id="phone" v-model="formData.phone" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入联系方式"> </div> @@ -192,7 +192,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-id-card"></i> </span> - <input type="text" id="cerno" v-model="formData.cerno" + <input disabled type="text" id="cerno" v-model="formData.cerno" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入身份证号"> </div> @@ -203,7 +203,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-house-chimney"></i> </span> - <input type="text" id="address" v-model="formData.address" + <input disabled type="text" id="address" v-model="formData.address" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入户籍地址"> </div> @@ -214,7 +214,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-badge-shield"></i> </span> - <input type="text" id="registeredAuthority" v-model="formData.registeredAuthority" + <input disabled type="text" id="registeredAuthority" v-model="formData.registeredAuthority" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入户籍地公安机关"> </div> @@ -225,7 +225,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-house"></i> </span> - <input type="text" id="permanentAddress" v-model="formData.permanentAddress" + <input disabled type="text" id="permanentAddress" v-model="formData.permanentAddress" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入常住地址"> </div> @@ -236,7 +236,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-badge-shield"></i> </span> - <input type="text" id="residentBureau" v-model="formData.residentBureau" + <input disabled type="text" id="residentBureau" v-model="formData.residentBureau" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入常住地公安机关"> </div> @@ -247,7 +247,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-building-user"></i> </span> - <input type="text" id="positionCapacity" v-model="formData.positionCapacity" + <input disabled type="text" id="positionCapacity" v-model="formData.positionCapacity" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入单位及职务职称"> </div> @@ -258,7 +258,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-shield-halved"></i> </span> - <input type="text" id="smPost" v-model="formData.smPost" + <input disabled type="text" id="smPost" v-model="formData.smPost" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入已(拟)任涉密岗位"> </div> @@ -269,7 +269,7 @@ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500"> <i class="fa-solid fa-lock"></i> </span> - <input type="text" id="smGrade" v-model="formData.smGrade" + <input disabled type="text" id="smGrade" v-model="formData.smGrade" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors duration-200" placeholder="请输入涉密等级"> </div>