@cmstops/pro-compo 3.10.5-stable.10 → 3.10.5-stable.11
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/editDocMeta/hooks/useMetaOptions.d.ts +5 -2
- package/dist/editDocMeta/script/api.d.ts +6 -0
- package/es/editDocMeta/components/Adapter.js +5 -3
- package/es/editDocMeta/components/docMetaForm.js +20 -4
- package/es/editDocMeta/components/fields/FSelect.js +43 -6
- package/es/editDocMeta/hooks/useMetaOptions.js +13 -2
- package/es/editDocMeta/script/api.js +14 -1
- package/lib/editDocMeta/components/Adapter.js +5 -3
- package/lib/editDocMeta/components/docMetaForm.js +20 -4
- package/lib/editDocMeta/components/fields/FSelect.js +42 -5
- package/lib/editDocMeta/hooks/useMetaOptions.js +13 -2
- package/lib/editDocMeta/script/api.js +14 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ export interface MetaOption {
|
|
|
9
9
|
default?: any;
|
|
10
10
|
meta?: any;
|
|
11
11
|
scope?: string[];
|
|
12
|
+
placeholder?: string;
|
|
12
13
|
is_extend?: boolean;
|
|
13
14
|
ext_type?: string;
|
|
14
15
|
}
|
|
@@ -17,7 +18,7 @@ export default function useMetaOptions(BASE_API: string, domainId?: number): {
|
|
|
17
18
|
options: import("vue").Ref<{
|
|
18
19
|
label: string;
|
|
19
20
|
value: string;
|
|
20
|
-
type: "input" | "select" | "
|
|
21
|
+
type: "input" | "select" | "switch" | "thumb" | "banner" | "date" | "radio" | "checkbox" | "custom" | "content-model";
|
|
21
22
|
show: boolean;
|
|
22
23
|
required: boolean;
|
|
23
24
|
disabled?: boolean | undefined;
|
|
@@ -25,12 +26,13 @@ export default function useMetaOptions(BASE_API: string, domainId?: number): {
|
|
|
25
26
|
default?: any;
|
|
26
27
|
meta?: any;
|
|
27
28
|
scope?: string[] | undefined;
|
|
29
|
+
placeholder?: string | undefined;
|
|
28
30
|
is_extend?: boolean | undefined;
|
|
29
31
|
ext_type?: string | undefined;
|
|
30
32
|
}[], MetaOption[] | {
|
|
31
33
|
label: string;
|
|
32
34
|
value: string;
|
|
33
|
-
type: "input" | "select" | "
|
|
35
|
+
type: "input" | "select" | "switch" | "thumb" | "banner" | "date" | "radio" | "checkbox" | "custom" | "content-model";
|
|
34
36
|
show: boolean;
|
|
35
37
|
required: boolean;
|
|
36
38
|
disabled?: boolean | undefined;
|
|
@@ -38,6 +40,7 @@ export default function useMetaOptions(BASE_API: string, domainId?: number): {
|
|
|
38
40
|
default?: any;
|
|
39
41
|
meta?: any;
|
|
40
42
|
scope?: string[] | undefined;
|
|
43
|
+
placeholder?: string | undefined;
|
|
41
44
|
is_extend?: boolean | undefined;
|
|
42
45
|
ext_type?: string | undefined;
|
|
43
46
|
}[]>;
|
|
@@ -10,4 +10,10 @@ export declare function getBylineTemplates(BASE_API: string, params?: {
|
|
|
10
10
|
}): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
11
11
|
export declare function updateDocMeta(BASE_API: string, params: Params): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
12
12
|
export declare function getEnabledExtendedFields(BASE_API: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
13
|
+
export declare function getBackendUsers(BASE_API: string, params?: {
|
|
14
|
+
keywords?: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
offset?: number;
|
|
17
|
+
where?: string;
|
|
18
|
+
}): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
13
19
|
export {};
|
|
@@ -26,7 +26,8 @@ const _sfc_main = defineComponent({
|
|
|
26
26
|
domainId: {},
|
|
27
27
|
series: {},
|
|
28
28
|
payload: {},
|
|
29
|
-
userInfo: {}
|
|
29
|
+
userInfo: {},
|
|
30
|
+
coverModel: {}
|
|
30
31
|
},
|
|
31
32
|
emits: ["update:value", "upload", "cover-model-change"],
|
|
32
33
|
setup(__props, { emit: __emit }) {
|
|
@@ -151,19 +152,20 @@ const _sfc_main = defineComponent({
|
|
|
151
152
|
key: 0,
|
|
152
153
|
"m-value": mValue.value,
|
|
153
154
|
label: __props.formItem.label,
|
|
154
|
-
placeholder: (_a = __props.formItem.meta) == null ? void 0 : _a.placeholder,
|
|
155
|
+
placeholder: __props.formItem.placeholder || ((_a = __props.formItem.meta) == null ? void 0 : _a.placeholder),
|
|
155
156
|
meta: __props.formItem.meta,
|
|
156
157
|
BASE_API: __props.BASE_API,
|
|
157
158
|
"domain-id": __props.domainId,
|
|
158
159
|
series: __props.series,
|
|
159
160
|
payload: __props.payload,
|
|
161
|
+
"cover-model": __props.coverModel,
|
|
160
162
|
"onUpdate:mValue": _cache[0] || (_cache[0] = (e) => mValue.value = e),
|
|
161
163
|
onUpload: _cache[1] || (_cache[1] = (e) => _ctx.$emit("upload", e)),
|
|
162
164
|
onResourceSelect: handleResourceSelect,
|
|
163
165
|
onImageEdit: handleImageEdit,
|
|
164
166
|
onPreview: handlePreview,
|
|
165
167
|
onCoverModelChange: _cache[2] || (_cache[2] = (model) => _ctx.$emit("cover-model-change", model))
|
|
166
|
-
}, null, 40, ["m-value", "label", "placeholder", "meta", "BASE_API", "domain-id", "series", "payload"])) : (openBlock(), createElementBlock("div", _hoisted_2, " \u7EC4\u4EF6\u672A\u627E\u5230: " + toDisplayString(__props.formItem.type) + " (\u5B57\u6BB5: " + toDisplayString(__props.formItem.value) + ") ", 1)),
|
|
168
|
+
}, null, 40, ["m-value", "label", "placeholder", "meta", "BASE_API", "domain-id", "series", "payload", "cover-model"])) : (openBlock(), createElementBlock("div", _hoisted_2, " \u7EC4\u4EF6\u672A\u627E\u5230: " + toDisplayString(__props.formItem.type) + " (\u5B57\u6BB5: " + toDisplayString(__props.formItem.value) + ") ", 1)),
|
|
167
169
|
createCommentVNode(" \u8D44\u6E90\u9009\u62E9\u5668 "),
|
|
168
170
|
resourceModalVisible.value && userInfo.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
169
171
|
key: 2,
|
|
@@ -284,7 +284,7 @@ const _sfc_main = defineComponent({
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
options.value.forEach((option) => {
|
|
287
|
-
var _a2, _b2, _c2, _d2;
|
|
287
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
288
288
|
if (initialData[option.value] !== void 0) {
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
@@ -308,6 +308,8 @@ const _sfc_main = defineComponent({
|
|
|
308
308
|
}
|
|
309
309
|
} else if (fieldValue && typeof fieldValue === "object" && !Array.isArray(fieldValue) && fieldValue.key && fieldValue.value) {
|
|
310
310
|
fieldValue = fieldValue.key;
|
|
311
|
+
} else if (option.ext_type === "backend_user" && fieldValue && typeof fieldValue === "object" && !Array.isArray(fieldValue) && fieldValue.uid !== void 0) {
|
|
312
|
+
fieldValue = fieldValue.uid || "";
|
|
311
313
|
} else if (Array.isArray(fieldValue) && fieldValue.length > 0 && ((_a2 = fieldValue[0]) == null ? void 0 : _a2.key)) {
|
|
312
314
|
fieldValue = fieldValue.map((item) => item.key);
|
|
313
315
|
}
|
|
@@ -354,8 +356,21 @@ const _sfc_main = defineComponent({
|
|
|
354
356
|
} else if (option.type === "banner") {
|
|
355
357
|
initialData[option.value] = false;
|
|
356
358
|
} else if (option.type === "thumb") {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
+
if (option.value === "cover") {
|
|
360
|
+
const model = (_d2 = coverModel.value) != null ? _d2 : 3;
|
|
361
|
+
const coverLengthMap = {
|
|
362
|
+
1: 1,
|
|
363
|
+
2: 3,
|
|
364
|
+
3: 1,
|
|
365
|
+
4: 0,
|
|
366
|
+
5: 1
|
|
367
|
+
};
|
|
368
|
+
const length = (_e2 = coverLengthMap[model]) != null ? _e2 : 1;
|
|
369
|
+
initialData[option.value] = length > 0 ? new Array(length).fill({}) : [];
|
|
370
|
+
} else {
|
|
371
|
+
initialData[option.value] = [{}];
|
|
372
|
+
}
|
|
373
|
+
} else if (option.type === "select" && ((_f2 = option.meta) == null ? void 0 : _f2.isMultiple)) {
|
|
359
374
|
initialData[option.value] = [];
|
|
360
375
|
} else if (option.type === "checkbox") {
|
|
361
376
|
initialData[option.value] = [];
|
|
@@ -519,10 +534,11 @@ const _sfc_main = defineComponent({
|
|
|
519
534
|
"domain-id": __props.domainId,
|
|
520
535
|
series: __props.series,
|
|
521
536
|
payload: __props.payload,
|
|
537
|
+
"cover-model": coverModel.value,
|
|
522
538
|
onUpload: _cache[2] || (_cache[2] = (e) => emit("upload", e)),
|
|
523
539
|
onSelectContent: _cache[3] || (_cache[3] = (e) => emit("select-content", e)),
|
|
524
540
|
onCoverModelChange: handleCoverModelChange
|
|
525
|
-
}, null, 8, ["value", "onUpdate:value", "form-item", "BASE_API", "domain-id", "series", "payload"])) : createCommentVNode("v-if", true)
|
|
541
|
+
}, null, 8, ["value", "onUpdate:value", "form-item", "BASE_API", "domain-id", "series", "payload", "cover-model"])) : createCommentVNode("v-if", true)
|
|
526
542
|
]),
|
|
527
543
|
_: 2
|
|
528
544
|
}, 1032, ["label", "field", "tooltip"]), [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, watch, onMounted, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createBlock, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { Select, Option } from "@arco-design/web-vue";
|
|
3
|
-
import { getBylineTemplates, getAllDutyEditor } from "../../script/api.js";
|
|
3
|
+
import { getBylineTemplates, getAllDutyEditor, getBackendUsers } from "../../script/api.js";
|
|
4
4
|
import { getConfiguration } from "../../../hooks/source.js";
|
|
5
5
|
const _hoisted_1 = ["id"];
|
|
6
6
|
const _sfc_main = defineComponent({
|
|
@@ -19,16 +19,44 @@ const _sfc_main = defineComponent({
|
|
|
19
19
|
const emits = __emit;
|
|
20
20
|
const props = __props;
|
|
21
21
|
const modelValue = computed({
|
|
22
|
-
get: () =>
|
|
22
|
+
get: () => {
|
|
23
|
+
var _a;
|
|
24
|
+
if (((_a = props.meta) == null ? void 0 : _a.key) === "backend_users" && props.mValue) {
|
|
25
|
+
if (typeof props.mValue === "object" && props.mValue.uid) {
|
|
26
|
+
return props.mValue.uid;
|
|
27
|
+
}
|
|
28
|
+
if (typeof props.mValue === "object" && !props.mValue.uid) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return props.mValue;
|
|
33
|
+
},
|
|
23
34
|
set: (value) => {
|
|
35
|
+
var _a;
|
|
36
|
+
if (((_a = props.meta) == null ? void 0 : _a.key) === "backend_users") {
|
|
37
|
+
if (value) {
|
|
38
|
+
const selectedOption = options.value.find((opt) => opt.value === value);
|
|
39
|
+
if (selectedOption == null ? void 0 : selectedOption._raw) {
|
|
40
|
+
emits("update:mValue", selectedOption._raw);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
emits("update:mValue", { id: 0, uid: "", name: "", alias: "" });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
24
48
|
emits("update:mValue", value);
|
|
25
49
|
}
|
|
26
50
|
});
|
|
27
51
|
const options = ref([]);
|
|
28
52
|
const loadOptions = async () => {
|
|
29
|
-
var _a, _b, _c;
|
|
30
|
-
if (
|
|
31
|
-
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
|
+
if (((_a = props.meta) == null ? void 0 : _a.selectOptions) && Array.isArray(props.meta.selectOptions)) {
|
|
55
|
+
options.value = props.meta.selectOptions;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!((_b = props.meta) == null ? void 0 : _b.key)) {
|
|
59
|
+
if ((_c = props.meta) == null ? void 0 : _c.options) {
|
|
32
60
|
options.value = props.meta.options;
|
|
33
61
|
}
|
|
34
62
|
return;
|
|
@@ -65,6 +93,15 @@ const _sfc_main = defineComponent({
|
|
|
65
93
|
value: item.id
|
|
66
94
|
}));
|
|
67
95
|
}
|
|
96
|
+
} else if (props.meta.key === "backend_users" && props.BASE_API) {
|
|
97
|
+
const { code, message } = await getBackendUsers(props.BASE_API);
|
|
98
|
+
if (code === 0 && (message == null ? void 0 : message.users)) {
|
|
99
|
+
options.value = message.users.map((item) => ({
|
|
100
|
+
label: item.alias || item.name,
|
|
101
|
+
value: item.uid,
|
|
102
|
+
_raw: { id: item.id, uid: item.uid, name: item.name, alias: item.alias || item.name }
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
68
105
|
} else if (props.meta.key === "sources" && props.domainId) {
|
|
69
106
|
const { code, message } = await getConfiguration(props.BASE_API, {
|
|
70
107
|
domain_id: props.domainId,
|
|
@@ -78,7 +115,7 @@ const _sfc_main = defineComponent({
|
|
|
78
115
|
value: item.id || item
|
|
79
116
|
}));
|
|
80
117
|
}
|
|
81
|
-
} else if ((
|
|
118
|
+
} else if ((_d = props.meta) == null ? void 0 : _d.options) {
|
|
82
119
|
options.value = props.meta.options;
|
|
83
120
|
}
|
|
84
121
|
} catch (error) {
|
|
@@ -37,14 +37,24 @@ function useMetaOptions(BASE_API, domainId) {
|
|
|
37
37
|
unSync: true,
|
|
38
38
|
key: extendField.value,
|
|
39
39
|
isSearch: false,
|
|
40
|
-
selectOptions: (extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []
|
|
40
|
+
selectOptions: ((extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []).map(
|
|
41
|
+
(opt) => ({
|
|
42
|
+
label: opt.value,
|
|
43
|
+
value: opt.key
|
|
44
|
+
})
|
|
45
|
+
)
|
|
41
46
|
},
|
|
42
47
|
multi_selection: {
|
|
43
48
|
unSync: true,
|
|
44
49
|
key: extendField.value,
|
|
45
50
|
isSearch: false,
|
|
46
51
|
isMultiple: true,
|
|
47
|
-
selectOptions: (extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []
|
|
52
|
+
selectOptions: ((extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []).map(
|
|
53
|
+
(opt) => ({
|
|
54
|
+
label: opt.value,
|
|
55
|
+
value: opt.key
|
|
56
|
+
})
|
|
57
|
+
)
|
|
48
58
|
},
|
|
49
59
|
datetime: {
|
|
50
60
|
showTime: ((_a = extendedFieldDetail == null ? void 0 : extendedFieldDetail.date_format) == null ? void 0 : _a.includes("15:04")) || false,
|
|
@@ -68,6 +78,7 @@ function useMetaOptions(BASE_API, domainId) {
|
|
|
68
78
|
show: true,
|
|
69
79
|
required: extendField.required || false,
|
|
70
80
|
meta: metaMapping[fieldType] || {},
|
|
81
|
+
placeholder: (extendedFieldDetail == null ? void 0 : extendedFieldDetail.tips) || extendField.label,
|
|
71
82
|
is_extend: true,
|
|
72
83
|
ext_type: fieldType,
|
|
73
84
|
order: 0
|
|
@@ -44,4 +44,17 @@ function getEnabledExtendedFields(BASE_API, category = "pubmedia") {
|
|
|
44
44
|
method: "get"
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
function getBackendUsers(BASE_API, params) {
|
|
48
|
+
return request(BASE_API, {
|
|
49
|
+
url: "/poplar/v2/accounts/1",
|
|
50
|
+
method: "get",
|
|
51
|
+
params: {
|
|
52
|
+
keywords: "",
|
|
53
|
+
limit: 1e4,
|
|
54
|
+
offset: 0,
|
|
55
|
+
where: "state:0,role:0",
|
|
56
|
+
...params
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export { getAllDutyEditor, getBackendUsers, getBylineTemplates, getDocDetailsNew, getDocMetaFieldsConfig, getEnabledExtendedFields, updateDocMeta };
|
|
@@ -27,7 +27,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
27
27
|
domainId: {},
|
|
28
28
|
series: {},
|
|
29
29
|
payload: {},
|
|
30
|
-
userInfo: {}
|
|
30
|
+
userInfo: {},
|
|
31
|
+
coverModel: {}
|
|
31
32
|
},
|
|
32
33
|
emits: ["update:value", "upload", "cover-model-change"],
|
|
33
34
|
setup(__props, { emit: __emit }) {
|
|
@@ -152,19 +153,20 @@ const _sfc_main = vue.defineComponent({
|
|
|
152
153
|
key: 0,
|
|
153
154
|
"m-value": mValue.value,
|
|
154
155
|
label: __props.formItem.label,
|
|
155
|
-
placeholder: (_a = __props.formItem.meta) == null ? void 0 : _a.placeholder,
|
|
156
|
+
placeholder: __props.formItem.placeholder || ((_a = __props.formItem.meta) == null ? void 0 : _a.placeholder),
|
|
156
157
|
meta: __props.formItem.meta,
|
|
157
158
|
BASE_API: __props.BASE_API,
|
|
158
159
|
"domain-id": __props.domainId,
|
|
159
160
|
series: __props.series,
|
|
160
161
|
payload: __props.payload,
|
|
162
|
+
"cover-model": __props.coverModel,
|
|
161
163
|
"onUpdate:mValue": _cache[0] || (_cache[0] = (e) => mValue.value = e),
|
|
162
164
|
onUpload: _cache[1] || (_cache[1] = (e) => _ctx.$emit("upload", e)),
|
|
163
165
|
onResourceSelect: handleResourceSelect,
|
|
164
166
|
onImageEdit: handleImageEdit,
|
|
165
167
|
onPreview: handlePreview,
|
|
166
168
|
onCoverModelChange: _cache[2] || (_cache[2] = (model) => _ctx.$emit("cover-model-change", model))
|
|
167
|
-
}, null, 40, ["m-value", "label", "placeholder", "meta", "BASE_API", "domain-id", "series", "payload"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, " \u7EC4\u4EF6\u672A\u627E\u5230: " + vue.toDisplayString(__props.formItem.type) + " (\u5B57\u6BB5: " + vue.toDisplayString(__props.formItem.value) + ") ", 1)),
|
|
169
|
+
}, null, 40, ["m-value", "label", "placeholder", "meta", "BASE_API", "domain-id", "series", "payload", "cover-model"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, " \u7EC4\u4EF6\u672A\u627E\u5230: " + vue.toDisplayString(__props.formItem.type) + " (\u5B57\u6BB5: " + vue.toDisplayString(__props.formItem.value) + ") ", 1)),
|
|
168
170
|
vue.createCommentVNode(" \u8D44\u6E90\u9009\u62E9\u5668 "),
|
|
169
171
|
resourceModalVisible.value && userInfo.value ? (vue.openBlock(), vue.createBlock(component, {
|
|
170
172
|
key: 2,
|
|
@@ -285,7 +285,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
options.value.forEach((option) => {
|
|
288
|
-
var _a2, _b2, _c2, _d2;
|
|
288
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
289
289
|
if (initialData[option.value] !== void 0) {
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
@@ -309,6 +309,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
309
309
|
}
|
|
310
310
|
} else if (fieldValue && typeof fieldValue === "object" && !Array.isArray(fieldValue) && fieldValue.key && fieldValue.value) {
|
|
311
311
|
fieldValue = fieldValue.key;
|
|
312
|
+
} else if (option.ext_type === "backend_user" && fieldValue && typeof fieldValue === "object" && !Array.isArray(fieldValue) && fieldValue.uid !== void 0) {
|
|
313
|
+
fieldValue = fieldValue.uid || "";
|
|
312
314
|
} else if (Array.isArray(fieldValue) && fieldValue.length > 0 && ((_a2 = fieldValue[0]) == null ? void 0 : _a2.key)) {
|
|
313
315
|
fieldValue = fieldValue.map((item) => item.key);
|
|
314
316
|
}
|
|
@@ -355,8 +357,21 @@ const _sfc_main = vue.defineComponent({
|
|
|
355
357
|
} else if (option.type === "banner") {
|
|
356
358
|
initialData[option.value] = false;
|
|
357
359
|
} else if (option.type === "thumb") {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
if (option.value === "cover") {
|
|
361
|
+
const model = (_d2 = coverModel.value) != null ? _d2 : 3;
|
|
362
|
+
const coverLengthMap = {
|
|
363
|
+
1: 1,
|
|
364
|
+
2: 3,
|
|
365
|
+
3: 1,
|
|
366
|
+
4: 0,
|
|
367
|
+
5: 1
|
|
368
|
+
};
|
|
369
|
+
const length = (_e2 = coverLengthMap[model]) != null ? _e2 : 1;
|
|
370
|
+
initialData[option.value] = length > 0 ? new Array(length).fill({}) : [];
|
|
371
|
+
} else {
|
|
372
|
+
initialData[option.value] = [{}];
|
|
373
|
+
}
|
|
374
|
+
} else if (option.type === "select" && ((_f2 = option.meta) == null ? void 0 : _f2.isMultiple)) {
|
|
360
375
|
initialData[option.value] = [];
|
|
361
376
|
} else if (option.type === "checkbox") {
|
|
362
377
|
initialData[option.value] = [];
|
|
@@ -520,10 +535,11 @@ const _sfc_main = vue.defineComponent({
|
|
|
520
535
|
"domain-id": __props.domainId,
|
|
521
536
|
series: __props.series,
|
|
522
537
|
payload: __props.payload,
|
|
538
|
+
"cover-model": coverModel.value,
|
|
523
539
|
onUpload: _cache[2] || (_cache[2] = (e) => emit("upload", e)),
|
|
524
540
|
onSelectContent: _cache[3] || (_cache[3] = (e) => emit("select-content", e)),
|
|
525
541
|
onCoverModelChange: handleCoverModelChange
|
|
526
|
-
}, null, 8, ["value", "onUpdate:value", "form-item", "BASE_API", "domain-id", "series", "payload"])) : vue.createCommentVNode("v-if", true)
|
|
542
|
+
}, null, 8, ["value", "onUpdate:value", "form-item", "BASE_API", "domain-id", "series", "payload", "cover-model"])) : vue.createCommentVNode("v-if", true)
|
|
527
543
|
]),
|
|
528
544
|
_: 2
|
|
529
545
|
}, 1032, ["label", "field", "tooltip"]), [
|
|
@@ -20,16 +20,44 @@ const _sfc_main = vue.defineComponent({
|
|
|
20
20
|
const emits = __emit;
|
|
21
21
|
const props = __props;
|
|
22
22
|
const modelValue = vue.computed({
|
|
23
|
-
get: () =>
|
|
23
|
+
get: () => {
|
|
24
|
+
var _a;
|
|
25
|
+
if (((_a = props.meta) == null ? void 0 : _a.key) === "backend_users" && props.mValue) {
|
|
26
|
+
if (typeof props.mValue === "object" && props.mValue.uid) {
|
|
27
|
+
return props.mValue.uid;
|
|
28
|
+
}
|
|
29
|
+
if (typeof props.mValue === "object" && !props.mValue.uid) {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return props.mValue;
|
|
34
|
+
},
|
|
24
35
|
set: (value) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (((_a = props.meta) == null ? void 0 : _a.key) === "backend_users") {
|
|
38
|
+
if (value) {
|
|
39
|
+
const selectedOption = options.value.find((opt) => opt.value === value);
|
|
40
|
+
if (selectedOption == null ? void 0 : selectedOption._raw) {
|
|
41
|
+
emits("update:mValue", selectedOption._raw);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
emits("update:mValue", { id: 0, uid: "", name: "", alias: "" });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
25
49
|
emits("update:mValue", value);
|
|
26
50
|
}
|
|
27
51
|
});
|
|
28
52
|
const options = vue.ref([]);
|
|
29
53
|
const loadOptions = async () => {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
-
if (
|
|
32
|
-
|
|
54
|
+
var _a, _b, _c, _d;
|
|
55
|
+
if (((_a = props.meta) == null ? void 0 : _a.selectOptions) && Array.isArray(props.meta.selectOptions)) {
|
|
56
|
+
options.value = props.meta.selectOptions;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!((_b = props.meta) == null ? void 0 : _b.key)) {
|
|
60
|
+
if ((_c = props.meta) == null ? void 0 : _c.options) {
|
|
33
61
|
options.value = props.meta.options;
|
|
34
62
|
}
|
|
35
63
|
return;
|
|
@@ -66,6 +94,15 @@ const _sfc_main = vue.defineComponent({
|
|
|
66
94
|
value: item.id
|
|
67
95
|
}));
|
|
68
96
|
}
|
|
97
|
+
} else if (props.meta.key === "backend_users" && props.BASE_API) {
|
|
98
|
+
const { code, message } = await api.getBackendUsers(props.BASE_API);
|
|
99
|
+
if (code === 0 && (message == null ? void 0 : message.users)) {
|
|
100
|
+
options.value = message.users.map((item) => ({
|
|
101
|
+
label: item.alias || item.name,
|
|
102
|
+
value: item.uid,
|
|
103
|
+
_raw: { id: item.id, uid: item.uid, name: item.name, alias: item.alias || item.name }
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
69
106
|
} else if (props.meta.key === "sources" && props.domainId) {
|
|
70
107
|
const { code, message } = await source.getConfiguration(props.BASE_API, {
|
|
71
108
|
domain_id: props.domainId,
|
|
@@ -79,7 +116,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
79
116
|
value: item.id || item
|
|
80
117
|
}));
|
|
81
118
|
}
|
|
82
|
-
} else if ((
|
|
119
|
+
} else if ((_d = props.meta) == null ? void 0 : _d.options) {
|
|
83
120
|
options.value = props.meta.options;
|
|
84
121
|
}
|
|
85
122
|
} catch (error) {
|
|
@@ -38,14 +38,24 @@ function useMetaOptions(BASE_API, domainId) {
|
|
|
38
38
|
unSync: true,
|
|
39
39
|
key: extendField.value,
|
|
40
40
|
isSearch: false,
|
|
41
|
-
selectOptions: (extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []
|
|
41
|
+
selectOptions: ((extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []).map(
|
|
42
|
+
(opt) => ({
|
|
43
|
+
label: opt.value,
|
|
44
|
+
value: opt.key
|
|
45
|
+
})
|
|
46
|
+
)
|
|
42
47
|
},
|
|
43
48
|
multi_selection: {
|
|
44
49
|
unSync: true,
|
|
45
50
|
key: extendField.value,
|
|
46
51
|
isSearch: false,
|
|
47
52
|
isMultiple: true,
|
|
48
|
-
selectOptions: (extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []
|
|
53
|
+
selectOptions: ((extendedFieldDetail == null ? void 0 : extendedFieldDetail.select_options) || []).map(
|
|
54
|
+
(opt) => ({
|
|
55
|
+
label: opt.value,
|
|
56
|
+
value: opt.key
|
|
57
|
+
})
|
|
58
|
+
)
|
|
49
59
|
},
|
|
50
60
|
datetime: {
|
|
51
61
|
showTime: ((_a = extendedFieldDetail == null ? void 0 : extendedFieldDetail.date_format) == null ? void 0 : _a.includes("15:04")) || false,
|
|
@@ -69,6 +79,7 @@ function useMetaOptions(BASE_API, domainId) {
|
|
|
69
79
|
show: true,
|
|
70
80
|
required: extendField.required || false,
|
|
71
81
|
meta: metaMapping[fieldType] || {},
|
|
82
|
+
placeholder: (extendedFieldDetail == null ? void 0 : extendedFieldDetail.tips) || extendField.label,
|
|
72
83
|
is_extend: true,
|
|
73
84
|
ext_type: fieldType,
|
|
74
85
|
order: 0
|
|
@@ -46,7 +46,21 @@ function getEnabledExtendedFields(BASE_API, category = "pubmedia") {
|
|
|
46
46
|
method: "get"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
function getBackendUsers(BASE_API, params) {
|
|
50
|
+
return request(BASE_API, {
|
|
51
|
+
url: "/poplar/v2/accounts/1",
|
|
52
|
+
method: "get",
|
|
53
|
+
params: {
|
|
54
|
+
keywords: "",
|
|
55
|
+
limit: 1e4,
|
|
56
|
+
offset: 0,
|
|
57
|
+
where: "state:0,role:0",
|
|
58
|
+
...params
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
49
62
|
exports.getAllDutyEditor = getAllDutyEditor;
|
|
63
|
+
exports.getBackendUsers = getBackendUsers;
|
|
50
64
|
exports.getBylineTemplates = getBylineTemplates;
|
|
51
65
|
exports.getDocDetailsNew = getDocDetailsNew;
|
|
52
66
|
exports.getDocMetaFieldsConfig = getDocMetaFieldsConfig;
|