cloud-web-corejs 1.0.235 → 1.0.236

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.236",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -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;