Commit 0b15835e by 胡悦

修复bug

1 parent dce3a4d0
......@@ -14,7 +14,10 @@
@change="uploadImg($event)"
/>
</el-button>
<ul>
<ul
:style="{'height': `${$client_height() - 50}px`}"
style="overflow-y: auto;"
>
<li
v-for="item in iconList"
:key="item.id"
......@@ -37,10 +40,6 @@
@change="update($event, item)"
/>
</el-button>
<!-- <el-button
type="text"
@click="update(item)"
>更新</el-button> -->
</li>
</ul>
......
......@@ -246,11 +246,6 @@ export default {
}
},
created() {
getTypeList({}).then(res => {
for (let i = this.productFormList.length; i > 0; i--) {
if (this.productFormList[i] && this.productFormList[i].prop === 'typeId') return (this.productFormList[i].options = res.list)
}
})
getDict({ dictType: 'access_platform' }).then(res => {
this.platformList = res
for (let i = this.productFormList.length; i > 0; i--) {
......@@ -267,7 +262,16 @@ export default {
methods: {
switchDialog() {
this.visible = !this.visible
if (!this.visible) this.$refs.productRuleForm.resetFields()
if (this.visible) {
getTypeList({}).then(res => {
for (let i = this.productFormList.length; i > 0; i--) {
if (this.productFormList[i] && this.productFormList[i].prop === 'typeId') return (this.productFormList[i].options = res.list)
}
})
} else {
this.productRuleForm = {}
this.$refs.productRuleForm.resetFields()
}
},
handleSubmit() {
console.log(this.productRuleForm)
......
......@@ -156,7 +156,9 @@ export default {
methods: {
switchDialog() {
this.visible = !this.visible
if (!this.visible) this.$refs.ruleForm.resetFields()
if (!this.visible) {
this.$refs.ruleForm.resetFields()
}
},
handleSubmit() {
this.$refs.ruleForm.validate((valid) => {
......@@ -168,7 +170,7 @@ export default {
type: 'success',
message: '操作成功'
})
this.visible = !this.visible
this.switchDialog()
this.$refs.productType.refreshTable()
} else {
this.$message({
......
......@@ -146,6 +146,7 @@
</el-form-item>
<el-form
:model="params"
ref="conditionForm"
label-width="150px"
>
<el-form-item
......@@ -260,6 +261,7 @@
</el-form>
<el-form
:model="params"
ref="contentForm"
label-width="150px"
>
<el-form-item
......@@ -461,10 +463,9 @@ export default {
// basicForm: this.params.basicForm,
basicRules: {
sceneName: [{ required: true, message: '请输入场景名称', trigger: 'blur' }],
typeKey: [{ required: true, message: '请选择场景类型', trigger: 'blur' }],
icon: [{ required: true, message: '请选择场景图标', trigger: 'blur' }],
backPic: [{ required: true, message: '请上传场景背景图', trigger: 'change' }],
description: [{ required: true, message: '请输入场景描述', trigger: 'blur' }]
typeKey: [{ required: true, message: '请选择场景类型', trigger: 'change' }],
icon: [{ required: true, message: '请选择场景图标', trigger: 'change' }],
backPic: [{ required: true, message: '请上传场景背景图', trigger: 'change' }]
},
iconList: [],
typeList: [],
......@@ -547,6 +548,7 @@ export default {
},
watch: {
visible(val) {
console.log(val)
if (val && this.params.basicForm.id) {
console.log(this.params)
const conditionList = this.params.conditionList
......@@ -567,12 +569,17 @@ export default {
}
})
}
if (!val) {
this.$refs.basicForm && this.$refs.basicForm.resetFields()
this.$refs.scenarioRuleForm && this.$refs.scenarioRuleForm.resetFields()
}
}
},
methods: {
// 上一步,下一步
last() {
this.active = 1
this.$refs.scenarioRuleForm && this.$refs.scenarioRuleForm.resetFields()
},
next() {
console.log(this.params.basicForm)
......@@ -584,32 +591,36 @@ export default {
handleSubmit() {
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', 'orderType']))
const templateList = conditionList.concat(contentList)
const params = Object.assign(basicForm, this.params.scenarioRuleForm)
params.templateList = templateList
delete params.conditionList
delete params.contentList
console.log(params)
save(params, this.baseURL).then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功'
})
this.$emit('hideDialog', true)
this.active = 1
} else {
this.$message({
type: 'error',
title: '操作失败'
this.$refs.conditionForm.validate((v) => {
this.$refs.contentForm.validate((t) => {
if (valid && v && t) {
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', 'orderType']))
const templateList = conditionList.concat(contentList)
const params = Object.assign(basicForm, this.params.scenarioRuleForm)
params.templateList = templateList
delete params.conditionList
delete params.contentList
console.log(params)
save(params, this.baseURL).then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功'
})
this.$emit('hideDialog', true)
this.active = 1
} else {
this.$message({
type: 'error',
title: '操作失败'
})
}
})
}
})
}
})
})
},
// clearObject
......@@ -681,7 +692,7 @@ export default {
} else {
var obj1 = _.cloneDeep(this.defalutContentObj)
obj1.key = parseInt(Math.random() * 1000)
this.params.scenarioRuleForm.contentList.push(obj1)
this.params.contentList.push(obj1)
}
},
closeCondition(index, name) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!