提交 57765f67 authored 作者: 刘旭's avatar 刘旭

优化

上级 e982ce95
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</el-row> </el-row>
</div> </div>
<el-dialog v-model="showAddDialog" title="选择产品" width="50%" :beforeClose="handleClose"> <el-dialog v-model="showAddDialog" :title="title" width="50%" :beforeClose="handleClose">
<el-row justify="start" style="padding: 0 10%"> <el-row justify="start" style="padding: 0 10%">
<el-col :span="6" style="text-align: center"> <el-col :span="6" style="text-align: center">
<el-button type="primary" :disabled="disabled" circle style="width: 100px; height: 100px" <el-button type="primary" :disabled="disabled" circle style="width: 100px; height: 100px"
...@@ -121,7 +121,7 @@ const previewProductAfterRef = ref() ...@@ -121,7 +121,7 @@ const previewProductAfterRef = ref()
const previewProductBeforeRef = ref() const previewProductBeforeRef = ref()
const enableRef = ref() const enableRef = ref()
const disabled = ref(false) // 选择产品是否禁用 const disabled = ref(false) // 选择产品是否禁用
const title = ref('选择产品')
const afterTitle = computed(() => { const afterTitle = computed(() => {
if (productAfterCode.value) { if (productAfterCode.value) {
let title = '' let title = ''
...@@ -145,6 +145,7 @@ const beforeTitle = computed(() => { ...@@ -145,6 +145,7 @@ const beforeTitle = computed(() => {
// 添加产品 // 添加产品
let addProductShow = () => { let addProductShow = () => {
disabled.value = false disabled.value = false
title.value = '选择产品'
showAddDialog.value = true showAddDialog.value = true
} }
...@@ -252,6 +253,7 @@ const selectScene = (id: string) => { ...@@ -252,6 +253,7 @@ const selectScene = (id: string) => {
const editProduct = (row: any) => { const editProduct = (row: any) => {
showAddDialog.value = true showAddDialog.value = true
disabled.value = true disabled.value = true
title.value = '编辑产品'
productAfterCode.value = row.productAfterCode productAfterCode.value = row.productAfterCode
productBeforeCode.value = row.productBeforeCode productBeforeCode.value = row.productBeforeCode
nextTick(() => { nextTick(() => {
...@@ -297,12 +299,10 @@ const onConfirm = () => { ...@@ -297,12 +299,10 @@ const onConfirm = () => {
setTimeout(() => { setTimeout(() => {
saveCommonParam(productBeforeCode.value, productBeforeData.value) saveCommonParam(productBeforeCode.value, productBeforeData.value)
saveCommonParam(productAfterCode.value, productAfterData.value) saveCommonParam(productAfterCode.value, productAfterData.value)
createPlatformProduct(data).then((res: any) => { if (title.value === '选择产品') createPlatformProduct(data).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
init() init()
productAfterCode.value = '' handleClose()
productBeforeCode.value = ''
showAddDialog.value = false
ElMessage({ type: 'success', message: '保存成功' }) ElMessage({ type: 'success', message: '保存成功' })
} }
}) })
...@@ -311,8 +311,9 @@ const onConfirm = () => { ...@@ -311,8 +311,9 @@ const onConfirm = () => {
const saveCommonParam = (code: string, data: any) => { const saveCommonParam = (code: string, data: any) => {
postCommonParam({ code, data }).then((res: any) => { postCommonParam({ code, data }).then((res: any) => {
if (res.code === 200) { if (res.code === 200 && code === productAfterCode.value && title.value === '编辑产品') {
console.log(res) handleClose()
ElMessage({ type: 'success', message: '保存成功' })
} }
}) })
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论