list.jsp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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. var renovationStateObj = null;
  7. var renovationState_array = null;
  8. //选房状态
  9. var tenderTypeObj = null;
  10. var tenderType_array = null;
  11. /**招标信息显示区*/
  12. $(function() {
  13. //招标类别
  14. $.ajax({
  15. type: "post",//使用post方法访问后台
  16. dataType: "json",//返回json格式的数据
  17. url: "aa10Action_listAa10All",//要访问的后台地址
  18. data:{"aa10.letter":"tenderType" ,"aa10.name":"招标类别" },
  19. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  20. success: function(msg){//msg为返回的数据,在这里做数据绑定
  21. if(msg.success){
  22. tenderTypeObj = msg.obj.rows;
  23. var select_arr = [];
  24. var data = tenderTypeObj;
  25. for(var nItem = 0; nItem < data.length; nItem++ ){
  26. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  27. }
  28. tenderType_array = select_arr.join("");
  29. }
  30. }
  31. });
  32. //状态
  33. $.ajax({
  34. type: "post",//使用post方法访问后台
  35. dataType: "json",//返回json格式的数据
  36. url: "aa10Action_listAa10All",//要访问的后台地址
  37. data:{"aa10.letter":"renovationState" ,"aa10.name":"装修状态" },
  38. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  39. success: function(msg){//msg为返回的数据,在这里做数据绑定
  40. if(msg.success){
  41. renovationStateObj = msg.obj.rows;
  42. var select_arr = [];
  43. var data = renovationStateObj;
  44. for(var nItem = 0; nItem < data.length; nItem++ ){
  45. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  46. }
  47. renovationState_array = select_arr.join("");
  48. }
  49. }
  50. });
  51. $.ajax({
  52. type: "post",
  53. dataType: "json",
  54. url: "columnSetAction_listColumn?tname=renovationContract",
  55. complete :function(){$("#load").hide();},
  56. success: function(msg){
  57. if(msg.success){
  58. setId();
  59. var data = msg.obj;
  60. for(var i = 0;i<data.length;i++){
  61. if("1"==data[i].type){
  62. if(typeof(data[i].formatter)!="undefined"){
  63. data[i].formatter=eval(data[i].formatter);
  64. }
  65. user_columns.push(data[i]);
  66. }else{
  67. user_frozenColumns.push(data[i]);
  68. }
  69. }
  70. columns.push(user_columns);
  71. frozenColumns.push(user_frozenColumns);
  72. $('#renovationContractDataGrid').datagrid({
  73. rownumbers:true,
  74. fit:true,
  75. pageSize:10,
  76. pageList : [ 10, 20, 30, 40, 50 ],
  77. fitColumns:false,
  78. border:false,
  79. sortOrder:'desc',
  80. pagination:true,
  81. idField:'id',
  82. url:whzl.basePath + '/renovationContractAction_list',
  83. toolbar:'#searchtool',
  84. checkOnSelect:true,
  85. selectOnCheck:true,
  86. singleSelect:true,
  87. showFooter: true,
  88. columns:columns,
  89. frozenColumns:frozenColumns,
  90. loadFilter:function(result){
  91. if(result.success){
  92. return result.obj;
  93. }else{
  94. $.messager.alert("提示",result.message);
  95. return ;
  96. }
  97. }
  98. });
  99. toolBar("renovationContractDataGrid","setRenovationContractDialog","renovationContract");
  100. }
  101. }
  102. });
  103. /* $('#renovationContractDataGrid').datagrid({
  104. rownumbers:true,
  105. fit:true,
  106. pageSize:10,
  107. pageList : [ 10, 20, 30, 40, 50 ],
  108. fitColumns:false,
  109. border:false,
  110. sortOrder:'desc',
  111. pagination:true,
  112. idField:'id',
  113. url:whzl.basePath + '/renovationContractAction_list',
  114. toolbar:'#searchtool',
  115. checkOnSelect:true,
  116. selectOnCheck:false,
  117. nowrap:true,
  118. loadFilter:function(result){
  119. if(result.success){
  120. return result.obj;
  121. }else{
  122. $.messager.alert("提示",result.message);
  123. return ;
  124. }
  125. }
  126. }
  127. );*/
  128. });
  129. /**查询*/
  130. function searchFun(){
  131. /*var params = encodeURI("renovationContract.number="+trim($("#tblQuery").find("input[id='number']").val())+
  132. "&renovationContract.name="+trim($("#tblQuery").find("input[id='name']").val()));*/
  133. $("#renovationContractDataGrid").datagrid("load", {
  134. "renovationContract.number":$("#tblQuery").find("input[id='number']").val(),
  135. "renovationContract.name":$("#tblQuery").find("input[id='name']").val()
  136. });
  137. $('#renovationContractDataGrid').datagrid({
  138. columns:columns,
  139. frozenColumns:frozenColumns
  140. });
  141. toolBar("renovationContractDataGrid","setRenovationContractDialog","renovationContract");
  142. }
  143. /*清除查询条件**/
  144. function ClearQuery() {
  145. $("#tblQuery").find("input").val("");
  146. $("#tblQuery").find("select").val("-1");
  147. }
  148. /**详细*/
  149. var detailsFormatter = function(value , row , index){
  150. return "<img src='<%=basePath%>/js/easyui/themes/itemicon/detail.png' title='查看详情' onclick=tenderDetails(" + row.id + ") style='cursor:pointer' />";
  151. };
  152. /**详细页面对话框*/
  153. var tenderDetails = function(id){
  154. $("#detailDialog").dialog(
  155. {
  156. buttons : [
  157. {
  158. text : '确定',
  159. iconCls : 'icon-ok',
  160. handler : function(){
  161. $("#detailDialog").dialog("close");
  162. }
  163. }
  164. ],
  165. onLoad : function(){
  166. detail_load(id);
  167. }
  168. }
  169. );
  170. };
  171. /**更新*/
  172. var updateFormatter = function(value , row , index){
  173. if(row.renovationState == 1){
  174. return "<img src='<%=basePath%>/images/pencil.png' title='修改' onclick=updateRow(" + row.id + ",'update') style='cursor:pointer' />";
  175. }
  176. };
  177. function selectUpdate(){
  178. var row = $('#renovationContractDataGrid').datagrid('getSelected');
  179. if(row == null){
  180. $.messager.alert("提示","请先选择要修改的装修合同!");
  181. }
  182. var id = row.id;
  183. if(row.renovationState == 1){
  184. updateRow(id,'update');
  185. }else{
  186. $.messager.alert("提示","该装修合同不可修改!");
  187. }
  188. }
  189. /**更新事件*/
  190. function updateRow(id,param){
  191. $("#updateDialog").dialog({
  192. buttons : [{
  193. text : '提交',
  194. iconCls : 'icon-ok',
  195. handler : function(){
  196. $('#updateRenovationContractForm').form('submit',{
  197. url : whzl.basePath+'/renovationContractAction_update',
  198. success : function(result){
  199. var parseResult = $.parseJSON(result);
  200. if(parseResult.success){
  201. $("#updateDialog").dialog("close");
  202. $('#renovationContractDataGrid').datagrid('reload');
  203. }else{
  204. $.messager.alert("提示",parseResult.message);
  205. }
  206. }
  207. });
  208. }
  209. },{
  210. text : '取消',
  211. iconCls : 'icon-cancel',
  212. handler : function(){
  213. $("#updateDialog").dialog("close");
  214. }
  215. }],
  216. onLoad : function(){
  217. if(param == 'add'){
  218. $('#tabs_update').tabs('select', $('#tabs_update').tabs('getTabIndex', $('#tabs_update').tabs('getSelected')) + 1);
  219. }
  220. $.ajax({
  221. type: "post",//使用get方法访问后台
  222. dataType: "json",//返回json格式的数据
  223. url: "renovationContractAction_findById",//要访问的后台地址
  224. data: "renovationContract.id="+id,//要发送的数据
  225. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  226. success: function(msg){//msg为返回的数据,在这里做数据绑定
  227. $("#id_update").val(msg.obj.id);
  228. $("#name_update").val(msg.obj.name);
  229. $("#number_update").val(msg.obj.number);
  230. $("#tenderName_update").val(msg.obj.tender.name);
  231. $("#tenderId_update").val(msg.obj.tender.id);
  232. $("#b_update").val(msg.obj.b);
  233. $("#foreignCompanyId_update").val(msg.obj.foreignCompany.id);
  234. $("#money_update").numberbox('setValue', msg.obj.money);
  235. $("#paymentMethod_update").val(msg.obj.paymentMethod);
  236. $("#content_update").val(msg.obj.content);
  237. $("#contractDate_update").datebox("setValue", msg.obj.contractDate);
  238. for(var i=0;i< msg.obj.contractFile.length;i++){
  239. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.contractFile[i].filePath+" download="+msg.obj.contractFile[i].fileName+">"+msg.obj.contractFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.contractFile[i].id + "' onclick='removeImg(" + msg.obj.contractFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  240. $("#contractFile_update_file").append ($file);
  241. }
  242. $("#contractFile_update").change(
  243. function(){
  244. var obj = document.getElementById('contractFile_update');
  245. if(imageFormat(obj)){
  246. $('#updateRenovationContractForm').form('submit',{
  247. url : whzl.basePath+'/renovationContractAction_addUploadFile',
  248. success: function(result){
  249. $("#contractFile_update").attr("value","");
  250. $.ajax({
  251. type: "post",//使用get方法访问后台
  252. dataType: "json",//返回json格式的数据
  253. url: "renovationContractAction_findById",//要访问的后台地址
  254. data: "renovationContract.id="+id,//要发送的数据
  255. success: function(msg){
  256. $("#contractFile_update_file").children('div').remove();
  257. for(var i=0;i< msg.obj.contractFile.length;i++){
  258. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.contractFile[i].filePath+" download="+msg.obj.contractFile[i].fileName+">"+msg.obj.contractFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.contractFile[i].id + "' onclick='removeImg(" + msg.obj.contractFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  259. $("#contractFile_update_file").append ($file);
  260. }
  261. }
  262. });
  263. }
  264. });
  265. }
  266. });
  267. }
  268. });
  269. }
  270. });
  271. }
  272. /**新增装修合同*/
  273. function add(){
  274. $('#addDialog').dialog(
  275. {
  276. buttons : [
  277. {
  278. text : '确定',
  279. iconCls : 'icon-ok',
  280. handler : function(){
  281. parent.$.messager.progress({
  282. title : '提示',
  283. text : '保存中,请稍后....'
  284. });
  285. $('#addRenovationContractForm').form('submit',
  286. {
  287. url : whzl.basePath+'/renovationContractAction_add',
  288. onSubmit: function(){
  289. var isValid =$('#addRenovationContractForm').form('validate');
  290. if(isValid == false){
  291. parent.$.messager.progress('close');
  292. }
  293. return isValid;
  294. },
  295. success : function(result){
  296. parent.$.messager.progress('close');
  297. var parseResult = $.parseJSON(result);
  298. if(parseResult.success){
  299. $("#addDialog").dialog("close");
  300. $('#renovationContractDataGrid').datagrid('reload');
  301. var id = parseResult.obj.id;
  302. updateRow(id,'add');
  303. }else{
  304. $.messager.alert("提示",parseResult.message);
  305. }
  306. }
  307. }
  308. );
  309. }
  310. },
  311. {
  312. text : '取消',
  313. iconCls : 'icon-cancel',
  314. handler : function(){
  315. $("#addDialog").dialog("close");
  316. }
  317. }
  318. ],
  319. onLoad : function(){
  320. var curr_time = new Date();
  321. var strDate = curr_time.getFullYear()+"-";
  322. strDate += curr_time.getMonth()+1+"-";
  323. strDate += curr_time.getDate();
  324. $("#contractDate_add").datebox("setValue", strDate);
  325. }
  326. }
  327. );
  328. }
  329. function changeCompany(param){
  330. $('#companyDialog').dialog(
  331. {
  332. buttons : [
  333. {
  334. text : '确定',
  335. iconCls : 'icon-ok',
  336. handler : function(){
  337. var selectedItem = $('#foreignCompanyDataGrid').datagrid('getSelected');
  338. if(selectedItem == null){
  339. $.messager.alert("警告","请选择监理单位!");
  340. return;
  341. }
  342. $("#companyDialog").dialog("close");
  343. }
  344. },
  345. {
  346. text : '取消',
  347. iconCls : 'icon-cancel',
  348. handler : function(){
  349. $("#companyDialog").dialog("close");
  350. }
  351. }
  352. ]
  353. }
  354. );
  355. }
  356. function changeTender(param){
  357. $('#tenderDialog').dialog(
  358. {
  359. buttons : [
  360. {
  361. text : '确定',
  362. iconCls : 'icon-ok',
  363. handler : function(){
  364. var selectedItem = $('#tenderDataGrid').datagrid('getSelected');
  365. if(selectedItem == null){
  366. $.messager.alert("警告","请选择装修招标!");
  367. return;
  368. }
  369. if(param == 'add'){
  370. $("#tenderName_add").val(selectedItem.name);
  371. $("#tenderId_add").val(selectedItem.id);
  372. $("#b_add").val(selectedItem.bid);
  373. $("#foreignCompanyId_add").val(selectedItem.bidCompany.id);
  374. $("#money_add").numberbox('setValue', selectedItem.money);
  375. }else{
  376. $("#tenderName_update").val(selectedItem.name);
  377. $("#tenderId_update").val(selectedItem.tenderId);
  378. $("#b_update").val(selectedItem.bid);
  379. $("#foreignCompanyId_update").val(selectedItem.bidCompanyId);
  380. }
  381. $("#tenderDialog").dialog("close");
  382. }
  383. },
  384. {
  385. text : '取消',
  386. iconCls : 'icon-cancel',
  387. handler : function(){
  388. $("#tenderDialog").dialog("close");
  389. }
  390. }
  391. ]
  392. }
  393. );
  394. }
  395. //删除图片
  396. var removeImg = function(id){
  397. $.messager.confirm('提示', '确定删除么?删除后将无法恢复', function(r){
  398. if (r){
  399. $("#img" + id).parent().remove();
  400. $.ajax({
  401. type: "post",//使用post方法访问后台
  402. dataType: "json",//返回json格式的数据
  403. url:whzl.basePath + "/uploadFileAction_deleteUploadFile",
  404. data:{
  405. "uploadFile.id":id
  406. },
  407. error: function(msg){//msg为返回的数据,在这里做数据绑定
  408. $.messager.alert("提示","删除失败!");
  409. }
  410. });
  411. }
  412. });
  413. }
  414. /**状态*/
  415. var stateFormatter = function(value , row , index){
  416. var renovationState = "";
  417. for(var nItem = 0; nItem < renovationStateObj.length; nItem++ ){
  418. if(renovationStateObj[nItem].code == value){
  419. renovationState = renovationStateObj[nItem].value;
  420. break;
  421. }
  422. }
  423. return renovationState;
  424. };
  425. /**创建人*/
  426. var createUserFormatter = function(value , row , index){
  427. return row.createUser.fullName;
  428. };
  429. /**格式化时间*/
  430. var dateFormatter = function(value,row,index){
  431. return dealDate(value);
  432. };
  433. function imageFormat(obj){
  434. var files = obj.files;
  435. for(var i=0;i<files.length;i++){
  436. /**判断图片大小*/
  437. if(files[i].size>1000*1024){
  438. $.messager.alert('提示','单张图片不得大于10M。');
  439. return false;
  440. }
  441. }
  442. return true;
  443. }
  444. /**合同打印*/
  445. var printFormatter = function(value , row , index){
  446. return "<img src='<%=basePath%>/images/printer.png' title='选择合同模板' onclick=templetSelect(" + row.id + ") style='cursor:pointer' />";
  447. };
  448. function templetSelect(){
  449. var row = $('#renovationContractDataGrid').datagrid('getSelected');
  450. if(row == null){
  451. $.messager.alert("提示","请先选择要打印的装修合同!");
  452. }
  453. var id = row.id;
  454. $("#templetSelectDialog").dialog({
  455. buttons : [{
  456. text : '关闭',
  457. iconCls : 'icon-ok',
  458. handler : function(){
  459. $("#templetSelectDialog").dialog("close");
  460. }
  461. }],
  462. onLoad : function(){
  463. templet_load(id);
  464. }
  465. });
  466. }
  467. /**招标类别*/
  468. var tenderTypeFormatter = function(value , row , index){
  469. var tenderType = "";
  470. for(var nItem = 0; nItem < tenderTypeObj.length; nItem++ ){
  471. if(tenderTypeObj[nItem].code == value){
  472. tenderType = tenderTypeObj[nItem].value;
  473. break;
  474. }
  475. }
  476. return tenderType;
  477. };
  478. </script>
  479. <div class="easyui-layout" data-options="fit:true,border:false">
  480. <div data-options="region:'center',border:false">
  481. <div id="searchtool" data-options="region:'north', border:false">
  482. <div class="clear"></div>
  483. <table id="tblQuery" style="width:100%;font-size:12px;">
  484. <tr>
  485. <td align="right" style="width: 10%"><span>合同编号</span></td>
  486. <td style="width: 10%">
  487. <input type="text" name="renovationContract.number" id="number">
  488. </td>
  489. <td align="right" style="width: 8%"><span>合同名称</span></td>
  490. <td style="width: 18%">
  491. <input type="text" name="renovationContract.name" id="name">
  492. </td>
  493. <td align="left" style="width: 54%">
  494. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  495. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
  496. <a href="javascript:add();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">增加</a>
  497. <a href="javascript:selectUpdate();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
  498. <a href="javascript:templetSelect();" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:true">打印合同</a>
  499. </td>
  500. </tr>
  501. </table>
  502. <div class="clear"></div>
  503. </div>
  504. <table id="renovationContractDataGrid">
  505. <!--<thead>
  506. <tr>
  507. <th data-options="field:'number',sortable:true,width:90">合同编号</th>
  508. <th data-options="field:'name',sortable:true,width:200">合同名称</th>
  509. <th data-options="field:'money',sortable:true,width:100">合同金额</th>
  510. <th data-options="field:'amountPaid',sortable:true,width:100">已付款</th>
  511. <th data-options="field:'b',sortable:true,width:200">装修单位</th>
  512. <th data-options="field:'renovationState',sortable:true,width:100,formatter:stateFormatter">状态</th>
  513. <th data-options="field:'createUser',sortable:true,width:100,formatter:createUserFormatter">创建人</th>
  514. <th data-options="field:'createDate',sortable:true,width:100,formatter:dateFormatter">创建时间</th>
  515. <th data-options="field:'details',align:'center',width:60,formatter:detailsFormatter">查看详情</th>
  516. <th data-options="field:'update',align:'center',width:60,formatter:updateFormatter">修改</th>
  517. <th data-options="field:'print',align:'center',width:60,formatter:printFormatter">合同打印</th>
  518. </tr>
  519. </thead>-->
  520. </table>
  521. </div>
  522. </div>
  523. <div id="detailDialog" data-options="title:'&nbsp;装修合同详细信息',iconCls:'icon-details',width:700,height:400,modal:true,href:'<%=basePath %>/renovationContractAction_toDetail'"></div>
  524. <div id="updateDialog" data-options="title:'&nbsp;修改招标信息',iconCls:'icon-edit',width:700,height:400,modal:true,href:'<%=basePath %>/renovationContractAction_toUpdate'"></div>
  525. <div id="addDialog" data-options="title:'&nbsp;增加装修合同',iconCls:'icon-add',width:700,height:350,modal:true,href:'<%=basePath %>/renovationContractAction_toAdd'"></div>
  526. <div id="companyDialog" data-options="title:'&nbsp;监理单位',iconCls:'icon-add',width:700,height:400,modal:true,href:'<%=basePath %>/foreignCompanyAction_toCompanyList'"></div>
  527. <div id="tenderDialog" data-options="title:'&nbsp;装修招标',iconCls:'icon-add',width:700,height:350,modal:true,href:'<%=basePath %>/renovationContractAction_toTenderList'"></div>
  528. <div id="constructionDetailDialog" data-options="title:'&nbsp;装修施工详细信息',iconCls:'icon-details',width:700,height:300,modal:true,href:'<%=basePath %>/constructionAction_toDetail'"></div>
  529. <div id="changeDetailDialog" data-options="title:'&nbsp;装修变更详细信息',iconCls:'icon-details',width:700,height:350,modal:true,href:'<%=basePath %>/decorationChangeAction_toDetail'"></div>
  530. <div id="acceptanceDetailDialog" data-options="title:'&nbsp;装修验收详细信息',iconCls:'icon-details',width:700,height:300,modal:true,href:'<%=basePath %>/decorationAcceptanceAction_toDetail'"></div>
  531. <div id="paymentDetailDialog" data-options="title:'&nbsp;装修付款详细信息',iconCls:'icon-details',width:700,height:300,modal:true,href:'<%=basePath %>/decorationPaymentAction_toDetail'"></div>
  532. <div id="templetSelectDialog" data-options="title:'&nbsp;选择合同模板',iconCls:'icon-details',width:420,height:320,modal:true,href:'<%=basePath %>/renovationContractAction_toTempletSelect'">
  533. </div>
  534. <div id="setRenovationContractDialog" data-options="title:'&nbsp;个性化设置',iconCls:'icon-cog',width:500,height:370,modal:true,href:'<%=basePath %>/columnSetAction_toSet?tname=renovationContract'">
  535. </div>
  536. <script type="text/javascript">
  537. <!--
  538. $(function(){
  539. parent.$.messager.progress('close');
  540. });
  541. //-->
  542. </script>