ProductProperty.cshtml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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="hsCode" data-formatter="HsCodeFormatter">海关编码</th>
  46. <th data-align="center" data-field="contentInfo">内容描述</th>
  47. </tr>
  48. </thead>
  49. </table>
  50. </div>
  51. @section modal{
  52. <section>
  53. <!--Main Modal-->
  54. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  55. <div class="modal-dialog modal-dialog-centered" role="document">
  56. <div class="modal-content">
  57. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("产品标准"))
  58. @{
  59. var inputs = new List<InputViewModel>
  60. {
  61. new InputViewModel("id", hide: true),
  62. new InputViewModel("propertyNo", hide: true),
  63. new InputViewModel("propertyType",InputTypes.List, displayName: "属性类别").SetSelectOptions(productPropertyTypeList),
  64. new InputViewModel("propertyValue", displayName: "属性值"),
  65. new InputViewModel("displayValue", displayName: "显示值").SetNotRequired(),
  66. new InputViewModel("hsCode", displayName: "海关编码").SetNotRequired(),
  67. new InputViewModel("contentInfo",InputTypes.Textarea, "内容描述").SetNotRequired(),
  68. };
  69. //var specials = new List<SpecialInputModel>();
  70. }
  71. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  72. @Html.Partial("Modals/_ModalFooter", "0")
  73. </div>
  74. </div>
  75. </div>
  76. @{
  77. var uploadModal = new ModalViewModel("产品属性导入", "", new ShwasherSys.Views.Shared.New.Modals.ModalBodyViewModel(
  78. new List<Input>(){
  79. new InputFile("uploadExcel","上传文件").SetFileOption("FileInfo","FileName","FileExt")
  80. }, "upload-form"), "upload-modal");
  81. }
  82. @Html.Partial("New/Modals/_Modal",uploadModal)
  83. <div class="modal fade" id="modal_extend" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  84. <div class="modal-dialog modal-dialog-centered" role="document">
  85. <div class="modal-content">
  86. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("产品标准扩展"))
  87. @{
  88. var inputs2 = new List<InputViewModel>
  89. {
  90. new InputViewModel("id", hide: true),
  91. new InputViewModel("propertyNo", hide: true),
  92. new InputViewModel("propertyType",InputTypes.List, displayName: "属性类别").SetSelectOptions(productPropertyTypeList),
  93. new InputViewModel("propertyValue",displayName: "属性值").SetNotRequired(),
  94. new InputViewModel("displayValue", displayName: "显示值").SetNotRequired(),
  95. new InputViewModel("hsCode", displayName: "海关编码")
  96. };
  97. }
  98. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs2))
  99. @Html.Partial("Modals/_ModalFooter", "0")
  100. </div>
  101. </div>
  102. </div>
  103. </section>
  104. }
  105. @section scripts
  106. {
  107. <script type="text/javascript">
  108. $(function () {
  109. //show完毕前执行
  110. LoadTable();
  111. var funs = window.funs || { none: function () { console.log("No type"); } };
  112. funs["btnUpdate"] = function () { BtnUpdate({ readonly: "propertyType", disabled:"propertyType" }); };
  113. funs["btnImport"] = function (url) {
  114. OpenModal(url, {
  115. modal: $("#upload-modal"), modaltitle: "产品属性导入", save: function () {
  116. $.iwbAjax1({
  117. url: url,
  118. modal: "upload-modal",
  119. form: "upload-form",
  120. success: function () {
  121. RefreshTable();
  122. }
  123. });
  124. }
  125. });
  126. }
  127. });
  128. function f_modifyExtent(id, propertyNo, propertyType, propertyValue, hsCode, contentInfo, displayValue) {
  129. data = { id: id, propertyNo: propertyNo, propertyType: propertyType, propertyValue: propertyValue || '', hsCode: hsCode, contentInfo: contentInfo || '', displayValue: displayValue || '' }
  130. console.log(data)
  131. OpenModal(window.appUrl + "ProductProperty/UpdateExtend", {
  132. modal: $("#modal_extend"), modaltitle: "",
  133. disabled: 'propertyType,propertyValue,displayValue,contentInfo',
  134. data: data,
  135. save: function () {
  136. $.iwbAjax1({
  137. url: window.appUrl + "ProductProperty/UpdateExtend",
  138. modal: "modal_extend",
  139. success: function () {
  140. RefreshTable();
  141. }
  142. });
  143. }
  144. });
  145. }
  146. function PropertyTypeFormatter(v) {
  147. var name = $('#hid-propertyType option[value="' + v + '"]').text();
  148. if (v) {
  149. return '<span class="label label-info">' + name + '</span>';
  150. } else {
  151. return '<span class="label label-warning">暂无</span>';
  152. }
  153. }
  154. function HsCodeFormatter(v, r) {
  155. let val = v ? `<i class="iconfont icon-edit"></i>${v}` :'<i class="iconfont icon-add"></i>'
  156. var str = `<span class="table-action label " onclick="f_modifyExtent(${r.id},'${r.propertyNo}','${r.propertyType}','${r.propertyValue}','${v || ''}','${r.contentInfo || ''}','${r.displayValue || ''}')">${val}</span>`;
  157. return str;
  158. }
  159. </script>
  160. }
  161. <section style="display: none">
  162. <select id="hid-type">
  163. <option value=""></option>
  164. </select>
  165. @Html.DropDownList("hid-propertyType", productPropertyTypeList)
  166. </section>