Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-carowner
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2bc6bd51
authored
Apr 22, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.0.1需求
1 parent
6908c246
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
19 deletions
src/api/product.js
src/views/customer/productList/index.vue
src/views/customer/scenarioManagement/addScenario.vue
src/views/customer/scenarioManagement/index.vue
src/api/product.js
View file @
2bc6bd5
...
@@ -21,4 +21,8 @@ function save(data, baseURl) {
...
@@ -21,4 +21,8 @@ function save(data, baseURl) {
}
}
})
})
}
}
export
{
getList
,
putOnOff
,
checkShopProductId
,
save
}
// 产品详情
function
productDetail
(
params
)
{
return
GlAxios
.
get
(
`
${
path
}
getById`
,
{
params
})
}
export
{
getList
,
putOnOff
,
checkShopProductId
,
save
,
productDetail
}
src/views/customer/productList/index.vue
View file @
2bc6bd5
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
type=
"text"
type=
"text"
@
click=
"handleProOnOff(scope.scope)"
@
click=
"handleProOnOff(scope.scope)"
>
{{
scope
.
scope
.
status
?
'下架'
:
'上架'
}}
</el-button>
>
{{
scope
.
scope
.
status
?
'下架'
:
'上架'
}}
</el-button>
<
!--
<
el-button
<el-button
type=
"text"
type=
"text"
@
click=
"handleProEdit(scope.scope)"
@
click=
"handleProEdit(scope.scope)"
>
指令集
</el-button>
--
>
>
编辑
</el-button
>
</span>
</span>
</d2-table>
</d2-table>
<glsx-dialog
<glsx-dialog
...
@@ -121,7 +121,7 @@ import _ from 'lodash'
...
@@ -121,7 +121,7 @@ import _ from 'lodash'
import
axios
from
'axios'
import
axios
from
'axios'
import
sign
from
'@/api/sign'
import
sign
from
'@/api/sign'
import
qs
from
'qs'
import
qs
from
'qs'
import
{
getList
,
putOnOff
,
checkShopProductId
,
save
}
from
'@/api/product'
import
{
getList
,
putOnOff
,
checkShopProductId
,
save
,
productDetail
}
from
'@/api/product'
import
{
getDict
,
batchSaveFile
}
from
'@/api/common'
import
{
getDict
,
batchSaveFile
}
from
'@/api/common'
import
{
getTypeList
}
from
'@/api/productType'
import
{
getTypeList
}
from
'@/api/productType'
...
@@ -287,6 +287,16 @@ export default {
...
@@ -287,6 +287,16 @@ export default {
this
.
$refs
.
productRuleForm
.
resetFields
()
this
.
$refs
.
productRuleForm
.
resetFields
()
}
}
},
},
handleProEdit
(
row
)
{
productDetail
({
id
:
row
.
id
}).
then
(
res
=>
{
this
.
change
(
res
.
platformKey
,
'platformKey'
)
const
arr
=
[
'id'
,
'productName'
,
'icon'
,
'iconUrl'
,
'typeId'
,
'shopProductId'
,
'platformKey'
,
'platformProductId'
,
'networkKey'
]
arr
.
forEach
(
item
=>
{
this
.
$set
(
this
.
productRuleForm
,
item
,
res
[
item
])
})
})
this
.
switchDialog
()
},
handleSubmit
()
{
handleSubmit
()
{
console
.
log
(
this
.
productRuleForm
)
console
.
log
(
this
.
productRuleForm
)
this
.
$refs
.
productRuleForm
.
validate
((
valid
)
=>
{
this
.
$refs
.
productRuleForm
.
validate
((
valid
)
=>
{
...
@@ -296,7 +306,6 @@ export default {
...
@@ -296,7 +306,6 @@ export default {
delete
params
.
iconUrl
delete
params
.
iconUrl
console
.
log
(
params
)
console
.
log
(
params
)
save
(
params
,
this
.
baseURL
).
then
(
res
=>
{
save
(
params
,
this
.
baseURL
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
)
{
if
(
res
)
{
this
.
$message
({
this
.
$message
({
type
:
'success'
,
type
:
'success'
,
...
...
src/views/customer/scenarioManagement/addScenario.vue
View file @
2bc6bd5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<el-dialog
<el-dialog
:title=
"params.basicForm.id ? '编辑场景' : '添加场景'"
:title=
"params.basicForm.id ? '编辑场景' : '添加场景'"
:visible
.
sync=
"visible"
:visible
.
sync=
"visible"
:close-on-click-modal=
"
visibl
e"
:close-on-click-modal=
"
fals
e"
:show-close=
"false"
:show-close=
"false"
>
>
<el-steps
<el-steps
...
@@ -86,6 +86,37 @@
...
@@ -86,6 +86,37 @@
>
>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
label=
"场景缩略图"
prop=
"pagePic"
>
<el-image
v-show=
"params.basicForm.pagePicUrl"
style=
"width: 100px; height: 100px"
:src=
"params.basicForm.pagePicUrl"
>
<div
slot=
"error"
class=
"image-slot"
>
<i
class=
"el-icon-picture-outline"
></i>
</div>
</el-image>
<el-button
class=
"import-btn"
style=
"display: block;"
type=
"primary"
>
上传缩略图
<input
type=
"file"
id=
"fileUpload"
class=
"import-input"
multiple=
"3"
accept=
"image/png, image/jpeg, image/jpg"
@
change=
"uploadImg($event, 'pagePic')"
/>
</el-button>
</el-form-item>
<el-form-item
label=
"场景背景图"
label=
"场景背景图"
prop=
"backPic"
prop=
"backPic"
>
>
...
@@ -105,14 +136,14 @@
...
@@ -105,14 +136,14 @@
class=
"import-btn"
class=
"import-btn"
style=
"display: block;"
style=
"display: block;"
type=
"primary"
type=
"primary"
>
上传
图片
>
上传
背景图
<input
<input
type=
"file"
type=
"file"
id=
"fileUpload"
id=
"fileUpload"
class=
"import-input"
class=
"import-input"
multiple=
"3"
multiple=
"3"
accept=
"image/png, image/jpeg, image/jpg"
accept=
"image/png, image/jpeg, image/jpg"
@
change=
"uploadImg($event)"
@
change=
"uploadImg($event
, 'backPic'
)"
/>
/>
</el-button>
</el-button>
</el-form-item>
</el-form-item>
...
@@ -193,6 +224,28 @@
...
@@ -193,6 +224,28 @@
<el-form-item
<el-form-item
v-if=
"item.paramKey == 'scene_condition_time'"
v-if=
"item.paramKey == 'scene_condition_time'"
class=
"inline"
class=
"inline"
:prop=
"'conditionList.'+index+'.paramValue.select'"
:rules=
"
{
required: true, message: '该选项不能为空', trigger: 'change'
}"
>
<el-select
v-model=
"item.paramValue.select"
placeholder=
"请选择"
@
change=
"firstChange(item.paramValue.select, index, 'condition', 'time')"
>
<el-option
v-for=
"i in timeList"
:key=
"i.label"
:label=
"i.label"
:value=
"i.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-if=
"item.paramValue.select"
class=
"inline"
:prop=
"'conditionList.'+index+'.paramValue.date'"
:prop=
"'conditionList.'+index+'.paramValue.date'"
:rules=
"
{
:rules=
"
{
required: true, message: '时间不能为空', trigger: 'change'
required: true, message: '时间不能为空', trigger: 'change'
...
@@ -484,6 +537,7 @@ export default {
...
@@ -484,6 +537,7 @@ export default {
sceneName
:
[{
required
:
true
,
message
:
'请输入场景名称'
,
trigger
:
'blur'
}],
sceneName
:
[{
required
:
true
,
message
:
'请输入场景名称'
,
trigger
:
'blur'
}],
typeKey
:
[{
required
:
true
,
message
:
'请选择场景类型'
,
trigger
:
'blur'
}],
typeKey
:
[{
required
:
true
,
message
:
'请选择场景类型'
,
trigger
:
'blur'
}],
icon
:
[{
required
:
true
,
message
:
'请选择场景图标'
,
trigger
:
'blur'
}],
icon
:
[{
required
:
true
,
message
:
'请选择场景图标'
,
trigger
:
'blur'
}],
pagePic
:
[{
required
:
true
,
message
:
'请上传场景缩略图'
,
trigger
:
'change'
}],
backPic
:
[{
required
:
true
,
message
:
'请上传场景背景图'
,
trigger
:
'change'
}]
backPic
:
[{
required
:
true
,
message
:
'请上传场景背景图'
,
trigger
:
'change'
}]
},
},
iconList
:
[],
iconList
:
[],
...
@@ -494,6 +548,11 @@ export default {
...
@@ -494,6 +548,11 @@ export default {
condition
:
[{
required
:
true
,
message
:
'请选择场景触发条件'
,
trigger
:
'change'
}],
condition
:
[{
required
:
true
,
message
:
'请选择场景触发条件'
,
trigger
:
'change'
}],
executeCycle
:
[{
required
:
true
,
message
:
'请选择场景执行周期'
,
trigger
:
'change'
}]
executeCycle
:
[{
required
:
true
,
message
:
'请选择场景执行周期'
,
trigger
:
'change'
}]
},
},
timeList
:
[
{
label
:
'手动设置'
,
value
:
1
},
{
label
:
'时间大于'
,
value
:
2
},
{
label
:
'时间小于'
,
value
:
3
}
],
cycleList
:
[
cycleList
:
[
{
label
:
'每天'
,
value
:
1
},
{
label
:
'每天'
,
value
:
1
},
{
label
:
'工作日'
,
value
:
2
},
{
label
:
'工作日'
,
value
:
2
},
...
@@ -529,7 +588,6 @@ export default {
...
@@ -529,7 +588,6 @@ export default {
created
()
{
created
()
{
// 场景类型
// 场景类型
getDict
({
dictType
:
'scene_classification'
}).
then
(
res
=>
(
this
.
typeList
=
res
))
getDict
({
dictType
:
'scene_classification'
}).
then
(
res
=>
(
this
.
typeList
=
res
))
// 场景触发条件
// 场景触发条件
getDict
({
dictType
:
'scene_condition'
}).
then
(
res
=>
(
this
.
sceneCondition
=
res
.
slice
(
1
)))
getDict
({
dictType
:
'scene_condition'
}).
then
(
res
=>
(
this
.
sceneCondition
=
res
.
slice
(
1
)))
getConditionList
({}).
then
(
res
=>
(
this
.
deviceConditionList
=
res
))
getConditionList
({}).
then
(
res
=>
(
this
.
deviceConditionList
=
res
))
...
@@ -539,9 +597,7 @@ export default {
...
@@ -539,9 +597,7 @@ export default {
},
},
watch
:
{
watch
:
{
visible
(
val
)
{
visible
(
val
)
{
console
.
log
(
val
)
if
(
val
&&
this
.
params
.
basicForm
.
id
)
{
if
(
val
&&
this
.
params
.
basicForm
.
id
)
{
console
.
log
(
this
.
params
)
const
conditionList
=
this
.
params
.
conditionList
const
conditionList
=
this
.
params
.
conditionList
const
contentList
=
this
.
params
.
contentList
const
contentList
=
this
.
params
.
contentList
conditionList
.
forEach
(
item
=>
{
conditionList
.
forEach
(
item
=>
{
...
@@ -608,7 +664,7 @@ export default {
...
@@ -608,7 +664,7 @@ export default {
})
})
},
},
handleParams
()
{
handleParams
()
{
const
basicForm
=
this
.
clearObject
(
this
.
params
.
basicForm
,
[
'backPicUrl'
,
'iconUrl'
])
const
basicForm
=
this
.
clearObject
(
this
.
params
.
basicForm
,
[
'backPicUrl'
,
'
pagePicUrl'
,
'
iconUrl'
])
const
conditionList
=
_
.
cloneDeep
(
this
.
params
.
conditionList
).
map
(
item
=>
this
.
clearObject
(
item
,
[
'list'
,
'noValue'
,
'key'
]))
const
conditionList
=
_
.
cloneDeep
(
this
.
params
.
conditionList
).
map
(
item
=>
this
.
clearObject
(
item
,
[
'list'
,
'noValue'
,
'key'
]))
const
contentList
=
_
.
cloneDeep
(
this
.
params
.
contentList
).
map
(
item
=>
this
.
clearObject
(
item
,
[
'list'
,
'lastList'
,
'key'
,
'orderType'
]))
const
contentList
=
_
.
cloneDeep
(
this
.
params
.
contentList
).
map
(
item
=>
this
.
clearObject
(
item
,
[
'list'
,
'lastList'
,
'key'
,
'orderType'
]))
const
templateList
=
conditionList
.
concat
(
contentList
)
const
templateList
=
conditionList
.
concat
(
contentList
)
...
@@ -649,7 +705,7 @@ export default {
...
@@ -649,7 +705,7 @@ export default {
this
.
params
.
basicForm
.
iconUrl
=
this
.
iconList
.
find
(
item
=>
item
.
id
==
val
).
url
this
.
params
.
basicForm
.
iconUrl
=
this
.
iconList
.
find
(
item
=>
item
.
id
==
val
).
url
},
},
// 上传图片
// 上传图片
uploadImg
(
e
)
{
uploadImg
(
e
,
name
)
{
// // 转码base64
// // 转码base64
const
reader
=
new
FileReader
()
const
reader
=
new
FileReader
()
reader
.
readAsDataURL
(
e
.
target
.
files
[
0
])
reader
.
readAsDataURL
(
e
.
target
.
files
[
0
])
...
@@ -664,10 +720,10 @@ export default {
...
@@ -664,10 +720,10 @@ export default {
this
.
request
({
this
.
request
({
fileName
:
e
.
target
.
files
[
0
].
name
.
split
(
'.'
)[
0
],
fileName
:
e
.
target
.
files
[
0
].
name
.
split
(
'.'
)[
0
],
file
:
fileInfo
file
:
fileInfo
},
'glsx.accounts.biz.common.pictureUpload'
,
iconObj
)
},
'glsx.accounts.biz.common.pictureUpload'
,
iconObj
,
name
)
}
}
},
},
request
(
params
=
{},
method
,
targetObj
,
noSignAttr
=
[
'file'
])
{
request
(
params
=
{},
method
,
targetObj
,
n
ame
,
n
oSignAttr
=
[
'file'
])
{
const
fileUploadURL
=
this
.
$get_session_common_config
().
axios
.
fileUploadURL
const
fileUploadURL
=
this
.
$get_session_common_config
().
axios
.
fileUploadURL
params
.
source
=
'glsx-oss-carowner'
params
.
source
=
'glsx-oss-carowner'
params
.
app_key
=
'48e5e13229b82c1b4e6e8c96151f0637'
params
.
app_key
=
'48e5e13229b82c1b4e6e8c96151f0637'
...
@@ -678,12 +734,12 @@ export default {
...
@@ -678,12 +734,12 @@ export default {
const
data
=
sign
(
params
,
noSignAttr
)
const
data
=
sign
(
params
,
noSignAttr
)
axios
.
post
(
`
${
fileUploadURL
}
/router?method=
${
method
}
`
,
qs
.
stringify
(
data
)).
then
(
res
=>
{
axios
.
post
(
`
${
fileUploadURL
}
/router?method=
${
method
}
`
,
qs
.
stringify
(
data
)).
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
if
(
res
.
status
===
200
)
{
this
.
$set
(
this
.
params
.
basicForm
,
'backPicUrl'
,
res
.
data
.
data
)
this
.
$set
(
this
.
params
.
basicForm
,
`
${
name
}
Url`
,
res
.
data
.
data
)
targetObj
.
url
=
res
.
data
.
data
targetObj
.
url
=
res
.
data
.
data
}
}
const
fileData
=
new
Array
(
targetObj
)
const
fileData
=
new
Array
(
targetObj
)
return
batchSaveFile
(
fileData
,
this
.
baseURL
)
return
batchSaveFile
(
fileData
,
this
.
baseURL
)
}).
then
(
r
=>
(
this
.
params
.
basicForm
.
backPic
=
r
[
0
].
id
))
}).
then
(
r
=>
(
this
.
params
.
basicForm
[
name
]
=
r
[
0
].
id
))
},
},
switchDialog
()
{
switchDialog
()
{
this
.
$emit
(
'hideDialog'
)
this
.
$emit
(
'hideDialog'
)
...
@@ -714,8 +770,9 @@ export default {
...
@@ -714,8 +770,9 @@ export default {
else
if
(
name
===
'content'
)
this
.
params
.
contentList
[
index
].
paramValue
=
_
.
cloneDeep
(
this
.
defalutContentObj
.
paramValue
)
else
if
(
name
===
'content'
)
this
.
params
.
contentList
[
index
].
paramValue
=
_
.
cloneDeep
(
this
.
defalutContentObj
.
paramValue
)
},
},
// 设备状态第二个下拉框
// 设备状态第二个下拉框
firstChange
(
e
,
index
,
name
)
{
firstChange
(
e
,
index
,
name
,
type
)
{
if
(
name
===
'condition'
)
{
if
(
name
===
'condition'
)
{
if
(
type
!==
'time'
)
{
const
arr
=
this
.
deviceConditionList
.
find
(
item
=>
item
.
id
===
e
).
conditionList
const
arr
=
this
.
deviceConditionList
.
find
(
item
=>
item
.
id
===
e
).
conditionList
const
value
=
this
.
params
.
conditionList
[
index
].
paramValue
const
value
=
this
.
params
.
conditionList
[
index
].
paramValue
value
.
list
=
arr
value
.
list
=
arr
...
@@ -725,6 +782,7 @@ export default {
...
@@ -725,6 +782,7 @@ export default {
})
})
if
(
value
.
id
)
this
.
$set
(
value
,
'id'
,
null
)
if
(
value
.
id
)
this
.
$set
(
value
,
'id'
,
null
)
if
(
value
.
noValue
)
value
.
noValue
=
false
if
(
value
.
noValue
)
value
.
noValue
=
false
}
}
else
{
}
else
{
const
arr
=
this
.
deviceContentList
.
find
(
item
=>
item
.
id
===
e
).
contentList
const
arr
=
this
.
deviceContentList
.
find
(
item
=>
item
.
id
===
e
).
contentList
const
value
=
this
.
params
.
contentList
[
index
].
paramValue
const
value
=
this
.
params
.
contentList
[
index
].
paramValue
...
@@ -737,7 +795,6 @@ export default {
...
@@ -737,7 +795,6 @@ export default {
},
},
// 设备状态三个下拉框
// 设备状态三个下拉框
secondChange
(
e
,
index
,
name
)
{
secondChange
(
e
,
index
,
name
)
{
console
.
log
(
e
)
if
(
name
===
'condition'
)
{
if
(
name
===
'condition'
)
{
const
obj
=
this
.
params
.
conditionList
[
index
].
paramValue
.
list
.
find
(
item
=>
item
.
id
===
e
)
const
obj
=
this
.
params
.
conditionList
[
index
].
paramValue
.
list
.
find
(
item
=>
item
.
id
===
e
)
const
paramValue
=
this
.
params
.
conditionList
[
index
].
paramValue
const
paramValue
=
this
.
params
.
conditionList
[
index
].
paramValue
...
@@ -750,6 +807,7 @@ export default {
...
@@ -750,6 +807,7 @@ export default {
const
obj
=
this
.
params
.
contentList
[
index
].
paramValue
.
list
.
find
(
item
=>
item
.
id
===
e
)
const
obj
=
this
.
params
.
contentList
[
index
].
paramValue
.
list
.
find
(
item
=>
item
.
id
===
e
)
const
paramValue
=
this
.
params
.
contentList
[
index
].
paramValue
const
paramValue
=
this
.
params
.
contentList
[
index
].
paramValue
paramValue
.
valType
=
obj
.
orderValueType
paramValue
.
valType
=
obj
.
orderValueType
paramValue
.
order
=
obj
.
orderCode
paramValue
.
orderType
=
obj
.
orderType
paramValue
.
orderType
=
obj
.
orderType
const
id
=
obj
.
id
const
id
=
obj
.
id
if
(
obj
.
orderType
==
2
)
{
if
(
obj
.
orderType
==
2
)
{
...
...
src/views/customer/scenarioManagement/index.vue
View file @
2bc6bd5
...
@@ -87,6 +87,8 @@ export default {
...
@@ -87,6 +87,8 @@ export default {
id
:
''
,
id
:
''
,
backPic
:
''
,
backPic
:
''
,
backPicUrl
:
''
,
backPicUrl
:
''
,
pagePic
:
''
,
pagePicUrl
:
''
,
description
:
''
,
description
:
''
,
icon
:
''
,
icon
:
''
,
iconUrl
:
''
,
iconUrl
:
''
,
...
@@ -105,6 +107,8 @@ export default {
...
@@ -105,6 +107,8 @@ export default {
id
:
''
,
id
:
''
,
backPic
:
''
,
backPic
:
''
,
backPicUrl
:
''
,
backPicUrl
:
''
,
pagePic
:
''
,
pagePicUrl
:
''
,
description
:
''
,
description
:
''
,
icon
:
''
,
icon
:
''
,
iconUrl
:
''
,
iconUrl
:
''
,
...
@@ -164,6 +168,7 @@ export default {
...
@@ -164,6 +168,7 @@ export default {
const
{
scenarioParams
}
=
this
const
{
scenarioParams
}
=
this
for
(
const
i
in
scenarioParams
.
basicForm
)
{
for
(
const
i
in
scenarioParams
.
basicForm
)
{
if
(
i
===
'backPicUrl'
)
this
.
$set
(
scenarioParams
,
'backPicUrl'
,
res
[
i
])
if
(
i
===
'backPicUrl'
)
this
.
$set
(
scenarioParams
,
'backPicUrl'
,
res
[
i
])
if
(
i
===
'pagePicUrl'
)
this
.
$set
(
scenarioParams
,
'pagePicUrl'
,
res
[
i
])
scenarioParams
.
basicForm
[
i
]
=
res
[
i
]
scenarioParams
.
basicForm
[
i
]
=
res
[
i
]
}
}
for
(
const
i
in
scenarioParams
.
scenarioRuleForm
)
{
for
(
const
i
in
scenarioParams
.
scenarioRuleForm
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment