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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
28 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) {
}
})
}
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 @@
type=
"text"
@
click=
"handleProOnOff(scope.scope)"
>
{{
scope
.
scope
.
status
?
'下架'
:
'上架'
}}
</el-button>
<
!--
<
el-button
<el-button
type=
"text"
@
click=
"handleProEdit(scope.scope)"
>
指令集
</el-button>
--
>
>
编辑
</el-button
>
</span>
</d2-table>
<glsx-dialog
...
...
@@ -121,7 +121,7 @@ import _ from 'lodash'
import
axios
from
'axios'
import
sign
from
'@/api/sign'
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
{
getTypeList
}
from
'@/api/productType'
...
...
@@ -287,6 +287,16 @@ export default {
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
()
{
console
.
log
(
this
.
productRuleForm
)
this
.
$refs
.
productRuleForm
.
validate
((
valid
)
=>
{
...
...
@@ -296,7 +306,6 @@ export default {
delete
params
.
iconUrl
console
.
log
(
params
)
save
(
params
,
this
.
baseURL
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
)
{
this
.
$message
({
type
:
'success'
,
...
...
src/views/customer/scenarioManagement/addScenario.vue
View file @
2bc6bd5
...
...
@@ -3,7 +3,7 @@
<el-dialog
:title=
"params.basicForm.id ? '编辑场景' : '添加场景'"
:visible
.
sync=
"visible"
:close-on-click-modal=
"
visibl
e"
:close-on-click-modal=
"
fals
e"
:show-close=
"false"
>
<el-steps
...
...
@@ -86,6 +86,37 @@
>
</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=
"场景背景图"
prop=
"backPic"
>
...
...
@@ -105,14 +136,14 @@
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)"
@
change=
"uploadImg($event
, 'backPic'
)"
/>
</el-button>
</el-form-item>
...
...
@@ -193,6 +224,28 @@
<el-form-item
v-if=
"item.paramKey == 'scene_condition_time'"
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'"
:rules=
"
{
required: true, message: '时间不能为空', trigger: 'change'
...
...
@@ -484,6 +537,7 @@ export default {
sceneName
:
[{
required
:
true
,
message
:
'请输入场景名称'
,
trigger
:
'blur'
}],
typeKey
:
[{
required
:
true
,
message
:
'请选择场景类型'
,
trigger
:
'blur'
}],
icon
:
[{
required
:
true
,
message
:
'请选择场景图标'
,
trigger
:
'blur'
}],
pagePic
:
[{
required
:
true
,
message
:
'请上传场景缩略图'
,
trigger
:
'change'
}],
backPic
:
[{
required
:
true
,
message
:
'请上传场景背景图'
,
trigger
:
'change'
}]
},
iconList
:
[],
...
...
@@ -494,6 +548,11 @@ export default {
condition
:
[{
required
:
true
,
message
:
'请选择场景触发条件'
,
trigger
:
'change'
}],
executeCycle
:
[{
required
:
true
,
message
:
'请选择场景执行周期'
,
trigger
:
'change'
}]
},
timeList
:
[
{
label
:
'手动设置'
,
value
:
1
},
{
label
:
'时间大于'
,
value
:
2
},
{
label
:
'时间小于'
,
value
:
3
}
],
cycleList
:
[
{
label
:
'每天'
,
value
:
1
},
{
label
:
'工作日'
,
value
:
2
},
...
...
@@ -529,7 +588,6 @@ export default {
created
()
{
// 场景类型
getDict
({
dictType
:
'scene_classification'
}).
then
(
res
=>
(
this
.
typeList
=
res
))
// 场景触发条件
getDict
({
dictType
:
'scene_condition'
}).
then
(
res
=>
(
this
.
sceneCondition
=
res
.
slice
(
1
)))
getConditionList
({}).
then
(
res
=>
(
this
.
deviceConditionList
=
res
))
...
...
@@ -539,9 +597,7 @@ export default {
},
watch
:
{
visible
(
val
)
{
console
.
log
(
val
)
if
(
val
&&
this
.
params
.
basicForm
.
id
)
{
console
.
log
(
this
.
params
)
const
conditionList
=
this
.
params
.
conditionList
const
contentList
=
this
.
params
.
contentList
conditionList
.
forEach
(
item
=>
{
...
...
@@ -608,7 +664,7 @@ export default {
})
},
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
contentList
=
_
.
cloneDeep
(
this
.
params
.
contentList
).
map
(
item
=>
this
.
clearObject
(
item
,
[
'list'
,
'lastList'
,
'key'
,
'orderType'
]))
const
templateList
=
conditionList
.
concat
(
contentList
)
...
...
@@ -649,7 +705,7 @@ export default {
this
.
params
.
basicForm
.
iconUrl
=
this
.
iconList
.
find
(
item
=>
item
.
id
==
val
).
url
},
// 上传图片
uploadImg
(
e
)
{
uploadImg
(
e
,
name
)
{
// // 转码base64
const
reader
=
new
FileReader
()
reader
.
readAsDataURL
(
e
.
target
.
files
[
0
])
...
...
@@ -664,10 +720,10 @@ export default {
this
.
request
({
fileName
:
e
.
target
.
files
[
0
].
name
.
split
(
'.'
)[
0
],
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
params
.
source
=
'glsx-oss-carowner'
params
.
app_key
=
'48e5e13229b82c1b4e6e8c96151f0637'
...
...
@@ -678,12 +734,12 @@ export default {
const
data
=
sign
(
params
,
noSignAttr
)
axios
.
post
(
`
${
fileUploadURL
}
/router?method=
${
method
}
`
,
qs
.
stringify
(
data
)).
then
(
res
=>
{
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
}
const
fileData
=
new
Array
(
targetObj
)
return
batchSaveFile
(
fileData
,
this
.
baseURL
)
}).
then
(
r
=>
(
this
.
params
.
basicForm
.
backPic
=
r
[
0
].
id
))
}).
then
(
r
=>
(
this
.
params
.
basicForm
[
name
]
=
r
[
0
].
id
))
},
switchDialog
()
{
this
.
$emit
(
'hideDialog'
)
...
...
@@ -714,17 +770,19 @@ export default {
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'
)
{
const
arr
=
this
.
deviceConditionList
.
find
(
item
=>
item
.
id
===
e
).
conditionList
const
value
=
this
.
params
.
conditionList
[
index
].
paramValue
value
.
list
=
arr
const
valueArr
=
[
'order'
,
'orderCondition'
,
'orderId'
,
'orderVal'
,
'value'
]
valueArr
.
forEach
(
item
=>
{
if
(
value
[
item
])
value
[
item
]
=
''
})
if
(
value
.
id
)
this
.
$set
(
value
,
'id'
,
null
)
if
(
value
.
noValue
)
value
.
noValue
=
false
if
(
type
!==
'time'
)
{
const
arr
=
this
.
deviceConditionList
.
find
(
item
=>
item
.
id
===
e
).
conditionList
const
value
=
this
.
params
.
conditionList
[
index
].
paramValue
value
.
list
=
arr
const
valueArr
=
[
'order'
,
'orderCondition'
,
'orderId'
,
'orderVal'
,
'value'
]
valueArr
.
forEach
(
item
=>
{
if
(
value
[
item
])
value
[
item
]
=
''
})
if
(
value
.
id
)
this
.
$set
(
value
,
'id'
,
null
)
if
(
value
.
noValue
)
value
.
noValue
=
false
}
}
else
{
const
arr
=
this
.
deviceContentList
.
find
(
item
=>
item
.
id
===
e
).
contentList
const
value
=
this
.
params
.
contentList
[
index
].
paramValue
...
...
@@ -737,7 +795,6 @@ export default {
},
// 设备状态三个下拉框
secondChange
(
e
,
index
,
name
)
{
console
.
log
(
e
)
if
(
name
===
'condition'
)
{
const
obj
=
this
.
params
.
conditionList
[
index
].
paramValue
.
list
.
find
(
item
=>
item
.
id
===
e
)
const
paramValue
=
this
.
params
.
conditionList
[
index
].
paramValue
...
...
@@ -750,6 +807,7 @@ export default {
const
obj
=
this
.
params
.
contentList
[
index
].
paramValue
.
list
.
find
(
item
=>
item
.
id
===
e
)
const
paramValue
=
this
.
params
.
contentList
[
index
].
paramValue
paramValue
.
valType
=
obj
.
orderValueType
paramValue
.
order
=
obj
.
orderCode
paramValue
.
orderType
=
obj
.
orderType
const
id
=
obj
.
id
if
(
obj
.
orderType
==
2
)
{
...
...
src/views/customer/scenarioManagement/index.vue
View file @
2bc6bd5
...
...
@@ -87,6 +87,8 @@ export default {
id
:
''
,
backPic
:
''
,
backPicUrl
:
''
,
pagePic
:
''
,
pagePicUrl
:
''
,
description
:
''
,
icon
:
''
,
iconUrl
:
''
,
...
...
@@ -105,6 +107,8 @@ export default {
id
:
''
,
backPic
:
''
,
backPicUrl
:
''
,
pagePic
:
''
,
pagePicUrl
:
''
,
description
:
''
,
icon
:
''
,
iconUrl
:
''
,
...
...
@@ -164,6 +168,7 @@ export default {
const
{
scenarioParams
}
=
this
for
(
const
i
in
scenarioParams
.
basicForm
)
{
if
(
i
===
'backPicUrl'
)
this
.
$set
(
scenarioParams
,
'backPicUrl'
,
res
[
i
])
if
(
i
===
'pagePicUrl'
)
this
.
$set
(
scenarioParams
,
'pagePicUrl'
,
res
[
i
])
scenarioParams
.
basicForm
[
i
]
=
res
[
i
]
}
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