Component.cshtml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. @using WePlatform
  2. @using WePlatform.Configuration
  3. @using WePlatform.Authorization
  4. @using WePlatform.Views.Shared.Modals
  5. @using WePlatform.Views.Shared.SearchForm
  6. @using WePlatform.Views.Shared.Table
  7. @{
  8. ViewBag.Title = "推演引擎事务组件";
  9. string activeMenu = PermissionNames.PagesEngineModelMgEngineComponentMg; //The menu item will be active for this page.
  10. ViewBag.ActiveMenu = activeMenu;
  11. var searchForm = new SearchFormViewModel(new List<SearchItem>()
  12. {
  13. new SearchItem("name","组件名称"),
  14. },"search-form",false);
  15. var table = new TableViewModel(IwbConsts.ApiAppUrl + "EngineComponent/GetAll", activeMenu, searchForm)
  16. .SetFields(new List<FieldItem>()
  17. {
  18. new FieldItem("name", "组件名称"),
  19. new FieldItem("parameters", "参数映射"),
  20. new FieldItem("description", "事务描述"),
  21. new FieldItem("registerKey", "注册Key"),
  22. });
  23. }
  24. @section css{
  25. }
  26. @Html.Partial("Table/_Table", table)
  27. @section modal{
  28. <!--Main Modal-->
  29. @{
  30. var modal = new ModalViewModel("推演引擎事务组件", new ModalBodyViewModel(new List<Input>()
  31. {
  32. new InputHide("id"),
  33. new Input("name", "组件名称").SetNotRequired(),
  34. new Input("parameters", "参数映射").SetNotRequired(),
  35. new InputTextarea("description", "事务描述").SetNotRequired(),
  36. new InputTextarea("componentScript", "事务逻辑").SetNotRequired(),
  37. new Input("componentClass", "类全名").SetNotRequired(),
  38. new Input("componentLib", "程序集").SetNotRequired(),
  39. new Input("registerKey", "注册Key").SetNotRequired(),
  40. }));
  41. }
  42. @Html.Partial("Modals/_Modal", modal)
  43. }
  44. @section scripts
  45. {
  46. <script type="text/javascript">
  47. var $table;
  48. $(function () {
  49. $table = LoadTable();
  50. var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
  51. funs["btnCreate"] = function() { BtnCreate({ data: { id: "" } }); }
  52. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  53. });
  54. </script>
  55. <!--格式化-->
  56. <script id="formatter-script" type="text/javascript">
  57. function TypeFormatter(v) {
  58. var name = $('#hid-type option[value="' + v + '"]').text();
  59. switch (v) {
  60. case 0:
  61. return '<span class="label label-danger">' + name +'</span>';
  62. default:
  63. return '<span class="label label-info">' + name +'</span>';
  64. }
  65. }
  66. </script>
  67. }
  68. <section style="display: none">
  69. <select id="hid-type">
  70. <option value=""></option>
  71. </select>
  72. @*@Html.DropDownList("hid-type", type)*@
  73. </section>