Commit b7c2d515 by xinla

表单bug

1 parent f36ba6a3
......@@ -27,10 +27,7 @@ export function dateFormat(dateString, fmt = 'yyyy-MM-dd hh:mm:ss') {
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1 || String(o[k]).length > 1 ? o[k] : '0' + o[k]
)
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 || String(o[k]).length > 1 ? o[k] : '0' + o[k])
}
}
......@@ -66,9 +63,7 @@ export function formatTime(time, option) {
if (option) {
return parseTime(time, option)
} else {
return (
d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
)
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
}
}
......@@ -172,7 +167,7 @@ export function param(json) {
Object.keys(json).map((key) => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
})
}),
).join('&')
}
......@@ -245,8 +240,7 @@ export function toggleClass(element, className) {
if (nameIndex === -1) {
classString += '' + className
} else {
classString =
classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length)
classString = classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length)
}
element.className = classString
}
......@@ -640,15 +634,13 @@ export async function getWechatAuthUserInfo(appId) {
let code = getQueryValue('code') //是否存在code
// let query = param2Obj() //
// let { code, appId, secret } = query
let local = window.location.origin.includes('localhost')
? 'http://h5.linkwechat.cn/test.html'
: window.location.href
let local = window.location.origin.includes('localhost') ? 'http://h5.linkwechat.cn/test.html' : window.location.href
if (!code) {
//不存在就打开上面的地址进行授权
let url = ''
if (appId) {
url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(
local
local,
)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
} else {
url = (await getWxRedirect()).data
......@@ -704,21 +696,24 @@ function tranDate(time) {
// 获取本机公网ip
export function getIP() {
return new Promise(function (resolve, reject) {
let script = document.createElement('script')
script.setAttribute('charset', 'utf-8')
script.setAttribute('type', 'text/javascript')
script.setAttribute('src', 'https://pv.sohu.com/cityjson?ie=utf-8')
document.getElementsByTagName('head')[0].appendChild(script)
script.onload = function () {
document.getElementsByTagName('head')[0].removeChild(script)
resolve(returnCitySN['cip'])
}
script.onerror = function () {
document.getElementsByTagName('head')[0].removeChild(script)
reject('')
}
})
// return new Promise(function (resolve, reject) {
// let script = document.createElement('script')
// script.setAttribute('charset', 'utf-8')
// script.setAttribute('type', 'text/javascript')
// script.setAttribute('src', 'https://pv.sohu.com/cityjson?ie=utf-8')
// document.getElementsByTagName('head')[0].appendChild(script)
// script.onload = function () {
// document.getElementsByTagName('head')[0].removeChild(script)
// resolve(returnCitySN['cip'])
// }
// script.onerror = function () {
// document.getElementsByTagName('head')[0].removeChild(script)
// reject('')
// }
// })
return axios({
url: 'https://api.ipify.org/?format=json',
}).then(({ data }) => data.ip || Promise.reject())
}
import { getProCityList } from '@/api/common'
......
......@@ -31,7 +31,7 @@
<el-input
ref="msgTextarea"
type="textarea"
v-model="baseForm.FormDescription"
v-model="baseForm.formDescription"
maxlength="200"
show-word-limit
placeholder="请填写表单说明"
......@@ -43,7 +43,7 @@
<el-switch v-model="ifFormLogo" :active-value="1" :inactive-value="0"></el-switch>
<div v-if="ifFormLogo == 1">
<div class="sub-des">开启后,表单首页或表单顶部会有logo图</div>
<upload :fileUrl.sync="baseForm.FormLogo" class="image-uploader" @update:file="handleUploadedHeadImage">
<upload :fileUrl.sync="baseForm.formLogo" class="image-uploader" @update:file="handleUploadedHeadImage">
<div slot="tip">建议大小2M以内,仅支持png/jpg等图片类型</div>
</upload>
</div>
......@@ -60,9 +60,9 @@
:index="1"
:surveyName="baseForm.surveyName"
:ifFormDescription="ifFormDescription"
:FormDescription="baseForm.FormDescription"
:formDescription="baseForm.formDescription"
:ifFormLogo="ifFormLogo"
:logoUrl="baseForm.FormLogo"
:logoUrl="baseForm.formLogo"
:FormIdY="formIdN"
:id="'y'"></FormsDetail>
<div style="display: flex; justify-content: center">
......@@ -76,9 +76,9 @@
unionDomId="FormsDetail3"
:surveyName="baseForm.surveyName"
:ifFormDescription="ifFormDescription"
:FormDescription="baseForm.FormDescription"
:formDescription="baseForm.formDescription"
:ifFormLogo="ifFormLogo"
:logoUrl="baseForm.FormLogo"
:logoUrl="baseForm.formLogo"
:FormIdY="formIdN"
:id="'y'"></FormsDetail>
<div style="display: flex; justify-content: center">
......@@ -346,8 +346,8 @@ export default {
styles: '', //表单数据
fillingRules: 0, //填写规则
surveyState: 0, //表单状态
FormDescription: '', //表单说明
FormLogo: '', //logo图片路径
formDescription: '', //表单说明
formLogo: '', //logo图片路径
tinyint: 0, //是否定时收集
anAuth: 0, //是否微信授权
//多渠道地址,
......@@ -635,11 +635,11 @@ export default {
this.baseForm.surveyName = data.surveyName
if (data.formDescription) {
this.ifFormDescription = 1
this.baseForm.FormDescription = data.formDescription
this.baseForm.formDescription = data.formDescription
}
if (data.formLogo) {
this.ifFormLogo = 1
this.baseForm.FormLogo = data.formLogo
this.baseForm.formLogo = data.formLogo
this.baseForm.logoUrl = data.formLogo
}
this.pageDataAll = JSON.parse(data.styles)
......@@ -998,14 +998,14 @@ export default {
return
}
if (this.ifFormDescription) {
if (!this.baseForm.FormDescription) {
if (!this.baseForm.formDescription) {
this.msgError('表单说明不能为空!')
return
}
}
if (this.ifFormLogo) {
if (!this.baseForm.logoUrl) {
this.baseForm.logoUrl = this.baseForm.FormLogo
this.baseForm.logoUrl = this.baseForm.formLogo
}
if (!this.baseForm.logoUrl) {
console.log('this.baseForm', this.baseForm)
......
<template>
<div
:style="
Ifcontainer
? ''
: 'background:#666;display: flex;justify-content: center;height: 100%;padding: 30px;'
"
>
<div :style="Ifcontainer ? '' : 'background:#666;display: flex;justify-content: center;height: 100%;padding: 30px;'">
<div
:class="Ifcontainer ? 'container' : 'container containerPC'"
data-title="调查问卷"
:id="cpUnionDomId"
v-loading="loading"
>
v-loading="loading">
<!-- 电脑端预览 -->
<phone-template
v-if="style == 'y' && fromList"
style="margin: 0 auto"
:title="fromList.surveyName"
>
<div
v-if="ifFormLogo && !formId && !fromList.formLogo"
style="display: flex; justify-content: center; margin-top: 30px"
>
<div
v-if="!logoUrl"
style="
width: 100px;
height: 100px;
background-color: #f2f2f2;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
"
>
Logo
</div>
<div
v-if="logoUrl"
style="
width: 100px;
height: 100px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
"
>
<img object-fit="cover" :src="logoUrl" style="width: 100%; height: 100%" />
</div>
</div>
<div
v-if="fromList.formLogo"
style="display: flex; justify-content: center; margin-top: 30px"
>
<div
v-if="fromList.formLogo"
style="
width: 100px;
height: 100px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
"
>
<el-image
object-fit="cover"
:src="fromList.formLogo"
style="width: 100%; height: 100%"
></el-image>
</div>
<phone-template v-if="style == 'y' && fromList" style="margin: 0 auto" :title="fromList.surveyName">
<div style="display: flex; justify-content: center; margin-top: 30px">
<template v-if="ifFormLogo && !formId && !fromList.formLogo">
<div v-if="!logoUrl" class="form-logo" style="">Logo</div>
<el-image v-else fit="cover" :src="logoUrl" class="form-logo" />
</template>
<el-image v-if="fromList.formLogo" fit="cover" :src="fromList.formLogo" class="form-logo" />
</div>
<div v-if="fromList.surveyName" class="ac mt20" style="font-size: 20px; font-weight: 700">
{{ fromList.surveyName }}
</div>
<div
v-if="fromList.formDescription"
style="font-size: 16px; padding: 30px 30px 0; line-height: 20px"
>
<div v-if="fromList.formDescription" style="font-size: 16px; padding: 30px 30px 0; line-height: 20px">
{{ fromList.formDescription }}
</div>
<div v-if="fromList.visibility == 0" style="padding: 15px; margin- top: 10px">
......@@ -99,14 +30,12 @@
fromList.surveyState != 2 &&
fromList.surveyState != 3) ||
(fromList.visibility == 1 && style == 'y')
"
>
">
<div v-if="drawingList.length != 0">
<el-form
:size="formConf.size"
:label-position="formConf.labelPosition"
:label-width="formConf.labelWidth + 'px'"
>
:label-width="formConf.labelWidth + 'px'">
<draggable-item
v-for="(element, index) in drawingList"
v-show="element.formCodeId != 0"
......@@ -115,22 +44,17 @@
:element="element"
:index="index"
:active-id="activeId"
:form-conf="formConf"
/>
:form-conf="formConf" />
</el-form>
</div>
<div
v-if="drawingList.length == 0 && fromList.surveyName"
style="padding: 15px; position: relative"
>
<div v-if="drawingList.length == 0 && fromList.surveyName" style="padding: 15px; position: relative">
<el-form
ref="elForm"
:model="formData"
:rules="rules"
size="medium"
label-width="100px"
label-position="top"
>
label-position="top">
<div style="color: transparent; position: relative; top: 500px">
<span style="color: transparent; position: relative; top: 500px">1</span>
</div>
......@@ -139,8 +63,7 @@
v-model="formData.userName"
placeholder="请输入你的姓名"
clearable
:style="{ width: '100%' }"
></el-input>
:style="{ width: '100%' }"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
......@@ -149,40 +72,23 @@
:maxlength="11"
show-word-limit
clearable
:style="{ width: '100%' }"
></el-input>
:style="{ width: '100%' }"></el-input>
</el-form-item>
</el-form>
</div>
<div style="color: #fff">1</div>
<div
v-if="page == pageData.length && page != 1"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page == pageData.length && page != 1" style="padding: 1rem; position: relative; top: 0.5rem">
<div @click="dePage" class="formDetailPush">上一页</div>
</div>
<div
v-if="page == pageData.length"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page == pageData.length" style="padding: 1rem; position: relative; top: 0.5rem">
<div @click.stop="fromPush()" class="formDetailPush">确认提交</div>
</div>
<div
v-if="page != pageData.length && page == 1"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page != pageData.length && page == 1" style="padding: 1rem; position: relative; top: 0.5rem">
<div @click="addPage" class="formDetailPush">下一页</div>
</div>
<div
v-if="page != pageData.length && page != 1"
style="
padding: 1rem;
position: relative;
top: 0.5rem;
display: flex;
justify-content: space-between;
"
>
style="padding: 1rem; position: relative; top: 0.5rem; display: flex; justify-content: space-between">
<div @click="dePage" style="width: 45%" class="formDetailPush">上一页</div>
<div @click="addPage" style="width: 45%" class="formDetailPush">下一页</div>
</div>
......@@ -204,41 +110,15 @@
></div> -->
<!-- 手机端 -->
<div v-if="style != 'y' && drawingList.length != 0" class="container">
<div
v-if="fromList.formLogo && !ifEnd"
style="display: flex; justify-content: center; margin-top: 30px"
>
<div
v-if="fromList.formLogo"
style="
width: 100px;
height: 100px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
"
>
<el-image
object-fit="cover"
:src="fromList.formLogo"
style="width: 100%; height: 100%"
></el-image>
</div>
<div v-if="fromList.formLogo && !ifEnd" style="display: flex; justify-content: center; margin-top: 30px">
<el-image fit="cover" :src="fromList.formLogo" class="form-logo"></el-image>
</div>
<div v-if="fromList.surveyName" class="ac mt20">
<span style="font-size: 20px; font-weight: 700">
{{ fromList.surveyName }}
</span>
</div>
<div
v-if="fromList.formDescription && !ifEnd"
style="font-size: 16px; padding: 30px 30px 0; line-height: 20px"
>
<div v-if="fromList.formDescription && !ifEnd" style="font-size: 16px; padding: 30px 30px 0; line-height: 20px">
{{ fromList.formDescription }}
</div>
<div v-if="fromList.visibility == 0 && !ifEnd" style="padding: 15px; margin- top: 8px">
......@@ -249,8 +129,7 @@
<el-form
:size="formConf.size"
:label-position="formConf.labelPosition"
:label-width="formConf.labelWidth + 'px'"
>
:label-width="formConf.labelWidth + 'px'">
<div v-for="(element, index) in drawingList" :key="element.renderKey">
<draggable-item
v-show="element.formCodeId != 0"
......@@ -258,8 +137,7 @@
:element="element"
:index="index"
:active-id="activeId"
:form-conf="formConf"
/>
:form-conf="formConf" />
<div v-show="element.formCodeId == 0" style="padding: 10px; padding-bottom: 0">
{{ element.defaultValue }}
</div>
......@@ -285,40 +163,21 @@
</div> -->
<div style="color: transparent; margin-top: 50px">1</div>
<div>
<div
v-if="page == pageData.length && page != 1"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page == pageData.length && page != 1" style="padding: 1rem; position: relative; top: 0.5rem">
<div @click="dePage" class="formDetailPush">上一页</div>
</div>
<div
v-if="page == pageData.length && !ifEnd"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page == pageData.length && !ifEnd" style="padding: 1rem; position: relative; top: 0.5rem">
<div @click.stop="fromPush()" class="formDetailPush">确认提交</div>
</div>
<div
v-if="page == pageData.length && ifEnd"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page == pageData.length && ifEnd" style="padding: 1rem; position: relative; top: 0.5rem">
<div class="formDetailPush">您已完成填写</div>
</div>
<div
v-if="page != pageData.length && page == 1"
style="padding: 1rem; position: relative; top: 0.5rem"
>
<div v-if="page != pageData.length && page == 1" style="padding: 1rem; position: relative; top: 0.5rem">
<div @click="addPage" class="formDetailPush">下一页</div>
</div>
<div
v-if="page != pageData.length && page != 1"
style="
padding: 1rem;
position: relative;
top: 0.5rem;
display: flex;
justify-content: space-between;
"
>
style="padding: 1rem; position: relative; top: 0.5rem; display: flex; justify-content: space-between">
<div @click="dePage" style="width: 45%" class="formDetailPush">上一页</div>
<div @click="addPage" style="width: 45%" class="formDetailPush">下一页</div>
</div>
......@@ -367,7 +226,7 @@ export default {
'index',
'surveyName',
'ifFormDescription',
'FormDescription',
'formDescription',
'ifFormLogo',
'logoUrl',
'unionDomId',
......@@ -478,19 +337,14 @@ export default {
this.fromList.fromLogo = val
},
},
FormDescription: {
formDescription: {
handler(val) {
console.log('FormDescription', val)
this.fromList.formDescription = val
},
},
// eslint-disable-next-line func-names
'activeData.label': function (val, oldVal) {
if (
this.activeData.placeholder === undefined ||
!this.activeData.tag ||
oldActiveId !== this.activeId
) {
if (this.activeData.placeholder === undefined || !this.activeData.tag || oldActiveId !== this.activeId) {
return
}
this.activeData.placeholder = this.activeData.placeholder.replace(oldVal, '')
......@@ -588,8 +442,9 @@ export default {
//表单提交
async fromPush() {
this.userIp = this.userIp || (await getIP())
if (!this.userIp) {
try {
this.userIp = this.userIp || (await getIP())
} catch (error) {
this.toast('获取ip失败')
return
}
......@@ -680,11 +535,7 @@ export default {
let curItem = answer[i]
if (curItem.required) {
let label = curItem.label.substring(curItem.label.indexOf('.') + 1)
if (
curItem.defaultValue === '' ||
curItem.defaultValue === undefined ||
curItem.defaultValue.length === 0
) {
if (curItem.defaultValue === '' || curItem.defaultValue === undefined || curItem.defaultValue.length === 0) {
// this.toast('第' + curItem.page + '页,' + label + ',' + '不能为空')
this.toast(`第${curItem.page}页,${label},${formCodeDict[curItem.formCodeId]}不能为空`)
return
......@@ -693,17 +544,13 @@ export default {
if (curItem.formCodeId == 4) {
if (curItem.max) {
if (curItem.defaultValue > curItem.max) {
this.toast(
'第' + curItem.page + '页,' + label + ',数字文本中数字不能大于' + curItem.max
)
this.toast('第' + curItem.page + '页,' + label + ',数字文本中数字不能大于' + curItem.max)
return
}
}
if (curItem.min) {
if (curItem.defaultValue < curItem.min) {
this.toast(
'第' + curItem.page + '页,' + label + ',数字文本中数字不能小于' + curItem.min
)
this.toast('第' + curItem.page + '页,' + label + ',数字文本中数字不能小于' + curItem.min)
return
}
}
......@@ -712,10 +559,7 @@ export default {
}
if (curItem.regList && curItem.regList.length != 0) {
curItem.regList[0].pattern = curItem.regList[0].pattern.substring(
1,
curItem.regList[0].pattern.length - 2
)
curItem.regList[0].pattern = curItem.regList[0].pattern.substring(1, curItem.regList[0].pattern.length - 2)
let a = new RegExp(curItem.regList[0].pattern)
if (!a.test(curItem.defaultValue)) {
......@@ -901,7 +745,7 @@ export default {
},
_isMobile() {
let flag = navigator.userAgent.match(
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i,
)
return flag
},
......@@ -1029,8 +873,9 @@ export default {
async siteStas() {
if (!['y', 'q'].includes(this.style)) {
//智能表单站点统计 PV
this.userIp = this.userIp || (await getIP())
if (!this.userIp) {
try {
this.userIp = this.userIp || (await getIP())
} catch (error) {
this.toast('获取ip失败')
return
}
......@@ -1075,7 +920,15 @@ export default {
<style lang="scss" scoped>
$selectedColor: #f6f7ff;
$lighterBlue: #409eff;
.form-logo {
width: 100px;
height: 100px;
background-color: #f2f2f2;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.container {
overflow-y: auto;
position: relative;
......
......@@ -4,21 +4,23 @@
<el-row type="flex" justify="space-between">
<el-col :span="5" class="left g-pad20">
<div class="title">
<div class="title-name">
表单分组
</div>
<div class="title-btn" @click="addGroup">
添加
</div>
<div class="title-name">表单分组</div>
<div class="title-btn" @click="addGroup">添加</div>
</div>
<div class="item-list">
<div class="item" :class="{ active: groupIndex == key }" v-for="(group, key) in groupList" :key="group.id"
<div
class="item"
v-for="(group, key) in groupList"
:class="{ active: groupIndex == key }"
:key="group.id"
@click="switchGroup(key, group)">
<div class="name">{{ group.name }}</div>
<el-dropdown v-if="groupIndex == key && group.flag === 0" class="dropdown"
<el-dropdown
v-if="groupIndex == key && group.flag === 0"
class="dropdown"
@command="onGroupCommand($event, group)">
<div v-if="group">
<span class="dot" v-if="group.name!='默认分组'">
<span class="dot" v-if="group.name != '默认分组'">
<!-- <img :src="require('@/assets/drainageCode/more.png')" alt=""> -->
<i class="el-icon-more"></i>
</span>
......@@ -31,37 +33,45 @@
</div>
</div>
</el-col>
<el-col :span="19" class="g-pad20" style="width: 85%;">
<el-col :span="19" class="g-pad20" style="width: 85%">
<div>
<el-form :inline="true" label-width="80px" label-position="left">
<el-form-item label="表单ID">
<el-input onkeyup="value=value.replace(/[^\d]/g,'')" v-model="query.id" placeholder="请输入表单ID" clearable @keyup.enter.native="search()" />
<el-input
onkeyup="value=value.replace(/[^\d]/g,'')"
v-model="query.id"
placeholder="请输入表单ID"
clearable
@keyup.enter.native="search()" />
</el-form-item>
<el-form-item label="表单名称">
<!-- readonly -->
<el-input v-model="query.surveyName" clearable placeholder="请输入表单名称" @keyup.enter.native="search()" />
<el-input
v-model="query.surveyName"
clearable
placeholder="请输入表单名称"
@keyup.enter.native="search()" />
</el-form-item>
<!-- <el-form-item label="创建时间">
<el-date-picker v-model="seachDate" format="yyyy-MM-dd" value-format="yyyyMMdd" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item> -->
<el-form-item label="创建时间">
<!-- <el-date-picker v-model="seachDate" format="yyyy-MM-dd" value-format="yyyyMMdd" type="daterange"
<!-- <el-date-picker v-model="seachDate" format="yyyy-MM-dd" value-format="yyyyMMdd" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> -->
<el-date-picker
v-model="query.createTime"
default-time="['00:00:00','00:00:00']"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择时间">
</el-date-picker>
<el-date-picker
v-model="query.createTime"
default-time="['00:00:00','00:00:00']"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择时间"></el-date-picker>
</el-form-item>
<el-form-item label="选择状态" prop="addState">
<el-select v-model="query.surveyState">
<el-option label="未发布" :value="0"> </el-option>
<el-option label="未收集" :value="4"> </el-option>
<el-option label="收集中" :value="1"> </el-option>
<el-option label="已暂停" :value="2"> </el-option>
<el-option label="已结束" :value="3"> </el-option>
<el-option label="未发布" :value="0"></el-option>
<el-option label="未收集" :value="4"></el-option>
<el-option label="收集中" :value="1"></el-option>
<el-option label="已暂停" :value="2"></el-option>
<el-option label="已结束" :value="3"></el-option>
<!-- <el-option label="待通过" :value="3">
</el-option> -->
</el-select>
......@@ -84,47 +94,63 @@
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="表单ID&名称" min-width="170" align="center" prop="id" show-overflow-tooltip >
<el-table-column label="表单ID&名称" min-width="170" align="center" prop="id" show-overflow-tooltip>
<template slot-scope="{ row }">
<div>ID:{{row.id}}</div>
<div>名称:{{row.surveyName}}</div>
<div>ID:{{ row.id }}</div>
<div>名称:{{ row.surveyName }}</div>
</template>
</el-table-column>
<el-table-column label="表单分组" align="center" min-width="100" prop="groupName" show-overflow-tooltip >
<el-table-column label="表单分组" align="center" min-width="100" prop="groupName" show-overflow-tooltip>
<template slot-scope="{ row }">
<div style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">{{row.groupName}}</div>
</template>
</el-table-column>
<el-table-column label="创建人&时间" align="center" min-width="130" prop="createTime" show-overflow-tooltip >
<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">
{{ row.groupName }}
</div>
</template>
</el-table-column>
<el-table-column label="创建人&时间" align="center" min-width="130" prop="createTime" show-overflow-tooltip>
<template slot-scope="{ row }">
<div>{{row.createBy}}</div>
<div>{{row.createTime}}</div>
<div>{{ row.createBy }}</div>
<div>{{ row.createTime }}</div>
</template>
</el-table-column>
<el-table-column label="收集开始&结束时间" align="center" min-width="200" prop="qrUserInfos" show-overflow-tooltip>
<el-table-column
label="收集开始&结束时间"
align="center"
min-width="200"
prop="qrUserInfos"
show-overflow-tooltip>
<template slot-scope="{ row }">
<div>开始时间:{{row.timingStart}}<span v-if="!row.timingStart">永久</span></div>
<div>结束时间:{{row.timingEnd}}<span v-if="!row.timingEnd">永久</span></div>
<div>
开始时间:{{ row.timingStart }}
<span v-if="!row.timingStart">永久</span>
</div>
<div>
结束时间:{{ row.timingEnd }}
<span v-if="!row.timingEnd">永久</span>
</div>
</template>
</el-table-column>
<el-table-column label="表单状态" align="center" min-width="100" prop="qrGroupName" show-overflow-tooltip>
<template slot-scope="{ row }">
<div v-if="row.surveyState==0">未发布</div>
<div v-if="row.surveyState==1">收集中</div>
<div v-if="row.surveyState==2">已暂停</div>
<div v-if="row.surveyState==3">已结束</div>
<div v-if="row.surveyState==4">未收集</div>
<div v-if="row.surveyState == 0">未发布</div>
<div v-if="row.surveyState == 1">收集中</div>
<div v-if="row.surveyState == 2">已暂停</div>
<div v-if="row.surveyState == 3">已结束</div>
<div v-if="row.surveyState == 4">未收集</div>
</template>
</el-table-column>
<el-table-column label="总访问量/有效收集量" align="center" min-width="180" prop="qrGroupName"
show-overflow-tooltip >
</el-table-column>
<el-table-column
label="总访问量/有效收集量"
align="center"
min-width="180"
prop="qrGroupName"
show-overflow-tooltip>
<template slot="header" slot-scope="scope">
<div style="display: flex;align-items: center;">
<div style="display: flex; align-items: center">
<div>总访问量/有效收集量</div>
<div style="margin-left: 10px;">
<el-popover width="250" trigger="hover" >
<div style="margin-left: 10px">
<el-popover width="250" trigger="hover">
<p>总访问量:PV;</p>
<p>有效收集量:成功提交表单的UV</p>
<i slot="reference" class="el-icon-question"></i>
......@@ -133,30 +159,57 @@
</div>
</template>
<template slot-scope="{ row }">
<div>{{row.totalVisits}}/{{row.collectionVolume}}</div>
<div>{{ row.totalVisits }}/{{ row.collectionVolume }}</div>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="最近操作人&时间" align="center" min-width="130" prop="qrGroupName"
<el-table-column
label="最近操作人&时间"
align="center"
min-width="130"
prop="qrGroupName"
show-overflow-tooltip>
<template slot-scope="{ row }">
<div>{{row.updateBy}}</div>
<div>{{row.updateTime}}</div>
</template>
</el-table-column>
<div>{{ row.updateBy }}</div>
<div>{{ row.updateTime }}</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="260" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
fixed="right"
width="260"
class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<!-- <el-button type="text" @click="goRoute('staffDetail', row.id)">详情|统计</el-button> -->
<el-button type="text" @click.stop="openPreview(row.id)">预览</el-button>
<el-button v-if="[0,2].includes(+row.surveyState)" type="text" @click='updateSurveyStatus(row.id,1,row)'>开启</el-button>
<el-button v-if="row.surveyState==0" type="text" @click="goRoute('add','',row.id)">编辑</el-button>
<el-button v-if="[1,2].includes(+row.surveyState)" @click.stop="openChannels(row.id)" type="text" >分享</el-button>
<el-button v-if="[1,4].includes(+row.surveyState)" type="text" @click='updateSurveyStatus(row.id,2,row)'>暂停</el-button>
<el-button v-if="[1,2].includes(+row.surveyState)" type="text" @click='updateSurveyStatus(row.id,3,row)'>结束</el-button>
<el-button v-if="row.surveyState!=1" type="text" @click="removeFn('single', row.id)">删除</el-button>
<el-button v-if="row.surveyState!=0" type="text" @click="goRoute('smartFormStatistics',row.id)">统计</el-button>
<el-button
v-if="[0, 2].includes(+row.surveyState)"
type="text"
@click="updateSurveyStatus(row.id, 1, row)">
开启
</el-button>
<el-button v-if="row.surveyState == 0" type="text" @click="goRoute('add', '', row.id)">编辑</el-button>
<el-button v-if="[1, 2].includes(+row.surveyState)" @click.stop="openChannels(row.id)" type="text">
分享
</el-button>
<el-button
v-if="[1, 4].includes(+row.surveyState)"
type="text"
@click="updateSurveyStatus(row.id, 2, row)">
暂停
</el-button>
<el-button
v-if="[1, 2].includes(+row.surveyState)"
type="text"
@click="updateSurveyStatus(row.id, 3, row)">
结束
</el-button>
<el-button v-if="row.surveyState != 1" type="text" @click="removeFn('single', row.id)">删除</el-button>
<el-button v-if="row.surveyState != 0" type="text" @click="goRoute('smartFormStatistics', row.id)">
统计
</el-button>
<!-- <el-dropdown style="margin-left: 10px">
<el-button type="text">
<i class="el-icon-more"></i>
......@@ -192,8 +245,7 @@
<el-dialog :title="`${groupForm.id ? '修改' : '新建'}分组`" :visible.sync="groupVisible" width="30%">
<el-form :model="groupForm" :rules="rules" ref="groupForm">
<el-form-item label="分组名称" prop="name" label-width="80px">
<el-input v-model="groupForm.name" clearable autocomplete="off" maxlength="15" show-word-limit>
</el-input>
<el-input v-model="groupForm.name" clearable autocomplete="off" maxlength="15" show-word-limit></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -203,346 +255,374 @@
</el-dialog>
<el-dialog title="表单预览" :visible.sync="Preview" width="auto" destroy-on-close>
<FormsDetail style="margin: -20px 5px 0;" :FormIdY="FormIdY" id='y' :key="FormIdY"></FormsDetail>
<FormsDetail style="margin: -20px 5px 0" :FormIdY="FormIdY" id="y" :key="FormIdY"></FormsDetail>
</el-dialog>
<el-dialog title="表单分享" :visible.sync="ifChannels" width="auto" destroy-on-close>
<Channels style="margin-top: -20px;" :FormIdY="FormIdY" :key="FormIdY"></Channels>
<Channels style="margin-top: -20px" :FormIdY="FormIdY" :key="FormIdY"></Channels>
</el-dialog>
</div>
</template>
<script>
import { surveyList,deleteInfoToSurvey,updateSurveyStatus,updateInfoToSurvey,
// updateSurveyGroup
} from '@/api/drainageCode/smartForms.js';
import { dateFormat } from '@/utils/index'
import FormsDetail from './build/formsDetail.vue'
import Channels from './components/Channels.vue'
import {
getList,
downloadBatch,
getCodeCategoryList,
addCodeCategory,
updateCodeCategory,
removeCodeCategory,
} from '@/api/drainageCode/staff'
import SelectUser from '@/components/SelectUser'
const groupForm = {
mediaType: 15,
name: '',
}
export default {
name: 'CodeStaff',
components: {
SelectUser,FormsDetail,Channels
},
data() {
return {
//当前时间戳
newData:'',
//分享显示
ifChannels:false,
newGroupId:'',
//预览表单id
FormIdY:'',
//预览显示
Preview:false,
//默认分组id
DefaultGroupingId:'',
// 查询参数
seachDate:"",
query: {
createTime:'',
pageNum: 1,
pageSize: 10,
groupId: '',
surveyName: "",
surveyState: undefined,
// qrName: '', // 活码名称
// qrUserName: undefined,
// orderByColumn: 'wqc.update_time',
// isAsc: 'desc',
},
userArray: [], // 选择人员
userArrayStr: '',
dialogVisible: false,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 总条数
total: 0,
// 表格数据
list: [],
// 表单参数
form: {
codeType: 3,
qrcode: '',
isJoinConfirmFriends: 0,
weEmpleCodeTags: [],
weEmpleCodeUseScops: [],
},
groupList: [],
groupVisible: false,
groupForm: JSON.parse(JSON.stringify(groupForm)) ,
rules: {
name: [{
required: true,
message: '请输入分组名称',
trigger: 'blur',
},
{
min: 1,
max: 15,
message: '长度在 1 到 15 个字符',
trigger: 'blur',
},
],
},
groupIndex: 0,
}
},
created() {
this.getCodeCategoryListFn()
// this.$store.dispatch(
// 'app/setBusininessDesc',
// `
// <div>支持单人、批量单人及多人方式新建员工活码,客户可以通过扫描员工活码添加员工为好友,并支持自动给客户打标签和发送欢迎语。</div>
// `
// )
},
mounted() {
},
methods: {
openPreview(id){
this.FormIdY=id;
this.Preview=true;
import {
surveyList,
deleteInfoToSurvey,
updateSurveyStatus,
updateInfoToSurvey,
// updateSurveyGroup
} from '@/api/drainageCode/smartForms.js'
import { dateFormat } from '@/utils/index'
import FormsDetail from './build/formsDetail.vue'
import Channels from './components/Channels.vue'
import {
getList,
downloadBatch,
getCodeCategoryList,
addCodeCategory,
updateCodeCategory,
removeCodeCategory,
} from '@/api/drainageCode/staff'
import SelectUser from '@/components/SelectUser'
const groupForm = {
mediaType: 15,
name: '',
}
export default {
name: 'CodeStaff',
components: {
SelectUser,
FormsDetail,
Channels,
},
data() {
return {
//当前时间戳
newData: '',
//分享显示
ifChannels: false,
newGroupId: '',
//预览表单id
FormIdY: '',
//预览显示
Preview: false,
//默认分组id
DefaultGroupingId: '',
// 查询参数
seachDate: '',
query: {
createTime: '',
pageNum: 1,
pageSize: 10,
groupId: '',
surveyName: '',
surveyState: undefined,
// qrName: '', // 活码名称
// qrUserName: undefined,
// orderByColumn: 'wqc.update_time',
// isAsc: 'desc',
},
openChannels(id){
this.FormIdY=id;
this.ifChannels=true;
userArray: [], // 选择人员
userArrayStr: '',
dialogVisible: false,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 总条数
total: 0,
// 表格数据
list: [],
// 表单参数
form: {
codeType: 3,
qrcode: '',
isJoinConfirmFriends: 0,
weEmpleCodeTags: [],
weEmpleCodeUseScops: [],
},
//更新表单状态
updateInfoToSurvey(data){
updateInfoToSurvey((data))
.then((res) => {
console.log('更改状态返回值',res)
})
.catch(() => {
})
groupList: [],
groupVisible: false,
groupForm: JSON.parse(JSON.stringify(groupForm)),
rules: {
name: [
{
required: true,
message: '请输入分组名称',
trigger: 'blur',
},
{
min: 1,
max: 15,
message: '长度在 1 到 15 个字符',
trigger: 'blur',
},
],
},
//开启表单
updateSurveyStatus(id,surveyState,row,style){
let that=this;
console.log('row',row.surveyState,row.timingStart,row)
if(row.surveyState==0&&!row.timingStart){
let data={
id:id,
timingStart:dateFormat(new Date())
}
console.log('data',data)
this.updateInfoToSurvey(data);
}else if(row.surveyState==0&&row.timingStart){
let data={
id:id,
timingStart:row.timingStart,
timingEnd:row.timingEnd,
}
console.log('data',data)
this.updateInfoToSurvey(data);
groupIndex: 0,
}
},
created() {
this.getCodeCategoryListFn()
// this.$store.dispatch(
// 'app/setBusininessDesc',
// `
// <div>支持单人、批量单人及多人方式新建员工活码,客户可以通过扫描员工活码添加员工为好友,并支持自动给客户打标签和发送欢迎语。</div>
// `
// )
},
mounted() {},
methods: {
openPreview(id) {
this.FormIdY = id
this.Preview = true
},
openChannels(id) {
this.FormIdY = id
this.ifChannels = true
},
//更新表单状态
updateInfoToSurvey(data) {
updateInfoToSurvey(data)
.then((res) => {
console.log('更改状态返回值', res)
})
.catch(() => {})
},
//开启表单
updateSurveyStatus(id, surveyState, row, style) {
let that = this
console.log('row', row.surveyState, row.timingStart, row)
if (row.surveyState == 0 && !row.timingStart) {
let data = {
id: id,
timingStart: dateFormat(new Date()),
}
if(surveyState==1){
if(row.timingStart){
let newData=new Date();
if(newData<new Date(row.timingStart)){
surveyState=1;
let data={
id:id,
timingStart:dateFormat(new Date()),
timingEnd:row.timingEnd,
}
this.updateInfoToSurvey(data);
}
}
if(row.timingEnd){
let newData=new Date();
if(newData>new Date(row.timingEnd)){
surveyState=3;
console.log('data', data)
this.updateInfoToSurvey(data)
} else if (row.surveyState == 0 && row.timingStart) {
let data = {
id: id,
timingStart: row.timingStart,
timingEnd: row.timingEnd,
}
console.log('data', data)
this.updateInfoToSurvey(data)
}
if (surveyState == 1) {
if (row.timingStart) {
let newData = new Date()
if (newData < new Date(row.timingStart)) {
surveyState = 1
let data = {
id: id,
timingStart: dateFormat(new Date()),
timingEnd: row.timingEnd,
}
this.updateInfoToSurvey(data)
}
}
console.log('surveyState',surveyState)
console.log('row.timingStart',row.timingStart)
if(surveyState==3){
let newData=new Date();
let data={
id:id,
timingEnd:dateFormat(new Date())
if (row.timingEnd) {
let newData = new Date()
if (newData > new Date(row.timingEnd)) {
surveyState = 3
}
this.updateInfoToSurvey(data);
}
let data={
id:id,
surveyState:surveyState
}
console.log('surveyState', surveyState)
console.log('row.timingStart', row.timingStart)
if (surveyState == 3) {
let newData = new Date()
let data = {
id: id,
timingEnd: dateFormat(new Date()),
}
updateSurveyStatus((data))
.then((res) => {
if([1,2,3].includes(surveyState)&&style!='no'){
this.msgSuccess('操作成功')
}
that.getList();
})
.catch(() => {
})
},
addGroup() {
this.groupForm = JSON.parse(JSON.stringify(groupForm))
this.groupVisible = true
},
getCodeCategoryListFn() {
getCodeCategoryList({ mediaType: groupForm.mediaType })
.then(({data}) => {
this.groupList = data
let groupId= this.$route.query && this.$route.query.groupId
let groupIndex= data.findIndex(e=> e.id === groupId)
if (groupId&&groupIndex != -1) {
this.query.groupId = groupId
this.query.groupName =data[groupIndex].name
} else {
this.query.groupId = data[0].id
this.query.groupName = data[0].name
}
this.groupIndex = groupIndex
this.query.pageNum = 1
for(let i=0;i<data.length;i++){
if(data[i].name=='默认分组'){
this.newGroupId=data[i].id;
}
}
this.getList()
})
},
switchGroup(index, data) {
console.log('data',data)
this.groupIndex = index
this.query.groupName = data.name
this.$router.replace({
query:{
groupId : data.id
this.updateInfoToSurvey(data)
}
let data = {
id: id,
surveyState: surveyState,
}
updateSurveyStatus(data)
.then((res) => {
if ([1, 2, 3].includes(surveyState) && style != 'no') {
this.msgSuccess('操作成功')
}
})
this.query.groupId = data.id
this.search()
},
getSelectUser(data) {
this.userArray = data
this.query.qrUserName = this.userArray
.map(function(obj, index) {
return obj.name
})
.join(',')
},
search() {
that.getList()
})
.catch(() => {})
},
addGroup() {
this.groupForm = JSON.parse(JSON.stringify(groupForm))
this.groupVisible = true
},
getCodeCategoryListFn() {
getCodeCategoryList({ mediaType: groupForm.mediaType }).then(({ data }) => {
this.groupList = data
let groupId = this.$route.query && this.$route.query.groupId
let groupIndex = data.findIndex((e) => e.id === groupId)
if (groupId && groupIndex != -1) {
this.query.groupId = groupId
this.query.groupName = data[groupIndex].name
this.groupIndex = groupIndex
} else {
this.query.groupId = undefined
this.query.groupName = undefined
this.groupIndex = undefined
}
this.query.pageNum = 1
for (let i = 0; i < data.length; i++) {
if (data[i].name == '默认分组') {
this.newGroupId = data[i].id
}
}
this.getList()
},
getList() {
this.loading = true
console.log('this.seachDate',this.seachDate)
surveyList((this.query))
.then((res) => {
this.total = Number(res.total)
this.list = res.rows;
for(let i=0;i<this.list.length;i++){
this.list[i].groupName=this.query.groupName;
if(this.list[i].surveyState==4){
if(this.list[i].timingStart){
let newData=new Date();
if(newData<new Date(this.list[i].timingStart)){
this.list[i].surveyState=4;
}else{
this.list[i].surveyState=1;
this.updateSurveyStatus(this.list[i].id,1,this.list[i],'no')
}
})
},
switchGroup(index, data) {
console.log('data', data)
this.groupIndex = index
this.query.groupName = data.name
this.$router.replace({
query: {
groupId: data.id,
},
})
this.query.groupId = data.id
this.search()
},
getSelectUser(data) {
this.userArray = data
this.query.qrUserName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
},
search() {
this.query.pageNum = 1
this.getList()
},
getList() {
this.loading = true
surveyList(this.query)
.then((res) => {
this.total = Number(res.total)
this.list = res.rows
for (let i = 0; i < this.list.length; i++) {
this.list[i].groupName = this.query.groupName
if (this.list[i].surveyState == 4) {
if (this.list[i].timingStart) {
let newData = new Date()
if (newData < new Date(this.list[i].timingStart)) {
this.list[i].surveyState = 4
} else {
this.list[i].surveyState = 1
this.updateSurveyStatus(this.list[i].id, 1, this.list[i], 'no')
}
if(this.list[i].timingEnd){
let newData=new Date();
if(newData>new Date(this.list[i].timingEnd)){
this.list[i].surveyState=3;
}
}
if (this.list[i].timingEnd) {
let newData = new Date()
if (newData > new Date(this.list[i].timingEnd)) {
this.list[i].surveyState = 3
}
}
// this.list[i].createTime=this.list[i].createTime.substr(0,10);
}
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false
})
},
/** 重置按钮操作 */
resetQuery() {
// this.query.qrName = ''
this.query.createTime = ''
this.query.surveyState = ''
this.query.surveyName = ''
this.query.id=''
// this.userArray = []
// this.query.addState = ''
// this.query.userArrayStr = ''
this.search()
},
goRoute(path, id,formId,currentActiveA,currentActiveB) {
this.$router.push({
path: path,
query: {
id,
formId,
currentActiveA,
currentActiveB,
groupId: this.query.groupId
// this.list[i].createTime=this.list[i].createTime.substr(0,10);
}
this.loading = false
this.ids = []
})
},
// 多选框选中数据
handleSelectionChange(selection) {
console.log('selection',selection)
this.ids = selection.map((item) => item.id)
},
/** 删除按钮操作 */
removeFn(type, id) {
if (type === 'mult' && !this.ids.length) {
this.msgInfo('请选择要删除项!')
return
}
const ids = id || this.ids.join(',')
this.$confirm('是否确定删除当前问卷?该操作同步删除所有数据,且不可恢复,请谨慎操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return deleteInfoToSurvey((ids))
})
.then(() => {
this.search()
this.msgSuccess('删除成功')
.catch(() => {
this.loading = false
})
},
/** 重置按钮操作 */
resetQuery() {
// this.query.qrName = ''
this.query.createTime = ''
this.query.surveyState = ''
this.query.surveyName = ''
this.query.id = ''
// this.userArray = []
// this.query.addState = ''
// this.query.userArrayStr = ''
this.search()
},
goRoute(path, id, formId, currentActiveA, currentActiveB) {
this.$router.push({
path: path,
query: {
id,
formId,
currentActiveA,
currentActiveB,
groupId: this.query.groupId,
},
})
},
// 多选框选中数据
handleSelectionChange(selection) {
console.log('selection', selection)
this.ids = selection.map((item) => item.id)
},
/** 删除按钮操作 */
removeFn(type, id) {
if (type === 'mult' && !this.ids.length) {
this.msgInfo('请选择要删除项!')
return
}
const ids = id || this.ids.join(',')
this.$confirm('是否确定删除当前问卷?该操作同步删除所有数据,且不可恢复,请谨慎操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return deleteInfoToSurvey(ids)
})
.then(() => {
this.search()
this.msgSuccess('删除成功')
})
.catch(function () {})
},
download(id, userName, qrName) {
let name = userName + '-' + qrName + '.png'
downloadBatch(id).then((res) => {
if (res != null) {
let blob = new Blob([res], {
type: 'application/zip',
})
.catch(function() {})
},
download(id, userName, qrName) {
let name = userName + '-' + qrName + '.png'
downloadBatch(id).then((res) => {
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
},
/** 下载 */
downloadBatch(qrCode) {
if (!this.ids.length) {
this.msgInfo('请先勾选下载项!')
return
}
this.$confirm('是否确认下载所有图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return downloadBatch(this.ids.join(','))
})
.then((res) => {
if (res != null) {
let blob = new Blob([res], {
type: 'application/zip',
......@@ -550,230 +630,197 @@
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.download = '批量员工活码.zip' // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
},
/** 下载 */
downloadBatch(qrCode) {
if (!this.ids.length) {
this.msgInfo('请先勾选下载项!')
return
}
this.$confirm('是否确认下载所有图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return downloadBatch(this.ids.join(','))
})
.then((res) => {
if (res != null) {
let blob = new Blob([res], {
type: 'application/zip',
})
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '批量员工活码.zip' // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch(function() {})
},
// 新增分组
onAddOrUpdateGroup() {
this.$refs.groupForm.validate((validate) => {
console.log(this.groupForm)
if (this.groupForm.id) {
let obj = {
id: this.groupForm.id,
name: this.groupForm.name,
mediaType: groupForm.mediaType,
}
this.groupForm = obj
}
if (validate) {
;
(this.groupForm.id ? updateCodeCategory : addCodeCategory)(this.groupForm).then(
(res) => {
this.groupVisible = false
this.groupForm = JSON.parse(JSON.stringify(groupForm))
this.$refs.groupForm.clearValidate()
this.msgSuccess('操作成功')
this.getCodeCategoryListFn()
}
)
.catch(function () {})
},
// 新增分组
onAddOrUpdateGroup() {
this.$refs.groupForm.validate((validate) => {
console.log(this.groupForm)
if (this.groupForm.id) {
let obj = {
id: this.groupForm.id,
name: this.groupForm.name,
mediaType: groupForm.mediaType,
}
})
},
onGroupCommand(e, group) {
if (group.id === '1') {
this.msgInfo('默认分组不可操作!')
return
}
if (e == 'edit') {
this.editGroup(group)
} else if (e == 'remove') {
this.removeGroup(group.id)
this.groupForm = obj
}
},
editGroup(group) {
this.groupForm = JSON.parse(JSON.stringify(group))
this.groupVisible = true
},
removeGroup(id) {
let that=this;
this.$confirm('是否确认删除当前分组,删除后所有表单将设置为默认分组,该操作不可撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
if (validate) {
;(this.groupForm.id ? updateCodeCategory : addCodeCategory)(this.groupForm).then((res) => {
this.groupVisible = false
this.groupForm = JSON.parse(JSON.stringify(groupForm))
this.$refs.groupForm.clearValidate()
this.msgSuccess('操作成功')
this.getCodeCategoryListFn()
})
.then(() => {
let data={
groupId:id,
newGroupId:that.newGroupId
}
console.log('updateSurveyGroup')
removeCodeCategory(id).then((res) => {
this.msgSuccess('操作成功')
that.getCodeCategoryListFn()
})
// updateSurveyGroup(that.$qs.stringify(data)).then((res) => {
// })
}
})
},
onGroupCommand(e, group) {
if (group.id === '1') {
this.msgInfo('默认分组不可操作!')
return
}
if (e == 'edit') {
this.editGroup(group)
} else if (e == 'remove') {
this.removeGroup(group.id)
}
},
editGroup(group) {
this.groupForm = JSON.parse(JSON.stringify(group))
this.groupVisible = true
},
removeGroup(id) {
let that = this
this.$confirm('是否确认删除当前分组,删除后所有表单将设置为默认分组,该操作不可撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
let data = {
groupId: id,
newGroupId: that.newGroupId,
}
console.log('updateSurveyGroup')
removeCodeCategory(id).then((res) => {
this.msgSuccess('操作成功')
that.getCodeCategoryListFn()
})
.catch(() => {})
},
// updateSurveyGroup(that.$qs.stringify(data)).then((res) => {
// })
})
.catch(() => {})
},
}
},
}
</script>
<style lang="scss" scoped>
.bottom {
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
.my-divider {
display: block;
height: 1px;
width: 100%;
background-color: #dcdfe6;
}
.hover-item {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3c88f0;
padding: 6px 15px;
cursor: pointer;
&:hover {
background-color: #f5f8fe;
}
}
.left {
border-right: 1px solid #f1f1f1;
.title {
color: #3c88f0;
display: flex;
justify-content: space-between;
align-items: center;
}
// padding-right: 20px;
.my-divider {
display: block;
height: 1px;
width: 100%;
background-color: #dcdfe6;
}
.title-name {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
display: flex;
align-items: center;
}
.hover-item {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3c88f0;
padding: 6px 15px;
cursor: pointer;
.title-btn {
cursor: pointer;
display: flex;
align-items: center;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3c88f0;
&:hover {
background-color: #f5f8fe;
&:hover {
opacity: 0.8;
}
}
}
.left {
border-right: 1px solid #f1f1f1;
.item-list {
max-height: 800px;
padding-top: 15px;
display: flex;
flex-direction: column;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
.title {
color: #3c88f0;
.item {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
// padding-right: 20px;
.title-name {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
display: flex;
align-items: center;
font-size: 12px;
color: #333333;
height: 40px;
line-height: 40px;
width: 100%;
padding-left: 20px;
.name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.title-btn {
cursor: pointer;
display: flex;
align-items: center;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3c88f0;
&:hover {
opacity: 0.8;
.dropdown {
// display: none;
.dot {
cursor: pointer;
width: 14px;
height: 14px;
line-height: 14px;
font-size: 14px;
font-family: JMT-Font, JMT;
font-weight: normal;
color: #3c88f0;
margin-right: 20px;
margin-left: 5px;
}
}
}
.item-list {
max-height: 800px;
padding-top: 15px;
display: flex;
flex-direction: column;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
.item {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: #333333;
height: 40px;
line-height: 40px;
width: 100%;
padding-left: 20px;
.name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
&:hover {
color: #3c88f0;
background: #f5f8fe;
opacity: 0.8;
.dropdown {
// display: none;
.dot {
cursor: pointer;
width: 14px;
height: 14px;
line-height: 14px;
font-size: 14px;
font-family: JMT-Font, JMT;
font-weight: normal;
color: #3c88f0;
margin-right: 20px;
margin-left: 5px;
}
}
&:hover {
color: #3c88f0;
background: #f5f8fe;
opacity: 0.8;
.dropdown {
// display: block;
}
// display: block;
}
}
}
.active {
// border-left: 2px solid #3c88f0;
color: #3c88f0;
background: #f5f8fe;
}
.active {
// border-left: 2px solid #3c88f0;
color: #3c88f0;
background: #f5f8fe;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!