明树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
742f9ba0
Commit
742f9ba0
authored
Dec 26, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
aefdc8f2
Pipeline
#105224
passed with stage
in 4 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
239 additions
and
0 deletions
+239
-0
projectTzController.js
controller/projectTzController.js
+103
-0
index.js
db/index.js
+8
-0
tzZdsxsp.js
db/model/jt/tzZdsxsp.js
+56
-0
tzZdsxspfl.js
db/model/jt/tzZdsxspfl.js
+67
-0
projectRouter.js
router/projectRouter.js
+5
-0
No files found.
controller/projectTzController.js
View file @
742f9ba0
...
@@ -744,6 +744,105 @@ async function getJsqtzjcList (req, res, next) {
...
@@ -744,6 +744,105 @@ async function getJsqtzjcList (req, res, next) {
next
(
error
);
next
(
error
);
}
}
}
}
async
function
createZdsxsp
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
//日常自查 投资(成本)分析会
let
zdsxspfls
=
req
.
body
.
zdsxspfls
||
[];
let
newArr
=
[];
for
(
let
index
=
0
;
index
<
zdsxspfls
.
length
;
index
++
)
{
const
element
=
zdsxspfls
[
index
];
element
.
projectId
=
projectId
;
element
.
wj
=
(
element
.
wj
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
newArr
.
push
(
element
);
}
delete
req
.
body
.
zdsxspfls
;
await
DB
.
TzZdsxspfl
.
bulkCreate
(
newArr
);
let
ret
=
await
DB
.
TzZdsxsp
.
create
(
req
.
body
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
getZdsxspInfo
(
req
,
res
,
next
)
{
try
{
let
search
=
{};
if
(
req
.
body
.
id
)
{
search
.
id
=
req
.
body
.
id
;
}
if
(
req
.
body
.
projectId
)
{
search
.
projectId
=
req
.
body
.
projectId
;
}
if
(
_
.
isEmpty
(
search
))
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
zdsxsp
=
await
DB
.
TzZdsxsp
.
findOne
({
where
:
search
,
raw
:
true
});
if
(
!
(
zdsxsp
&&
zdsxsp
.
id
&&
zdsxsp
.
projectId
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
zdsxspfls
=
await
DB
.
TzZdsxspfl
.
findAll
({
where
:
{
projectId
:
req
.
body
.
projectId
},
raw
:
true
,
});
let
newArr
=
[];
for
(
let
index
=
0
;
index
<
zdsxspfls
.
length
;
index
++
)
{
const
element
=
zdsxspfls
[
index
];
if
(
element
.
wj
&&
element
.
wj
.
length
>
0
)
{
element
.
wj
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
element
.
wj
}},
raw
:
true
});
}
newArr
.
push
(
element
);
}
zdsxsp
.
zdsxspfls
=
zdsxspfls
;
return
res
.
sendData
(
zdsxsp
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updateZdsxsp
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
getZdsxspList
(
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.projectName) {
// where = {
// [Op.or]: [
// { projectName: { [Op.like]: `%${req.body.projectName}%` } },
// ],
// del: 0
// }
// }
search
.
where
=
where
;
if
(
req
.
body
.
attributes
&&
req
.
body
.
attributes
.
length
)
{
search
.
attributes
=
req
.
body
.
attributes
;
}
let
ret
=
await
DB
.
TzJsqtzjc
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
...
@@ -768,4 +867,8 @@ module.exports = {
...
@@ -768,4 +867,8 @@ module.exports = {
updateJsqtzjc
,
updateJsqtzjc
,
getJsqtzjcList
,
getJsqtzjcList
,
getJsqtzjcInfo
,
getJsqtzjcInfo
,
createZdsxsp
,
getZdsxspInfo
,
updateZdsxsp
,
getZdsxspList
,
}
}
\ No newline at end of file
db/index.js
View file @
742f9ba0
...
@@ -56,6 +56,12 @@ const TzJsqtzjc = require("./model/jt/tzJsqtzjc");
...
@@ -56,6 +56,12 @@ const TzJsqtzjc = require("./model/jt/tzJsqtzjc");
const
TzJsqtzjcTzfx
=
require
(
"./model/jt/tzJsqtzjcTzfx"
);
const
TzJsqtzjcTzfx
=
require
(
"./model/jt/tzJsqtzjcTzfx"
);
const
TzJsqtzjcrcjc
=
require
(
"./model/jt/tzJsqtzjcrcjc"
);
const
TzJsqtzjcrcjc
=
require
(
"./model/jt/tzJsqtzjcrcjc"
);
const
TzJsqtzjcZxjc
=
require
(
"./model/jt/tzJsqtzjcZxjc"
);
const
TzJsqtzjcZxjc
=
require
(
"./model/jt/tzJsqtzjcZxjc"
);
const
TzZdsxsp
=
require
(
"./model/jt/tzZdsxsp"
);
const
TzZdsxspfl
=
require
(
"./model/jt/tzZdsxspfl"
);
/**
/**
* 业务表
* 业务表
*/
*/
...
@@ -112,6 +118,8 @@ global.DB = {
...
@@ -112,6 +118,8 @@ global.DB = {
TzJsqtzjcTzfx
,
TzJsqtzjcTzfx
,
TzJsqtzjcrcjc
,
TzJsqtzjcrcjc
,
TzJsqtzjcZxjc
,
TzJsqtzjcZxjc
,
TzZdsxsp
,
TzZdsxspfl
,
}
}
...
...
db/model/jt/tzZdsxsp.js
0 → 100644
View file @
742f9ba0
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
//投中管理- 重大事项审批
const
TzZdsxsp
=
sequelize
.
define
(
'TzZdsxsp'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
/* -------------------------------------------------------- */
projectId
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"所属项目ID"
,
},
del
:
{
type
:
DataTypes
.
INTEGER
,
defaultValue
:
0
,
comment
:
"0 正常 1 删除"
},
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_tz_zdsxsp'
,
// 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
TzZdsxsp
.
sync
({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter
:
true
})
.
then
(()
=>
{
console
.
log
(
'TzZdsxsp 表同步成功'
);
});
module
.
exports
=
TzZdsxsp
;
\ No newline at end of file
db/model/jt/tzZdsxspfl.js
0 → 100644
View file @
742f9ba0
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
//投中管理- 重大事项审批分类
const
TzZdsxspfl
=
sequelize
.
define
(
'TzZdsxspfl'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
lx
:
{
type
:
DataTypes
.
JSON
,
comment
:
"类型---级联选择"
},
sm
:
{
type
:
DataTypes
.
TEXT
,
comment
:
"说明"
},
wj
:
{
type
:
DataTypes
.
JSON
,
comment
:
"文件"
},
projectId
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"所属项目ID"
,
},
del
:
{
type
:
DataTypes
.
INTEGER
,
defaultValue
:
0
,
comment
:
"0 正常 1 删除"
},
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_tz_zdsxspfl'
,
// 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
TzZdsxspfl
.
sync
({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter
:
true
})
.
then
(()
=>
{
console
.
log
(
'TzZdsxspfl 表同步成功'
);
});
module
.
exports
=
TzZdsxspfl
;
\ No newline at end of file
router/projectRouter.js
View file @
742f9ba0
...
@@ -78,6 +78,11 @@ router.post('/createJsqtzjc', projectTzController.createJsqtzjc);
...
@@ -78,6 +78,11 @@ router.post('/createJsqtzjc', projectTzController.createJsqtzjc);
router
.
post
(
'/updateJsqtzjc'
,
projectTzController
.
updateJsqtzjc
);
router
.
post
(
'/updateJsqtzjc'
,
projectTzController
.
updateJsqtzjc
);
router
.
post
(
'/getJsqtzjcList'
,
projectTzController
.
getJsqtzjcList
);
router
.
post
(
'/getJsqtzjcList'
,
projectTzController
.
getJsqtzjcList
);
router
.
post
(
'/getJsqtzjcInfo'
,
projectTzController
.
getJsqtzjcInfo
);
router
.
post
(
'/getJsqtzjcInfo'
,
projectTzController
.
getJsqtzjcInfo
);
//重大事项审批
router
.
post
(
'/createZdsxsp'
,
projectTzController
.
createZdsxsp
);
router
.
post
(
'/updateZdsxsp'
,
projectTzController
.
updateZdsxsp
);
router
.
post
(
'/getZdsxspList'
,
projectTzController
.
getZdsxspList
);
router
.
post
(
'/getZdsxspInfo'
,
projectTzController
.
getZdsxspInfo
);
module
.
exports
=
router
;
module
.
exports
=
router
;
\ No newline at end of file
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