cloud-web-corejs 1.0.235 → 1.0.237

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.235",
4
+ "version": "1.0.237",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
package/src/utils/vab.js CHANGED
@@ -7,11 +7,11 @@ function reqImg(a) {
7
7
 
8
8
  import request from "./request";
9
9
  import * as lodash from "lodash";
10
- import {Loading, Message, MessageBox, Notification, Form} from "element-ui";
10
+ import { Loading, Message, MessageBox, Notification, Form } from "element-ui";
11
11
  import store from "../store";
12
12
  import ElImageViewer from "../components/VabUpload/image-viewer";
13
13
 
14
- import {getToken} from "./auth";
14
+ import { getToken } from "./auth";
15
15
  import XEUtils from "xe-utils";
16
16
 
17
17
  import prefixConfig from "@/prefixConfig.js";
@@ -61,10 +61,14 @@ install = (Vue, opts = {}) => {
61
61
  if (opts.addCreateInfo === null || opts.addCreateInfo === undefined) {
62
62
  option.addCreateInfo = defaultOption.addCreateInfo;
63
63
  }
64
- if (opts.queryCreateInfo === null || opts.queryCreateInfo === undefined || opts.queryCreateInfo === true) {
64
+ if (
65
+ opts.queryCreateInfo === null ||
66
+ opts.queryCreateInfo === undefined ||
67
+ opts.queryCreateInfo === true
68
+ ) {
65
69
  option.queryCreateInfo = defaultOption.queryCreateInfo;
66
70
  }
67
- if(opts.queryCreateInfo === false){
71
+ if (opts.queryCreateInfo === false) {
68
72
  option.queryCreateInfo = "0";
69
73
  }
70
74
  return this.$http(option);
@@ -142,7 +146,7 @@ install = (Vue, opts = {}) => {
142
146
  return loading;
143
147
  };
144
148
  /* 全局Message */
145
- Vue.prototype.$baseMessage = ({message, type, onClose}) => {
149
+ Vue.prototype.$baseMessage = ({ message, type, onClose }) => {
146
150
  imFun.Message({
147
151
  offset: 60,
148
152
  showClose: true,
@@ -326,6 +330,7 @@ install = (Vue, opts = {}) => {
326
330
  "webp",
327
331
  "tga",
328
332
  "svg",
333
+ "vue",
329
334
  ];
330
335
  Vue.prototype.$commonFileUtil = {
331
336
  // 文件类型获取与判断接口
@@ -369,7 +374,7 @@ install = (Vue, opts = {}) => {
369
374
  gif: true,
370
375
  bmp: true,
371
376
  mpg: true,
372
- webp: true
377
+ webp: true,
373
378
  };
374
379
 
375
380
  let type = fileTypeMap[suffix];
@@ -503,12 +508,12 @@ install = (Vue, opts = {}) => {
503
508
  return true;
504
509
  },
505
510
  isPictureFile: function (fileName) {
506
- if(!fileName)return false;
511
+ if (!fileName) return false;
507
512
  let typeStr = Object.prototype.toString.call(fileName);
508
- let suffix = null
513
+ let suffix = null;
509
514
  if (typeStr === "[object Object]") {
510
515
  suffix = this.getFileSuffix(fileName.name);
511
- }else{
516
+ } else {
512
517
  suffix = this.getFileSuffix(fileName);
513
518
  }
514
519
  return this.isPicture(suffix);
@@ -634,17 +639,17 @@ install = (Vue, opts = {}) => {
634
639
  return iconType;
635
640
  },
636
641
  getFileExtension(urlString) {
637
- if(!urlString)return null
642
+ if (!urlString) return null;
638
643
  const url = new URL(urlString);
639
644
  // 获取路径部分,例如 "/images/photo.jpg"
640
645
  const pathname = url.pathname;
641
646
 
642
647
  // 使用 lastIndexOf 找到最后一个点的位置
643
- const lastDotIndex = pathname.lastIndexOf('.');
648
+ const lastDotIndex = pathname.lastIndexOf(".");
644
649
 
645
650
  // 如果没有点,或者点在最后一位(即没有后缀),返回空字符串
646
651
  if (lastDotIndex === -1 || lastDotIndex === pathname.length - 1) {
647
- return '';
652
+ return "";
648
653
  }
649
654
 
650
655
  // 截取点之后的部分
@@ -670,7 +675,7 @@ install = (Vue, opts = {}) => {
670
675
  }
671
676
  if (name) {
672
677
  let fileSuffix = this.getFileExtension(filePath);
673
- if(fileSuffix && !name.endsWith("."+fileSuffix)){
678
+ if (fileSuffix && !name.endsWith("." + fileSuffix)) {
674
679
  name = name + "." + fileSuffix;
675
680
  }
676
681
 
@@ -835,7 +840,12 @@ install = (Vue, opts = {}) => {
835
840
  let parentTarget = target.$attrs["parent-target"] || target.$parent;
836
841
  let originTarget = parentTarget.$refs._viewDialog ? parentTarget : target;
837
842
  let updateParam =
838
- param !== null && param !== undefined && param.updateParam !== null && param.updateParam !== undefined ? param.updateParam : {};
843
+ param !== null &&
844
+ param !== undefined &&
845
+ param.updateParam !== null &&
846
+ param.updateParam !== undefined
847
+ ? param.updateParam
848
+ : {};
839
849
  for (let key in updateParam) {
840
850
  originTarget.$emit("update:" + key, updateParam[key]);
841
851
  }
@@ -932,7 +942,6 @@ install = (Vue, opts = {}) => {
932
942
  Vue.prototype.$baseMul = baseMul;
933
943
  Vue.prototype.$baseDiv = baseDiv;
934
944
 
935
-
936
945
  /**
937
946
  * 格式化数字为带千分位的字符串。
938
947
  *
@@ -957,25 +966,25 @@ install = (Vue, opts = {}) => {
957
966
  * formatNumber(1000, { fixed: true, digits: 0 }); // "1,000"
958
967
  */
959
968
  function formatNumber(value, options = {}) {
960
- if (value === null || value === undefined || value === '') {
961
- return '';
969
+ if (value === null || value === undefined || value === "") {
970
+ return "";
962
971
  }
963
972
 
964
973
  const {
965
974
  fixed = false,
966
975
  digits = 2,
967
- thousandsSeparator = ',',
968
- decimalSeparator = '.'
976
+ thousandsSeparator = ",",
977
+ decimalSeparator = ".",
969
978
  } = options;
970
979
 
971
- const isNumber = typeof value === 'number';
980
+ const isNumber = typeof value === "number";
972
981
  let str = String(value).trim();
973
982
 
974
983
  // Normalize ".123" → "0.123"
975
984
  if (str.charCodeAt(0) === 46) {
976
- str = '0' + str;
977
- } else if (str.startsWith('-.')) {
978
- str = '-0.' + str.slice(2);
985
+ str = "0" + str;
986
+ } else if (str.startsWith("-.")) {
987
+ str = "-0." + str.slice(2);
979
988
  }
980
989
 
981
990
  let intPart, decPart, isNegative;
@@ -986,9 +995,9 @@ install = (Vue, opts = {}) => {
986
995
  if (num !== num) return str;
987
996
 
988
997
  const fixedStr = num.toFixed(digits);
989
- const dotIndex = fixedStr.indexOf('.');
998
+ const dotIndex = fixedStr.indexOf(".");
990
999
  intPart = dotIndex === -1 ? fixedStr : fixedStr.slice(0, dotIndex);
991
- decPart = dotIndex === -1 ? '' : fixedStr.slice(dotIndex + 1);
1000
+ decPart = dotIndex === -1 ? "" : fixedStr.slice(dotIndex + 1);
992
1001
  isNegative = intPart.charCodeAt(0) === 45;
993
1002
  if (isNegative) intPart = intPart.slice(1);
994
1003
  } else {
@@ -997,18 +1006,18 @@ install = (Vue, opts = {}) => {
997
1006
  isNegative = s.charCodeAt(0) === 45;
998
1007
  if (isNegative) s = s.slice(1);
999
1008
 
1000
- const dotIndex = s.indexOf('.');
1009
+ const dotIndex = s.indexOf(".");
1001
1010
  intPart = dotIndex === -1 ? s : s.slice(0, dotIndex);
1002
- decPart = dotIndex === -1 ? '' : s.slice(dotIndex + 1);
1011
+ decPart = dotIndex === -1 ? "" : s.slice(dotIndex + 1);
1003
1012
 
1004
- if (intPart === '') intPart = '0';
1013
+ if (intPart === "") intPart = "0";
1005
1014
  if (!/^\d+$/.test(intPart)) return str;
1006
1015
  }
1007
1016
 
1008
1017
  // 千分位(始终应用)
1009
1018
  let fmtInt = intPart;
1010
- if (intPart !== '0') {
1011
- let out = '';
1019
+ if (intPart !== "0") {
1020
+ let out = "";
1012
1021
  for (let i = intPart.length - 1, c = 0; i >= 0; i--, c++) {
1013
1022
  if (c > 0 && c % 3 === 0) out = thousandsSeparator + out;
1014
1023
  out = intPart[i] + out;
@@ -1017,11 +1026,11 @@ install = (Vue, opts = {}) => {
1017
1026
  }
1018
1027
 
1019
1028
  // 拼接
1020
- let result = isNegative ? '-' + fmtInt : fmtInt;
1029
+ let result = isNegative ? "-" + fmtInt : fmtInt;
1021
1030
  if (decPart) {
1022
1031
  result += decimalSeparator + decPart;
1023
1032
  } else if (fixed && digits > 0) {
1024
- result += decimalSeparator + '0'.repeat(digits);
1033
+ result += decimalSeparator + "0".repeat(digits);
1025
1034
  }
1026
1035
 
1027
1036
  return result;
@@ -1037,18 +1046,23 @@ install = (Vue, opts = {}) => {
1037
1046
  crypto.getRandomValues(buf);
1038
1047
  buf[6] = (buf[6] & 0x0f) | 0x40; // version 4
1039
1048
  buf[8] = (buf[8] & 0x3f) | 0x80; // variant RFC4122
1040
- const hex = Array.from(buf, b => b.toString(16).padStart(2, '0')).join('');
1041
- return `${hex.slice(0,8)}-${hex.slice(8,12)}-${hex.slice(12,16)}-${hex.slice(16,20)}-${hex.slice(20)}`;
1049
+ const hex = Array.from(buf, (b) => b.toString(16).padStart(2, "0")).join(
1050
+ ""
1051
+ );
1052
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(
1053
+ 12,
1054
+ 16
1055
+ )}-${hex.slice(16, 20)}-${hex.slice(20)}`;
1042
1056
  }
1043
1057
  Vue.prototype.$generateUUID = generateUUID;
1044
1058
 
1045
1059
  //数字精确位数
1046
1060
  Vue.prototype.$currency = function (value, priceScale, priceRoundType) {
1047
- if (value !== null && value !== undefined) {
1048
- if (priceScale === null || priceScale === undefined) {
1061
+ if (value !== null && value !== undefined) {
1062
+ if (priceScale === null || priceScale === undefined) {
1049
1063
  priceScale = 2;
1050
1064
  }
1051
- if (priceRoundType === null || priceRoundType === undefined) {
1065
+ if (priceRoundType === null || priceRoundType === undefined) {
1052
1066
  priceRoundType = "roundHalfUp";
1053
1067
  }
1054
1068
  let price;
@@ -1087,24 +1101,24 @@ install = (Vue, opts = {}) => {
1087
1101
  success: (res) => {
1088
1102
  let dicts = res.objx || [];
1089
1103
  let dictMap = {};
1090
- for(let item of dicts){
1104
+ for (let item of dicts) {
1091
1105
  dictMap[item.sn] = item.value;
1092
1106
  }
1093
1107
  /* dicts.forEach((item) => {
1094
1108
  dictMap[item.sn] = item.value;
1095
1109
  }); */
1096
1110
  option.success &&
1097
- option.success({
1098
- dicts,
1099
- dictMap,
1100
- });
1111
+ option.success({
1112
+ dicts,
1113
+ dictMap,
1114
+ });
1101
1115
  },
1102
1116
  });
1103
1117
  };
1104
1118
 
1105
1119
  imFun.Form.methods.$baseValidate = function (callback, opt) {
1106
1120
  let that = this;
1107
- that.validate((valid, obj,c,d) => {
1121
+ that.validate((valid, obj, c, d) => {
1108
1122
  if (!valid && (!opt || opt.errorTip !== false)) {
1109
1123
  this.$message({
1110
1124
  message: this.$t2("必填项不能为空", "system.message.required"),
@@ -1120,8 +1134,8 @@ install = (Vue, opts = {}) => {
1120
1134
  function scrollToFirstError(formTarget) {
1121
1135
  // 获取第一个验证失败的字段
1122
1136
  // let formTarget = this.$refs['renderForm'];
1123
- const firstErrorField = Object.keys(formTarget.fields).find(key => {
1124
- return formTarget.fields[key].validateState === 'error';
1137
+ const firstErrorField = Object.keys(formTarget.fields).find((key) => {
1138
+ return formTarget.fields[key].validateState === "error";
1125
1139
  });
1126
1140
 
1127
1141
  if (firstErrorField) {
@@ -1131,19 +1145,18 @@ install = (Vue, opts = {}) => {
1131
1145
  if (dom) {
1132
1146
  // 滚动到该字段位置
1133
1147
  dom.scrollIntoView({
1134
- behavior: 'smooth',
1135
- block: 'center'
1148
+ behavior: "smooth",
1149
+ block: "center",
1136
1150
  });
1137
1151
 
1138
1152
  // 添加高亮效果
1139
- dom.classList.add('highlight');
1153
+ dom.classList.add("highlight");
1140
1154
 
1141
1155
  // 3秒后移除高亮效果
1142
1156
  setTimeout(() => {
1143
- dom.classList.remove('highlight');
1157
+ dom.classList.remove("highlight");
1144
1158
  }, 3000);
1145
1159
  }
1146
-
1147
1160
  }
1148
1161
  }
1149
1162
 
@@ -1184,7 +1197,7 @@ install = (Vue, opts = {}) => {
1184
1197
  });
1185
1198
  };
1186
1199
  getDownloadDomian((domain) => {
1187
- if(fileName){
1200
+ if (fileName) {
1188
1201
  fileWhole.fileName = fileName;
1189
1202
  }
1190
1203
  that.$http({
@@ -1223,13 +1236,16 @@ install = (Vue, opts = {}) => {
1223
1236
  let lang = that.$i18n.locale;
1224
1237
  const i18n = that.$i18n;
1225
1238
  if (lang === "zh") {
1226
- let val = i18n._t(path, lang, {zh: {[path]: path}}, null, values);
1239
+ let val = i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1227
1240
  return val;
1228
1241
  } else {
1229
- if(!i18n.te(path)){
1230
- return i18n._t(path, lang, {zh: {[path]: path}}, null, values);
1231
- }else{
1232
- return i18n.t(path, values) || i18n._t(path, lang, {zh: {[path]: path}}, null, values);
1242
+ if (!i18n.te(path)) {
1243
+ return i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1244
+ } else {
1245
+ return (
1246
+ i18n.t(path, values) ||
1247
+ i18n._t(path, lang, { zh: { [path]: path } }, null, values)
1248
+ );
1233
1249
  }
1234
1250
  }
1235
1251
  };
@@ -1250,9 +1266,9 @@ install = (Vue, opts = {}) => {
1250
1266
  };
1251
1267
 
1252
1268
  Vue.prototype.$utcToLocal = function (utcTime) {
1253
- if(!utcTime)return utcTime;
1254
- let offsetHours = this.$store.getters.utcTransformOffset;// 时区偏移量,单位:小时
1255
- if(!offsetHours || offsetHours === 0)return utcTime;
1269
+ if (!utcTime) return utcTime;
1270
+ let offsetHours = this.$store.getters.utcTransformOffset; // 时区偏移量,单位:小时
1271
+ if (!offsetHours || offsetHours === 0) return utcTime;
1256
1272
  let localTime = moment(utcTime).add(offsetHours, "hours");
1257
1273
  return localTime.format("YYYY-MM-DD HH:mm:ss");
1258
1274
  };
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <vFormRender :formCode="formCode" :dataId.sync="dataId"
2
+ <vFormRender :formCode="formCode" :dataId.sync="dataId" :param="param"
3
3
  v-if="showEdit" visible-key="showEdit" :parent-target="_self"
4
4
  @reload="$reloadHandle"></vFormRender>
5
5
  </template>
@@ -14,15 +14,33 @@ export default {
14
14
  formCode: null,
15
15
  dataId: null,
16
16
  showEdit: false,
17
+ param: {},
17
18
  }
18
19
  },
19
20
  created() {
20
21
  this.init()
21
22
  },
22
23
  methods: {
24
+ parseViewParam() {
25
+ let param = {};
26
+ let rawParam = this.$attrs.param ?? this.$route.query.param;
27
+ if (rawParam) {
28
+ if (typeof rawParam === "string") {
29
+ try {
30
+ param = JSON.parse(rawParam) || {};
31
+ } catch (e) {
32
+ param = {};
33
+ }
34
+ } else if (typeof rawParam === "object") {
35
+ param = { ...rawParam };
36
+ }
37
+ }
38
+ return param;
39
+ },
23
40
  init() {
24
41
  let formCode = this.$route.query.formCode || this.$attrs.formCode;
25
42
  let dataId = this.$route.query.dataId || this.$attrs.dataId || this.$attrs._dataId;
43
+ this.param = this.parseViewParam();
26
44
 
27
45
  if (dataId && formCode) {
28
46
  this.formCode = formCode;
@@ -1,7 +1,12 @@
1
1
  <template>
2
2
  <div id="containt">
3
3
  <template v-if="layoutType == 'PC'">
4
- <x-tabs ref="xTabs" v-model="activeName" class="tab-box" :tabNameEnable="true">
4
+ <x-tabs
5
+ ref="xTabs"
6
+ v-model="activeName"
7
+ class="tab-box"
8
+ :tabNameEnable="true"
9
+ >
5
10
  <el-tab-pane :label="$t2('常规')" name="first">
6
11
  <vFormRender
7
12
  ref="edit"
@@ -17,11 +22,15 @@
17
22
  @openCopyEditTab="openCopyEditTab"
18
23
  ></vFormRender>
19
24
  </el-tab-pane>
20
- <el-tab-pane :label="$t2(formConfig.customListTabLabel || '列表')" name="second">
25
+ <el-tab-pane
26
+ :label="$t2(formConfig.customListTabLabel || '列表')"
27
+ name="second"
28
+ >
21
29
  <div class="grid-height">
22
30
  <vFormRender
23
31
  ref="list"
24
32
  :formCode="formCode"
33
+ :param="param"
25
34
  style="height: 100%"
26
35
  v-if="showRender"
27
36
  visible-key="showRender"
@@ -97,8 +106,9 @@
97
106
  >
98
107
  <div class="cont" style="height: calc(100vh - 73px)">
99
108
  <vFormRender
100
- :formCode="formCode2"
109
+ :formCode="formCode1"
101
110
  :dataId.sync="dataId"
111
+ :param="param"
102
112
  v-if="showEditDialog && showEdit"
103
113
  visible-key="showEdit"
104
114
  :parent-target="_self"
@@ -108,6 +118,7 @@
108
118
  </el-dialog>
109
119
  <vFormRender
110
120
  :formCode="formCode"
121
+ :param="param"
111
122
  style="height: 100%"
112
123
  v-if="showRender"
113
124
  visible-key="showRender"
@@ -159,6 +170,7 @@ export default {
159
170
  let num = Number(val.substring("otherTab".length));
160
171
  this.otherTabList[num].showContent = true;
161
172
  }
173
+ this.handleTabChange(val);
162
174
  },
163
175
  },
164
176
  created() {
@@ -171,11 +183,37 @@ export default {
171
183
  };
172
184
  },
173
185
  methods: {
186
+ handleTabChange(tabName) {
187
+ if (tabName == "second") {
188
+ this.$refs.list.dataTableSearch();
189
+ } else if (tabName.startsWith("otherTab")) {
190
+ let refName = tabName.replace("otherTab", "list");
191
+ if (this.$refs[refName]?.length)
192
+ this.$refs[refName][0].dataTableSearch();
193
+ }
194
+ },
195
+ parseViewParam() {
196
+ let param = {};
197
+ let rawParam = this.$attrs.param ?? this.$route.query.param;
198
+ if (rawParam) {
199
+ if (typeof rawParam === "string") {
200
+ try {
201
+ param = JSON.parse(rawParam) || {};
202
+ } catch (e) {
203
+ param = {};
204
+ }
205
+ } else if (typeof rawParam === "object") {
206
+ param = { ...rawParam };
207
+ }
208
+ }
209
+ return param;
210
+ },
174
211
  initParam() {
175
212
  let path = this.$route.path;
176
- let param = path.split("/").reverse();
213
+ let pathSegments = path.split("/").reverse();
177
214
 
178
- this.formCode = this.$attrs.formCode || param[0];
215
+ this.formCode = this.$attrs.formCode || pathSegments[0];
216
+ this.param = this.parseViewParam();
179
217
  this.showRender = true;
180
218
  },
181
219
  getReportTemplate() {
@@ -211,7 +249,9 @@ export default {
211
249
  openOtherTab(row, param, option) {
212
250
  let dataId = row && row.id ? row.id : null;
213
251
  let formCode = option.formCode;
214
- let otherTab = this.otherTabList.find((item) => item.formCode == formCode);
252
+ let otherTab = this.otherTabList.find(
253
+ (item) => item.formCode == formCode
254
+ );
215
255
  let otherTabIndex = this.otherTabList.findIndex(
216
256
  (item) => item.formCode == formCode
217
257
  );
@@ -227,21 +267,26 @@ export default {
227
267
  });
228
268
  },
229
269
  openEditDialog(row, param, option) {
270
+ debugger;
230
271
  if (option?.otherTab) {
231
272
  this.openOtherTab(row, param, option);
232
273
  return;
233
274
  }
234
275
  if (this.layoutType == "H5") {
235
- this.openEditH5Dialog(row);
276
+ this.openEditH5Dialog(row, param);
236
277
  return;
237
278
  }
238
279
  let formConfig = this.formJson.formConfig;
239
- let tabLabelField = option?.multiTabLabelField || formConfig.multiTabLabelField;
280
+ let tabLabelField =
281
+ option?.multiTabLabelField || formConfig.multiTabLabelField;
240
282
  let multiTabEnabled = false;
241
283
  if (tabLabelField) {
242
284
  if (option?.multiTabEnabled) {
243
285
  multiTabEnabled = true;
244
- } else if (formConfig.multiTabEnabled && option?.multiTabEnabled !== false) {
286
+ } else if (
287
+ formConfig.multiTabEnabled &&
288
+ option?.multiTabEnabled !== false
289
+ ) {
245
290
  multiTabEnabled = true;
246
291
  }
247
292
  }
@@ -275,9 +320,11 @@ export default {
275
320
  openEditDialog1(row, param, option) {
276
321
  this.openEditDialog(row, param, { multiTabEnabled: false, ...option });
277
322
  },
278
- openEditH5Dialog(row) {
323
+ openEditH5Dialog(row, param) {
324
+ debugger;
279
325
  this.formCode1 = this.addFormCode;
280
326
  this.dataId = row && row.id ? row.id : null;
327
+ this.param = param;
281
328
  this.activeName = "first";
282
329
  this.showEdit = false;
283
330
  this.showEditDialog = true;