src/components/VisibilityToolbar/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/enums/fileType.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/projectEngineering/component/FileDialog.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/projectEngineering/projectLibrary/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/components/VisibilityToolbar/index.vue
@@ -1,5 +1,5 @@ <template> <div class="top-right-btn" :style="style"> <div class="top-right-btn"> <el-row> <el-tooltip v-if="search" class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> <el-button size="small" circle icon="el-icon-search" @click="toggleSearch"></el-button> @@ -12,12 +12,18 @@ </el-tooltip> </el-row> <el-drawer :visible.sync="table" title="信息显隐筛选" size="30%" append-to-body> <el-drawer :visible.sync="table" title="信息显隐筛选" size="30%" append-to-body :wrapperCLosable="false" :with-header="true"> <div slot="header"> <span>信息显隐筛选</span> </div> <div slot="default"> <el-table :data="pagedColumns" style="width: 100%; height: 80%"> <div slot="default" style="margin-left: 20px;margin-top: 20px"> <el-table :data="pagedColumns" style="width: 95%; height: 80%;;margin-bottom: 40px;"> <el-table-column prop="index" label="序号" width="80"></el-table-column> <el-table-column prop="label" label="数据名称"></el-table-column> <el-table-column prop="visible" label="是否显示"> @@ -25,7 +31,8 @@ <el-switch v-model="scope.row.visible" class="ml-2" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" active-color="#13ce66" inactive-color="#ff4949" @change="switchChange(scope.row)" ></el-switch> </template> @@ -36,7 +43,6 @@ </template> </el-table-column> </el-table> <el-pagination v-if="total > pageSize" :page-size="pageSize" @@ -46,7 +52,7 @@ @current-change="handlePageChange" ></el-pagination> </div> <div slot="footer"> <div style="position: absolute; bottom: 0; left: 0; right: 0; padding: 20px; text-align: right;"> <el-button @click="table = false">取 消</el-button> <el-button type="primary" @click="resetSort">重 置</el-button> </div> @@ -126,10 +132,7 @@ mounted() { this.columns.forEach((item, index) => { if (item.visible) { // 注意:这里假设columnRef应该是一个checkbox组件的引用, // 但在Vue 2中,我们可能需要另一种方式来管理checked状态, // 因为Vue 2没有ref的自动实例绑定,且这里的columnRef逻辑似乎不完整或错误。 // 可能需要移除或重写这部分逻辑。 } }); }, @@ -157,4 +160,14 @@ .show-btn { margin-left: 12px; } .drawer-footer { position: absolute; bottom: 0; left: 0; right: 0; padding: 20px; background: #fff; border-top: 1px solid #e8e8e8; text-align: right; } </style> src/enums/fileType.js
File was deleted src/views/projectEngineering/component/FileDialog.vue
@@ -1,3 +1,4 @@ <template> <div> <el-dialog @@ -8,7 +9,7 @@ close-on-click-modal @close="closeDialog" > <template slot="header"> <template slot="title"> <span style="padding-bottom: 18px"> {{ isImportOrExport ? '请按照需求导出目标内容' : '请按照模板样式上传项目文件' }} </span> @@ -18,17 +19,17 @@ <el-upload ref="uploadRef" class="upload-demo" :action="upload.url" :action="uploadUrl" :limit="1" :accept="accept" :headers="upload.headers" :disabled="upload.isUploading" :headers=" uploadHeaders" :disabled="uploadIsUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag > <el-icon class="el-icon--upload"><upload-filled /></el-icon> <i class="el-icon-upload"></i> <div class="el-upload__text">请上传<em>Zip</em>文件,大小在<em>100M</em>以内</div> </el-upload> <span>仅允许导入zip格式文件。</span> @@ -53,15 +54,10 @@ </template> <script> // import UploadFilled from '@element/icons-vue/es/icons/UploadFilled.vue'; import { globalHeaders } from '@/utils/request'; import { FileTypeEnum } from '@/enums/fileType'; export default { name: 'FileDialog', // components: { // UploadFilled // }, props: { isImportOrExport: { type: Boolean, @@ -82,49 +78,18 @@ return { uploadRef: null, targetColumn: [], accept: `${FileTypeEnum.ZIP}`, upload: { open: false, title: '', isUploading: false, updateSupport: 0, headers: globalHeaders(), url: process.env.VITE_APP_BASE_API + '/project/import' } accept: `.zip`, uploadUrl: '/project/import', uploadHeaders: globalHeaders(), uploadIsUploading: false }; }, computed: { // In Vue 2, computed properties don't use setters and getters as objects. // Instead, you define them as functions for reading and use methods for writing. // However, in this case, we can use a watcher to update the prop. fileDialogVisible: { get() { return this.isFileDialogVisible; }, set(value) { this.$emit('update:fileDialogVisible', value); } } // Note: In Vue 2, you cannot directly define a computed property with a setter for a prop. // Instead, you should use a watcher or a method to handle changes. // Since `fileDialogVisible` is a prop, we'll use a watcher to sync it with the internal state. // However, for simplicity, we'll rename `fileDialogVisible` to `isFileDialogVisible` in data and use a watcher. }, watch: { fileDialogVisible(newVal) { this.isFileDialogVisible = newVal; }, isFileDialogVisible(newVal) { this.$emit('update:fileDialogVisible', newVal); } }, methods: { handleFileUploadProgress() { this.upload.isUploading = true; this.uploadIsUploading = true; }, handleFileSuccess(response, file) { this.upload.open = false; this.upload.isUploading = false; this.uploadIsUploading = false; if (this.uploadRef) { this.uploadRef.handleRemove(file); } @@ -140,24 +105,24 @@ }, handleDownloadFile() { const self = this; fetch(`${process.env.VITE_APP_BASE_API}/project/export/template`, { method: 'GET', headers: self.upload.headers }) .then(response => response.blob()) .then(blob => { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = `项目文件模板_${new Date().getTime()}.zip`; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); }) .catch(error => { console.error('文件下载失败:', error); }); // fetch(`${process.env.VITE_APP_BASE_API}/project/export/template`, { // method: 'GET', // headers: self.upload.headers // }) // .then(response => response.blob()) // .then(blob => { // const url = window.URL.createObjectURL(blob); // const a = document.createElement('a'); // a.style.display = 'none'; // a.href = url; // a.download = `项目文件模板_${new Date().getTime()}.zip`; // document.body.appendChild(a); // a.click(); // window.URL.revokeObjectURL(url); // }) // .catch(error => { // console.error('文件下载失败:', error); // }); }, submitFileForm() { if (this.uploadRef) { @@ -172,8 +137,11 @@ this.targetColumn = this.currentColumns.filter(item => item.visible); } }, mounted() { this.uploadRef = this.$refs.uploadRef; }, created() { // Initialize the computed property as a data property in Vue 2 this.isFileDialogVisible = this.fileDialogVisible; } }; @@ -186,6 +154,7 @@ align-items: center; flex-direction: column; height: 300px; .export-button { margin-left: 0; margin-bottom: 10px; @@ -198,4 +167,10 @@ .upload-demo { width: 100%; } ::v-deep .el-upload{ width: 100%; } ::v-deep .el-upload .el-upload-dragger{ width: 100%; } </style> src/views/projectEngineering/projectLibrary/index.vue
@@ -164,7 +164,7 @@ </div> <VisibilityToolbar v-model:showSearch="showSearch" :columns="columnList" :columns="columns" @queryTable="handleQuery" ></VisibilityToolbar> <!-- @update:columns="handleUpdateColumns"--> @@ -239,27 +239,28 @@ @pagination="getList" /> <!-- <FileDialog--> <!-- v-model:fileDialogVisible="fileDialogVisible"--> <!-- :isImportOrExport="isImportOrExport"--> <!-- @fileDialogCancel="fileDialogCancel"--> <!-- :currentColumns="currentColumns"--> <!-- />--> <FileDialog :fileDialogVisible.sync="fileDialogVisible" :isImportOrExport="isImportOrExport" @fileDialogCancel="fileDialogCancel" :currentColumns="columns" /> </div> </template> <script> import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/projectInfo"; import { current } from './list'; import FileDialog from '../component/FileDialog'; export default { name: "projectInfo", components: { FileDialog }, data() { return { isImportOrExport: false, fileDialogVisible: false, //控制显隐的表单 columnList: [], //是否需要新增按钮(储蓄项目需要) isReserve: false, //表头 @@ -327,6 +328,13 @@ this.getList(); }, methods: { // 关闭文件处理弹框的方法 fileDialogCancel() { this.tableLoading = true; this.fileDialogVisible = false; // this.getList(); this.tableLoading = false; }, handlePopover() { this.popoverValue.value = !this.popoverValue.value; },