mp_sqljc_inp.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <!-- 2026-09-24 升旗礼检查小程序专用页面。样式与 mp_ssnwjc_inp.html 保持一致。 -->
  5. <meta charset="UTF-8"/>
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  8. <title>升旗礼检查</title>
  9. <script src="/js/mp_base/base.js?v=20261201-list-return-v1"></script>
  10. <style>
  11. [v-cloak] {
  12. display: none !important;
  13. }
  14. :root {
  15. --line: #e5e7eb;
  16. --text: #222222;
  17. --muted: #8b95a5;
  18. --soft: #f7f8fa;
  19. --green: #222222;
  20. --green-soft: #f5f6f8;
  21. --danger: #e5484d;
  22. --danger-soft: #fff0f0;
  23. }
  24. * {
  25. box-sizing: border-box;
  26. }
  27. body {
  28. margin: 0;
  29. color: var(--text);
  30. background: #f3f4f6;
  31. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
  32. "Microsoft YaHei", sans-serif;
  33. }
  34. #app {
  35. min-height: 100vh;
  36. padding-bottom: 86px;
  37. }
  38. .loading-container {
  39. display: flex;
  40. flex-direction: column;
  41. align-items: center;
  42. justify-content: center;
  43. min-height: 65vh;
  44. color: var(--muted);
  45. }
  46. .loading-spinner {
  47. width: 38px;
  48. height: 38px;
  49. margin-bottom: 12px;
  50. border: 4px solid #e6e8ec;
  51. border-top-color: var(--green);
  52. border-radius: 50%;
  53. animation: spin 0.9s linear infinite;
  54. }
  55. @keyframes spin {
  56. to {
  57. transform: rotate(360deg);
  58. }
  59. }
  60. .error-box {
  61. margin: 18px 14px;
  62. padding: 18px;
  63. color: var(--danger);
  64. background: var(--danger-soft);
  65. border: 1px solid #ffd0d0;
  66. border-radius: 6px;
  67. line-height: 1.6;
  68. }
  69. .page-content {
  70. padding: 12px 14px 0;
  71. }
  72. .info-table,
  73. .score-table {
  74. overflow: hidden;
  75. background: #fff;
  76. border: 1px solid var(--line);
  77. border-radius: 6px;
  78. }
  79. .info-row {
  80. position: relative;
  81. display: grid;
  82. grid-template-columns: 92px 1fr;
  83. min-height: 58px;
  84. border-bottom: 1px solid var(--line);
  85. }
  86. .info-row.required::before {
  87. content: "";
  88. position: absolute;
  89. left: 92px;
  90. top: 0;
  91. bottom: 0;
  92. width: 2px;
  93. background: #ff3b30;
  94. z-index: 1;
  95. }
  96. .info-row:last-child {
  97. border-bottom: none;
  98. }
  99. .info-label {
  100. display: flex;
  101. align-items: center;
  102. justify-content: flex-end;
  103. padding: 12px 14px;
  104. color: var(--muted);
  105. background: #fbfbfc;
  106. border-right: 1px solid var(--line);
  107. font-size: 15px;
  108. }
  109. .info-value {
  110. display: flex;
  111. align-items: center;
  112. min-width: 0;
  113. padding: 11px 12px;
  114. font-size: 15px;
  115. }
  116. .select-cell {
  117. width: 100%;
  118. min-width: 0;
  119. }
  120. .select-cell > .ss-select-container {
  121. width: 100%;
  122. min-width: 0;
  123. }
  124. .info-text {
  125. align-items: flex-start;
  126. line-height: 1.55;
  127. overflow-wrap: anywhere;
  128. }
  129. .clickable {
  130. justify-content: space-between;
  131. gap: 10px;
  132. cursor: pointer;
  133. }
  134. .clickable-text {
  135. min-width: 0;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. white-space: nowrap;
  139. }
  140. .chevron {
  141. flex: 0 0 auto;
  142. color: #9aa3b2;
  143. font-size: 25px;
  144. line-height: 1;
  145. }
  146. .score-value {
  147. color: var(--green);
  148. font-weight: 700;
  149. font-size: 18px;
  150. }
  151. .veto-value {
  152. display: flex;
  153. align-items: center;
  154. justify-content: space-between;
  155. gap: 12px;
  156. width: 100%;
  157. }
  158. .native-input {
  159. width: 100%;
  160. height: 38px;
  161. padding: 0 10px;
  162. color: var(--text);
  163. background: #fff;
  164. border: 0;
  165. outline: none;
  166. font: inherit;
  167. }
  168. .native-input::placeholder {
  169. color: #b4bbc6;
  170. }
  171. .score-table {
  172. margin-top: 12px;
  173. }
  174. .score-row {
  175. display: grid;
  176. grid-template-columns: minmax(0, 1fr) 168px;
  177. min-height: 68px;
  178. overflow: visible;
  179. border-bottom: 1px solid var(--line);
  180. }
  181. .score-row:last-child {
  182. border-bottom: none;
  183. }
  184. .score-name {
  185. display: flex;
  186. align-items: center;
  187. padding: 10px 12px;
  188. line-height: 1.45;
  189. font-size: 15px;
  190. }
  191. .score-max {
  192. display: flex;
  193. align-items: center;
  194. justify-content: center;
  195. color: var(--muted);
  196. border-left: 1px solid var(--line);
  197. font-size: 16px;
  198. }
  199. .stepper {
  200. display: grid;
  201. grid-template-columns: 48px minmax(56px, 1fr) 40px;
  202. align-items: center;
  203. width: auto;
  204. min-width: 0;
  205. margin: 10px 7px;
  206. background: #fff;
  207. border: 1px solid #cfd4dc;
  208. border-radius: 5px;
  209. overflow: hidden;
  210. }
  211. .stepper-btn {
  212. display: inline-flex;
  213. align-items: center;
  214. justify-content: center;
  215. gap: 1px;
  216. height: 44px;
  217. padding: 0;
  218. color: #596273;
  219. background: #f3f4f6;
  220. border: 0;
  221. font-size: 24px;
  222. line-height: 1;
  223. appearance: none;
  224. }
  225. .stepper-btn:disabled {
  226. color: #c8cdd5;
  227. background: #eceff2;
  228. }
  229. .stepper-deduct-num {
  230. font-size: 15px;
  231. font-weight: 400;
  232. line-height: 1;
  233. }
  234. .stepper-btn-symbol {
  235. line-height: 1;
  236. }
  237. .stepper-value {
  238. width: 100%;
  239. min-width: 56px;
  240. height: 44px;
  241. padding: 0 2px;
  242. text-align: center;
  243. background: #fff;
  244. border: 0;
  245. border-left: 1px solid #e1e4e9;
  246. border-right: 1px solid #e1e4e9;
  247. outline: none;
  248. font: inherit;
  249. font-size: 16px;
  250. font-weight: 400;
  251. }
  252. .score-total {
  253. display: flex;
  254. align-items: center;
  255. justify-content: space-between;
  256. padding: 14px 4px 0;
  257. color: var(--muted);
  258. font-size: 14px;
  259. }
  260. .score-total strong {
  261. color: var(--green);
  262. font-size: 18px;
  263. }
  264. .formula-note {
  265. padding: 4px 4px 0;
  266. color: var(--muted);
  267. text-align: right;
  268. font-size: 13px;
  269. }
  270. .empty-tip {
  271. padding: 16px 12px;
  272. color: var(--muted);
  273. text-align: center;
  274. font-size: 14px;
  275. }
  276. .warning-bar {
  277. margin: 12px 14px 0;
  278. padding: 11px 12px;
  279. color: #9a6700;
  280. background: #fff8e6;
  281. border: 1px solid #ffe8a3;
  282. border-radius: 6px;
  283. line-height: 1.5;
  284. font-size: 14px;
  285. }
  286. .submit-hint {
  287. margin: 12px 14px 0;
  288. padding: 11px 12px;
  289. color: var(--danger);
  290. background: var(--danger-soft);
  291. border: 1px solid #ffd0d0;
  292. border-radius: 6px;
  293. line-height: 1.5;
  294. font-size: 14px;
  295. }
  296. .bottom-spacer {
  297. height: 16px;
  298. }
  299. </style>
  300. </head>
  301. <body>
  302. <div id="app" v-cloak>
  303. <div v-if="loading" class="loading-container">
  304. <div class="loading-spinner"></div>
  305. <div>加载中...</div>
  306. </div>
  307. <div v-else-if="errorMsg" class="error-box">
  308. {{ errorMsg }}
  309. </div>
  310. <template v-else>
  311. <div v-if="warnMsg" class="warning-bar">{{ warnMsg }}</div>
  312. <div v-if="submitHint" class="submit-hint">{{ submitHint }}</div>
  313. <div class="page-content">
  314. <div class="info-table">
  315. <div class="info-row required">
  316. <div class="info-label">部门</div>
  317. <div class="info-value">
  318. <div class="select-cell">
  319. <ss-select
  320. v-model="form.bmid"
  321. :options="departmentOptions"
  322. :mapping="{ text: 'n', value: 'v' }"
  323. placeholder=""
  324. searchable
  325. @change="onDepartmentChange"
  326. />
  327. </div>
  328. </div>
  329. </div>
  330. <div class="info-row">
  331. <div class="info-label">总分数</div>
  332. <div class="info-value">{{ formatScore(totalFs) }}</div>
  333. </div>
  334. <div class="info-row">
  335. <div class="info-label">出勤率(%)</div>
  336. <div class="info-value">{{ formatScore(attendanceRate) }}</div>
  337. </div>
  338. <div class="info-row">
  339. <div class="info-label">考勤分数</div>
  340. <div class="info-value">{{ formatScore(attendanceRate) }}</div>
  341. </div>
  342. <div class="info-row">
  343. <div class="info-label">队列分数</div>
  344. <div class="info-value">{{ formatScore(queueScore) }}</div>
  345. </div>
  346. <div class="info-row">
  347. <div class="info-label">风貌分数</div>
  348. <div class="info-value">{{ formatScore(demeanorScore) }}</div>
  349. </div>
  350. <div class="info-row">
  351. <div class="info-label">纪律分数</div>
  352. <div class="info-value">{{ formatScore(disciplineScore) }}</div>
  353. </div>
  354. <div class="info-row">
  355. <div class="info-label">检查人</div>
  356. <div class="info-value">{{ jcryxm || '—' }}</div>
  357. </div>
  358. <div class="info-row">
  359. <div class="info-label">检查日期</div>
  360. <div class="info-value">{{ inspectionDate }}</div>
  361. </div>
  362. <div class="info-row">
  363. <div class="info-label">说明</div>
  364. <div class="info-value">
  365. <input
  366. v-model="form.ms"
  367. class="native-input"
  368. maxlength="500"
  369. placeholder="请输入"
  370. />
  371. </div>
  372. </div>
  373. </div>
  374. <div class="score-table">
  375. <div v-if="!jcxmList.length" class="empty-tip">暂无检查项目</div>
  376. <div v-for="item in jcxmList" :key="item.sqljcxmm" class="score-row">
  377. <div class="score-name">
  378. {{ item.mc }}<span v-if="isScoreItem(item)"> ({{ item.mfz }})</span>
  379. </div>
  380. <div class="stepper">
  381. <button
  382. class="stepper-btn"
  383. type="button"
  384. :disabled="Number(item.value) <= 0"
  385. @click="changeStep(item, -1)"
  386. >
  387. <span class="stepper-btn-symbol">-</span><span
  388. v-if="deductedFs(item) > 0"
  389. class="stepper-deduct-num">{{ deductedFs(item) }}</span>
  390. </button>
  391. <input
  392. class="stepper-value"
  393. inputmode="numeric"
  394. :value="item.value"
  395. :min="0"
  396. :max="isScoreItem(item) ? item.mfz : null"
  397. @input="onStepInput(item, $event)"
  398. @blur="normalizeStep(item, $event)"
  399. />
  400. <button
  401. class="stepper-btn"
  402. type="button"
  403. :disabled="isScoreItem(item) && Number(item.value) >= Number(item.mfz)"
  404. @click="changeStep(item, 1)"
  405. >
  406. +
  407. </button>
  408. </div>
  409. </div>
  410. </div>
  411. <div class="bottom-spacer"></div>
  412. </div>
  413. <ss-bottom
  414. :show-shyj="false"
  415. :buttons="submitting ? [{ text: '提交中...', action: 'submit' }] : bottomButtons"
  416. @button-click="handleBottomAction"
  417. :disabled="submitting"
  418. />
  419. </template>
  420. </div>
  421. <script>
  422. window.SS.ready(function () {
  423. const LIST_PAGE = "/page/mp/mp_sqljc_list.html";
  424. window.SS.dom.initializeFormApp({
  425. el: "#app",
  426. data() {
  427. return {
  428. loading: true,
  429. submitting: false,
  430. errorMsg: "",
  431. warnMsg: "",
  432. submitHint: "",
  433. bmmc: "",
  434. jcryxm: "",
  435. inspectionDate: "",
  436. totalStudents: 0,
  437. leaveStudents: 0,
  438. classCount: 0,
  439. classes: [],
  440. departments: [],
  441. formulaNote: "出勤率×25% + 队列分×20% + 风貌分×40% + 纪律分×15%",
  442. jcxmList: [],
  443. form: {
  444. bmid: "",
  445. ms: ""
  446. },
  447. bottomButtons: [
  448. { text: "取消", action: "cancel" },
  449. { text: "保存并提交", action: "submit" }
  450. ]
  451. };
  452. },
  453. computed: {
  454. departmentOptions() {
  455. return this.departments.map((item) => ({
  456. n: item.bmmc || "",
  457. v: String(item.bmid == null ? "" : item.bmid)
  458. }));
  459. },
  460. expectedStudents() {
  461. const countCodes = [3, 4, 5, 6, 7, 8];
  462. const exempt = countCodes.reduce(
  463. (sum, code) => sum + this.valueOfCode(code), 0);
  464. return Math.max(0, this.valueOfCode(1) - exempt);
  465. },
  466. attendanceRate() {
  467. if (this.expectedStudents <= 0)
  468. return 0;
  469. return Math.min(100, this.round2(
  470. this.valueOfCode(2) * 100 / this.expectedStudents));
  471. },
  472. queueScore() {
  473. return this.round2(this.valueOfCode(11));
  474. },
  475. demeanorScore() {
  476. return this.round2(
  477. this.valueOfCode(21) + this.valueOfCode(22));
  478. },
  479. disciplineScore() {
  480. return this.round2(this.valueOfCode(31));
  481. },
  482. totalFs() {
  483. return this.round2(
  484. this.attendanceRate * 0.25
  485. + this.queueScore * 0.20
  486. + this.demeanorScore * 0.40
  487. + this.disciplineScore * 0.15);
  488. }
  489. },
  490. async mounted() {
  491. this.inspectionDate = this.formatLocalDate(new Date());
  492. try {
  493. const sessionOk = await this.ensureSession();
  494. if (!sessionOk)
  495. return;
  496. await this.loadInit();
  497. } catch (error) {
  498. console.error("[mp_sqljc_inp] 初始化失败", error);
  499. this.errorMsg = error && error.message ? error.message : "页面初始化失败";
  500. } finally {
  501. this.loading = false;
  502. }
  503. },
  504. methods: {
  505. getUrlParams() {
  506. const params = {};
  507. const search = new URLSearchParams(window.location.search);
  508. for (const [key, value] of search) {
  509. params[key] = decodeURIComponent(value);
  510. }
  511. return params;
  512. },
  513. getRequest() {
  514. return (window && window.request) || request;
  515. },
  516. // 小程序切换账号后,旧 H5 会话会写到别人名下,必须先刷新会话。Lin
  517. async ensureSession() {
  518. if (typeof window.ensureMiniProgramSessionFresh !== "function")
  519. return true;
  520. try {
  521. await window.ensureMiniProgramSessionFresh({
  522. page: "mp_sqljc_inp",
  523. service: "sqljc_mpInit",
  524. force: true
  525. });
  526. return true;
  527. } catch (error) {
  528. this.errorMsg = "登录状态刷新失败,请返回小程序重新进入";
  529. return false;
  530. }
  531. },
  532. async loadInit() {
  533. const data = await this.postService(
  534. "/service?ssServ=sqljc_mpInit&ssDest=data",
  535. this.form.bmid ? { bmid: this.form.bmid } : {});
  536. this.departments = (data && data.departments) || [];
  537. if (data && data.bmid != null && String(data.bmid) !== "0")
  538. this.form.bmid = String(data.bmid);
  539. this.bmmc = (data && data.bmmc) || "";
  540. this.jcryxm = (data && data.jcryxm) || "";
  541. this.inspectionDate = (data && data.jcsjDate) || this.inspectionDate;
  542. this.totalStudents = Number(data && data.totalStudents || 0);
  543. this.leaveStudents = Number(data && data.leaveStudents || 0);
  544. this.classCount = Number(data && data.classCount || 0);
  545. this.classes = (data && data.classes) || [];
  546. this.formulaNote = (data && data.formulaNote) || this.formulaNote;
  547. this.jcxmList = ((data && data.jcxmList) || []).map((item) => {
  548. const mfz = item.mfz === null || item.mfz === undefined || item.mfz === ""
  549. ? null : Number(item.mfz);
  550. return {
  551. sqljcxmm: Number(item.sqljcxmm),
  552. mc: item.mc,
  553. mfz: mfz,
  554. defaultValue: item.defaultValue === null
  555. || item.defaultValue === undefined
  556. ? (mfz === null ? 0 : mfz)
  557. : Number(item.defaultValue),
  558. value: item.defaultValue === null
  559. || item.defaultValue === undefined
  560. ? (mfz === null ? 0 : mfz)
  561. : Number(item.defaultValue)
  562. };
  563. });
  564. },
  565. valueOfCode(code) {
  566. const item = this.jcxmList.find(
  567. (row) => Number(row.sqljcxmm) === Number(code));
  568. return item ? Number(item.value || 0) : 0;
  569. },
  570. round2(value) {
  571. const number = Number(value || 0);
  572. return Math.round(number * 100) / 100;
  573. },
  574. formatScore(value) {
  575. const number = this.round2(value);
  576. return Number.isInteger(number) ? String(number) : number.toFixed(2);
  577. },
  578. isScoreItem(item) {
  579. return item.mfz !== null && item.mfz !== undefined;
  580. },
  581. async onDepartmentChange(value) {
  582. this.form.bmid = value == null ? "" : String(value);
  583. this.submitHint = "";
  584. this.warnMsg = "";
  585. this.jcxmList = [];
  586. this.classes = [];
  587. this.classCount = 0;
  588. this.totalStudents = 0;
  589. this.leaveStudents = 0;
  590. if (!this.form.bmid)
  591. return;
  592. try {
  593. await this.loadInit();
  594. } catch (error) {
  595. this.submitHint = error && error.message
  596. ? error.message
  597. : "部门检查项目加载失败";
  598. }
  599. },
  600. async postService(url, data) {
  601. const req = this.getRequest();
  602. if (!req || typeof req.post !== "function")
  603. throw new Error("请求组件未加载");
  604. const response = await req.post(url, data, {
  605. loading: false,
  606. formData: true
  607. });
  608. const raw = response && response.data !== undefined ? response.data : response;
  609. if (raw && raw.ssCode !== undefined && Number(raw.ssCode) !== 0)
  610. throw new Error(raw.ssMsg || "请求失败");
  611. return raw && raw.ssData !== undefined ? raw.ssData : raw;
  612. },
  613. // 打分项显示累计扣分;人数项没有满分,不显示扣分。Lin
  614. deductedFs(item) {
  615. if (!this.isScoreItem(item))
  616. return 0;
  617. const mfz = Number(item.mfz || 0);
  618. return Math.max(0, mfz - Number(item.value || 0));
  619. },
  620. // 所有数字项左右都可加减:打分项限 0..MFZ,人数项只限 >= 0。Lin
  621. changeStep(item, step) {
  622. const unit = this.isScoreItem(item) ? 5 : 1;
  623. let value = Number(item.value || 0) + step * unit;
  624. if (value < 0)
  625. value = 0;
  626. if (this.isScoreItem(item) && value > Number(item.mfz || 0))
  627. value = Number(item.mfz || 0);
  628. item.value = value;
  629. },
  630. onStepInput(item, event) {
  631. const raw = String(event.target.value || "").replace(/[^0-9]/g, "");
  632. item.value = raw === "" ? "" : Number(raw);
  633. },
  634. normalizeStep(item, event) {
  635. let value = Number(String(event.target.value || "").replace(/[^0-9]/g, ""));
  636. if (!Number.isFinite(value) || value < 0)
  637. value = 0;
  638. if (this.isScoreItem(item) && value > Number(item.mfz || 0))
  639. value = Number(item.mfz || 0);
  640. item.value = value;
  641. },
  642. validateForm() {
  643. if (!this.form.bmid)
  644. return "请选择部门";
  645. if (!this.classCount)
  646. return "所选部门没有有效班级";
  647. if (!this.jcxmList.length)
  648. return "检查项目未配置";
  649. if (this.valueOfCode(1) <= 0)
  650. return "学员总人数必须大于0";
  651. if (this.expectedStudents <= 0)
  652. return "有效应到人数必须大于0";
  653. if (this.valueOfCode(2) > this.expectedStudents)
  654. return "队列人数不能大于有效应到人数";
  655. for (const item of this.jcxmList) {
  656. const value = Number(item.value || 0);
  657. if (value < 0)
  658. return item.mc + " 不能为负数";
  659. if (this.isScoreItem(item) && value > Number(item.mfz || 0))
  660. return item.mc + " 分值超出满分";
  661. }
  662. return "";
  663. },
  664. async submit() {
  665. if (this.submitting)
  666. return;
  667. const message = this.validateForm();
  668. if (message) {
  669. this.submitHint = message;
  670. this.warnMsg = "";
  671. this.showToast(message, "fail");
  672. return;
  673. }
  674. try {
  675. this.submitting = true;
  676. this.warnMsg = "";
  677. this.submitHint = "";
  678. const payload = {
  679. bmid: this.form.bmid,
  680. jcsjDate: this.inspectionDate,
  681. ms: this.form.ms
  682. };
  683. this.jcxmList.forEach((item) => {
  684. payload["sqljcxmm" + item.sqljcxmm] =
  685. item.value === "" ? 0 : Number(item.value);
  686. });
  687. const result = await this.postService(
  688. "/service?ssServ=sqljc_mpSubm&ssDest=data", payload);
  689. const savedCount = Number(result && result.classCount || this.classCount);
  690. this.showToast("已同步" + savedCount + "个班级", "success");
  691. const listDate = this.inspectionDate;
  692. setTimeout(() => {
  693. window.NavigationManager.returnToList(LIST_PAGE, {
  694. refreshData: { date: listDate },
  695. storageValues: {
  696. "mp_sqljc_list_refresh": "1",
  697. "mp_sqljc_list_date": listDate
  698. }
  699. });
  700. }, 900);
  701. } catch (error) {
  702. console.error("[mp_sqljc_inp] 提交失败", error);
  703. this.submitHint = error && error.message ? error.message : "提交失败";
  704. this.showToast(this.submitHint, "fail");
  705. } finally {
  706. this.submitting = false;
  707. }
  708. },
  709. formatLocalDate(date) {
  710. const d = date instanceof Date ? date : new Date(date);
  711. const pad = (v) => String(v).padStart(2, "0");
  712. return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
  713. },
  714. handleBottomAction(data) {
  715. if (data && data.action === "cancel")
  716. this.goBack();
  717. else if (data && data.action === "submit")
  718. this.submit();
  719. },
  720. goBack() {
  721. if (window.NavigationManager
  722. && typeof window.NavigationManager.goBack === "function") {
  723. window.NavigationManager.goBack({ listPage: LIST_PAGE });
  724. } else if (window.history.length > 1) {
  725. window.history.back();
  726. } else {
  727. window.location.replace(LIST_PAGE);
  728. }
  729. },
  730. showToast(message, type) {
  731. const toastType = type === "success" ? "success" : "error";
  732. if (window.wx && window.wx.miniProgram && window.wx.miniProgram.showToast) {
  733. window.wx.miniProgram.showToast({ title: message, icon: toastType });
  734. } else if (window.SS && window.SS.dom && typeof window.SS.dom.showToast === "function") {
  735. window.SS.dom.showToast({ message: message, type: toastType });
  736. }
  737. }
  738. }
  739. });
  740. });
  741. </script>
  742. </body>
  743. </html>