|
|
@@ -0,0 +1,419 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8" />
|
|
|
+ <meta
|
|
|
+ name="viewport"
|
|
|
+ content="width=device-width, initial-scale=1.0, user-scalable=no"
|
|
|
+ />
|
|
|
+ <title>住宿申请</title>
|
|
|
+ <script src="/js/mp_base/base.js"></script>
|
|
|
+
|
|
|
+ <style>
|
|
|
+ [v-cloak] {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ #app {
|
|
|
+ background: #f5f5f5;
|
|
|
+ min-height: 100vh;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+
|
|
|
+ .table th {
|
|
|
+ width: 140px;
|
|
|
+ max-width: 170px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .table td {
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .reason-input {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div id="app" v-cloak>
|
|
|
+ <div class="form-wrap">
|
|
|
+ <table class="table">
|
|
|
+ <tr>
|
|
|
+ <th>申请类别</th>
|
|
|
+ <td>
|
|
|
+ <ss-select
|
|
|
+ v-model="formData.zssqlbm"
|
|
|
+ cb="zssqlb"
|
|
|
+ :disabled="isTypeLocked"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="onTypeChange"
|
|
|
+ >
|
|
|
+ </ss-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>班级</th>
|
|
|
+ <td>
|
|
|
+ <ss-select
|
|
|
+ v-model="formData.sqbjid"
|
|
|
+ cb="adminBj"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="onBjChange"
|
|
|
+ >
|
|
|
+ </ss-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>学员</th>
|
|
|
+ <td>
|
|
|
+ <ss-select
|
|
|
+ v-model="formData.sqryid"
|
|
|
+ :cb="formData.sqbjid ? 'xyByBj' : ''"
|
|
|
+ :filter="studentFilter"
|
|
|
+ :disabled="!formData.sqbjid"
|
|
|
+ :placeholder="formData.sqbjid ? '请选择' : '请先选择班级'"
|
|
|
+ @change="onStudentChange"
|
|
|
+ >
|
|
|
+ </ss-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <template v-if="isRsType">
|
|
|
+ <tr>
|
|
|
+ <th>建筑物</th>
|
|
|
+ <td>
|
|
|
+ <ss-select
|
|
|
+ v-model="formData.jzwid"
|
|
|
+ cb="xyssl"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="onJzwChange"
|
|
|
+ >
|
|
|
+ </ss-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>房间</th>
|
|
|
+ <td>
|
|
|
+ <ss-select
|
|
|
+ v-model="formData.kfid"
|
|
|
+ :cb="formData.jzwid ? 'kxkfByJzw' : ''"
|
|
|
+ :filter="roomFilter"
|
|
|
+ :disabled="!formData.jzwid"
|
|
|
+ :placeholder="formData.jzwid ? '请选择' : '请先选择建筑物'"
|
|
|
+ @change="onKfChange"
|
|
|
+ >
|
|
|
+ </ss-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>床位</th>
|
|
|
+ <td>
|
|
|
+ <ss-select
|
|
|
+ v-model="formData.cwid"
|
|
|
+ :cb="formData.kfid ? 'kxcwByKf' : ''"
|
|
|
+ :filter="bedFilter"
|
|
|
+ :disabled="!formData.kfid"
|
|
|
+ :placeholder="formData.kfid ? '请选择' : '请先选择房间'"
|
|
|
+ >
|
|
|
+ </ss-select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </template>
|
|
|
+ <template v-if="isTsType">
|
|
|
+ <tr>
|
|
|
+ <th>开始时间</th>
|
|
|
+ <td>
|
|
|
+ <ss-datetime-picker
|
|
|
+ v-model="formData.kssj"
|
|
|
+ mode="datetime"
|
|
|
+ placeholder="YYYY-MM-DD HH:mm"
|
|
|
+ @change="onStartTimeChange"
|
|
|
+ >
|
|
|
+ </ss-datetime-picker>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>结束时间</th>
|
|
|
+ <td>
|
|
|
+ <ss-datetime-picker
|
|
|
+ v-model="formData.jssj"
|
|
|
+ mode="datetime"
|
|
|
+ :min-date="endMinDate"
|
|
|
+ placeholder="YYYY-MM-DD HH:mm"
|
|
|
+ >
|
|
|
+ </ss-datetime-picker>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </template>
|
|
|
+ <tr>
|
|
|
+ <th>描述</th>
|
|
|
+ <td>
|
|
|
+ <ss-input
|
|
|
+ v-model="formData.ms"
|
|
|
+ name="ms"
|
|
|
+ class="reason-input"
|
|
|
+ placeholder="请录入"
|
|
|
+ />
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ window.SS.ready(function () {
|
|
|
+ window.SS.dom.initializeFormApp({
|
|
|
+ el: "#app",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pageParams: {},
|
|
|
+ formData: {
|
|
|
+ zssqlbm: "",
|
|
|
+ sqrxnd: "",
|
|
|
+ sqbjid: "",
|
|
|
+ sqryid: "",
|
|
|
+ jzwid: "",
|
|
|
+ kfid: "",
|
|
|
+ cwid: "",
|
|
|
+ kssj: "",
|
|
|
+ jssj: "",
|
|
|
+ ms: "",
|
|
|
+ fjid: "",
|
|
|
+ },
|
|
|
+ typeLocked: false,
|
|
|
+ endMinDate: "",
|
|
|
+ studentFilter: null,
|
|
|
+ roomFilter: null,
|
|
|
+ bedFilter: null,
|
|
|
+ studentLookupSeq: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isTypeLocked() {
|
|
|
+ return this.typeLocked;
|
|
|
+ },
|
|
|
+ isRsType() {
|
|
|
+ return String(this.formData.zssqlbm || "") === "1";
|
|
|
+ },
|
|
|
+ isTsType() {
|
|
|
+ return String(this.formData.zssqlbm || "") === "11";
|
|
|
+ },
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ this.pageParams = this.getUrlParams();
|
|
|
+ this.initFormFromParams();
|
|
|
+
|
|
|
+ window.__mpObjInpGetFormData = async () => {
|
|
|
+ if (this.formData.sqryid && !this.formData.sqrxnd) {
|
|
|
+ await this.fetchStudentBaseInfo(this.formData.sqryid);
|
|
|
+ }
|
|
|
+
|
|
|
+ const message = this.validateForm();
|
|
|
+ return {
|
|
|
+ valid: !message,
|
|
|
+ message: message || "",
|
|
|
+ data: {
|
|
|
+ zssqlbm: this.formData.zssqlbm,
|
|
|
+ sqrxnd: this.formData.sqrxnd,
|
|
|
+ sqbjid: this.formData.sqbjid,
|
|
|
+ sqryid: this.formData.sqryid,
|
|
|
+ jzwid: this.formData.jzwid,
|
|
|
+ kfid: this.formData.kfid,
|
|
|
+ cwid: this.formData.cwid,
|
|
|
+ kssj: this.formData.kssj,
|
|
|
+ jssj: this.formData.jssj,
|
|
|
+ ms: (this.formData.ms || "").trim(),
|
|
|
+ fjid: this.formData.fjid,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ };
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ try {
|
|
|
+ if (window.__mpObjInpGetFormData) {
|
|
|
+ delete window.__mpObjInpGetFormData;
|
|
|
+ }
|
|
|
+ } catch (_) {}
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getUrlParams() {
|
|
|
+ const params = {};
|
|
|
+ const urlSearchParams = new URLSearchParams(
|
|
|
+ window.location.search
|
|
|
+ );
|
|
|
+ for (const [key, value] of urlSearchParams) {
|
|
|
+ params[key] = decodeURIComponent(value);
|
|
|
+ }
|
|
|
+ return params;
|
|
|
+ },
|
|
|
+
|
|
|
+ initFormFromParams() {
|
|
|
+ const params = this.pageParams || {};
|
|
|
+ this.formData.zssqlbm = String(params.zssqlbm || "").trim();
|
|
|
+ this.formData.sqrxnd = String(params.sqrxnd || "").trim();
|
|
|
+ this.formData.sqbjid = String(params.sqbjid || "").trim();
|
|
|
+ this.formData.sqryid = String(params.sqryid || "").trim();
|
|
|
+ this.formData.jzwid = String(params.jzwid || "").trim();
|
|
|
+ this.formData.kfid = String(params.kfid || "").trim();
|
|
|
+ this.formData.cwid = String(params.cwid || "").trim();
|
|
|
+ this.formData.kssj = String(params.kssj || "").trim();
|
|
|
+ this.formData.jssj = String(params.jssj || "").trim();
|
|
|
+ this.formData.ms = String(params.ms || "").trim();
|
|
|
+ this.formData.fjid = String(params.fjid || "").trim();
|
|
|
+ this.typeLocked = String(params.forceZssqlbm || "") === "1";
|
|
|
+ this.studentFilter = this.formData.sqbjid
|
|
|
+ ? { bjid: this.formData.sqbjid }
|
|
|
+ : null;
|
|
|
+ this.roomFilter = this.formData.jzwid
|
|
|
+ ? { jzwid: this.formData.jzwid }
|
|
|
+ : null;
|
|
|
+ this.bedFilter = this.formData.kfid
|
|
|
+ ? { kfid: this.formData.kfid }
|
|
|
+ : null;
|
|
|
+ this.endMinDate = this.formData.kssj || "";
|
|
|
+ this.applyTypeSideEffects();
|
|
|
+ },
|
|
|
+
|
|
|
+ onTypeChange(value) {
|
|
|
+ this.formData.zssqlbm = String(value || "").trim();
|
|
|
+ this.applyTypeSideEffects();
|
|
|
+ },
|
|
|
+
|
|
|
+ applyTypeSideEffects() {
|
|
|
+ const type = String(this.formData.zssqlbm || "").trim();
|
|
|
+ if (type !== "1") {
|
|
|
+ this.formData.jzwid = "";
|
|
|
+ this.formData.kfid = "";
|
|
|
+ this.formData.cwid = "";
|
|
|
+ this.roomFilter = null;
|
|
|
+ this.bedFilter = null;
|
|
|
+ }
|
|
|
+ if (type !== "11") {
|
|
|
+ this.formData.kssj = "";
|
|
|
+ this.formData.jssj = "";
|
|
|
+ this.endMinDate = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ onBjChange(value) {
|
|
|
+ const bjid = String(value || "").trim();
|
|
|
+ this.formData.sqbjid = bjid;
|
|
|
+ this.formData.sqryid = "";
|
|
|
+ this.formData.sqrxnd = "";
|
|
|
+ this.studentFilter = bjid ? { bjid } : null;
|
|
|
+ },
|
|
|
+
|
|
|
+ onStudentChange(value) {
|
|
|
+ const ryid = String(value || this.formData.sqryid || "").trim();
|
|
|
+ this.formData.sqryid = ryid;
|
|
|
+ if (!ryid) {
|
|
|
+ this.formData.sqrxnd = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.fetchStudentBaseInfo(ryid);
|
|
|
+ },
|
|
|
+
|
|
|
+ onJzwChange(value) {
|
|
|
+ const jzwid = String(value || "").trim();
|
|
|
+ this.formData.jzwid = jzwid;
|
|
|
+ this.formData.kfid = "";
|
|
|
+ this.formData.cwid = "";
|
|
|
+ this.roomFilter = jzwid ? { jzwid } : null;
|
|
|
+ this.bedFilter = null;
|
|
|
+ },
|
|
|
+
|
|
|
+ onKfChange(value) {
|
|
|
+ const kfid = String(value || "").trim();
|
|
|
+ this.formData.kfid = kfid;
|
|
|
+ this.formData.cwid = "";
|
|
|
+ this.bedFilter = kfid ? { kfid } : null;
|
|
|
+ },
|
|
|
+
|
|
|
+ onStartTimeChange(value) {
|
|
|
+ this.endMinDate = value || "";
|
|
|
+ if (
|
|
|
+ this.formData.jssj &&
|
|
|
+ value &&
|
|
|
+ new Date(this.formData.jssj).getTime() <
|
|
|
+ new Date(value).getTime()
|
|
|
+ ) {
|
|
|
+ this.formData.jssj = value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async fetchStudentBaseInfo(ryid) {
|
|
|
+ const value = String(ryid || "").trim();
|
|
|
+ if (!value) {
|
|
|
+ this.formData.sqrxnd = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const reqSeq = ++this.studentLookupSeq;
|
|
|
+ try {
|
|
|
+ const req = (window && window.request) || request;
|
|
|
+ if (!req || typeof req.post !== "function") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const response = await req.post(
|
|
|
+ "/service?ssServ=xy_selBaseInfoByXyid",
|
|
|
+ { ryid: value },
|
|
|
+ { loading: false, formData: true }
|
|
|
+ );
|
|
|
+
|
|
|
+ if (reqSeq !== this.studentLookupSeq) return;
|
|
|
+
|
|
|
+ const raw = response && response.data ? response.data : response;
|
|
|
+ const data =
|
|
|
+ raw && raw.ssData !== undefined ? raw.ssData : raw || {};
|
|
|
+
|
|
|
+ this.formData.sqrxnd = String(data.rxnd || "").trim();
|
|
|
+ if (
|
|
|
+ data.bjid !== undefined &&
|
|
|
+ data.bjid !== null &&
|
|
|
+ data.bjid !== ""
|
|
|
+ ) {
|
|
|
+ this.formData.sqbjid = String(data.bjid).trim();
|
|
|
+ this.studentFilter = this.formData.sqbjid
|
|
|
+ ? { bjid: this.formData.sqbjid }
|
|
|
+ : null;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ if (reqSeq !== this.studentLookupSeq) return;
|
|
|
+ console.error("[mp_zssq_inp] 学员基础信息反查失败", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ validateForm() {
|
|
|
+ const type = String(this.formData.zssqlbm || "").trim();
|
|
|
+ if (!type) return "请选择住宿申请类别";
|
|
|
+ if (!this.formData.sqbjid) return "请选择班级";
|
|
|
+ if (!this.formData.sqryid) return "请选择学员";
|
|
|
+
|
|
|
+ if (type === "1") {
|
|
|
+ if (!this.formData.jzwid) return "请选择建筑物";
|
|
|
+ if (!this.formData.kfid) return "请选择房间";
|
|
|
+ if (!this.formData.cwid) return "请选择床位";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type === "11") {
|
|
|
+ if (!this.formData.kssj) return "请选择开始时间";
|
|
|
+ if (!this.formData.jssj) return "请选择结束时间";
|
|
|
+ const start = new Date(this.formData.kssj).getTime();
|
|
|
+ const end = new Date(this.formData.jssj).getTime();
|
|
|
+ if (!Number.isNaN(start) && !Number.isNaN(end) && end < start) {
|
|
|
+ return "结束时间不能早于开始时间";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type !== "1" && type !== "11" && type !== "51") {
|
|
|
+ return "当前住宿申请类别不支持提交";
|
|
|
+ }
|
|
|
+
|
|
|
+ return "";
|
|
|
+ },
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+</html>
|