123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508 |
-
- @{
- Layout = null;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width" />
- <title>BulletinInfo</title>
- <link href="~/easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
- <link href="~/easyui/themes/icon.css" rel="stylesheet" />
- <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
- <link href="~/Content/js/plugins/layer/skin/layer.css" rel="stylesheet" />
- <script src="~/Content/js/jquery.min.js"></script>
- <script src="~/Content/js/bootstrap.min.js"></script>
- <script src="~/easyui/jquery.easyui.min.js"></script>
- <script src="~/easyui/jquery.easyui.mobile.js"></script>
- <script src="~/easyui/locale/easyui-lang-zh_CN.js"></script>
- <script src="~/Content/js/plugins/layer/laydate/laydate.js"></script>
- <script src="~/Content/js/plugins/layer/layer.min.js"></script>
- <script src="~/Content/plugins/ajaxFileUpload/ajaxFileUpload-M.js"></script>
- <script src="~/js/Utils.js"></script>
- <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
- <link href="~/Content/kindeditor-master/themes/default/default.css" rel="stylesheet" />
- <script src="~/Content/kindeditor-master/kindeditor-all.js"></script>
- <script src="~/Content/kindeditor-master/kindeditor-all-min.js"></script>
- <script src="~/Content/kindeditor-master/lang/zh-CN.js"></script>
- <style>
- .td_1 {
- padding-bottom: 5px;
- padding-left: 5px;
- }
- </style>
- </head>
- <body>
- <section class="hidden">
- <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
- <input id="hid_RuleType" name="hid_RuleType" type="hidden" value="@ViewBag.RuleType" />
- <input id="hid_IsAdd" name="hid_RuleType" type="hidden" value="@ViewBag.IsAdd" />
- <input id="hid_IsUpdate" name="hid_RuleType" type="hidden" value="@ViewBag.IsUpdate" />
- <input id="hid_IsDelete" name="hid_RuleType" type="hidden" value="@ViewBag.IsDelete" />
- <input id="hid_IsAudit" name="hid_RuleType" type="hidden" value="@ViewBag.IsAudit" />
- </section>
- @*<section class="text-center title">
- <h2>市场信息</h2>
- </section>*@
- <section class="container-fluid" style="height: 95vh; padding-top: 5px;">
- <div class="row tbToolBar" id="tbToolBar">
- <div class="toolbar" id="CurdTool" style="float:left">
- <a href="#" class="easyui-linkbutton" id="btn_Add" iconCls="icon-add" plain="true" onclick="btn_Add()" >添加</a>
-
- <a href="#" class="easyui-linkbutton" id="btn_Update" iconCls="icon-edit" plain="true" onclick="btn_Edit()" >修改</a>
-
- <a href="#" class="easyui-linkbutton" id="btn_Delete" iconCls="icon-remove" plain="true" onclick="btn_Del()" >删除</a>
-
- <a href="#" class="easyui-linkbutton" id="btn_Audit" iconCls="icon-edit" plain="true" onclick="btn_Aud()" >审核</a>
-
- </div>
- </div>
- <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
- data-options="singleSelect: true,
- method: 'post',
- multiSort: false,
- toolbar: '#tbToolBar',
- fitColumns: true,
- rownumbers: true,
- remoteSort: false,
- loadFilter: pagerFilter,
- pagination: true,
- pageSize: 25,
- pageList: [15, 25, 50, 100]
- ">
- <thead>
- <tr>
- @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
- <th data-options="field:'Title',width:80,align:'center'">标题</th>
- <th data-options="field:'BulletinTypeID',width:80,align:'center'">公告类型</th>
- <th data-options="field:'AuditFlagName',width:80,align:'center'">是否审核</th>
- <th data-options="field:'UpdateTime',width:80,align:'center'">日期</th>
- </tr>
- </thead>
- </table>
- </section>
- <section>
- <div id="winModal" class="easyui-window winModal" title="公告栏信息维护" style="width: 650px; height:450px;padding:5px;"
- iconCls="icon-save" data-options="modal:true,closed:true">
- <div class="easyui-layout" data-options="fit:true" style="height:400px">
- <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
- <table cellpadding="10" cellspacing="0" style="margin-left:10px">
- <tr>
- <td class="td_1">公告类型</td>
- <td class="td_1">
- <select class="easyui-combobox" id="BulletinTypeID" name="BulletinTypeID" style="width:400px;height:20px">
- @Html.Raw(ViewBag.SelBulletinType)
- </select>
- </td>
- </tr>
- <tr>
- <td class="td_1">标题</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="Title" name="Title" data-options="required:true" style="width:400px;height:20px" />
- </td>
- </tr>
- <tr>
- <td class="td_1">发布日期</td>
- <td class="td_1">
- <input class="laydate-icon" type="text" id="UpdateTime" name="UpdateTime" data-options="required:true" style="width:400px;height:20px" />
- </td>
- </tr>
- <tr>
- <td class="td_1">上传附件</td>
- <td class="td_1">
- <input class="easyui-filebox" id="UploadedFile" name="UploadedFile" data-options="prompt:'Choose a file...'" style="width:300px;height:20px" />
-
- </td>
- </tr>
- <tr>
- <td align="left" colspan="2" >
- <label id="DownUrl"></label>
- </td>
- </tr>
- <tr style="color:cornflowerblue">
- <td align="center" colspan="2" style="background-color:lightgray">
- <span><strong>内容</strong></span>
- </td>
- </tr>
- <tr>
- <td class="td_1" colspan="2">
- <textarea id="content" name="content" class="easyui-validatebox" data-options="required:true" style="width: 550px; height: 150px;" placeholder="请输入内容"></textarea>
- </td>
- </tr>
- <tr></tr>
- </table>
- </div>
- <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
- <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
- <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
- </div>
- </div>
- </div>
- </section>
- <script>
- function btn_Add() {
- $("#hid_Type").val("Add");
- $("#Title").textbox("setValue", "");
- $('#UploadedFile').filebox('setValue', '');
- $("#DownUrl").html("未上传附件");
- KindEditor.html('#content', "");
- $('#winModal').window('open');
- }
- //修改
- function btn_Edit() {
- $("#hid_Type").val("Edit");
- //ClearFile(getFileElement());
- $("#UploadedFile").filebox("setValue", "");
- var row = $('#dgTable').datagrid('getSelected');
- if (row) {
- $("#BulletinTypeID").combobox("setValue", row.BulletinTypeID);
- $("#Title").textbox("setValue", row.Title)
- $("#UpdateTime").val(row.UpdateTime);
- $.ajax({
- url: "/BulletinInfo/GetBulletinInfoAttachFileInfo?ran=" + Math.random(),
- type: "POST",
- dataType: "json",
- data: { ID: row.ID },
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = data.FileName;
- if (!msg || msg.length <= 0) {
- $("#DownUrl").html("未上传附件");
- } else {
- $("#DownUrl").html(msg);
- }
- }
- })
- KindEditor.html('#content', row.content);
- $('#winModal').window('open');
- } else {
- layer.alert('请选择一条记录进行查看', {icon:0, title: '提示信息' });
- }
- }
- @*function Save(type) {
- type = type || $("#hid_Type").val();
- var ID = (type === "Edit") ? $('#dgTable').datagrid('getSelections')[0].ID : "";
- $.ajaxFileUpload({
- url: "@Url.Action("BulletinInfoListOper", "BulletinInfo")",
- secureuri: false, //一般设置为false
- fileElementId: getfileelement(),//$("#UploadedFile").filebox('getValue'),
- type: "post",
- dataType: "json",
- data: {
- Type: type,
- UploadFile: "true",
- ID: ID,
- BulletinTypeID: $("#BulletinTypeID").combobox("getValue"),
- Title: $("#Title").textbox("getValue"),
- UpdateTime: $("#UpdateTime").val(),
- content: $("#content").val()
- },
- success: function (data) {
- if (CheckAajxData(data) === false) return;
- //$("#UploadedFile").filebox("setValue", "");
- $('#UploadedFile').filebox({
- buttonText: '选择文件...',
- buttonAlign: 'right'
- })
- var msg = data.ErrorInfo;
- if (data.Success === true) {
- LoadTable();
- $("#winModal").window("close");
- layer.alert(msg, { icon: 1, title: '提示信息' });
- } else {
- layer.alert(msg, { icon: 7, title: '提示信息' });
- }
- }
- });
- }*@
- function Save(type) {
- type = type || $("#hid_Type").val();
- var ID = (type === "Edit") ? $('#dgTable').datagrid('getSelections')[0].ID : "";
- var formdata = new FormData();
- formdata.append("Type", type);
- formdata.append("ID", ID);
- formdata.append("BulletinTypeID", $("#BulletinTypeID").combobox("getValue"));
- formdata.append("Title", $("#Title").textbox("getValue"));
- formdata.append("UpdateTime", $("#UpdateTime").val());
- //formdata.append("content", encodeURI(encodeURI($("#content").val())));
- var b64 = new Base64();
- formdata.append("content", b64.encode($("#content").val()));
- formdata.append("file", $("#" + getfileelement())[0].files[0]);
- $.ajax({ // $.post,告辞
- type: 'post',
- contentType: false, // 关关关!必须得 false
- // 这个不关会扔一个默认值 application/x-www-form-urlencoded 过去,后端拿不到数据的!
- // 而且你甚至不能传个字符串 'multipart/form-data',后端一样拿不到数据!
- processData: false, // 关关关!重点
- url: "@Url.Action("BulletinInfoListOper", "BulletinInfo")",
- data: formdata,
- success: function (data) {
- if (CheckAajxData(data) === false) return;
- //$("#UploadedFile").filebox("setValue", "");
- $('#UploadedFile').filebox({
- buttonText: '选择文件...',
- buttonAlign: 'right'
- });
- data = JSON.parse(data);
- var msg = data.ErrorInfo;
- //console.log(msg, data.Success);
- if (data.Success === true) {
- LoadTable();
- $("#winModal").window("close");
- layer.alert(msg, { icon: 1, title: '提示信息' });
- } else {
- layer.alert(msg, { icon: 7, title: '提示信息' });
- }
- }
- });
- }
- function btn_Aud() {
- $("#hid_Type").val("Aud");
- var row = $('#dgTable').datagrid('getSelected');
- if (row) {
- layer.confirm('确认审核这条记录?', {
- btn: ['确认审核', '取消'] //按钮
- }, function () {
- if (row) {
- $.ajax({
- url: "/BulletinInfo/BulletinInfoListOper?ran=" + Math.random(),
- type: "POST",
- dataType: "json",
- data: { ID: row.ID, Type: 'Aud' },
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = data.ErrorInfo;
- if (data != null && data.Success == true) {
- LoadTable();
- //$('#winSetSysStatusInfo').window('close');
- layer.alert("操作成功!", { icon: 1, title: '提示信息' });
- } else {
- layer.alert(msg, { icon: 2, title: '提示信息' });
- }
- }
- })
- }
- })
- } else {
- layer.alert('请选择一条记录进行查看', { icon: 0, title: '提示信息' });
- }
- }
- function btn_Del() {
- $("#hid_Type").val("Del");
- var row = $('#dgTable').datagrid('getSelected');
- if (row) {
- layer.confirm('确认删除这条记录?', {
- btn: ['确认删除', '取消'] //按钮
- }, function () {
- if (row) {
- $.ajax({
- url: "/BulletinInfo/BulletinInfoListOper?ran=" + Math.random(),
- type: "POST",
- dataType: "json",
- data: { ID: row.ID, Type: 'Del'},
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = data.ErrorInfo;
- if (data != null && data.Success == true) {
- LoadTable();
- //$('#winSetSysStatusInfo').window('close');
- layer.alert("操作成功!", {icon: 1, title: '提示信息' });
- } else {
- layer.alert(msg, { icon: 2, title: '提示信息' });
- }
- }
- })
- }
- })
- } else {
- layer.alert('请选择一条记录进行查看', { icon: 0, title: '提示信息' });
- }
- }
- //加载表格数据
- function LoadTable() {
- $('#dgTable').datagrid({
- url: '@Url.Action("GetBulletinInfoList", "BulletinInfo")',
- onDblClickRow: function () {
- btn_Edit();
- }
- });
- }
- var editor;
- $(function () {
- //加载表格数据
- window.LoadTable();
- editor = KindEditor.create('textarea[name="content"]', {
- resizeType: 1, width: "100%", height: "500px", afterChange: function () {
- this.sync();
- }, afterBlur: function () {
- this.sync();
- }, allowUpload: true, uploadJson: '/SystemModule/UploadImage'
- });
- laydate({
- elem: '#UpdateTime',
- format: "YYYY-MM-DD",
- min: "2000-01-01",
- event: "focus"
- });
- $('#UploadedFile').filebox({
- buttonText: '选择文件...',
- buttonAlign: 'right'
- })
- if($('#hid_IsAdd').val()=="N"){
- $("#btn_Add").hide();
- }
- if($('#hid_IsUpdate').val()=="N"){
- $("#btn_Update").hide();
- }
- if($('#hid_IsDelete').val()=="N"){
- $("#btn_Delete").hide();
- }
- if($('#hid_IsAudit').val()=="N"){
- $("#btn_Audit").hide();
- }
- });
- //function ClearFile(idStr) {
- // var file = $(idStr);
- // file.after(file.clone().val(""));
- // file.remove();
- //}
- function getfileelement(uploadedfile) {
- uploadedfile = uploadedfile || "UploadedFile";
- return $('#' + uploadedfile).next().find("input[type='file']").attr("id")
- }
- function Base64() {
- // private property
- _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- // public method for encoding
- this.encode = function (input) {
- var output = "";
- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
- var i = 0;
- input = _utf8_encode(input);
- while (i < input.length) {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
- if (isNaN(chr2)) {
- enc3 = enc4 = 64;
- } else if (isNaN(chr3)) {
- enc4 = 64;
- }
- output = output +
- _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
- _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
- }
- return output;
- }
- // public method for decoding
- this.decode = function (input) {
- var output = "";
- var chr1, chr2, chr3;
- var enc1, enc2, enc3, enc4;
- var i = 0;
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- while (i < input.length) {
- enc1 = _keyStr.indexOf(input.charAt(i++));
- enc2 = _keyStr.indexOf(input.charAt(i++));
- enc3 = _keyStr.indexOf(input.charAt(i++));
- enc4 = _keyStr.indexOf(input.charAt(i++));
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
- output = output + String.fromCharCode(chr1);
- if (enc3 != 64) {
- output = output + String.fromCharCode(chr2);
- }
- if (enc4 != 64) {
- output = output + String.fromCharCode(chr3);
- }
- }
- output = _utf8_decode(output);
- return output;
- }
- // private method for UTF-8 encoding
- _utf8_encode = function (string) {
- string = string.replace(/\r\n/g, "\n");
- var utftext = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- utftext += String.fromCharCode(c);
- } else if ((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- } else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- }
- return utftext;
- }
- // private method for UTF-8 decoding
- _utf8_decode = function (utftext) {
- var string = "";
- var i = 0;
- var c = c1 = c2 = 0;
- while (i < utftext.length) {
- c = utftext.charCodeAt(i);
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if ((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i + 1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = utftext.charCodeAt(i + 1);
- c3 = utftext.charCodeAt(i + 2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
- }
- </script>
- </body>
- </html>
|