Commit c6d19c3a authored by neo's avatar neo

[dev] fixed uigrid to dxgrid and view active menu

parent 7bc96dd8
......@@ -628,20 +628,164 @@
return typeof floatVal == 'undefined' ? Math.round(randVal) : randVal.toFixed(floatVal);
}
var loadApprovalFromDB = function (pageIndex) {
var loadApprovalFromDB = function () {
vatApproveService.approvalTasks().success(function (data) {
if (data) {
var index = 1;
data.forEach(function (v) {
v.index = index++;
v.amount = PWC.round(v.amount, 2);
v.taxAmount = PWC.round(v.taxAmount, 2);
$scope.gridOptions = {
dataSource: data,
keyExpr: "instanceId",
showBorders: true,
editing: {
mode: "form",
allowUpdating: true
},
columns: [
{ caption: '项目名称', width: '12%', dataField: "projectName"},
{ caption: '期间', width: '7%', dataField: "period"},
{ caption: '提审人', width: '10%', dataField: "createBy"},
{ caption: '审批人', width: '10%', dataField: "approvalBy"},
{ caption: '审批状态', width: '10%', dataField: "status"},
{ caption: '审批意见', width: '15%', dataField: "approvalResult"},
{ caption: '创建时间', width: '7.5%', dataField: "createTime"},
{ caption: '审批时间', width: '7.5%', dataField: "approvalTime"}
],
onRowClick: function (e) {
$scope.newProductModalInstance = ackUibModal($scope, 'addNewProduct.html', 'addNewProduct', '.app-overview ', 'static')
$scope.newProductModalInstance.open();
}
};
}
});
$scope.gridOptions.data = data;
};
$scope.cancel = function () {
$scope.newProductModalInstance.cancel();
};
$scope.modalService = {
open: function () {
$scope.product = {
fYear: "",
fSetId: "",
fSetName: "",
fManager: ""
};
var treeView;
var syncTreeViewSelection = function (treeView) {
if (!treeView) return;
if (!$scope.treeBoxValue) {
treeView.unselectAll();
return;
}
$scope.treeBoxValue.forEach(function (key) {
treeView.selectItem(key);
});
};
$scope.treeBoxValue = [""];
$scope.treeDataSource = [];
$scope.treeBoxNameValue = [""];
// productService.getProductList().success(function (data) {
// data.forEach(function (v) {
// if (!v.productIDs) {
// var item = new Object;
// item.name = v.fSetName;
// item.content = { id: v.fSetCode, guid: v.id};
// $scope.treeDataSource.push(item);
// }
// });
// });
$scope.treeBoxOptions = {
bindingOptions: {
value: 'treeBoxNameValue'
},
valueExpr: "ID",
displayExpr: "name",
placeholder: "选择...",
showClearButton: false,
dataSource: $scope.treeDataSource,
onValueChanged: function () {
syncTreeViewSelection(treeView);
},
treeView: {
dataSource: $scope.treeDataSource,
dataStructure: "plain",
keyExpr: "ID",
parentIdExpr: "categoryId",
displayExpr: "name",
selectByClick: true,
selectNodesRecursive: false,
showCheckBoxesMode: "normal",
bindingOptions: {
selectionMode: "selectionMode"
},
onContentReady: function (e) {
treeView = e.component;
syncTreeViewSelection(treeView);
},
onItemSelectionChanged: function (args) {
var keyValue = args.component.getSelectedNodesKeys();
if (keyValue.length===0) {
keyValue = [""];
}
var value = [""];
var nodes = args.component.getNodes();
var newValue = [""];
var nameValue = [""];
keyValue.forEach(function (v) {
var findResult = _.find(nodes, function (node) {
return node.key === v;
});
if (findResult) {
newValue.push(findResult.itemData.content.guid);
value.push(findResult.itemData.content.id);
nameValue.push(findResult.itemData.name);
}
});
$scope.treeBoxValue = keyValue;
$scope.newNewtreeBoxValue = value;
$scope.newTreeBoxValue = newValue;
var tempArray = nameValue.length===1?nameValue:nameValue.shift();
$scope.treeBoxNameValue = nameValue;
}
}
};
$timeout(function () {
var ele2 = $("#productStartDate");
ele2.datepicker({
startDate: $scope.startDate,
endDate: $scope.endDate,
language: region,
viewMode: $scope.viewMode,
minViewMode: $scope.viewMode,
autoclose: true, //选中之后自动隐藏日期选择框
clearBtn: true, //清除按钮
todayBtn: false, //今日按钮
format: $scope.dateFormat //日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
}).on('changeDate', function (e) {
$scope.changeStartDate(e);
});
ele2.datepicker("setDate", $scope.selectedStartDate);
}, 100);
$scope.newProductModalInstance = ackUibModal($scope, 'addNewProduct.html', 'addNewProduct', '.app-overview ', 'static')
$scope.newProductModalInstance.open();
},
save: function (result) {
$scope.saveProduct();
$scope.newProductModalInstance.close();
},
cancel: function () {
$scope.newProductModalInstance.cancel();
}
};
(function initialize() {
initDatePickers();
......@@ -659,39 +803,6 @@
orgDisplay.main();
loadApprovalFromDB();
});
/**
private String projectName;
private Integer period;
private String instanceId;
private String createBy;
private String approvalBy;
private String status;
private String approvalResult;
private Date createTime;
private Date approvalTime;
private String reportPaths;
*/
$scope.gridOptions = {
rowHeight: constant.UIGrid.rowHeight,
selectionRowHeaderWidth: constant.UIGrid.rowHeight,
virtualizationThreshold: 50,//默认加载50条数据,避免在数据展示时,只显示前面4条
enableSorting: false,
enableColumnMenus: false,
columnDefs: [
{ name: '序号', width: '7%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.index}}<span></div>' },
{ name: '项目名称', width: '12%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.projectName}}<span></div>' },
{ name: '期间', width: '7%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.period}}<span></div>' },
{ name: '提审人', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.createBy}}</span></div>' },
{ name: '审批人', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span> {{row.entity.approvalBy}}</span></div>' },
{ name: '审批状态', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.status}}</span></div>' },
{ name: '审批意见', width: '15%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.approvalResult}}</span></div>' },
{ name: '创建时间', width: '7.5%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.createTime | date:"yyyy-MM-dd"}}</span></div>' },
{ name: '审批时间', width: '7.5%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.approvalTime | date:"yyyy-MM-dd"}}</span></div>' },
{ name: '操作', width: '15%', cellTemplate: '<div class="ui-grid-cell-contents"><span>审批</span>|<span>下载</span>|<span>流程图</span></div>' }
]
};
})();
}
]);
......@@ -88,7 +88,7 @@
</div>
<div class="vat-preview-input-invoice" id="mainPreviewDiv">
<div id="mainAreaDiv" class="main-area">
<div class="inputInvoiceGrid" ui-grid-expandable ui-grid="gridOptions">
<div class="inputInvoiceGrid" id="grid" dx-data-grid="gridOptions">
<div class="watermark" ng-show="!gridOptions.data.length"><span translate="NoDataAvailable"></span>
</div>
</div>
......@@ -96,4 +96,71 @@
</div>
</div>
</div>
<script type="text/ng-template" id="addNewProduct.html">
<div class="modal-header">
<div class="modal-title" id="modal-title">新增产品</div>
</div>
<div class="modal-body" id="modal-body">
<div class="content">
<form name="add-product-form" id="add-product-form" class="form-horizontal">
<div class="form-group" style="margin-bottom:5px">
<label for="year" class="col-sm-3 control-label">年份</label>
<div class="col-sm-8 input-group">
<input class="form-control" name="year" id="year" ng-model="product.fYear" maxlength="50">
</div>
</div>
<div class="form-group" style="margin-bottom:5px">
<label for="setId" class="col-sm-3 control-label">产品标识</label>
<div class="col-sm-8 input-group">
<input class="form-control" name="setId" id="setId" ng-model="product.fSetId" maxlength="50">
</div>
</div>
<div class="form-group" style="margin-bottom:5px">
<label for="setCode" class="col-sm-3 control-label">产品编号</label>
<div class="col-sm-8 input-group">
<input class="form-control" name="setCode" id="setCode" ng-model="product.fSetCode" maxlength="50">
</div>
</div>
<div class="form-group" style="margin-bottom:5px">
<label for="aliaSetCode" class="col-sm-3 control-label">关联产品</label>
<div class="col-sm-8 input-group">
<div class="dx-field-value" style="width:265px">
<div dx-drop-down-box="treeBoxOptions">
<div data-options="dxTemplate: { name: 'content' }">
<div dx-tree-view="treeBoxOptions.treeView"></div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group" style="margin-bottom:5px">
<label for="setName" class="col-sm-3 control-label">产品描述</label>
<div class="col-sm-8 input-group">
<input class="form-control" name="setName" id="setName" ng-model="product.fSetName" maxlength="50">
</div>
</div>
<div class="form-group" style="margin-bottom:5px">
<label for="manager" class="col-sm-3 control-label">财务主管</label>
<div class="col-sm-8 input-group">
<input class="form-control" name="manager" id="manager" ng-model="product.fManager" maxlength="50">
</div>
</div>
<div class="form-group" style="margin-bottom:5px">
<label for="startDate" class="col-sm-3 control-label">启用日期</label>
<div class="overview-picker">
<input type="text" id="productStartDate" class="datepicker vat-subheader" style="width:200px;" readonly="readonly" />
<i class="fa fa-calendar vat-subheader red-color" style="width:20px;"></i>
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancel()">{{'Cancel' | translate }}</button>
</div>
</script>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment