From a563ea879ef5fb6897e76d2df661e465dce2ab9b Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 01 六月 2026 15:02:27 +0800
Subject: [PATCH] Merge branch 'dev_新疆_大罗素马铃薯new' of http://114.132.189.42:9002/r/product-inventory-management into dev_新疆_大罗素马铃薯new
---
src/views/system/appVersion/index.vue | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 270 insertions(+), 0 deletions(-)
diff --git a/src/views/system/appVersion/index.vue b/src/views/system/appVersion/index.vue
new file mode 100644
index 0000000..6ff9ae6
--- /dev/null
+++ b/src/views/system/appVersion/index.vue
@@ -0,0 +1,270 @@
+<template>
+ <div class="app-container">
+ <el-row :gutter="10" class="mb8">
+ <el-col :span="1.5">
+ <el-button type="primary" plain icon="Upload" @click="openUploadDialog">涓婁紶APK</el-button>
+ </el-col>
+ </el-row>
+
+ <el-table v-loading="loading" :data="versionList">
+ <el-table-column label="ID" prop="id" align="center" width="80"/>
+ <el-table-column label="搴旂敤鍚嶇О" prop="name" align="center" min-width="150"/>
+ <el-table-column label="鐗堟湰鍙�" prop="version" align="center" width="120"/>
+ <el-table-column label="鍒涘缓鏃堕棿" prop="createTime" align="center" width="170">
+ <template #default="scope">
+ <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏇存柊鏃堕棿" prop="updateTime" align="center" width="170">
+ <template #default="scope">
+ <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d} {h}:{i}:{s}") }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鍒涘缓浜�" prop="createUser" align="center" width="100"/>
+ <el-table-column label="鎿嶄綔" align="center" width="180" class-name="small-padding fixed-width">
+ <template #default="scope">
+ <el-button link type="primary" @click="downloadAttachment(scope.row)">涓嬭浇</el-button>
+ <el-button link type="success" @click="openQrDialog(scope.row)">鎵爜涓嬭浇</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ v-model:page="queryParams.current"
+ v-model:limit="queryParams.size"
+ @pagination="getList"
+ />
+
+ <el-dialog title="涓婁紶APK" v-model="uploadOpen" width="560px" append-to-body @close="resetUploadForm">
+ <el-form ref="uploadRef" :model="uploadForm" :rules="uploadRules" label-width="90px">
+ <el-form-item label="搴旂敤鍚嶇О" prop="name">
+ <el-input v-model="uploadForm.name" placeholder="璇疯緭鍏ュ簲鐢ㄥ悕绉�"/>
+ </el-form-item>
+ <el-form-item label="鐗堟湰鍙�" prop="version">
+ <el-input v-model="uploadForm.version" placeholder="璇疯緭鍏ョ増鏈彿"/>
+ </el-form-item>
+ <el-form-item label="APK鏂囦欢" prop="storageBlobDTOList">
+ <FileUpload v-model:file-list="uploadForm.storageBlobDTOList" :limit="1" :file-type="['apk']"
+ :file-size="200"/>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" :loading="uploading" @click="submitUpload">纭� 瀹�</el-button>
+ <el-button @click="uploadOpen = false">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+
+ <el-dialog
+ v-model="qrOpen"
+ title="鎵爜涓嬭浇"
+ width="460px"
+ append-to-body
+ class="download-qr-dialog"
+ >
+ <div class="download-qr-content">
+ <div class="app-meta-card">
+ <div class="meta-row">
+ <span class="meta-label">搴旂敤鍚嶇О</span>
+ <span class="meta-value">{{ qrCurrentRow?.name || "-" }}</span>
+ </div>
+ <div class="meta-row">
+ <span class="meta-label">鐗堟湰缂栧彿</span>
+ <span class="meta-value">{{ qrCurrentRow?.version || "-" }}</span>
+ </div>
+ </div>
+ <div class="qr-box">
+ <img v-if="qrCodeUrl" :src="qrCodeUrl" alt="download qr code" class="qr-image" />
+ <div class="qr-tip">璇蜂娇鐢ㄦ墜鏈烘壂鐮佷笅杞藉簲鐢�</div>
+ </div>
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="qrOpen = false">鍏� 闂�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup name="SystemAppVersion">
+import {listAppVersion, add} from "@/api/system/appVersion";
+import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+import QRCode from "qrcode";
+
+const {proxy} = getCurrentInstance();
+
+const loading = ref(false);
+const versionList = ref([]);
+const total = ref(0);
+
+const queryParams = reactive({
+ current: 1,
+ size: 10,
+});
+
+const uploadOpen = ref(false);
+const uploading = ref(false);
+const qrOpen = ref(false);
+const qrCodeUrl = ref("");
+const qrCurrentRow = ref(null);
+const uploadForm = reactive({
+ name: "",
+ version: "",
+ storageBlobDTOList: null,
+});
+
+const uploadRules = {
+ name: [{required: true, message: "璇疯緭鍏ュ簲鐢ㄥ悕绉�", trigger: "blur"}],
+ version: [{required: true, message: "璇疯緭鍏ョ増鏈彿", trigger: "blur"}],
+ storageBlobDTOList: [{required: true, message: "璇蜂笂浼燗PK鏂囦欢", trigger: "change"}],
+};
+
+function normalizeListResp(res) {
+ const data = res?.data || {};
+ const records = data.records || res?.rows || [];
+ const totalNum = Number(data.total ?? res?.total ?? 0);
+ return {
+ records: Array.isArray(records) ? records : [],
+ total: Number.isNaN(totalNum) ? 0 : totalNum,
+ };
+}
+
+function getList() {
+ loading.value = true;
+ listAppVersion(queryParams)
+ .then(res => {
+ const result = normalizeListResp(res);
+ versionList.value = result.records;
+ total.value = result.total;
+ })
+ .finally(() => {
+ loading.value = false;
+ });
+}
+
+function openUploadDialog() {
+ resetUploadForm();
+ uploadOpen.value = true;
+}
+
+function resetUploadForm() {
+ uploadForm.name = "";
+ uploadForm.version = "";
+ uploadForm.storageBlobDTOList = null;
+ proxy.resetForm("uploadRef");
+}
+
+
+function downloadAttachment(row) {
+ window.open(row.downloadURL, "_blank");
+}
+
+async function openQrDialog(row) {
+ if (!row?.downloadURL) {
+ proxy.$modal.msgError("褰撳墠璁板綍缂哄皯涓嬭浇鍦板潃锛屾棤娉曠敓鎴愪簩缁寸爜");
+ return;
+ }
+ try {
+ qrCodeUrl.value = await QRCode.toDataURL(row.downloadURL, {
+ width: 220,
+ margin: 2,
+ errorCorrectionLevel: "M",
+ color: {
+ dark: "#1f2937",
+ light: "#ffffff",
+ },
+ });
+ qrCurrentRow.value = row;
+ qrOpen.value = true;
+ } catch (error) {
+ proxy.$modal.msgError("浜岀淮鐮佺敓鎴愬け璐ワ紝璇风◢鍚庨噸璇�");
+ }
+}
+
+function submitUpload() {
+ proxy.$refs.uploadRef.validate(valid => {
+ if (!valid) return;
+ uploading.value = true;
+ add(uploadForm)
+ .then(() => {
+ proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+ uploadOpen.value = false;
+ getList();
+ })
+ .finally(() => {
+ uploading.value = false;
+ });
+ });
+}
+
+onMounted(() => {
+ getList();
+});
+</script>
+
+<style scoped>
+.download-qr-content {
+ padding: 4px 4px 8px;
+}
+
+.app-meta-card {
+ border-radius: 10px;
+ padding: 12px 14px;
+ margin-bottom: 16px;
+ background: linear-gradient(135deg, #f0f7ff 0%, #ecfdf5 100%);
+ border: 1px solid #dbeafe;
+}
+
+.meta-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ line-height: 26px;
+}
+
+.meta-row + .meta-row {
+ margin-top: 6px;
+}
+
+.meta-label {
+ font-size: 13px;
+ color: #64748b;
+}
+
+.meta-value {
+ max-width: 260px;
+ font-size: 14px;
+ color: #0f172a;
+ font-weight: 600;
+ word-break: break-all;
+ text-align: right;
+}
+
+.qr-box {
+ border: 1px solid #e2e8f0;
+ border-radius: 12px;
+ padding: 18px 12px 14px;
+ text-align: center;
+ background: #ffffff;
+ box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
+}
+
+.qr-image {
+ width: 220px;
+ height: 220px;
+ border-radius: 8px;
+ border: 1px solid #e5e7eb;
+ padding: 8px;
+ background: #fff;
+}
+
+.qr-tip {
+ margin-top: 10px;
+ font-size: 13px;
+ color: #64748b;
+}
+</style>
--
Gitblit v1.9.3