UNPKG

@cdwx/system

Version:

成都文宣业务类服务模块组件库

167 lines (166 loc) 6.66 kB
/* empty css */ /* empty css */ /* empty css */ /* empty css */ import "../workspace/code/cloud-frontend/node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/theme-chalk/el-form-item.css.js"; /* empty css */ import { defineComponent as F, mergeModels as x, ref as p, useModel as q, computed as B, onMounted as I, reactive as U, openBlock as s, createBlock as i, withModifiers as $, withCtx as r, createVNode as m, createCommentVNode as f, createElementVNode as w, createTextVNode as y } from "vue"; import { ElMessage as _ } from "element-plus"; import { updateData as R, saveData as j } from "../workspace/code/cloud-frontend/service-modules/system/src/api/api-job.js"; import { ElInput as A } from "../workspace/code/cloud-frontend/node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/input/index.js"; import { ElFormItem as L, ElForm as O } from "../workspace/code/cloud-frontend/node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/form/index.js"; import { ElSwitch as T } from "../workspace/code/cloud-frontend/node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/switch/index.js"; import { ElButton as h } from "../workspace/code/cloud-frontend/node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/button/index.js"; const z = { class: "flex flex-1 justify-end" }, oe = /* @__PURE__ */ F({ name: "Add", __name: "add", props: /* @__PURE__ */ x({ rules: {} }, { modelValue: { required: !0 }, modelModifiers: {} }), emits: /* @__PURE__ */ x(["close"], ["update:modelValue"]), setup(v, { emit: k }) { const d = v, E = k, c = p(), t = p({ name: "", commandStatus: void 0, des: "" }), V = q(v, "modelValue"), b = B({ get() { return V.value; }, set(l) { V.value = l; } }); I(() => { b.value && (t.value = b.value); }); const C = U({ name: [ { required: !0, message: "请输入岗位名称", trigger: ["blur", "change"] } ] }), u = p(!1); function M(l) { !l || u.value || l.validate((e, n) => { if (e) S(); else if (n) { const o = document.querySelector(".el-form-item.is-error"); o && o.scrollIntoView({ behavior: "smooth", block: "center" }); } }); } async function S() { u.value = !0; try { t.value.id ? (await R(t.value), _.success("编辑成功")) : (await j(t.value), _.success("新增成功")), E("close"); } catch (l) { console.log(l); } finally { u.value = !1; } } return (l, e) => { const n = A, o = L, N = T, g = h, D = O; return s(), i(D, { ref_key: "formRef", ref: c, "label-width": "100px", rules: C, model: t.value, onSubmit: e[5] || (e[5] = $(() => { }, ["prevent"])) }, { default: r(() => [ d.rules.showName ? (s(), i(o, { key: 0, label: "岗位名称", prop: "name" }, { default: r(() => [ m(n, { modelValue: t.value.name, "onUpdate:modelValue": e[0] || (e[0] = (a) => t.value.name = a), placeholder: "请输入岗位名称", maxlength: "10", clearable: "" }, null, 8, ["modelValue"]) ]), _: 1 })) : f("", !0), d.rules.showDes ? (s(), i(o, { key: 1, label: "岗位描述" }, { default: r(() => [ m(n, { modelValue: t.value.des, "onUpdate:modelValue": e[1] || (e[1] = (a) => t.value.des = a), placeholder: "请输入描述信息", rows: 4, type: "textarea", maxlength: "100", clearable: "" }, null, 8, ["modelValue"]) ]), _: 1 })) : f("", !0), d.rules.showCommand ? (s(), i(o, { key: 2, label: "指挥调度大屏" }, { default: r(() => [ m(N, { modelValue: t.value.commandStatus, "onUpdate:modelValue": e[2] || (e[2] = (a) => t.value.commandStatus = a), "inline-prompt": "", "active-text": "开", "inactive-text": "关", "active-value": 1, "inactive-value": 0 }, null, 8, ["modelValue"]), e[6] || (e[6] = w("p", { class: "ml-10 text-12 color-[--el-text-color-regular]" }, " 指该职位的值班计划推送到指挥调度大屏 ", -1)) ]), _: 1 })) : f("", !0), m(o, null, { default: r(() => [ w("div", z, [ m(g, { disabled: u.value, onClick: e[3] || (e[3] = (a) => l.$emit("close")) }, { default: r(() => e[7] || (e[7] = [ y(" 取消 ") ])), _: 1 }, 8, ["disabled"]), m(g, { type: "primary", loading: u.value, onClick: e[4] || (e[4] = (a) => M(c.value)) }, { default: r(() => e[8] || (e[8] = [ y(" 确定 ") ])), _: 1 }, 8, ["loading"]) ]) ]), _: 1 }) ]), _: 1 }, 8, ["rules", "model"]); }; } }); export { oe as default };