Commit 0b15835e by 胡悦

修复bug

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