Browse Source

更新接口代码

MY 5 tháng trước cách đây
mục cha
commit
82ee9886ac

+ 25 - 0
JLHHJSvr/Com/GetERPMtrlTypeList.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.DBA.DBModle;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class GetERPMtrlTypeListRequest : ILJRequest<GetERPMtrlTypeListResponse>
+    {
+        public string GetApiName()
+        {
+            return "GetERPMtrlTypeList";
+        }
+        public string token { get; set; }
+    }
+
+    public sealed class GetERPMtrlTypeListResponse : LJResponse
+    {
+        public List<u_mtrltype> list { get; set; }
+        public List<Recursion<u_mtrltype>> reList { get; set; }
+    }
+}

+ 1 - 1
JLHHJSvr/Com/Model/erp_sc_workgroup.cs

@@ -10,7 +10,7 @@ namespace JLHHJSvr.Com.Model
     public sealed class erp_sc_workgroup
     {
         public int? wrkgrpid { get; set; }
-        public int? wrkgrpname { get; set; }
+        public string wrkgrpname { get; set; }
         public string wrkgrpcode { get; set; }
     }
 }

+ 1 - 0
JLHHJSvr/Com/RefreshMattressInterfaceQd.cs

@@ -22,6 +22,7 @@ namespace JLHHJSvr.Com
         /// </summary>
         public int? mattressid { get; set; }
         public byte? isPz { get; set; }
+        public byte? isCheck { get; set; }
     }
 
     public sealed class RefreshMattressInterfaceQdResponse : LJResponse

+ 102 - 0
JLHHJSvr/DataStore/web_mattress_choose.xml

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+  <selectstr>
+SELECT mattressid
+	,mattressname
+	,deptid
+	,mattresstypeid
+	,mattresscode
+	,mattress_width
+	,mattress_length
+	,mattress_height
+	,packtype
+	,packqty
+	,woodpallettype
+	,total_hr_cost
+	,total_material_cost
+	,fees_dscrp
+	,total_fees_cost
+	,total_cost
+	,taxrate
+	,taxes
+	,commissionrate
+	,commission
+	,fob
+	,profitrate
+	,nottax_factory_cost
+	,nottax_dept_cost
+	,dept_cost
+	,foreign_cost
+	,extras_cost
+	,dept_profitrate
+	,moneyrate
+	,mattressrelcode
+	,flag
+	,auditingrep
+	,auditingdate
+	,createtime
+	,createby
+	,yw_flag
+	,yw_auditingrep
+	,yw_auditingdate
+	,js1_flag
+	,js1_auditingrep
+	,js1_auditingdate
+	,js2_flag
+	,js2_auditingrep
+	,js2_auditingdate
+	,creatmtrl_flag
+	,creatmtrl_auditingrep
+	,creatmtrl_auditingdate
+	,creatmtrlqd_flag
+	,creatmtrlqd_auditingrep
+	,creatmtrlqd_auditingdate
+	,erp_mtrlcode AS erp_mtrlcode
+	,erp_mtrlid
+	,nottax_factory_cost / (dept_profitrate + dept_profitrate_rangli / 100) AS dijia_cost
+	,erp_mtrlengname
+	,0 AS yongjin
+FROM u_mattress
+  </selectstr>
+  <where>
+	<when notnull="@arg_deptid">
+		u_mattress.deptid = @arg_deptid
+	</when>
+	<when>
+		u_mattress.createby in ($$user_outrepstr$$)
+	</when>
+	<when>
+		u_mattress.deptid in ($$user_deptstr$$)
+	</when>
+  </where>
+  <displayfields>
+    <field field="pid" compute="getrow()">序</field>
+    <field field="erp_mtrlcode">L1物料编码</field>
+    <field field="mattresscode">报价唯一码</field>
+    <field field="mattressrelcode">床垫编码</field>
+    <field field="mattressname">床垫名称</field>
+    <field field="mattresstypeid" mapper="">床垫类别</field>
+    <field field="mattress_width" datatype="number">床垫宽/CM</field>
+    <field field="mattress_length" datatype="number">床垫长/CM</field>
+    <field field="mattress_height" datatype="number">床垫高/CM</field>
+    <field field="createby">登记人</field>
+    <field field="createtime" datatype="datetime">登记时间</field>
+    <field field="deptid" mapper="">部门</field>
+    <field field="yw_auditingrep">业务审核人</field>
+    <field field="yw_auditingdate" datatype="datetime">业务审核时间</field>
+    <field field="js1_auditingrep">产品补充审核人</field>
+    <field field="js1_auditingdate" datatype="datetime">产品补充审核时间</field>
+    <field field="js2_auditingrep">清单补充审核人</field>
+    <field field="js2_auditingdate" datatype="datetime">清单补充审核时间</field>
+    <field field="creatmtrl_auditingrep">生成L1产品人</field>
+    <field field="creatmtrl_auditingdate" datatype="datetime">生成L1产品时间</field>
+    <field field="creatmtrlqd_auditingrep">生成L1清单人</field>
+    <field field="creatmtrlqd_auditingdate" datatype="datetime">生成L1清单时间</field>
+    <field field="dijia_cost" datatype="number">底价</field>
+    <field field="yongjin" datatype="number">佣金</field>
+    <field field="taxrate" datatype="number">税率</field>
+    <field field="fob" datatype="number">Fob</field>
+    <field field="taxes" datatype="number">税金</field>
+    <field field="erp_mtrlengname">原来物料编码</field>
+  </displayfields>
+</select>

+ 0 - 5
JLHHJSvr/Excutor/GetERPConfigureListExcutor.cs

@@ -23,11 +23,6 @@ namespace JLHHJSvr.Excutor
                 rslt.ErrMsg = "会话已经中断,请重新登录";
                 return;
             }
-            if (request.typeid == null || request.typeid <= 0)
-            {
-                rslt.ErrMsg = "配置id有误,请检查!";
-                return;
-            }
 
             using (var con = new SqlConnection(GlobalVar.ConnectionString))
             using (var cmd = con.CreateCommand())

+ 62 - 0
JLHHJSvr/Excutor/GetERPMtrlTypeListExcutor.cs

@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using DirectService.Tools;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class GetERPMtrlTypeListExcutor : ExcutorBase<GetERPMtrlTypeListRequest, GetERPMtrlTypeListResponse>
+    {
+        protected override void ExcuteInternal(GetERPMtrlTypeListRequest request, object state, GetERPMtrlTypeListResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                using (var erp_con = new SqlConnection(BllHelper.GetERPConnectString(cmd)))
+                using (var erp_cmd = erp_con.CreateCommand())
+                {
+                    erp_con.Open();
+
+                    var selectStr = @"SELECT
+	                                    u_mtrltype.mtrltypeid, 
+	                                    u_mtrltype.typecode, 
+	                                    u_mtrltype.mtrltype, 
+	                                    u_mtrltype.parentid
+                                    FROM
+	                                    u_mtrltype";
+                    var list = new List<u_mtrltype>();
+                    DbSqlHelper.SelectJoin(erp_cmd, selectStr, null, null, "parentid", "mtrltypeid,typecode,mtrltype,parentid", 0, 0, list);
+
+                    var pk = new PkName()
+                    {
+                        MainField = "mtrltypeid",
+                        MainName = "mtrltype",
+                        ParentField = "parentid"
+                    };
+
+                    ListEx.GetRecursions(list, pk, out var resultList);
+
+                    rslt.reList = resultList;
+                }
+            }
+        }
+    }
+}

+ 0 - 5
JLHHJSvr/Excutor/GetERPMtrldefListExcutor.cs

@@ -23,11 +23,6 @@ namespace JLHHJSvr.Excutor
                 rslt.ErrMsg = "会话已经中断,请重新登录";
                 return;
             }
-            if (request.mtrlid == null || request.mtrlid <= 0)
-            {
-                rslt.ErrMsg = "物料id有误,请检查!";
-                return;
-            }
 
             using (var con = new SqlConnection(GlobalVar.ConnectionString))
             using (var cmd = con.CreateCommand())

+ 1 - 6
JLHHJSvr/Excutor/GetERPWrkGrpListExcutor.cs

@@ -23,11 +23,6 @@ namespace JLHHJSvr.Excutor
                 rslt.ErrMsg = "会话已经中断,请重新登录";
                 return;
             }
-            if (request.wrkgrpid == null || request.wrkgrpid <= 0)
-            {
-                rslt.ErrMsg = "工组id有误,请检查!";
-                return;
-            }
 
             using (var con = new SqlConnection(GlobalVar.ConnectionString))
             using (var cmd = con.CreateCommand())
@@ -47,7 +42,7 @@ namespace JLHHJSvr.Excutor
 	                                        ,u_sc_workgroup.wrkgrpcode
                                         FROM u_sc_workgroup
                                         WHERE inuse = 1";
-                    var outputFields = "pzid,pzcode,name,inputtype";
+                    var outputFields = "wrkGrpid,wrkGrpName,wrkgrpcode";
 
                     if (request.wrkgrpid != null && request.wrkgrpid > 0)
                     {

+ 2 - 0
JLHHJSvr/Excutor/GetMattressInterfaceListExcutor.cs

@@ -52,6 +52,7 @@ namespace JLHHJSvr.Excutor
 		                                ELSE erp_mtrlengname
 		                                END AS erp_mtrlengname
 	                                ,old_mtrlname AS old_mtrlname
+                                    ,deptid
                                 FROM u_mattress
                                 WHERE u_mattress.mattressid = @mattressid";
                 cmd.Parameters.Clear();
@@ -63,6 +64,7 @@ namespace JLHHJSvr.Excutor
                         {
                             mattressid = request.mattressid.Value,
                             erp_mtrlid = Convert.ToInt32(reader["erp_mtrlid"]),
+                            deptid = Convert.ToInt32(reader["deptid"]),
                             mattressname = Convert.ToString(reader["mattressname"]),
                             mattresscode = Convert.ToString(reader["mattresscode"]),
                             mattressrelcode = Convert.ToString(reader["mattressrelcode"]),

+ 11 - 2
JLHHJSvr/Excutor/RefreshMattressInterfaceQdExcutor.cs

@@ -36,7 +36,7 @@ namespace JLHHJSvr.Excutor
                 var mattress = new u_mattress() { mattressid = request.mattressid.Value };
                 DbSqlHelper.SelectOne(cmd, mattress, "js2_flag");
 
-                if (mattress.js2_flag == 1)
+                if (request.isCheck == 1 && mattress.js2_flag == 1)
                 {
                     throw new LJCommonException("床垫已技术2审核,不能重新生成!");
                 }
@@ -78,7 +78,16 @@ namespace JLHHJSvr.Excutor
 
                     if(request.isPz != null && request.isPz == 1)
                     {
-                        var copyDict = copy_list.ToDictionary(mx2 => Tuple.Create(mx2.itemname, mx2.bj_pzname, mx2.bj_pzname_mx), mx2 => mx2);
+                        var copyDict = new Dictionary<Tuple<string, string, string>, u_mattress_interface_qd>();
+
+                        foreach (var mx2 in copy_list)
+                        {
+                            var key = Tuple.Create(mx2.itemname, mx2.bj_pzname, mx2.bj_pzname_mx);
+                            if (!copyDict.ContainsKey(key))
+                            {
+                                copyDict[key] = mx2;
+                            }
+                        }
 
                         // 遍历qdList
                         foreach (var mx in qdList)

+ 1 - 1
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -183,8 +183,8 @@ namespace JLHHJSvr
                 excutorManager.AddMap("GetERPMtrldefList", typeof(GetERPMtrldefListRequest), new GetERPMtrldefListExcutor());// 获取ERP物料资料
                 excutorManager.AddMap("GetERPConfigureList", typeof(GetERPConfigureListRequest), new GetERPConfigureListExcutor());// 获取ERP配置资料
                 excutorManager.AddMap("GetERPWrkGrpList", typeof(GetERPWrkGrpListRequest), new GetERPWrkGrpListExcutor());// 获取ERP配置资料
+                excutorManager.AddMap("GetERPMtrlTypeList", typeof(GetERPMtrlTypeListRequest), new GetERPMtrlTypeListExcutor());// 获取ERP配置资料
                 excutorManager.AddMap("GetMattressInterfaceList", typeof(GetMattressInterfaceListRequest), new GetMattressInterfaceListExcutor());// 获取ERP配置资料
-
             }
             catch (Exception ex)
             {

+ 39 - 15
JLHHJSvr/Helper/InterfaceHelper.cs

@@ -1014,19 +1014,24 @@ namespace JLHHJSvr.Helper
         {
             foreach(var mx in qdList)
             {
-                if(mx.erp_mtrlid <= 0)
+                if(mx.mtrlid != null && mx.mtrlid > 0 && (mx.erp_mtrlid == null || mx.erp_mtrlid <= 0))
                 {
                     var mtrldef = new u_mtrl_price() { mtrlid = mx.mtrlid };
                     if(DbSqlHelper.SelectOne(cmd, mtrldef, "erp_mtrlid") == 1)
                     {
                         mx.erp_mtrlid = mtrldef.erp_mtrlid;
                     }
+                }else
+                {
+                    mx.erp_mtrlid = 0;
                 }
             }
 
             foreach(var mx in qdList)
             {
-                erp_cmd.CommandText = @"SELECT mtrlid
+                if(mx.erp_mtrlid > 0)
+                {
+                    erp_cmd.CommandText = @"SELECT mtrlid
 	                                    ,mtrlcode
 	                                    ,mtrlname
 	                                    ,mtrlmode
@@ -1036,17 +1041,18 @@ namespace JLHHJSvr.Helper
 	                                    ,zxmtrlmode
                                     FROM u_mtrldef
                                     WHERE mtrlid = @mtrlid";
-                erp_cmd.Parameters.Clear();
-                erp_cmd.Parameters.AddWithValue("@mtrlid", mx.erp_mtrlid);
-                using(var reader = erp_cmd.ExecuteReader())
-                {
-                    if (reader.Read())
+                    erp_cmd.Parameters.Clear();
+                    erp_cmd.Parameters.AddWithValue("@mtrlid", mx.erp_mtrlid);
+                    using (var reader = erp_cmd.ExecuteReader())
                     {
-                        mx.erp_mtrlcode = Convert.ToString(reader["mtrlcode"]);
-                        mx.erp_mtrlname = Convert.ToString(reader["mtrlname"]);
-                        mx.erp_mtrlmode = Convert.ToString(reader["mtrlmode"]);
-                        mx.erp_unit = Convert.ToString(reader["unit"]);
-                        mx.erp_mtrlengname = Convert.ToString(reader["zxmtrlmode"]);
+                        if (reader.Read())
+                        {
+                            mx.erp_mtrlcode = Convert.ToString(reader["mtrlcode"]);
+                            mx.erp_mtrlname = Convert.ToString(reader["mtrlname"]);
+                            mx.erp_mtrlmode = Convert.ToString(reader["mtrlmode"]);
+                            mx.erp_unit = Convert.ToString(reader["unit"]);
+                            mx.erp_mtrlengname = Convert.ToString(reader["zxmtrlmode"]);
+                        }
                     }
                 }
             }
@@ -1201,7 +1207,9 @@ namespace JLHHJSvr.Helper
                 {"V侧2",new string[] { "V侧", "V侧2裥棉", "V侧2裥棉图案" } },
                 {"V侧3",new string[] { "V侧", "V侧3裥棉", "V侧3裥棉图案", "V侧说明" } }
             };
+            var extreDict = new HashSet<string>() { "小侧", "V侧" };
             var jianmianList = mxlist.Where(t => t.formulatype == 0).ToList();
+            var isEnter = false;
 
             #region wf_import_qingdan_prdpf
             foreach (var item in powerDict)
@@ -1230,11 +1238,27 @@ namespace JLHHJSvr.Helper
                     }
                 }
 
-                foreach(var name in chastrArrDict[item.Key])
+                if(item.Key.Contains("小侧3") || item.Key.Contains("V侧3"))
                 {
-                    if(name.Contains("说明"))
+                    var list = qdList.FindAll(t => extreDict.Contains(t.itemname)).ToList();
+                    if(list.Any())
                     {
-                        qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], name, ""));
+                        foreach (var name in chastrArrDict[item.Key])
+                        {
+                            if (name.Contains("说明"))
+                            {
+                                qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], name, ""));
+                            }
+                        }
+                    }
+                } else
+                {
+                    foreach (var name in chastrArrDict[item.Key])
+                    {
+                        if (name.Contains("说明"))
+                        {
+                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], name, ""));
+                        }
                     }
                 }
             }

+ 2 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -100,6 +100,7 @@
     <Compile Include="Com\GetBedNetVarList.cs" />
     <Compile Include="Com\GetBillList.cs" />
     <Compile Include="Com\GetCarList.cs" />
+    <Compile Include="Com\GetERPMtrlTypeList.cs" />
     <Compile Include="Com\GetMattressImportDW2.cs" />
     <Compile Include="Com\GetMattressPackagMx.cs" />
     <Compile Include="Com\GetComputeMattress.cs" />
@@ -271,6 +272,7 @@
     <Compile Include="Excutor\GetBedNetVarListExcutor.cs" />
     <Compile Include="Excutor\GetBillListExcutor.cs" />
     <Compile Include="Excutor\GetCarListExcutor.cs" />
+    <Compile Include="Excutor\GetERPMtrlTypeListExcutor.cs" />
     <Compile Include="Excutor\GetMattressPackagMxExcutor.cs" />
     <Compile Include="Excutor\GetMattressImportDW2Excutor.cs" />
     <Compile Include="Excutor\GetComputeMattressExcutor.cs" />

+ 1 - 0
JLHWEB/src/api/interface/index.ts

@@ -1244,6 +1244,7 @@ export namespace Mattress {
   export interface ReqRefreshMattressInterface {
     mattressid: number;
     isPz?: number;
+    isCheck?: number;
   }
   export interface ResRefreshMattressInterface {
     mxList: any[];

+ 5 - 1
JLHWEB/src/api/modules/common.ts

@@ -1,4 +1,4 @@
-import { GenericApi, DwLayout, FileApi } from "@/api/interface/index";
+import { GenericApi, DwLayout, FileApi, Basicinfo } from "@/api/interface/index";
 import { PORT1, PORT_DL } from "@/api/config/servicePort";
 import http from "@/api";
 
@@ -82,3 +82,7 @@ export const GetERPConfigureList = (params?: GenericApi.ReqGetERPConfigureList)
 export const GetERPWrkGrpList = (params?: GenericApi.ReqGetERPWrkGrpList) => {
   return http.post<GenericApi.ResGetERPWrkGrpList>(PORT1 + `/GetERPWrkGrpList`, params);
 };
+
+export const GetERPMtrlTypeList = () => {
+  return http.post<Basicinfo.ResGetMtrlTypeList>(PORT1 + `/GetERPMtrlTypeList`);
+};

+ 5 - 1
JLHWEB/src/enums/dwnameEnum.ts

@@ -149,5 +149,9 @@ export enum DwnameEnum {
   /**
    * @description 床垫接口清单
    */
-  mattressInterfaceQd = "u_mattress_interface_qd"
+  mattressInterfaceQd = "u_mattress_interface_qd",
+  /**
+   * @description 床垫-选择
+   */
+  mattressChoose = "u_mattress_choose"
 }

+ 3 - 0
JLHWEB/src/languages/modules/zh-cn/business.json

@@ -286,6 +286,9 @@
     },
     "bednet": {
       "title": "床网选择"
+    },
+    "mattress": {
+      "title": "床垫选择"
     }
   },
   "sptPriceChange": {

+ 7 - 0
JLHWEB/src/utils/index.ts

@@ -1235,3 +1235,10 @@ export const getCurrentRecords = (targetRef: any) => {
 
   return { $table, curRecords };
 };
+
+export const transformTreeData = (data: any) => {
+  return data.map(node => ({
+    ...node.data,
+    children: node.children ? transformTreeData(node.children) : []
+  }));
+};

+ 14 - 5
JLHWEB/src/views/quote/mattressInterface/detail.vue

@@ -43,7 +43,7 @@
     </template>
   </LjDetail>
 
-  <!-- <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" /> -->
+  <MattressDialog ref="MattressDialogRef" v-bind="MattressDialogProps" />
 </template>
 
 <script setup lang="tsx" name="mattressInterfaceDetail">
@@ -60,7 +60,7 @@ import { SaveMattressInterface } from "@/api/modules/quote";
 import { ElMessage, ElMessageBox } from "element-plus";
 import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
-import MtrldefDialog from "@/views/system/selector/mtrldefNoPrice/index.vue";
+import MattressDialog from "@/views/system/selector/mattress/index.vue";
 import { formatToDate } from "@/utils/dateUtil";
 
 interface detailProp {
@@ -97,9 +97,12 @@ const {
   editType,
   mattressYWList,
   mattressQDList,
+  MattressDialogRef,
+  MattressDialogProps,
   RetriveMattressInterface,
   RefreshMattressInterfaceList,
-  RefreshMattressInterfaceQdList
+  RefreshMattressInterfaceQdList,
+  fModelChoseMattress
 } = useHooks(t);
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
@@ -203,7 +206,9 @@ const orderDefaultAction = [
       return !orderStatus.value || editType.value == 3;
     },
     clickFunc: item => {
-      throw new Error("功能没开放");
+      fModelChoseMattress().then((res: any) => {
+        RefreshMattressInterfaceList(res.mattressid, 1);
+      });
     }
   }),
   buttonDefault({
@@ -229,7 +234,11 @@ const orderDefaultAction = [
     limited: () => {
       return !orderStatus.value;
     },
-    clickFunc: item => {}
+    clickFunc: item => {
+      fModelChoseMattress().then((res: any) => {
+        RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
+      });
+    }
   }),
   buttonDefault({
     label: "重新生成清单",

+ 61 - 12
JLHWEB/src/views/quote/mattressInterface/hooks/index.tsx

@@ -1,13 +1,13 @@
-import { ref, reactive, computed, toRefs } from "vue";
+import { ref, reactive, computed, toRefs, nextTick } from "vue";
 import { Table } from "@/hooks/interface";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { ALLOW_EDIT_STATE } from "@/config/index";
 import { GetMattressInterfaceList, RefreshMattressInterface, RefreshMattressInterfaceQd } from "@/api/modules/quote";
 import { ElMessage, ElMessageBox } from "element-plus";
-import { CommonDynamicSelect, GetERPMtrldefList } from "@/api/modules/common";
-import { useHooks as useHooks_mtrltype } from "@/views/baseinfo/mtrltype/hooks/index";
-import { number } from "echarts";
-const { gMtrltypeList } = useHooks_mtrltype();
+import { CommonDynamicSelect, GetERPMtrldefList, GetERPWrkGrpList, GetERPMtrlTypeList } from "@/api/modules/common";
+import { transformTreeData } from "@/utils/index";
+import { floatSub, floatAdd, floatMul, floatDiv, formatFixedNumber } from "@/utils/index";
+
 interface defaultState {
   /**
    * @description 单据当前状态
@@ -25,6 +25,8 @@ interface defaultState {
   mattressYWList: any[];
   mattressQDList: any[];
   editType: number;
+  MattressDialogRef: any;
+  MattressDialogProps: any;
 }
 
 const state = reactive<defaultState>({
@@ -34,7 +36,9 @@ const state = reactive<defaultState>({
   mainData: {},
   mattressYWList: [],
   mattressQDList: [],
-  editType: 0
+  editType: 0,
+  MattressDialogRef: null,
+  MattressDialogProps: {}
 });
 /**
  * @description 表格多选数据操作
@@ -163,7 +167,12 @@ export const useHooks = (t?: any) => {
     },
     {
       field: "yongjin",
-      title: "佣金"
+      title: "佣金",
+      render: (scope: any) => {
+        let result = floatSub(floatDiv(scope.row.dijia_cost, floatSub(1, scope.row.commission - 1)), scope.row.dijia_cost);
+        result = formatFixedNumber({ val: result });
+        return <>{result}</>;
+      }
     },
     {
       field: "taxrate",
@@ -246,7 +255,10 @@ export const useHooks = (t?: any) => {
         order: 3,
         span: 1
       },
-      enum: gMtrltypeList,
+      enum: async () => {
+        const data = await GetERPMtrlTypeList();
+        return transformTreeData(data.reList);
+      },
       fieldNames: {
         label: "mtrltype",
         value: "mtrltypeid",
@@ -487,8 +499,14 @@ export const useHooks = (t?: any) => {
     {
       field: "wrkgrpid",
       title: "领用工组",
+      enum: async () => {
+        const data = await GetERPWrkGrpList();
+        return { data: data.workgroupList };
+      },
+      isFilterEnum: true,
+      fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
       editRender: {
-        name: "$input"
+        name: "$select"
       }
     },
     {
@@ -560,8 +578,10 @@ export const useHooks = (t?: any) => {
    * 获取产品配置,产品清单
    * @param mattressid 床垫ID
    */
-  const RefreshMattressInterfaceQdList = async (mattressid: number, isPz: number) => {
-    let res = await RefreshMattressInterfaceQd({ mattressid, isPz });
+  const RefreshMattressInterfaceQdList = async (mattressid: number, isPz: number, isCheck?: number) => {
+    isCheck = isCheck ?? 1;
+
+    let res = await RefreshMattressInterfaceQd({ mattressid, isPz, isCheck });
 
     const interfaceMap = {};
     state.mattressYWList.forEach(mb => {
@@ -587,6 +607,34 @@ export const useHooks = (t?: any) => {
     state.mattressQDList = res.mxList;
   };
 
+  /**
+   * @description 弹窗模块:床垫选择
+   * @param data 当前数据
+   * @param status 当前订单状态
+   * @returns Promise
+   */
+  const fModelChoseMattress = (label?: string) => {
+    return new Promise((resolve, reject) => {
+      let _params = {
+        arg_deptid: state.mainData.deptid
+      };
+      state.MattressDialogProps = {
+        onSubmit: (res: any) => {
+          // submit
+          console.log("openCustDialog res", res);
+          nextTick(() => {
+            resolve(res.value[0]);
+          });
+        },
+        onCancel: (error: any) => {
+          // cancel 回调
+          console.log("openCustDialog error", error);
+        }
+      };
+      state.MattressDialogRef.show(_params, label);
+    });
+  };
+
   return {
     ...toRefs(state),
     columns,
@@ -595,6 +643,7 @@ export const useHooks = (t?: any) => {
     columns_qd,
     RetriveMattressInterface,
     RefreshMattressInterfaceList,
-    RefreshMattressInterfaceQdList
+    RefreshMattressInterfaceQdList,
+    fModelChoseMattress
   };
 };

+ 153 - 0
JLHWEB/src/views/system/selector/mattress/hooks/index.tsx

@@ -0,0 +1,153 @@
+import { ColumnProps, SearchProps } from "@/components/LjVxeTable/interface";
+import type { uSale } from "@/typings/modules/sale";
+import { Table } from "@/hooks/interface/index";
+import { useUserStore } from "@/stores/modules/user";
+import { floatSub, floatAdd, floatMul, floatDiv, formatFixedNumber } from "@/utils/index";
+
+export const useOutrep = (t: any) => {
+  // 表格配置项
+  const columns: ColumnProps<any>[] = [
+    { title: "#", field: "pid", fixed: "left", width: 80 },
+    {
+      field: "yw_flag",
+      title: "业务审核"
+    },
+    {
+      field: "js1_flag",
+      title: "产品补充审核"
+    },
+    {
+      field: "js2_flag",
+      title: "清单补充审核"
+    },
+    {
+      field: "creatmtrl_flag",
+      title: "生成L1产品"
+    },
+    {
+      field: "creatmtrlqd_flag",
+      title: "生成L1清单"
+    },
+    {
+      field: "erp_mtrlcode",
+      title: "L1物料编码"
+    },
+    {
+      field: "deptid",
+      title: "部门"
+    },
+    {
+      field: "mattresscode",
+      title: "报价唯一码"
+    },
+    {
+      field: "mattressrelcode",
+      title: "床垫编码"
+    },
+    {
+      field: "mattressname",
+      title: "床垫名称"
+    },
+    {
+      field: "mattresstypeid",
+      title: "床垫类别"
+    },
+    {
+      field: "mattress_width",
+      title: "床垫宽/CM"
+    },
+    {
+      field: "mattress_length",
+      title: "床垫长/CM"
+    },
+    {
+      field: "mattress_height",
+      title: "床垫高/CM"
+    },
+    {
+      field: "createby",
+      title: "登记人"
+    },
+    {
+      field: "createtime",
+      title: "登记时间"
+    },
+    {
+      field: "yw_auditingrep",
+      title: "业务审核人"
+    },
+    {
+      field: "yw_auditingdate",
+      title: "业务审核时间"
+    },
+    {
+      field: "js1_auditingrep",
+      title: "产品补充审核人"
+    },
+    {
+      field: "js1_auditingdate",
+      title: "产品补充审核时间"
+    },
+    {
+      field: "js2_auditingrep",
+      title: "清单补充审核人"
+    },
+    {
+      field: "js2_auditingdate",
+      title: "清单补充审核时间"
+    },
+    {
+      field: "creatmtrl_auditingrep",
+      title: "生成L1产品人"
+    },
+    {
+      field: "creatmtrl_auditingdate",
+      title: "生成L1产品时间"
+    },
+    {
+      field: "creatmtrlqd_auditingrep",
+      title: "生成L1清单人"
+    },
+    {
+      field: "creatmtrlqd_auditingdate",
+      title: "生成L1清单时间"
+    },
+    {
+      field: "dijia_cost",
+      title: "底价"
+    },
+    {
+      field: "yongjin",
+      title: "佣金",
+      render: (scope: any) => {
+        let result = floatSub(floatDiv(scope.row.dijia_cost, floatSub(1, scope.row.commission - 1)), scope.row.dijia_cost);
+        result = formatFixedNumber({ val: result });
+        return <>{result}</>;
+      }
+    },
+    {
+      field: "taxrate",
+      title: "税率"
+    },
+    {
+      field: "fob",
+      title: "FOB"
+    },
+    {
+      field: "taxes",
+      title: "税金"
+    },
+    {
+      field: "erp_mtrlengname",
+      title: "原物料编码"
+    },
+    {
+      field: "erp_configcodetype",
+      title: "ERP配置类型"
+    }
+  ];
+
+  return {
+    columns
+  };
+};

+ 190 - 0
JLHWEB/src/views/system/selector/mattress/index.vue

@@ -0,0 +1,190 @@
+<template>
+  <LjSelector
+    ref="LjSelectorRef"
+    :title="`${$t('business.selector.mattress.title')} ${subtitle ? '(' + subtitle + ')' : ''}`"
+    v-model:value="selectList"
+    v-bind="$attrs"
+    :item-key="TABLE_KEY"
+    :layout="layout"
+    @change-value="autoUpdateTableCheckbox"
+  >
+    <template #default>
+      <LjVxeTable
+        ref="LjTableRef"
+        table-cls=""
+        :columns="selColumns"
+        :request-api="getData"
+        :data-callback="dataCallback"
+        :init-param="initParams"
+        :dwname="DwnameEnum.mattressChoose"
+        pagination
+        :search-col="tableSearchCol"
+        :table-events="tableEvents"
+        :table-props="tableProps"
+        :tool-button="['refresh', 'setting', 'search']"
+        :auto-load-layout="false"
+        collapse-buttons
+        :page-change-call-back="autoUpdateTableCheckbox"
+      >
+      </LjVxeTable>
+    </template>
+  </LjSelector>
+</template>
+
+<script lang="tsx" setup name="SelectorMattressDialog">
+import { reactive, toRefs, ref, onMounted, nextTick, inject, watch, computed } from "vue";
+// import LjDialog from "@/components/LjDialog/index.vue";
+// import LjFoldLayoutDouble from "@/components/LjFoldLayoutDouble/index.vue";
+import LjVxeTable from "@/components/LjVxeTable/index.vue";
+// 注意: 需要按需引入使用到的第三方UI组件
+// import { ElDialog, ElButton } from "element-plus";
+
+import { useOutrep } from "./hooks/index";
+import { useI18n } from "vue-i18n";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import { cloneDeep, pick, defaultsDeep } from "lodash-es";
+import { CommonDynamicSelect } from "@/api/modules/common";
+// import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+
+import LjSelector from "@/components/LjSelector/index.vue";
+import { throttle } from "lodash-es";
+import { Search } from "@element-plus/icons-vue";
+// import variables from "@/styles/js.module.scss";
+
+// const props = withDefaults(defineProps<{}>(), {});
+
+const { t } = useI18n();
+const { columns } = useOutrep(t);
+const selColumns: any = computed(() => {
+  // let selCol: any = { type: "checkbox", width: 50, fixed: "left" };
+  let selCol: any = { type: "radio", width: 50, fixed: "left" };
+  let _columns = cloneDeep(columns);
+  // console.log(" _columns.unshift(selCol); :>> ", _columns.unshift(selCol));
+  _columns.unshift(selCol);
+  console.log("_columns :>> ", _columns);
+  return _columns;
+});
+
+/**
+ * @description 已选列表
+ */
+const selectList = ref<any>([]);
+const TABLE_KEY = "mattressid";
+const layout = { first: { left: { hidden: true } } };
+
+const LjSelectorRef = ref();
+const LjTableRef = ref();
+// const _variables: any = variables;
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+
+const initParams = ref<any>({});
+const searchInput = ref("");
+const tableSearchCol = { xs: 4, sm: 5, md: 6, lg: 6, xl: 8 };
+const tableProps = {
+  height: "auto",
+  editConfig: { trigger: "click", mode: "cell" },
+  rowConfig: { isCurrent: true, isHover: true, useKey: true, keyField: TABLE_KEY }
+};
+
+const subtitle = ref("");
+
+/**
+ * @description 鼠标单击表格
+ */
+const handleClickTable = async ({ row, column, rowIndex }: any) => {
+  const $table = LjTableRef.value.element;
+  if ($table) {
+    selectList.value = [row];
+    $table.setRadioRow(row);
+  }
+};
+
+/**
+ * @description 鼠标双击表格
+ */
+const handleDBlClickTable = async ({ row, column, rowIndex }: any) => {
+  const $table = LjTableRef.value.element;
+  if ($table) {
+    selectList.value = [row];
+    $table.setRadioRow(row);
+
+    LjSelectorRef.value.funcSubmit();
+  }
+};
+
+// 返回绑定的事件
+const tableEvents = {
+  "cell-dblclick": handleDBlClickTable,
+  "cell-click": handleClickTable
+};
+
+const dataCallback = (data: any) => {
+  console.log("data :>> ", data);
+  return {
+    list: data.datatable,
+    tableinfo: data.tableinfo,
+    total: data.totalcnt,
+    pageNum: data.pageindex,
+    pageSize: data.pagesize
+  };
+};
+
+const getData = (params: any) => {
+  // console.log("getData params :>> ", params);
+  let newParams: any = {};
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+
+  delete params.pageNum;
+  delete params.pageSize;
+  newParams.queryParams = initParams.value;
+  console.log("params :>> ", newParams);
+  newParams.dsname = "web_mattress_choose";
+  return CommonDynamicSelect(newParams, DwnameEnum.mtrlPrice);
+};
+
+const autoUpdateTableCheckbox = () => {
+  const $table = LjTableRef.value.element;
+  if ($table && selectList.value.length) {
+    console.log("autoUpdateTableCheckbox selectLst.value :>> ", selectList.value);
+    $table.clearCheckboxRow();
+    let _rows: any = [];
+    selectList.value.map((item: any) => {
+      if ($table.getRowById(item[TABLE_KEY])) {
+        _rows.push($table.getRowById(item[TABLE_KEY]));
+      }
+    });
+    _rows.length && $table.setCheckboxRow(_rows, true);
+  }
+};
+
+/**
+ * @description 打开组件
+ * @param params 入参
+ */
+const show = (params: any, label?: string) => {
+  selectList.value = [];
+  searchInput.value = "";
+
+  subtitle.value = label;
+
+  console.log("show bfff initParams.value :>> ", initParams.value, params);
+  initParams.value = defaultsDeep(params, initParams.value);
+  console.log("show afff initParams.value :>> ", initParams.value);
+  LjSelectorRef.value.show(initParams.value);
+};
+
+// 节流
+const disshow = throttle((val: any) => {
+  console.log("val :>> ", val);
+  // initParams.value = defaultsDeep({ keyword: val }, initParams.value);
+  initParams.value.keyword = val;
+
+  console.log("disshow initParams.value :>> ", initParams.value);
+}, 500);
+
+defineExpose({
+  show
+});
+</script>