明树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
c7627521
Commit
c7627521
authored
Jan 27, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2250a8ff
Pipeline
#106647
passed with stage
in 3 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
309 additions
and
9 deletions
+309
-9
projectRcController.js
controller/projectRcController.js
+184
-4
rcTzgh.js
db/model/jt/rcTzgh.js
+114
-0
projectRouter.js
router/projectRouter.js
+11
-5
No files found.
controller/projectRcController.js
View file @
c7627521
const
errorMessage
=
require
(
"../utils/errorMessage"
);
const
_
=
require
(
"lodash"
);
const
{
Op
}
=
require
(
'sequelize'
);
// ---------------- 投资规划 RcTzgh ----------------
// 创建投资规划
async
function
createTzgh
(
req
,
res
,
next
)
{
try
{
req
.
body
.
creator
=
req
.
user
.
id
;
// let required = ['itemName', 'itemType', 'planYear', 'planCycle', 'planUnit', 'leadingDepartment', 'creatorName', 'creatorTime'];
// for (let key of required) {
// if (!req.body[key]) return res.sendError(errorMessage.paramsError);
// }
let
ret
=
await
DB
.
RcTzgh
.
create
(
req
.
body
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 更新投资规划
async
function
updateTzgh
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
return
res
.
sendError
(
errorMessage
.
paramsError
);
let
ret
=
await
DB
.
RcTzgh
.
findOne
({
where
:
{
id
:
req
.
body
.
id
},
raw
:
true
});
if
(
!
(
ret
&&
ret
.
id
))
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
await
DB
.
RcTzgh
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
// 获取单个投资规划
async
function
getTzgh
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
return
res
.
sendError
(
errorMessage
.
paramsError
);
let
info
=
await
DB
.
RcTzgh
.
findOne
({
where
:
{
id
:
req
.
body
.
id
,
del
:
0
}});
if
(
!
(
info
&&
info
.
id
))
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendData
(
info
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 获取投资规划列表
async
function
getTzghList
(
req
,
res
,
next
)
{
try
{
let
page
=
req
.
body
.
page
||
1
;
let
limit
=
req
.
body
.
pagesize
||
req
.
body
.
pageSize
||
10
;
let
offset
=
(
page
-
1
)
*
limit
;
let
search
=
{};
search
.
order
=
[[
'createdAt'
,
'DESC'
]];
search
.
limit
=
limit
;
search
.
offset
=
offset
;
let
where
=
{
del
:
0
};
if
(
req
.
body
.
itemName
)
{
where
.
itemName
=
{
[
Op
.
like
]:
`%
${
req
.
body
.
itemName
}
%`
};
}
if
(
req
.
body
.
planYear
)
{
where
.
planYear
=
req
.
body
.
planYear
;
}
if
(
req
.
body
.
projectId
)
{
where
.
projectId
=
req
.
body
.
projectId
;
}
search
.
where
=
where
;
if
(
req
.
body
.
attributes
&&
req
.
body
.
attributes
.
length
)
{
search
.
attributes
=
req
.
body
.
attributes
;
}
let
ret
=
await
DB
.
RcTzgh
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 删除投资规划
async
function
deleteTzgh
(
req
,
res
,
next
)
{
try
{
await
DB
.
RcTzgh
.
update
({
del
:
1
},
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
/**
* 日常管理 - 体系建设 (RcTxjs)
*/
const
errorMessage
=
require
(
"../utils/errorMessage"
);
const
_
=
require
(
"lodash"
);
const
{
Op
}
=
require
(
'sequelize'
);
async
function
createTxjs
(
req
,
res
,
next
)
{
try
{
...
...
@@ -214,7 +300,7 @@ async function getCgqyglList(req, res, next) {
let
ret
=
await
DB
.
RcCgqygl
.
findAndCountAll
(
search
);
let
risMap
=
await
projectModule
.
getResourceInfoMapByKeys
([
"xmjd"
]);
ret
.
rows
.
map
(
o
=>
{
o
.
xmscjd
=
risMap
[
o
.
xmscjd
]
||
o
.
xmscjd
;
return
o
;
});
ret
.
rows
.
map
(
o
=>
{
o
.
xmscjd
=
risMap
[
o
.
xmscjd
]
||
o
.
xmscjd
;
return
o
;
});
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -230,6 +316,88 @@ async function deleteCgqygl(req, res, next) {
}
}
// ---------------- 投委会管理 RcTwhgl ----------------
// 创建投委会
async
function
createTwhgl
(
req
,
res
,
next
)
{
try
{
req
.
body
.
creator
=
req
.
user
.
id
;
if
(
!
req
.
body
.
meetingCode
||
!
req
.
body
.
meetingName
||
!
req
.
body
.
meetingDate
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
ret
=
await
DB
.
RcTwhgl
.
create
(
req
.
body
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 更新投委会
async
function
updateTwhgl
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
ret
=
await
DB
.
RcTwhgl
.
findOne
({
where
:
{
id
:
req
.
body
.
id
},
raw
:
true
});
if
(
!
(
ret
&&
ret
.
id
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
await
DB
.
RcTwhgl
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
// 获取单个投委会
async
function
getTwhgl
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
return
res
.
sendError
(
errorMessage
.
paramsError
);
let
info
=
await
DB
.
RcTwhgl
.
findOne
({
where
:
{
id
:
req
.
body
.
id
,
del
:
0
},
raw
:
true
});
if
(
!
(
info
&&
info
.
id
))
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendData
(
info
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 获取投委会列表
async
function
getTwhglList
(
req
,
res
,
next
)
{
try
{
let
page
=
req
.
body
.
page
||
1
;
let
limit
=
req
.
body
.
pagesize
||
req
.
body
.
pageSize
||
10
;
let
offset
=
(
page
-
1
)
*
limit
;
let
search
=
{};
search
.
order
=
[[
'createdAt'
,
'DESC'
]];
search
.
limit
=
limit
;
search
.
offset
=
offset
;
let
where
=
{
del
:
0
};
if
(
req
.
body
.
meetingName
)
{
where
.
meetingName
=
{
[
Op
.
like
]:
`%
${
req
.
body
.
meetingName
}
%`
};
}
if
(
req
.
body
.
projectId
)
{
where
.
projectId
=
req
.
body
.
projectId
;
}
search
.
where
=
where
;
if
(
req
.
body
.
attributes
&&
req
.
body
.
attributes
.
length
)
{
search
.
attributes
=
req
.
body
.
attributes
;
}
let
ret
=
await
DB
.
RcTwhgl
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 删除投委会
async
function
deleteTwhgl
(
req
,
res
,
next
)
{
try
{
await
DB
.
RcTwhgl
.
update
({
del
:
1
},
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
createTxjs
,
updateTxjs
,
...
...
@@ -241,4 +409,16 @@ module.exports = {
getCgqygl
,
getCgqyglList
,
deleteCgqygl
,
// 投委会管理
createTwhgl
,
updateTwhgl
,
getTwhgl
,
getTwhglList
,
deleteTwhgl
,
createTzgh
,
updateTzgh
,
getTzgh
,
getTzghList
,
deleteTzgh
,
}
\ No newline at end of file
db/model/jt/rcTzgh.js
0 → 100644
View file @
c7627521
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
//投中管理- 建设期投资检查
const
RcTxjsWj
=
sequelize
.
define
(
'RcTxjsWj'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
itemName
:
{
type
:
DataTypes
.
STRING
(
200
),
comment
:
'事项名称'
},
itemType
:
{
type
:
DataTypes
.
STRING
(
100
),
comment
:
'事项类型'
},
planYear
:
{
type
:
DataTypes
.
DATE
,
comment
:
'编制年度'
,
get
()
{
const
rawValue
=
this
.
getDataValue
(
'planYear'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY'
)
:
''
;
}
},
planCycle
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
'规划周期(年)'
,
},
planUnit
:
{
type
:
DataTypes
.
STRING
(
100
),
comment
:
'编制单位'
},
leadingDepartment
:
{
type
:
DataTypes
.
STRING
(
100
),
comment
:
'牵头部门'
},
creatorName
:
{
type
:
DataTypes
.
STRING
(
50
),
comment
:
'填报人'
},
creatorTime
:
{
type
:
DataTypes
.
DATE
,
defaultValue
:
DataTypes
.
NOW
,
comment
:
'填报时间'
,
get
()
{
const
rawValue
=
this
.
getDataValue
(
'creatorTime'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
}
},
sjdwtzgh
:
{
type
:
DataTypes
.
JSON
,
comment
:
'上级单位投资规划'
},
bjdwtzgh
:
{
type
:
DataTypes
.
JSON
,
comment
:
' 2.本级单位投资规划'
},
qtcl
:
{
type
:
DataTypes
.
JSON
,
comment
:
'3.其他材料'
},
projectId
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"所属项目ID"
,
},
del
:
{
type
:
DataTypes
.
INTEGER
,
defaultValue
:
0
,
comment
:
"0 正常 1 删除"
},
creator
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"创建人"
},
createdAt
:
{
type
:
DataTypes
.
DATE
,
defaultValue
:
new
Date
(),
get
()
{
const
rawValue
=
this
.
getDataValue
(
'createdAt'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
}
},
updatedAt
:
{
// 同样处理 updatedAt
type
:
DataTypes
.
DATE
,
defaultValue
:
new
Date
(),
get
()
{
const
rawValue
=
this
.
getDataValue
(
'updatedAt'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
}
}
},
{
tableName
:
'jt_rc_rctxwj'
,
// 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
RcTxjsWj
.
sync
({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter
:
true
})
.
then
(()
=>
{
console
.
log
(
'RcTxjsWj 表同步成功'
);
});
module
.
exports
=
RcTxjsWj
;
\ No newline at end of file
router/projectRouter.js
View file @
c7627521
...
...
@@ -154,11 +154,11 @@ router.post('/getTxjsList', projectRcController.getTxjsList);
router
.
post
(
'/deleteTxjs'
,
projectRcController
.
deleteTxjs
);
//4.2 投资规划
//
router.post('/createTzgh', projectRcController.createTzgh);
//
router.post('/updateTzgh', projectRcController.updateTzgh);
//
router.post('/getTzgh', projectRcController.getTzgh);
//
router.post('/getTzghList', projectRcController.getTzghList);
//
router.post('/deleteTzgh', projectRcController.deleteTzgh);
router
.
post
(
'/createTzgh'
,
projectRcController
.
createTzgh
);
router
.
post
(
'/updateTzgh'
,
projectRcController
.
updateTzgh
);
router
.
post
(
'/getTzgh'
,
projectRcController
.
getTzgh
);
router
.
post
(
'/getTzghList'
,
projectRcController
.
getTzghList
);
router
.
post
(
'/deleteTzgh'
,
projectRcController
.
deleteTzgh
);
// 4.3 投资计划
...
...
@@ -169,7 +169,13 @@ router.post('/deleteTxjs', projectRcController.deleteTxjs);
//4.5 投委会管理
router
.
post
(
'/createTwhgl'
,
projectRcController
.
createTwhgl
);
router
.
post
(
'/updateTwhgl'
,
projectRcController
.
updateTwhgl
);
router
.
post
(
'/getTwhgl'
,
projectRcController
.
getTwhgl
);
router
.
post
(
'/getTwhglList'
,
projectRcController
.
getTwhglList
);
router
.
post
(
'/deleteTwhgl'
,
projectRcController
.
deleteTwhgl
);
//4.6 投资档案管理
...
...
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