diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 8254c4d4..b3ba02d9 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -1,12 +1,11 @@ import request from "@utils/request"; - /** * 获取字典分页列表 * * @param queryParams */ -export function listDictByPage(queryParams: object) { +export function listDictWithPage(queryParams: object) { return request({ url: '/youlai-admin/api/v2/dict/page', method: 'get', @@ -14,6 +13,19 @@ export function listDictByPage(queryParams: object) { }) } +/** + * 获取字典详情 + * + * @param id + */ +export function getDictDetail(id: number) { + return request({ + url: '/youlai-admin/api/v2/dict/' + id, + method: 'get' + }) +} + + /** * 新增字典 * @@ -41,13 +53,23 @@ export function updateDict(id: number, data: object) { }) } +/** + * 批量删除字典 + * @param ids 字典ID,多个以英文逗号(,)分割 + */ +export function deleteDict(ids: string) { + return request({ + url: '/youlai-admin/api/v2/dict/' + ids, + method: 'delete', + }) +} /** * 获取字典项分页列表 * * @param queryParams */ -export function listDictItemsByPage(queryParams: object) { +export function listDictItemsWithPage(queryParams: object) { return request({ url: '/youlai-admin/api/v2/dict/items/page', method: 'get', @@ -69,6 +91,19 @@ export function listDictItems(dictCode: string) { }) } +/** + * 获取字典项详情 + * + * @param id + */ +export function getDictItemDetail(id: number) { + return request({ + url: '/youlai-admin/api/v2/dict/items/' + id, + method: 'get' + }) +} + + /** * 新增字典项 @@ -97,4 +132,13 @@ export function updateDictItem(id: number, data: object) { }) } - +/** + * 批量删除字典项 + * @param ids 字典项ID,多个以英文逗号(,)分割 + */ +export function deleteDictItem(ids: string) { + return request({ + url: '/youlai-admin/api/v2/dict/items/' + ids, + method: 'delete', + }) +} diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue index cb413390..1f21ae4f 100644 --- a/src/views/system/client/index.vue +++ b/src/views/system/client/index.vue @@ -106,10 +106,7 @@ - - - @@ -117,10 +114,12 @@ import {list, detail, update, add, del} from '@/api/system/client' import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons' import {onMounted, reactive, getCurrentInstance, ref, unref} from 'vue' -import {ElForm, ElMessage,ElMessageBox} from "element-plus"; +import {ElForm, ElMessage, ElMessageBox} from "element-plus"; const state = reactive({ loading: true, + + ids: [], // 非单个禁用 single: true, @@ -226,7 +225,7 @@ function submitForm() { } function cancel() { - state.dialog.visible=false + state.dialog.visible = false } function resetForm() { @@ -243,9 +242,9 @@ function resetForm() { } } -function handleDelete(row:any) { - const clientIds=[row.clientId|| state.ids].join(',') - ElMessageBox.confirm('确认删除已选中的数据项?','警告',{ +function handleDelete(row: any) { + const clientIds = [row.clientId || state.ids].join(',') + ElMessageBox.confirm('确认删除已选中的数据项?', '警告', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -261,11 +260,10 @@ function handleDelete(row:any) { onMounted(() => { handleQuery() - // 全局方法调用 - const { proxy } = getCurrentInstance(); - proxy.$listDictItems('gender').then(response=>{ - console.log('性别字典数据',response.data) + const {proxy}: any = getCurrentInstance(); + proxy.$listDictItems('gender').then((response: any) => { + console.log('性别字典数据', response.data) }) }) diff --git a/src/views/system/dict/components/Dict.vue b/src/views/system/dict/components/Dict.vue new file mode 100644 index 00000000..bafe07f0 --- /dev/null +++ b/src/views/system/dict/components/Dict.vue @@ -0,0 +1,291 @@ + diff --git a/src/views/system/dict/components/DictItem.vue b/src/views/system/dict/components/DictItem.vue new file mode 100644 index 00000000..a0224e3a --- /dev/null +++ b/src/views/system/dict/components/DictItem.vue @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue new file mode 100644 index 00000000..1bbf76a7 --- /dev/null +++ b/src/views/system/dict/index.vue @@ -0,0 +1,56 @@ + + + + +