| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- @using ShwasherSys.Authorization.Permissions
- @using ShwasherSys.BasicInfo
- @using ShwasherSys.Models.Layout
- @using ShwasherSys.Models.Modal
- @using ShwasherSys.Views.Shared.New.Modals
- @using ShwasherSys.Views.Shared.New.Table
- @using InputTypes = ShwasherSys.Views.Shared.New.Modals.InputTypes
- @using ModalBodyViewModel = ShwasherSys.Views.Shared.New.Modals.ModalBodyViewModel
- @using ModalHeaderViewModel = ShwasherSys.Models.Modal.ModalHeaderViewModel
- @using SpecialInputModel = ShwasherSys.Views.Shared.New.Modals.SpecialInputModel
- @{
- ViewBag.Title = "原材料信息维护";
- string activeMenu = PermissionNames.PagesProductInfoRmProduct; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- var searchForm = new SearchFormViewModal(new List<SearchItem>()
- {
- new SearchItem("id","原材料编码"),
- new SearchItem("productName","名称"),
- new SearchItem("material","材质"),
- new SearchItem("model","规格"),
- });
- var table = new TableViewModel("/api/services/app/RmProduct/GetAll", activeMenu, searchForm)
- .SetFields(new List<FieldItem>()
- {
- new FieldItem("id", "原材料编码"),
- new FieldItem("productName", "名称"),
- new FieldItem("material", "材质"),
- new FieldItem("model", "规格"),
- new FieldItem("productDesc", "描述"),
- });
- }
- @section css{
- }
- @Html.Partial("New/Table/_Table", table)
- @section modal{
- <!--Main Modal-->
- @{
- var modal = new ModalViewModel("原材料", new ModalBodyViewModel(new List<Input>()
- {
- new Input("id", "原材料编码"),
- new Input("productName", "名称"),
- new Input("material", "材质"),
- new Input("model", "规格").SetNotRequired(),
- new InputTextarea("productDesc", "描述").SetNotRequired(),
- //new Input("userName", "登陆账号").SetNotRequired(),
- }));
- }
- @Html.Partial("New/Modals/_Modal", modal)
- <section>
- <div id="modalImport" class="modal fade" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered" role="document">
- <div class="modal-content">
- @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("原材料导入", ""))
- @{
- var inputs2 = new List<InputViewModel>
- {
- new InputViewModel("importExcel",ShwasherSys.Models.Modal.InputTypes.File, displayName:"上传Excel").SetNotRequired(),
- new InputViewModel("downloadFile",ShwasherSys.Models.Modal.InputTypes.Text, displayName:" ").SetNotRequired(),
- };
- var specials2 = new List<ShwasherSys.Models.Modal.SpecialInputModel> {
- new ShwasherSys.Models.Modal.SpecialInputModel()
- {
- Id= "importExcel",
- InputStr = "<div class=\"col-md-10\"><input class=\"form-control\" name=\"fileInfo\" id=\"fileInfo2\" type=\"hidden\"><input class=\"form-control\" name=\"fileName\" id=\"fileName2\" type=\"hidden\"><input class=\"form-control\" name=\"fileExt\" id=\"fileExt2\" type=\"hidden\"><input class=\"form-control\" name=\"constraintExt\" value=\"xls,xlsx\" type=\"hidden\"><div class=\"custom-file\"><input class=\"custom-file-input\" id=\"customFile-2\" type=\"file\" onchange=\"FileCheck(this,\'fileInfo2\')\" onclick=\"OpenUploadWindow()\"><label class=\"custom-file-label\" for=\"customFile-2\">选择文件</label></div></div>"
- },
- new ShwasherSys.Models.Modal.SpecialInputModel()
- {
- Id="downloadFile",
- InputStr = "<div class=\"col-md-10\"><button id=\"download\" type=\"button\" class=\"btn btn-success waves-effect\" style=\"min-width: 100px; background-color: #678ceb;border: 1px solid #678ceb;\" data-url=\"../Download/Excel/RmProduct.xls\" onclick=\"DownloadFile(this)\">下载导入文件模板</button><span style=\"color:red;\">*导入数据会清空原有记录,请谨慎使用</span></div>"
- }
- };
- }
- @Html.Partial("Modals/_ModalBody", new ShwasherSys.Models.Modal.ModalBodyViewModel(inputs2, specials: specials2))
- @Html.Partial("Modals/_ModalFooter", "0")
- </div>
- </div>
- </div>
- </section>
- }
- @section scripts
- {
- <script type="text/javascript">
- var $table = $('#table');
- $(function () {
- LoadTable();
- var funs = window.funs || { none: function () { console.log("No type"); } };
- funs["btnCreate"] = function () { BtnCreate({ data: { id: "" } }); }
- funs["btnUpdate"] = function () { BtnUpdate({ disabled: "id" }); };
- funs["btnImport"] = function(url) {
- OpenModal(url, { modal: $("#modalImport"), modaltitle: "原材料导入", data: { constraintExt:"xls,xlsx"} });
-
- }
- });
- function FileCheck(that, id) {
- var $fileName = $(that).closest(".col-md-10").find('input[name=fileName]');
- var $fileExt = $(that).closest(".col-md-10").find('input[name=fileExt]');
- var $fileConstraintExt = $(that).closest(".col-md-10").find('input[name=constraintExt]');
- FileInputCheck(that, id, false, 100, function (fileName) {
- var name = fileName.substring(0, fileName.lastIndexOf("."));
- var ext = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length);
- $fileName.val(name);
- $fileExt.val(ext);
- }, function(fileName) {
- var name = fileName.substring(0, fileName.lastIndexOf("."));
- var ext = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length);
- if ($fileConstraintExt) {
- var fileConstraintExt = $fileConstraintExt.val();
- if (fileConstraintExt&&fileConstraintExt.indexOf(ext) === -1) {
- abp.message.warn("只能选择" + fileConstraintExt + "为后缀的文件类型");
- $(".custom-file-label").text("");
- return false;
- }
- }
- });
- }
- function DownloadFile(that) {
- window.location.href = "/Resources/Excel/RmProduct.xls";
- }
- </script>
- <!--格式化-->
- <script id="formatter-script" type="text/javascript">
- </script>
- }
- <section style="display: none">
- <select id="hid-type">
- <option value=""></option>
- </select>
- @*@Html.DropDownList("hid-du", duty)
- @Html.DropDownList("hid-de", depart)
- @Html.DropDownList("hid-gender", gender)*@
- </section>
|