AcceptancProblem.model.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. function AcceptancProblem(id) {
  2. //问题id
  3. this.id = id;
  4. var that = this;
  5. this.inits = function () {
  6. //加载问题信息
  7. $.ajax({
  8. url: '/Problem/CheckProblem',
  9. data: { id: this.id },
  10. method: 'post',
  11. success: function (data) {
  12. $('#code').text(data[0].编号);
  13. $('#property').text(data[0].问题性质);
  14. $('#company').text(data[0].渠道);
  15. $('#project').text(data[0].项目);
  16. $('#org').text(data[0].机构);
  17. $('#productAndVersion').text(data[0].产品 + '/' + data[0].版本号);
  18. $('#module').text(data[0].模块);
  19. $('#prior').text(data[0].紧急代码);
  20. var priordate = data[0].要求时间 == null ? '无' : data[0].要求时间;
  21. $('#priordate').text(priordate);
  22. var priordesc = data[0].紧急描述 == null ? '无' : data[0].紧急描述;
  23. $('#priorDesc').text(priordesc);
  24. var feedback = data[0].反馈人 == null ? '无' : data[0].反馈人;
  25. $('#feedbackAndRegisterPerson').text(feedback + '/' + data[0].登记人);
  26. $('#registertime').text(data[0].登记日期);
  27. $('#title').text(data[0].问题标题);
  28. $('#content').html(data[0].问题描述);
  29. //附件记录(附件id|文件类型,1:图像,2:其它)
  30. var attach_ids = data[0].附件
  31. if (attach_ids != null) {//包括了附件
  32. var ids = attach_ids.split(',');
  33. var imghtml = '';
  34. for (var i = 0; i < ids.length; i++) {
  35. var imgid = ids[i].split('|');
  36. var id = imgid[0];
  37. var ft = imgid[1];
  38. if (ft == '1') {//图像类型,显示缩略图 o原图,s缩略图,m大图
  39. imghtml += '<a href="#" onclick="OpenImage(' + id + ')"><img src="/Problem/ViewProblemImage?id=' + id + '&type=s" class="img"/></a>&nbsp;';
  40. } else {//非图像类型,显示下载附件
  41. imghtml += '<a href="#" onclick="downloadfile(' + id + ')">下载附件' + (i + 1) + '</a>';
  42. }
  43. }
  44. //添加附件html
  45. $('#attach').html(imghtml);
  46. }
  47. //放大图片
  48. var img = $('#content').find("img");
  49. if (img) {
  50. img.bind("click", function () {
  51. var src = $(this).attr("src")
  52. top.ZLPMS.OpenNewWindow("查看图片", "/Problem/ViewImg?src=" + src, "850px", "620px")
  53. })
  54. }
  55. }
  56. });
  57. //初始化富文本编辑器
  58. var um = UM.getEditor('tbRemark', {
  59. toolbar: [
  60. 'source | undo redo | emotion forecolor backcolor | removeformat |',
  61. 'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontsize',
  62. '| justifyleft justifycenter justifyright justifyjustify |',
  63. '| horizontal print preview']
  64. });
  65. //关闭窗口
  66. $('#btnClose').bind('click', function () {
  67. ZLPMS.CloseTopWindow();
  68. });
  69. $(function () {
  70. //加载问题分类
  71. $('#ProblemType').combotreegrid({
  72. width: '40%',
  73. panelWidth: 680,
  74. panelHeight: 200,
  75. label: '问题分类:',
  76. labelPosition: 'left',
  77. url: '/ClassifyManage/GetTreeGrid',
  78. method: 'GET',
  79. idField: 'ID',
  80. treeField: '名称',
  81. editable: true,
  82. columns: [[
  83. { field: '编码', title: '编码', width: 55, align: 'center' },
  84. { field: '名称', title: '名称', width: 170, align: 'center' },
  85. { field: '说明', title: '说明', width: 380, align: 'center', halign: 'center' },
  86. {
  87. field: '分值', title: '分值', width: 70, align: 'center', halign: 'center', formatter: function (val, row, index) {
  88. return (val || 0) + "分";
  89. }
  90. }
  91. ]]
  92. });
  93. });
  94. $('#Solve').radiobutton({
  95. onChange: function (checked) {
  96. if (checked) {
  97. $('#ProblemType').combotreegrid({ disabled: false });
  98. } else {
  99. $('#ProblemType').combotreegrid({ disabled: true });
  100. }
  101. }
  102. });
  103. //确定按钮
  104. //确定按钮事件
  105. $('#btnFinish').bind('click', function () {
  106. var val=that.GetPara();
  107. $.post('/Problem/AcceptancProblem', val, function (data) {
  108. if (data == '1') {
  109. top.ZLPMS.Msg('验证完成');
  110. ZLPMS.CloseTopWindow(true);
  111. } else {
  112. top.ZLPMS.Msg('数据发生异常,请重新填写');
  113. }
  114. })
  115. });
  116. }
  117. //获取用户录入内容
  118. this.GetPara = function () {
  119. var para = {};
  120. //是否验证通过
  121. var IsSolve = $('#Solve').radiobutton('options').checked;
  122. //问题分类
  123. var TypeID = $('#ProblemType').combotreegrid('getValue');
  124. //描述说明
  125. var ProcessRemark = escape(UM.getEditor('tbRemark').getContent());
  126. var ProblemId=that.id;
  127. para={
  128. Verification: IsSolve,
  129. ProblemTypeID:TypeID,
  130. ProcessRemark:ProcessRemark,
  131. ProblemID:ProblemId
  132. };
  133. return para
  134. };
  135. }
  136. //查看附件大图
  137. function OpenImage(id) {
  138. //top.ZLPMS.OpenNewWindow(null, '/Problem/ViewProblemImage?id=' + id + '&type=m', '80%', '90%');
  139. top.ZLPMS.OpenNewWindow(null, '/SysCom/ImageView?id=' + id + '&type=m', '70%', '80%');
  140. }
  141. //下载附件文件
  142. function downloadfile(id) {
  143. window.open('/Problem/ViewProblemImage?id=' + id);
  144. }