ai-form-designer
Version:
vue3+adv的设计器,可视化开发页面表单
79 lines (78 loc) • 2.46 kB
JavaScript
import { defineComponent as g, ref as r, provide as v, onMounted as V, createElementBlock as x, openBlock as y, withDirectives as _, createElementVNode as s, vShow as w, unref as i, createTextVNode as b, createVNode as A } from "vue";
import { p as C, n as E } from "./index-DwcJO-0a.js";
import { a as u } from "./index-BKOQxhUA.js";
const Y = { class: "" }, B = { class: "py-4 my-2 text-center text-gray-400 bg-white" }, M = { style: { "margin-bottom": "12px" } }, D = /* @__PURE__ */ g({
__name: "index",
props: {
tree: { type: Boolean },
modelValue: {},
dataYVal: {}
},
emits: ["update:modelValue"],
setup(p, { emit: m }) {
const h = C.getComponent("select"), n = p, d = E(n, "modelValue", m), c = r(""), l = r([{ id: 1, label: "qq", value: "222" }]);
v("tree", n.tree), V(() => {
u.post(
"/dcc/open/treeTypeList",
{},
{
headers: { "Access-Control-Allow-Origin": "*" }
}
).then(function(t) {
console.log(t.data.records), l.value = [], t.data.records.length > 0 && t.data.records.forEach((e) => {
l.value.push({
id: e.id,
value: e.id,
label: e.name
});
});
}).catch(function(t) {
console.log(t);
});
});
function f(t) {
console.log(t), t && u.post(
"/dcc/open/treeDataList",
{
treeTypeId: t
},
{
headers: { "Access-Control-Allow-Origin": "*" }
}
).then(function(e) {
console.log(e.data.data);
let o = [];
e.data.data.length > 0 && e.data.data.forEach((a) => {
o.push({
label: a.label,
value: a.value,
children: a.children
});
}), d.value = [...o];
}).catch(function(e) {
console.log(e);
});
}
return (t, e) => {
var o;
return y(), x("div", Y, [
_(s("div", B, " 暂无选项 ", 512), [
[w, !((o = i(d)) != null && o.length)]
]),
s("div", M, [
e[1] || (e[1] = b(" 配置数据源: ")),
A(i(h), {
modelValue: c.value,
"onUpdate:modelValue": e[0] || (e[0] = (a) => c.value = a),
style: { width: "calc(100% - 100px)" },
options: l.value,
onChange: f
}, null, 8, ["modelValue", "options"])
])
]);
};
}
});
export {
D as default
};