| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
- <%@include file="/context/mytags.jsp"%>
- <t:base type="jquery,easyui,tools,DatePicker"></t:base>
- <!-- 项目岗位明细表 -->
- <input name="postGeneralId" id="postGeneralId" type="hidden" value="${postGeneralId}" />
- <input name="pid" id="pid" type="hidden" value="${pid}" />
- <input name="rowIndex" id="rowIndex" type="hidden" value="" />
- <div class="easyui-layout" fit="true" >
- <div region="center" style="padding:0px;border:0px">
- <div title="新建数据" style="height:90px;" name="editPanel" id="editPanel" fit="true">
- <t:formvalid formid="formobj" dialog="true" layout="table" action="" tiptype="1" callback="callback">
- <input name="id" id="id" type="hidden" value="" />
- <table id="myTable" style="position:absolute;top:10px;">
- <tbody>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>项目岗位名称:
- </label>
- </td>
- <td class="value">
- <input id="ptjPostName" name="ptjPostName" type="text" style="width: 240px" class="inputxt" maxlength="20" datatype="*1-20" errormsg="项目岗位名称最多20文字" placeholder="请输入项目岗位名称(1-20字符)" ignore="checked"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">项目岗位名称</label>
-
- </td>
-
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>岗位类型:
- </label>
- </td>
- <td class="value">
- <%--update-start--Author:jg_renjie Date:20160320 for:#942 【组件封装】所属部门弹出模式,目前是列表,得改造成树方式--%>
- <input id="postName" name="postName" type="text" readonly="readonly" class="inputxt" datatype="*" value="${postName}" placeholder="请选择岗位" onclick="openDepartmentSelect()">
- <input id="postid" name="postid" type="hidden" value="${postid}">
- <a href="#" class="easyui-linkbutton" plain="true" icon="icon-search" id="departSearch" onclick="openDepartmentSelect()">选择</a>
- <a href="#" class="easyui-linkbutton" plain="true" icon="icon-undo" id="departRedo" onclick="callbackClean()">清空</a>
- <%--update-end--Author:jg_renjie Date:20160320 for:#942 【组件封装】所属部门弹出模式,目前是列表,得改造成树方式--%>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">岗位类型</label>
- </td>
- </tr>
- <tr >
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>所需人数:
- </label>
- </td>
- <td class="value">
- <input id="needNumber" name="needNumber" type="text" style="width: 240px" class="inputxt" maxlength="3" datatype="/^\d{1,3}$/" errormsg="所需人数数最多3位数字" placeholder="请输入所需人数"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">所需人数</label>
- </td>
- <td align="right">
- <label class="Validform_label">
- 备注:
- </label>
- </td>
- <td class="value">
- <input id="remark" name="remark" type="text" style="width: 340px" class="inputxt" maxlength="50" datatype="*0-50" errormsg="备注最多50文字" placeholder="请输入项目岗位备注" />
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">备注</label>
- </td>
- </tr>
- </tbody>
- </table>
- <div style="display:none"><input type="submit" id ="btnsub" value=""/></div>
- </t:formvalid>
- </div>
- <div title="" style="height:35px" name="editPanel2" id="editPanel2" fit="true">
- <a href="#" style="float: right;" class="easyui-linkbutton l-btn l-btn-plain" plain="true" icon="icon-undo" onclick="clearData()">清空</a>
- <a href="#" style="float: right;" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save" plain="true" onclick="btn_ok()">确定</a>
-
- </div>
- <div style="height:460px;">
- <t:datagrid name="projectPostDetailList" checkbox="false" fitColumns="true" title="${departname}项目岗位列表" actionUrl="projectPostDetailController.do?datagrid&ptjPostGeneralid=${postGeneralId}" idField="id" fit="true" pagination="false" queryMode="group">
- <t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="项目岗位名称" field="ptjPostName" queryMode="single" width="120"></t:dgCol>
- <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>
- <t:dgCol title="项目岗位总揽表ID" field="ptjPostGeneralid" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="所需人数" field="needNumber" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="备注" field="remark" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="创建人名称" field="createName" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="创建人登录名称" field="createBy" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="更新人名称" field="updateName" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="更新人登录名称" field="updateBy" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="更新日期" field="updateDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="所属部门" field="sysOrgCode" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="所属公司" field="sysCompanyCode" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol title="逻辑删除标识" field="deleteFlag" hidden="true" queryMode="single" dictionary="del_flag" width="120"></t:dgCol>
- <%-- <t:dgCol title="操作" field="opt"></t:dgCol>
- <t:dgDelOpt title="删除" url="projectPostDetailController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>
- <t:dgToolBar title="录入" icon="icon-add" operationCode="add" url="projectPostDetailController.do?goAdd" funname="add"></t:dgToolBar>
- <t:dgToolBar title="修改" icon="icon-edit" operationCode="edit" url="projectPostDetailController.do?goUpdate" funname="update"></t:dgToolBar>
- <t:dgToolBar title="批量删除" icon="icon-remove" operationCode="remove" url="projectPostDetailController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
- <t:dgToolBar title="查看" icon="icon-search" url="projectPostDetailController.do?goUpdate" funname="detail"></t:dgToolBar>
- <t:dgToolBar title="导入" icon="icon-putout" operationCode="put" funname="ImportXls"></t:dgToolBar>
- <t:dgToolBar title="导出" icon="icon-put" operationCode="put" funname="ExportXls"></t:dgToolBar>
- <t:dgToolBar title="模板下载" icon="icon-putout" operationCode="putout" funname="ExportXlsByT"></t:dgToolBar> --%>
- <t:dgToolBar title="删除" icon="icon-remove" operationCode="remove" funname="logicDel"></t:dgToolBar>
- </t:datagrid>
- </div>
-
- <script>
- $(function() {
- var datagrid = $("#editPanel");
- datagrid.next("div").next("div").after($("#tempSavePostInfo div[name='SavePostInfo1']").html());
- $("#tempSavePostInfo").html('');
- });
- </script>
- <div id="tempSavePostInfo" style="display: none;">
- <div name="SavePostInfo1">
- <div name="SavePostInfo" style="text-align: center;" class="datagrid-toolbar">
- <a href="#" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save" plain="true" onclick="savePostGeneral()">保存</a>
- <a href="#" class="easyui-linkbutton" plain="true" icon="icon-redo" id="departRedo" onclick="callbackPostGeneralList()">取消</a>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- <script src = "webpage/cn/com/lzt/projectpostdetail/projectPostDetailList.js"></script>
- <script type="text/javascript">
-
- //导入
- function ImportXls() {
- openuploadwin('Excel导入', 'projectPostDetailController.do?upload', "projectPostDetailList");
- }
- //导出
- function ExportXls() {
- JeecgExcelExport("projectPostDetailController.do?exportXls","projectPostDetailList");
- }
- //模板下载
- function ExportXlsByT() {
- JeecgExcelExport("projectPostDetailController.do?exportXlsByT","projectPostDetailList");
- }
- //新增
- function add(title,url,id){
- window.location.href=url
- }
- //修改
- function update(title,url, id){
- updateNotCreateWin("修改",url, "projectPostDetailList",false);
- }
- //查看
- function view(title,url, id){
- viewNotCreateWin("查看",url, "projectPostDetailList",false)
- }
-
- /* $(document).ready(function(){
- //datagrid 隐藏行号
- $('#projectPostDetailList').datagrid({rownumbers:false});
- }); */
-
-
- //自定义保存按钮
- function btn_ok(){
-
- debugger;
- var flag = $("#formobj").Validform().check(true);
- if(flag!=true){
- $("#btnsub").click();
- return false;
- }
- var id=$('#id').val();
- var ptjPostName=$('#ptjPostName').val();
- var postid=$('#postid').val();
- var needNumber=$('#needNumber').val();
- var remark=$('#remark').val();
- var rowIndex="";
- rowIndex=$('#rowIndex').val();
- $('#rowIndex').val("");
- //判断项目岗位名称是否重复;
- // if(ptjPostNameCheck(rowIndex)!=true){
- // return false;
- // }
- if(rowIndex.length==0){
- //index:要插入的行索引,如果该索引值未定义,则追加新行。
- //row:行数据。
- $('#projectPostDetailList').datagrid('insertRow',{
- //index: rowIndex, // 索引从0开始
- row: {
- ptjPostName: ptjPostName,
- postid: postid,
- needNumber: needNumber,
- remark:remark
- }
- });
- }else{
- $('#projectPostDetailList').datagrid('updateRow',{
- index: parseInt(rowIndex), // 索引从0开始,parseInt(rowIndex)解决行号变为01,11,22;
- row: {
- ptjPostName: ptjPostName,
- postid: postid,
- needNumber: needNumber,
- remark:remark
- }
- });
-
-
- }
- clearData();
- /* $.ajax({
- url : "projectPostDetailController.do?saveRows",
- type : 'post',
- data : {
- id : id,
- ptjPostName : ptjPostName,
- postid : postid,
- needNumber : needNumber,
- remark : remark
- },
- cache : false,
- success : function(data) {
- console.log(data);
- var d = data; // ------ $.parseJSON(data);
- callback(d);
- }
- }); */
- }
-
- //check项目岗位名称
- function ptjPostNameCheck(index){
- //获得所有行数据
- var rowsAll = $("#projectPostDetailList").datagrid('getData').rows;
- var ptjPostName=$('#ptjPostName').val()
- for(var i=0;i<rowsAll.length;i++){
- if(index.length==0){
- if(ptjPostName==rowsAll[i].ptjPostName){
- layer.alert("项目岗位名称已存在");
- return false;
- }else{
- return true;
- }
- }else{
- if(index!=i && ptjPostName==rowsAll[i].ptjPostName){
- layer.alert("项目岗位名称已存在");
- return false;
- }else{
- return true;
- }
- }
- }
- return true;
- }
-
-
-
- //保存数据后刷新当前页面数据
- function callback(data){
- //debugger;
- if(data.success){
- clearData();
- $("#projectPostDetailList").datagrid('reload');
- top.tip(data.msg);
- }
- else{
- top.tip(data.msg);
- }
- }
-
- //清空选择
- function callbackClean(){
- $('#postid').val('');
- $('#postName').val('');
- }
-
- //清空数据
- function clearData(){
- var rowData = {};
- fillData(rowData);
- $("#projectPostDetailList").datagrid('clearChecked');
- $("#projectPostDetailList").datagrid('unselectAll');
- //清空编辑时定义的rowIndex
- $("#rowIndex").val("");
- }
-
- function fillData(rowData){
- //清空表单
- $("#formobj").form('clear');
- //填充数据
- for(var d in rowData){
- $("#"+d).val(rowData[d]);
- }
- }
- //选择按钮
- function openDepartmentSelect() {
- //$.dialog.setting.zIndex = getzIndex();
- var orgIds = $("#postid").val();
- $.dialog({content: 'url:projectPostDetailController.do?postZTree&orgIds='+orgIds,
- zIndex:getzIndex(), title: '岗位类型选择', lock: true, width: '400px', height: '350px', opacity: 0.4, button: [
- {name: '<t:mutiLang langKey="common.confirm"/>', callback: callbackDepartmentSelect, focus: true},
- {name: '<t:mutiLang langKey="common.cancel"/>', callback: function (){}}
- ]}).zindex();
- }
-
- function callbackDepartmentSelect() {
- var iframe = this.iframe.contentWindow;
- var treeObj = iframe.$.fn.zTree.getZTreeObj("departSelect");
- var nodes = treeObj.getCheckedNodes(true);
- if(nodes.length>0){
- var ids='',names='';
- for(i=0;i<nodes.length;i++){
- var node = nodes[i];
- ids += node.id+',';
- names += node.name+',';
- }
- setCookie(ids);
- $('#postName').val(names);
- $('#postName').blur();
- $('#postid').val(ids);
- }else{
- tip("请选择岗位类型");
- return false;
- }
- }
-
- function callbackClean(){
- $('#postName').val('');
- $('#postid').val('');
- }
-
- //编辑数据输入框复现
- $(function(){
- $("#projectPostDetailList").datagrid({
- onClickRow: function(rowIndex, rowData){
- $('#rowIndex').val(rowIndex);
- $('#id').val(rowData.id);
- $('#ptjPostName').val(rowData.ptjPostName);
- $('#postid').val(rowData.postid+',');
- $('#needNumber').val(rowData.needNumber);
- $('#remark').val(rowData.remark);
- $.ajax({
- url : "projectPostDetailController.do?getPName",
- type : 'post',
- data : {
- id : rowData.postid
- },
- cache : false,
- success : function(data) {
- var d = data; // ------ $.parseJSON(data);
- $('#postName').val(d.msg);
- }
- });
- }
- });
- })
-
- //逻辑删除
- function logicDel(){
- var rows = $("#projectPostDetailList").datagrid('getSelections');
- if (rows.length > 0) {
- $.messager.confirm("确认", "确定要删除这条数据?", function (r) {
- if (r) {
- var rowIndex="";
- rowIndex=$('#rowIndex').val();
- $('#rowIndex').val("");
- $('#projectPostDetailList').datagrid('deleteRow',rowIndex);
- clearData();
- /* for ( var i = 0; i < rows.length; i++) {
- id=rows[i].id;
- }
- $.ajax({
- url : "projectPostDetailController.do?logicDel",
- type : 'post',
- data : {
- id : id
- },
- cache : false,
- success : function(data) {
- var d = data; // ------ $.parseJSON(data);
- if (d.success) {
- var msg = d.msg;
- tip(msg);
- $("#projectPostDetailList").datagrid('reload');
- clearData();
- id='';
- }
- }
- }); */
- }
- });
- } else {
- tip("请选择需要删除的数据");
- }
- }
-
- //取消
- function callbackPostGeneralList(){
- window.location.href="projectPostGeneralController.do?list";
- }
-
- //保存
- function savePostGeneral(){
- var postGeneralId=null;
- if($("#postGeneralId").val()!="undefined"){
- postGeneralId=$("#postGeneralId").val();
- }
- var pid=$("#pid").val();
- var overallSituation;
- //获得所有行数据
- var rowsAll = $("#projectPostDetailList").datagrid('getData').rows;
- if(rowsAll.length>0){
- for(var i=0;i<rowsAll.length;i++){
- if(i==0){
- overallSituation=rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
- }else{
- overallSituation+=","+rowsAll[i].ptjPostName+"-"+rowsAll[i].needNumber;
- }
- }
-
- var result={};
-
- result["projectPostDetailList["+0+"].id"]=postGeneralId;
- result["projectPostDetailList["+0+"].postid"]=pid;
- result["projectPostDetailList["+0+"].remark"]=overallSituation;
-
- for(var i=0;i<rowsAll.length;i++){
- for(var d in rowsAll[i]){
- result["projectPostDetailList["+parseInt(i+1)+"]."+d]=rowsAll[i][d];
- }
- //result["projectPostDetailList["+i+"]."+"pkid"]=$("#busId").val();
- }
- $.ajax({
- url : "projectPostGeneralController.do?saveRows",
- type : 'post',
- /* data : {
- id : 1,
- pid : pid,
- overallSituation : overallSituation,
- detailList: result
- }, */
- data : result,
- dataType:"json",
- cache : false,
- success : function(data) {
- if (data.success) {
- window.location.href="projectPostGeneralController.do?list";
- tip(data.msg);
- }
- }
- });
-
-
- }else{
- tip("请添加项目岗位明细数据");
- }
- }
-
-
-
- </script>
|