勾股OA4.0完成发布:优化了审批流程模块,消息模块独立、员工管理模块修改为人力资源模块、新增行政模块、财务模块新增权限控制功能、合同协议的审核功能使用新的审批流程、增强了项目模块的功能、Layui更新为最新版本2.76等等

This commit is contained in:
hdm 2022-08-01 09:53:02 +08:00
parent eb88bd6560
commit 0d24b97555
166 changed files with 9294 additions and 9810 deletions

833
LICENSE
View File

@ -1,281 +1,622 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Version 3, 29 June 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
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
this service 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.
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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
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 give the recipients all the rights that
you have. 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.
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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
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.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
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.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
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.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
TERMS AND CONDITIONS
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
0. Definitions.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
"This License" refers to version 3 of the GNU General Public License.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
"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.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
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) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
A "covered work" means either the unmodified Program or a work based
on the Program.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
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.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
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.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
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.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
1. Source Code.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
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.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
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.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
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.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
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.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
The Corresponding Source for a work in source code form is that
same work.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
2. Basic Permissions.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
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.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
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.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
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.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
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.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
13. Use with the GNU Affero General Public License.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
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.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
14. Revised Versions of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
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.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
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.
NO WARRANTY
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.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
15. Disclaimer of Warranty.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
@ -287,15 +628,15 @@ 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
convey the exclusion of warranty; and each file should have at least
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
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 2 of the License, or
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,
@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
<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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
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 your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
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
<http://www.gnu.org/licenses/>.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This 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.
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

12
app/adm/common.php Normal file
View File

@ -0,0 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
/**
======================
*模块数据获取公共文件
======================
*/
use think\facade\Db;

View File

@ -0,0 +1,83 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\adm\controller;
use app\base\BaseController;
use app\adm\validate\CarCateCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Car extends BaseController
{
//车辆类型
public function car_cate()
{
if (request()->isAjax()) {
$cate = Db::name('CarCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//车辆类型添加
public function car_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(CarCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('CarCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(CarCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('CarCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//车辆类型设置
public function car_cate_check()
{
$param = get_params();
$res = Db::name('CarCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
}

View File

@ -0,0 +1,83 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\adm\controller;
use app\base\BaseController;
use app\adm\validate\MeetingCateCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Meeting extends BaseController
{
//会议室
public function meeting_cate()
{
if (request()->isAjax()) {
$cate = Db::name('MeetingCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//会议室添加
public function meeting_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(MeetingCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('MeetingCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(MeetingCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('MeetingCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//会议室设置
public function meeting_cate_check()
{
$param = get_params();
$res = Db::name('MeetingCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
}

View File

@ -0,0 +1,83 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\adm\controller;
use app\base\BaseController;
use app\adm\validate\SealCateCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Seal extends BaseController
{
//印章类别
public function seal_cate()
{
if (request()->isAjax()) {
$cate = Db::name('SealCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//印章类别添加
public function seal_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(SealCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('SealCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(SealCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('SealCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//印章类别设置
public function seal_cate_check()
{
$param = get_params();
$res = Db::name('SealCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
}

5
app/adm/event.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// 这是系统自动生成的event定义文件
return [
];

14
app/adm/middleware.php Normal file
View File

@ -0,0 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股OA是否完成安装
\app\home\middleware\Install::class,
];

View File

@ -5,7 +5,7 @@
* @link https://www.gougucms.com
*/
namespace app\home\validate;
namespace app\adm\validate;
use think\Validate;

View File

@ -0,0 +1,29 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\adm\validate;
use think\Validate;
class MeetingCateCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:meeting_cate',
'id' => 'require',
];
protected $message = [
'title.require' => '名称不能为空',
'title.unique' => '同样的名称已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['title'],
'edit' => ['id', 'title'],
];
}

View File

@ -5,7 +5,7 @@
* @link https://www.gougucms.com
*/
namespace app\home\validate;
namespace app\adm\validate;
use think\Validate;

View File

@ -0,0 +1,145 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加车辆类型</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'车辆类型列表'
,url: "/adm/car/car_cate"
,page: false
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '车辆名称'}
,{field:'name',title: '车牌号码'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span class="green">正常</span>';
var html2='<span class="yellow">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title,obj.data.name);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该车辆吗?', {icon: 3, title:'提示'}, function(index){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/car/car_cate_check", { id: obj.data.id,status: 0}, callback);
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该车辆吗?', {icon: 3, title:'提示'}, function(index){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/car/car_cate_check", { id: obj.data.id,status: 1}, callback);
layer.close(index);
});
}
});
$('body').on('click','.addNew',function(){
addExpense(0,'','');
});
function addExpense(id,title,name){
var biaoti = '新增车辆';
if(id>0){
biaoti = '编辑车辆';
}
layer.open({
type: 1
,title: biaoti
,area: '368px;'
,id: 'LAY_module' //设定一个id防止重复弹出
,btn: ['确定', '取消']
,btnAlign: 'c'
,content: '<div style="padding-top:15px;">\
<div class="layui-form-item">\
<label class="layui-form-label">车辆名称</label>\
<div class="layui-input-inline">\
<input type="hidden" name="id" value="'+id+'">\
<input type="text" name="title" autocomplete="off" value="'+title+'" placeholder="请输入车辆名称" class="layui-input">\
</div>\
</div>\
<div class="layui-form-item">\
<label class="layui-form-label">车牌号码</label>\
<div class="layui-input-inline">\
<input type="text" name="name" autocomplete="off" value="'+name+'" placeholder="请输入车牌号码" class="layui-input">\
</div>\
</div>\
</div>'
,yes: function(index){
let id = $('#LAY_module').find('[name="id"]').val();
let title = $('#LAY_module').find('[name="title"]').val();
let name = $('#LAY_module').find('[name="name"]').val();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
layer.close(index);
}
}
tool.post("/adm/car/car_cate_add", {
id: id,
title: title,
name: name
}, callback);
}
,btn2: function(){
layer.closeAll();
}
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,120 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加会议室</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'会议室列表'
,url: "/adm/meeting/meeting_cate"
,page: false
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '类别名称'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span class="green">正常</span>';
var html2='<span class="yellow">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该会议室吗?', {icon: 3, title:'提示'}, function(index){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/meeting/meeting_cate_check", { id: obj.data.id,status: 0,title: obj.data.title}, callback);
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该会议室吗?', {icon: 3, title:'提示'}, function(index){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/meeting/meeting_cate_check", { id: obj.data.id,status: 1,title: obj.data.title}, callback);
layer.close(index);
});
}
});
$('body').on('click','.addNew',function(){
addExpense(0,'');
});
function addExpense(id,val){
var title = '新增会议室';
if(id>0){
title = '编辑会议室';
}
layer.prompt({
title: title,
value: val,
yes: function(index, layero) {
// 获取文本框输入的值
var value = layero.find(".layui-layer-input").val();
if (value) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/meeting/meeting_cate_add", {id: id,title: value}, callback);
layer.close(index);
} else {
layer.msg('请填写会议室名称');
}
}
})
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,120 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加印章类型</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'印章类型列表'
,url: "/adm/seal/seal_cate"
,page: false
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '类别名称'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span class="green">正常</span>';
var html2='<span class="yellow">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该类别吗?', {icon: 3, title:'提示'}, function(index){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/seal/seal_cate_check", { id: obj.data.id,status: 0,title: obj.data.title}, callback);
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该类别吗?', {icon: 3, title:'提示'}, function(index){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/seal/seal_cate_check", { id: obj.data.id,status: 1,title: obj.data.title}, callback);
layer.close(index);
});
}
});
$('body').on('click','.addNew',function(){
addExpense(0,'');
});
function addExpense(id,val){
var title = '新增类别';
if(id>0){
title = '编辑类别';
}
layer.prompt({
title: title,
value: val,
yes: function(index, layero) {
// 获取文本框输入的值
var value = layero.find(".layui-layer-input").val();
if (value) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.post("/adm/seal/seal_cate_add", {id: id,title: value}, callback);
layer.close(index);
} else {
layer.msg('请填写类别标题');
}
}
})
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -8,11 +8,7 @@ declare (strict_types = 1);
namespace app\api\controller;
use app\api\BaseController;
use app\home\model\AdminLog;
use app\user\validate\AdminCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\Session;
class Index extends BaseController
{
@ -126,13 +122,6 @@ class Index extends BaseController
return to_assign(0, '系统缓存已清空');
}
//获取关键字
public function get_keyword_cate()
{
$keyword = Db::name('Keywords')->where(['status' => 1])->order('id desc')->select()->toArray();
return to_assign(0, '', $keyword);
}
// 测试邮件发送
public function email_test()
{
@ -228,177 +217,6 @@ class Index extends BaseController
$position = Db::name('Position')->field('id,title as name')->where([['status', '=', 1], ['id', '>', 1]])->select();
return to_assign(0, '', $position);
}
//首页公告
public function get_note_list()
{
$list = Db::name('Note')
->field('a.id,a.title,a.create_time,c.title as cate_title')
->alias('a')
->join('note_cate c', 'a.cate_id = c.id')
->where(['a.status' => 1])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
return table_assign(0, '', $res);
}
//首页文章
public function get_article_list()
{
$prefix = get_config('database.connections.mysql.prefix');//判断是否安装了文章模块
$exist = Db::query('show tables like "'.$prefix.'article"');
$res['data'] = [];
if($exist){
$list = Db::name('Article')
->field('a.id,a.title,a.create_time,a.read,c.title as cate_title')
->alias('a')
->join('article_cate c', 'a.cate_id = c.id')
->where(['a.delete_time' => 0])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
}
return table_assign(0, '', $res);
}
//首页项目
public function get_project_list()
{
$prefix = get_config('database.connections.mysql.prefix');//判断是否安装了项目模块
$exist = Db::query('show tables like "'.$prefix.'project"');
$res['data'] = [];
if($exist){
$project_ids = Db::name('ProjectUser')->where(['uid' => $this->uid, 'delete_time' => 0])->column('project_id');
$list = Db::name('Project')
->field('a.id,a.name,a.status,a.create_time,a.start_time,a.end_time,u.name as director_name')
->alias('a')
->join('Admin u', 'a.director_uid = u.id')
->where([['a.delete_time', '=', 0], ['a.id', 'in', $project_ids]])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
$list[$key]['plan_time'] = date('Y-m-d', $list[$key]['start_time']) . ' 至 ' . date('Y-m-d', $list[$key]['end_time']);
$list[$key]['status_name'] = \app\project\model\Project::$Status[(int) $val['status']];
}
$res['data'] = $list;
}
return table_assign(0, '', $res);
}
//修改个人信息
public function edit_personal()
{
if (request()->isAjax()) {
$param = get_params();
$uid = $this->uid;
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('user@user/edit_personal', [
'admin' => get_admin($this->uid),
]);
}
}
//修改密码
public function edit_password()
{
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editPwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$uid = $this->uid;
$admin = Db::name('Admin')->where(['id' => $uid])->find();
$old_psw = set_password($param['old_pwd'], $admin['salt']);
if ($admin['pwd'] != $old_psw) {
return to_assign(1, '旧密码错误');
}
$salt = set_salt(20);
$new_pwd = set_password($param['pwd'], $salt);
$data = [
'reg_pwd' => '',
'salt' => $salt,
'pwd' => $new_pwd,
'update_time' => time(),
];
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($data);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('user@user/edit_password', [
'admin' => get_admin($this->uid),
]);
}
}
//系统操作日志
public function log_list()
{
if (request()->isAjax()) {
$param = get_params();
$log = new AdminLog();
$content = $log->get_log_list($param);
return table_assign(0, '', $content);
}else{
return view('home@log/log_list');
}
}
//保存密码修改
public function password_submit()
{
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editpwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$admin = get_admin($this->uid);
if (set_password($param['old_pwd'], $admin['salt']) !== $admin['pwd']) {
return to_assign(1, '旧密码不正确!');
}
unset($param['username']);
$param['salt'] = set_salt(20);
$param['pwd'] = set_password($param['pwd'], $param['salt']);
Db::name('Admin')->where(['id' => $admin['id'],
])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($admin['id']));
return to_assign();
}
}
//获取工作类型列表
public function get_work_cate()
{
$cate = Db::name('WorkCate')->field('id,title')->where([['status', '=', 1]])->select();
return to_assign(0, '', $cate);
}
//获取审核类型
public function get_flow_cate($type=0)
@ -411,10 +229,17 @@ class Index extends BaseController
{
$flow = Db::name('Flow')->where(['id' => $id])->find();
$flowData = unserialize($flow['flow_list']);
foreach ($flowData as $key => &$val) {
$val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
}
if(!empty($flowData)){
foreach ($flowData as $key => &$val) {
$val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
}
}
$data['copy_uids'] = $flow['copy_uids'];
$data['copy_unames'] ='';
if($flow['copy_uids']!=''){
$copy_unames = Db::name('Admin')->where('id', 'in', $flow['copy_uids'])->column('name');
$data['copy_unames'] = implode(',', $copy_unames);
}
$data['flow_data'] = $flowData;
return to_assign(0, '', $data);
}
@ -468,57 +293,341 @@ class Index extends BaseController
}
return to_assign(0, '', $check_list);
}
//删除报销附件
public function del_expense_interfix()
{
$id = get_params("id");
$admin_id = Db::name('ExpenseInterfix')->where('id', $id)->value('admin_id');
if ($admin_id == $this->uid) {
if (Db::name('ExpenseInterfix')->where('id', $id)->delete() !== false) {
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "您没权限删除该报销数据");
}
}
//删除消息附件
public function del_message_interfix()
{
$id = get_params("id");
$detail = Db::name('MessageFileInterfix')->where('id', $id)->find();
if ($detail['admin_id'] == $this->uid) {
if (Db::name('MessageFileInterfix')->where('id', $id)->delete() !== false) {
$data = Db::name('MessageFileInterfix')->where('mid', $detail['mid'])->column('file_id');
return to_assign(0, "删除成功",$data);
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "您没权限删除该消息附件");
}
}
//获取访问记录
public function get_view_data()
//流程审核
public function flow_check()
{
$param = get_params();
$first_time = time();
$second_time = $first_time - 86400;
$three_time = $first_time - 86400 * 365;
$begin_first = strtotime(date('Y-m-d', $first_time) . " 00:00:00");
$end_first = strtotime(date('Y-m-d', $first_time) . " 23:59:59");
$begin_second = strtotime(date('Y-m-d', $second_time) . " 00:00:00");
$end_second = strtotime(date('Y-m-d', $second_time) . " 23:59:59");
$begin_three = strtotime(date('Y-m-d', $three_time) . " 00:00:00");
$data_first = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_first,$end_first")->select();
$data_second = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_second,$end_second")->select();
$data_three = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_three,$end_first")->select();
return to_assign(0, '', ['data_first' => hour_document($data_first), 'data_second' => hour_document($data_second), 'data_three' => date_document($data_three)]);
$id = $param['id'];
$type = $param['type'];
$detail = [];
if($type==1){
//日常审核
$detail = Db::name('Approve')->where(['id' => $id])->find();
}
else if($type==2){
//报销审核
$detail = Db::name('Expense')->where(['id' => $id])->find();
}
else if($type==3){
//发票审核
$detail = Db::name('Invoice')->where(['id' => $id])->find();
}
else if($type==4){
//合同审核
$detail = Db::name('Contract')->where(['id' => $id])->find();
}
if (empty($detail)){
return to_assign(1,'审批数据错误');
}
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
//审核通过
if($param['check'] == 1){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 4){
//查询当前会签记录数
$check_count = Db::name('FlowRecord')->where(['action_id'=>$id,'type'=>$type,'step_id'=>$step['id']])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
$param['check_admin_ids'] = $next_step['flow_uids'];
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$param['check_status'] = 1;
$param['check_admin_ids'] = $step['flow_uids'];
}
}
else if($step['flow_type'] == 0){
//自由人审批
if($param['check_node'] == 2){
$next_step = $detail['check_step_sort']+1;
$flow_step = array(
'action_id' => $id,
'sort' => $next_step,
'type' => $type,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$param['check_admin_ids'] = $param['check_admin_ids'];
$param['check_step_sort'] = $next_step;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$next_step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
$param['check_admin_ids'] = get_department_leader($this->uid);
}
else if($next_step['flow_type'] == 2){
$param['check_admin_ids'] = get_department_leader($this->uid,1);
}
else{
$param['check_admin_ids'] = $next_step['flow_uids'];
}
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
if($param['check_status'] == 1 && $param['check_admin_ids']==''){
return to_assign(1,'找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
if($type==1){
//日常审核
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
else if($type==2){
//报销审核
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
else if($type==3){
//发票审核
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
else if($type==4){
//合同审核
$res = Db::name('Contract')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
if($res!==false){
$checkData=array(
'action_id' => $id,
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => $type,
'check_time' => time(),
'status' => $param['check'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('check', $param['id'], $param);
//发送消息通知
$msg=[
'create_time'=>time(),
'action_id'=>$id
];
if($param['check_status'] == 1){
$users = $param['check_admin_ids'];
sendMessage($users,($type*10+11),$msg);
}
if($param['check_status'] == 2){
$users = $detail['admin_id'];
sendMessage($users,($type*10+12),$msg);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['check'] == 2){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//拒绝审核,数据操作
$param['check_status'] = 3;
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$param['check_admin_ids'] ='';
if($step['flow_type'] == 5){
//获取上一步的审核信息
$prev_step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>($detail['check_step_sort']-1),'delete_time'=>0])->find();
if($prev_step){
//存在上一步审核
$param['check_step_sort'] = $prev_step['sort'];
$param['check_admin_ids'] = $prev_step['flow_uids'];
$param['check_status'] = 1;
}
else{
//不存在上一步审核,审核初始化步骤
$param['check_step_sort'] = 0;
$param['check_admin_ids'] = '';
$param['check_status'] = 0;
}
}
if($type==1){
//日常审核
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
else if($type==2){
//报销审核
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
else if($type==3){
//发票审核
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
else if($type==4){
//合同审核
$res = Db::name('Contract')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
}
if($res!==false){
$checkData=array(
'action_id' => $id,
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => $type,
'check_time' => time(),
'status' => $param['check'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('refue', $param['id'], $param);
//发送消息通知
$msg=[
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'action_id'=>$detail['id']
];
$users = $detail['admin_id'];
sendMessage($users,($type*10+13),$msg);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['check'] == 3){
if($detail['admin_id'] != $this->uid){
return to_assign(1,'你没权限操作');
}
//撤销审核,数据操作
$param['check_status'] = 4;
$param['check_admin_ids'] ='';
$param['check_step_sort'] =0;
if($type==1){
//日常审核
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
}
else if($type==2){
//报销审核
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
}
else if($type==3){
//发票审核
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
}
else if($type==4){
//合同审核
$res = Db::name('Contract')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
}
if($res!==false){
$checkData=array(
'action_id' => $id,
'step_id' => 0,
'check_user_id' => $this->uid,
'type' => $type,
'check_time' => time(),
'status' => $param['check'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('back', $param['id'], $param);
return to_assign();
}else{
return to_assign(1,'操作失败');
}
}
}
//获取关键字
public function get_keyword_cate()
{
$keyword = Db::name('Keywords')->where(['status' => 1])->order('id desc')->select()->toArray();
return to_assign(0, '', $keyword);
}
//读取报销类型
function get_expense_cate()
{
$cate = get_expense_cate();
return to_assign(0, '', $cate);
}
//读取费用类型
function get_cost_cate()
{
$cate = get_cost_cate();
return to_assign(0, '', $cate);
}
//读取印章类型
function get_seal_cate()
{
$cate = get_seal_cate();
return to_assign(0, '', $cate);
}
//读取车辆类型
function get_car_cate()
{
$cate = get_car_cate();
return to_assign(0, '', $cate);
}
//读取企业主体
function get_subject()
{
$subject = get_subject();
return to_assign(0, '', $subject);
}
//读取行业类型
function get_industry()
{
$industry = get_industry();
return to_assign(0, '', $industry);
}
//读取服务类型
function get_services()
{
$services = get_services();
return to_assign(0, '', $services);
}
//获取工作类型列表
public function get_work_cate()
{
$cate = get_work_cate();
return to_assign(0, '', $cate);
}
}

View File

@ -90,7 +90,7 @@ abstract class BaseController
$this->did = Session::get($session_admin)['did'];
View::assign('login_user', $this->uid);
// 验证用户访问权限
if (($this->module == 'api') || ($this->module == 'home' && $this->controller == 'index')) {
if (($this->module == 'api') || ($this->module == 'message') || ($this->module == 'home' && $this->controller == 'index')) {
return true;
}
else{
@ -101,7 +101,7 @@ abstract class BaseController
}
if (!$this->checkAuth()) {
if ($this->request->isAjax()) {
return to_assign(405, '你没有权限,请联系管理员或者人事部');
return to_assign(405, '你没有权限,请联系管理员或者HR');
} else {
echo '<div style="text-align:center;color:red;margin-top:20%;">你没有权限访问,请联系管理员或者人事部</div>';exit;
}

View File

@ -31,7 +31,7 @@
<div class="info-text">{$file | default=""}模板不存在,请检查对应的目录文件,注意区分大小写!</div>
</div>
<div class="footer">
© 2022 gougucms.com GPL-2.0 licensePowered by 勾股OA
© 2022 gougucms.com GPL-3.0 licensePowered by 勾股OA
</div>
</div>
</body>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>你没有权限</title>
<style type="text/css">
html,body {width: 100%;height: 100%;background: #f7f7f7;margin: 0;padding: 0;border: 0;}
div,p {margin: 0;padding: 0;border: 0;}
.container {width: 100%;height: 100%;position: fixed;top: 0;left: 0;z-index: 999;overflow: hidden;}
.info {width: 480px;position: absolute;top: 50%;left: 50%;margin-top: -200px;margin-left: -240px;text-align:center;}
.info-status{width: 480px; display: -webkit-flex;display: flex;flex-direction: row;justify-content: space-between;align-items: center;flex-wrap: nowrap;}
.info-status div{width:180px; height:180px; line-height:180px; font-size:180px; font-weight:200; color:#F35F37}
.info-status div.face{font-size:60px; border:9px solid #F35F37; width:120px; height:120px; line-height:118px; background-color:#fff; border-radius:50%;}
.info-tips{font-size:24px;color:#F35F37; padding-top:32px; font-weight:600;}
.info-text{padding-top:20px; line-height:1.6; text-align:left; font-size:14px; color:#646464}
.footer {position: absolute;font-size: 12px;bottom: 28px;text-align: center;width: 100%;color: #969696;}
</style>
</head>
<body>
<div class="container">
<div class="info">
<div class="info-status">
<div>4</div><div class="face">😔</div><div>6</div>
</div>
<div class="info-tips">哎呀你没有权限请联系管理员或者HR</div>
</div>
<div class="footer">
© 2022 gougucms.com GPL-3.0 licensePowered by 勾股OA
</div>
</div>
</body>
</html>

View File

@ -231,58 +231,170 @@ function get_position()
return $position;
}
//读取行业
//根据流程类型读取某部门某模块的审核流程
function get_cate_department_flows($cate=1,$department=0)
{
$map1 = [];
$map2 = [];
$map1[] = ['status', '=', 1];
$map1[] = ['flow_cate', '=', $cate];
$map1[] = ['department_ids', '=', ''];
$map2[] = ['status', '=', 1];
$map2[] = ['flow_cate', '=', $cate];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
$list = Db::name('Flow')->field('id,name,check_type')->whereOr([$map1,$map2])->order('id desc')->select()->toArray();
return $list;
}
//根据流程所属模块读取某部门某模块的审核流程
function get_type_department_flows($type=6,$department=0)
{
$map1 = [];
$map2 = [];
$map1[] = ['status', '=', 1];
$map1[] = ['type', '=', $type];
$map1[] = ['department_ids', '=', ''];
$map2[] = ['status', '=', 1];
$map2[] = ['type', '=', $type];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
$list = Db::name('Flow')->field('id,name,check_type')->whereOr([$map1,$map2])->order('id desc')->select()->toArray();
return $list;
}
/**
* 初始化审批流程数据
* @param $flow_id 审批流程id
* @return
*/
function set_flow($flow_id,$check_admin_ids='')
{
$flow_detail = Db::name('Flow')->where('id',$flow_id)->find();
$check_type = $flow_detail['check_type'];
$flow = unserialize($flow_detail['flow_list']);
if ($check_type == 1) {
if($flow[0]['flow_type'] == 1){
//部门负责人
$leader = get_department_leader($this->uid);
if($leader == 0){
return to_assign(1,'审批流程设置有问题当前部门负责人还未设置请联系HR或者管理员');
}
else{
$check_admin_ids = $leader;
}
}
else if($flow[0]['flow_type'] == 2){
//上级部门负责人
$leader = get_department_leader($this->uid,1);
if($leader == 0){
return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
}
else{
$check_admin_ids = $leader;
}
}
else{
$check_admin_ids = $flow[0]['flow_uids'];
}
}
else if ($check_type == 3) {
$check_admin_ids = $flow[0]['flow_uids'];
}
$flow_data = array(
'check_type' => $check_type,
'flow' => $flow,
'check_admin_ids' => $check_admin_ids
);
return $flow_data;
}
/**
* 获取审批流程数据
* @param $uid 当前登录用户
* @param $flows 当前步骤内容
* @return
*/
function get_flow($uid,$flows)
{
$check_user = '';
$check_user_ids = [];
if($flows['flow_type']==1){
$check_user = '部门负责人-';
$check_user_ids[]=get_department_leader($uid);
}
else if($flows['flow_type']==2){
$check_user = '上级部门负责人-';
$check_user_ids[]=get_department_leader($uid,1);
}
else{
$check_user_ids = explode(',',$flows['flow_uids']);
}
$check_user_array = Db::name('Admin')->where('id','in',$check_user_ids)->column('name');
$res = array(
'check_user' => $check_user.implode(',',$check_user_array),
'check_user_ids' => $check_user_ids
);
return $res;
}
//读取报销类型
function get_expense_cate()
{
$expense = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray();
return $expense;
}
//读取费用类型
function get_cost_cate()
{
$cost = Db::name('CostCate')->where(['status' => 1])->select()->toArray();
return $cost;
}
//读取印章类型
function get_seal_cate()
{
$seal = Db::name('SealCate')->where(['status' => 1])->select()->toArray();
return $seal;
}
//读取车辆类型
function get_car_cate()
{
$car = Db::name('CarCate')->where(['status' => 1])->select()->toArray();
return $car;
}
//读取企业主体
function get_subject()
{
$subject = Db::name('Subject')->where(['status' => 1])->select()->toArray();
return $subject;
}
//读取行业类型
function get_industry()
{
$industry = Db::name('Industry')->where(['status' => 1])->select()->toArray();
return $industry;
}
//读取服务
//读取服务类型
function get_services()
{
$services = Db::name('Services')->where(['status' => 1])->select()->toArray();
return $services;
}
//根据流程模块读取某部门某模块的审核流程
function get_flows($type=1,$department=0)
//读取工作类型
function get_work_cate()
{
$map1 = [];
$map2 = [];
$map1[] = ['status', '=', 1];
$map1[] = ['flow_cate', '=', $type];
$map1[] = ['department_ids', '=', ''];
$map2[] = ['status', '=', 1];
$map2[] = ['flow_cate', '=', $type];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
$list = Db::name('Flow')
->field('id,name,check_type')
->whereOr([$map1,$map2])
->order('id desc')->select()->toArray();
return $list;
}
//根据流程所属模块读取某部门某模块的审核流程
function get_type_flows($module=6,$department=0)
{
$map1 = [];
$map2 = [];
$map1[] = ['status', '=', 1];
$map1[] = ['type', '=', $module];
$map1[] = ['department_ids', '=', ''];
$map2[] = ['status', '=', 1];
$map2[] = ['type', '=', $module];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
$list = Db::name('Flow')
->field('id,name,check_type')
->whereOr([$map1,$map2])
->order('id desc')->select()->toArray();
return $list;
$work = Db::name('WorkCate')->where(['status' => 1])->select()->toArray();
return $work;
}
/**

View File

@ -87,30 +87,71 @@ class Api extends BaseController
public function check()
{
if (request()->isPost()) {
$params = get_params();
if($params['status'] == 3){
$params['check_uid'] = $this->uid;
$params['check_time'] = time();
$params['check_remark'] = $params['mark'];
$param = get_params();
if($param['check_status'] == 1){
$check_admin_ids = isset($param['check_admin_ids'])?$param['check_admin_ids']:'';
$flow_data = set_flow($param['flow_id'],$check_admin_ids);
$param['check_admin_ids'] = $flow_data['check_admin_ids'];
$flow = $flow_data['flow'];
$check_type = $flow_data['check_type'];
//删除原来的审核流程和审核记录
Db::name('FlowStep')->where(['action_id'=>$param['id'],'type'=>4,'delete_time'=>0])->update(['delete_time'=>time()]);
Db::name('FlowRecord')->where(['action_id'=>$param['id'],'type'=>4,'delete_time'=>0])->update(['delete_time'=>time()]);
if($check_type == 2){
$flow_step = array(
'action_id' => $param['id'],
'type' => 4,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
else{
foreach ($flow as $key => &$value){
$value['action_id'] = $param['id'];
$value['sort'] = $key;
$value['type'] = 4;
$value['create_time'] = time();
}
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
}
$checkData=array(
'action_id' => $param['id'],
'step_id' => 0,
'check_user_id' => $this->uid,
'type' => 4,
'check_time' => time(),
'status' => 0,
'content' => '提交申请',
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
}
if($params['status'] == 4){
$params['stop_uid'] = $this->uid;
$params['stop_time'] = time();
$params['stop_remark'] = $params['mark'];
if($param['check_status'] == 3){
$param['check_uid'] = $this->uid;
$param['check_time'] = time();
$param['check_remark'] = $param['mark'];
}
if($params['status'] == 5){
$params['void_uid'] = $this->uid;
$params['void_time'] = time();
$params['void_remark'] = $params['mark'];
if($param['check_status'] == 4){
$param['stop_uid'] = $this->uid;
$param['stop_time'] = time();
$param['stop_remark'] = $param['mark'];
}
$old = Db::name('Contract')->where('id', $params['id'])->find();
if (Db::name('Contract')->strict(false)->update($params) !== false) {
if($param['check_status'] == 5){
$param['void_uid'] = $this->uid;
$param['void_time'] = time();
$param['void_remark'] = $param['mark'];
}
$old = Db::name('Contract')->where('id', $param['id'])->find();
if (Db::name('Contract')->strict(false)->update($param) !== false) {
$log_data = array(
'field' => 'status',
'contract_id' => $params['id'],
'field' => 'check_status',
'contract_id' => $param['id'],
'admin_id' => $this->uid,
'new_content' => $params['status'],
'old_content' => $old['status'],
'new_content' => $param['check_status'],
'old_content' => $old['check_status'],
'create_time' => time(),
);
Db::name('ContractLog')->strict(false)->field(true)->insert($log_data);
@ -127,20 +168,20 @@ class Api extends BaseController
public function archive()
{
if (request()->isPost()) {
$params = get_params();
$param = get_params();
$old = 1;
if($params['archive_status'] == 1){
$params['archive_uid'] = $this->uid;
$params['archive_time'] = time();
if($param['archive_status'] == 1){
$param['archive_uid'] = $this->uid;
$param['archive_time'] = time();
$old = 0;
}
$old = Db::name('Contract')->where('id', $params['id'])->find();
if (Db::name('Contract')->strict(false)->update($params) !== false) {
$old = Db::name('Contract')->where('id', $param['id'])->find();
if (Db::name('Contract')->strict(false)->update($param) !== false) {
$log_data = array(
'field' => 'archive_status',
'contract_id' => $params['id'],
'contract_id' => $param['id'],
'admin_id' => $this->uid,
'new_content' => $params['archive_status'],
'new_content' => $param['archive_status'],
'old_content' => $old['archive_status'],
'create_time' => time(),
);

View File

@ -33,43 +33,24 @@ class Index extends BaseController
if (!empty($param['type'])) {
$where[] = ['a.type', '=', $param['type']];
}
if (!empty($param['status'])) {
$where[] = ['a.status', '=', $param['status']];
if (!empty($param['check_status'])) {
$where[] = ['a.check_status', '=', $param['check_status']];
}
$where[] = ['a.delete_time', '=', 0];
$where[] = ['a.archive_status', '=', 0];
$uid = $this->uid;
$auth = contract_auth($uid);
$auth = isAuth($uid,'contract');
if($auth==0){
$whereOr[] =['a.admin_id|a.prepared_uid|a.sign_uid|a.keeper_uid', '=', $uid];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',a.share_ids)")];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',a.check_admin_ids)")];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',a.flow_admin_ids)")];
}
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = ContractList::where($where)
->where(function ($query) use($whereOr) {
$query->whereOr($whereOr);
})
->field('a.*,c.title as cate_title,d.title as sign_department')
->alias('a')
->join('contract_cate c', 'a.cate_id = c.id')
->join('department d', 'a.sign_did = d.id','LEFT')
->order('a.create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->keeper_name = Db::name('Admin')->where(['id' => $item->keeper_uid])->value('name');
$item->sign_name = Db::name('Admin')->where(['id' => $item->sign_uid])->value('name');
$item->sign_time = date('Y-m-d', $item->sign_time);
$item->interval_time = date('Y-m-d', $item->start_time) . ' 至 ' . date('Y-m-d', $item->end_time);
$item->type_name = ContractList::$Type[(int) $item->type];
$item->status_name = ContractList::$Status[(int) $item->status];
$item->chack_status_name = ContractList::$Status[(int) $item->CheckStatus];
if($item->cost == 0){
$item->cost = '-';
}
});
return table_assign(0, '', $content);
$model = new ContractList();
$list = $model->get_list($param, $where, $whereOr);
return table_assign(0, '', $list);
} else {
return view();
}
@ -97,36 +78,14 @@ class Index extends BaseController
$where[] = ['a.archive_status', '=', 1];
$uid = $this->uid;
$auth = contract_auth($uid);
$auth = isAuth($uid,'contract_admin');
if($auth==0){
$whereOr[] =['a.admin_id|a.prepared_uid|a.sign_uid|a.keeper_uid', '=', $uid];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',a.share_ids)")];
}
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = ContractList::where($where)
->where(function ($query) use($whereOr) {
$query->whereOr($whereOr);
})
->field('a.*,c.title as cate_title,d.title as sign_department')
->alias('a')
->join('contract_cate c', 'a.cate_id = c.id')
->join('department d', 'a.sign_did = d.id','LEFT')
->order('a.create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->keeper_name = Db::name('Admin')->where(['id' => $item->keeper_uid])->value('name');
$item->sign_name = Db::name('Admin')->where(['id' => $item->sign_uid])->value('name');
$item->sign_time = date('Y-m-d', $item->sign_time);
$item->interval_time = date('Y-m-d', $item->start_time) . ' 至 ' . date('Y-m-d', $item->end_time);
$item->type_name = ContractList::$Type[(int) $item->type];
$item->status_name = ContractList::$Status[(int) $item->status];
$item->chack_status_name = ContractList::$Status[(int) $item->CheckStatus];
if($item->cost == 0){
$item->cost = '-';
}
});
return table_assign(0, '', $content);
}
$model = new ContractList();
$list = $model->get_list($param, $where, $whereOr);
return table_assign(0, '', $list);
} else {
return view();
}
@ -158,11 +117,11 @@ class Index extends BaseController
}
$param['update_time'] = time();
$old = Db::name('Contract')->where(['id' => $param['id']])->find();
$auth = contract_auth($this->uid);
if($this->uid!=$old['admin_id'] && $auth==0 && $old['status'] == 1){
$auth = isAuth($this->uid,'contract_admin');
if($this->uid!=$old['admin_id'] && $auth==0 && $old['check_status'] == 1){
return to_assign(1, "只有录入人员和合同管理员有权限操作");
}
if($auth==0 && $old['status'] > 1){
if($auth==0 && $old['check_status'] > 1){
return to_assign(1, "只有合同管理员有权限操作");
}
$res = contractList::strict(false)->field(true)->update($param);
@ -205,10 +164,10 @@ class Index extends BaseController
View::assign('id', $id);
View::assign('type', $type);
View::assign('pid', $pid);
View::assign('auth', contract_auth($this->uid));
View::assign('auth', isAuth($this->uid,'contract_admin'));
if ($id > 0) {
$detail = (new ContractList())->detail($id);
if($detail['status']>1){
if($detail['check_status']>1){
echo '<div style="text-align:center;color:red;margin-top:20%;">当前状态不开放编辑,请联系合同管理员</div>';exit;
}
View::assign('detail', $detail);
@ -222,27 +181,100 @@ class Index extends BaseController
}
}
//查看文章
//查看
public function view()
{
$id = get_params("id");
$detail = (new ContractList())->detail($id);
$auth = contract_auth($this->uid);
$auth = isAuth($this->uid,'contract_admin');
$is_check_admin = 0;
$is_create_admin = 0;
$check_record = [];
$auth_array=[];
if(!empty($detail['share_ids'])){
$auth_array = explode(",",$detail['share_ids']);
$share_ids = explode(",",$detail['share_ids']);
$auth_array = array_merge($auth_array,$share_ids);
}
if(!empty($detail['check_admin_ids'])){
$check_admin_ids = explode(",",$detail['check_admin_ids']);
$auth_array = array_merge($auth_array,$check_admin_ids);
}
if(!empty($detail['flow_admin_ids'])){
$flow_admin_ids = explode(",",$detail['flow_admin_ids']);
$auth_array = array_merge($auth_array,$flow_admin_ids);
}
array_push($auth_array,$detail['admin_id'],$detail['prepared_uid'],$detail['sign_uid'],$detail['keeper_uid']);
if($auth==0 && !in_array($this->uid,$auth_array)){
echo '<div style="text-align:center;color:red;margin-top:20%;">你无权限查看该合同</div>';exit;
return view('../../base/view/common/roletemplate');
}
$detail['create_user'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
$detail['copy_user'] = '-';
if($detail['copy_uids'] !=''){
$copy_user = Db::name('Admin')->where('id','in',$detail['copy_uids'])->column('name');
$detail['copy_user'] = implode(',',$copy_user);
}
if($detail['check_status']==1){
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>4,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
$flow_check = get_flow($this->uid,$flows);
$detail['check_user'] = $flow_check['check_user'];
$check_user_ids = $flow_check['check_user_ids'];
if(in_array($this->uid,$check_user_ids)){
$is_check_admin = 1;
if($flows['flow_type'] == 4){
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>4,'step_id'=>$flows['id'],'check_user_id'=>$this->uid])->count();
if($check_count>0){
$is_check_admin = 0;
}
}
}
}
else{
//获取合同审批流程
$flows = get_type_department_flows(8,$this->did);
$detail['check_user'] = '-';
}
if($detail['admin_id'] == $this->uid){
$is_create_admin = 1;
}
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
->alias('f')
->join('Admin a', 'a.id = f.check_user_id', 'left')
->where(['f.action_id'=>$detail['id'],'f.type'=>4])
->order('check_time asc')
->select()->toArray();
foreach ($check_record as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d :H:i', $vv['check_time']);
$vv['status_str'] = '提交';
if($vv['status'] == 1){
$vv['status_str'] = '审核通过';
}
else if($vv['status'] == 2){
$vv['status_str'] = '审核拒绝';
}
if($vv['status'] == 3){
$vv['status_str'] = '撤销';
}
}
View::assign('is_check_admin', $is_check_admin);
View::assign('is_create_admin', $is_create_admin);
View::assign('check_record', $check_record);
View::assign('flows', $flows);
View::assign('auth', $auth);
View::assign('detail', $detail);
return view();
if($detail['check_status'] == 0 || $detail['check_status'] == 4){
return view('view_set');
}
else{
return view();
}
}
//删除文章
//删除
public function delete()
{
if (request()->isDelete()) {

View File

@ -18,6 +18,7 @@ class Contract extends Model
const THREE = 3;
const FORE = 4;
const FIVE = 5;
const SIX = 6;
public static $Type = [
self::ZERO => '未设置',
@ -28,22 +29,54 @@ class Contract extends Model
];
public static $Status = [
self::ZERO => '未设置',
self::ONE => '已录入',
self::TWO => '待审核',
self::THREE => '已审核',
self::FORE => '已中止',
self::FIVE => '已作废',
self::ZERO => '待审核',
self::ONE => '审核中',
self::TWO => '审核通过',
self::THREE => '审核拒绝',
self::FORE => '已撤销',
self::FIVE => '已中止',
self::SIX => '已作废',
];
public static $ArchiveStatus = [
self::ZERO => '未归档',
self::ONE => '已归档',
];
//列表检索
public function get_list($param = [], $where = [], $whereOr=[])
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$list = self::where($where)
->where(function ($query) use($whereOr) {
$query->whereOr($whereOr);
})
->field('a.*,a.type as type_a, c.title as cate_title,d.title as sign_department')
->alias('a')
->join('contract_cate c', 'a.cate_id = c.id')
->join('department d', 'a.sign_did = d.id','LEFT')
->order('a.create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->keeper_name = Db::name('Admin')->where(['id' => $item->keeper_uid])->value('name');
$item->sign_name = Db::name('Admin')->where(['id' => $item->sign_uid])->value('name');
$item->sign_time = date('Y-m-d', $item->sign_time);
$item->interval_time = date('Y-m-d', $item->start_time) . ' 至 ' . date('Y-m-d', $item->end_time);
$item->type_name = self::$Type[(int)$item->type_a];
$item->status_name = self::$Status[(int)$item->check_status];
$item->chack_status_name = self::$Status[(int) $item->CheckStatus];
if($item->cost == 0){
$item->cost = '-';
}
});
return $list;
}
// 获取合同详情
public function detail($id)
{
$detail = Db::name('Contract')->where(['id' => $id])->find();
$detail = self::where(['id' => $id])->find();
if (!empty($detail)) {
$file_array = Db::name('ContractFile')
->field('cf.id,f.filepath,f.name,f.filesize,f.fileext')
@ -53,12 +86,11 @@ class Contract extends Model
->where(array('cf.contract_id' => $id, 'cf.delete_time' => 0))
->select()->toArray();
$detail['status_name'] = self::$Status[(int) $detail['status']];
$detail['status_name'] = self::$Status[(int) $detail['check_status']];
$detail['archive_status_name'] = self::$ArchiveStatus[(int) $detail['archive_status']];
$detail['sign_time'] = date('Y-m-d', $detail['sign_time']);
$detail['start_time'] = date('Y-m-d', $detail['start_time']);
$detail['end_time'] = date('Y-m-d', $detail['end_time']);
$detail['create_time'] = date('Y-m-d', $detail['create_time']);
$detail['cate_title'] = Db::name('ContractCate')->where(['id' => $detail['cate_id']])->value('title');
$detail['sign_department'] = Db::name('Department')->where(['id' => $detail['sign_did']])->value('title');
$detail['sign_name'] = Db::name('Admin')->where(['id' => $detail['sign_uid']])->value('name');
@ -91,7 +123,7 @@ class Contract extends Model
}
if($detail['pid']>0){
$detail['pname'] = Db::name('Contract')->where(['id' => $detail['pid']])->value('name');
$detail['pname'] = self::where(['id' => $detail['pid']])->value('name');
}
$detail['file_array'] = $file_array;
}

View File

@ -15,7 +15,7 @@ class ContractLog extends Model
{
public static $Sourse = [
'type' => ['', '未设置', '普通合同', '框架合同', '补充协议', '其他合同'],
'status' => ['', '已录入', '待审核', '已审核', '已中止', '已作废'],
'check_status' => ['待审核', '审核中', '审核通过', '审核拒绝', '已撤销', '已中止', '已作废'],
'action' => [
'add' => '添加',
'edit' => '修改',
@ -42,6 +42,7 @@ class ContractLog extends Model
'cost' => '金额',
'is_tax' => '是否含税',
'tax' => '税点',
'check_status' => '状态',
'status' => '状态',
'archive_status' => '归档状态',
'file' => '合同附件',

View File

@ -8,7 +8,7 @@
<td colspan="4" class="red" style="line-height:1.8">
<p><strong>合同模块使用说明:</strong></p>
<p><strong>1、设置合同管理员可设置多个</strong></p>
<p style="text-indent:2em">a、拥有合同管理员权限的员工可以查看、编辑、审核、作废、中止所有合同。</p>
<p style="text-indent:2em">a、拥有合同管理员权限的员工可以查看、编辑、作废、中止所有合同。</p>
<p style="text-indent:2em">b、非合同管理员的员工可查看合同制定人、合同签订人、合同保管人、合同共享人员、合同录入人相关联的合同。</p>
<p style="text-indent:2em; margin-bottom:8px">c、合同的编辑权限只有合同录入人和合同管理员拥有。</p>
<p><strong>2、合同状态有已录入、待审核、已审核、已中止、已作废</strong></p>

View File

@ -67,8 +67,8 @@
title: '编号',
align: 'center',
width: 80
},{ field: 'status', title: '状态', align: 'center', width: 70, templet: function (d) {
var html = '<span class="layui-btn layui-btn-xs layui-bg-' + d.status + '">' + d.status_name + '</span>';
},{ field: 'check_status', title: '状态', align: 'center', width: 70, templet: function (d) {
var html = '<span class="layui-btn layui-btn-xs layui-bg-' + d.check_status + '">' + d.status_name + '</span>';
return html;
}
},{
@ -90,7 +90,7 @@
align: 'center',
width: 80,
templet: function (d) {
var html = '<span class="layui-color-' + d.type + '">' + d.type_name + '</span>';
var html = '<span class="layui-color-' + d.type_a + '">' + d.type_name + '</span>';
return html;
}
},{

View File

@ -2,22 +2,6 @@
{block name="style"}
<style>
html{background-color:#fff;}
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;width: calc(100% - 110px);
}
.file-card .file-tool .layui-icon{font-size:22px; padding:2px; cursor:pointer;}
.log-timeline{ position: relative; min-height:600px; padding-left: 48px; background-color:#fff;}
.log-timeline:after {content: ""; position: absolute; top: 0; left: 24px; width: 1px; height: 100%; background: #e3e9ed;}
.log-timeline dl{padding-bottom: 8px; position: relative;}
@ -28,19 +12,62 @@ html{background-color:#fff;}
.log-timeline .open-a{margin:0 4px;}
.log-item i{font-weight:800; color:#323232}
.log-content strong{margin:0 4px; color:#323232}
.check-items{overflow-x: auto; padding: 2px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
flex-wrap: wrap;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0; padding:4px 0}
.check-item i{margin-right:3px; color:#646464;}
.check-item span{color:#999;margin:0 3px;}
.check-item .layui-icon {font-size:18px;}
.check-item .layui-icon.layui-icon-right{font-size:12px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:4px 4px 0;}
.flow-record .layui-timeline-item{text-decoration:line-through; color:#acacac; padding-bottom:10px;}
.flow-record .layui-timeline-item.delete-0{text-decoration:none; color:#323232;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.check-record{line-height:1.5; padding:4px 0}
.flow-this{font-weight:800;}
.flow-this i{color:#4285f4}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="px-4 pt-2">
<form class="layui-form px-4 pt-2" lay-filter="contract">
<div class="layui-tab" style="margin:0;" lay-filter="contract" id="contractTab">
<ul class="layui-tab-title">
<li class="layui-this" data-load="true">合同详情</li>
<li>操作记录</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-tab-item layui-show">
<table class="layui-table layui-table-form">
{gt name="$detail.pid" value="0"}
<tr>
@ -116,7 +143,7 @@ html{background-color:#fff;}
<tr>
<td class="layui-td-gray">
<div class="layui-input-inline">合同附件</div>
{eq name="$detail.status" value="1" }<div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div>{/eq}
{eq name="$detail.check_status" value="1" }<div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div>{/eq}
</td>
<td colspan="7" id="fileList">
{volist name="$detail.file_array" id="vo"}
@ -146,45 +173,39 @@ html{background-color:#fff;}
<td class="layui-td-gray-2">合同签订部门</td>
<td>{$detail.sign_department}</td>
</tr>
<tr>
<td class="layui-td-gray-2">合同保管人</td>
<td>{$detail.keeper_name}{gt name="$auth" value="0"}<span id="keeper" data-ids="{$detail.keeper_uid}" data-names="{$detail.keeper_name}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</span>{/gt}</td>
<td class="layui-td-gray">合同共享人员</td>
<td colspan="5">{$detail.share_names}{gt name="$auth" value="0"}<span id="shares" data-ids="{$detail.share_ids}" data-names="{$detail.share_names}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</span>{/gt}</td>
</tr>
<tr>
<td colspan="8"><strong>审核信息</strong></td>
</tr>
<tr>
<td class="layui-td-gray-2">合同保管人</td>
<td>{$detail.keeper_name}{gt name="$auth" value="0"}<button id="keeper" data-ids="{$detail.keeper_uid}" data-names="{$detail.keeper_name}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</button>{/gt}</td>
<td class="layui-td-gray">合同共享人员</td>
<td colspan="5">{$detail.share_names}{gt name="$auth" value="0"}<button id="shares" data-ids="{$detail.share_ids}" data-names="{$detail.share_names}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</button>{/gt}</td>
</tr>
{lt name="$detail.status" value="3" }
<tr>
<td class="layui-td-gray-2">合同状态</td>
<td><span class="layui-color-{$detail.status}">{$detail.status_name}</span></td>
<td><span class="layui-color-{$detail.check_status}">{$detail.status_name}</span></td>
<td class="layui-td-gray-2">录入人</td>
<td>{$detail.admin_name} </td>
<td class="layui-td-gray-2">录入时间</td>
<td colspan="3">{$detail.create_time}</td>
</tr>
{/lt}
{eq name="$detail.status" value="3" }
<tr>
<td class="layui-td-gray-2">合同状态</td>
<td colspan="7"><span class="layui-color-{$detail.status}">{$detail.status_name}</span></td>
</tr>
<tr>
<td class="layui-td-gray-2">审核人</td>
<td>{$detail.check_name} </td>
<td class="layui-td-gray-2">审核时间</td>
<td>{$detail.check_time}</td>
<td class="layui-td-gray-2">录入人</td>
<td>{$detail.admin_name} </td>
<td class="layui-td-gray-2">录入时间</td>
<td>{$detail.create_time}</td>
</tr>
<tr>
<td class="layui-td-gray-2">审核备注</td>
<td colspan="7">{$detail.check_remark}</td>
</tr>
</tr>
{notempty name="$check_record"}
<tr>
<td class="layui-td-gray">历史审批记录</td>
<td colspan="7">
<ul class="layui-timeline flow-record pt-2">
{volist name="$check_record" id="vo"}
<li class="layui-timeline-item delete-{$vo.delete_time}">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<p style="padding-left:24px">{$vo.check_time_str}<span class="black ml-2">{$vo.name}</span><span class="mx-2 layui-color-{$vo.status}">{$vo.status_str}</span>了此申请。操作意见:<span class="green">{$vo.content}</span></p>
</li>
{/volist}
</ul>
</td>
</tr>
{/notempty}
{eq name="$detail.check_status" value="3" }
<tr>
<td class="layui-td-gray-2">归档状态</td>
{eq name="$detail.archive_status" value="0" }
@ -199,20 +220,12 @@ html{background-color:#fff;}
</tr>
{/eq}
{eq name="$detail.status" value="4" }
<tr>
<td class="layui-td-gray-2">合同状态</td>
<td colspan="7"><span class="layui-color-{$detail.status}">{$detail.status_name}</span></td>
</tr>
{eq name="$detail.check_status" value="4" }
<tr>
<td class="layui-td-gray-2">中止人</td>
<td>{$detail.stop_name} </td>
<td class="layui-td-gray-2">中止时间</td>
<td>{$detail.stop_time}</td>
<td class="layui-td-gray-2">录入人</td>
<td>{$detail.admin_name} </td>
<td class="layui-td-gray-2">录入时间</td>
<td>{$detail.create_time}</td>
<td colspan="5">{$detail.stop_time}</td>
</tr>
<tr>
<td class="layui-td-gray-2">中止备注</td>
@ -220,67 +233,47 @@ html{background-color:#fff;}
</tr>
{/eq}
{eq name="$detail.status" value="5" }
<tr>
<td class="layui-td-gray-2">合同状态</td>
<td colspan="7"><span class="layui-color-{$detail.status}">{$detail.status_name}</span></td>
</tr>
{eq name="$detail.check_status" value="5" }
<tr>
<td class="layui-td-gray-2">作废人</td>
<td>{$detail.void_name} </td>
<td class="layui-td-gray-2">作废时间</td>
<td>{$detail.void_time}</td>
<td class="layui-td-gray-2">录入人</td>
<td>{$detail.admin_name} </td>
<td class="layui-td-gray-2">录入时间</td>
<td>{$detail.create_time}</td>
<td colspan="5">{$detail.void_time}</td>
</tr>
<tr>
<td class="layui-td-gray-2">作废备注</td>
<td colspan="7">{$detail.void_remark}</td>
</tr>
{/eq}
{/eq}
</table>
{gt name="$auth" value="0"}
{eq name="$detail.status" value="1" }
<div class="p-4" style="text-align:center;">
<a class="layui-btn" href="/contract/index/add/id/{$detail.id}">编辑合同</a>
<button class="layui-btn layui-btn-normal" data-event="check" data-status="2">提交审核</button>
<button class="layui-btn layui-btn-warm" data-event="check" data-status="4">中止合同</button>
<button class="layui-btn layui-btn-danger" data-event="check" data-status="5">作废合同</button>
</div>
{/eq}
{eq name="$detail.status" value="2" }
<div class="p-4" style="text-align:center;">
<button class="layui-btn layui-btn-normal" data-event="check" data-status="3">审核通过</button>
<button class="layui-btn layui-btn-danger" data-event="check" data-status="1">审核拒绝</button>
</div>
{/eq}
{eq name="$detail.status" value="3" }
<div class="p-4" style="text-align:center;">
{eq name="$detail.archive_status" value="1" }
<button class="layui-btn layui-btn-danger" data-event="archive" data-status="0">反确认归档</button>
{else/}
<button class="layui-btn layui-btn-normal" data-event="archive" data-status="1">合同归档</button>
<button class="layui-btn layui-btn-danger" data-event="check" data-status="1">反确认审核</button>
{eq name="$detail.check_status" value="1" }
{include file="/index/view_step" /}
{/eq}
{gt name="$auth" value="0"}
{eq name="$detail.check_status" value="3" }
<div class="py-4">
{eq name="$detail.archive_status" value="1" }
<span class="layui-btn layui-btn-danger" data-event="archive" data-status="0">反确认归档</span>
{else/}
<span class="layui-btn layui-btn-normal" data-event="archive" data-status="1">合同归档</span>
<span class="layui-btn layui-btn-danger" data-event="check" data-status="0">反确认审核</span>
{/eq}
</div>
{/eq}
</div>
{/eq}
{eq name="$detail.status" value="4" }
<div class="p-4" style="text-align:center;">
<button class="layui-btn layui-btn-danger" data-event="check" data-status="1">反中止合同</button>
</div>
{/eq}
{eq name="$detail.status" value="5" }
<div class="p-4" style="text-align:center;">
<button class="layui-btn layui-btn-danger" data-event="check" data-status="1">反作废合同</button>
</div>
{/eq}
{eq name="$detail.check_status" value="5" }
<div class="p-4" style="text-align:center;">
<span class="layui-btn layui-btn-danger" data-event="check" data-status="0">反中止合同</span>
</div>
{/eq}
{eq name="$detail.check_status" value="6" }
<div class="p-4" style="text-align:center;">
<span class="layui-btn layui-btn-danger" data-event="check" data-status="0">反作废合同</span>
</div>
{/eq}
{/gt}
</div>
<div class="layui-tab-item">
@ -290,7 +283,7 @@ html{background-color:#fff;}
</div>
</div>
</form>
{/block}
<!-- /主体 -->
@ -298,19 +291,21 @@ html{background-color:#fff;}
{block name="script"}
<script>
const contract_id = '{$detail.id}';
const contract_status = '{$detail.status}';
const contract_status = '{$detail.check_status}';
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, upload = layui.upload,element = layui.element,employeepicker = layui.employeepicker;
element.on('tab(contract)', function(data){
let index = data.index;
console.log(index);
if(index == 1){
log(layui);
}
});
if (typeof (flowStep) == "function") {
flowStep();
}
//选择合同保管人弹窗
$('body').on('click','#keeper',function () {
var ids=$(this).data('ids')+'',names = $(this).data('names')+'';
@ -361,33 +356,25 @@ const moduleInit = ['tool','employeepicker'];
$('body').on('click','[data-event="check"]',function(){
let status = $(this).data('status');
let action = 'apply';
let title = '提交审核后合同内容将不能编辑,确定要提交审核?'
if(contract_status == 2 && status == 3){
title = '确定要通过该合同审核?';
action = 'check_ok';
}
if(contract_status == 2 && status == 1){
title = '确定要拒绝该合同审核?';
action = 'check_refue';
}
if(contract_status == 3 && status == 1){
let action = '';
let title = ''
if(contract_status == 2 && status == 0){
title = '确定要反确认该合同的审核?';
action = 'check_refue';
}
if(contract_status == 1 && status == 4){
if(contract_status == 0 && status == 3){
title = '确定要中止该合同?';
action = 'stop_ok';
}
if(contract_status == 4 && status == 1){
if(contract_status == 3 && status == 0){
title = '确定要反中止该合同?';
action = 'stop_no';
}
if(contract_status == 1 && status == 5){
if(contract_status == 0 && status == 4){
title = '确定要作废该合同?';
action = 'void_ok';
}
if(contract_status == 5 && status == 1){
if(contract_status == 4 && status == 0){
title = '确定要反作废该合同?';
action = 'void_no';
}
@ -403,7 +390,7 @@ const moduleInit = ['tool','employeepicker'];
},2000)
}
if(status == 3 || status == 4 || status == 5){
if(status == 3 || status == 4){
layer.open({
type: 1,
title: '请输入原因或理由',
@ -414,7 +401,7 @@ const moduleInit = ['tool','employeepicker'];
yes: function () {
let remark = $("#remarkTextarea").val();
if (remark != '') {
tool.post("/contract/api/check", {id: contract_id,status:status,mark:remark}, callback);
tool.post("/contract/api/check", {id: contract_id,check_status:status,mark:remark}, callback);
} else {
layer.msg('请输入原因或理由');
}
@ -422,7 +409,7 @@ const moduleInit = ['tool','employeepicker'];
})
}
else{
tool.post("/contract/api/check", {id: contract_id,status:status,mark:''}, callback);
tool.post("/contract/api/check", {id: contract_id,check_status:status,mark:''}, callback);
}
layer.close(index);

View File

@ -0,0 +1,561 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
html{background-color:#fff;}
.log-timeline{ position: relative; min-height:600px; padding-left: 48px; background-color:#fff;}
.log-timeline:after {content: ""; position: absolute; top: 0; left: 24px; width: 1px; height: 100%; background: #e3e9ed;}
.log-timeline dl{padding-bottom: 8px; position: relative;}
.log-timeline dt{font-size: 16px; line-height: 2.4; color: #323232; font-weight:600}
.log-timeline dd{font-size: 14px; line-height: 1.6; padding:5px 0}
.log-timeline .date-second-point{width: 10px; height: 10px; display: block; border-radius: 50%; border: 3px solid #FBBC05; background: #fff; position: absolute; z-index: 99; left:-32px; top:9px}
.log-timeline .log-thumb{width: 24px; height: 24px; border-radius: 50%; margin-right:4px;}
.log-timeline .open-a{margin:0 4px;}
.log-item i{font-weight:800; color:#323232}
.log-content strong{margin:0 4px; color:#323232}
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;width: calc(100% - 108px);}
.file-card .file-tool .layui-icon{font-size:20px; padding:2px; cursor:pointer;}
.check-items{overflow-x: auto; padding: 2px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
flex-wrap: wrap;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0; padding:4px 0}
.check-item i{margin-right:3px; color:#646464;}
.check-item span{color:#999;margin:0 3px;}
.check-item .layui-icon {font-size:18px;}
.check-item .layui-icon.layui-icon-right{font-size:12px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:4px 4px 0;}
.flow-record .layui-timeline-item{text-decoration:line-through; color:#acacac; padding-bottom:10px;}
.flow-record .layui-timeline-item.delete-0{text-decoration:none; color:#323232;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.check-record{line-height:1.5; padding:4px 0}
.flow-this{font-weight:800;}
.flow-this i{color:#4285f4}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form px-4 pt-2" lay-filter="contract">
<div class="layui-tab" style="margin:0;" lay-filter="contract" id="contractTab">
<ul class="layui-tab-title">
<li class="layui-this" data-load="true">合同详情</li>
<li>操作记录</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<table class="layui-table layui-table-form">
{gt name="$detail.pid" value="0"}
<tr>
<td class="layui-td-gray">母合同名称</td>
<td colspan="7">{$detail.pname}</td>
</tr>
{/gt}
<tr>
<td class="layui-td-gray">合同名称</td>
<td colspan="5">{$detail.name}</td>
<td class="layui-td-gray">合同编号</td>
<td>{$detail.code}</td>
</tr>
<tr>
<td class="layui-td-gray">签约主体(乙方)</td>
<td colspan="3">
{volist name=":contract_subject()" id="v"}
{eq name="$v.id" value="$detail.subject_id" }{$v.title}{/eq}
{/volist}
</td>
<td class="layui-td-gray">合同性质</td>
<td>
{eq name="$detail.type" value="1" }普通合同{/eq}
{eq name="$detail.type" value="2" }框架合同{/eq}
{eq name="$detail.type" value="3" }补充协议{/eq}
{eq name="$detail.type" value="4" }其他合同{/eq}
</td>
<td class="layui-td-gray">合同类别</td>
<td>
{volist name=":contract_cate()" id="v"}
{eq name="$v.id" value="$detail.cate_id" }{$v.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">客户名称(甲方)</td>
<td colspan="3">{$detail.customer}</td>
<td class="layui-td-gray">签约客户代表</td>
<td>{$detail.customer_name}</td>
<td class="layui-td-gray">客户联系电话</td>
<td>{$detail.customer_mobile}</td>
</tr>
<tr>
<td class="layui-td-gray-2">客户联系地址</td>
<td colspan="3">{$detail.customer_address}</td>
<td class="layui-td-gray-2">合同开始日期</td>
<td>{$detail.start_time}</td>
<td class="layui-td-gray-2">合同结束日期</td>
<td>{$detail.end_time}</td>
</tr>
{neq name="$detail.type" value="2"}
<tr>
<td class="layui-td-gray">合同金额</td>
<td>{$detail.cost}</td>
{eq name="$detail.is_tax" value="1" }
<td class="layui-td-gray">是否含税</td>
<td></td>
<td class="layui-td-gray">税点(百分比)</td>
<td colspan="3">{$detail.tax}%</td>
{/eq}
{eq name="$detail.is_tax" value="0" }
<td class="layui-td-gray">是否含税</td>
<td colspan="5"></td>
{/eq}
</tr>
{/neq}
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="7">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">
<div class="layui-input-inline">合同附件</div>
{eq name="$detail.check_status" value="1" }<div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div>{/eq}
</td>
<td colspan="7" id="fileList">
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4" id="file_{$vo.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="{$vo.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>
{/volist}
</td>
</tr>
<tr>
<td colspan="8"><strong>签订信息</strong></td>
</tr>
<tr>
<td class="layui-td-gray-2">合同制定人</td>
<td>{$detail.prepared_name} </td>
<td class="layui-td-gray-2">合同签订人</td>
<td>{$detail.sign_name}</td>
<td class="layui-td-gray-2">合同签订时间</td>
<td>{$detail.sign_time}</td>
<td class="layui-td-gray-2">合同签订部门</td>
<td>{$detail.sign_department}</td>
</tr>
<tr>
<td class="layui-td-gray-2">合同保管人</td>
<td>{$detail.keeper_name}{gt name="$auth" value="0"}<span id="keeper" data-ids="{$detail.keeper_uid}" data-names="{$detail.keeper_name}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</span>{/gt}</td>
<td class="layui-td-gray">合同共享人员</td>
<td colspan="5">{$detail.share_names}{gt name="$auth" value="0"}<span id="shares" data-ids="{$detail.share_ids}" data-names="{$detail.share_names}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</span>{/gt}</td>
</tr>
<tr>
<td colspan="8"><strong>审核信息</strong></td>
</tr>
<tr>
<td class="layui-td-gray-2">合同状态</td>
<td><span class="layui-color-{$detail.check_status}">{$detail.status_name}</span></td>
<td class="layui-td-gray-2">录入人</td>
<td>{$detail.admin_name} </td>
<td class="layui-td-gray-2">录入时间</td>
<td colspan="3">{$detail.create_time}</td>
</tr>
{notempty name="$check_record"}
<tr>
<td class="layui-td-gray">历史审批记录</td>
<td colspan="7">
<ul class="layui-timeline flow-record pt-2">
{volist name="$check_record" id="vo"}
<li class="layui-timeline-item delete-{$vo.delete_time}">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<p style="padding-left:24px">{$vo.check_time_str}<span class="black ml-2">{$vo.name}</span><span class="mx-2 layui-color-{$vo.status}">{$vo.status_str}</span>了此申请。操作意见:<span class="green">{$vo.content}</span></p>
</li>
{/volist}
</ul>
</td>
</tr>
{/notempty}
{eq name="$is_create_admin" value = "1"}
<tr>
<td class="layui-td-gray-2">选择审批流程<font>*</font></td>
<td colspan="7">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="7">
<input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one" readonly>
<input type="hidden" name="check_admin_ids" value="">
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="7">
<input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择抄送人" class="layui-input picker-more" readonly>
<input type="hidden" name="copy_uids" value="">
</td>
</tr>
{/eq}
</table>
<div class="py-4">
{eq name="$is_create_admin" value = "1"}
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交审核</button>
<a class="layui-btn" href="/contract/index/add/id/{$detail.id}">编辑合同</a>
{/eq}
{gt name="$auth" value="0"}
<span class="layui-btn layui-btn-warm" data-event="check" data-status="3">中止合同</span>
<span class="layui-btn layui-btn-danger" data-event="check" data-status="4">作废合同</span>
{/gt}
</div>
</div>
<div class="layui-tab-item">
{include file="/index/view_log" /}
</div>
</div>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const contract_id = '{$detail.id}';
const contract_status = '{$detail.check_status}';
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, upload = layui.upload,element = layui.element,employeepicker = layui.employeepicker,dropdown = layui.dropdown;
element.on('tab(contract)', function(data){
let index = data.index;
if(index == 1){
log(layui);
}
});
//=================================================
//选择单个员工弹窗
$('body').on('click','.picker-one',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'';
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names);
that.next().val(ids);
}
});
});
//选择多个员工弹窗
$('body').on('click','.picker-more',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'',ids_array=[],names_array=[];
if(ids.length>0){
ids_array=ids.split(',');
names_array=names.split(',');
}
employeepicker.init({
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));
}
});
});
$('body').on('click','[data-event="check"]',function(){
let status = $(this).data('status');
let action = '';
let title = ''
if(contract_status == 0 && status == 3){
title = '确定要中止该合同?';
action = 'stop_ok';
}
if(contract_status == 0 && status == 4){
title = '确定要作废该合同?';
action = 'void_ok';
}
layer.confirm(title, {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
parent.layui.pageTable.reload();
setTimeout(function(){
location.reload();
},2000)
}
layer.open({
type: 1,
title: '请输入原因或理由',
area: ['800px', '360px'],
content: '<div style="padding:5px;"><textarea class="layui-textarea" id="remarkTextarea" style="width: 100%; height: 240px;"></textarea></div>',
btnAlign: 'c',
btn: ['提交保存'],
yes: function () {
let remark = $("#remarkTextarea").val();
if (remark != '') {
tool.post("/contract/api/check", {id: contract_id,check_status:status,mark:remark}, callback);
} else {
layer.msg('请输入原因或理由');
}
}
})
tool.post("/contract/api/check", {id: contract_id,check_status:status,mark:''}, callback);
layer.close(index);
});
});
//监听提交
form.on('submit(webform)', function(data){
layer.confirm('提交审核后合同内容将不能编辑,确定要提交审核?', {
icon: 3,
title: '提示'
}, function(index) {
data.field.id = contract_id;
data.field.check_status = 1;
$.ajax({
url: "/contract/api/check",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
})
});
return false;
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one"><input type="hidden" name="check_admin_ids" value="">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
$('[name="copy_names"]').val(e.data.copy_unames);
$('[name="copy_uids"]').val(e.data.copy_uids.split(','));
}
if(check_type == 1 || check_type == 3){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(check_type == 1){
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>';
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>';
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
}
else if(check_type == 3){
sign_type= ' <span class="layui-badge layui-bg-blue">'+flow_data[a].flow_name+'</span>'
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="7">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
//选择合同保管人弹窗
$('body').on('click','#keeper',function () {
var ids=$(this).data('ids')+'',names = $(this).data('names')+'';
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
location.reload();
}
}
tool.post("/contract/index/add", {'id':contract_id,'keeper_uid':ids,'scene':'change'}, callback);
}
});
});
//选择共享成员弹窗
$('body').on('click','#shares',function () {
var ids=$(this).data('ids')+'',names = $(this).data('names')+'',share_ids_array=[],share_names_array=[];
if(ids.length>0){
share_ids_array=ids.split(',');
share_names_array=names.split(',');
}
employeepicker.init({
ids:share_ids_array,
names:share_names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
location.reload();
}
}
tool.post("/contract/index/add", {'id':contract_id,'share_ids':ids.join(','),'scene':'change'}, callback);
}
});
});
//删除附件
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
layer.confirm('确定要删除该附件吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
$('#file_' + _id).remove();
}
}
tool.delete("/contract/api/delete_file", {id: _id}, callback);
layer.close(index);
});
})
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|txt|zip|rar|7z' //只允许上传文件格式
,done: function(res){
if (res.code == 0) {
let callback = function (e) {
layer.msg(e.msg);
let temp = `<div class="layui-col-md4" id="file_${e.data}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${e.data}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
tool.post("/contract/api/add_file", {'contract_id':contract_id,'file_id':res.data.id,'file_name':res.data.name}, callback);
}
else{
layer.msg(res.msg);
}
}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,285 @@
<table class="layui-table layui-table-form" style="margin-top:12px">
{eq name="$detail.check_status" value="1"}
<tr>
<td class="layui-td-gray-2">当前审核人</td>
<td>{$detail.check_user}</td>
<td class="layui-td-gray">审核状态</td>
<td>
<span style="color:#4285f4">审批中</span>
</td>
</tr>
{/eq}
<tr>
<td class="layui-td-gray-2">抄送人</td>
<td colspan="3">{$detail.copy_user}</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程</td>
<td colspan="3">
<div class="flow-flexbox check-items flow-flex-row" id="flowList">
<div class="flow-flexbox check-item flow-flex-row">
<i class="layui-icon layui-icon-add-circle" data-ok=""></i>
<div class="check-item-name">{$detail.create_user}</div>
<div class="check-item-status">提交申请</div>
<span class="layui-icon layui-icon-right"></span>
</div>
</div>
</td>
</tr>
{if ( $is_check_admin eq 1) }
{eq name="$flows.flow_type" value="0"}
<tr>
<td class="layui-td-gray">审批节点 <font>*</font></td>
<td colspan="3">
<input type="radio" name="check_node" lay-filter="check_node" value="1" title="审核结束">
<input type="radio" name="check_node" lay-filter="check_node" value="2" title="下一审批人">
<div class="layui-inline">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择下一审批人" lay-verify="required" lay-reqText="请选择下一审批人" class="layui-input">
</div>
</td>
</tr>
{/eq}
<tr>
<td class="layui-td-gray">审批意见 <font>*</font></td>
<td colspan="3">
<textarea name="content" placeholder="请输入审批意见" class="layui-textarea"></textarea>
</td>
</tr>
{/if}
</table>
<input type="hidden" name="id" value="{$detail.id}">
<input type="hidden" name="flow_type" value="{$flows.flow_type}">
<input type="hidden" name="check_step_sort" value="{$detail.check_step_sort}">
<input type="hidden" name="check_status" value="{$detail.check_status}">
<div id="formBtn" style="padding: 10px 0">
{eq name="$detail.check_status" value='1'}
{eq name="$is_check_admin" value='1'}
<span class="layui-btn layui-btn-normal" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> {$flows.flow_type == 5?'回退':'拒绝'}</span>
{/eq}
{eq name="$is_create_admin" value='1'}
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/eq}
{/eq}
{if ( $detail.check_status eq 3) AND ( $is_create_admin eq 1) }
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/if}
{if ( $detail.check_status eq 4) AND ( $is_create_admin eq 1) }
<a class="layui-btn" href="/finance/invoice/add?id={$detail.id}">重新编辑</a>
{/if}
</div>
<script>
function flowStep(){
var form = layui.form,tool=layui.tool, dropdown = layui.dropdown,employeepicker = layui.employeepicker;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'get',
data:{id:contract_id,type:4},
success: function (e) {
if (e.code == 0) {
let flowHtml='',list = e.data,record_list='',sort = $('[name="check_step_sort"]').val();
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>',
sortClass ='';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
else if(list[f].flow_type == 5){
checkUser=list[f].flow_name+' ['+list[f].user_id_info[0].name+']';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
if(sort == list[f].sort){
sortClass ='flow-this';
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">当前审核</div>';
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row '+sortClass+'" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
}
$('#flowList').append(flowHtml);
}
}
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
$('#formBtn').on('click','span', function(data){
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/api/index/flow_check",
type:'post',
data:{
id:contract_id,
type:4,
check_node:check_node,
check_admin_ids:check_admin_ids,
check:check_status,
content:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
location.reload();
}
}
})
layer.close(index);
});
}
else if(check_status ==3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
$.ajax({
url: "/api/index/flow_check",
type:'post',
data:{
id:contract_id,
type:4,
check:check_status,
content:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
location.reload();
}
}
})
layer.close(index);
});
}
return false;
});
}
</script>

View File

@ -85,7 +85,7 @@ function trace_stage()
//写入日志
function to_log($uid,$type=0,$new,$old)
function to_log($uid,$type,$new,$old)
{
$log_data = [];
$key_array = ['id', 'create_time', 'update_time', 'admin_id','belong_did','belong_time','distribute_time'];

View File

@ -17,6 +17,102 @@ use think\facade\View;
class Api extends BaseController
{
//分配客户
public function distribute()
{
if (request()->isAjax()) {
$params = get_params();
//是否是客户管理员
$auth = isAuth($this->uid,'customer_admin');
if($auth==0){
return to_assign(1, "只有客户管理员才有权限操作");
}
$data['id'] = $params['id'];
$data['belong_uid'] = $params['uid'];
$data['belong_did'] = $params['did'];
$data['distribute_time'] = time();
if (Db::name('Customer')->update($data) !== false) {
add_log('allot', $data['id']);
to_log($this->uid,0,$data,['belong_uid'=>0]);
return to_assign(0, "操作成功");
} else {
return to_assign(1, "操作失败");
}
} else {
return to_assign(1, "错误的请求");
}
}
//删除客户
public function delete()
{
if (request()->isDelete()) {
$params = get_params();
//是否是客户管理员
$auth = isAuth($this->uid,'customer_admin');
if($auth==0){
return to_assign(1, "只有客户管理员才有权限操作");
}
$data['id'] = $params['id'];
$log_data = array(
'field' => 'del',
'action' => 'delete',
'type' => 0,
'customer_id' => $params['id'],
'admin_id' => $this->uid,
'create_time' => time(),
);
if($params['type'] ==1){
$data['delete_time'] = time();
$log_data['action'] = 'totrash';
}
else{
$data['delete_time'] = -1;
}
if (Db::name('Customer')->update($data) !== false) {
add_log('delete', $params['id']);
Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "错误的请求");
}
}
//还原客户
public function revert()
{
if (request()->isAjax()) {
$params = get_params();
//是否是客户管理员
$auth = isAuth($this->uid,'customer_admin');
if($auth==0){
return to_assign(1, "只有客户管理员才有权限操作");
}
$data['id'] = $params['id'];
$data['delete_time'] = 0;
if (Db::name('Customer')->update($data) !== false) {
add_log('recovery', $params['id']);
$log_data = array(
'field' => 'del',
'action' => 'recovery',
'type' => 0,
'customer_id' => $params['id'],
'admin_id' => $this->uid,
'create_time' => time(),
);
Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "错误的请求");
}
}
//跟进记录列表
public function get_trace()
{
@ -99,7 +195,7 @@ class Api extends BaseController
}
//添加跟进记录
//查看跟进记录
public function view_trace()
{
$param = get_params();

View File

@ -415,99 +415,5 @@ class Index extends BaseController
return to_assign(1, "错误的请求");
}
}
//分配客户
public function distribute()
{
if (request()->isAjax()) {
$params = get_params();
//是否是客户管理员
$auth = isAuth($this->uid,'customer_admin');
if($auth==0){
return to_assign(1, "只有客户管理员才有权限操作");
}
$data['id'] = $params['id'];
$data['belong_uid'] = $params['uid'];
$data['belong_did'] = $params['did'];
$data['distribute_time'] = time();
if (Db::name('Customer')->update($data) !== false) {
add_log('allot', $data['id']);
to_log($this->uid,0,$data,['belong_uid'=>0]);
return to_assign(0, "操作成功");
} else {
return to_assign(1, "操作失败");
}
} else {
return to_assign(1, "错误的请求");
}
}
//删除
public function delete()
{
if (request()->isDelete()) {
$params = get_params();
//是否是客户管理员
$auth = isAuth($this->uid,'customer_admin');
if($auth==0){
return to_assign(1, "只有客户管理员才有权限操作");
}
$data['id'] = $params['id'];
$log_data = array(
'field' => 'del',
'action' => 'delete',
'type' => 0,
'customer_id' => $params['id'],
'admin_id' => $this->uid,
'create_time' => time(),
);
if($params['type'] ==1){
$data['delete_time'] = time();
$log_data['action'] = 'totrash';
}
else{
$data['delete_time'] = -1;
}
if (Db::name('Customer')->update($data) !== false) {
add_log('delete', $params['id']);
Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "错误的请求");
}
}
//还原
public function revert()
{
if (request()->isAjax()) {
$params = get_params();
//是否是客户管理员
$auth = isAuth($this->uid,'customer_admin');
if($auth==0){
return to_assign(1, "只有客户管理员才有权限操作");
}
$data['id'] = $params['id'];
$data['delete_time'] = 0;
if (Db::name('Customer')->update($data) !== false) {
add_log('recovery', $params['id']);
$log_data = array(
'field' => 'del',
'action' => 'recovery',
'type' => 0,
'customer_id' => $params['id'],
'admin_id' => $this->uid,
'create_time' => time(),
);
Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "错误的请求");
}
}
}

View File

@ -10,6 +10,46 @@
======================
*/
use think\facade\Db;
//是否是报销打款管理员,count>1即有权限
function isAuthExpense($uid)
{
if($uid == 1){
return 1;
}
$map = [];
$map[] = ['name', '=', 'finance_admin'];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',uids)")];
$count = Db::name('DataAuth')->where($map)->count();
return $count;
}
//是否是发票管理员,count>1即有权限
function isAuthInvoice($uid)
{
if($uid == 1){
return 1;
}
$map = [];
$map[] = ['name', '=', 'finance_admin'];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',conf_1)")];
$count = Db::name('DataAuth')->where($map)->count();
return $count;
}
//是否是到账管理员,count>1即有权限
function isAuthIncome($uid)
{
if($uid == 1){
return 1;
}
$map = [];
$map[] = ['name', '=', 'finance_admin'];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',conf_2)")];
$count = Db::name('DataAuth')->where($map)->count();
return $count;
}
//读取开票主体
function finance_invoice_subject()
{

View File

@ -0,0 +1,141 @@
<?php
/**
* @copyright Copyright (c) 2022 勾股工作室
* @license https://opensource.org/licenses/GPL-3.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\finance\controller;
use app\api\BaseController;
use app\finance\model\Expense;
use app\finance\model\Invoice;
use app\finance\model\InvoiceIncome;
use think\facade\Db;
use think\facade\View;
class Api extends BaseController
{
//删除报销附件
public function del_expense_interfix()
{
$id = get_params("id");
$admin_id = Db::name('ExpenseInterfix')->where('id', $id)->value('admin_id');
if ($admin_id == $this->uid) {
if (Db::name('ExpenseInterfix')->where('id', $id)->delete() !== false) {
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "您不是上传者,没权限删除该报销数据");
}
}
//报销设置为已打款
public function topay()
{
$param = get_params();
if (request()->isAjax()) {
$auth = isAuthExpense($this->uid);
if($auth == 0){
return to_assign(1, "你没有打款权限请联系管理员或者HR");
}
//打款,数据操作
$param['check_status'] = 5;
$param['pay_admin_id'] = $this->uid;
$param['pay_time'] = time();
$res = Expense::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('topay', $param['id'],$param,'报销');
//发送消息通知
$detail = Expense::where(['id' => $param['id']])->find();
$msg=[
'create_time'=>date('Y-m-d H:i:s',(int)$detail['create_time']),
'action_id'=>$detail['id']
];
$users = $detail['admin_id'];
sendMessage($users,34,$msg);
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
//开具发票
public function open()
{
$param = get_params();
if (request()->isAjax()) {
$auth = isAuthInvoice($this->uid);
if($auth == 0){
return to_assign(1, "你没有开票权限请联系管理员或者HR");
}
$status = Invoice::where(['id' => $param['id']])->value('check_status');
if ($status == 2) {
$param['check_status'] = 5;
$param['open_admin_id'] = $this->uid;
}
$param['open_time'] = isset($param['open_time']) ? strtotime(urldecode($param['open_time'])) : 0;
$res = Invoice::where('id', $param['id'])->strict(false)->field('code,check_status,open_time,open_admin_id,delivery')->update($param);
if ($res !== false) {
add_log('open', $param['id'],$param,'发票');
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
//作废发票
public function tovoid()
{
$param = get_params();
if (request()->isAjax()) {
$auth = isAuthInvoice($this->uid);
if($auth == 0){
return to_assign(1, "你没有作废发票权限请联系管理员或者HR");
}
if ($param['check_status'] == 10) {
$count = InvoiceIncome::where(['inid'=>$param['id'],'status'=>1])->count();
if($count>0){
return to_assign(1, "发票已经新增有到账记录,请先反到账后再作废发票");
}
else{
$param['update_time'] = time();
}
}
$res = Invoice::where('id', $param['id'])->strict(false)->field('check_status')->update($param);
if ($res !== false) {
return to_assign();
add_log('tovoid', $param['id'],$param,'发票');
} else {
return to_assign(1, "操作失败");
}
}
}
//反作废发票
public function novoid()
{
$param = get_params();
if (request()->isAjax()) {
$auth = isAuthInvoice($this->uid);
if($auth == 0){
return to_assign(1, "你没有作废发票权限请联系管理员或者HR");
}
$param['check_status'] = 5;
$param['update_time'] = time();
add_log('tovoid', $param['id'],$param,'发票');
$res = Invoice::where('id', $param['id'])->strict(false)->field('check_status')->update($param);
if ($res !== false) {
return to_assign();
add_log('novoid', $param['id'],$param,'发票');
} else {
return to_assign(1, "操作失败");
}
}
}
}

View File

@ -18,74 +18,24 @@ use think\facade\View;
class Expense extends BaseController
{
public function get_list($where = [], $param = [], $type='and')
public function conf()
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($type == 'or'){
$expense = ExpenseList::whereOr($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
$item['check_user'] = '-';
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
});
}
else{
$expense = ExpenseList::where($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
$item['check_user'] = '-';
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
});
}
return $expense;
}
public function detail($id = 0)
{
$expense = Db::name('Expense')->where(['id' => $id])->find();
if ($expense) {
$expense['income_month'] = empty($expense['income_month']) ? '-' : date('Y-m', $expense['income_month']);
$expense['expense_time'] = empty($expense['expense_time']) ? '-' : date('Y-m-d', $expense['expense_time']);
$expense['create_user'] = Db::name('Admin')->where(['id' => $expense['admin_id']])->value('name');
$expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title');
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount');
if ($expense['pay_time'] > 0) {
$expense['pay_time'] = date('Y-m-d H:i:s', $expense['pay_time']);
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
}
else{
$expense['pay_time'] = '-';
}
$expense['list'] = Db::name('ExpenseInterfix')
->field('a.*,c.title as cate_title')
->alias('a')
->join('ExpenseCate c', 'a.cate_id = c.id','LEFT')
->where(['a.exid' => $expense['id']])
->select();
$param = get_params();
if (request()->isPost()) {
$param['update_time'] = time();
$res = Db::name('DataAuth')->strict(false)->field(true)->update($param);
return to_assign();
} else {
$detail = Db::name('DataAuth')->where('name','finance_admin')->find();
$unames = Db::name('Admin')->where('id', 'in', $detail['uids'])->column('name');
$detail['unames'] = implode(',', $unames);
$conf_unames_1 = Db::name('Admin')->where('id', 'in', $detail['conf_1'])->column('name');
$detail['conf_unames_1'] = implode(',', $conf_unames_1);
$conf_unames_2 = Db::name('Admin')->where('id', 'in', $detail['conf_2'])->column('name');
$detail['conf_unames_2'] = implode(',', $conf_unames_2);
View::assign('detail', $detail);
return view();
}
return $expense;
}
public function index()
@ -93,6 +43,7 @@ class Expense extends BaseController
if (request()->isAjax()) {
$param = get_params();
$where = [];
$where[] = ['delete_time', '=', 0];
//按时间检索
$start_time = !empty($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = !empty($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
@ -103,9 +54,10 @@ class Expense extends BaseController
$where[] = ['admin_id','=',$this->uid];
if (!empty($param['check_status']) && $param['check_status']!='') {
$where[] = ['check_status', '=', $param['check_status']];
}
$expense = $this->get_list($where, $param);
return table_assign(0, '', $expense);
}
$model = new ExpenseList;
$list = $model->get_list($param,$where);
return table_assign(0, '', $list);
} else {
return view();
}
@ -122,16 +74,22 @@ class Expense extends BaseController
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")];
$map1[] = ['delete_time', '=', 0];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',flow_admin_ids)")];
$map2[] = ['delete_time', '=', 0];
if($status == 0){
$list = $this->get_list([$map1,$map2],$param,'or');
$model = new ExpenseList;
$list = $model->get_list($param,[$map1,$map2],'or');
}
if($status == 1){
$list = $this->get_list($map1,$param);
$model = new ExpenseList;
$list = $model->get_list($param,$map1);
}
if($status == 2){
$list = $this->get_list($map2,$param);
$model = new ExpenseList;
$list = $model->get_list($param,$map2);
}
return table_assign(0, '', $list);
} else {
@ -150,12 +108,13 @@ class Expense extends BaseController
$start_time = !empty($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = !empty($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
$map[] = ['expense_time', 'between', [$start_time, $end_time]];
}
$map[] = ['check_status', '=', 2];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',copy_uids)")];
$expense = $this->get_list($map, $param);
return table_assign(0, '', $expense);
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',copy_uids)")];
$model = new ExpenseList;
$list = $model->get_list($param,$map);
return table_assign(0, '', $list);
} else {
return view();
}
@ -179,9 +138,14 @@ class Expense extends BaseController
if ($start_time > 0 && $end_time > 0) {
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
}
$list = $this->get_list($where,$param);
$model = new ExpenseList;
$list = $model->get_list($param,$where);
return table_assign(0, '', $list);
} else {
$auth = isAuthExpense($this->uid);
if($auth == 0){
return view('../../base/view/common/roletemplate');
}
return view();
}
}
@ -191,7 +155,6 @@ class Expense extends BaseController
{
$param = get_params();
if (request()->isAjax()) {
$dbRes = false;
$admin_id = $this->uid;
$param['income_month'] = isset($param['income_month']) ? strtotime(urldecode($param['income_month'])) : 0;
$param['expense_time'] = isset($param['expense_time']) ? strtotime(urldecode($param['expense_time'])) : 0;
@ -229,6 +192,7 @@ class Expense extends BaseController
}
}
$dbRes = false;
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ExpenseCheck::class)->scene('edit')->check($param);
@ -287,49 +251,56 @@ class Expense extends BaseController
}
$res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
$exid = $param['id'];
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
$idData = isset($param['expense_id']) ? $param['expense_id'] : 0;
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['id'] = $idData[$key];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
if ($data['id'] > 0) {
$data['update_time'] = time();
$resa = Db::name('ExpenseInterfix')->strict(false)->field(true)->update($data);
} else {
$data['create_time'] = time();
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
}
add_log('edit', $exid, $param);
//发送消息通知
$msg=[
'from_uid'=>$this->uid,
'action_id'=>$param['id']
];
$users = $param['check_admin_ids'];
sendMessage($users,31,$msg);
Db::commit();
$dbRes = true;
} else {
Db::rollback();
}
$exid = $param['id'];
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
$idData = isset($param['expense_id']) ? $param['expense_id'] : 0;
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['id'] = $idData[$key];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
if ($data['id'] > 0) {
$data['update_time'] = time();
$resa = Db::name('ExpenseInterfix')->strict(false)->field(true)->update($data);
} else {
$data['create_time'] = time();
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
}
//添加提交申请记录
$checkData=array(
'action_id' => $exid,
'check_user_id' => $this->uid,
'content' => '重新提交申请',
'type' => 2,
'check_time' => time(),
'create_time' => time()
);
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('edit', $exid, $param);
//发送消息通知
$msg=[
'from_uid'=>$this->uid,
'action_id'=>$param['id']
];
$users = $param['check_admin_ids'];
sendMessage($users,31,$msg);
Db::commit();
$dbRes = true;
} catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
Db::rollback();
return to_assign(1, $e->getMessage());
}
} else {
@ -390,41 +361,47 @@ class Expense extends BaseController
Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
if ($exid) {
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
$data['create_time'] = time();
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
add_log('add', $exid, $param);
//发送消息通知
$msg=[
'from_uid'=>$this->uid,
'action_id'=>$exid
];
$users = $param['check_admin_ids'];
sendMessage($users,31,$msg);
Db::commit();
$dbRes = true;
} else {
Db::rollback();
}
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
$data['create_time'] = time();
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
//添加提交申请记录
$checkData=array(
'action_id' => $exid,
'check_user_id' => $this->uid,
'content' => '提交申请',
'type' => 2,
'check_time' => time(),
'create_time' => time()
);
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('add', $exid, $param);
//发送消息通知
$msg=[
'from_uid'=>$this->uid,
'action_id'=>$exid
];
$users = $param['check_admin_ids'];
sendMessage($users,31,$msg);
Db::commit();
$dbRes = true;
} catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
Db::rollback();
return to_assign(1, $e->getMessage());
}
}
@ -437,7 +414,13 @@ class Expense extends BaseController
else{
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$expense = $this->detail($id);
$expense = (new ExpenseList())->detail($id);
if($expense['admin_id']!=$this->uid){
throw new \think\exception\HttpException(403, '禁止访问');
}
if($expense['check_status']!=4){
throw new \think\exception\HttpException(403, '禁止访问');
}
if($expense['file_ids'] !=''){
$fileArray = Db::name('File')->where('id','in',$expense['file_ids'])->select();
$expense['fileArray'] = $fileArray;
@ -446,7 +429,7 @@ class Expense extends BaseController
}
$department = $this->did;
//获取报销审批流程
$flows = get_type_flows(6,$department);
$flows = get_type_department_flows(6,$department);
$expense_cate = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray();
View::assign('user', get_admin($this->uid));
View::assign('expense_cate', $expense_cate);
@ -460,12 +443,12 @@ class Expense extends BaseController
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$detail = $this->detail($id);
$detail = (new ExpenseList())->detail($id);
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
$detail['check_user'] = '-';
$detail['copy_user'] = '-';
$check_user_ids = [];
if($detail['check_status']<2){
if($detail['check_status']==1){
if($flows['flow_type']==1){
$detail['check_user'] = '部门负责人';
$check_user_ids[]=get_department_leader($detail['admin_id']);
@ -477,7 +460,7 @@ class Expense extends BaseController
else{
$check_user_ids = explode(',',$flows['flow_uids']);
$check_user = Db::name('Admin')->where('id','in',$flows['flow_uids'])->column('name');
$detail['check_user'] = implode(',',$check_user);
$detail['check_user'] = implode(',',$check_user);
}
}
if($detail['copy_uids'] !=''){
@ -505,8 +488,30 @@ class Expense extends BaseController
}
}
}
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
->alias('f')
->join('Admin a', 'a.id = f.check_user_id', 'left')
->where(['f.action_id'=>$detail['id'],'f.type'=>2])
->order('check_time desc')
->select()->toArray();
foreach ($check_record as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d :H:i', $vv['check_time']);
$vv['status_str'] = '提交';
if($vv['status'] == 1){
$vv['status_str'] = '审核通过';
}
else if($vv['status'] == 2){
$vv['status_str'] = '审核拒绝';
}
if($vv['status'] == 3){
$vv['status_str'] = '撤销';
}
}
View::assign('is_create_admin', $is_create_admin);
View::assign('is_check_admin', $is_check_admin);
View::assign('check_record', $check_record);
View::assign('detail', $detail);
View::assign('flows', $flows);
View::assign('uid', $this->uid);
@ -517,16 +522,15 @@ class Expense extends BaseController
public function delete()
{
$id = get_params("id");
$expense = $this->detail($id);
$expense = (new ExpenseList())->detail($id);
if ($expense['check_status'] == 2) {
return to_assign(1, "已审核的报销记录不能删除");
}
if ($expense['check_status'] == 3) {
if ($expense['check_status'] == 5) {
return to_assign(1, "已打款的报销记录不能删除");
}
$data['status'] = '-1';
$data['delete'] = time();
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('expense')->update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
@ -534,218 +538,4 @@ class Expense extends BaseController
return to_assign(1, "删除失败");
}
}
//审核
public function check()
{
$param = get_params();
$detail = Db::name('Expense')->where(['id' => $param['id']])->find();
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
//审核通过
if($param['status'] == 1){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 4){
//查询当前会签记录数
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>2,'step_id'=>$step['id']])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
}
}
else{
$param['check_status'] = 1;
}
}
else if($step['flow_type'] == 0){
//自由人审批
if($param['check_node'] == 2){
$next_step = $detail['check_step_sort']+1;
$flow_step = array(
'action_id' => $detail['id'],
'sort' => $next_step,
'type' => 2,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$param['check_admin_ids'] = $param['check_admin_ids'];
$param['check_step_sort'] = $next_step;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
$param['check_admin_ids'] = get_department_leader($this->uid);
}
else if($next_step['flow_type'] == 2){
$param['check_admin_ids'] = get_department_leader($this->uid,1);
}
else{
$param['check_admin_ids'] = $next_step['flow_uids'];
}
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
if($param['check_status'] == 1 && $param['check_admin_ids']==''){
return to_assign(1,'找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 2,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('check', $param['id'], $param);
//发送消息通知
$msg=[
'from_uid'=>$detail['admin_id'],
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'action_id'=>$detail['id']
];
if($param['check_status'] == 1){
$users = $param['check_admin_ids'];
sendMessage($users,31,$msg);
}
if($param['check_status'] == 2){
$users = $detail['admin_id'];
sendMessage($users,32,$msg);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 2){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//拒绝审核,数据操作
$param['check_status'] = 3;
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$param['check_admin_ids'] ='';
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 2,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('refue', $param['id'], $param);
//发送消息通知
$msg=[
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'action_id'=>$detail['id']
];
$users = $detail['admin_id'];
sendMessage($users,33,$msg);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 3){
if($detail['admin_id'] != $this->uid){
return to_assign(1,'你没权限操作');
}
//撤销审核,数据操作
$param['check_status'] = 4;
$param['check_admin_ids'] ='';
$param['check_step_sort'] =0;
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => 0,
'check_user_id' => $this->uid,
'type' => 2,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('back', $param['id'], $param);
return to_assign();
}else{
return to_assign(1,'操作失败');
}
}
}
//设置为已打款
public function topay()
{
$param = get_params();
if (request()->isAjax()) {
//打款,数据操作
$param['check_status'] = 5;
$param['pay_admin_id'] = $this->uid;
$param['pay_time'] = time();
$res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
//发送消息通知
$detail = Db::name('Expense')->where(['id' => $param['id']])->find();
$msg=[
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'action_id'=>$detail['id']
];
$users = $detail['admin_id'];
sendMessage($users,34,$msg);
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
}

View File

@ -10,67 +10,21 @@ declare (strict_types = 1);
namespace app\finance\controller;
use app\base\BaseController;
use app\finance\model\Invoice as InvoiceList;
use app\finance\model\Invoice;
use app\finance\model\InvoiceIncome;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Income extends BaseController
{
public function get_list($param = [], $where = [])
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$expense = InvoiceList::where($where)
->order('create_time asc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->user = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->check_name = Db::name('Admin')->where(['id' => $item->check_admin_id])->value('name');
$item->check_time = empty($item->check_time) ? '-' : date('Y-m-d H:i', $item->check_time);
$item->enter_time = empty($item->enter_time) ? '-' : date('Y-m-d H:i', $item->enter_time);
$item->open_name = Db::name('Admin')->where(['id' => $item->open_admin_id])->value('name');
$item->open_time = empty($item->open_time) ? '-' : date('Y-m-d H:i', $item->open_time);
});
return $expense;
}
public function detail($id = 0)
{
$invoice = Db::name('Invoice')->where(['id' => $id])->find();
if ($invoice) {
$invoice['user'] = Db::name('Admin')->where(['id' => $invoice['admin_id']])->value('name');
$invoice['department'] = Db::name('Department')->where(['id' => $invoice['did']])->value('title');
$invoice['check_admin'] = Db::name('Admin')->where(['id' => $invoice['check_admin_id']])->value('name');
$invoice['open_admin'] = Db::name('Admin')->where(['id' => $invoice['open_admin_id']])->value('name');
if ($invoice['check_time'] > 0) {
$invoice['check_time'] = empty($invoice['check_time']) ? '0' : date('Y-m-d H:i', $invoice['check_time']);
}
if ($invoice['open_time'] > 0) {
$invoice['open_time'] = empty($invoice['open_time']) ? '0' : date('Y-m-d H:i', $invoice['open_time']);
}
else{
$invoice['open_time'] = '-';
}
$invoice['not_income'] = ($invoice['amount']*100 - $invoice['enter_amount']*100)/100;
//已到账的记录
$invoice['income'] = Db::name('InvoiceIncome')
->field('i.*,a.name as admin')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'LEFT')
->where(['i.inid'=>$id,'i.status'=>1])
->order('i.id asc')
->select();
}
return $invoice;
}
public function index()
{
$auth = isAuthIncome($this->uid);
if (request()->isAjax()) {
$param = get_params();
$where = [];
$where[] = ['status', '=', 1];
$where[] = ['delete_time', '=', 0];
$where[] = ['check_status', '=', 5];
//按时间检索
$start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
@ -81,9 +35,14 @@ class Income extends BaseController
if (isset($param['is_cash']) && $param['is_cash']!='') {
$where[] = ['is_cash', '=', $param['is_cash']];
}
$invoice = $this->get_list($param, $where);
if($auth == 0){
$where[] = ['admin_id','=',$this->uid];
}
$model = new Invoice();
$invoice = $model->income_list($param, $where);
return table_assign(0, '', $invoice);
} else {
View::assign('auth', $auth);
return view();
}
}
@ -92,13 +51,17 @@ class Income extends BaseController
public function add()
{
$param = get_params();
$auth = isAuthIncome($this->uid);
if (request()->isAjax()) {
if($auth == 0){
return to_assign(1, "你没有到账管理权限请联系管理员或者HR");
}
$inid = $param['inid'];
$admin_id = $this->uid;
//计算已到账的金额
$hasIncome = Db::name('InvoiceIncome')->where(['inid'=>$inid,'status'=>1])->sum('amount');
$hasIncome = InvoiceIncome::where(['inid'=>$inid,'status'=>1])->sum('amount');
//查询发票金额
$invoiceAmount = Db::name('Invoice')->where(['id'=>$inid])->value('amount');
$invoiceAmount = Invoice::where(['id'=>$inid])->value('amount');
if($param['enter_type']==1){ //单个到账记录
//相关内容多个数组
$enterPriceData=isset($param['amount'])? $param['amount'] : '';
@ -126,16 +89,16 @@ class Income extends BaseController
return to_assign(1,'到账金额大于发票金额,不允许保存');
}
else{
$res = Db::name('InvoiceIncome')->strict(false)->field(true)->insertAll($insert);
$res = InvoiceIncome::strict(false)->field(true)->insertAll($insert);
if($res!==false){
if(($enter_price + $hasIncome*100) == $invoiceAmount*100){
//发票全部到账
Db::name('Invoice')->where(['id'=>$inid])->update(['is_cash'=>2,'enter_amount'=>$invoiceAmount,'enter_time'=>time()]);
Invoice::where(['id'=>$inid])->update(['is_cash'=>2,'enter_amount'=>$invoiceAmount,'enter_time'=>time()]);
}
else if(($enter_price + $hasIncome*100) < $invoiceAmount*100){
$incomeTotal=($enter_price + $hasIncome*100)/100;
//发票部分到账
Db::name('Invoice')->where(['id'=>$inid])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]);
Invoice::where(['id'=>$inid])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]);
}
add_log('add',$inid,$param);
return to_assign();
@ -159,28 +122,47 @@ class Income extends BaseController
'admin_id' => $admin_id,
'create_time' => time()
];
$res = Db::name('InvoiceIncome')->strict(false)->field(true)->insertGetId($data);
$res = InvoiceIncome::strict(false)->field(true)->insertGetId($data);
if($res!==false){
//设置发票全部到账
Db::name('Invoice')->where(['id'=>$inid])->update(['is_cash'=>2,'enter_amount'=>$invoiceAmount,'enter_time'=>time()]);
Invoice::where(['id'=>$inid])->update(['is_cash'=>2,'enter_amount'=>$invoiceAmount,'enter_time'=>time()]);
add_log('add',$inid,$param);
return to_assign();
}
}
else if ($param['enter_type']==3) {//全部反账记录
//作废初始化发票到账数据
$res = Db::name('InvoiceIncome')->where(['inid'=>$inid])->update(['status'=>'6','update_time'=>time()]);
$res = InvoiceIncome::where(['inid'=>$inid])->update(['status'=>'6','update_time'=>time()]);
if($res!==false){
//设置发票全部没到账
Db::name('Invoice')->where(['id'=>$inid])->update(['is_cash'=>0,'enter_amount'=>0,'enter_time'=>0]);
Invoice::where(['id'=>$inid])->update(['is_cash'=>0,'enter_amount'=>0,'enter_time'=>0]);
add_log('tovoid',$inid,$param);
return to_assign();
}
}
}
else{
if($auth == 0){
return view('../../base/view/common/roletemplate');
}
$id = isset($param['id']) ? $param['id']: 0 ;
$detail = $this->detail($id);
$model = new Invoice();
$detail = $model->detail($id);
if(empty($detail)){
throw new \think\exception\HttpException(406, '找不到记录');
}
if($detail['file_ids'] !=''){
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
$detail['fileArray'] = $fileArray;
}
$detail['not_income'] = ($detail['amount']*100 - $detail['enter_amount']*100)/100;
//已到账的记录
$detail['income'] = InvoiceIncome::field('i.*,a.name as admin')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'LEFT')
->where(['i.inid'=>$id,'i.status'=>1])
->order('i.enter_time desc')
->select();
View::assign('uid', $this->uid);
View::assign('id', $id);
View::assign('detail', $detail);
@ -191,7 +173,19 @@ class Income extends BaseController
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$detail = $this->detail($id);
$model = new Invoice();
$detail = $model->detail($id);
if(empty($detail)){
throw new \think\exception\HttpException(406, '找不到记录');
}
$detail['not_income'] = ($detail['amount']*100 - $detail['enter_amount']*100)/100;
//已到账的记录
$detail['income'] = InvoiceIncome::field('i.*,a.name as admin')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'LEFT')
->where(['i.inid'=>$id,'i.status'=>1])
->order('i.enter_time desc')
->select();
View::assign('uid', $this->uid);
View::assign('detail', $detail);
return view();
@ -203,19 +197,19 @@ class Income extends BaseController
$param = get_params();
if (request()->isAjax()) {
//作废初始化发票到账数据
$income = Db::name('InvoiceIncome')->where(['id'=>$param['id']])->find();
$invoice = Db::name('Invoice')->where(['id'=>$income['inid']])->find();
$income =InvoiceIncome::where(['id'=>$param['id']])->find();
$invoice = Invoice::where(['id'=>$income['inid']])->find();
if($income){
$res = Db::name('InvoiceIncome')->where(['id'=>$param['id']])->update(['status'=>'6','update_time'=>time()]);
$res = InvoiceIncome::where(['id'=>$param['id']])->update(['status'=>'6','update_time'=>time()]);
if($res!==false){
if($income['amount']*100 == $invoice['amount']*100){
//发票全部反到账
Db::name('Invoice')->where(['id'=>$income['inid']])->update(['is_cash'=>0,'enter_amount'=>0,'enter_time'=>0]);
Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>0,'enter_amount'=>0,'enter_time'=>0]);
}
else if($income['amount']*100 < $invoice['amount']*100){
$incomeTotal=Db::name('InvoiceIncome')->where(['inid'=>$income['inid'],'status'=>1])->sum('amount');
$incomeTotal=InvoiceIncome::where(['inid'=>$income['inid'],'status'=>1])->sum('amount');
//发票部分到账
Db::name('Invoice')->where(['id'=>$income['inid']])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]);
Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]);
}
add_log('enter',$income['inid'],$invoice);
return to_assign();

View File

@ -18,90 +18,6 @@ use think\facade\View;
class Invoice extends BaseController
{
//发票列表检索
public function get_list($where = [],$param=[], $type='and')
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($type == 'or'){
$list = Db::name('Invoice')
->field('i.*,a.name,d.title as department_name')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'left')
->join('Department d', 'd.id = i.did', 'left')
->whereOr($where)
->order('i.id desc')
->group('i.id')
->paginate(['list_rows' => $rows, 'query' => $param])
->each(function($item, $key){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if ($item['open_time'] > 0) {
$item['open_time'] = empty($item['open_time']) ? '0' : date('Y-m-d', $item['open_time']);
$item['open_name'] = Db::name('Admin')->where('id',$item['open_admin_id'])->value('name');
}
else{
$item['open_time'] = '';
$item['open_name'] = '-';
}
$item['check_user'] = '-';
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
return $item;
});
}
else{
$list = Db::name('Invoice')
->field('i.*,a.name,d.title as department_name')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'left')
->join('Department d', 'd.id = i.did', 'left')
->where($where)
->order('i.id desc')
->paginate(['list_rows' => $rows, 'query' => $param])
->each(function($item, $key){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
$item['check_user'] = '-';
if ($item['open_time'] > 0) {
$item['open_time'] = empty($item['open_time']) ? '0' : date('Y-m-d', $item['open_time']);
$item['open_name'] = Db::name('Admin')->where('id',$item['open_admin_id'])->value('name');
}
else{
$item['open_time'] = '';
$item['open_name'] = '-';
}
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
return $item;
});
}
return $list;
}
//发票详情
public function detail($id = 0)
{
$invoice = Db::name('Invoice')->where(['id' => $id])->find();
if ($invoice) {
$invoice['create_user'] = Db::name('Admin')->where(['id' => $invoice['admin_id']])->value('name');
$invoice['department'] = Db::name('Department')->where(['id' => $invoice['did']])->value('title');
$invoice['check_admin'] = Db::name('Admin')->where(['id' => $invoice['check_admin_id']])->value('name');
$invoice['open_admin'] = Db::name('Admin')->where(['id' => $invoice['open_admin_id']])->value('name');
if ($invoice['check_time'] > 0) {
$invoice['check_time'] = empty($invoice['check_time']) ? '0' : date('Y-m-d H:i', $invoice['check_time']);
}
if ($invoice['open_time'] > 0) {
$invoice['open_time'] = empty($invoice['open_time']) ? '0' : date('Y-m-d', $invoice['open_time']);
}
else{
$invoice['open_time'] = '-';
}
}
return $invoice;
}
//我申请的发票
public function index()
{
@ -118,8 +34,9 @@ class Invoice extends BaseController
$where[] = ['i.create_time', 'between', [$start_time, $end_time]];
}
$where[] = ['i.admin_id','=',$this->uid];
$where[] = ['i.status','=',1];
$list = $this->get_list($where,$param);
$where[] = ['i.delete_time','=',0];
$model = new InvoiceList();
$list = $model->get_list($param, $where);
return table_assign(0, '', $list);
} else {
return view();
@ -137,18 +54,18 @@ class Invoice extends BaseController
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',i.check_admin_ids)")];
$map1[] = ['i.status','=',1];
$map1[] = ['i.delete_time','=',0];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',i.flow_admin_ids)")];
$map2[] = ['i.status','=',1];
$map2[] = ['i.delete_time','=',0];
$model = new InvoiceList();
if($status == 0){
$list = $this->get_list([$map1,$map2],$param,'or');
$list = $model->get_list($param,[$map1,$map2],'or');
}
if($status == 1){
$list = $this->get_list($map1,$param);
$list = $model->get_list($param,$map1);
}
if($status == 2){
$list = $this->get_list($map2,$param);
$list = $model->get_list($param,$map2);
}
return table_assign(0, '', $list);
} else {
@ -169,11 +86,12 @@ class Invoice extends BaseController
if ($start_time > 0 && $end_time > 0) {
$where[] = ['i.expense_time', 'between', [$start_time, $end_time]];
}
$map[] = ['i.status','=',1];
$map[] = ['i.delete_time','=',0];
$map[] = ['i.check_status', '=', 2];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',i.copy_uids)")];
$expense = $this->get_list($map, $param);
return table_assign(0, '', $expense);
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',i.copy_uids)")];
$model = new InvoiceList();
$list = $model->get_list($param,$map);
return table_assign(0, '', $list);
} else {
return view();
}
@ -197,10 +115,15 @@ class Invoice extends BaseController
if ($start_time > 0 && $end_time > 0) {
$where[] = ['i.create_time', 'between', [$start_time, $end_time]];
}
$where[] = ['i.status','=',1];
$list = $this->get_list($where,$param);
$where[] = ['i.delete_time','=',0];
$model = new InvoiceList();
$list = $model->get_list($param,$where);
return table_assign(0, '', $list);
} else {
$auth = isAuthInvoice($this->uid);
if($auth == 0){
return view('../../base/view/common/roletemplate');
}
return view();
}
}
@ -289,6 +212,16 @@ class Invoice extends BaseController
$res = InvoiceList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
//添加提交申请记录
$checkData=array(
'action_id' => $param['id'],
'check_user_id' => $this->uid,
'content' => '重新提交申请',
'type' => 3,
'check_time' => time(),
'create_time' => time()
);
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('edit', $param['id'], $param);
//发送消息通知
$msg=[
@ -308,9 +241,8 @@ class Invoice extends BaseController
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$admin_id = $this->uid;
$param['admin_id'] = $admin_id;
$param['did'] = get_login_admin('did');
$param['admin_id'] = $this->uid;
$param['did'] = $this->did;
$param['create_time'] = time();
if (!isset($param['check_admin_ids'])) {
@ -360,6 +292,16 @@ class Invoice extends BaseController
}
if ($exid) {
//添加提交申请记录
$checkData=array(
'action_id' => $exid,
'check_user_id' => $this->uid,
'content' => '提交申请',
'type' => 3,
'check_time' => time(),
'create_time' => time()
);
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('apply', $exid, $param);
//发送消息通知
$msg=[
@ -376,7 +318,11 @@ class Invoice extends BaseController
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$detail = $this->detail($id);
$model = new InvoiceList();
$detail = $model->detail($id);
if(empty($detail)){
throw new \think\exception\HttpException(406, '找不到记录');
}
if($detail['file_ids'] !=''){
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
$detail['fileArray'] = $fileArray;
@ -385,7 +331,7 @@ class Invoice extends BaseController
}
$department = $this->did;
//获取发票审批流程
$flows = get_type_flows(7,$department);
$flows = get_type_department_flows(7,$department);
View::assign('user', get_admin($this->uid));
View::assign('id', $id);
View::assign('flows', $flows);
@ -397,12 +343,16 @@ class Invoice extends BaseController
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$detail = $this->detail($id);
$model = new InvoiceList();
$detail = $model->detail($id);
if(empty($detail)){
throw new \think\exception\HttpException(406, '找不到记录');
}
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
$detail['check_user'] = '-';
$detail['copy_user'] = '-';
$check_user_ids = [];
if($detail['check_status']<2){
if($detail['check_status'] == 1){
if($flows['flow_type']==1){
$detail['check_user'] = '部门负责人';
$check_user_ids[]=get_department_leader($detail['admin_id']);
@ -435,7 +385,6 @@ class Invoice extends BaseController
if(in_array($this->uid,$check_user_ids)){
$is_check_admin = 1;
//当前审核节点详情
//$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
if($flows['flow_type'] == 4){
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>3,'step_id'=>$flows['id'],'check_user_id'=>$this->uid])->count();
if($check_count>0){
@ -443,8 +392,30 @@ class Invoice extends BaseController
}
}
}
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
->alias('f')
->join('Admin a', 'a.id = f.check_user_id', 'left')
->where(['f.action_id'=>$detail['id'],'f.type'=>3])
->order('check_time desc')
->select()->toArray();
foreach ($check_record as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d :H:i', $vv['check_time']);
$vv['status_str'] = '提交';
if($vv['status'] == 1){
$vv['status_str'] = '审核通过';
}
else if($vv['status'] == 2){
$vv['status_str'] = '审核拒绝';
}
if($vv['status'] == 3){
$vv['status_str'] = '撤销';
}
}
View::assign('is_create_admin', $is_create_admin);
View::assign('is_check_admin', $is_check_admin);
View::assign('check_record', $check_record);
View::assign('detail', $detail);
View::assign('flows', $flows);
View::assign('uid', $this->uid);
@ -455,253 +426,20 @@ class Invoice extends BaseController
public function delete()
{
$id = get_params("id");
$detail = $this->detail($id);
if ($detail['status'] == 2) {
$status = InvoiceList::where(['id' => $param['id']])->value('check_status');
if ($status == 2) {
return to_assign(1, "已审核的发票不能删除");
}
if ($detail['status'] == 3) {
if ($status == 3) {
return to_assign(1, "已开具的发票不能删除");
}
$data['status'] = '-1';
$data['delete_time'] = time();
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('Invoice')->update($data) !== false) {
if (InvoiceList::update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
//审核
public function check()
{
$param = get_params();
$detail = Db::name('Invoice')->where(['id' => $param['id']])->find();
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
//审核通过
if($param['status'] == 1){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 4){
//查询当前会签记录数
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>3,'step_id'=>$step['id']])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
}
}
else{
$param['check_status'] = 1;
}
}
else if($step['flow_type'] == 0){
//自由人审批
if($param['check_node'] == 2){
$next_step = $detail['check_step_sort']+1;
$flow_step = array(
'action_id' => $detail['id'],
'sort' => $next_step,
'type' => 3,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$param['check_admin_ids'] = $param['check_admin_ids'];
$param['check_step_sort'] = $next_step;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
$param['check_admin_ids'] = get_department_leader($this->uid);
}
else if($next_step['flow_type'] == 2){
$param['check_admin_ids'] = get_department_leader($this->uid,1);
}
else{
$param['check_admin_ids'] = $next_step['flow_uids'];
}
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
if($param['check_status'] == 1 && $param['check_admin_ids']==''){
return to_assign(1,'找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 3,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['check_remark'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('check', $param['id'], $param);
//发送消息通知
$msg=[
'from_uid'=>$detail['admin_id'],
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'action_id'=>$detail['id']
];
if($param['check_status'] == 1){
$users = $param['check_admin_ids'];
sendMessage($users,41,$msg);
}
if($param['check_status'] == 2){
$users = $detail['admin_id'];
sendMessage($users,42,$msg);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 2){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//拒绝审核,数据操作
$param['check_status'] = 3;
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$param['check_admin_ids'] ='';
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids,check_remark')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 3,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['check_remark'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('refue', $param['id'], $param);
//发送消息通知
$msg=[
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'action_id'=>$detail['id']
];
$users = $detail['admin_id'];
sendMessage($users,43,$msg);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 3){
if($detail['admin_id'] != $this->uid){
return to_assign(1,'你没权限操作');
}
//撤销审核,数据操作
$param['check_status'] = 4;
$param['check_admin_ids'] ='';
$param['check_step_sort'] =0;
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids,check_remark')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => 0,
'check_user_id' => $this->uid,
'type' => 3,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['check_remark'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('back', $param['id'], $param);
return to_assign();
}else{
return to_assign(1,'操作失败');
}
}
}
//作废
public function tovoid()
{
$param = get_params();
if (request()->isAjax()) {
if ($param['check_status'] == 10) {
$count = Db::name('InvoiceIncome')->where(['inid'=>$param['id'],'status'=>1])->count();
if($count>0){
return to_assign(1, "发票已经新增有到账记录,请先反到账后再作废发票");
}
else{
$param['update_time'] = time();
add_log('tovoid', $param['id'],$param);
}
}
$res = InvoiceList::where('id', $param['id'])->strict(false)->field('check_status')->update($param);
if ($res !== false) {
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
//开具发票
public function open()
{
$param = get_params();
if (request()->isAjax()) {
$detail = Db::name('Invoice')->where(['id' => $param['id']])->find();
if ($detail['check_status'] == 2) {
$param['check_status'] = 5;
$param['open_admin_id'] = $this->uid;
}
$param['open_time'] = isset($param['open_time']) ? strtotime(urldecode($param['open_time'])) : 0;
$res = InvoiceList::where('id', $param['id'])->strict(false)->field('code,check_status,open_time,open_admin_id,delivery')->update($param);
if ($res !== false) {
add_log('open', $param['id'],$param);
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
}
}

View File

@ -1,7 +1,76 @@
<?php
namespace app\finance\model;
use think\Model;
use think\facade\Db;
class Expense extends Model
{
public function get_list($param = [],$where = [], $type='and')
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($type == 'or'){
$expense = Expense::whereOr($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
$item['check_user'] = '-';
if($item['check_status']==1 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
});
}
else{
$expense = Expense::where($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
$item['check_user'] = '-';
if($item['check_status']==1 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
});
}
return $expense;
}
public function detail($id = 0)
{
$expense = Expense::where(['id' => $id])->find();
if ($expense) {
$expense['income_month'] = empty($expense['income_month']) ? '-' : date('Y-m', $expense['income_month']);
$expense['expense_time'] = empty($expense['expense_time']) ? '-' : date('Y-m-d', $expense['expense_time']);
$expense['create_user'] = Db::name('Admin')->where(['id' => $expense['admin_id']])->value('name');
$expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title');
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount');
if ($expense['pay_time'] > 0) {
$expense['pay_time'] = date('Y-m-d H:i:s', $expense['pay_time']);
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
}
else{
$expense['pay_time'] = '-';
}
$expense['list'] = Db::name('ExpenseInterfix')
->field('a.*,c.title as cate_title')
->alias('a')
->join('ExpenseCate c', 'a.cate_id = c.id','LEFT')
->where(['a.exid' => $expense['id']])
->select();
}
return $expense;
}
}

View File

@ -1,7 +1,101 @@
<?php
namespace app\finance\model;
use think\Model;
use think\facade\Db;
class Invoice extends Model
{
//发票列表检索
public function get_list($param=[],$where = [], $type='and')
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($type == 'or'){
$list = Invoice::field('i.*,a.name,d.title as department_name')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'left')
->join('Department d', 'd.id = i.did', 'left')
->whereOr($where)
->order('i.id desc')
->group('i.id')
->paginate(['list_rows' => $rows, 'query' => $param])
->each(function($item, $key){
if ($item['open_time'] > 0) {
$item['open_time'] = empty($item['open_time']) ? '0' : date('Y-m-d', (int)$item['open_time']);
$item['open_name'] = Db::name('Admin')->where('id',$item['open_admin_id'])->value('name');
}
else{
$item['open_time'] = '';
$item['open_name'] = '-';
}
$item['check_user'] = '-';
if($item['check_status']==1 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
return $item;
});
}
else{
$list = Invoice::field('i.*,a.name,d.title as department_name')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'left')
->join('Department d', 'd.id = i.did', 'left')
->where($where)
->order('i.id desc')
->paginate(['list_rows' => $rows, 'query' => $param])
->each(function($item, $key){
$item['check_user'] = '-';
if ($item['open_time'] > 0) {
$item['open_time'] = empty($item['open_time']) ? '0' : date('Y-m-d', (int)$item['open_time']);
$item['open_name'] = Db::name('Admin')->where('id',$item['open_admin_id'])->value('name');
}
else{
$item['open_time'] = '';
$item['open_name'] = '-';
}
if($item['check_status'] == 1 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
return $item;
});
}
return $list;
}
//到账列表检索
public function income_list($param = [], $where = [])
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$list = Invoice::where($where)
->order('is_cash asc,create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->user = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->enter_time = empty($item->enter_time) ? '-' : date('Y-m-d H:i', $item->enter_time);
$item->open_name = Db::name('Admin')->where(['id' => $item->open_admin_id])->value('name');
$item->open_time = empty($item->open_time) ? '-' : date('Y-m-d H:i', $item->open_time);
});
return $list;
}
public function detail($id = 0)
{
$detail = Invoice::where(['id' => $id])->find();
if ($detail) {
$detail['create_user'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
$detail['department'] = Db::name('Department')->where(['id' => $detail['did']])->value('title');
if ($detail['open_time'] > 0) {
$detail['open_time'] = empty($detail['open_time']) ? '0' : date('Y-m-d H:i', $detail['open_time']);
$detail['open_admin'] = Db::name('Admin')->where(['id' => $detail['open_admin_id']])->value('name');
}
else{
$detail['open_time'] = '-';
$detail['open_admin'] = '-';
}
}
return $detail;
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace app\finance\model;
use think\Model;
class InvoiceIncome extends Model
{
}

View File

@ -9,21 +9,6 @@
.select-1,.select-2{display:none;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;width: calc(100% - 110px);
}
.file-card .file-tool .layui-icon{font-size:22px; padding:2px; cursor:pointer;}
</style>
{/block}
<!-- 主体 -->
@ -58,31 +43,31 @@
</tr>
<tr>
<td class="layui-td-gray">报销选项<font>*</font></td>
<td colspan="5">
<div>
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th width="100">报销金额</th>
<th width="120">报销项目</th>
<th>备注信息</th>
<th width="60">操作</th>
</tr>
<tr class="more_interfix">
<td><input type="text" name="amount[]" value="" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
<td style="text-align:left">
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
<option value="">请选择</option>
{volist name="$expense_cate" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</td>
<td><input type="text" name="remarks[]" class="layui-input" value=""><input type="hidden" name="expense_id[]" class="layui-input" value="0"></td>
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>
</tr>
</table>
<td colspan="5">
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th width="100">报销金额</th>
<th width="120">报销项目</th>
<th>备注信息</th>
<th width="60">操作</th>
</tr>
<tr class="more_interfix">
<td><input type="text" name="amount[]" value="" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
<td style="text-align:left">
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
<option value="">请选择</option>
{volist name="$expense_cate" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</td>
<td><input type="text" name="remarks[]" class="layui-input" value=""><input type="hidden" name="expense_id[]" class="layui-input" value="0"></td>
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>
</tr>
</table>
<div class="pt-2">
<button class="layui-btn layui-btn-sm" type="button" id="addInterfix">+ 报销选项</button>
</div>
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="addInterfix">+报销选项</button>
</td>
</tr>
<tr>
@ -113,7 +98,7 @@
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
<input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择审核人" class="layui-input picker-more" readonly><input type="hidden" name="copy_uids" value="" readonly>
</td>
</tr>
</table>
@ -142,32 +127,32 @@
<tr>
<td class="layui-td-gray">报销选项<font>*</font></td>
<td colspan="5">
<div>
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th width="100">报销金额</th>
<th width="120">报销类别</th>
<th>备注信息</th>
<th width="60">操作</th>
</tr>
{volist name="$expense.list" id="val"}
<tr class="more_interfix">
<td><input type="text" name="amount[]" value="{$val.amount}" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
<td style="text-align:left">
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
<option value="">请选择</option>
{volist name="$expense_cate" id="vo"}
<option value="{$vo.id}" {eq name="$vo.id" value="$val.cate_id"} selected{/eq}>{$vo.title}</option>
{/volist}
</select>
</td>
<td><input type="text" name="remarks[]" class="layui-input" value="{$val.remarks}"><input type="hidden" name="expense_id[]" class="layui-input" value="{$val.id}"></td>
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="{$val.id}" lay-event="del">删除</a></td>
</tr>
{/volist}
</table>
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th width="100">报销金额</th>
<th width="120">报销类别</th>
<th>备注信息</th>
<th width="60">操作</th>
</tr>
{volist name="$expense.list" id="val"}
<tr class="more_interfix">
<td><input type="text" name="amount[]" value="{$val.amount}" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
<td style="text-align:left">
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
<option value="">请选择</option>
{volist name="$expense_cate" id="vo"}
<option value="{$vo.id}" {eq name="$vo.id" value="$val.cate_id"} selected{/eq}>{$vo.title}</option>
{/volist}
</select>
</td>
<td><input type="text" name="remarks[]" class="layui-input" value="{$val.remarks}"><input type="hidden" name="expense_id[]" class="layui-input" value="{$val.id}"></td>
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="{$val.id}" lay-event="del">删除</a></td>
</tr>
{/volist}
</table>
<div class="pt-2">
<button class="layui-btn layui-btn-sm" type="button" id="addInterfix">+ 报销选项</button>
</div>
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="addInterfix">+报销选项</button>
</td>
</tr>
<tr>
@ -177,13 +162,13 @@
<input type="hidden" name="file_ids" value="{$expense.file_ids}">
{notempty name="$expense.file_ids"}
{volist name="$expense.fileArray" id="vo"}
<div class="layui-col-md3" id="uploadImg{$vo.id}">
<div class="layui-col-md4" id="uploadImg{$vo.id}">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="{$vo.id}" style="color: #FF5722;" title="删除"></i>
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="iconfont icon-shujudaoru blue"></i></a>
<i class="btn-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除"></i>
</div>
</div>
</div>
@ -212,7 +197,7 @@
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
<input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择审核人" class="layui-input picker-more" readonly><input type="hidden" name="copy_uids" value="" readonly>
</td>
</tr>
</table>
@ -220,7 +205,7 @@
<div class="py-3">
<input name="id" id="id" type="hidden" value="{$id}">
<button class="layui-btn" lay-submit="" lay-filter="webform">保存并提交审核</button>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">保存并提交审核</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
@ -255,57 +240,14 @@ Array.prototype.remove = function (val) {
}
};
const moduleInit = ['tool','formSelects','employeepicker'];
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,
upload = layui.upload,
tool=layui.tool,
formSelects = layui.formSelects,
employeepicker = layui.employeepicker,
laydate = layui.laydate;
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
laydate.render({
elem: '#income_month',
type:'month',
@ -345,7 +287,7 @@ const moduleInit = ['tool','formSelects','employeepicker'];
title: '提示'
}, function(index) {
$.ajax({
url: "/api/index/del_expense_interfix",
url: "/finance/api/del_expense_interfix",
type:'post',
data: {id: _id},
success: function(res) {
@ -393,35 +335,53 @@ const moduleInit = ['tool','formSelects','employeepicker'];
return false;
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
//选择单个员工弹窗
$('body').on('click','.picker-one',function () {
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'';
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
callback:function(ids,names,dids,departments){
that.val(names);
that.next().val(ids);
}
});
})
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
//选择多个员工弹窗
$('body').on('click','.picker-more',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'',ids_array=[],names_array=[];
if(ids.length>0){
ids_array=ids.split(',');
names_array=names.split(',');
}
employeepicker.init({
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));
}
});
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
<input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one"><input type="hidden" name="check_admin_ids" value="">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
@ -439,24 +399,33 @@ const moduleInit = ['tool','formSelects','employeepicker'];
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
$('[name="copy_names"]').val(e.data.copy_unames);
$('[name="copy_uids"]').val(e.data.copy_uids.split(','));
}
if(check_type == 1){
if(check_type == 1 || check_type == 3){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
if(check_type == 1){
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>';
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>';
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
}
else if(check_type == 3){
sign_type= ' <span class="layui-badge layui-bg-blue">'+flow_data[a].flow_name+'</span>'
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
@ -470,7 +439,7 @@ const moduleInit = ['tool','formSelects','employeepicker'];
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<td colspan="7">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
@ -479,6 +448,48 @@ const moduleInit = ['tool','formSelects','employeepicker'];
}
})
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md4" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="iconfont icon-shujudaoru blue"></i></a>
<i class="btn-delete iconfont icon-shanchu red" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
}
</script>
{/block}

View File

@ -166,7 +166,7 @@
title: '提示'
}, function(index) {
$.ajax({
url: "/finance/expense/topay",
url: "/finance/api/topay",
type:'post',
data: {id: data.id},
success: function(res) {

View File

@ -0,0 +1,97 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">权限配置</h3>
<table class="layui-table layui-table-form">
<tr>
<td colspan="4" class="red" style="line-height:1.8">
<p><strong>财务模块使用说明:</strong></p>
<p><strong>1、设置报销打款管理员可设置多个</strong></p>
<p style="text-indent:1.6em">拥有报销打款管理员权限的员工可以设置报销的打款情况。</p>
<p><strong>2、设置发票管理员可设置多个</strong></p>
<p style="text-indent:1.6em">拥有发票管理员权限的员工可以开具、废弃发票。</p>
<p><strong>3、设置到账管理员可设置多个</strong></p>
<p style="text-indent:1.6em">拥有到账管理员权限的员工可以设置发票的到账情况。</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">权限名称</td>
<td>
<input type="hidden" name="id" value="{$detail.id}" />
{$detail.title}
</td>
<td class="layui-td-gray">权限标识</td>
<td>{$detail.name}</td>
</tr>
<tr>
<td class="layui-td-gray-2">报销管理员<font>*</font>
</td>
<td colspan="3">
<input type="text" name="unames" value="{$detail.unames}" readonly placeholder="请选择报销管理员" autocomplete="off" class="layui-input picker-more" lay-verify="required" lay-reqText="请选择报销管理员">
<input type="hidden" id="uids" name="uids" value="{$detail.uids}">
</td>
</tr>
<tr>
<td class="layui-td-gray-2">发票管理员<font>*</font></td>
<td colspan="3">
<input type="text" name="conf_unames_1" value="{$detail.conf_unames_1}" readonly placeholder="请选择发票管理员" autocomplete="off" class="layui-input picker-more" lay-verify="required" lay-reqText="请选择发票管理员">
<input type="hidden" name="conf_1" value="{$detail.conf_1}">
</td>
</tr>
<tr>
<td class="layui-td-gray-2">到账管理员<font>*</font></td>
<td colspan="3">
<input type="text" name="conf_unames_2" value="{$detail.conf_unames_2}" readonly placeholder="请选择到账管理员" autocomplete="off" class="layui-input picker-more" lay-verify="required" lay-reqText="请选择到账管理员">
<input type="hidden" name="conf_2" value="{$detail.conf_2}">
</td>
</tr>
</table>
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form, tool = layui.tool,employeepicker = layui.employeepicker;
//选择多个员工弹窗
$('body').on('click','.picker-more',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'',ids_array=[],names_array=[];
if(ids.length>0){
ids_array=ids.split(',');
names_array=names.split(',');
}
employeepicker.init({
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));
}
});
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
}
tool.post("/contract/cate/conf", data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -28,7 +28,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">+ 添加报销登记</span>
<span class="layui-btn layui-btn-sm" lay-event="add">+ 添加报销登记</span>
</div>
</script>
{/block}
@ -79,15 +79,18 @@
align: 'center',
width: 120,
templet:function(d){
var html='<span class="red">审批不通过</span>';
var html='<span class="black">待审批</span>';
if(d.check_status==1){
html='<span class="green">审批中</span>';
html='<span class="blue">审批中</span>';
}
else if(d.check_status==2){
html='<span class="blue">审批通过</span>';
html='<span class="green">审批通过</span>';
}
else if(d.check_status==3){
html='<span class="red">审批失败</span>';
}
else if(d.check_status==4){
html='<span class="red">撤销</span>';
html='<span class="red">撤销</span>';
}
else if(d.check_status==5){
html='<span class="yellow">已打款</span>';

View File

@ -8,7 +8,7 @@
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
.check-items{overflow-x: auto; padding: 10px 0;}
.check-items{overflow-x: auto; padding: 2px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
@ -24,11 +24,13 @@
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
flex-wrap: wrap;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0; padding:4px 0}
.check-item i{margin-right:3px; color:#646464;}
.check-item span{color:#999;margin:0 3px;}
.check-item .layui-icon {font-size:18px;}
.check-item .layui-icon.layui-icon-right{font-size:12px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
@ -38,31 +40,17 @@
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.flow-record{padding:4px 4px 0;}
.flow-record .layui-timeline-item{text-decoration:line-through; color:#acacac; padding-bottom:10px;}
.flow-record .layui-timeline-item.delete-0{text-decoration:none; color:#323232;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.check-record{line-height:1.5; padding:4px 0}
.flow-this{font-weight:800;}
.flow-this i{color:#4285f4}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;width: calc(100% - 80px);
}
.file-card .file-tool .layui-icon{font-size:22px; padding:2px; cursor:pointer;}
</style>
{/block}
<!-- 主体 -->
@ -121,12 +109,12 @@
<td colspan="5">
<div class="layui-row">
{volist name="$detail.fileArray" id="vo"}
<div class="layui-col-md3">
<div class="layui-col-md4">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-title file-title-view">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="iconfont icon-shujudaoru blue"></i></a>
</div>
</div>
</div>
@ -135,15 +123,27 @@
</td>
</tr>
{/notempty}
{if ( $detail.check_status eq 5)}
<tr>
<td class="layui-td-gray">报销状态</td>
<td><span style="color:#34a853">已打款</span></td>
<td class="layui-td-gray">打款人</td>
<td>{$detail.pay_admin}</td>
<td class="layui-td-gray">打款时间</td>
<td>{$detail.pay_time}</td>
</tr>
{/if}
</table>
<table class="layui-table layui-table-form mt-4">
<tr>
<td class="layui-td-gray">审核状态</td>
<td>{eq name="$detail.check_status" value="0"}<span class="green">待审批</span>{/eq}
{eq name="$detail.check_status" value="1"}<span class="green">审批中</span>{/eq}
{eq name="$detail.check_status" value="2"}<span class="blue">已通过,待打款</span>{/eq}
<td>{eq name="$detail.check_status" value="0"}<span class="black">待审批</span>{/eq}
{eq name="$detail.check_status" value="1"}<span class="blue">审批中</span>{/eq}
{eq name="$detail.check_status" value="2"}<span class="green">已通过,待打款</span>{/eq}
{eq name="$detail.check_status" value="3"}<span class="red">已拒绝</span>{/eq}
{eq name="$detail.check_status" value="4"}<span class="red">已撤销</span>{/eq}
{eq name="$detail.check_status" value="5"}<span class="yellow">已通过,并打款</span>{/eq}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
<td class="layui-td-gray-2">当前审核人</td>
<td>{$detail.check_user}</td>
@ -163,18 +163,31 @@
</div>
</td>
</tr>
{if ( $detail.check_status lt 2) AND ( $is_check_admin eq 1) }
{notempty name="$check_record"}
<tr>
<td class="layui-td-gray">审批记录</td>
<td colspan="5">
<ul class="layui-timeline flow-record pt-2">
{volist name="$check_record" id="vo"}
<li class="layui-timeline-item delete-{$vo.delete_time}">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<p style="padding-left:24px">{$vo.check_time_str}<span class="black ml-2">{$vo.name}</span><span class="mx-2 layui-color-{$vo.status}">{$vo.status_str}</span>了此申请。操作意见:<span class="green">{$vo.content}</span></p>
</li>
{/volist}
</ul>
</td>
</tr>
{/notempty}
{if ( $detail.check_status eq 1) AND ( $is_check_admin eq 1) }
{eq name="$flows.flow_type" value="0"}
<tr>
<td class="layui-td-gray">审批节点 <font>*</font></td>
<td colspan="5">
<form class="layui-form">
<input type="radio" name="check_node" lay-filter="check_node" value="1" title="审核结束">
<input type="radio" name="check_node" lay-filter="check_node" value="2" title="下一审批人">
<div class="layui-inline">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择下一审批人" lay-verify="required" lay-reqText="请选择下一审批人" class="layui-input">
</div>
</form>
<input type="radio" name="check_node" lay-filter="check_node" value="1" title="审核结束">
<input type="radio" name="check_node" lay-filter="check_node" value="2" title="下一审批人">
<div class="layui-inline">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择下一审批人" lay-verify="required" lay-reqText="请选择下一审批人" class="layui-input">
</div>
</td>
</tr>
{/eq}
@ -185,33 +198,26 @@
</td>
</tr>
{/if}
{if ( $detail.check_status eq 5)}
<tr>
<td class="layui-td-gray">报销状态</td>
<td><span style="color:#34a853">已打款</span></td>
<td class="layui-td-gray">打款人</td>
<td>{$detail.pay_admin}</td>
<td class="layui-td-gray">打款时间</td>
<td>{$detail.pay_time}</td>
</tr>
{/if}
</table>
<input type="hidden" name="id" value="{$detail.id}">
<input type="hidden" name="flow_type" value="{$flows.flow_type}">
<div id="formBtn" style="padding: 10px 0">
{if ( $detail.check_status lt 2)}
<input type="hidden" name="check_step_sort" value="{$detail.check_step_sort}">
<input type="hidden" name="check_status" value="{$detail.check_status}">
<div id="formBtn" style="padding: 10px 0">
{eq name="$detail.check_status" value='1'}
{eq name="$is_check_admin" value='1'}
<span class="layui-btn layui-btn-normal" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> 拒绝</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> {$flows.flow_type == 5?'回退':'拒绝'}</span>
{/eq}
{eq name="$is_create_admin" value='1'}
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/eq}
{/eq}
{if ( $detail.check_status eq 3) AND ( $is_create_admin eq 1) }
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/if}
{if ( $detail.check_status eq 3) OR ( $detail.check_status eq 4 ) }
{eq name="$is_create_admin" value='1'}
<a class="layui-btn" href="/finance/expense/add?id={$detail.id}">重新编辑</a>
{/eq}
{if ( $detail.check_status eq 4) AND ( $is_create_admin eq 1) }
<a class="layui-btn" href="/finance/expense/add?id={$detail.id}">重新编辑</a>
{/if}
</div>
{/block}
@ -221,24 +227,24 @@
{block name="script"}
<script>
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, dropdown = layui.dropdown, employeepicker = layui.employeepicker;
function gouguInit() {
var form = layui.form,tool=layui.tool, employeepicker = layui.employeepicker,dropdown = layui.dropdown;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'get',
data:{id:$('[name="id"]').val(),type:2},
success: function (e) {
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'get',
data:{id:$('[name="id"]').val(),type:2},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
let flowHtml='',list = e.data,record_list='',sort = $('[name="check_step_sort"]').val(), check_status = $('[name="check_status"').val();
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
strStatus ='<div class="check-item-status">待审核</div>',
sortClass ='';
if(f == list.length-1){
iconRight ='';
}
@ -283,7 +289,6 @@ const moduleInit = ['tool','employeepicker'];
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
@ -305,50 +310,37 @@ const moduleInit = ['tool','employeepicker'];
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
else if(list[f].flow_type == 5){
checkUser=list[f].flow_name+' ['+list[f].user_id_info[0].name+']';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
if(sort == list[f].sort && check_status==1){
sortClass ='flow-this';
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">当前审核</div>';
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row '+sortClass+'" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
@ -370,104 +362,108 @@ const moduleInit = ['tool','employeepicker'];
,'</div>'].join('')
});
}
}
}
}
}
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
$('#formBtn').on('click','span', function(data){
let id=$('[name="id"]').val();
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/finance/expense/check",
type:'post',
data:{
id:id,
check_node:check_node,
check_admin_ids:check_admin_ids,
status:check_status,
content:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
location.reload();
}
}
})
layer.close(index);
});
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
else if(check_status ==3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
$.ajax({
url: "/finance/expense/check",
type:'post',
data:{
id:id,
status:check_status,
content:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
location.reload();
}
}
})
layer.close(index);
});
}
return false;
});
})
//监听提交
$('#formBtn').on('click','span', function(data){
let id=$('[name="id"]').val();
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/api/index/flow_check",
type:'post',
data:{
id:id,
type:2,
check_node:check_node,
check_admin_ids:check_admin_ids,
check:check_status,
content:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
}
else if(check_status == 3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
if(value==''){
layer.msg('请输入撤回理由');
return false;
}
$.ajax({
url: "/api/index/flow_check",
type:'post',
data:{
id:id,
type:2,
check:check_status,
content:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
}
return false;
});
}
</script>
{/block}

View File

@ -1,7 +1,19 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.check-items{overflow-x: auto; padding: 10px 0;}
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;width: calc(100% - 80px);}
.file-card .file-tool .layui-icon{font-size:22px; padding:2px; cursor:pointer;}
.check-items{overflow-x: auto; padding: 2px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
@ -17,11 +29,13 @@
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
flex-wrap: wrap;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0; padding:4px 0}
.check-item i{margin-right:3px; color:#646464;}
.check-item span{color:#999;margin:0 3px;}
.check-item .layui-icon {font-size:18px;}
.check-item .layui-icon.layui-icon-right{font-size:12px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
@ -31,14 +45,15 @@
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.flow-record{padding:4px 4px 0;}
.flow-record .layui-timeline-item{text-decoration:line-through; color:#acacac; padding-bottom:10px;}
.flow-record .layui-timeline-item.delete-0{text-decoration:none; color:#323232;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.layui-table-min{margin-bottom:6px;}
.check-record{line-height:1.5; padding:4px 0}
.flow-this{font-weight:800;}
.flow-this i{color:#4285f4}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
@ -56,7 +71,8 @@
<td class="layui-td-gray">发票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
{eq name="$detail.invoice_type" value="2"}普通发票{/eq}
{eq name="$detail.invoice_type" value="3"}专业发票{/eq}
</td>
<td class="layui-td-gray">发票主体</td>
<td>
@ -100,21 +116,20 @@
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.check_status == 0)"}
<span style="color:#009688">待审</span>
<span class="black">待审核</span>
{elseif condition="($detail.check_status == 1)"}
<span style="color:#009688">审核中</span>
<span class="blue">审核中</span>
{elseif condition="($detail.check_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
<span class="green">审核通过,待开具</span>
{elseif condition="($detail.check_status == 3)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
<span class="red">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 4)"}
<span style="color:#FF5722">撤销 【原因:{$detail.check_remark}】</span>
<span class="red">撤销 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 5)"}
<span style="color:#1E9FFF">已开具</span>
<span class="green">已开具</span>
{elseif condition="($detail.check_status == 10)"}
<span style="color:#FF5722">已作废</span>
<span class="yellow">已作废</span>
{/if}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
</tr>
{if condition="$detail.open_admin_id > 0"}
@ -174,7 +189,7 @@
{/empty}
</table>
{if condition="($detail.is_cash lt 2)"}
<div><button class="layui-btn layui-btn-sm layui-btn-normal" type="button" id="addInterfix">+ 添加到账记录</button></div>
<div class="pt-2"><button class="layui-btn layui-btn-sm" type="button" id="addInterfix">+ 添加到账记录</button></div>
{/if}
</td>
</tr>
@ -183,7 +198,7 @@
<input name="inid" id="inid" type="hidden" value="{$id}">
<input name="enter_type" id="enter_type" type="hidden" value="1">
{if condition="($detail.is_cash lt 2)"}
<button class="layui-btn" lay-submit="" lay-filter="webform">保存到账记录</button>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">保存到账记录</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
{/if}
{if condition="($detail.is_cash eq 0)"}
@ -207,158 +222,7 @@
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool,laydate = layui.laydate, dropdown = layui.dropdown;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'get',
data:{id:$('[name="id"]').val(),type:3},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
var form = layui.form,tool=layui.tool,laydate = layui.laydate;
//添加表格行
$('#addInterfix').on('click',function(){

View File

@ -30,6 +30,7 @@
<!-- 脚本 -->
{block name="script"}
<script>
const auth = "{$auth}";
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,table = layui.table,tool=layui.tool, laydate = layui.laydate;
@ -151,8 +152,15 @@
width: 142,
align: 'center',
templet:function(d){
var html='<div class="layui-btn-group"><span class="layui-btn layui-btn-xs" lay-event="add">到账管理</span><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">到账详情</span></div>';
return html;
var html='<div class="layui-btn-group">';
var btn1='<span class="layui-btn layui-btn-xs" lay-event="add">到账管理</span>';
var btn2='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">到账详情</span>';
if(auth == 1){
return html+btn1+btn2+'</div>';
}
else{
return html+btn2+'</div>';
}
}
}
]

View File

@ -1,42 +1,17 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.check-items{overflow-x: auto; padding: 10px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item span{color:#999;margin:0 3px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;width: calc(100% - 80px);}
.file-card .file-tool .layui-icon{font-size:22px; padding:2px; cursor:pointer;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
@ -55,7 +30,8 @@
<td class="layui-td-gray">发票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
{eq name="$detail.invoice_type" value="2"}普通发票{/eq}
{eq name="$detail.invoice_type" value="3"}专业发票{/eq}
</td>
<td class="layui-td-gray">发票主体</td>
<td>
@ -99,21 +75,20 @@
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.check_status == 0)"}
<span class="green">待审</span>
<span class="black">待审核</span>
{elseif condition="($detail.check_status == 1)"}
<span class="green">审核中</span>
<span class="blue">审核中</span>
{elseif condition="($detail.check_status == 2)"}
<span class="blue">审核通过,待开具</span>
<span class="green">审核通过,待开具</span>
{elseif condition="($detail.check_status == 3)"}
<span class="red">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 4)"}
<span class="red">撤销 【原因:{$detail.check_remark}】</span>
<span class="red">撤销 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 5)"}
<span class="blue">已开具</span>
<span class="green">已开具</span>
{elseif condition="($detail.check_status == 10)"}
<span class="yellow">已作废</span>
{/if}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
</tr>
{if condition="$detail.open_admin_id > 0"}
@ -126,6 +101,26 @@
<td>{$detail.code}</td>
</tr>
{/if}
{notempty name="$detail.file_ids"}
<tr>
<td class="layui-td-gray">相关附件</td>
<td colspan="5">
<div class="layui-row">
{volist name="$detail.fileArray" id="vo"}
<div class="layui-col-md3">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
</div>
</div>
</div>
{/volist}
</div>
</td>
</tr>
{/notempty}
</table>
<h3 class="py-3">到账信息</h3>
@ -184,161 +179,5 @@
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool, dropdown = layui.dropdown;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'get',
data:{id:$('[name="id"]').val(),type:3},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
}
</script>
{/block}
{block name="script"}{/block}
<!-- /脚本 -->

View File

@ -89,7 +89,7 @@
</div>
</td>
</tr>
<tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
@ -109,7 +109,7 @@
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
<input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择审核人" class="layui-input picker-more" readonly><input type="hidden" name="copy_uids" value="" readonly>
</td>
</tr>
</table>
@ -210,7 +210,7 @@
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
<input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择审核人" class="layui-input picker-more" readonly><input type="hidden" name="copy_uids" value="" readonly>
</td>
</tr>
</table>
@ -218,7 +218,7 @@
<div class="py-3">
<input name="id" id="id" type="hidden" value="{$id}">
<button class="layui-btn" lay-submit="" lay-filter="webform">保存并提交审核</button>
<button class="layui-btn layui-btn-normal " lay-submit="" lay-filter="webform">保存并提交审核</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
@ -245,118 +245,112 @@ Array.prototype.remove = function (val) {
}
};
const moduleInit = ['tool','formSelects','employeepicker'];
function gouguInit() {
var form = layui.form,
upload = layui.upload,
tool=layui.tool,
formSelects = layui.formSelects,
employeepicker = layui.employeepicker,
laydate = layui.laydate;
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,
upload = layui.upload,
tool=layui.tool,
employeepicker = layui.employeepicker,
laydate = layui.laydate;
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
//选择抬头类型
form.on('radio(type)', function (data) {
if(data.value==2){
$('.invoice-type').hide();
}
else{
$('.invoice-type').show();
}
});
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/finance/invoice/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//选择抬头类型
form.on('radio(type)', function (data) {
if(data.value==2){
$('.invoice-type').hide();
}
else{
$('.invoice-type').show();
}
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
return false;
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
//选择单个员工弹窗
$('body').on('click','.picker-one',function () {
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'';
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names);
that.next().val(ids);
}
if(data.value==''){
return false;
});
});
//选择多个员工弹窗
$('body').on('click','.picker-more',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'',ids_array=[],names_array=[];
if(ids.length>0){
ids_array=ids.split(',');
names_array=names.split(',');
}
employeepicker.init({
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
}
if(check_type == 1){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
});
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one"><input type="hidden" name="check_admin_ids" value="">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
$('[name="copy_names"]').val(e.data.copy_unames);
$('[name="copy_uids"]').val(e.data.copy_uids.split(','));
}
if(check_type == 1 || check_type == 3){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(check_type == 1){
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
@ -365,51 +359,84 @@ const moduleInit = ['tool','formSelects','employeepicker'];
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>';
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>';
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
else if(check_type == 3){
sign_type= ' <span class="layui-badge layui-bg-blue">'+flow_data[a].flow_name+'</span>'
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="7">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
})
});
}
})
});
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/finance/invoice/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
})
return false;
});
}
</script>
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -107,23 +107,23 @@
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
width: 120,
templet:function(d){
var html='<span class="green">待审核</span>';
var html='<span class="black">待审核</span>';
if(d.check_status==1){
html='<span class="green">审核中</span>';
html='<span class="blue">审核中</span>';
}
else if(d.check_status==2){
html='<span class="blue">待开具</span>';
html='<span class="green">审核通过,待开具</span>';
}
else if(d.check_status==3){
html='<span class="red">审核不通过</span>';
}
else if(d.check_status==4){
html='<span class="red">撤销</span>';
html='<span class="red">撤销</span>';
}
else if(d.check_status==5){
html='<span class="blue">已开具</span>';
html='<span class="green">已开具</span>';
}
else if(d.check_status==10){
html='<span class="yellow">已作废</span>';
@ -164,20 +164,25 @@
field: 'right',
fixed: 'right',
title: '操作',
width: 168,
width: 170,
align: 'center',
templet:function(d){
//0待审、1审批中、2通过、3失败、4撤销、5已开具、10已作废
var html='<div class="layui-btn-group">';
var btn1='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
var btn2='<span class="layui-btn layui-btn-warm layui-btn-xs" lay-event="open">标记为开票</span>';
var btn3='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disabled">作废</span>';
var btn3='<span class="layui-btn layui-btn-xs" lay-event="open">修改开票信息</span>';
var btn4='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="tovoid">作废</span>';
var btn5='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="novoid">反作废</span>';
html+=btn1;
if(d.check_status==2){
html+=btn2;
}
if(d.check_status==5 && d.open_admin_id==login_user){
html+=btn2+btn3;
if(d.check_status==5){
html+=btn3+btn4;
}
if(d.check_status==10){
html+=btn5;
}
html+='</div>';
return html;
@ -232,8 +237,16 @@
let code = $('#LAY_module').find('[name="code"]').val();
let open_time = $('#LAY_module').find('[name="open_time"]').val();
let delivery = $('#LAY_module').find('[name="delivery"]').val();
if(code == ''){
layer.msg('请输入发票号码');
return false;
}
if(open_time == ''){
layer.msg('请选择开票时间');
return false;
}
$.ajax({
url: "/finance/invoice/open",
url: "/finance/api/open",
type: 'post',
data: {
id: data.id,
@ -255,13 +268,13 @@
}
});
}
if (obj.event === 'disabled') {
if (obj.event === 'tovoid') {
layer.confirm('确定作废该发票吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/finance/invoice/tovoid",
url: "/finance/api/tovoid",
type:'post',
data: {
id: data.id,
@ -277,6 +290,28 @@
layer.close(index);
});
}
if (obj.event === 'novoid') {
layer.confirm('确定反作废该发票吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/finance/api/novoid",
type:'post',
data: {
id: data.id,
check_status:5
},
success: function(res) {
layer.msg(res.msg);
if (res.code == 0) {
layui.pageTable.reload();
}
}
})
layer.close(index);
});
}
});
}
</script>

View File

@ -93,23 +93,23 @@
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
width: 120,
templet:function(d){
var html='<span class="green">待审核</span>';
var html='<span class="black">待审核</span>';
if(d.check_status==1){
html='<span class="green">审核中</span>';
html='<span class="blue">审核中</span>';
}
else if(d.check_status==2){
html='<span class="blue">待开具</span>';
html='<span class="green">审核通过,待开具</span>';
}
else if(d.check_status==3){
html='<span class="red">审核不通过</span>';
}
else if(d.check_status==4){
html='<span class="red">撤销</span>';
html='<span class="red">撤销</span>';
}
else if(d.check_status==5){
html='<span class="blue">已开具</span>';
html='<span class="green">已开具</span>';
}
else if(d.check_status==10){
html='<span class="yellow">已作废</span>';

View File

@ -29,7 +29,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">+ 申请开票</span>
<span class="layui-btn layui-btn-sm" lay-event="add">+ 申请开票</span>
</div>
</script>
{/block}
@ -109,23 +109,23 @@
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
width: 120,
templet:function(d){
var html='<span class="green">待审核</span>';
var html='<span class="black">待审核</span>';
if(d.check_status==1){
html='<span class="green">审核中</span>';
html='<span class="blue">审核中</span>';
}
else if(d.check_status==2){
html='<span class="blue">待开具</span>';
html='<span class="green">审核通过,待开具</span>';
}
else if(d.check_status==3){
html='<span class="red">审核不通过</span>';
}
else if(d.check_status==4){
html='<span class="red">撤销</span>';
html='<span class="red">撤销</span>';
}
else if(d.check_status==5){
html='<span class="blue">已开具</span>';
html='<span class="green">已开具</span>';
}
else if(d.check_status==10){
html='<span class="yellow">已作废</span>';
@ -150,7 +150,7 @@
},{
field: 'check_user',
title: '当前审核人',
width: 150
width: 140
},{
field: 'open_name',
title: '开票人',

View File

@ -87,23 +87,23 @@
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
width: 120,
templet:function(d){
var html='<span class="green">待审核</span>';
var html='<span class="black">待审核</span>';
if(d.check_status==1){
html='<span class="green">审核中</span>';
html='<span class="blue">审核中</span>';
}
else if(d.check_status==2){
html='<span class="blue">待开具</span>';
html='<span class="green">审核通过,待开具</span>';
}
else if(d.check_status==3){
html='<span class="red">审核不通过</span>';
}
else if(d.check_status==4){
html='<span class="red">撤销</span>';
html='<span class="red">撤销</span>';
}
else if(d.check_status==5){
html='<span class="blue">已开具</span>';
html='<span class="green">已开具</span>';
}
else if(d.check_status==10){
html='<span class="yellow">已作废</span>';

View File

@ -8,7 +8,7 @@
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
.check-items{overflow-x: auto; padding: 10px 0;}
.check-items{overflow-x: auto; padding: 2px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
@ -24,11 +24,13 @@
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
flex-wrap: wrap;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0; padding:4px 0}
.check-item i{margin-right:3px; color:#646464;}
.check-item span{color:#999;margin:0 3px;}
.check-item .layui-icon {font-size:18px;}
.check-item .layui-icon.layui-icon-right{font-size:12px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
@ -38,36 +40,21 @@
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.flow-record{padding:4px 4px 0;}
.flow-record .layui-timeline-item{text-decoration:line-through; color:#acacac; padding-bottom:10px;}
.flow-record .layui-timeline-item.delete-0{text-decoration:none; color:#323232;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.check-record{line-height:1.5; padding:4px 0}
.flow-this{font-weight:800;}
.flow-this i{color:#4285f4}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
.file-card {background: #fff;border: 1px solid #f1f1f1;border-radius: 2px; padding:8px 0; margin:4px 8px 4px 0;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.file-card .file-icon{font-size:36px; color:#646464; margin-right: 4px;}
.file-card .file-title {font-size: 12px; letter-spacing: 0; margin-right: 8px; line-height: 16px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;width: calc(100% - 80px);
}
.file-card .file-tool .layui-icon{font-size:22px; padding:2px; cursor:pointer;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">发票详情</h3>
<table class="layui-table">
@ -126,12 +113,12 @@
<td colspan="5">
<div class="layui-row">
{volist name="$detail.fileArray" id="vo"}
<div class="layui-col-md3">
<div class="layui-col-md4">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-title file-title-view">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="iconfont icon-shujudaoru blue"></i></a>
</div>
</div>
</div>
@ -144,21 +131,20 @@
<td class="layui-td-gray">发票状态</td>
<td>
{if condition="($detail.check_status == 0)"}
<span class="green">待审</span>
<span class="black">待审核</span>
{elseif condition="($detail.check_status == 1)"}
<span class="green">审核中</span>
<span class="blue">审核中</span>
{elseif condition="($detail.check_status == 2)"}
<span class="blue">审核通过,待开具</span>
<span class="green">审核通过,待开具</span>
{elseif condition="($detail.check_status == 3)"}
<span class="red">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 4)"}
<span class="red">撤销 【原因:{$detail.check_remark}】</span>
<span class="red">撤销 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 5)"}
<span class="blue">已开具</span>
<span class="green">已开具</span>
{elseif condition="($detail.check_status == 10)"}
<span class="yellow">已作废</span>
{/if}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
<td class="layui-td-gray-2">当前审核人</td>
<td>{$detail.check_user}</td>
@ -178,7 +164,22 @@
</div>
</td>
</tr>
{if ( $detail.check_status lt 2) AND ( $is_check_admin eq 1) }
{notempty name="$check_record"}
<tr>
<td class="layui-td-gray">审批记录</td>
<td colspan="5">
<ul class="layui-timeline flow-record pt-2">
{volist name="$check_record" id="vo"}
<li class="layui-timeline-item delete-{$vo.delete_time}">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<p style="padding-left:24px">{$vo.check_time_str}<span class="black ml-2">{$vo.name}</span><span class="mx-2 layui-color-{$vo.status}">{$vo.status_str}</span>了此申请。操作意见:<span class="green">{$vo.content}</span></p>
</li>
{/volist}
</ul>
</td>
</tr>
{/notempty}
{if ( $detail.check_status eq 1) AND ( $is_check_admin eq 1) }
{eq name="$flows.flow_type" value="0"}
<tr>
<td class="layui-td-gray">审批节点 <font>*</font></td>
@ -210,27 +211,30 @@
<td colspan="3">{$detail.open_time}</td>
</tr>
<tr>
<td class="layui-td-gray">快递单号</td>
<td class="layui-td-gray">物流单号</td>
<td colspan="5">{$detail.delivery}</td>
</tr>
{/if}
</table>
<input type="hidden" name="id" value="{$detail.id}">
<input type="hidden" name="flow_type" value="{$flows.flow_type}">
<input type="hidden" name="check_step_sort" value="{$detail.check_step_sort}">
<input type="hidden" name="check_status" value="{$detail.check_status}">
<div id="formBtn" style="padding: 10px 0">
{if ( $detail.check_status lt 2)}
{eq name="$detail.check_status" value='1'}
{eq name="$is_check_admin" value='1'}
<span class="layui-btn layui-btn-normal" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> 拒绝</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> {$flows.flow_type == 5?'回退':'拒绝'}</span>
{/eq}
{eq name="$is_create_admin" value='1'}
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/eq}
{/eq}
{if ( $detail.check_status eq 3) AND ( $is_create_admin eq 1) }
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/if}
{if ( $detail.check_status eq 3) OR ( $detail.check_status eq 4 ) }
{eq name="$is_create_admin" value='1'}
<a class="layui-btn" href="/finance/invoice/add?id={$detail.id}">重新编辑</a>
{/eq}
{if ( $detail.check_status eq 4) AND ( $is_create_admin eq 1) }
<a class="layui-btn" href="/finance/invoice/add?id={$detail.id}">重新编辑</a>
{/if}
</div>
</div>
@ -241,157 +245,145 @@
{block name="script"}
<script>
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, dropdown = layui.dropdown, employeepicker = layui.employeepicker;
function gouguInit() {
var form = layui.form,tool=layui.tool, employeepicker = layui.employeepicker,dropdown = layui.dropdown;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'get',
data:{id:$('[name="id"]').val(),type:3},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
if (e.code == 0) {
let flowHtml='',list = e.data,record_list='',sort = $('[name="check_step_sort"]').val(), check_status = $('[name="check_status"').val();
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>',
sortClass ='';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
else if(list[f].check_list[0].status == 2){
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
else if(list[f].flow_type == 5){
checkUser=list[f].flow_name+' ['+list[f].user_id_info[0].name+']';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
if(sort == list[f].sort && check_status==1){
sortClass ='flow-this';
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
strStatus ='<div class="check-item-status">当前审核</div>';
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row '+sortClass+'" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
$('#flowList').append(flowHtml);
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
@ -405,86 +397,91 @@ const moduleInit = ['tool','employeepicker'];
}
});
})
//监听提交
$('#formBtn').on('click','span', function(data){
let id=$('[name="id"]').val();
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/finance/invoice/check",
type:'post',
data:{
id:id,
check_node:check_node,
check_admin_ids:check_admin_ids,
status:check_status,
check_remark:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
location.reload();
}
}
})
layer.close(index);
});
//监听提交
$('#formBtn').on('click','span', function(data){
let id=$('[name="id"]').val();
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
else if(check_status ==3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
$.ajax({
url: "/finance/invoice/check",
type:'post',
data:{
id:id,
status:check_status,
check_remark:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
location.reload();
}
}
})
layer.close(index);
});
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
return false;
});
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/api/index/flow_check",
type:'post',
data:{
id:id,
type:3,
check_node:check_node,
check_admin_ids:check_admin_ids,
check:check_status,
content:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
}
else if(check_status == 3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
if(value==''){
layer.msg('请输入撤回理由');
return false;
}
$.ajax({
url: "/api/index/flow_check",
type:'post',
data:{
id:id,
type:3,
check:check_status,
content:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
}
return false;
});
}
</script>
{/block}

175
app/home/controller/Api.php Normal file
View File

@ -0,0 +1,175 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\api\BaseController;
use app\home\model\AdminLog;
use app\user\validate\AdminCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\Session;
class api extends BaseController
{
//首页公告
public function get_note_list()
{
$list = Db::name('Note')
->field('a.id,a.title,a.create_time,c.title as cate_title')
->alias('a')
->join('note_cate c', 'a.cate_id = c.id')
->where(['a.status' => 1])
->order('a.end_time desc,a.sort desc,a.create_time desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
return table_assign(0, '', $res);
}
//首页知识列表
public function get_article_list()
{
$prefix = get_config('database.connections.mysql.prefix');//判断是否安装了文章模块
$exist = Db::query('show tables like "'.$prefix.'article"');
$res['data'] = [];
if($exist){
$list = Db::name('Article')
->field('a.id,a.title,a.create_time,a.read,c.title as cate_title')
->alias('a')
->join('article_cate c', 'a.cate_id = c.id')
->where(['a.delete_time' => 0])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
}
return table_assign(0, '', $res);
}
//首页项目
public function get_project_list()
{
$prefix = get_config('database.connections.mysql.prefix');//判断是否安装了项目模块
$exist = Db::query('show tables like "'.$prefix.'project"');
$res['data'] = [];
if($exist){
$project_ids = Db::name('ProjectUser')->where(['uid' => $this->uid, 'delete_time' => 0])->column('project_id');
$list = Db::name('Project')
->field('a.id,a.name,a.status,a.create_time,a.start_time,a.end_time,u.name as director_name')
->alias('a')
->join('Admin u', 'a.director_uid = u.id')
->where([['a.delete_time', '=', 0], ['a.id', 'in', $project_ids]])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
$list[$key]['plan_time'] = date('Y-m-d', $list[$key]['start_time']) . ' 至 ' . date('Y-m-d', $list[$key]['end_time']);
$list[$key]['status_name'] = \app\project\model\Project::$Status[(int) $val['status']];
}
$res['data'] = $list;
}
return table_assign(0, '', $res);
}
//获取访问记录
public function get_view_data()
{
$param = get_params();
$first_time = time();
$second_time = $first_time - 86400;
$three_time = $first_time - 86400 * 365;
$begin_first = strtotime(date('Y-m-d', $first_time) . " 00:00:00");
$end_first = strtotime(date('Y-m-d', $first_time) . " 23:59:59");
$begin_second = strtotime(date('Y-m-d', $second_time) . " 00:00:00");
$end_second = strtotime(date('Y-m-d', $second_time) . " 23:59:59");
$begin_three = strtotime(date('Y-m-d', $three_time) . " 00:00:00");
$data_first = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_first,$end_first")->select();
$data_second = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_second,$end_second")->select();
$data_three = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_three,$end_first")->select();
return to_assign(0, '', ['data_first' => hour_document($data_first), 'data_second' => hour_document($data_second), 'data_three' => date_document($data_three)]);
}
//修改个人信息
public function edit_personal()
{
if (request()->isAjax()) {
$param = get_params();
$uid = $this->uid;
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('user@user/edit_personal', [
'admin' => get_admin($this->uid),
]);
}
}
//修改密码
public function edit_password()
{
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editPwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$uid = $this->uid;
$admin = Db::name('Admin')->where(['id' => $uid])->find();
$old_psw = set_password($param['old_pwd'], $admin['salt']);
if ($admin['pwd'] != $old_psw) {
return to_assign(1, '旧密码错误');
}
$salt = set_salt(20);
$new_pwd = set_password($param['pwd'], $salt);
$data = [
'reg_pwd' => '',
'salt' => $salt,
'pwd' => $new_pwd,
'update_time' => time(),
];
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($data);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('user@user/edit_password', [
'admin' => get_admin($this->uid),
]);
}
}
//系统操作日志
public function log_list()
{
if (request()->isAjax()) {
$param = get_params();
$log = new AdminLog();
$content = $log->get_log_list($param);
return table_assign(0, '', $content);
}else{
return view('home@log/log_list');
}
}
}

View File

@ -13,8 +13,6 @@ use app\base\BaseController;
use app\home\validate\FlowTypeCheck;
use app\home\validate\ExpenseCateCheck;
use app\home\validate\CostCateCheck;
use app\home\validate\SealCateCheck;
use app\home\validate\CarCateCheck;
use app\home\validate\IndustryCheck;
use app\home\validate\ServicesCheck;
use app\home\validate\WorkCateCheck;
@ -165,134 +163,6 @@ class Cate extends BaseController
}
}
//印章类别
public function seal_cate()
{
if (request()->isAjax()) {
$cate = Db::name('SealCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//印章类别添加
public function seal_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(SealCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('SealCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(SealCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('SealCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//印章类别设置
public function seal_cate_check()
{
$param = get_params();
$res = Db::name('SealCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//车辆类型
public function car_cate()
{
if (request()->isAjax()) {
$cate = Db::name('CarCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//车辆类型添加
public function car_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(CarCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('CarCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(CarCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('CarCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//车辆类型设置
public function car_cate_check()
{
$param = get_params();
$res = Db::name('CarCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//报销类别
public function expense_cate()
{

View File

@ -44,19 +44,48 @@ class Flow extends BaseController
{
$param = get_params();
if (request()->isAjax()) {
$flowTypeData = isset($param['flowType']) ? $param['flowType'] : '';
$flowUidsData = isset($param['flowUids']) ? $param['flowUids'] : '';
$flow_list=[];
foreach ($flowTypeData as $key => $value) {
if (!$value) {
continue;
$param['flow_list'] = '';
$flow_list=[];
if($param['check_type']==1){
$flowTypeData = isset($param['flowType']) ? $param['flowType'] : '';
$flowUidsData = isset($param['flowUidsA']) ? $param['flowUidsA'] : '';
foreach ($flowTypeData as $key => $value) {
if (!$value) {
continue;
}
if($value>2 && $flowUidsData[$key]==''){
return to_assign(1, '第'.($key+1).'行的指定人未选择');
break;
}
$item = [];
$item['flow_type'] = $value;
$item['flow_uids'] = $flowUidsData[$key];
$flow_list[]=$item;
}
$item = [];
$item['flow_type'] = $value;
$item['flow_uids'] = $flowUidsData[$key];
$flow_list[]=$item;
$param['flow_list'] = serialize($flow_list);
}
$param['flow_list'] = serialize($flow_list);
if($param['check_type']==3){
$flowNameData = isset($param['flowName']) ? $param['flowName'] : '';
$flowUidsData = isset($param['flowUidsB']) ? $param['flowUidsB'] : '';
foreach ($flowNameData as $key => $value) {
if (!$value) {
continue;
}
if($flowUidsData[$key]==''){
return to_assign(1, '第'.($key+1).'行的指定人未选择');
break;
}
$item = [];
$item['flow_name'] = $value;
$item['flow_type'] = 5;
$item['flow_uids'] = $flowUidsData[$key];
$flow_list[]=$item;
}
if(empty($flow_list)){
return to_assign(1, '审批流程信息未完善');
}
$param['flow_list'] = serialize($flow_list);
}
if ($param['id'] > 0) {
try {
validate(FlowCheck::class)->scene('edit')->check($param);
@ -84,7 +113,22 @@ class Flow extends BaseController
$id = isset($param['id']) ? $param['id'] : 0;
if($id>0){
$detail = Db::name('Flow')->where('id',$id)->find();
$detail['flow_list'] = unserialize($detail['flow_list']);
$flow_list = unserialize($detail['flow_list']);
if(!empty($flow_list)){
foreach ($flow_list as $key => &$val) {
$val['flow_unames'] ='';
if($val['flow_type']>2){
$flow_unames = Db::name('Admin')->where('id', 'in', $val['flow_uids'])->column('name');
$val['flow_unames'] = implode(',', $flow_unames);
}
}
}
$detail['flow_list'] = $flow_list;
$detail['copy_unames'] ='';
if($detail['copy_uids']!=''){
$copy_unames = Db::name('Admin')->where('id', 'in', $detail['copy_uids'])->column('name');
$detail['copy_unames'] = implode(',', $copy_unames);
}
$detail['flow_cate_list'] = Db::name('FlowType')->where(['type'=>$detail['type'],'status'=>1])->select()->toArray();
View::assign('detail', $detail);
}

View File

@ -22,7 +22,7 @@ class Index extends BaseController
//发票待审核统计
$invoice_map_check[] = ['check_status', '<', 2];
$invoice_map_check[] = ['', 'exp', Db::raw("FIND_IN_SET('{$admin_id}',check_admin_ids)")];
$invoice_map_check[] = ['status', '=', 1];
$invoice_map_check[] = ['delete_time', '=', 0];
$invoice_count_check = Db::name('Invoice')->where($invoice_map_check)->count();
$statistics['invoice_html_check'] = '<a data-id="130" class="side-menu-item" data-href="/finance/invoice/list" class="menu-active"> 您有<font style="color:#FF0000">' . $invoice_count_check . '</font>条发票申请待审核</a>';
if ($invoice_count_check == 0) {
@ -32,7 +32,7 @@ class Index extends BaseController
//发票待开具统计
$invoice_map_open[] = ['open_time', '=', 0];
$invoice_map_open[] = ['open_admin_id', '=', $admin_id];
$invoice_map_open[] = ['status', '=', 1];
$invoice_map_open[] = ['delete_time', '=', 0];
$invoice_count_open = Db::name('Invoice')->where($invoice_map_open)->count();
$statistics['invoice_html_open'] = '<a data-id="131" class="side-menu-item" data-href="/finance/invoice/checkedlist">您有<font style="color:#FF0000">' . $invoice_count_open . '</font>条发票待开具</a>';
if ($invoice_count_open == 0) {
@ -42,7 +42,7 @@ class Index extends BaseController
//待审核的报销统计
$expense_map_check[] = ['check_status', '<', 2];
$expense_map_check[] = ['', 'exp', Db::raw("FIND_IN_SET('{$admin_id}',check_admin_ids)")];
$expense_map_check[] = ['status', '=', 1];
$expense_map_check[] = ['delete_time', '=', 0];
$expense_count_check = Db::name('Expense')->where($expense_map_check)->count();
$statistics['expense_html_check'] = '<a data-id="121" class="side-menu-item" data-title="待我审批的报销" data-href="/finance/expense/list">您有<font style="color:#FF0000">' . $expense_count_check . '</font>条报销单待审核</a>';
if ($expense_count_check == 0) {
@ -97,8 +97,8 @@ class Index extends BaseController
$total = [];
$adminCount = Db::name('Admin')->where('status', '1')->count();
$approveCount = Db::name('Approve')->count();
$expenseCount = Db::name('Expense')->where('status', '1')->count();
$invoiceCount = Db::name('Invoice')->where('status', '1')->count();
$expenseCount = Db::name('Expense')->where('delete_time', '0')->count();
$invoiceCount = Db::name('Invoice')->where('delete_time', '0')->count();
$total[] = array(
'name' => '员工',
'num' => $adminCount,

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加车辆类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加车辆类型</button>
</div>
</script>
{/block}
@ -41,9 +41,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加费用类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加费用类型</button>
</div>
</script>
{/block}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加报销类别</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加报销类别</button>
</div>
</script>
{/block}
@ -24,7 +24,7 @@
,title:'报销类别列表'
,url: "/home/cate/expense_cate"
,page: false
,cellMinWidth: 80
,cellMinWidth: 120
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '类别名称'}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加审批类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加审批类型</button>
</div>
</script>
{/block}
@ -24,12 +24,15 @@
,title:'审批模块列表'
,url: "/home/cate/flow_type"
,page: false
,cellMinWidth: 80
,cellMinWidth: 120
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '审批类型名称'}
,{field:'name',title: '审批类型标识'}
,{field:'icon',title: '审批类型图标'}
,{field:'icon',title: '审批类型图标',templet: function(d){
var html='<strong class="iconfont '+d.icon+'"></strong> '+d.icon;
return html;
}}
,{field:'type', title: '所属分类',width:100,align:'center',templet: function(d){
var html='';
if(d.type==1){
@ -64,9 +67,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -32,7 +32,7 @@
</td>
<td class="layui-td-gray">图标<font>*</font></td>
<td>
<input style="width:150px; display:inline" class="layui-input" type="text" name="icon" value="" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >
<input style="width:200px; display:inline" class="layui-input" type="text" name="icon" value="" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >
icon-jichupeizhi<a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
@ -71,8 +71,8 @@
</td>
<td class="layui-td-gray">图标<font>*</font></td>
<td>
<input style="width:150px; display:inline" class="layui-input" type="text" name="icon" value="{$detail.icon}" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >
<i class="iconfont {$detail.icon}"></i><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
<input style="width:200px; display:inline" class="layui-input" type="text" name="icon" value="{$detail.icon}" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >
<strong class="iconfont {$detail.icon}"></strong><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加行业类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加行业类型</button>
</div>
</script>
{/block}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加印章类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加印章类型</button>
</div>
</script>
{/block}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加服务类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加服务类型</button>
</div>
</script>
{/block}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加发票主体</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加发票主体</button>
</div>
</script>
{/block}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加工作类型</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加工作类型</button>
</div>
</script>
{/block}
@ -40,9 +40,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -58,13 +58,14 @@
<td class="layui-td-gray-2">审批流类型<font>*</font></td>
<td colspan="5">
<input type="radio" name="check_type" lay-filter="checktype" value="1" title="固定审批流" checked>
<input type="radio" name="check_type" lay-filter="checktype" value="2" title="授权审批人">
<input type="radio" name="check_type" lay-filter="checktype" value="2" title="自由审批流">
<input type="radio" name="check_type" lay-filter="checktype" value="3" title="可回退的审批流">
</td>
</tr>
<tr id="flowTr">
<tr id="flowTr1">
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div id="flowList">
<div id="flowList1">
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第1级</label>
@ -78,28 +79,67 @@
</div>
</div>
<div class="layui-inline select-1">
<label class="layui-form-label">指定用户</label>
<div class="layui-input-inline" style="width:300px;">
<select name="flowUids[]" xm-selected="" xm-select="flowuids0" xm-select-skin="default" xm-select-height="36px"></select>
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:360px;">
<input type="text" name="flowUnamesA[]" value="" autocomplete="off" readonly class="layui-input picker-more">
<input type="hidden" name="flowUidsA[]" value="">
</div>
</div>
</div>
</div>
<span id="addFlow" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<span id="addFlow1" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、当选择<strong> “当前部门负责人” </strong>审批时。系统仅会通知当前部门的负责人。</p>
<p>2、当选择<strong> “上一级部门负责人” </strong>审批时。系统仅会通知当前部门的上一级部门的负责人。</p>
<p>3、当选择<strong> “指定人员(多人或签)” </strong>时,表示指定用户中任意一人审批即可。</p>
<p>4、当选择<strong> “指定人员(多人会签)” </strong>时,表示指定人员中所有人都需要审批。</p>
<p>3、当选择<strong> “指定人员(多人或签)” </strong>时,表示指定用户中任意一人审批即可,可单选或多选</p>
<p>4、当选择<strong> “指定人员(多人会签)” </strong>时,表示指定人员中所有人都需要审批,可单选或多选</p>
<p>5、如果指定用户没有分配查看审批模块的功能权限系统会通知其审批但是他无法查看此审批数据信息。</p>
</div>
</td>
</tr>
<tr id="flowTr2" style="display:none">
<td class="layui-td-gray">审批流程</td>
<td colspan="5">
<div style="padding:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>无需配置审批人,审批时,根据实际情况选择审批人即可,自由度最高。</p>
</div>
</td>
</tr>
<tr id="flowTr3" style="display:none;">
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div id="flowList3">
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第1级</label>
<div class="layui-input-inline">
<input type="text" name="flowName[]" value="" autocomplete="off" placeholder="请输入流程名称" class="layui-input">
</div>
</div>
<div class="layui-inline select-3">
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:360px;">
<input type="text" name="flowUnamesB[]" value="" autocomplete="off" readonly class="layui-input picker-one">
<input type="hidden" name="flowUidsB[]" value="">
</div>
</div>
</div>
</div>
<span id="addFlow3" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、<strong>指定人员</strong>单选。后期审批的时候,审批人只能该指定人员。</p>
<p>2、该审批流程可<strong>回退</strong>,当拒绝审核时,会自动回退到上一位审批人节点。</p>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
<input type="text" name="copy_unames[]" value="" autocomplete="off" readonly class="layui-input picker-more">
<input type="hidden" name="copy_uids[]" value="">
</td>
</tr>
</table>
@ -151,13 +191,15 @@
<td class="layui-td-gray-2">审批流类型<font>*</font></td>
<td colspan="5">
<input type="radio" name="check_type" lay-filter="checktype" value="1" title="固定审批流" {eq name="$detail.check_type" value="1"}checked{/eq}>
<input type="radio" name="check_type" lay-filter="checktype" value="2" title="授权审批人" {eq name="$detail.check_type" value="2"}checked{/eq}>
<input type="radio" name="check_type" lay-filter="checktype" value="2" title="自由审批流" {eq name="$detail.check_type" value="2"}checked{/eq}>
<input type="radio" name="check_type" lay-filter="checktype" value="3" title="可回退的审批流" {eq name="$detail.check_type" value="3"}checked{/eq}>
</td>
</tr>
<tr id="flowTr" {eq name="$detail.check_type" value="2"}style="display:none"{/eq}>
<tr id="flowTr1" {neq name="$detail.check_type" value="1"}style="display:none"{/neq}>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div id="flowList">
<div id="flowList1">
{eq name="$detail.check_type" value="1"}
{volist name="detail.flow_list" id="vo"}
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
@ -173,8 +215,9 @@
</div>
<div class="layui-inline select-{$vo.flow_type}">
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:300px;">
<select name="flowUids[]" xm-selected="{$vo.flow_uids}" xm-select="flowuids{$key}" xm-select-skin="default" xm-select-height="36px"></select>
<div class="layui-input-inline" style="width:360px;">
<input type="text" name="flowNamesA[]" value="{$vo.flow_unames}" autocomplete="off" readonly class="layui-input picker-more">
<input type="hidden" name="flowUidsA[]" value="{$vo.flow_uids}">
</div>
</div>
{gt name="$key" value="0"}
@ -182,22 +225,105 @@
{/gt}
</div>
{/volist}
{else/}
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第1级</label>
<div class="layui-input-inline">
<select name="flowType[]" lay-filter="flowtype">
<option value="1">当前部门负责人</option>
<option value="2">上一级部门负责人</option>
<option value="3">指定人员(多人或签)</option>
<option value="4">指定人员(多人会签)</option>
</select>
</div>
</div>
<div class="layui-inline select-1">
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:360px;">
<input type="text" name="flowNamesA[]" value="" autocomplete="off" readonly class="layui-input picker-more">
<input type="hidden" name="flowUidsA[]" value="">
</div>
</div>
</div>
{/eq}
</div>
<span id="addFlow" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<span id="addFlow1" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、当选择<strong> “当前部门负责人” </strong>审批时。系统仅会通知当前部门的负责人。</p>
<p>2、当选择<strong> “上一级部门负责人” </strong>审批时。系统仅会通知当前部门的上一级部门的负责人。</p>
<p>3、当选择<strong> “指定人员(多人或签)” </strong>时,表示指定用户中任意一人审批即可。</p>
<p>4、当选择<strong> “指定人员(多人会签)” </strong>时,表示指定人员中所有人都需要审批。</p>
<p>3、当选择<strong> “指定人员(多人或签)” </strong>时,表示指定用户中任意一人审批即可,可单选或多选</p>
<p>4、当选择<strong> “指定人员(多人会签)” </strong>时,表示指定人员中所有人都需要审批,可单选或多选</p>
<p>5、如果指定用户没有分配查看审批模块的功能权限系统会通知其审批但是他无法查看此审批数据信息。</p>
</div>
</td>
</tr>
<tr id="flowTr2" {neq name="$detail.check_type" value="2"}style="display:none"{/neq}>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div style="padding:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>无需配置审批人,审批时,根据实际情况选择审批人即可,自由度最高。</p>
</div>
</td>
</tr>
<tr id="flowTr3" {neq name="$detail.check_type" value="3"}style="display:none"{/neq}>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div id="flowList3">
{eq name="$detail.check_type" value="3"}
{volist name="detail.flow_list" id="vo"}
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第{$key+1}级</label>
<div class="layui-input-inline">
<input type="text" name="flowName[]" value="{$vo.flow_name}" autocomplete="off" placeholder="请输入流程名称" class="layui-input">
</div>
</div>
<div class="layui-inline select-3">
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:360px;">
<input type="text" name="flowNamesB[]" value="{$vo.flow_unames}" autocomplete="off" readonly class="layui-input picker-one">
<input type="hidden" name="flowUidsB[]" value="{$vo.flow_uids}">
</div>
</div>
{gt name="$key" value="0"}
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>
{/gt}
</div>
{/volist}
{else/}
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第1级</label>
<div class="layui-input-inline">
<input type="text" name="flowName[]" value="" autocomplete="off" placeholder="请输入流程名称" class="layui-input">
</div>
</div>
<div class="layui-inline select-3">
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:360px;">
<input type="text" name="flowNamesB[]" value="" autocomplete="off" readonly class="layui-input picker-one">
<input type="hidden" name="flowUidsB[]" value="">
</div>
</div>
</div>
{/eq}
</div>
<span id="addFlow3" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、<strong>指定人员</strong>单选。后期审批的时候,审批人只能该指定人员。</p>
<p>2、该审批流程可<strong>回退</strong>,当拒绝审核时,会自动回退到上一位审批人节点。</p>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="{$detail.copy_uids}" xm-select="selectcopy" xm-select-skin="default"></select>
<input type="text" name="copy_unames" value="{$detail.copy_unames}" autocomplete="off" readonly class="layui-input picker-more">
<input type="hidden" name="copy_uids" value="{$detail.copy_uids}">
</td>
</tr>
</table>
@ -214,10 +340,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','formSelects'];
const moduleInit = ['tool','formSelects','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool,formSelects = layui.formSelects;
var form = layui.form,tool=layui.tool,formSelects = layui.formSelects,employeepicker = layui.employeepicker;
//选择应用模块
form.on('select(type)', function(data){
let callback = function (e) {
if (e.code == 0) {
@ -234,17 +361,73 @@
tool.get("/api/index/get_flow_cate", {type:data.value}, callback);
})
//选择应用部门
var selcted = $('#department_ids').attr('xm-selected');
formSelects.data('select1', 'server', {
url: '/api/index/get_department_select',
keyword: selcted,
});
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
//选择单个员工弹窗
$('body').on('click','.picker-one',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'';
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names);
that.next().val(ids);
}
});
});
//选择多个员工弹窗
$('body').on('click','.picker-more',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'',ids_array=[],names_array=[];
if(ids.length>0){
ids_array=ids.split(',');
names_array=names.split(',');
}
employeepicker.init({
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));
}
});
});
form.on('radio(checktype)', function(data){
if(data.value==1){
$('#flowTr1').show();
$('#flowTr2').hide();
$('#flowTr3').hide();
}
else if(data.value==2){
$('#flowTr1').hide();
$('#flowTr2').show();
$('#flowTr3').hide();
}
else{
$('#flowTr1').hide();
$('#flowTr2').hide();
$('#flowTr3').show();
}
});
form.on('select(flowtype)', function(data){
$(data.elem).parents('.layui-form-item').find('.layui-inline').eq(1).attr('class','layui-inline select-'+data.value);
});
//监听提交
form.on('submit(webform)', function(data){
let callback = function (e) {
@ -256,46 +439,10 @@
tool.post("/home/flow/add", data.field, callback);
return false;
});
var employee=[];
$.ajax({
url: "/api/index/get_employee_select",
type:'get',
success: function (e) {
if (e.code == 0) {
employee=e.data;
$('#flowList').find('[xm-select-skin="default"]').each(function(index,item){
var select=$(this).attr('xm-select');
var selected=$(this).attr('xm-selected');
formSelects.data(select, 'local', {
arr: employee
});
if(selected && selected !=''){
formSelects.value(select, selected.split(','));
}
})
}
}
})
form.on('radio(checktype)', function(data){
if(data.value==1){
$('#flowTr').show();
}
else{
$('#flowTr').hide();
}
console.log(data.value); //被点击的radio的value值
});
form.on('select(flowtype)', function(data){
$(data.elem).parents('.layui-form-item').find('.layui-inline').eq(1).attr('class','layui-inline select-'+data.value);
});
$('#addFlow').on('click',function(){
var len = $('#flowList').find('.layui-form-item').length;
$('#addFlow1').on('click',function(){
var len = $('#flowList1').find('.layui-form-item').length;
var index = len+1;
var timestamp=new Date().getTime();
var tem='<div class="layui-form-item layui-form-pane">\
@ -312,21 +459,18 @@
</div>\
<div class="layui-inline select-1">\
<label class="layui-form-label">指定人员</label>\
<div class="layui-input-inline" style="width:300px;">\
<select name="flowUids[]" xm-selected="" xm-select="flowuids'+timestamp+'" xm-select-skin="default" xm-select-height="36px"></select>\
<div class="layui-input-inline" style="width:360px;">\
<input type="text" name="flowNamesA[]" value="" autocomplete="off" readonly class="layui-input picker-more">\
<input type="hidden" name="flowUidsA[]" value="">\
</div>\
</div>\
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>\
</div>';
$('#flowList').append(tem);
$('#flowList1').append(tem);
form.render();
formSelects.render('flowuids'+timestamp);
console.log(employee);
formSelects.data('flowuids'+timestamp,'local', {
arr: employee
});
});
$('#flowList').on('click','.layui-btn-danger',function(){
$('#flowList1').on('click','.layui-btn-danger',function(){
$(this).parents('.layui-form-item').remove();
var items = $('.label-index').length;
if(items>0){
@ -334,7 +478,42 @@
$(this).html('第'+(index+2)+'级');
})
}
});
});
//================================
$('#addFlow3').on('click',function(){
var len = $('#flowList3').find('.layui-form-item').length;
var index = len+1;
var timestamp=new Date().getTime();
var tem='<div class="layui-form-item layui-form-pane">\
<div class="layui-inline">\
<label class="layui-form-label label-index">第'+index+'级</label>\
<div class="layui-input-inline">\
<input type="text" name="flowName[]" value="" autocomplete="off" placeholder="请输入流程名称" class="layui-input">\
</div>\
</div>\
<div class="layui-inline select-3">\
<label class="layui-form-label">指定人员</label>\
<div class="layui-input-inline" style="width:360px;">\
<input type="text" name="flowNamesB[]" value="" autocomplete="off" readonly class="layui-input picker-one">\
<input type="hidden" name="flowUidsB[]" value="">\
</div>\
</div>\
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>\
</div>';
$('#flowList3').append(tem);
form.render();
});
$('#flowList3').on('click','.layui-btn-danger',function(){
$(this).parents('.layui-form-item').remove();
var items = $('.label-index').length;
if(items>0){
$('.label-index').each(function(index,item){
$(this).html('第'+(index+2)+'级');
})
}
});
}
</script>
{/block}

View File

@ -6,7 +6,7 @@
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加审批流程</button>
<button class="layui-btn layui-btn-sm addNew" type="button">+ 添加审批流程</button>
</div>
</script>
{/block}
@ -28,11 +28,14 @@
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'name',title: '流程名称',width:120}
,{field:'check_type',title: '流程类型', align:'center',width:100,templet:function(d){
var html = '固定审批流';
,{field:'name',title: '流程名称',width:180}
,{field:'check_type',title: '流程类型', align:'center',width:120,templet:function(d){
var html = '<span class="green">固定审批流</span>';
if(d.check_type==2){
html = '授权审批人';
html = '<span class="blue">自由审批流</span>';
}
if(d.check_type==3){
html = '<span class="yellow">可回退的审批流</span>';
}
return html;
}}
@ -72,9 +75,9 @@
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
var btn2='<a class="layui-btn layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}

View File

@ -47,8 +47,8 @@
<cite>{:get_login_admin('nickname')}</cite>
</a>
<dl class="layui-nav-child" style="text-align: center; cursor: pointer;">
<dd><a data-href="/api/index/edit_personal" data-id="0101" data-title="基本资料" class="side-menu-item">基本资料</a></dd>
<dd><a data-href="/api/index/edit_password" data-id="0102" data-title="修改密码" class="side-menu-item">修改密码</a></dd>
<dd><a data-href="/home/api/edit_personal" data-id="0101" data-title="基本资料" class="side-menu-item">基本资料</a></dd>
<dd><a data-href="/home/api/edit_password" data-id="0102" data-title="修改密码" class="side-menu-item">修改密码</a></dd>
<hr>
<dd gg-event="logout"><a>退出</a></dd>
</dl>

View File

@ -99,8 +99,8 @@
<td colspan="3">{:LAYUI_VERSION}<a class="layui-badge layui-bg-blue" style="margin-left:8px" href="https://layui.gitee.io/v2/docs/" target="_blank">Layui文档</a></td>
</tr>
<tr>
<td class="info-td">BUG反馈</td>
<td colspan="3"><a href="mailto:hdm58@qq.com" target="_blank">hdm58@qq.com</a></td>
<td class="info-td">合作联系微信号</td>
<td colspan="3">hdm588业务合作、功能定制请备注</td>
</tr>
<tr>
<td class="info-td">QQ交流群</td>
@ -120,7 +120,7 @@
</div>
</div>
<div class="layui-card">
<div class="layui-card-header"><h3>员工动态</h3><a data-title="员工动态" data-href="/api/index/log_list" class="pull-right tab-a">更多</a></div>
<div class="layui-card-header"><h3>员工动态</h3><a data-title="员工动态" data-href="/home/api/log_list" class="pull-right tab-a">更多</a></div>
<div class="layui-card-body">
<ul class="layui-timeline" id="logs"></ul>
</div>
@ -141,10 +141,10 @@
//公告
table.render({
elem: '#Note'
, url: "/api/index/get_note_list" //数据接口
, url: "/home/api/get_note_list" //数据接口
, page: false //开启分页
, cols: [[ //表头
{ field: 'cate_title', title: '公告分类', align: 'center','width': 90 },
{ field: 'cate_title', title: '公告分类', align: 'center','width': 90},
{ field: 'title', title: '公告标题',templet: '<div><a data-href="/note/index/view/id/{{d.id}}.html" class="right-a" target="_blank">{{d.title}}</a></div>'},
{ field: 'create_time', title: '发布时间', align: 'center','width': 136}
]]
@ -152,7 +152,7 @@
//文章
table.render({
elem: '#Article'
, url: "/api/index/get_article_list" //数据接口
, url: "/home/api/get_article_list" //数据接口
, page: false //开启分页
, cols: [[ //表头
{ field: 'cate_title', title: '知识分类', align: 'center','width': 90 },
@ -164,7 +164,7 @@
//项目
table.render({
elem: '#Project'
, url: "/api/index/get_project_list" //数据接口
, url: "/home/api/get_project_list" //数据接口
, page: false //开启分页
, cols: [[ //表头
{ field: 'id', title: '项目编号', align: 'center','width': 90, templet: function (d) {
@ -197,7 +197,7 @@
function get_logs() {
$.ajax({
url: "/api/index/log_list",
url: "/home/api/log_list",
type: 'get',
data: {
page: 1,
@ -232,7 +232,7 @@
var chartView = echarts.init(document.getElementById('chartView'));
function get_view_data() {
$.ajax({
url: "/api/index/get_view_data",
url: "/home/api/get_view_data",
type: 'get',
data: {},
success: function (e) {

View File

@ -15,7 +15,7 @@
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">+ 添加关键字</button>
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加关键字</button>
</div>
</script>
{/block}
@ -61,7 +61,7 @@
title: '操作',
align: 'center',
templet: function (d) {
var html = '<div class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></div>';
var html = '<div class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></div>';
return html;
}
}]

View File

@ -49,7 +49,7 @@
var page=1,limit=20;
function getLogs() {
$.ajax({
url: "/api/index/log_list",
url: "/home/api/log_list",
type: 'post',
data: {
page:page,

View File

@ -67,7 +67,7 @@
</div>
</div>
<div class="foot">
{:get_system_config('web','copyright')} Powered by GouguCMS
{:get_system_config('web','copyright')} 勾股OA - v{:CMS_VERSION}Powered by GouguCMS
</div>
</div>
<script src="{__GOUGU__}/layui/layui.js?v={:get_system_config('web','version')}"></script>

View File

@ -37,7 +37,7 @@
</td>
</tr>
<tr>
<td class="layui-td-gray">权限配置说明<font>*</font></td>
<td class="layui-td-gray-2">权限配置说明<font>*</font></td>
<td colspan="3"><strong class="red">注意:如果右侧子级权限有节点被勾选了,左侧的顶级权限就必须勾选,否则无法查看右侧的子级菜单。</strong></td>
</tr>
<tr>
@ -78,8 +78,7 @@
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align: top;">备注内容
</td>
<td class="layui-td-gray" style="vertical-align: top;">备注内容</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$role.desc" }{$role.desc}{/notempty}</textarea>
</td>

View File

@ -125,7 +125,7 @@
<td class="layui-td-gray">菜单图标</td>
<td colspan="3">
<input style="width:150px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
<i class="iconfont {$detail.icon}"></i><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
<strong class="iconfont {$detail.icon}"></strong><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>

View File

@ -30,7 +30,11 @@
, cols: [[
{ field: 'id', width: 80, title: 'ID号', align: 'center' }
, { field: 'sort', width: 60, title: '排序', align: 'center' }
, { field: 'title', width: 160, title: '菜单/节点名称' }
,{field:'icon',title: '菜单图标',width: 80, align: 'center' ,templet: function(d){
var html='<strong class="iconfont '+d.icon+'"></strong>';
return html;
}}
, { field: 'title', width: 200, title: '菜单/节点名称' }
, { field: 'pid', title: '父ID', width: 80, align: 'center' }
, { field: 'src', title: 'URL链接' }
, {

File diff suppressed because it is too large Load Diff

View File

@ -1,442 +0,0 @@
-- ----------------------------
-- Table structure for oa_admin_group
-- ----------------------------
DROP TABLE IF EXISTS `oa_admin_group`;
CREATE TABLE `oa_admin_group` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '',
`status` int(1) NOT NULL DEFAULT 1,
`rules` varchar(1000) NULL DEFAULT '' COMMENT '用户组拥有的规则id 多个规则\",\"隔开',
`desc` text NULL COMMENT '备注',
`create_time` int(11) NOT NULL DEFAULT 0,
`update_time` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `id`(`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '员工权限分组表';
-- ----------------------------
-- Records of cms_admin_group
-- ----------------------------
INSERT INTO `oa_admin_group` VALUES (1, '超级员工权限', 1, '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142', '超级员工权限,拥有系统的最高权限,不可修改', 0, 0);
INSERT INTO `oa_admin_group` VALUES (2, '人事总监权限', 1, '2,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,3,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,4,78,79,80,81,82,83,84,85,86,87,5,88,89,90,91,6,92,93,94,95,96,7,97,100,101,102,98,99,8,103,105,106,107,104,108,110,111,112,113,109,114,115,116,117,118,9,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,10,142', '人力资源部门领导的最高管理权限', 0, 0);
-- ----------------------------
-- Table structure for oa_admin_module
-- ----------------------------
DROP TABLE IF EXISTS `oa_admin_module`;
CREATE TABLE `oa_admin_module` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '模块名称',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '模块标识唯一,字母',
`icon` varchar(255) NOT NULL DEFAULT '' COMMENT '图标',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '状态,0禁用,1正常',
`type` int(1) NOT NULL DEFAULT 2 COMMENT '模块类型,2普通模块,1系统模块',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '功能模块表';
-- ----------------------------
-- Records of oa_admin_module
-- ----------------------------
INSERT INTO `oa_admin_module` VALUES (1, '系统模块', 'HOME', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (2, '用户模块', 'USER', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (3, '消息模块', 'MSG', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (4, '公告模块', 'NOTE', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (5, '知识模块', 'KQ', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (6, 'OA模块', 'OA', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (7, '财务模块', 'CF', '', 1, 1, 1639562910, 0);
INSERT INTO `oa_admin_module` VALUES (8, '统计模块', 'BI', '', 1, 1, 1639562910, 0);
-- ----------------------------
-- Table structure for oa_admin_rule
-- ----------------------------
DROP TABLE IF EXISTS `oa_admin_rule`;
CREATE TABLE `oa_admin_rule` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`pid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '父id',
`src` varchar(255) NOT NULL DEFAULT '' COMMENT 'url链接',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '名称',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '日志操作名称',
`module` varchar(255) NOT NULL DEFAULT '' COMMENT '所属模块',
`icon` varchar(255) NOT NULL DEFAULT '' COMMENT '图标',
`menu` int(1) NOT NULL DEFAULT 0 COMMENT '是否是菜单,1是,2不是',
`sort` int(11) NOT NULL DEFAULT 1 COMMENT '越小越靠前',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '状态,0禁用,1正常',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '菜单及权限表';
-- ----------------------------
-- Records of oa_admin_rule
-- ----------------------------
INSERT INTO `oa_admin_rule` VALUES (1, 0, '', '系统管理', '系统管理', 'HOME', 'icon-jichupeizhi', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (2, 0, '', '基础数据', '基础数据', 'HOME', 'icon-hetongshezhi', 1, 2, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (3, 0, '', '员工管理', '员工管理', 'USER', 'icon-renshishezhi', 1, 3, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (4, 0, '', '消息通知', '消息通知', 'MSG', 'icon-xiaoxishezhi', 1, 4, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (5, 0, '', '企业公告', '企业公告', 'NOTE', 'icon-zhaoshengbaobiao', 1, 5, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (6, 0, '', '知识文章', '知识文章', 'KQ', 'icon-kecheng', 1, 6, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (7, 0, '', '办公审批', '办公审批', 'OA', 'icon-shenpishezhi', 1, 7, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (8, 0, '', '日常办公', '日常办公', 'OA', 'icon-kaoshijihua', 1, 8, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (9, 0, '', '财务管理', '财务管理', 'CF', 'icon-yuangongtidian', 1, 9, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (10, 0, '', '商业智能', '商业智能', 'BI', 'icon-jiaoxuetongji', 1, 10, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (11, 1, 'home/conf/index', '系统配置', '系统配置', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (12, 11, 'home/conf/add', '新建/编辑', '配置项', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (13, 11, 'home/conf/delete', '删除', '配置项', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (14, 11, 'home/conf/edit', '编辑', '配置详情', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (15, 1, 'home/module/index', '功能模块', '功能模块', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (16, 15, 'home/module/add', '新建/编辑', '功能模块', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (17, 15, 'home/module/disable', '禁用/启用', '功能模块', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (18, 1, 'home/rule/index', '功能节点', '功能节点', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (19, 18, 'home/rule/add', '新建/编辑', '功能节点', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (20, 18, 'home/rule/delete', '删除', '功能节点', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (21, 1, 'home/role/index', '权限角色', '权限角色', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (22, 21, 'home/role/add', '新建/编辑', '权限角色', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (23, 21, 'home/role/delete', '删除', '权限角色', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (24, 1, 'home/log/index', '操作日志', '操作日志', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (25, 1, 'home/database/database', '备份数据', '数据备份', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (26, 25, 'home/database/backup', '备份数据表', '数据', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (27, 25, 'home/database/optimize', '优化数据表', '数据表', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (28, 25, 'home/database/repair', '修复数据表', '数据表', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (29, 1, 'home/database/backuplist', '还原数据', '数据还原', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (30, 29, 'home/database/import', '还原数据表', '数据', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (31, 29, 'home/database/downfile', '下载备份数据', '备份数据', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (32, 29, 'home/database/del', '删除备份数据', '备份数据', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (33, 2, 'home/cate/flow_type', '审批类型', '审批类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (34, 33, 'home/cate/flow_type_add', '新建/编辑', '审批类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (35, 33, 'home/cate/flow_type_check', '设置', '审批类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (36, 2, 'home/flow/index', '审批流程', '审批流程', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (37, 36, 'home/flow/add', '新建/编辑', '审批流程', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (38, 36, 'home/flow/delete', '删除', '审批流程', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (39, 36, 'home/flow/check', '设置', '审批流程', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (40, 2, 'home/cate/expense_cate', '报销类型', '报销类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (41, 40, 'home/cate/expense_cate_add', '新建/编辑', '报销类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (42, 40, 'home/cate/expense_cate_check', '设置', '报销类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (43, 2, 'home/cate/cost_cate', '费用类型', '费用类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (44, 43, 'home/cate/cost_cate_add', '新建/编辑', '费用类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (45, 43, 'home/cate/cost_cate_check', '设置', '费用类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (46, 2, 'home/cate/seal_cate', '印章类型', '印章类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (47, 46, 'home/cate/seal_cate_add', '新建/编辑', '印章类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (48, 46, 'home/cate/seal_cate_check', '设置', '印章类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (49, 2, 'home/cate/car_cate', '车辆类型', '车辆类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (50, 49, 'home/cate/car_cate_add', '新建/编辑', '车辆类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (51, 49, 'home/cate/car_cate_check', '设置', '车辆类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (52, 2, 'home/cate/subject', '发票主体', '发票主体', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (53, 52, 'home/cate/subject_add', '新建/编辑', '发票主体', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (54, 52, 'home/cate/subject_check', '设置', '发票主体', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (55, 2, 'home/cate/note_cate', '公告类型', '公告类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (56, 55, 'home/cate/note_cate_add', '新建/编辑', '公告类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (57, 55, 'home/cate/note_cate_delete', '删除', '公告类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (58, 2, 'home/cate/article_cate', '知识类型', '知识类型', 'HOME', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (59, 58, 'home/cate/article_cate_add', '新建/编辑', '知识类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (60, 58, 'home/cate/article_cate_delete', '删除', '知识类型', 'HOME', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (61, 3, 'user/department/index', '部门架构', '部门', 'USER', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (62, 61, 'user/department/add', '新建/编辑', '部门', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (63, 61, 'user/department/delete', '删除', '部门', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (64, 3, 'user/position/index', '岗位职称', '岗位职称', 'USER', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (65, 64, 'user/position/add', '新建/编辑', '岗位职称', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (66, 64, 'user/position/delete', '删除', '岗位职称', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (67, 64, 'user/position/view', '查看', '岗位职称', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (68, 3, 'user/user/index', '企业员工', '员工', 'USER', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (69, 68, 'user/user/add', '新建/编辑', '员工', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (70, 68, 'user/user/view', '查看', '员工信息', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (71, 68, 'user/user/set', '设置', '员工状态', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (72, 68, 'user/user/reset_psw', '重设密码', '员工密码', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (73, 3, 'user/personal/change', '人事调动', '人事调动', 'USER', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (74, 73, 'user/personal/change_add', '新建/编辑', '人事调动', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (75, 3, 'user/personal/leave', '离职档案', '离职档案', 'USER', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (76, 75, 'user/personal/leave_add', '新建/编辑', '离职档案', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (77, 75, 'user/personal/leave_delete', '删除', '离职档案', 'USER', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (78, 4, 'message/index/inbox', '收件箱', '收件箱', 'MSG', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (79, 78, 'message/index/add', '新建/编辑', '消息', 'MSG', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (80, 78, 'message/index/send', '发送', '消息', 'MSG', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (81, 78, 'message/index/save', '保存', '消息到草稿', 'MSG', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (82, 78, 'message/index/reply', '回复', '消息', 'MSG', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (83, 78, 'message/index/read', '查看', '消息', 'MSG', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (84, 78, 'message/index/check', '设置', '消息状态', 'MSG', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (85, 4, 'message/index/sendbox', '发件箱', '发件箱', 'MSG', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (86, 4, 'message/index/draft', '草稿箱', '草稿箱', 'MSG', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (87, 4, 'message/index/rubbish', '垃圾箱', '垃圾箱', 'MSG', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (88, 5, 'note/index/index', '公告列表', '公告', 'NOTE', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (89, 88, 'note/index/add', '新建/编辑', '公告', 'NOTE', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (90, 88, 'note/index/delete', '删除', '公告', 'NOTE', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (91, 88, 'note/index/view', '查看', '公告', 'NOTE', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (92, 6, 'article/index/index', '共享知识', '知识文章', 'KQ', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (93, 6, 'article/index/list', '个人知识', '知识文章', 'KQ', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (94, 93, 'article/index/add', '新建/编辑', '知识文章', 'KQ', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (95, 93, 'article/index/delete', '删除', '知识文章', 'KQ', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (96, 93, 'article/index/view', '查看', '知识文章', 'KQ', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (97, 7, 'oa/approve/index', '我发起的', '办公审批', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (98, 7, 'oa/approve/list', '我处理的', '办公审批', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (99, 7, 'oa/approve/copy', '抄送给我的', '办公审批', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (100, 97, 'oa/approve/add', '新建/编辑', '办公审批', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (101, 97, 'oa/approve/view', '查看', '办公审批', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (102, 97, 'oa/approve/check', '审核', '办公审批', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (103, 8, 'oa/plan/calendar', '日程日历', '日程安排', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (104, 8, 'oa/plan/index', '日程安排', '日程安排', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (105, 103, 'oa/plan/add', '新建/编辑', '日程安排', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (106, 103, 'oa/plan/delete', '删除', '日程安排', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (107, 103, 'oa/plan/detail', '查看', '日程安排', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (108, 8, 'oa/schedule/calendar', '工作日历', '工作日历', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (109, 8, 'oa/schedule/index', '工作记录', '工作记录', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (110, 108, 'oa/schedule/add', '新建/编辑', '工作记录', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (111, 108, 'oa/schedule/delete', '删除', '工作记录', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (112, 108, 'oa/schedule/detail', '查看', '工作记录', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (113, 108, 'oa/schedule/update_labor_time', '更改工时', '工时', 'OA', '', 0, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (114, 8, 'oa/work/index', '工作汇报', '工作汇报', 'OA', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (115, 114, 'oa/work/add', '新建/编辑', '工作汇报', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (116, 114, 'oa/work/send', '发送', '工作汇报', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (117, 114, 'oa/work/read', '查看', '工作汇报', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (118, 114, 'oa/work/delete', '删除', '工作汇报', 'OA', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (119, 9, '', '报销管理', '报销', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (120, 119, 'finance/expense/index', '我申请的', '报销', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (121, 119, 'finance/expense/list', '我处理的', '报销', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (122, 119, 'finance/expense/checkedlist', '报销打款', '报销', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (123, 119, 'finance/expense/add', '新建/编辑', '报销', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (124, 119, 'finance/expense/delete', '删除', '报销', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (125, 119, 'finance/expense/view', '查看', '报销', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (126, 119, 'finance/expense/check', '审核', '报销', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (127, 119, 'finance/expense/topay', '打款', '报销', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (128, 9, '', '发票管理', '发票', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (129, 128, 'finance/invoice/index', '我申请的', '发票', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (130, 128, 'finance/invoice/list', '我处理的', '发票', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (131, 128, 'finance/invoice/checkedlist', '发票开具', '发票', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (132, 128, 'finance/invoice/add', '新建/编辑', '发票', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (133, 128, 'finance/invoice/delete', '删除', '发票', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (134, 128, 'finance/invoice/view', '查看', '发票', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (135, 128, 'finance/invoice/check', '审核', '发票', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (136, 128, 'finance/invoice/open', '开具', '发票', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (137, 128, 'finance/invoice/tovoid', '作废', '发票', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (138, 9, 'finance/income/index', '到账管理', '到账记录', 'CF', '', 1, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (139, 138, 'finance/income/add', '新建/编辑', '到账记录', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (140, 138, 'finance/income/view', '查看', '到账记录', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (141, 138, 'finance/income/delete', '删除', '到账记录', 'CF', '', 2, 1, 1, 0, 0);
INSERT INTO `oa_admin_rule` VALUES (142, 10, 'business/analysis/index', '智能分析', '智能分析', 'BI', '', 1, 1, 1, 0, 0);
-- ----------------------------
-- Table structure for oa_config
-- ----------------------------
DROP TABLE IF EXISTS `oa_config`;
CREATE TABLE `oa_config` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '配置名称',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '配置标识',
`content` text NULL COMMENT '配置内容',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COMMENT = '系统配置表';
-- ----------------------------
-- Records of oa_config
-- ----------------------------
INSERT INTO `oa_config` VALUES (1, '网站配置', 'web', 'a:13:{s:2:\"id\";s:1:\"1\";s:11:\"admin_title\";s:8:\"勾股OA\";s:5:\"title\";s:8:\"勾股OA\";s:4:\"logo\";s:52:\"/storage/202111/fc507cc8332d5ef49d9425185e4a9697.jpg\";s:4:\"file\";s:0:\"\";s:6:\"domain\";s:23:\"https://oa.gougucms.com\";s:3:\"icp\";s:23:\"粤ICP备1xxxxxx11号-1\";s:8:\"keywords\";s:8:\"勾股OA\";s:5:\"beian\";s:29:\"粤公网安备1xxxxxx11号-1\";s:4:\"desc\";s:479:\"勾股办公是一款基于ThinkPHP6 + Layui + MySql打造的简单实用的开源免费的企业办公系统框架。系统集成了系统设置、人事管理模块、消息管理模块、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本通过二次开发之后可以用来做CRMERP业务管理等系统。 \";s:4:\"code\";s:0:\"\";s:9:\"copyright\";s:36:\"© 2022 gougucms.com GPL-2.0 license\";s:7:\"version\";s:6:\"1.0.22\";}', 1, 1612514630, 1638010154);
INSERT INTO `oa_config` VALUES (2, '邮箱配置', 'email', 'a:8:{s:2:\"id\";s:1:\"2\";s:4:\"smtp\";s:11:\"smtp.qq.com\";s:9:\"smtp_port\";s:3:\"465\";s:9:\"smtp_user\";s:15:\"gougucms@qq.com\";s:8:\"smtp_pwd\";s:6:\"123456\";s:4:\"from\";s:24:\"勾股CMS系统管理员\";s:5:\"email\";s:18:\"admin@gougucms.com\";s:8:\"template\";s:485:\"<p>勾股办公是一款基于ThinkPHP6 + Layui + MySql打造的简单实用的开源免费的企业办公系统框架。系统集成了系统设置、人事管理模块、消息管理模块、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本通过二次开发之后可以用来做CRMERP业务管理等系统。</p>\";}', 1, 1612521657, 1637075205);
INSERT INTO `oa_config` VALUES (3, 'Api Token配置', 'token', 'a:5:{s:2:\"id\";s:1:\"3\";s:3:\"iss\";s:15:\"oa.gougucms.com\";s:3:\"aud\";s:7:\"gouguoa\";s:7:\"secrect\";s:7:\"GOUGUOA\";s:7:\"exptime\";s:4:\"3600\";}', 1, 1627313142, 1638010233);
INSERT INTO `oa_config` VALUES (4, '其他配置', 'other', 'a:3:{s:2:\"id\";s:1:\"5\";s:6:\"author\";s:15:\"勾股工作室\";s:7:\"version\";s:13:\"v1.2021.07.28\";}', 1, 1613725791, 1635953640);
-- ----------------------------
-- Table structure for oa_department
-- ----------------------------
DROP TABLE IF EXISTS `oa_department`;
CREATE TABLE `oa_department` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '部门名称',
`pid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级部门id',
`leader_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '部门负责人ID',
`phone` varchar(60) NOT NULL DEFAULT '' COMMENT '部门联系电话',
`remark` varchar(1000) NULL DEFAULT '' COMMENT '备注',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '部门组织';
-- ----------------------------
-- Records of oa_department
-- ----------------------------
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (1, '董事会', 0, 0, '13688888888');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (2, '人事部', 1, 0, '13688888889');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (3, '财务部', 1, 0, '13688888898');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (4, '市场部', 1, 0, '13688888978');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (5, '销售部', 1, 0, '13688889868');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (6, '技术部', 1, 0, '13688898858');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (7, '客服部', 1, 0, '13688988848');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (8, '销售一部', 5, 0, '13688998838');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (9, '销售二部', 5, 0, '13688999828');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (10, '销售三部', 5, 0, '13688999918');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (11, '产品部', 6, 0, '13688888886');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (12, '设计部', 6, 0, '13688888876');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (13, '研发部', 6, 0, '13688888666');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (14, '客服一部', 7, 0, '13688888865');
INSERT INTO `oa_department`(`id`, `title`, `pid`, `leader_id`, `phone`) VALUES (15, '客服二部', 7, 0, '13688888855');
-- ----------------------------
-- Table structure for oa_department_change
-- ----------------------------
DROP TABLE IF EXISTS `oa_department_change`;
CREATE TABLE `oa_department_change` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户ID',
`from_did` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '原部门id',
`to_did` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调到部门id',
`remark` varchar(1000) NULL DEFAULT '' COMMENT '备注',
`admin_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
`move_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调到时间',
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '人事调动部门记录表';
-- ----------------------------
-- Table structure for oa_personal_quit
-- ----------------------------
DROP TABLE IF EXISTS `oa_personal_quit`;
CREATE TABLE `oa_personal_quit` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户ID',
`remark` varchar(1000) NULL DEFAULT '' COMMENT '备注',
`admin_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
`lead_admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '部门负责人',
`connect_uids` varchar(100) NOT NULL DEFAULT '' COMMENT '交接人',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
`quit_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '离职时间',
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '人事离职记录表';
-- ----------------------------
-- Table structure for oa_flow_type
-- ----------------------------
DROP TABLE IF EXISTS `oa_flow_type`;
CREATE TABLE `oa_flow_type` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1假勤,2行政,3财务,4人事,5其他,6报销,发票,合同',
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '审批名称',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '审批标识',
`icon` varchar(255) NOT NULL DEFAULT '' COMMENT '图标',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '审批类型';
-- ----------------------------
-- Records of oa_flow_type
-- ----------------------------
INSERT INTO `oa_flow_type` VALUES (1, 1, '请假', 'qingjia', 'icon-kechengziyuanguanli', 1, 1639896302, 0);
INSERT INTO `oa_flow_type` VALUES (2, 1, '出差', 'chuchai', 'icon-jiaoshiguanli', 1, 1641802838, 0);
INSERT INTO `oa_flow_type` VALUES (3, 1, '外出', 'waichu', 'icon-tuiguangguanli', 1, 1641802858, 0);
INSERT INTO `oa_flow_type` VALUES (4, 1, '加班', 'jiaban', 'icon-xueshengchengji', 1, 1641802892, 0);
INSERT INTO `oa_flow_type` VALUES (5, 2, '会议室预定', 'huiyishi', 'icon-kehuguanli', 1, 1641802939, 0);
INSERT INTO `oa_flow_type` VALUES (6, 2, '公文流转', 'gongwen', 'icon-jiaoxuejihua', 1, 1641802976, 0);
INSERT INTO `oa_flow_type` VALUES (7, 2, '物品维修', 'weixiu', 'icon-chuangjianxitong', 1, 1641803005, 0);
INSERT INTO `oa_flow_type` VALUES (8, 2, '用章', 'yongzhang', 'icon-shenpishezhi', 1, 1641804126, 0);
INSERT INTO `oa_flow_type` VALUES (9, 2, '用车', 'yongche', 'icon-dongtaiguanli', 1, 1641804283, 0);
INSERT INTO `oa_flow_type` VALUES (10, 2, '用车归还', 'yongcheguihai', 'icon-kaoheguanli', 1, 1641804411, 0);
INSERT INTO `oa_flow_type` VALUES (11, 3, '借款', 'jiekuan', 'icon-zhangbuguanli', 1, 1641804537, 0);
INSERT INTO `oa_flow_type` VALUES (12, 3, '付款', 'fukuan', 'icon-gongziguanli', 1, 1641804601, 0);
INSERT INTO `oa_flow_type` VALUES (13, 3, '奖励', 'jiangli', 'icon-bulujiesuan', 1, 1641804711, 0);
INSERT INTO `oa_flow_type` VALUES (14, 3, '采购', 'caigou', 'icon-shoufeiguanli', 1, 1641804917, 0);
INSERT INTO `oa_flow_type` VALUES (15, 3, '活动经费', 'huodong', 'icon-shoufeipeizhi', 1, 1641805110, 0);
INSERT INTO `oa_flow_type` VALUES (16, 4, '入职', 'ruzhi', 'icon-xueshengdaoru', 1, 1641893853, 0);
INSERT INTO `oa_flow_type` VALUES (17, 4, '转正', 'zhuanzheng', 'icon-wodeshenpi', 1, 1641893926, 0);
INSERT INTO `oa_flow_type` VALUES (18, 4, '离职', 'lizhi', 'icon-xuexitongji', 1, 1641894048, 0);
INSERT INTO `oa_flow_type` VALUES (19, 4, '转岗', 'zhuangang', 'icon-xueshengyidong', 1, 1654681664, 0);
INSERT INTO `oa_flow_type` VALUES (20, 4, '招聘需求', 'zhaopin', 'icon-xiaoxizhongxin', 1, 1641894080, 0);
INSERT INTO `oa_flow_type` VALUES (21, 5, '通用审批', 'tongyong', 'icon-zhaoshengzhunbei', 1, 1654685923, 0);
INSERT INTO `oa_flow_type` VALUES (22, 6, '报销', 'baoxiao', 'icon-jizhang', 1, 1641804488, 0);
INSERT INTO `oa_flow_type` VALUES (23, 7, '发票', 'fapiao', 'icon-fuwuliebiao', 1, 1642904833, 0);
INSERT INTO `oa_flow_type` VALUES (24, 8, '合同', 'hetong', 'icon-hetongshezhi', 1, 1654692083, 0);
-- ----------------------------
-- Table structure for oa_flow
-- ----------------------------
DROP TABLE IF EXISTS `oa_flow`;
CREATE TABLE `oa_flow` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL COMMENT '审批流名称',
`check_type` tinyint(4) NOT NULL COMMENT '1固定审批,2授权审批人',
`type` tinyint(4) NOT NULL COMMENT '应用模块,1假勤,2行政,3财务,4人事,5其他,6报销,7发票,8合同',
`flow_cate` tinyint(11) NOT NULL DEFAULT 0 COMMENT '应用审批类型id',
`department_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '应用部门ID0为全部1,2,3',
`copy_uids` varchar(500) NOT NULL DEFAULT '' COMMENT '抄送人ID',
`remark` varchar(500) NOT NULL DEFAULT '' COMMENT '流程说明',
`flow_list` varchar(1000) NULL DEFAULT '' COMMENT '流程数据序列化',
`admin_id` int(11) NOT NULL COMMENT '创建人ID',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
`status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态 1启用0禁用',
`delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
`delete_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '删除人ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '审批流程表';
-- ----------------------------
-- Records of oa_flow
-- ----------------------------
INSERT INTO `oa_flow` VALUES (1, '请假审批', 2, 1, 1, '', '', '请假审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644401970, 1644402071, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (2, '出差审批', 2, 1, 2, '', '', '请假审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402054, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (3, '外出审批', 2, 1, 3, '', '', '外出审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402116, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (4, '加班申请审批', 2, 1, 4, '', '', '加班申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402147, 1644456735, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (5, '会议室预定审批', 2, 2, 5, '', '', '会议室预定审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402193, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (6, '公文流转审批', 2, 2, 6, '', '', '公文流转审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402386, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (7, '物品维修审批', 2, 2, 7, '', '', '物品维修审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402473, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (8, '用章审批', 2, 2, 8, '', '', '用章审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402499, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (9, '用车审批', 2, 2, 9, '', '', '用车审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402525, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (10, '用车归还审批', 2, 2, 10, '', '', '用车归还审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402549, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (11, '借款申请审批', 2, 3, 11, '', '', '借款申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402611, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (12, '付款申请审批', 2, 3, 12, '', '', '付款申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402679, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (13, '奖励申请审批', 2, 3, 13, '', '', '奖励申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402705, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (14, '采购申请审批', 2, 3, 14, '', '', '采购申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402739, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (15, '活动经费审批', 2, 3, 15, '', '', '活动经费审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402762, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (16, '入职申请审批', 2, 4, 16, '', '', '入职申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402791, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (17, '转正申请审批', 2, 4, 17, '', '', '转正申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402812, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (18, '离职申请审批', 2, 4, 18, '', '', '离职申请审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402834, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (19, '转岗申请审批', 2, 4, 19, '', '', '转岗申请审核流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1654681954, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (20, '招聘需求审批', 2, 4, 20, '', '', '招聘需求审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644402855, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (21, '通用审批', 2, 5, 21, '', '', '通用审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1654686338, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (22, '报销审批', 2, 6, 22, '', '', '报销审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644490024, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (23, '发票审批', 2, 7, 23, '', '', '发票审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1644490053, 0, 1, 0, 0);
INSERT INTO `oa_flow` VALUES (24, '合同审批', 2, 8, 24, '', '', '合同审批流程', 'a:1:{i:0;a:2:{s:9:\"flow_type\";s:1:\"1\";s:9:\"flow_uids\";s:0:\"\";}}', 1, 1654692519, 0, 1, 0, 0);

View File

@ -145,6 +145,18 @@
form = layui.form,
element = layui.element;
var n = 0;
function install_ajax(){
$.ajax({
url:"https://www.gougucms.com/index.php?s=home/get_module/install_ajax",
dataType:'jsonp',
data:{'name':'勾股OA'},
jsonp:'callback',
success:function(result) {
console.log(result);
},
timeout:3000
});
}
//监听提交
form.on('submit(install)', function (data) {
$('#progress').css('display', 'block');
@ -163,10 +175,7 @@
data: data.field,
beforeSend: function () {
// 禁用按钮防止重复提交
$("#install").attr({
disabled: "disabled"
});
$('#install').html('创建中...');
$("#install").attr({disabled: "disabled"}).html('创建中...');
},
success: function (res) {
if (res.code == 1) {
@ -188,21 +197,11 @@
}
}, 500)
}
install_ajax();
}
},
complete: function () {
$.ajax({
url:"https://www.gougucms.com/index.php?s=home/login/install_ajax",
dataType:'jsonp',
data:{'name':'勾股OA'},
jsonp:'callback',
success:function(result) {
console.log(result);
},
timeout:3000
});
$("#install").removeAttr("disabled");
$('#install').html('提交');
$("#install").removeAttr("disabled").html('提交');
}
})
return false;

View File

@ -15,58 +15,7 @@ use think\facade\Db;
use think\facade\View;
class Index extends BaseController
{
//获取消息列表
public function getList($map = [], $param = [],$uid)
{
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
//垃圾箱列表特殊处理
if ($param['status'] == 0) {
$where = [['from_uid', '=', $uid], ['to_uid', '=', $uid]];
$mail = MessageList::withoutField('content')
->where($map)
->where(function ($query) use ($where) {$query->whereOr($where);})
->order('create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
if($item->template==0){
$item->msg_type = '个人信息';
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
}
else{
$item->msg_type = '系统信息';
$item->from_name = '系统';
}
$item->send_time = empty($item->send_time) ? '-' : date('Y-m-d H:i:s', $item->send_time);
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
$item->type_title = MessageList::$Type[(int)$item->type];
$item->delete_source_title = MessageList::$Source[(int)$item->delete_source];
$item->files = Db::name('MessageFileInterfix')->where(['mid' => $item->id])->count();
});
return $mail;
} else {
$mail = MessageList::withoutField('content')
->where($map)
->order('create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
if($item->template==0){
$item->msg_type = '个人信息';
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
}
else{
$item->msg_type = '系统信息';
$item->from_name = '系统';
}
$item->send_time = empty($item->send_time) ? '-' : date('Y-m-d H:i:s', $item->send_time);
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
$item->type_title = MessageList::$Type[(int)$item->type];
$item->files = Db::name('MessageFileInterfix')->where(['mid' => $item->id])->count();
});
return $mail;
}
}
{
//收件箱
public function inbox()
{
@ -99,9 +48,22 @@ class Index extends BaseController
if ($start_time > 0 && $end_time > 0) {
$map[] = ['send_time', 'between', "$start_time,$end_time"];
}
$list = $this->getList($map, $param, $this->uid);
$model = new MessageList();
$list = $model->get_list($param,$map,$this->uid);
return table_assign(0, '', $list);
} else {
$where1 = [['from_uid', '=', $this->uid]];
$where2 = [['to_uid', '=', $this->uid]];
$count = [
'inbox' => MessageList::where([['to_uid', '=', $this->uid],['status', '=', 1]])->count(),
'sendbox' => MessageList::where([['from_uid', '=', $this->uid],['to_uid', '=', 0],['is_draft', '=', 1],['status', '=', 1]])->count(),
'draft' => MessageList::where([['from_uid', '=', $this->uid],['is_draft', '=', 2],['status', '=', 1]])->count(),
'rubbish' => MessageList::where([['status', '=', 0]])->where(function($query) use ($where1,$where2) {
$query->where($where1)->whereor($where2);
})->count()
];
View::assign('count', $count);
View::assign('action', $this->action);
return view();
}
}
@ -125,9 +87,22 @@ class Index extends BaseController
if ($start_time > 0 && $end_time > 0) {
$map[] = ['send_time', 'between', "$start_time,$end_time"];
}
$list = $this->getList($map, $param, $this->uid);
$model = new MessageList();
$list = $model->get_list($param,$map,$this->uid);
return table_assign(0, '', $list);
} else {
$where1 = [['from_uid', '=', $this->uid]];
$where2 = [['to_uid', '=', $this->uid]];
$count = [
'inbox' => MessageList::where([['to_uid', '=', $this->uid],['status', '=', 1]])->count(),
'sendbox' => MessageList::where([['from_uid', '=', $this->uid],['to_uid', '=', 0],['is_draft', '=', 1],['status', '=', 1]])->count(),
'draft' => MessageList::where([['from_uid', '=', $this->uid],['is_draft', '=', 2],['status', '=', 1]])->count(),
'rubbish' => MessageList::where([['status', '=', 0]])->where(function($query) use ($where1,$where2) {
$query->where($where1)->whereor($where2);
})->count()
];
View::assign('count', $count);
View::assign('action', $this->action);
return view();
}
}
@ -151,9 +126,22 @@ class Index extends BaseController
if ($start_time > 0 && $end_time > 0) {
$map[] = ['send_time', 'between', "$start_time,$end_time"];
}
$list = $this->getList($map, $param, $this->uid);
$model = new MessageList();
$list = $model->get_list($param,$map,$this->uid);
return table_assign(0, '', $list);
} else {
$where1 = [['from_uid', '=', $this->uid]];
$where2 = [['to_uid', '=', $this->uid]];
$count = [
'inbox' => MessageList::where([['to_uid', '=', $this->uid],['status', '=', 1]])->count(),
'sendbox' => MessageList::where([['from_uid', '=', $this->uid],['to_uid', '=', 0],['is_draft', '=', 1],['status', '=', 1]])->count(),
'draft' => MessageList::where([['from_uid', '=', $this->uid],['is_draft', '=', 2],['status', '=', 1]])->count(),
'rubbish' => MessageList::where([['status', '=', 0]])->where(function($query) use ($where1,$where2) {
$query->where($where1)->whereor($where2);
})->count()
];
View::assign('count', $count);
View::assign('action', $this->action);
return view();
}
}
@ -175,9 +163,22 @@ class Index extends BaseController
if ($start_time > 0 && $end_time > 0) {
$map[] = ['send_time', 'between', "$start_time,$end_time"];
}
$list = $this->getList($map, $param, $this->uid);
$model = new MessageList();
$list = $model->get_list($param,$map,$this->uid);
return table_assign(0, '', $list);
} else {
$where1 = [['from_uid', '=', $this->uid]];
$where2 = [['to_uid', '=', $this->uid]];
$count = [
'inbox' => MessageList::where([['to_uid', '=', $this->uid],['status', '=', 1]])->count(),
'sendbox' => MessageList::where([['from_uid', '=', $this->uid],['to_uid', '=', 0],['is_draft', '=', 1],['status', '=', 1]])->count(),
'draft' => MessageList::where([['from_uid', '=', $this->uid],['is_draft', '=', 2],['status', '=', 1]])->count(),
'rubbish' => MessageList::where([['status', '=', 0]])->where(function($query) use ($where1,$where2) {
$query->where($where1)->whereor($where2);
})->count()
];
View::assign('count', $count);
View::assign('action', $this->action);
return view();
}
}
@ -188,10 +189,14 @@ class Index extends BaseController
$id = empty(get_params('id')) ? 0 : get_params('id');
$fid = 0;
if ($id > 0) {
$detail = Db::name('Message')->where(['id' => $id, 'from_uid' => $this->uid])->find();
$model = new MessageList();
$detail = $model->detail($id);
if (empty($detail)) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
throw new \think\exception\HttpException(406, '找不到记录');
}
if ($detail['from_uid'] != $this->uid) {
throw new \think\exception\HttpException(406, '找不到记录');
}
$fid = $detail['fid'];
$person_name = [];
if ($detail['type'] == 1) { //人员
@ -207,29 +212,6 @@ class Index extends BaseController
$person_name = array_column($positions, 'title');
}
$detail['person_name'] = implode(",", $person_name);
$file_array = Db::name('MessageFileInterfix')
->field('mf.id,mf.mid,mf.file_id,f.name,f.filesize,f.filepath')
->alias('mf')
->join('file f', 'mf.file_id = f.id', 'LEFT')
->order('mf.create_time desc')
->where(array('mf.mid' => $id))
->select()->toArray();
$interfix_ids = array_column($file_array, 'file_id');
$detail['file_ids'] = implode(",", $interfix_ids);
//引用消息的附件
if($fid>0){
$detail['from_content'] = Db::name('Message')->where(['id' => $fid])->value('content');
$from_file_array = Db::name('MessageFileInterfix')
->field('mf.id,mf.mid,mf.file_id,f.name,f.filesize,f.filepath')
->alias('mf')
->join('file f', 'mf.file_id = f.id', 'LEFT')
->order('mf.create_time desc')
->where(array('mf.mid' => $fid))
->select()->toArray();
$detail['from_file_array'] = $from_file_array;
}
View::assign('file_array', $file_array);
View::assign('detail', $detail);
}
View::assign('id', $id);
@ -242,25 +224,16 @@ class Index extends BaseController
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$type = empty(get_params('type')) ? 0 : get_params('type');
$detail = Db::name('Message')->where(['id' => $id, 'template' => 0])->find();
$model = new MessageList();
$detail = $model->detail($id);
if (empty($detail)) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
throw new \think\exception\HttpException(406, '找不到记录');
}
if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
throw new \think\exception\HttpException(406, '找不到记录');
}
$sender = get_admin($detail['from_uid']);
$detail['person_name'] = $sender['name'];
$file_array = Db::name('MessageFileInterfix')
->field('mf.id,mf.mid,mf.file_id,f.name,f.filesize,f.filepath')
->alias('mf')
->join('file f', 'mf.file_id = f.id', 'LEFT')
->order('mf.create_time desc')
->where(array('mf.mid' => $id))
->select()->toArray();
$interfix_ids = array_column($file_array, 'file_id');
$detail['file_ids'] = implode(",", $interfix_ids);
View::assign('file_array', $file_array);
View::assign('detail', $detail);
View::assign('fid', $id);
View::assign('type', $type);
@ -272,12 +245,13 @@ class Index extends BaseController
{
$param = get_params();
$id = $param['id'];
$detail = Db::name('Message')->where(['id' => $id])->find();
$model = new MessageList();
$detail = $model->detail($id);
if (empty($detail)) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
throw new \think\exception\HttpException(406, '找不到记录');
}
if ($detail['to_uid'] != $this->uid && $detail['from_uid'] != $this->uid) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该信息不存在</div>';exit;
throw new \think\exception\HttpException(406, '找不到记录');
}
Db::name('Message')->where(['id' => $id])->update(['read_time' => time()]);
if($detail['from_uid']==0){
@ -287,37 +261,20 @@ class Index extends BaseController
$sender = get_admin($detail['from_uid']);
$detail['person_name'] = $sender['name'];
}
//引用消息的附件
if($detail['fid']>0){
$detail['from_content'] = Db::name('Message')->where(['id' => $detail['fid']])->value('content');
$from_file_array = Db::name('MessageFileInterfix')
->field('mf.id,mf.mid,mf.file_id,f.name,f.filesize,f.filepath')
->alias('mf')
->join('file f', 'mf.file_id = f.id', 'LEFT')
->order('mf.create_time desc')
->where(array('mf.mid' => $detail['fid']))
->select()->toArray();
$detail['from_file_array'] = $from_file_array;
}
//当前消息的附件
$file_array = Db::name('MessageFileInterfix')
->field('mf.id,mf.mid,mf.file_id,f.name,f.filesize,f.filepath')
->alias('mf')
->join('file f', 'mf.file_id = f.id', 'LEFT')
->order('mf.create_time desc')
->where(array('mf.mid' => $detail['id']))
->select()->toArray();
$detail['file_array'] = $file_array;
$detail['send_time'] = date('Y-m-d H:i:s',$detail['send_time']);
if($detail['send_time']>0){
$detail['send_time'] = date('Y-m-d H:i:s',$detail['send_time']);
}
else{
$detail['send_time'] = '-';
}
//发送人查询
$user_names=[];
//已读回执
$read_user_names = [];
if($detail['from_uid'] == $this->uid){
$mails= Db::name('Message')->where(['pid' => $id])->select()->toArray();
$read_mails= Db::name('Message')->where([['pid','=',$id],['read_time','>',2]])->select()->toArray();
$mails= MessageList::where(['pid' => $id])->select()->toArray();
$read_mails= MessageList::where([['pid','=',$id],['read_time','>',2]])->select()->toArray();
$read_user_ids = array_column($read_mails, 'to_uid');
$read_users = Db::name('Admin')->where('status', 1)->where('id', 'in', $read_user_ids)->select()->toArray();
$read_user_names = array_column($read_users, 'name');
@ -330,7 +287,6 @@ class Index extends BaseController
$users = Db::name('Admin')->where('id', $detail['to_uid'])->value('name');
array_push($user_names,$users);
}
$detail['users'] = implode(",", $user_names);
$detail['read_users'] = implode(",", $read_user_names);
View::assign('detail', $detail);
@ -375,6 +331,7 @@ class Index extends BaseController
$basedata['type'] = $param['type'];
$basedata['type_user'] = $type_user;
$basedata['content'] = $param['content'];
$basedata['file_ids'] = $param['file_ids'];
$basedata['controller_name'] = $this->controller;
$basedata['module_name'] = $this->module;
$basedata['action_name'] = $this->action;
@ -382,39 +339,19 @@ class Index extends BaseController
//编辑信息的情况
$basedata['update_time'] = time();
$basedata['id'] = $id;
$res = Db::name('Message')->strict(false)->field(true)->update($basedata);
$res = MessageList::strict(false)->field(true)->update($basedata);
} else {
//新增信息的情况
$basedata['create_time'] = time();
$res = Db::name('Message')->strict(false)->field(true)->insertGetId($basedata);
$res = MessageList::strict(false)->field(true)->insertGetId($basedata);
}
if ($res !== false) {
//信息附件处理
if ($id > 0) {
$mid = $id;
Db::name('MessageFileInterfix')->where(['mid' => $mid])->delete();
} else {
$mid = $res;
}
//附件插入附件
if (!empty($param['file_ids'])) {
$file_array = explode(',', $param['file_ids']);
$file_data = array();
foreach ($file_array as $key => $value) {
if (!$value) {
continue;
}
$file_data[] = array(
'file_id' => $value,
'mid' => $mid,
'admin_id' => $admin_id,
'create_time' => time()
);
}
if ($file_data) {
$sql = Db::name('MessageFileInterfix')->insertAll($file_data);
}
}
add_log('save',$mid);
return to_assign(0, '保存成功', $mid);
} else {
@ -427,7 +364,7 @@ class Index extends BaseController
{
$param = get_params();
//查询要发的消息
$msg = Db::name('Message')->where(['id' => $param['id']])->find();
$msg = MessageList::where(['id' => $param['id']])->find();
$users = [];
if ($msg) {
$admin_id = $msg['from_uid'];
@ -455,6 +392,7 @@ class Index extends BaseController
'fid' => $msg['fid'],//转发或回复消息关联id
'title' => $msg['title'],
'content' => $msg['content'],
'file_ids' => $msg['file_ids'],
'type' => $msg['type'],//接收人类型
'type_user' => $msg['type_user'],//接收人数据
'from_uid' => $this->uid,//发送人
@ -465,32 +403,10 @@ class Index extends BaseController
'create_time' => time()
);
}
$res = Db::name('Message')->strict(false)->field(true)->insertAll($send_data);
$res = MessageList::strict(false)->field(true)->insertAll($send_data);
if ($res!==false) {
//查询原来的附件,并插入
$file_array = Db::name('MessageFileInterfix')->where('mid', $msg['id'])->select()->toArray();
if ($file_array) {
$mids = Db::name('Message')->where('pid', $msg['id'])->select()->toArray();
foreach ($mids as $k => $v) {
$file_data = array();
foreach ($file_array as $key => $value) {
if (!$value) {
continue;
}
$file_data[] = array(
'mid' => $v['id'],
'file_id' => $value['file_id'],
'create_time' => time(),
'admin_id' => $admin_id,
);
}
if ($file_data) {
Db::name('MessageFileInterfix')->strict(false)->field(true)->insertAll($file_data);
}
}
}
//草稿消息变成已发消息
Db::name('Message')->where(['id' => $msg['id']])->update(['is_draft' => '1', 'send_time' => time(), 'update_time' => time()]);
MessageList::where(['id' => $msg['id']])->update(['is_draft' => '1', 'send_time' => time(), 'update_time' => time()]);
add_log('send',$msg['id']);
return to_assign(0, '发送成功');
} else {
@ -542,7 +458,7 @@ class Index extends BaseController
}
foreach ($list as $key => $v) {
if (Db::name('Message')->update($v) !== false) {
if (MessageList::update($v) !== false) {
if ($type = 1) {
add_log('view', $v['id']);
} else if ($type = 2) {

View File

@ -33,4 +33,74 @@ class Message extends Model
self::THREE => '岗位',
self::FOUR => '全部',
];
//获取消息列表
public function get_list($param = [],$map = [], $uid)
{
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
//垃圾箱列表特殊处理
if ($param['status'] == 0) {
$where = [['from_uid', '=', $uid], ['to_uid', '=', $uid]];
$list = Message::withoutField('content')
->where($map)
->where(function ($query) use ($where) {$query->whereOr($where);})
->order('create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
if($item->template==0){
$item->msg_type = '个人信息';
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
}
else{
$item->msg_type = '系统信息';
$item->from_name = '系统';
}
$item->send_time = empty($item->send_time) ? '-' : date('Y-m-d H:i:s', $item->send_time);
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
$item->type_title = Message::$Type[(int)$item->type];
$item->delete_source_title = Message::$Source[(int)$item->delete_source];
});
return $list;
} else {
$list = Message::withoutField('content')
->where($map)
->order('create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
if($item->template==0){
$item->msg_type = '个人信息';
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
}
else{
$item->msg_type = '系统信息';
$item->from_name = '系统';
}
$item->send_time = empty($item->send_time) ? '-' : date('Y-m-d H:i:s', $item->send_time);
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
$item->type_title = Message::$Type[(int)$item->type];
});
return $list;
}
}
//消息详情
public function detail($id)
{
$detail = Db::name('Message')->where(['id' => $id])->find();
if(!empty($detail)){
//消息附件
$file_array = Db::name('File')->order('create_time desc')->where([['id','in',$detail['file_ids']]])->select()->toArray();
$detail['file_array'] = $file_array;
//引用消息附件
if($detail['fid']>0){
$from_msg = Db::name('Message')->field('content,file_ids')->where(['id' => $detail['fid']])->find();
$detail['from_content'] = $from_msg['content'];
$detail['from_file_ids'] = $from_msg['file_ids'];
$from_file_array = Db::name('File')->order('create_time desc')->where([['id','in',$detail['from_file_ids']]])->select()->toArray();
$detail['from_file_array'] = $from_file_array;
}
}
return $detail;
}
}

View File

@ -35,22 +35,10 @@
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top">消息附件</td>
<td>
<div class="layui-upload" style="max-width: 800px;">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="testList">选择文件并上传</button> <span style="color:#FF5722;margin-left: 10px;">最大只能上传{:get_system_info('upload_max_filesize')}的文件,超过{:get_system_info('upload_max_filesize')}请压缩成多个文件上传。</span>
<div class="layui-upload-list" style="display:none;">
<table class="layui-table">
<thead>
<tr>
<th width="60%">文件名</th>
<th width="20%" style="text-align:center">文件大小</th>
<th width="20%" style="text-align:center">操作</th>
</tr>
</thead>
<tbody id="demoList"></tbody>
</table>
</div>
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div></td>
<td colspan="5">
<div class="layui-row" id="fileList">
<input type="hidden" name="file_ids" value="">
</div>
</td>
</tr>
@ -122,34 +110,24 @@
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top">消息附件</td>
<td>
<div class="layui-upload" style="max-width: 800px;">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="testList">选择文件并上传</button> <span style="color:#FF5722;margin-left: 10px;">最大只能上传{:get_system_info('upload_max_filesize')}的文件,超过{:get_system_info('upload_max_filesize')}请压缩成多个文件上传。</span>
<div class="layui-upload-list" {empty name="$file_array"}style="display:none;"{/empty}>
<table class="layui-table">
<thead>
<tr>
<th width="60%">文件名</th>
<th width="20%" style="text-align:center">文件大小</th>
<th width="20%" style="text-align:center">操作</th>
</tr>
</thead>
<tbody id="demoList">
{notempty name="$file_array"}
{volist name="file_array" id="vo"}
<tr data-id="{$vo.file_id}" id="tr_{$vo.id}">
<td>{$vo.name}</td>
<td style="text-align: center;">{$vo.filesize/1048576|round=2}MB</td>
<td style="text-align: center;">
<a class="layui-btn layui-btn-xs layui-btn-danger demo-delete" data-id="{$vo.id}">删除</a>
</td>
</tr>
{/volist}
{/notempty}
</tbody>
</table>
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div></td>
<td colspan="5">
<div class="layui-row" id="fileList">
<input type="hidden" name="file_ids" value="{$detail.file_ids}">
{notempty name="$detail.file_ids"}
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md3" id="uploadImg{$vo.id}">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="{$vo.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>
{/volist}
{/notempty}
</div>
</td>
</tr>
@ -168,21 +146,29 @@
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const moduleInit = ['tool','employeepicker','dtree'];
function gouguInit() {
var form = layui.form,tool=layui.tool,table=layui.table,laydate = layui.laydate,employeepicker = layui.employeepicker,dtree = layui.dtree,upload = layui.upload;
//监听保存到草稿并发送
form.on('submit(webform)', function(data){
var file_ids = [];
var item_tr = $('#demoList').find('tr');
item_tr.each(function(index,item) {
var item_id = $(item).data('id');
if (item_id && item_id != '') {
file_ids.push(item_id);
}
});
data.field.file_ids = file_ids.join(',');
$.ajax({
url: "/message/index/save",
type:'post',
@ -197,7 +183,7 @@
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
tool.sideClose(1000);
}
}
})
@ -211,15 +197,6 @@
//监听保存到草稿
form.on('submit(draftform)', function(data){
var file_ids = [];
var item_tr = $('#demoList').find('tr');
item_tr.each(function(index,item) {
var item_id = $(item).data('id');
if (item_id && item_id != '') {
file_ids.push(item_id);
}
});
data.field.file_ids = file_ids.join(',');
$.ajax({
url: "/message/index/save",
type:'post',
@ -227,50 +204,13 @@
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
tool.sideClose(1000);
}
}
})
return false;
});
upload.render({ //允许上传的文件后缀
elem: '#testList'
,url: '/api/index/upload' //此处配置你自己的上传接口即可
,accept: 'file' //普通文件
,exts: 'jpeg|jpg|png|gif|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件
,before: function(obj){ //obj参数包含的信息跟 choose回调完全一致可参见上文。
layer.msg('上传中...',{time: 3600000});
}
,done: function(res, index, upload){
layer.msg(res.msg);
if(res.code==0){
var timestamp=new Date().getTime();
var tr = '<tr data-id="'+res.data.id+'" id="tr_'+timestamp+'">\
<td>'+ res.data.name +'</td>\
<td align="center">'+ (res.data.filesize/(1024*1024)).toFixed(2) +'MB</td>\
<td align="center">\
<span class="layui-btn layui-btn-xs layui-btn-danger demo-delete" data-id="'+timestamp+'">删除</span>\
</td>\
</tr>';
$('.layui-upload-list').show();
$('#demoList').append(tr);
}
}
,error: function(index, upload){
layer.msg('上传失败');
}
});
$('#demoList').on('click','.demo-delete',function(){
let id = $(this).data('id');
layer.confirm('确定要删除该附件吗?', {icon: 3, title:'提示'}, function(index){
$('#tr_'+id).remove()
layer.close(index);
});
})
//选择收件人类型
form.on('radio(type)', function (data) {
$('[name="person_name"]').val('');
@ -402,6 +342,49 @@
}
})
}
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
}
</script>
{/block}

View File

@ -2,22 +2,25 @@
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="开始日期">
{include file="index/msgmenu" /}
<div style="margin-left:172px;">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="结束日期">
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="开始日期">
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="结束日期">
</div>
</div>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="mail_type">
@ -59,14 +62,13 @@
url: "/message/index/draft", //数据接口
page: true ,//开启分页
limit: 20,
cellMinWidth: 80, //全局定义常规单元格的最小宽度layui 2.2.1 新增
cellMinWidth: 200, //全局定义常规单元格的最小宽度layui 2.2.1 新增
cols: [[ //表头
{type:'checkbox',fixed:'left'},
{field: 'type_title', title: '接收人类型',width:100,align:'center'},
{field: 'title', title: '消息主题'},
{field: 'create_time', title: '保存时间', align:'center',width:160},
{field: 'files', title: '附件(个)',align:'center', width:86},
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:100, align:'center'}
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:120, align:'center'}
]],
where:{type:1}
});

View File

@ -2,36 +2,39 @@
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="接收开始日期">
{include file="index/msgmenu" /}
<div style="margin-left:172px;">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="接收结束日期">
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="接收开始日期">
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="接收结束日期">
</div>
</div>
</div>
<div class="layui-input-inline" style="width:136px">
<select name="read">
<option value="">选择消息状态</option>
<option value="1">读消息</option>
<option value="2">已读消息</option>
</select>
</div>
<div class="layui-input-inline" style="width:136px">
<select name="template">
<option value="">选择消息类型</option>
<option value="1">系统消息</option>
<option value="2">个人消息</option>
</select>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<div class="layui-input-inline" style="width:136px">
<select name="read">
<option value="">选择消息状态</option>
<option value="1">未读消息</option>
<option value="2">读消息</option>
</select>
</div>
<div class="layui-input-inline" style="width:136px">
<select name="template">
<option value="">选择消息类型</option>
<option value="1">系统消息</option>
<option value="2">个人消息</option>
</select>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="toolbarDemo">
@ -71,22 +74,21 @@
url: "/message/index/inbox", //数据接口
page: true ,//开启分页
limit: 20,
cellMinWidth: 80, //全局定义常规单元格的最小宽度layui 2.2.1 新增
cellMinWidth: 200, //全局定义常规单元格的最小宽度layui 2.2.1 新增
cols: [[ //表头
{type:'checkbox',fixed:'left'},
{field: 'msg_type', title: '消息类型',width:88,align:'center'},
{field: 'msg_type', title: '消息类型',width:90,align:'center'},
{field: 'from_name', title: '发件人', width:100,align:'center'},
{field: 'title', title: '消息主题'},
{field: 'send_time', title: '发件时间', align:'center',width:160},
{field: 'read_time', title: '是否已读',align:'center', width:86,templet:function(d){
{field: 'read_time', title: '是否已读',align:'center', width:90,templet:function(d){
var html='<span style="color:#5FB878">已读</span>';
if(d.read_time==0){
html='<span style="color:#FF5722">未读</span>';
}
return html;
}},
{field: 'files', title: '附件(个)',align:'center', width:86},
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:172, align:'center'}
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:170, align:'center'}
]],
where:{type:1}
});

View File

@ -0,0 +1,10 @@
<div class="p-3 sub-menu" style="width:160px;height: calc(100% - 24px);">
<div class="border bg-white" style="width:100%;height:100%;">
<ul>
<li class="sub-menu-li {eq name='$action' value='inbox'} active{/eq}"><a href="/message/index/inbox"><i class="iconfont icon-yiyichuli"></i><span class="text">收件箱</span><span class="num">({$count.inbox})<span></a></li>
<li class="sub-menu-li {eq name='$action' value='sendbox'} active{/eq}"><a href="/message/index/sendbox"><i class="iconfont icon-tuiguangshezhi"></i><span class="text">发件箱</span><span class="num">({$count.sendbox})<span></a></li>
<li class="sub-menu-li {eq name='$action' value='draft'} active{/eq}"><a href="/message/index/draft"><i class="iconfont icon-lunwenguanli"></i><span class="text">草稿箱</span><span class="num">({$count.draft})<span></a></li>
<li class="sub-menu-li {eq name='$action' value='rubbish'} active{/eq}"><a href="/message/index/rubbish"><i class="iconfont icon-tiku"></i><span class="text">垃圾箱</span><span class="num">({$count.rubbish})<span></a></li>
</ul>
</div>
</div>

View File

@ -40,23 +40,18 @@
{notempty name="$detail.from_file_array"}
<tr>
<td class="layui-td-gray-2" style="vertical-align:top">引用消息附件</td>
<td>
<table class="layui-table" style="max-width: 680px;">
<thead>
<th width="70%">文件名</th>
<th width="20%" style="text-align:center">文件大小</th>
<th width="10%" style="text-align:center">操作</th>
</thead>
<tbody>
{volist name="$detail.from_file_array" id="vo"}
<tr>
<td>{$vo.name}</td>
<td style="text-align: center;">{$vo.filesize/1048576|round=2}MB</td>
<td style="text-align: center;"><a class="layui-btn layui-btn-xs layui-btn-normal" href="{$vo.filepath}" target="_blank">下载</a></td>
</tr>
{/volist}
</tbody>
</table>
<td>
{volist name="$detail.from_file_array" id="vo"}
<div class="layui-col-md3" id="uploadImg{$vo.id}">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
</div>
</div>
</div>
{/volist}
</td>
</tr>
{/notempty}
@ -71,24 +66,17 @@
<tr>
<td class="layui-td-gray" style="vertical-align:top">相关附件</td>
<td colspan="5">
<table class="layui-table" style="max-width: 800px;">
<thead>
<tr>
<th width="70%">文件名</th>
<th width="20%" style="text-align:center">文件大小</th>
<th width="10%" style="text-align:center">操作</th>
</tr>
</thead>
<tbody>
{volist name="detail.file_array" id="vo"}
<tr>
<td>{$vo.name}</td>
<td style="text-align: center;">{$vo.filesize/1048576|round=2}MB</td>
<td style="text-align: center;"><a class="layui-btn layui-btn-xs layui-btn-normal" href="{$vo.filepath}" target="_blank">下载</a></td>
</tr>
{/volist}
</tbody>
</table>
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md3" id="uploadImg{$vo.id}">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
</div>
</div>
</div>
{/volist}
</td>
</tr>
{/notempty}

View File

@ -58,29 +58,23 @@
<table class="layui-table" style="margin-top:10px;">
<tr>
<td class="layui-td-gray-2">原消息内容</td>
<td>{$detail.content}
</td>
<td>{$detail.content}</td>
</tr>
{notempty name="$file_array"}
<tr>
<td class="layui-td-gray-2" style="vertical-align:top">原消息附件</td>
<td>
<table class="layui-table">
<thead>
<tr>
<th width="80%">文件名</th>
<th width="20%" style="text-align:center">文件大小</th>
</tr>
</thead>
<tbody>
{volist name="file_array" id="vo"}
<tr>
<td>{$vo.name}</td>
<td style="text-align: center;">{$vo.filesize/1048576|round=2}MB</td>
</tr>
{/volist}
</tbody>
</table>
{volist name="$detail.from_file_array" id="vo"}
<div class="layui-col-md3" id="uploadImg{$vo.id}">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
</div>
</div>
</div>
{/volist}
</td>
</tr>
{/notempty}
@ -88,22 +82,24 @@
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top">消息附件</td>
<td>
<div class="layui-upload" style="max-width: 800px;">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="testList">选择文件并上传</button> <span style="color:#FF5722;margin-left: 10px;">最大只能上传{:get_system_info('upload_max_filesize')}的文件,超过{:get_system_info('upload_max_filesize')}请压缩成多个文件上传。</span>
<div class="layui-upload-list" style="display:none;">
<table class="layui-table">
<thead>
<tr>
<th width="60%">文件名</th>
<th width="20%" style="text-align:center">文件大小</th>
<th width="20%" style="text-align:center">操作</th>
</tr>
</thead>
<tbody id="demoList"></tbody>
</table>
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div></td>
<td colspan="5">
<div class="layui-row" id="fileList">
<input type="hidden" name="file_ids" value="{$detail.file_ids}">
{notempty name="$detail.file_ids"}
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md3" id="uploadImg{$vo.id}">
<div class="file-card">
<i class="file-icon iconfont icon-renwuguanli"></i>
<div class="file-title">{$vo.name}</div>
<div class="file-tool">
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="{$vo.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>
{/volist}
{/notempty}
</div>
</td>
</tr>
@ -121,21 +117,27 @@
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const moduleInit = ['tool','employeepicker','dtree'];
function gouguInit() {
var form = layui.form,tool=layui.tool,table=layui.table,laydate = layui.laydate,employeepicker = layui.employeepicker,dtree = layui.dtree,upload = layui.upload;
//监听保存到草稿并发送
form.on('submit(webform)', function(data){
var file_ids = [];
var item_tr = $('#demoList').find('tr');
item_tr.each(function(index,item) {
var item_id = $(item).data('id');
if (item_id && item_id != '') {
file_ids.push(item_id);
}
});
console.log(file_ids.join(','));
data.field.file_ids = file_ids.join(',');
$.ajax({
url: "/message/index/save",
type:'post',
@ -150,7 +152,7 @@
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
tool.sideClose(1000);
}
}
})
@ -164,16 +166,6 @@
//监听保存到草稿
form.on('submit(draftform)', function(data){
var file_ids = [];
var item_tr = $('#demoList').find('tr');
item_tr.each(function(index,item) {
var item_id = $(item).data('id');
if (item_id && item_id != '') {
file_ids.push(item_id);
}
});
console.log(file_ids.join(','));
data.field.file_ids = file_ids.join(',');
$.ajax({
url: "/message/index/save",
type:'post',
@ -181,49 +173,13 @@
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
tool.sideClose(1000);
}
}
})
return false;
});
upload.render({ //允许上传的文件后缀
elem: '#testList'
,url: '/api/index/upload' //此处配置你自己的上传接口即可
,accept: 'file' //普通文件
,exts: 'jpeg|jpg|png|gif|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件
,before: function(obj){ //obj参数包含的信息跟 choose回调完全一致可参见上文。
layer.msg('上传中...',{time: 3600000});
}
,done: function(res, index, upload){
layer.msg(res.msg);
if(res.code==0){
var timestamp=new Date().getTime();
var tr = '<tr data-id="'+res.data.id+'" id="tr_'+timestamp+'">\
<td>'+ res.data.name +'</td>\
<td align="center">'+ (res.data.filesize/(1024*1024)).toFixed(2) +'MB</td>\
<td align="center">\
<span class="layui-btn layui-btn-xs layui-btn-danger demo-delete" data-id="'+timestamp+'">删除</span>\
</td>\
</tr>';
$('.layui-upload-list').show();
$('#demoList').append(tr);
}
}
,error: function(index, upload){
layer.msg('上传失败');
}
});
$('#demoList').on('click','.demo-delete',function(){
let id = $(this).data('id');
layer.confirm('确定要删除该附件吗?', {icon: 3, title:'提示'}, function(index){
$('#tr_'+id).remove()
layer.close(index);
});
})
//选择收件人类型
form.on('radio(type)', function (data) {
$('[name="person_name"]').val('');
@ -353,6 +309,37 @@
}
})
}
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
}
</script>
{/block}

View File

@ -2,22 +2,25 @@
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="开始日期">
{include file="index/msgmenu" /}
<div style="margin-left:172px;">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="结束日期">
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="开始日期">
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="结束日期">
</div>
</div>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="mail_type">
@ -65,10 +68,9 @@
cols: [[ //表头
{type:'checkbox',fixed:'left'},
{field: 'delete_source_title', title: '来源',toolbar: '#mail_type',width:90,align:'center'},
{field: 'from_name', title: '发件人', width:110,align:'center'},
{field: 'from_name', title: '发件人', width:100,align:'center'},
{field: 'title', title: '消息主题'},
{field: 'send_time', title: '发送时间', align:'center',width:160},
{field: 'files', title: '附件(个)',align:'center', width:88},
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:160, align:'center'}
]],
where:{type:1}
@ -89,7 +91,7 @@
success:function(e){
layer.msg(e.msg);
if(e.code==0){
tableIns.reload();
layui.pageTable.reload();
}
}
})
@ -104,7 +106,7 @@
success:function(e){
layer.msg(e.msg);
if(e.code==0){
tableIns.reload();
layui.pageTable.reload();
}
}
})

View File

@ -2,22 +2,25 @@
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="发送开始日期">
{include file="index/msgmenu" /}
<div style="margin-left:172px;">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-inline" style="width:240px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off"/>
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="发送结束日期">
<div class="layui-inline" id="date">
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="start_time" name="start_time" class="layui-input" placeholder="发送开始日期">
</div>
~
<div class="layui-input-inline" style="width:112px">
<input type="text" autocomplete="off" id="end_time" name="end_time" class="layui-input" placeholder="发送结束日期">
</div>
</div>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="mail_type">
@ -60,14 +63,13 @@
url: "/message/index/sendbox", //数据接口
page: true ,//开启分页
limit: 20,
cellMinWidth: 80, //全局定义常规单元格的最小宽度layui 2.2.1 新增
cellMinWidth: 200, //全局定义常规单元格的最小宽度layui 2.2.1 新增
cols: [[ //表头
{type:'checkbox',fixed:'left'},
{field: 'type_title', title: '接收人类型',width:100,align:'center'},
{field: 'title', title: '消息主题'},
{field: 'send_time', title: '发件时间', align:'center',width:160},
{field: 'files', title: '附件(个)',align:'center', width:86},
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:136, align:'center'}
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:140, align:'center'}
]],
where:{type:1}
});

View File

@ -33,7 +33,7 @@ class Index extends BaseController
->field('a.*,c.title as cate_title')
->alias('a')
->join('NoteCate c', 'a.cate_id = c.id', 'LEFT')
->order('a.create_time asc')
->order('a.end_time desc,a.sort desc,a.create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->start_time = empty($item->start_time) ? '-' : date('Y-m-d', $item->start_time);
@ -126,7 +126,7 @@ class Index extends BaseController
}
}
//公告类别
//公告类别
public function note_cate()
{
if (request()->isAjax()) {

View File

@ -10,11 +10,11 @@
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">+ 添加公告</span>
<span class="layui-btn layui-btn-sm" lay-event="add">+ 添加公告</span>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">查看</span><span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></div>
<div class="layui-btn-group"><span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></div>
</script>
{/block}
<!-- /主体 -->
@ -48,10 +48,15 @@
field: 'cate_title',
title: '公告分类',
align: 'center',
width: 136
width: 136,
templet: function (d) {
var html = '<span class="layui-color-'+d.cate_id+'">'+d.cate_title+'</span>';
return html;
}
}, {
field: 'title',
title: '公告标题'
title: '公告标题',
templet: '<div><a data-href="/note/index/view/id/{{d.id}}.html" class="right-a">{{d.title}}</a></div>'
}, {
field: 'cate_title',
title: '公告展示期间',
@ -71,7 +76,7 @@
field: 'right',
title: '操作',
toolbar: '#barDemo',
width: 136,
width: 110,
align: 'center'
}
]
@ -89,10 +94,6 @@
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
tool.side("/note/index/view?id="+data.id);
return;
}
if (obj.event === 'edit') {
tool.side("/note/index/add?id="+data.id);
return;

View File

@ -3,7 +3,7 @@
{block name="body"}
<div class="p-3">
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 添加分类</button>
<button class="layui-btn layui-btn-sm add-menu">+ 添加分类</button>
</div>
<div>
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
@ -37,7 +37,7 @@
,{field:'title', title: '分类名称'}
,{field:'pid', title: '父级ID', width:80, align:'center'}
,{width:160,title: '操作', align:'center',templet: function(d){
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="add">添加子分类</button><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></span>';
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="add">添加子分类</button><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></span>';
return html;
}
}

View File

@ -18,6 +18,13 @@ function oa_seal_cate()
return $list;
}
//读取会议室
function oa_meeting_cate()
{
$list = Db::name('MeetingCate')->where(['status' => 1])->select()->toArray();
return $list;
}
//读取车辆类型
function oa_car_cate()
{

View File

@ -31,12 +31,12 @@ class Approve extends BaseController
$where[] = ['check_status','>',2];
}
}
$where[] = ['create_admin_id','=',$this->uid];
$where[] = ['admin_id','=',$this->uid];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$list = Db::name('Approve')
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
->alias('f')
->join('Admin a', 'a.id = f.create_admin_id', 'left')
->join('Admin a', 'a.id = f.admin_id', 'left')
->join('Department d', 'd.id = f.department_id', 'left')
->join('FlowType t', 't.id = f.type', 'left')
->where($where)
@ -77,7 +77,7 @@ class Approve extends BaseController
$list = Db::name('Approve')
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
->alias('f')
->join('Admin a', 'a.id = f.create_admin_id', 'left')
->join('Admin a', 'a.id = f.admin_id', 'left')
->join('Department d', 'd.id = f.department_id', 'left')
->join('FlowType t', 't.id = f.type', 'left')
->whereOr([$map1,$map2])
@ -99,7 +99,7 @@ class Approve extends BaseController
$list = Db::name('Approve')
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
->alias('f')
->join('Admin a', 'a.id = f.create_admin_id', 'left')
->join('Admin a', 'a.id = f.admin_id', 'left')
->join('Department d', 'd.id = f.department_id', 'left')
->join('FlowType t', 't.id = f.type', 'left')
->where($map1)
@ -120,7 +120,7 @@ class Approve extends BaseController
$list = Db::name('Approve')
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
->alias('f')
->join('Admin a', 'a.id = f.create_admin_id', 'left')
->join('Admin a', 'a.id = f.admin_id', 'left')
->join('Department d', 'd.id = f.department_id', 'left')
->join('FlowType t', 't.id = f.type', 'left')
->where($map2)
@ -156,7 +156,7 @@ class Approve extends BaseController
$list = Db::name('Approve')
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
->alias('f')
->join('Admin a', 'a.id = f.create_admin_id', 'left')
->join('Admin a', 'a.id = f.admin_id', 'left')
->join('Department d', 'd.id = f.department_id', 'left')
->join('FlowType t', 't.id = f.type', 'left')
->where($map)
@ -255,6 +255,15 @@ class Approve extends BaseController
);
$res = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
//添加提交申请记录
$checkData=array(
'action_id' => $param['id'],
'check_user_id' => $this->uid,
'content' => '重新提交申请',
'check_time' => time(),
'create_time' => time()
);
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('edit', $param['id'], $param);
//发送消息通知
$msg=[
@ -265,7 +274,7 @@ class Approve extends BaseController
$users = $param['check_admin_ids'];
sendMessage($users,21,$msg);
} else {
$param['create_admin_id'] = $this->uid;
$param['admin_id'] = $this->uid;
$param['department_id'] = $this->did;
$param['create_time'] = time();
@ -308,8 +317,17 @@ class Approve extends BaseController
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$res = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
$step_id = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
//添加提交申请记录
$checkData=array(
'action_id' => $aid,
'check_user_id' => $this->uid,
'content' => '提交申请',
'check_time' => time(),
'create_time' => time()
);
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('add', $aid, $param);
//给审核人发送消息通知
$msg=[
@ -343,7 +361,7 @@ class Approve extends BaseController
}
$department = $this->did;
//获取审批流程
$flows = get_flows($type,$department);
$flows = get_cate_department_flows($type,$department);
$moban=Db::name('FlowType')->where('id',$type)->value('name');
$module = strtolower(app('http')->getName());
$class = strtolower(app('request')->controller());
@ -357,7 +375,7 @@ class Approve extends BaseController
if(isTemplate($template)){
return view('add_'.$moban);
}else{
return view('Base@common/errortemplate',['file' =>$template]);
return view('../../base/view/common/errortemplate',['file' =>$template]);
}
}
}
@ -367,6 +385,7 @@ class Approve extends BaseController
{
$param = get_params();
$detail = Db::name('Approve')->where('id',$param['id'])->find();
$check_record = [];
if($detail['start_time']>0){
$detail['start_time'] = date('Y-m-d H:i',$detail['start_time']);
}
@ -380,7 +399,7 @@ class Approve extends BaseController
$detail['days'] = floor($detail['duration']*10/75);
$detail['hours'] = (($detail['duration']*10)%75)/10;
$detail['create_user'] = Db::name('Admin')->where('id',$detail['create_admin_id'])->value('name');
$detail['create_user'] = Db::name('Admin')->where('id',$detail['admin_id'])->value('name');
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
$detail['check_user'] = '-';
$detail['copy_user'] = '-';
@ -411,7 +430,7 @@ class Approve extends BaseController
$is_check_admin = 0;
$is_create_admin = 0;
if($detail['create_admin_id'] == $this->uid){
if($detail['admin_id'] == $this->uid){
$is_create_admin = 1;
}
if(in_array($this->uid,$check_user_ids)){
@ -425,6 +444,25 @@ class Approve extends BaseController
}
}
}
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
->alias('f')
->join('Admin a', 'a.id = f.check_user_id', 'left')
->where(['f.action_id'=>$detail['id'],'f.type'=>1])
->order('check_time desc')
->select()->toArray();
foreach ($check_record as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d :H:i', $vv['check_time']);
$vv['status_str'] = '提交';
if($vv['status'] == 1){
$vv['status_str'] = '审核通过';
}
else if($vv['status'] == 2){
$vv['status_str'] = '审核拒绝';
}
if($vv['status'] == 3){
$vv['status_str'] = '撤销';
}
}
$moban=Db::name('FlowType')->where('id',$detail['type'])->value('name');
$module = strtolower(app('http')->getName());
$class = strtolower(app('request')->controller());
@ -432,198 +470,13 @@ class Approve extends BaseController
$template = $module . '/view/'. $class .'/view_'.$moban.'.html';
View::assign('is_create_admin', $is_create_admin);
View::assign('is_check_admin', $is_check_admin);
View::assign('check_record', $check_record);
View::assign('detail', $detail);
View::assign('flows', $flows);
if(isTemplate($template)){
return view('view_'.$moban);
}else{
return view('Base@common/errortemplate',['file' =>$template]);
return view('../../base/view/common/errortemplate',['file' =>$template]);
}
}
//审核
public function check()
{
$param = get_params();
$detail = Db::name('Approve')->where('id',$param['id'])->find();
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
//审核通过
if($param['status'] == 1){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 4){
//查询当前会签记录数
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>1,'step_id'=>$step['id']])->count();
//当前会签记应有记录数
$param['check_admin_ids'] = $step['flow_uids'];
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
$param['check_admin_ids'] = $next_step['flow_uids'];
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$param['check_status'] = 1;
}
}
else if($step['flow_type'] == 0){
//自由人审批
if($param['check_node'] == 2){
$next_step = $detail['check_step_sort']+1;
$flow_step = array(
'action_id' => $detail['id'],
'sort' => $next_step,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$param['check_step_sort'] = $next_step;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
$param['check_admin_ids'] = get_department_leader($this->uid);
}
else if($next_step['flow_type'] == 2){
$param['check_admin_ids'] = get_department_leader($this->uid,1);
}
else{
$param['check_admin_ids'] = $next_step['flow_uids'];
}
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
if($param['check_status'] == 1 && $param['check_admin_ids']==''){
return to_assign(1,'找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('check', $param['id'], $param);
//发送消息通知
$msg=[
'from_uid'=>$detail['create_admin_id'],
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'title' => Db::name('FlowType')->where('id',$detail['type'])->value('title'),
'action_id'=>$detail['id']
];
if($param['check_status'] == 1){
$users = $param['check_admin_ids'];
sendMessage($users,21,$msg);
}
if($param['check_status'] == 2){
$users = $detail['create_admin_id'];
sendMessage($users,22,$msg);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 2){
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
if (!in_array($this->uid, $check_admin_ids)){
return to_assign(1,'您没权限审核该审批');
}
//拒绝审核,数据操作
$param['check_status'] = 3;
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$param['check_admin_ids'] ='';
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('refue', $param['id'], $param);
//发送消息通知
$msg=[
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
'title' => Db::name('FlowType')->where('id',$detail['type'])->value('title'),
'action_id'=>$detail['id']
];
$users = $detail['create_admin_id'];
sendMessage($users,23,$msg);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 3){
if($detail['create_admin_id'] != $this->uid){
return to_assign(1,'你没权限操作');
}
//撤销审核,数据操作
$param['check_status'] = 4;
$param['check_admin_ids'] ='';
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => 0,
'check_user_id' => $this->uid,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('back', $param['id'], $param);
return to_assign();
}else{
return to_assign(1,'操作失败');
}
}
}
}

View File

@ -1,486 +0,0 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.layui-form-pane .layui-form-label{color:#999; width:80px; padding:8px 3px;}
.layui-form-item .layui-inline{margin-right:3px; margin-bottom:10px;}
.layui-form-item{margin-bottom:5px;}
.layui-form-item .layui-btn-danger{display:none; margin-top:-8px}
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">请假审批</h3>
{eq name="$id" value="0"}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">请假类型<font>*</font></td>
<td colspan="5">
<select name="detail_type" lay-verify="required" lay-reqText="请选择请假类型">
<option value="">--请选择--</option>
<option value="1">事假</option>
<option value="2">年假</option>
<option value="3">调休假</option>
<option value="4">病假</option>
<option value="5">婚假</option>
<option value="6">丧假</option>
<option value="7">产假</option>
<option value="8">陪产假</option>
<option value="9">其他</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">开始时间<font>*</font></td>
<td>
<input id="start_time_a" name="start_time_a" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<select lay-filter="time_b" id="start_time_b" name="start_time_b">
<option value="">--请选择--</option>
<option value="09:00">09:00</option>
<option value="09:30">09:30</option>
<option value="10:00">10:00</option>
<option value="10:30">10:30</option>
<option value="11:00">11:00</option>
<option value="11:30">11:30</option>
<option value="12:00">12:00</option>
<option value="13:30">13:30</option>
<option value="14:00">14:00</option>
<option value="14:30">14:30</option>
<option value="15:00">15:00</option>
<option value="15:30">15:30</option>
<option value="16:00">16:00</option>
<option value="16:30">16:30</option>
<option value="17:00">17:00</option>
<option value="17:30">17:30</option>
<option value="18:00">18:00</option>
</select>
</td>
<td class="layui-td-gray">结束时间<font>*</font></td>
<td>
<input id="end_time_a" name="end_time_a" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<input type="hidden" name="duration" value="">
<select lay-filter="time_b" id="end_time_b" name="end_time_b">
<option value="">--请选择--</option>
<option value="09:00">09:00</option>
<option value="09:30">09:30</option>
<option value="10:00">10:00</option>
<option value="10:30">10:30</option>
<option value="11:00">11:00</option>
<option value="11:30">11:30</option>
<option value="12:00">12:00</option>
<option value="13:30">13:30</option>
<option value="14:00">14:00</option>
<option value="14:30">14:30</option>
<option value="15:00">15:00</option>
<option value="15:30">15:30</option>
<option value="16:00">16:00</option>
<option value="16:30">16:30</option>
<option value="17:00">17:00</option>
<option value="17:30">17:30</option>
<option value="18:00">18:00</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">请假工时</td>
<td colspan="2" id="hours">-</td>
<td class="layui-td-gray">请假天数</td>
<td colspan="2" id="days">-</td>
</tr>
<tr>
<td class="layui-td-gray">请假事由<font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入请假理由" class="layui-textarea" lay-verify="required" lay-reqText="请输入请假理由"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">请假类型<font>*</font></td>
<td colspan="5">
<select name="detail_type" lay-verify="required" lay-reqText="请选择请假类型">
<option value="">--请选择--</option>
<option value="1" {eq name="$detail.detail_type" value="1"}selected=""{/eq}>事假</option>
<option value="2" {eq name="$detail.detail_type" value="2"}selected=""{/eq}>年假</option>
<option value="3" {eq name="$detail.detail_type" value="3"}selected=""{/eq}>调休假</option>
<option value="4" {eq name="$detail.detail_type" value="4"}selected=""{/eq}>病假</option>
<option value="5" {eq name="$detail.detail_type" value="5"}selected=""{/eq}>婚假</option>
<option value="6" {eq name="$detail.detail_type" value="6"}selected=""{/eq}>丧假</option>
<option value="7" {eq name="$detail.detail_type" value="7"}selected=""{/eq}>产假</option>
<option value="8" {eq name="$detail.detail_type" value="8"}selected=""{/eq}>陪产假</option>
<option value="9" {eq name="$detail.detail_type" value="9"}selected=""{/eq}>其他</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">开始时间<font>*</font></td>
<td>
<input id="start_time_a" name="start_time_a" autocomplete="off" class="layui-input" value="{$detail.start_time_a}" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<select lay-filter="time_b" id="start_time_b" name="start_time_b" lay-verify="required" lay-reqText="请选择具体时间">
<option value="">--请选择--</option>
<option value="09:00" {eq name="$detail.start_time_b" value="09:00"}selected=""{/eq}>09:00</option>
<option value="09:30" {eq name="$detail.start_time_b" value="09:30"}selected=""{/eq}>09:30</option>
<option value="10:00" {eq name="$detail.start_time_b" value="10:00"}selected=""{/eq}>10:00</option>
<option value="10:30" {eq name="$detail.start_time_b" value="10:30"}selected=""{/eq}>10:30</option>
<option value="11:00" {eq name="$detail.start_time_b" value="11:00"}selected=""{/eq}>11:00</option>
<option value="11:30" {eq name="$detail.start_time_b" value="11:30"}selected=""{/eq}>11:30</option>
<option value="12:00" {eq name="$detail.start_time_b" value="12:00"}selected=""{/eq}>12:00</option>
<option value="13:30" {eq name="$detail.start_time_b" value="13:30"}selected=""{/eq}>13:30</option>
<option value="14:00" {eq name="$detail.start_time_b" value="14:00"}selected=""{/eq}>14:00</option>
<option value="14:30" {eq name="$detail.start_time_b" value="14:30"}selected=""{/eq}>14:30</option>
<option value="15:00" {eq name="$detail.start_time_b" value="15:00"}selected=""{/eq}>15:00</option>
<option value="15:30" {eq name="$detail.start_time_b" value="15:30"}selected=""{/eq}>15:30</option>
<option value="16:00" {eq name="$detail.start_time_b" value="16:00"}selected=""{/eq}>16:00</option>
<option value="16:30" {eq name="$detail.start_time_b" value="16:30"}selected=""{/eq}>16:30</option>
<option value="17:00" {eq name="$detail.start_time_b" value="17:00"}selected=""{/eq}>17:00</option>
<option value="17:30" {eq name="$detail.start_time_b" value="17:30"}selected=""{/eq}>17:30</option>
<option value="18:00" {eq name="$detail.start_time_b" value="18:00"}selected=""{/eq}>18:00</option>
</select>
</td>
<td class="layui-td-gray">结束时间<font>*</font></td>
<td>
<input id="end_time_a" name="end_time_a" autocomplete="off" class="layui-input" value="{$detail.end_time_a}" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<input type="hidden" name="duration" value="{$detail.duration}">
<select lay-filter="time_b" id="end_time_b" name="end_time_b" lay-verify="required" lay-reqText="请选择具体时间">
<option value="">--请选择--</option>
<option value="09:00" {eq name="$detail.end_time_b" value="09:00"}selected=""{/eq}>09:00</option>
<option value="09:30" {eq name="$detail.end_time_b" value="09:30"}selected=""{/eq}>09:30</option>
<option value="10:00" {eq name="$detail.end_time_b" value="10:00"}selected=""{/eq}>10:00</option>
<option value="10:30" {eq name="$detail.end_time_b" value="10:30"}selected=""{/eq}>10:30</option>
<option value="11:00" {eq name="$detail.end_time_b" value="11:00"}selected=""{/eq}>11:00</option>
<option value="11:30" {eq name="$detail.end_time_b" value="11:30"}selected=""{/eq}>11:30</option>
<option value="12:00" {eq name="$detail.end_time_b" value="12:00"}selected=""{/eq}>12:00</option>
<option value="13:30" {eq name="$detail.end_time_b" value="13:30"}selected=""{/eq}>13:30</option>
<option value="14:00" {eq name="$detail.end_time_b" value="14:00"}selected=""{/eq}>14:00</option>
<option value="14:30" {eq name="$detail.end_time_b" value="14:30"}selected=""{/eq}>14:30</option>
<option value="15:00" {eq name="$detail.end_time_b" value="15:00"}selected=""{/eq}>15:00</option>
<option value="15:30" {eq name="$detail.end_time_b" value="15:30"}selected=""{/eq}>15:30</option>
<option value="16:00" {eq name="$detail.end_time_b" value="16:00"}selected=""{/eq}>16:00</option>
<option value="16:30" {eq name="$detail.end_time_b" value="16:30"}selected=""{/eq}>16:30</option>
<option value="17:00" {eq name="$detail.end_time_b" value="17:00"}selected=""{/eq}>17:00</option>
<option value="17:30" {eq name="$detail.end_time_b" value="17:30"}selected=""{/eq}>17:30</option>
<option value="18:00" {eq name="$detail.end_time_b" value="18:00"}selected=""{/eq}>18:00</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">请假工时</td>
<td colspan="2">共{$detail.duration}工时</td>
<td class="layui-td-gray">请假天数</td>
<td colspan="2">共{$detail.days}天,{$detail.hours}小时</td>
</tr>
<tr>
<td class="layui-td-gray">请假事由<font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入请假理由" class="layui-textarea" lay-verify="required" lay-reqText="请输入请假理由">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="type" value="{$type}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
/**
* 请假工时计算
*/
function leaveTime() {
var data_1 = $('#start_time_a').val();
var data_1_1 = $('#start_time_b').val();
var data_2 = $('#end_time_a').val();
var data_2_1 = $('#end_time_b').val();
if(data_1=='' || data_1_1=='' || data_2=='' || data_2_1==''){
return 0;
}
var start = new Date(data_1+' '+data_1_1);
var end = new Date(data_2+' '+data_2_1);
var startHour = start.getHours(); //16
var startMin = start.getMinutes();
var endHour = end.getHours();
var endMin = end.getMinutes();
var startDate = start.setHours(0, 0, 0);
var endDate = end.setHours(0, 0, 0);
if(endDate<startDate){
return 0;
}
var dayNum = parseInt(Math.abs(endDate - startDate) / 1000 / 60 / 60 / 24);
var hour = 0;
if (startDate == endDate) {
var date = new Date(startDate);
var week = date.getDay();
if (week != 0 && week != 6) {
hour= (endHour-startHour)*10-startMin/6+endMin/6;
if (startHour <= 12 && endHour>12) {
hour= hour-15;
}
}
} else {
for (var i = 0; i <= dayNum; i++) {
var DateTime = startDate + 60 * 60 * 24 * 1000*i
var date = new Date(DateTime);
var week = date.getDay();
if (week != 0 && week != 6) {
if (DateTime == startDate) {
hour+= (18-startHour)*10-(startMin/6);
if (startHour <= 12) {
hour= hour-15;
}
} else if (DateTime > startDate && DateTime < endDate) {
hour += 75;
} else if (DateTime == endDate){
hour+= (endHour-9)*10+endMin/6;
if (endHour > 12) {
hour= hour-15;
}
}
}
}
}
if(hour<0){
hour=0;
}
return hour;
}
const moduleInit = ['tool','formSelects','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, formSelects = layui.formSelects, employeepicker = layui.employeepicker,laydate = layui.laydate;
//日期时间范围
laydate.render({
elem: '#start_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(){
var hours = leaveTime();
if(hours == 0){
$('#hours,#days').html('-');
}
else{
$('#hours').html('共'+hours/10+'小时');
$('[name="duration"]').val(hours/10);
var days = 0;
if(hours>75){
days = parseInt(hours/75);
}
$('#days').html('共'+days+'天,'+(hours%75)/10+'小时');
}
}
});
//日期时间范围
laydate.render({
elem: '#end_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(){
var hours = leaveTime();
if(hours == 0){
$('#hours,#days').html('-');
}
else{
$('#hours').html('共'+hours/10+'小时');
$('[name="duration"]').val(hours/10);
var days = 0;
if(hours>=75){
days = parseInt(hours/75);
}
$('#days').html('共'+days+'天,'+(hours%75)/10+'小时');
}
}
});
form.on('select(time_b)', function(data){
var hours = leaveTime();
if(hours == 0){
$('#hours,#days').html('-');
}
else{
$('#hours').html('共'+hours/10+'小时');
$('[name="duration"]').val(hours/10);
var days = 0;
if(hours>=75){
days = parseInt(hours/75);
}
$('#days').html('共'+days+'天,'+(hours%75)/10+'小时');
}
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
form.on('submit(webform)', function(data){
console.log(data.field);
//return false;
$.ajax({
url: "/oa/approve/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
})
return false;
});
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
}
if(check_type == 1){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -42,29 +42,6 @@
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
@ -116,37 +93,9 @@
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="type" value="{$type}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
{include file="/approve/add_flow" /}
</form>
{/block}
<!-- /主体 -->
@ -154,73 +103,16 @@
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const moduleInit = ['tool','formSelects','employeepicker'];
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,
upload = layui.upload,
tool=layui.tool,
formSelects = layui.formSelects,
employeepicker = layui.employeepicker,
laydate = layui.laydate;
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
laydate = layui.laydate;
if (typeof (flowStep) == "function") {
flowStep();
}
//日期时间范围
laydate.render({
elem: '#detail_time',
@ -228,111 +120,6 @@ const moduleInit = ['tool','formSelects','employeepicker'];
format: 'yyyy-MM-dd',
showBottom: false
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
form.on('submit(webform)', function(data){
console.log(data.field);
//return false;
$.ajax({
url: "/oa/approve/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
})
return false;
});
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
}
if(check_type == 1){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
}
</script>
{/block}

View File

@ -93,29 +93,6 @@
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
@ -218,37 +195,9 @@
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="type" value="{$type}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
{include file="/approve/add_flow" /}
</form>
{/block}
<!-- /主体 -->
@ -256,28 +205,10 @@
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const moduleInit = ['tool','formSelects','employeepicker'];
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,
upload = layui.upload,
tool=layui.tool,
formSelects = layui.formSelects,
employeepicker = layui.employeepicker,
laydate = layui.laydate;
//日期时间范围
@ -295,151 +226,10 @@ const moduleInit = ['tool','formSelects','employeepicker'];
format: 'yyyy-MM-dd',
showBottom: false
});
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/oa/approve/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
})
return false;
});
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
}
if(check_type == 1){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
if (typeof (flowStep) == "function") {
flowStep();
}
}
</script>
{/block}

View File

@ -0,0 +1,230 @@
<table class="layui-table layui-table-form" style="margin-top:12px">
<tr>
<td class="layui-td-gray-2">选择审批流程<font>*</font></td>
<td>
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td>
<input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one" readonly><input type="hidden" name="check_admin_ids" value="" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td>
<input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择审核人" class="layui-input picker-more" readonly><input type="hidden" name="copy_uids" value="" readonly>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="type" value="{$type}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
function flowStep(){
let tool=layui.tool,form = layui.form,upload = layui.upload,employeepicker = layui.employeepicker;
//选择单个员工弹窗
$('body').on('click','.picker-one',function () {
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'';
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names);
that.next().val(ids);
}
});
});
//选择多个员工弹窗
$('body').on('click','.picker-more',function () {
let that = $(this);
let ids=that.next().val()+'',names = that.val()+'',ids_array=[],names_array=[];
if(ids.length>0){
ids_array=ids.split(',');
names_array=names.split(',');
}
employeepicker.init({
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));
}
});
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one"><input type="hidden" name="check_admin_ids" value="">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
$('#flow_tr').html(formHtml);
$('[name="copy_names"]').val('');
$('[name="copy_uids"]').val('');
form.render();
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
$('[name="copy_names"]').val(e.data.copy_unames);
$('[name="copy_uids"]').val(e.data.copy_uids.split(','));
}
if(check_type == 1 || check_type == 3){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(check_type == 1){
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>';
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>';
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
}
else if(check_type == 3){
sign_type= ' <span class="layui-badge layui-bg-blue">'+flow_data[a].flow_name+'</span>'
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="7">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/oa/approve/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
return false;
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
}
</script>

View File

@ -59,29 +59,6 @@
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
@ -150,37 +127,9 @@
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="type" value="{$type}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
{include file="/approve/add_flow" /}
</form>
{/block}
<!-- /主体 -->
@ -188,186 +137,23 @@
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const moduleInit = ['tool','formSelects','employeepicker'];
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,
upload = layui.upload,
tool=layui.tool,
formSelects = layui.formSelects,
employeepicker = layui.employeepicker,
laydate = layui.laydate;
//多附件上传
upload.render({
elem: '#upFile'
,url: "/api/index/upload"
,multiple: true
,accept: 'file' //普通文件
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
,done: function(res){
layer.msg(res.msg);
if (res.code == 0) {
//上传成功
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#fileList input').attr('value', idsArray.join(','));
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
<div class="file-card">
<i class="file-icon layui-icon layui-icon-file"></i>
<div class="file-title">${res.data.name}</div>
<div class="file-tool">
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
</div>
</div>
</div>`;
$('#fileList').append(temp);
}
}
});
$('#fileList').on('click', '.btn-delete', function () {
var _id = $(this).data('id');
var idsStr = $('#fileList input').val(),idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#fileList input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
if (typeof (flowStep) == "function") {
flowStep();
}
//日期时间范围
laydate.render({
elem: '#detail_time',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
form.on('submit(webform)', function(data){
console.log(data.field);
//return false;
$.ajax({
url: "/oa/approve/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
})
return false;
});
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
}
if(check_type == 1){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
});
}
</script>
{/block}

View File

@ -40,29 +40,6 @@
<textarea name="remark" placeholder="请输入备注信息" class="layui-textarea"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
@ -97,37 +74,9 @@
<textarea name="remark" placeholder="请输入备注" class="layui-textarea">{$detail.remark}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">抄送人</td>
<td colspan="5">
<select id="copy_uids" name="copy_uids" xm-selected="" xm-select="selectcopy" xm-select-skin="default"></select>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="type" value="{$type}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
{include file="/approve/add_flow" /}
</form>
{/block}
<!-- /主体 -->
@ -135,10 +84,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','formSelects','employeepicker'];
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, formSelects = layui.formSelects, employeepicker = layui.employeepicker,laydate = layui.laydate;
var form = layui.form,tool=layui.tool, employeepicker = layui.employeepicker,laydate = layui.laydate;
if (typeof (flowStep) == "function") {
flowStep();
}
//日期时间范围
laydate.render({
elem: '#detail_time',
@ -146,109 +97,6 @@ const moduleInit = ['tool','formSelects','employeepicker'];
format: 'yyyy-MM-dd',
showBottom: false
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/oa/approve/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close(1000);
}
}
})
return false;
});
//选择抄送人员
var copy_uids = $('#copy_uids').attr('xm-selected');
formSelects.data('selectcopy', 'server', {
url: '/api/index/get_employee_select',
keyword: copy_uids,
});
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input">\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
if(data.value==''){
return false;
}
$.ajax({
url: "/api/index/get_flow_users",
type:'get',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
var flow_data = e.data.flow_data;
if(e.data.copy_uids && e.data.copy_uids !=''){
formSelects.value('selectcopy', e.data.copy_uids.split(','));
}
if(check_type == 1){
for(var a=0;a<flow_data.length;a++){
var userList='',sign_type = '';
if(flow_data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(flow_data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(flow_data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(flow_data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<flow_data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
}
})
});
}
</script>
{/block}

Some files were not shown because too many files have changed in this diff Show More