问卷表单

This commit is contained in:
yanran200730
2022-10-24 11:17:59 +08:00
parent 719a45a4c2
commit fb0354221d
5 changed files with 70 additions and 439 deletions

View File

@@ -9,7 +9,6 @@
<script>
import Add from './components/Add'
import List from './components/List'
import Detail from './components/Detail'
export default {
name: 'AppScoringTemplate',
@@ -29,18 +28,12 @@
},
components: {
Detail,
List,
Add
},
methods: {
onChange (data) {
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params

View File

@@ -1,6 +1,6 @@
<template>
<ai-detail class="form-add">
<ai-title :title="pageTitle" slot="title" isShowBack @onBackClick="cancel(false)">
<ai-title title="问卷表单" slot="title" isShowBack @onBackClick="cancel(false)">
<template #rightBtn>
<el-button type="primary" icon="iconfont iconRepulsebeifen" @click="toPublish">保存模板</el-button>
</template>
@@ -70,6 +70,7 @@
<span>{{ i + 1 }}. </span>
<h2>{{ item.label }}</h2>
</div>
<p>{{ item.describe }}</p>
<div class="left-item__item--wrapper">
<template v-if="(item.type === 'radio')" >
<div class="radio-item" v-for="(field, index) in item.options" :key="index" >
@@ -199,6 +200,14 @@
<el-input placeholder="标题名称" :maxlength="200" show-word-limit v-model="currTarget.label"></el-input>
</div>
</div>
<div class="right-item" v-if="activeIndex > -1">
<div class="right-item__title no-solid">
<h2>说明文字</h2>
</div>
<div class="right-item__content">
<el-input placeholder="说明文字" :maxlength="200" show-word-limit v-model="currTarget.describe"></el-input>
</div>
</div>
<div class="right-item right-item__select" v-if="currTarget.type === 'radio' || currTarget.type === 'select' || currTarget.type === 'checkbox'">
<div class="right-item__title no-solid">
<h2>选项设置</h2>
@@ -347,70 +356,6 @@
</template>
</div>
</el-scrollbar>
<ai-dialog
:visible.sync="isShowAdd"
width="800px"
customFooter
title="发布">
<el-form label-position="top" class="publish" ref="form" label-width="120px" :model="form">
<div class="form-item__wrapper">
<div class="form-title">
<h2>基本信息</h2>
</div>
<div class="form-field">
<i>*</i>
<h2>截止时间</h2>
<span>表单截止后用户打开表单会提示此表单已结束</span>
</div>
<div class="form-item__container">
<el-radio-group v-model="form.periodValidityType">
<el-radio label="0">永久有效</el-radio>
<el-radio label="1">自定义时间</el-radio>
</el-radio-group>
</div>
<div class="form-item__container" v-if="form.periodValidityType === '1'">
<el-date-picker
v-model="form.periodValidityEndTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
size="small"
:picker-options="pickerOptions"
placeholder="截止时间">
</el-date-picker>
</div>
<div class="form-field">
<i>*</i>
<h2>匹配客户方式</h2>
<span>将参与活动的微信客户和企业微信客户匹配</span>
</div>
<div class="form-item__container">
<el-radio-group v-model="form.wechatId">
<el-radio label="0">客户微信ID匹配</el-radio>
</el-radio-group>
</div>
</div>
<div class="form-item__wrapper">
<div class="form-title">
<h2>提交次数限制</h2>
<span>此功能发布后不可修改</span>
</div>
<div class="form-field">
<i>*</i>
<h2>提交次数</h2>
</div>
<div class="form-item__container">
<el-radio-group v-model="form.commitType">
<el-radio label="0">不限次数</el-radio>
<el-radio label="1">限提交一次</el-radio>
</el-radio-group>
</div>
</div>
</el-form>
<template #footer>
<el-button @click="isShowAdd = false">返回</el-button>
<el-button type="primary" @click="onConfirm(1)">完成并发布</el-button>
</template>
</ai-dialog>
</template>
</ai-detail>
</template>
@@ -436,7 +381,6 @@
data () {
return {
isShowAdd: false,
components: components,
targetList: [],
form: {
@@ -446,12 +390,6 @@
isShowTableExplain: true,
isShowBtn: true,
headPicture: [],
commitType: '1',
periodValidityType: '0',
actionNotice: '1',
dynamicNotice: '1',
periodValidityEndTime: '',
shareStatus: '0',
count: 0,
wechatId: '0',
type: 0,
@@ -479,37 +417,6 @@
return {}
},
pageTitle () {
let typeName = '新增'
let itemName = '问卷调查'
if (this.params.id) {
typeName = '编辑'
}
if (this.params.type == 0) {
itemName = '问卷调查'
}
if (this.params.type == 1) {
itemName = '考试测评'
}
if (this.params.type == 2) {
itemName = '报名登记'
}
if (this.params.type == 3) {
itemName = '满意调查'
}
if (this.params.type == 4) {
itemName = '投票评选'
}
return `${typeName}${itemName}`
},
currComponentTitle () {
if (this.activeIndex >= 0) {
return this.targetList[this.activeIndex].fixedLabel + '设置'
@@ -545,54 +452,9 @@
},
init () {
if (this.params.type == 0) {
this.form.headPicture = [{
url: 'https://cdn.cunwuyun.cn/dvcp/h5/form/interview.png'
}]
}
if (this.params.type == 1) {
this.form.title = '考试测评'
this.form.headPicture = [{
url: 'https://cdn.cunwuyun.cn/dvcp/h5/form/exam.png'
}]
}
if (this.params.type == 2) {
this.form.title = '报名登记'
this.form.headPicture = [{
url: 'https://cdn.cunwuyun.cn/dvcp/h5/form/apply.png'
}]
}
if (this.params.type == 3) {
this.form.title = '满意调查'
this.form.headPicture = [{
url: 'https://cdn.cunwuyun.cn/dvcp/h5/form/satisfaction.png'
}]
}
if (this.params.type == 4) {
this.form.title = '投票评选'
this.form.headPicture = [{
url: 'https://cdn.cunwuyun.cn/dvcp/h5/form/vote.png'
}]
}
},
downloadImg (url) {
let image = new Image()
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function() {
let canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
let context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height)
let url = canvas.toDataURL("image/png")
let a = document.createElement("a")
let event = new MouseEvent("click")
a.download = name || 'photo'
a.href = url
a.dispatchEvent(event)
}
image.src = url
this.form.headPicture = [{
url: 'https://cdn.cunwuyun.cn/dvcp/h5/form/interview.png'
}]
},
onKeyup (e) {
@@ -600,7 +462,6 @@
},
onSelcetKeyup (e, index) {
console.log(e, index)
this.$set(this.currTarget.options[index], 'point', e.replace(/[^\d]/g, ''))
},
@@ -638,36 +499,30 @@
}
}
}
if (this.params.templateType != 1) {
this.isShowAdd = true
} else {
const fields = this.targetList.map(item => {
return {
fieldType: item.type,
fieldName: item.label,
fieldInfo: JSON.stringify(item)
}
})
this.instance.post(`/app/appquestionnairetemplate/addOrUpdate`, {
...this.form,
fields,
status: 0,
areaId: this.params.templateType == 0 ? this.areaId : '',
id: this.params.id,
headPicture: this.form.headPicture.length ? this.form.headPicture[0].url : '',
type: this.params.type,
templateType: this.params.templateType
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
const fields = this.targetList.map(item => {
return {
fieldType: item.type,
fieldName: item.label,
fieldInfo: JSON.stringify(item)
}
})
setTimeout(() => {
this.cancel()
}, 600)
}
})
}
this.instance.post(`/app/appassessmentscoretemplate/addOrUpdate`, {
...this.form,
fields,
id: this.params.id,
status: 1,
headPicture: this.form.headPicture.length ? this.form.headPicture[0].url : ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
},
bindEvent (e) {
@@ -686,7 +541,7 @@
},
getInfo (id) {
this.instance.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => {
this.instance.post(`/app/appassessmentscoretemplate/queryDetailById?id=${id}`).then(res => {
if (res.code == 0) {
this.form = {
...res.data,
@@ -705,59 +560,6 @@
})
},
onConfirm (status) {
if (this.params.templateType == 1) {
// this.submitTemp()
}
if (this.form.periodValidityType === '1') {
if (!this.form.periodValidityEndTime) {
return this.$message.error('请选择截止时间')
}
if (new Date(this.form.periodValidityEndTime).getTime() < Date.now()) {
return this.$message.error('截止时间不能晚于当前时间')
}
}
const fields = this.targetList.map(item => {
return {
fieldType: item.type,
fieldName: item.label,
fieldInfo: JSON.stringify(item)
}
})
this.instance.post(`/app/appquestionnairetemplate/addOrUpdate`, {
...this.form,
fields,
areaId: this.areaId,
status: status,
id: this.params.isQuote ? '' : this.params.id,
headPicture: this.form.headPicture.length ? this.form.headPicture[0].url : '',
type: this.params.type,
templateType: this.params.templateType,
periodValidityEndTime: this.form.periodValidityType === '1' ? this.form.periodValidityEndTime : ''
}).then(res => {
if (res.code == 0) {
if (this.params.isQuote) {
this.instance.post(`/app/appquestionnairetemplate/quoteCount?id=${this.params.id}`)
}
this.$message.success('提交成功')
if (status === 0) {
return this.cancel()
}
this.successInfo = res.data
this.$nextTick(() => {
this.cancel(true)
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
@@ -943,6 +745,12 @@
content: ' ';
}
& > p {
margin: 0 0 12px 12px;
color: #888;
font-size: 14px;
}
.left-item__item--remove {
display: flex;
position: absolute;

View File

@@ -1,188 +0,0 @@
<template>
<ai-detail isHasSidebar v-loading="isLoading">
<template slot="title">
<ai-title title="返乡报备详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<AiSidebar :tabTitle="tabList" v-model="currIndex"></AiSidebar>
<div v-show="currIndex === 0">
<ai-card title="基本信息" v-show="currIndex === 0">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="姓名" :value="info.name"></ai-info-item>
<ai-info-item label="填报时间" :value="info.createTime"></ai-info-item>
<ai-info-item label="身份证号" :value="info.idNumber"></ai-info-item>
<ai-info-item label="手机号码" :value="info.phone"></ai-info-item>
<ai-info-item label="人员类别" :value="dict.getLabel('EP_registerPersonType', info.type)"></ai-info-item>
<ai-info-item label="是否从事高危行业" :value="dict.getLabel('EP_highRiskIndustries', info.highRiskIndustries)"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="行程信息">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="出发时间" :value="info.startTime"></ai-info-item>
<ai-info-item label="出发地" >
<span :style="{color: info.denger == 1 ? '#FF4466' : '#333'}">{{info.startAreaName}} </span>
</ai-info-item>
<ai-info-item label="出发地详址" isLine :value="info.startAddress"></ai-info-item>
<ai-info-item label="出行方式" :value="info.travelTypeNames"></ai-info-item>
<ai-info-item label="车次/航班" isLine :value="info.trainNo"></ai-info-item>
<ai-info-item label="行程描述" :value="info.description"></ai-info-item>
<ai-info-item label="抵平卡口" :value="info.gatewayName"></ai-info-item>
<ai-info-item label="抵平时间" :value="info.arriveTime"></ai-info-item>
<ai-info-item label="目的地" :value="info.arriveAreaName"></ai-info-item>
<ai-info-item label="目的地详址" isLine :value="info.arriveAddress"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="健康状况">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="是否有风险旅居史" v-if="info.fromHighRiskArea === '1'">
<span style="color: red">{{ info.highRiskAreaName }}</span>
</ai-info-item>
<ai-info-item label="是否有风险旅居史" v-else value="否"></ai-info-item>
<ai-info-item label="7天内是否接触新冠确诊或疑似患者">
<span :style="{color: info.contactPatients === '1' ? 'red' : ''}">{{ dict.getLabel('yesOrNo', info.contactPatients) }}</span>
</ai-info-item>
<ai-info-item label="当前健康状况" v-if="info.abnormalHealth === '1'">
<span style="color: red">{{ dict.getLabel('EP_abnormalType', info.abnormalType) }}</span>
</ai-info-item>
<ai-info-item label="当前健康状况" v-else value="否"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</div>
<div v-show="currIndex === 1">
<ai-card title="风险处置">
<template #right>
<el-button type="primary" v-if="info.status === '0'" @click="release">解除异常</el-button>
</template>
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="姓名" :value="info.name"></ai-info-item>
<ai-info-item label="填报时间" :value="info.createTime"></ai-info-item>
<ai-info-item label="身份证号" :value="info.idNumber"></ai-info-item>
<ai-info-item label="手机号码" :value="info.phone"></ai-info-item>
<ai-info-item label="人员类别" :value="dict.getLabel('EP_registerPersonType', info.type)"></ai-info-item>
<ai-info-item label="是否从事高危行业" :value="dict.getLabel('EP_highRiskIndustries', info.highRiskIndustries)"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="风险处理意见">
<template #content>
<ai-table
:isShowPagination="false"
tableSize="small"
border
:tableData="info.riskDisposalList"
:col-configs="colConfigs"
@getList="() => {}">
</ai-table>
</template>
</ai-card>
<ai-card title="社区初排" v-if="info.cmAdvanceDisposal">
<template #content>
<ai-wrapper
style="margin-bottom: 20px;"
label-width="120px">
<ai-info-item label="处置意见" :value="dict.getLabel('EP_communityHandleType', info.cmAdvanceDisposal.communityHandleType)"></ai-info-item>
<ai-info-item v-if="info.cmAdvanceDisposal.communityHandleType === '1'" label="居家状态" :value="dict.getLabel('EP_homeStatus2', info.cmAdvanceDisposal.homeStatus)"></ai-info-item>
<ai-info-item v-if="info.cmAdvanceDisposal.communityHandleType === '1'" label="隔离时间" :value="info.cmAdvanceDisposal.quarantineBeginTime + ' - ' + info.cmAdvanceDisposal.quarantineEndTime"></ai-info-item>
<ai-info-item v-if="info.cmAdvanceDisposal.communityHandleType === '1'" label="隔离策略" :value="dict.getLabel('EP_quarantineStrategy', info.cmAdvanceDisposal.quarantineStrategy)"></ai-info-item>
<ai-info-item v-if="info.cmAdvanceDisposal.communityHandleType === '1'" label="管控方式" :value="dict.getLabel('EP_controlMethod', info.cmAdvanceDisposal.controlMethod)"></ai-info-item>
<ai-info-item v-if="info.cmAdvanceDisposal.communityHandleType === '1'" label="图片" isLine>
<ai-uploader
:instance="instance"
:value="info.cmAdvanceDisposal.fileList"
disabled
:limit="9">
</ai-uploader>
</ai-info-item>
<ai-info-item v-if="info.cmAdvanceDisposal.communityHandleType === '2'" label="风险解除证明文件" isLine>
<ai-uploader
:instance="instance"
:value="info.cmAdvanceDisposal.proveFileList"
disabled
:limit="9">
</ai-uploader>
</ai-info-item>
</ai-wrapper>
<ai-empty style="margin-bottom: 60px;" v-if="!info.cmAdvanceDisposal"></ai-empty>
</template>
</ai-card>
</div>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
isShow: false,
currIndex: 0,
isLoading: false,
tableData: [],
colConfigs: [
{prop: 'remarks', label: '异常记录', align: 'center' },
{prop: 'createTime', label: '创建时间', align: 'center'},
{prop: 'createUserName', label: '记录人', align: 'center' }
],
tabList: ['基本信息', '风险处置']
}
},
created () {
this.isLoading = true
if (this.params && this.params.id) {
this.id = this.params.id
this.$dict.load(['EP_registerPersonType', 'EP_communityHandleType', 'EP_highRiskIndustries', 'EP_travelType', 'yesOrNo', 'EP_homeStatus2', 'EP_quarantineStrategy', 'EP_controlMethod', 'EP_abnormalType']).then(() => {
this.getInfo(this.params.id)
})
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appepidemicpreventionregisterinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.travelTypeNames = res.data.travelType.split(',').map(v => {
return this.dict.getLabel('EP_travelType', v)
}).join('')
}
this.isLoading = false
}).catch(() => {
this.isLoading = false
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -5,16 +5,16 @@
<div class="content">
<ai-search-bar bottomBorder>
<template #left>
<el-button type="primary" @click="toAdd">新建模板</el-button>
<el-button type="primary" @click="toAdd('')">新建模板</el-button>
</template>
<template #right>
<el-input
v-model="search.name"
v-model="search.title"
size="small"
placeholder="请输入姓名、手机号"
clearable
v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, search.name = '', getList()"
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
@@ -31,7 +31,8 @@
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="changeStatus(row.id, row.status)">{{ row.status === '0' ? '启用' : '停用' }}</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
@@ -56,12 +57,12 @@
search: {
current: 1,
size: 10,
name: ''
title: ''
},
colConfigs: [
{ prop: 'name', label: '模板名称' },
{ prop: 'phone', align: 'center', label: '创建人' },
{ prop: 'startTime', align: 'center', label: '更新时间' }
{ prop: 'title', label: '模板名称' },
{ prop: 'createUserName', align: 'center', label: '创建人' },
{ prop: 'createTime', align: 'center', label: '更新时间' }
],
ids: [],
tableData: [],
@@ -80,7 +81,7 @@
methods: {
getList () {
this.instance.post(`/app/appepidemicpreventionregisterinfo/list`, null, {
this.instance.post(`/app/appassessmentscoretemplate/list`, null, {
params: {
...this.search
}
@@ -115,9 +116,20 @@
})
},
changeStatus (id, status) {
this.$confirm(`确定${status === '0' ? '启用' : '停用'}该数据?`).then(() => {
this.instance.post(`/app/appassessmentscoretemplate/stopRelease?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success(`${status === '0' ? '启用' : '停用'}成功!`)
this.getList()
}
})
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appepidemicpreventionregisterinfo/delete?id=${id}`).then(res => {
this.instance.post(`/app/appassessmentscoretemplate/delete?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()

View File

@@ -10,6 +10,7 @@ export const components = [
fixedLabel: '单选',
value: '',
points: '',
describe: '',
icon: 'iconradio',
isShowPoints: false,
required: true,
@@ -46,6 +47,7 @@ export const components = [
type: 'checkbox',
label: '多选',
fixedLabel: '多选',
describe: '',
points: '',
icon: 'iconcheck_box',
isShowPoints: false,
@@ -90,6 +92,7 @@ export const components = [
fixedLabel: '单下拉框',
value: '',
points: '',
describe: '',
icon: 'iconSelect',
isShowPoints: false,
required: true,
@@ -132,6 +135,7 @@ export const components = [
{
type: 'input',
label: '单行填空',
describe: '',
fixedLabel: '单行填空',
value: '',
pointType: '0',
@@ -146,6 +150,7 @@ export const components = [
{
type: 'textarea',
label: '多行填空',
describe: '',
fixedLabel: '多行填空',
pointType: '0',
icon: 'icontext_area',
@@ -168,6 +173,7 @@ export const components = [
type: 'upload',
label: '上传图片',
fixedLabel: '上传图片',
describe: '',
value: '',
icon: 'iconpic',
isShowPoints: false,