【调度系统】广东民航医疗快线调度系统源代码
wanglizhong
2025-04-28 1e955583470b47f7636eaba800c52c258ac24296
ServiceOrder.gds
@@ -1181,6 +1181,289 @@
                              
                              </div>
                     </div>
                     <div class="field">
                        <!-- 开单人 -->
                        <%
                        EntourageID_OpenUser = "-8"
                        departmentID_OpenUser = "9"
                        OpenUserID = ""
                        OpenUserName = ""
                        OpenUserRatio = ""
                        OpenerAndFollowerEnableModify = False
                        if isDepartment("020140")=1 then
                           OpenerAndFollowerEnableModify=True
                        End If
                        If ServiceOrdID<>"" Then
                           openSql="select * from ServiceOrderCommissionDetails where ServiceOrderID="&ServiceOrdID&" and PersonType='Opener'"
                           rs.open openSql,objConn,1,1
                           If not rs.Eof Then
                           OpenUserID = rs("PersonID")
                           OpenUserName = rs("PersonName")
                           OpenUserRatio = rs("CommissionRatio")
                           End If
                           rs.close()
                        End If
                        %>
                        <div class="label" style="float: left;margin-left: 0px;"><label for="input-small">开单人:</label></div>
                        <div class="input" style="float:left;margin-left: 70px;">
                           <input id="Entourage_<%=EntourageID_OpenUser%>" name="OpenUserID" type="hidden" value="<%=OpenUserID%>">
                           <input type="text" id="EntourageName_<%=EntourageID_OpenUser%>" name="OpenUserName" <% if OpenerAndFollowerEnableModify=False Then%> disabled <% end If%> class="small" <%If OpenUserID="" Or OpenerAndFollowerEnableModify=True Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID_OpenUser%>','-<%=departmentID_OpenUser%>');"<%End If%> style="width:138px;" value="<%=OpenUserName%>" readonly="true">
                        </div>
                        <%
                           followerCount = 0
                           showFollower = False
                           If ServiceOrdID<>"" Then
                              followerSqlCount="select count(1) from ServiceOrderCommissionDetails where ServiceOrderID="&ServiceOrdID&" and PersonType='Follower'"
                              rs.open followerSqlCount,objConn,1,1
                              If Not rs.EOF Then
                                 ' 获取查询结果
                                 followerCount = rs.Fields(0).Value
                                 if followerCount>0 then
                                    showFollower = True
                                 else
                                    showFollower = False
                                 end if
                              Else
                                 ' 如果记录集为空,将结果设为 0
                                 followerCount = 0
                                 showFollower = False
                              End If
                              rs.close()
                           End If
                           EditFollower=True
                           showTopFollowerAdd=True
                           if showFollower=True then
                              showTopFollowerAdd=False
                           End If
                           if OpenerAndFollowerEnableModify=False Then
                              EditFollower=False
                              showTopFollowerAdd=False
                           End If
                        %>
                        <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">提成比例(%):</label></div>
                        <div class="input" style="float:left;margin-left: 86px;">
                           <input type="text" id="OpenUserRatio" name="OpenUserRatio" <% if EditFollower=False Then%> disabled <% end If%> value="<%=OpenUserRatio%>" class="small" style="width:50px;">
                        </div>
                        <div class="input" style="float:left;margin-left: 10px;">
                        <button class="ui-state-default" <% If showTopFollowerAdd=False then %> style='display:none' <% End If%> id="inputTopAddFollower" onclick="return showFollower();">添加跟单人</button>
                        </div>
                        </div>
                        <div class="field" id="followerDiv" <% If showFollower<>True  then %> style="display:none;" <% end if%>>
                           <!-- 跟单人 -->
                           <input type="hidden" id="hidFollowerCount" name="FollowersCount" value="<%=followerCount%>"/>
                           <div class="label" style="float: left;margin-left: 10px;"><label for="input-small">跟单人:</label></div>
                           <div class="input" style="float:left;margin-left: 70px;">
                              <div id="FollowersList">
                                 <%
                                 FollowerCount = 1
                                 EntourageID_Follower = "-9"
                                 departmentID_Follower = "9"
                                 if ServiceOrdID<>"" then
                                    followerSql="select * from ServiceOrderCommissionDetails where ServiceOrderID="&ServiceOrdID&" and PersonType='Follower'"
                                    rs.open followerSql,objConn,1,1
                                    FollowerIndex=1
                                    do while not rs.Eof
                                       FollowerID = rs("PersonID")
                                       FollowerName = rs("PersonName")
                                       FollowerRatio = rs("CommissionRatio")
                                 %>
                                 <div class="follower-item">
                                    <input  name="FollowerID_<%=FollowerIndex%>" id="FollowerId_<%=FollowerIndex%>" type="hidden" value="<%=FollowerID%>">
                                    <input type="text" name="FollowerName_<%=FollowerIndex%>"  <% if EditFollower=False Then %> disabled <% End If%> id="FollowerName_<%=FollowerIndex%>" class="small" <%If FollowerID="" Or isDepartment("020140")=1 Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID_Follower%>_<%=FollowerCount%>','-<%=departmentID_Follower%>');"<%End If%> style="width:138px;" value="<%=FollowerName%>" readonly="true">
                                    <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">提成比例(%):</label></div>
                                    <div class="input" style="float:left;margin-left: 87px;">
                                       <input type="text" id="FollowerRatio_<%=FollowerIndex%>"  <% if EditFollower=False Then %> disabled <% End If%> name="FollowerRatio_<%=FollowerIndex%>" class="small" style="width:50px;" value="<%=FollowerRatio%>" />
                                    </div>
                                    <div class="input" style="float:left;margin-left: 10px;">
                                       <button <% if EditFollower=False Then %> style="display:none" <% End If%> onclick="return removeFollower();">删除</button>
                                    </div>
                                 </div>
                                 <%
                                    FollowerIndex=FollowerIndex+1
                                    rs.movenext
                                    loop
                                    rs.close()
                                 End If
                                 %>
                              </div>
                              <button  <% if EditFollower=False Then %> style="display:none" <% End If%> class="ui-state-default" onclick="return addFollower()">添加跟单人</button>
                           </div>
                        </div>
                        <style>
                           /* 其他已有样式... */
                           .follower-item {
                              margin-bottom: 10px; /* 每个跟单人项之间的间距 */
                              clear: both; /* 清除浮动 */
                              overflow: hidden; /* 处理浮动元素 */
                           }
                           .follower-item input {
                              margin-right: 10px; /* 输入框之间的间距 */
                           }
                        </style>
                     <script LANGUAGE="javascript">
                     function showFollower(){
                        document.getElementById("followerDiv").style.display="";
                        document.getElementById("inputTopAddFollower").style.display="none";
                        addFollower()
                        return false;
                     }
                     function checkOpenerAndFollower(){
                        // 获取开单人信息
                        var openerNameInput = document.getElementById("EntourageName_<%=EntourageID_OpenUser%>");
                        var openerName = openerNameInput.value;
                        var openerRatioInput = document.getElementById("OpenUserRatio");
                        var openerRatio = openerRatioInput.value;
                        // 检测开单人姓名是否为空
                        //if (openerName === "") {
                        //   alert("开单人姓名不能为空");
                        //   return false;
                        //}
                        // 检测开单人提成比例是否为空
                        if (openerName !="" && openerRatio === "") {
                           alert("开单人提成比例不能为空");
                           return false;
                        }
                        // 存储跟单人姓名和提成比例
                        var followerNames = [];
                        var followerRatios = [];
                        var followersList = document.getElementById('FollowersList');
                        var followerItems = followersList.getElementsByClassName('follower-item');
                        // 遍历跟单人,收集姓名和提成比例并进行检测
                        for (var i = 0; i < followerItems.length; i++) {
                           var followerNameInput = followerItems[i].querySelector('input[name^="FollowerName_"]');
                           var followerName = followerNameInput.value;
                           var followerRatioInput = followerItems[i].querySelector('input[name^="FollowerRatio_"]');
                           var followerRatio = followerRatioInput.value;
                           // 检测跟单人姓名是否为空
                           if (followerName === "") {
                              alert("跟单人姓名不能为空");
                              return false;
                           }
                           // 检测跟单人提成比例是否为空
                           if (followerRatio === "") {
                              alert("跟单人提成比例不能为空");
                              return false;
                           }
                           followerNames.push(followerName);
                           followerRatios.push(parseFloat(followerRatio));
                        }
                        // 将开单人提成比例转换为浮点数
                        openerRatio = parseFloat(openerRatio);
                        // 检测逻辑 1: 开单人与跟单人比例加起不能超过 100
                        var totalRatio = openerRatio;
                        for (var j = 0; j < followerRatios.length; j++) {
                           totalRatio += followerRatios[j];
                        }
                        if (totalRatio > 100) {
                           alert("开单人与跟单人提成比例总和不能超过 100%");
                           return false;
                        }
                        // 检测逻辑 2: 开单人与跟单人不要出现重复
                        if (followerNames.includes(openerName)) {
                           alert("开单人与跟单人不能重复");
                           return false;
                        }
                        // 检测逻辑 3: 多个跟单人之间也不要出现重复
                        var uniqueFollowerNames = [];
                        for (var k = 0; k < followerNames.length; k++) {
                           if (uniqueFollowerNames.includes(followerNames[k])) {
                              alert("跟单人之间不能重复");
                              return false;
                           }
                           uniqueFollowerNames.push(followerNames[k]);
                        }
                        return true;
                     }
                     function addFollower() {
                        var followersList = document.getElementById('FollowersList');
                        var newFollower = document.createElement('div');
                        newFollower.className = 'follower-item';
                        var followerCount = followersList.children.length + 1;
                        newFollower.innerHTML = `
                           <input id="Entourage_<%=EntourageID_Follower%>_${followerCount}" name="FollowerID_${followerCount}" type="hidden" value="">
                           <input type="text" id="EntourageName_<%=EntourageID_Follower%>_${followerCount}" name="FollowerName_${followerCount}" class="small" onclick="javascript:JS_EntourageOpen('<%=EntourageID_Follower%>_${followerCount}','-<%=departmentID_Follower%>');" style="width:138px;" value="" readonly="true">
                           <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">提成比例(%):</label></div>
                           <div class="input" style="float:left;margin-left: 87px;">
                              <input type="text" id="FollowerRatio_${followerCount}" name="FollowerRatio_${followerCount}" class="small" style="width:50px;">
                           </div>
                           <div class="input" style="float:left;margin-left: 10px;">
                              <button onclick="return removeFollower();">删除</button>
                           </div>
                        `;
                        followersList.appendChild(newFollower);
                        addFollowerCount(1);
                        return false;
                     }
                     function removeFollower(index){
                        var followersList = document.getElementById('FollowersList');
                        var followerItems = followersList.getElementsByClassName('follower-item');
                        // 如果传入了 index 参数,删除指定索引的元素;否则删除最后一个元素
                        var elementToRemove = index !== undefined ? followerItems[index] : followersList.lastElementChild;
                        if (elementToRemove) {
                           elementToRemove.remove();
                        }
                        followersList = document.getElementById('FollowersList');
                        let len=followersList.children.length;
                        // 更新剩余元素的 name 属性和索引
                        var newFollowerCount = 1;
                        for (var i = 0; i < len; i++) {
                           var item = followerItems[i];
                           var followerIdInput = item.querySelector('input[name^="FollowerID_"]');
                           var followerNameInput = item.querySelector('input[name^="FollowerName_"]');
                           var followerRatioInput = item.querySelector('input[name^="FollowerRatio_"]');
                           if (followerIdInput) {
                              followerIdInput.name = `FollowerID_${newFollowerCount}`;
                              followerIdInput.id = `FollowerId_${newFollowerCount}`;
                           }
                           if (followerNameInput) {
                              followerNameInput.name = `FollowerName_${newFollowerCount}`;
                              followerNameInput.id = `FollowerName_${newFollowerCount}`;
                           }
                           if (followerRatioInput) {
                              followerRatioInput.name = `FollowerRatio_${newFollowerCount}`;
                              followerRatioInput.id = `FollowerRatio_${newFollowerCount}`;
                           }
                           newFollowerCount++;
                        }
                        if(followersList.children.length==0){
                           document.getElementById("followerDiv").style.display="none";
                           document.getElementById("inputTopAddFollower").style.display="";
                        }
                        addFollowerCount(-1);
                        return false;
                     }
                     function addFollowerCount(val){
                        var hid=document.getElementById("hidFollowerCount");
                        var oldv=hid.value;
                        hid.value=parseInt(oldv)+val;
                     }
                     </script>
                     <%If isDepartment("070127")=1 Then%>
                     <div class="field">
                              <%'主要企微客服
@@ -1483,22 +1766,30 @@
               <script LANGUAGE="javascript">
                  //生成咨询单(新增)
                  function form1_submit19_1(){
                  document.form1.action = "admin_save.gds";
                  document.form1.admin_save.value = "19";
                  document.form1.NEWOrder.value = "";
                  document.form1.ServiceOrdState.value = "1";
                  document.getElementById("zhezhao").style.display="block";
                  document.getElementById("login").style.display="block";
                  form1.submit();
                     let checkResult=checkOpenerAndFollower();
                     if(!checkResult){
                        return;
                     }
                     document.form1.action = "admin_save.gds";
                     document.form1.admin_save.value = "19";
                     document.form1.NEWOrder.value = "";
                     document.form1.ServiceOrdState.value = "1";
                     document.getElementById("zhezhao").style.display="block";
                     document.getElementById("login").style.display="block";
                     form1.submit();
                  }
                  //生成服务单(新增)
                  function form1_submit19_2(){
                  document.form1.action = "admin_save.gds";
                  document.form1.admin_save.value = "19";
                  document.form1.ServiceOrdState.value = "2";
                  document.getElementById("zhezhao").style.display="block";
                  document.getElementById("login").style.display="block";
                  form1.submit();
                     let checkResult=checkOpenerAndFollower();
                     if(!checkResult){
                        return;
                     }
                     document.form1.action = "admin_save.gds";
                     document.form1.admin_save.value = "19";
                     document.form1.ServiceOrdState.value = "2";
                     document.getElementById("zhezhao").style.display="block";
                     document.getElementById("login").style.display="block";
                     form1.submit();
                  }
                  //生成无效电话(新增)
                  function form1_submit19_4(){
@@ -1527,6 +1818,10 @@
                  }
                  //生成/保存服务单(修改)
                  function form1_submit20_2(){
                     let checkResult=checkOpenerAndFollower();
                     if(!checkResult){
                        return;
                     }
                     document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                     document.form1.action = "admin_save.gds";
                     document.form1.admin_save.value = "20";