Toggle navigation
Toggle navigation
This project
Loading...
Sign in
runsa
/
crm
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Anthony
2016-09-08 11:03:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8180f7c7605af4913bad56c3c19c1e1203a67f5c
8180f7c7
1 parent
dab1b7ae
brand 模块化
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
46 deletions
portal/portal.web/src/main/webapp/js/views/brand/index.js
portal/portal.web/src/main/webapp/js/views/brand/index.js
View file @
8180f7c
define
([
"uploadify"
],
function
(){
return
function
(
sessionId
,
rootUrl
){
define
([
'i18n!brand/nls/resource'
,
'cls'
,
'base/index'
,
'index/index'
,
'uploadify'
],
function
(
resource
,
Class
,
base
,
indexlayout
,
uploadify
){
return
{
resource
:
resource
,
init
:
function
(
sessionId
,
rootUrl
){
var
body
=
$
(
document
.
body
);
var
pannel
=
getSelectedPanel
();
//初始化面板
var
pannel
=
indexlayout
.
getSelectedPanel
();
//初始化面板
var
page
=
pannel
.
children
(
".data-brand"
).
layout
({
fit
:
true
});
//定义面板内div
var
datagrid
=
initDatagrid
();
//初始化数据表格
var
window
=
initWindow
();
//初始化添加页面
...
...
@@ -11,33 +13,33 @@ define(["uploadify"],function(){
var
txtDesc
=
form
.
find
(
"input[name='desc']"
);
var
txtCode
=
form
.
find
(
"input[name='code']"
);
var
txtValid
=
form
.
find
(
"select[name='valid']"
);
form
.
find
(
"span.name"
).
html
(
resource
.
brand
.
name
);
form
.
find
(
"div.desc"
).
html
(
resource
.
brand
.
desc
);
form
.
find
(
"span.code"
).
html
(
resource
.
brand
.
code
);
form
.
find
(
"div.valid"
).
html
(
resource
.
brand
.
valid
);
maxlengthUtils
(
txtName
,
20
);
form
.
find
(
"span.name"
).
html
(
resource
.
name
);
form
.
find
(
"div.desc"
).
html
(
resource
.
desc
);
form
.
find
(
"span.code"
).
html
(
resource
.
code
);
form
.
find
(
"div.valid"
).
html
(
resource
.
valid
);
base
.
maxlength
(
txtName
,
20
);
txtName
.
textbox
({
required
:
true
});
maxlengthUtils
(
txtDesc
,
100
);
base
.
maxlength
(
txtDesc
,
100
);
txtDesc
.
textbox
({
multiline
:
true
,
height
:
75
,
onChange
:
function
(
val
){
if
(
val
.
length
>
100
){
$
.
messager
.
alert
(
resource
.
msg_title
,
resource
.
brand
.
deaclength
);
$
.
messager
.
alert
(
resource
.
msg_title
,
resource
.
deaclength
);
txtDesc
.
textbox
(
"setValue"
,
txtDesc
.
textbox
(
"getValue"
).
substring
(
0
,
60
));
}
}
});
maxlengthUtils
(
txtCode
,
10
);
base
.
maxlength
(
txtCode
,
10
);
txtCode
.
textbox
({
required
:
true
});
txtValid
.
combobox
({
data
:[
{
text
:
resource
.
btn
.
yes
,
value
:
'1'
,
selected
:
true
},
{
text
:
resource
.
btn
.
no
,
value
:
'0'
}
{
text
:
base
.
resource
.
btn
.
yes
,
value
:
'1'
,
selected
:
true
},
{
text
:
base
.
resource
.
btn
.
no
,
value
:
'0'
}
]
});
window
.
find
(
".cancel"
).
bind
(
"click"
,
hideWindow
);
//绑定页面取消按钮
...
...
@@ -46,14 +48,14 @@ define(["uploadify"],function(){
return
page
.
layout
(
'panel'
,
'center'
).
children
(
'.data-brand-table'
).
datagrid
({
url
:
'./query/22726b54-5748-4926-82ed-abe076caecfa.json'
,
toolbar
:
$
(
'<div class="clearfix"></div>'
).
rs_toolbar
({
title
:
resource
.
brand
.
grid
.
title
,
authz
:
getAuthzUtils
(
'brand'
),
title
:
resource
.
grid
.
title
,
authz
:
base
.
getAuthz
(
'brand'
),
buttons
:[{
text
:
resource
.
btn
.
select
,
text
:
base
.
resource
.
btn
.
select
,
iconCls
:
'btn-select select-condition'
,
code
:
'view'
,
handler
:
function
(){
showCondObject
(
'22726b54-5748-4926-82ed-abe076caecfa'
,
datagridReload
);
base
.
showCondObject
(
'22726b54-5748-4926-82ed-abe076caecfa'
,
datagridReload
);
// showTreeObject('22726b54-5748-4926-82ed-abe076caecfa',datagridReload);
// showCondObject({
// id:'11111111-1111-1111-1111-111111111111',
...
...
@@ -77,35 +79,37 @@ define(["uploadify"],function(){
// });
}
},{
text
:
resource
.
btn
.
add
,
text
:
base
.
resource
.
btn
.
add
,
iconCls
:
'btn-add'
,
code
:
'edit'
,
handler
:
addWindow
},{
text
:
resource
.
btn
.
edit
,
text
:
base
.
resource
.
btn
.
edit
,
iconCls
:
'btn-edit'
,
code
:
'edit'
,
handler
:
editWindow
},{
text
:
resource
.
btn
.
remove
,
text
:
base
.
resource
.
btn
.
remove
,
iconCls
:
'btn-remove'
,
code
:
'edit'
,
handler
:
deleteData
}],
tools
:[
{
text
:
resource
.
btn
.
downloadExcel
,
text
:
base
.
resource
.
btn
.
downloadExcel
,
iconCls
:
'btn-down'
,
handler
:
function
(){
var
fileName
=
"mtBrandTemplate.xlsx"
;
downloadExcel
(
fileName
);
base
.
downloadExcelTemplate
(
fileName
);
}
}
,{
text
:
resource
.
btn
.
refresh
,
text
:
base
.
resource
.
btn
.
refresh
,
iconCls
:
'btn-refresh'
,
handler
:
panelRefreshUtils
handler
:
function
(){
indexlayout
.
getSelectedPanel
().
panel
(
"refresh"
);
}
}
,{
text
:
resource
.
btn
.
import
,
text
:
base
.
resource
.
btn
.
addByFile
,
iconCls
:
'btn-up'
,
id
:
'btn-brand-import'
}
]
...
...
@@ -113,14 +117,14 @@ define(["uploadify"],function(){
columns
:[[
{
field
:
'ck'
,
checkbox
:
true
},
/*{field:'id',title:'编号', width:100, align:"center"},*/
{
field
:
'BRNAME'
,
title
:
resource
.
brand
.
grid
.
BRNAME
,
width
:
120
},
{
field
:
'BRDESC'
,
title
:
resource
.
brand
.
grid
.
BRDESC
,
width
:
200
},
{
field
:
'BRCODE'
,
title
:
resource
.
brand
.
grid
.
BRCODE
,
width
:
120
},
{
field
:
'PTVALID'
,
title
:
resource
.
brand
.
grid
.
PTVALID
,
width
:
80
,
formatter
:
function
(
value
,
row
,
index
){
{
field
:
'BRNAME'
,
title
:
resource
.
grid
.
BRNAME
,
width
:
120
},
{
field
:
'BRDESC'
,
title
:
resource
.
grid
.
BRDESC
,
width
:
200
},
{
field
:
'BRCODE'
,
title
:
resource
.
grid
.
BRCODE
,
width
:
120
},
{
field
:
'PTVALID'
,
title
:
resource
.
grid
.
PTVALID
,
width
:
80
,
formatter
:
function
(
value
,
row
,
index
){
if
(
parseInt
(
value
)
==
1
){
return
resource
.
btn
.
yes
;
return
base
.
resource
.
btn
.
yes
;
}
else
if
(
parseInt
(
value
)
==
0
){
return
resource
.
btn
.
no
;
return
base
.
resource
.
btn
.
no
;
}
else
{
return
""
;}
}}
]]
...
...
@@ -133,13 +137,13 @@ define(["uploadify"],function(){
var
tempWin
=
page
.
children
(
".data-brand-dialog"
);
tempWin
.
dialog
({
buttons
:[{
text
:
resource
.
btn
.
confirm
,
text
:
base
.
resource
.
btn
.
confirm
,
handler
:
function
(){
editSubmit
();
}
},
{
text
:
resource
.
btn
.
cancel
,
text
:
base
.
resource
.
btn
.
cancel
,
handler
:
hideWindow
}],
closed
:
true
,
...
...
@@ -159,11 +163,11 @@ define(["uploadify"],function(){
//添加页面弹出绑定按钮
function
addWindow
(){
window
.
removeClass
(
"hide"
);
maxlengthUtils
(
txtName
,
20
);
maxlengthUtils
(
txtCode
,
10
);
base
.
maxlength
(
txtName
,
20
);
base
.
maxlength
(
txtCode
,
10
);
window
.
find
(
".addForm"
).
form
(
"clear"
);
txtValid
.
combobox
(
"setValue"
,
"1"
);
window
.
window
(
"center"
).
dialog
(
'setTitle'
,
resource
.
brand
.
addDialog
.
title
).
dialog
(
"open"
);
window
.
window
(
"center"
).
dialog
(
'setTitle'
,
resource
.
addDialog
.
title
).
dialog
(
"open"
);
window
.
addClass
(
"add"
);
}
...
...
@@ -184,14 +188,14 @@ define(["uploadify"],function(){
// }
//编辑页面弹出绑定按钮
function
editWindow
(){
maxlengthUtils
(
txtName
,
20
);
maxlengthUtils
(
txtCode
,
10
);
base
.
maxlength
(
txtName
,
20
);
base
.
maxlength
(
txtCode
,
10
);
var
row
=
getSelectedRow
();
if
(
row
==
null
){
$
.
messager
.
alert
(
resource
.
msg_title
,
resource
.
brand
.
editDialog
.
tip
);
$
.
messager
.
alert
(
base
.
resource
.
msg_title
,
resource
.
editDialog
.
tip
);
}
else
{
window
.
removeClass
(
"hide"
);
var
edit
=
window
.
window
(
"center"
).
dialog
(
'setTitle'
,
resource
.
brand
.
editDialog
.
title
).
dialog
(
"open"
).
find
(
".addForm"
);
var
edit
=
window
.
window
(
"center"
).
dialog
(
'setTitle'
,
resource
.
editDialog
.
title
).
dialog
(
"open"
).
find
(
".addForm"
);
window
.
addClass
(
"edit"
);
edit
.
form
(
"load"
,
getSelectedRow
());
}
...
...
@@ -211,7 +215,7 @@ define(["uploadify"],function(){
param
[
"id"
]
=
txtId
.
val
();
}
$
.
JSON
(
txtId
.
val
()
==
""
?
"./brand/insert.json"
:
"./brand/update.json"
,
param
,
function
(
result
){
if
(
responseUtils
(
result
)){
if
(
$
.
response
(
result
)){
window
.
dialog
(
"close"
);
datagridReload
();
}
...
...
@@ -234,14 +238,14 @@ define(["uploadify"],function(){
function
deleteData
(){
var
accountSet
=
getSelectedRow
();
if
(
accountSet
==
null
){
return
$
.
messager
.
alert
(
resource
.
msg_title
,
resource
.
brand
.
removeDialog
.
tip
);
return
$
.
messager
.
alert
(
base
.
resource
.
msg_title
,
resource
.
removeDialog
.
tip
);
}
else
if
(
accountSet
.
id
==
'1'
){
return
$
.
messager
.
alert
(
resource
.
msg_title
,
resource
.
brand
.
removeDialog
.
deBrand
);
return
$
.
messager
.
alert
(
base
.
resource
.
msg_title
,
resource
.
removeDialog
.
deBrand
);
}
$
.
messager
.
confirm
(
resource
.
msg_title
,
resource
.
brand
.
removeDialog
.
title
,
function
(
r
){
$
.
messager
.
confirm
(
base
.
resource
.
msg_title
,
resource
.
removeDialog
.
title
,
function
(
r
){
if
(
r
){
$
.
JSON
(
"./brand/delete.json"
,
accountSet
,
function
(
result
){
if
(
responseUtils
(
result
)){
if
(
$
.
response
(
result
)){
datagridReload
();
}
});
...
...
@@ -252,7 +256,7 @@ define(["uploadify"],function(){
if
(
params
){
datagrid
.
datagrid
(
"reload"
,
params
);
}
else
{
datagrid
.
datagrid
(
"reload"
,
getCondObjectValue
(
'22726b54-5748-4926-82ed-abe076caecfa'
));
datagrid
.
datagrid
(
"reload"
,
base
.
getCondObjectValue
(
'22726b54-5748-4926-82ed-abe076caecfa'
));
}
}
function
getSelectedRow
(){
...
...
@@ -295,4 +299,5 @@ define(["uploadify"],function(){
}())
}
}
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment