Commit 1c61de3e authored by 何虹's avatar 何虹 💬

优化测试

parent e1d12149
......@@ -1093,7 +1093,18 @@ const hsInput = {
placeholder: '',
size: 'mini',
clearable: true,
disabled: false
disabled: false,
innerValidateRegex: '',
validateRegex: '',
validateAction: '',
maxlength: 100000,
minlength: 0,
type: 'text',
'show-word-limit': false,
'show-password': false,
rows: 2,
autosize: false,
readonly: false
}
}
const hsInputNumber = {
......
......@@ -438,6 +438,8 @@ export default {
.dyncUiItemChildBox {
width: 100%;
height: 100%;
display: flex;
align-items: center;
}
.dyncUiItemChildBox >>> .el-date-editor--daterange.el-input,
.el-date-editor--daterange.el-input__inner,
......
......@@ -5,7 +5,7 @@
:src='innerValue'
:width="configData.width||150"
:height="configData.height||150"
alt="请上传图片"
:onerror="errorImg01"
>
<div class="icon_box">
<i
......@@ -32,7 +32,7 @@
width="200"
height="200"
:src='dialogImgSrc'
alt="请上传图片"
:onerror="errorImg01"
>
<div class="file">
选择图片
......@@ -98,11 +98,13 @@ export default {
},
data() {
return {
errorImg01: 'this.src="' + require('./default.png') + '"',
upload_dialogVisible: false,
upload_src: ''
}
},
methods: {
closeImgDialog() {
this.upload_src = ''
},
......
......@@ -6,17 +6,26 @@
>{{configData.title}}</div>
<div class="inputCurr">
<el-input
v-model="innerValue"
@keyup.native="btKeyUp"
:clearable='clearable'
:clearable='configData.clearable'
:size='configData.size'
@clear='clear'
@keyup.enter.native="submitInput"
v-model="innerValue"
@input='inputFun'
@change='changeFun'
@blur="inputBlur"
:disabled="getDisabled"
:placeholder="configData.placeholder"
:maxlength='configData.maxlength'
:minlength='configData.minlength'
:type='configData.type'
:show-word-limit='configData["show-word-limit"]'
:show-password='configData["show-password"]'
:rows='configData.rows'
:autosize='configData.autosize'
:readonly='configData.readonly'
></el-input>
</div>
</div>
......@@ -27,7 +36,7 @@ export default {
mixins: [commonMixins],
name: 'input-component',
watch: {
formData: {
formData44: {
handler: function(newVal, oldVal) {
if (!this.isInputed) {
const linkProps = this.configData.linkProps || []
......@@ -46,7 +55,7 @@ export default {
},
computed: {
configData: function() {
return Object.assign(this.configData_, this.config || {})
return Object.assign(this.configDefaultData, this.config || {})
},
innerValue: {
set(value) {
......@@ -64,7 +73,7 @@ export default {
if (disabledLevel === 1) {
// 以自己的的配置为优先级最高
if (type === 'function') {
return disabled(this.formData)
return !!disabled(this.formData)
} else {
return disabled
}
......@@ -79,29 +88,64 @@ export default {
},
data() {
return {
value_inner: '',
isInputed: false,
clearable: true,
configData_: {
configDefaultData: {
title: '',
placeholder: '',
size: 'mini',
clearable: true,
disabled: false,
innerValidateRegex: '',
validateRegex: '',
validateAction: ''
validateAction: '',
maxlength: 100000,
minlength: 0,
type: 'text',
'show-word-limit': false,
'show-password': false,
rows: 2,
autosize: false,
readonly: false
},
regExpInner: {
number: '\\d',
chinese: '\\u4e00-\\u9fa5',
alphabet: 'a-zA-Z',
lowercase: 'a-z',
uppercase: 'A-Z',
'n-c': '\\d\\u4e00-\\u9fa5',
'n-a': '\\da-zA-Z',
'n-l': '\\da-z',
'n-u': '\\dA-Z',
'c-a': '\\u4e00-\\u9fa5a-zA-Z',
'c-l': '\\u4e00-\\u9fa5a-z',
'c-u': '\\u4e00-\\u9fa5A-Z'
}
}
},
methods: {
btKeyUp(e) {},
validateHandle(value) {
const { validateRegex, validateAction } = this.configData
if (typeof validate === 'function') {
const v = validateAction(this.value, this.formData, this.prop, e)
debugger
if (value === '') return ''
const { validateRegex, innerValidateRegex, validateAction } = this.configData
if (typeof validateAction === 'function') {
const v = validateAction(this.value, this.formData, this.prop)
return v
} else if (validateRegex) {
const r = this.regExpFun(validateRegex, value)
debugger
if (r) {
return value
} else {
return this.value
}
} else if (innerValidateRegex) {
const targteReg = this.regExpInner[innerValidateRegex]
if (targteReg) {
const r = this.regExpFunInner(targteReg, value)
if (r) {
return value
} else {
......@@ -110,16 +154,24 @@ export default {
} else {
return value
}
} else {
return value
}
},
regExpFun(expression, value) {
const regxp = new RegExp('^' + expression + '$', 'gi')
const regxp = new RegExp('^[' + expression + ']+$', 'gi')
return regxp.test(value)
},
regExpFunInner(expression, value) {
const regxp = new RegExp('^[' + expression + ']+$', 'g')
return regxp.test(value)
},
inputBlur() {
this.isInputed = false
const { blur } = this.configData
if (blur) {
this.execAction(clear, this.value)
this.execAction(blur, this.value)
} else {
this.$emit('blur', this.value)
}
......@@ -159,14 +211,12 @@ export default {
const { inputed } = this.configData
if (inputed) {
this.execAction(inputed, value)
} else {
this.$emit('input', value)
}
},
submitInput(val) {
const { entered } = this.configData
this.execAction(entered, val, this.elInfo)
this.$emit('enterInput', this.value_inner, this.elInfo)
this.$emit('enterInput', this.innerValue, this.elInfo)
}
}
}
......
......@@ -57,7 +57,7 @@
</hs-table>
</div>
<div class="rightLeftIcon">
<el-button-group>
<el-button-group class="iconBoxCenter">
<el-button
@click="goLeftTable"
size='mini'
......@@ -126,120 +126,6 @@
</div>
</template>
</hs-dialog>
<el-dialog
v-if="false"
@open='openDialog'
top='10px'
:close-on-click-modal='false'
:before-close='beforeClose'
:append-to-body='true'
center
title="查询"
:visible.sync="dialogTableVisible"
:width="dialogWidth"
>
<div class="contentBox">
<div
class="leftBox"
:style="{'width':tableWithLeft}"
>
<el-divider content-position="left">所有项</el-divider>
<hs-dync-form
height='55px'
@searchSubmit='queryLeft'
type='queryArea'
:formParms='searchFormLeft'
:elInfo='hsDyncFormElLeft'
:config='hsDyncFormConfigLeft'
v-bind="$attrs"
v-on="$listeners"
>
</hs-dync-form>
<hs-table
:width='tableWithLeft'
:height="tableHeightLeft"
:config='leftHsTableConfig'
:data='leftTabeData'
:paging='pagingLeft'
:elInfo='hsTableElLeft'
@paginationFun="paginationFunLeft"
v-bind="$attrs"
v-on="$listeners"
>
</hs-table>
</div>
<div class="rightLeftIcon">
<el-button-group>
<el-button
@click="goLeftTable"
size='mini'
type="primary"
icon="el-icon-arrow-left"
></el-button>
<el-button
@click="goRightTable"
size='mini'
type="primary"
><i class="el-icon-arrow-right el-icon--right"></i></el-button>
</el-button-group>
</div>
<div
class="rightBox"
:style="{'width':tableWithRight}"
>
<el-divider content-position="left">已选区</el-divider>
<hs-dync-form
height='55px'
@searchSubmit='queryRight'
type='queryArea'
:formParms='searchFormRight'
:elInfo='hsDyncFormElRight'
:config='hsDyncFormConfigRight'
v-bind="$attrs"
v-on="$listeners"
>
</hs-dync-form>
<hs-table
:width='tableWithRight'
:height="tableHeightRight"
:paging='pagingRight'
:data='rightTabeData'
:config='rightHsTableConfig'
:elInfo='hsTableElRight'
@paginationFun="paginationFunRight"
v-bind="$attrs"
v-on="$listeners"
>
</hs-table>
</div>
</div>
<div
slot="footer"
class="dialog-footer"
v-if='!getDisabled'
>
<div class="cacelSubmit">
<el-button
size='mini'
@click="beforeClose"
>取 消</el-button>
<el-button
size='mini'
type="primary"
@click="submit"
>确 定</el-button>
<el-button
size='mini'
icon='el-icon-position'
type="primary"
@click="showAddPage"
>新增</el-button>
</div>
</div>
</el-dialog>
<hsIframeDialog ref='appIframePageBoxA'></hsIframeDialog>
</div>
</template>
......@@ -777,4 +663,7 @@ export default {
display: flex;
justify-content: center;
}
.iconBoxCenter{
width: 93px;
}
</style>
......@@ -47,6 +47,7 @@
@handlePageSize='handlePageSize'
:row-height="rowHeight"
:row-style='setRowStyle'
:cell-style="setCellStyle"
>
<template v-for='(columnItem,index) in tableColumns'>
......@@ -185,6 +186,7 @@
@handlePageSize='handlePageSize'
:row-height="rowHeight"
:row-style='setRowStyle'
:cell-style="setCellStyle"
>
<template v-for='(column,index) in tableColumns'>
......@@ -384,7 +386,17 @@ export default {
'$exportAllPageData'
],
dialogVisibleTbaleColums: false,
tableDataColums: []
tableDataColums: [],
subjoinStyle: {
hyperlink: {
'text-decoration': 'underline',
cursor: 'pointer'
},
asyncQueryDetail: {
'text-decoration': 'underline',
cursor: 'pointer'
}
}
}
},
watch: {
......@@ -806,7 +818,7 @@ export default {
// 利用mathjs 来计算精度问题
// sumObj[key] = NP.plus(sumObj[key], Number(item[key]))
sumObj[key] = this.mathFormatAdd(sumObj[key], item[key])
//math.add(sumObj[key], Number(item[key]))
// math.add(sumObj[key], Number(item[key]))
// sumObj[key] += Number(item[key])
}
})
......@@ -1003,7 +1015,20 @@ export default {
return 'el-icon-close'
}
},
setRowStyle({ row }) {
setRowStyle(rowData) {
const { rowStyle } = this.tableConfig
const { row } = rowData
const data_style = this.getRowStatusStyle(row) // 数据样式根据状态来设置
const _styleRowSetting_ = this.dealStyleConfig(row['_styleRowSetting_']) // row._styleRowSetting_ || {} // 每一行的样式
const styleObj = Object.assign(
{},
rowStyle || {}, // 配置中的行样式
data_style, // 数据中的根据状态行样式
_styleRowSetting_ // 每一行数据返回单独的样式
)
return styleObj
},
getRowStatusStyle(row) {
const { usable, bUsable, bDisabled, bill_status } = row
const valuelist = [false, 0, '0']
if (
......@@ -1016,7 +1041,58 @@ export default {
'text-decoration': 'line-through',
color: '#afafaf'
}
} else {
return {}
}
},
dealStyleConfig(dataStyle) {
if (dataStyle) {
return typeof dataStyle === 'string' ? JSON.parse(dataStyle) : dataStyle
} else {
return {}
}
},
setCellStyle(cellData) {
const { column, row } = cellData
const { property } = column // 对应的列名
if (!property) return
// 后端返回的样式
const _styleCellSetting_ = this.dealStyleConfig(row['_styleCellSetting_']) // 对应这一行单元格样式
const _styleCellSetting_property = this.dealStyleConfig(
row['_styleCellSetting_' + property]
) // 对应这一行property 字段的样式
// 前端config中设置的样式
const { cellStyle, columnStyle } = this.tableConfig
const { commonStyle, data } = columnStyle || {}
const configColumnStyle = {}
if (commonStyle) {
Object.assign(configColumnStyle, commonStyle)
}
if (data && Array.isArray(data)) {
const targetProperty = data.find(item => item.property === property)
if (targetProperty) {
Object.assign(configColumnStyle, targetProperty.style || {})
}
}
// 附加样式 如超链接 配置中columnsConfig
const otherStyle = this.tableColumns.find(item => item.prop === property)
let columnsConfig_otherStyle = {}
if (
otherStyle &&
(otherStyle.type === 'hyperlink' ||
otherStyle.type === 'asyncQueryDetail')
) {
columnsConfig_otherStyle = this.subjoinStyle[otherStyle.type] || {}
}
const cellStyleObj = Object.assign(
{},
columnsConfig_otherStyle,
cellStyle || {}, // 配置中每个单元格样式
configColumnStyle, // 配置中列样式
_styleCellSetting_, // 数据中每一行对应的单元格样式
_styleCellSetting_property// 数据中每一行对应字段的单元格样式
)
return cellStyleObj
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment