字典修改时添加密码校验

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>
<div class="app-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-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>
<el-input v-model="listQuery.keyWord" :maxlength="50" placeholder="请输入字典名称" style="width: 200px;"
class="filter-item" @keyup.enter.native="handleFilter" />
<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>
<el-table
:data="tableData"
style="width: 100%;margin-bottom: 20px;"
row-key="dictId"
border
:default-expand-all="false"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table :data="tableData" 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="dictName" :maxlength="50" label="字典名称" sortable width="180" />
<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">
<template slot-scope="{row,$index}">
<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>
</el-table-column>
</el-table>
@ -30,9 +28,11 @@
</div>
<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">
<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 label="字典编码" prop="dictCode">
<el-input-number v-model="temp.dictCode" :min="1" :max="999999999" placeholder="请输入字典编码(大于0的正整数)" />
@ -51,19 +51,22 @@
<el-button @click="dialogFormVisible = false">
关闭
</el-button>
<el-button type="primary" @click="dialogStatus==='create'?addDict():updateDict()">
<el-button type="primary" @click="dialogStatus === 'create' ? addDict() : updateDict()">
提交
</el-button>
</div>
</el-dialog>
<modul-dialog ref="pwdVerifiersDialog" :title="componentDialog.title" :width="componentDialog.width"
v-model="componentDialog.openFalg">
<component :is="componentDialog.modulName" />
</modul-dialog>
</div>
</template>
<style scoped>
.el-input-number--medium {
width: 320px;
line-height: 34px;
}
.el-input-number--medium {
width: 320px;
line-height: 34px;
}
</style>
<script>
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 '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { delUser } from '@/api/user'
import { verifyPwd } from '@/api/verifyPwd'
import modulDialog from '@/components/pwdVerifiers/pwdVerifiers.vue'
export default {
components: { Pagination, Treeselect },
components: { Pagination, Treeselect,modulDialog },
directives: { waves },
data() {
return {
componentDialog: {
modulName: '', //
title: '',
width: '',
openFalg: false
},
tableData: null,
listLoading: true,
listQuery: {
@ -113,6 +124,29 @@ export default {
this.fetchDictList()
},
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() { //
this.listLoading = true
getList(this.listQuery.keyWord).then(response => {
@ -189,24 +223,27 @@ export default {
updateDict() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateDict(this.temp).then((response) => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: '成功',
message: response.msg,
type: 'success',
duration: 2000
})
})
this.openModulDialog('验证密码', 'pwdVerifiers', '600px', true)
}
})
},
commitUpdateData() {
updateDict(this.temp).then((response) => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: '成功',
message: response.msg,
type: 'success',
duration: 2000
})
})
},
handleDelete(row, index) {
this.$confirm(`确定要删除该数据吗?`, {
type: 'warning',
title: '操作提示',
beforeClose: async(action, instance, done) => {
beforeClose: async (action, instance, done) => {
if (action === 'confirm') {
delDict({ dictId: row.dictId }).then((response) => {
this.$notify({