|
|
@@ -0,0 +1,402 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+ <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: #222;
|
|
|
+ --muted: #8b95a5;
|
|
|
+ --green: #19a463;
|
|
|
+ --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; }
|
|
|
+ .loading-container {
|
|
|
+ display: flex;
|
|
|
+ min-height: 65vh;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ color: var(--muted);
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .loading-spinner {
|
|
|
+ width: 38px;
|
|
|
+ height: 38px;
|
|
|
+ margin-right: 10px;
|
|
|
+ border: 4px solid #e6e8ec;
|
|
|
+ border-top-color: var(--green);
|
|
|
+ border-radius: 50%;
|
|
|
+ animation: spin .9s linear infinite;
|
|
|
+ }
|
|
|
+ @keyframes spin { to { transform: rotate(360deg); } }
|
|
|
+ .error-box,
|
|
|
+ .submit-hint {
|
|
|
+ margin: 12px 14px 0;
|
|
|
+ padding: 12px;
|
|
|
+ border-radius: 6px;
|
|
|
+ line-height: 1.55;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .error-box,
|
|
|
+ .submit-hint {
|
|
|
+ color: var(--danger);
|
|
|
+ background: var(--danger-soft);
|
|
|
+ border: 1px solid #ffd0d0;
|
|
|
+ }
|
|
|
+ .page-content { padding: 12px 14px 16px; }
|
|
|
+ .form-table {
|
|
|
+ overflow: hidden;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid var(--line);
|
|
|
+ border-radius: 6px;
|
|
|
+ }
|
|
|
+ .form-row {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: 92px minmax(0, 1fr);
|
|
|
+ min-height: 58px;
|
|
|
+ border-bottom: 1px solid var(--line);
|
|
|
+ }
|
|
|
+ .form-row:last-child { border-bottom: 0; }
|
|
|
+ .form-label {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ padding: 12px;
|
|
|
+ color: var(--muted);
|
|
|
+ background: #fbfbfc;
|
|
|
+ border-right: 1px solid var(--line);
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+ .form-value {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ min-width: 0;
|
|
|
+ padding: 10px 12px;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+ .select-cell,
|
|
|
+ .select-cell > .ss-select-container { width: 100%; min-width: 0; }
|
|
|
+ .native-textarea {
|
|
|
+ width: 100%;
|
|
|
+ min-height: 100px;
|
|
|
+ padding: 10px 0;
|
|
|
+ color: var(--text);
|
|
|
+ background: #fff;
|
|
|
+ border: 0;
|
|
|
+ outline: none;
|
|
|
+ resize: vertical;
|
|
|
+ font: inherit;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+ .native-textarea::placeholder { color: #b4bbc6; }
|
|
|
+ .attachment-cell {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ gap: 10px;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ .attachment-button {
|
|
|
+ height: 34px;
|
|
|
+ padding: 0 12px;
|
|
|
+ color: #166534;
|
|
|
+ background: #eaf8f1;
|
|
|
+ border: 1px solid #b7ebd0;
|
|
|
+ border-radius: 5px;
|
|
|
+ font: inherit;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .attachment-state { color: var(--muted); font-size: 13px; }
|
|
|
+ .attachment-modal {
|
|
|
+ position: fixed;
|
|
|
+ z-index: 9999;
|
|
|
+ inset: 0;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+ .attachment-modal-head {
|
|
|
+ display: flex;
|
|
|
+ height: 48px;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0 14px;
|
|
|
+ border-bottom: 1px solid var(--line);
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+ .attachment-close {
|
|
|
+ padding: 8px 4px 8px 14px;
|
|
|
+ color: var(--green);
|
|
|
+ background: transparent;
|
|
|
+ border: 0;
|
|
|
+ font: inherit;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+ .attachment-frame { flex: 1; width: 100%; border: 0; }
|
|
|
+ .tip {
|
|
|
+ margin: 12px 2px 0;
|
|
|
+ color: var(--muted);
|
|
|
+ line-height: 1.55;
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div id="app" v-cloak>
|
|
|
+ <div v-if="loading" class="loading-container">
|
|
|
+ <div class="loading-spinner"></div><span>加载中...</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template v-else>
|
|
|
+ <div v-if="errorMsg" class="error-box">{{ errorMsg }}</div>
|
|
|
+ <div v-if="submitHint" class="submit-hint">{{ submitHint }}</div>
|
|
|
+
|
|
|
+ <div class="page-content">
|
|
|
+ <div class="form-table">
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="form-label">违纪时间</div>
|
|
|
+ <div class="form-value">
|
|
|
+ <div class="select-cell">
|
|
|
+ <ss-datetime-picker
|
|
|
+ v-model="form.wjsj"
|
|
|
+ mode="datetime"
|
|
|
+ min-date="2020-01-01"
|
|
|
+ max-date="2035-12-31"
|
|
|
+ placeholder="请选择违纪时间"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="form-label">班级</div>
|
|
|
+ <div class="form-value">
|
|
|
+ <div class="select-cell">
|
|
|
+ <ss-select
|
|
|
+ v-model="form.bjid"
|
|
|
+ cb="bj"
|
|
|
+ placeholder="请选择班级"
|
|
|
+ searchable
|
|
|
+ clearable
|
|
|
+ @change="onClassChange"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="form-label">学员</div>
|
|
|
+ <div class="form-value">
|
|
|
+ <div class="select-cell">
|
|
|
+ <ss-select
|
|
|
+ :key="'student-' + form.bjid"
|
|
|
+ v-model="form.ryid"
|
|
|
+ :cb="form.bjid ? 'xyByBj' : ''"
|
|
|
+ :filter="{bjid: form.bjid}"
|
|
|
+ :disabled="!form.bjid"
|
|
|
+ :placeholder="form.bjid ? '请选择学员' : '请先选择班级'"
|
|
|
+ searchable
|
|
|
+ clearable
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="form-label">违纪类别</div>
|
|
|
+ <div class="form-value">
|
|
|
+ <div class="select-cell">
|
|
|
+ <ss-select
|
|
|
+ v-model="form.wjlbm"
|
|
|
+ cb="xxwjlb"
|
|
|
+ placeholder="请选择学校违纪类别"
|
|
|
+ searchable
|
|
|
+ clearable
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="form-label">描述</div>
|
|
|
+ <div class="form-value">
|
|
|
+ <textarea
|
|
|
+ v-model="form.ms"
|
|
|
+ class="native-textarea"
|
|
|
+ maxlength="500"
|
|
|
+ placeholder="请输入违纪情况说明"
|
|
|
+ ></textarea>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="form-label">附件</div>
|
|
|
+ <div class="form-value">
|
|
|
+ <div class="attachment-cell">
|
|
|
+ <span class="attachment-state">
|
|
|
+ {{ form.fjid ? '已关联附件内容' : '未添加附件' }}
|
|
|
+ </span>
|
|
|
+ <button class="attachment-button" type="button"
|
|
|
+ :disabled="attachmentLoading" @click="openAttachment">
|
|
|
+ {{ attachmentLoading ? '处理中...' : (form.fjid ? '管理附件' : '添加附件') }}
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="tip">提交后进入学校违纪审批流程,审批通过后记录生效。</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-if="attachmentVisible" class="attachment-modal">
|
|
|
+ <div class="attachment-modal-head">
|
|
|
+ <span>附件管理</span>
|
|
|
+ <button class="attachment-close" type="button" @click="closeAttachment">关闭</button>
|
|
|
+ </div>
|
|
|
+ <iframe class="attachment-frame" :src="attachmentUrl"></iframe>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script>
|
|
|
+ window.SS.ready(function () {
|
|
|
+ window.SS.dom.initializeFormApp({
|
|
|
+ el: "#app",
|
|
|
+ data() {
|
|
|
+ const params = new URLSearchParams(window.location.search);
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ errorMsg: "",
|
|
|
+ submitHint: "",
|
|
|
+ attachmentVisible: false,
|
|
|
+ attachmentLoading: false,
|
|
|
+ attachmentUrl: "",
|
|
|
+ form: {
|
|
|
+ wjlxm: 1,
|
|
|
+ wjsj: params.get("wjsj") || "",
|
|
|
+ bjid: params.get("bjid") || "",
|
|
|
+ ryid: params.get("ryid") || "",
|
|
|
+ wjlbm: params.get("wjlbm") || "",
|
|
|
+ ms: params.get("ms") || "",
|
|
|
+ fjid: params.get("fjid") || ""
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ if (!this.form.wjsj)
|
|
|
+ this.form.wjsj = this.formatNow();
|
|
|
+ window.__mpObjInpGetFormData = () => {
|
|
|
+ const form = this.form;
|
|
|
+ let message = "";
|
|
|
+ if (!form.wjsj) message = "请选择违纪时间";
|
|
|
+ else if (!form.bjid) message = "请选择班级";
|
|
|
+ else if (!form.ryid) message = "请选择学员";
|
|
|
+ else if (!form.wjlbm) message = "请选择违纪类别";
|
|
|
+ return {
|
|
|
+ valid: !message,
|
|
|
+ message,
|
|
|
+ data: {
|
|
|
+ wjlxm: 1,
|
|
|
+ wjsj: form.wjsj,
|
|
|
+ bjid: form.bjid,
|
|
|
+ ryid: form.ryid,
|
|
|
+ wjlbm: form.wjlbm,
|
|
|
+ ms: String(form.ms || "").trim(),
|
|
|
+ fjid: form.fjid
|
|
|
+ }
|
|
|
+ };
|
|
|
+ };
|
|
|
+ this.loading = true;
|
|
|
+ try {
|
|
|
+ if (typeof window.ensureMiniProgramSessionFresh === "function") {
|
|
|
+ await window.ensureMiniProgramSessionFresh({
|
|
|
+ page: "mp_xxwjjl_inp",
|
|
|
+ service: "xxwjjl_lr_zj",
|
|
|
+ force: true
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.errorMsg = error && error.message
|
|
|
+ ? error.message
|
|
|
+ : "登录状态刷新失败";
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ try {
|
|
|
+ delete window.__mpObjInpGetFormData;
|
|
|
+ } catch (_) {}
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getRequest() {
|
|
|
+ return window.request || (typeof request !== "undefined" ? request : null);
|
|
|
+ },
|
|
|
+ onClassChange() {
|
|
|
+ this.form.ryid = "";
|
|
|
+ },
|
|
|
+ async openAttachment() {
|
|
|
+ if (this.attachmentLoading) return;
|
|
|
+ this.attachmentLoading = true;
|
|
|
+ try {
|
|
|
+ if (!this.form.fjid) {
|
|
|
+ const req = this.getRequest();
|
|
|
+ if (!req || typeof req.post !== "function") throw new Error("请求组件未加载");
|
|
|
+ const response = await req.post(
|
|
|
+ "/service?ssServ=makeAttCms&wdConfirmationCaptchaService=0",
|
|
|
+ {name: "fjid", ssNrObjName: "xxwjjl", ssNrObjId: ""},
|
|
|
+ {loading: false, formData: true}
|
|
|
+ );
|
|
|
+ const raw = response && response.data !== undefined ? response.data : response;
|
|
|
+ const candidate = raw && typeof raw === "object"
|
|
|
+ ? (raw.data ?? raw.ssData ?? raw.result)
|
|
|
+ : raw;
|
|
|
+ const fjid = String(candidate == null ? "" : candidate).trim();
|
|
|
+ if (!/^\d+$/.test(fjid)) throw new Error("附件初始化失败");
|
|
|
+ this.form.fjid = fjid;
|
|
|
+ }
|
|
|
+ const query = "&nrid=T-" + encodeURIComponent(this.form.fjid)
|
|
|
+ + "&objectId=" + encodeURIComponent(this.form.fjid)
|
|
|
+ + "&objectName=fjid&mode=edit&callback=";
|
|
|
+ this.attachmentUrl =
|
|
|
+ "/service?ssServ=regCms&ssDest=cmsEdit&wdConfirmationCaptchaService=0" + query;
|
|
|
+ this.attachmentVisible = true;
|
|
|
+ } catch (error) {
|
|
|
+ this.showToast(error.message || "附件初始化失败", "fail");
|
|
|
+ } finally {
|
|
|
+ this.attachmentLoading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ closeAttachment() {
|
|
|
+ this.attachmentVisible = false;
|
|
|
+ },
|
|
|
+ formatNow() {
|
|
|
+ const d = new Date();
|
|
|
+ const pad = v => String(v).padStart(2, "0");
|
|
|
+ return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-"
|
|
|
+ + pad(d.getDate()) + " " + pad(d.getHours()) + ":"
|
|
|
+ + pad(d.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 && window.SS.dom.showToast) {
|
|
|
+ window.SS.dom.showToast({message, type: toastType});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|