| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- import { computed as i, openBlock as r, createBlock as d, withCtx as b, createElementBlock as D, Fragment as L, renderList as O, unref as l, createTextVNode as P, toDisplayString as h, createSlots as z, createElementVNode as G } from "vue";
- import { a6 as J, a7 as K, aj as Q, I as R } from "./index2.js";
- import { _ as U } from "./index9.js";
- import { D as W } from "./dayjs.js";
- const X = { key: 5 }, ne = {
- __name: "SExtendFieldsFormItem",
- props: {
- field: {
- type: Object,
- required: !0
- },
- value: {
- default: null
- },
- // 表单类型(add / edit / view)
- type: {
- type: String,
- required: !0
- }
- },
- emits: ["update:value", "callback"],
- setup(x, { emit: S }) {
- const n = x, s = S, A = (e) => s("update:value", e), k = i(() => {
- var e;
- return ((e = n.field.fillModeConfig) == null ? void 0 : e.config) || n.field.fillModeConfig || {};
- }), o = i(() => {
- var e;
- return (e = n.field.fillModeConfig) == null ? void 0 : e.showType;
- }), m = i(() => {
- if (n.type === "view") return !0;
- const { isManual: e } = n.field.fillModeConfig || {};
- return !e;
- }), F = i(() => {
- var e;
- return !!((e = n.field.fillModeConfig) != null && e.required);
- }), g = i(() => k.value.multiple === 1), { dropList: _ = [], dataType: w, min: M, max: C, unit: Y, scale: v, maxlength: f, minlength: p, format: y } = k.value;
- i(() => {
- if (n.type !== "view" || o.value !== "select") return "";
- if (g.value)
- return Array.isArray(n.value) && n.value.length ? _.filter((t) => n.value.includes(t.value)).map((t) => t.label).join(";") : "";
- const e = _.find((t) => t.value === n.value);
- return e ? e.label : "";
- });
- const I = i(() => g.value ? Array.isArray(n.value) && n.value.length ? n.value.map((e) => w === "int" ? parseInt(e) : e) : n.value === null ? [] : n.value : w === "int" ? n.value ? parseInt(n.value) : null : n.value), u = (e) => [null, void 0, ""].includes(e), c = i(() => {
- const e = n.value;
- return Array.isArray(e) ? e.length ? e[0] : "" : e == null ? "" : e;
- }), V = (e) => {
- A(e);
- }, q = (e) => Number((Math.pow(10, Number(e)) * 0.1).toFixed(10));
- return (e, t) => {
- const E = K, H = J, N = U, T = Q, j = R, B = W;
- return o.value === "select" ? (r(), d(H, {
- key: 0,
- value: I.value,
- disabled: m.value,
- mode: g.value ? "multiple" : void 0,
- clearable: !F.value,
- onChange: V
- }, {
- default: b(() => [
- (r(!0), D(L, null, O(l(_), (a) => (r(), d(E, {
- key: a.value,
- value: a.value
- }, {
- default: b(() => [
- P(h(a.label), 1)
- ]),
- _: 2
- }, 1032, ["value"]))), 128))
- ]),
- _: 1
- }, 8, ["value", "disabled", "mode", "clearable"])) : o.value === "number" ? (r(), d(N, {
- key: 1,
- value: c.value,
- disabled: m.value,
- min: u(l(M)) ? void 0 : +l(M),
- max: u(l(C)) ? void 0 : +l(C),
- step: l(v) ? +q(l(v)) : void 0,
- precision: u(l(v)) ? void 0 : +l(v),
- style: { width: "100%" },
- onChange: t[0] || (t[0] = (a) => s("update:value", a))
- }, z({ _: 2 }, [
- u(l(Y)) ? void 0 : {
- name: "suffix",
- fn: b(() => [
- G("span", null, h(l(Y)), 1)
- ]),
- key: "0"
- }
- ]), 1032, ["value", "disabled", "min", "max", "step", "precision"])) : o.value === "textarea" ? (r(), d(T, {
- key: 2,
- value: c.value,
- disabled: m.value,
- rows: 3,
- "show-word-limit": "",
- minlength: u(l(p)) ? void 0 : +l(p),
- maxlength: u(l(f)) ? void 0 : +l(f),
- onChange: t[1] || (t[1] = (a) => s("update:value", a.target.value))
- }, null, 8, ["value", "disabled", "minlength", "maxlength"])) : o.value === "input" ? (r(), d(j, {
- key: 3,
- value: c.value,
- disabled: m.value,
- minlength: u(l(p)) ? void 0 : +l(p),
- maxlength: u(l(f)) ? void 0 : +l(f),
- onChange: t[2] || (t[2] = (a) => s("update:value", a.target.value))
- }, null, 8, ["value", "disabled", "minlength", "maxlength"])) : o.value === "datePicker" ? (r(), d(B, {
- key: 4,
- value: c.value,
- disabled: m.value,
- style: { width: "100%" },
- format: u(l(y)) ? void 0 : l(y),
- "show-time": l(y) === "YYYY-MM-DD HH:mm:ss",
- "value-format": "YYYY-MM-DD HH:mm:ss",
- onChange: t[3] || (t[3] = (a) => s("update:value", a))
- }, null, 8, ["value", "disabled", "format", "show-time"])) : (r(), D("span", X, h(x.value), 1));
- };
- }
- };
- export {
- ne as default
- };
|