Commit 5c157359 by 李伟康

11月底需求

1 parent bbc7f38a
...@@ -217,6 +217,15 @@ const transformData = (data, childrenDepth) => { ...@@ -217,6 +217,15 @@ const transformData = (data, childrenDepth) => {
}) })
return result 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,
...@@ -231,5 +240,6 @@ export { ...@@ -231,5 +240,6 @@ export {
exportFn, exportFn,
getExplorer, getExplorer,
activityStatusList, activityStatusList,
transformData transformData,
checkSpace
} }
\ No newline at end of file \ No newline at end of file
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import * as XLSX from 'xlsx' import * as XLSX from 'xlsx'
import { transformData } from '@/common/constant' import { transformData, checkSpace } from '@/common/constant'
const inputKeyObject = { const inputKeyObject = {
1: 'radioValue', 1: 'radioValue',
2: 'checkboxValue', 2: 'checkboxValue',
...@@ -250,13 +250,17 @@ export default { ...@@ -250,13 +250,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'
}] }]
...@@ -375,7 +379,7 @@ export default { ...@@ -375,7 +379,7 @@ 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')
......
...@@ -173,6 +173,8 @@ ...@@ -173,6 +173,8 @@
<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, const marginBottom = 16,
delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
translateY = (val, size) => `translateY(${val}px) ` translateY = (val, size) => `translateY(${val}px) `
...@@ -195,8 +197,8 @@ export default { ...@@ -195,8 +197,8 @@ 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' }],
}, },
editQuestionsObj: { editQuestionsObj: {
...@@ -376,7 +378,7 @@ export default { ...@@ -376,7 +378,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
.w432{ .w432 {
width: 432px; width: 432px;
} }
/deep/.el-scrollbar__wrap { /deep/.el-scrollbar__wrap {
...@@ -417,11 +419,12 @@ export default { ...@@ -417,11 +419,12 @@ export default {
word-break: break-all; word-break: break-all;
white-space: break-spaces; white-space: break-spaces;
} }
.label-center{ .label-center {
align-items: center; align-items: center;
} }
.el-radio,.el-checkbox{ .el-radio,
.el-checkbox {
word-break: break-all; word-break: break-all;
white-space: break-spaces; white-space: break-spaces;
display: inline-flex; display: inline-flex;
......
...@@ -110,11 +110,11 @@ ...@@ -110,11 +110,11 @@
ref="copyFormRef" ref="copyFormRef"
inline inline
:model="copyParmas"> :model="copyParmas">
<el-form-item label="问卷名称" prop="name" :rules="[{required: true, message: '请输入问卷名称' }]"> <el-form-item label="问卷名称" prop="name" :rules="rules">
<el-input <el-input
placeholder="请输入" placeholder="请输入"
size="small" size="small"
v-model="copyParmas.name" v-model.trim="copyParmas.name"
maxlength="50" maxlength="50"
> >
</el-input> </el-input>
...@@ -316,6 +316,7 @@ export default { ...@@ -316,6 +316,7 @@ export default {
show: false, show: false,
name: '' name: ''
}, },
rules:[{required: true, message: '请输入问卷名称' }]
} }
}, },
mounted () { mounted () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!