form.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. <template>
  2. <view class="page-no-tab">
  3. <view class="form-intro">
  4. <ModuleIcon :icon="config.icon" :color="config.color" soft />
  5. <view><text class="intro-title">{{ config.title }}</text><text class="intro-sub">{{ config.subtitle }}</text>
  6. </view>
  7. </view>
  8. <view class="steps">
  9. <view class="step active">
  10. <view>1</view><text>填写申请</text>
  11. </view>
  12. <view class="step-line"></view>
  13. <view class="step">
  14. <view>2</view><text>主管审批</text>
  15. </view>
  16. <view class="step-line"></view>
  17. <view class="step">
  18. <view>3</view><text>完成</text>
  19. </view>
  20. </view>
  21. <view class="form-card card section">
  22. <view class="field"><text class="label">申请人</text>
  23. <view class="readonly">
  24. <view class="avatar small-avatar">{{ currentUser.initials }}</view><text>{{ currentUser.name }} · {{
  25. currentUser.department }}</text>
  26. </view>
  27. </view>
  28. <view class="divider"></view>
  29. <view v-if="type === 'leave'" class="field press" @click="chooseLeave"><text
  30. class="label required">请假类型</text><text :class="form.leaveType ? 'value' : 'placeholder'">{{
  31. form.leaveType || "请选择"
  32. }}</text><text class="arrow">›</text></view>
  33. <view v-if="type === 'certificate'" class="field press" @click="chooseCertificate"><text
  34. class="label required">证明类型</text><text :class="form.certificateType ? 'value' : 'placeholder'">{{
  35. form.certificateType || "请选择"
  36. }}</text><text class="arrow">›</text></view>
  37. <view v-if="type === 'check'" class="field"><text class="label required">补卡日期</text>
  38. <picker mode="date" :value="form.startDate" @change="(e) => (form.startDate = e.detail.value)"><text
  39. class="value">{{ form.startDate }}</text></picker><text class="arrow">›</text>
  40. </view>
  41. <view v-if="type === 'check'" class="divider"></view>
  42. <view v-if="type === 'check'" class="field press" @click="chooseRepairType"><text
  43. class="label required">补卡类型</text><text :class="form.repairType ? 'value' : 'placeholder'">{{
  44. repairTypeLabel
  45. }}</text><text class="arrow">›</text></view>
  46. <view v-if="type === 'check'" class="divider"></view>
  47. <view v-if="type === 'check'" class="field"><text class="label required">打卡时间</text>
  48. <picker mode="time" :value="form.repairTime" @change="(e) => (form.repairTime = e.detail.value)"><text
  49. class="value">{{ form.repairTime || "请选择" }}</text></picker><text class="arrow">›</text>
  50. </view>
  51. <template v-if="!['certificate', 'check', 'resign'].includes(type)">
  52. <view class="field"><text class="label required">开始日期</text>
  53. <picker mode="date" :value="form.startDate" @change="(e) => (form.startDate = e.detail.value)"><text
  54. class="value">{{ form.startDate }}</text></picker><text class="arrow">›</text>
  55. </view>
  56. <view class="divider"></view>
  57. <view class="field"><text class="label required">开始时间</text>
  58. <picker mode="time" :value="form.startTime" @change="(e) => (form.startTime = e.detail.value)"><text
  59. class="value">{{ form.startTime || "请选择" }}</text></picker><text class="arrow">›</text>
  60. </view>
  61. <view class="divider"></view>
  62. <view class="field"><text class="label required">结束日期</text>
  63. <picker mode="date" :value="form.endDate" @change="(e) => (form.endDate = e.detail.value)"><text
  64. class="value">{{ form.endDate }}</text></picker><text class="arrow">›</text>
  65. </view>
  66. <view class="divider"></view>
  67. <view class="field"><text class="label required">结束时间</text>
  68. <picker mode="time" :value="form.endTime" @change="(e) => (form.endTime = e.detail.value)"><text
  69. class="value">{{ form.endTime || "请选择" }}</text></picker><text class="arrow">›</text>
  70. </view>
  71. </template>
  72. <view class="divider"></view>
  73. <template v-if="type === 'resign'">
  74. <view class="field press" @click="chooseResignType"><text
  75. class="label required">离职类型</text><text :class="form.resignType ? 'value' : 'placeholder'">{{
  76. form.resignType || "请选择"
  77. }}</text><text class="arrow">›</text></view>
  78. <view class="divider"></view>
  79. <view class="field press" @click="chooseResignReason"><text
  80. class="label required">离职原因</text><text :class="form.resignReason ? 'value' : 'placeholder'">{{
  81. form.resignReason || "请选择"
  82. }}</text><text class="arrow">›</text></view>
  83. <view class="divider"></view>
  84. <view class="field"><text class="label required">预计离职日期</text>
  85. <picker mode="date" :start="todayStr" :value="form.expectedLeaveDate"
  86. @change="(e) => (form.expectedLeaveDate = e.detail.value)"><text
  87. :class="form.expectedLeaveDate ? 'value' : 'placeholder'">{{ form.expectedLeaveDate || "请选择" }}</text></picker><text class="arrow">›</text>
  88. </view>
  89. <view class="divider"></view>
  90. <view class="field"><text class="label">工作交接人</text>
  91. <input class="input-flex" v-model="form.handover" placeholder="请输入交接人姓名" maxlength="20" /></view>
  92. <view class="divider"></view>
  93. <view class="field textarea-field small-textarea"><text class="label">交接备注</text>
  94. <textarea v-model="form.handoverNote" maxlength="200" placeholder="交接事项、文档与客户说明(选填)" /></view>
  95. <view class="divider"></view>
  96. <view class="field check-field"><text class="label">待归还资产</text>
  97. <view class="check-list">
  98. <label v-for="opt in assetReturnOptions" :key="opt" class="check-row press" @click="toggleAssetReturn(opt)">
  99. <view class="checkbox" :class="{ 'is-checked': form.assetReturnList.includes(opt) }">
  100. <text v-if="form.assetReturnList.includes(opt)">✓</text>
  101. </view>
  102. <text>{{ opt }}</text>
  103. </label>
  104. </view>
  105. </view>
  106. <view class="divider"></view>
  107. <view class="field press" @click="chooseCompensation"><text
  108. class="label">补偿方案</text><text :class="form.compensation ? 'value' : 'placeholder'">{{
  109. form.compensation || "请选择"
  110. }}</text><text class="arrow">›</text></view>
  111. <view class="divider"></view>
  112. <view class="field switch-field"><text class="label">开具离职证明</text>
  113. <switch :checked="form.needCertificate" @change="(e) => (form.needCertificate = e.detail.value)" color="#1677ff" />
  114. </view>
  115. <view class="divider"></view>
  116. </template>
  117. <view class="field textarea-field"><text class="label"
  118. :class="{ required: type !== 'certificate' }">申请事由</text><textarea v-model="form.reason" maxlength="200"
  119. :placeholder="reasonPlaceholder" /><text class="counter">{{ form.reason.length }}/200</text></view>
  120. </view>
  121. <view class="form-card card section">
  122. <view class="field"><text class="label">附件</text>
  123. <view class="upload press" @click="chooseImage"><text class="plus">+</text><text>拍照或上传</text></view>
  124. <view v-if="attachmentSummary" class="file-name">{{ attachmentSummary }}</view>
  125. </view>
  126. <view class="divider"></view>
  127. <view class="field"><text class="label">审批人</text>
  128. <view class="approver approver-auto">
  129. <view class="avatar approve-avatar auto">·</view><text>系统自动匹配</text><text class="muted">(直属主管 · 由 BPM
  130. 引擎分配)</text>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="bottom-action safe-bottom"><button class="draft-btn" @click="saveDraft">存草稿</button><button
  135. class="submit-btn" @click="submit">提交申请</button></view>
  136. </view>
  137. </template>
  138. <script setup>
  139. import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
  140. import { onLoad, onShow } from "@dcloudio/uni-app";
  141. import ModuleIcon from "@/components/ModuleIcon.vue";
  142. import { applicationTypes } from "@/data/mock";
  143. import { useAuthGuard } from "@/hooks/useAuthGuard";
  144. import { useCurrentUser } from "@/hooks/useCurrentUser";
  145. import {
  146. addApplication,
  147. getDraft,
  148. removeDraft,
  149. saveDraft as persistDraft,
  150. } from "@/utils/storage";
  151. import {
  152. ATTENDANCE_APPLY_TYPE_MAP,
  153. REPAIR_TYPE_LABEL,
  154. REPAIR_TYPE_OPTIONS,
  155. buildAttendancePayload,
  156. submitAttendanceApplication,
  157. } from "@/api/attendance";
  158. import {
  159. buildResignationPayload,
  160. registerSubmittedResignation,
  161. submitResignationApplication,
  162. } from "@/api/resign";
  163. import { uploadAttachment } from "@/api/file";
  164. import { getServerConfig } from "@/utils/auth";
  165. const type = ref("leave");
  166. useAuthGuard();
  167. const currentUser = useCurrentUser();
  168. const form = reactive({
  169. leaveType: "",
  170. certificateType: "",
  171. startDate: "2026-08-06",
  172. startTime: "08:30",
  173. endDate: "2026-08-06",
  174. endTime: "17:30",
  175. reason: "",
  176. attachments: [],
  177. repairType: "",
  178. repairTime: "",
  179. resignType: "",
  180. resignReason: "",
  181. expectedLeaveDate: "",
  182. handover: "",
  183. handoverNote: "",
  184. assetReturnList: [],
  185. compensation: "",
  186. needCertificate: true,
  187. });
  188. const config = computed(
  189. () => applicationTypes[type.value] || applicationTypes.leave,
  190. );
  191. const reasonPlaceholder = computed(() =>
  192. type.value === "certificate"
  193. ? "请填写证明用途(选填)"
  194. : type.value === "check"
  195. ? "请说明补卡原因(如:临时接待客户忘记打卡)"
  196. : "请简要说明申请原因",
  197. );
  198. const repairTypeLabel = computed(() =>
  199. form.repairType ? REPAIR_TYPE_LABEL[form.repairType] : "请选择",
  200. );
  201. const attachmentSummary = computed(() => {
  202. const list = Array.isArray(form.attachments) ? form.attachments : [];
  203. if (!list.length) return "";
  204. const uploading = list.filter((a) => a && a.status === "uploading").length;
  205. const failed = list.filter((a) => a && a.status === "failed").length;
  206. const parts = [`已选择 ${list.length} 张图片`];
  207. if (uploading) parts.push(`${uploading} 上传中`);
  208. if (failed) parts.push(`${failed} 失败`);
  209. return parts.join(" · ");
  210. });
  211. function syncType(o = {}) {
  212. const next = o.type || "leave";
  213. if (type.value !== next) resetForm();
  214. type.value = next;
  215. uni.setNavigationBarTitle({ title: config.value.title });
  216. const draft = getDraft(next);
  217. if (draft) Object.assign(form, draft);
  218. // 草稿兼容:
  219. // - 老草稿没有 startTime / endTime 字段 → 兜底默认值,避免 validate 误报
  220. // - 老草稿字段叫 attachment(字符串)→ 已不在 form 上,忽略
  221. // - 老格式(新字段 attachments)但值为字符串数组(重命名前的中间态)→ 清空让用户重选
  222. // - 跨会话遗留的 uploading 状态 → 视为失败(upload 早已中断)
  223. if (!form.startTime) form.startTime = "08:30";
  224. if (!form.endTime) form.endTime = "17:30";
  225. if (!Array.isArray(form.attachments)) {
  226. form.attachments = [];
  227. } else if (form.attachments.some((a) => typeof a === "string")) {
  228. form.attachments = [];
  229. } else {
  230. form.attachments = form.attachments.map((a) =>
  231. a && a.status === "uploading"
  232. ? { ...a, status: "failed", error: "上次会话未完成" }
  233. : a,
  234. );
  235. }
  236. }
  237. onLoad(syncType);
  238. onShow(() => {
  239. const pages = getCurrentPages();
  240. syncType(pages[pages.length - 1]?.options || {});
  241. });
  242. function syncHash() {
  243. if (typeof location === "undefined") return;
  244. const match = location.hash.match(/[?&]type=([^&]+)/);
  245. if (match) syncType({ type: decodeURIComponent(match[1]) });
  246. }
  247. onMounted(() => {
  248. syncHash();
  249. if (typeof window !== "undefined")
  250. window.addEventListener("hashchange", syncHash);
  251. });
  252. onBeforeUnmount(() => {
  253. if (typeof window !== "undefined")
  254. window.removeEventListener("hashchange", syncHash);
  255. });
  256. function resetForm() {
  257. Object.assign(form, {
  258. leaveType: "",
  259. certificateType: "",
  260. startDate: "2026-08-06",
  261. startTime: "08:30",
  262. endDate: "2026-08-06",
  263. endTime: "17:30",
  264. reason: "",
  265. attachments: [],
  266. repairType: "",
  267. repairTime: "",
  268. resignType: "",
  269. resignReason: "",
  270. expectedLeaveDate: "",
  271. handover: "",
  272. handoverNote: "",
  273. assetReturnList: [],
  274. compensation: "",
  275. needCertificate: true,
  276. });
  277. }
  278. function chooseLeave() {
  279. uni.showActionSheet({
  280. itemList: ["年假", "事假", "病假", "调休假", "婚假"],
  281. success: (r) =>
  282. (form.leaveType = ["年假", "事假", "病假", "调休假", "婚假"][r.tapIndex]),
  283. });
  284. }
  285. function chooseCertificate() {
  286. uni.showActionSheet({
  287. itemList: ["在职证明", "收入证明", "离职证明"],
  288. success: (r) =>
  289. (form.certificateType = ["在职证明", "收入证明", "离职证明"][r.tapIndex]),
  290. });
  291. }
  292. function chooseRepairType() {
  293. const itemList = REPAIR_TYPE_OPTIONS.map((k) => REPAIR_TYPE_LABEL[k]);
  294. uni.showActionSheet({
  295. itemList,
  296. success: (r) => (form.repairType = REPAIR_TYPE_OPTIONS[r.tapIndex]),
  297. });
  298. }
  299. const todayStr = new Date().toISOString().slice(0, 10);
  300. const assetReturnOptions = ['工牌', '门禁卡', '办公电脑', '测量仪器', '其他'];
  301. function toggleAssetReturn(opt) {
  302. const list = Array.isArray(form.assetReturnList) ? form.assetReturnList : [];
  303. const idx = list.indexOf(opt);
  304. if (idx >= 0) list.splice(idx, 1);
  305. else list.push(opt);
  306. form.assetReturnList = [...list];
  307. }
  308. function chooseResignType() {
  309. const items = ['主动离职', '协商离职', '辞退', '合同到期', '退休'];
  310. uni.showActionSheet({
  311. itemList: items,
  312. success: (r) => (form.resignType = items[r.tapIndex]),
  313. });
  314. }
  315. function chooseResignReason() {
  316. const items = ['个人发展', '家庭原因', '薪资待遇', '职业转型', '公司调整', '健康原因'];
  317. uni.showActionSheet({
  318. itemList: items,
  319. success: (r) => (form.resignReason = items[r.tapIndex]),
  320. });
  321. }
  322. function chooseCompensation() {
  323. const items = ['N+1', 'N', '协商一致', '不适用'];
  324. uni.showActionSheet({
  325. itemList: items,
  326. success: (r) => (form.compensation = items[r.tapIndex]),
  327. });
  328. }
  329. function chooseImage() {
  330. uni.chooseImage({
  331. count: 9,
  332. success: (r) => {
  333. const paths = (r.tempFilePaths || []).filter(Boolean);
  334. if (!paths.length) return;
  335. // 立即把每张图作为 uploading 项加入列表,触发并行上传,
  336. // 状态变化(success/failed)由 Promise 回调直接写回对应条目。
  337. const items = paths.map((p) => ({ localPath: p, status: "uploading" }));
  338. form.attachments = [...form.attachments, ...items];
  339. items.forEach((item) => {
  340. uploadAttachment(item.localPath, "hr_attendance")
  341. .then((file) => {
  342. item.status = "success";
  343. item.id = String(file?.id ?? "");
  344. })
  345. .catch((e) => {
  346. item.status = "failed";
  347. item.error = e?.message || "上传失败";
  348. uni.showToast({ title: item.error, icon: "none" });
  349. });
  350. });
  351. },
  352. });
  353. }
  354. function saveDraft() {
  355. persistDraft(type.value, form);
  356. uni.showToast({ title: "草稿已保存", icon: "success" });
  357. }
  358. function validate() {
  359. if (type.value === "leave" && !form.leaveType) return "请选择请假类型";
  360. if (type.value === "certificate" && !form.certificateType)
  361. return "请选择证明类型";
  362. if (type.value === "check") {
  363. if (!form.startDate) return "请选择补卡日期";
  364. if (!form.repairType) return "请选择补卡类型";
  365. if (!form.repairTime) return "请选择打卡时间";
  366. if (!form.reason) return "请填写补卡原因";
  367. }
  368. if (type.value === "resign") {
  369. if (!form.resignType) return "请选择离职类型";
  370. if (!form.resignReason) return "请选择离职原因";
  371. if (!form.expectedLeaveDate) return "请选择预计离职日期";
  372. if (form.expectedLeaveDate < todayStr) return "预计离职日期不能早于今天";
  373. if (!form.reason) return "请填写申请事由";
  374. return "";
  375. }
  376. if (!["certificate", "check", "resign"].includes(type.value)) {
  377. if (!form.startDate) return "请选择开始日期";
  378. if (!form.endDate) return "请选择结束日期";
  379. if (!form.startTime) return "请选择开始时间";
  380. if (!form.endTime) return "请选择结束时间";
  381. if (form.endDate < form.startDate) return "结束日期不能早于开始日期";
  382. if (form.endDate === form.startDate && form.endTime <= form.startTime)
  383. return "结束时间不能早于或等于开始时间";
  384. }
  385. if (!form.reason && type.value === "certificate") return "";
  386. if (!form.reason && !["certificate", "check", "resign"].includes(type.value))
  387. return "请填写申请事由";
  388. return "";
  389. }
  390. async function submit() {
  391. const error = validate();
  392. if (error) return uni.showToast({ title: error, icon: "none" });
  393. // 服务器模式 + 考勤类申请(请假 / 加班 / 出差 / 外出 / 补卡 / 调班)
  394. // → POST /hr/attendance/applications(附件已在 chooseImage 时上传完成)
  395. if (
  396. ATTENDANCE_APPLY_TYPE_MAP[type.value] &&
  397. getServerConfig().mode === "server"
  398. ) {
  399. try {
  400. // 等待所有进行中的上传完成(chooseImage 触发的后台任务)
  401. const pending = form.attachments.filter(
  402. (a) => a && a.status === "uploading",
  403. );
  404. if (pending.length) {
  405. uni.showLoading({ title: `附件上传中(${pending.length})` });
  406. await Promise.all(
  407. pending.map((item) =>
  408. uploadAttachment(item.localPath, "hr_attendance")
  409. .then((file) => {
  410. item.status = "success";
  411. item.id = String(file?.id ?? "");
  412. })
  413. .catch((e) => {
  414. item.status = "failed";
  415. item.error = e?.message || "上传失败";
  416. throw e;
  417. }),
  418. ),
  419. );
  420. uni.hideLoading();
  421. }
  422. // 有失败的附件就拦截提交
  423. const failed = form.attachments.filter((a) => a && a.status === "failed");
  424. if (failed.length) {
  425. return uni.showToast({
  426. title: `有 ${failed.length} 张附件上传失败,请重新选择`,
  427. icon: "none",
  428. });
  429. }
  430. const attachmentFileIds = form.attachments
  431. .filter((a) => a && a.status === "success" && a.id)
  432. .map((a) => a.id)
  433. .join(",");
  434. uni.showLoading({ title: "提交中..." });
  435. const payload = buildAttendancePayload(
  436. form,
  437. type.value,
  438. currentUser,
  439. attachmentFileIds,
  440. );
  441. if (!payload) {
  442. uni.hideLoading();
  443. return uni.showToast({
  444. title: "申请类型不支持",
  445. icon: "none",
  446. });
  447. }
  448. await submitAttendanceApplication(payload);
  449. uni.hideLoading();
  450. } catch (e) {
  451. uni.hideLoading();
  452. return uni.showToast({
  453. title: e.message || "申请提交失败",
  454. icon: "none",
  455. });
  456. }
  457. }
  458. // 服务器模式 + 离职申请
  459. // → POST /hr/ess/mobile/applications/resignation
  460. // → 部门和申请人由服务端当前任职确定,前端只送表单字段
  461. // → 响应 data 是后端新建单据主键,作为本地申请 id 保持两端一致
  462. let serverApplicationId = null;
  463. if (type.value === "resign") {
  464. try {
  465. uni.showLoading({ title: "提交中..." });
  466. const payload = buildResignationPayload(form);
  467. if (!payload) throw new Error("申请参数为空");
  468. serverApplicationId =
  469. getServerConfig().mode === "server"
  470. ? await submitResignationApplication(payload)
  471. : null;
  472. // 登记离职单:服务器模式记住服务端主键,演示模式落一条本地离职单,
  473. // 使「人事管理 → 离职管理」能直接看到这条申请并继续交接 / 归档
  474. registerSubmittedResignation({ serverId: serverApplicationId, form });
  475. uni.hideLoading();
  476. } catch (e) {
  477. uni.hideLoading();
  478. return uni.showToast({
  479. title: e.message || "离职申请提交失败",
  480. icon: "none",
  481. });
  482. }
  483. }
  484. addApplication({
  485. ...(serverApplicationId ? { id: serverApplicationId } : {}),
  486. type: config.value.title,
  487. summary: summary(),
  488. reason: form.reason || "用于个人材料办理",
  489. color: config.value.color,
  490. metadata: type.value === "resign" ? {
  491. employeeId: currentUser.id,
  492. resignType: form.resignType,
  493. resignReason: form.resignReason,
  494. expectedLeaveDate: form.expectedLeaveDate,
  495. handover: form.handover,
  496. handoverNote: form.handoverNote,
  497. assetReturnList: form.assetReturnList,
  498. compensation: form.compensation,
  499. needCertificate: form.needCertificate,
  500. source: serverApplicationId ? "server" : "demo",
  501. serverId: serverApplicationId || undefined,
  502. } : undefined,
  503. });
  504. removeDraft(type.value);
  505. // 补卡:返回上一页(考勤页),由 onShow 重新拉月度 + 当日详情
  506. if (type.value === "check") {
  507. const pages = getCurrentPages();
  508. if (pages.length > 1) {
  509. uni.showToast({ title: "补卡申请已提交", icon: "success" });
  510. setTimeout(() => uni.navigateBack({ delta: 1 }), 600);
  511. return;
  512. }
  513. }
  514. uni.showModal({
  515. title: "提交成功",
  516. content: "申请已提交给宋慧敏审批,可在“我的申请”中查看进度。",
  517. showCancel: false,
  518. success: () => uni.redirectTo({ url: "/pages/apply/list" }),
  519. });
  520. }
  521. function summary() {
  522. if (type.value === "certificate") return form.certificateType || "在职证明";
  523. if (type.value === "check") {
  524. const date = form.startDate || "";
  525. const typeLabel = form.repairType ? REPAIR_TYPE_LABEL[form.repairType] : "补卡";
  526. return `${date} · ${typeLabel} · ${form.repairTime || ""}`;
  527. }
  528. if (type.value === "resign") {
  529. return `${form.resignType} · ${form.expectedLeaveDate}${form.handover ? " · 交接 " + form.handover : ""}`;
  530. }
  531. return `${form.startDate} 至 ${form.endDate}`;
  532. }
  533. </script>
  534. <style scoped lang="scss">
  535. .page-no-tab {
  536. padding-bottom: 140rpx;
  537. }
  538. .form-intro {
  539. padding: 30rpx 30rpx 22rpx;
  540. display: flex;
  541. align-items: center;
  542. background: #fff;
  543. }
  544. .form-intro>view:last-child {
  545. margin-left: 22rpx;
  546. }
  547. .intro-title {
  548. display: block;
  549. font-size: 32rpx;
  550. font-weight: 600;
  551. }
  552. .intro-sub {
  553. display: block;
  554. margin-top: 9rpx;
  555. color: #8b939f;
  556. font-size: 23rpx;
  557. }
  558. .steps {
  559. height: 128rpx;
  560. padding: 18rpx 70rpx 12rpx;
  561. display: flex;
  562. align-items: flex-start;
  563. background: #fff;
  564. border-top: 1rpx solid #f2f3f5;
  565. }
  566. .step {
  567. width: 92rpx;
  568. text-align: center;
  569. color: #a0a7b0;
  570. font-size: 20rpx;
  571. }
  572. .step>view {
  573. width: 42rpx;
  574. height: 42rpx;
  575. margin: 0 auto 8rpx;
  576. border-radius: 50%;
  577. background: #e8eaed;
  578. color: #8b939f;
  579. line-height: 42rpx;
  580. }
  581. .step.active {
  582. color: #1677ff;
  583. }
  584. .step.active>view {
  585. background: #1677ff;
  586. color: #fff;
  587. }
  588. .step-line {
  589. flex: 1;
  590. height: 2rpx;
  591. margin-top: 20rpx;
  592. background: #e1e4e8;
  593. }
  594. .form-card {
  595. overflow: hidden;
  596. }
  597. .field {
  598. position: relative;
  599. min-height: 108rpx;
  600. padding: 28rpx 28rpx;
  601. display: flex;
  602. align-items: center;
  603. }
  604. .label {
  605. width: 180rpx;
  606. flex-shrink: 0;
  607. font-size: 28rpx;
  608. }
  609. .required::before {
  610. content: "*";
  611. color: #ee4d4d;
  612. margin-right: 6rpx;
  613. }
  614. .readonly,
  615. .approver {
  616. flex: 1;
  617. display: flex;
  618. align-items: center;
  619. justify-content: flex-end;
  620. font-size: 26rpx;
  621. }
  622. .small-avatar,
  623. .approve-avatar {
  624. width: 52rpx;
  625. height: 52rpx;
  626. margin-right: 14rpx;
  627. font-size: 22rpx;
  628. }
  629. .value {
  630. color: #1f2329;
  631. font-size: 27rpx;
  632. }
  633. .placeholder {
  634. color: #b2b7be;
  635. }
  636. .arrow {
  637. margin-left: 13rpx;
  638. color: #c4c8ce;
  639. font-size: 38rpx;
  640. }
  641. .textarea-field {
  642. display: block;
  643. min-height: 260rpx;
  644. }
  645. .textarea-field .label {
  646. display: block;
  647. width: auto;
  648. margin-bottom: 20rpx;
  649. }
  650. .textarea-field textarea {
  651. width: 100%;
  652. height: 130rpx;
  653. padding: 18rpx;
  654. border-radius: 12rpx;
  655. background: #f6f7f8;
  656. font-size: 27rpx;
  657. }
  658. .counter {
  659. position: absolute;
  660. right: 45rpx;
  661. bottom: 38rpx;
  662. color: #b2b7be;
  663. font-size: 21rpx;
  664. }
  665. .upload {
  666. width: 160rpx;
  667. height: 132rpx;
  668. border: 1rpx dashed #cfd4da;
  669. border-radius: 12rpx;
  670. display: flex;
  671. flex-direction: column;
  672. align-items: center;
  673. justify-content: center;
  674. color: #8b939f;
  675. font-size: 21rpx;
  676. }
  677. .plus {
  678. font-size: 40rpx;
  679. color: #9aa1aa;
  680. }
  681. .file-name {
  682. margin-left: 18rpx;
  683. color: #07a44d;
  684. font-size: 22rpx;
  685. }
  686. .approver-auto .auto {
  687. background: #eef3ff;
  688. color: #6b7c93;
  689. border: 1rpx dashed #b8c4d6;
  690. }
  691. .approver-auto {
  692. color: #8b939f;
  693. }
  694. .bottom-action {
  695. position: fixed;
  696. z-index: 10;
  697. left: 0;
  698. right: 0;
  699. bottom: 0;
  700. height: 120rpx;
  701. padding: 16rpx 24rpx;
  702. display: flex;
  703. gap: 18rpx;
  704. background: #fff;
  705. border-top: 1rpx solid #e8e9eb;
  706. }
  707. .draft-btn,
  708. .submit-btn {
  709. height: 84rpx;
  710. border-radius: 12rpx;
  711. display: flex;
  712. align-items: center;
  713. justify-content: center;
  714. font-size: 30rpx;
  715. }
  716. .draft-btn {
  717. width: 210rpx;
  718. border: 1rpx solid #d7dce2;
  719. color: #4b5563;
  720. }
  721. .submit-btn {
  722. flex: 1;
  723. background: #1677ff;
  724. color: #fff;
  725. }
  726. @media (min-width: 800px) {
  727. .bottom-action {
  728. max-width: 520px;
  729. left: 50%;
  730. transform: translateX(-50%);
  731. }
  732. }
  733. .input-flex {
  734. flex: 1;
  735. text-align: right;
  736. font-size: 27rpx;
  737. color: #1f2329;
  738. padding: 0 6rpx;
  739. }
  740. .small-textarea {
  741. min-height: 180rpx;
  742. }
  743. .small-textarea textarea {
  744. height: 100rpx;
  745. }
  746. .check-field {
  747. display: block;
  748. align-items: flex-start;
  749. }
  750. .check-field .label {
  751. display: block;
  752. width: auto;
  753. margin-bottom: 16rpx;
  754. }
  755. .check-list {
  756. display: flex;
  757. flex-wrap: wrap;
  758. gap: 18rpx 24rpx;
  759. padding-top: 4rpx;
  760. }
  761. .check-row {
  762. display: flex;
  763. align-items: center;
  764. gap: 10rpx;
  765. font-size: 26rpx;
  766. color: #4b5563;
  767. }
  768. .checkbox {
  769. width: 32rpx;
  770. height: 32rpx;
  771. border: 1rpx solid #c4c8ce;
  772. border-radius: 6rpx;
  773. display: flex;
  774. align-items: center;
  775. justify-content: center;
  776. font-size: 22rpx;
  777. color: #fff;
  778. background: #fff;
  779. box-sizing: border-box;
  780. }
  781. .checkbox.is-checked {
  782. background: #1677ff;
  783. border-color: #1677ff;
  784. }
  785. .switch-field {
  786. justify-content: space-between;
  787. }
  788. </style>