336 lines
7.9 KiB
TypeScript
336 lines
7.9 KiB
TypeScript
|
|
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',
|
||
|
|
};
|
||
|
|
};
|