Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-resource
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-resource
Commits
aff0826a
提交
aff0826a
authored
6月 10, 2022
作者:
lihuihui
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://gitlab-pro.ezijing.com/ezijing-web/center-resource
上级
f2427bc5
655dc952
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
132 行增加
和
139 行删除
+132
-139
.eslintrc-auto-import.json
.eslintrc-auto-import.json
+0
-1
auto-imports.d.ts
auto-imports.d.ts
+0
-1
api.ts
src/modules/admin/category/api.ts
+3
-5
AddDialog.vue
src/modules/admin/category/component/AddDialog.vue
+19
-10
List.vue
src/modules/admin/category/views/List.vue
+28
-35
api.ts
src/modules/system/cover/api.ts
+3
-8
AddDialog.vue
src/modules/system/cover/component/AddDialog.vue
+13
-4
List.vue
src/modules/system/cover/views/List.vue
+5
-17
api.ts
src/modules/system/dictionary/api.ts
+14
-14
AddDialog.vue
src/modules/system/dictionary/component/AddDialog.vue
+16
-4
ListAddDialog.vue
src/modules/system/dictionary/component/ListAddDialog.vue
+21
-3
List.vue
src/modules/system/dictionary/views/List.vue
+4
-18
rowList.vue
src/modules/system/dictionary/views/rowList.vue
+6
-19
没有找到文件。
.eslintrc-auto-import.json
浏览文件 @
aff0826a
...
...
@@ -134,7 +134,6 @@
"useDisplayMedia"
:
true
,
"useDocumentVisibility"
:
true
,
"useDraggable"
:
true
,
"useDropZone"
:
true
,
"useElementBounding"
:
true
,
"useElementByPoint"
:
true
,
"useElementHover"
:
true
,
...
...
auto-imports.d.ts
浏览文件 @
aff0826a
...
...
@@ -135,7 +135,6 @@ declare global {
const
useDisplayMedia
:
typeof
import
(
'@vueuse/core'
)[
'useDisplayMedia'
]
const
useDocumentVisibility
:
typeof
import
(
'@vueuse/core'
)[
'useDocumentVisibility'
]
const
useDraggable
:
typeof
import
(
'@vueuse/core'
)[
'useDraggable'
]
const
useDropZone
:
typeof
import
(
'@vueuse/core'
)[
'useDropZone'
]
const
useElementBounding
:
typeof
import
(
'@vueuse/core'
)[
'useElementBounding'
]
const
useElementByPoint
:
typeof
import
(
'@vueuse/core'
)[
'useElementByPoint'
]
const
useElementHover
:
typeof
import
(
'@vueuse/core'
)[
'useElementHover'
]
...
...
src/modules/admin/category/api.ts
浏览文件 @
aff0826a
...
...
@@ -7,10 +7,9 @@ export function getCategoryList(params: { type: string }) {
// 新建分类
export
function
createCategory
(
data
:
{
category_name
:
string
depth
?:
string
status
:
string
need_pass
:
string
parent_id
:
string
status
?:
string
need_pass
?:
string
parent_id
?:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/category/create'
,
data
)
}
...
...
@@ -18,7 +17,6 @@ export function createCategory(data: {
export
function
updateCategory
(
data
:
{
id
:
string
category_name
:
string
depth
?:
string
status
:
string
need_pass
:
string
parent_id
:
string
...
...
src/modules/admin/category/component/AddDialog.vue
浏览文件 @
aff0826a
<
script
lang=
"ts"
setup
>
import
{
createCategory
,
updateCategory
}
from
'../api'
import
{
ElMessage
}
from
'element-plus'
import
{
Search
}
from
'@element-plus/icons-vue'
import
type
{
FormRules
}
from
'element-plus'
import
TreeDialog
from
'./TreeDialog.vue'
...
...
@@ -14,12 +17,11 @@ const categoryForm = reactive({
parent_id
:
''
,
category_name
:
''
,
depth
:
1
,
name
:
''
,
status
:
'0'
,
need_pass
:
'1'
})
const
rules
=
reactive
<
FormRules
>
({
name
:
[
category_
name
:
[
{
required
:
true
,
message
:
'请输入类别名称'
,
trigger
:
'blur'
},
{
message
:
'请输入类别名称'
,
trigger
:
'blur'
}
]
...
...
@@ -53,7 +55,7 @@ const props = defineProps({
})
const
emit
=
defineEmits
<
{
(
e
:
'update:dialogVisible'
,
dialogVisible
:
false
):
void
(
e
:
'
confirm'
,
categoryForm
:
any
):
void
(
e
:
'
updatePage'
):
void
}
>
()
// 打开类别选择弹框
...
...
@@ -76,20 +78,27 @@ const handleCancel = () => {
}
// 确认提交表单
const
handleConfirm
=
()
=>
{
console
.
log
(
categoryForm
.
parent_id
,
'0000'
)
emit
(
'update:dialogVisible'
,
false
)
emit
(
'confirm'
,
categoryForm
)
if
(
props
.
isEdit
)
{
emit
(
'confirm'
,
{
categoryForm
,
isUpdate
:
1
,
id
:
props
.
editData
.
id
})
const
params
=
Object
.
assign
({
id
:
props
.
editData
.
idd
},
categoryForm
)
updateCategory
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新类别成功'
)
emit
(
'update:dialogVisible'
,
false
)
emit
(
'updatePage'
)
})
}
else
{
emit
(
'confirm'
,
{
categoryForm
,
isUpdate
:
0
})
const
params
=
Object
.
assign
({},
categoryForm
)
createCategory
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'新建类别成功'
)
emit
(
'update:dialogVisible'
,
false
)
emit
(
'updatePage'
)
})
}
}
onMounted
(()
=>
{
console
.
log
(
props
.
prevCategoryName
,
'props.prevCategoryName'
)
categoryForm
.
depth
=
parseInt
(
props
.
editData
.
depth
)
+
1
categoryForm
.
parent_id
=
props
.
editData
.
id
categoryForm
.
depth
=
parseInt
(
props
.
editData
?.
depth
)
+
1
||
0
categoryForm
.
parent_id
=
props
.
editData
?
.
id
categoryName
.
value
=
props
.
prevCategoryName
if
(
props
.
isEdit
)
{
categoryName
.
value
=
props
.
prevCategoryName
...
...
src/modules/admin/category/views/List.vue
浏览文件 @
aff0826a
...
...
@@ -3,7 +3,7 @@ import Sortable from 'sortablejs'
import
type
{
MoveEvent
,
SortableEvent
}
from
'sortablejs'
import
AddDialog
from
'../component/AddDialog.vue'
import
{
Operation
}
from
'@element-plus/icons-vue'
import
{
getCategoryList
,
delCategory
,
createCategory
,
updateCategory
,
moveCategory
}
from
'../api'
import
{
getCategoryList
,
delCategory
,
moveCategory
}
from
'../api'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
AppList
from
'@/components/base/AppList.vue'
...
...
@@ -15,11 +15,11 @@ const dialogVisible = ref(false)
interface
ICategory
{
pid
?:
string
category_name
:
number
category_name
:
string
depth
:
string
id
:
string
lft
:
string
need_pass
:
string
lft
?
:
string
need_pass
?
:
string
rgt
:
string
status_name
:
string
children
?:
ICategory
[]
...
...
@@ -27,7 +27,7 @@ interface ICategory {
let
tableData
=
$ref
<
ICategory
[]
>
([])
const
editData
=
ref
({})
const
isEdit
=
ref
(
false
)
const
handleEdit
=
(
index
:
number
,
row
:
ICategory
)
=>
{
const
handleEdit
=
(
row
:
ICategory
)
=>
{
title
.
value
=
'编辑类别'
isEdit
.
value
=
true
dialogVisible
.
value
=
true
...
...
@@ -39,17 +39,17 @@ const handleEdit = (index: number, row: ICategory) => {
}
}
// 删除分类
const
handleDelete
=
(
index
:
number
,
row
:
ICategory
)
=>
{
const
handleDelete
=
(
row
:
ICategory
)
=>
{
ElMessageBox
.
confirm
(
'确定要删除吗?'
,
'提示'
).
then
(()
=>
{
const
params
=
{
id
:
row
.
id
}
delCategory
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'删除成功'
)
handle
CategoryList
()
handle
Update
()
})
})
}
// 行内新增类别
const
handleAddRow
=
(
index
:
number
,
row
:
ICategory
)
=>
{
const
handleAddRow
=
(
row
:
ICategory
)
=>
{
isEdit
.
value
=
false
dialogVisible
.
value
=
true
title
.
value
=
'新增类别'
...
...
@@ -60,13 +60,13 @@ const handleAddRow = (index: number, row: ICategory) => {
prevCategoryName
.
value
=
''
}
}
// 外部新增类别
//
//
外部新增类别
const
handleAddCategory
=
()
=>
{
isEdit
.
value
=
false
dialogVisible
.
value
=
true
title
.
value
=
'新增类别'
editData
.
value
=
tableData
[
0
]
prevCategoryName
.
value
=
''
prevCategoryName
.
value
=
tableData
[
0
].
category_name
}
// 获取上级类别
const
getParent
=
(
node
:
string
,
tree
:
any
)
=>
{
...
...
@@ -86,26 +86,10 @@ const getParent = (node: string, tree: any) => {
}
// 获取分类列表
const
handle
CategoryList
=
()
=>
{
const
handle
Update
=
()
=>
{
appList
?.
refetch
()
}
// 确定
const
handleConfirm
=
(
val
:
any
)
=>
{
console
.
log
(
val
,
'val'
)
if
(
val
.
isUpdate
===
1
)
{
const
params
=
Object
.
assign
({
id
:
val
.
id
},
val
.
categoryForm
)
updateCategory
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新类别成功'
)
handleCategoryList
()
})
}
else
if
(
val
.
isUpdate
===
0
)
{
const
params
=
Object
.
assign
({},
val
.
categoryForm
)
createCategory
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'新建类别成功'
)
handleCategoryList
()
})
}
}
// 扁平列表数据
let
tableDataList
=
$ref
<
ICategory
[]
>
([])
// 列表配置
...
...
@@ -113,7 +97,8 @@ const listOptions = {
remote
:
{
httpRequest
:
getCategoryList
,
params
:
{
type
:
'tree'
,
category_name
:
''
},
callback
(
data
:
Record
<
string
,
any
>
[])
{
callback
(
data
:
ICategory
[])
{
tableData
=
data
tableDataList
=
flatten
(
data
)
return
{
list
:
data
}
}
...
...
@@ -162,7 +147,7 @@ function useSortable() {
const
relatedRow
=
tableDataList
[
newIndex
]
moveCategory
({
id
:
draggedRow
.
id
,
brother_id
:
relatedRow
.
id
,
type
:
'before'
}).
then
(()
=>
{
handle
CategoryList
()
handle
Update
()
})
}
})
...
...
@@ -178,12 +163,20 @@ onMounted(() => {
<template
#
table-drag
>
<el-icon><Operation
/></el-icon>
</
template
>
<
template
#
table-operate=
"
scope
"
>
<el-
button
type=
"primary"
@
click=
"handleEdit(scope.$index, scope.row)"
>
编辑
</el-button
>
<el-
button
@
click=
"handleAddRow(scope.$index, scope.row)"
>
新增
</el-button
>
<el-
button
@
click=
"handleDelete(scope.$index, scope.row)"
>
删除
</el-button
>
<
template
#
table-operate=
"
{ row }
"
>
<el-
link
type=
"primary"
style=
"margin-right: 5px"
@
click=
"handleEdit(row)"
>
编辑
</el-link
>
<el-
link
type=
"primary"
style=
"margin-right: 5px"
@
click=
"handleAddRow(row)"
>
新增
</el-link
>
<el-
link
type=
"primary"
@
click=
"handleDelete(row)"
>
删除
</el-link
>
</
template
>
</AppList>
</AppCard>
<AddDialog
v-model:dialogVisible=
"dialogVisible"
@
confirm=
"handleConfirm"
:editData=
"editData"
:isEdit=
"isEdit"
:title=
"title"
:prevCategoryName=
"prevCategoryName"
v-if=
"dialogVisible"
/>
<AddDialog
v-model:dialogVisible=
"dialogVisible"
@
updatePage=
"handleUpdate"
:editData=
"editData"
:isEdit=
"isEdit"
:title=
"title"
:prevCategoryName=
"prevCategoryName"
v-if=
"dialogVisible"
/>
</template>
src/modules/system/cover/api.ts
浏览文件 @
aff0826a
...
...
@@ -5,19 +5,14 @@ export function getCoverList(params?: { type?: string; page?: number; page_size?
return
httpRequest
.
get
(
'/api/resource/v1/backend/cover/list'
,
{
params
})
}
// 创建封面
export
function
createCover
(
data
?:
{
title
?:
string
;
status
?:
number
;
type
?:
number
;
url
?:
number
})
{
export
function
createCover
(
data
?:
{
title
?:
string
;
status
?:
string
;
type
?:
string
;
url
?:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/cover/create'
,
data
)
}
// 更新封面
export
function
updateCover
(
data
?:
{
title
?:
string
;
status
?:
number
;
type
?:
number
;
url
?:
number
})
{
export
function
updateCover
(
data
?:
{
id
:
any
;
title
?:
string
;
status
?:
string
;
type
?:
string
;
url
?:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/cover/update'
,
data
)
}
// 删除封面
export
function
deleteCover
(
data
:
{
id
:
any
})
{
export
function
deleteCover
(
data
:
{
id
:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/cover/delete'
,
data
)
}
// 获取公共字典列表
export
function
getMapList
()
{
return
httpRequest
.
get
(
'/api/resource/v1/util/get-data-dictionary-list'
)
}
src/modules/system/cover/component/AddDialog.vue
浏览文件 @
aff0826a
...
...
@@ -2,6 +2,7 @@
import
AppUpload
from
'@/components/base/AppUpload.vue'
import
type
{
FormInstance
,
FormRules
}
from
'element-plus'
import
{
useMapStore
}
from
'@/stores/map'
import
{
updateCover
,
createCover
}
from
'../api'
const
store
=
useMapStore
()
const
emit
=
defineEmits
<
Emits
>
()
const
ruleFormRef
=
ref
<
FormInstance
>
()
...
...
@@ -36,7 +37,7 @@ const props = defineProps({
})
interface
Emits
{
(
e
:
'update:isShowDialog'
,
isShowDialog
:
boolean
):
void
(
e
:
'
createCover'
,
form
:
any
):
void
(
e
:
'
updatePage'
):
void
}
// 取消
...
...
@@ -45,12 +46,20 @@ const handleCancel = () => {
}
// 确定
const
handleConfirm
=
()
=>
{
emit
(
'update:isShowDialog'
,
false
)
if
(
props
.
isEdit
===
true
)
{
emit
(
'createCover'
,
{
form
,
isUpdate
:
1
,
id
:
props
.
editData
.
id
})
// emit('createCover', { form, isUpdate: 1, id: props.editData.id })
const
params
=
Object
.
assign
({
id
:
props
.
editData
.
id
},
form
)
updateCover
(
params
).
then
(()
=>
{
emit
(
'update:isShowDialog'
,
false
)
emit
(
'updatePage'
)
})
}
else
{
form
.
title
=
form
.
url
emit
(
'createCover'
,
{
form
,
isUpdate
:
0
})
const
params
=
Object
.
assign
({},
form
)
createCover
(
params
).
then
(()
=>
{
emit
(
'update:isShowDialog'
,
false
)
emit
(
'updatePage'
)
})
}
}
...
...
src/modules/system/cover/views/List.vue
浏览文件 @
aff0826a
<
script
setup
lang=
"ts"
>
import
{
getCoverList
,
createCover
,
updateCover
,
deleteCover
}
from
'../api'
import
{
getCoverList
,
deleteCover
}
from
'../api'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
AddDialog
from
'../component/AddDialog.vue'
...
...
@@ -32,25 +32,13 @@ const handleDelete = (row: any) => {
const
params
:
any
=
{
id
:
row
.
id
}
deleteCover
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'删除成功'
)
appList
.
value
.
refetch
()
handleUpdate
()
})
})
}
// 确定
const
handleConfirm
=
(
val
:
any
)
=>
{
if
(
val
.
isUpdate
===
1
)
{
// 更新封面
const
params
=
Object
.
assign
({
id
:
val
.
id
},
val
.
form
)
updateCover
(
params
).
then
(()
=>
{
appList
.
value
.
refetch
()
})
}
else
{
// 添加封面
const
params
=
Object
.
assign
({},
val
.
form
)
createCover
(
params
).
then
(()
=>
{
// 刷新页面
const
handleUpdate
=
()
=>
{
appList
.
value
.
refetch
()
})
}
}
// 添加
const
handleAdd
=
()
=>
{
...
...
@@ -82,9 +70,9 @@ const handleEdit = (row: any) => {
<
template
v-if=
"isShowDialog === true"
>
<AddDialog
v-model:isShowDialog=
"isShowDialog"
@
createCover=
"handleConfirm"
:editData=
"editData"
:isEdit=
"isEdit"
@
updatePage=
"handleUpdate"
/>
</
template
>
</AppList>
...
...
src/modules/system/dictionary/api.ts
浏览文件 @
aff0826a
...
...
@@ -19,10 +19,10 @@ export function getDictionaryList(params?: {
// 新增字典
export
function
createDictionary
(
data
:
{
name
:
string
key
:
number
status
:
boolean
remark
:
string
can_edit
:
string
key
:
string
status
?:
string
remark
?
:
string
can_edit
?
:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/data-dictionary/create'
,
data
)
}
...
...
@@ -30,10 +30,10 @@ export function createDictionary(data: {
export
function
updateDictionary
(
data
:
{
id
:
string
name
:
string
key
:
number
status
:
boolean
remark
:
string
can_edit
:
string
key
:
string
status
?:
string
remark
?
:
string
can_edit
?
:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/data-dictionary/update'
,
data
)
}
...
...
@@ -48,8 +48,8 @@ export function getDictionaryItemList(params?: { data_dictionary_id: string; pag
// 新增字典的值
export
function
createDictionaryItem
(
data
:
{
data_dictionary_id
:
string
label
:
number
value
:
boolean
label
:
string
value
:
string
sort
:
string
remark
:
string
can_edit
:
string
...
...
@@ -57,12 +57,12 @@ export function createDictionaryItem(data: {
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/data-dictionary/value-create'
,
data
)
}
//
新增
字典的值
//
更新
字典的值
export
function
updateDictionaryItem
(
data
:
{
id
:
string
id
:
any
data_dictionary_id
:
string
label
:
number
value
:
boolean
label
:
string
value
:
string
sort
:
string
remark
:
string
can_edit
:
string
...
...
src/modules/system/dictionary/component/AddDialog.vue
浏览文件 @
aff0826a
<
script
lang=
"ts"
setup
>
import
{
ElMessage
}
from
'element-plus'
import
{
updateDictionary
,
createDictionary
}
from
'../api'
import
{
useMapStore
}
from
'@/stores/map'
import
type
{
FormInstance
,
FormRules
}
from
'element-plus'
...
...
@@ -9,7 +11,8 @@ const form = reactive({
name
:
''
,
key
:
''
,
status
:
'1'
,
remark
:
''
remark
:
''
,
can_edit
:
''
})
const
rules
=
reactive
<
FormRules
>
({
name
:
[{
required
:
true
,
message
:
'请输入字典名称'
,
trigger
:
'blur'
}],
...
...
@@ -31,7 +34,7 @@ const props = defineProps({
})
interface
Emits
{
(
e
:
'update:isShowDialog'
,
isShowDialog
:
boolean
):
void
(
e
:
'
confirm'
,
form
:
object
):
void
(
e
:
'
updatePage'
):
void
}
const
emit
=
defineEmits
<
Emits
>
()
...
...
@@ -47,11 +50,20 @@ const handleConfirm = async (formEl: FormInstance | undefined) => {
await
formEl
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
props
.
isEdit
===
true
)
{
const
params
=
Object
.
assign
({
id
:
props
.
rowInfo
.
id
},
form
)
updateDictionary
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新成功'
)
emit
(
'update:isShowDialog'
,
false
)
emit
(
'confirm'
,
{
form
,
isUpdate
:
1
,
id
:
props
.
rowInfo
.
id
})
emit
(
'updatePage'
)
})
}
else
{
// 新增字典
const
params
=
Object
.
assign
({},
form
)
createDictionary
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'新增成功'
)
emit
(
'update:isShowDialog'
,
false
)
emit
(
'confirm'
,
{
form
,
isUpdate
:
0
})
emit
(
'updatePage'
)
})
}
}
})
...
...
src/modules/system/dictionary/component/ListAddDialog.vue
浏览文件 @
aff0826a
<
script
lang=
"ts"
setup
>
import
{
ElMessage
}
from
'element-plus'
import
{
updateDictionaryItem
,
createDictionaryItem
}
from
'../api'
import
{
useMapStore
}
from
'@/stores/map'
import
type
{
FormInstance
,
FormRules
}
from
'element-plus'
...
...
@@ -43,11 +45,15 @@ const props = defineProps({
type
:
{
type
:
String
,
required
:
true
},
dictionaryId
:
{
type
:
String
,
required
:
true
}
})
interface
Emits
{
(
e
:
'update:isListAddDialog'
,
isListAddDialog
:
boolean
):
void
(
e
:
'
confirm'
,
form
:
object
):
void
(
e
:
'
updatePage'
):
void
}
const
emit
=
defineEmits
<
Emits
>
()
...
...
@@ -63,11 +69,23 @@ const handleConfirm = async (formEl: FormInstance | undefined) => {
await
formEl
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
props
.
isEdit
===
true
)
{
// emit('confirm', { form, isUpdate: 1, id: props.editData.id })
// 更新字典的值
const
params
=
Object
.
assign
({
id
:
props
.
editData
.
id
,
data_dictionary_id
:
props
.
dictionaryId
},
form
)
updateDictionaryItem
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新成功'
)
emit
(
'update:isListAddDialog'
,
false
)
emit
(
'confirm'
,
{
form
,
isUpdate
:
1
,
id
:
props
.
editData
.
id
})
emit
(
'updatePage'
)
})
}
else
{
// emit('confirm', { form, isUpdate: 0 })
// 新增字典的值
const
params
=
Object
.
assign
({
data_dictionary_id
:
props
.
dictionaryId
},
form
)
createDictionaryItem
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'新增成功'
)
emit
(
'update:isListAddDialog'
,
false
)
emit
(
'confirm'
,
{
form
,
isUpdate
:
0
})
emit
(
'updatePage'
)
})
}
}
})
...
...
src/modules/system/dictionary/views/List.vue
浏览文件 @
aff0826a
<
script
setup
lang=
"ts"
>
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
{
useMapStore
}
from
'@/stores/map'
import
{
getDictionaryList
,
createDictionary
,
updateDictionary
,
delDictionary
}
from
'../api'
import
{
getDictionaryList
,
delDictionary
}
from
'../api'
import
AddDialog
from
'../component/AddDialog.vue'
const
router
=
useRouter
()
...
...
@@ -73,7 +73,7 @@ const handleDelete = (row: any) => {
const
params
=
{
id
:
row
.
id
}
delDictionary
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'删除成功'
)
appList
.
value
.
refetch
()
handleUpdate
()
})
})
}
...
...
@@ -90,22 +90,8 @@ const handleList = (row: any) => {
}
// 确定
const
handleConfirm
=
(
val
:
any
)
=>
{
if
(
val
.
isUpdate
===
1
)
{
// 更新字典
const
params
=
Object
.
assign
({
id
:
val
.
id
},
val
.
form
)
updateDictionary
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新成功'
)
appList
.
value
.
refetch
()
})
}
else
{
// 新增字典
const
params
=
Object
.
assign
({},
val
.
form
)
createDictionary
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'新增成功'
)
const
handleUpdate
=
()
=>
{
appList
.
value
.
refetch
()
})
}
}
</
script
>
...
...
@@ -130,7 +116,7 @@ const handleConfirm = (val: any) => {
</el-space>
</
template
>
<
template
v-if=
"isShowDialog === true"
>
<AddDialog
v-model:isShowDialog=
"isShowDialog"
:isEdit=
"isEdit"
:rowInfo=
"rowInfo"
@
confirm=
"handleConfirm
"
/>
<AddDialog
v-model:isShowDialog=
"isShowDialog"
:isEdit=
"isEdit"
:rowInfo=
"rowInfo"
@
updatePage=
"handleUpdate
"
/>
</
template
>
</AppList>
</AppCard>
...
...
src/modules/system/dictionary/views/rowList.vue
浏览文件 @
aff0826a
<
script
setup
lang=
"ts"
>
import
{
getDictionaryItemList
,
createDictionaryItem
,
updateDictionaryItem
,
delDictionaryItem
}
from
'../api'
import
{
getDictionaryItemList
,
delDictionaryItem
}
from
'../api'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
ListAddDialog
from
'../component/ListAddDialog.vue'
...
...
@@ -8,6 +8,7 @@ const appList = ref()
const
editData
=
ref
({})
const
title
=
ref
(
''
)
const
type
=
route
.
query
.
type
as
string
const
dictionaryId
=
route
.
query
.
id
as
string
const
isEdit
=
ref
(
false
)
const
isListAddDialog
=
ref
(
false
)
const
listOptions
=
{
...
...
@@ -49,28 +50,13 @@ const handleDelete = (row: any) => {
const
params
=
{
id
:
row
.
id
}
delDictionaryItem
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'删除成功'
)
appList
.
value
.
refetch
()
handleUpdate
()
})
})
}
// 确定
const
handleConfirm
=
(
val
:
any
)
=>
{
console
.
log
(
val
.
id
,
'9999'
)
if
(
val
.
isUpdate
===
1
)
{
// 更新字典的值
const
params
=
Object
.
assign
({
id
:
val
.
id
,
data_dictionary_id
:
route
.
query
.
id
},
val
.
form
)
updateDictionaryItem
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新成功'
)
appList
.
value
.
refetch
()
})
}
else
{
// 新增字典的值
const
params
=
Object
.
assign
({
data_dictionary_id
:
route
.
query
.
id
},
val
.
form
)
createDictionaryItem
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'新增成功'
)
const
handleUpdate
=
()
=>
{
appList
.
value
.
refetch
()
})
}
}
</
script
>
...
...
@@ -91,11 +77,12 @@ const handleConfirm = (val: any) => {
<
template
v-if=
"isListAddDialog === true"
>
<ListAddDialog
v-model:isListAddDialog=
"isListAddDialog"
@
confirm=
"handleConfirm
"
@
updatePage=
"handleUpdate
"
:editData=
"editData"
:isEdit=
"isEdit"
:title=
"title"
:type=
"type"
:dictionaryId=
"dictionaryId"
/>
</
template
>
</template>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论