Commit 8ca80d42 by 温丽香

base64校验

1 parent a5163c49
Pipeline #3534 passed
in 1 minute 0 seconds
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
//- body //- body
.confirm-body(slot="body") .confirm-body(slot="body")
//- span.dialog-icon.iconfont(:class="[mode, iconClass]") //- span.dialog-icon.iconfont(:class="[mode, iconClass]")
.title //- .title
span.dialog-icon.iconfont(:class="[mode, iconClass]") span.dialog-icon.iconfont(:class="[mode, iconClass]")
span.text {{ title }} span.text {{ title }}
p.caption(v-if="message") p.caption(v-if="message")
//- 支持html格式 //- 支持html格式
span(v-html="message") {{ message }} i.el-icon-warning(style="color: #F6AD3D;font-size: 22px;margin-right: 10px;float:left")
span(v-html="message" style="height: 22px;line-height: 22px") {{ message }}
.options(v-if="options && options.length") .options(v-if="options && options.length")
.option(v-for="option in options") .option(v-for="option in options")
...@@ -170,7 +171,7 @@ export default { ...@@ -170,7 +171,7 @@ export default {
.caption .caption
color: #4C4C4C color: #4C4C4C
font-size: 14px font-size: 14px
margin-top: 20px // margin-top: 20px
color: $--color-text-regular color: $--color-text-regular
.options .options
margin-top: 15px margin-top: 15px
......
...@@ -39,11 +39,11 @@ ...@@ -39,11 +39,11 @@
<span style="margin-left: 12px">{{scope.row.field}}</span> <span style="margin-left: 12px">{{scope.row.field}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="(column, index) in tableData[0].columns" :key="index" :label="`列${index + 1}`" :width="index + 1 === columnIndex ? '220px' : ''"> <el-table-column v-for="(column, index) in tableData[0].columns" :key="index" :label="`列${index + 1}`" :min-width="index + 1 === columnIndex ? '220px' : ''">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <div class="column-box"> --> <!-- <div class="column-box"> -->
<div style="display: flex"> <div style="display: flex">
<pack-select v-model="scope.row.columns[index].type" @blur="handleBlur" placeholder="请选择" class="none-display" style="margin-right: 10px"> <pack-select v-model="scope.row.columns[index].type" @blur="handleBlur" @change="value => handleTypeChange(value, scope.row.columns[index])" placeholder="请选择" class="none-display" style="margin-right: 10px">
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
:key="item.value" :key="item.value"
...@@ -51,7 +51,10 @@ ...@@ -51,7 +51,10 @@
:value="item.value"> :value="item.value">
</el-option> </el-option>
</pack-select> </pack-select>
<input type="text" v-model="scope.row.columns[index].value" @blur="handleBlur" placeholder="请输入" class="cell-value"> <input type="text" v-model="scope.row.columns[index].value" @blur="handleBlur" placeholder="请输入" class="cell-value"
:style="{border: scope.row.columns[index].type === 'base64' && !base64Pattern.test(scope.row.columns[index].value) ? '1px solid #F56C6C' : 'none'}"
@input="event => checkBase64(event.target, scope.row.columns[index])"
@focus="event => handleFocus(event.target, scope.row.columns[index])">
<!-- <el-select v-model="scope.row.columns[index].type" placeholder="请选择"> <!-- <el-select v-model="scope.row.columns[index].type" placeholder="请选择">
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
...@@ -108,50 +111,52 @@ export default { ...@@ -108,50 +111,52 @@ export default {
tableData: [{ tableData: [{
field: '1', field: '1',
columns: [ columns: [
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' } { type: 'base64', value: '1222' }
] ]
}, { }, {
field: '2', field: '2',
columns: [ columns: [
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' } { type: 'base64', value: '1222' }
] ]
}, { }, {
field: '3', field: '3',
columns: [ columns: [
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '122' } { type: 'base64', value: '1222' }
] ]
}, { }, {
field: '4', field: '4',
columns: [ columns: [
{ type: 'base64', value: '上海市普陀上海市普陀' },
{ type: 'string', value: '上海市普陀上海市普陀' }, { type: 'string', value: '上海市普陀上海市普陀' },
{ type: 'base64', value: '122' }, { type: 'string', value: '上海市普陀上海市普陀' },
{ type: 'base64', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'base64', value: '1222' },
{ type: 'string', value: '122' }, { type: 'string', value: '1222' },
{ type: 'base64', value: '上海市普陀上海市普陀' } { type: 'string', value: '1222' },
{ type: 'string', value: '上海市普陀上海市普陀' }
] ]
}], }],
total: 34, total: 34,
agoCell: null, agoCell: null,
currentInput: null,
base64Pattern: /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/,
flexHeight: 0, flexHeight: 0,
columnIndex: 0 columnIndex: 0
} }
...@@ -168,7 +173,26 @@ export default { ...@@ -168,7 +173,26 @@ export default {
} }
}, },
methods: { methods: {
handleTypeChange(value, param) {
this.checkBase64(this.currentInput, param)
},
handleFocus(target, param) {
this.currentInput = target
this.checkBase64(this.currentInput, param)
},
checkBase64(target, param) {
if (param.type === 'string') {
target.style.border = 'none'
return
}
if (!this.base64Pattern.test(param.value)) {
target.style.border = '1px solid #F56C6C'
} else {
target.style.border = 'none'
}
},
cancel() { cancel() {
// this.getData() 取消后所有修改都撤销
this.clearCell(this.agoCell) this.clearCell(this.agoCell)
this.setCurrent() this.setCurrent()
}, },
......
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
{ {
label: '操作', label: '操作',
type: 'slot', type: 'slot',
width: '150px', width: '200px',
slotName: 'operate' slotName: 'operate'
}, },
], ],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!