| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- import j from './ContentContainer-BF98H707.js';
- import { _ as A, B as M } from './Modal-5FpMAvV9.js';
- import { T as Q } from './TreeParts-YNkYa4Hd.js';
- import {
- ab as x,
- c as $,
- o as B,
- g as P,
- w as l,
- f as a,
- j as u,
- x as E,
- A as b,
- r as S,
- b as G,
- m as H,
- ac as J,
- B as y,
- a1 as K,
- d as W,
- e as F,
- s as X,
- i as O,
- t as T
- } from './index-Q0E3WkDV.js';
- import { a as Y } from './common-C2h3Dl9G.js';
- import { _ as Z } from './_plugin-vue_export-helper-DlAUqK2U.js';
- const q = {
- __name: 'OrgForm',
- props: {
- org_form: {
- type: Object,
- required: !0,
- default: () => ({ parentName: '', status: 0, deptName: '', leader: '', phone: '', address: '' })
- }
- },
- emits: ['statusChange'],
- setup(r, { emit: _ }) {
- const m = _,
- I = r,
- { org_form: o } = x(I),
- e = (d) => {
- m('statusChange', d);
- };
- return (d, n) => {
- const g = $('a-input'),
- c = $('a-form-item'),
- U = $('a-switch'),
- D = $('a-space'),
- k = $('a-form');
- return (
- B(),
- P(
- k,
- { model: u(o), layout: 'horizontal', ref: 'formRef' },
- {
- default: l(() => [
- a(
- c,
- { field: 'parentName', label: d.$t('permission.org.parent_org'), disabled: '' },
- {
- default: l(() => [
- a(
- g,
- {
- modelValue: u(o).parentName,
- 'onUpdate:modelValue': n[0] || (n[0] = (i) => (u(o).parentName = i))
- },
- null,
- 8,
- ['modelValue']
- )
- ]),
- _: 1
- },
- 8,
- ['label']
- ),
- a(
- c,
- { field: 'status', label: d.$t('permission.org.status') },
- {
- default: l(() => [
- a(
- U,
- {
- modelValue: u(o).status,
- 'onUpdate:modelValue': n[1] || (n[1] = (i) => (u(o).status = i)),
- onChange: n[2] || (n[2] = (i) => e(u(o).status)),
- 'checked-value': '1',
- 'unchecked-value': '0'
- },
- null,
- 8,
- ['modelValue']
- )
- ]),
- _: 1
- },
- 8,
- ['label']
- ),
- a(
- c,
- {
- field: 'deptName',
- label: d.$t('permission.org.org_name'),
- rules: [
- { required: !0, message: '机构名称必填' },
- { maxLength: 50, message: '长度不超过50' }
- ]
- },
- {
- default: l(() => [
- a(
- g,
- {
- modelValue: u(o).deptName,
- 'onUpdate:modelValue': n[3] || (n[3] = (i) => (u(o).deptName = i))
- },
- null,
- 8,
- ['modelValue']
- )
- ]),
- _: 1
- },
- 8,
- ['label']
- ),
- a(
- c,
- {
- field: 'leader',
- label: d.$t('permission.org.leader'),
- rules: [
- { required: !0, message: '联系人必填' },
- { maxLength: 50, message: '长度不超过50' }
- ]
- },
- {
- default: l(() => [
- a(
- g,
- { modelValue: u(o).leader, 'onUpdate:modelValue': n[4] || (n[4] = (i) => (u(o).leader = i)) },
- null,
- 8,
- ['modelValue']
- )
- ]),
- _: 1
- },
- 8,
- ['label']
- ),
- a(
- c,
- {
- field: 'phone',
- label: d.$t('permission.org.phone'),
- rules: [
- { required: !0, message: '联系电话必填' },
- { maxLength: 50, message: '长度不超过50' }
- ]
- },
- {
- default: l(() => [
- a(
- g,
- { modelValue: u(o).phone, 'onUpdate:modelValue': n[5] || (n[5] = (i) => (u(o).phone = i)) },
- null,
- 8,
- ['modelValue']
- )
- ]),
- _: 1
- },
- 8,
- ['label']
- ),
- a(
- c,
- { field: 'address', label: d.$t('permission.org.address') },
- {
- default: l(() => [
- a(
- g,
- { modelValue: u(o).address, 'onUpdate:modelValue': n[6] || (n[6] = (i) => (u(o).address = i)) },
- null,
- 8,
- ['modelValue']
- )
- ]),
- _: 1
- },
- 8,
- ['label']
- ),
- a(c, null, {
- default: l(() => [a(D, null, { default: l(() => [E(d.$slots, 'actions')]), _: 3 })]),
- _: 3
- })
- ]),
- _: 3
- },
- 8,
- ['model']
- )
- );
- };
- }
- },
- V = '/api/dept';
- function ee(r) {
- return b({ url: `${V}/${r}`, method: 'get' });
- }
- function te(r) {
- return b({ url: `${V}/status`, method: 'put', data: r });
- }
- function ae(r) {
- return b({ url: `${V}/edit_dept`, method: 'put', data: r });
- }
- function se(r) {
- return b({ url: `${V}/dept_parent`, method: 'put', data: r });
- }
- function oe(r) {
- return b({ url: `${V}/add_dept`, method: 'post', data: r });
- }
- function ne(r) {
- return b({ url: `${V}/${r}`, method: 'delete' });
- }
- const re = { class: 'organization-container' },
- le = { class: 'left' },
- de = { class: 'right' },
- ie = {
- __name: 'index',
- setup(r) {
- const _ = S(!1),
- m = S(!0),
- I = S([]),
- o = { add_permission: 'system:dept:add', delete_permission: 'system:dept:delete' },
- e = G({ parentName: '', status: 0, deptName: '', leader: '', phone: '', address: '', orderNum: 0 }),
- d = async () => {
- const {
- code: t,
- data: { rows: s }
- } = await Y();
- t == 200 && (I.value = s);
- },
- n = async (t) => {
- const {
- data: { data: s }
- } = await ee(t);
- (e.deptId = t),
- (e.parentName = s.parentName),
- (e.status = s.status),
- (e.deptName = s.deptName),
- (e.leader = s.leader),
- (e.phone = s.phone),
- (e.address = s.address),
- (m.value = !0);
- },
- g = (t) => {
- (e.deptId = ''),
- (e.parentName = t.deptName),
- (e.parentId = t.deptId),
- (e.status = 0),
- (e.deptName = ''),
- (e.leader = ''),
- (e.phone = ''),
- (e.address = ''),
- (_.value = !0),
- (m.value = !1);
- },
- c = async ({ deptId: t }) => {
- const { code: s } = await ne(t);
- s === 200 && y.success({ title: '删除', content: '删除成功' }), d();
- },
- U = async (t) => {
- const s = { deptId: e.deptId[0], status: t },
- { code: f, msg: p } = await te(s);
- f === 200
- ? (y.success({ title: '状态更新', content: '状态更新成功' }), d())
- : (y.error({ title: '状态更新', content: p }), (e.status = '1'));
- },
- D = async () => {
- const t = { ...e, deptId: m.value && e.deptId ? e.deptId[0] : null },
- s = m.value ? ae : oe,
- { code: f } = await s(t);
- if (f === 200) {
- const p = m.value ? '编辑' : '新增';
- y.success({ title: `${p}用户`, content: `${p}成功` }), d(), (_.value = !1);
- }
- },
- k = () => {
- (e.deptId = null),
- (e.parentName = ''),
- (e.status = 0),
- (e.deptName = ''),
- (e.leader = ''),
- (e.phone = ''),
- (e.address = '');
- },
- i = () => {
- (m.value = !0), (_.value = !1);
- },
- z = async ({ dropNode: t, dragNode: s, dropPosition: f }) => {
- const p = I.value;
- se({ orderNum: '0', parentId: t.deptId, deptId: s.deptId });
- const N = (h, v, C) => {
- h.some((w, L, R) => (w.deptId === v ? (C(w, L, R), !0) : w.children ? N(w.children, v, C) : !1));
- };
- N(p, s.deptId, (h, v, C) => {
- C.splice(v, 1);
- }),
- f === 0
- ? N(p, t.deptId, (h) => {
- (h.children = h.children || []), h.children.push(s);
- })
- : N(p, t.deptId, (h, v, C) => {
- C.splice(f < 0 ? v : v + 1, 0, s);
- });
- };
- return (
- H(() => {
- J('system:dept:list') ? d() : y.error({ title: '权限不足', content: '抱歉,您没有权限查看该页面' });
- }),
- (t, s) => {
- const f = $('a-button'),
- p = $('a-card'),
- N = K('hasPerm');
- return (
- B(),
- W('div', re, [
- F('div', le, [
- a(
- Q,
- {
- treeData: I.value,
- title: t.$t('permission.org.organization'),
- showLock: !0,
- fieldNames: { key: 'deptId', title: 'deptName', children: 'children' },
- permission: o,
- onNodeClick: n,
- onAddBtnClick: g,
- onDeleteBtnClick: c,
- onDrop: z
- },
- null,
- 8,
- ['treeData', 'title']
- )
- ]),
- F('div', de, [
- a(
- p,
- { title: t.$t('permission.org.details'), style: { height: '100%' } },
- {
- default: l(() => [
- a(
- q,
- { org_form: e, onStatusChange: U, onSave: D, onReset: k },
- {
- actions: l(() => [
- X(
- (B(),
- P(f, { onClick: D }, { default: l(() => [O(T(t.$t('permission.org.save')), 1)]), _: 1 })),
- [[N, 'system:dept:edit']]
- ),
- a(f, { onClick: k }, { default: l(() => [O(T(t.$t('permission.org.reset')), 1)]), _: 1 })
- ]),
- _: 1
- },
- 8,
- ['org_form']
- )
- ]),
- _: 1
- },
- 8,
- ['title']
- )
- ]),
- a(
- A,
- { visible: _.value, onOk: D, onCancel: i, title: t.$t('permission.org.add') },
- { default: l(() => [a(q, { org_form: e }, null, 8, ['org_form'])]), _: 1 },
- 8,
- ['visible', 'title']
- )
- ])
- );
- }
- );
- }
- },
- ue = Z(ie, [['__scopeId', 'data-v-5fddc97d']]),
- he = {
- __name: 'PermissionOrganization',
- setup(r) {
- return (_, m) => (B(), P(j, null, { default: l(() => [a(M, { current_label: '机构' }), a(ue)]), _: 1 }));
- }
- };
- export { he as default };
|