Initial commit

This commit is contained in:
南宁网宿科技
2024-04-24 16:36:46 +08:00
commit 121348e011
991 changed files with 158700 additions and 0 deletions

View File

@@ -0,0 +1,166 @@
<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="appId"
:columns="columns"
:customRow="customRow"
:datasource="datasource"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
<template #toolbar>
<a-space>
<a-input-search
allow-clear
v-model:value="where.appName"
placeholder="请输入搜索关键词"
style="width: 200px"
@search="reload"
@pressEnter="reload"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'appName'">
<div class="app-box">
<a-image
:height="45"
:width="45"
:preview="false"
:src="record.appIcon"
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
/>
<div class="app-info">
<a class="ele-text-heading">
{{ record.appName }}
</a>
<span class="ele-text-placeholder">
{{ record.companyName }}
</span>
</div>
</div>
</template>
<template v-if="column.key === 'action'">
<a-radio @click="onDone(record)" />
<span class="ele-text-secondary">选择</span>
</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 { App, AppParam } from '@/api/oa/app/model';
import { EleProTable } from 'ele-admin-pro';
import useSearch from '@/utils/use-search';
import { pageApp } from '@/api/oa/app';
defineProps<{
// 弹窗是否打开
visible: boolean;
title?: any;
// 修改回显的数据
data?: App | null;
}>();
const emit = defineEmits<{
(e: 'done', data: App): void;
(e: 'update:visible', visible: boolean): void;
}>();
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单数据
const { where } = useSearch<AppParam>({
appId: undefined,
appName: undefined,
nickname: '',
keywords: ''
});
// 表格实例
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: 'appName',
key: 'appName'
},
{
title: '操作',
key: 'action',
align: 'center',
hideInSetting: true
}
]);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
return pageApp({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = () => {
// selection.value = [];
tableRef?.value?.reload({ page: 1, where });
};
const onDone = (record: App) => {
updateVisible(false);
emit('done', record);
};
/* 自定义行属性 */
const customRow = (record: App) => {
return {
// 行点击事件
onClick: () => {
updateVisible(false);
emit('done', record);
}
};
};
</script>
<style lang="less">
.app-box {
display: flex;
.app-info {
display: flex;
margin-left: 15px;
margin-right: 15px;
flex-direction: column;
}
}
</style>

View File

@@ -0,0 +1,63 @@
<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 { App } from '@/api/oa/app/model';
const props = withDefaults(
defineProps<{
value?: any;
placeholder?: string;
index?: number;
}>(),
{
placeholder: '请选择项目'
}
);
const emit = defineEmits<{
(e: 'done', App): void;
(e: 'clear'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
// 当前编辑数据
const current = ref<App | null>(null);
/* 打开编辑弹窗 */
const openEdit = (row?: App) => {
current.value = row ?? null;
showEdit.value = true;
};
const onChange = (row) => {
row.index = Number(props.index);
emit('done', row);
};
// 查询租户列表
// const appList = ref<App[] | undefined>([]);
</script>