Browse Source

tijiao

main
dinghao 6 months ago
parent
commit
51d9fb84e5
  1. 274
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue

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

@ -1,27 +1,115 @@
<!-- @format --> <!-- @format -->
<template> <template>
<div class="main">
<div class="left">
<div class="top">
<div class="ns-table-title">关联企业</div>
<div>
<a-input-search
v-model:value="searchValue"
style="margin-bottom: 8px"
placeholder="请输入关联企业"
@search="onSearch" />
<a-tree :tree-data="treeData" @select="handleSelect">
<template #title="{ title }">
{{ title }}
<!-- <span v-if="title.indexOf(searchValue) > -1">
{{ title.substring(0, title.indexOf(searchValue)) }}
</span>
<span v-else>{{ title }}</span> -->
</template>
</a-tree>
</div>
</div>
<div class="ns-table-title">关联部门</div>
<div>
<a-input-search
v-model:value="searchValue2"
style="margin-bottom: 8px"
placeholder="请输入关联部门"
@search="onSearch2" />
<a-tree :tree-data="treeData2" @select="handleSelect2">
<template #title="{ title }">
{{ title }}
<!-- <span v-if="title.indexOf(searchValue) > -1">
{{ title.substring(0, title.indexOf(searchValue)) }}
</span>
<span v-else>{{ title }}</span> -->
</template>
</a-tree>
</div>
</div>
<div class="right">
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" class="table" />
</div>
</div>
<a-drawer
:width="1200"
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
@close="onClose">
<ns-form :schemas="formSchema" :model="formData" class="form" />
<span class="admin">用户权限</span>
<ns-view-list-table v-bind="tableConfig2" :model="data" ref="mainRef" rowKey="uuid" />
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onEdit">确定</a-button>
</a-drawer>
<a-modal
title="用户信息"
:width="600"
:visible="addformvisible"
cancelText="取消"
@ok="handleOk"
@cancel="handleClose">
<ns-form :schemas="formSchema2" :model="formData2" />
</a-modal>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { createVNode, defineComponent, reactive, ref } from 'vue'; import { createVNode, defineComponent, reactive, ref } from 'vue';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { cloneDeep } from 'lodash-es';
import { NsMessage } from '/nerv-lib/component';
export default defineComponent({ export default defineComponent({
name: 'OrderListIndex', name: 'OrderListIndex',
setup() { setup() {
const mainRef = ref(); const mainRef = ref();
const data = reactive({}); const data = reactive({});
const data2 = reactive([ let formData = ref({});
{ let formData2 = ref({});
userinformation: 1,
},
]);
const visible = ref(false); const visible = ref(false);
const addformvisible = ref(false);
const searchValue = ref<string>(''); const searchValue = ref<string>('');
const searchValue2 = ref<string>(''); const searchValue2 = ref<string>('');
const addformvisible = ref(false); const opMap: any = {
type: 'add',
fuc: () => {},
record: {},
};
const mockData = ref([
{
id: 3,
zhanghao: 'axb',
name: '张三',
sex: '男',
phone: '123456789',
email: '1234567889',
relation: '1',
role: '1',
status: '1',
},
]);
const mockData2 = ref([
{
information: '1',
},
]);
const treeData = [ const treeData = [
{ {
title: '铁路总局', title: '铁路总局',
@ -43,14 +131,6 @@
}, },
]; ];
let formData = reactive({
name: '',
zhanghao: '',
});
let formData2 = reactive({
information: '',
});
const onSearch = () => { const onSearch = () => {
console.log(searchValue.value); console.log(searchValue.value);
}; };
@ -70,12 +150,14 @@
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
}; };
const onEdit = () => { const onEdit = () => {
console.log(formData, 'formData'); opMap.fuc && opMap.fuc(formData.value);
visible.value = false; visible.value = false;
}; };
const handleOk = () => { const handleOk = () => {
opMap.fuc && opMap.fuc(formData2.value);
addformvisible.value = false; addformvisible.value = false;
}; };
const handleClose = () => { const handleClose = () => {
@ -84,10 +166,11 @@
const tableConfig = { const tableConfig = {
// title: '', // title: '',
api: { // api: {
url: '/carbon_emission/device/getGatewayList', // url: '/carbon_emission/device/getGatewayList',
method: 'post', // method: 'post',
}, // },
value: mockData.value,
listField: 'data.records', listField: 'data.records',
headerActions: [ headerActions: [
{ {
@ -95,6 +178,11 @@
name: 'RoleTypeAdd', name: 'RoleTypeAdd',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
opMap.type = 'add';
opMap.fuc = (formData: any) => {
console.log(formData, 'formData');
mockData.value.push(cloneDeep(formData));
};
visible.value = true; visible.value = true;
}, },
}, },
@ -113,8 +201,7 @@
{ {
label: '导出', label: '导出',
type: 'primary', type: 'primary',
name: 'RoleTypeAdd', name: 'exports',
handle: () => {},
}, },
{ {
label: '批量删除', label: '批量删除',
@ -195,8 +282,14 @@
// dynamicParams: 'uuid', // dynamicParams: 'uuid',
handle: (record: any) => { handle: (record: any) => {
console.log(record, 'record'); console.log(record, 'record');
formData.name = record.name; formData.value = record;
formData.zhanghao = record.zhanghao; opMap.type = 'edit';
opMap.fuc = (formData: any) => {
Object.assign(
mockData.value.filter((item) => item.id === record.id)[0],
formData,
);
};
visible.value = true; visible.value = true;
}, },
}, },
@ -217,6 +310,7 @@
// .then((res) => { // .then((res) => {
// mainRef.value.nsTableRef.reload(); // mainRef.value.nsTableRef.reload();
// }); // });
NsMessage.success('冻结成功');
}, },
onCancel() { onCancel() {
console.log('Cancel'); console.log('Cancel');
@ -235,9 +329,10 @@
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''), content: createVNode('div', { style: 'color:red;' }, ''),
onOk() { onOk() {
Modal.success({ // Modal.success({
title: '密码重置成功,初始密码123456', // title: ',123456',
}); // });
NsMessage.success('密码重置成功,初始密码123456');
}, },
onCancel() { onCancel() {
console.log('Cancel'); console.log('Cancel');
@ -252,27 +347,10 @@
dynamicParams: { dynamicParams: {
uuid: 'uuid', uuid: 'uuid',
}, },
// name: 'ExitManageDelete', confirm: true,
handle: (record: any) => { handle: (record: any, name, reload) => {
console.log(record, 'record'); console.log(record, name, reload, 'record');
Modal.confirm({ mockData.value.splice(0, 1);
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',
});
}, },
}, },
], ],
@ -334,13 +412,14 @@
params: {}, params: {},
}, },
// pagination: { defaultPageSize: 10 }, // pagination: { defaultPageSize: 10 },
rowKey: 'uuid', rowKey: 'id',
}; };
const tableConfig2 = { const tableConfig2 = {
api: { // api: {
url: '/carbon_emission/device/getGatewayList', // url: '/carbon_emission/device/getGatewayList',
method: 'post', // method: 'post',
}, // },
value: mockData2.value,
listField: 'data.records', listField: 'data.records',
rowSelection: null, rowSelection: null,
headerActions: [ headerActions: [
@ -349,6 +428,11 @@
name: 'RoleTypeAdd', name: 'RoleTypeAdd',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
opMap.type = 'add';
opMap.fuc = (formData2: any) => {
console.log(formData2, 'formData2');
mockData2.value.push(cloneDeep(formData2));
};
addformvisible.value = true; addformvisible.value = true;
}, },
}, },
@ -356,7 +440,7 @@
columns: [ columns: [
{ {
title: '角色信息', title: '角色信息',
dataIndex: 'name', dataIndex: 'information',
}, },
], ],
columnActions: { columnActions: {
@ -368,10 +452,15 @@
// dynamicParams: 'uuid', // dynamicParams: 'uuid',
handle: (record: any) => { handle: (record: any) => {
console.log(record, 'record'); console.log(record, 'record');
formData2.value = record;
opMap.type = 'edit';
opMap.fuc = (formData2: any) => {
Object.assign(
mockData.value.filter((item) => item.id === record.id)[0],
formData2,
);
};
addformvisible.value = true; addformvisible.value = true;
// formData.name = record.name;
// formData.zhanghao = record.zhanghao;
// visible.value = true;
}, },
}, },
{ {
@ -380,28 +469,30 @@
dynamicParams: { dynamicParams: {
uuid: 'uuid', uuid: 'uuid',
}, },
// name: 'ExitManageDelete', confirm: true,
handle: (record: any) => { handle: (record: any, name, reload) => {
console.log(record, 'record'); console.log(record, name, reload, 'record');
Modal.confirm({ mockData2.value.splice(0, 1);
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',
});
}, },
// 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',
// });
}, },
], ],
}, },
@ -507,15 +598,15 @@
options: [ options: [
{ {
value: 'zhejiang', value: 'zhejiang',
label: 'Zhejiang', label: '铁路局',
children: [ children: [
{ {
value: 'hangzhou', value: 'hangzhou',
label: 'Hangzhou', label: '铁路局1',
children: [ children: [
{ {
value: 'xihu', value: 'xihu',
label: 'West Lake', label: '铁路局2',
}, },
], ],
}, },
@ -530,26 +621,25 @@
tableConfig, tableConfig,
tableConfig2, tableConfig2,
data, data,
data2,
mainRef, mainRef,
visible, visible,
onClose, addformvisible,
onEdit,
formSchema, formSchema,
formSchema2,
formData, formData,
formData2,
treeData, treeData,
treeData2, treeData2,
handleSelect,
handleSelect2,
searchValue, searchValue,
searchValue2, searchValue2,
handleSelect,
handleSelect2,
onClose,
onEdit,
onSearch, onSearch,
onSearch2, onSearch2,
handleOk, handleOk,
handleClose, handleClose,
formSchema2,
formData2,
addformvisible,
}; };
}, },
}); });
@ -562,11 +652,11 @@
.left { .left {
width: 400px; width: 400px;
/* height: 95vh; */ /* height: 95vh; */
height: 92vh; height: 92.7vh;
border-right: 5px solid rgb(229, 235, 240); border-right: 5px solid rgb(229, 235, 240);
} }
.top { .top {
height: 50vh; height: 46vh;
border-bottom: 5px solid rgb(229, 235, 240); border-bottom: 5px solid rgb(229, 235, 240);
} }
.ns-table-title { .ns-table-title {
@ -577,7 +667,7 @@
font-weight: bold; font-weight: bold;
user-select: text; user-select: text;
padding-left: 16px; padding-left: 16px;
width: calc(100% + 32px); width: 100%;
} }
.table { .table {
width: 2000px; width: 2000px;

Loading…
Cancel
Save