This commit is contained in:
g7hoo 2022-08-10 15:54:41 +08:00
parent e91520e99d
commit bc08dffda2
2 changed files with 29 additions and 5 deletions

View File

@ -259,6 +259,7 @@ export default {
return opt.label ? opt.label : this.defaultNames[opt.name] return opt.label ? opt.label : this.defaultNames[opt.name]
} }
}, },
getPlaceholder(n, c) { getPlaceholder(n, c) {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) { if (opt) {
@ -266,6 +267,7 @@ export default {
return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name] return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name]
} }
}, },
getType(n, c) { getType(n, c) {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) { if (opt) {
@ -279,9 +281,25 @@ export default {
return 'input' return 'input'
} }
}, },
init() {
init(id) {
this.dataForm.id = id || null
this.visible = true this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`${this.infoUrl}/${this.dataForm.id}`),
method: 'get'
}).then(({ data: res }) => {
if (res && res.code === 0) {
this.dataForm =
}
})
}
})
}, },
handleClick(btn) { handleClick(btn) {
/** 提取url */ /** 提取url */
const urls = {} const urls = {}
@ -330,8 +348,11 @@ export default {
// add more.. // add more..
} }
}, },
handleOperations() {}, handleOperations() {},
getDataList() {}, getDataList() {},
handleClose() { handleClose() {
if (this.isAdd || this.isUpdated) this.$emit('refreshDataList') if (this.isAdd || this.isUpdated) this.$emit('refreshDataList')
this.visible = false this.visible = false

View File

@ -6,7 +6,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList()">查询</el-button>
<el-button @click="test()">测试</el-button> <el-button @click="addOrEdit()">测试</el-button>
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -102,6 +102,7 @@ const tableConfigs = [
const addOrUpdateConfigs = { const addOrUpdateConfigs = {
type: 'dialog', // dialog | drawer | page type: 'dialog', // dialog | drawer | page
infoUrl: '/monitoring/product',
fields: [ fields: [
'name', 'name',
{ {
@ -214,14 +215,16 @@ export default {
}, },
methods: { methods: {
// //
test() { addOrEdit(id) {
this.showbasedialog = true this.showbasedialog = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.basedialog.init() this.$refs.basedialog.init(id)
}) })
}, },
// //
getDataList() { getDataList() {
// console.log("after dialog close: ", this.showbasedialog)
this.showbasedialog = false //
this.dataListLoading = true this.dataListLoading = true
this.$http({ this.$http({
url: this.$http.adornUrl('/monitoring/product/page'), url: this.$http.adornUrl('/monitoring/product/page'),
@ -268,7 +271,7 @@ export default {
handleOperations({ type, data }) { handleOperations({ type, data }) {
switch (type) { switch (type) {
case 'viewAttr': // <== tableConfig case 'viewAttr': // <== tableConfig
return this.addOrUpdateHandle(data) return this.addOrEdit(data)
case 'delete': case 'delete':
return this.deleteHandle(data) return this.deleteHandle(data)
} }