dinghao 6 months ago
parent
commit
3f236bb1b1
  1. 4
      hx-ai-intelligent/src/router/organizationManage.ts
  2. 108
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  3. 598
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  4. 2
      lib/component/table/use-table-column.ts

4
hx-ai-intelligent/src/router/organizationManage.ts

@ -39,7 +39,7 @@ const organizationManage = {
{
path: 'index',
name: 'userManageIndex',
component: () => import('/@/view/developing.vue'),
component: () => import('/@/view/organizationManage/usermanage/index.vue'),
meta: {
title: '用户管理',
keepAlive: true,
@ -63,7 +63,7 @@ const organizationManage = {
{
path: 'index',
name: 'authorityManageIndex',
component: () => import('/@/view/departmentManage/index.vue'),
component: () => import('/@/view/organizationManage/departmentManage/index.vue'),
meta: {
title: '部门/权限',
keepAlive: true,

108
hx-ai-intelligent/src/view/departmentManage/index.vue → hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue

@ -6,9 +6,9 @@
<div class="ns-table-title">部门管理</div>
<a-row>
<a-col :span="12" class="tree">
<ns-button style="margin: 10px" type="primary">新增部门</ns-button>
<ns-button type="primary">新增子部门</ns-button>
<ns-button style="margin: 10px" type="primary">删除</ns-button>
<ns-button style="margin: 10px" type="primary" @click="addApartment">新增部门</ns-button>
<ns-button type="primary" @click="addApartmentSon">新增子部门</ns-button>
<ns-button style="margin: 10px" type="primary" @click="deleteApartment">删除</ns-button>
<a-tree :tree-data="treeData" @select="handleSelect">
<template #title="{ title }">
{{ title }}
@ -18,25 +18,102 @@
<a-col :span="12" class="list">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="部门信息">
<ns-form :schemas="formSchema" :model="formData" disabled />
<ns-form :schemas="formSchema" :model="formData" />
</a-tab-pane>
<a-tab-pane key="2" tab="部门权限">2</a-tab-pane>
</a-tabs>
<ns-button style="margin: 10px" type="primary">取消</ns-button>
<ns-button type="primary" @click="ApartmentSure">{{
disabled ? '编辑' : '确定'
}}</ns-button>
</a-col>
</a-row>
</div>
<div class="right">
<div class="ns-table-title">角色管理</div>
<a-row>
<a-col :span="12" class="tree">
<ns-button style="margin: 10px" type="primary" @click="addUser">新增角色</ns-button>
<ns-button type="primary" @click="addUserSon">新增子角色</ns-button>
<ns-button style="margin: 10px" type="primary" @click="deleteUser">删除</ns-button>
<a-tree :tree-data="treeData" @select="handleSelect">
<template #title="{ title }">
{{ title }}
</template>
</a-tree>
</a-col>
<a-col :span="12" class="list">
<a-tabs v-model:activeKey="activeKey2">
<a-tab-pane key="1" tab="角色信息">
<ns-form :schemas="formSchema" :model="formData" />
</a-tab-pane>
<a-tab-pane key="2" tab="角色权限">2</a-tab-pane>
</a-tabs>
<ns-button style="margin: 10px" type="primary">取消</ns-button>
<ns-button type="primary">确定</ns-button>
</a-col>
</a-row>
</div>
<div class="right"></div>
</div>
</template>
<script lang="ts">
import { createVNode, defineComponent, reactive, ref } from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { http } from '/nerv-lib/util/http';
export default defineComponent({
name: 'OrderListIndex',
setup() {
const activeKey = ref('1');
const activeKey2 = ref('1');
const disabled = ref(false);
const addApartment = () => {
disabled.value = false;
};
const addApartmentSon = () => {
disabled.value = false;
};
const deleteApartment = () => {
Modal.confirm({
title: '是否确认删除',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
};
const addUser = () => {
disabled.value = false;
};
const addUserSon = () => {
disabled.value = false;
};
const deleteUser = () => {
Modal.confirm({
title: '是否确认删除',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
};
const handleSelect = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
};
const ApartmentSure = () => {
disabled.value = !disabled.value;
};
const treeData = [
{
@ -54,11 +131,6 @@
remark: '',
});
const handleSelect = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
};
const formSchema = reactive([
{
field: 'field111',
@ -70,6 +142,7 @@
field: 'department',
component: 'NsSelect',
componentProps: {
disabled: disabled,
placeholder: '请选择部门',
options: [
{
@ -94,6 +167,7 @@
field: 'department',
component: 'NsSelect',
componentProps: {
disabled: disabled,
placeholder: '请选择上级部门',
options: [
{
@ -112,6 +186,7 @@
field: 'department',
component: 'NsSelect',
componentProps: {
disabled: disabled,
placeholder: '请选择部门编码',
options: [
{
@ -136,6 +211,7 @@
field: 'order',
component: 'NsInput',
componentProps: {
disabled: disabled,
placeholder: '请输入排序',
},
rules: [
@ -150,6 +226,7 @@
label: '备注',
component: 'NsTextarea',
componentProps: {
disabled: disabled,
placeholder: '请输入',
},
},
@ -158,11 +235,20 @@
},
]);
return {
disabled,
formSchema,
formData,
treeData,
handleSelect,
activeKey,
activeKey2,
ApartmentSure,
addApartment,
addApartmentSon,
deleteApartment,
deleteUser,
addUser,
addUserSon,
};
},
});
@ -177,7 +263,7 @@
height: calc(100vh-50px);
border-right: 5px solid rgb(229, 235, 240);
}
.left .tree {
.tree {
width: 400px;
height: 89vh;
border-right: 2px solid rgb(229, 235, 240);

598
hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue

@ -0,0 +1,598 @@
<!-- @format -->
<template>
</template>
<script lang="ts">
import { Modal } from 'ant-design-vue';
import { createVNode, defineComponent, reactive, ref } from 'vue';
import { http } from '/nerv-lib/util/http';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
export default defineComponent({
name: 'OrderListIndex',
setup() {
const mainRef = ref();
const data = reactive({});
const data2 = reactive([
{
userinformation: 1,
},
]);
const visible = ref(false);
const searchValue = ref<string>('');
const searchValue2 = ref<string>('');
const addformvisible = ref(false);
const treeData = [
{
title: '铁路总局',
key: '0-0',
children: [
{ title: '济阳站', key: '0-0-0' },
{ title: '临沂站', key: '0-0-1' },
],
},
];
const treeData2 = [
{
title: '全部',
key: '0-0',
children: [
{ title: '产品部', key: '0-0-0' },
{ title: '运维部', key: '0-0-1' },
],
},
];
let formData = reactive({
name: '',
zhanghao: '',
});
let formData2 = reactive({
information: '',
});
const onSearch = () => {
console.log(searchValue.value);
};
const onSearch2 = () => {
console.log(searchValue2.value);
};
const handleSelect = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
};
const handleSelect2 = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
};
const onClose = () => {
visible.value = false;
};
const onEdit = () => {
console.log(formData, 'formData');
visible.value = false;
};
const handleOk = () => {
addformvisible.value = false;
};
const handleClose = () => {
addformvisible.value = false;
};
const tableConfig = {
// title: '',
api: {
url: '/carbon_emission/device/getGatewayList',
method: 'post',
},
listField: 'data.records',
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
type: 'primary',
handle: () => {
visible.value = true;
},
},
{
label: '导入',
type: 'primary',
name: 'RoleTypeAdd',
handle: () => {},
},
{
label: '模板下载',
type: 'primary',
name: 'RoleTypeAdd',
handle: () => {},
},
{
label: '导出',
type: 'primary',
name: 'RoleTypeAdd',
handle: () => {},
},
{
label: '批量删除',
type: 'primary',
name: 'RoleTypeAdd',
handle: () => {},
dynamicDisabled: (data: any) => {
return data.list.length === 0;
},
confirm: true,
isReload: true,
},
],
params: {
page: 0,
pageSize: 10,
},
columns: [
{
title: '序号',
dataIndex: 'address',
width: 80,
customRender: (text: any) => {
return text.index + 1;
},
sorter: {
compare: (a, b) => a.address - b.address,
},
},
{
title: '账号',
dataIndex: 'zhanghao',
sorter: {
compare: (a, b) => a.zhanghao - b.zhanghao,
},
},
{
title: '姓名',
dataIndex: 'name',
sorter: {
compare: (a, b) => a.name - b.name,
},
},
{
title: '性别',
dataIndex: 'sex',
sorter: {
compare: (a, b) => a.name - b.name,
},
},
{
title: '手机号',
dataIndex: 'phone',
},
{
title: '邮箱',
dataIndex: 'email',
},
{
title: '组织关系',
dataIndex: 'relation',
},
{
title: '部门角色',
dataIndex: 'role',
},
{
title: '状态',
dataIndex: 'status',
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'RoleTypeEdit',
// dynamicParams: 'uuid',
handle: (record: any) => {
console.log(record, 'record');
formData.name = record.name;
formData.zhanghao = record.zhanghao;
visible.value = true;
},
},
{
label: '冻结',
name: 'RoleTypeEdit',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '是否冻结该账户',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
// http
// .post('/api/parking_merchant/objs/gateInfo/delete', {
// uuid: record.uuid,
// })
// .then((res) => {
// mainRef.value.nsTableRef.reload();
// });
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
},
},
{
label: '重置密码',
name: 'RoleTypeEdit',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '是否重置密码',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
Modal.success({
title: '密码重置成功,初始密码123456',
});
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
},
},
{
label: '删除',
name: 'RoleTypeEdit',
dynamicParams: {
uuid: 'uuid',
},
// name: 'ExitManageDelete',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '确定确认删除',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
// http
// .post('/api/parking_merchant/objs/gateInfo/delete', {
// uuid: record.uuid,
// })
// .then((res) => {
// mainRef.value.nsTableRef.reload();
// });
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
},
},
],
},
formConfig: {
schemas: [
{
field: 'zhanghao',
label: '账号名',
component: 'NsInput',
componentProps: {
placeholder: '请输入账号名',
},
},
{
field: 'name',
label: '姓名',
component: 'NsInput',
componentProps: {
placeholder: '请输入姓名',
},
},
{
field: 'phone',
label: '手机号',
component: 'NsInput',
componentProps: {
placeholder: '请输入手机号',
},
},
{
field: 'email',
label: '邮箱',
component: 'NsInput',
componentProps: {
placeholder: '请输入邮箱',
},
},
{
field: 'status',
label: '用户状态',
component: 'NsSelect',
componentProps: {
placeholder: '请选择',
options: [
{
label: '正常',
value: 1,
},
{
label: '冻结',
value: 2,
},
],
},
},
],
params: {},
},
// pagination: { defaultPageSize: 10 },
rowKey: 'uuid',
};
const tableConfig2 = {
api: {
url: '/carbon_emission/device/getGatewayList',
method: 'post',
},
listField: 'data.records',
rowSelection: null,
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
type: 'primary',
handle: () => {
addformvisible.value = true;
},
},
],
columns: [
{
title: '角色信息',
dataIndex: 'name',
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'RoleTypeEdit',
// dynamicParams: 'uuid',
handle: (record: any) => {
console.log(record, 'record');
addformvisible.value = true;
// formData.name = record.name;
// formData.zhanghao = record.zhanghao;
// visible.value = true;
},
},
{
label: '删除',
name: 'RoleTypeEdit',
dynamicParams: {
uuid: 'uuid',
},
// name: 'ExitManageDelete',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '确定确认删除',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
// http
// .post('/api/parking_merchant/objs/gateInfo/delete', {
// uuid: record.uuid,
// })
// .then((res) => {
// mainRef.value.nsTableRef.reload();
// });
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
},
},
],
},
};
const formSchema = reactive([
{
field: 'field111',
component: 'NsChildForm',
componentProps: {
title: '用户信息',
schemas: [
{
label: '账号',
field: 'zhanghao',
component: 'NsInput',
componentProps: {
placeholder: '请输入账号',
},
rules: [
{
required: false,
message: '请输入账号',
},
],
},
{
label: '姓名',
field: 'name',
component: 'NsInput',
componentProps: {
placeholder: '请输入姓名',
},
rules: [
{
required: false,
message: '请输入姓名',
},
],
},
{
label: '性别',
field: 'sex',
component: 'NsRadioGroup',
componentProps: {
radioType: 'radio',
options: [
{ label: '男', value: 1 },
{ label: '女', value: 2 },
],
},
},
{
label: '手机号',
field: 'phone',
component: 'NsInput',
componentProps: {
placeholder: '请输入手机号',
},
rules: [
{
required: false,
message: '请输入手机号',
},
],
},
{
label: '邮箱',
field: 'email',
component: 'NsInput',
componentProps: {
placeholder: '请输入邮箱',
},
},
{
label: '组织关系',
field: 'relation',
component: 'NsSelect',
componentProps: {
placeholder: '请选择组织关系',
options: [
{
label: '正常',
value: 1,
},
{
label: '冻结',
value: 2,
},
],
},
},
],
},
},
]);
const formSchema2 = reactive([
{
field: 'information',
component: 'NsCascader',
componentProps: {
placeholder: '请选择',
options: [
{
value: 'zhejiang',
label: 'Zhejiang',
children: [
{
value: 'hangzhou',
label: 'Hangzhou',
children: [
{
value: 'xihu',
label: 'West Lake',
},
],
},
],
},
],
},
},
]);
return {
tableConfig,
tableConfig2,
data,
data2,
mainRef,
visible,
onClose,
onEdit,
formSchema,
formData,
treeData,
treeData2,
handleSelect,
handleSelect2,
searchValue,
searchValue2,
onSearch,
onSearch2,
handleOk,
handleClose,
formSchema2,
formData2,
addformvisible,
};
},
});
</script>
<style scoped>
.main {
display: flex;
flex: 1;
}
.left {
width: 400px;
/* height: 95vh; */
height: 92vh;
border-right: 5px solid rgb(229, 235, 240);
}
.top {
height: 50vh;
border-bottom: 5px solid rgb(229, 235, 240);
}
.ns-table-title {
text-align: left;
height: 46px;
line-height: 46px;
font-size: 18px;
font-weight: bold;
user-select: text;
padding-left: 16px;
width: calc(100% + 32px);
}
.table {
width: 2000px;
}
.admin {
text-align: left;
height: 42px;
line-height: 42px;
font-size: 16px;
font-weight: bold;
user-select: text;
padding-left: 16px;
width: calc(100% + 32px);
}
.form {
margin-left: 10px;
}
</style>

2
lib/component/table/use-table-column.ts

@ -33,7 +33,7 @@ export function useTableColumn({ columnActions }: any) {
if (autoMergeAction) {
const _actions = [];
const actionsLength = actions.length;
if (actionsLength > 2) {
if (actionsLength > 4) {
const moreAction = {
label: '更多',
openPermission: true,

Loading…
Cancel
Save