Edit_Window.cshtml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. @{
  2. ViewBag.Title = "Edit_Window";
  3. Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
  4. }
  5. <link href="~/Content/Scripts/plugins/umeditor-1.2.3/themes/default/_css/umeditor.css?v=1.1" rel="stylesheet" />
  6. <script src="~/Content/Scripts/plugins/umeditor-1.2.3/umeditor.min.js"></script>
  7. <script src="~/Content/Scripts/plugins/umeditor-1.2.3/umeditor.config.js?v=1.41"></script>
  8. <script src="~/Content/Scripts/plugins/umeditor-1.2.3/lang/zh-cn/zh-cn.js"></script>
  9. <script src="~/Content/Scripts/plugins/easyui/easyui-lang-zh_CN.js"></script>
  10. <script src="~/ViewModels/NoticeManager.js?r=1.1"></script>
  11. <style>
  12. table {
  13. width: 97%;
  14. }
  15. table td {
  16. padding: 3px;
  17. border-bottom: solid 1px #EEE;
  18. }
  19. </style>
  20. <form class="easyui-tabs" fit="true" lay-filter="edit_notice" id="edit_notice">
  21. <div title="<i class='fa fa-sticky-note-o'></i> 公告通知" style="padding:5px;display:none;">
  22. <input type="hidden" id="ID" name="ID" value="@ViewBag.id" />
  23. <input type="hidden" id="IsShow" name="IsShow" />
  24. <table>
  25. <tr>
  26. <td style="width:80px;">
  27. 标题:
  28. </td>
  29. <td>
  30. <input id="Title" name="Title" autofocus class="easyui-textbox" style="width:454px" />
  31. <input id="EndDate" name="EndDate" required editable="false" class="easyui-datetimebox" disabled="disabled" data-options="label:'截止日期:',labelAlign:'right',limitToList:true" style="width:200px;" />
  32. </td>
  33. </tr>
  34. <tr style="margin-top:20px">
  35. <td>通知类型:</td>
  36. <td>
  37. <input id="Type" name="Type" required panelheight="200px" editable="false" class="easyui-combobox xmid" data-options="labelAlign:'right',prompt:'请选择类型',limitToList:true,tipPosition:'top'" style="width:200px;" />
  38. <input id="NotifyTagert" name="NotifyTagert" editable="false" multiple=multiple required panelheight="200px" class="easyui-combobox" data-options="label:'通知对象:',labelAlign:'right',limitToList:true" style="width:250px;" />
  39. <input id="Property" name="Property" required editable="false" panelheight="200px" class="easyui-combobox" data-options="label:'优先级',labelAlign:'right',limitToList:true,tipPosition:'top'" style="width:200px;" />
  40. </td>
  41. </tr>
  42. <tr>
  43. <td>信息内容:</td>
  44. <td colspan="2">
  45. <textarea id="Deatil" name="Deatil" style="width:98%;height:140px;"></textarea>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td style="border-bottom:0px">公告附件:</td>
  50. <td colspan="2" id="demoList" style="border-bottom:0px">
  51. <a id="ChooseFile" href="#" class="easyui-linkbutton c8" data-options="plain:true"><i class="fa fa-plus-square-o"></i> 添加附件</a>
  52. </td>
  53. </tr>
  54. <tr id="attchment" style="height:55px"></tr>
  55. </table>
  56. <div class="layui-input-inline" style="width:300px;position:fixed;bottom:10px;right:-8%">
  57. <input class="easyui-checkbox checkbox-f" type="checkbox" id="Show" label="首页显示" labelposition="after" labelwidth="60px" style="top:15px;">
  58. <a onclick="Save_Notice()" href="#" class="easyui-linkbutton c1"><i class="fa fa-pencil"></i> 确认</a>&nbsp;&nbsp;&nbsp;
  59. <a onclick="Close()" href="#" class="easyui-linkbutton c5"><i class="fa fa-power-off"></i> 关闭</a>
  60. <button id="upload" style="display:none"></button>
  61. </div>
  62. </div>
  63. </form>
  64. <script type="text/javascript">
  65. var model = new viewModel();
  66. model.Edit_Init("@ViewBag.id");
  67. $(function () {
  68. $('#Show').checkbox({
  69. onChange: function (checked) {
  70. if (checked) {
  71. $('#EndDate').datetimebox({ disabled: false });
  72. } else {
  73. $('#EndDate').datetimebox({ disabled: true });
  74. }
  75. }
  76. });
  77. })
  78. //附件上传
  79. layui.use('upload', function () {
  80. var upload = layui.upload;
  81. var demoListView = $('#demoList');
  82. var uploadInst = upload.render({
  83. elem: '#ChooseFile' //文件选择按钮
  84. , url: '/Notice/FileUpload?type=3'
  85. , method: "post"
  86. , accept: 'file' //(文件类型)
  87. , multiple: true //多文件上传
  88. , auto: true //自动上传
  89. , size: 5120
  90. //, bindAction: "#upload"
  91. , number: 1//最大允许上传文件数量
  92. , choose: function (obj) {
  93. var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
  94. //读取本地文件
  95. obj.preview(function (index, file, result) {
  96. appOBJ.count++;
  97. var display = "none";
  98. var tr = $(['<tr id="upload-' + index + '">'
  99. , '<td class="uplad-filename">' + file.name + '</td>'
  100. , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
  101. , '<td>等待上传</td>'
  102. , '<td>'
  103. , '<button class="layui-btn layui-btn-mini demo-reload layui-hide">重传</button>'
  104. , '<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete" style="height:25px;line-height:25px">删除</button>'
  105. , '</td>'
  106. , '</tr>'].join(''));
  107. //删除
  108. tr.find('.demo-delete').on('click', function () {
  109. delete files[index]; //删除对应的文件
  110. tr.remove();
  111. uploadInst.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
  112. appOBJ.count--;
  113. ClearImg();
  114. });
  115. demoListView.append(tr);
  116. });
  117. }
  118. , before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
  119. appOBJ.index = ZLPMS.Loading3(0)
  120. appOBJ.index2 = top.ZLPMS.Loading3(0);
  121. }
  122. , allDone: function (obj) {
  123. top.ZLPMS.Msg("附件总共上传" + obj.total + ",成功" + obj.successful + "个,失败" + obj.aborted + "个")
  124. if (obj.successful > 0) {
  125. ZLPMS.UnLoading(appOBJ.index)
  126. top.ZLPMS.UnLoading(appOBJ.index2);
  127. return;
  128. }
  129. ZLPMS.UnLoading(appOBJ.index)
  130. top.ZLPMS.UnLoading(appOBJ.index2);
  131. top.ZLPMS.Msg("上传失败", 2);
  132. }
  133. });
  134. });
  135. </script>