Commit d4ff565ed95c7a48fbf4a804022e14124a11f898

Authored by 徐烜
1 parent 3e28457d

update

src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -339,6 +339,16 @@ angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', fun
339 339 }
340 340 }
341 341  
  342 + ),
  343 + cci2: $resource(
  344 + '/cci/:type',
  345 + {},
  346 + {
  347 + list: {
  348 + method: 'GET',
  349 + isArray: true
  350 + }
  351 + }
342 352 )
343 353 }
344 354 }]);
... ... @@ -537,6 +547,10 @@ angular.module('ScheduleApp').directive("saSelect2", [
537 547 * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
538 548 * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
539 549 *
  550 + * 高级属性:
  551 + * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
  552 + * dataparam(可选):数据源关联的外部参数对象
  553 + *
540 554 */
541 555 angular.module('ScheduleApp').directive("saSelect3", [
542 556 '$timeout',
... ... @@ -575,6 +589,7 @@ angular.module('ScheduleApp').directive("saSelect3", [
575 589 var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
576 590 var $required_attr = tAttrs["required"]; // 是否需要required验证
577 591 var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
  592 + var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
578 593  
579 594 // controlAs名字
580 595 var ctrlAs = "$saSelectCtrl";
... ... @@ -680,6 +695,7 @@ angular.module('ScheduleApp').directive("saSelect3", [
680 695 // 清空内部数据
681 696 scope[ctrlAs].$$data_real = [];
682 697 for (var i = 0; i < result.length; i ++) {
  698 + // TODO:超级大BUG
683 699 var data = {}; // data是result的一部分属性集合,根据配置来确定
684 700 if ($icname_attr) {
685 701 if ($mlp_attr) {
... ... @@ -753,6 +769,25 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
753 769 //console.log("end");
754 770 };
755 771  
  772 + /**
  773 + * 判定一个对象是否为空对象。
  774 + * @param Obj
  775 + */
  776 + scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
  777 + console.log(typeof obj);
  778 +
  779 + if (typeof obj === "object" && !(obj instanceof Array)) {
  780 + for (var prop in obj) {
  781 + if (obj.hasOwnProperty(prop)) {
  782 + return false;
  783 + }
  784 + }
  785 + return true;
  786 + } else {
  787 + throw "必须是对象";
  788 + }
  789 + };
  790 +
756 791 // 刷新数据
757 792 scope[ctrlAs].$$internal_refresh_fn = function(search) {
758 793 // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
... ... @@ -768,22 +803,24 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
768 803 scope[ctrlAs].$$internalmodel = $dcvalue_attr;
769 804 }
770 805 } else { // 非字典类型数据源
771   - $$searchInfoService_g[$datatype_attr].list(
772   - {type: "all"},
773   - function(result) {
774   - //console.log("ok:" + $datatype_attr);
775   - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
776   - //console.log("ok2:" + $datatype_attr);
777   - if ($dcvalue_attr) {
778   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
779   - }
  806 + if (!$dataassociate_attr) {
  807 + $$searchInfoService_g[$datatype_attr].list(
  808 + {type: "all"},
  809 + function(result) {
  810 + //console.log("ok:" + $datatype_attr);
  811 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  812 + //console.log("ok2:" + $datatype_attr);
  813 + if ($dcvalue_attr) {
  814 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  815 + }
780 816  
781   - $$data_init = true;
782   - },
783   - function(result) {
  817 + $$data_init = true;
  818 + },
  819 + function(result) {
784 820  
785   - }
786   - );
  821 + }
  822 + );
  823 + }
787 824 }
788 825 }
789 826  
... ... @@ -825,18 +862,47 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
825 862  
826 863 // dom全部载入后调用
827 864 $timeout(function() {
828   - // TODO:
829   -
830 865 console.log("dom全部载入后调用");
831 866 }, 0);
832 867 // 监控dcvalue model值变换
833 868 attr.$observe("dcvalue", function(value) {
834   - // TODO:
835   -
836 869 console.log("监控dc1 model值变换:" + value);
837 870 scope[ctrlAs].$$internalmodel = value;
838 871 }
839 872 );
  873 + // 监控获取数据参数变换
  874 + attr.$observe("dataparam", function(value) {
  875 + // 判定是否空对象
  876 + console.log(value);
  877 + var obj = JSON.parse(value);
  878 + var $dcvalue_attr = attr["dcvalue"];
  879 + if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
  880 + console.log("dataparam:" + obj);
  881 +
  882 + //
  883 +
  884 + obj["type"] = "all";
  885 +
  886 + $$data_init = false;
  887 + $$searchInfoService_g[$datatype_attr].list(
  888 + obj,
  889 + function(result) {
  890 + //console.log("ok:" + $datatype_attr);
  891 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  892 + //console.log("ok2:" + $datatype_attr);
  893 + if ($dcvalue_attr) {
  894 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  895 + }
  896 +
  897 + $$data_init = true;
  898 + },
  899 + function(result) {
  900 +
  901 + }
  902 + );
  903 + }
  904 + }
  905 + );
840 906 }
841 907 };
842 908 }
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
... ... @@ -71,6 +71,8 @@
71 71 icname="id"
72 72 icnames="insideCode"
73 73 datatype="cl"
  74 + dataassociate="true"
  75 + dataparam="{{ {'businessCode_eq': ctrl.busConfigForSave.xl.company} | json }}"
74 76 mlp="true"
75 77 required >
76 78 </sa-Select3>
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
... ... @@ -49,6 +49,8 @@
49 49 dcvalue="{{ctrl.busConfigForSave.xl.id}}"
50 50 dcname="xl.id"
51 51 icname="id"
  52 + dcname2="xl.company"
  53 + icname2="company"
52 54 icnames="name"
53 55 datatype="xl"
54 56 mlp="true"
... ... @@ -71,6 +73,8 @@
71 73 icname="id"
72 74 icnames="insideCode"
73 75 datatype="cl"
  76 + dataassociate="true"
  77 + dataparam="{{ {'businessCode_eq': ctrl.busConfigForSave.xl.company} | json }}"
74 78 mlp="true"
75 79 required >
76 80 </sa-Select3>
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/edit.html
... ... @@ -84,6 +84,8 @@
84 84 icname="id"
85 85 icnames="personnelName"
86 86 datatype="ry"
  87 + dataassociate="true"
  88 + dataparam="{{ {'companyCode_eq': ctrl.employeeConfigForSave.xl.company} | json }}"
87 89 mlp="true"
88 90 required >
89 91 </sa-Select3>
... ... @@ -105,6 +107,8 @@
105 107 icname="id"
106 108 icnames="personnelName"
107 109 datatype="ry"
  110 + dataassociate="true"
  111 + dataparam="{{ {'companyCode_eq': ctrl.employeeConfigForSave.xl.company} | json }}"
108 112 mlp="true" >
109 113 </sa-Select3>
110 114 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/employeeConfig.js
... ... @@ -21,7 +21,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService&#39;, [&#39;EmployeeConfigS
21 21 resetSearchCondition: function() {
22 22 var key;
23 23 for (key in currentSearchCondition) {
24   - currentSearchCondition[key] = null;
  24 + currentSearchCondition[key] = undefined;
25 25 }
26 26 },
27 27 /**
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/form.html
... ... @@ -49,6 +49,8 @@
49 49 dcvalue="{{ctrl.employeeConfigForSave.xl.id}}"
50 50 dcname="xl.id"
51 51 icname="id"
  52 + dcname2="xl.company"
  53 + icname2="company"
52 54 icnames="name"
53 55 datatype="xl"
54 56 mlp="true"
... ... @@ -84,6 +86,8 @@
84 86 icname="id"
85 87 icnames="personnelName"
86 88 datatype="ry"
  89 + dataassociate="true"
  90 + dataparam="{{ {'companyCode_eq': ctrl.employeeConfigForSave.xl.company} | json }}"
87 91 mlp="true"
88 92 required >
89 93 </sa-Select3>
... ... @@ -105,6 +109,8 @@
105 109 icname="id"
106 110 icnames="personnelName"
107 111 datatype="ry"
  112 + dataassociate="true"
  113 + dataparam="{{ {'companyCode_eq': ctrl.employeeConfigForSave.xl.company} | json }}"
108 114 mlp="true" >
109 115 </sa-Select3>
110 116 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
... ... @@ -23,6 +23,8 @@
23 23 dcvalue="{{ctrl.searchCondition()['xl.lineCode_eq']}}"
24 24 dcname="xl.lineCode_eq"
25 25 icname="lineCode"
  26 + dcname2="xl.company_eq"
  27 + icname2="company"
26 28 icnames="name"
27 29 datatype="xl">
28 30 </sa-Select3>
... ... @@ -39,7 +41,9 @@
39 41 dcname="jsy.id_eq"
40 42 icname="id"
41 43 icnames="personnelName"
42   - datatype="ry">
  44 + datatype="ry"
  45 + dataassociate="true"
  46 + dataparam="{{ {'companyCode_eq': ctrl.searchCondition()['xl.company_eq']} | json }}" >
43 47 </sa-Select3>
44 48 </div>
45 49 </td>
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/edit.html
... ... @@ -69,8 +69,10 @@
69 69 dcvalue="{{ctrl.scheduleRuleManageForSave.carConfigInfo.id}}"
70 70 dcname="carConfigInfo.id"
71 71 icname="id"
72   - icnames="nbbm"
73   - datatype="cci"
  72 + icnames="cl.insideCode"
  73 + datatype="cci2"
  74 + dataassociate="true"
  75 + dataparam="{{ {'xl.id_eq': ctrl.scheduleRuleManageForSave.xl.id} | json }}"
74 76 mlp="true"
75 77 required >
76 78 </sa-Select3>
... ...