From 338f3c59ce3d26269cd68878fae2ff2144fb67bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com>
Date: Wed, 8 Dec 2021 00:18:45 +0800
Subject: [PATCH] =?UTF-8?q?feat(dict.ts):=E6=B7=BB=E5=8A=A0=E5=AD=97?=
=?UTF-8?q?=E5=85=B8=E6=8E=A5=E5=8F=A3=E5=92=8C=E7=A7=BB=E9=99=A4=E5=85=A8?=
=?UTF-8?q?=E5=B1=80=E8=8E=B7=E5=8F=96=E5=AD=97=E5=85=B8=E9=A1=B9=E7=9A=84?=
=?UTF-8?q?ts=E8=AD=A6=E5=91=8A=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/system/dict.ts | 52 +++-
src/views/system/client/index.vue | 22 +-
src/views/system/dict/components/Dict.vue | 291 ++++++++++++++++++
src/views/system/dict/components/DictItem.vue | 18 ++
src/views/system/dict/index.vue | 56 ++++
5 files changed, 423 insertions(+), 16 deletions(-)
create mode 100644 src/views/system/dict/components/Dict.vue
create mode 100644 src/views/system/dict/components/DictItem.vue
create mode 100644 src/views/system/dict/index.vue
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 @@
+
+
+ dictItem
+
+
+
+
+
+
+
+
+
\ 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 @@
+
+
+
+
+
+
+ 字典列表
+
+
+
+
+
+
+
+
+
+ {{ dict.name }}数据项
+
+
+
+
+
+
+
+
+
+
+
+