foodBusinessLicense.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. <template>
  2. <div class="card content-box">
  3. <div class="content-section">
  4. <div class="tip-text">
  5. 如需变更请在此处上传,重新上传之后需要重新进行审核,审核通过后,新的食品经营许可证将会覆盖之前的食品经营许可证
  6. </div>
  7. <div class="action-buttons">
  8. <el-button type="primary" @click="handleReplace"> 更换 </el-button>
  9. <el-button type="primary" @click="handleViewChangeRecord"> 查看变更记录 </el-button>
  10. </div>
  11. </div>
  12. <div class="license-container" v-if="licenseImage">
  13. <div class="license-display">
  14. <el-image :src="licenseImage" fit="contain" class="license-image" :preview-src-list="[licenseImage]" />
  15. </div>
  16. </div>
  17. <div v-else class="empty-license">
  18. <el-empty description="暂无食品经营许可证" :image-size="100" />
  19. </div>
  20. <!-- 更换食品经营许可证弹窗 -->
  21. <el-dialog
  22. v-model="replaceDialogVisible"
  23. title="更换食品经营许可证"
  24. width="600px"
  25. :before-close="handleReplaceDialogClose"
  26. :close-on-click-modal="false"
  27. :close-on-press-escape="false"
  28. >
  29. <div class="replace-upload-area" :class="{ 'upload-full': uploadedImageCount >= 1 }">
  30. <el-upload
  31. v-model:file-list="fileList"
  32. list-type="picture-card"
  33. :accept="'.jpg,.png'"
  34. :limit="1"
  35. :auto-upload="false"
  36. :disabled="hasUnuploadedImages"
  37. :on-change="handleUploadChange"
  38. :on-exceed="handleUploadExceed"
  39. :on-preview="handlePictureCardPreview"
  40. :before-remove="handleBeforeRemove"
  41. :on-remove="handleRemove"
  42. :show-file-list="true"
  43. >
  44. <template #trigger>
  45. <div v-if="uploadedImageCount < 1" class="upload-trigger-card el-upload--picture-card">
  46. <el-icon>
  47. <Plus />
  48. </el-icon>
  49. <div class="upload-tip">({{ uploadedImageCount }}/1)</div>
  50. </div>
  51. </template>
  52. </el-upload>
  53. </div>
  54. <template #footer>
  55. <div class="dialog-footer">
  56. <el-button @click="handleCancelReplace" :disabled="hasUnuploadedImages"> 取消 </el-button>
  57. <el-button type="primary" @click="handleSubmitReplace" :disabled="hasUnuploadedImages"> 去审核 </el-button>
  58. </div>
  59. </template>
  60. </el-dialog>
  61. <!-- 图片预览 -->
  62. <el-image-viewer
  63. v-if="imageViewerVisible"
  64. :url-list="imageViewerUrlList"
  65. :initial-index="imageViewerInitialIndex"
  66. @close="imageViewerVisible = false"
  67. />
  68. <!-- 变更记录弹窗 -->
  69. <el-dialog v-model="changeRecordDialogVisible" title="变更记录" width="900px" :close-on-click-modal="false">
  70. <el-scrollbar height="400px" class="change-record-scrollbar">
  71. <div v-if="changeRecordList && changeRecordList.length > 0" class="change-record-content">
  72. <div v-for="(item, index) in changeRecordList" :key="index" class="record-group">
  73. <div class="record-date">
  74. {{ item.createdDateFormat }}
  75. </div>
  76. <div class="record-items">
  77. <div class="record-item">
  78. <div class="record-status-badge" :class="getStatusClass(item.licenseExecuteStatus)">
  79. {{ item.licenseExecuteName }}
  80. </div>
  81. <el-image
  82. :src="item.imgUrl"
  83. fit="cover"
  84. class="record-image"
  85. :preview-src-list="changeRecordList.map(record => record.imgUrl)"
  86. :initial-index="index"
  87. >
  88. <template #error>
  89. <div class="image-slot">
  90. <el-icon><Picture /></el-icon>
  91. </div>
  92. </template>
  93. </el-image>
  94. </div>
  95. </div>
  96. <div v-if="item.reasonRefusal" class="rejection-reason">拒绝原因: {{ item.reasonRefusal }}</div>
  97. </div>
  98. </div>
  99. <div v-else class="empty-record">
  100. <el-empty description="暂无变更记录" :image-size="100" />
  101. </div>
  102. </el-scrollbar>
  103. <template #footer>
  104. <div class="dialog-footer">
  105. <el-button type="primary" @click="changeRecordDialogVisible = false"> 关闭 </el-button>
  106. </div>
  107. </template>
  108. </el-dialog>
  109. </div>
  110. </template>
  111. <script setup lang="ts" name="foodBusinessLicense">
  112. import { ref, computed, onMounted } from "vue";
  113. import { ElMessage, ElMessageBox } from "element-plus";
  114. import { Picture, Plus } from "@element-plus/icons-vue";
  115. import type { UploadProps, UploadFile } from "element-plus";
  116. import {
  117. getFoodBusinessLicense,
  118. uploadContractImage,
  119. submitFoodLicenseReview,
  120. getChangeRecords,
  121. getStoreFoodLicenceStatus
  122. } from "@/api/modules/licenseManagement";
  123. import { localGet } from "@/utils";
  124. // 状态映射对象
  125. const statusMap: Record<number, { name: string; class: string }> = {
  126. 1: { name: "审核通过", class: "status-success" },
  127. 2: { name: "审核中", class: "status-pending" },
  128. 3: { name: "审核拒绝", class: "status-failed" }
  129. };
  130. const id = localGet("createdId");
  131. const licenseImage = ref<string>("");
  132. const replaceDialogVisible = ref(false);
  133. const changeRecordDialogVisible = ref(false);
  134. const fileList = ref<UploadFile[]>([]);
  135. const changeRecordList = ref<any>([]);
  136. // ==================== 图片上传相关变量 ====================
  137. const uploading = ref(false);
  138. const pendingUploadFiles = ref<UploadFile[]>([]);
  139. const imageUrlList = ref<string[]>([]); // 存储图片URL列表
  140. // 图片预览相关
  141. const imageViewerVisible = ref(false);
  142. const imageViewerUrlList = ref<string[]>([]);
  143. const imageViewerInitialIndex = ref(0);
  144. // 计算属性:获取已成功上传的图片数量
  145. const uploadedImageCount = computed(() => {
  146. return fileList.value.filter((file: any) => file.status === "success" && file.url).length;
  147. });
  148. // 计算属性:检查是否有未上传完成的图片
  149. const hasUnuploadedImages = computed(() => {
  150. // 检查是否有正在上传的文件
  151. if (uploading.value || pendingUploadFiles.value.length > 0) {
  152. return true;
  153. }
  154. // 检查文件列表中是否有状态为 "ready"(待上传)或 "uploading"(上传中)的图片
  155. if (fileList.value && fileList.value.length > 0) {
  156. return fileList.value.some((file: any) => {
  157. return file.status === "ready" || file.status === "uploading";
  158. });
  159. }
  160. return false;
  161. });
  162. onMounted(async () => {
  163. await initData();
  164. });
  165. const initData = async () => {
  166. const params = {
  167. id: id
  168. };
  169. const res: any = await getFoodBusinessLicense(params);
  170. if (res.code === 200) {
  171. licenseImage.value = res.data[0].imgUrl;
  172. }
  173. };
  174. const handleReplace = async () => {
  175. fileList.value = [];
  176. imageUrlList.value = [];
  177. pendingUploadFiles.value = [];
  178. uploading.value = false;
  179. const params = {
  180. id: localGet("createdId")
  181. };
  182. const res: any = await getStoreFoodLicenceStatus(params);
  183. if (res.data.foodLicenceStatus === 2) {
  184. ElMessage.warning("食品经营许可证审核中,请耐心等待");
  185. } else {
  186. replaceDialogVisible.value = true;
  187. }
  188. };
  189. const handleViewChangeRecord = async () => {
  190. try {
  191. const params = {
  192. storeId: localGet("createdId")
  193. };
  194. const res: any = await getChangeRecords(params);
  195. if (res.code === 200) {
  196. changeRecordList.value = res.data;
  197. } else {
  198. // 请求失败时清空数据
  199. changeRecordList.value = [];
  200. }
  201. changeRecordDialogVisible.value = true;
  202. } catch (error) {
  203. ElMessage.error("获取变更记录失败");
  204. // 发生错误时清空数据并显示空状态
  205. changeRecordList.value = [];
  206. changeRecordDialogVisible.value = true;
  207. }
  208. };
  209. /**
  210. * 检查文件是否在排队中(未上传)
  211. * @param file 文件对象
  212. * @returns 是否在排队中
  213. */
  214. const isFilePending = (file: any): boolean => {
  215. // 只检查 ready 状态(排队中),不包括 uploading(正在上传)
  216. if (file.status === "ready") {
  217. return true;
  218. }
  219. // 检查是否在待上传队列中
  220. if (pendingUploadFiles.value.some(item => item.uid === file.uid)) {
  221. return true;
  222. }
  223. return false;
  224. };
  225. /**
  226. * 图片上传 - 删除前确认
  227. * @param uploadFile 要删除的文件对象
  228. * @param uploadFiles 当前文件列表
  229. * @returns Promise<boolean>,true 允许删除,false 阻止删除
  230. */
  231. const handleBeforeRemove = async (uploadFile: any, uploadFiles: any[]): Promise<boolean> => {
  232. // 如果文件在排队中(未上传),禁止删除
  233. if (isFilePending(uploadFile)) {
  234. ElMessage.warning("图片尚未上传,请等待上传完成后再删除");
  235. return false;
  236. }
  237. try {
  238. await ElMessageBox.confirm("确定要删除这张图片吗?", "提示", {
  239. confirmButtonText: "确定",
  240. cancelButtonText: "取消",
  241. type: "warning"
  242. });
  243. // 用户确认删除,返回 true 允许删除
  244. return true;
  245. } catch {
  246. // 用户取消删除,返回 false 阻止删除
  247. return false;
  248. }
  249. };
  250. /**
  251. * 图片上传 - 移除图片回调(删除成功后调用)
  252. * @param uploadFile 已删除的文件对象
  253. * @param uploadFiles 删除后的文件列表
  254. */
  255. const handleRemove: UploadProps["onRemove"] = (uploadFile, uploadFiles) => {
  256. // 从被删除的文件对象中获取 url
  257. const file = uploadFile as any;
  258. const imageUrl = file.url;
  259. if (imageUrl) {
  260. // 从 imageUrl 数组中删除对应的 URL
  261. const urlIndex = imageUrlList.value.indexOf(imageUrl);
  262. if (urlIndex > -1) {
  263. imageUrlList.value.splice(urlIndex, 1);
  264. }
  265. }
  266. if (file.url && file.url.startsWith("blob:")) {
  267. URL.revokeObjectURL(file.url);
  268. }
  269. // 同步文件列表
  270. fileList.value = [...uploadFiles];
  271. // 删除成功后提示
  272. ElMessage.success("图片已删除");
  273. };
  274. /**
  275. * 上传文件超出限制提示
  276. */
  277. const handleUploadExceed: UploadProps["onExceed"] = () => {
  278. ElMessage.warning("最多只能上传1张图片");
  279. };
  280. /**
  281. * el-upload 文件变更(选中或移除)
  282. */
  283. const handleUploadChange: UploadProps["onChange"] = async (uploadFile, uploadFiles) => {
  284. // 检查文件类型,只允许 jpg 和 png
  285. if (uploadFile.raw) {
  286. const fileType = uploadFile.raw.type.toLowerCase();
  287. const fileName = uploadFile.name.toLowerCase();
  288. const validTypes = ["image/jpeg", "image/jpg", "image/png"];
  289. const validExtensions = [".jpg", ".jpeg", ".png"];
  290. // 检查 MIME 类型或文件扩展名
  291. const isValidType = validTypes.includes(fileType) || validExtensions.some(ext => fileName.endsWith(ext));
  292. if (!isValidType) {
  293. // 从文件列表中移除不符合类型的文件
  294. const index = fileList.value.findIndex((f: any) => f.uid === uploadFile.uid);
  295. if (index > -1) {
  296. fileList.value.splice(index, 1);
  297. }
  298. // 从 uploadFiles 中移除
  299. const uploadIndex = uploadFiles.findIndex((f: any) => f.uid === uploadFile.uid);
  300. if (uploadIndex > -1) {
  301. uploadFiles.splice(uploadIndex, 1);
  302. }
  303. // 如果文件有 blob URL,释放它
  304. if (uploadFile.url && uploadFile.url.startsWith("blob:")) {
  305. URL.revokeObjectURL(uploadFile.url);
  306. }
  307. ElMessage.warning("只支持上传 JPG 和 PNG 格式的图片");
  308. return;
  309. }
  310. }
  311. // 同步文件列表到表单数据(只添加通过验证的文件)
  312. const existingIndex = fileList.value.findIndex((f: any) => f.uid === uploadFile.uid);
  313. if (existingIndex === -1) {
  314. fileList.value.push(uploadFile);
  315. }
  316. const readyFiles = fileList.value.filter(file => file.status === "ready");
  317. if (readyFiles.length) {
  318. readyFiles.forEach(file => {
  319. if (!pendingUploadFiles.value.some(item => item.uid === file.uid)) {
  320. pendingUploadFiles.value.push(file);
  321. }
  322. });
  323. }
  324. processUploadQueue();
  325. };
  326. /**
  327. * 处理上传队列 - 逐个上传文件
  328. */
  329. const processUploadQueue = async () => {
  330. if (uploading.value || pendingUploadFiles.value.length === 0) {
  331. return;
  332. }
  333. // 每次只取一个文件进行上传
  334. const file = pendingUploadFiles.value.shift();
  335. if (file) {
  336. await uploadSingleFile(file);
  337. // 继续处理队列中的下一个文件
  338. processUploadQueue();
  339. }
  340. };
  341. /**
  342. * 单文件上传图片
  343. * @param file 待上传的文件
  344. */
  345. const uploadSingleFile = async (file: UploadFile) => {
  346. if (!file.raw) {
  347. return;
  348. }
  349. const rawFile = file.raw as File;
  350. const formData = new FormData();
  351. formData.append("file", rawFile);
  352. formData.append("user", "text");
  353. file.status = "uploading";
  354. file.percentage = 0;
  355. uploading.value = true;
  356. try {
  357. // 上传过程中保持进度为 0,避免接口异常时进度条误显示 100%
  358. const result: any = await uploadContractImage(formData);
  359. if (result?.code === 200 && result.data) {
  360. // 处理单个文件的上传结果
  361. let imageUrl = result.data[0];
  362. if (!imageUrl) {
  363. throw new Error("上传成功但未获取到图片URL");
  364. }
  365. file.status = "success";
  366. file.percentage = 100;
  367. // 保存图片URL到文件对象
  368. file.url = imageUrl;
  369. file.response = { url: imageUrl };
  370. // 保存图片URL
  371. if (!Array.isArray(imageUrlList.value)) {
  372. imageUrlList.value = [];
  373. }
  374. if (!imageUrlList.value.includes(imageUrl)) {
  375. imageUrlList.value.push(imageUrl);
  376. }
  377. } else {
  378. throw new Error(result?.msg || "图片上传失败");
  379. }
  380. } catch (error: any) {
  381. file.status = "fail";
  382. // 上传失败时保持进度条为 0
  383. file.percentage = 0;
  384. if (file.url && file.url.startsWith("blob:")) {
  385. URL.revokeObjectURL(file.url);
  386. }
  387. // 从文件列表中移除失败的文件
  388. const index = fileList.value.findIndex((f: any) => f.uid === file.uid);
  389. if (index > -1) {
  390. fileList.value.splice(index, 1);
  391. }
  392. // Error message handled by global upload method, except for specific business logic errors
  393. if (error?.message && error.message.includes("未获取到图片URL")) {
  394. ElMessage.error(error.message);
  395. }
  396. } finally {
  397. uploading.value = false;
  398. // 触发视图更新
  399. fileList.value = [...fileList.value];
  400. }
  401. };
  402. /**
  403. * 图片预览 - 使用 el-image-viewer 预览功能
  404. * @param file 上传文件对象
  405. */
  406. const handlePictureCardPreview = (file: any) => {
  407. // 如果文件在排队中(未上传),禁止预览
  408. if (isFilePending(file)) {
  409. ElMessage.warning("图片尚未上传,请等待上传完成后再预览");
  410. return;
  411. }
  412. // 如果文件正在上传中,允许预览(使用本地预览)
  413. if (file.status === "uploading" && file.url) {
  414. imageViewerUrlList.value = [file.url];
  415. imageViewerInitialIndex.value = 0;
  416. imageViewerVisible.value = true;
  417. return;
  418. }
  419. // 获取所有图片的 URL 列表(只包含已上传成功的图片)
  420. const urlList = fileList.value
  421. .filter((item: any) => item.status === "success" && (item.url || item.response?.data))
  422. .map((item: any) => item.url || item.response?.data);
  423. // 找到当前点击的图片索引
  424. const currentIndex = urlList.findIndex((url: string) => url === (file.url || file.response?.data));
  425. if (currentIndex < 0) {
  426. ElMessage.warning("图片尚未上传完成,无法预览");
  427. return;
  428. }
  429. imageViewerUrlList.value = urlList;
  430. imageViewerInitialIndex.value = currentIndex;
  431. imageViewerVisible.value = true;
  432. };
  433. const handleCancelReplace = async () => {
  434. // 如果有图片正在上传,阻止关闭
  435. if (hasUnuploadedImages.value) {
  436. ElMessage.warning("请等待图片上传完成后再关闭");
  437. return;
  438. }
  439. if (fileList.value.length > 0) {
  440. try {
  441. await ElMessageBox.confirm("确定要取消本次图片上传吗?已上传的图片将不保存", "提示", {
  442. confirmButtonText: "确定",
  443. cancelButtonText: "取消",
  444. type: "warning"
  445. });
  446. // 用户确认取消
  447. fileList.value = [];
  448. imageUrlList.value = [];
  449. pendingUploadFiles.value = [];
  450. uploading.value = false;
  451. replaceDialogVisible.value = false;
  452. } catch {
  453. // 用户取消操作,不做任何处理
  454. }
  455. } else {
  456. replaceDialogVisible.value = false;
  457. }
  458. };
  459. const handleReplaceDialogClose = async (done: () => void) => {
  460. // 如果有图片正在上传,阻止关闭
  461. if (hasUnuploadedImages.value) {
  462. ElMessage.warning("请等待图片上传完成后再关闭");
  463. return; // 不调用 done(),阻止关闭弹窗
  464. }
  465. if (fileList.value.length > 0) {
  466. try {
  467. await ElMessageBox.confirm("确定要取消本次图片上传吗?已上传的图片将不保存", "提示", {
  468. confirmButtonText: "确定",
  469. cancelButtonText: "取消",
  470. type: "warning"
  471. });
  472. // 用户确认取消,清空数据并关闭弹窗
  473. fileList.value = [];
  474. imageUrlList.value = [];
  475. pendingUploadFiles.value = [];
  476. uploading.value = false;
  477. done(); // 调用 done() 允许关闭弹窗
  478. } catch {
  479. // 用户取消操作,不调用 done(),阻止关闭弹窗
  480. }
  481. } else {
  482. // 没有文件,直接关闭
  483. done();
  484. }
  485. };
  486. const handleSubmitReplace = async () => {
  487. // 检查是否有未上传完成的图片
  488. if (hasUnuploadedImages.value) {
  489. ElMessage.warning("请等待图片上传完成后再提交");
  490. return;
  491. }
  492. if (fileList.value.length === 0) {
  493. ElMessage.warning("请先上传图片");
  494. return;
  495. }
  496. const uploadedFiles = fileList.value.filter(file => file.status === "success");
  497. if (uploadedFiles.length === 0) {
  498. ElMessage.warning("请先上传图片");
  499. return;
  500. }
  501. try {
  502. // 只提交单张图片,排序为0
  503. const imageDataWithSort = uploadedFiles.map((file, index) => ({
  504. imgUrl: file.url,
  505. imgSort: index,
  506. storeId: localGet("createdId")
  507. }));
  508. await submitFoodLicenseReview(imageDataWithSort[0]);
  509. ElMessage.success("提交审核成功");
  510. replaceDialogVisible.value = false;
  511. fileList.value = [];
  512. imageUrlList.value = [];
  513. pendingUploadFiles.value = [];
  514. uploading.value = false;
  515. await initData();
  516. } catch (error) {
  517. ElMessage.error("提交审核失败");
  518. }
  519. };
  520. const getStatusClass = (status: string) => {
  521. const statusInfo = statusMap[status];
  522. return statusInfo ? statusInfo.class : "";
  523. };
  524. const getStatusText = (status: string) => {
  525. const map: Record<string, string> = {
  526. pending: "审核中",
  527. success: "审核通过",
  528. failed: "审核拒绝"
  529. };
  530. return map[status] || "未知";
  531. };
  532. </script>
  533. <style lang="scss" scoped>
  534. .page-header {
  535. margin-bottom: 20px;
  536. }
  537. .store-title {
  538. margin: 0;
  539. font-size: 24px;
  540. font-weight: 600;
  541. color: var(--el-text-color-primary);
  542. }
  543. .content-section {
  544. display: flex;
  545. gap: 50px;
  546. align-items: center;
  547. justify-content: space-between;
  548. margin-top: 20px;
  549. margin-bottom: 50px;
  550. }
  551. .tip-text {
  552. font-size: 18px;
  553. color: var(--el-text-color-regular);
  554. }
  555. .action-buttons {
  556. display: flex;
  557. flex-shrink: 0;
  558. gap: 10px;
  559. }
  560. .license-container {
  561. padding: 20px;
  562. background-color: var(--el-bg-color-page);
  563. border-radius: 8px;
  564. }
  565. .license-display {
  566. display: flex;
  567. align-items: center;
  568. justify-content: center;
  569. width: 700px;
  570. height: 500px;
  571. }
  572. .license-image {
  573. width: 100%;
  574. height: 100%;
  575. border-radius: 8px;
  576. box-shadow: 0 2px 12px rgb(0 0 0 / 10%);
  577. }
  578. .empty-license {
  579. display: flex;
  580. align-items: center;
  581. justify-content: center;
  582. min-height: 570px;
  583. padding: 40px 20px;
  584. }
  585. .replace-upload-area {
  586. min-height: 300px;
  587. padding: 20px;
  588. :deep(.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label) {
  589. display: inline-flex !important;
  590. opacity: 1 !important;
  591. }
  592. :deep(.el-upload-list__item.is-success:focus .el-upload-list__item-status-label) {
  593. display: inline-flex !important;
  594. opacity: 1 !important;
  595. }
  596. :deep(.el-upload-list--picture-card .el-icon--close-tip) {
  597. display: none !important;
  598. }
  599. &.upload-full {
  600. :deep(.el-upload--picture-card) {
  601. display: none !important;
  602. }
  603. }
  604. }
  605. .dialog-footer {
  606. display: flex;
  607. gap: 10px;
  608. justify-content: center;
  609. }
  610. /* el-upload 图片预览铺满容器 */
  611. :deep(.el-upload-list--picture-card) {
  612. .el-upload-list__item {
  613. overflow: hidden;
  614. .el-upload-list__item-thumbnail {
  615. width: 100%;
  616. height: 100%;
  617. object-fit: fill;
  618. }
  619. }
  620. /* 排队中(未上传)的图片禁用样式 */
  621. .el-upload-list__item[data-status="ready"],
  622. .el-upload-list__item.is-ready {
  623. position: relative;
  624. pointer-events: none;
  625. cursor: not-allowed;
  626. opacity: 0.6;
  627. &::after {
  628. position: absolute;
  629. inset: 0;
  630. z-index: 1;
  631. content: "";
  632. background-color: rgb(0 0 0 / 30%);
  633. }
  634. .el-upload-list__item-actions {
  635. pointer-events: none;
  636. opacity: 0.5;
  637. }
  638. }
  639. }
  640. .upload-trigger-card {
  641. display: flex;
  642. flex-direction: column;
  643. align-items: center;
  644. justify-content: center;
  645. width: 100%;
  646. height: 100%;
  647. font-size: 28px;
  648. color: #8c939d;
  649. .upload-tip {
  650. margin-top: 8px;
  651. font-size: 14px;
  652. color: #8c939d;
  653. }
  654. }
  655. .change-record-scrollbar {
  656. :deep(.el-scrollbar__wrap) {
  657. overflow-x: hidden;
  658. }
  659. }
  660. .change-record-content {
  661. .record-group {
  662. padding: 20px;
  663. margin-bottom: 30px;
  664. background-color: var(--el-fill-color-lighter);
  665. &:last-child {
  666. margin-bottom: 0;
  667. }
  668. .record-date {
  669. margin-bottom: 15px;
  670. font-size: 16px;
  671. font-weight: 500;
  672. color: var(--el-text-color-primary);
  673. }
  674. .record-items {
  675. display: flex;
  676. flex-wrap: wrap;
  677. gap: 15px;
  678. }
  679. .record-item {
  680. position: relative;
  681. width: 150px;
  682. height: 150px;
  683. overflow: hidden;
  684. border-radius: 8px;
  685. .record-status-badge {
  686. position: absolute;
  687. right: 0;
  688. bottom: 0;
  689. left: 0;
  690. z-index: 1;
  691. padding: 4px 8px;
  692. font-size: 12px;
  693. font-weight: 500;
  694. text-align: center;
  695. border-radius: 0 0 8px 8px;
  696. &.status-pending {
  697. color: #e6a23c;
  698. background-color: rgb(253 246 236 / 90%);
  699. border-top: 1px solid #e6a23c;
  700. }
  701. &.status-success {
  702. color: #67c23a;
  703. background-color: rgb(240 249 255 / 90%);
  704. border-top: 1px solid #67c23a;
  705. }
  706. &.status-failed {
  707. color: #f56c6c;
  708. background-color: rgb(254 240 240 / 90%);
  709. border-top: 1px solid #f56c6c;
  710. }
  711. }
  712. .record-image {
  713. width: 100%;
  714. height: 100%;
  715. .image-slot {
  716. display: flex;
  717. align-items: center;
  718. justify-content: center;
  719. width: 100%;
  720. height: 100%;
  721. font-size: 30px;
  722. color: var(--el-text-color-placeholder);
  723. background: var(--el-fill-color-light);
  724. }
  725. }
  726. }
  727. .rejection-reason {
  728. margin-top: 15px;
  729. font-size: 14px;
  730. font-weight: 500;
  731. color: var(--el-text-color-regular);
  732. border-radius: 8px;
  733. }
  734. }
  735. }
  736. .empty-record {
  737. display: flex;
  738. align-items: center;
  739. justify-content: center;
  740. min-height: 300px;
  741. padding: 40px 20px;
  742. }
  743. </style>