| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- function getSelectData(initData){
- var projId = $("#projId").val();
- if(projId != ""){
- $.ajax({
- type:"post",
- url:"TaskDetailAction.do?task=getSelectData4Edit&time=" + new Date().getTime(),
- data:{"projId":projId},
- timeout:20000,
- cache:false,
- dataType:"json",
- beforeSend:function(){
- $("#projNodeIdLoading").show();
- $("#taskTypeLoading").show();
- },
- success:function(data){
- var projNodeList = data.projNodeList;
- var taskTypeList = data.taskTypeList;
- var projNode = document.getElementById("projNodeId");
- var taskType = document.getElementById("taskType");
- taskType.options.length = 0;
- projNode.options.length = 0;
- for(var i = 0; i < taskTypeList.length; i++){
- addSelectOption(taskType, taskTypeList[i].dname, taskTypeList[i].dvalue);
- }
- for(var i = 0; i < projNodeList.length; i++){
- if(projNodeList[i].projectid){
- projNodeList[i].node_name = projNodeList[i].node_name + "(当前阶段)";
- }
- addSelectOption(projNode, projNodeList[i].node_name, projNodeList[i].universalid);
- }
- if(projId < 1){
- addSelectOption(projNode, "无", "0");
- }
- // 加一个空的option
- addSelectOption(taskType, "", "");
- taskType.value = "";
- },
- error:function(err){
- showAjaxError(err);
- },
- complete:function(msg,err){
- $("#projNodeIdLoading").hide();
- $("#taskTypeLoading").hide();
- if(initData != undefined){
- $("#projNodeId").val(initData.projNodeId);
- $("#taskType").val(initData.taskType);
- }
- }
- });
- }
- }
- function checkForm() {
- var rs = $.validate({
- name : "projId",
- model : [ {
- type : "require",
- msg : "请选择项目名称!"
- }]
- });
- rs = $.validate({
- name : "projNodeId",
- model : [ {
- type : "require",
- msg : "请选择项目阶段!"
- }]
- }) && rs;
- rs = $.validate({
- name : "taskName",
- model : [ {
- type : "require",
- msg : "请填写任务名称!"
- } , {
- type : "len",
- min : 1,
- max : 40,
- msg : "任务名称须少于20个汉字!"
- }]
- }) && rs;
- rs = $.validate({
- name : "taskType",
- model : [ {
- type : "require",
- msg : "请选择任务类型!"
- }]
- }) && rs;
- rs = $.validate({
- name : "taskContent",
- model : [ {
- type : "require",
- msg : "请填写任务描述!",
- msgBox:"taskContentMsg"
- }, {
- type : "len",
- min : 1,
- max : 4000,
- msg : "任务描述内容太长,请减少到2000个汉字以内!",
- msgBox:"taskContentMsg"
- } ]
- }) && rs;
- rs = $.validate({
- name : "planStartDate",
- model : [ {
- type : "require",
- msg : "请填写计划开始时间!"
- }]
- }) && rs;
- rs = $.validate({
- name : "planFinDate",
- model : [ {
- type : "require",
- msg : "请填写计划结束始时间!"
- }]
- }) && rs;
- // rs = $.validate({
- // name : "provUserName",
- // model : [ {
- // type : "require",
- // msg : "请选择指派人!"
- // } ]
- // }) && rs;
- // rs = $.validate({
- // name : "developUserName",
- // model : [ {
- // type : "require",
- // msg : "请选择责任人!"
- // } ]
- // }) && rs;
- rs = $.validate({
- name : "planManHour",
- model : [ {
- type : "regex",
- regex: new RegExp("[1-9]\d{0,}"),
- msg : "工时必须是大于0的数字"
- } ]
- }) && rs;
- if (rs) {
- return true;
- }
- return false;
- }
- function commitTask(btnObj){
- var isPass = checkForm();
- if(isPass){
- btnObj.disabled = true;
- $.ligerDialog.waitting("正在提交,请稍后……");
- $("#taskForm").submit();
- }else{
- btnObj.disabled = false;
- }
- }
- function initPlanStartDate(initValue){
- var id = "planStartDate";
- if(initValue){
- document.getElementById(id).value = initValue;
- }else{
- document.getElementById(id).value = getDates(new Date());
- }
- $("#" + id).ligerDateEditor({ labelAlign: 'left', width:100});
- }
- function initPlanFinDate(initValue){
- var id = "planFinDate";
- if(initValue){
- document.getElementById(id).value = initValue;
- }else{
- document.getElementById(id).value = getDates(new Date());
- }
- $("#" + id).ligerDateEditor({ labelAlign: 'left', width:100});
- }
- function initPlanStartTime(initValue){
- var id = "planStartTime";
- createHourOption4Select(id);
- if(initValue){
- document.getElementById(id).value = initValue;
- }else{
- document.getElementById(id).value = defaultWorkStartTime;
- }
- $("#" + id).ligerComboBox({width:70,slide:false});
- }
- function initPlanFinTime(initValue){
- var id = "planFinTime";
- createHourOption4Select("planFinTime");
- if(initValue){
- document.getElementById(id).value = initValue;
- }else{
- document.getElementById(id).value = defaultWorkEndTime;
- }
- $("#" + id).ligerComboBox({width:70,slide:false});
- }
- function change4UserTree(){
- var projId = $("#projId").val();
- $("#provUserId").val(curProvUserId);
- $("#provUserName").val(curProvUserName);
- $("#developUserId").val("");
- $("#developUserName").val("");
- if(projId){
- $("#provUserBtn").unbind("click");
- $("#developUserBtn").unbind("click");
- if(projId > 0){
- loadTypeTree("provUserBtn",{type:"singleuser",backId:"provUserId",backName:"provUserName",tab: "7", tabParam:[{tab:"7",root:projId}]});
- loadTypeTree("developUserBtn",{type:"singleuser",backId:"developUserId",backName:"developUserName",tab: "7", tabParam:[{tab:"7",root:projId}]});
- }else{
- if(userScope == "dept"){
- loadTypeTree("provUserBtn",{type:"singleuser",backId:"provUserId",backName:"provUserName",tab: "2"});
- loadTypeTree("developUserBtn",{type:"singleuser",backId:"developUserId",backName:"developUserName",tab: "2"});
- }else if(userScope == "all"){
- loadTypeTree("provUserBtn",{type:"singleuser",backId:"provUserId",backName:"provUserName",tab: "1,2"});
- loadTypeTree("developUserBtn",{type:"singleuser",backId:"developUserId",backName:"developUserName",tab: "1,2"});
- }else{
- loadTypeTree("provUserBtn",{type:"singleuser",backId:"provUserId",backName:"provUserName",tab: "2"});
- loadTypeTree("developUserBtn",{type:"singleuser",backId:"developUserId",backName:"developUserName",tab: "2"});
- }
- }
- }else{
- $("#provUserBtn").bind("click", function(){alert("请先选择项目!");});
- $("#developUserBtn").bind("click", function(){alert("请先选择项目!");});
- }
- }
|