修复权限以及供应商入库
This commit is contained in:
@ -28,10 +28,10 @@ export interface ContractorVO {
|
|||||||
* 管理人联系电话
|
* 管理人联系电话
|
||||||
*/
|
*/
|
||||||
custodianPhone: string;
|
custodianPhone: string;
|
||||||
/**
|
/**
|
||||||
* 分包类型
|
* 分包类型
|
||||||
*/
|
*/
|
||||||
contractorType?: string;
|
contractorType?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司相关文件
|
* 公司相关文件
|
||||||
@ -54,6 +54,14 @@ export interface ContractorForm extends BaseEntity {
|
|||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
|
/**
|
||||||
|
* 供应商id
|
||||||
|
*/
|
||||||
|
supplierId?: string | number;
|
||||||
|
/**
|
||||||
|
* 供应商
|
||||||
|
*/
|
||||||
|
supplier?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
@ -127,10 +135,10 @@ export interface ContractorQuery extends PageQuery {
|
|||||||
* 管理人联系电话
|
* 管理人联系电话
|
||||||
*/
|
*/
|
||||||
custodianPhone?: string;
|
custodianPhone?: string;
|
||||||
/**
|
/**
|
||||||
* 分包类型
|
* 分包类型
|
||||||
*/
|
*/
|
||||||
contractorType?: string;
|
contractorType?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期范围参数
|
* 日期范围参数
|
||||||
|
@ -8,7 +8,7 @@ import { SupplierInputVO, SupplierInputForm, SupplierInputQuery } from '@/api/su
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const listSupplierInput = (query?: SupplierInputQuery): AxiosPromise<SupplierInputVO[]> => {
|
export const listSupplierInput = (query?: any): AxiosPromise<SupplierInputVO[]> => {
|
||||||
return request({
|
return request({
|
||||||
url: '/supplierInput/supplierInput/list',
|
url: '/supplierInput/supplierInput/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -56,7 +56,13 @@ const handleSelect = async (projectId: string) => {
|
|||||||
text: '项目切换中...',
|
text: '项目切换中...',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
if (loadingInstance && loadingInstance.visible) {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
await changeProject(projectId);
|
await changeProject(projectId);
|
||||||
|
console.log('切换项目', selectedProject);
|
||||||
|
|
||||||
// 更新项目 & 权限
|
// 更新项目 & 权限
|
||||||
userStore.setSelectedProject(selectedProject);
|
userStore.setSelectedProject(selectedProject);
|
||||||
|
@ -10,6 +10,8 @@ import useUserStore from '@/store/modules/user';
|
|||||||
import useSettingsStore from '@/store/modules/settings';
|
import useSettingsStore from '@/store/modules/settings';
|
||||||
import usePermissionStore from '@/store/modules/permission';
|
import usePermissionStore from '@/store/modules/permission';
|
||||||
|
|
||||||
|
let isFirst = false;
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false });
|
NProgress.configure({ showSpinner: false });
|
||||||
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*', '/materials/purchaseDoc/uploadCode'];
|
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*', '/materials/purchaseDoc/uploadCode'];
|
||||||
|
|
||||||
@ -17,57 +19,64 @@ const isWhiteList = (path: string) => {
|
|||||||
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
||||||
};
|
};
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
if (to.path == '/indexEquipment' || to.path == '/materials/purchaseDoc/uploadCode' || to.path == '/codeDetail') {
|
|
||||||
next();
|
|
||||||
} else if (getToken()) {
|
|
||||||
to.meta.title && useSettingsStore().setTitle(to.meta.title);
|
|
||||||
/* has token*/
|
|
||||||
if (to.path === '/login') {
|
|
||||||
next({ path: '/' });
|
|
||||||
NProgress.done();
|
|
||||||
} else if (isWhiteList(to.path)) {
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
if (useUserStore().roles.length === 0 || $cache.local.getJSON('isCheckRole')) {
|
|
||||||
isRelogin.show = true;
|
|
||||||
// 判断当前用户是否已拉取完user_info信息
|
|
||||||
const [err] = await tos(useUserStore().getInfo());
|
|
||||||
if (err) {
|
|
||||||
await useUserStore().logout();
|
|
||||||
ElMessage.error(err);
|
|
||||||
next({ path: '/' });
|
|
||||||
} else {
|
|
||||||
isRelogin.show = false;
|
|
||||||
const accessRoutes = await usePermissionStore().generateRoutes();
|
|
||||||
// 根据roles权限生成可访问的路由表
|
|
||||||
accessRoutes.forEach((route) => {
|
|
||||||
if (!isHttp(route.path)) {
|
|
||||||
router.addRoute(route); // 动态添加可访问路由表
|
|
||||||
console.log('🚀 ~ route:', route);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$cache.local.remove('isCheckRole');
|
|
||||||
|
|
||||||
// @ts-expect-error hack方法 确保addRoutes已完成
|
// 特殊页面放行
|
||||||
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
|
if (['/indexEquipment', '/materials/purchaseDoc/uploadCode', '/codeDetail'].includes(to.path)) {
|
||||||
}
|
return true;
|
||||||
} else {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 没有token
|
|
||||||
if (isWhiteList(to.path)) {
|
|
||||||
// 在免登录白名单,直接进入
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
const redirect = encodeURIComponent(to.fullPath || '/');
|
|
||||||
next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
|
|
||||||
NProgress.done();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 已登录
|
||||||
|
if (getToken()) {
|
||||||
|
if (to.meta.title) useSettingsStore().setTitle(to.meta.title);
|
||||||
|
|
||||||
|
if (to.path === '/login') {
|
||||||
|
NProgress.done();
|
||||||
|
return { path: '/' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWhiteList(to.path)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((!isFirst && useUserStore().roles.length === 0) || $cache.local.getJSON('isCheckRole') === 'true') {
|
||||||
|
isFirst = true;
|
||||||
|
isRelogin.show = true;
|
||||||
|
|
||||||
|
const [err] = await tos(useUserStore().getInfo());
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
await useUserStore().logout();
|
||||||
|
ElMessage.error(err);
|
||||||
|
NProgress.done();
|
||||||
|
return { path: '/' };
|
||||||
|
}
|
||||||
|
|
||||||
|
isRelogin.show = false;
|
||||||
|
const accessRoutes = await usePermissionStore().generateRoutes();
|
||||||
|
accessRoutes.forEach((route) => {
|
||||||
|
if (!isHttp(route.path)) router.addRoute(route);
|
||||||
|
});
|
||||||
|
|
||||||
|
$cache.local.remove('isCheckRole');
|
||||||
|
|
||||||
|
// 确保路由已添加后再跳转
|
||||||
|
return { ...to, replace: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未登录
|
||||||
|
if (isWhiteList(to.path)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const redirect = encodeURIComponent(to.fullPath || '/');
|
||||||
|
NProgress.done();
|
||||||
|
return { path: `/login?redirect=${redirect}` };
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
|
@ -88,6 +88,7 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const [err, res] = await to(getUserInfo());
|
const [err, res] = await to(getUserInfo());
|
||||||
|
console.log(111111111111);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
|
@ -133,8 +133,8 @@
|
|||||||
></el-col>
|
></el-col>
|
||||||
<el-col :span="12" :offset="0"
|
<el-col :span="12" :offset="0"
|
||||||
><el-form-item label="供应商" prop="supplier">
|
><el-form-item label="供应商" prop="supplier">
|
||||||
<el-select v-model="form.supplier" value-key="id" placeholder="请选择供应商" clearable filterable @change="">
|
<el-select v-model="form.supplierId" value-key="id" placeholder="请选择供应商" clearable filterable @change="">
|
||||||
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
|
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.supplierName" :value="item.id"> </el-option>
|
||||||
</el-select> </el-form-item
|
</el-select> </el-form-item
|
||||||
></el-col>
|
></el-col>
|
||||||
<el-col :span="12" :offset="0"
|
<el-col :span="12" :offset="0"
|
||||||
@ -268,6 +268,7 @@ import { useUserStoreHook } from '@/store/modules/user';
|
|||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import logisticsDetail from './comm/logisticsDetail.vue';
|
import logisticsDetail from './comm/logisticsDetail.vue';
|
||||||
import { FormRules } from 'element-plus';
|
import { FormRules } from 'element-plus';
|
||||||
|
import { listSupplierInput } from '@/api/supplierInput/supplierInput';
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -307,6 +308,8 @@ const initFormData: any = {
|
|||||||
docCode: undefined,
|
docCode: undefined,
|
||||||
supplier: undefined,
|
supplier: undefined,
|
||||||
reason: undefined,
|
reason: undefined,
|
||||||
|
supplierId: undefined,
|
||||||
|
|
||||||
name: undefined,
|
name: undefined,
|
||||||
arrivalDate: undefined,
|
arrivalDate: undefined,
|
||||||
designDirectorTel: undefined,
|
designDirectorTel: undefined,
|
||||||
@ -479,6 +482,7 @@ const submitForm = () => {
|
|||||||
form.value.associationList = form.value.planId?.map((item: any) => ({
|
form.value.associationList = form.value.planId?.map((item: any) => ({
|
||||||
planId: item
|
planId: item
|
||||||
}));
|
}));
|
||||||
|
form.value.supplier = supplierOptions.value.find((item) => item.id == form.value.supplierId)?.supplierName;
|
||||||
|
|
||||||
if (form.value.id) {
|
if (form.value.id) {
|
||||||
await updatePurchaseDoc(form.value).finally(() => (buttonLoading.value = false));
|
await updatePurchaseDoc(form.value).finally(() => (buttonLoading.value = false));
|
||||||
@ -514,10 +518,10 @@ const getBatchList = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getSupplierList = async () => {
|
const getSupplierList = async () => {
|
||||||
const res = await listContractor({
|
const res = await listSupplierInput({
|
||||||
projectId: currentProject.value?.id,
|
projectId: currentProject.value?.id,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
contractorType: 4,
|
state: 'finish',
|
||||||
pageSize: 10000
|
pageSize: 10000
|
||||||
});
|
});
|
||||||
supplierOptions.value = res.rows;
|
supplierOptions.value = res.rows;
|
||||||
|
@ -81,6 +81,11 @@
|
|||||||
<el-form-item label="公司名称" prop="name">
|
<el-form-item label="公司名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入公司名称" />
|
<el-input v-model="form.name" placeholder="请输入公司名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="供应商" prop="supplier">
|
||||||
|
<el-select v-model="form.supplierId" value-key="id" placeholder="请选择供应商" clearable filterable @change="">
|
||||||
|
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.supplierName" :value="item.id"> </el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="负责人" prop="principal">
|
<el-form-item label="负责人" prop="principal">
|
||||||
<el-input v-model="form.principal" placeholder="请输入负责人" />
|
<el-input v-model="form.principal" placeholder="请输入负责人" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -121,6 +126,7 @@ import { ContractorForm, ContractorQuery, ContractorVO } from '@/api/project/con
|
|||||||
import ContractorFileDialog from '@/views/project/contractor/component/ContractorFileDialog.vue';
|
import ContractorFileDialog from '@/views/project/contractor/component/ContractorFileDialog.vue';
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
import { getDicts, listData } from '@/api/system/dict/data';
|
import { getDicts, listData } from '@/api/system/dict/data';
|
||||||
|
import { listSupplierInput } from '@/api/supplierInput/supplierInput';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
@ -152,6 +158,8 @@ const initFormData: ContractorForm = {
|
|||||||
principalPhone: undefined,
|
principalPhone: undefined,
|
||||||
custodian: undefined,
|
custodian: undefined,
|
||||||
custodianPhone: undefined,
|
custodianPhone: undefined,
|
||||||
|
supplierId: undefined,
|
||||||
|
supplier: undefined,
|
||||||
contractorType: undefined,
|
contractorType: undefined,
|
||||||
fileMap: undefined,
|
fileMap: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
@ -257,6 +265,8 @@ const submitForm = () => {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
form.value.projectId = currentProject.value?.id;
|
form.value.projectId = currentProject.value?.id;
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
|
form.value.supplier = supplierOptions.value.find((item) => item.id == form.value.supplierId)?.supplierName;
|
||||||
|
|
||||||
if (form.value.id) {
|
if (form.value.id) {
|
||||||
await updateContractor(form.value).finally(() => (buttonLoading.value = false));
|
await updateContractor(form.value).finally(() => (buttonLoading.value = false));
|
||||||
} else {
|
} else {
|
||||||
@ -278,15 +288,16 @@ const handleDelete = async (row?: ContractorVO) => {
|
|||||||
await getList();
|
await getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 获取供应商 */
|
||||||
const handleExport = () => {
|
const supplierOptions = ref([]);
|
||||||
proxy?.download(
|
const getSupplierList = async () => {
|
||||||
'project/contractor/export',
|
const res = await listSupplierInput({
|
||||||
{
|
projectId: currentProject.value?.id,
|
||||||
...queryParams.value
|
pageNum: 1,
|
||||||
},
|
state: 'finish',
|
||||||
`contractor_${new Date().getTime()}.xlsx`
|
pageSize: 10000
|
||||||
);
|
});
|
||||||
|
supplierOptions.value = res.rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 文件操作 **/
|
/** 文件操作 **/
|
||||||
@ -304,6 +315,7 @@ const listeningProject = watch(
|
|||||||
queryParams.value.projectId = nid;
|
queryParams.value.projectId = nid;
|
||||||
form.value.projectId = nid;
|
form.value.projectId = nid;
|
||||||
console.log('监听项目id', queryParams.value.projectId, form.value.projectId);
|
console.log('监听项目id', queryParams.value.projectId, form.value.projectId);
|
||||||
|
getSupplierList();
|
||||||
getList();
|
getList();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -314,5 +326,6 @@ onUnmounted(() => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDictList();
|
getDictList();
|
||||||
getList();
|
getList();
|
||||||
|
getSupplierList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -275,6 +275,7 @@
|
|||||||
<el-row class="mb-4">
|
<el-row class="mb-4">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="入库资料" prop="inputFile">
|
<el-form-item label="入库资料" prop="inputFile">
|
||||||
|
<template #label> <span class="text-red">*</span> 入库资料 </template>
|
||||||
<file-upload
|
<file-upload
|
||||||
v-model="form.inputFile"
|
v-model="form.inputFile"
|
||||||
:fileType="['doc', 'docx', 'pdf']"
|
:fileType="['doc', 'docx', 'pdf']"
|
||||||
|
Reference in New Issue
Block a user