From 882c04207fdc667b0be8dc347e320d0414eedb94 Mon Sep 17 00:00:00 2001 From: fei <791364011@qq.com> Date: 星期二, 16 九月 2025 22:27:11 +0800 Subject: [PATCH] 新增了代码 --- src/views/archiveProjectName/index.vue | 76 +++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 1 deletions(-) diff --git a/src/views/archiveProjectName/index.vue b/src/views/archiveProjectName/index.vue index 53e0793..8ed9064 100644 --- a/src/views/archiveProjectName/index.vue +++ b/src/views/archiveProjectName/index.vue @@ -50,6 +50,35 @@ v-hasPermi="['system:projectName:export']" >瀵煎嚭</el-button> </el-col> + + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExportTemplate" + v-hasPermi="['system:category:export']" + >瀵煎叆妯℃澘涓嬭浇</el-button> + </el-col> + + <el-col :span="1.5"> + + <el-upload + action="" + + class="upload-demo" + :show-file-list="false" + :http-request="handleImport" + accept=".xlsx,.xls" + + > + <el-button size="mini" type="primary" + plain + icon="el-icon-top">瀵煎叆</el-button> + + </el-upload> + </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> @@ -57,6 +86,9 @@ <el-table-column type="selection" width="55" align="center" /> <!-- <el-table-column label="${comment}" align="center" prop="id" /> --> <el-table-column label="椤圭洰鍚嶇О" align="center" prop="name" /> + <el-table-column label="鍏徃鍚嶇О" align="center" prop="companyName" /> + <el-table-column label="椤圭洰璐熻矗浜�" align="center" prop="createPerson" /> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button @@ -101,7 +133,7 @@ </template> <script> -import { listName, getName, delName, addName, updateName } from "@/api/system/projectName" +import { listName, getName, enload,delName, addName, updateName } from "@/api/system/projectName" export default { name: "Name", @@ -147,6 +179,7 @@ this.loading = true listName(this.queryParams).then(response => { this.nameList = response.data.data + console.log(response.data.data) this.total = response.data.total this.loading = false }) @@ -233,6 +266,47 @@ this.download('system/projectName/export', { ...this.queryParams }, `name_${new Date().getTime()}.xlsx`) + }, + /** 瀵煎叆妯℃澘涓嬭浇鎿嶄綔*/ + handleExportTemplate() + { + this.download('/system/projectName/model', { + + }, `projectName_${new Date().getTime()}.xlsx`) + }, + + /** 瀵煎叆鎿嶄綔*/ + async handleImport({file}){ + // 妫�鏌ユ枃浠剁被鍨嬫槸鍚︿负xlsx + // if (!params.file.name.endsWith('.xlsx')) { + // this.$message.error('璇蜂笂浼�.xlsx鏍煎紡鐨勬枃浠�'); + // return; + // } + const formData = new FormData(); + formData.append('file', file); + console.log(file) + + // 鏄剧ず鍔犺浇涓姸鎬� + const loading = this.$loading({ + lock: true, + text: '涓婁紶涓�...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + + enload(formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }).then(response => { + loading.close(); + this.$message.success('瀵煎叆鎴愬姛'); + this.getList(); + }).catch(error => { + loading.close(); + this.$message.error('瀵煎叆澶辫触: ' + (error.message || '鏈煡閿欒')); + }); + } } } -- Gitblit v1.9.1