ProductProperty.cshtml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. @using ShwasherSys.Authorization.Permissions
  2. @using ShwasherSys.Models.Layout
  3. @using ShwasherSys.Models.Modal
  4. @using ShwasherSys.Views.Shared.New.Modals
  5. @using InputTypes = ShwasherSys.Models.Modal.InputTypes
  6. @using ModalBodyViewModel = ShwasherSys.Models.Modal.ModalBodyViewModel
  7. @using ModalHeaderViewModel = ShwasherSys.Models.Modal.ModalHeaderViewModel
  8. @using Input = ShwasherSys.Views.Shared.New.Modals.Input
  9. @{
  10. /**/
  11. ViewBag.ActiveMenu = PermissionNames.PagesProductInfoProductProperty; //The menu item will be active for this page.
  12. ViewBag.Title = "产品属性管理";
  13. List<SelectListItem> productPropertyTypeList = ViewBag.ProductPropertyType;
  14. // List<SelectListItem> classification = ViewBag.Classification;
  15. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  16. {
  17. new SearchItem("propertyNo","编码"),
  18. new SearchItem("propertyValue","属性值"),
  19. new SearchItem("propertyType","属性类别").SetSearchItem(productPropertyTypeList),
  20. new SearchItem("displayValue","显示值"),
  21. }, false);
  22. }
  23. <div class="table-box mr-4 iwb-bootstrap-table">
  24. <input type="hidden" id="IsLock" value="N" />
  25. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  26. <table id="table"
  27. data-url="/api/services/app/ProductProperty/GetAll"
  28. data-striped="true" data-id-field="id" data-unique-id="id"
  29. data-method="post"
  30. data-side-pagination="server"
  31. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  32. data-cache="false"
  33. 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"
  34. data-query-params="QueryParams"
  35. data-response-handler="ResponseHandler"
  36. data-click-to-select="true"
  37. data-single-select="true">
  38. <thead>
  39. <tr class="row" id="header">
  40. <th data-field="state" data-checkbox="true"></th>
  41. <th data-align="center" data-field="propertyType" data-formatter="PropertyTypeFormatter">属性类别</th>
  42. <th data-align="center" data-field="propertyNo">编码</th>
  43. <th data-align="center" data-field="propertyValue">属性值</th>
  44. <th data-align="center" data-field="displayValue">显示值</th>
  45. <th data-align="center" data-field="contentInfo">内容描述</th>
  46. </tr>
  47. </thead>
  48. </table>
  49. </div>
  50. @section modal{
  51. <section>
  52. <!--Main Modal-->
  53. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  54. <div class="modal-dialog modal-dialog-centered" role="document">
  55. <div class="modal-content">
  56. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("产品标准"))
  57. @{
  58. var inputs = new List<InputViewModel>
  59. {
  60. new InputViewModel("id", hide: true),
  61. new InputViewModel("propertyNo", hide: true),
  62. new InputViewModel("propertyType",InputTypes.List, displayName: "属性类别").SetSelectOptions(productPropertyTypeList),
  63. new InputViewModel("propertyValue", displayName: "属性值"),
  64. new InputViewModel("displayValue", displayName: "显示值").SetNotRequired(),
  65. new InputViewModel("contentInfo",InputTypes.Textarea, "内容描述").SetNotRequired(),
  66. };
  67. //var specials = new List<SpecialInputModel>();
  68. }
  69. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  70. @Html.Partial("Modals/_ModalFooter", "0")
  71. </div>
  72. </div>
  73. </div>
  74. @{
  75. var uploadModal = new ModalViewModel("产品属性导入", "", new ShwasherSys.Views.Shared.New.Modals.ModalBodyViewModel(
  76. new List<Input>(){
  77. new InputFile("uploadExcel","上传文件").SetFileOption("FileInfo","FileName","FileExt")
  78. }, "upload-form"), "upload-modal");
  79. }
  80. @Html.Partial("New/Modals/_Modal",uploadModal)
  81. </section>
  82. }
  83. @section scripts
  84. {
  85. <script type="text/javascript">
  86. $(function () {
  87. //show完毕前执行
  88. LoadTable();
  89. var funs = window.funs || { none: function () { console.log("No type"); } };
  90. funs["btnUpdate"] = function () { BtnUpdate({ readonly: "propertyType", disabled:"propertyType" }); };
  91. funs["btnImport"] = function (url) {
  92. OpenModal(url, {
  93. modal: $("#upload-modal"), modaltitle: "产品属性导入", save: function () {
  94. $.iwbAjax1({
  95. url: url,
  96. modal: "upload-modal",
  97. form: "upload-form",
  98. success: function () {
  99. RefreshTable();
  100. }
  101. });
  102. }
  103. });
  104. }
  105. });
  106. function PropertyTypeFormatter(v) {
  107. var name = $('#hid-propertyType option[value="' + v + '"]').text();
  108. if (v) {
  109. return '<span class="label label-info">' + name + '</span>';
  110. } else {
  111. return '<span class="label label-warning">暂无</span>';
  112. }
  113. }
  114. </script>
  115. }
  116. <section style="display: none">
  117. <select id="hid-type">
  118. <option value=""></option>
  119. </select>
  120. @Html.DropDownList("hid-propertyType", productPropertyTypeList)
  121. </section>