Form.cshtml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. @{
  2. ViewBag.Title = "机构管理";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. var keyValue = request('keyValue');
  7. var parentId = request('parentId');
  8. $(function () {
  9. initControl();
  10. })
  11. //初始化控件
  12. function initControl() {
  13. //上级公司
  14. $("#ParentId").ComboBoxTree({
  15. url: "../../BaseManage/Organize/GetTreeJson",
  16. description: "==请选择==",
  17. height: "260px",
  18. allowSearch: true
  19. });
  20. //公司性质
  21. $("#Nature").ComboBox({
  22. url: "../../SystemManage/DataItemDetail/GetDataItemListJson",
  23. param: { EnCode: "CompanyNature" },
  24. id: "ItemValue",
  25. text: "ItemName",
  26. description: "==请选择==",
  27. height: "200px"
  28. });
  29. //负责人
  30. $("#ManagerId").ComboBoxTree({
  31. url: "../../BaseManage/User/GetTreeJson",
  32. description: "==请选择==",
  33. height: "220px",
  34. allowSearch: true
  35. });
  36. //省份
  37. $("#ProvinceId").ComboBox({
  38. url: "../../SystemManage/Area/GetAreaListJson",
  39. param: { parentId: "0" },
  40. id: "AreaCode",
  41. text: "AreaName",
  42. description: "选择省",
  43. height: "170px"
  44. }).bind("change", function () {
  45. var value = $(this).attr('data-value');
  46. $("#CityId").ComboBox({
  47. url: "../../SystemManage/Area/GetAreaListJson",
  48. param: { parentId: value },
  49. id: "AreaCode",
  50. text: "AreaName",
  51. description: "选择市",
  52. height: "170px"
  53. });
  54. });
  55. //城市
  56. $("#CityId").ComboBox({
  57. description: "选择市",
  58. height: "170px"
  59. }).bind("change", function () {
  60. var value = $(this).attr('data-value');
  61. if (value) {
  62. $("#CountyId").ComboBox({
  63. url: "../../SystemManage/Area/GetAreaListJson",
  64. param: { parentId: value },
  65. id: "AreaCode",
  66. text: "AreaName",
  67. description: "选择县/区",
  68. height: "170px"
  69. });
  70. }
  71. });
  72. //县/区
  73. $("#CountyId").ComboBox({
  74. description: "选择县/区",
  75. height: "170px"
  76. });
  77. //获取表单
  78. if (!!keyValue) {
  79. $.SetForm({
  80. url: "../../BaseManage/Organize/GetFormJson",
  81. param: { keyValue: keyValue },
  82. success: function (data) {
  83. $("#form1").SetWebControls(data);
  84. $("#FoundedTime").val(formatDate(data.FoundedTime, "yyyy-MM-dd"));
  85. $("#ProvinceId").trigger("change");
  86. if (data.CityId != undefined) {
  87. $("#CityId").ComboBoxSetValue(data.CityId).trigger("change");
  88. $("#CountyId").ComboBoxSetValue(data.CountyId);
  89. }
  90. }
  91. });
  92. } else {
  93. $("#ParentId").ComboBoxTreeSetValue(parentId);
  94. }
  95. }
  96. //保存表单
  97. function AcceptClick() {
  98. if (!$('#form1').Validform()) {
  99. return false;
  100. }
  101. var postData = $("#form1").GetWebControls(keyValue);
  102. postData["Manager"] = $("#ManagerId").attr('data-text');
  103. if (postData["ParentId"] == "") {
  104. postData["ParentId"] = 0;
  105. }
  106. $.SaveForm({
  107. url: "../../BaseManage/Organize/SaveForm?keyValue=" + keyValue,
  108. param: postData,
  109. loading: "正在保存数据...",
  110. success: function () {
  111. $.currentIframe().$("#gridTable").resetSelection();
  112. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  113. }
  114. })
  115. }
  116. </script>
  117. <div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
  118. <table class="form">
  119. <tr>
  120. <th class="formTitle">公司名称<font face="宋体">*</font></th>
  121. <td class="formValue">
  122. <input id="FullName" type="text" onblur="$.ExistField(this.id,'../../BaseManage/Organize/ExistFullName')" class="form-control" />
  123. </td>
  124. <th class="formTitle">公司性质</th>
  125. <td class="formValue">
  126. <div id="Nature" type="select" class="ui-select">
  127. </div>
  128. </td>
  129. </tr>
  130. <tr>
  131. <th class="formTitle">外文名称</th>
  132. <td class="formValue">
  133. <input id="EnCode" type="text" onblur="$.ExistField(this.id,'../../BaseManage/Organize/ExistEnCode')" class="form-control" />
  134. </td>
  135. <th class="formTitle">中文名称</th>
  136. <td class="formValue">
  137. <input id="ShortName" type="text" onblur="$.ExistField(this.id,'../../BaseManage/Organize/ExistShortName')" class="form-control" />
  138. </td>
  139. </tr>
  140. <tr>
  141. <th class="formTitle">上级公司</th>
  142. <td class="formValue">
  143. <div id="ParentId" type="selectTree" class="ui-select">
  144. </div>
  145. </td>
  146. <th class="formTitle">成立时间</th>
  147. <td class="formValue">
  148. <input id="FoundedTime" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" />
  149. </td>
  150. </tr>
  151. <tr>
  152. <th class="formTitle">负责人</th>
  153. <td class="formValue">
  154. <div id="ManagerId" type="selectTree" class="ui-select"></div>
  155. </td>
  156. <th class="formTitle">电话</th>
  157. <td class="formValue">
  158. <input id="OuterPhone" type="text" class="form-control" />
  159. </td>
  160. </tr>
  161. <tr>
  162. <th class="formTitle">电子邮箱</th>
  163. <td class="formValue">
  164. <input id="Email" type="text" class="form-control" />
  165. </td>
  166. <th class="formTitle">传真</th>
  167. <td class="formValue">
  168. <input id="Fax" type="text" class="form-control" />
  169. </td>
  170. </tr>
  171. <tr>
  172. <th class="formTitle">公司地点</th>
  173. <td class="formValue" colspan="3">
  174. <div style="float: left; width: 255px;">
  175. <div id="ProvinceId" type="select" class="ui-select" style="float: left; width: 84px; margin-right: 1px;"></div>
  176. <div id="CityId" type="select" class="ui-select" style="float: left; width: 84px; margin-right: 1px;"></div>
  177. <div id="CountyId" type="select" class="ui-select" style="float: left; width: 84px; margin-right: 1px;"></div>
  178. </div>
  179. <div style="margin: 0 auto; width: 100%;">
  180. <input id="Address" type="text" class="form-control" style="float: left; width: 355px;" />
  181. </div>
  182. </td>
  183. </tr>
  184. <tr>
  185. <th class="formTitle">邮编</th>
  186. <td class="formValue">
  187. <input id="Postalcode" type="text" class="form-control" />
  188. </td>
  189. <th class="formTitle">公司官网</th>
  190. <td class="formValue">
  191. <input id="WebAddress" type="text" class="form-control" />
  192. </td>
  193. </tr>
  194. <tr>
  195. <th class="formTitle">经营范围
  196. </th>
  197. <td class="formValue" colspan="3">
  198. <input id="BusinessScope" type="text" class="form-control" />
  199. </td>
  200. </tr>
  201. <tr>
  202. <th class="formTitle" valign="top" style="padding-top: 4px;">备注
  203. </th>
  204. <td class="formValue" colspan="3">
  205. <textarea id="Description" class="form-control" style="height: 70px;"></textarea>
  206. </td>
  207. </tr>
  208. </table>
  209. </div>