完成合同管理模块和公共参数模块

This commit is contained in:
gxwebsoft
2023-06-08 19:33:24 +08:00
parent 7ee10c16c7
commit f5cb3dc489
31 changed files with 3195 additions and 140 deletions
@@ -112,7 +112,7 @@
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where.isStaff = true
where.isStaff = true;
return pageUsers({
...where,
...orders,
+3 -1
View File
@@ -27,10 +27,11 @@
import SelectData from './components/select-data.vue';
import { User } from '@/api/system/user/model';
withDefaults(
const props = withDefaults(
defineProps<{
value?: any;
placeholder?: string;
index?: number;
}>(),
{
placeholder: '请选择'
@@ -54,6 +55,7 @@
};
const onChange = (row) => {
row.index = Number(props.index);
emit('done', row);
};
// 查询租户列表
@@ -0,0 +1,57 @@
<!-- 选择下拉框 -->
<template>
<a-select
show-search
optionFilterProp="label"
:options="data"
allow-clear
:value="value"
:placeholder="placeholder"
@update:value="updateValue"
@blur="onBlur"
/>
</template>
<script lang="ts" setup>
import { listCategory } from '@/api/goods/category';
import { ref } from 'vue';
import { Category } from '@/api/goods/category/model';
const emit = defineEmits<{
(e: 'update:value', value: string): void;
(e: 'blur'): void;
}>();
withDefaults(
defineProps<{
value?: string;
placeholder?: string;
dictCode?: string;
}>(),
{
placeholder: '请选择分类'
}
);
const data = ref<Category[]>([]);
// 字典数据
listCategory({ parentId: 0 }).then((list) => {
data.value = list.map((d) => {
return {
value: d.title,
label: d.title,
text: d.title
};
});
});
/* 更新选中数据 */
const updateValue = (value: string) => {
emit('update:value', value);
};
/* 失去焦点 */
const onBlur = () => {
emit('blur');
};
</script>
@@ -0,0 +1,146 @@
<template>
<ele-modal
:width="750"
:visible="visible"
:maskClosable="false"
:title="title"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
>
<ele-pro-table
ref="tableRef"
row-key="modelId"
:datasource="datasource"
:columns="columns"
:customRow="customRow"
:striped="true"
: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, record }">
<template v-if="column.key === 'customerLogo'">
<a-image
v-if="record.customerAvatar"
:src="FILE_THUMBNAIL + record.customerAvatar"
:preview="false"
:width="45"
/>
</template>
<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 { pageTowerModel } from '@/api/tower/model';
import { FILE_THUMBNAIL } from '@/config/setting';
import { EleProTable } from 'ele-admin-pro';
import { TowerModel, TowerModelParam } from '@/api/tower/model/model';
import { pageTowerPlace } from "@/api/tower/param/place";
defineProps<{
// 弹窗是否打开
visible: boolean;
// 标题
title?: string;
// 修改回显的数据
data?: TowerModel | null;
selection?: TowerModel[];
}>();
const emit = defineEmits<{
(e: 'done', data: TowerModel): 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',
title: '序号',
width: 48,
align: 'center',
fixed: 'left',
hideInSetting: true,
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
},
{
title: '部位编号',
dataIndex: 'placeCode'
},
{
title: '设备类型',
dataIndex: 'equipmentType'
},
{
title: '部位名称',
dataIndex: 'name'
},
{
title: '操作',
key: 'action',
align: 'center'
}
]);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
// 搜索条件
if (searchText.value) {
where.keywords = searchText.value;
}
return pageTowerPlace({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: TowerModelParam) => {
tableRef?.value?.reload({ page: 1, where });
};
/* 自定义行属性 */
const customRow = (record: TowerModel) => {
return {
// 行点击事件
onClick: () => {
updateVisible(false);
emit('done', record);
}
};
};
</script>
<style lang="less"></style>
+65
View File
@@ -0,0 +1,65 @@
<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>
<!-- 选择弹窗 -->
<SelectData
v-model:visible="showEdit"
:data="current"
:title="placeholder"
:customer-type="customerType"
@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 { TowerModel } from '@/api/tower/model/model';
const props = withDefaults(
defineProps<{
value?: any;
customerType?: string;
placeholder?: string;
index?: number;
}>(),
{
placeholder: '请选择数据'
}
);
const emit = defineEmits<{
(e: 'done', TowerModel): void;
(e: 'clear'): void;
(e: 'multiple', any): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
// 当前编辑数据
const current = ref<TowerModel | null>(null);
/* 打开编辑弹窗 */
const openEdit = (row?: TowerModel) => {
current.value = row ?? null;
showEdit.value = true;
};
const onChange = (row) => {
// 第几行
row.index = Number(props.index);
emit('done', row);
};
</script>
+8 -6
View File
@@ -26,13 +26,14 @@
import { BulbOutlined } from '@ant-design/icons-vue';
import { ref } from 'vue';
import SelectData from './components/select-data.vue';
import { Customer } from '@/api/oa/customer/model';
import { TowerModel } from '@/api/tower/model/model';
withDefaults(
const props = withDefaults(
defineProps<{
value?: any;
customerType?: string;
placeholder?: string;
index?: number;
}>(),
{
placeholder: '请选择数据'
@@ -40,7 +41,7 @@
);
const emit = defineEmits<{
(e: 'done', Customer): void;
(e: 'done', TowerModel): void;
(e: 'clear'): void;
(e: 'multiple', any): void;
}>();
@@ -48,16 +49,17 @@
// 是否显示编辑弹窗
const showEdit = ref(false);
// 当前编辑数据
const current = ref<Customer | null>(null);
const current = ref<TowerModel | null>(null);
/* 打开编辑弹窗 */
const openEdit = (row?: Customer) => {
const openEdit = (row?: TowerModel) => {
current.value = row ?? null;
showEdit.value = true;
};
const onChange = (row) => {
console.log(row);
// 第几行
row.index = Number(props.index);
emit('done', row);
};
</script>