This commit is contained in:
2026-07-22 18:04:17 +08:00
parent 07c5027ad8
commit da58dc92d0
19 changed files with 2105 additions and 148 deletions
+4
View File
@@ -95,6 +95,10 @@ namespace Model
public virtual DbSet<AncestralTabletStatus> AncestralTabletStatus { get; set; } public virtual DbSet<AncestralTabletStatus> AncestralTabletStatus { get; set; }
public virtual DbSet<GuaDanOrderGuest> GuaDanOrderGuest { get; set; } public virtual DbSet<GuaDanOrderGuest> GuaDanOrderGuest { get; set; }
public virtual DbSet<auto_enroll> auto_enroll { get; set; } public virtual DbSet<auto_enroll> auto_enroll { get; set; }
public virtual DbSet<receipt_detail> receipt_detail { get; set; }
public virtual DbSet<receipt_master> receipt_master { get; set; }
public virtual DbSet<receipt_style> receipt_style { get; set; }
public virtual DbSet<receipt_style_d> receipt_style_d { get; set; }
public virtual int pager_eztrust(Nullable<int> startRowIndex, Nullable<int> pageSize, string tableName, string columnName, string sqlWhere, string orderBy, ObjectParameter rowCount) public virtual int pager_eztrust(Nullable<int> startRowIndex, Nullable<int> pageSize, string tableName, string columnName, string sqlWhere, string orderBy, ObjectParameter rowCount)
{ {
+81 -2
View File
@@ -694,8 +694,8 @@ namespace Model
public int num { get; set; } public int num { get; set; }
public int f_num { get; set; } public int f_num { get; set; }
public System.DateTime start_date { get; set; } public Nullable<System.DateTime> start_date { get; set; }
public System.DateTime end_date { get; set; } public Nullable<System.DateTime> end_date { get; set; }
public string receipt_title { get; set; } public string receipt_title { get; set; }
public string receipt_address { get; set; } public string receipt_address { get; set; }
@@ -1539,6 +1539,85 @@ namespace Model
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
public partial class receipt_detail
{
public int num { get; set; }
public Nullable<int> receipt_num { get; set; }
public string title { get; set; }
public Nullable<int> amt { get; set; }
public string receipt_no { get; set; }
public string caseofficer { get; set; }
public string c_user { get; set; }
public string c_date { get; set; }
public string c_time { get; set; }
public string u_user { get; set; }
public string u_date { get; set; }
public string u_time { get; set; }
public string addr { get; set; }
}
}
namespace Model
{
using System;
using System.Collections.Generic;
public partial class receipt_master
{
public int num { get; set; }
public string order_no { get; set; }
public Nullable<int> total_amt { get; set; }
public string receipt_date { get; set; }
public Nullable<int> style_num { get; set; }
public string c_user { get; set; }
public string c_date { get; set; }
public string c_time { get; set; }
public string u_user { get; set; }
public string u_date { get; set; }
public string u_time { get; set; }
public string source { get; set; }
}
}
namespace Model
{
using System;
using System.Collections.Generic;
public partial class receipt_style
{
public int num { get; set; }
public string name { get; set; }
public string c_user { get; set; }
public string c_date { get; set; }
public string c_time { get; set; }
public string u_user { get; set; }
public string u_date { get; set; }
public string u_time { get; set; }
}
}
namespace Model
{
using System;
using System.Collections.Generic;
public partial class receipt_style_d
{
public int num { get; set; }
public Nullable<int> style_num { get; set; }
public string item_name { get; set; }
public string item_value { get; set; }
public string c_user { get; set; }
public string c_date { get; set; }
public string c_time { get; set; }
public string u_user { get; set; }
public string u_date { get; set; }
public string u_time { get; set; }
}
}
namespace Model
{
using System;
using System.Collections.Generic;
public partial class Region public partial class Region
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+215 -14
View File
@@ -343,10 +343,10 @@
</Key> </Key>
<Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" /> <Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="f_num" Type="int" Nullable="false" /> <Property Name="f_num" Type="int" Nullable="false" />
<Property Name="start_date" Type="date" Nullable="false" /> <Property Name="start_date" Type="date" />
<Property Name="end_date" Type="date" Nullable="false" /> <Property Name="end_date" Type="date" />
<Property Name="receipt_title" Type="nvarchar(max)" /> <Property Name="receipt_title" Type="nvarchar(max)" />
<Property Name="receipt_address" Type="nchar" MaxLength="200" /> <Property Name="receipt_address" Type="nvarchar" MaxLength="200" />
</EntityType> </EntityType>
<EntityType Name="bed_kind"> <EntityType Name="bed_kind">
<Key> <Key>
@@ -419,7 +419,7 @@
<Property Name="smtp_def" Type="nvarchar" MaxLength="1" /> <Property Name="smtp_def" Type="nvarchar" MaxLength="1" />
<Property Name="use_sender" Type="nvarchar" MaxLength="1" /> <Property Name="use_sender" Type="nvarchar" MaxLength="1" />
<Property Name="bed_order_no" Type="nvarchar" MaxLength="20" /> <Property Name="bed_order_no" Type="nvarchar" MaxLength="20" />
<Property Name="last_auto_order_no" Type="nvarchar" MaxLength="20" /> <Property Name="last_auto_order_no" Type="varchar" MaxLength="20" />
</EntityType> </EntityType>
<EntityType Name="country"> <EntityType Name="country">
<Key> <Key>
@@ -795,6 +795,69 @@
<Property Name="pic1" Type="nvarchar" MaxLength="50" /> <Property Name="pic1" Type="nvarchar" MaxLength="50" />
<Property Name="pro_id" Type="int" /> <Property Name="pro_id" Type="int" />
</EntityType> </EntityType>
<EntityType Name="receipt_detail">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="receipt_num" Type="int" />
<Property Name="title" Type="nvarchar(max)" />
<Property Name="amt" Type="int" />
<Property Name="receipt_no" Type="varchar" MaxLength="50" />
<Property Name="caseofficer" Type="nvarchar" MaxLength="50" />
<Property Name="c_user" Type="varchar" MaxLength="30" />
<Property Name="c_date" Type="varchar" MaxLength="10" />
<Property Name="c_time" Type="varchar" MaxLength="6" />
<Property Name="u_user" Type="varchar" MaxLength="30" />
<Property Name="u_date" Type="varchar" MaxLength="10" />
<Property Name="u_time" Type="varchar" MaxLength="6" />
<Property Name="addr" Type="nvarchar" MaxLength="255" />
</EntityType>
<EntityType Name="receipt_master">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="order_no" Type="varchar" MaxLength="50" />
<Property Name="total_amt" Type="int" />
<Property Name="receipt_date" Type="varchar" MaxLength="10" />
<Property Name="style_num" Type="int" />
<Property Name="c_user" Type="varchar" MaxLength="30" />
<Property Name="c_date" Type="varchar" MaxLength="10" />
<Property Name="c_time" Type="varchar" MaxLength="6" />
<Property Name="u_user" Type="varchar" MaxLength="30" />
<Property Name="u_date" Type="varchar" MaxLength="10" />
<Property Name="u_time" Type="varchar" MaxLength="6" />
<Property Name="source" Type="varchar" MaxLength="8" />
</EntityType>
<EntityType Name="receipt_style">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="name" Type="nvarchar" MaxLength="50" />
<Property Name="c_user" Type="varchar" MaxLength="30" />
<Property Name="c_date" Type="varchar" MaxLength="10" />
<Property Name="c_time" Type="varchar" MaxLength="6" />
<Property Name="u_user" Type="varchar" MaxLength="30" />
<Property Name="u_date" Type="varchar" MaxLength="10" />
<Property Name="u_time" Type="varchar" MaxLength="6" />
</EntityType>
<EntityType Name="receipt_style_d">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="style_num" Type="int" />
<Property Name="item_name" Type="varchar" MaxLength="50" />
<Property Name="item_value" Type="nvarchar" MaxLength="50" />
<Property Name="c_user" Type="varchar" MaxLength="30" />
<Property Name="c_date" Type="varchar" MaxLength="10" />
<Property Name="c_time" Type="varchar" MaxLength="6" />
<Property Name="u_user" Type="varchar" MaxLength="30" />
<Property Name="u_date" Type="varchar" MaxLength="10" />
<Property Name="u_time" Type="varchar" MaxLength="6" />
</EntityType>
<EntityType Name="Region"> <EntityType Name="Region">
<Key> <Key>
<PropertyRef Name="Uuid" /> <PropertyRef Name="Uuid" />
@@ -1140,15 +1203,15 @@
</Dependent> </Dependent>
</ReferentialConstraint> </ReferentialConstraint>
</Association> </Association>
<Association Name="FK_activity_activity_category_kind"> <Association Name="FK_activity_activity_kind">
<End Role="activity_category_kind" Type="Self.activity_category_kind" Multiplicity="0..1" /> <End Role="activity_kind" Type="Self.activity_kind" Multiplicity="0..1" />
<End Role="activity" Type="Self.activity" Multiplicity="*" /> <End Role="activity" Type="Self.activity" Multiplicity="*" />
<ReferentialConstraint> <ReferentialConstraint>
<Principal Role="activity_category_kind"> <Principal Role="activity_kind">
<PropertyRef Name="num" /> <PropertyRef Name="num" />
</Principal> </Principal>
<Dependent Role="activity"> <Dependent Role="activity">
<PropertyRef Name="category_kind" /> <PropertyRef Name="kind" />
</Dependent> </Dependent>
</ReferentialConstraint> </ReferentialConstraint>
</Association> </Association>
@@ -2188,6 +2251,10 @@
<EntitySet Name="project" EntityType="Self.project" Schema="dbo" store:Type="Tables" /> <EntitySet Name="project" EntityType="Self.project" Schema="dbo" store:Type="Tables" />
<EntitySet Name="project_kind" EntityType="Self.project_kind" Schema="dbo" store:Type="Tables" /> <EntitySet Name="project_kind" EntityType="Self.project_kind" Schema="dbo" store:Type="Tables" />
<EntitySet Name="project_sub" EntityType="Self.project_sub" Schema="dbo" store:Type="Tables" /> <EntitySet Name="project_sub" EntityType="Self.project_sub" Schema="dbo" store:Type="Tables" />
<EntitySet Name="receipt_detail" EntityType="Self.receipt_detail" Schema="dbo" store:Type="Tables" />
<EntitySet Name="receipt_master" EntityType="Self.receipt_master" Schema="dbo" store:Type="Tables" />
<EntitySet Name="receipt_style" EntityType="Self.receipt_style" Schema="dbo" store:Type="Tables" />
<EntitySet Name="receipt_style_d" EntityType="Self.receipt_style_d" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Region" EntityType="Self.Region" Schema="dbo" store:Type="Tables" /> <EntitySet Name="Region" EntityType="Self.Region" Schema="dbo" store:Type="Tables" />
<EntitySet Name="RegionAndRoomAndBedSchedule" EntityType="Self.RegionAndRoomAndBedSchedule" Schema="dbo" store:Type="Tables" /> <EntitySet Name="RegionAndRoomAndBedSchedule" EntityType="Self.RegionAndRoomAndBedSchedule" Schema="dbo" store:Type="Tables" />
<EntitySet Name="RegionRoomBed" EntityType="Self.RegionRoomBed" Schema="dbo" store:Type="Tables" /> <EntitySet Name="RegionRoomBed" EntityType="Self.RegionRoomBed" Schema="dbo" store:Type="Tables" />
@@ -2246,8 +2313,8 @@
<End Role="actItem" EntitySet="actItem" /> <End Role="actItem" EntitySet="actItem" />
<End Role="actItem_files" EntitySet="actItem_files" /> <End Role="actItem_files" EntitySet="actItem_files" />
</AssociationSet> </AssociationSet>
<AssociationSet Name="FK_activity_activity_category_kind" Association="Self.FK_activity_activity_category_kind"> <AssociationSet Name="FK_activity_activity_kind" Association="Self.FK_activity_activity_kind">
<End Role="activity_category_kind" EntitySet="activity_category_kind" /> <End Role="activity_kind" EntitySet="activity_kind" />
<End Role="activity" EntitySet="activity" /> <End Role="activity" EntitySet="activity" />
</AssociationSet> </AssociationSet>
<AssociationSet Name="FK_activity_check_activity" Association="Self.FK_activity_check_activity"> <AssociationSet Name="FK_activity_check_activity" Association="Self.FK_activity_check_activity">
@@ -2953,7 +3020,7 @@
<Property Name="smtp_def" Type="String" MaxLength="1" FixedLength="false" Unicode="true" /> <Property Name="smtp_def" Type="String" MaxLength="1" FixedLength="false" Unicode="true" />
<Property Name="use_sender" Type="String" MaxLength="1" FixedLength="false" Unicode="true" /> <Property Name="use_sender" Type="String" MaxLength="1" FixedLength="false" Unicode="true" />
<Property Name="bed_order_no" Type="String" MaxLength="20" FixedLength="false" Unicode="true" /> <Property Name="bed_order_no" Type="String" MaxLength="20" FixedLength="false" Unicode="true" />
<Property Name="last_auto_order_no" Type="String" MaxLength="20" FixedLength="false" Unicode="true" /> <Property Name="last_auto_order_no" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
</EntityType> </EntityType>
<EntityType Name="country"> <EntityType Name="country">
<Key> <Key>
@@ -4620,6 +4687,10 @@
<End Role="auto_enroll" EntitySet="auto_enroll" /> <End Role="auto_enroll" EntitySet="auto_enroll" />
<End Role="pro_order" EntitySet="pro_order" /> <End Role="pro_order" EntitySet="pro_order" />
</AssociationSet> </AssociationSet>
<EntitySet Name="receipt_detail" EntityType="Model.receipt_detail" />
<EntitySet Name="receipt_master" EntityType="Model.receipt_master" />
<EntitySet Name="receipt_style" EntityType="Model.receipt_style" />
<EntitySet Name="receipt_style_d" EntityType="Model.receipt_style_d" />
</EntityContainer> </EntityContainer>
<ComplexType Name="sp_helpdiagramdefinition_Result"> <ComplexType Name="sp_helpdiagramdefinition_Result">
<Property Type="Int32" Name="version" Nullable="true" /> <Property Type="Int32" Name="version" Nullable="true" />
@@ -5343,10 +5414,10 @@
</Key> </Key>
<Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" /> <Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="f_num" Type="Int32" Nullable="false" /> <Property Name="f_num" Type="Int32" Nullable="false" />
<Property Name="start_date" Type="DateTime" Precision="0" Nullable="false" /> <Property Name="start_date" Type="DateTime" Precision="0" />
<Property Name="end_date" Type="DateTime" Precision="0" Nullable="false" /> <Property Name="end_date" Type="DateTime" Precision="0" />
<Property Name="receipt_title" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" /> <Property Name="receipt_title" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="receipt_address" Type="String" MaxLength="200" FixedLength="true" Unicode="true" /> <Property Name="receipt_address" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
<NavigationProperty Name="followers" Relationship="Model.FK_auto_enroll_followers" FromRole="auto_enroll" ToRole="follower" /> <NavigationProperty Name="followers" Relationship="Model.FK_auto_enroll_followers" FromRole="auto_enroll" ToRole="follower" />
<NavigationProperty Name="pro_order" Relationship="Model.FK_pro_order_auto_enroll" FromRole="auto_enroll" ToRole="pro_order" /> <NavigationProperty Name="pro_order" Relationship="Model.FK_pro_order_auto_enroll" FromRole="auto_enroll" ToRole="pro_order" />
</EntityType> </EntityType>
@@ -5376,6 +5447,69 @@
</Dependent> </Dependent>
</ReferentialConstraint> </ReferentialConstraint>
</Association> </Association>
<EntityType Name="receipt_detail">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="receipt_num" Type="Int32" />
<Property Name="title" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="amt" Type="Int32" />
<Property Name="receipt_no" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="caseofficer" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="c_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="c_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="c_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
<Property Name="u_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="u_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="u_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
<Property Name="addr" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="receipt_master">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="order_no" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="total_amt" Type="Int32" />
<Property Name="receipt_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="style_num" Type="Int32" />
<Property Name="c_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="c_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="c_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
<Property Name="u_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="u_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="u_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
<Property Name="source" Type="String" MaxLength="8" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="receipt_style">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="c_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="c_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="c_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
<Property Name="u_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="u_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="u_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="receipt_style_d">
<Key>
<PropertyRef Name="num" />
</Key>
<Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="style_num" Type="Int32" />
<Property Name="item_name" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="item_value" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="c_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="c_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="c_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
<Property Name="u_user" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
<Property Name="u_date" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="u_time" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
</EntityType>
</Schema> </Schema>
</edmx:ConceptualModels> </edmx:ConceptualModels>
<!-- C-S mapping content --> <!-- C-S mapping content -->
@@ -6447,6 +6581,73 @@
</MappingFragment> </MappingFragment>
</EntityTypeMapping> </EntityTypeMapping>
</EntitySetMapping> </EntitySetMapping>
<EntitySetMapping Name="receipt_detail">
<EntityTypeMapping TypeName="Model.receipt_detail">
<MappingFragment StoreEntitySet="receipt_detail">
<ScalarProperty Name="addr" ColumnName="addr" />
<ScalarProperty Name="u_time" ColumnName="u_time" />
<ScalarProperty Name="u_date" ColumnName="u_date" />
<ScalarProperty Name="u_user" ColumnName="u_user" />
<ScalarProperty Name="c_time" ColumnName="c_time" />
<ScalarProperty Name="c_date" ColumnName="c_date" />
<ScalarProperty Name="c_user" ColumnName="c_user" />
<ScalarProperty Name="caseofficer" ColumnName="caseofficer" />
<ScalarProperty Name="receipt_no" ColumnName="receipt_no" />
<ScalarProperty Name="amt" ColumnName="amt" />
<ScalarProperty Name="title" ColumnName="title" />
<ScalarProperty Name="receipt_num" ColumnName="receipt_num" />
<ScalarProperty Name="num" ColumnName="num" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="receipt_master">
<EntityTypeMapping TypeName="Model.receipt_master">
<MappingFragment StoreEntitySet="receipt_master">
<ScalarProperty Name="source" ColumnName="source" />
<ScalarProperty Name="u_time" ColumnName="u_time" />
<ScalarProperty Name="u_date" ColumnName="u_date" />
<ScalarProperty Name="u_user" ColumnName="u_user" />
<ScalarProperty Name="c_time" ColumnName="c_time" />
<ScalarProperty Name="c_date" ColumnName="c_date" />
<ScalarProperty Name="c_user" ColumnName="c_user" />
<ScalarProperty Name="style_num" ColumnName="style_num" />
<ScalarProperty Name="receipt_date" ColumnName="receipt_date" />
<ScalarProperty Name="total_amt" ColumnName="total_amt" />
<ScalarProperty Name="order_no" ColumnName="order_no" />
<ScalarProperty Name="num" ColumnName="num" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="receipt_style">
<EntityTypeMapping TypeName="Model.receipt_style">
<MappingFragment StoreEntitySet="receipt_style">
<ScalarProperty Name="u_time" ColumnName="u_time" />
<ScalarProperty Name="u_date" ColumnName="u_date" />
<ScalarProperty Name="u_user" ColumnName="u_user" />
<ScalarProperty Name="c_time" ColumnName="c_time" />
<ScalarProperty Name="c_date" ColumnName="c_date" />
<ScalarProperty Name="c_user" ColumnName="c_user" />
<ScalarProperty Name="name" ColumnName="name" />
<ScalarProperty Name="num" ColumnName="num" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="receipt_style_d">
<EntityTypeMapping TypeName="Model.receipt_style_d">
<MappingFragment StoreEntitySet="receipt_style_d">
<ScalarProperty Name="u_time" ColumnName="u_time" />
<ScalarProperty Name="u_date" ColumnName="u_date" />
<ScalarProperty Name="u_user" ColumnName="u_user" />
<ScalarProperty Name="c_time" ColumnName="c_time" />
<ScalarProperty Name="c_date" ColumnName="c_date" />
<ScalarProperty Name="c_user" ColumnName="c_user" />
<ScalarProperty Name="item_value" ColumnName="item_value" />
<ScalarProperty Name="item_name" ColumnName="item_name" />
<ScalarProperty Name="style_num" ColumnName="style_num" />
<ScalarProperty Name="num" ColumnName="num" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping> </EntityContainerMapping>
</Mapping> </Mapping>
</edmx:Mappings> </edmx:Mappings>
+4
View File
@@ -165,6 +165,10 @@
<EntityTypeShape EntityType="Model.auto_enroll" Width="1.5" PointX="5.25" PointY="37.875" /> <EntityTypeShape EntityType="Model.auto_enroll" Width="1.5" PointX="5.25" PointY="37.875" />
<AssociationConnector Association="Model.FK_auto_enroll_followers" /> <AssociationConnector Association="Model.FK_auto_enroll_followers" />
<AssociationConnector Association="Model.FK_pro_order_auto_enroll" /> <AssociationConnector Association="Model.FK_pro_order_auto_enroll" />
<EntityTypeShape EntityType="Model.receipt_detail" Width="1.5" PointX="23.375" PointY="7.75" />
<EntityTypeShape EntityType="Model.receipt_master" Width="1.5" PointX="25.375" PointY="7.75" />
<EntityTypeShape EntityType="Model.receipt_style" Width="1.5" PointX="19.375" PointY="25.75" />
<EntityTypeShape EntityType="Model.receipt_style_d" Width="1.5" PointX="26.375" PointY="0.75" />
</Diagram> </Diagram>
</edmx:Diagrams> </edmx:Diagrams>
</edmx:Designer> </edmx:Designer>
+42
View File
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Model.ViewModel
{
/// <summary>
/// receipt 的摘要描述
/// </summary>
public class receipt_master
{
public receipt_master()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
public int? num { get; set; }
public string order_no { get; set; }
public int? total_amt { get; set; }
public int? style_num { get; set; }
public string source { get; set; }
public string receipt_date { get; set; }
public List<receipt_detail> list { get;set ; }
}
public class receipt_detail
{
public receipt_detail()
{
}
public int? num { get; set; }
public int? receipt_num { get; set; }
public string title { get; set; }
public string receipt_no { get; set; }
public int? amt { get; set; }
public string caseofficer { get; set; }
public string addr { get; set; }
}
}
+6 -6
View File
@@ -738,8 +738,8 @@ public class FollowerController : ApiController
list = prod.Select(x => new list = prod.Select(x => new
{ {
num = x.num, num = x.num,
auto_enroll_start_date = x.start_date.ToString("yyyy-MM-dd"), auto_enroll_start_date = x.start_date.Value.ToString("yyyy-MM-dd"),
auto_enroll_end_date = x.end_date.ToString("yyyy-MM-dd"), auto_enroll_end_date = x.end_date.Value.ToString("yyyy-MM-dd"),
auto_enroll_receipt_title = x.receipt_title?? "", auto_enroll_receipt_title = x.receipt_title?? "",
auto_enroll_receipt_address = x.receipt_address?? "", auto_enroll_receipt_address = x.receipt_address?? "",
}), }),
@@ -768,7 +768,7 @@ public class FollowerController : ApiController
; ;
_db.auto_enroll.Add(autoEnroll); _db.auto_enroll.Add(autoEnroll);
_db.SaveChanges(); _db.SaveChanges();
CreateOrdersForActivities(item.f_num, autoEnroll.num, item.start_date, item.end_date, item.receipt_title, item.receipt_address); CreateOrdersForActivities(item.f_num, autoEnroll.num, item.start_date.Value, item.end_date.Value, item.receipt_title, item.receipt_address);
} }
else else
{ {
@@ -781,7 +781,7 @@ public class FollowerController : ApiController
autoEnroll.receipt_title = item.receipt_title?.Trim() ?? null; autoEnroll.receipt_title = item.receipt_title?.Trim() ?? null;
autoEnroll.receipt_address = item.receipt_address?.Trim() ?? null; autoEnroll.receipt_address = item.receipt_address?.Trim() ?? null;
_db.SaveChanges(); _db.SaveChanges();
CreateOrdersForActivities(item.f_num, autoEnroll.num, item.start_date, item.end_date, item.receipt_title, item.receipt_address); CreateOrdersForActivities(item.f_num, autoEnroll.num, item.start_date.Value, item.end_date.Value, item.receipt_title, item.receipt_address);
} }
try try
@@ -789,8 +789,8 @@ public class FollowerController : ApiController
var ret = new var ret = new
{ {
num = autoEnroll.num, num = autoEnroll.num,
start_date = autoEnroll.start_date.ToString("yyyy-MM-dd"), start_date = autoEnroll.start_date.Value.ToString("yyyy-MM-dd"),
end_date = autoEnroll.end_date.ToString("yyyy-MM-dd"), end_date = autoEnroll.end_date.Value.ToString("yyyy-MM-dd"),
receipt_title = autoEnroll.receipt_title, receipt_title = autoEnroll.receipt_title,
receipt_address = autoEnroll.receipt_address, receipt_address = autoEnroll.receipt_address,
}; };
+4
View File
@@ -391,6 +391,7 @@ public class orderController : ApiController
o_detail.qty = detail.qty; o_detail.qty = detail.qty;
o_detail.printed_files = detail.printed_files; o_detail.printed_files = detail.printed_files;
o_detail.style = detail.style; o_detail.style = detail.style;
o_detail.print_id = GenerateSequentialId(o_detail, order);
Newtonsoft.Json.Linq.JArray mid_items = new Newtonsoft.Json.Linq.JArray(); Newtonsoft.Json.Linq.JArray mid_items = new Newtonsoft.Json.Linq.JArray();
foreach (var data in detail.mid_items) foreach (var data in detail.mid_items)
{ {
@@ -514,6 +515,8 @@ public class orderController : ApiController
qry = qry.Where(o => o.f_num != null && o.follower != null && encrypt.DecryptAutoKey(o.follower.id_code) == q.f_user.id_code); qry = qry.Where(o => o.f_num != null && o.follower != null && encrypt.DecryptAutoKey(o.follower.id_code) == q.f_user.id_code);
} }
sortBy = sortBy ?? string.Empty;
if (sortBy.Equals("order_no")) if (sortBy.Equals("order_no"))
{ {
if (sortDesc) if (sortDesc)
@@ -580,6 +583,7 @@ public class orderController : ApiController
uptime=x.up_time?.ToString("yyyy-MM-dd"), uptime=x.up_time?.ToString("yyyy-MM-dd"),
keyin1_txt = Model.pro_order.keyin1_value_to_text(x.keyin1), keyin1_txt = Model.pro_order.keyin1_value_to_text(x.keyin1),
status = x.activity.activity_check.FirstOrDefault(a => x.activity_num == a.activity_num && x.f_num == a.f_num)?.status ?? 0, status = x.activity.activity_check.FirstOrDefault(a => x.activity_num == a.activity_num && x.f_num == a.f_num)?.status ?? 0,
amt = _db.pro_order_detail.Where(y => y.order_no == x.order_no).Select(y => new {y.price,y.qty}).Sum(y => y.price*y.qty),
}), }),
count = count count = count
}; };
+481
View File
@@ -0,0 +1,481 @@
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Drawing;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Vml;
using DocumentFormat.OpenXml.Wordprocessing;
using Model;
using NPOI.OpenXmlFormats.Wordprocessing;
using NPOI.Util;
using PagedList;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Web.Http;
using System.Web.UI.WebControls;
using Break = DocumentFormat.OpenXml.Wordprocessing.Break;
using Paragraph = DocumentFormat.OpenXml.Wordprocessing.Paragraph;
using Run = DocumentFormat.OpenXml.Wordprocessing.Run;
using Table = DocumentFormat.OpenXml.Wordprocessing.Table;
using Text = DocumentFormat.OpenXml.Wordprocessing.Text;
/// <summary>
/// receiptController 的摘要描述
/// </summary>
[ezAuthorize]
public class receiptController: ApiController
{
private Model.ezEntities _db = new Model.ezEntities();
public receiptController()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
public string generend_receiptNo(string source)
{
string start = source + "A";
string no = start + DateTime.Now.ToString("yyyyMMdd");
var qry = _db.receipt_detail.Where(x => x.receipt_no.StartsWith(no));
var receipt_no=qry.Select(x => x.receipt_no).Max();
if (!string.IsNullOrEmpty(receipt_no))
{
receipt_no= receipt_no.Remove(0,(start + DateTime.Now.ToString("yyyyMMdd")).Length);
return start + DateTime.Now.ToString("yyyyMMdd")+string.Format("{0:D4}", Int32.Parse(receipt_no)+1);
}
else
{
return start + DateTime.Now.ToString("yyyyMMdd") + "0001";
}
}
[HttpPost]
[Route("api/receipt/UpdateReceiptWithDetail")]
public IHttpActionResult UpdateReceiptWithDetail([FromBody] Model.ViewModel.receipt_master receipt)
{
int master_no = 0;
try
{
//Model.receipt_master m = new Model.receipt_master();
List<Model.receipt_detail> list = new List<Model.receipt_detail>();
var master = _db.receipt_master.Where(x => x.num == receipt.num).FirstOrDefault();
if (master != null)
{
master.u_time = DateTime.Now.ToString("HHmmss");
master.u_date = DateTime.Now.ToString("yyyyMMdd");
}
master_no=master.num;
//m.receipt_date = receipt.receipt_date;
//m.order_no = receipt.order_no;
//m.total_amt = receipt.total_amt;
//m.style_num = receipt.style_num;
//m.source = receipt.source;
//m.num=(int)receipt.num;
//m.c_date = DateTime.Now.ToString("yyyyMMdd");
//m.c_time = DateTime.Now.ToString("HHmmss");
//m.u_time = DateTime.Now.ToString("HHmmss");
//m.u_date = DateTime.Now.ToString("yyyyMMdd");
//_db.receipt_master.Add(m);
//_db.SaveChanges();
//master_no = m.num;
string pre_no = string.Empty;
foreach (var d in receipt.list)
{
if (d.num == 0)
{
receipt_detail dd = new receipt_detail();
if (string.IsNullOrEmpty(pre_no))
{
dd.receipt_no = generend_receiptNo(master.source);
}
else
{
string new_no = pre_no.Remove(0, 10);
dd.receipt_no = master.source + "A" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", Int32.Parse(new_no) + 1);
}
dd.addr = d.addr;
dd.title = d.title;
dd.amt = d.amt;
dd.caseofficer = d.caseofficer;
dd.receipt_num = master.num;
dd.c_date = DateTime.Now.ToString("yyyyMMdd");
dd.c_time = DateTime.Now.ToString("HHmmss");
dd.u_time = DateTime.Now.ToString("HHmmss");
dd.u_date = DateTime.Now.ToString("yyyyMMdd");
pre_no = dd.receipt_no;
list.Add(dd);
}
else
{
var dd=_db.receipt_detail.Where(x=>x.num==d.num).FirstOrDefault();
dd.title=d.title;
dd.amt=d.amt;
dd.caseofficer=d.caseofficer;
dd.u_time = DateTime.Now.ToString("HHmmss");
dd.u_date = DateTime.Now.ToString("yyyyMMdd");
}
}
_db.receipt_detail.AddRange(list);
_db.SaveChanges();
return Ok(new { result = "Y", message = "存檔成功" });
}
catch (Exception ex)
{
var s = _db.receipt_master.Where(x => x.num == master_no).FirstOrDefault();
if (s != null)
{
_db.receipt_master.Remove(s);
_db.SaveChanges();
}
return Ok(new { result = "N", message = $"存檔失敗,{ex.Message} {ex.StackTrace}" });
}
}
[HttpPost]
[Route("api/receipt/SaveReceiptWithDetail")]
public IHttpActionResult SaveReceiptWithDetail([FromBody] Model.ViewModel.receipt_master receipt)
{
int master_no = 0;
try
{
Model.receipt_master m = new Model.receipt_master();
List<Model.receipt_detail> list = new List<Model.receipt_detail>();
m.receipt_date = receipt.receipt_date;
m.order_no = receipt.order_no;
m.total_amt = receipt.total_amt;
m.style_num = receipt.style_num;
m.source = receipt.source;
m.c_date = DateTime.Now.ToString("yyyyMMdd");
m.c_time = DateTime.Now.ToString("HHmmss");
m.u_time= DateTime.Now.ToString("HHmmss");
m.u_date = DateTime.Now.ToString("yyyyMMdd");
_db.receipt_master.Add(m);
_db.SaveChanges();
master_no = m.num;
string pre_no = string.Empty;
foreach (var d in receipt.list)
{
receipt_detail dd = new receipt_detail();
if (string.IsNullOrEmpty(pre_no))
{
dd.receipt_no = generend_receiptNo(m.source);
}
else
{
string new_no = pre_no.Remove(0,10);
dd.receipt_no = m.source + "A" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", Int32.Parse(new_no)+1);
}
dd.addr = d.addr;
dd.title = d.title;
dd.amt = d.amt;
dd.caseofficer = d.caseofficer;
dd.receipt_num = m.num;
dd.c_date = DateTime.Now.ToString("yyyyMMdd");
dd.c_time = DateTime.Now.ToString("HHmmss");
dd.u_time = DateTime.Now.ToString("HHmmss");
dd.u_date = DateTime.Now.ToString("yyyyMMdd");
pre_no = dd.receipt_no;
list.Add(dd);
}
_db.receipt_detail.AddRange(list);
_db.SaveChanges();
return Ok(new {result="Y",message="存檔成功"});
}
catch (Exception ex)
{
var s=_db.receipt_master.Where(x=>x.num==master_no).FirstOrDefault();
if (s != null)
{
_db.receipt_master.Remove(s);
_db.SaveChanges();
}
return Ok(new { result = "N", message = $"存檔失敗,{ex.Message} {ex.StackTrace}" });
}
}
[HttpPost]
[Route("api/receipt/GetList")]
public IHttpActionResult GetList([FromBody] Model.ViewModel.receipt_master r,
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
{
var qry = _db.receipt_master.AsQueryable();
if (r.num.HasValue)
qry = qry.Where(x => x.num == r.num.Value);
if (!string.IsNullOrEmpty(r.receipt_date))
qry = qry.Where(x=>x.receipt_date==r.receipt_date);
if (!string.IsNullOrEmpty(r.source))
qry = qry.Where(x => x.source == r.source);
if (!string.IsNullOrEmpty(r.order_no))
qry = qry.Where(x => x.order_no == r.order_no);
qry=qry.OrderBy(x => x.num);
var count = qry.Count();
var qryList = (pageSize > 0) ? qry.ToPagedList(page, pageSize).ToList() : qry.ToList();
var ret = new
{
list = qryList.Select(x => new
{
x.num,x.source,x.order_no,x.total_amt,x.receipt_date,x.style_num,
follower=_db.pro_order.Where(y=>y.order_no==x.order_no).Select(y=>new {
u_name=_db.followers.Where(z=>z.num==y.f_num).Select(z=>z.u_name).FirstOrDefault(),
}).FirstOrDefault(),
receipt_count=_db.receipt_detail.Where(w=>w.receipt_num==x.num).Count()
}),
count=count
};
if (ret.list == null) throw new HttpResponseException(HttpStatusCode.NotFound);
return Ok(ret);
}
[HttpPost]
[Route("api/receipt/GetData")]
public IHttpActionResult GetData([FromBody] Model.ViewModel.receipt_master r)
{
var qry = _db.receipt_master.AsQueryable();
if (r.num.HasValue)
qry = qry.Where(x => x.num == r.num.Value);
if (!string.IsNullOrEmpty(r.receipt_date))
qry = qry.Where(x => x.receipt_date == r.receipt_date);
if (!string.IsNullOrEmpty(r.source))
qry = qry.Where(x => x.source == r.source);
if (!string.IsNullOrEmpty(r.order_no))
qry = qry.Where(x => x.order_no == r.order_no);
qry = qry.OrderBy(x => x.num);
var ret = new
{
data = qry.Select(x => new
{
x.num,
x.source,
x.order_no,
x.total_amt,
x.receipt_date,
x.style_num,
follower = _db.pro_order.Where(y => y.order_no == x.order_no).Select(y => new {
u_name = _db.followers.Where(z => z.num == y.f_num).Select(z => z.u_name).FirstOrDefault(),
}).FirstOrDefault(),
receipt_detail = _db.receipt_detail.Where(w => w.receipt_num == x.num).ToList(),
orderdetails=_db.pro_order_detail.Where(q=>q.order_no==x.order_no).Select(q=>new
{
records=_db.pro_order_record.Where(rc=>rc.detail_num==q.num).Select(rc=>rc.price).ToList(),
}).ToList()
}).FirstOrDefault(),
};
if (ret.data == null) throw new HttpResponseException(HttpStatusCode.NotFound);
return Ok(ret);
}
[HttpPost]
[Route("api/receipt/GetAllStyle")]
public IHttpActionResult GetAllStyle()
{
var qry = _db.receipt_style.AsQueryable();
return Ok(new { result = "Y", list = qry.ToList() });
}
[HttpPost]
[Route("api/receipt/PrintReceipt")]
public HttpResponseMessage PrintReceipt([FromBody] Model.receipt_master r)
{
var qry=_db.receipt_master.AsQueryable();
qry = qry.Where(x=>x.num==r.num);
var data = qry.Select(x=>new
{
x.num,x.receipt_date,x.source,x.order_no,x.style_num,
details=_db.receipt_detail.Where(y=>y.receipt_num==x.num).ToList(),
styleDetail=_db.receipt_style_d.Where(z=>z.style_num==x.style_num).ToList(),
}).FirstOrDefault();
try
{
string templatePath = HttpContext.Current.Server.MapPath("~/rpt/sample/receipt_sample01.docx");
if (!File.Exists(templatePath))
{
return Request.CreateResponse(HttpStatusCode.NotFound, "Template file not found.");
}
byte[] templateBytes = File.ReadAllBytes(templatePath);
// 2. 建立記憶體串流
MemoryStream outputStream = new MemoryStream();
outputStream.Write(templateBytes, 0, templateBytes.Length);
// 3. 使用 Open XML 處理記憶體中的資料
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(outputStream, true))
{
var body = wordDoc.MainDocumentPart.Document.Body;
var templateTable = body.Elements<Table>().FirstOrDefault();
if (templateTable != null && data.details != null && data.details.Count > 0)
{
OpenXmlElement currentAnchor = templateTable;
// 建立全域計數器 (請實作於迴圈外部,避免歸零)
int docPrIdCounter = 1000;
int vmlIdCounter = 2000;
for (int i = 0; i < data.details.Count; i++)
{
Table newTable = (Table)templateTable.CloneNode(true);
// --- 步驟 A:修復 DrawingML 的 docPr ID ---
foreach (var docPr in newTable.Descendants<DocumentFormat.OpenXml.Drawing.Wordprocessing.DocProperties>())
{
docPr.Id = (uint)docPrIdCounter++;
// 順便變更 Name,避免如 "直線接點 2" 的名稱重複
docPr.Name = $"直線接點_{docPrIdCounter}";
}
// --- 步驟 B:修復 VML 的 id 與 o:spid ---
foreach (var line in newTable.Descendants<Line>())
{
string newSpid = $"_x0000_s{vmlIdCounter++}";
// 更新原本的 v:line id
line.Id = $"直線接點_{vmlIdCounter}";
// o:spid 屬於 Office 擴充屬性,透過 SetAttribute 強制覆寫
var oNamespace = "urn:schemas-microsoft-com:office:office";
line.SetAttribute(new OpenXmlAttribute("spid", "o", oNamespace, newSpid));
}
// 移除複製出來的書籤標籤,保持結構乾淨
var bookmarksStarts = newTable.Descendants<BookmarkStart>().ToList();
var bookmarksEnds = newTable.Descendants<BookmarkEnd>().ToList();
foreach (var bm in bookmarksStarts) bm.Remove();
foreach (var bm in bookmarksEnds) bm.Remove();
foreach (var p in newTable.Descendants<Paragraph>())
{
p.RsidParagraphAddition = null;
p.RsidParagraphDeletion = null;
p.RsidParagraphProperties = null;
p.RsidRunAdditionDefault = null;
}
var textElements = newTable.Descendants<Text>().ToList();
foreach (var textNode in textElements)
{
// 檢查文字節點是否包含指定的關鍵字,並進行置換
if (textNode.Text.Contains("$CompanyTitle"))
{
var companyTitle = data.styleDetail.Where(x => x.item_name == "CompanyTitle").Select(x => x.item_value).FirstOrDefault();
textNode.Text = textNode.Text.Replace("$CompanyTitle", companyTitle ?? "");
}
if (textNode.Text.Contains("$ApproveNo"))
{
var approveNo = data.styleDetail.Where(x => x.item_name == "ApproveNo").Select(x => x.item_value).FirstOrDefault();
textNode.Text = textNode.Text.Replace("$ApproveNo", approveNo ?? "");
}
if (textNode.Text.Contains("$CompanyTaxNo"))
{
var companyTaxNo = data.styleDetail.Where(x => x.item_name == "CompanyTaxNo").Select(x => x.item_value).FirstOrDefault();
textNode.Text = textNode.Text.Replace("$CompanyTaxNo", companyTaxNo ?? "");
}
if (textNode.Text.Contains("$CompanyAddr"))
{
var companyAddr = data.styleDetail.Where(x => x.item_name == "CompanyAddr").Select(x => x.item_value).FirstOrDefault();
textNode.Text = textNode.Text.Replace("$CompanyAddr", companyAddr ?? "");
}
if (textNode.Text.Contains("$CompanyTel"))
{
var companyTel = data.styleDetail.Where(x => x.item_name == "CompanyTel").Select(x => x.item_value).FirstOrDefault();
textNode.Text = textNode.Text.Replace("$CompanyTel", companyTel ?? "");
}
if (textNode.Text.Contains("$ReceiptNo"))
{
textNode.Text = textNode.Text.Replace("$ReceiptNo", data.details[i].receipt_no ?? "");
}
if (textNode.Text.Contains("$ReceiptDate"))
{
textNode.Text = textNode.Text.Replace("$ReceiptDate", data.receipt_date ?? "");
}
if (textNode.Text.Contains("$ReceiptTitle"))
{
textNode.Text = textNode.Text.Replace("$ReceiptTitle", data.details[i].title ?? "");
}
if (textNode.Text.Contains("$ReceiptAmt"))
{
textNode.Text = textNode.Text.Replace("$ReceiptAmt", data.details[i].amt.ToString() ?? "");
}
if (textNode.Text.Contains("$Charge"))
{
textNode.Text = textNode.Text.Replace("$Charge", "" ?? "");
}
if (textNode.Text.Contains("$Caseofficer"))
{
textNode.Text = textNode.Text.Replace("$Caseofficer", data.details[i].caseofficer ?? "");
}
}
currentAnchor= body.InsertAfter(newTable, currentAnchor);
//currentAnchor = newTable;
if (i < data.details.Count - 1)
{
Paragraph pageBreakParagraph = new Paragraph(
new Run(
new Break() { Type = BreakValues.Page }
)
);
// 🔥【關鍵修正】將分頁段落插入到剛才產生的新表格後方
currentAnchor = body.InsertAfter(pageBreakParagraph, currentAnchor);
}
}
body.RemoveChild(templateTable);
wordDoc.MainDocumentPart.Document.Save();
}
} // wordDoc 關閉,確認資料完全寫入 outputStream
// 🔥 關鍵步驟:重設記憶體串流指標到起點
outputStream.Position = 0;
// 4. 建立 HttpResponseMessage
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
// 將記憶體流包裝成 StreamContent
response.Content = new StreamContent(outputStream);
// 設定 Content-Type 標頭(Word 專用 MIME Type
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
// 設定 Content-Disposition 標頭,指定為附件並提供預設檔名
string fileName = $"Report_{DateTime.Now:yyyyMMddHHmmss}.docx";
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = fileName
};
return response;
}
catch (Exception ex)
{
// Log exception details appropriately here
return Request.CreateResponse(HttpStatusCode.InternalServerError, $"Generation failed: {ex.Message}");
}
}
}
+1 -1
View File
@@ -170,7 +170,7 @@ public partial class admin_activity_item_reg : MyWeb.config
Model.actItem_files file=new Model.actItem_files(); Model.actItem_files file=new Model.actItem_files();
file.actItem_num= _id; file.actItem_num= _id;
file.files_num = 211; file.files_num = 211;
file.file.reg_time=DateTime.Now; file.reg_time=DateTime.Now;
_db.actItem_files.Add(file); _db.actItem_files.Add(file);
_db.SaveChanges(); _db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log(); Model.admin_log admin_log = new Model.admin_log();
+70 -29
View File
@@ -511,11 +511,11 @@
await axios await axios
.post(HTTP_HOST + 'api/tablet/GetTabletElement', {}) .post(HTTP_HOST + 'api/tablet/GetTabletElement', {})
.then(response => { .then(response => {
console.log(response) //console.log(response)
//if (response.result=="Y") { //if (response.result=="Y") {
if (response.status == "200") { if (response.status == "200") {
let data = response.data; let data = response.data;
console.log("data:",data) //console.log("data:",data)
if (data.result == "Y") { if (data.result == "Y") {
data.data.forEach(x => { data.data.forEach(x => {
self.tabletElements.push(x); self.tabletElements.push(x);
@@ -826,9 +826,18 @@
createEl(el, slice) { createEl(el, slice) {
let html = ''; let html = '';
let fontSize = el.style.fontSize;
// 1. 智慧名單渲染 // 1. 智慧名單渲染
if (el.type === 'roster') { if (el.type === 'roster') {
html = this.renderRoster(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderRoster(slice, el, rowWidth);
} }
// 2. 正名合併置中 // 2. 正名合併置中
else if (el.type === 'combined-center') { else if (el.type === 'combined-center') {
@@ -843,11 +852,27 @@
html = el.text.replace(/(\d+)/g, '<span class="tate-chu-yoko">$1</span>'); html = el.text.replace(/(\d+)/g, '<span class="tate-chu-yoko">$1</span>');
} }
else if (el.id === 'title1') { else if (el.id === 'title1') {
html = this.renderNameList(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderNameList(slice, el, rowWidth);
} }
else if (el.id === 'alive') { else if (el.id === 'alive') {
console.log("createEl:",slice,el) let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
html = this.renderLiveList(slice, el); let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
} }
else { else {
html = el.text; html = el.text;
@@ -855,12 +880,12 @@
return $(`<div class="tablet-element vertical-text ${this.activeId === el.id ? 'selected' : ''}" id="${el.id}"></div>`) return $(`<div class="tablet-element vertical-text ${this.activeId === el.id ? 'selected' : ''}" id="${el.id}"></div>`)
.css({ .css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
//position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive //position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive
}) })
.html(html); .html(html);
}, },
renderNameList(names, el) { renderNameList(names, el,rowWidth) {
let $namelist = $(`<div class='nameList'></div>`).css({ let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
display: "flex", display: "flex",
@@ -880,16 +905,16 @@
//"row-gap": "1px", //"row-gap": "1px",
let self = this; let self = this;
names.forEach(n => { names.forEach(n => {
$namelist.append(self.renderNameSpan(n, el)) $namelist.append(self.renderNameSpan(n, el,rowWidth))
}) })
return $namelist; return $namelist;
}, },
renderNameSpan(name, el) { renderNameSpan(name, el,rowWidth) {
return $(`<span>${name}</span>`).css({ return $(`<span>${name}</span>`).css({
display: "block", display: "block",
"min-height": `${el.textHeight}px`, "min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`, "max-height": `${el.height}px`,
width: `${el.textWidth}px`, width: `${rowWidth}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -897,8 +922,8 @@
"text-justify": "inter-character", "text-justify": "inter-character",
});// "margin-bottom": `${el.textSpan}px`, });// "margin-bottom": `${el.textSpan}px`,
}, },
renderLiveList(names, el) { renderLiveList(names, el,rowWidth) {
console.log("renderLiveList:",names); //console.log("renderLiveList:",names);
//$("#imp-text").updateActive("text",names) //$("#imp-text").updateActive("text",names)
let $namelist = $(`<div class='liveList'></div>`).css({ let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
@@ -919,18 +944,17 @@
//"row-gap": "1px", //"row-gap": "1px",
let self = this; let self = this;
names.forEach(n => { names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el)) $namelist.append(self.renderLiveSpan(n, el,rowWidth))
}) })
return $namelist; return $namelist;
}, },
renderLiveSpan(name, el) { renderLiveSpan(name, el, rowWidth) {
console.log("renderLiveSpan:", name, el //console.log("renderLiveSpan:", name, el );
);
return $(`<span>${name}</span>`).css({ return $(`<span>${name}</span>`).css({
display: "block", display: "block",
"min-height": `${el.textHeight}px`, "min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`, "max-height": `${el.height}px`,
width: `${el.textWidth}px`, width: `${rowWidth}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -1000,9 +1024,9 @@
}, },
select(id) { select(id) {
console.log("QQ:",id); //console.log("QQ:",id);
this.activeId = id; this.activeId = id;
console.log("QQ:",this.elements); //console.log("QQ:",this.elements);
const el = this.elements.find(x => x.id === id); const el = this.elements.find(x => x.id === id);
const el1 = this.elements.find(x => x.id === "titletriangle"); const el1 = this.elements.find(x => x.id === "titletriangle");
$('#attr-box').removeClass('d-none'); $('#attr-box').removeClass('d-none');
@@ -1024,7 +1048,7 @@
}, },
updateActive(key, val) { updateActive(key, val) {
console.log("updateActive:",key, val) //console.log("updateActive:",key, val)
const el = this.elements.find(x => x.id === this.activeId); const el = this.elements.find(x => x.id === this.activeId);
if (key === 'fontSize') el.style.fontSize = parseFloat(val); if (key === 'fontSize') el.style.fontSize = parseFloat(val);
@@ -1042,7 +1066,7 @@
position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.style.isActive position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.style.isActive
}).html(this.renderRoster(names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit), el)); }).html(this.renderRoster(names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit), el));
} else if (el.type == "combined-center") { } else if (el.type == "combined-center") {
console.log("combined-center"); //console.log("combined-center");
const parts = el.text.split('\n'); const parts = el.text.split('\n');
html = `<div class="ancestor-wrapper" style='width:${el.width}px !important;height:${el.height}px !important' > html = `<div class="ancestor-wrapper" style='width:${el.width}px !important;height:${el.height}px !important' >
@@ -1058,16 +1082,33 @@
} else if (this.activeId === "title1") { } else if (this.activeId === "title1") {
let names = el.text.split('\n').filter(s => s.trim()); let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit); let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderNameList(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
html = this.renderNameList(slice, el, rowWidth);//el.style.fontSize
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html); }).html(html);
} else if (this.activeId === "alive") { } else if (this.activeId === "alive") {
let names = el.text.split('\n').filter(s => s.trim()); let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit); let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderLiveList(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html); }).html(html);
} else if (this.activeId==="righttitle") { } else if (this.activeId==="righttitle") {
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
@@ -1095,11 +1136,11 @@
//this.render(); //this.render();
}, },
displayItem(id) { displayItem(id) {
console.log("displayItem:", this.elements, id); //console.log("displayItem:", this.elements, id);
let el = this.elements.find(x => x.id === id); let el = this.elements.find(x => x.id === id);
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden"; el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
//要判斷如果所在位置超出範圍,要拉回來放 //要判斷如果所在位置超出範圍,要拉回來放
console.log("displayItem:", this.paper, el) //console.log("displayItem:", this.paper, el)
if (el.x > this.paper.width) { if (el.x > this.paper.width) {
el.x = this.paper.width/2 el.x = this.paper.width/2
} }
@@ -1197,7 +1238,7 @@
orientation: $("#paperOrientation").val(), printPageCount: $("#perpage").val(), rosterLimit: 8, orientation: $("#paperOrientation").val(), printPageCount: $("#perpage").val(), rosterLimit: 8,
detail: detail detail: detail
} }
console.log(master); //console.log(master);
let path = "SavDegignerData"; let path = "SavDegignerData";
if (this.styleID != null && this.styleID != "") { if (this.styleID != null && this.styleID != "") {
path = "UpdateDegignerData" path = "UpdateDegignerData"
+6 -6
View File
@@ -386,10 +386,10 @@
return ""; return "";
} }
let data = JSON.parse(item.f_num_tablet) let data = JSON.parse(item.f_num_tablet)
let left = data.left_items let left = data?.left_items
let mid = data.mid_items let mid = data?.mid_items
let mid_right = data.mid_right let mid_right = data?.mid_right
let mid_left=data.mid_left let mid_left=data?.mid_left
let returnVal = "" let returnVal = ""
if (left) { if (left) {
returnVal = "陽上:" + left.map(x => x.fam_name).join("、") returnVal = "陽上:" + left.map(x => x.fam_name).join("、")
@@ -418,7 +418,7 @@
this.tablet_list.forEach(x => { this.tablet_list.forEach(x => {
if (x.actitem_num_checked && x.actitem_num_checked == true) { if (x.actitem_num_checked && x.actitem_num_checked == true) {
console.log("OOQ:", x) //console.log("OOQ:", x)
//console.log("OOQ:", x.num) //console.log("OOQ:", x.num)
let actItem = this.act_items.find(y => y.act_item_selected.val == x.actitem_num_selected.val) let actItem = this.act_items.find(y => y.act_item_selected.val == x.actitem_num_selected.val)
detail.push({ detail.push({
@@ -456,7 +456,7 @@
this.message_dialog.show_confirm = false this.message_dialog.show_confirm = false
this.message_dialog.show = true this.message_dialog.show = true
this.message_dialog.message =error this.message_dialog.message =error
console.log(error) //console.log(error)
}); });
} }
} }
+38 -15
View File
@@ -4,8 +4,8 @@
<v-card-title class="bg-primary white--text text-center"> <v-card-title class="bg-primary white--text text-center">
<h4>快速報名</h4> <h4>快速報名</h4>
<div class="ms-auto"> <div class="ms-auto">
<v-btn @click.prevent="addOrderWithDetail()">儲存</v-btn> <v-btn @click.prevent="addOrderWithDetail()" :disabled="statusAfterClick">儲存</v-btn>
<v-btn @click.prevent="back01()">返回</v-btn> <v-btn @click.prevent="back01()" :disabled="statusAfterClick">返回</v-btn>
</div> </div>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
@@ -24,13 +24,13 @@
</v-col> </v-col>
<v-col cols="2" md="2"> <v-col cols="2" md="2">
e <v-select :items="countrys" :rules="requiredrules" <v-select :items="countrys" :rules="requiredrules"
label="*國籍" label="*國籍"
item-text="name_zh" item-text="name_zh"
item-value="id" v-model="follower.country"> item-value="id" v-model="follower.country">
</v-select> </v-select>
<!--<v-text-field v-model="follower.country" :rules="requiredrules" <!--<v-text-field v-model="follower.country" :rules="requiredrules"
label="*國籍"></v-text-field>--> label="*國籍"></v-text-field>-->
</v-col> </v-col>
<v-col cols="2" md="2"> <v-col cols="2" md="2">
<v-text-field v-model="follower.id_code" <v-text-field v-model="follower.id_code"
@@ -47,7 +47,7 @@
item-value="val" v-model="follower.sex"> item-value="val" v-model="follower.sex">
</v-select> </v-select>
<!--<v-text-field v-model="follower.sex" :rules="[rules.required]" <!--<v-text-field v-model="follower.sex" :rules="[rules.required]"
label="*性別"></v-text-field>--> label="*性別"></v-text-field>-->
</v-col> </v-col>
<v-col cols="2" md="2"> <v-col cols="2" md="2">
<v-select :items="identity_items" :rules="requiredrules" <v-select :items="identity_items" :rules="requiredrules"
@@ -56,7 +56,7 @@
item-value="val" v-model="follower.identity_type"> item-value="val" v-model="follower.identity_type">
</v-select> </v-select>
<!--<v-text-field v-model="follower.identity_type" :rules="[rules.required]" <!--<v-text-field v-model="follower.identity_type" :rules="[rules.required]"
label="*身分別"></v-text-field>--> label="*身分別"></v-text-field>-->
</v-col> </v-col>
<v-col cols="2" md="2"> <v-col cols="2" md="2">
<v-menu v-model="menu" <v-menu v-model="menu"
@@ -77,9 +77,9 @@
@input="menu = false"></v-date-picker> @input="menu = false"></v-date-picker>
</v-menu> </v-menu>
<!--<v-date-picker v-model="follower.birthday" <!--<v-date-picker v-model="follower.birthday"
label="生日"></v-date-picker>--> label="生日"></v-date-picker>-->
<!--<v-text-field v-model="follower.birthday" <!--<v-text-field v-model="follower.birthday"
label="生日"></v-text-field>--> label="生日"></v-text-field>-->
</v-col> </v-col>
<v-col cols="2" md="2"> <v-col cols="2" md="2">
<v-checkbox v-model="follower.send_receipt" <v-checkbox v-model="follower.send_receipt"
@@ -135,7 +135,7 @@
item-value="val" v-model="title_new.islive"> item-value="val" v-model="title_new.islive">
</v-select> </v-select>
<!--<v-text-field v-model="title_new.islive" <!--<v-text-field v-model="title_new.islive"
label="存/歿"></v-text-field>--> label="存/歿"></v-text-field>-->
</v-col> </v-col>
<v-col> <v-col>
<v-btn @click.prevent="addTitle(item)">加入</v-btn> <v-btn @click.prevent="addTitle(item)">加入</v-btn>
@@ -165,7 +165,7 @@
item-value="val" v-model="alive_new.islive"> item-value="val" v-model="alive_new.islive">
</v-select> </v-select>
<!--<v-text-field v-model="alive_new.islive" <!--<v-text-field v-model="alive_new.islive"
label="存/歿"></v-text-field>--> label="存/歿"></v-text-field>-->
</v-col> </v-col>
<v-col> <v-col>
<v-btn @click.prevent="addLive(item)">加入</v-btn> <v-btn @click.prevent="addLive(item)">加入</v-btn>
@@ -187,7 +187,14 @@
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card> </v-card>
</div>
<v-snackbar v-model="snackbar.show" :timeout="3000" top color="error">
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn dark text v-bind="attrs" @click="snackbar.show = false">關閉</v-btn>
</template>
</v-snackbar>
</div>
</template> </template>
<script> <script>
@@ -199,6 +206,11 @@
}, },
data() { data() {
return { return {
statusAfterClick:false,
snackbar: {
show: false,
text: ''
},
follower: { follower: {
u_name: "", sex: "", identity_type: "", phone: "", u_name: "", sex: "", identity_type: "", phone: "",
cellphone: "", country: "", address: "", cellphone: "", country: "", address: "",
@@ -252,7 +264,8 @@
addOrderWithDetail() { addOrderWithDetail() {
// //
let details = [] let details = []
let self = this
this.statusAfterClick = true;
this.tablets.forEach(x => { this.tablets.forEach(x => {
let mid_items = [] let mid_items = []
@@ -313,6 +326,16 @@
.post(HTTP_HOST + 'api/order/AddOrderWithDetail', order) .post(HTTP_HOST + 'api/order/AddOrderWithDetail', order)
.then(response => { .then(response => {
console.log(response); console.log(response);
this.snackbar.text = response.data.message
this.snackbar.show = true;
if (response.data.result == "Y") {
//
setTimeout(() => {
self.back01()
}, 2000);
} else {
this.statusAfterClick = true;
}
}) })
}, },
renderContent(titles) { renderContent(titles) {
+94 -41
View File
@@ -317,13 +317,13 @@
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="number" id="xPosition" class="form-control form-control-sm mb-2" onchange="changePosition()"> <input type="number" id="xPosition" class="form-control form-control-sm mb-2" @change.prevent="changePosition">
<label class="small" for="xPosition">X</label> <label class="small" for="xPosition">X</label>
</div> </div>
</div> </div>
<div class="col-6"> <div class="col-6">
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="number" id="yPosition" class="form-control form-control-sm mb-2" onchange="changePosition()"> <input type="number" id="yPosition" class="form-control form-control-sm mb-2" @change.prevent="changePosition">
<label class="small" for="yPosition">Y</label> <label class="small" for="yPosition">Y</label>
</div> </div>
</div> </div>
@@ -518,7 +518,7 @@
}, },
methods: { methods: {
onTabsResize(e) { onTabsResize(e) {
console.log(e) //console.log(e)
// 當畫面變動時,呼叫 Vuetify 內部的呼叫方法重新計算寬度 // 當畫面變動時,呼叫 Vuetify 內部的呼叫方法重新計算寬度
//if (this.$refs.myTabs) { //if (this.$refs.myTabs) {
// this.$refs.myTabs.onResize(); // this.$refs.myTabs.onResize();
@@ -781,7 +781,7 @@
await axios await axios
.post(HTTP_HOST + 'api/tablet/GetTabletElement', {}) .post(HTTP_HOST + 'api/tablet/GetTabletElement', {})
.then(response => { .then(response => {
console.log(response) //console.log(response)
//if (response.result=="Y") { //if (response.result=="Y") {
if (response.status == "200") { if (response.status == "200") {
let data = response.data; let data = response.data;
@@ -932,7 +932,7 @@
changePaper1(val) { changePaper1(val) {
//$("#paperSize").val(val) //$("#paperSize").val(val)
this.paperSize = val.id this.paperSize = val.id
console.log("changePaper1:",val) //console.log("changePaper1:",val)
this.changePaper() this.changePaper()
}, },
changePaper() { changePaper() {
@@ -985,7 +985,7 @@
async removePaper() { async removePaper() {
this.removeDialog = true; this.removeDialog = true;
this.removeTarget = "paper"; this.removeTarget = "paper";
console.log("QQOO", this.removeStyle) //console.log("QQOO", this.removeStyle)
}, },
async confirmRemoveStyle() { async confirmRemoveStyle() {
let self = this; let self = this;
@@ -1012,7 +1012,7 @@
async removeStyle() { async removeStyle() {
this.removeDialog = true; this.removeDialog = true;
this.removeTarget = "style"; this.removeTarget = "style";
console.log("QQOO",this.removeStyle) //console.log("QQOO",this.removeStyle)
}, },
async newPaperSize() { async newPaperSize() {
this.paperDialog = true this.paperDialog = true
@@ -1049,8 +1049,8 @@
changeRosterLimit() { changeRosterLimit() {
//this.rosterLimit = parseInt(this.rosterLimit) //parseInt($("#rosterLimit").val()); //this.rosterLimit = parseInt(this.rosterLimit) //parseInt($("#rosterLimit").val());
}, },
changePrintMode() { changePrintMode(printMode) {
this.printMode = printMode
}, },
bindEvents() { bindEvents() {
// 文字變更連動渲染 // 文字變更連動渲染
@@ -1123,9 +1123,18 @@
createEl(el, slice) { createEl(el, slice) {
let html = ''; let html = '';
let fontSize = el.style.fontSize;
// 1. 智慧名單渲染 // 1. 智慧名單渲染
if (el.type === 'roster') { if (el.type === 'roster') {
html = this.renderRoster(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderRoster(slice, el, rowWidth);
} }
// 2. 正名合併置中 // 2. 正名合併置中
else if (el.type === 'combined-center') { else if (el.type === 'combined-center') {
@@ -1140,24 +1149,43 @@
html = el.text.replace(/(\d+)/g, '<span class="tate-chu-yoko">$1</span>'); html = el.text.replace(/(\d+)/g, '<span class="tate-chu-yoko">$1</span>');
} }
else if (el.id === 'title1') { else if (el.id === 'title1') {
html = this.renderNameList(slice, el); //要先去算出需要縮到多小字,根據總寬度跟行數,這樣才會在正中間
//字體大小*2如果大於行數就要縮字體
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderNameList(slice, el, rowWidth);
} }
else if (el.id === 'alive') { else if (el.id === 'alive') {
console.log("createEl:", slice, el) //console.log("createEl:", slice, el)
html = this.renderLiveList(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
} }
else { else {
html = el.text; html = el.text;
} }
//el.style.fontSize
return $(`<div class="tablet-element vertical-text ${this.activeId === el.id ? 'selected' : ''}" id="${el.id}"></div>`) return $(`<div class="tablet-element vertical-text ${this.activeId === el.id ? 'selected' : ''}" id="${el.id}"></div>`)
.css({ .css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
//position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive //position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive
}) })
.html(html); .html(html);
}, },
renderNameList(names, el) { renderNameList(names, el,rowWidth) {
let $namelist = $(`<div class='nameList'></div>`).css({ let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
display: "flex", display: "flex",
@@ -1177,16 +1205,16 @@
//"row-gap": "1px", //"row-gap": "1px",
let self = this; let self = this;
names.forEach(n => { names.forEach(n => {
$namelist.append(self.renderNameSpan(n, el)) $namelist.append(self.renderNameSpan(n, el, rowWidth))
}) })
return $namelist; return $namelist;
}, },
renderNameSpan(name, el) { renderNameSpan(name, el, rowWidth) {
return $(`<span>${name}</span>`).css({ return $(`<span>${name}</span>`).css({
display: "block", display: "block",
"min-height": `${el.textHeight}px`, "min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`, "max-height": `${el.height}px`,
width: `${el.textWidth}px`, width: `${rowWidth}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -1194,8 +1222,8 @@
"text-justify": "inter-character", "text-justify": "inter-character",
});// "margin-bottom": `${el.textSpan}px`, });// "margin-bottom": `${el.textSpan}px`,
}, },
renderLiveList(names, el) { renderLiveList(names, el, rowWidth) {
console.log("renderLiveList:", names); //console.log("renderLiveList:", names);
//$("#imp-text").updateActive("text",names) //$("#imp-text").updateActive("text",names)
let $namelist = $(`<div class='liveList'></div>`).css({ let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
@@ -1216,18 +1244,17 @@
//"row-gap": "1px", //"row-gap": "1px",
let self = this; let self = this;
names.forEach(n => { names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el)) $namelist.append(self.renderLiveSpan(n, el, rowWidth))
}) })
return $namelist; return $namelist;
}, },
renderLiveSpan(name, el) { renderLiveSpan(name, el, rowWidth) {
console.log("renderLiveSpan:", name, el //console.log("renderLiveSpan:", name, el );
);
return $(`<span>${name}</span>`).css({ return $(`<span>${name}</span>`).css({
display: "block", display: "block",
"min-height": `${el.textHeight}px`, "min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`, "max-height": `${el.height}px`,
width: `${el.textWidth}px`, width: `${rowWidth}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -1236,7 +1263,7 @@
});//"margin-bottom": `${el.textSpan}px`, });//"margin-bottom": `${el.textSpan}px`,
}, },
// 品字佈局邏輯:一上二下 // 品字佈局邏輯:一上二下
renderRoster(names, el) { renderRoster(names, el,rowWidth) {
if (!names.length) return ''; if (!names.length) return '';
const mid = names.length === 1 ? 1 : Math.floor(names.length / 2); const mid = names.length === 1 ? 1 : Math.floor(names.length / 2);
const top = names.slice(0, mid); const top = names.slice(0, mid);
@@ -1297,9 +1324,9 @@
}, },
select(id) { select(id) {
console.log("QQ:", id); //console.log("QQ:", id);
this.activeId = id; this.activeId = id;
console.log("QQ:", this.elements); //console.log("QQ:", this.elements);
const el = this.elements.find(x => x.id === id); const el = this.elements.find(x => x.id === id);
const el1 = this.elements.find(x => x.id === "titletriangle"); const el1 = this.elements.find(x => x.id === "titletriangle");
$('#attr-box').removeClass('d-none'); $('#attr-box').removeClass('d-none');
@@ -1321,7 +1348,7 @@
}, },
updateActive(key, val) { updateActive(key, val) {
console.log("updateActive:", key, val) //console.log("updateActive:", key, val)
const el = this.elements.find(x => x.id === this.activeId); const el = this.elements.find(x => x.id === this.activeId);
if (key === 'fontSize') el.style.fontSize = parseFloat(val); if (key === 'fontSize') el.style.fontSize = parseFloat(val);
@@ -1334,12 +1361,19 @@
else el[key] = val; else el[key] = val;
if (el.type == "roster") { if (el.type == "roster") {
const names = el.text.split('\n').filter(s => s.trim()); const names = el.text.split('\n').filter(s => s.trim());
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(names.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.style.isActive position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.style.isActive
}).html(this.renderRoster(names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit), el)); }).html(this.renderRoster(names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit), el, rowWidth));
} else if (el.type == "combined-center") { } else if (el.type == "combined-center") {
console.log("combined-center"); //console.log("combined-center");
const parts = el.text.split('\n'); const parts = el.text.split('\n');
html = `<div class="ancestor-wrapper" style='width:${el.width}px !important;height:${el.height}px !important' > html = `<div class="ancestor-wrapper" style='width:${el.width}px !important;height:${el.height}px !important' >
@@ -1353,18 +1387,37 @@
}).html(html); }).html(html);
} else if (this.activeId === "title1") { } else if (this.activeId === "title1") {
let names = el.text.split('\n').filter(s => s.trim()); let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit); let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderNameList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
html = this.renderNameList(slice, el, rowWidth);//el.style.fontSize
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html); }).html(html);
} else if (this.activeId === "alive") { } else if (this.activeId === "alive") {
let names = el.text.split('\n').filter(s => s.trim()); let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit); let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderLiveList(slice, el); let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html); }).html(html);
} else if (this.activeId === "righttitle") { } else if (this.activeId === "righttitle") {
$(`.tablet-element[id="${this.activeId}"]`).css({ $(`.tablet-element[id="${this.activeId}"]`).css({
@@ -1392,11 +1445,11 @@
//this.render(); //this.render();
}, },
displayItem(id) { displayItem(id) {
console.log("displayItem:", this.elements, id); //console.log("displayItem:", this.elements, id);
let el = this.elements.find(x => x.id === id); let el = this.elements.find(x => x.id === id);
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden"; el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
//要判斷如果所在位置超出範圍,要拉回來放 //要判斷如果所在位置超出範圍,要拉回來放
console.log("displayItem:", this.paper, el) //console.log("displayItem:", this.paper, el)
if (el.x > this.paper.width) { if (el.x > this.paper.width) {
el.x = this.paper.width / 2 el.x = this.paper.width / 2
} }
@@ -1494,7 +1547,7 @@
orientation:"", printPageCount:this.perPage, rosterLimit: 8, orientation:"", printPageCount:this.perPage, rosterLimit: 8,
detail: detail detail: detail
} }
console.log(master); //console.log(master);
let path = "SavDegignerData"; let path = "SavDegignerData";
if (this.styleID != null && this.styleID != "") { if (this.styleID != null && this.styleID != "") {
path = "UpdateDegignerData" path = "UpdateDegignerData"
+27 -10
View File
@@ -368,12 +368,20 @@
details.forEach(d => { details.forEach(d => {
if (d.isActive != "hidden") { if (d.isActive != "hidden") {
let newFontSize = self.scaleFontSize(mid, d.fontSize, d.width); let newFontSize = self.scaleFontSize(mid, d.fontSize, d.width);
let html = ""; let html = "";
let alive = ""; let alive = "";
let yang = ""; let yang = "";
let bi = ""; let bi = "";
if (d.elementID === 'title1') { if (d.elementID === 'title1') {
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
let $namelist = $(`<div class='nameList'></div>`).css({ let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
display: "flex", display: "flex",
@@ -396,14 +404,14 @@
let info = self.getTextInfo(z, newFontSize); let info = self.getTextInfo(z, newFontSize);
let spanWidth = mid.length > 1 ? newFontSize : d.width let spanWidth = mid.length > 1 ? newFontSize : d.width
let height = d.textHeight; let height = d.textHeight;
if (info.width >= d.textHeight) { if (info.height >= d.textHeight) {//width
height = d.height; height = d.height;
} }
let $span = $(`<span class="nameSpan">${z}</span>`).css({ let $span = $(`<span class="nameSpan">${z}</span>`).css({
display: "block", display: "block",
"min-height": `${height}px`, "min-height": `${height}px`,
"max-height": `${d.height}px`, "max-height": `${d.height}px`,
"max-width": `${spanWidth}px`, "max-width": `${rowWidth}px`,
//width: `${newFontSize}px`, //width: `${newFontSize}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -418,9 +426,18 @@
html = $namelist; html = $namelist;
} else if (d.elementID === "alive") { } else if (d.elementID === "alive") {
html = self.renderLiveList(left, d); let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
console.log(d.height,d.width,d.textHeight,perRow,rows,rowWidth,newFontSize,d)
html = self.renderLiveList(left, d, rowWidth);
newFontSize = d.fontSize; //newFontSize = d.fontSize;
} else if (d.elementID === "titletriangle") { } else if (d.elementID === "titletriangle") {
html = self.renderRoster(mid, d) html = self.renderRoster(mid, d)
} else if (d.elementID === "combined") { } else if (d.elementID === "combined") {
@@ -798,7 +815,7 @@
fix2(val) { fix2(val) {
return Number.parseFloat(val).toFixed(2); return Number.parseFloat(val).toFixed(2);
}, },
renderLiveList(names, el) { renderLiveList(names, el,rowWidth) {
let $namelist = $(`<div class='liveList'></div>`).css({ let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
display: "flex", display: "flex",
@@ -817,17 +834,17 @@
}); });
let self = this; let self = this;
names.forEach(n => { names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el)) $namelist.append(self.renderLiveSpan(n, el,rowWidth))
}) })
return $namelist; return $namelist;
}, },
renderLiveSpan(name, el) { renderLiveSpan(name, el,rowWidth) {
return $(`<span class="liveSpan">${name}</span>`).css({ return $(`<span class="liveSpan">${name}</span>`).css({
display: "block", display: "block",
"min-height": `${el.textHeight}px`, "min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`, "max-height": `${el.height}px`,
width: `${el.textWidth}px`, width: `${rowWidth}px`,
height: `${el.textHeight}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
"margin-bottom": "10px", "margin-bottom": "10px",
+60 -24
View File
@@ -239,7 +239,7 @@
this.defaultStyle = response.data.data.defaultStyle; this.defaultStyle = response.data.data.defaultStyle;
this.selected.style = response.data.data.defaultStyle; this.selected.style = response.data.data.defaultStyle;
this.selectStyle.style = response.data.data.defaultStyle; this.selectStyle.style = response.data.data.defaultStyle;
console.log("GetActItem:",this.defaultStyle) //console.log("GetActItem:",this.defaultStyle)
$("#styleSel").val(this.defaultStyle); $("#styleSel").val(this.defaultStyle);
//this.getStyle(); //this.getStyle();
@@ -334,7 +334,7 @@
if (response.status == 200) { if (response.status == 200) {
self.printData = response.data; self.printData = response.data;
self.printData.forEach(x => { self.printData.forEach(x => {
console.log("GetDetailToPrint:",x.style); //console.log("GetDetailToPrint:",x.style);
if (x.style != null && x.style != undefined) { if (x.style != null && x.style != undefined) {
self.selectStyle.style = x.style; self.selectStyle.style = x.style;
self.selected.style = x.style; self.selected.style = x.style;
@@ -460,15 +460,33 @@
if (mid.length == 0) { if (mid.length == 0) {
mid.push("請選擇") mid.push("請選擇")
} }
html = self.renderNameList(mid, d, newFontSize, style); let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
//console.log(perRow, rows, rowWidth, newFontSize)
html = self.renderNameList(mid, d, newFontSize, style, rowWidth);
} else if (d.elementID === "alive") { } else if (d.elementID === "alive") {
self.tabletType = "B"; self.tabletType = "B";
if (left.length == 0) { if (left.length == 0) {
left.push("請選擇"); left.push("請選擇");
} }
newFontSize = self.scaleFontSize(left, d.fontSize, d.Width); newFontSize = self.scaleFontSize(left, d.fontSize, d.Width);
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
//console.log(perRow, rows, rowWidth, newFontSize)
//newFontSize = d.fontSize; //newFontSize = d.fontSize;
html = self.renderLiveList(left, d); html = self.renderLiveList(left, d, rowWidth);
} else if (d.elementID === "titletriangle") { } else if (d.elementID === "titletriangle") {
if (mid.length == 0) { if (mid.length == 0) {
@@ -748,7 +766,7 @@
}); });
} else if (element.hasClass("address")) {//地址 } else if (element.hasClass("address")) {//地址
console.log(self.address); //console.log(self.address);
$(".selectedItem").append(`<li><span style="opacity:0.5"></span> $(".selectedItem").append(`<li><span style="opacity:0.5"></span>
<span class="selected">${self.address==undefined?"":self.address}</span> <span class="selected">${self.address==undefined?"":self.address}</span>
<span class="itemRemove" style="float:right ;margin-left:2rem;cursor:pointer;" >&minus;</span>`); <span class="itemRemove" style="float:right ;margin-left:2rem;cursor:pointer;" >&minus;</span>`);
@@ -866,7 +884,7 @@
self.bindEvent(); self.bindEvent();
}, },
async addNewItem() {//已選輸入框按加號 async addNewItem() {//已選輸入框按加號
console.log("addNewItem:",$("#custom_txt").val()) //console.log("addNewItem:",$("#custom_txt").val())
if ($("#custom_txt").val()=="") { if ($("#custom_txt").val()=="") {
alert("名稱不可空白") alert("名稱不可空白")
@@ -1246,8 +1264,16 @@
let left = [] let left = []
Object.assign(left, self.alive); Object.assign(left, self.alive);
//this.printData.forEach(x => { //this.printData.forEach(x => {
let d = details.find(y => y.elementID == "alive"); let d = details.find(y => y.elementID == "alive");
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
let newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
self.selectedElement.css("font-size", newFontSize+"px");
let html = self.renderLiveList(left, d); let html = self.renderLiveList(left, d);
$(self.selectedElement).append(html); $(self.selectedElement).append(html);
} else if ($(self.selectedElement).children().first().hasClass("lefttitle") || } else if ($(self.selectedElement).children().first().hasClass("lefttitle") ||
@@ -1284,11 +1310,21 @@
$(self.selectedElement).empty(); $(self.selectedElement).empty();
let d = details.find(y => y.elementID == "title1"); let d = details.find(y => y.elementID == "title1");
let newfontSize = self.scaleFontSize(mid, d.fontSize, d.textWidth) let newfontSize = self.scaleFontSize(mid, d.fontSize, d.textWidth)
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newfontSize = Math.floor(rowWidth / 2);
if (newfontSize > d.fontSize) {
newfontSize = d.fontSize;
rowWidth = newfontSize * 2;
}
if (newfontSize < 10) { if (newfontSize < 10) {
newfontSize = 10; newfontSize = 10;
} }
$(self.selectedElement).css("font-size", newfontSize); //console.log(self.selectedElement,perRow, rows, rowWidth, newfontSize)
let html = self.renderNameList(mid, d, style.fontSize, style);
self.selectedElement.css("font-size", newfontSize+"px");
let html = self.renderNameList(mid, d, style.fontSize, style,rowWidth);
$(self.selectedElement).append(html); $(self.selectedElement).append(html);
} else if ($(self.selectedElement).children().first().hasClass("rosterList")) { } else if ($(self.selectedElement).children().first().hasClass("rosterList")) {
$(self.selectedElement).empty(); $(self.selectedElement).empty();
@@ -1297,7 +1333,7 @@
if (newfontSize < 10) { if (newfontSize < 10) {
newfontSize = 10; newfontSize = 10;
} }
$(self.selectedElement).css("font-size", newfontSize); self.selectedElement.css("font-size", newfontSize+"px");
let html = self.renderRoster(mid, d); let html = self.renderRoster(mid, d);
$(self.selectedElement).append(html); $(self.selectedElement).append(html);
} else if ($(self.selectedElement).children().first().hasClass("ancestor-wrapper")) { } else if ($(self.selectedElement).children().first().hasClass("ancestor-wrapper")) {
@@ -1307,7 +1343,7 @@
if (newfontSize < 10) { if (newfontSize < 10) {
newfontSize = 10; newfontSize = 10;
} }
$(self.selectedElement).css("font-size", newfontSize); self.selectedElement.css("font-size", newfontSize+"px");
let html = self.renderCombined(mid, d); let html = self.renderCombined(mid, d);
$(self.selectedElement).append(html); $(self.selectedElement).append(html);
} }
@@ -1365,7 +1401,7 @@
}); });
return txt; return txt;
}, },
renderNameList(mid, d, newFontSize, style) { renderNameList(mid, d, newFontSize, style,rowWidth) {
let self = this; let self = this;
let $namelist = $(`<div class='nameList'></div>`).css({ let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
@@ -1396,7 +1432,7 @@
display: "block", display: "block",
"min-height": `${height}px`, "min-height": `${height}px`,
"max-height": `${d.height}px`, "max-height": `${d.height}px`,
"max-width": `${spanWidth}px`, "max-width": `${rowWidth}px`,
//width: `${newFontSize}px`, //width: `${newFontSize}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -1410,7 +1446,7 @@
}); });
return $namelist; return $namelist;
}, },
renderLiveList(names, el) { renderLiveList(names, el,rowWidth) {
let $namelist = $(`<div class='liveList'></div>`).css({ let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl", "writing-mode": "vertical rl",
display: "flex", display: "flex",
@@ -1429,16 +1465,16 @@
}); });
let self = this; let self = this;
names.forEach(n => { names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el)) $namelist.append(self.renderLiveSpan(n, el,rowWidth))
}) })
return $namelist; return $namelist;
}, },
renderLiveSpan(name, el) { renderLiveSpan(name, el,rowWidth) {
return $(`<span class="liveSpan">${name}</span>`).css({ return $(`<span class="liveSpan">${name}</span>`).css({
display: "block", display: "block",
"min-height": `${el.textHeight}px`, "min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`, "max-height": `${el.height}px`,
width: `${el.textWidth}px`, width: `${rowWidth}px`,
height: `${el.textHeight}px`, height: `${el.textHeight}px`,
"text-align": "justify", "text-align": "justify",
"text-align-last": "justify", "text-align-last": "justify",
@@ -1559,7 +1595,7 @@
async saveFamily() { async saveFamily() {
let self = this; let self = this;
if (this.follower_id == "") { if (this.follower_id == "") {
console.log("follower_id:", this.follower_id); //console.log("follower_id:", this.follower_id);
return false return false
} }
@@ -1611,7 +1647,7 @@
event.preventDefault() event.preventDefault()
//console.log("tabletItem:", designer.tabletItem); //console.log("tabletItem:", designer.tabletItem);
//拚牌位的內容 //拚牌位的內容
console.log("AA") //console.log("AA")
let self = this; let self = this;
let tablet = { let tablet = {
mid_items: designer.family_deceased_N_selected, mid_items: designer.family_deceased_N_selected,
@@ -1621,7 +1657,7 @@
mid_right: designer.family_right_title, mid_right: designer.family_right_title,
addr_items: designer.family_address addr_items: designer.family_address
} }
console.log("BB") //console.log("BB")
var pro_order_detail = var pro_order_detail =
{ {
num: designer.tabletItem.num <= 0 ? null : designer.tabletItem.num, num: designer.tabletItem.num <= 0 ? null : designer.tabletItem.num,
@@ -1647,7 +1683,7 @@
customize_data: designer.tabletItem.customize_data, customize_data: designer.tabletItem.customize_data,
style: designer.selectStyle.style style: designer.selectStyle.style
} }
console.log("CC") //console.log("CC")
await axios await axios
.post('/api/order/SaveDetailData', pro_order_detail) .post('/api/order/SaveDetailData', pro_order_detail)
.then(response => { .then(response => {
@@ -1742,7 +1778,7 @@
//designer.toast.show(); //designer.toast.show();
//designer.reset(); //designer.reset();
let e = event.originalEvent; let e = event.originalEvent;
console.log("QOO"); //console.log("QOO");
if (e.origin === window.parent.location.origin) { if (e.origin === window.parent.location.origin) {
//console.log('editor.html - origin check passed'); //console.log('editor.html - origin check passed');
//console.log('editor.html - received data:', event.data); //console.log('editor.html - received data:', event.data);
@@ -1753,7 +1789,7 @@
designer.family_right_title = []; designer.family_right_title = [];
designer.http_host = receivedData.host; designer.http_host = receivedData.host;
designer.follower_id = receivedData.follower_id; designer.follower_id = receivedData.follower_id;
console.log("三小:", receivedData.tabletItem) //console.log("三小:", receivedData.tabletItem)
if (receivedData.tabletItem) { if (receivedData.tabletItem) {
//console.log('editor.html - updating tabletItem:', receivedData.tabletItem); //console.log('editor.html - updating tabletItem:', receivedData.tabletItem);
designer.tabletItem = receivedData.tabletItem; designer.tabletItem = receivedData.tabletItem;
@@ -1824,7 +1860,7 @@
} }
} }
console.log(e.origin, window.parent.location.origin) //console.log(e.origin, window.parent.location.origin)
}) })
); );
function delay(ms) { function delay(ms) {
+419
View File
@@ -0,0 +1,419 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="admin_receipt_index" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
<script src="/js//httpVueLoader.js"></script>
<style>
.modify_modal{
width:80vw !important;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<div class="mb-2 mb-sm-0">
<a @click.prevent="newReceipt" class="btn btn-primary">
<i class="mdi mdi-plus"></i>新增
</a>
<%--<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>--%>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="content" class="container-fluid">
<v-data-table
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="num"
:options.sync="options"
:headers="data_table.header"
:footer-props="data_table.footer"
:server-items-length="data_table.count"
:loading="data_table.loading"
:single-select="data_table.singleSelect"
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
class="elevation-1">
<template #item.source="{ item }">
{{ getSourceName(item.source) }}
</template>
<template #item.slot_btn="{ item }">
<a @click.prevent="viewReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>明細</a>
<a @click.prevent="editReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-printer"></i>編輯</a>
<a @click.prevent="printReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-printer"></i>列印</a>
<%--<a :href="'reg.aspx?order_no='+item.order_no" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>編輯</a>--%>
<%--<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>--%>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="data_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ data_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="data_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="data_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
<v-dialog v-model="search_dialog.show" max-width="500px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
查詢:{{search_dialog.current.title}}
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" v-bind:key="item.value">
<v-text-field v-model="item.value" :label="item.title" v-if="item.visible===undefined || item.visible==true "></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="search_options"
@click:row="search_select"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="modify_dialog.show" class="modify_modal">
<template>
<keep-alive>
<component :is="currentView" :num="twoData" :mode="modify_dialog.mode" @close-dialog="changeModifyDialog($event)"></component>
</keep-alive>
</template>
</v-dialog>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script>
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
options: { multiSort: false },
search_options: { multiSort: false },
twoData:0,
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '序號', value: 'num' },
{ text: '來源', value: 'source' },
{ text: '開立日期', value: 'receipt_date' },
{ text: '報名單號', value: 'order_no', align: 'start' },
{ text: '信眾', value: 'follower.u_name' },
{ text: '總金額', value: 'total_amt' },
{ text: '收據張數', value: 'receipt_count' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
modify_dialog: {
show: false,
mode: ""
},
search_dialog: {
controls: {
search2: {
id: 'search2',
title: '報名活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(item, t) {
t.print_search.select_act = item.num;
}
},
},
show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
},
},
search: {
source: '',
order_no: '',
},
currentView: 'receipt-component'
}
},
mounted() {
},
components: {
'receipt-component': httpVueLoader('./receipt.vue'),
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
search_options: {
handler() {
this.search_get()
},
deep: true,
},
},
methods: {
changeModifyDialog(event) {
this.modify_dialog.show = false
this.modify_dialog.mode = ""
this.currentView = "";
if (event === "reload") {
this.getDefault()
}
},
getSourceName(id) {
return id=="1"?"活動/法會":"其他"
},
viewReceipt(item) {
this.twoData = item.num;
this.modify_dialog.show = true;
this.modify_dialog.mode = "view";
this.currentView = "receipt-component";
},
editReceipt(item) {
this.twoData = item.num;
this.modify_dialog.show = true;
this.modify_dialog.mode = "edit";
this.currentView = "receipt-component";
},
printReceipt(item) {
try {
let searchData = { num: item.num }
axios
.post(HTTP_HOST + 'api/receipt/PrintReceipt', searchData, { responseType: 'blob' })
.then(response => {
// 1. Create a dynamic URL object from the binary blob
const blob = new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
});
const fileUrl = window.URL.createObjectURL(blob);
// 2. Create a temporary 'a' element to trigger download
const link = document.createElement('a');
link.href = fileUrl;
// 3. Set desired file name
link.setAttribute('download', `${searchData.activity_num}_${searchData.mode}.docx`);
// 4. Append, click and cleanup
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(fileUrl); // Free up memory allocation
})
} catch (error) {
//alert('Failed to download file.');
this.showSnack('Failed to download file.');
} finally {
this.loading = false;
}
},
newReceipt() {
this.modify_dialog.show = true;
this.modify_dialog.mode = "add";
this.twoData = 0;
this.currentView = "receipt-component";
},
search_show(curr) {
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.search_options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
if (this.search_dialog.current.id == 'search2') {
params = { sortBy: 'startDate_solar', sortDesc: true, page: this.search_dialog.page, pageSize: 10 };//url params
}
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(row, this);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
//page = this.data_table.page;
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
//sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
.post(HTTP_HOST + 'api/receipt/GetList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
const dataToStore = JSON.stringify(this.data_table);
//sessionStorage.setItem("order_list_cache", dataToStore);
})
.catch(error => console.log(error))
},
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/receipt/' + item.order_no)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/receipt/DeleteAll/' + this.data_table.selected.map(x => x.order_no))
.then(response => {
this.getDefault();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.isSearched = true;
this.search.activity_num = '';
this.getDefault(true)
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
},
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
}
})
</script>
</asp:Content>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_receipt_index : MyWeb.config
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
+539
View File
@@ -0,0 +1,539 @@
<template>
<div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-10">
<div class="card shadow">
<div class="card-header bg-primary text-white text-center">
<h4 class="mb-0">收款收據開立作業</h4>
</div>
<div class="card-body">
<div class="row">
<div class="mb-3 col-12 col-md-6">
<label for="source" class="form-label">來源 <span class="text-danger">*</span></label>
<select class="form-select" id="source" v-model="formData.source" required :disabled="mode=='view'||mode=='edit'">
<option value="">請選擇</option>
<option v-for="(desc, value) in sources" :key="value" :value="value">
{{desc}}
</option>
</select>
</div>
<div class="mb-3 col-12 col-md-6">
<!--source=1 就要有-->
<label for="order_no" class="form-label">報名單號 <span class="text-danger" v-show="order_no_need">*</span></label>
<div class="input-group mb-3"
@click.prevent="showPickOrder" :disabled="mode=='view'||mode=='edit'">
<input class="form-control search-text" type="text" readonly
id="order_no" runat="server" placeholder="報名單號" v-model="formData.order_no">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
<div class="mb-3 col-12 col-md-6">
<label for="" class="form-label">開立日期 <span class="text-danger">*</span></label>
<v-menu ref="menu"
v-model="menu"
:close-on-content-click="false"
:return-value.sync="formData.receipt_date"
transition="scale-transition"
offset-y
min-width="auto"
:disabled="mode=='view'||mode=='edit'">
<template v-slot:activator="{ on, attrs }">
<v-text-field v-model="formData.receipt_date"
prepend-icon="mdi-calendar"
readonly
v-bind="attrs"
v-on="on"></v-text-field>
</template>
<v-date-picker v-model="formData.receipt_date"
:active-picker.sync="activePicker"
:max="(new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000)).toISOString().substring(0, 10)"
min="1950-01-01">
<v-spacer></v-spacer>
<v-btn text
color="primary"
@click.prevent="menu = false">
Cancel
</v-btn>
<v-btn text
color="primary"
@click.prevent="$refs.menu.save(formData.receipt_date)">
OK
</v-btn>
</v-date-picker>
</v-menu>
</div>
<div class="mb-3 col-12 col-md-6">
<label for="receiptStyle" class="form-label">收據格式 <span class="text-danger">*</span></label>
<select class="form-select" id="receiptStyle" v-model="formData.style_num" required
:disabled="mode=='view'||mode=='edit'">
<option value="">請選擇</option>
<option v-for="r in receiptStyles" :key="r.num" :value="r.num">
{{r.name}}
</option>
</select>
</div>
<div class="mb-3 col-12 col-md-6">
<v-text-field v-model="formData.total_amt" label="應收總金額"
:disabled="mode=='view'||mode=='edit'||formData.source=='1'"></v-text-field><!--從報名來的不能改總金額-->
</div>
<div class="mb-3 col-12 col-md-6">
<v-text-field v-model="alreadyAmt" label="已收總金額"
:disabled="mode=='view'||mode=='edit'||formData.source=='1'"></v-text-field>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-title bg-primary text-white">
<h4>收據明細</h4>
</div>
<div class="card-body">
<div class="row" v-show="mode!='view'">
<!--<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.receipt_no" label="編號" :readonly="true"></v-text-field>
</div>-->
<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.title" label="抬頭"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.amt" label="金額"></v-text-field>
</div>
<div class="col-12 col-md-4">
<v-text-field v-model="newDetail.addr" label="地址"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.caseofficer" label="經手人"></v-text-field>
</div>
<div class="col-12 col-md-2">
<button class="btn btn-info" @click.prevent="addDetail">新增</button>
</div>
</div>
<div class="row" v-for="d in formDetail">
<div class="row">
<!--<div class="col-12 col-md-2">
<v-text-field v-model="d.receipt_no" label="編號"></v-text-field>
</div>-->
<div class="col-12 col-md-2">
<v-text-field v-model="d.title" label="抬頭" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="d.amt" label="金額" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-4">
<v-text-field v-model="d.addr" label="地址" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="d.caseofficer" label="經手人" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="d.receipt_no" label="收據編號" v-show="mode=='view'" :disabled="mode=='view'"></v-text-field>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-2">
收據已開立總金額 {{ countReceiptTotal() }}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-footer">
<button class="btn btn-primary" @click.prevent="saveReceipt" v-show="mode!='view'">存檔</button>
<button class="btn btn-primary" @click.prevent="printReceipt" v-show="mode=='view'">列印</button>
<button class="btn btn-primary" @click.prevent="closeWindow('')">取消</button>
</div>
</div>
</div>
<v-dialog v-model="order_dialog.show" max-width="800px">
<v-card>
<v-card-title class="grey lighten-2">
選擇報名表
<v-spacer></v-spacer>
<v-btn icon @click.prevent="order_dialog.show = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-card-title>
<v-card-text class="pt-4">
<v-row>
<v-col cols="12">
<v-text-field v-model="order_dialog.search"
label="依法會名稱搜尋報名表 (按 Enter 搜尋)"
prepend-icon="mdi-magnify"
@keydown.enter.prevent="searchOrders"
clearable></v-text-field>
</v-col>
</v-row>
<v-data-table :headers="order_dialog.headers"
:items="order_dialog.list"
:loading="order_dialog.loading"
item-key="num"
:server-items-length="order_dialog.count"
:page.sync="order_dialog.page"
:items-per-page.sync="order_dialog.pageSize"
:options.sync="options"
class="elevation-1"
@click:row="selectOrder">
<template v-slot:item.actions="{ item }">
<v-btn small color="primary" @click.stop="selectOrder(item)">
選擇
</v-btn>
</template>
</v-data-table>
</v-card-text>
</v-card>
</v-dialog>
<v-snackbar v-model="snackbar.show" :timeout="3000" top color="error">
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn dark text v-bind="attrs" @click="snackbar.show = false">關閉</v-btn>
</template>
</v-snackbar>
</div>
</template>
<script>
module.exports = {
props: {
num: {
type: Number // num
},
mode: {
type: String,
default:''
}
},
data() {
return {
snackbar: {
show: false,
text: ''
},
options: { multiSort: false },
formData: {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num:0
},
alreadyAmt:0,
order_no_need:false,
newDetail: {
num:0,
receipt_no: "",
title: "",
addr: "",
amt: 0,
caseofficer: ""
},
formDetail: [
],
sources: {
'1': '活動/法會',
'2':'其他'
},
orders: [],
receiptStyles:[],
activePicker: null,
date: null,
menu: false,
order_dialog: {
show: false,
search: '',
headers: [
{ text: '活動/法會', value: 'subject' },
{ text: '單號', value: 'order_no' },
{ text: '姓名', value: 'u_name' },
],
loading: false,
items: [],
list: [],
count: 0,
page: 1,
pageSize: 10,
options: { multiSort: false },
}
}
},
watch: {
options: {
handler() {
this.searchOrders()
},
deep: true,
},
formData: {
handler(newVal) {
if (newVal.source === "1") {
this.order_no_need = true;
} else {
this.order_no_need = false;
}
},
deep:true,
},
num: {
handler() {
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
if (this.mode == "view"||this.mode=="edit") {
this.getReceipt();
}
},
deep: true,
immediate: true
}
},
methods: {
showPickOrder() {
this.order_dialog.show = true;
},
selectOrder(item) {
//console.log(item)
this.formData.order_no = item.order_no
this.formData.total_amt = item.amt
this.order_dialog.show=false
},
searchOrders() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
//page = this.data_table.page;
let self = this;
const params = {
page: page == null ? 1 : page, pageSize: itemsPerPage == null ? 10 : itemsPerPage,
sortBy: sortBy[0], sortDesc: sortDesc[0],
};
this.order_dialog.loading = true
let search = { subject: this.order_dialog.search }
//sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
.post(HTTP_HOST + 'api/order/GetList', search, { params: params })
.then(response => {
console.log(response)
self.order_dialog.list = response.data.list
self.order_dialog.count = response.data.count;
self.order_dialog.loading = false
//sessionStorage.setItem("order_list_cache", dataToStore);
})
.catch(error => console.log(error))
},
getReceiptStyles() {
axios
.post(HTTP_HOST + 'api/receipt/GetAllStyle')
.then(response => {
let data = response.data.list;
this.receiptStyles = data;
});
},
getOrders() {
},
getReceipt() {
let search = { num: this.num }
axios
.post(HTTP_HOST + 'api/receipt/GetData', search)
.then(response => {
let data = response.data.data;
this.formData = {
source: data.source,
order_no: data.order_no,
receipt_date: data.receipt_date,
style_num: data.style_num,
total_amt: data.total_amt,
num: data.num
}
data.orderdetails.forEach(x => {
x.records.forEach(y => {
this.alreadyAmt = Number(this.alreadyAmt) + (isNaN(y.price) ? 0 : Number(y.price))
})
})
this.formDetail=[...data.receipt_detail]
})
.catch(error => console.log(error))
},
addDetail() {
this.formDetail.push({ ...this.newDetail })
this.newDetail = {
receipt_no: "",
title: "",
addr: "",
amt: 0,
caseofficer: "",
num: 0,
receipt_num:0
}
},
showSnack(message) {
this.snackbar.text = message;
this.snackbar.show = true;
},
saveReceipt() {
if (this.formDetail.length === 0) {
this.showSnack("沒有明細資料");
return false;
}
if (this.formData.source == "") {
this.showSnack("請選擇來源");
return false;
}
if (this.formData.source === "1" && this.formData.order_no== "") {
this.showSnack("請選擇活動/法會");
return false;
}
if (this.formData.receipt_date == "") {
this.showSnack("請選擇開立日期");
return false;
}
if (this.formData.style_num==0) {
this.showSnack("請選擇收據格式");
return false;
}
if (this.formData.total_amt == 0) {
this.showSnack("總金額不可為0");
return false;
}
let total=0
let detail = []
this.formDetail.forEach(x => {
detail.push({ ...x })
total=total+Number(x.amt)
})
if (total > this.formData.total_amt) {
this.showSnack("收據總金額超過應收總金額!!!");
return false
}
let master = {
...this.formData, list: detail
}
let targetUrl = "SaveReceiptWithDetail";
if (this.mode === "edit")
targetUrl = "UpdateReceiptWithDetail";
axios
.post(HTTP_HOST + `api/receipt/${targetUrl}`, master)
.then(response => {
this.snackbar.text = response.data.message;
this.snackbar.show = true;
if (response.data.result == "Y") {
this.closeWindow('reload');
}
})
.catch(error => console.log(error))
},
closeWindow(param) {
this.formDetail.length = 0
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
this.$emit('close-dialog', param);
},
printReceipt() {
try {
let searchData = {num:this.formData.num}
axios
.post(HTTP_HOST + 'api/receipt/PrintReceipt', searchData, { responseType: 'blob' })
.then(response => {
// 1. Create a dynamic URL object from the binary blob
const blob = new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
});
const fileUrl = window.URL.createObjectURL(blob);
// 2. Create a temporary 'a' element to trigger download
const link = document.createElement('a');
link.href = fileUrl;
// 3. Set desired file name
link.setAttribute('download', `${searchData.activity_num}_${searchData.mode}.docx`);
// 4. Append, click and cleanup
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(fileUrl); // Free up memory allocation
})
} catch (error) {
console.error('Error downloading the file:', error);
//alert('Failed to download file.');
this.showSnack('Failed to download file.');
} finally {
this.loading = false;
}
},
countReceiptTotal() {
let total=0
this.formDetail.forEach(x => {
total=Number(total)+Number(x.amt)
})
return total
}
},
deactivated() {
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
this.formDetail.length = 0;
this.alreadyAmt = 0;
},
activated() {
this.getReceiptStyles();
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
this.formDetail.length = 0;
this.alreadyAmt = 0;
},
mounted() {
//this.formDetail.push()
},
computed: {
pageCount() {
return Math.ceil(this.order_dialog.count / (this.options.itemsPerPage??10))
},
}
}
</script>
Binary file not shown.