dialog 标题

This commit is contained in:
吕金泽 2022-01-28 12:13:17 +08:00
parent 5d793cde19
commit 8b7a73d452
8 changed files with 94 additions and 136 deletions

View File

@ -1,16 +1,15 @@
<template>
<el-dialog v-el-drag-dialog :fullscreen="fullscreen" :width="width" :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" :append-to-body="true" @opened="opened">
<template v-if="content">
{{ content }}
</template>
<slot v-else name="content" />
<slot name="content" />
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">
关闭
</el-button>
<el-button type="primary" @click="confirmClick">
确认
</el-button>
<slot name="btns">
<el-button @click="dialogVisible = false">
关闭
</el-button>
<el-button type="primary" @click="confirmClick">
确认
</el-button>
</slot>
</div>
</el-dialog>
</template>
@ -23,11 +22,6 @@ export default {
type: String,
default: ''
},
content: {
type: String,
default: '',
require: false
},
width: {
type: String,
default: '50%'

View File

@ -19,30 +19,24 @@
<pd-table ref="table" v-bind="tableOptions" />
<el-dialog v-el-drag-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :modal="false" :close-on-click-modal="false" width="700px">
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="100px" style="margin-left: 20px">
<el-form-item label="标签名" prop="label">
<el-input v-model="temp.label" />
</el-form-item>
<el-form-item label="值" prop="value">
<el-input v-model="temp.value" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">
关闭
</el-button>
<el-button type="primary" @click="save()">
确认
</el-button>
</div>
</el-dialog>
<pd-dialog ref="formDialog" :title="dialogTitle" width="700px" @confirm-click="save">
<template #content>
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="100px" style="margin-left: 20px">
<el-form-item label="标签名" prop="label">
<el-input v-model="temp.label" />
</el-form-item>
<el-form-item label="值" prop="value">
<el-input v-model="temp.value" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
</el-form>
</template>
</pd-dialog>
</div>
</template>
@ -115,12 +109,7 @@ export default {
}
]
},
textMap: {
update: '修改',
create: '添加'
},
dialogFormVisible: false,
dialogStatus: '',
dialogTitle: '',
rules: {
value: [{ required: true, message: '请输入值', trigger: 'change' }],
label: [{ required: true, message: '请输入标签名', trigger: 'change' }],
@ -162,8 +151,8 @@ export default {
handleCreate() {
this.temp = this.getTemp()
this.getSort()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.dialogTitle = '添加'
this.$refs.formDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
@ -172,10 +161,10 @@ export default {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$post('dict/items/save', this.temp).then(() => {
this.dialogFormVisible = false
this.$refs.formDialog.hide()
this.$notify({
title: '成功',
message: (this.dialogStatus === 'create' ? '创建' : '修改') + '成功',
message: this.dialogTitle + '成功',
type: 'success',
duration: 2000
})
@ -187,8 +176,8 @@ export default {
},
handleUpdate(row) {
this.$common.objAssign(this.temp, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.dialogTitle = '修改'
this.$refs.formDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})

View File

@ -19,37 +19,33 @@
<pd-table ref="table" v-bind="tableOptions" />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="700px">
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="100px" style="margin-left: 20px">
<el-form-item label="字典类型" prop="dictType">
<pd-select v-model="temp.dictType" type="dict_type" width="185px" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-input v-model="temp.type" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
<el-form-item label="描述" prop="descRibe">
<el-input v-model="temp.descRibe" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">
关闭
</el-button>
<el-button type="primary" @click="save()">
确认
</el-button>
</div>
</el-dialog>
<pd-dialog ref="dictDialog" :title="dialogTitle" width="700px" @confirm-click="save()">
<template #content>
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="100px" style="margin-left: 20px">
<el-form-item label="字典类型" prop="dictType">
<pd-select v-model="temp.dictType" type="dict_type" width="185px" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-input v-model="temp.type" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
<el-form-item label="描述" prop="descRibe">
<el-input v-model="temp.descRibe" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
</el-form>
</template>
</pd-dialog>
<el-dialog v-el-drag-dialog title="字典项" :visible.sync="dictItemsVisible" :close-on-click-modal="false" width="1400px">
<dict-items :dict-id.sync="dictId" />
</el-dialog>
<pd-dialog ref="dictItemsDialog" title="字典项" width="1400px">
<template #content>
<dict-items :dict-id.sync="dictId" />
</template>
</pd-dialog>
</div>
</template>
@ -130,7 +126,7 @@ export default {
title: '字典项',
type: 'primary',
click: (row) => {
this.dictItemsVisible = true
this.$refs.dictItemsDialog.show()
this.dictId = row.id
}
}
@ -140,21 +136,13 @@ export default {
},
dictId: '',
temp: this.getTemp(),
dialogFormVisible: false,
dictItemsVisible: false,
dialogStatus: '',
textMap: {
update: '修改',
create: '添加'
},
pvData: [],
dialogTitle: '',
rules: {
dictType: [{ required: true, message: '请输入标签', trigger: 'change' }],
type: [{ required: true, message: '请输入类型', trigger: 'change' }],
sort: [{ required: true, message: '请输入排序', trigger: 'change' }],
descRibe: [{ required: true, message: '请输入描述', trigger: 'change' }]
},
downloadLoading: false
}
}
},
methods: {
@ -179,8 +167,8 @@ export default {
handleCreate() {
this.temp = this.getTemp()
this.getSort()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.dialogTitle = '添加'
this.$refs.dictDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
@ -190,10 +178,10 @@ export default {
if (valid) {
this.$post('dict/save', this.temp).then((response) => {
this.temp.id = response.data
this.dialogFormVisible = false
this.$refs.dictDialog.hide()
this.$notify({
title: '成功',
message: (this.dialogStatus === 'create' ? '创建' : '修改') + '成功',
message: this.dialogTitle + '成功',
type: 'success',
duration: 2000
})
@ -205,8 +193,8 @@ export default {
},
handleUpdate(row) {
this.$common.objAssign(this.temp, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.dialogTitle = '修改'
this.$refs.dictDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})

View File

@ -24,7 +24,7 @@
<pd-table ref="table" v-bind="tableOptions" v-if="menuData && menuData.length > 0 && refreshTable" />
<pd-dialog ref="menuFormDialog" width="1050px" :title="textMap[dialogStatus]" @confirm-click="$refs.menuForm.save()">
<pd-dialog ref="menuFormDialog" width="1050px" :title="dialogTitle" @confirm-click="$refs.menuForm.save()">
<template #content>
<menu-form ref="menuForm" :menu-tree="menuTree" @reload-table="reloadTable" />
</template>
@ -185,11 +185,7 @@ export default {
}
]
},
dialogStatus: '',
textMap: {
update: '修改',
create: '添加'
},
dialogTitle: '',
searchTimeout: ''
}
},
@ -223,7 +219,7 @@ export default {
},500)
},
addSubMenu(id) {
this.dialogStatus = 'create'
this.dialogTitle = '添加'
this.$refs.menuFormDialog.show()
this.$nextTick(() => {
this.$refs.menuForm.addSubMenu(id)
@ -237,7 +233,7 @@ export default {
})
},
handleUpdate(row) {
this.dialogStatus = 'update'
this.dialogTitle = '修改'
this.$refs.menuFormDialog.show()
this.$nextTick(() => {
this.$refs.menuForm.getInfo(row);

View File

@ -30,7 +30,7 @@
<pd-table ref="table" v-bind="tableOptions" v-if="officeData && officeData.length > 0 && refreshTable" />
<pd-dialog ref="officeFormDialog" width="1050px" :title="textMap[dialogStatus]" @confirm-click="save()">
<pd-dialog ref="officeFormDialog" width="1050px" :title="dialogTitle" @confirm-click="save()">
<template #content>
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px" style="width: 900px; margin-left:50px;">
<el-row :gutter="24">
@ -184,18 +184,13 @@ export default {
}
]
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '修改',
create: '添加'
},
dialogTitle: '',
temp: this.getTemp(),
listConfigDialogVisible: false,
formConfigDialogVisible: false,
rules: {
type: [{ required: true, message: '请选择机构类型', trigger: 'change' }],
pid: [{ required: true, message: '请选择上级机构', trigger: 'change' }],
name: [{ required: true, message: '请输入机构名称', trigger: 'change' }]
name: [{ required: true, message: '请输入机构名称', trigger: 'change' }],
code: [{ required: true, message: '请输入机构编码', trigger: 'change' }]
},
searchTimeout: ''
}
@ -254,7 +249,7 @@ export default {
this.temp.pid = id
this.temp.id = this.$common.uuid()
this.getSort()
this.dialogStatus = 'create'
this.dialogTitle = '添加'
this.$refs.officeFormDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
@ -286,7 +281,7 @@ export default {
this.$refs.officeFormDialog.hide()
this.$notify({
title: '成功',
message: (this.dialogStatus === 'create' ? '创建' : '修改') + '成功',
message: dialogTitle + '成功',
type: 'success',
duration: 2000
})
@ -305,7 +300,7 @@ export default {
this.temp[t] = row[t]
}
this.temp.name = this.temp.name.replaceAll(/<font.*?>(.*?)<\/font>/g,'$1')
this.dialogStatus = 'update'
this.dialogTitle = '修改'
this.$refs.officeFormDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()

View File

@ -22,7 +22,7 @@
<pd-table ref="table" v-bind="tableOptions" />
<pd-dialog ref="roleFormDialog" @confirm-click="save()">
<pd-dialog ref="roleFormDialog" :title="dialogTitle" width="1000px" @confirm-click="save()">
<template #content>
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="120px" style="width: 900px;">
<el-row :gutter="24">
@ -66,7 +66,7 @@
</template>
</pd-dialog>
<pd-dialog ref="assignPermissionsDialog" width="40%" @confirm-click="$refs.assignPermissions.save()">
<pd-dialog ref="assignPermissionsDialog" title="分配权限" width="750" @confirm-click="$refs.assignPermissions.save()">
<template #content>
<role-assign-permissions ref="assignPermissions" :key="Math.random()" :id="temp.id" @close="() => { $refs.assignPermissionsDialog.hide(); temp.id = '' }" />
</template>
@ -163,12 +163,8 @@ export default {
}
]
},
dialogTitle: '',
temp: this.getTemp(),
dialogStatus: '',
textMap: {
update: '修改',
create: '添加'
},
rules: {
name: [{ required: true, message: '请输入角色名称', trigger: 'change' }],
code: [{ required: true, message: '请输入角色编码', trigger: 'change' }]
@ -203,7 +199,7 @@ export default {
},
handleCreate() {
this.resetTemp()
this.dialogStatus = 'create'
this.dialogTitle = '添加'
this.$refs.roleFormDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
@ -217,7 +213,7 @@ export default {
this.$refs.roleFormDialog.hide()
this.$notify({
title: '成功',
message: (this.dialogStatus === 'create' ? '创建' : '修改') + '成功',
message: this.dialogTitle + '成功',
type: 'success',
duration: 2000
})
@ -235,7 +231,7 @@ export default {
this.$get('office/by/role',{ roleId: row.id }).then(res => {
this.temp.offices = res.data.join(',')
})
this.dialogStatus = 'update'
this.dialogTitle = '修改'
this.$refs.roleFormDialog.show()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()

View File

@ -53,7 +53,7 @@ export default {
name: 'UserForm',
components: { Treeselect },
props: {
dialogStatus: {
dialogTitle: {
type: String,
default: ''
}
@ -105,7 +105,7 @@ export default {
this.dialogVisible = false
this.$notify({
title: '成功',
message: (this.dialogStatus === 'create' ? '创建' : '修改') + '成功',
message: this.dialogTitle + '成功',
type: 'success',
duration: 2000
})

View File

@ -45,9 +45,9 @@
<pd-table ref="table" v-bind="tableOptions" @selection-change="selectionChange" />
<pd-dialog ref="userFormDialog" @confirm-click="$refs.userForm.save()" width="40%">
<pd-dialog ref="userFormDialog" :title="dialogTitle" @confirm-click="$refs.userForm.save()" width="770px">
<template #content>
<user-form ref="userForm" :dialog-status="dialogStatus" @reload-table="reloadTable" />
<user-form ref="userForm" :dialog-status="dialogTitle" @reload-table="reloadTable" />
</template>
</pd-dialog>
</div>
@ -141,7 +141,7 @@ export default {
}
]
},
dialogStatus: '',
dialogTitle: '',
downloadLoading: false,
ids: []
}
@ -163,12 +163,12 @@ export default {
this.$refs.table.reloadList()
},
handleCreate() {
this.dialogStatus = 'create'
this.dialogTitle = '添加'
this.$refs.userFormDialog.show()
this.$nextTick(() => { this.$refs.userForm.resetTemp() })
},
handleUpdate(row) {
this.dialogStatus = 'update'
this.dialogTitle = '修改'
this.$refs.userFormDialog.show()
this.$nextTick(() => {
this.$refs.userForm.getInfo(row)