cnhis-design-vue 3.0.2 → 3.0.5

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.
@@ -7903,14 +7903,12 @@ var script = /* @__PURE__ */ defineComponent({
7903
7903
  previewText: { type: String, required: false, default: "\u6253\u5370\u9884\u89C8" },
7904
7904
  formatEditText: { type: String, required: false, default: "\u683C\u5F0F\u7F16\u8F91" },
7905
7905
  identityVerificationTitle: { type: String, required: false, default: "\u6253\u5370\u670D\u52A1\u8EAB\u4EFD\u6821\u9A8C" },
7906
- params: { type: Array, required: true },
7907
- hisParams: { type: null, required: true },
7906
+ params: { type: Array, required: false, default: () => [] },
7908
7907
  prevFn: { type: Function, required: false, default: () => Promise.resolve() },
7909
7908
  verifyUser: { type: Function, required: false, default: () => Promise.resolve() },
7910
7909
  queryPrintFormatByNumber: { type: Function, required: true, default: () => Promise.resolve({}) },
7911
7910
  queryTemplateParams: { type: Function, required: false, default: () => Promise.resolve({}) },
7912
- strategy: { type: String, required: false, default: "MULTI" },
7913
- versionType: { type: [Number, String], required: false, default: "2" }
7911
+ strategy: { type: String, required: false, default: "MULTI" }
7914
7912
  },
7915
7913
  emits: ["success", "error"],
7916
7914
  setup(__props, { emit }) {
@@ -7951,7 +7949,7 @@ var script = /* @__PURE__ */ defineComponent({
7951
7949
  let id = state.currentFormatId;
7952
7950
  return state.formatList.find((item) => item.id === id);
7953
7951
  });
7954
- const formatTitle = computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
7952
+ computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
7955
7953
  const getTemplateIdByFormatId = (id) => {
7956
7954
  let find = state.formatList.find((item) => item.id === id);
7957
7955
  return find.templateId;
@@ -7973,34 +7971,6 @@ var script = /* @__PURE__ */ defineComponent({
7973
7971
  };
7974
7972
  emit("error", error);
7975
7973
  };
7976
- const getHisParams = (index = 0) => {
7977
- const { reportid = "280" } = props.hisParams;
7978
- const { id, name } = state.templateParams;
7979
- return {
7980
- reportid,
7981
- formatid: state.currentFormatId || id,
7982
- formatname: name,
7983
- param: props.params[index]
7984
- };
7985
- };
7986
- const getOnceHisParams = () => {
7987
- const { reportid = "280" } = props.hisParams;
7988
- const { id, name } = state.templateParams;
7989
- const obj = {};
7990
- Object.keys(props.params[0]).forEach((v) => {
7991
- obj[v] = [];
7992
- props.params.forEach((k) => {
7993
- obj[v].push(k[v]);
7994
- });
7995
- obj[v] = obj[v].join(",");
7996
- });
7997
- return {
7998
- reportid,
7999
- formatid: state.currentFormatId || id,
8000
- formatname: name,
8001
- param: obj
8002
- };
8003
- };
8004
7974
  const getPrintParams = (index = 0) => {
8005
7975
  const params = state.printParams[index];
8006
7976
  return JSON.stringify(params);
@@ -8044,49 +8014,26 @@ var script = /* @__PURE__ */ defineComponent({
8044
8014
  prevFnError();
8045
8015
  return Promise.reject();
8046
8016
  }).then(() => {
8047
- if (props.versionType == 1 || props.versionType == 3) {
8048
- const printFn = props.versionType == 1 ? "handleHisPrint" : "handleOldHisPrint";
8049
- if (props.strategy === "MULTI") {
8050
- for (let i = 0; i < props.params.length; i++) {
8051
- const params = getHisParams(i);
8052
- printInstance[printFn](7, params).then((res) => {
8053
- console.log(res, "777777777777");
8054
- }).catch((error) => {
8055
- console.log(error, "error777");
8056
- });
8057
- }
8058
- }
8059
- else {
8060
- const params = getOnceHisParams();
8061
- printInstance[printFn](7, params).then((res) => {
8062
- console.log(res, "777777777777");
8063
- }).catch((error) => {
8064
- console.log(error, "error777");
8065
- });
8066
- }
8067
- }
8068
- else {
8069
- if (props.strategy === "MULTI") {
8070
- for (let i = 0; i < state.printParams.length; i++) {
8071
- const queryParams = {
8072
- formatId: state.currentFormatId,
8073
- templateId: getTemplateIdByFormatId(state.currentFormatId),
8074
- params: getPrintParams(i)
8075
- };
8076
- printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
8077
- }
8078
- }
8079
- else {
8017
+ if (props.strategy === "MULTI") {
8018
+ for (let i = 0; i < state.printParams.length; i++) {
8080
8019
  const queryParams = {
8081
8020
  formatId: state.currentFormatId,
8082
8021
  templateId: getTemplateIdByFormatId(state.currentFormatId),
8083
- params: getOnceParams()
8022
+ params: getPrintParams(i)
8084
8023
  };
8085
- printInstance.printDirect(queryParams, (res) => {
8086
- callLocalServicesSuccessCb(res, "print");
8087
- }, callLocalServicesErrorCb);
8024
+ printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
8088
8025
  }
8089
8026
  }
8027
+ else {
8028
+ const queryParams = {
8029
+ formatId: state.currentFormatId,
8030
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
8031
+ params: getOnceParams()
8032
+ };
8033
+ printInstance.printDirect(queryParams, (res) => {
8034
+ callLocalServicesSuccessCb(res, "print");
8035
+ }, callLocalServicesErrorCb);
8036
+ }
8090
8037
  }).finally(() => {
8091
8038
  state.visible = false;
8092
8039
  });
@@ -8096,26 +8043,15 @@ var script = /* @__PURE__ */ defineComponent({
8096
8043
  prevFnError();
8097
8044
  return Promise.reject();
8098
8045
  }).then(() => {
8099
- if (props.versionType == 1 || props.versionType == 3) {
8100
- const params = props.strategy === "MULTI" ? getHisParams() : getOnceHisParams();
8101
- const printFn = props.versionType == 1 ? "handleHisPrint" : "handleOldHisPrint";
8102
- printInstance[printFn](8, params).then((res) => {
8103
- console.log(res, 88888888);
8104
- }).catch((error) => {
8105
- console.log(error, "error888");
8106
- });
8107
- }
8108
- else {
8109
- const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
8110
- const queryParams = {
8111
- formatId: state.currentFormatId,
8112
- templateId: getTemplateIdByFormatId(state.currentFormatId),
8113
- params
8114
- };
8115
- printInstance.preview(queryParams, (res) => {
8116
- callLocalServicesSuccessCb(res, "preview");
8117
- }, callLocalServicesErrorCb);
8118
- }
8046
+ const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
8047
+ const queryParams = {
8048
+ formatId: state.currentFormatId,
8049
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
8050
+ params
8051
+ };
8052
+ printInstance.preview(queryParams, (res) => {
8053
+ callLocalServicesSuccessCb(res, "preview");
8054
+ }, callLocalServicesErrorCb);
8119
8055
  }).finally(() => {
8120
8056
  state.visible = false;
8121
8057
  });
@@ -8125,18 +8061,7 @@ var script = /* @__PURE__ */ defineComponent({
8125
8061
  prevFnError();
8126
8062
  return Promise.reject();
8127
8063
  }).then(() => {
8128
- if (props.versionType == 1 || props.versionType == 3) {
8129
- const params = props.strategy === "MULTI" ? getHisParams() : getOnceHisParams();
8130
- const printFn = props.versionType == 1 ? "handleHisPrint" : "handleOldHisPrint";
8131
- printInstance[printFn](9, params).then((res) => {
8132
- console.log(res, 999999);
8133
- }).catch((error) => {
8134
- console.log(error, "error999");
8135
- });
8136
- }
8137
- else {
8138
- state.identityVerification.visible = true;
8139
- }
8064
+ state.identityVerification.visible = true;
8140
8065
  }).finally(() => {
8141
8066
  state.visible = false;
8142
8067
  });
@@ -8181,25 +8106,6 @@ var script = /* @__PURE__ */ defineComponent({
8181
8106
  let findDefault = list.find((item) => item[key] == 1);
8182
8107
  return findDefault?.id || list[0].id;
8183
8108
  };
8184
- const setOptions = () => {
8185
- const children = state.formatList.map((v) => {
8186
- return {
8187
- label: v.name,
8188
- key: v.id
8189
- };
8190
- });
8191
- options.unshift({
8192
- label: formatTitle.value,
8193
- key: "format",
8194
- children
8195
- });
8196
- };
8197
- const initHIS = (formatListResult) => {
8198
- state.formatList = formatListResult ? formatListResult.list.filter((item) => item.printmark == 1) : [];
8199
- setOptions();
8200
- state.currentFormatId = getDefaultFormatId(state.formatList, "printmark");
8201
- state.templateParams = state.formatList[0];
8202
- };
8203
8109
  const formatFormatList = (list) => {
8204
8110
  let formatList = [];
8205
8111
  list.forEach((item) => {
@@ -8263,7 +8169,7 @@ var script = /* @__PURE__ */ defineComponent({
8263
8169
  };
8264
8170
  const initCRM = async (formatListResult) => {
8265
8171
  state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
8266
- setOptions();
8172
+ console.log("formatListResult", formatListResult);
8267
8173
  state.currentFormatId = getDefaultFormatId(state.formatList, "defaultFlag");
8268
8174
  if (!state.currentFormatId) {
8269
8175
  window.$message.error("\u83B7\u53D6\u6253\u5370\u683C\u5F0F\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01");
@@ -8289,12 +8195,7 @@ var script = /* @__PURE__ */ defineComponent({
8289
8195
  setTimeoutSpin();
8290
8196
  instantiatePrintSDK();
8291
8197
  const formatListResult = await props.queryPrintFormatByNumber();
8292
- if (props.versionType == 1 || props.versionType == 3) {
8293
- initHIS(formatListResult);
8294
- }
8295
- else {
8296
- await initCRM(formatListResult);
8297
- }
8198
+ await initCRM(formatListResult);
8298
8199
  setLoaded();
8299
8200
  return true;
8300
8201
  };