Selaa lähdekoodia

1、新增软床公式定义接口
2、新增ERP物料资料定义接口

MY 1 kuukausi sitten
vanhempi
commit
7c453a0b20
31 muutettua tiedostoa jossa 1836 lisäystä ja 114 poistoa
  1. 45 0
      JLHHJSvr/Com/GetErpMtrlPriceList.cs
  2. 20 0
      JLHHJSvr/Com/Model/u_erpmtrl_price.cs
  3. 22 0
      JLHHJSvr/Com/Model/u_softbed_formula.cs
  4. 1 1
      JLHHJSvr/Com/Model/u_softbed_mx.cs
  5. 26 0
      JLHHJSvr/Com/SaveErpMtrlPriceList.cs
  6. 22 0
      JLHHJSvr/Com/SaveSoftBedFormula.cs
  7. 29 0
      JLHHJSvr/DataStore/web_softbed_formulalist.xml
  8. 104 0
      JLHHJSvr/Excutor/GetErpMtrlPriceListExcutor.cs
  9. 77 0
      JLHHJSvr/Excutor/SaveErpMtrlPriceListExcutor.cs
  10. 59 0
      JLHHJSvr/Excutor/SaveSoftBedFormulaExcutor.cs
  11. 3 0
      JLHHJSvr/GlobalVar/GlobalVar.cs
  12. 63 0
      JLHHJSvr/Helper/BasicInfoHelper.cs
  13. 8 32
      JLHHJSvr/Helper/SoftBedHelper.cs
  14. 8 0
      JLHHJSvr/JLHHJSvr.csproj
  15. 3 0
      JLHWEB/src/api/interface/index.ts
  16. 27 1
      JLHWEB/src/api/modules/basicinfo.ts
  17. 5 1
      JLHWEB/src/enums/dwnameEnum.ts
  18. 2 1
      JLHWEB/src/languages/modules/zh-cn/menu.json
  19. 68 0
      JLHWEB/src/routers/modules/baseRouter.ts
  20. 182 0
      JLHWEB/src/views/baseinfo/erpmtrldef/components/ImportPrice.vue
  21. 93 0
      JLHWEB/src/views/baseinfo/erpmtrldef/detail.vue
  22. 199 0
      JLHWEB/src/views/baseinfo/erpmtrldef/hooks/index.tsx
  23. 199 0
      JLHWEB/src/views/baseinfo/erpmtrldef/index.vue
  24. 1 0
      JLHWEB/src/views/baseinfo/mtrltype/hooks/index.tsx
  25. 106 0
      JLHWEB/src/views/baseinfo/softbedformula/detail.vue
  26. 184 0
      JLHWEB/src/views/baseinfo/softbedformula/hooks/index.tsx
  27. 150 0
      JLHWEB/src/views/baseinfo/softbedformula/index.vue
  28. 1 0
      JLHWEB/src/views/quote/softbedQuote/components/BedConfigModal.vue
  29. 17 2
      JLHWEB/src/views/quote/softbedQuote/components/ConfigSection.vue
  30. 2 33
      JLHWEB/src/views/quote/softbedQuote/detail.vue
  31. 110 43
      JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx

+ 45 - 0
JLHHJSvr/Com/GetErpMtrlPriceList.cs

@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class GetErpMtrlPriceListRequest : ILJRequest<GetErpMtrlPriceListResponse>
+    {
+        /// <summary>
+        /// 登录token
+        /// </summary>
+        public string token { get; set; }
+        /// <summary>
+        /// 物料类别
+        /// </summary>
+        public int? mtrltypeid { get; set; }
+        public string keyword { get; set; }
+        public string mtrlname { get; set; }
+        public string mtrlcode { get; set; }
+        public string mtrlmode { get; set; }
+        public string mtrlsectype { get; set; }
+        public string zxmtrlmode { get; set; }
+        public string usermtrlmode { get; set; }
+        public string plancode { get; set; }
+        public string mtrlengname { get; set; }
+
+        public int pageindex { get; set; }
+        public int pagesize { get; set; }
+        public override string GetApiName()
+        {
+            return "GetErpMtrlPriceList";
+        }
+    }
+
+    public sealed class GetErpMtrlPriceListResponse : LJResponse
+    {
+        public List<L1Mtrldef> mtrldefList { get; set; }
+        public int pageindex { get; set; }
+        public int pagesize { get; set; }
+        public int totalcnt { get; set; }
+    }
+}

+ 20 - 0
JLHHJSvr/Com/Model/u_erpmtrl_price.cs

@@ -0,0 +1,20 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mtrlid" })]
+    public class u_erpmtrl_price
+    {
+        public int mtrlid { get; set; }
+        public decimal price { get; set; }
+        public DateTime create_date { get; set; }
+        public string create_emp { get; set; }
+        public DateTime? update_date { get; set; }
+        public string update_emp { get; set; }
+    }
+}

+ 22 - 0
JLHHJSvr/Com/Model/u_softbed_formula.cs

@@ -0,0 +1,22 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "formulaid" })]
+    public class u_softbed_formula
+    {
+        public int formulaid { get; set; }
+        public string formulaname { get; set; }
+        public string use_formula { get; set; }
+        public string price_formula { get; set; }
+        public DateTime create_date { get; set; }
+        public string create_emp { get; set; }
+        public DateTime? update_date { get; set; }
+        public string update_emp { get; set; }
+    }
+}

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

@@ -13,7 +13,7 @@ namespace JLHHJSvr.Com.Model
         public int softbed_id { get; set; }
         public int printid { get; set; }
         public int pzid { get; set; }
-        public int pz_pringid { get; set; }
+        public int formulaid { get; set; }
         public int mtrlid { get; set; }
         public string mtrlname { get; set; }
         public string mtrlcode { get; set; }

+ 26 - 0
JLHHJSvr/Com/SaveErpMtrlPriceList.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class SaveErpMtrlPriceListRequest : ILJRequest<SaveErpMtrlPriceListResponse>
+    {
+        public override string GetApiName()
+        {
+            return "SaveErpMtrlPriceList";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 物料资料定义
+        /// </summary>
+        public List<u_erpmtrl_price> mtrldefList { get; set; }
+    }
+
+    public sealed class SaveErpMtrlPriceListResponse : LJResponse
+    {
+    }
+}

+ 22 - 0
JLHHJSvr/Com/SaveSoftBedFormula.cs

@@ -0,0 +1,22 @@
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class SaveSoftBedFormulaRequest : ILJRequest<SaveSoftBedFormulaResponse>
+    {
+        public override string GetApiName()
+        {
+            return "SaveSoftBedFormula";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 软床公式定义信息
+        /// </summary>
+        public u_softbed_formula formula { get; set; }
+    }
+
+    public sealed class SaveSoftBedFormulaResponse : LJResponse
+    {
+    }
+}

+ 29 - 0
JLHHJSvr/DataStore/web_softbed_formulalist.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+  <selectstr>
+SELECT formulaid
+	,formulaname
+	,use_formula
+	,price_formula
+	,create_date
+	,create_emp
+	,update_date
+	,update_emp
+FROM u_softbed_formula
+  </selectstr>
+  <where>
+  </where>
+	<orderstr>
+		formulaid
+	</orderstr>
+  <displayfields>
+    <field field="pid" compute="getrow()">序</field>
+    <field field="formulaname">公式名</field>
+    <field field="use_formula">用料量公式</field>
+    <field field="price_formula">单价公式</field>
+    <field field="create_date" datatype="datetime">登记时间</field>
+    <field field="create_emp">登记人</field>
+    <field field="update_date" datatype="datetime">修改时间</field>
+    <field field="update_emp">修改人</field>
+  </displayfields>
+</select>

+ 104 - 0
JLHHJSvr/Excutor/GetErpMtrlPriceListExcutor.cs

@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Web.UI.WebControls.WebParts;
+using DirectService.Tools;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+using Newtonsoft.Json.Linq;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class GetErpMtrlPriceListExcutor : ExcutorBase<GetErpMtrlPriceListRequest, GetErpMtrlPriceListResponse>
+    {
+        protected override void ExcuteInternal(GetErpMtrlPriceListRequest request, object state, GetErpMtrlPriceListResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var erpHelper = HelperBase.GetHelper<ERPHelper>(null);
+
+                var mtrldef = new L1Mtrldef()
+                {
+                    flag = 2,
+                };
+
+                if (!string.IsNullOrEmpty(request.mtrlcode))
+                {
+                    mtrldef.mtrlcode = request.mtrlcode;
+                }
+
+                if (!string.IsNullOrEmpty(request.mtrlname))
+                {
+                    mtrldef.mtrlname = request.mtrlname;
+                }
+
+                if (!string.IsNullOrEmpty(request.mtrlmode))
+                {
+                    mtrldef.mtrlmode = request.mtrlmode;
+                }
+
+                if (!string.IsNullOrEmpty(request.mtrlsectype))
+                {
+                    mtrldef.mtrlsectype = request.mtrlsectype;
+                }
+
+                if (!string.IsNullOrEmpty(request.zxmtrlmode))
+                {
+                    mtrldef.zxmtrlmode = request.zxmtrlmode;
+                }
+
+                if (!string.IsNullOrEmpty(request.usermtrlmode))
+                {
+                    mtrldef.usermtrlmode = request.usermtrlmode;
+                }
+
+                if (!string.IsNullOrEmpty(request.plancode))
+                {
+                    mtrldef.plancode = request.plancode;
+                }
+                if (!string.IsNullOrEmpty(request.mtrlengname))
+                {
+                    mtrldef.mtrlengname = request.mtrlengname;
+                }
+
+                int total = 0;
+                var resultList = erpHelper.GetERPMtrldef(cmd, ref total, request.keyword, mtrldef, request.pagesize, request.pageindex);
+
+
+                var mtrlids = resultList.Where(t => t.mtrlid > 0).Select(t => t.mtrlid).ToList();
+
+                if (mtrlids.Count > 0)
+                {
+                    var priceList = new List<u_erpmtrl_price>();
+
+                    DbSqlHelper.SelectJoin(cmd, $@"SELECT * FROM u_erpmtrl_price FROM mtrlid IN {ListEx.getString(mtrlids)}", null, null, "mtrlid", "mtrlid,price", 0,
+                       0, priceList);
+
+                }
+
+
+                rslt.mtrldefList = resultList;
+                rslt.totalcnt = total;
+                rslt.pageindex = request.pageindex;
+                rslt.pagesize = request.pagesize;
+            }
+        }
+    }
+}

+ 77 - 0
JLHHJSvr/Excutor/SaveErpMtrlPriceListExcutor.cs

@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using DirectService.Tools;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+using NPOI.SS.Formula;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class SaveErpMtrlPriceListExcutor : ExcutorBase<SaveErpMtrlPriceListRequest, SaveErpMtrlPriceListResponse>
+    {
+        protected override void ExcuteInternal(SaveErpMtrlPriceListRequest request, object state, SaveErpMtrlPriceListResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var mtrlids = request.mtrldefList.Where(t => t.mtrlid > 0).Select(t => t.mtrlid).ToList();
+                var existids = new List<int>();
+
+                if (mtrlids.Count > 0) 
+                {
+                    cmd.CommandText = $@"SELECT mtrlid FROM u_mtrldef WHERE mtrlid IN {ListEx.getString(mtrlids)}";
+                    cmd.Parameters.Clear();
+                    using (var reader = cmd.ExecuteReader())
+                    {
+                        while (reader.Read())
+                        {
+                            existids.Add(Convert.ToInt32(reader["mtrlid"]));
+                        }
+                    }
+
+                    if(existids.Count > 0 && existids.Count != mtrlids.Count)
+                    {
+                        var missingIds = mtrlids.Except(existids).ToList();
+                        throw new LJCommonException($"以下物料不存在,请检查!{ListEx.getString(missingIds)}");
+                    }
+                }
+
+
+                var baseHelper = HelperBase.GetHelper<BasicInfoHelper>(cmd);
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach(var mtrl in request.mtrldefList)
+                        {
+                            baseHelper.SaveErpMtrlPrice(mtrl);
+                        }
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        rslt.ErrMsg = e.Message;
+                        cmd.Transaction?.Rollback();
+                    }
+                }
+            }
+        }
+    }
+}

+ 59 - 0
JLHHJSvr/Excutor/SaveSoftBedFormulaExcutor.cs

@@ -0,0 +1,59 @@
+using System;
+using DirectService.Tools;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Helper;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class SaveSoftBedFormulaExcutor : ExcutorBase<SaveSoftBedFormulaRequest, SaveSoftBedFormulaResponse>
+    {
+        protected override void ExcuteInternal(SaveSoftBedFormulaRequest request, object state, SaveSoftBedFormulaResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            if (request.formula == null)
+            {
+                rslt.ErrMsg = "未提交软床公式定义信息";
+                return;
+            }
+
+            if (string.IsNullOrEmpty(request.formula.formulaname))
+            {
+                rslt.ErrMsg = "公式名称不能为空,请检查!";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var baseHelper = HelperBase.GetHelper<BasicInfoHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+                var _formula = ObjectHelper.DeepCopy(request.formula);
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        baseHelper.SaveSoftBedFormula(_formula);
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        rslt.ErrMsg = e.Message;
+                        cmd.Transaction?.Rollback();
+                    }
+                }
+            }
+        }
+    }
+}

+ 3 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -260,6 +260,9 @@ namespace JLHHJSvr
                 excutorManager.AddMap("AuditSoftBedQuote", typeof(AuditSoftBedQuoteRequest), new AuditSoftBedQuoteExcutor()); // 审核软床报价
                 excutorManager.AddMap("GetSoftBedMxList", typeof(GetSoftBedMxListRequest), new GetSoftBedMxListExcutor()); // 审核软床报价
                 excutorManager.AddMap("GetSoftBedConfigureList", typeof(GetSoftBedConfigureListRequest), new GetSoftBedConfigureListExcutor()); // 获取软床报价部件选配
+                excutorManager.AddMap("SaveSoftBedFormula", typeof(SaveSoftBedFormulaRequest), new SaveSoftBedFormulaExcutor()); // 保存软床公式定义
+                excutorManager.AddMap("SaveErpMtrlPriceList", typeof(SaveErpMtrlPriceListRequest), new SaveErpMtrlPriceListExcutor()); // 保存物料价格
+
             }
             catch (Exception ex)
             {

+ 63 - 0
JLHHJSvr/Helper/BasicInfoHelper.cs

@@ -1,6 +1,8 @@
 using JLHHJSvr.BLL;
 using JLHHJSvr.Com.Model;
+using JLHHJSvr.LJException;
 using LJLib.DAL.SQL;
+using NPOI.SS.Formula;
 using NPOI.SS.Formula.Functions;
 using System;
 using System.Collections.Generic;
@@ -12,6 +14,10 @@ namespace JLHHJSvr.Helper
 {
     internal class BasicInfoHelper: HelperBase
     {
+        /// <summary>
+        /// 核价选配类型-保存
+        /// </summary>
+        /// <param name="configure"></param>
         public void SaveConfigureType(u_configure_type configure)
         {
             if (configure.contfigtypeid <= 0)
@@ -31,5 +37,62 @@ namespace JLHHJSvr.Helper
                 DbSqlHelper.Update(cmd, "u_configure_type", null, configure, "contfigtypeid", fields);
             }
         }
+        /// <summary>
+        /// 核价软床公式定义-保存
+        /// </summary>
+        /// <param name="formula"></param>
+        public void SaveSoftBedFormula(u_softbed_formula formula)
+        {
+            if (formula == null)
+            {
+                throw new LJCommonException("未提交软床公式定义信息");
+            }
+
+            if (string.IsNullOrEmpty(formula.formulaname))
+            {
+                throw new LJCommonException($"公式名称不能为空,请检查!");
+            }
+
+            var fields = "formulaname,price_formula,use_formula";
+
+            if (formula.formulaid <= 0)
+            {
+                // 新建
+                fields += ",formulaid,create_date,create_emp";
+                formula.formulaid = BllHelper.GetID(cmd, "u_softbed_formula");
+                formula.create_date = context.opdate;
+                formula.create_emp = context.tokendata.username;
+
+                DbSqlHelper.Insert(cmd, "u_softbed_formula", null, formula, fields);
+            }
+            else
+            {
+                //修改
+                fields += ",update_date,update_emp";
+                formula.update_date = context.opdate;
+                formula.update_emp = context.tokendata.username;
+
+                DbSqlHelper.Update(cmd, "u_softbed_formula", null, formula, "formulaid", fields);
+            }
+        }
+        public void SaveErpMtrlPrice(u_erpmtrl_price mtrl)
+        {
+            var fields = "";
+
+            if(mtrl.mtrlid <= 0)
+            {
+                throw new LJCommonException("物料ID有误,请检查!");
+            }
+
+            mtrl.update_date = context.opdate;
+            mtrl.update_emp = context.tokendata.username;
+            if(DbSqlHelper.Update(cmd, "u_erpmtrl_price", null, mtrl, "mtrlid", "price,update_date,update_emp") == 0)
+            {
+                mtrl.create_date = context.opdate;
+                mtrl.create_emp = context.tokendata.username;
+
+                DbSqlHelper.Insert(cmd, "u_erpmtrl_price", null, mtrl, "mtrlid,price,create_date,create_emp");
+            }
+        }
     }
 }

+ 8 - 32
JLHHJSvr/Helper/SoftBedHelper.cs

@@ -40,16 +40,15 @@ namespace JLHHJSvr.Helper
 		/// <param name="billid"></param>
 		/// <param name="fields"></param>
 		/// <param name="mxlist"></param>
-        public void GetSoftBedMxList(int billid,string fields,out List<u_softbed_mx> mxlist,out List<u_configure_codemx> codeList)
+        public List<u_softbed_mx> GetSoftBedMxList(int billid,string fields = null)
         {
-            fields = fields ?? @"softbed_id,printid,pzid,pz_printid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
+            fields = fields ?? @"softbed_id,printid,pzid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
                                 useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,pzname,pzmxname";
-            mxlist = new List<u_softbed_mx>();
+            var mxlist = new List<u_softbed_mx>();
 
             var selectStr = @"SELECT u_softbed_mx.softbed_id
 								,u_softbed_mx.printid
 								,u_softbed_mx.pzid
-								,u_softbed_mx.pz_printid
 								,u_softbed_mx.mtrlid
 								,u_softbed_mx.mtrlname
 								,u_softbed_mx.mtrlcode
@@ -72,32 +71,10 @@ namespace JLHHJSvr.Helper
 								,u_softbed_mx.cost_amt
 								,u_configure_code.name AS pzname
 								,u_configure_codemx.namemx AS pzmxname
-							FROM u_softbed_mx
-								INNER JOIN u_configure_codemx ON u_configure_codemx.pzid = u_softbed_mx.pzid
-											AND u_configure_codemx.printid = u_softbed_mx.pz_printid
-								INNER JOIN u_configure_code ON u_configure_code.pzid = u_configure_codemx.pzid";
-
-            DbSqlHelper.SelectJoin(cmd, selectStr, "softbed_id = @billid", new Dictionary<string, object>() { { "@billid", billid } }, "printid,pz_printid", fields, 0, 0, mxlist);
-
-            codeList = mxlist.GroupBy(item => new { item.pzid, item.pz_pringid })
-                            .Select(group => new u_configure_codemx
-                            {
-                                pzid = group.Key.pzid,
-                                printid = group.Key.pz_pringid,
-                                pzname = group.First().pzname,
-                                namemx = group.First().pzmxname,
-                            })
-                            .ToList();
-        }
-		/// <summary>
-		/// 获取软床报价单据明细
-		/// </summary>
-		/// <param name="billid"></param>
-		/// <param name="fields"></param>
-		/// <param name="mxlist"></param>
-        public List<u_softbed_mx> GetSoftBedMxList(int billid, string fields = null)
-        {
-            GetSoftBedMxList(billid, fields, out var mxlist, out _);
+							FROM u_softbed_mx";
+
+            DbSqlHelper.SelectJoin(cmd, selectStr, "softbed_id = @billid", new Dictionary<string, object>() { { "@billid", billid } }, "printid", fields, 0, 0, mxlist);
+
 			return mxlist;
         }
         /// <summary>
@@ -165,7 +142,6 @@ namespace JLHHJSvr.Helper
 			var mx = new u_softbed_mx()
 			{
 				pzid = bomItem.pzid,
-				pz_pringid = bomItem.printid,
 				mtrlid = bomItem.mtrlid,
 				mtrlname = bomItem.mtrlname,
 				mtrlcode = bomItem.mtrlcode,
@@ -220,7 +196,7 @@ namespace JLHHJSvr.Helper
                             template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,money_type,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
                             dept_cost,foreign_cost";
 
-			var mx_fields = @"softbed_id,printid,pzid,pz_printid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
+			var mx_fields = @"softbed_id,printid,pzid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
 							useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,pzname,pzmxname";
 
 			if(softbed.softbed_id == 0)

+ 8 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -109,6 +109,7 @@
     <Compile Include="Com\DeleteSoftBedQuote.cs" />
     <Compile Include="Com\GetBedNetInterfaceList.cs" />
     <Compile Include="Com\GetComputeMattressById.cs" />
+    <Compile Include="Com\GetErpMtrlPriceList.cs" />
     <Compile Include="Com\GetResetWiptype.cs" />
     <Compile Include="Com\GetMattressSubspecs.cs" />
     <Compile Include="Com\GetSoftBedConfigureList.cs" />
@@ -123,6 +124,7 @@
     <Compile Include="Com\Model\u_bednet_interface.cs" />
     <Compile Include="Com\Model\u_bednet_interface_qd.cs" />
     <Compile Include="Com\Model\u_configure_codemxbom.cs" />
+    <Compile Include="Com\Model\u_erpmtrl_price.cs" />
     <Compile Include="Com\Model\u_mtrldef.cs" />
     <Compile Include="Com\Model\u_mtrltype_erp.cs" />
     <Compile Include="Com\Model\u_sc_workgroup_erp.cs" />
@@ -137,14 +139,17 @@
     <Compile Include="Com\Model\u_mattress_mx_subspecs.cs" />
     <Compile Include="Com\Model\u_bcpcompare.cs" />
     <Compile Include="Com\Model\u_softbed.cs" />
+    <Compile Include="Com\Model\u_softbed_formula.cs" />
     <Compile Include="Com\Model\u_softbed_mx.cs" />
     <Compile Include="Com\ReCalculateERPCost.cs" />
     <Compile Include="Com\RefreshBedNetInterface.cs" />
     <Compile Include="Com\RefreshBedNetInterfaceQd.cs" />
     <Compile Include="Com\SaveBedNetInterface.cs" />
     <Compile Include="Com\SaveConfigureBomList.cs" />
+    <Compile Include="Com\SaveErpMtrlPriceList.cs" />
     <Compile Include="Com\SaveMattressExtraType.cs" />
     <Compile Include="Com\SaveMattressExtra.cs" />
+    <Compile Include="Com\SaveSoftBedFormula.cs" />
     <Compile Include="Com\SaveSoftBedQuote.cs" />
     <Compile Include="Com\UnLockUser.cs" />
     <Compile Include="Com\UpdateL1Basicinfo.cs" />
@@ -338,6 +343,7 @@
     <Compile Include="Excutor\FormulaCheckExcutor.cs" />
     <Compile Include="Excutor\GetBedNetInterfaceListExcutor.cs" />
     <Compile Include="Excutor\GetComputeMattressByIdExcutor.cs" />
+    <Compile Include="Excutor\GetErpMtrlPriceListExcutor.cs" />
     <Compile Include="Excutor\GetFormulaVarListExcutor.cs" />
     <Compile Include="Excutor\GetResetWiptypeExcutor.cs" />
     <Compile Include="Excutor\GetMattressSubspecsExcutor.cs" />
@@ -351,8 +357,10 @@
     <Compile Include="Excutor\RefreshBedNetInterfaceQdExcutor.cs" />
     <Compile Include="Excutor\SaveBedNetInterfaceExcutor.cs" />
     <Compile Include="Excutor\SaveConfigureBomListExcutor.cs" />
+    <Compile Include="Excutor\SaveErpMtrlPriceListExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraExcutor.cs" />
+    <Compile Include="Excutor\SaveSoftBedFormulaExcutor.cs" />
     <Compile Include="Excutor\SaveSoftBedQuoteExcutor.cs" />
     <Compile Include="Excutor\UnLockUserExcutor.cs" />
     <Compile Include="Excutor\UpdateL1BasicinfoExcutor.cs" />

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

@@ -1224,6 +1224,9 @@ export namespace Basicinfo {
     mxList: any[];
     type: number;
   }
+  export interface ReqSoftBedFormula {
+    formula: any;
+  }
 }
 
 export namespace SalePrice {

+ 27 - 1
JLHWEB/src/api/modules/basicinfo.ts

@@ -561,8 +561,34 @@ export const ImportMtrlPrice = (params: any) => {
   return http.post<Basicinfo.ResimportMtrl>(PORT1 + `/ImportMtrlPriceByExcel`, params);
 };
 /**
- * @name 复制部件选配项值值数据
+ * @name 复制 部件选配项值值数据
  */
 export const CopyConfigureCodeMxList = (params: Basicinfo.ReqCopyConfigureCodeMxList) => {
   return http.post(PORT1 + `/CopyConfigureCodeMxList`, params);
 };
+/**
+ * @name 获取 软床公式定义列表
+ */
+export const getSoftBedFormulaList = (params: any) => {
+  let newParams: any = {};
+  newParams.dsname = "web_softbed_formulalist";
+  newParams.queryparams = params;
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+  delete params.pageNum;
+  delete params.pageSize;
+  return CommonDynamicSelect(newParams, "web_softbed_formulalist");
+};
+/**
+ * @name 保存 软床公式定义
+ */
+export const SaveSoftBedFormula = (params: Basicinfo.ReqSoftBedFormula) => {
+  return http.post(PORT1 + `/SaveSoftBedFormula`, params);
+};
+
+/**
+ * @name 删除 床垫公式定义
+ */
+export const DeleteSoftBedFormula = (params: Basicinfo.ReqDeleteBasicinfo) => {
+  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteMattressFormula`, params);
+};

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

@@ -193,5 +193,9 @@ export enum DwnameEnum {
   /**
    * @description 软床模板报价-选择
    */
-  softbedQuoteChoose = "u_softbed_choose"
+  softbedQuoteChoose = "u_softbed_choose",
+  /**
+   * @description ERP物料资料定义
+   */
+  erpmtrlPrice = "u_erpmtrl_price"
 }

+ 2 - 1
JLHWEB/src/languages/modules/zh-cn/menu.json

@@ -175,5 +175,6 @@
   "softbedQuoteDetail": "软床报价详情",
   "softbedQuoteEdit": "修改软床报价",
   "softbedQuoteAdd": "新建软床报价",
-  "softbedQuoteCopy": "复制软床报价"
+  "softbedQuoteCopy": "复制软床报价",
+  "softbedformula": "软床公式定义"
 }

+ 68 - 0
JLHWEB/src/routers/modules/baseRouter.ts

@@ -458,6 +458,74 @@ export const baseRouter: Menu.MenuOptions[] = [
             }
           }
         ]
+      },
+      {
+        path: "/baseinfo/softbedformula",
+        name: "softbedformula",
+        component: "/baseinfo/softbedformula/index",
+        meta: {
+          icon: "Common_List.png",
+          title: "软床公式定义",
+          isLink: "",
+          isHide: false,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          isSubMenu: false,
+          activeMenu: "/baseinfo",
+          funid: 53
+        },
+        children: [
+          {
+            path: "/baseinfo/softbedformula/detail",
+            name: "softbedformulaDetail",
+            component: "/baseinfo/softbedformula/detail",
+            meta: {
+              icon: "Common_List.png",
+              title: "软床公式定义详情",
+              isLink: "",
+              isHide: true,
+              isFull: false,
+              isAffix: false,
+              isKeepAlive: true,
+              activeMenu: "/baseinfo/softbedformula"
+            }
+          }
+        ]
+      },
+      {
+        path: "/baseinfo/erpmtrldef",
+        name: "erpmtrldef",
+        component: "/baseinfo/erpmtrldef/index",
+        meta: {
+          icon: "Common_List.png",
+          title: "ERP物料资料定义",
+          isLink: "",
+          isHide: false,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          isSubMenu: false,
+          activeMenu: "/baseinfo",
+          funid: 1
+        },
+        children: [
+          {
+            path: "/baseinfo/erpmtrldef/detail",
+            name: "erpmtrldefDetail",
+            component: "/baseinfo/erpmtrldef/detail",
+            meta: {
+              icon: "Common_List.png",
+              title: "ERP物料资料定义详情",
+              isLink: "",
+              isHide: true,
+              isFull: false,
+              isAffix: false,
+              isKeepAlive: true,
+              activeMenu: "/baseinfo/erpmtrldef"
+            }
+          }
+        ]
       }
     ]
   }

+ 182 - 0
JLHWEB/src/views/baseinfo/erpmtrldef/components/ImportPrice.vue

@@ -0,0 +1,182 @@
+<template>
+  <LJDialog ref="DialogRef">
+    <el-upload
+      ref="uploadRef"
+      class="upload-demo"
+      v-model:file-list="fileList"
+      drag
+      action="#"
+      :auto-upload="false"
+      v-bind="$attrs"
+      :on-change="handelChange"
+      :on-exceed="handleExceed"
+      :limit="1"
+      :format="['xls', 'xlsx']"
+      accept=".xls, .xlsx"
+    >
+      <template #trigger>
+        <el-button type="primary">选择文件</el-button>
+      </template>
+    </el-upload>
+    <div style="text-align: right">
+      <el-button class="ml-3" type="success" :loading="uploading" @click="confirm"> 导入 </el-button>
+    </div>
+  </LJDialog>
+</template>
+
+<script setup lang="tsx" name="ImportPrice">
+import { ref, nextTick } from "vue";
+import { ElMessage } from "element-plus";
+import { ImportMtrlPrice } from "@/api/modules/basicinfo";
+import LJDialog from "@/components/LjDialog/index.vue";
+import { base64 } from "js-md5";
+import { ElNotification } from "element-plus";
+import { TYPE, useToast, POSITION } from "vue-toastification";
+import ToastErrCopy from "@/components/ToastWidget/ToastErrCopy/index.vue";
+//import type { FileParams } from "../index.vue";
+
+interface UploadWidgetProps {
+  limit?: number;
+  //params: FileParams;
+}
+
+const props = withDefaults(defineProps<UploadWidgetProps>(), {
+  limit: 1
+});
+
+const emit = defineEmits(["uploaded", "closed"]);
+const basedata = ref();
+const fileList = ref([]);
+// const popoverRef = ref();
+const visible = ref(false);
+const uploading = ref(false);
+const successStatus = ref(false);
+const closeTimer = ref();
+const toCloseTime = ref(3);
+const DialogRef = ref();
+const uploadRef = ref();
+/**
+ * @description 上传文件
+ * @param data
+ */
+const afterReader = async (data: any) => {
+  console.log("afterReader :>> ", data);
+
+  let res = await ImportMtrlPrice({
+    filename: data[0].fileName,
+    base64: data[0].base64
+  });
+  console.log("afterReader res :>> ", res);
+
+  let errmsg = "";
+  if (res?.messageList.length > 0) {
+    errmsg = `,以下类别或物料不存在 <br />` + res.messageList.join(" <br />");
+  }
+  // ElNotification({
+  //   title: "温馨提示",
+  //   message: `读取${res.allqty}条数据,成功录入${res.successqty}个价格,失败${res?.messageList.length}个物料` + errmsg,
+  //   type: "warning"
+  // });
+
+  const toast = useToast();
+  toast(
+    {
+      component: ToastErrCopy,
+      props: {
+        type: "info",
+        title: "温馨提示",
+        message: `读取${res.allqty}条数据,成功录入${res.successqty}个价格,失败${res?.messageList.length}个物料` + errmsg
+      }
+    },
+    {
+      position: POSITION.TOP_RIGHT,
+      icon: false,
+      timeout: 0,
+      closeButton: true,
+      toastClassName: "longjoe-toast"
+    }
+  );
+  // setTimeout(() => {
+  ElMessage.success("导入成功");
+  successStatus.value = true;
+  setTimeout(() => {
+    DialogRef.value.hide();
+
+    emit("closed");
+  }, 500);
+
+  uploading.value = false;
+  //   closeTimer.value = setInterval(() => {
+  //     toCloseTime.value--;
+  //     if (toCloseTime.value <= 0) {
+  //       handleClose();
+  //     }
+  //   }, 1000);
+  // }, 2000);
+};
+
+const confirm = async () => {
+  toCloseTime.value = 3;
+  //   console.log("fileList :>> ", fileList.value);
+  if (!fileList.value.length) {
+    ElMessage.warning("请选择文件");
+    return;
+  }
+  uploading.value = true;
+  // 读取文件内容
+  let base64List: any = [];
+  let successKey = 0;
+  fileList.value.map((item: any, index: number) => {
+    console.log("fileList item :>> ", item, item.raw);
+    // 创建FileReader对象
+    const reader = new FileReader();
+    // 读取文件内容
+    reader.readAsDataURL(item.raw);
+    //reader.readAsArrayBuffer(item.raw);
+    // 当文件读取完成时的回调函数, 将文件内容转换为base64格式
+    reader.onload = () => {
+      let netIndex = item.name.lastIndexOf("."); // 获取最后一个.的位置
+      let file = {
+        //...props.params,
+        //fileName: item.name.substring(0, netIndex),
+        //fileType: item.name.substring(netIndex + 1),
+        fileName: item.name,
+        base64: reader.result
+        //ClassID: props.params.classid
+      };
+      base64List.push(file);
+      successKey++;
+      // 将文件内容转换为base64格式
+      console.log("reader.result :>> ", index, successKey, reader.result);
+      if (successKey == fileList.value.length) {
+        afterReader(base64List);
+      } else {
+        uploading.value = false;
+      }
+    };
+  });
+};
+const handelChange = (file: any) => {};
+const handleExceed = (files: any) => {
+  uploadRef.value.clearFiles();
+  nextTick(() => {
+    uploadRef.value.handleStart(files[0]);
+  });
+};
+const handleClose = () => {
+  clearInterval(closeTimer.value);
+  uploading.value = false;
+  fileList.value = [];
+  emit("uploaded");
+  //visible.value = false;
+  successStatus.value = false;
+  DialogRef.value.hide();
+};
+const show = () => {
+  DialogRef.value.show();
+  fileList.value = [];
+};
+defineExpose({
+  show
+});
+</script>

+ 93 - 0
JLHWEB/src/views/baseinfo/erpmtrldef/detail.vue

@@ -0,0 +1,93 @@
+<template>
+  <LjDetail
+    name="mtrldefListDetail"
+    ref="LjDetailRef"
+    v-bind="detailProps"
+    v-model:order-status="orderStatus"
+    :data="mainData"
+    :init-param="mainData[0]"
+    :if-fold-layout="false"
+    :if-layout-editable="false"
+    :if-basic-editable="false"
+    :search-col="{ xs: 2, sm: 2, md: 2, lg: 2, xl: 2 }"
+    :basic-group-col="{ xs: 2, sm: 2, md: 2, lg: 2, xl: 2 }"
+    :enum="props.enum"
+  >
+  </LjDetail>
+</template>
+
+<script setup lang="tsx" name="mtrldefListDetail">
+import { ref, watch, reactive, inject, onMounted } from "vue";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import { getMtrlPriceList, getMtrlPriceNewList } from "@/api/modules/basicinfo";
+import LjDetail from "@/components/LjDetail/index.vue";
+import { DetailProp } from "@/components/LjDetail/interface";
+import { useI18n } from "vue-i18n";
+import { useHooks } from "./hooks/index";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+
+interface detailProp {
+  /**
+   * @argument any 页面数据
+   */
+  data?: any;
+  /**
+   * @argument string 请求数据的api ==> 非必传
+   */
+  requestApi?: (params: any) => Promise<any>;
+  /**
+   * @argument any 基础信息,表格展示数据
+   */
+  // columns?: any;
+  /**
+   * @description 是否可编辑
+   */
+  status: "edit" | "new" | string;
+  enum?: any;
+}
+
+const props = withDefaults(defineProps<detailProp>(), {});
+const { t } = useI18n();
+const { LjDetailRef, VxeTableMxRef, columns, orderStatus } = useHooks(t);
+
+const mainData = ref([{}]);
+const initParams = ref({ mtrlid: 0 as Number });
+/**
+ * @description 是否可编辑
+ */
+
+const detailProps = reactive<DetailProp>({
+  dwname: DwnameEnum.erpmtrlPrice,
+  columns: columns,
+  header: {
+    fieldNames: {
+      code: "deptname",
+      codeLabel: t("table.u_cust.cuscode") + ":",
+      name: "name"
+    },
+    icon: "iconuser-01",
+    tabsProp: {
+      scrollspy: false,
+      sticky: true
+    }
+  },
+  mould: []
+});
+
+watch(
+  () => props.data,
+  val => {
+    mainData.value = [val];
+    initParams.value.mtrlid = val.mtrlid;
+  },
+  { immediate: true }
+);
+
+watch(
+  () => props.status,
+  val => {
+    orderStatus.value = val;
+  },
+  { immediate: true, deep: true }
+);
+</script>

+ 199 - 0
JLHWEB/src/views/baseinfo/erpmtrldef/hooks/index.tsx

@@ -0,0 +1,199 @@
+import { ref, reactive, computed, toRefs } from "vue";
+import { Table } from "@/hooks/interface";
+import { ColumnProps } from "@/components/LjVxeTable/interface";
+import { ALLOW_EDIT_STATE } from "@/config/index";
+import { SaveMtrlDef, DeleteMtrlDef, BanMtrlDef, getMtrlType } from "@/api/modules/basicinfo";
+import { getPriceList } from "@/api/modules/saleprice";
+import { ElMessage, ElMessageBox } from "element-plus";
+import { transformTreeData } from "@/utils/index";
+interface defaultState {
+  /**
+   * @description 单据当前状态
+   */
+  orderStatus: string;
+  /**
+   * @description 列表Ref
+   */
+  VxeTableRef: any;
+  /**
+   * @description 详情页Ref
+   */
+  LjDetailRef: any;
+  /**
+   * @description 详情页明细表格Ref
+   */
+  VxeTableMxRef: any;
+  initParams: any;
+}
+
+const state = reactive<defaultState>({
+  orderStatus: "",
+  VxeTableRef: null,
+  LjDetailRef: null,
+  VxeTableMxRef: null,
+  initParams: { mtrltypeid: undefined as Number }
+});
+/**
+ * @description 表格多选数据操作
+ * @param {String} rowKey 当表格可以多选时,所指定的 id
+ * */
+export const useHooks = (t?: any) => {
+  // 表格配置项
+  const columns: ColumnProps<any>[] = [
+    {
+      title: "序",
+      field: "rowNum",
+      width: 50,
+      basicinfo: {
+        visible: false
+      }
+    },
+    {
+      title: "物料编码",
+      field: "mtrlcode",
+      table: "u_mtrldef",
+      type: "html"
+    },
+    {
+      title: "物料名称",
+      field: "mtrlname",
+      table: "u_mtrldef",
+      type: "html"
+    },
+    {
+      title: "英文名称",
+      field: "mtrlengname",
+      table: "u_mtrldef"
+    },
+    {
+      title: "物料类别",
+      field: "mtrltype",
+      table: "u_mtrldef"
+    },
+    {
+      title: "物料规格",
+      field: "mtrlmode",
+      table: "u_mtrldef"
+    },
+    {
+      title: "单位",
+      field: "unit",
+      table: "u_mtrldef"
+    },
+    {
+      title: "自定义1",
+      field: "mtrlsectype",
+      table: "u_mtrldef"
+    },
+    {
+      title: "自定义2",
+      field: "zxmtrlmode",
+      table: "u_mtrldef"
+    },
+    {
+      title: "自定义3",
+      field: "usermtrlmode",
+      table: "u_mtrldef"
+    },
+    {
+      title: "物料单价",
+      field: "price",
+      table: "u_erpmtrl_price",
+      basicinfo: {
+        el: "input-number",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ required: true }]
+      }
+    },
+    {
+      title: "建立时间",
+      field: "opdate",
+      table: "u_mtrldef"
+    },
+    {
+      title: "建立人",
+      field: "opemp",
+      table: "u_mtrldef"
+    },
+    {
+      title: "修改时间",
+      field: "moddate",
+      table: "u_mtrldef"
+    },
+    {
+      title: "修改人",
+      field: "modemp",
+      table: "u_mtrldef"
+    },
+    {
+      title: "状态",
+      field: "isuse",
+      table: "u_mtrldef",
+      datatype: "checkbox",
+      width: 80,
+      basicinfo: {
+        visible: false
+      }
+    }
+  ];
+
+  // 保存
+  const fSave = (param: any) => {
+    return new Promise((resolve, reject) => {
+      ElMessageBox.confirm("是否确定要保存吗?", "询问", {
+        confirmButtonText: "是",
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          SaveMtrlDef(param).then(() => {
+            ElMessage.success("保存成功!");
+            state.VxeTableRef?.refresh();
+            resolve({});
+          });
+        })
+        .catch(() => {
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
+    });
+  };
+
+  // 删除
+  const fDelete = () => {
+    const checkDate = state.VxeTableRef?.element.getCheckboxRecords();
+    if (checkDate.length === 0) {
+      ElMessage.error("请选择要删除的数据!");
+      return;
+    }
+    const delArr = checkDate.map((item: any) => {
+      return { mtrlid: parseInt(item.mtrlid), name: item.name };
+    });
+    ElMessageBox.confirm("是否确定要删除吗?", "询问", {
+      confirmButtonText: "是",
+      cancelButtonText: "否",
+      type: "warning"
+    })
+      .then(() => {
+        DeleteMtrlDef({ list: delArr }).then(() => {
+          ElMessage.success("删除成功!");
+          state.VxeTableRef?.refresh();
+        });
+      })
+      .catch(() => {
+        ElMessage({
+          type: "info",
+          message: "操作取消"
+        });
+      });
+  };
+
+  return {
+    ...toRefs(state),
+    columns,
+    fSave,
+    fDelete
+  };
+};

+ 199 - 0
JLHWEB/src/views/baseinfo/erpmtrldef/index.vue

@@ -0,0 +1,199 @@
+<template>
+  <div class="main-box">
+    <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting" :dwname="dwname">
+      <template #left>
+        <TreeFilter
+          ref="LjTreeRef"
+          id="mtrltypeid"
+          title="物料分类"
+          label="mtrltype"
+          :expand-on-click-node="true"
+          :request-api="getMtrlType"
+          @change="changeTreeFilter"
+        />
+      </template>
+      <div class="main-box flx-col">
+        <LjVxeTable
+          ref="VxeTableRef"
+          row-key="mtrlid"
+          :columns="columns"
+          :request-api="getData"
+          :data-callback="dataCallback"
+          :dwname="dwname"
+          :table-props="tableProps"
+          :table-events="tableEvents"
+          :tool-button="['export', 'refresh', 'setting', 'search', 'location']"
+          :init-param="initParams"
+          :auto-load-layout="false"
+          pagination
+        >
+          <!-- 表格 header 按钮 -->
+          <template #tableHeader>
+            <el-button-group>
+              <el-button>{{ $t("common.add") }}</el-button>
+              <el-button @click="fDelete">{{ $t("common.delText") }}</el-button>
+            </el-button-group>
+          </template>
+        </LjVxeTable>
+      </div>
+    </LjFoldLayout>
+  </div>
+
+  <LjDialog
+    ref="LjDrawerRef"
+    class="is-selector"
+    v-bind="{
+      ...drawerDefineProp
+    }"
+    :style="{ padding: 0 }"
+  >
+    <template #header>
+      <div class="flx-1">
+        <span class="text-h5-b">物料: {{ mtrlname }}</span>
+      </div>
+    </template>
+    <div class="flx-1 h-full">
+      <LjHeaderMenu :data="mainData" :action="orderStatus ? orderEditAction : orderDefaultAction" />
+      <Detail class="flx-1" :data="mainData" :status="orderStatus" :enum="enumMap" />
+    </div>
+  </LjDialog>
+</template>
+
+<script setup lang="ts" name="baseinfo_mtrldeflist">
+import { ref, onMounted, provide } from "vue";
+import Detail from "./detail.vue";
+import { useHooks } from "./hooks/index";
+import LjDialog from "@/components/LjDialog/index.vue";
+import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
+import { useI18n } from "vue-i18n";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+import { cloneDeep } from "lodash-es";
+import { GetERPMtrldefList, GetERPMtrlTypeList } from "@/api/modules/common";
+import { transformTreeData } from "@/utils/index";
+
+const dwname = "web_mtrldeflist";
+const mainData = ref({});
+const tableProps = {
+  height: "auto",
+  editConfig: { trigger: "click", mode: "cell" }
+};
+
+const layoutSetting = {
+  dwname: dwname,
+  right: {
+    hidden: true
+  }
+};
+
+const { t } = useI18n();
+const { VxeTableRef, LjDetailRef, VxeTableMxRef, columns, fDelete, fSave, initParams } = useHooks(t);
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+
+const orderStatus = ref("");
+const mtrlname = ref("");
+const enumMap = ref(new Map());
+
+const orderDefaultAction = [
+  buttonDefault({
+    label: t("common.cancelText"),
+    icon: "iconchevron-left"
+  }),
+  buttonNew({
+    label: t("common.saveText"),
+    icon: "iconsave-01",
+    clickFunc: item => {
+      const save_data = orderStatus.value == "new" ? LjDetailRef.value?.infoParam : LjDetailRef.value?._mainData;
+
+      save_data.mxlist = VxeTableMxRef.value?.tableData;
+      fSave({ mtrl: save_data }).then(() => {
+        LjDrawerRef.value.hide();
+      });
+    }
+  })
+];
+const orderEditAction = [
+  buttonNew({
+    label: t("common.saveText"),
+    icon: "iconsave-01",
+    clickFunc: item => {
+      const save_data = LjDetailRef.value?._mainData;
+
+      if (orderStatus.value == "new" || orderStatus.value == "copy") save_data.mtrlid = 0;
+      let { fullData } = VxeTableMxRef.value?.element.getTableData();
+      save_data.mxlist = fullData;
+      fSave({ mtrl: save_data }).then(() => {
+        LjDrawerRef.value.hide();
+      });
+    }
+  })
+];
+
+const changeTreeFilter = (val: any) => {
+  console.log("val :>> ", val);
+  initParams.value.mtrltypeid = val.mtrltypeid;
+};
+
+/*
+ * @description 抽屉默认属性
+ */
+const drawerDefineProp = {
+  draggable: true,
+  overflow: true,
+  width: "40%"
+  // modalClass: "lj-file-dialog"
+};
+
+const getData = (params: any) => {
+  let newParams: any = params;
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+
+  delete params.pageNum;
+  delete params.pageSize;
+  return GetERPMtrldefList(newParams);
+};
+
+const dataCallback = (data: any) => {
+  return {
+    list: data.mtrldefList,
+    total: data.totalcnt,
+    pageNum: data.pageindex,
+    pageSize: data.pagesize
+  };
+};
+
+const getMtrlType = async () => {
+  const data = await GetERPMtrlTypeList();
+  let arr = data.reList;
+  arr.unshift({
+    value: -1,
+    text: "全部",
+    data: {
+      mtrltypeid: -1,
+      mtrltype: "全部",
+      inuse: 1,
+      parentid: 0
+    }
+  });
+  return transformTreeData(data.reList);
+};
+
+const LjDrawerRef = ref();
+const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  // 弹窗
+  mainData.value = cloneDeep(row);
+  mtrlname.value = row.name;
+  orderStatus.value = "edit";
+  LjDrawerRef.value.show();
+};
+
+// 返回绑定的事件
+const tableEvents = {
+  "cell-dblclick": handleDBlClickTable
+  // "cell-click": handleClickTable
+};
+
+const toGetPriceList = () => {
+  VxeTableRef.value.refresh();
+};
+</script>

+ 1 - 0
JLHWEB/src/views/baseinfo/mtrltype/hooks/index.tsx

@@ -3,6 +3,7 @@ import { isNullOrUnDef } from "@/utils/is";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { ALLOW_EDIT_STATE } from "@/config/index";
 import { SaveMtrlType, DeleteMtrlType, getMtrlType } from "@/api/modules/basicinfo";
+import { GetERPMtrlTypeList } from "@/api/modules/common";
 import { ElMessage, ElMessageBox } from "element-plus";
 interface defaultState {
   /**

+ 106 - 0
JLHWEB/src/views/baseinfo/softbedformula/detail.vue

@@ -0,0 +1,106 @@
+<template>
+  <LjDetail
+    name="mattressFormulaListDetail"
+    ref="LjDetailRef"
+    v-bind="detailProps"
+    v-model:order-status="orderStatus"
+    :data="mainData"
+    :init-param="mainData[0]"
+    :if-fold-layout="false"
+    :if-layout-editable="false"
+    :if-basic-editable="false"
+    :search-col="{ xs: 6, sm: 6, md: 6, lg: 6, xl: 6 }"
+    :basic-group-col="{ xs: 6, sm: 6, md: 6, lg: 6, xl: 6 }"
+    :enum="props.enum"
+  >
+    <!-- :action="orderStatus ? orderEditAction : orderDefaultAction" -->
+  </LjDetail>
+
+  <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
+</template>
+
+<script setup lang="tsx" name="mattressFormulaListDetail">
+import { ref, watch, reactive, inject, onMounted } from "vue";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import LjDetail from "@/components/LjDetail/index.vue";
+import { DetailProp } from "@/components/LjDetail/interface";
+import { useI18n } from "vue-i18n";
+import { useHooks } from "./hooks/index";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+import MtrldefDialog from "@/views/system/selector/mtrldefNoPrice/index.vue";
+
+interface detailProp {
+  /**
+   * @argument any 页面数据
+   */
+  data?: any;
+  /**
+   * @argument string 请求数据的api ==> 非必传
+   */
+  requestApi?: (params: any) => Promise<any>;
+  /**
+   * @argument any 基础信息,表格展示数据
+   */
+  // columns?: any;
+  /**
+   * @description 是否可编辑
+   */
+  status: "edit" | "new" | string;
+  enum?: any;
+}
+
+const props = withDefaults(defineProps<detailProp>(), {});
+const { t } = useI18n();
+const { LjDetailRef, columns, MtrldefDialogRef, MtrldefDialogProps } = useHooks(t);
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+
+const mainData = ref([{}]);
+
+/**
+ * @description 是否可编辑
+ */
+const orderStatus = ref("");
+
+const detailProps = reactive<DetailProp>({
+  dwname: DwnameEnum.mattressformulalist,
+  columns: columns,
+  // addPower: 5,
+  // editPower: 4359,
+  header: {
+    fieldNames: {
+      code: "formulakind",
+      codeLabel: t("table.u_cust.cuscode") + ":",
+      name: "name"
+    },
+    icon: "iconuser-01",
+    tabsProp: {
+      scrollspy: false,
+      sticky: true
+    }
+  },
+  mould: []
+});
+
+watch(
+  () => props.data,
+  val => {
+    console.log("props.data, val :>> ", val);
+    mainData.value = [val];
+    // initParam.value.cusid = val.cusid;
+
+    // getDetailData(val).then(res => {
+    //   detailData.value = res;
+    // });
+  },
+  { immediate: true }
+);
+
+watch(
+  () => props.status,
+  val => {
+    console.log("props.status val :>> ", val);
+    orderStatus.value = val;
+  },
+  { immediate: true, deep: true }
+);
+</script>

+ 184 - 0
JLHWEB/src/views/baseinfo/softbedformula/hooks/index.tsx

@@ -0,0 +1,184 @@
+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 MtrldefSelect from "@/views/system/selector/mtrldefNoPrice/select.vue";
+import { SaveSoftBedFormula, DeleteMattressFormula, getMtrlType } from "@/api/modules/basicinfo";
+import { ElMessage, ElMessageBox } from "element-plus";
+import { transformTreeData } from "@/utils/index";
+
+interface defaultState {
+  /**
+   * @description 单据当前状态
+   */
+  orderStatus: string;
+  /**
+   * @description 列表Ref
+   */
+  VxeTableRef: any;
+  /**
+   * @description 详情页Ref
+   */
+  LjDetailRef: any;
+  MtrldefDialogRef: any;
+  MtrldefDialogProps: any;
+}
+
+const state = reactive<defaultState>({
+  orderStatus: "",
+  VxeTableRef: null,
+  LjDetailRef: null,
+  MtrldefDialogRef: null,
+  MtrldefDialogProps: {}
+});
+/**
+ * @description 表格多选数据操作
+ * @param {String} rowKey 当表格可以多选时,所指定的 id
+ * */
+export const useHooks = (t?: any) => {
+  // 表格配置项
+  const columns: ColumnProps<any>[] = [
+    { type: "checkbox", width: 80, fixed: "left" },
+    {
+      field: "formulaname",
+      title: "公式名",
+      basicinfo: {
+        el: "input",
+        order: 5,
+        span: 3,
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ required: true }]
+      }
+    },
+    {
+      field: "use_formula",
+      title: "用料量公式",
+      basicinfo: {
+        el: "input",
+        order: 13,
+        span: 6,
+        editable: ALLOW_EDIT_STATE,
+        props: { type: "textarea", rows: 3 }
+      }
+    },
+    {
+      field: "price_formula",
+      title: "单价公式",
+      basicinfo: {
+        el: "input",
+        order: 12,
+        span: 6,
+        editable: ALLOW_EDIT_STATE,
+        props: { type: "textarea", rows: 3 }
+      }
+    }
+  ];
+
+  // 保存
+  const fSave = (param: any) => {
+    return new Promise((resolve, reject) => {
+      ElMessageBox.confirm("是否确定要保存吗?", "询问", {
+        confirmButtonText: "是",
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          SaveSoftBedFormula(param).then(() => {
+            ElMessage.success("保存成功!");
+            state.VxeTableRef?.refresh();
+            resolve({});
+          });
+        })
+        .catch(() => {
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
+    });
+  };
+
+  // 删除
+  const fDelete = () => {
+    const checkDate = state.VxeTableRef?.element.getCheckboxRecords();
+    if (checkDate.length === 0) {
+      ElMessage.error("请选择要删除的数据!");
+      return;
+    }
+    const delArr = checkDate.map((item: any) => {
+      return { formulaid: parseInt(item.formulaid), formulakind: item.formulakind };
+    });
+    ElMessageBox.confirm("是否确定要删除吗?", "询问", {
+      confirmButtonText: "是",
+      cancelButtonText: "否",
+      type: "warning"
+    })
+      .then(() => {
+        DeleteMattressFormula({ list: delArr }).then(() => {
+          ElMessage.success("删除成功!");
+          state.VxeTableRef?.refresh();
+        });
+      })
+      .catch(() => {
+        ElMessage({
+          type: "info",
+          message: "操作取消"
+        });
+      });
+  };
+
+  /**
+   * @description 弹窗模块:客户选择
+   * @param data 当前数据
+   * @param status 当前订单状态
+   * @returns Promise
+   */
+  const fModelChoseMtrl = (data: any, params: any, label?: string) => {
+    return new Promise((resolve, reject) => {
+      // if (!ALLOW_EDIT_STATE.includes(status)) return;
+
+      let _params = {
+        keyword: "",
+        arg_mtrltype: params.mtrltype,
+        arg_pricelistid: params.pricelistid
+      };
+      state.MtrldefDialogProps = {
+        onSubmit: (res: any) => {
+          // submit
+          console.log("openCustDialog res", res);
+          nextTick(() => {
+            rModelSetMtrl(data, res.value[0]);
+            resolve(1);
+          });
+        },
+        onCancel: (error: any) => {
+          // cancel 回调
+          console.log("openCustDialog error", error);
+        }
+      };
+      state.MtrldefDialogRef.show(_params, label);
+    });
+  };
+
+  /**
+   * @description 数据赋值: 联系人
+   * @param data 当前数据
+   * @param item 当前选择的数据
+   */
+  const rModelSetMtrl = (data: any, item: any) => {
+    data.default_mtrlid = Number(item.mtrlid);
+    data.default_mtrlname = item.name;
+  };
+
+  const rModelClearMtrl = (data: any) => {
+    data.default_mtrlid = 0;
+    data.default_mtrlname = "";
+  };
+
+  return {
+    ...toRefs(state),
+    columns,
+    fSave,
+    fDelete
+  };
+};

+ 150 - 0
JLHWEB/src/views/baseinfo/softbedformula/index.vue

@@ -0,0 +1,150 @@
+<template>
+  <div class="table-box">
+    <LjVxeTable
+      ref="VxeTableRef"
+      row-key="formulaid"
+      :columns="columns"
+      :request-api="getData"
+      :data-callback="dataCallback"
+      :dwname="dwname"
+      :table-props="tableProps"
+      :table-events="tableEvents"
+      :tool-button="['export', 'refresh', 'setting', 'search', 'location']"
+      :auto-load-layout="false"
+      pagination
+    >
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader>
+        <el-button-group>
+          <el-button @click="handleOpenNewTable">{{ $t("common.add") }}</el-button>
+          <el-button @click="fDelete">{{ $t("common.delText") }}</el-button>
+        </el-button-group>
+      </template>
+    </LjVxeTable>
+  </div>
+
+  <LjDialog
+    ref="LjDrawerRef"
+    class="is-selector"
+    v-bind="{
+      ...drawerDefineProp
+    }"
+    :style="{ padding: 0 }"
+  >
+    <div class="flx-1 h-full">
+      <LjHeaderMenu :data="mainData" :action="orderStatus ? orderEditAction : orderDefaultAction" />
+      <Detail class="flx-1" :data="mainData" :status="orderStatus" :enum="enumMap" />
+    </div>
+  </LjDialog>
+</template>
+
+<script setup lang="ts" name="baseinfo_softbedformulalist">
+import { ref, onMounted, provide } from "vue";
+import { getSoftBedFormulaList } from "@/api/modules/basicinfo";
+import Detail from "./detail.vue";
+import { useHooks } from "./hooks/index";
+import LjDialog from "@/components/LjDialog/index.vue";
+import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
+import { useI18n } from "vue-i18n";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+import { cloneDeep } from "lodash-es";
+
+const dwname = "web_softbed_formulalist";
+const mainData = ref({});
+const tableProps = {
+  height: "auto",
+  editConfig: { trigger: "click", mode: "cell" }
+};
+
+const { t } = useI18n();
+const { VxeTableRef, LjDetailRef, columns, fDelete, fSave } = useHooks(t);
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+
+const orderStatus = ref("");
+const typename = ref("");
+const enumMap = ref(new Map());
+
+const orderDefaultAction = [
+  buttonDefault({
+    label: t("common.cancelText"),
+    icon: "iconchevron-left"
+  }),
+  buttonNew({
+    label: t("common.saveText"),
+    icon: "iconsave-01",
+    clickFunc: item => {
+      const save_data = orderStatus.value == "new" ? LjDetailRef.value?.infoParam : LjDetailRef.value?._mainData;
+
+      fSave({ bednet: save_data }).then(() => {
+        LjDrawerRef.value.hide();
+      });
+    }
+  })
+];
+const orderEditAction = [
+  buttonNew({
+    label: t("common.saveText"),
+    icon: "iconsave-01",
+    clickFunc: item => {
+      const save_data = LjDetailRef.value?._mainData;
+
+      fSave({ formula: save_data }).then(() => {
+        LjDrawerRef.value.hide();
+      });
+    }
+  })
+];
+
+/*
+ * @description 抽屉默认属性
+ */
+const drawerDefineProp = {
+  draggable: true,
+  overflow: true,
+  width: "40%"
+  // modalClass: "lj-file-dialog"
+};
+
+const getData = (params: any) => {
+  return getSoftBedFormulaList(params);
+};
+
+const dataCallback = (data: any) => {
+  if (data.tableinfo?.columns) {
+    data.tableinfo?.columns.map((item: any) => {
+      if (item?.enum) {
+        enumMap.value.set(item.field, item.enum);
+      }
+    });
+  }
+  return {
+    list: data.datatable,
+    tableinfo: data.tableinfo,
+    total: data.totalcnt,
+    pageNum: data.pageindex,
+    pageSize: data.pagesize
+  };
+};
+
+const LjDrawerRef = ref();
+const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  // 弹窗
+  mainData.value = cloneDeep(row);
+  orderStatus.value = "edit";
+  LjDrawerRef.value.show();
+};
+
+const handleOpenNewTable = () => {
+  mainData.value = {
+    formulaid: 0
+  };
+  orderStatus.value = "new";
+  LjDrawerRef.value.show();
+};
+
+// 返回绑定的事件
+const tableEvents = {
+  "cell-dblclick": handleDBlClickTable
+  // "cell-click": handleClickTable
+};
+</script>

+ 1 - 0
JLHWEB/src/views/quote/softbedQuote/components/BedConfigModal.vue

@@ -60,6 +60,7 @@ interface ConfigItemOption {
 }
 interface SelectedConfigItem {
   pzid: number;
+  selectedId: number;
   selectedValue?: string;
 }
 

+ 17 - 2
JLHWEB/src/views/quote/softbedQuote/components/ConfigSection.vue

@@ -16,8 +16,15 @@
       </el-select>
 
       <!-- 配置值选择 -->
-      <el-select v-model="item.selectedValue" placeholder="选择选配值" size="small" class="select-config-value">
-        <el-option v-for="opt in valueListByPzid(item.pzid)" :key="opt.printid" :label="opt.namemx" :value="opt.namemx" />
+      <el-select
+        v-model="item.selectedValue"
+        placeholder="选择选配值"
+        size="small"
+        class="select-config-value"
+        value-key="namemx"
+        @change="value => onConfigValueChange(item, value)"
+      >
+        <el-option v-for="opt in valueListByPzid(item.pzid)" :key="opt.printid" :label="opt.namemx" :value="opt" />
       </el-select>
 
       <i class="iconfont icontrash-01 delete-icon" @click="removeConfigItem(index)" title="删除选配项" />
@@ -43,6 +50,7 @@ interface ConfigItemOption {
 }
 interface SelectedConfigItem {
   pzid: number;
+  selectedId: number;
   selectedValue?: string;
 }
 
@@ -61,9 +69,15 @@ const valueListByPzid = (pzid: number) => {
 
 const onConfigItemChange = (item: SelectedConfigItem) => {
   const options = valueListByPzid(item.pzid);
+  item.selectedId = options.length > 0 ? options[0].printid : 0;
   item.selectedValue = options.length > 0 ? options[0].namemx : "";
 };
 
+const onConfigValueChange = (item: SelectedConfigItem, value: any) => {
+  item.selectedId = value.printid;
+  item.selectedValue = value.namemx;
+};
+
 const removeConfigItem = (index: number) => {
   const newList = [...props.selectedConfigItems];
   newList.splice(index, 1);
@@ -81,6 +95,7 @@ const addConfigItem = () => {
 
   const newItem: SelectedConfigItem = {
     pzid: defaultPzid,
+    selectedId: defaultValues.length > 0 ? defaultValues[0].printid : 0,
     selectedValue: defaultValues.length > 0 ? defaultValues[0].namemx : ""
   };
 

+ 2 - 33
JLHWEB/src/views/quote/softbedQuote/detail.vue

@@ -193,38 +193,6 @@ const tableProps_mx = ref({
   // height: "",
   minHeight: "100px",
   editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
-  // editRules: {
-  // mattress_width: [
-  //   {
-  //     validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
-  //       const { _mainData } = LjDetailRef.value;
-  //       let _value = Number(cellValue);
-  //       if (_value < 0) {
-  //         return new Error("不能小于0");
-  //       }
-  //       if (!isNaN(_value) && _value > Number(_mainData.mattress_width)) {
-  //         return new Error("不能大于床垫尺寸");
-  //       }
-  //       return true;
-  //     }
-  //   }
-  // ],
-  // mattress_length: [
-  //   {
-  //     validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
-  //       const { _mainData } = LjDetailRef.value;
-  //       let _value = Number(cellValue);
-  //       if (_value < 0) {
-  //         return new Error("不能小于0");
-  //       }
-  //       if (!isNaN(_value) && _value > Number(_mainData.mattress_length)) {
-  //         return new Error("不能大于床垫尺寸");
-  //       }
-  //       return true;
-  //     }
-  //   }
-  // ]
-  // },
   keyboardConfig: {
     isEdit: true,
     isArrow: true,
@@ -437,12 +405,13 @@ const orderDefaultAction = [
  * @description 页面数据加载完成
  */
 const funcAfterMound = async (data: any) => {
-  console.log("onMounted detail start!!!! :>> ", orderStatus.value, data, route, router);
+  // console.log("onMounted detail start!!!! :>> ", orderStatus.value, data, route, router);
   if (!orderStatus.value) {
     // 详情页
   } else {
     // 新增/编辑
     tableProps.value.editConfig.enabled = true;
+    tableProps_mx.value.editConfig.enabled = true;
   }
 
   if (orderStatus.value != "new") {

+ 110 - 43
JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx

@@ -9,7 +9,7 @@ import { CommonDynamicSelect } from "@/api/modules/common";
 import SoftBedSelect from "@/views/system/selector/softbedTemplate/select.vue";
 import { cloneDeep } from "lodash-es";
 import { getCurrentRecords } from "@/utils/index";
-import MtrldefSelect from "@/views/system/selector/mtrldefNoPrice/select.vue";
+import MtrldefErpSelect from "@/views/system/selector/mtrldefErp/select.vue";
 interface defaultState {
   /**
    * @description 单据当前状态
@@ -775,7 +775,19 @@ export const useHooks = (t?: any) => {
       width: 80,
       align: "center",
       datatype: "checkbox",
-      editRender: {}
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { column, row, status } = scope;
+        if (Number(row.allow_edit) == 0) {
+          row.allow_edit = 0;
+        }
+
+        return (
+          <>
+            <el-checkbox v-model={row.allow_edit} true-value={1} false-value={0} class="vxe-edit-col-middle"></el-checkbox>
+          </>
+        );
+      }
     },
     {
       field: "pzname",
@@ -785,12 +797,31 @@ export const useHooks = (t?: any) => {
     {
       field: "pznamemx",
       title: "部件选配项值",
-      visible: false
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { row } = scope;
+        const { _mainData } = state.LjDetailRef;
+        const _disabled = !row.allow_edit && !_mainData.is_template;
+
+        const partTypes = {
+          1: "headboardConfigOptions",
+          2: "nightstandConfigOptions",
+          8: "bedframeConfigOptions"
+        };
+        const targetArray = partTypes[row.has_type] || "headboardConfigOptions";
+
+        const options = state[targetArray]?.map(item => <el-option key={item.pzid} label={item.pzname} value={item} />) || [];
+
+        return (
+          <el-select v-model={row.pzid} disabled={_disabled} valueKey={"pzid"} clearable={true}>
+            {options}
+          </el-select>
+        );
+      }
     },
     {
       field: "mtrlcode",
-      title: "物料编码",
-      visible: false
+      title: "物料编码"
     },
     {
       field: "mtrlname",
@@ -798,56 +829,71 @@ export const useHooks = (t?: any) => {
       width: 400,
       editRender: {},
       editColRender: (scope: any) => {
-        const { $table, column, row } = scope;
+        const { $table, column, row, status } = scope;
+        let field = column.field;
         let _label = column.title;
-        let params = {};
+        let params = {
+          keyword: row.mtrlcode
+        };
 
         return (
-          <>
-            <MtrldefSelect
-              value={row.mtrlid}
-              {...params}
-              clearable
-              placeholder={_label}
-              onOpenModal={() => fModelChoseMtrl(row, params)}
-              onSelect={val => rModelSetMtrl(row, val)}
-              onClear={() => rModelClearMtrl(row)}
-            >
-              {{
-                label: () => row.mtrlname
-              }}
-            </MtrldefSelect>
-          </>
+          <MtrldefErpSelect
+            value={row.mtrlid}
+            {...params}
+            clearable
+            placeholder={_label}
+            onOpenModal={() => fModelChoseMtrlErp(row, params)}
+            onSelect={val => rModelSetMtrlErp(row, val)}
+            onClear={() => rModelClearMtrlErp(row)}
+          >
+            {{
+              label: () => `${row.mtrlname} ${row.mtrlmode}`
+            }}
+          </MtrldefErpSelect>
         );
       }
     },
     {
       field: "unit",
-      title: "物料单位",
-      visible: false
+      title: "物料单位"
     },
     {
       field: "cutting_length",
       title: "下料长(mm)",
       datatype: "number",
-      editRender: {
-        name: "$input"
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { $table, column, row, status } = scope;
+        const { _mainData } = state.LjDetailRef;
+
+        let _disabled = !Boolean(row.allow_edit) && !Boolean(_mainData.is_template);
+        return <el-input v-model={scope.row.cutting_length} type="number" disabled={_disabled}></el-input>;
       }
     },
     {
       field: "cutting_width",
       title: "下料宽(mm)",
       datatype: "number",
-      editRender: {
-        name: "$input"
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { $table, column, row, status } = scope;
+        const { _mainData } = state.LjDetailRef;
+
+        let _disabled = !Boolean(row.allow_edit) && !Boolean(_mainData.is_template);
+        return <el-input v-model={scope.row.cutting_width} type="number" disabled={_disabled}></el-input>;
       }
     },
     {
       field: "cutting_qty",
       title: "下料数量",
       datatype: "number",
-      editRender: {
-        name: "$input"
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { $table, column, row, status } = scope;
+        const { _mainData } = state.LjDetailRef;
+
+        let _disabled = !Boolean(row.allow_edit) && !Boolean(_mainData.is_template);
+        return <el-input v-model={scope.row.cutting_qty} type="number" disabled={_disabled}></el-input>;
       }
     },
     {
@@ -872,12 +918,27 @@ export const useHooks = (t?: any) => {
       field: "loss_rate",
       title: "损耗率",
       datatype: "number",
-      editRender: {}
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { $table, column, row, status } = scope;
+        const { _mainData } = state.LjDetailRef;
+
+        let _disabled = !Boolean(row.allow_edit) && !Boolean(_mainData.is_template);
+        return <el-input v-model={scope.row.loss_rate} type="number" disabled={_disabled}></el-input>;
+      }
     },
     {
       field: "price",
       title: "材料单价",
-      datatype: "number"
+      datatype: "number",
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { $table, column, row, status } = scope;
+        const { _mainData } = state.LjDetailRef;
+
+        let _disabled = !Boolean(row.allow_edit) && !Boolean(_mainData.is_template);
+        return <el-input v-model={scope.row.loss_rate} type="number" disabled={_disabled}></el-input>;
+      }
     },
     {
       field: "price_formula",
@@ -920,6 +981,10 @@ export const useHooks = (t?: any) => {
     const { _mainData } = state.LjDetailRef;
     const result = await GetSoftBedConfigureList({ softbed: _mainData });
 
+    state.nightstandConfigOptions = [];
+    state.bedframeConfigOptions = [];
+    state.headboardConfigOptions = [];
+
     if (result.typeList?.length > 0) {
       for (const item of result.typeList) {
         if (item.contfigtypename.includes("床头柜")) {
@@ -1182,7 +1247,9 @@ export const useHooks = (t?: any) => {
         allow_edit: 0,
         cutting_length: 0,
         cutting_width: 0,
-        cutting_qty: 0
+        cutting_qty: 0,
+        loss_rate: 0,
+        price: 0
       };
       const { row } = await $table.insertAt(records, -1);
       await $table.setCurrentRow(row);
@@ -1218,7 +1285,7 @@ export const useHooks = (t?: any) => {
    * @param status 当前订单状态
    * @returns Promise
    */
-  const fModelChoseMtrl = (data: any, params: any) => {
+  const fModelChoseMtrlErp = (data: any, params: any) => {
     return new Promise((resolve, reject) => {
       // if (!ALLOW_EDIT_STATE.includes(status)) return;
 
@@ -1230,7 +1297,7 @@ export const useHooks = (t?: any) => {
           // submit
           console.log("openCustDialog res", res);
           nextTick(() => {
-            rModelSetMtrl(data, res.value[0]);
+            rModelSetMtrlErp(data, res.value[0]);
             resolve(1);
           });
         },
@@ -1248,19 +1315,19 @@ export const useHooks = (t?: any) => {
    * @param data 当前数据
    * @param item 当前选择的数据
    */
-  const rModelSetMtrl = (data: any, item: any) => {
+  const rModelSetMtrlErp = (data: any, item: any) => {
     data.mtrlid = Number(item.mtrlid);
-    data.mtrlname = item.name;
-    // data.mtrlcode = item.mtrlcode;
-    // data.mtrlmode = item.mtrlmode;
-    data.unit = item.priceunit;
+    data.mtrlname = item.mtrlname;
+    data.mtrlcode = item.mtrlcode;
+    data.mtrlmode = item.mtrlmode;
+    data.unit = item.unit;
   };
 
-  const rModelClearMtrl = (data: any) => {
+  const rModelClearMtrlErp = (data: any) => {
     data.mtrlid = 0;
     data.mtrlname = "";
-    // data.mtrlcode = "";
-    // data.mtrlmode = "";
+    data.mtrlcode = "";
+    data.mtrlmode = "";
     data.unit = "";
   };