From 5701636d0554a89cdb6a06327658de75d74f67ed Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期一, 16 一月 2023 13:42:09 +0800 Subject: [PATCH] 添加客户关联企业功能 --- zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/Index.cshtml | 12 zhengcaioa/Services/CooperatecustomCustomerService.cs | 107 +++++ zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexCustomerGuanlian.cshtml | 257 ++++++++++++++ zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexSelect.cshtml | 307 +++++++++++++++++ zhengcaioa/DTO/CooperatecustomCustomerDTO.cs | 2 zhengcaioa/Model/zhengcaioaContext.cs | 16 zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs | 6 zhengcaioa/DTO/CustomerGuanlianDTO.cs | 18 + zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs | 2 zhengcaioa/DTO/IntentionCustomerDTO.cs | 2 zhengcaioa/Services/IntentionCustomerService.cs | 125 +++++- zhengcaioa/zhengcaioa/Controllers/Customer/CooperatecustomCustomerController.cs | 177 +++++++++ zhengcaioa/IServices/ICooperatecustomCustomerService.cs | 9 zhengcaioa/Model/CustomerGuanlian.cs | 16 zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml | 14 15 files changed, 1,034 insertions(+), 36 deletions(-) diff --git a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs index f1c31ec..e3d5674 100644 --- a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs +++ b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs @@ -337,6 +337,12 @@ CreateMap<AdmAskzczbwsydtl, AdmAskzczbwsydtlDTO>(); CreateMap<AdmAskzczbwsydtlDTO, AdmAskzczbwsydtl>(); + CreateMap<CustomerGuanlian, CustomerGuanlianDTO>(); + CreateMap<CustomerGuanlianDTO, CustomerGuanlian>(); + + CreateMap<IntentionCustomer, CooperatecustomCustomerDTO>(); + + } } } diff --git a/zhengcaioa/DTO/CooperatecustomCustomerDTO.cs b/zhengcaioa/DTO/CooperatecustomCustomerDTO.cs index 3fcd11f..43431bf 100644 --- a/zhengcaioa/DTO/CooperatecustomCustomerDTO.cs +++ b/zhengcaioa/DTO/CooperatecustomCustomerDTO.cs @@ -84,6 +84,8 @@ public DateTime? Ywjltime { get; set; } + public int Guanliankehushu { get; set; } + } public class CooperatecustomCustomerDTOSearch : SearchEntity diff --git a/zhengcaioa/DTO/CustomerGuanlianDTO.cs b/zhengcaioa/DTO/CustomerGuanlianDTO.cs new file mode 100644 index 0000000..307b39e --- /dev/null +++ b/zhengcaioa/DTO/CustomerGuanlianDTO.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class CustomerGuanlianDTO + { + public string Id { get; set; } + public string CustomerId { get; set; } + public string Customertype { get; set; } + public string SecCustomerId { get; set; } + public string SecCustomertype { get; set; } + + + public List<CooperatecustomCustomerDTO> cooperatecustomCustomerDTOs { get; set; } + } +} diff --git a/zhengcaioa/DTO/IntentionCustomerDTO.cs b/zhengcaioa/DTO/IntentionCustomerDTO.cs index 62d9225..ea08ac2 100644 --- a/zhengcaioa/DTO/IntentionCustomerDTO.cs +++ b/zhengcaioa/DTO/IntentionCustomerDTO.cs @@ -69,6 +69,8 @@ public string Viscustomer { get; set; } public DateTime? Ywjltime { get; set; } + + public int Guanliankehushu { get; set; } } public class IntentionCustomerDTOSearch : SearchEntity diff --git a/zhengcaioa/IServices/ICooperatecustomCustomerService.cs b/zhengcaioa/IServices/ICooperatecustomCustomerService.cs index 1ad0f92..7d00cf5 100644 --- a/zhengcaioa/IServices/ICooperatecustomCustomerService.cs +++ b/zhengcaioa/IServices/ICooperatecustomCustomerService.cs @@ -27,5 +27,14 @@ ResultEntity saveyufukuan(CooperatecustomCustomerDTO cooperatecustomCustomerDTO); + + + ResultEntity saveCustomerGuanlian(CustomerGuanlianDTO DTO); + + ResultEntity DeleteCustomerGuanlian(string CustomerId, string SecCustomerId); + + List<CooperatecustomCustomerDTO> GetListCustomerGuanlian(string CustomerId); + + CustomerGuanlianDTO GetCustomerGuanlian(string CustomerId,string SecCustomerId); } } diff --git a/zhengcaioa/Model/CustomerGuanlian.cs b/zhengcaioa/Model/CustomerGuanlian.cs new file mode 100644 index 0000000..8ac4913 --- /dev/null +++ b/zhengcaioa/Model/CustomerGuanlian.cs @@ -0,0 +1,16 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class CustomerGuanlian + { + public string Id { get; set; } + public string CustomerId { get; set; } + public string Customertype { get; set; } + public string SecCustomerId { get; set; } + public string SecCustomertype { get; set; } + } +} diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index cde8ff5..e5eaff8 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -62,6 +62,7 @@ public virtual DbSet<CooperOrder> CooperOrders { get; set; } public virtual DbSet<CooperVisit> CooperVisits { get; set; } public virtual DbSet<CooperatecustomCustomer> CooperatecustomCustomers { get; set; } + public virtual DbSet<CustomerGuanlian> CustomerGuanlians { get; set; } public virtual DbSet<CusFangwenjilu> CusFangwenjilus { get; set; } public virtual DbSet<FiAccount> FiAccounts { get; set; } public virtual DbSet<FiAccountRecord> FiAccountRecords { get; set; } @@ -2760,6 +2761,21 @@ .HasColumnName("taocanjianshu"); }); + modelBuilder.Entity<CustomerGuanlian>(entity => + { + entity.ToTable("CustomerGuanlian"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.CustomerId).HasMaxLength(50); + + entity.Property(e => e.Customertype).HasMaxLength(50); + + entity.Property(e => e.SecCustomerId).HasMaxLength(50); + + entity.Property(e => e.SecCustomertype).HasMaxLength(50); + }); + modelBuilder.Entity<CusFangwenjilu>(entity => { entity.ToTable("cus_fangwenjilu"); diff --git a/zhengcaioa/Services/CooperatecustomCustomerService.cs b/zhengcaioa/Services/CooperatecustomCustomerService.cs index 36b9928..3e6ca7f 100644 --- a/zhengcaioa/Services/CooperatecustomCustomerService.cs +++ b/zhengcaioa/Services/CooperatecustomCustomerService.cs @@ -60,10 +60,10 @@ cooperatecustomCustomer.Ywjltime = DateTime.Now; var Cooper = _context.CooperatecustomCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == cooperatecustomCustomer.Ywjl); var Inten = _context.IntentionCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == cooperatecustomCustomer.Ywjl); - if (Cooper + Inten >= 1000) + if (Cooper + Inten >= 2000) { resultEntity.Result = false; - resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�1000锛�"; + resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�2000锛�"; return resultEntity; } } @@ -80,10 +80,10 @@ updateproject.Ywjltime = DateTime.Now; var Cooper = _context.CooperatecustomCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == cooperatecustomCustomer.Ywjl); var Inten = _context.IntentionCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == cooperatecustomCustomer.Ywjl); - if (Cooper + Inten >= 1000) + if (Cooper + Inten >= 2000) { resultEntity.Result = false; - resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�1000锛�"; + resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�2000锛�"; return resultEntity; } } @@ -446,6 +446,8 @@ cooperatecustomCustomerDTO.Hezuoyewu += "閲囪喘鍏憡鏉冮檺 | "; } + cooperatecustomCustomerDTO.Guanliankehushu = _context.CustomerGuanlians.Count(x => x.CustomerId == cooperatecustomCustomerDTO.Id); + } } @@ -564,5 +566,102 @@ var list = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition); return list; } + + + public ResultEntity saveCustomerGuanlian(CustomerGuanlianDTO DTO) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = false; + var customerGuanlian = _mapper.Map<CustomerGuanlian>(DTO); + + + if (String.IsNullOrEmpty(customerGuanlian.Id)) + { + customerGuanlian.Id = Guid.NewGuid().ToString(); + DTO.Id = customerGuanlian.Id; + _context.CustomerGuanlians.Add(customerGuanlian); + + CustomerGuanlian customerGuanlian1 = new CustomerGuanlian(); + customerGuanlian1.Id = Guid.NewGuid().ToString(); + customerGuanlian1.CustomerId = customerGuanlian.SecCustomerId; + customerGuanlian1.Customertype = customerGuanlian.SecCustomertype; + customerGuanlian1.SecCustomerId = customerGuanlian.CustomerId; + customerGuanlian1.SecCustomertype = customerGuanlian.Customertype; + _context.CustomerGuanlians.Add(customerGuanlian1); + } + + _context.SaveChanges(); + resultEntity.ReturnID = customerGuanlian.Id; + resultEntity.Result = true; + + return resultEntity; + } + + public CustomerGuanlianDTO GetCustomerGuanlian(string CustomerId, string SecCustomerId) + { + var entity = _context.CustomerGuanlians.Where(x=>x.CustomerId == CustomerId && x.SecCustomerId == SecCustomerId).FirstOrDefault(); + if (entity == null) + { + entity = new CustomerGuanlian(); + } + var customerGuanlianDTO = _mapper.Map<CustomerGuanlianDTO>(entity); + return customerGuanlianDTO; + } + + public ResultEntity DeleteCustomerGuanlian(string CustomerId, string SecCustomerId) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = false; + + + var entity = _context.CustomerGuanlians.Where(x => x.CustomerId == CustomerId && x.SecCustomerId == SecCustomerId).FirstOrDefault(); + + if (entity != null) + { + var entity1 = _context.CustomerGuanlians.Where(x => x.CustomerId == entity.SecCustomerId && x.SecCustomerId == entity.CustomerId).FirstOrDefault(); + _context.CustomerGuanlians.Remove(entity); + if (entity1 != null) + { + _context.CustomerGuanlians.Remove(entity1); + } + } + _context.SaveChanges(); + resultEntity.ReturnID = CustomerId; + resultEntity.Result = true; + return resultEntity; + } + public List<CooperatecustomCustomerDTO> GetListCustomerGuanlian(string CustomerId) + { + var customerGuanlians = _context.CustomerGuanlians.Where(x=>x.CustomerId == CustomerId).ToList(); + List <CooperatecustomCustomerDTO> cooperatecustomCustomerDTOs = new List<CooperatecustomCustomerDTO>(); + if (customerGuanlians!=null && customerGuanlians.Count > 0) + { + var hezuokehu = customerGuanlians/*.Where(x => x.SecCustomertype == "鍚堜綔瀹㈡埛")*/.Select(x => x.SecCustomerId).ToArray(); + if(hezuokehu!=null&& hezuokehu.Length > 0) + { + var cooperatecustomCustomers = _context.CooperatecustomCustomers.Where(x => x.RecStatus == "A" && hezuokehu.Contains(x.Id)).ToList(); + var cooperatecustomCustomerDTOssss = _mapper.Map<List<CooperatecustomCustomerDTO>>(cooperatecustomCustomers); + foreach(var cooperatecustomCustomerDTO in cooperatecustomCustomerDTOssss) + { + cooperatecustomCustomerDTO.Customertype = "鍚堜綔瀹㈡埛"; + cooperatecustomCustomerDTOs.Add(cooperatecustomCustomerDTO); + + } + + } + //var dangankehu = customerGuanlians.Where(x => x.SecCustomertype == "妗f瀹㈡埛").Select(x => x.SecCustomerId).ToArray(); + if (hezuokehu != null && hezuokehu.Length > 0) + { + var intentionCustomers = _context.IntentionCustomers.Where(x => x.RecStatus == "A" && hezuokehu.Contains(x.Id)).ToList(); + var cooperatecustomCustomerDTOssss = _mapper.Map<List<CooperatecustomCustomerDTO>>(intentionCustomers); + foreach (var cooperatecustomCustomerDTO in cooperatecustomCustomerDTOssss) + { + cooperatecustomCustomerDTO.Customertype = "妗f瀹㈡埛"; + cooperatecustomCustomerDTOs.Add(cooperatecustomCustomerDTO); + } + } + } + return cooperatecustomCustomerDTOs; + } } } diff --git a/zhengcaioa/Services/IntentionCustomerService.cs b/zhengcaioa/Services/IntentionCustomerService.cs index 8371d13..410bb6c 100644 --- a/zhengcaioa/Services/IntentionCustomerService.cs +++ b/zhengcaioa/Services/IntentionCustomerService.cs @@ -54,10 +54,10 @@ intentionCustomer.Ywjltime = DateTime.Now; var Cooper = _context.CooperatecustomCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == intentionCustomer.Ywjl); var Inten = _context.IntentionCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == intentionCustomer.Ywjl); - if(Cooper+ Inten >= 1000) + if(Cooper+ Inten >= 2000) { resultEntity.Result = false; - resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�1000锛�"; + resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�2000锛�"; return resultEntity; } } @@ -73,10 +73,10 @@ updateproject.Ywjltime = DateTime.Now; var Cooper = _context.CooperatecustomCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == intentionCustomer.Ywjl); var Inten = _context.IntentionCustomers.Count(x => x.RecStatus == "A" && x.Ywjl == intentionCustomer.Ywjl); - if (Cooper + Inten >= 1000) + if (Cooper + Inten >= 2000) { resultEntity.Result = false; - resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�1000锛�"; + resultEntity.Message = "璇ヤ笟鍔$粡鐞嗭紝瀹㈡埛鍗曚綅鍜屽悎浣滃鎴峰悎璁¤秴杩�2000锛�"; return resultEntity; } } @@ -245,25 +245,25 @@ var query = (from a in _context.IntentionCustomers - join b in listCode.Where(x => x.CodeTable == "IntentionCustomer" && x.CodeField == "khly") - on a.Khly equals b.CodeSn - join c in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl") - on a.Hyfl equals c.CodeSn - join d in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khlx") - on a.Khlx equals d.CodeSn - join e in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" && x.IsYwjl == "A") - on a.Ywjl equals e.Id - into esss - from abi in esss.DefaultIfEmpty() + // join b in listCode.Where(x => x.CodeTable == "IntentionCustomer" && x.CodeField == "khly") + // on a.Khly equals b.CodeSn + // join c in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl") + // on a.Hyfl equals c.CodeSn + // join d in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khlx") + //on a.Khlx equals d.CodeSn + // join e in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" && x.IsYwjl == "A") + // on a.Ywjl equals e.Id + // into esss + // from abi in esss.DefaultIfEmpty() - join f in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" ) - on a.Dianxiaozhuanyuan equals f.Id - into fsss - from fff in fsss.DefaultIfEmpty() + // join f in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" ) + // on a.Dianxiaozhuanyuan equals f.Id + // into fsss + // from fff in fsss.DefaultIfEmpty() - join f in _context.Areas on a.Sheng equals f.CodeId - join g in _context.Areas on a.City equals g.CodeId - join h in _context.Areas on a.AreaId equals h.CodeId + // join f in _context.Areas on a.Sheng equals f.CodeId + // join g in _context.Areas on a.City equals g.CodeId + // join h in _context.Areas on a.AreaId equals h.CodeId join l in _context.IntentionVisits.Where(x => x.RecStatus == "A").GroupBy(q => new { q.Viscustomer }).Select(q => new @@ -305,13 +305,13 @@ Hyfl = a.Hyfl, Khlx = a.Khlx, Ywjl = a.Ywjl, - ShengName = f.Name + "-" + g.Name + "-" + h.Name, - CityName = g.Name, - AreaIdName = h.Name, - KhlyName = b.Comments, - HyflName = c.Comments, - KhlxName = d.Comments, - YwjlName = abi.UserName, + //ShengName = f.Name + "-" + g.Name + "-" + h.Name, + //CityName = g.Name, + //AreaIdName = h.Name, + //KhlyName = b.Comments, + //HyflName = c.Comments, + //KhlxName = d.Comments, + //YwjlName = abi.UserName, Name = a.Name, Postal = a.Postal, Address = a.Address, @@ -348,7 +348,7 @@ YixiangtimeName = a.Yixiangtime.HasValue? a.Yixiangtime.Value.ToString("yyyy-MM-dd"):"", Yixiang = a.Yixiang, Dianxiaozhuanyuan = a.Dianxiaozhuanyuan, - DianxiaozhuanyuanName = fff.UserName, + //DianxiaozhuanyuanName = fff.UserName, Zuijinzhuizongtime = a.Zuijinzhuizongtime, ZuijinzhuizongtimeName = a.Zuijinzhuizongtime.HasValue ? a.Zuijinzhuizongtime.Value.ToString("yyyy-MM-dd") : "", Visittimes = lll.Visittimes, @@ -403,6 +403,71 @@ searchEntity.totalrows = query.Count(); var lianlist = query.OrderByDescending(x => x.Modifytime).Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + if(lianlist!=null && lianlist.Count > 0) + { + var areas = _context.Areas; + var pltUsers = _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A"); + + var khly = listCode.Where(x => x.CodeTable == "IntentionCustomer" && x.CodeField == "khly"); + + + var hyfl = listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl"); + + + var khlx = listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khlx"); + + + foreach (var intentionCustomerDTO in lianlist) + { + var sheng = areas.Where(x => x.CodeId == intentionCustomerDTO.Sheng).FirstOrDefault(); + var city = areas.Where(x => x.CodeId == intentionCustomerDTO.City).FirstOrDefault(); + var Area = areas.Where(x => x.CodeId == intentionCustomerDTO.AreaId).FirstOrDefault(); + if (sheng != null) + { + intentionCustomerDTO.ShengName = sheng.Name; + } + if (city != null) + { + intentionCustomerDTO.CityName = city.Name; + intentionCustomerDTO.ShengName += "-" + city.Name; + } + if (Area != null) + { + intentionCustomerDTO.AreaIdName = Area.Name; + intentionCustomerDTO.ShengName += "-" + Area.Name; + } + var ywjl = pltUsers.Where(x => x.Id == intentionCustomerDTO.Ywjl).FirstOrDefault(); + if (ywjl != null) + { + intentionCustomerDTO.YwjlName = ywjl.UserName; + } + var Dianxiaozhuanyuan = pltUsers.Where(x => x.Id == intentionCustomerDTO.Dianxiaozhuanyuan).FirstOrDefault(); + if (Dianxiaozhuanyuan != null) + { + intentionCustomerDTO.DianxiaozhuanyuanName = Dianxiaozhuanyuan.UserName; + } + var KhlyName = khly.Where(x => x.CodeSn == intentionCustomerDTO.Khly).FirstOrDefault(); + if (KhlyName != null) + { + intentionCustomerDTO.KhlyName = KhlyName.Comments; + } + var HyflName = hyfl.Where(x => x.CodeSn == intentionCustomerDTO.Hyfl).FirstOrDefault(); + if (HyflName != null) + { + intentionCustomerDTO.HyflName = HyflName.Comments; + } + var KhlxName = khlx.Where(x => x.CodeSn == intentionCustomerDTO.Khlx).FirstOrDefault(); + if (KhlxName != null) + { + intentionCustomerDTO.KhlxName = KhlxName.Comments; + } + + + intentionCustomerDTO.Guanliankehushu = _context.CustomerGuanlians.Count(x => x.CustomerId == intentionCustomerDTO.Id); + } + } + + //foreach (var intentionCustomerDTO in lianlist) //{ @@ -410,7 +475,7 @@ //} - data.LoadData(searchEntity, lianlist); + data.LoadData(searchEntity, lianlist); return data; } diff --git a/zhengcaioa/zhengcaioa/Controllers/Customer/CooperatecustomCustomerController.cs b/zhengcaioa/zhengcaioa/Controllers/Customer/CooperatecustomCustomerController.cs index 9fea049..db6457c 100644 --- a/zhengcaioa/zhengcaioa/Controllers/Customer/CooperatecustomCustomerController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/Customer/CooperatecustomCustomerController.cs @@ -400,5 +400,182 @@ return View(); } + + + + + [CheckLogin] + + public IActionResult IndexCustomerGuanlian(string CustomerId,string Customertype) + { + + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + + CustomerGuanlianDTO customerGuanlianDTO = new CustomerGuanlianDTO(); + customerGuanlianDTO.CustomerId = CustomerId; + customerGuanlianDTO.Customertype = Customertype; + customerGuanlianDTO.cooperatecustomCustomerDTOs = _cooperatecustomCustomerService.GetListCustomerGuanlian(CustomerId); + + + + ViewData.Model = customerGuanlianDTO; + return View(); + } + + + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + /// + [HttpPost] + public IActionResult DelCustomerGuanlian(CustomerGuanlianDTO dTO) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = false; + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + + + + resultEntity = _cooperatecustomCustomerService.DeleteCustomerGuanlian(dTO.CustomerId, dTO.SecCustomerId); + + + return new JsonResult(resultEntity); + } + + + public IActionResult IndexSelect(string Id, string Customertype) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + List<ActionEntity> actionlist = new List<ActionEntity>(); + + + + + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Search"; + actionEntity.PageIco = "fa fa-search"; + actionEntity.ActionName = "鏌ヨ"; + actionlist.Add(actionEntity); + + + ActionEntity actionEntity2 = new ActionEntity(); + actionEntity2.OpenType = 0; + actionEntity2.ActionUrl = ""; + actionEntity2.ActionFun = "Zhuanyi"; + actionEntity2.PageIco = "fa fa-exchange"; + actionEntity2.ActionName = "纭鍏宠仈"; + actionlist.Add(actionEntity2); + + + ViewData["ActionInfo"] = actionlist; + //ViewData["ActionInfo2"] = pageEntities2; + + ViewBag.khlx = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.khly = _liaotianService.GetSYScode("IntentionCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + ViewBag.users = _userService.GetList().Where(x => x.IsYwjl == "A").Select(x => new { code = x.Id, label = x.UserName }).ToList(); + + ViewBag.Creater = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList(); + + ViewBag.shifou = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + + var areaDTOs = _projectService.Getsheng().ToList(); + foreach (var areaDTO in areaDTOs) + { + if (areaDTO.CodeId == "510000") + { + areaDTOs.Remove(areaDTO); + break; + } + } + var areaDTOsic = new Area(); + areaDTOsic.CodeId = "510000"; + areaDTOsic.Name = "鍥涘窛鐪�"; + areaDTOsic.ParentId = "0 "; + areaDTOs.Insert(1, areaDTOsic); + ViewBag.ShengDropDown = areaDTOs.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); + + ViewBag.Baomingtimebegin = DateTime.Now.AddMonths(-6).ToString("yyyy-MM-dd"); + ViewBag.Baomingtimeend = DateTime.Now.ToString("yyyy-MM-dd"); + ViewBag.Id = Id; + ViewBag.Customertype1 = Customertype; + + ViewBag.Customertype = _liaotianService.GetSYScode("ADM_Askzczbwsydtl", "Customertype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + + return View(); + + } + + + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + /// + [HttpPost] + public IActionResult SaveCustomerGuanlian(CustomerGuanlianDTO dTO) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = true; + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, + new TransactionOptions + { + IsolationLevel = IsolationLevel.ReadCommitted, + Timeout = TransactionManager.MaximumTimeout + } + )) + { + + if (!string.IsNullOrWhiteSpace(dTO.SecCustomerId)) + { + var SecCustomerId = dTO.SecCustomerId.Split(','); + + var SecCustomertype = dTO.SecCustomertype.Split(','); + + for (int i = 0; i < SecCustomerId.Length; i++) + { + var customerGuanlianDTO = _cooperatecustomCustomerService.GetCustomerGuanlian(dTO.CustomerId, SecCustomerId[i]); + + if (string.IsNullOrEmpty(customerGuanlianDTO.Id)) + { + customerGuanlianDTO.CustomerId = dTO.CustomerId; + customerGuanlianDTO.Customertype = dTO.Customertype; + customerGuanlianDTO.SecCustomerId = SecCustomerId[i]; + customerGuanlianDTO.SecCustomertype = SecCustomertype[i]; + resultEntity = _cooperatecustomCustomerService.saveCustomerGuanlian(customerGuanlianDTO); + } + } + scope.Complete(); + } + else + { + resultEntity.Result = true; + } + + + } + + + + + return new JsonResult(resultEntity); + } + } } diff --git a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs index 510d10e..7ce48bc 100644 --- a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs +++ b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs @@ -369,7 +369,7 @@ admSignInDTO = new AdmSignInDTO(); } //鏌ヨ璇峰亣 璇峰亣鏃堕棿涓嶈兘閲嶅彔 - List<AdmAskLeaveDTO> admAskLeaveDTOMin = admAskLeaveDTOs.Where(x =>/*x.Lavetype != "2" &&*/ x.StratTime < dateminkaoqin.AddDays(1) && x.EndTime > dateminkaoqin).OrderByDescending(x=>x.Createtime).ToList(); + List<AdmAskLeaveDTO> admAskLeaveDTOMin = admAskLeaveDTOs.Where(x => x.Lavetype != "2" && x.StratTime < dateminkaoqin.AddDays(1) && x.EndTime > dateminkaoqin).OrderByDescending(x=>x.Createtime).ToList(); //鏌ヨ閿�鍋� 閿�鍋囨椂闂翠笉鑳介噸鍙� List<AdmAskLeaveOffDTO> admAskLeaveOffDTOMin = admAskLeaveOffDTOs.Where(x => x.StratTime < dateminkaoqin.AddDays(1) && x.EndTime > dateminkaoqin).OrderByDescending(x => x.Createtime).ToList(); diff --git a/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/Index.cshtml b/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/Index.cshtml index bd837ae..75f5ca4 100644 --- a/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/Index.cshtml @@ -31,6 +31,12 @@ return "<a onclick=\"OpenWindow('" + cellvalue.replace(/'/g, '') + "','98%','100%', '/CooperatecustomCustomer/Edit?id=" + rowObject.Id + "')\" >" + cellvalue + "</a>"; } }, + { + label: '鍏宠仈瀹㈡埛鏁�', name: 'Guanliankehushu', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('" + rowObject.Name.replace(/'/g, '') + "','100%','100%', '/CooperatecustomCustomer/IndexCustomerGuanlian?CustomerId=" + rowObject.Id + "&Customertype=鍚堜綔瀹㈡埛')\" >" + cellvalue + "</a>"; + } + }, { label: '鑱旂郴鐢佃瘽', name: 'Tel', labtype: 'txt', hidden: false, width: 100 }, { label: '鎵�灞炲尯鍩�', name: 'ShengName', labtype: 'txt', hidden: false, width: 100 }, //{ label: '瀹㈡埛鏉ユ簮', name: 'KhlyName', labtype: 'txt', hidden: false, width: 100 }, @@ -53,6 +59,12 @@ return "<a class='Huifang' style='display: none;' onclick=\"OpenWindow('鍥炶璁板綍','98%','100%', '/CooperVisit/Index?IsYwjl=true&Viscustomer=" + rowObject.Id + "')\" >鍥炶璁板綍</a>"; } }, + { + label: '娣诲姞鍏宠仈瀹㈡埛', name: 'Guanliankehushu', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('" + rowObject.Name.replace(/'/g, '') + "','100%','100%', '/CooperatecustomCustomer/IndexSelect?Id=" + rowObject.Id + "&Customertype=鍚堜綔瀹㈡埛')\" >娣诲姞鍏宠仈瀹㈡埛</a>"; + } + }, ]; dataUrl = "/CooperatecustomCustomer/GetList?Createtime=" + Baomingtimebegin + "|" + Baomingtimeend +"@(string.IsNullOrEmpty(Creater)?"": "&Ywjl=" + Creater)"; searchCol = [ diff --git a/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexCustomerGuanlian.cshtml b/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexCustomerGuanlian.cshtml new file mode 100644 index 0000000..4e2b393 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexCustomerGuanlian.cshtml @@ -0,0 +1,257 @@ +锘緻model CustomerGuanlianDTO; +@using DTO; +@using zhengcaioa.Models; +@{ + Layout = null; + + + + //List<CooperatecustomCustomerDTO> CooperatecustomCustomerDTOs = ViewData["CooperatecustomCustomerDTOs"] as List<CooperatecustomCustomerDTO>; +} + +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="ThemeBucket"> + <link href="~/css/bootstrap.min.css" rel="stylesheet"> + <link href="~/css/font-awesome.min.css" rel="stylesheet"> + <link href="~/css/animate.min.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/chosen/chosen.css" rel="stylesheet"> + <link href="~/js/plugins/layer/skin/layer.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/toastr/toastr.min.css" rel="stylesheet" /> + + <!-- jqgrid--> + <script language="javascript" src="~/js/jquery.min.js" type="text/javascript"></script> + <script src="~/js/bootstrap.min.js"></script> + + <!--瀹瑰櫒--> + <script language="javascript" src="~/js/plugins/chosen/chosen.jquery.js" type="text/javascript"></script> + <script language="javascript" src="~/js/plugins/layer/layer.js" type="text/javascript"></script> + <script src="~/js/plugins/toastr/toastr.min.js" type="text/javascript"></script> + <script language="javascript" src="~/js/common-layout.js" type="text/javascript"></script> + <script src="~/js/plugins/layer/laydate/laydate.js" type="text/javascript"></script> + <script src="~/js/TUJS.js"></script> + + <style type="text/css"> + + div.clearfix > label { + padding-top: 8px; + } + + .col-md-1.control-label { + padding-right: 0px; + font-weight: 400; + } + + table { + border-collapse: collapse; + border: none; + width: 900px; + margin-left: 0px; + text-align: center; + } + + td { + border: solid #000000 1px; + height: 30px; + } + </style> + + +</head> + +<body class="gray-bg" style="overflow:auto"> + <form id="fm" method="post"> + <div class="wrapper wrapper-content" id="ibox-content" style="padding:15px;"> + <div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div id="div_content" class="ibox-content" style="background-color:white;"> + <div class="row"> + + + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鍏宠仈瀹㈡埛<i class="red">*</i></label> + <div class="col-sm-7 col-md-7"> + <a class="btn btn-success" id="xuanze" href="javascript:void(0)" onclick="xuanzekehu();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">閫夋嫨</span> + </a> + </div> + + + </div> + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label"></label> + <div class="col-sm-8 col-md-8"> + <table style="width:95%;" id="kehutable"> + @{ + int i = 1; + } + <tr> + @*<td style="width:10%;"> 缂栧彿</td>*@ + <td style="width:60%;"> 瀹㈡埛鍚嶇О</td> + + <td style="width:15%;"> 鑱旂郴鏂瑰紡</td> + <td style="width:15%;"> 瀹㈡埛绫诲瀷</td> + <td style="width:10%;"> 鍒犻櫎</td> + </tr> + @*<tr class="Customers"> + + <td> 1</td> + <td> 娴嬭瘯瀹㈡埛</td> + <td> 娴嬭瘯鐢佃瘽</td> + <td> + 鍚堜綔瀹㈡埛 + <input type="hidden" name="Customername" value="娴嬭瘯瀹㈡埛" /> + <input type="hidden" name="Phone" value="娴嬭瘯鐢佃瘽" /> + <input type="hidden" name="Customertype" value="鍚堜綔瀹㈡埛" /> + <input type="hidden" name="CustomerId" value="32423423432432434" /> + </td> + </tr>*@ + + @if (Model.cooperatecustomCustomerDTOs != null && Model.cooperatecustomCustomerDTOs.Count > 0) + { + @foreach (var cooperatecustomCustomerDTO in Model.cooperatecustomCustomerDTOs) + { + <tr class="Customers"> + + @*<td> @i</td>*@ + <td> @cooperatecustomCustomerDTO.Name</td> + <td> @cooperatecustomCustomerDTO.Tel</td> + <td> + @cooperatecustomCustomerDTO.Customertype + <input type="hidden" name="Customername" value="@cooperatecustomCustomerDTO.Name" /> + <input type="hidden" name="Phone" value="@cooperatecustomCustomerDTO.Tel" /> + <input type="hidden" name="Customertype" value="@cooperatecustomCustomerDTO.Customertype" /> + <input type="hidden" name="CustomerId" value="@cooperatecustomCustomerDTO.Id" /> + </td> + <td style="width:10%;"> <button type="button" class="delBtn" onclick="delBtn(this, '@cooperatecustomCustomerDTO.Id','@Model.CustomerId')" data-type="3" style="width:32px">-</button> </td> + </tr> + + i++; + } + } + </table> + </div> + + + </div> + + + + + <div class="clearfix layer-area" style="padding-bottom:60px;"> + + </div> + </div> + </div> + </div> + </div> + </div> + </div> + + + </form> + + <script type="text/javascript"> + + var hh = document.body.clientHeight - $("#top").height() * 2 - 50; + $("#div_content").height(hh); + + toastr.options = { + "closeButton": true, + "debug": false, + "progressBar": true, + "positionClass": "toast-bottom-right", + "onclick": null, + "showDuration": "300", + "hideDuration": "600", + "timeOut": "4500", + "extendedTimeOut": "600", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" + }; + + + + + var xuanzekehu = function () { + OpenWindow("閫夋嫨瀹㈡埛", "100%", "100%", "/CooperatecustomCustomer/IndexSelect?Id=@(Model.CustomerId)&Customertype=@(Html.Raw(Model.Customertype))"); + } + + + var _reloadPageData = function () { + + + window.location = "/CooperatecustomCustomer/IndexCustomerGuanlian?CustomerId=@(Model.CustomerId)&Customertype=@(Html.Raw(Model.Customertype))"; + + + } + + + function _pageAutoClose() { + try { + parent.window._reloadPageData(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.isRefresh = true; + parent.layer.closeAll('loading'); + parent.layer.close(index); + return false; + } + catch (err) { + var pathname = window.location.pathname; + var search = window.location.search; + parent._CloseTab1(pathname + search); + } + + } + + + function delBtn(obj, id, CustomerId) { + + + $.ajax({ + type: "POST", + url: "/CooperatecustomCustomer/DelCustomerGuanlian", + dataType: "json", + global: false, + data: { CustomerId: CustomerId, SecCustomerId: id}, + success: function (data) { + + if (data.Result) { + $(obj).parent().parent().remove(); + layer.msg('鍒犻櫎鎴愬姛', { icon: 6 }); + //try { + // _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + //} + //catch (err) { + // var pathname = window.location.pathname; + // var search = window.location.search; + // parent._CloseTab1(pathname + search); + //} + } + else { + layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + layer.msg('澶辫触', { icon: 5 }); + } + }); + + + + } + </script> +</body> +</html> \ No newline at end of file diff --git a/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexSelect.cshtml b/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexSelect.cshtml new file mode 100644 index 0000000..1fb55f5 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/CooperatecustomCustomer/IndexSelect.cshtml @@ -0,0 +1,307 @@ +锘緻using DTO; +@{ + ViewBag.Title = "IntentionCustomer"; + Layout = "~/Views/Shared/_Layout_Search.cshtml"; + + +} +@section headerStyle{ + <script type="text/javascript"> + var khlxs = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.khlx))'; + var khlys = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.khly))'; + var hyfls = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.hyfl))'; + var users = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.users))'; + var shengDropDown = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.ShengDropDown))'; + var Creater = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Creater))'; + var shifou = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.shifou))'; + + var Customertype = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Customertype))'; + + var Baomingtimebegin = '@Html.Raw(ViewBag.Baomingtimebegin)'; + var Baomingtimeend = '@Html.Raw(ViewBag.Baomingtimeend)'; + var Id = '@Html.Raw(ViewBag.Id)'; + var Customertype1 = '@Html.Raw(ViewBag.Customertype1)'; + + loseherght = 60; + gridConfig = { multiselect: true, selectcol: "Id" }; + dataCol = [ + { + label: 'id', name: 'Id', labtype: 'txt', hidden: true + }, + { label: '寤烘。鏃堕棿', name: 'CreatetimeName', labtype: 'txt', hidden: false, width: 100 }, + { + label: '瀹㈡埛鍗曚綅', name: 'Name', labtype: 'txt', hidden: false, width: 400 + }, + + { label: '鑱旂郴鐢佃瘽', name: 'Tel', labtype: 'txt', hidden: false, width: 100 }, + { label: '鎵�灞炲尯鍩�', name: 'ShengName', labtype: 'txt', hidden: false, width: 100 }, + { label: '瀹㈡埛鏉ユ簮', name: 'KhlyName', labtype: 'txt', hidden: false, width: 100 }, + { label: '琛屼笟鍒嗙被', name: 'HyflName', labtype: 'txt', hidden: false, width: 100 }, + { label: '瀹㈡埛绫诲瀷', name: 'KhlxName', labtype: 'txt', hidden: false, width: 100}, + { label: '涓氬姟缁忕悊', name: 'YwjlName', labtype: 'txt', hidden: false, width: 100 }, + { label: '瀹㈡埛绉嶇被', name: 'Customertype', labtype: 'txt', hidden: false, width: 100 }, + + ]; + dataUrl = "/IntentionCustomer/GetListSelect?Createtime=" + Baomingtimebegin + "|" + Baomingtimeend +"&Customertype=01"; + searchCol = [ + { label: '瀹㈡埛鏉ユ簮', name: 'Khly', labtype: 'combox', hidden: false, data: JSON.parse(khlys), cwidth: '5%', cccwidth: '8%' }, + { label: '琛屼笟鍒嗙被', name: 'Hyfl', labtype: 'combox', hidden: false, data: JSON.parse(hyfls), cwidth: '5%', cccwidth: '15%' }, + { label: '瀹㈡埛绫诲瀷', name: 'Khlx', labtype: 'combox', hidden: false, data: JSON.parse(khlxs), cwidth: '5%', cccwidth: '8%' }, + { label: '涓氬姟缁忕悊', name: 'Ywjl', labtype: 'combox', hidden: false, data: JSON.parse(users), cwidth: '5%', cccwidth: '8%' }, + + { label: '鐪�', name: 'Sheng', labtype: 'combox', hidden: false, data: JSON.parse(shengDropDown), cwidth: '5%', cccwidth: '8%' }, + { label: '甯�', name: 'City', labtype: 'combox', hidden: false, data: JSON.parse('[]'), cwidth: '1%', cccwidth: '8%' }, + { label: '鍖哄幙', name: 'AreaId', labtype: 'combox', hidden: false, data: JSON.parse('[]'), cwidth: '2%', cccwidth: '8%' }, + { label: '瀹㈡埛鍗曚綅', name: 'Name', labtype: 'txt', hidden: false }, + { label: '寤烘。鏃堕棿', name: 'Createtime', labtype: 'datearea', hidden: false }, + { label: '瀹㈡埛绉嶇被', name: 'Customertype', labtype: 'combox', hidden: false, data: JSON.parse(Customertype), cwidth: '5%', cccwidth: '8%' }, + + + ]; + + + var _pageSearch = function () { + $("#jqGrid").jqGrid('setGridParam', { + url: dataUrl = "/IntentionCustomer/GetListSelect", postData: jsons, page: 1 + }); //閲嶆柊杞藉叆 + var jsons = GetSearchEnd(); + if (jsons == false) { + msg.info("璇峰綍鍏ユ煡璇㈡潯浠�"); + return false; + } + LoadGrid(jsons); + } + + + + var _pageZhuanyi = function () { + + var duanxin = GetGridSelect(); + var SecCustomerId = ""; + var SecCustomertype = ""; + if (duanxin != '') { + var Customerss = Id; + var Customertype = Customertype1; + for (var i = 0; i < duanxin.length; i++) { + + if (Customerss != duanxin[i]) { + var rowData = $("#jqGrid").jqGrid('getRowData', duanxin[i]); + + + SecCustomerId += duanxin[i] + ','; + SecCustomertype += rowData.Customertype + ','; + } + + } + if (SecCustomerId == "") { + toastr.error("璇烽�夋嫨瀹㈡埛"); + return; + } + + SecCustomerId = SecCustomerId.substring(0, SecCustomerId.length - 1); + SecCustomertype = SecCustomertype.substring(0, SecCustomertype.length - 1); + + $.ajax({ + type: "POST", + url: "/CooperatecustomCustomer/SaveCustomerGuanlian", + dataType: "json", + global: false, + data: { CustomerId: Customerss, Customertype: Customertype , SecCustomerId: SecCustomerId, SecCustomertype: SecCustomertype }, + success: function (data) { + if (data.Result) { + /* $(obj).parent().parent().remove();*/ + layer.msg('淇濆瓨鎴愬姛', { icon: 6 }); + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + else { + layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + layer.msg('澶辫触', { icon: 5 }); + } + }); + + + + + + + + + + + + + + + //var index = parent.layer.getFrameIndex(window.name); + //parent.layer.close(index); + //return false; + } else { + toastr.error("璇烽�夋嫨瀹㈡埛"); + return; + } + + + } + + + + + + + + + + + + + var _afterSave = function (result) { + if (result) { + toastr.success("淇濆瓨鎴愬姛"); + } else { + toastr.error("淇濆瓨澶辫触"); + } + } + + var _afterDel = function (result) { + if (result) { + toastr.success("鍒犻櫎鎴愬姛"); + } else { + /**/ + toastr.error("鍒犻櫎澶辫触"); + /**/ + } + } + + + + function _pageAutoClose() { + + parent.window._reloadPageData(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.isRefresh = true; + parent.layer.closeAll('loading'); + parent.layer.close(index); + return false; + + + } + + </script> +} + +@section footerScripts{ + <script type="text/javascript"> + + function send() { + + var msg = $("#PBSSheng"); + + + if (msg.length > 0) { + $("#PBSSheng").change(function () { + var sheng = $("#PBSSheng").val(); + $.ajax({ + type: "GET", + url: "/Project/getCity?shengid=" + sheng, + dataType: "json", + global: false, + data: "", + success: function (data) { + + var city = $("#PBSCity"); + city.find('option').remove(); + var aaa = '<option value="" hassubinfo="true"> </option>'; + city.append(aaa); + if (data.length > 0) { + for (var i = 0; i < data.length; i++) { + + var o = '<option value="' + data[i].CodeId + '" hassubinfo="true">' + data[i].Name + '</option>'; + city.append(o); + } + } + $("#PBSCity").trigger('chosen:updated');//鏇存柊閫夐」 + }, + error: function () { + + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + }); + + } else { + setTimeout(send, 1000); + } + } + + + send(); + + + + function sendCity() { + + var msg = $("#PBSCity"); + + + if (msg.length > 0) { + $("#PBSCity").change(function () { + + var city = $("#PBSCity").val(); + $.ajax({ + type: "GET", + url: "/Project/getAreaId?cityid=" + city, + dataType: "json", + global: false, + data: "", + success: function (data) { + + var quxian = $("#PBSAreaId"); + quxian.find('option').remove(); + var aaa = '<option value="" hassubinfo="true"> </option>'; + quxian.append(aaa); + if (data.length > 0) { + for (var i = 0; i < data.length; i++) { + + var o = '<option value="' + data[i].CodeId + '" hassubinfo="true">' + data[i].Name + '</option>'; + quxian.append(o); + } + } + $("#PBSAreaId").trigger('chosen:updated');//鏇存柊閫夐」 + }, + error: function () { + + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + }); + + } else { + setTimeout(sendCity, 1000); + } + } + + + sendCity(); + + + $(function () { + + + + $("#PBSCreatetimeend").val(Baomingtimeend); + + $("#PBSCreatetimestart").val(Baomingtimebegin); + + $("#PBSCustomertype").val("01"); + $("#PBSCustomertype").trigger('chosen:updated');//鏇存柊閫夐」 + }); + + + </script> +} diff --git a/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml b/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml index 05077ac..cb0b19c 100644 --- a/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml @@ -35,7 +35,12 @@ return "<a onclick=\"OpenWindow('" + cellvalue.replace(/'/g, '') + "','98%','100%', '/IntentionCustomer/Edit?id=" + rowObject.Id + "')\" ><span style='color:" + color + ";'>" + cellvalue + "</span></a>"; } }, - + { + label: '鍏宠仈瀹㈡埛鏁�', name: 'Guanliankehushu', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('" + rowObject.Name.replace(/'/g, '') + "','100%','100%', '/CooperatecustomCustomer/IndexCustomerGuanlian?CustomerId=" + rowObject.Id + "&Customertype=妗f瀹㈡埛')\" >" + cellvalue + "</a>"; + } + }, { label: '鑱旂郴鐢佃瘽', name: 'Tel', labtype: 'txt', hidden: false, width: 100 }, { label: '鎵�灞炲尯鍩�', name: 'ShengName', labtype: 'txt', hidden: false, width: 100 }, { label: '瀹㈡埛鏉ユ簮', name: 'KhlyName', labtype: 'txt', hidden: false, width: 100 }, @@ -61,6 +66,13 @@ } }, + { + label: '娣诲姞鍏宠仈瀹㈡埛', name: 'Guanliankehushu', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('" + rowObject.Name.replace(/'/g, '') + "','100%','100%', '/CooperatecustomCustomer/IndexSelect?Id=" + rowObject.Id + "&Customertype=妗f瀹㈡埛')\" >娣诲姞鍏宠仈瀹㈡埛</a>"; + } + }, + ]; dataUrl = "/IntentionCustomer/GetList?Createtime=" + Baomingtimebegin + "|" + Baomingtimeend +"@(string.IsNullOrEmpty(Creater11) ?"": "&Ywjl=" + Creater11)"; searchCol = [ -- Gitblit v1.9.1