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

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

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

Loading…
Cancel
Save