|
|
@@ -0,0 +1,795 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+ <!-- 2026-09-24 升旗礼检查小程序专用页面。样式与 mp_ssnwjc_inp.html 保持一致。 -->
|
|
|
+ <meta charset="UTF-8"/>
|
|
|
+ <meta name="viewport"
|
|
|
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
|
|
|
+ <title>升旗礼检查</title>
|
|
|
+ <script src="/js/mp_base/base.js"></script>
|
|
|
+ <style>
|
|
|
+ [v-cloak] {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ :root {
|
|
|
+ --line: #e5e7eb;
|
|
|
+ --text: #222222;
|
|
|
+ --muted: #8b95a5;
|
|
|
+ --soft: #f7f8fa;
|
|
|
+ --green: #19a463;
|
|
|
+ --green-soft: #eaf8f1;
|
|
|
+ --danger: #e5484d;
|
|
|
+ --danger-soft: #fff0f0;
|
|
|
+ }
|
|
|
+
|
|
|
+ * {
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+
|
|
|
+ body {
|
|
|
+ margin: 0;
|
|
|
+ color: var(--text);
|
|
|
+ background: #f3f4f6;
|
|
|
+ font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
|
|
|
+ "Microsoft YaHei", sans-serif;
|
|
|
+ }
|
|
|
+
|
|
|
+ #app {
|
|
|
+ min-height: 100vh;
|
|
|
+ padding-bottom: 86px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .loading-container {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ min-height: 65vh;
|
|
|
+ color: var(--muted);
|
|
|
+ }
|
|
|
+
|
|
|
+ .loading-spinner {
|
|
|
+ width: 38px;
|
|
|
+ height: 38px;
|
|
|
+ margin-bottom: 12px;
|
|
|
+ border: 4px solid #e6e8ec;
|
|
|
+ border-top-color: var(--green);
|
|
|
+ border-radius: 50%;
|
|
|
+ animation: spin 0.9s linear infinite;
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes spin {
|
|
|
+ to {
|
|
|
+ transform: rotate(360deg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .error-box {
|
|
|
+ margin: 18px 14px;
|
|
|
+ padding: 18px;
|
|
|
+ color: var(--danger);
|
|
|
+ background: var(--danger-soft);
|
|
|
+ border: 1px solid #ffd0d0;
|
|
|
+ border-radius: 6px;
|
|
|
+ line-height: 1.6;
|
|
|
+ }
|
|
|
+
|
|
|
+ .page-content {
|
|
|
+ padding: 12px 14px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-table,
|
|
|
+ .score-table {
|
|
|
+ overflow: hidden;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid var(--line);
|
|
|
+ border-radius: 6px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-row {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: 92px 1fr;
|
|
|
+ min-height: 58px;
|
|
|
+ border-bottom: 1px solid var(--line);
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-row:last-child {
|
|
|
+ border-bottom: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-label {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ padding: 12px 14px;
|
|
|
+ color: var(--muted);
|
|
|
+ background: #fbfbfc;
|
|
|
+ border-right: 1px solid var(--line);
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-value {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ min-width: 0;
|
|
|
+ padding: 11px 12px;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-cell {
|
|
|
+ width: 100%;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-cell > .ss-select-container {
|
|
|
+ width: 100%;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .clickable {
|
|
|
+ justify-content: space-between;
|
|
|
+ gap: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .clickable-text {
|
|
|
+ min-width: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ .chevron {
|
|
|
+ flex: 0 0 auto;
|
|
|
+ color: #9aa3b2;
|
|
|
+ font-size: 25px;
|
|
|
+ line-height: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-value {
|
|
|
+ color: var(--green);
|
|
|
+ font-weight: 700;
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .veto-value {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ gap: 12px;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .native-input {
|
|
|
+ width: 100%;
|
|
|
+ height: 38px;
|
|
|
+ padding: 0 10px;
|
|
|
+ color: var(--text);
|
|
|
+ background: #fff;
|
|
|
+ border: 0;
|
|
|
+ outline: none;
|
|
|
+ font: inherit;
|
|
|
+ }
|
|
|
+
|
|
|
+ .native-input::placeholder {
|
|
|
+ color: #b4bbc6;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-table {
|
|
|
+ margin-top: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-row {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: minmax(0, 1fr) 48px 132px;
|
|
|
+ min-height: 68px;
|
|
|
+ overflow: visible;
|
|
|
+ border-bottom: 1px solid var(--line);
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-row:last-child {
|
|
|
+ border-bottom: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-name {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 10px 12px;
|
|
|
+ line-height: 1.45;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-max {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ color: var(--muted);
|
|
|
+ border-left: 1px solid var(--line);
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stepper {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: 48px minmax(0, 1fr) 40px;
|
|
|
+ align-items: center;
|
|
|
+ width: auto;
|
|
|
+ min-width: 0;
|
|
|
+ margin: 10px 7px;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid #cfd4dc;
|
|
|
+ border-radius: 5px;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stepper-btn {
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ gap: 1px;
|
|
|
+ height: 44px;
|
|
|
+ padding: 0;
|
|
|
+ color: #596273;
|
|
|
+ background: #f3f4f6;
|
|
|
+ border: 0;
|
|
|
+ font-size: 24px;
|
|
|
+ line-height: 1;
|
|
|
+ appearance: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stepper-btn:disabled {
|
|
|
+ color: #c8cdd5;
|
|
|
+ background: #eceff2;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stepper-deduct-num {
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stepper-btn-symbol {
|
|
|
+ line-height: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stepper-value {
|
|
|
+ width: 100%;
|
|
|
+ min-width: 0;
|
|
|
+ height: 44px;
|
|
|
+ padding: 0 4px;
|
|
|
+ text-align: center;
|
|
|
+ background: #fff;
|
|
|
+ border: 0;
|
|
|
+ border-left: 1px solid #e1e4e9;
|
|
|
+ border-right: 1px solid #e1e4e9;
|
|
|
+ outline: none;
|
|
|
+ font: inherit;
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-total {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 14px 4px 0;
|
|
|
+ color: var(--muted);
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .score-total strong {
|
|
|
+ color: var(--green);
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .empty-tip {
|
|
|
+ padding: 16px 12px;
|
|
|
+ color: var(--muted);
|
|
|
+ text-align: center;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet {
|
|
|
+ max-height: 72vh;
|
|
|
+ padding: 18px 16px 24px;
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-mask {
|
|
|
+ position: fixed;
|
|
|
+ z-index: 9999;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-end;
|
|
|
+ background: rgba(0, 0, 0, 0.35);
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-mask .sheet {
|
|
|
+ width: 100%;
|
|
|
+ border-radius: 8px 8px 0 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-title {
|
|
|
+ margin: 0 0 14px;
|
|
|
+ font-size: 17px;
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-list {
|
|
|
+ overflow-y: auto;
|
|
|
+ max-height: 58vh;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-item {
|
|
|
+ padding: 13px 0;
|
|
|
+ border-bottom: 1px solid #eef0f3;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-item:last-child {
|
|
|
+ border-bottom: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-main {
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sheet-sub {
|
|
|
+ margin-top: 4px;
|
|
|
+ color: var(--muted);
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .class-option {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .class-option.selected {
|
|
|
+ color: var(--green);
|
|
|
+ }
|
|
|
+
|
|
|
+ .warning-bar {
|
|
|
+ margin: 12px 14px 0;
|
|
|
+ padding: 11px 12px;
|
|
|
+ color: #9a6700;
|
|
|
+ background: #fff8e6;
|
|
|
+ border: 1px solid #ffe8a3;
|
|
|
+ border-radius: 6px;
|
|
|
+ line-height: 1.5;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .submit-hint {
|
|
|
+ margin: 12px 14px 0;
|
|
|
+ padding: 11px 12px;
|
|
|
+ color: var(--danger);
|
|
|
+ background: var(--danger-soft);
|
|
|
+ border: 1px solid #ffd0d0;
|
|
|
+ border-radius: 6px;
|
|
|
+ line-height: 1.5;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bottom-spacer {
|
|
|
+ height: 16px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div id="app" v-cloak>
|
|
|
+ <div v-if="loading" class="loading-container">
|
|
|
+ <div class="loading-spinner"></div>
|
|
|
+ <div>加载中...</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-else-if="errorMsg" class="error-box">
|
|
|
+ {{ errorMsg }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template v-else>
|
|
|
+ <div v-if="warnMsg" class="warning-bar">{{ warnMsg }}</div>
|
|
|
+ <div v-if="submitHint" class="submit-hint">{{ submitHint }}</div>
|
|
|
+
|
|
|
+ <div class="page-content">
|
|
|
+ <div class="info-table">
|
|
|
+ <div class="info-row">
|
|
|
+ <div class="info-label">部门</div>
|
|
|
+ <div class="info-value">{{ bmmc || '—' }}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-row">
|
|
|
+ <div class="info-label">检查人</div>
|
|
|
+ <div class="info-value">{{ jcryxm || '—' }}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-row">
|
|
|
+ <div class="info-label">检查时间</div>
|
|
|
+ <div class="info-value">{{ todayText }}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-row">
|
|
|
+ <div class="info-label">入学年度</div>
|
|
|
+ <div class="info-value">
|
|
|
+ <div class="select-cell">
|
|
|
+ <ss-select
|
|
|
+ v-model="form.rxnd"
|
|
|
+ cb="rxnd"
|
|
|
+ placeholder="入学年度"
|
|
|
+ @change="onRxndChange"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-row">
|
|
|
+ <div class="info-label">班级</div>
|
|
|
+ <div class="info-value">
|
|
|
+ <div class="select-cell">
|
|
|
+ <ss-select
|
|
|
+ :key="'bj-' + form.rxnd"
|
|
|
+ v-model="form.bjid"
|
|
|
+ :cb="form.rxnd ? 'bjByRxnd' : ''"
|
|
|
+ :url="bjUrl"
|
|
|
+ :filter="{cascadingLevel: 'rxnd,bjid'}"
|
|
|
+ :disabled="!form.rxnd"
|
|
|
+ :placeholder="form.rxnd ? '班级' : '请先选择入学年度'"
|
|
|
+ @change="onBjChange"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-row">
|
|
|
+ <div class="info-label">说明</div>
|
|
|
+ <div class="info-value">
|
|
|
+ <input
|
|
|
+ v-model="form.ms"
|
|
|
+ class="native-input"
|
|
|
+ maxlength="500"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="score-table">
|
|
|
+ <div v-if="!jcxmList.length" class="empty-tip">暂无检查项目</div>
|
|
|
+ <div v-for="item in jcxmList" :key="item.sqljcxmm" class="score-row">
|
|
|
+ <div class="score-name">{{ item.mc }}</div>
|
|
|
+ <div class="score-max">{{ isScoreItem(item) ? item.mfz : '人' }}</div>
|
|
|
+ <div class="stepper">
|
|
|
+ <button
|
|
|
+ class="stepper-btn"
|
|
|
+ type="button"
|
|
|
+ :disabled="Number(item.value) <= 0"
|
|
|
+ @click="changeStep(item, -1)"
|
|
|
+ >
|
|
|
+ <span class="stepper-btn-symbol">-</span><span
|
|
|
+ v-if="deductedFs(item) > 0"
|
|
|
+ class="stepper-deduct-num">{{ deductedFs(item) }}</span>
|
|
|
+ </button>
|
|
|
+ <input
|
|
|
+ class="stepper-value"
|
|
|
+ inputmode="numeric"
|
|
|
+ :value="item.value"
|
|
|
+ :min="0"
|
|
|
+ :max="isScoreItem(item) ? item.mfz : null"
|
|
|
+ @input="onStepInput(item, $event)"
|
|
|
+ @blur="normalizeStep(item, $event)"
|
|
|
+ />
|
|
|
+ <button
|
|
|
+ class="stepper-btn"
|
|
|
+ type="button"
|
|
|
+ :disabled="isScoreItem(item) && Number(item.value) >= Number(item.mfz)"
|
|
|
+ @click="changeStep(item, 1)"
|
|
|
+ >
|
|
|
+ +
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="score-total">
|
|
|
+ <span>总分数(打分项合计)</span>
|
|
|
+ <strong>{{ totalFs }}<span v-if="maxFs"> / {{ maxFs }}</span></strong>
|
|
|
+ </div>
|
|
|
+ <div class="bottom-spacer"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <ss-bottom
|
|
|
+ :show-shyj="false"
|
|
|
+ :buttons="submitting ? [{ text: '提交中...', action: 'submit' }] : bottomButtons"
|
|
|
+ @button-click="handleBottomAction"
|
|
|
+ :disabled="submitting"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script>
|
|
|
+ window.SS.ready(function () {
|
|
|
+ window.SS.dom.initializeFormApp({
|
|
|
+ el: "#app",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: true,
|
|
|
+ submitting: false,
|
|
|
+ errorMsg: "",
|
|
|
+ warnMsg: "",
|
|
|
+ submitHint: "",
|
|
|
+ recordsToday: 0,
|
|
|
+ bmmc: "",
|
|
|
+ jcryxm: "",
|
|
|
+ todayText: "",
|
|
|
+ jcxmList: [],
|
|
|
+ form: {
|
|
|
+ rxnd: "",
|
|
|
+ bjid: "",
|
|
|
+ ms: ""
|
|
|
+ },
|
|
|
+ bottomButtons: [
|
|
|
+ { text: "取消", action: "cancel" },
|
|
|
+ { text: "保存并提交", action: "submit" }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ /**
|
|
|
+ * 2026-09-29 修复「选完入学年度班级不出来」。
|
|
|
+ *
|
|
|
+ * 原因:码本 bjByRxnd 的 SQL 是
|
|
|
+ * select BJID,MC from BJ where BJZTM!=81 and trunc(RXND,'YYYY')=trunc(:rxnd,'YYYY')
|
|
|
+ * <parm name="rxnd" type="date"/>
|
|
|
+ * 而平台 loadObjpOpt 在【非级联】方式下会把 objectpickerparam 里的筛选值按字符串
|
|
|
+ * 绑到 SQL 参数上(ss.objp.ObjpServ.loadOptByA → ss.db.Db.doSelMapByC),
|
|
|
+ * 字符串绑到 DATE 参数上 → Oracle 报
|
|
|
+ * ORA-00932: expression (TRUNC(TO_NUMBER(:1),TO_NUMBER('YYYY'))) is of type NUMBER,
|
|
|
+ * incompatible with expected type DATE
|
|
|
+ * → 码本查询失败 → loadObjpOpt 返回「*** 页面执行时错误 ***」→ 班级下拉为空。
|
|
|
+ * 入学年度能用,是因为它的码本 rxnd 是"服务型码本"(DwServ.rxnd),不走 SQL 参数绑定。
|
|
|
+ *
|
|
|
+ * 解法:改用平台的【级联】方式取班级 —— 带上 cascadingLevel,
|
|
|
+ * 并把上级值通过 URL 的 upperValue 传给后端(PC 的 入学年度>班级 就是这么走的,
|
|
|
+ * 后端在级联分支里会按参数声明的类型正确绑定日期)。只改前端,不动平台与码本。
|
|
|
+ */
|
|
|
+ bjUrl() {
|
|
|
+ const base = "/service?ssServ=loadObjpOpt&objectpickerdropdown1=1";
|
|
|
+ const y = String(this.form.rxnd || "").trim();
|
|
|
+ return y ? base + "&upperValue=" + encodeURIComponent(y) : base;
|
|
|
+ },
|
|
|
+ totalFs() {
|
|
|
+ return this.jcxmList.reduce(
|
|
|
+ (sum, item) => sum + (this.isScoreItem(item) ? Number(item.value || 0) : 0), 0);
|
|
|
+ },
|
|
|
+ maxFs() {
|
|
|
+ return this.jcxmList.reduce(
|
|
|
+ (sum, item) => sum + (this.isScoreItem(item) ? Number(item.mfz || 0) : 0), 0);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ this.todayText = this.formatNow();
|
|
|
+ try {
|
|
|
+ const sessionOk = await this.ensureSession();
|
|
|
+ if (!sessionOk)
|
|
|
+ return;
|
|
|
+ await this.loadInit();
|
|
|
+ } catch (error) {
|
|
|
+ console.error("[mp_sqljc_inp] 初始化失败", error);
|
|
|
+ this.errorMsg = error && error.message ? error.message : "页面初始化失败";
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getUrlParams() {
|
|
|
+ const params = {};
|
|
|
+ const search = new URLSearchParams(window.location.search);
|
|
|
+ for (const [key, value] of search) {
|
|
|
+ params[key] = decodeURIComponent(value);
|
|
|
+ }
|
|
|
+ return params;
|
|
|
+ },
|
|
|
+
|
|
|
+ getRequest() {
|
|
|
+ return (window && window.request) || request;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 小程序切换账号后,旧 H5 会话会写到别人名下,必须先刷新会话。Lin
|
|
|
+ async ensureSession() {
|
|
|
+ if (typeof window.ensureMiniProgramSessionFresh !== "function")
|
|
|
+ return true;
|
|
|
+ try {
|
|
|
+ await window.ensureMiniProgramSessionFresh({
|
|
|
+ page: "mp_sqljc_inp",
|
|
|
+ service: "sqljc_mpInit",
|
|
|
+ force: true
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ } catch (error) {
|
|
|
+ this.errorMsg = "登录状态刷新失败,请返回小程序重新进入";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async loadInit() {
|
|
|
+ const data = await this.postService(
|
|
|
+ "/service?ssServ=sqljc_mpInit&ssDest=data", {});
|
|
|
+ this.bmmc = (data && data.bmmc) || "";
|
|
|
+ this.jcryxm = (data && data.jcryxm) || "";
|
|
|
+ this.jcxmList = ((data && data.jcxmList) || []).map((item) => {
|
|
|
+ const mfz = item.mfz === null || item.mfz === undefined || item.mfz === ""
|
|
|
+ ? null : Number(item.mfz);
|
|
|
+ return {
|
|
|
+ sqljcxmm: Number(item.sqljcxmm),
|
|
|
+ mc: item.mc,
|
|
|
+ mfz: mfz,
|
|
|
+ value: mfz === null ? 0 : mfz
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ isScoreItem(item) {
|
|
|
+ return item.mfz !== null && item.mfz !== undefined;
|
|
|
+ },
|
|
|
+
|
|
|
+ async postService(url, data) {
|
|
|
+ const req = this.getRequest();
|
|
|
+ if (!req || typeof req.post !== "function")
|
|
|
+ throw new Error("请求组件未加载");
|
|
|
+ const response = await req.post(url, data, {
|
|
|
+ loading: false,
|
|
|
+ formData: true
|
|
|
+ });
|
|
|
+ const raw = response && response.data !== undefined ? response.data : response;
|
|
|
+ if (raw && raw.ssCode !== undefined && Number(raw.ssCode) !== 0)
|
|
|
+ throw new Error(raw.ssMsg || "请求失败");
|
|
|
+ return raw && raw.ssData !== undefined ? raw.ssData : raw;
|
|
|
+ },
|
|
|
+
|
|
|
+ onRxndChange(value) {
|
|
|
+ this.form.rxnd = value || "";
|
|
|
+ this.form.bjid = ""; // 换入学年度后清空班级,避免串档。Lin
|
|
|
+ },
|
|
|
+
|
|
|
+ onBjChange(value) {
|
|
|
+ this.form.bjid = value || "";
|
|
|
+ },
|
|
|
+
|
|
|
+ // 打分项显示累计扣分;人数项没有满分,不显示扣分。Lin
|
|
|
+ deductedFs(item) {
|
|
|
+ if (!this.isScoreItem(item))
|
|
|
+ return 0;
|
|
|
+ const mfz = Number(item.mfz || 0);
|
|
|
+ return Math.max(0, mfz - Number(item.value || 0));
|
|
|
+ },
|
|
|
+
|
|
|
+ // 所有数字项左右都可加减:打分项限 0..MFZ,人数项只限 >= 0。Lin
|
|
|
+ changeStep(item, step) {
|
|
|
+ let value = Number(item.value || 0) + step;
|
|
|
+ if (value < 0)
|
|
|
+ value = 0;
|
|
|
+ if (this.isScoreItem(item) && value > Number(item.mfz || 0))
|
|
|
+ value = Number(item.mfz || 0);
|
|
|
+ item.value = value;
|
|
|
+ },
|
|
|
+
|
|
|
+ onStepInput(item, event) {
|
|
|
+ const raw = String(event.target.value || "").replace(/[^0-9]/g, "");
|
|
|
+ item.value = raw === "" ? "" : Number(raw);
|
|
|
+ },
|
|
|
+
|
|
|
+ normalizeStep(item, event) {
|
|
|
+ let value = Number(String(event.target.value || "").replace(/[^0-9]/g, ""));
|
|
|
+ if (!Number.isFinite(value) || value < 0)
|
|
|
+ value = 0;
|
|
|
+ if (this.isScoreItem(item) && value > Number(item.mfz || 0))
|
|
|
+ value = Number(item.mfz || 0);
|
|
|
+ item.value = value;
|
|
|
+ },
|
|
|
+
|
|
|
+ validateForm() {
|
|
|
+ if (!this.form.rxnd)
|
|
|
+ return "请选择入学年度";
|
|
|
+ if (!this.form.bjid)
|
|
|
+ return "请选择班级";
|
|
|
+ if (!this.jcxmList.length)
|
|
|
+ return "检查项目未配置";
|
|
|
+ for (const item of this.jcxmList) {
|
|
|
+ const value = Number(item.value || 0);
|
|
|
+ if (value < 0)
|
|
|
+ return item.mc + " 不能为负数";
|
|
|
+ if (this.isScoreItem(item) && value > Number(item.mfz || 0))
|
|
|
+ return item.mc + " 分值超出满分";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ },
|
|
|
+
|
|
|
+ async submit() {
|
|
|
+ if (this.submitting)
|
|
|
+ return;
|
|
|
+ const message = this.validateForm();
|
|
|
+ if (message) {
|
|
|
+ this.submitHint = message;
|
|
|
+ this.warnMsg = "";
|
|
|
+ this.showToast(message, "fail");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ this.submitting = true;
|
|
|
+ this.warnMsg = "";
|
|
|
+ this.submitHint = "";
|
|
|
+ const payload = {
|
|
|
+ bjid: this.form.bjid,
|
|
|
+ ms: this.form.ms
|
|
|
+ };
|
|
|
+ this.jcxmList.forEach((item) => {
|
|
|
+ payload["sqljcxmm" + item.sqljcxmm] =
|
|
|
+ item.value === "" ? 0 : Number(item.value);
|
|
|
+ });
|
|
|
+ const result = await this.postService(
|
|
|
+ "/service?ssServ=sqljc_mpSubm&ssDest=data", payload);
|
|
|
+ this.recordsToday = (result && result.recordsToday) || this.recordsToday + 1;
|
|
|
+ this.resetAfterSubmit();
|
|
|
+ this.warnMsg = "已提交,可继续录入下一个班级(今天已录入 "
|
|
|
+ + this.recordsToday + " 条)";
|
|
|
+ this.showToast("提交成功", "success");
|
|
|
+ } catch (error) {
|
|
|
+ console.error("[mp_sqljc_inp] 提交失败", error);
|
|
|
+ this.submitHint = error && error.message ? error.message : "提交失败";
|
|
|
+ this.showToast(this.submitHint, "fail");
|
|
|
+ } finally {
|
|
|
+ this.submitting = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 连续录入:保留入学年度,清空班级与说明,评分恢复默认(打分项满分、人数 0)。Lin
|
|
|
+ resetAfterSubmit() {
|
|
|
+ this.form.bjid = "";
|
|
|
+ this.form.ms = "";
|
|
|
+ this.jcxmList.forEach((item) => {
|
|
|
+ item.value = this.isScoreItem(item) ? Number(item.mfz) : 0;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleBottomAction(data) {
|
|
|
+ if (data && data.action === "cancel")
|
|
|
+ this.goBack();
|
|
|
+ else if (data && data.action === "submit")
|
|
|
+ this.submit();
|
|
|
+ },
|
|
|
+
|
|
|
+ goBack() {
|
|
|
+ if (window.wx && window.wx.miniProgram) {
|
|
|
+ window.wx.miniProgram.navigateBack({ delta: 1 });
|
|
|
+ } else if (window.history.length > 1) {
|
|
|
+ window.history.back();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ formatNow() {
|
|
|
+ const now = new Date();
|
|
|
+ const pad = (v) => String(v).padStart(2, "0");
|
|
|
+ return now.getFullYear() + "-" + pad(now.getMonth() + 1) + "-" + pad(now.getDate())
|
|
|
+ + " " + pad(now.getHours()) + ":" + pad(now.getMinutes());
|
|
|
+ },
|
|
|
+
|
|
|
+ showToast(message, type) {
|
|
|
+ const toastType = type === "success" ? "success" : "error";
|
|
|
+ if (window.wx && window.wx.miniProgram && window.wx.miniProgram.showToast) {
|
|
|
+ window.wx.miniProgram.showToast({ title: message, icon: toastType });
|
|
|
+ } else if (window.SS && window.SS.dom && typeof window.SS.dom.showToast === "function") {
|
|
|
+ window.SS.dom.showToast({ message: message, type: toastType });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|