fix: 自助数据集添加参数的时候,参数值添加非空校验,根据前面的是否必填判断

main
wu.jian2 1 year ago
parent 1b3573ffa7
commit ec041a76b5

@ -192,7 +192,7 @@
<LabelSelect
:dataset-id="datasetId"
:id-list="dataForm.labelIds"
@commit="(ids) =>{dataForm.labelIds = ids}"
@commit="(ids) => { dataForm.labelIds = ids }"
/>
</el-form-item>
</el-col>
@ -708,20 +708,32 @@
align="center"
>
<template slot-scope="scope">
<el-date-picker
v-if="scope.row.type === 'Date'"
v-model="scope.row.value"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
<el-input
v-else
v-model="scope.row.value"
class="bs-el-input"
clearable
placeholder="请输入值"
/>
<el-form
ref="form"
:model="scope.row"
>
<el-form-item
:show-message="scope.row.require === 1"
class="form-item-value"
prop="value"
:rules="getRules(scope.row)"
>
<el-date-picker
v-if="scope.row.type === 'Date'"
v-model="scope.row.value"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
<el-input
v-else
v-model="scope.row.value"
class="bs-el-input"
clearable
placeholder="请输入值"
/>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column
@ -775,11 +787,15 @@
<el-button
class="bs-el-button-default"
@click="cancelParam"
>取消</el-button>
>
取消
</el-button>
<el-button
type="primary"
@click="setParam"
>确定</el-button>
>
确定
</el-button>
</span>
</el-dialog>
</el-scrollbar>
@ -963,6 +979,13 @@ export default {
this.datasetTest(false)
})
},
getRules (row) {
return [{
required: row.require === 1,
message: '参数值不能为空',
trigger: ['blur', 'change']
}]
},
/**
* 获取数据源列表
*/
@ -1014,6 +1037,13 @@ export default {
* 保存参数设置
*/
setParam () {
for (let i = 0; i < this.paramsListCopy.length; i++) {
const row = this.paramsListCopy[i]
if (row.require === 1 && (row.value === '' || row.value === null)) {
this.$message.error(`${i + 1}行参数值不能为空`)
return
}
}
this.dataForm.paramsList = cloneDeep(this.paramsListCopy)
if (this.isTest) {
this.datasetTest()
@ -1419,16 +1449,29 @@ export default {
.bs-pagination {
padding: 16px !important;
position: unset !important;
::v-deep .el-input__inner {
width: 110px !important;
border: none;
background: var(--bs-el-background-1);
}
}
.bs-el-select{
.bs-el-select {
width: 100% !important;
}
::v-deep .el-input__inner{
::v-deep .el-input__inner {
width: 100% !important;
}
::v-deep .el-table__row{
height: 58px;
.cell{
width: 100%;
margin: 0 auto;
position: absolute;
top:8px;
}
}
</style>

Loading…
Cancel
Save