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)=>{ export const exportDictType=(params: Dict.ReqDictTypeParams)=>{
return http.post(`/dictType/export`, params) return http.download(`/dictType/export`, params)
} }

View File

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