12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- /**
- * Created by Mai on 2017/4/1.
- */
- var Bills = {
- createNew: function (project) {
- var billsTreeSetting = {
- id: 'ID',
- pid: 'ParentID',
- nid: 'NextSiblingID',
- rootId: -1
- };
- // �û�����private����
- var tools = {};
- // ����ͨ��this���ʵ����ԣ�����Ӧ�ڴ˵�Ԫ�ⲿ����д�����
- var bills = function (proj) {
- this.project = proj;
- this.datas = null;
- this.tree = idTree.createInit(billsTreeSetting);
- var sourceType = 'bills';
- this.getSourceType = function () {
- return sourceType;
- }
- };
- // prototype���ڶ���public����
- bills.prototype.loadDatas = function (datas) {
- this.datas = datas;
- // generate Fees & Flags Index��For View & Calculate
- this.datas.forEach(function (data) {
- data.FeesIndex = {};
- data.fees.forEach(function (fee) {
- data.FeesIndex[fee.fieldName] = fee;
- });
- data.FlagsIndex = {};
- data.flags.forEach(function (flag) {
- data.FlagsIndex[flag.fieldName] = flag;
- });
- });
- // datas load to Tree
- this.tree.loadDatas(this.datas);
- };
- return new bills(project);
- }
- };
|