123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- using AntDesign;
- using AntDesign.TableModels;
- using Microsoft.AspNetCore.Components.Web;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- namespace wispro.sp.web.Pages
- {
- public partial class CustomerList
- {
- private List<entity.Customer> _Customers =new List<entity.Customer>()
- {
- new entity.Customer()
- {
- Id=1,
- Name = "OPPO广东移动通信有限公司",
- Address="广东省东莞市长安镇乌沙海滨路18号",
- Phone="4001-666-888",
- ContactMan="刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 2,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 3,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 4,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 5,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 6,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 7,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 8,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 9,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 10,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 11,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 12,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 13,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 14,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 15,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 16,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 17,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- },
- new entity.Customer()
- {
- Id = 18,
- Name = "OPPO广东移动通信有限公司",
- Address = "广东省东莞市长安镇乌沙海滨路18号",
- Phone = "4001-666-888",
- ContactMan = "刘波",
- ResponseMan= new entity.Staff(){Name ="钟子敏",Id =1},
- ResponseManId= 1
- }
- };
- IEnumerable<entity.Customer> selectedRows;
- ITable table;
- int _pageIndex = 1;
- int _pageSize = 10;
- int _total = 0;
- bool _loading = false;
- entity.Customer Editing = null;
- bool _visible = false;
- bool _isAdd = false;
- protected override void OnInitialized()
- {
- _loading = true;
- //await System.Threading.Thread.Sleep();
- //List<wispro.sp.entity.StaffGrade> data = await Http.GetFromJsonAsync<List<wispro.sp.entity.StaffGrade>>($"http://localhost:39476/api/StaffGrade/GetAll");
- _loading = false;
- _total = _Customers.Count;
- }
- private void HandlePageChange(PaginationEventArgs args)
- {
- if (_pageIndex != args.Page)
- {
- _pageIndex = args.Page;
- }
- if (_pageSize != args.PageSize)
- {
- _pageSize = args.PageSize;
- }
- }
- Dictionary<string, object> OnRow(RowData<entity.Customer> row)
- {
- Dictionary<string, object> ret = new Dictionary<string, object>();
- ret.Add("id", row.Data.Id);
- ret.Add("onclick", ((Action)delegate
- {
- //_message.Info($"row {row.Data.Grade} was clicked");
- }));
- return ret;
- }
- public void RemoveSelection(int id)
- {
- //var selected = selectedRows.Where(x => x.Id != id);
- //selectedRows = selected;
- }
- private void Delete(int id)
- {
- var DelCustumer = _Customers.Where(x => x.Id == id).FirstOrDefault<entity.Customer>();
- if (DelCustumer != null)
- {
- Editing = DelCustumer;
- _isAdd = false;
- _visible = true;
- }
- else
- {
- }
- _total = _Customers.Count;
- }
- private void Edit(int id)
- {
- Editing = _Customers.Where(x => x.Id == id).FirstOrDefault<entity.Customer>();
- if (Editing != null)
- {
- _isAdd = false;
- _visible = true;
- }
- else
- {
- }
- _total = _Customers.Count;
- }
- private void AddNew()
- {
- Editing = new entity.Customer();
- //_isAdd = true;
- _visible = true;
- }
- private async Task HandleOk(MouseEventArgs e)
- {
- //var data = await Http.PostAsJsonAsync<wispro.sp.entity.StaffGrade>($"http://localhost:39476/api/StaffGrade/Save", EditingStaff);
- //if (data.IsSuccessStatusCode)
- //{
- // ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
- // await Task.Delay(1000);
- // if (result.Success)
- // {
- // await _message.Success("数据已保存!");
- // }
- // else
- // {
- // await _message.Error($"{result.ErrorMessage}");
- // }
- //}
- //else
- //{
- // await _message.Error($"请求发生错误 {data.StatusCode}");
- //}
- _visible = false;
- }
- private void HandleCancel(MouseEventArgs e)
- {
- Console.WriteLine(e);
- _visible = false;
- }
- }
- }
|