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

优化测试

parent e1d12149
...@@ -1093,7 +1093,18 @@ const hsInput = { ...@@ -1093,7 +1093,18 @@ const hsInput = {
placeholder: '', placeholder: '',
size: 'mini', size: 'mini',
clearable: true, 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 = { const hsInputNumber = {
......
...@@ -438,6 +438,8 @@ export default { ...@@ -438,6 +438,8 @@ export default {
.dyncUiItemChildBox { .dyncUiItemChildBox {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex;
align-items: center;
} }
.dyncUiItemChildBox >>> .el-date-editor--daterange.el-input, .dyncUiItemChildBox >>> .el-date-editor--daterange.el-input,
.el-date-editor--daterange.el-input__inner, .el-date-editor--daterange.el-input__inner,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
:src='innerValue' :src='innerValue'
:width="configData.width||150" :width="configData.width||150"
:height="configData.height||150" :height="configData.height||150"
alt="请上传图片" :onerror="errorImg01"
> >
<div class="icon_box"> <div class="icon_box">
<i <i
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
width="200" width="200"
height="200" height="200"
:src='dialogImgSrc' :src='dialogImgSrc'
alt="请上传图片" :onerror="errorImg01"
> >
<div class="file"> <div class="file">
选择图片 选择图片
...@@ -98,11 +98,13 @@ export default { ...@@ -98,11 +98,13 @@ export default {
}, },
data() { data() {
return { return {
errorImg01: 'this.src="' + require('./default.png') + '"',
upload_dialogVisible: false, upload_dialogVisible: false,
upload_src: '' upload_src: ''
} }
}, },
methods: { methods: {
closeImgDialog() { closeImgDialog() {
this.upload_src = '' this.upload_src = ''
}, },
......
...@@ -6,17 +6,26 @@ ...@@ -6,17 +6,26 @@
>{{configData.title}}</div> >{{configData.title}}</div>
<div class="inputCurr"> <div class="inputCurr">
<el-input <el-input
v-model="innerValue"
@keyup.native="btKeyUp" @keyup.native="btKeyUp"
:clearable='clearable' :clearable='configData.clearable'
:size='configData.size' :size='configData.size'
@clear='clear' @clear='clear'
@keyup.enter.native="submitInput" @keyup.enter.native="submitInput"
v-model="innerValue"
@input='inputFun' @input='inputFun'
@change='changeFun' @change='changeFun'
@blur="inputBlur" @blur="inputBlur"
:disabled="getDisabled" :disabled="getDisabled"
:placeholder="configData.placeholder" :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> ></el-input>
</div> </div>
</div> </div>
...@@ -27,7 +36,7 @@ export default { ...@@ -27,7 +36,7 @@ export default {
mixins: [commonMixins], mixins: [commonMixins],
name: 'input-component', name: 'input-component',
watch: { watch: {
formData: { formData44: {
handler: function(newVal, oldVal) { handler: function(newVal, oldVal) {
if (!this.isInputed) { if (!this.isInputed) {
const linkProps = this.configData.linkProps || [] const linkProps = this.configData.linkProps || []
...@@ -46,7 +55,7 @@ export default { ...@@ -46,7 +55,7 @@ export default {
}, },
computed: { computed: {
configData: function() { configData: function() {
return Object.assign(this.configData_, this.config || {}) return Object.assign(this.configDefaultData, this.config || {})
}, },
innerValue: { innerValue: {
set(value) { set(value) {
...@@ -64,7 +73,7 @@ export default { ...@@ -64,7 +73,7 @@ export default {
if (disabledLevel === 1) { if (disabledLevel === 1) {
// 以自己的的配置为优先级最高 // 以自己的的配置为优先级最高
if (type === 'function') { if (type === 'function') {
return disabled(this.formData) return !!disabled(this.formData)
} else { } else {
return disabled return disabled
} }
...@@ -79,47 +88,90 @@ export default { ...@@ -79,47 +88,90 @@ export default {
}, },
data() { data() {
return { return {
value_inner: '',
isInputed: false, isInputed: false,
clearable: true, configDefaultData: {
configData_: {
title: '', title: '',
placeholder: '', placeholder: '',
size: 'mini', size: 'mini',
clearable: true, clearable: true,
disabled: false, disabled: false,
innerValidateRegex: '',
validateRegex: '', 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: { methods: {
btKeyUp(e) {}, btKeyUp(e) {},
validateHandle(value) { validateHandle(value) {
const { validateRegex, validateAction } = this.configData debugger
if (typeof validate === 'function') { if (value === '') return ''
const v = validateAction(this.value, this.formData, this.prop, e) const { validateRegex, innerValidateRegex, validateAction } = this.configData
if (typeof validateAction === 'function') {
const v = validateAction(this.value, this.formData, this.prop)
return v return v
} else if (validateRegex) { } else if (validateRegex) {
const r = this.regExpFun(validateRegex, value) const r = this.regExpFun(validateRegex, value)
debugger
if (r) { if (r) {
return value return value
} else { } else {
return this.value return this.value
} }
} else if (innerValidateRegex) {
const targteReg = this.regExpInner[innerValidateRegex]
if (targteReg) {
const r = this.regExpFunInner(targteReg, value)
if (r) {
return value
} else {
return this.value
}
} else {
return value
}
} else { } else {
return value return value
} }
}, },
regExpFun(expression, 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) return regxp.test(value)
}, },
inputBlur() { inputBlur() {
this.isInputed = false this.isInputed = false
const { blur } = this.configData const { blur } = this.configData
if (blur) { if (blur) {
this.execAction(clear, this.value) this.execAction(blur, this.value)
} else { } else {
this.$emit('blur', this.value) this.$emit('blur', this.value)
} }
...@@ -159,14 +211,12 @@ export default { ...@@ -159,14 +211,12 @@ export default {
const { inputed } = this.configData const { inputed } = this.configData
if (inputed) { if (inputed) {
this.execAction(inputed, value) this.execAction(inputed, value)
} else {
this.$emit('input', value)
} }
}, },
submitInput(val) { submitInput(val) {
const { entered } = this.configData const { entered } = this.configData
this.execAction(entered, val, this.elInfo) 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 @@ ...@@ -57,7 +57,7 @@
</hs-table> </hs-table>
</div> </div>
<div class="rightLeftIcon"> <div class="rightLeftIcon">
<el-button-group> <el-button-group class="iconBoxCenter">
<el-button <el-button
@click="goLeftTable" @click="goLeftTable"
size='mini' size='mini'
...@@ -126,120 +126,6 @@ ...@@ -126,120 +126,6 @@
</div> </div>
</template> </template>
</hs-dialog> </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> <hsIframeDialog ref='appIframePageBoxA'></hsIframeDialog>
</div> </div>
</template> </template>
...@@ -777,4 +663,7 @@ export default { ...@@ -777,4 +663,7 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.iconBoxCenter{
width: 93px;
}
</style> </style>
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
@handlePageSize='handlePageSize' @handlePageSize='handlePageSize'
:row-height="rowHeight" :row-height="rowHeight"
:row-style='setRowStyle' :row-style='setRowStyle'
:cell-style="setCellStyle"
> >
<template v-for='(columnItem,index) in tableColumns'> <template v-for='(columnItem,index) in tableColumns'>
...@@ -185,6 +186,7 @@ ...@@ -185,6 +186,7 @@
@handlePageSize='handlePageSize' @handlePageSize='handlePageSize'
:row-height="rowHeight" :row-height="rowHeight"
:row-style='setRowStyle' :row-style='setRowStyle'
:cell-style="setCellStyle"
> >
<template v-for='(column,index) in tableColumns'> <template v-for='(column,index) in tableColumns'>
...@@ -384,7 +386,17 @@ export default { ...@@ -384,7 +386,17 @@ export default {
'$exportAllPageData' '$exportAllPageData'
], ],
dialogVisibleTbaleColums: false, dialogVisibleTbaleColums: false,
tableDataColums: [] tableDataColums: [],
subjoinStyle: {
hyperlink: {
'text-decoration': 'underline',
cursor: 'pointer'
},
asyncQueryDetail: {
'text-decoration': 'underline',
cursor: 'pointer'
}
}
} }
}, },
watch: { watch: {
...@@ -806,7 +818,7 @@ export default { ...@@ -806,7 +818,7 @@ export default {
// 利用mathjs 来计算精度问题 // 利用mathjs 来计算精度问题
// sumObj[key] = NP.plus(sumObj[key], Number(item[key])) // sumObj[key] = NP.plus(sumObj[key], Number(item[key]))
sumObj[key] = this.mathFormatAdd(sumObj[key], 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]) // sumObj[key] += Number(item[key])
} }
}) })
...@@ -1003,7 +1015,20 @@ export default { ...@@ -1003,7 +1015,20 @@ export default {
return 'el-icon-close' 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 { usable, bUsable, bDisabled, bill_status } = row
const valuelist = [false, 0, '0'] const valuelist = [false, 0, '0']
if ( if (
...@@ -1016,7 +1041,58 @@ export default { ...@@ -1016,7 +1041,58 @@ export default {
'text-decoration': 'line-through', 'text-decoration': 'line-through',
color: '#afafaf' 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