Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4a1a1ab2
authored
Feb 14, 2023
by
xingyuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: table-v2
parent
2ec69784
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
362 additions
and
142 deletions
+362
-142
src/types/auto-components.d.ts
+1
-8
src/types/auto-imports.d.ts
+1
-0
src/views/system/notice/index.vue
+109
-134
src/views/system/notice/indexd.vue
+148
-0
src/views/system/notice/indexh.vue
+103
-0
No files found.
src/types/auto-components.d.ts
View file @
4a1a1ab2
...
...
@@ -21,6 +21,7 @@ declare module '@vue/runtime-core' {
DictTag
:
typeof
import
(
'./../components/DictTag/src/DictTag.vue'
)[
'default'
]
Echart
:
typeof
import
(
'./../components/Echart/src/Echart.vue'
)[
'default'
]
Editor
:
typeof
import
(
'./../components/Editor/src/Editor.vue'
)[
'default'
]
ElAutoResizer
:
typeof
import
(
'element-plus/es'
)[
'ElAutoResizer'
]
ElBadge
:
typeof
import
(
'element-plus/es'
)[
'ElBadge'
]
ElButton
:
typeof
import
(
'element-plus/es'
)[
'ElButton'
]
ElButtonGroup
:
typeof
import
(
'element-plus/es'
)[
'ElButtonGroup'
]
...
...
@@ -51,14 +52,10 @@ declare module '@vue/runtime-core' {
ElIcon
:
typeof
import
(
'element-plus/es'
)[
'ElIcon'
]
ElImageViewer
:
typeof
import
(
'element-plus/es'
)[
'ElImageViewer'
]
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
ElInputNumber
:
typeof
import
(
'element-plus/es'
)[
'ElInputNumber'
]
ElLink
:
typeof
import
(
'element-plus/es'
)[
'ElLink'
]
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
ElPagination
:
typeof
import
(
'element-plus/es'
)[
'ElPagination'
]
ElPopover
:
typeof
import
(
'element-plus/es'
)[
'ElPopover'
]
ElRadio
:
typeof
import
(
'element-plus/es'
)[
'ElRadio'
]
ElRadioButton
:
typeof
import
(
'element-plus/es'
)[
'ElRadioButton'
]
ElRadioGroup
:
typeof
import
(
'element-plus/es'
)[
'ElRadioGroup'
]
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
ElScrollbar
:
typeof
import
(
'element-plus/es'
)[
'ElScrollbar'
]
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
...
...
@@ -69,11 +66,7 @@ declare module '@vue/runtime-core' {
ElTableV2
:
typeof
import
(
'element-plus/es'
)[
'ElTableV2'
]
ElTabPane
:
typeof
import
(
'element-plus/es'
)[
'ElTabPane'
]
ElTabs
:
typeof
import
(
'element-plus/es'
)[
'ElTabs'
]
ElTag
:
typeof
import
(
'element-plus/es'
)[
'ElTag'
]
ElTooltip
:
typeof
import
(
'element-plus/es'
)[
'ElTooltip'
]
ElTransfer
:
typeof
import
(
'element-plus/es'
)[
'ElTransfer'
]
ElTree
:
typeof
import
(
'element-plus/es'
)[
'ElTree'
]
ElTreeSelect
:
typeof
import
(
'element-plus/es'
)[
'ElTreeSelect'
]
ElUpload
:
typeof
import
(
'element-plus/es'
)[
'ElUpload'
]
Error
:
typeof
import
(
'./../components/Error/src/Error.vue'
)[
'default'
]
FlowCondition
:
typeof
import
(
'./../components/bpmnProcessDesigner/package/penal/flow-condition/FlowCondition.vue'
)[
'default'
]
...
...
src/types/auto-imports.d.ts
View file @
4a1a1ab2
...
...
@@ -3,6 +3,7 @@ export {}
declare
global
{
const
DICT_TYPE
:
typeof
import
(
'@/utils/dict'
)[
'DICT_TYPE'
]
const
EffectScope
:
typeof
import
(
'vue'
)[
'EffectScope'
]
const
ElButton
:
typeof
import
(
'element-plus/es'
)[
'ElButton'
]
const
computed
:
typeof
import
(
'vue'
)[
'computed'
]
const
createApp
:
typeof
import
(
'vue'
)[
'createApp'
]
const
customRef
:
typeof
import
(
'vue'
)[
'customRef'
]
...
...
src/views/system/notice/index.vue
View file @
4a1a1ab2
<
template
>
<ContentWrap>
<!-- 列表 -->
<XTable
@
register=
"registerTable"
>
<!-- 操作:新增 -->
<template
#
toolbar_buttons
>
<XButton
type=
"primary"
preIcon=
"ep:zoom-in"
:title=
"t('action.add')"
v-hasPermi=
"['system:notice:create']"
@
click=
"handleCreate()"
/>
</
template
>
<
template
#
actionbtns_default=
"{ row }"
>
<!-- 操作:修改 -->
<XTextButton
preIcon=
"ep:edit"
:title=
"t('action.edit')"
v-hasPermi=
"['system:notice:update']"
@
click=
"handleUpdate(row.id)"
/>
<!-- 操作:详情 -->
<XTextButton
preIcon=
"ep:view"
:title=
"t('action.detail')"
v-hasPermi=
"['system:notice:query']"
@
click=
"handleDetail(row.id)"
/>
<!-- 操作:删除 -->
<XTextButton
preIcon=
"ep:delete"
:title=
"t('action.del')"
v-hasPermi=
"['system:notice:delete']"
@
click=
"deleteData(row.id)"
/>
</
template
>
</XTable>
</ContentWrap>
<!-- 弹窗 -->
<XModal
id=
"noticeModel"
v-model=
"dialogVisible"
:title=
"dialogTitle"
>
<!-- 对话框(添加 / 修改) -->
<Form
ref=
"formRef"
v-if=
"['create', 'update'].includes(actionType)"
:schema=
"allSchemas.formSchema"
:rules=
"rules"
/>
<!-- 对话框(详情) -->
<Descriptions
v-if=
"actionType === 'detail'"
:schema=
"allSchemas.detailSchema"
:data=
"detailData"
>
<
template
#
content=
"{ row }"
>
<Editor
:model-value=
"row.content"
:readonly=
"true"
/>
</
template
>
</Descriptions>
<
template
#
footer
>
<!-- 按钮:保存 -->
<XButton
v-if=
"['create', 'update'].includes(actionType)"
type=
"primary"
:title=
"t('action.save')"
:loading=
"actionLoading"
@
click=
"submitForm()"
<el-form
ref=
"searchForm"
:model=
"queryParms"
:inline=
"true"
>
<el-form-item
label=
"公告标题"
>
<el-input
v-model=
"queryParms.title"
/>
</el-form-item>
<el-form-item
label=
"状态"
>
<el-select
v-model=
"queryParms.status"
>
<el-option
label=
"全部"
value=
""
/>
<el-option
label=
"开启"
:value=
"1"
/>
<el-option
label=
"关闭"
:value=
"0"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"getList"
>
Query
</el-button>
</el-form-item>
</el-form>
<div
style=
"width: 100%; height: 500px"
>
<el-auto-resizer>
<template
#
default=
"
{ height, width }">
<el-table-v2
:columns=
"columns"
:data=
"tableData"
:width=
"width"
:height=
"height"
fixed
/>
</
template
>
</el-auto-resizer>
<el-pagination
:current-page=
"queryParms.pageNo"
:page-size=
"queryParms.pageSize"
layout=
"total, prev, pager, next"
:total=
"tableTotal"
@
size-change=
"getList"
@
current-change=
"getList"
/>
<!-- 按钮:关闭 -->
<XButton
:loading=
"actionLoading"
:title=
"t('dialog.close')"
@
click=
"dialogVisible = false"
/>
</
template
>
</XModal>
</div>
</ContentWrap>
</template>
<
script
setup
lang=
"ts
"
name=
"Notice
"
>
import
type
{
FormExpose
}
from
'@/components/Form
'
// 业务相关的 import
<
script
setup
lang=
"ts
x
"
>
import
dayjs
from
'dayjs
'
import
{
Column
,
ElPagination
,
ElTableV2
,
TableV2FixedDir
}
from
'element-plus'
import
*
as
NoticeApi
from
'@/api/system/notice'
import
{
rules
,
allSchemas
}
from
'./notice.data'
import
{
XTextButton
}
from
'@/components/XButton'
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
// 列表相关的变量
const
[
registerTable
,
{
reload
,
deleteData
}]
=
useXTable
({
allSchemas
:
allSchemas
,
getListApi
:
NoticeApi
.
getNoticePageApi
,
deleteApi
:
NoticeApi
.
deleteNoticeApi
})
// 弹窗相关的变量
const
dialogVisible
=
ref
(
false
)
// 是否显示弹出层
const
dialogTitle
=
ref
(
'edit'
)
// 弹出层标题
const
actionType
=
ref
(
''
)
// 操作按钮的类型
const
actionLoading
=
ref
(
false
)
// 按钮 Loading
const
formRef
=
ref
<
FormExpose
>
()
// 表单 Ref
const
detailData
=
ref
()
// 详情 Ref
// 设置标题
const
setDialogTile
=
(
type
:
string
)
=>
{
dialogTitle
.
value
=
t
(
'action.'
+
type
)
actionType
.
value
=
type
dialogVisible
.
value
=
true
}
const
columns
:
Column
<
any
>
[]
=
[
{
key
:
'id'
,
dataKey
:
'id'
,
//需要渲染当前列的数据字段,如{id:9527,name:'Mike'},则填id
title
:
'id'
,
//显示在单元格表头的文本
width
:
80
,
//当前列的宽度,必须设置
fixed
:
true
//是否固定列
},
{
key
:
'title'
,
dataKey
:
'title'
,
title
:
'公告标题'
,
width
:
180
},
{
key
:
'type'
,
dataKey
:
'type'
,
title
:
'公告类型'
,
width
:
180
},
{
key
:
'status'
,
dataKey
:
'status'
,
title
:
t
(
'common.status'
),
width
:
180
},
{
key
:
'content'
,
dataKey
:
'content'
,
title
:
'公告内容'
,
width
:
400
,
cellRenderer
:
({
cellData
:
content
})
=>
<
span
v
-
html
=
{
content
}
><
/span
>
},
{
key
:
'createTime'
,
dataKey
:
'createTime'
,
title
:
t
(
'common.createTime'
),
width
:
180
,
cellRenderer
:
({
cellData
:
createTime
})
=>
(
<>
{
dayjs
(
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)}
<
/
>
)
},
{
key
:
'actionbtns'
,
dataKey
:
'actionbtns'
,
//需要渲染当前列的数据字段,如{id:9527,name:'Mike'},则填id
title
:
'操作'
,
//显示在单元格表头的文本
width
:
80
,
//当前列的宽度,必须设置
fixed
:
TableV2FixedDir
.
RIGHT
,
//是否固定列
align
:
'center'
,
cellRenderer
:
({
cellData
:
id
})
=>
(
<
XTextButton
preIcon
=
"ep:delete"
title
=
{
t
(
'action.del'
)}
onClick
=
{
handleDelete
.
bind
(
this
,
id
)}
><
/XTextButton
>
)
}
]
// 新增操作
const
handleCreate
=
()
=>
{
setDialogTile
(
'create'
)
}
const
tableData
=
ref
([])
// 修改操作
const
handleUpdate
=
async
(
rowId
:
number
)
=>
{
setDialogTile
(
'update'
)
// 设置数据
const
res
=
await
NoticeApi
.
getNoticeApi
(
rowId
)
unref
(
formRef
)?.
setValues
(
res
)
}
const
tableTotal
=
ref
(
0
)
// 详情操作
const
handleDetail
=
async
(
rowId
:
number
)
=>
{
setDialogTile
(
'detail'
)
// 设置数据
const
res
=
await
NoticeApi
.
getNoticeApi
(
rowId
)
detailData
.
value
=
res
const
queryParms
=
reactive
({
title
:
''
,
status
:
undefined
,
pageNo
:
1
,
pageSize
:
10
})
const
getList
=
async
()
=>
{
const
res
=
await
NoticeApi
.
getNoticePageApi
(
queryParms
)
tableData
.
value
=
res
.
list
tableTotal
.
value
=
res
.
total
}
// 提交新增/修改的表单
const
submitForm
=
async
()
=>
{
const
elForm
=
unref
(
formRef
)?.
getElFormRef
()
if
(
!
elForm
)
return
elForm
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
actionLoading
.
value
=
true
// 提交请求
try
{
const
data
=
unref
(
formRef
)?.
formModel
as
NoticeApi
.
NoticeVO
if
(
actionType
.
value
===
'create'
)
{
await
NoticeApi
.
createNoticeApi
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
await
NoticeApi
.
updateNoticeApi
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
}
dialogVisible
.
value
=
false
}
finally
{
actionLoading
.
value
=
false
await
reload
()
}
}
})
const
handleDelete
=
(
id
)
=>
{
console
.
info
(
id
)
}
getList
()
</
script
>
src/views/system/notice/indexd.vue
0 → 100644
View file @
4a1a1ab2
<
template
>
<ContentWrap>
<!-- 列表 -->
<XTable
@
register=
"registerTable"
>
<!-- 操作:新增 -->
<template
#
toolbar_buttons
>
<XButton
type=
"primary"
preIcon=
"ep:zoom-in"
:title=
"t('action.add')"
v-hasPermi=
"['system:notice:create']"
@
click=
"handleCreate()"
/>
</
template
>
<
template
#
actionbtns_default=
"{ row }"
>
<!-- 操作:修改 -->
<XTextButton
preIcon=
"ep:edit"
:title=
"t('action.edit')"
v-hasPermi=
"['system:notice:update']"
@
click=
"handleUpdate(row.id)"
/>
<!-- 操作:详情 -->
<XTextButton
preIcon=
"ep:view"
:title=
"t('action.detail')"
v-hasPermi=
"['system:notice:query']"
@
click=
"handleDetail(row.id)"
/>
<!-- 操作:删除 -->
<XTextButton
preIcon=
"ep:delete"
:title=
"t('action.del')"
v-hasPermi=
"['system:notice:delete']"
@
click=
"deleteData(row.id)"
/>
</
template
>
</XTable>
</ContentWrap>
<!-- 弹窗 -->
<XModal
id=
"noticeModel"
v-model=
"dialogVisible"
:title=
"dialogTitle"
>
<!-- 对话框(添加 / 修改) -->
<Form
ref=
"formRef"
v-if=
"['create', 'update'].includes(actionType)"
:schema=
"allSchemas.formSchema"
:rules=
"rules"
/>
<!-- 对话框(详情) -->
<Descriptions
v-if=
"actionType === 'detail'"
:schema=
"allSchemas.detailSchema"
:data=
"detailData"
>
<
template
#
content=
"{ row }"
>
<Editor
:model-value=
"row.content"
:readonly=
"true"
/>
</
template
>
</Descriptions>
<
template
#
footer
>
<!-- 按钮:保存 -->
<XButton
v-if=
"['create', 'update'].includes(actionType)"
type=
"primary"
:title=
"t('action.save')"
:loading=
"actionLoading"
@
click=
"submitForm()"
/>
<!-- 按钮:关闭 -->
<XButton
:loading=
"actionLoading"
:title=
"t('dialog.close')"
@
click=
"dialogVisible = false"
/>
</
template
>
</XModal>
</template>
<
script
setup
lang=
"ts"
name=
"Notice"
>
import
type
{
FormExpose
}
from
'@/components/Form'
// 业务相关的 import
import
*
as
NoticeApi
from
'@/api/system/notice'
import
{
rules
,
allSchemas
}
from
'./notice.data'
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
// 列表相关的变量
const
[
registerTable
,
{
reload
,
deleteData
}]
=
useXTable
({
allSchemas
:
allSchemas
,
getListApi
:
NoticeApi
.
getNoticePageApi
,
deleteApi
:
NoticeApi
.
deleteNoticeApi
})
// 弹窗相关的变量
const
dialogVisible
=
ref
(
false
)
// 是否显示弹出层
const
dialogTitle
=
ref
(
'edit'
)
// 弹出层标题
const
actionType
=
ref
(
''
)
// 操作按钮的类型
const
actionLoading
=
ref
(
false
)
// 按钮 Loading
const
formRef
=
ref
<
FormExpose
>
()
// 表单 Ref
const
detailData
=
ref
()
// 详情 Ref
// 设置标题
const
setDialogTile
=
(
type
:
string
)
=>
{
dialogTitle
.
value
=
t
(
'action.'
+
type
)
actionType
.
value
=
type
dialogVisible
.
value
=
true
}
// 新增操作
const
handleCreate
=
()
=>
{
setDialogTile
(
'create'
)
}
// 修改操作
const
handleUpdate
=
async
(
rowId
:
number
)
=>
{
setDialogTile
(
'update'
)
// 设置数据
const
res
=
await
NoticeApi
.
getNoticeApi
(
rowId
)
unref
(
formRef
)?.
setValues
(
res
)
}
// 详情操作
const
handleDetail
=
async
(
rowId
:
number
)
=>
{
setDialogTile
(
'detail'
)
// 设置数据
const
res
=
await
NoticeApi
.
getNoticeApi
(
rowId
)
detailData
.
value
=
res
}
// 提交新增/修改的表单
const
submitForm
=
async
()
=>
{
const
elForm
=
unref
(
formRef
)?.
getElFormRef
()
if
(
!
elForm
)
return
elForm
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
actionLoading
.
value
=
true
// 提交请求
try
{
const
data
=
unref
(
formRef
)?.
formModel
as
NoticeApi
.
NoticeVO
if
(
actionType
.
value
===
'create'
)
{
await
NoticeApi
.
createNoticeApi
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
await
NoticeApi
.
updateNoticeApi
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
}
dialogVisible
.
value
=
false
}
finally
{
actionLoading
.
value
=
false
await
reload
()
}
}
})
}
</
script
>
src/views/system/notice/indexh.vue
0 → 100644
View file @
4a1a1ab2
<
template
>
<ContentWrap>
<div
style=
"width: 100%; height: 500px"
>
<el-auto-resizer>
<template
#
default=
"
{ height, width }">
<el-table-v2
:columns=
"columns"
:data=
"tableData"
:width=
"width"
:height=
"height"
fixed
/>
</
template
>
</el-auto-resizer>
<el-pagination
:current-page=
"queryParms.pageNo"
:page-size=
"queryParms.pageSize"
layout=
"total, prev, pager, next"
:total=
"tableTotal"
@
size-change=
"getList"
@
current-change=
"getList"
/>
</div>
</ContentWrap>
</template>
<
script
setup
lang=
"ts"
>
import
{
Column
,
TableV2FixedDir
}
from
'element-plus'
import
*
as
NoticeApi
from
'@/api/system/notice'
import
{
XTextButton
}
from
'@/components/XButton'
const
{
t
}
=
useI18n
()
// 国际化
const
columns
:
Column
<
any
>
[]
=
[
{
key
:
'id'
,
dataKey
:
'id'
,
//需要渲染当前列的数据字段,如{id:9527,name:'Mike'},则填id
title
:
'id'
,
//显示在单元格表头的文本
width
:
80
,
//当前列的宽度,必须设置
fixed
:
true
//是否固定列
},
{
key
:
'title'
,
dataKey
:
'title'
,
title
:
'公告标题'
,
width
:
180
},
{
key
:
'type'
,
dataKey
:
'type'
,
title
:
'公告类型'
,
width
:
180
},
{
key
:
'status'
,
dataKey
:
'status'
,
title
:
t
(
'common.status'
),
width
:
180
},
{
key
:
'content'
,
dataKey
:
'content'
,
title
:
'公告内容'
,
width
:
180
},
{
key
:
'createTime'
,
dataKey
:
'createTime'
,
title
:
t
(
'common.createTime'
),
width
:
180
},
{
key
:
'actionbtns'
,
dataKey
:
'actionbtns'
,
//需要渲染当前列的数据字段,如{id:9527,name:'Mike'},则填id
title
:
'操作'
,
//显示在单元格表头的文本
width
:
80
,
//当前列的宽度,必须设置
fixed
:
TableV2FixedDir
.
RIGHT
,
//是否固定列
align
:
'center'
,
cellRenderer
:
(
date
)
=>
h
(
XTextButton
,
{
onClick
:
()
=>
handleDelete
(
date
.
rowData
),
type
:
'danger'
,
preIcon
:
'ep:delete'
,
title
:
t
(
'action.del'
)
})
}
]
const
tableData
=
ref
([])
const
tableTotal
=
ref
(
0
)
const
queryParms
=
reactive
({
title
:
''
,
status
:
undefined
,
pageNo
:
1
,
pageSize
:
10
})
const
getList
=
async
()
=>
{
const
res
=
await
NoticeApi
.
getNoticePageApi
(
queryParms
)
tableData
.
value
=
res
.
list
tableTotal
.
value
=
res
.
total
}
const
handleDelete
=
(
row
)
=>
{
console
.
info
(
row
.
id
)
}
getList
()
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment