123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- @{
- ViewBag.Title = "Detail";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- @using MES.Production.Service;
- @using Central.Control.Domain;
- @using Ant.Service.Common;
- @using Ant.Service.Common.Enums;
- @using MES.Production.Entity;
- @using CommonToolHelper;
- @model Ent_YW_Notice
- <style>
- body {
- background-color: white;
- }
- .changeicon {
- float: right;
- margin-right: -15px;
- position: absolute;
- right: -7px;
- top: 0px;
- border: none;
- background-color: #18a689;
- color: #FFFFFF;
- line-height: 33px;
- height: 33px;
- }
- </style>
- <link href="~/Content/uploadone/CSS/webuploader.css" rel="stylesheet" />
- <link href="~/Content/uploadone/CSS/bootstrap.min.css" rel="stylesheet" />
- <link href="~/Content/uploadone/CSS/uploadstyle.css" rel="stylesheet" />
- <link href="~/Content/uploadone/CSS/font-awesome.css" rel="stylesheet" />
- <script src="~/Content/js/jquery/jquery-1.8.2.min.js"></script>
- <script src="~/Content/uploadone/Script/webuploader.js"></script>
- <!-- 配置文件 -->
- <script type="text/javascript" src="~/Content/ueditor/utf8-net/ueditor.config.js"></script>
- <!-- 编辑器源码文件 -->
- <script type="text/javascript" src="~/Content/ueditor/utf8-net/ueditor.all.js"></script>
- @using (Ajax.BeginForm("Save", null, new AjaxOptions()
- {
- HttpMethod = "Post",
- OnBegin = "SubAjax.Loading",
- OnComplete = "SubAjax.Complate",
- OnFailure = "SubAjax.Failure",
- OnSuccess = "SubAjax.Success"
- }, new { @class = "form-horizontal dig-from", @role = "form" }))
- {
- <div class="wrapper-content">
- @Html.Hidden("hidfilename", Model.ImgUrl)@*Html.Hidden("hidfilename", new HtmlString(ViewBag.imgurl))*@
- @Html.Hidden("hidfileid", Model.ImgUrl)
- <div class="panel-body">
- <div class="tab-content">
- <div id="tab-1" class="tab-pane active">
- <div class="form-group">
- <label class="col-lg-3 control-label">公告名称:</label>
- <div class="col-lg-8">
- @Html.HiddenFor(p => p.ID)
- @Html.TextBoxFor(p => p.Title, new { @class = "form-control", @id = "POSTNAME", @placeholder = "请输入公告名称", @datatype = "*", @nullmsg = "请输入岗位名称!", @errormsg = "请输入岗位名称!" })
- </div>
- </div>
- <div class="clearfix f-hafl">
- <div class="col-hafl">
- <div class="form-group">
- <label class="col-lg-3 control-label">用户类型:</label>
- <div class="col-lg-8">
- <select id="RoleId" name="RoleId" class="input-sm form-control input-s-sm inline" >
- @{ var post = ViewData["postType"] as List<SYS_CODE>;
- foreach (var item in post)
- {
- <option value="@item.CODEVALUE" @(Model.RoleId == Convert.ToInt32(item.CODEVALUE) ? "selected" : "")>@item.NAMETEXT</option>
- }
- }
- </select>
- </div>
- </div>
- </div>
- @*<div class="col-hafl">
- <div class="form-group">
- <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">显示顺序:</label>
- <div class="col-lg-8">
- @Html.TextBoxFor(p => p.RoleId, new { @class = "form-control", @placeholder = "请输入显示顺序", @datatype = "n1-10", @nullmsg = "请输入显示顺序!", @errormsg = "显示顺序必须是数字!" })
- </div>
- </div>
- </div>*@
- @*<div class="col-hafl">
- <div class="form-group">
- <label class="col-lg-3 control-label">公告类型:</label>
- <div class="col-lg-8" style="width:45% !important">
- <select id="RoleId" name="RoleId" class="input-sm form-control input-s-sm inline" style="width:auto;">
- <option value="10" @(Model.Noticetype == 1 ? "selected" : "")>文字消息</option>
- <option value="25" @(Model.Noticetype == 2 ? "selected" : "")>图文消息</option>
- </select>
- </div>
- </div>
- </div>*@
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">公告内容:</label>
- <div class="col-lg-8">
- <script id="container" name="content" type="text/plain">
- @(new HtmlString(ViewBag.html))
- </script>
- <script type="text/javascript">
- var editor = UE.getEditor('container')
- </script>
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">上传公告图片:</label>
- <div class="col-lg-8">
- <div id="fileNameList">
- </div>
- <div class="cp_img_jia" id="fileNamePicker"></div>
- </div>
- </div>
- <div class="hr-line-dashed">
- <div class="form-group m20">
- <div class="col-sm-2 col-sm-offset-2">
- <button class="btn btn-primary btn-save" type="submit"><i class="fa fa-check"></i> <span>确定保存</span></button>
- <button class="btn btn-warning" id="btn-dig-close" type="button"><i class="im-undo2"></i> 取消返回</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- }
- @section scripts{
- <script type="text/javascript">
- var applicationPath = "http://" + window.location.host;
- $(function () {
- var filename = document.getElementById("hidfilename").value;
- if (filename != null && filename != "") {
- //alert(filename);
- var headstr = "<div id=\"WU_FILE_0\" class=\"cpup_img upload-state-done\"><img src=\"";
- var footstr = "\"><div class=\"upcp_img_jian\"></div><p class=\"progress hide\"><span style=\"width: 100%;\"></span></p></div>";
- document.getElementById("fileNameList").innerHTML = headstr + filename + footstr;
- }
- var $ = jQuery, fileId,
- $list = $('#fileNameList'),
- // 优化retina, 在retina下这个值是2
- ratio = window.devicePixelRatio || 1,
- // 缩略图大小
- thumbnailWidth = 90 * ratio,
- thumbnailHeight = 90 * ratio,
- // Web Uploader实例
- uploader;
- uploader = WebUploader.create({
- // 选完文件后,是否自动上传。
- auto: true,
- disableGlobalDnd: true,
- // swf文件路径
- swf: applicationPath + '/Script/Uploader.swf',
- // 文件接收服务端。
- //server: applicationPath + '/Home/UpLoadProcess',
- server: applicationPath + '/Sys/Home/UpLoadProcess',
- // 选择文件的按钮。可选。
- // 内部根据当前运行是创建,可能是input元素,也可能是flash.
- pick: '#fileNamePicker',
- //只允许选择图片
- accept: {
- title: 'Images',
- extensions: 'gif,jpg,jpeg,bmp,png',
- mimeTypes: 'image/*'
- }
- });
- // 当有文件添加进来的时候
- uploader.on('fileQueued', function (file) {
- var $li = $(
- '<div id="' + file.id + '" class="cpup_img">' +
- '<img id="jjgimg">' +
- '<div class="upcp_img_jian"></div></div>'
- ),
- $img = $li.find('img');
- $list.children().remove();//先清空元素内容
- if (fileId != file.id && fileId != null) {
- //alert(fileId);
- uploader.removeFile(uploader.getFile(fileId, true));
- }
- fileId = file.id;
- // $list为容器jQuery实例
- $list.append($li);
- // 创建缩略图
- // 如果为非图片文件,可以不用调用此方法。
- // thumbnailWidth x thumbnailHeight 为 100 x 100
- uploader.makeThumb(file, function (error, src) {
- if (error) {
- $img.replaceWith('<span>不能预览</span>');
- return;
- }
- //alert(src);
- //alert(file);
- $img.attr('src', src);
- }, thumbnailWidth, thumbnailHeight);
- });
- //上传压缩宽度
- uploader.option('compress', {
- width: 700
- });
- // 文件上传过程中创建进度条实时显示。
- uploader.on('uploadProgress', function (file, percentage) {
- var $li = $('#' + file.id),
- $percent = $li.find('.progress span');
- // 避免重复创建
- if (!$percent.length) {
- $percent = $('<p class="progress"><span></span></p>')
- .appendTo($li)
- .find('span');
- }
- $percent.css('width', percentage * 100 + '%');
- });
- // 文件上传成功,给item添加成功class, 用样式标记上传成功。
- uploader.on('uploadSuccess', function (file, response) {
- //alert(file.name);//原来文件名
- //alert(response.id);//文件路径
- var imgurl = response.filePath; //上传图片的路径
- var fileid = response.fileid; //上传图片的路径
- console.log(response.id);
- console.log(imgurl);
- $('#' + file.id).addClass('upload-state-done');
- //alert(document.getElementById("fileNameList").innerHTML.replace('class="progress"', 'class="progress hide"'));
- $("#hidfilename").val(imgurl);
- $("#jjgimg").attr('src', imgurl);//季健国加为了解决保存一串字符串
- $("#hidfileid").val(fileid);
- });
- // 文件上传失败,显示上传出错。
- uploader.on('uploadError', function (file) {
- var $li = $('#' + file.id),
- $error = $li.find('div.error');
- // 避免重复创建
- if (!$error.length) {
- $error = $('<div class="error"></div>').appendTo($li);
- }
- $error.text('上传失败');
- });
- // 完成上传完了,成功或者失败,先删除进度条。
- uploader.on('uploadComplete', function (file) {
- $('#' + file.id).find('.progress').remove();
- });
- //所有文件上传完毕
- uploader.on("uploadFinished", function () {
- //提交表单
- });
- //开始上传
- $("#ctlUpBtn").click(function () {
- uploader.upload();
- });
- //显示删除按钮
- $(".cpup_img").on("mouseover", function () {
- $(this).children(".upcp_img_jian").css('display', 'block');
- });
- //隐藏删除按钮
- $(".cpup_img").on("mouseout", function () {
- $(this).children(".upcp_img_jian").css('display', 'none');
- });
- //执行删除方法
- $list.on("click", ".upcp_img_jian", function () {
- var Id = $(this).parent().attr("id");
- try {
- uploader.removeFile(uploader.getFile(Id, true));
- }
- catch (ex) { }
- $(this).parent().remove();
- });
- $('.form-horizontal').initValidform();
- $('.select2').select2();
- //分配部门
- $('#changeDpt').click(function () {
- var vals = $('#hiddpt').val();
- top.dialog({
- url: '/Sys/Department/GetSelectDpt',
- title: '选择景点',
- width: 450,
- height: 500,
- data: vals, // 给 iframe 的数据
- onclose: function () {
- if (this.returnValue != 'no') {
- $('#hiddpt').val(this.returnValue.split('|')[0]);
- $('#dpt').html(this.returnValue.split('|')[1]);
- //清理岗位
- $('#hidpost').val('');
- $('#post').html('');
- }
- },
- oniframeload: function () {
- }
- }).showModal();
- return false;
- });
- //分配岗位
- $('#changePost').click(function () {
- var dptid = $('#DPTID').val() + ',' + $('#hiddpt').val();
- if ($('#DPTID').val() == '' && $('#hiddpt').val() == '') {
- dig.alertError('提示', '请选择部门后再选择岗位');
- return;
- }
- var vals = $('#hidpost').val();
- top.dialog({
- url: '/Sys/Post/PostUser?dptid=' + dptid,
- title: '分配岗位',
- width: 500,
- height: 500,
- data: vals, // 给 iframe 的数据
- onclose: function () {
- if (this.returnValue != 'no') {
- $('#hidpost').val(this.returnValue.split('|')[0]);
- $('#post').html(this.returnValue.split('|')[1]);
- }
- },
- oniframeload: function () {
- }
- }).showModal();
- return false;
- });
- });
- </script>
- }
|