refactor(risk_history):重构

This commit is contained in:
陈昱达
2025-08-21 13:55:52 +08:00
parent ef654c5d2d
commit 61f018480f

View File

@@ -39,93 +39,6 @@
position: relative;
}
#error-msg {
color: red;
margin-top: 5px;
font-size: 14px;
}
/* 审批意见弹窗样式 */
#examDialogTextarea {
//width: 100%;
height: 120px;
padding: 10px;
box-sizing: border-box;
border: 1px solid #dcdfe6;
border-radius: 4px;
resize: vertical;
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC',
'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
font-size: 14px;
margin: 5px;
}
#examDialogErrorMessage {
margin: 0 5px 5px 10px;
text-align: left;
}
#examDialogOverlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
display: none;
}
#examDialog {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 500px;
max-width: 90%;
background: #fff;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 1000;
display: none;
}
#examDialog .title {
padding: 15px;
border-bottom: 1px solid #e8e8e8;
position: relative;
font-size: 16px;
font-weight: 500;
}
#examDialog .dialog-close {
position: absolute;
top: 12px;
right: 12px;
width: 24px;
height: 24px;
line-height: 24px;
border: none;
background: transparent;
font-size: 18px;
cursor: pointer;
color: #999;
}
#examDialog .dialog-action {
padding: 15px;
text-align: right;
border-top: 1px solid #e8e8e8;
}
#examDialog .dialog-action button {
margin-left: 10px;
padding: 8px 16px;
border-radius: 4px;
border: 1px solid #dcdfe6;
cursor: pointer;
}
#error-msg {
text-align: left;
color: Red;
@@ -717,7 +630,7 @@
<div class="left-nav" id="leftNav">
<div class="nav-header">
<div>历史风险筛查结果</div>
<span id="taCode">213</span>
<!-- <span id="taCode">213</span>-->
</div>
<div class="nav-body" id="navBody">
<div id="loadingNav" class="loading">
@@ -729,8 +642,18 @@
<div class="right-container" id="right-container">
<div class="top-container">
<div class="custom-container">
<span id="custom">客户名称</span>
<span id="time">时间</span>
<span
id="taCode"
style="margin-right:5px; font-size: 16px; font-weight: bold;display: inline-block; padding-top: 5px"
></span>
<span
style="margin-right: 5px; font-size: 16px; font-weight: bold;display: inline-block; padding-top: 5px"
>-</span
>
<span id="custom" style="display: inline-block; font-size: 22px;"
>-客户名称</span
>
<span id="time" style="display: inline-block; ">时间</span>
</div>
<div class="action-container">
<h4 id="insured" style="float:left">投保人</h4>
@@ -767,7 +690,9 @@
<div id="examErrorMessage"></div>
</div>
<button onClick="openExamDialog()">修改审批意见</button>
<button onClick="openExamDialog()" id="modifyExamButton">
修改审批意见
</button>
<div style="clear:both"></div>
</div>
@@ -1229,6 +1154,8 @@
var examContainer = document.getElementById('exam-container')
var examTextarea = document.getElementById('exam-textarea')
var examSelect = document.getElementById('exam-input')
// 获取修改审批意见按钮
var modifyExamButton = document.getElementById('modifyExamButton')
// 0-未审批 1-审批通过 2-审批不通过
@@ -1278,6 +1205,21 @@
// examSelect.value =detailJson.content.content.approveInfo.approveResult
examTextarea.value =
detailJson.content.content.approveInfo.approveOpinion
// 根据是否有审批意见来控制修改审批意见按钮的状态
if (modifyExamButton) {
if (detailJson.content.content.approveInfo.approveOpinion) {
modifyExamButton.disabled = false
modifyExamButton.style.opacity = '1'
modifyExamButton.style.cursor = 'pointer'
} else {
modifyExamButton.disabled = true
modifyExamButton.style.opacity = '0.5'
examTextarea.value = '-'
modifyExamButton.style.cursor = 'not-allowed'
}
}
// examTextarea.value = examSelect.value = detailJson.content.content.examText;
time.innerHTML =
@@ -1480,6 +1422,13 @@
' style="height: 24px; width: 24px; vertical-align: middle;">\n' +
' <span style="vertical-align: middle;margin-left: 20px">正在筛查中...</span>\n' +
'</div>'
// 筛查中状态下禁用修改审批意见按钮
if (modifyExamButton) {
modifyExamButton.disabled = true
modifyExamButton.style.opacity = '0.5'
modifyExamButton.style.cursor = 'not-allowed'
}
return false
}
}
@@ -1711,6 +1660,8 @@
var examDialogErrorMessage = document.getElementById(
'examDialogErrorMessage'
)
// 获取修改审批意见按钮
var modifyExamButton = document.getElementById('modifyExamButton')
// 优先使用弹窗中的文本框
var examValue =
@@ -1721,6 +1672,23 @@
examErrorMessage.innerHTML = ''
examDialogErrorMessage.innerHTML = ''
// 检查审批意见字数是否超过500字
if (examValue && examValue.length > 500) {
if (
examDialogTextarea &&
examDialogTextarea.style.display !== 'none'
) {
// 在弹窗中显示错误
examDialogErrorMessage.innerHTML =
'<span style="color:red;display:block;text-align:left;margin-left: 35px" >审批意见支持录入汉字、大写字母、小写字母、数字、符号不超过500个字请重新输入</span>'
} else {
// 在原位置显示错误
examErrorMessage.innerHTML =
'<span style="color:red;display:block;text-align:left;margin-left: 35px" >审批意见支持录入汉字、大写字母、小写字母、数字、符号不超过500个字请重新输入</span>'
}
return false
}
if (!examValue) {
if (
examDialogTextarea &&
@@ -1728,11 +1696,11 @@
) {
// 在弹窗中显示错误
examDialogErrorMessage.innerHTML =
'<span style="color:red;margin-left: 10px" >请填写审批意见</span>'
'<span style="color:red;display:block;text-align:left;" >请填写审批意见</span>'
} else {
// 在原位置显示错误
examErrorMessage.innerHTML =
'<span style="color:red;margin-left: 10px" >请填写审批意见</span>'
'<span style="color:red;display:block;text-align:left;" >请填写审批意见</span>'
}
return false
}
@@ -1752,6 +1720,14 @@
if (exam) {
exam.value = examValue
}
// 启用修改审批意见按钮并恢复样式
if (modifyExamButton) {
modifyExamButton.disabled = false
modifyExamButton.style.opacity = '1'
modifyExamButton.style.cursor = 'pointer'
}
alert('修改审批意见成功')
closeExamDialog() // 关闭弹窗
}
@@ -1762,6 +1738,12 @@
// 打开审批意见弹窗
function openExamDialog() {
// 获取修改审批意见按钮并检查是否被禁用
var modifyExamButton = document.getElementById('modifyExamButton')
if (modifyExamButton && modifyExamButton.disabled) {
return // 如果按钮被禁用,则不执行任何操作
}
var exam = document.getElementById('exam-textarea')
var examDialog = document.getElementById('examDialog')
var examDialogOverlay = document.getElementById('examDialogOverlay')