明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
jt_backend
Commits
bb3d76a2
Commit
bb3d76a2
authored
Jan 21, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
27516f5e
Pipeline
#106430
passed with stage
in 3 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
+29
-20
projectThController.js
controller/projectThController.js
+20
-20
index.js
db/index.js
+9
-0
No files found.
controller/projectThController.js
View file @
bb3d76a2
...
...
@@ -134,7 +134,7 @@ async function createYyqtzjc(req, res, next) {
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
ret
=
await
DB
.
Th
Tz
Yyqtzjc
.
create
(
req
.
body
);
let
ret
=
await
DB
.
ThYyqtzjc
.
create
(
req
.
body
);
//日常自查 投资(成本)分析会
let
yyqtzjcTzfxs
=
req
.
body
.
yyqtzjcTzfxs
||
[];
...
...
@@ -170,9 +170,9 @@ async function createYyqtzjc(req, res, next) {
delete
req
.
body
.
yyqtzjcZxjcs
;
//创建
await
DB
.
Th
Tz
YyqtzjcTzfx
.
bulkCreate
(
yyqtzjcTzfxs
);
// await DB.Th
Tz
Yyqtzjcrcjc.bulkCreate(yyqtzjcrcjcs);
await
DB
.
Th
Tz
YyqtzjcZxjc
.
bulkCreate
(
yyqtzjcZxjcs
);
await
DB
.
ThYyqtzjcTzfx
.
bulkCreate
(
yyqtzjcTzfxs
);
// await DB.ThYyqtzjcrcjc.bulkCreate(yyqtzjcrcjcs);
await
DB
.
ThYyqtzjcZxjc
.
bulkCreate
(
yyqtzjcZxjcs
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -188,27 +188,27 @@ async function getYyqtzjcInfo(req, res, next) {
if
(
_
.
isEmpty
(
search
))
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
jsqtzjc
=
await
DB
.
Th
Tz
Yyqtzjc
.
findOne
({
where
:
search
,
raw
:
true
});
let
jsqtzjc
=
await
DB
.
ThYyqtzjc
.
findOne
({
where
:
search
,
raw
:
true
});
if
(
!
(
jsqtzjc
&&
jsqtzjc
.
id
&&
jsqtzjc
.
projectId
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
newyyqtzjcTzfxs
=
[],
newyyqtzjcrcjcs
=
[],
newyyqtzjcZxjcs
=
[];
let
yyqtzjcTzfxs
=
await
DB
.
Th
Tz
YyqtzjcTzfx
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
,
sourceId
:
req
.
body
.
id
},
raw
:
true
});
let
yyqtzjcTzfxs
=
await
DB
.
ThYyqtzjcTzfx
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
,
sourceId
:
req
.
body
.
id
},
raw
:
true
});
for
(
let
index
=
0
;
index
<
yyqtzjcTzfxs
.
length
;
index
++
)
{
let
element
=
yyqtzjcTzfxs
[
index
];
// fileids.concat(element.tzcbfxhzl || []);
element
.
tzcbfxhzl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
element
.
tzcbfxhzl
}
}
});
newyyqtzjcTzfxs
.
push
(
element
);
}
// let yyqtzjcrcjcs = await DB.Th
Tz
Yyqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId , sourceId: req.body.id}, raw: true });
// let yyqtzjcrcjcs = await DB.ThYyqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId , sourceId: req.body.id}, raw: true });
// for (let index = 0; index < yyqtzjcrcjcs.length; index++) {
// const element = yyqtzjcrcjcs[index];
// // fileids.concat(element.fxcl || []);
// element.fxcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fxcl } } });
// newyyqtzjcrcjcs.push(element);
// }
let
yyqtzjcZxjcs
=
await
DB
.
Th
Tz
YyqtzjcZxjc
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
,
sourceId
:
req
.
body
.
id
},
raw
:
true
});
let
yyqtzjcZxjcs
=
await
DB
.
ThYyqtzjcZxjc
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
,
sourceId
:
req
.
body
.
id
},
raw
:
true
});
for
(
let
index
=
0
;
index
<
yyqtzjcZxjcs
.
length
;
index
++
)
{
const
element
=
yyqtzjcZxjcs
[
index
];
// fileids.concat(element.fjcl || []);
...
...
@@ -244,9 +244,9 @@ async function updateYyqtzjc(req, res, next) {
newArr
.
push
(
element
);
}
}
await
DB
.
Th
Tz
YyqtzjcTzfx
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
sourceId
:
req
.
body
.
id
,
id
:
{
[
Op
.
notIn
]:
ids
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
Th
Tz
YyqtzjcTzfx
.
bulkCreate
(
newArr
);
//创建新的 没有id的
await
Promise
.
all
(
info
.
map
(
item
=>
{
DB
.
Th
Tz
YyqtzjcTzfx
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
await
DB
.
ThYyqtzjcTzfx
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
sourceId
:
req
.
body
.
id
,
id
:
{
[
Op
.
notIn
]:
ids
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
ThYyqtzjcTzfx
.
bulkCreate
(
newArr
);
//创建新的 没有id的
await
Promise
.
all
(
info
.
map
(
item
=>
{
DB
.
ThYyqtzjcTzfx
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
delete
req
.
body
.
yyqtzjcTzfxs
;
// let yyqtzjcrcjcs = req.body.yyqtzjcrcjcs || [];
...
...
@@ -262,9 +262,9 @@ async function updateYyqtzjc(req, res, next) {
// newArr1.push(element);
// }
// }
// await DB.Th
Tz
Yyqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.Th
Tz
Yyqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
// await Promise.all(info1.map(item => { DB.Th
Tz
Yyqtzjcrcjc.update(item, { where: { id: item.id } }) }));
// await DB.ThYyqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.ThYyqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
// await Promise.all(info1.map(item => { DB.ThYyqtzjcrcjc.update(item, { where: { id: item.id } }) }));
// delete req.body.yyqtzjcrcjcs;
...
...
@@ -282,12 +282,12 @@ async function updateYyqtzjc(req, res, next) {
newArr2
.
push
(
element
);
}
}
await
DB
.
Th
Tz
YyqtzjcZxjc
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
sourceId
:
req
.
body
.
id
,
id
:
{
[
Op
.
notIn
]:
ids2
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
Th
Tz
YyqtzjcZxjc
.
bulkCreate
(
newArr2
);
//创建新的 没有id的
await
Promise
.
all
(
info2
.
map
(
item
=>
{
DB
.
Th
Tz
YyqtzjcZxjc
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
await
DB
.
ThYyqtzjcZxjc
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
sourceId
:
req
.
body
.
id
,
id
:
{
[
Op
.
notIn
]:
ids2
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
ThYyqtzjcZxjc
.
bulkCreate
(
newArr2
);
//创建新的 没有id的
await
Promise
.
all
(
info2
.
map
(
item
=>
{
DB
.
ThYyqtzjcZxjc
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
delete
req
.
body
.
yyqtzjcZxjcs
;
await
DB
.
Th
Tz
Yyqtzjc
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
await
DB
.
ThYyqtzjc
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -318,7 +318,7 @@ async function getYyqtzjcList(req, res, next) {
if
(
req
.
body
.
attributes
&&
req
.
body
.
attributes
.
length
)
{
search
.
attributes
=
req
.
body
.
attributes
;
}
let
ret
=
await
DB
.
Th
Tz
Yyqtzjc
.
findAndCountAll
(
search
);
let
ret
=
await
DB
.
ThYyqtzjc
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -539,7 +539,7 @@ async function deleteYyqtzhs(req, res, next) {
}
async
function
deleteYyqtzjc
(
req
,
res
,
next
)
{
try
{
await
DB
.
Th
Tz
Yyqtzjc
.
update
({
del
:
1
},
{
where
:
{
id
:
req
.
body
.
id
}
});
await
DB
.
ThYyqtzjc
.
update
({
del
:
1
},
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
...
...
db/index.js
View file @
bb3d76a2
...
...
@@ -77,6 +77,10 @@ const ThYyqtzjcTzfx = require('./model/jt/thYyqtzjcTzfx');
const
ThYyqtzjcZxjc
=
require
(
'./model/jt/thYyqtzjcZxjc'
);
const
ThYyqtzjcrcjc
=
require
(
'./model/jt/thYyqtzjcrcjc'
);
const
ThYjgl
=
require
(
"./model/jt/thYjgl"
);
const
ThYyqtzjc
=
require
(
'./model/jt/thYyqtzjc'
)
const
ThYyqtzjcTzfx
=
require
(
'./model/jt/thYyqtzjcTzfx'
)
const
ThYyqtzjcZxjc
=
require
(
'./model/jt/thYyqtzjcZxjc'
)
const
RcTxjs
=
require
(
'./model/jt/rcTxjs'
);
const
RcTxjsWj
=
require
(
'./model/jt/rcTxjswj'
);
...
...
@@ -165,6 +169,11 @@ global.DB = {
RcCgqygl
,
RcCgqyglTzfh
,
RcCgqyglWtyy
,
ThYyqtzjc
,
ThYyqtzjcTzfx
,
ThYyqtzjcZxjc
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment