cloud-web-corejs 1.0.54-dev.537 → 1.0.54-dev.539

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.537",
4
+ "version": "1.0.54-dev.539",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <el-button
3
+ @click="openUniverDialog"
4
+ type="primary"
5
+ class="button-sty"
6
+ icon="el-icon-edit"
7
+ >
8
+ {{ !!value ? "已维护" : "" }}
9
+ <univerDialog
10
+ v-if="showDialog"
11
+ :visiable.sync="showDialog"
12
+ :data.sync="value"
13
+ title="title"
14
+ :readonly="readonly"
15
+ @confirm="confirmUniverDialog"
16
+ :univerConfig="univerConfig"
17
+ ></univerDialog>
18
+ </el-button>
19
+ </template>
20
+ <script>
21
+ import univerDialog from "./dialog.vue";
22
+ export default {
23
+ name: "univerButton",
24
+ props: {
25
+ value: String,
26
+ title: {
27
+ type: String,
28
+ default: "excel",
29
+ },
30
+ readonly: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ univerConfig: {
35
+ type: Object,
36
+ default: () => {},
37
+ },
38
+ },
39
+ components: {
40
+ univerDialog,
41
+ },
42
+ data() {
43
+ return {
44
+ showDialog: false,
45
+ };
46
+ },
47
+ methods: {
48
+ openUniverDialog() {
49
+ this.showDialog = true;
50
+ },
51
+ confirmUniverDialog(result) {
52
+ this.$emit("input", result);
53
+ this.$emit("change", result);
54
+ },
55
+ },
56
+ };
57
+ </script>
@@ -0,0 +1,129 @@
1
+ <template>
2
+ <el-dialog
3
+ :visible.sync="showDialog"
4
+ :fullscreen="true"
5
+ @close="close"
6
+ :appendToBody="true"
7
+ :modalAppendToBody="true"
8
+ :closeOnClickModal="false"
9
+ :modal="false"
10
+ :title="title"
11
+ custom-class="dialog-style list-dialog dialog-checkbox pd_0"
12
+ >
13
+ <div class="cont" id="containt" :class="{ nfootBtn: readonly }">
14
+ <univer
15
+ ref="univer"
16
+ :data="json"
17
+ v-if="showUniver"
18
+ :readonly="readonly"
19
+ :options="univerConfig"
20
+ ></univer>
21
+ </div>
22
+ <span slot="footer" class="dialog-footer" v-if="!readonly">
23
+ <el-button type="primary" plain class="button-sty" @click="close">
24
+ <i class="el-icon-close el-icon"></i>
25
+ {{ $t2("取 消", "system.button.cancel2") }}
26
+ </el-button>
27
+ <el-button type="primary" @click="dialogSubmit" class="button-sty">
28
+ <i class="el-icon-check el-icon"></i>
29
+ {{ $t2("确 定", "system.button.confirm2") }}
30
+ </el-button>
31
+ </span>
32
+ </el-dialog>
33
+ </template>
34
+
35
+ <script>
36
+ import univer from "./univerSheet.vue";
37
+
38
+ export default {
39
+ name: "univerDialog",
40
+ components: { univer },
41
+ props: {
42
+ visiable: Boolean,
43
+ data: String,
44
+ title: {
45
+ type: String,
46
+ default: "excel",
47
+ },
48
+ readonly: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ univerConfig: {
53
+ type: Object,
54
+ default: () => {},
55
+ },
56
+ },
57
+ mounted() {},
58
+ data() {
59
+ return {
60
+ showDialog: true,
61
+ json: {},
62
+ showUniver: false,
63
+ };
64
+ },
65
+ computed: {},
66
+ created() {
67
+ this.init();
68
+ },
69
+ methods: {
70
+ init() {
71
+ if (this.data) {
72
+ this.json = JSON.parse(this.data);
73
+ }
74
+ this.$nextTick(() => {
75
+ this.showUniver = true;
76
+ });
77
+ },
78
+ close() {
79
+ this.showDialog = false;
80
+ this.$emit("update:visiable", false);
81
+ },
82
+ dialogSubmit() {
83
+ let univerRef = this.$refs.univer;
84
+ this.$refs.univer.getValue().then((value) => {
85
+ let result = JSON.stringify(value);
86
+ this.$emit("confirm", result);
87
+ this.close();
88
+ });
89
+ },
90
+ },
91
+ };
92
+ </script>
93
+
94
+ <style lang="scss" scoped>
95
+ .list-dialog {
96
+ .el-dialog__body {
97
+ height: calc(100% - 42px);
98
+ .cont {
99
+ height: calc(100vh - 210px);
100
+
101
+ &.nfootBtn {
102
+ height: calc(100vh - 158px);
103
+ }
104
+ &#containt {
105
+ padding: 0;
106
+ ::v-deep .grid-container {
107
+ outline: none;
108
+ &.detail-wrap .d-cont {
109
+ height: calc(100vh - 150px);
110
+ .title .field-wrapper {
111
+ display: inline-block !important;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ &.is-fullscreen .el-dialog__body {
120
+ .cont {
121
+ height: calc(100vh - 110px);
122
+
123
+ &.nfootBtn {
124
+ height: calc(100vh - 58px);
125
+ }
126
+ }
127
+ }
128
+ }
129
+ </style>
@@ -0,0 +1,95 @@
1
+ import Vue from 'vue';
2
+ import dialogComponent from './dialog.vue';
3
+
4
+ export { default as univerSheet } from "./univerSheet.vue";
5
+ export { default as asuniverDialog } from "./dialog.vue";
6
+ export { default as asuniverButton } from "./button.vue";
7
+
8
+ /**
9
+ * 打开univerDialog对话框
10
+ * @param {Object} options - 对话框配置选项
11
+ * @param {Boolean} options.visiable - 是否可见
12
+ * @param {String} options.data - Excel数据(JSON字符串)
13
+ * @param {String} options.title - 对话框标题
14
+ * @param {Boolean} options.readonly - 是否只读
15
+ * @param {Object} options.options - univer配置选项
16
+ * @param {Function} options.onConfirm - 确认回调函数
17
+ * @param {Function} options.onClose - 关闭回调函数
18
+ * @returns {Object} 对话框实例,包含close方法
19
+ */
20
+ export function openUniverSheetDialog(options = {}) {
21
+ const {
22
+ visiable = true,
23
+ data = '',
24
+ title = 'excel',
25
+ readonly = false,
26
+ onConfirm,
27
+ onClose,
28
+ univerConfig = {},
29
+ } = options;
30
+
31
+ // 创建组件实例
32
+ const DialogConstructor = Vue.extend(dialogComponent);
33
+ const instance = new DialogConstructor({
34
+ propsData: {
35
+ visiable,
36
+ data,
37
+ title,
38
+ readonly,
39
+ univerConfig: univerConfig,
40
+ }
41
+ });
42
+
43
+ // 挂载组件
44
+ instance.$mount();
45
+ document.body.appendChild(instance.$el);
46
+
47
+ // 定义销毁函数
48
+ const destroyDialog = () => {
49
+ // 延迟销毁,确保动画完成
50
+ setTimeout(() => {
51
+ // 从DOM中移除
52
+ if (instance.$el && instance.$el.parentNode) {
53
+ instance.$el.parentNode.removeChild(instance.$el);
54
+ }
55
+ // 销毁组件实例
56
+ instance.$destroy();
57
+ }, 300);
58
+ };
59
+
60
+ // 监听确认事件
61
+ if (onConfirm) {
62
+ instance.$on('confirm', (result) => {
63
+ onConfirm(result);
64
+ // 确认后也需要销毁
65
+ destroyDialog();
66
+ });
67
+ } else {
68
+ // 如果没有传入onConfirm,也要确保确认后销毁
69
+ instance.$on('confirm', destroyDialog);
70
+ }
71
+
72
+ // 监听关闭事件
73
+ if (onClose) {
74
+ instance.$on('update:visiable', (value) => {
75
+ if (!value) {
76
+ onClose();
77
+ // 关闭后销毁
78
+ destroyDialog();
79
+ }
80
+ });
81
+ } else {
82
+ // 如果没有传入onClose,也要确保关闭后销毁
83
+ instance.$on('update:visiable', (value) => {
84
+ if (!value) destroyDialog();
85
+ });
86
+ }
87
+
88
+ // 返回实例,允许外部控制
89
+ return {
90
+ instance,
91
+ close: () => {
92
+ instance.close();
93
+ }
94
+ };
95
+ }
@@ -15,8 +15,6 @@ import { UniverSheetsHyperLinkPreset } from "@univerjs/preset-sheets-hyper-link"
15
15
  import sheetsHyperLinkZhCN from "@univerjs/preset-sheets-hyper-link/locales/zh-CN";
16
16
  import { UniverSheetsSortPreset } from "@univerjs/preset-sheets-sort";
17
17
  import SheetsSortZhCN from "@univerjs/preset-sheets-sort/locales/zh-CN";
18
- import { UniverSheetsThreadCommentPreset } from "@univerjs/preset-sheets-thread-comment";
19
- import UniverPresetSheetsThreadCommentZhCN from "@univerjs/preset-sheets-thread-comment/locales/zh-CN";
20
18
  import { createUniver, LocaleType, mergeLocales } from "@univerjs/presets";
21
19
  import { UniverSheetsCrosshairHighlightPlugin } from "@univerjs/sheets-crosshair-highlight";
22
20
  import SheetsCrosshairHighlightZhCN from "@univerjs/sheets-crosshair-highlight/locale/zh-CN";
@@ -32,19 +30,27 @@ import "@univerjs/preset-sheets-sort/lib/index.css";
32
30
  import "@univerjs/preset-sheets-filter/lib/index.css";
33
31
  import "@univerjs/preset-sheets-conditional-formatting/lib/index.css";
34
32
  import "@univerjs/preset-sheets-data-validation/lib/index.css";
35
- import "@univerjs/preset-sheets-drawing/lib/index.css";
36
33
  import "@univerjs/preset-sheets-hyper-link/lib/index.css";
37
34
  import "@univerjs/preset-sheets-find-replace/lib/index.css";
38
- import "@univerjs/preset-sheets-thread-comment/lib/index.css";
39
35
  import "@univerjs/sheets-zen-editor/lib/index.css";
40
36
  import "@univerjs/sheets-crosshair-highlight/lib/index.css";
37
+ import "@univerjs/preset-sheets-drawing/lib/index.css";
41
38
 
42
39
  export default {
40
+ name: "univerSheet",
43
41
  props: {
44
42
  data: {
45
43
  type: Object,
46
44
  default: () => {},
47
45
  },
46
+ readonly: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ options: {
51
+ type: Object,
52
+ default: () => {},
53
+ },
48
54
  },
49
55
  data() {
50
56
  return {
@@ -65,38 +71,50 @@ export default {
65
71
  methods: {
66
72
  initStyle() {},
67
73
  init() {
74
+ // 基础国际化文件
75
+ const localeFiles = [
76
+ sheetsCoreZhCN,
77
+ SheetsSortZhCN,
78
+ UniverPresetSheetsFilterZhCN,
79
+ sheetsConditionalFormattingZhCN,
80
+ sheetsDataValidationZhCN,
81
+ UniverPresetSheetsFindReplaceZhCN,
82
+ sheetsHyperLinkZhCN,
83
+ SheetsCrosshairHighlightZhCN,
84
+ SheetsZenEditorZhCN,
85
+ ];
86
+
87
+ // 基础预设
88
+ const presets = [
89
+ UniverSheetsCorePreset({
90
+ container: this.$refs.container,
91
+ menu: {
92
+ "sheet.contextMenu.permission": {
93
+ hidden: true,
94
+ },
95
+ },
96
+ }),
97
+ UniverSheetsFindReplacePreset(),
98
+ UniverSheetsSortPreset(),
99
+ UniverSheetsFilterPreset(),
100
+ UniverSheetsConditionalFormattingPreset(),
101
+ UniverSheetsDataValidationPreset(),
102
+ UniverSheetsFilterPreset(),
103
+ UniverSheetsHyperLinkPreset(),
104
+ ];
105
+
106
+ // 根据options.enableImage参数条件性添加图片相关功能
107
+ if (this.options?.enableImage) {
108
+ localeFiles.push(sheetsDrawingZhCN);
109
+ presets.push(UniverSheetsDrawingPreset());
110
+ }
111
+
68
112
  const { univer, univerAPI } = createUniver({
69
113
  locale: LocaleType.ZH_CN,
70
114
  locales: {
71
- [LocaleType.ZH_CN]: mergeLocales(
72
- sheetsCoreZhCN,
73
- SheetsSortZhCN,
74
- UniverPresetSheetsFilterZhCN,
75
- sheetsConditionalFormattingZhCN,
76
- sheetsDataValidationZhCN,
77
- UniverPresetSheetsFindReplaceZhCN,
78
- sheetsDrawingZhCN,
79
- sheetsHyperLinkZhCN,
80
- UniverPresetSheetsThreadCommentZhCN,
81
- SheetsCrosshairHighlightZhCN,
82
- SheetsZenEditorZhCN
83
- ),
115
+ [LocaleType.ZH_CN]: mergeLocales(...localeFiles),
84
116
  },
85
- presets: [
86
- UniverSheetsCorePreset({
87
- container: this.$refs.container,
88
- // zIndex: 3000,
89
- }),
90
- UniverSheetsFindReplacePreset(),
91
- UniverSheetsSortPreset(),
92
- UniverSheetsFilterPreset(),
93
- UniverSheetsConditionalFormattingPreset(),
94
- UniverSheetsDataValidationPreset(),
95
- UniverSheetsDrawingPreset(),
96
- UniverSheetsFilterPreset(),
97
- UniverSheetsHyperLinkPreset(),
98
- UniverSheetsThreadCommentPreset(),
99
- ],
117
+ presets,
100
118
  plugins: [
101
119
  /* [
102
120
  UniverWatermarkPlugin,
@@ -128,12 +146,25 @@ export default {
128
146
 
129
147
  this.univerInstance = univer;
130
148
  this.univerAPIInstance = univerAPI;
149
+
150
+ // 获取工作表
151
+ const worksheets = this.workbook.getSheets();
152
+
153
+ this.$nextTick(() => {
154
+ const fWorkbook = univerAPI.getActiveWorkbook();
155
+ const permission = fWorkbook.getWorkbookPermission();
156
+ if (this.readonly) {
157
+ // 设置为只读模式
158
+ permission.setMode("viewer");
159
+ permission.setPoint(univerAPI.Enum.WorkbookPermissionPoint.CopyContent, true);
160
+ }
161
+ });
131
162
  },
132
- getValue() {
163
+ async getValue() {
133
164
  const fWorkbook = this.univerAPIInstance.getActiveWorkbook();
165
+ await fWorkbook.endEditingAsync(true);
134
166
  const snapshot = fWorkbook.save();
135
167
  return snapshot;
136
- // return this.workbook.save();
137
168
  },
138
169
  },
139
170
  };
@@ -155,7 +186,12 @@ export default {
155
186
  }
156
187
  </style>
157
188
  <style>
158
- div[data-radix-popper-content-wrapper] {
189
+ div[data-radix-popper-content-wrapper],
190
+ .univer-popup.univer-popup-enter-done,
191
+ .univer-menu-submenu,
192
+ [data-u-comp="rect-popup"],
193
+ .univer-grid,
194
+ div[role="tooltip"] {
159
195
  z-index: 999999 !important;
160
196
  }
161
197
  </style>
@@ -8,7 +8,7 @@
8
8
  @close="close"
9
9
  >
10
10
  <div class="cont designer-view" v-bind="bodyConfig" id="containt">
11
- <univer ref="univer" :data="option.data"></univer>
11
+ <univerSheet ref="univer" :data="json" v-if="showUniver"></univerSheet>
12
12
  </div>
13
13
  <span
14
14
  slot="footer"
@@ -29,11 +29,12 @@
29
29
  </template>
30
30
 
31
31
  <script>
32
- import univer from "@base/components/univer";
32
+ // import univerSheet from "@base/components/univer/univerSheet.vue";
33
+ import { univerSheet } from "@base/components/univer/index.js";
33
34
 
34
35
  export default {
35
36
  // name: "vabSearchDialog",
36
- components: { univer },
37
+ components: { univerSheet },
37
38
  props: {
38
39
  visiable: Boolean,
39
40
  option: Object,
@@ -41,7 +42,9 @@ export default {
41
42
  mixins: [],
42
43
  inject: ["getFormConfig"],
43
44
 
44
- mounted() {},
45
+ mounted() {
46
+ this.init();
47
+ },
45
48
  data() {
46
49
  var that = this;
47
50
  return {
@@ -63,6 +66,8 @@ export default {
63
66
  currentLayoutType: null,
64
67
  dataId: null,
65
68
  formConfig: {},
69
+ showUniver: true,
70
+ json: {},
66
71
  };
67
72
  },
68
73
  computed: {
@@ -115,6 +120,14 @@ export default {
115
120
  this.currentLayoutType = currentFormConfig.layoutType;
116
121
  },
117
122
  methods: {
123
+ init() {
124
+ if (this.option.data) {
125
+ this.json = JSON.parse(this.option.data);
126
+ }
127
+ this.$nextTick(() => {
128
+ this.showRender = true;
129
+ });
130
+ },
118
131
  reload(e, option) {
119
132
  let updateParam = option?.updateParam || {};
120
133
  if (this.formConfig) Object.assign(this.formConfig, updateParam);
@@ -131,9 +144,12 @@ export default {
131
144
  let univerRef = this.$refs.univer;
132
145
  if (this.option.confirm) {
133
146
  let excelJson = this.$refs.univer.getValue();
134
- if (this.option.confirm(excelJson, univerRef, this) !== false) {
135
- this.close();
136
- }
147
+ this.$refs.univer.getValue().then((value) => {
148
+ let result = JSON.stringify(value);
149
+ if (this.option.confirm(result, univerRef, this) !== false) {
150
+ this.close();
151
+ }
152
+ });
137
153
  } else {
138
154
  this.close();
139
155
  }
@@ -98,14 +98,13 @@
98
98
  :option="baseFormulaDialogOption"
99
99
  ></baseFormulaDialog>
100
100
  <template v-if="showQrCanvas">
101
- <canvas
102
- ref="qrCanvas"
103
- v-show="false"
104
- :width="qrWidth"
105
- :height="qrHeight"
106
- ></canvas>
101
+ <canvas ref="qrCanvas" v-show="false" :width="qrWidth" :height="qrHeight"></canvas>
107
102
  </template>
108
- <univerDialog v-if="showUniverDialog" :visiable.sync="showUniverDialog" :option="univerDialogOption"></univerDialog>
103
+ <univerDialog
104
+ v-if="showUniverDialog"
105
+ :visiable.sync="showUniverDialog"
106
+ :option="univerDialogOption"
107
+ ></univerDialog>
109
108
  </div>
110
109
  </template>
111
110
 
@@ -114,6 +113,7 @@
114
113
  import "./container-item/index";
115
114
  import FieldComponents from "../../../components/xform/form-designer/form-widget/field-widget/index";
116
115
  import indexMixin from "../../../components/xform/form-render/indexMixin";
116
+ import univerDialog from "../../../components/xform/form-designer/form-widget/dialog/univerDialog.vue";
117
117
 
118
118
  export default {
119
119
  name: "VFormRender",
@@ -135,8 +135,11 @@ export default {
135
135
  import(
136
136
  "../../../components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue"
137
137
  ),
138
- univerDialog: () =>
139
- import("../../../components/xform/form-designer/form-widget/dialog/univerDialog.vue"),
138
+ univerDialog,
139
+ /* univerDialog: () =>
140
+ import(
141
+ "../../../components/xform/form-designer/form-widget/dialog/univerDialog.vue"
142
+ ), */
140
143
  },
141
144
  mixins: [indexMixin],
142
145
  };
@@ -80,6 +80,16 @@ export const constantRoutes = [
80
80
  },
81
81
  },
82
82
 
83
+ {
84
+ path: "/test_univer2",
85
+ component: () =>
86
+ import("@/views/test/test_univer2.vue"),
87
+ name: "test_univer2",
88
+ meta: {
89
+ title: "测试excel",
90
+ },
91
+ },
92
+
83
93
  // {
84
94
  // path: "/test_table",
85
95
  // component: () =>