Commit 11321740 by 李伟康

提交问卷需求

1 parent 643af4fe
import { http } from '@/main'
const url = '/rop-scrm-marketing/router'
const url = 'http://192.168.3.226:8593/rop-scrm-marketing/router'
// const url = '/rop-scrm-marketing/router'
export default {
/**
* 分页查询调查问卷列表
*/
getQuestionnaireList (params) {
params.method = 'marketing.api.activityQuestionnaireForm.page'
return http({
url,
data: params
})
},
/**
* 分页查询用户-调查问卷列表
*/
getQuestionnaireDetailPage (params) {
params.method = 'marketing.api.activityQuestionnaireUserForm.page'
return http({
url,
data: params
})
},
/**
* 结束调查问卷
*/
closeQuestionnaire (params) {
params.method = 'marketing.api.activityQuestionnaireForm.close'
return http({
url,
data: params
})
},
/**新增调查问卷 */
addQuestionnaire (params) {
params.method = 'marketing.api.activityQuestionnaireForm.add'
return http({
url,
data: params
})
},
/**
* 查询关联客户信息
*/
getUserInfoFieldList (params = {}) {
params.method = 'marketing.api.activityQuestionnaireUserInfoField.getAll'
return http({
url,
data: params
})
},
/**权益卡试用 */
getEquityActivityList (params) {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
......
......@@ -56,7 +56,7 @@ export default {
data () {
return {
parsedData: [],
step: 2,
step: 1,
tabs: ['基本信息', '配置内容']
}
},
......@@ -77,8 +77,27 @@ export default {
if (valid) this.step = 2
})
} else {
stepTwo.formRef().validate(valid => {
if (valid) console.log(stepOne.configForm, stepTwo.configForm)
stepTwo.formRef().validate(async valid => {
if (valid) {
try {
const params = {
...stepOne.configForm,
...stepTwo.configForm,
status: 1
}, res = await this.$apis.questionnaire.addQuestionnaire(params)
console.log(res)
if (res) {
this.$message({
message: '创建成功',
type: 'success'
})
this.$router.go(-1)
}
else throw '创建失败'
} catch (error) {
if (error) this.$message.error(error)
}
}
})
}
}
......
......@@ -36,20 +36,19 @@ export default {
tableOption: false,
tableColumns: [
{
label: '导入时间',
prop: 'exportTime',
label: '手机号码',
prop: 'phone',
minWidth: 180
},
{
label: '状态',
prop: 'statusStr',
label: '微信昵称',
prop: 'wechatNickname',
minWidth: 100,
},
{
label: '微信昵称',
prop: 'wechatName',
label: '答题时间',
prop: 'updatedTime',
minWidth: 100
},
]
},
......@@ -68,13 +67,14 @@ export default {
methods: {
async refreshTable (pageCon) {
pageCon && (this.pageConfig = pageCon)
const params = {
redEnvelopeId: this.dataObj.id,
pageSize: 10,
pageNum: 1,
...this.pageConfig
}
const { data, count } = await this.$apis.redenvelope.getActivityRedEnvelopeLinkDetailPage(params)
const { id } = this.dataObj,
params = {
formId: id,
pageSize: 10,
pageNum: 1,
...this.pageConfig
}
const { data, count } = await this.$apis.questionnaire.getQuestionnaireDetailPage(params)
this.tableData = data || []
this.tableTotal = count || 0
},
......
......@@ -50,7 +50,7 @@ export default {
methods: {
chooseRed (id) {
const {activityId} = this.configForm
if(activityId == id) id = ''
if(activityId && activityId == id) id = ''
this.$emit('choose', id)
}
}
......
<template>
<div
@click="chooseRed(data.id)"
:class="['item',{'active':configForm.activityId == data.id}]"
@click="chooseRed(data.equityClassId)"
:class="['item',{'active':configForm.activityId == data.equityClassId}]"
>
<div class="icon">
<img src="@/assets/red-radio.png" />
......@@ -37,7 +37,7 @@ export default {
methods: {
chooseRed (id) {
const {activityId} = this.configForm
if(activityId == id) id = ''
if(activityId && activityId == id) id = ''
this.$emit('choose', id)
}
}
......
......@@ -38,7 +38,7 @@ export default {
methods: {
chooseRed (id) {
const {activityId} = this.configForm
if(activityId == id) id = ''
if(activityId && activityId == id) id = ''
this.$emit('choose', id)
}
}
......
......@@ -101,22 +101,23 @@ export default {
data () {
return {
configForm: {
activityName: '',
name: '',
merchantId: '',
activityTime: '',
activityImg: '',
activityId: ''
cardTitle: '',
cardCover: '',
activityId: '',
merchantName: ''
},
rule: {
activityName: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
name: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
merchantId: [{ required: true, message: '请选择所属渠道', trigger: 'change' }],
activityTime: [{ required: true, message: '请输入卡片标题', trigger: 'change' }],
activityImg: [{ required: true, message: '请上传卡片封面', trigger: 'change' }],
cardTitle: [{ required: true, message: '请输入卡片标题', trigger: 'change' }],
cardCover: [{ required: true, message: '请上传卡片封面', trigger: 'change' }],
},
formData: [
{
label: '问卷名称',
name: 'activityName',
name: 'name',
type: 'input',
maxlength: 50,
},
......@@ -128,18 +129,18 @@ export default {
},
{
label: '卡片标题',
name: 'activityTime',
name: 'cardTitle',
type: 'input',
maxlength: 20,
},
{
label: '卡片封面',
name: 'activityImg',
name: 'cardCover',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
suffixSlot: 'activityImg',
suffixSlot: 'cardCover',
handleUpload: async (e, file, targetItem) => {
try {
const imgFile = e.target.result,
......@@ -184,6 +185,7 @@ export default {
},
watch: {
'configForm.merchantId' (n) {
this.configForm.merchantName = this.merchantObj.data.find(e => e.confId == n).confName
this.getActivityList()
}
},
......@@ -215,6 +217,7 @@ export default {
if (!merchantId) return this.$message.error('请先选择所属渠道')
this.tabsObj.index = index
this.configForm.activityId = ''
this.configForm.activityType = ''
this.activityObj.pageNum = 1
this.activityObj.nothing = false
this.activityObj.flag = false
......@@ -244,7 +247,10 @@ export default {
this.activityObj.flag = true
},
choose (e) {
console.log(e)
const { index } = this.tabsObj
this.configForm.activityId = e
this.configForm.activityType = e ? index == 0 ? 1 : index : ''
}
},
......
......@@ -44,39 +44,61 @@
v-model="configForm.required"
class="fit-width radio"
>
<el-radio :label="1">是</el-radio>
<el-radio :label="0">否</el-radio>
<el-radio :label="true">是</el-radio>
<el-radio :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="题目:"
prop="title"
prop="text"
class="m-t-20"
>
<el-input
style="width:432px"
size="small"
v-model="configForm.title"
v-model="configForm.text"
placeholder="请输入"
maxlength="8"
maxlength="50"
></el-input>
</el-form-item>
<el-form-item
label="关联客户信息"
class="m-t-20"
>
<el-select
v-model="configForm.merchantId"
placeholder="请选择"
style="width:432px"
>
<el-option
v-for="item in customerInfoOptions"
:key="item.confId"
:label="item.confName"
:value="item.confId"
></el-option>
</el-select>
<template v-if="configForm.type != 5">
<el-select
v-model="configForm.userInfoField"
placeholder="请选择"
style="width:432px"
>
<el-option
v-for="item in userInfoFieldList"
:key="item.id"
:label="item.fieldName"
:value="item.id"
></el-option>
</el-select>
</template>
<template v-else>
<template v-for="(i,index) in 3">
<template>
<el-select
class="cascader"
:key="index"
v-model="userInfoFields[index]"
placeholder="请选择"
>
<el-option
v-for="item in userInfoFieldList"
:key="item.id"
:label="item.fieldName"
:value="item.id"
></el-option>
</el-select>
</template>
</template>
</template>
</el-form-item>
<template v-if="configForm.type != 3">
<el-form-item
......@@ -144,7 +166,7 @@
size="small"
:min="1"
:max="99999"
v-model="configForm.maxNum"
v-model="configForm.maxLength"
:step="1"
step-strictly
></el-input-number>
......@@ -171,24 +193,29 @@ import * as XLSX from 'xlsx'
const inputKeyObject = {
1: 'radioValue',
2: 'checkboxValue',
3: 'maxNum',
3: 'maxLength',
4: 'selectValue',
5: 'cascaderValue'
}
export default {
props: {
show: Boolean
show: Boolean,
userInfoFieldList: {
type: Array,
default: () => []
}
},
name: '',
data () {
return {
userInfoFields: ['', '', ''],
configForm: {
type: 1,
required: 1,
title: '',
merchantId: '',
required: true,
text: '',
userInfoField: '',
value: '',
maxNum: 1,
maxLength: 1,
radioValue: '',
checkboxValue: '',
selectValue: '',
......@@ -197,7 +224,7 @@ export default {
rule: {
type: [{ required: true }],
required: [{ required: true }],
title: [{ required: true, message: '请输入题目', trigger: 'blur' }],
text: [{ required: true, message: '请输入题目', trigger: 'blur' }],
value: [{
required: true,
validator: (rule, value, callback) => {
......@@ -215,20 +242,6 @@ export default {
{ label: '下拉框', value: 4 },
{ label: '多级下拉框', value: 5 },
],
customerInfoOptions: [
{ confName: '车牌号', confId: 1 },
{ confName: '车架号', confId: 1 },
{ confName: '车品牌', confId: 1 },
{ confName: '车系', confId: 1 },
{ confName: '车型', confId: 1 },
{ confName: '小区名称', confId: 1 },
{ confName: '楼栋', confId: 1 },
{ confName: '房号', confId: 1 },
{ confName: '住户类型', confId: 1 },
{ confName: '子女数量', confId: 1 },
{ confName: '子女性别', confId: 1 },
{ confName: '子女年龄', confId: 1 },
],
errorList: [],
inputKeyObject
}
......@@ -296,21 +309,27 @@ export default {
this.configForm[inputKeyObject[type]] = str.join('\n')
},
handleConfirm () {
const { type, required, title, merchantId } = this.configForm
let { type, required, text, userInfoField } = this.configForm,
{ userInfoFields } = this
this.$refs.configRef.validate(valid => {
if (valid) {
let rawData = this.configForm[inputKeyObject[type]],
data = type == 3 ? rawData : rawData.split('\n'),
let option = this.configForm[inputKeyObject[type]],
data = type == 3 ? option : option.split('\n'),
itemValue = ''
if (type == 2 || type == 5) itemValue = []
if (type == 5) data = this.transformData(data)
if (type == 5) {
data.splice(0, 1)
option = data.join('\n')
data = this.transformData(data)
userInfoField = userInfoFields.join('/')
}
this.$emit('addQuestions', {
type,
required,
title,
merchantId,
text,
userInfoField,
data,
rawData,
option,
itemValue
})
this.close()
......@@ -320,27 +339,25 @@ export default {
transformData (data) {
const result = []
data.forEach((item, index) => {
if (index != 0) {
const levels = item.split('/')
let currentLevel = result
for (let i = 0; i < levels.length; i++) {
const label = levels[i],
value = label,
existingOption = currentLevel.find((option) => option.label === label)
if (existingOption) {
if (i === levels.length - 1) {
continue
}
currentLevel = existingOption.children
} else {
const newOption = { label, value, children: [] }
currentLevel.push(newOption)
const levels = item.split('/')
let currentLevel = result
for (let i = 0; i < levels.length; i++) {
const label = levels[i],
value = label,
existingOption = currentLevel.find((option) => option.label === label)
if (existingOption) {
if (i === levels.length - 1) {
continue
}
currentLevel = existingOption.children
} else {
const newOption = { label, value, children: [] }
currentLevel.push(newOption)
if (i === levels.length - 1) {
delete newOption.children
}
currentLevel = newOption.children
if (i === levels.length - 1) {
delete newOption.children
}
currentLevel = newOption.children
}
}
})
......@@ -379,6 +396,10 @@ export default {
.radio {
height: 40px;
}
.cascader {
width: 136px;
margin-right: 12px;
}
.number-tips {
font-size: 14px;
color: #666666;
......
......@@ -9,27 +9,27 @@
>
<el-form-item
label="问卷标题:"
prop="activityName"
prop="title"
class="m-t-20"
>
<el-input
style="width:432px"
size="small"
v-model="configForm.activityName"
v-model="configForm.title"
placeholder="请输入"
maxlength="8"
></el-input>
</el-form-item>
<el-form-item
label="问卷说明:"
prop="activityTime"
prop="desc"
class="m-t-20"
>
<el-input
style="width:580px"
type="textarea"
rows="3"
v-model="configForm.activityTime"
v-model="configForm.desc"
placeholder="请输入"
maxlength="50"
show-word-limit
......@@ -37,18 +37,18 @@
</el-form-item>
<el-form-item
label="题目配置:"
prop="activityImg"
prop="questions"
class="m-t-20"
>
<div class="config-box">
<template v-for="(i,index) in configForm.activityImg">
<template v-for="(i,index) in questionsList">
<template>
<div
:key="index"
class="item"
>
<div :class="['label',{'required':i.required}]">
{{i.title}}:
{{i.text}}:
</div>
<template v-if="i.type == 1">
<el-radio-group
......@@ -124,6 +124,7 @@
<edit-questions
:show.sync="showEditQuestions"
@addQuestions="addQuestions"
:userInfoFieldList="userInfoFieldList"
/>
</el-scrollbar>
</template>
......@@ -136,26 +137,42 @@ export default {
data () {
return {
configForm: {
activityName: '',
activityTime: '',
activityImg: [],
title: '',
desc: '',
questions: [],
},
rule: {
activityName: [{ required: true, message: '请输入问卷标题', trigger: 'change' }],
activityTime: [{ required: true, message: '请输入问卷说明', trigger: 'change' }],
activityImg: [{ required: true, message: '请添加题目', trigger: 'change' }],
title: [{ required: true, message: '请输入问卷标题', trigger: 'change' }],
desc: [{ required: true, message: '请输入问卷说明', trigger: 'change' }],
questions: [{ required: true, message: '请添加题目', trigger: 'change' }],
},
showEditQuestions: true
showEditQuestions: false,
questionsList: [],
userInfoFieldList: []
}
},
mounted () {
this.getUserInfoFieldList()
},
methods: {
formRef () {
return this.$refs.formRef
},
async getUserInfoFieldList () {
const res = await this.$apis.questionnaire.getUserInfoFieldList()
this.userInfoFieldList = res || []
},
addQuestions (params) {
this.configForm.activityImg.push(params)
this.questionsList.push(params)
const obj = {
type: params.type,
required: params.required,
text: params.text,
userInfoField: params.userInfoField
}
if(params.type == 3) obj.maxLength = params.data
else obj.option = params.option
this.configForm.questions.push(obj)
}
}
}
......
......@@ -32,7 +32,7 @@
:pageConf="pageConf"
>
<template
slot="qr"
slot="qrcode"
slot-scope="scope"
>
<el-popover
......@@ -41,13 +41,13 @@
>
<img
class="img-plus"
src="https://wx.glsx.com.cn/upload/biz/575c552b-d342-46d8-bbc2-813906187b50.jpg"
:src="scope.scope.qrcode"
/>
<div
slot="reference"
class="qr"
>
<img :src="scope.scope.qr||'https://wx.glsx.com.cn/upload/biz/575c552b-d342-46d8-bbc2-813906187b50.jpg'" />
<img :src="scope.scope.qrcode" />
</div>
</el-popover>
</template>
......@@ -66,7 +66,7 @@
<data-table :dataObj.sync="dataObj" />
<GLDialog
title="结束"
@onOk="handleDel"
@onOk="overQiestion"
@onCancel="dialogVisible = false"
:visible.sync="dialogVisible"
mode="small"
......@@ -95,13 +95,12 @@ export default {
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
merchantName: '',
merchantId: '',
staffName: ''
name: '',
},
searchFormData: [
{
label: '问卷名称',
name: 'activityName',
name: 'name',
type: 'input',
maxlength: 100
},
......@@ -112,16 +111,16 @@ export default {
maxlength: 100
},
],
getListApi: this.$apis.redenvelope.getRedEnvelopeRecordList,
getListApi: this.$apis.questionnaire.getQuestionnaireList,
tableParams: {
listName: 'list',
listName: 'data',
tableOption: {
width: '110px'
},
tableColumns: [
{
label: '问卷名称',
prop: 'activityName',
prop: 'name',
minWidth: 100
},
{
......@@ -131,13 +130,13 @@ export default {
},
{
label: '卡片标题',
prop: 'activityName',
prop: 'cardTitle',
minWidth: 100
},
{
label: '二维码',
minWidth: 100,
addHtml: 'qr'
addHtml: 'qrcode'
},
]
},
......@@ -160,12 +159,17 @@ export default {
type: 'text',
},
listeners: {
click: row => this.overQiestion(row)
}
click: row => {
this.dialogVisible = true
this.closeParams = row
}
},
condition: row => row.status != -1
},
],
dataObj: {},
dialogVisible: false
dialogVisible: false,
closeParams: {}
}
},
mounted () {
......@@ -181,15 +185,21 @@ export default {
jumpDetail (row) {
this.dataObj = {
show: true,
id: 22
...row
}
},
overQiestion (row) {
this.dialogVisible = true
async overQiestion () {
const { id } = this.closeParams,
res = await this.$apis.questionnaire.closeQuestionnaire({ id })
if (res) {
this.dialogVisible = false
this.$message({
message: '操作成功',
type: 'success'
})
this.handleSearch()
} else this.$message.error('操作失败,请重试。')
},
handleDel(){
this.dialogVisible = false
}
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!