UpdateViewProcessInfo.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. 
  2. @{
  3. ViewBag.Title = "UpdateViewProcessInfo";
  4. Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
  5. }
  6. <link href="~/Content/Scripts/plugins/umeditor-1.2.3/themes/default/_css/umeditor.css?v=1.1" rel="stylesheet" />
  7. <script src="~/Content/Scripts/plugins/umeditor-1.2.3/umeditor.min.js"></script>
  8. <script src="~/Content/Scripts/plugins/umeditor-1.2.3/umeditor.config.js?v=1.41"></script>
  9. <script src="~/Content/Scripts/plugins/umeditor-1.2.3/lang/zh-cn/zh-cn.js"></script>
  10. <script src="~/ViewModels/projectproblem.index.js?r=1.1"></script>
  11. <script type="text/javascript">
  12. $(function () {
  13. $('#btnClose').bind('click', function () { Close(); });
  14. $('#btnUpdate').bind('click', function () {
  15. var r = $('#updateprocess').form('validate');
  16. if (r) {//post到后台
  17. var param = escape(JSON.stringify(ZLPMS.FormToObject('updateprocess')));
  18. $.post("/Problem/UpdateProblemProcess", { text: param }, function (data) {
  19. if(data.code==200)
  20. {
  21. if (problemlObj.Choose == 1)
  22. {
  23. document.getElementById("btn_upload").click();
  24. }
  25. else {
  26. top.ZLPMS.Msg("修改成功!", 1);
  27. ZLPMS.CloseTopWindow(true)
  28. }
  29. }
  30. else
  31. {
  32. top.ZLPMS.Msg("修改失败!", 2);
  33. ZLPMS.CloseTopWindow(true)
  34. }
  35. })
  36. }
  37. });
  38. //问题描述
  39. $(function () {
  40. var um = UM.getEditor('MS', {
  41. toolbar: [
  42. 'source | undo redo | emotion forecolor backcolor | removeformat |',
  43. 'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontsize',
  44. '| justifyleft justifycenter justifyright justifyjustify |',
  45. '| horizontal print preview']
  46. });
  47. })
  48. //加载附件信息
  49. var attfiles = '@Model.附件';
  50. if (attfiles != '') {
  51. var files = attfiles.split(',')
  52. var imghtml = '';
  53. $.each(files, function (i, n) {
  54. var imgs = n.split('|');
  55. var id = imgs[0];
  56. var ft = imgs[1];
  57. if (ft == '1') {//图像类型,显示缩略图 o原图,s缩略图,m大图
  58. imghtml += '<div id="Attachment'+id+'"><a href="#" onclick="OpenImage(' + id + ')"><img src="/Problem/ViewProblemImage?id=' + id + '&type=s" class="img"/></a><i class="fa fa-times" id="icon' + id + '" aria-hidden="true" onclick="Delete_img(' + id + ')"></i></div>';
  59. } else {//非图像类型,显示下载附件
  60. imghtml += '<div id="Attachment' + id + '"><a href="#" onclick="downloadfile(' + id + ')">下载附件' + (i + 1) + '</a><i class="fa fa-times" id="icon' + id + '" aria-hidden="true" onclick="Delete_img(' + id + ')"></i></div>';
  61. }
  62. });
  63. $('#attach').html(imghtml);
  64. }
  65. //放大图片
  66. var img = $('#content').find("img");
  67. if (img) {
  68. img.bind("click", function () {
  69. var src = $(this).attr("src")
  70. top.ZLPMS.OpenNewWindow("查看图片", "/Problem/ViewImg?src=" + src, "850px", "620px")
  71. })
  72. }
  73. });
  74. //查看附件大图
  75. function OpenImage(id) {
  76. top.ZLPMS.OpenNewWindow('', '/Problem/ViewProblemImage?id=' + id + '&type=m', '80%', '90%');
  77. };
  78. //下载附件文件
  79. function downloadfile(id) {
  80. window.open('/Problem/ViewProblemImage?id=' + id);
  81. }
  82. //删除附件
  83. function Delete_img(data) {
  84. top.ZLPMS.Confirm('删除后无法恢复,您确定要删除该附件吗?', 3, function () {
  85. $.post("/Problem/Delete_Img", { id: data }, function (d) {
  86. if (d == 1) {
  87. top.ZLPMS.Msg("删除成功", 1);
  88. var name = "#Attachment" + data;
  89. var icon = "#icon" + data;
  90. $(name).attr("style", "display:none;")
  91. $(icon).attr("style", "display:none;")
  92. }
  93. else {
  94. top.ZLPMS.Msg("删除失败", 2)
  95. }
  96. })
  97. });
  98. }
  99. //附件上传
  100. layui.use('upload', function () {
  101. var upload = layui.upload;
  102. var demoListView = $('#AttachData');
  103. var uploadInst = upload.render({
  104. elem: '#ChooseFile' //文件选择按钮
  105. , url: '/Problem/ProcessFileUpload?problemID='+"@Model.ID"+"&processID="+"@ViewBag.id"
  106. , method: "post"
  107. , accept: 'file' //普通文件(文件类型)
  108. , multiple: true //多文件上传
  109. , auto: false //自动上传
  110. , size: 5120
  111. , bindAction: "#btn_upload"
  112. , number: 3//最大允许上传文件数量
  113. , choose: function (obj) {
  114. var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
  115. //读取本地文件
  116. obj.preview(function (index, file, result) {
  117. var display = "none";
  118. if (file.type == "image/jpeg" || file.type == "image/png") {
  119. display = "";
  120. }
  121. var tr = $(['<tr id="upload-' + index + '">'
  122. , '<td class="uplad-filename">' + file.name + '</td>'
  123. , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
  124. , '<td>等待上传</td>'
  125. , '<td>'
  126. , '<button class="layui-btn layui-btn-mini demo-reload layui-hide">重传</button>'
  127. , '<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete" style="height:25px;line-height:25px">删除</button>'
  128. , '<img src="' + result + '" class="CheckImg" width="auto" height="40" style="margin-left:10px;display:' + display + '"/>'
  129. , '</td>'
  130. , '</tr>'].join(''));
  131. //单个重传
  132. tr.find('.demo-reload').on('click', function () {
  133. obj.upload(index, file);
  134. });
  135. //删除
  136. tr.find('.demo-delete').on('click', function () {
  137. delete files[index]; //删除对应的文件
  138. tr.remove();
  139. uploadInst.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
  140. });
  141. problemlObj.Choose = 1;
  142. demoListView.append(tr);
  143. });
  144. }
  145. , done: function (res, index, upload) {
  146. if (res==1) {
  147. top.ZLPMS.Msg("修改成功!", 1);
  148. ZLPMS.CloseTopWindow(true)
  149. }
  150. else {
  151. top.ZLPMS.Msg("附件上传失败", 2);
  152. return;
  153. }
  154. }
  155. });
  156. });
  157. </script>
  158. <style>
  159. table {
  160. width: 100%;
  161. }
  162. table td {
  163. border: solid 1px #cacaca;
  164. padding: 3px;
  165. }
  166. .lable {
  167. width: 130px;
  168. padding: 5px 5px 5px 15px;
  169. background: #f5f5f5;
  170. color: #2636a3;
  171. font-size: 13px;
  172. }
  173. .img {
  174. width: 40px;
  175. height: 50px;
  176. border: solid 1px #000;
  177. }
  178. file {
  179. margin: 1px;
  180. }
  181. #content img {
  182. max-width: 400px;
  183. height: auto;
  184. }
  185. .CheckImg:hover {
  186. transform: scale(3);
  187. z-index: 999;
  188. width: auto;
  189. height: 40px;
  190. }
  191. .CheckImg {
  192. cursor: pointer;
  193. transition: all 0.6s;
  194. }
  195. #attach div{
  196. float:left;
  197. margin-left:15px;
  198. line-height: 55px;
  199. }
  200. </style>
  201. <form class="easyui-layout" data-options="fit:true" lay-filter="updateprocess" id="updateprocess">
  202. <div data-options="region:'south',border:false" style="height:50px; padding-top:10px;text-align:right; padding-right:10px;">
  203. <a id="btnUpdate" href="#" class="easyui-linkbutton c6"><i class="fa fa-pencil"></i> 确认</a>
  204. <a id="btnClose" href="#" class="easyui-linkbutton c5"><i class="fa fa-power-off"></i> 关闭</a>
  205. </div>
  206. <div data-options="region:'center',border:false">
  207. <div id="tabMyprocess" class="easyui-tabs" data-options="fit:true">
  208. <div title="过程详细信息" style="padding:3px;">
  209. <table>
  210. <input type="hidden" id="ID" name="ID" value="@ViewBag.id" />
  211. <input type="hidden" id="btn_upload" />
  212. <tr>
  213. <td class="lable">问题编号</td>
  214. <td id="code" style="width:200px">@Model.编号</td>
  215. <td class="lable">处理人</td>
  216. <td id="property">@Model.处理人</td>
  217. </tr>
  218. <tr>
  219. <td class="lable">处理时间</td>
  220. <td id="code">@Model.记录时间</td>
  221. <td class="lable">状态</td>
  222. <td id="property">@Model.状态</td>
  223. </tr>
  224. <tr>
  225. <td class="lable">问题标题</td>
  226. <td id="title" colspan="3">@Model.问题标题</td>
  227. </tr>
  228. <tr>
  229. <td class="lable">过程描述</td>
  230. <td id="content" colspan="3" style="height:200px;overflow:auto;">
  231. <textarea id="MS" name="MS" data-options="multiline:true,prompt:'请在此录入处理备注'" style="width:100%; height:220px;">@Html.Raw(Model.描述)</textarea>
  232. </td>
  233. </tr>
  234. <tr>
  235. <td class="lable">问题附件</td>
  236. <td colspan="3" style="height:50px;" id="attach"></td>
  237. </tr>
  238. <tr>
  239. <td class="lable" id="demoList">
  240. <a id="ChooseFile" href="#" class="easyui-linkbutton c8" data-options="plain:true"><i class="fa fa-plus-square-o"></i> 添加附件</a>
  241. </td>
  242. <td colspan="3" style="height:50px;" id="AttachData"></td>
  243. </tr>
  244. </table>
  245. </div>
  246. </div>
  247. </div>
  248. </form>