FixedAsset.cshtml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. @using ShwasherSys
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Views.Shared.New.Modals
  5. @using ShwasherSys.Views.Shared.New.Table
  6. @{
  7. ViewBag.Title = "设备固定资产维护";
  8. string activeMenu = PermissionNames.PagesCompanyDieMaintenanceFixedAsset; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. List<SelectListItem> faType = ViewBag.FixedAssetType;
  11. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  12. {
  13. new SearchItem("no","资产编号"),
  14. new SearchItem("name","资产名称"),
  15. new SearchItem("model","资产类型",FiledType.S,ExpType.Equal).SetSearchItem(faType,isAddBlank:false),
  16. },"search-form",false);
  17. var table = new TableViewModel( "/api/services/app/FixedAsset/GetAll", activeMenu, searchForm)
  18. .SetFields(new List<FieldItem>()
  19. {
  20. new FieldItem("no", "资产编号"),
  21. new FieldItem("name", "资产名称"),
  22. new FieldItem("model", "资产类型","FaTypeFormatter"),
  23. });
  24. }
  25. @section css{
  26. }
  27. @Html.Partial("New/Table/_Table", table)
  28. @section modal{
  29. <!--Main Modal-->
  30. @{
  31. var modal = new ModalViewModel("资产", new ModalBodyViewModel(new List<Input>()
  32. {
  33. new InputHide("id"),
  34. new InputHide("no", "资产编号"),
  35. new Input("name", "资产名称"),
  36. new Input("model", "资产类型").SetSelectOptions(faType,isAddBlank:false),
  37. new InputTextarea("description", "资产描述").SetNotRequired(),
  38. }));
  39. }
  40. @Html.Partial("New/Modals/_Modal", modal)
  41. }
  42. @section scripts
  43. {
  44. <script type="text/javascript">
  45. var $table;
  46. $(function () {
  47. $table = LoadTable();
  48. var funs = window.funs || { none: function () { console.log("No type"); } };
  49. funs["btnCreate"] = function() { BtnCreate({ data: { id: "" } }); }
  50. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  51. });
  52. </script>
  53. <!--格式化-->
  54. <script id="formatter-script" type="text/javascript">
  55. function FaTypeFormatter(v) {
  56. var name = $('#hid-type option[value="' + v + '"]').text();
  57. return name;
  58. //switch (v) {
  59. // case 0:
  60. // return '<span class="label label-danger">' + name +'</span>';
  61. // default:
  62. // return '<span class="label label-info">' + name +'</span>';
  63. //}
  64. }
  65. </script>
  66. }
  67. <section style="display: none">
  68. <select id="hid-type">
  69. <option value=""></option>
  70. </select>
  71. @Html.DropDownList("hid-type", faType)
  72. </section>