CustomerDetail.cshtml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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="customerProductName">客户定义名称</th>
  194. <th data-align="center" data-field="sequence">序号</th>
  195. <th data-align="center" data-formatter="ActionsFormatter"></th>
  196. </tr>
  197. </thead>
  198. </table>
  199. </div>
  200. </div>
  201. <!-- /.tab-pane -->
  202. <!-- /.tab-pane -->
  203. </div>
  204. <!-- /.tab-content -->
  205. </div>
  206. <!-- /.nav-tabs-custom -->
  207. </div>
  208. <!-- /.col -->
  209. </div>
  210. <!-- /.row -->
  211. </section>
  212. <!-- /.content -->
  213. @section modal{
  214. <section>
  215. <!--Main Modal-->
  216. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  217. <div class="modal-dialog modal-dialog-centered" role="document">
  218. <div class="modal-content">
  219. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("送货信息"))
  220. @{
  221. var inputs = new List<InputViewModel>
  222. {
  223. new InputViewModel("id", hide:true),
  224. new InputViewModel("customerId", hide:true),
  225. new InputViewModel("customerSendName", displayName: "送货地址名称"),
  226. new InputViewModel("telephone", displayName: "电话"),
  227. new InputViewModel("fax", displayName: "传真").SetNotRequired(),
  228. new InputViewModel("zip", displayName: "邮编").SetNotRequired(),
  229. new InputViewModel("email", displayName: "Email").SetNotRequired(),
  230. new InputViewModel("linkMan", displayName: "联系人"),
  231. new InputViewModel("mobile", displayName: "移动电话").SetNotRequired(),
  232. new InputViewModel("sendAdress", displayName: "送货地址"),
  233. };
  234. }
  235. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  236. @Html.Partial("Modals/_ModalFooter", "0")
  237. </div>
  238. </div>
  239. </div>
  240. <!--Main Modal-->
  241. <div class="modal fade" id="modalInvoice" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  242. <div class="modal-dialog modal-dialog-centered" role="document">
  243. <div class="modal-content">
  244. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("发票信息"))
  245. @{
  246. var invoiceInputs = new List<InputViewModel>
  247. {
  248. new InputViewModel("id", hide:true),
  249. new InputViewModel("customerId", hide:true),
  250. new InputViewModel("invoiceAddressName", displayName: "发票地址名称"),
  251. new InputViewModel("telephone", displayName: "电话"),
  252. new InputViewModel("fax", displayName: "传真").SetNotRequired(),
  253. new InputViewModel("zip", displayName: "邮编").SetNotRequired(),
  254. new InputViewModel("email", displayName: "Email").SetNotRequired(),
  255. new InputViewModel("linkMan", displayName: "联系人"),
  256. new InputViewModel("mobile", displayName: "移动电话").SetNotRequired(),
  257. new InputViewModel("invoiceAddress", displayName: "发票地址"),
  258. };
  259. }
  260. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(invoiceInputs))
  261. @Html.Partial("Modals/_ModalFooter", "0")
  262. </div>
  263. </div>
  264. </div>
  265. <div class="modal fade" id="modalProduct" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  266. <div class="modal-dialog modal-dialog-centered" role="document">
  267. <div class="modal-content" style="width: 800px;">
  268. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("产品信息"))
  269. <div class="modal-body container-fluid" style="padding: 0; padding-top: 15px;">
  270. <form class="pr-3 pl-3 form-horizontal">
  271. <div class="form-group-sm">
  272. <label class="iwb-label col-md-1 control-label" for="ProductNo">产品编码</label>
  273. <div class="col-md-4">
  274. <input class="form-control" id="ProductNo" name="ProductNo" placeholder="请输入..." value="" style="" type="text"></input>
  275. </div>
  276. <label class="iwb-label col-md-1 control-label" for="ProductName">产品名称</label>
  277. <div class="col-md-4">
  278. <input class="form-control" id="ProductName" name="ProductName" placeholder="请输入..." value="" style="" type="text"></input>
  279. </div>
  280. <div class="col-md-2">
  281. <button type="button" class="btn btn-default" onclick="SearchProducts()">
  282. <i class="iconfont icon-search">查询</i>
  283. </button>
  284. </div>
  285. </div>
  286. </form>
  287. </div>
  288. <div class="table-box mr-4 iwb-bootstrap-table">
  289. <table id="tableQueryProduct"
  290. data-url="/api/services/app/Query/GetQueryCustomerDefaultProduct"
  291. data-striped="true" data-id-field="id" data-unique-id="id"
  292. data-method="post"
  293. data-side-pagination="server"
  294. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  295. data-cache="false"
  296. 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"
  297. data-response-handler="ResponseHandler"
  298. data-click-to-select="true"
  299. data-single-select="false">
  300. <thead>
  301. <tr class="row">
  302. <th data-field="state" data-checkbox="true"></th>
  303. <th data-align="center" data-field="id">产品编号</th>
  304. <th data-align="center" data-field="productName">产品名称</th>
  305. </tr>
  306. </thead>
  307. </table>
  308. </div>
  309. <div class="modal-footer" style="text-align: center;">
  310. <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>
  311. <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>
  312. </div>
  313. </div>
  314. </div>
  315. </div>
  316. <div class="modal fade" id="modalSetDefaultName" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  317. <div class="modal-dialog modal-dialog-centered" role="document">
  318. <div class="modal-content">
  319. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("设置客户命名及零件号"))
  320. @{
  321. var inputSetDefaultName = new List<InputViewModel>
  322. {
  323. new InputViewModel("id", hide:true),
  324. new InputViewModel("customerId", hide:true),
  325. new InputViewModel("productNo", hide:true),
  326. new InputViewModel("partNo", displayName: "产品零件号").SetNotRequired(),
  327. new InputViewModel("customerProductName", displayName: "客户产品命名").SetNotRequired(),
  328. new InputViewModel("sequence", displayName: "排序")
  329. };
  330. }
  331. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputSetDefaultName, "setDefaultName"))
  332. @Html.Partial("Modals/_ModalFooter", "0")
  333. </div>
  334. </div>
  335. </div>
  336. </section>
  337. }
  338. @section scripts
  339. {
  340. <script type="text/javascript">
  341. var $invoiceTable = $("#invoice-table");
  342. var $currentTab = '#customerSend';
  343. $(function() {
  344. //show完毕前执行
  345. LoadTable();
  346. var funs = window.funs || { none: function() { console.log("No type"); } };
  347. funs["btnUpdate1"] = function(url) { BtnUpdate({ url: url, readonly: "" }); };
  348. funs["btnCreate1"] = function(url) {
  349. BtnCreate({ url: url, data: { customerId: "@Model.Id" } });
  350. }
  351. funs["btnDelete1"] = function(url) {
  352. BtnDelete(url);
  353. };
  354. LoadTable({ table: $("#invoice-table") });
  355. LoadTable({
  356. table: $("#tableDefaultProduct"),
  357. onAll: function(e, r) {},
  358. onLoadSuccess: function(d) { OnLoadSuccess(d, $invoiceTable) },
  359. onPostBody: function(d) { OnPostBody(d, $invoiceTable) },
  360. });
  361. LoadTableQueryProduct();
  362. var funs2 = window.funs || { none: function() { console.log("No type"); } };
  363. $invoiceTable.closest('.table-box').find('.btn-toolbar .btn').on('click',
  364. function() {
  365. var type = $(this).data('type').replace("a_", "").replace("_", "");
  366. var url = $(this).data('url') || "";
  367. funs2[type] ? funs2[type].call(this, url) : funs2["none"].call(this);
  368. });
  369. funs2["btnUpdate"] = function(url) {
  370. BtnUpdate({ url: url, table: $invoiceTable, readonly: "", modal: $('#modalInvoice') });
  371. };
  372. funs2["btnCreate"] = function(url) {
  373. BtnCreate({ url: url, table: $invoiceTable, modal: $('#modalInvoice'), data: { customerId: "@Model.Id" }
  374. });
  375. };
  376. funs2["btnDelete"] = function(url) {
  377. BtnDelete(url, $invoiceTable);
  378. };
  379. $('a[data-toggle="tab"]').on('click',
  380. function(e) {
  381. $currentTab = $(e.target).data('id');
  382. });
  383. });
  384. function GetSearchList() {
  385. window._searchList = [];
  386. window._searchList.push({ KeyWords: "@Model.Id", KeyField: "CustomerId", FieldType: "0", ExpType: "6" });
  387. if ($currentTab == '#defaultProduct') {
  388. var count = $("#SearchForm").find(".KeyWords").length;
  389. for (var i = 1; i <= count; i++) {
  390. var keyWords = $("#KeyWords-" + i).val();
  391. if (keyWords) {
  392. var keyField = $("#KeyField-" + i).val();
  393. var fieldType = $("#FieldType-" + i).val();
  394. var expType = $("#ExpType-" + i).val();
  395. window._searchList.push({
  396. KeyWords: keyWords,
  397. KeyField: keyField,
  398. FieldType: fieldType,
  399. ExpType: expType
  400. });
  401. }
  402. }
  403. }
  404. }
  405. function BtnSearch(isCheck) {
  406. clearTimeout(t);
  407. if (_isSearching) {
  408. return;
  409. }
  410. _isSearching = true;
  411. GetSearchList();
  412. if (!isCheck && _searchList.length <= 0) {
  413. console.log("Search-Multi-None");
  414. return;
  415. }
  416. var isValidated = FormValidate({ form: $("#SearchForm") });
  417. if (isValidated) {
  418. RefreshTable("tableDefaultProduct");
  419. console.log("Search");
  420. } else {
  421. console.log("Search_Validate_Faild");
  422. }
  423. }
  424. var isCanUpdateDefaultProduct = "@isCanUpdateDefaultProduct";
  425. var isCanDeleteDefaultProduct = "@isCanDeleteDefaultProduct";
  426. function ActionsFormatter(v, r) {
  427. var str = '';
  428. if (isCanUpdateDefaultProduct === "True") {
  429. str += '<span class="table-action" onclick="SetCustomerDefaultName(\'' +
  430. r.id +
  431. '\',\'' +
  432. r.customerId +
  433. '\',\'' +
  434. r.customerProductName +
  435. '\',\'' +
  436. r.sequence +
  437. '\',\'' +
  438. r.partNo +
  439. '\',\'' +
  440. r.productNo +
  441. '\')"><i class="iconfont icon-edit"></i>设置客户命名及零件号</span>';
  442. }
  443. if (isCanDeleteDefaultProduct === "True") {
  444. str += '<span class="table-action" onclick="DeleteDefaultProduct(\'' +
  445. r.id +
  446. '\')"><i class="iconfont icon-delete"></i>删除</span>';
  447. }
  448. return str;
  449. }
  450. function SetCustomerDefaultName(id, customerId, customerProductName, sequence, partNo, productNo) {
  451. OpenModal("/api/services/app/CustomerDefaultProduct/Update",
  452. {
  453. modal: $('#modalSetDefaultName'),
  454. modaltitle: "",
  455. data: {
  456. id: id,
  457. customerId: customerId,
  458. customerProductName: customerProductName == "null" ? "" : customerProductName,
  459. sequence: sequence,
  460. partNo: partNo == "null" ? "" : partNo,
  461. productNo: productNo
  462. }, success: function(res) {
  463. $('#modalSetDefaultName').modal("hide");
  464. $('#tableDefaultProduct').bootstrapTable("refresh", { silent: true });
  465. }
  466. });
  467. /*var rows = config.table.bootstrapTable("getSelections");
  468. if (rows.length === 1) {
  469. if (rows[0].userName) {
  470. abp.message.warn("该联系人已绑定账号,请解绑后再操作!");
  471. return;
  472. }
  473. abp.ajax({
  474. url: window.appUrl + 'CustomerContact/GetAccountSelectStr',
  475. type: 'POST',
  476. dataType: "json",
  477. success: function (res) {
  478. console.log(res);
  479. if (res) {
  480. $("#userName").html(res).select2();
  481. }
  482. OpenModal(url, { modal: $('#bind-modal'), modaltitle: "", data: { contactNo: rows[0].contactNo } });
  483. }
  484. });
  485. } else
  486. abp.message.warn(abp.localization.localize("ChooseOneToOp"));*/
  487. }
  488. function AddDefaultProduct() {
  489. $("#ProductNo").val("");
  490. $("#ProductName").val("");
  491. SearchProducts();
  492. $("#modalProduct").modal("show");
  493. }
  494. function f_submit() {
  495. var rows = $("#tableQueryProduct").bootstrapTable("getSelections");
  496. if (rows.length >= 1) {
  497. /*if (rows[0].userName) {
  498. abp.message.warn("该联系人已绑定账号,请解绑后再操作!");
  499. return;
  500. }*/
  501. var products = '';
  502. for (var i = 0; i < rows.length; i++) {
  503. products += rows[i].id + ",";
  504. }
  505. abp.ajax({
  506. url: window.appUrl + 'CustomerDefaultProduct/Create',
  507. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  508. data: { ProductNo: products, CustomerId: "@Model.Id" },
  509. type: 'POST',
  510. dataType: "json",
  511. isValidate: false,
  512. success: function(res) {
  513. console.log(res);
  514. abp.message.success(abp.localization.localize("OpSuccess"));
  515. $("#modalProduct").modal("hide");
  516. RefreshDefaultProductTable($("#tableDefaultProduct"));
  517. }
  518. });
  519. } else
  520. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  521. }
  522. function DeleteDefaultProduct() {
  523. abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"),
  524. abp.localization.localize("DeleteConfirmTitle"),
  525. function() {
  526. var rows = $("#tableDefaultProduct").bootstrapTable("getSelections");
  527. if (rows.length !== 1) {
  528. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  529. return;
  530. }
  531. SaveAjax({
  532. url: window.appUrl + 'CustomerDefaultProduct/Delete',
  533. data: { Id: rows[0].id },
  534. isValidate: false,
  535. success: function() {
  536. RefreshDefaultProductTable($("#tableDefaultProduct"));
  537. }
  538. });
  539. });
  540. }
  541. function SearchProducts() {
  542. GetProductSearchList();
  543. RefreshDefaultProductTable($("#tableQueryProduct"));
  544. }
  545. function LoadTableQueryProduct() {
  546. GetProductSearchList();
  547. $("#tableQueryProduct").bootstrapTable({
  548. queryParams: function(params) {
  549. return {
  550. //limit: params.limit, //页面大小
  551. //page: (params.offset / params.limit) + 1, //页码
  552. MaxResultCount: params.limit,
  553. SkipCount: params.offset,
  554. sort: params.sort, //排序列名
  555. sortOrder: params.order, //排位命令(desc,asc)
  556. SearchList: _searchProductList
  557. };
  558. },
  559. onLoadSuccess: OnLoadSuccess,
  560. onPostBody: OnPostBody
  561. });
  562. }
  563. var _searchProductList = [];
  564. function GetProductSearchList() {
  565. _searchProductList = [];
  566. _searchProductList.push({ KeyWords: "@Model.Id", KeyField: "CustomerId", FieldType: "0", ExpType: "6" });
  567. var productNo = $("#ProductNo").val();
  568. var productName = $("#ProductName").val();
  569. if (productNo) {
  570. _searchProductList.push({ KeyWords: productNo, KeyField: "Id", FieldType: "0", ExpType: "6" });
  571. }
  572. if (productName) {
  573. _searchProductList.push(
  574. { KeyWords: productName, KeyField: "ProductName", FieldType: "0", ExpType: "6" });
  575. }
  576. }
  577. function RefreshDefaultProductTable($this) {
  578. //parms = parms || RefreshQueryParams();
  579. //$("#table").bootstrapTable("refreshOptions", parms);
  580. //config.table.bootstrapTable("refreshOptions", {});
  581. abp.ui.setBusy();
  582. $this.bootstrapTable("refresh", { silent: true });
  583. setTimeout(function() { abp.ui.clearBusy(); }, 8 * 1000);
  584. }
  585. </script>
  586. }