Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-collect-api
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyi.chen
data-collect-api
Commits
9c4537d5
Commit
9c4537d5
authored
Apr 02, 2024
by
cwy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0403
parent
b8768f47
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
+23
-8
app/api/controller/ExcelFile.php
+16
-7
app/api/controller/NormReceives.php
+4
-0
app/api/controller/TaskPackage.php
+3
-1
No files found.
app/api/controller/ExcelFile.php
View file @
9c4537d5
...
...
@@ -69,7 +69,6 @@ class ExcelFile extends BaseController
array_push
(
$list
,
$arr
);
}
}
dump
(
$list
);
}
catch
(
\Exception
$e
){
var_dump
(
$e
->
getMessage
());
}
...
...
@@ -394,12 +393,18 @@ class ExcelFile extends BaseController
array_push
(
$data
[
'admin'
],
$arr
);
}
// 添加用户端
if
(
$normCollects
Id
){
if
(
$normCollects
){
$collectsInfo
=
Db
::
table
(
'norm_collects_extend'
)
->
where
(
'norm_collects_id'
,
$normCollectsId
)
->
select
();
foreach
(
$collectsInfo
as
$collectsValue
){
$arr
=
[
'name'
=>
$collectsValue
[
'extend_name'
],
'value'
=>
$collectsValue
[
'extend_value'
]];
array_push
(
$data
[
'user'
],
$arr
);
}
}
else
{
$normExtendInfo
=
Db
::
table
(
'norm_extend'
)
->
where
(
'norm_id'
,
$norm
[
'id'
])
->
where
(
'user_filled'
,
1
)
->
select
();
foreach
(
$normExtendInfo
as
$normExtendInfoValue
){
$arr
=
[
'name'
=>
$normExtendInfoValue
[
'extend_name'
],
'value'
=>
$normExtendInfoValue
[
'extend_value'
]
?
$normExtendInfoValue
[
'extend_value'
]
:
'/'
];
array_push
(
$data
[
'user'
],
$arr
);
}
}
// 添加第一条指标信息
array_push
(
$sheet
[
'data'
],
$data
);
...
...
@@ -407,7 +412,6 @@ class ExcelFile extends BaseController
if
(
$sheet
[
'data'
]){
array_push
(
$list
,
$sheet
);
}
// 创建一个新的 Spreadsheet 对象
$spreadsheet
=
new
Spreadsheet
();
// 设置为活动工作表
...
...
@@ -537,12 +541,14 @@ class ExcelFile extends BaseController
$sheet
->
getRowDimension
(
$row
)
->
setRowHeight
(
80
);
// 设置第n行的高度为30
$sheet
->
getColumnDimension
(
$column
[
$num
+
$position
])
->
setWidth
(
30
);
// 设置A列的宽度为20
if
(
$title
[
$position
]
==
'图片'
){
if
(
$value
[
'imgPath'
]
!=
"无"
){
if
(
$value
[
'imgPath'
]
!=
"无"
&&
$value
[
'imgPath'
]
!=
"/"
){
// 创建一个 Drawing 对象,并设置图片的路径
$drawing
=
new
Drawing
();
$drawing
->
setName
(
'Sample Image'
);
$drawing
->
setDescription
(
'Sample Image'
);
$drawing
->
setPath
(
'./storage/topic/20240402/bff4607948a621271fac9b86ca8dc17c.png'
);
// 图片路径
$imgList
=
explode
(
","
,
$value
[
'imgPath'
]);
$words
=
explode
(
"storage"
,
$imgList
[
0
]);
$drawing
->
setPath
(
'./storage'
.
$words
[
1
]);
// 图片路径
$drawing
->
setCoordinates
(
$column
[
$num
+
$position
]
.
$row
);
// 图片放置的单元格位置
$drawing
->
setWorksheet
(
$sheet
);
// 关联到工作表
// 调整图片大小以适应单元格(可选)
...
...
@@ -558,12 +564,15 @@ class ExcelFile extends BaseController
$sheet
->
setCellValue
(
$column
[
$num
+
$position
]
.
$row
,
'/'
);
$position
++
;
}
if
(
$value
[
'imgPath'
]
!=
"无"
){
if
(
$value
[
'imgPath'
]
!=
"无"
&&
$value
[
'imgPath'
]
!=
"/"
){
// 创建一个 Drawing 对象,并设置图片的路径
$drawing
=
new
Drawing
();
$drawing
->
setName
(
'Sample Image'
);
$drawing
->
setDescription
(
'Sample Image'
);
$drawing
->
setPath
(
'./storage/topic/20240402/bff4607948a621271fac9b86ca8dc17c.png'
);
// 图片路径
$imgList
=
explode
(
","
,
$value
[
'imgPath'
]);
$words
=
explode
(
"storage"
,
$imgList
[
0
]);
$drawing
->
setPath
(
'./storage'
.
$words
[
1
]);
// 图片路径
// $drawing->setPath('./storage/topic/20240402/bff4607948a621271fac9b86ca8dc17c.png'); // 图片路径
$drawing
->
setCoordinates
(
$column
[
$num
+
$position
]
.
$row
);
// 图片放置的单元格位置
$drawing
->
setWorksheet
(
$sheet
);
// 关联到工作表
// 调整图片大小以适应单元格(可选)
...
...
app/api/controller/NormReceives.php
View file @
9c4537d5
...
...
@@ -25,6 +25,7 @@ class NormReceives extends AuthBase
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'task_id'
]
=
input
(
"param.task_id"
);
$data
[
'status'
]
=
input
(
"param.status"
);
$data
[
'statusSelect'
]
=
input
(
"param.statusSelect"
);
$data
[
'user_id'
]
=
input
(
"param.user_id"
);
$data
[
'norm_id'
]
=
input
(
"param.norm_id"
);
$data
[
'order'
]
=
input
(
"param.order"
)
?
input
(
"param.order"
)
:
'desc'
;
...
...
@@ -33,6 +34,9 @@ class NormReceives extends AuthBase
if
(
$data
[
'admin'
]
==
0
){
$data
[
'user_id'
]
=
$this
->
userId
;
}
if
(
!
empty
(
$data
[
'statusSelect'
])){
$data
[
'status'
]
=
$data
[
'statusSelect'
];
}
// 分页数据
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
$NormListBus
=
new
\app\api\business\NormListBus
;
...
...
app/api/controller/TaskPackage.php
View file @
9c4537d5
...
...
@@ -38,6 +38,8 @@ class TaskPackage extends AuthBase
// $normBus = new CommonBus('normBus'); // 通过公共业务初始化指标类
// $normRes = $normBus->getConditionalQuery(['task_id'=>$value['id']]);
// // 领取进度
$NormBus
=
new
CommonBus
(
'NormBus'
);
// 通过公共业务初始化指标类
$NormInfo
=
$NormBus
->
getConditionalQuery
([
'task_id'
=>
$value
[
'id'
]]);
$NormListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化指标类
$totalDegree
=
$NormListBus
->
getConditionalQueryAll
([
'task_id'
=>
$value
[
'id'
]]);
$NormReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化指标类
...
...
@@ -45,7 +47,7 @@ class TaskPackage extends AuthBase
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$collectsTimes
=
$NormCollectsBus
->
getConditionalQueryAll
([
'task_id'
=>
$value
[
'id'
]]);
if
(
$totalDegree
){
$totalNum
=
count
(
$totalDegree
)
*
$
totalDegree
[
0
]
[
'num'
];
$totalNum
=
count
(
$totalDegree
)
*
$
NormInfo
[
'num'
];
$result
[
'data'
][
$index
][
'receivedQuantity'
]
=
count
(
$receivedTimes
)
.
'/'
.
$totalNum
;
$result
[
'data'
][
$index
][
'collectsQuantity'
]
=
count
(
$collectsTimes
)
.
'/'
.
$totalNum
;
}
else
{
...
...
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