diff --git a/package.json b/package.json index ea04dc8..e454834 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "url": "https://github.com/YunaiV/ruoyi-vue-pro" }, "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1", "@babel/parser": "^7.18.4", "@riophae/vue-treeselect": "0.4.0", "axios": "0.27.2", @@ -52,11 +53,12 @@ "dayjs": "^1.11.12", "echarts": "5.4.0", "element-ui": "2.15.12", - "file-saver": "2.0.5", + "file-saver": "^2.0.5", "fuse.js": "6.6.2", "highlight.js": "9.18.5", "js-beautify": "1.13.0", "jsencrypt": "3.3.1", + "jszip": "^3.10.1", "min-dash": "3.5.2", "nprogress": "0.2.0", "nvm": "^0.0.4", @@ -70,6 +72,7 @@ "vue-count-to": "1.0.13", "vue-cropper": "0.5.8", "vue-meta": "^2.4.0", + "vue-qriously": "^1.1.1", "vue-quill-editor": "^3.0.6", "vue-router": "3.4.9", "vue-video-player": "^5.0.2", diff --git a/src/api/company/archives/archives.js b/src/api/company/archives/archives.js new file mode 100644 index 0000000..17604bd --- /dev/null +++ b/src/api/company/archives/archives.js @@ -0,0 +1,24 @@ +import request from '@/utils/request' + +export function updateArchives(data){ + return request({ + url: "/archives/update", + method: "post", + data + }) +} + +export function queryArchivesPage(params){ + return request({ + url: "/archives/list", + method: "get", + params + }) +} + +export function removeArchivesById(id){ + return request({ + url: "/archives/remove/" + id, + method: 'delete' + }) +} diff --git a/src/components/FileUpload2/index.vue b/src/components/FileUpload2/index.vue index e7873ad..5183ce4 100644 --- a/src/components/FileUpload2/index.vue +++ b/src/components/FileUpload2/index.vue @@ -98,8 +98,13 @@ export default { return this.isShowTip && (this.fileType || this.fileSize); }, }, + mounted(){ + //加载文件列表 + this.initFiles() + }, watch: { value(val) { + if (val) { let temp = 1; const list = Array.isArray(val)? val : this.value.split(","); @@ -116,6 +121,26 @@ export default { }, }, methods: { + /** + * 手动加载文件列表,为了解决本组件value值变化可能会出现监听不到的情况 + */ + initFiles(){ + if(this.fileList.length==0){ + // 不存在就是新增,新增时直接返回,不然要报错 + if (!this.value){ + return; + } + let temp = 1; + const list = Array.isArray(this.value)? this.value : this.value.split(","); + this.fileList = list.map((item) => { + if (typeof item === "string") { + item = { name: item, url: item }; + } + item.uid = item.uid || new Date().getTime() + temp++; + return item; + }); + } + }, handleBeforeUpload(file) { if (this.fileType.length) { const name = file.name.split("."); diff --git a/src/main.js b/src/main.js index 6e38255..18d9258 100644 --- a/src/main.js +++ b/src/main.js @@ -30,6 +30,8 @@ import ImagePreview from "@/components/ImagePreview/index.vue"; // import hljs from 'highlight.js' // import 'highlight.js/styles/github-gist.css' import {DICT_TYPE, getDictDataLabel, getDictDatas, getDictDatas2} from "@/utils/dict"; +// 二维码 +import VueQriously from 'vue-qriously' // 全局方法挂载 Vue.prototype.getDicts = getDicts @@ -61,6 +63,8 @@ import VueMeta from 'vue-meta' Vue.use(directive) Vue.use(plugins) Vue.use(VueMeta) +// 二维码 +Vue.use(VueQriously) // Vue.use(hljs.vuePlugin); // bpmnProcessDesigner 需要引入 diff --git a/src/utils/createUUID.js b/src/utils/createUUID.js deleted file mode 100644 index a261edd..0000000 --- a/src/utils/createUUID.js +++ /dev/null @@ -1,5 +0,0 @@ -import {v4 as uuidv4} from 'uuid' - -export function createUUID(){ - return uuidv4().replace(/-/g, '') -} diff --git a/src/utils/createUniqueCode.js b/src/utils/createUniqueCode.js new file mode 100644 index 0000000..eb411cb --- /dev/null +++ b/src/utils/createUniqueCode.js @@ -0,0 +1,17 @@ +import { v4 as uuidv4 } from 'uuid' + +export function createUUID() { + return uuidv4().replace(/-/g, '') +} + +export function createHashCodeByStr(str) { + let hash = 0 + if (str.length === 0) return hash + for (let i = 0; i < str.length; i++) { + const char = str.charCodeAt(i) + hash = ((hash << 5) - hash) + char + hash = hash & hash // 转换为32位整数 + } + // 将整数转换为16进制字符串,以缩短code长度 + return Math.abs(hash).toString(16) +} diff --git a/src/utils/dict.js b/src/utils/dict.js index 1284e6d..b8c035c 100644 --- a/src/utils/dict.js +++ b/src/utils/dict.js @@ -169,6 +169,8 @@ export const DICT_TYPE = { RESCUE_CAR_TYPE: 'rescue_car_type', // 档案分类 ARCHIVES_TYPE: 'archives_type', + // 档案项分类 + ARCHIVES_ITEM_TYPE: 'archives_item_type', } /** diff --git a/src/utils/downloadZIP.js b/src/utils/downloadZIP.js new file mode 100644 index 0000000..444554c --- /dev/null +++ b/src/utils/downloadZIP.js @@ -0,0 +1,29 @@ +import JSZip from 'jszip' +import { saveAs } from 'file-saver' + +export async function downloadFilesAsZip(fileObject) { + const zip = new JSZip() + for (const item of fileObject.files) { + try { + const response = await fetch(item.url) + if (!response.ok) { + throw new Error(`下载失败 ${item.url}: ${response.status}`) + } + const blob = await response.blob() + // 提取文件名,假设文件路径中最后一部分为文件名 + const fileName = item.name + zip.file(fileName, blob) + } catch (error) { + console.error(`下载失败 ${item.url}:`, error) + } + } + + // 生成压缩文件 + try { + const content = await zip.generateAsync({ type: 'blob' }); + // 保存压缩文件 + saveAs(content, fileObject.zipName); + } catch (error) { + console.error('生成ZIP错误', error); + } +} diff --git a/src/views/company/promotion/index.vue b/src/views/company/promotion/index.vue index 9f6ff22..9fec3e5 100644 --- a/src/views/company/promotion/index.vue +++ b/src/views/company/promotion/index.vue @@ -15,9 +15,9 @@ /> - - - + + + - + + +