@cdwx/system
Version:
成都文宣业务类服务模块组件库
650 lines (649 loc) • 32.6 kB
JavaScript
/* 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-config-provider.css.js";
/* 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-tooltip.css.js";
/* empty css */
import { defineComponent as de, ref as w, onMounted as fe, openBlock as r, createBlock as n, unref as c, withCtx as s, createElementVNode as y, normalizeClass as B, createTextVNode as u, toDisplayString as d, createCommentVNode as l, createElementBlock as I, createVNode as $ } from "vue";
/* 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-sub-menu.css.js";
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-menu-item.css.js";
import { useRouter as he } from "vue-router";
/* 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-breadcrumb-item.css.js";
/* empty css */
import "../workspace/code/cloud-frontend/node_modules/.pnpm/vue-echarts@7.0.3_@vue_runtime-core@3.5.13_echarts@5.6.0_vue@3.5.13_typescript@5.5.4_/node_modules/vue-echarts/dist/index.js";
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
import "../workspace/code/cloud-frontend/packages/http/src/index.js";
import "../workspace/code/cloud-frontend/packages/stores/src/instance.js";
import "../workspace/code/cloud-frontend/packages/stores/src/modules/menu.js";
import "../workspace/code/cloud-frontend/packages/stores/src/modules/page-tab.js";
import { useRequestingStore as be } from "../workspace/code/cloud-frontend/packages/stores/src/modules/requesting-records.js";
import "../workspace/code/cloud-frontend/packages/stores/src/modules/system.js";
import "../workspace/code/cloud-frontend/packages/stores/src/modules/user.js";
import { ElMessageBox as P, ElMessage as N } from "element-plus";
/* empty css */
/* empty css */
import { formatter as D } from "../workspace/code/cloud-frontend/packages/utils/src/index.js";
/* empty css */
/* empty css */
import { useSearchTable as we } from "../workspace/code/cloud-frontend/packages/hooks/src/use-search-table.js";
/* empty css */
/* empty css */
/* empty css */
import "../workspace/code/cloud-frontend/node_modules/.pnpm/@vue-office_docx@1.6.3_vue-demi@0.14.10_vue@3.5.13_typescript@5.5.4___vue@3.5.13_typescript@5.5.4_/node_modules/@vue-office/docx/lib/index.js";
import "../workspace/code/cloud-frontend/node_modules/.pnpm/@vue-office_excel@1.7.14_vue-demi@0.14.10_vue@3.5.13_typescript@5.5.4___vue@3.5.13_typescript@5.5.4_/node_modules/@vue-office/excel/lib/index.js";
import "../workspace/code/cloud-frontend/node_modules/.pnpm/@vue-office_pdf@2.0.10_vue-demi@0.14.10_vue@3.5.13_typescript@5.5.4___vue@3.5.13_typescript@5.5.4_/node_modules/@vue-office/pdf/lib/index.js";
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
import "../workspace/code/cloud-frontend/packages/ui/src/assets/iconfont/iconfont.js";
/* empty css */
/* 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-tab-pane.css.js";
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
import ye from "../workspace/code/cloud-frontend/packages/ui/src/components/search-bar/src/index.vue2.js";
/* empty css */
import { FormType as L } from "../workspace/code/cloud-frontend/packages/ui/src/components/search-bar/src/types.js";
/* empty css */
import ke from "../workspace/code/cloud-frontend/packages/ui/src/components/table/index.vue2.js";
/* empty css */
/* empty css */
/* empty css */
/* empty css */
import ve 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/locale/lang/zh-cn.js";
import { getListData as ge, deleteData as xe, delList as Te, exportData as _e, resetPwd as Ce, operateData as U } from "../workspace/code/cloud-frontend/service-modules/system/src/api/api-account.js";
import { getAllDep as Be } from "../workspace/code/cloud-frontend/service-modules/system/src/api/api-department.js";
import { getAllData as $e } from "../workspace/code/cloud-frontend/service-modules/system/src/api/api-job.js";
import { getAllList as Ne } from "../workspace/code/cloud-frontend/service-modules/system/src/api/api-role.js";
import { statusListAll as De } from "../workspace/code/cloud-frontend/service-modules/system/src/config/local-data.js";
import { replaceMiddleWithStars as Le } from "../workspace/code/cloud-frontend/service-modules/system/src/utils/index.js";
/* empty css */
import { ElButton as Ee } 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";
import { ElTree as Se } 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/tree/index.js";
import { ElTableColumn as Pe } 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/table/index.js";
import { ElSwitch as Ve } 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 { ElConfigProvider as Ae } 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/config-provider/index.js";
const Re = { class: "bg-white" }, Ie = {
key: 0,
class: "mr-10 w-220 bg-white p-30"
}, Ue = { class: "flex items-center" }, He = { class: "mr-12 text-14 color-[--el-text-color-regular]" }, ko = /* @__PURE__ */ de({
name: "Account",
__name: "list",
props: {
customName: {},
search: {},
btn: {},
showTree: { type: Boolean },
table: {},
addItem: {}
},
setup(H) {
const e = H, J = be(), T = he(), {
search: K,
searchParams: q,
setSearchParam: z,
turnPage: M,
pageInfo: O,
tableData: W,
getData: _,
remove: j,
removeBatch: X
} = we({
api: ge,
removeApi: xe,
removeBatchApi: Te,
defaultPageSize: 10,
defaultSearchParams: {
keyValue: "",
// 名称
roleName: "",
// 编码
status: void 0,
station: ""
// 岗位
}
}), E = w([]);
async function F() {
const o = {
id: 0,
nameValue: "",
name: "全部"
};
try {
const { data: t } = await Ne();
E.value = [o, ...t], E.value.forEach((a) => {
a.id !== 0 && (a.nameValue = a.name);
});
} catch (t) {
console.log(t);
}
}
const v = w([]);
function C() {
T.push({
path: "/system/account/create"
});
}
function G() {
T.push({
path: "/system/account/record"
});
}
async function Q() {
const o = await _e(q.value);
if (o.status === 200 && o.headers["content-disposition"]) {
const t = o.headers["content-disposition"].split("="), a = (t && decodeURI(t[1])).replace("", "").replace("", "") || "", m = new Blob([o.data], { type: "application/vnd.ms-excel" }), f = URL.createObjectURL(m), p = document.createElement("a");
p.download = a, p.target = "_blank", p.href = f, p.click(), URL.revokeObjectURL(f);
}
}
const h = w([]), k = w([]);
function Y(o) {
const t = h.value.find((m) => m.id === o), a = window.setInterval(() => {
(t == null ? void 0 : t.count) !== void 0 && (t.count = t.count - 1), (t == null ? void 0 : t.count) === 0 && (clearInterval(a), h.value = h.value.filter((m) => m.id !== o), k.value = k.value.filter((m) => m !== a));
}, 1e3);
k.value.push(a);
}
function Z() {
h.value = [], k.value && (k.value.forEach((o) => {
clearInterval(o);
}), k.value = []);
}
function ee(o) {
const t = h.value.find((a) => a.id === o.id);
t && t.count !== 60 || P.confirm(`请确认要重置【${o.realName}】${o.phone}的登录密码吗?点击确认将向此账号以短信的方式发送随机登录密码。`, "重置登录密码", {
confirmButtonText: "确认",
cancelButtonText: "取消"
}).then(async () => {
h.value.push({
id: o.id,
count: 60
}), Y(o.id), await Ce(o.id), N({
type: "success",
message: "登录密码重置成功,请注意查收短信!"
});
});
}
function te(o) {
T.push({
path: "/system/account/create",
query: {
operate: 2,
id: o.id,
type: "show"
}
});
}
function oe(o) {
T.push({
path: "/system/account/create",
query: {
operate: 1,
id: o.id
}
});
}
function ae(o) {
const t = o.status === 1 ? "禁用" : "启用";
P.confirm(`请确认要${t}【${o.realName}】吗?`, `${t}`, {
confirmButtonText: "确认",
cancelButtonText: "取消"
}).then(async () => {
await re(o), N({
type: "success",
message: `${t}成功!`
}), _();
});
}
async function re(o) {
try {
const t = {
ids: [o.id],
status: o.status ? 0 : 1
};
return await U(t), Promise.resolve(!0);
} catch {
return Promise.reject(new Error("false"));
}
}
const S = w([]);
function le(o) {
S.value = o;
}
async function g(o) {
const a = o === "disable" ? "禁用" : o === "enable" ? "启用" : "删除";
if (S.value.length <= 0)
return N({
type: "error",
message: `请选择需要批量${a}的数据哦`
});
const m = [];
S.value.forEach((f) => {
m.push(f.id);
}), o === "delete" ? X(m, `${e.customName}管理`) : P.confirm(`请确认要${a}选中的数据吗?`, `${a}`, {
confirmButtonText: "确认",
cancelButtonText: "取消"
}).then(async () => {
await U({
ids: m,
status: o === "disable" ? 0 : 1
}), N({
type: "success",
message: `${a}成功!`
}), _();
});
}
const V = w([]), A = w([]);
async function ne() {
try {
const { data: o } = await Be();
V.value = o;
} catch (o) {
console.log(o);
}
}
async function ie() {
try {
const { data: o } = await $e();
A.value = o;
} catch (o) {
console.log(o);
}
}
const se = {
children: "childTreeVoList",
label: "name"
};
function pe(o) {
z("deptId", o.id), _();
}
return fe(async () => {
var o, t, a, m, f;
await F(), e.showTree && ne(), (o = e.search) != null && o.showJob && ie(), (t = e.search) != null && t.showKey && v.value.push({
type: L.input,
label: "关键字",
placeholder: "姓名/手机号",
prop: "keyValue",
maxlength: 200,
defaultValue: ""
}), (a = e.search) != null && a.showStatus && v.value.push({
type: L.select,
label: "状态",
placeholder: "请选择",
options: De,
prop: "status",
maxlength: 200,
defaultValue: ""
}), (m = e.search) != null && m.showRole && v.value.push({
type: L.select,
label: "角色",
placeholder: "请选择",
options: E,
labelKey: "name",
valueKey: "nameValue",
prop: "roleName",
maxlength: 200,
defaultValue: ""
}), (f = e.search) != null && f.showJob && v.value.push({
type: L.select,
label: "岗位",
placeholder: "请选择",
options: A,
labelKey: "name",
valueKey: "id",
prop: "station",
maxlength: 200,
defaultValue: ""
}), _();
}), (o, t) => {
const a = Ee, m = ye, f = Se, p = Pe, ue = Ve, me = ke, ce = Ae;
return r(), n(ce, { locale: c(ve) }, {
default: s(() => [
y("div", {
class: B([{ "bg-white": !e.showTree, "bg-[#f0f2f5]": e.btn.showHeader }, "h-100%"])
}, [
y("div", null, [
y("div", Re, [
e.search ? (r(), n(m, {
key: 0,
"is-loading": c(J).loading,
"field-list": v.value,
onSearch: t[2] || (t[2] = (i) => c(K)(i))
}, {
buttons: s(() => [
e.btn.showAdd ? (r(), n(a, {
key: 0,
onClick: C
}, {
default: s(() => [
u(" 新增" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showBatchDis && !e.btn.showHeader ? (r(), n(a, {
key: 1,
onClick: t[0] || (t[0] = (i) => g("disable"))
}, {
default: s(() => [
u(" 停用" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showBatchEnable && !e.btn.showHeader ? (r(), n(a, {
key: 2,
onClick: t[1] || (t[1] = (i) => g("enable"))
}, {
default: s(() => [
u(" 启用" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showLog ? (r(), n(a, {
key: 3,
onClick: G
}, {
default: s(() => t[6] || (t[6] = [
u(" 操作记录 ")
])),
_: 1
})) : l("", !0)
]),
_: 1
}, 8, ["is-loading", "field-list"])) : l("", !0)
]),
y("div", {
class: B([{ "mt-10": e.search }, "flex"])
}, [
e.showTree ? (r(), I("div", Ie, [
$(f, {
data: V.value,
"default-expand-all": "",
"expand-on-click-node": !1,
"highlight-current": !0,
props: se,
onNodeClick: pe
}, null, 8, ["data"])
])) : l("", !0),
y("div", {
class: B(["h-100% w-1 flex-1 bg-white p-20", { "pt-0": !e.showTree }])
}, [
e.showTree ? (r(), I("div", {
key: 0,
class: B({ "mb-20": e.showTree })
}, [
e.btn.showAdd && !e.search ? (r(), n(a, {
key: 0,
type: "primary",
onClick: C
}, {
default: s(() => [
u(" 新增" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showBatchDel ? (r(), n(a, {
key: 1,
onClick: t[3] || (t[3] = (i) => g("delete"))
}, {
default: s(() => [
u(" 删除" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showBatchDis ? (r(), n(a, {
key: 2,
onClick: t[4] || (t[4] = (i) => g("disable"))
}, {
default: s(() => [
u(" 停用" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showBatchEnable ? (r(), n(a, {
key: 3,
onClick: t[5] || (t[5] = (i) => g("enable"))
}, {
default: s(() => [
u(" 启用" + d(e.customName || "员工"), 1)
]),
_: 1
})) : l("", !0),
e.btn.showBatchUpdateDept ? (r(), n(a, {
key: 4,
onClick: C
}, {
default: s(() => t[7] || (t[7] = [
u(" 编辑部门 ")
])),
_: 1
})) : l("", !0),
e.btn.showBatchUpdateJob ? (r(), n(a, {
key: 5,
onClick: C
}, {
default: s(() => t[8] || (t[8] = [
u(" 编辑岗位 ")
])),
_: 1
})) : l("", !0),
e.btn.showExport ? (r(), n(a, {
key: 6,
onClick: Q
}, {
default: s(() => t[9] || (t[9] = [
u(" 导出数据 ")
])),
_: 1
})) : l("", !0)
], 2)) : l("", !0),
$(me, {
data: c(W),
"page-info": c(O),
onPageChange: c(M),
onSelectionChange: le,
onPagechange: Z
}, {
default: s(() => [
e.table.showCheckBox ? (r(), n(p, {
key: 0,
type: "selection",
width: "55"
})) : l("", !0),
e.table.showOrder ? (r(), n(p, {
key: 1,
prop: "date",
label: "序号",
type: "index",
width: "80px",
align: "center"
})) : l("", !0),
e.table.showName ? (r(), n(p, {
key: 2,
prop: "realName",
label: "姓名"
})) : l("", !0),
e.table.showPhone ? (r(), n(p, {
key: 3,
prop: "phone",
label: "手机号"
}, {
default: s((i) => [
u(d(c(Le)(i.row.phone)), 1)
]),
_: 1
})) : l("", !0),
e.table.showAccount ? (r(), n(p, {
key: 4,
prop: "account",
label: "登录账号"
})) : l("", !0),
e.table.showSex ? (r(), n(p, {
key: 5,
prop: "sex",
label: "性别"
}, {
default: s((i) => [
u(d(i.row.sex === 1 ? "男" : i.row.sex === 2 ? "女" : "保密"), 1)
]),
_: 1
})) : l("", !0),
e.table.showEmail ? (r(), n(p, {
key: 6,
prop: "email",
label: "邮箱",
formatter: c(D)
}, null, 8, ["formatter"])) : l("", !0),
e.table.showDept ? (r(), n(p, {
key: 7,
prop: "department",
label: "所属部门",
formatter: c(D)
}, null, 8, ["formatter"])) : l("", !0),
e.table.showJob ? (r(), n(p, {
key: 8,
prop: "station",
label: "所属岗位",
formatter: c(D)
}, null, 8, ["formatter"])) : l("", !0),
e.table.showRole ? (r(), n(p, {
key: 9,
prop: "roleName",
label: "所属角色",
formatter: c(D)
}, null, 8, ["formatter"])) : l("", !0),
e.table.showCreateTime ? (r(), n(p, {
key: 10,
label: "创建时间",
prop: "createTime"
})) : l("", !0),
e.table.showAccountType ? (r(), n(p, {
key: 11,
prop: "userType",
label: "账号类型"
}, {
default: s((i) => [
u(d(i.row.userType === 1 ? "演示" : i.row.userType === 2 ? "正式" : "测试"), 1)
]),
_: 1
})) : l("", !0),
e.table.showUpdateTime ? (r(), n(p, {
key: 12,
prop: "updateTime",
label: "操作时间"
})) : l("", !0),
e.table.showUpdatePerson ? (r(), n(p, {
key: 13,
prop: "updatedBy",
label: "操作员"
})) : l("", !0),
e.table.showStatus ? (r(), n(p, {
key: 14,
label: "状态",
width: "100"
}, {
default: s((i) => [
y("div", Ue, [
y("span", He, d(i.row.status === 1 ? "启用" : "禁用"), 1),
$(ue, {
"model-value": i.row.status,
size: "small",
"active-value": 1,
"inactive-value": i.row.status !== 1,
"before-change": () => !1,
onClick: (b) => ae(i.row)
}, null, 8, ["model-value", "inactive-value", "onClick"])
])
]),
_: 1
})) : l("", !0),
$(p, {
label: "操作",
width: "250px"
}, {
default: s((i) => [
e.table.showResetBtn ? (r(), n(a, {
key: 0,
type: e.table.showBtnType === "text" ? "primary" : "",
link: e.table.showBtnType === "text",
onClick: (b) => ee(i.row)
}, {
default: s(() => {
var b, R;
return [
u(d(h.value.find((x) => x.id === i.row.id) && ((b = h.value.find((x) => x.id === i.row.id)) == null ? void 0 : b.count) !== 60 ? `${(R = h.value.find((x) => x.id === i.row.id)) == null ? void 0 : R.count}s后重置` : "重置密码"), 1)
];
}),
_: 2
}, 1032, ["type", "link", "onClick"])) : l("", !0),
e.table.showDetail ? (r(), n(a, {
key: 1,
type: e.table.showBtnType === "text" ? "primary" : "",
link: e.table.showBtnType === "text",
onClick: (b) => te(i.row)
}, {
default: s(() => t[10] || (t[10] = [
u(" 查看 ")
])),
_: 2
}, 1032, ["type", "link", "onClick"])) : l("", !0),
e.table.showEdit ? (r(), n(a, {
key: 2,
type: e.table.showBtnType === "text" ? "primary" : "",
link: e.table.showBtnType === "text",
onClick: (b) => oe(i.row)
}, {
default: s(() => t[11] || (t[11] = [
u(" 编辑 ")
])),
_: 2
}, 1032, ["type", "link", "onClick"])) : l("", !0),
e.table.showDel ? (r(), n(a, {
key: 3,
type: e.table.showBtnType === "text" ? "primary" : "",
link: e.table.showBtnType === "text",
onClick: (b) => c(j)(i.row, "realName", "id", "")
}, {
default: s(() => t[12] || (t[12] = [
u(" 删除 ")
])),
_: 2
}, 1032, ["type", "link", "onClick"])) : l("", !0)
]),
_: 1
})
]),
_: 1
}, 8, ["data", "page-info", "onPageChange"])
], 2)
], 2)
])
], 2)
]),
_: 1
}, 8, ["locale"]);
};
}
});
export {
ko as default
};