@cmstops/pro-compo
Version:
[物料平台文档中心](https://arco.design/docs/material/guide)
462 lines (461 loc) • 21 kB
JavaScript
import { defineComponent, computed, ref, onMounted, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString, createVNode, createCommentVNode } from "vue";
import { Modal, Tabs, TabPane, Button } from "@arco-design/web-vue";
import _sfc_main$1 from "./components/ViewAllColumn/index.js";
import _sfc_main$4 from "./components/CompoList/index.js";
import _sfc_main$6 from "./components/MpAccountList/index.js";
import _sfc_main$3 from "./components/ContentList/index.js";
import _sfc_main$5 from "./components/LiveList/index.js";
import _sfc_main$8 from "./components/EqxiuList/index.js";
import _sfc_main$7 from "./components/MpContentList/index.js";
import _sfc_main$9 from "./components/Dejin/index.js";
import _sfc_main$2 from "./components/storeBox/index.js";
import "../typeIcons/style/index.js";
import { getConfigurationNew } from "./script/api.js";
import { DEFAULT_BASE_API } from "../config.js";
import useLoadUserInfo from "../hooks/user.js";
const _sfc_main = defineComponent({
...{ name: "contentModal" },
__name: "component",
props: {
BASE_API: {},
visible: { type: Boolean },
title: {},
outsideSelectData: {},
defaultSelectedData: {},
maxSelect: {},
typeData: {},
userStore: {},
compoFilter: { type: Boolean, default: false }
},
emits: ["update:visible", "comfirm"],
setup(__props, { emit: __emit }) {
var _a, _b, _c;
const emit = __emit;
const props = __props;
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
const visible = computed({
get() {
return props.visible;
},
set(value) {
setVisible(value);
}
});
const mpName = ((_c = (_b = (_a = window.situoyun) == null ? void 0 : _a.config) == null ? void 0 : _b.oem_config) == null ? void 0 : _c.mp_name) || "\u516C\u4F17\u53F7";
const selectedData = ref([]);
const hasSelected = computed(() => {
return selectedData.value.length > 0;
});
const typeDataController = computed(() => {
const ret = JSON.parse(JSON.stringify(props.typeData));
return ret;
});
const setVisible = (bool) => {
emit("update:visible", bool);
};
const selectedDataChangeHandle = (data) => {
selectedData.value = data;
};
const handleOk = () => {
setVisible(false);
};
const handleCancel = () => {
setVisible(false);
};
const comfirm = () => {
emit("comfirm", JSON.parse(JSON.stringify(selectedData.value)));
};
const { userInfo, getUserInfoHandle } = useLoadUserInfo(BASE_API);
const HandleOpen = () => {
selectedData.value = props.defaultSelectedData || [];
};
const HandleClose = () => {
selectedData.value = [];
};
const tabsChange = () => {
selectedData.value = [];
};
const configData = ref({});
const loadConfig = async () => {
var _a2;
const res = await getConfigurationNew(BASE_API, {
module: "third_party_services"
});
if (res.code === 0 && ((_a2 = res.message) == null ? void 0 : _a2.length)) {
res.message.forEach((item) => {
configData.value[item.key] = JSON.parse(item.value);
});
}
};
const checkServiceEnable = (key) => {
const data = configData.value[key];
if (!data)
return false;
if (!data.enable && typeof data.enable !== "undefined")
return false;
return true;
};
onMounted(() => {
if (props.userStore) {
userInfo.value = { BASE_API, ...props.userStore };
} else {
getUserInfoHandle();
}
loadConfig();
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(Modal), {
footer: false,
"mask-closable": false,
visible: visible.value,
"body-class": "add-content-modal-body",
"modal-class": "add-content-modal-wrapper",
"title-align": "start",
"unmount-on-close": "",
width: "1020px",
onCancel: handleCancel,
onClose: HandleClose,
onOk: handleOk,
onOpen: HandleOpen
}, {
title: withCtx(() => [
createTextVNode(toDisplayString(props.title ? props.title : "\u6DFB\u52A0\u5185\u5BB9"), 1)
]),
default: withCtx(() => [
createVNode(unref(Tabs), {
class: "content-tabs",
justify: "",
"lazy-load": "",
onTabClick: tabsChange
}, {
default: withCtx(() => [
createCommentVNode(" \u680F\u76EE\u7A3F\u4EF6 "),
typeDataController.value.addDoc ? (openBlock(), createBlock(unref(TabPane), {
key: "1",
title: "\u680F\u76EE"
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$1, {
key: 0,
banner: typeDataController.value.docBanner,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
series: typeDataController.value.docSeries,
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[0] || (_cache[0] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[8] || (_cache[8] = [
createTextVNode("\u6DFB\u52A0 ")
])),
_: 1,
__: [8]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["banner", "default-selected-data", "max-select", "series", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
})) : createCommentVNode("v-if", true),
createCommentVNode(" \u9891\u9053 "),
typeDataController.value.addContentList ? (openBlock(), createBlock(unref(TabPane), {
key: "2",
title: "\u9891\u9053"
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$3, {
key: 0,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
type: typeDataController.value.contentListType,
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[1] || (_cache[1] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[9] || (_cache[9] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [9]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["default-selected-data", "max-select", "outside-select-data", "type", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
})) : createCommentVNode("v-if", true),
createCommentVNode(" \u7EC4\u4EF6 "),
typeDataController.value.addCompo ? (openBlock(), createBlock(unref(TabPane), {
key: "5",
title: "\u7EC4\u4EF6"
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$4, {
key: 0,
type: typeDataController.value.compoType,
"compo-filter": _ctx.compoFilter,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[2] || (_cache[2] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[10] || (_cache[10] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [10]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["type", "compo-filter", "default-selected-data", "max-select", "outside-select-data", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
})) : createCommentVNode("v-if", true),
createCommentVNode(" \u4E92\u52A8\u76F4\u64AD "),
typeDataController.value.addILive && checkServiceEnable("guangdianyun") ? (openBlock(), createBlock(unref(TabPane), {
key: "6",
title: "\u4E92\u52A8\u76F4\u64AD"
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$5, {
key: 0,
columns: typeDataController.value.iliveType,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[3] || (_cache[3] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[11] || (_cache[11] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [11]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["columns", "default-selected-data", "max-select", "outside-select-data", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
})) : createCommentVNode("v-if", true),
createCommentVNode(" \u516C\u4F17\u53F7\u8D26\u53F7 "),
typeDataController.value.addMpAccount ? (openBlock(), createBlock(unref(TabPane), {
key: "7",
title: unref(mpName)
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$6, {
key: 0,
columns: typeDataController.value.MpAccountType,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[4] || (_cache[4] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[12] || (_cache[12] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [12]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["columns", "default-selected-data", "max-select", "outside-select-data", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
}, 8, ["title"])) : createCommentVNode("v-if", true),
createCommentVNode(" \u516C\u4F17\u53F7\u5185\u5BB9 "),
typeDataController.value.addMpContent ? (openBlock(), createBlock(unref(TabPane), {
key: "8",
title: `${unref(mpName)}\u5185\u5BB9`
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$7, {
key: 0,
columns: typeDataController.value.MpAccountType,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[5] || (_cache[5] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[13] || (_cache[13] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [13]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["columns", "default-selected-data", "max-select", "outside-select-data", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
}, 8, ["title"])) : createCommentVNode("v-if", true),
createCommentVNode(" \u4E92\u52A8\u8FD0\u8425 "),
typeDataController.value.addFunhd && checkServiceEnable("interactive") ? (openBlock(), createBlock(unref(TabPane), {
key: "9",
title: "\u4E92\u52A8\u8FD0\u8425"
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$8, {
key: 0,
columns: typeDataController.value.funhdType,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[6] || (_cache[6] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[14] || (_cache[14] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [14]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["columns", "default-selected-data", "max-select", "outside-select-data", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
})) : createCommentVNode("v-if", true),
createCommentVNode(" \u62A5\u6599\u5185\u5BB9 "),
typeDataController.value.addDejin ? (openBlock(), createBlock(unref(TabPane), {
key: "10",
title: "\u62A5\u6599\u5185\u5BB9"
}, {
default: withCtx(() => [
unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(_sfc_main$9, {
key: 0,
"default-selected-data": selectedData.value,
"max-select": _ctx.maxSelect,
"outside-select-data": _ctx.outsideSelectData || [],
"type-data": typeDataController.value,
"user-info": unref(userInfo),
onChange: selectedDataChangeHandle
}, {
store: withCtx(() => [
createVNode(_sfc_main$2, {
selectData: selectedData.value,
"onUpdate:selectData": _cache[7] || (_cache[7] = ($event) => selectedData.value = $event)
}, null, 8, ["selectData"])
]),
options: withCtx(() => [
createVNode(unref(Button), {
disabled: !hasSelected.value,
type: "primary",
onClick: comfirm
}, {
default: withCtx(() => _cache[15] || (_cache[15] = [
createTextVNode(" \u6DFB\u52A0 ")
])),
_: 1,
__: [15]
}, 8, ["disabled"])
]),
_: 1
}, 8, ["default-selected-data", "max-select", "outside-select-data", "type-data", "user-info"])) : createCommentVNode("v-if", true)
]),
_: 1
})) : createCommentVNode("v-if", true)
]),
_: 1
})
]),
_: 1
}, 8, ["visible"]);
};
}
});
export { _sfc_main as default };