Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
c9e60f8f
Commit
c9e60f8f
authored
May 28, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed report display issue
parent
ed7a17d0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
124 additions
and
133 deletions
+124
-133
CellTemplateController.java
...a/pwc/taxtech/atms/controller/CellTemplateController.java
+25
-6
CellTemplateService.java
...in/java/pwc/taxtech/atms/service/CellTemplateService.java
+4
-1
CellConfigTranslater.java
...a/pwc/taxtech/atms/service/impl/CellConfigTranslater.java
+6
-6
CellTemplateServiceImpl.java
...wc/taxtech/atms/service/impl/CellTemplateServiceImpl.java
+44
-3
declaration-form-configuration.ctrl.js
...nFormConfiguration/declaration-form-configuration.ctrl.js
+0
-0
declaration-form-configuration.html
...tionFormConfiguration/declaration-form-configuration.html
+0
-0
spread-js-tip.svc.js
.../src/main/webapp/app/common/services/spread-js-tip.svc.js
+14
-14
spreadjs.svc.js
...eb/src/main/webapp/app/common/webservices/spreadjs.svc.js
+8
-8
template.svc.js
...eb/src/main/webapp/app/common/webservices/template.svc.js
+23
-95
common.js
atms-web/src/main/webapp/bundles/common.js
+0
-0
systemConfiguration.js
atms-web/src/main/webapp/bundles/systemConfiguration.js
+0
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/CellTemplateController.java
View file @
c9e60f8f
...
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
pwc.taxtech.atms.dto.CellTemplateConfigDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.service.CellTemplateService
;
import
java.util.Collections
;
...
...
@@ -21,17 +22,35 @@ public class CellTemplateController {
@RequestMapping
(
value
=
"configList/{templateID}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
@ResponseBody
List
<
CellTemplateConfigDto
>
GetConfigList
(
@PathVariable
String
templateID
)
{
if
(
StringUtils
.
isEmpty
(
templateID
)){
return
Collections
.
emptyList
();
OperationResultDto
<
List
<
CellTemplateConfigDto
>>
GetConfigList
(
@PathVariable
String
templateID
)
{
OperationResultDto
<
List
<
CellTemplateConfigDto
>>
result
=
new
OperationResultDto
<>();
if
(
StringUtils
.
isEmpty
(
templateID
))
{
result
.
setData
(
Collections
.
emptyList
());
}
try
{
return
cellTemplateService
.
getCellConfigList
(
templateID
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"CellTemplateController.GetCellConfigList"
,
e
);
}
return
result
;
}
@RequestMapping
(
value
=
"config/{cellTemplateID}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
@ResponseBody
OperationResultDto
<
CellTemplateConfigDto
>
GetConfig
(
@PathVariable
String
cellTemplateID
)
{
if
(
StringUtils
.
isEmpty
(
cellTemplateID
))
{
return
new
OperationResultDto
<>();
}
try
{
return
cellTemplateService
.
GetCellConfigList
(
t
emplateID
);
return
cellTemplateService
.
getCellConfig
(
cellT
emplateID
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"
GetCellConfigList"
,
e
);
logger
.
error
(
"
CellTemplateController.GetConfig"
,
e
);
}
return
Collections
.
emptyList
();
return
new
OperationResultDto
<>
();
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/CellTemplateService.java
View file @
c9e60f8f
package
pwc
.
taxtech
.
atms
.
service
;
import
pwc.taxtech.atms.dto.CellTemplateConfigDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
java.util.List
;
public
interface
CellTemplateService
{
List
<
CellTemplateConfigDto
>
GetCellConfigList
(
String
templateID
);
OperationResultDto
<
List
<
CellTemplateConfigDto
>>
getCellConfigList
(
String
templateID
);
OperationResultDto
<
CellTemplateConfigDto
>
getCellConfig
(
String
cellTemplateID
);
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/CellConfigTranslater.java
View file @
c9e60f8f
...
...
@@ -43,7 +43,7 @@ public final class CellConfigTranslater {
cellTemplateConfigDto
.
setFormulaDescription
(
description
);
Optional
<
CellTemplateConfig
>
formulaItem
=
configList
.
stream
().
filter
(
a
->
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"Formula"
))).
findFirst
();
if
(
formulaItem
!=
null
)
{
if
(
formulaItem
.
isPresent
()
)
{
cellTemplateConfigDto
.
setHasFormula
(
true
);
cellTemplateConfigDto
.
setFormula
(
formulaItem
.
get
().
getFormula
());
if
(
StringUtils
.
isEmpty
(
cellTemplateConfigDto
.
getFormulaDescription
())
...
...
@@ -55,7 +55,7 @@ public final class CellConfigTranslater {
}
Optional
<
CellTemplateConfig
>
voucherItem
=
configList
.
stream
().
filter
(
x
->
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"Voucher"
))).
findFirst
();
if
(
voucherItem
!=
null
)
{
if
(
voucherItem
.
isPresent
()
)
{
cellTemplateConfigDto
.
setHasVoucher
(
true
);
cellTemplateConfigDto
.
setVoucherKeyword
(
voucherItem
.
get
().
getVoucherKeyword
()
==
null
?
""
:
voucherItem
.
get
().
getVoucherKeyword
());
if
(!
StringUtils
.
isEmpty
(
voucherItem
.
get
().
getAccountCodes
()))
{
...
...
@@ -64,7 +64,7 @@ public final class CellConfigTranslater {
}
Optional
<
CellTemplateConfig
>
invoiceItem
=
configList
.
stream
().
filter
(
x
->
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"OutputInvoice"
))
||
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"InputInvoice"
))
||
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"CustomInvoice"
))).
findFirst
();
if
(
invoiceItem
!=
null
)
{
if
(
invoiceItem
.
isPresent
()
)
{
cellTemplateConfigDto
.
setHasInvoice
(
true
);
cellTemplateConfigDto
.
setInvoiceType
(
invoiceItem
.
get
().
getInvoiceType
());
cellTemplateConfigDto
.
setInvoiceAmountType
(
invoiceItem
.
get
().
getInvoiceAmountType
());
...
...
@@ -85,18 +85,18 @@ public final class CellConfigTranslater {
}
Optional
<
CellTemplateConfig
>
keyInItem
=
configList
.
stream
().
filter
(
x
->
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"KeyIn"
))).
findFirst
();
if
(
keyInItem
!=
null
)
{
if
(
keyInItem
.
isPresent
()
)
{
cellTemplateConfigDto
.
setHasKeyIn
(
true
);
}
Optional
<
CellTemplateConfig
>
modelItem
=
configList
.
stream
().
filter
(
x
->
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"RelatedModel"
))).
findFirst
();
if
(
modelItem
!=
null
)
{
if
(
modelItem
.
isPresent
()
)
{
cellTemplateConfigDto
.
setHasModel
(
true
);
cellTemplateConfigDto
.
setModelIDs
(
GetList
(
modelItem
.
get
().
getModelIDs
()));
}
Optional
<
CellTemplateConfig
>
validationItem
=
configList
.
stream
().
filter
(
x
->
x
.
getDataSourceType
().
equals
(
CellDataSourceType
.
valueOf
(
"Validation"
))).
findFirst
();
if
(
validationItem
!=
null
)
{
if
(
validationItem
.
isPresent
()
)
{
cellTemplateConfigDto
.
setHasValidation
(
true
);
cellTemplateConfigDto
.
setValidation
(
validationItem
.
get
().
getValidation
());
cellTemplateConfigDto
.
setValidationDescription
(
validationItem
.
get
().
getValidationDescription
());
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/CellTemplateServiceImpl.java
View file @
c9e60f8f
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.dao.CellTemplateMapper
;
import
pwc.taxtech.atms.dto.CellTemplateConfigDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.entitiy.CellTemplate
;
import
pwc.taxtech.atms.entitiy.CellTemplateConfig
;
import
pwc.taxtech.atms.entitiy.CellTemplateConfigExample
;
import
pwc.taxtech.atms.entitiy.CellTemplateExample
;
import
pwc.taxtech.atms.service.CellTemplateService
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -15,19 +19,56 @@ import java.util.stream.Collectors;
public
class
CellTemplateServiceImpl
extends
AbstractService
implements
CellTemplateService
{
@Override
public
List
<
CellTemplateConfigDto
>
G
etCellConfigList
(
String
templateID
)
{
List
<
CellTemplateConfigDto
>
result
=
new
ArrayList
<>();
public
OperationResultDto
<
List
<
CellTemplateConfigDto
>>
g
etCellConfigList
(
String
templateID
)
{
OperationResultDto
<
List
<
CellTemplateConfigDto
>>
result
=
new
OperationResultDto
<>();
CellTemplateExample
example
=
new
CellTemplateExample
();
example
.
createCriteria
().
andReportTemplateIDEqualTo
(
templateID
);
List
<
CellTemplate
>
cellTemplateList
=
cellTemplateMapper
.
selectByExample
(
example
);
List
<
CellTemplateConfig
>
configList
=
cellTemplateConfigMapper
.
getCellTemplateConfigByTemplateID
(
templateID
);
if
(
cellTemplateList
.
isEmpty
())
{
result
.
setData
(
Collections
.
emptyList
());
return
result
;
}
List
<
CellTemplateConfigDto
>
rData
=
new
ArrayList
<>();
for
(
CellTemplate
x
:
cellTemplateList
)
{
r
esult
.
add
(
GetConfigDto
(
x
,
configList
.
stream
().
filter
(
a
->
a
.
getCellTemplateID
().
equalsIgnoreCase
(
x
.
getID
())).
collect
(
Collectors
.
toList
())));
r
Data
.
add
(
GetConfigDto
(
x
,
configList
.
stream
().
filter
(
a
->
a
.
getCellTemplateID
().
equalsIgnoreCase
(
x
.
getID
())).
collect
(
Collectors
.
toList
())));
}
if
(
rData
.
size
()
>
0
)
{
result
.
setResult
(
true
);
result
.
setData
(
rData
);
}
else
{
result
.
setData
(
Collections
.
emptyList
());
}
return
result
;
}
@Override
public
OperationResultDto
<
CellTemplateConfigDto
>
getCellConfig
(
String
cellTemplateID
)
{
OperationResultDto
<
CellTemplateConfigDto
>
result
=
new
OperationResultDto
<>();
CellTemplate
config
=
cellTemplateMapper
.
selectByPrimaryKey
(
cellTemplateID
);
if
(
config
.
equals
(
null
))
{
result
.
setResultMsg
(
"NoData"
);
return
result
;
}
CellTemplateConfigExample
example
=
new
CellTemplateConfigExample
();
example
.
createCriteria
().
andCellTemplateIDEqualTo
(
cellTemplateID
);
List
<
CellTemplateConfig
>
configList
=
cellTemplateConfigMapper
.
selectByExample
(
example
);
result
.
setData
(
GetConfigDto
(
config
,
configList
));
if
(
result
.
getData
().
equals
(
null
))
{
result
.
setResultMsg
(
"NoData"
);
return
result
;
}
result
.
setResult
(
true
);
return
result
;
}
...
...
atms-web/src/main/webapp/app/admin/systemConfiguration/declarationFormConfiguration/declaration-form-configuration.ctrl.js
View file @
c9e60f8f
This diff is collapsed.
Click to expand it.
atms-web/src/main/webapp/app/admin/systemConfiguration/declarationFormConfiguration/declaration-form-configuration.html
View file @
c9e60f8f
This diff is collapsed.
Click to expand it.
atms-web/src/main/webapp/app/common/services/spread-js-tip.svc.js
View file @
c9e60f8f
...
...
@@ -14,54 +14,54 @@ function ($rootScope, $log, $uibModal, $translate) {
var
initialize
=
function
(
sheet
)
{
sheet
.
isPaintSuspended
(
true
);
sheet
.
suspendPaint
(
);
hasVoucherImg
=
new
Image
();
hasVoucherImg
.
src
=
'/app-resources/images/vat/hasVoucher.png'
;
hasVoucherImg
.
onload
=
function
()
{
sheet
.
repaint
();
}
}
;
hasInvoiceImg
=
new
Image
();
hasInvoiceImg
.
src
=
'/app-resources/images/vat/hasInvoice.png'
;
hasInvoiceImg
.
onload
=
function
()
{
sheet
.
repaint
();
}
}
;
hasKeyInImg
=
new
Image
();
hasKeyInImg
.
src
=
'/app-resources/images/vat/hasKeyIn.png'
;
hasKeyInImg
.
onload
=
function
()
{
sheet
.
repaint
();
}
}
;
hasModelImg
=
new
Image
();
hasModelImg
.
src
=
'/app-resources/images/vat/hasModel.png'
;
hasModelImg
.
onload
=
function
()
{
sheet
.
repaint
();
}
}
;
hasExceptionImg
=
new
Image
();
hasExceptionImg
.
src
=
'/app-resources/images/vat/hasException.png'
;
hasExceptionImg
.
onload
=
function
()
{
sheet
.
repaint
();
}
}
;
hasValidationImg
=
new
Image
();
hasValidationImg
.
src
=
'/app-resources/images/vat/hasValidation.png'
;
hasValidationImg
.
onload
=
function
()
{
sheet
.
repaint
();
}
}
;
};
var
paintSheet
=
function
(
sheet
)
{
sheet
.
isPaintSuspended
(
false
);
sheet
.
resumePaint
(
);
};
var
setCellTipString
=
function
(
cell
,
tip
)
{
//cell.cellType(new IconCellType(null, null, 0, null, tip));
cell
.
cellType
(
new
IconsCellType
([],
[],
tip
));
}
}
;
var
setCellTipByCellData
=
function
(
cell
,
cellData
)
{
var
tips
=
null
;
...
...
@@ -100,7 +100,7 @@ function ($rootScope, $log, $uibModal, $translate) {
}
cell
.
cellType
(
new
IconsCellType
(
icons
,
infos
,
tips
));
}
}
;
var
setCellTip
=
function
(
cell
,
config
)
{
var
tips
=
null
;
...
...
@@ -201,7 +201,7 @@ function ($rootScope, $log, $uibModal, $translate) {
this
.
count
=
0
;
this
.
Formula
=
formula
;
}
}
}
;
//var IconCellType = function (icon1, icon2, count, infos, formula) {
...
...
@@ -217,7 +217,7 @@ function ($rootScope, $log, $uibModal, $translate) {
IconsCellType
.
prototype
=
new
GC
.
Spread
.
Sheets
.
CellTypes
.
Base
();
IconsCellType
.
prototype
.
paint
=
function
(
ctx
,
value
,
x
,
y
,
w
,
h
,
style
,
context
)
{
GC
.
Spread
.
Sheets
.
CellTypes
.
Base
.
p
rototype
.
p
aint
.
call
(
this
,
ctx
,
value
,
x
,
y
,
w
,
h
,
style
,
context
);
GC
.
Spread
.
Sheets
.
CellTypes
.
Base
.
paint
.
call
(
this
,
ctx
,
value
,
x
,
y
,
w
,
h
,
style
,
context
);
for
(
var
i
=
1
;
i
<=
this
.
count
;
i
++
)
{
//距离当前单元格左侧距离,距离顶部距离 , ICON宽度,ICON高度
ctx
.
drawImage
(
this
.
Icons
[
i
-
1
],
x
+
w
-
(
h
-
3
)
*
i
+
(
h
-
6
-
18
)
*
i
,
y
+
3
+
(
h
/
2
-
3
-
9
),
18
,
18
);
...
...
@@ -232,7 +232,7 @@ function ($rootScope, $log, $uibModal, $translate) {
// ctx.drawImage(this.icon2, x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18);
//}
}
}
}
;
IconsCellType
.
prototype
.
getHitInfo
=
function
(
x
,
y
,
cellStyle
,
cellRect
,
context
)
{
var
index
=
x
-
(
cellRect
.
x
+
cellRect
.
width
-
(
cellRect
.
height
-
3
)
*
this
.
count
)
>
0
?
Math
.
floor
(
this
.
count
-
(
x
-
(
cellRect
.
x
+
cellRect
.
width
-
(
cellRect
.
height
-
3
)
*
this
.
count
))
/
(
cellRect
.
height
-
3
))
:
...
...
@@ -248,7 +248,7 @@ function ($rootScope, $log, $uibModal, $translate) {
sheetArea
:
context
.
sheetArea
,
reservedLocationIndex
:
index
};
}
}
;
IconsCellType
.
prototype
.
processMouseMove
=
function
(
hitinfo
)
{
//console.log(hitinfo);
...
...
atms-web/src/main/webapp/app/common/webservices/spreadjs.svc.js
View file @
c9e60f8f
...
...
@@ -93,7 +93,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
this
.
minArgs
=
minArgs
;
};
customFunction
.
prototype
=
new
G
C
.
Spread
.
Sheets
.
Calc
.
Functions
.
Function
();
customFunction
.
prototype
=
new
G
c
Spread
.
Sheets
.
Calc
.
Functions
.
Function
();
customFunction
.
prototype
.
evaluate
=
function
(
args
)
{
var
formulaName
=
this
.
name
+
"("
;
...
...
@@ -128,7 +128,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
var
deferred
=
$q
.
defer
();
var
promise
=
deferred
.
promise
;
var
spread
=
new
G
C
.
Spread
.
Sheets
.
Spread
(
document
.
getElementById
(
id
));
var
spread
=
new
G
c
Spread
.
Sheets
.
Spread
(
document
.
getElementById
(
id
));
var
sheet
=
spread
.
getActiveSheet
();
spread
.
showVerticalScrollbar
(
true
);
...
...
@@ -149,16 +149,16 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
sheet
.
setIsProtected
(
false
);
}
spread
.
bind
(
G
C
.
Spread
.
Sheets
.
Events
.
CellClick
,
function
(
sender
,
args
)
{
if
(
args
.
sheetArea
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
colHeader
)
{
spread
.
bind
(
G
c
Spread
.
Sheets
.
Events
.
CellClick
,
function
(
sender
,
args
)
{
if
(
args
.
sheetArea
===
G
c
Spread
.
Sheets
.
SheetArea
.
colHeader
)
{
$log
.
debug
(
"The column header was clicked."
);
}
if
(
args
.
sheetArea
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
rowHeader
)
{
if
(
args
.
sheetArea
===
G
c
Spread
.
Sheets
.
SheetArea
.
rowHeader
)
{
$log
.
debug
(
"The row header was clicked."
);
}
if
(
args
.
sheetArea
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
corner
)
{
if
(
args
.
sheetArea
===
G
c
Spread
.
Sheets
.
SheetArea
.
corner
)
{
$log
.
debug
(
"The corner header was clicked."
);
}
...
...
@@ -167,7 +167,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
$log
.
debug
(
sheet
.
getTag
(
args
.
row
,
args
.
col
));
});
spread
.
bind
(
G
C
.
Spread
.
Sheets
.
Events
.
EditEnding
,
function
(
sender
,
args
)
{
spread
.
bind
(
G
c
Spread
.
Sheets
.
Events
.
EditEnding
,
function
(
sender
,
args
)
{
var
sheet
=
spread
.
getActiveSheet
();
...
...
@@ -288,7 +288,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
var
asum
=
function
()
{
}
//Define a class "ASUM" that extends AsyncFunction
asum
.
prototype
=
new
G
C
.
Spread
.
Sheets
.
Calc
.
Functions
.
AsyncFunction
(
name
,
1
,
255
);
asum
.
prototype
=
new
G
c
Spread
.
Sheets
.
Calc
.
Functions
.
AsyncFunction
(
name
,
1
,
255
);
//Set default value to "Loading..."
asum
.
prototype
.
defaultValue
=
function
()
{
return
"Loading..."
;
};
//Override the evaluateAsync function
...
...
atms-web/src/main/webapp/app/common/webservices/template.svc.js
View file @
c9e60f8f
...
...
@@ -13,78 +13,37 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
return
""
;
};
var
getTemplateJson
=
function
(
templateID
)
{
//return $http.get('/template/getTemplateJson?templateID=' + templateID, apiConfig.create());
// var result = httpCacheService.get('/template/getTemplateJson?templateID=' + templateID);
// if (result.finishedCache) {
// return result;
// } else {
// var thisConfig = apiConfig.create();
// thisConfig.responseType = "blob";
// return $http.post('/template/getTemplateJson?templateID=' + templateID, {}, apiConfig.create());
// }
var
deferred
=
$q
.
defer
();
var
promise
=
deferred
.
promise
;
// var ajaxUrl = loginContext.apiHost + constant.webapi.prefix + '/template/getTemplateJson?templateID=' + templateID;
// var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
// var apiToken = apiTokenObj.access_token;
// var tokenType = apiTokenObj.token_type;
// var ajaxSource = $.ajax({
// url: ajaxUrl,
// type: "POST",
// dataType:"blob",
// beforeSend: function (xhr) {
// xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// //xhr.setRequestHeader('from', 'aabb@cn.pwc.com');
// //xhr.responseType = "blob";
// },
// success: function(data){
// deferred.resolve(data);
// },
// complete: function(data){
// deferred.resolve(data.responseText);
// }
// });
// ajaxSource.done(function (data) {
// deferred.resolve(data);
// });
return
promise
;
};
var
initSpreadExcel
=
function
(
id
,
ssjsondata
)
{
var
deferred
=
$q
.
defer
();
var
promise
=
deferred
.
promise
;
var
spread
=
new
GC
.
Spread
.
Sheets
.
Workbook
(
document
.
getElementById
(
id
));
spread
.
showVerticalScrollbar
(
true
)
;
spread
.
showHorizontalScrollbar
(
true
)
;
spread
.
scrollbarMaxAlign
(
true
)
;
spread
.
scrollbarShowMax
(
true
)
;
spread
.
tabNavigationVisible
(
true
)
;
spread
.
newTabVisible
(
false
)
;
spread
.
tabEditable
(
false
)
;
spread
.
tabStripVisible
(
false
)
;
spread
.
newTabVisible
(
false
)
;
// spread.allowUndo(false)
;
// spread.allowUserResize(false)
;
// spread.canUserDragDrop(false)
;
// spread.canUserDragFill(false)
;
// spread.canUserEditFormula(false)
;
//
// spread.isPaintSuspended(true
);
// spread.fromJSON(JSON.parse(ssjsondata)
);
// spread.isPaintSuspended(false
);
spread
.
options
.
showVerticalScrollbar
=
true
;
spread
.
options
.
showHorizontalScrollbar
=
true
;
spread
.
options
.
scrollbarMaxAlign
=
true
;
spread
.
options
.
scrollbarShowMax
=
true
;
spread
.
options
.
tabNavigationVisible
=
true
;
spread
.
options
.
newTabVisible
=
false
;
spread
.
options
.
tabEditable
=
false
;
spread
.
options
.
tabStripVisible
=
false
;
spread
.
options
.
newTabVisible
=
false
;
spread
.
options
.
allowUndo
=
false
;
spread
.
options
.
allowUserResize
=
false
;
spread
.
options
.
allowUserDragDrop
=
false
;
spread
.
options
.
allowUserDragFill
=
false
;
spread
.
options
.
allowUserEditFormula
=
false
;
spread
.
suspendPaint
(
);
spread
.
fromJSON
(
ssjsondata
);
spread
.
resumePaint
(
);
var
sheet
=
spread
.
getActiveSheet
();
if
(
sheet
!=
null
)
{
// sheet.setRowHeaderVisible(true);
// sheet.setColumnHeaderVisible(true);
// sheet.setGridlineOptions({
// showVerticalGridline: false, showHorizontalGridline: false
// });
sheet
.
options
.
rowHeaderVisible
=
true
;
sheet
.
options
.
colHeaderVisible
=
true
;
sheet
.
options
.
gridline
.
showVerticalGridline
=
false
;
sheet
.
options
.
gridline
.
showHorizontalGridline
=
false
;
}
deferred
.
resolve
(
spread
);
...
...
@@ -96,7 +55,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var
promise
=
deferred
.
promise
;
var
spreadSheet
;
var
url
=
loginContext
.
apiHost
+
constant
.
webapi
.
prefix
+
'/template/getTemplateJson?templateID='
+
templateID
;
var
url
=
loginContext
.
apiHost
+
constant
.
webapi
.
prefix
+
'/template/getTemplateJson?templateID='
+
templateID
;
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'POST'
,
url
,
true
);
// 也可以使用POST方式,根据接口
xhr
.
responseType
=
"blob"
;
// 返回类型blob
...
...
@@ -104,7 +63,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var
apiToken
=
apiTokenObj
.
access_token
;
var
tokenType
=
apiTokenObj
.
token_type
;
xhr
.
setRequestHeader
(
'Authorization'
,
tokenType
+
' '
+
apiToken
);
// xhr.setRequestHeader("Authorization","bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTUyNzMxNDA4NCwiaWF0IjoxNTI3MTQxMjg0LCJuYmYiOjE1MjcxNDA2ODQsImp0aSI6IjVGM0FGMTBDLTdFMEEtNDVDQy04RDVGLUREMTBFMDRCOUY4NCIsInVzZXJuYW1lIjoiYWRtaW4iLCJkYXRhYmFzZVVzZXJuYW1lIjoiQWRtaW4iLCJ1c2VyaWQiOiI2NjkzM0U3Qi1EQTc1LTRCMkUtQjdENi1BQjY1RENBMjBENTAifQ.M-dyU6W51LAPVQ66HIJZ-KAg6WjPSIt1GqpOc6etQ6XJfXp8KkUPA6A8qPZ8bhydWsKKMqpPlx-KRVhK2o5q0Q")
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr
.
onload
=
function
()
{
// 请求完成
...
...
@@ -121,39 +79,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
// process error
alert
(
e
.
errorMessage
);
},
{});
// var reader = new FileReader();
// reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
// reader.onload = function (e) {
// // 转换完成,创建一个a标签用于下载
// var a = document.createElement('a');
// a.download = 'data.xlsx';
// a.href = e.target.result;
// $("body").append(a); // 修复firefox中无法触发click
// a.click();
// $(a).remove();
// }
}
};
// 发送ajax请求
xhr
.
send
();
// getTemplateJson(templateID).then(function (result) {
// //var data = new Blob(result, {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});
// var excelIo = new GC.Spread.Excel.IO();
// excelIo.open(result, function (json) {
// //var workbookObj = json;
// //spread.fromJSON(workbookObj);
// spreadSheet = initSpreadExcel(id, json);
// deferred.resolve(spreadSheet);
// }, function (e) {
// // process error
// alert(e.errorMessage);
// }, {});
// spreadSheet = initSpreadExcel(id, result.data === undefined ? result : result.data);
//
// deferred.resolve(spreadSheet);
// });
return
promise
;
};
...
...
@@ -162,7 +91,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
};
return
{
getTemplateJson
:
getTemplateJson
,
renderSpreadExcelSimple
:
renderSpreadExcelSimple
,
initSpreadExcel
:
initSpreadExcel
,
setRowColName
:
setRowColName
...
...
atms-web/src/main/webapp/bundles/common.js
View file @
c9e60f8f
This diff is collapsed.
Click to expand it.
atms-web/src/main/webapp/bundles/systemConfiguration.js
View file @
c9e60f8f
This diff is collapsed.
Click to expand it.
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