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
43e541f9
authored
May 16, 2023
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 移动copyValueToTarget方法到utils/index中
parent
e92361ed
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
26 deletions
+28
-26
src/utils/index.ts
+18
-0
src/utils/object.ts
+0
-18
src/views/mall/product/spu/components/BasicInfoForm.vue
+5
-4
src/views/mall/product/spu/components/DescriptionForm.vue
+1
-1
src/views/mall/product/spu/components/OtherSettingsForm.vue
+2
-1
src/views/mall/product/spu/components/SkuList.vue
+2
-2
No files found.
src/utils/index.ts
View file @
43e541f9
...
@@ -155,3 +155,21 @@ export const fileSizeFormatter = (row, column, cellValue) => {
...
@@ -155,3 +155,21 @@ export const fileSizeFormatter = (row, column, cellValue) => {
const
sizeStr
=
size
.
toFixed
(
2
)
//保留的小数位数
const
sizeStr
=
size
.
toFixed
(
2
)
//保留的小数位数
return
sizeStr
+
' '
+
unitArr
[
index
]
return
sizeStr
+
' '
+
unitArr
[
index
]
}
}
/**
* 将值复制到目标对象,且以目标对象属性为准,例:target: {a:1} source:{a:2,b:3} 结果为:{a:2}
* @param target 目标对象
* @param source 源对象
*/
export
const
copyValueToTarget
=
(
target
,
source
)
=>
{
const
newObj
=
Object
.
assign
({},
target
,
source
)
// 删除多余属性
Object
.
keys
(
newObj
).
forEach
((
key
)
=>
{
// 如果不是target中的属性则删除
if
(
Object
.
keys
(
target
).
indexOf
(
key
)
===
-
1
)
{
delete
newObj
[
key
]
}
})
// 更新目标对象值
Object
.
assign
(
target
,
newObj
)
}
src/utils/object.ts
deleted
100644 → 0
View file @
e92361ed
// TODO @puhui999:这个方法,可以考虑放到 index.js
/**
* 将值复制到目标对象,且以目标对象属性为准,例:target: {a:1} source:{a:2,b:3} 结果为:{a:2}
* @param target 目标对象
* @param source 源对象
*/
export
const
copyValueToTarget
=
(
target
,
source
)
=>
{
const
newObj
=
Object
.
assign
({},
target
,
source
)
// 删除多余属性
Object
.
keys
(
newObj
).
forEach
((
key
)
=>
{
// 如果不是target中的属性则删除
if
(
Object
.
keys
(
target
).
indexOf
(
key
)
===
-
1
)
{
delete
newObj
[
key
]
}
})
// 更新目标对象值
Object
.
assign
(
target
,
newObj
)
}
src/views/mall/product/spu/components/BasicInfoForm.vue
View file @
43e541f9
...
@@ -14,9 +14,9 @@
...
@@ -14,9 +14,9 @@
:data=
"categoryList"
:data=
"categoryList"
:props=
"defaultProps"
:props=
"defaultProps"
check-strictly
check-strictly
class=
"w-1/1"
node-key=
"id"
node-key=
"id"
placeholder=
"请选择商品分类"
placeholder=
"请选择商品分类"
class=
"w-1/1"
/>
/>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"单位"
prop=
"unit"
>
<el-form-item
label=
"单位"
prop=
"unit"
>
<el-select
v-model=
"formData.unit"
placeholder=
"请选择单位"
class=
"w-1/1
"
>
<el-select
v-model=
"formData.unit"
class=
"w-1/1"
placeholder=
"请选择单位
"
>
<el-option
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.PRODUCT_UNIT)"
v-for=
"dict in getIntDictOptions(DICT_TYPE.PRODUCT_UNIT)"
:key=
"dict.value"
:key=
"dict.value"
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"运费模板"
prop=
"deliveryTemplateId"
>
<el-form-item
label=
"运费模板"
prop=
"deliveryTemplateId"
>
<el-select
v-model=
"formData.deliveryTemplateId"
placeholder=
"请选择"
class=
"w-1/1
"
>
<el-select
v-model=
"formData.deliveryTemplateId"
class=
"w-1/1"
placeholder=
"请选择
"
>
<el-option
v-for=
"item in []"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
<el-option
v-for=
"item in []"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
@@ -112,10 +112,11 @@ import { defaultProps, handleTree } from '@/utils/tree'
...
@@ -112,10 +112,11 @@ import { defaultProps, handleTree } from '@/utils/tree'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
{
UploadImg
,
UploadImgs
}
from
'@/components/UploadFile'
import
{
UploadImg
,
UploadImgs
}
from
'@/components/UploadFile'
import
{
copyValueToTarget
}
from
'@/utils
/object
'
import
{
copyValueToTarget
}
from
'@/utils'
import
{
ProductAttributes
,
ProductAttributesAddForm
,
SkuList
}
from
'./index'
import
{
ProductAttributes
,
ProductAttributesAddForm
,
SkuList
}
from
'./index'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
propTypes
}
from
'@/utils/propTypes'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
({
const
props
=
defineProps
({
...
...
src/views/mall/product/spu/components/DescriptionForm.vue
View file @
43e541f9
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
{
Editor
}
from
'@/components/Editor'
import
{
Editor
}
from
'@/components/Editor'
import
{
PropType
}
from
'vue'
import
{
PropType
}
from
'vue'
import
{
copyValueToTarget
}
from
'@/utils
/object
'
import
{
copyValueToTarget
}
from
'@/utils'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
propTypes
}
from
'@/utils/propTypes'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
...
...
src/views/mall/product/spu/components/OtherSettingsForm.vue
View file @
43e541f9
...
@@ -53,8 +53,9 @@
...
@@ -53,8 +53,9 @@
<
script
lang=
"ts"
name=
"OtherSettingsForm"
setup
>
<
script
lang=
"ts"
name=
"OtherSettingsForm"
setup
>
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
{
PropType
}
from
'vue'
import
{
PropType
}
from
'vue'
import
{
copyValueToTarget
}
from
'@/utils
/object
'
import
{
copyValueToTarget
}
from
'@/utils'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
propTypes
}
from
'@/utils/propTypes'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
({
const
props
=
defineProps
({
...
...
src/views/mall/product/spu/components/SkuList.vue
View file @
43e541f9
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</template>
</template>
<!-- TODO @puhui999: controls-position="
right
" 可以去掉哈,不然太长了,手动输入更方便 -->
<!-- TODO @puhui999: controls-position="
" 可以去掉哈,不然太长了,手动输入更方便 -->
<el-table-column
align=
"center"
label=
"商品条码"
min-width=
"168"
>
<el-table-column
align=
"center"
label=
"商品条码"
min-width=
"168"
>
<
template
#
default=
"{ row }"
>
<
template
#
default=
"{ row }"
>
<el-input
v-model=
"row.barCode"
class=
"w-100%"
/>
<el-input
v-model=
"row.barCode"
class=
"w-100%"
/>
...
@@ -110,7 +110,7 @@ import { PropType } from 'vue'
...
@@ -110,7 +110,7 @@ import { PropType } from 'vue'
import
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
SkuType
}
from
'@/api/mall/product/management/type/skuType'
import
{
SkuType
}
from
'@/api/mall/product/management/type/skuType'
import
{
copyValueToTarget
}
from
'@/utils
/object
'
import
{
copyValueToTarget
}
from
'@/utils'
const
props
=
defineProps
({
const
props
=
defineProps
({
propFormData
:
{
propFormData
:
{
...
...
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