Commit fd96ceca by 李伟康

问卷需求

1 parent a01ed0b5
...@@ -77,7 +77,9 @@ export default { ...@@ -77,7 +77,9 @@ export default {
if (valid) this.step = 2 if (valid) this.step = 2
}) })
} else { } else {
console.log(stepOne.configForm, stepTwo.configForm) stepTwo.formRef().validate(valid => {
if (valid) console.log(stepOne.configForm, stepTwo.configForm)
})
} }
} }
......
<template>
<GLDialog
mode="big"
bigTitle="数据"
:hasFooter="false"
:before-close="handleClose"
:visible.sync="dataObj.show"
>
<GLTable
:tableData="tableData"
:noDataImg="url"
:tableParams="tableParams"
:tableTotal="tableTotal"
:pageConf="pageConf"
>
</GLTable>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
export default {
name: '',
props: {
dataObj: {
type: Object,
default: () => { }
}
},
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '导入时间',
prop: 'exportTime',
minWidth: 180
},
{
label: '状态',
prop: 'statusStr',
minWidth: 100,
},
{
label: '微信昵称',
prop: 'wechatName',
minWidth: 100
},
]
},
tableData: [],
tableTotal: 0
}
},
mounted () {
},
watch: {
'dataObj' (n) {
if (n.id) this.refreshTable()
}
},
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)
this.tableData = data || []
this.tableTotal = count || 0
},
handleClose () {
this.$emit('update:dataObj', {})
},
}
}
</script>
<style scoped lang='scss'>
.link {
/deep/.el-form-item--small {
width: fit-content;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -286,6 +286,20 @@ export default { ...@@ -286,6 +286,20 @@ export default {
height: 100%; height: 100%;
} }
} }
/deep/.activity-img {
margin-bottom: 30px;
&::before {
content: '图片大小10M以内';
display: block;
font-size: 14px;
color: #999999;
position: absolute;
left: 0;
line-height: 20px;
bottom: -30px;
width: 200px;
}
}
.tabs { .tabs {
height: 36px; height: 36px;
background: #f8f8f8; background: #f8f8f8;
......
<template> <template>
<el-scrollbar class="step-box"> <el-scrollbar class="step-box">
<div class="step-content"> <div class="step-content">
1 <el-form
ref="formRef"
label-width="154px"
:rules="rule"
:model="configForm"
>
<el-form-item
label="问卷标题:"
prop="activityName"
class="m-t-20"
>
<el-input
style="width:432px"
size="small"
v-model="configForm.activityName"
placeholder="请输入"
maxlength="8"
></el-input>
</el-form-item>
<el-form-item
label="问卷说明:"
prop="activityTime"
class="m-t-20"
>
<el-input
style="width:580px"
type="textarea"
rows="3"
v-model="configForm.activityTime"
placeholder="请输入"
maxlength="50"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label="题目配置:"
prop="activityImg"
class="m-t-20"
>
<div class="config-box">
<template v-for="(i,index) in configForm.activityImg">
<template>
<div
:key="index"
class="item"
>
<div :class="['label',{'required':i.required}]">
{{i.title}}:
</div>
<template v-if="i.type == 1">
<el-radio-group
v-model="i.itemValue"
class="radio"
>
<template v-for="(item,ind) in i.data">
<template>
<el-radio
:key="ind"
:label="item"
>{{item}}</el-radio>
</template>
</template>
</el-radio-group>
</template>
<template v-if="i.type == 2">
<el-checkbox-group v-model="i.itemValue">
<template v-for="(item,ind) in i.data">
<template>
<el-checkbox
:label="item"
:key="ind"
></el-checkbox>
</template>
</template>
</el-checkbox-group>
</template>
<template v-if="i.type == 3">
<el-input
style="width:580px"
v-model="i.itemValue"
placeholder="请输入"
type="textarea"
:autosize="{ minRows: 3,maxRows:3}"
:maxlength="i.data"
show-word-limit
></el-input>
</template>
<template v-if="i.type == 4">
<el-select
v-model="i.itemValue"
placeholder="请选择"
style="width:432px;"
>
<el-option
v-for="(item,ind) in i.data"
:key="ind"
:label="item"
:value="item"
></el-option>
</el-select>
</template>
<template v-if="i.type == 5">
<el-cascader
v-model="i.itemValue"
:options="i.data"
style="width:432px;"
></el-cascader>
</template>
</div>
</template>
</template>
<el-button
icon="el-icon-plus"
size="small"
@click="showEditQuestions = true"
>添加题目</el-button>
</div>
</el-form-item>
</el-form>
</div> </div>
<!-- <input <edit-questions
type="file" :show.sync="showEditQuestions"
@change="handleFileUpload" @addQuestions="addQuestions"
accept=".xlsx" />
/> -->
</el-scrollbar> </el-scrollbar>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import * as XLSX from 'xlsx' import EditQuestions from './EditQuestions.vue'
export default { export default {
name: 'StepTwo', name: 'StepTwo',
components: { EditQuestions },
data () { data () {
return { return {
configForm: {
activityName: '',
activityTime: '',
activityImg: [],
},
rule: {
activityName: [{ required: true, message: '请输入问卷标题', trigger: 'change' }],
activityTime: [{ required: true, message: '请输入问卷说明', trigger: 'change' }],
activityImg: [{ required: true, message: '请添加题目', trigger: 'change' }],
},
showEditQuestions: true
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
handleFileUpload (event) { formRef () {
const [file] = event.target.files return this.$refs.formRef
if (file) {
const reader = new FileReader()
reader.onload = e => {
try {
const data = e.target.result
if (data) {
const workbook = XLSX.read(data, { type: 'array' }),
[firstSheetName] = workbook.SheetNames,
worksheet = workbook.Sheets[firstSheetName]
this.parsedData = XLSX.utils.sheet_to_json(worksheet, { header: 1 })
console.table(this.parsedData)
} else throw '数据不能为空'
} catch (error) {
this.$message.error(error || '读取文件时出错')
}
}
reader.readAsArrayBuffer(file)
}
}, },
addQuestions (params) {
this.configForm.activityImg.push(params)
}
} }
} }
</script> </script>
...@@ -59,9 +172,41 @@ export default { ...@@ -59,9 +172,41 @@ export default {
height: 0; height: 0;
color: transparent; color: transparent;
} }
.el-form-item__content {
width: calc(100% - 154px);
}
} }
.step-content { .step-content {
padding-top: 32px; padding-top: 32px;
} }
.config-box {
width: 100%;
}
.item {
width: 870px;
background: #f9f9f9;
display: flex;
margin-bottom: 16px;
padding: 20px;
.label {
font-size: 14px;
color: #333333;
width: 154px;
display: flex;
justify-content: flex-end;
}
.required {
&::before {
content: '*';
color: #eb4e4e;
display: block;
margin: 2px 4px 0 0;
}
}
.radio {
line-height: 22px;
font-size: 40px;
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -63,14 +63,32 @@ ...@@ -63,14 +63,32 @@
</span> </span>
</GLTable> </GLTable>
</div> </div>
<data-table :dataObj.sync="dataObj" />
<GLDialog
title="结束"
@onOk="handleDel"
@onCancel="dialogVisible = false"
:visible.sync="dialogVisible"
mode="small"
>
<template #default>
<div class="over-box">
<div class="el-icon-warning"></div>
请确认是否结束该调查问卷?
<div class="tips">结束后,客户点击将提示:问卷活动已结束</div>
</div>
</template>
</GLDialog>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import * as dayjs from 'dayjs' import DataTable from './components/DataTable/index.vue'
export default { export default {
name: 'RedEnvelopeConfig', name: 'RedEnvelopeConfig',
components: { DataTable },
data () { data () {
return { return {
url, url,
...@@ -142,10 +160,12 @@ export default { ...@@ -142,10 +160,12 @@ export default {
type: 'text', type: 'text',
}, },
listeners: { listeners: {
click: row => this.showEditFun(row) click: row => this.overQiestion(row)
} }
}, },
], ],
dataObj: {},
dialogVisible: false
} }
}, },
mounted () { mounted () {
...@@ -158,6 +178,18 @@ export default { ...@@ -158,6 +178,18 @@ export default {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch() this.handleSearch()
}, },
jumpDetail (row) {
this.dataObj = {
show: true,
id: 22
}
},
overQiestion (row) {
this.dialogVisible = true
},
handleDel(){
this.dialogVisible = false
}
} }
} }
</script> </script>
...@@ -209,4 +241,22 @@ export default { ...@@ -209,4 +241,22 @@ export default {
width: 200px; width: 200px;
height: 200px; height: 200px;
} }
/deep/.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;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!