Initial commit

This commit is contained in:
南宁网宿科技
2023-06-03 23:57:39 +08:00
commit 13bed2bafb
1017 changed files with 175796 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,138 @@
<template>
<ele-modal
:width="750"
:visible="visible"
:maskClosable="false"
:title="title"
:footer="null"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
>
<ele-pro-table
ref="tableRef"
row-key="userId"
:datasource="datasource"
:columns="columns"
:customRow="customRow"
:pagination="false"
>
<template #toolbar>
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入搜索关键词"
style="width: 200px"
@search="reload"
@pressEnter="reload"
/>
</template>
<template #bodyCell="{ column }">
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link">选择</a-button>
</a-space>
</template>
</template>
</ele-pro-table>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import {
ColumnItem,
DatasourceFunction
} from 'ele-admin-pro/es/ele-pro-table/types';
import { pageUsers } from '@/api/system/user';
import { User, UserParam } from '@/api/system/user/model';
import { EleProTable } from 'ele-admin-pro';
defineProps<{
// 弹窗是否打开
visible: boolean;
title?: string;
// 修改回显的数据
data?: User | null;
}>();
const emit = defineEmits<{
(e: 'done', data: User): void;
(e: 'update:visible', visible: boolean): void;
}>();
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 搜索内容
const searchText = ref(null);
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格配置
const columns = ref<ColumnItem[]>([
{
key: 'index',
width: 48,
align: 'center',
fixed: 'left',
hideInSetting: true,
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
},
{
title: '姓名',
dataIndex: 'nickname'
},
{
title: '联系电话',
dataIndex: 'phone',
key: 'phone'
},
{
title: '所属部门',
dataIndex: 'organizationName'
},
{
title: '操作',
key: 'action',
align: 'center',
hideInSetting: true
}
]);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where = {};
// 搜索条件
if (searchText.value) {
where.keywords = searchText.value;
}
where.isStaff = true;
return pageUsers({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: UserParam) => {
// selection.value = [];
tableRef?.value?.reload({ page: 1, where });
};
/* 自定义行属性 */
const customRow = (record: User) => {
return {
// 行点击事件
onClick: () => {
updateVisible(false);
emit('done', record);
}
};
};
</script>
<style lang="less"></style>
@@ -0,0 +1,138 @@
<template>
<ele-modal
:width="750"
:visible="visible"
:maskClosable="false"
:title="title"
:footer="null"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
>
<ele-pro-table
ref="tableRef"
row-key="userId"
:datasource="datasource"
:columns="columns"
:customRow="customRow"
:pagination="false"
>
<template #toolbar>
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入搜索关键词"
style="width: 200px"
@search="reload"
@pressEnter="reload"
/>
</template>
<template #bodyCell="{ column }">
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link">选择</a-button>
</a-space>
</template>
</template>
</ele-pro-table>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import {
ColumnItem,
DatasourceFunction
} from 'ele-admin-pro/es/ele-pro-table/types';
import { pageUsers } from '@/api/system/user';
import { User, UserParam } from '@/api/system/user/model';
import { EleProTable } from 'ele-admin-pro';
defineProps<{
// 弹窗是否打开
visible: boolean;
title?: string;
// 修改回显的数据
data?: User | null;
}>();
const emit = defineEmits<{
(e: 'done', data: User): void;
(e: 'update:visible', visible: boolean): void;
}>();
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 搜索内容
const searchText = ref(null);
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格配置
const columns = ref<ColumnItem[]>([
{
key: 'index',
width: 48,
align: 'center',
fixed: 'left',
hideInSetting: true,
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
},
{
title: '姓名',
dataIndex: 'nickname'
},
{
title: '联系电话',
dataIndex: 'phone',
key: 'phone'
},
{
title: '所属部门',
dataIndex: 'organizationName'
},
{
title: '操作',
key: 'action',
align: 'center',
hideInSetting: true
}
]);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where = {};
// 搜索条件
if (searchText.value) {
where.keywords = searchText.value;
}
where.isStaff = true;
return pageUsers({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: UserParam) => {
// selection.value = [];
tableRef?.value?.reload({ page: 1, where });
};
/* 自定义行属性 */
const customRow = (record: User) => {
return {
// 行点击事件
onClick: () => {
updateVisible(false);
emit('done', record);
}
};
};
</script>
<style lang="less"></style>
@@ -0,0 +1,61 @@
<template>
<div>
<a-input-group compact>
<a-input
disabled
style="width: calc(100% - 32px)"
v-model:value="value"
:placeholder="placeholder"
/>
<a-button @click="openEdit">
<template #icon><BulbOutlined class="ele-text-warning" /></template>
</a-button>
</a-input-group>
<!-- 选择弹窗 -->
<select-data
v-model:visible="showEdit"
:data="current"
:title="placeholder"
@done="onChange"
/>
</div>
</template>
<script lang="ts" setup>
import { BulbOutlined } from '@ant-design/icons-vue';
import { ref } from 'vue';
import SelectData from './components/select-data.vue';
import { User } from '@/api/system/user/model';
withDefaults(
defineProps<{
value?: any;
placeholder?: string;
}>(),
{
placeholder: '请选择数据'
}
);
const emit = defineEmits<{
(e: 'done', User): void;
(e: 'clear'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
// 当前编辑数据
const current = ref<User | null>(null);
/* 打开编辑弹窗 */
const openEdit = (row?: User) => {
current.value = row ?? null;
showEdit.value = true;
};
const onChange = (row) => {
emit('done', row);
};
// 查询租户列表
// const appList = ref<App[] | undefined>([]);
</script>
+129
View File
@@ -0,0 +1,129 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>
<span>添加应用</span>
</a-button>
<a-button
danger
type="primary"
class="ele-btn-icon"
:disabled="selection.length === 0"
@click="removeBatch"
>
<template #icon>
<DeleteOutlined />
</template>
<span>批量删除</span>
</a-button>
<a-radio-group v-model:value="where.appStatus" @change="handleSearch">
<a-radio-button value="开发中">开发中</a-radio-button>
<a-radio-button value="运行中">运行中</a-radio-button>
<a-radio-button value="维护中">维护中</a-radio-button>
<a-radio-button value="已下架">已下架</a-radio-button>
</a-radio-group>
<SelectCompany
:placeholder="`请选择业主单位`"
v-model:value="where.companyName"
@done="chooseCompanyName"
/>
<SelectCompany
:placeholder="`请选择开发商`"
v-model:value="where.developer"
@done="chooseDeveloper"
/>
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="where.keywords"
@pressEnter="search"
@search="search"
/>
<a-button @click="reset">重置</a-button>
</a-space>
</template>
<script lang="ts" setup>
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons-vue';
import useSearch from '@/utils/use-search';
import { ref, watch } from 'vue';
import { AppParam } from '@/api/oa/app/model';
import { Company } from "@/api/system/company/model";
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
}>(),
{}
);
const emit = defineEmits<{
(e: 'search', where?: AppParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'advanced'): void;
}>();
// 表单数据
const { where, resetFields } = useSearch<AppParam>({
appId: undefined,
userId: undefined,
appStatus: '',
companyId: undefined,
companyName: '',
keywords: ''
});
// 下来选项
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
/* 搜索 */
const search = () => {
const [d1, d2] = dateRange.value ?? [];
emit('search', {
...where,
createTimeStart: d1 ? d1 + ' 00:00:00' : '',
createTimeEnd: d2 ? d2 + ' 23:59:59' : ''
});
};
// 发布应用
const add = () => {
emit('add');
};
// 批量删除
const removeBatch = () => {
emit('remove');
};
const chooseCompanyName = (data: Company) => {
where.companyName = data.companyName;
where.companyId = data.companyId;
emit('search', where);
};
const chooseDeveloper = (data: Company) => {
where.developer = data.companyName;
emit('search', where);
};
const handleSearch = () => {
emit('search', where);
};
/* 重置 */
const reset = () => {
resetFields();
search();
};
watch(
() => props.selection,
() => {}
);
</script>
+339
View File
@@ -0,0 +1,339 @@
<template>
<div class="page">
<div class="ele-body">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="appId"
:columns="columns"
:datasource="datasource"
v-model:selection="selection"
:customRow="customRow"
tool-class="ele-toolbar-form"
:scroll="{ x: 1200 }"
class="sys-org-table"
:striped="true"
>
<template #toolbar>
<search
@search="reload"
:selection="selection"
@add="openEdit"
@remove="removeBatch"
@advanced="openAdvanced"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'appName'">
<div class="app-box">
<a-image
:height="45"
:width="45"
:preview="false"
:src="FILE_THUMBNAIL + record.appIcon"
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
/>
<div class="app-info">
<a class="ele-text-heading" @click="openEdit(record)">
{{ record.appName }}
</a>
<span class="ele-text-placeholder">
{{ record.companyName }}
</span>
</div>
</div>
</template>
<template v-if="column.key === 'appCode'">
<span class="ele-text-placeholder">{{ record.appCode }}</span>
</template>
<template v-if="column.key === 'appStatus'">
<a-tag v-if="record.appStatus === '开发中'" color="red">{{
record.appStatus
}}</a-tag>
<a-tag v-if="record.appStatus === '运行中'" color="success">{{
record.appStatus
}}</a-tag>
<a-tag v-if="record.appStatus === '维护中'" color="orange">{{
record.appStatus
}}</a-tag>
<a-tag v-if="record.appStatus === '已下架'">{{
record.appStatus
}}</a-tag>
</template>
<template v-if="column.key === 'appUrl'">
<a-tooltip v-if="record.appUrl" :title="record.appUrl">
<a @click="openUrl(record.appUrl)">前往</a>
</a-tooltip>
</template>
<template v-if="column.key === 'appTypeMultiple'">
<a-space
:size="2"
direction="vertical"
v-if="record.appTypeMultiple"
>
<a-tag
v-for="(item, index) in JSON.parse(record.appTypeMultiple)"
:key="index"
class="ele-text-placeholder"
>{{ item }}</a-tag
>
</a-space>
</template>
<template v-if="column.key === 'appQrcode'">
<a-image
v-if="record.appQrcode"
:height="45"
:width="45"
:src="record.appQrcode"
/>
</template>
<template v-if="column.key === 'createTime'">
{{ record.createTime }}
</template>
<template v-if="column.key === 'action'">
<a-space>
<a-button @click="openEdit(record)">管理</a-button>
</a-space>
</template>
</template>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
<AppEdit v-model:visible="showEdit" :data="current" @done="reload" />
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { openUrl } from '@/utils/common';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import AppEdit from './components/app-edit.vue';
import { FILE_THUMBNAIL } from '@/config/setting';
import { pageApp, removeBatchApp, removeApp } from '@/api/oa/app';
import { App, AppParam } from '@/api/oa/app/model';
defineProps<{
activeKey?: boolean;
data?: any;
}>();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格列配置
const columns = ref<ColumnItem[]>([
{
key: 'index',
width: 48,
align: 'center',
fixed: 'left',
hideInSetting: true,
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
},
{
title: '应用ID',
dataIndex: 'appId',
width: 100,
key: 'appId'
},
{
title: '应用名称',
dataIndex: 'appName',
width: 360,
key: 'appName'
},
{
title: '应用标识',
dataIndex: 'appCode',
key: 'appCode'
},
{
title: '应用类型',
dataIndex: 'appTypeMultiple',
key: 'appTypeMultiple'
},
{
title: '应用状态',
dataIndex: 'appStatus',
key: 'appStatus'
},
{
title: '应用地址',
dataIndex: 'appUrl',
key: 'appUrl'
},
{
title: '二维码',
dataIndex: 'appQrcode',
key: 'appQrcode'
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime'
},
{
title: '操作',
key: 'action',
width: 120,
align: 'center',
fixed: 'right',
hideInSetting: true
}
]);
// 表格选中数据
const selection = ref<App[]>([]);
// 当前编辑数据
const current = ref<App | null>(null);
// 是否显示资产详情
const showInfo = ref(false);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示高级搜索
const showAdvancedSearch = ref(false);
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
// 搜索条件
return pageApp({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: AppParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: App) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 打开用户详情弹窗 */
const openInfo = (row?: App) => {
current.value = row ?? null;
showInfo.value = true;
};
/* 打开高级搜索 */
const openAdvanced = () => {
showAdvancedSearch.value = !showAdvancedSearch.value;
};
/* 删除单个 */
const remove = (row: App) => {
const hide = message.loading('请求中..', 0);
removeApp(row.appId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
console.log(selection.value);
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchApp(selection.value.map((d) => d.appId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 自定义行属性 */
const customRow = (record: App) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
};
reload();
</script>
<script lang="ts">
export default {
name: 'AppIndex'
};
</script>
<style lang="less" scoped>
p {
line-height: 0.8;
}
.sys-org-table :deep(.ant-table-body) {
overflow: auto !important;
overflow: overlay !important;
}
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
padding: 0 4px;
margin-bottom: 0;
}
.price-edit {
padding-right: 5px;
}
.comments {
max-width: 200px;
}
.app-box {
display: flex;
.app-info {
display: flex;
margin-left: 15px;
margin-right: 15px;
flex-direction: column;
}
}
</style>