@idooel/components 0.0.2-beta.2 → 0.0.2-beta.21
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/README.md +98 -98
- package/dist/@idooel/components.esm.js +1931 -785
- package/dist/@idooel/components.umd.js +1956 -812
- package/jsconfig.json +7 -7
- package/package.json +61 -50
- package/packages/alert/index.js +4 -4
- package/packages/alert/src/index.vue +45 -45
- package/packages/batch-export/index.js +4 -4
- package/packages/batch-export/src/index.vue +104 -104
- package/packages/business-components/modal-fsm/index.js +4 -4
- package/packages/business-components/modal-fsm/src/index.vue +163 -163
- package/packages/business-components/modal-import/index.js +4 -4
- package/packages/business-components/modal-import/src/index.vue +222 -139
- package/packages/business-components/modal-timeline/index.js +4 -4
- package/packages/business-components/modal-timeline/src/index.vue +77 -77
- package/packages/business-components/tabs-sub-center/index.js +4 -4
- package/packages/business-components/tabs-sub-center/src/index.vue +116 -116
- package/packages/button/index.js +4 -4
- package/packages/button/src/index.vue +65 -65
- package/packages/checkbox/index.js +4 -4
- package/packages/checkbox/src/index.vue +52 -52
- package/packages/composite-components/button-group/index.js +4 -4
- package/packages/composite-components/button-group/src/index.vue +151 -151
- package/packages/composite-components/form-attachment/src/index.vue +14 -14
- package/packages/composite-components/form-img-crop/index.js +4 -4
- package/packages/composite-components/form-img-crop/src/index.vue +131 -131
- package/packages/composite-components/modal-confirm/index.js +4 -4
- package/packages/composite-components/modal-confirm/src/index.vue +103 -103
- package/packages/composite-components/modal-form/index.js +4 -4
- package/packages/composite-components/modal-form/src/index.vue +230 -230
- package/packages/composite-components/modal-img-crop/index.js +4 -4
- package/packages/composite-components/modal-img-crop/src/index.vue +298 -298
- package/packages/composite-components/modal-table/index.js +4 -4
- package/packages/composite-components/modal-table/src/index.vue +155 -155
- package/packages/composite-components/modal-tree/index.js +4 -4
- package/packages/composite-components/modal-tree/src/index.vue +75 -75
- package/packages/composite-components/search-area/index.js +4 -4
- package/packages/composite-components/search-area/src/index.vue +238 -237
- package/packages/composite-components/search-area/src/label.vue +35 -35
- package/packages/composite-components/select-entity-modal-table/index.js +4 -4
- package/packages/composite-components/select-entity-modal-table/src/index.vue +171 -171
- package/packages/date/index.js +4 -4
- package/packages/date/src/index.vue +112 -112
- package/packages/date-range/index.js +4 -4
- package/packages/date-range/src/index.vue +47 -47
- package/packages/form/index.js +4 -4
- package/packages/form/src/index.vue +319 -319
- package/packages/icon/index.js +4 -4
- package/packages/icon/src/index.vue +31 -31
- package/packages/index.js +156 -153
- package/packages/input/index.js +4 -4
- package/packages/input/src/index.vue +35 -35
- package/packages/input-number/index.js +4 -4
- package/packages/input-number/src/index.vue +23 -23
- package/packages/loading/index.js +4 -4
- package/packages/loading/src/index.vue +36 -36
- package/packages/meta/provider.js +4 -0
- package/packages/modal/index.js +4 -4
- package/packages/modal/src/index.vue +184 -184
- package/packages/models/form-group-model/index.js +4 -4
- package/packages/models/form-group-model/src/index.vue +273 -273
- package/packages/models/form-model/index.js +4 -4
- package/packages/models/form-model/src/index.vue +236 -232
- package/packages/models/step-model/index.js +4 -4
- package/packages/models/step-model/src/index.vue +224 -224
- package/packages/models/tree-table-model/index.js +4 -4
- package/packages/models/tree-table-model/src/index.vue +830 -689
- package/packages/radio/index.js +4 -4
- package/packages/radio/src/index.vue +56 -56
- package/packages/select/index.js +4 -4
- package/packages/select/src/index.vue +105 -105
- package/packages/select-entity/index.js +4 -4
- package/packages/select-entity/src/index.vue +119 -119
- package/packages/table/index.js +4 -4
- package/packages/table/src/action.vue +176 -172
- package/packages/table/src/index.vue +339 -309
- package/packages/tabs/index.js +4 -4
- package/packages/tabs/src/index.vue +55 -55
- package/packages/text/index.js +4 -4
- package/packages/text/src/index.vue +47 -47
- package/packages/text-editor/index.js +4 -4
- package/packages/text-editor/src/index.vue +72 -72
- package/packages/textarea/index.js +4 -4
- package/packages/textarea/src/index.vue +57 -57
- package/packages/theme/form.scss +21 -21
- package/packages/theme/index.scss +43 -43
- package/packages/theme/overrid.scss +7 -7
- package/packages/theme/styleClass.scss +2 -2
- package/packages/theme/variables.scss +55 -55
- package/packages/timeline/index.js +4 -4
- package/packages/timeline/src/index.vue +257 -257
- package/packages/tpl/index.js +4 -4
- package/packages/tpl/src/index.vue +55 -55
- package/packages/tree/index.js +4 -4
- package/packages/tree/src/TreeNode.vue +29 -29
- package/packages/tree/src/index.vue +101 -101
- package/packages/tree-select/index.js +4 -4
- package/packages/tree-select/src/index.vue +142 -142
- package/packages/upload/index.js +4 -4
- package/packages/upload/src/index.vue +998 -494
- package/packages/utils/index.js +66 -62
- package/packages/utils/runtime-context/dataPoolAPI.js +501 -0
- package/packages/utils/runtime-context/globalDataPool.js +279 -0
- package/packages/utils/runtime-context/index.js +76 -0
- package/packages/utils/runtime-context/modelSchema.js +174 -0
- package/scripts/rollup.config.js +42 -42
- package/scripts/rollup.esm.config.js +11 -11
- package/scripts/rollup.umd.config.js +17 -14
- package/vitest.config.js +17 -0
|
@@ -1,413 +1,765 @@
|
|
|
1
|
+
import { createDataPool } from '@idooel/runtime-context';
|
|
2
|
+
import { parse as parse$1 } from '@idooel/expression';
|
|
1
3
|
import moment from 'moment';
|
|
2
4
|
import { type, net, route, util } from '@idooel/shared';
|
|
3
5
|
import FileUpload from 'vue-upload-component';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 模型字段定义
|
|
9
|
+
* 定义 TreeTable 模型支持的数据字段和类型
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 字段类型定义
|
|
14
|
+
*/
|
|
15
|
+
const FIELD_TYPES = {
|
|
16
|
+
OBJECT: 'object',
|
|
17
|
+
ARRAY: 'array',
|
|
18
|
+
STRING: 'string',
|
|
19
|
+
NUMBER: 'number',
|
|
20
|
+
BOOLEAN: 'boolean'
|
|
11
21
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* TreeTable 模型字段定义
|
|
25
|
+
*/
|
|
26
|
+
const TREE_TABLE_FIELDS = {
|
|
27
|
+
// 当前选中的行数据 - 核心字段
|
|
28
|
+
currentRowData: {
|
|
29
|
+
type: FIELD_TYPES.OBJECT,
|
|
30
|
+
default: {},
|
|
31
|
+
description: '当前表格选中的行数据'
|
|
32
|
+
}
|
|
17
33
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
">": (data, a, b) => a(data) > b(data),
|
|
30
|
-
"<=": (data, a, b) => a(data) <= b(data),
|
|
31
|
-
">=": (data, a, b) => a(data) >= b(data),
|
|
32
|
-
"&&": (data, a, b) => a(data) && b(data),
|
|
33
|
-
"||": (data, a, b) => a(data) || b(data),
|
|
34
|
-
"!": (data, a) => !a(data)
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 共享数据字段定义
|
|
37
|
+
*/
|
|
38
|
+
const SHARED_FIELDS = {
|
|
39
|
+
// Modal Table 父级数据
|
|
40
|
+
parentCurrentRowData: {
|
|
41
|
+
type: FIELD_TYPES.OBJECT,
|
|
42
|
+
default: null,
|
|
43
|
+
description: 'Modal Table 的父级表格当前行数据'
|
|
44
|
+
}
|
|
35
45
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 获取字段默认值
|
|
49
|
+
* @param {object} schema 字段schema
|
|
50
|
+
* @returns {object} 默认值对象
|
|
51
|
+
*/
|
|
52
|
+
const getFieldDefaults = schema => {
|
|
53
|
+
const defaults = {};
|
|
54
|
+
for (const [fieldName, fieldConfig] of Object.entries(schema)) {
|
|
55
|
+
if (fieldConfig.default !== undefined) {
|
|
56
|
+
defaults[fieldName] = fieldConfig.default;
|
|
57
|
+
} else if (fieldConfig.required) {
|
|
58
|
+
// 必填字段但没有默认值的处理
|
|
59
|
+
switch (fieldConfig.type) {
|
|
60
|
+
case FIELD_TYPES.OBJECT:
|
|
61
|
+
defaults[fieldName] = {};
|
|
62
|
+
break;
|
|
63
|
+
case FIELD_TYPES.ARRAY:
|
|
64
|
+
defaults[fieldName] = [];
|
|
65
|
+
break;
|
|
66
|
+
case FIELD_TYPES.STRING:
|
|
67
|
+
defaults[fieldName] = '';
|
|
68
|
+
break;
|
|
69
|
+
case FIELD_TYPES.NUMBER:
|
|
70
|
+
defaults[fieldName] = 0;
|
|
71
|
+
break;
|
|
72
|
+
case FIELD_TYPES.BOOLEAN:
|
|
73
|
+
defaults[fieldName] = false;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return defaults;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 验证字段值是否符合类型要求
|
|
83
|
+
* @param {*} value 要验证的值
|
|
84
|
+
* @param {string} expectedType 期望的类型
|
|
85
|
+
* @returns {boolean} 是否有效
|
|
86
|
+
*/
|
|
87
|
+
const validateFieldType = (value, expectedType) => {
|
|
88
|
+
if (value === null || value === undefined) {
|
|
89
|
+
return true; // 允许空值
|
|
90
|
+
}
|
|
91
|
+
const actualType = Array.isArray(value) ? FIELD_TYPES.ARRAY : typeof value;
|
|
92
|
+
|
|
93
|
+
// 宽松的类型检查
|
|
94
|
+
switch (expectedType) {
|
|
95
|
+
case FIELD_TYPES.OBJECT:
|
|
96
|
+
return actualType === FIELD_TYPES.OBJECT;
|
|
97
|
+
case FIELD_TYPES.ARRAY:
|
|
98
|
+
return actualType === FIELD_TYPES.ARRAY;
|
|
99
|
+
case FIELD_TYPES.STRING:
|
|
100
|
+
return actualType === FIELD_TYPES.STRING;
|
|
101
|
+
case FIELD_TYPES.NUMBER:
|
|
102
|
+
return actualType === FIELD_TYPES.NUMBER;
|
|
103
|
+
case FIELD_TYPES.BOOLEAN:
|
|
104
|
+
return actualType === FIELD_TYPES.BOOLEAN;
|
|
105
|
+
default:
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 获取模型支持的字段列表
|
|
112
|
+
* @returns {string[]} 字段名列表
|
|
113
|
+
*/
|
|
114
|
+
const getSupportedFields = () => {
|
|
115
|
+
return Object.keys({
|
|
116
|
+
...TREE_TABLE_FIELDS,
|
|
117
|
+
...SHARED_FIELDS
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 全局数据池管理器
|
|
123
|
+
* 挂载到 window.__idooel_data_pool__,提供统一的数据和实例方法管理
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
class BaseModelMethods {
|
|
127
|
+
constructor(instanceId, dataPool) {
|
|
128
|
+
this.instanceId = instanceId;
|
|
129
|
+
this.dataPool = dataPool;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 基础数据操作 - 保留,实际在使用
|
|
133
|
+
setData(key, value) {
|
|
134
|
+
// 验证字段类型(可选)
|
|
135
|
+
const supportedFields = getSupportedFields();
|
|
136
|
+
if (supportedFields.includes(key)) {
|
|
137
|
+
const fieldDef = TREE_TABLE_FIELDS[key];
|
|
138
|
+
if (fieldDef && !validateFieldType(value, fieldDef.type)) {
|
|
139
|
+
console.warn(`Field type mismatch for ${key}: expected ${fieldDef.type}, got ${typeof value}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
this.dataPool.manager.setData(this.instanceId, key, value);
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
145
|
+
getData(key, defaultValue = null) {
|
|
146
|
+
return this.dataPool.manager.getData(this.instanceId, key, defaultValue);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 事件订阅 - 保留,实际在使用
|
|
150
|
+
subscribe(key, callback) {
|
|
151
|
+
return this.dataPool.manager.subscribe({
|
|
152
|
+
instanceId: this.instanceId,
|
|
153
|
+
key
|
|
154
|
+
}, callback);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 数据清理 - 保留,实际在使用
|
|
158
|
+
cleanup() {
|
|
159
|
+
this.dataPool.manager.clearModelData(this.instanceId);
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// 获取数据池引用 - 保留,实际在使用
|
|
164
|
+
getDataPool() {
|
|
165
|
+
return this.dataPool;
|
|
166
|
+
}
|
|
41
167
|
}
|
|
42
|
-
|
|
43
|
-
|
|
168
|
+
class TreeTableModelMethods extends BaseModelMethods {
|
|
169
|
+
constructor(instanceId, dataPool) {
|
|
170
|
+
super(instanceId, dataPool);
|
|
171
|
+
// 初始化 TreeTable 特有的数据结构 - 只保留必要的字段
|
|
172
|
+
this._initTreeTableData();
|
|
173
|
+
}
|
|
174
|
+
_initTreeTableData() {
|
|
175
|
+
// 设置初始元数据
|
|
176
|
+
this.setData('__meta__', {
|
|
177
|
+
type: 'tree-table',
|
|
178
|
+
instanceId: this.instanceId,
|
|
179
|
+
createdAt: Date.now()
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// 使用 schema 初始化数据字段
|
|
183
|
+
const defaults = getFieldDefaults(TREE_TABLE_FIELDS);
|
|
184
|
+
for (const [fieldName, defaultValue] of Object.entries(defaults)) {
|
|
185
|
+
this.setData(fieldName, defaultValue);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// TreeTable 核心方法 - 只保留实际使用的
|
|
190
|
+
setCurrentRowData(data) {
|
|
191
|
+
this.setData('currentRowData', data);
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
getCurrentRowData() {
|
|
195
|
+
return this.getData('currentRowData', {});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// 共享数据操作(与 modal table 交互)- 保留,实际在使用
|
|
199
|
+
setSharedData(data) {
|
|
200
|
+
if (data && Object.keys(data).length > 0) {
|
|
201
|
+
this.dataPool.manager.setSharedData('modalTable', 'parentCurrentRowData', data);
|
|
202
|
+
}
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
getSharedData() {
|
|
206
|
+
return this.dataPool.manager.getSharedData('modalTable', 'parentCurrentRowData');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 订阅共享数据变化 - 保留,实际在使用
|
|
210
|
+
subscribeShared(callback) {
|
|
211
|
+
return this.dataPool.manager.subscribe({
|
|
212
|
+
namespace: 'modalTable',
|
|
213
|
+
key: 'parentCurrentRowData'
|
|
214
|
+
}, callback);
|
|
215
|
+
}
|
|
44
216
|
}
|
|
45
|
-
class
|
|
46
|
-
constructor(
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
let char = content.charAt(index);
|
|
57
|
-
if (char === '"' || char === "'") {
|
|
58
|
-
let start = ++index;
|
|
59
|
-
let escape = false;
|
|
60
|
-
let value = "";
|
|
61
|
-
let token;
|
|
62
|
-
while (index < length) {
|
|
63
|
-
let c = content.charAt(index);
|
|
64
|
-
if (escape) {
|
|
65
|
-
if (c === "u") {
|
|
66
|
-
let hex = content.substring(index + 1, index + 5);
|
|
67
|
-
if (!hex.match(/[\da-f]{4}/i)) {
|
|
68
|
-
throw new Error(`invalid expression: ${content}, invalid unicode escape [\\u${hex}]`);
|
|
69
|
-
}
|
|
70
|
-
index += 4;
|
|
71
|
-
value += String.fromCharCode(parseInt(hex, 16));
|
|
72
|
-
} else {
|
|
73
|
-
let rep = ESCAPE[c];
|
|
74
|
-
value = value + (rep || c);
|
|
75
|
-
}
|
|
76
|
-
escape = false;
|
|
77
|
-
} else if (c === "\\") {
|
|
78
|
-
escape = true;
|
|
79
|
-
} else if (c === char) {
|
|
80
|
-
index++;
|
|
81
|
-
token = {
|
|
82
|
-
index: start,
|
|
83
|
-
constant: true,
|
|
84
|
-
text: char + value + char,
|
|
85
|
-
value
|
|
86
|
-
};
|
|
87
|
-
break;
|
|
88
|
-
} else {
|
|
89
|
-
value += c;
|
|
90
|
-
}
|
|
91
|
-
index++;
|
|
92
|
-
}
|
|
93
|
-
if (!token) {
|
|
94
|
-
throw new Error(`invalid expression: ${content}`);
|
|
95
|
-
} else {
|
|
96
|
-
tokens.push(token);
|
|
97
|
-
}
|
|
98
|
-
} else if (isNumber$1(char) || char === "." && isNumber$1(content.charAt(index + 1))) {
|
|
99
|
-
let start = index;
|
|
100
|
-
let value = "";
|
|
101
|
-
while (index < length) {
|
|
102
|
-
let c = content.charAt(index).toLowerCase();
|
|
103
|
-
if (c === "." || isNumber$1(c)) {
|
|
104
|
-
value += c;
|
|
105
|
-
} else {
|
|
106
|
-
let c2 = content.charAt(index + 1);
|
|
107
|
-
if (c === "e" && isExpOperator(c2)) {
|
|
108
|
-
value += c;
|
|
109
|
-
} else if (isExpOperator(c) && c2 && isNumber$1(c2) && value.charAt(value.length - 1) === "e") {
|
|
110
|
-
value += c;
|
|
111
|
-
} else if (isExpOperator(c) && (!c2 || !isNumber$1(c2)) && value.charAt(value.length - 1) == "e") {
|
|
112
|
-
throw new Error(`invalid expression: ${content}`);
|
|
113
|
-
} else {
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
index++;
|
|
118
|
-
}
|
|
119
|
-
tokens.push({
|
|
120
|
-
index: start,
|
|
121
|
-
constant: true,
|
|
122
|
-
text: value,
|
|
123
|
-
value: Number(value)
|
|
124
|
-
});
|
|
125
|
-
} else if (isIdent(char)) {
|
|
126
|
-
let start = index;
|
|
127
|
-
while (index < length) {
|
|
128
|
-
let c = content.charAt(index);
|
|
129
|
-
if (!(isIdent(c) || isNumber$1(c))) {
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
index++;
|
|
133
|
-
}
|
|
134
|
-
tokens.push({
|
|
135
|
-
index: start,
|
|
136
|
-
text: content.slice(start, index),
|
|
137
|
-
identifier: true
|
|
138
|
-
});
|
|
139
|
-
} else if ("(){}[].,:?".indexOf(char) >= 0) {
|
|
140
|
-
tokens.push({
|
|
141
|
-
index,
|
|
142
|
-
text: char
|
|
143
|
-
});
|
|
144
|
-
index++;
|
|
145
|
-
} else if (char === " " || char === "\r" || char === " " || char === "\n" || char === "\v" || char === "\xA0") {
|
|
146
|
-
index++;
|
|
147
|
-
} else {
|
|
148
|
-
let char2 = char + content.charAt(index + 1);
|
|
149
|
-
let char3 = char2 + content.charAt(index + 2);
|
|
150
|
-
let op1 = OPERATORS[char];
|
|
151
|
-
let op2 = OPERATORS[char2];
|
|
152
|
-
let op3 = OPERATORS[char3];
|
|
153
|
-
if (op1 || op2 || op3) {
|
|
154
|
-
let text = op3 ? char3 : op2 ? char2 : char;
|
|
155
|
-
tokens.push({
|
|
156
|
-
index,
|
|
157
|
-
text,
|
|
158
|
-
operator: true
|
|
159
|
-
});
|
|
160
|
-
index += text.length;
|
|
161
|
-
} else {
|
|
162
|
-
throw new Error(`invalid expression: ${content}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
217
|
+
class GlobalDataManager {
|
|
218
|
+
constructor() {
|
|
219
|
+
this.models = new Map();
|
|
220
|
+
this.runtimeContext = createDataPool();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 注册模型实例 - 保留,实际在使用
|
|
224
|
+
registerModel(modelType, instanceId, methods) {
|
|
225
|
+
if (this.models.has(instanceId)) {
|
|
226
|
+
console.warn(`Model instance ${instanceId} already exists`);
|
|
227
|
+
return this;
|
|
165
228
|
}
|
|
166
|
-
this.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
let left = this.logicalOR();
|
|
197
|
-
if (this.expect("?")) {
|
|
198
|
-
let middle = this.expression();
|
|
199
|
-
this.consume(":");
|
|
200
|
-
let right = this.expression();
|
|
201
|
-
return data => left(data) ? middle(data) : right(data);
|
|
202
|
-
}
|
|
203
|
-
return left;
|
|
204
|
-
}
|
|
205
|
-
binary(left, op, right) {
|
|
206
|
-
let fn = OPERATORS[op];
|
|
207
|
-
return data => fn(data, left, right);
|
|
208
|
-
}
|
|
209
|
-
unary() {
|
|
210
|
-
let token;
|
|
211
|
-
if (this.expect("+")) {
|
|
212
|
-
return this.primary();
|
|
213
|
-
} else if (token = this.expect("-")) {
|
|
214
|
-
return this.binary(data => 0, token.text, this.unary());
|
|
215
|
-
} else if (token = this.expect("!")) {
|
|
216
|
-
let fn = OPERATORS[token.text];
|
|
217
|
-
let right = this.unary();
|
|
218
|
-
return data => fn(data, right);
|
|
219
|
-
} else {
|
|
220
|
-
return this.primary();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
logicalOR() {
|
|
224
|
-
let left = this.logicalAND();
|
|
225
|
-
let token;
|
|
226
|
-
while (token = this.expect("||")) {
|
|
227
|
-
left = this.binary(left, token.text, this.logicalAND());
|
|
228
|
-
}
|
|
229
|
-
return left;
|
|
230
|
-
}
|
|
231
|
-
logicalAND() {
|
|
232
|
-
let left = this.equality();
|
|
233
|
-
let token;
|
|
234
|
-
while (token = this.expect("&&")) {
|
|
235
|
-
left = this.binary(left, token.text, this.equality());
|
|
236
|
-
}
|
|
237
|
-
return left;
|
|
238
|
-
}
|
|
239
|
-
equality() {
|
|
240
|
-
let left = this.relational();
|
|
241
|
-
let token;
|
|
242
|
-
while (token = this.expect("==") || this.expect("!=") || this.expect("===") || this.expect("!==")) {
|
|
243
|
-
left = this.binary(left, token.text, this.relational());
|
|
244
|
-
}
|
|
245
|
-
return left;
|
|
246
|
-
}
|
|
247
|
-
relational() {
|
|
248
|
-
let left = this.additive();
|
|
249
|
-
let token;
|
|
250
|
-
while (token = this.expect("<") || this.expect(">") || this.expect("<=") || this.expect(">=")) {
|
|
251
|
-
left = this.binary(left, token.text, this.additive());
|
|
252
|
-
}
|
|
253
|
-
return left;
|
|
254
|
-
}
|
|
255
|
-
additive() {
|
|
256
|
-
let left = this.multiplicative();
|
|
257
|
-
let token;
|
|
258
|
-
while (token = this.expect("+") || this.expect("-")) {
|
|
259
|
-
left = this.binary(left, token.text, this.multiplicative());
|
|
260
|
-
}
|
|
261
|
-
return left;
|
|
262
|
-
}
|
|
263
|
-
multiplicative() {
|
|
264
|
-
let left = this.unary();
|
|
265
|
-
let token;
|
|
266
|
-
while (token = this.expect("*") || this.expect("/") || this.expect("%")) {
|
|
267
|
-
left = this.binary(left, token.text, this.unary());
|
|
268
|
-
}
|
|
269
|
-
return left;
|
|
270
|
-
}
|
|
271
|
-
primary() {
|
|
272
|
-
let token = this.tokens[0];
|
|
273
|
-
let primary;
|
|
274
|
-
if (this.expect("(")) {
|
|
275
|
-
primary = this.expression();
|
|
276
|
-
this.consume(")");
|
|
277
|
-
} else if (this.expect("[")) {
|
|
278
|
-
primary = this.array();
|
|
279
|
-
} else if (this.expect("{")) {
|
|
280
|
-
primary = this.object();
|
|
281
|
-
} else if (token.identifier && token.text in CONSTANTS) {
|
|
282
|
-
primary = CONSTANTS[this.consume().text];
|
|
283
|
-
} else if (token.identifier) {
|
|
284
|
-
primary = this.identifier();
|
|
285
|
-
} else if (token.constant) {
|
|
286
|
-
primary = this.constant();
|
|
287
|
-
} else {
|
|
288
|
-
throw new Error(`parse expression error: ${this.content}`);
|
|
289
|
-
}
|
|
290
|
-
let next;
|
|
291
|
-
let context;
|
|
292
|
-
while (next = this.expect("(") || this.expect("[") || this.expect(".")) {
|
|
293
|
-
if (next.text === "(") {
|
|
294
|
-
primary = this.functionCall(primary, context);
|
|
295
|
-
context = null;
|
|
296
|
-
} else if (next.text === "[") {
|
|
297
|
-
context = primary;
|
|
298
|
-
primary = this.objectIndex(primary);
|
|
299
|
-
} else {
|
|
300
|
-
context = primary;
|
|
301
|
-
primary = this.fieldAccess(primary);
|
|
229
|
+
this.models.set(instanceId, {
|
|
230
|
+
type: modelType,
|
|
231
|
+
instanceId,
|
|
232
|
+
methods,
|
|
233
|
+
createdAt: Date.now()
|
|
234
|
+
});
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 注销模型实例 - 保留,实际在使用
|
|
239
|
+
unregisterModel(instanceId) {
|
|
240
|
+
if (this.models.has(instanceId)) {
|
|
241
|
+
this.clearModelData(instanceId);
|
|
242
|
+
this.models.delete(instanceId);
|
|
243
|
+
}
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// 获取模型实例 - 保留,实际在使用
|
|
248
|
+
getModel(instanceId) {
|
|
249
|
+
const model = this.models.get(instanceId);
|
|
250
|
+
return model ? model.methods : null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// 获取指定类型的所有模型 - 保留,dataPoolAPI 中使用
|
|
254
|
+
getAllModels(modelType = null) {
|
|
255
|
+
const result = {};
|
|
256
|
+
for (const [instanceId, model] of this.models) {
|
|
257
|
+
if (!modelType || model.type === modelType) {
|
|
258
|
+
result[instanceId] = model.methods;
|
|
302
259
|
}
|
|
303
260
|
}
|
|
304
|
-
return
|
|
261
|
+
return result;
|
|
305
262
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
263
|
+
|
|
264
|
+
// 设置模型数据 - 保留,实际在使用
|
|
265
|
+
setData(instanceId, key, value) {
|
|
266
|
+
const model = this.models.get(instanceId);
|
|
267
|
+
if (!model) {
|
|
268
|
+
console.error(`Model instance ${instanceId} not found`);
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
271
|
+
this.runtimeContext.set(instanceId, key, value);
|
|
272
|
+
return this;
|
|
312
273
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
274
|
+
|
|
275
|
+
// 获取模型数据 - 保留,实际在使用
|
|
276
|
+
getData(instanceId, key, defaultValue = null) {
|
|
277
|
+
const model = this.models.get(instanceId);
|
|
278
|
+
if (!model) {
|
|
279
|
+
return defaultValue;
|
|
280
|
+
}
|
|
281
|
+
return this.runtimeContext.get(instanceId, key, defaultValue);
|
|
321
282
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
this.consume(")");
|
|
330
|
-
return data => {
|
|
331
|
-
let callContext = context && context(data);
|
|
332
|
-
let fn = func(data, callContext);
|
|
333
|
-
return fn && fn.apply(callContext, args.length ? args.map(arg => arg(data)) : null);
|
|
334
|
-
};
|
|
283
|
+
|
|
284
|
+
// 设置共享数据 - 保留,实际在使用(modal table 交互)
|
|
285
|
+
setSharedData(namespace, key, value) {
|
|
286
|
+
const prefixedNamespace = `shared.${namespace}`;
|
|
287
|
+
this.runtimeContext.set(prefixedNamespace, key, value);
|
|
288
|
+
return this;
|
|
335
289
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
this.
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
do {
|
|
354
|
-
token = this.tokens[0];
|
|
355
|
-
if (token.text === "}") break;
|
|
356
|
-
token = this.consume();
|
|
357
|
-
if (token.constant) {
|
|
358
|
-
keys.push(token.value);
|
|
359
|
-
} else if (token.identifier) {
|
|
360
|
-
keys.push(token.text);
|
|
361
|
-
} else {
|
|
362
|
-
throw new Error(`parse expression error: ${this.content}`);
|
|
363
|
-
}
|
|
364
|
-
this.consume(":");
|
|
365
|
-
values.push(this.expression());
|
|
366
|
-
} while (this.expect(","));
|
|
290
|
+
|
|
291
|
+
// 获取共享数据 - 保留,实际在使用
|
|
292
|
+
getSharedData(namespace, key, defaultValue = null) {
|
|
293
|
+
const prefixedNamespace = `shared.${namespace}`;
|
|
294
|
+
return this.runtimeContext.get(prefixedNamespace, key, defaultValue);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// 订阅系统 - 保留,实际在使用
|
|
298
|
+
subscribe(filter, callback) {
|
|
299
|
+
return this.runtimeContext.subscribe(filter, callback);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// 清理模型数据 - 保留,实际在使用
|
|
303
|
+
clearModelData(instanceId) {
|
|
304
|
+
const model = this.models.get(instanceId);
|
|
305
|
+
if (model) {
|
|
306
|
+
this.runtimeContext.clear(instanceId);
|
|
367
307
|
}
|
|
368
|
-
this
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// 模型工厂 - 简化版,只支持 tree-table
|
|
313
|
+
class ModelFactory {
|
|
314
|
+
static createModel(modelType, instanceId, options = {}) {
|
|
315
|
+
if (modelType !== 'tree-table') {
|
|
316
|
+
throw new Error(`Unsupported model type: ${modelType}. Only 'tree-table' is supported.`);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// 注册到全局数据池
|
|
320
|
+
window.__idooel_data_pool__.manager.registerModel(modelType, instanceId, null // 占位符
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
// 创建 TreeTable 模型实例
|
|
324
|
+
const methods = new TreeTableModelMethods(instanceId, window.__idooel_data_pool__);
|
|
325
|
+
|
|
326
|
+
// 更新注册的方法引用
|
|
327
|
+
const model = window.__idooel_data_pool__.manager.models.get(instanceId);
|
|
328
|
+
if (model) {
|
|
329
|
+
model.methods = methods;
|
|
330
|
+
}
|
|
331
|
+
return methods;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// 初始化全局数据池 - 简化版
|
|
336
|
+
function initGlobalDataPool() {
|
|
337
|
+
if (window.__idooel_data_pool__) {
|
|
338
|
+
return window.__idooel_data_pool__;
|
|
339
|
+
}
|
|
340
|
+
const dataPool = {
|
|
341
|
+
// 全局管理接口
|
|
342
|
+
manager: new GlobalDataManager(),
|
|
343
|
+
// 模型工厂
|
|
344
|
+
factory: ModelFactory,
|
|
345
|
+
// 工具方法 - 只保留实际使用的
|
|
346
|
+
utils: {
|
|
347
|
+
// 生成唯一 ID - dataPoolAPI 中使用
|
|
348
|
+
generateId: (prefix = 'model') => `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
|
|
349
|
+
// 获取时间戳 - dataPoolAPI 中使用
|
|
350
|
+
now: () => Date.now(),
|
|
351
|
+
// 深拷贝 - dataPoolAPI 中使用
|
|
352
|
+
deepClone: obj => JSON.parse(JSON.stringify(obj)),
|
|
353
|
+
// 类型检查 - dataPoolAPI 中使用
|
|
354
|
+
isObject: val => val !== null && typeof val === 'object',
|
|
355
|
+
isEmpty: val => {
|
|
356
|
+
if (val == null) return true;
|
|
357
|
+
if (Array.isArray(val) || typeof val === 'string') return val.length === 0;
|
|
358
|
+
if (typeof val === 'object') return Object.keys(val).length === 0;
|
|
359
|
+
return false;
|
|
373
360
|
}
|
|
374
|
-
|
|
375
|
-
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// 挂载到 window
|
|
365
|
+
window.__idooel_data_pool__ = dataPool;
|
|
366
|
+
return dataPool;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// 初始化
|
|
370
|
+
initGlobalDataPool();
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* 统一的数据池 API 接口
|
|
374
|
+
* 提供简洁易用的数据操作接口,封装全局数据池的复杂性
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* 数据池 API 类
|
|
379
|
+
*/
|
|
380
|
+
class DataPoolAPI {
|
|
381
|
+
constructor() {
|
|
382
|
+
this.dataPool = window.__idooel_data_pool__;
|
|
383
|
+
if (!this.dataPool) {
|
|
384
|
+
throw new Error('Global data pool not initialized. Please ensure runtime-context/index.js is imported before using this API.');
|
|
385
|
+
}
|
|
376
386
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
387
|
+
|
|
388
|
+
// ==================== 模型实例管理 ====================
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* 创建树形表格模型实例
|
|
392
|
+
* @param {string} instanceId 实例ID(可选,不提供则自动生成)
|
|
393
|
+
* @param {object} options 初始化选项
|
|
394
|
+
* @returns {object} 模型方法实例
|
|
395
|
+
*/
|
|
396
|
+
createTreeTableModel(instanceId, options = {}) {
|
|
397
|
+
const id = instanceId || this.dataPool.utils.generateId('treeTableModel');
|
|
398
|
+
return this.dataPool.factory.createModel('tree-table', id, options);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* 获取模型实例
|
|
403
|
+
* @param {string} instanceId 实例ID
|
|
404
|
+
* @returns {object|null} 模型方法实例
|
|
405
|
+
*/
|
|
406
|
+
getModel(instanceId) {
|
|
407
|
+
return this.dataPool.manager.getModel(instanceId);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* 获取所有指定类型的模型
|
|
412
|
+
* @param {string} modelType 模型类型
|
|
413
|
+
* @returns {object} 模型实例集合
|
|
414
|
+
*/
|
|
415
|
+
getAllModels(modelType = null) {
|
|
416
|
+
return this.dataPool.manager.getAllModels(modelType);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 销毁模型实例
|
|
421
|
+
* @param {string} instanceId 实例ID
|
|
422
|
+
*/
|
|
423
|
+
destroyModel(instanceId) {
|
|
424
|
+
this.dataPool.manager.unregisterModel(instanceId);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// ==================== 数据操作 ====================
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* 设置模型数据
|
|
431
|
+
* @param {string} instanceId 实例ID
|
|
432
|
+
* @param {string} key 数据键
|
|
433
|
+
* @param {any} value 数据值
|
|
434
|
+
*/
|
|
435
|
+
setModelData(instanceId, key, value) {
|
|
436
|
+
this.dataPool.manager.setData(instanceId, key, value);
|
|
437
|
+
return this;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* 获取模型数据
|
|
442
|
+
* @param {string} instanceId 实例ID
|
|
443
|
+
* @param {string} key 数据键
|
|
444
|
+
* @param {any} defaultValue 默认值
|
|
445
|
+
* @returns {any} 数据值
|
|
446
|
+
*/
|
|
447
|
+
getModelData(instanceId, key, defaultValue = null) {
|
|
448
|
+
return this.dataPool.manager.getData(instanceId, key, defaultValue);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* 批量设置模型数据
|
|
453
|
+
* @param {string} instanceId 实例ID
|
|
454
|
+
* @param {object} data 数据对象
|
|
455
|
+
*/
|
|
456
|
+
setBatchModelData(instanceId, data) {
|
|
457
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
458
|
+
this.setModelData(instanceId, key, value);
|
|
459
|
+
});
|
|
460
|
+
return this;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* 获取模型的所有数据
|
|
465
|
+
* @param {string} instanceId 实例ID
|
|
466
|
+
* @returns {object} 模型数据
|
|
467
|
+
*/
|
|
468
|
+
getAllModelData(instanceId) {
|
|
469
|
+
const model = this.dataPool.manager.getModel(instanceId);
|
|
470
|
+
if (!model) {
|
|
471
|
+
return {};
|
|
472
|
+
}
|
|
473
|
+
const exported = model.export() || {};
|
|
474
|
+
return exported.data || {};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// ==================== 共享数据操作 ====================
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* 设置用户信息
|
|
481
|
+
* @param {object} userInfo 用户信息
|
|
482
|
+
*/
|
|
483
|
+
setUserInfo(userInfo) {
|
|
484
|
+
this.dataPool.manager.setSharedData(SHARED_NAMESPACES.USER, SHARED_KEYS.USER_INFO, userInfo, ACCESS_LEVELS.PROTECTED);
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* 获取用户信息
|
|
490
|
+
* @returns {object} 用户信息
|
|
491
|
+
*/
|
|
492
|
+
getUserInfo() {
|
|
493
|
+
return this.dataPool.manager.getSharedData(SHARED_NAMESPACES.USER, SHARED_KEYS.USER_INFO, {}, ACCESS_LEVELS.PROTECTED);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* 设置用户权限
|
|
498
|
+
* @param {array} permissions 权限列表
|
|
499
|
+
*/
|
|
500
|
+
setUserPermissions(permissions) {
|
|
501
|
+
this.dataPool.manager.setSharedData(SHARED_NAMESPACES.USER, SHARED_KEYS.USER_PERMISSIONS, permissions, ACCESS_LEVELS.PROTECTED);
|
|
502
|
+
return this;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* 获取用户权限
|
|
507
|
+
* @returns {array} 权限列表
|
|
508
|
+
*/
|
|
509
|
+
getUserPermissions() {
|
|
510
|
+
return this.dataPool.manager.getSharedData(SHARED_NAMESPACES.USER, SHARED_KEYS.USER_PERMISSIONS, [], ACCESS_LEVELS.PROTECTED);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* 设置系统配置
|
|
515
|
+
* @param {object} config 系统配置
|
|
516
|
+
*/
|
|
517
|
+
setSystemConfig(config) {
|
|
518
|
+
this.dataPool.manager.setSharedData(SHARED_NAMESPACES.SYSTEM, SHARED_KEYS.SYSTEM_CONFIG, config, ACCESS_LEVELS.PROTECTED);
|
|
519
|
+
return this;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* 获取系统配置
|
|
524
|
+
* @returns {object} 系统配置
|
|
525
|
+
*/
|
|
526
|
+
getSystemConfig() {
|
|
527
|
+
return this.dataPool.manager.getSharedData(SHARED_NAMESPACES.SYSTEM, SHARED_KEYS.SYSTEM_CONFIG, {}, ACCESS_LEVELS.PROTECTED);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* 设置系统主题
|
|
532
|
+
* @param {object} theme 主题配置
|
|
533
|
+
*/
|
|
534
|
+
setSystemTheme(theme) {
|
|
535
|
+
this.dataPool.manager.setSharedData(SHARED_NAMESPACES.SYSTEM, SHARED_KEYS.SYSTEM_THEME, theme, ACCESS_LEVELS.PUBLIC);
|
|
536
|
+
return this;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* 获取系统主题
|
|
541
|
+
* @returns {object} 主题配置
|
|
542
|
+
*/
|
|
543
|
+
getSystemTheme() {
|
|
544
|
+
return this.dataPool.manager.getSharedData(SHARED_NAMESPACES.SYSTEM, SHARED_KEYS.SYSTEM_THEME, {}, ACCESS_LEVELS.PUBLIC);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* 设置模态框父级数据
|
|
549
|
+
* @param {object} parentData 父级数据
|
|
550
|
+
*/
|
|
551
|
+
setModalParentData(parentData) {
|
|
552
|
+
this.dataPool.manager.setSharedData(SHARED_NAMESPACES.MODAL, SHARED_KEYS.MODAL_PARENT_DATA, parentData, ACCESS_LEVELS.PRIVATE);
|
|
553
|
+
return this;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* 获取模态框父级数据
|
|
558
|
+
* @returns {object} 父级数据
|
|
559
|
+
*/
|
|
560
|
+
getModalParentData() {
|
|
561
|
+
return this.dataPool.manager.getSharedData(SHARED_NAMESPACES.MODAL, SHARED_KEYS.MODAL_PARENT_DATA, null, ACCESS_LEVELS.PRIVATE);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* 设置业务字典
|
|
566
|
+
* @param {object} dictionaries 业务字典
|
|
567
|
+
*/
|
|
568
|
+
setBusinessDictionaries(dictionaries) {
|
|
569
|
+
this.dataPool.manager.setSharedData(SHARED_NAMESPACES.BUSINESS, SHARED_KEYS.BUSINESS_DICTIONARIES, dictionaries, ACCESS_LEVELS.PUBLIC);
|
|
570
|
+
return this;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* 获取业务字典
|
|
575
|
+
* @returns {object} 业务字典
|
|
576
|
+
*/
|
|
577
|
+
getBusinessDictionaries() {
|
|
578
|
+
return this.dataPool.manager.getSharedData(SHARED_NAMESPACES.BUSINESS, SHARED_KEYS.BUSINESS_DICTIONARIES, {}, ACCESS_LEVELS.PUBLIC);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// ==================== 订阅系统 ====================
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* 订阅模型数据变化
|
|
585
|
+
* @param {string} instanceId 实例ID
|
|
586
|
+
* @param {string} key 数据键
|
|
587
|
+
* @param {function} callback 回调函数
|
|
588
|
+
* @returns {function} 取消订阅函数
|
|
589
|
+
*/
|
|
590
|
+
subscribeModelData(instanceId, key, callback) {
|
|
591
|
+
return this.dataPool.manager.subscribe({
|
|
592
|
+
instanceId,
|
|
593
|
+
key
|
|
594
|
+
}, callback);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* 订阅用户信息变化
|
|
599
|
+
* @param {function} callback 回调函数
|
|
600
|
+
* @returns {function} 取消订阅函数
|
|
601
|
+
*/
|
|
602
|
+
subscribeUserInfo(callback) {
|
|
603
|
+
return this.dataPool.manager.subscribe({
|
|
604
|
+
namespace: SHARED_NAMESPACES.USER,
|
|
605
|
+
key: SHARED_KEYS.USER_INFO
|
|
606
|
+
}, callback);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* 订阅系统配置变化
|
|
611
|
+
* @param {function} callback 回调函数
|
|
612
|
+
* @returns {function} 取消订阅函数
|
|
613
|
+
*/
|
|
614
|
+
subscribeSystemConfig(callback) {
|
|
615
|
+
return this.dataPool.manager.subscribe({
|
|
616
|
+
namespace: SHARED_NAMESPACES.SYSTEM,
|
|
617
|
+
key: SHARED_KEYS.SYSTEM_CONFIG
|
|
618
|
+
}, callback);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* 订阅系统主题变化
|
|
623
|
+
* @param {function} callback 回调函数
|
|
624
|
+
* @returns {function} 取消订阅函数
|
|
625
|
+
*/
|
|
626
|
+
subscribeSystemTheme(callback) {
|
|
627
|
+
return this.dataPool.manager.subscribe({
|
|
628
|
+
namespace: SHARED_NAMESPACES.SYSTEM,
|
|
629
|
+
key: SHARED_KEYS.SYSTEM_THEME
|
|
630
|
+
}, callback);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* 订阅模态框父级数据变化
|
|
635
|
+
* @param {function} callback 回调函数
|
|
636
|
+
* @returns {function} 取消订阅函数
|
|
637
|
+
*/
|
|
638
|
+
subscribeModalParentData(callback) {
|
|
639
|
+
return this.dataPool.manager.subscribe({
|
|
640
|
+
namespace: SHARED_NAMESPACES.MODAL,
|
|
641
|
+
key: SHARED_KEYS.MODAL_PARENT_DATA
|
|
642
|
+
}, callback);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// ==================== 工具方法 ====================
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* 导出模型数据
|
|
649
|
+
* @param {string} instanceId 实例ID
|
|
650
|
+
* @returns {object} 导出的数据
|
|
651
|
+
*/
|
|
652
|
+
exportModelData(instanceId) {
|
|
653
|
+
const model = this.dataPool.manager.getModel(instanceId);
|
|
654
|
+
return model ? model.export() : null;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* 导入模型数据
|
|
659
|
+
* @param {string} instanceId 实例ID
|
|
660
|
+
* @param {object} data 要导入的数据
|
|
661
|
+
*/
|
|
662
|
+
importModelData(instanceId, data) {
|
|
663
|
+
this.dataPool.manager.importData(instanceId, data);
|
|
664
|
+
return this;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* 清理模型数据
|
|
669
|
+
* @param {string} instanceId 实例ID
|
|
670
|
+
*/
|
|
671
|
+
clearModelData(instanceId) {
|
|
672
|
+
this.dataPool.manager.clearModelData(instanceId);
|
|
673
|
+
return this;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* 获取调试信息
|
|
678
|
+
* @returns {object} 调试信息
|
|
679
|
+
*/
|
|
680
|
+
getDebugInfo() {
|
|
681
|
+
return this.dataPool.manager.debug();
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* 生成唯一ID
|
|
686
|
+
* @param {string} prefix 前缀
|
|
687
|
+
* @returns {string} 唯一ID
|
|
688
|
+
*/
|
|
689
|
+
generateId(prefix = 'data') {
|
|
690
|
+
return this.dataPool.utils.generateId(prefix);
|
|
399
691
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* 深拷贝对象
|
|
695
|
+
* @param {any} obj 要拷贝的对象
|
|
696
|
+
* @returns {any} 拷贝后的对象
|
|
697
|
+
*/
|
|
698
|
+
deepClone(obj) {
|
|
699
|
+
return this.dataPool.utils.deepClone(obj);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* 检查对象是否为空
|
|
704
|
+
* @param {any} value 要检查的值
|
|
705
|
+
* @returns {boolean} 是否为空
|
|
706
|
+
*/
|
|
707
|
+
isEmpty(value) {
|
|
708
|
+
return this.dataPool.utils.isEmpty(value);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* 检查是否为对象
|
|
713
|
+
* @param {any} value 要检查的值
|
|
714
|
+
* @returns {boolean} 是否为对象
|
|
715
|
+
*/
|
|
716
|
+
isObject(value) {
|
|
717
|
+
return this.dataPool.utils.isObject(value);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* 获取当前时间戳
|
|
722
|
+
* @returns {number} 时间戳
|
|
723
|
+
*/
|
|
724
|
+
now() {
|
|
725
|
+
return this.dataPool.utils.now();
|
|
403
726
|
}
|
|
404
727
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* 创建数据池 API 实例
|
|
731
|
+
* @returns {DataPoolAPI} API 实例
|
|
732
|
+
*/
|
|
733
|
+
const createDataPoolAPI = () => {
|
|
734
|
+
return new DataPoolAPI();
|
|
409
735
|
};
|
|
410
736
|
|
|
737
|
+
/**
|
|
738
|
+
* 全局数据池 API 实例 - 延迟初始化
|
|
739
|
+
*/
|
|
740
|
+
let dataPoolAPIInstance = null;
|
|
741
|
+
new Proxy({}, {
|
|
742
|
+
get(target, prop) {
|
|
743
|
+
if (!dataPoolAPIInstance) {
|
|
744
|
+
dataPoolAPIInstance = createDataPoolAPI();
|
|
745
|
+
}
|
|
746
|
+
return dataPoolAPIInstance[prop];
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* 便捷的导出函数,供直接使用 - 延迟初始化
|
|
752
|
+
*/
|
|
753
|
+
const getAPI = () => {
|
|
754
|
+
if (!dataPoolAPIInstance) {
|
|
755
|
+
dataPoolAPIInstance = createDataPoolAPI();
|
|
756
|
+
}
|
|
757
|
+
return dataPoolAPIInstance;
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
// 模型管理
|
|
761
|
+
const createTreeTableModel = (instanceId, options = {}) => getAPI().createTreeTableModel(instanceId, options);
|
|
762
|
+
|
|
411
763
|
const CONTEXT = '__idooel__ele__context__';
|
|
412
764
|
const AREA_NAMES = {
|
|
413
765
|
BUTTON_GROUP: 'BUTTON_GROUP'
|
|
@@ -864,11 +1216,11 @@ __vue_render__$G._withStripped = true;
|
|
|
864
1216
|
/* style */
|
|
865
1217
|
const __vue_inject_styles__$G = function (inject) {
|
|
866
1218
|
if (!inject) return
|
|
867
|
-
inject("data-v-
|
|
1219
|
+
inject("data-v-1d79ddf9_0", { source: ".ele-date__wrapper[data-v-1d79ddf9] {\n width: 100%;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\date\\src\\index.vue","index.vue"],"names":[],"mappings":"AA6GA;EACA,WAAA;AC5GA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele-date__wrapper\">\r\n <a-date-picker \r\n style=\"width: 100%;\" \r\n :mode=\"modeValue\"\r\n v-if=\"modeValue == 'year'\"\r\n :open=\"open\"\r\n :disabled=\"disabled\"\r\n :value=\"value\"\r\n :placeholder=\"placeholder\"\r\n :show-time=\"showTime\"\r\n :show-today=\"showToday\"\r\n :valueFormat=\"innerValueFormat\"\r\n @panelChange=\"onPanelChange\"\r\n @openChange=\"openChange\"\r\n @change=\"onChange\"\r\n :format=\"format\">\r\n </a-date-picker>\r\n <a-date-picker \r\n v-else\r\n style=\"width: 100%;\"\r\n :placeholder=\"placeholder\"\r\n :open=\"open\"\r\n :disabled=\"disabled\"\r\n :value=\"value\"\r\n :show-time=\"showTime\"\r\n :show-today=\"showToday\"\r\n :valueFormat=\"innerValueFormat\"\r\n @panelChange=\"onPanelChange\"\r\n @openChange=\"openChange\"\r\n @change=\"onChange\"\r\n :format=\"format\">\r\n </a-date-picker>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport moment from 'moment'\r\nexport default {\r\n name: 'ele-date',\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n value: {\r\n type: [String, Object]\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n },\r\n format: {\r\n type: String,\r\n default: 'YYYY/MM/DD'\r\n },\r\n mode: {\r\n type: String\r\n },\r\n valueFormat: {\r\n type: String\r\n },\r\n showTime: {\r\n type: [Boolean, Object],\r\n default: true\r\n },\r\n showToday: {\r\n type: Boolean,\r\n default: true\r\n },\r\n placeholder: {\r\n type: String,\r\n default: '请选择日期'\r\n }\r\n },\r\n data () {\r\n return {\r\n open: false\r\n }\r\n },\r\n computed: {\r\n innerValueFormat () {\r\n if (this.valueFormat) return this.valueFormat\r\n return this.format\r\n },\r\n modeValue () {\r\n if (this.mode) return this.mode\r\n if (this.format === 'YYYY') return 'year'\r\n return 'date'\r\n }\r\n },\r\n methods: {\r\n onChange (_, dataString) {\r\n this.$emit('input', dataString)\r\n this.$emit('change', dataString)\r\n },\r\n onPanelChange (value, mode) {\r\n if (this.modeValue !== 'year') return\r\n this.$emit('input', moment(value).format(this.format))\r\n this.$emit('change', moment(value).format(this.format))\r\n this.open = false\r\n },\r\n openChange (open) {\r\n this.open = open\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n.ele-date__wrapper {\r\n width: 100%;\r\n}\r\n</style>",".ele-date__wrapper {\n width: 100%;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
868
1220
|
|
|
869
1221
|
};
|
|
870
1222
|
/* scoped */
|
|
871
|
-
const __vue_scope_id__$G = "data-v-
|
|
1223
|
+
const __vue_scope_id__$G = "data-v-1d79ddf9";
|
|
872
1224
|
/* module identifier */
|
|
873
1225
|
const __vue_module_identifier__$G = undefined;
|
|
874
1226
|
/* functional template */
|
|
@@ -949,11 +1301,11 @@ __vue_render__$F._withStripped = true;
|
|
|
949
1301
|
/* style */
|
|
950
1302
|
const __vue_inject_styles__$F = function (inject) {
|
|
951
1303
|
if (!inject) return
|
|
952
|
-
inject("data-v-
|
|
1304
|
+
inject("data-v-22b90b54_0", { source: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", map: {"version":3,"sources":[],"names":[],"mappings":"","file":"index.vue"}, media: undefined });
|
|
953
1305
|
|
|
954
1306
|
};
|
|
955
1307
|
/* scoped */
|
|
956
|
-
const __vue_scope_id__$F = "data-v-
|
|
1308
|
+
const __vue_scope_id__$F = "data-v-22b90b54";
|
|
957
1309
|
/* module identifier */
|
|
958
1310
|
const __vue_module_identifier__$F = undefined;
|
|
959
1311
|
/* functional template */
|
|
@@ -1108,11 +1460,11 @@ __vue_render__$E._withStripped = true;
|
|
|
1108
1460
|
/* style */
|
|
1109
1461
|
const __vue_inject_styles__$E = function (inject) {
|
|
1110
1462
|
if (!inject) return
|
|
1111
|
-
inject("data-v-
|
|
1463
|
+
inject("data-v-d3a1fb9e_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
1112
1464
|
|
|
1113
1465
|
};
|
|
1114
1466
|
/* scoped */
|
|
1115
|
-
const __vue_scope_id__$E = "data-v-
|
|
1467
|
+
const __vue_scope_id__$E = "data-v-d3a1fb9e";
|
|
1116
1468
|
/* module identifier */
|
|
1117
1469
|
const __vue_module_identifier__$E = undefined;
|
|
1118
1470
|
/* functional template */
|
|
@@ -1421,6 +1773,9 @@ var script$D = {
|
|
|
1421
1773
|
},
|
|
1422
1774
|
requestTableData: {
|
|
1423
1775
|
default: void 0
|
|
1776
|
+
},
|
|
1777
|
+
keepAliveRefresh: {
|
|
1778
|
+
default: void 0
|
|
1424
1779
|
}
|
|
1425
1780
|
},
|
|
1426
1781
|
data() {
|
|
@@ -1448,6 +1803,7 @@ var script$D = {
|
|
|
1448
1803
|
return {
|
|
1449
1804
|
requestTreeData: this.requestTreeData,
|
|
1450
1805
|
requestTableData: this.requestTableData,
|
|
1806
|
+
keepAliveRefresh: this.keepAliveRefresh,
|
|
1451
1807
|
closeModalConfirm: this.closeModalConfirm,
|
|
1452
1808
|
showModalConfirm: this.handleClickModalConfirm,
|
|
1453
1809
|
currentRowData: this.record
|
|
@@ -1706,11 +2062,11 @@ __vue_render__$D._withStripped = true;
|
|
|
1706
2062
|
/* style */
|
|
1707
2063
|
const __vue_inject_styles__$D = function (inject) {
|
|
1708
2064
|
if (!inject) return
|
|
1709
|
-
inject("data-v-
|
|
2065
|
+
inject("data-v-248508c0_0", { source: ".g-table__action[data-v-248508c0] {\n display: flex;\n flex-direction: row;\n}\n.g-table__action .table-action__item[data-v-248508c0] {\n font-size: 14px;\n color: #409EFF;\n margin-left: 16px;\n cursor: pointer;\n}\n.g-table__action .table-action__item[data-v-248508c0]:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=action.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\table\\src\\action.vue","action.vue"],"names":[],"mappings":"AAmKA;EACA,aAAA;EACA,mBAAA;AClKA;ADmKA;EACA,eAAA;EACA,cAAA;EACA,iBAAA;EACA,eAAA;ACjKA;ADkKA;EACA,cAAA;AChKA;;AAEA,qCAAqC","file":"action.vue","sourcesContent":["<template>\r\n <div class=\"g-table__action\">\r\n <div class=\"table-action__item\" v-for=\"(item, idx) in execOperationExpression(dataSource)\" :key=\"idx\">\r\n <template v-if=\"item.type == 'text'\">\r\n <span @click=\"handleClickText(item)\">{{ item.label }}</span>\r\n </template>\r\n <template v-else-if=\"item.type == 'confirm'\">\r\n <div>\r\n <a-popconfirm :title=\"item.message\" @confirm=\"handleClickConfirm(item)\">\r\n {{ item.label }}\r\n </a-popconfirm>\r\n </div>\r\n </template>\r\n <template v-else-if=\"item.type == 'dropdown'\">\r\n <a-dropdown>\r\n <a-menu slot=\"overlay\" @click=\"handleDropdownClick\">\r\n <a-menu-item :key=\"`${item.key || ''}${menuKeyDelimiter}${opt.value || ''}`\" v-for=\"opt in execOperationExpression(item.optionList)\">\r\n <template v-if=\"opt.type == 'confirm'\">\r\n <a-popconfirm :title=\"opt.message\" @confirm=\"handleClickConfirm(opt)\">\r\n {{ opt.label }}\r\n </a-popconfirm>\r\n </template>\r\n <template v-else-if=\"opt.type == 'modal-confirm'\">\r\n <div style=\"width: 100%\" @click=\"handleClickModalConfirm(opt)\">{{ opt.label }}</div>\r\n <ele-modal-confirm v-bind=\"opt.modalConfirm\" v-on=\"$listeners\" v-model=\"showModalConfirm\"></ele-modal-confirm>\r\n </template>\r\n <template v-else>\r\n {{ opt.label }}\r\n </template>\r\n </a-menu-item>\r\n </a-menu>\r\n <span>{{ item.label }}</span>\r\n </a-dropdown>\r\n </template>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { v5 as uuidv5 } from 'uuid'\r\nimport { type, route } from '@idooel/shared'\r\nimport { parse } from '@idooel/expression'\r\nimport { CONTEXT } from '../../utils'\r\nconst MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002'\r\nexport default {\r\n props: {\r\n record: {\r\n type: Object\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n }\r\n },\r\n inject: {\r\n requestTreeData: {\r\n default: void 0\r\n },\r\n requestTableData: {\r\n default: void 0\r\n },\r\n keepAliveRefresh: {\r\n default: void 0\r\n }\r\n },\r\n data() {\r\n return {\r\n showModalConfirm: false\r\n }\r\n },\r\n provide () {\r\n return {\r\n [CONTEXT]: () => {\r\n return {\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta,\r\n exposed: this.builtInMethods,\r\n ...this.record\r\n }\r\n }\r\n }\r\n },\r\n computed: {\r\n menuKeyDelimiter () {\r\n return uuidv5('_', MENU_KEY_NAMESPACE)\r\n },\r\n builtInMethods () {\r\n return { \r\n requestTreeData: this.requestTreeData, \r\n requestTableData: this.requestTableData,\r\n keepAliveRefresh: this.keepAliveRefresh,\r\n closeModalConfirm: this.closeModalConfirm,\r\n showModalConfirm: this.handleClickModalConfirm,\r\n currentRowData: this.record\r\n }\r\n }\r\n },\r\n methods: {\r\n closeModalConfirm () {\r\n this.showModalConfirm = false\r\n },\r\n handleClickModalConfirm () {\r\n this.showModalConfirm = true\r\n },\r\n execOperationExpression (dataSource = []) {\r\n const ret = dataSource.map(item => {\r\n const { show } = item\r\n if (type.isUndefined(show)) {\r\n return item\r\n } else if (type.isBool(show)) {\r\n if (show) return item\r\n } else if (type.isStr(show)) {\r\n const parseRet = parse(show, { \r\n ...this.record, \r\n _route: route.searchToQueryParams(window.location.search) \r\n })\r\n if (parseRet) return item\r\n }\r\n }).filter(item => item)\r\n return ret\r\n },\r\n handleClickConfirm (props) {\r\n //TODO generate event by special rule\r\n const { eventName, value, key } = props\r\n this.$emit(eventName || key, { \r\n key: value || key, \r\n record: this.record,\r\n builtInMethods: this.builtInMethods,\r\n exposed: this.builtInMethods\r\n })\r\n },\r\n handleDropdownClick (props) {\r\n const { key } = props\r\n const [parent, child] = key.split(this.menuKeyDelimiter)\r\n if (!parent || !child) {\r\n throw new Error('key is required')\r\n }\r\n const currentDropdown = this.dataSource.find(item => item.key === parent)\r\n const currentClickTarget = currentDropdown.optionList.find(item => item.value === child)\r\n const { eventName, type, key: currentKey } = currentClickTarget\r\n //TODO generate event by special rule\r\n if (type === 'confirm' || type === 'modal-confirm') return\r\n this.$emit(eventName || currentKey, { \r\n key: child, \r\n record: this.record, \r\n builtInMethods: this.builtInMethods,\r\n exposed: this.builtInMethods\r\n })\r\n },\r\n handleClickText (props) {\r\n const { eventName, key } = props\r\n this.$emit(eventName || key, { \r\n key, \r\n record: this.record, \r\n builtInMethods: this.builtInMethods,\r\n exposed: this.builtInMethods\r\n })\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-table__action {\r\n display: flex;\r\n flex-direction: row;\r\n .table-action__item {\r\n font-size: 14px;\r\n color: #409EFF;\r\n margin-left: 16px;\r\n cursor: pointer;\r\n &:first-child {\r\n margin-left: 0;\r\n }\r\n }\r\n}\r\n</style>",".g-table__action {\n display: flex;\n flex-direction: row;\n}\n.g-table__action .table-action__item {\n font-size: 14px;\n color: #409EFF;\n margin-left: 16px;\n cursor: pointer;\n}\n.g-table__action .table-action__item:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=action.vue.map */"]}, media: undefined });
|
|
1710
2066
|
|
|
1711
2067
|
};
|
|
1712
2068
|
/* scoped */
|
|
1713
|
-
const __vue_scope_id__$D = "data-v-
|
|
2069
|
+
const __vue_scope_id__$D = "data-v-248508c0";
|
|
1714
2070
|
/* module identifier */
|
|
1715
2071
|
const __vue_module_identifier__$D = undefined;
|
|
1716
2072
|
/* functional template */
|
|
@@ -1951,6 +2307,7 @@ var __vue_render__$C = function () {
|
|
|
1951
2307
|
bordered: _vm.bordered,
|
|
1952
2308
|
pagination: false,
|
|
1953
2309
|
loading: _vm.loading,
|
|
2310
|
+
size: "middle",
|
|
1954
2311
|
columns: _vm.innerColumns,
|
|
1955
2312
|
"row-selection": _vm.rowSelection,
|
|
1956
2313
|
"row-class-name": _vm.setRowClassName,
|
|
@@ -2009,11 +2366,11 @@ __vue_render__$C._withStripped = true;
|
|
|
2009
2366
|
/* style */
|
|
2010
2367
|
const __vue_inject_styles__$C = function (inject) {
|
|
2011
2368
|
if (!inject) return
|
|
2012
|
-
inject("data-v-7943901f_0", { source: "@charset \"UTF-8\";\n.g-table__wrapper[data-v-7943901f] {\n /* 外层采用列布局,确保分页始终可见,表格充满剩余空间 */\n display: flex;\n flex-direction: column;\n overflow: hidden;\n /* 表格区域占满剩余空间,启用纵向滚动 */\n /* 确保表体能够正常纵向滚动 */\n /* 分页区域固定在底部,不被挤出视口 */\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-wrapper {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-7943901f] .ant-spin-nested-loading {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-7943901f] .ant-spin-container {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-content {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-scroll {\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-header {\n flex: 0 0 auto;\n overflow: hidden;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-selection-column {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-selection-column {\n background-color: var(--idooel-row-odd-color);\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-odd-color);\n}\n.g-table__wrapper[data-v-7943901f] .ant-table-body {\n flex: 1 1 auto;\n overflow: auto !important;\n /* 确保滚动条稳定,避免列宽抖动 */\n scrollbar-gutter: stable;\n}\n.g-table__wrapper .g-table__pagination[data-v-7943901f] {\n flex: 0 0 auto;\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n background: #fff;\n z-index: 999;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue","/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/table/src/index.vue"],"names":[],"mappings":"AAAA,gBAAgB;ACwNhB;EACA,8BAAA;EACA,aAAA;EACA,sBAAA;EACA,gBAAA;EAEA,sBAAA;EA6BA,iBAAA;EA6CA,qBAAA;AD/RA;ACsNA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADpNA;ACuNA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADrNA;ACwNA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADtNA;ACyNA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADvNA;AC2NA;EACA,cAAA;EACA,aAAA;EACA,gBAAA;ADzNA;AC4NA;EACA,YAAA;EACA,aAAA;EACA,sBAAA;AD1NA;AC6NA;EACA,cAAA;EACA,gBAAA;AD3NA;ACiOA;EACA,0DAAA;AD/NA;ACiOA;EACA,0DAAA;AD/NA;ACkOA;EACA,6CAAA;ADhOA;ACkOA;EACA,6CAAA;ADhOA;ACsOA;EACA,cAAA;EACA,yBAAA;EACA,mBAAA;EACA,wBAAA;ADpOA;ACwOA;EACA,cAAA;EACA,aAAA;EACA,mBAAA;EACA,oBAAA;EACA,iBAAA;EACA,gBAAA;EACA,mBAAA;EACA,gBAAA;EACA,YAAA;ADtOA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["@charset \"UTF-8\";\n.g-table__wrapper {\n /* 外层采用列布局,确保分页始终可见,表格充满剩余空间 */\n display: flex;\n flex-direction: column;\n overflow: hidden;\n /* 表格区域占满剩余空间,启用纵向滚动 */\n /* 确保表体能够正常纵向滚动 */\n /* 分页区域固定在底部,不被挤出视口 */\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-spin-nested-loading {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-spin-container {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-table {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-table-content {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n}\n.g-table__wrapper ::v-deep .ant-table-scroll {\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-table-header {\n flex: 0 0 auto;\n overflow: hidden;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-selection-column {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-selection-column {\n background-color: var(--idooel-row-odd-color);\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-odd-color);\n}\n.g-table__wrapper ::v-deep .ant-table-body {\n flex: 1 1 auto;\n overflow: auto !important;\n /* 确保滚动条稳定,避免列宽抖动 */\n scrollbar-gutter: stable;\n}\n.g-table__wrapper .g-table__pagination {\n flex: 0 0 auto;\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n background: #fff;\n z-index: 999;\n}\n\n/*# sourceMappingURL=index.vue.map */","<template>\n <div class=\"g-table__wrapper\" :style=\"wrapperStyle\" :class=\"{ 'g-table--no-scroll-y': !needScrollY }\">\n <a-table\n :bordered=\"bordered\"\n :class=\"[isNoData && 'g-table__no-data']\"\n :pagination=\"false\"\n :loading=\"loading\"\n :columns=\"innerColumns\"\n :row-selection=\"rowSelection\"\n :row-class-name=\"setRowClassName\"\n :data-source=\"dataSource\"\n :scroll=\"getScroll\">\n <template slot=\"action\" slot-scope=\"record\">\n <Actions v-on=\"$listeners\" :data-source=\"actions\" :record=\"record\"></Actions>\n </template>\n </a-table>\n <div class=\"g-table__pagination\">\n <a-pagination\n :show-total=\"all => `共 ${all} 条数据`\"\n show-size-changer \n show-quick-jumper\n :pageSize=\"innerPageSize\"\n :current=\"innerCurrentPage\"\n :pageSizeOptions=\"pageSizeOptions\"\n @change=\"onChangePagination\"\n @showSizeChange=\"onShowSizeChange\"\n :total=\"total\">\n </a-pagination>\n </div>\n </div>\n</template>\n\n<script>\nimport Actions from './action.vue'\nexport default {\n name: 'ele-table',\n components: {\n Actions\n },\n props: {\n // ant table wrapper\n height: {\n type: Number\n },\n width: {\n type: Number\n },\n x: {\n type: Number,\n default: 1200\n },\n y: {\n type: Number,\n default: 200\n },\n scroll: {\n type: Object\n },\n rowSelection: {\n type: Object\n },\n actions: {\n type: Array,\n default: () => []\n },\n total: {\n type: Number,\n default: 0\n },\n loading: {\n type: Boolean,\n default: false\n },\n columns: {\n type: Array,\n default: () => []\n },\n dataSource: {\n type: Array,\n default: () => []\n },\n pageSize: {\n type: Number,\n default: 10\n },\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '20', '30', '40']\n },\n bordered: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n tableHeaderHeight: 0,\n paginationHeight: 0,\n innerPageSize: 10,\n innerCurrentPage: 1,\n tableContentHeight: 0,\n obs: []\n }\n },\n computed: {\n wrapperStyle () {\n // 外层容器样式:确保分页始终可见,表格充满剩余空间\n if (!this.height) return {}\n return { height: `${this.height}px` }\n },\n needScrollY () {\n // 判断是否需要 y 轴滚动:基于数据行数与可用高度预估\n if (!this.height) return false\n \n const availableHeight = this.getScrollHeightByHeight\n if (availableHeight <= 0) return false\n \n // 预估每行高度(包含边框),antd 默认约 54px\n const estimatedRowHeight = 54\n const estimatedTableHeight = this.dataSource.length * estimatedRowHeight\n \n return estimatedTableHeight > availableHeight\n },\n innerColumns () {\n return this.columns.filter(col => !Object.keys(col).includes('multiple'))\n },\n isNoData () {\n return !this.dataSource.length\n },\n getScrollHeightByHeight () {\n // 始终返回可用的剩余高度,让表格内容不足时也能占满容器\n return this.height - this.tableHeaderHeight - this.paginationHeight\n },\n isFlexColumn () {\n return this.columns.every(col => !col.width)\n },\n getScroll () {\n if (this.scroll) {\n return this.scroll\n } else {\n const baseX = this.isFlexColumn ? 0 : (this.width > this.x ? 0 : this.x)\n if (this.height) {\n // 计算表体可用高度\n const availableHeight = this.tableHeaderHeight && this.paginationHeight \n ? this.getScrollHeightByHeight \n : this.height - 100 // 预估值,给表头和分页留空间\n \n if (availableHeight > 50) { // 确保有足够的最小高度\n console.log('Table scroll config:', { x: baseX, y: availableHeight, height: this.height, headerHeight: this.tableHeaderHeight, paginationHeight: this.paginationHeight })\n return { x: baseX, y: availableHeight }\n }\n }\n return { x: baseX }\n }\n }\n },\n watch: {\n pageSize: {\n handler (pageSize) {\n this.innerPageSize = pageSize\n },\n immediate: true\n }\n },\n methods: {\n onShowSizeChange (current, pageSize) {\n this.innerCurrentPage = current\n this.innerPageSize = pageSize\n this.$emit('change-page', current, pageSize)\n },\n setPaginationHeight () {\n this.$nextTick(() => {\n const { height } = document.querySelector('.g-table__pagination').getBoundingClientRect()\n this.paginationHeight = height\n })\n },\n setTableHeaderHeight () {\n this.$nextTick(() => {\n const el = document.querySelector('.ant-table-header')\n if (!el) return\n const { height } = el.getBoundingClientRect()\n this.tableHeaderHeight = height\n })\n },\n setTableTbodyHeight () {\n // 简化:仅需要获取表头高度,不再依赖表体高度的动态监听\n this.$nextTick(() => {\n this.setTableHeaderHeight()\n })\n },\n setRowClassName (record, idx) {\n return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd'\n },\n onChangePagination (page, pageSize) {\n this.innerCurrentPage = page\n this.innerPageSize = pageSize\n this.$emit('change-page', page, pageSize)\n }\n },\n mounted() {\n this.$nextTick(() => {\n this.setPaginationHeight()\n setTimeout(() => {\n this.setTableTbodyHeight()\n // 再测一次分页高度,确保初次渲染完成后数值准确\n this.setPaginationHeight()\n }, 200)\n })\n },\n destroyed () {\n this.obs.forEach(ob => ob.disconnect())\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.g-table__wrapper {\n /* 外层采用列布局,确保分页始终可见,表格充满剩余空间 */\n display: flex;\n flex-direction: column;\n overflow: hidden;\n\n /* 表格区域占满剩余空间,启用纵向滚动 */\n ::v-deep .ant-table-wrapper {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n ::v-deep .ant-spin-nested-loading {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n ::v-deep .ant-spin-container {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n ::v-deep .ant-table {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n /* 确保表体能够正常纵向滚动 */\n ::v-deep .ant-table-content {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n }\n\n ::v-deep .ant-table-scroll {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n ::v-deep .ant-table-header {\n flex: 0 0 auto;\n overflow: hidden;\n }\n ::v-deep .ant-table-fixed {\n .ant-table-tbody {\n .g-table__row--odd {\n &.ant-table-row-hover {\n .ant-table-selection-column {\n background-color: var(--idooel-row-hover-color) !important;\n }\n .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-hover-color) !important;\n }\n }\n .ant-table-selection-column {\n background-color: var(--idooel-row-odd-color);\n }\n .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-odd-color);\n }\n }\n }\n }\n\n ::v-deep .ant-table-body {\n flex: 1 1 auto;\n overflow: auto !important;\n /* 确保滚动条稳定,避免列宽抖动 */\n scrollbar-gutter: stable;\n }\n\n /* 分页区域固定在底部,不被挤出视口 */\n .g-table__pagination {\n flex: 0 0 auto;\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n background: #fff;\n z-index: 999;\n }\n}\n</style>"]}, media: undefined });
|
|
2369
|
+
inject("data-v-3d0d3edf_0", { source: "@charset \"UTF-8\";\n.g-table__wrapper[data-v-3d0d3edf] {\n /* 外层采用列布局,确保分页始终可见,表格充满剩余空间 */\n display: flex;\n flex-direction: column;\n overflow: hidden;\n /* 表格区域占满剩余空间,启用纵向滚动 */\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-wrapper {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-spin-nested-loading {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-spin-container {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-3d0d3edf] {\n /* 确保表体能够正常纵向滚动 */\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-content {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-scroll {\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-header {\n flex: 0 0 auto;\n overflow: hidden;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover td {\n background-color: var(--idooel-row-hover-color);\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-selection-column {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-tbody .g-table__row--odd td {\n background-color: var(--idooel-row-odd-color);\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-selection-column {\n background-color: var(--idooel-row-odd-color) !important;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-odd-color) !important;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-fixed .ant-table-thead {\n background: rgba(0, 0, 0, 0.03) !important;\n}\n.g-table__wrapper[data-v-3d0d3edf] .ant-table-body {\n flex: 1 1 auto;\n overflow: auto !important;\n /* 确保滚动条稳定,避免列宽抖动 */\n scrollbar-gutter: stable;\n}\n.g-table__wrapper[data-v-3d0d3edf] {\n /* 分页区域固定在底部,不被挤出视口 */\n}\n.g-table__wrapper .g-table__pagination[data-v-3d0d3edf] {\n flex: 0 0 auto;\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n background: #fff;\n z-index: 999;\n}\n.g-table__wrapper[data-v-3d0d3edf] {\n /* 空数据状态顶部显示 */\n}\n.g-table__wrapper .g-table__no-data[data-v-3d0d3edf] {\n position: relative;\n}\n.g-table__wrapper .g-table__no-data[data-v-3d0d3edf] .ant-table-placeholder {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -40%);\n width: 100%;\n height: 100%;\n text-align: center;\n color: #999;\n font-size: 14px;\n font-weight: normal;\n line-height: 20px;\n overflow: hidden;\n border: unset;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue","C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\table\\src\\index.vue"],"names":[],"mappings":"AAAA,gBAAgB;ACyNhB;EACA,8BAAA;EACA,aAAA;EACA,sBAAA;EACA,gBAAA;EAEA,sBAAA;ADxNA;ACyNA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADvNA;AC0NA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADxNA;AC2NA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;ADzNA;AC4NA;EACA,cAAA;EACA,aAAA;EACA,aAAA;EACA,sBAAA;AD1NA;AC0LA;EAmCA,iBAAA;AD1NA;AC2NA;EACA,cAAA;EACA,aAAA;EACA,gBAAA;ADzNA;AC4NA;EACA,YAAA;EACA,aAAA;EACA,sBAAA;AD1NA;AC6NA;EACA,cAAA;EACA,gBAAA;AD3NA;ACiOA;EACA,+CAAA;AD/NA;ACiOA;EACA,0DAAA;AD/NA;ACiOA;EACA,0DAAA;AD/NA;ACkOA;EACA,6CAAA;ADhOA;ACkOA;EACA,wDAAA;ADhOA;ACkOA;EACA,wDAAA;ADhOA;ACoOA;EACA,0CAAA;ADlOA;ACsOA;EACA,cAAA;EACA,yBAAA;EACA,mBAAA;EACA,wBAAA;ADpOA;AC8IA;EAyFA,qBAAA;ADpOA;ACqOA;EACA,cAAA;EACA,aAAA;EACA,mBAAA;EACA,oBAAA;EACA,iBAAA;EACA,gBAAA;EACA,mBAAA;EACA,gBAAA;EACA,YAAA;ADnOA;ACgIA;EAsGA,cAAA;ADnOA;ACoOA;EACA,kBAAA;ADlOA;ACmOA;EACA,kBAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;EACA,WAAA;EACA,eAAA;EACA,mBAAA;EACA,iBAAA;EACA,gBAAA;EACA,aAAA;ADjOA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["@charset \"UTF-8\";\n.g-table__wrapper {\n /* 外层采用列布局,确保分页始终可见,表格充满剩余空间 */\n display: flex;\n flex-direction: column;\n overflow: hidden;\n /* 表格区域占满剩余空间,启用纵向滚动 */\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-spin-nested-loading {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-spin-container {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-table {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper {\n /* 确保表体能够正常纵向滚动 */\n}\n.g-table__wrapper ::v-deep .ant-table-content {\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n}\n.g-table__wrapper ::v-deep .ant-table-scroll {\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.g-table__wrapper ::v-deep .ant-table-header {\n flex: 0 0 auto;\n overflow: hidden;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover td {\n background-color: var(--idooel-row-hover-color);\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-selection-column {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd.ant-table-row-hover .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-hover-color) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd td {\n background-color: var(--idooel-row-odd-color);\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-selection-column {\n background-color: var(--idooel-row-odd-color) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-tbody .g-table__row--odd .ant-table-row-cell-break-word {\n background-color: var(--idooel-row-odd-color) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-fixed .ant-table-thead {\n background: rgba(0, 0, 0, 0.03) !important;\n}\n.g-table__wrapper ::v-deep .ant-table-body {\n flex: 1 1 auto;\n overflow: auto !important;\n /* 确保滚动条稳定,避免列宽抖动 */\n scrollbar-gutter: stable;\n}\n.g-table__wrapper {\n /* 分页区域固定在底部,不被挤出视口 */\n}\n.g-table__wrapper .g-table__pagination {\n flex: 0 0 auto;\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n background: #fff;\n z-index: 999;\n}\n.g-table__wrapper {\n /* 空数据状态顶部显示 */\n}\n.g-table__wrapper .g-table__no-data {\n position: relative;\n}\n.g-table__wrapper .g-table__no-data ::v-deep .ant-table-placeholder {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -40%);\n width: 100%;\n height: 100%;\n text-align: center;\n color: #999;\n font-size: 14px;\n font-weight: normal;\n line-height: 20px;\n overflow: hidden;\n border: unset;\n}\n\n/*# sourceMappingURL=index.vue.map */","<template>\r\n <div class=\"g-table__wrapper\" :style=\"wrapperStyle\" :class=\"{ 'g-table--no-scroll-y': !needScrollY }\">\r\n <a-table\r\n :bordered=\"bordered\"\r\n :class=\"[isNoData && 'g-table__no-data']\"\r\n :pagination=\"false\"\r\n :loading=\"loading\"\r\n size=\"middle\"\r\n :columns=\"innerColumns\"\r\n :row-selection=\"rowSelection\"\r\n :row-class-name=\"setRowClassName\"\r\n :data-source=\"dataSource\"\r\n :scroll=\"getScroll\">\r\n <template slot=\"action\" slot-scope=\"record\">\r\n <Actions v-on=\"$listeners\" :data-source=\"actions\" :record=\"record\"></Actions>\r\n </template>\r\n </a-table>\r\n <div class=\"g-table__pagination\">\r\n <a-pagination\r\n :show-total=\"all => `共 ${all} 条数据`\"\r\n show-size-changer \r\n show-quick-jumper\r\n :pageSize=\"innerPageSize\"\r\n :current=\"innerCurrentPage\"\r\n :pageSizeOptions=\"pageSizeOptions\"\r\n @change=\"onChangePagination\"\r\n @showSizeChange=\"onShowSizeChange\"\r\n :total=\"total\">\r\n </a-pagination>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport Actions from './action.vue'\r\nexport default {\r\n name: 'ele-table',\r\n components: {\r\n Actions\r\n },\r\n props: {\r\n // ant table wrapper\r\n height: {\r\n type: Number\r\n },\r\n width: {\r\n type: Number\r\n },\r\n x: {\r\n type: Number,\r\n default: 1200\r\n },\r\n y: {\r\n type: Number,\r\n default: 200\r\n },\r\n scroll: {\r\n type: Object\r\n },\r\n rowSelection: {\r\n type: Object\r\n },\r\n actions: {\r\n type: Array,\r\n default: () => []\r\n },\r\n total: {\r\n type: Number,\r\n default: 0\r\n },\r\n loading: {\r\n type: Boolean,\r\n default: false\r\n },\r\n columns: {\r\n type: Array,\r\n default: () => []\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n },\r\n pageSize: {\r\n type: Number,\r\n default: 10\r\n },\r\n pageSizeOptions: {\r\n type: Array,\r\n default: () => ['10', '20', '30', '40']\r\n },\r\n bordered: {\r\n type: Boolean,\r\n default: true\r\n }\r\n },\r\n data() {\r\n return {\r\n tableHeaderHeight: 0,\r\n paginationHeight: 0,\r\n innerPageSize: 10,\r\n innerCurrentPage: 1,\r\n tableContentHeight: 0,\r\n obs: []\r\n }\r\n },\r\n computed: {\r\n wrapperStyle () {\r\n // 外层容器样式:确保分页始终可见,表格充满剩余空间\r\n if (!this.height) return {}\r\n return { height: `${this.height}px` }\r\n },\r\n needScrollY () {\r\n // 判断是否需要 y 轴滚动:基于数据行数与可用高度预估\r\n if (!this.height) return false\r\n \r\n const availableHeight = this.getScrollHeightByHeight\r\n if (availableHeight <= 0) return false\r\n \r\n // 预估每行高度(包含边框),antd 默认约 54px\r\n const estimatedRowHeight = 54\r\n const estimatedTableHeight = this.dataSource.length * estimatedRowHeight\r\n \r\n return estimatedTableHeight > availableHeight\r\n },\r\n innerColumns () {\r\n return this.columns.filter(col => !Object.keys(col).includes('multiple'))\r\n },\r\n isNoData () {\r\n return !this.dataSource.length\r\n },\r\n getScrollHeightByHeight () {\r\n // 始终返回可用的剩余高度,让表格内容不足时也能占满容器\r\n return this.height - this.tableHeaderHeight - this.paginationHeight\r\n },\r\n isFlexColumn () {\r\n return this.columns.every(col => !col.width)\r\n },\r\n getScroll () {\r\n if (this.scroll) {\r\n return this.scroll\r\n } else {\r\n const baseX = this.isFlexColumn ? 0 : (this.width > this.x ? 0 : this.x)\r\n if (this.height) {\r\n // 计算表体可用高度\r\n const availableHeight = this.tableHeaderHeight && this.paginationHeight \r\n ? this.getScrollHeightByHeight \r\n : this.height - 100 // 预估值,给表头和分页留空间\r\n \r\n if (availableHeight > 50) { // 确保有足够的最小高度\r\n console.log('Table scroll config:', { x: baseX, y: availableHeight, height: this.height, headerHeight: this.tableHeaderHeight, paginationHeight: this.paginationHeight })\r\n return { x: baseX, y: availableHeight }\r\n }\r\n }\r\n return { x: baseX }\r\n }\r\n }\r\n },\r\n watch: {\r\n pageSize: {\r\n handler (pageSize) {\r\n this.innerPageSize = pageSize\r\n },\r\n immediate: true\r\n }\r\n },\r\n methods: {\r\n onShowSizeChange (current, pageSize) {\r\n this.innerCurrentPage = current\r\n this.innerPageSize = pageSize\r\n this.$emit('change-page', current, pageSize)\r\n },\r\n setPaginationHeight () {\r\n this.$nextTick(() => {\r\n const { height } = document.querySelector('.g-table__pagination').getBoundingClientRect()\r\n this.paginationHeight = height\r\n })\r\n },\r\n setTableHeaderHeight () {\r\n this.$nextTick(() => {\r\n const el = document.querySelector('.ant-table-header')\r\n if (!el) return\r\n const { height } = el.getBoundingClientRect()\r\n this.tableHeaderHeight = height\r\n })\r\n },\r\n setTableTbodyHeight () {\r\n // 简化:仅需要获取表头高度,不再依赖表体高度的动态监听\r\n this.$nextTick(() => {\r\n this.setTableHeaderHeight()\r\n })\r\n },\r\n setRowClassName (record, idx) {\r\n return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd'\r\n },\r\n onChangePagination (page, pageSize) {\r\n this.innerCurrentPage = page\r\n this.innerPageSize = pageSize\r\n this.$emit('change-page', page, pageSize)\r\n }\r\n },\r\n mounted() {\r\n this.$nextTick(() => {\r\n this.setPaginationHeight()\r\n setTimeout(() => {\r\n this.setTableTbodyHeight()\r\n // 再测一次分页高度,确保初次渲染完成后数值准确\r\n this.setPaginationHeight()\r\n }, 200)\r\n })\r\n },\r\n destroyed () {\r\n this.obs.forEach(ob => ob.disconnect())\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-table__wrapper {\r\n /* 外层采用列布局,确保分页始终可见,表格充满剩余空间 */\r\n display: flex;\r\n flex-direction: column;\r\n overflow: hidden;\r\n\r\n /* 表格区域占满剩余空间,启用纵向滚动 */\r\n ::v-deep .ant-table-wrapper {\r\n flex: 1 1 auto;\r\n min-height: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n ::v-deep .ant-spin-nested-loading {\r\n flex: 1 1 auto;\r\n min-height: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n ::v-deep .ant-spin-container {\r\n flex: 1 1 auto;\r\n min-height: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n ::v-deep .ant-table {\r\n flex: 1 1 auto;\r\n min-height: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n /* 确保表体能够正常纵向滚动 */\r\n ::v-deep .ant-table-content {\r\n flex: 1 1 auto;\r\n min-height: 0;\r\n overflow: hidden;\r\n }\r\n\r\n ::v-deep .ant-table-scroll {\r\n height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n ::v-deep .ant-table-header {\r\n flex: 0 0 auto;\r\n overflow: hidden;\r\n }\r\n ::v-deep .ant-table-fixed {\r\n .ant-table-tbody {\r\n .g-table__row--odd {\r\n &.ant-table-row-hover {\r\n td {\r\n background-color: var(--idooel-row-hover-color);\r\n }\r\n .ant-table-selection-column {\r\n background-color: var(--idooel-row-hover-color) !important;\r\n }\r\n .ant-table-row-cell-break-word {\r\n background-color: var(--idooel-row-hover-color) !important;\r\n }\r\n }\r\n td {\r\n background-color: var(--idooel-row-odd-color);\r\n }\r\n .ant-table-selection-column {\r\n background-color: var(--idooel-row-odd-color) !important;\r\n }\r\n .ant-table-row-cell-break-word {\r\n background-color: var(--idooel-row-odd-color) !important;\r\n }\r\n }\r\n }\r\n .ant-table-thead {\r\n background: rgba(0, 0, 0, 0.03) !important;\r\n }\r\n }\r\n\r\n ::v-deep .ant-table-body {\r\n flex: 1 1 auto;\r\n overflow: auto !important;\r\n /* 确保滚动条稳定,避免列宽抖动 */\r\n scrollbar-gutter: stable;\r\n }\r\n\r\n /* 分页区域固定在底部,不被挤出视口 */\r\n .g-table__pagination {\r\n flex: 0 0 auto;\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: end;\r\n border-top: unset;\r\n padding-top: 8px;\r\n padding-bottom: 8px;\r\n background: #fff;\r\n z-index: 999;\r\n }\r\n\r\n /* 空数据状态顶部显示 */\r\n .g-table__no-data {\r\n position: relative;\r\n ::v-deep .ant-table-placeholder {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -40%);\r\n width: 100%;\r\n height: 100%;\r\n text-align: center;\r\n color: #999;\r\n font-size: 14px;\r\n font-weight: normal;\r\n line-height: 20px;\r\n overflow: hidden;\r\n border: unset;\r\n }\r\n }\r\n}\r\n</style>"]}, media: undefined });
|
|
2013
2370
|
|
|
2014
2371
|
};
|
|
2015
2372
|
/* scoped */
|
|
2016
|
-
const __vue_scope_id__$C = "data-v-
|
|
2373
|
+
const __vue_scope_id__$C = "data-v-3d0d3edf";
|
|
2017
2374
|
/* module identifier */
|
|
2018
2375
|
const __vue_module_identifier__$C = undefined;
|
|
2019
2376
|
/* functional template */
|
|
@@ -2213,11 +2570,11 @@ __vue_render__$B._withStripped = true;
|
|
|
2213
2570
|
/* style */
|
|
2214
2571
|
const __vue_inject_styles__$B = function (inject) {
|
|
2215
2572
|
if (!inject) return
|
|
2216
|
-
inject("data-v-
|
|
2573
|
+
inject("data-v-252ec372_0", { source: ".g-tree__wrapper[data-v-252ec372] {\n overflow: hidden;\n}\n.g-tree__wrapper[data-v-252ec372] .ant-tree .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n.g-tree__wrapper[data-v-252ec372] .ant-tree .ant-tree-node-selected {\n color: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\tree\\src\\index.vue","index.vue"],"names":[],"mappings":"AAwFA;EACA,gBAAA;ACvFA;ADyFA;EACA,uBAAA;EACA,gBAAA;EACA,mBAAA;ACvFA;ADyFA;EACA,WAAA;ACvFA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"g-tree__wrapper\">\r\n <a-tree\r\n v-if=\"innerTreeData.length\"\r\n :tree-data=\"innerTreeData\"\r\n :checkable=\"checkable\"\r\n @select=\"selectTreeNode\"\r\n @check=\"checkTreeNode\"\r\n :replaceFields=\"replaceFields\"\r\n :default-expanded-keys=\"defaultExpandedKeys\"\r\n :default-selected-keys=\"defaultSelectedKeys\"\r\n :show-line=\"showLine\"\r\n blockNode \r\n :show-icon=\"showIcon\">\r\n <a-icon v-if=\"switcherIcon\" slot=\"switcherIcon\" :type=\"switcherIcon\" />\r\n <template #title=\"props\">\r\n <span :title=\"props[replaceFields.title]\" class=\"tree-node__title\">\r\n {{ props[replaceFields.title] }}\r\n </span>\r\n </template>\r\n <template slot=\"custom\" slot-scope=\"{ scopedSlots }\">\r\n <a-icon :type=\"scopedSlots.iconName\"></a-icon>\r\n </template>\r\n </a-tree>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-tree',\r\n props: {\r\n treeData: {\r\n type: Array,\r\n default: () => []\r\n },\r\n showLine: {\r\n type: Boolean,\r\n default: false\r\n },\r\n switcherIcon: {\r\n type: String\r\n },\r\n checkable: {\r\n type: Boolean,\r\n default: false\r\n },\r\n replaceFields: {\r\n type: Object,\r\n default: () => ({\r\n title: 'title',\r\n key: 'id',\r\n children: 'children'\r\n })\r\n },\r\n defaultExpandedKeys: {\r\n type: Array\r\n },\r\n defaultSelectedKeys: {\r\n type: Array\r\n },\r\n showIcon: {\r\n type: Boolean,\r\n default: true\r\n }\r\n },\r\n data () {\r\n return {}\r\n },\r\n computed: {\r\n innerTreeData () {\r\n return this.treeData\r\n }\r\n },\r\n methods: {\r\n checkTreeNode (checkedKeys, e) {\r\n const { checkedNodes } = e\r\n const nodeDatas = checkedNodes.map(item => item.data.props.dataRef)\r\n this.$emit('check', checkedKeys, nodeDatas)\r\n },\r\n refreshTreeStatus (props = {}) {},\r\n selectTreeNode (selectedKeys, e) {\r\n this.$emit('select', selectedKeys, e)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-tree__wrapper {\r\n overflow: hidden;\r\n ::v-deep .ant-tree {\r\n .ant-tree-node-content-wrapper {\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n }\r\n .ant-tree-node-selected {\r\n color: #fff;\r\n }\r\n }\r\n}\r\n</style>",".g-tree__wrapper {\n overflow: hidden;\n}\n.g-tree__wrapper ::v-deep .ant-tree .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n.g-tree__wrapper ::v-deep .ant-tree .ant-tree-node-selected {\n color: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
2217
2574
|
|
|
2218
2575
|
};
|
|
2219
2576
|
/* scoped */
|
|
2220
|
-
const __vue_scope_id__$B = "data-v-
|
|
2577
|
+
const __vue_scope_id__$B = "data-v-252ec372";
|
|
2221
2578
|
/* module identifier */
|
|
2222
2579
|
const __vue_module_identifier__$B = undefined;
|
|
2223
2580
|
/* functional template */
|
|
@@ -2281,6 +2638,7 @@ var script$A = {
|
|
|
2281
2638
|
return {
|
|
2282
2639
|
requestTreeData: this.requestTreeData,
|
|
2283
2640
|
requestTableData: this.requestTableData,
|
|
2641
|
+
keepAliveRefresh: this.keepAliveRefresh,
|
|
2284
2642
|
[CONTEXT]: () => {
|
|
2285
2643
|
return {
|
|
2286
2644
|
exposed: this.exposed
|
|
@@ -2316,7 +2674,8 @@ var script$A = {
|
|
|
2316
2674
|
fsmMeta: {},
|
|
2317
2675
|
fsmContextProp: {},
|
|
2318
2676
|
modalTableValue: false,
|
|
2319
|
-
modalTableMeta: {}
|
|
2677
|
+
modalTableMeta: {},
|
|
2678
|
+
dataPoolManager: null
|
|
2320
2679
|
};
|
|
2321
2680
|
},
|
|
2322
2681
|
computed: {
|
|
@@ -2398,9 +2757,10 @@ var script$A = {
|
|
|
2398
2757
|
currentTableSelection: this.currentTableSelection,
|
|
2399
2758
|
currentTreeNode: this.currentTreeNodeData,
|
|
2400
2759
|
requestTableData: this.requestTableData,
|
|
2760
|
+
keepAliveRefresh: this.keepAliveRefresh,
|
|
2401
2761
|
refreshTreeData: this.refreshTreeData,
|
|
2402
2762
|
querys: this.tableQuerys,
|
|
2403
|
-
currentRowData: this.
|
|
2763
|
+
currentRowData: this.getCurrentRowData(),
|
|
2404
2764
|
getCurrentRowData: this.getCurrentRowData,
|
|
2405
2765
|
setCurrentRowData: this.setCurrentRowData,
|
|
2406
2766
|
setCurrentTableSelection: this.setCurrentTableSelection,
|
|
@@ -2408,7 +2768,9 @@ var script$A = {
|
|
|
2408
2768
|
cleanCurrentModelEffect: this.cleanCurrentModelEffect,
|
|
2409
2769
|
route: this.$route,
|
|
2410
2770
|
_route: this.$route.query,
|
|
2411
|
-
_routeMeta: this.$route.meta
|
|
2771
|
+
_routeMeta: this.$route.meta,
|
|
2772
|
+
dataPool: this.model ? this.model.getDataPool() : null,
|
|
2773
|
+
dataPoolManager: this.model || null
|
|
2412
2774
|
};
|
|
2413
2775
|
},
|
|
2414
2776
|
overrideTableEvent() {
|
|
@@ -2646,32 +3008,92 @@ var script$A = {
|
|
|
2646
3008
|
}
|
|
2647
3009
|
},
|
|
2648
3010
|
async created() {
|
|
3011
|
+
// onSearch会初始化请求表格数据,所以不需要在这里请求表格数据
|
|
3012
|
+
// 确保全局数据池已初始化
|
|
3013
|
+
if (!window.__idooel_data_pool__) {
|
|
3014
|
+
console.error('Global data pool not initialized. Please check if runtime-context/globalDataPool.js is properly imported.');
|
|
3015
|
+
return;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
// 初始化数据池管理器(使用新的 runtime-context)
|
|
3019
|
+
try {
|
|
3020
|
+
this.model = createTreeTableModel('treeTableModel');
|
|
3021
|
+
if (!this.model) {
|
|
3022
|
+
throw new Error('Failed to create tree table model');
|
|
3023
|
+
}
|
|
3024
|
+
} catch (error) {
|
|
3025
|
+
console.error('Error creating tree table model:', error);
|
|
3026
|
+
this.model = null;
|
|
3027
|
+
return;
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
// 初始化 currentRowData(尝试从共享命名空间获取)
|
|
3031
|
+
this.initializeCurrentRowData();
|
|
3032
|
+
|
|
3033
|
+
// 订阅数据池变化
|
|
3034
|
+
this.unsubscribe = this.model.subscribe('currentRowData', event => {
|
|
3035
|
+
this.currentRowData = event.value || {};
|
|
3036
|
+
this.$forceUpdate();
|
|
3037
|
+
});
|
|
3038
|
+
|
|
3039
|
+
// 订阅共享数据变化
|
|
3040
|
+
this.unsubscribeShared = this.model.subscribeShared(event => {
|
|
3041
|
+
// 当有新的共享数据时,更新当前组件的 currentRowData
|
|
3042
|
+
if (event.value && Object.keys(event.value).length > 0) {
|
|
3043
|
+
this.setCurrentRowData(event.value);
|
|
3044
|
+
}
|
|
3045
|
+
});
|
|
2649
3046
|
if (this.showTree) {
|
|
2650
3047
|
this.treeData = await this.requestTreeData();
|
|
2651
3048
|
const [defaultTreeNode = {}] = this.treeData;
|
|
2652
3049
|
this.defaultExpandedKeys = [defaultTreeNode[this.mapFields.key]];
|
|
2653
3050
|
this.defaultSelectedKeys = [defaultTreeNode[this.mapFields.key]];
|
|
2654
3051
|
this.currentTreeNodeData = defaultTreeNode;
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
3052
|
+
const {
|
|
3053
|
+
params = {},
|
|
3054
|
+
fieldMap = {},
|
|
3055
|
+
overrideInit = false
|
|
3056
|
+
} = this.tableMeta;
|
|
3057
|
+
const currentRowData = this.getCurrentRowData();
|
|
3058
|
+
const ctx = {
|
|
3059
|
+
...this.currentTreeNodeData,
|
|
3060
|
+
_route: this.$route.query,
|
|
3061
|
+
currentRowData: currentRowData
|
|
3062
|
+
};
|
|
3063
|
+
const initQuerys = Object.assign({}, params, parseFieldMap(fieldMap, ctx));
|
|
3064
|
+
if (overrideInit) {
|
|
3065
|
+
this.$emit(RESERVE_EVENT_NAMES.INIT, {
|
|
3066
|
+
...this.exposed
|
|
3067
|
+
});
|
|
3068
|
+
} else {
|
|
3069
|
+
this.tableData = await this.requestTableData(initQuerys);
|
|
3070
|
+
}
|
|
2672
3071
|
}
|
|
2673
3072
|
},
|
|
2674
3073
|
methods: {
|
|
3074
|
+
initializeCurrentRowData() {
|
|
3075
|
+
if (!this.model) {
|
|
3076
|
+
console.warn('Model not initialized, skipping currentRowData initialization');
|
|
3077
|
+
return;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
// 检查是否有来自父组件的共享数据(比如 modal table 场景)
|
|
3081
|
+
const parentData = this.model.getSharedData();
|
|
3082
|
+
if (parentData && Object.keys(parentData).length > 0) {
|
|
3083
|
+
this.setCurrentRowData(parentData);
|
|
3084
|
+
return;
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
// 可以根据路由参数、props 或其他来源设置初始的 currentRowData
|
|
3088
|
+
const {
|
|
3089
|
+
query
|
|
3090
|
+
} = this.$route;
|
|
3091
|
+
|
|
3092
|
+
// 示例:如果路由中有特定参数,可以设置为 currentRowData
|
|
3093
|
+
if (query.rowId || query.selectedId) ;
|
|
3094
|
+
|
|
3095
|
+
// 目前保持空对象,等待用户选择行数据
|
|
3096
|
+
},
|
|
2675
3097
|
async refreshTreeData() {
|
|
2676
3098
|
this.treeData = await this.requestTreeData();
|
|
2677
3099
|
const [defaultTreeNode = {}] = this.treeData;
|
|
@@ -2701,7 +3123,8 @@ var script$A = {
|
|
|
2701
3123
|
break;
|
|
2702
3124
|
case BUILT_IN_TRIGGER.ELE_MODAL_TABLE:
|
|
2703
3125
|
this.modalTableMeta = modeMeta;
|
|
2704
|
-
|
|
3126
|
+
// 将当前行的 record 数据传递给 modal table
|
|
3127
|
+
this.showModalTable(modeMeta, record);
|
|
2705
3128
|
break;
|
|
2706
3129
|
}
|
|
2707
3130
|
},
|
|
@@ -2740,13 +3163,24 @@ var script$A = {
|
|
|
2740
3163
|
},
|
|
2741
3164
|
setCurrentRowData(props = {}) {
|
|
2742
3165
|
this.currentRowData = props;
|
|
3166
|
+
if (this.model) {
|
|
3167
|
+
this.model.setCurrentRowData(props);
|
|
3168
|
+
} else {
|
|
3169
|
+
console.warn('Model not initialized, cannot setCurrentRowData in model');
|
|
3170
|
+
}
|
|
2743
3171
|
},
|
|
2744
3172
|
getCurrentRowData() {
|
|
2745
|
-
|
|
3173
|
+
if (this.model) {
|
|
3174
|
+
return this.model.getCurrentRowData();
|
|
3175
|
+
}
|
|
3176
|
+
console.warn('Model not initialized, getCurrentRowData returning local data');
|
|
3177
|
+
return this.currentRowData || {};
|
|
2746
3178
|
},
|
|
2747
|
-
cleanCurrentModelEffect() {
|
|
3179
|
+
cleanCurrentModelEffect(clearRowData = true) {
|
|
2748
3180
|
this.setCurrentTableSelection();
|
|
2749
|
-
|
|
3181
|
+
if (clearRowData) {
|
|
3182
|
+
this.setCurrentRowData({});
|
|
3183
|
+
}
|
|
2750
3184
|
},
|
|
2751
3185
|
[BUILT_IN_EVENT_NAMES.SUBMIT](props = {}) {
|
|
2752
3186
|
this.cleanCurrentModelEffect();
|
|
@@ -2756,7 +3190,6 @@ var script$A = {
|
|
|
2756
3190
|
const {
|
|
2757
3191
|
record = {}
|
|
2758
3192
|
} = props;
|
|
2759
|
-
this.currentRowData = record;
|
|
2760
3193
|
this.setCurrentRowData(record);
|
|
2761
3194
|
this.modalFormMeta = this.editMeta;
|
|
2762
3195
|
this.modalFormValue = true;
|
|
@@ -2774,21 +3207,48 @@ var script$A = {
|
|
|
2774
3207
|
}
|
|
2775
3208
|
this.modalFormValue = true;
|
|
2776
3209
|
},
|
|
2777
|
-
showModalTable(modeMeta = {}) {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
this.
|
|
3210
|
+
showModalTable(modeMeta = {}, record = null) {
|
|
3211
|
+
// 获取当前行数据并设置到共享命名空间
|
|
3212
|
+
const currentRowData = record || this.getCurrentRowData();
|
|
3213
|
+
if (this.model) {
|
|
3214
|
+
this.model.setSharedData(currentRowData);
|
|
2782
3215
|
} else {
|
|
2783
|
-
|
|
3216
|
+
console.warn('Model not initialized, cannot setSharedData');
|
|
3217
|
+
}
|
|
3218
|
+
let targetMeta = modeMeta;
|
|
3219
|
+
if (type.isStr(modeMeta)) {
|
|
3220
|
+
targetMeta = this.findMetaByKey(modeMeta);
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
// 解析 fieldMap 参数,使用完整的上下文包括 currentRowData
|
|
3224
|
+
if (targetMeta && targetMeta.fieldMap) {
|
|
3225
|
+
const {
|
|
3226
|
+
fieldMap,
|
|
3227
|
+
params = {}
|
|
3228
|
+
} = targetMeta;
|
|
3229
|
+
const ctx = {
|
|
3230
|
+
...this.currentTreeNodeData,
|
|
3231
|
+
_route: this.$route.query,
|
|
3232
|
+
...currentRowData
|
|
3233
|
+
};
|
|
3234
|
+
const parsedParams = parseFieldMap(fieldMap, ctx);
|
|
3235
|
+
|
|
3236
|
+
// 将当前的 currentRowData 传递给 modal table,通过 params
|
|
3237
|
+
targetMeta = {
|
|
3238
|
+
...targetMeta,
|
|
3239
|
+
params: {
|
|
3240
|
+
...params,
|
|
3241
|
+
...parsedParams
|
|
3242
|
+
}
|
|
3243
|
+
};
|
|
2784
3244
|
}
|
|
3245
|
+
this.modalTableMeta = targetMeta;
|
|
2785
3246
|
this.modalTableValue = true;
|
|
2786
3247
|
},
|
|
2787
3248
|
closeModalForm() {
|
|
2788
3249
|
this.modalFormValue = false;
|
|
2789
3250
|
},
|
|
2790
3251
|
closeModalTable() {
|
|
2791
|
-
console.log('closeModalTable');
|
|
2792
3252
|
this.modalTableValue = false;
|
|
2793
3253
|
},
|
|
2794
3254
|
findMetaByKey(key) {
|
|
@@ -2811,13 +3271,6 @@ var script$A = {
|
|
|
2811
3271
|
currentTreeNode: this.currentTreeNodeData
|
|
2812
3272
|
});
|
|
2813
3273
|
},
|
|
2814
|
-
watchViewPort() {
|
|
2815
|
-
const modelTableWrapper = this.$refs[this.modelTableWrapper];
|
|
2816
|
-
const {
|
|
2817
|
-
top
|
|
2818
|
-
} = modelTableWrapper.getBoundingClientRect();
|
|
2819
|
-
this.$refs[this.modelTreeWrapper].style.height = `calc(100vh - ${top}px)`;
|
|
2820
|
-
},
|
|
2821
3274
|
async onSearch(props) {
|
|
2822
3275
|
const {
|
|
2823
3276
|
overrideInit = false
|
|
@@ -2828,6 +3281,10 @@ var script$A = {
|
|
|
2828
3281
|
...this.exposed
|
|
2829
3282
|
});
|
|
2830
3283
|
} else {
|
|
3284
|
+
const {
|
|
3285
|
+
initSearch = false
|
|
3286
|
+
} = props;
|
|
3287
|
+
if (this.showTree && initSearch) return;
|
|
2831
3288
|
this.tableData = await this.requestTableData();
|
|
2832
3289
|
}
|
|
2833
3290
|
},
|
|
@@ -2887,12 +3344,9 @@ var script$A = {
|
|
|
2887
3344
|
requestType = 'GET',
|
|
2888
3345
|
page = {}
|
|
2889
3346
|
} = this.tableMeta;
|
|
2890
|
-
const {
|
|
2891
|
-
pageSize = 10
|
|
2892
|
-
} = page;
|
|
2893
3347
|
this.tableQuerys = Object.assign(this.tableQuerys, {
|
|
2894
|
-
currentPage: 1,
|
|
2895
|
-
pageSize
|
|
3348
|
+
currentPage: this.tableQuerys.currentPage || 1,
|
|
3349
|
+
pageSize: this.tableQuerys.pageSize || 10
|
|
2896
3350
|
}, props);
|
|
2897
3351
|
this.$emit(RESERVE_EVENT_NAMES.WATCH, {
|
|
2898
3352
|
...this.exposed
|
|
@@ -2913,12 +3367,10 @@ var script$A = {
|
|
|
2913
3367
|
};
|
|
2914
3368
|
});
|
|
2915
3369
|
});
|
|
2916
|
-
this.cleanCurrentModelEffect();
|
|
3370
|
+
this.cleanCurrentModelEffect(false); // 不清空 currentRowData,除非明确需要
|
|
2917
3371
|
this.tableData = ret;
|
|
2918
3372
|
return ret;
|
|
2919
3373
|
},
|
|
2920
|
-
refreshTreeStatus(props = {}) {},
|
|
2921
|
-
refreshTableStatus(props = {}) {},
|
|
2922
3374
|
calculateTableHeight() {
|
|
2923
3375
|
const currentViewportHeight = window.innerHeight;
|
|
2924
3376
|
const tableRef = this.$refs[this.tableRef];
|
|
@@ -2936,6 +3388,28 @@ var script$A = {
|
|
|
2936
3388
|
height
|
|
2937
3389
|
} = modelTableContainerRef.getBoundingClientRect();
|
|
2938
3390
|
this.treeWrapperHeight = height;
|
|
3391
|
+
},
|
|
3392
|
+
async keepAliveRefresh() {
|
|
3393
|
+
// 重新计算表格高度(应对窗口大小变化)
|
|
3394
|
+
this.$nextTick(() => {
|
|
3395
|
+
this.calculateTableHeight();
|
|
3396
|
+
if (this.showTree) {
|
|
3397
|
+
this.calculateTreeHeight();
|
|
3398
|
+
}
|
|
3399
|
+
});
|
|
3400
|
+
// 刷新列表数据
|
|
3401
|
+
const {
|
|
3402
|
+
overrideInit = false
|
|
3403
|
+
} = this.tableMeta;
|
|
3404
|
+
if (overrideInit) {
|
|
3405
|
+
// 如果使用自定义初始化模式,触发 INIT 事件
|
|
3406
|
+
this.$emit(RESERVE_EVENT_NAMES.INIT, {
|
|
3407
|
+
...this.exposed
|
|
3408
|
+
});
|
|
3409
|
+
} else {
|
|
3410
|
+
// 使用当前查询参数刷新表格数据
|
|
3411
|
+
await this.requestTableData(this.tableQuerys);
|
|
3412
|
+
}
|
|
2939
3413
|
}
|
|
2940
3414
|
},
|
|
2941
3415
|
mounted() {
|
|
@@ -2954,6 +3428,22 @@ var script$A = {
|
|
|
2954
3428
|
},
|
|
2955
3429
|
destroyed() {
|
|
2956
3430
|
this.resizeObserverModelTableWrapper.disconnect();
|
|
3431
|
+
if (this.model) {
|
|
3432
|
+
// 清理订阅
|
|
3433
|
+
if (this.unsubscribe) {
|
|
3434
|
+
this.unsubscribe();
|
|
3435
|
+
}
|
|
3436
|
+
if (this.unsubscribeShared) {
|
|
3437
|
+
this.unsubscribeShared();
|
|
3438
|
+
}
|
|
3439
|
+
// 清理模型数据
|
|
3440
|
+
if (this.model) {
|
|
3441
|
+
this.model.cleanup();
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
},
|
|
3445
|
+
async activated() {
|
|
3446
|
+
await this.keepAliveRefresh();
|
|
2957
3447
|
}
|
|
2958
3448
|
};
|
|
2959
3449
|
|
|
@@ -3147,11 +3637,11 @@ __vue_render__$A._withStripped = true;
|
|
|
3147
3637
|
/* style */
|
|
3148
3638
|
const __vue_inject_styles__$A = function (inject) {
|
|
3149
3639
|
if (!inject) return
|
|
3150
|
-
inject("data-v-34cddd52_0", { source: ".ele.model__tree-table[data-v-34cddd52] {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.ele.model__tree-table .model__tree-table--container .model__tree--wrapper[data-v-34cddd52] {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n}\n.ele.model__tree-table .model__table--container[data-v-34cddd52] {\n width: 100%;\n min-width: 0;\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--bar[data-v-34cddd52] {\n width: 100%;\n height: 8px;\n background: var(--idooel-primary-color);\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--text[data-v-34cddd52] {\n text-align: left;\n padding: 16px;\n font-size: 16px;\n font-weight: bold;\n background: #fff;\n border-bottom: 1px solid;\n border-color: var(--idoole-black-016);\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper[data-v-34cddd52] {\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .button-row__area[data-v-34cddd52] {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-top: 16px;\n padding-bottom: 8px;\n padding-right: 16px;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .g-table__wrapper .fsm[data-v-34cddd52] {\n cursor: pointer;\n color: var(--idooel-primary-color);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/models/tree-table-model/src/index.vue","index.vue"],"names":[],"mappings":"AAonBA;EACA,uBAAA;EACA,aAAA;EACA,mBAAA;EACA,WAAA;ACnnBA;ADqnBA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;EACA,aAAA;EACA,sBAAA;EACA,kBAAA;EACA,gBAAA;ACnnBA;ADsnBA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;ACpnBA;ADsnBA;EACA,WAAA;EACA,WAAA;EACA,uCAAA;EACA,2BAAA;EACA,4BAAA;ACpnBA;ADsnBA;EACA,gBAAA;EACA,aAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,wBAAA;EACA,qCAAA;ACpnBA;ADunBA;EACA,gBAAA;ACrnBA;ADsnBA;EACA,WAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8BAAA;EACA,iBAAA;EACA,mBAAA;EACA,mBAAA;ACpnBA;ADunBA;EACA,eAAA;EACA,kCAAA;ACrnBA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <section class=\"ele model__tree-table\">\n <section class=\"model__tree-table--container\" v-if=\"showTree\">\n <div class=\"model__tree--title\"></div>\n <section :ref=\"modelTreeWrapper\" class=\"model__tree--wrapper\" :style=\"{height: `${treeWrapperHeight}px`}\">\n <ele-tree\n :tree-data=\"treeData\"\n :defaultExpandedKeys=\"defaultExpandedKeys\"\n :defaultSelectedKeys=\"defaultSelectedKeys\"\n @select=\"selectTreeNode\"\n :replace-fields=\"mapFields\">\n </ele-tree>\n </section>\n </section>\n <section class=\"model__table--container\" :ref=\"modelTableContainerRef\">\n <div class=\"model__table--title\" v-if=\"title\">\n <template v-if=\"titleMode\">\n <div :class=\"[`model__table-title--${titleMode}`]\"></div>\n </template>\n <template v-else>\n <div class=\"model__table-title--text\">{{ title }}</div>\n </template>\n </div>\n <section :ref=\"modelTableWrapper\" class=\"model__table--wrapper\">\n <ele-search-area :ref=\"searchArea\" @search=\"onSearch\" :data-source=\"searchMeta.elements\"></ele-search-area>\n <div class=\"button-row__area\">\n <ele-button-group class=\"model-table__button-group\" v-on=\"overrideButtonGroupEvent\" :ref=\"buttonGroup\" @click=\"handleClickButtonGroup\" :data-source=\"getButtonGroupElements\"></ele-button-group>\n <slot name=\"tags\"></slot>\n <slot v-if=\"$slots['sub-center']\" name=\"sub-center\"></slot>\n </div>\n <ele-table\n v-on=\"overrideTableEvent\"\n :ref=\"tableRef\"\n :row-selection=\"rowSelection\"\n :loading=\"loading\" \n :columns=\"columns\"\n :total=\"total\"\n :x=\"x\"\n :y=\"y\"\n :bordered=\"setBorder\"\n :height=\"tableHeight\"\n :width=\"tableWidth\"\n :actions=\"actions\"\n :pageSize=\"pageSize\"\n :pageSizeOptions=\"pageSizeOptions\"\n :data-source=\"tableData\"\n @change-page=\"onChangePage\"\n ></ele-table>\n </section>\n </section>\n <ele-modal-form v-model=\"modalFormValue\" v-on=\"overrideModalFormEvent\" :meta=\"modalFormMeta\"></ele-modal-form>\n <ele-modal-fsm v-model=\"showFsmModal\" :contextProp=\"fsmContextProp\" :meta=\"fsmMeta\" @cancel=\"handleCloseFsmModal\"></ele-modal-fsm>\n <ele-modal-table\n :meta=\"modalTableMeta\"\n v-model=\"modalTableValue\"\n v-on=\"overrideModalTableEvent\"\n ></ele-modal-table>\n </section>\n</template>\n\n<script>\nimport { type, net, util } from '@idooel/shared'\nimport { v4 as uuidv4 } from 'uuid'\nimport { BUILT_IN_EVENT_NAMES, RESERVE_EVENT_NAMES, parseFieldMap, BUILT_IN_TRIGGER, CONTEXT } from '../../../utils'\nexport default {\n name: 'ele-tree-table-model',\n props: {\n title: {\n type: [Object, String]\n },\n overHeight: {\n type: Number,\n default: 0\n },\n treeMeta: {\n type: Object,\n default: () => ({})\n },\n searchMeta: {\n type: Object,\n default: () => ({})\n },\n buttonGroupMeta: {\n typeof: Object,\n default: () => ({})\n },\n tableMeta: {\n type: Object,\n default: () => ({})\n },\n createMeta: {\n type: Object\n },\n editMeta: {\n type: Object\n }\n },\n provide () {\n return {\n requestTreeData: this.requestTreeData,\n requestTableData: this.requestTableData,\n [CONTEXT]: () => {\n return {\n exposed: this.exposed\n }\n }\n }\n },\n data () {\n return {\n tableHeight: 0,\n tableWidth: 0,\n modalFormMeta: {},\n modalFormValue: false,\n treeData: [],\n tableData: [],\n defaultExpandedKeys: [],\n defaultSelectedKeys: [],\n replaceFields: {\n title: 'title',\n children: 'children',\n key: 'id'\n },\n loading: false,\n total: 0,\n tableQuerys: {},\n resizeObserverModelTableWrapper: null,\n modelTableWrapperHeight: 0,\n currentTreeNodeData: {},\n currentRowData: {},\n treeWrapperHeight: 0,\n currentTableSelection: this.currentTableMode == 'radio' ? {} : [],\n showFsmModal: false,\n fsmMeta: {},\n fsmContextProp: {},\n modalTableValue: false,\n modalTableMeta: {}\n }\n },\n computed: {\n setBorder () {\n return this.tableMeta.bordered === false ? false : true\n },\n rowSelection () {\n if (!this.currentTableMode) return void 0\n return {\n columnTitle: this.currentSelectionColumn.columnTitle,\n fixed: true,\n type: this.currentTableMode,\n onChange: this.onChangeTableSelection\n }\n },\n currentSelectionColumn () {\n const { multiple } = this.tableMeta\n const target = this.columns.find(item => Object.keys(item).includes('multiple'))\n const isGlobalExistMultiple = Object.keys(this.tableMeta).includes('multiple')\n if (target) {\n return target\n } else if (isGlobalExistMultiple) {\n return { multiple }\n }\n return void 0\n },\n x () {\n const { x } = this.tableMeta\n return x\n },\n y () {\n const { y } = this.tableMeta\n return y\n },\n currentTableMode () {\n if (!this.currentSelectionColumn) return void 0\n const { multiple } = this.currentSelectionColumn\n if (type.isBool(multiple)) {\n if (multiple) {\n return 'checkbox'\n } else {\n return 'radio'\n }\n } else {\n return void 0\n }\n },\n modelTableContainerRef () {\n return uuidv4()\n },\n titleMode () {\n if (type.isObject(this.title)) {\n const { mode = '' } = this.title\n return mode\n }\n return void 0\n },\n tableRef () {\n return uuidv4()\n },\n exposed () {\n return {\n showModalForm: this.showModalForm,\n closeModalForm: this.closeModalForm,\n showModalTable: this.showModalTable,\n closeModalTable: this.closeModalTable,\n currentTableSelection: this.currentTableSelection,\n currentTreeNode: this.currentTreeNodeData,\n requestTableData: this.requestTableData,\n refreshTreeData: this.refreshTreeData,\n querys: this.tableQuerys,\n currentRowData: this.currentRowData,\n getCurrentRowData: this.getCurrentRowData,\n setCurrentRowData: this.setCurrentRowData,\n setCurrentTableSelection: this.setCurrentTableSelection,\n getCurrentTableSelection: this.getCurrentTableSelection,\n cleanCurrentModelEffect: this.cleanCurrentModelEffect,\n route: this.$route,\n _route: this.$route.query,\n _routeMeta: this.$route.meta\n }\n },\n overrideTableEvent () {\n const events = this.actions.reduce((ret, action) => {\n ret[action.eventName || action.key] = (e) => {\n this.setCurrentRowData(e.exposed.currentRowData)\n const { target } = action\n const targetMeta = this.findMetaByKey(target)\n const { mode } = targetMeta\n mode && this.dispatchTrigger({ mode, record: e.exposed.currentRowData, modeMeta: targetMeta })\n this.$emit(action.eventName || action.key, { ...e, currentTreeNode: this.currentTreeNodeData, exposed: { ...this.exposed, ...e.exposed } })\n }\n return ret\n }, {})\n return {\n ...this.$listeners,\n ...events,\n [BUILT_IN_EVENT_NAMES.EDIT]: this[BUILT_IN_EVENT_NAMES.EDIT],\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT]\n }\n },\n overrideModalFormEvent () {\n const { footerMeta } = this.modalFormMeta\n const { elements = [] } = footerMeta || {}\n const eles = type.isFunction(elements) ? elements.call(this) : elements\n const events = eles.reduce((ret, ele) => {\n ret[ele.eventName] = (e = {}) => {\n if (ele.eventName === 'cancel') {\n this.closeModalForm()\n } else {\n const { exposed = {} } = e\n this.$emit(`${ele.eventName || ele.key}`, { ...e, currentTreeNode: this.currentTreeNodeData, exposed: Object.assign({}, exposed )})\n }\n }\n return ret\n }, {})\n return {\n ...events\n }\n },\n overrideModalTableEvent () {\n const { footerMeta } = this.modalTableMeta\n const { elements = [] } = footerMeta || {}\n const eles = type.isFunction(elements) ? elements.call(this) : elements\n const events = eles.reduce((ret, ele) => {\n ret[ele.eventName] = (e = {}) => {\n if (ele.eventName === 'cancel') {\n this.closeModalTable()\n } else {\n const { exposed = {} } = e\n this.$emit(`${ele.eventName || ele.key}`, { ...e, currentTreeNode: this.currentTreeNodeData, exposed: Object.assign({}, exposed )})\n }\n }\n return ret\n }, {})\n return {\n ...events,\n exposed: this.exposed\n }\n },\n overrideButtonGroupEvent () {\n const events = this.getButtonGroupElements.reduce((ret, ele) => {\n ret[ele.eventName] = (e) => {\n this.$emit(ele.eventName || 'click', { ...e, currentTreeNode: this.currentTreeNodeData, exposed: Object.assign({}, e.exposed || {}, this.exposed)})\n }\n return ret\n }, {})\n return {\n ...this.$listeners,\n ...events,\n [BUILT_IN_EVENT_NAMES.CREATE]: this[BUILT_IN_EVENT_NAMES.CREATE],\n exposed: this.exposed\n }\n },\n showTree () {\n return !!Object.keys(this.treeMeta).length\n },\n buttonGroup () {\n return uuidv4()\n },\n searchArea () {\n return uuidv4()\n },\n modelTreeWrapper () {\n return uuidv4()\n },\n modelTableWrapper () {\n return uuidv4()\n },\n actions () {\n const { operations } = this.tableMeta\n if (operations) {\n return operations.elements\n } else {\n return []\n }\n },\n pageSize () {\n const { page = {} } = this.tableMeta\n return page.pageSize || 10\n },\n pageSizeOptions () {\n const { page = {} } = this.tableMeta\n return page.pageSizeOptions || ['10', '20', '30', '40']\n },\n columns () {\n const { columns, operations } = this.tableMeta\n if (type.get(columns) === 'array') {\n const columnsOptions = columns.map(item => {\n const { mode = 'text' } = item\n if (item.render) {\n return {\n ...item,\n customRender: (text, record, index) => {\n const { $createElement } = this\n return item.render.call(this, \n { h: $createElement, ctx: this },\n text ? typeof text == 'object' ? text[item.dataIndex] : text : '', \n record, index)\n }\n }\n } else if (mode !== BUILT_IN_TRIGGER.TEXT) {\n const { [`${mode}Meta`]: modeMeta } = item\n return {\n ...item,\n customRender: (text, record, index) => {\n return <span onClick={() => this.dispatchTrigger({ mode, record, modeMeta, index })} class={ mode }>{ text }</span>\n }\n }\n }\n return {\n ...item\n }\n })\n if (operations) {\n return [\n ...columnsOptions,\n {\n title: '操作',\n width: operations.width,\n key: 'action',\n fixed: 'right',\n scopedSlots: { customRender: 'action' }\n }\n ]\n }\n return columnsOptions\n } else {\n console.error('Error: columns is invalid, please check it')\n return []\n }\n },\n getButtonGroupElements () {\n const { elements } = this.buttonGroupMeta\n if (type.get(elements) === 'function') {\n return elements.call(this)\n } else if (type.get(elements) === 'array') {\n return elements\n } else {\n return []\n }\n },\n mapFields () {\n const { replaceFields = {} } = this.treeMeta\n const mapFields = type.isEmpty(replaceFields) ? this.replaceFields : replaceFields\n return mapFields\n }\n },\n async created () {\n if (this.showTree) {\n this.treeData = await this.requestTreeData()\n const [defaultTreeNode = {}] = this.treeData\n this.defaultExpandedKeys = [defaultTreeNode[this.mapFields.key]]\n this.defaultSelectedKeys = [defaultTreeNode[this.mapFields.key]]\n this.currentTreeNodeData = defaultTreeNode\n }\n const { params = {}, fieldMap = {}, overrideInit = false } = this.tableMeta\n const ctx = { ...this.currentTreeNodeData, _route: this.$route.query }\n const initQuerys = Object.assign({}, params, parseFieldMap(fieldMap, ctx))\n if (overrideInit) {\n this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })\n } else {\n this.tableData = await this.requestTableData(initQuerys)\n }\n },\n methods: {\n async refreshTreeData () {\n this.treeData = await this.requestTreeData()\n const [defaultTreeNode = {}] = this.treeData\n this.defaultExpandedKeys = [defaultTreeNode[this.mapFields.key]]\n this.defaultSelectedKeys = [defaultTreeNode[this.mapFields.key]]\n this.currentTreeNodeData = defaultTreeNode\n },\n dispatchTrigger ({ mode, record = {}, modeMeta = { } }) {\n switch (mode) {\n case BUILT_IN_TRIGGER.FSM:\n this[`${BUILT_IN_TRIGGER.FSM}Trigger`](record, modeMeta = type.isEmpty(modeMeta) ? { \n url: 'api-fsm/workbench/fsm/auditFlow',\n requestType: 'GET',\n fieldMap: {\n modelCode: 'modelCode',\n businessId: 'businessId'\n }\n } : modeMeta)\n break\n case BUILT_IN_TRIGGER.ELE_MODAL_FORM:\n this.modalFormMeta = modeMeta\n this.showModalForm(modeMeta)\n break\n case BUILT_IN_TRIGGER.ELE_MODAL_TABLE:\n this.modalTableMeta = modeMeta\n this.showModalTable(modeMeta)\n break\n default:\n break\n }\n },\n handleCloseFsmModal () {\n this.showFsmModal = false\n },\n [`${BUILT_IN_TRIGGER.FSM}Trigger`] (record, meta) {\n this.fsmMeta = meta\n this.fsmContextProp = record\n this.showFsmModal = true\n },\n onChangeTableSelection (_, selectedRows = []) {\n if (this.currentTableMode === 'radio') {\n this.setCurrentTableSelection(selectedRows)\n this.$emit('on-change-table-selection', this.currentTableSelection)\n this.$emit('x:refresh-exposed', { exposed: this.exposed })\n } else {\n this.setCurrentTableSelection(selectedRows)\n this.$emit('on-change-table-selection', this.currentTableSelection)\n this.$emit('x:refresh-exposed', { exposed: this.exposed })\n }\n },\n setCurrentTableSelection (props = {}) {\n if (this.currentTableMode === 'radio') {\n this.$set(this, 'currentTableSelection', (type.isArray(props) && props.length > 0) ? props[0] : type.isObject(props) ? props : {})\n } else {\n this.$set(this, 'currentTableSelection', type.isArray(props) ? props : [])\n }\n },\n getCurrentTableSelection () {\n return this.currentTableSelection\n },\n setCurrentRowData (props = {}) {\n this.currentRowData = props\n },\n getCurrentRowData () {\n return this.currentRowData\n },\n cleanCurrentModelEffect () {\n this.setCurrentTableSelection()\n this.setCurrentRowData({})\n },\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props = {}) {\n this.cleanCurrentModelEffect()\n this.requestTableData()\n },\n [BUILT_IN_EVENT_NAMES.EDIT] (props = {}) {\n const { record = {} } = props\n this.currentRowData = record\n this.setCurrentRowData(record)\n this.modalFormMeta = this.editMeta\n this.modalFormValue = true\n },\n [BUILT_IN_EVENT_NAMES.CREATE] () {\n this.modalFormMeta = this.createMeta\n this.modalFormValue = true\n },\n showModalForm (modeMeta = {}) {\n if (type.isStr(modeMeta)) {\n const targetMeta = this.findMetaByKey(modeMeta)\n this.modalFormMeta = targetMeta\n } else {\n this.modalFormMeta = modeMeta\n }\n this.modalFormValue = true\n },\n showModalTable (modeMeta = {}) {\n console.log('showModalTable', modeMeta)\n if (type.isStr(modeMeta)) {\n const targetMeta = this.findMetaByKey(modeMeta)\n this.modalTableMeta = targetMeta\n } else {\n this.modalTableMeta = modeMeta\n }\n this.modalTableValue = true\n },\n closeModalForm () {\n this.modalFormValue = false\n },\n closeModalTable () {\n console.log('closeModalTable')\n this.modalTableValue = false\n },\n findMetaByKey (key) {\n return this.$attrs[key] || {}\n },\n handleClickButtonGroup (props) {\n const { eventName, target } = props\n const targetMeta = this.findMetaByKey(target)\n const { mode } = targetMeta\n mode && this.dispatchTrigger({ mode, modeMeta: targetMeta })\n this.$emit(eventName || 'click', { currentTreeNode: this.currentTreeNodeData })\n },\n watchViewPort () {\n const modelTableWrapper = this.$refs[this.modelTableWrapper]\n const { top } = modelTableWrapper.getBoundingClientRect()\n this.$refs[this.modelTreeWrapper].style.height = `calc(100vh - ${top}px)`\n },\n async onSearch (props) {\n const { overrideInit = false } = this.tableMeta\n this.tableQuerys = Object.assign(this.tableQuerys, props)\n if (overrideInit) {\n this.$emit(RESERVE_EVENT_NAMES.TREE_CHANGE, { ...this.exposed })\n } else {\n this.tableData = await this.requestTableData()\n }\n },\n async selectTreeNode (selectedKeys, e) {\n const { fieldMap } = this.tableMeta\n this.currentTreeNodeData = e.node.$vnode.data.props.dataRef || {}\n //@deprecated '_' namespace is deprecated, please use 'exposed' instead\n const execFieldMapRet = parseFieldMap(fieldMap, { ...this.currentTreeNodeData, exposed: this.exposed, _route: this.exposed._route })\n const { overrideInit = false } = this.tableMeta\n if (overrideInit) {\n this.$emit(RESERVE_EVENT_NAMES.TREE_CHANGE, { ...this.exposed })\n } else {\n this.tableData = await this.requestTableData(execFieldMapRet)\n }\n },\n async requestTreeData () {\n const { url, requestType = 'GET', params = {}, fieldMap = {} } = this.treeMeta\n const fieldMapRet = parseFieldMap(fieldMap, { ...this.currentTreeNodeData, _route: this.$route.query })\n const ret = await net[requestType.toLowerCase()](\n url,\n { ...params, ...fieldMapRet }\n ).then(resp => {\n const { data } = resp || {}\n return data\n })\n return ret\n },\n async onChangePage (page, pageSize) {\n this.tableData = await this.requestTableData({ currentPage: page, pageSize })\n },\n async requestTableData (props = {}) {\n const { url, requestType = 'GET', page = {} } = this.tableMeta\n const { pageSize = 10 } = page\n this.tableQuerys = Object.assign(this.tableQuerys, { currentPage: 1, pageSize }, props)\n this.$emit(RESERVE_EVENT_NAMES.WATCH, { ...this.exposed })\n this.loading = true\n const ret = await net[requestType.toLowerCase()](\n url,\n this.tableQuerys\n ).then(resp => {\n const { data = [], count } = resp || {}\n this.total = count\n this.loading = false\n return (data || []).map(item => {\n delete item.children\n return {\n key: uuidv4(),\n ...item\n }\n })\n })\n this.cleanCurrentModelEffect()\n this.tableData = ret\n return ret\n },\n refreshTreeStatus (props = {}) {},\n refreshTableStatus (props = {}) {},\n calculateTableHeight () {\n const currentViewportHeight = window.innerHeight\n const tableRef = this.$refs[this.tableRef]\n const { top: tableToTop, width } = tableRef.$el.getBoundingClientRect()\n this.tableWidth = width\n this.tableHeight = currentViewportHeight - tableToTop - this.overHeight\n },\n calculateTreeHeight () {\n if (!this.showTree) return\n const modelTableContainerRef = this.$refs[this.modelTableContainerRef]\n const { height } = modelTableContainerRef.getBoundingClientRect()\n this.treeWrapperHeight = height\n }\n },\n mounted () {\n this.calculateTableHeight()\n this.$nextTick(() => {\n this.calculateTreeHeight()\n })\n this.resizeObserverModelTableWrapper = new ResizeObserver(entries => {\n for (const _ of entries) {\n requestAnimationFrame(() => {\n this.calculateTableHeight()\n })\n }\n })\n this.resizeObserverModelTableWrapper.observe(this.$refs[this.modelTableWrapper])\n },\n destroyed () {\n this.resizeObserverModelTableWrapper.disconnect()\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.ele {\n &.model__tree-table {\n background: transparent; \n display: flex;\n flex-direction: row;\n width: 100%;\n .model__tree-table--container {\n .model__tree--wrapper {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n }\n }\n .model__table--container {\n width: 100%;\n min-width: 0;\n background: #fff;\n .model__table--title {\n .model__table-title--bar {\n width: 100%;\n height: 8px;\n background: var(--idooel-primary-color);\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n .model__table-title--text {\n text-align: left;\n padding: 16px;\n font-size: 16px;\n font-weight: bold;\n background: #fff;\n border-bottom: 1px solid;\n border-color: var(--idoole-black-016);\n }\n }\n .model__table--wrapper {\n background: #fff;\n .button-row__area {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-top: 16px;\n padding-bottom: 8px;\n padding-right: 16px;\n }\n .g-table__wrapper {\n .fsm {\n cursor: pointer;\n color: var(--idooel-primary-color);\n }\n }\n }\n }\n }\n}\n</style>\n",".ele.model__tree-table {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.ele.model__tree-table .model__tree-table--container .model__tree--wrapper {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n}\n.ele.model__tree-table .model__table--container {\n width: 100%;\n min-width: 0;\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--bar {\n width: 100%;\n height: 8px;\n background: var(--idooel-primary-color);\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--text {\n text-align: left;\n padding: 16px;\n font-size: 16px;\n font-weight: bold;\n background: #fff;\n border-bottom: 1px solid;\n border-color: var(--idoole-black-016);\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper {\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .button-row__area {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-top: 16px;\n padding-bottom: 8px;\n padding-right: 16px;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .g-table__wrapper .fsm {\n cursor: pointer;\n color: var(--idooel-primary-color);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
3640
|
+
inject("data-v-46075027_0", { source: ".ele.model__tree-table[data-v-46075027] {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.ele.model__tree-table .model__tree-table--container .model__tree--wrapper[data-v-46075027] {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n}\n.ele.model__tree-table .model__table--container[data-v-46075027] {\n width: 100%;\n min-width: 0;\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--bar[data-v-46075027] {\n width: 100%;\n height: 8px;\n background: var(--idooel-primary-color);\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--text[data-v-46075027] {\n text-align: left;\n padding: 16px;\n font-size: 16px;\n font-weight: bold;\n background: #fff;\n border-bottom: 1px solid;\n border-color: var(--idoole-black-016);\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper[data-v-46075027] {\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .button-row__area[data-v-46075027] {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-top: 16px;\n padding-bottom: 8px;\n padding-right: 16px;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .g-table__wrapper .fsm[data-v-46075027] {\n cursor: pointer;\n color: var(--idooel-primary-color);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\models\\tree-table-model\\src\\index.vue","index.vue"],"names":[],"mappings":"AAiwBA;EACA,uBAAA;EACA,aAAA;EACA,mBAAA;EACA,WAAA;AChwBA;ADkwBA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;EACA,aAAA;EACA,sBAAA;EACA,kBAAA;EACA,gBAAA;AChwBA;ADmwBA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;ACjwBA;ADmwBA;EACA,WAAA;EACA,WAAA;EACA,uCAAA;EACA,2BAAA;EACA,4BAAA;ACjwBA;ADmwBA;EACA,gBAAA;EACA,aAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,wBAAA;EACA,qCAAA;ACjwBA;ADowBA;EACA,gBAAA;AClwBA;ADmwBA;EACA,WAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8BAAA;EACA,iBAAA;EACA,mBAAA;EACA,mBAAA;ACjwBA;ADowBA;EACA,eAAA;EACA,kCAAA;AClwBA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <section class=\"ele model__tree-table\">\r\n <section class=\"model__tree-table--container\" v-if=\"showTree\">\r\n <div class=\"model__tree--title\"></div>\r\n <section :ref=\"modelTreeWrapper\" class=\"model__tree--wrapper\" :style=\"{height: `${treeWrapperHeight}px`}\">\r\n <ele-tree\r\n :tree-data=\"treeData\"\r\n :defaultExpandedKeys=\"defaultExpandedKeys\"\r\n :defaultSelectedKeys=\"defaultSelectedKeys\"\r\n @select=\"selectTreeNode\"\r\n :replace-fields=\"mapFields\">\r\n </ele-tree>\r\n </section>\r\n </section>\r\n <section class=\"model__table--container\" :ref=\"modelTableContainerRef\">\r\n <div class=\"model__table--title\" v-if=\"title\">\r\n <template v-if=\"titleMode\">\r\n <div :class=\"[`model__table-title--${titleMode}`]\"></div>\r\n </template>\r\n <template v-else>\r\n <div class=\"model__table-title--text\">{{ title }}</div>\r\n </template>\r\n </div>\r\n <section :ref=\"modelTableWrapper\" class=\"model__table--wrapper\">\r\n <ele-search-area :ref=\"searchArea\" @search=\"onSearch\" :data-source=\"searchMeta.elements\"></ele-search-area>\r\n <div class=\"button-row__area\">\r\n <ele-button-group class=\"model-table__button-group\" v-on=\"overrideButtonGroupEvent\" :ref=\"buttonGroup\" @click=\"handleClickButtonGroup\" :data-source=\"getButtonGroupElements\"></ele-button-group>\r\n <slot name=\"tags\"></slot>\r\n <slot v-if=\"$slots['sub-center']\" name=\"sub-center\"></slot>\r\n </div>\r\n <ele-table\r\n v-on=\"overrideTableEvent\"\r\n :ref=\"tableRef\"\r\n :row-selection=\"rowSelection\"\r\n :loading=\"loading\" \r\n :columns=\"columns\"\r\n :total=\"total\"\r\n :x=\"x\"\r\n :y=\"y\"\r\n :bordered=\"setBorder\"\r\n :height=\"tableHeight\"\r\n :width=\"tableWidth\"\r\n :actions=\"actions\"\r\n :pageSize=\"pageSize\"\r\n :pageSizeOptions=\"pageSizeOptions\"\r\n :data-source=\"tableData\"\r\n @change-page=\"onChangePage\"\r\n ></ele-table>\r\n </section>\r\n </section>\r\n <ele-modal-form v-model=\"modalFormValue\" v-on=\"overrideModalFormEvent\" :meta=\"modalFormMeta\"></ele-modal-form>\r\n <ele-modal-fsm v-model=\"showFsmModal\" :contextProp=\"fsmContextProp\" :meta=\"fsmMeta\" @cancel=\"handleCloseFsmModal\"></ele-modal-fsm>\r\n <ele-modal-table\r\n :meta=\"modalTableMeta\"\r\n v-model=\"modalTableValue\"\r\n v-on=\"overrideModalTableEvent\"\r\n ></ele-modal-table>\r\n </section>\r\n</template>\r\n\r\n<script>\r\nimport { type, net } from '@idooel/shared'\r\nimport { v4 as uuidv4 } from 'uuid'\r\nimport { BUILT_IN_EVENT_NAMES, RESERVE_EVENT_NAMES, parseFieldMap, BUILT_IN_TRIGGER, CONTEXT } from '../../../utils'\r\nimport { createTreeTableModel } from '../../../utils/runtime-context'\r\nexport default {\r\n name: 'ele-tree-table-model',\r\n props: {\r\n title: {\r\n type: [Object, String]\r\n },\r\n overHeight: {\r\n type: Number,\r\n default: 0\r\n },\r\n treeMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n searchMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n buttonGroupMeta: {\r\n typeof: Object,\r\n default: () => ({})\r\n },\r\n tableMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n createMeta: {\r\n type: Object\r\n },\r\n editMeta: {\r\n type: Object\r\n }\r\n },\r\n provide () {\r\n return {\r\n requestTreeData: this.requestTreeData,\r\n requestTableData: this.requestTableData,\r\n keepAliveRefresh: this.keepAliveRefresh,\r\n [CONTEXT]: () => {\r\n return {\r\n exposed: this.exposed\r\n }\r\n }\r\n }\r\n },\r\n data () {\r\n return {\r\n tableHeight: 0,\r\n tableWidth: 0,\r\n modalFormMeta: {},\r\n modalFormValue: false,\r\n treeData: [],\r\n tableData: [],\r\n defaultExpandedKeys: [],\r\n defaultSelectedKeys: [],\r\n replaceFields: {\r\n title: 'title',\r\n children: 'children',\r\n key: 'id'\r\n },\r\n loading: false,\r\n total: 0,\r\n tableQuerys: {},\r\n resizeObserverModelTableWrapper: null,\r\n modelTableWrapperHeight: 0,\r\n currentTreeNodeData: {},\r\n currentRowData: {},\r\n treeWrapperHeight: 0,\r\n currentTableSelection: this.currentTableMode == 'radio' ? {} : [],\r\n showFsmModal: false,\r\n fsmMeta: {},\r\n fsmContextProp: {},\r\n modalTableValue: false,\r\n modalTableMeta: {},\r\n dataPoolManager: null\r\n }\r\n },\r\n computed: {\r\n setBorder () {\r\n return this.tableMeta.bordered === false ? false : true\r\n },\r\n rowSelection () {\r\n if (!this.currentTableMode) return void 0\r\n return {\r\n columnTitle: this.currentSelectionColumn.columnTitle,\r\n fixed: true,\r\n type: this.currentTableMode,\r\n onChange: this.onChangeTableSelection\r\n }\r\n },\r\n currentSelectionColumn () {\r\n const { multiple } = this.tableMeta\r\n const target = this.columns.find(item => Object.keys(item).includes('multiple'))\r\n const isGlobalExistMultiple = Object.keys(this.tableMeta).includes('multiple')\r\n if (target) {\r\n return target\r\n } else if (isGlobalExistMultiple) {\r\n return { multiple }\r\n }\r\n return void 0\r\n },\r\n x () {\r\n const { x } = this.tableMeta\r\n return x\r\n },\r\n y () {\r\n const { y } = this.tableMeta\r\n return y\r\n },\r\n currentTableMode () {\r\n if (!this.currentSelectionColumn) return void 0\r\n const { multiple } = this.currentSelectionColumn\r\n if (type.isBool(multiple)) {\r\n if (multiple) {\r\n return 'checkbox'\r\n } else {\r\n return 'radio'\r\n }\r\n } else {\r\n return void 0\r\n }\r\n },\r\n modelTableContainerRef () {\r\n return uuidv4()\r\n },\r\n titleMode () {\r\n if (type.isObject(this.title)) {\r\n const { mode = '' } = this.title\r\n return mode\r\n }\r\n return void 0\r\n },\r\n tableRef () {\r\n return uuidv4()\r\n },\r\n exposed () {\r\n return {\r\n showModalForm: this.showModalForm,\r\n closeModalForm: this.closeModalForm,\r\n showModalTable: this.showModalTable,\r\n closeModalTable: this.closeModalTable,\r\n currentTableSelection: this.currentTableSelection,\r\n currentTreeNode: this.currentTreeNodeData,\r\n requestTableData: this.requestTableData,\r\n keepAliveRefresh: this.keepAliveRefresh,\r\n refreshTreeData: this.refreshTreeData,\r\n querys: this.tableQuerys,\r\n currentRowData: this.getCurrentRowData(),\r\n getCurrentRowData: this.getCurrentRowData,\r\n setCurrentRowData: this.setCurrentRowData,\r\n setCurrentTableSelection: this.setCurrentTableSelection,\r\n getCurrentTableSelection: this.getCurrentTableSelection,\r\n cleanCurrentModelEffect: this.cleanCurrentModelEffect,\r\n route: this.$route,\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta,\r\n dataPool: this.model ? this.model.getDataPool() : null,\r\n dataPoolManager: this.model || null\r\n }\r\n },\r\n overrideTableEvent () {\r\n const events = this.actions.reduce((ret, action) => {\r\n ret[action.eventName || action.key] = (e) => {\r\n this.setCurrentRowData(e.exposed.currentRowData)\r\n const { target } = action\r\n const targetMeta = this.findMetaByKey(target)\r\n const { mode } = targetMeta\r\n mode && this.dispatchTrigger({ mode, record: e.exposed.currentRowData, modeMeta: targetMeta })\r\n this.$emit(action.eventName || action.key, { ...e, currentTreeNode: this.currentTreeNodeData, exposed: { ...this.exposed, ...e.exposed } })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events,\r\n [BUILT_IN_EVENT_NAMES.EDIT]: this[BUILT_IN_EVENT_NAMES.EDIT],\r\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT]\r\n }\r\n },\r\n overrideModalFormEvent () {\r\n const { footerMeta } = this.modalFormMeta\r\n const { elements = [] } = footerMeta || {}\r\n const eles = type.isFunction(elements) ? elements.call(this) : elements\r\n const events = eles.reduce((ret, ele) => {\r\n ret[ele.eventName] = (e = {}) => {\r\n if (ele.eventName === 'cancel') {\r\n this.closeModalForm()\r\n } else {\r\n const { exposed = {} } = e\r\n this.$emit(`${ele.eventName || ele.key}`, { ...e, currentTreeNode: this.currentTreeNodeData, exposed: Object.assign({}, exposed )})\r\n }\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...events\r\n }\r\n },\r\n overrideModalTableEvent () {\r\n const { footerMeta } = this.modalTableMeta\r\n const { elements = [] } = footerMeta || {}\r\n const eles = type.isFunction(elements) ? elements.call(this) : elements\r\n const events = eles.reduce((ret, ele) => {\r\n ret[ele.eventName] = (e = {}) => {\r\n if (ele.eventName === 'cancel') {\r\n this.closeModalTable()\r\n } else {\r\n const { exposed = {} } = e\r\n this.$emit(`${ele.eventName || ele.key}`, { ...e, currentTreeNode: this.currentTreeNodeData, exposed: Object.assign({}, exposed )})\r\n }\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...events,\r\n exposed: this.exposed\r\n }\r\n },\r\n overrideButtonGroupEvent () {\r\n const events = this.getButtonGroupElements.reduce((ret, ele) => {\r\n ret[ele.eventName] = (e) => {\r\n this.$emit(ele.eventName || 'click', { ...e, currentTreeNode: this.currentTreeNodeData, exposed: Object.assign({}, e.exposed || {}, this.exposed)})\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events,\r\n [BUILT_IN_EVENT_NAMES.CREATE]: this[BUILT_IN_EVENT_NAMES.CREATE],\r\n exposed: this.exposed\r\n }\r\n },\r\n showTree () {\r\n return !!Object.keys(this.treeMeta).length\r\n },\r\n buttonGroup () {\r\n return uuidv4()\r\n },\r\n searchArea () {\r\n return uuidv4()\r\n },\r\n modelTreeWrapper () {\r\n return uuidv4()\r\n },\r\n modelTableWrapper () {\r\n return uuidv4()\r\n },\r\n actions () {\r\n const { operations } = this.tableMeta\r\n if (operations) {\r\n return operations.elements\r\n } else {\r\n return []\r\n }\r\n },\r\n pageSize () {\r\n const { page = {} } = this.tableMeta\r\n return page.pageSize || 10\r\n },\r\n pageSizeOptions () {\r\n const { page = {} } = this.tableMeta\r\n return page.pageSizeOptions || ['10', '20', '30', '40']\r\n },\r\n columns () {\r\n const { columns, operations } = this.tableMeta\r\n if (type.get(columns) === 'array') {\r\n const columnsOptions = columns.map(item => {\r\n const { mode = 'text' } = item\r\n if (item.render) {\r\n return {\r\n ...item,\r\n customRender: (text, record, index) => {\r\n const { $createElement } = this\r\n return item.render.call(this, \r\n { h: $createElement, ctx: this },\r\n text ? typeof text == 'object' ? text[item.dataIndex] : text : '', \r\n record, index)\r\n }\r\n }\r\n } else if (mode !== BUILT_IN_TRIGGER.TEXT) {\r\n const { [`${mode}Meta`]: modeMeta } = item\r\n return {\r\n ...item,\r\n customRender: (text, record, index) => {\r\n return <span onClick={() => this.dispatchTrigger({ mode, record, modeMeta, index })} class={ mode }>{ text }</span>\r\n }\r\n }\r\n }\r\n return {\r\n ...item\r\n }\r\n })\r\n if (operations) {\r\n return [\r\n ...columnsOptions,\r\n {\r\n title: '操作',\r\n width: operations.width,\r\n key: 'action',\r\n fixed: 'right',\r\n scopedSlots: { customRender: 'action' }\r\n }\r\n ]\r\n }\r\n return columnsOptions\r\n } else {\r\n console.error('Error: columns is invalid, please check it')\r\n return []\r\n }\r\n },\r\n getButtonGroupElements () {\r\n const { elements } = this.buttonGroupMeta\r\n if (type.get(elements) === 'function') {\r\n return elements.call(this)\r\n } else if (type.get(elements) === 'array') {\r\n return elements\r\n } else {\r\n return []\r\n }\r\n },\r\n mapFields () {\r\n const { replaceFields = {} } = this.treeMeta\r\n const mapFields = type.isEmpty(replaceFields) ? this.replaceFields : replaceFields\r\n return mapFields\r\n }\r\n },\r\n async created () {\r\n // onSearch会初始化请求表格数据,所以不需要在这里请求表格数据\r\n // 确保全局数据池已初始化\r\n if (!window.__idooel_data_pool__) {\r\n console.error('Global data pool not initialized. Please check if runtime-context/globalDataPool.js is properly imported.')\r\n return\r\n }\r\n \r\n // 初始化数据池管理器(使用新的 runtime-context)\r\n try {\r\n this.model = createTreeTableModel('treeTableModel')\r\n \r\n if (!this.model) {\r\n throw new Error('Failed to create tree table model')\r\n }\r\n } catch (error) {\r\n console.error('Error creating tree table model:', error)\r\n this.model = null\r\n return\r\n }\r\n \r\n // 初始化 currentRowData(尝试从共享命名空间获取)\r\n this.initializeCurrentRowData()\r\n \r\n // 订阅数据池变化\r\n this.unsubscribe = this.model.subscribe('currentRowData', (event) => {\r\n this.currentRowData = event.value || {}\r\n this.$forceUpdate()\r\n })\r\n \r\n // 订阅共享数据变化\r\n this.unsubscribeShared = this.model.subscribeShared((event) => {\r\n // 当有新的共享数据时,更新当前组件的 currentRowData\r\n if (event.value && Object.keys(event.value).length > 0) {\r\n this.setCurrentRowData(event.value)\r\n }\r\n })\r\n \r\n if (this.showTree) {\r\n this.treeData = await this.requestTreeData()\r\n const [defaultTreeNode = {}] = this.treeData\r\n this.defaultExpandedKeys = [defaultTreeNode[this.mapFields.key]]\r\n this.defaultSelectedKeys = [defaultTreeNode[this.mapFields.key]]\r\n this.currentTreeNodeData = defaultTreeNode\r\n const { params = {}, fieldMap = {}, overrideInit = false } = this.tableMeta\r\n const currentRowData = this.getCurrentRowData()\r\n const ctx = { \r\n ...this.currentTreeNodeData, \r\n _route: this.$route.query, \r\n currentRowData: currentRowData\r\n }\r\n \r\n const initQuerys = Object.assign({}, params, parseFieldMap(fieldMap, ctx))\r\n if (overrideInit) {\r\n this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })\r\n } else {\r\n this.tableData = await this.requestTableData(initQuerys)\r\n }\r\n }\r\n },\r\n methods: {\r\n initializeCurrentRowData () {\r\n if (!this.model) {\r\n console.warn('Model not initialized, skipping currentRowData initialization')\r\n return\r\n }\r\n \r\n // 检查是否有来自父组件的共享数据(比如 modal table 场景)\r\n const parentData = this.model.getSharedData()\r\n \r\n if (parentData && Object.keys(parentData).length > 0) {\r\n this.setCurrentRowData(parentData)\r\n return\r\n }\r\n \r\n // 可以根据路由参数、props 或其他来源设置初始的 currentRowData\r\n const { query } = this.$route\r\n \r\n // 示例:如果路由中有特定参数,可以设置为 currentRowData\r\n if (query.rowId || query.selectedId) {\r\n // 这里可以根据实际需求从服务端或其他地方获取数据\r\n // const presetData = { id: query.rowId, /* 其他字段 */ }\r\n // this.setCurrentRowData(presetData)\r\n }\r\n \r\n // 目前保持空对象,等待用户选择行数据\r\n },\r\n async refreshTreeData () {\r\n this.treeData = await this.requestTreeData()\r\n const [defaultTreeNode = {}] = this.treeData\r\n this.defaultExpandedKeys = [defaultTreeNode[this.mapFields.key]]\r\n this.defaultSelectedKeys = [defaultTreeNode[this.mapFields.key]]\r\n this.currentTreeNodeData = defaultTreeNode\r\n },\r\n dispatchTrigger ({ mode, record = {}, modeMeta = { } }) {\r\n switch (mode) {\r\n case BUILT_IN_TRIGGER.FSM:\r\n this[`${BUILT_IN_TRIGGER.FSM}Trigger`](record, modeMeta = type.isEmpty(modeMeta) ? { \r\n url: 'api-fsm/workbench/fsm/auditFlow',\r\n requestType: 'GET',\r\n fieldMap: {\r\n modelCode: 'modelCode',\r\n businessId: 'businessId'\r\n }\r\n } : modeMeta)\r\n break\r\n case BUILT_IN_TRIGGER.ELE_MODAL_FORM:\r\n this.modalFormMeta = modeMeta\r\n this.showModalForm(modeMeta)\r\n break\r\n case BUILT_IN_TRIGGER.ELE_MODAL_TABLE:\r\n this.modalTableMeta = modeMeta\r\n // 将当前行的 record 数据传递给 modal table\r\n this.showModalTable(modeMeta, record)\r\n break\r\n default:\r\n break\r\n }\r\n },\r\n handleCloseFsmModal () {\r\n this.showFsmModal = false\r\n },\r\n [`${BUILT_IN_TRIGGER.FSM}Trigger`] (record, meta) {\r\n this.fsmMeta = meta\r\n this.fsmContextProp = record\r\n this.showFsmModal = true\r\n },\r\n onChangeTableSelection (_, selectedRows = []) {\r\n if (this.currentTableMode === 'radio') {\r\n this.setCurrentTableSelection(selectedRows)\r\n this.$emit('on-change-table-selection', this.currentTableSelection)\r\n this.$emit('x:refresh-exposed', { exposed: this.exposed })\r\n } else {\r\n this.setCurrentTableSelection(selectedRows)\r\n this.$emit('on-change-table-selection', this.currentTableSelection)\r\n this.$emit('x:refresh-exposed', { exposed: this.exposed })\r\n }\r\n },\r\n setCurrentTableSelection (props = {}) {\r\n if (this.currentTableMode === 'radio') {\r\n this.$set(this, 'currentTableSelection', (type.isArray(props) && props.length > 0) ? props[0] : type.isObject(props) ? props : {})\r\n } else {\r\n this.$set(this, 'currentTableSelection', type.isArray(props) ? props : [])\r\n }\r\n },\r\n getCurrentTableSelection () {\r\n return this.currentTableSelection\r\n },\r\n setCurrentRowData (props = {}) {\r\n this.currentRowData = props\r\n if (this.model) {\r\n this.model.setCurrentRowData(props)\r\n } else {\r\n console.warn('Model not initialized, cannot setCurrentRowData in model')\r\n }\r\n },\r\n getCurrentRowData () {\r\n if (this.model) {\r\n return this.model.getCurrentRowData()\r\n }\r\n console.warn('Model not initialized, getCurrentRowData returning local data')\r\n return this.currentRowData || {}\r\n },\r\n cleanCurrentModelEffect (clearRowData = true) {\r\n this.setCurrentTableSelection()\r\n if (clearRowData) {\r\n this.setCurrentRowData({})\r\n }\r\n },\r\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props = {}) {\r\n this.cleanCurrentModelEffect()\r\n this.requestTableData()\r\n },\r\n [BUILT_IN_EVENT_NAMES.EDIT] (props = {}) {\r\n const { record = {} } = props\r\n this.setCurrentRowData(record)\r\n this.modalFormMeta = this.editMeta\r\n this.modalFormValue = true\r\n },\r\n [BUILT_IN_EVENT_NAMES.CREATE] () {\r\n this.modalFormMeta = this.createMeta\r\n this.modalFormValue = true\r\n },\r\n showModalForm (modeMeta = {}) {\r\n if (type.isStr(modeMeta)) {\r\n const targetMeta = this.findMetaByKey(modeMeta)\r\n this.modalFormMeta = targetMeta\r\n } else {\r\n this.modalFormMeta = modeMeta\r\n }\r\n this.modalFormValue = true\r\n },\r\n showModalTable (modeMeta = {}, record = null) {\r\n // 获取当前行数据并设置到共享命名空间\r\n const currentRowData = record || this.getCurrentRowData()\r\n if (this.model) {\r\n this.model.setSharedData(currentRowData)\r\n } else {\r\n console.warn('Model not initialized, cannot setSharedData')\r\n }\r\n \r\n let targetMeta = modeMeta\r\n if (type.isStr(modeMeta)) {\r\n targetMeta = this.findMetaByKey(modeMeta)\r\n }\r\n \r\n // 解析 fieldMap 参数,使用完整的上下文包括 currentRowData\r\n if (targetMeta && targetMeta.fieldMap) {\r\n const { fieldMap, params = {} } = targetMeta\r\n \r\n const ctx = { \r\n ...this.currentTreeNodeData, \r\n _route: this.$route.query, \r\n ...currentRowData \r\n }\r\n const parsedParams = parseFieldMap(fieldMap, ctx)\r\n \r\n // 将当前的 currentRowData 传递给 modal table,通过 params\r\n targetMeta = {\r\n ...targetMeta,\r\n params: {\r\n ...params,\r\n ...parsedParams\r\n }\r\n }\r\n }\r\n \r\n this.modalTableMeta = targetMeta\r\n this.modalTableValue = true\r\n },\r\n closeModalForm () {\r\n this.modalFormValue = false\r\n },\r\n closeModalTable () {\r\n this.modalTableValue = false\r\n },\r\n findMetaByKey (key) {\r\n return this.$attrs[key] || {}\r\n },\r\n handleClickButtonGroup (props) {\r\n const { eventName, target } = props\r\n const targetMeta = this.findMetaByKey(target)\r\n const { mode } = targetMeta\r\n mode && this.dispatchTrigger({ mode, modeMeta: targetMeta })\r\n this.$emit(eventName || 'click', { currentTreeNode: this.currentTreeNodeData })\r\n },\r\n async onSearch (props) {\r\n const { overrideInit = false } = this.tableMeta\r\n this.tableQuerys = Object.assign(this.tableQuerys, props)\r\n if (overrideInit) {\r\n this.$emit(RESERVE_EVENT_NAMES.TREE_CHANGE, { ...this.exposed })\r\n } else {\r\n const { initSearch = false } = props\r\n if (this.showTree && initSearch) return\r\n this.tableData = await this.requestTableData()\r\n }\r\n },\r\n async selectTreeNode (selectedKeys, e) {\r\n const { fieldMap } = this.tableMeta\r\n this.currentTreeNodeData = e.node.$vnode.data.props.dataRef || {}\r\n //@deprecated '_' namespace is deprecated, please use 'exposed' instead\r\n const execFieldMapRet = parseFieldMap(fieldMap, { ...this.currentTreeNodeData, exposed: this.exposed, _route: this.exposed._route })\r\n const { overrideInit = false } = this.tableMeta\r\n if (overrideInit) {\r\n this.$emit(RESERVE_EVENT_NAMES.TREE_CHANGE, { ...this.exposed })\r\n } else {\r\n this.tableData = await this.requestTableData(execFieldMapRet)\r\n }\r\n },\r\n async requestTreeData () {\r\n const { url, requestType = 'GET', params = {}, fieldMap = {} } = this.treeMeta\r\n const fieldMapRet = parseFieldMap(fieldMap, { ...this.currentTreeNodeData, _route: this.$route.query })\r\n const ret = await net[requestType.toLowerCase()](\r\n url,\r\n { ...params, ...fieldMapRet }\r\n ).then(resp => {\r\n const { data } = resp || {}\r\n return data\r\n })\r\n return ret\r\n },\r\n async onChangePage (page, pageSize) {\r\n this.tableData = await this.requestTableData({ currentPage: page, pageSize })\r\n },\r\n async requestTableData (props = {}) {\r\n const { url, requestType = 'GET', page = {} } = this.tableMeta\r\n this.tableQuerys = Object.assign(this.tableQuerys, { currentPage: this.tableQuerys.currentPage || 1, pageSize: this.tableQuerys.pageSize || 10 }, props)\r\n this.$emit(RESERVE_EVENT_NAMES.WATCH, { ...this.exposed })\r\n this.loading = true\r\n const ret = await net[requestType.toLowerCase()](\r\n url,\r\n this.tableQuerys\r\n ).then(resp => {\r\n const { data = [], count } = resp || {}\r\n this.total = count\r\n this.loading = false\r\n return (data || []).map(item => {\r\n delete item.children\r\n return {\r\n key: uuidv4(),\r\n ...item\r\n }\r\n })\r\n })\r\n this.cleanCurrentModelEffect(false) // 不清空 currentRowData,除非明确需要\r\n this.tableData = ret\r\n return ret\r\n },\r\n calculateTableHeight () {\r\n const currentViewportHeight = window.innerHeight\r\n const tableRef = this.$refs[this.tableRef]\r\n const { top: tableToTop, width } = tableRef.$el.getBoundingClientRect()\r\n this.tableWidth = width\r\n this.tableHeight = currentViewportHeight - tableToTop - this.overHeight\r\n },\r\n calculateTreeHeight () {\r\n if (!this.showTree) return\r\n const modelTableContainerRef = this.$refs[this.modelTableContainerRef]\r\n const { height } = modelTableContainerRef.getBoundingClientRect()\r\n this.treeWrapperHeight = height\r\n },\r\n async keepAliveRefresh () {\r\n // 重新计算表格高度(应对窗口大小变化)\r\n this.$nextTick(() => {\r\n this.calculateTableHeight()\r\n if (this.showTree) {\r\n this.calculateTreeHeight()\r\n }\r\n })\r\n // 刷新列表数据\r\n const { overrideInit = false } = this.tableMeta\r\n if (overrideInit) {\r\n // 如果使用自定义初始化模式,触发 INIT 事件\r\n this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })\r\n } else {\r\n // 使用当前查询参数刷新表格数据\r\n await this.requestTableData(this.tableQuerys)\r\n }\r\n }\r\n },\r\n mounted () {\r\n this.calculateTableHeight()\r\n this.$nextTick(() => {\r\n this.calculateTreeHeight()\r\n })\r\n this.resizeObserverModelTableWrapper = new ResizeObserver(entries => {\r\n for (const _ of entries) {\r\n requestAnimationFrame(() => {\r\n this.calculateTableHeight()\r\n })\r\n }\r\n })\r\n this.resizeObserverModelTableWrapper.observe(this.$refs[this.modelTableWrapper])\r\n },\r\n destroyed () {\r\n this.resizeObserverModelTableWrapper.disconnect()\r\n if (this.model) {\r\n // 清理订阅\r\n if (this.unsubscribe) {\r\n this.unsubscribe()\r\n }\r\n if (this.unsubscribeShared) {\r\n this.unsubscribeShared()\r\n }\r\n // 清理模型数据\r\n if (this.model) {\r\n this.model.cleanup()\r\n }\r\n }\r\n },\r\n async activated () {\r\n await this.keepAliveRefresh()\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele {\r\n &.model__tree-table {\r\n background: transparent; \r\n display: flex;\r\n flex-direction: row;\r\n width: 100%;\r\n .model__tree-table--container {\r\n .model__tree--wrapper {\r\n width: 240px;\r\n background: #fff;\r\n flex-shrink: 0;\r\n padding: 16px;\r\n box-sizing: border-box;\r\n margin-right: 16px;\r\n overflow-y: auto;\r\n }\r\n }\r\n .model__table--container {\r\n width: 100%;\r\n min-width: 0;\r\n background: #fff;\r\n .model__table--title {\r\n .model__table-title--bar {\r\n width: 100%;\r\n height: 8px;\r\n background: var(--idooel-primary-color);\r\n border-top-left-radius: 4px;\r\n border-top-right-radius: 4px;\r\n }\r\n .model__table-title--text {\r\n text-align: left;\r\n padding: 16px;\r\n font-size: 16px;\r\n font-weight: bold;\r\n background: #fff;\r\n border-bottom: 1px solid;\r\n border-color: var(--idoole-black-016);\r\n }\r\n }\r\n .model__table--wrapper {\r\n background: #fff;\r\n .button-row__area {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: space-between;\r\n padding-top: 16px;\r\n padding-bottom: 8px;\r\n padding-right: 16px;\r\n }\r\n .g-table__wrapper {\r\n .fsm {\r\n cursor: pointer;\r\n color: var(--idooel-primary-color);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n",".ele.model__tree-table {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.ele.model__tree-table .model__tree-table--container .model__tree--wrapper {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n}\n.ele.model__tree-table .model__table--container {\n width: 100%;\n min-width: 0;\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--bar {\n width: 100%;\n height: 8px;\n background: var(--idooel-primary-color);\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n.ele.model__tree-table .model__table--container .model__table--title .model__table-title--text {\n text-align: left;\n padding: 16px;\n font-size: 16px;\n font-weight: bold;\n background: #fff;\n border-bottom: 1px solid;\n border-color: var(--idoole-black-016);\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper {\n background: #fff;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .button-row__area {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-top: 16px;\n padding-bottom: 8px;\n padding-right: 16px;\n}\n.ele.model__tree-table .model__table--container .model__table--wrapper .g-table__wrapper .fsm {\n cursor: pointer;\n color: var(--idooel-primary-color);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
3151
3641
|
|
|
3152
3642
|
};
|
|
3153
3643
|
/* scoped */
|
|
3154
|
-
const __vue_scope_id__$A = "data-v-
|
|
3644
|
+
const __vue_scope_id__$A = "data-v-46075027";
|
|
3155
3645
|
/* module identifier */
|
|
3156
3646
|
const __vue_module_identifier__$A = undefined;
|
|
3157
3647
|
/* functional template */
|
|
@@ -3567,11 +4057,11 @@ __vue_render__$z._withStripped = true;
|
|
|
3567
4057
|
/* style */
|
|
3568
4058
|
const __vue_inject_styles__$z = function (inject) {
|
|
3569
4059
|
if (!inject) return
|
|
3570
|
-
inject("data-v-770e5c93_0", { source: ".ele.form-group-model__wrapper[data-v-770e5c93] {\n background: unset;\n padding-bottom: 80px;\n}\n.ele.form-group-model__wrapper .form-group-model__from[data-v-770e5c93] {\n background: #fff;\n margin-top: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__from[data-v-770e5c93]:first-child {\n margin-top: unset;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--title[data-v-770e5c93] {\n width: 100%;\n height: 56px;\n padding: 0 16px;\n border-bottom: 1px solid;\n border-color: var(--idooel-form-title-border-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--content[data-v-770e5c93] {\n padding: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__form--footer[data-v-770e5c93] {\n width: 100%;\n height: 64px;\n background: #fff;\n position: fixed;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/models/form-group-model/src/index.vue","index.vue"],"names":[],"mappings":"AA4OA;EACA,iBAAA;EACA,oBAAA;AC3OA;AD4OA;EACA,gBAAA;EACA,gBAAA;AC1OA;AD2OA;EACA,iBAAA;ACzOA;AD2OA;EACA,WAAA;EACA,YAAA;EACA,eAAA;EACA,wBAAA;EACA,mDAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8BAAA;ACzOA;AD2OA;EACA,aAAA;ACzOA;AD4OA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,oBAAA;AC1OA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"ele form-group-model__wrapper\">\n <template v-for=\"(group, idx) in innerGroupMeta\">\n <div \n class=\"form-group-model__from\"\n v-if=\"!group.isGenTpl\"\n :key=\"group.key || idx\">\n <div class=\"form-group-model__form--title\">\n <div>{{ group.title }}</div>\n <div class=\"form-group-model__form--buttons\">\n <ele-button-group v-if=\"group.buttonGroupMeta\" v-on=\"assignAttrForEvents\" @delete=\"handleClickDelete($event, group, idx)\" :data-source=\"group.buttonGroupMeta.elements.call(this)\"></ele-button-group>\n </div>\n </div>\n <div class=\"form-group-model__form--content\">\n <ele-form @change=\"onChangeFormStatus($event, group.key || idx)\" :form-name=\"group.key || idx\" :ref=\"group.key || `${formRefBase}__${idx}`\" :elements=\"group.elements\"></ele-form>\n </div>\n </div>\n </template>\n <div v-if=\"showFooterMeta\" class=\"form-group-model__form--footer\">\n <ele-button-group v-on=\"assignAttrForEvents\" :data-source=\"footerElements\"></ele-button-group>\n </div>\n </div>\n</template>\n\n<script>\nimport { BUILT_IN_EVENT_NAMES, RESERVE_EVENT_NAMES, parseFieldMap, PAGE_STATUS } from '../../../utils'\nimport { v4 as uuidv4 } from 'uuid'\nimport { type, net } from '@idooel/shared'\nexport default {\n name: 'ele-form-group-model',\n props: {\n mode: {\n type: String\n },\n fieldName: {\n type: String,\n default: 'formGroup'\n },\n groupMeta: {\n type: Function,\n default: () => []\n },\n footerMeta: {\n type: Object,\n default: () => {}\n },\n preRequest: {\n type: Object,\n default: () => {}\n },\n infoRequest: {\n type: Object,\n default: () => {}\n },\n submitRequest: {\n type: Object,\n default: () => {}\n }\n },\n data () {\n return {\n increaseCount: 1,\n innerGroupMeta: []\n }\n },\n watch: {\n readOnlyGroupMeta: {\n handler (meta) {\n this.innerGroupMeta = meta\n },\n immediate: true\n }\n },\n computed: {\n routeMetaMode () {\n return this.$route.meta.mode\n },\n readOnlyGroupMeta () {\n return this.groupMeta.call(this)\n },\n showFooterMeta () {\n return !type.isEmpty(this.footerMeta)\n },\n formRefBase () {\n return uuidv4()\n },\n footerElements () {\n const { elements } = this.footerMeta\n return elements.call(this)\n },\n assignAttrForEvents () {\n const events = this.footerElements.reduce((ret, ele) => {\n ret[ele.eventName] = (e) => {\n this.$emit(ele.eventName || 'click', { ...e })\n }\n return ret\n }, {})\n return {\n ...this.$listeners,\n ...events,\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT],\n [BUILT_IN_EVENT_NAMES.CANCEL]: this[BUILT_IN_EVENT_NAMES.CANCEL],\n [BUILT_IN_EVENT_NAMES.INCREASE]: this[BUILT_IN_EVENT_NAMES.INCREASE]\n }\n },\n getFormRefs () {\n return this.innerGroupMeta.map((group, idx) => {\n if (!group.isGenTpl) {\n return this.$refs[group.key || `${this.formRefBase}__${idx}`]\n }\n return void 0\n }).filter(item => !!item).flat()\n },\n formModels () {\n if (this.mode === 'increase') {\n //TODO increase mode to return formModels\n return this.getFormRefs.map(form => {\n return form.getFieldsValue()\n })\n } else {\n return this.getFormRefs.map(form => {\n const { $vnode: { data: { ref } } } = form\n return {\n key: ref,\n value: form.getFieldsValue()\n }\n }).reduce((ret, props) => {\n ret[props.key] = props.value\n return ret\n }, {})\n }\n }\n },\n methods: {\n execFieldMap (fieldMap = {}, dataSource = {}) {\n const ret = parseFieldMap(fieldMap, { _route: this.$route.query, ...dataSource})\n return ret\n },\n onChangeFormStatus (props, key) {\n this.$emit(RESERVE_EVENT_NAMES.WATCH_FORM_STATUS, { key, ...props })\n },\n async infoRequestTrigger () {\n if (!this.infoRequest || this.routeMetaMode == PAGE_STATUS.CREATE) return\n const { url, requestType, params = {}, fieldMap = {}, headers = {} } = this.infoRequest\n if (!url) return\n net[requestType.toLowerCase()](url, { ...params, ...this.execFieldMap(fieldMap) }, { ...headers }).then(resp => {\n const { data = {} } = resp\n if (this.mode === 'increase') {\n this.renderIncreaseForm(data)\n }\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\n })\n },\n async preRequestTrigger () {\n if (!this.preRequest) return\n const { url, requestType = 'GET', params = {}, fieldMap = {}, headers = {} } = this.preRequest\n if (!url) return\n net[requestType.toLowerCase()](url, { ...params, ...fieldMap }, { ...headers }).then(resp => {\n const { data = {} } = resp\n if (this.mode === 'increase') {\n this.renderIncreaseForm(data)\n }\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\n })\n },\n renderIncreaseForm (data = {}) {\n const formGroupValuesLength = data[this.fieldName].length\n const genTplTarget = this.readOnlyGroupMeta.find(item => item.isGenTpl)\n const notGenTplPoolLength = this.readOnlyGroupMeta.filter(item => !item.isGenTpl).length\n const genNum = formGroupValuesLength - notGenTplPoolLength\n new Array(genNum).fill().forEach(() => {\n const form = this.genForm(genTplTarget)\n this.innerGroupMeta.push(form)\n })\n const formGroupValues = data[this.fieldName]\n this.$nextTick(() => {\n this.setFieldsValue(formGroupValues)\n })\n },\n async submitRequestTrigger (props = {}) {\n const { url, requestType, headers = {}, params = {}, fieldMap = {} } = this.submitRequest\n if (!url) return\n const ret = await net[requestType.toLowerCase()](url, { ...params, ...this.execFieldMap(fieldMap, { ...this.formModels }), [this.fieldName]: this.formModels }, { headers }).then(resp => {\n this.$emit(BUILT_IN_EVENT_NAMES.SUBMIT, { ...props, formModel: { ...this.formModels, ...resp.data || {} } })\n return resp.data\n })\n return ret\n },\n setFieldsValue (data = []) {\n this.getFormRefs.forEach((form, idx) => {\n form.setFieldsValue(data[idx])\n form.evalDisabledExpression(data[idx])\n })\n },\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props = {}) {\n const status = this.getFormRefs.map(form => {\n const status = form.validateFields()\n return status\n }).every(item => item)\n if (status) {\n return this.submitRequestTrigger(props)\n } else {\n return false\n }\n },\n [BUILT_IN_EVENT_NAMES.CANCEL] (props = {}) {\n this.$emit(BUILT_IN_EVENT_NAMES.CANCEL, { ...props })\n },\n genForm (base) {\n const { elements, title, buttonGroupMeta } = base\n return {\n elements: JSON.parse(JSON.stringify(elements)),\n buttonGroupMeta,\n title: `${title}${this.increaseCount++}`,\n _gen: true\n }\n },\n handleClickDelete (props = {}, attr = {}, idx) {\n this.innerGroupMeta.splice(idx, 1)\n this.$emit(BUILT_IN_EVENT_NAMES.DELETE, { ...props })\n },\n [BUILT_IN_EVENT_NAMES.INCREASE] (props) {\n const genTplTarget = this.readOnlyGroupMeta.find(item => item.isGenTpl)\n const form = this.genForm(genTplTarget)\n this.innerGroupMeta.push(form)\n }\n },\n async mounted() {\n await this.preRequestTrigger()\n await this.infoRequestTrigger()\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.ele {\n &.form-group-model__wrapper {\n background: unset;\n padding-bottom: 80px;\n .form-group-model__from {\n background: #fff;\n margin-top: 16px;\n &:first-child {\n margin-top: unset;\n }\n .form-group-model__form--title {\n width: 100%;\n height: 56px;\n padding: 0 16px;\n border-bottom: 1px solid;\n border-color: var(--idooel-form-title-border-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n .form-group-model__form--content {\n padding: 16px;\n }\n }\n .form-group-model__form--footer {\n width: 100%;\n height: 64px;\n background: #fff;\n position: fixed;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n }\n }\n}\n</style>",".ele.form-group-model__wrapper {\n background: unset;\n padding-bottom: 80px;\n}\n.ele.form-group-model__wrapper .form-group-model__from {\n background: #fff;\n margin-top: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__from:first-child {\n margin-top: unset;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--title {\n width: 100%;\n height: 56px;\n padding: 0 16px;\n border-bottom: 1px solid;\n border-color: var(--idooel-form-title-border-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--content {\n padding: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__form--footer {\n width: 100%;\n height: 64px;\n background: #fff;\n position: fixed;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
4060
|
+
inject("data-v-db482174_0", { source: ".ele.form-group-model__wrapper[data-v-db482174] {\n background: unset;\n padding-bottom: 80px;\n}\n.ele.form-group-model__wrapper .form-group-model__from[data-v-db482174] {\n background: #fff;\n margin-top: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__from[data-v-db482174]:first-child {\n margin-top: unset;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--title[data-v-db482174] {\n width: 100%;\n height: 56px;\n padding: 0 16px;\n border-bottom: 1px solid;\n border-color: var(--idooel-form-title-border-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--content[data-v-db482174] {\n padding: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__form--footer[data-v-db482174] {\n width: 100%;\n height: 64px;\n background: #fff;\n position: fixed;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\models\\form-group-model\\src\\index.vue","index.vue"],"names":[],"mappings":"AA4OA;EACA,iBAAA;EACA,oBAAA;AC3OA;AD4OA;EACA,gBAAA;EACA,gBAAA;AC1OA;AD2OA;EACA,iBAAA;ACzOA;AD2OA;EACA,WAAA;EACA,YAAA;EACA,eAAA;EACA,wBAAA;EACA,mDAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8BAAA;ACzOA;AD2OA;EACA,aAAA;ACzOA;AD4OA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,oBAAA;AC1OA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele form-group-model__wrapper\">\r\n <template v-for=\"(group, idx) in innerGroupMeta\">\r\n <div \r\n class=\"form-group-model__from\"\r\n v-if=\"!group.isGenTpl\"\r\n :key=\"group.key || idx\">\r\n <div class=\"form-group-model__form--title\">\r\n <div>{{ group.title }}</div>\r\n <div class=\"form-group-model__form--buttons\">\r\n <ele-button-group v-if=\"group.buttonGroupMeta\" v-on=\"assignAttrForEvents\" @delete=\"handleClickDelete($event, group, idx)\" :data-source=\"group.buttonGroupMeta.elements.call(this)\"></ele-button-group>\r\n </div>\r\n </div>\r\n <div class=\"form-group-model__form--content\">\r\n <ele-form @change=\"onChangeFormStatus($event, group.key || idx)\" :form-name=\"group.key || idx\" :ref=\"group.key || `${formRefBase}__${idx}`\" :elements=\"group.elements\"></ele-form>\r\n </div>\r\n </div>\r\n </template>\r\n <div v-if=\"showFooterMeta\" class=\"form-group-model__form--footer\">\r\n <ele-button-group v-on=\"assignAttrForEvents\" :data-source=\"footerElements\"></ele-button-group>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { BUILT_IN_EVENT_NAMES, RESERVE_EVENT_NAMES, parseFieldMap, PAGE_STATUS } from '../../../utils'\r\nimport { v4 as uuidv4 } from 'uuid'\r\nimport { type, net } from '@idooel/shared'\r\nexport default {\r\n name: 'ele-form-group-model',\r\n props: {\r\n mode: {\r\n type: String\r\n },\r\n fieldName: {\r\n type: String,\r\n default: 'formGroup'\r\n },\r\n groupMeta: {\r\n type: Function,\r\n default: () => []\r\n },\r\n footerMeta: {\r\n type: Object,\r\n default: () => {}\r\n },\r\n preRequest: {\r\n type: Object,\r\n default: () => {}\r\n },\r\n infoRequest: {\r\n type: Object,\r\n default: () => {}\r\n },\r\n submitRequest: {\r\n type: Object,\r\n default: () => {}\r\n }\r\n },\r\n data () {\r\n return {\r\n increaseCount: 1,\r\n innerGroupMeta: []\r\n }\r\n },\r\n watch: {\r\n readOnlyGroupMeta: {\r\n handler (meta) {\r\n this.innerGroupMeta = meta\r\n },\r\n immediate: true\r\n }\r\n },\r\n computed: {\r\n routeMetaMode () {\r\n return this.$route.meta.mode\r\n },\r\n readOnlyGroupMeta () {\r\n return this.groupMeta.call(this)\r\n },\r\n showFooterMeta () {\r\n return !type.isEmpty(this.footerMeta)\r\n },\r\n formRefBase () {\r\n return uuidv4()\r\n },\r\n footerElements () {\r\n const { elements } = this.footerMeta\r\n return elements.call(this)\r\n },\r\n assignAttrForEvents () {\r\n const events = this.footerElements.reduce((ret, ele) => {\r\n ret[ele.eventName] = (e) => {\r\n this.$emit(ele.eventName || 'click', { ...e })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events,\r\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT],\r\n [BUILT_IN_EVENT_NAMES.CANCEL]: this[BUILT_IN_EVENT_NAMES.CANCEL],\r\n [BUILT_IN_EVENT_NAMES.INCREASE]: this[BUILT_IN_EVENT_NAMES.INCREASE]\r\n }\r\n },\r\n getFormRefs () {\r\n return this.innerGroupMeta.map((group, idx) => {\r\n if (!group.isGenTpl) {\r\n return this.$refs[group.key || `${this.formRefBase}__${idx}`]\r\n }\r\n return void 0\r\n }).filter(item => !!item).flat()\r\n },\r\n formModels () {\r\n if (this.mode === 'increase') {\r\n //TODO increase mode to return formModels\r\n return this.getFormRefs.map(form => {\r\n return form.getFieldsValue()\r\n })\r\n } else {\r\n return this.getFormRefs.map(form => {\r\n const { $vnode: { data: { ref } } } = form\r\n return {\r\n key: ref,\r\n value: form.getFieldsValue()\r\n }\r\n }).reduce((ret, props) => {\r\n ret[props.key] = props.value\r\n return ret\r\n }, {})\r\n }\r\n }\r\n },\r\n methods: {\r\n execFieldMap (fieldMap = {}, dataSource = {}) {\r\n const ret = parseFieldMap(fieldMap, { _route: this.$route.query, ...dataSource})\r\n return ret\r\n },\r\n onChangeFormStatus (props, key) {\r\n this.$emit(RESERVE_EVENT_NAMES.WATCH_FORM_STATUS, { key, ...props })\r\n },\r\n async infoRequestTrigger () {\r\n if (!this.infoRequest || this.routeMetaMode == PAGE_STATUS.CREATE) return\r\n const { url, requestType, params = {}, fieldMap = {}, headers = {} } = this.infoRequest\r\n if (!url) return\r\n net[requestType.toLowerCase()](url, { ...params, ...this.execFieldMap(fieldMap) }, { ...headers }).then(resp => {\r\n const { data = {} } = resp\r\n if (this.mode === 'increase') {\r\n this.renderIncreaseForm(data)\r\n }\r\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\r\n })\r\n },\r\n async preRequestTrigger () {\r\n if (!this.preRequest) return\r\n const { url, requestType = 'GET', params = {}, fieldMap = {}, headers = {} } = this.preRequest\r\n if (!url) return\r\n net[requestType.toLowerCase()](url, { ...params, ...fieldMap }, { ...headers }).then(resp => {\r\n const { data = {} } = resp\r\n if (this.mode === 'increase') {\r\n this.renderIncreaseForm(data)\r\n }\r\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\r\n })\r\n },\r\n renderIncreaseForm (data = {}) {\r\n const formGroupValuesLength = data[this.fieldName].length\r\n const genTplTarget = this.readOnlyGroupMeta.find(item => item.isGenTpl)\r\n const notGenTplPoolLength = this.readOnlyGroupMeta.filter(item => !item.isGenTpl).length\r\n const genNum = formGroupValuesLength - notGenTplPoolLength\r\n new Array(genNum).fill().forEach(() => {\r\n const form = this.genForm(genTplTarget)\r\n this.innerGroupMeta.push(form)\r\n })\r\n const formGroupValues = data[this.fieldName]\r\n this.$nextTick(() => {\r\n this.setFieldsValue(formGroupValues)\r\n })\r\n },\r\n async submitRequestTrigger (props = {}) {\r\n const { url, requestType, headers = {}, params = {}, fieldMap = {} } = this.submitRequest\r\n if (!url) return\r\n const ret = await net[requestType.toLowerCase()](url, { ...params, ...this.execFieldMap(fieldMap, { ...this.formModels }), [this.fieldName]: this.formModels }, { headers }).then(resp => {\r\n this.$emit(BUILT_IN_EVENT_NAMES.SUBMIT, { ...props, formModel: { ...this.formModels, ...resp.data || {} } })\r\n return resp.data\r\n })\r\n return ret\r\n },\r\n setFieldsValue (data = []) {\r\n this.getFormRefs.forEach((form, idx) => {\r\n form.setFieldsValue(data[idx])\r\n form.evalDisabledExpression(data[idx])\r\n })\r\n },\r\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props = {}) {\r\n const status = this.getFormRefs.map(form => {\r\n const status = form.validateFields()\r\n return status\r\n }).every(item => item)\r\n if (status) {\r\n return this.submitRequestTrigger(props)\r\n } else {\r\n return false\r\n }\r\n },\r\n [BUILT_IN_EVENT_NAMES.CANCEL] (props = {}) {\r\n this.$emit(BUILT_IN_EVENT_NAMES.CANCEL, { ...props })\r\n },\r\n genForm (base) {\r\n const { elements, title, buttonGroupMeta } = base\r\n return {\r\n elements: JSON.parse(JSON.stringify(elements)),\r\n buttonGroupMeta,\r\n title: `${title}${this.increaseCount++}`,\r\n _gen: true\r\n }\r\n },\r\n handleClickDelete (props = {}, attr = {}, idx) {\r\n this.innerGroupMeta.splice(idx, 1)\r\n this.$emit(BUILT_IN_EVENT_NAMES.DELETE, { ...props })\r\n },\r\n [BUILT_IN_EVENT_NAMES.INCREASE] (props) {\r\n const genTplTarget = this.readOnlyGroupMeta.find(item => item.isGenTpl)\r\n const form = this.genForm(genTplTarget)\r\n this.innerGroupMeta.push(form)\r\n }\r\n },\r\n async mounted() {\r\n await this.preRequestTrigger()\r\n await this.infoRequestTrigger()\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele {\r\n &.form-group-model__wrapper {\r\n background: unset;\r\n padding-bottom: 80px;\r\n .form-group-model__from {\r\n background: #fff;\r\n margin-top: 16px;\r\n &:first-child {\r\n margin-top: unset;\r\n }\r\n .form-group-model__form--title {\r\n width: 100%;\r\n height: 56px;\r\n padding: 0 16px;\r\n border-bottom: 1px solid;\r\n border-color: var(--idooel-form-title-border-color);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: space-between;\r\n }\r\n .form-group-model__form--content {\r\n padding: 16px;\r\n }\r\n }\r\n .form-group-model__form--footer {\r\n width: 100%;\r\n height: 64px;\r\n background: #fff;\r\n position: fixed;\r\n bottom: 0;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: end;\r\n }\r\n }\r\n}\r\n</style>",".ele.form-group-model__wrapper {\n background: unset;\n padding-bottom: 80px;\n}\n.ele.form-group-model__wrapper .form-group-model__from {\n background: #fff;\n margin-top: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__from:first-child {\n margin-top: unset;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--title {\n width: 100%;\n height: 56px;\n padding: 0 16px;\n border-bottom: 1px solid;\n border-color: var(--idooel-form-title-border-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.ele.form-group-model__wrapper .form-group-model__from .form-group-model__form--content {\n padding: 16px;\n}\n.ele.form-group-model__wrapper .form-group-model__form--footer {\n width: 100%;\n height: 64px;\n background: #fff;\n position: fixed;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
3571
4061
|
|
|
3572
4062
|
};
|
|
3573
4063
|
/* scoped */
|
|
3574
|
-
const __vue_scope_id__$z = "data-v-
|
|
4064
|
+
const __vue_scope_id__$z = "data-v-db482174";
|
|
3575
4065
|
/* module identifier */
|
|
3576
4066
|
const __vue_module_identifier__$z = undefined;
|
|
3577
4067
|
/* functional template */
|
|
@@ -3637,6 +4127,7 @@ var script$y = {
|
|
|
3637
4127
|
setFieldsValue: this.setFieldsValue,
|
|
3638
4128
|
validateFields: this.validateFields,
|
|
3639
4129
|
getFieldsValue: this.getFieldsValue,
|
|
4130
|
+
executeExpressions: this.executeExpressions,
|
|
3640
4131
|
route: this.$route,
|
|
3641
4132
|
[BUILT_IN_METHODS_NAMES.SUBMIT_FORM]: this.submitRequestTrigger
|
|
3642
4133
|
};
|
|
@@ -3831,6 +4322,9 @@ var script$y = {
|
|
|
3831
4322
|
getFieldsValue(fieldNames) {
|
|
3832
4323
|
return this.$refs[this.formRef].getFieldsValue(fieldNames);
|
|
3833
4324
|
},
|
|
4325
|
+
executeExpressions() {
|
|
4326
|
+
return this.$refs[this.formRef].evalShowExpression();
|
|
4327
|
+
},
|
|
3834
4328
|
validateFields() {
|
|
3835
4329
|
return this.$refs[this.formRef].validateFields();
|
|
3836
4330
|
},
|
|
@@ -3928,11 +4422,11 @@ __vue_render__$y._withStripped = true;
|
|
|
3928
4422
|
/* style */
|
|
3929
4423
|
const __vue_inject_styles__$y = function (inject) {
|
|
3930
4424
|
if (!inject) return
|
|
3931
|
-
inject("data-v-f6310b92_0", { source: ".form__model--wrapper[data-v-f6310b92] {\n width: 100%;\n height: 100%;\n overflow: auto;\n background: #fff;\n}\n.form__model--wrapper .form-model__title[data-v-f6310b92] {\n height: 56px;\n padding: 0 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid var(--idooel-form-title-border-color);\n}\n.form__model--wrapper .form-model__content[data-v-f6310b92] {\n padding: 16px;\n}\n.form__model--wrapper .form-model__footer[data-v-f6310b92] {\n /* width: 100%; */\n height: 64px;\n position: fixed;\n bottom: 0;\n display: flex;\n float: right;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/models/form-model/src/index.vue","index.vue"],"names":[],"mappings":"AA4MA;EACA,WAAA;EACA,YAAA;EACA,cAAA;EACA,gBAAA;AC3MA;AD4MA;EACA,YAAA;EACA,eAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8DAAA;AC1MA;AD4MA;EACA,aAAA;AC1MA;AD4MA;EACA,iBAAA;EACA,YAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,YAAA;EACA,mBAAA;EACA,mBAAA;EACA,oBAAA;AC1MA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"form__model--wrapper\">\n <div class=\"form-model__title\" v-if=\"title\">\n {{ title }}\n </div>\n <div class=\"form-model__content\">\n <ele-alert style=\"margin-bottom: 16px;\" v-if=\"alertMeta\" v-bind=\"alertMeta\"></ele-alert>\n <ele-form :ref=\"formRef\" @change=\"onChangeFormStatus($event)\" :elements=\"elements\" :disabled=\"globalDisabled\"></ele-form>\n </div>\n <div class=\"form-model__footer\" v-if=\"footerMeta\">\n <ele-button-group v-on=\"assignAttrForEvents\" :data-source=\"footerElements\"></ele-button-group>\n </div>\n </div>\n</template>\n\n<script>\nimport { BUILT_IN_EVENT_NAMES, parseFieldMap, RESERVE_EVENT_NAMES, PAGE_STATUS, CONTEXT, BUILT_IN_METHODS_NAMES } from '../../../utils'\nimport { v4 as uuidv4 } from 'uuid'\nimport { net, type } from '@idooel/shared'\nimport { parse } from '@idooel/expression'\nexport default {\n name: 'ele-form-model',\n props: {\n disabled: {\n type: [Boolean, String],\n default: '_routeMeta.disabled'\n },\n title: {\n type: String\n },\n formMeta: {\n type: Object\n },\n footerMeta: {\n type: Object\n }\n },\n data() {\n return {}\n },\n provide () {\n return {\n [CONTEXT]: () => {\n return {\n exposed: this.exposed\n }\n }\n }\n },\n computed: {\n globalDisabled () {\n return this.executeExpression(this.disabled)\n },\n formRef () {\n return uuidv4()\n },\n exposed () {\n return {\n setFieldsValue: this.setFieldsValue,\n validateFields: this.validateFields,\n getFieldsValue: this.getFieldsValue,\n route: this.$route,\n [BUILT_IN_METHODS_NAMES.SUBMIT_FORM]: this.submitRequestTrigger\n }\n },\n assignAttrForEvents () {\n const events = this.footerElements.reduce((ret, ele) => {\n ret[ele.eventName] = (e) => {\n this.$emit(ele.eventName || 'click', { ...e, formModel: this.formModels(), exposed: this.exposed })\n }\n return ret\n }, {})\n return {\n ...this.$listeners,\n ...events,\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT],\n [BUILT_IN_EVENT_NAMES.CANCEL]: this[BUILT_IN_EVENT_NAMES.CANCEL]\n }\n },\n elements () {\n const { elements } = this.formMeta\n return elements\n },\n preRequest () {\n const { preRequest = {} } = this.formMeta\n return preRequest\n },\n infoRequest () {\n const { infoRequest = {} } = this.formMeta\n return infoRequest\n },\n alertMeta () {\n const { alert = {} } = this.formMeta\n return type.isEmpty(alert) ? null : alert\n },\n submitRequest () {\n const { submitRequest = {} } = this.formMeta\n return submitRequest\n },\n footerElements () {\n const { elements } = this.footerMeta\n return elements.call(this)\n },\n expressionData () {\n return {\n _route: this.$route.query,\n _routeMeta: this.$route.meta\n }\n },\n routeMetaMode () {\n return this.$route.meta.mode\n }\n },\n methods: {\n collectDefaultValues () {\n const ret = this.elements.reduce((ret, props) => {\n const { name, defaultValue } = props\n if (defaultValue) {\n ret[name] = defaultValue\n }\n return ret\n }, {})\n return ret\n },\n onChangeFormStatus (props) {\n this.$emit(RESERVE_EVENT_NAMES.WATCH_FORM_STATUS, { ...props })\n },\n formModels (fieldNames) {\n return this.$refs[this.formRef] ? this.$refs[this.formRef].getFieldsValue(fieldNames) : {}\n },\n executeExpression (expression, dataSource = {}) {\n if (type.isBool(expression)) return expression\n if (type.isEmpty(expression)) return false\n return parse(expression, { ...this.expressionData, ...this.formModels(), ...dataSource })\n },\n execFieldMap (fieldMap = {}, dataSource = {}) {\n const ret = parseFieldMap(fieldMap, { ...this.expressionData, ...dataSource})\n return ret\n },\n async submitRequestTrigger (props = {}) {\n const { url, requestType, headers = {}, params = {}, fieldMap = {} } = this.submitRequest\n const currentUrl = this.executeExpressionForUrl(url)\n if (!currentUrl) return\n const ret = await net[requestType.toLowerCase()](currentUrl, { ...params, ...this.execFieldMap(fieldMap, { ...this.formModels() }), ...this.formModels() }, { headers }).then(resp => {\n this.$emit(BUILT_IN_EVENT_NAMES.SUBMIT, { ...props, formModel: { ...this.formModels(), ...resp.data || {} } })\n return resp.data\n })\n return ret\n },\n async infoRequestTrigger () {\n if (PAGE_STATUS.CREATE == this.routeMetaMode) return\n const { url, requestType, params = {}, fieldMap = {}, headers = {} } = this.infoRequest\n const currentUrl = this.executeExpressionForUrl(url)\n if (!currentUrl) return\n net[requestType.toLowerCase()](currentUrl, { ...params, ...this.execFieldMap(fieldMap) }, { ...headers }).then(resp => {\n const { data = {} } = resp\n this.setFieldsValue(data)\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\n })\n },\n async preRequestTrigger () {\n const { url, requestType = 'GET', params = {}, fieldMap = {}, headers = {} } = this.preRequest\n const currentUrl = this.executeExpressionForUrl(url)\n if (!currentUrl) return\n const { data } = await net[requestType.toLowerCase()](currentUrl, { ...params, ...this.execFieldMap(fieldMap) }, { ...headers })\n this.setFieldsValue(data)\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\n },\n executeExpressionForUrl (url) {\n return type.isApi(url) ? url : this.executeExpression(url)\n },\n setFieldsValue (props) {\n this.$refs[this.formRef].setFieldsValue(props)\n },\n getFieldsValue (fieldNames) {\n return this.$refs[this.formRef].getFieldsValue(fieldNames)\n },\n validateFields () {\n return this.$refs[this.formRef].validateFields()\n },\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props = {}) {\n if (this.globalDisabled) return\n const status = this.$refs[this.formRef].validateFields()\n if (status) {\n //TODO fieldMap\n return this.submitRequestTrigger(props)\n } else {\n return false\n }\n },\n [BUILT_IN_EVENT_NAMES.CANCEL] (props = {}) {\n this.$emit(BUILT_IN_EVENT_NAMES.CANCEL, { ...props })\n }\n },\n async mounted() {\n this.setFieldsValue(this.collectDefaultValues())\n await this.preRequestTrigger()\n await this.infoRequestTrigger()\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { exposed: this.exposed })\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.form__model--wrapper {\n width: 100%;\n height: 100%;\n overflow: auto;\n background: #fff;\n .form-model__title {\n height: 56px;\n padding: 0 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid var(--idooel-form-title-border-color);\n }\n .form-model__content {\n padding: 16px;\n }\n .form-model__footer {\n /* width: 100%; */\n height: 64px;\n position: fixed;\n bottom: 0;\n display: flex;\n float: right;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n }\n}\n</style>",".form__model--wrapper {\n width: 100%;\n height: 100%;\n overflow: auto;\n background: #fff;\n}\n.form__model--wrapper .form-model__title {\n height: 56px;\n padding: 0 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid var(--idooel-form-title-border-color);\n}\n.form__model--wrapper .form-model__content {\n padding: 16px;\n}\n.form__model--wrapper .form-model__footer {\n /* width: 100%; */\n height: 64px;\n position: fixed;\n bottom: 0;\n display: flex;\n float: right;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
4425
|
+
inject("data-v-5149ea56_0", { source: ".form__model--wrapper[data-v-5149ea56] {\n width: 100%;\n height: 100%;\n overflow: auto;\n background: #fff;\n}\n.form__model--wrapper .form-model__title[data-v-5149ea56] {\n height: 56px;\n padding: 0 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid var(--idooel-form-title-border-color);\n}\n.form__model--wrapper .form-model__content[data-v-5149ea56] {\n padding: 16px;\n}\n.form__model--wrapper .form-model__footer[data-v-5149ea56] {\n /* width: 100%; */\n height: 64px;\n position: fixed;\n bottom: 0;\n display: flex;\n float: right;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\models\\form-model\\src\\index.vue","index.vue"],"names":[],"mappings":"AAgNA;EACA,WAAA;EACA,YAAA;EACA,cAAA;EACA,gBAAA;AC/MA;ADgNA;EACA,YAAA;EACA,eAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8DAAA;AC9MA;ADgNA;EACA,aAAA;AC9MA;ADgNA;EACA,iBAAA;EACA,YAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,YAAA;EACA,mBAAA;EACA,mBAAA;EACA,oBAAA;AC9MA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"form__model--wrapper\">\r\n <div class=\"form-model__title\" v-if=\"title\">\r\n {{ title }}\r\n </div>\r\n <div class=\"form-model__content\">\r\n <ele-alert style=\"margin-bottom: 16px;\" v-if=\"alertMeta\" v-bind=\"alertMeta\"></ele-alert>\r\n <ele-form :ref=\"formRef\" @change=\"onChangeFormStatus($event)\" :elements=\"elements\" :disabled=\"globalDisabled\"></ele-form>\r\n </div>\r\n <div class=\"form-model__footer\" v-if=\"footerMeta\">\r\n <ele-button-group v-on=\"assignAttrForEvents\" :data-source=\"footerElements\"></ele-button-group>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { BUILT_IN_EVENT_NAMES, parseFieldMap, RESERVE_EVENT_NAMES, PAGE_STATUS, CONTEXT, BUILT_IN_METHODS_NAMES } from '../../../utils'\r\nimport { v4 as uuidv4 } from 'uuid'\r\nimport { net, type } from '@idooel/shared'\r\nimport { parse } from '@idooel/expression'\r\nexport default {\r\n name: 'ele-form-model',\r\n props: {\r\n disabled: {\r\n type: [Boolean, String],\r\n default: '_routeMeta.disabled'\r\n },\r\n title: {\r\n type: String\r\n },\r\n formMeta: {\r\n type: Object\r\n },\r\n footerMeta: {\r\n type: Object\r\n }\r\n },\r\n data() {\r\n return {}\r\n },\r\n provide () {\r\n return {\r\n [CONTEXT]: () => {\r\n return {\r\n exposed: this.exposed\r\n }\r\n }\r\n }\r\n },\r\n computed: {\r\n globalDisabled () {\r\n return this.executeExpression(this.disabled)\r\n },\r\n formRef () {\r\n return uuidv4()\r\n },\r\n exposed () {\r\n return {\r\n setFieldsValue: this.setFieldsValue,\r\n validateFields: this.validateFields,\r\n getFieldsValue: this.getFieldsValue,\r\n executeExpressions: this.executeExpressions,\r\n route: this.$route,\r\n [BUILT_IN_METHODS_NAMES.SUBMIT_FORM]: this.submitRequestTrigger\r\n }\r\n },\r\n assignAttrForEvents () {\r\n const events = this.footerElements.reduce((ret, ele) => {\r\n ret[ele.eventName] = (e) => {\r\n this.$emit(ele.eventName || 'click', { ...e, formModel: this.formModels(), exposed: this.exposed })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events,\r\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT],\r\n [BUILT_IN_EVENT_NAMES.CANCEL]: this[BUILT_IN_EVENT_NAMES.CANCEL]\r\n }\r\n },\r\n elements () {\r\n const { elements } = this.formMeta\r\n return elements\r\n },\r\n preRequest () {\r\n const { preRequest = {} } = this.formMeta\r\n return preRequest\r\n },\r\n infoRequest () {\r\n const { infoRequest = {} } = this.formMeta\r\n return infoRequest\r\n },\r\n alertMeta () {\r\n const { alert = {} } = this.formMeta\r\n return type.isEmpty(alert) ? null : alert\r\n },\r\n submitRequest () {\r\n const { submitRequest = {} } = this.formMeta\r\n return submitRequest\r\n },\r\n footerElements () {\r\n const { elements } = this.footerMeta\r\n return elements.call(this)\r\n },\r\n expressionData () {\r\n return {\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta\r\n }\r\n },\r\n routeMetaMode () {\r\n return this.$route.meta.mode\r\n }\r\n },\r\n methods: {\r\n collectDefaultValues () {\r\n const ret = this.elements.reduce((ret, props) => {\r\n const { name, defaultValue } = props\r\n if (defaultValue) {\r\n ret[name] = defaultValue\r\n }\r\n return ret\r\n }, {})\r\n return ret\r\n },\r\n onChangeFormStatus (props) {\r\n this.$emit(RESERVE_EVENT_NAMES.WATCH_FORM_STATUS, { ...props })\r\n },\r\n formModels (fieldNames) {\r\n return this.$refs[this.formRef] ? this.$refs[this.formRef].getFieldsValue(fieldNames) : {}\r\n },\r\n executeExpression (expression, dataSource = {}) {\r\n if (type.isBool(expression)) return expression\r\n if (type.isEmpty(expression)) return false\r\n return parse(expression, { ...this.expressionData, ...this.formModels(), ...dataSource })\r\n },\r\n execFieldMap (fieldMap = {}, dataSource = {}) {\r\n const ret = parseFieldMap(fieldMap, { ...this.expressionData, ...dataSource})\r\n return ret\r\n },\r\n async submitRequestTrigger (props = {}) {\r\n const { url, requestType, headers = {}, params = {}, fieldMap = {} } = this.submitRequest\r\n const currentUrl = this.executeExpressionForUrl(url)\r\n if (!currentUrl) return\r\n const ret = await net[requestType.toLowerCase()](currentUrl, { ...params, ...this.execFieldMap(fieldMap, { ...this.formModels() }), ...this.formModels() }, { headers }).then(resp => {\r\n this.$emit(BUILT_IN_EVENT_NAMES.SUBMIT, { ...props, formModel: { ...this.formModels(), ...resp.data || {} } })\r\n return resp.data\r\n })\r\n return ret\r\n },\r\n async infoRequestTrigger () {\r\n if (PAGE_STATUS.CREATE == this.routeMetaMode) return\r\n const { url, requestType, params = {}, fieldMap = {}, headers = {} } = this.infoRequest\r\n const currentUrl = this.executeExpressionForUrl(url)\r\n if (!currentUrl) return\r\n net[requestType.toLowerCase()](currentUrl, { ...params, ...this.execFieldMap(fieldMap) }, { ...headers }).then(resp => {\r\n const { data = {} } = resp\r\n this.setFieldsValue(data)\r\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\r\n })\r\n },\r\n async preRequestTrigger () {\r\n const { url, requestType = 'GET', params = {}, fieldMap = {}, headers = {} } = this.preRequest\r\n const currentUrl = this.executeExpressionForUrl(url)\r\n if (!currentUrl) return\r\n const { data } = await net[requestType.toLowerCase()](currentUrl, { ...params, ...this.execFieldMap(fieldMap) }, { ...headers })\r\n this.setFieldsValue(data)\r\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { ...data })\r\n },\r\n executeExpressionForUrl (url) {\r\n return type.isApi(url) ? url : this.executeExpression(url)\r\n },\r\n setFieldsValue (props) {\r\n this.$refs[this.formRef].setFieldsValue(props)\r\n },\r\n getFieldsValue (fieldNames) {\r\n return this.$refs[this.formRef].getFieldsValue(fieldNames)\r\n },\r\n executeExpressions () {\r\n return this.$refs[this.formRef].evalShowExpression()\r\n },\r\n validateFields () {\r\n return this.$refs[this.formRef].validateFields()\r\n },\r\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props = {}) {\r\n if (this.globalDisabled) return\r\n const status = this.$refs[this.formRef].validateFields()\r\n if (status) {\r\n //TODO fieldMap\r\n return this.submitRequestTrigger(props)\r\n } else {\r\n return false\r\n }\r\n },\r\n [BUILT_IN_EVENT_NAMES.CANCEL] (props = {}) {\r\n this.$emit(BUILT_IN_EVENT_NAMES.CANCEL, { ...props })\r\n }\r\n },\r\n async mounted() {\r\n this.setFieldsValue(this.collectDefaultValues())\r\n await this.preRequestTrigger()\r\n await this.infoRequestTrigger()\r\n this.$emit(RESERVE_EVENT_NAMES.INIT_FORM, { exposed: this.exposed })\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.form__model--wrapper {\r\n width: 100%;\r\n height: 100%;\r\n overflow: auto;\r\n background: #fff;\r\n .form-model__title {\r\n height: 56px;\r\n padding: 0 16px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n border-bottom: 1px solid var(--idooel-form-title-border-color);\r\n }\r\n .form-model__content {\r\n padding: 16px;\r\n }\r\n .form-model__footer {\r\n /* width: 100%; */\r\n height: 64px;\r\n position: fixed;\r\n bottom: 0;\r\n display: flex;\r\n float: right;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: end;\r\n }\r\n}\r\n</style>",".form__model--wrapper {\n width: 100%;\n height: 100%;\n overflow: auto;\n background: #fff;\n}\n.form__model--wrapper .form-model__title {\n height: 56px;\n padding: 0 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid var(--idooel-form-title-border-color);\n}\n.form__model--wrapper .form-model__content {\n padding: 16px;\n}\n.form__model--wrapper .form-model__footer {\n /* width: 100%; */\n height: 64px;\n position: fixed;\n bottom: 0;\n display: flex;\n float: right;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
3932
4426
|
|
|
3933
4427
|
};
|
|
3934
4428
|
/* scoped */
|
|
3935
|
-
const __vue_scope_id__$y = "data-v-
|
|
4429
|
+
const __vue_scope_id__$y = "data-v-5149ea56";
|
|
3936
4430
|
/* module identifier */
|
|
3937
4431
|
const __vue_module_identifier__$y = undefined;
|
|
3938
4432
|
/* functional template */
|
|
@@ -4223,11 +4717,11 @@ __vue_render__$x._withStripped = true;
|
|
|
4223
4717
|
/* style */
|
|
4224
4718
|
const __vue_inject_styles__$x = function (inject) {
|
|
4225
4719
|
if (!inject) return
|
|
4226
|
-
inject("data-v-
|
|
4720
|
+
inject("data-v-3000c68c_0", { source: ".ele-step-model__wrapper[data-v-3000c68c] {\n width: 100%;\n height: 100vh;\n position: relative;\n}\n.ele-step-model__wrapper .ele-step-model__step--wrapper[data-v-3000c68c] {\n width: 100%;\n height: 64px;\n padding: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n background: #fff;\n}\n.ele-step-model__wrapper .ele-step-model__step--wrapper .ele-steps .ant-steps-item[data-v-3000c68c] {\n text-align: left;\n}\n.ele-step-model__wrapper .ele-step-model__content--wrapper[data-v-3000c68c] {\n width: 100%;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n height: calc(100vh - 64px - 64px - 16px - 16px);\n overflow: auto;\n}\n.ele-step-model__wrapper .ele-step-model__footer--wrapper[data-v-3000c68c] {\n width: 100%;\n height: 64px;\n background: #fff;\n position: absolute;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\models\\step-model\\src\\index.vue","index.vue"],"names":[],"mappings":"AAwLA;EACA,WAAA;EACA,aAAA;EACA,kBAAA;ACvLA;ADwLA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,gBAAA;ACtLA;ADwLA;EACA,gBAAA;ACtLA;AD0LA;EACA,WAAA;EACA,WAAA;EACA,gBAAA;EACA,mBAAA;EACA,+CAAA;EACA,cAAA;ACxLA;AD0LA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;EACA,kBAAA;EACA,SAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,oBAAA;ACxLA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele-step-model__wrapper\">\r\n <div class=\"ele-step-model__step--wrapper\">\r\n <a-steps class=\"ele-steps\" :current=\"current\" size=\"small\">\r\n <a-step v-for=\"step in elements\" :title=\"step.title\" :key=\"step.key\" />\r\n </a-steps>\r\n </div>\r\n <div class=\"ele-step-model__content--wrapper\">\r\n <template v-for=\"name in scopedSlotsNames\">\r\n <div :key=\"name\" v-if=\"currentSlotName == name\" :class=\"['ele-step-model__slot', `ele-step-model__slot--${name}`]\">\r\n <slot :name=\"name\"></slot>\r\n </div>\r\n </template>\r\n </div>\r\n <div class=\"ele-step-model__footer--wrapper\">\r\n <ele-button-group v-on=\"assignAttrForEvents\" :data-source=\"footerElements\"></ele-button-group>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { BUILT_IN_EVENT_NAMES, CONTEXT } from '../../../utils'\r\nimport { parse } from '@idooel/expression'\r\nimport { type } from '@idooel/shared'\r\nexport default {\r\n name: 'ele-step-model',\r\n props: {\r\n stepMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n footerMeta: {\r\n type: Object,\r\n default: () => ({})\r\n }\r\n },\r\n data() {\r\n return {\r\n current: 0,\r\n currentSlotComponentRef: null,\r\n innerFooterElements: []\r\n }\r\n },\r\n provide() {\r\n return {\r\n [CONTEXT]: () => {\r\n return {\r\n ...this.expressionData\r\n }\r\n }\r\n }\r\n },\r\n computed: {\r\n routeMetaDisabled () {\r\n return this.executeExpression(this.$route.meta.disabled)\r\n },\r\n expressionData () {\r\n return {\r\n current: this.current,\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta\r\n }\r\n },\r\n currentSlotName () {\r\n return this.scopedSlotsNames[this.current]\r\n },\r\n footerElements () {\r\n return this.innerFooterElements\r\n },\r\n assignAttrForEvents () {\r\n const events = this.footerElements.reduce((ret, ele) => {\r\n ret[ele.eventName] = (e) => {\r\n this.evalShowExpressionForFooterElements()\r\n this.$emit(ele.eventName || 'click', { ...e, exposed: this.exposedMethods })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events,\r\n [BUILT_IN_EVENT_NAMES.NEXT]: this[BUILT_IN_EVENT_NAMES.NEXT],\r\n [BUILT_IN_EVENT_NAMES.PREVIOUS]: this[BUILT_IN_EVENT_NAMES.PREVIOUS],\r\n [BUILT_IN_EVENT_NAMES.SUBMIT]: this[BUILT_IN_EVENT_NAMES.SUBMIT]\r\n }\r\n },\r\n activeIndex () {\r\n const { activeIndex } = this.stepMeta\r\n return activeIndex\r\n },\r\n elements () {\r\n const { elements } = this.stepMeta\r\n return elements\r\n },\r\n scopedSlotsNames () {\r\n const slotNames = this.elements.map(item => item.key)\r\n return slotNames\r\n },\r\n exposedMethods () {\r\n return {\r\n slotRef: this.currentSlotComponentRef,\r\n setCurrentStep: this.setCurrentStep,\r\n next: this.nextStep,\r\n prev: this.prevStep,\r\n current: this.current\r\n }\r\n }\r\n },\r\n watch: {\r\n activeIndex: {\r\n handler (idx) {\r\n this.current = idx\r\n },\r\n immediate: true\r\n },\r\n current: {\r\n handler () {\r\n this.$nextTick(() => {\r\n this.currentSlotComponentRef = this.getCurrentSlotComponentRef()\r\n })\r\n },\r\n immediate: true\r\n }\r\n },\r\n created () {\r\n const { elements } = this.footerMeta\r\n this.innerFooterElements = elements.call(this)\r\n this.evalShowExpressionForFooterElements()\r\n },\r\n methods: {\r\n executeExpression (expression) {\r\n if (type.isBool(expression)) return expression\r\n if (type.isEmpty(expression)) return false\r\n return parse(expression, { ...this.expressionData })\r\n },\r\n evalShowExpressionForFooterElements () {\r\n this.innerFooterElements = this.innerFooterElements.map(element => {\r\n const { show = true, key, eventName } = element\r\n if(key == BUILT_IN_EVENT_NAMES.SUBMIT || eventName == BUILT_IN_EVENT_NAMES.SUBMIT) {\r\n // built in submit button should according to the route meta disabled\r\n this.$set(element, '_show', this.executeExpression(show, this.expressionData) && !this.routeMetaDisabled)\r\n return element\r\n }\r\n show && this.$set(element, '_show', this.executeExpression(show, this.expressionData))\r\n return element\r\n })\r\n },\r\n getCurrentSlotComponentRef () {\r\n const includeMetaCmp = this.$children.find(child => child.meta)\r\n if (!includeMetaCmp) return null\r\n const { $children: components } = includeMetaCmp\r\n const target = components.find(cmp => cmp.$options._componentTag === 'ele-tpl')\r\n return target.getModel ? target.getModel() : null\r\n },\r\n setCurrentStep (index) {\r\n this.current = index\r\n this.evalShowExpressionForFooterElements()\r\n },\r\n nextStep () {\r\n if (this.current >= this.elements.length - 1) return\r\n this.current ++\r\n this.evalShowExpressionForFooterElements()\r\n },\r\n prevStep () {\r\n if (this.current <= 0) return\r\n this.current --\r\n this.evalShowExpressionForFooterElements()\r\n },\r\n [BUILT_IN_EVENT_NAMES.NEXT] (props) {\r\n this.$emit(BUILT_IN_EVENT_NAMES.NEXT, { ...props, exposed: { ...this.exposedMethods } })\r\n },\r\n [BUILT_IN_EVENT_NAMES.PREVIOUS] (props) {\r\n this.$emit(BUILT_IN_EVENT_NAMES.PREVIOUS, { ...props, exposed: { ...this.exposedMethods } })\r\n },\r\n [BUILT_IN_EVENT_NAMES.SUBMIT] (props) {\r\n const currentComponent = this.getCurrentSlotComponentRef() || {}\r\n const hasSubmitMethod = currentComponent.hasOwnProperty(BUILT_IN_EVENT_NAMES.SUBMIT)\r\n hasSubmitMethod && currentComponent[BUILT_IN_EVENT_NAMES.SUBMIT]()\r\n this.$emit(BUILT_IN_EVENT_NAMES.SUBMIT, { ...props, exposed: { ...this.exposedMethods } })\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele-step-model__wrapper {\r\n width: 100%;\r\n height: 100vh;\r\n position: relative;\r\n .ele-step-model__step--wrapper {\r\n width: 100%;\r\n height: 64px;\r\n padding: 16px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n background: #fff;\r\n .ele-steps {\r\n .ant-steps-item {\r\n text-align: left;\r\n }\r\n }\r\n }\r\n .ele-step-model__content--wrapper {\r\n width: 100%;\r\n width: 100%;\r\n margin-top: 16px;\r\n margin-bottom: 16px;\r\n height: calc(100vh - 64px - 64px - 16px - 16px);\r\n overflow: auto;\r\n }\r\n .ele-step-model__footer--wrapper {\r\n width: 100%;\r\n height: 64px;\r\n background: #fff;\r\n position: absolute;\r\n bottom: 0;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: end;\r\n }\r\n}\r\n</style>import meta from '@/views/tree-table-page/meta'import meta from '@/views/tree-table-page/meta'\r\n\r\n",".ele-step-model__wrapper {\n width: 100%;\n height: 100vh;\n position: relative;\n}\n.ele-step-model__wrapper .ele-step-model__step--wrapper {\n width: 100%;\n height: 64px;\n padding: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n background: #fff;\n}\n.ele-step-model__wrapper .ele-step-model__step--wrapper .ele-steps .ant-steps-item {\n text-align: left;\n}\n.ele-step-model__wrapper .ele-step-model__content--wrapper {\n width: 100%;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n height: calc(100vh - 64px - 64px - 16px - 16px);\n overflow: auto;\n}\n.ele-step-model__wrapper .ele-step-model__footer--wrapper {\n width: 100%;\n height: 64px;\n background: #fff;\n position: absolute;\n bottom: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
4227
4721
|
|
|
4228
4722
|
};
|
|
4229
4723
|
/* scoped */
|
|
4230
|
-
const __vue_scope_id__$x = "data-v-
|
|
4724
|
+
const __vue_scope_id__$x = "data-v-3000c68c";
|
|
4231
4725
|
/* module identifier */
|
|
4232
4726
|
const __vue_module_identifier__$x = undefined;
|
|
4233
4727
|
/* functional template */
|
|
@@ -4332,7 +4826,7 @@ __vue_render__$w._withStripped = true;
|
|
|
4332
4826
|
/* style */
|
|
4333
4827
|
const __vue_inject_styles__$w = function (inject) {
|
|
4334
4828
|
if (!inject) return
|
|
4335
|
-
inject("data-v-
|
|
4829
|
+
inject("data-v-18f3cb29_0", { source: ".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n.margin-t-8 {\n margin-top: 8px;\n}\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,qBAAqB;AACvB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AAEA;EACE,eAAe;AACjB;AAEA;EACE,+BAA+B;EAC/B,sCAAsC;EACtC,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,uCAAuC;EACvC,uCAAuC;EACvC,mDAAmD;EACnD,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;EACrC,2CAA2C;EAC3C,6BAA6B;EAC7B,iCAAiC;EACjC,qDAAqD;EACrD,kDAAkD;EAClD,gDAAgD;EAChD,gCAAgC;EAChC,uCAAuC;EACvC,yBAAyB;EACzB,yBAAyB;EACzB,oCAAoC;AACtC;AAEA;EACE,4DAA4D;AAC9D;AAEA;EACE,4DAA4D;AAC9D;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n\n.margin-t-8 {\n margin-top: 8px;\n}\n\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
4336
4830
|
|
|
4337
4831
|
};
|
|
4338
4832
|
/* scoped */
|
|
@@ -5113,11 +5607,11 @@ __vue_render__$v._withStripped = true;
|
|
|
5113
5607
|
/* style */
|
|
5114
5608
|
const __vue_inject_styles__$v = function (inject) {
|
|
5115
5609
|
if (!inject) return
|
|
5116
|
-
inject("data-v-5bd17709_0", { source: ".ele__form--wrapper[data-v-5bd17709] {\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/form/src/index.vue","index.vue"],"names":[],"mappings":"AA0TA;EACA,gBAAA;ACzTA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"ele__form--wrapper\">\n <a-form :form=\"form\" layout=\"vertical\" class=\"ant-advanced-search-form\">\n <a-row :gutter=\"24\">\n <template v-for=\"ele in elements\">\n <a-col v-if=\"executeExpression(ele._show)\" :span=\"ele.span\" :key=\"ele.name\">\n <template v-if=\"ele.type == 'Input'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-input \n @change=\"onChange($event, ele)\" \n :disabled=\"executeExpression(ele._disabled)\" \n :max-length=\"ele.maxLength\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-input>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'Textarea'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-textarea \n @change=\"onChange($event, ele)\"\n :max-length=\"ele.maxLength\"\n :autosize=\"ele.autosize\"\n :disabled=\"executeExpression(ele._disabled)\"\n :allow-clear=\"ele.allowClear\"\n :placeholder=\"ele.placeholder\"\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\"\n style=\"width:100%;\">\n </ele-textarea>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'Select'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-select \n :data-source=\"ele.optionList\" \n :disabled=\"executeExpression(ele._disabled)\"\n :multiple=\"ele.multiple\"\n :mode=\"ele.mode\"\n :code=\"ele.code\"\n :init=\"ele.init\"\n :url=\"ele.url\"\n :params=\"ele.params\" \n @change=\"onChange($event, ele)\"\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-select>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'ele-upload'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-upload v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n :ext=\"ele.ext\"\n :multiple=\"ele.multiple\"\n :accept=\"ele.accept\"\n :extensions=\"ele.extensions\"\n :size=\"ele.size\"\n :icon=\"ele.icon\"\n :url=\"ele.url\"\n :message=\"ele.message\" \n style=\"width:100%;\">\n </ele-upload>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'ele-date-range'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-date-range \n :disabled=\"executeExpression(ele._disabled)\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-date-range>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'ele-date'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-date\n :format=\"ele.format\"\n :mode=\"ele.mode\"\n :show-time=\"ele.showTime\"\n :show-today=\"ele.showToday\"\n :value-format=\"ele.valueFormat\"\n :disabled=\"executeExpression(ele._disabled)\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-date>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'SelectEntity'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-select-entity \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-select-entity>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'InputNumber' || ele.type == 'ele-input-number'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-input-number \n @change=\"onChange($event, ele)\" \n :precision=\"ele.precision\" \n :disabled=\"executeExpression(ele._disabled)\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n v-bind=\"ele.props\" \n style=\"width:100%;\">\n </ele-input-number>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'Checkbox'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-checkbox \n :data-source=\"ele.optionList\" \n :disabled=\"executeExpression(ele._disabled)\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-checkbox>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'Radio'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-radio \n @change=\"onChange($event, ele)\" \n :disabled=\"executeExpression(ele._disabled)\" \n :data-source=\"ele.optionList\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-radio>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'ele-form-img-crop'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-form-img-crop\n @change=\"onChange($event, ele)\"\n :width=\"ele.width\"\n :height=\"ele.height\"\n :modal-title=\"ele.modalTitle\"\n :cropper-config=\"ele.cropperConfig\"\n :uploadFileConfig=\"ele.uploadFileConfig\"\n :oper-text=\"ele.operText\"\n :disabled=\"executeExpression(ele._disabled)\" \n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-form-img-crop>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'ele-tree-select'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-tree-select\n @change=\"onChange($event, ele)\"\n :disabled=\"executeExpression(ele._disabled)\"\n v-bind=\"ele.meta\"\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-tree-select>\n </a-form-item>\n </template>\n <template v-else-if=\"ele.type == 'ele-select-entity-modal-table'\">\n <a-form-item :label=\"`${ele.label}:`\">\n <ele-select-entity-modal-table\n @change=\"onChange($event, ele)\"\n :disabled=\"executeExpression(ele._disabled)\"\n v-bind=\"ele.meta\"\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \n style=\"width:100%;\">\n </ele-select-entity-modal-table>\n </a-form-item>\n </template>\n </a-col>\n </template>\n </a-row>\n </a-form>\n </div>\n</template>\n\n<script>\nimport { parse } from '@idooel/expression'\nimport { type } from '@idooel/shared'\nimport { CONTEXT } from '../../utils'\nexport default {\n name: 'ele-form',\n props: {\n value: {\n type: Object,\n default: () => ({})\n },\n disabled: {\n type: [Boolean, String],\n default: '_routeMeta.disabled'\n },\n formName: {\n type: [Number, String],\n default: 'coordinated'\n },\n elements: {\n type: Array,\n default: () => []\n }\n },\n data () {\n return {\n formModel: {}\n }\n },\n inject: {\n [CONTEXT]: {\n default: () => (() => ({}))\n }\n },\n computed: {\n contextData () {\n return this[CONTEXT].call(this)\n },\n globalDisabled () {\n return this.executeExpression(this.disabled)\n },\n form () {\n const ref = this.$form.createForm(this, { name: this.formName })\n return ref\n },\n exposedMethods () {\n return {\n setFieldsValue: this.setFieldsValue,\n getFieldsValue: this.getFieldsValue\n }\n }\n },\n created () {\n this.setDefaultValues()\n },\n methods: {\n setFormModel (props = {}) {\n this.formModel = props\n this.dispatchExpression()\n },\n rebuildRules (rules = []) {\n //TODO\n rules.map(rule => {\n const { validator } = rule\n if (validator) {\n validator.formModel = this.getFieldsValue()\n validator.exposed = this.exposedMethods\n }\n })\n return rules\n },\n dispatchExpression () {\n this.evalDisabledExpression()\n this.evalShowExpression()\n },\n evalDisabledExpression () {\n this.elements.forEach(ele => {\n if (this.globalDisabled) return this.$set(ele, '_disabled', true)\n const { disabled } = ele\n const ret = this.executeExpression(disabled)\n this.$set(ele, '_disabled', ret)\n })\n },\n evalShowExpression () {\n this.elements.forEach(ele => {\n const { show = true } = ele\n const ret = this.executeExpression(show)\n this.$set(ele, '_show', ret)\n })\n },\n executeExpression (expression) {\n if (type.isBool(expression)) return expression\n if (type.isEmpty(expression)) return false\n return parse(expression, { ...this.getFieldsValue(), ...this.formModel, _route: this.$route.query, _routeMeta: this.$route.meta })\n },\n onChange (value, props) {\n const { name } = props\n this.$set(this.formModel, name, value)\n this.dispatchExpression()\n this.setFieldsValue({ [name]: value })\n this.$emit('change', { value, props, exposed: { ...this.exposedMethods } })\n },\n collectDefaultValues () {\n const ret = this.elements.reduce((ret, props) => {\n const { name, defaultValue } = props\n if (defaultValue) {\n ret[name] = defaultValue\n }\n return ret\n }, {})\n return ret\n },\n //TODO deprecated in the future, need to be implemented in the outer component\n setDefaultValues () {\n const defaultValues = this.collectDefaultValues()\n this.setFormModel(defaultValues)\n this.setFieldsValue(defaultValues)\n },\n validateFields () {\n let ret = false\n this.form.validateFields((error, values) => {\n ret = !error\n })\n return ret\n },\n setFieldsValue (props = {}) {\n this.$nextTick(() => {\n this.form.setFieldsValue(props)\n })\n },\n getFieldsValue (fieldNames) {\n return this.form.getFieldsValue(fieldNames)\n }\n },\n mounted() {\n this.$emit('x:mounted', { setFormModel: this.setFormModel })\n this.dispatchExpression()\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.ele__form--wrapper {\n background: #fff;\n .ant-form-item {\n }\n}\n</style>",".ele__form--wrapper {\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
5610
|
+
inject("data-v-061511f7_0", { source: ".ele__form--wrapper[data-v-061511f7] {\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\form\\src\\index.vue","index.vue"],"names":[],"mappings":"AA0TA;EACA,gBAAA;ACzTA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele__form--wrapper\">\r\n <a-form :form=\"form\" layout=\"vertical\" class=\"ant-advanced-search-form\">\r\n <a-row :gutter=\"24\">\r\n <template v-for=\"ele in elements\">\r\n <a-col v-if=\"executeExpression(ele._show)\" :span=\"ele.span\" :key=\"ele.name\">\r\n <template v-if=\"ele.type == 'Input'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-input \r\n @change=\"onChange($event, ele)\" \r\n :disabled=\"executeExpression(ele._disabled)\" \r\n :max-length=\"ele.maxLength\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-input>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'Textarea'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-textarea \r\n @change=\"onChange($event, ele)\"\r\n :max-length=\"ele.maxLength\"\r\n :autosize=\"ele.autosize\"\r\n :disabled=\"executeExpression(ele._disabled)\"\r\n :allow-clear=\"ele.allowClear\"\r\n :placeholder=\"ele.placeholder\"\r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\"\r\n style=\"width:100%;\">\r\n </ele-textarea>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'Select'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-select \r\n :data-source=\"ele.optionList\" \r\n :disabled=\"executeExpression(ele._disabled)\"\r\n :multiple=\"ele.multiple\"\r\n :mode=\"ele.mode\"\r\n :code=\"ele.code\"\r\n :init=\"ele.init\"\r\n :url=\"ele.url\"\r\n :params=\"ele.params\" \r\n @change=\"onChange($event, ele)\"\r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-select>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'ele-upload'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-upload v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n :ext=\"ele.ext\"\r\n :multiple=\"ele.multiple\"\r\n :accept=\"ele.accept\"\r\n :extensions=\"ele.extensions\"\r\n :size=\"ele.size\"\r\n :icon=\"ele.icon\"\r\n :url=\"ele.url\"\r\n :message=\"ele.message\" \r\n style=\"width:100%;\">\r\n </ele-upload>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'ele-date-range'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-date-range \r\n :disabled=\"executeExpression(ele._disabled)\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-date-range>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'ele-date'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-date\r\n :format=\"ele.format\"\r\n :mode=\"ele.mode\"\r\n :show-time=\"ele.showTime\"\r\n :show-today=\"ele.showToday\"\r\n :value-format=\"ele.valueFormat\"\r\n :disabled=\"executeExpression(ele._disabled)\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-date>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'SelectEntity'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-select-entity \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-select-entity>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'InputNumber' || ele.type == 'ele-input-number'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-input-number \r\n @change=\"onChange($event, ele)\" \r\n :precision=\"ele.precision\" \r\n :disabled=\"executeExpression(ele._disabled)\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n v-bind=\"ele.props\" \r\n style=\"width:100%;\">\r\n </ele-input-number>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'Checkbox'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-checkbox \r\n :data-source=\"ele.optionList\" \r\n :disabled=\"executeExpression(ele._disabled)\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-checkbox>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'Radio'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-radio \r\n @change=\"onChange($event, ele)\" \r\n :disabled=\"executeExpression(ele._disabled)\" \r\n :data-source=\"ele.optionList\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-radio>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'ele-form-img-crop'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-form-img-crop\r\n @change=\"onChange($event, ele)\"\r\n :width=\"ele.width\"\r\n :height=\"ele.height\"\r\n :modal-title=\"ele.modalTitle\"\r\n :cropper-config=\"ele.cropperConfig\"\r\n :uploadFileConfig=\"ele.uploadFileConfig\"\r\n :oper-text=\"ele.operText\"\r\n :disabled=\"executeExpression(ele._disabled)\" \r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-form-img-crop>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'ele-tree-select'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-tree-select\r\n @change=\"onChange($event, ele)\"\r\n :disabled=\"executeExpression(ele._disabled)\"\r\n v-bind=\"ele.meta\"\r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-tree-select>\r\n </a-form-item>\r\n </template>\r\n <template v-else-if=\"ele.type == 'ele-select-entity-modal-table'\">\r\n <a-form-item :label=\"`${ele.label}:`\">\r\n <ele-select-entity-modal-table\r\n @change=\"onChange($event, ele)\"\r\n :disabled=\"executeExpression(ele._disabled)\"\r\n v-bind=\"ele.meta\"\r\n v-decorator=\"[ele.name, { rules: rebuildRules(ele.rules) }]\" \r\n style=\"width:100%;\">\r\n </ele-select-entity-modal-table>\r\n </a-form-item>\r\n </template>\r\n </a-col>\r\n </template>\r\n </a-row>\r\n </a-form>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { parse } from '@idooel/expression'\r\nimport { type } from '@idooel/shared'\r\nimport { CONTEXT } from '../../utils'\r\nexport default {\r\n name: 'ele-form',\r\n props: {\r\n value: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n disabled: {\r\n type: [Boolean, String],\r\n default: '_routeMeta.disabled'\r\n },\r\n formName: {\r\n type: [Number, String],\r\n default: 'coordinated'\r\n },\r\n elements: {\r\n type: Array,\r\n default: () => []\r\n }\r\n },\r\n data () {\r\n return {\r\n formModel: {}\r\n }\r\n },\r\n inject: {\r\n [CONTEXT]: {\r\n default: () => (() => ({}))\r\n }\r\n },\r\n computed: {\r\n contextData () {\r\n return this[CONTEXT].call(this)\r\n },\r\n globalDisabled () {\r\n return this.executeExpression(this.disabled)\r\n },\r\n form () {\r\n const ref = this.$form.createForm(this, { name: this.formName })\r\n return ref\r\n },\r\n exposedMethods () {\r\n return {\r\n setFieldsValue: this.setFieldsValue,\r\n getFieldsValue: this.getFieldsValue\r\n }\r\n }\r\n },\r\n created () {\r\n this.setDefaultValues()\r\n },\r\n methods: {\r\n setFormModel (props = {}) {\r\n this.formModel = props\r\n this.dispatchExpression()\r\n },\r\n rebuildRules (rules = []) {\r\n //TODO\r\n rules.map(rule => {\r\n const { validator } = rule\r\n if (validator) {\r\n validator.formModel = this.getFieldsValue()\r\n validator.exposed = this.exposedMethods\r\n }\r\n })\r\n return rules\r\n },\r\n dispatchExpression () {\r\n this.evalDisabledExpression()\r\n this.evalShowExpression()\r\n },\r\n evalDisabledExpression () {\r\n this.elements.forEach(ele => {\r\n if (this.globalDisabled) return this.$set(ele, '_disabled', true)\r\n const { disabled } = ele\r\n const ret = this.executeExpression(disabled)\r\n this.$set(ele, '_disabled', ret)\r\n })\r\n },\r\n evalShowExpression () {\r\n this.elements.forEach(ele => {\r\n const { show = true } = ele\r\n const ret = this.executeExpression(show)\r\n this.$set(ele, '_show', ret)\r\n })\r\n },\r\n executeExpression (expression) {\r\n if (type.isBool(expression)) return expression\r\n if (type.isEmpty(expression)) return false\r\n return parse(expression, { ...this.getFieldsValue(), ...this.formModel, _route: this.$route.query, _routeMeta: this.$route.meta })\r\n },\r\n onChange (value, props) {\r\n const { name } = props\r\n this.$set(this.formModel, name, value)\r\n this.dispatchExpression()\r\n this.setFieldsValue({ [name]: value })\r\n this.$emit('change', { value, props, exposed: { ...this.exposedMethods } })\r\n },\r\n collectDefaultValues () {\r\n const ret = this.elements.reduce((ret, props) => {\r\n const { name, defaultValue } = props\r\n if (defaultValue) {\r\n ret[name] = defaultValue\r\n }\r\n return ret\r\n }, {})\r\n return ret\r\n },\r\n //TODO deprecated in the future, need to be implemented in the outer component\r\n setDefaultValues () {\r\n const defaultValues = this.collectDefaultValues()\r\n this.setFormModel(defaultValues)\r\n this.setFieldsValue(defaultValues)\r\n },\r\n validateFields () {\r\n let ret = false\r\n this.form.validateFields((error, values) => {\r\n ret = !error\r\n })\r\n return ret\r\n },\r\n setFieldsValue (props = {}) {\r\n this.$nextTick(() => {\r\n this.form.setFieldsValue(props)\r\n })\r\n },\r\n getFieldsValue (fieldNames) {\r\n return this.form.getFieldsValue(fieldNames)\r\n }\r\n },\r\n mounted() {\r\n this.$emit('x:mounted', { setFormModel: this.setFormModel })\r\n this.dispatchExpression()\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele__form--wrapper {\r\n background: #fff;\r\n .ant-form-item {\r\n }\r\n}\r\n</style>",".ele__form--wrapper {\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
5117
5611
|
|
|
5118
5612
|
};
|
|
5119
5613
|
/* scoped */
|
|
5120
|
-
const __vue_scope_id__$v = "data-v-
|
|
5614
|
+
const __vue_scope_id__$v = "data-v-061511f7";
|
|
5121
5615
|
/* module identifier */
|
|
5122
5616
|
const __vue_module_identifier__$v = undefined;
|
|
5123
5617
|
/* functional template */
|
|
@@ -5209,11 +5703,11 @@ __vue_render__$u._withStripped = true;
|
|
|
5209
5703
|
/* style */
|
|
5210
5704
|
const __vue_inject_styles__$u = function (inject) {
|
|
5211
5705
|
if (!inject) return
|
|
5212
|
-
inject("data-v-
|
|
5706
|
+
inject("data-v-83e11950_0", { source: ".ele-alert[data-v-83e11950] {\n text-align: left !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\alert\\src\\index.vue","index.vue"],"names":[],"mappings":"AA0CA;EACA,2BAAA;ACzCA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <a-alert\r\n class=\"ele-alert\"\r\n :message=\"message\" \r\n :description=\"description\" \r\n :type=\"type\"\r\n :closable=\"closable\"\r\n :closeText=\"closeText\"\r\n :show-icon=\"showIcon\" />\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-alert',\r\n props: {\r\n type: {\r\n type: String,\r\n default: 'success'\r\n },\r\n showIcon: {\r\n type: Boolean,\r\n default: true\r\n },\r\n message: {\r\n type: String,\r\n default: 'Success Tips'\r\n },\r\n description: {\r\n type: String\r\n },\r\n closable: {\r\n type: Boolean,\r\n default: true\r\n },\r\n closeText: {\r\n type: String\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele-alert {\r\n text-align: left !important;\r\n}\r\n</style>",".ele-alert {\n text-align: left !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
5213
5707
|
|
|
5214
5708
|
};
|
|
5215
5709
|
/* scoped */
|
|
5216
|
-
const __vue_scope_id__$u = "data-v-
|
|
5710
|
+
const __vue_scope_id__$u = "data-v-83e11950";
|
|
5217
5711
|
/* module identifier */
|
|
5218
5712
|
const __vue_module_identifier__$u = undefined;
|
|
5219
5713
|
/* functional template */
|
|
@@ -5240,7 +5734,66 @@ __vue_render__$u._withStripped = true;
|
|
|
5240
5734
|
__vue_component__$u.install = Vue => Vue.component(__vue_component__$u.name, __vue_component__$u);
|
|
5241
5735
|
|
|
5242
5736
|
//
|
|
5243
|
-
|
|
5737
|
+
|
|
5738
|
+
// 常量定义
|
|
5739
|
+
const CONSTANTS = {
|
|
5740
|
+
DEFAULT_URL: 'zuul/api-file/workbench/file',
|
|
5741
|
+
DEFAULT_ICON: '上传',
|
|
5742
|
+
DEFAULT_SIZE: 100,
|
|
5743
|
+
DEFAULT_MESSAGE: '单击或拖动文件到该区域以上传',
|
|
5744
|
+
DEFAULT_MAXIMUM: 20,
|
|
5745
|
+
BYTE_CONVERSION: 1024 * 1024,
|
|
5746
|
+
CHUNK_MIN_SIZE: 3 * 1024 * 1024,
|
|
5747
|
+
CHUNK_MAX_ACTIVE: 3,
|
|
5748
|
+
CHUNK_MAX_RETRIES: 5,
|
|
5749
|
+
SAVE_INTERVAL: 2000
|
|
5750
|
+
};
|
|
5751
|
+
|
|
5752
|
+
// 文件后缀图标映射
|
|
5753
|
+
const FILE_SUFFIX_ICONS = {
|
|
5754
|
+
'doc': {
|
|
5755
|
+
name: 'icon-doc'
|
|
5756
|
+
},
|
|
5757
|
+
'html': {
|
|
5758
|
+
name: 'icon-html'
|
|
5759
|
+
},
|
|
5760
|
+
'mp4': {
|
|
5761
|
+
name: 'icon-mp'
|
|
5762
|
+
},
|
|
5763
|
+
'pdf': {
|
|
5764
|
+
name: 'icon-pdf'
|
|
5765
|
+
},
|
|
5766
|
+
'ppt': {
|
|
5767
|
+
name: 'icon-ppt'
|
|
5768
|
+
},
|
|
5769
|
+
'psd': {
|
|
5770
|
+
name: 'icon-psd'
|
|
5771
|
+
},
|
|
5772
|
+
'rtf': {
|
|
5773
|
+
name: 'icon-rtf'
|
|
5774
|
+
},
|
|
5775
|
+
'txt': {
|
|
5776
|
+
name: 'icon-txt'
|
|
5777
|
+
},
|
|
5778
|
+
'vis': {
|
|
5779
|
+
name: 'icon-vis'
|
|
5780
|
+
},
|
|
5781
|
+
'xls': {
|
|
5782
|
+
name: 'icon-xls'
|
|
5783
|
+
},
|
|
5784
|
+
'xml': {
|
|
5785
|
+
name: 'icon-xml'
|
|
5786
|
+
},
|
|
5787
|
+
'zip': {
|
|
5788
|
+
name: 'icon-zip'
|
|
5789
|
+
},
|
|
5790
|
+
'jpg': {
|
|
5791
|
+
name: 'icon-img'
|
|
5792
|
+
},
|
|
5793
|
+
'mp3': {
|
|
5794
|
+
name: 'icon-mp1'
|
|
5795
|
+
}
|
|
5796
|
+
};
|
|
5244
5797
|
var script$t = {
|
|
5245
5798
|
name: 'ele-upload',
|
|
5246
5799
|
components: {
|
|
@@ -5253,20 +5806,19 @@ var script$t = {
|
|
|
5253
5806
|
props: {
|
|
5254
5807
|
url: {
|
|
5255
5808
|
type: String,
|
|
5256
|
-
|
|
5257
|
-
default: `zuul/api-file/workbench/file`
|
|
5809
|
+
default: CONSTANTS.DEFAULT_URL
|
|
5258
5810
|
},
|
|
5259
5811
|
icon: {
|
|
5260
5812
|
type: String,
|
|
5261
|
-
default:
|
|
5813
|
+
default: CONSTANTS.DEFAULT_ICON
|
|
5262
5814
|
},
|
|
5263
5815
|
size: {
|
|
5264
5816
|
type: Number,
|
|
5265
|
-
default:
|
|
5817
|
+
default: CONSTANTS.DEFAULT_SIZE
|
|
5266
5818
|
},
|
|
5267
5819
|
message: {
|
|
5268
5820
|
type: String,
|
|
5269
|
-
default:
|
|
5821
|
+
default: CONSTANTS.DEFAULT_MESSAGE
|
|
5270
5822
|
},
|
|
5271
5823
|
ext: {
|
|
5272
5824
|
type: String
|
|
@@ -5279,7 +5831,7 @@ var script$t = {
|
|
|
5279
5831
|
},
|
|
5280
5832
|
maximum: {
|
|
5281
5833
|
type: Number,
|
|
5282
|
-
default:
|
|
5834
|
+
default: CONSTANTS.DEFAULT_MAXIMUM
|
|
5283
5835
|
},
|
|
5284
5836
|
multiple: {
|
|
5285
5837
|
type: Boolean,
|
|
@@ -5295,8 +5847,7 @@ var script$t = {
|
|
|
5295
5847
|
querys: {
|
|
5296
5848
|
type: Object,
|
|
5297
5849
|
default: () => ({
|
|
5298
|
-
_csrf: localStorage.getItem('token')
|
|
5299
|
-
_t: new Date().valueOf()
|
|
5850
|
+
_csrf: localStorage.getItem('token')
|
|
5300
5851
|
})
|
|
5301
5852
|
},
|
|
5302
5853
|
headers: {
|
|
@@ -5307,7 +5858,7 @@ var script$t = {
|
|
|
5307
5858
|
},
|
|
5308
5859
|
byteConversion: {
|
|
5309
5860
|
type: Number,
|
|
5310
|
-
default:
|
|
5861
|
+
default: CONSTANTS.BYTE_CONVERSION
|
|
5311
5862
|
},
|
|
5312
5863
|
chunkEnabled: {
|
|
5313
5864
|
type: Boolean,
|
|
@@ -5316,37 +5867,68 @@ var script$t = {
|
|
|
5316
5867
|
},
|
|
5317
5868
|
data() {
|
|
5318
5869
|
return {
|
|
5870
|
+
// 文件状态管理
|
|
5319
5871
|
files: [],
|
|
5872
|
+
// vue-upload-component 管理的文件
|
|
5320
5873
|
buildedFiles: [],
|
|
5874
|
+
// 已构建完成的文件列表
|
|
5875
|
+
|
|
5876
|
+
// 上传状态管理
|
|
5321
5877
|
saveToServerAsyncPageTimer: null,
|
|
5322
|
-
uploadRefId: null
|
|
5878
|
+
uploadRefId: null,
|
|
5879
|
+
// 多选且外部无值时,预先生成 groupId,确保首次上传参数完整
|
|
5880
|
+
groupId: this.multiple && !this.value ? v4() : null,
|
|
5881
|
+
//TODO
|
|
5882
|
+
iconIsZhWrod: false
|
|
5323
5883
|
};
|
|
5324
5884
|
},
|
|
5885
|
+
created() {
|
|
5886
|
+
// 多文件模式下,如果没有外部 groupId,则生成一个
|
|
5887
|
+
if (this.multiple && !this.value) {
|
|
5888
|
+
this.groupId = v4();
|
|
5889
|
+
console.log('Created with new groupId:', this.groupId);
|
|
5890
|
+
}
|
|
5891
|
+
},
|
|
5325
5892
|
watch: {
|
|
5326
5893
|
value: {
|
|
5327
5894
|
async handler(value) {
|
|
5328
|
-
if (type.
|
|
5329
|
-
this.
|
|
5330
|
-
|
|
5895
|
+
if (type.isEmpty(value)) {
|
|
5896
|
+
this.resetFiles();
|
|
5897
|
+
} else if (this.multiple) {
|
|
5898
|
+
this.handleMultipleFileValue(value);
|
|
5331
5899
|
} else {
|
|
5332
|
-
|
|
5333
|
-
this.fetchFileWithFileId();
|
|
5900
|
+
this.handleSingleFileValue();
|
|
5334
5901
|
}
|
|
5335
5902
|
},
|
|
5336
5903
|
immediate: true
|
|
5337
5904
|
}
|
|
5338
5905
|
},
|
|
5339
5906
|
computed: {
|
|
5907
|
+
// ==================== 基础配置 ====================
|
|
5340
5908
|
prefixPath() {
|
|
5341
5909
|
return window.prefixPath;
|
|
5342
5910
|
},
|
|
5343
|
-
|
|
5911
|
+
uploadRef() {
|
|
5912
|
+
if (!this.uploadRefId) {
|
|
5913
|
+
this.uploadRefId = `uploadRef_${v4()}`;
|
|
5914
|
+
}
|
|
5915
|
+
return this.uploadRefId;
|
|
5916
|
+
},
|
|
5917
|
+
iconIsZhWord() {
|
|
5344
5918
|
return type.isZhWord(this.icon);
|
|
5345
5919
|
},
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5920
|
+
// ==================== 上传配置 ====================
|
|
5921
|
+
uploadParams() {
|
|
5922
|
+
return this.multiple ? {
|
|
5923
|
+
groupID: this.groupId
|
|
5924
|
+
} : {};
|
|
5925
|
+
},
|
|
5926
|
+
fileSizeLimit() {
|
|
5927
|
+
return this.size * this.byteConversion;
|
|
5928
|
+
},
|
|
5929
|
+
postAction() {
|
|
5930
|
+
const queryString = route.toQueryString(this.querys);
|
|
5931
|
+
return `${this.prefixPath}${this.url}?${queryString}`;
|
|
5350
5932
|
},
|
|
5351
5933
|
chunkConfig() {
|
|
5352
5934
|
return {
|
|
@@ -5354,9 +5936,9 @@ var script$t = {
|
|
|
5354
5936
|
headers: {
|
|
5355
5937
|
...this.headers
|
|
5356
5938
|
},
|
|
5357
|
-
minSize:
|
|
5358
|
-
maxActive:
|
|
5359
|
-
maxRetries:
|
|
5939
|
+
minSize: CONSTANTS.CHUNK_MIN_SIZE,
|
|
5940
|
+
maxActive: CONSTANTS.CHUNK_MAX_ACTIVE,
|
|
5941
|
+
maxRetries: CONSTANTS.CHUNK_MAX_RETRIES,
|
|
5360
5942
|
startBody: {
|
|
5361
5943
|
override: true,
|
|
5362
5944
|
path: '/cw'
|
|
@@ -5371,185 +5953,425 @@ var script$t = {
|
|
|
5371
5953
|
}
|
|
5372
5954
|
};
|
|
5373
5955
|
},
|
|
5374
|
-
isFileUploadSuccessed() {
|
|
5375
|
-
return this.files.every(file => file.success);
|
|
5376
|
-
},
|
|
5377
|
-
isShowUploadContainer() {
|
|
5378
|
-
if (this.multiple) {
|
|
5379
|
-
if (this.isFileUploadSuccessed && this.buildedFiles.length >= this.maximum) {
|
|
5380
|
-
return false;
|
|
5381
|
-
} else {
|
|
5382
|
-
return true;
|
|
5383
|
-
}
|
|
5384
|
-
} else {
|
|
5385
|
-
const [file = {}] = this.buildedFiles;
|
|
5386
|
-
if (this.buildedFiles.length < 1) {
|
|
5387
|
-
return true;
|
|
5388
|
-
}
|
|
5389
|
-
if (this.isFileUploadSuccessed && this.buildedFiles.length >= 1 || !file.response) {
|
|
5390
|
-
return false;
|
|
5391
|
-
} else {
|
|
5392
|
-
return true;
|
|
5393
|
-
}
|
|
5394
|
-
}
|
|
5395
|
-
},
|
|
5396
5956
|
getMaximum() {
|
|
5397
5957
|
return this.multiple ? this.maximum : 1;
|
|
5398
5958
|
},
|
|
5399
|
-
|
|
5400
|
-
|
|
5959
|
+
// ==================== 文件状态 ====================
|
|
5960
|
+
uploadingFiles() {
|
|
5961
|
+
// 筛选条件:有进度信息 且 (未成功 或 成功但还没有fileID的切片上传文件)
|
|
5962
|
+
// 这样可以确保切片上传完成但异步保存未完成的文件继续显示,避免闪烁
|
|
5963
|
+
return this.files.filter(file => {
|
|
5964
|
+
if (file.progress === undefined) return false;
|
|
5965
|
+
if (!file.success) return true;
|
|
5966
|
+
|
|
5967
|
+
// 检查文件是否已经有 fileID(可能在 file.fileID 或 file.response.data.fileID)
|
|
5968
|
+
const hasFileID = file.fileID || file.response && file.response.data && file.response.data.fileID;
|
|
5969
|
+
|
|
5970
|
+
// 切片上传成功但还没有完成异步保存(没有fileID)的文件继续显示
|
|
5971
|
+
// 普通上传成功且已有 fileID 的文件不显示(会在 completedFiles 中显示)
|
|
5972
|
+
return file.success && !hasFileID;
|
|
5973
|
+
});
|
|
5401
5974
|
},
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
return `${this.prefixPath}${this.url}?${ret}`;
|
|
5975
|
+
completedFiles() {
|
|
5976
|
+
return this.buildedFiles.filter(file => file.fileID);
|
|
5405
5977
|
},
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5978
|
+
totalFiles() {
|
|
5979
|
+
return this.uploadingFiles.length + this.completedFiles.length;
|
|
5980
|
+
},
|
|
5981
|
+
isFileUploadSuccessed() {
|
|
5982
|
+
const currentUploadingFiles = this.files.filter(file => file.response !== undefined);
|
|
5983
|
+
if (currentUploadingFiles.length === 0) {
|
|
5984
|
+
return this.buildedFiles.length > 0;
|
|
5409
5985
|
}
|
|
5410
|
-
return
|
|
5986
|
+
return currentUploadingFiles.every(file => file.success);
|
|
5987
|
+
},
|
|
5988
|
+
isShowUploadContainer() {
|
|
5989
|
+
const maxFiles = this.multiple ? this.maximum : 1;
|
|
5990
|
+
return this.totalFiles < maxFiles;
|
|
5411
5991
|
},
|
|
5992
|
+
// ==================== 文件信息 ====================
|
|
5412
5993
|
fileSuffixIcon() {
|
|
5413
|
-
return
|
|
5414
|
-
'doc': {
|
|
5415
|
-
name: 'icon-doc'
|
|
5416
|
-
},
|
|
5417
|
-
'html': {
|
|
5418
|
-
name: 'icon-html'
|
|
5419
|
-
},
|
|
5420
|
-
'mp4': {
|
|
5421
|
-
name: 'icon-mp'
|
|
5422
|
-
},
|
|
5423
|
-
'pdf': {
|
|
5424
|
-
name: 'icon-pdf'
|
|
5425
|
-
},
|
|
5426
|
-
'ppt': {
|
|
5427
|
-
name: 'icon-ppt'
|
|
5428
|
-
},
|
|
5429
|
-
'psd': {
|
|
5430
|
-
name: 'icon-psd'
|
|
5431
|
-
},
|
|
5432
|
-
'rtf': {
|
|
5433
|
-
name: 'icon-rtf'
|
|
5434
|
-
},
|
|
5435
|
-
'txt': {
|
|
5436
|
-
name: 'icon-txt'
|
|
5437
|
-
},
|
|
5438
|
-
'vis': {
|
|
5439
|
-
name: 'icon-vis'
|
|
5440
|
-
},
|
|
5441
|
-
'xls': {
|
|
5442
|
-
name: 'icon-xls'
|
|
5443
|
-
},
|
|
5444
|
-
'xml': {
|
|
5445
|
-
name: 'icon-xml'
|
|
5446
|
-
},
|
|
5447
|
-
'zip': {
|
|
5448
|
-
name: 'icon-zip'
|
|
5449
|
-
},
|
|
5450
|
-
'jpg': {
|
|
5451
|
-
name: 'icon-img'
|
|
5452
|
-
},
|
|
5453
|
-
'mp3': {
|
|
5454
|
-
name: 'icon-mp1'
|
|
5455
|
-
}
|
|
5456
|
-
};
|
|
5994
|
+
return FILE_SUFFIX_ICONS;
|
|
5457
5995
|
},
|
|
5458
5996
|
fileIds() {
|
|
5459
|
-
|
|
5460
|
-
return
|
|
5461
|
-
}
|
|
5462
|
-
|
|
5997
|
+
if (this.multiple) {
|
|
5998
|
+
return this.groupId;
|
|
5999
|
+
} else {
|
|
6000
|
+
const fileIds = this.buildedFiles.map(file => file.fileID);
|
|
6001
|
+
return fileIds[0];
|
|
6002
|
+
}
|
|
5463
6003
|
},
|
|
5464
6004
|
fileResponseData() {
|
|
5465
6005
|
return this.multiple ? this.buildedFiles : this.buildedFiles[0];
|
|
5466
6006
|
}
|
|
5467
6007
|
},
|
|
5468
6008
|
methods: {
|
|
5469
|
-
|
|
6009
|
+
// ==================== 文件管理 ====================
|
|
6010
|
+
|
|
6011
|
+
/**
|
|
6012
|
+
* 从多个数组中移除文件
|
|
6013
|
+
*/
|
|
6014
|
+
removeFromArrays(file, arrays, key = 'fileID') {
|
|
6015
|
+
return arrays.map(arr => arr.filter(item => {
|
|
6016
|
+
// 如果 fileID 都存在且相等,则移除
|
|
6017
|
+
if (item[key] && file[key] && item[key] === file[key]) {
|
|
6018
|
+
return false;
|
|
6019
|
+
}
|
|
6020
|
+
// 如果 id 都存在且相等,则移除
|
|
6021
|
+
if (item.id && file.id && item.id === file.id) {
|
|
6022
|
+
return false;
|
|
6023
|
+
}
|
|
6024
|
+
// 如果文件名相同,也考虑移除(额外的安全检查)
|
|
6025
|
+
if (item.name && file.name && item.name === file.name && item[key] === file[key]) {
|
|
6026
|
+
return false;
|
|
6027
|
+
}
|
|
6028
|
+
// 否则保留
|
|
6029
|
+
return true;
|
|
6030
|
+
}));
|
|
6031
|
+
},
|
|
6032
|
+
/**
|
|
6033
|
+
* 检查文件是否为新文件
|
|
6034
|
+
*/
|
|
6035
|
+
isNewFile(newFile, existingFiles, key = 'fileID') {
|
|
6036
|
+
return newFile[key] && !existingFiles.some(existing => existing[key] === newFile[key]);
|
|
6037
|
+
},
|
|
6038
|
+
/**
|
|
6039
|
+
* 合并文件数据
|
|
6040
|
+
*/
|
|
6041
|
+
mergeFileData(uploadFile) {
|
|
6042
|
+
return {
|
|
6043
|
+
...uploadFile.response.data,
|
|
6044
|
+
...uploadFile
|
|
6045
|
+
};
|
|
6046
|
+
},
|
|
6047
|
+
/**
|
|
6048
|
+
* 初始化文件列表
|
|
6049
|
+
*/
|
|
6050
|
+
async initializeFiles() {
|
|
5470
6051
|
if (!this.value) return;
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
6052
|
+
if (this.multiple) {
|
|
6053
|
+
await this.fetchFilesWithGroupId();
|
|
6054
|
+
} else {
|
|
6055
|
+
await this.fetchFileWithFileId();
|
|
6056
|
+
}
|
|
6057
|
+
},
|
|
6058
|
+
/**
|
|
6059
|
+
* 获取多文件组
|
|
6060
|
+
*/
|
|
6061
|
+
async fetchFilesWithGroupId() {
|
|
6062
|
+
try {
|
|
6063
|
+
const response = await net.get(`/api-file/workbench/file/group/${this.value}`);
|
|
6064
|
+
const data = response.data || [];
|
|
6065
|
+
|
|
6066
|
+
// 只有在没有现有文件时才设置初始文件列表
|
|
6067
|
+
if (this.buildedFiles.length === 0) {
|
|
6068
|
+
this.buildedFiles = data;
|
|
6069
|
+
console.log('Initial files loaded:', this.buildedFiles.length);
|
|
6070
|
+
} else {
|
|
6071
|
+
console.log('Keep existing files, skip initial load');
|
|
6072
|
+
}
|
|
6073
|
+
} catch (error) {
|
|
6074
|
+
console.log('fetchFilesWithGroupId error:', error);
|
|
6075
|
+
console.log('Keep current files, do not clear due to API error');
|
|
6076
|
+
}
|
|
6077
|
+
},
|
|
6078
|
+
/**
|
|
6079
|
+
* 获取单文件
|
|
6080
|
+
*/
|
|
6081
|
+
async fetchFileWithFileId() {
|
|
6082
|
+
try {
|
|
6083
|
+
const response = await net.get(`/api-file/file/${this.value}`);
|
|
6084
|
+
const data = response.data;
|
|
5475
6085
|
this.buildedFiles = [data];
|
|
5476
6086
|
this.files = [data];
|
|
6087
|
+
} catch (error) {
|
|
6088
|
+
console.log('fetchFileWithFileId error:', error);
|
|
6089
|
+
}
|
|
6090
|
+
},
|
|
6091
|
+
/**
|
|
6092
|
+
* 调用服务器删除文件 API
|
|
6093
|
+
*/
|
|
6094
|
+
async deleteFiles(ids) {
|
|
6095
|
+
if (!ids) {
|
|
6096
|
+
console.warn('No fileID provided for deletion');
|
|
6097
|
+
return;
|
|
6098
|
+
}
|
|
6099
|
+
if (type.isArray(ids)) {
|
|
6100
|
+
ids = ids.join(',');
|
|
6101
|
+
}
|
|
6102
|
+
try {
|
|
6103
|
+
await net.remove(`/api-file/workbench/file?ids=${ids}`);
|
|
6104
|
+
console.log('File deleted from server:', ids);
|
|
6105
|
+
} catch (error) {
|
|
6106
|
+
console.error('Failed to delete file from server:', error);
|
|
6107
|
+
throw error; // 重新抛出错误,让调用方处理
|
|
6108
|
+
}
|
|
6109
|
+
},
|
|
6110
|
+
/**
|
|
6111
|
+
* 处理文件删除
|
|
6112
|
+
*/
|
|
6113
|
+
async handleClickDelete(file) {
|
|
6114
|
+
const {
|
|
6115
|
+
fileID,
|
|
6116
|
+
name
|
|
6117
|
+
} = file;
|
|
6118
|
+
console.log('Deleting file:', {
|
|
6119
|
+
name,
|
|
6120
|
+
fileID
|
|
5477
6121
|
});
|
|
6122
|
+
|
|
6123
|
+
// 先从上传组件中移除文件
|
|
6124
|
+
if (this.$refs[this.uploadRef]) {
|
|
6125
|
+
this.$refs[this.uploadRef].remove(file);
|
|
6126
|
+
}
|
|
6127
|
+
|
|
6128
|
+
// 从所有数组中移除文件
|
|
6129
|
+
[this.files, this.buildedFiles] = this.removeFromArrays(file, [this.files, this.buildedFiles]);
|
|
6130
|
+
console.log('After deletion - files:', this.files.length, 'buildedFiles:', this.buildedFiles.length);
|
|
6131
|
+
|
|
6132
|
+
// 如果有 fileID,调用服务器删除 API
|
|
6133
|
+
if (fileID) {
|
|
6134
|
+
try {
|
|
6135
|
+
await this.deleteFiles(fileID);
|
|
6136
|
+
} catch (error) {
|
|
6137
|
+
console.error('Failed to delete file from server:', error);
|
|
6138
|
+
// 可以选择提示用户或回滚操作
|
|
6139
|
+
// 这里仅记录错误,不影响前端显示
|
|
6140
|
+
}
|
|
6141
|
+
}
|
|
6142
|
+
|
|
6143
|
+
// 多文件模式下,如果删除最后一个文件,重置 groupId
|
|
6144
|
+
if (this.multiple && this.buildedFiles.length === 0) {
|
|
6145
|
+
this.groupId = null;
|
|
6146
|
+
console.log('Reset groupId after deleting last file');
|
|
6147
|
+
}
|
|
6148
|
+
|
|
6149
|
+
// 触发 change 事件
|
|
6150
|
+
this.$emit('change', this.fileIds);
|
|
5478
6151
|
},
|
|
6152
|
+
/**
|
|
6153
|
+
* 处理文件下载
|
|
6154
|
+
*/
|
|
5479
6155
|
handleClickDownload(file) {
|
|
5480
6156
|
const {
|
|
5481
6157
|
fileID: fileId
|
|
5482
6158
|
} = file;
|
|
5483
6159
|
window.open(`/api-file/workbench/file/stream/${fileId}?origin=true`);
|
|
5484
6160
|
},
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
6161
|
+
// ==================== 上传处理 ====================
|
|
6162
|
+
|
|
6163
|
+
/**
|
|
6164
|
+
* 处理文件上传状态变化
|
|
6165
|
+
*/
|
|
6166
|
+
onWatchFiles(files) {
|
|
6167
|
+
console.log('onWatchFiles called with files:', files.length);
|
|
6168
|
+
console.log('Current buildedFiles:', this.buildedFiles.length);
|
|
6169
|
+
|
|
6170
|
+
// 更新文件状态
|
|
6171
|
+
this.files = files;
|
|
6172
|
+
|
|
6173
|
+
// 处理已上传成功的文件
|
|
6174
|
+
this.processUploadedFiles(files);
|
|
6175
|
+
|
|
6176
|
+
// 检查上传是否完成
|
|
6177
|
+
if (this.isFileUploadSuccessed) {
|
|
6178
|
+
this.$emit('change', this.fileIds);
|
|
6179
|
+
this.$emit('on-success', this.fileResponseData);
|
|
6180
|
+
}
|
|
6181
|
+
},
|
|
6182
|
+
/**
|
|
6183
|
+
* 处理已上传成功的文件
|
|
6184
|
+
*/
|
|
6185
|
+
processUploadedFiles(files) {
|
|
6186
|
+
// 处理所有有响应的文件(包括正在上传和已完成的)
|
|
6187
|
+
const uploadedFiles = files.filter(file => file.response);
|
|
6188
|
+
const newBuildedFiles = uploadedFiles.map(file => this.mergeFileData(file));
|
|
6189
|
+
if (this.multiple) {
|
|
6190
|
+
this.processMultipleFiles(newBuildedFiles);
|
|
6191
|
+
} else {
|
|
6192
|
+
// 单文件模式:只保留最新的文件
|
|
6193
|
+
this.buildedFiles = newBuildedFiles;
|
|
6194
|
+
|
|
6195
|
+
// 从 files 数组中移除已完成的文件(普通上传),避免重复显示
|
|
6196
|
+
if (newBuildedFiles.length > 0 && newBuildedFiles[0].fileID) {
|
|
6197
|
+
this.$nextTick(() => {
|
|
6198
|
+
this.files = this.files.filter(file => {
|
|
6199
|
+
const fileID = file.fileID || file.response && file.response.data && file.response.data.fileID;
|
|
6200
|
+
return fileID !== newBuildedFiles[0].fileID;
|
|
6201
|
+
});
|
|
6202
|
+
console.log('Removed completed file from upload list (single mode)');
|
|
6203
|
+
});
|
|
6204
|
+
}
|
|
6205
|
+
}
|
|
6206
|
+
this.logFileStatus();
|
|
6207
|
+
},
|
|
6208
|
+
/**
|
|
6209
|
+
* 处理多文件模式
|
|
6210
|
+
*/
|
|
6211
|
+
processMultipleFiles(newBuildedFiles) {
|
|
6212
|
+
// 获取已存在的文件ID集合
|
|
6213
|
+
const existingFileIds = new Set(this.buildedFiles.map(f => f.fileID).filter(id => id));
|
|
6214
|
+
|
|
6215
|
+
// 过滤出真正的新文件
|
|
6216
|
+
const trulyNewFiles = newBuildedFiles.filter(newFile => this.isNewFile(newFile, this.buildedFiles));
|
|
6217
|
+
console.log('Existing fileIDs:', Array.from(existingFileIds));
|
|
6218
|
+
console.log('New uploaded files:', newBuildedFiles.map(f => ({
|
|
6219
|
+
name: f.name,
|
|
6220
|
+
fileID: f.fileID
|
|
6221
|
+
})));
|
|
6222
|
+
console.log('Truly new files:', trulyNewFiles.map(f => ({
|
|
6223
|
+
name: f.name,
|
|
6224
|
+
fileID: f.fileID
|
|
6225
|
+
})));
|
|
6226
|
+
|
|
6227
|
+
// 将新文件追加到现有文件列表
|
|
6228
|
+
if (trulyNewFiles.length > 0) {
|
|
6229
|
+
this.buildedFiles = [...this.buildedFiles, ...trulyNewFiles];
|
|
6230
|
+
console.log('Added new files, total buildedFiles:', this.buildedFiles.length);
|
|
6231
|
+
|
|
6232
|
+
// 从 files 数组中移除已完成的文件(普通上传),避免重复显示
|
|
6233
|
+
this.$nextTick(() => {
|
|
6234
|
+
const completedFileIDs = new Set(trulyNewFiles.map(f => f.fileID));
|
|
6235
|
+
this.files = this.files.filter(file => {
|
|
6236
|
+
const fileID = file.fileID || file.response && file.response.data && file.response.data.fileID;
|
|
6237
|
+
return !completedFileIDs.has(fileID);
|
|
6238
|
+
});
|
|
6239
|
+
console.log('Removed completed files from upload list');
|
|
6240
|
+
});
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6243
|
+
// 更新现有文件的状态(包括新添加的文件)
|
|
6244
|
+
this.updateExistingFiles(newBuildedFiles);
|
|
5493
6245
|
},
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
6246
|
+
/**
|
|
6247
|
+
* 更新现有文件状态
|
|
6248
|
+
*/
|
|
6249
|
+
updateExistingFiles(newBuildedFiles) {
|
|
6250
|
+
this.buildedFiles = this.buildedFiles.map(existingFile => {
|
|
6251
|
+
const updatedFile = newBuildedFiles.find(newFile => newFile.fileID === existingFile.fileID);
|
|
6252
|
+
return updatedFile ? {
|
|
6253
|
+
...existingFile,
|
|
6254
|
+
...updatedFile
|
|
6255
|
+
} : existingFile;
|
|
5501
6256
|
});
|
|
5502
|
-
if (this.isFileUploadSuccessed) {
|
|
5503
|
-
this.$emit('change', this.fileIds);
|
|
5504
|
-
this.$emit('on-success', this.fileResponseData);
|
|
5505
|
-
}
|
|
5506
6257
|
},
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
6258
|
+
/**
|
|
6259
|
+
* 记录文件状态日志
|
|
6260
|
+
*/
|
|
6261
|
+
logFileStatus() {
|
|
6262
|
+
console.log('Final buildedFiles:', this.buildedFiles.length);
|
|
6263
|
+
console.log('buildedFiles details:', this.buildedFiles.map(f => ({
|
|
6264
|
+
name: f.name,
|
|
6265
|
+
fileID: f.fileID,
|
|
6266
|
+
success: f.success
|
|
6267
|
+
})));
|
|
6268
|
+
console.log('Uploading files:', this.uploadingFiles.length);
|
|
6269
|
+
console.log('Completed files:', this.completedFiles.length);
|
|
6270
|
+
},
|
|
6271
|
+
// ==================== 异步处理 ====================
|
|
6272
|
+
|
|
6273
|
+
/**
|
|
6274
|
+
* 异步保存文件到服务器
|
|
6275
|
+
* @param {FormData} payloads - 上传参数
|
|
6276
|
+
* @param {Object} uploadingFile - 正在上传的文件对象(可选)
|
|
6277
|
+
*/
|
|
6278
|
+
async saveToServerAsyncPage(payloads = {}, uploadingFile = null) {
|
|
6279
|
+
try {
|
|
6280
|
+
const response = await net.post('zuul/api-file/workbench/file/temp/saveToServerAsyncPage', payloads, {
|
|
6281
|
+
headers: {
|
|
6282
|
+
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
|
6283
|
+
}
|
|
6284
|
+
});
|
|
5513
6285
|
const {
|
|
5514
6286
|
data
|
|
5515
|
-
} =
|
|
6287
|
+
} = response;
|
|
5516
6288
|
if (data !== 'saveToServerAsyncPage') {
|
|
5517
6289
|
clearInterval(this.saveToServerAsyncPageTimer);
|
|
6290
|
+
console.log('Chunk upload async save completed, file data:', data);
|
|
6291
|
+
const {
|
|
6292
|
+
fileID,
|
|
6293
|
+
groupID,
|
|
6294
|
+
name
|
|
6295
|
+
} = data;
|
|
6296
|
+
|
|
6297
|
+
// 根据上传模式处理文件信息
|
|
6298
|
+
if (this.multiple) {
|
|
6299
|
+
// 多文件模式:更新 groupID 并追加文件到列表
|
|
6300
|
+
if (groupID) {
|
|
6301
|
+
this.groupId = groupID;
|
|
6302
|
+
console.log('Updated groupId from server:', groupID);
|
|
6303
|
+
}
|
|
6304
|
+
|
|
6305
|
+
// 检查文件是否已存在,避免重复添加
|
|
6306
|
+
const fileExists = this.buildedFiles.some(file => file.fileID === fileID);
|
|
6307
|
+
if (!fileExists && fileID) {
|
|
6308
|
+
// 将服务器返回的完整文件信息追加到文件列表
|
|
6309
|
+
// 添加必要的显示属性
|
|
6310
|
+
const fileData = {
|
|
6311
|
+
...data,
|
|
6312
|
+
success: true // 标记为上传成功
|
|
6313
|
+
};
|
|
6314
|
+
|
|
6315
|
+
// 先添加到已完成列表
|
|
6316
|
+
this.buildedFiles.push(fileData);
|
|
6317
|
+
console.log('File added to list:', name, 'Total files:', this.buildedFiles.length);
|
|
6318
|
+
|
|
6319
|
+
// 使用 nextTick 确保视图更新后再移除上传列表中的文件,避免闪烁
|
|
6320
|
+
this.$nextTick(() => {
|
|
6321
|
+
// 从上传列表中精确移除对应的文件
|
|
6322
|
+
if (uploadingFile) {
|
|
6323
|
+
// 如果有文件对象引用,直接移除该文件
|
|
6324
|
+
this.files = this.files.filter(file => file.id !== uploadingFile.id);
|
|
6325
|
+
console.log('Removed uploading file by id:', uploadingFile.id);
|
|
6326
|
+
} else {
|
|
6327
|
+
// 否则根据文件名移除
|
|
6328
|
+
this.files = this.files.filter(file => file.name !== name);
|
|
6329
|
+
console.log('Removed uploading file by name:', name);
|
|
6330
|
+
}
|
|
6331
|
+
});
|
|
6332
|
+
|
|
6333
|
+
// 触发 change 事件通知父组件
|
|
6334
|
+
this.$emit('change', this.fileIds);
|
|
6335
|
+
this.$emit('on-success', this.fileResponseData);
|
|
6336
|
+
} else {
|
|
6337
|
+
console.log('File already exists or invalid fileID, skip adding');
|
|
6338
|
+
}
|
|
6339
|
+
} else {
|
|
6340
|
+
// 单文件模式:替换文件列表
|
|
6341
|
+
if (fileID) {
|
|
6342
|
+
const fileData = {
|
|
6343
|
+
...data,
|
|
6344
|
+
success: true // 标记为上传成功
|
|
6345
|
+
};
|
|
6346
|
+
this.buildedFiles = [fileData];
|
|
6347
|
+
this.files = []; // 清空上传列表
|
|
6348
|
+
console.log('Single file updated:', name);
|
|
6349
|
+
|
|
6350
|
+
// 触发 change 事件通知父组件更新 value
|
|
6351
|
+
this.$emit('change', fileID);
|
|
6352
|
+
this.$emit('on-success', data);
|
|
6353
|
+
}
|
|
6354
|
+
}
|
|
5518
6355
|
}
|
|
5519
|
-
})
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
// }
|
|
5530
|
-
// if (data !== 'saveToServerAsyncPage') {
|
|
5531
|
-
// clearInterval(timer)
|
|
5532
|
-
// const { fileID, size } = data
|
|
5533
|
-
// this.$emit('on-success', { ...data, fileId: fileID })
|
|
5534
|
-
// this.$Message.success('同步成功')
|
|
5535
|
-
// return { fileId: fileID, size }
|
|
5536
|
-
// }
|
|
5537
|
-
// })
|
|
5538
|
-
// return ret
|
|
5539
|
-
},
|
|
5540
|
-
// 验证文件类型
|
|
6356
|
+
} catch (error) {
|
|
6357
|
+
console.error('saveToServerAsyncPage error:', error);
|
|
6358
|
+
clearInterval(this.saveToServerAsyncPageTimer);
|
|
6359
|
+
}
|
|
6360
|
+
},
|
|
6361
|
+
// ==================== 文件验证 ====================
|
|
6362
|
+
|
|
6363
|
+
/**
|
|
6364
|
+
* 验证文件类型
|
|
6365
|
+
*/
|
|
5541
6366
|
validateFileType(file) {
|
|
5542
6367
|
if (!file || !file.name) {
|
|
5543
6368
|
console.log('文件或文件名不存在');
|
|
5544
6369
|
return false;
|
|
5545
6370
|
}
|
|
5546
|
-
const
|
|
5547
|
-
const fileExt = fileName.substring(fileName.lastIndexOf('.'));
|
|
6371
|
+
const fileExt = this.getFileExtension(file.name);
|
|
5548
6372
|
console.log('文件扩展名:', fileExt);
|
|
5549
|
-
|
|
5550
|
-
// 只检查 extensions,accept 由 vue-upload-component 处理
|
|
5551
6373
|
if (this.extensions) {
|
|
5552
|
-
const allowedExts = this.
|
|
6374
|
+
const allowedExts = this.getAllowedExtensions();
|
|
5553
6375
|
console.log('允许的扩展名:', allowedExts);
|
|
5554
6376
|
if (!allowedExts.includes(fileExt)) {
|
|
5555
6377
|
console.log('扩展名不在允许列表中');
|
|
@@ -5560,68 +6382,197 @@ var script$t = {
|
|
|
5560
6382
|
console.log('文件类型验证通过');
|
|
5561
6383
|
return true;
|
|
5562
6384
|
},
|
|
6385
|
+
/**
|
|
6386
|
+
* 获取文件扩展名
|
|
6387
|
+
*/
|
|
6388
|
+
getFileExtension(fileName) {
|
|
6389
|
+
return fileName.toLowerCase().substring(fileName.lastIndexOf('.'));
|
|
6390
|
+
},
|
|
6391
|
+
/**
|
|
6392
|
+
* 获取允许的扩展名列表
|
|
6393
|
+
*/
|
|
6394
|
+
getAllowedExtensions() {
|
|
6395
|
+
return this.extensions.toLowerCase().split(',').map(ext => ext.trim().startsWith('.') ? ext.trim() : `.${ext.trim()}`);
|
|
6396
|
+
},
|
|
6397
|
+
// ==================== 事件处理 ====================
|
|
6398
|
+
|
|
6399
|
+
/**
|
|
6400
|
+
* 处理文件输入事件
|
|
6401
|
+
*/
|
|
5563
6402
|
onWatchInputFiles(newFile, oldFile) {
|
|
5564
6403
|
if (newFile && !oldFile) {
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
// 验证文件类型
|
|
5571
|
-
if (!this.validateFileType(newFile)) {
|
|
5572
|
-
// 如果验证失败,移除文件
|
|
5573
|
-
console.log('文件类型验证失败,尝试移除文件');
|
|
5574
|
-
console.log('uploadRef:', this.uploadRef);
|
|
5575
|
-
console.log('$refs:', this.$refs);
|
|
5576
|
-
if (this.$refs[this.uploadRef]) {
|
|
5577
|
-
this.$refs[this.uploadRef].remove(newFile);
|
|
5578
|
-
} else {
|
|
5579
|
-
console.error('无法找到 uploadRef 引用');
|
|
5580
|
-
}
|
|
5581
|
-
return;
|
|
5582
|
-
}
|
|
5583
|
-
console.log('文件类型验证通过,继续上传');
|
|
5584
|
-
// 不要在这里 return,让文件继续走原有的上传逻辑
|
|
6404
|
+
this.handleFileAdd(newFile);
|
|
6405
|
+
} else if (newFile && oldFile) {
|
|
6406
|
+
this.handleFileUpdate(newFile);
|
|
6407
|
+
} else if (!newFile && oldFile) {
|
|
6408
|
+
this.handleFileDelete();
|
|
5585
6409
|
}
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
6410
|
+
|
|
6411
|
+
// 激活上传组件
|
|
6412
|
+
this.activateUploadComponent(newFile, oldFile);
|
|
6413
|
+
},
|
|
6414
|
+
/**
|
|
6415
|
+
* 生成唯一的随机数
|
|
6416
|
+
*/
|
|
6417
|
+
generateUniqueRandom() {
|
|
6418
|
+
// 使用 crypto.getRandomValues 生成更安全的随机数
|
|
6419
|
+
if (window.crypto && window.crypto.getRandomValues) {
|
|
6420
|
+
const array = new Uint32Array(1);
|
|
6421
|
+
window.crypto.getRandomValues(array);
|
|
6422
|
+
return array[0].toString();
|
|
6423
|
+
}
|
|
6424
|
+
// 降级方案:使用 Math.random 结合时间戳
|
|
6425
|
+
return Math.random().toString(36).substr(2, 9) + Date.now().toString(36);
|
|
6426
|
+
},
|
|
6427
|
+
/**
|
|
6428
|
+
* 处理文件添加
|
|
6429
|
+
*/
|
|
6430
|
+
handleFileAdd(newFile) {
|
|
6431
|
+
// 为每个文件生成唯一的随机数
|
|
6432
|
+
const uniqueRandom = this.generateUniqueRandom();
|
|
6433
|
+
newFile.postAction = newFile.postAction + '&_t=' + uniqueRandom;
|
|
6434
|
+
console.log('add file:', newFile);
|
|
6435
|
+
console.log('extensions:', this.extensions);
|
|
6436
|
+
console.log('accept:', this.accept);
|
|
6437
|
+
|
|
6438
|
+
// 生成或使用 groupId
|
|
6439
|
+
this.ensureGroupId();
|
|
6440
|
+
|
|
6441
|
+
// 验证文件类型
|
|
6442
|
+
if (!this.validateFileType(newFile)) {
|
|
6443
|
+
this.removeInvalidFile(newFile);
|
|
6444
|
+
return;
|
|
6445
|
+
}
|
|
6446
|
+
console.log('文件类型验证通过,继续上传');
|
|
6447
|
+
},
|
|
6448
|
+
/**
|
|
6449
|
+
* 处理文件更新
|
|
6450
|
+
*/
|
|
6451
|
+
handleFileUpdate(newFile) {
|
|
6452
|
+
console.log('update', newFile);
|
|
6453
|
+
const {
|
|
6454
|
+
success,
|
|
6455
|
+
active,
|
|
6456
|
+
chunk,
|
|
6457
|
+
response
|
|
6458
|
+
} = newFile;
|
|
6459
|
+
if (chunk && success && !active) {
|
|
6460
|
+
console.log('chunk end');
|
|
6461
|
+
this.handleChunkComplete(response, newFile);
|
|
6462
|
+
}
|
|
6463
|
+
},
|
|
6464
|
+
/**
|
|
6465
|
+
* 处理文件删除
|
|
6466
|
+
*/
|
|
6467
|
+
handleFileDelete() {
|
|
6468
|
+
console.log('delete');
|
|
6469
|
+
},
|
|
6470
|
+
/**
|
|
6471
|
+
* 确保 groupId 存在
|
|
6472
|
+
*/
|
|
6473
|
+
ensureGroupId() {
|
|
6474
|
+
console.log('onWatchInputFiles - multiple:', this.multiple, 'current groupId:', this.groupId);
|
|
6475
|
+
if (this.multiple && !this.groupId) {
|
|
6476
|
+
this.groupId = v4();
|
|
6477
|
+
console.log('Generated new groupId:', this.groupId);
|
|
6478
|
+
} else if (this.multiple && this.groupId) {
|
|
6479
|
+
console.log('Using existing groupId:', this.groupId);
|
|
5615
6480
|
}
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
6481
|
+
},
|
|
6482
|
+
/**
|
|
6483
|
+
* 移除无效文件
|
|
6484
|
+
*/
|
|
6485
|
+
removeInvalidFile(file) {
|
|
6486
|
+
console.log('文件类型验证失败,尝试移除文件');
|
|
6487
|
+
console.log('uploadRef:', this.uploadRef);
|
|
6488
|
+
console.log('$refs:', this.$refs);
|
|
6489
|
+
if (this.$refs[this.uploadRef]) {
|
|
6490
|
+
this.$refs[this.uploadRef].remove(file);
|
|
6491
|
+
} else {
|
|
6492
|
+
console.error('无法找到 uploadRef 引用');
|
|
5619
6493
|
}
|
|
6494
|
+
},
|
|
6495
|
+
/**
|
|
6496
|
+
* 处理分片上传完成
|
|
6497
|
+
* @param {Object} response - 上传响应
|
|
6498
|
+
* @param {Object} uploadingFile - 正在上传的文件对象(可选)
|
|
6499
|
+
*/
|
|
6500
|
+
handleChunkComplete(response, uploadingFile = null) {
|
|
6501
|
+
const {
|
|
6502
|
+
data: {
|
|
6503
|
+
file,
|
|
6504
|
+
type
|
|
6505
|
+
}
|
|
6506
|
+
} = response;
|
|
6507
|
+
const payloads = {
|
|
6508
|
+
filePath: file.match(/\/cw(.*)/) ? file.match(/\/cw(.*)/)[0] : void 0,
|
|
6509
|
+
asyncID: v4(),
|
|
6510
|
+
groupID: this.groupId,
|
|
6511
|
+
isDeleteOrigin: false,
|
|
6512
|
+
toImage: type === 'pdf',
|
|
6513
|
+
unzip: type === 'zip',
|
|
6514
|
+
_csrf: localStorage.getItem('token')
|
|
6515
|
+
};
|
|
6516
|
+
const formData = new FormData();
|
|
6517
|
+
Object.keys(payloads).forEach(key => {
|
|
6518
|
+
formData.append(key, payloads[key]);
|
|
6519
|
+
});
|
|
6520
|
+
|
|
6521
|
+
// 将上传文件对象传递给异步保存方法
|
|
6522
|
+
this.saveToServerAsyncPageTimer = setInterval(() => {
|
|
6523
|
+
this.saveToServerAsyncPage(formData, uploadingFile);
|
|
6524
|
+
}, CONSTANTS.SAVE_INTERVAL);
|
|
6525
|
+
},
|
|
6526
|
+
/**
|
|
6527
|
+
* 激活上传组件
|
|
6528
|
+
*/
|
|
6529
|
+
activateUploadComponent(newFile, oldFile) {
|
|
5620
6530
|
if (Boolean(newFile) !== Boolean(oldFile) || oldFile.error !== newFile.error) {
|
|
5621
6531
|
if (!this.$refs[this.uploadRef].active) {
|
|
5622
6532
|
this.$refs[this.uploadRef].active = true;
|
|
5623
6533
|
}
|
|
5624
6534
|
}
|
|
6535
|
+
},
|
|
6536
|
+
// ==================== 值变化处理 ====================
|
|
6537
|
+
|
|
6538
|
+
/**
|
|
6539
|
+
* 重置文件状态
|
|
6540
|
+
*/
|
|
6541
|
+
resetFiles() {
|
|
6542
|
+
this.files = [];
|
|
6543
|
+
this.buildedFiles = [];
|
|
6544
|
+
// 多选模式下保留或生成 groupId,避免首次上传为空
|
|
6545
|
+
if (this.multiple) {
|
|
6546
|
+
if (!this.groupId) {
|
|
6547
|
+
this.groupId = v4();
|
|
6548
|
+
console.log('Generated groupId in resetFiles:', this.groupId);
|
|
6549
|
+
} else {
|
|
6550
|
+
console.log('Preserve existing groupId in resetFiles:', this.groupId);
|
|
6551
|
+
}
|
|
6552
|
+
} else {
|
|
6553
|
+
this.groupId = null;
|
|
6554
|
+
console.log('Reset groupId to null (single mode)');
|
|
6555
|
+
}
|
|
6556
|
+
},
|
|
6557
|
+
/**
|
|
6558
|
+
* 处理多文件模式的值变化
|
|
6559
|
+
*/
|
|
6560
|
+
async handleMultipleFileValue(value) {
|
|
6561
|
+
// multiple - value 就是 groupId
|
|
6562
|
+
// 只有当 groupId 发生变化时才重新获取文件列表(初始化回显)
|
|
6563
|
+
if (this.groupId !== value) {
|
|
6564
|
+
this.groupId = value;
|
|
6565
|
+
console.log('Set groupId from external value:', this.groupId);
|
|
6566
|
+
await this.fetchFilesWithGroupId();
|
|
6567
|
+
} else {
|
|
6568
|
+
console.log('GroupId unchanged, skip fetchFilesWithGroupId');
|
|
6569
|
+
}
|
|
6570
|
+
},
|
|
6571
|
+
/**
|
|
6572
|
+
* 处理单文件模式的值变化
|
|
6573
|
+
*/
|
|
6574
|
+
async handleSingleFileValue() {
|
|
6575
|
+
await this.fetchFileWithFileId();
|
|
5625
6576
|
}
|
|
5626
6577
|
}
|
|
5627
6578
|
};
|
|
@@ -5662,6 +6613,7 @@ var __vue_render__$t = function () {
|
|
|
5662
6613
|
multiple: _vm.multiple,
|
|
5663
6614
|
headers: _vm.headers,
|
|
5664
6615
|
maximum: _vm.getMaximum,
|
|
6616
|
+
data: _vm.uploadParams,
|
|
5665
6617
|
},
|
|
5666
6618
|
on: { "input-file": _vm.onWatchInputFiles, input: _vm.onWatchFiles },
|
|
5667
6619
|
model: {
|
|
@@ -5711,57 +6663,114 @@ var __vue_render__$t = function () {
|
|
|
5711
6663
|
_c(
|
|
5712
6664
|
"section",
|
|
5713
6665
|
{ staticClass: "ele-files__wrapper" },
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
_c(
|
|
6666
|
+
[
|
|
6667
|
+
_vm._l(_vm.uploadingFiles, function (file, idx) {
|
|
6668
|
+
return _c(
|
|
5717
6669
|
"div",
|
|
5718
|
-
{ staticClass: "ele-
|
|
6670
|
+
{ key: "uploading-" + idx, staticClass: "ele-file__item" },
|
|
5719
6671
|
[
|
|
5720
|
-
_c(
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
6672
|
+
_c(
|
|
6673
|
+
"div",
|
|
6674
|
+
{ staticClass: "ele-file__suffix--icon" },
|
|
6675
|
+
[
|
|
6676
|
+
_c("ele-icon", {
|
|
6677
|
+
attrs: {
|
|
6678
|
+
type: _vm.fileSuffixIcon[file.suffix]
|
|
6679
|
+
? _vm.fileSuffixIcon[file.suffix].name
|
|
6680
|
+
: "icon-file",
|
|
6681
|
+
},
|
|
6682
|
+
}),
|
|
6683
|
+
],
|
|
6684
|
+
1
|
|
6685
|
+
),
|
|
6686
|
+
_vm._v(" "),
|
|
6687
|
+
_c("div", { staticClass: "ele-file__name" }, [
|
|
6688
|
+
_c("div", { staticClass: "ele-file__inner" }, [
|
|
6689
|
+
_vm._v(_vm._s(file.name)),
|
|
6690
|
+
]),
|
|
6691
|
+
_vm._v(" "),
|
|
6692
|
+
file.progress !== undefined
|
|
6693
|
+
? _c(
|
|
6694
|
+
"div",
|
|
6695
|
+
{ staticClass: "ele-uplpad__progress" },
|
|
6696
|
+
[
|
|
6697
|
+
_c("a-progress", {
|
|
6698
|
+
attrs: {
|
|
6699
|
+
strokeWidth: 2,
|
|
6700
|
+
percent: Number(file.progress),
|
|
6701
|
+
size: "small",
|
|
6702
|
+
},
|
|
6703
|
+
}),
|
|
6704
|
+
],
|
|
6705
|
+
1
|
|
6706
|
+
)
|
|
6707
|
+
: _vm._e(),
|
|
6708
|
+
]),
|
|
6709
|
+
_vm._v(" "),
|
|
6710
|
+
file.success || file.error
|
|
6711
|
+
? _c("div", { staticClass: "ele-file__delete" }, [
|
|
6712
|
+
_c("span", { staticClass: "ele-file__size" }, [
|
|
6713
|
+
_vm._v(
|
|
6714
|
+
_vm._s((file.size / _vm.byteConversion).toFixed(2)) +
|
|
6715
|
+
"M"
|
|
6716
|
+
),
|
|
6717
|
+
]),
|
|
6718
|
+
_vm._v(" "),
|
|
6719
|
+
_c(
|
|
6720
|
+
"span",
|
|
6721
|
+
{
|
|
6722
|
+
staticClass: "ele-file__delete--icon",
|
|
6723
|
+
on: {
|
|
6724
|
+
click: function ($event) {
|
|
6725
|
+
return _vm.handleClickDelete(file)
|
|
6726
|
+
},
|
|
6727
|
+
},
|
|
6728
|
+
},
|
|
6729
|
+
[_c("ele-icon", { attrs: { type: "delete" } })],
|
|
6730
|
+
1
|
|
6731
|
+
),
|
|
6732
|
+
])
|
|
6733
|
+
: _vm._e(),
|
|
6734
|
+
]
|
|
6735
|
+
)
|
|
6736
|
+
}),
|
|
6737
|
+
_vm._v(" "),
|
|
6738
|
+
_vm._l(_vm.completedFiles, function (file, idx) {
|
|
6739
|
+
return _c(
|
|
6740
|
+
"div",
|
|
6741
|
+
{ key: "completed-" + idx, staticClass: "ele-file__item" },
|
|
6742
|
+
[
|
|
6743
|
+
_c(
|
|
6744
|
+
"div",
|
|
6745
|
+
{ staticClass: "ele-file__suffix--icon" },
|
|
6746
|
+
[
|
|
6747
|
+
_c("ele-icon", {
|
|
6748
|
+
attrs: {
|
|
6749
|
+
type: _vm.fileSuffixIcon[file.suffix]
|
|
6750
|
+
? _vm.fileSuffixIcon[file.suffix].name
|
|
6751
|
+
: "icon-file",
|
|
6752
|
+
},
|
|
6753
|
+
}),
|
|
6754
|
+
],
|
|
6755
|
+
1
|
|
6756
|
+
),
|
|
6757
|
+
_vm._v(" "),
|
|
6758
|
+
_c("div", { staticClass: "ele-file__name" }, [
|
|
6759
|
+
_c(
|
|
5747
6760
|
"div",
|
|
5748
|
-
{
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
percent: Number(file.progress),
|
|
5754
|
-
size: "small",
|
|
6761
|
+
{
|
|
6762
|
+
staticClass: "ele-file__inner",
|
|
6763
|
+
on: {
|
|
6764
|
+
click: function ($event) {
|
|
6765
|
+
return _vm.handleClickDownload(file)
|
|
5755
6766
|
},
|
|
5756
|
-
}
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
)
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
file.success || file.error || !file.response
|
|
5764
|
-
? _c("div", { staticClass: "ele-file__delete" }, [
|
|
6767
|
+
},
|
|
6768
|
+
},
|
|
6769
|
+
[_vm._v(_vm._s(file.name))]
|
|
6770
|
+
),
|
|
6771
|
+
]),
|
|
6772
|
+
_vm._v(" "),
|
|
6773
|
+
_c("div", { staticClass: "ele-file__delete" }, [
|
|
5765
6774
|
_c("span", { staticClass: "ele-file__size" }, [
|
|
5766
6775
|
_vm._v(
|
|
5767
6776
|
_vm._s((file.size / _vm.byteConversion).toFixed(2)) + "M"
|
|
@@ -5781,11 +6790,12 @@ var __vue_render__$t = function () {
|
|
|
5781
6790
|
[_c("ele-icon", { attrs: { type: "delete" } })],
|
|
5782
6791
|
1
|
|
5783
6792
|
),
|
|
5784
|
-
])
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
6793
|
+
]),
|
|
6794
|
+
]
|
|
6795
|
+
)
|
|
6796
|
+
}),
|
|
6797
|
+
],
|
|
6798
|
+
2
|
|
5789
6799
|
),
|
|
5790
6800
|
],
|
|
5791
6801
|
1
|
|
@@ -5797,11 +6807,11 @@ __vue_render__$t._withStripped = true;
|
|
|
5797
6807
|
/* style */
|
|
5798
6808
|
const __vue_inject_styles__$t = function (inject) {
|
|
5799
6809
|
if (!inject) return
|
|
5800
|
-
inject("data-v-b00d3688_0", { source: "[data-v-b00d3688] .ele-upload__inner {\n opacity: 1 !important;\n cursor: pointer;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color) !important;\n border-radius: var(--idooel-form-border-radius);\n}\n[data-v-b00d3688] .ele-upload__inner:hover {\n border-color: var(--idooel-form-upload-border-hover-color);\n}\n.ele-upload__wrapper[data-v-b00d3688] {\n width: 100%;\n}\n.ele-upload__wrapper .ele-upload__area[data-v-b00d3688] {\n padding: 16px;\n width: 100%;\n height: 80px;\n display: flex;\n flex-direction: row;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon[data-v-b00d3688] {\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n font-size: 16x;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload[data-v-b00d3688] {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon[data-v-b00d3688] {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text[data-v-b00d3688] {\n margin-left: 16px;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__message[data-v-b00d3688] {\n font-size: 16px;\n color: var(--idoole-black-088);\n text-align: left;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__ext[data-v-b00d3688] {\n text-align: left;\n font-size: 14px;\n color: var(--idoole-black-06);\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item[data-v-b00d3688] {\n width: 100%;\n margin-top: 8px;\n padding: 8px 12px;\n border-radius: var(--idooel-form-border-radius);\n background: var(--idooel-form-upload-bg-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name[data-v-b00d3688] {\n flex: 1;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n font-size: 14px;\n margin-left: 8px;\n cursor: pointer;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name .ele-file__inner[data-v-b00d3688] {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete[data-v-b00d3688] {\n margin-left: 8px;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete .ele-file__delete--icon[data-v-b00d3688] {\n margin-left: 8px;\n cursor: pointer;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/upload/src/index.vue","index.vue"],"names":[],"mappings":"AA6ZA;EACA,qBAAA;EACA,eAAA;EACA,wDAAA;EACA,yDAAA;EAIA,+CAAA;AC/ZA;AD4ZA;EACA,0DAAA;AC1ZA;AD8ZA;EACA,WAAA;AC3ZA;AD4ZA;EACA,aAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;AC1ZA;AD2ZA;EACA,kCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,cAAA;ACzZA;AD0ZA;EACA,eAAA;EACA,kCAAA;ACxZA;AD0ZA;EACA,eAAA;EACA,kCAAA;ACxZA;AD2ZA;EACA,iBAAA;ACzZA;AD0ZA;EACA,eAAA;EACA,8BAAA;EACA,gBAAA;ACxZA;AD0ZA;EACA,gBAAA;EACA,eAAA;EACA,6BAAA;ACxZA;AD6ZA;EACA,WAAA;EACA,eAAA;EACA,iBAAA;EACA,+CAAA;EACA,8CAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AC3ZA;AD6ZA;EACA,OAAA;EACA,gBAAA;EACA,mBAAA;EACA,gBAAA;EACA,eAAA;EACA,gBAAA;EACA,eAAA;AC3ZA;AD4ZA;EACA,gBAAA;EACA,uBAAA;AC1ZA;AD6ZA;EACA,gBAAA;AC3ZA;AD4ZA;EACA,gBAAA;EACA,eAAA;AC1ZA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"ele-upload__wrapper\">\n <FileUpload\n class=\"ele-upload__inner\"\n v-show=\"isShowUploadContainer\"\n v-model=\"files\"\n :ref=\"uploadRef\"\n :drop=\"drop\"\n :chunk-enabled=\"chunkEnabled\"\n :chunk=\"chunkConfig\"\n :accept=\"accept\"\n :size=\"fileSizeLimit\"\n :post-action=\"postAction\"\n :multiple=\"multiple\"\n :headers=\"headers\"\n :maximum=\"getMaximum\"\n @input-file=\"onWatchInputFiles\"\n @input=\"onWatchFiles\"\n style=\"width: 100%;\">\n <section class=\"ele-upload__area\">\n <div class=\"ele-upload__area--icon\">\n <template v-if=\"iconIsZhWrod\">\n {{ icon }}\n </template>\n <template v-else>\n <ele-icon :type=\"icon\"></ele-icon>\n </template>\n </div>\n <div class=\"ele-upload__area--text\">\n <div class=\"ele-upload__message\" v-if=\"message\" v-html=\"message\"></div>\n <div class=\"ele-upload__message\" v-else>单击或拖动文件到该区域以上传</div>\n <div class=\"ele-upload__ext\" v-if=\"ext\" v-html=\"ext\"></div>\n <div class=\"ele-upload__ext\" v-else>文件小于{{ size }}M</div>\n </div>\n </section>\n </FileUpload>\n <section class=\"ele-files__wrapper\">\n <div class=\"ele-file__item\" v-for=\"(file, idx) in buildedFiles\" :key=\"idx\">\n <div class=\"ele-file__suffix--icon\">\n <ele-icon :type=\"fileSuffixIcon[file.suffix] ? fileSuffixIcon[file.suffix].name : 'icon-file'\"></ele-icon>\n </div>\n <div class=\"ele-file__name\">\n <div class=\"ele-file__inner\" @click=\"handleClickDownload(file)\">{{ file.name }}</div>\n <div v-if=\"(!file.success && file.progress)\" class=\"ele-uplpad__progress\">\n <a-progress :strokeWidth=\"2\" :percent=\"Number(file.progress)\" size=\"small\" />\n </div>\n </div>\n <div class=\"ele-file__delete\" v-if=\"file.success || file.error || !file.response\">\n <span class=\"ele-file__size\">{{ (file.size / byteConversion).toFixed(2) }}M</span>\n <span class=\"ele-file__delete--icon\" @click=\"handleClickDelete(file)\">\n <ele-icon type=\"delete\"></ele-icon>\n </span>\n </div>\n </div>\n </section>\n </div>\n</template>\n\n<script>\nimport FileUpload from 'vue-upload-component'\nimport { v4 as uuidv4 } from 'uuid'\nimport { route, net, type } from '@idooel/shared'\n// import { message } from 'ant-design-vue'\nexport default {\n name: 'ele-upload',\n components: {\n FileUpload\n },\n model: {\n prop: 'value',\n event: 'change'\n },\n props: {\n url: {\n type: String,\n //TODO\n default: `zuul/api-file/workbench/file`\n },\n icon: {\n type: String,\n default: '上传'\n },\n size: {\n type: Number,\n default: 100\n },\n message: {\n type: String,\n default: '单击或拖动文件到该区域以上传'\n },\n ext: {\n type: String\n },\n extensions: {\n type: String\n },\n accept: {\n type: String\n },\n maximum: {\n type: Number,\n default: 10\n },\n multiple: {\n type: Boolean,\n default: false\n },\n drop: {\n type: Boolean,\n default: true\n },\n value: {\n type: [String, Array]\n },\n querys: {\n type: Object,\n default: () => ({\n _csrf: localStorage.getItem('token'),\n _t: new Date().valueOf()\n })\n },\n headers: {\n type: Object,\n default: () => ({\n 'X-XSRF-TOKEN': localStorage.getItem('token')\n })\n },\n byteConversion: {\n type: Number,\n default: 1024 * 1024\n },\n chunkEnabled: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n files: [],\n buildedFiles: [],\n saveToServerAsyncPageTimer: null,\n uploadRefId: null\n }\n },\n watch: {\n value: {\n async handler (value) {\n if (type.isArray(value)) {\n // multiple\n } else if (type.isEmpty(value)) {\n this.files = []\n this.buildedFiles = []\n } else {\n // single\n this.fetchFileWithFileId()\n }\n },\n immediate: true\n }\n },\n computed: {\n prefixPath () {\n return window.prefixPath\n },\n iconIsZhWrod () {\n return type.isZhWord(this.icon)\n },\n getPayloads () {\n return {\n override: false\n }\n },\n chunkConfig () {\n return {\n action: `${this.prefixPath}zuul/api-file/workbench/file/temp/chunk/vue`,\n headers: {\n ...this.headers\n },\n minSize: 3 * this.byteConversion,\n maxActive: 3,\n maxRetries: 5,\n startBody: {\n override: true,\n path: '/cw'\n },\n uploadBody: {\n override: true,\n path: '/cw'\n },\n finishBody: {\n override: true,\n path: '/cw'\n }\n }\n },\n isFileUploadSuccessed () {\n return this.files.every(file => file.success)\n },\n isShowUploadContainer () {\n if (this.multiple) {\n if (this.isFileUploadSuccessed && this.buildedFiles.length >= this.maximum) {\n return false\n } else {\n return true\n }\n } else {\n const [file = {}] = this.buildedFiles\n if (this.buildedFiles.length < 1) {\n return true\n }\n if ((this.isFileUploadSuccessed && this.buildedFiles.length >= 1) || !file.response) {\n return false\n } else {\n return true\n }\n }\n },\n getMaximum () {\n return this.multiple ? this.maximum : 1\n },\n fileSizeLimit () {\n return this.size * this.byteConversion\n },\n postAction () {\n const ret = route.toQueryString(this.querys)\n return `${this.prefixPath}${this.url}?${ret}`\n },\n uploadRef () {\n if (!this.uploadRefId) {\n this.uploadRefId = `uploadRef_${uuidv4()}`\n }\n return this.uploadRefId\n },\n fileSuffixIcon () {\n return {\n 'doc': { name: 'icon-doc' },\n 'html': { name: 'icon-html' },\n 'mp4': { name: 'icon-mp' },\n 'pdf': { name: 'icon-pdf' },\n 'ppt': { name: 'icon-ppt' },\n 'psd': { name: 'icon-psd' },\n 'rtf': { name: 'icon-rtf' },\n 'txt': { name: 'icon-txt' },\n 'vis': { name: 'icon-vis' },\n 'xls': { name: 'icon-xls' },\n 'xml': { name: 'icon-xml' },\n 'zip': { name: 'icon-zip' },\n 'jpg': { name: 'icon-img' },\n 'mp3': { name: 'icon-mp1' },\n }\n },\n fileIds () {\n const fileIds = this.buildedFiles.map(file => {\n return file.fileID\n })\n return this.multiple ? fileIds : fileIds[0]\n },\n fileResponseData () {\n return this.multiple ? this.buildedFiles : this.buildedFiles[0]\n }\n },\n methods: {\n async fetchFileWithFileId () {\n if (!this.value) return\n await net.get(\n `/api-file/file/${this.value}`\n ).then(resp => {\n const { data } = resp\n this.buildedFiles = [data]\n this.files = [data]\n })\n },\n handleClickDownload (file) {\n const { fileID: fileId } = file\n window.open(`/api-file/workbench/file/stream/${fileId}?origin=true`)\n },\n handleClickDelete (file) {\n this.$refs[this.uploadRef].remove(file)\n const { fileID } = file\n this.files = this.files.filter(file => file.fileID !== fileID)\n this.buildedFiles = this.buildedFiles.filter(file => file.fileID !== fileID)\n this.$emit('change', this.fileIds)\n },\n onWatchFiles (files) {\n this.files = files\n this.buildedFiles = this.files.map(file => {\n return {\n ...file.response.data,\n ...file\n }\n })\n if (this.isFileUploadSuccessed) {\n this.$emit('change', this.fileIds)\n this.$emit('on-success', this.fileResponseData)\n }\n },\n async saveToServerAsyncPage (payloads = {}) {\n net.post('zuul/api-file/workbench/file/temp/saveToServerAsyncPage', payloads, { \n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'\n }\n }).then(resp =>{\n const { data } = resp\n if (data !== 'saveToServerAsyncPage') {\n clearInterval(this.saveToServerAsyncPageTimer)\n }\n })\n // const ret = await net.post({\n // url: 'zuul/api-file/workbench/file/temp/saveToServerAsyncPage',\n // method: 'POST',\n // data: { ...payloads }\n // }).then(resp => {\n // const { data: { data, code, message } } = resp\n // if (code !== '2000') {\n // this.$Message.error(message)\n // return\n // }\n // if (data !== 'saveToServerAsyncPage') {\n // clearInterval(timer)\n // const { fileID, size } = data\n // this.$emit('on-success', { ...data, fileId: fileID })\n // this.$Message.success('同步成功')\n // return { fileId: fileID, size }\n // }\n // })\n // return ret\n },\n // 验证文件类型\n validateFileType(file) {\n if (!file || !file.name) {\n console.log('文件或文件名不存在')\n return false\n }\n \n const fileName = file.name.toLowerCase()\n const fileExt = fileName.substring(fileName.lastIndexOf('.'))\n console.log('文件扩展名:', fileExt)\n \n // 只检查 extensions,accept 由 vue-upload-component 处理\n if (this.extensions) {\n const allowedExts = this.extensions.toLowerCase()\n .split(',')\n .map(ext => ext.trim().startsWith('.') ? ext.trim() : `.${ext.trim()}`)\n console.log('允许的扩展名:', allowedExts)\n \n if (!allowedExts.includes(fileExt)) {\n console.log('扩展名不在允许列表中')\n this.$message.error(`不支持的文件类型 \"${fileExt}\",请上传 ${this.extensions} 格式的文件`)\n return false\n }\n }\n \n console.log('文件类型验证通过')\n return true\n },\n onWatchInputFiles (newFile, oldFile) {\n if (newFile && !oldFile) {\n // add file\n console.log('add file:', newFile)\n console.log('extensions:', this.extensions)\n console.log('accept:', this.accept)\n \n // 验证文件类型\n if (!this.validateFileType(newFile)) {\n // 如果验证失败,移除文件\n console.log('文件类型验证失败,尝试移除文件')\n console.log('uploadRef:', this.uploadRef)\n console.log('$refs:', this.$refs)\n if (this.$refs[this.uploadRef]) {\n this.$refs[this.uploadRef].remove(newFile)\n } else {\n console.error('无法找到 uploadRef 引用')\n }\n return\n }\n console.log('文件类型验证通过,继续上传')\n // 不要在这里 return,让文件继续走原有的上传逻辑\n }\n if (newFile && oldFile) {\n // update file\n console.log('update', newFile)\n const { success, active, chunk, response } = newFile\n if (chunk && success && !active) {\n console.log('chunk end')\n const { data: { file, type } } = response\n const payloads = {\n filePath: file.match(/\\/cw(.*)/) ? file.match(/\\/cw(.*)/)[0] : void 0,\n asyncID: uuidv4(),\n isDeleteOrigin: false,\n toImage: type === 'pdf' ? true : false,\n unzip: type === 'zip' ? true : false,\n _csrf: localStorage.getItem('token')\n }\n this.saveToServerAsyncPageTimer = setInterval(() => {\n this.saveToServerAsyncPage(payloads)\n }, 2000)\n }\n }\n if (!newFile && oldFile) {\n // delete file\n console.log('delete')\n }\n if (Boolean(newFile) !== Boolean(oldFile) || oldFile.error !== newFile.error) {\n if (!this.$refs[this.uploadRef].active) {\n this.$refs[this.uploadRef].active = true\n }\n }\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n::v-deep .ele-upload__inner {\n opacity: 1 !important;\n cursor: pointer;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color) !important;\n &:hover {\n border-color: var(--idooel-form-upload-border-hover-color);\n }\n border-radius: var(--idooel-form-border-radius);\n}\n.ele-upload__wrapper {\n width: 100%;\n .ele-upload__area {\n padding: 16px;\n width: 100%;\n height: 80px;\n display: flex;\n flex-direction: row;\n .ele-upload__area--icon {\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n font-size: 16x;\n .anticon-cloud-upload {\n font-size: 48px;\n color: var(--idooel-primary-color);\n }\n .anticon {\n font-size: 48px;\n color: var(--idooel-primary-color);\n }\n }\n .ele-upload__area--text {\n margin-left: 16px;\n .ele-upload__message {\n font-size: 16px;\n color: var(--idoole-black-088);\n text-align: left;\n }\n .ele-upload__ext {\n text-align: left;\n font-size: 14px;\n color: var(--idoole-black-06);\n }\n }\n }\n .ele-files__wrapper {\n .ele-file__item {\n width: 100%;\n margin-top: 8px;\n padding: 8px 12px;\n border-radius: var(--idooel-form-border-radius);\n background: var(--idooel-form-upload-bg-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n .ele-file__suffix--icon {}\n .ele-file__name {\n flex: 1;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n font-size: 14px;\n margin-left: 8px;\n cursor: pointer;\n .ele-file__inner {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n .ele-file__delete {\n margin-left: 8px;\n .ele-file__delete--icon {\n margin-left: 8px;\n cursor: pointer;\n }\n }\n }\n }\n}\n</style>","::v-deep .ele-upload__inner {\n opacity: 1 !important;\n cursor: pointer;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color) !important;\n border-radius: var(--idooel-form-border-radius);\n}\n::v-deep .ele-upload__inner:hover {\n border-color: var(--idooel-form-upload-border-hover-color);\n}\n\n.ele-upload__wrapper {\n width: 100%;\n}\n.ele-upload__wrapper .ele-upload__area {\n padding: 16px;\n width: 100%;\n height: 80px;\n display: flex;\n flex-direction: row;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon {\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n font-size: 16x;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text {\n margin-left: 16px;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__message {\n font-size: 16px;\n color: var(--idoole-black-088);\n text-align: left;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n text-align: left;\n font-size: 14px;\n color: var(--idoole-black-06);\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item {\n width: 100%;\n margin-top: 8px;\n padding: 8px 12px;\n border-radius: var(--idooel-form-border-radius);\n background: var(--idooel-form-upload-bg-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name {\n flex: 1;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n font-size: 14px;\n margin-left: 8px;\n cursor: pointer;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name .ele-file__inner {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete {\n margin-left: 8px;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete .ele-file__delete--icon {\n margin-left: 8px;\n cursor: pointer;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
6810
|
+
inject("data-v-3db5c928_0", { source: "[data-v-3db5c928] .ele-upload__inner {\n opacity: 1 !important;\n cursor: pointer;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color) !important;\n}\n[data-v-3db5c928] .ele-upload__inner:hover {\n border-color: var(--idooel-form-upload-border-hover-color);\n}\n[data-v-3db5c928] .ele-upload__inner {\n border-radius: var(--idooel-form-border-radius);\n}\n.ele-upload__wrapper[data-v-3db5c928] {\n width: 100%;\n}\n.ele-upload__wrapper .ele-upload__area[data-v-3db5c928] {\n padding: 16px;\n width: 100%;\n height: 80px;\n display: flex;\n flex-direction: row;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon[data-v-3db5c928] {\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n font-size: 16x;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload[data-v-3db5c928] {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon[data-v-3db5c928] {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text[data-v-3db5c928] {\n margin-left: 16px;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__message[data-v-3db5c928] {\n font-size: 16px;\n color: var(--idoole-black-088);\n text-align: left;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__ext[data-v-3db5c928] {\n text-align: left;\n font-size: 14px;\n color: var(--idoole-black-06);\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item[data-v-3db5c928] {\n width: 100%;\n margin-top: 8px;\n padding: 8px 12px;\n border-radius: var(--idooel-form-border-radius);\n background: var(--idooel-form-upload-bg-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__suffix--icon[data-v-3db5c928] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name[data-v-3db5c928] {\n flex: 1;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n font-size: 14px;\n margin-left: 8px;\n cursor: pointer;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name .ele-file__inner[data-v-3db5c928] {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete[data-v-3db5c928] {\n margin-left: 8px;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete .ele-file__delete--icon[data-v-3db5c928] {\n margin-left: 8px;\n cursor: pointer;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\upload\\src\\index.vue","index.vue"],"names":[],"mappings":"AA+4BA;EACA,qBAAA;EACA,eAAA;EACA,wDAAA;EACA,yDAAA;AC94BA;AD+4BA;EACA,0DAAA;AC74BA;ADu4BA;EAQA,+CAAA;AC54BA;AD84BA;EACA,WAAA;AC34BA;AD44BA;EACA,aAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;AC14BA;AD24BA;EACA,kCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,cAAA;ACz4BA;AD04BA;EACA,eAAA;EACA,kCAAA;ACx4BA;AD04BA;EACA,eAAA;EACA,kCAAA;ACx4BA;AD24BA;EACA,iBAAA;ACz4BA;AD04BA;EACA,eAAA;EACA,8BAAA;EACA,gBAAA;ACx4BA;AD04BA;EACA,gBAAA;EACA,eAAA;EACA,6BAAA;ACx4BA;AD64BA;EACA,WAAA;EACA,eAAA;EACA,iBAAA;EACA,+CAAA;EACA,8CAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AC34BA;AD44BA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,WAAA;EACA,YAAA;AC14BA;AD44BA;EACA,OAAA;EACA,gBAAA;EACA,mBAAA;EACA,gBAAA;EACA,eAAA;EACA,gBAAA;EACA,eAAA;AC14BA;AD24BA;EACA,gBAAA;EACA,uBAAA;ACz4BA;AD44BA;EACA,gBAAA;AC14BA;AD24BA;EACA,gBAAA;EACA,eAAA;ACz4BA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele-upload__wrapper\">\r\n <FileUpload\r\n class=\"ele-upload__inner\"\r\n v-show=\"isShowUploadContainer\"\r\n v-model=\"files\"\r\n :ref=\"uploadRef\"\r\n :drop=\"drop\"\r\n :chunk-enabled=\"chunkEnabled\"\r\n :chunk=\"chunkConfig\"\r\n :accept=\"accept\"\r\n :size=\"fileSizeLimit\"\r\n :post-action=\"postAction\"\r\n :multiple=\"multiple\"\r\n :headers=\"headers\"\r\n :maximum=\"getMaximum\"\r\n :data=\"uploadParams\"\r\n @input-file=\"onWatchInputFiles\"\r\n @input=\"onWatchFiles\"\r\n style=\"width: 100%;\">\r\n <section class=\"ele-upload__area\">\r\n <div class=\"ele-upload__area--icon\">\r\n <template v-if=\"iconIsZhWrod\">\r\n {{ icon }}\r\n </template>\r\n <template v-else>\r\n <ele-icon :type=\"icon\"></ele-icon>\r\n </template>\r\n </div>\r\n <div class=\"ele-upload__area--text\">\r\n <div class=\"ele-upload__message\" v-if=\"message\" v-html=\"message\"></div>\r\n <div class=\"ele-upload__message\" v-else>单击或拖动文件到该区域以上传</div>\r\n <div class=\"ele-upload__ext\" v-if=\"ext\" v-html=\"ext\"></div>\r\n <div class=\"ele-upload__ext\" v-else>文件小于{{ size }}M</div>\r\n </div>\r\n </section>\r\n </FileUpload>\r\n <section class=\"ele-files__wrapper\">\r\n <!-- 显示正在上传的文件(有进度条) -->\r\n <div class=\"ele-file__item\" v-for=\"(file, idx) in uploadingFiles\" :key=\"`uploading-${idx}`\">\r\n <div class=\"ele-file__suffix--icon\">\r\n <ele-icon :type=\"fileSuffixIcon[file.suffix] ? fileSuffixIcon[file.suffix].name : 'icon-file'\"></ele-icon>\r\n </div>\r\n <div class=\"ele-file__name\">\r\n <div class=\"ele-file__inner\">{{ file.name }}</div>\r\n <div v-if=\"file.progress !== undefined\" class=\"ele-uplpad__progress\">\r\n <a-progress :strokeWidth=\"2\" :percent=\"Number(file.progress)\" size=\"small\" />\r\n </div>\r\n </div>\r\n <div class=\"ele-file__delete\" v-if=\"file.success || file.error\">\r\n <span class=\"ele-file__size\">{{ (file.size / byteConversion).toFixed(2) }}M</span>\r\n <span class=\"ele-file__delete--icon\" @click=\"handleClickDelete(file)\">\r\n <ele-icon type=\"delete\"></ele-icon>\r\n </span>\r\n </div>\r\n </div>\r\n \r\n <!-- 显示已上传完成的文件 -->\r\n <div class=\"ele-file__item\" v-for=\"(file, idx) in completedFiles\" :key=\"`completed-${idx}`\">\r\n <div class=\"ele-file__suffix--icon\">\r\n <ele-icon :type=\"fileSuffixIcon[file.suffix] ? fileSuffixIcon[file.suffix].name : 'icon-file'\"></ele-icon>\r\n </div>\r\n <div class=\"ele-file__name\">\r\n <div class=\"ele-file__inner\" @click=\"handleClickDownload(file)\">{{ file.name }}</div>\r\n </div>\r\n <div class=\"ele-file__delete\">\r\n <span class=\"ele-file__size\">{{ (file.size / byteConversion).toFixed(2) }}M</span>\r\n <span class=\"ele-file__delete--icon\" @click=\"handleClickDelete(file)\">\r\n <ele-icon type=\"delete\"></ele-icon>\r\n </span>\r\n </div>\r\n </div>\r\n </section>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport FileUpload from 'vue-upload-component'\r\nimport { v4 as uuidv4 } from 'uuid'\r\nimport { route, net, type } from '@idooel/shared'\r\n\r\n// 常量定义\r\nconst CONSTANTS = {\r\n DEFAULT_URL: 'zuul/api-file/workbench/file',\r\n DEFAULT_ICON: '上传',\r\n DEFAULT_SIZE: 100,\r\n DEFAULT_MESSAGE: '单击或拖动文件到该区域以上传',\r\n DEFAULT_MAXIMUM: 20,\r\n BYTE_CONVERSION: 1024 * 1024,\r\n CHUNK_MIN_SIZE: 3 * 1024 * 1024,\r\n CHUNK_MAX_ACTIVE: 3,\r\n CHUNK_MAX_RETRIES: 5,\r\n SAVE_INTERVAL: 2000\r\n}\r\n\r\n// 文件后缀图标映射\r\nconst FILE_SUFFIX_ICONS = {\r\n 'doc': { name: 'icon-doc' },\r\n 'html': { name: 'icon-html' },\r\n 'mp4': { name: 'icon-mp' },\r\n 'pdf': { name: 'icon-pdf' },\r\n 'ppt': { name: 'icon-ppt' },\r\n 'psd': { name: 'icon-psd' },\r\n 'rtf': { name: 'icon-rtf' },\r\n 'txt': { name: 'icon-txt' },\r\n 'vis': { name: 'icon-vis' },\r\n 'xls': { name: 'icon-xls' },\r\n 'xml': { name: 'icon-xml' },\r\n 'zip': { name: 'icon-zip' },\r\n 'jpg': { name: 'icon-img' },\r\n 'mp3': { name: 'icon-mp1' }\r\n}\r\n\r\nexport default {\r\n name: 'ele-upload',\r\n components: {\r\n FileUpload\r\n },\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n url: {\r\n type: String,\r\n default: CONSTANTS.DEFAULT_URL\r\n },\r\n icon: {\r\n type: String,\r\n default: CONSTANTS.DEFAULT_ICON\r\n },\r\n size: {\r\n type: Number,\r\n default: CONSTANTS.DEFAULT_SIZE\r\n },\r\n message: {\r\n type: String,\r\n default: CONSTANTS.DEFAULT_MESSAGE\r\n },\r\n ext: {\r\n type: String\r\n },\r\n extensions: {\r\n type: String\r\n },\r\n accept: {\r\n type: String\r\n },\r\n maximum: {\r\n type: Number,\r\n default: CONSTANTS.DEFAULT_MAXIMUM\r\n },\r\n multiple: {\r\n type: Boolean,\r\n default: false\r\n },\r\n drop: {\r\n type: Boolean,\r\n default: true\r\n },\r\n value: {\r\n type: [String, Array]\r\n },\r\n querys: {\r\n type: Object,\r\n default: () => ({\r\n _csrf: localStorage.getItem('token')\r\n })\r\n },\r\n headers: {\r\n type: Object,\r\n default: () => ({\r\n 'X-XSRF-TOKEN': localStorage.getItem('token')\r\n })\r\n },\r\n byteConversion: {\r\n type: Number,\r\n default: CONSTANTS.BYTE_CONVERSION\r\n },\r\n chunkEnabled: {\r\n type: Boolean,\r\n default: true\r\n }\r\n },\r\n data() {\r\n return {\r\n // 文件状态管理\r\n files: [], // vue-upload-component 管理的文件\r\n buildedFiles: [], // 已构建完成的文件列表\r\n \r\n // 上传状态管理\r\n saveToServerAsyncPageTimer: null,\r\n uploadRefId: null,\r\n // 多选且外部无值时,预先生成 groupId,确保首次上传参数完整\r\n groupId: (this.multiple && !this.value) ? uuidv4() : null,\r\n //TODO\r\n iconIsZhWrod: false\r\n }\r\n },\r\n created() {\r\n // 多文件模式下,如果没有外部 groupId,则生成一个\r\n if (this.multiple && !this.value) {\r\n this.groupId = uuidv4()\r\n console.log('Created with new groupId:', this.groupId)\r\n }\r\n },\r\n watch: {\r\n value: {\r\n async handler(value) {\r\n if (type.isEmpty(value)) {\r\n this.resetFiles()\r\n } else if (this.multiple) {\r\n this.handleMultipleFileValue(value)\r\n } else {\r\n this.handleSingleFileValue()\r\n }\r\n },\r\n immediate: true\r\n }\r\n },\r\n computed: {\r\n // ==================== 基础配置 ====================\r\n prefixPath() {\r\n return window.prefixPath\r\n },\r\n \r\n uploadRef() {\r\n if (!this.uploadRefId) {\r\n this.uploadRefId = `uploadRef_${uuidv4()}`\r\n }\r\n return this.uploadRefId\r\n },\r\n \r\n iconIsZhWord() {\r\n return type.isZhWord(this.icon)\r\n },\r\n \r\n // ==================== 上传配置 ====================\r\n uploadParams() {\r\n return this.multiple ? { groupID: this.groupId } : {}\r\n },\r\n \r\n fileSizeLimit() {\r\n return this.size * this.byteConversion\r\n },\r\n \r\n postAction() {\r\n const queryString = route.toQueryString(this.querys)\r\n return `${this.prefixPath}${this.url}?${queryString}`\r\n },\r\n \r\n chunkConfig() {\r\n return {\r\n action: `${this.prefixPath}zuul/api-file/workbench/file/temp/chunk/vue`,\r\n headers: { ...this.headers },\r\n minSize: CONSTANTS.CHUNK_MIN_SIZE,\r\n maxActive: CONSTANTS.CHUNK_MAX_ACTIVE,\r\n maxRetries: CONSTANTS.CHUNK_MAX_RETRIES,\r\n startBody: { override: true, path: '/cw' },\r\n uploadBody: { override: true, path: '/cw' },\r\n finishBody: { override: true, path: '/cw' }\r\n }\r\n },\r\n \r\n getMaximum() {\r\n return this.multiple ? this.maximum : 1\r\n },\r\n \r\n // ==================== 文件状态 ====================\r\n uploadingFiles() {\r\n // 筛选条件:有进度信息 且 (未成功 或 成功但还没有fileID的切片上传文件)\r\n // 这样可以确保切片上传完成但异步保存未完成的文件继续显示,避免闪烁\r\n return this.files.filter(file => {\r\n if (file.progress === undefined) return false\r\n if (!file.success) return true\r\n \r\n // 检查文件是否已经有 fileID(可能在 file.fileID 或 file.response.data.fileID)\r\n const hasFileID = file.fileID || (file.response && file.response.data && file.response.data.fileID)\r\n \r\n // 切片上传成功但还没有完成异步保存(没有fileID)的文件继续显示\r\n // 普通上传成功且已有 fileID 的文件不显示(会在 completedFiles 中显示)\r\n return file.success && !hasFileID\r\n })\r\n },\r\n \r\n completedFiles() {\r\n return this.buildedFiles.filter(file => file.fileID)\r\n },\r\n \r\n totalFiles() {\r\n return this.uploadingFiles.length + this.completedFiles.length\r\n },\r\n \r\n isFileUploadSuccessed() {\r\n const currentUploadingFiles = this.files.filter(file => file.response !== undefined)\r\n if (currentUploadingFiles.length === 0) {\r\n return this.buildedFiles.length > 0\r\n }\r\n return currentUploadingFiles.every(file => file.success)\r\n },\r\n \r\n isShowUploadContainer() {\r\n const maxFiles = this.multiple ? this.maximum : 1\r\n return this.totalFiles < maxFiles\r\n },\r\n \r\n // ==================== 文件信息 ====================\r\n fileSuffixIcon() {\r\n return FILE_SUFFIX_ICONS\r\n },\r\n \r\n fileIds() {\r\n if (this.multiple) {\r\n return this.groupId\r\n } else {\r\n const fileIds = this.buildedFiles.map(file => file.fileID)\r\n return fileIds[0]\r\n }\r\n },\r\n \r\n fileResponseData() {\r\n return this.multiple ? this.buildedFiles : this.buildedFiles[0]\r\n }\r\n },\r\n methods: {\r\n // ==================== 文件管理 ====================\r\n \r\n /**\r\n * 从多个数组中移除文件\r\n */\r\n removeFromArrays(file, arrays, key = 'fileID') {\r\n return arrays.map(arr => \r\n arr.filter(item => {\r\n // 如果 fileID 都存在且相等,则移除\r\n if (item[key] && file[key] && item[key] === file[key]) {\r\n return false\r\n }\r\n // 如果 id 都存在且相等,则移除\r\n if (item.id && file.id && item.id === file.id) {\r\n return false\r\n }\r\n // 如果文件名相同,也考虑移除(额外的安全检查)\r\n if (item.name && file.name && item.name === file.name && item[key] === file[key]) {\r\n return false\r\n }\r\n // 否则保留\r\n return true\r\n })\r\n )\r\n },\r\n \r\n /**\r\n * 检查文件是否为新文件\r\n */\r\n isNewFile(newFile, existingFiles, key = 'fileID') {\r\n return newFile[key] && !existingFiles.some(existing => existing[key] === newFile[key])\r\n },\r\n \r\n /**\r\n * 合并文件数据\r\n */\r\n mergeFileData(uploadFile) {\r\n return {\r\n ...uploadFile.response.data,\r\n ...uploadFile\r\n }\r\n },\r\n \r\n /**\r\n * 初始化文件列表\r\n */\r\n async initializeFiles() {\r\n if (!this.value) return\r\n \r\n if (this.multiple) {\r\n await this.fetchFilesWithGroupId()\r\n } else {\r\n await this.fetchFileWithFileId()\r\n }\r\n },\r\n \r\n /**\r\n * 获取多文件组\r\n */\r\n async fetchFilesWithGroupId() {\r\n try {\r\n const response = await net.get(`/api-file/workbench/file/group/${this.value}`)\r\n const data = response.data || []\r\n \r\n // 只有在没有现有文件时才设置初始文件列表\r\n if (this.buildedFiles.length === 0) {\r\n this.buildedFiles = data\r\n console.log('Initial files loaded:', this.buildedFiles.length)\r\n } else {\r\n console.log('Keep existing files, skip initial load')\r\n }\r\n } catch (error) {\r\n console.log('fetchFilesWithGroupId error:', error)\r\n console.log('Keep current files, do not clear due to API error')\r\n }\r\n },\r\n \r\n /**\r\n * 获取单文件\r\n */\r\n async fetchFileWithFileId() {\r\n try {\r\n const response = await net.get(`/api-file/file/${this.value}`)\r\n const data = response.data\r\n this.buildedFiles = [data]\r\n this.files = [data]\r\n } catch (error) {\r\n console.log('fetchFileWithFileId error:', error)\r\n }\r\n },\r\n\r\n /**\r\n * 调用服务器删除文件 API\r\n */\r\n async deleteFiles (ids) {\r\n if (!ids) {\r\n console.warn('No fileID provided for deletion')\r\n return\r\n }\r\n \r\n if (type.isArray(ids)) {\r\n ids = ids.join(',')\r\n }\r\n \r\n try {\r\n await net.remove(`/api-file/workbench/file?ids=${ids}`)\r\n console.log('File deleted from server:', ids)\r\n } catch (error) {\r\n console.error('Failed to delete file from server:', error)\r\n throw error // 重新抛出错误,让调用方处理\r\n }\r\n },\r\n \r\n /**\r\n * 处理文件删除\r\n */\r\n async handleClickDelete(file) {\r\n const { fileID, name } = file\r\n console.log('Deleting file:', { name, fileID })\r\n \r\n // 先从上传组件中移除文件\r\n if (this.$refs[this.uploadRef]) {\r\n this.$refs[this.uploadRef].remove(file)\r\n }\r\n \r\n // 从所有数组中移除文件\r\n [this.files, this.buildedFiles] = this.removeFromArrays(file, [this.files, this.buildedFiles])\r\n \r\n console.log('After deletion - files:', this.files.length, 'buildedFiles:', this.buildedFiles.length)\r\n \r\n // 如果有 fileID,调用服务器删除 API\r\n if (fileID) {\r\n try {\r\n await this.deleteFiles(fileID)\r\n } catch (error) {\r\n console.error('Failed to delete file from server:', error)\r\n // 可以选择提示用户或回滚操作\r\n // 这里仅记录错误,不影响前端显示\r\n }\r\n }\r\n \r\n // 多文件模式下,如果删除最后一个文件,重置 groupId\r\n if (this.multiple && this.buildedFiles.length === 0) {\r\n this.groupId = null\r\n console.log('Reset groupId after deleting last file')\r\n }\r\n \r\n // 触发 change 事件\r\n this.$emit('change', this.fileIds)\r\n },\r\n \r\n /**\r\n * 处理文件下载\r\n */\r\n handleClickDownload(file) {\r\n const { fileID: fileId } = file\r\n window.open(`/api-file/workbench/file/stream/${fileId}?origin=true`)\r\n },\r\n // ==================== 上传处理 ====================\r\n \r\n /**\r\n * 处理文件上传状态变化\r\n */\r\n onWatchFiles(files) {\r\n console.log('onWatchFiles called with files:', files.length)\r\n console.log('Current buildedFiles:', this.buildedFiles.length)\r\n \r\n // 更新文件状态\r\n this.files = files\r\n \r\n // 处理已上传成功的文件\r\n this.processUploadedFiles(files)\r\n \r\n // 检查上传是否完成\r\n if (this.isFileUploadSuccessed) {\r\n this.$emit('change', this.fileIds)\r\n this.$emit('on-success', this.fileResponseData)\r\n }\r\n },\r\n \r\n /**\r\n * 处理已上传成功的文件\r\n */\r\n processUploadedFiles(files) {\r\n // 处理所有有响应的文件(包括正在上传和已完成的)\r\n const uploadedFiles = files.filter(file => file.response)\r\n const newBuildedFiles = uploadedFiles.map(file => this.mergeFileData(file))\r\n \r\n if (this.multiple) {\r\n this.processMultipleFiles(newBuildedFiles)\r\n } else {\r\n // 单文件模式:只保留最新的文件\r\n this.buildedFiles = newBuildedFiles\r\n \r\n // 从 files 数组中移除已完成的文件(普通上传),避免重复显示\r\n if (newBuildedFiles.length > 0 && newBuildedFiles[0].fileID) {\r\n this.$nextTick(() => {\r\n this.files = this.files.filter(file => {\r\n const fileID = file.fileID || (file.response && file.response.data && file.response.data.fileID)\r\n return fileID !== newBuildedFiles[0].fileID\r\n })\r\n console.log('Removed completed file from upload list (single mode)')\r\n })\r\n }\r\n }\r\n \r\n this.logFileStatus()\r\n },\r\n \r\n /**\r\n * 处理多文件模式\r\n */\r\n processMultipleFiles(newBuildedFiles) {\r\n // 获取已存在的文件ID集合\r\n const existingFileIds = new Set(this.buildedFiles.map(f => f.fileID).filter(id => id))\r\n \r\n // 过滤出真正的新文件\r\n const trulyNewFiles = newBuildedFiles.filter(newFile => \r\n this.isNewFile(newFile, this.buildedFiles)\r\n )\r\n \r\n console.log('Existing fileIDs:', Array.from(existingFileIds))\r\n console.log('New uploaded files:', newBuildedFiles.map(f => ({ name: f.name, fileID: f.fileID })))\r\n console.log('Truly new files:', trulyNewFiles.map(f => ({ name: f.name, fileID: f.fileID })))\r\n \r\n // 将新文件追加到现有文件列表\r\n if (trulyNewFiles.length > 0) {\r\n this.buildedFiles = [...this.buildedFiles, ...trulyNewFiles]\r\n console.log('Added new files, total buildedFiles:', this.buildedFiles.length)\r\n \r\n // 从 files 数组中移除已完成的文件(普通上传),避免重复显示\r\n this.$nextTick(() => {\r\n const completedFileIDs = new Set(trulyNewFiles.map(f => f.fileID))\r\n this.files = this.files.filter(file => {\r\n const fileID = file.fileID || (file.response && file.response.data && file.response.data.fileID)\r\n return !completedFileIDs.has(fileID)\r\n })\r\n console.log('Removed completed files from upload list')\r\n })\r\n }\r\n \r\n // 更新现有文件的状态(包括新添加的文件)\r\n this.updateExistingFiles(newBuildedFiles)\r\n },\r\n \r\n /**\r\n * 更新现有文件状态\r\n */\r\n updateExistingFiles(newBuildedFiles) {\r\n this.buildedFiles = this.buildedFiles.map(existingFile => {\r\n const updatedFile = newBuildedFiles.find(newFile => newFile.fileID === existingFile.fileID)\r\n return updatedFile ? { ...existingFile, ...updatedFile } : existingFile\r\n })\r\n },\r\n \r\n /**\r\n * 记录文件状态日志\r\n */\r\n logFileStatus() {\r\n console.log('Final buildedFiles:', this.buildedFiles.length)\r\n console.log('buildedFiles details:', this.buildedFiles.map(f => ({ name: f.name, fileID: f.fileID, success: f.success })))\r\n console.log('Uploading files:', this.uploadingFiles.length)\r\n console.log('Completed files:', this.completedFiles.length)\r\n },\r\n // ==================== 异步处理 ====================\r\n \r\n /**\r\n * 异步保存文件到服务器\r\n * @param {FormData} payloads - 上传参数\r\n * @param {Object} uploadingFile - 正在上传的文件对象(可选)\r\n */\r\n async saveToServerAsyncPage(payloads = {}, uploadingFile = null) {\r\n try {\r\n const response = await net.post('zuul/api-file/workbench/file/temp/saveToServerAsyncPage', payloads, { \r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'\r\n }\r\n })\r\n \r\n const { data } = response\r\n if (data !== 'saveToServerAsyncPage') {\r\n clearInterval(this.saveToServerAsyncPageTimer)\r\n console.log('Chunk upload async save completed, file data:', data)\r\n \r\n const { fileID, groupID, name } = data\r\n \r\n // 根据上传模式处理文件信息\r\n if (this.multiple) {\r\n // 多文件模式:更新 groupID 并追加文件到列表\r\n if (groupID) {\r\n this.groupId = groupID\r\n console.log('Updated groupId from server:', groupID)\r\n }\r\n \r\n // 检查文件是否已存在,避免重复添加\r\n const fileExists = this.buildedFiles.some(file => file.fileID === fileID)\r\n if (!fileExists && fileID) {\r\n // 将服务器返回的完整文件信息追加到文件列表\r\n // 添加必要的显示属性\r\n const fileData = {\r\n ...data,\r\n success: true // 标记为上传成功\r\n }\r\n \r\n // 先添加到已完成列表\r\n this.buildedFiles.push(fileData)\r\n console.log('File added to list:', name, 'Total files:', this.buildedFiles.length)\r\n \r\n // 使用 nextTick 确保视图更新后再移除上传列表中的文件,避免闪烁\r\n this.$nextTick(() => {\r\n // 从上传列表中精确移除对应的文件\r\n if (uploadingFile) {\r\n // 如果有文件对象引用,直接移除该文件\r\n this.files = this.files.filter(file => file.id !== uploadingFile.id)\r\n console.log('Removed uploading file by id:', uploadingFile.id)\r\n } else {\r\n // 否则根据文件名移除\r\n this.files = this.files.filter(file => file.name !== name)\r\n console.log('Removed uploading file by name:', name)\r\n }\r\n })\r\n \r\n // 触发 change 事件通知父组件\r\n this.$emit('change', this.fileIds)\r\n this.$emit('on-success', this.fileResponseData)\r\n } else {\r\n console.log('File already exists or invalid fileID, skip adding')\r\n }\r\n } else {\r\n // 单文件模式:替换文件列表\r\n if (fileID) {\r\n const fileData = {\r\n ...data,\r\n success: true // 标记为上传成功\r\n }\r\n this.buildedFiles = [fileData]\r\n this.files = [] // 清空上传列表\r\n console.log('Single file updated:', name)\r\n \r\n // 触发 change 事件通知父组件更新 value\r\n this.$emit('change', fileID)\r\n this.$emit('on-success', data)\r\n }\r\n }\r\n }\r\n } catch (error) {\r\n console.error('saveToServerAsyncPage error:', error)\r\n clearInterval(this.saveToServerAsyncPageTimer)\r\n }\r\n },\r\n \r\n // ==================== 文件验证 ====================\r\n \r\n /**\r\n * 验证文件类型\r\n */\r\n validateFileType(file) {\r\n if (!file || !file.name) {\r\n console.log('文件或文件名不存在')\r\n return false\r\n }\r\n \r\n const fileExt = this.getFileExtension(file.name)\r\n console.log('文件扩展名:', fileExt)\r\n \r\n if (this.extensions) {\r\n const allowedExts = this.getAllowedExtensions()\r\n console.log('允许的扩展名:', allowedExts)\r\n \r\n if (!allowedExts.includes(fileExt)) {\r\n console.log('扩展名不在允许列表中')\r\n this.$message.error(`不支持的文件类型 \"${fileExt}\",请上传 ${this.extensions} 格式的文件`)\r\n return false\r\n }\r\n }\r\n \r\n console.log('文件类型验证通过')\r\n return true\r\n },\r\n \r\n /**\r\n * 获取文件扩展名\r\n */\r\n getFileExtension(fileName) {\r\n return fileName.toLowerCase().substring(fileName.lastIndexOf('.'))\r\n },\r\n \r\n /**\r\n * 获取允许的扩展名列表\r\n */\r\n getAllowedExtensions() {\r\n return this.extensions.toLowerCase()\r\n .split(',')\r\n .map(ext => ext.trim().startsWith('.') ? ext.trim() : `.${ext.trim()}`)\r\n },\r\n // ==================== 事件处理 ====================\r\n \r\n /**\r\n * 处理文件输入事件\r\n */\r\n onWatchInputFiles(newFile, oldFile) {\r\n if (newFile && !oldFile) {\r\n this.handleFileAdd(newFile)\r\n } else if (newFile && oldFile) {\r\n this.handleFileUpdate(newFile)\r\n } else if (!newFile && oldFile) {\r\n this.handleFileDelete()\r\n }\r\n \r\n // 激活上传组件\r\n this.activateUploadComponent(newFile, oldFile)\r\n },\r\n \r\n /**\r\n * 生成唯一的随机数\r\n */\r\n generateUniqueRandom() {\r\n // 使用 crypto.getRandomValues 生成更安全的随机数\r\n if (window.crypto && window.crypto.getRandomValues) {\r\n const array = new Uint32Array(1)\r\n window.crypto.getRandomValues(array)\r\n return array[0].toString()\r\n }\r\n // 降级方案:使用 Math.random 结合时间戳\r\n return Math.random().toString(36).substr(2, 9) + Date.now().toString(36)\r\n },\r\n\r\n /**\r\n * 处理文件添加\r\n */\r\n handleFileAdd(newFile) {\r\n // 为每个文件生成唯一的随机数\r\n const uniqueRandom = this.generateUniqueRandom()\r\n newFile.postAction = newFile.postAction + '&_t=' + uniqueRandom\r\n console.log('add file:', newFile)\r\n console.log('extensions:', this.extensions)\r\n console.log('accept:', this.accept)\r\n \r\n // 生成或使用 groupId\r\n this.ensureGroupId()\r\n \r\n // 验证文件类型\r\n if (!this.validateFileType(newFile)) {\r\n this.removeInvalidFile(newFile)\r\n return\r\n }\r\n console.log('文件类型验证通过,继续上传')\r\n },\r\n \r\n /**\r\n * 处理文件更新\r\n */\r\n handleFileUpdate(newFile) {\r\n console.log('update', newFile)\r\n const { success, active, chunk, response } = newFile\r\n \r\n if (chunk && success && !active) {\r\n console.log('chunk end')\r\n this.handleChunkComplete(response, newFile)\r\n }\r\n },\r\n \r\n /**\r\n * 处理文件删除\r\n */\r\n handleFileDelete() {\r\n console.log('delete')\r\n },\r\n \r\n /**\r\n * 确保 groupId 存在\r\n */\r\n ensureGroupId() {\r\n console.log('onWatchInputFiles - multiple:', this.multiple, 'current groupId:', this.groupId)\r\n \r\n if (this.multiple && !this.groupId) {\r\n this.groupId = uuidv4()\r\n console.log('Generated new groupId:', this.groupId)\r\n } else if (this.multiple && this.groupId) {\r\n console.log('Using existing groupId:', this.groupId)\r\n }\r\n },\r\n \r\n /**\r\n * 移除无效文件\r\n */\r\n removeInvalidFile(file) {\r\n console.log('文件类型验证失败,尝试移除文件')\r\n console.log('uploadRef:', this.uploadRef)\r\n console.log('$refs:', this.$refs)\r\n \r\n if (this.$refs[this.uploadRef]) {\r\n this.$refs[this.uploadRef].remove(file)\r\n } else {\r\n console.error('无法找到 uploadRef 引用')\r\n }\r\n },\r\n \r\n /**\r\n * 处理分片上传完成\r\n * @param {Object} response - 上传响应\r\n * @param {Object} uploadingFile - 正在上传的文件对象(可选)\r\n */\r\n handleChunkComplete(response, uploadingFile = null) {\r\n const { data: { file, type } } = response\r\n const payloads = {\r\n filePath: file.match(/\\/cw(.*)/) ? file.match(/\\/cw(.*)/)[0] : void 0,\r\n asyncID: uuidv4(),\r\n groupID: this.groupId,\r\n isDeleteOrigin: false,\r\n toImage: type === 'pdf',\r\n unzip: type === 'zip',\r\n _csrf: localStorage.getItem('token')\r\n }\r\n\r\n const formData = new FormData()\r\n\r\n Object.keys(payloads).forEach(key => {\r\n formData.append(key, payloads[key])\r\n })\r\n \r\n // 将上传文件对象传递给异步保存方法\r\n this.saveToServerAsyncPageTimer = setInterval(() => {\r\n this.saveToServerAsyncPage(formData, uploadingFile)\r\n }, CONSTANTS.SAVE_INTERVAL)\r\n },\r\n \r\n /**\r\n * 激活上传组件\r\n */\r\n activateUploadComponent(newFile, oldFile) {\r\n if (Boolean(newFile) !== Boolean(oldFile) || oldFile.error !== newFile.error) {\r\n if (!this.$refs[this.uploadRef].active) {\r\n this.$refs[this.uploadRef].active = true\r\n }\r\n }\r\n },\r\n \r\n // ==================== 值变化处理 ====================\r\n \r\n /**\r\n * 重置文件状态\r\n */\r\n resetFiles() {\r\n this.files = []\r\n this.buildedFiles = []\r\n // 多选模式下保留或生成 groupId,避免首次上传为空\r\n if (this.multiple) {\r\n if (!this.groupId) {\r\n this.groupId = uuidv4()\r\n console.log('Generated groupId in resetFiles:', this.groupId)\r\n } else {\r\n console.log('Preserve existing groupId in resetFiles:', this.groupId)\r\n }\r\n } else {\r\n this.groupId = null\r\n console.log('Reset groupId to null (single mode)')\r\n }\r\n },\r\n \r\n /**\r\n * 处理多文件模式的值变化\r\n */\r\n async handleMultipleFileValue(value) {\r\n // multiple - value 就是 groupId\r\n // 只有当 groupId 发生变化时才重新获取文件列表(初始化回显)\r\n if (this.groupId !== value) {\r\n this.groupId = value\r\n console.log('Set groupId from external value:', this.groupId)\r\n await this.fetchFilesWithGroupId()\r\n } else {\r\n console.log('GroupId unchanged, skip fetchFilesWithGroupId')\r\n }\r\n },\r\n \r\n /**\r\n * 处理单文件模式的值变化\r\n */\r\n async handleSingleFileValue() {\r\n await this.fetchFileWithFileId()\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n::v-deep .ele-upload__inner {\r\n opacity: 1 !important;\r\n cursor: pointer;\r\n border: 1px dashed var(--idooel-form-title-border-color);\r\n background: var(--idooel-form-upload-bg-color) !important;\r\n &:hover {\r\n border-color: var(--idooel-form-upload-border-hover-color);\r\n }\r\n border-radius: var(--idooel-form-border-radius);\r\n}\r\n.ele-upload__wrapper {\r\n width: 100%;\r\n .ele-upload__area {\r\n padding: 16px;\r\n width: 100%;\r\n height: 80px;\r\n display: flex;\r\n flex-direction: row;\r\n .ele-upload__area--icon {\r\n color: var(--idooel-primary-color);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n font-size: 16x;\r\n .anticon-cloud-upload {\r\n font-size: 48px;\r\n color: var(--idooel-primary-color);\r\n }\r\n .anticon {\r\n font-size: 48px;\r\n color: var(--idooel-primary-color);\r\n }\r\n }\r\n .ele-upload__area--text {\r\n margin-left: 16px;\r\n .ele-upload__message {\r\n font-size: 16px;\r\n color: var(--idoole-black-088);\r\n text-align: left;\r\n }\r\n .ele-upload__ext {\r\n text-align: left;\r\n font-size: 14px;\r\n color: var(--idoole-black-06);\r\n }\r\n }\r\n }\r\n .ele-files__wrapper {\r\n .ele-file__item {\r\n width: 100%;\r\n margin-top: 8px;\r\n padding: 8px 12px;\r\n border-radius: var(--idooel-form-border-radius);\r\n background: var(--idooel-form-upload-bg-color);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n .ele-file__suffix--icon {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 24px;\r\n height: 24px;\r\n }\r\n .ele-file__name {\r\n flex: 1;\r\n text-align: left;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n font-size: 14px;\r\n margin-left: 8px;\r\n cursor: pointer;\r\n .ele-file__inner {\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n }\r\n .ele-file__delete {\r\n margin-left: 8px;\r\n .ele-file__delete--icon {\r\n margin-left: 8px;\r\n cursor: pointer;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</style>","::v-deep .ele-upload__inner {\n opacity: 1 !important;\n cursor: pointer;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color) !important;\n}\n::v-deep .ele-upload__inner:hover {\n border-color: var(--idooel-form-upload-border-hover-color);\n}\n::v-deep .ele-upload__inner {\n border-radius: var(--idooel-form-border-radius);\n}\n\n.ele-upload__wrapper {\n width: 100%;\n}\n.ele-upload__wrapper .ele-upload__area {\n padding: 16px;\n width: 100%;\n height: 80px;\n display: flex;\n flex-direction: row;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon {\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n font-size: 16x;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--icon .anticon {\n font-size: 48px;\n color: var(--idooel-primary-color);\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text {\n margin-left: 16px;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__message {\n font-size: 16px;\n color: var(--idoole-black-088);\n text-align: left;\n}\n.ele-upload__wrapper .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n text-align: left;\n font-size: 14px;\n color: var(--idoole-black-06);\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item {\n width: 100%;\n margin-top: 8px;\n padding: 8px 12px;\n border-radius: var(--idooel-form-border-radius);\n background: var(--idooel-form-upload-bg-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__suffix--icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name {\n flex: 1;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n font-size: 14px;\n margin-left: 8px;\n cursor: pointer;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__name .ele-file__inner {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete {\n margin-left: 8px;\n}\n.ele-upload__wrapper .ele-files__wrapper .ele-file__item .ele-file__delete .ele-file__delete--icon {\n margin-left: 8px;\n cursor: pointer;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
5801
6811
|
|
|
5802
6812
|
};
|
|
5803
6813
|
/* scoped */
|
|
5804
|
-
const __vue_scope_id__$t = "data-v-
|
|
6814
|
+
const __vue_scope_id__$t = "data-v-3db5c928";
|
|
5805
6815
|
/* module identifier */
|
|
5806
6816
|
const __vue_module_identifier__$t = undefined;
|
|
5807
6817
|
/* functional template */
|
|
@@ -5952,11 +6962,11 @@ __vue_render__$s._withStripped = true;
|
|
|
5952
6962
|
/* style */
|
|
5953
6963
|
const __vue_inject_styles__$s = function (inject) {
|
|
5954
6964
|
if (!inject) return
|
|
5955
|
-
inject("data-v-
|
|
6965
|
+
inject("data-v-d83730f2_0", { source: ".g-select-entity__wrapper[data-v-d83730f2] {\n font-size: 14px;\n line-height: 30px;\n position: relative;\n width: 100%;\n display: flex;\n color: var(--idoole-black-07);\n border-radius: 4px;\n border: 1px solid var(--idooel-form-title-border-color);\n}\n.g-select-entity__wrapper[data-v-d83730f2]:hover {\n border-color: var(--idooel-primary-color);\n}\n.g-select-entity__wrapper .select-entity__input[data-v-d83730f2] {\n padding: 0 11px;\n background-color: #fff;\n border-radius: 4px;\n flex-grow: 1;\n min-height: 30px;\n text-align: left;\n}\n.g-select-entity__wrapper .select-entity__addon[data-v-d83730f2] {\n padding: 0 11px;\n color: var(--idoole-black-07);\n background-color: var(--idoole-black-02);\n border-left: 1px solid var(--idooel-form-title-border-color);\n cursor: pointer;\n min-height: 30px;\n white-space: nowrap;\n}\n.has-error .g-select-entity__wrapper[data-v-d83730f2] {\n border-color: var(--idooel-form-border-err-color);\n}\n.g-select-entity__disabled .select-entity__input[data-v-d83730f2] {\n background-color: var(--idoole-black-02);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\select-entity\\src\\index.vue","index.vue"],"names":[],"mappings":"AAmFA;EACA,eAAA;EACA,iBAAA;EACA,kBAAA;EACA,WAAA;EACA,aAAA;EACA,6BAAA;EACA,kBAAA;EACA,uDAAA;AClFA;ADmFA;EACA,yCAAA;ACjFA;ADmFA;EACA,eAAA;EACA,sBAAA;EACA,kBAAA;EACA,YAAA;EACA,gBAAA;EACA,gBAAA;ACjFA;ADmFA;EACA,eAAA;EACA,6BAAA;EACA,wCAAA;EACA,4DAAA;EACA,eAAA;EACA,gBAAA;EACA,mBAAA;ACjFA;ADoFA;EACA,iDAAA;ACjFA;ADmFA;EACA,wCAAA;AChFA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"g-select-entity__wrapper\" :class=\"disabled ? 'g-select-entity__disabled' : ''\">\r\n <span class=\"select-entity__input\">\r\n <a-tag\r\n v-for=\"(item, inx) in getValueList\"\r\n :key=\"item.value\"\r\n :closable=\"!disabled && !getIsMaxCount\"\r\n @close=\"onClose(...arguments, inx, item)\"\r\n >\r\n {{ item.label }}\r\n </a-tag>\r\n <a-tag v-if=\"getIsMaxCount\">......</a-tag>\r\n </span>\r\n <span class=\"select-entity__addon\" @click=\"onChange\">{{ addonAfter }}</span>\r\n <slot></slot>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { type } from '@idooel/shared'\r\nexport default {\r\n name: 'ele-select-entity',\r\n props: {\r\n value: {\r\n type: [Array, Object]\r\n },\r\n multiple: {\r\n type: Boolean,\r\n default: true\r\n },\r\n maxCount: {\r\n type: Number,\r\n default: 7\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n },\r\n addonAfter: {\r\n type: String,\r\n default: '选择'\r\n }\r\n },\r\n computed: {\r\n getValueList () {\r\n if (this.value) {\r\n if (this.multiple) {\r\n return this.getIsMaxCount ? this.value.slice(0, this.maxCount) : this.value\r\n }\r\n return type.isArray(this.value) ? this.value : [this.value]\r\n }\r\n return []\r\n },\r\n getIsMaxCount () {\r\n if (this.value && this.multiple) {\r\n return this.value.length >= this.maxCount\r\n }\r\n return false\r\n }\r\n },\r\n methods: {\r\n onChange () {\r\n if (this.disabled) return\r\n this.$emit('change', this.value)\r\n this.$emit('evoke')\r\n },\r\n onClose (e, inx, props) {\r\n e = window.event || e\r\n e.preventDefault()\r\n if (!this.multiple) {\r\n this.$emit('close', props)\r\n this.$emit('change', null)\r\n return\r\n }\r\n this.value.splice(inx, 1)\r\n this.$emit('close', props)\r\n this.$emit('change', this.value)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-select-entity__wrapper {\r\n font-size: 14px;\r\n line-height: 30px;\r\n position: relative;\r\n width: 100%;\r\n display: flex;\r\n color: var(--idoole-black-07);\r\n border-radius: 4px;\r\n border: 1px solid var(--idooel-form-title-border-color);\r\n &:hover {\r\n border-color: var(--idooel-primary-color);\r\n }\r\n .select-entity__input {\r\n padding: 0 11px;\r\n background-color: #fff;\r\n border-radius: 4px;\r\n flex-grow: 1;\r\n min-height: 30px;\r\n text-align: left;\r\n }\r\n .select-entity__addon {\r\n padding: 0 11px;\r\n color: var(--idoole-black-07);\r\n background-color: var(--idoole-black-02);\r\n border-left: 1px solid var(--idooel-form-title-border-color);\r\n cursor: pointer;\r\n min-height: 30px;\r\n white-space: nowrap;\r\n }\r\n}\r\n.has-error .g-select-entity__wrapper {\r\n border-color: var(--idooel-form-border-err-color);\r\n}\r\n.g-select-entity__disabled .select-entity__input {\r\n background-color: var(--idoole-black-02);\r\n}\r\n</style>",".g-select-entity__wrapper {\n font-size: 14px;\n line-height: 30px;\n position: relative;\n width: 100%;\n display: flex;\n color: var(--idoole-black-07);\n border-radius: 4px;\n border: 1px solid var(--idooel-form-title-border-color);\n}\n.g-select-entity__wrapper:hover {\n border-color: var(--idooel-primary-color);\n}\n.g-select-entity__wrapper .select-entity__input {\n padding: 0 11px;\n background-color: #fff;\n border-radius: 4px;\n flex-grow: 1;\n min-height: 30px;\n text-align: left;\n}\n.g-select-entity__wrapper .select-entity__addon {\n padding: 0 11px;\n color: var(--idoole-black-07);\n background-color: var(--idoole-black-02);\n border-left: 1px solid var(--idooel-form-title-border-color);\n cursor: pointer;\n min-height: 30px;\n white-space: nowrap;\n}\n\n.has-error .g-select-entity__wrapper {\n border-color: var(--idooel-form-border-err-color);\n}\n\n.g-select-entity__disabled .select-entity__input {\n background-color: var(--idoole-black-02);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
5956
6966
|
|
|
5957
6967
|
};
|
|
5958
6968
|
/* scoped */
|
|
5959
|
-
const __vue_scope_id__$s = "data-v-
|
|
6969
|
+
const __vue_scope_id__$s = "data-v-d83730f2";
|
|
5960
6970
|
/* module identifier */
|
|
5961
6971
|
const __vue_module_identifier__$s = undefined;
|
|
5962
6972
|
/* functional template */
|
|
@@ -6373,11 +7383,11 @@ __vue_render__$p._withStripped = true;
|
|
|
6373
7383
|
/* style */
|
|
6374
7384
|
const __vue_inject_styles__$p = function (inject) {
|
|
6375
7385
|
if (!inject) return
|
|
6376
|
-
inject("data-v-
|
|
7386
|
+
inject("data-v-2872c57a_0", { source: ".ele-modal__footer[data-v-2872c57a] {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n}\n.ele-modal__footer .footer-btn__wrapper[data-v-2872c57a] {\n flex: 1;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\modal\\src\\index.vue","index.vue"],"names":[],"mappings":"AA+KA;EACA,aAAA;EACA,mBAAA;EACA,8BAAA;EACA,mBAAA;AC9KA;AD+KA;EACA,OAAA;AC7KA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <a-modal\r\n :title=\"title\"\r\n :cancelText=\"cancelText\"\r\n :okText=\"okText\"\r\n :closable=\"closable\"\r\n v-model:visible=\"showModal\"\r\n :width=\"width\"\r\n :keyboard=\"false\"\r\n :maskClosable=\"maskClosable\"\r\n :dialogStyle=\"{ top: `${upDownDistance[size]}px` }\"\r\n :bodyStyle=\"{ maxHeight: maxheight, overflowY: 'auto' }\"\r\n :footer=\"showFooter ? undefined : null\"\r\n @cancel=\"handleCancel\"\r\n @ok=\"handleOk\"\r\n >\r\n <slot v-if=\"showModal\"></slot>\r\n <template slot=\"footer\" v-if=\"!showDefaultFooter\">\r\n <div class=\"ele-modal__footer\">\r\n <slot name=\"footer-text\"></slot>\r\n <div class=\"footer-btn__wrapper\">\r\n <ele-button\r\n v-for=\"btn in buttonGroupMeta.elements\"\r\n :type=\"btn.type\"\r\n v-on=\"assignAttrEvents\"\r\n :event-name=\"btn.eventName\"\r\n :key=\"btn.key\">\r\n {{ btn.label }}\r\n </ele-button>\r\n </div>\r\n </div>\r\n </template>\r\n </a-modal>\r\n</template>\r\n<script>\r\nimport { CONTEXT } from '../../utils'\r\nexport default {\r\n name: 'ele-modal',\r\n props: {\r\n value: {\r\n type: Boolean,\r\n default: false\r\n },\r\n title: {\r\n type: String,\r\n default: '标题'\r\n },\r\n cancelText: {\r\n type: String,\r\n default: '关闭'\r\n },\r\n okText: {\r\n type: String,\r\n default: '确定'\r\n },\r\n size: {\r\n type: String,\r\n default: 'middle'\r\n },\r\n map: {\r\n type: Object,\r\n default () {\r\n return {}\r\n }\r\n },\r\n closable: {\r\n type: Boolean,\r\n default: true\r\n },\r\n maskClosable: {\r\n type: Boolean,\r\n default: false\r\n },\r\n showFooter: {\r\n type: Boolean,\r\n default: true\r\n },\r\n footer: {\r\n type: Function,\r\n default: null\r\n },\r\n onlyClose: {\r\n type: Boolean,\r\n default: false\r\n },\r\n buttonGroupMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n // 是否展示组件默认底部按钮\r\n showDefaultFooter: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n watch: {\r\n value: {\r\n handler (value) {\r\n this.$nextTick(() => {\r\n this.showModal = value\r\n })\r\n },\r\n immediate: true\r\n }\r\n },\r\n inject: {\r\n [CONTEXT]: {\r\n default: () => (() => ({}))\r\n }\r\n },\r\n computed: {\r\n assignAttrEvents () {\r\n const events = this.buttons.reduce((ret, btn) => {\r\n ret[btn.eventName] = (e) => {\r\n this.$emit(btn.eventName || 'click', { ...e, ...this[CONTEXT]() })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events\r\n }\r\n },\r\n buttons () {\r\n const { elements = [] } = this.buttonGroupMeta\r\n return elements\r\n },\r\n width () {\r\n return this.map[this.size]\r\n },\r\n maxheight () {\r\n return `calc(100vh - ${this.upDownDistance[this.size] * 2 + (this.title ? 55 : 0) + (this.showFooter ? 53 : 0) }px`\r\n }\r\n },\r\n data () {\r\n return {\r\n showModal: false\r\n }\r\n },\r\n created () {\r\n let defaultMap = {\r\n small: 480,\r\n middle: 768,\r\n big: 1200\r\n }\r\n this.upDownDistance = {\r\n small: 80,\r\n middle: 80,\r\n big: 40\r\n }\r\n this.map = Object.assign(this.map, defaultMap)\r\n },\r\n methods: {\r\n openModal () {\r\n this.showModal = true\r\n this.removeHidden()\r\n },\r\n handleCancel () {\r\n this.showModal = false\r\n this.$emit('input', this.showModal)\r\n this.$emit('change', this.showModal)\r\n this.removeHidden()\r\n this.$emit('cancel')\r\n },\r\n handleOk () {\r\n this.$emit('ok')\r\n },\r\n removeHidden () {\r\n let ishidden = document.body.style.overflow === 'hidden'\r\n ishidden && (document.body.style.overflow = 'initial')\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n.ele-modal__footer {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n align-items: center;\r\n .footer-btn__wrapper {\r\n flex: 1;\r\n }\r\n}\r\n</style>",".ele-modal__footer {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n}\n.ele-modal__footer .footer-btn__wrapper {\n flex: 1;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
6377
7387
|
|
|
6378
7388
|
};
|
|
6379
7389
|
/* scoped */
|
|
6380
|
-
const __vue_scope_id__$p = "data-v-
|
|
7390
|
+
const __vue_scope_id__$p = "data-v-2872c57a";
|
|
6381
7391
|
/* module identifier */
|
|
6382
7392
|
const __vue_module_identifier__$p = undefined;
|
|
6383
7393
|
/* functional template */
|
|
@@ -6463,11 +7473,11 @@ __vue_render__$o._withStripped = true;
|
|
|
6463
7473
|
/* style */
|
|
6464
7474
|
const __vue_inject_styles__$o = function (inject) {
|
|
6465
7475
|
if (!inject) return
|
|
6466
|
-
inject("data-v-
|
|
7476
|
+
inject("data-v-087ae2a9_0", { source: ".ant-checkbox-group[data-v-087ae2a9] {\n text-align: left;\n line-height: 32px;\n}\n.has-error .ant-checkbox-group[data-v-087ae2a9] .ant-checkbox-wrapper {\n color: var(--idooel-form-border-err-color);\n}\n.has-error .ant-checkbox-group[data-v-087ae2a9] .ant-checkbox-inner {\n border-color: var(--idooel-form-border-err-color);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\checkbox\\src\\index.vue","index.vue"],"names":[],"mappings":"AAsCA;EACA,gBAAA;EACA,iBAAA;ACrCA;ADyCA;EACA,0CAAA;ACtCA;ADwCA;EACA,iDAAA;ACtCA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <a-checkbox-group\r\n :value=\"value\"\r\n :options=\"dataSource\" \r\n :disabled=\"disabled\" \r\n @change=\"onChange\">\r\n </a-checkbox-group>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-checkbox',\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n value: {\r\n type: Array\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n methods: {\r\n onChange (value) {\r\n this.$emit('change', value)\r\n this.$emit('input', value)\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n.ant-checkbox-group {\r\n text-align: left;\r\n line-height: 32px;\r\n}\r\n.has-error {\r\n .ant-checkbox-group {\r\n ::v-deep .ant-checkbox-wrapper {\r\n color: var(--idooel-form-border-err-color);\r\n }\r\n ::v-deep .ant-checkbox-inner {\r\n border-color: var(--idooel-form-border-err-color);\r\n }\r\n }\r\n}\r\n</style>",".ant-checkbox-group {\n text-align: left;\n line-height: 32px;\n}\n\n.has-error .ant-checkbox-group ::v-deep .ant-checkbox-wrapper {\n color: var(--idooel-form-border-err-color);\n}\n.has-error .ant-checkbox-group ::v-deep .ant-checkbox-inner {\n border-color: var(--idooel-form-border-err-color);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
6467
7477
|
|
|
6468
7478
|
};
|
|
6469
7479
|
/* scoped */
|
|
6470
|
-
const __vue_scope_id__$o = "data-v-
|
|
7480
|
+
const __vue_scope_id__$o = "data-v-087ae2a9";
|
|
6471
7481
|
/* module identifier */
|
|
6472
7482
|
const __vue_module_identifier__$o = undefined;
|
|
6473
7483
|
/* functional template */
|
|
@@ -6562,11 +7572,11 @@ __vue_render__$n._withStripped = true;
|
|
|
6562
7572
|
/* style */
|
|
6563
7573
|
const __vue_inject_styles__$n = function (inject) {
|
|
6564
7574
|
if (!inject) return
|
|
6565
|
-
inject("data-v-
|
|
7575
|
+
inject("data-v-3e01936f_0", { source: ".ant-radio-group[data-v-3e01936f] {\n text-align: left;\n line-height: 32px;\n}\n.has-error .ant-radio-group[data-v-3e01936f] .ant-radio-wrapper {\n color: var(--idooel-form-border-err-color);\n}\n.has-error .ant-radio-group[data-v-3e01936f] .ant-radio-inner {\n border-color: var(--idooel-form-border-err-color);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\radio\\src\\index.vue","index.vue"],"names":[],"mappings":"AA0CA;EACA,gBAAA;EACA,iBAAA;ACzCA;AD6CA;EACA,0CAAA;AC1CA;AD4CA;EACA,iDAAA;AC1CA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <a-radio-group :value=\"value\" @change=\"onChange\" :disabled=\"disabled\">\r\n <a-radio v-for=\"item in dataSource\" :key=\"item.value\" :value=\"item.value\">\r\n {{ item.label }}\r\n </a-radio>\r\n </a-radio-group>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-radio',\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n value: {\r\n type: [String, Array, Number]\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n watch: {\r\n value (val) {\r\n console.log('valvalval', val)\r\n }\r\n },\r\n methods: {\r\n onChange (e) {\r\n this.$emit('change', e.target.value)\r\n this.$emit('input', e.target.value)\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n.ant-radio-group {\r\n text-align: left;\r\n line-height: 32px;\r\n}\r\n.has-error {\r\n .ant-radio-group {\r\n ::v-deep .ant-radio-wrapper {\r\n color: var(--idooel-form-border-err-color);\r\n }\r\n ::v-deep .ant-radio-inner {\r\n border-color: var(--idooel-form-border-err-color);\r\n }\r\n }\r\n}\r\n</style>",".ant-radio-group {\n text-align: left;\n line-height: 32px;\n}\n\n.has-error .ant-radio-group ::v-deep .ant-radio-wrapper {\n color: var(--idooel-form-border-err-color);\n}\n.has-error .ant-radio-group ::v-deep .ant-radio-inner {\n border-color: var(--idooel-form-border-err-color);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
6566
7576
|
|
|
6567
7577
|
};
|
|
6568
7578
|
/* scoped */
|
|
6569
|
-
const __vue_scope_id__$n = "data-v-
|
|
7579
|
+
const __vue_scope_id__$n = "data-v-3e01936f";
|
|
6570
7580
|
/* module identifier */
|
|
6571
7581
|
const __vue_module_identifier__$n = undefined;
|
|
6572
7582
|
/* functional template */
|
|
@@ -6726,12 +7736,12 @@ __vue_render__$m._withStripped = true;
|
|
|
6726
7736
|
/* style */
|
|
6727
7737
|
const __vue_inject_styles__$m = function (inject) {
|
|
6728
7738
|
if (!inject) return
|
|
6729
|
-
inject("data-v-
|
|
6730
|
-
,inject("data-v-
|
|
7739
|
+
inject("data-v-5cdc3f9f_0", { source: ".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n.margin-t-8 {\n margin-top: 8px;\n}\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,qBAAqB;AACvB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AAEA;EACE,eAAe;AACjB;AAEA;EACE,+BAA+B;EAC/B,sCAAsC;EACtC,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,uCAAuC;EACvC,uCAAuC;EACvC,mDAAmD;EACnD,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;EACrC,2CAA2C;EAC3C,6BAA6B;EAC7B,iCAAiC;EACjC,qDAAqD;EACrD,kDAAkD;EAClD,gDAAgD;EAChD,gCAAgC;EAChC,uCAAuC;EACvC,yBAAyB;EACzB,yBAAyB;EACzB,oCAAoC;AACtC;AAEA;EACE,4DAA4D;AAC9D;AAEA;EACE,4DAA4D;AAC9D;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n\n.margin-t-8 {\n margin-top: 8px;\n}\n\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined })
|
|
7740
|
+
,inject("data-v-5cdc3f9f_1", { source: ".ele-batch-export__content[data-v-5cdc3f9f] {\n height: 106px;\n}\n.ele-batch-export__content .ele-batch-export__container[data-v-5cdc3f9f] {\n border-width: 1px;\n border-style: dashed;\n height: 80px;\n border-color: var(--idooel-link-06);\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 16px;\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__icon[data-v-5cdc3f9f] {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__handle[data-v-5cdc3f9f] {\n margin-left: 16px;\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__handle .ele-batch-export__btn[data-v-5cdc3f9f] {\n color: var(--idooel-link-06);\n font-size: 16px;\n cursor: pointer;\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__handle .ele-batch-export__btn--hint[data-v-5cdc3f9f] {\n color: var(--idooel-link-03);\n font-size: 14px;\n}\n.ele-batch-export__content .ele-batch-export__message[data-v-5cdc3f9f] {\n color: var(--idooel-link-06);\n font-size: 14px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\batch-export\\src\\index.vue","index.vue"],"names":[],"mappings":"AAuEA;EACA,aAAA;ACtEA;ADuEA;EACA,iBAAA;EACA,oBAAA;EACA,YAAA;EACA,mCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,eAAA;ACrEA;ADsEA;EACA,eAAA;EACA,4BAAA;ACpEA;ADsEA;EACA,iBAAA;ACpEA;ADqEA;EACA,4BAAA;EACA,eAAA;EACA,eAAA;ACnEA;ADqEA;EACA,4BAAA;EACA,eAAA;ACnEA;ADuEA;EACA,4BAAA;EACA,eAAA;ACrEA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <ele-modal \r\n v-model=\"innerValue\" \r\n v-on=\"$listeners\"\r\n :buttonGroupMeta=\"buttonGroupMeta\" \r\n title=\"批量导出\">\r\n <div class=\"ele-batch-export__content\">\r\n <div class=\"ele-batch-export__container\">\r\n <ele-icon class=\"ele-batch-export__icon\" type=\"download\"></ele-icon>\r\n <div class=\"ele-batch-export__handle\">\r\n <div class=\"ele-batch-export__btn\" @click=\"handleClick\">导出任务处理中..... 请点击此按钮跳转到“批处理管理”菜单查看任务进度</div>\r\n <div class=\"ele-batch-export__btn--hint\">批处理任务的准备工作会在后台运行</div>\r\n </div>\r\n </div>\r\n <div class=\"ele-batch-export__message\">\r\n 您可以请点击上方按钮查看任务进度或关闭弹框\r\n </div>\r\n </div>\r\n </ele-modal>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-batch-export',\r\n props: {\r\n value: {\r\n type: Boolean,\r\n default: false\r\n },\r\n buttonGroupMeta: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n elements: [\r\n {\r\n label: '关闭',\r\n key: 'close',\r\n type: 'primary',\r\n eventName: 'handleClose'\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n },\r\n data() {\r\n return {\r\n innerValue: false\r\n }\r\n },\r\n watch: {\r\n value: {\r\n handler (value) {\r\n this.$nextTick(() => {\r\n this.innerValue = value\r\n })\r\n },\r\n immediate: true\r\n }\r\n },\r\n methods: {\r\n handleClick () {\r\n this.$emit('on-batch-export')\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\">\r\n@import '../../theme/index';\r\n</style>\r\n<style lang=\"scss\" scoped>\r\n.ele-batch-export__content {\r\n height: 106px;\r\n .ele-batch-export__container {\r\n border-width: 1px;\r\n border-style: dashed;\r\n height: 80px;\r\n border-color: var(--idooel-link-06);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n padding: 0 16px;\r\n .ele-batch-export__icon {\r\n font-size: 48px;\r\n color: var(--idooel-link-06);\r\n }\r\n .ele-batch-export__handle {\r\n margin-left: 16px;\r\n .ele-batch-export__btn {\r\n color: var(--idooel-link-06);\r\n font-size: 16px;\r\n cursor: pointer;\r\n }\r\n .ele-batch-export__btn--hint {\r\n color: var(--idooel-link-03);\r\n font-size: 14px;\r\n }\r\n }\r\n }\r\n .ele-batch-export__message {\r\n color: var(--idooel-link-06);\r\n font-size: 14px;\r\n }\r\n}\r\n</style>",".ele-batch-export__content {\n height: 106px;\n}\n.ele-batch-export__content .ele-batch-export__container {\n border-width: 1px;\n border-style: dashed;\n height: 80px;\n border-color: var(--idooel-link-06);\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 16px;\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__icon {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__handle {\n margin-left: 16px;\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__handle .ele-batch-export__btn {\n color: var(--idooel-link-06);\n font-size: 16px;\n cursor: pointer;\n}\n.ele-batch-export__content .ele-batch-export__container .ele-batch-export__handle .ele-batch-export__btn--hint {\n color: var(--idooel-link-03);\n font-size: 14px;\n}\n.ele-batch-export__content .ele-batch-export__message {\n color: var(--idooel-link-06);\n font-size: 14px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
6731
7741
|
|
|
6732
7742
|
};
|
|
6733
7743
|
/* scoped */
|
|
6734
|
-
const __vue_scope_id__$m = "data-v-
|
|
7744
|
+
const __vue_scope_id__$m = "data-v-5cdc3f9f";
|
|
6735
7745
|
/* module identifier */
|
|
6736
7746
|
const __vue_module_identifier__$m = undefined;
|
|
6737
7747
|
/* functional template */
|
|
@@ -6824,11 +7834,11 @@ __vue_render__$l._withStripped = true;
|
|
|
6824
7834
|
/* style */
|
|
6825
7835
|
const __vue_inject_styles__$l = function (inject) {
|
|
6826
7836
|
if (!inject) return
|
|
6827
|
-
inject("data-v-
|
|
7837
|
+
inject("data-v-28d8d270_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
6828
7838
|
|
|
6829
7839
|
};
|
|
6830
7840
|
/* scoped */
|
|
6831
|
-
const __vue_scope_id__$l = "data-v-
|
|
7841
|
+
const __vue_scope_id__$l = "data-v-28d8d270";
|
|
6832
7842
|
/* module identifier */
|
|
6833
7843
|
const __vue_module_identifier__$l = undefined;
|
|
6834
7844
|
/* functional template */
|
|
@@ -7045,12 +8055,12 @@ __vue_render__$k._withStripped = true;
|
|
|
7045
8055
|
/* style */
|
|
7046
8056
|
const __vue_inject_styles__$k = function (inject) {
|
|
7047
8057
|
if (!inject) return
|
|
7048
|
-
inject("data-v-
|
|
7049
|
-
,inject("data-v-bfb18322_1", { source: ".ele-timeline__wrapper[data-v-bfb18322] {\n width: 100%;\n height: 100%;\n}\n.ele-timeline__wrapper .ele-timeline__item[data-v-bfb18322] {\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item:last-child .ele-timeline__middle .ele-timeline__traline[data-v-bfb18322] {\n display: none;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left[data-v-bfb18322] {\n flex: 1;\n padding-right: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n text-align: right;\n display: flex;\n flex-direction: row;\n justify-content: end;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left .titleline-left__date[data-v-bfb18322] {\n width: 100px;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle[data-v-bfb18322] {\n width: 10px;\n display: flex;\n flex-direction: column;\n align-items: center;\n transform: translate(0, 20px);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__circle[data-v-bfb18322] {\n width: 100%;\n height: 10px;\n border-radius: 50%;\n border-width: 2px;\n border-style: solid;\n border-color: var(--idooel-primary-color);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__traline[data-v-bfb18322] {\n width: 1px;\n height: calc(100% - 10px);\n border-width: 1px;\n border-style: solid;\n border-color: var(--idoole-black-016);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right[data-v-bfb18322] {\n text-align: left;\n flex: 2;\n padding-left: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title[data-v-bfb18322] {\n line-height: 22px;\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title[data-v-bfb18322] {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info[data-v-bfb18322] {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info[data-v-bfb18322]::before {\n content: \"\";\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.success[data-v-bfb18322]::before {\n background: var(--idoole-success-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.warning[data-v-bfb18322]::before {\n background: var(--idoole-warning-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.error[data-v-bfb18322]::before {\n background: var(--idoole-error-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper[data-v-bfb18322] {\n line-height: 22px;\n margin-top: 8px;\n margin-left: 12px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper .oper-name[data-v-bfb18322] {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle[data-v-bfb18322] {\n margin-left: 12px;\n display: flex;\n flex-direction: row;\n line-height: 22px;\n margin-top: 4px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__field[data-v-bfb18322] {\n flex-shrink: 0;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__content[data-v-bfb18322] {\n font-size: 14px;\n color: var(--idoole-black-088);\n font-weight: bold;\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/timeline/src/index.vue","index.vue"],"names":[],"mappings":"AAiIA;EACA,WAAA;EACA,YAAA;AChIA;ADiIA;EACA,aAAA;EACA,mBAAA;AC/HA;ADkIA;EACA,aAAA;AChIA;ADoIA;EACA,OAAA;EACA,mBAAA;EACA,iBAAA;EACA,oBAAA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,oBAAA;AClIA;ADmIA;EACA,YAAA;EACA,eAAA;EACA,8BAAA;ACjIA;ADoIA;EACA,WAAA;EACA,aAAA;EACA,sBAAA;EACA,mBAAA;EACA,6BAAA;AClIA;ADmIA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;EACA,iBAAA;EACA,mBAAA;EACA,yCAAA;ACjIA;ADmIA;EACA,UAAA;EACA,yBAAA;EACA,iBAAA;EACA,mBAAA;EACA,qCAAA;ACjIA;ADoIA;EACA,gBAAA;EACA,OAAA;EACA,kBAAA;EACA,iBAAA;EACA,oBAAA;AClIA;ADmIA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;ACjIA;ADkIA;EACA,8BAAA;EACA,eAAA;EACA,iBAAA;AChIA;ADkIA;EACA,eAAA;EACA,8BAAA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AChIA;ADiIA;EACA,WAAA;EACA,qBAAA;EACA,UAAA;EACA,WAAA;EACA,kBAAA;EACA,iBAAA;AC/HA;ADkIA;EACA,oCAAA;AChIA;ADoIA;EACA,oCAAA;AClIA;ADsIA;EACA,kCAAA;ACpIA;ADyIA;EACA,iBAAA;EACA,eAAA;EACA,iBAAA;ACvIA;ADwIA;EACA,8BAAA;EACA,eAAA;EACA,iBAAA;ACtIA;ADyIA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACvIA;ADwIA;EACA,cAAA;EACA,eAAA;EACA,8BAAA;ACtIA;ADwIA;EACA,eAAA;EACA,8BAAA;EACA,iBAAA;EACA,gBAAA;ACtIA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"ele-timeline__wrapper\">\n <div class=\"ele-timeline__item\" v-for=\"item in innerDataSource\" :key=\"item.key\">\n <div class=\"ele-timeline__left\">\n <div class=\"titleline-left__date\">{{ item.date }}</div>\n </div>\n <div class=\"ele-timeline__middle\">\n <div class=\"ele-timeline__circle\"></div>\n <div class=\"ele-timeline__traline\"></div>\n </div>\n <div class=\"ele-timeline__right\">\n <slot v-if=\"$scopedSlots.right\" name=\"right\" :data=\"item\"></slot>\n <template v-else>\n <div class=\"timeline-right__title\">\n <span class=\"title\">{{ item.title }}</span>\n <span :class=\"['title-info', item.state == 1 && 'success', item.state == 2 && 'warning', item.state == 3 && 'error']\">{{ item.stateName }}</span>\n </div>\n <div class=\"timeline-right__oper\">\n 由\n <span class=\"oper-name\">{{ item.userName }}</span>\n 操作\n </div>\n <div class=\"timeline-right__subtitle\" v-for=\"label in item.labelList\" :key=\"label.value\">\n <div class=\"right-subtitle__field\">{{ label.label }}:</div>\n <div class=\"right-subtitle__content\">{{ label.value }}</div>\n </div>\n </template>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { net, type } from '@idooel/shared'\nimport { v4 as uuidv4 } from 'uuid'\nimport { CONTEXT, parseFieldMap } from '../../utils'\nexport default {\n name: 'ele-timeline',\n props: {\n url: {\n type: String\n },\n params: {\n type: Object,\n default: () => ({})\n },\n requestType: {\n type: String,\n default: 'GET'\n },\n fieldMap: {\n type: Object,\n default: () => ({})\n },\n params: {\n type: Object,\n default: () => ({})\n },\n dataSource: {\n type: Array,\n default: () => ([\n // {\n // date: '2023/05/09 03:34:56',\n // title: 123,\n // state: 1,\n // stateName: '成功',\n // userName: 'Name',\n // labelList: [\n // {\n // label: 'label',\n // value: 'value'\n // }\n // ],\n // action: '结班',\n // opinion: '意见'\n // }\n ])\n }\n },\n data () {\n return {\n innerDataSource: []\n }\n },\n inject: {\n [CONTEXT]: {\n default: () => (() => ({}))\n }\n },\n computed: {\n expressionData () {\n return {\n _route: this.$route.query,\n ...this[CONTEXT]()\n }\n }\n },\n async created() {\n if (this.url) {\n this.innerDataSource = await this.requestData()\n } else if (!type.isEmpty(this.dataSource)) {\n this.innerDataSource = this.dataSource\n } else {\n console.warn('ele-timeline: 请传入数据源')\n }\n },\n methods: {\n async requestData () {\n const ret = await net[this.requestType.toLowerCase()](\n this.url,\n { ...this.params, ...parseFieldMap(this.fieldMap, this.expressionData) }\n ).then(resp => {\n const { data } = resp || {}\n return data.map(item => {\n return {\n key: uuidv4(),\n ...item\n }\n })\n })\n return ret\n }\n }\n}\n</script>\n<style lang=\"scss\">\n@import '../../theme/index';\n</style>\n<style lang=\"scss\" scoped>\n.ele-timeline__wrapper {\n width: 100%;\n height: 100%;\n .ele-timeline__item {\n display: flex;\n flex-direction: row;\n &:last-child {\n .ele-timeline__middle {\n .ele-timeline__traline {\n display: none;\n }\n }\n }\n .ele-timeline__left {\n flex: 1;\n padding-right: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n text-align: right;\n display: flex;\n flex-direction: row;\n justify-content: end;\n .titleline-left__date {\n width: 100px;\n font-size: 14px;\n color: var(--idoole-black-064);\n }\n }\n .ele-timeline__middle {\n width: 10px;\n display: flex;\n flex-direction: column;\n align-items: center;\n transform: translate(0, 20px);\n .ele-timeline__circle {\n width: 100%;\n height: 10px;\n border-radius: 50%;\n border-width: 2px;\n border-style: solid;\n border-color: var(--idooel-primary-color);\n }\n .ele-timeline__traline {\n width: 1px;\n height: calc(100% - 10px);\n border-width: 1px;\n border-style: solid;\n border-color: var(--idoole-black-016);\n }\n }\n .ele-timeline__right {\n text-align: left;\n flex: 2;\n padding-left: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n .timeline-right__title {\n line-height: 22px;\n display: flex;\n flex-direction: row;\n .title {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n }\n .title-info {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n &::before {\n content: '';\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n }\n &.success {\n &::before {\n background: var(--idoole-success-06);\n }\n }\n &.warning {\n &::before {\n background: var(--idoole-warning-06);\n }\n }\n &.error {\n &::before {\n background: var(--idoole-error-06);\n }\n }\n }\n }\n .timeline-right__oper {\n line-height: 22px;\n margin-top: 8px;\n margin-left: 12px;\n .oper-name {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n }\n }\n .timeline-right__subtitle {\n margin-left: 12px;\n display: flex;\n flex-direction: row;\n line-height: 22px;\n margin-top: 4px;\n .right-subtitle__field {\n flex-shrink: 0;\n font-size: 14px;\n color: var(--idoole-black-064);\n }\n .right-subtitle__content {\n font-size: 14px;\n color: var(--idoole-black-088);\n font-weight: bold;\n margin-left: 4px;\n }\n }\n }\n }\n}\n</style>",".ele-timeline__wrapper {\n width: 100%;\n height: 100%;\n}\n.ele-timeline__wrapper .ele-timeline__item {\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item:last-child .ele-timeline__middle .ele-timeline__traline {\n display: none;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left {\n flex: 1;\n padding-right: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n text-align: right;\n display: flex;\n flex-direction: row;\n justify-content: end;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left .titleline-left__date {\n width: 100px;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle {\n width: 10px;\n display: flex;\n flex-direction: column;\n align-items: center;\n transform: translate(0, 20px);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__circle {\n width: 100%;\n height: 10px;\n border-radius: 50%;\n border-width: 2px;\n border-style: solid;\n border-color: var(--idooel-primary-color);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__traline {\n width: 1px;\n height: calc(100% - 10px);\n border-width: 1px;\n border-style: solid;\n border-color: var(--idoole-black-016);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right {\n text-align: left;\n flex: 2;\n padding-left: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title {\n line-height: 22px;\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info::before {\n content: \"\";\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.success::before {\n background: var(--idoole-success-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.warning::before {\n background: var(--idoole-warning-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.error::before {\n background: var(--idoole-error-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper {\n line-height: 22px;\n margin-top: 8px;\n margin-left: 12px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper .oper-name {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle {\n margin-left: 12px;\n display: flex;\n flex-direction: row;\n line-height: 22px;\n margin-top: 4px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__field {\n flex-shrink: 0;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__content {\n font-size: 14px;\n color: var(--idoole-black-088);\n font-weight: bold;\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
8058
|
+
inject("data-v-717789a6_0", { source: ".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n.margin-t-8 {\n margin-top: 8px;\n}\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,qBAAqB;AACvB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AAEA;EACE,eAAe;AACjB;AAEA;EACE,+BAA+B;EAC/B,sCAAsC;EACtC,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,uCAAuC;EACvC,uCAAuC;EACvC,mDAAmD;EACnD,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;EACrC,2CAA2C;EAC3C,6BAA6B;EAC7B,iCAAiC;EACjC,qDAAqD;EACrD,kDAAkD;EAClD,gDAAgD;EAChD,gCAAgC;EAChC,uCAAuC;EACvC,yBAAyB;EACzB,yBAAyB;EACzB,oCAAoC;AACtC;AAEA;EACE,4DAA4D;AAC9D;AAEA;EACE,4DAA4D;AAC9D;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n\n.margin-t-8 {\n margin-top: 8px;\n}\n\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined })
|
|
8059
|
+
,inject("data-v-717789a6_1", { source: ".ele-timeline__wrapper[data-v-717789a6] {\n width: 100%;\n height: 100%;\n}\n.ele-timeline__wrapper .ele-timeline__item[data-v-717789a6] {\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item:last-child .ele-timeline__middle .ele-timeline__traline[data-v-717789a6] {\n display: none;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left[data-v-717789a6] {\n flex: 1;\n padding-right: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n text-align: right;\n display: flex;\n flex-direction: row;\n justify-content: end;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left .titleline-left__date[data-v-717789a6] {\n width: 100px;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle[data-v-717789a6] {\n width: 10px;\n display: flex;\n flex-direction: column;\n align-items: center;\n transform: translate(0, 20px);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__circle[data-v-717789a6] {\n width: 100%;\n height: 10px;\n border-radius: 50%;\n border-width: 2px;\n border-style: solid;\n border-color: var(--idooel-primary-color);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__traline[data-v-717789a6] {\n width: 1px;\n height: calc(100% - 10px);\n border-width: 1px;\n border-style: solid;\n border-color: var(--idoole-black-016);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right[data-v-717789a6] {\n text-align: left;\n flex: 2;\n padding-left: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title[data-v-717789a6] {\n line-height: 22px;\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title[data-v-717789a6] {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info[data-v-717789a6] {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info[data-v-717789a6]::before {\n content: \"\";\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.success[data-v-717789a6]::before {\n background: var(--idoole-success-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.warning[data-v-717789a6]::before {\n background: var(--idoole-warning-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.error[data-v-717789a6]::before {\n background: var(--idoole-error-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper[data-v-717789a6] {\n line-height: 22px;\n margin-top: 8px;\n margin-left: 12px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper .oper-name[data-v-717789a6] {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle[data-v-717789a6] {\n margin-left: 12px;\n display: flex;\n flex-direction: row;\n line-height: 22px;\n margin-top: 4px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__field[data-v-717789a6] {\n flex-shrink: 0;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__content[data-v-717789a6] {\n font-size: 14px;\n color: var(--idoole-black-088);\n font-weight: bold;\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\timeline\\src\\index.vue","index.vue"],"names":[],"mappings":"AAiIA;EACA,WAAA;EACA,YAAA;AChIA;ADiIA;EACA,aAAA;EACA,mBAAA;AC/HA;ADkIA;EACA,aAAA;AChIA;ADoIA;EACA,OAAA;EACA,mBAAA;EACA,iBAAA;EACA,oBAAA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,oBAAA;AClIA;ADmIA;EACA,YAAA;EACA,eAAA;EACA,8BAAA;ACjIA;ADoIA;EACA,WAAA;EACA,aAAA;EACA,sBAAA;EACA,mBAAA;EACA,6BAAA;AClIA;ADmIA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;EACA,iBAAA;EACA,mBAAA;EACA,yCAAA;ACjIA;ADmIA;EACA,UAAA;EACA,yBAAA;EACA,iBAAA;EACA,mBAAA;EACA,qCAAA;ACjIA;ADoIA;EACA,gBAAA;EACA,OAAA;EACA,kBAAA;EACA,iBAAA;EACA,oBAAA;AClIA;ADmIA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;ACjIA;ADkIA;EACA,8BAAA;EACA,eAAA;EACA,iBAAA;AChIA;ADkIA;EACA,eAAA;EACA,8BAAA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AChIA;ADiIA;EACA,WAAA;EACA,qBAAA;EACA,UAAA;EACA,WAAA;EACA,kBAAA;EACA,iBAAA;AC/HA;ADkIA;EACA,oCAAA;AChIA;ADoIA;EACA,oCAAA;AClIA;ADsIA;EACA,kCAAA;ACpIA;ADyIA;EACA,iBAAA;EACA,eAAA;EACA,iBAAA;ACvIA;ADwIA;EACA,8BAAA;EACA,eAAA;EACA,iBAAA;ACtIA;ADyIA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACvIA;ADwIA;EACA,cAAA;EACA,eAAA;EACA,8BAAA;ACtIA;ADwIA;EACA,eAAA;EACA,8BAAA;EACA,iBAAA;EACA,gBAAA;ACtIA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele-timeline__wrapper\">\r\n <div class=\"ele-timeline__item\" v-for=\"item in innerDataSource\" :key=\"item.key\">\r\n <div class=\"ele-timeline__left\">\r\n <div class=\"titleline-left__date\">{{ item.date }}</div>\r\n </div>\r\n <div class=\"ele-timeline__middle\">\r\n <div class=\"ele-timeline__circle\"></div>\r\n <div class=\"ele-timeline__traline\"></div>\r\n </div>\r\n <div class=\"ele-timeline__right\">\r\n <slot v-if=\"$scopedSlots.right\" name=\"right\" :data=\"item\"></slot>\r\n <template v-else>\r\n <div class=\"timeline-right__title\">\r\n <span class=\"title\">{{ item.title }}</span>\r\n <span :class=\"['title-info', item.state == 1 && 'success', item.state == 2 && 'warning', item.state == 3 && 'error']\">{{ item.stateName }}</span>\r\n </div>\r\n <div class=\"timeline-right__oper\">\r\n 由\r\n <span class=\"oper-name\">{{ item.userName }}</span>\r\n 操作\r\n </div>\r\n <div class=\"timeline-right__subtitle\" v-for=\"label in item.labelList\" :key=\"label.value\">\r\n <div class=\"right-subtitle__field\">{{ label.label }}:</div>\r\n <div class=\"right-subtitle__content\">{{ label.value }}</div>\r\n </div>\r\n </template>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { net, type } from '@idooel/shared'\r\nimport { v4 as uuidv4 } from 'uuid'\r\nimport { CONTEXT, parseFieldMap } from '../../utils'\r\nexport default {\r\n name: 'ele-timeline',\r\n props: {\r\n url: {\r\n type: String\r\n },\r\n params: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n requestType: {\r\n type: String,\r\n default: 'GET'\r\n },\r\n fieldMap: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n params: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => ([\r\n // {\r\n // date: '2023/05/09 03:34:56',\r\n // title: 123,\r\n // state: 1,\r\n // stateName: '成功',\r\n // userName: 'Name',\r\n // labelList: [\r\n // {\r\n // label: 'label',\r\n // value: 'value'\r\n // }\r\n // ],\r\n // action: '结班',\r\n // opinion: '意见'\r\n // }\r\n ])\r\n }\r\n },\r\n data () {\r\n return {\r\n innerDataSource: []\r\n }\r\n },\r\n inject: {\r\n [CONTEXT]: {\r\n default: () => (() => ({}))\r\n }\r\n },\r\n computed: {\r\n expressionData () {\r\n return {\r\n _route: this.$route.query,\r\n ...this[CONTEXT]()\r\n }\r\n }\r\n },\r\n async created() {\r\n if (this.url) {\r\n this.innerDataSource = await this.requestData()\r\n } else if (!type.isEmpty(this.dataSource)) {\r\n this.innerDataSource = this.dataSource\r\n } else {\r\n console.warn('ele-timeline: 请传入数据源')\r\n }\r\n },\r\n methods: {\r\n async requestData () {\r\n const ret = await net[this.requestType.toLowerCase()](\r\n this.url,\r\n { ...this.params, ...parseFieldMap(this.fieldMap, this.expressionData) }\r\n ).then(resp => {\r\n const { data } = resp || {}\r\n return data.map(item => {\r\n return {\r\n key: uuidv4(),\r\n ...item\r\n }\r\n })\r\n })\r\n return ret\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\">\r\n@import '../../theme/index';\r\n</style>\r\n<style lang=\"scss\" scoped>\r\n.ele-timeline__wrapper {\r\n width: 100%;\r\n height: 100%;\r\n .ele-timeline__item {\r\n display: flex;\r\n flex-direction: row;\r\n &:last-child {\r\n .ele-timeline__middle {\r\n .ele-timeline__traline {\r\n display: none;\r\n }\r\n }\r\n }\r\n .ele-timeline__left {\r\n flex: 1;\r\n padding-right: 12px;\r\n padding-top: 16px;\r\n padding-bottom: 16px;\r\n text-align: right;\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: end;\r\n .titleline-left__date {\r\n width: 100px;\r\n font-size: 14px;\r\n color: var(--idoole-black-064);\r\n }\r\n }\r\n .ele-timeline__middle {\r\n width: 10px;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n transform: translate(0, 20px);\r\n .ele-timeline__circle {\r\n width: 100%;\r\n height: 10px;\r\n border-radius: 50%;\r\n border-width: 2px;\r\n border-style: solid;\r\n border-color: var(--idooel-primary-color);\r\n }\r\n .ele-timeline__traline {\r\n width: 1px;\r\n height: calc(100% - 10px);\r\n border-width: 1px;\r\n border-style: solid;\r\n border-color: var(--idoole-black-016);\r\n }\r\n }\r\n .ele-timeline__right {\r\n text-align: left;\r\n flex: 2;\r\n padding-left: 12px;\r\n padding-top: 16px;\r\n padding-bottom: 16px;\r\n .timeline-right__title {\r\n line-height: 22px;\r\n display: flex;\r\n flex-direction: row;\r\n .title {\r\n color: var(--idoole-black-088);\r\n font-size: 14px;\r\n font-weight: bold;\r\n }\r\n .title-info {\r\n font-size: 14px;\r\n color: var(--idoole-black-064);\r\n margin-left: 16px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n &::before {\r\n content: '';\r\n display: inline-block;\r\n width: 6px;\r\n height: 6px;\r\n border-radius: 50%;\r\n margin-right: 8px;\r\n }\r\n &.success {\r\n &::before {\r\n background: var(--idoole-success-06);\r\n }\r\n }\r\n &.warning {\r\n &::before {\r\n background: var(--idoole-warning-06);\r\n }\r\n }\r\n &.error {\r\n &::before {\r\n background: var(--idoole-error-06);\r\n }\r\n }\r\n }\r\n }\r\n .timeline-right__oper {\r\n line-height: 22px;\r\n margin-top: 8px;\r\n margin-left: 12px;\r\n .oper-name {\r\n color: var(--idoole-black-088);\r\n font-size: 14px;\r\n font-weight: bold;\r\n }\r\n }\r\n .timeline-right__subtitle {\r\n margin-left: 12px;\r\n display: flex;\r\n flex-direction: row;\r\n line-height: 22px;\r\n margin-top: 4px;\r\n .right-subtitle__field {\r\n flex-shrink: 0;\r\n font-size: 14px;\r\n color: var(--idoole-black-064);\r\n }\r\n .right-subtitle__content {\r\n font-size: 14px;\r\n color: var(--idoole-black-088);\r\n font-weight: bold;\r\n margin-left: 4px;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</style>",".ele-timeline__wrapper {\n width: 100%;\n height: 100%;\n}\n.ele-timeline__wrapper .ele-timeline__item {\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item:last-child .ele-timeline__middle .ele-timeline__traline {\n display: none;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left {\n flex: 1;\n padding-right: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n text-align: right;\n display: flex;\n flex-direction: row;\n justify-content: end;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__left .titleline-left__date {\n width: 100px;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle {\n width: 10px;\n display: flex;\n flex-direction: column;\n align-items: center;\n transform: translate(0, 20px);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__circle {\n width: 100%;\n height: 10px;\n border-radius: 50%;\n border-width: 2px;\n border-style: solid;\n border-color: var(--idooel-primary-color);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__middle .ele-timeline__traline {\n width: 1px;\n height: calc(100% - 10px);\n border-width: 1px;\n border-style: solid;\n border-color: var(--idoole-black-016);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right {\n text-align: left;\n flex: 2;\n padding-left: 12px;\n padding-top: 16px;\n padding-bottom: 16px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title {\n line-height: 22px;\n display: flex;\n flex-direction: row;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info::before {\n content: \"\";\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.success::before {\n background: var(--idoole-success-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.warning::before {\n background: var(--idoole-warning-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__title .title-info.error::before {\n background: var(--idoole-error-06);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper {\n line-height: 22px;\n margin-top: 8px;\n margin-left: 12px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__oper .oper-name {\n color: var(--idoole-black-088);\n font-size: 14px;\n font-weight: bold;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle {\n margin-left: 12px;\n display: flex;\n flex-direction: row;\n line-height: 22px;\n margin-top: 4px;\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__field {\n flex-shrink: 0;\n font-size: 14px;\n color: var(--idoole-black-064);\n}\n.ele-timeline__wrapper .ele-timeline__item .ele-timeline__right .timeline-right__subtitle .right-subtitle__content {\n font-size: 14px;\n color: var(--idoole-black-088);\n font-weight: bold;\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
7050
8060
|
|
|
7051
8061
|
};
|
|
7052
8062
|
/* scoped */
|
|
7053
|
-
const __vue_scope_id__$k = "data-v-
|
|
8063
|
+
const __vue_scope_id__$k = "data-v-717789a6";
|
|
7054
8064
|
/* module identifier */
|
|
7055
8065
|
const __vue_module_identifier__$k = undefined;
|
|
7056
8066
|
/* functional template */
|
|
@@ -7128,11 +8138,11 @@ __vue_render__$j._withStripped = true;
|
|
|
7128
8138
|
/* style */
|
|
7129
8139
|
const __vue_inject_styles__$j = function (inject) {
|
|
7130
8140
|
if (!inject) return
|
|
7131
|
-
inject("data-v-
|
|
8141
|
+
inject("data-v-45452493_0", { source: ".ele-text__wrapper[data-v-45452493] {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-text__wrapper.default .anticon[data-v-45452493], .ele-text__wrapper.default .message[data-v-45452493] {\n color: var(--idoole-black-064);\n}\n.ele-text__wrapper .anticon[data-v-45452493] {\n font-size: 16px;\n}\n.ele-text__wrapper .message[data-v-45452493] {\n font-size: 14px;\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\text\\src\\index.vue","index.vue"],"names":[],"mappings":"AA8BA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AC7BA;AD+BA;EACA,8BAAA;AC7BA;ADgCA;EACA,eAAA;AC9BA;ADgCA;EACA,eAAA;EACA,gBAAA;AC9BA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div :class=\"['ele-text__wrapper', type]\">\r\n <ele-icon theme=\"filled\" :type=\"icon\"></ele-icon>\r\n <span class=\"message\">{{ message }}</span>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-text',\r\n props: {\r\n type: {\r\n String,\r\n // default success error warning info\r\n default: 'default'\r\n },\r\n message: {\r\n type: String\r\n }\r\n },\r\n computed: {\r\n icon() {\r\n return 'info-circle'\r\n }\r\n },\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n//\r\n.ele-text__wrapper {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n &.default {\r\n .anticon, .message {\r\n color: var(--idoole-black-064);\r\n }\r\n }\r\n .anticon {\r\n font-size: 16px;\r\n }\r\n .message {\r\n font-size: 14px;\r\n margin-left: 4px;\r\n }\r\n}\r\n</style>",".ele-text__wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-text__wrapper.default .anticon, .ele-text__wrapper.default .message {\n color: var(--idoole-black-064);\n}\n.ele-text__wrapper .anticon {\n font-size: 16px;\n}\n.ele-text__wrapper .message {\n font-size: 14px;\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
7132
8142
|
|
|
7133
8143
|
};
|
|
7134
8144
|
/* scoped */
|
|
7135
|
-
const __vue_scope_id__$j = "data-v-
|
|
8145
|
+
const __vue_scope_id__$j = "data-v-45452493";
|
|
7136
8146
|
/* module identifier */
|
|
7137
8147
|
const __vue_module_identifier__$j = undefined;
|
|
7138
8148
|
/* functional template */
|
|
@@ -7269,11 +8279,11 @@ __vue_render__$i._withStripped = true;
|
|
|
7269
8279
|
/* style */
|
|
7270
8280
|
const __vue_inject_styles__$i = function (inject) {
|
|
7271
8281
|
if (!inject) return
|
|
7272
|
-
inject("data-v-
|
|
8282
|
+
inject("data-v-9485b23c_0", { source: "[data-v-9485b23c] .ant-tabs-nav-scroll {\n float: left !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\tabs\\src\\index.vue","index.vue"],"names":[],"mappings":"AAoDA;EACA,sBAAA;ACnDA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div>\r\n <a-tabs :default-active-key=\"activeKey\" :tabBarGutter=\"tabBarGutter\" :tabBarStyle=\"tabBarStyle\" @change=\"changeHandle\">\r\n <a-tab-pane v-for=\"(item, index) in tabsList\" :key=\"index\" :tab=\"item.tabName\" :disabled=\"item.disabled\">\r\n <template #tab>\r\n <component v-if=\"item.renderHeader\" :is=\"item.renderHeader\" ></component>\r\n <span v-else>{{ item.tabName }}</span>\r\n </template>\r\n <component :is=\"item.content\"></component>\r\n </a-tab-pane>\r\n </a-tabs>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-tabs',\r\n components: {},\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n activeKey: {\r\n type: Number,\r\n default: 0\r\n },\r\n tabsList: {\r\n type: Array,\r\n default () {\r\n return []\r\n }\r\n },\r\n tabBarStyle: {\r\n type: Object,\r\n default () {\r\n return {}\r\n }\r\n },\r\n tabBarGutter: {\r\n type: Number\r\n }\r\n },\r\n methods: {\r\n changeHandle (key) {\r\n this.$emit('changeActiveKey', key)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n::v-deep .ant-tabs-nav-scroll {\r\n float: left !important;\r\n}\r\n</style>","::v-deep .ant-tabs-nav-scroll {\n float: left !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
7273
8283
|
|
|
7274
8284
|
};
|
|
7275
8285
|
/* scoped */
|
|
7276
|
-
const __vue_scope_id__$i = "data-v-
|
|
8286
|
+
const __vue_scope_id__$i = "data-v-9485b23c";
|
|
7277
8287
|
/* module identifier */
|
|
7278
8288
|
const __vue_module_identifier__$i = undefined;
|
|
7279
8289
|
/* functional template */
|
|
@@ -11294,11 +12304,11 @@ __vue_render__$h._withStripped = true;
|
|
|
11294
12304
|
/* style */
|
|
11295
12305
|
const __vue_inject_styles__$h = function (inject) {
|
|
11296
12306
|
if (!inject) return
|
|
11297
|
-
inject("data-v-600a1f56_0", { source: "[data-v-600a1f56] .ant-modal-body {\n padding: 16px;\n}\n[data-v-600a1f56] .ant-modal-header {\n padding: 16px;\n}\n.ele-imgCrop__wrapper[data-v-600a1f56] {\n display: flex;\n gap: 16px;\n justify-content: center;\n margin-bottom: 30px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg[data-v-600a1f56] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .img-crop-left__image[data-v-600a1f56] {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-600a1f56] {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-600a1f56] .ele-upload__inner {\n height: 100%;\n border: unset;\n background: transparent !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-600a1f56] .ele-upload__inner .ele-upload__area {\n display: flex;\n flex-direction: column;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-600a1f56] .ele-upload__inner .ele-upload__area .ele-upload__area--text {\n margin-top: 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font1[data-v-600a1f56] {\n color: var(--idoole-black-088);\n font-size: 16px;\n line-height: 24px !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font2[data-v-600a1f56] {\n color: var(--idoole-black-06);\n font-size: 14px;\n line-height: 22px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__update[data-v-600a1f56] {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n cursor: pointer;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right[data-v-600a1f56] {\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right span[data-v-600a1f56] {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right .img-crop-right__image[data-v-600a1f56] {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__item[data-v-600a1f56] {\n width: 480px;\n height: 300px;\n border-radius: 2px;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color);\n}\n.ele-imgCrop__tips[data-v-600a1f56] {\n float: left;\n width: 80%;\n}\n.ele-imgCrop__error[data-v-600a1f56] {\n color: var(--idooel-form-border-err-color) !important;\n}\n.ele-imgCrop__error2[data-v-600a1f56] {\n color: var(--idooel-img-crop-err-color) !important;\n}\n.ele-imgCrop__icon[data-v-600a1f56] {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/composite-components/modal-img-crop/src/index.vue","index.vue"],"names":[],"mappings":"AAoMA;EACA,aAAA;ACnMA;ADqMA;EACA,aAAA;AClMA;ADoMA;EACA,aAAA;EACA,SAAA;EACA,uBAAA;EACA,mBAAA;ACjMA;ADmMA;EACA,aAAA;EACA,sBAAA;EACA,uBAAA;EACA,mBAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;ACjMA;ADkMA;EACA,WAAA;EACA,YAAA;AChMA;ADkMA;EACA,WAAA;EACA,YAAA;AChMA;ADiMA;EACA,YAAA;EACA,aAAA;EACA,kCAAA;AC/LA;ADgMA;EACA,aAAA;EACA,sBAAA;EACA,YAAA;EACA,mBAAA;EACA,uBAAA;AC9LA;AD+LA;EACA,gBAAA;EACA,aAAA;EACA,sBAAA;EACA,mBAAA;AC7LA;ADkMA;EACA,8BAAA;EACA,eAAA;EACA,4BAAA;AChMA;ADkMA;EACA,6BAAA;EACA,eAAA;EACA,iBAAA;AChMA;ADmMA;EACA,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,eAAA;ACjMA;ADoMA;EACA,kBAAA;AClMA;ADmMA;EACA,kBAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;ACjMA;ADmMA;EACA,WAAA;EACA,YAAA;ACjMA;ADoMA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;EACA,wDAAA;EACA,8CAAA;AClMA;ADqMA;EACA,WAAA;EACA,UAAA;AClMA;ADoMA;EACA,qDAAA;ACjMA;ADmMA;EACA,kDAAA;AChMA;ADkMA;EACA,eAAA;EACA,4BAAA;AC/LA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div>\n <ele-modal\n :ref=\"getEleModal\"\n :title=\"title\"\n :cancelText=\"cancelText\"\n :maskClosable=\"maskClosable\"\n v-on=\"$listeners\"\n :size=\"size\"\n :value=\"value\"\n @ok=\"handleOk\"\n @cancel=\"handleCancel\"\n :showDefaultFooter=\"true\"\n >\n <div class=\"ele-imgCrop__wrapper\">\n <div class=\"ele-imgCrop__left ele-imgCrop__item\">\n <div class=\"ele-imgCrop__noImg\">\n <ele-upload v-if=\"!fileId\" v-bind=\"uploadFileConfig\" class=\"ele-img-crop__upload\" @on-success=\"onUploadFileSuccess\" icon=\"inbox\" url=\"api/zuul/api-file/workbench/file\"></ele-upload>\n <template v-else>\n <img :ref=\"leftImage\" class=\"img-crop-left__image\" :src=\"imageUrl\" alt=\"\">\n </template>\n </div>\n <div class=\"margin-t-8\">\n <span v-if=\"imgtips\" class=\"ele-imgCrop__font1 ele-imgCrop__tips\" :class=\"isFail? 'ele-imgCrop__error' : ''\">{{ imgtips }}</span>\n <template v-else>\n <span class=\"ele-imgCrop__font1\">{{ fileName }}</span>\n <a-icon v-if=\"fileId || fileName\" @click=\"handleClickDeleteFile\" type=\"close\" style=\"cursor: pointer;float: right; line-height: 24px;\"/>\n </template>\n </div>\n </div>\n <div class=\"ele-imgCrop__right ele-imgCrop__item\">\n <span v-if=\"!fileId\" class=\"ele-imgCrop__font2\">左侧上传图片后可预览</span>\n <template v-else>\n <img class=\"img-crop-right__image\" :src=\"previewBase\" alt=\"\">\n </template>\n </div>\n </div>\n </ele-modal>\n </div>\n</template>\n\n<script>\nimport { v4 as uuidv4 } from 'uuid'\nimport Cropper from 'cropperjs'\nimport { util, net } from '@idooel/shared'\nexport default {\n name: 'ele-modal-img-crop',\n model: {\n event: 'input',\n prop: 'value'\n },\n props: {\n title: {\n type: String,\n default: '图像裁剪'\n },\n uploadFileConfig: {\n type: Object,\n default: () => {\n return {\n size: 10,\n accept: '*',\n byteConversion: 1024 * 1024\n }\n }\n },\n imageId: {\n type: String\n },\n maskClosable: {\n type: Boolean,\n default () {\n return false\n }\n },\n size: {\n type: String,\n default () {\n return 'big'\n }\n },\n value: {\n type: Boolean,\n default () {\n return false\n }\n },\n cropperConfig: {\n type: Object,\n default: () => {\n return {\n aspectRatio: 16 / 9\n }\n }\n }\n },\n data () {\n return {\n haveImg: false,\n imgtips: null,\n isFail: false,\n cancelText: '取消',\n fileName: null,\n fileId: null,\n previewBase: null,\n cropper: null\n }\n },\n computed: {\n leftImage () {\n return uuidv4()\n },\n imageUrl () {\n return `/api-file/workbench/file/stream/${this.fileId}?origin=true`\n },\n getEleModal () {\n return uuidv4()\n }\n },\n watch: {\n value: {\n handler (value) {\n this.fileId = this.imageId\n if (value && this.fileId) {\n setTimeout(() => {\n this.initCropper()\n })\n }\n },\n immediate: true\n }\n },\n methods: {\n handleCancel () {\n this.$emit('input', false)\n this.$emit('change', this.fileId)\n },\n handleClickDeleteFile () {\n this.fileId = null\n this.fileName = null\n this.cropper && this.cropper.destroy()\n },\n blobToFile(blob, fileName = 'file.png') {\n return new File([blob], fileName, {\n type: blob.type,\n lastModified: Date.now()\n })\n },\n handleOk () {\n this.cropper && this.cropper.getCroppedCanvas().toBlob(async (blob) => {\n await this.uploadFile(this.blobToFile(blob, this.fileName))\n this.$emit('input', false)\n this.$emit('change', this.fileId)\n })\n },\n async uploadFile (file) {\n const formData = new FormData()\n formData.append('serviceCode', 'cover-image')\n formData.append('_t', Math.random())\n formData.append('file', file)\n await net.post(\n 'zuul/api-file/workbench/file' + '?_csrf=' + localStorage.getItem('token'),\n formData\n ).then((resp) => {\n const { data: { fileID } } = resp\n this.fileId = fileID\n })\n },\n initCropper () {\n let previewReady = false\n this.cropper = new Cropper(this.$refs[this.leftImage], {\n aspectRatio: this.cropperConfig.aspectRatio,\n ready: () => {\n previewReady = true\n },\n crop: util.debounce(() => {\n if (!previewReady) {\n return\n }\n this.previewBase = this.cropper.getCroppedCanvas().toDataURL()\n }, 200)\n })\n },\n onUploadFileSuccess (props) {\n const { response: { data: { fileID } }, name } = props\n this.fileId = fileID\n this.fileName = name\n this.$nextTick(() => {\n this.initCropper()\n })\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n::v-deep .ant-modal-body {\n padding: 16px;\n}\n::v-deep .ant-modal-header {\n padding: 16px;\n}\n.ele-imgCrop__wrapper {\n display: flex;\n gap: 16px;\n justify-content: center;\n margin-bottom: 30px;\n .ele-imgCrop__left {\n .ele-imgCrop__noImg {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n position: relative;\n .img-crop-left__image {\n width: 100%;\n height: 100%;\n }\n .ele-img-crop__upload {\n width: 100%;\n height: 100%;\n ::v-deep .ele-upload__inner {\n height: 100%;\n border: unset;\n background: transparent !important;\n .ele-upload__area {\n display: flex;\n flex-direction: column;\n height: 100%;\n align-items: center;\n justify-content: center;\n .ele-upload__area--text {\n margin-top: 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n }\n }\n }\n .ele-imgCrop__font1 {\n color: var(--idoole-black-088);\n font-size: 16px;\n line-height: 24px !important;\n }\n .ele-imgCrop__font2 {\n color: var(--idoole-black-06);\n font-size: 14px;\n line-height: 22px; \n }\n }\n .ele-imgCrop__update {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n cursor: pointer;\n }\n }\n .ele-imgCrop__right {\n position: relative;\n span {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n .img-crop-right__image {\n width: 100%;\n height: 100%;\n }\n }\n .ele-imgCrop__item {\n width: 480px;\n height: 300px;\n border-radius: 2px;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color);\n }\n}\n.ele-imgCrop__tips {\n float: left;\n width: 80%;\n}\n.ele-imgCrop__error {\n color: var(--idooel-form-border-err-color) !important;\n}\n.ele-imgCrop__error2 {\n color: var(--idooel-img-crop-err-color) !important;\n}\n.ele-imgCrop__icon {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n</style>","::v-deep .ant-modal-body {\n padding: 16px;\n}\n\n::v-deep .ant-modal-header {\n padding: 16px;\n}\n\n.ele-imgCrop__wrapper {\n display: flex;\n gap: 16px;\n justify-content: center;\n margin-bottom: 30px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .img-crop-left__image {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload ::v-deep .ele-upload__inner {\n height: 100%;\n border: unset;\n background: transparent !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload ::v-deep .ele-upload__inner .ele-upload__area {\n display: flex;\n flex-direction: column;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload ::v-deep .ele-upload__inner .ele-upload__area .ele-upload__area--text {\n margin-top: 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font1 {\n color: var(--idoole-black-088);\n font-size: 16px;\n line-height: 24px !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font2 {\n color: var(--idoole-black-06);\n font-size: 14px;\n line-height: 22px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__update {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n cursor: pointer;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right {\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right span {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right .img-crop-right__image {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__item {\n width: 480px;\n height: 300px;\n border-radius: 2px;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color);\n}\n\n.ele-imgCrop__tips {\n float: left;\n width: 80%;\n}\n\n.ele-imgCrop__error {\n color: var(--idooel-form-border-err-color) !important;\n}\n\n.ele-imgCrop__error2 {\n color: var(--idooel-img-crop-err-color) !important;\n}\n\n.ele-imgCrop__icon {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
12307
|
+
inject("data-v-3676b54c_0", { source: "[data-v-3676b54c] .ant-modal-body {\n padding: 16px;\n}\n[data-v-3676b54c] .ant-modal-header {\n padding: 16px;\n}\n.ele-imgCrop__wrapper[data-v-3676b54c] {\n display: flex;\n gap: 16px;\n justify-content: center;\n margin-bottom: 30px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg[data-v-3676b54c] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .img-crop-left__image[data-v-3676b54c] {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-3676b54c] {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-3676b54c] .ele-upload__inner {\n height: 100%;\n border: unset;\n background: transparent !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-3676b54c] .ele-upload__inner .ele-upload__area {\n display: flex;\n flex-direction: column;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload[data-v-3676b54c] .ele-upload__inner .ele-upload__area .ele-upload__area--text {\n margin-top: 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font1[data-v-3676b54c] {\n color: var(--idoole-black-088);\n font-size: 16px;\n line-height: 24px !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font2[data-v-3676b54c] {\n color: var(--idoole-black-06);\n font-size: 14px;\n line-height: 22px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__update[data-v-3676b54c] {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n cursor: pointer;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right[data-v-3676b54c] {\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right span[data-v-3676b54c] {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right .img-crop-right__image[data-v-3676b54c] {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__item[data-v-3676b54c] {\n width: 480px;\n height: 300px;\n border-radius: 2px;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color);\n}\n.ele-imgCrop__tips[data-v-3676b54c] {\n float: left;\n width: 80%;\n}\n.ele-imgCrop__error[data-v-3676b54c] {\n color: var(--idooel-form-border-err-color) !important;\n}\n.ele-imgCrop__error2[data-v-3676b54c] {\n color: var(--idooel-img-crop-err-color) !important;\n}\n.ele-imgCrop__icon[data-v-3676b54c] {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\composite-components\\modal-img-crop\\src\\index.vue","index.vue"],"names":[],"mappings":"AAoMA;EACA,aAAA;ACnMA;ADqMA;EACA,aAAA;AClMA;ADoMA;EACA,aAAA;EACA,SAAA;EACA,uBAAA;EACA,mBAAA;ACjMA;ADmMA;EACA,aAAA;EACA,sBAAA;EACA,uBAAA;EACA,mBAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;ACjMA;ADkMA;EACA,WAAA;EACA,YAAA;AChMA;ADkMA;EACA,WAAA;EACA,YAAA;AChMA;ADiMA;EACA,YAAA;EACA,aAAA;EACA,kCAAA;AC/LA;ADgMA;EACA,aAAA;EACA,sBAAA;EACA,YAAA;EACA,mBAAA;EACA,uBAAA;AC9LA;AD+LA;EACA,gBAAA;EACA,aAAA;EACA,sBAAA;EACA,mBAAA;AC7LA;ADkMA;EACA,8BAAA;EACA,eAAA;EACA,4BAAA;AChMA;ADkMA;EACA,6BAAA;EACA,eAAA;EACA,iBAAA;AChMA;ADmMA;EACA,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,eAAA;ACjMA;ADoMA;EACA,kBAAA;AClMA;ADmMA;EACA,kBAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;ACjMA;ADmMA;EACA,WAAA;EACA,YAAA;ACjMA;ADoMA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;EACA,wDAAA;EACA,8CAAA;AClMA;ADqMA;EACA,WAAA;EACA,UAAA;AClMA;ADoMA;EACA,qDAAA;ACjMA;ADmMA;EACA,kDAAA;AChMA;ADkMA;EACA,eAAA;EACA,4BAAA;AC/LA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div>\r\n <ele-modal\r\n :ref=\"getEleModal\"\r\n :title=\"title\"\r\n :cancelText=\"cancelText\"\r\n :maskClosable=\"maskClosable\"\r\n v-on=\"$listeners\"\r\n :size=\"size\"\r\n :value=\"value\"\r\n @ok=\"handleOk\"\r\n @cancel=\"handleCancel\"\r\n :showDefaultFooter=\"true\"\r\n >\r\n <div class=\"ele-imgCrop__wrapper\">\r\n <div class=\"ele-imgCrop__left ele-imgCrop__item\">\r\n <div class=\"ele-imgCrop__noImg\">\r\n <ele-upload v-if=\"!fileId\" v-bind=\"uploadFileConfig\" class=\"ele-img-crop__upload\" @on-success=\"onUploadFileSuccess\" icon=\"inbox\" url=\"api/zuul/api-file/workbench/file\"></ele-upload>\r\n <template v-else>\r\n <img :ref=\"leftImage\" class=\"img-crop-left__image\" :src=\"imageUrl\" alt=\"\">\r\n </template>\r\n </div>\r\n <div class=\"margin-t-8\">\r\n <span v-if=\"imgtips\" class=\"ele-imgCrop__font1 ele-imgCrop__tips\" :class=\"isFail? 'ele-imgCrop__error' : ''\">{{ imgtips }}</span>\r\n <template v-else>\r\n <span class=\"ele-imgCrop__font1\">{{ fileName }}</span>\r\n <a-icon v-if=\"fileId || fileName\" @click=\"handleClickDeleteFile\" type=\"close\" style=\"cursor: pointer;float: right; line-height: 24px;\"/>\r\n </template>\r\n </div>\r\n </div>\r\n <div class=\"ele-imgCrop__right ele-imgCrop__item\">\r\n <span v-if=\"!fileId\" class=\"ele-imgCrop__font2\">左侧上传图片后可预览</span>\r\n <template v-else>\r\n <img class=\"img-crop-right__image\" :src=\"previewBase\" alt=\"\">\r\n </template>\r\n </div>\r\n </div>\r\n </ele-modal>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { v4 as uuidv4 } from 'uuid'\r\nimport Cropper from 'cropperjs'\r\nimport { util, net } from '@idooel/shared'\r\nexport default {\r\n name: 'ele-modal-img-crop',\r\n model: {\r\n event: 'input',\r\n prop: 'value'\r\n },\r\n props: {\r\n title: {\r\n type: String,\r\n default: '图像裁剪'\r\n },\r\n uploadFileConfig: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n size: 10,\r\n accept: '*',\r\n byteConversion: 1024 * 1024\r\n }\r\n }\r\n },\r\n imageId: {\r\n type: String\r\n },\r\n maskClosable: {\r\n type: Boolean,\r\n default () {\r\n return false\r\n }\r\n },\r\n size: {\r\n type: String,\r\n default () {\r\n return 'big'\r\n }\r\n },\r\n value: {\r\n type: Boolean,\r\n default () {\r\n return false\r\n }\r\n },\r\n cropperConfig: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n aspectRatio: 16 / 9\r\n }\r\n }\r\n }\r\n },\r\n data () {\r\n return {\r\n haveImg: false,\r\n imgtips: null,\r\n isFail: false,\r\n cancelText: '取消',\r\n fileName: null,\r\n fileId: null,\r\n previewBase: null,\r\n cropper: null\r\n }\r\n },\r\n computed: {\r\n leftImage () {\r\n return uuidv4()\r\n },\r\n imageUrl () {\r\n return `/api-file/workbench/file/stream/${this.fileId}?origin=true`\r\n },\r\n getEleModal () {\r\n return uuidv4()\r\n }\r\n },\r\n watch: {\r\n value: {\r\n handler (value) {\r\n this.fileId = this.imageId\r\n if (value && this.fileId) {\r\n setTimeout(() => {\r\n this.initCropper()\r\n })\r\n }\r\n },\r\n immediate: true\r\n }\r\n },\r\n methods: {\r\n handleCancel () {\r\n this.$emit('input', false)\r\n this.$emit('change', this.fileId)\r\n },\r\n handleClickDeleteFile () {\r\n this.fileId = null\r\n this.fileName = null\r\n this.cropper && this.cropper.destroy()\r\n },\r\n blobToFile(blob, fileName = 'file.png') {\r\n return new File([blob], fileName, {\r\n type: blob.type,\r\n lastModified: Date.now()\r\n })\r\n },\r\n handleOk () {\r\n this.cropper && this.cropper.getCroppedCanvas().toBlob(async (blob) => {\r\n await this.uploadFile(this.blobToFile(blob, this.fileName))\r\n this.$emit('input', false)\r\n this.$emit('change', this.fileId)\r\n })\r\n },\r\n async uploadFile (file) {\r\n const formData = new FormData()\r\n formData.append('serviceCode', 'cover-image')\r\n formData.append('_t', Math.random())\r\n formData.append('file', file)\r\n await net.post(\r\n 'zuul/api-file/workbench/file' + '?_csrf=' + localStorage.getItem('token'),\r\n formData\r\n ).then((resp) => {\r\n const { data: { fileID } } = resp\r\n this.fileId = fileID\r\n })\r\n },\r\n initCropper () {\r\n let previewReady = false\r\n this.cropper = new Cropper(this.$refs[this.leftImage], {\r\n aspectRatio: this.cropperConfig.aspectRatio,\r\n ready: () => {\r\n previewReady = true\r\n },\r\n crop: util.debounce(() => {\r\n if (!previewReady) {\r\n return\r\n }\r\n this.previewBase = this.cropper.getCroppedCanvas().toDataURL()\r\n }, 200)\r\n })\r\n },\r\n onUploadFileSuccess (props) {\r\n const { response: { data: { fileID } }, name } = props\r\n this.fileId = fileID\r\n this.fileName = name\r\n this.$nextTick(() => {\r\n this.initCropper()\r\n })\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n::v-deep .ant-modal-body {\r\n padding: 16px;\r\n}\r\n::v-deep .ant-modal-header {\r\n padding: 16px;\r\n}\r\n.ele-imgCrop__wrapper {\r\n display: flex;\r\n gap: 16px;\r\n justify-content: center;\r\n margin-bottom: 30px;\r\n .ele-imgCrop__left {\r\n .ele-imgCrop__noImg {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n align-items: center;\r\n width: 100%;\r\n height: 100%;\r\n position: relative;\r\n .img-crop-left__image {\r\n width: 100%;\r\n height: 100%;\r\n }\r\n .ele-img-crop__upload {\r\n width: 100%;\r\n height: 100%;\r\n ::v-deep .ele-upload__inner {\r\n height: 100%;\r\n border: unset;\r\n background: transparent !important;\r\n .ele-upload__area {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n align-items: center;\r\n justify-content: center;\r\n .ele-upload__area--text {\r\n margin-top: 16px;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n }\r\n }\r\n }\r\n }\r\n .ele-imgCrop__font1 {\r\n color: var(--idoole-black-088);\r\n font-size: 16px;\r\n line-height: 24px !important;\r\n }\r\n .ele-imgCrop__font2 {\r\n color: var(--idoole-black-06);\r\n font-size: 14px;\r\n line-height: 22px; \r\n }\r\n }\r\n .ele-imgCrop__update {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n opacity: 0;\r\n cursor: pointer;\r\n }\r\n }\r\n .ele-imgCrop__right {\r\n position: relative;\r\n span {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n }\r\n .img-crop-right__image {\r\n width: 100%;\r\n height: 100%;\r\n }\r\n }\r\n .ele-imgCrop__item {\r\n width: 480px;\r\n height: 300px;\r\n border-radius: 2px;\r\n border: 1px dashed var(--idooel-form-title-border-color);\r\n background: var(--idooel-form-upload-bg-color);\r\n }\r\n}\r\n.ele-imgCrop__tips {\r\n float: left;\r\n width: 80%;\r\n}\r\n.ele-imgCrop__error {\r\n color: var(--idooel-form-border-err-color) !important;\r\n}\r\n.ele-imgCrop__error2 {\r\n color: var(--idooel-img-crop-err-color) !important;\r\n}\r\n.ele-imgCrop__icon {\r\n font-size: 48px;\r\n color: var(--idooel-link-06);\r\n}\r\n</style>","::v-deep .ant-modal-body {\n padding: 16px;\n}\n\n::v-deep .ant-modal-header {\n padding: 16px;\n}\n\n.ele-imgCrop__wrapper {\n display: flex;\n gap: 16px;\n justify-content: center;\n margin-bottom: 30px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .img-crop-left__image {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload ::v-deep .ele-upload__inner {\n height: 100%;\n border: unset;\n background: transparent !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload ::v-deep .ele-upload__inner .ele-upload__area {\n display: flex;\n flex-direction: column;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-img-crop__upload ::v-deep .ele-upload__inner .ele-upload__area .ele-upload__area--text {\n margin-top: 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font1 {\n color: var(--idoole-black-088);\n font-size: 16px;\n line-height: 24px !important;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__noImg .ele-imgCrop__font2 {\n color: var(--idoole-black-06);\n font-size: 14px;\n line-height: 22px;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__left .ele-imgCrop__update {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n cursor: pointer;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right {\n position: relative;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right span {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ele-imgCrop__wrapper .ele-imgCrop__right .img-crop-right__image {\n width: 100%;\n height: 100%;\n}\n.ele-imgCrop__wrapper .ele-imgCrop__item {\n width: 480px;\n height: 300px;\n border-radius: 2px;\n border: 1px dashed var(--idooel-form-title-border-color);\n background: var(--idooel-form-upload-bg-color);\n}\n\n.ele-imgCrop__tips {\n float: left;\n width: 80%;\n}\n\n.ele-imgCrop__error {\n color: var(--idooel-form-border-err-color) !important;\n}\n\n.ele-imgCrop__error2 {\n color: var(--idooel-img-crop-err-color) !important;\n}\n\n.ele-imgCrop__icon {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
11298
12308
|
|
|
11299
12309
|
};
|
|
11300
12310
|
/* scoped */
|
|
11301
|
-
const __vue_scope_id__$h = "data-v-
|
|
12311
|
+
const __vue_scope_id__$h = "data-v-3676b54c";
|
|
11302
12312
|
/* module identifier */
|
|
11303
12313
|
const __vue_module_identifier__$h = undefined;
|
|
11304
12314
|
/* functional template */
|
|
@@ -11403,11 +12413,11 @@ __vue_render__$g._withStripped = true;
|
|
|
11403
12413
|
/* style */
|
|
11404
12414
|
const __vue_inject_styles__$g = function (inject) {
|
|
11405
12415
|
if (!inject) return
|
|
11406
|
-
inject("data-v-
|
|
12416
|
+
inject("data-v-05b001f6_0", { source: ".ele-editor__bottom[data-v-05b001f6] {\n height: 40px;\n padding: 8px 20px 8px 8px;\n border: 1px solid var(--idooel-form-title-border-color);\n border-top: 0px;\n}\n.ele-editor__bottom span[data-v-05b001f6] {\n color: var(--idoole-black-088);\n text-align: right;\n font-size: 12px;\n line-height: 20px;\n width: 100%;\n display: inline-block;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\text-editor\\src\\index.vue","index.vue"],"names":[],"mappings":"AA0DA;EACA,YAAA;EACA,yBAAA;EACA,uDAAA;EACA,eAAA;ACzDA;AD0DA;EACA,8BAAA;EACA,iBAAA;EACA,eAAA;EACA,iBAAA;EACA,WAAA;EACA,qBAAA;ACxDA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele-editor__wrapper\" :style=\"{width: editorWidth, height: editorHeight}\">\r\n <Vueditor :ref=\"getVueditor\" :style=\"{width: editorWidth, height: editorHeight}\"></Vueditor>\r\n <div class=\"ele-editor__bottom\">\r\n <span>{{ innerContent.length }}字</span>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { v4 as uuidv4 } from 'uuid'\r\nexport default {\r\n name: 'ele-text-editor',\r\n props: {\r\n editorWidth: {\r\n type: String\r\n },\r\n editorHeight: {\r\n type: String\r\n },\r\n maxLength: {\r\n type: Number,\r\n default () {\r\n return 10\r\n }\r\n }\r\n },\r\n data() {\r\n return {\r\n editorConfig: {},\r\n textEditorRef: null\r\n }\r\n },\r\n computed: {\r\n innerContent () {\r\n let content = this.textEditorRef ? this.textEditorRef.getContent() : ''\r\n if (this.textEditorRef && content.length > this.maxLength) {\r\n content = content.substring(0, this.maxLength)\r\n this.$nextTick(() => {\r\n this.textEditorRef.setContent(content)\r\n })\r\n }\r\n this.$emit('input', content)\r\n return content\r\n },\r\n getVueditor () {\r\n return uuidv4()\r\n }\r\n },\r\n watch: {},\r\n methods: {},\r\n mounted () {\r\n this.textEditorRef = this.$refs[this.getVueditor]\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele-editor__bottom {\r\n height: 40px;\r\n padding: 8px 20px 8px 8px;\r\n border: 1px solid var(--idooel-form-title-border-color);\r\n border-top: 0px;\r\n span {\r\n color: var(--idoole-black-088);\r\n text-align: right;\r\n font-size: 12px;\r\n line-height: 20px;\r\n width: 100%;\r\n display: inline-block;\r\n }\r\n}\r\n</style>",".ele-editor__bottom {\n height: 40px;\n padding: 8px 20px 8px 8px;\n border: 1px solid var(--idooel-form-title-border-color);\n border-top: 0px;\n}\n.ele-editor__bottom span {\n color: var(--idoole-black-088);\n text-align: right;\n font-size: 12px;\n line-height: 20px;\n width: 100%;\n display: inline-block;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
11407
12417
|
|
|
11408
12418
|
};
|
|
11409
12419
|
/* scoped */
|
|
11410
|
-
const __vue_scope_id__$g = "data-v-
|
|
12420
|
+
const __vue_scope_id__$g = "data-v-05b001f6";
|
|
11411
12421
|
/* module identifier */
|
|
11412
12422
|
const __vue_module_identifier__$g = undefined;
|
|
11413
12423
|
/* functional template */
|
|
@@ -11513,11 +12523,11 @@ __vue_render__$f._withStripped = true;
|
|
|
11513
12523
|
/* style */
|
|
11514
12524
|
const __vue_inject_styles__$f = function (inject) {
|
|
11515
12525
|
if (!inject) return
|
|
11516
|
-
inject("data-v-
|
|
12526
|
+
inject("data-v-468787f7_0", { source: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", map: {"version":3,"sources":[],"names":[],"mappings":"","file":"index.vue"}, media: undefined });
|
|
11517
12527
|
|
|
11518
12528
|
};
|
|
11519
12529
|
/* scoped */
|
|
11520
|
-
const __vue_scope_id__$f = "data-v-
|
|
12530
|
+
const __vue_scope_id__$f = "data-v-468787f7";
|
|
11521
12531
|
/* module identifier */
|
|
11522
12532
|
const __vue_module_identifier__$f = undefined;
|
|
11523
12533
|
/* functional template */
|
|
@@ -11576,11 +12586,11 @@ __vue_render__$e._withStripped = true;
|
|
|
11576
12586
|
/* style */
|
|
11577
12587
|
const __vue_inject_styles__$e = function (inject) {
|
|
11578
12588
|
if (!inject) return
|
|
11579
|
-
inject("data-v-
|
|
12589
|
+
inject("data-v-3750a094_0", { source: ".g-loading[data-v-3750a094] {\n width: 16px;\n height: 16px;\n border: 1px solid #409EFF;\n border-top-color: transparent;\n border-left-color: transparent;\n border-radius: 100%;\n animation: rotate-data-v-3750a094 infinite 0.75s linear;\n}\n@keyframes rotate-data-v-3750a094 {\n0% {\n transform: rotate(0);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\loading\\src\\index.vue","index.vue"],"names":[],"mappings":"AAmBA;EACA,WAAA;EACA,YAAA;EACA,yBAAA;EACA,6BAAA;EACA,8BAAA;EACA,mBAAA;EACA,uDAAA;AClBA;ADoBA;AACA;IACA,oBAAA;ACjBE;ADmBF;IACA,yBAAA;ACjBE;AACF;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div v-if=\"loading\" class=\"g-loading\">\r\n\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-loading',\r\n props: {\r\n loading: {\r\n type: Boolean,\r\n default: true\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-loading {\r\n width: 16px;\r\n height: 16px;\r\n border: 1px solid #409EFF;\r\n border-top-color: transparent;\r\n border-left-color: transparent;\r\n border-radius: 100%;\r\n animation: rotate infinite 0.75s linear;\r\n}\r\n@keyframes rotate {\r\n 0% {\r\n transform: rotate(0);\r\n }\r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n</style>",".g-loading {\n width: 16px;\n height: 16px;\n border: 1px solid #409EFF;\n border-top-color: transparent;\n border-left-color: transparent;\n border-radius: 100%;\n animation: rotate infinite 0.75s linear;\n}\n\n@keyframes rotate {\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
11580
12590
|
|
|
11581
12591
|
};
|
|
11582
12592
|
/* scoped */
|
|
11583
|
-
const __vue_scope_id__$e = "data-v-
|
|
12593
|
+
const __vue_scope_id__$e = "data-v-3750a094";
|
|
11584
12594
|
/* module identifier */
|
|
11585
12595
|
const __vue_module_identifier__$e = undefined;
|
|
11586
12596
|
/* functional template */
|
|
@@ -11775,11 +12785,11 @@ __vue_render__$d._withStripped = true;
|
|
|
11775
12785
|
/* style */
|
|
11776
12786
|
const __vue_inject_styles__$d = function (inject) {
|
|
11777
12787
|
if (!inject) return
|
|
11778
|
-
inject("data-v-
|
|
12788
|
+
inject("data-v-8b1c2320_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
11779
12789
|
|
|
11780
12790
|
};
|
|
11781
12791
|
/* scoped */
|
|
11782
|
-
const __vue_scope_id__$d = "data-v-
|
|
12792
|
+
const __vue_scope_id__$d = "data-v-8b1c2320";
|
|
11783
12793
|
/* module identifier */
|
|
11784
12794
|
const __vue_module_identifier__$d = undefined;
|
|
11785
12795
|
/* functional template */
|
|
@@ -11841,11 +12851,11 @@ __vue_render__$c._withStripped = true;
|
|
|
11841
12851
|
/* style */
|
|
11842
12852
|
const __vue_inject_styles__$c = function (inject) {
|
|
11843
12853
|
if (!inject) return
|
|
11844
|
-
inject("data-v-
|
|
12854
|
+
inject("data-v-45e85742_0", { source: ".g-search__label[data-v-45e85742] {\n /* width: 69px; */\n flex-basis: 69px;\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.g-search__label .label__title[data-v-45e85742], .g-search__label .label__suffix[data-v-45e85742] {\n font-size: 14px;\n color: rgba(0, 0, 0, 0.88);\n white-space: nowrap;\n}\n.g-search__label .label__suffix[data-v-45e85742] {\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=label.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\composite-components\\search-area\\src\\label.vue","label.vue"],"names":[],"mappings":"AAkBA;EACA,iBAAA;EACA,gBAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8BAAA;ACjBA;ADkBA;EACA,eAAA;EACA,0BAAA;EACA,mBAAA;AChBA;ADkBA;EACA,gBAAA;AChBA;;AAEA,oCAAoC","file":"label.vue","sourcesContent":["<template>\r\n <div class=\"g-search__label\">\r\n <span class=\"label__title\">{{ label }}</span>\r\n <span class=\"label__suffix\">:</span>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n props: {\r\n label: {\r\n type: String\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-search__label {\r\n /* width: 69px; */\r\n flex-basis: 69px;\r\n height: 32px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: space-between;\r\n .label__title, .label__suffix {\r\n font-size: 14px;\r\n color: rgba(0, 0, 0, 0.88);\r\n white-space: nowrap;\r\n }\r\n .label__suffix {\r\n margin-left: 4px;\r\n }\r\n}\r\n</style>",".g-search__label {\n /* width: 69px; */\n flex-basis: 69px;\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.g-search__label .label__title, .g-search__label .label__suffix {\n font-size: 14px;\n color: rgba(0, 0, 0, 0.88);\n white-space: nowrap;\n}\n.g-search__label .label__suffix {\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=label.vue.map */"]}, media: undefined });
|
|
11845
12855
|
|
|
11846
12856
|
};
|
|
11847
12857
|
/* scoped */
|
|
11848
|
-
const __vue_scope_id__$c = "data-v-
|
|
12858
|
+
const __vue_scope_id__$c = "data-v-45e85742";
|
|
11849
12859
|
/* module identifier */
|
|
11850
12860
|
const __vue_module_identifier__$c = undefined;
|
|
11851
12861
|
/* functional template */
|
|
@@ -11910,7 +12920,10 @@ var script$b = {
|
|
|
11910
12920
|
},
|
|
11911
12921
|
created() {
|
|
11912
12922
|
const querys = this.extractValues();
|
|
11913
|
-
this.$emit('search',
|
|
12923
|
+
this.$emit('search', {
|
|
12924
|
+
...querys,
|
|
12925
|
+
initSearch: true
|
|
12926
|
+
});
|
|
11914
12927
|
},
|
|
11915
12928
|
methods: {
|
|
11916
12929
|
controlDisplayByFormula(dataSource = []) {
|
|
@@ -11930,6 +12943,7 @@ var script$b = {
|
|
|
11930
12943
|
return dataSource;
|
|
11931
12944
|
},
|
|
11932
12945
|
buildDefaultValue(arg) {
|
|
12946
|
+
if (type.isFunction(arg)) return arg.call(this);
|
|
11933
12947
|
if (type.notStr(arg)) return arg;
|
|
11934
12948
|
if (!arg || arg.charAt(0) !== '_') return arg;
|
|
11935
12949
|
return parse$1(arg, {
|
|
@@ -12152,6 +13166,11 @@ var __vue_render__$b = function () {
|
|
|
12152
13166
|
_vm._v(" "),
|
|
12153
13167
|
_c("ele-select", {
|
|
12154
13168
|
attrs: {
|
|
13169
|
+
init: item.init,
|
|
13170
|
+
mode: item.mode,
|
|
13171
|
+
code: item.code,
|
|
13172
|
+
params: item.params,
|
|
13173
|
+
url: item.url,
|
|
12155
13174
|
multiple: item.multiple,
|
|
12156
13175
|
"data-source": item.optionList,
|
|
12157
13176
|
},
|
|
@@ -12227,11 +13246,11 @@ __vue_render__$b._withStripped = true;
|
|
|
12227
13246
|
/* style */
|
|
12228
13247
|
const __vue_inject_styles__$b = function (inject) {
|
|
12229
13248
|
if (!inject) return
|
|
12230
|
-
inject("data-v-c447c0e0_0", { source: ".search-area__wrapper[data-v-c447c0e0] {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper[data-v-c447c0e0] .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item[data-v-c447c0e0] {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.search-area__wrapper .search-area__item.search-area--action[data-v-c447c0e0] {\n justify-content: end;\n}\n.search-area__wrapper .search-area__item .expand-collapse[data-v-c447c0e0] {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__text[data-v-c447c0e0] {\n font-size: 14px;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__icon[data-v-c447c0e0] {\n font-size: 16px;\n margin-left: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/composite-components/search-area/src/index.vue","index.vue"],"names":[],"mappings":"AAwMA;EACA,iBAAA;EACA,kBAAA;EACA,mBAAA;ACvMA;ADyMA;EACA,YAAA;ACvMA;AD0MA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;ACxMA;ADyMA;EACA,oBAAA;ACvMA;ADyMA;EACA,gBAAA;EACA,YAAA;EACA,iBAAA;EACA,kCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,uBAAA;EACA,eAAA;ACvMA;ADwMA;EACA,eAAA;ACtMA;ADwMA;EACA,eAAA;EACA,gBAAA;ACtMA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"search-area__wrapper\">\n <a-row :gutter=\"gutter\">\n <template v-for=\"(item, idx) in innerDataSource\">\n <a-col v-if=\"item._show\" :span=\"item.span || span\" :key=\"idx\">\n <div v-if=\"item.type == '_action'\" class=\"search-area__item search-area--action\">\n <ele-button icon=\"search\" type=\"primary\" @click=\"handleClickSearch\">查询</ele-button>\n <ele-button style=\"margin-left:8px;\" icon=\"reload\" @click=\"handleClickReset\">重置</ele-button>\n <div v-if=\"innerDataSource.length > cuttingFormula + 1\" class=\"expand-collapse\" @click=\"handleClickExpandCollapse\">\n <span class=\"expand-collapse__text\">{{ isExpand ? '收起' : '展开' }}</span>\n <span class=\"expand-collapse__icon\">\n <a-icon v-if=\"isExpand\" type=\"up\" />\n <a-icon v-else type=\"down\" />\n </span>\n </div>\n </div>\n <div v-else class=\"search-area__item\">\n <template v-if=\"(item.type == 'ele-input') || (item.type == 'Input')\">\n <Label :label=\"item.label\"></Label>\n <ele-input v-model=\"item._value\"></ele-input>\n </template>\n <template v-else-if=\"(item.type == 'ele-select') || (item.type == 'Select')\">\n <Label :label=\"item.label\"></Label>\n <ele-select v-model=\"item._value\" :multiple=\"item.multiple\" :data-source=\"item.optionList\"></ele-select>\n </template>\n <template v-else-if=\"(item.type == 'ele-date') || (item.type == 'DatePicker')\">\n <Label :label=\"item.label\"></Label>\n <ele-date v-model=\"item._value\" :placeholder=\"item.placeholder\" :format=\"item.format\"></ele-date>\n </template>\n <template v-else-if=\"item.type == 'ele-date-range'\">\n <Label :label=\"item.label\"></Label>\n <ele-date-range v-model=\"item._value\" :format=\"item.format\" :show-time=\"item.showTime\"></ele-date-range>\n </template>\n </div>\n </a-col>\n </template>\n </a-row>\n </div>\n</template>\n\n<script>\nimport Label from './label.vue'\nimport moment from 'moment'\nimport { parse } from '@idooel/expression'\nimport { type } from '@idooel/shared'\nexport default {\n name: 'ele-search-area',\n components: {\n Label\n },\n props: {\n gutter: {\n type: [Number, Array, Object],\n default: () => ([\n 16, 8\n ])\n },\n span: {\n type: Number,\n default: 8\n },\n dataSource: {\n type: Array,\n required: true\n }\n },\n data() {\n return {\n isExpand: false\n }\n },\n computed: {\n cuttingFormula () {\n return (24 / this.span - 1)\n },\n buildDataSource () {\n return this.controlDisplayByFormula(this.mapDefaultValueToValue())\n },\n innerDataSource () {\n return [ ...this.buildDataSource, { type: '_action', _show: true }]\n }\n },\n created() {\n const querys = this.extractValues()\n this.$emit('search', querys)\n },\n methods: {\n controlDisplayByFormula (dataSource = []) {\n if (this.isExpand) {\n dataSource.forEach(item => {\n this.$set(item, '_show', true)\n })\n } else {\n dataSource.forEach((item, idx) => {\n if (idx < this.cuttingFormula) {\n this.$set(item, '_show', true)\n } else {\n this.$set(item, '_show', false)\n }\n })\n }\n return dataSource\n },\n buildDefaultValue (arg) {\n if (type.notStr(arg)) return arg\n if (!arg || arg.charAt(0) !== '_') return arg\n return parse(arg, {\n _route: this.$route.query\n })\n },\n mapDefaultValueToValue () {\n this.dataSource.forEach(props => {\n this.$set(props, '_show', this.isExpand)\n if (props.defaultValue) {\n if (type.isFunction(props.defaultValue)) {\n const ret = props.defaultValue.call(this)\n this.$set(props, '_value', this.buildDefaultValue(ret))\n } else {\n this.$set(props, '_value', this.buildDefaultValue(props.defaultValue))\n }\n }\n })\n return this.dataSource\n },\n handleClickExpandCollapse () {\n this.isExpand = !this.isExpand\n },\n handleClickSearch () {\n const querys = this.extractValues()\n this.$emit('search', querys)\n },\n buildMapto (mapTo = [], dataSource) {\n const [ startField, endField ] = mapTo\n const [ startValue, endValue ] = dataSource || [null, null]\n return {\n [startField]: startValue,\n [endField]: endValue\n }\n },\n extractValues () {\n let ret = {}\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\n switch (item.type) {\n case 'DatePicker':\n ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)\n break\n case 'ele-date-range':\n if (item.mapTo) {\n Object.assign(ret, this.buildMapto(item.mapTo, item._value))\n } else {\n ret[item.name] = (item._value || []).join(',')\n }\n break\n default:\n ret[item.name] = item._value\n break\n }\n })\n return ret\n },\n cleanValues () {\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\n const { defaultValue } = item\n switch (item.type) {\n case 'Select':\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\n !defaultValue && this.$set(item, '_value', null)\n break\n case 'DatePicker':\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\n !defaultValue && this.$set(item, '_value', undefined)\n break\n case 'ele-date-range':\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\n !defaultValue && this.$set(item, '_value', [])\n break\n default:\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\n !defaultValue && this.$set(item, '_value', null)\n break\n }\n })\n },\n handleClickReset () {\n this.cleanValues()\n //TODO defaultValue\n const querys = this.extractValues()\n this.$emit('search', querys)\n },\n onChangeSelect (value, props) {\n this.$set(props, '_value', value)\n }\n },\n destroyed () {\n this.cleanValues()\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.search-area__wrapper {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n ::v-deep .ant-col {\n &:last-child {\n float: right;\n }\n }\n .search-area__item {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n &.search-area--action {\n justify-content: end;\n }\n .expand-collapse {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n .expand-collapse__text {\n font-size: 14px;\n }\n .expand-collapse__icon {\n font-size: 16px;\n margin-left: 8px;\n }\n }\n }\n}\n</style>",".search-area__wrapper {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper ::v-deep .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.search-area__wrapper .search-area__item.search-area--action {\n justify-content: end;\n}\n.search-area__wrapper .search-area__item .expand-collapse {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__text {\n font-size: 14px;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__icon {\n font-size: 16px;\n margin-left: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
13249
|
+
inject("data-v-06dd8a38_0", { source: ".search-area__wrapper[data-v-06dd8a38] {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper[data-v-06dd8a38] .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item[data-v-06dd8a38] {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.search-area__wrapper .search-area__item.search-area--action[data-v-06dd8a38] {\n justify-content: end;\n}\n.search-area__wrapper .search-area__item .expand-collapse[data-v-06dd8a38] {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__text[data-v-06dd8a38] {\n font-size: 14px;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__icon[data-v-06dd8a38] {\n font-size: 16px;\n margin-left: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\composite-components\\search-area\\src\\index.vue","index.vue"],"names":[],"mappings":"AAyMA;EACA,iBAAA;EACA,kBAAA;EACA,mBAAA;ACxMA;AD0MA;EACA,YAAA;ACxMA;AD2MA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;ACzMA;AD0MA;EACA,oBAAA;ACxMA;AD0MA;EACA,gBAAA;EACA,YAAA;EACA,iBAAA;EACA,kCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,uBAAA;EACA,eAAA;ACxMA;ADyMA;EACA,eAAA;ACvMA;ADyMA;EACA,eAAA;EACA,gBAAA;ACvMA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"search-area__wrapper\">\r\n <a-row :gutter=\"gutter\">\r\n <template v-for=\"(item, idx) in innerDataSource\">\r\n <a-col v-if=\"item._show\" :span=\"item.span || span\" :key=\"idx\">\r\n <div v-if=\"item.type == '_action'\" class=\"search-area__item search-area--action\">\r\n <ele-button icon=\"search\" type=\"primary\" @click=\"handleClickSearch\">查询</ele-button>\r\n <ele-button style=\"margin-left:8px;\" icon=\"reload\" @click=\"handleClickReset\">重置</ele-button>\r\n <div v-if=\"innerDataSource.length > cuttingFormula + 1\" class=\"expand-collapse\" @click=\"handleClickExpandCollapse\">\r\n <span class=\"expand-collapse__text\">{{ isExpand ? '收起' : '展开' }}</span>\r\n <span class=\"expand-collapse__icon\">\r\n <a-icon v-if=\"isExpand\" type=\"up\" />\r\n <a-icon v-else type=\"down\" />\r\n </span>\r\n </div>\r\n </div>\r\n <div v-else class=\"search-area__item\">\r\n <template v-if=\"(item.type == 'ele-input') || (item.type == 'Input')\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-input v-model=\"item._value\"></ele-input>\r\n </template>\r\n <template v-else-if=\"(item.type == 'ele-select') || (item.type == 'Select')\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-select v-model=\"item._value\" :init=\"item.init\" :mode=\"item.mode\" :code=\"item.code\" :params=\"item.params\" :url=\"item.url\" :multiple=\"item.multiple\" :data-source=\"item.optionList\"></ele-select>\r\n </template>\r\n <template v-else-if=\"(item.type == 'ele-date') || (item.type == 'DatePicker')\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-date v-model=\"item._value\" :placeholder=\"item.placeholder\" :format=\"item.format\"></ele-date>\r\n </template>\r\n <template v-else-if=\"item.type == 'ele-date-range'\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-date-range v-model=\"item._value\" :format=\"item.format\" :show-time=\"item.showTime\"></ele-date-range>\r\n </template>\r\n </div>\r\n </a-col>\r\n </template>\r\n </a-row>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport Label from './label.vue'\r\nimport moment from 'moment'\r\nimport { parse } from '@idooel/expression'\r\nimport { type } from '@idooel/shared'\r\nexport default {\r\n name: 'ele-search-area',\r\n components: {\r\n Label\r\n },\r\n props: {\r\n gutter: {\r\n type: [Number, Array, Object],\r\n default: () => ([\r\n 16, 8\r\n ])\r\n },\r\n span: {\r\n type: Number,\r\n default: 8\r\n },\r\n dataSource: {\r\n type: Array,\r\n required: true\r\n }\r\n },\r\n data() {\r\n return {\r\n isExpand: false\r\n }\r\n },\r\n computed: {\r\n cuttingFormula () {\r\n return (24 / this.span - 1)\r\n },\r\n buildDataSource () {\r\n return this.controlDisplayByFormula(this.mapDefaultValueToValue())\r\n },\r\n innerDataSource () {\r\n return [ ...this.buildDataSource, { type: '_action', _show: true }]\r\n }\r\n },\r\n created() {\r\n const querys = this.extractValues()\r\n this.$emit('search', { ...querys, initSearch: true })\r\n },\r\n methods: {\r\n controlDisplayByFormula (dataSource = []) {\r\n if (this.isExpand) {\r\n dataSource.forEach(item => {\r\n this.$set(item, '_show', true)\r\n })\r\n } else {\r\n dataSource.forEach((item, idx) => {\r\n if (idx < this.cuttingFormula) {\r\n this.$set(item, '_show', true)\r\n } else {\r\n this.$set(item, '_show', false)\r\n }\r\n })\r\n }\r\n return dataSource\r\n },\r\n buildDefaultValue (arg) {\r\n if (type.isFunction(arg)) return arg.call(this)\r\n if (type.notStr(arg)) return arg\r\n if (!arg || arg.charAt(0) !== '_') return arg\r\n return parse(arg, {\r\n _route: this.$route.query\r\n })\r\n },\r\n mapDefaultValueToValue () {\r\n this.dataSource.forEach(props => {\r\n this.$set(props, '_show', this.isExpand)\r\n if (props.defaultValue) {\r\n if (type.isFunction(props.defaultValue)) {\r\n const ret = props.defaultValue.call(this)\r\n this.$set(props, '_value', this.buildDefaultValue(ret))\r\n } else {\r\n this.$set(props, '_value', this.buildDefaultValue(props.defaultValue))\r\n }\r\n }\r\n })\r\n return this.dataSource\r\n },\r\n handleClickExpandCollapse () {\r\n this.isExpand = !this.isExpand\r\n },\r\n handleClickSearch () {\r\n const querys = this.extractValues()\r\n this.$emit('search', querys)\r\n },\r\n buildMapto (mapTo = [], dataSource) {\r\n const [ startField, endField ] = mapTo\r\n const [ startValue, endValue ] = dataSource || [null, null]\r\n return {\r\n [startField]: startValue,\r\n [endField]: endValue\r\n }\r\n },\r\n extractValues () {\r\n let ret = {}\r\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\r\n switch (item.type) {\r\n case 'DatePicker':\r\n ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)\r\n break\r\n case 'ele-date-range':\r\n if (item.mapTo) {\r\n Object.assign(ret, this.buildMapto(item.mapTo, item._value))\r\n } else {\r\n ret[item.name] = (item._value || []).join(',')\r\n }\r\n break\r\n default:\r\n ret[item.name] = item._value\r\n break\r\n }\r\n })\r\n return ret\r\n },\r\n cleanValues () {\r\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\r\n const { defaultValue } = item\r\n switch (item.type) {\r\n case 'Select':\r\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\r\n !defaultValue && this.$set(item, '_value', null)\r\n break\r\n case 'DatePicker':\r\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\r\n !defaultValue && this.$set(item, '_value', undefined)\r\n break\r\n case 'ele-date-range':\r\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\r\n !defaultValue && this.$set(item, '_value', [])\r\n break\r\n default:\r\n defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))\r\n !defaultValue && this.$set(item, '_value', null)\r\n break\r\n }\r\n })\r\n },\r\n handleClickReset () {\r\n this.cleanValues()\r\n //TODO defaultValue\r\n const querys = this.extractValues()\r\n this.$emit('search', querys)\r\n },\r\n onChangeSelect (value, props) {\r\n this.$set(props, '_value', value)\r\n }\r\n },\r\n destroyed () {\r\n this.cleanValues()\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.search-area__wrapper {\r\n padding-top: 16px;\r\n padding-left: 16px;\r\n padding-right: 16px;\r\n ::v-deep .ant-col {\r\n &:last-child {\r\n float: right;\r\n }\r\n }\r\n .search-area__item {\r\n height: 32px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n &.search-area--action {\r\n justify-content: end;\r\n }\r\n .expand-collapse {\r\n margin-left: 8px;\r\n height: 32px;\r\n padding: 4px 16px;\r\n color: var(--idooel-primary-color);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n cursor: pointer;\r\n .expand-collapse__text {\r\n font-size: 14px;\r\n }\r\n .expand-collapse__icon {\r\n font-size: 16px;\r\n margin-left: 8px;\r\n }\r\n }\r\n }\r\n}\r\n</style>",".search-area__wrapper {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper ::v-deep .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.search-area__wrapper .search-area__item.search-area--action {\n justify-content: end;\n}\n.search-area__wrapper .search-area__item .expand-collapse {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__text {\n font-size: 14px;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__icon {\n font-size: 16px;\n margin-left: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
12231
13250
|
|
|
12232
13251
|
};
|
|
12233
13252
|
/* scoped */
|
|
12234
|
-
const __vue_scope_id__$b = "data-v-
|
|
13253
|
+
const __vue_scope_id__$b = "data-v-06dd8a38";
|
|
12235
13254
|
/* module identifier */
|
|
12236
13255
|
const __vue_module_identifier__$b = undefined;
|
|
12237
13256
|
/* functional template */
|
|
@@ -12474,11 +13493,11 @@ __vue_render__$a._withStripped = true;
|
|
|
12474
13493
|
/* style */
|
|
12475
13494
|
const __vue_inject_styles__$a = function (inject) {
|
|
12476
13495
|
if (!inject) return
|
|
12477
|
-
inject("data-v-
|
|
13496
|
+
inject("data-v-6e62914a_0", { source: ".button-group__wrapper[data-v-6e62914a] {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n}\n.button-group__wrapper .ant-btn[data-v-6e62914a] {\n margin-left: 8px;\n}\n.button-group__wrapper .ant-btn[data-v-6e62914a]:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\composite-components\\button-group\\src\\index.vue","index.vue"],"names":[],"mappings":"AA4IA;EACA,aAAA;EACA,kBAAA;EACA,mBAAA;AC3IA;AD4IA;EACA,gBAAA;AC1IA;AD2IA;EACA,cAAA;ACzIA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"button-group__wrapper\">\r\n <template v-for=\"(item, idx) in innerDatasource\" >\r\n <ele-button\r\n v-if=\"isBool(item._show) ? item._show : true\"\r\n :type=\"item.type\"\r\n :icon=\"item.icon\"\r\n :mode=\"item.mode\"\r\n :data-source=\"item.optionList\"\r\n :event-name=\"item.eventName\"\r\n :record=\"item\"\r\n v-on=\"overrideButtonEvent\"\r\n :key=\"idx\">\r\n {{ item.label }}\r\n </ele-button>\r\n </template>\r\n <ele-modal-confirm v-model=\"modalConfirmValue\" :contextProp=\"currentContext\" v-on=\"overrideModalConfirmEvent\" v-bind=\"modalConfirmMeta\"></ele-modal-confirm>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { type, util } from '@idooel/shared'\r\nimport { parse } from '@idooel/expression'\r\nimport { CONTEXT, AREA_NAMES } from '../../../utils'\r\nexport default {\r\n name: 'ele-button-group',\r\n props: {\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n }\r\n },\r\n data() {\r\n return {\r\n innerDatasource: [],\r\n modalConfirmValue: false,\r\n modalConfirmMeta: {}\r\n }\r\n },\r\n inject: {\r\n [CONTEXT]: {\r\n default: () => (() => ({}))\r\n }\r\n },\r\n computed: {\r\n callContext () {\r\n return this[CONTEXT].call(this)\r\n },\r\n currentExposed () {\r\n const exposed = Object.assign({}, this.callContext.exposed || {}, { [AREA_NAMES.BUTTON_GROUP]: { setModalConfirm: this.setModalConfirm } })\r\n return exposed\r\n },\r\n contextData () {\r\n return {\r\n ...this.currentContext,\r\n exposed: this.currentExposed\r\n }\r\n },\r\n overrideButtonEvent () {\r\n const events = this.dataSource.reduce((ret, item) => {\r\n const { mode, optionList = [] } = item\r\n if (mode == 'dropdown') {\r\n optionList.forEach(props => {\r\n ret[props.eventName || 'click'] = (e) => {\r\n const { modalConfirm } = props\r\n modalConfirm && (this.modalConfirmMeta = modalConfirm)\r\n if (this.preventModalConfirm(modalConfirm)) {\r\n this.$emit(props.eventName || 'click', { ...e, ...props, record: props, ...this.contextData })\r\n return\r\n }\r\n modalConfirm && (this.modalConfirmValue = true)\r\n this.$emit(props.eventName || 'click', { ...e, ...props, record: props, ...this.contextData })\r\n }\r\n })\r\n }\r\n ret[item.eventName || 'click'] = (e) => {\r\n const { modalConfirm } = item\r\n modalConfirm && (this.modalConfirmMeta = modalConfirm)\r\n if (this.preventModalConfirm(modalConfirm)) {\r\n this.$emit(item.eventName || 'click', { ...e, record: item, ...this.contextData })\r\n return\r\n }\r\n modalConfirm && (this.modalConfirmValue = true)\r\n this.$emit(item.eventName || 'click', { ...e, record: item, ...this.contextData })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...this.$listeners,\r\n ...events,\r\n ...this.contextData\r\n }\r\n },\r\n overrideModalConfirmEvent () {\r\n return {\r\n ...this.$listeners\r\n }\r\n },\r\n currentContext () {\r\n return {\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta,\r\n ...this.callContext\r\n }\r\n }\r\n },\r\n watch: {\r\n dataSource: {\r\n handler (dataSource) {\r\n this.innerDatasource = dataSource.map(item => {\r\n return {\r\n ...item,\r\n _show: this.executeExpression(item.show)\r\n }\r\n })\r\n },\r\n immediate: true\r\n }\r\n },\r\n methods: {\r\n setModalConfirm (arg = false) {\r\n this.modalConfirmValue = arg\r\n },\r\n preventModalConfirm (modalConfirm = {}) {\r\n const { show } = modalConfirm\r\n return !this.executeExpression(show)\r\n },\r\n executeExpression (expression) {\r\n if (type.isBool(expression)) return expression\r\n if (type.isEmpty(expression)) return true\r\n return parse(expression, { ...this.currentContext, ...this.contextData })\r\n },\r\n isBool (arg) {\r\n return type.isBool(arg)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.button-group__wrapper {\r\n display: flex;\r\n padding-left: 16px;\r\n padding-right: 16px;\r\n .ant-btn {\r\n margin-left: 8px;\r\n &:first-child {\r\n margin-left: 0;\r\n }\r\n }\r\n}\r\n</style>",".button-group__wrapper {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n}\n.button-group__wrapper .ant-btn {\n margin-left: 8px;\n}\n.button-group__wrapper .ant-btn:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
12478
13497
|
|
|
12479
13498
|
};
|
|
12480
13499
|
/* scoped */
|
|
12481
|
-
const __vue_scope_id__$a = "data-v-
|
|
13500
|
+
const __vue_scope_id__$a = "data-v-6e62914a";
|
|
12482
13501
|
/* module identifier */
|
|
12483
13502
|
const __vue_module_identifier__$a = undefined;
|
|
12484
13503
|
/* functional template */
|
|
@@ -12692,6 +13711,7 @@ var script$9 = {
|
|
|
12692
13711
|
_route: this.$route.query,
|
|
12693
13712
|
exposed: exposed,
|
|
12694
13713
|
...exposed,
|
|
13714
|
+
currentRowData: exposed.getCurrentRowData(),
|
|
12695
13715
|
...dataSource
|
|
12696
13716
|
});
|
|
12697
13717
|
return ret;
|
|
@@ -12989,11 +14009,11 @@ __vue_render__$8._withStripped = true;
|
|
|
12989
14009
|
/* style */
|
|
12990
14010
|
const __vue_inject_styles__$8 = function (inject) {
|
|
12991
14011
|
if (!inject) return
|
|
12992
|
-
inject("data-v-
|
|
14012
|
+
inject("data-v-59b22738_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
12993
14013
|
|
|
12994
14014
|
};
|
|
12995
14015
|
/* scoped */
|
|
12996
|
-
const __vue_scope_id__$8 = "data-v-
|
|
14016
|
+
const __vue_scope_id__$8 = "data-v-59b22738";
|
|
12997
14017
|
/* module identifier */
|
|
12998
14018
|
const __vue_module_identifier__$8 = undefined;
|
|
12999
14019
|
/* functional template */
|
|
@@ -13153,12 +14173,12 @@ __vue_render__$7._withStripped = true;
|
|
|
13153
14173
|
/* style */
|
|
13154
14174
|
const __vue_inject_styles__$7 = function (inject) {
|
|
13155
14175
|
if (!inject) return
|
|
13156
|
-
inject("data-v-
|
|
13157
|
-
,inject("data-v-
|
|
14176
|
+
inject("data-v-11e1b8a0_0", { source: ".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n.margin-t-8 {\n margin-top: 8px;\n}\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,qBAAqB;AACvB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AAEA;EACE,eAAe;AACjB;AAEA;EACE,+BAA+B;EAC/B,sCAAsC;EACtC,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,uCAAuC;EACvC,uCAAuC;EACvC,mDAAmD;EACnD,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;EACrC,2CAA2C;EAC3C,6BAA6B;EAC7B,iCAAiC;EACjC,qDAAqD;EACrD,kDAAkD;EAClD,gDAAgD;EAChD,gCAAgC;EAChC,uCAAuC;EACvC,yBAAyB;EACzB,yBAAyB;EACzB,oCAAoC;AACtC;AAEA;EACE,4DAA4D;AAC9D;AAEA;EACE,4DAA4D;AAC9D;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n\n.margin-t-8 {\n margin-top: 8px;\n}\n\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined })
|
|
14177
|
+
,inject("data-v-11e1b8a0_1", { source: ".ele-modal-confirm__content[data-v-11e1b8a0] {\n margin-top: 8px;\n color: var(--idoole-black-088);\n font-size: 14px;\n line-height: 22px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\composite-components\\modal-confirm\\src\\index.vue","index.vue"],"names":[],"mappings":"AAiGA;EACA,eAAA;EACA,8BAAA;EACA,eAAA;EACA,iBAAA;AChGA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <ele-modal :title=\"title\" :value=\"value\" :size=\"size\" @cancel=\"onCancel\" v-on=\"overrideEvents\" :buttonGroupMeta=\"buttonGroupMeta\">\r\n <ele-alert v-if=\"alert\" v-bind=\"alert\"></ele-alert>\r\n <div v-if=\"contentText\" class=\"ele-modal-confirm__content\">\r\n {{ contentText }}\r\n </div>\r\n </ele-modal>\r\n</template>\r\n\r\n<script>\r\nimport { CONTEXT } from '../../../utils'\r\nexport default {\r\n name: 'ele-modal-confirm',\r\n model: {\r\n event: 'change',\r\n prop: 'value'\r\n },\r\n props: {\r\n title: {\r\n type: String\r\n },\r\n size: {\r\n type: String,\r\n default: 'small'\r\n },\r\n alert: {\r\n type: [Object, Boolean],\r\n default: () => ({\r\n type: 'warning',\r\n message: '确定要删除吗?',\r\n description: '删除后将无法恢复',\r\n closable: false\r\n })\r\n },\r\n contentText: {\r\n type: String\r\n },\r\n value: {\r\n type: Boolean,\r\n default: false\r\n },\r\n buttonGroupMeta: {\r\n type: Object\r\n },\r\n //!deprecated\r\n contextProp: {\r\n type: Object,\r\n default: () => ({})\r\n }\r\n },\r\n inject: {\r\n [CONTEXT]: {\r\n default: () => (() => ({}))\r\n }\r\n },\r\n data () {\r\n return {}\r\n },\r\n computed: {\r\n currentContext () {\r\n const { exposed: exposedData = {} } = this[CONTEXT]()\r\n const exposed = Object.assign({}, exposedData, { closeModalConfirm: this.closeModalConfirm })\r\n return {\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta,\r\n ...this[CONTEXT](),\r\n exposed\r\n }\r\n },\r\n overrideEvents () {\r\n if (!this.buttonGroupMeta) return {}\r\n const { elements = [] } = this.buttonGroupMeta\r\n const events = elements.reduce((ret, ele) =>{\r\n ret[ele.eventName || 'click'] = (e) => {\r\n this.$emit(ele.eventName || 'click', { ...e, ...this.currentContext })\r\n }\r\n return ret\r\n }, {})\r\n return {\r\n ...events\r\n }\r\n }\r\n },\r\n methods: {\r\n closeModalConfirm () {\r\n this.$emit('change', false)\r\n },\r\n onCancel () {\r\n this.$emit('change', false)\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\">\r\n@import '../../../theme/index';\r\n</style>\r\n<style lang=\"scss\" scoped>\r\n.ele-modal-confirm__content {\r\n margin-top: 8px;\r\n color: var(--idoole-black-088);\r\n font-size: 14px;\r\n line-height: 22px;\r\n}\r\n</style>",".ele-modal-confirm__content {\n margin-top: 8px;\n color: var(--idoole-black-088);\n font-size: 14px;\n line-height: 22px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
13158
14178
|
|
|
13159
14179
|
};
|
|
13160
14180
|
/* scoped */
|
|
13161
|
-
const __vue_scope_id__$7 = "data-v-
|
|
14181
|
+
const __vue_scope_id__$7 = "data-v-11e1b8a0";
|
|
13162
14182
|
/* module identifier */
|
|
13163
14183
|
const __vue_module_identifier__$7 = undefined;
|
|
13164
14184
|
/* functional template */
|
|
@@ -13401,11 +14421,11 @@ __vue_render__$6._withStripped = true;
|
|
|
13401
14421
|
/* style */
|
|
13402
14422
|
const __vue_inject_styles__$6 = function (inject) {
|
|
13403
14423
|
if (!inject) return
|
|
13404
|
-
inject("data-v-
|
|
14424
|
+
inject("data-v-3d3d1b6e_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
13405
14425
|
|
|
13406
14426
|
};
|
|
13407
14427
|
/* scoped */
|
|
13408
|
-
const __vue_scope_id__$6 = "data-v-
|
|
14428
|
+
const __vue_scope_id__$6 = "data-v-3d3d1b6e";
|
|
13409
14429
|
/* module identifier */
|
|
13410
14430
|
const __vue_module_identifier__$6 = undefined;
|
|
13411
14431
|
/* functional template */
|
|
@@ -13600,11 +14620,11 @@ __vue_render__$5._withStripped = true;
|
|
|
13600
14620
|
/* style */
|
|
13601
14621
|
const __vue_inject_styles__$5 = function (inject) {
|
|
13602
14622
|
if (!inject) return
|
|
13603
|
-
inject("data-v-
|
|
14623
|
+
inject("data-v-cc928cfe_0", { source: ".ele__img--form .form__img--wrapper[data-v-cc928cfe] {\n cursor: pointer;\n border-radius: 4px;\n background: #000;\n opacity: 0.3;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n position: relative;\n}\n.ele__img--form .form__img--wrapper .form__img--preivew[data-v-cc928cfe] {\n position: absolute;\n color: red;\n width: 100%;\n height: 100%;\n border-radius: 4px;\n}\n.ele__img--form .form__img--wrapper .form__icon--wrapper[data-v-cc928cfe] {\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n color: #fff;\n}\n.ele__img--form .form__img--wrapper .form__icon--wrapper .icon--oper[data-v-cc928cfe] {\n font-size: 40px;\n}\n.ele__img--form .form__img--wrapper .form__icon--wrapper .icon__text--oper[data-v-cc928cfe] {\n font-size: 16px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\composite-components\\form-img-crop\\src\\index.vue","index.vue"],"names":[],"mappings":"AAmGA;EACA,eAAA;EACA,kBAAA;EACA,gBAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,uBAAA;EACA,kBAAA;AClGA;ADmGA;EACA,kBAAA;EACA,UAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;ACjGA;ADmGA;EACA,kBAAA;EACA,aAAA;EACA,sBAAA;EACA,mBAAA;EACA,WAAA;ACjGA;ADkGA;EACA,eAAA;AChGA;ADkGA;EACA,eAAA;AChGA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"ele__img--form\">\r\n <div class=\"form__img--wrapper\" \r\n @click=\"handleClick\" \r\n :style=\"style\">\r\n <div class=\"form__img--preivew\" v-if=\"value\">\r\n <img style=\"width:100%;height:100%\" :src=\"imageUrl\" alt=\"\" srcset=\"\">\r\n </div>\r\n <div class=\"form__icon--wrapper\">\r\n <ele-icon class=\"icon--oper\" type=\"icon-camera\"></ele-icon>\r\n <span class=\"icon__text--oper\">{{ operText }}</span>\r\n </div>\r\n </div>\r\n <ele-modal-img-crop \r\n v-model=\"showModalImgCropValue\"\r\n :uploadFileConfig=\"uploadFileConfig\"\r\n @change=\"onChangeModalCropImg\"\r\n :cropperConfig=\"cropperConfig\"\r\n :imageId=\"value\"\r\n :title=\"modalTitle\">\r\n </ele-modal-img-crop>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-form-img-crop',\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n value: {\r\n type: [String, Number]\r\n },\r\n modalTitle: {\r\n type: String\r\n },\r\n operText: {\r\n type: String,\r\n default: '更改头像'\r\n },\r\n width: {\r\n type: [Number, String],\r\n default: 200\r\n },\r\n height: {\r\n type: [Number, String],\r\n default: 200\r\n },\r\n cropperConfig: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n aspectRatio: 16 / 9\r\n }\r\n }\r\n },\r\n uploadFileConfig: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n size: 10,\r\n accept: '*',\r\n byteConversion: 1024 * 1024\r\n }\r\n }\r\n }\r\n },\r\n data() {\r\n return {\r\n showModalImgCropValue: false\r\n }\r\n },\r\n computed: {\r\n style () {\r\n return {\r\n width: this.width + 'px',\r\n height: this.height + 'px'\r\n }\r\n },\r\n imageUrl () {\r\n return `/api-file/workbench/file/stream/${this.value}?origin=true`\r\n }\r\n },\r\n methods: {\r\n handleClick () {\r\n this.showModalImgCropValue = true\r\n },\r\n onChangeModalCropImg (fileId) {\r\n console.log('fileId', fileId)\r\n this.$emit('change', fileId)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.ele__img--form {\r\n .form__img--wrapper {\r\n cursor: pointer;\r\n border-radius: 4px;\r\n background: #000;\r\n opacity: 0.3;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n .form__img--preivew {\r\n position: absolute;\r\n color: red;\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 4px;\r\n }\r\n .form__icon--wrapper {\r\n position: absolute;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n color: #fff;\r\n .icon--oper {\r\n font-size: 40px;\r\n }\r\n .icon__text--oper {\r\n font-size: 16px;\r\n }\r\n }\r\n }\r\n}\r\n</style>",".ele__img--form .form__img--wrapper {\n cursor: pointer;\n border-radius: 4px;\n background: #000;\n opacity: 0.3;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n position: relative;\n}\n.ele__img--form .form__img--wrapper .form__img--preivew {\n position: absolute;\n color: red;\n width: 100%;\n height: 100%;\n border-radius: 4px;\n}\n.ele__img--form .form__img--wrapper .form__icon--wrapper {\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n color: #fff;\n}\n.ele__img--form .form__img--wrapper .form__icon--wrapper .icon--oper {\n font-size: 40px;\n}\n.ele__img--form .form__img--wrapper .form__icon--wrapper .icon__text--oper {\n font-size: 16px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
13604
14624
|
|
|
13605
14625
|
};
|
|
13606
14626
|
/* scoped */
|
|
13607
|
-
const __vue_scope_id__$5 = "data-v-
|
|
14627
|
+
const __vue_scope_id__$5 = "data-v-cc928cfe";
|
|
13608
14628
|
/* module identifier */
|
|
13609
14629
|
const __vue_module_identifier__$5 = undefined;
|
|
13610
14630
|
/* functional template */
|
|
@@ -13878,9 +14898,37 @@ var script$3 = {
|
|
|
13878
14898
|
event: 'change'
|
|
13879
14899
|
},
|
|
13880
14900
|
props: {
|
|
14901
|
+
title: {
|
|
14902
|
+
type: String,
|
|
14903
|
+
default: '导入'
|
|
14904
|
+
},
|
|
14905
|
+
mode: {
|
|
14906
|
+
type: String,
|
|
14907
|
+
default: 'async'
|
|
14908
|
+
},
|
|
13881
14909
|
value: {
|
|
13882
14910
|
type: Boolean,
|
|
13883
14911
|
default: false
|
|
14912
|
+
},
|
|
14913
|
+
hooks: {
|
|
14914
|
+
type: Object,
|
|
14915
|
+
default: () => ({
|
|
14916
|
+
download: {},
|
|
14917
|
+
uploaded: {
|
|
14918
|
+
url: '',
|
|
14919
|
+
requestType: 'POST',
|
|
14920
|
+
params: {},
|
|
14921
|
+
fieldMap: {},
|
|
14922
|
+
messages: {
|
|
14923
|
+
type: 'success',
|
|
14924
|
+
message: '文件上传成功'
|
|
14925
|
+
}
|
|
14926
|
+
}
|
|
14927
|
+
})
|
|
14928
|
+
},
|
|
14929
|
+
errorList: {
|
|
14930
|
+
type: Array,
|
|
14931
|
+
default: () => []
|
|
13884
14932
|
}
|
|
13885
14933
|
},
|
|
13886
14934
|
data() {
|
|
@@ -13894,12 +14942,20 @@ var script$3 = {
|
|
|
13894
14942
|
type: 'default',
|
|
13895
14943
|
eventName: 'handleClose'
|
|
13896
14944
|
}]
|
|
13897
|
-
}
|
|
14945
|
+
},
|
|
14946
|
+
innerErrorList: []
|
|
13898
14947
|
};
|
|
13899
14948
|
},
|
|
13900
14949
|
computed: {
|
|
13901
14950
|
isFileEmpty() {
|
|
13902
14951
|
return type.isEmpty(this.file);
|
|
14952
|
+
},
|
|
14953
|
+
statusList() {
|
|
14954
|
+
// 0 default
|
|
14955
|
+
if (this.errorList.length > 0) {
|
|
14956
|
+
return this.buildErrorList(this.errorList);
|
|
14957
|
+
}
|
|
14958
|
+
return this.innerErrorList;
|
|
13903
14959
|
}
|
|
13904
14960
|
},
|
|
13905
14961
|
watch: {
|
|
@@ -13925,7 +14981,66 @@ var script$3 = {
|
|
|
13925
14981
|
action: 'jump'
|
|
13926
14982
|
});
|
|
13927
14983
|
},
|
|
14984
|
+
execFieldMap(fieldMap = {}, payloads = {}) {
|
|
14985
|
+
const ctx = {
|
|
14986
|
+
_route: this.$route.query,
|
|
14987
|
+
route: this.$route,
|
|
14988
|
+
...payloads
|
|
14989
|
+
};
|
|
14990
|
+
return parseFieldMap(fieldMap, ctx);
|
|
14991
|
+
},
|
|
14992
|
+
buildErrorList(dataSource = []) {
|
|
14993
|
+
const ret = dataSource.map(item => {
|
|
14994
|
+
if (type.isStr(item)) {
|
|
14995
|
+
return {
|
|
14996
|
+
statusCode: '0',
|
|
14997
|
+
message: item
|
|
14998
|
+
};
|
|
14999
|
+
} else {
|
|
15000
|
+
// TODO
|
|
15001
|
+
console.warn('not support error list type', item);
|
|
15002
|
+
}
|
|
15003
|
+
});
|
|
15004
|
+
return ret;
|
|
15005
|
+
},
|
|
13928
15006
|
uploadFileSuccess(props) {
|
|
15007
|
+
const {
|
|
15008
|
+
uploaded
|
|
15009
|
+
} = this.hooks;
|
|
15010
|
+
const {
|
|
15011
|
+
url,
|
|
15012
|
+
requestType = 'POST',
|
|
15013
|
+
params = {},
|
|
15014
|
+
fieldMap = {}
|
|
15015
|
+
} = uploaded;
|
|
15016
|
+
if (!url) {
|
|
15017
|
+
return this.emitEvent({
|
|
15018
|
+
action: 'uploaded',
|
|
15019
|
+
file: props
|
|
15020
|
+
});
|
|
15021
|
+
}
|
|
15022
|
+
const payloads = this.execFieldMap(fieldMap, {
|
|
15023
|
+
file: props.file
|
|
15024
|
+
});
|
|
15025
|
+
const formData = new FormData();
|
|
15026
|
+
Object.keys(payloads).forEach(key => {
|
|
15027
|
+
formData.append(key, payloads[key]);
|
|
15028
|
+
});
|
|
15029
|
+
net[requestType.toLowerCase()](url, formData, {
|
|
15030
|
+
headers: {
|
|
15031
|
+
'Content-Type': 'multipart/form-data'
|
|
15032
|
+
}
|
|
15033
|
+
}).then(resp => {
|
|
15034
|
+
const {
|
|
15035
|
+
code,
|
|
15036
|
+
data
|
|
15037
|
+
} = resp;
|
|
15038
|
+
if (code !== '2000') {
|
|
15039
|
+
this.innerErrorList = this.buildErrorList(data || []);
|
|
15040
|
+
} else {
|
|
15041
|
+
this.innerErrorList = [];
|
|
15042
|
+
}
|
|
15043
|
+
});
|
|
13929
15044
|
this.emitEvent({
|
|
13930
15045
|
action: 'uploaded',
|
|
13931
15046
|
file: props
|
|
@@ -13961,7 +15076,7 @@ var __vue_render__$3 = function () {
|
|
|
13961
15076
|
attrs: {
|
|
13962
15077
|
value: _vm.innerValue,
|
|
13963
15078
|
buttonGroupMeta: _vm.buttonGroupMeta,
|
|
13964
|
-
title:
|
|
15079
|
+
title: _vm.title,
|
|
13965
15080
|
},
|
|
13966
15081
|
on: { cancel: _vm.onCancel, handleClose: _vm.handleClose },
|
|
13967
15082
|
},
|
|
@@ -13993,7 +15108,10 @@ var __vue_render__$3 = function () {
|
|
|
13993
15108
|
],
|
|
13994
15109
|
1
|
|
13995
15110
|
)
|
|
13996
|
-
:
|
|
15111
|
+
: _vm._e(),
|
|
15112
|
+
_vm._v(" "),
|
|
15113
|
+
!_vm.isFileEmpty && _vm.mode === "async"
|
|
15114
|
+
? _c("div", { staticClass: "ele-modal-import__hint" }, [
|
|
13997
15115
|
_c("div", { staticClass: "import-hint__content" }, [
|
|
13998
15116
|
_c(
|
|
13999
15117
|
"div",
|
|
@@ -14027,7 +15145,34 @@ var __vue_render__$3 = function () {
|
|
|
14027
15145
|
"\n 您可以请点击上方按钮查看任务进度或关闭弹框\n "
|
|
14028
15146
|
),
|
|
14029
15147
|
]),
|
|
14030
|
-
])
|
|
15148
|
+
])
|
|
15149
|
+
: _vm._e(),
|
|
15150
|
+
_vm._v(" "),
|
|
15151
|
+
!_vm.isFileEmpty && _vm.mode === "sync"
|
|
15152
|
+
? _c(
|
|
15153
|
+
"div",
|
|
15154
|
+
{ staticClass: "ele-modal-import__errors" },
|
|
15155
|
+
[
|
|
15156
|
+
_vm.statusList.length > 0
|
|
15157
|
+
? _vm._l(_vm.statusList, function (value, idx) {
|
|
15158
|
+
return _c("div", { key: idx }, [
|
|
15159
|
+
_vm._v(
|
|
15160
|
+
"\n " + _vm._s(value.message) + "\n "
|
|
15161
|
+
),
|
|
15162
|
+
])
|
|
15163
|
+
})
|
|
15164
|
+
: [
|
|
15165
|
+
_c("ele-alert", {
|
|
15166
|
+
attrs: {
|
|
15167
|
+
type: _vm.hooks.uploaded.messages.type,
|
|
15168
|
+
message: _vm.hooks.uploaded.messages.message,
|
|
15169
|
+
},
|
|
15170
|
+
}),
|
|
15171
|
+
],
|
|
15172
|
+
],
|
|
15173
|
+
2
|
|
15174
|
+
)
|
|
15175
|
+
: _vm._e(),
|
|
14031
15176
|
]
|
|
14032
15177
|
)
|
|
14033
15178
|
};
|
|
@@ -14037,12 +15182,12 @@ __vue_render__$3._withStripped = true;
|
|
|
14037
15182
|
/* style */
|
|
14038
15183
|
const __vue_inject_styles__$3 = function (inject) {
|
|
14039
15184
|
if (!inject) return
|
|
14040
|
-
inject("data-v-
|
|
14041
|
-
,inject("data-v-
|
|
15185
|
+
inject("data-v-49352923_0", { source: ".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n.margin-t-8 {\n margin-top: 8px;\n}\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,qBAAqB;AACvB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AAEA;EACE,eAAe;AACjB;AAEA;EACE,+BAA+B;EAC/B,sCAAsC;EACtC,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,uCAAuC;EACvC,uCAAuC;EACvC,mDAAmD;EACnD,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;EACrC,2CAA2C;EAC3C,6BAA6B;EAC7B,iCAAiC;EACjC,qDAAqD;EACrD,kDAAkD;EAClD,gDAAgD;EAChD,gCAAgC;EAChC,uCAAuC;EACvC,yBAAyB;EACzB,yBAAyB;EACzB,oCAAoC;AACtC;AAEA;EACE,4DAA4D;AAC9D;AAEA;EACE,4DAA4D;AAC9D;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n\n.margin-t-8 {\n margin-top: 8px;\n}\n\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined })
|
|
15186
|
+
,inject("data-v-49352923_1", { source: ".import-download__link[data-v-49352923] {\n color: var(--idooel-link-06);\n font-size: 14px;\n cursor: pointer;\n line-height: 22px;\n}\n.ele-modal-import__hint .import-hint__content[data-v-49352923] {\n padding: 16px;\n border-radius: 2px;\n height: 82px;\n border: 1px dashed var(--idooel-link-06);\n background: var(--idoole-black-02);\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-modal-import__hint .import-hint__content .import-hint__left .anticon-upload[data-v-49352923] {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n.ele-modal-import__hint .import-hint__content .import-hint__right[data-v-49352923] {\n margin-left: 16px;\n}\n.ele-modal-import__hint .import-hint__content .import-hint__right .hint-right__title[data-v-49352923] {\n font-size: 16px;\n color: var(--idooel-link-06);\n cursor: pointer;\n}\n.ele-modal-import__hint .import-hint__content .import-hint__right .hint-right__sub-title[data-v-49352923] {\n font-size: 14px;\n color: var(--idooel-link-03);\n}\n.ele-modal-import__hint .import-footer__hint--text[data-v-49352923] {\n font-size: 14px;\n color: var(--idooel-link-06);\n line-height: 22px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\business-components\\modal-import\\src\\index.vue","index.vue"],"names":[],"mappings":"AAqLA;EACA,4BAAA;EACA,eAAA;EACA,eAAA;EACA,iBAAA;ACpLA;ADuLA;EACA,aAAA;EACA,kBAAA;EACA,YAAA;EACA,wCAAA;EACA,kCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;ACpLA;ADsLA;EACA,eAAA;EACA,4BAAA;ACpLA;ADuLA;EACA,iBAAA;ACrLA;ADsLA;EACA,eAAA;EACA,4BAAA;EACA,eAAA;ACpLA;ADsLA;EACA,eAAA;EACA,4BAAA;ACpLA;ADwLA;EACA,eAAA;EACA,4BAAA;EACA,iBAAA;ACtLA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <ele-modal :value=\"innerValue\" :buttonGroupMeta=\"buttonGroupMeta\" @cancel=\"onCancel\" @handleClose=\"handleClose\" :title=\"title\">\r\n <div class=\"ele-modal-import__upload\" v-if=\"isFileEmpty\">\r\n <div class=\"import-download__link\" @click=\"handleClickDownloadTpl\">点击此链接下载导入模板</div>\r\n <ele-upload v-model=\"file\" @on-success=\"uploadFileSuccess\"></ele-upload>\r\n </div>\r\n <div v-if=\"(!isFileEmpty && mode === 'async')\" class=\"ele-modal-import__hint\">\r\n <div class=\"import-hint__content\">\r\n <div class=\"import-hint__left\">\r\n <ele-icon></ele-icon>\r\n </div>\r\n <div class=\"import-hint__right\">\r\n <div class=\"hint-right__title\" @click=\"handleClickJump\">文件上传成功,任务处理中..... 请点击此按钮跳转到“批处理管理”菜单查看任务进度</div>\r\n <div class=\"hint-right__sub-title\">批处理任务的准备工作会在后台运行</div>\r\n </div>\r\n </div>\r\n <div class=\"import-footer__hint--text\">\r\n 您可以请点击上方按钮查看任务进度或关闭弹框\r\n </div>\r\n </div>\r\n <div v-if=\"!isFileEmpty && mode === 'sync'\" class=\"ele-modal-import__errors\">\r\n <template v-if=\"statusList.length > 0\">\r\n <div v-for=\"(value, idx) in statusList\" :key=\"idx\">\r\n {{ value.message }}\r\n </div>\r\n </template>\r\n <template v-else>\r\n <ele-alert :type=\"hooks.uploaded.messages.type\" :message=\"hooks.uploaded.messages.message\"></ele-alert>\r\n </template>\r\n </div>\r\n </ele-modal>\r\n</template>\r\n\r\n<script>\r\nimport { type, net } from '@idooel/shared'\r\nimport { parseFieldMap } from '../../../utils'\r\nexport default {\r\n name: 'ele-modal-import',\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n title: {\r\n type: String,\r\n default: '导入'\r\n },\r\n mode: {\r\n type: String,\r\n default: 'async'\r\n },\r\n value: {\r\n type: Boolean,\r\n default: false\r\n },\r\n hooks: {\r\n type: Object,\r\n default: () => ({\r\n download: {},\r\n uploaded: {\r\n url: '',\r\n requestType: 'POST',\r\n params: {},\r\n fieldMap: {},\r\n messages: {\r\n type: 'success',\r\n message: '文件上传成功'\r\n }\r\n }\r\n })\r\n },\r\n errorList: {\r\n type: Array,\r\n default: () => []\r\n }\r\n },\r\n data() {\r\n return {\r\n innerValue: false,\r\n file: [],\r\n buttonGroupMeta: {\r\n elements: [\r\n {\r\n label: '关闭',\r\n key: 'close',\r\n type: 'default',\r\n eventName: 'handleClose'\r\n }\r\n ]\r\n },\r\n innerErrorList: []\r\n }\r\n },\r\n computed: {\r\n isFileEmpty () {\r\n return type.isEmpty(this.file)\r\n },\r\n statusList () {\r\n // 0 default\r\n if (this.errorList.length > 0) {\r\n return this.buildErrorList(this.errorList)\r\n }\r\n return this.innerErrorList\r\n }\r\n },\r\n watch: {\r\n value: {\r\n handler (value) {\r\n this.innerValue = value\r\n },\r\n immediate: true\r\n }\r\n },\r\n methods: {\r\n emitEvent (props = {}) {\r\n this.$emit('on-actions', { ...props })\r\n },\r\n onCancel () {\r\n this.innerValue = false\r\n this.$emit('change', false)\r\n },\r\n handleClickJump () {\r\n this.emitEvent({ action: 'jump' })\r\n },\r\n execFieldMap (fieldMap = {}, payloads = {}) {\r\n const ctx = { _route: this.$route.query, route: this.$route, ...payloads }\r\n return parseFieldMap(fieldMap, ctx)\r\n },\r\n buildErrorList (dataSource = []) {\r\n const ret = dataSource.map(item => {\r\n if (type.isStr(item)) {\r\n return {\r\n statusCode: '0',\r\n message: item\r\n }\r\n } else {\r\n // TODO\r\n console.warn('not support error list type', item)\r\n }\r\n })\r\n return ret\r\n },\r\n uploadFileSuccess (props) {\r\n const { uploaded } = this.hooks\r\n const { url, requestType = 'POST', params = {}, fieldMap = {} } = uploaded\r\n if (!url) {\r\n return this.emitEvent({ action: 'uploaded', file: props })\r\n }\r\n const payloads = this.execFieldMap(fieldMap, { file: props.file })\r\n const formData = new FormData()\r\n Object.keys(payloads).forEach(key => {\r\n formData.append(key, payloads[key])\r\n })\r\n net[requestType.toLowerCase()](url, formData , { headers: { 'Content-Type': 'multipart/form-data' } }).then(resp => {\r\n const { code, data } = resp\r\n if (code !== '2000') {\r\n this.innerErrorList = this.buildErrorList(data || [])\r\n } else {\r\n this.innerErrorList = []\r\n }\r\n })\r\n this.emitEvent({ action: 'uploaded', file: props })\r\n },\r\n handleClickDownloadTpl () {\r\n this.emitEvent({ action: 'download' })\r\n },\r\n cleanFile () {\r\n this.file = []\r\n },\r\n handleClose () {\r\n this.cleanFile()\r\n this.innerValue = false\r\n this.$emit('change', false)\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\">\r\n@import '../../../theme/index';\r\n</style>\r\n<style lang=\"scss\" scoped>\r\n.import-download__link {\r\n color: var(--idooel-link-06);\r\n font-size: 14px;\r\n cursor: pointer;\r\n line-height: 22px;\r\n}\r\n.ele-modal-import__hint {\r\n .import-hint__content {\r\n padding: 16px;\r\n border-radius: 2px;\r\n height: 82px;\r\n border: 1px dashed var(--idooel-link-06);\r\n background: var(--idoole-black-02);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n .import-hint__left {\r\n .anticon-upload {\r\n font-size: 48px;\r\n color: var(--idooel-link-06);\r\n }\r\n }\r\n .import-hint__right {\r\n margin-left: 16px;\r\n .hint-right__title {\r\n font-size: 16px;\r\n color: var(--idooel-link-06);\r\n cursor: pointer;\r\n }\r\n .hint-right__sub-title {\r\n font-size: 14px;\r\n color: var(--idooel-link-03);\r\n }\r\n }\r\n }\r\n .import-footer__hint--text {\r\n font-size: 14px;\r\n color: var(--idooel-link-06);\r\n line-height: 22px;\r\n }\r\n}\r\n</style>",".import-download__link {\n color: var(--idooel-link-06);\n font-size: 14px;\n cursor: pointer;\n line-height: 22px;\n}\n\n.ele-modal-import__hint .import-hint__content {\n padding: 16px;\n border-radius: 2px;\n height: 82px;\n border: 1px dashed var(--idooel-link-06);\n background: var(--idoole-black-02);\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-modal-import__hint .import-hint__content .import-hint__left .anticon-upload {\n font-size: 48px;\n color: var(--idooel-link-06);\n}\n.ele-modal-import__hint .import-hint__content .import-hint__right {\n margin-left: 16px;\n}\n.ele-modal-import__hint .import-hint__content .import-hint__right .hint-right__title {\n font-size: 16px;\n color: var(--idooel-link-06);\n cursor: pointer;\n}\n.ele-modal-import__hint .import-hint__content .import-hint__right .hint-right__sub-title {\n font-size: 14px;\n color: var(--idooel-link-03);\n}\n.ele-modal-import__hint .import-footer__hint--text {\n font-size: 14px;\n color: var(--idooel-link-06);\n line-height: 22px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
14042
15187
|
|
|
14043
15188
|
};
|
|
14044
15189
|
/* scoped */
|
|
14045
|
-
const __vue_scope_id__$3 = "data-v-
|
|
15190
|
+
const __vue_scope_id__$3 = "data-v-49352923";
|
|
14046
15191
|
/* module identifier */
|
|
14047
15192
|
const __vue_module_identifier__$3 = undefined;
|
|
14048
15193
|
/* functional template */
|
|
@@ -14183,11 +15328,11 @@ __vue_render__$2._withStripped = true;
|
|
|
14183
15328
|
/* style */
|
|
14184
15329
|
const __vue_inject_styles__$2 = function (inject) {
|
|
14185
15330
|
if (!inject) return
|
|
14186
|
-
inject("data-v-
|
|
15331
|
+
inject("data-v-1f132055_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
14187
15332
|
|
|
14188
15333
|
};
|
|
14189
15334
|
/* scoped */
|
|
14190
|
-
const __vue_scope_id__$2 = "data-v-
|
|
15335
|
+
const __vue_scope_id__$2 = "data-v-1f132055";
|
|
14191
15336
|
/* module identifier */
|
|
14192
15337
|
const __vue_module_identifier__$2 = undefined;
|
|
14193
15338
|
/* functional template */
|
|
@@ -14396,12 +15541,12 @@ __vue_render__$1._withStripped = true;
|
|
|
14396
15541
|
/* style */
|
|
14397
15542
|
const __vue_inject_styles__$1 = function (inject) {
|
|
14398
15543
|
if (!inject) return
|
|
14399
|
-
inject("data-v-
|
|
14400
|
-
,inject("data-v-
|
|
15544
|
+
inject("data-v-1c7f4c3c_0", { source: ".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n.margin-t-8 {\n margin-top: 8px;\n}\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,qBAAqB;AACvB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AAEA;EACE,eAAe;AACjB;AAEA;EACE,+BAA+B;EAC/B,sCAAsC;EACtC,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,uCAAuC;EACvC,uCAAuC;EACvC,mDAAmD;EACnD,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;EACrC,2CAA2C;EAC3C,6BAA6B;EAC7B,iCAAiC;EACjC,qDAAqD;EACrD,kDAAkD;EAClD,gDAAgD;EAChD,gCAAgC;EAChC,uCAAuC;EACvC,yBAAyB;EACzB,yBAAyB;EACzB,oCAAoC;AACtC;AAEA;EACE,4DAA4D;AAC9D;AAEA;EACE,4DAA4D;AAC9D;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[".has-error .ele-upload__wrapper .ele-upload__inner {\n border-color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--icon .anticon-cloud-upload {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__message {\n color: #F5222D;\n}\n.has-error .ele-upload__wrapper .ele-upload__inner .ele-upload__area .ele-upload__area--text .ele-upload__ext {\n color: #FFA39E;\n}\n\n.margin-t-8 {\n margin-top: 8px;\n}\n\n:root {\n --idooel-primary-color: #1890FF;\n --idoole-black-02: rgba(0, 0, 0, 0.04);\n --idoole-black-06: rgba(0, 0, 0, 0.44);\n --idoole-black-07: rgba(0, 0, 0, 0.64);\n --idoole-black-064: rgba(0, 0, 0, 0.64);\n --idoole-black-088: rgba(0, 0, 0, 0.88);\n --idoole-black-016: rgba(0, 0, 0, 0.16);\n --idooel-disabled-border-color: rgba(0, 0, 0, 0.16);\n --idoole-success-06: #52C41A;\n --idoole-warning-06: #FAAD14;\n --idoole-error-06: #F5222D;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n --idooel-row-odd-color: rgba(0, 0, 0, 0.04);\n --idooel-row-even-color: #FFF;\n --idooel-row-hover-color: #E6F7FF;\n --idooel-form-title-border-color: rgba(0, 0, 0, 0.16);\n --idooel-form-upload-bg-color: rgba(0, 0, 0, 0.02);\n --idooel-form-upload-border-hover-color: #40A9FF;\n --idooel-form-border-radius: 2px;\n --idooel-form-border-err-color: #F5222D;\n --idooel-link-06: #1890FF;\n --idooel-link-03: #91D5FF;\n --idooel-img-crop-err-color: #FFA39E;\n}\n\n.ant-input-disabled {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n.ant-select-disabled .ant-select-selection {\n border-color: var(--idooel-disabled-border-color) !important;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined })
|
|
15545
|
+
,inject("data-v-1c7f4c3c_1", { source: ".ele-modal-fsm__display[data-v-1c7f4c3c] {\n display: flex;\n flex-direction: row;\n font-size: 14px;\n line-height: 22px;\n}\n.ele-modal-fsm__display .fms-display__name[data-v-1c7f4c3c], .ele-modal-fsm__display .fms-display__action[data-v-1c7f4c3c] {\n font-weight: bold;\n color: var(--idoole-black-088);\n}\n.ele-modal-fsm__display .fms-display__name[data-v-1c7f4c3c]::before, .ele-modal-fsm__display .fms-display__action[data-v-1c7f4c3c]::before {\n content: \"\";\n margin-left: 4px;\n}\n.ele-modal-fsm__display .fms-display__name[data-v-1c7f4c3c]::after, .ele-modal-fsm__display .fms-display__action[data-v-1c7f4c3c]::after {\n content: \"\";\n margin-right: 4px;\n}\n.ele-modal-fsm__display .title-info[data-v-1c7f4c3c] {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-modal-fsm__display .title-info[data-v-1c7f4c3c]::before {\n content: \"\";\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n}\n.ele-modal-fsm__display .title-info.success[data-v-1c7f4c3c]::before {\n background: var(--idoole-success-06);\n}\n.ele-modal-fsm__display .title-info.warning[data-v-1c7f4c3c]::before {\n background: var(--idoole-warning-06);\n}\n.ele-modal-fsm__display .title-info.error[data-v-1c7f4c3c]::before {\n background: var(--idoole-error-06);\n}\n.ele-modal-fsm__opinion-wrapper[data-v-1c7f4c3c] {\n margin-top: 4px;\n line-height: 22px;\n font-size: 14px;\n display: flex;\n flex-direction: row;\n}\n.ele-modal-fsm__opinion-wrapper .fsm-opinion__label[data-v-1c7f4c3c] {\n width: 42px;\n flex-shrink: 0;\n color: var(--idoole-black-064);\n}\n.ele-modal-fsm__opinion-wrapper .fsm-opinion__value[data-v-1c7f4c3c] {\n color: var(--idoole-black-088);\n font-weight: bold;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\business-components\\modal-fsm\\src\\index.vue","index.vue"],"names":[],"mappings":"AAkGA;EACA,aAAA;EACA,mBAAA;EACA,eAAA;EACA,iBAAA;ACjGA;ADkGA;EACA,iBAAA;EACA,8BAAA;AChGA;ADiGA;EACA,WAAA;EACA,gBAAA;AC/FA;ADiGA;EACA,WAAA;EACA,iBAAA;AC/FA;ADkGA;EACA,eAAA;EACA,8BAAA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AChGA;ADiGA;EACA,WAAA;EACA,qBAAA;EACA,UAAA;EACA,WAAA;EACA,kBAAA;EACA,iBAAA;AC/FA;ADkGA;EACA,oCAAA;AChGA;ADoGA;EACA,oCAAA;AClGA;ADsGA;EACA,kCAAA;ACpGA;ADyGA;EACA,eAAA;EACA,iBAAA;EACA,eAAA;EACA,aAAA;EACA,mBAAA;ACtGA;ADuGA;EACA,WAAA;EACA,cAAA;EACA,8BAAA;ACrGA;ADuGA;EACA,8BAAA;EACA,iBAAA;ACrGA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <ele-modal v-on=\"$listeners\" :value=\"value\" :title=\"meta.title || title\" @cancel=\"handleCancel\" :buttonGroupMeta=\"buttonGroupMeta\">\r\n <slot name=\"alert\"></slot>\r\n <ele-timeline v-bind=\"meta\">\r\n <template #right=\"{ data: item }\">\r\n <div class=\"ele-modal-fsm__display\">\r\n <span>由</span>\r\n <span class=\"fms-display__name\">{{ item.userName || '管理员' }}</span>\r\n <span>执行了</span>\r\n <span class=\"fms-display__action\">{{ item.action || '结班' }}</span>\r\n <span>操作</span>\r\n <span :class=\"['title-info', item.state == 1 && 'success', item.state == 2 && 'warning', item.state == 3 && 'error']\">{{ item.stateName }}</span>\r\n </div>\r\n <div class=\"ele-modal-fsm__opinion-wrapper\">\r\n <div class=\"fsm-opinion__label\">意见:</div>\r\n <div class=\"fsm-opinion__value\">{{ item.opinion }}</div>\r\n </div>\r\n </template>\r\n </ele-timeline>\r\n <template v-if=\"showTextSlot\" #footer-text>\r\n <ele-text v-bind=\"textAttrs\"></ele-text>\r\n </template>\r\n </ele-modal>\r\n</template>\r\n\r\n<script>\r\nimport { CONTEXT } from '../../../utils'\r\nimport { type } from '@idooel/shared'\r\nexport default {\r\n name: 'ele-modal-fsm',\r\n model: {\r\n prop: 'value',\r\n event: 'change'\r\n },\r\n props: {\r\n value: {\r\n type: Boolean,\r\n default: false\r\n },\r\n title: {\r\n type: String,\r\n default: '状态变更记录'\r\n },\r\n meta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n buttonGroupMeta: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n elements: [\r\n {\r\n label: '关闭',\r\n key: 'cancel',\r\n type: 'default',\r\n eventName: 'cancel'\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n contextProp: {\r\n type: Object,\r\n default: () => ({})\r\n }\r\n },\r\n provide() {\r\n return {\r\n [CONTEXT]: () => {\r\n return {\r\n _route: this.$route.query,\r\n _routeMeta: this.$route.meta,\r\n ...this.contextProp\r\n }\r\n }\r\n }\r\n },\r\n computed: {\r\n showTextSlot () {\r\n return !type.isEmpty(this.textAttrs)\r\n },\r\n textAttrs() {\r\n const { text = {} } = this.buttonGroupMeta\r\n return text\r\n }\r\n },\r\n methods: {\r\n handleCancel () {\r\n this.$emit('change', false)\r\n }\r\n }\r\n}\r\n</script>\r\n<style lang=\"scss\">\r\n@import '../../../theme/index';\r\n</style>\r\n<style lang=\"scss\" scoped>\r\n.ele-modal-fsm__display {\r\n display: flex;\r\n flex-direction: row;\r\n font-size: 14px;\r\n line-height: 22px;\r\n .fms-display__name, .fms-display__action {\r\n font-weight: bold;\r\n color: var(--idoole-black-088);\r\n &::before {\r\n content: '';\r\n margin-left: 4px;\r\n }\r\n &::after {\r\n content: '';\r\n margin-right: 4px;\r\n }\r\n }\r\n .title-info {\r\n font-size: 14px;\r\n color: var(--idoole-black-064);\r\n margin-left: 16px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n &::before {\r\n content: '';\r\n display: inline-block;\r\n width: 6px;\r\n height: 6px;\r\n border-radius: 50%;\r\n margin-right: 8px;\r\n }\r\n &.success {\r\n &::before {\r\n background: var(--idoole-success-06);\r\n }\r\n }\r\n &.warning {\r\n &::before {\r\n background: var(--idoole-warning-06);\r\n }\r\n }\r\n &.error {\r\n &::before {\r\n background: var(--idoole-error-06);\r\n }\r\n }\r\n }\r\n}\r\n.ele-modal-fsm__opinion-wrapper {\r\n margin-top: 4px;\r\n line-height: 22px;\r\n font-size: 14px;\r\n display: flex;\r\n flex-direction: row;\r\n .fsm-opinion__label {\r\n width: 42px;\r\n flex-shrink: 0;\r\n color: var(--idoole-black-064);\r\n }\r\n .fsm-opinion__value {\r\n color: var(--idoole-black-088);\r\n font-weight: bold;\r\n }\r\n}\r\n</style>",".ele-modal-fsm__display {\n display: flex;\n flex-direction: row;\n font-size: 14px;\n line-height: 22px;\n}\n.ele-modal-fsm__display .fms-display__name, .ele-modal-fsm__display .fms-display__action {\n font-weight: bold;\n color: var(--idoole-black-088);\n}\n.ele-modal-fsm__display .fms-display__name::before, .ele-modal-fsm__display .fms-display__action::before {\n content: \"\";\n margin-left: 4px;\n}\n.ele-modal-fsm__display .fms-display__name::after, .ele-modal-fsm__display .fms-display__action::after {\n content: \"\";\n margin-right: 4px;\n}\n.ele-modal-fsm__display .title-info {\n font-size: 14px;\n color: var(--idoole-black-064);\n margin-left: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.ele-modal-fsm__display .title-info::before {\n content: \"\";\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 8px;\n}\n.ele-modal-fsm__display .title-info.success::before {\n background: var(--idoole-success-06);\n}\n.ele-modal-fsm__display .title-info.warning::before {\n background: var(--idoole-warning-06);\n}\n.ele-modal-fsm__display .title-info.error::before {\n background: var(--idoole-error-06);\n}\n\n.ele-modal-fsm__opinion-wrapper {\n margin-top: 4px;\n line-height: 22px;\n font-size: 14px;\n display: flex;\n flex-direction: row;\n}\n.ele-modal-fsm__opinion-wrapper .fsm-opinion__label {\n width: 42px;\n flex-shrink: 0;\n color: var(--idoole-black-064);\n}\n.ele-modal-fsm__opinion-wrapper .fsm-opinion__value {\n color: var(--idoole-black-088);\n font-weight: bold;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
14401
15546
|
|
|
14402
15547
|
};
|
|
14403
15548
|
/* scoped */
|
|
14404
|
-
const __vue_scope_id__$1 = "data-v-
|
|
15549
|
+
const __vue_scope_id__$1 = "data-v-1c7f4c3c";
|
|
14405
15550
|
/* module identifier */
|
|
14406
15551
|
const __vue_module_identifier__$1 = undefined;
|
|
14407
15552
|
/* functional template */
|
|
@@ -14559,11 +15704,11 @@ __vue_render__._withStripped = true;
|
|
|
14559
15704
|
/* style */
|
|
14560
15705
|
const __vue_inject_styles__ = function (inject) {
|
|
14561
15706
|
if (!inject) return
|
|
14562
|
-
inject("data-v-
|
|
15707
|
+
inject("data-v-936fe67a_0", { source: ".g-form__tabs[data-v-936fe67a] {\n width: 100%;\n background: #fff;\n display: flex;\n flex-direction: row;\n height: 32px;\n}\n.g-form__tabs .g-form__wrapper[data-v-936fe67a] {\n display: flex;\n flex-direction: row;\n}\n.g-form__tabs .g-form__wrapper.disabled .g-form__item[data-v-936fe67a] {\n cursor: not-allowed;\n border-color: rgba(0, 0, 0, 0.16);\n background: rgba(0, 0, 0, 0.04);\n color: rgba(0, 0, 0, 0.24);\n}\n.g-form__tabs .g-form__wrapper .g-form__item[data-v-936fe67a] {\n padding: 0px 16px;\n cursor: pointer;\n font-size: 14px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border: 1px solid rgba(0, 0, 0, 0.16);\n color: rgba(0, 0, 0, 0.64);\n border-right: unset;\n}\n.g-form__tabs .g-form__wrapper .g-form__item .suffix[data-v-936fe67a] {\n display: flex;\n}\n.g-form__tabs .g-form__wrapper .g-form__item[data-v-936fe67a]:last-child {\n border-right: 1px solid rgba(0, 0, 0, 0.16);\n}\n.g-form__tabs .g-form__wrapper .g-form__item.actived[data-v-936fe67a] {\n border-color: #409eff;\n color: #409eff;\n font-size: 14px;\n}\n.g-form__tabs .g-form__wrapper .g-form__item.actived + .g-form__item[data-v-936fe67a] {\n border-left: 1px solid #409eff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["C:\\Users\\ZOU\\Code\\OnlineStudy\\base-elearning-frontend-model\\packages\\components\\packages\\business-components\\tabs-sub-center\\src\\index.vue","index.vue"],"names":[],"mappings":"AAwEA;EACA,WAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;EACA,YAAA;ACvEA;ADwEA;EACA,aAAA;EACA,mBAAA;ACtEA;ADwEA;EACA,mBAAA;EACA,iCAAA;EACA,+BAAA;EACA,0BAAA;ACtEA;ADyEA;EACA,iBAAA;EACA,eAAA;EACA,eAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,qCAAA;EACA,0BAAA;EACA,mBAAA;ACvEA;ADwEA;EACA,aAAA;ACtEA;ADwEA;EACA,2CAAA;ACtEA;ADwEA;EACA,qBAAA;EACA,cAAA;EACA,eAAA;ACtEA;ADuEA;EACA,8BAAA;ACrEA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"g-form__tabs\">\r\n <div :class=\"['g-form__wrapper', disabled && 'disabled']\">\r\n <div :class=\"['g-form__item', !disabled && (innerActiveKey == props.key) && 'actived']\" @click=\"handleTabClick(props)\" v-for=\"props in dataSource\" :key=\"props.key\">\r\n <div>{{ props.title }}</div>\r\n <div v-if=\"isSuffix\" class=\"suffix\">\r\n <template v-if=\"props.loading\">\r\n <ele-loading style=\"margin-left:4px;\" :loading=\"props.loading\"></ele-loading>\r\n </template>\r\n <div v-else>({{ props.suffix }}人)</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-tabs-sub-center',\r\n props: {\r\n activeKey: {\r\n type: [String, Number]\r\n },\r\n isSuffix: {\r\n type: Boolean,\r\n default: false\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n },\r\n dataSource: {\r\n type: Array\r\n }\r\n },\r\n data () {\r\n return {\r\n innerActiveKey: 1\r\n }\r\n },\r\n watch: {\r\n activeKey: {\r\n handler (key) {\r\n this.innerActiveKey = key\r\n },\r\n immediate: true\r\n }\r\n },\r\n methods: {\r\n setLoadingByKey (key, status = true) {\r\n const target = this.dataSource.find(item => item.key == key)\r\n this.$set(target, 'loading', status)\r\n },\r\n setTitleByKey (key, title) {\r\n const target = this.dataSource.find(item => item.key == key)\r\n this.$set(target, 'title', title)\r\n },\r\n setSuffixByKey (key, suffix) {\r\n const target = this.dataSource.find(item => item.key == key)\r\n this.$set(target, 'suffix', suffix)\r\n },\r\n handleTabClick (props) {\r\n if (this.disabled) return\r\n const { key } = props\r\n this.innerActiveKey = key\r\n this.$emit('on-click', props)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-form__tabs {\r\n width: 100%;\r\n background: #fff;\r\n display: flex;\r\n flex-direction: row;\r\n height: 32px;\r\n .g-form__wrapper {\r\n display: flex;\r\n flex-direction: row;\r\n &.disabled {\r\n .g-form__item {\r\n cursor: not-allowed;\r\n border-color: rgba(0, 0, 0, 0.16);\r\n background: rgba(0, 0, 0, 0.04);\r\n color: rgba(0, 0, 0, 0.24);\r\n }\r\n }\r\n .g-form__item {\r\n padding: 0px 16px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n border: 1px solid rgba(0, 0, 0, 0.16);\r\n color: rgba(0, 0, 0, 0.64);\r\n border-right: unset;\r\n & .suffix {\r\n display: flex;\r\n }\r\n &:last-child {\r\n border-right: 1px solid rgba(0, 0, 0, 0.16);\r\n }\r\n &.actived {\r\n border-color:#409eff;\r\n color: #409eff;\r\n font-size: 14px;\r\n &+.g-form__item {\r\n border-left: 1px solid #409eff;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</style>",".g-form__tabs {\n width: 100%;\n background: #fff;\n display: flex;\n flex-direction: row;\n height: 32px;\n}\n.g-form__tabs .g-form__wrapper {\n display: flex;\n flex-direction: row;\n}\n.g-form__tabs .g-form__wrapper.disabled .g-form__item {\n cursor: not-allowed;\n border-color: rgba(0, 0, 0, 0.16);\n background: rgba(0, 0, 0, 0.04);\n color: rgba(0, 0, 0, 0.24);\n}\n.g-form__tabs .g-form__wrapper .g-form__item {\n padding: 0px 16px;\n cursor: pointer;\n font-size: 14px;\n display: flex;\n flex-direction: row;\n align-items: center;\n border: 1px solid rgba(0, 0, 0, 0.16);\n color: rgba(0, 0, 0, 0.64);\n border-right: unset;\n}\n.g-form__tabs .g-form__wrapper .g-form__item .suffix {\n display: flex;\n}\n.g-form__tabs .g-form__wrapper .g-form__item:last-child {\n border-right: 1px solid rgba(0, 0, 0, 0.16);\n}\n.g-form__tabs .g-form__wrapper .g-form__item.actived {\n border-color: #409eff;\n color: #409eff;\n font-size: 14px;\n}\n.g-form__tabs .g-form__wrapper .g-form__item.actived + .g-form__item {\n border-left: 1px solid #409eff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
14563
15708
|
|
|
14564
15709
|
};
|
|
14565
15710
|
/* scoped */
|
|
14566
|
-
const __vue_scope_id__ = "data-v-
|
|
15711
|
+
const __vue_scope_id__ = "data-v-936fe67a";
|
|
14567
15712
|
/* module identifier */
|
|
14568
15713
|
const __vue_module_identifier__ = undefined;
|
|
14569
15714
|
/* functional template */
|
|
@@ -14597,6 +15742,7 @@ __vue_component__$z.install = Vue => Vue.component(__vue_component__$z.name, __v
|
|
|
14597
15742
|
|
|
14598
15743
|
__vue_component__$x.install = Vue => Vue.component(__vue_component__$x.name, __vue_component__$x);
|
|
14599
15744
|
|
|
15745
|
+
// 初始化全局数据池(必须在其他组件之前)
|
|
14600
15746
|
const compositeComponents = [__vue_component__$a, __vue_component__$b, __vue_component__$9, __vue_component__$8, __vue_component__$h, __vue_component__$7, __vue_component__$6, __vue_component__$5, __vue_component__$4];
|
|
14601
15747
|
const businessComponents = [__vue_component__$3, __vue_component__$2, __vue_component__$1, __vue_component__];
|
|
14602
15748
|
const models = [__vue_component__$A, __vue_component__$y, __vue_component__$z, __vue_component__$x];
|