This commit is contained in:
2024-11-06 09:46:54 +08:00
parent 51f408ce7a
commit d7518e41e4
2 changed files with 20 additions and 26 deletions

View File

@@ -22,6 +22,6 @@ export const deleteDictType = (params: string[]) => {
}
//导出字典类型
export const exportdictType=(params: Dict.ReqDictTypeParams)=>{
return http.post(`/dictType/export`, params)
export const exportDictType=(params: Dict.ReqDictTypeParams)=>{
return http.download(`/dictType/export`, params)
}

View File

@@ -1,9 +1,9 @@
<template>
<div class='table-box' ref='popupBaseView'>
<ProTable
ref='proTable'
:columns='columns'
:request-api='getDictTypeList'
ref='proTable'
:columns='columns'
:request-api='getDictTypeList'
>
<template #tableHeader='scope'>
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
@@ -21,31 +21,31 @@
</template>
</ProTable>
</div>
<DictData :width='viewWidth' :height='viewHeight' ref='openView'/>
<TypePopup :refresh-table='proTable?.getTableList' ref='typePopup'/>
<DictData :width='viewWidth' :height='viewHeight' ref='openView' />
<TypePopup :refresh-table='proTable?.getTableList' ref='typePopup' />
</template>
<script setup lang='tsx' name='dict'>
import {CirclePlus, Delete, Download, EditPen, View} from '@element-plus/icons-vue'
import {Dict} from '@/api/system/dictionary/interface'
import {ColumnProps, ProTableInstance} from '@/components/ProTable/interface'
import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons-vue'
import { Dict } from '@/api/system/dictionary/interface'
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import DictData from '@/views/system/dictionary/dictData/index.vue'
import {useDictStore} from '@/stores/modules/dict'
import {useHandleData} from '@/hooks/useHandleData'
import {useViewSize} from '@/hooks/useViewSize'
import {useDownload} from '@/hooks/useDownload'
import {deleteDictType, getDictTypeList,exportdictType} from '@/api/system/dictionary/dictType'
import { useDictStore } from '@/stores/modules/dict'
import { useHandleData } from '@/hooks/useHandleData'
import { useViewSize } from '@/hooks/useViewSize'
import { useDownload } from '@/hooks/useDownload'
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
const dictStore = useDictStore()
const {popupBaseView, viewWidth, viewHeight} = useViewSize()
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
const proTable = ref<ProTableInstance>()
const typePopup = ref()
const openView = ref()
const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
{type: 'selection', fixed: 'left', width: 70},
{type: 'index', fixed: 'left', width: 70, label: '序号'},
{ type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'name',
label: '类型名称',
@@ -55,7 +55,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
},
},
{
prop: 'code',
prop: 'code',
label: '类型编码',
width: 180,
search: {
@@ -86,12 +86,6 @@ const openDialog = (titleType: string, row: Partial<Dict.ResDictType> = {}) => {
typePopup.value?.open(titleType, row)
}
// 导出字典类型
// const downloadFile = async () => {
// ElMessageBox.confirm('确认导出字典类型数据?', '温馨提示', { type: 'warning' }).then(() =>
// useDownload(exportDictType, '字典类型列表', proTable.value?.searchParam),
// )
// }
// 批量删除字典类型
const batchDelete = async (id: string[]) => {
@@ -114,7 +108,7 @@ const toDictData = (row: Dict.ResDictType) => {
// 导出字典类型列表
const downloadFile = async () => {
ElMessageBox.confirm('确认导出字典类型数据?', '温馨提示', { type: 'warning' }).then(() =>
useDownload(exportdictType, '字典类型导出数据', proTable.value?.searchParam,true,'.xls'),
useDownload(exportDictType, '字典类型导出数据', proTable.value?.searchParam, false,'.xls'),
)
}
</script>