/** * 编码规则 * @author wangting@2021-7-16 */ layui.define(['layer','element','form','table','util'],function(exports){ var Class = function(){ this.MODELNAME = "platform/objectService/OsCodeRule"; this.moduleKey = "OsCodeRule"; this.id='OsCodeRule'; this.sourceData={}; this.columns = []; this.backPath = configData.compatibility?path:configData.objectServicePath; this.url={ controller:'codeRuleController/', dataGrid:'dataGrid', dataGridDetail:'dataGridElement', addSave:'addRule', editSave:'editRule', deleteUrl:'deleteRule', getObjectByOid:'getObjectByOid', enableData: 'enableRule', disableData: 'disableRule', getBtmTypeByOid:'btmTypeController/getBtmTypeByOid' }; this.buttonIconMap = { SEARCH:'layui-icon-refresh-2', SENIORSEARCH:'layui-icon-query', ADD:'layui-icon-add-1', EDIT:'layui-icon-edit', DELETE:'layui-icon-delete' }; this.vciFieldTypeMap = { VTBoolean:"布尔型", VTClob: "长文本", VTDate:"日期", VTDateTime:"日期时间", VTTime:"时间", VTLong:"长整型", VTDouble:"金额/双精度", VTInteger:"整形", VTFilePath:"文件", VTString:"字符串" }; this.btmTypeOid=null; this.getContent=function(){//返回这个组件的基础html var that = this; var html = ""; html = [ '
', '
', '
', that.getToolbarHtml(), '
', '
', '
', '
', '
', '
', '
' ].join(""); return html; }; this.getToolbarHtml = function () { var that = this; var html = [ '
', '', '', '', '', '', '', '', '
' ].join(""); return html; }; this.createSearchHtml = function () { var that = this; $webUtil.bindDefultButtonLisenter(that, that.id); $webUtil.createSearchHtml({ id: "方案编号", name: "名称", btmTypeName: "业务类型名称" }, $("[layui-filter='toolbar_" + that.id + "']"), "table_" + that.id); }; this.init=function(){//基础的html被添加后,再执行初始化 var that = this; $webUtil.copyConfig(that,that.moduleKey); that.initMainTable(); that.createSearchHtml(); that.initDetailTable('detail_' + that.id); }; this.initMainTable = function (parentFieldName) { var that = this; var table = layui.table; that.checkColumns(); var tableWidth = $("#border_" + that.id).width() - 225; var options = { elem: '#table_' + that.id, id: 'table_' + that.id, backPath: that.backPath, url: that.url.controller + that.url.dataGrid, page: { limit: 20, page: 1 }, selectMode: table.selectMode.muti, cols: [that.columns], done: function (res, cur, total) { table.on('tool(' + that.id + ')', function (obj) { var data = obj.data;//当前选择行的数据 var layEvent = obj.event;//点的是什么按钮 if (layEvent == 'EDIT') { that.addOrEdit(false, data); } }); if (total > 0) { table.selectRecord('table_' + that.id, {index: 0}); } }, rowClick: function (thisTableFilter, record) { table.reload("table_detail_" + that.id, { extraParams: { "pkRule": record.oid } }); } }; table.render(options); }; this.initDetailTable = function (filter) { var that = this; var table = layui.table; var detailColumns=that.checkDetailColumns() //初始化表格 var options = { elem: '#table_' + filter, id: 'table_' + filter, backPath: that.backPath, url:that.url.controller+that.url.dataGridDetail, selectMode: layui.table.selectMode.muti, cols: [detailColumns], remoteSort:false, initSort:{sortField:'ruleOrderNumber',type:'asc'} }; table.render(options); }; this.checkColumns = function(){ var that = this; var table = layui.table; if(that.columns==null || that.columns.length==0){//如果其他地方想使用这个组件的时候,可以自定义列 that.columns = [table.getIndexColumn(),table.getRadioColumn(),{ field:'id', title:'编号', sort:true, width:260 },{ field:'name', title:'名称', sort:true, width:160 },{ field:'totalLength', title:'总长度', width:110 },{ field:'codeProductTypeText', title:'编码生成方式', width:120 },{ field:'codeEditFlag', title:'是否可以编辑', width:100, templet:function(d){ return $webUtil.formateBoolean(d.codeEditFlag); } },{ field:'breakReUseFlag', title:'是否断码补码', width:100, templet:function(d){ return $webUtil.formateBoolean(d.breakReUseFlag); } },{ field:'btmTypeName', title:'业务类型名称', width:150 },{ field:'useRuleFlag', title:'使用规则标记', width:150 },{ field:'lcStatusText', title:'状态', width:100 },{ field:'options', title:'操作', width:80, templet:function(d){ return '编辑'; } }]; } }; this.checkDetailColumns = function(isDialog) { var that = this; var table = layui.table; var detailColumns = [table.getIndexColumn(), table.getCheckColumn(), { title: '排序号', field: 'ruleOrderNumber', sort: true, width: 70, hide: isDialog }, { title: '元素编号', field: 'id', sort: true, width: 90 }, { title: '元素类型', field: 'codeElementTypeText', sort: true, width: 120 }, { title: '元素中文名称', field: 'name', width: 120 }, { title: '元素表达式', field: 'id', width: 120 }, { title: '最大长度', field: 'maxLength', width: 70 }, { title: '最小长度', field: 'minLength', width: 70 }, { title: '编码补位方式', field: 'codeFillTypeText', width: 95 }, { title: '补位字符', field: 'codeFillSeparator', width: 70 }, { title: '校验规则', field: 'validateString', width: 120 }, { title: '时间格式', field: 'codeDateFormat', width: 110 }, { title: '时间取值类型', field: 'codeDateValueTypeText', width: 100 }, { title: '时间取值属性', field: 'codeDateUseFieldName', width: 110 }, { title: '值对应属性', field: 'codeUseFieldName', width: 110 }, { title: '公式表达式', field: 'codeExpression', width: 120 }, { title: '是否流水依据', field: 'serialAccording', width: 95, templet: function (d) { return $webUtil.formateBoolean(d.serialAccording); } }, { title: '常量值', field: 'staticCode', width: 70 }, { title: '流水起始值', field: 'serialStart', width: 80 }, { title: '流水步长', field: 'serialStep', width: 70 }, { title: '流水优先级', field: 'serialPriority', width: 80 } ]; if(isDialog){ detailColumns.push({ field: 'options', title: '操作', width: 150, fixed: 'right', templet: function (d) { return '编辑上移下移'; } }) } return detailColumns; }; this.getFormItems = function(onlyShow,edit) { var that=this; that.checkBtmTypeColumns() return [{ field:'btmTypeId', title:'所属业务类型', type: 'refer', showField: 'btmTypeName', referConfig:{ textField: 'name', valueField: 'id', backPath: that.backPath,//注意这里需要修改参照的对应路径 isMuti: false, width:1280, height:630, type:'grid', url:"/btmTypeController/referDataGrid", tableConfig: { page: { limit: 15, page: 1 }, cols: that.btmTypeColumns, queryColumns: [ {field: 'id',title: '业务类型英文'}, {field: 'name',title: '业务类型中文'}] } }, required: true, readOnly:onlyShow },{ field:'id', title:'编码规则编号', required: true, readOnly:(onlyShow||edit) },{ field:'name', title:'名称', required: true, readOnly:onlyShow },{ field:'totalLength', title:'总长度', readOnly:true, value: 0 },{ field:'codeProductType', title:'编码生成方式', type:'combox', comboxKey:'codeProductType', required: true, readOnly:onlyShow },{ field:'useRuleFlag', title:'使用规则标记', required: true, readOnly:onlyShow },{ field:'codeEditFlag', title:'是否可以编辑', type: 'truefalse', value: 'false', readOnly:onlyShow },{ field:'breakReUseFlag', title:'是否断码补码', type: 'truefalse', value: 'false', readOnly:onlyShow }]; }; this.getFormDetailItems = function(onlyShow,codeElementTypeText) { var that = this; that.checkBtmTypeAttrColumns(); var items = [onlyShow ? { title: '元素类型', field: 'codeElementTypeText', required: true, readOnly: onlyShow } : { title: '元素类型', field: 'codeElementType', type: 'combox', comboxKey: 'codeElementType', defaultValue: 'code_element_enum', required: true }, { title: '元素编号', field: 'id', required: true }, { title: '元素中文名称', field: 'name', required: true }]; if (codeElementTypeText == '常量') { items.push({ title: '常量值', field: 'staticCode', required: true }, { title: '是否流水依据', field: 'serialAccording', defultValue: 'false', type: 'truefalse' }) } else { items.push({ title: '最大长度', field: 'maxLength', verify: 'number', required: true }, { title: '最小长度', field: 'minLength', verify: 'number', required: true }, { title: '编码补位方式', field: 'codeFillType', type: 'combox', comboxKey: 'codeFillType', required: true }, { title: '补位字符', field: 'codeFillSeparator' }) } if (codeElementTypeText == '手动输入') { items.push({ title: '校验规则', field: 'validateString' }, { title: '是否流水依据', field: 'serialAccording', defultValue: 'false', type: 'truefalse' }) } else if (codeElementTypeText == '日期') { items.push({ title: '时间格式', field: 'codeDateFormat', required: true }, { title: '时间取值类型', field: 'codeDateValueType', type: 'combox', comboxKey: 'codeDateValueType', defaultValue: 'code_date_business' }, { title: '时间取值属性', field: 'codeDateUseField', required: true, type: 'refer', showField: 'codeDateUseFieldName', referConfig: { textField: 'name,label', valueField: 'name', backPath: that.backPath,//注意这里需要修改参照的对应路径 isMuti: false, width: 580,//1280 height: 630, type: 'grid', where: { btmTypeId: that.btmTypeOid, codeElementType: that.codeElementType }, url: "/btmTypeController/gridAttributesByBtmId", tableConfig: { cols: that.btmTypeAttrColumns, queryColumns:that.btmTypeAttrQuerys } } }, { title: '是否流水依据', field: 'serialAccording', defultValue: 'false', type: 'truefalse' }) } else if (codeElementTypeText == '属性') { items.push({ title: '值对应属性', field: 'codeUseField', required: true, type: 'refer', showField: 'codeUseFieldName', referConfig: { textField: 'name,label', valueField: 'name', backPath: that.backPath,//注意这里需要修改参照的对应路径 isMuti: false, width: 580, height: 630, type: 'grid', where: { btmTypeId: that.btmTypeOid, codeElementType: that.codeElementType }, url: "/btmTypeController/gridAttributesByBtmId", tableConfig: { cols: that.btmTypeAttrColumns, queryColumns:that.btmTypeAttrQuerys } } }, { title: '是否流水依据', field: 'serialAccording', defultValue: 'false', type: 'truefalse' }) } else if (codeElementTypeText == '枚举属性映射') { items.push({ title: '值对应属性', field: 'codeUseField', required: true, type: 'refer', showField: 'codeUseFieldName', referConfig: { textField: 'name,label', valueField: 'name', backPath: that.backPath,//注意这里需要修改参照的对应路径 isMuti: false, width: 580, height: 630, type: 'grid', where: { btmTypeId: that.btmTypeOid, codeElementType: that.codeElementType }, url: "/btmTypeController/gridAttributesByBtmId", tableConfig: { cols: that.btmTypeAttrColumns, queryColumns:that.btmTypeAttrQuerys } } }, { title: '所选枚举', field: 'enumId', readOnly: !onlyShow, required: onlyShow, type: 'refer', showField: 'enumName', referConfig: { textField: 'id,name', valueField: 'id', backPath: that.backPath,//注意这里需要修改参照的对应路径 isMuti: false, width: 580, height: 630, type: 'grid', where: { btmTypeId: that.btmTypeOid }, url: "/webEnumController/gridEnum", tableConfig: { cols: [layui.table.getIndexColumn(), layui.table.getCheckColumn(), { field: 'id', title: '枚举编号', width: 200 }, { field: 'name', title: '枚举名称', width: 260 }], queryColumns:[{ field:'id', title:'枚举编号' }] } } }, { title: '是否流水依据', field: 'serialAccording', defultValue: 'false', type: 'truefalse' }) } else if (codeElementTypeText == '公式') { items.push({ title: '公式表达式', field: 'codeExpression', required: true }) } else if (codeElementTypeText == '流水号') { items.push({ title: '流水起始值', field: 'serialStart', verify: 'number', required: true, defaultValue: 1 }, { title: '流水步长', field: 'serialStep', verify: 'number', required: true, defaultValue: 1 }, { title: '流水优先级', field: 'serialPriority', verify: 'number', defaultValue:1, required: true }) } return items; }; this.checkBtmTypeColumns = function(){ var that = this; var table = layui.table; if(that.btmTypeColumns==null || that.btmTypeColumns.length==0){//如果其他地方想使用这个组件的时候,可以自定义列 that.btmTypeColumns = [table.getIndexColumn(),table.getCheckColumn(),{ field:'id', title:'业务类型英文', width:130 },{ field:'name', title:'业务类型中文', width:140 },{ field:'description', title:'描述', width:200 },{ field:'tableName', title:'数据库表', width:140 },{ field:'revisionRuleId', title:'版本规则', width:150, templet:function(d){ if(!d.revisionFlag){ return '不控制版本'; }else{ return d.revisionRuleId + ' ' + d.revisionRuleName; } } },{ field:'lifeCycleFlag', title:'生命周期', width:210, templet:function(d){ if(!d.lifeCycleFlag){ return '不控制生命周期'; }else{ return d.lifeCycleId + ' ' + d.lifeCycleName; } } },{ field:'secretFlag', title:'控制密级', width:70, templet:function(d){ return $webUtil.formateBoolean(d.secretFlag); } },{ field:'viewFlag', title:'是否为视图', width:80, templet:function(d){ return $webUtil.formateBoolean(d.viewFlag); } },{ field:'versionRule', title:'版次规则', width:110 }]; } }; this.btmTypeAttrQuerys = [{ field:'id', title:'属性英文名称', width:150 },{ field:'name', title:'属性中文名称', width:200 }]; this.checkBtmTypeAttrColumns = function(){ var that = this; var table = layui.table; if(that.btmTypeAttrColumns==null || that.btmTypeAttrColumns.length==0){//如果其他地方想使用这个组件的时候,可以自定义列 that.btmTypeAttrColumns = [table.getIndexColumn(),table.getCheckColumn(),{ field:'id', title:'属性英文名称', width:150 },{ field:'name', title:'属性中文名称', width:200 },{ field:'attributeLength', title:'长度', width:80 },{ field:'attrDataType', title:'数据类型', width:80, templet:function(d){ return that.vciFieldTypeMap[d.attrDataType]; } },{ field:'nullableFlag', title:'是否可以为空', width:100, templet:function(d){ return $webUtil.formateBoolean(d.nullableFlag); } },{ field:'defaultValue', title:'默认值', width:80 },{ field:'precisionLength', title:'小数精度', width:80 },{ field:'scaleLength', title:'小数刻度', width:80 },{ field:'range', title:'取值范围', width:100 },{ field:'referFlag', title:'是否参照', width:130, templet:function(d){ if(!d.referFlag){ return '否'; }else{ return d.referBtmTypeId } } },{ field:'enumFlag', title:'是否枚举', width:110, templet:function(d){ if(!d.enumFlag){ return '否'; }else{ return d.enumId } } }]; } }; this.ADD = function () { var that = this; that.addOrEdit(true); }; this.EDIT = function(){ var that = this; var selectData = layui.table.checkStatus("table_" + that.id).data; if(!selectData || selectData.length!=1){ $webUtil.showErrorMsg("请仅选择一条编码规则"); return false; } that.addOrEdit(false,selectData[0]); }; this.addOrEdit = function(add,selectData) { var that = this; var form = layui.form; var table = layui.table; var filter ="form_" + that.id; var addSaveIndex =$webUtil.dialog({ title:add?'添加编码规则':'修改编码规则', btn:['保存','取消'], skin:'layui-layer-lan', content:['
', '
', '编码规则明细 ', '增加行', '删除行', '
', '
'].join(''), fullScreen:true, resizing:function(layero){ form.doResize(filter); }, success:function(layero) { form.addItems(filter,that.getFormItems(false,!add), function () { if(!add){ form.setValues(selectData, filter); that.btmTypeOid=selectData.btmTypeId; }else{ var defaultValues = { codeProductType:'code_product_after' }; //可以手动在此处添加默认值 form.setValues(defaultValues,filter); } }, {}, {defaultColumnOneRow: 4,labelWidth:110,textWidth:220}); form.on('select('+filter+')',function (data){ if(data.name=='btmTypeId'){ that.btmTypeOid=data.value; } }) var detailColumns=that.checkDetailColumns(true) table.render({ elem: '#tableFrom_' + filter, id: 'tableFrom_' + filter, cols: [detailColumns], data: [], remoteSort:false, initSort:{sortField:'ruleOrderNumber',type:'asc'}, done: function (res, cur, total) { table.on('tool(tableFrom_' + filter + ')', function (obj) { var data = obj.data;//当前选择行的数据 var layEvent = obj.event;//点的是什么按钮 var index=obj.index; if (layEvent == 'up') { index!=0 && table.moveData( 'tableFrom_' + filter,index,index-1,'ruleOrderNumber') } if (layEvent == 'down') { index!=total-1 && table.moveData( 'tableFrom_' + filter,index,index+1,'ruleOrderNumber') } if (layEvent == 'edit') { that.addOrEditDetail(false,filter,data) } }); }, rowDBLClick: function (thisTableFilter, record,isChecked) { that.addOrEditDetail(false,filter,record) } }); if(!add){ $webUtil.get(that.backPath+that.url.controller+that.url.dataGridDetail,{pkRule:selectData.oid},function(result){ if(result.success){ layui.table.addData('tableFrom_' + filter, result.data); } }) } // 添加 $(".dtableFromAdd_" + filter + "").on("click", function (e) { if(form.validata(filter)){ that.addOrEditDetail(true,filter) layui.stope(e); } }); // 删除行 $(".dtableFromDel_" + filter + "").on("click", function (e) { var checkData = layui.table.checkStatus('tableFrom_' + filter).data; layui.table.removeData('tableFrom_' + filter, checkData); }); }, yes:function(layero){ if(form.validata(filter)){ var values = form.getValues(filter,true); values["codeProductTypeText"]=layui.vciWebComboxStore.getComboxText('codeProductType',values.codeProductType) values.totalLength=0 var tableitems=layui.table.getData('tableFrom_' + filter); var hasSerial=0 layui.each(tableitems,function (index,item){ item.ruleOrderNumber=index+1; if(item.codeElementType=='code_element_serial'){ hasSerial++; } values.totalLength+=parseInt(item.maxLength) values.serialAccording=values.serialAccording=='on'?'false':values.serialAccording; }) if(hasSerial==0){ $webUtil.showErrorMsg("请添加一条元素类型为“流水号”的明细"); return false; }else if(hasSerial>1){ $webUtil.showErrorMsg("元素类型为“流水号”的明细只能有一条"); return false; } if(values.totalLength<=0){ $webUtil.showErrorMsg("请添加编码规则明细"); return false; } values.elements=tableitems; values.breakReUseFlag=values.breakReUseFlag=='on'?'false':values.breakReUseFlag; values.codeEditFlag=values.codeEditFlag=='on'?'false':values.codeEditFlag; var url = that.url.controller + (add?that.url.addSave:that.url.editSave); $webUtil.manualAjax(add?'post':'put',url,JSON.stringify(values) ,function(result){ if(result.success){ $webUtil.showMsgFromResult(result,(add ? "添加成功" : "修改成功")); layer.close(addSaveIndex); that.refresh(); }else{ $webUtil.showErrorMsg(result.msg); } },function(xhr,err){ $webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启"); },that.backPath); } }, btn2:function(layero){ layer.close(addSaveIndex); } }); }; this.DEL = function(){ var that = this; var oid = $webUtil.getOidFromGrid("table_" +that.id,true,true); if(!oid){ return false; } var ts = $webUtil.getOidFromGrid("table_" +that.id,true,true,'ts'); $webUtil.showConfirmMsg("是否删除这条数据?如果被引用将不能被删除!",function () { $webUtil.deleteRequest(that.url.controller + that.url.deleteUrl,{oid:oid,ts:ts},function(result){ if(result.success){ $webUtil.showMsgFromResult(result,"删除成功"); that.refresh(); }else{ $webUtil.showErrorMsg(result.msg); } },function(xhr,err){ $webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启"); },that.backPath); }); }; this.addOrEditDetail = function(add,filter,selectData) { var that = this; var form = layui.form; var table=layui.table; var detailfilter ="detail_" + filter; var addSaveDetailIndex =$webUtil.dialog({ title:add?'添加编码规则明细':'修改编码规则明细', btn:['保存','取消'], skin:'layui-layer-lan', content:'
'+ '
', area: ['800px', '540px'], resizing:function(layero){ form.doResize(detailfilter); }, success:function(layero) { that.codeElementType=add?'code_element_enum':selectData.codeElementType; form.addItems(detailfilter,that.getFormDetailItems(!add,add?'枚举属性映射':selectData.codeElementTypeText), function () { table.render({ elem: '#tableFrom_' + detailfilter, id: 'tableFrom_' + detailfilter, cols:[[layui.table.getIndexColumn(), layui.table.getCheckColumn(), { field: 'enumItemKey', title: '枚举选项值', width: 150 }, { field: 'enumItemValue', title: '枚举选项显示文本', width: 200 }, { field: 'codeMapValue', title: '映射的码值', width: 280, edit:true }]], data: [], limit:-1, done: function (res, cur, total) { } }); function renderEnumTable(data){ table.reload('tableFrom_' + detailfilter,{data:data}) } $('#tableFrom_' + detailfilter).parent().hide() if(!add) { form.setValues(selectData, detailfilter); if (selectData.codeElementType == 'code_element_enum') { $('#tableFrom_' + detailfilter).parent().show() renderEnumTable(selectData.enumMaps || selectData.enumMapList) } else if (selectData.codeElementType == 'code_element_date') { if (selectData.codeDateValueType == 'code_date_system') { //系统时间 var items=form.getFormItems(detailfilter); for (var i=items.length-1;i=values.maxLength){ $webUtil.showErrorMsg("最小长度需小于最大长度"); return false; } }else{ values.maxLength=values.staticCode.length; values.minLength=values.maxLength } if(values.codeFillType=='code_fill_right'||values.codeFillType=='code_fill_left'){ if($webUtil.isNull(values.codeFillSeparator) ){ $webUtil.showErrorMsg("请输入补位字符"); return false; }else if(values.codeFillSeparator.length>values.maxLength){ $webUtil.showErrorMsg("补位字符长度不能大于最大长度"); return false; } } /*values.staticCode=values.staticCode?parseInt(values.staticCode):values.staticCode if(values.staticCode>values.maxLength){ $webUtil.showErrorMsg("常量值不能大于最大长度"); return false; }*/ try { values["codeElementTypeText"]=layui.vciWebComboxStore.getComboxText('codeElementType',values.codeElementType) values["codeFillTypeText"]=layui.vciWebComboxStore.getComboxText('codeFillType',values.codeFillType) values["codeDateValueTypeText"]=layui.vciWebComboxStore.getComboxText('codeDateValueType',values.codeDateValueType) }catch (e){ } if(values.codeElementType=='code_element_enum'){ var tableenumitems=layui.table.getData('tableFrom_' + detailfilter); var hasNull=0 layui.each(tableenumitems,function (index,item){ if($webUtil.isNull(item.codeMapValue)){ hasNull++; return false; } }) if(hasNull>0){ $webUtil.showErrorMsg("映射的码值不能为空"); return false; } values.enumMaps=tableenumitems; values.enumMapList=tableenumitems; selectData && (selectData.enumMapList=tableenumitems); } if(add){ layui.table.addData('tableFrom_' + filter, values); }else{ layui.table.changeRecord('tableFrom_' + filter,-1, values); } layer.close(addSaveDetailIndex); } }, btn2:function(layero){ layer.close(addSaveDetailIndex); } }); }; this.ENABLE=function (){ var that = this; that.disableOrEnable(true); } this.DISABLE=function (){ var that = this; that.disableOrEnable(false); } this.disableOrEnable = function (enable) { var that = this; var oid; var ts; oid = $webUtil.getOidFromGrid("table_" + that.id, true, true); if (!oid) { return false; } var lcStatusText = $webUtil.getOidFromGrid("table_" + that.id, false, true, 'lcStatusText'); if(enable && lcStatusText=='启用'){ $webUtil.showErrorMsg('该状态不可以启用'); return false } if(!enable && lcStatusText=='停用'){ $webUtil.showErrorMsg('该状态不可以停用'); return false } ts = $webUtil.getOidFromGrid("table_" + that.id, false, true, 'ts'); $webUtil.post(that.url.controller + (enable ? that.url.enableData : that.url.disableData), {oid: oid,ts: ts}, function (result) { if (result.success) { $webUtil.showMsgFromResult(result, (enable ? '启用成功' : '停用成功')); that.refresh(); } else { $webUtil.showErrorMsg(result.msg); } }, function (xhr, err) { $webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启"); }, that.backPath); }; this.refresh = function(){ var that = this; layui.table.reload("table_" + that.id); }; }; var cs = new Class(); exports(cs.MODELNAME,cs); });