CustomerDetail.cshtml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. @using Abp.Authorization
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Models.Modal
  5. @using ShwasherSys.Views.Shared.New.Table
  6. @model ShwasherSys.CustomerInfo.Dto.CustomerDto
  7. @{
  8. /**/
  9. ViewBag.ActiveMenu = PermissionNames.PagesCustomerInfoCustomers; //The menu item will be active for this page.
  10. ViewBag.Title = "客户信息详情";
  11. bool isCanDeleteDefaultProduct = IsGranted(PermissionNames.PagesCustomerInfoCustomersDeleteDefaultProduct);
  12. bool isCanUpdateDefaultProduct = IsGranted(PermissionNames.PagesCustomerInfoCustomersUpdateDefaultProduct);
  13. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  14. {
  15. new SearchItem("partNo","零件号"),
  16. new SearchItem("productNo","成品编码"),
  17. }, false);
  18. }
  19. <!-- Content Header (Page header) -->
  20. <section class="content-header">
  21. <h1>
  22. @Model.CustomerName
  23. </h1>
  24. @*<ol class="breadcrumb">
  25. <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
  26. <li><a href="#">Examples</a></li>
  27. <li class="active">User profile</li>
  28. </ol>*@
  29. </section>
  30. <!-- Main content -->
  31. <section class="content">
  32. <div class="row">
  33. <div class="col-md-3">
  34. <!-- /.box -->
  35. <!-- About Me Box -->
  36. <div class="box box-primary">
  37. <div class="box-header with-border">
  38. <h3 class="box-title">客户详情</h3>
  39. </div>
  40. <!-- /.box-header -->
  41. <div class="box-body">
  42. <strong><i class="fa fa-book margin-r-5"></i> 客户编号</strong>
  43. <p class="text-muted">
  44. @Model.Id
  45. </p>
  46. <hr>
  47. <strong><i class="fa fa-map-marker margin-r-5"></i> 客户名称</strong>
  48. <p class="text-muted">@Model.CustomerName</p>
  49. <hr>
  50. <strong><i class="fa fa-pencil margin-r-5"></i> 联系人</strong>
  51. <p class="text-muted">@Model.LinkMan</p>
  52. <hr>
  53. <strong><i class="fa fa-file-text-o margin-r-5"></i> 电话</strong>
  54. <p class="text-muted">@Model.Telephone</p>
  55. <hr>
  56. <strong><i class="fa fa-file-text-o margin-r-5"></i> 传真</strong>
  57. <p class="text-muted">@Model.Fax</p>
  58. <hr>
  59. <strong><i class="fa fa-file-text-o margin-r-5"></i> 邮编</strong>
  60. <p class="text-muted">@Model.Zip</p>
  61. <hr>
  62. <strong><i class="fa fa-file-text-o margin-r-5"></i> 电子邮件</strong>
  63. <p class="text-muted">@Model.Email</p>
  64. <hr>
  65. <strong><i class="fa fa-file-text-o margin-r-5"></i> 网址</strong>
  66. <p class="text-muted">@Model.WebSite</p>
  67. <hr>
  68. <strong><i class="fa fa-file-text-o margin-r-5"></i> 地址</strong>
  69. <p class="text-muted">@Model.Address</p>
  70. <hr>
  71. </div>
  72. <!-- /.box-body -->
  73. </div>
  74. <!-- /.box -->
  75. </div>
  76. <!-- /.col -->
  77. <div class="col-md-9">
  78. <div class="nav-tabs-custom">
  79. <ul class="nav nav-tabs">
  80. <li class="active"><a href="#customerSend" data-toggle="tab" data-id="#customerSend">客户发货地址</a></li>
  81. <li><a href="#invoiceAddress" data-toggle="tab" data-id="#invoiceAddress">客户发票地址</a></li>
  82. <li><a href="#defaultProduct" data-toggle="tab" data-id="#defaultProduct">客户默认产品</a></li>
  83. </ul>
  84. <div class="tab-content">
  85. <div class="active tab-pane" id="customerSend">
  86. <div class="table-box mr-4 iwb-bootstrap-table">
  87. <div class="btn-toolbar row" id="tableTool" role="toolbar" aria-label="Toolbar with button groups">
  88. <div class="col-sm-12 col-lg-12 pull-left" style="padding: 0">
  89. <div class="btn-group btn-group-sm" id="Tool1" role="group" aria-label="First group">
  90. @if (PermissionChecker.IsGranted(PermissionNames.PagesCustomerInfoCustomersCreateSend))
  91. {
  92. <button type="button" class="btn btn-default" data-type="_btnCreate1" data-url="/api/services/app/CustomerSends/Create">
  93. <i class="iconfont icon-add">添加客户发货地址</i>
  94. </button>
  95. }
  96. @if (PermissionChecker.IsGranted(PermissionNames.PagesCustomerInfoCustomersUpdateSend))
  97. {
  98. <button type="button" class="btn btn-default" data-type="btnUpdate1" data-url="/api/services/app/CustomerSends/Update">
  99. <i class="iconfont icon-edit">修改客户发货地址</i>
  100. </button>
  101. }
  102. @if (PermissionChecker.IsGranted(PermissionNames.PagesCustomerInfoCustomersDeleteSend))
  103. {
  104. <button type="button" class="btn btn-default" data-type="btnDelete1" data-url="/api/services/app/CustomerSends/Delete">
  105. <i class="iconfont icon-delete">删除客户发货地址</i>
  106. </button>
  107. }
  108. </div>
  109. </div>
  110. </div>
  111. <table id="table"
  112. data-url="/api/services/app/CustomerSends/GetAll"
  113. data-striped="true" data-id-field="id" data-unique-id="id"
  114. data-method="post"
  115. data-side-pagination="server"
  116. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  117. data-cache="false"
  118. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  119. data-query-params="QueryParam"
  120. data-response-handler="ResponseHandler"
  121. data-click-to-select="true"
  122. data-single-select="true">
  123. <thead>
  124. <tr class="row" id="header">
  125. <th data-field="state" data-checkbox="true"></th>
  126. <th data-align="center" data-field="customerSendName">送货地址名称</th>
  127. <th data-align="center" data-field="linkMan">联系人</th>
  128. <th data-align="center" data-field="telephone">电话</th>
  129. <th data-align="center" data-field="mobile">手机</th>
  130. <th data-align="center" data-field="sendAdress">送货地址</th>
  131. </tr>
  132. </thead>
  133. </table>
  134. </div>
  135. </div>
  136. <div class=" tab-pane" id="invoiceAddress">
  137. @{
  138. var invoiceTable = new TableViewModel("/api/services/app/CustomerInvoiceAddress/GetAll", PermissionNames.PagesCustomerInfoCustomerInvoices, "invoice-table")
  139. .SetFields(new List<FieldItem>()
  140. {
  141. new FieldItem("invoiceAddressName", "发票地址名称"),
  142. new FieldItem("linkMan", "联系人"),
  143. new FieldItem("telephone", "电话"),
  144. new FieldItem("mobile", "手机"),
  145. new FieldItem("invoiceAddress", "发票地址"),
  146. });
  147. }
  148. @Html.Partial("New/Table/_Table", invoiceTable)
  149. </div>
  150. <!-- /.tab-pane -->
  151. <div class="tab-pane" id="defaultProduct">
  152. <!-- The timeline -->
  153. <div class="table-box mr-4 iwb-bootstrap-table">
  154. <div class="btn-toolbar row" id="tableTool" role="toolbar" aria-label="Toolbar with button groups">
  155. <div class="col-sm-8 col-lg-9 pull-left" style="padding: 0">
  156. <div class="btn-group btn-group-sm" id="Tool1" role="group" aria-label="First group">
  157. @if (PermissionChecker.IsGranted(PermissionNames.PagesCustomerInfoCustomersCreateDefaultProduct))
  158. {
  159. <button type="button" class="btn btn-default" data-type="_btnCreate" data-url="/api/services/app/CustomerDefaultProduct/Create" onclick="AddDefaultProduct()">
  160. <i class="iconfont icon-add">添加客户默认产品</i>
  161. </button>
  162. }
  163. @*@if (PermissionChecker.IsGranted(PermissionNames.PagesCustomerInfoCustomersDeleteDefaultProduct))
  164. {
  165. <button type="button" class="btn btn-default" data-type="btnDelete" data-url="/api/services/app/CustomerDefaultProduct/Delete">
  166. <i class="iconfont icon-delete">删除客户默认产品</i>
  167. </button>
  168. }*@
  169. </div>
  170. </div>
  171. <div class="col-sm-4 col-lg-3 pull-right" style="padding: 0">
  172. @Html.Partial("_SearchForm", searchForm)
  173. </div>
  174. </div>
  175. <table id="tableDefaultProduct"
  176. data-url="/api/services/app/CustomerDefaultProduct/GetAll"
  177. data-striped="true" data-id-field="id" data-unique-id="id"
  178. data-method="post"
  179. data-side-pagination="server"
  180. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  181. data-cache="false"
  182. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  183. data-query-params="QueryParams"
  184. data-response-handler="ResponseHandler"
  185. data-click-to-select="true"
  186. data-single-select="true">
  187. <thead>
  188. <tr class="row">
  189. <th data-field="state" data-checkbox="true"></th>
  190. <th data-align="center" data-field="productNo">产品编号</th>
  191. <th data-align="center" data-field="productName">产品名称</th>
  192. <th data-align="center" data-field="partNo">零件号</th>
  193. <th data-align="center" data-field="model">规格</th>
  194. <th data-align="center" data-field="material">材质</th>
  195. <th data-align="center" data-field="surfaceColor">表色</th>
  196. <th data-align="center" data-field="rigidity">硬度</th>
  197. <th data-align="center" data-field="customerProductName">客户定义名称</th>
  198. <th data-align="center" data-field="productHsCode">产品海关编号</th>
  199. <th data-align="center" data-field="sequence">序号</th>
  200. <th data-align="center" data-formatter="ActionsFormatter"></th>
  201. </tr>
  202. </thead>
  203. </table>
  204. </div>
  205. </div>
  206. <!-- /.tab-pane -->
  207. <!-- /.tab-pane -->
  208. </div>
  209. <!-- /.tab-content -->
  210. </div>
  211. <!-- /.nav-tabs-custom -->
  212. </div>
  213. <!-- /.col -->
  214. </div>
  215. <!-- /.row -->
  216. </section>
  217. <!-- /.content -->
  218. @section modal{
  219. <section>
  220. <!--Main Modal-->
  221. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  222. <div class="modal-dialog modal-dialog-centered" role="document">
  223. <div class="modal-content">
  224. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("送货信息"))
  225. @{
  226. var inputs = new List<InputViewModel>
  227. {
  228. new InputViewModel("id", hide:true),
  229. new InputViewModel("customerId", hide:true),
  230. new InputViewModel("customerSendName", displayName: "送货地址名称"),
  231. new InputViewModel("telephone", displayName: "电话"),
  232. new InputViewModel("fax", displayName: "传真").SetNotRequired(),
  233. new InputViewModel("zip", displayName: "邮编").SetNotRequired(),
  234. new InputViewModel("email", displayName: "Email").SetNotRequired(),
  235. new InputViewModel("linkMan", displayName: "联系人"),
  236. new InputViewModel("mobile", displayName: "移动电话").SetNotRequired(),
  237. new InputViewModel("sendAdress", displayName: "送货地址"),
  238. };
  239. }
  240. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  241. @Html.Partial("Modals/_ModalFooter", "0")
  242. </div>
  243. </div>
  244. </div>
  245. <!--Main Modal-->
  246. <div class="modal fade" id="modalInvoice" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  247. <div class="modal-dialog modal-dialog-centered" role="document">
  248. <div class="modal-content">
  249. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("发票信息"))
  250. @{
  251. var invoiceInputs = new List<InputViewModel>
  252. {
  253. new InputViewModel("id", hide:true),
  254. new InputViewModel("customerId", hide:true),
  255. new InputViewModel("invoiceAddressName", displayName: "发票地址名称"),
  256. new InputViewModel("telephone", displayName: "电话"),
  257. new InputViewModel("fax", displayName: "传真").SetNotRequired(),
  258. new InputViewModel("zip", displayName: "邮编").SetNotRequired(),
  259. new InputViewModel("email", displayName: "Email").SetNotRequired(),
  260. new InputViewModel("linkMan", displayName: "联系人"),
  261. new InputViewModel("mobile", displayName: "移动电话").SetNotRequired(),
  262. new InputViewModel("invoiceAddress", displayName: "发票地址"),
  263. };
  264. }
  265. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(invoiceInputs))
  266. @Html.Partial("Modals/_ModalFooter", "0")
  267. </div>
  268. </div>
  269. </div>
  270. <div class="modal fade" id="modalProduct" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  271. <div class="modal-dialog modal-dialog-centered" role="document">
  272. <div class="modal-content" style="width: 800px;">
  273. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("产品信息"))
  274. <div class="modal-body container-fluid" style="padding: 0; padding-top: 15px;">
  275. <form class="pr-3 pl-3 form-horizontal">
  276. <div class="form-group-sm">
  277. <label class="iwb-label col-md-1 control-label" for="ProductNo">产品编码</label>
  278. <div class="col-md-4">
  279. <input class="form-control" id="ProductNo" name="ProductNo" placeholder="请输入..." value="" style="" type="text"></input>
  280. </div>
  281. <label class="iwb-label col-md-1 control-label" for="ProductName">产品名称</label>
  282. <div class="col-md-4">
  283. <input class="form-control" id="ProductName" name="ProductName" placeholder="请输入..." value="" style="" type="text"></input>
  284. </div>
  285. <div class="col-md-2">
  286. <button type="button" class="btn btn-default" onclick="SearchProducts()">
  287. <i class="iconfont icon-search">查询</i>
  288. </button>
  289. </div>
  290. </div>
  291. </form>
  292. </div>
  293. <div class="table-box mr-4 iwb-bootstrap-table">
  294. <table id="tableQueryProduct"
  295. data-url="/api/services/app/Query/GetQueryCustomerDefaultProduct"
  296. data-striped="true" data-id-field="id" data-unique-id="id"
  297. data-method="post"
  298. data-side-pagination="server"
  299. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  300. data-cache="false"
  301. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  302. data-response-handler="ResponseHandler"
  303. data-click-to-select="true"
  304. data-single-select="false">
  305. <thead>
  306. <tr class="row">
  307. <th data-field="state" data-checkbox="true"></th>
  308. <th data-align="center" data-field="id">产品编号</th>
  309. <th data-align="center" data-field="productName">产品名称</th>
  310. </tr>
  311. </thead>
  312. </table>
  313. </div>
  314. <div class="modal-footer" style="text-align: center;">
  315. <button type="button" class="btn btn-default waves-effect" data-dismiss="modalProduct" style="min-width:100px;background: #FFFFFF;border: 1px solid #DDDDDD;" onclick="$('#modalProduct').modal('hide');">取消</button>
  316. <button type="button" class="btn btn-success save-btn waves-effect" style="min-width:100px;background-color: #678ceb;border: 1px solid #678ceb;" onclick="f_submit()">确定</button>
  317. </div>
  318. </div>
  319. </div>
  320. </div>
  321. <div class="modal fade" id="modalSetDefaultName" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  322. <div class="modal-dialog modal-dialog-centered" role="document">
  323. <div class="modal-content">
  324. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("设置客户命名及零件号"))
  325. @{
  326. var inputSetDefaultName = new List<InputViewModel>
  327. {
  328. new InputViewModel("id", hide:true),
  329. new InputViewModel("customerId", hide:true),
  330. new InputViewModel("productNo", hide:true),
  331. new InputViewModel("partNo", displayName: "产品零件号").SetNotRequired(),
  332. new InputViewModel("customerProductName", displayName: "客户产品命名").SetNotRequired(),
  333. new InputViewModel("productHsCode", displayName: "产品海关编号").SetNotRequired(),
  334. new InputViewModel("sequence", displayName: "排序")
  335. };
  336. }
  337. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputSetDefaultName, "setDefaultName"))
  338. @Html.Partial("Modals/_ModalFooter", "0")
  339. </div>
  340. </div>
  341. </div>
  342. </section>
  343. }
  344. @section scripts
  345. {
  346. <script type="text/javascript">
  347. var $invoiceTable = $("#invoice-table");
  348. var $currentTab = '#customerSend';
  349. $(function() {
  350. //show完毕前执行
  351. LoadTable();
  352. var funs = window.funs || { none: function() { console.log("No type"); } };
  353. funs["btnUpdate1"] = function(url) { BtnUpdate({ url: url, readonly: "" }); };
  354. funs["btnCreate1"] = function(url) {
  355. BtnCreate({ url: url, data: { customerId: "@Model.Id" } });
  356. }
  357. funs["btnDelete1"] = function(url) {
  358. BtnDelete(url);
  359. };
  360. LoadTable({ table: $("#invoice-table") });
  361. LoadTable({
  362. table: $("#tableDefaultProduct"),
  363. onAll: function(e, r) {},
  364. onLoadSuccess: function(d) { OnLoadSuccess(d, $invoiceTable) },
  365. onPostBody: function(d) { OnPostBody(d, $invoiceTable) },
  366. });
  367. LoadTableQueryProduct();
  368. var funs2 = window.funs || { none: function() { console.log("No type"); } };
  369. $invoiceTable.closest('.table-box').find('.btn-toolbar .btn').on('click',
  370. function() {
  371. var type = $(this).data('type').replace("a_", "").replace("_", "");
  372. var url = $(this).data('url') || "";
  373. funs2[type] ? funs2[type].call(this, url) : funs2["none"].call(this);
  374. });
  375. funs2["btnUpdate"] = function(url) {
  376. BtnUpdate({ url: url, table: $invoiceTable, readonly: "", modal: $('#modalInvoice') });
  377. };
  378. funs2["btnCreate"] = function(url) {
  379. BtnCreate({ url: url, table: $invoiceTable, modal: $('#modalInvoice'), data: { customerId: "@Model.Id" }
  380. });
  381. };
  382. funs2["btnDelete"] = function(url) {
  383. BtnDelete(url, $invoiceTable);
  384. };
  385. $('a[data-toggle="tab"]').on('click',
  386. function(e) {
  387. $currentTab = $(e.target).data('id');
  388. });
  389. });
  390. function GetSearchList() {
  391. window._searchList = [];
  392. window._searchList.push({ KeyWords: "@Model.Id", KeyField: "CustomerId", FieldType: "0", ExpType: "6" });
  393. if ($currentTab == '#defaultProduct') {
  394. var count = $("#SearchForm").find(".KeyWords").length;
  395. for (var i = 1; i <= count; i++) {
  396. var keyWords = $("#KeyWords-" + i).val();
  397. if (keyWords) {
  398. var keyField = $("#KeyField-" + i).val();
  399. var fieldType = $("#FieldType-" + i).val();
  400. var expType = $("#ExpType-" + i).val();
  401. window._searchList.push({
  402. KeyWords: keyWords,
  403. KeyField: keyField,
  404. FieldType: fieldType,
  405. ExpType: expType
  406. });
  407. }
  408. }
  409. }
  410. }
  411. function BtnSearch(isCheck) {
  412. clearTimeout(t);
  413. if (_isSearching) {
  414. return;
  415. }
  416. _isSearching = true;
  417. GetSearchList();
  418. if (!isCheck && _searchList.length <= 0) {
  419. console.log("Search-Multi-None");
  420. return;
  421. }
  422. var isValidated = FormValidate({ form: $("#SearchForm") });
  423. if (isValidated) {
  424. RefreshTable("tableDefaultProduct");
  425. console.log("Search");
  426. } else {
  427. console.log("Search_Validate_Faild");
  428. }
  429. }
  430. var isCanUpdateDefaultProduct = "@isCanUpdateDefaultProduct";
  431. var isCanDeleteDefaultProduct = "@isCanDeleteDefaultProduct";
  432. function ActionsFormatter(v, r) {
  433. var str = '';
  434. if (isCanUpdateDefaultProduct === "True") {
  435. str += '<span class="table-action" onclick="SetCustomerDefaultName(\'' +
  436. r.id +
  437. '\',\'' +
  438. r.customerId +
  439. '\',\'' +
  440. r.customerProductName +
  441. '\',\'' +
  442. r.sequence +
  443. '\',\'' +
  444. r.partNo +
  445. '\',\'' +
  446. r.productNo +
  447. '\',\'' +
  448. r.productHsCode +
  449. '\')"><i class="iconfont icon-edit"></i>设置客户命名及零件号</span>';
  450. }
  451. if (isCanDeleteDefaultProduct === "True") {
  452. str += '<span class="table-action" onclick="DeleteDefaultProduct(\'' +
  453. r.id +
  454. '\')"><i class="iconfont icon-delete"></i>删除</span>';
  455. }
  456. return str;
  457. }
  458. function SetCustomerDefaultName(id, customerId, customerProductName, sequence, partNo, productNo,productHsCode) {
  459. OpenModal("/api/services/app/CustomerDefaultProduct/Update",
  460. {
  461. modal: $('#modalSetDefaultName'),
  462. modaltitle: "",
  463. data: {
  464. id: id,
  465. customerId: customerId,
  466. customerProductName: customerProductName == "null" ? "" : customerProductName,
  467. sequence: sequence,
  468. partNo: partNo == "null" ? "" : partNo,
  469. productNo: productNo,
  470. productHsCode: productHsCode == "null" ? "" : productHsCode
  471. }, success: function(res) {
  472. $('#modalSetDefaultName').modal("hide");
  473. $('#tableDefaultProduct').bootstrapTable("refresh", { silent: true });
  474. }
  475. });
  476. /*var rows = config.table.bootstrapTable("getSelections");
  477. if (rows.length === 1) {
  478. if (rows[0].userName) {
  479. abp.message.warn("该联系人已绑定账号,请解绑后再操作!");
  480. return;
  481. }
  482. abp.ajax({
  483. url: window.appUrl + 'CustomerContact/GetAccountSelectStr',
  484. type: 'POST',
  485. dataType: "json",
  486. success: function (res) {
  487. console.log(res);
  488. if (res) {
  489. $("#userName").html(res).select2();
  490. }
  491. OpenModal(url, { modal: $('#bind-modal'), modaltitle: "", data: { contactNo: rows[0].contactNo } });
  492. }
  493. });
  494. } else
  495. abp.message.warn(abp.localization.localize("ChooseOneToOp"));*/
  496. }
  497. function AddDefaultProduct() {
  498. $("#ProductNo").val("");
  499. $("#ProductName").val("");
  500. SearchProducts();
  501. $("#modalProduct").modal("show");
  502. }
  503. function f_submit() {
  504. var rows = $("#tableQueryProduct").bootstrapTable("getSelections");
  505. if (rows.length >= 1) {
  506. /*if (rows[0].userName) {
  507. abp.message.warn("该联系人已绑定账号,请解绑后再操作!");
  508. return;
  509. }*/
  510. var products = '';
  511. for (var i = 0; i < rows.length; i++) {
  512. products += rows[i].id + ",";
  513. }
  514. abp.ajax({
  515. url: window.appUrl + 'CustomerDefaultProduct/Create',
  516. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  517. data: { ProductNo: products, CustomerId: "@Model.Id" },
  518. type: 'POST',
  519. dataType: "json",
  520. isValidate: false,
  521. success: function(res) {
  522. console.log(res);
  523. abp.message.success(abp.localization.localize("OpSuccess"));
  524. $("#modalProduct").modal("hide");
  525. RefreshDefaultProductTable($("#tableDefaultProduct"));
  526. }
  527. });
  528. } else
  529. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  530. }
  531. function DeleteDefaultProduct() {
  532. abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"),
  533. abp.localization.localize("DeleteConfirmTitle"),
  534. function() {
  535. var rows = $("#tableDefaultProduct").bootstrapTable("getSelections");
  536. if (rows.length !== 1) {
  537. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  538. return;
  539. }
  540. SaveAjax({
  541. url: window.appUrl + 'CustomerDefaultProduct/Delete',
  542. data: { Id: rows[0].id },
  543. isValidate: false,
  544. success: function() {
  545. RefreshDefaultProductTable($("#tableDefaultProduct"));
  546. }
  547. });
  548. });
  549. }
  550. function SearchProducts() {
  551. GetProductSearchList();
  552. RefreshDefaultProductTable($("#tableQueryProduct"));
  553. }
  554. function LoadTableQueryProduct() {
  555. GetProductSearchList();
  556. $("#tableQueryProduct").bootstrapTable({
  557. queryParams: function(params) {
  558. return {
  559. //limit: params.limit, //页面大小
  560. //page: (params.offset / params.limit) + 1, //页码
  561. MaxResultCount: params.limit,
  562. SkipCount: params.offset,
  563. sort: params.sort, //排序列名
  564. sortOrder: params.order, //排位命令(desc,asc)
  565. SearchList: _searchProductList
  566. };
  567. },
  568. onLoadSuccess: OnLoadSuccess,
  569. onPostBody: OnPostBody
  570. });
  571. }
  572. var _searchProductList = [];
  573. function GetProductSearchList() {
  574. _searchProductList = [];
  575. _searchProductList.push({ KeyWords: "@Model.Id", KeyField: "CustomerId", FieldType: "0", ExpType: "6" });
  576. var productNo = $("#ProductNo").val();
  577. var productName = $("#ProductName").val();
  578. if (productNo) {
  579. _searchProductList.push({ KeyWords: productNo, KeyField: "Id", FieldType: "0", ExpType: "6" });
  580. }
  581. if (productName) {
  582. _searchProductList.push(
  583. { KeyWords: productName, KeyField: "ProductName", FieldType: "0", ExpType: "6" });
  584. }
  585. }
  586. function RefreshDefaultProductTable($this) {
  587. //parms = parms || RefreshQueryParams();
  588. //$("#table").bootstrapTable("refreshOptions", parms);
  589. //config.table.bootstrapTable("refreshOptions", {});
  590. abp.ui.setBusy();
  591. $this.bootstrapTable("refresh", { silent: true });
  592. setTimeout(function() { abp.ui.clearBusy(); }, 8 * 1000);
  593. }
  594. </script>
  595. }