feat:修改http数据集动态参数

main
liu.shiyi 2 years ago
parent e6dcb8f3dc
commit 17e076a9db

@ -441,7 +441,7 @@
<el-button <el-button
type="text" type="text"
style="float: right;border: none;margin-top: -4px;" style="float: right;border: none;margin-top: -4px;"
@click="$refs.paramsSettingDialog.open()" @click="openParamsSetDialog(false)"
> >
配置 配置
</el-button> </el-button>
@ -451,7 +451,7 @@
v-for="param in dataForm.config.paramsList" v-for="param in dataForm.config.paramsList"
:key="param.name" :key="param.name"
class="field-item" class="field-item"
@click="$refs.paramsSettingDialog.open()" @click="openParamsSetDialog(false)"
> >
<span>{{ param.name }}</span>&nbsp;<span <span>{{ param.name }}</span>&nbsp;<span
v-show="param.remark" v-show="param.remark"
@ -463,7 +463,7 @@
class="edit_field" class="edit_field"
type="text" type="text"
style="float: right;border: none;margin-top: 2px;" style="float: right;border: none;margin-top: 2px;"
@click="$refs.paramsSettingDialog.open()" @click="openParamsSetDialog(false)"
> >
配置 配置
</el-button> </el-button>
@ -620,10 +620,11 @@
<ParamsSettingDialog <ParamsSettingDialog
ref="paramsSettingDialog" ref="paramsSettingDialog"
:params-list="dataForm.config.paramsList" :params-list="dataForm.config.paramsList"
:newParamsList="newParamsList" :new-params-list="newParamsList"
@saveParams="saveParams" @saveParams="saveParams"
@saveNewParams="saveNewParams" @saveNewParams="saveNewParams"
@getData="getData" @getData="getData"
@getPramsList="getPramsList"
/> />
<OutputFieldDialog <OutputFieldDialog
ref="outputFieldDialog" ref="outputFieldDialog"
@ -908,7 +909,6 @@ export default {
this.dataForm.config.params.splice(index, 1) this.dataForm.config.params.splice(index, 1)
}, },
saveParams (val) { saveParams (val) {
debugger
this.dataForm.config.paramsList = val this.dataForm.config.paramsList = val
}, },
saveNewParams (val) { saveNewParams (val) {
@ -975,6 +975,14 @@ export default {
}) })
this.fieldDesc = fieldDesc this.fieldDesc = fieldDesc
}, },
//
async openParamsSetDialog (isUpdate) {
this.getPramsList()
const oldList = _.cloneDeep(this.dataForm.config.paramsList)
this.newParamsList = this.compareParamsList(this.newParamsList, oldList)
await this.$nextTick()
this.$refs.paramsSettingDialog.open(isUpdate)
},
// //
getPramsList () { getPramsList () {
const paramNames1 = this.getValName(this.dataForm.config.url) const paramNames1 = this.getValName(this.dataForm.config.url)
@ -994,13 +1002,40 @@ export default {
type: 'String', type: 'String',
value: '', value: '',
status: 1, status: 1,
require: 1, require: 0,
remark: '' remark: ''
}) })
} }
}) })
this.dataForm.config.paramsList = _.cloneDeep(params) this.dataForm.config.paramsList = _.cloneDeep(params)
}, },
//
compareParamsList (newList, oldList) {
//
const result = []
// A
for (const objA of oldList) {
let found = false // B
// B
for (const objB of newList) {
if (objA.name === objB.name) {
// ABfieldNameBA
objA.value = objB.value
result.push(objA)
found = true
break
}
}
// B
if (!found) {
result.push(objA)
}
}
return result
},
// ${} // ${}
getValName (str) { getValName (str) {
// //
@ -1015,12 +1050,13 @@ export default {
}, },
// //
scriptExecute (isInit = false) { scriptExecute (isInit = false) {
this.getPramsList() // this.getPramsList()
// this.newParamsList = this.compareParamsList(this.newParamsList, this.dataForm.config.paramsList)
// //
// const flag = this.dataForm.config.paramsList.some(item => !item.value) // const flag = this.dataForm.config.paramsList.some(item => !item.value)
// //
if (this.dataForm.config.paramsList && this.dataForm.config.paramsList.length && !isInit) { if (this.dataForm.config.paramsList && this.dataForm.config.paramsList.length && !isInit) {
this.$refs.paramsSettingDialog.open(true) this.openParamsSetDialog(true)
} else { } else {
this.getData() this.getData()
} }
@ -1098,6 +1134,7 @@ export default {
} }
return result return result
}, },
// //
clearType () { clearType () {
this.typeName = '' this.typeName = ''

@ -29,6 +29,7 @@
class="bs-el-input" class="bs-el-input"
placeholder="请输入名称" placeholder="请输入名称"
clearable clearable
readonly
@change="checkParamsName(scope.row)" @change="checkParamsName(scope.row)"
/> />
</template> </template>
@ -64,7 +65,10 @@
filterable filterable
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-radio-group v-model="scope.row.require"> <el-radio-group
v-model="scope.row.require"
:disabled="isUpdate"
>
<el-radio :label="1"> <el-radio :label="1">
</el-radio> </el-radio>
@ -108,6 +112,7 @@
class="bs-el-input" class="bs-el-input"
placeholder="请输入备注" placeholder="请输入备注"
rows="2" rows="2"
:readonly="isUpdate"
maxlength="200" maxlength="200"
/> />
</template> </template>
@ -184,8 +189,9 @@ export default {
}, },
methods: { methods: {
open (isUpdate = false) { open (isUpdate = false) {
this.$emit('getPramsList')
if (isUpdate) { if (isUpdate) {
this.params = cloneDeep(this.newParamsList) this.params = this.newParamsList
} else { } else {
this.params = cloneDeep(this.paramsList) this.params = cloneDeep(this.paramsList)
} }
@ -219,7 +225,6 @@ export default {
this.dialogVisible = false this.dialogVisible = false
} }
} }
} }
</script> </script>

Loading…
Cancel
Save