123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- @using WePlatform
- @using WePlatform.Configuration
- @using WePlatform.Authorization
- @using WePlatform.Views.Shared.Modals
- @using WePlatform.Views.Shared.SearchForm
- @using WePlatform.Views.Shared.Table
- @{
- ViewBag.Title = "环境资源信息维护";
- string activeMenu = PermissionNames.PagesResourceMgEnvironReMg; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- string resourceType = ViewBag.ResourceType;
- var searchForm = new SearchFormViewModel(new List<SearchItem>()
- {
- new SearchItem("resourceName","资源名称"),
- new SearchItem("messageCode","消息代码"),
- }, "search-form", false);
- var table = new TableViewModel(IwbConsts.ApiAppUrl + "EnvironResource/GetAll", activeMenu, searchForm)
- .SetFields(new List<FieldItem>()
- {
- new FieldItem("id", "编码"),
- new FieldItem("resourceName", "资源名称"),
- new FieldItem("resourceType", "资源类型","ResourceTypeFormatter"),
- new FieldItem("messageCode", "消息代码"),
- new FieldItem("resourcePath", "资源路径","PathFormatter"),
- });
- }
- @section css{
- }
- @Html.Partial("Table/_Table", table)
- @section modal{
- <!--Main Modal-->
- @{
- var modal = new ModalViewModel("环境资源", new ModalBodyViewModel(new List<Input>()
- {
- new InputHide("id"),
- new Input("resourceName", "资源名称"),
- new Input("resourceType", "资源类型").SetSelectOptions(resourceType),
- new Input("messageCode", "消息代码"),
- new InputFile("resourcePath", "资源路径").SetFileOption("fileInfo","fileName","fileExt"),
- new InputTextarea("description", "资源描述").SetNotRequired(),
- }));
- }
- @Html.Partial("Modals/_Modal", modal)
- }
- @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>';
- }
- }
- function ResourceTypeFormatter(v) {
- var name = $('#hid-resource-type option[value="' + v + '"]').text();
- switch (v) {
- case 1:
- return '<span class="label label-danger">' + name + '</span>';
- case 2:
- return '<span class="label label-info">' + name + '</span>';
- case 3:
- return '<span class="label label-success">' + name + '</span>';
- default:
- return '<span class="label label-info">' + name + '</span>';
- }
- }
- function PathFormatter(v) {
- if (v) {
- return '<a class="table-action" href="{0}" target="_blank">查看附件</a>'.format(v);
- }
- return '暂无附件';
- }
- </script>
- }
- <section style="display: none">
- <select id="hid-type">
- <option value=""></option>
- </select>
- <select id="hid-resource-type">
- @Html.Raw(resourceType)
- </select>
- @*@Html.DropDownList("hid-type", type)*@
- </section>
|