Commit dce3a4d0 by 胡悦

修改新增场景

1 parent 028d7872
......@@ -215,7 +215,9 @@ export default {
{
label: '商城ID:',
prop: 'shopProductId',
type: 'input'
type: 'input',
maxlength: 15,
limit: true
},
{
label: '接入平台:',
......@@ -226,7 +228,9 @@ export default {
{
label: '平台产品ID:',
prop: 'platformProductId',
type: 'input'
type: 'input',
maxlength: 15,
limit: true
},
{
label: '配网方式:',
......
......@@ -344,12 +344,12 @@
</el-select>
</el-form-item>
<el-form-item
v-if="item.paramValue.lastList"
v-if="item.paramValue.orderType == 2"
class="inline"
:prop="'contentList.'+idx+'.paramValue.valueId'"
:rules="{
required: true, message: '该选项不能为空', trigger: 'change'
}"
required: true, message: '该选项不能为空', trigger: 'change'
}"
>
<el-select
v-model="item.paramValue.valueId"
......@@ -365,6 +365,16 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="item.paramValue.orderType == 1"
class="inline"
:prop="'contentList.'+idx+'.paramValue.value'"
:rules="{
required: true, message: '该选项不能为空', trigger: 'blur'
}"
>
<el-input v-model="item.paramValue.value"></el-input>
</el-form-item>
</template>
<i
v-show="idx != 0"
......@@ -446,7 +456,7 @@ export default {
data() {
return {
baseURL: this.$get_session_common_config().axios.baseURL,
active: 1,
active: 2,
// 场景基础信息
// basicForm: this.params.basicForm,
basicRules: {
......@@ -572,12 +582,12 @@ export default {
},
// 提交
handleSubmit() {
console.log(this.params.basicForm, this.params.conditionList, this.params.scenarioRuleForm.contentList)
console.log(this.params.basicForm, this.params.conditionList, this.params.contentList)
this.$refs.scenarioRuleForm.validate((valid) => {
if (valid) {
const basicForm = this.clearObject(this.params.basicForm, ['backPicUrl', 'iconUrl'])
const conditionList = this.params.conditionList.map(item => this.clearObject(item, ['list', 'noValue', 'key']))
const contentList = this.params.contentList.map(item => this.clearObject(item, ['list', 'lastList', 'key']))
const contentList = this.params.contentList.map(item => this.clearObject(item, ['list', 'lastList', 'key', 'orderType']))
const templateList = conditionList.concat(contentList)
const params = Object.assign(basicForm, this.params.scenarioRuleForm)
params.templateList = templateList
......@@ -689,18 +699,29 @@ export default {
const arr = this.deviceConditionList.find(item => item.id === e).conditionList
const value = this.params.conditionList[index].paramValue
value.list = arr
const valueArr = ['order', 'orderCondition', 'orderId', 'orderVal', 'value']
valueArr.forEach(item => {
if (value[item]) value[item] = ''
})
if (value.id) this.$set(value, 'id', null)
if (value.noValue) value.noValue = false
if (value.order) value.order = ''
if (value.value) value.value = ''
if (value.orderVal) value.orderVal = ''
// if (value.order) value.order = ''
// if (value.value) value.value = ''
// if (value.orderVal) value.orderVal = ''
} else {
const arr = this.deviceContentList.find(item => item.id === e).contentList
const value = this.params.contentList[index].paramValue
value.list = arr
if (value.order) value.order = ''
if (value.valType) value.valType = ''
if (value.orderVal) value.orderVal = ''
const valueArr = ['order', 'valType', 'orderId', 'valueId', 'orderVal', 'value']
valueArr.forEach(item => {
if (value[item]) value[item] = ''
})
// if (value.order) value.order = ''
// if (value.valType) value.valType = ''
// if (value.orderVal) value.orderVal = ''
// if (value.valueId) value.valueId = ''
// if (value.orderType) value.orderType = ''
// if (value.value) value.value = ''
}
},
// 设备状态三个下拉框
......@@ -716,12 +737,15 @@ export default {
} else {
const obj = this.params.contentList[index].paramValue.list.find(item => item.id === e)
const paramValue = this.params.contentList[index].paramValue
paramValue.valType = obj.orderType
paramValue.valType = obj.orderValueType
paramValue.orderType = obj.orderType
const id = obj.id
getOrderValue({ orderId: id }).then(res => {
const val = res.length === 0 ? null : res
this.$set(paramValue, 'lastList', val)
})
if (obj.orderType == 2) {
getOrderValue({ orderId: id }).then(res => {
const val = res.length === 0 ? null : res
this.$set(paramValue, 'lastList', val)
})
}
}
},
lastChange(e, index) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!