| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836 |
- <!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?v=20261117-select-font-v4"></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) 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 }}<span v-if="isScoreItem(item)"> ({{ item.mfz }})</span>
- </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,
- fromList: 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();
- // 从列表页「新增」进来时带 ?from=list:提交后直接回列表。Lin
- try {
- const params = new URLSearchParams(window.location.search);
- this.fromList = String(params.get("from") || "") === "list";
- } catch (_) {
- this.fromList = false;
- }
- 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,
- defaultValue: item.defaultValue === null
- || item.defaultValue === undefined
- ? (mfz === null ? 0 : mfz)
- : Number(item.defaultValue),
- value: item.defaultValue === null
- || item.defaultValue === undefined
- ? (mfz === null ? 0 : mfz)
- : Number(item.defaultValue)
- };
- });
- },
- 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.markListRefresh();
- if (this.fromList) {
- // 从列表页进来的:提交完直接回列表(列表会自动刷新),与宿舍内务检查一致。Lin
- this.resetAfterSubmit();
- this.warnMsg = "";
- this.showToast("提交成功", "success");
- setTimeout(() => this.goBack(), 900);
- return;
- }
- // 直接入口进来的:保留连续录入(今天已录入 N 条)。Lin
- 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 = Number(item.defaultValue || 0);
- });
- },
- // 通知列表页刷新(回到列表时由 mp_sqljc_list.html 的 pageshow 处理读取)。Lin
- markListRefresh() {
- try {
- sessionStorage.setItem("mp_sqljc_list_refresh", "1");
- sessionStorage.setItem("mp_sqljc_list_date", this.formatLocalDate(new Date()));
- } catch (_) {
- }
- },
- formatLocalDate(date) {
- const d = date instanceof Date ? date : new Date(date);
- const pad = (v) => String(v).padStart(2, "0");
- return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
- },
- 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>
|