导入导出
This commit is contained in:
@@ -59,6 +59,19 @@
|
||||
宿舍月卫生列表
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button
|
||||
icon="Upload"
|
||||
type="primary"
|
||||
@click="handleImport">
|
||||
导入
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Download"
|
||||
type="warning"
|
||||
class="ml10"
|
||||
@click="handleExport">
|
||||
导出
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10"
|
||||
@@ -195,20 +208,33 @@
|
||||
<el-button type="primary" @click="submitEvaluation" :loading="evalLoading">确定评比</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<upload-excel
|
||||
ref="uploadExcelRef"
|
||||
:title="'导入宿舍月卫生'"
|
||||
:url="'/stuwork/file/importDormHygieneMonthly'"
|
||||
:temp-url="templateUrl"
|
||||
@refreshDataList="getDataList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="DormHygieneMonthly">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { reactive, ref, onMounted, defineAsyncComponent } from 'vue'
|
||||
import { fetchList, addObj, editObj, delObj, triggerEvaluation } from '/@/api/stuwork/dormhygienemonthly'
|
||||
import { exportDormHygieneMonthlyTemplate, downloadBlobFile } from '/@/api/stuwork/file'
|
||||
import { getBuildingList } from '/@/api/stuwork/dormbuilding'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import { Search, Document, Plus, Edit, Delete, Promotion } from '@element-plus/icons-vue'
|
||||
|
||||
// 引入组件
|
||||
const UploadExcel = defineAsyncComponent(() => import('/@/components/Upload/Excel.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const formRef = ref()
|
||||
const evalFormRef = ref()
|
||||
const uploadExcelRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
@@ -218,6 +244,8 @@ const buildingList = ref<any[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
const evalDialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增宿舍月卫生')
|
||||
// 模板文件URL
|
||||
const templateUrl = ref('/stuwork/file/exportDormHygieneMonthlyTemplate')
|
||||
|
||||
// 分页
|
||||
const page = reactive({
|
||||
@@ -361,6 +389,18 @@ const handleEvaluation = () => {
|
||||
evalDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 导入
|
||||
const handleImport = () => {
|
||||
if (uploadExcelRef.value) {
|
||||
uploadExcelRef.value.show()
|
||||
}
|
||||
}
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
await downloadBlobFile(exportDormHygieneMonthlyTemplate(searchForm), '宿舍月卫生.xlsx')
|
||||
}
|
||||
|
||||
// 提交评比
|
||||
const submitEvaluation = async () => {
|
||||
evalLoading.value = true
|
||||
|
||||
Reference in New Issue
Block a user