明树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
f05c3f87
Commit
f05c3f87
authored
Dec 10, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a3623380
Pipeline
#104409
passed with stage
in 3 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
resourceController.js
controller/resourceController.js
+4
-3
project.js
db/model/jt/project.js
+2
-2
package.json
package.json
+1
-1
index.js
utils/index.js
+2
-2
No files found.
controller/resourceController.js
View file @
f05c3f87
const
{
buildTree
,
disTree
}
=
require
(
"../utils"
);
const
errorMessage
=
require
(
"../utils/errorMessage"
);
const
{
Op
}
=
require
(
'sequelize'
);
const
_
=
require
(
'lodash'
)
/**
* 资源库controller
...
...
@@ -230,6 +230,7 @@ async function listResourceAll(req, res, next) {
model
:
DB
.
ResourcesInfo
,
as
:
'resourcesInfos'
,
// raw: true,
// order: [['order', 'ASC']],
}
],
}
...
...
@@ -238,11 +239,11 @@ async function listResourceAll(req, res, next) {
for
(
let
index
=
0
;
index
<
datas
.
length
;
index
++
)
{
let
element
=
datas
[
index
];
element
=
element
.
toJSON
()
console
.
log
(
element
.
resourceInfos
,
"=="
)
console
.
log
(
element
.
resource
s
Infos
,
"=="
)
if
(
element
.
type
==
2
)
{
element
.
resourcesInfos
=
utils
.
buildTree2
(
element
.
resourcesInfos
,
'code'
,
'parentCode'
);
}
obj
[
element
.
key
]
=
element
.
resourcesInfos
||
[]
;
obj
[
element
.
key
]
=
_
.
orderBy
(
element
.
resourcesInfos
||
[],
'order'
,
'asc'
)
;
}
return
res
.
sendData
(
obj
)
}
catch
(
error
)
{
...
...
db/model/jt/project.js
View file @
f05c3f87
...
...
@@ -45,7 +45,7 @@ const Project = sequelize.define('Project', {
sfzjc
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"是否再决策"
,
zjType
:
'danxuan'
,
zjKey
:
'sf'
,
_mark
:
"lixiang"
},
// 1是 2 否
projectForeignName
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"项目外文名称"
,
_mark
:
"lixiang"
},
sfnjlhtxm
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"是否能建联合体项目"
,
zjType
:
'danxuan'
,
zjKey
:
'sf'
,
_mark
:
"lixiang"
},
// 1是 2 否
tzzt
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"投资主体"
,
zjType
:
'danxuan'
,
_mark
:
"lixiang"
},
tzzt
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"投资主体"
,
zjType
:
'danxuan'
,
_mark
:
"lixiang"
},
zyfzy
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"主业/非主业"
,
zjType
:
'danxuan'
,
_mark
:
"lixiang"
},
zsqy
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"直属企业"
,
zjType
:
'danxuan'
,
_mark
:
"lixiang"
},
sfnjzdhzytz
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"是否能建重大或重要投资"
,
zjType
:
'danxuan'
,
zjKey
:
'sf'
,
_mark
:
"lixiang"
},
...
...
@@ -132,7 +132,7 @@ const Project = sequelize.define('Project', {
sbdwqygg
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"申报单位企业规格"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
},
xmztz
:
{
type
:
DataTypes
.
DECIMAL
(
19
,
8
),
allowNull
:
true
,
comment
:
"项目总投资"
,
_mark
:
'juece'
},
// zsqy: { type: DataTypes.STRING, allowNull: true, comment: "直属企业", },
glzt
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
comment
:
"管理主体"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
},
glzt
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"管理主体"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
},
// xmqy: { type: DataTypes.STRING, allowNull: true, comment: "项目区域", zjType: 'danxuan' },
// jnw: { type: DataTypes.STRING, allowNull: true, comment: "境内/外", zjType: 'danxuan' },
// sjnzjjw: { type: DataTypes.STRING, allowNull: true, comment: "省(境内)/洲际(境外)", zjType: 'danxuan' },
...
...
package.json
View file @
f05c3f87
...
...
@@ -4,7 +4,7 @@
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"production"
:
"cross-env NODE_ENV=production node server.js"
,
"production"
:
"cross-env NODE_ENV=production node
mon
server.js"
,
"dev"
:
"cross-env NODE_ENV=dev nodemon server.js"
,
"local"
:
"cross-env NODE_ENV=local nodemon server.js"
,
"lint"
:
"eslint ."
,
...
...
utils/index.js
View file @
f05c3f87
...
...
@@ -142,13 +142,13 @@ function buildTree2(nodes, keyid = 'id', keyParentId = 'parentId') {
if
(
nodeMap
.
has
(
parentId
))
{
// 将当前节点添加到父节点的children数组中
nodeMap
.
get
(
parentId
).
children
.
push
(
nodeMap
.
get
(
String
(
node
[
keyid
])));
nodeMap
.
get
(
parentId
).
children
=
_
.
orderBy
(
nodeMap
.
get
(
parentId
).
children
,
'order'
)
nodeMap
.
get
(
parentId
).
children
=
_
.
orderBy
(
nodeMap
.
get
(
parentId
).
children
,
[
'order'
,
'code'
]
)
}
}
});
// 从映射中提取顶级节点(parentId为null)
return
_
.
orderBy
(
Array
.
from
(
nodeMap
.
values
()).
filter
(
node
=>
node
[
keyParentId
]
==
null
),
'order'
);
return
_
.
orderBy
(
Array
.
from
(
nodeMap
.
values
()).
filter
(
node
=>
node
[
keyParentId
]
==
null
),
[
'order'
,
'code'
]
);
}
...
...
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