This commit is contained in:
dinghao
2024-05-28 11:08:57 +08:00
parent d2b0a2ca06
commit de08945d49
12 changed files with 1125 additions and 476 deletions

View File

@@ -11,7 +11,7 @@
style="margin-bottom: 8px"
placeholder="请输入关联企业"
@search="onSearch" />
<a-tree :tree-data="treeData" @select="handleSelect">
<a-tree :tree-data="treeData" defaultExpandAll @select="handleSelect">
<template #title="{ title }">
{{ title }}
<!-- <span v-if="title.indexOf(searchValue) > -1">
@@ -29,7 +29,7 @@
style="margin-bottom: 8px"
placeholder="请输入关联部门"
@search="onSearch2" />
<a-tree :tree-data="treeData2" @select="handleSelect2">
<a-tree :tree-data="treeData2" defaultExpandAll @select="handleSelect2">
<template #title="{ title }">
{{ title }}
<!-- <span v-if="title.indexOf(searchValue) > -1">
@@ -48,8 +48,9 @@
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<ns-form :schemas="formSchema" :model="formData" class="form" />
<ns-form ref="formRef" :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>
@@ -74,6 +75,8 @@
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { cloneDeep } from 'lodash-es';
import { NsMessage } from '/nerv-lib/component';
import { formConfig, formConfig2 } from './config';
import { mockData, mockData2, treeData, treeData2 } from './mock';
export default defineComponent({
name: 'OrderListIndex',
setup() {
@@ -81,56 +84,21 @@
const data = reactive({});
let formData = ref({});
let formData2 = ref({});
const formRef = ref();
const visible = ref(false);
const addformvisible = ref(false);
const searchValue = ref<string>('');
const searchValue2 = ref<string>('');
const formSchema = formConfig;
const casData = ref([]);
const formSchema2 = formConfig2(casData);
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/产品部1/产品总监1',
},
]);
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' },
],
},
];
const onSearch = () => {
console.log(searchValue.value);
};
@@ -152,9 +120,11 @@
};
const onEdit = () => {
console.log(formData.value, 'formData.value');
opMap.fuc && opMap.fuc(formData.value);
visible.value = false;
formRef.value?.triggerSubmit().then(() => {
console.log(formData.value, 'formData.value');
opMap.fuc && opMap.fuc(formData.value);
visible.value = false;
});
};
const handleOk = () => {
@@ -187,7 +157,10 @@
opMap.type = 'add';
opMap.fuc = (formData: any) => {
console.log(formData, 'formData');
mockData.value.push(cloneDeep(formData));
mockData.value.push({
id: Math.random().toString().slice(2, 6),
...cloneDeep(formData),
});
};
visible.value = true;
},
@@ -219,7 +192,25 @@
confirm: true,
isReload: true,
handle: (data: any) => {
console.log(data.list);
console.log('object :>> ', data.list);
const idList = data.list.map((item) => item.id);
mockData.value.splice(0);
return;
const copyData = cloneDeep(mockData.value);
mockData.value = copyData.filter((tar) => {
return !idList.includes(tar.id);
});
console.log(mockData.value);
return;
copyData.map((item, index) => {
if (idList.includes(item.id)) {
mockData.value.filter((tar) => {
return !idList.includes(tar.id);
});
}
});
},
},
],
@@ -369,6 +360,7 @@
component: 'NsInput',
componentProps: {
placeholder: '请输入账号名',
maxLength: 30,
},
},
{
@@ -377,6 +369,7 @@
component: 'NsInput',
componentProps: {
placeholder: '请输入姓名',
maxLength: 30,
},
},
{
@@ -385,6 +378,7 @@
component: 'NsInput',
componentProps: {
placeholder: '请输入手机号',
maxLength: 11,
},
},
{
@@ -393,6 +387,7 @@
component: 'NsInput',
componentProps: {
placeholder: '请输入邮箱',
maxLength: 30,
},
},
{
@@ -401,6 +396,7 @@
component: 'NsSelect',
componentProps: {
placeholder: '请选择',
disabled: true,
options: [
{
label: '正常',
@@ -476,155 +472,13 @@
console.log(record, name, reload, 'record');
mockData2.value.splice(0, 1);
},
// 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 casData = ref([]);
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: '请选择',
displayRender: ({ labels }: any) => {
casData.value = labels;
return labels.join('/');
},
options: [
{
value: '1',
label: '铁路局',
children: [
{
value: '2',
label: '产品部',
children: [
{
value: '3',
label: '产品总监',
},
],
},
],
},
],
},
},
]);
return {
formRef,
tableConfig,
tableConfig2,
data,