提交 51c699ec authored 作者: 吕本才's avatar 吕本才

弹窗不显示问题优化

上级 b70d85dc
...@@ -5,7 +5,8 @@ VUE_APP_TITLE = 若水数据中台 ...@@ -5,7 +5,8 @@ VUE_APP_TITLE = 若水数据中台
ENV = 'development' ENV = 'development'
# 若水数据中台/开发环境 # 若水数据中台/开发环境
VUE_APP_BASE_API = '' # VUE_APP_BASE_API = ''
# VUE_APP_BASE_API = 'http://192.168.100.38:10001'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" /> <pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" append-to-body="true">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="89px" style="width: 400px; margin-left:50px;"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="89px" style="width: 400px; margin-left:50px;">
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
@pagination="fetchData" @pagination="fetchData"
/> />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="800px"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="800px" append-to-body="true">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="100px"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="100px">
<el-form-item label="数据源" prop="datasource"> <el-form-item label="数据源" prop="datasource">
<el-select <el-select
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogPluginVisible" title="Reading statistics"> <el-dialog :visible.sync="dialogPluginVisible" title="Reading statistics" append-to-body="true">
<el-table :data="pluginData" border fit highlight-current-row style="width: 100%"> <el-table :data="pluginData" border fit highlight-current-row style="width: 100%">
<el-table-column prop="key" label="Channel" /> <el-table-column prop="key" label="Channel" />
<el-table-column prop="pv" label="Pv" /> <el-table-column prop="pv" label="Pv" />
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" /> <pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="1000px" :before-close="handleClose"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="1000px" :before-close="handleClose" append-to-body="true">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="110px"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="110px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
...@@ -446,7 +446,9 @@ export default { ...@@ -446,7 +446,9 @@ export default {
readerTable: '' readerTable: ''
}, },
resetTemp() { resetTemp() {
this.temp = this.$options.data().temp // 重置temp对象的属性,而不是替换整个对象,以保持响应式
const initialTemp = this.$options.data().temp
Object.assign(this.temp, initialTemp)
this.jobJson = '' this.jobJson = ''
this.glueSource = '' this.glueSource = ''
this.timeOffset = 0 this.timeOffset = 0
...@@ -571,35 +573,54 @@ export default { ...@@ -571,35 +573,54 @@ export default {
incStartTimeFormat(vData) { incStartTimeFormat(vData) {
}, },
handleCreate() { handleCreate() {
// 直接重置表单可见性,避免之前的状态影响
this.dialogFormVisible = false
// 重置temp对象
this.resetTemp() this.resetTemp()
// 设置弹窗状态
this.dialogStatus = 'create' this.dialogStatus = 'create'
// 先显示弹窗
this.dialogFormVisible = true this.dialogFormVisible = true
// 使用nextTick确保DOM更新后再清除验证
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs['dataForm']) {
this.$refs['dataForm'].clearValidate() this.$refs['dataForm'].clearValidate()
}
}) })
}, },
handlerUpdate(row) { handlerUpdate(row) {
console.log(row)
// 直接重置表单可见性,避免之前的状态影响
this.dialogFormVisible = false
// 重置temp对象,使用响应式的初始对象
this.resetTemp() this.resetTemp()
this.temp = Object.assign({}, row) // copy obj
// 逐个赋值row的属性,保持temp对象的响应式
Object.assign(this.temp, row)
// 处理jobJson
if (this.temp.jobJson) { if (this.temp.jobJson) {
try {
this.jobJson = JSON.parse(this.temp.jobJson) this.jobJson = JSON.parse(this.temp.jobJson)
this.temp.jobJson = JSON.parse(this.temp.jobJson) } catch (e) {
} console.error('解析jobJson失败:', e)
this.jobJson = ''
this.glueSource = this.temp.glueSource
const arrchildSet = []
const arrJobIdList = []
if (this.jobIdList) {
for (const n in this.jobIdList) {
if (this.jobIdList[n].id !== this.temp.id) {
arrJobIdList.push(this.jobIdList[n])
}
} }
this.JobIdList = arrJobIdList } else {
this.jobJson = ''
} }
this.glueSource = this.temp.glueSource || ''
// 处理子任务
if (this.temp.childJobId) { if (this.temp.childJobId) {
const arrString = this.temp.childJobId.split(',') const arrString = this.temp.childJobId.split(',')
const arrchildSet = []
for (const i in arrString) { for (const i in arrString) {
for (const n in this.jobIdList) { for (const n in this.jobIdList) {
if (this.jobIdList[n].id === parseInt(arrString[i])) { if (this.jobIdList[n].id === parseInt(arrString[i])) {
...@@ -608,17 +629,29 @@ export default { ...@@ -608,17 +629,29 @@ export default {
} }
} }
this.temp.childJobId = arrchildSet this.temp.childJobId = arrchildSet
} else {
this.temp.childJobId = []
} }
// 处理分区信息
if (this.temp.partitionInfo) { if (this.temp.partitionInfo) {
const partition = this.temp.partitionInfo.split(',') const partition = this.temp.partitionInfo.split(',')
this.partitionField = partition[0] this.partitionField = partition[0] || ''
this.timeOffset = partition[1] this.timeOffset = parseInt(partition[1]) || 0
this.timeFormatType = partition[2] this.timeFormatType = partition[2] || 'yyyy-MM-dd'
} }
// 设置弹窗状态和显示
this.dialogStatus = 'update' this.dialogStatus = 'update'
// 先显示弹窗
this.dialogFormVisible = true this.dialogFormVisible = true
// 使用nextTick确保DOM更新后再清除验证
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs['dataForm']) {
this.$refs['dataForm'].clearValidate() this.$refs['dataForm'].clearValidate()
}
}) })
}, },
createData() { createData() {
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
@pagination="fetchData" @pagination="fetchData"
/> />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px" append-to-body="true">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="center" label-width="100px"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="center" label-width="100px">
<el-row> <el-row>
<el-col :span="14" :offset="5"> <el-col :span="14" :offset="5">
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="日志查看" :visible.sync="dialogVisible" width="95%"> <el-dialog title="日志查看" :visible.sync="dialogVisible" width="95%" append-to-body="true">
<div class="log-container"> <div class="log-container">
<pre :loading="logLoading" v-text="logContent" /> <pre :loading="logLoading" v-text="logContent" />
</div> </div>
...@@ -263,7 +263,9 @@ export default { ...@@ -263,7 +263,9 @@ export default {
this.dialogStatus = 'create' this.dialogStatus = 'create'
this.dialogFormVisible = true this.dialogFormVisible = true
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs['dataForm']) {
this.$refs['dataForm'].clearValidate() this.$refs['dataForm'].clearValidate()
}
}) })
}, },
deleteLog() { deleteLog() {
...@@ -315,7 +317,6 @@ export default { ...@@ -315,7 +317,6 @@ export default {
killRunningJob(row) { killRunningJob(row) {
log.killJob(row).then(response => { log.killJob(row).then(response => {
this.fetchData() this.fetchData()
this.dialogFormVisible = false
this.$notify({ this.$notify({
title: 'Success', title: 'Success',
message: 'Kill Successfully', message: 'Kill Successfully',
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
@pagination="fetchData" @pagination="fetchData"
/> />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="800px"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="800px" append-to-body="true">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="100px"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="100px">
<el-form-item label="项目名称" prop="name"> <el-form-item label="项目名称" prop="name">
<el-input v-model="temp.name" placeholder="项目名称" style="width: 40%" /> <el-input v-model="temp.name" placeholder="项目名称" style="width: 40%" />
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogPluginVisible" title="Reading statistics"> <el-dialog :visible.sync="dialogPluginVisible" title="Reading statistics" append-to-body="true">
<el-table :data="pluginData" border fit highlight-current-row style="width: 100%"> <el-table :data="pluginData" border fit highlight-current-row style="width: 100%">
<el-table-column prop="key" label="Channel" /> <el-table-column prop="key" label="Channel" />
<el-table-column prop="pv" label="Pv" /> <el-table-column prop="pv" label="Pv" />
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" /> <pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="1000px" :before-close="handleClose"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="1000px" :before-close="handleClose" append-to-body="true">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="110px"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="110px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
:limit.sync="listQuery.size" :limit.sync="listQuery.size"
@pagination="fetchData" @pagination="fetchData"
/> />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" append-to-body="true">
<el-form <el-form
ref="dataForm" ref="dataForm"
:rules="rules" :rules="rules"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论