sqljc_addInp.ss.jsp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <%-- 2026-09-23 升旗礼检查 PC 专用录入页。参照 宿舍内务检查 ssnwjc_excelAdd.ss.jsp。Lin --%>
  2. <html>
  3. <head>
  4. </head>
  5. <body class="env-input-body">
  6. <form id="app" action="<serv.ss name='sqljc_addInpSubm' dest='info'/>" method="post" class="form-container">
  7. <div class="content-box fit-height-content">
  8. <div class="content-div" ssFith="true">
  9. <table class='form'>
  10. <tr>
  11. <th>部门</th>
  12. <td>
  13. <objp.ss name="bmid" cb="sqljcBm" placeholder="请选择部门"
  14. width="200px" chg="loadJcxmList"/>
  15. </td>
  16. </tr>
  17. <tr>
  18. <th>检查人</th>
  19. <td style="font-family: inherit;padding-left: 15px;">${sessionScope.ssUser.xm}</td>
  20. <th>检查时间</th>
  21. <td style="font-family: inherit;padding-left: 15px;">提交时自动记录</td>
  22. </tr>
  23. <tr>
  24. <th>总分数</th>
  25. <td id="zfsStr" style="font-family: inherit;padding-left: 15px;">0</td>
  26. <th>出勤率(%)</th>
  27. <td><input name="cql" width="80px" readonly="true"/></td>
  28. </tr>
  29. <tr>
  30. <th>考勤分数</th>
  31. <td><input name="kqfs" width="80px" readonly="true"/></td>
  32. <th>队列分数</th>
  33. <td><input name="dlfs" width="80px" readonly="true"/></td>
  34. </tr>
  35. <tr>
  36. <th>风貌分数</th>
  37. <td><input name="fmfs" width="80px" readonly="true"/></td>
  38. <th>纪律分数</th>
  39. <td><input name="jlfs" width="80px" readonly="true"/></td>
  40. </tr>
  41. <tr>
  42. <th>说明</th>
  43. <td colspan="3">
  44. <input name="ms" ssBtn="{desc:'附件',name:'fjid',val:'${sqljc.fjid}'}" ssRow="2"/>
  45. </td>
  46. </tr>
  47. </table>
  48. <%-- 检查项目:有满分的为打分项(默认满分,-/+ 调整),无满分的为人数(按实填写)。Lin --%>
  49. <div style="padding: 8px 0 0 15px;color: #8b95a5;">
  50. 检查项目:带括号的为满分,默认给满分,可用 - / + 调整;不带括号的为人数字段,按实际填写。
  51. </div>
  52. <div>
  53. <template v-for="(item, i) in resList"
  54. :key="item.sqljcxmm + '-' + item.loadKey">
  55. <ss-nump
  56. :name="'sqljcxmm' + item.sqljcxmm"
  57. :desc="item.mc"
  58. :def-val="item.defaultValue == null ? 0 : item.defaultValue"
  59. :max-val="item.mfz == null ? null : item.mfz"
  60. :min-val="0"
  61. onChange="refreshTotals"
  62. :tab-index="i"></ss-nump>
  63. </template>
  64. </div>
  65. </div>
  66. </div>
  67. <div class='bottom-div'>
  68. <ss-btn type="submit" text="保存" icon-class="bottom-div-save"></ss-btn>
  69. <ss-btn type="button" text="关闭" icon-class="bottom-div-close"
  70. onclick="wd.display.closeDialog()"></ss-btn>
  71. </div>
  72. </form>
  73. </body>
  74. </html>
  75. <script>
  76. let vm; // Vue 实例代理。Lin
  77. let jcxmList = []; // 检查项目:有 mfz 的按打分项参与总分汇总。Lin
  78. // 按正式公式计算,人数项只参与有效应到人数。Lin
  79. function refreshTotals() {
  80. const val = code => {
  81. const input = document.getElementsByName('sqljcxmm' + code)[0];
  82. return input ? Number(input.value || 0) : 0;
  83. };
  84. const round2 = value => Math.round((Number(value) + Number.EPSILON) * 100) / 100;
  85. const formatNumber = value => {
  86. const number = round2(value);
  87. return Number.isInteger(number) ? String(number) : number.toFixed(2);
  88. };
  89. const total = val(1);
  90. const queue = val(2);
  91. const exempt = val(3) + val(4) + val(5) + val(6) + val(7) + val(8);
  92. const expected = total - exempt;
  93. const cql = expected > 0
  94. ? round2(Math.min(100, Math.max(0, queue * 100 / expected)))
  95. : 0;
  96. const dlfs = val(11);
  97. const fmfs = val(21) + val(22) + val(23);
  98. const jlfs = val(31);
  99. const zfs = round2(cql * 0.25 + dlfs * 0.2
  100. + fmfs * 0.4 + jlfs * 0.15);
  101. document.getElementById('zfsStr').innerHTML = isFinite(zfs) ? formatNumber(zfs) : 0;
  102. const setReadonlyValue = (name, value) => {
  103. const input = document.getElementsByName(name)[0];
  104. if (!input)
  105. return;
  106. input.value = isFinite(value) ? formatNumber(value) : 0;
  107. input.readOnly = true;
  108. };
  109. setReadonlyValue('cql', cql);
  110. setReadonlyValue('kqfs', cql);
  111. setReadonlyValue('dlfs', dlfs);
  112. setReadonlyValue('fmfs', fmfs);
  113. setReadonlyValue('jlfs', jlfs);
  114. }
  115. function loadJcxmList(bmid) {
  116. if (!vm)
  117. return Promise.resolve(null);
  118. if (bmid == null)
  119. bmid = selectedBmid();
  120. bmid = bmid == null ? "" : String(bmid);
  121. return callSsService("sqljc_addInpInit", bmid ? {bmid} : {})
  122. .then((res) => {
  123. if (!res || res.ssCode != 0) {
  124. alert(res && res.ssMsg ? res.ssMsg : "检查项目加载失败");
  125. return res;
  126. }
  127. const data = res.ssData;
  128. jcxmList = (data.jcxmList || []).map(function(item) {
  129. return {
  130. ...item,
  131. loadKey: data.bmid == null ? "none" : String(data.bmid)
  132. };
  133. });
  134. vm.resList = jcxmList;
  135. refreshTotals();
  136. return res;
  137. });
  138. }
  139. function selectedBmid() {
  140. const input = document.querySelector("input[name='bmid']");
  141. return input ? input.value : "";
  142. }
  143. // 抄自 objList.jsp。通用:调用后端 service(统一返回原生 Promise)。Lin
  144. function callSsService(ssServ, extraParams = {}) {
  145. if (!ssServ) return
  146. Promise.resolve(null);
  147. return new Promise((resolve) => {
  148. $.ajax({
  149. type: "get",
  150. url: "/service",
  151. data: {ssServ, ...extraParams},
  152. dataType: "text",
  153. })
  154. .done((text) => {
  155. if (typeof text !== "string") return resolve(text);
  156. const t = text.trim();
  157. if (!t) return resolve(null);
  158. try {
  159. return resolve(JSON.parse(t));
  160. } catch (_) {
  161. return resolve(text);
  162. }
  163. })
  164. .fail((xhr, status, err) => {
  165. console.error("callSsService failed", ssServ, status, err);
  166. resolve(null);
  167. });
  168. });
  169. }
  170. window.onload = function () {
  171. vm = document.getElementById("app").__vue_app__._instance.proxy;
  172. loadJcxmList();
  173. }
  174. document.getElementById("app").addEventListener("submit", function(event) {
  175. if (!selectedBmid()) {
  176. event.preventDefault();
  177. alert("请选择部门");
  178. }
  179. });
  180. </script>