From 4efd39b4696db81789d3d92a54d197f1e85ecdf2 Mon Sep 17 00:00:00 2001 From: feige <feige@qq.com> Date: 星期三, 17 五月 2023 17:01:43 +0800 Subject: [PATCH] 把所有模块的导入模板和导出问题都解决了 --- ruoyi-ui/src/views/pet/index.vue | 36 ++++++++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ruoyi-ui/src/views/pet/index.vue b/ruoyi-ui/src/views/pet/index.vue index cec544d..6719690 100644 --- a/ruoyi-ui/src/views/pet/index.vue +++ b/ruoyi-ui/src/views/pet/index.vue @@ -111,7 +111,7 @@ plain icon="el-icon-download" size="mini" - @click="handleExport" + @click="handleExportTemplate" v-hasPermi="['family:note:export']" >瀵煎叆妯℃澘涓嬭浇</el-button> </el-col> @@ -132,8 +132,8 @@ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> - <el-table v-loading="loading" :data="petList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName"> - <el-table-column type="selection" width="55" align="center" /> + <el-table v-loading="loading" :data="petList" :row-key="getRowId" ref="multipleTable" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName"> + <el-table-column type="selection" :reserve-selection="true" width="55" align="center" /> <el-table-column label="搴忓彿" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="120"/> @@ -156,7 +156,7 @@ <span>{{ parseTime(scope.row.birth) }}</span> </template> </el-table-column> - <el-table-column label="瀹犵墿id" prop="id" sortable width="100" /> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope" v-if="scope.row.roleId !== 1"> <el-button @@ -423,7 +423,7 @@ }, created() { this.getList(); - this.getCateInfor() + // this.getCateInfor() }, methods: { @@ -456,12 +456,9 @@ this.loading = true; this.queryParams.happenStartTime = this.dateRange.length > 0 && this.dateRange[0] this.queryParams.happenEndTime = this.dateRange.length > 0 && this.dateRange[1] - // console.log(this.queryParams) // listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listPet(this.queryParams).then(response => { - // alert(123) - // console.log(response.data) this.petList = response.data.data; this.total = response.data.total; @@ -487,6 +484,10 @@ if(this.fileListOther[i].url==file.url) this.$delete(this.fileListOther,i); } + }, + getRowId(row) + { + return row.id }, // 鍙栨秷鎸夐挳 cancel() { @@ -625,10 +626,25 @@ }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { - this.download('family/property/export', { + const Ids = this.ids; + + if(Ids.length==0) + { + this.download('/family/property/export', { ...this.queryParams - }, `property_${new Date().getTime()}.xlsx`) + }, `pet_${new Date().getTime()}.xlsx`) + }else{ + this.download('/family/property/export1/'+Ids, { + + }, `pet_${new Date().getTime()}.xlsx`) + } }, + handleExportTemplate() + { + this.download('/family/property/model', { + ...this.queryParams + }, `pet_${new Date().getTime()}.xlsx`) + }, /** 瀵煎叆鎿嶄綔*/ handleEnport(params){ var file = params.file; -- Gitblit v1.9.1