Browse Source

update

pull/1/head
g7hoo 2 years ago
parent
commit
bc08dffda2
2 changed files with 29 additions and 5 deletions
  1. +22
    -1
      src/components/base-dialog/addOrUpdate/index.vue
  2. +7
    -4
      src/views/modules/monitoring/product.vue

+ 22
- 1
src/components/base-dialog/addOrUpdate/index.vue View File

@@ -259,6 +259,7 @@ export default {
return opt.label ? opt.label : this.defaultNames[opt.name]
}
},

getPlaceholder(n, c) {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) {
@@ -266,6 +267,7 @@ export default {
return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name]
}
},

getType(n, c) {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) {
@@ -279,9 +281,25 @@ export default {
return 'input'
}
},
init() {

init(id) {
this.dataForm.id = id || null
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) {
/** 提取url */
const urls = {}
@@ -330,8 +348,11 @@ export default {
// add more..
}
},

handleOperations() {},

getDataList() {},

handleClose() {
if (this.isAdd || this.isUpdated) this.$emit('refreshDataList')
this.visible = false


+ 7
- 4
src/views/modules/monitoring/product.vue View File

@@ -6,7 +6,7 @@
</el-form-item>
<el-form-item>
<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-form-item>
</el-form>
@@ -102,6 +102,7 @@ const tableConfigs = [

const addOrUpdateConfigs = {
type: 'dialog', // dialog | drawer | page
infoUrl: '/monitoring/product',
fields: [
'name',
{
@@ -214,14 +215,16 @@ export default {
},
methods: {
//
test() {
addOrEdit(id) {
this.showbasedialog = true
this.$nextTick(() => {
this.$refs.basedialog.init()
this.$refs.basedialog.init(id)
})
},
// 获取数据列表
getDataList() {
// console.log("after dialog close: ", this.showbasedialog)
this.showbasedialog = false // 清理弹窗
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/product/page'),
@@ -268,7 +271,7 @@ export default {
handleOperations({ type, data }) {
switch (type) {
case 'viewAttr': // <== 对照 tableConfig
return this.addOrUpdateHandle(data)
return this.addOrEdit(data)
case 'delete':
return this.deleteHandle(data)
}


Loading…
Cancel
Save