Commit dce3a4d0 by 胡悦

修改新增场景

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