| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <#@ template language="C#" #>
- <#@ assembly name="System.Core" #>
- <#@ import namespace="System.Linq" #>
- <#@ import namespace="System.Text" #>
- <#@ import namespace="System.Collections.Generic" #>
- @using <#=Model.ProjectName#>
- @using <#=Model.ProjectName#>.Configuration
- @using <#=Model.ProjectName#>.Authorization
- @using <#=Model.ProjectName#>.Web.Views.Shared.Modals
- @using <#=Model.ProjectName#>.Web.Views.Shared.SearchForm
- @using <#=Model.ProjectName#>.Web.Views.Shared.Table
- <#
- string isMuiltSearch= Model.IsMultipleSearch?"false":"true";
- #>
- @{
- ViewBag.Title = "<#=Model.HtmlPageTitle#>";
- string activeMenu = PermissionNames.Pages<#=Model.ParentPath#><#=Model.FileName#>Mg; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- var searchForm = new SearchFormViewModel(new List<SearchItem>()
- {
- <# foreach (var item in Model.Columns)
- {
- if(!item.IsGenreated) continue;
- if(item.IsSearch)
- {
- var typeStr= item.AttrType=="int"?"FieldType.I": item.AttrType=="int"?"FieldType.In": item.AttrType=="DateTime"?"FieldType.D": item.AttrType=="DateTime?"?"FieldType.Dn":"";
- typeStr= string.IsNullOrEmpty(typeStr)?"":","+typeStr;
-
- #> new SearchItem("<#=item.CamelColumnName#>","<#=item.Comment#>"<#=typeStr#>),
- <# }
- }
- #>
- },"search-form",<#=isMuiltSearch#>);
- var table = new TableViewModel(IwbConsts.ApiAppUrl + "<#=Model.FileName#>/GetAll", activeMenu, searchForm)
- .SetFields(new List<FieldItem>()
- {
- <# foreach (var item in Model.Columns)
- {
- if(!item.IsGenreated) continue;
- if(item.IsTable)
- {
- #> new FieldItem("<#=item.CamelColumnName#>", "<#=item.Comment#>"),
- <# }
- }
- #>
- });
- var inputs = new List<Input>()
- {
- new InputHide("id"),
- <# foreach (var item in Model.Columns)
- {
- if(!item.IsGenreated) continue;
- if(!item.IsModal) continue;
- var inputType=item.AttrType=="int"?"InputNumber": item.AttrType=="int?"?"InputNumber": item.AttrType=="DateTime"?"InputDateTime": item.AttrType=="DateTime?"?"InputDateTime":"Input";
- if(item.IsRequired) {
- #> new <#=inputType#>("<#=item.CamelColumnName#>", "<#=item.Comment#>"),
- <#
- }else{
- #> new <#=inputType#>("<#=item.CamelColumnName#>", "<#=item.Comment#>").SetNotRequired(),
- <#
- }
- #>
- <# }
- #>
- };
- var modalBody = new ModalBodyViewModel().AddInputs(inputs);
- var modal = new ModalViewModel().SetHeader("<#=Model.HtmlModalTitle#>").SetBody(modalBody);
- }
- @section styles{
-
- }
- @await Html.PartialAsync("Table/_Table", table)
- @section modal{
- <!--Modal Start-->
- @await Html.PartialAsync("Modals/_Modal", modal)
- <!--Modal End-->
- }
- @section scripts
- {
- <script type="text/javascript">
- var $table;
- $(function () {
- $table = LoadTable();
- var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
- funs["btnCreate"] = function() { BtnCreate({ data: { id: "" } }); }
- funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
- });
- </script>
- <!--格式化-->
- <script id="formatter-script" type="text/javascript">
- function TypeFormatter(v) {
- var name = $('#hid-type option[value="' + v + '"]').text();
- switch (v) {
- case 0:
- return '<span class="label label-danger">' + name +'</span>';
- default:
- return '<span class="label label-info">' + name +'</span>';
- }
- }
- </script>
- }
- <section style="display: none">
- <select id="hid-type">
- <option value=""></option>
- </select>
- @*@Html.DropDownList("hid-type", type)*@
- </section>
|