角色列表字段修改

This commit is contained in:
fengachen
2021-08-30 17:59:13 +08:00
parent e19b92a51e
commit eec31f453b
2 changed files with 66 additions and 72 deletions
@@ -187,19 +187,6 @@ export default {
handleCancel() { handleCancel() {
this.close() this.close()
}, },
/**
* 邮编校验
* @param rules
* @param value
* @param callback
*/
checkPostcode(rules, value, callback) {
if (postcode(value)) {
callback()
} else {
callback('请输入正确格式的邮编')
}
}
} }
} }
</script> </script>
+66 -59
View File
@@ -22,25 +22,25 @@
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator" style="margin: 5px 0 10px 2px"> <div class="table-operator" style="margin: 5px 0 10px 2px">
<a-button @click="handleAdd" type="primary" icon="plus" v-has="'sys:role:add'">添加角色</a-button> <a-button @click="handleAdd" type="primary" icon="plus" v-has="'sys:role:add'">添加角色</a-button>
<a-button @click="handleAddLowerLevel" type="primary" icon="plus" >添加下级</a-button> <a-button @click="handleAddLowerLevel" type="primary" icon="plus">添加下级</a-button>
<a-button @click="batchDel" type="danger" icon="delete">批量删除</a-button> <a-button @click="batchDel" type="danger" icon="delete">批量删除</a-button>
</div> </div>
<div style="margin-top: 15px"> <div style="margin-top: 15px">
<a-table <a-table
style="height:500px" style="height:500px"
ref="table" ref="table"
size="middle" size="middle"
bordered bordered
rowKey="id" rowKey="id"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
:expandedRowKeys="expandedRowKeys" :expandedRowKeys="expandedRowKeys"
@expandedRowsChange="handleExpandedRowsChange" @expandedRowsChange="handleExpandedRowsChange"
@change="handleTableChange"> @change="handleTableChange">
<span slot="action" class="action-span-cell" slot-scope="text, record"> <span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="handlePerssion(record.id)">授权</a> <a @click="handlePerssion(record.id)">授权</a>
<a @click="handleEdit(record)" v-has="'sys:role:edit'">编辑</a> <a @click="handleEdit(record)" v-has="'sys:role:edit'">编辑</a>
<a @click="handleDelete(record.id)" v-has="'sys:role:del'">删除</a> <a @click="handleDelete(record.id)" v-has="'sys:role:del'">删除</a>
@@ -57,10 +57,10 @@
</a-card> </a-card>
</template> </template>
<script> <script>
import { JeroListMixin } from "@/mixins/JeroListMixin"; import {JeroListMixin} from "@/mixins/JeroListMixin";
import {postAction, getAction } from "@/api/manage"; import {postAction, getAction} from "@/api/manage";
import RoleModal from "./modules/RoleModal"; import RoleModal from "./modules/RoleModal";
import { filterObj } from "@/utils/util"; import {filterObj} from "@/utils/util";
import UserRoleModal from "./modules/UserRoleModal"; import UserRoleModal from "./modules/UserRoleModal";
import JEllipsis from "@comp/jero/JEllipsis"; import JEllipsis from "@comp/jero/JEllipsis";
import moment from "moment"; import moment from "moment";
@@ -81,44 +81,51 @@ export default {
model2: {}, model2: {},
currentRoleId: "", currentRoleId: "",
selectedRowKeys: [], selectedRowKeys: [],
expandedRowKeys:[], expandedRowKeys: [],
columns: columns:
[ [
{ {
title: "角色编码", title: "角色编码",
align: "center", align: "center",
dataIndex: "roleCode", dataIndex: "roleCode",
width:160, width: 160,
scopedSlots: {customRender: 'text'} scopedSlots: {customRender: 'text'}
}, },
{ {
title: "角色名称", title: "角色名称",
align: "center", align: "center",
dataIndex: "roleName", dataIndex: "roleName",
scopedSlots: {customRender: 'text'} scopedSlots: {customRender: 'text'}
}, },
{ {
title: "上级角色", title: "上级角色",
align: "center", align: "center",
dataIndex: "", dataIndex: "parentName",
}, customRender(text) {
{ if (text) {
title: "创建时间", return text
dataIndex: "createTime", }else {
align: "center", return '无'
sorter: true, }
scopedSlots: {customRender: 'text'}, }
customRender: (text) => { },
return moment(text).format("YYYY-MM-DD HH:mm:ss"); {
title: "创建时间",
dataIndex: "createTime",
align: "center",
sorter: true,
scopedSlots: {customRender: 'text'},
customRender: (text) => {
return moment(text).format("YYYY-MM-DD HH:mm:ss");
}
},
{
title: "操作",
dataIndex: "action",
align: "center",
scopedSlots: {customRender: "action"}
} }
}, ],
{
title: "操作",
dataIndex: "action",
align: "center",
scopedSlots: { customRender: "action" }
}
],
url: { url: {
list: "/sys/role/treeListPage", list: "/sys/role/treeListPage",
delete: "/sys/role/delete", delete: "/sys/role/delete",
@@ -133,7 +140,7 @@ export default {
}; };
}, },
computed: { computed: {
importExcelUrl: function() { importExcelUrl: function () {
return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`; return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
} }
}, },
@@ -158,18 +165,18 @@ export default {
/* /*
* 添加下级 * 添加下级
* */ * */
handleAddLowerLevel(){ handleAddLowerLevel() {
if(this.selectedRowKeys.length === 0){ if (this.selectedRowKeys.length === 0) {
this.$message.warning('请选择一条记录') this.$message.warning('请选择一条记录')
return return
} }
if(this.selectedRowKeys.length > 1){ if (this.selectedRowKeys.length > 1) {
this.$message.warning('只能选择一条记录') this.$message.warning('只能选择一条记录')
return return
} }
// 将这行的角色id作为新建角色的的父级id // 将这行的角色id作为新建角色的的父级id
this.$refs.modalForm.addLowerRole(this.selectedRowKeys[0]); this.$refs.modalForm.addLowerRole(this.selectedRowKeys[0]);
this.$refs.modalForm.title='添加下级' this.$refs.modalForm.title = '添加下级'
}, },
handleAddUserRole() { handleAddUserRole() {
if (this.currentRoleId == "") { if (this.currentRoleId == "") {