CustomerDetail.cshtml 33 KB

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