EvalModel.cshtml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.PagesEngineModelMgEvalModelMg; //The menu item will be active for this page.
  10. ViewBag.ActiveMenu = activeMenu;
  11. string target = ViewBag.Target;
  12. var searchForm = new SearchFormViewModel(new List<SearchItem>()
  13. {
  14. new SearchItem("modelName","模型名称"),
  15. }, "search-form", false);
  16. var table = new TableViewModel(IwbConsts.ApiAppUrl + "EvalModel/GetAll", activeMenu, searchForm)
  17. .SetFields(new List<FieldItem>()
  18. {
  19. new FieldItem("modelName", "模型名称"),
  20. new FieldItem("evalTargetNo", "评估指标","EvalTargetFormatter"),
  21. new FieldItem("qualitativeExpression", "定性评估表达式"),
  22. new FieldItem("version", "模型版本"),
  23. new FieldItem("description", "模型描述"),
  24. });
  25. }
  26. @section css{
  27. }
  28. @Html.Partial("Table/_Table", table)
  29. @section modal{
  30. <!--Main Modal-->
  31. @{
  32. var modal = new ModalViewModel("模型", new ModalBodyViewModel(new List<Input>()
  33. {
  34. new InputHide("id"),
  35. new Input("modelName", "模型名称"),
  36. new Input("evalTargetNo", "评估指标").SetSelectOptions(target),
  37. new Input("qualitativeExpression", "定性评估表达式"),
  38. new Input("version", "模型版本").SetNotRequired(),
  39. new InputTextarea("description", "模型描述").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: "" }, select2tree:"evalTargetNo" }); }
  52. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "", select2tree: "evalTargetNo"}); };
  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. function EvalTargetFormatter(v) {
  67. var name = $('#hid-target option[value="' + v + '"]').text();
  68. return name;
  69. //switch (v) {
  70. //case 0:
  71. // return '<span class="label label-danger">' + name + '</span>';
  72. // default:
  73. //}
  74. }
  75. </script>
  76. }
  77. <section style="display: none">
  78. <select id="hid-type">
  79. <option value=""></option>
  80. </select>
  81. <select id="hid-target">
  82. <option value="">
  83. @Html.Raw(target)
  84. </option>
  85. </select>
  86. @*@Html.DropDownList("hid-type", type)*@
  87. </section>