123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- /**
- * 初始化人才津贴配置详情对话框
- */
- var AmountStandardInfoDlg = {
- amountStandardInfoData : {},
- validateFields: {
- type: {
- validators: {
- notEmpty: {
- message: '人才类型不能为空'
- }
- }
- },
- allowanceType: {
- validators: {
- notEmpty: {
- message: '津贴类型不能为空'
- }
- }
- },
- talentArrange: {
- validators: {
- notEmpty: {
- message: '人才层次不能为空'
- }
- }
- },
- money: {
- validators: {
- notEmpty: {
- message: '津贴类型不能为空'
- },
- regexp :{
- regexp: /^\d+$/,
- message:"只能输入数字"
- }
- }
- }
- }
- };
- /**
- * 清除数据
- */
- AmountStandardInfoDlg.clearData = function() {
- this.amountStandardInfoData = {};
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- AmountStandardInfoDlg.set = function(key, val) {
- this.amountStandardInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
- return this;
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- AmountStandardInfoDlg.get = function(key) {
- return $("#" + key).val();
- }
- /**
- * 关闭此对话框
- */
- AmountStandardInfoDlg.close = function() {
- parent.layer.close(window.parent.AmountStandard.layerIndex);
- }
- /**
- * 收集数据
- */
- AmountStandardInfoDlg.collectData = function() {
- this
- .set('id')
- .set('type')
- .set('allowanceType')
- .set('talentArrange')
- .set('money')
- .set('description');
- }
- /**
- * 验证数据是否为空
- */
- AmountStandardInfoDlg.validate = function () {
- $('#amountForm').data("bootstrapValidator").resetForm();
- $('#amountForm').bootstrapValidator('validate');
- return $("#amountForm").data('bootstrapValidator').isValid();
- }
- /**
- * 提交添加
- */
- AmountStandardInfoDlg.addSubmit = function() {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/amountStandard/add", function(data){
- if(data.code=="200"){
- Feng.success(data.msg);
- window.parent.AmountStandard.table.refresh();
- AmountStandardInfoDlg.close();
- }else{
- Feng.error(data.msg);
- }
- },function(data){
- Feng.error("添加失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.amountStandardInfoData);
- ajax.start();
- }
- /**
- * 提交修改
- */
- AmountStandardInfoDlg.editSubmit = function() {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- //提交信息
- var ajax = new $ax(Feng.ctxPath + "/amountStandard/update", function(data){
- Feng.success(data.msg);
- window.parent.AmountStandard.table.refresh();
- AmountStandardInfoDlg.close();
- },function(data){
- Feng.error("修改失败!" + data.responseJSON.message + "!");
- });
- ajax.set(this.amountStandardInfoData);
- ajax.start();
- }
- $(function() {
- Feng.initValidator("amountForm", AmountStandardInfoDlg.validateFields);
- //下拉框数据动态加载
- Feng.addAjaxSelect({
- "id": "talentArrange",
- "displayCode": "code",
- "displayName": "name",
- "type": "GET",
- "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_talentLevel"
- });
- //下拉框数据回显
- $("select").each(function () {
- $(this).val($(this).attr("selectVal"));
- });
- });
|