projectPostDetailList.jsp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  4. <!-- 项目岗位明细表 -->
  5. <style>
  6. .seachdiv{
  7. padding : 15px 30px;
  8. background-color: #ffffff;
  9. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.05);
  10. border: solid 1px #dcdcdc;
  11. margin: 10px 10px 0px 10px;
  12. margin-bottom:1px;
  13. }
  14. </style>
  15. <input name="pid" id="pid" type="hidden" value="${pid}" />
  16. <input name="rowIndex" id="rowIndex" type="hidden" value="" />
  17. <input name="ptjPostGeneralid" id="ptjPostGeneralid" type="hidden" value="${ptjPostGeneralid}" />
  18. <div class="easyui-layout" fit="true" >
  19. <div region="center" style="padding:0px;border:0px">
  20. <t:datagrid name="projectPostDetailList" checkbox="false" fitColumns="true" nowrap="false" title="${departname}-项目岗位列表" actionUrl="projectPostDetailController.do?datagrid&pid=${pid}" idField="id" fit="true" pagination="false" queryMode="group">
  21. <t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
  22. <t:dgCol title="项目岗位名称" field="ptjPostName" queryMode="single" width="120"></t:dgCol>
  23. <t:dgCol title="岗位类型" field="postid" queryMode="single" dictionary="t_bus_post,id,post_name, and delete_flag = '0' and status = '0'" width="120"></t:dgCol>
  24. <t:dgCol title="项目岗位总揽表ID" field="ptjPostGeneralid" hidden="true" queryMode="single" width="120"></t:dgCol>
  25. <t:dgCol title="所需人数" field="needNumber" style="text-align: right;" queryMode="single" width="120"></t:dgCol>
  26. <t:dgCol title="备注" field="remark" queryMode="single" width="120"></t:dgCol>
  27. <t:dgCol title="创建人名称" field="createName" hidden="true" queryMode="single" width="120"></t:dgCol>
  28. <t:dgCol title="创建人登录名称" field="createBy" hidden="true" queryMode="single" width="120"></t:dgCol>
  29. <t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
  30. <t:dgCol title="更新人名称" field="updateName" hidden="true" queryMode="single" width="120"></t:dgCol>
  31. <t:dgCol title="更新人登录名称" field="updateBy" hidden="true" queryMode="single" width="120"></t:dgCol>
  32. <t:dgCol title="更新日期" field="updateDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
  33. <t:dgCol title="所属部门" field="sysOrgCode" hidden="true" queryMode="single" width="120"></t:dgCol>
  34. <t:dgCol title="所属公司" field="sysCompanyCode" hidden="true" queryMode="single" width="120"></t:dgCol>
  35. <t:dgCol title="逻辑删除标识" field="deleteFlag" hidden="true" queryMode="single" dictionary="del_flag" width="120"></t:dgCol>
  36. <%-- <t:dgCol title="操作" field="opt"></t:dgCol>
  37. <t:dgDelOpt title="删除" url="projectPostDetailController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>
  38. <t:dgToolBar title="录入" icon="icon-add" operationCode="add" url="projectPostDetailController.do?goAdd" funname="add"></t:dgToolBar>
  39. <t:dgToolBar title="修改" icon="icon-edit" operationCode="edit" url="projectPostDetailController.do?goUpdate" funname="update"></t:dgToolBar>
  40. <t:dgToolBar title="批量删除" icon="icon-remove" operationCode="remove" url="projectPostDetailController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
  41. <t:dgToolBar title="查看" icon="icon-search" url="projectPostDetailController.do?goUpdate" funname="detail"></t:dgToolBar>
  42. <t:dgToolBar title="导入" icon="icon-putout" operationCode="put" funname="ImportXls"></t:dgToolBar>
  43. <t:dgToolBar title="导出" icon="icon-put" operationCode="put" funname="ExportXls"></t:dgToolBar>
  44. <t:dgToolBar title="模板下载" icon="icon-putout" operationCode="putout" funname="ExportXlsByT"></t:dgToolBar> --%>
  45. <t:dgToolBar title="删除" icon="icon-remove" operationCode="remove" funname="logicDel"></t:dgToolBar>
  46. </t:datagrid>
  47. <script>
  48. $(function() {
  49. var datagrid = $("#projectPostDetailListtb");
  50. datagrid.prepend($("#pinjie1 div[name='pinjie2']").html());
  51. $("#pinjie1").html('');
  52. /* datagrid.children("span:first").after($("#hengxian1 div[name='hengxian2']").html());
  53. $("#hengxian1").html(''); */
  54. /* datagrid.children(".datagrid-toolbar").children("span:first").after($("#pinjiechaxun1 div[name='pinjiechaxun2']").html());
  55. $("#pinjiechaxun1").html(''); */
  56. //datagrid.children(".datagrid-toolbar").children("span:first").before($("#hengxian1 div[name='hengxian2']").html());
  57. // $("#hengxian1").html('');
  58. datagrid.children(".datagrid-toolbar").children("span:first").before($("#pinjie2 div[name='pinjie21']").html());
  59. $("#pinjie2").html('');
  60. });
  61. </script>
  62. <div id="pinjie1">
  63. <div name="pinjie2" style="padding:3px; height: auto" >
  64. <div title="新建数据" name="editPanel" id="editPanel" fit="true" class="seachdiv">
  65. <t:formvalid formid="formobj" dialog="false" tipSweep="true" layout="table" action="" tiptype="1" callback="callback">
  66. <input name="id" id="id" type="hidden" value="" />
  67. <table id="myTable" >
  68. <tbody>
  69. <tr>
  70. <td align="right">
  71. <label class="Validform_label">
  72. <span color="red" class="requiredIcon">*</span>项目岗位名称:
  73. </label>
  74. </td>
  75. <td class="value">
  76. <input id="ptjPostName" name="ptjPostName" type="text" style="width: 240px" class="inputxt" maxlength="20" datatype="*1-20" errormsg="项目岗位名称最多20文字" placeholder="请输入项目岗位名称(1-20字符)" ignore="ignore"/>
  77. <span class="Validform_checktip"></span>
  78. <label class="Validform_label" style="display: none;">项目岗位名称</label>
  79. </td>
  80. <td align="right">
  81. <label class="Validform_label">
  82. <span color="red" class="requiredIcon">*</span>岗位类型:
  83. </label>
  84. </td>
  85. <td class="value">
  86. <%--update-start--Author:jg_renjie Date:20160320 for:#942 【组件封装】所属部门弹出模式,目前是列表,得改造成树方式--%>
  87. <input id="postName" name="postName" type="text" readonly="readonly" class="inputxt" datatype="*" value="${postName}" placeholder="请选择岗位" onclick="openDepartmentSelect()" ignore="ignore">
  88. <input id="postid" name="postid" type="hidden" value="${postid}">
  89. <a href="#" class="easyui-linkbutton" plain="true" icon="icon-select" id="departSearch" onclick="openDepartmentSelect()">选择</a>
  90. <a href="#" class="easyui-linkbutton" plain="true" icon="icon-clean" id="departRedo" onclick="callbackClean()">清空</a>
  91. <%--update-end--Author:jg_renjie Date:20160320 for:#942 【组件封装】所属部门弹出模式,目前是列表,得改造成树方式--%>
  92. <span class="Validform_checktip"></span>
  93. <label class="Validform_label" style="display: none;">岗位类型</label>
  94. </td>
  95. </tr>
  96. <tr >
  97. <td align="right">
  98. <label class="Validform_label">
  99. <span color="red" class="requiredIcon">*</span>所需人数:
  100. </label>
  101. </td>
  102. <td class="value">
  103. <!-- <input id="needNumber" name="needNumber" type="text" style="width: 240px" class="inputxt" maxlength="3" datatype="/^\d{1,3}$/" errormsg="所需人数数最多3位数字" placeholder="请输入所需人数" ignore="ignore"/> -->
  104. <input id="needNumber" name="needNumber" type="text" style="width: 240px" class="inputxt" maxlength="3" placeholder="请输入所需人数" ignore="ignore"/>
  105. <span class="Validform_checktip"></span>
  106. <label class="Validform_label" style="display: none;">所需人数</label>
  107. </td>
  108. <td align="right">
  109. <label class="Validform_label">
  110. 备注:
  111. </label>
  112. </td>
  113. <td class="value">
  114. <input id="remark" name="remark" type="text" style="width: 340px" class="inputxt" maxlength="50" datatype="*0-50" errormsg="备注最多50文字" placeholder="请输入项目岗位备注" />
  115. <span class="Validform_checktip"></span>
  116. <label class="Validform_label" style="display: none;">备注</label>
  117. </td>
  118. <td>
  119. <div style="margin-left: 60px;">
  120. <a href="#" style="float: right;" class="easyui-linkbutton l-btn l-btn-plain" plain="true" icon="icon-clean" onclick="clearData()">清空</a>
  121. <a href="#" style="float: right;" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save" plain="true" onclick="btn_ok()">保存</a>
  122. </div>
  123. </td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. <div style="display:none"><input type="submit" id ="btnsub" value=""/></div>
  128. </t:formvalid>
  129. </div>
  130. <!-- <div title="" style="height:35px" name="editPanel2" id="editPanel2" fit="true">
  131. <a href="#" style="float: right;" class="easyui-linkbutton l-btn l-btn-plain" plain="true" icon="icon-clean" onclick="clearData()">清空</a>&nbsp;&nbsp;&nbsp;
  132. <a href="#" style="float: right;" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save" plain="true" onclick="btn_ok()">保存</a>
  133. </div> -->
  134. </div>
  135. </div>
  136. <!-- <script>
  137. $(function() {
  138. var datagrid = $(".datagrid-view");
  139. datagrid.after($("#tempSavePostInfo div[name='SavePostInfo1']").html());
  140. $("#tempSavePostInfo").html('');
  141. });
  142. </script>
  143. <div id="tempSavePostInfo" style="display: none;">
  144. <div name="SavePostInfo1">
  145. <div name="SavePostInfo" style="text-align: center;" class="datagrid-toolbar">
  146. <a href="#" class="easyui-linkbutton" plain="true" icon="icon-return" id="departRedo" onclick="callbackPostGeneralList()">返回</a>
  147. </div>
  148. </div>
  149. </div> -->
  150. <div id="pinjie2" style="display: none;">
  151. <div name="pinjie21">
  152. <span style="float:left;margin-bottom:4px;">
  153. <a href="#" class="easyui-linkbutton" plain="true" icon="icon-return" id="departRedo" onclick="callbackPostGeneralList()">返回</a>
  154. </span>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <script src = "webpage/cn/com/lzt/projectpostdetail/projectPostDetailList.js"></script>
  160. <script type="text/javascript">
  161. //导入
  162. function ImportXls() {
  163. openuploadwin('Excel导入', 'projectPostDetailController.do?upload', "projectPostDetailList");
  164. }
  165. //导出
  166. function ExportXls() {
  167. JeecgExcelExport("projectPostDetailController.do?exportXls","projectPostDetailList");
  168. }
  169. //模板下载
  170. function ExportXlsByT() {
  171. JeecgExcelExport("projectPostDetailController.do?exportXlsByT","projectPostDetailList");
  172. }
  173. //新增
  174. function add(title,url,id){
  175. window.location.href=url;
  176. }
  177. //修改
  178. function update(title,url, id){
  179. updateNotCreateWin("修改",url, "projectPostDetailList",false);
  180. }
  181. //查看
  182. function view(title,url, id){
  183. viewNotCreateWin("查看",url, "projectPostDetailList",false);
  184. }
  185. /* $(document).ready(function(){
  186. //datagrid 隐藏行号
  187. $('#projectPostDetailList').datagrid({rownumbers:false});
  188. }); */
  189. //正则验证只能输入最多3位数
  190. //datatype="/^\d{1,6}(?:\.\d{0,2}$|$)/"
  191. function regx(str){
  192. var regx = /^\d{1,3}$/;
  193. if(regx.test(str)){
  194. return true;
  195. }else{
  196. return false;
  197. }
  198. }
  199. //自定义保存按钮
  200. function btn_ok(){
  201. var flag = $("#formobj").Validform().check(true);
  202. if(flag!=true){
  203. $("#btnsub").click();
  204. return false;
  205. }
  206. var id=$('#id').val();
  207. var ptjPostName=$('#ptjPostName').val();
  208. var ptjPostGeneralid=$('#ptjPostGeneralid').val();
  209. var pid=$('#pid').val();
  210. var postid=$('#postid').val();
  211. var needNumber=$('#needNumber').val();
  212. var remark=$('#remark').val();
  213. if(ptjPostName.length==0){
  214. layer.alert("请输入项目岗位名称");
  215. return false;
  216. }
  217. if(ptjPostName!=null&&ptjPostName.length>0){
  218. if(ptjPostName.indexOf(",")!=-1){
  219. layer.alert("项目岗位名称不允许有逗号");
  220. return false;
  221. }
  222. }
  223. if(postid.length==0){
  224. layer.alert("请选择岗位类型");
  225. return false;
  226. }
  227. if(needNumber.length==0){
  228. layer.alert("请输入所需人数");
  229. return false;
  230. }
  231. if(isNaN(needNumber)==true||parseInt(needNumber)<=0){
  232. layer.alert("所需人数请输入合法格式的数字");
  233. return false;
  234. }
  235. //check项目岗位名称
  236. $.ajax({
  237. url : "projectPostGeneralController.do?ajaxCheckPtjPostName",
  238. type : 'post',
  239. data : {
  240. id : id,
  241. ptjPostName : ptjPostName,
  242. pid : pid
  243. },
  244. cache : false,
  245. success : function(data) {
  246. var d = data; // ------ $.parseJSON(data);
  247. if(d.success==false){
  248. layer.alert(d.msg);
  249. return false;
  250. }else{
  251. var overallSituation="";
  252. //获得所有行数据
  253. var rowsAll = $("#projectPostDetailList").datagrid('getData').rows;
  254. if(rowsAll.length>0){
  255. for(var i=0;i<rowsAll.length;i++){
  256. if(id!=null&&id.length>0){
  257. if(rowsAll[i].id!=id){
  258. if(overallSituation.length==0){
  259. overallSituation=rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
  260. }else{
  261. overallSituation+=","+rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
  262. }
  263. }
  264. }else{
  265. if(overallSituation.length==0){
  266. overallSituation=rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
  267. }else{
  268. overallSituation+=","+rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
  269. }
  270. }
  271. }
  272. }
  273. if(overallSituation.length==0){
  274. overallSituation=ptjPostName+"-"+needNumber;
  275. }else{
  276. overallSituation+=","+ptjPostName+"-"+needNumber;
  277. }
  278. $.ajax({
  279. url : "projectPostGeneralController.do?saveRows",
  280. type : 'post',
  281. data : {
  282. id : id,
  283. ptjPostName : ptjPostName,
  284. ptjPostGeneralid : ptjPostGeneralid,
  285. pid : pid,
  286. postid : postid,
  287. needNumber : needNumber,
  288. remark : remark,
  289. overallSituation : overallSituation
  290. },
  291. cache : false,
  292. success : function(data) {
  293. var d = data; // ------ $.parseJSON(data);
  294. if(d.attributes.ptjPostGeneralid!=null&&d.attributes.ptjPostGeneralid.length>0){
  295. $('#ptjPostGeneralid').val(d.attributes.ptjPostGeneralid);
  296. }
  297. callback(d);
  298. }
  299. });
  300. }
  301. }
  302. });
  303. }
  304. //check项目岗位名称
  305. /* function ptjPostNameCheck(id,ptjPostName,pid){
  306. $.ajax({
  307. url : "projectPostGeneralController.do?ajaxCheckPtjPostName",
  308. type : 'post',
  309. data : {
  310. id : id,
  311. ptjPostName : ptjPostName,
  312. pid : pid
  313. },
  314. cache : false,
  315. success : function(data) {
  316. var d = data; // ------ $.parseJSON(data);
  317. if(d.success==false){
  318. layer.alert(d.msg);
  319. return false;
  320. }
  321. }
  322. });
  323. } */
  324. //保存数据后刷新当前页面数据
  325. function callback(data){
  326. //debugger;
  327. if(data.success){
  328. // var ptjPostGeneralid=$('#ptjPostGeneralid').val();
  329. clearData();
  330. // var myFormUrl="projectPostDetailController.do?datagrid&ptjPostGeneralid="+ptjPostGeneralid;
  331. // $("#projectPostDetailListtb").attr("actionUrl",myFormUrl);
  332. $("#projectPostDetailList").datagrid('reload');
  333. top.tip(data.msg);
  334. }else{
  335. layer.alert(data.msg);
  336. }
  337. }
  338. //清空数据
  339. function clearData(){
  340. var rowData = {};
  341. fillData(rowData);
  342. $("#projectPostDetailList").datagrid('clearChecked');
  343. $("#projectPostDetailList").datagrid('unselectAll');
  344. //清空编辑时定义的rowIndex
  345. // $("#rowIndex").val("");
  346. }
  347. function fillData(rowData){
  348. //清空表单
  349. $("#formobj").form('clear');
  350. //填充数据
  351. for(var d in rowData){
  352. $("#"+d).val(rowData[d]);
  353. }
  354. }
  355. /* $(document).ready(function(){
  356. //动态添加form表单actionUrl数据
  357. function getmyptjPostGeneralid(){
  358. var ptjPostGeneralid=$('#ptjPostGeneralid').val();
  359. return ptjPostGeneralid;
  360. }
  361. }); */
  362. //选择按钮
  363. function openDepartmentSelect() {
  364. //$.dialog.setting.zIndex = getzIndex();
  365. var orgIds = $("#postid").val();
  366. $.dialog({content: 'url:projectPostDetailController.do?postZTree&orgIds='+orgIds,
  367. zIndex:getzIndex(), title: '岗位类型选择', lock: true, width: '400px', height: '350px', opacity: 0.4, button: [
  368. {name: '<t:mutiLang langKey="common.confirm"/>', callback: callbackDepartmentSelect, focus: true},
  369. {name: '<t:mutiLang langKey="common.cancel"/>', callback: function (){}}
  370. ]}).zindex();
  371. }
  372. function callbackDepartmentSelect() {
  373. var iframe = this.iframe.contentWindow;
  374. var treeObj = iframe.$.fn.zTree.getZTreeObj("departSelect");
  375. var nodes = treeObj.getCheckedNodes(true);
  376. if(nodes.length>0){
  377. var ids='',names='';
  378. for(var i=0;i<nodes.length;i++){
  379. var node = nodes[i];
  380. ids += node.id+',';
  381. names += node.name+',';
  382. }
  383. // setCookie(ids);
  384. if(names.length!=0){
  385. $('#postName').val(names.substring(0,names.length-1));
  386. }
  387. $('#postName').blur();
  388. $('#postid').val(ids);
  389. }else{
  390. layer.alert("请选择岗位类型");
  391. return false;
  392. }
  393. }
  394. function callbackClean(){
  395. $('#postName').val('');
  396. $('#postid').val('');
  397. }
  398. //编辑数据输入框复现
  399. $(function(){
  400. $("#projectPostDetailList").datagrid({
  401. onClickRow: function(rowIndex, rowData){
  402. $('#rowIndex').val(rowIndex);
  403. $('#id').val(rowData.id);
  404. $('#ptjPostName').val(rowData.ptjPostName);
  405. $('#postid').val(rowData.postid+',');
  406. $('#needNumber').val(rowData.needNumber);
  407. $('#remark').val(rowData.remark);
  408. $.ajax({
  409. url : "projectPostDetailController.do?getPName",
  410. type : 'post',
  411. data : {
  412. id : rowData.postid
  413. },
  414. cache : false,
  415. success : function(data) {
  416. var d = data; // ------ $.parseJSON(data);
  417. $('#postName').val(d.msg);
  418. }
  419. });
  420. }
  421. });
  422. });
  423. //逻辑删除
  424. function logicDel(){
  425. var rows = $("#projectPostDetailList").datagrid('getSelections');
  426. if (rows.length > 0) {
  427. $.messager.confirm("确认", "确定要删除这条数据?", function (r) {
  428. if (r) {
  429. var id="";
  430. for ( var i = 0; i < rows.length; i++) {
  431. id=rows[0].id;
  432. }
  433. var ptjPostGeneralid=$('#ptjPostGeneralid').val();
  434. var pid=$('#pid').val();
  435. var overallSituation="";
  436. //获得所有行数据
  437. var rowsAll = $("#projectPostDetailList").datagrid('getData').rows;
  438. if(rowsAll.length>0){
  439. for(var i=0;i<rowsAll.length;i++){
  440. if(rowsAll[i].id!=id){
  441. if(overallSituation.length==0){
  442. overallSituation=rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
  443. }else{
  444. overallSituation+=","+rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
  445. }
  446. }
  447. }
  448. }
  449. $.ajax({
  450. url : "projectPostGeneralController.do?logicDelProjectPostDetailUpdateProjectPostGeneral",
  451. type : 'post',
  452. data : {
  453. id : id,
  454. ptjPostGeneralid : ptjPostGeneralid,
  455. pid : pid,
  456. overallSituation : overallSituation
  457. },
  458. cache : false,
  459. success : function(data) {
  460. var d = data; // ------ $.parseJSON(data);
  461. if (d.success) {
  462. tip(d.msg);
  463. $("#projectPostDetailList").datagrid('reload');
  464. clearData();
  465. id='';
  466. }else{
  467. layer.alert(d.msg);
  468. }
  469. }
  470. });
  471. }
  472. });
  473. } else {
  474. layer.alert("请选择需要删除的数据");
  475. }
  476. }
  477. //取消
  478. function callbackPostGeneralList(){
  479. window.location.href="projectPostGeneralController.do?list";
  480. }
  481. //保存
  482. function savePostGeneral(){
  483. window.location.href="projectPostGeneralController.do?list";
  484. }
  485. </script>