Compare commits
10 Commits
5b38710ddf
...
b0741d4ddb
Author | SHA1 | Date |
---|---|---|
HXZN | b0741d4ddb | |
HXZN | 28223435a1 | |
yx | 0b1a61d4fc | |
yx | 4d98830006 | |
yx | f6f788a8bc | |
yixr | 6b4becfbd2 | |
yixr | 5fc23fa31f | |
louis | d20d0314b4 | |
louis | 89d1aeedf0 | |
louis | 783f92bf18 |
|
@ -4,7 +4,7 @@ ENV = 'production'
|
||||||
# base api url
|
# base api url
|
||||||
# VITE_BASE_API_URL = 'https://nest-api.buqiyuan.site'
|
# VITE_BASE_API_URL = 'https://nest-api.buqiyuan.site'
|
||||||
# VITE_BASE_API_URL = 'http://123.249.107.55'
|
# VITE_BASE_API_URL = 'http://123.249.107.55'
|
||||||
VITE_BASE_API_URL = 'http://144.123.43.138:3001'
|
VITE_BASE_API_URL = 'http://192.168.60.213:3001'
|
||||||
|
|
||||||
# 公共基础路径, 所有资源的路径都将据此配置重写。
|
# 公共基础路径, 所有资源的路径都将据此配置重写。
|
||||||
VITE_BASE_URL = /api
|
VITE_BASE_URL = /api
|
||||||
|
|
|
@ -9,7 +9,7 @@ COPY ./ $PROJECT_DIR
|
||||||
# 若网络不通,可以使用淘宝源
|
# 若网络不通,可以使用淘宝源
|
||||||
# RUN pnpm config set registry https://registry.npmmirror.com
|
# RUN pnpm config set registry https://registry.npmmirror.com
|
||||||
# 若不存在安装pnpm
|
# 若不存在安装pnpm
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm@8.10.2
|
||||||
|
|
||||||
# 构建项目
|
# 构建项目
|
||||||
# 安装生成依赖
|
# 安装生成依赖
|
||||||
|
|
|
@ -34,7 +34,7 @@ http {
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 3001;
|
listen 3001;
|
||||||
server_name 144.123.43.138;
|
server_name localhost;
|
||||||
absolute_redirect off; #取消绝对路径的重定向
|
absolute_redirect off; #取消绝对路径的重定向
|
||||||
sendfile on;
|
sendfile on;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { request, type RequestOptions } from '@/utils/request';
|
||||||
|
|
||||||
|
/** 获取公司列表 GET /api/domain */
|
||||||
|
export async function domainList(params: API.DomainParams, options?: RequestOptions) {
|
||||||
|
return request<{
|
||||||
|
items?: API.DomainEntity[];
|
||||||
|
meta?: {
|
||||||
|
itemCount?: number;
|
||||||
|
totalItems?: number;
|
||||||
|
itemsPerPage?: number;
|
||||||
|
totalPages?: number;
|
||||||
|
currentPage?: number;
|
||||||
|
};
|
||||||
|
}>('/api/domain', {
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
// page has a default value: 1
|
||||||
|
page: '1',
|
||||||
|
// pageSize has a default value: 10
|
||||||
|
pageSize: '10',
|
||||||
|
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
|
@ -35,9 +35,11 @@ import * as vehicleUsage from './vehicleUsage';
|
||||||
import * as saleQuotationGroup from './saleQuotationGroup';
|
import * as saleQuotationGroup from './saleQuotationGroup';
|
||||||
import * as saleQuotationComponent from './saleQuotationComponent';
|
import * as saleQuotationComponent from './saleQuotationComponent';
|
||||||
import * as saleQuotationTemplate from './saleQuotationTemplate';
|
import * as saleQuotationTemplate from './saleQuotationTemplate';
|
||||||
|
import * as saleQuotation from './saleQuotation';
|
||||||
|
import * as domain from './domain';
|
||||||
export default {
|
export default {
|
||||||
auth,
|
auth,
|
||||||
|
domain,
|
||||||
account,
|
account,
|
||||||
captcha,
|
captcha,
|
||||||
authEmail,
|
authEmail,
|
||||||
|
@ -70,4 +72,5 @@ export default {
|
||||||
saleQuotationGroup,
|
saleQuotationGroup,
|
||||||
saleQuotationComponent,
|
saleQuotationComponent,
|
||||||
saleQuotationTemplate,
|
saleQuotationTemplate,
|
||||||
|
saleQuotation,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
import { request, type RequestOptions } from '@/utils/request';
|
import { request, type RequestOptions } from '@/utils/request';
|
||||||
|
|
||||||
|
/** 导出出入库记录 GET /api/materials-inventory/export*/
|
||||||
|
export async function materialsInoutExport(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.MaterialsInoutExportParams,
|
||||||
|
options?: RequestOptions,
|
||||||
|
) {
|
||||||
|
const { ...queryParams } = params;
|
||||||
|
return request(`/api/materials-in-out/export`, {
|
||||||
|
method: 'GET',
|
||||||
|
params: { ...queryParams },
|
||||||
|
...(options || { responseType: 'blob', isReturnResult: false }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取原材料出入库记录列表 GET /api/materials-in-out */
|
/** 获取原材料出入库记录列表 GET /api/materials-in-out */
|
||||||
export async function materialsInOutList(
|
export async function materialsInOutList(
|
||||||
params: API.MaterialsInOutListParams,
|
params: API.MaterialsInOutListParams,
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { request, type RequestOptions } from '@/utils/request';
|
||||||
|
const baseApi = '/api/sale_quotation/sale_quotation';
|
||||||
|
/** 导出原材料盘点表 GET /api/sale_quotation/export*/
|
||||||
|
export async function exportSaleQuotation(id: number, options?: RequestOptions) {
|
||||||
|
return request(`${baseApi}/export/${id}`, {
|
||||||
|
method: 'GET',
|
||||||
|
...(options || { responseType: 'blob', isReturnResult: false }),
|
||||||
|
});
|
||||||
|
}
|
|
@ -21,6 +21,8 @@ declare namespace API {
|
||||||
remark: string;
|
remark: string;
|
||||||
/** 头像 */
|
/** 头像 */
|
||||||
avatar: string;
|
avatar: string;
|
||||||
|
/** 所属域 */
|
||||||
|
domain: DomainType;
|
||||||
};
|
};
|
||||||
|
|
||||||
type AccountMenus = {
|
type AccountMenus = {
|
||||||
|
@ -1213,12 +1215,13 @@ declare namespace API {
|
||||||
status: number;
|
status: number;
|
||||||
roles: RoleEntity[];
|
roles: RoleEntity[];
|
||||||
dept: DeptEntity;
|
dept: DeptEntity;
|
||||||
|
domain: DomainType;
|
||||||
accessTokens: AccessTokenEntity[];
|
accessTokens: AccessTokenEntity[];
|
||||||
id: number;
|
id: number;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
|
type DomainType = number;
|
||||||
type UserListParams = {
|
type UserListParams = {
|
||||||
page?: number;
|
page?: number;
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
|
@ -1379,8 +1382,9 @@ declare namespace API {
|
||||||
};
|
};
|
||||||
|
|
||||||
type MaterialsInventoryExportParams = {
|
type MaterialsInventoryExportParams = {
|
||||||
time: string;
|
time: string[];
|
||||||
projectId: number;
|
filename:string;
|
||||||
|
projectId?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type MaterialsInventoryInfoParams = {
|
type MaterialsInventoryInfoParams = {
|
||||||
|
@ -1808,6 +1812,11 @@ declare namespace API {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Materials In out history
|
// Materials In out history
|
||||||
|
type MaterialsInoutExportParams = {
|
||||||
|
time: string[];
|
||||||
|
filename:string;
|
||||||
|
};
|
||||||
|
|
||||||
type MaterialsInOutUpdateParams = {
|
type MaterialsInOutUpdateParams = {
|
||||||
id: number;
|
id: number;
|
||||||
fileIds?: number[];
|
fileIds?: number[];
|
||||||
|
@ -2015,4 +2024,18 @@ declare namespace API {
|
||||||
type SaleQuotationTemplateDeleteParams = {
|
type SaleQuotationTemplateDeleteParams = {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type DomainEntity = {
|
||||||
|
title: string;
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type DomainParams = {
|
||||||
|
page?: number;
|
||||||
|
pageSize?: number;
|
||||||
|
title?: string;
|
||||||
|
field?: string;
|
||||||
|
order?: 'ASC' | 'DESC';
|
||||||
|
_t?: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,11 +58,11 @@ export const useExportExcelModal = () => {
|
||||||
modalProps: {
|
modalProps: {
|
||||||
title: t('component.excel.exportModalTitle'),
|
title: t('component.excel.exportModalTitle'),
|
||||||
onFinish: async (values) => {
|
onFinish: async (values) => {
|
||||||
const { filename, bookType } = values;
|
const { filename, bookType, time } = values;
|
||||||
|
|
||||||
onOk({
|
onOk({
|
||||||
filename: `${filename.split('.').shift()}.${bookType}`,
|
filename: bookType ? `${filename.split('.').shift()}.${bookType}` : filename,
|
||||||
bookType,
|
bookType,
|
||||||
|
time,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,12 @@ export const USER_INFO_KEY = 'USER__INFO__';
|
||||||
|
|
||||||
// role info key
|
// role info key
|
||||||
export const ROLES_KEY = 'ROLES__KEY__';
|
export const ROLES_KEY = 'ROLES__KEY__';
|
||||||
|
|
||||||
/** 是否锁屏 */
|
/** 是否锁屏 */
|
||||||
export const IS_LOCKSCREEN = 'IS_LOCKSCREEN';
|
export const IS_LOCKSCREEN = 'IS_LOCKSCREEN';
|
||||||
|
|
||||||
/** 标签页 */
|
/** 标签页 */
|
||||||
export const TABS_ROUTES = 'TABS_ROUTES';
|
export const TABS_ROUTES = 'TABS_ROUTES';
|
||||||
|
|
||||||
|
/** 域 */
|
||||||
|
export const DOMAIN_KEY = 'DOMAIN__';
|
|
@ -0,0 +1,51 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
公司: <a-select ref="select"
|
||||||
|
v-if="options.length"
|
||||||
|
:disabled="!$auth('system:domain:change')"
|
||||||
|
v-model:value="userStore.domain"
|
||||||
|
style="min-width: 100px;"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="onChange"
|
||||||
|
:dropdownStyle="{ 'textOverflow': 'ellipsis', 'min-width': 'fit-content' }">
|
||||||
|
<a-select-option :value="item.value"
|
||||||
|
v-for="(item, index) in options"
|
||||||
|
:key="index">{{ item.label }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='ts'>
|
||||||
|
import Api from '@/api';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import type { SelectValue } from 'ant-design-vue/es/select';
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'DomianPicker'
|
||||||
|
})
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const options = ref<{ label: string, value: number }[]>([]);
|
||||||
|
let domains = ref<API.DomainEntity[]>([]);
|
||||||
|
const onChange = (value: SelectValue) => {
|
||||||
|
userStore.changeDomain(value)
|
||||||
|
};
|
||||||
|
onMounted(() => {
|
||||||
|
Api.domain.domainList({}).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
domains.value = res.items ?? [];
|
||||||
|
options.value = domains.value.map((item) => {
|
||||||
|
return {
|
||||||
|
label: item.title,
|
||||||
|
value: item.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='less' scoped></style>
|
|
@ -1,3 +1,4 @@
|
||||||
export { default as Search } from './search/index.vue';
|
export { default as Search } from './search/index.vue';
|
||||||
export { default as FullScreen } from './fullscreen/index.vue';
|
export { default as FullScreen } from './fullscreen/index.vue';
|
||||||
export { default as ProjectSetting } from './setting/index.vue';
|
export { default as ProjectSetting } from './setting/index.vue';
|
||||||
|
export { default as DomianPicker } from './domianPicker/index.vue';
|
||||||
|
|
|
@ -1,23 +1,26 @@
|
||||||
<template>
|
<template>
|
||||||
<Layout.Header :style="headerStyle" class="layout-header">
|
<Layout.Header :style="headerStyle"
|
||||||
|
class="layout-header">
|
||||||
<Space :size="20">
|
<Space :size="20">
|
||||||
<slot>
|
<slot>
|
||||||
<Space :size="20">
|
<Space :size="20">
|
||||||
<span class="menu-fold" @click="() => emit('update:collapsed', !collapsed)">
|
<span class="menu-fold"
|
||||||
|
@click="() => emit('update:collapsed', !collapsed)">
|
||||||
<component :is="collapsed ? MenuUnfoldOutlined : MenuFoldOutlined" />
|
<component :is="collapsed ? MenuUnfoldOutlined : MenuFoldOutlined" />
|
||||||
</span>
|
</span>
|
||||||
<Breadcrumb>
|
<Breadcrumb>
|
||||||
<template v-for="(routeItem, rotueIndex) in menus" :key="routeItem?.name">
|
<template v-for="(routeItem, rotueIndex) in menus"
|
||||||
|
:key="routeItem?.name">
|
||||||
<Breadcrumb.Item>
|
<Breadcrumb.Item>
|
||||||
<TitleI18n :title="routeItem?.meta?.title" />
|
<TitleI18n :title="routeItem?.meta?.title" />
|
||||||
<template v-if="routeItem?.children?.length" #overlay>
|
<template v-if="routeItem?.children?.length"
|
||||||
|
#overlay>
|
||||||
<Menu :selected-keys="getSelectKeys(rotueIndex)">
|
<Menu :selected-keys="getSelectKeys(rotueIndex)">
|
||||||
<template v-for="childItem in routeItem?.children" :key="childItem.name">
|
<template v-for="childItem in routeItem?.children"
|
||||||
<Menu.Item
|
:key="childItem.name">
|
||||||
v-if="!childItem.meta?.hideInMenu && !childItem.meta?.hideInBreadcrumb"
|
<Menu.Item v-if="!childItem.meta?.hideInMenu && !childItem.meta?.hideInBreadcrumb"
|
||||||
:key="childItem.name"
|
:key="childItem.name"
|
||||||
@click="clickMenuItem(childItem)"
|
@click="clickMenuItem(childItem)">
|
||||||
>
|
|
||||||
<TitleI18n :title="childItem.meta?.title" />
|
<TitleI18n :title="childItem.meta?.title" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</template>
|
</template>
|
||||||
|
@ -30,14 +33,17 @@
|
||||||
</slot>
|
</slot>
|
||||||
</Space>
|
</Space>
|
||||||
<Space :size="20">
|
<Space :size="20">
|
||||||
|
<DomianPicker />
|
||||||
<Search />
|
<Search />
|
||||||
<Tooltip :title="$t('layout.header.tooltipLock')" placement="bottom">
|
<Tooltip :title="$t('layout.header.tooltipLock')"
|
||||||
|
placement="bottom">
|
||||||
<LockOutlined @click="lockscreenStore.setLock(true)" />
|
<LockOutlined @click="lockscreenStore.setLock(true)" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<FullScreen />
|
<FullScreen />
|
||||||
<!-- <LocalePicker /> -->
|
<!-- <LocalePicker /> -->
|
||||||
<Dropdown placement="bottomRight">
|
<Dropdown placement="bottomRight">
|
||||||
<Avatar :src="userInfo.avatar" :alt="userInfo.username">{{ userInfo.username }}</Avatar>
|
<Avatar :src="userInfo.avatar"
|
||||||
|
:alt="userInfo.username">{{ userInfo.username }}</Avatar>
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<Menu>
|
<Menu>
|
||||||
<Menu.Item @click="$router.push({ name: 'account-about' })">
|
<Menu.Item @click="$router.push({ name: 'account-about' })">
|
||||||
|
@ -81,7 +87,7 @@
|
||||||
Tooltip,
|
Tooltip,
|
||||||
type MenuTheme,
|
type MenuTheme,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { Search, FullScreen, ProjectSetting } from './components/';
|
import { Search, FullScreen, ProjectSetting, DomianPicker } from './components/';
|
||||||
import { LocalePicker } from '@/components/basic/locale-picker';
|
import { LocalePicker } from '@/components/basic/locale-picker';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useDictStore } from './dict';
|
||||||
import { useRouter, type RouteRecordRaw, useRoute } from 'vue-router';
|
import { useRouter, type RouteRecordRaw, useRoute } from 'vue-router';
|
||||||
import { store } from '@/store';
|
import { store } from '@/store';
|
||||||
import Api from '@/api/';
|
import Api from '@/api/';
|
||||||
import { ACCESS_TOKEN_KEY } from '@/enums/cacheEnum';
|
import { ACCESS_TOKEN_KEY, DOMAIN_KEY } from '@/enums/cacheEnum';
|
||||||
import { Storage } from '@/utils/Storage';
|
import { Storage } from '@/utils/Storage';
|
||||||
import { resetRouter } from '@/router';
|
import { resetRouter } from '@/router';
|
||||||
import { generateDynamicRoutes } from '@/router/helper/routeHelper';
|
import { generateDynamicRoutes } from '@/router/helper/routeHelper';
|
||||||
|
@ -21,12 +21,12 @@ export type MessageEvent = {
|
||||||
export const useUserStore = defineStore('user', () => {
|
export const useUserStore = defineStore('user', () => {
|
||||||
let eventSource: EventSource | null = null;
|
let eventSource: EventSource | null = null;
|
||||||
const token = ref(Storage.get(ACCESS_TOKEN_KEY, null));
|
const token = ref(Storage.get(ACCESS_TOKEN_KEY, null));
|
||||||
const name = ref('amdin');
|
const name = ref('admin');
|
||||||
const perms = ref<string[]>([]);
|
const perms = ref<string[]>([]);
|
||||||
const menus = ref<RouteRecordRaw[]>([]);
|
const menus = ref<RouteRecordRaw[]>([]);
|
||||||
const userInfo = ref<Partial<API.UserEntity>>({});
|
const userInfo = ref<Partial<API.UserEntity>>({});
|
||||||
const serverConnected = ref(true);
|
const serverConnected = ref(true);
|
||||||
|
const domain = ref<API.DomainType>(Storage.get(DOMAIN_KEY, null));
|
||||||
watch(serverConnected, (val) => {
|
watch(serverConnected, (val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
initServerMsgListener();
|
initServerMsgListener();
|
||||||
|
@ -87,6 +87,7 @@ export const useUserStore = defineStore('user', () => {
|
||||||
// const ex = 7 * 24 * 60 * 60 * 1000;
|
// const ex = 7 * 24 * 60 * 60 * 1000;
|
||||||
Storage.set(ACCESS_TOKEN_KEY, token.value);
|
Storage.set(ACCESS_TOKEN_KEY, token.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 登录 */
|
/** 登录 */
|
||||||
const login = async (params: API.LoginDto) => {
|
const login = async (params: API.LoginDto) => {
|
||||||
try {
|
try {
|
||||||
|
@ -97,6 +98,7 @@ export const useUserStore = defineStore('user', () => {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 解锁屏幕 */
|
/** 解锁屏幕 */
|
||||||
const unlock = async (params: API.LoginDto) => {
|
const unlock = async (params: API.LoginDto) => {
|
||||||
try {
|
try {
|
||||||
|
@ -106,6 +108,17 @@ export const useUserStore = defineStore('user', () => {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 切换domain */
|
||||||
|
const changeDomain = (value) => {
|
||||||
|
domain.value = value;
|
||||||
|
Storage.set(DOMAIN_KEY, value);
|
||||||
|
setTimeout(() => {
|
||||||
|
// 刷新页面
|
||||||
|
window.location.reload();
|
||||||
|
}, 200);
|
||||||
|
};
|
||||||
|
|
||||||
/** 登录成功之后, 获取用户信息以及生成权限路由 */
|
/** 登录成功之后, 获取用户信息以及生成权限路由 */
|
||||||
const afterLogin = async () => {
|
const afterLogin = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -113,9 +126,12 @@ export const useUserStore = defineStore('user', () => {
|
||||||
useDictStore();
|
useDictStore();
|
||||||
// const wsStore = useWsStore();
|
// const wsStore = useWsStore();
|
||||||
const userInfoData = await accountProfile();
|
const userInfoData = await accountProfile();
|
||||||
|
|
||||||
userInfo.value = userInfoData;
|
userInfo.value = userInfoData;
|
||||||
|
|
||||||
|
if (!Storage.get(DOMAIN_KEY)) {
|
||||||
|
domain.value = userInfoData.domain;
|
||||||
|
Storage.set(DOMAIN_KEY, domain.value);
|
||||||
|
}
|
||||||
await fetchPermsAndMenus();
|
await fetchPermsAndMenus();
|
||||||
initServerMsgListener();
|
initServerMsgListener();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -158,6 +174,8 @@ export const useUserStore = defineStore('user', () => {
|
||||||
perms,
|
perms,
|
||||||
menus,
|
menus,
|
||||||
userInfo,
|
userInfo,
|
||||||
|
domain,
|
||||||
|
changeDomain,
|
||||||
login,
|
login,
|
||||||
unlock,
|
unlock,
|
||||||
afterLogin,
|
afterLogin,
|
||||||
|
|
|
@ -123,6 +123,8 @@ export function request<T = any>(config: RequestOptions): Promise<BaseResponse<T
|
||||||
export async function request(_url: string | RequestOptions, _config: RequestOptions = {}) {
|
export async function request(_url: string | RequestOptions, _config: RequestOptions = {}) {
|
||||||
const url = isString(_url) ? _url : _url.url;
|
const url = isString(_url) ? _url : _url.url;
|
||||||
const config = isString(_url) ? _config : _url;
|
const config = isString(_url) ? _config : _url;
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 兼容 from data 文件上传的情况
|
// 兼容 from data 文件上传的情况
|
||||||
const { requestType, isReturnResult = true, ...rest } = config;
|
const { requestType, isReturnResult = true, ...rest } = config;
|
||||||
|
@ -137,6 +139,7 @@ export async function request(_url: string | RequestOptions, _config: RequestOpt
|
||||||
headers: {
|
headers: {
|
||||||
...rest.headers,
|
...rest.headers,
|
||||||
...(requestType === 'form' ? { 'Content-Type': 'multipart/form-data' } : {}),
|
...(requestType === 'form' ? { 'Content-Type': 'multipart/form-data' } : {}),
|
||||||
|
'sk-domain':userStore.domain
|
||||||
},
|
},
|
||||||
})) as AxiosResponse<BaseResponse>;
|
})) as AxiosResponse<BaseResponse>;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<a-form layout="horizontal" :model="state.formInline" @submit.prevent="handleSubmit">
|
<a-form layout="horizontal" :model="state.formInline" @submit.prevent="handleSubmit">
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-input v-model:value="state.formInline.username" size="large" placeholder="admin">
|
<a-input v-model:value="state.formInline.username" size="large" placeholder="用户名">
|
||||||
<template #prefix><user-outlined type="user" /></template>
|
<template #prefix><user-outlined type="user" /></template>
|
||||||
</a-input>
|
</a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
v-model:value="state.formInline.password"
|
v-model:value="state.formInline.password"
|
||||||
size="large"
|
size="large"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="huaxin123"
|
placeholder="密码"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
>
|
>
|
||||||
<template #prefix><lock-outlined type="user" /></template>
|
<template #prefix><lock-outlined type="user" /></template>
|
||||||
|
@ -61,8 +61,8 @@
|
||||||
loading: false,
|
loading: false,
|
||||||
captcha: '',
|
captcha: '',
|
||||||
formInline: {
|
formInline: {
|
||||||
username: 'admin',
|
username: '',
|
||||||
password: 'huaxin123',
|
password: '',
|
||||||
verifyCode: '',
|
verifyCode: '',
|
||||||
captchaId: '',
|
captchaId: '',
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup
|
<script setup lang="tsx">
|
||||||
lang="tsx">
|
|
||||||
import { useTable } from '@/components/core/dynamic-table';
|
import { useTable } from '@/components/core/dynamic-table';
|
||||||
import {
|
import {
|
||||||
baseColumns,
|
baseColumns,
|
||||||
|
@ -32,13 +31,15 @@
|
||||||
import Api from '@/api/';
|
import Api from '@/api/';
|
||||||
import { onMounted, ref, type FunctionalComponent } from 'vue';
|
import { onMounted, ref, type FunctionalComponent } from 'vue';
|
||||||
import { useFormModal, useModal } from '@/hooks/useModal';
|
import { useFormModal, useModal } from '@/hooks/useModal';
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button, message } from 'ant-design-vue';
|
||||||
import { formSchemas } from './formSchemas';
|
import { formSchemas } from './formSchemas';
|
||||||
import AttachmentManage from '@/components/business/attachment-manage/index.vue';
|
import AttachmentManage from '@/components/business/attachment-manage/index.vue';
|
||||||
import AttachmentUpload from '@/components/business/attachment-upload/index.vue';
|
import AttachmentUpload from '@/components/business/attachment-upload/index.vue';
|
||||||
import { useExportExcelModal, jsonToSheetXlsx } from '@/components/basic/excel';
|
import { useExportExcelModal, jsonToSheetXlsx } from '@/components/basic/excel';
|
||||||
import { MaterialsInOutEnum } from '@/enums/materialsInventoryEnum';
|
import { MaterialsInOutEnum } from '@/enums/materialsInventoryEnum';
|
||||||
import { formatToDate } from '@/utils/dateUtil';
|
import { formatToDate } from '@/utils/dateUtil';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import fileDownload from 'js-file-download';
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'MaterialsInOut',
|
name: 'MaterialsInOut',
|
||||||
});
|
});
|
||||||
|
@ -100,68 +101,81 @@
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
const openExportModal = () => {
|
const openExportModal = async () => {
|
||||||
exportExcelModal.openModal({
|
const queryModel = dynamicTableInstance.queryFormRef?.formModel;
|
||||||
formSchemas: [
|
if(!queryModel?.time){
|
||||||
{
|
message.warning('请选择时间范围')
|
||||||
field: 'time',
|
return;
|
||||||
component: 'RangePicker',
|
|
||||||
label:'时间范围',
|
|
||||||
rules: [{ required: true }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
onOk: ({ filename, bookType }) => {
|
|
||||||
const tableData: TableListItem[] = dynamicTableInstance.tableData;
|
|
||||||
let exportData: any[] = []
|
|
||||||
for (let item of tableData) {
|
|
||||||
exportData.push({
|
|
||||||
projectName: item.project?.name,
|
|
||||||
inOrOut: item.inOrOut === MaterialsInOutEnum.In ? '入库' : '出库',
|
|
||||||
inventoryInOutNumber: item.inventoryInOutNumber,
|
|
||||||
time: formatToDate(item.time),
|
|
||||||
company: item.product?.company?.name,
|
|
||||||
productName: item.product?.name,
|
|
||||||
productSpecification: item.product?.productSpecification,
|
|
||||||
unit: item.product?.unit?.label,
|
|
||||||
quantity: item.quantity,
|
|
||||||
unitPrice: parseFloat(item.unitPrice),
|
|
||||||
amount: parseFloat(item.amount),
|
|
||||||
agent: item.agent,
|
|
||||||
issuanceNumber: item.issuanceNumber,
|
|
||||||
remark: item.remark
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
jsonToSheetXlsx({
|
const timeRange = (queryModel?.time ?? []).map(item => dayjs(item).format('YYYY-MM-DD'));
|
||||||
data: exportData,
|
const response = await Api.materialsInOut.materialsInoutExport({
|
||||||
header: {
|
time: timeRange ?? [], filename: `${timeRange[0]}-${timeRange[1]}`
|
||||||
inOrOut: '出/入库',
|
|
||||||
inventoryInOutNumber: '出入库单号',
|
|
||||||
time: '时间',
|
|
||||||
projectName: '项目',
|
|
||||||
company: '公司',
|
|
||||||
productName: '产品名',
|
|
||||||
productSpecification: "产品规格",
|
|
||||||
unit: '单位',
|
|
||||||
quantity: '数量',
|
|
||||||
unitPrice: '单价',
|
|
||||||
amount: '金额',
|
|
||||||
agent: '经办人',
|
|
||||||
issuanceNumber: '领料单号',
|
|
||||||
remark: '备注'
|
|
||||||
},
|
|
||||||
filename,
|
|
||||||
write2excelOpts: {
|
|
||||||
bookType,
|
|
||||||
},
|
|
||||||
json2sheetOpts: {
|
|
||||||
// 指定顺序
|
|
||||||
header: [
|
|
||||||
'inOrOut', 'inventoryInOutNumber', 'time', 'projectName', 'company', 'productName', 'productSpecification', 'unit', 'quantity',
|
|
||||||
'unitPrice', 'amount', 'agent', 'issuanceNumber', 'remark'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
fileDownload(response, `${timeRange[0]}-${timeRange[1]}.xls`);
|
||||||
|
// exportExcelModal.openModal({
|
||||||
|
// formSchemas: [
|
||||||
|
// {
|
||||||
|
// field: 'time',
|
||||||
|
// component: 'RangePicker',
|
||||||
|
// label: '时间范围',
|
||||||
|
// rules: [{ required: true }],
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// onOk: async ({ filename, bookType, time }) => {
|
||||||
|
// const response = await Api.materialsInOut.materialsInoutExport({
|
||||||
|
// time: (time ?? []).map(item => dayjs(item).format('YYYY-MM-DD')), filename
|
||||||
|
// });
|
||||||
|
// fileDownload(response, `${filename}.xls`);
|
||||||
|
// const tableData: TableListItem[] = dynamicTableInstance.tableData;
|
||||||
|
// let exportData: any[] = []
|
||||||
|
// for (let item of tableData) {
|
||||||
|
// exportData.push({
|
||||||
|
// projectName: item.project?.name,
|
||||||
|
// inOrOut: item.inOrOut === MaterialsInOutEnum.In ? '入库' : '出库',
|
||||||
|
// inventoryInOutNumber: item.inventoryInOutNumber,
|
||||||
|
// time: formatToDate(item.time),
|
||||||
|
// company: item.product?.company?.name,
|
||||||
|
// productName: item.product?.name,
|
||||||
|
// productSpecification: item.product?.productSpecification,
|
||||||
|
// unit: item.product?.unit?.label,
|
||||||
|
// quantity: item.quantity,
|
||||||
|
// unitPrice: parseFloat(item.unitPrice),
|
||||||
|
// amount: parseFloat(item.amount),
|
||||||
|
// agent: item.agent,
|
||||||
|
// issuanceNumber: item.issuanceNumber,
|
||||||
|
// remark: item.remark
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// jsonToSheetXlsx({
|
||||||
|
// data: exportData,
|
||||||
|
// header: {
|
||||||
|
// inOrOut: '出/入库',
|
||||||
|
// inventoryInOutNumber: '出入库单号',
|
||||||
|
// time: '时间',
|
||||||
|
// projectName: '项目',
|
||||||
|
// company: '公司',
|
||||||
|
// productName: '产品名',
|
||||||
|
// productSpecification: "产品规格",
|
||||||
|
// unit: '单位',
|
||||||
|
// quantity: '数量',
|
||||||
|
// unitPrice: '单价',
|
||||||
|
// amount: '金额',
|
||||||
|
// agent: '经办人',
|
||||||
|
// issuanceNumber: '领料单号',
|
||||||
|
// remark: '备注'
|
||||||
|
// },
|
||||||
|
// filename,
|
||||||
|
// write2excelOpts:
|
||||||
|
// { bookType: 'xls' },
|
||||||
|
// json2sheetOpts: {
|
||||||
|
// // 指定顺序
|
||||||
|
// header: [
|
||||||
|
// 'inOrOut', 'inventoryInOutNumber', 'time', 'projectName', 'company', 'productName', 'productSpecification', 'unit', 'quantity',
|
||||||
|
// 'unitPrice', 'amount', 'agent', 'issuanceNumber', 'remark'],
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// });
|
||||||
};
|
};
|
||||||
const openAttachmentUploadModal = async (record: TableListItem) => {
|
const openAttachmentUploadModal = async (record: TableListItem) => {
|
||||||
isUploadPopupVisiable.value = true;
|
isUploadPopupVisiable.value = true;
|
||||||
|
@ -280,5 +294,4 @@
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less"
|
<style lang="less" scoped></style>
|
||||||
scoped></style>
|
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup
|
<script setup lang="tsx">
|
||||||
lang="tsx">
|
|
||||||
import { useTable } from '@/components/core/dynamic-table';
|
import { useTable } from '@/components/core/dynamic-table';
|
||||||
import { baseColumns, type TableColumnItem, type TableListItem } from './columns';
|
import { baseColumns, type TableColumnItem, type TableListItem } from './columns';
|
||||||
import Api from '@/api/';
|
import Api from '@/api/';
|
||||||
|
@ -29,12 +28,14 @@
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import fileDownload from 'js-file-download';
|
import fileDownload from 'js-file-download';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
import { useExportExcelModal } from '@/components/basic/excel';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'MaterialsInventory',
|
name: 'MaterialsInventory',
|
||||||
});
|
});
|
||||||
const [DynamicTable, dynamicTableInstance] = useTable();
|
const [DynamicTable, dynamicTableInstance] = useTable();
|
||||||
const [showExportModal] = useFormModal();
|
const [showExportModal] = useFormModal();
|
||||||
|
const exportExcelModal = useExportExcelModal();
|
||||||
let columns = ref<TableColumnItem[]>();
|
let columns = ref<TableColumnItem[]>();
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
columns.value = [
|
columns.value = [
|
||||||
|
@ -76,30 +77,45 @@
|
||||||
const { time } = unref<{ time: string; projectId: number }>(
|
const { time } = unref<{ time: string; projectId: number }>(
|
||||||
dynamicTableInstance?.queryFormRef?.formModel as { time: string; projectId: number },
|
dynamicTableInstance?.queryFormRef?.formModel as { time: string; projectId: number },
|
||||||
);
|
);
|
||||||
|
exportExcelModal.openModal({
|
||||||
const [formRef] = await showExportModal({
|
formSchemas: [
|
||||||
modalProps: {
|
{
|
||||||
title: `导出条件选择`,
|
field: 'time',
|
||||||
width: '50%',
|
component: 'RangePicker',
|
||||||
okText: '导出',
|
label: '时间范围',
|
||||||
onFinish: async (values) => {
|
rules: [{ required: true }],
|
||||||
const response = await Api.materialsInventory.materialsInventoryExport(values);
|
|
||||||
const { time } = values;
|
|
||||||
fileDownload(response, `${dayjs(time).format('YYYY.MM.盘点表')}.xls`);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formProps: {
|
|
||||||
labelWidth: 100,
|
|
||||||
schemas: exportSchemas,
|
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
onOk: async ({ filename, bookType, time }) => {
|
||||||
|
const response = await Api.materialsInventory.materialsInventoryExport({
|
||||||
|
time: (time ?? []).map(item => dayjs(item).format('YYYY-MM-DD')), filename
|
||||||
});
|
});
|
||||||
|
fileDownload(response, `${filename}.xls`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// const [formRef] = await showExportModal({
|
||||||
|
// modalProps: {
|
||||||
|
// title: `导出条件选择`,
|
||||||
|
// width: '50%',
|
||||||
|
// okText: '导出',
|
||||||
|
// onFinish: async (values) => {
|
||||||
|
// const response = await Api.materialsInventory.materialsInventoryExport(values);
|
||||||
|
// const { time } = values;
|
||||||
|
// fileDownload(response, `${dayjs(time).format('YYYY.MM.盘点表')}.xls`);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// formProps: {
|
||||||
|
// labelWidth: 100,
|
||||||
|
// schemas: exportSchemas,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
// auto fill export time fields
|
// auto fill export time fields
|
||||||
if (time) {
|
// if (time) {
|
||||||
formRef?.setFieldsValue({
|
// formRef?.setFieldsValue({
|
||||||
time,
|
// time,
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,8 +165,7 @@
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less"
|
<style lang="less" scoped></style>
|
||||||
scoped></style>
|
|
||||||
import dayjs from 'dayjs'; import fileDownload from 'js-file-download'; import type { TableQueryItem
|
import dayjs from 'dayjs'; import fileDownload from 'js-file-download'; import type { TableQueryItem
|
||||||
} from '../in-out/columns'; import { exportSchemas } from '../in-out/exportSchema'; import dayjs
|
} from '../in-out/columns'; import { exportSchemas } from '../in-out/exportSchema'; import dayjs
|
||||||
from 'dayjs'; import fileDownload from 'js-file-download'; import type { TableQueryItem } from
|
from 'dayjs'; import fileDownload from 'js-file-download'; import type { TableQueryItem } from
|
||||||
|
|
|
@ -26,6 +26,7 @@ import { useFormModal, useModal } from '@/hooks/useModal';
|
||||||
import { formSchemas } from './formSchemas';
|
import { formSchemas } from './formSchemas';
|
||||||
|
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
|
import fileDownload from 'js-file-download';
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'SaleQuotationTemplate',
|
name: 'SaleQuotationTemplate',
|
||||||
});
|
});
|
||||||
|
@ -46,6 +47,7 @@ onMounted(() => {
|
||||||
dataIndex: 'ACTION',
|
dataIndex: 'ACTION',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
actions: ({ record }) => [
|
actions: ({ record }) => [
|
||||||
|
|
||||||
{
|
{
|
||||||
icon: 'ant-design:edit-outlined',
|
icon: 'ant-design:edit-outlined',
|
||||||
tooltip: '编辑',
|
tooltip: '编辑',
|
||||||
|
@ -66,14 +68,25 @@ onMounted(() => {
|
||||||
onConfirm: () => delRowConfirm(record.id),
|
onConfirm: () => delRowConfirm(record.id),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: 'ant-design:file-excel-outlined',
|
||||||
|
tooltip: '导出',
|
||||||
|
auth: {
|
||||||
|
perm: 'sale_quotation:sale_quotation:export',
|
||||||
|
effect: 'disable',
|
||||||
|
},
|
||||||
|
onClick: () => onExport(record),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const onExport = async (record:TableListItem) => {
|
||||||
|
const response = await Api.saleQuotation.exportSaleQuotation(record.id);
|
||||||
|
fileDownload(response, `${record.name}.xls`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 打开新增/编辑弹窗
|
* @description 打开新增/编辑弹窗
|
||||||
|
|
Loading…
Reference in New Issue