明树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
ccb3856e
Commit
ccb3856e
authored
Dec 30, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
742f9ba0
Pipeline
#105417
passed with stage
in 3 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
321 additions
and
36 deletions
+321
-36
projectTzController.js
controller/projectTzController.js
+161
-35
index.js
db/index.js
+4
-0
tzJsqtzjc.js
db/model/jt/tzJsqtzjc.js
+5
-0
tzXmtc.js
db/model/jt/tzXmtc.js
+74
-0
tzXmtcCwzb.js
db/model/jt/tzXmtcCwzb.js
+65
-0
tzZdsxsp.js
db/model/jt/tzZdsxsp.js
+5
-1
projectRouter.js
router/projectRouter.js
+7
-0
No files found.
controller/projectTzController.js
View file @
ccb3856e
...
...
@@ -598,7 +598,7 @@ async function createJsqtzjc(req, res, next) {
}
}
async
function
getJsqtzjcInfo
(
req
,
res
,
next
)
{
async
function
getJsqtzjcInfo
(
req
,
res
,
next
)
{
try
{
let
search
=
{};
if
(
req
.
body
.
id
)
{
...
...
@@ -610,31 +610,31 @@ async function getJsqtzjcInfo (req, res, next) {
if
(
_
.
isEmpty
(
search
))
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
jsqtzjc
=
await
DB
.
TzJsqtzjc
.
findOne
({
where
:
search
,
raw
:
true
});
if
(
!
(
jsqtzjc
&&
jsqtzjc
.
id
&&
jsqtzjc
.
projectId
))
{
let
jsqtzjc
=
await
DB
.
TzJsqtzjc
.
findOne
({
where
:
search
,
raw
:
true
});
if
(
!
(
jsqtzjc
&&
jsqtzjc
.
id
&&
jsqtzjc
.
projectId
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
newjsqtzjcTzfxs
=
[],
newjsqtzjcrcjcs
=
[],
newjsqtzjcZxjcs
=
[];
let
jsqtzjcTzfxs
=
await
DB
.
TzJsqtzjcTzfx
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
},
raw
:
true
});
let
jsqtzjcTzfxs
=
await
DB
.
TzJsqtzjcTzfx
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
},
raw
:
true
});
for
(
let
index
=
0
;
index
<
jsqtzjcTzfxs
.
length
;
index
++
)
{
let
element
=
jsqtzjcTzfxs
[
index
];
// fileids.concat(element.tzcbfxhzl || []);
element
.
tzcbfxhzl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
element
.
tzcbfxhzl
}}
});
element
.
tzcbfxhzl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
element
.
tzcbfxhzl
}
}
});
newjsqtzjcTzfxs
.
push
(
element
);
}
let
jsqtzjcrcjcs
=
await
DB
.
TzJsqtzjcrcjc
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
},
raw
:
true
});
let
jsqtzjcrcjcs
=
await
DB
.
TzJsqtzjcrcjc
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
},
raw
:
true
});
for
(
let
index
=
0
;
index
<
jsqtzjcrcjcs
.
length
;
index
++
)
{
const
element
=
jsqtzjcrcjcs
[
index
];
// fileids.concat(element.fxcl || []);
element
.
fxcl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
element
.
fxcl
}}
});
element
.
fxcl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
element
.
fxcl
}
}
});
newjsqtzjcrcjcs
.
push
(
element
);
}
let
jsqtzjcZxjcs
=
await
DB
.
TzJsqtzjcZxjc
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
},
raw
:
true
});
let
jsqtzjcZxjcs
=
await
DB
.
TzJsqtzjcZxjc
.
findAll
({
where
:
{
projectId
:
jsqtzjc
.
projectId
},
raw
:
true
});
for
(
let
index
=
0
;
index
<
jsqtzjcZxjcs
.
length
;
index
++
)
{
const
element
=
jsqtzjcZxjcs
[
index
];
// fileids.concat(element.fjcl || []);
element
.
fjcl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
element
.
fjcl
}}
});
element
.
fjcl
=
await
DB
.
File
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
element
.
fjcl
}
}
});
newjsqtzjcZxjcs
.
push
(
element
);
}
...
...
@@ -657,8 +657,8 @@ async function updateJsqtzjc(req, res, next) {
for
(
let
index
=
0
;
index
<
jsqtzjcTzfxs
.
length
;
index
++
)
{
let
element
=
jsqtzjcTzfxs
[
index
];
element
.
projectId
=
req
.
body
.
projectId
;
element
.
tzcbfxhzl
=
(
element
.
tzcbfxhzl
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
element
.
tzcbfxhzl
=
(
element
.
tzcbfxhzl
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
ids
.
push
(
element
.
id
);
info
.
push
(
element
);
}
else
{
...
...
@@ -675,8 +675,8 @@ async function updateJsqtzjc(req, res, next) {
for
(
let
index
=
0
;
index
<
jsqtzjcrcjcs
.
length
;
index
++
)
{
let
element
=
jsqtzjcrcjcs
[
index
];
element
.
projectId
=
req
.
body
.
projectId
;
element
.
fxcl
=
(
element
.
fxcl
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
element
.
fxcl
=
(
element
.
fxcl
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
ids1
.
push
(
element
.
id
);
info1
.
push
(
element
);
}
else
{
...
...
@@ -694,8 +694,8 @@ async function updateJsqtzjc(req, res, next) {
for
(
let
index
=
0
;
index
<
jsqtzjcZxjcs
.
length
;
index
++
)
{
let
element
=
jsqtzjcZxjcs
[
index
];
element
.
projectId
=
req
.
body
.
projectId
;
element
.
fjcl
=
(
element
.
fjcl
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
element
.
fjcl
=
(
element
.
fjcl
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
ids2
.
push
(
element
.
id
);
info2
.
push
(
element
);
}
else
{
...
...
@@ -713,7 +713,7 @@ async function updateJsqtzjc(req, res, next) {
next
(
error
);
}
}
async
function
getJsqtzjcList
(
req
,
res
,
next
)
{
async
function
getJsqtzjcList
(
req
,
res
,
next
)
{
try
{
let
page
=
req
.
body
.
page
||
1
;
let
limit
=
req
.
body
.
pagesize
||
req
.
body
.
pageSize
||
10
;
...
...
@@ -754,8 +754,8 @@ async function createZdsxsp(req, res, next) {
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
});
element
.
projectId
=
req
.
body
.
projectId
;
element
.
wj
=
(
element
.
wj
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
newArr
.
push
(
element
);
}
delete
req
.
body
.
zdsxspfls
;
...
...
@@ -767,7 +767,7 @@ async function createZdsxsp(req, res, next) {
}
}
async
function
getZdsxspInfo
(
req
,
res
,
next
)
{
async
function
getZdsxspInfo
(
req
,
res
,
next
)
{
try
{
let
search
=
{};
if
(
req
.
body
.
id
)
{
...
...
@@ -779,23 +779,23 @@ async function getZdsxspInfo (req, res, next) {
if
(
_
.
isEmpty
(
search
))
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
zdsxsp
=
await
DB
.
TzZdsxsp
.
findOne
({
where
:
search
,
raw
:
true
});
if
(
!
(
zdsxsp
&&
zdsxsp
.
id
&&
zdsxsp
.
projectId
))
{
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
},
where
:
{
projectId
:
zdsxsp
.
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
});
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
;
zdsxsp
.
zdsxspfls
=
newArr
;
return
res
.
sendData
(
zdsxsp
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -806,13 +806,31 @@ async function updateZdsxsp(req, res, next) {
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
zdsxspfls
=
req
.
body
.
zdsxspfls
||
[];
let
ids
=
[],
info
=
[],
newArr
=
[];
for
(
let
index
=
0
;
index
<
zdsxspfls
.
length
;
index
++
)
{
const
element
=
zdsxspfls
[
index
];
element
.
projectId
=
req
.
body
.
projectId
;
element
.
wj
=
(
element
.
wj
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
ids
.
push
(
element
.
id
);
info
.
push
(
element
);
}
else
{
newArr
.
push
(
element
);
}
}
await
DB
.
TzZdsxspfl
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
id
:
{
[
Op
.
notIn
]:
ids
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
TzZdsxspfl
.
bulkCreate
(
newArr
);
//创建新的 没有id的
await
Promise
.
all
(
info
.
map
(
item
=>
{
DB
.
TzZdsxspfl
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
delete
req
.
body
.
zdsxspfls
;
await
DB
.
TzZdsxsp
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
getZdsxspList
(
req
,
res
,
next
)
{
async
function
getZdsxspList
(
req
,
res
,
next
)
{
try
{
let
page
=
req
.
body
.
page
||
1
;
let
limit
=
req
.
body
.
pagesize
||
req
.
body
.
pageSize
||
10
;
...
...
@@ -824,20 +842,124 @@ async function getZdsxspList (req, res, next) {
search
.
offset
=
offset
;
let
where
=
{
del
:
0
};
//
if (req.body.projectName) {
//
where = {
//
[Op.or]: [
//
{ projectName: { [Op.like]: `%${req.body.projectName}%` } },
//
],
//
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
);
let
ret
=
await
DB
.
TzZdsxsp
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
createXmtc
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
// 1. 文件
req
.
body
.
tcwj
=
(
req
.
body
.
tcwj
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
let
tccwzbs
=
(
req
.
body
.
tccwzbs
||
[]).
map
(
o
=>
{
o
.
projectId
=
req
.
body
.
projectId
;
return
o
;});
delete
req
.
body
.
tccwzbs
;
await
DB
.
TzXmtcCwzb
.
bulkCreate
(
tccwzbs
);
let
ret
=
await
DB
.
TzXmtc
.
create
(
req
.
body
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
getXmtcInfo
(
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
xmtc
=
await
DB
.
TzXmtc
.
findOne
({
where
:
search
,
raw
:
true
});
if
(
!
(
xmtc
&&
xmtc
.
id
&&
xmtc
.
projectId
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
tccwzbs
=
await
DB
.
TzXmtcCwzb
.
findAll
({
where
:
{
projectId
:
xmtc
.
projectId
},
raw
:
true
,
});
xmtc
.
tccwzbs
=
tccwzbs
;
return
res
.
sendData
(
xmtc
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updateXmtc
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
let
tccwzbs
=
req
.
body
.
tccwzbs
||
[];
let
ids
=
[],
info
=
[],
newArr
=
[];
for
(
let
index
=
0
;
index
<
tccwzbs
.
length
;
index
++
)
{
const
element
=
tccwzbs
[
index
];
element
.
projectId
=
req
.
body
.
projectId
;
element
.
wj
=
(
element
.
wj
||
[]).
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
if
(
element
.
id
)
{
ids
.
push
(
element
.
id
);
info
.
push
(
element
);
}
else
{
newArr
.
push
(
element
);
}
}
await
DB
.
TzXmtcCwzb
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
id
:
{
[
Op
.
notIn
]:
ids
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
TzXmtcCwzb
.
bulkCreate
(
newArr
);
//创建新的 没有id的
await
Promise
.
all
(
info
.
map
(
item
=>
{
DB
.
TzXmtcCwzb
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
delete
req
.
body
.
tccwzbs
;
await
DB
.
TzXmtc
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
getXmtcList
(
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
.
TzXmtc
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -871,4 +993,8 @@ module.exports = {
getZdsxspInfo
,
updateZdsxsp
,
getZdsxspList
,
createXmtc
,
getXmtcInfo
,
updateXmtc
,
getXmtcList
,
}
\ No newline at end of file
db/index.js
View file @
ccb3856e
...
...
@@ -61,6 +61,8 @@ const TzJsqtzjcZxjc = require("./model/jt/tzJsqtzjcZxjc");
const
TzZdsxsp
=
require
(
"./model/jt/tzZdsxsp"
);
const
TzZdsxspfl
=
require
(
"./model/jt/tzZdsxspfl"
);
const
TzXmtc
=
require
(
"./model/jt/tzXmtc"
);
const
TzXmtcCwzb
=
require
(
"./model/jt/tzXmtcCwzb"
);
/**
* 业务表
...
...
@@ -120,6 +122,8 @@ global.DB = {
TzJsqtzjcZxjc
,
TzZdsxsp
,
TzZdsxspfl
,
TzXmtc
,
TzXmtcCwzb
,
}
...
...
db/model/jt/tzJsqtzjc.js
View file @
ccb3856e
...
...
@@ -9,6 +9,11 @@ const TzJsqtzjc = sequelize.define('TzJsqtzjc', {
primaryKey
:
true
,
autoIncrement
:
true
},
projectName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目名称"
,
},
jcztz
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
comment
:
"决策总投资 一次填报锁定"
...
...
db/model/jt/tzXmtc.js
0 → 100644
View file @
ccb3856e
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
//投中管理- 重大事项审批
const
TzXmtc
=
sequelize
.
define
(
'TzXmtc'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
/* -------------------TODO: 缺少内容------------------------------------- */
projectName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目名称"
,
},
tcfs
:
{
type
:
DataTypes
.
STRING
,
comment
:
"退出方式"
},
sjtcrq
:
{
type
:
DataTypes
.
DATE
,
comment
:
"实际退出日期"
},
tcwj
:
{
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_xmtc'
,
// 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
TzXmtc
.
sync
({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter
:
true
})
.
then
(()
=>
{
console
.
log
(
'TzXmtc 表同步成功'
);
});
module
.
exports
=
TzXmtc
;
\ No newline at end of file
db/model/jt/tzXmtcCwzb.js
0 → 100644
View file @
ccb3856e
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
//投中管理- 重大事项审批
const
TzXmtcCwzb
=
sequelize
.
define
(
'TzXmtcCwzb'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
/* -------------------TODO: 缺少内容------------------------------------- */
zbmc
:
{
type
:
DataTypes
.
STRING
,
comment
:
"指标名称"
,
},
zbsz
:
{
type
:
DataTypes
.
INTEGER
,
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_xmtccwzb'
,
// 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
TzXmtcCwzb
.
sync
({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter
:
true
})
.
then
(()
=>
{
console
.
log
(
'TzXmtcCwzb 表同步成功'
);
});
module
.
exports
=
TzXmtcCwzb
;
\ No newline at end of file
db/model/jt/tzZdsxsp.js
View file @
ccb3856e
...
...
@@ -9,8 +9,12 @@ const TzZdsxsp = sequelize.define('TzZdsxsp', {
primaryKey
:
true
,
autoIncrement
:
true
},
/* -------------------------------------------------------- */
/* -------------------TODO: 缺少内容------------------------------------- */
projectName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目名称"
,
},
projectId
:
{
type
:
DataTypes
.
INTEGER
,
...
...
router/projectRouter.js
View file @
ccb3856e
...
...
@@ -85,4 +85,11 @@ router.post('/getZdsxspList', projectTzController.getZdsxspList);
router
.
post
(
'/getZdsxspInfo'
,
projectTzController
.
getZdsxspInfo
);
//项目退出
router
.
post
(
'/createXmtc'
,
projectTzController
.
createXmtc
);
router
.
post
(
'/updateXmtc'
,
projectTzController
.
updateXmtc
);
router
.
post
(
'/getXmtcList'
,
projectTzController
.
getXmtcList
);
router
.
post
(
'/getXmtcInfo'
,
projectTzController
.
getXmtcInfo
);
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