| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- @using ShwasherSys
- @using ShwasherSys.Authorization.Permissions
- @using ShwasherSys.Models.Layout
- @using ShwasherSys.Views.Shared.New.Modals
- @using ShwasherSys.Views.Shared.New.Table
- @{
- ViewBag.Title = "模具信息维护";
- string activeMenu = PermissionNames.PagesCompanyDieMaintenanceMold; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- var searchForm = new SearchFormViewModal(new List<SearchItem>()
- {
- new SearchItem("no","模具编码"),
- new SearchItem("name","模具名称"),
- new SearchItem("model","模具规格"),
- new SearchItem("material","模具材质"),
- new SearchItem("outerDiameter","外径"),
- new SearchItem("insideDiameter","内径"),
- //new SearchItem("expireDate","有效期限",FiledType.D,ExpType.GreaterOrEqual),
- //new SearchItem("expireDate","至",FiledType.D,ExpType.LessOrEqual),
- //new SearchItem("maintenanceDate","维护时间",FiledType.D,ExpType.GreaterOrEqual),
- //new SearchItem("maintenanceDate","至",FiledType.D,ExpType.LessOrEqual),
- //new SearchItem("nextMaintenanceDate","下一次维护时间",FiledType.Dnull,ExpType.GreaterOrEqual),
- //new SearchItem("nextMaintenanceDate","至",FiledType.Dnull,ExpType.LessOrEqual),
- }, "search-form", false);
- var table = new TableViewModel("/api/services/app/Mold/GetAll", activeMenu, searchForm)
- .SetFields(new List<FieldItem>()
- {
- new FieldItem("no", "模具编码",isSort:true),
- // new FieldItem("name", "模具名称"),
- new FieldItem("model", "模具规格"),
- new FieldItem("material", "模具材质"),
- new FieldItem("customerName", "客户"),
- new FieldItem("shelfNum", "架号"),
- new FieldItem("outerDiameter", "外径"),
- new FieldItem("insideDiameter", "内径"),
- new FieldItem("thickness", "厚度"),
- new FieldItem("height", "高度"),
- new FieldItem("rigidity", "硬度"),
- //new FieldItem("expireDate", "有效期限","ExDateFormatter"),
- new FieldItem("maintenanceCycle", "维护周期"),
- //new FieldItem("maintenanceDate", "维护时间","DateFormatter"),
- //new FieldItem("nextMaintenanceDate", "下一次维护时间","MtDateFormatter"),
- });
- }
- @section css{
- }
- @Html.Partial("New/Table/_Table", table)
- @section modal{
- <!--Main Modal-->
- @{
- var modal = new ModalViewModel("模具", new ModalBodyViewModel(new List<Input>()
- {
- new InputHide("id"),
- new InputHide("no", "模具编码"),
- new Input("name", "模具名称").SetNotRequired(),
- new Input("model", "模具规格").SetNotRequired(),
- new Input("material", "模具材质").SetNotRequired(),
- new Input("customerName", "客户").SetNotRequired(),
- new Input("shelfNum", "架号").SetNotRequired(),
- new Input("outerDiameter", "内径").SetNotRequired(),
- new Input("insideDiameter", "外径").SetNotRequired(),
- new Input("thickness", "厚度").SetNotRequired(),
- new Input("height", "高度").SetNotRequired(),
- new Input("rigidity", "硬度").SetNotRequired(),
- new InputNumber("maintenanceCycle", "维护周期(次数)",other:"min=1").SetNotRequired(),
- new InputTextarea("description", "模具描述").SetNotRequired(),
- //new InputDate("expireDate", "有效期限"),
- //new InputNumber("maintenanceCycle", "维护周期(天)").SetMin(0),
- //new InputDate("maintenanceDate", "维护时间"),
- }));
- }
- @Html.Partial("New/Modals/_Modal", modal)
- @{
- var recordModal = new ModalViewModel("添加维护记录", "", new ModalBodyViewModel(new List<Input>()
- {
- new InputHide("id"),
- new Input("no", "设备编号"),
- new Input("name", "设备名称"),
- new Input("address", "维护地点"),
- new InputTextarea("description", "维护内容").SetNotRequired(),
- new InputDate("planDate", "计划维护时间").SetNotRequired()
- }), "record-modal");
- }
- @Html.Partial("New/Modals/_Modal", recordModal)
- }
- @section scripts
- {
- <script type="text/javascript">
- var $table = $('#table');
- $(function () {
- $table = LoadTable();
- var funs = window.funs || { none: function () { console.log("No type"); } };
- funs["btnCreate"] = function () {
- BtnCreate({
- data: { id: "", no: "1", maintenanceCycle: "50000000" },
- readonly: "maintenanceCycle"
- });
- }
- funs["btnUpdate"] = function () { BtnUpdate({ disabled: "maintenanceDate", readonly: "maintenanceCycle" }); };
- funs["btnMaintain"] = function (url) {
- var row= $table.bootstrapTable("getSelections")[0];
- if (row) {
- OpenModal({
- url: url,
- disabled: "no,name" ,
- modal: $('#record-modal'),
- data: row
- });
- }
- };
- });
- </script>
- <!--格式化-->
- <script id="formatter-script" type="text/javascript">
- function ExDateFormatter(v, r, i, f) {
- return CheckDateFormatter(v, r, i, f, 3 * 30);
- }
- function MtDateFormatter(v, r, i, f) {
- return CheckDateFormatter(v, r, i, f, 10);
- }
- function CheckDateFormatter(v, r, i, f,day) {
- var value = DateFormatter(v, r, i, f);
- if (value <= new Date().format('yyyy-MM-dd')) {
- return '<span style="color:red" class="iwb-flash2">' + value + ' [已到期]</span>';
- }
- var date = new Date(new Date(new Date().getTime() + day * 1000 * 60 * 60 * 24)).format('yyyy-MM-dd');
- if (date >= value) {
- return '<span style="color:orange" class="iwb-flash">' + value + ' [即将到期]</span>';
- }
- return value;
- }
- 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>
|