cnhis-design-vue 3.0.4 → 3.0.7

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,13 @@ 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
7911
  strategy: { type: String, required: false, default: "MULTI" },
7913
- versionType: { type: [Number, String], required: false, default: "2" }
7912
+ printParams: { type: Array, required: false }
7914
7913
  },
7915
7914
  emits: ["success", "error"],
7916
7915
  setup(__props, { emit }) {
@@ -7951,7 +7950,7 @@ var script = /* @__PURE__ */ defineComponent({
7951
7950
  let id = state.currentFormatId;
7952
7951
  return state.formatList.find((item) => item.id === id);
7953
7952
  });
7954
- const formatTitle = computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
7953
+ computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
7955
7954
  const getTemplateIdByFormatId = (id) => {
7956
7955
  let find = state.formatList.find((item) => item.id === id);
7957
7956
  return find.templateId;
@@ -7973,36 +7972,8 @@ var script = /* @__PURE__ */ defineComponent({
7973
7972
  };
7974
7973
  emit("error", error);
7975
7974
  };
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
7975
  const getPrintParams = (index = 0) => {
8005
- const params = state.printParams[index];
7976
+ const params = props.printParams?.length ? props.printParams[index] : state.printParams[index];
8006
7977
  return JSON.stringify(params);
8007
7978
  };
8008
7979
  const getOnceParams = () => {
@@ -8044,49 +8015,26 @@ var script = /* @__PURE__ */ defineComponent({
8044
8015
  prevFnError();
8045
8016
  return Promise.reject();
8046
8017
  }).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 {
8018
+ if (props.strategy === "MULTI") {
8019
+ for (let i = 0; i < state.printParams.length; i++) {
8080
8020
  const queryParams = {
8081
8021
  formatId: state.currentFormatId,
8082
8022
  templateId: getTemplateIdByFormatId(state.currentFormatId),
8083
- params: getOnceParams()
8023
+ params: getPrintParams(i)
8084
8024
  };
8085
- printInstance.printDirect(queryParams, (res) => {
8086
- callLocalServicesSuccessCb(res, "print");
8087
- }, callLocalServicesErrorCb);
8025
+ printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
8088
8026
  }
8089
8027
  }
8028
+ else {
8029
+ const queryParams = {
8030
+ formatId: state.currentFormatId,
8031
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
8032
+ params: getOnceParams()
8033
+ };
8034
+ printInstance.printDirect(queryParams, (res) => {
8035
+ callLocalServicesSuccessCb(res, "print");
8036
+ }, callLocalServicesErrorCb);
8037
+ }
8090
8038
  }).finally(() => {
8091
8039
  state.visible = false;
8092
8040
  });
@@ -8096,26 +8044,15 @@ var script = /* @__PURE__ */ defineComponent({
8096
8044
  prevFnError();
8097
8045
  return Promise.reject();
8098
8046
  }).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
- }
8047
+ const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
8048
+ const queryParams = {
8049
+ formatId: state.currentFormatId,
8050
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
8051
+ params
8052
+ };
8053
+ printInstance.preview(queryParams, (res) => {
8054
+ callLocalServicesSuccessCb(res, "preview");
8055
+ }, callLocalServicesErrorCb);
8119
8056
  }).finally(() => {
8120
8057
  state.visible = false;
8121
8058
  });
@@ -8125,18 +8062,7 @@ var script = /* @__PURE__ */ defineComponent({
8125
8062
  prevFnError();
8126
8063
  return Promise.reject();
8127
8064
  }).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
- }
8065
+ state.identityVerification.visible = true;
8140
8066
  }).finally(() => {
8141
8067
  state.visible = false;
8142
8068
  });
@@ -8181,25 +8107,6 @@ var script = /* @__PURE__ */ defineComponent({
8181
8107
  let findDefault = list.find((item) => item[key] == 1);
8182
8108
  return findDefault?.id || list[0].id;
8183
8109
  };
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
8110
  const formatFormatList = (list) => {
8204
8111
  let formatList = [];
8205
8112
  list.forEach((item) => {
@@ -8263,7 +8170,7 @@ var script = /* @__PURE__ */ defineComponent({
8263
8170
  };
8264
8171
  const initCRM = async (formatListResult) => {
8265
8172
  state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
8266
- setOptions();
8173
+ console.log("formatListResult", formatListResult);
8267
8174
  state.currentFormatId = getDefaultFormatId(state.formatList, "defaultFlag");
8268
8175
  if (!state.currentFormatId) {
8269
8176
  window.$message.error("\u83B7\u53D6\u6253\u5370\u683C\u5F0F\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01");
@@ -8289,12 +8196,7 @@ var script = /* @__PURE__ */ defineComponent({
8289
8196
  setTimeoutSpin();
8290
8197
  instantiatePrintSDK();
8291
8198
  const formatListResult = await props.queryPrintFormatByNumber();
8292
- if (props.versionType == 1 || props.versionType == 3) {
8293
- initHIS(formatListResult);
8294
- }
8295
- else {
8296
- await initCRM(formatListResult);
8297
- }
8199
+ await initCRM(formatListResult);
8298
8200
  setLoaded();
8299
8201
  return true;
8300
8202
  };