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