list.jsp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
  2. <jsp:include page="../../common/include.jsp" />
  3. <%String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
  4. <script type="text/javascript">
  5. /**信息显示区*/
  6. $(function() {
  7. $.ajax({
  8. type: "post",
  9. dataType: "json",
  10. url: "columnSetAction_listColumn?tname=decorationChange",
  11. complete :function(){$("#load").hide();},
  12. success: function(msg){
  13. if(msg.success){
  14. setId();
  15. var data = msg.obj;
  16. for(var i = 0;i<data.length;i++){
  17. if("1"==data[i].type){
  18. if(typeof(data[i].formatter)!="undefined"){
  19. data[i].formatter=eval(data[i].formatter);
  20. }
  21. user_columns.push(data[i]);
  22. }else{
  23. user_frozenColumns.push(data[i]);
  24. }
  25. }
  26. columns.push(user_columns);
  27. frozenColumns.push(user_frozenColumns);
  28. $('#decorationChangeDataGrid').datagrid({
  29. rownumbers:true,
  30. fit:true,
  31. pageSize:10,
  32. pageList : [ 10, 20, 30, 40, 50 ],
  33. fitColumns:false,
  34. border:false,
  35. sortOrder:'desc',
  36. pagination:true,
  37. idField:'id',
  38. url:whzl.basePath + '/decorationChangeAction_list',
  39. toolbar:'#searchtool',
  40. checkOnSelect:true,
  41. selectOnCheck:true,
  42. singleSelect:true,
  43. showFooter: true,
  44. columns:columns,
  45. frozenColumns:frozenColumns,
  46. loadFilter:function(result){
  47. if(result.success){
  48. return result.obj;
  49. }else{
  50. $.messager.alert("提示",result.message);
  51. return ;
  52. }
  53. }
  54. });
  55. toolBar("decorationChangeDataGrid","setDecorationChangeDialog","decorationChange");
  56. }
  57. }
  58. });
  59. /*$('#decorationChangeDataGrid').datagrid({
  60. rownumbers:true,
  61. fit:true,
  62. pageSize:10,
  63. pageList : [ 10, 20, 30, 40, 50 ],
  64. fitColumns:false,
  65. border:false,
  66. sortOrder:'desc',
  67. pagination:true,
  68. idField:'id',
  69. url:whzl.basePath + '/decorationChangeAction_list',
  70. toolbar:'#searchtool',
  71. checkOnSelect:true,
  72. selectOnCheck:false,
  73. nowrap:true,
  74. loadFilter:function(result){
  75. if(result.success){
  76. return result.obj;
  77. }else{
  78. $.messager.alert("提示",result.message);
  79. return ;
  80. }
  81. }
  82. }
  83. );*/
  84. });
  85. /**查询*/
  86. function searchFun(){
  87. /*var params = encodeURI("decorationChange.renovationContract.number="+trim($("#tblQuery").find("input[id='number']").val())+
  88. "&decorationChange.renovationContract.name="+trim($("#tblQuery").find("input[id='name']").val())+
  89. "&decorationChange.title="+trim($("#tblQuery").find("input[id='title']").val())
  90. );*/
  91. $("#decorationChangeDataGrid").datagrid("load", {
  92. "decorationChange.renovationContract.number":$("#tblQuery").find("input[id='number']").val(),
  93. "decorationChange.renovationContract.name":$("#tblQuery").find("input[id='name']").val(),
  94. "decorationChange.title":$("#tblQuery").find("input[id='title']").val()
  95. });
  96. $('#decorationChangeDataGrid').datagrid({
  97. columns:columns,
  98. frozenColumns:frozenColumns
  99. });
  100. toolBar("decorationChangeDataGrid","setDecorationChangeDialog","decorationChange");
  101. }
  102. /*清除查询条件**/
  103. function ClearQuery() {
  104. $("#tblQuery").find("input").val("");
  105. $("#tblQuery").find("select").val("-1");
  106. }
  107. /**详细*/
  108. var detailsFormatter = function(value , row , index){
  109. return "<img src='<%=basePath%>/js/easyui/themes/itemicon/detail.png' title='查看详情' onclick=tenderDetails(" + row.id + ") style='cursor:pointer' />";
  110. };
  111. /**详细页面对话框*/
  112. var tenderDetails = function(id){
  113. $("#detailDialog").dialog(
  114. {
  115. buttons : [
  116. {
  117. text : '确定',
  118. iconCls : 'icon-ok',
  119. handler : function(){
  120. $("#detailDialog").dialog("close");
  121. }
  122. }
  123. ],
  124. onLoad : function(){
  125. detail_load(id);
  126. }
  127. }
  128. );
  129. };
  130. /**更新*/
  131. var updateFormatter = function(value , row , index){
  132. return "<img src='<%=basePath%>/images/pencil.png' title='修改' onclick=updateRow(" + row.id + ",'update') style='cursor:pointer' />";
  133. };
  134. /**更新事件*/
  135. function updateRow(){
  136. var row = $('#decorationChangeDataGrid').datagrid('getSelected');
  137. if(row == null){
  138. $.messager.alert("提示","请先选择要修改的变更信息!");
  139. }
  140. var id = row.id;
  141. param='update';
  142. $("#updateDialog").dialog(
  143. {
  144. buttons : [
  145. {
  146. text : '提交',
  147. iconCls : 'icon-ok',
  148. handler : function(){
  149. $('#updateDecorationChangeForm').form('submit',
  150. {
  151. url : whzl.basePath+'/decorationChangeAction_update',
  152. success : function(result){
  153. var parseResult = $.parseJSON(result);
  154. if(parseResult.success){
  155. $("#updateDialog").dialog("close");
  156. $('#decorationChangeDataGrid').datagrid('reload');
  157. }else{
  158. $.messager.alert("提示",parseResult.message);
  159. }
  160. }
  161. }
  162. );
  163. }
  164. },
  165. {
  166. text : '取消',
  167. iconCls : 'icon-cancel',
  168. handler : function(){
  169. $("#updateDialog").dialog("close");
  170. }
  171. }
  172. ],
  173. onLoad : function(){
  174. if(param == 'add'){
  175. $('#tabs_update').tabs('select', $('#tabs_update').tabs('getTabIndex', $('#tabs_update').tabs('getSelected')) + 1);
  176. }
  177. $.ajax({
  178. type: "post",//使用get方法访问后台
  179. dataType: "json",//返回json格式的数据
  180. url: "decorationChangeAction_findById",//要访问的后台地址
  181. data: "decorationChange.id="+id,//要发送的数据
  182. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  183. success: function(msg){//msg为返回的数据,在这里做数据绑定
  184. $("#id_update").val(msg.obj.id);
  185. $("#name_update").append("<a href='javascript:void(0);' onclick='js_method("+msg.obj.renovationContract.id+")'>"+msg.obj.renovationContract.name+"</a>");
  186. $("#number_update").append("<a href='javascript:void(0);' onclick='js_method("+msg.obj.renovationContract.id+")'>"+msg.obj.renovationContract.number+"</a>");
  187. $("#renovationContractId_update").val(msg.obj.renovationContract.id);
  188. $("#title_update").val(msg.obj.title);
  189. $("#content_update").val(msg.obj.content);
  190. $("#businessDate_update").datebox("setValue", msg.obj.businessDate);
  191. $("#businessUserName_update").val(msg.obj.businessUserName);
  192. $("#company_update").text(msg.obj.renovationContract.foreignCompany.name);
  193. $("#contractContent_update").text(msg.obj.renovationContract.content);
  194. for(var i=0;i< msg.obj.changeFile.length;i++){
  195. var $image = $("<div style='width: 100px;height: 40px;float:left;'><a href='" + msg.obj.changeFile[i].filePath + "' rel='lightbox[changeFile_update]'><img src='" + msg.obj.changeFile[i].filePath + "' width='100' height='40'/></a><img src='images/de.png' id='img" + msg.obj.changeFile[i].id + "' onclick='removeImg(" + msg.obj.changeFile[i].id + ")' width='15' height='15' style='float: right;position: relative;top: -38px;right: 2px; cursor:pointer;'></div>");
  196. $("#changeFile_update_file").append ($image);
  197. }
  198. $("#changeFile_update").change(
  199. function(){
  200. var obj = document.getElementById('changeFile_update');
  201. if(imageFormat(obj)){
  202. $('#updateDecorationChangeForm').form('submit',{
  203. url : whzl.basePath+'/decorationChangeAction_addUploadFile',
  204. success: function(result){
  205. $("#changeFile_update").attr("value","");
  206. $.ajax({
  207. type: "post",//使用get方法访问后台
  208. dataType: "json",//返回json格式的数据
  209. url: "decorationChangeAction_findById",//要访问的后台地址
  210. data: "decorationChange.id="+id,//要发送的数据
  211. success: function(msg){
  212. $("#changeFile_update_file").children('div').remove();
  213. for(var i=0;i< msg.obj.changeFile.length;i++){
  214. var $image = $("<div style='width: 100px;height: 40px;float:left;'><a href='" + msg.obj.changeFile[i].filePath + "' rel='lightbox[changeFile_update]'><img src='" + msg.obj.changeFile[i].filePath + "' width='100' height='40'/></a><img src='images/de.png' id='img" + msg.obj.changeFile[i].id + "' onclick='removeImg(" + msg.obj.changeFile[i].id + ")' width='15' height='15' style='float: right;position: relative;top: -38px;right: 2px; cursor:pointer;'></div>");
  215. $("#changeFile_update_file").append ($image);
  216. }
  217. }
  218. });
  219. }
  220. });
  221. }
  222. });
  223. }
  224. });
  225. }
  226. }
  227. );
  228. }
  229. /**新增装修合同*/
  230. function add(){
  231. $('#addDialog').dialog(
  232. {
  233. buttons : [
  234. {
  235. text : '下一步',
  236. iconCls : 'icon-redo',
  237. handler : function(){
  238. if($('#tabs').tabs('getTabIndex', $('#tabs').tabs('getSelected')) != 1){
  239. $('#tabs').tabs('select', $('#tabs').tabs('getTabIndex', $('#tabs').tabs('getSelected')) + 1);
  240. }else{
  241. parent.$.messager.progress({
  242. title : '提示',
  243. text : '保存中,请稍后....'
  244. });
  245. $('#addDecorationChangeForm').form('submit',
  246. {
  247. url : whzl.basePath+'/decorationChangeAction_add',
  248. onSubmit: function(){
  249. var isValid =$('#addDecorationChangeForm').form('validate');
  250. if(isValid == false){
  251. parent.$.messager.progress('close');
  252. }
  253. return isValid;
  254. },
  255. success : function(result){
  256. parent.$.messager.progress('close');
  257. var parseResult = $.parseJSON(result);
  258. if(parseResult.success){
  259. $("#addDialog").dialog("close");
  260. $('#decorationChangeDataGrid').datagrid('reload');
  261. }else{
  262. $.messager.alert("提示",parseResult.message);
  263. }
  264. }
  265. }
  266. );
  267. }
  268. }
  269. },
  270. {
  271. text : '取消',
  272. iconCls : 'icon-cancel',
  273. handler : function(){
  274. $("#addDialog").dialog("close");
  275. }
  276. }
  277. ],
  278. onLoad : function(){
  279. var curr_time = new Date();
  280. var strDate = curr_time.getFullYear()+"-";
  281. strDate += curr_time.getMonth()+1+"-";
  282. strDate += curr_time.getDate();
  283. $("#businessDate_add").datebox("setValue", strDate);
  284. }
  285. }
  286. );
  287. }
  288. function changeRenovationContract(param){
  289. $('#renovationContractDialog').dialog(
  290. {
  291. buttons : [
  292. {
  293. text : '确定',
  294. iconCls : 'icon-ok',
  295. handler : function(){
  296. var selectedItem = $('#renovationContractDataGrid').datagrid('getSelected');
  297. if(selectedItem == null){
  298. $.messager.alert("警告","请选择装修合同!");
  299. return;
  300. }
  301. if(param == 'add'){
  302. $("#number_add").append("<a href='javascript:void(0);' onclick='js_method("+selectedItem.id+")'>"+selectedItem.number+"</a>");
  303. $("#name_add").append("<a href='javascript:void(0);' onclick='js_method("+selectedItem.id+")'>"+selectedItem.name+"</a>");
  304. $("#renovationContractId_add").val(selectedItem.id);
  305. $("#company_add").text(selectedItem.foreignCompany.name);
  306. $("#content_add").text(selectedItem.content);
  307. }else{
  308. $("#number_update").val(selectedItem.number);
  309. $("#name_update").val(selectedItem.name);
  310. $("#renovationContractId_update").val(selectedItem.id);
  311. $("#company_update").text(selectedItem.foreignCompany.name);
  312. $("#content_update").text(selectedItem.content);
  313. }
  314. $("#renovationContractDialog").dialog("close");
  315. }
  316. },
  317. {
  318. text : '取消',
  319. iconCls : 'icon-cancel',
  320. handler : function(){
  321. $("#renovationContractDialog").dialog("close");
  322. }
  323. }
  324. ],
  325. onLoad : function(){
  326. renovationContract_load();
  327. }
  328. }
  329. );
  330. }
  331. //删除文件
  332. var removeImg = function(id){
  333. $.messager.confirm('提示', '确定删除么?删除后将无法恢复', function(r){
  334. if (r){
  335. $("#img" + id).parent().remove();
  336. $.ajax({
  337. type: "post",//使用post方法访问后台
  338. dataType: "json",//返回json格式的数据
  339. url:whzl.basePath + "/uploadFileAction_deleteUploadFile",
  340. data:{
  341. "uploadFile.id":id
  342. },
  343. error: function(msg){//msg为返回的数据,在这里做数据绑定
  344. $.messager.alert("提示","删除失败!");
  345. }
  346. });
  347. }
  348. });
  349. }
  350. /**合同编号*/
  351. var numberFormatter = function(value , row , index){
  352. return row.renovationContract.number;
  353. };
  354. /**合同名称*/
  355. var nameFormatter = function(value , row , index){
  356. return row.renovationContract.name;
  357. };
  358. /**格式化时间*/
  359. var dateFormatter = function(value,row,index){
  360. return dealDate(value);
  361. };
  362. /**删除*/
  363. var delFormatter = function(value , row , index){
  364. return "<img src='<%=basePath%>/images/edit_remove.png' title='删除' onclick=deleteRow(" + row.id + ") style='cursor:pointer' />";
  365. };
  366. /**删除功能*/
  367. function deleteRow(){
  368. var row = $('#decorationChangeDataGrid').datagrid('getSelected');
  369. if(row == null){
  370. $.messager.alert("提示","请先选择要删除的变更信息!");
  371. }
  372. var id = row.id;
  373. $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
  374. if (r){
  375. $.ajax({
  376. type: "post",//使用get方法访问后台
  377. dataType: "json",//返回json格式的数据
  378. url: "decorationChangeAction_del",//要访问的后台地址
  379. data: "decorationChange.id="+id,//要发送的数据
  380. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  381. success: function(msg){//msg为返回的数据,在这里做数据绑定
  382. if(msg.success){
  383. $.messager.alert('提示','删除成功!');
  384. $('#decorationChangeDataGrid').datagrid('reload');
  385. }else{
  386. $.messager.alert('提示','删除失败!');
  387. }
  388. }
  389. });
  390. }
  391. });
  392. }
  393. function js_method(id){
  394. $("#renovationContractDetailDialog").dialog(
  395. {
  396. buttons : [
  397. {
  398. text : '确定',
  399. iconCls : 'icon-ok',
  400. handler : function(){
  401. $("#renovationContractDetailDialog").dialog("close");
  402. }
  403. }
  404. ],
  405. onLoad : function(){
  406. detail_load(id);
  407. }
  408. }
  409. );
  410. }
  411. function imageFormat(obj){
  412. var files = obj.files;
  413. for(var i=0;i<files.length;i++){
  414. /**判断图片格式*/
  415. if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(files[i].name)){
  416. $.messager.alert('提示','图片类型必须是.gif,jpeg,jpg,png中的一种');
  417. return false;
  418. }
  419. /**判断图片大小*/
  420. if(files[i].size>1000*1024){
  421. $.messager.alert('提示','单张图片不得大于10M。');
  422. return false;
  423. }
  424. }
  425. return true;
  426. }
  427. </script>
  428. <div class="easyui-layout" data-options="fit:true,border:false">
  429. <div data-options="region:'center',border:false">
  430. <div id="searchtool" data-options="region:'north', border:false">
  431. <div class="clear"></div>
  432. <table id="tblQuery" style="width:100%;font-size:12px;">
  433. <tr>
  434. <td align="right" style="width: 10%"><span>变更标题</span></td>
  435. <td style="width: 10%">
  436. <input type="text" id="title">
  437. </td>
  438. <td align="right" style="width: 8%"><span>合同编号</span></td>
  439. <td style="width: 10%">
  440. <input type="text" id="number">
  441. </td>
  442. <td align="right" style="width: 8%"><span>合同名称</span></td>
  443. <td style="width: 18%">
  444. <input type="text" id="name">
  445. </td>
  446. <td align="left" style="width: 36%">
  447. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  448. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
  449. <a href="javascript:add();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">增加</a>
  450. <a href="javascript:updateRow();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
  451. <a href="javascript:deleteRow();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
  452. </td>
  453. </tr>
  454. </table>
  455. <div class="clear"></div>
  456. </div>
  457. <table id="decorationChangeDataGrid">
  458. <!--<thead frozen="true">
  459. <tr>
  460. <th data-options="field:'id',checkbox:true,width:30">ID</th>
  461. </tr>
  462. </thead>
  463. <thead>
  464. <tr>
  465. <th data-options="field:'title',sortable:true,width:200">标题</th>
  466. <th data-options="field:'number',sortable:true,width:90,formatter:numberFormatter">合同编号</th>
  467. <th data-options="field:'name',sortable:true,width:200,formatter:nameFormatter">合同名称</th>
  468. <th data-options="field:'businessUserName',sortable:true,width:100">变更人</th>
  469. <th data-options="field:'businessDate',sortable:true,width:100,formatter:dateFormatter">变更时间</th>
  470. <th data-options="field:'details',align:'center',width:60,formatter:detailsFormatter">查看详情</th>
  471. <th data-options="field:'update',align:'center',width:60,formatter:updateFormatter">修改</th>
  472. <th data-options="field:'delete',align:'center',width:38,formatter:delFormatter">删除</th>
  473. </tr>
  474. </thead>-->
  475. </table>
  476. </div>
  477. </div>
  478. <div id="detailDialog" data-options="title:'&nbsp;装修变更详细信息',iconCls:'icon-details',width:700,height:350,modal:true,href:'<%=basePath %>/decorationChangeAction_toDetail'"></div>
  479. <div id="updateDialog" data-options="title:'&nbsp;修改装修变更信息',iconCls:'icon-edit',width:700,height:350,modal:true,href:'<%=basePath %>/decorationChangeAction_toUpdate'"></div>
  480. <div id="addDialog" data-options="title:'&nbsp;增加装修变更',iconCls:'icon-add',width:700,height:400,modal:true,href:'<%=basePath %>/decorationChangeAction_toAdd'"></div>
  481. <div id="renovationContractDialog" data-options="title:'&nbsp;装修合同',iconCls:'icon-add',width:700,height:400,modal:true,href:'<%=basePath %>/constructionAction_toRenovationContractList'"></div>
  482. <div id="renovationContractDetailDialog" data-options="title:'&nbsp;装修合同详细信息',iconCls:'icon-details',width:700,height:400,modal:true,href:'<%=basePath %>/renovationContractAction_toDetail'"></div>
  483. <div id="constructionDetailDialog" data-options="title:'&nbsp;装修施工详细信息',iconCls:'icon-details',width:700,height:300,modal:true,href:'<%=basePath %>/constructionAction_toDetail'"></div>
  484. <div id="changeDetailDialog" data-options="title:'&nbsp;装修变更详细信息',iconCls:'icon-details',width:700,height:350,modal:true,href:'<%=basePath %>/decorationChangeAction_toDetail'"></div>
  485. <div id="acceptanceDetailDialog" data-options="title:'&nbsp;装修验收详细信息',iconCls:'icon-details',width:700,height:300,modal:true,href:'<%=basePath %>/decorationAcceptanceAction_toDetail'"></div>
  486. <div id="paymentDetailDialog" data-options="title:'&nbsp;装修付款详细信息',iconCls:'icon-details',width:700,height:300,modal:true,href:'<%=basePath %>/decorationPaymentAction_toDetail'"></div>
  487. <div id="setDecorationChangeDialog" data-options="title:'&nbsp;个性化设置',iconCls:'icon-cog',width:500,height:370,modal:true,href:'<%=basePath %>/columnSetAction_toSet?tname=decorationChange'">
  488. </div>
  489. <script type="text/javascript">
  490. <!--
  491. $(function(){
  492. parent.$.messager.progress('close');
  493. });
  494. //-->
  495. </script>