@ibiz-template/vue3-components 0.4.3-dev.2 → 0.4.3
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/dist/index-1dtzc9-X.js +14 -0
- package/dist/index-1dtzc9-X.js.map +1 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{xlsx-util-4xzbYCrh.js → xlsx-util-Mxa6HuaG.js} +2 -2
- package/dist/{xlsx-util-4xzbYCrh.js.map → xlsx-util-Mxa6HuaG.js.map} +1 -1
- package/es/_virtual/_commonjs-dynamic-modules.mjs +5 -0
- package/es/_virtual/pluralize.mjs +3 -0
- package/es/common/data-import2/data-import2.css +1 -0
- package/es/common/data-import2/data-import2.d.ts +54 -0
- package/es/common/data-import2/data-import2.mjs +459 -0
- package/es/common/index.mjs +2 -0
- package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/format-path/format-path.mjs +11 -0
- package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/index.mjs +4 -0
- package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/merge-model/merge-model.mjs +22 -0
- package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/plural/plural.mjs +30 -0
- package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/service-path-util/service-path-util.mjs +187 -0
- package/es/node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.mjs +515 -0
- package/es/panel-component/auth-userinfo/auth-userinfo.d.ts +0 -2
- package/es/panel-component/auth-userinfo/auth-userinfo.mjs +2 -25
- package/es/panel-component/auth-userinfo/index.d.ts +0 -2
- package/lib/_virtual/_commonjs-dynamic-modules.cjs +7 -0
- package/lib/_virtual/pluralize.cjs +5 -0
- package/lib/common/data-import2/data-import2.cjs +461 -0
- package/lib/common/data-import2/data-import2.css +1 -0
- package/lib/common/index.cjs +2 -0
- package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/format-path/format-path.cjs +13 -0
- package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/index.cjs +14 -0
- package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/merge-model/merge-model.cjs +24 -0
- package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/plural/plural.cjs +33 -0
- package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/service-path-util/service-path-util.cjs +189 -0
- package/lib/node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.cjs +519 -0
- package/lib/panel-component/auth-userinfo/auth-userinfo.cjs +0 -23
- package/package.json +4 -4
- package/dist/index-xXitupxZ.js +0 -14
- package/dist/index-xXitupxZ.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
function commonjsRequire(path) {
|
|
2
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export { commonjsRequire };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-data-import2{display:flex;flex-flow:column nowrap;min-width:644px;height:568px;background:var(--ibiz-color-bg-1)}.ibiz-data-import2__data-import2-toolbar{display:flex;align-items:center;justify-content:space-between}.ibiz-data-import2__data-import2-toolbar-container{display:flex;align-items:center;justify-content:space-between}.ibiz-data-import2__template-container{height:100%}.ibiz-data-import2__empty{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ibiz-data-import2__dataimport-select{margin-top:-5px}.ibiz-data-import2__select{width:100%}.ibiz-data-import2__select-option{padding:0 0 0 20px}.ibiz-data-import2__select-option-item{display:flex;align-items:center;justify-content:center;height:100%}.ibiz-data-import2__select-option-item-button{height:100%}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { IAppDataEntity, IAppDEDataImport } from '@ibiz/model-core';
|
|
2
|
+
import { PropType, Ref } from 'vue';
|
|
3
|
+
import './data-import2.scss';
|
|
4
|
+
export declare const DataImport2: import("vue").DefineComponent<{
|
|
5
|
+
dismiss: {
|
|
6
|
+
type: PropType<() => void>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
appDataEntity: {
|
|
10
|
+
type: PropType<IAppDataEntity>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
dataImport: {
|
|
14
|
+
type: PropType<IAppDEDataImport>;
|
|
15
|
+
required: false;
|
|
16
|
+
};
|
|
17
|
+
}, {
|
|
18
|
+
ns: import("@ibiz-template/core").Namespace;
|
|
19
|
+
onButtonColumnMappingImportClick: () => Promise<void>;
|
|
20
|
+
onButtonImportClick: () => Promise<void>;
|
|
21
|
+
onCancelButtonClick: () => void;
|
|
22
|
+
isLoading: Ref<boolean>;
|
|
23
|
+
UploadUrl: import("vue").ComputedRef<string>;
|
|
24
|
+
headers: Ref<IData>;
|
|
25
|
+
onSuccess: (response: IData, _file: IData, _fileList: []) => void;
|
|
26
|
+
renderTable: () => JSX.Element;
|
|
27
|
+
renderSelect: (itemx: string, index: number) => JSX.Element;
|
|
28
|
+
previewinfo: Ref<[string[]]>;
|
|
29
|
+
selectValues: Ref<string[]>;
|
|
30
|
+
renderEmpty: () => JSX.Element;
|
|
31
|
+
beforeUpload: () => void;
|
|
32
|
+
dataimport2: Ref<any>;
|
|
33
|
+
listValue: Ref<string>;
|
|
34
|
+
options: Ref<{
|
|
35
|
+
value: string;
|
|
36
|
+
label: string;
|
|
37
|
+
}[]>;
|
|
38
|
+
handleDeleteOption: (e: Event, str: string) => Promise<void>;
|
|
39
|
+
select: Ref<any>;
|
|
40
|
+
isNoPersonel: Ref<boolean>;
|
|
41
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
42
|
+
dismiss: {
|
|
43
|
+
type: PropType<() => void>;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
46
|
+
appDataEntity: {
|
|
47
|
+
type: PropType<IAppDataEntity>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
dataImport: {
|
|
51
|
+
type: PropType<IAppDEDataImport>;
|
|
52
|
+
required: false;
|
|
53
|
+
};
|
|
54
|
+
}>>, {}, {}>;
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import { isVNode, ref, watch, onMounted, resolveComponent, createVNode, computed, createTextVNode, resolveDirective, withDirectives, defineComponent } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import './data-import2.css';
|
|
4
|
+
import qs from 'qs';
|
|
5
|
+
import { getCookie } from 'qx-util';
|
|
6
|
+
import { CoreConst } from '@ibiz-template/core';
|
|
7
|
+
import '../../node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/index.mjs';
|
|
8
|
+
import { pluralLower } from '../../node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/plural/plural.mjs';
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
|
+
}
|
|
14
|
+
async function importMapping(method, id, data) {
|
|
15
|
+
let url = `extension/import_schemas`;
|
|
16
|
+
if (id) {
|
|
17
|
+
url = `${url}/${id}`;
|
|
18
|
+
}
|
|
19
|
+
const res = await ibiz.net.request(url, {
|
|
20
|
+
method,
|
|
21
|
+
data
|
|
22
|
+
});
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
const DataImport2 = /* @__PURE__ */ defineComponent({
|
|
26
|
+
name: "DataImport2",
|
|
27
|
+
props: {
|
|
28
|
+
dismiss: {
|
|
29
|
+
type: Function,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
appDataEntity: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
dataImport: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(props) {
|
|
42
|
+
const ns = useNamespace("data-import2");
|
|
43
|
+
const isLoading = ref(false);
|
|
44
|
+
const onCancelButtonClick = () => {
|
|
45
|
+
props.dismiss();
|
|
46
|
+
};
|
|
47
|
+
const previewinfo = ref([[]]);
|
|
48
|
+
const columnMap = /* @__PURE__ */ new Map();
|
|
49
|
+
const selectValues = ref([]);
|
|
50
|
+
let dataOption = [];
|
|
51
|
+
const dataimport2 = ref();
|
|
52
|
+
const select = ref();
|
|
53
|
+
let fileName = "";
|
|
54
|
+
let fileid = "";
|
|
55
|
+
const ColumnMappingSave = ref(false);
|
|
56
|
+
const columnMappingSaveName = ref("");
|
|
57
|
+
const listValue = ref("");
|
|
58
|
+
const columnMappingListMap = /* @__PURE__ */ new Map();
|
|
59
|
+
const options = ref([]);
|
|
60
|
+
const isNoPersonel = ref(false);
|
|
61
|
+
const watchValue = async (listvalue) => {
|
|
62
|
+
if (listvalue) {
|
|
63
|
+
const columnData = columnMappingListMap.get(listvalue);
|
|
64
|
+
let columnMapData = columnData.fields;
|
|
65
|
+
if (!columnData.fields) {
|
|
66
|
+
const res = await importMapping("get", columnData.id);
|
|
67
|
+
if (res.status === 200 && res.data) {
|
|
68
|
+
columnMapData = res.data.fields;
|
|
69
|
+
}
|
|
70
|
+
columnData.fields = res.data.fields;
|
|
71
|
+
columnMappingListMap.set(listvalue, columnData);
|
|
72
|
+
}
|
|
73
|
+
if (columnData.owner_type !== "" && columnData.owner_type !== "PERSONAL") {
|
|
74
|
+
isNoPersonel.value = true;
|
|
75
|
+
}
|
|
76
|
+
const keys = [...columnMap.keys()];
|
|
77
|
+
const captionMap = /* @__PURE__ */ new Map();
|
|
78
|
+
keys.forEach((item) => {
|
|
79
|
+
const columnMapValue = columnMap.get(item);
|
|
80
|
+
const lastIndex = item.lastIndexOf("-");
|
|
81
|
+
const itemName = item.substring(0, lastIndex);
|
|
82
|
+
let index = captionMap.get(itemName);
|
|
83
|
+
if (!index) {
|
|
84
|
+
captionMap.set(itemName, 0);
|
|
85
|
+
index = 0;
|
|
86
|
+
}
|
|
87
|
+
const filteredObjects = columnMapData.filter((columnitem) => columnitem.caption === itemName);
|
|
88
|
+
const newColumnValue = filteredObjects[index];
|
|
89
|
+
if (newColumnValue) {
|
|
90
|
+
captionMap.set(itemName, index + 1);
|
|
91
|
+
newColumnValue.index = columnMapValue.index;
|
|
92
|
+
columnMap.set(item, newColumnValue);
|
|
93
|
+
selectValues.value[newColumnValue.index] = newColumnValue.name;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
const keys = [...columnMap.keys()];
|
|
98
|
+
keys.forEach((item) => {
|
|
99
|
+
const data = columnMap.get(item);
|
|
100
|
+
if (data) {
|
|
101
|
+
data.name = "";
|
|
102
|
+
columnMap.set(item, data);
|
|
103
|
+
selectValues.value[data.index] = "";
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
watch(listValue, (newValue, _oldValue) => {
|
|
109
|
+
if (columnMappingSaveName.value !== newValue) {
|
|
110
|
+
ColumnMappingSave.value = false;
|
|
111
|
+
}
|
|
112
|
+
columnMappingSaveName.value = "";
|
|
113
|
+
watchValue(newValue);
|
|
114
|
+
});
|
|
115
|
+
const onButtonColumnMappingImportClick = async () => {
|
|
116
|
+
var _a;
|
|
117
|
+
if (previewinfo.value[0].length) {
|
|
118
|
+
ColumnMappingSave.value = true;
|
|
119
|
+
const columnMapArr = [...columnMap.values()];
|
|
120
|
+
const fields = columnMapArr.filter((columnitem) => columnitem.name !== "");
|
|
121
|
+
const data = {
|
|
122
|
+
// schame_tag: '', // 导入模式标记 不传
|
|
123
|
+
// id: '', // 导入模式标识 也不用传
|
|
124
|
+
name: `${fileName.split(".")[0]}|${(/* @__PURE__ */ new Date()).toLocaleString()}`,
|
|
125
|
+
// 导入模式名称 按照导入的名称|时间来生成
|
|
126
|
+
// order_value: '', // 排序值 也不用传
|
|
127
|
+
fields,
|
|
128
|
+
// 导入模式属性 {name:'',order_value:1}
|
|
129
|
+
// type: '', // 导入模式类型 暂时不用传
|
|
130
|
+
system_tag: (_a = ibiz.appData) == null ? void 0 : _a.context.srfsystemid,
|
|
131
|
+
// 系统标记
|
|
132
|
+
data_entity_tag: props.appDataEntity.codeName,
|
|
133
|
+
// 数据实体标记
|
|
134
|
+
import_tag: props.appDataEntity.defaultAppDEDataImportId,
|
|
135
|
+
// 导入标记 导入模型的代码名称
|
|
136
|
+
owner_type: "PERSONAL"
|
|
137
|
+
// 所有者类型
|
|
138
|
+
};
|
|
139
|
+
if (listValue.value) {
|
|
140
|
+
const columnData = columnMappingListMap.get(listValue.value);
|
|
141
|
+
const resput = await importMapping("put", columnData.id, data);
|
|
142
|
+
if (resput.status === 200 && resput.ok) {
|
|
143
|
+
columnMappingListMap.set(listValue.value, resput.data);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
options.value.push({
|
|
147
|
+
value: data.name,
|
|
148
|
+
label: data.name
|
|
149
|
+
});
|
|
150
|
+
const res = await importMapping("post", "", data);
|
|
151
|
+
if (res.status === 200 && res.ok) {
|
|
152
|
+
columnMappingListMap.set(data.name, res.data);
|
|
153
|
+
}
|
|
154
|
+
columnMappingSaveName.value = data.name;
|
|
155
|
+
listValue.value = data.name;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
ibiz.message.warning("\u8BF7\u4E0A\u4F20\u6587\u4EF6");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const onButtonImportClick = async () => {
|
|
162
|
+
if (previewinfo.value[0].length) {
|
|
163
|
+
if (listValue.value) {
|
|
164
|
+
const data = columnMappingListMap.get(listValue.value);
|
|
165
|
+
const {
|
|
166
|
+
id
|
|
167
|
+
} = data;
|
|
168
|
+
const dataEntityTag = data.data_entity_tag;
|
|
169
|
+
const url = `${pluralLower(dataEntityTag)}/asyncimportdata2?srfimporttag=${props.appDataEntity.defaultAppDEDataImportId}&srfossfileid=${fileid}&srfimportschemaid=${id}`;
|
|
170
|
+
await ibiz.net.request(url, {
|
|
171
|
+
method: "get"
|
|
172
|
+
});
|
|
173
|
+
ibiz.notification.info({
|
|
174
|
+
desc: "\u5F00\u59CB\u5BFC\u5165\uFF0C\u8BE6\u7EC6\u8FDB\u5EA6\u548C\u7ED3\u679C\u8BF7\u770B\u5E94\u7528\u901A\u77E5"
|
|
175
|
+
});
|
|
176
|
+
onCancelButtonClick();
|
|
177
|
+
} else {
|
|
178
|
+
await onButtonColumnMappingImportClick();
|
|
179
|
+
await onButtonImportClick();
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
ibiz.message.warning("\u8BF7\u4E0A\u4F20\u6587\u4EF6");
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const findDialog = (el) => {
|
|
186
|
+
const regex = /\bel-dialog\b/;
|
|
187
|
+
if (!regex.test(el.className)) {
|
|
188
|
+
if (el.parentElement) {
|
|
189
|
+
findDialog(el.parentElement);
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
el.style.maxWidth = "calc(100% - 100px)";
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const columnMappingListQuery = async () => {
|
|
196
|
+
var _a;
|
|
197
|
+
const params = {
|
|
198
|
+
n_import_tag_eq: props.appDataEntity.defaultAppDEDataImportId,
|
|
199
|
+
n_system_tag_eq: (_a = ibiz.appData) == null ? void 0 : _a.context.srfsystemid,
|
|
200
|
+
n_data_entity_tag_eq: props.appDataEntity.codeName
|
|
201
|
+
};
|
|
202
|
+
const res = await importMapping("post", "fetch_cur_user", params);
|
|
203
|
+
if (res.status === 200 && res.data) {
|
|
204
|
+
res.data.forEach((item) => {
|
|
205
|
+
options.value.push({
|
|
206
|
+
value: item.name,
|
|
207
|
+
label: item.name
|
|
208
|
+
});
|
|
209
|
+
columnMappingListMap.set(item.name, item);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
onMounted(() => {
|
|
214
|
+
var _a;
|
|
215
|
+
const dataImport = (_a = props.appDataEntity.appDEDataImports) == null ? void 0 : _a.find((importItem) => importItem.id === props.appDataEntity.defaultAppDEDataImportId);
|
|
216
|
+
if (dataImport && dataImport.dedataImportItems) {
|
|
217
|
+
dataOption = dataImport.dedataImportItems;
|
|
218
|
+
} else if (props.appDataEntity.appDEFields) {
|
|
219
|
+
dataOption = props.appDataEntity.appDEFields;
|
|
220
|
+
}
|
|
221
|
+
findDialog(dataimport2.value.parentElement);
|
|
222
|
+
columnMappingListQuery();
|
|
223
|
+
});
|
|
224
|
+
const renderSelect = (itemx, index) => {
|
|
225
|
+
let _slot;
|
|
226
|
+
const change = (item) => {
|
|
227
|
+
selectValues.value[index] = item;
|
|
228
|
+
const data = columnMap.get(`${itemx}-${index}`);
|
|
229
|
+
data.name = item;
|
|
230
|
+
columnMap.set(`${itemx}-${index}`, data);
|
|
231
|
+
ColumnMappingSave.value = false;
|
|
232
|
+
};
|
|
233
|
+
return createVNode(resolveComponent("el-select"), {
|
|
234
|
+
"modelValue": selectValues.value[index],
|
|
235
|
+
"placeholder": "\u9009\u62E9\u5F53\u524D\u5217\u5BF9\u5E94\u7684\u5BFC\u5165\u5C5E\u6027",
|
|
236
|
+
"onChange": change,
|
|
237
|
+
"key": index,
|
|
238
|
+
"popper-class": ns.e("dataimport-select"),
|
|
239
|
+
"class": ns.e("select")
|
|
240
|
+
}, _isSlot(_slot = dataOption.map((item) => {
|
|
241
|
+
return createVNode(resolveComponent("el-option"), {
|
|
242
|
+
"key": item.name,
|
|
243
|
+
"value": item.id,
|
|
244
|
+
"label": item.caption ? item.caption : item.logicName
|
|
245
|
+
}, null);
|
|
246
|
+
})) ? _slot : {
|
|
247
|
+
default: () => [_slot]
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
const renderTable = () => {
|
|
251
|
+
const arr = previewinfo.value;
|
|
252
|
+
const rows = arr.map((row, rowIndex) => createVNode("tr", {
|
|
253
|
+
"key": rowIndex
|
|
254
|
+
}, [row.map((cell, cellIndex) => rowIndex === 0 ? createVNode("th", {
|
|
255
|
+
"key": cellIndex,
|
|
256
|
+
"style": {
|
|
257
|
+
border: "1px solid #e5e5e5",
|
|
258
|
+
padding: "4px",
|
|
259
|
+
"min-width": "132px"
|
|
260
|
+
}
|
|
261
|
+
}, [cell]) : createVNode("td", {
|
|
262
|
+
"key": cellIndex,
|
|
263
|
+
"style": {
|
|
264
|
+
border: "1px solid #e5e5e5",
|
|
265
|
+
padding: "4px",
|
|
266
|
+
"min-width": "132px"
|
|
267
|
+
}
|
|
268
|
+
}, [cell]))]));
|
|
269
|
+
const newRows = [createVNode("tr", {
|
|
270
|
+
"key": "newRow"
|
|
271
|
+
}, [arr[0].map((item, index) => createVNode("td", {
|
|
272
|
+
"key": index,
|
|
273
|
+
"style": {
|
|
274
|
+
border: "1px solid #e5e5e5",
|
|
275
|
+
"min-width": "132px"
|
|
276
|
+
}
|
|
277
|
+
}, [renderSelect(item, index)]))]), ...rows];
|
|
278
|
+
return createVNode("table", {
|
|
279
|
+
"style": "border-collapse:collapse;border-spacing:0"
|
|
280
|
+
}, [createVNode("tbody", null, [newRows])]);
|
|
281
|
+
};
|
|
282
|
+
const headers = ref({
|
|
283
|
+
Authorization: `Bearer ${getCookie(CoreConst.TOKEN)}`
|
|
284
|
+
});
|
|
285
|
+
const UploadUrl = computed(() => {
|
|
286
|
+
let uploadUrl = `${ibiz.env.baseUrl}/${ibiz.env.appId}${ibiz.env.uploadFileUrl}/temp`;
|
|
287
|
+
uploadUrl += qs.stringify({
|
|
288
|
+
preview: true
|
|
289
|
+
}, {
|
|
290
|
+
addQueryPrefix: true
|
|
291
|
+
});
|
|
292
|
+
return uploadUrl;
|
|
293
|
+
});
|
|
294
|
+
const beforeUpload = () => {
|
|
295
|
+
isLoading.value = true;
|
|
296
|
+
};
|
|
297
|
+
const onSuccess = (response, _file, _fileList) => {
|
|
298
|
+
fileName = "";
|
|
299
|
+
fileid = "";
|
|
300
|
+
if (response.name) {
|
|
301
|
+
fileName = response.name;
|
|
302
|
+
}
|
|
303
|
+
if (response.fileid) {
|
|
304
|
+
fileid = response.fileid;
|
|
305
|
+
}
|
|
306
|
+
if (response.previewinfo) {
|
|
307
|
+
previewinfo.value = JSON.parse(response.previewinfo);
|
|
308
|
+
if (previewinfo.value[0] && previewinfo.value[0].length > 0) {
|
|
309
|
+
const firstArrayLength = previewinfo.value[0].length;
|
|
310
|
+
for (let i = 1; i < previewinfo.value.length; i++) {
|
|
311
|
+
const currentArray = previewinfo.value[i];
|
|
312
|
+
const currentArrayLength = currentArray.length;
|
|
313
|
+
if (currentArrayLength < firstArrayLength) {
|
|
314
|
+
const diff = firstArrayLength - currentArrayLength;
|
|
315
|
+
for (let j = 0; j < diff; j++) {
|
|
316
|
+
currentArray.push("");
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
columnMap.clear();
|
|
321
|
+
previewinfo.value[0].forEach((item, index) => {
|
|
322
|
+
columnMap.set(`${item}-${index}`, {
|
|
323
|
+
name: "",
|
|
324
|
+
index,
|
|
325
|
+
caption: item
|
|
326
|
+
});
|
|
327
|
+
selectValues.value[index] = "";
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
ColumnMappingSave.value = false;
|
|
332
|
+
isLoading.value = false;
|
|
333
|
+
watchValue(listValue.value);
|
|
334
|
+
};
|
|
335
|
+
const renderEmpty = () => {
|
|
336
|
+
return createVNode("div", {
|
|
337
|
+
"class": ns.e("empty")
|
|
338
|
+
}, [createTextVNode("\u6682\u65E0\u6570\u636E")]);
|
|
339
|
+
};
|
|
340
|
+
const handleDeleteOption = async (e, str) => {
|
|
341
|
+
e.stopPropagation();
|
|
342
|
+
const columnData = columnMappingListMap.get(str);
|
|
343
|
+
const res = await importMapping("delete", columnData.id);
|
|
344
|
+
if (res.status === 200 && res.ok) {
|
|
345
|
+
const index = options.value.findIndex((obj) => obj.label === str);
|
|
346
|
+
if (index !== -1) {
|
|
347
|
+
options.value.splice(index, 1);
|
|
348
|
+
}
|
|
349
|
+
columnMappingListMap.delete(str);
|
|
350
|
+
if (listValue.value === str) {
|
|
351
|
+
listValue.value = "";
|
|
352
|
+
}
|
|
353
|
+
select.value.blur();
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
return {
|
|
357
|
+
ns,
|
|
358
|
+
onButtonColumnMappingImportClick,
|
|
359
|
+
onButtonImportClick,
|
|
360
|
+
onCancelButtonClick,
|
|
361
|
+
isLoading,
|
|
362
|
+
UploadUrl,
|
|
363
|
+
headers,
|
|
364
|
+
onSuccess,
|
|
365
|
+
renderTable,
|
|
366
|
+
renderSelect,
|
|
367
|
+
previewinfo,
|
|
368
|
+
selectValues,
|
|
369
|
+
renderEmpty,
|
|
370
|
+
beforeUpload,
|
|
371
|
+
dataimport2,
|
|
372
|
+
listValue,
|
|
373
|
+
options,
|
|
374
|
+
handleDeleteOption,
|
|
375
|
+
select,
|
|
376
|
+
isNoPersonel
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
render() {
|
|
380
|
+
let _slot2;
|
|
381
|
+
return withDirectives(createVNode("div", {
|
|
382
|
+
"class": [this.ns.b(), "ibiz-view"],
|
|
383
|
+
"ref": "dataimport2"
|
|
384
|
+
}, [createVNode("div", {
|
|
385
|
+
"class": [this.ns.e("data-import2-toolbar"), "ibiz-panel-view-header"]
|
|
386
|
+
}, [createVNode("div", {
|
|
387
|
+
"class": [this.ns.e("caption")]
|
|
388
|
+
}, [createVNode("div", {
|
|
389
|
+
"class": "ibiz-panel-container"
|
|
390
|
+
}, [createVNode("div", {
|
|
391
|
+
"class": "ibiz-control-captionbar"
|
|
392
|
+
}, [createVNode("div", {
|
|
393
|
+
"class": "ibiz-control-captionbar-caption"
|
|
394
|
+
}, [createTextVNode("\u5BFC\u5165\u6570\u636E")])])])]), createVNode("div", {
|
|
395
|
+
"class": [this.ns.e("data-import2-toolbar-container"), "ibiz-panel-container--view_header_right"]
|
|
396
|
+
}, [createVNode("div", {
|
|
397
|
+
"class": "ibiz-panel-container"
|
|
398
|
+
}, [createVNode("div", {
|
|
399
|
+
"class": "ibiz-control-toolbar"
|
|
400
|
+
}, [createVNode("div", {
|
|
401
|
+
"class": "ibiz-control-toolbar__item"
|
|
402
|
+
}, [createVNode(resolveComponent("el-select"), {
|
|
403
|
+
"ref": "select",
|
|
404
|
+
"modelValue": this.listValue,
|
|
405
|
+
"onUpdate:modelValue": ($event) => this.listValue = $event,
|
|
406
|
+
"clearable": true,
|
|
407
|
+
"placeholder": "\u9009\u62E9\u5BFC\u5165\u6A21\u5F0F",
|
|
408
|
+
"disabled": !(this.previewinfo[0] && this.previewinfo[0].length),
|
|
409
|
+
"popper-class": this.ns.e("dataimport-select")
|
|
410
|
+
}, _isSlot(_slot2 = this.options.map((item) => {
|
|
411
|
+
return createVNode(resolveComponent("el-option"), {
|
|
412
|
+
"label": item.label,
|
|
413
|
+
"value": item.value,
|
|
414
|
+
"class": [this.ns.e("select-option")]
|
|
415
|
+
}, {
|
|
416
|
+
default: () => createVNode("div", {
|
|
417
|
+
"class": [this.ns.e("select-option-item")]
|
|
418
|
+
}, [createVNode("span", null, [item.label]), createVNode(resolveComponent("el-button"), {
|
|
419
|
+
"text": true,
|
|
420
|
+
"size": "small",
|
|
421
|
+
"onClick": (e) => this.handleDeleteOption(e, item.value),
|
|
422
|
+
"class": this.ns.e("select-option-item-button")
|
|
423
|
+
}, {
|
|
424
|
+
default: () => [createTextVNode("\u5220\u9664")]
|
|
425
|
+
})])
|
|
426
|
+
});
|
|
427
|
+
})) ? _slot2 : {
|
|
428
|
+
default: () => [_slot2]
|
|
429
|
+
})]), createVNode(resolveComponent("el-upload"), {
|
|
430
|
+
"class": "ibiz-control-toolbar__item",
|
|
431
|
+
"action": this.UploadUrl,
|
|
432
|
+
"headers": this.headers,
|
|
433
|
+
"show-file-list": false,
|
|
434
|
+
"onSuccess": this.onSuccess,
|
|
435
|
+
"before-upload": this.beforeUpload
|
|
436
|
+
}, {
|
|
437
|
+
default: () => [createVNode(resolveComponent("el-button"), null, {
|
|
438
|
+
default: () => [createTextVNode("\u6587\u4EF6\u4E0A\u4F20")]
|
|
439
|
+
})]
|
|
440
|
+
}), createVNode("div", {
|
|
441
|
+
"class": "ibiz-control-toolbar__item"
|
|
442
|
+
}, [createVNode(resolveComponent("el-button"), {
|
|
443
|
+
"onClick": this.onButtonColumnMappingImportClick,
|
|
444
|
+
"disabled": this.isNoPersonel
|
|
445
|
+
}, {
|
|
446
|
+
default: () => [createTextVNode("\u5BFC\u5165\u6A21\u5F0F\u4FDD\u5B58")]
|
|
447
|
+
})]), createVNode("div", {
|
|
448
|
+
"class": "ibiz-control-toolbar__item"
|
|
449
|
+
}, [createVNode(resolveComponent("el-button"), {
|
|
450
|
+
"onClick": this.onButtonImportClick
|
|
451
|
+
}, {
|
|
452
|
+
default: () => [createTextVNode("\u5BFC\u5165")]
|
|
453
|
+
})])])])])]), createVNode("div", {
|
|
454
|
+
"class": [this.ns.e("template-container"), "ibiz-panel-view-content"]
|
|
455
|
+
}, [this.previewinfo[0] && this.previewinfo[0].length ? this.renderTable() : this.renderEmpty()])]), [[resolveDirective("loading"), this.isLoading]]);
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
export { DataImport2 };
|
package/es/common/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { ViewMessage } from './view-message/view-message.mjs';
|
|
|
12
12
|
import { IBizPagination } from './pagination/pagination.mjs';
|
|
13
13
|
import { IBizSortBar } from './sort-bar/sort-bar.mjs';
|
|
14
14
|
import { DataImport } from './data-import/data-import.mjs';
|
|
15
|
+
import { DataImport2 } from './data-import2/data-import2.mjs';
|
|
15
16
|
|
|
16
17
|
"use strict";
|
|
17
18
|
const IBizCommonComponents = {
|
|
@@ -34,6 +35,7 @@ const IBizCommonComponents = {
|
|
|
34
35
|
v.component(IBizPagination.name, IBizPagination);
|
|
35
36
|
v.component(IBizSortBar.name, IBizSortBar);
|
|
36
37
|
v.component(DataImport.name, DataImport);
|
|
38
|
+
v.component(DataImport2.name, DataImport2);
|
|
37
39
|
v.component(
|
|
38
40
|
"IBizMapChart",
|
|
39
41
|
defineAsyncComponent({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function formatPath(path) {
|
|
2
|
+
// 合成路径,需要判断模型路径是否从 PSSYSAPPS 开始
|
|
3
|
+
if ((path === null || path === void 0 ? void 0 : path.indexOf('PSSYSAPPS/')) === 0) {
|
|
4
|
+
// 合成路径
|
|
5
|
+
const pos = path.indexOf('/');
|
|
6
|
+
return path.substring(path.indexOf('/', pos + 1));
|
|
7
|
+
}
|
|
8
|
+
return path;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { formatPath };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mergeDeepLeft } from 'ramda';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 将预置的模型合并到当前模型中
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-09-22 10:09:10
|
|
8
|
+
* @export
|
|
9
|
+
* @param {IModel[]} models
|
|
10
|
+
* @param {IModel} m
|
|
11
|
+
* @param {string} tag
|
|
12
|
+
*/
|
|
13
|
+
function mergeModel(models, m, tag) {
|
|
14
|
+
models.forEach(model => {
|
|
15
|
+
const item = m[model[tag]];
|
|
16
|
+
if (item) {
|
|
17
|
+
Object.assign(model, mergeDeepLeft(model, item));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { mergeModel };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import pluralize from '../../../../../../../pluralize@8.0.0/node_modules/pluralize/pluralize.mjs';
|
|
2
|
+
|
|
3
|
+
// 补充特殊转换规则
|
|
4
|
+
pluralize.addPluralRule(/(matr|vert|ind)ix|ex$/, '$1ices');
|
|
5
|
+
/**
|
|
6
|
+
* 英文转复数写法
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2022-08-25 18:08:41
|
|
10
|
+
* @export
|
|
11
|
+
* @param {string} key
|
|
12
|
+
* @return {*} {string}
|
|
13
|
+
*/
|
|
14
|
+
function plural(key) {
|
|
15
|
+
return pluralize(key);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 英文转复数写法并转全小写
|
|
19
|
+
*
|
|
20
|
+
* @author chitanda
|
|
21
|
+
* @date 2022-08-25 18:08:23
|
|
22
|
+
* @export
|
|
23
|
+
* @param {string} key
|
|
24
|
+
* @return {*} {string}
|
|
25
|
+
*/
|
|
26
|
+
function pluralLower(key) {
|
|
27
|
+
return plural(key).toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { plural, pluralLower };
|