diff --git a/src/api/system/dictionary.ts b/src/api/system/dictionary.ts
index 4cfd5a06..9fef3ddc 100644
--- a/src/api/system/dictionary.ts
+++ b/src/api/system/dictionary.ts
@@ -13,4 +13,9 @@ export const verifyId = (id:string) => request.post(`/dictionary/_exists`,{where
/**
* 保存字典
*/
-export const addDictionary = (data:any) => request.post('/dictionary',data)
\ No newline at end of file
+export const addDictionary = (data:any) => request.patch('/dictionary',data)
+
+/**
+ * 删除字典
+ */
+export const deleteDictionary =(id:string) => request.delete(`/dictionary/${id}`)
\ No newline at end of file
diff --git a/src/views/system/Dictionary/components/Left.vue b/src/views/system/Dictionary/components/Left.vue
index ab7d77de..94a5be20 100644
--- a/src/views/system/Dictionary/components/Left.vue
+++ b/src/views/system/Dictionary/components/Left.vue
@@ -10,30 +10,37 @@
下载
导入
+
-
-
-
- {{ item.name }}
-
-
- 删除
- 编辑
-
-
+
+
+
+
{{ item.name }}
+
+ updateDic(item.data)">
+
+
+ deleteDic(item.id)">
+ 删除
+
+ showEdit(item.data)">编辑
+
+
-
+
-
+
\ No newline at end of file
diff --git a/src/views/system/Dictionary/components/save/index.vue b/src/views/system/Dictionary/components/save/index.vue
index f77cf5b0..12b86ac4 100644
--- a/src/views/system/Dictionary/components/save/index.vue
+++ b/src/views/system/Dictionary/components/save/index.vue
@@ -10,7 +10,7 @@
>
-
+
@@ -33,11 +33,14 @@ import { isInput } from '@/utils/regular';
import type { Rule } from 'ant-design-vue/es/form';
import { verifyId,addDictionary } from '@/api/system/dictionary'
import { onlyMessage } from '@/utils/comm';
-import { error } from 'console';
const props = defineProps({
type:{
type:String,
default:'add'
+ },
+ data:{
+ type:Object,
+ default:{}
}
})
const emit = defineEmits(['closeSave','success'])
@@ -96,21 +99,27 @@ const rules = {
const submitData = () =>{
formRef.value.validate().then(async()=>{
loading.value = true
- if(props.type === 'add'){
- const res = await addDictionary(form)
+ const res = await addDictionary(form)
if(res.status === 200){
onlyMessage('保存成功!')
emit('success')
}else{
onlyMessage('操作失败!','error')
}
- }
loading.value = false
})
}
const closeModal = ()=>{
emit('closeSave')
}
+onMounted(()=>{
+ if(props.type==='edit' && props.data){
+ form.describe = props.data.describe
+ form.id = props.data.id
+ form.name = props.data.name
+ form.status = props.data.status
+ }
+})
\ No newline at end of file