|
@@ -0,0 +1,112 @@
|
|
|
+<template>
|
|
|
+ <el-form ref="form" label-width="120px" class="cameraVersion-from">
|
|
|
+ <el-form-item label="设备类型" class="mandatory">
|
|
|
+ {{ cameraTypeDesc[data.type] }}
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="版本号" class="mandatory">
|
|
|
+ <el-input
|
|
|
+ maxlength="30"
|
|
|
+ v-model="data.version"
|
|
|
+ placeholder="请输入最新版本号"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="最低版本号" class="mandatory">
|
|
|
+ <el-input
|
|
|
+ maxlength="30"
|
|
|
+ v-model="data.minVersion"
|
|
|
+ placeholder="请输入最低版本(低于此版本号强制更新)"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="版本更新说明" class="mandatory">
|
|
|
+ <el-input
|
|
|
+ maxlength="200"
|
|
|
+ type="textarea"
|
|
|
+ :autosize="{ minRows: 4, maxRows: 10 }"
|
|
|
+ v-model="data.description"
|
|
|
+ placeholder="请输入版本更新说明"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="文件" class="mandatory">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ :multiple="false"
|
|
|
+ :limit="1"
|
|
|
+ :disabled="!!data.file"
|
|
|
+ :before-upload="upload"
|
|
|
+ :file-list="fileList"
|
|
|
+ :http-request="httpsApi"
|
|
|
+ :on-preview="previewFile"
|
|
|
+ :accept="accept"
|
|
|
+ :before-remove="removeFile"
|
|
|
+ >
|
|
|
+ <el-button type="primary" :disabled="!!data.file">
|
|
|
+ <el-icon><Upload /></el-icon>上传
|
|
|
+ </el-button>
|
|
|
+ <!-- <template v-slot:tip>
|
|
|
+ <div class="el-upload__tip">注:可上传{{ size }}以内的{{ formatDesc }}</div>
|
|
|
+ </template> -->
|
|
|
+ <!-- <template v-slot:file="{ file }: { file: UploadFile }">
|
|
|
+ <div class="file" @click.stop="previewFile()">
|
|
|
+ <div>
|
|
|
+ <el-icon><Document /></el-icon>
|
|
|
+ <span class="name">{{ file.name }}</span>
|
|
|
+ </div>
|
|
|
+ <el-icon @click.stop="removeFile()"><Close /></el-icon>
|
|
|
+ </div>
|
|
|
+ </template> -->
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { computed, ref, watchEffect } from "vue";
|
|
|
+// import { ElMessage } from "element-plus";
|
|
|
+import { QuiskExpose } from "@/helper/mount";
|
|
|
+import { CameraVersionEntity } from "@/store/cameraVersion";
|
|
|
+import { useUpload } from "@/hook/upload";
|
|
|
+import { maxFileSize } from "@/constant/caseFile";
|
|
|
+import { CameraType } from "@/store/camera";
|
|
|
+import { cameraTypeDesc } from "@/constant/camera";
|
|
|
+import { uploadFile } from "@/store/cameraVersion";
|
|
|
+
|
|
|
+const cameraTypes = [CameraType.SWKJ, CameraType.SWSS1, CameraType.SWSS2];
|
|
|
+const props = defineProps<{
|
|
|
+ type: string | number;
|
|
|
+ entity?: CameraVersionEntity;
|
|
|
+}>();
|
|
|
+const data = ref<CameraVersionEntity>({
|
|
|
+ version: "",
|
|
|
+ description: "",
|
|
|
+ minVersion: "",
|
|
|
+ type: props.type.toString(),
|
|
|
+ file: undefined,
|
|
|
+});
|
|
|
+
|
|
|
+const isAdd = computed(() => !props.entity?.id);
|
|
|
+
|
|
|
+const httpsApi = async ({ file }) => {
|
|
|
+ console.log("httpsApi", file);
|
|
|
+ let fileUrl = await uploadFile(file);
|
|
|
+
|
|
|
+ file.url = fileUrl;
|
|
|
+ console.log("httpsApi", file, fileUrl);
|
|
|
+};
|
|
|
+
|
|
|
+const { size, fileList, upload, removeFile, previewFile, file, accept } =
|
|
|
+ useUpload({
|
|
|
+ maxSize: maxFileSize,
|
|
|
+ formats: [".jpg", ".jpeg"],
|
|
|
+ });
|
|
|
+defineExpose<QuiskExpose>({
|
|
|
+ async submit() {},
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.icon-style {
|
|
|
+ font-size: 20px;
|
|
|
+ line-height: 50px;
|
|
|
+}
|
|
|
+</style>
|