cloud-web-corejs 1.0.54-dev.165 → 1.0.54-dev.166

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.165",
4
+ "version": "1.0.54-dev.166",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -63,7 +63,8 @@
63
63
  custom-class="dialog-style"
64
64
  width="501px"
65
65
  height="250px"
66
- @close="dialogClose2"
66
+ :beforeClose="handleBeforeClose"
67
+ @close="handleClose2"
67
68
  v-el-drag-dialog
68
69
  >
69
70
  <div>
@@ -176,7 +176,7 @@ tmixins = {
176
176
  },
177
177
  dialogClose1() {
178
178
  this.importLoading = false;
179
- if (!this.showImportDialog2) {
179
+ if(!this.showImportDialog2){
180
180
  this.$emit("update:visiable", false);
181
181
  this.showContent = false;
182
182
  }
@@ -267,20 +267,63 @@ tmixins = {
267
267
  })
268
268
  return
269
269
  },
270
- dialogClose2(flag) {
270
+ handleBeforeClose(hide) {
271
+ this.option.onCancel && this.option.onCancel(this.getCallbackData(), this.fileRaw);
272
+ let importOption = this.option.importOption;
273
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.getCallbackData(), this.fileRaw])
274
+ this.handleTableCallback();
275
+ hide();
276
+ },
277
+ dialogClose2() {
278
+ this.showImportDialog2 = false;
279
+ this.option.onBeforeCancel && this.option.onBeforeCancel(this.getCallbackData(), this.fileRaw);
280
+ let importOption = this.option.importOption;
281
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.getCallbackData(), this.fileRaw])
282
+ this.handleTableCallback();
283
+ },
284
+ handleClose2() {
285
+ this.clearImportTimer();
286
+ this.showImportDialog2 = false;
287
+ this.showContent = false;
288
+ this.option.onClose && this.option.onClose(this.getCallbackData(), this.fileRaw);
289
+ this.option.callback && this.option.callback(this.getCallbackData(), this.fileRaw);
290
+ this.dialogClose1();
291
+ },
292
+ dialogPrimary2() {
293
+ let importOption = this.option.importOption;
294
+ this.showImportDialog2 = false;
295
+ this.option.onBeforeConfirm && this.option.onBeforeConfirm(this.getCallbackData(), this.fileRaw);
296
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.getCallbackData(), this.fileRaw])
297
+ this.handleTableCallback();
298
+ },
299
+ getCallbackData() {
300
+ return {
301
+ ...this.resultData,
302
+ 'successRows': this.successRows,
303
+ "failRows": this.failRows
304
+ };
305
+ },
306
+
307
+
308
+ /*dialogClose2(flag) {
309
+ let importOption = this.option.importOption;
271
310
  this.clearImportTimer();
272
311
  this.showImportDialog2 = false;
273
312
  this.dialogClose1();
274
313
  this.handleTableCallback(flag);
275
- this.option.callback && this.option.callback();
314
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.resultData, this.fileRaw])
315
+ this.option.callback && this.option.callback(this.resultData, this.fileRaw);
276
316
  },
277
317
  dialogPrimary2() {
318
+ let importOption = this.option.importOption;
278
319
  this.clearImportTimer();
279
320
  this.showImportDialog2 = false;
280
321
  this.dialogClose1()
281
322
  this.handleTableCallback();
282
- this.option.callback && this.option.callback(this.resultData);
283
- },
323
+ let fileRaw = this.fileRaw;
324
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.resultData, this.fileRaw])
325
+ this.option.callback && this.option.callback(this.resultData, this.fileRaw);
326
+ },*/
284
327
  handleTableCallback(flag) {
285
328
  if (flag === 0) return;
286
329
  let importOption = this.option.importOption;
@@ -312,7 +355,7 @@ tmixins = {
312
355
  that.showContent = false;
313
356
  that.clearImportTimer();*/
314
357
  that.$baseAlert(this.$t2('请使用正确的导入模版!', 'components.excelImport.warmMsg2'));
315
- that.dialogClose2(0);
358
+ that.handleClose2();
316
359
  return false;
317
360
  }
318
361
  var range = configUtil.XLSX.utils.decode_range(sheet['!ref']);
@@ -378,7 +421,7 @@ tmixins = {
378
421
  // that.showContent = false;
379
422
  // that.clearImportTimer();
380
423
  that.$baseAlert(this.$t2('请使用正确的导入模版!', 'components.excelImport.warmMsg2'));
381
- that.dialogClose2(0);
424
+ that.handleClose2();
382
425
  return false;
383
426
  }
384
427
 
@@ -393,7 +436,7 @@ tmixins = {
393
436
  // that.showContent = false;
394
437
  // that.clearImportTimer();
395
438
  that.$baseAlert(this.$t2('请使用正确的导入模版!', 'components.excelImport.warmMsg2'));
396
- that.dialogClose2(0);
439
+ that.handleClose2();
397
440
  return false;
398
441
  }
399
442
  let t = title.substr(-1);
@@ -448,6 +491,7 @@ tmixins = {
448
491
  lineNo: (j + 4),
449
492
  title: oriCol.title
450
493
  }));
494
+ that.handleClose2();
451
495
  return false;
452
496
  }
453
497
  }
@@ -834,6 +878,9 @@ tmixins = {
834
878
  clearImportTimer() {
835
879
  clearInterval(importTimer);
836
880
  loadingObj && loadingObj.close();
881
+ },
882
+ getWidgetTarget() {
883
+
837
884
  },
838
885
  async dialogPrimary3() {
839
886
  if (!(this.fileRaw)) {
@@ -846,13 +893,27 @@ tmixins = {
846
893
  target: document.body,
847
894
  background: 'unset'
848
895
  });
849
- let done = () => {
850
- that.showImportDialog = false;
851
- }
896
+
897
+ let importOption = option.importOption;
852
898
  this.readExcel(this.fileRaw, function (resultData) {
899
+ let file = that.fileRaw;
900
+ let flag = false;
901
+ let done = () => {
902
+ if (flag) return
903
+ flag = true;
904
+ that.showImportDialog = false;
905
+ that.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [resultData, file])
906
+ }
853
907
  try {
854
- if (option.callback && option.callback(resultData, that.fileRaw, done) !== false) {
855
- that.showImportDialog = false;
908
+
909
+ if (importOption.onConfirmImportEnabled) {
910
+ if (that.parentTarget.handleCustomEvent(importOption.onConfirmImport, ['resultData', 'file', 'done'], [resultData, file, done]) !== false) {
911
+ done();
912
+ }
913
+ } else if (importOption.tableRef) {
914
+ let tableRef = that.parentTarget.getWidgetRef(importOption.tableRef);
915
+ tableRef && tableRef.addTableData(resultData.data)
916
+ done()
856
917
  }
857
918
  } catch (et) {
858
919
  console.error(et);
@@ -5,7 +5,7 @@
5
5
  :parent-widget="parentWidget" :parent-list="parentList"
6
6
  :index-of-parent-list="indexOfParentList">
7
7
  <el-button type="primary" class="button-sty" size="mini" icon="el-icon-download" @click="importHandle"
8
- :disabled="field.options.disabled">{{ $t1('导入') }}
8
+ :disabled="field.options.disabled">{{ getI18nLabel(field.options.label)}}
9
9
  </el-button>
10
10
  </static-content-wrapper>
11
11
 
@@ -61,16 +61,11 @@ export default {
61
61
 
62
62
  methods: {
63
63
  importHandle() {
64
- let scriptCode = this.field.options.importScriptCode;
65
- let entity = this.field.options.importEntity;
66
- let importAttachCode = this.field.options.importAttachCode;
67
- // let importCodes = this.field.options.importCodes;
68
64
  this.getFormRef().openImportDialog({
69
65
  importOption: this.field.options,
70
- importFrontOnly: !!this.field.options.importFrontOnly,
66
+ importFrontOnly: false,
71
67
  callback: (resultData, file, done) => {
72
- // this.getWidgetRef(tableTarget).searchEvent();
73
- this.handleCustomEvent(this.field.options.onConfirmImport, ['resultData', 'file', 'done'], [resultData, file, done])
68
+
74
69
  }
75
70
  });
76
71
  }
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <static-content-wrapper
3
+ :designer="designer" :field="field" :design-state="designState"
4
+ :display-style="field.options.displayStyle"
5
+ :parent-widget="parentWidget" :parent-list="parentList"
6
+ :index-of-parent-list="indexOfParentList">
7
+ <el-button type="primary" class="button-sty" size="mini" icon="el-icon-download" @click="importHandle"
8
+ :disabled="field.options.disabled">{{ getI18nLabel(field.options.label)}}
9
+ </el-button>
10
+ </static-content-wrapper>
11
+
12
+ </template>
13
+ <script>
14
+ import emitter from '../../../../../components/xform/utils/emitter'
15
+ import i18n from "../../../../../components/xform/utils/i18n";
16
+ import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
17
+ import StaticContentWrapper
18
+ from "../../../../../components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue";
19
+
20
+ export default {
21
+ name: "import2-button-widget",
22
+ components: {StaticContentWrapper},
23
+ componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
24
+ mixins: [emitter, fieldMixin, i18n],
25
+ props: {
26
+ field: Object,
27
+ parentWidget: Object,
28
+ parentList: Array,
29
+ indexOfParentList: Number,
30
+ designer: Object,
31
+ designState: {
32
+ type: Boolean,
33
+ default: false
34
+ }
35
+ },
36
+ data() {
37
+ return {
38
+ exportOption: {}
39
+ }
40
+ },
41
+ beforeCreate() {
42
+ /* 这里不能访问方法和属性!! */
43
+ },
44
+ created() {
45
+
46
+ /* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
47
+ 需要在父组件created中初始化!! */
48
+ this.registerToRefList()
49
+ this.initEventHandler()
50
+
51
+ this.handleOnCreated()
52
+ },
53
+
54
+ mounted() {
55
+ this.handleOnMounted()
56
+ },
57
+
58
+ beforeDestroy() {
59
+ this.unregisterFromRefList()
60
+ },
61
+
62
+ methods: {
63
+ importHandle() {
64
+ this.getFormRef().openImportDialog({
65
+ importOption: this.field.options,
66
+ importFrontOnly: true,
67
+ callback: (resultData, file, done) => {
68
+
69
+ }
70
+ });
71
+ }
72
+ }
73
+
74
+ }
75
+ </script>
76
+
77
+ <style lang="scss" scoped>
78
+ @import "~@/styles/global.scss"; //* static-content-wrapper已引入,还需要重复引入吗? *//
79
+
80
+ </style>
@@ -1,12 +1,9 @@
1
1
  <template>
2
2
  <div>
3
3
  <el-form-item label-width="0">
4
- <el-divider class="custom-divider">导入设置</el-divider>
4
+ <el-divider class="custom-divider">后端导入设置</el-divider>
5
5
  </el-form-item>
6
- <el-form-item label="仅导入到前端">
7
- <el-switch v-model="optionModel.importFrontOnly"></el-switch>
8
- </el-form-item>
9
- <el-form-item label="导入数据表名" v-if="!optionModel.importFrontOnly">
6
+ <el-form-item label="导入数据表名">
10
7
  <el-input v-model="optionModel.importEntity"></el-input>
11
8
  </el-form-item>
12
9
  <el-form-item label="文件大小限制(M)">
@@ -22,28 +19,27 @@
22
19
  <i slot="suffix" class="el-input__icon el-icon-search" @click="showBdAttachSettingDialog = true"></i>
23
20
  </el-input>
24
21
  </el-form-item>
25
- <template v-if="!optionModel.importFrontOnly">
26
- <el-form-item label="执行后台脚本编码">
27
- <el-input v-model="optionModel.importScriptCode"></el-input>
28
- </el-form-item>
29
- <el-form-item label="关联表格唯一名称">
30
- <el-input v-model="optionModel.tableRef"></el-input>
31
- </el-form-item>
32
- <el-form-item label="启用图片处理">
33
- <el-switch v-model="optionModel.enabledImportPreHandle"></el-switch>
34
- </el-form-item>
35
- <el-form-item label="导入前数据处理" label-width="150px">
36
- <a href="javascript:void(0);" class="a-link link-oneLind"
37
- @click="editEventHandler('onBeforeImport', onBeforeImportParams)">
38
- <span>{{ optionModel.onBeforeImport }}</span>
39
- <i class="el-icon-edit"></i>
40
- </a>
41
- </el-form-item>
42
- </template>
43
- <el-form-item label="确认回调" label-width="150px" v-if="optionModel.importFrontOnly">
22
+ <el-form-item label="关联表格唯一名称">
23
+ <el-input v-model="optionModel.tableRef"></el-input>
24
+ </el-form-item>
25
+ <el-form-item label="执行后台脚本编码">
26
+ <el-input v-model="optionModel.importScriptCode"></el-input>
27
+ </el-form-item>
28
+ <el-form-item label="启用图片处理">
29
+ <el-switch v-model="optionModel.enabledImportPreHandle"></el-switch>
30
+ </el-form-item>
31
+ <el-form-item label="导入前数据处理" label-width="150px">
32
+ <a href="javascript:void(0);" class="a-link link-oneLind"
33
+ @click="editEventHandler('onBeforeImport', onBeforeImportParams)">
34
+ <span>{{ optionModel.onBeforeImport }}</span>
35
+ <i class="el-icon-edit"></i>
36
+ </a>
37
+ </el-form-item>
38
+
39
+ <el-form-item label="导入完成回调" label-width="150px">
44
40
  <a href="javascript:void(0);" class="a-link link-oneLind"
45
- @click="editEventHandler('onConfirmImport', onConfirmImportParams)">
46
- <span>{{ optionModel.onConfirmImport }}</span>
41
+ @click="editEventHandler('onSuccessImport', onSuccessImportParams)">
42
+ <span>{{ optionModel.onSuccessImport }}</span>
47
43
  <i class="el-icon-edit"></i>
48
44
  </a>
49
45
  </el-form-item>
@@ -73,7 +69,8 @@ export default {
73
69
  eventParams: [],
74
70
  showBdAttachSettingDialog: false,
75
71
  onBeforeImportParams: ["dataId", "formCode", 'file', 'resultData', 'done'],
76
- onConfirmImportParams: ["dataId", "formCode", 'resultData', 'file', 'done']
72
+ onConfirmImportParams: ["dataId", "formCode", 'resultData', 'file', 'done'],
73
+ onSuccessImportParams: ["dataId", "formCode", 'resultData', 'file']
77
74
  };
78
75
  },
79
76
  methods: {
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div>
3
+ <el-form-item label-width="0">
4
+ <el-divider class="custom-divider">前端导入设置</el-divider>
5
+ </el-form-item>
6
+ <el-form-item label="文件大小限制(M)">
7
+ <base-input-number v-model="optionModel.importFileLimitSize" :max="200"></base-input-number>
8
+ </el-form-item>
9
+ <el-form-item label="选择导入模板文件">
10
+ <el-input
11
+ class="search-input"
12
+ max="200"
13
+ v-model="optionModel.importAttachCode"
14
+ clearable
15
+ >
16
+ <i slot="suffix" class="el-input__icon el-icon-search" @click="showBdAttachSettingDialog = true"></i>
17
+ </el-input>
18
+ </el-form-item>
19
+ <el-form-item label="关联表格唯一名称">
20
+ <el-input v-model="optionModel.tableRef"></el-input>
21
+ </el-form-item>
22
+ <el-form-item label="启用确认回调">
23
+ <el-switch v-model="optionModel.onConfirmImportEnabled"></el-switch>
24
+ </el-form-item>
25
+ <el-form-item label="确认回调" label-width="150px" v-if="optionModel.onConfirmImportEnabled">
26
+ <a href="javascript:void(0);" class="a-link link-oneLind"
27
+ @click="editEventHandler('onConfirmImport', onConfirmImportParams)">
28
+ <span>{{ optionModel.onConfirmImport }}</span>
29
+ <i class="el-icon-edit"></i>
30
+ </a>
31
+ </el-form-item>
32
+ <el-form-item label="导入完成回调" label-width="150px">
33
+ <a href="javascript:void(0);" class="a-link link-oneLind"
34
+ @click="editEventHandler('onSuccessImport', onSuccessImportParams)">
35
+ <span>{{ optionModel.onSuccessImport }}</span>
36
+ <i class="el-icon-edit"></i>
37
+ </a>
38
+ </el-form-item>
39
+
40
+ <bdAttachSettingDialog v-if="showBdAttachSettingDialog" :visiable.sync="showBdAttachSettingDialog" :multi="false"
41
+ @confirm="confirmBdAttachSettingDialog"></bdAttachSettingDialog>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ import i18n from "../../../../../../components/xform/utils/i18n";
47
+ import eventMixin
48
+ from "../../../../../../components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin";
49
+ import bdAttachSettingDialog from "../../../../../../views/bd/setting/bd_attach_setting/dialog.vue";
50
+
51
+ export default {
52
+ name: "import2-button-editor",
53
+ components: {bdAttachSettingDialog},
54
+ mixins: [i18n, eventMixin],
55
+ props: {
56
+ designer: Object,
57
+ selectedWidget: Object,
58
+ optionModel: Object,
59
+ },
60
+ data() {
61
+ return {
62
+ eventParams: [],
63
+ showBdAttachSettingDialog: false,
64
+ onBeforeImportParams: ["dataId", "formCode", 'file', 'resultData', 'done'],
65
+ onConfirmImportParams: ["dataId", "formCode", 'resultData', 'file', 'done'],
66
+ onSuccessImportParams: ["dataId", "formCode", 'resultData', 'file']
67
+ };
68
+ },
69
+ methods: {
70
+ confirmBdAttachSettingDialog(rows) {
71
+ if (rows.length) {
72
+ let row = rows[0];
73
+ this.optionModel.importAttachCode = row.code;
74
+ }
75
+ }
76
+ }
77
+ };
78
+ </script>
79
+
80
+ <style scoped></style>
@@ -140,6 +140,7 @@ const COMMON_PROPERTIES = {
140
140
 
141
141
  tableExportParam: "table-export-button-editor",
142
142
  importEntity: "import-button-editor",
143
+ frontImportFlag: "import2-button-editor",
143
144
  printTableRef: "print-button-editor",
144
145
  statusParam: "field-status-editor",
145
146
  // searchDialogEventEnabled: "search-dialog-event-editor"
@@ -2793,7 +2793,7 @@ export const advancedFields = [
2793
2793
  label: "导入",
2794
2794
  columnWidth: "200px",
2795
2795
  size: "",
2796
- importFileLimitSize: 200,
2796
+
2797
2797
  // displayStyle: "block",
2798
2798
  disabled: !1,
2799
2799
  hidden: !1,
@@ -2810,14 +2810,57 @@ export const advancedFields = [
2810
2810
  ...defaultSearchDialogConfig
2811
2811
  },
2812
2812
  ...defaultWfConfig,
2813
+
2814
+ importFileLimitSize: 200,
2813
2815
  importEntity: '',
2814
2816
  importAttachCode: '',
2815
2817
  importScriptCode: '',
2816
2818
  onBeforeImport: '',
2817
2819
  enabledImportPreHandle: false,
2820
+ tableRef:'',
2821
+ onSuccessImport:'',
2822
+
2823
+ showRuleFlag: 1,
2824
+ showRuleEnabled: 1,
2825
+ showRules: []
2826
+ },
2827
+ },
2828
+ {
2829
+ type: "import2-button",
2830
+ icon: "button",
2831
+ commonFlag: !0,
2832
+ columnFlag: true,
2833
+ formItemFlag: !1,
2834
+ options: {
2835
+ name: "",
2836
+ label: "明细导入",
2837
+ columnWidth: "200px",
2838
+ size: "",
2818
2839
 
2819
- importFrontOnly: false,
2840
+ // displayStyle: "block",
2841
+ disabled: !1,
2842
+ hidden: !1,
2843
+ type: "primary",
2844
+ /*plain: !1,
2845
+ round: !1,
2846
+ circle: !1,
2847
+ icon: "el-icon-download",*/
2848
+ customClass: "",
2849
+ onCreated: "",
2850
+ onMounted: "",
2851
+ // clickBindEvent: null,
2852
+ searchDialogConfig: {
2853
+ ...defaultSearchDialogConfig
2854
+ },
2855
+ ...defaultWfConfig,
2856
+
2857
+ frontImportFlag:1,
2858
+ importFileLimitSize: 200,
2859
+ importAttachCode: '',
2860
+ tableRef:'',
2861
+ onConfirmImportEnabled:false,
2820
2862
  onConfirmImport: '',
2863
+ onSuccessImport:'',
2821
2864
 
2822
2865
  showRuleFlag: 1,
2823
2866
  showRuleEnabled: 1,
@@ -69,6 +69,7 @@ export default {
69
69
  "export_button": "导出按钮",
70
70
  "import_button": "导入按钮",
71
71
  "import-button": "导入按钮",
72
+ "import2-button": "明细导入按钮",
72
73
  "print-button": "导出/打印按钮",
73
74
  "rich-editor": "富文本",
74
75
  cascader: "级联选择",