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
5a5202d4
authored
Apr 02, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REVIEW 商品属性
parent
616243a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
31 deletions
+44
-31
src/api/mall/product/property.ts
+1
-1
src/views/mall/product/category/index.vue
+1
-0
src/views/mall/product/property/PropertyForm.vue
+8
-7
src/views/mall/product/property/index.vue
+34
-23
No files found.
src/api/mall/product/property.ts
View file @
5a5202d4
...
...
@@ -61,7 +61,7 @@ export const getProperty = (id: number): Promise<PropertyVO> => {
}
// 获得属性项分页
export
const
getPropertyPage
=
(
params
:
PageParam
&
any
)
=>
{
export
const
getPropertyPage
=
(
params
:
PageParam
)
=>
{
return
request
.
get
({
url
:
'/product/property/page'
,
params
})
}
...
...
src/views/mall/product/category/index.vue
View file @
5a5202d4
...
...
@@ -14,6 +14,7 @@
placeholder=
"请输入分类名称"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item>
...
...
src/views/mall/product/property/
f
orm.vue
→
src/views/mall/product/property/
PropertyF
orm.vue
View file @
5a5202d4
...
...
@@ -24,7 +24,6 @@
</template>
<
script
setup
lang=
"ts"
>
import
*
as
PropertyApi
from
'@/api/mall/product/property'
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
...
...
@@ -32,18 +31,17 @@ const modelVisible = ref(false) // 弹窗的是否展示
const
modelTitle
=
ref
(
''
)
// 弹窗的标题
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formType
=
ref
(
''
)
// 表单的类型:create - 新增;update - 修改
const
defaultFormData
:
PropertyApi
.
PropertyVO
=
{
const
formData
=
ref
(
{
id
:
undefined
,
name
:
''
}
const
formData
=
ref
({
...
defaultFormData
})
})
const
formRules
=
reactive
({
name
:
[{
required
:
true
,
message
:
'名称不能为空'
,
trigger
:
'blur'
}]
})
const
formRef
=
ref
()
// 表单 Ref
/** 打开弹窗 */
const
open
Modal
=
async
(
type
:
string
,
id
?:
number
)
=>
{
const
open
=
async
(
type
:
string
,
id
?:
number
)
=>
{
modelVisible
.
value
=
true
modelTitle
.
value
=
t
(
'action.'
+
type
)
formType
.
value
=
type
...
...
@@ -58,7 +56,7 @@ const openModal = async (type: string, id?: number) => {
}
}
}
defineExpose
({
open
Modal
})
// 提供 openModal
方法,用于打开弹窗
defineExpose
({
open
})
// 提供 open
方法,用于打开弹窗
/** 提交表单 */
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
...
...
@@ -88,7 +86,10 @@ const submitForm = async () => {
/** 重置表单 */
const
resetForm
=
()
=>
{
formData
.
value
=
{
...
defaultFormData
}
formData
.
value
=
{
id
:
undefined
,
name
:
''
}
formRef
.
value
?.
resetFields
()
}
</
script
>
src/views/mall/product/property/index.vue
View file @
5a5202d4
<
template
>
<content-wrap>
<!-- 搜索工作栏 -->
<el-form
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<!-- 搜索工作栏 -->
<ContentWrap>
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"名称"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入名称"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
...
...
@@ -15,31 +22,32 @@
v-model=
"queryParams.createTime"
value-format=
"YYYY-MM-DD HH:mm:ss"
type=
"daterange"
range-separator=
"-"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
<el-button
type=
"primary"
@
click=
"openModal('create')"
v-hasPermi=
"['infra:config:create']"
>
<el-button
plain
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['product:property:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<el-table
v-loading=
"loading"
:data=
"list"
align=
"center"
>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"编号"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"名称"
align=
"center"
:show-overflow-tooltip=
"true"
>
<template
#
default=
"scope"
>
<router-link
:to=
"'/property/value/' + scope.row.id"
class=
"link-type"
>
<span>
{{
scope
.
row
.
name
}}
</span>
</router-link>
</
template
>
</el-table-column>
<el-table-column
label=
"名称"
align=
"center"
/>
<el-table-column
label=
"备注"
align=
"center"
prop=
"remark"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"创建时间"
...
...
@@ -53,16 +61,19 @@
<el-button
link
type=
"primary"
@
click=
"open
Modal
('update', scope.row.id)"
v-hasPermi=
"['
infra:config
:update']"
@
click=
"open
Form
('update', scope.row.id)"
v-hasPermi=
"['
product:property
:update']"
>
编辑
</el-button>
<el-button
link
type=
"primary"
>
<router-link
:to=
"'/property/value/' + scope.row.id"
>
属性值
</router-link>
</el-button>
<el-button
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['
infra:config
:delete']"
v-hasPermi=
"['
product:property
:delete']"
>
删除
</el-button>
...
...
@@ -76,15 +87,15 @@
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</
content-w
rap>
</
ContentW
rap>
<!-- 表单弹窗:添加/修改 -->
<
property-form
ref=
"modal
Ref"
@
success=
"getList"
/>
<
PropertyForm
ref=
"form
Ref"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
name=
"Config"
>
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
*
as
PropertyApi
from
'@/api/mall/product/property'
import
PropertyForm
from
'./
f
orm.vue'
import
PropertyForm
from
'./
PropertyF
orm.vue'
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
...
...
@@ -124,9 +135,9 @@ const resetQuery = () => {
}
/** 添加/修改操作 */
const
modal
Ref
=
ref
()
const
open
Modal
=
(
type
:
string
,
id
?:
number
)
=>
{
modalRef
.
value
.
openModal
(
type
,
id
)
const
form
Ref
=
ref
()
const
open
Form
=
(
type
:
string
,
id
?:
number
)
=>
{
formRef
.
value
.
open
(
type
,
id
)
}
/** 删除按钮操作 */
...
...
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