123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- /**
- * 初始化认定条件管理详情对话框
- */
- var IdentifyConditionInfoDlg = {
- identifyConditionInfoData : {},
- validateFields: {
- talentLevel: {
- validators: {
- notEmpty: {
- message: '人才层次不能为空'
- }
- }
- },
- type :{
- validators: {
- notEmpty: {
- message: '人才类别不能为空'
- }
- }
- },
- name: {
- validators: {
- notEmpty: {
- message: '名称不能为空'
- }
- }
- },
- active: {
- validators: {
- notEmpty: {
- message: '启用状态不能为空'
- }
- }
- },
- notWorkYear: {
- validators: {
- notEmpty: {
- message: '常年工作判定条件不能为空'
- }
- }
- },
- activeYear:{
- validators: {
- notEmpty: {
- message: '有效期不能为空'
- },
- regexp :{
- regexp: /^\d+$/,
- message:"只能输入数字"
- }
- }
- }
- }
- };
- /**
- * 清除数据
- */
- IdentifyConditionInfoDlg.clearData = function() {
- this.identifyConditionInfoData = {};
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- IdentifyConditionInfoDlg.set = function(key, val) {
- this.identifyConditionInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
- return this;
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- IdentifyConditionInfoDlg.get = function(key) {
- return $("#" + key).val();
- }
- /**
- * 关闭此对话框
- */
- IdentifyConditionInfoDlg.close = function() {
- parent.layer.close(window.parent.IdentifyCondition.layerIndex);
- }
- /**
- * 收集数据
- */
- IdentifyConditionInfoDlg.collectData = function() {
- this
- .set('id')
- .set('source')
- .set('type')
- .set('talentLevel')
- .set('name')
- .set('activeYear')
- .set('notWorkYear')
- .set('active')
- .set('description');
- var companys = $("#companyIds").val();
- var talentTypes = $("#talentTypes").val();
- var ids = "",talentTypeArr = "";
- for(var key in companys){
- if(Feng.isNotEmptyStr(companys[key])){
- ids = ids + companys[key]+",";
- }
- }
- if(Feng.isNotEmptyStr(ids)){
- ids = ids.substring(0,ids.length-1);
- }
- for(var key in talentTypes){
- if(Feng.isNotEmptyStr(talentTypes[key])){
- talentTypeArr = talentTypeArr + talentTypes[key]+",";
- }
- }
- if(Feng.isNotEmptyStr(talentTypeArr)){
- talentTypeArr = talentTypeArr.substring(0,talentTypeArr.length-1);
- }
- this.identifyConditionInfoData['companyIds'] = ids;
- this.identifyConditionInfoData['talentTypes'] = talentTypeArr;
- }
- /**
- * 提交添加
- */
- IdentifyConditionInfoDlg.addSubmit = function() {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- // if(this.identifyConditionInfoData.companyIds==null||this.identifyConditionInfoData.companyIds==''){
- // Feng.error("审核单位不能为空");return ;
- // }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/identifyCondition/add", function(data){
- if(data.code=="200"){
- Feng.success(data.msg);
- window.parent.IdentifyCondition.table.refresh();
- IdentifyConditionInfoDlg.close();
- }else{
- Feng.error(data.msg);
- }
- },function(data){
- Feng.error("添加失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.identifyConditionInfoData);
- ajax.start();
- }
- /**
- * 提交修改
- */
- IdentifyConditionInfoDlg.editSubmit = function() {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- // if(this.identifyConditionInfoData.companyIds==null||this.identifyConditionInfoData.companyIds==''){
- // Feng.error("审核单位不能为空");return ;
- // }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/identifyCondition/update", function(data){
- if(data.code=="200"){
- Feng.success(data.msg);
- window.parent.IdentifyCondition.table.refresh();
- IdentifyConditionInfoDlg.close();
- }else{
- Feng.error(data.msg);
- }
- },function(data){
- Feng.error("修改失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.identifyConditionInfoData);
- ajax.start();
- }
- /**
- * 验证数据是否为空
- */
- IdentifyConditionInfoDlg.validate = function () {
- $('#identifyConditionInfoForm').data("bootstrapValidator").resetForm();
- $('#identifyConditionInfoForm').bootstrapValidator('validate');
- return $("#identifyConditionInfoForm").data('bootstrapValidator').isValid();
- }
- $(function() {
- Feng.initValidator("identifyConditionInfoForm", IdentifyConditionInfoDlg.validateFields);
- //下拉框数据动态加载
- // Feng.addAjaxSelect({
- // "id": "talentLevel",
- // "displayCode": "code",
- // "displayName": "name",
- // "type": "GET",
- // "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_talentLevel"
- // });
- var arr = [{
- "name": "talentLevel",
- "code": "un_talentLevel"
- }, {
- "name": "talentTypes",
- "code": "un_jbt_talentType"
- }];
- Feng.findChildDictBatch(JSON.stringify(arr));
- Feng.addAjaxSelect({
- "id": "companyIds",
- "displayCode": "id",
- "displayName": "name",
- "type": "GET",
- "url": Feng.ctxPath + "/company/selectAll"
- });
- $('#companyIds').chosen({
- // search_contains:false,
- // enable_split_word_search: true
- });
- $('#talentTypes').chosen({
- search_contains:true, //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
- disable_search: false,
- width:"100%",
- enable_split_word_search: true
- });
- //下拉框数据回显
- $("select").each(function () {
- $(this).val($(this).attr("selectVal"));
- });
- var companyIds = $("#companyIds").attr("selectVal");
- var talentTypes = $("#talentTypes").attr("selectVal");
- if(Feng.isNotEmptyStr(companyIds)){
- $("#companyIds").val(companyIds.split(",")).trigger("chosen:updated");
- }
- if(Feng.isNotEmptyStr(talentTypes)){
- $("#talentTypes").val(talentTypes.split(",")).trigger("chosen:updated");
- }
- });
|