Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
1、改bug
2、去掉consol.log和console.dir
  • Loading branch information
ZreoDark committed Dec 24, 2024
1 parent 5d13be3 commit 7fda95e
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 90 deletions.
9 changes: 4 additions & 5 deletions pm-resource-server/src/graphql/resolvers/agreements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { dbid2id } from "../../util/utils";
export default {
Query: {
agreements: async (_: any, __: any, context: AuthContext) => {
// console.dir(__, { depth: null, colors: true });

let { page, pageSize, name, customer, type } = __;
if (!page || page === 0) {
page = 1;
Expand Down Expand Up @@ -66,7 +66,6 @@ export default {
// maintenanceFreePeriod,
...agreement
} = args.agreement;
// console.dir(args.agreement, { depth: null, colors: true });
if (!id) {
agreement.createDate = moment()
.utc()
Expand Down Expand Up @@ -97,7 +96,7 @@ export default {
} // 更新 contractState 字段
).then((res) => proID || res.upsertedId._id);
});
// console.dir(agreement.contactProj, { depth: null, color: true });

delete agreement.contactProj;
if (!id) {
return Agreement.updateOne(
Expand All @@ -113,7 +112,7 @@ export default {
}
},
payWaySub: async (_: any, args: any, context: AuthContext) => {
// console.dir(args, { depth: null, color: true });

let { milestone, ...agreement } = args.agreement;

// 遍历 milestone 并插入数据
Expand Down Expand Up @@ -152,7 +151,7 @@ export default {
return data;
});

console.dir(inserts, { depth: null, color: true });

await Promise.all(
inserts.map(async (item) => {
// PaymentManage.updateOne(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { dbid2id } from "../../util/utils";
export default {
Query: {
contractPaymentManages: async (_: any, __: any, context: AuthContext) => {
// console.dir(__, { depth: null, colors: true });

let { page, pageSize, name, customer, type } = __;
if (!page || page === 0) {
page = 1;
Expand Down Expand Up @@ -59,13 +59,13 @@ export default {
},
Mutation: {
contractPaymentSub: async (_: any, args: any, context: AuthContext) => {
console.dir(args.agreement, { depth: null, colors: true });

//actualQuarter\expectedQuarter\payState
let temp = JSON.parse(JSON.stringify(args.agreement));
temp.actualQuarter = args.agreement.actualQuarter[0];
temp.expectedQuarter = args.agreement.expectedQuarter[0];
temp.payState = args.agreement.payState[0];
console.dir(temp, { depth: null, colors: true });

return PaymentManage.updateOne(
{
$or: [{ _id: new ObjectId(temp.id) }, { _id: temp.id }],
Expand All @@ -75,7 +75,7 @@ export default {
},
// pushAgreement: async (_: any, args: any, context: AuthContext) => {
// const { id, ...agreement } = args.agreement;
// // console.dir(args.agreement, { depth: null, colors: true });

// if (!id) {
// agreement.createDate = moment()
// .utc()
Expand All @@ -99,7 +99,7 @@ export default {
// { $set: { contractState: 1 } } // 更新 contractState 字段
// ).then((res) => proID || res.upsertedId._id);
// });
// console.dir(agreement.contactProj, { depth: null, color: true });

// delete agreement.contactProj;
// if (!id) {
// return Agreement.updateOne(
Expand All @@ -115,7 +115,7 @@ export default {
// }
// },
// payWaySub: async (_: any, args: any, context: AuthContext) => {
// // console.dir(args, { depth: null, color: true });

// let { milestone, ...agreement } = args.agreement;
// // 遍历 milestone 并插入数据
// const inserts = milestone.map((item) => ({
Expand Down Expand Up @@ -145,7 +145,7 @@ export default {
// milestoneValue: item.value, // 添加 milestoneValue
// }));

// // console.dir(agreement.id, { depth: null, color: true });

// await Agreement.updateOne(
// { $or: [{ _id: new ObjectId(agreement.id) }] },
// {
Expand All @@ -155,7 +155,7 @@ export default {
// },
// }
// ).then((e) => {
// // console.dir(e, { depth: null, color: true });

// });
// delete agreement._id;
// return PaymentManage.insertMany(inserts).then(
Expand Down
32 changes: 15 additions & 17 deletions pm-resource-server/src/graphql/resolvers/projs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@ const getTodoProjects = (projects: any[]) => {
return true;
}
if (result?.groups?.projType === "SZ") {
// 售中
// 售中 验收期与当前日期小于90天,返回该条数据
if (project.acceptDate) {
const dayDiff = moment(project.acceptDate).diff(new Date(), "day");
if (dayDiff <= 90 && dayDiff > 0) {
return true;
}
}
} else if (result?.groups?.projType === "SH") {
// 售后 服务周期 启动日期
if (project.startTime && project.serviceCycle) {
const today = new Date();
// 启动周期和当前时间的差值,已服务了几个月
const monthDiff = moment(today).diff(project.startTime, "month");
// 服务周期-已服务了的,如果小于等于3个月,大于0个月,就返回该条数据
if (
project.serviceCycle - monthDiff <= 3 &&
project.serviceCycle - monthDiff > -1
Expand All @@ -44,6 +47,7 @@ const getTodoProjects = (projects: any[]) => {
}
}
}
return false
});
return projectResult;
};
Expand Down Expand Up @@ -187,7 +191,7 @@ export default {
// ];
// }

// console.dir(filter, { depth: null, colors: true });

const result = await Project.find(filter)
.skip(skip)
.limit(pageSize)
Expand All @@ -206,7 +210,7 @@ export default {
})
.map(dbid2id)
.toArray(); //合同数据
// console.dir(agreement, { depth: null, colors: true });

const oneResult = result.find((res) => res.id === pa._id);
oneResult.agreements = agreement;
})
Expand All @@ -222,7 +226,7 @@ export default {
if (customer) oneResult.customerObj = dbid2id(customer);
})
);
// console.dir(filter, { depth: null, colors: true });

const total = await Project.find(filter).count();

return {
Expand Down Expand Up @@ -391,10 +395,10 @@ export default {
const regexArray: RegExp[] = [];
if (!regions || regions.length == 0) regions = ["\\w*"];
if (!industries || industries.length == 0) industries = ["\\w*"];
if (!projTypes || projTypes.length == 0) projTypes = ["SH", "SZ"];
if (!projTypes || projTypes.length == 0) projTypes = ["SH", "SZ","SQ",'YF','ZH','QT'];

projTypes = projTypes.filter(
(projType) => projType === "SH" || projType === "SZ"
(projType) => projType === "SH" || projType === "SZ" || projType === "SQ" || projType === "YF" || projType === "ZH" || projType === "QT"
);
if (confirmYear) {
filter["confirmYear"] = confirmYear;
Expand Down Expand Up @@ -426,7 +430,6 @@ export default {
.map(dbid2id)
.toArray();
result = getTodoProjects(result);

const projIds = result.map((proj) => proj.id);
const projAggrement = await ProjectAgreement.find({
_id: { $in: projIds },
Expand Down Expand Up @@ -782,7 +785,7 @@ export default {
}

filter["_id"] = { $in: regexArray, $not: /-ZH-/ };
console.dir(filter, { depth: null, colors: true });

const result = await Project.find(filter)
.sort({ createDate: -1 })
.map(dbid2id)
Expand Down Expand Up @@ -920,14 +923,14 @@ export default {

// 获取旧项目数据
const oldId = proj.oldId;
// console.dir(oldId, { depth: null, colors: true });

// 删除 `oldId` 对应的数据
if (oldId) {
await Project.deleteOne({ _id: oldId });
}
// 判断是否有此项目,如果没有则为第一次创建
let repeat = await Project.findOne({ _id: id });
// console.dir(repeat, { depth: null, colors: true });


if (isNil(repeat)) {
proj.createDate = moment()
Expand All @@ -939,9 +942,6 @@ export default {
proj.createDate = repeat.createDate;
proj.isArchive = repeat.isArchive;
}
// console.dir(proj, { depth: null, colors: true });
// console.dir(id, { depth: null, colors: true });
// return 123;
// // 更新或新增项目
proj.updateTime = moment()
.utc()
Expand All @@ -955,13 +955,11 @@ export default {
{ $set: proj },
{ upsert: true }
).then((res) => {
console.dir(res, { depth: null, colors: true });
console.dir(id, { depth: null, colors: true });
return id || res.upsertedId._id;
});
},
checkProj: async (_: any, args: any, context: AuthContext) => {
// console.dir(args, { depth: null, colors: true });

let { id, checkState, reason, incomeConfirm } = args;
return Project.updateOne(
{ _id: id },
Expand All @@ -970,7 +968,7 @@ export default {
)
.then((res) => id || res.upsertedId._id)
.catch((e) => {
// console.dir(e, { depth: null, colors: true });

});
},
archiveProject: async (_: any, args: any, context: AuthContext) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ const layout = {
};

export default (form: FormInstance<AgreementInput>, data?: AgreementInput) => {
// console.log(data, 'data JJJJJJ');

const { data: resData } = useQuery<Query>(userQuery, {
fetchPolicy: 'no-cache',
variables: {
customersPageSize: 10000000,
},
});
// console.log(resData, 'resData JJJJJ');

// 初始化时计算款项金额
useEffect(() => {
const { contractAmount, milestoneValue } = data;
Expand All @@ -93,7 +93,7 @@ export default (form: FormInstance<AgreementInput>, data?: AgreementInput) => {
const [payState, setPayState] = useState();
const [expectedQuarter, setExpectedQuarter] = useState();
let files = data?.paymentFileList ? (data?.paymentFileList as UploadFile[]) : [];
console.log(files, 'paymentFileList KKLLKKLL');

const props: UploadProps = {
listType: 'picture-card',
action: '/api/upload/tmp',
Expand All @@ -107,7 +107,7 @@ export default (form: FormInstance<AgreementInput>, data?: AgreementInput) => {
let fileList = form.getFieldValue('paymentFileList')
? form.getFieldValue('paymentFileList')
: [];
console.log(fileList, 'fileList LLLLLL');

if (fileList.filter((item: any) => item.name === file.name).length) {
message.warning('请不要上传相同名字的文件');
return Upload.LIST_IGNORE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export function useAgreementState() {
const payWaySub = useCallback(
async (agreement: AgreementInput) => {
let reqAgreement = await attachmentUpload(agreement);
console.log(reqAgreement, 'reqAgreement JJJJJJJ');

await contractPaymentSubSubHandle({
variables: {
agreement: { ...reqAgreement },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Agreement: React.FC<any> = () => {

// agreement.contactProj = projArr;
// agreement.time = [moment(agreement.startTime), moment(agreement.endTime)];
// console.log(agreement, 'agreement KKKKK');

payWayref.current?.showDialog({
...agreement,
});
Expand Down Expand Up @@ -106,7 +106,7 @@ const Agreement: React.FC<any> = () => {
};
const [projInfo, setProjInfo] = useState();
const payWayBtn = (record:any) => {
// console.log(record, 'MMMMJJJJJ');

setProjInfo(record);
payWayref.current?.showDialog({
...record,
Expand Down
2 changes: 1 addition & 1 deletion pm-web-app/src/pages/InfoManage/Region/Edit/RegionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const layout = {

export default (form: FormInstance<RegionInput>, data?: RegionInput) => {
const { regionones } = useRegionState();
console.log(regionones,'regionones LLLLLL')

return (
<Form {...layout} form={form} initialValues={data}>
<Form.Item label="一级区域" name="parentId">
Expand Down
2 changes: 1 addition & 1 deletion pm-web-app/src/pages/Project/Edit/EditActive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const Project: React.FC<any> = () => {
const [confirmYearOptions, setConfirmYearOptions] = useState([]);
useEffect(() => {
if (yearManages) {
console.log(yearManages, 'yearManages ====== LLLLLLL');

let yearManages_ = yearManages.filter((item) => item.enable == true);
setConfirmYearOptions(yearManages_);
}
Expand Down
Loading

0 comments on commit 7fda95e

Please sign in to comment.