Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-outbound
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 534476a6
authored
Dec 01, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v3.22.0' into 'master'
V3.22.0 See merge request
!25
2 parents
23137f42
f1b531cc
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
866 additions
and
202 deletions
src/api/modules/questionnaire.js
src/assets/css/public.scss
src/common/constant.js
src/views/questionnaire/add.vue
src/views/questionnaire/components/StepOne/CouponItem.vue
src/views/questionnaire/components/StepOne/EquityItem.vue
src/views/questionnaire/components/StepOne/RedEnvelopeItem.vue
src/views/questionnaire/components/StepOne/index.vue
src/views/questionnaire/components/StepTwo/EditQuestions.vue
src/views/questionnaire/components/StepTwo/index.vue
src/views/questionnaire/index.vue
src/views/redEnvelope/components/common/fun.js
src/api/modules/questionnaire.js
View file @
534476a
...
@@ -25,10 +25,10 @@ export default {
...
@@ -25,10 +25,10 @@ export default {
})
})
},
},
/**
/**
*
结束调查问卷
*
更新调查问卷状态
*/
*/
closeQuestionnaire
(
params
)
{
updateQuestionnaireStatus
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.
clos
e'
params
.
method
=
'marketing.api.activityQuestionnaireForm.
status.updat
e'
return
http
({
return
http
({
url
,
url
,
data
:
params
data
:
params
...
@@ -45,7 +45,7 @@ export default {
...
@@ -45,7 +45,7 @@ export default {
})
})
},
},
/**导出用户调查问卷 */
/**导出用户调查问卷 */
exportUserQuestionnaireList
(
params
)
{
exportUserQuestionnaireList
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireUserForm.export'
params
.
method
=
'marketing.api.activityQuestionnaireUserForm.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -71,7 +71,7 @@ export default {
...
@@ -71,7 +71,7 @@ export default {
})
})
},
},
/**
/**
*
*
查询调查问卷详情
*/
*/
getQuestionnaireDetail
(
params
=
{})
{
getQuestionnaireDetail
(
params
=
{})
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.detail'
params
.
method
=
'marketing.api.activityQuestionnaireForm.detail'
...
@@ -94,7 +94,7 @@ export default {
...
@@ -94,7 +94,7 @@ export default {
method
:
'scrm.api.coupon.list.merchant'
,
method
:
'scrm.api.coupon.list.merchant'
,
validType
:
'valid'
,
validType
:
'valid'
,
directionalFlag
:
1
,
directionalFlag
:
1
,
pageSize
:
2
0
,
pageSize
:
10
0
,
discountTypes
:
[
2
,
3
,
4
],
discountTypes
:
[
2
,
3
,
4
],
status
:
2
,
status
:
2
,
...
params
...
params
...
@@ -113,5 +113,16 @@ export default {
...
@@ -113,5 +113,16 @@ export default {
url
,
url
,
data
:
params
,
data
:
params
,
})
})
}
},
/**
* 更新调查问卷
*/
updateQuestionnaire
(
params
)
{
params
.
method
=
'marketing.api.activityQuestionnaireForm.update'
return
http
({
url
,
data
:
params
,
})
},
}
}
\ No newline at end of file
\ No newline at end of file
src/assets/css/public.scss
View file @
534476a
...
@@ -118,3 +118,22 @@ img{
...
@@ -118,3 +118,22 @@ img{
width
:
auto
!
important
;
width
:
auto
!
important
;
height
:
auto
!
important
;
height
:
auto
!
important
;
}
}
.over-box
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
height
:
100%
;
font-size
:
16px
;
color
:
#333333
;
gap
:
8px
;
.el-icon-warning
{
font-size
:
48px
;
color
:
#e6a23c
;
}
.tips
{
font-size
:
14px
;
color
:
#666666
;
max-width
:
80%
;
}
}
\ No newline at end of file
\ No newline at end of file
src/common/constant.js
View file @
534476a
...
@@ -192,6 +192,40 @@ const activityStatusList = [
...
@@ -192,6 +192,40 @@ const activityStatusList = [
{
text
:
'红包已用完'
,
id
:
2
},
{
text
:
'红包已用完'
,
id
:
2
},
{
text
:
'活动已结束'
,
id
:
3
}
{
text
:
'活动已结束'
,
id
:
3
}
]
]
const
transformData
=
(
data
,
childrenDepth
)
=>
{
const
result
=
[]
data
.
forEach
(
item
=>
{
const
levels
=
item
.
split
(
'/'
)
let
currentLevel
=
result
for
(
let
i
=
0
;
i
<
childrenDepth
;
i
++
)
{
const
label
=
levels
[
i
],
value
=
label
,
existingOption
=
currentLevel
&&
currentLevel
.
find
((
option
)
=>
option
.
label
===
label
)
if
(
existingOption
)
{
if
(
i
===
childrenDepth
-
1
)
continue
if
(
existingOption
.
children
)
currentLevel
=
existingOption
.
children
}
else
{
if
(
label
&&
value
)
{
const
newOption
=
{
label
,
value
}
if
(
levels
[
i
+
1
])
newOption
.
children
=
[]
currentLevel
.
push
(
newOption
)
if
(
i
===
childrenDepth
-
1
)
delete
newOption
.
children
currentLevel
=
newOption
.
children
}
}
}
})
return
result
}
const
checkSpace
=
(
rule
,
value
,
callback
,
target
)
=>
{
const
{
field
,
message
}
=
rule
if
(
!
value
)
callback
(
new
Error
(
message
))
else
if
(
!
value
.
trim
())
callback
(
new
Error
(
rule
.
message
))
else
{
target
[
field
]
=
value
.
trim
()
callback
()
}
}
export
{
export
{
limitPrice
,
limitPrice
,
orderManageStatusList
,
orderManageStatusList
,
...
@@ -205,5 +239,7 @@ export {
...
@@ -205,5 +239,7 @@ export {
orderStatusList
,
orderStatusList
,
exportFn
,
exportFn
,
getExplorer
,
getExplorer
,
activityStatusList
activityStatusList
,
transformData
,
checkSpace
}
}
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/add.vue
View file @
534476a
<
template
>
<
template
>
<div
class=
"layout"
v-loading=
"loading"
>
<div
class=
"layout"
v-loading=
"loading"
>
<div
class=
"tabs flex"
>
<div
class=
"tabs flex"
>
<template
v-for=
"(i,index) in tabs"
>
<template
v-for=
"(i,index) in tabs"
>
<template>
<template>
...
@@ -27,10 +30,13 @@
...
@@ -27,10 +30,13 @@
<step-one
<step-one
v-show=
"step == 1"
v-show=
"step == 1"
ref=
"stepOne"
ref=
"stepOne"
:disabled=
"disabled"
/>
/>
<step-two
<step-two
v-show=
"step == 2"
v-show=
"step == 2"
ref=
"stepTwo"
ref=
"stepTwo"
:disabled=
"disabled"
:userInfoFieldList=
"userInfoFieldList"
/>
/>
</div>
</div>
<GLFooter
class=
"footer"
>
<GLFooter
class=
"footer"
>
...
@@ -42,7 +48,7 @@
...
@@ -42,7 +48,7 @@
type=
"primary"
type=
"primary"
@
click=
"handleConfirm"
@
click=
"handleConfirm"
size=
"medium"
size=
"medium"
>
{{step == 1?'下一步':'提交'}}
</el-button>
>
{{step == 1?'下一步':
disabled ? '返回' :
'提交'}}
</el-button>
</GLFooter>
</GLFooter>
</div>
</div>
</template>
</template>
...
@@ -50,6 +56,7 @@
...
@@ -50,6 +56,7 @@
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
import
StepOne
from
'./components/StepOne/index.vue'
import
StepOne
from
'./components/StepOne/index.vue'
import
StepTwo
from
'./components/StepTwo/index.vue'
import
StepTwo
from
'./components/StepTwo/index.vue'
import
{
transformData
}
from
'@/common/constant'
export
default
{
export
default
{
components
:
{
StepOne
,
StepTwo
},
components
:
{
StepOne
,
StepTwo
},
name
:
''
,
name
:
''
,
...
@@ -58,44 +65,143 @@ export default {
...
@@ -58,44 +65,143 @@ export default {
parsedData
:
[],
parsedData
:
[],
step
:
1
,
step
:
1
,
tabs
:
[
'基本信息'
,
'配置内容'
],
tabs
:
[
'基本信息'
,
'配置内容'
],
loading
:
false
loading
:
false
,
disabled
:
false
,
fromId
:
''
,
isEdit
:
false
,
userInfoFieldList
:
[]
}
}
},
},
mounted
()
{
mounted
()
{
const
{
id
,
type
}
=
this
.
$route
.
query
if
(
id
)
{
this
.
loading
=
true
this
.
fromId
=
id
this
.
disabled
=
!
type
this
.
getQuestionnaireDetail
()
this
.
isEdit
=
type
}
this
.
getUserInfoFieldList
()
},
},
methods
:
{
methods
:
{
async
getQuestionnaireDetail
()
{
try
{
const
data
=
await
this
.
$apis
.
questionnaire
.
getQuestionnaireDetail
({
id
:
this
.
fromId
}),
{
$refs
:
{
stepOne
,
stepTwo
}
}
=
this
this
.
setStepOneData
(
stepOne
,
data
)
this
.
setStepTwoData
(
stepTwo
,
data
)
this
.
loading
=
false
}
catch
(
error
)
{
setTimeout
(()
=>
this
.
$router
.
go
(
-
1
),
1.5e3
)
}
},
async
getUserInfoFieldList
()
{
if
(
this
.
disabled
)
return
const
res
=
await
this
.
$apis
.
questionnaire
.
getUserInfoFieldList
()
this
.
userInfoFieldList
=
res
||
[]
},
setStepOneData
(
stepOne
,
data
)
{
stepOne
.
merchantObj
.
data
=
[{
confId
:
data
.
merchantId
,
confName
:
data
.
merchantName
}]
stepOne
.
configForm
=
{
name
:
data
.
name
,
merchantId
:
data
.
merchantId
,
cardTitle
:
data
.
cardTitle
,
cardCover
:
data
.
cardCover
,
activityId
:
data
.
activityId
,
merchantName
:
data
.
merchantName
,
activityType
:
data
.
activityType
}
if
(
data
.
activityType
)
{
stepOne
.
tabsObj
.
index
=
{
1
:
0
,
2
:
2
,
3
:
3
}[
data
.
activityType
]
}
if
(
!
this
.
disabled
||
data
.
activityId
)
{
stepOne
.
activityObj
.
flag
=
false
stepOne
.
getActivityList
()
}
},
setStepTwoData
(
stepTwo
,
res
)
{
stepTwo
.
configForm
=
{
title
:
res
.
title
,
desc
:
res
.
desc
,
questions
:
res
.
questions
,
}
res
.
questions
.
map
(
e
=>
{
let
{
type
,
option
,
maxLength
}
=
e
,
data
=
void
0
if
(
type
!=
3
)
{
data
=
option
.
split
(
'\n'
)
if
(
type
==
5
)
{
const
[,
two
,
three
]
=
data
[
0
].
split
(
'/'
)
data
.
splice
(
0
,
1
)
data
=
transformData
(
data
,
three
?
3
:
two
?
2
:
1
)
}
}
else
{
data
=
maxLength
option
=
maxLength
}
stepTwo
.
questionsList
.
push
({
type
,
required
:
e
.
required
,
text
:
e
.
text
,
userInfoField
:
e
.
userInfoField
,
option
,
data
,
itemValue
:
type
==
2
||
type
==
5
?
[]
:
''
})
})
},
handleCancel
()
{
handleCancel
()
{
const
{
step
}
=
this
const
{
step
}
=
this
step
==
1
?
this
.
$router
.
go
(
-
1
)
:
this
.
step
=
1
step
==
1
?
this
.
$router
.
go
(
-
1
)
:
this
.
step
=
1
},
},
handleConfirm
()
{
handleConfirm
(
autoJump
=
true
)
{
const
{
step
,
$refs
:
{
const
{
step
,
isEdit
,
fromId
,
disabled
,
$refs
:
{
stepOne
,
stepOne
,
stepTwo
stepTwo
}
}
=
this
}
}
=
this
,
apiName
=
fromId
?
'updateQuestionnaire'
:
'addQuestionnaire'
if
(
step
==
1
)
{
if
(
step
==
1
)
{
stepOne
.
formRef
().
validate
(
valid
=>
{
stepOne
.
formRef
().
validate
(
valid
=>
{
if
(
valid
)
this
.
step
=
2
if
(
valid
)
this
.
step
=
2
})
})
}
else
{
}
else
{
if
(
disabled
)
return
this
.
$router
.
go
(
-
1
)
stepTwo
.
formRef
().
validate
(
async
valid
=>
{
stepTwo
.
formRef
().
validate
(
async
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
loading
=
true
this
.
loading
=
true
try
{
try
{
const
params
=
{
const
params
=
{
...
stepOne
.
configForm
,
...
stepOne
.
configForm
,
...
stepTwo
.
configForm
,
...
stepTwo
.
configForm
status
:
1
}
},
res
=
await
this
.
$apis
.
questionnaire
.
addQuestionnaire
(
params
)
if
(
fromId
)
params
.
id
=
fromId
cons
ole
.
log
(
re
s
)
cons
t
res
=
await
this
.
$apis
.
questionnaire
[
apiName
](
param
s
)
if
(
res
)
{
if
(
res
)
{
if
(
autoJump
)
{
this
.
$message
({
this
.
$message
({
message
:
'创建成功'
,
message
:
isEdit
?
'编辑成功'
:
'创建成功'
,
type
:
'success'
type
:
'success'
})
})
this
.
$router
.
go
(
-
1
)
this
.
$router
.
go
(
-
1
)
}
else
{
this
.
fromId
=
res
.
id
this
.
loading
=
false
}
}
}
else
throw
'创建失败'
else
throw
isEdit
?
'编辑失败'
:
'创建失败'
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
loading
=
false
this
.
loading
=
false
if
(
error
)
this
.
$message
.
error
(
error
)
if
(
error
)
this
.
$message
.
error
(
error
)
...
@@ -103,7 +209,8 @@ export default {
...
@@ -103,7 +209,8 @@ export default {
}
}
})
})
}
}
}
},
}
}
}
}
...
...
src/views/questionnaire/components/StepOne/CouponItem.vue
View file @
534476a
<
template
>
<
template
>
<div
<div
@
click=
"chooseRed(data.id)"
@
click=
"chooseRed(data.id)"
:class=
"['item',
{'active':configForm.activityId == data.id}]"
:class=
"['item',
{'
disabled':disabled},{'
active':configForm.activityId == data.id}]"
>
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
src=
"@/assets/red-radio.png"
/>
<img
src=
"@/assets/red-radio.png"
/>
...
@@ -38,7 +38,8 @@ export default {
...
@@ -38,7 +38,8 @@ export default {
configForm
:
{
configForm
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
}
default
:
()
=>
{
}
}
},
disabled
:
Boolean
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -49,8 +50,10 @@ export default {
...
@@ -49,8 +50,10 @@ export default {
},
},
methods
:
{
methods
:
{
chooseRed
(
id
)
{
chooseRed
(
id
)
{
const
{
activityId
}
=
this
.
configForm
const
{
activityId
}
=
this
.
configForm
,
if
(
activityId
&&
activityId
==
id
)
id
=
''
{
disabled
}
=
this
if
(
disabled
)
return
if
(
activityId
&&
activityId
==
id
)
id
=
''
this
.
$emit
(
'choose'
,
id
)
this
.
$emit
(
'choose'
,
id
)
}
}
}
}
...
@@ -105,4 +108,7 @@ export default {
...
@@ -105,4 +108,7 @@ export default {
background-color
:
#5850ff
;
background-color
:
#5850ff
;
}
}
}
}
.disabled
{
cursor
:
not-allowed
;
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/EquityItem.vue
View file @
534476a
<
template
>
<
template
>
<div
<div
@
click=
"chooseRed(data.equityClassId)"
@
click=
"chooseRed(data.equityClassId)"
:class=
"['item',
{'active':configForm.activityId == data.equityClassId}]"
:class=
"['item',
{'
disabled':disabled},{'
active':configForm.activityId == data.equityClassId}]"
>
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
src=
"@/assets/red-radio.png"
/>
<img
src=
"@/assets/red-radio.png"
/>
...
@@ -25,7 +25,8 @@ export default {
...
@@ -25,7 +25,8 @@ export default {
configForm
:
{
configForm
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
}
default
:
()
=>
{
}
}
},
disabled
:
Boolean
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -36,8 +37,10 @@ export default {
...
@@ -36,8 +37,10 @@ export default {
},
},
methods
:
{
methods
:
{
chooseRed
(
id
)
{
chooseRed
(
id
)
{
const
{
activityId
}
=
this
.
configForm
const
{
activityId
}
=
this
.
configForm
,
if
(
activityId
&&
activityId
==
id
)
id
=
''
{
disabled
}
=
this
if
(
disabled
)
return
if
(
activityId
&&
activityId
==
id
)
id
=
''
this
.
$emit
(
'choose'
,
id
)
this
.
$emit
(
'choose'
,
id
)
}
}
}
}
...
@@ -98,4 +101,7 @@ export default {
...
@@ -98,4 +101,7 @@ export default {
background-color
:
#5850ff
;
background-color
:
#5850ff
;
}
}
}
}
.disabled
{
cursor
:
not-allowed
;
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/RedEnvelopeItem.vue
View file @
534476a
<
template
>
<
template
>
<div
<div
@
click=
"chooseRed(data.id)"
@
click=
"chooseRed(data.id)"
:class=
"['item',
{'active':configForm.activityId == data.id}]"
:class=
"['item',
{'
disabled':disabled},{'
active':configForm.activityId == data.id}]"
>
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
src=
"@/assets/red-radio.png"
/>
<img
src=
"@/assets/red-radio.png"
/>
...
@@ -26,7 +26,8 @@ export default {
...
@@ -26,7 +26,8 @@ export default {
configForm
:
{
configForm
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
}
default
:
()
=>
{
}
}
}
,
disabled
:
Boolean
}
,
}
,
data
()
{
data
()
{
return
{
return
{
...
@@ -37,8 +38,10 @@ export default {
...
@@ -37,8 +38,10 @@ export default {
}
,
}
,
methods
:
{
methods
:
{
chooseRed
(
id
)
{
chooseRed
(
id
)
{
const
{
activityId
}
=
this
.
configForm
const
{
activityId
}
=
this
.
configForm
,
if
(
activityId
&&
activityId
==
id
)
id
=
''
{
disabled
}
=
this
if
(
disabled
)
return
if
(
activityId
&&
activityId
==
id
)
id
=
''
this
.
$emit
(
'choose'
,
id
)
this
.
$emit
(
'choose'
,
id
)
}
}
}
}
...
@@ -88,4 +91,7 @@ export default {
...
@@ -88,4 +91,7 @@ export default {
background
-
color
:
#
5850
ff
;
background
-
color
:
#
5850
ff
;
}
}
}
}
.
disabled
{
cursor
:
not
-
allowed
;
}
<
/style>
<
/style>
\ No newline at end of file
\ No newline at end of file
src/views/questionnaire/components/StepOne/index.vue
View file @
534476a
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
v-reachbottom=
"onReachBottom"
v-reachbottom=
"onReachBottom"
@
focus=
"selectFocus"
@
focus=
"selectFocus"
:loading=
"loading"
:loading=
"loading"
:disabled=
"disabled"
@
change=
"change"
>
>
<el-option
<el-option
v-for=
"item in merchantObj.data"
v-for=
"item in merchantObj.data"
...
@@ -37,15 +39,15 @@
...
@@ -37,15 +39,15 @@
</template>
</template>
<
template
#
activity
>
<
template
#
activity
>
<div
class=
"tabs flex"
>
<div
class=
"tabs flex"
>
<template
v-for=
"(i,index) in tabsObj.data"
>
<template
v-for=
"(i,
index) in tabsObj.data"
>
<template>
<template>
<el-button
<el-button
type=
"text"
type=
"text"
@
click=
"changeActivity(index)"
@
click=
"changeActivity(index)"
:class=
"['tab',
{active:index == tabsObj.index
}]"
:class=
"['tab',
{ active: index == tabsObj.index
}]"
:key="index"
:key="index"
:disabled="index == 1"
:disabled="index == 1
|| disabled
"
>
{{
i
}}
</el-button>
>
{{
i
}}
</el-button>
</
template
>
</
template
>
</template>
</template>
</div>
</div>
...
@@ -55,17 +57,20 @@
...
@@ -55,17 +57,20 @@
>
>
<
template
v-if=
"activityObj.flag"
>
<
template
v-if=
"activityObj.flag"
>
<template
v-if=
"activityObj.data.length"
>
<template
v-if=
"activityObj.data.length"
>
<template
v-for=
"(i,index) in activityObj.data"
>
<template
v-for=
"(i,
index) in activityObj.data"
>
<template>
<template>
<component
<component
:key=
"index"
:key=
"index"
:is=
"
{
:is=
"
0:'EquityItem',
{
2:'CouponItem',
0: 'EquityItem',
3:'RedEnvelopeItem'
2: 'CouponItem',
}[tabsObj.index]"
3: 'RedEnvelopeItem'
}[tabsObj.index]
"
:configForm="configForm"
:configForm="configForm"
:data="i"
:data="i"
:disabled="disabled"
@choose="choose"
@choose="choose"
>
</component>
>
</component>
</
template
>
</
template
>
...
@@ -78,7 +83,7 @@
...
@@ -78,7 +83,7 @@
</template>
</template>
<
template
v-else
>
<
template
v-else
>
<div
class=
"nothing"
>
<div
class=
"nothing"
>
<img
src=
"@/assets/activity-nothing.png"
>
<img
src=
"@/assets/activity-nothing.png"
/
>
<div>
暂无内容
</div>
<div>
暂无内容
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -90,16 +95,18 @@
...
@@ -90,16 +95,18 @@
</el-scrollbar>
</el-scrollbar>
</template>
</template>
<
script
type=
'text/ecmascript-6'
>
<
script
type=
"text/ecmascript-6"
>
import
{
getMerchantListMixin
}
from
'@/mixins'
import
{
getMerchantListMixin
}
from
'@/mixins'
import
EquityItem
from
'./EquityItem.vue'
import
EquityItem
from
'./EquityItem.vue'
import
CouponItem
from
'./CouponItem.vue'
import
CouponItem
from
'./CouponItem.vue'
import
RedEnvelopeItem
from
'./RedEnvelopeItem.vue'
import
RedEnvelopeItem
from
'./RedEnvelopeItem.vue'
// import CombiForm from '@/components/glsx-combi-form/index.vue'
export
default
{
export
default
{
name
:
'StepOne'
,
name
:
'StepOne'
,
mixins
:
[
getMerchantListMixin
],
mixins
:
[
getMerchantListMixin
],
components
:
{
RedEnvelopeItem
,
EquityItem
,
CouponItem
},
components
:
{
RedEnvelopeItem
,
EquityItem
,
CouponItem
},
props
:
{
disabled
:
Boolean
},
data
()
{
data
()
{
return
{
return
{
configForm
:
{
configForm
:
{
...
@@ -144,6 +151,9 @@ export default {
...
@@ -144,6 +151,9 @@ export default {
maxPhotoNum
:
1
,
maxPhotoNum
:
1
,
suffixSlot
:
'cardCover'
,
suffixSlot
:
'cardCover'
,
handleUpload
:
async
(
e
,
file
,
targetItem
)
=>
{
handleUpload
:
async
(
e
,
file
,
targetItem
)
=>
{
let
loading
=
this
.
$loading
({
target
:
document
.
querySelector
(
'.activity-img'
),
})
try
{
try
{
const
imgFile
=
e
.
target
.
result
,
const
imgFile
=
e
.
target
.
result
,
arrBase64
=
imgFile
.
split
(
','
)[
1
],
arrBase64
=
imgFile
.
split
(
','
)[
1
],
...
@@ -153,8 +163,10 @@ export default {
...
@@ -153,8 +163,10 @@ export default {
if
(
res
)
{
if
(
res
)
{
this
.
configForm
[
targetItem
.
name
]
=
res
this
.
configForm
[
targetItem
.
name
]
=
res
this
.
formRef
().
validateField
(
targetItem
.
name
)
this
.
formRef
().
validateField
(
targetItem
.
name
)
loading
.
close
()
}
else
throw
'上传失败'
}
else
throw
'上传失败'
}
catch
(
error
)
{
}
catch
(
error
)
{
loading
.
close
()
this
.
$message
(
error
)
this
.
$message
(
error
)
}
}
}
}
...
@@ -188,14 +200,13 @@ export default {
...
@@ -188,14 +200,13 @@ export default {
}
}
},
},
watch
:
{
watch
:
{
'disabled'
(
n
)
{
this
.
formData
.
map
(
e
=>
{
e
.
isDisabled
=
n
})
},
'configForm.merchantId'
(
n
)
{
'configForm.merchantId'
(
n
)
{
if
(
n
)
{
if
(
!
n
)
this
.
change
()
this
.
configForm
.
activityId
=
''
this
.
configForm
.
activityType
=
''
this
.
configForm
.
merchantName
=
this
.
merchantObj
.
data
.
find
(
e
=>
e
.
confId
==
n
).
confName
this
.
activityObj
=
this
.
$options
.
data
.
call
(
this
).
activityObj
this
.
getActivityList
()
}
else
this
.
activityObj
.
data
=
[]
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -203,6 +214,15 @@ export default {
...
@@ -203,6 +214,15 @@ export default {
this
.
activityObj
.
flag
=
true
this
.
activityObj
.
flag
=
true
},
},
methods
:
{
methods
:
{
change
(
id
)
{
this
.
clearActivity
()
this
.
configForm
.
merchantName
=
''
this
.
activityObj
=
this
.
$options
.
data
.
call
(
this
).
activityObj
if
(
id
)
{
this
.
configForm
.
merchantName
=
this
.
merchantObj
.
data
.
find
(
e
=>
e
.
confId
==
id
).
confName
this
.
getActivityList
()
}
else
this
.
activityObj
.
flag
=
true
},
formRef
()
{
formRef
()
{
return
this
.
$refs
.
formRef
.
$refs
.
formRef
return
this
.
$refs
.
formRef
.
$refs
.
formRef
},
},
...
@@ -213,7 +233,7 @@ export default {
...
@@ -213,7 +233,7 @@ export default {
{
total
,
pageNum
}
=
_this
.
activityObj
{
total
,
pageNum
}
=
_this
.
activityObj
if
(
condition
)
{
if
(
condition
)
{
if
(
index
==
2
)
{
if
(
index
==
2
)
{
if
(
Math
.
ceil
(
total
/
2
0
)
>
pageNum
)
{
if
(
Math
.
ceil
(
total
/
10
0
)
>
pageNum
)
{
_this
.
activityObj
.
pageNum
+=
1
_this
.
activityObj
.
pageNum
+=
1
_this
.
getActivityList
()
_this
.
getActivityList
()
}
else
{
}
else
{
...
@@ -226,12 +246,11 @@ export default {
...
@@ -226,12 +246,11 @@ export default {
})
})
},
},
changeActivity
(
index
)
{
changeActivity
(
index
)
{
const
{
merchantId
}
=
this
.
configForm
const
{
merchantId
,
id
}
=
this
.
configForm
if
(
this
.
tabsObj
.
index
==
index
)
return
if
(
this
.
tabsObj
.
index
==
index
)
return
if
(
!
merchantId
)
return
this
.
$message
.
error
(
'请选择所属渠道'
)
if
(
!
merchantId
)
return
this
.
$message
.
error
(
'请选择所属渠道'
)
this
.
tabsObj
.
index
=
index
this
.
tabsObj
.
index
=
index
this
.
configForm
.
activityId
=
''
// this.clearActivity()
this
.
configForm
.
activityType
=
''
this
.
activityObj
=
this
.
$options
.
data
.
call
(
this
).
activityObj
this
.
activityObj
=
this
.
$options
.
data
.
call
(
this
).
activityObj
this
.
getActivityList
()
this
.
getActivityList
()
},
},
...
@@ -255,29 +274,32 @@ export default {
...
@@ -255,29 +274,32 @@ export default {
if
(
index
==
2
)
{
if
(
index
==
2
)
{
data
=
[...
this
.
activityObj
.
data
,
...
res
.
list
]
data
=
[...
this
.
activityObj
.
data
,
...
res
.
list
]
this
.
activityObj
.
total
=
res
.
total
this
.
activityObj
.
total
=
res
.
total
}
}
this
.
activityObj
.
data
=
data
this
.
setActivityData
(
data
)
this
.
activityObj
.
loading
=
false
this
.
activityObj
.
flag
=
true
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
activityObj
.
data
=
[]
this
.
setActivityData
()
}
},
setActivityData
(
data
=
[])
{
this
.
activityObj
.
data
=
data
this
.
activityObj
.
loading
=
false
this
.
activityObj
.
loading
=
false
this
.
activityObj
.
flag
=
true
this
.
activityObj
.
flag
=
true
}
},
},
choose
(
e
)
{
choose
(
e
)
{
console
.
log
(
e
)
const
{
index
}
=
this
.
tabsObj
const
{
index
}
=
this
.
tabsObj
this
.
configForm
.
activityId
=
e
this
.
configForm
.
activityId
=
e
this
.
configForm
.
activityType
=
e
?
index
==
0
?
1
:
index
:
''
this
.
configForm
.
activityType
=
e
?
index
==
0
?
1
:
index
:
''
}
},
clearActivity
(){
this
.
configForm
.
activityId
=
''
this
.
configForm
.
activityType
=
''
},
},
},
}
}
</
script
>
</
script
>
<
style
scoped
lang=
'scss'
>
<
style
scoped
lang=
"scss"
>
.step-box
{
.step-box
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
...
...
src/views/questionnaire/components/StepTwo/EditQuestions.vue
View file @
534476a
<
template
>
<
template
>
<el-drawer
<el-drawer
:visible
.
sync=
"show"
:visible
.
sync=
"
editQuestionsObj.
show"
direction=
"rtl"
direction=
"rtl"
size=
"880px"
size=
"880px"
:before-close=
"close"
:before-close=
"close"
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
<el-radio
<el-radio
:key=
"index"
:key=
"index"
:label=
"i.value"
:label=
"i.value"
@
change=
"changeType"
:disabled=
"editQuestionsObj.data && configForm.type != i.value"
>
{{
i
.
label
}}
</el-radio>
>
{{
i
.
label
}}
</el-radio>
</
template
>
</
template
>
</template>
</template>
...
@@ -70,6 +72,7 @@
...
@@ -70,6 +72,7 @@
v-model=
"configForm.userInfoField"
v-model=
"configForm.userInfoField"
placeholder=
"请选择"
placeholder=
"请选择"
style=
"width:432px"
style=
"width:432px"
clearable
>
>
<el-option
<el-option
v-for=
"item in userInfoFieldList"
v-for=
"item in userInfoFieldList"
...
@@ -87,6 +90,7 @@
...
@@ -87,6 +90,7 @@
:key=
"index"
:key=
"index"
v-model=
"userInfoFields[index]"
v-model=
"userInfoFields[index]"
placeholder=
"请选择"
placeholder=
"请选择"
clearable
>
>
<el-option
<el-option
v-for=
"item in userInfoFieldList"
v-for=
"item in userInfoFieldList"
...
@@ -109,20 +113,20 @@
...
@@ -109,20 +113,20 @@
<template
#
label
>
<template
#
label
>
<span
class=
"tips-block"
>
<span
class=
"tips-block"
>
<span
class=
"tips-label"
>
选项
</span>
<span
class=
"tips-label"
>
选项
</span>
<template
v-if=
"configForm.type != 5"
>
<el-popover
<el-popover
placement=
"top"
placement=
"top"
:width=
"200"
:width=
"200"
trigger=
"hover"
trigger=
"hover"
>
>
<div>
各选项之间需回车换行
{{
configForm
.
type
!=
5
?
'各选项之间需回车换行'
:
'最多支持3级,各级间使用“/”进行分隔。如: 广东省/深圳市/南山区'
}}
</div>
<img
<img
slot=
"reference"
slot=
"reference"
class=
"tips-icon"
class=
"tips-icon"
src=
"@/assets/icon-tip.png"
src=
"@/assets/icon-tip.png"
/>
/>
</el-popover>
:
</el-popover>
</
template
>
:
</span>
</span>
</template>
</template>
<
template
v-if=
"configForm.type == 5"
>
<
template
v-if=
"configForm.type == 5"
>
...
@@ -147,6 +151,7 @@
...
@@ -147,6 +151,7 @@
target=
"_blank"
target=
"_blank"
>
下载模板
</a>
>
下载模板
</a>
</div>
</div>
<div
class=
"tips"
>
最多支持3级,各级间使用“/”进行分隔。如:广东省/深圳市/南山区
</div>
</
template
>
</
template
>
<el-input
<el-input
style=
"width:580px"
style=
"width:580px"
...
@@ -209,6 +214,7 @@
...
@@ -209,6 +214,7 @@
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
import
*
as
XLSX
from
'xlsx'
import
*
as
XLSX
from
'xlsx'
import
{
transformData
,
checkSpace
}
from
'@/common/constant'
const
inputKeyObject
=
{
const
inputKeyObject
=
{
1
:
'radioValue'
,
1
:
'radioValue'
,
2
:
'checkboxValue'
,
2
:
'checkboxValue'
,
...
@@ -218,7 +224,10 @@ const inputKeyObject = {
...
@@ -218,7 +224,10 @@ const inputKeyObject = {
}
}
export
default
{
export
default
{
props
:
{
props
:
{
show
:
Boolean
,
editQuestionsObj
:
{
type
:
Object
,
default
:
()
=>
{
}
},
userInfoFieldList
:
{
userInfoFieldList
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[]
default
:
()
=>
[]
...
@@ -243,13 +252,17 @@ export default {
...
@@ -243,13 +252,17 @@ export default {
rule
:
{
rule
:
{
type
:
[{
required
:
true
}],
type
:
[{
required
:
true
}],
required
:
[{
required
:
true
}],
required
:
[{
required
:
true
}],
text
:
[{
required
:
true
,
message
:
'请输入题目'
,
trigger
:
'blur'
}],
text
:
[{
validator
:
(
rule
,
value
,
callback
)
=>
checkSpace
(
rule
,
value
,
callback
,
this
.
configForm
),
required
:
true
,
message
:
'请输入题目'
,
trigger
:
'blur'
}],
value
:
[{
value
:
[{
required
:
true
,
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
validator
:
(
rule
,
value
,
callback
)
=>
{
const
{
type
}
=
this
.
configForm
const
{
type
}
=
this
.
configForm
,
if
(
this
.
configForm
[
inputKeyObject
[
type
]]
===
''
)
callback
(
new
Error
(
`请输入选项`
))
val
=
this
.
configForm
[
inputKeyObject
[
type
]]
else
callback
()
if
(
val
===
''
)
callback
(
new
Error
(
`请输入选项`
))
else
{
if
(
type
!=
3
)
this
.
configForm
[
inputKeyObject
[
type
]]
=
val
.
trim
()
callback
()
}
},
},
trigger
:
'blur'
trigger
:
'blur'
}]
}]
...
@@ -266,18 +279,44 @@ export default {
...
@@ -266,18 +279,44 @@ export default {
}
}
},
},
watch
:
{
watch
:
{
'configForm.type'
()
{
'editQuestionsObj'
(
n
)
{
this
.
$refs
.
configRef
.
clearValidate
(
'value'
)
if
(
n
.
data
)
{
const
{
data
,
data
:
{
type
,
userInfoField
}
}
=
n
this
.
configForm
=
{
type
,
required
:
data
.
required
,
text
:
data
.
text
,
userInfoField
:
''
,
value
:
''
,
maxLength
:
1
,
radioValue
:
''
,
checkboxValue
:
''
,
selectValue
:
''
,
cascaderValue
:
''
}
if
(
type
!=
3
)
this
.
configForm
[
inputKeyObject
[
type
]]
=
String
(
data
.
option
)
else
this
.
configForm
.
maxLength
=
data
.
option
if
(
userInfoField
)
{
if
(
type
==
5
)
this
.
userInfoFields
=
userInfoField
.
split
(
'/'
).
map
(
e
=>
e
?
Number
(
e
)
:
''
)
else
this
.
configForm
.
userInfoField
=
Number
(
userInfoField
)
}
}
}
}
},
},
mounted
()
{
mounted
()
{
},
},
methods
:
{
methods
:
{
changeType
()
{
this
.
$refs
.
configRef
.
clearValidate
(
'value'
)
},
close
()
{
close
()
{
this
.
configForm
=
this
.
$options
.
data
.
call
(
this
).
configForm
this
.
configForm
=
this
.
$options
.
data
.
call
(
this
).
configForm
this
.
userInfoFields
=
this
.
$options
.
data
.
call
(
this
).
userInfoFields
this
.
$refs
.
configRef
.
resetFields
()
this
.
$refs
.
configRef
.
resetFields
()
this
.
errorList
=
[]
this
.
errorList
=
[]
this
.
$emit
(
'update:show'
,
false
)
this
.
$emit
(
'update:editQuestionsObj'
,
{
show
:
false
})
},
},
handleFileUpload
(
event
)
{
handleFileUpload
(
event
)
{
const
[
file
]
=
event
.
target
.
files
const
[
file
]
=
event
.
target
.
files
...
@@ -341,23 +380,22 @@ export default {
...
@@ -341,23 +380,22 @@ export default {
str
=
[]
str
=
[]
arr
.
map
(
i
=>
{
arr
.
map
(
i
=>
{
if
(
i
&&
((
type
===
1
||
type
===
2
)
&&
str
.
length
<
10
||
(
type
===
4
||
type
===
5
)))
{
if
(
i
&&
((
type
===
1
||
type
===
2
)
&&
str
.
length
<
10
||
(
type
===
4
||
type
===
5
)))
{
str
.
push
(
i
)
str
.
push
(
i
.
trim
()
)
}
}
})
})
this
.
configForm
[
inputKeyObject
[
type
]]
=
str
.
join
(
'\n'
)
this
.
configForm
[
inputKeyObject
[
type
]]
=
str
.
join
(
'\n'
)
},
},
handleConfirm
()
{
handleConfirm
()
{
let
{
type
,
required
,
text
,
userInfoField
}
=
this
.
configForm
,
let
{
type
,
required
,
text
,
userInfoField
}
=
this
.
configForm
,
{
userInfoFields
}
=
this
{
userInfoFields
}
=
this
,
{
index
}
=
this
.
editQuestionsObj
this
.
$refs
.
configRef
.
validate
(
valid
=>
{
this
.
$refs
.
configRef
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
try
{
try
{
this
.
errorList
=
[]
this
.
errorList
=
[]
let
option
=
this
.
configForm
[
inputKeyObject
[
type
]],
let
option
=
this
.
configForm
[
inputKeyObject
[
type
]],
data
=
type
==
3
?
option
:
option
.
split
(
'\n'
),
data
=
type
==
3
?
option
:
option
.
split
(
'\n'
)
itemValue
=
''
if
(
type
!=
3
)
{
if
(
type
!=
3
)
{
if
(
type
==
2
||
type
==
5
)
itemValue
=
[]
if
(
type
==
5
)
{
if
(
type
==
5
)
{
const
title
=
data
[
0
].
split
(
'/'
)
const
title
=
data
[
0
].
split
(
'/'
)
if
(
data
.
length
<
2
)
throw
'数据不能为空'
if
(
data
.
length
<
2
)
throw
'数据不能为空'
...
@@ -365,10 +403,9 @@ export default {
...
@@ -365,10 +403,9 @@ export default {
option
=
data
.
join
(
'\n'
)
option
=
data
.
join
(
'\n'
)
if
(
this
.
checkData
(
option
))
throw
''
if
(
this
.
checkData
(
option
))
throw
''
data
.
splice
(
0
,
1
)
data
.
splice
(
0
,
1
)
data
=
t
his
.
t
ransformData
(
data
,
three
?
3
:
two
?
2
:
1
)
data
=
transformData
(
data
,
three
?
3
:
two
?
2
:
1
)
userInfoField
=
userInfoFields
.
join
(
'/'
)
userInfoField
=
userInfoFields
.
join
(
'/'
)
}
}
// else data = Array.from(new Set([...data.map(e => e)]))
}
}
this
.
$emit
(
'addQuestions'
,
{
this
.
$emit
(
'addQuestions'
,
{
type
,
type
,
...
@@ -376,9 +413,8 @@ export default {
...
@@ -376,9 +413,8 @@ export default {
text
,
text
,
userInfoField
,
userInfoField
,
data
,
data
,
option
,
option
itemValue
},
index
)
})
this
.
close
()
this
.
close
()
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
@@ -386,31 +422,6 @@ export default {
...
@@ -386,31 +422,6 @@ export default {
}
}
}
}
})
})
},
transformData
(
data
,
childrenDepth
)
{
const
result
=
[]
data
.
forEach
(
item
=>
{
const
levels
=
item
.
split
(
'/'
)
let
currentLevel
=
result
for
(
let
i
=
0
;
i
<
childrenDepth
;
i
++
)
{
const
label
=
levels
[
i
],
value
=
label
,
existingOption
=
currentLevel
&&
currentLevel
.
find
((
option
)
=>
option
.
label
===
label
)
if
(
existingOption
)
{
if
(
i
===
childrenDepth
-
1
)
continue
if
(
existingOption
.
children
)
currentLevel
=
existingOption
.
children
}
else
{
if
(
label
&&
value
)
{
const
newOption
=
{
label
,
value
}
if
(
levels
[
i
+
1
])
newOption
.
children
=
[]
currentLevel
.
push
(
newOption
)
if
(
i
===
childrenDepth
-
1
)
delete
newOption
.
children
currentLevel
=
newOption
.
children
}
}
}
})
return
result
}
}
}
}
}
}
...
@@ -442,8 +453,8 @@ export default {
...
@@ -442,8 +453,8 @@ export default {
}
}
.tips-icon
{
.tips-icon
{
display
:
inline-block
;
display
:
inline-block
;
width
:
1
4
px
;
width
:
1
3
px
;
height
:
1
4
px
;
height
:
1
3
px
;
margin-right
:
0px
!important
;
margin-right
:
0px
!important
;
vertical-align
:
middle
;
vertical-align
:
middle
;
cursor
:
pointer
;
cursor
:
pointer
;
...
@@ -468,7 +479,8 @@ export default {
...
@@ -468,7 +479,8 @@ export default {
.btn-box
{
.btn-box
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
margin-bottom
:
10px
;
height
:
32px
;
margin-top
:
4px
;
a
{
a
{
margin-left
:
8px
;
margin-left
:
8px
;
color
:
#5850ff
;
color
:
#5850ff
;
...
@@ -491,6 +503,12 @@ export default {
...
@@ -491,6 +503,12 @@ export default {
}
}
}
}
}
}
.tips
{
font-size
:
14px
;
color
:
#999999
;
line-height
:
20px
;
padding
:
8px
0
;
}
.error
{
.error
{
width
:
580px
;
width
:
580px
;
height
:
40px
;
height
:
40px
;
...
...
src/views/questionnaire/components/StepTwo/index.vue
View file @
534476a
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
v-model=
"configForm.title"
v-model=
"configForm.title"
placeholder=
"请输入"
placeholder=
"请输入"
maxlength=
"8"
maxlength=
"8"
:disabled=
"disabled"
></el-input>
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
...
@@ -33,6 +34,8 @@
...
@@ -33,6 +34,8 @@
placeholder=
"请输入"
placeholder=
"请输入"
maxlength=
"50"
maxlength=
"50"
show-word-limit
show-word-limit
:disabled=
"disabled"
resize=
"none"
></el-input>
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
...
@@ -40,34 +43,42 @@
...
@@ -40,34 +43,42 @@
prop=
"questions"
prop=
"questions"
class=
"m-t-20"
class=
"m-t-20"
>
>
<div
class=
"config-box"
>
<div
<template
v-for=
"(i,index) in questionsList"
>
class=
"config-box"
ref=
"itemBox"
>
<template
v-for=
"(i, index) in questionsList"
>
<template>
<template>
<div
<div
:key=
"index"
:key=
"index"
class=
"item"
class=
"item move"
:ref=
"`item-$
{index}`"
>
>
<div
:class=
"['label',
{'required':i.required}]">
<div
:class=
"['label',
{ required: i.required },{'label-center':i.type == 4 || i.type == 5}]">
{{
i
.
text
}}
:
{{
i
.
text
}}
<span>
:
</span>
</div>
</div>
<template
v-if=
"i.type == 1"
>
<template
v-if=
"i.type == 1"
>
<el-radio-group
<el-radio-group
v-model=
"i.itemValue"
v-model=
"i.itemValue"
class=
"r
adio
"
class=
"r
esize
"
>
>
<template
v-for=
"(item,ind) in i.data"
>
<template
v-for=
"(item,
ind) in i.data"
>
<template>
<template>
<el-radio
<el-radio
:key=
"ind"
:key=
"ind"
:label=
"item"
:label=
"item"
>
{{
item
}}
</el-radio>
>
{{
item
}}
</el-radio>
</
template
>
</
template
>
</template>
</template>
</el-radio-group>
</el-radio-group>
</template>
</template>
<
template
v-if=
"i.type == 2"
>
<
template
v-if=
"i.type == 2"
>
<el-checkbox-group
v-model=
"i.itemValue"
>
<el-checkbox-group
<template
v-for=
"(item,ind) in i.data"
>
v-model=
"i.itemValue"
class=
"resize"
>
<template
v-for=
"(item, ind) in i.data"
>
<template>
<template>
<el-checkbox
<el-checkbox
:label=
"item"
:label=
"item"
...
@@ -83,19 +94,20 @@
...
@@ -83,19 +94,20 @@
v-model=
"i.itemValue"
v-model=
"i.itemValue"
placeholder=
"请输入"
placeholder=
"请输入"
type=
"textarea"
type=
"textarea"
:autosize=
"
{ minRows: 3,
maxRows:3
}"
:autosize=
"
{ minRows: 3,
maxRows: 3
}"
:maxlength="i.data"
:maxlength="i.data"
show-word-limit
show-word-limit
resize="none"
>
</el-input>
>
</el-input>
</
template
>
</
template
>
<
template
v-if=
"i.type == 4"
>
<
template
v-if=
"i.type == 4"
>
<el-select
<el-select
v-model=
"i.itemValue"
v-model=
"i.itemValue"
placeholder=
"请选择"
placeholder=
"请选择"
style=
"width:432px;
"
class=
"w432
"
>
>
<el-option
<el-option
v-for=
"(item,ind) in i.data"
v-for=
"(item,
ind) in i.data"
:key=
"ind"
:key=
"ind"
:label=
"item"
:label=
"item"
:value=
"item"
:value=
"item"
...
@@ -106,34 +118,77 @@
...
@@ -106,34 +118,77 @@
<el-cascader
<el-cascader
v-model=
"i.itemValue"
v-model=
"i.itemValue"
:options=
"i.data"
:options=
"i.data"
style=
"width:432px;
"
class=
"w432
"
></el-cascader>
></el-cascader>
</
template
>
</
template
>
<div
class=
"control-box"
>
<
template
v-for=
"(c, ind) in controlOptions"
>
<template>
<el-button
:key=
"ind"
type=
"text"
@
click=
"controlClick(index, ind)"
:disabled=
"itemLoading || controlDisabled(index, ind) || disabled"
>
{{
c
}}
</el-button>
</
template
>
</template>
</div>
</div>
</div>
</template>
</template>
</template>
</template>
<el-button
<el-button
icon=
"el-icon-plus"
icon=
"el-icon-plus"
size=
"small"
size=
"small"
@
click=
"showEditQuestions = true"
@
click=
"editQuestionsObj.show = true"
:disabled=
"disabled"
>
添加题目
</el-button>
>
添加题目
</el-button>
</div>
</div>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
<edit-questions
<edit-questions
:
show
.
sync=
"showEditQuestions
"
:
editQuestionsObj
.
sync=
"editQuestionsObj
"
@
addQuestions=
"addQuestions"
@
addQuestions=
"addQuestions"
:userInfoFieldList=
"userInfoFieldList"
:userInfoFieldList=
"userInfoFieldList"
/>
/>
<GLDialog
title=
"删除"
@
onOk=
"delItem"
@
onCancel=
"delObj.show = false"
:visible
.
sync=
"delObj.show"
mode=
"small"
>
<
template
#
default
>
<div
class=
"over-box"
>
<div
class=
"el-icon-warning"
></div>
请确认是否删除以下题目?
<div
class=
"tips"
>
题目名称:
{{
delObj
.
text
}}
</div>
</div>
</
template
>
</GLDialog>
</el-scrollbar>
</el-scrollbar>
</template>
</template>
<
script
type=
'text/ecmascript-6'
>
<
script
type=
"text/ecmascript-6"
>
import
EditQuestions
from
'./EditQuestions.vue'
import
EditQuestions
from
'./EditQuestions.vue'
import
{
checkSpace
}
from
'@/common/constant'
const
marginBottom
=
16
,
delay
=
(
ms
)
=>
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
)),
translateY
=
(
val
,
size
)
=>
`translateY(
${
val
}
px) `
// ${size == 1 ? 'scale(1.01)' : ''}
export
default
{
export
default
{
name
:
'StepTwo'
,
name
:
'StepTwo'
,
components
:
{
EditQuestions
},
components
:
{
EditQuestions
},
props
:
{
disabled
:
Boolean
,
userInfoFieldList
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
data
()
{
return
{
return
{
configForm
:
{
configForm
:
{
...
@@ -142,49 +197,193 @@ export default {
...
@@ -142,49 +197,193 @@ export default {
questions
:
[],
questions
:
[],
},
},
rule
:
{
rule
:
{
title
:
[{
required
:
true
,
message
:
'请输入问卷标题'
,
trigger
:
'change
'
}],
title
:
[{
validator
:
(
rule
,
value
,
callback
)
=>
checkSpace
(
rule
,
value
,
callback
,
this
.
configForm
),
required
:
true
,
message
:
'请输入问卷标题'
,
trigger
:
'blur
'
}],
desc
:
[{
required
:
true
,
message
:
'请输入问卷说明'
,
trigger
:
'change
'
}],
desc
:
[{
validator
:
(
rule
,
value
,
callback
)
=>
checkSpace
(
rule
,
value
,
callback
,
this
.
configForm
),
required
:
true
,
message
:
'请输入问卷说明'
,
trigger
:
'blur
'
}],
questions
:
[{
required
:
true
,
message
:
'请添加题目'
,
trigger
:
'change'
}],
questions
:
[{
required
:
true
,
message
:
'请添加题目'
,
trigger
:
'change'
}],
},
},
showEditQuestions
:
false
,
editQuestionsObj
:
{
show
:
false
},
questionsList
:
[],
questionsList
:
[],
userInfoFieldList
:
[]
controlOptions
:
[
'编辑'
,
'删除'
,
'上移'
,
'下移'
,
'最前'
,
'最后'
],
delObj
:
{},
delList
:
[],
itemLoading
:
false
}
}
},
},
mounted
()
{
mounted
()
{
this
.
getUserInfoFieldLis
t
()
this
.
addEven
t
()
},
},
methods
:
{
methods
:
{
addEvent
()
{
const
_this
=
this
document
.
addEventListener
(
'keydown'
,
function
(
event
)
{
if
(
event
.
ctrlKey
&&
event
.
key
.
toLocaleLowerCase
()
===
'z'
)
{
event
.
preventDefault
()
const
{
delList
}
=
_this
if
(
delList
.
length
)
{
const
{
index
,
questionsList
,
questions
}
=
delList
.
at
(
-
1
)
_this
.
questionsList
.
splice
(
index
,
0
,
questionsList
)
_this
.
configForm
.
questions
.
splice
(
index
,
0
,
questions
)
delList
.
pop
()
_this
.
formRef
().
validateField
(
'questions'
)
}
}
})
},
formRef
()
{
formRef
()
{
return
this
.
$refs
.
formRef
return
this
.
$refs
.
formRef
},
},
async
getUserInfoFieldList
()
{
async
addQuestions
(
params
,
index
)
{
const
res
=
await
this
.
$apis
.
questionnaire
.
getUserInfoFieldList
()
params
.
itemValue
=
params
.
type
==
2
||
params
.
type
==
5
?
[]
:
''
this
.
userInfoFieldList
=
res
||
[]
},
addQuestions
(
params
)
{
this
.
questionsList
.
push
(
params
)
const
obj
=
{
const
obj
=
{
type
:
params
.
type
,
type
:
params
.
type
,
required
:
params
.
required
,
required
:
params
.
required
,
text
:
params
.
text
,
text
:
params
.
text
,
userInfoField
:
params
.
userInfoField
userInfoField
:
params
.
userInfoField
}
},
{
fromId
}
=
this
.
$parent
,
{
title
,
desc
}
=
this
.
configForm
if
(
params
.
type
==
3
)
obj
.
maxLength
=
params
.
data
if
(
params
.
type
==
3
)
obj
.
maxLength
=
params
.
data
else
obj
.
option
=
params
.
option
else
obj
.
option
=
params
.
option
if
(
index
>
-
1
)
{
this
.
questionsList
.
splice
(
index
,
1
,
params
)
this
.
configForm
.
questions
[
index
]
=
obj
}
else
{
this
.
questionsList
.
push
(
params
)
this
.
configForm
.
questions
.
push
(
obj
)
this
.
configForm
.
questions
.
push
(
obj
)
if
(
!
fromId
&&
title
&&
desc
)
this
.
$parent
.
handleConfirm
(
false
)
}
this
.
updateQuestionnaire
()
this
.
formRef
().
validateField
(
'questions'
)
this
.
formRef
().
validateField
(
'questions'
)
},
async
updateQuestionnaire
()
{
const
{
fromId
}
=
this
.
$parent
,
{
questions
}
=
this
.
configForm
if
(
fromId
)
await
this
.
$apis
.
questionnaire
.
updateQuestionnaire
({
id
:
fromId
,
questions
})
},
controlClick
(
index
,
ind
)
{
const
{
questionsList
}
=
this
,
{
questions
}
=
this
.
configForm
if
(
ind
==
0
)
this
.
editQuestionsObj
=
{
show
:
true
,
data
:
questionsList
[
index
],
index
}
else
if
(
ind
==
1
)
this
.
delObj
=
{
show
:
true
,
text
:
questionsList
[
index
].
text
,
index
}
else
{
this
.
itemLoading
=
true
this
.
moveItem
(
questionsList
,
index
,
ind
,
true
)
this
.
moveItem
(
questions
,
index
,
ind
)
}
},
async
delItem
()
{
const
{
index
}
=
this
.
delObj
,
refs
=
this
.
$refs
,
{
questionsList
,
configForm
:
{
questions
}
}
=
this
,
items
=
[]
questionsList
.
map
((
_
,
i
)
=>
{
const
[
item
]
=
refs
[
`item-
${
i
}
`
]
item
.
className
=
'item move'
items
.
push
(
item
)
})
this
.
delList
.
push
({
questionsList
:
questionsList
[
index
],
questions
:
questions
[
index
],
index
})
for
(
let
i
=
index
+
1
;
i
<
questionsList
.
length
;
i
++
)
{
items
[
i
].
style
.
transform
=
translateY
(
-
(
items
[
index
].
offsetHeight
+
marginBottom
))
}
items
[
index
].
className
=
'item move del'
this
.
delObj
=
{
show
:
false
}
await
delay
(
600
)
this
.
questionsList
.
splice
(
index
,
1
)
this
.
configForm
.
questions
.
splice
(
index
,
1
)
items
.
length
&&
items
.
map
(
e
=>
{
e
.
className
=
'item'
e
.
style
.
transform
=
''
})
},
controlDisabled
(
index
,
ind
)
{
const
{
questionsList
}
=
this
let
disabled
=
false
if
((
index
==
0
&&
(
ind
==
2
||
ind
==
4
))
||
(
index
==
questionsList
.
length
-
1
&&
(
ind
==
3
||
ind
==
5
)))
disabled
=
true
return
disabled
},
async
moveItem
(
array
,
originalIndex
,
targetIndex
,
moveElement
=
false
)
{
const
LENGTH
=
array
.
length
,
newIndex
=
{
2
:
originalIndex
-
1
,
3
:
originalIndex
+
1
,
4
:
0
,
5
:
LENGTH
-
1
}[
targetIndex
],
elementToMove
=
array
[
originalIndex
],
items
=
[]
if
(
moveElement
)
{
const
refs
=
this
.
$refs
// 获取所有元素的引用
for
(
let
i
=
0
;
i
<
LENGTH
;
i
++
)
{
const
[
item
]
=
refs
[
`item-
${
i
}
`
]
item
.
className
=
'item move'
items
.
push
(
item
)
}
const
originalEl
=
items
[
originalIndex
],
targetEl
=
items
[
newIndex
],
originalOffsetTop
=
originalEl
.
offsetTop
,
originalOffsetHeight
=
originalEl
.
offsetHeight
+
marginBottom
,
targetOffsetHeight
=
targetEl
.
offsetHeight
+
marginBottom
if
(
targetIndex
<
4
)
{
originalEl
.
style
.
transform
=
translateY
((
targetIndex
==
2
?
'-'
:
''
)
+
targetOffsetHeight
)
targetEl
.
style
.
transform
=
translateY
((
targetIndex
==
2
?
''
:
'-'
)
+
originalOffsetHeight
)
}
else
{
let
moveNum
=
0
if
(
targetIndex
==
4
)
{
for
(
let
i
=
0
;
i
<
originalIndex
;
i
++
)
{
items
[
i
].
style
.
transform
=
translateY
(
originalOffsetHeight
)
}
moveNum
=
-
originalOffsetTop
}
else
for
(
let
i
=
originalIndex
+
1
;
i
<
LENGTH
;
i
++
)
{
items
[
i
].
style
.
transform
=
translateY
(
-
originalOffsetHeight
)
moveNum
+=
(
items
[
i
].
offsetHeight
+
marginBottom
)
}
originalEl
.
style
.
transform
=
translateY
(
moveNum
)
}
}
await
delay
(
600
)
// 移动元素到新位置
array
.
splice
(
originalIndex
,
1
)
array
.
splice
(
newIndex
,
0
,
elementToMove
)
// 清空元素的样式和位置
moveElement
&&
items
.
length
&&
items
.
map
(
e
=>
{
e
.
className
=
'item'
e
.
style
.
transform
=
''
})
this
.
itemLoading
=
false
return
array
}
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
'scss'
>
<
style
scoped
lang=
"scss"
>
.step-box
{
.step-box
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
.w432
{
width
:
432px
;
}
/
deep
/
.el-scrollbar__wrap
{
/
deep
/
.el-scrollbar__wrap
{
&::-webkit-scrollbar
{
&::-webkit-scrollbar
{
width
:
0
;
width
:
0
;
...
@@ -200,25 +399,43 @@ export default {
...
@@ -200,25 +399,43 @@ export default {
}
}
.config-box
{
.config-box
{
width
:
100%
;
width
:
100%
;
position
:
relative
;
}
.move
{
transition
:
all
0.5s
ease
;
}
}
.item
{
.item
{
width
:
87
0px
;
width
:
99
0px
;
background
:
#f9f9f9
;
background
:
#f9f9f9
;
display
:
flex
;
display
:
flex
;
margin-bottom
:
16px
;
margin-bottom
:
16px
;
padding
:
20px
;
padding
:
20px
10px
20px
20px
;
box-sizing
:
border-box
;
.label
{
.label
{
font-size
:
14px
;
font-size
:
14px
;
color
:
#333333
;
color
:
#333333
;
width
:
154px
;
width
:
154px
;
line-height
:
20px
;
display
:
flex
;
display
:
flex
;
justify-content
:
flex-end
;
justify-content
:
flex-end
;
flex-shrink
:
0
;
flex-shrink
:
0
;
word-break
:
break-all
;
white-space
:
break-spaces
;
}
.label-center
{
align-items
:
center
;
}
}
/
deep
/
.el-radio__label
{
.el-radio
,
.el-checkbox
{
word-break
:
break-all
;
word-break
:
break-all
;
white-space
:
break-spaces
;
white-space
:
break-spaces
;
display
:
inline-flex
;
align-items
:
center
;
}
}
//
.el-radio
{
//
line-height
:
24px
;
//
}
.required
{
.required
{
&::before
{
&::before
{
content
:
'*'
;
content
:
'*'
;
...
@@ -227,9 +444,37 @@ export default {
...
@@ -227,9 +444,37 @@ export default {
margin
:
2px
4px
0
0
;
margin
:
2px
4px
0
0
;
}
}
}
}
.radio
{
.resize
{
line-height
:
22px
;
display
:
inline-flex
;
font-size
:
40px
;
align-items
:
center
;
flex-wrap
:
wrap
;
line-height
:
24px
;
gap
:
10px
0
;
}
}
.del
{
transform
:
translateX
(
-200%
);
}
.show
{
animation
:
show-item
0.25s
;
}
@keyframes
show-item
{
0
%
{
transform
:
translateX
(
-500%
);
}
100
%
{
transform
:
translateX
(
0
);
}
}
.control-box
{
display
:
flex
;
align-items
:
center
;
margin-left
:
auto
;
.el-button
{
border
:
none
;
}
.el-button
+
.el-button
{
margin-left
:
10px
;
}
}
}
}
}
}
...
...
src/views/questionnaire/index.vue
View file @
534476a
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<el-button
<el-button
type=
"default"
type=
"default"
plain
plain
@
click=
"edit"
@
click=
"edit
Form
"
>
新建问卷
</el-button>
>
新建问卷
</el-button>
<el-button
<el-button
type=
"default"
type=
"default"
...
@@ -57,6 +57,18 @@
...
@@ -57,6 +57,18 @@
</div>
</div>
</el-popover>
</el-popover>
</
template
>
</
template
>
<
template
slot=
"status"
slot-scope=
"scope"
>
<div
:class=
"`status status-$
{scope.scope.status}`">
{{
{
'-1'
:
'已结束'
,
'0'
:
'待发布'
,
'1'
:
'已发布'
}
[
scope
.
scope
.
status
]
}}
<
/div
>
<
/template
>
<
span
<
span
slot
=
"auth-button"
slot
=
"auth-button"
slot
-
scope
=
"scope"
slot
-
scope
=
"scope"
...
@@ -71,21 +83,56 @@
...
@@ -71,21 +83,56 @@
<
/div
>
<
/div
>
<
data
-
table
:
dataObj
.
sync
=
"dataObj"
/>
<
data
-
table
:
dataObj
.
sync
=
"dataObj"
/>
<
GLDialog
<
GLDialog
title=
"结束
"
:
title
=
"updateParams.title
"
@
onOk=
"
overQiestion
"
@
onOk
=
"
updateQiestionStatus
"
@
onCancel=
"
dialogVisible
= false"
@
onCancel
=
"
updateParams.show
= false"
:visible
.
sync=
"
dialogVisible
"
:
visible
.
sync
=
"
updateParams.show
"
mode
=
"small"
mode
=
"small"
>
>
<
template
#
default
>
<
template
#
default
>
<
div
class
=
"over-box"
>
<
div
class
=
"over-box"
>
<
div
class
=
"el-icon-warning"
><
/div
>
<
div
class
=
"el-icon-warning"
><
/div
>
请确认是否结束该调查问卷?
{{
updateParams
.
text
}}
<div
class=
"tips"
>
结束后,客户点击将提示:问卷活动已结束
</div>
<
div
class
=
"tips"
>
{{
updateParams
.
tips
}}
<
/div
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
<
/GLDialog
>
<
/GLDialog
>
<
GLDialog
title
=
"复制问卷"
@
onCancel
=
"copyParmas.show = false"
:
visible
.
sync
=
"copyParmas.show"
mode
=
"small"
>
<
template
#
default
>
<
div
class
=
"copy-box"
>
<
div
class
=
"input"
>
<
el
-
form
ref
=
"copyFormRef"
inline
@
submit
.
native
.
prevent
:
model
=
"copyParmas"
>
<
el
-
form
-
item
label
=
"问卷名称"
prop
=
"name"
:
rules
=
"rules"
>
<
el
-
input
placeholder
=
"请输入"
size
=
"small"
v
-
model
.
trim
=
"copyParmas.name"
maxlength
=
"50"
>
<
/el-input
>
<
/el-form-item
>
<
/el-form
>
<
/div
>
<
el
-
button
class
=
"tips"
type
=
"text"
@
click
=
"copyParmas.name = copyParmas.data.name"
>
使用原问卷名称
<
/el-button
>
<
/div
>
<
/template
>
<
template
#
footer
>
<
el
-
button
type
=
"primary"
size
=
"small"
@
click
=
"copyQiestion"
>
提交
<
/el-button
>
<
/template
>
<
/GLDialog
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
...
@@ -104,6 +151,7 @@ export default {
...
@@ -104,6 +151,7 @@ export default {
searchForm
:
{
searchForm
:
{
merchantName
:
''
,
merchantName
:
''
,
name
:
''
,
name
:
''
,
statuses
:
'-1,0,1'
}
,
}
,
searchFormData
:
[
searchFormData
:
[
{
{
...
@@ -118,13 +166,25 @@ export default {
...
@@ -118,13 +166,25 @@ export default {
type
:
'input'
,
type
:
'input'
,
maxlength
:
100
maxlength
:
100
}
,
}
,
{
label
:
'状态'
,
name
:
'statuses'
,
type
:
'select'
,
maxlength
:
100
,
optionList
:
[
{
text
:
'全部'
,
id
:
'-1,0,1'
}
,
{
text
:
'待发布'
,
id
:
'0'
}
,
{
text
:
'已发布'
,
id
:
'1'
}
,
{
text
:
'已结束'
,
id
:
'-1'
}
,
],
optionId
:
'id'
,
optionLabel
:
'text'
}
,
],
],
getListApi
:
this
.
$apis
.
questionnaire
.
getQuestionnaireList
,
getListApi
:
this
.
$apis
.
questionnaire
.
getQuestionnaireList
,
tableParams
:
{
tableParams
:
{
listName
:
'data'
,
listName
:
'data'
,
tableOption
:
{
tableOption
:
true
,
width
:
'110px'
},
tableColumns
:
[
tableColumns
:
[
{
{
label
:
'问卷名称'
,
label
:
'问卷名称'
,
...
@@ -142,6 +202,11 @@ export default {
...
@@ -142,6 +202,11 @@ export default {
minWidth
:
100
minWidth
:
100
}
,
}
,
{
{
label
:
'状态'
,
minWidth
:
100
,
addHtml
:
'status'
}
,
{
label
:
'二维码'
,
label
:
'二维码'
,
minWidth
:
100
,
minWidth
:
100
,
addHtml
:
'qrcode'
addHtml
:
'qrcode'
...
@@ -156,8 +221,12 @@ export default {
...
@@ -156,8 +221,12 @@ export default {
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
,
}
,
}
,
condition
:
row
=>
row
.
status
!=
0
,
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
jumpDetail
(
row
)
click
:
row
=>
this
.
dataObj
=
{
show
:
true
,
...
row
}
}
}
}
,
}
,
{
{
...
@@ -166,18 +235,89 @@ export default {
...
@@ -166,18 +235,89 @@ export default {
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
,
}
,
}
,
condition
:
row
=>
row
.
status
==
1
,
listeners
:
{
click
:
row
=>
this
.
updateParams
=
{
show
:
true
,
id
:
row
.
id
,
title
:
'结束'
,
status
:
-
1
,
text
:
'请确认是否结束该调查问卷?'
,
tips
:
'结束后,客户点击将提示:问卷活动已结束'
}
}
}
,
{
type
:
'el-button'
,
name
:
'发布'
,
attrs
:
{
type
:
'text'
,
}
,
condition
:
row
=>
row
.
status
==
0
,
listeners
:
{
click
:
row
=>
this
.
updateParams
=
{
show
:
true
,
id
:
row
.
id
,
title
:
'发布问卷'
,
status
:
1
,
text
:
'请确认是否发布以下调查问卷?'
,
tips
:
`问卷名称:${row.name
}
`
}
}
}
,
{
type
:
'el-button'
,
name
:
'编辑'
,
attrs
:
{
type
:
'text'
,
}
,
condition
:
row
=>
row
.
status
==
0
,
listeners
:
{
click
:
row
=>
this
.
editForm
(
row
,
'edit'
)
}
}
,
{
type
:
'el-button'
,
name
:
'复制'
,
attrs
:
{
type
:
'text'
,
}
,
listeners
:
{
listeners
:
{
click
:
row
=>
{
click
:
async
row
=>
{
this
.
dialogVisible
=
true
const
data
=
await
this
.
$apis
.
questionnaire
.
getQuestionnaireDetail
({
this
.
closeParams
=
row
id
:
row
.
id
}
)
if
(
data
)
{
this
.
copyParmas
=
{
show
:
true
,
data
,
name
:
''
}
this
.
$nextTick
(()
=>
this
.
$refs
?.
copyFormRef
?.
clearValidate
(
'name'
))
}
else
this
.
$message
.
error
(
'复制失败,请重试!'
)
}
}
}
}
,
}
,
condition
:
row
=>
row
.
status
!=
-
1
{
type
:
'el-button'
,
name
:
'详情'
,
attrs
:
{
type
:
'text'
,
}
,
listeners
:
{
click
:
row
=>
this
.
editForm
(
row
)
}
}
,
}
,
],
],
dataObj
:
{
}
,
dataObj
:
{
}
,
dialogVisible
:
false
,
updateParams
:
{
closeParams
:
{}
show
:
false
}
,
copyParmas
:
{
show
:
false
,
name
:
''
}
,
rules
:
[{
required
:
true
,
message
:
'请输入问卷名称'
}
]
}
}
}
,
}
,
mounted
()
{
mounted
()
{
...
@@ -190,23 +330,46 @@ export default {
...
@@ -190,23 +330,46 @@ export default {
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
handleSearch
()
this
.
handleSearch
()
}
,
}
,
jumpDetail
(
row
)
{
updateQiestionStatus
()
{
this
.
dataObj
=
{
const
{
id
,
status
}
=
this
.
updateParams
show
:
true
,
this
.
Interceptor
(
async
()
=>
await
this
.
$apis
.
questionnaire
.
updateQuestionnaireStatus
({
id
,
status
}
),
{
...
row
target
:
'updateParams'
,
successText
:
'操作成功!'
,
errorText
:
'操作失败,请重试。'
}
)
}
,
copyQiestion
()
{
const
{
data
,
name
}
=
this
.
copyParmas
this
.
$refs
.
copyFormRef
.
validate
(
valid
=>
{
if
(
valid
)
{
delete
data
.
id
delete
data
.
status
data
.
name
=
name
this
.
Interceptor
(
async
()
=>
await
this
.
$apis
.
questionnaire
.
addQuestionnaire
(
data
),
{
target
:
'copyParmas'
,
successText
:
'复制成功!'
,
errorText
:
'复制失败!'
}
)
}
}
}
)
}
,
}
,
async
overQiestion
()
{
async
Interceptor
(
fun
,
params
)
{
const
{
id
}
=
this
.
closeParams
,
let
loading
=
this
.
$loading
()
res
=
await
this
.
$apis
.
questionnaire
.
closeQuestionnaire
({
id
})
try
{
const
res
=
await
fun
()
if
(
res
)
{
if
(
res
)
{
this
.
dialogVisible
=
false
this
.
$message
({
this
.
$message
({
message
:
'操作成功'
,
message
:
params
.
successText
,
type
:
'success'
type
:
'success'
}
)
}
)
this
[
params
.
target
]
=
this
.
$options
.
data
.
call
(
this
)[
params
.
target
]
loading
.
close
()
this
.
handleSearch
()
this
.
handleSearch
()
}
else
this
.
$message
.
error
(
'操作失败,请重试。'
)
}
else
throw
params
.
errorText
}
catch
(
error
)
{
loading
.
close
()
if
(
error
)
this
.
$message
.
error
(
error
)
}
}
,
}
,
handleExport
()
{
handleExport
()
{
this
.
$apis
.
questionnaire
.
exportQuestionnaireList
({
...
this
.
searchForm
,
...
this
.
$refs
.
listRef
.
page
}
).
then
(
res
=>
{
this
.
$apis
.
questionnaire
.
exportQuestionnaireList
({
...
this
.
searchForm
,
...
this
.
$refs
.
listRef
.
page
}
).
then
(
res
=>
{
...
@@ -216,11 +379,13 @@ export default {
...
@@ -216,11 +379,13 @@ export default {
download
(
url
)
{
download
(
url
)
{
util
.
downloadIamge
(
url
)
util
.
downloadIamge
(
url
)
}
,
}
,
edit
(
row
)
{
edit
Form
(
row
,
type
=
''
)
{
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/questionnaire/add'
,
path
:
'/questionnaire/add'
,
query
:
{
query
:
{
$title
:
row
.
id
?
'编辑问卷'
:
'新建问卷'
$title
:
row
.
id
?
type
==
'edit'
?
'编辑问卷'
:
'问卷详情'
:
'新建问卷'
,
id
:
row
.
id
,
type
}
}
}
)
}
)
}
}
...
@@ -275,31 +440,53 @@ export default {
...
@@ -275,31 +440,53 @@ export default {
width
:
200
px
;
width
:
200
px
;
height
:
200
px
;
height
:
200
px
;
}
}
/
deep
/
.over-box
{
.
download
-
img
{
cursor
:
pointer
;
margin
-
top
:
10
px
;
font
-
size
:
14
px
;
font
-
weight
:
600
;
color
:
#
5850
ff
;
line
-
height
:
20
px
;
text
-
align
:
center
;
}
.
status
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
align
-
items
:
center
;
align
-
items
:
center
;
&
::
before
{
content
:
''
;
width
:
8
px
;
height
:
8
px
;
border
-
radius
:
100
%
;
margin
-
right
:
8
px
;
background
:
#
999999
;
}
}
.
status
-
0
{
&
::
before
{
background
:
#
f8b757
;
}
}
.
status
-
1
{
&
::
before
{
background
:
#
4
aca74
;
}
}
/deep/
.
copy
-
box
{
display
:
flex
;
flex
-
direction
:
column
;
justify
-
content
:
center
;
justify
-
content
:
center
;
height
:
100
%
;
height
:
100
%
;
font
-
size
:
16
px
;
font
-
size
:
16
px
;
color
:
#
333333
;
color
:
#
333333
;
gap
:
8px
;
.
input
{
.el-icon-warning
{
transform
:
translateY
(
-
4
px
);
font-size
:
48px
;
margin
:
0
auto
;
color
:
#e6a23c
;
}
}
.
tips
{
.
tips
{
font-size
:
14px
;
font
-
size
:
12
px
;
color
:
#666666
;
}
}
.download-img
{
cursor
:
pointer
;
margin-top
:
10px
;
font-size
:
14px
;
font-weight
:
600
;
color
:
#
5850
ff
;
color
:
#
5850
ff
;
line-height
:
20px
;
margin
-
left
:
148
px
;
text-align
:
center
;
width
:
fit
-
content
;
}
}
}
<
/style>
<
/style>
\ No newline at end of file
\ No newline at end of file
src/views/redEnvelope/components/common/fun.js
View file @
534476a
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
export
default
{
export
default
{
uploadFile
(
e
,
_this
,
maxSize
)
{
uploadFile
(
e
,
_this
,
maxSize
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
file
=
e
.
srcElement
.
files
[
0
]
const
[
file
]
=
e
.
srcElement
.
files
if
(
!
file
)
return
reject
()
let
AllImgExt
=
'.xls|.xlsx'
let
AllImgExt
=
'.xls|.xlsx'
let
extName
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
'.'
)).
toLowerCase
()
let
extName
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
'.'
)).
toLowerCase
()
if
(
AllImgExt
.
indexOf
(
extName
)
===
-
1
)
{
if
(
AllImgExt
.
indexOf
(
extName
)
===
-
1
)
{
...
...
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