|
@ -0,0 +1,5 @@
|
|||
*.js linguist-language=vue
|
||||
|
||||
*.css linguist-language=vue
|
||||
|
||||
*.html linguist-language=vue
|
|
@ -0,0 +1,35 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/build/
|
||||
/nbbuild/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
/dist/
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is 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. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
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.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
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 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. Use with the GNU Affero General Public License.
|
||||
|
||||
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 Affero 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 special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 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 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 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 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
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 GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
@ -0,0 +1,11 @@
|
|||
export default {
|
||||
development: {
|
||||
baseUrl: '/api' // 测试接口域名
|
||||
},
|
||||
beta: {
|
||||
baseUrl: '/api' // 测试接口域名
|
||||
},
|
||||
release: {
|
||||
baseUrl: '/api' // 正式接口域名
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'vue3-admin',
|
||||
script: 'vue3-admin-server.js'
|
||||
},
|
||||
],
|
||||
deploy: {
|
||||
production: {
|
||||
user: 'root',
|
||||
host: '47.99.134.126',
|
||||
ref: 'origin/main',
|
||||
repo: 'git@git.zhlh6.cn:newbee-ltd/vue3-admin.git',
|
||||
path: '/workspace/vue3-admin',
|
||||
'post-deploy': 'git reset --hard && git checkout main && git pull && npm i --production=false && pm2 startOrReload ecosystem.config.js', // -production=false 下载全量包
|
||||
env: {
|
||||
NODE_ENV: 'production'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" href="./favicon.ico">
|
||||
<title>vue3-admin</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="https://s.yezgea02.com/1609305532675/echarts.js"></script>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "vue3-admin",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite --mode development --host=0.0.0.0",
|
||||
"build:beta": "vite build --mode beta",
|
||||
"build:release": "vite build --mode release",
|
||||
"serve": "vite preview",
|
||||
"tauri": "tauri",
|
||||
"pd": "pbjs -t static-module -w es6 -o ./src/proto/data/pd.js ./src/proto/*.proto"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"@sentry/browser": "^6.3.1",
|
||||
"@sentry/tracing": "^6.3.1",
|
||||
"axios": "^0.21.1",
|
||||
"echarts": "^5.4.2",
|
||||
"element-plus": "^2.3.4",
|
||||
"js-base64": "^3.7.5",
|
||||
"js-md5": "^0.7.3",
|
||||
"moment": "^2.29.4",
|
||||
"protobufjs": "^7.2.4",
|
||||
"protobufjs-cli": "^1.1.2",
|
||||
"pushstate-server": "^3.1.0",
|
||||
"sass": "^1.32.8",
|
||||
"sass-loader": "^10.1.1",
|
||||
"vue": "^3.0.5",
|
||||
"vue-router": "^4.0.4",
|
||||
"vue3-cron-plus": "^0.1.9",
|
||||
"vuex": "^4.0.2",
|
||||
"vuex-persistedstate": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.13.8",
|
||||
"@babel/runtime": "^7.13.8",
|
||||
"@rollup/plugin-babel": "^5.3.0",
|
||||
"@tauri-apps/cli": "^1.2.3",
|
||||
"@vitejs/plugin-vue": "^1.1.4",
|
||||
"@vue/compiler-sfc": "^3.0.5",
|
||||
"babel": "^6.23.0",
|
||||
"babel-plugin-component": "^1.1.1",
|
||||
"babel-plugin-import": "^1.13.3",
|
||||
"vite": "^2.0.1",
|
||||
"vite-babel-plugin": "^0.0.2",
|
||||
"vite-plugin-babel-import": "^2.0.2",
|
||||
"vite-plugin-imp": "^2.0.4"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 33 KiB |
|
@ -0,0 +1,133 @@
|
|||
<template>
|
||||
<div class="layout">
|
||||
<el-container v-if="state.showMenu" class="container">
|
||||
<!-- <Sidebar :currentPath="state.currentPath"></Sidebar> -->
|
||||
<el-container class="content">
|
||||
<Header />
|
||||
<div class="main">
|
||||
<router-view />
|
||||
</div>
|
||||
<!-- <Footer /> -->
|
||||
</el-container>
|
||||
</el-container>
|
||||
<el-container v-else class="container">
|
||||
<router-view />
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onUnmounted, reactive } from 'vue'
|
||||
import Header from '@/components/Header.vue'
|
||||
import Footer from '@/components/Footer.vue'
|
||||
import Sidebar from '@/components/Sidebar.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { pathMap, localGet } from '@/utils';
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
Header,
|
||||
Footer,
|
||||
Sidebar
|
||||
},
|
||||
setup() {
|
||||
const noMenu = ['/login']
|
||||
const router = useRouter();
|
||||
const state = reactive({
|
||||
defaultOpen: ['1', '2', '3', '4'],
|
||||
showMenu: true,
|
||||
currentPath: '/dashboard'
|
||||
})
|
||||
// 监听浏览器原生回退事件
|
||||
if (window.history && window.history.pushState) {
|
||||
history.pushState(null, null, document.URL);
|
||||
window.addEventListener('popstate', () => {
|
||||
if (!localGet('token')) {
|
||||
state.showMenu = false
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
const unwatch = router.beforeEach((to, from, next) => {
|
||||
if (to.path == '/login') {
|
||||
// 如果路径是 /login 则正常执行
|
||||
next()
|
||||
} else {
|
||||
// 如果不是 /login,判断是否有 token
|
||||
if (!localGet('token')) {
|
||||
// 如果没有,则跳至登录页面
|
||||
next({ path: '/login' })
|
||||
} else {
|
||||
// 否则继续执行
|
||||
next()
|
||||
}
|
||||
}
|
||||
state.showMenu = !noMenu.includes(to.path)
|
||||
state.currentPath = to.path
|
||||
document.title = pathMap[to.name]
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
unwatch();
|
||||
})
|
||||
|
||||
return {
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.layout {
|
||||
min-height: 100vh;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.container {
|
||||
height: 100vh;
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.main {
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
::v-deep .el-card__body {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.el-menu {
|
||||
border-right: none!important;
|
||||
}
|
||||
.el-submenu {
|
||||
border-top: 1px solid hsla(0, 0%, 100%, .05);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, .2);
|
||||
}
|
||||
.el-submenu:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
.el-submenu [class^="el-icon-"] {
|
||||
vertical-align: -1px!important;
|
||||
}
|
||||
a {
|
||||
color: #409eff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.el-pagination {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.el-popper__arrow {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,134 @@
|
|||
import {
|
||||
getRequest,
|
||||
postJsonRequest,
|
||||
deleteRequest,
|
||||
putRequest,
|
||||
} from "@/utils/axios";
|
||||
const infoApi = {
|
||||
// 获取设备信息
|
||||
getSys(params) {
|
||||
return getRequest("/info", params);
|
||||
},
|
||||
// 获取网络信息
|
||||
getNet(params) {
|
||||
return getRequest("/net", params);
|
||||
},
|
||||
saveNet(params) {
|
||||
return putRequest("/net", params);
|
||||
},
|
||||
reboot() {
|
||||
return postJsonRequest("/reboot",);
|
||||
},
|
||||
// 透传列表
|
||||
getTc(params) {
|
||||
return getRequest('/tc', params)
|
||||
},
|
||||
// 获取透传类型
|
||||
getSupport(params) {
|
||||
return getRequest('/tc/support', params)
|
||||
},
|
||||
// 获取可用串口列表
|
||||
getFree(params) {
|
||||
return getRequest('/com/free', params)
|
||||
},
|
||||
// 获取支持的通讯驱动
|
||||
getTxSupport(params) {
|
||||
return getRequest('/tx/support', params)
|
||||
},
|
||||
|
||||
// 获取所有串口列表api/com
|
||||
getCom(params) {
|
||||
return getRequest('/com', params)
|
||||
},
|
||||
|
||||
saveTx(params) {
|
||||
return postJsonRequest("/tx", params);
|
||||
},
|
||||
editTx(params) {
|
||||
return putRequest("/tx", params);
|
||||
},
|
||||
// 透传服务启停
|
||||
stopTc(params) {
|
||||
return putRequest("/tc", params);
|
||||
},
|
||||
// 透传服务删除
|
||||
delTc(params) {
|
||||
return deleteRequest("/tc", params);
|
||||
},
|
||||
// 模板列表
|
||||
getMb(params) {
|
||||
return getRequest('/tx/mb/list', params)
|
||||
},
|
||||
// 新增模板
|
||||
addMb(params) {
|
||||
return postJsonRequest('/tx/mb', params)
|
||||
},
|
||||
// 编辑模板
|
||||
editMb(params) {
|
||||
return putRequest('/tx/mb', params)
|
||||
},
|
||||
// 删除模板
|
||||
delMb(params) {
|
||||
return deleteRequest('/tx/mb', params)
|
||||
},
|
||||
// 新增点位
|
||||
addP(params) {
|
||||
return putRequest('/tx/mb', params)
|
||||
},
|
||||
|
||||
// 获取点位
|
||||
getP(params) {
|
||||
return postJsonRequest('/tx/mb/info', params)
|
||||
},
|
||||
// 获取设备列表
|
||||
getSet(params) {
|
||||
return postJsonRequest('/tx/info', params)
|
||||
},
|
||||
// 新增设备
|
||||
addSet(params) {
|
||||
return putRequest('/tx/device', params)
|
||||
},
|
||||
// 通讯列表
|
||||
getTx(params) {
|
||||
return getRequest('/tx/list', params)
|
||||
},
|
||||
// 新增通讯列表
|
||||
saveTx(params) {
|
||||
return postJsonRequest("/tx", params);
|
||||
},
|
||||
|
||||
// 通讯服务启用,停用
|
||||
changeStatus(params) {
|
||||
return postJsonRequest(`/tx/${params.url}/${params.name}`, params);
|
||||
},
|
||||
|
||||
// 删除通讯
|
||||
delTx(params) {
|
||||
return deleteRequest(`/tx`, params);
|
||||
},
|
||||
// 获取上报列表
|
||||
getSc(params) {
|
||||
return getRequest('/sb/list', params)
|
||||
},
|
||||
// 获取上报驱动
|
||||
getQuDong(params) {
|
||||
return getRequest('/sb/support', params)
|
||||
},
|
||||
// 新增上报
|
||||
saveTx(params) {
|
||||
return postJsonRequest("/sb", params);
|
||||
},
|
||||
// 编辑通讯
|
||||
updateTx(params) {
|
||||
return putRequest('/sb', params);
|
||||
},
|
||||
// 上报启停
|
||||
stopSc(params) {
|
||||
return putRequest("/sc", params);
|
||||
},
|
||||
// 删除上报
|
||||
delSc(params) {
|
||||
return deleteRequest("/sb", params);
|
||||
},
|
||||
};
|
||||
export default infoApi;
|
|
@ -0,0 +1,22 @@
|
|||
import {
|
||||
getRequest,
|
||||
postJsonRequest,
|
||||
deleteRequest,
|
||||
putRequest
|
||||
} from '@/utils/axios';
|
||||
const myApi = {
|
||||
// 登录
|
||||
login(params = {}) {
|
||||
return postJsonRequest('/login', params);
|
||||
},
|
||||
// 修改密码
|
||||
editPass(params) {
|
||||
return putRequest("/user", params);
|
||||
},
|
||||
// 退出
|
||||
logOut() {
|
||||
return postJsonRequest('/logout');
|
||||
}
|
||||
}
|
||||
export default myApi;
|
||||
|
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 931 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 648 B |
|
@ -0,0 +1,391 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="type == '1' ? '编辑' : '新增'"
|
||||
width="45%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-form
|
||||
label-position="top"
|
||||
:model="formData"
|
||||
label-width="150px"
|
||||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="通讯名称:" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入驱动名称"
|
||||
clearable
|
||||
:disabled="type == '1'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="通讯驱动:" prop="drive" >
|
||||
<el-select
|
||||
v-model="formData.drive"
|
||||
value-key="name"
|
||||
clearable
|
||||
placeholder="请选择通讯驱动"
|
||||
@change="driveChange"
|
||||
:disabled="type == '1'"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of qudongOptions"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="驱动描述:" prop="description">
|
||||
<el-input
|
||||
v-model="formData.description"
|
||||
placeholder="请输入描述"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<!-- 驱动1 -->
|
||||
<div v-if="serialConfig">
|
||||
<el-form-item label="COM口:">
|
||||
<el-select
|
||||
v-model="configData.name"
|
||||
placeholder="请选择COM口"
|
||||
clearable
|
||||
@change="selsectCom"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of com_select"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
:disabled="item.used"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="波特率:">
|
||||
<el-select
|
||||
v-model="configData.baudRate"
|
||||
placeholder="请选择波频率"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of baud_rate_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="校验位:">
|
||||
<el-select
|
||||
v-model="configData.parity"
|
||||
placeholder="请选择校验位"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of parity_select"
|
||||
:key="index"
|
||||
:label="item.text"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据位:">
|
||||
<el-select
|
||||
v-model="configData.dataBits"
|
||||
placeholder="请选择波频率"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of data_bits_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="停止位:">
|
||||
<el-select
|
||||
v-model="configData.stopBits"
|
||||
placeholder="请选择波频率"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of stop_bits_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="超时时间:" >
|
||||
<el-select
|
||||
v-model="configData.timeout"
|
||||
placeholder="请选择超时时间"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of timeout_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 驱动2 -->
|
||||
<div v-if="modbusTCPConfig">
|
||||
<el-form-item label="主机地址:">
|
||||
<el-input
|
||||
v-model="configData1.port"
|
||||
placeholder="请输入模板描述"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="主机端口:">
|
||||
<el-input
|
||||
v-model="configData1.host"
|
||||
placeholder="请输入模板描述"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="saveData"> 保存 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { response, tx_list, com_info, com_list, tx_drive_list, tx_add, tx_info, tx_drive_config_modbusTCP } from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible", "type", "qudongOptions"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const ruleFormRef = ref(null);
|
||||
const validName = (rule, value, callback) => {
|
||||
var name = /^[a-zA-Z]([_\w]*)$/;
|
||||
if (name.test(value) || !value) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("通讯名称格式不正确,支持英文数字和下划线"));
|
||||
}
|
||||
};
|
||||
const state = reactive({
|
||||
serialConfig: false,
|
||||
modbusTCPConfig: false,
|
||||
com_select: [],
|
||||
comArr: [],
|
||||
configData: {
|
||||
name: '',
|
||||
baudRate: '',
|
||||
parity: '',
|
||||
dataBits: '',
|
||||
stopBits:'',
|
||||
timeout:'',
|
||||
},
|
||||
configData1: {
|
||||
port: '',
|
||||
host: ''
|
||||
},
|
||||
baud_rate_select: [9600, 115200],
|
||||
parity_select:[
|
||||
{ text: "无校验", value: "N" },
|
||||
{ text: "偶校验", value: "E" },
|
||||
{ text: "奇校验", value: "O" }
|
||||
],
|
||||
data_bits_select: [5, 6, 7, 8],
|
||||
stop_bits_select: [1, 2],
|
||||
timeout_select: [0, 100, 200, 500, 1000, 2000],
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "请输入通讯名称", trigger: "blur" },
|
||||
{ required: true, validator: validName, trigger: "blur" },
|
||||
],
|
||||
description: [{ required: true, message: "请输入驱动描述", trigger: "blur" }],
|
||||
drive: [{ required: true, message: "请选择通讯驱动", trigger: "blur" }],
|
||||
// com: [{ required: true, message: "请选择COM口", trigger: "blur" }],
|
||||
// baudRate: [{ required: true, message: "请选择波特率", trigger: "blur" }],
|
||||
// parity: [{ required: true, message: "请选择校验位", trigger: "blur" }],
|
||||
// dataBits: [{ required: true, message: "请选择数据位", trigger: "blur" }],
|
||||
// stopBits: [{ required: true, message: "请选择停止位", trigger: "blur" }],
|
||||
// timeout: [{ required: true, message: "请选择超时时间", trigger: "blur" }],
|
||||
// port: [{ required: true, message: "请填写主机地址", trigger: "blur" }],
|
||||
// host: [{ required: true, message: "请填写主机端口", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.type === '1') {
|
||||
if (props.formData.serial) {
|
||||
state.serialConfig = true;
|
||||
state.modbusTCPConfig = false;
|
||||
// 获取com,比对赋值
|
||||
getCom();
|
||||
} else {
|
||||
state.serialConfig = false;
|
||||
if (props.formData.drive == "modbusTCP") {
|
||||
state.modbusTCPConfig = true;
|
||||
// 直接赋值
|
||||
state.configData1 = {
|
||||
port: props.formData.host.split(":")[0],
|
||||
host: props.formData.host.split(":")[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
const saveData = async () => {
|
||||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
let req_configbuf;
|
||||
if (props.type==='0') {
|
||||
if (props.formData.drive.serial) {
|
||||
req_configbuf = com_info.encode(state.configData).finish();
|
||||
} else {
|
||||
if (props.formData.drive.name == "modbusTCP") {
|
||||
req_configbuf = tx_drive_config_modbusTCP.encode(state.configData1).finish();
|
||||
}
|
||||
}
|
||||
var obj = {
|
||||
name: props.formData.name,
|
||||
drive: props.formData.drive.name,
|
||||
description: props.formData.description,
|
||||
serial: props.formData.drive.serial,
|
||||
config: req_configbuf.slice(0, req_configbuf.length),
|
||||
};
|
||||
console.log('编辑数据3', obj);
|
||||
} else {
|
||||
console.log('编辑数据1', state.configData)
|
||||
console.log('编辑数据2', state.configData1)
|
||||
if (props.formData.serial) {
|
||||
req_configbuf = com_info.encode(state.configData).finish();
|
||||
} else {
|
||||
if (props.formData.drive == "modbusTCP") {
|
||||
req_configbuf = tx_drive_config_modbusTCP.encode(state.configData1).finish();
|
||||
}
|
||||
}
|
||||
obj = {
|
||||
name: props.formData.name,
|
||||
drive: props.formData.drive,
|
||||
description: props.formData.description,
|
||||
serial: props.formData.serial,
|
||||
config: req_configbuf.slice(0, req_configbuf.length),
|
||||
};
|
||||
console.log('编辑数据3', obj);
|
||||
}
|
||||
|
||||
|
||||
const req_databuf = tx_add.encode(obj).finish();
|
||||
// 截取有效长度
|
||||
const req_data = req_databuf.slice(0, req_databuf.length);
|
||||
const res = props.type === '0' ? await infoApi.saveTx(req_data) : await infoApi.editTx(req_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
ElMessage.success(res.msg || "请求成功");
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
ElMessage.error(res.msg || "请求失败");
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!");
|
||||
}
|
||||
});
|
||||
};
|
||||
const driveChange = () => {
|
||||
// 如果是串口协议
|
||||
if (props.formData.drive.serial) {
|
||||
state.serialConfig = true;
|
||||
state.modbusTCPConfig = false;
|
||||
// 获取com
|
||||
getCom();
|
||||
|
||||
} else {
|
||||
state.serialConfig = false;
|
||||
if (props.formData.drive.name == "modbusTCP") {
|
||||
state.modbusTCPConfig = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取com
|
||||
const getCom = async () => {
|
||||
const res = await infoApi.getCom();
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
const infodata = com_list.decode(ret.data);
|
||||
state.comArr = infodata.com;
|
||||
console.log('comlist',state.comArr)
|
||||
state.com_select = [];
|
||||
infodata.com.forEach(e => {
|
||||
if (!e.used) {
|
||||
state.com_select.push(e);
|
||||
}
|
||||
});
|
||||
// 编辑赋值
|
||||
if (props.type === '1') {
|
||||
const config = infodata.com.filter(item => item.name === props.formData.host)[0];
|
||||
state.configData = {
|
||||
name: config.name,
|
||||
baudRate: config.baudRate,
|
||||
parity: config.parity,
|
||||
dataBits: config.dataBits,
|
||||
stopBits: config.stopBits,
|
||||
timeout: config.timeout,
|
||||
}
|
||||
}
|
||||
if (state.com_select.length == 0) {
|
||||
ElMessage.info("没有可用串口,请选择其他驱动");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 选择 com 回填数据
|
||||
const selsectCom = () => {
|
||||
const c = state.comArr.filter(item => item.name === state.configData.name)[0];
|
||||
state.configData = {
|
||||
name: c.name,
|
||||
baudRate: c.baudRate,
|
||||
parity: c.parity,
|
||||
dataBits: c.dataBits,
|
||||
stopBits: c.stopBits,
|
||||
timeout: c.timeout,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
ruleFormRef,
|
||||
visible,
|
||||
saveData,
|
||||
closeDialog,
|
||||
driveChange,
|
||||
getCom,
|
||||
selsectCom
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.inline-div {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
.el-form-item {
|
||||
margin-right: 10px;
|
||||
width: 175px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,170 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="type === 'I' ? '新增模板': '编辑模板'"
|
||||
width="30%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-form
|
||||
:model="addForm"
|
||||
label-width="100px"
|
||||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="模板名称:" prop="name">
|
||||
<el-input
|
||||
v-model="addForm.name"
|
||||
placeholder="请输入模板名称"
|
||||
clearable
|
||||
:disabled="type === 'I' ? false: true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板描述:" prop="description">
|
||||
<el-input
|
||||
v-model="addForm.description"
|
||||
placeholder="请输入模板描述"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板类型:" prop="type">
|
||||
<el-input
|
||||
v-model="addForm.type"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="saveFormData"> 保存 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { mb_list, mb_info, response} from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible", "type"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const ruleFormRef = ref(null);
|
||||
const state = reactive({
|
||||
addForm: {},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "请输入模板名称", trigger: "blur" }
|
||||
],
|
||||
description: [
|
||||
{ required: true, message: "请输入模板描述", trigger: "blur" }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: "请选择类型", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
const type = computed(() => {
|
||||
return props.type;
|
||||
});
|
||||
onMounted(() => {
|
||||
state.addForm = props.formData;
|
||||
});
|
||||
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
||||
const importData = () => {};
|
||||
|
||||
const exoportData = () => {};
|
||||
|
||||
|
||||
const saveFormData = () => {
|
||||
ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const req_databuf = mb_info.encode(state.addForm).finish();
|
||||
// 截取有效长度
|
||||
const req_data = req_databuf.slice(0, req_databuf.length);
|
||||
const res = props.type === 'I' ? await infoApi.addMb(req_data) : await infoApi.editMb(req_data);
|
||||
console.log(555, res)
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
// 获取数据
|
||||
console.log(new TextDecoder().decode(ret.data));
|
||||
ElMessage.success(new TextDecoder().decode(ret.data) || "请求成功");
|
||||
// 关闭弹框
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
console.log(res);
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!");
|
||||
}
|
||||
});
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
visible,
|
||||
type,
|
||||
closeDialog,
|
||||
importData,
|
||||
exoportData,
|
||||
saveFormData,
|
||||
ruleFormRef
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.title-div {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
display: flex;
|
||||
|
||||
> div {
|
||||
width: 15%;
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.tree-div {
|
||||
height: 780px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.tree {
|
||||
width: 20%;
|
||||
border: 1px solid #f2f2f2;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
}
|
||||
.table {
|
||||
height: 100%;
|
||||
width: 79%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
.point-table {
|
||||
border: 1px solid #f2f2f2;
|
||||
padding: 10px;
|
||||
}
|
||||
.propertie-table {
|
||||
padding: 10px;
|
||||
border: 1px solid #f2f2f2;
|
||||
}
|
||||
}
|
||||
.custom-tree-node {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
.add-icon {
|
||||
padding-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,347 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="点位管理"
|
||||
width="60%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-card class="top-title">
|
||||
<span>模板名称:{{ addForm.name }}</span>
|
||||
<span>模板描述:{{ addForm.description }}</span>
|
||||
<span>模板类型:{{ addForm.type }}</span>
|
||||
</el-card>
|
||||
<div class="btns">
|
||||
<div>
|
||||
<el-button type="primary" @click="saveP"> 保存 </el-button>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="importData"> 导入 </el-button>
|
||||
<el-button type="primary" @click="exportData"> 导出 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-table
|
||||
:data="propertiesData"
|
||||
height="230"
|
||||
style="width: 100%"
|
||||
border
|
||||
stripe
|
||||
:header-cell-style="{ background: '#F6F7FC' }"
|
||||
>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="点位名称"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.name"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="address"
|
||||
label="点位地址"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.address"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="datatype"
|
||||
label="点位类型"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.datatype" size="mini">
|
||||
<el-option
|
||||
v-for="item in datatypeArr"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="byteorder"
|
||||
label="字节顺序"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.byteorder" size="mini">
|
||||
<el-option
|
||||
v-for="item in byteorderArr"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="multplier"
|
||||
label="缩放系数"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.multplier"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="unit"
|
||||
label="点位单位"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.unit"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="description"
|
||||
label="点位描述"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.description"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button type="danger" @click="delData(scope.$index)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex-center" @click="addRow">
|
||||
+新增一行
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { m_point, m_properties, mb_info, response} from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
addForm: {},
|
||||
propertiesData: [],
|
||||
datatypeArr: [{
|
||||
label: 'bool',
|
||||
value: 'bool'
|
||||
},{
|
||||
label: 'int16',
|
||||
value: 'int16'
|
||||
},{
|
||||
label: 'int32',
|
||||
value: 'int32'
|
||||
},{
|
||||
label: 'unit16',
|
||||
value: 'unit16'
|
||||
},{
|
||||
label: 'unit32',
|
||||
value: 'unit32'
|
||||
},{
|
||||
label: 'float32',
|
||||
value: 'float32'
|
||||
},{
|
||||
label: 'float64',
|
||||
value: 'float64'
|
||||
}],
|
||||
byteorderArr: [{
|
||||
label: 'null',
|
||||
value: 'null'
|
||||
},{
|
||||
label: '12',
|
||||
value: '12'
|
||||
},{
|
||||
label: '21',
|
||||
value: '21'
|
||||
},{
|
||||
label: '1234',
|
||||
value: '1234'
|
||||
},{
|
||||
label: '4321',
|
||||
value: '4321'
|
||||
},{
|
||||
label: 'ABCD',
|
||||
value: 'ABCD'
|
||||
},{
|
||||
label: 'DCBA',
|
||||
value: 'DCBA'
|
||||
}]
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
state.addForm = props.formData;
|
||||
console.log(123, props.formData)
|
||||
// 获取点位列表
|
||||
getPointList();
|
||||
});
|
||||
const getPointList = async() => {
|
||||
const parm = mb_info.encode({
|
||||
name: state.addForm.name
|
||||
}).finish();
|
||||
// 截取有效长度
|
||||
const parm_data = parm.slice(0, parm.length);
|
||||
const res = await infoApi.getP(parm_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
const propArr = mb_info.decode(ret.data).points;
|
||||
state.propertiesData = [];
|
||||
propArr.forEach(v => {
|
||||
state.propertiesData.push({
|
||||
name: v.name,
|
||||
address: v.properties[0].value,
|
||||
datatype: v.properties[1].value,
|
||||
byteorder: v.properties[2].value,
|
||||
multplier: v.properties[3].value,
|
||||
unit: v.properties[4].value,
|
||||
description: v.properties[5].value,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log(res);
|
||||
}
|
||||
};
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
||||
const importData = () => {};
|
||||
|
||||
const exportData = () => {};
|
||||
|
||||
const saveP = async () => {
|
||||
if (state.propertiesData.length<1) {
|
||||
return ElMessage.error("请添加一条点位");
|
||||
}
|
||||
const newArr = [];
|
||||
state.propertiesData.forEach(item => {
|
||||
newArr.push(m_point.create({
|
||||
name: item.name,
|
||||
properties: [
|
||||
m_properties.create({
|
||||
name: 'address',value:item.address
|
||||
}),
|
||||
m_properties.create({
|
||||
name: 'datatype',value:item.datatype
|
||||
}),
|
||||
m_properties.create({
|
||||
name: 'byteorder',value:item.byteorder
|
||||
}),
|
||||
m_properties.create({
|
||||
name: 'multplier',value:item.multplier
|
||||
}),
|
||||
m_properties.create({
|
||||
name: 'unit',value:item.unit
|
||||
}),
|
||||
m_properties.create({
|
||||
name: 'description',value:item.description
|
||||
})
|
||||
]
|
||||
}))
|
||||
})
|
||||
console.log(123, newArr)
|
||||
const req_databuf = mb_info.encode({
|
||||
name: state.addForm.name,
|
||||
type: state.addForm.type,
|
||||
description: state.addForm.description,
|
||||
points: newArr
|
||||
}).finish();
|
||||
// 截取有效长度
|
||||
const req_data = req_databuf.slice(0, req_databuf.length);
|
||||
const res = await infoApi.addP(req_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
console.log(new TextDecoder().decode(ret.data));
|
||||
ElMessage.success(new TextDecoder().decode(ret.data) || "请求成功");
|
||||
// 获取数据
|
||||
getPointList();
|
||||
}
|
||||
|
||||
};
|
||||
const addRow = () => {
|
||||
let newRow = {
|
||||
name: '',
|
||||
address: '',
|
||||
datatype: 'bool',
|
||||
byteorder: 'null',
|
||||
multplier: '',
|
||||
unit: '',
|
||||
description: ''
|
||||
};
|
||||
state.propertiesData.push(newRow);
|
||||
}
|
||||
const delData = (index) => {
|
||||
state.propertiesData.splice(index, 1);
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
visible,
|
||||
closeDialog,
|
||||
importData,
|
||||
exportData,
|
||||
addRow,
|
||||
saveP,
|
||||
delData
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.top-title {
|
||||
width: 100%;
|
||||
::v-deep .el-card__body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-weight: 800;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
.btns {
|
||||
padding: 15px 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 10px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="formData.id ? '编辑' : '新增'"
|
||||
width="35%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-form
|
||||
label-position="top"
|
||||
:model="formData"
|
||||
label-width="150px"
|
||||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="通讯名称:" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入通讯名称"
|
||||
clearable
|
||||
:disabled="type === 'I' ? false: true"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="上报驱动:" prop="drive">
|
||||
<el-select v-model="formData.drive" placeholder="请选择驱动">
|
||||
<el-option
|
||||
v-for="(item, index) of qudongOptions"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="主机地址:" prop="host">
|
||||
<el-input
|
||||
v-model="formData.host"
|
||||
placeholder="请输入主机地址"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="通讯描述:">
|
||||
<el-input
|
||||
v-model="formData.description"
|
||||
placeholder="请输入通讯名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他配置:" prop="config">
|
||||
<el-input
|
||||
v-model="formData.config"
|
||||
placeholder="请输入其他配置"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="saveData"> 保存 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { sb_list, sb_info, sb_drive_list, sb_add, response } from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible", "type"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const ruleFormRef = ref(null);
|
||||
const state = reactive({
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入通讯名称", trigger: "blur" }],
|
||||
drive: [{ required: true, message: "请选择驱动", trigger: "blur" }],
|
||||
host: [{ required: true, message: "请输入主机地址", trigger: "blur" }],
|
||||
},
|
||||
qudongOptions: [],
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getQuDong();
|
||||
});
|
||||
const getQuDong = async () => {
|
||||
const res = await infoApi.getQuDong();
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
|
||||
if (ret.code == 0) {
|
||||
// 获取数据
|
||||
const infodata = sb_drive_list.decode(ret.data).sbDrive;
|
||||
console.log('驱动类型', infodata);
|
||||
state.qudongOptions = infodata;
|
||||
}
|
||||
}
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
// 保存
|
||||
const saveData = async () => {
|
||||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
console.log(123, props.formData);
|
||||
const req_databuf = sb_add.encode(props.formData).finish();
|
||||
// 截取有效长度
|
||||
const req_data = req_databuf.slice(0, req_databuf.length);
|
||||
const res = props.type === 'I' ? await infoApi.saveTx(req_data) : await infoApi.updateTx(req_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if(ret.code == 0) {
|
||||
ElMessage.success(res.msg || '请求成功');
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!");
|
||||
}
|
||||
});
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
ruleFormRef,
|
||||
visible,
|
||||
saveData,
|
||||
closeDialog,
|
||||
getQuDong
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,262 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="设备管理"
|
||||
width="60%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-card class="top-title">
|
||||
<span>通讯名称:{{ addForm.name }}</span>
|
||||
<span>通讯描述:{{ addForm.description }}</span>
|
||||
<span>通讯主机:{{ addForm.host }}</span>
|
||||
</el-card>
|
||||
<div class="btns">
|
||||
<div>
|
||||
<el-button type="primary" @click="saveSet"> 保存 </el-button>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="scanData"> 扫描 </el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-table
|
||||
:data="propertiesData"
|
||||
height="230"
|
||||
style="width: 100%"
|
||||
border
|
||||
stripe
|
||||
:header-cell-style="{ background: '#F6F7FC' }"
|
||||
>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="设备名称"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.name"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="ID"
|
||||
label="设备id"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.ID"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="template"
|
||||
label="数据模板"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.template" clearable placeholder="请选择模板" size="mini">
|
||||
<el-option
|
||||
v-for="item in modelArr"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="description"
|
||||
label="设备描述"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.description"
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button type="danger" @click="delData(scope.$index)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex-center" @click="addRow">
|
||||
+新增一行
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { mb_list, tx_info, response, m_device, m_properties, tx_add_device} from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
addForm: {},
|
||||
propertiesData: [],
|
||||
modelArr: []
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
state.addForm = props.formData;
|
||||
console.log(123, props.formData)
|
||||
// 获取模板数据
|
||||
getMbData();
|
||||
// 获取点位列表
|
||||
getSetList();
|
||||
});
|
||||
const getMbData = async () => {
|
||||
const res = await infoApi.getMb();
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
|
||||
if (ret.code == 0) {
|
||||
// 获取数据
|
||||
state.modelArr = mb_list.decode(ret.data).mb;
|
||||
console.log(mb_list.decode(ret.data).mb);
|
||||
} else {
|
||||
console.log(res);
|
||||
}
|
||||
};
|
||||
const getSetList = async() => {
|
||||
const parm = tx_info.encode({
|
||||
name: state.addForm.name
|
||||
}).finish();
|
||||
// 截取有效长度
|
||||
const parm_data = parm.slice(0, parm.length);
|
||||
const res = await infoApi.getSet(parm_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
console.log(99, tx_info.decode(ret.data).device);
|
||||
const propArr = tx_info.decode(ret.data).device;
|
||||
state.propertiesData = [];
|
||||
propArr.forEach(v => {
|
||||
state.propertiesData.push({
|
||||
name: v.name,
|
||||
ID: v.properties[0].value,
|
||||
template: v.properties[1].value,
|
||||
description: v.properties[2].value,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
console.log(res);
|
||||
}
|
||||
};
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
||||
const scanData = () => {};
|
||||
|
||||
const saveSet = async () => {
|
||||
if (state.propertiesData.length < 1) {
|
||||
return ElMessage.error("请至少添加一条数据");
|
||||
}
|
||||
const newArr = [];
|
||||
state.propertiesData.forEach(item => {
|
||||
newArr.push({
|
||||
name: item.name,
|
||||
properties: [
|
||||
{
|
||||
name: 'ID', value: item.ID
|
||||
},{
|
||||
name: 'template', value: item.template
|
||||
},{
|
||||
name: 'description', value: item.description
|
||||
}]
|
||||
})
|
||||
})
|
||||
|
||||
const req_databuf = tx_add_device.encode({
|
||||
name: state.addForm.name,
|
||||
device: newArr
|
||||
}).finish();
|
||||
|
||||
// 截取有效长度
|
||||
const req_data = req_databuf.slice(0, req_databuf.length);
|
||||
const res = await infoApi.addSet(req_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
|
||||
if (ret.code == 0) {
|
||||
console.log(new TextDecoder().decode(ret.data));
|
||||
ElMessage.success(new TextDecoder().decode(ret.data) || "请求成功");
|
||||
// 获取数据
|
||||
getSetList();
|
||||
}
|
||||
|
||||
};
|
||||
const addRow = () => {
|
||||
let newRow = {
|
||||
name: '',
|
||||
address: '',
|
||||
datatype: 'bool',
|
||||
byteorder: 'null',
|
||||
multplier: '',
|
||||
unit: '',
|
||||
description: ''
|
||||
};
|
||||
state.propertiesData.push(newRow);
|
||||
}
|
||||
const delData = (index) => {
|
||||
state.propertiesData.splice(index, 1);
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
visible,
|
||||
closeDialog,
|
||||
scanData,
|
||||
addRow,
|
||||
saveSet,
|
||||
delData,
|
||||
getMbData
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.top-title {
|
||||
width: 100%;
|
||||
::v-deep .el-card__body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-weight: 800;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
.btns {
|
||||
padding: 15px 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 10px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,456 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="formData.id ? '编辑' : '新增'"
|
||||
width="60%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-form
|
||||
:model="formData"
|
||||
label-width="150px"
|
||||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="透传名称:" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入透传名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="透传类型:" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择驱动">
|
||||
<el-option
|
||||
v-for="(item, index) of typeOptions"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="本地串口:">
|
||||
<div class="inline-div">
|
||||
<el-form-item label="名称:" prop="name" label-width="60px">
|
||||
<el-select v-model="formData.serial.name" placeholder="请选择名称" @change="changeName">
|
||||
<el-option
|
||||
v-for="(item, index) of portOptions"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="波频率:" prop="baudrate" label-width="60px">
|
||||
<el-select
|
||||
v-model="formData.serial.baudrate"
|
||||
placeholder="请选择波频率"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of waveOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据位:" prop="databits" label-width="60px">
|
||||
<el-select v-model="formData.serial.databits" placeholder="请选择波频率">
|
||||
<el-option
|
||||
v-for="(item, index) of bitsOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="停止位:" prop="stopbits" label-width="60px">
|
||||
<el-select v-model="formData.serial.stopbits" placeholder="请选择波频率">
|
||||
<el-option
|
||||
v-for="(item, index) of stopOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="校验位:" prop="parity" label-width="60px">
|
||||
<el-select v-model="formData.serial.parity" placeholder="请选择波频率">
|
||||
<el-option
|
||||
v-for="(item, index) of validOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="读取超时:" prop="time" label-width="80px">
|
||||
<el-input
|
||||
v-model="formData.time"
|
||||
placeholder="请输入透传名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="透传接口:" class="trans-div">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
class="add-btn"
|
||||
v-if="formData.type == 'modbus分身'"
|
||||
@click="addTransData"
|
||||
>
|
||||
添加网口
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="SemiSelect"
|
||||
class="del-btn"
|
||||
v-if="formData.type == 'modbus分身'"
|
||||
@click="delTransData"
|
||||
>
|
||||
删除网口
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
class="add-btn1"
|
||||
v-if="formData.type == 'modbus分身'"
|
||||
@click="addTransData1"
|
||||
>
|
||||
添加串口
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="SemiSelect"
|
||||
class="del-btn1"
|
||||
v-if="formData.type == 'modbus分身'"
|
||||
@click="delTransData1"
|
||||
>
|
||||
删除串口
|
||||
</el-button>
|
||||
<div
|
||||
class="inline-div"
|
||||
v-for="(item, index) of formData.tcp"
|
||||
:key="index"
|
||||
>
|
||||
<el-form-item
|
||||
label="名称:"
|
||||
:prop="'tcp[' + index + '].name'"
|
||||
label-width="60px"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.tcp[index].name"
|
||||
placeholder="请选择名称"
|
||||
@change="changeTransName(index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of transOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="主机地址:"
|
||||
:prop="'tcp[' + index + '].host'"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.tcp[index].host"
|
||||
placeholder="请输入透传名称"
|
||||
clearable
|
||||
:disabled="formData.tcp[index].disabled"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="端口号:"
|
||||
:prop="'tcp[' + index + '].port'"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.tcp[index].port"
|
||||
placeholder="请输入端口号"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div
|
||||
v-if="formData.type == 'modbus分身'"
|
||||
class="inline-div transData1"
|
||||
v-for="(item, index) of formData.transData1"
|
||||
:key="index"
|
||||
>
|
||||
<el-form-item
|
||||
label="名称:"
|
||||
:prop="'transData1[' + index + '].localPort'"
|
||||
label-width="60px"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.transData1[index].localPort"
|
||||
placeholder="请选择名称"
|
||||
@change="changeTransName(index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of portOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="波特率:"
|
||||
:prop="'transData1[' + index + '].waveFrequency'"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.transData1[index].waveFrequency"
|
||||
placeholder="请选择波频率"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of waveOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="数据位:"
|
||||
:prop="'transData1[' + index + '].dataBits'"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.transData1[index].dataBits"
|
||||
placeholder="请选择波频率"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of bitsOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="停止位:"
|
||||
:prop="'transData1[' + index + '].stopBits'"
|
||||
label-width="60px"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.transData1[index].stopBits"
|
||||
placeholder="请选择波频率"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of stopOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="校验位:"
|
||||
:prop="'transData1[' + index + '].validBits'"
|
||||
label-width="60px"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.transData1[index].validBits"
|
||||
placeholder="请选择波频率"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of validOptions"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="读取超时:"
|
||||
:prop="'transData1[' + index + '].time'"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.transData1[index].time"
|
||||
placeholder="请输入透传名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="saveData"> 保存 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
export default {
|
||||
props: ["formData", "dialogVisible"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const ruleFormRef = ref(null);
|
||||
const state = reactive({
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入通讯名称", trigger: "blur" }],
|
||||
},
|
||||
typeOptions: [],
|
||||
portOptions: [],
|
||||
waveOptions: ["2400", "9600", "19200", "38400", "115200", "自定义"],
|
||||
bitsOptions: ["5", "6", "7", "8"],
|
||||
stopOptions: ["1", "2", "1.5"],
|
||||
validOptions: ["无", "奇校验", "偶校验", "Mark", "Space"],
|
||||
transOptions: ["TCP服务器", "TCP客户端"],
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
onMounted(() => {
|
||||
getSupport();
|
||||
getFree();
|
||||
});
|
||||
|
||||
const getSupport = async () => {
|
||||
const res = await infoApi.getSupport();
|
||||
state.typeOptions = res.data;
|
||||
}
|
||||
|
||||
const getFree = async () => {
|
||||
const res = await infoApi.getFree();
|
||||
state.portOptions = res.data;
|
||||
}
|
||||
|
||||
const changeName = () => {
|
||||
let item = state.portOptions.find(ele => {
|
||||
return ele.name === props.formData.serial.name;
|
||||
})
|
||||
props.formData.serial.baudrate = item.baudrate;
|
||||
props.formData.serial.databits = item.databits;
|
||||
props.formData.serial.stopbits = item.stopbits;
|
||||
props.formData.serial.parity = item.parity;
|
||||
}
|
||||
|
||||
const closeDialog = () => {
|
||||
ruleFormRef.value.resetFields();
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
||||
const changeTransName = (index) => {
|
||||
props.formData.tcp[index].disabled =
|
||||
props.formData.tcp[index].name == "TCP服务器";
|
||||
};
|
||||
|
||||
const addTransData = () => {
|
||||
let item = {
|
||||
transName: "TCP服务端",
|
||||
transAdress: "localhost",
|
||||
transPort: "",
|
||||
disabled: true,
|
||||
};
|
||||
props.formData.tcp.push(item);
|
||||
};
|
||||
|
||||
const delTransData = () => {
|
||||
if (props.formData.tcp.length == 1) {
|
||||
ElMessage.warning("至少为一个");
|
||||
return;
|
||||
}
|
||||
props.formData.tcp.pop();
|
||||
};
|
||||
|
||||
const addTransData1 = () => {
|
||||
let item = {
|
||||
localPort: "COM1",
|
||||
waveFrequency: "9600",
|
||||
dataBits: "8",
|
||||
stopBits: "1",
|
||||
validBits: "无",
|
||||
time: "",
|
||||
};
|
||||
props.formData.transData1.push(item);
|
||||
};
|
||||
|
||||
const delTransData1 = () => {
|
||||
if (props.formData.transData1.length == 1) {
|
||||
ElMessage.warning("至少为一个");
|
||||
return;
|
||||
}
|
||||
props.formData.transData1.pop();
|
||||
};
|
||||
const saveData = async () => {
|
||||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const res = await infoApi.saveTc(props.formData);
|
||||
if(res.code == 0) {
|
||||
ElMessage.success(res.msg || '请求成功');
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!");
|
||||
}
|
||||
});
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
ruleFormRef,
|
||||
visible,
|
||||
saveData,
|
||||
closeDialog,
|
||||
changeTransName,
|
||||
addTransData,
|
||||
delTransData,
|
||||
addTransData1,
|
||||
delTransData1,
|
||||
changeName
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.inline-div {
|
||||
display: flex;
|
||||
width:100%;
|
||||
.el-form-item {
|
||||
margin-right: 10px;
|
||||
width: 175px;
|
||||
}
|
||||
}
|
||||
.trans-div {
|
||||
position: relative;
|
||||
}
|
||||
.transData1 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.add-btn {
|
||||
position: absolute;
|
||||
top: -35px;
|
||||
left: 70px;
|
||||
}
|
||||
.del-btn {
|
||||
position: absolute;
|
||||
top: -35px;
|
||||
left: 175px;
|
||||
}
|
||||
.add-btn1 {
|
||||
position: absolute;
|
||||
top: -35px;
|
||||
left: 295px;
|
||||
}
|
||||
.del-btn1 {
|
||||
position: absolute;
|
||||
top: -35px;
|
||||
left: 415px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,148 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="修改密码"
|
||||
width="35%"
|
||||
:before-close="closeDialog"
|
||||
>
|
||||
<el-form
|
||||
label-position="top"
|
||||
:model="formData"
|
||||
label-width="150px"
|
||||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="原密码:" prop="oldPass">
|
||||
<el-input
|
||||
type="password"
|
||||
v-model="formData.oldPass"
|
||||
placeholder="请输入原密码"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码:" prop="newPass">
|
||||
<el-input
|
||||
type="password"
|
||||
v-model="formData.newPass"
|
||||
placeholder="请输入新密码"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码:" prop="confirmPass">
|
||||
<el-input
|
||||
type="password"
|
||||
v-model="formData.confirmPass"
|
||||
placeholder="请再次输入新密码"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="saveData"> 保存 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, computed } from "vue";
|
||||
import myApi from "@/api/myApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { useStore } from "vuex";
|
||||
import md5 from 'js-md5'
|
||||
import { passwd, response } from '../proto/data/pd'
|
||||
|
||||
export default {
|
||||
props: ["dialogVisible"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const store = useStore();
|
||||
const ruleFormRef = ref(null);
|
||||
var checkPass = (rule, value, callback) => {
|
||||
var pass = /[\u4E00-\u9FA5]/;
|
||||
if (!pass.test(value) || !value) {
|
||||
// 规则校验通过,或者为空
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("不能输入汉字"));
|
||||
}
|
||||
};
|
||||
var validatePassCheck = (rule, value, callback) => {
|
||||
if (value && value !== state.formData.newPass) {
|
||||
callback(new Error("两次输入密码不一致,请重新输入"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const state = reactive({
|
||||
rules: {
|
||||
oldPass: [
|
||||
{ required: true, message: "请输入密码", trigger: "blur" },
|
||||
{ min: 6, max: 18, message: "长度在6到18个字符", trigger: "blur" },
|
||||
{ required: true, validator: checkPass, trigger: "blur" },
|
||||
],
|
||||
newPass: [
|
||||
{ required: true, message: "请输入密码", trigger: "blur" },
|
||||
{ min: 6, max: 18, message: "长度在6到18个字符", trigger: "blur" },
|
||||
{ required: true, validator: checkPass, trigger: "blur" },
|
||||
],
|
||||
confirmPass: [
|
||||
{ required: true, message: "请输入密码", trigger: "blur" },
|
||||
{ min: 6, max: 18, message: "长度在6到18个字符", trigger: "blur" },
|
||||
{ required: true, validator: validatePassCheck, trigger: "blur" },
|
||||
],
|
||||
},
|
||||
formData: {
|
||||
oldPass: "",
|
||||
newPass: "",
|
||||
confirmPass: "",
|
||||
},
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
|
||||
onMounted(() => {});
|
||||
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
||||
const saveData = async () => {
|
||||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 请求数据
|
||||
const req_databuf = passwd.encode({
|
||||
name: store.state.userInfo.nickName,
|
||||
oldPassword: md5(state.formData.oldPass).toUpperCase(),
|
||||
newPassword: md5(state.formData.newPass).toUpperCase(),
|
||||
}).finish();
|
||||
// 截取有效长度
|
||||
const req_data = req_databuf.slice(0, req_databuf.length);
|
||||
const res = await myApi.editPass(req_data);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
// 获取数据
|
||||
console.log(new TextDecoder().decode(ret.data));
|
||||
ElMessage.success(new TextDecoder().decode(ret.data) || "请求成功");
|
||||
// 关闭弹框
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
console.log(ret);
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!");
|
||||
}
|
||||
});
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
ruleFormRef,
|
||||
visible,
|
||||
saveData,
|
||||
closeDialog,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<template>
|
||||
<div class="footer">
|
||||
<div class="left">Copyright © 2019-2021 十三. All rights reserved.</div>
|
||||
<div class="right">
|
||||
<a target="_blank" href="https://github.com/newbee-ltd/vue3-admin">vue3-admin Version 3.0.0</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Footer'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.footer {
|
||||
height: 50px;
|
||||
border-top: 1px solid #e9e9e9;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,198 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="header">
|
||||
<div class="left">
|
||||
<i v-if="hasBack" class="el-icon-back" @click="back"></i>
|
||||
<span style="font-size: 20px">
|
||||
<img class="logo" src="../assets/logo.png" width="16" />雨火
|
||||
</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
:width="350"
|
||||
trigger="click"
|
||||
popper-class="popper-user-box"
|
||||
>
|
||||
<template #reference>
|
||||
<div class="author">
|
||||
<el-icon><User /></el-icon>
|
||||
{{ (userInfo && userInfo.nickName) || "" }}
|
||||
<el-icon><CaretBottom /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
<div class="nickname">
|
||||
<p>登录名:{{ (userInfo && userInfo.loginUserName) || "" }}</p>
|
||||
<p>昵称:{{ (userInfo && userInfo.nickName) || "" }}</p>
|
||||
<el-tag effect="dark" class="reStart" @click="reStart"
|
||||
>重启设备</el-tag
|
||||
>
|
||||
<el-tag effect="dark" class="editPass" @click="editPass"
|
||||
>修改密码</el-tag
|
||||
>
|
||||
<el-tag effect="dark" class="logout" @click="logout"
|
||||
>退出登录</el-tag
|
||||
>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
<EditPass
|
||||
:dialogVisible="dialogVisible"
|
||||
@dialogClose="dialogClose"
|
||||
@dialogSuccess="dialogSuccess"
|
||||
></EditPass>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { localRemove, pathMap } from "@/utils";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import EditPass from "@/components/EditPass.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useStore } from "vuex";
|
||||
import myApi from "@/api/myApi.js";
|
||||
import { response } from '../proto/data/pd'
|
||||
export default {
|
||||
name: "Header",
|
||||
components: {
|
||||
EditPass,
|
||||
},
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const store = useStore();
|
||||
const state = reactive({
|
||||
name: "dashboard",
|
||||
userInfo: null,
|
||||
hasBack: false,
|
||||
dialogVisible: false,
|
||||
});
|
||||
onMounted(() => {
|
||||
const pathname = window.location.hash.split("/")[1] || "";
|
||||
if (!["login"].includes(pathname)) {
|
||||
getUserInfo();
|
||||
}
|
||||
});
|
||||
const dialogClose = () => {
|
||||
state.dialogVisible = false;
|
||||
};
|
||||
|
||||
const dialogSuccess = () => {
|
||||
state.dialogVisible = false;
|
||||
};
|
||||
const getUserInfo = async () => {
|
||||
// const userInfo = await myApi.getUserInfo();
|
||||
// state.userInfo = userInfo
|
||||
state.userInfo = {
|
||||
adminUserId: 1,
|
||||
locked: 0,
|
||||
loginPassword: "******",
|
||||
loginUserName: "admin",
|
||||
nickName: "admin",
|
||||
};
|
||||
store.commit("setUserInfo", state.userInfo);
|
||||
};
|
||||
|
||||
const reStart = async () => {
|
||||
const res = await infoApi.reboot();
|
||||
if (res.code == 0) {
|
||||
ElMessage.success(res.msg || "请求成功");
|
||||
} else {
|
||||
ElMessage.error(res.msg || "请求失败");
|
||||
}
|
||||
};
|
||||
const logout = async () => {
|
||||
const res = await myApi.logOut();
|
||||
// 解析返回数据
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
// 获取数据
|
||||
console.log(new TextDecoder().decode(ret.data));
|
||||
localRemove("token");
|
||||
window.location.reload();
|
||||
} else {
|
||||
console.log(ret);
|
||||
}
|
||||
};
|
||||
|
||||
const editPass = () => {
|
||||
state.dialogVisible = true;
|
||||
};
|
||||
const back = () => {
|
||||
router.back();
|
||||
};
|
||||
router.afterEach((to) => {
|
||||
console.log("to", to);
|
||||
const { id } = to.query;
|
||||
state.name = pathMap[to.name];
|
||||
// state.hasBack = ['level2', 'level3', 'order_detail'].includes(to.name)
|
||||
});
|
||||
return {
|
||||
...toRefs(state),
|
||||
logout,
|
||||
back,
|
||||
editPass,
|
||||
dialogClose,
|
||||
dialogSuccess,
|
||||
reStart,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
height: 50px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
}
|
||||
.el-icon-back {
|
||||
border: 1px solid #e9e9e9;
|
||||
padding: 4px;
|
||||
border-radius: 50px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.right > div > .icon {
|
||||
font-size: 18px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
.author {
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.popper-user-box {
|
||||
background: url("https://s.yezgea02.com/lingling-h5/static/account-banner-bg.png")
|
||||
50% 50% no-repeat !important;
|
||||
background-size: cover !important;
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
.popper-user-box .nickname {
|
||||
position: relative;
|
||||
color: #ffffff;
|
||||
}
|
||||
.popper-user-box .nickname .logout {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.editPass {
|
||||
position: absolute;
|
||||
right: 75px;
|
||||
top: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.reStart {
|
||||
position: absolute;
|
||||
right: 150px;
|
||||
top: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,77 @@
|
|||
<template>
|
||||
<ul class="left-menus">
|
||||
<li v-for="(item,i) in menus" :style="{backgroundColor: item.color}" :class="activeindex === i? 'active-menu' : ''" @click="activeindex = i, go()"> {{ item.name }} </li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
export default {
|
||||
name: "leftMenu",
|
||||
setup(props, ctx) {
|
||||
const router = useRouter();
|
||||
const state = reactive({
|
||||
menus:[
|
||||
{
|
||||
name: '电',
|
||||
color: '#3794FC'
|
||||
},
|
||||
{
|
||||
name: '水',
|
||||
color: '#85B335'
|
||||
},
|
||||
{
|
||||
name: '气',
|
||||
color: '#CAA441'
|
||||
},
|
||||
{
|
||||
name: '煤',
|
||||
color: '#347CAE'
|
||||
},
|
||||
{
|
||||
name: '油',
|
||||
color: '#54BCBD'
|
||||
}
|
||||
],
|
||||
activeindex: 0
|
||||
});
|
||||
onMounted(() => {
|
||||
});
|
||||
const go = () => {
|
||||
ctx.emit("showContent", state.activeindex);
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
go
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.left-menus {
|
||||
height: 700px;
|
||||
width: 50px;
|
||||
border: 1px solid #c3c3c3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
li {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
&.active-menu {
|
||||
border: 1px solid #5019cf;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<template>
|
||||
<ul class="menus">
|
||||
<li v-for="(item,i) in menus" :class="activeI === i? 'active-menu' : ''" @click="activeI = i, go(item.url)"> {{ item.name }} </li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
export default {
|
||||
name: "Header",
|
||||
props: ["pactiveI"],
|
||||
setup(props, ctx) {
|
||||
const router = useRouter();
|
||||
const state = reactive({
|
||||
menus:[
|
||||
{
|
||||
name: '能耗首页',
|
||||
url: '/'
|
||||
},
|
||||
{
|
||||
name: '能耗详情',
|
||||
url: '/info'
|
||||
},
|
||||
{
|
||||
name: '能耗查询',
|
||||
url: '/search'
|
||||
},
|
||||
{
|
||||
name: '能耗足迹',
|
||||
url: '/history'
|
||||
},
|
||||
{
|
||||
name: '能耗预警',
|
||||
url: '/worning'
|
||||
},
|
||||
{
|
||||
name: '碳排放管理',
|
||||
url: '/maneger'
|
||||
}
|
||||
],
|
||||
activeI: 0
|
||||
});
|
||||
onMounted(() => {
|
||||
if (props.pactiveI) {
|
||||
state.activeI = props.pactiveI;
|
||||
}
|
||||
});
|
||||
|
||||
const go = (url) => {
|
||||
console.log(44, router)
|
||||
router.push(url);
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
go
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menus {
|
||||
height: 8%;
|
||||
width: 100%;
|
||||
border-radius: 20px;
|
||||
border: 1px solid #c3c3c3;
|
||||
display: flex;
|
||||
padding: 0 15px;
|
||||
align-items: center;
|
||||
li {
|
||||
width: 10%;
|
||||
// border: 1px solid red;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&.active-menu
|
||||
{
|
||||
border: 1px solid #5019cf;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
<template>
|
||||
<el-aside class="aside">
|
||||
<div class="head">
|
||||
<div>
|
||||
<img src="../assets/logo.png" alt="logo" />
|
||||
<span>数据控制</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line" />
|
||||
<el-menu
|
||||
:default-openeds="state.defaultOpen"
|
||||
background-color="#222832"
|
||||
text-color="#fff"
|
||||
:router="true"
|
||||
:default-active="currentPath"
|
||||
>
|
||||
<div v-for="(list, i) of state.menuList" :key="i">
|
||||
<el-sub-menu :index="list.index" v-if="list.children.length > 0">
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<component :is="list.iconName"></component></el-icon>
|
||||
<span>{{ list.name }}</span>
|
||||
</template>
|
||||
<el-menu-item
|
||||
:index="item.index"
|
||||
v-for="(item, index) of list.children"
|
||||
:key="index"
|
||||
>{{ item.name }}</el-menu-item
|
||||
>
|
||||
</el-sub-menu>
|
||||
<el-menu-item v-else :index="list.index"
|
||||
><el-icon>
|
||||
<component :is="list.iconName"></component></el-icon>{{ list.name }}</el-menu-item
|
||||
>
|
||||
</div>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { useStore } from "vuex";
|
||||
export default {
|
||||
name: "Sidebar",
|
||||
props: {
|
||||
currentPath: String,
|
||||
},
|
||||
setup() {
|
||||
const store = useStore();
|
||||
const state = reactive({
|
||||
defaultOpen: ["1"],
|
||||
menuList: [
|
||||
{
|
||||
id: 1,
|
||||
name: "设备信息",
|
||||
index: "/home",
|
||||
iconName: 'FolderRemove',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "网络配置",
|
||||
index: "/net",
|
||||
iconName: 'Management',
|
||||
children: [],
|
||||
},
|
||||
// {
|
||||
// id: 4,
|
||||
// name: "透传管理",
|
||||
// index: "/transparent",
|
||||
// iconName: 'Management',
|
||||
// children: [],
|
||||
// },
|
||||
{
|
||||
id: 3,
|
||||
name: "数据管理",
|
||||
index: "/model",
|
||||
iconName: 'TrendCharts',
|
||||
children: [
|
||||
{
|
||||
id: 3 - 1,
|
||||
name: "模板管理",
|
||||
index: "/model",
|
||||
},
|
||||
{
|
||||
id: 3 - 2,
|
||||
name: "通讯管理",
|
||||
index: "/page",
|
||||
},
|
||||
// {
|
||||
// id: 3 - 2,
|
||||
// name: "实时数据",
|
||||
// index: "/data",
|
||||
// },
|
||||
{
|
||||
id: 3 - 3,
|
||||
name: "上报管理",
|
||||
index: "/report",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
return {
|
||||
state,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.aside {
|
||||
width: 200px !important;
|
||||
background-color: #222832;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
-ms-overflow-style: none;
|
||||
overflow: -moz-scrollbars-none;
|
||||
}
|
||||
.aside::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 50px;
|
||||
div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
img {
|
||||
width: 40px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
span {
|
||||
font-size: 20px;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.line {
|
||||
border-top: 1px solid hsla(0, 0%, 100%, 0.05);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,239 @@
|
|||
html,
|
||||
body,
|
||||
#app {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
ul,
|
||||
p,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
ul,
|
||||
h5 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
ul,
|
||||
li,
|
||||
a,
|
||||
b,
|
||||
s {
|
||||
list-style: none;
|
||||
}
|
||||
.el-breadcrumb {
|
||||
margin-bottom: 15px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.el-main {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
.el-card {
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;
|
||||
}
|
||||
.el-table,
|
||||
.el-pagination {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-button--primary {
|
||||
border: 0 !important;
|
||||
}
|
||||
.mb {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.mt {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.ml {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.mt15 {
|
||||
margin-top: 15px;
|
||||
}
|
||||
.mt5 {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.btns {
|
||||
text-align: center;
|
||||
}
|
||||
.el-drawer {
|
||||
width: 50% !important;
|
||||
padding: 20px 15px;
|
||||
}
|
||||
.title-form {
|
||||
height: 50px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.el-select,
|
||||
.el-date-editor {
|
||||
width: 100% !important;
|
||||
}
|
||||
.right-pop {
|
||||
.el-input__inner {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
}
|
||||
.el-upload--picture-card {
|
||||
width: 48px !important;
|
||||
height: 48px !important;
|
||||
line-height: 55px !important;
|
||||
}
|
||||
.el-upload-list--picture-card .el-upload-list__item {
|
||||
width: 48px !important;
|
||||
height: 48px !important;
|
||||
}
|
||||
.el-container {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.v-modal {
|
||||
z-index: 2000 !important;
|
||||
}
|
||||
.rt {
|
||||
float: right;
|
||||
}
|
||||
.menu-right-pop {
|
||||
.el-form {
|
||||
padding: 50px 20px !important;
|
||||
}
|
||||
}
|
||||
.no-label {
|
||||
.el-radio__label {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
.space-between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.el-dialog__header {
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.el-upload-list__item {
|
||||
transition: none !important;
|
||||
}
|
||||
.border {
|
||||
border: 1px solid red;
|
||||
}
|
||||
.bottom-menu {
|
||||
/* width: 100%; */
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
left: 50%;
|
||||
text-align: center;
|
||||
z-index: 10000;
|
||||
transform: translate(-50%);
|
||||
}
|
||||
.turn {
|
||||
background: rgba(15, 179, 251, 0.2);
|
||||
color: #00ffff !important;
|
||||
animation: turn 1s linear infinite;
|
||||
}
|
||||
@keyframes turn {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
25% {
|
||||
-webkit-transform: rotate(90deg);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: rotate(180deg);
|
||||
}
|
||||
75% {
|
||||
-webkit-transform: rotate(270deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.bottom-menu span {
|
||||
display: inline-block;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
border-radius: 50%;
|
||||
margin-right: 100px;
|
||||
box-shadow: 0 0 15px 8px rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
.bottom-menu span img {
|
||||
vertical-align: -2px;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.xh-allow-up::after,
|
||||
.xh-allow-down::after {
|
||||
border: solid 2px #fff;
|
||||
border-bottom-width: 0;
|
||||
border-left-width: 0;
|
||||
content: " ";
|
||||
top: 22px;
|
||||
right: 20px;
|
||||
position: absolute;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
transform: translateY(-50%) rotate(-45deg);
|
||||
}
|
||||
.xh-allow-down::after {
|
||||
transform: translateY(-50%) rotate(135deg);
|
||||
}
|
||||
.move-enter {
|
||||
max-height: 0;
|
||||
}
|
||||
.move-enter-active {
|
||||
max-height: 480px;
|
||||
-webkit-transition: max-height 0.5s cubic-bezier(1, 0.5, 0.8, 1);
|
||||
transition: max-height 0.5s cubic-bezier(1, 0.5, 0.8, 1);
|
||||
}
|
||||
.move-leave {
|
||||
max-height: 0;
|
||||
}
|
||||
.move-leave-active {
|
||||
max-height: 0;
|
||||
-webkit-transition: max-height 0.5s cubic-bezier(1, 0.5, 0.8, 1);
|
||||
transition: max-height 0.5s cubic-bezier(1, 0.5, 0.8, 1);
|
||||
}
|
||||
/*滚动条样式*/
|
||||
::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 4px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: inset 0 0 5px #00ffff;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 0;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.content-div {
|
||||
width:100%;
|
||||
height:100%;
|
||||
.all-content {
|
||||
width:100%;
|
||||
height:100%;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
import router from "./router/index";
|
||||
import store from "./store/index";
|
||||
import "./css/index.scss";
|
||||
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
|
||||
const app = createApp(App);
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn
|
||||
})
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component);
|
||||
}
|
||||
|
||||
app.use(ElementPlus);
|
||||
app.use(router);
|
||||
app.use(store);
|
||||
|
||||
app.mount("#app");
|
|
@ -0,0 +1,17 @@
|
|||
syntax = "proto3";
|
||||
option go_package = "data/";
|
||||
|
||||
message com_list{
|
||||
repeated com_info com = 1;
|
||||
}
|
||||
|
||||
message com_info{
|
||||
string name = 1;
|
||||
string path = 2;
|
||||
bool used = 3;
|
||||
int32 baud_rate = 4;
|
||||
int32 data_bits = 5;
|
||||
int32 stop_bits = 6;
|
||||
string parity = 7;
|
||||
int32 timeout = 8;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
syntax = "proto3";
|
||||
option go_package = "data/";
|
||||
|
||||
message info{
|
||||
Basicinfo basicinfo = 1;
|
||||
Hostinfo hostinfo = 2;
|
||||
Meminfo meminfo = 3;
|
||||
repeated Diskinfo diskinfo = 4;
|
||||
repeated Netinfo netinfo = 5;
|
||||
}
|
||||
|
||||
// 基本信息
|
||||
message Basicinfo{
|
||||
string model = 1; // 设备型号
|
||||
string sn = 2; // 设备SN
|
||||
string first_time = 3; // 初次激活时间
|
||||
}
|
||||
|
||||
// 主机信息
|
||||
message Hostinfo{
|
||||
int32 cpu = 1; // cpu核数
|
||||
string uptime = 2; // 开机时长
|
||||
string boottime = 3; // 开机时间
|
||||
}
|
||||
|
||||
// 内存信息
|
||||
message Meminfo{
|
||||
double total = 1; // 总大小
|
||||
double available = 2; // 可用
|
||||
double used = 3; // 已用
|
||||
double used_percent = 4; // 已用占比
|
||||
double free = 5; // 空闲
|
||||
double buffers = 6; // 缓冲区
|
||||
double cached = 7; // 缓存
|
||||
}
|
||||
|
||||
// 存储信息
|
||||
message Diskinfo{
|
||||
string name = 1; // 名称
|
||||
string path = 2; // 路径
|
||||
double total = 3; // 总大小
|
||||
double free = 4; // 空闲
|
||||
double used = 5; // 已用
|
||||
double used_percent = 6; // 已用占比
|
||||
}
|
||||
|
||||
// 网络信息
|
||||
message Netinfo{
|
||||
string name = 1; // 网卡名称
|
||||
uint64 bytesSent = 2; // number of bytes sent
|
||||
uint64 bytesRecv = 3; // number of bytes received
|
||||
uint64 packetsSent = 4; // number of packets sent
|
||||
uint64 packetsRecv = 5; // number of packets received
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
syntax = "proto3";
|
||||
option go_package = "data/";
|
||||
|
||||
message net_info{
|
||||
repeated ip_info ip = 1;
|
||||
dns_info dns = 2;
|
||||
}
|
||||
|
||||
message ip_info{
|
||||
string name = 1;
|
||||
string mode = 2;
|
||||
string ip = 3;
|
||||
string mk = 4;
|
||||
string gw = 5;
|
||||
}
|
||||
|
||||
message dns_info{
|
||||
string dns1 = 1;
|
||||
string dns2 = 2;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
syntax = "proto3";
|
||||
option go_package = "data/";
|
||||
|
||||
message response{
|
||||
uint32 code = 1;
|
||||
bytes data = 2;
|
||||
string msg = 3;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
syntax = "proto3";
|
||||
option go_package = "data/";
|
||||
|
||||
message user{
|
||||
string name = 1;
|
||||
string password = 2;
|
||||
fixed64 timestamp = 3;
|
||||
}
|
||||
|
||||
message token{
|
||||
string name = 1;
|
||||
string token = 2;
|
||||
fixed64 timestamp = 3;
|
||||
fixed64 expiration_time = 4;
|
||||
}
|
||||
|
||||
message passwd{
|
||||
string name = 1;
|
||||
string old_password = 2;
|
||||
string new_password = 3;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(), // hash模式:createWebHashHistory,history模式:createWebHistory
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue')
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue')
|
||||
},
|
||||
{
|
||||
path: '/info',
|
||||
name: 'info',
|
||||
component: () => import(/* webpackChunkName: "login" */ '../views/Info.vue')
|
||||
},
|
||||
{
|
||||
path: '/search',
|
||||
name: 'search',
|
||||
component: () => import(/* webpackChunkName: "login" */ '../views/Search.vue')
|
||||
},
|
||||
{
|
||||
path: '/history',
|
||||
name: 'history',
|
||||
component: () => import(/* webpackChunkName: "login" */ '../views/History.vue')
|
||||
},
|
||||
{
|
||||
path: '/worning',
|
||||
name: 'worning',
|
||||
component: () => import(/* webpackChunkName: "login" */ '../views/Worning.vue')
|
||||
},
|
||||
{
|
||||
path: '/maneger',
|
||||
name: 'maneger',
|
||||
component: () => import(/* webpackChunkName: "login" */ '../views/Maneger.vue')
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
|
@ -0,0 +1,37 @@
|
|||
import { createStore } from "vuex"
|
||||
// 引入持久化
|
||||
import createPersistedState from 'vuex-persistedstate';
|
||||
|
||||
const store = createStore({
|
||||
state: {
|
||||
currentPath: '',
|
||||
userInfo: {}
|
||||
},
|
||||
mutations: {
|
||||
updateCurrentPath(state, path) {
|
||||
state.currentPath = path
|
||||
},
|
||||
setUserInfo(state, data) {
|
||||
console.log(123, data);
|
||||
state.userInfo = data;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
updateCurrentPath({ commit }, path) {
|
||||
commit('updateCurrentPath', path)
|
||||
}
|
||||
},
|
||||
modules: {},
|
||||
getters: {
|
||||
getCurrentPath(state) {
|
||||
return state.currentPath;
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
createPersistedState({
|
||||
key: 'vuex',
|
||||
storage: window.localStorage
|
||||
})
|
||||
]
|
||||
})
|
||||
export default store
|
|
@ -0,0 +1,85 @@
|
|||
import axios from "axios";
|
||||
import md5 from "js-md5";
|
||||
import { Base64 } from "js-base64";
|
||||
import { ElMessage } from "element-plus";
|
||||
import router from "@/router/index";
|
||||
import { localGet } from "./index";
|
||||
import config from "~/config";
|
||||
import { token } from '../proto/data/pd'
|
||||
|
||||
axios.defaults.baseURL = config[import.meta.env.MODE].baseUrl;
|
||||
axios.defaults.withCredentials = true;
|
||||
// 请求头,headers 信息
|
||||
axios.defaults.headers["X-Requested-With"] = "XMLHttpRequest";
|
||||
|
||||
// axios.defaults.headers = getNeedToken();
|
||||
|
||||
|
||||
// function getNeedToken() {
|
||||
// console.log(333, localGet("token"));
|
||||
// const ret_token = localGet("token");
|
||||
// if (ret_token) {
|
||||
// ret_token.timestamp = new Date().getTime();
|
||||
// const tokenInfo = token.encode(ret_token).finish();
|
||||
// // 直接转换为string丢到header里,header的key为"cdcm"
|
||||
// const cdcm = tokenInfo.slice(0, tokenInfo.length).toString()
|
||||
// return { cdcm };
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// 请求拦截器,内部根据返回值,重新组装,统一管理。
|
||||
axios.interceptors.response.use(
|
||||
(res) => {
|
||||
return res.data;
|
||||
},
|
||||
(error) => {
|
||||
ElMessage.closeAll();
|
||||
ElMessage.error(error || "401 Unauthorized");
|
||||
router.push({ path: "/login" });
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
// post请求
|
||||
export function postJsonRequest(url, params) {
|
||||
return axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
data: params,
|
||||
// responseType: 'arraybuffer',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
// get请求
|
||||
export function getRequest(url, params) {
|
||||
return axios({
|
||||
method: "get",
|
||||
// responseType: 'arraybuffer',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteRequest(url, params) {
|
||||
return axios({
|
||||
method: "delete",
|
||||
data: params,
|
||||
// responseType: 'arraybuffer',
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
export const putRequest = (url, params) => {
|
||||
return axios({
|
||||
method: "put",
|
||||
data: params,
|
||||
// responseType: 'arraybuffer',
|
||||
url: url,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
export function localGet (key) {
|
||||
const value = window.localStorage.getItem(key)
|
||||
try {
|
||||
return JSON.parse(window.localStorage.getItem(key))
|
||||
} catch (error) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
export function localSet (key, value) {
|
||||
window.localStorage.setItem(key, JSON.stringify(value))
|
||||
}
|
||||
|
||||
|
||||
export function localRemove (key) {
|
||||
window.localStorage.removeItem(key)
|
||||
}
|
||||
|
||||
// 判断内容是否含有表情字符,现有数据库不支持。
|
||||
export function hasEmoji (str = '') {
|
||||
const reg = /[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g;
|
||||
return str.match(reg) && str.match(reg).length
|
||||
}
|
||||
|
||||
// 单张图片上传
|
||||
export const uploadImgServer = 'http://backend-api-02.newbee.ltd/manage-api/v1/upload/file'
|
||||
// 多张图片上传
|
||||
export const uploadImgsServer = 'http://backend-api-02.newbee.ltd/manage-api/v1/upload/files'
|
||||
|
||||
export const pathMap = {
|
||||
login: '登录',
|
||||
home: '能耗首页',
|
||||
info: '能耗详情',
|
||||
search: '能耗查询',
|
||||
history: '能耗足迹',
|
||||
worning: '能耗预警',
|
||||
maneger: '碳排放管理',
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<template>
|
||||
<div class="info">
|
||||
<Menus :pactiveI="3"/>
|
||||
<div class="bottom">
|
||||
<LeftMenu @showContent="showContent" />
|
||||
<div class="search-content" v-if="activeindex === 0">
|
||||
044
|
||||
</div>
|
||||
<div class="search-content" v-if="activeindex === 1">
|
||||
1
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import LeftMenu from "@/components/LeftMenu.vue";
|
||||
import Menus from "@/components/Menus.vue";
|
||||
export default {
|
||||
name: "history",
|
||||
components: {
|
||||
LeftMenu,
|
||||
Menus
|
||||
},
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeindex: 0
|
||||
});
|
||||
onMounted(() => {
|
||||
});
|
||||
const showContent = (i) => {
|
||||
console.log(i)
|
||||
state.activeindex = i;
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
showContent
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info
|
||||
{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bottom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 92%;
|
||||
border: 1px solid red;
|
||||
}
|
||||
.search-content {
|
||||
width: calc(100% - 50px);
|
||||
border: 1px solid red;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,362 @@
|
|||
<template>
|
||||
<el-card class="content-div">
|
||||
<div class="all-content">
|
||||
<Menus :activeI="0"/>
|
||||
<div class="top-div">
|
||||
<div class="left-div">
|
||||
<el-carousel height="258px" >
|
||||
<el-carousel-item v-for="item in imgArr" :key="item">
|
||||
<h3><img :src="requireImg(item.src)" alt=""></h3>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
<div id="echartDiv" class="echartDiv"></div>
|
||||
</div>
|
||||
<div class="right-div">
|
||||
<el-calendar>
|
||||
<template #date-cell="{ data }">
|
||||
<p :class="data.isSelected ? 'is-selected' : ''">
|
||||
{{ data.day.split('-').slice(2).join('') }}
|
||||
{{ data.isSelected ? '✔️' : '' }}
|
||||
</p>
|
||||
</template>
|
||||
</el-calendar>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-div">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>电</span>
|
||||
</div>
|
||||
<div id="echartE" class="echartDiv100"></div>
|
||||
<div class="flex-around s-circle">
|
||||
<el-progress type="circle" :stroke-width="10" v-for="item in eleArr" :percentage="item.value">
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-label">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="water">水</span>
|
||||
</div>
|
||||
<div id="echartW" class="echartDiv100"></div>
|
||||
<div class="flex-around s-circle">
|
||||
<el-progress type="circle" :stroke-width="10" status="success" v-for="item in waterArr" :percentage="item.value">
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-label">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import * as echarts from "echarts";
|
||||
import Menus from "@/components/Menus.vue";
|
||||
export default {
|
||||
name: "home",
|
||||
components: {
|
||||
Menus
|
||||
},
|
||||
setup() {
|
||||
const state = reactive({
|
||||
imgArr: [{
|
||||
src: 'bg.png'
|
||||
},{
|
||||
src: 'bg3.png'
|
||||
}],
|
||||
eleArr:[{
|
||||
name:'实时量',
|
||||
value: 50
|
||||
},{
|
||||
name:'同比',
|
||||
value: 50
|
||||
},{
|
||||
name:'环比',
|
||||
value: 50
|
||||
}],
|
||||
waterArr: [{
|
||||
name:'实时量',
|
||||
value: 50
|
||||
},{
|
||||
name:'同比',
|
||||
value: 50
|
||||
},{
|
||||
name:'环比',
|
||||
value: 50
|
||||
}]
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
drawAll();
|
||||
dreawEandW("echartE", "#7CBBF7", "#5470C6", "当日用电", "同比用电");
|
||||
dreawEandW("echartW", "#2CFEF7", "#51BDBE", "当日用水", "同比用水");
|
||||
});
|
||||
|
||||
|
||||
const requireImg = (imgPath) => {
|
||||
return new URL(`../assets/${imgPath}`, import.meta.url).href;
|
||||
};
|
||||
const drawAll = () => {
|
||||
var dom = document.getElementById("echartDiv");
|
||||
var op = {
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
top: '5%',
|
||||
left: 'center'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '能耗用量',
|
||||
type: 'pie',
|
||||
radius: ['30%', '50%'],
|
||||
avoidLabelOverlap: false,
|
||||
itemStyle: {
|
||||
borderRadius: 10,
|
||||
borderColor: '#fff',
|
||||
borderWidth: 2
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{ value: 20, name: '用电' },
|
||||
{ value: 20, name: '用水' },
|
||||
{ value: 40, name: '其他' }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
getEchart(dom, op)
|
||||
}
|
||||
const getEchart = (dom, op) => {
|
||||
|
||||
if (dom) {
|
||||
var myChart = echarts.init(dom);
|
||||
var option = op;
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
};
|
||||
/***************************************************** */
|
||||
|
||||
const dreawEandW = (name, lineColor, barColor, barName, lineName) => {
|
||||
var dom = document.getElementById(name);
|
||||
if (dom) {
|
||||
var myChart = echarts.init(dom);
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: {
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
bottom: '5%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
data: [barName, lineName]
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1点', '2点', '3点', '4点', '5点', '6点', '7点',
|
||||
'8点', '9点', '10点', '11点', '12点', '13点', '14点','15点',
|
||||
'16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点', '24点']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: barName,
|
||||
data: [120, 200, 150, 80, 70, 110, 130,120, 200, 150, 80, 70, 110, 130,120, 200, 150, 80, 70, 110, 130, 70, 110, 130],
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: barColor
|
||||
}
|
||||
},
|
||||
{
|
||||
name: lineName,
|
||||
data: [150, 230, 224, 218, 135, 147, 260,150, 230, 224, 218, 135, 147, 260,150, 230, 224, 218, 135, 147, 260,150, 230],
|
||||
type: 'line',
|
||||
itemStyle: {
|
||||
color: lineColor
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
requireImg,
|
||||
getEchart,
|
||||
drawAll,
|
||||
dreawEandW,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.el-carousel {
|
||||
width: 70% !important;
|
||||
.el-carousel__container {
|
||||
width: 100% !important;
|
||||
}
|
||||
.el-carousel__item--card.is-active {
|
||||
height: 100%;
|
||||
// border: 1px solid red;
|
||||
h3 {
|
||||
height: 100%;
|
||||
// border: 1px solid blue;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.is-selected {
|
||||
color: #1989fa;
|
||||
}
|
||||
.el-calendar__header {
|
||||
padding: 0 10px;
|
||||
}
|
||||
.el-button-group>.el-button {
|
||||
border: 0;
|
||||
}
|
||||
.el-calendar-table .el-calendar-day {
|
||||
height: 45px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.el-calendar__body {
|
||||
padding: 0;
|
||||
}
|
||||
.s-circle .el-progress-circle {
|
||||
width: 70px !important;
|
||||
height: 70px !important;
|
||||
}
|
||||
.percentage-value {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
font-size: 28px;
|
||||
}
|
||||
.percentage-label {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.demo-progress .el-progress--line {
|
||||
margin-bottom: 15px;
|
||||
width: 350px;
|
||||
}
|
||||
.demo-progress .el-progress--circle {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.bottom-div > .box-card .flex-around span {
|
||||
background:transparent !important;
|
||||
color: #333 !important;
|
||||
font-size: 12px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.all-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-div {
|
||||
height: 35%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
|
||||
}
|
||||
.bottom-div {
|
||||
height: 55%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border: 1px solid #c3c3c3;
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
> .box-card {
|
||||
width: 49.5%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
span {
|
||||
display: inline-block;
|
||||
padding: 5px 20px;
|
||||
background: #0a82f3;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
&.water {
|
||||
background: #3dc21c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.left-div {
|
||||
height: 100%;
|
||||
width: 77%;
|
||||
border: 1px solid #c3c3c3;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
padding: 20px;
|
||||
}
|
||||
.right-div {
|
||||
height: 100%;
|
||||
width: 22%;
|
||||
border: 1px solid #c3c3c3;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
}
|
||||
.echartDiv {
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.echartDiv100 {
|
||||
width: 100%;
|
||||
height: 70%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.circle {
|
||||
height: 38%;
|
||||
}
|
||||
.flex-around
|
||||
{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 100px;
|
||||
// border: 1px solid red;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,291 @@
|
|||
<template>
|
||||
<div class="info">
|
||||
<Menus :pactiveI="1"/>
|
||||
<div class="bottom">
|
||||
<LeftMenu @showContent="showContent" />
|
||||
<div class="search-content">
|
||||
<div class="times">
|
||||
<el-date-picker
|
||||
v-model="timeValue"
|
||||
type="date"
|
||||
placeholder="请选择日期"
|
||||
:size="size"
|
||||
/>
|
||||
<el-button type="primary" @click="searchByDate">查询</el-button>
|
||||
</div>
|
||||
<div class="middle-content">
|
||||
<div class="div30">
|
||||
<div id="echartDiv" class="echartDiv"></div>
|
||||
</div>
|
||||
<div class="div30">
|
||||
<div class="flex-around">
|
||||
<el-progress type="circle" :stroke-width="12" v-for="item in arr" :percentage="item.value">
|
||||
<template #default="{ percentage }">
|
||||
<span class="percentage-label">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
<span class="percentage-value">{{ percentage }}%</span>
|
||||
</template>
|
||||
</el-progress>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div30">
|
||||
<div id="drawTop5" class="echartDiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-content">
|
||||
<div id="echartE" class="echartDiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import LeftMenu from "@/components/LeftMenu.vue";
|
||||
import Menus from "@/components/Menus.vue";
|
||||
export default {
|
||||
name: "info",
|
||||
components: {
|
||||
LeftMenu,
|
||||
Menus
|
||||
},
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeindex: 0,
|
||||
timeValue: '',
|
||||
arr:[{
|
||||
name:'实时量',
|
||||
value: 20
|
||||
},{
|
||||
name:'同比',
|
||||
value: 50
|
||||
},{
|
||||
name:'环比',
|
||||
value: 50
|
||||
}],
|
||||
});
|
||||
onMounted(() => {
|
||||
drawAll();
|
||||
drawTop5();
|
||||
dreawEandW("echartE", "#7CBBF7", "#5470C6", "当日用电", "同比用电");
|
||||
});
|
||||
const searchByDate = () => {
|
||||
|
||||
}
|
||||
const showContent = (i) => {
|
||||
console.log(i)
|
||||
state.activeindex = i;
|
||||
}
|
||||
const drawAll = () => {
|
||||
var dom = document.getElementById("echartDiv");
|
||||
var op = {
|
||||
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
top: '5%',
|
||||
left: 'center'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '照明插座',
|
||||
type: 'pie',
|
||||
radius: ['40%', '60%'],
|
||||
center: ['50%', '60%'],
|
||||
avoidLabelOverlap: false,
|
||||
itemStyle: {
|
||||
borderRadius: 10,
|
||||
borderColor: '#fff',
|
||||
borderWidth: 2
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{ value: 20, name: '空调用电' },
|
||||
{ value: 20, name: '动力用电' },
|
||||
{ value: 40, name: '其他用电' }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
getEchart(dom, op)
|
||||
}
|
||||
const drawTop5 = () => {
|
||||
var dom = document.getElementById("drawTop5");
|
||||
var op = {
|
||||
color: '#DB7459',
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, 0.01]
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: ['冷却塔电表', '离心机电表', '电梯电表', '电梯电表01', '电梯电表02', '循环泵电表']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '电表TOP5',
|
||||
type: 'bar',
|
||||
barWidth: 20,
|
||||
data: [18203, 23489, 29034, 104970, 131744, 430230]
|
||||
}
|
||||
]
|
||||
};
|
||||
getEchart(dom, op)
|
||||
}
|
||||
const dreawEandW = (name, lineColor, barColor, barName, lineName) => {
|
||||
var dom = document.getElementById(name);
|
||||
if (dom) {
|
||||
var myChart = echarts.init(dom);
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: {
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
bottom: '5%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
data: [barName, lineName]
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1点', '2点', '3点', '4点', '5点', '6点', '7点',
|
||||
'8点', '9点', '10点', '11点', '12点', '13点', '14点','15点',
|
||||
'16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点', '24点']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: barName,
|
||||
barWidth: 26,
|
||||
data: [120, 200, 150, 80, 70, 110, 130,120, 200, 150, 80, 70, 110, 130,120, 200, 150, 80, 70, 110, 130, 70, 110, 130],
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: barColor
|
||||
}
|
||||
},
|
||||
{
|
||||
name: lineName,
|
||||
data: [150, 230, 224, 218, 135, 147, 260,150, 230, 224, 218, 135, 147, 260,150, 230, 224, 218, 135, 147, 260,150, 230],
|
||||
type: 'line',
|
||||
itemStyle: {
|
||||
color: lineColor
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
}
|
||||
const getEchart = (dom, op) => {
|
||||
if (dom) {
|
||||
var myChart = echarts.init(dom);
|
||||
var option = op;
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
showContent,
|
||||
drawAll,
|
||||
getEchart,
|
||||
drawTop5,
|
||||
searchByDate
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.el-date-editor {
|
||||
width: 20% !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.info
|
||||
{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bottom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 92%;
|
||||
// border: 1px solid red;
|
||||
}
|
||||
.search-content {
|
||||
width: calc(100% - 50px);
|
||||
// border: 1px solid red;
|
||||
.times {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
// justify-content: center;
|
||||
margin: 10px;
|
||||
}
|
||||
.middle-content {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.div30 {
|
||||
width: 33%;
|
||||
height: 100%;
|
||||
// border: 1px solid red;
|
||||
|
||||
.flex-around
|
||||
{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
// border: 1px solid red;
|
||||
}
|
||||
}
|
||||
}
|
||||
.bottom-content {
|
||||
width: 100%;
|
||||
height: calc(100% - 360px);
|
||||
// border: 1px solid red;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
.echartDiv {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
<template>
|
||||
<div class="login-body">
|
||||
<div class="login-container">
|
||||
<div class="head">
|
||||
<img class="logo" src="../assets/logo.png" />
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="left-bottom"></div>
|
||||
<div class="middle-bottom"></div>
|
||||
<div class="right-bottom">
|
||||
<div class="title">数据控制器</div>
|
||||
<div class="s-title">登录LOGIN</div>
|
||||
<el-form label-position="top" :rules="rules" :model="ruleForm" ref="loginForm" class="login-form" size="large">
|
||||
<el-form-item prop="username">
|
||||
<el-input type="text" v-model.trim="ruleForm.username" autocomplete="off" placeholder="请输入账号">
|
||||
<template #prefix>
|
||||
<img class="logo" src="../assets/user.png" width="16" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input type="password" v-model.trim="ruleForm.password" autocomplete="off" placeholder="请输入密码"
|
||||
@keyup.enter="submitForm">
|
||||
<template #prefix>
|
||||
<img class="logo" src="../assets/ps.png" width="16" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item class="login-btn">
|
||||
<el-button style="width: 100%" type="primary" @click="submitForm">立即登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { reactive, ref, toRefs } from "vue";
|
||||
import { localSet, localGet } from "@/utils";
|
||||
import myApi from "@/api/myApi.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { user, token, response } from '../proto/data/pd'
|
||||
import axios from "axios";
|
||||
import md5 from 'js-md5'
|
||||
export default {
|
||||
name: "Login",
|
||||
setup() {
|
||||
const loginForm = ref(null);
|
||||
const state = reactive({
|
||||
ruleForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
},
|
||||
checked: true,
|
||||
rules: {
|
||||
username: [
|
||||
{ required: "true", message: "账户不能为空", trigger: "blur" },
|
||||
],
|
||||
password: [
|
||||
{ required: "true", message: "密码不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
});
|
||||
const submitForm = async () => {
|
||||
// 将返回token传入路由
|
||||
localSet('token', '12');
|
||||
// 跳转
|
||||
window.location.href = '/home';
|
||||
// loginForm.value.validate(async (valid) => {
|
||||
// if (valid) {
|
||||
|
||||
// if (res.code == 0) {
|
||||
|
||||
// } else {
|
||||
// console.log(ret);
|
||||
// }
|
||||
// } else {
|
||||
// console.log("error submit!!");
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
};
|
||||
const resetForm = () => {
|
||||
loginForm.value.resetFields();
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
loginForm,
|
||||
submitForm,
|
||||
resetForm,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.login-body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
background: url("../assets/bg.png") no-repeat center;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
width: 1280px;
|
||||
height: 750px;
|
||||
border-radius: 4px;
|
||||
background: url("../assets/bg1.png") no-repeat center;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40px 0 20px 180px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.head img {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
height: 65%;
|
||||
display: flex;
|
||||
|
||||
.left-bottom {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.middle-bottom {
|
||||
width: 690px;
|
||||
background: url("../assets/bg3.png") no-repeat center;
|
||||
}
|
||||
|
||||
.right-bottom {
|
||||
width: 360px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
padding: 20px 0 40px 0;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.s-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
width: 85%;
|
||||
margin: 40px auto;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.el-form--label-top .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.login-form .el-form-item {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
margin-top: 80px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,229 @@
|
|||
<template>
|
||||
<div class="info">
|
||||
<Menus :pactiveI="2"/>
|
||||
<div class="bottom">
|
||||
<LeftMenu @showContent="showContent" />
|
||||
<div class="search-content">
|
||||
<div class="search-top">
|
||||
<el-select v-model="value1" placeholder="请选择" size="mini">
|
||||
<el-option
|
||||
v-for="item in fxOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select v-model="value2" placeholder="请选择" size="mini">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<div class="date-container">
|
||||
<el-date-picker
|
||||
style="width: 300px;"
|
||||
v-model="timeValue"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="起始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="echartDiv" class="echartDiv"></div>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="tableData" style="width: 100%" border="1" height="360">
|
||||
<el-table-column v-for="item in tableHeader" :prop="item.prop" :label="item.label" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import LeftMenu from "@/components/LeftMenu.vue";
|
||||
import Menus from "@/components/Menus.vue";
|
||||
export default {
|
||||
name: "search",
|
||||
components: {
|
||||
LeftMenu,
|
||||
Menus
|
||||
},
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeindex: 0,
|
||||
value1: '',
|
||||
value2: '',
|
||||
fxOptions: [{
|
||||
value: '0',
|
||||
label: '分项查询',
|
||||
}],
|
||||
options: [{
|
||||
value: '10',
|
||||
label: '全部',
|
||||
}],
|
||||
timeValue: '',
|
||||
tableHeader: [{
|
||||
prop: 'one',
|
||||
label: '1点'
|
||||
},{
|
||||
prop: 'two',
|
||||
label: '2点'
|
||||
},{
|
||||
prop: 'three',
|
||||
label: '3点'
|
||||
},{
|
||||
prop: 'four',
|
||||
label: '4点'
|
||||
},{
|
||||
prop: 'five',
|
||||
label: '5点'
|
||||
},{
|
||||
prop: 'six',
|
||||
label: '6点'
|
||||
},{
|
||||
prop: 'seven',
|
||||
label: '7点'
|
||||
},{
|
||||
prop: 'eight',
|
||||
label: '8点'
|
||||
},{
|
||||
prop: 'nine',
|
||||
label: '9点'
|
||||
},{
|
||||
prop: 'ten',
|
||||
label: '10点'
|
||||
}],
|
||||
tableData: [{
|
||||
one: '100',
|
||||
two: '200',
|
||||
three: '100',
|
||||
four: '500',
|
||||
five: '200',
|
||||
six: '300',
|
||||
seven: '200',
|
||||
eight: '100',
|
||||
nine: '300',
|
||||
ten: '400'
|
||||
}]
|
||||
});
|
||||
onMounted(() => {
|
||||
drawE();
|
||||
});
|
||||
const showContent = (i) => {
|
||||
console.log(i)
|
||||
state.activeindex = i;
|
||||
}
|
||||
const drawE = () => {
|
||||
var dom = document.getElementById("echartDiv");
|
||||
var op = {
|
||||
legend: {},
|
||||
grid: {
|
||||
left: '1%',
|
||||
right: '1%',
|
||||
bottom: '10%',
|
||||
top: '10%',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1点', '2点', '3点', '4点', '5点', '6点', '7点',
|
||||
'8点', '9点', '10点', '11点', '12点', '13点', '14点','15点',
|
||||
'16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点', '24点']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '空调用电',
|
||||
data: [120, 200, 150, 80, 70, 120, 200, 150, 80, 70, 110, 130,110, 130,120, 200, 150, 70, 110, 130,80, 70, 110, 130],
|
||||
type: 'bar'
|
||||
},{
|
||||
name: '照明用电',
|
||||
data: [80, 70, 120, 200, 150, 80, 110, 130,110, 70, 110, 130,110, 130,120, 200, 150, 120, 200, 150, 80, 70, 110, 130],
|
||||
type: 'bar'
|
||||
},{
|
||||
name: '动力用电',
|
||||
data: [120, 200, 150, 80, 70, 110, 130,200, 150, 110, 80, 110, 130,110, 70, 110, 130,110, 130,120, 200, 150, 120, 200, ],
|
||||
type: 'bar'
|
||||
},{
|
||||
name: '其他用电',
|
||||
data: [120, 80, 70, 110, 130,200, 150, 110, 80, 110, 130,110, 70, 110, 130,110, 130,120, 200, 150, 80, 70, 110, 130],
|
||||
type: 'bar'
|
||||
}
|
||||
]
|
||||
};
|
||||
getEchart(dom, op)
|
||||
}
|
||||
const getEchart = (dom, op) => {
|
||||
if (dom) {
|
||||
var myChart = echarts.init(dom);
|
||||
var option = op;
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
showContent,
|
||||
drawE
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info
|
||||
{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bottom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 92%;
|
||||
// border: 1px solid red;
|
||||
}
|
||||
.search-content {
|
||||
width: calc(100% - 50px);
|
||||
// border: 1px solid blue;
|
||||
padding: 10px;
|
||||
.search-top {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
// justify-content: space-between;
|
||||
.date-container {
|
||||
width: 300px;
|
||||
}
|
||||
::v-deep .el-select {
|
||||
width: 200px !important;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
}
|
||||
.echartDiv {
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
margin: 0 auto;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<template>
|
||||
<div class="info">
|
||||
<Menus :pactiveI="4"/>
|
||||
<div class="bottom">
|
||||
<LeftMenu @showContent="showContent" />
|
||||
<div class="search-content" v-if="activeindex === 0">
|
||||
0
|
||||
</div>
|
||||
<div class="search-content" v-if="activeindex === 1">
|
||||
1
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import LeftMenu from "@/components/LeftMenu.vue";
|
||||
import Menus from "@/components/Menus.vue";
|
||||
export default {
|
||||
name: "worning",
|
||||
components: {
|
||||
LeftMenu,
|
||||
Menus
|
||||
},
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeindex: 0
|
||||
});
|
||||
onMounted(() => {
|
||||
});
|
||||
const showContent = (i) => {
|
||||
console.log(i)
|
||||
state.activeindex = i;
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
showContent
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info
|
||||
{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bottom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 92%;
|
||||
border: 1px solid red;
|
||||
}
|
||||
.search-content {
|
||||
width: calc(100% - 50px);
|
||||
border: 1px solid red;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<template>
|
||||
<div class="info">
|
||||
<Menus :pactiveI="5"/>
|
||||
<div class="bottom">
|
||||
<LeftMenu @showContent="showContent" />
|
||||
<div class="search-content" v-if="activeindex === 0">
|
||||
0
|
||||
</div>
|
||||
<div class="search-content" v-if="activeindex === 1">
|
||||
1
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs } from "vue";
|
||||
import LeftMenu from "@/components/LeftMenu.vue";
|
||||
import Menus from "@/components/Menus.vue";
|
||||
export default {
|
||||
name: "maneger",
|
||||
components: {
|
||||
LeftMenu,
|
||||
Menus
|
||||
},
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeindex: 0
|
||||
});
|
||||
onMounted(() => {
|
||||
});
|
||||
const showContent = (i) => {
|
||||
console.log(i)
|
||||
state.activeindex = i;
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
showContent
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info
|
||||
{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bottom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 92%;
|
||||
border: 1px solid red;
|
||||
}
|
||||
.search-content {
|
||||
width: calc(100% - 50px);
|
||||
border: 1px solid red;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vitePluginImport from 'vite-plugin-babel-import';
|
||||
import path from 'path'
|
||||
|
||||
const baseUrl = {
|
||||
development: './',
|
||||
beta: './',
|
||||
release: './'
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default ({ mode }) => defineConfig({
|
||||
plugins: [
|
||||
vue()
|
||||
],
|
||||
base: baseUrl[mode],
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': path.resolve(__dirname, './'),
|
||||
'@': path.resolve(__dirname, 'src')
|
||||
}
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
// target: 'http://192.168.1.123:8866',
|
||||
// target: 'http://10.10.14.123',
|
||||
target: 'https://cdcmapi.shikicc.com',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/api/, '/api')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,6 @@
|
|||
const server = require('pushstate-server')
|
||||
|
||||
server.start({
|
||||
port: 5018,
|
||||
directory: './dist'
|
||||
})
|