cloud-web-corejs 1.0.54-dev.391 → 1.0.54-dev.393

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.54-dev.391",
4
+ "version": "1.0.54-dev.393",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -62,6 +62,7 @@
62
62
  :data="fieldTreeData"
63
63
  :filter-node-method="filterNode"
64
64
  @node-click="insertField"
65
+ default-expand-all
65
66
  >
66
67
  <template #default="{ node, data }">
67
68
  <span class="custom-tree-node">
@@ -292,15 +293,6 @@ export default {
292
293
  handleTableConfigData(widget, callback) {
293
294
  callback(widget);
294
295
  },
295
- initFields() {
296
- let option = this.option;
297
- let formCode = option.formCode;
298
- if (formCode) {
299
- this.getReportTemplate(formCode, () => {
300
- this.loadFieldListToTree();
301
- });
302
- }
303
- },
304
296
  initHandleFields() {
305
297
  let option = this.option;
306
298
  let formWidgetNames = option.formWidgetNames || [];
@@ -353,11 +345,11 @@ export default {
353
345
  }
354
346
  });
355
347
  },
356
- async getReportTemplate(formCode, callback) {
348
+ getReportTemplate(formCode, callback) {
357
349
  let url, data;
358
350
  url = USER_PREFIX + `/formTemplate/getByFormCode`;
359
351
  data = { stringOne: formCode };
360
- await this.$http({
352
+ return this.$http({
361
353
  // aes: true,
362
354
  url: url,
363
355
  method: `post`,
@@ -365,7 +357,7 @@ export default {
365
357
  isLoading: true,
366
358
  // loadingTarget: document.body,
367
359
  // modalStrictly: true,
368
- success: async (res) => {
360
+ success: (res) => {
369
361
  let formTemplate = res.objx || {};
370
362
  this.targetFormTemplate = formTemplate;
371
363
  this.targetFormJson = formTemplate.formViewContent
@@ -616,30 +608,37 @@ export default {
616
608
 
617
609
  // 打开编辑公式弹窗
618
610
  editFormula() {
611
+ this.formula = this.option.formula ?? null;
619
612
  this.fieldTreeData.length = 0;
620
613
  // 初始化字段树
621
614
 
622
615
  // this.loadFieldListToTree();
623
- this.initFields();
624
-
625
- console.log("设计器字段===>", this.fieldTreeData);
626
-
627
- // 加载当前字段计算公式tags
628
- this.refreshFormula();
629
- const code = this.formula;
630
- this.formulaDialogVisible = true;
631
-
632
- //==== codeMirror 挂载视图 ====
633
- this.$nextTick(() => {
634
- this.codeMirror = new EditorView({
635
- state: EditorState.create({
636
- doc: code,
637
- extensions: [basicSetup, javascript(), [baseTheme, [], placeholders]],
638
- }),
639
- parent: this.$refs.cmRef,
616
+
617
+ let option = this.option;
618
+ let formCode = option.formCode;
619
+ if (formCode) {
620
+ this.getReportTemplate(formCode, () => {
621
+ this.loadFieldListToTree();
622
+ console.log("设计器字段===>", this.fieldTreeData);
623
+
624
+ // 加载当前字段计算公式tags
625
+ this.refreshFormula();
626
+ const code = this.formula;
627
+ this.formulaDialogVisible = true;
628
+
629
+ //==== codeMirror 挂载视图 ====
630
+ this.$nextTick(() => {
631
+ this.codeMirror = new EditorView({
632
+ state: EditorState.create({
633
+ doc: code,
634
+ extensions: [basicSetup, javascript(), [baseTheme, [], placeholders]],
635
+ }),
636
+ parent: this.$refs.cmRef,
637
+ });
638
+ console.log("编辑器实例==>", this.codeMirror);
639
+ });
640
640
  });
641
- console.log("编辑器实例==>", this.codeMirror);
642
- });
641
+ }
643
642
  },
644
643
 
645
644
  // 保存计算公式
@@ -825,7 +825,6 @@ export default {
825
825
 
826
826
  // this.setValue(value);
827
827
  this.fieldModel = value;
828
- // debugger;
829
828
  this.$nextTick(() => {
830
829
  this.showGantt = true;
831
830
  });
@@ -198,7 +198,10 @@ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, for
198
198
  let fieldRef = VFR.getWidgetRef(fieldSchema.options.name)
199
199
  if (!!fieldRef) {
200
200
  //是否要考虑字符串值的替换??
201
- resultFormula = resultFormula.replace(mi, fieldRef.getValue())
201
+ // resultFormula = resultFormula.replace(mi, fieldRef.getValue())
202
+ let fieldKeyName = getFieldKeyName(fieldSchema)
203
+ let value = fieldRef.formModel[fieldKeyName];
204
+ resultFormula = resultFormula.replace(mi, value)
202
205
  } else { //getWidgetRef找不到,则可能是子表单字段
203
206
  const subFormNameOfField = VFR.getSubFormNameOfWidget(fieldSchema.options.name)
204
207
  if (!!formulaFieldRef.subFormItemFlag || formulaFieldRef.tableParam || row) {