EditWindow.cshtml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. 
  2. @{
  3. ViewBag.Title = "EditWindow";
  4. Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
  5. }
  6. <style>
  7. table {
  8. width: 97%;
  9. }
  10. table td {
  11. padding: 5px 0px;
  12. /*border-bottom: solid 1px #EEE;*/
  13. }
  14. .layui-form-radio {
  15. margin: 0px;
  16. padding: 0px
  17. }
  18. .combobox-item {
  19. width: 1000px;
  20. }
  21. .combobox-item {
  22. width: 1000px;
  23. }
  24. </style>
  25. <form fit="true" class="layui-form" lay-filter="lteration" id="lteration">
  26. <input type="hidden" id="ID" name="ID" />
  27. <table>
  28. <tr>
  29. <td style="text-align: right; ">
  30. 标题:
  31. </td>
  32. <td>
  33. <input id="MC" name="MC" required autofocus class="easyui-textbox" style="width: 700px " />
  34. </td>
  35. </tr>
  36. <tr>
  37. <td style="text-align:right;">
  38. 有效日期:
  39. </td>
  40. <td>
  41. <input id="KSRJ" name="KSRJ" type="text" class="easyui-datebox" required style="width:120px">
  42. 至:
  43. <input id="JSRJ" name="JSRJ" type="text" class="easyui-datebox" required style="width:120px;" />
  44. <div class="layui-input-block" style="width:413px;margin-left:0px;float:right">
  45. <input type="radio" name="LX1" value="1" lay-filter="LX" title="一周">
  46. <input type="radio" name="LX1" value="2" lay-filter="LX" title="两周">
  47. <input type="radio" name="LX1" value="3" lay-filter="LX" title="一个月">
  48. <input type="radio" name="LX1" value="4" lay-filter="LX" title="两个月">
  49. <input type="radio" name="LX1" value="5" lay-filter="LX" title="三个月">
  50. <input type="radio" name="LX1" value="6" lay-filter="LX" title="半年">
  51. </div>
  52. </td>
  53. </tr>
  54. <tr style="margin-top:20px">
  55. <td style="text-align:right;width:105px">类型:</td>
  56. <td>
  57. <input id="LX" name="LX" required panelheight="300px" editable="false" class="easyui-combobox xmid" data-options="labelAlign:'right',limitToList:true,tipPosition:'top'" style="width:275px;" />
  58. </td>
  59. </tr>
  60. <tr style="margin-top:20px">
  61. <td style="text-align:right;width:105px">产品:</td>
  62. <td>
  63. <input id="CPID" name="CPID" required panelheight="275px" class="easyui-combobox" data-options="limitToList:true" style="width:275px;" />
  64. </td>
  65. </tr>
  66. <tr style="margin-top:20px">
  67. <td style="text-align:right;width:105px">项目:</td>
  68. <td>
  69. <input id="XMID" name="XMID" panelheight="200px" class="easyui-combobox" data-options="limitToList:true,tipPosition:'top'" style="width:275px;" />
  70. </td>
  71. </tr>
  72. <tr style="margin-top:20px">
  73. <td style="text-align:right;width:105px">渠道:</td>
  74. <td>
  75. <input id="QDID" name="QDID" panelheight="200px" class="easyui-combobox" data-options="limitToList:true,tipPosition:'top'" style="width:275px;" />
  76. </td>
  77. </tr>
  78. <tr style="margin-top:20px">
  79. <td style="text-align:right;width:105px">责任人:</td>
  80. <td>
  81. <input id="ZRRID" name="ZRRID" required panelheight="200px" class="easyui-combobox" data-options="limitToList:true,tipPosition:'top'" style="width:275px;" />
  82. </td>
  83. </tr>
  84. <tr style="margin-top:20px">
  85. <td style="text-align:right;width:105px">状态:</td>
  86. <td>
  87. <div class="layui-input-block" style="width:413px;margin-left:0px;float:left;margin-top:10px">
  88. <input type="radio" name="ZT" value="1" title="未完成">
  89. <input type="radio" name="ZT" value="2" title="未开始">
  90. <input type="radio" name="ZT" value="3" title="进行中">
  91. <input type="radio" name="ZT" value="4" title="已关闭">
  92. </div>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td style="text-align:right;width: 105px">描述:</td>
  97. <td colspan="2">
  98. <textarea id="MS" name="MS" style="width:100%;height:140px;"></textarea>
  99. </td>
  100. </tr>
  101. </table>
  102. <div class="layui-input-inline" style="width: 300px;position: fixed;bottom: 10px;right: -150px">
  103. <a href="#" onclick="Confrim()" class="easyui-linkbutton c1"><i class="fa fa-pencil"></i> 确认</a>&nbsp;&nbsp;&nbsp;
  104. <a onclick="Close()" href="#" class="easyui-linkbutton c5"><i class="fa fa-power-off"></i> 关闭</a>
  105. </div>
  106. </form>
  107. <script type="text/javascript">
  108. $(function () {
  109. layui.use('form', function () {
  110. var form = layui.form;
  111. form.on('radio(LX)', function (data) {
  112. $.post("/Problem/GetDateRange?type=" + data.value, function (result) {
  113. if (result.state) {
  114. $("#KSRJ").datebox("setValue", result.Sdate)
  115. $("#JSRJ").datebox("setValue", result.Edate)
  116. }
  117. })
  118. });
  119. });
  120. $("#LX").combobox({
  121. method: 'post',
  122. url: "/Problem/GetBaseCode?type=2DDA172A-499A-40CC-BA6A-29AB0FAEEDCB",
  123. valueField: '代码',
  124. textField: '显示名'
  125. })
  126. $("#CPID").combobox({
  127. method: 'post',
  128. url: "/Product/GetAllProducts",
  129. valueField: 'ID',
  130. textField: '名称'
  131. })
  132. $("#XMID").combobox({
  133. url: '/Problem/GetProjectByInfo',
  134. valueField: 'ID',
  135. textField: '名称',
  136. limitToList: true,
  137. onChange: function (newValue, oldValue) {
  138. if (newValue.length == 36) {
  139. //项目所属的渠道
  140. $("#QDID").combobox({
  141. url: '/Problem/GetChannelByInfo/' + newValue,
  142. valueField: 'ID',
  143. textField: '名称',
  144. onLoadSuccess: function (data) {
  145. $("#QDID").combobox("setValue", data[0].ID);
  146. }
  147. })
  148. }
  149. }
  150. })
  151. $("#ZRRID").combobox({
  152. method: 'post',
  153. url: "/Problem/GetFKR",
  154. valueField: 'ID',
  155. textField: '姓名'
  156. })
  157. if (@ViewBag.type== 2) {
  158. $.post("/Lteration/GetDataById?id=" +"@ViewBag.id",function(data){
  159. $("#ID").val(data[0].ID)
  160. $("#MC").textbox("setValue",data[0].名称)
  161. $("#KSRJ").datebox("setValue", data[0].开始日期)
  162. $("#JSRJ").datebox("setValue", data[0].结束日期)
  163. $("#LX").combobox("setValue", data[0].类型)
  164. $("#CPID").combobox("setValue", data[0].产品ID)
  165. $("#XMID").combobox("setValue", data[0].项目ID)
  166. $("#QDID").combobox("setValue", data[0].渠道ID)
  167. $("#ZRRID").combobox("setValue", data[0].责任人ID)
  168. $("#MS").val(data[0].描述)
  169. layui.use(['form'], function () {
  170. var form = layui.form
  171. //表单赋值
  172. form.val('lteration', {
  173. "ZT": data[0].状态.toString()
  174. });
  175. form.render()
  176. })
  177. })
  178. }
  179. })
  180. function Confrim() {
  181. //执行提交验证
  182. var r = $('#lteration').form('validate');
  183. var url='/Lteration/Save?type=1'
  184. if (@ViewBag.type== 2) {
  185. url='/Lteration/Save?type=2'
  186. }
  187. if (r) { //post到后台
  188. var loading = ZLPMS.Loading3(0)
  189. var param = ZLPMS.FormToObject('lteration');
  190. if (param.ZT == null) {
  191. top.ZLPMS.Msg("请选择迭代状态", 3)
  192. ZLPMS.UnLoading(loading)
  193. return
  194. }
  195. $.post(url, param, function (data) {
  196. if (data == 1) {
  197. ZLPMS.UnLoading(loading)
  198. top.ZLPMS.Msg("保存成功", 1);
  199. ZLPMS.CloseTopWindow(true);
  200. } else {
  201. ZLPMS.UnLoading(loading)
  202. top.ZLPMS.Msg("保存失败,请联系管理员", 2);
  203. ZLPMS.CloseTopWindow(true);
  204. }
  205. });
  206. }
  207. }
  208. function Close() {
  209. ZLPMS.CloseTopWindow(true);
  210. }
  211. </script>