feat: 补充新项目hx-op
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<a-modal title="企业信息" :width="600" v-model:visible="visible" @ok="handleOk">
|
||||
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="vertical" />
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, ref } from 'vue';
|
||||
export default defineComponent({
|
||||
name: 'AddBorderVisible',
|
||||
setup() {
|
||||
let formData = ref({});
|
||||
const formRef = ref();
|
||||
const visible = ref(false);
|
||||
const toggle = () => {
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
const formSchema = reactive([
|
||||
{
|
||||
field: 'name',
|
||||
label: '企业名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入企业名称',
|
||||
maxLength: 20,
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入企业名称',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'Isshare',
|
||||
label: '点位数据',
|
||||
component: 'NsRadioGroup',
|
||||
componentProps: {
|
||||
radioType: 'radio',
|
||||
options: [
|
||||
{ label: '分享', value: 1 },
|
||||
{ label: '不分享', value: 2 },
|
||||
],
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择是否分享',
|
||||
type: 'number',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
const handleOk = () => {
|
||||
formRef.value?.triggerSubmit().then(() => {
|
||||
toggle();
|
||||
});
|
||||
};
|
||||
return { handleOk, formData, formSchema, visible, toggle, formRef };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
// :deep(.ns-child-form) {
|
||||
// width: 1100px !important;
|
||||
// justify-content: flex-start !important;
|
||||
// }
|
||||
// :deep(.ant-input-group-addon) {
|
||||
// border: 0px solid #dcdfe2 !important;
|
||||
// }
|
||||
</style>
|
335
hx-op/src/view/organizationManage/enterpriseManage/config.ts
Normal file
335
hx-op/src/view/organizationManage/enterpriseManage/config.ts
Normal file
@@ -0,0 +1,335 @@
|
||||
import { mockData } from './mock';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { enterPrise } from '/@/api/origanizemanage';
|
||||
|
||||
export const formConfig = [
|
||||
{
|
||||
field: 'zuzhi',
|
||||
label: '组织ID',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入组织ID',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入组织编号',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'jituanname',
|
||||
label: '企业名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入企业名称',
|
||||
maxLength: 20,
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入企业名称',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'jituanname',
|
||||
label: '集团名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入集团名称',
|
||||
maxLength: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'cityName',
|
||||
label: '省市区',
|
||||
component: 'NsInputCity',
|
||||
defaultValue: '',
|
||||
fieldMap: ['provinceName', 'cityName', 'areaName', 'province', 'city', 'area'],
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
api: '/api/parking_merchant/objs/BaseArea',
|
||||
isSeparate: true,
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择区域',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'address',
|
||||
label: '地址',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入地址',
|
||||
maxLength: 50,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'person',
|
||||
label: '联系人',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入联系人',
|
||||
maxLength: 10,
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入联系人',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
label: '联系电话',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入联系电话',
|
||||
maxLength: 11,
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export const tableConfig = (visible) => {
|
||||
return {
|
||||
// title: '企业管理',
|
||||
api: enterPrise.list,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'RoleTypeAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
opMap.type = 'add';
|
||||
opMap.fuc = (formData: any) => {
|
||||
console.log(formData, 'formData');
|
||||
mockData.value.push({
|
||||
id: Math.random().toString().slice(2, 6),
|
||||
...cloneDeep(formData),
|
||||
});
|
||||
};
|
||||
visible.value = true;
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
rowSelection: null,
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'address',
|
||||
width: 80,
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '组织ID',
|
||||
dataIndex: 'orgCode',
|
||||
},
|
||||
{
|
||||
title: '集团名称',
|
||||
dataIndex: 'intro',
|
||||
},
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'orgName',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
},
|
||||
{
|
||||
title: '省市区',
|
||||
dataIndex: 'area',
|
||||
customRender: ({ record }) => {
|
||||
const { province = '', city = '', county = '' } = record;
|
||||
return `${province}/${city}/${county}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '地址',
|
||||
dataIndex: 'address',
|
||||
},
|
||||
{
|
||||
title: '联系人',
|
||||
dataIndex: 'person',
|
||||
},
|
||||
{
|
||||
title: '联系电话',
|
||||
dataIndex: 'phone',
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'RoleTypeEdit',
|
||||
handle: (record: any) => {
|
||||
console.log(record, 'record');
|
||||
formData.value = record;
|
||||
opMap.type = 'edit';
|
||||
opMap.fuc = (formData: any) => {
|
||||
Object.assign(mockData.value.filter((item) => item.id === record.id)[0], formData);
|
||||
};
|
||||
visible.value = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '组织边界',
|
||||
handle: (record: any) => {
|
||||
console.log(record, 'record');
|
||||
borderVisible.value = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '服务',
|
||||
handle: (record: any) => {
|
||||
console.log(record, 'record');
|
||||
serviceVisible.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() {
|
||||
NsMessage.success('冻结成功');
|
||||
},
|
||||
class: 'test',
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '重置密码',
|
||||
name: 'RoleTypeEdit',
|
||||
handle: (record: any) => {
|
||||
console.log(record, 'record');
|
||||
Modal.confirm({
|
||||
title: '重置密码',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
okText: '重置',
|
||||
content: h('div', {}, [
|
||||
h('p', `企业名称: ${record.jituanname}`),
|
||||
h('p', '管理员账号: hxdtadmin'),
|
||||
]),
|
||||
onOk() {
|
||||
Modal.confirm({
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认重置该企业管理员密码',
|
||||
onOk() {
|
||||
Modal.success({
|
||||
okText: '确认',
|
||||
content: h('div', {}, [
|
||||
h('p', '重置成功'),
|
||||
h('p', '点击【确认】后自动复制密码并离开'),
|
||||
]),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
class: 'test',
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'RoleTypeEdit',
|
||||
dynamicParams: 'orgId',
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
api: enterPrise.del,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'zuzhibianhao',
|
||||
label: '组织ID',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
maxLength: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'jituanname',
|
||||
label: '集团名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
maxLength: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'zuzhiname',
|
||||
label: '组织名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
maxLength: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
label: '状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '正常',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '冻结',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'cityName',
|
||||
label: '城市地区',
|
||||
component: 'NsInputCity',
|
||||
defaultValue: '',
|
||||
fieldMap: ['provinceName', 'cityName', 'areaName', 'province', 'city', 'area'],
|
||||
componentProps: {
|
||||
api: '/api/parking_merchant/objs/BaseArea',
|
||||
isSeparate: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
params: {},
|
||||
},
|
||||
// pagination: { defaultPageSize: 10 },
|
||||
rowKey: 'id',
|
||||
};
|
||||
};
|
175
hx-op/src/view/organizationManage/enterpriseManage/index.vue
Normal file
175
hx-op/src/view/organizationManage/enterpriseManage/index.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" rowKey="uuid" />
|
||||
<a-drawer
|
||||
:width="600"
|
||||
:visible="visible"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
@close="onClose">
|
||||
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="vertical" />
|
||||
<template #footer>
|
||||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
||||
</template>
|
||||
</a-drawer>
|
||||
<a-drawer
|
||||
:width="600"
|
||||
:visible="borderVisible"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
@close="onClose">
|
||||
<a-button type="primary" @click="borderAdd">新增</a-button>
|
||||
<a-button type="primary" style="margin-left: 10px; margin-bottom: 10px" @click="borderAddSon"
|
||||
>新增子集</a-button
|
||||
>
|
||||
<a-directory-tree @select="handleSelect" multiple :tree-data="treeData">
|
||||
<template #title="{ title, key }">
|
||||
{{ title }}
|
||||
<a-button type="link" @click="editTree(title, key)">编辑</a-button>
|
||||
<a-button type="link" danger @click="deleteTree(title, key)">删除</a-button>
|
||||
</template>
|
||||
</a-directory-tree>
|
||||
</a-drawer>
|
||||
|
||||
<a-drawer
|
||||
:width="600"
|
||||
:visible="serviceVisible"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
@close="onClose">
|
||||
<a-input-search
|
||||
placeholder="请选择开通模块"
|
||||
v-model:value="searchValue"
|
||||
style="margin-bottom: 8px"
|
||||
@search="onSearch" />
|
||||
<a-tree
|
||||
:tree-data="treeData"
|
||||
v-model:checkedKeys="checkedKeys"
|
||||
checkable
|
||||
@select="ServiceSelect">
|
||||
<template #title="{ title }">
|
||||
{{ title }}
|
||||
</template>
|
||||
</a-tree>
|
||||
<ns-button style="margin: 20px" type="primary" @click="onClose">取消</ns-button>
|
||||
<ns-button type="primary" @click="Sure">确定</ns-button>
|
||||
</a-drawer>
|
||||
|
||||
<TreeAdd ref="treeAdd" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { computed, createVNode, defineComponent, reactive, ref, watch } from 'vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import TreeAdd from './TreeAdd.vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { h } from 'vue';
|
||||
import { formConfig } from './config';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { mockData, treeData } from './mock';
|
||||
import { enterPrise } from '/@/api/origanizemanage';
|
||||
import { tableConfig as insertConfig } from './config';
|
||||
defineOptions({
|
||||
name: 'EnterpriseManageIndex',
|
||||
});
|
||||
|
||||
const data = reactive({});
|
||||
const treeAdd = ref();
|
||||
const mainRef = ref();
|
||||
let formData = ref({});
|
||||
const formRef = ref();
|
||||
const searchValue = ref<string>('');
|
||||
const checkedKeys = ref<string[]>([]);
|
||||
const visible = ref(false);
|
||||
const borderVisible = ref(false);
|
||||
const serviceVisible = ref(false);
|
||||
const treeAddVisible = ref(false);
|
||||
const formSchema = formConfig;
|
||||
const tableConfig = computed(() => {
|
||||
return insertConfig(visible);
|
||||
});
|
||||
const opMap: any = {
|
||||
type: 'add',
|
||||
fuc: () => {},
|
||||
record: {},
|
||||
};
|
||||
|
||||
watch(checkedKeys, () => {
|
||||
console.log('checkedKeys', checkedKeys.value);
|
||||
});
|
||||
|
||||
const handleSelect = (selectedKeys: any, info: any) => {
|
||||
console.log(selectedKeys, 'selectedKeys');
|
||||
console.log(info, 'info');
|
||||
};
|
||||
|
||||
const ServiceSelect = (selectedKeys: any, info: any) => {
|
||||
console.log(selectedKeys, 'selectedKeys');
|
||||
console.log(info, 'info');
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
visible.value = false;
|
||||
borderVisible.value = false;
|
||||
serviceVisible.value = false;
|
||||
};
|
||||
|
||||
const borderAdd = () => {
|
||||
treeAddVisible.value = true;
|
||||
treeAdd.value?.toggle();
|
||||
};
|
||||
|
||||
const borderAddSon = () => {
|
||||
treeAddVisible.value = true;
|
||||
};
|
||||
|
||||
const onEdit = () => {
|
||||
formRef.value?.triggerSubmit().then(() => {
|
||||
console.log(formData.value, 'formData.value');
|
||||
opMap.fuc && opMap.fuc(formData.value);
|
||||
visible.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const Sure = () => {
|
||||
serviceVisible.value = false;
|
||||
};
|
||||
|
||||
const editTree = (title: any, key: any) => {
|
||||
console.log(title, 'title');
|
||||
console.log(key, 'key');
|
||||
};
|
||||
|
||||
const deleteTree = (title: any, key: any) => {
|
||||
console.log(title, 'title');
|
||||
console.log(key, 'key');
|
||||
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 onSearch = () => {
|
||||
console.log(searchValue.value);
|
||||
};
|
||||
</script>
|
43
hx-op/src/view/organizationManage/enterpriseManage/mock.ts
Normal file
43
hx-op/src/view/organizationManage/enterpriseManage/mock.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
export const mockData = ref([
|
||||
{
|
||||
id: 3,
|
||||
zuzhi: '22',
|
||||
jituanname: 'axb',
|
||||
zuzhiname: '张三',
|
||||
status: '男',
|
||||
area: '123456789',
|
||||
address: '1234567889',
|
||||
person: '1',
|
||||
phone: '1',
|
||||
},
|
||||
]);
|
||||
|
||||
export const mockData2 = ref([
|
||||
{
|
||||
information: '铁路局1/产品部1/产品总监1',
|
||||
},
|
||||
]);
|
||||
|
||||
export const treeData = ref([
|
||||
{
|
||||
title: '铁路总局',
|
||||
key: '0-0',
|
||||
children: [
|
||||
{ title: '济阳站', key: '0-0-0' },
|
||||
{ title: '临沂站', key: '0-0-1' },
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
export const treeData2 = [
|
||||
{
|
||||
title: '全部',
|
||||
key: '0-0',
|
||||
children: [
|
||||
{ title: '产品部', key: '0-0-0' },
|
||||
{ title: '运维部', key: '0-0-1' },
|
||||
],
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user