_InputView.cshtml 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @using IwbZero.ToolCommon.StringModel
  2. @using Abp.Extensions
  3. @using ContractService.Views.Shared.Modals
  4. @model ContractService.Views.Shared.Modals.Input
  5. @{
  6. string sm = Model.IsSm ? "input-group-sm" : "", search = string.IsNullOrEmpty(Model.SearchModalId) ? "" : "search-input", divId = string.IsNullOrEmpty(Model.DivId) ? "" : "id=\"" + Model.DivId + "\"";
  7. Model.Styles = Model.Styles.IsNullOrEmpty()|| !Model.Styles.Contains("width") ? "width:100%" : Model.Styles;
  8. }
  9. <div @(Html.Raw(divId)) class="input-group @(Html.Raw(sm)) @(Html.Raw(search)) @(Html.Raw(Model.DivSearchClass))" style="position: relative">
  10. @if (Model.InputType == InputTypes.List)
  11. {
  12. var ajax = "";
  13. if (Model.IsAjaxSelect)
  14. {
  15. ajax += "data-table-key=\"" + Model.TableKey + "\"";
  16. ajax += "data-column-key=\"" + Model.ColumnKey + "\"";
  17. ajax += "data-take-count=\"" + Model.TakeCount + "\"";
  18. ajax += string.IsNullOrEmpty(Model.FunResultTemplateName) ? "" : "data-fun-result-template-name=\"" + Model.FunResultTemplateName + "\"";
  19. Model.Class += " ajax-select";
  20. }
  21. var multiple = Model.IsMultiple ? "multiple" : "";
  22. <select class="@Model.Class @Model.Required" id="@Model.Id" name="@Model.Name" placeholder="@(Model.Placeholder)" value="@Model.Value" @multiple @Model.DataOptions @Model.Events @Model.Disabled @Model.ReadOnly style="@Model.Styles" @Model.Other @Html.Raw(ajax)>
  23. @Html.Raw(Model.SelectOptions)
  24. </select>
  25. if (!string.IsNullOrEmpty(Model.SearchModalId))
  26. {
  27. <div class="search-icon-box select-icon-box">
  28. @if (Model.Clear.NotEmpty())
  29. {
  30. <div class="search-icon input-group-text" title="@(L("Clean"))" style="" onclick="ClearSearchValue('@(Model.Target)','@(Model.Clear)');">
  31. <i class="fa fa-minus-square-o"></i>
  32. </div>
  33. }
  34. <div class="search-icon input-group-text" title="@(L("Search"))" style="" onclick="ShowQueryModal('@Model.SearchModalId','@(Model.Target)');">
  35. <i class="fa fa-search"></i>
  36. </div>
  37. </div>
  38. }
  39. }
  40. else if (Model.InputType == InputTypes.Textarea)
  41. {
  42. <textarea rows="5" class="@Model.Class @Model.Required" id="@Model.Id" name="@Model.Name" placeholder="@(Model.Placeholder)" data-placeholder="@(Model.Placeholder)" value="@Model.Value" @Model.DataOptions @Model.Events @Model.Disabled @Model.ReadOnly style="@Model.Styles" @Model.Other></textarea>
  43. }
  44. else if (Model.InputType == InputTypes.WangEditor)
  45. {
  46. <div class="iwb-wang-editor" id="wang-@Model.Id" data-id="@Model.Id" data-name="@Model.Name" data-menu="@Model.Other" data-opt="@Model.DataOptions" style="width:100%"></div>
  47. }
  48. else if (Model.InputType == InputTypes.File)
  49. {
  50. <div class="iwb-file">
  51. @{
  52. string infoId = Model.Id, nameId = Model.Id + "_name", extId = Model.Id + "_ext", isImage = "false", maxSize = "";
  53. if (Model.FileOption != null)
  54. {
  55. infoId = Model.FileOption.FileInfoField;
  56. nameId = Model.FileOption.FileNameField;
  57. extId = Model.FileOption.FileExtField;
  58. isImage = Model.FileOption.IsImage ? "true" : "false";
  59. maxSize = Model.FileOption.MaxSize + "";
  60. }
  61. }
  62. <input type="hidden" id="@(infoId)" name="@(infoId)" value="" />
  63. <input type="hidden" id="@(nameId)" name="@(nameId)" value="" />
  64. <input type="hidden" id="@(extId)" name="@(extId)" value="" />
  65. <input class="iwb-file-input" id="@(Model.Id)_file" type="file" placeholder="@(Model.Placeholder)" data-placeholder="@(Model.Placeholder)" onclick="FileUpload(this, { targetInfo: '@(infoId)', targetName: '@(nameId)', targetExt: '@(extId)', isImage: @(isImage), maxSize: '@(maxSize)' })">
  66. @* ReSharper disable once Html.IdNotResolved *@
  67. <label class="iwb-file-label" for="@(Model.Id)_file">@L("SelectFile")</label>
  68. <span class="clear" title="@(L("Clean"))" onclick="$(this).closest('.iwb-file').find('.iwb-file-input').iwbFileUpload('cleanFile')"><i class="fa fa-minus-square-o"></i></span>
  69. </div>
  70. }
  71. else
  72. {
  73. <input class="@Model.Class @Model.Required" id="@Model.Id" name="@Model.Name" type="@Model.TypeStr" placeholder="@(Model.Placeholder)" data-placeholder="@(Model.Placeholder)" @Model.DataOptions @Model.Events @Model.Disabled @Model.ReadOnly style="@Model.Styles" @Model.Other />
  74. if (!string.IsNullOrEmpty(Model.SearchModalId))
  75. {
  76. <div class="search-icon-box">
  77. @if (Model.Clear.NotEmpty())
  78. {
  79. <div class="search-icon input-group-text" title="@(L("Clean"))" style="" onclick="ClearSearchValue('@(Model.Target)','@(Model.Clear)');">
  80. <i class="fa fa-minus-square-o"></i>
  81. </div>
  82. }
  83. <div class="search-icon input-group-text" title="@(L("Search"))" style="" onclick="ShowQueryModal('@Model.SearchModalId','@(Model.Target)');">
  84. <i class="fa fa-search"></i>
  85. </div>
  86. </div>
  87. }
  88. }
  89. </div>