字典修改时添加密码校验

This commit is contained in:
cwchen 2024-09-11 18:25:49 +08:00
parent b707f728f2
commit 6a9fb2a8a5
1 changed files with 69 additions and 32 deletions

View File

@ -1,19 +1,16 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-input v-model="listQuery.keyWord" :maxlength="50" placeholder="请输入字典名称" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.keyWord" :maxlength="50" placeholder="请输入字典名称" style="width: 200px;"
<el-button v-waves style="margin-left: 40px;" class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查询</el-button> class="filter-item" @keyup.enter.native="handleFilter" />
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">新增</el-button> <el-button v-waves style="margin-left: 40px;" class="filter-item" type="primary" icon="el-icon-search"
@click="handleFilter">查询</el-button>
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit"
@click="handleCreate">新增</el-button>
</div> </div>
<div> <div>
<el-table <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="dictId" border
:data="tableData" :default-expand-all="false" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
style="width: 100%;margin-bottom: 20px;"
row-key="dictId"
border
:default-expand-all="false"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="dictCode" :maxlength="50" label="字典编码" sortable width="180" /> <el-table-column prop="dictCode" :maxlength="50" label="字典编码" sortable width="180" />
<el-table-column prop="dictName" :maxlength="50" label="字典名称" sortable width="180" /> <el-table-column prop="dictName" :maxlength="50" label="字典名称" sortable width="180" />
<el-table-column prop="dictValue" :maxlength="50" label="排序" /> <el-table-column prop="dictValue" :maxlength="50" label="排序" />
@ -22,7 +19,8 @@
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="{row,$index}"> <template slot-scope="{row,$index}">
<el-button type="primary" icon="el-icon-edit" title="编辑" size="mini" @click="handleUpdate(row)" /> <el-button type="primary" icon="el-icon-edit" title="编辑" size="mini" @click="handleUpdate(row)" />
<el-button v-if="row.status!='deleted'" size="mini" icon="el-icon-delete" title="删除" type="danger" @click="handleDelete(row,$index)" /> <el-button v-if="row.status != 'deleted'" size="mini" icon="el-icon-delete" title="删除" type="danger"
@click="handleDelete(row, $index)" />
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -30,9 +28,11 @@
</div> </div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="80px" style="width: 400px; margin-left:50px;"> <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="80px"
style="width: 400px; margin-left:50px;">
<el-form-item label="上级节点" prop="type"> <el-form-item label="上级节点" prop="type">
<treeselect v-model="temp.pidCode" :options="DictList" :show-count="true" placeholder="请选择上级节点" no-options-text="暂无数据" /> <treeselect v-model="temp.pidCode" :options="DictList" :show-count="true" placeholder="请选择上级节点"
no-options-text="暂无数据" />
</el-form-item> </el-form-item>
<el-form-item label="字典编码" prop="dictCode"> <el-form-item label="字典编码" prop="dictCode">
<el-input-number v-model="temp.dictCode" :min="1" :max="999999999" placeholder="请输入字典编码(大于0的正整数)" /> <el-input-number v-model="temp.dictCode" :min="1" :max="999999999" placeholder="请输入字典编码(大于0的正整数)" />
@ -51,19 +51,22 @@
<el-button @click="dialogFormVisible = false"> <el-button @click="dialogFormVisible = false">
关闭 关闭
</el-button> </el-button>
<el-button type="primary" @click="dialogStatus==='create'?addDict():updateDict()"> <el-button type="primary" @click="dialogStatus === 'create' ? addDict() : updateDict()">
提交 提交
</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<modul-dialog ref="pwdVerifiersDialog" :title="componentDialog.title" :width="componentDialog.width"
v-model="componentDialog.openFalg">
<component :is="componentDialog.modulName" />
</modul-dialog>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.el-input-number--medium { .el-input-number--medium {
width: 320px; width: 320px;
line-height: 34px; line-height: 34px;
} }
</style> </style>
<script> <script>
import { getList, addDict, updateDict, delDict, getDetails } from '@/api/dict' import { getList, addDict, updateDict, delDict, getDetails } from '@/api/dict'
@ -73,11 +76,19 @@ import Pagination from '@/components/Pagination' // secondary package based on e
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { delUser } from '@/api/user' import { delUser } from '@/api/user'
import { verifyPwd } from '@/api/verifyPwd'
import modulDialog from '@/components/pwdVerifiers/pwdVerifiers.vue'
export default { export default {
components: { Pagination, Treeselect }, components: { Pagination, Treeselect,modulDialog },
directives: { waves }, directives: { waves },
data() { data() {
return { return {
componentDialog: {
modulName: '', //
title: '',
width: '',
openFalg: false
},
tableData: null, tableData: null,
listLoading: true, listLoading: true,
listQuery: { listQuery: {
@ -113,6 +124,29 @@ export default {
this.fetchDictList() this.fetchDictList()
}, },
methods: { methods: {
openModulDialog(title, modulName, width, openFalg) {
this.componentDialog.title = title
this.componentDialog.modulName = modulName
this.componentDialog.width = width
this.componentDialog.openFalg = openFalg
},
verifiersPwd(data) {
verifyPwd(data).then((response) => {
this.$message({
showClose: true,
message: response.msg,
type: 'success',
duration: 500
})
//
this.componentDialog.openFalg = false;
if (this.$refs.pwdVerifiersDialog) {
this.$refs.pwdVerifiersDialog.resetForm();
}
this.commitUpdateData();
})
},
getList() { // getList() { //
this.listLoading = true this.listLoading = true
getList(this.listQuery.keyWord).then(response => { getList(this.listQuery.keyWord).then(response => {
@ -189,6 +223,11 @@ export default {
updateDict() { updateDict() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.openModulDialog('验证密码', 'pwdVerifiers', '600px', true)
}
})
},
commitUpdateData() {
updateDict(this.temp).then((response) => { updateDict(this.temp).then((response) => {
this.dialogFormVisible = false this.dialogFormVisible = false
this.getList() this.getList()
@ -199,14 +238,12 @@ export default {
duration: 2000 duration: 2000
}) })
}) })
}
})
}, },
handleDelete(row, index) { handleDelete(row, index) {
this.$confirm(`确定要删除该数据吗?`, { this.$confirm(`确定要删除该数据吗?`, {
type: 'warning', type: 'warning',
title: '操作提示', title: '操作提示',
beforeClose: async(action, instance, done) => { beforeClose: async (action, instance, done) => {
if (action === 'confirm') { if (action === 'confirm') {
delDict({ dictId: row.dictId }).then((response) => { delDict({ dictId: row.dictId }).then((response) => {
this.$notify({ this.$notify({