first
|
|
@ -0,0 +1,5 @@
|
|||
# 使用【演示环境】接口地址
|
||||
#VITE_API_URL=https://demo.maku.net/maku-boot-server
|
||||
|
||||
# 使用【本地环境]接口地址
|
||||
VITE_API_URL=http://localhost:8080
|
||||
|
|
@ -0,0 +1 @@
|
|||
VITE_API_URL=http://localhost:8080
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
logs
|
||||
*.log
|
||||
*.sh
|
||||
node_modules
|
||||
.DS_Store
|
||||
lib
|
||||
*.md
|
||||
*.scss
|
||||
*.woff
|
||||
*.ttf
|
||||
.vscode
|
||||
.idea
|
||||
dist
|
||||
mock
|
||||
public
|
||||
bin
|
||||
build
|
||||
config
|
||||
index.html
|
||||
components.d.ts
|
||||
element.d.ts
|
||||
src/assets
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
extends: ['plugin:vue/vue3-recommended', 'plugin:prettier/recommended'],
|
||||
parser: 'vue-eslint-parser',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser',
|
||||
ecmaVersion: 2022,
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
curly: 'error', // 控制语句需要大括号
|
||||
'vue/multi-word-component-names': 'off'
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
qodana.yaml
|
||||
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
coverage
|
||||
*.local
|
||||
|
||||
/cypress/videos/
|
||||
/cypress/screenshots/
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
// 参考:https://prettier.io/docs/en/options.html
|
||||
module.exports = {
|
||||
// 超过指定值换行
|
||||
printWidth: 150,
|
||||
// 制表符宽度
|
||||
tabWidth: 2,
|
||||
// 使用制表符缩进
|
||||
useTabs: true,
|
||||
// 句尾不使用分号
|
||||
semi: false,
|
||||
// 使用单引号
|
||||
singleQuote: true,
|
||||
// 在 JSX 文件中使用单引号代替双引号
|
||||
jsxSingleQuote: true,
|
||||
// 在对象或数组最后一个元素后面是否加逗号,可选值"[none:不追加 | es5:追加]
|
||||
trailingComma: 'none',
|
||||
// 在对象,数组括号与代码之间加空格 "{ foo: bar }"
|
||||
bracketSpacing: true,
|
||||
// 将多行 JSX 元素的 > 放置于最后一行的末尾,而非换行
|
||||
jsxBracketSameLine: true,
|
||||
//(x) => {} 箭头函数参数只有一个时是否要有小括号,可选值"[always:(x) => x | avoid:x => x]
|
||||
arrowParens: 'avoid',
|
||||
// 使用默认的折行标准,可选值"[always|never|preserve]"
|
||||
proseWrap: 'preserve',
|
||||
// 指定HTML文件的全局空格敏感度,可选值"[css|strict|ignore]"
|
||||
htmlWhitespaceSensitivity: 'css',
|
||||
// 结尾时换行符,默认值lf,可选值"[auto|lf|crlf|cr]"
|
||||
endOfLine: 'auto'
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["johnsoncodehk.volar", "johnsoncodehk.vscode-typescript-vue-plugin"]
|
||||
}
|
||||
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
## 介绍
|
||||
- 基于Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、i18n、Vite等开发的后台管理,使用门槛极低。
|
||||
- 目前已实现maku-admin后端接口的有:【maku-boot】 和 【maku-cloud】 2个后端开源项目。
|
||||
- 开发文档:https://maku.net/docs/maku-admin
|
||||
- 官网地址:https://maku.net
|
||||
|
||||
## maku-boot | 单体低代码开发平台
|
||||
- Gitee仓库:https://gitee.com/makunet/maku-boot
|
||||
- Github仓库:https://github.com/makunet/maku-boot
|
||||
- 演示环境:https://demo.maku.net/maku-boot
|
||||
|
||||
|
||||
## maku-cloud | 微服务低代码开发平台
|
||||
- Gitee仓库:https://gitee.com/makunet/maku-cloud
|
||||
- Github仓库:https://github.com/makunet/maku-cloud
|
||||
- 演示环境:https://demo.maku.net/maku-cloud
|
||||
|
||||
|
||||
## 安装
|
||||
注意:需使用 nodejs 长期维护版本,如:[18.x、20.x],能保证项目的稳定运行。
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone https://gitee.com/makunet/maku-admin.git
|
||||
|
||||
# 进入项目
|
||||
cd maku-admin
|
||||
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 运行项目
|
||||
npm run dev
|
||||
|
||||
# 打包发布
|
||||
npm run build
|
||||
```
|
||||
|
||||
|
||||
## 微信交流群
|
||||
为了更好的交流,我们新提供了微信交流群,需扫描下面的二维码,关注公众号,回复【加群】,根据提示信息,作者会拉你进群的,感谢配合!
|
||||
|
||||

|
||||
|
||||
|
||||
## 开源汇总
|
||||
- 低代码开发平台(单体版):https://gitee.com/makunet/maku-boot
|
||||
- 低代码开发平台(微服务):https://gitee.com/makunet/maku-cloud
|
||||
- 超好用的代码生成器:https://gitee.com/makunet/maku-generator
|
||||
- Vue3.x 后台管理UI:https://gitee.com/makunet/maku-admin
|
||||
- Vue3.x 表单设计器:https://gitee.com/makunet/maku-form-design
|
||||
|
||||
|
||||
|
||||
## 支持
|
||||
如果觉得框架还不错,或者已经在使用了,希望你可以去 [Github](https://github.com/makunet/maku-admin) 或 [Gitee](https://gitee.com/makunet/maku-admin) 帮作者点个 ⭐ Star,这将是对作者极大的鼓励与支持。
|
||||
|
||||
## 效果图
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"name": "maku-admin",
|
||||
"version": "4.3.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint --fix --ext .vue,.jsx,.ts,.tsx ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "2.3.1",
|
||||
"@kangc/v-md-editor": "2.3.17",
|
||||
"@vueuse/core": "10.9.0",
|
||||
"@wangeditor/editor": "5.1.23",
|
||||
"@wangeditor/editor-for-vue": "5.1.12",
|
||||
"axios": "1.6.8",
|
||||
"cropperjs": "1.6.1",
|
||||
"echarts": "5.5.0",
|
||||
"element-plus": "2.7.6",
|
||||
"maku-form-design": "1.1.0",
|
||||
"mitt": "3.0.1",
|
||||
"nprogress": "0.2.0",
|
||||
"pinia": "2.1.7",
|
||||
"print-js": "1.6.0",
|
||||
"qrcode.vue": "3.4.1",
|
||||
"qs": "6.12.0",
|
||||
"sm-crypto": "^0.3.13",
|
||||
"sortablejs": "^1.15.2",
|
||||
"vue": "3.4.30",
|
||||
"vue-i18n": "9.10.2",
|
||||
"vue-router": "4.3.0",
|
||||
"vxe-table": "4.5.21",
|
||||
"xe-utils": "3.5.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "7.24.0",
|
||||
"@types/node": "20.11.28",
|
||||
"@types/nprogress": "0.2.3",
|
||||
"@types/qs": "6.9.12",
|
||||
"@types/sm-crypto": "0.3.4",
|
||||
"@types/sortablejs": "1.15.8",
|
||||
"@vitejs/plugin-vue": "5.0.5",
|
||||
"@vue/compiler-sfc": "3.4.30",
|
||||
"@vue/eslint-config-prettier": "9.0.0",
|
||||
"@vue/eslint-config-typescript": "13.0.0",
|
||||
"@vue/tsconfig": "0.5.1",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-plugin-vue": "9.23.0",
|
||||
"prettier": "3.2.5",
|
||||
"sass": "1.72.0",
|
||||
"typescript": "5.4.2",
|
||||
"vite": "5.3.1",
|
||||
"vite-plugin-svg-icons": "2.0.1",
|
||||
"vite-plugin-vue-setup-extend": "0.4.0",
|
||||
"vue-tsc": "2.0.22"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 282 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<el-config-provider :locale="locale" :size="size">
|
||||
<router-view />
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted } from 'vue'
|
||||
import { RouterView } from 'vue-router'
|
||||
import { useTitle } from '@vueuse/core'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { messages } from '@/i18n'
|
||||
import { handleThemeStyle } from '@/utils/theme'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const { t } = useI18n()
|
||||
const locale = computed(() => messages[appStore.language].el)
|
||||
const size = computed(() => appStore.componentSize)
|
||||
|
||||
// 设置标题
|
||||
useTitle(t('app.title'))
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
handleThemeStyle(appStore.theme)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useCaptchaEnabledApi = () => {
|
||||
return service.get('/sys/auth/captcha/enabled')
|
||||
}
|
||||
|
||||
export const useCaptchaApi = () => {
|
||||
return service.get('/sys/auth/captcha')
|
||||
}
|
||||
|
||||
export const useSendCodeApi = (mobile: string) => {
|
||||
return service.post('/sys/auth/send/code?mobile=' + mobile)
|
||||
}
|
||||
|
||||
export const useAccountLoginApi = (data: any) => {
|
||||
return service.post('/sys/auth/login', data)
|
||||
}
|
||||
|
||||
export const useMobileLoginApi = (data: any) => {
|
||||
return service.post('/sys/auth/mobile', data)
|
||||
}
|
||||
|
||||
export const useThirdLoginApi = (data: any) => {
|
||||
return service.post('/sys/auth/third', data)
|
||||
}
|
||||
|
||||
export const useLogoutApi = () => {
|
||||
return service.post('/sys/auth/logout')
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useDataApi = async (url: string) => {
|
||||
const { data } = await service.get(url)
|
||||
|
||||
return data
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useUserApi = (id: number) => {
|
||||
return service.get('/member/user/' + id)
|
||||
}
|
||||
|
||||
export const useUserSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/member/user', dataForm)
|
||||
} else {
|
||||
return service.post('/member/user', dataForm)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useCacheInfoApi = () => {
|
||||
return service.get('/monitor/cache/info')
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useServerInfoApi = () => {
|
||||
return service.get('/monitor/server/info')
|
||||
}
|
||||
|
||||
export const useCpuInfoApi = () => {
|
||||
return service.get('/monitor/server/cpu')
|
||||
}
|
||||
|
||||
export const useMemInfoApi = () => {
|
||||
return service.get('/monitor/server/mem')
|
||||
}
|
||||
|
||||
export const useJvmInfoApi = () => {
|
||||
return service.get('/monitor/server/jvm')
|
||||
}
|
||||
|
||||
export const useSysInfoApi = () => {
|
||||
return service.get('/monitor/server/sys')
|
||||
}
|
||||
|
||||
export const useDiskInfoApi = () => {
|
||||
return service.get('/monitor/server/disk')
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useMonitorUserLogoutApi = (accessToken: string) => {
|
||||
return service.delete('/monitor/user/' + accessToken)
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useScheduleApi = (id: Number) => {
|
||||
return service.get('/schedule/' + id)
|
||||
}
|
||||
|
||||
export const useScheduleSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/schedule', dataForm)
|
||||
} else {
|
||||
return service.post('/schedule', dataForm)
|
||||
}
|
||||
}
|
||||
|
||||
export const useScheduleRunApi = (dataForm: any) => {
|
||||
return service.put('/schedule/run', dataForm)
|
||||
}
|
||||
|
||||
export const useScheduleStatusApi = (dataForm: any) => {
|
||||
return service.put('/schedule/change-status', dataForm)
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useAttachmentSubmitApi = (dataForm: any) => {
|
||||
return service.post('/sys/attachment', dataForm)
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useDictTypeAllApi = () => {
|
||||
return service.get('/sys/dict/type/all')
|
||||
}
|
||||
|
||||
export const useDictTypeApi = (id: Number) => {
|
||||
return service.get('/sys/dict/type/' + id)
|
||||
}
|
||||
|
||||
export const useDictTypeListApi = (pid: Number) => {
|
||||
return service.get('/sys/dict/type/list?pid=' + pid)
|
||||
}
|
||||
|
||||
export const useDictTypeSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/dict/type', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/dict/type', dataForm)
|
||||
}
|
||||
}
|
||||
|
||||
export const useDictDataApi = (id: Number) => {
|
||||
return service.get('/sys/dict/data/' + id)
|
||||
}
|
||||
|
||||
export const useDictDataSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/dict/data', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/dict/data', dataForm)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import cache from '@/utils/cache'
|
||||
import constant from '@/utils/constant'
|
||||
|
||||
// 文件导出
|
||||
export const useLogLoginExportApi = () => {
|
||||
location.href = constant.apiUrl + '/sys/log/login/export?access_token=' + cache.getToken()
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useMailConfigApi = (id: number) => {
|
||||
return service.get('/sys/mail/config/' + id)
|
||||
}
|
||||
|
||||
export const useMailConfigSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/mail/config', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/mail/config', dataForm)
|
||||
}
|
||||
}
|
||||
|
||||
export const useMailSendApi = (dataForm: any) => {
|
||||
return service.post('/sys/mail/config/send', dataForm)
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useMenuNavApi = () => {
|
||||
return service.get('/sys/menu/nav')
|
||||
}
|
||||
|
||||
export const useAuthorityListApi = () => {
|
||||
return service.get('/sys/menu/authority')
|
||||
}
|
||||
|
||||
export const useMenuListApi = (type: Number) => {
|
||||
// 菜单类型 0:菜单 1:按钮 2:接口
|
||||
const menuType = type === 2 ? 2 : 0
|
||||
|
||||
return service.get('/sys/menu/list?type=' + menuType)
|
||||
}
|
||||
|
||||
export const useMenuApi = (id: Number) => {
|
||||
return service.get('/sys/menu/' + id)
|
||||
}
|
||||
|
||||
export const useMenuSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/menu', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/menu', dataForm)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useOrgListApi = () => {
|
||||
return service.get('/sys/org/list')
|
||||
}
|
||||
|
||||
export const useOrgApi = (id: Number) => {
|
||||
return service.get('/sys/org/' + id)
|
||||
}
|
||||
|
||||
export const useOrgNameListApi = (idList: number[]) => {
|
||||
return service.post('/sys/org/nameList', idList)
|
||||
}
|
||||
|
||||
export const useOrgSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/org', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/org', dataForm)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useParamsApi = (id: number) => {
|
||||
return service.get('/sys/params/' + id)
|
||||
}
|
||||
|
||||
export const useParamsSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/params', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/params', dataForm)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const usePostApi = (id: Number) => {
|
||||
return service.get('/sys/post/' + id)
|
||||
}
|
||||
|
||||
export const usePostNameListApi = (idList: number[]) => {
|
||||
return service.post('/sys/post/nameList', idList)
|
||||
}
|
||||
|
||||
export const usePostSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/post', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/post', dataForm)
|
||||
}
|
||||
}
|
||||
|
||||
export const usePostListApi = () => {
|
||||
return service.get('/sys/post/list')
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useRoleMenuApi = () => {
|
||||
return service.get('/sys/role/menu')
|
||||
}
|
||||
|
||||
export const useRoleApi = (id: number) => {
|
||||
return service.get('/sys/role/' + id)
|
||||
}
|
||||
|
||||
export const useRoleListApi = () => {
|
||||
return service.get('/sys/role/list')
|
||||
}
|
||||
|
||||
export const useRoleNameListApi = (idList: number[]) => {
|
||||
return service.post('/sys/role/nameList', idList)
|
||||
}
|
||||
|
||||
export const useRoleSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/role', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/role', dataForm)
|
||||
}
|
||||
}
|
||||
|
||||
export const useRoleDataScopeSubmitApi = (dataForm: any) => {
|
||||
return service.put('/sys/role/data-scope', dataForm)
|
||||
}
|
||||
|
||||
export const useRoleUserSubmitApi = (roleId: number, dataForm: any) => {
|
||||
return service.post('/sys/role/user/' + roleId, dataForm)
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useSmsConfigApi = (id: Number) => {
|
||||
return service.get('/sys/sms/config/' + id)
|
||||
}
|
||||
|
||||
export const useSmsConfigSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/sms/config', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/sms/config', dataForm)
|
||||
}
|
||||
}
|
||||
|
||||
export const useSmsSendApi = (dataForm: any) => {
|
||||
return service.post('/message/sms/config/send', dataForm)
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useThirdListApi = () => {
|
||||
return service.get('/sys/third/list')
|
||||
}
|
||||
|
||||
export const useThirdBindApi = (data: any) => {
|
||||
return service.post('/sys/third/bind', data)
|
||||
}
|
||||
|
||||
export const useThirdUnBindApi = (openType: string) => {
|
||||
return service.put('/sys/third/unbind/' + openType)
|
||||
}
|
||||
|
||||
export const useThirdConfigApi = (id: number) => {
|
||||
return service.get('/sys/third/config/' + id)
|
||||
}
|
||||
|
||||
export const useThirdConfigSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/third/config', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/third/config', dataForm)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import service from '@/utils/request'
|
||||
import constant from '@/utils/constant'
|
||||
import cache from '@/utils/cache'
|
||||
|
||||
export const uploadImg = (params: FormData) => {
|
||||
return service.postForm(constant.uploadUrl + '?access_token=' + cache.getToken(), params)
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
export const useUserInfoApi = () => {
|
||||
return service.get('/sys/user/info')
|
||||
}
|
||||
|
||||
export const useUserInfoSubmitApi = (dataForm: any) => {
|
||||
return service.put('/sys/user/info', dataForm)
|
||||
}
|
||||
|
||||
export const useUserAvatarApi = (dataForm: any) => {
|
||||
return service.put('/sys/user/avatar', dataForm)
|
||||
}
|
||||
|
||||
export const updatePasswordApi = (data: any) => {
|
||||
return service.put('/sys/user/password', data)
|
||||
}
|
||||
|
||||
export const useUserApi = (id: number) => {
|
||||
return service.get('/sys/user/' + id)
|
||||
}
|
||||
|
||||
export const useRealNameListApi = (idList: number[]) => {
|
||||
return service.post('/sys/user/nameList', idList)
|
||||
}
|
||||
|
||||
export const useUserSubmitApi = (dataForm: any) => {
|
||||
if (dataForm.id) {
|
||||
return service.put('/sys/user', dataForm)
|
||||
} else {
|
||||
return service.post('/sys/user', dataForm)
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
|
@ -0,0 +1,59 @@
|
|||
import type { App, Plugin } from 'vue'
|
||||
import MaDictColumn from '@/components/ma-dict/ma-dict-column/index.vue'
|
||||
import MaDictLabel from '@/components/ma-dict/ma-dict-label/index.vue'
|
||||
import MaDictRadio from '@/components/ma-dict/ma-dict-radio/index.vue'
|
||||
import MaDictSelect from '@/components/ma-dict/ma-dict-select/index.vue'
|
||||
import MaDictTreeSelect from '@/components/ma-dict/ma-dict-tree-select/index.vue'
|
||||
import MaDataColumn from '@/components/ma-data/ma-data-column/index.vue'
|
||||
import MaDataLabel from '@/components/ma-data/ma-data-label/index.vue'
|
||||
import MaDataSelect from '@/components/ma-data/ma-data-select/index.vue'
|
||||
import MaDataTable from '@/components/ma-data/ma-data-table/index.vue'
|
||||
import MaDataTreeSelect from '@/components/ma-data/ma-data-tree-select/index.vue'
|
||||
|
||||
import MaIcon from '@/components/ma-icon/index.vue'
|
||||
import MaEditor from '@/components/ma-editor/index.vue'
|
||||
import MaMarkdown from '@/components/ma-markdown/index.vue'
|
||||
import MaAddress from '@/components/ma-address/index.vue'
|
||||
import MaUserInput from '@/components/ma-user/ma-user-input/index.vue'
|
||||
import MaUserDialog from '@/components/ma-user/ma-user-dialog/index.vue'
|
||||
import MaOrgSelect from '@/components/ma-org/ma-org-select/index.vue'
|
||||
import MaOrgInput from '@/components/ma-org/ma-org-input/index.vue'
|
||||
import MaRoleInput from '@/components/ma-role-input/index.vue'
|
||||
import MaPostInput from '@/components/ma-post-input/index.vue'
|
||||
import MaUploadImage from '@/components/ma-upload/ma-upload-image/index.vue'
|
||||
import MaUploadImages from '@/components/ma-upload/ma-upload-images/index.vue'
|
||||
|
||||
const components = [
|
||||
MaEditor,
|
||||
MaMarkdown,
|
||||
MaAddress,
|
||||
MaIcon,
|
||||
MaDictLabel,
|
||||
MaDictColumn,
|
||||
MaDictRadio,
|
||||
MaDictSelect,
|
||||
MaDictTreeSelect,
|
||||
MaDataColumn,
|
||||
MaDataLabel,
|
||||
MaDataSelect,
|
||||
MaDataTreeSelect,
|
||||
MaDataTable,
|
||||
MaUserInput,
|
||||
MaUserDialog,
|
||||
MaOrgSelect,
|
||||
MaOrgInput,
|
||||
MaRoleInput,
|
||||
MaPostInput,
|
||||
MaUploadImage,
|
||||
MaUploadImages
|
||||
]
|
||||
|
||||
const MaComponent: Plugin = {
|
||||
install(Vue: App) {
|
||||
components.forEach((component: any) => {
|
||||
Vue.component(component.name, component)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default MaComponent
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import pca from './pca.json'
|
||||
|
||||
interface DataItem {
|
||||
value: string
|
||||
label: string
|
||||
children?: DataItem[]
|
||||
}
|
||||
|
||||
const pcaData: DataItem[] = Object.entries(pca).map(([province, cities]) => ({
|
||||
label: province,
|
||||
value: province,
|
||||
children: Object.entries(cities).map(([city, areas]) => ({
|
||||
label: city,
|
||||
value: city,
|
||||
children: areas.map((area: string) => ({
|
||||
label: area,
|
||||
value: area
|
||||
}))
|
||||
}))
|
||||
}))
|
||||
|
||||
export { pcaData }
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<template>
|
||||
<el-cascader
|
||||
v-model="data"
|
||||
:options="pcaData"
|
||||
:style="{ width: props.width }"
|
||||
:placeholder="props.placeholder"
|
||||
:clearable="props.clearable"
|
||||
:disabled="props.disabled"
|
||||
@change="handleChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="MaAddress">
|
||||
import { pcaData } from './index'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [String, Number, Boolean, Date, Array],
|
||||
default: ''
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const data = computed(() => {
|
||||
if (Array.isArray(props.modelValue)) {
|
||||
return []
|
||||
}
|
||||
|
||||
if (props.modelValue) {
|
||||
return (props.modelValue as string).split(',')
|
||||
}
|
||||
|
||||
return []
|
||||
})
|
||||
|
||||
// 编辑器change事件触发
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const handleChange = (value: any) => {
|
||||
if (value) {
|
||||
emit('update:modelValue', value.join(','))
|
||||
} else {
|
||||
emit('update:modelValue', '')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<template>
|
||||
<el-table-column
|
||||
:prop="prop"
|
||||
:label="label"
|
||||
:header-align="headerAlign"
|
||||
:align="align"
|
||||
:width="width"
|
||||
:min-width="minWidth"
|
||||
:class-name="className"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ getDataLabel(scope.row[props.prop]) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDataColumn">
|
||||
import { PropType, ref } from 'vue'
|
||||
|
||||
interface Prop {
|
||||
value: any
|
||||
label: string
|
||||
}
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array as PropType<any[]>,
|
||||
default: () => []
|
||||
},
|
||||
props: {
|
||||
type: Object as PropType<Prop>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
value: 'id',
|
||||
label: 'name'
|
||||
})
|
||||
},
|
||||
prop: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
headerAlign: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => 'center'
|
||||
},
|
||||
align: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => 'center'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
},
|
||||
minWidth: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const getDataLabel = (value: any) => {
|
||||
const val = props.data.find((item: any) => item[props.props.value] == value)
|
||||
if (val) {
|
||||
return val[props.props.label]
|
||||
}
|
||||
return ''
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<span>{{ label }}</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDataLabel">
|
||||
import { PropType, ref } from 'vue'
|
||||
import { useDataApi } from '@/api/common'
|
||||
|
||||
interface Prop {
|
||||
value: any
|
||||
label: string
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array as PropType<any[]>,
|
||||
default: () => []
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
},
|
||||
props: {
|
||||
type: Object as PropType<Prop>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
value: 'id',
|
||||
label: 'name'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const label = ref()
|
||||
|
||||
const getDataList = async () => {
|
||||
let data = props.data
|
||||
if (data.length === 0) {
|
||||
if (props.url.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
data = await useDataApi(props.url)
|
||||
}
|
||||
|
||||
const val = data.find((item: any) => item[props.props.value] == props.value)
|
||||
if (val) {
|
||||
label.value = val[props.props.label]
|
||||
}
|
||||
}
|
||||
|
||||
getDataList()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<template>
|
||||
<el-select v-model="model" :placeholder :disabled :clearable style="width: 100%; min-width: 200px">
|
||||
<el-option v-for="item in dataList" :key="item[props.value]" :label="item[props.label]" :value="item[props.value]"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDataSelect">
|
||||
import { PropType, ref, watch } from 'vue'
|
||||
import { useDataApi } from '@/api/common'
|
||||
|
||||
interface Prop {
|
||||
value: any
|
||||
label: string
|
||||
}
|
||||
const prop = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
props: {
|
||||
type: Object as PropType<Prop>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
value: 'id',
|
||||
label: 'name'
|
||||
})
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => prop.data,
|
||||
val => {
|
||||
dataList.value = val
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
const model = defineModel<number | string>()
|
||||
|
||||
// 获取列表
|
||||
const dataList = ref<any[]>()
|
||||
const getDataList = async () => {
|
||||
if (prop.url.length === 0) {
|
||||
return
|
||||
}
|
||||
dataList.value = await useDataApi(prop.url)
|
||||
}
|
||||
|
||||
getDataList()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
<template>
|
||||
<div class="ma-data-table">
|
||||
<el-dialog :model-value="visible" :title :close-on-click-modal="false" :width="800" draggable @close="handleClose">
|
||||
<el-form v-if="queryParams.length > 0" :inline="true" :model="state.queryForm" style="margin-bottom: 15px">
|
||||
<el-form-item v-for="(query, index) in queryParams" :key="index">
|
||||
<el-input v-model="state.queryForm[query.field]" :placeholder="query.label"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList()">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
v-loading="state.dataListLoading"
|
||||
:data="state.dataList"
|
||||
border
|
||||
style="width: 100%"
|
||||
highlight-current-row
|
||||
show-overflow-tooltip
|
||||
:row-key="rowKey"
|
||||
@selection-change="selectionChangeHandle"
|
||||
@current-change="currentChange"
|
||||
>
|
||||
<el-table-column v-if="multiple" type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column v-for="(column, index) in columns" :key="index" :prop="column.field" :label="column.label"></el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-if="page"
|
||||
:current-page="state.page"
|
||||
:page-sizes="state.pageSizes"
|
||||
:page-size="state.limit"
|
||||
:total="state.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
>
|
||||
</el-pagination>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="submitHandle()">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDataTable">
|
||||
import { ref, reactive, PropType } from 'vue'
|
||||
import { IHooksOptions } from '@/hooks/interface'
|
||||
import { useCrud } from '@/hooks'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
interface Column {
|
||||
field: string
|
||||
label: string
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
columns: {
|
||||
type: Array as PropType<Column[]>,
|
||||
required: true
|
||||
},
|
||||
queryParams: {
|
||||
type: Array as PropType<Column[]>,
|
||||
required: false,
|
||||
default: () => []
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
rowKey: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
page: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const state: IHooksOptions = reactive({
|
||||
dataListUrl: props.url,
|
||||
queryForm: {},
|
||||
isPage: props.page
|
||||
})
|
||||
|
||||
const currentRow = ref()
|
||||
const currentChange = (row: any) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
const emit = defineEmits(['select', 'update:visible'])
|
||||
const submitHandle = () => {
|
||||
// 多选
|
||||
if (props.multiple) {
|
||||
const dataList = state.dataListSelections ? state.dataListSelections : []
|
||||
if (dataList.length === 0) {
|
||||
ElMessage.warning('请选择记录')
|
||||
return
|
||||
}
|
||||
|
||||
handleClose()
|
||||
emit('select', dataList)
|
||||
return
|
||||
}
|
||||
|
||||
// 单选
|
||||
if (!currentRow.value) {
|
||||
ElMessage.warning('请选择记录')
|
||||
return
|
||||
}
|
||||
handleClose()
|
||||
emit('select', [currentRow.value])
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('update:visible', false)
|
||||
}
|
||||
|
||||
const { getDataList, selectionChangeHandle, sizeChangeHandle, currentChangeHandle } = useCrud(state)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ma-data-table {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<template>
|
||||
<el-tree-select
|
||||
v-model="model"
|
||||
:data="dataList"
|
||||
value-key="id"
|
||||
check-strictly
|
||||
:render-after-expand="false"
|
||||
:props="props"
|
||||
style="width: 100%"
|
||||
:clearable="clearable"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDataTreeSelect">
|
||||
import { PropType, ref, watch } from 'vue'
|
||||
import { useDataApi } from '@/api/common'
|
||||
import { treeDataTranslate } from '@/utils/tool'
|
||||
interface Prop {
|
||||
label: string
|
||||
children: string
|
||||
}
|
||||
const prop = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
props: {
|
||||
type: Object as PropType<Prop>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
label: 'name',
|
||||
children: 'children'
|
||||
})
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => prop.data,
|
||||
val => {
|
||||
dataList.value = val
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
const model = defineModel<number | string>()
|
||||
|
||||
// 获取列表
|
||||
const dataList = ref<any[]>()
|
||||
const getDataList = async () => {
|
||||
if (prop.url.length === 0) {
|
||||
return
|
||||
}
|
||||
const data = await useDataApi(prop.url)
|
||||
dataList.value = treeDataTranslate(data)
|
||||
}
|
||||
|
||||
getDataList()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<template>
|
||||
<el-table-column
|
||||
:prop="prop"
|
||||
:label="label"
|
||||
:header-align="headerAlign"
|
||||
:align="align"
|
||||
:width="width"
|
||||
:min-width="minWidth"
|
||||
:class-name="className"
|
||||
>
|
||||
<template #default="scope">
|
||||
<ma-dict-label :dict-type="props.dictType" :dict-value="scope.row[props.prop]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDictColumn">
|
||||
const props = defineProps({
|
||||
prop: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dictType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
headerAlign: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => 'center'
|
||||
},
|
||||
align: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => 'center'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
},
|
||||
minWidth: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<span v-html="getDictLabelList(dictType, dictValue)"></span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDictLabel">
|
||||
import { getDictLabelList } from '@/utils/tool'
|
||||
|
||||
defineProps({
|
||||
dictType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dictValue: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<el-radio-group v-model="modelAsString" :disabled="props.disabled">
|
||||
<el-radio v-for="data in dataList" :key="data.dictValue" :value="data.dictValue">{{ data.dictLabel }}</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDictRadio">
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import { getDictDataList } from '@/utils/tool'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const props = defineProps({
|
||||
dictType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<number | string>()
|
||||
|
||||
const modelAsString = computed({
|
||||
get() {
|
||||
return model.value + ''
|
||||
},
|
||||
set(value) {
|
||||
model.value = value
|
||||
}
|
||||
})
|
||||
|
||||
const dataList = getDictDataList(appStore.dictList, props.dictType)
|
||||
</script>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<template>
|
||||
<el-select v-model="modelAsString" :placeholder="placeholder" :clearable="clearable">
|
||||
<el-option v-for="data in dataList" :key="data.dictValue" :label="data.dictLabel" :value="data.dictValue">{{ data.dictLabel }}</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDictSelect">
|
||||
import { getDictDataList } from '@/utils/tool'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const props = defineProps({
|
||||
dictType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<number | string>()
|
||||
const modelAsString = computed({
|
||||
get() {
|
||||
return model.value != undefined ? model.value.toString() : ''
|
||||
},
|
||||
set(value) {
|
||||
model.value = value
|
||||
}
|
||||
})
|
||||
|
||||
const dataList = getDictDataList(appStore.dictList, props.dictType)
|
||||
</script>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<template>
|
||||
<el-tree-select
|
||||
v-model="modelAsString"
|
||||
:data="dataList"
|
||||
value-key="dictValue"
|
||||
check-strictly
|
||||
:render-after-expand="false"
|
||||
:props="{
|
||||
label: 'dictLabel',
|
||||
children: 'children'
|
||||
}"
|
||||
style="width: 100%"
|
||||
:clearable="clearable"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaDictTreeSelect">
|
||||
import { getDictDataList, treeDataTranslate } from '@/utils/tool'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const prop = defineProps({
|
||||
dictType: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<number | string>()
|
||||
const modelAsString = computed({
|
||||
get() {
|
||||
return model.value != undefined ? model.value.toString() : ''
|
||||
},
|
||||
set(value) {
|
||||
model.value = value
|
||||
}
|
||||
})
|
||||
|
||||
const dictDataList = getDictDataList(appStore.dictList, prop.dictType)
|
||||
const dataList = treeDataTranslate(dictDataList, 'dictValue')
|
||||
</script>
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<template>
|
||||
<div style="border: 1px solid #ccc; z-index: 100">
|
||||
<!-- 工具栏 -->
|
||||
<Toolbar :editor="editorRef" :mode="mode" style="border-bottom: 1px solid #ccc" />
|
||||
<!-- 编辑器 -->
|
||||
<Editor
|
||||
:model-value="modelValue"
|
||||
:style="style"
|
||||
:disabled="disabled"
|
||||
:default-config="editorConfig"
|
||||
:mode="mode"
|
||||
@on-created="handleCreated"
|
||||
@on-change="handleChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="MaEditor">
|
||||
import '@wangeditor/editor/dist/css/style.css'
|
||||
import { onBeforeUnmount, shallowRef } from 'vue'
|
||||
import constant from '@/utils/constant'
|
||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||
import { IDomEditor, IEditorConfig } from '@wangeditor/editor'
|
||||
import cache from '@/utils/cache'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'default' // 可选值:[default | simple]
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
style: {
|
||||
type: String,
|
||||
default: 'height: 400px;'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
// 编辑器实例,必须用 shallowRef
|
||||
const editorRef = shallowRef()
|
||||
|
||||
type InsertFnType = (url: string, alt: string, href: string) => void
|
||||
|
||||
// 编辑器配置
|
||||
const editorConfig: Partial<IEditorConfig> = {
|
||||
placeholder: props.placeholder,
|
||||
readOnly: props.disabled,
|
||||
MENU_CONF: {
|
||||
uploadImage: {
|
||||
server: constant.uploadUrl + '?access_token=' + cache.getToken(),
|
||||
fieldName: 'file',
|
||||
// 自定义插入图片
|
||||
customInsert(res: any, insertFn: InsertFnType) {
|
||||
// res 即服务端的返回结果
|
||||
// 从 res 中找到 url alt href ,然后插图图片
|
||||
insertFn(res.data.url, res.data.name, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 组件销毁时,也及时销毁编辑器
|
||||
onBeforeUnmount(() => {
|
||||
const editor = editorRef.value
|
||||
if (editor == null) {
|
||||
return
|
||||
}
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
const handleCreated = (editor: IDomEditor) => {
|
||||
editorRef.value = editor
|
||||
}
|
||||
|
||||
// 编辑器change事件触发
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const handleChange = (editor: IDomEditor) => {
|
||||
emit('update:modelValue', editor.getHtml())
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
.icon-box {
|
||||
width: 100%;
|
||||
.el-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
:deep(.el-dialog__body) {
|
||||
padding: 25px 20px 20px;
|
||||
.el-input {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.icon-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, 115px);
|
||||
justify-content: space-evenly;
|
||||
max-height: 70vh;
|
||||
.icon-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 42px;
|
||||
padding: 20px 30px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
&:hover {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
span {
|
||||
margin-top: 5px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<template>
|
||||
<div class="icon-box">
|
||||
<el-input ref="inputRef" v-model="model" v-bind="$attrs" :placeholder="placeholder" :clearable="clearable" @clear="clearIcon" @click="openDialog">
|
||||
<template #append>
|
||||
<ma-icon :icon="model"></ma-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-dialog v-model="dialogVisible" :title="placeholder" top="50px" width="66%">
|
||||
<el-input v-model="inputValue" placeholder="搜索图标" size="large" prefix-icon="Search" />
|
||||
<el-scrollbar>
|
||||
<div class="icon-list">
|
||||
<div v-for="item in iconList" :key="item" class="icon-item" @click="selectIcon(item)">
|
||||
<ma-icon size="36px" :icon="item"></ma-icon>
|
||||
<span>{{ item.replace('icon-', '') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaIconSelect">
|
||||
import { ref, computed } from 'vue'
|
||||
import { getIconList } from '@/utils/tool'
|
||||
interface SelectIconProps {
|
||||
title?: string
|
||||
clearable?: boolean
|
||||
placeholder?: string
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<SelectIconProps>(), {
|
||||
title: '请选择图标',
|
||||
clearable: true,
|
||||
placeholder: '请选择图标'
|
||||
})
|
||||
|
||||
const model = defineModel<string>()
|
||||
|
||||
// open Dialog
|
||||
const dialogVisible = ref(false)
|
||||
const openDialog = () => (dialogVisible.value = true)
|
||||
|
||||
const selectIcon = (item: any) => {
|
||||
dialogVisible.value = false
|
||||
model.value = item
|
||||
setTimeout(() => inputRef.value.blur(), 0)
|
||||
}
|
||||
|
||||
// 清空图标
|
||||
const inputRef = ref()
|
||||
const clearIcon = () => {
|
||||
model.value = ''
|
||||
setTimeout(() => inputRef.value.blur(), 0)
|
||||
}
|
||||
|
||||
// 监听搜索框值
|
||||
const inputValue = ref('')
|
||||
const customIcons: { [key: string]: any } = getIconList()
|
||||
const iconList = computed((): { [key: string]: any } => {
|
||||
if (!inputValue.value) {
|
||||
return getIconList()
|
||||
}
|
||||
let result: { [key: number]: any } = {}
|
||||
customIcons.forEach((item: any, index: number) => {
|
||||
if (item.toLowerCase().indexOf(inputValue.value.toLowerCase()) > -1) {
|
||||
result[index] = customIcons[index]
|
||||
}
|
||||
})
|
||||
return result
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<div v-if="icon" class="ma-icon">
|
||||
<svg :class="`${className}`" :style="`color:${color};width: ${size};height: ${size}`" aria-hidden="true">
|
||||
<use :xlink:href="iconName" />
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaIcon">
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
// https://www.iconfont.cn 图标库需使用前缀 icon- 才能匹配
|
||||
const iconName = computed(() => `#icon-${props.icon.replace('icon-', '')}`)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ma-icon {
|
||||
display: inline-block;
|
||||
svg {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
vertical-align: -0.15em;
|
||||
fill: currentColor;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<template>
|
||||
<div>
|
||||
<v-md-editor :model-value="model" :height="height"></v-md-editor>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="MaMarkdown">
|
||||
import VMdEditor from '@kangc/v-md-editor'
|
||||
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js'
|
||||
import '@kangc/v-md-editor/lib/style/base-editor.css'
|
||||
import '@kangc/v-md-editor/lib/theme/style/github.css'
|
||||
|
||||
// highlight
|
||||
import hljs from 'highlight.js'
|
||||
VMdEditor.use(githubTheme, {
|
||||
Hljs: hljs
|
||||
})
|
||||
|
||||
defineProps({
|
||||
height: {
|
||||
type: String,
|
||||
default: '400px'
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<string>()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<template>
|
||||
<el-input v-model="orgName" :clearable :disabled readonly :placeholder @clear="model = ''">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="visible = true"></el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<ma-data-table
|
||||
v-if="!disabled && visible"
|
||||
:key="visible + ''"
|
||||
v-model:visible="visible"
|
||||
title="机构选择"
|
||||
url="/sys/org/list"
|
||||
:multiple
|
||||
row-key="id"
|
||||
:page="false"
|
||||
:columns="[
|
||||
{ field: 'name', label: '名称' },
|
||||
{ field: 'parentName', label: '上级名称' }
|
||||
]"
|
||||
@select="onSelect"
|
||||
></ma-data-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaOrgInput">
|
||||
import { ref, watch } from 'vue'
|
||||
import { useOrgNameListApi } from '@/api/sys/orgs'
|
||||
|
||||
const props = defineProps({
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<any | any[]>()
|
||||
const visible = ref(false)
|
||||
const orgName = ref()
|
||||
|
||||
watch(
|
||||
() => model.value,
|
||||
async val => {
|
||||
if (val && val.length > 0) {
|
||||
const idList = props.multiple ? model.value : [model.value]
|
||||
const { data } = await useOrgNameListApi(idList)
|
||||
orgName.value = data.join(',')
|
||||
} else {
|
||||
orgName.value = ''
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits(['select'])
|
||||
const onSelect = (rows: any[]) => {
|
||||
if (props.multiple) {
|
||||
model.value = rows.map((item: any) => item.id)
|
||||
} else {
|
||||
model.value = rows[0].id
|
||||
}
|
||||
|
||||
emit('select', rows)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<template>
|
||||
<el-tree-select
|
||||
v-model="model"
|
||||
:data="orgList"
|
||||
value-key="id"
|
||||
check-strictly
|
||||
:render-after-expand="false"
|
||||
:props="{ label: 'name', children: 'children' }"
|
||||
style="width: 100%"
|
||||
:clearable="clearable"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaOrgSelect">
|
||||
import { ref } from 'vue'
|
||||
import { useOrgListApi } from '@/api/sys/orgs'
|
||||
|
||||
defineProps({
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<number | string>()
|
||||
const orgList = ref([])
|
||||
|
||||
// 获取机构列表
|
||||
const getOrgList = async () => {
|
||||
const res = await useOrgListApi()
|
||||
orgList.value = res.data
|
||||
}
|
||||
|
||||
getOrgList()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<template>
|
||||
<el-input v-model="postName" :clearable :disabled readonly :placeholder @clear="model = ''">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="visible = true"></el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<ma-data-table
|
||||
v-if="!disabled && visible"
|
||||
:key="visible + ''"
|
||||
v-model:visible="visible"
|
||||
title="岗位选择"
|
||||
url="/sys/post/page"
|
||||
:multiple
|
||||
:columns="[
|
||||
{ field: 'postCode', label: '岗位编码' },
|
||||
{ field: 'postName', label: '岗位名称' }
|
||||
]"
|
||||
:query-params="[
|
||||
{ field: 'postCode', label: '岗位编码' },
|
||||
{ field: 'postName', label: '岗位名称' }
|
||||
]"
|
||||
@select="onSelect"
|
||||
></ma-data-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaPostInput">
|
||||
import { ref, watch } from 'vue'
|
||||
import { usePostNameListApi } from '@/api/sys/post'
|
||||
|
||||
const props = defineProps({
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<any | any[]>()
|
||||
const visible = ref(false)
|
||||
const postName = ref()
|
||||
|
||||
watch(
|
||||
() => model.value,
|
||||
async val => {
|
||||
if (val) {
|
||||
const idList = props.multiple ? val : [val]
|
||||
if (idList.length > 0) {
|
||||
const { data } = await usePostNameListApi(idList)
|
||||
postName.value = data.join(',')
|
||||
}
|
||||
} else {
|
||||
postName.value = ''
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits(['select'])
|
||||
const onSelect = (rows: any[]) => {
|
||||
if (props.multiple) {
|
||||
model.value = rows.map((item: any) => item.id)
|
||||
} else {
|
||||
model.value = rows[0].id
|
||||
}
|
||||
|
||||
emit('select', rows)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<template>
|
||||
<el-input v-model="roleName" :clearable :disabled readonly :placeholder @clear="model = ''">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="visible = true"></el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<ma-data-table
|
||||
v-if="!disabled && visible"
|
||||
:key="visible + ''"
|
||||
v-model:visible="visible"
|
||||
title="角色选择"
|
||||
url="/sys/role/page"
|
||||
:multiple
|
||||
:columns="[
|
||||
{ field: 'name', label: '名称' },
|
||||
{ field: 'roleCode', label: '编码' },
|
||||
{ field: 'remark', label: '备注' }
|
||||
]"
|
||||
:query-params="[{ field: 'name', label: '名称' }]"
|
||||
@select="onSelect"
|
||||
></ma-data-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaRoleInput">
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRoleNameListApi } from '@/api/sys/role'
|
||||
|
||||
const props = defineProps({
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<any | any[]>()
|
||||
const visible = ref(false)
|
||||
const roleName = ref()
|
||||
|
||||
watch(
|
||||
() => model.value,
|
||||
async val => {
|
||||
if (val) {
|
||||
const idList = props.multiple ? val : [val]
|
||||
if (idList.length > 0) {
|
||||
const { data } = await useRoleNameListApi(idList)
|
||||
roleName.value = data.join(',')
|
||||
}
|
||||
} else {
|
||||
roleName.value = ''
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits(['select'])
|
||||
const onSelect = (rows: any[]) => {
|
||||
if (props.multiple) {
|
||||
model.value = rows.map((item: any) => item.id)
|
||||
} else {
|
||||
model.value = rows[0].id
|
||||
}
|
||||
|
||||
emit('select', rows)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
<template>
|
||||
<div class="upload-box">
|
||||
<el-upload
|
||||
:id="uuid"
|
||||
action="#"
|
||||
:class="['upload', self_disabled ? 'disabled' : '', drag ? 'no-border' : '']"
|
||||
:multiple="false"
|
||||
:disabled="self_disabled"
|
||||
:show-file-list="false"
|
||||
:http-request="handleHttpUpload"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="uploadSuccess"
|
||||
:on-error="uploadError"
|
||||
:drag="drag"
|
||||
:accept="fileType.join(',')"
|
||||
>
|
||||
<template v-if="imageUrl">
|
||||
<img :src="imageUrl" class="upload-image" />
|
||||
<div class="upload-handle" @click.stop>
|
||||
<div v-if="!self_disabled" class="handle-icon" @click="editImg">
|
||||
<el-icon><Edit /></el-icon>
|
||||
<span>编辑</span>
|
||||
</div>
|
||||
<div class="handle-icon" @click="imgViewVisible = true">
|
||||
<el-icon><ZoomIn /></el-icon>
|
||||
<span>查看</span>
|
||||
</div>
|
||||
<div v-if="!self_disabled" class="handle-icon" @click="deleteImg">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<span>删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="upload-empty">
|
||||
<slot name="empty">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<!-- <span>请上传图片</span> -->
|
||||
</slot>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<div class="el-upload__tip">
|
||||
<slot name="tip"></slot>
|
||||
</div>
|
||||
<el-image-viewer v-if="imgViewVisible" :url-list="[imageUrl]" @close="imgViewVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaUploadImage">
|
||||
import { ref, computed, inject } from 'vue'
|
||||
import { ElNotification, formContextKey, formItemContextKey } from 'element-plus'
|
||||
import type { UploadProps, UploadRequestOptions } from 'element-plus'
|
||||
import { generateUUID } from '@/utils/tool'
|
||||
import { uploadImg } from '@/api/sys/upload'
|
||||
|
||||
interface UploadFileProps {
|
||||
imageUrl: string // 图片地址 ==> 必传
|
||||
drag?: boolean // 是否支持拖拽上传 ==> 非必传(默认为 true)
|
||||
disabled?: boolean // 是否禁用上传组件 ==> 非必传(默认为 false)
|
||||
fileSize?: number // 图片大小限制 ==> 非必传(默认为 5M)
|
||||
fileType?: any[] // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
|
||||
height?: string // 组件高度 ==> 非必传(默认为 150px)
|
||||
width?: string // 组件宽度 ==> 非必传(默认为 150px)
|
||||
borderRadius?: string // 组件边框圆角 ==> 非必传(默认为 8px)
|
||||
}
|
||||
|
||||
// 接受父组件参数
|
||||
const props = withDefaults(defineProps<UploadFileProps>(), {
|
||||
imageUrl: '',
|
||||
drag: true,
|
||||
disabled: false,
|
||||
fileSize: 5,
|
||||
fileType: () => ['image/jpeg', 'image/png', 'image/gif'],
|
||||
height: '150px',
|
||||
width: '150px',
|
||||
borderRadius: '8px'
|
||||
})
|
||||
|
||||
// 生成组件唯一id
|
||||
const uuid = ref('id-' + generateUUID())
|
||||
|
||||
// 查看图片
|
||||
const imgViewVisible = ref(false)
|
||||
// 获取 el-form 组件上下文
|
||||
const formContext = inject(formContextKey, void 0)
|
||||
// 获取 el-form-item 组件上下文
|
||||
const formItemContext = inject(formItemContextKey, void 0)
|
||||
// 判断是否禁用上传和删除
|
||||
const self_disabled = computed(() => {
|
||||
return props.disabled || formContext?.disabled
|
||||
})
|
||||
|
||||
/**
|
||||
* @description 图片上传
|
||||
* @param options upload 所有配置项
|
||||
* */
|
||||
const emit = defineEmits<{
|
||||
'update:imageUrl': [value: string]
|
||||
success: [value: any]
|
||||
}>()
|
||||
const handleHttpUpload = async (options: UploadRequestOptions) => {
|
||||
let formData = new FormData()
|
||||
formData.append('file', options.file)
|
||||
try {
|
||||
const { data } = await uploadImg(formData)
|
||||
emit('update:imageUrl', data.url)
|
||||
emit('success', data)
|
||||
// 调用 el-form 内部的校验方法(可自动校验)
|
||||
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string])
|
||||
} catch (error) {
|
||||
options.onError(error as any)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 删除图片
|
||||
* */
|
||||
const deleteImg = () => {
|
||||
emit('update:imageUrl', '')
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 编辑图片
|
||||
* */
|
||||
const editImg = () => {
|
||||
const dom = document.querySelector(`#${uuid.value} .el-upload__input`)
|
||||
dom && dom.dispatchEvent(new MouseEvent('click'))
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 文件上传之前判断
|
||||
* @param rawFile 选择的文件
|
||||
* */
|
||||
const beforeUpload: UploadProps['beforeUpload'] = rawFile => {
|
||||
const imgSize = rawFile.size / 1024 / 1024 < props.fileSize
|
||||
const imgType = props.fileType.includes(rawFile.type)
|
||||
if (!imgType) {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: '上传图片不符合所需的格式!',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
if (!imgSize) {
|
||||
setTimeout(() => {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: `上传图片大小不能超过 ${props.fileSize}M!`,
|
||||
type: 'warning'
|
||||
})
|
||||
}, 0)
|
||||
}
|
||||
return imgType && imgSize
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片上传成功
|
||||
* */
|
||||
const uploadSuccess = () => {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: '图片上传成功!',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片上传错误
|
||||
* */
|
||||
const uploadError = () => {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: '图片上传失败,请您重新上传!',
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.is-error {
|
||||
.upload {
|
||||
:deep(.el-upload),
|
||||
:deep(.el-upload-dragger) {
|
||||
border: 1px dashed var(--el-color-danger) !important;
|
||||
&:hover {
|
||||
border-color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.disabled) {
|
||||
.el-upload,
|
||||
.el-upload-dragger {
|
||||
cursor: not-allowed !important;
|
||||
background: var(--el-disabled-bg-color);
|
||||
border: 1px dashed var(--el-border-color-darker) !important;
|
||||
&:hover {
|
||||
border: 1px dashed var(--el-border-color-darker) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.upload-box {
|
||||
.no-border {
|
||||
:deep(.el-upload) {
|
||||
border: none !important;
|
||||
}
|
||||
}
|
||||
:deep(.upload) {
|
||||
.el-upload {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: v-bind(width);
|
||||
height: v-bind(height);
|
||||
overflow: hidden;
|
||||
border: 1px dashed var(--el-border-color-darker);
|
||||
border-radius: v-bind(borderRadius);
|
||||
transition: var(--el-transition-duration-fast);
|
||||
&:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
.upload-handle {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.el-upload-dragger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: transparent;
|
||||
border: 1px dashed var(--el-border-color-darker);
|
||||
border-radius: v-bind(borderRadius);
|
||||
&:hover {
|
||||
border: 1px dashed var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
.el-upload-dragger.is-dragover {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
border: 2px dashed var(--el-color-primary) !important;
|
||||
}
|
||||
.upload-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.upload-empty {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
color: var(--el-color-info);
|
||||
.el-icon {
|
||||
font-size: 28px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
}
|
||||
.upload-handle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
background: rgb(0 0 0 / 60%);
|
||||
opacity: 0;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
.handle-icon {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 6%;
|
||||
color: aliceblue;
|
||||
.el-icon {
|
||||
margin-bottom: 40%;
|
||||
font-size: 130%;
|
||||
line-height: 130%;
|
||||
}
|
||||
span {
|
||||
font-size: 85%;
|
||||
line-height: 85%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-upload__tip {
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
<template>
|
||||
<div class="upload-box">
|
||||
<el-upload
|
||||
v-model:file-list="_fileList"
|
||||
action="#"
|
||||
list-type="picture-card"
|
||||
:class="['upload', self_disabled ? 'disabled' : '', drag ? 'no-border' : '']"
|
||||
:multiple="true"
|
||||
:disabled="self_disabled"
|
||||
:limit="limit"
|
||||
:http-request="handleHttpUpload"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:on-success="uploadSuccess"
|
||||
:on-error="uploadError"
|
||||
:drag="drag"
|
||||
:accept="fileType.join(',')"
|
||||
>
|
||||
<div class="upload-empty">
|
||||
<slot name="empty">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</slot>
|
||||
</div>
|
||||
<template #file="{ file }">
|
||||
<img :src="file.url" class="upload-image" />
|
||||
<div class="upload-handle" @click.stop>
|
||||
<div class="handle-icon" @click="handlePictureCardPreview(file)">
|
||||
<el-icon><ZoomIn /></el-icon>
|
||||
<span>查看</span>
|
||||
</div>
|
||||
<div v-if="!self_disabled" class="handle-icon" @click="handleRemove(file)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<span>删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<div class="el-upload__tip">
|
||||
<slot name="tip"></slot>
|
||||
</div>
|
||||
<el-image-viewer v-if="imgViewVisible" :url-list="[viewImageUrl]" @close="imgViewVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaUploadImages">
|
||||
import { ref, computed, inject, watch } from 'vue'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { uploadImg } from '@/api/sys/upload'
|
||||
import type { UploadProps, UploadFile, UploadUserFile, UploadRequestOptions } from 'element-plus'
|
||||
import { ElNotification, formContextKey, formItemContextKey } from 'element-plus'
|
||||
|
||||
interface UploadFileProps {
|
||||
fileList: UploadUserFile[]
|
||||
drag?: boolean // 是否支持拖拽上传 ==> 非必传(默认为 true)
|
||||
disabled?: boolean // 是否禁用上传组件 ==> 非必传(默认为 false)
|
||||
limit?: number // 最大图片上传数 ==> 非必传(默认为 5张)
|
||||
fileSize?: number // 图片大小限制 ==> 非必传(默认为 5M)
|
||||
fileType?: any[] // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
|
||||
height?: string // 组件高度 ==> 非必传(默认为 150px)
|
||||
width?: string // 组件宽度 ==> 非必传(默认为 150px)
|
||||
borderRadius?: string // 组件边框圆角 ==> 非必传(默认为 8px)
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<UploadFileProps>(), {
|
||||
fileList: () => [],
|
||||
drag: true,
|
||||
disabled: false,
|
||||
limit: 5,
|
||||
fileSize: 5,
|
||||
fileType: () => ['image/jpeg', 'image/png', 'image/gif'],
|
||||
height: '150px',
|
||||
width: '150px',
|
||||
borderRadius: '8px'
|
||||
})
|
||||
|
||||
// 获取 el-form 组件上下文
|
||||
const formContext = inject(formContextKey, void 0)
|
||||
// 获取 el-form-item 组件上下文
|
||||
const formItemContext = inject(formItemContextKey, void 0)
|
||||
// 判断是否禁用上传和删除
|
||||
const self_disabled = computed(() => {
|
||||
return props.disabled || formContext?.disabled
|
||||
})
|
||||
|
||||
const _fileList = ref<UploadUserFile[]>(props.fileList)
|
||||
|
||||
// 监听 props.fileList 列表默认值改变
|
||||
watch(
|
||||
() => props.fileList,
|
||||
(n: UploadUserFile[]) => {
|
||||
_fileList.value = n
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* @description 文件上传之前判断
|
||||
* @param rawFile 选择的文件
|
||||
* */
|
||||
const beforeUpload: UploadProps['beforeUpload'] = rawFile => {
|
||||
const imgSize = rawFile.size / 1024 / 1024 < props.fileSize
|
||||
const imgType = props.fileType.includes(rawFile.type)
|
||||
if (!imgType) {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: '上传图片不符合所需的格式!',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
if (!imgSize) {
|
||||
setTimeout(() => {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: `上传图片大小不能超过 ${props.fileSize}M!`,
|
||||
type: 'warning'
|
||||
})
|
||||
}, 0)
|
||||
}
|
||||
return imgType && imgSize
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片上传
|
||||
* @param options upload 所有配置项
|
||||
* */
|
||||
const handleHttpUpload = async (options: UploadRequestOptions) => {
|
||||
let formData = new FormData()
|
||||
formData.append('file', options.file)
|
||||
try {
|
||||
const { data } = await uploadImg(formData)
|
||||
options.onSuccess(data)
|
||||
} catch (error) {
|
||||
options.onError(error as any)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片上传成功
|
||||
* @param response 上传响应结果
|
||||
* @param uploadFile 上传的文件
|
||||
* */
|
||||
const emit = defineEmits<{
|
||||
'update:fileList': [value: UploadUserFile[]]
|
||||
}>()
|
||||
const uploadSuccess = (response: { url: string } | undefined, uploadFile: UploadFile) => {
|
||||
if (!response) {
|
||||
return
|
||||
}
|
||||
uploadFile.url = response.url
|
||||
emit('update:fileList', _fileList.value)
|
||||
// 调用 el-form 内部的校验方法(可自动校验)
|
||||
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string])
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: '图片上传成功!',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 删除图片
|
||||
* @param file 删除的文件
|
||||
* */
|
||||
const handleRemove = (file: UploadFile) => {
|
||||
_fileList.value = _fileList.value.filter(item => item.url !== file.url || item.name !== file.name)
|
||||
emit('update:fileList', _fileList.value)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片上传错误
|
||||
* */
|
||||
const uploadError = () => {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: '图片上传失败,请您重新上传!',
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 文件数超出
|
||||
* */
|
||||
const handleExceed = () => {
|
||||
ElNotification({
|
||||
title: '温馨提示',
|
||||
message: `当前最多只能上传 ${props.limit} 张图片,请移除后上传!`,
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片预览
|
||||
* @param file 预览的文件
|
||||
* */
|
||||
const viewImageUrl = ref('')
|
||||
const imgViewVisible = ref(false)
|
||||
const handlePictureCardPreview: UploadProps['onPreview'] = file => {
|
||||
viewImageUrl.value = file.url!
|
||||
imgViewVisible.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.is-error {
|
||||
.upload {
|
||||
:deep(.el-upload--picture-card),
|
||||
:deep(.el-upload-dragger) {
|
||||
border: 1px dashed var(--el-color-danger) !important;
|
||||
&:hover {
|
||||
border-color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.disabled) {
|
||||
.el-upload--picture-card,
|
||||
.el-upload-dragger {
|
||||
cursor: not-allowed;
|
||||
background: var(--el-disabled-bg-color) !important;
|
||||
border: 1px dashed var(--el-border-color-darker);
|
||||
&:hover {
|
||||
border-color: var(--el-border-color-darker) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.upload-box {
|
||||
.no-border {
|
||||
:deep(.el-upload--picture-card) {
|
||||
border: none !important;
|
||||
}
|
||||
}
|
||||
:deep(.upload) {
|
||||
.el-upload-dragger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
border: 1px dashed var(--el-border-color-darker);
|
||||
border-radius: v-bind(borderRadius);
|
||||
&:hover {
|
||||
border: 1px dashed var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
.el-upload-dragger.is-dragover {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
border: 2px dashed var(--el-color-primary) !important;
|
||||
}
|
||||
.el-upload-list__item,
|
||||
.el-upload--picture-card {
|
||||
width: v-bind(width);
|
||||
height: v-bind(height);
|
||||
background-color: transparent;
|
||||
border-radius: v-bind(borderRadius);
|
||||
}
|
||||
.upload-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.upload-handle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
background: rgb(0 0 0 / 60%);
|
||||
opacity: 0;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
.handle-icon {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 6%;
|
||||
color: aliceblue;
|
||||
.el-icon {
|
||||
margin-bottom: 15%;
|
||||
font-size: 140%;
|
||||
}
|
||||
span {
|
||||
font-size: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-upload-list__item {
|
||||
&:hover {
|
||||
.upload-handle {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.upload-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
color: var(--el-color-info);
|
||||
.el-icon {
|
||||
font-size: 28px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-upload__tip {
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<ma-data-table
|
||||
:key="visible + ''"
|
||||
v-model:visible="visible"
|
||||
title="用户选择"
|
||||
url="/sys/user/page"
|
||||
:multiple
|
||||
:columns="[
|
||||
{ field: 'id', label: '用户ID' },
|
||||
{ field: 'username', label: '用户名' },
|
||||
{ field: 'realName', label: '姓名' },
|
||||
{ field: 'mobile', label: '手机号' },
|
||||
{ field: 'createTime', label: '创建时间' }
|
||||
]"
|
||||
:query-params="[
|
||||
{ field: 'username', label: '用户名' },
|
||||
{ field: 'mobile', label: '手机号' }
|
||||
]"
|
||||
@select="onSelect"
|
||||
></ma-data-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaUserDialog">
|
||||
defineProps({
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const visible = defineModel<boolean>()
|
||||
|
||||
const emit = defineEmits(['select'])
|
||||
const onSelect = (rows: any[]) => {
|
||||
emit('select', rows)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<template>
|
||||
<el-input v-model="userName" :clearable :disabled :placeholder @clear="model = ''">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="visible = true"></el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<ma-user-dialog v-if="!disabled && visible" :key="visible" v-model="visible" :multiple @select="userHandle"></ma-user-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MaUserInput">
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRealNameListApi } from '@/api/sys/user'
|
||||
|
||||
const props = defineProps({
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: () => false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: () => ''
|
||||
}
|
||||
})
|
||||
|
||||
const model = defineModel<any | any[]>()
|
||||
const visible = ref(false)
|
||||
const userName = ref()
|
||||
|
||||
watch(
|
||||
() => model.value,
|
||||
async val => {
|
||||
if (val) {
|
||||
const idList = props.multiple ? val : [val]
|
||||
if (idList.length > 0) {
|
||||
const { data } = await useRealNameListApi(idList)
|
||||
userName.value = data.join(',')
|
||||
}
|
||||
} else {
|
||||
userName.value = ''
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits(['select'])
|
||||
const userHandle = (rows: any[]) => {
|
||||
if (props.multiple) {
|
||||
model.value = rows.map((item: any) => item.id)
|
||||
} else {
|
||||
model.value = rows[0].id
|
||||
}
|
||||
emit('select', rows)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
import { IHooksOptions } from '@/hooks/interface'
|
||||
import service from '@/utils/request'
|
||||
import { onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import qs from 'qs'
|
||||
|
||||
export const useCrud = (options: IHooksOptions) => {
|
||||
const defaultOptions: IHooksOptions = {
|
||||
createdIsNeed: true,
|
||||
dataListUrl: '',
|
||||
isPage: true,
|
||||
deleteUrl: '',
|
||||
primaryKey: 'id',
|
||||
exportUrl: '',
|
||||
queryForm: {},
|
||||
dataList: [],
|
||||
order: '',
|
||||
asc: false,
|
||||
page: 1,
|
||||
limit: 10,
|
||||
total: 0,
|
||||
pageSizes: [10, 20, 50, 100, 200],
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
dataListSelectionKeys: []
|
||||
}
|
||||
|
||||
const mergeDefaultOptions = (options: any, props: any): IHooksOptions => {
|
||||
for (const key in options) {
|
||||
if (!Object.getOwnPropertyDescriptor(props, key)) {
|
||||
props[key] = options[key]
|
||||
}
|
||||
}
|
||||
return props
|
||||
}
|
||||
|
||||
// 覆盖默认值
|
||||
const state = mergeDefaultOptions(defaultOptions, options)
|
||||
|
||||
onMounted(() => {
|
||||
if (state.createdIsNeed) {
|
||||
query()
|
||||
}
|
||||
})
|
||||
|
||||
const query = () => {
|
||||
if (!state.dataListUrl) {
|
||||
return
|
||||
}
|
||||
|
||||
state.dataListLoading = true
|
||||
|
||||
service
|
||||
.get(state.dataListUrl, {
|
||||
params: {
|
||||
order: state.order,
|
||||
asc: state.asc,
|
||||
page: state.isPage ? state.page : null,
|
||||
limit: state.isPage ? state.limit : null,
|
||||
...state.queryForm
|
||||
},
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params)
|
||||
}
|
||||
})
|
||||
.then((res: any) => {
|
||||
state.dataList = state.isPage ? res.data.list : res.data
|
||||
state.total = state.isPage ? res.data.total : 0
|
||||
})
|
||||
.finally(() => {
|
||||
state.dataListLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
const getDataList = () => {
|
||||
state.page = 1
|
||||
query()
|
||||
}
|
||||
|
||||
const sizeChangeHandle = (val: number) => {
|
||||
state.page = 1
|
||||
state.limit = val
|
||||
query()
|
||||
}
|
||||
|
||||
const currentChangeHandle = (val: number) => {
|
||||
state.page = val
|
||||
query()
|
||||
}
|
||||
|
||||
// 多选
|
||||
const selectionChangeHandle = (selections: any[]) => {
|
||||
state.dataListSelections = selections
|
||||
state.dataListSelectionKeys = selections.map((item: any) => state.primaryKey && item[state.primaryKey])
|
||||
}
|
||||
|
||||
// 排序
|
||||
const sortChangeHandle = (data: any) => {
|
||||
const { prop, order } = data
|
||||
|
||||
if (prop && order) {
|
||||
state.order = prop
|
||||
state.asc = order === 'ascending'
|
||||
} else {
|
||||
state.order = ''
|
||||
}
|
||||
|
||||
query()
|
||||
}
|
||||
|
||||
const deleteHandle = (key: number | string) => {
|
||||
if (!state.deleteUrl) {
|
||||
return
|
||||
}
|
||||
|
||||
ElMessageBox.confirm('确定进行删除操作?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
service.delete(state.deleteUrl + '/' + key).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
|
||||
query()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const deleteBatchHandle = (key?: number | string) => {
|
||||
let data: any[] = []
|
||||
if (key) {
|
||||
data = [key]
|
||||
} else {
|
||||
data = state.dataListSelectionKeys ? state.dataListSelectionKeys : []
|
||||
|
||||
if (data.length === 0) {
|
||||
ElMessage.warning('请选择删除记录')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ElMessageBox.confirm('确定进行删除操作?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
if (state.deleteUrl) {
|
||||
service.delete(state.deleteUrl, { data }).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
|
||||
query()
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const downloadHandle = async (url: string, filename?: string, method: string = 'GET'): Promise<any> => {
|
||||
try {
|
||||
const res = await service({
|
||||
responseType: 'blob',
|
||||
url: url,
|
||||
method: method
|
||||
})
|
||||
// 创建a标签
|
||||
const down = document.createElement('a')
|
||||
|
||||
// 文件名没传,则使用时间戳
|
||||
if (filename) {
|
||||
down.download = filename
|
||||
} else {
|
||||
const downName = res.headers['content-disposition'].split('=')[1]
|
||||
down.download = decodeURI(downName)
|
||||
}
|
||||
|
||||
// 隐藏a标签
|
||||
down.style.display = 'none'
|
||||
|
||||
// 创建下载url
|
||||
down.href = URL.createObjectURL(
|
||||
new Blob([res.data], {
|
||||
type: res.data.type
|
||||
})
|
||||
)
|
||||
|
||||
// 模拟点击下载
|
||||
document.body.appendChild(down)
|
||||
down.click()
|
||||
|
||||
// 释放URL
|
||||
URL.revokeObjectURL(down.href)
|
||||
// 下载完成移除
|
||||
document.body.removeChild(down)
|
||||
} catch (err: any) {
|
||||
ElMessage.error(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
const reset = (queryRef: any) => {
|
||||
queryRef.resetFields()
|
||||
|
||||
getDataList()
|
||||
}
|
||||
|
||||
return {
|
||||
getDataList,
|
||||
sizeChangeHandle,
|
||||
currentChangeHandle,
|
||||
selectionChangeHandle,
|
||||
sortChangeHandle,
|
||||
deleteHandle,
|
||||
deleteBatchHandle,
|
||||
downloadHandle,
|
||||
reset
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
export interface IHooksOptions {
|
||||
// 是否在创建页面时,调用数据列表接口
|
||||
createdIsNeed?: boolean
|
||||
// 数据列表 Url
|
||||
dataListUrl?: string
|
||||
// 是否需要分页
|
||||
isPage?: boolean
|
||||
// 删除 Url
|
||||
deleteUrl?: string
|
||||
// 主键key,用于删除场景
|
||||
primaryKey?: string
|
||||
// 导出 Url
|
||||
exportUrl?: string
|
||||
// 查询条件
|
||||
queryForm?: any
|
||||
// 数据列表
|
||||
dataList?: any[]
|
||||
// 排序字段
|
||||
order?: string
|
||||
// 是否升序
|
||||
asc?: boolean
|
||||
// 当前页码
|
||||
page?: number
|
||||
// 每页数
|
||||
limit?: number
|
||||
// 总条数
|
||||
total?: number
|
||||
pageSizes?: any[]
|
||||
// 数据列表,loading状态
|
||||
dataListLoading?: boolean
|
||||
// 数据列表,多选项
|
||||
dataListSelections?: any[]
|
||||
dataListSelectionKeys?: any[]
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
import { createI18n } from 'vue-i18n'
|
||||
import cache from '@/utils/cache'
|
||||
|
||||
// element-plus 国际化文件
|
||||
import element_zh_cn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import element_en from 'element-plus/es/locale/lang/en'
|
||||
|
||||
// 框架 国际化文件
|
||||
const zh_cn = import.meta.glob('./lang/**/zh-CN.ts', { eager: true })
|
||||
const en_us = import.meta.glob('./lang/**/en-US.ts', { eager: true })
|
||||
|
||||
// 加载 lang 文件夹下的国际化
|
||||
export const loadLang = (modules: Record<string, any>) => {
|
||||
const messages: { [key: string]: string } = {}
|
||||
|
||||
Object.keys(modules).forEach(module => {
|
||||
Object.assign(messages, { ...modules[module].default })
|
||||
})
|
||||
return messages
|
||||
}
|
||||
|
||||
export const messages: { [key: string]: any } = {
|
||||
'zh-CN': {
|
||||
langName: '简体中文',
|
||||
...loadLang(zh_cn),
|
||||
el: {
|
||||
...element_zh_cn
|
||||
}
|
||||
},
|
||||
'en-US': {
|
||||
langName: 'English',
|
||||
...loadLang(en_us),
|
||||
el: {
|
||||
...element_en
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 返回当前 Language
|
||||
function getLanguage() {
|
||||
return cache.getLanguage()
|
||||
}
|
||||
|
||||
export const i18n = createI18n({
|
||||
allowComposition: true,
|
||||
globalInjection: true,
|
||||
legacy: false,
|
||||
locale: getLanguage(),
|
||||
messages
|
||||
})
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
export default {
|
||||
loading: 'Loading...',
|
||||
add: 'Add',
|
||||
delete: 'Delete',
|
||||
edit: 'Edit',
|
||||
query: 'Query',
|
||||
export: 'Export',
|
||||
handle: 'Action',
|
||||
back: 'Back',
|
||||
home: 'Home',
|
||||
confirm: 'Confirm',
|
||||
cancel: 'Cancel',
|
||||
clear: 'Clear',
|
||||
close: 'Close',
|
||||
createTime: 'Create Time',
|
||||
updateTime: 'Update Time',
|
||||
required: 'Required items cannot be empty',
|
||||
app: {
|
||||
title: 'Maku Admin',
|
||||
description:
|
||||
'The backstage management template developed based on Vue3, TypeScript, Element Plus, Vue Router, Pinia, Axios, i18n、Vite, etc., has a very low threshold for use, adopts the MIT open source protocol, is completely free and open source, and can be used for commercial projects and other scenarios for free! ',
|
||||
logoText: 'Maku Admin',
|
||||
miniLogoText: 'MAKU',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
captcha: 'Captcha',
|
||||
mobileSignIn: 'Mobile SignIn',
|
||||
mobile: 'Mobile',
|
||||
signIn: 'Sign in',
|
||||
signOut: 'Sign Out',
|
||||
profile: 'Profile',
|
||||
large: 'Large',
|
||||
default: 'Default',
|
||||
small: 'Small',
|
||||
close: 'Close',
|
||||
closeOthers: 'Close Others',
|
||||
closeAll: 'Close All'
|
||||
},
|
||||
settings: {
|
||||
title: 'Layout Settings',
|
||||
sidebarDark: 'Dark Sidebar',
|
||||
sidebarLight: 'Light Sidebar',
|
||||
navbarLight: 'Light Navbar',
|
||||
navbarTheme: 'Theme Navbar',
|
||||
layout: 'Layout Switch',
|
||||
vertical: 'Vertical',
|
||||
columns: 'Columns',
|
||||
transverse: 'Transverse',
|
||||
interface: 'Interface Settings',
|
||||
uniqueOpened: 'Unique Opened',
|
||||
dark: 'Enable Dark',
|
||||
logo: 'Enable Logo',
|
||||
breadcrumb: 'Enable Breadcrumb',
|
||||
tabs: 'Enable Tabs',
|
||||
tabsCache: 'Enable Tabs Cache',
|
||||
tabsStyle: 'Tabs Style',
|
||||
tips: 'After setting, it will only take effect temporarily. To take effect permanently, you need to click the "Copy Config" button below to replace the configuration in store/theme/config.ts. ',
|
||||
copyConfig: 'Copy Config',
|
||||
reset: 'Reset',
|
||||
copySuc: 'Copy Succeeded',
|
||||
style1: 'Style-1',
|
||||
style2: 'Style2'
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
export default {
|
||||
profile: {
|
||||
username: 'Username',
|
||||
oldPassword: 'Original Password',
|
||||
newPassword: 'New Password',
|
||||
confirmPassword: 'Confirm Password'
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
export default {
|
||||
profile: {
|
||||
username: '用户名',
|
||||
oldPassword: '原密码',
|
||||
newPassword: '新密码',
|
||||
confirmPassword: '确认密码'
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
export default {
|
||||
loading: '加载中...',
|
||||
add: '新增',
|
||||
delete: '删除',
|
||||
edit: '修改',
|
||||
query: '查询',
|
||||
export: '导出',
|
||||
handle: '操作',
|
||||
back: '返回',
|
||||
home: '首页',
|
||||
confirm: '确定',
|
||||
cancel: '取消',
|
||||
clear: '清除',
|
||||
close: '关闭',
|
||||
createTime: '创建时间',
|
||||
updateTime: '更新时间',
|
||||
required: '必填项不能为空',
|
||||
app: {
|
||||
title: 'Maku Admin',
|
||||
description:
|
||||
'基于Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、i18n、Vite等开发的后台管理,使用门槛极低,采用MIT开源协议,完全免费开源且终生免费,可免费用于商业项目等场景!',
|
||||
logoText: 'Maku Admin',
|
||||
miniLogoText: 'MAKU',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
captcha: '验证码',
|
||||
signIn: '登录',
|
||||
mobileSignIn: '手机登录',
|
||||
mobile: '手机号',
|
||||
signOut: '退出',
|
||||
profile: '个人中心',
|
||||
large: '大型',
|
||||
default: '默认',
|
||||
small: '小型',
|
||||
close: '关闭当前',
|
||||
closeOthers: '关闭其它',
|
||||
closeAll: '关闭全部'
|
||||
},
|
||||
settings: {
|
||||
title: '布局设置',
|
||||
sidebarDark: '暗色侧边栏',
|
||||
sidebarLight: '亮色侧边栏',
|
||||
navbarLight: '亮色顶栏',
|
||||
navbarTheme: '主题色顶栏',
|
||||
layout: '布局切换',
|
||||
vertical: '纵向',
|
||||
columns: '分栏',
|
||||
transverse: '横向',
|
||||
interface: '界面设置',
|
||||
dark: '开启暗黑模式',
|
||||
uniqueOpened: '侧栏排他展开',
|
||||
logo: '开启LOGO',
|
||||
breadcrumb: '开启面包屑',
|
||||
tabs: '开启标签页',
|
||||
tabsCache: '开启标签页缓存',
|
||||
tabsStyle: '标签页风格',
|
||||
tips: '设置之后仅是临时生效,要想永久生效,需点击下方的 "复制配置" 按钮,将配置替换到 store/theme/config.ts 中。',
|
||||
copyConfig: '复制配置',
|
||||
reset: '恢复默认',
|
||||
copySuc: '复制成功',
|
||||
style1: '风格1',
|
||||
style2: '风格2'
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M121.718 73.272v9.953c3.957-7.584 6.199-16.05 6.199-24.995C127.917 26.079 99.273 0 63.958 0 28.644 0 0 26.079 0 58.23c0 .403.028.806.028 1.21l22.97-25.953h13.34l-19.76 27.187h6.42V53.77l13.728-19.477v49.361H22.998V73.272H2.158c5.951 20.284 23.608 36.208 45.998 41.399-1.44 3.3-5.618 11.263-12.565 12.674-8.607 1.764 23.358.428 46.163-13.178 17.519-4.611 31.938-15.849 39.77-30.513h-13.506V73.272H85.02V59.464l22.998-25.977h13.008l-19.429 27.187h6.421v-7.433l13.727-19.402v39.433h-.027zm-78.24 2.822a10.516 10.516 0 0 1-.996-4.535V44.548c0-1.613.332-3.124.996-4.535a11.66 11.66 0 0 1 2.713-3.68c1.134-1.032 2.49-1.864 4.04-2.468 1.55-.605 3.21-.908 4.982-.908h11.292c1.77 0 3.431.303 4.981.908 1.522.604 2.85 1.41 3.986 2.418l-12.26 16.303v-2.898a1.96 1.96 0 0 0-.665-1.512c-.443-.403-.996-.604-1.66-.604-.665 0-1.218.201-1.661.604a1.96 1.96 0 0 0-.664 1.512v9.071L44.364 77.606a10.556 10.556 0 0 1-.886-1.512zm35.73-4.535c0 1.613-.332 3.124-.997 4.535a11.66 11.66 0 0 1-2.712 3.68c-1.134 1.032-2.49 1.864-4.04 2.469-1.55.604-3.21.907-4.982.907H55.185c-1.77 0-3.431-.303-4.981-.907-1.55-.605-2.906-1.437-4.041-2.47a12.49 12.49 0 0 1-1.384-1.512l13.727-18.217v6.375c0 .605.222 1.109.665 1.512.442.403.996.604 1.66.604.664 0 1.218-.201 1.66-.604a1.96 1.96 0 0 0 .665-1.512V53.87L75.97 36.838c.913.932 1.66 1.99 2.214 3.175.664 1.41.996 2.922.996 4.535v27.011h.028z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -0,0 +1,43 @@
|
|||
<template>
|
||||
<div v-if="appStore.sidebarOpened" class="sidebar-logo">
|
||||
<el-avatar src="./favicon.ico"></el-avatar>
|
||||
<span class="logo-title"> {{ $t('app.logoText') }}</span>
|
||||
</div>
|
||||
<div v-else class="sidebar-logo sidebar-logo-expend">
|
||||
<span>{{ $t('app.miniLogoText') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sidebar-logo {
|
||||
width: 230px !important;
|
||||
height: var(--theme-header-height);
|
||||
line-height: var(--theme-header-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: rgb(0 21 41 / 2%) 0 1px 4px;
|
||||
color: var(--theme-logo-text-color);
|
||||
font-size: 18px;
|
||||
|
||||
//overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
.el-avatar {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
.logo-title {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
.sidebar-logo-expend {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<template>
|
||||
<el-scrollbar>
|
||||
<el-main class="layout-main">
|
||||
<el-scrollbar class="layout-scrollbar">
|
||||
<div class="layout-card" :style="layoutMainHeight">
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<keep-alive v-if="theme.isTabsCache" :include="[...tabsStore.cachedViews]">
|
||||
<component :is="Component" :key="route.fullPath" />
|
||||
</keep-alive>
|
||||
<component :is="Component" v-else :key="route.name" />
|
||||
</router-view>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</el-main>
|
||||
</el-scrollbar>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RouterView } from 'vue-router'
|
||||
import { computed } from 'vue'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import { useTabsStore } from '@/store/modules/tabs'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const tabsStore = useTabsStore()
|
||||
const theme = computed(() => appStore.theme)
|
||||
const layoutMainHeight = computed(() => {
|
||||
if (!theme.value.isTabsView) {
|
||||
return 'min-height: calc(100vh - var(--theme-header-height) - 30px) !important'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<el-sub-menu v-if="menu.children.length > 0" :key="menu.path" :index="menu.path">
|
||||
<template #title>
|
||||
<ma-icon v-if="showIcon" :icon="menu.meta.icon"></ma-icon>
|
||||
<span>{{ menu.meta.title }}</span>
|
||||
</template>
|
||||
<menu-item v-for="sub in menu.children" :key="sub.path" :menu="sub"></menu-item>
|
||||
</el-sub-menu>
|
||||
<el-menu-item v-else :key="menu.path" :index="menu.path" @click="handleClickMenu(menu)">
|
||||
<ma-icon v-if="showIcon" :icon="menu.meta.icon"></ma-icon>
|
||||
<template #title>
|
||||
{{ menu.meta.title }}
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, PropType } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { isExternalLink, replaceLinkParam } from '@/utils/tool'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
// 显示icon图标
|
||||
const showIcon = computed(() => {
|
||||
return appStore.theme.layout !== 'columns'
|
||||
})
|
||||
|
||||
defineProps({
|
||||
menu: {
|
||||
type: Object as PropType<any>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// 菜单点击事件
|
||||
const handleClickMenu = (menu: any) => {
|
||||
// 不是新开页面,则直接切换路由
|
||||
if (!menu.meta.newOpen) {
|
||||
router.push(menu.path)
|
||||
return
|
||||
}
|
||||
|
||||
// 新开页面逻辑
|
||||
if (isExternalLink(menu.meta.url)) {
|
||||
// 外链
|
||||
window.open(replaceLinkParam(menu.meta.url), '_blank')
|
||||
} else {
|
||||
// 内部组件
|
||||
window.open('#' + menu.meta.url, '_blank')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<template>
|
||||
<div class="navbar-left">
|
||||
<Hamburger />
|
||||
<Refresh />
|
||||
<Breadcrumb v-if="appStore.theme.isBreadcrumb" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Hamburger from './components/Hamburger.vue'
|
||||
import Refresh from './components/Refresh.vue'
|
||||
import Breadcrumb from './components/Breadcrumb.vue'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar-left {
|
||||
flex: 1;
|
||||
height: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<div class="navbar-right">
|
||||
<Lang />
|
||||
<ComponentSize />
|
||||
<a href="https://maku.net" target="_blank">
|
||||
<ma-icon icon="icon-earth"></ma-icon>
|
||||
</a>
|
||||
<a href="https://github.com/makunet/maku-admin" target="_blank">
|
||||
<ma-icon icon="icon-github-fill"></ma-icon>
|
||||
</a>
|
||||
<a href="https://gitee.com/makunet/maku-admin" target="_blank">
|
||||
<ma-icon icon="icon-gitee-fill-round"></ma-icon>
|
||||
</a>
|
||||
<Search />
|
||||
<Fullscreen />
|
||||
<User />
|
||||
<ThemeSettings />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Lang from './components/Lang.vue'
|
||||
import Search from './components/Search.vue'
|
||||
import ComponentSize from './components/ComponentSize.vue'
|
||||
import Fullscreen from './components/Fullscreen.vue'
|
||||
import User from './components/User.vue'
|
||||
import ThemeSettings from './components/ThemeSettings.vue'
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
&-link {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
&-photo {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<template>
|
||||
<el-breadcrumb separator="/" :separator-icon="ArrowRight" class="navbar-breadcrumb">
|
||||
<el-breadcrumb-item key="home">
|
||||
<span>{{ $t('home') }}</span>
|
||||
</el-breadcrumb-item>
|
||||
<el-breadcrumb-item v-for="(item, index) in breadcrumb" :key="index">
|
||||
<span>{{ item }}</span>
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ArrowRight } from '@element-plus/icons-vue'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const breadcrumb = computed(() => route.meta.breadcrumb)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar-breadcrumb {
|
||||
::v-deep(.el-breadcrumb__inner) {
|
||||
color: var(--theme-header-text-color) !important;
|
||||
}
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<el-dropdown trigger="click" @command="componentSizeChange">
|
||||
<ma-icon icon="icon-font-size"></ma-icon>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="large" :disabled="componentSize === 'large'">{{ $t('app.large') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="default" :disabled="componentSize === 'default'">{{ $t('app.default') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="small" :disabled="componentSize === 'small'">{{ $t('app.small') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const componentSize = computed(() => appStore.componentSize)
|
||||
const componentSizeChange = (size: string) => {
|
||||
appStore.setComponentSize(size)
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<template>
|
||||
<ma-icon :icon="isFullscreen ? 'icon-compress' : 'icon-expend'" @click="toggle" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
|
||||
const { isFullscreen, toggle } = useFullscreen()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<div @click="handleClick">
|
||||
<ma-icon :icon="icon"></ma-icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const screenWidth = ref(0)
|
||||
|
||||
const handleClick = () => {
|
||||
appStore.setSidebarOpened()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', () => {
|
||||
screenWidth.value = document.body.clientWidth
|
||||
})
|
||||
})
|
||||
|
||||
watch(screenWidth, (value, oldValue) => {
|
||||
if (oldValue > value && value < 1000) {
|
||||
appStore.setSidebarStatus(false)
|
||||
} else if (oldValue < value && value > 1000) {
|
||||
appStore.setSidebarStatus(true)
|
||||
}
|
||||
})
|
||||
const icon = computed(() => (appStore.sidebarOpened ? 'icon-outdent' : 'icon-indent'))
|
||||
</script>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<el-dropdown trigger="click" @command="languageChange">
|
||||
<ma-icon icon="icon-translate"></ma-icon>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="language in languages" :key="language" :disabled="locale === language" :command="language">
|
||||
{{ messages[language].langName }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { messages } from '@/i18n'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const languages = Object.keys(messages)
|
||||
|
||||
const { locale } = useI18n()
|
||||
const languageChange = (language: string) => {
|
||||
appStore.setLanguage(language)
|
||||
locale.value = language
|
||||
|
||||
// 刷新页面
|
||||
window.location.reload()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<ma-icon icon="icon-reload" @click="refresh"></ma-icon>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useTabsStore } from '@/store/modules/tabs'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { nextTick } from 'vue'
|
||||
|
||||
const tabsStore = useTabsStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const refresh = () => {
|
||||
tabsStore.delCachedView(route).then(() => {
|
||||
nextTick(() => {
|
||||
router.replace({ path: '/redirect' + route.path }).catch(err => {
|
||||
console.warn(err)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<template>
|
||||
<div class="navbar-search">
|
||||
<ma-icon icon="icon-search" @click="openSearch"></ma-icon>
|
||||
<el-dialog v-model="visible" :width="280" :destroy-on-close="true" :modal="false" fullscreen :show-close="false">
|
||||
<el-autocomplete
|
||||
ref="menuAutocompleteRef"
|
||||
v-model="menuValue"
|
||||
size="large"
|
||||
:prefix-icon="Search"
|
||||
:fetch-suggestions="menuSearch"
|
||||
placeholder="菜单搜索"
|
||||
@select="handleSelect"
|
||||
@blur="handleBlur"
|
||||
>
|
||||
<template #default="{ item }">
|
||||
<ma-icon :icon="item.meta.icon" />
|
||||
{{ item.meta.title }}
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { nextTick, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouterStore } from '@/store/modules/router'
|
||||
|
||||
const routerStore = useRouterStore()
|
||||
const router = useRouter()
|
||||
const menuAutocompleteRef = ref()
|
||||
const visible = ref(false)
|
||||
const menuValue = ref('')
|
||||
|
||||
const openSearch = () => {
|
||||
visible.value = true
|
||||
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
menuAutocompleteRef.value.focus()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
interface Restaurant {
|
||||
path: string
|
||||
meta: {
|
||||
title: string
|
||||
}
|
||||
}
|
||||
|
||||
// 获取菜单列表
|
||||
const menuList = routerStore.searchMenu
|
||||
|
||||
// 菜单搜索
|
||||
const menuSearch = (queryString: string, cb: any) => {
|
||||
const results = queryString ? menuList.filter(createFilter(queryString)) : menuList
|
||||
cb(results)
|
||||
}
|
||||
|
||||
const createFilter: any = (queryString: string) => {
|
||||
return (restaurant: Restaurant) => {
|
||||
return (
|
||||
restaurant.path.toLowerCase().indexOf(queryString.toLowerCase()) > -1 ||
|
||||
restaurant.meta.title.toLowerCase().indexOf(queryString.toLowerCase()) > -1
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSelect = (item: Restaurant) => {
|
||||
router.push(item.path)
|
||||
visible.value = false
|
||||
}
|
||||
const handleBlur = () => {
|
||||
visible.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar-search {
|
||||
:deep(.el-dialog) {
|
||||
box-shadow: unset !important;
|
||||
border-radius: 0 !important;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
:deep(.el-autocomplete) {
|
||||
width: 560px;
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<template>
|
||||
<div>
|
||||
<ma-icon icon="icon-ellipsis-v" @click="themeSettingsHandle"></ma-icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import emits from '@/utils/emits'
|
||||
const themeSettingsHandle = () => {
|
||||
emits.emit('openThemeSettings')
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<el-dropdown class="avatar-container" trigger="hover">
|
||||
<div class="avatar-wrapper">
|
||||
<el-avatar shape="circle" :size="30" :src="userStore.user.avatar"></el-avatar>
|
||||
<span>{{ userStore.user.realName }}</span>
|
||||
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="user-dropdown">
|
||||
<router-link to="/profile">
|
||||
<el-dropdown-item> {{ $t('app.profile') }} </el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item divided @click="logout"> {{ $t('app.signOut') }} </el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
|
||||
const logout = () => {
|
||||
userStore.logoutAction().then(() => {
|
||||
// router.push({ path: '/login' })
|
||||
|
||||
// 刷新页面
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.avatar-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
height: var(--theme-header-height);
|
||||
.avatar-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
padding: 0 8px;
|
||||
color: var(--theme-header-text-color);
|
||||
span {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
//&:hover {
|
||||
// background: var(--theme-header-hover-color);
|
||||
//}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<template>
|
||||
<el-card v-loading="loading">
|
||||
<iframe :src="url" class="iframe" @load="load"></iframe>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { RouteLocationNormalizedLoaded, useRoute } from 'vue-router'
|
||||
import { replaceLinkParam } from '@/utils/tool'
|
||||
|
||||
const route = useRoute()
|
||||
const url = ref('')
|
||||
const loading = ref(false)
|
||||
|
||||
watch(
|
||||
() => route,
|
||||
value => {
|
||||
if (value.path === '/iframe') {
|
||||
initUrl(value)
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
initUrl(route)
|
||||
})
|
||||
const initUrl = (route: RouteLocationNormalizedLoaded): void => {
|
||||
loading.value = true
|
||||
|
||||
const { meta, query } = route
|
||||
if (query.url) {
|
||||
url.value = query.url as string
|
||||
} else {
|
||||
url.value = replaceLinkParam(meta.url as string)
|
||||
}
|
||||
}
|
||||
const load = () => {
|
||||
loading.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iframe {
|
||||
min-height: calc(100vh - 70px - var(--theme-header-height));
|
||||
width: 100%;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<script lang="ts">
|
||||
import { defineComponent, h } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
export default defineComponent({
|
||||
created() {
|
||||
const { params, query } = useRoute()
|
||||
const { path } = params
|
||||
const router = useRouter()
|
||||
router.replace({ path: '/' + path, query }).catch(err => {
|
||||
console.warn(err)
|
||||
})
|
||||
},
|
||||
render() {
|
||||
return h('div')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<div class="settings-select">
|
||||
<span> {{ title }}</span>
|
||||
<el-select :model-value="modelValue" size="default" style="width: 100px" :disabled="disabled" @change="handleChange($event)">
|
||||
<el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
|
||||
defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
options: {
|
||||
type: Array as PropType<any[]>,
|
||||
required: true,
|
||||
default: () => []
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
const handleChange = (val: any) => {
|
||||
emit('update:modelValue', val)
|
||||
emit('change')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.settings-select {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<div class="settings-switch">
|
||||
<span> {{ title }}</span>
|
||||
<el-switch :model-value="modelValue" :disabled="disabled" @change="handleChange($event)"></el-switch>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
const handleChange = (val: boolean) => {
|
||||
emit('update:modelValue', val)
|
||||
emit('change')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.settings-switch {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 15px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,384 @@
|
|||
<template>
|
||||
<div class="navbar-settings">
|
||||
<ma-icon icon="icon-ellipsis-v" @click="visible = true"></ma-icon>
|
||||
<el-drawer v-model="visible" :title="$t('settings.title')" :destroy-on-close="true" :size="280">
|
||||
<el-scrollbar class="settings-container">
|
||||
<el-space direction="vertical" alignment="flex-start">
|
||||
<el-space>
|
||||
<el-tooltip key="dark" effect="dark" :content="$t('settings.sidebarDark')" placement="top">
|
||||
<div
|
||||
class="settings-box-item item-left-dark"
|
||||
:class="theme.sidebarStyle === 'dark' ? 'active' : ''"
|
||||
@click="handleSidebarTheme('dark')"
|
||||
></div>
|
||||
</el-tooltip>
|
||||
<el-tooltip key="light" effect="dark" :content="$t('settings.sidebarLight')" placement="top">
|
||||
<div
|
||||
class="settings-box-item item-left-light"
|
||||
:class="theme.sidebarStyle === 'light' ? 'active' : ''"
|
||||
@click="handleSidebarTheme('light')"
|
||||
></div>
|
||||
</el-tooltip>
|
||||
</el-space>
|
||||
<el-space>
|
||||
<el-tooltip key="light" effect="dark" :content="$t('settings.navbarLight')" placement="top">
|
||||
<div
|
||||
class="settings-box-item item-top-light"
|
||||
:class="theme.headerStyle === 'light' ? 'active' : ''"
|
||||
@click="handleHeaderTheme('light')"
|
||||
></div>
|
||||
</el-tooltip>
|
||||
<el-tooltip key="auto" effect="dark" :content="$t('settings.navbarTheme')" placement="top">
|
||||
<div
|
||||
class="settings-box-item item-top-theme"
|
||||
:class="theme.headerStyle === 'theme' ? 'active' : ''"
|
||||
@click="handleHeaderTheme('theme')"
|
||||
></div>
|
||||
</el-tooltip>
|
||||
</el-space>
|
||||
<el-space :size="2" wrap>
|
||||
<div v-for="color in colors" :key="color">
|
||||
<span
|
||||
class="theme-color"
|
||||
:class="theme.primaryColor === color ? 'active' : ''"
|
||||
:style="`background-color: ${color}`"
|
||||
@click="handleThemeColor(color)"
|
||||
></span>
|
||||
</div>
|
||||
</el-space>
|
||||
</el-space>
|
||||
|
||||
<el-divider content-position="left">{{ $t('settings.layout') }}</el-divider>
|
||||
|
||||
<!-- 布局切换 -->
|
||||
<el-space>
|
||||
<el-tooltip key="dark" effect="dark" placement="top" :content="$t('settings.vertical')">
|
||||
<div
|
||||
class="settings-box-item item-vertical"
|
||||
:class="theme.layout === 'vertical' ? 'active' : ''"
|
||||
@click="handleLayoutTheme('vertical')"
|
||||
></div>
|
||||
</el-tooltip>
|
||||
<el-tooltip key="light" effect="dark" placement="top" :content="$t('settings.columns')">
|
||||
<div class="settings-box-item item-columns" :class="theme.layout === 'columns' ? 'active' : ''" @click="handleLayoutTheme('columns')">
|
||||
<div class="columns-tips-box"></div>
|
||||
<div class="columns-sub-menu"></div>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<el-tooltip key="light" effect="dark" placement="top" :content="$t('settings.transverse')">
|
||||
<div
|
||||
class="settings-box-item item-transverse"
|
||||
:class="theme.layout === 'transverse' ? 'active' : ''"
|
||||
@click="handleLayoutTheme('transverse')"
|
||||
></div>
|
||||
</el-tooltip>
|
||||
</el-space>
|
||||
|
||||
<el-divider content-position="left">{{ $t('settings.interface') }}</el-divider>
|
||||
|
||||
<SwitchItem v-model="isDark" :title="$t('settings.dark')" />
|
||||
<SwitchItem v-model="theme.uniqueOpened" :title="$t('settings.uniqueOpened')" @change="handleOtherTheme" />
|
||||
<SwitchItem v-model="theme.isLogo" :title="$t('settings.logo')" @change="handleOtherTheme" />
|
||||
<SwitchItem v-model="theme.isBreadcrumb" :title="$t('settings.breadcrumb')" @change="handleOtherTheme" />
|
||||
<SwitchItem v-model="theme.isTabsView" :title="$t('settings.tabs')" @change="handleOtherTheme" />
|
||||
<SwitchItem v-model="theme.isTabsCache" :title="$t('settings.tabsCache')" @change="handleOtherTheme" />
|
||||
<SelectItem v-model="theme.tabsStyle" :title="$t('settings.tabsStyle')" :options="tabsStyle" @change="handleOtherTheme" />
|
||||
|
||||
<el-divider />
|
||||
|
||||
<el-space direction="vertical">
|
||||
<el-alert :title="$t('settings.tips')" type="warning" :closable="false"> </el-alert>
|
||||
<div class="config-btn">
|
||||
<el-button type="primary" size="default" :icon="CopyDocument" @click="handleCopyConfig">
|
||||
{{ $t('settings.copyConfig') }}
|
||||
</el-button>
|
||||
<el-button type="info" size="default" :icon="RefreshRight" @click="handleResetConfig">
|
||||
{{ $t('settings.reset') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-space>
|
||||
</el-scrollbar>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { CopyDocument, RefreshRight } from '@element-plus/icons-vue'
|
||||
import { useClipboard, useDark } from '@vueuse/core'
|
||||
import SwitchItem from './components/SwitchItem.vue'
|
||||
import SelectItem from './components/SelectItem.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { handleThemeStyle } from '@/utils/theme'
|
||||
import cache from '@/utils/cache'
|
||||
import emits from '@/utils/emits'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const { t } = useI18n()
|
||||
const { copy } = useClipboard()
|
||||
|
||||
// 是否显示
|
||||
const visible = ref(false)
|
||||
emits.on('openThemeSettings', () => (visible.value = true))
|
||||
|
||||
const colors = [
|
||||
'#409eff',
|
||||
'#0BB2D4',
|
||||
'#3E8EF7',
|
||||
'#11C26D',
|
||||
'#17B3A3',
|
||||
'#667AFA',
|
||||
'#997B71',
|
||||
'#9463F7',
|
||||
'#757575',
|
||||
'#EB6709',
|
||||
'#F74584',
|
||||
'#FCB900',
|
||||
'#FF4C52'
|
||||
]
|
||||
|
||||
const tabsStyle = [
|
||||
{ label: t('settings.style1'), value: 'style-1' },
|
||||
{ label: t('settings.style2'), value: 'style-2' }
|
||||
]
|
||||
|
||||
// 默认主题
|
||||
const theme = computed(() => appStore.theme)
|
||||
|
||||
// 处理布局切换
|
||||
const handleLayoutTheme = (layout: string) => {
|
||||
theme.value.layout = layout
|
||||
cache.setTheme(theme.value)
|
||||
}
|
||||
|
||||
// 处理侧边栏主题
|
||||
const handleSidebarTheme = (style: string) => {
|
||||
theme.value.sidebarStyle = style
|
||||
cache.setTheme(theme.value)
|
||||
}
|
||||
|
||||
// 处理顶栏主题
|
||||
const handleHeaderTheme = (style: string) => {
|
||||
theme.value.headerStyle = style
|
||||
cache.setTheme(theme.value)
|
||||
}
|
||||
|
||||
// 处理暗黑模式
|
||||
const isDark = useDark()
|
||||
|
||||
// 处理其他主题
|
||||
const handleOtherTheme = () => {
|
||||
cache.setTheme(theme.value)
|
||||
}
|
||||
|
||||
// 处理主题色
|
||||
const handleThemeColor = (color: string) => {
|
||||
theme.value.primaryColor = color
|
||||
cache.setTheme(theme.value)
|
||||
|
||||
handleThemeStyle(theme.value)
|
||||
}
|
||||
|
||||
// 复制配置
|
||||
const handleCopyConfig = () => {
|
||||
const config = JSON.stringify(theme.value, null, 2)
|
||||
copy(config)
|
||||
ElMessage.success(t('settings.copySuc'))
|
||||
}
|
||||
|
||||
// 恢复默认
|
||||
const handleResetConfig = async () => {
|
||||
cache.removeTheme()
|
||||
window.location.reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar-settings {
|
||||
::v-deep(.el-drawer) {
|
||||
--el-drawer-padding-primary: unset !important;
|
||||
}
|
||||
}
|
||||
.settings-container {
|
||||
padding: 15px;
|
||||
color: #444444;
|
||||
.settings-box-item {
|
||||
position: relative;
|
||||
width: 50px;
|
||||
height: 35px;
|
||||
margin: 0 20px 20px 0;
|
||||
background-color: rgb(240 242 245);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
cursor: pointer;
|
||||
&.active {
|
||||
&:after {
|
||||
content: '';
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--el-color-primary);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: -15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-left-light {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 33%;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-left-dark {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 33%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-top-light {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 33%;
|
||||
background-color: #fff;
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-top-theme {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 33%;
|
||||
background-color: var(--el-color-primary);
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.theme-color {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 8px 8px 0 0;
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
&.active {
|
||||
&:after {
|
||||
content: url('data:image/svg+xml;charset=utf-8,<svg width="14" height="14" color="rgb(255 255 255)" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-042ca774=""><path fill="currentColor" d="M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z"></path></svg>');
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -7px 0 0 -7px;
|
||||
font-size: 14px;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-vertical {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 33%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-columns {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
.columns-tips-box {
|
||||
transition: inherit;
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 20%;
|
||||
background-color: #333;
|
||||
content: '';
|
||||
height: 30%;
|
||||
width: 83%;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
.columns-sub-menu {
|
||||
transition: inherit;
|
||||
position: relative;
|
||||
width: 18%;
|
||||
top: 0;
|
||||
left: 20%;
|
||||
background-color: #999;
|
||||
content: '';
|
||||
height: 70%;
|
||||
}
|
||||
}
|
||||
|
||||
.item-transverse {
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 33%;
|
||||
background-color: #333;
|
||||
content: '';
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.config-btn {
|
||||
button {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-button + .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
<template>
|
||||
<div class="tabs-container">
|
||||
<div class="tabs-item">
|
||||
<el-tabs v-model="activeTabName" :class="tabsStyleClass" @tab-click="tabClick" @tab-remove="tabRemove">
|
||||
<el-tab-pane v-for="tab in tabsStore.visitedViews" :key="tab" :label="tab.title" :name="tab.path" :closable="!isAffix(tab)">
|
||||
<template #label>
|
||||
<el-dropdown
|
||||
:id="tab.path"
|
||||
ref="dropdownRef"
|
||||
trigger="contextmenu"
|
||||
placement="bottom-end"
|
||||
@visible-change="handleChange($event, tab)"
|
||||
@command="onClose"
|
||||
>
|
||||
<span>{{ tab.title }}</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :icon="Close" command="close">{{ $t('app.close') }}</el-dropdown-item>
|
||||
<el-dropdown-item :icon="CircleClose" command="closeOthers">{{ $t('app.closeOthers') }}</el-dropdown-item>
|
||||
<el-dropdown-item :icon="CircleCloseFilled" command="closeAll">{{ $t('app.closeAll') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-dropdown class="tabs-action" trigger="click" placement="bottom-end" @command="onClose">
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :icon="Close" command="close">{{ $t('app.close') }}</el-dropdown-item>
|
||||
<el-dropdown-item :icon="CircleClose" command="closeOthers">{{ $t('app.closeOthers') }}</el-dropdown-item>
|
||||
<el-dropdown-item :icon="CircleCloseFilled" command="closeAll">{{ $t('app.closeAll') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
<el-icon><arrow-down /></el-icon>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch, onMounted, ref, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { closeAllTabs, closeOthersTabs, closeTab } from '@/utils/tabs'
|
||||
import { ArrowDown, Close, CircleClose, CircleCloseFilled } from '@element-plus/icons-vue'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import { useRouterStore } from '@/store/modules/router'
|
||||
import { useTabsStore } from '@/store/modules/tabs'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const routerStore = useRouterStore()
|
||||
const tabsStore = useTabsStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const activeTabName = ref(route.path)
|
||||
const tabsStyleClass = computed(() => 'tabs-item-' + appStore.theme.tabsStyle)
|
||||
|
||||
// 是否固定
|
||||
const isAffix = (tab: any) => {
|
||||
return tab.meta && tab.meta.affix
|
||||
}
|
||||
|
||||
watch(route, () => {
|
||||
// 当前路由,添加到tabs里
|
||||
if (route.name) {
|
||||
addTab()
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// 初始化
|
||||
initTabs()
|
||||
addTab()
|
||||
})
|
||||
|
||||
// 初始化固定tab
|
||||
const initTabs = () => {
|
||||
const affixTabs = getAffixTabs(routerStore.routes)
|
||||
for (const tab of affixTabs) {
|
||||
// 需要有tab名称
|
||||
if (tab.name) {
|
||||
tabsStore.addView(tab)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取需要固定的tabs
|
||||
const getAffixTabs = (routes: any) => {
|
||||
let tabs: any[] = []
|
||||
routes.forEach((route: any) => {
|
||||
if (route.meta && route.meta.affix) {
|
||||
tabs.push({
|
||||
fullPath: route.path,
|
||||
path: route.path,
|
||||
name: route.name,
|
||||
meta: { ...route.meta }
|
||||
})
|
||||
}
|
||||
if (route.children) {
|
||||
const tempTabs = getAffixTabs(route.children)
|
||||
if (tempTabs.length >= 1) {
|
||||
tabs = [...tabs, ...tempTabs]
|
||||
}
|
||||
}
|
||||
})
|
||||
return tabs
|
||||
}
|
||||
|
||||
// 添加tab
|
||||
const addTab = () => {
|
||||
tabsStore.addView(route)
|
||||
tabsStore.addCachedView(route)
|
||||
activeTabName.value = route.path
|
||||
}
|
||||
|
||||
// tab被选中
|
||||
const tabClick = (tab: any) => {
|
||||
tab.props.name && router.push(tab.props.name)
|
||||
}
|
||||
|
||||
// 点击关闭tab
|
||||
const tabRemove = (path: string) => {
|
||||
const tab = tabsStore.visitedViews.filter((tab: any) => tab.path === path)
|
||||
closeTab(router, tab[0])
|
||||
}
|
||||
|
||||
// dropdown 关闭事件
|
||||
const onClose = (type: string) => {
|
||||
switch (type) {
|
||||
case 'close':
|
||||
closeTab(router, route)
|
||||
break
|
||||
case 'closeOthers':
|
||||
closeOthersTabs(router, route)
|
||||
break
|
||||
case 'closeAll':
|
||||
closeAllTabs(router, route)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 保证右键标签页只会弹出当前一个下拉框
|
||||
const dropdownRef = ref()
|
||||
const handleChange = (visible: boolean, tab: any) => {
|
||||
if (!visible) {
|
||||
return
|
||||
}
|
||||
dropdownRef.value.forEach((item: { id: string; handleClose: () => void }) => {
|
||||
if (item.id === tab.path) {
|
||||
return
|
||||
}
|
||||
item.handleClose()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tabs-container {
|
||||
display: flex;
|
||||
position: relative;
|
||||
z-index: 6;
|
||||
height: 40px;
|
||||
background-color: #fff;
|
||||
.tabs-item {
|
||||
transition: left 0.3s;
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
::v-deep(.el-tabs__nav-prev) {
|
||||
padding: 0 10px;
|
||||
border-right: var(--el-border-color-extra-light) 1px solid;
|
||||
}
|
||||
::v-deep(.el-tabs__nav-next) {
|
||||
padding: 0 10px;
|
||||
border-left: var(--el-border-color-extra-light) 1px solid;
|
||||
}
|
||||
::v-deep(.is-scrollable) {
|
||||
padding: 0 32px;
|
||||
}
|
||||
::v-deep(.el-tabs__active-bar) {
|
||||
height: 0;
|
||||
}
|
||||
::v-deep(.el-tabs__item) {
|
||||
.is-icon-close {
|
||||
transition: none !important;
|
||||
&:hover {
|
||||
color: var(--el-color-primary-light-9);
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.tabs-item-style-1 {
|
||||
::v-deep(.el-tabs__item) {
|
||||
padding: 0 15px !important;
|
||||
border-right: var(--el-border-color-extra-light) 1px solid;
|
||||
user-select: none;
|
||||
color: #8c8c8c;
|
||||
&:hover {
|
||||
color: #444;
|
||||
background: rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
&.is-active {
|
||||
.el-dropdown {
|
||||
color: var(--el-color-primary) !important;
|
||||
}
|
||||
color: var(--el-color-primary);
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
border-bottom: var(--el-border-color-light) 2px solid;
|
||||
&:before {
|
||||
background-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
&:before {
|
||||
content: '';
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
margin-right: 8px;
|
||||
display: inline-block;
|
||||
background-color: #ddd;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.tabs-item-style-2 {
|
||||
::v-deep(.el-tabs__item) {
|
||||
padding: 0 15px !important;
|
||||
border-right: none;
|
||||
user-select: none;
|
||||
color: #8c8c8c;
|
||||
//display: inline-block;
|
||||
|
||||
&:hover {
|
||||
color: #444;
|
||||
background: rgba(0, 0, 0, 0.02);
|
||||
border-bottom: var(--el-color-primary) 2px solid;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
.el-dropdown {
|
||||
color: var(--el-color-primary) !important;
|
||||
}
|
||||
color: var(--el-color-primary) !important;
|
||||
background-color: var(--el-color-primary-light-9) !important;
|
||||
border-bottom: var(--el-color-primary) 2px solid;
|
||||
&:before {
|
||||
background-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.tabs-action {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 12px;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
color: #666;
|
||||
border-left: var(--el-border-color-extra-light) 1px solid;
|
||||
border-bottom: var(--el-border-color-light) 2px solid;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
<template>
|
||||
<el-container class="layout-container layout-columns">
|
||||
<el-aside class="layout-sidebar aside-expend" :class="sidebarClass">
|
||||
<div class="sidebar-logo">
|
||||
<el-avatar src="./favicon.ico"></el-avatar>
|
||||
</div>
|
||||
<el-scrollbar>
|
||||
<div class="columns-menu">
|
||||
<div
|
||||
v-for="menu in routerStore.menuRoutes"
|
||||
:key="menu.path"
|
||||
class="columns-menu-item"
|
||||
:class="{ active: menuPath === menu.path }"
|
||||
@click="handleMenu(menu)"
|
||||
>
|
||||
<ma-icon :icon="menu.meta?.icon"></ma-icon>
|
||||
<span class="title">{{ menu.meta?.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-header class="layout-header" :style="layoutHeaderHeight">
|
||||
<div class="navbar-container" :class="headerClass">
|
||||
<NavbarLeft />
|
||||
<NavbarRight />
|
||||
</div>
|
||||
</el-header>
|
||||
<div class="layout-main">
|
||||
<div v-if="subMenus.length > 0 && appStore.sidebarOpened" class="columns-sub-menu">
|
||||
<el-menu
|
||||
:default-active="defaultActive"
|
||||
:collapse="!appStore.sidebarOpened"
|
||||
:unique-opened="appStore.theme.uniqueOpened"
|
||||
background-color="transparent"
|
||||
:collapse-transition="false"
|
||||
mode="vertical"
|
||||
>
|
||||
<menu-item v-for="menu in subMenus" :key="menu.path" :menu="menu"></menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<Tabs v-if="theme.isTabsView" />
|
||||
<Main />
|
||||
</div>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouterStore } from '@/store/modules/router'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import NavbarLeft from '@/layout/components/Navbar/NavbarLeft.vue'
|
||||
import NavbarRight from '@/layout/components/Navbar/NavbarRight.vue'
|
||||
import Main from '@/layout/components/Main/index.vue'
|
||||
import Tabs from '@/layout/components/Tabs/index.vue'
|
||||
import MenuItem from '@/layout/components/Menu/MenuItem.vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { RouteRecordRaw, useRoute, useRouter } from 'vue-router'
|
||||
|
||||
const routerStore = useRouterStore()
|
||||
const appStore = useAppStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const defaultActive = computed(() => {
|
||||
const { path } = route
|
||||
return path
|
||||
})
|
||||
|
||||
const subMenus = ref<any[]>([])
|
||||
watch(route, () => {
|
||||
subMenus.value = []
|
||||
initSubMenu()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
initSubMenu()
|
||||
})
|
||||
|
||||
const menuPath = ref<string>('')
|
||||
const initSubMenu = () => {
|
||||
menuPath.value = defaultActive.value
|
||||
for (const menu of routerStore.menuRoutes) {
|
||||
// 是否包含当前路由
|
||||
const exist = findRoute(menu.children as RouteRecordRaw[])
|
||||
if (exist) {
|
||||
subMenus.value = menu.children as RouteRecordRaw[]
|
||||
|
||||
menuPath.value = menu.path
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const findRoute = (menus: RouteRecordRaw[]): boolean => {
|
||||
for (const menu of menus) {
|
||||
// 有子菜单的情况
|
||||
if (menu.children && menu.children.length > 0) {
|
||||
if (findRoute(menu.children)) {
|
||||
return true
|
||||
}
|
||||
} else if (menu.path === defaultActive.value) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const handleMenu = (menu: any) => {
|
||||
if (menu.children && menu.children.length > 0) {
|
||||
const leafRoute = findLeafRoute(menu.children)
|
||||
router.push(leafRoute.path)
|
||||
} else {
|
||||
router.push(menu.path)
|
||||
}
|
||||
}
|
||||
|
||||
const findLeafRoute = (menus: RouteRecordRaw[]): any => {
|
||||
for (const menu of menus) {
|
||||
// 有子菜单的情况
|
||||
if (menu.children && menu.children.length > 0) {
|
||||
return findLeafRoute(menu.children)
|
||||
} else {
|
||||
return menu
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const headerClass = computed(() => (appStore.theme.headerStyle === 'theme' ? 'header-theme' : ''))
|
||||
|
||||
const sidebarClass = computed(() => {
|
||||
return appStore.theme.sidebarStyle === 'dark' ? 'sidebar-dark' : ''
|
||||
})
|
||||
|
||||
const theme = computed(() => appStore.theme)
|
||||
const layoutHeaderHeight = computed(() => {
|
||||
if (!theme.value.isTabsView) {
|
||||
return 'height:var(--theme-header-height) !important'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sidebar-logo {
|
||||
height: var(--theme-header-height);
|
||||
line-height: var(--theme-header-height);
|
||||
border-bottom: var(--theme-border-color-light) 1px solid;
|
||||
text-align: center;
|
||||
.el-avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.columns-menu {
|
||||
flex: 1;
|
||||
.columns-menu-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 70px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
&:hover {
|
||||
background-color: var(--el-color-primary);
|
||||
}
|
||||
::v-deep(.ma-icon) {
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
svg {
|
||||
font-size: 21px;
|
||||
color: var(--theme-menu-text-color) !important;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--theme-menu-text-color);
|
||||
}
|
||||
}
|
||||
.active {
|
||||
background-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.layout-sidebar {
|
||||
&.aside-expend {
|
||||
width: 75px !important;
|
||||
}
|
||||
::v-deep(.el-menu-item) {
|
||||
padding-left: 6px !important;
|
||||
padding-right: 10px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.layout-header {
|
||||
height: var(--theme-header-height) !important;
|
||||
border-bottom: 1px solid #8c8c8c !important;
|
||||
}
|
||||
.layout-main {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.el-menu {
|
||||
border-right: none !important;
|
||||
}
|
||||
.el-menu-item {
|
||||
height: 40px !important;
|
||||
line-height: 40px !important;
|
||||
font-size: 14px !important;
|
||||
color: var(--theme-menu-text-color) !important;
|
||||
&:hover {
|
||||
color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
.el-menu-item.is-active {
|
||||
border-right: none;
|
||||
right: 0;
|
||||
color: var(--theme-menu-hover-color) !important;
|
||||
}
|
||||
}
|
||||
.column-menu {
|
||||
display: block;
|
||||
}
|
||||
.columns-sub-menu {
|
||||
width: 120px;
|
||||
height: 100%;
|
||||
display: block;
|
||||
float: left;
|
||||
border-right: var(--theme-border-color-light) 1px solid;
|
||||
background: #fff;
|
||||
}
|
||||
.navbar-container {
|
||||
height: var(--theme-header-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: var(--theme-header-bg-color);
|
||||
border-bottom: 1px solid var(--theme-border-color-light);
|
||||
color: var(--theme-header-text-color);
|
||||
::v-deep(.ma-icon) {
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
height: var(--theme-header-height);
|
||||
line-height: var(--theme-header-height);
|
||||
padding: 0 12px;
|
||||
svg {
|
||||
color: var(--theme-header-text-color) !important;
|
||||
font-size: 16px;
|
||||
}
|
||||
&:hover {
|
||||
background: var(--theme-header-hover-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<template>
|
||||
<el-container class="layout-container layout-transverse">
|
||||
<el-header class="navbar-container" :class="headerClass">
|
||||
<div style="display: flex">
|
||||
<Logo v-if="theme.isLogo" />
|
||||
<el-menu :default-active="defaultActive" background-color="transparent" :collapse-transition="false" mode="horizontal">
|
||||
<menu-item v-for="menu in routerStore.menuRoutes" :key="menu.path" :menu="menu"></menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<NavbarRight />
|
||||
</el-header>
|
||||
<Tabs v-if="theme.isTabsView" />
|
||||
<Main />
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import NavbarRight from '@/layout/components/Navbar/NavbarRight.vue'
|
||||
import Main from '@/layout/components/Main/index.vue'
|
||||
import Tabs from '@/layout/components/Tabs/index.vue'
|
||||
import Logo from '@/layout/components/Logo/index.vue'
|
||||
import MenuItem from '@/layout/components/Menu/MenuItem.vue'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useRouterStore } from '@/store/modules/router'
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const routerStore = useRouterStore()
|
||||
const theme = computed(() => appStore.theme)
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const defaultActive = computed(() => {
|
||||
const { path } = route
|
||||
return path
|
||||
})
|
||||
|
||||
const headerClass = computed(() => (appStore.theme.headerStyle === 'theme' ? 'header-theme' : ''))
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.layout-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.el-header {
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
.navbar-container {
|
||||
height: var(--theme-header-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: var(--theme-header-bg-color);
|
||||
border-bottom: 1px solid var(--theme-border-color-light);
|
||||
color: var(--theme-header-text-color);
|
||||
::v-deep(.el-sub-menu__title) {
|
||||
&:hover {
|
||||
background: var(--theme-header-hover-color) !important;
|
||||
}
|
||||
}
|
||||
::v-deep(.ma-icon) {
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
height: var(--theme-header-height);
|
||||
line-height: var(--theme-header-height);
|
||||
padding: 0 12px;
|
||||
svg {
|
||||
font-size: 16px;
|
||||
}
|
||||
&:hover {
|
||||
background: var(--theme-header-hover-color);
|
||||
}
|
||||
}
|
||||
.el-menu {
|
||||
max-width: 800px;
|
||||
height: var(--theme-header-height);
|
||||
line-height: var(--theme-header-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
//margin-left: 20px;
|
||||
::v-deep(.ma-icon) {
|
||||
&:hover {
|
||||
background: none !important;
|
||||
}
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||