|
|
@ -1,11 +1,12 @@ |
|
|
|
var App = function () { |
|
|
|
|
|
|
|
this.data = { |
|
|
|
"total": 20, |
|
|
|
"rows": [{ Id: 1, Name: '线条宽度', Value: "2", Unit: '像素' }, |
|
|
|
{ Id: 2, Name: '线条颜色', Value: "#ff0000", Unit: '-' }, |
|
|
|
{ Id: 3, Name: '定位图标', Value: "", Unit: '-' }] |
|
|
|
}; |
|
|
|
//this.data = {
|
|
|
|
// "total": 20,
|
|
|
|
// "rows": [{ Id: 1, Name: '线条宽度', Value: "2", Unit: '像素' },
|
|
|
|
// { Id: 2, Name: '线条颜色', Value: "#ff0000", Unit: '-' },
|
|
|
|
// { Id: 3, Name: '定位图标', Value: "", Unit: '-' }]
|
|
|
|
//};
|
|
|
|
this.data = {}; |
|
|
|
this.selectedRow = []; |
|
|
|
this.EditLineWidth = new EditLineWidth(this); |
|
|
|
this.EditLineColor = new EditLineColor(this); |
|
|
@ -38,9 +39,10 @@ |
|
|
|
this.InitDataGrid = function () { |
|
|
|
$('#task-grid').datagrid({ |
|
|
|
columns: [[ |
|
|
|
{ field: 'Name', title: '名称', align: 'center', width: 10, formatter: this.formatIcon.bind(this) }, |
|
|
|
{ field: 'Value', title: '值', align: 'center', width: 10, formatter: this.formatIcon.bind(this) }, |
|
|
|
{ field: 'Unit', title: '单位', align: 'left', width: 70, formatter: this.formatIcon.bind(this) } |
|
|
|
{ field: 'Id', title: '名称', align: 'center', width: 10 }, |
|
|
|
{ field: 'Value', title: '值', align: 'center', width: 10 }, |
|
|
|
{ field: 'Unit', title: '单位', align: 'center', width: 10, formatter: this.formatUnit.bind(this) }, |
|
|
|
{ field: 'Description', title: '描述', align: 'left', width: 60, formatter: this.formatDescription.bind(this) } |
|
|
|
]], |
|
|
|
striped: true, |
|
|
|
singleSelect: false, |
|
|
@ -59,17 +61,24 @@ |
|
|
|
url: '/ConfigManagement/Query', |
|
|
|
data: { |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 100 |
|
|
|
pageSize: 1000 |
|
|
|
}, |
|
|
|
success: function (result) { |
|
|
|
console.log(result) |
|
|
|
$('#task-grid').datagrid('loadData', JSON.parse(result)); |
|
|
|
console.log(JSON.parse(result)); |
|
|
|
var value = JSON.parse(result); |
|
|
|
this.data['total'] = value.length; |
|
|
|
this.data['rows'] = value; |
|
|
|
$('#task-grid').datagrid('loadData', this.data); |
|
|
|
}.bind(this) |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.formatIcon = function (value) { |
|
|
|
return value === "" ? '<img src="../Content/images/locate.png" />' : value; |
|
|
|
this.formatUnit = function (value) { |
|
|
|
return value === "像素" ? value : '-'; |
|
|
|
}; |
|
|
|
|
|
|
|
this.formatDescription = function (value) { |
|
|
|
return '<span>{0}</span>'.format(value); |
|
|
|
}; |
|
|
|
|
|
|
|
this.OnTaskSelected = function (index, row) { |
|
|
@ -86,11 +95,11 @@ |
|
|
|
}; |
|
|
|
|
|
|
|
this.onEditButtonClick = function () { |
|
|
|
if (this.selectedRow.Name === '线条宽度') |
|
|
|
if (this.selectedRow.Id === 'line-width') |
|
|
|
this.EditLineWidth.Show(this.selectedRow); |
|
|
|
else if (this.selectedRow.Name === '线条颜色') |
|
|
|
else if (this.selectedRow.Id === 'line-color') |
|
|
|
this.EditLineColor.Show(this.selectedRow); |
|
|
|
else if (this.selectedRow.Name === '定位图标') |
|
|
|
else if (this.selectedRow.Id === 'marker-icon') |
|
|
|
this.EditLocateIcon.Show(this.selectedRow); |
|
|
|
|
|
|
|
}; |
|
|
|