123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- /**
- * 初始化主管部门审核配置详情对话框
- */
- var TalentcheckpropertiesInfoDlg = {
- talentcheckpropertiesInfoData : {},
- validateFields: {
- code:{
- validators: {
- notEmpty: {
- message: '人才标签不能为空'
- }
- }
- },
- companyId: {
- validators: {
- notEmpty: {
- message: '审核单位不能为空'
- }
- }
- },
- enterpriseId: {
- validators: {
- notEmpty: {
- message: '企业不能为空'
- }
- }
- }
- }
- };
- /**
- * 清除数据
- */
- TalentcheckpropertiesInfoDlg.clearData = function() {
- this.talentcheckpropertiesInfoData = {};
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- TalentcheckpropertiesInfoDlg.set = function(key, val) {
- this.talentcheckpropertiesInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
- return this;
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- TalentcheckpropertiesInfoDlg.get = function(key) {
- return $("#" + key).val();
- }
- /**
- * 关闭此对话框
- */
- TalentcheckpropertiesInfoDlg.close = function() {
- parent.layer.close(window.parent.Talentcheckproperties.layerIndex);
- }
- /**
- * 收集数据
- */
- TalentcheckpropertiesInfoDlg.collectData = function() {
- this
- .set('id')
- .set('code')
- .set('enterpriseId')
- .set('companyId')
- .set('description');
- }
- /**
- * 提交添加
- */
- TalentcheckpropertiesInfoDlg.addSubmit = function() {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/talentcheckproperties/add", function(data){
- if(data.code==200){
- Feng.success(data.msg);
- window.parent.Talentcheckproperties.table.refresh();
- TalentcheckpropertiesInfoDlg.close();
- }else{
- Feng.error(data.msg);
- }
- },function(data){
- Feng.error("添加失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.talentcheckpropertiesInfoData);
- ajax.start();
- }
- /**
- * 提交修改
- */
- TalentcheckpropertiesInfoDlg.editSubmit = function() {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/talentcheckproperties/update", function(data){
- if(data.code==200){
- Feng.success(data.msg);
- window.parent.Talentcheckproperties.table.refresh();
- TalentcheckpropertiesInfoDlg.close();
- }else{
- Feng.error(data.msg);
- }
- },function(data){
- Feng.error("修改失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.talentcheckpropertiesInfoData);
- ajax.start();
- }
- /**
- * 验证数据是否为空
- */
- TalentcheckpropertiesInfoDlg.validate = function () {
- $('#talentcheckpropertiesForm').data("bootstrapValidator").resetForm();
- $('#talentcheckpropertiesForm').bootstrapValidator('validate');
- return $("#talentcheckpropertiesForm").data('bootstrapValidator').isValid();
- }
- $(function() {
- Feng.initValidator("talentcheckpropertiesForm", TalentcheckpropertiesInfoDlg.validateFields);
- //下拉框数据动态加载
- Feng.addAjaxSelect({
- "id": "code",
- "displayCode": "code",
- "displayName": "name",
- "type": "GET",
- "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_jbt_talentType"
- });
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/talentcheckproperties/init", function(data){
- var enterprise = data.enterprises;
- var company = data.companys;
- var eHtml,cHtml = "<option value=''>请选择</option>";
- for(var key in enterprise){
- eHtml = eHtml + "<option value='"+enterprise[key].id+"'>"+enterprise[key].name+"</option>"
- }
- for(var key in company){
- cHtml = cHtml + "<option value='"+company[key].id+"'>"+company[key].name+"</option>"
- }
- $("#companyId").empty().append(cHtml);
- $("#enterpriseId").empty().append(eHtml);
- },function(data){
- Feng.error("初始失败!" + data.responseJSON.message + "!");
- });
- ajax.start();
- //下拉框数据回显
- $("select").each(function () {
- $(this).val($(this).attr("selectVal"));
- });
- });
|