shcp-api-lib 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -837,6 +837,161 @@ exports.StudyType = void 0;
837
837
  StudyType[StudyType["Unknown"] = 99] = "Unknown";
838
838
  })(exports.StudyType || (exports.StudyType = {}));
839
839
 
840
+ //todo 以下js定义,后续要慢慢移除
841
+ const ArticleLibType = {
842
+ Public: '公开库',
843
+ Private: '私有库',
844
+ Draft: '草稿库',
845
+ Other: '其他租户私有库',
846
+ };
847
+ const FormLibType = {
848
+ Public: '公开库',
849
+ Private: '私有库',
850
+ Draft: '草稿库',
851
+ Other: '其他租户私有库',
852
+ };
853
+ const LabelLibType = {
854
+ Public: '公开库',
855
+ Private: '私有库',
856
+ };
857
+ exports.FormType = void 0;
858
+ (function (FormType) {
859
+ FormType[FormType["Form"] = 1] = "Form";
860
+ FormType[FormType["Tree"] = 2] = "Tree";
861
+ })(exports.FormType || (exports.FormType = {}));
862
+ exports.QuestionItemType = void 0;
863
+ (function (QuestionItemType) {
864
+ QuestionItemType[QuestionItemType["FirstTitle"] = 1] = "FirstTitle";
865
+ QuestionItemType[QuestionItemType["SecondTitle"] = 2] = "SecondTitle";
866
+ QuestionItemType[QuestionItemType["ThirdTitle"] = 3] = "ThirdTitle";
867
+ QuestionItemType[QuestionItemType["FormItem"] = 4] = "FormItem";
868
+ })(exports.QuestionItemType || (exports.QuestionItemType = {}));
869
+ const FormTypeOptions = [
870
+ {
871
+ label: '表单',
872
+ value: exports.FormType.Form,
873
+ },
874
+ {
875
+ label: '表单树',
876
+ value: exports.FormType.Tree,
877
+ },
878
+ ];
879
+ exports.FormRuleType = void 0;
880
+ (function (FormRuleType) {
881
+ /** 表单内置评估规则 */
882
+ FormRuleType[FormRuleType["BuiltInRules"] = 1] = "BuiltInRules";
883
+ /** 联动计算规则 */
884
+ FormRuleType[FormRuleType["InlineCalculation"] = 2] = "InlineCalculation";
885
+ /** 数值检验规则 */
886
+ FormRuleType[FormRuleType["Validation"] = 3] = "Validation";
887
+ /** 未知 */
888
+ FormRuleType[FormRuleType["Unknown"] = 99] = "Unknown";
889
+ })(exports.FormRuleType || (exports.FormRuleType = {}));
890
+ exports.FormLibraryType = void 0;
891
+ (function (FormLibraryType) {
892
+ FormLibraryType[FormLibraryType["Public"] = 1] = "Public";
893
+ FormLibraryType[FormLibraryType["Private"] = 2] = "Private";
894
+ FormLibraryType[FormLibraryType["Draft"] = 3] = "Draft";
895
+ FormLibraryType[FormLibraryType["Other"] = 4] = "Other";
896
+ FormLibraryType[FormLibraryType["Custom"] = 1000] = "Custom";
897
+ })(exports.FormLibraryType || (exports.FormLibraryType = {}));
898
+ const FormLibraryTypeOptions = [
899
+ {
900
+ value: exports.FormLibraryType.Public,
901
+ label: '公开库',
902
+ },
903
+ {
904
+ value: exports.FormLibraryType.Private,
905
+ label: '私有库',
906
+ },
907
+ {
908
+ value: exports.FormLibraryType.Draft,
909
+ label: '草稿库',
910
+ },
911
+ {
912
+ value: exports.FormLibraryType.Other,
913
+ label: '其他租户私有库',
914
+ },
915
+ {
916
+ value: exports.FormLibraryType.Custom,
917
+ label: '',
918
+ },
919
+ ];
920
+ function processFormQueryParams(params, type, userInfo) {
921
+ switch (type) {
922
+ case exports.FormLibraryType.Public: {
923
+ params.visibility = '*';
924
+ params.statusList = ['3'];
925
+ break;
926
+ }
927
+ case exports.FormLibraryType.Private: {
928
+ params.visibility = userInfo.tenantId;
929
+ if (params.status) {
930
+ params.statusList = [params.status];
931
+ }
932
+ else {
933
+ params.statusList = ['2', '4'];
934
+ }
935
+ break;
936
+ }
937
+ case exports.FormLibraryType.Draft: {
938
+ params.visibility = userInfo.tenantId;
939
+ params.isDraft = 1;
940
+ params.statusList = ['1', '2'];
941
+ break;
942
+ }
943
+ case exports.FormLibraryType.Other: {
944
+ params.statusList = ['2', '4'];
945
+ break;
946
+ }
947
+ }
948
+ }
949
+ //对比两个表单是否一致
950
+ function isFormEqual(left, right) {
951
+ if (left === right) {
952
+ return true;
953
+ }
954
+ if (left.id !== right.id) {
955
+ return false;
956
+ }
957
+ if ((left.value || '') != (right.value || '')) {
958
+ return false;
959
+ }
960
+ if (left.group) {
961
+ if (left.group.length != right.group.length) {
962
+ return false;
963
+ }
964
+ for (let i = 0; i < left.group.length; i++) {
965
+ if (!isFormEqual(left.group[i], right.group[i])) {
966
+ return false;
967
+ }
968
+ }
969
+ }
970
+ // 如果有子项,递归查找
971
+ if ('column' in left && left.column?.length) {
972
+ if (left.column.length != right.column.length) {
973
+ return false;
974
+ }
975
+ for (let i = 0; i < left.column.length; i++) {
976
+ if (!isFormEqual(left.column[i], right.column[i])) {
977
+ return false;
978
+ }
979
+ }
980
+ }
981
+ // 如果是动态类型且有子项,递归查找
982
+ if ('children' in left && left.children?.column?.length) {
983
+ if (left.children.column.length != right.children.column.length) {
984
+ return false;
985
+ }
986
+ for (let i = 0; i < left.children.column.length; i++) {
987
+ if (!isFormEqual(left.children.column[i], right.children.column[i])) {
988
+ return false;
989
+ }
990
+ }
991
+ }
992
+ return true;
993
+ }
994
+
840
995
  class _ShcpApiSdk {
841
996
  init(config) {
842
997
  this.config = config;
@@ -3457,6 +3612,7 @@ exports.AppCategoryOptions = AppCategoryOptions;
3457
3612
  exports.AppClientApi = AppClientApi;
3458
3613
  exports.AppClientPageConfigApi = AppClientPageConfigApi;
3459
3614
  exports.AppClientSettingApi = AppClientSettingApi;
3615
+ exports.ArticleLibType = ArticleLibType;
3460
3616
  exports.CommonDictApi = CommonDictApi;
3461
3617
  exports.CommonRightApi = CommonRightApi;
3462
3618
  exports.ConsumerApi = ConsumerApi;
@@ -3474,6 +3630,9 @@ exports.DeviceUserApi = DeviceUserApi;
3474
3630
  exports.DiseaseCareServiceFlowStatusOptions = DiseaseCareServiceFlowStatusOptions;
3475
3631
  exports.FileApi = FileApi;
3476
3632
  exports.FileTypeOptions = FileTypeOptions;
3633
+ exports.FormLibType = FormLibType;
3634
+ exports.FormLibraryTypeOptions = FormLibraryTypeOptions;
3635
+ exports.FormTypeOptions = FormTypeOptions;
3477
3636
  exports.GenderOptions = GenderOptions;
3478
3637
  exports.GroupJoinTypeOptions = GroupJoinTypeOptions;
3479
3638
  exports.HealthCommonApi = HealthCommonApi;
@@ -3491,6 +3650,7 @@ exports.InterviewServiceTaskStatusOptions = InterviewServiceTaskStatusOptions;
3491
3650
  exports.KmArticleApi = KmArticleApi;
3492
3651
  exports.KmFormApi = KmFormApi;
3493
3652
  exports.KmFormRuleRelationApi = KmFormRuleRelationApi;
3653
+ exports.LabelLibType = LabelLibType;
3494
3654
  exports.LoginApi = LoginApi;
3495
3655
  exports.MarketingApi = MarketingApi;
3496
3656
  exports.MarketingTaskLogStatusOptions = MarketingTaskLogStatusOptions;
@@ -3537,4 +3697,6 @@ exports.formatMetricData = formatMetricData;
3537
3697
  exports.getPlanExecLabel = getPlanExecLabel;
3538
3698
  exports.healthStudyExceptionOpApi = healthStudyExceptionOpApi;
3539
3699
  exports.healthStudyOpApi = healthStudyOpApi;
3700
+ exports.isFormEqual = isFormEqual;
3701
+ exports.processFormQueryParams = processFormQueryParams;
3540
3702
  //# sourceMappingURL=index.js.map