123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- /**
- * 医共体
- */
- var HospitalInfo = {
- infoData: {},
- validateFields: {
- name: {
- validators: {
- notEmpty: {
- message: '医院名称不能为空'
- }
- }
- },
- communityId: {
- validators: {
- notEmpty: {
- message: '请选择医共体'
- }
- }
- },
- isGeneral: {
- validators: {
- notEmpty: {
- message: '请选择是否总院'
- }
- }
- },
- status: {
- validators: {
- notEmpty: {
- message: '启用状态不能为空'
- }
- }
- },
- num: {
- validators: {
- notEmpty: {
- message: '排序不能为空'
- },
- regexp: {
- regexp: /^\d+$/,
- message: '只能输入数字'
- }
- }
- }
- }
- };
- /**
- * 清除数据
- */
- HospitalInfo.clearData = function () {
- this.infoData = {};
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- HospitalInfo.set = function (key, val) {
- this.infoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
- return this;
- }
- /**
- * 设置对话框中的数据
- *
- * @param key 数据的名称
- * @param val 数据的具体值
- */
- HospitalInfo.get = function (key) {
- return $("#" + key).val();
- }
- /**
- * 关闭此对话框
- */
- HospitalInfo.close = function () {
- parent.layer.close(window.parent.Hospital.layerIndex);
- }
- /**
- * 收集数据
- */
- HospitalInfo.collectData = function () {
- this.set('id')
- .set('name')
- .set('communityId')
- .set('isGeneral')
- .set('status')
- .set('num')
- .set('description');
- }
- /**
- * 验证数据是否为空
- */
- HospitalInfo.validate = function () {
- $('#hospitalInfoForm').data("bootstrapValidator").resetForm();
- $('#hospitalInfoForm').bootstrapValidator('validate');
- return $("#hospitalInfoForm").data('bootstrapValidator').isValid();
- }
- /**
- * 提交修改
- */
- HospitalInfo.editSubmit = function () {
- this.clearData();
- this.collectData();
- if (!this.validate()) {
- return;
- }
- $('#hospitalInfoForm')[0].submit();
- }
- //回调
- HospitalInfo.callBack = function (data) {
- if (data.code == "200") {
- Feng.success(data.msg);
- window.parent.Hospital.table.refresh();
- HospitalInfo.close();
- } else {
- Feng.error(data.msg);
- }
- }
- $(function () {
- //下拉框数据回显
- $("select").each(function () {
- $(this).val($(this).attr("selectVal"));
- });
- Feng.initValidator("hospitalInfoForm", HospitalInfo.validateFields);
- });
|