/**
* 主题库分类的模板属性页面
* @author weidy
* @date 2022-01-24
*/
layui.define(['layer','element','form','table','dynamicCondition' ],function(exports){
var webUtil = $webUtil;
var Class = function(){
this.MODELNAME = "mdm/CodeClassifyTemplateAttr";
this.moduleKey = "CodeClassifyTemplateAttr";
this.backPath = configData.compatibility? path:configData.mdmService;
this.url = {
attrController:'codeClassifyAttrController/',
classifyController:'codeClassifyController/',
classifyTree:'referTree',
attrRefer:'gridCodeClassifyAttribute',
controller:'codeClassifyTempAttrController/',
dataGrid:'gridCodeClassifyTemplateAttr',
tree:'treeCodeClassifyTemplate',
addSave:'addSave',
editSave:'editSave',
deleteUrl:'deleteData',
getObjectByOid:'getObjectByOid',
tempController:'codeClassifyTemplateController/',
tempDataGrid:'gridCodeClassifyTemplate',
addSaveTemp:'addSave',
editSaveTemp:'editSave',
deleteUrlTemp:'deleteData',
};
this.getContent=function() {
var that = this;
return '
';
};
this.showContent = function (){
var that = this;
var html=[
'',
'
',
that.getWestToolbarHtml(),
'
',
'
',
'
',
'
',
'
',
that.getNorthToolbarHtml(),
'
',
'
',
'
',
'
',
that.getToolbarHtml(),
'
',
'
',
'
',
'
',
'
',
'
'
];
$("#UIContent_"+that.id).html(html.join(''));
};
this.getWestToolbarHtml = function(){
var that = this;
var html = [
'',
'',
'',
'
'
].join("");
return html;
};
this.getNorthToolbarHtml = function(){
var that = this;
var html = [
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'
'
].join("");
return html;
};
this.getToolbarHtml =function(isFull){
var that = this;
var html = ['')
return html.join("");
};
this.createSearchHtml = function () {
var that = this;
webUtil.bindDefultButtonLisenter(that, that.id);
};
this.init = function(){
var that = this;
webUtil.copyConfig(that,that.moduleKey);
setTimeout(function () {
that.showContent();
that.createWestSearchHtml();
that.createSearchHtml();
var easyuiLayout = $('#easyuiLayout_' + that.id)
easyuiLayout.css({height: $('#portal_body').height() - 43, width: $('#portal_body').width() - 15})
easyuiLayout.layout();
$('#easyuiLayoutCenter_'+that.id).layout();
that.initMainTable();
that.initTempTable();
that.initTree();
},1)
};
this.initTree = function () {
var that = this;
var tree = layui.tree;
var treeUL = $('[layui-filter="tree_' + that.id + '"]');
var scrollHeight = treeUL.closest('.panel-body').height();
var treeHeight = scrollHeight - 100;
treeUL.parent().height(treeHeight);
tree.init("tree_" + that.id, treeUL, {
url: that.url.classifyController + that.url.classifyTree,
backPath: that.backPath,
extraParams: {
isMuti: false,
isQueryAllColumn: true
},
showSearch:true,
click: function (item, elem, options) {
that.currentItemOid = item.oid;
that.currentItemAttributes = item.attributes;
that.setFormValues();
}
});
};
this.setFormValues = function () {
var that = this;
//列表
layui.table.reload('temp_' + that.id,{
where:{
codeclassifyoid:that.currentItemAttributes.oid
}
})
};
this.initMainTable = function (parentFieldName) {
var that = this;
var table = layui.table;
that.checkColumns();
var tableWidth = $("#border_" + that.id).width();
var options = {
elem: '#table_' + that.id,
id: 'table_' + that.id,
backPath:that.backPath,
url: that.url.controller + that.url.dataGrid,
width:tableWidth,
selectMode:table.selectMode.muti,
cols: [that.columns],
method:'get',
done:function(res,cur,total){
if(!that.fristMainLoad ){
table.on('tool(' + that.id + ')',function(obj){
var data = obj.data;//当前选择行的数据
var layEvent = obj.event;//点的是什么按钮
if(layEvent == 'EDIT'){
that.addOrEdit(false,data.oid);
}
});
}else{
if(total>0) {
table.selectRecord('table_' + that.id, {index:0});
}
}
that.fristMainLoad = true;
}
};
if(parentFieldName){
options.treeConfig = {
treepid:parentFieldName,
treeid:'id',
showField:'name'
};
}
table.render(options);
};
this.initTempTable = function (){
var that = this;
var table = layui.table;
that.checkTempColumns();
var tableWidth = $("#border_" + that.id).width()-10;
var options = {
elem: '#temp_' + that.id,
id: 'temp_' + that.id,
backPath:that.backPath,
url: that.url.tempController + that.url.tempDataGrid,
page: {
limit: 10,
page: 1
},
width:tableWidth,
selectMode:table.selectMode.muti,
cols: [that.tempColumns],
method:'get',
done:function(res,cur,total){
if(!that.fristMainLoad ){
table.on('tool(' + that.id + ')',function(obj){
var data = obj.data;//当前选择行的数据
var layEvent = obj.event;//点的是什么按钮
if(layEvent == 'EDIT'){
that.addOrEdit(false,data.oid);
}
});
}else{
if(total>0) {
table.selectRecord('temp_' + that.id, {index:0});
}
}
that.fristMainLoad = true;
}
};
table.render(options);
};
this.checkTempColumns = function (){
var that = this;
var table = layui.table;
if(that.tempColumns==null || that.tempColumns.length==0){
that.tempColumns = [table.getIndexColumn(),table.getCheckColumn(),
{
field: 'id',
title: '模板编号',
sort:true,
width: 150
},{
field: 'name',
title: '模板名称',
sort:true,
width: 200
},{
field: 'description',
title: '模板描述',
sort:true,
width: 150
},{
field: 'revisionValue',
title: '版本号',
sort: true,
width: 70
},{
field: 'lcStatusText',
title: '状态',
sortField:'lcStatus',
sort:true,
width: 60
},
{
field:'options',
title:'操作',
width: 150,
templet:function(d){
return ['编辑','升版'].join("");
}
}];
}
};
this.createWestSearchHtml = function () {
var that = this;
webUtil.bindDefultButtonLisenter(that,"west_" + that.id);
};
this.checkColumns = function(){
var that = this;
var table = layui.table;
if(that.columns==null || that.columns.length==0){
that.columns = [table.getIndexColumn(),table.getCheckColumn(),{
field: 'id',
title: '属性英文编号',
sort: true,
width: 150
},{
field: 'name',
title: '属性中文名称',
sort: true,
width: 150
},
{
title: '属性分组',
field: 'attributegroup',
sort:true,
width: 90
},
{
title: '类型',
field: 'attributedatatypeText',
sort:true,
type: 'combox',
data:[],
width: 60
},
{
title: '关键属性',
field: 'keyattrflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.keyattrflag);
}
},
{
title: '查询属性',
field: 'queryattrflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.queryattrflag);
}
},
{
title: '高级查询属性',
field: 'seniorqueryattrflag',
width: 90,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.seniorqueryattrflag);
}
},
{
title: '相似查重属性',
field: 'samerepeatattrflag',
width: 90,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.samerepeatattrflag);
}
},
{
title: '一维码',
field: 'barcodeflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.barcodeflag);
}
},
{
title: '二维码',
field: 'qrcodeflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.qrcodeflag);
}
},
{
title: '必输',
field: 'requireflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.requireflag);
}
},
{
title: '表单显示',
field: 'formdisplayflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.formdisplayflag);
}
},
{
title: '列表显示',
field: 'tabledisplayflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.tabledisplayflag);
}
},
{
title: '只读',
field: 'readonlyflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.readonlyflag);
}
},
{
title: '列表排序',
field: 'sortattrflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.sortattrflag);
}
},
{
title: '长度',
field: 'controllength',
type:'number',
width: 60
},
{
title: '默认值',
field: 'defaultvalue',
sort:true,
width: 150
},
{
title: '前缀',
field: 'prefixvalue',
sort:true,
width: 60
},
{
title: '后缀',
field: 'suffixvalue',
sort:true,
width: 60
},
{
title: '小数精度(刻度)',
field: 'precisionlength',
type:'number',
width: 100
},
{
title: '组合规则',
field: 'componentrule',
sort:true,
width: 180
},
{
title: '验证规则',
field: 'verifyrule',
sort:true,
width: 150
},
{
title: '取值范围',
field: 'valuearea',
sort:true,
width: 150
},
{
title: '时间格式',
field: 'codedateformat',
sort:true,
width: 150
},
{
title: '分类注入(层级/名称)',
field: 'classifyinvokelevel',
sort:true,
width: 200
},
{
title: '枚举注入',
field: 'enumid',
sort:true,
width: 150
},
{
title: '参照配置',
field: 'referbtmid',
sort:true,
width: 150
},
{
title: '表单显示样式',
field: 'formdisplaystyle',
sort:true,
width: 150
},
{
title: '表格显示样式',
field: 'tabledisplaystyle',
sort:true,
width: 150
},
{
title: '表单超链接',
field: 'formhref',
sort:true,
width: 150
},
{
title: '表格超链接',
field: 'tablehref',
sort:true,
width: 150
},
{
title: '表格显示js',
field: 'tabledisplayjs',
sort:true,
width: 150
},
{
title: '多行文本',
field: 'textareaflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.textareaflag);
}
},
{
title: '预览图',
field: 'imageflag',
width: 60,
type:'combox',
data:[{key:"true",value:"是"},{key:"false",value:"否"}],
templet: function (d) {
return webUtil.formateBoolean(d.imageflag);
}
},
{
field:'options',
title:'操作',
width: 150,
templet:function(d){
return ['上移','下移','移除'];
}
}];
}
};
this.getFormItems = function(onlyShow) {
var that = this;
var table = layui.table;
return [
{
field: 'classifytemplateoid',
title: '所属模板',
required: true,
type: 'refer',
showField: 'classifytemplateoidName',
referConfig: {
referBo:'codeclstemplate'
},
defaultValue:"",
readOnly:onlyShow
} , {
field: 'classifyattributeoid',
title: '所属分类中的属性主键',
required: true,
type: 'refer',
showField: 'classifyattributeoidName',
referConfig: {
referBo:'codeclsattr'
},
defaultValue:"",
readOnly:onlyShow
} , {
field: 'attributedatatype',
title: '属性的类型',
required: true,
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'keyattrflag',
title: '是否关键属性',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'queryattrflag',
title: '是否快速查询属性',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'seniorqueryattrflag',
title: '是否高级查询属性',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'samerepeatattrflag',
title: '相似查重属性',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'sortattrflag',
title: '是否排序',
type: 'truefalse',
defaultValue:"true",
readOnly:onlyShow
} , {
field: 'qrcodeflag',
title: '是否生成二维码',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'barcodeflag',
title: '是否生成一维码',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'componentrule',
title: '组合规则',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'verifyrule',
title: '验证规则',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'classifyinvokelevel',
title: '分类注入层级',
type: 'text',
defaultValue:"none",
readOnly:onlyShow
} , {
field: 'classifyinvokeattr',
title: '分类注入的属性英文名称',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'classifyinvokeattrname',
title: '分类注入的属性中文名称',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'classifyinvokeeditflag',
title: '分类注入是否可以编辑',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'ordernum',
title: '码值序号',
verify: 'number',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'formdisplayflag',
title: '表单里是否显示',
type: 'truefalse',
defaultValue:"true",
readOnly:onlyShow
} , {
field: 'tabledisplayflag',
title: '列表里是否显示',
type: 'truefalse',
defaultValue:"true",
readOnly:onlyShow
} , {
field: 'attributegroup',
title: '所属属性分组',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'enumid',
title: '使用枚举英文编号',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'enumname',
title: '使用枚举中文名称',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'enumeditflag',
title: '枚举是否可以编辑',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'referbtmid',
title: '参照的业务类型英文名称',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'referbtmname',
title: '参照的业务类型中文名称',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'referconfig',
title: '参照窗口配置',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'requireflag',
title: '是否必输',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'readonlyflag',
title: '是否只读',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'controllength',
title: '属性控制输入的长度',
required: true,
verify: 'number',
defaultValue:"254",
readOnly:onlyShow
} , {
field: 'formdisplaystyle',
title: '表单里显示的样式',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'tabledisplaystyle',
title: '表格里显示的样式',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'formhref',
title: '表单中超链接内容',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'tablehref',
title: '表格中超链接内容',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'precisionlength',
title: '小数精度',
verify: 'number',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'scalelength',
title: '小数刻度',
verify: 'number',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'valuearea',
title: '取值范围',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'codedateformat',
title: '时间格式',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'tabledisplayjs',
title: '表格里显示调用的js',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'textareaflag',
title: '是否显示多行文本',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'imageflag',
title: '预览图',
type: 'truefalse',
defaultValue:"false",
readOnly:onlyShow
} , {
field: 'defaultvalue',
title: '默认值',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'prefixvalue',
title: '前缀',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'suffixvalue',
title: '后缀',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'filtersourceattr',
title: '选择数据时过滤的属性',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} , {
field: 'filtersourceattrname',
title: '选择数据时过滤的属性名称',
type: 'text',
defaultValue:"",
readOnly:onlyShow
} ];
};
this.ADD = function () {
var that = this;
var table =layui.table;
var filter ="refer_attr_" + that.id;
var addSaveIndex =webUtil.dialog({
title:'从属性集中选择',
btn:['确定选择','取消'],
content:'',
success:function(layero,layerIndex,classP) {
layui.use('mdm/CodeClassify',function (){
var codeClassify = layui['mdm/CodeClassify'];
codeClassify.checkColumns(true);
var options = {
elem: '#table_' + filter,
id: 'table_' + filter,
backPath:that.backPath,
url: that.url.attrController + that.url.attrRefer,
selectMode:table.selectMode.muti,
cols: [codeClassify.columns]
};
table.render(options);
webUtil.relocationOpen(classP)
});
},
yes:function(layero){
},
btn2:function(layero){
layer.close(addSaveIndex);
}
});
};
this.EDIT = function(){
var that = this;
var oid = webUtil.getOidFromGrid("table_" + that.id,true,true);
if(!oid){
return false;
}
that.addOrEdit(false,oid);
};
this.addOrEdit = function(add,oid) {
var that = this;
var form = layui.form;
var filter ="form_" + that.id;
var addSaveIndex =webUtil.dialog({
title:add?'添加主题库分类的模板属性':'修改主题库分类的模板属性',
btn:['保存','取消'],
content:'',
resizing:function(layero){
form.doResize(filter);
},
success:function(layero) {
form.addItems(filter,that.getFormItems(false),
function () {
if(!add){
form.load(filter,{
backPath:that.backPath,
url:that.url.controller + that.url.getObjectByOid,
method:'get',
params:{
oid:oid
}
});
}else{
var defaultValues = {};
//可以手动在此处添加默认值
form.setValues(defaultValues,filter);
}
}, {}, {defaultColumnOneRow: 2, labelWidth: 200});
},
yes:function(layero){
if(form.validata(filter)){
var values = form.getValues(filter,true);
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,false,false,"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.BATCHEDIT=function (){
var that=this;
var filter ="fullScreen_" + that.id;
var table=layui.table;
that.BATCHEDITIndex =layer.open({
type:1,
title:'模板属性',
content:''+that.getToolbarHtml(true)+'
',
fullScreen:true,
closeBtn:0,
shadeClose: false,
resizing:function(layero){
form.doResize(filter);
},
success:function(layero) {
var options = table.getConfig('table_' + that.id);
options.elem = '#table_' + filter
options.id = 'table_' + filter;
options.width='auto';
table.render(options);
webUtil.bindDefultButtonLisenter(that, that.id);
}
});
}
this.UNBATCHEDIT=function (){
var that=this;
layer.close(that.BATCHEDITIndex)
}
//组合规则
this.COMPUSE=function (){
layui.use('mdm/CodeClassifyCompuse',function (){
var CodeClassifyCompuse=layui['mdm/CodeClassifyCompuse'];
CodeClassifyCompuse.showDialog()
})
}
//效验规则
this.VERIFYUSER=function (){
var that=this;
var form = layui.form;
var table = layui.table;
var filter ="verifyuser_" + that.id;
var html=[
''
];
var verifyuserIndex =webUtil.dialog({
title:'属性效验规则',
btn:['保存','取消'],
content:html.join(''),
resizing:function(layero){
form.doResize(filter);
},
success:function(layero,layerIndex,classP) {
var easyuiLayout = $('#easyuiLayout_' + filter)
easyuiLayout.css({height: 600, width: 1050})
easyuiLayout.parent().parent().css({margin: '5px'})
easyuiLayout.layout();
form.addItems(filter, [{
field: 'regexp',
title: '正则表达式',
required: true,
type: 'textarea',
textWidth: 240,
textStyle:'height:200px;'
}, {
field: 'content',
title: '测试内容',
type: 'textarea',
textWidth: 240,
textStyle:'height:200px;'
}],
function () {
webUtil.relocationOpen(classP)
}, {}, {labelWidth: 110});
var tableData=[{name:'[\u3000\uff01-\uff5f]+',description:'全角符号'},
{name:'[^\u3000\uff01-\uff5f]+',description: '半角符号'},
{name:'(([-|+]{1}[\\d]+℃~[-|+]{1}[\\d]+℃)|无)',description: '温度范围,示例 -55℃~+125℃'},
{name:'[\\d]{15}|[\\d]{18}|[\\d]{17}X',description: '身份证号码(15或18位数字、17位数字X) '},
{name:'男|女|男性|女性',description: '中文性别'},
{name:'[\\d]+',description: '数字'},
{name:'[a-zA-Z]+',description: '字母'},
{name:'[A-Z]+',description: '大写字母'},
{name:'[a-z]+',description: '小写字母'},
{name:'[0-9a-zA-Z]+',description: '字母、数字组合'},
{name:'((0[\\d]{3}-[\\d]{7})|(0[\\d]{2}-[\\d]{8})|([\\d]{7,8}))',description: '电话号码'},
{name:'-?[1-9]\\d*',description: '整数'},
{name:'[1-9]\\d*',description: '正整数'},
{name:'-[1-9]\\d*',description: '负整数'},
{name:'-[1-9]\\d*|0',description: '非正整数(负整数+0)'},
{name:'[1-9]\\d*|0',description: '非负整数(正整数+0)'},
{name:'-?([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*|0?\\.0+|0)',description: '浮点数'},
{name:'[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*',description: '正浮点数'},
{name:'-[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*',description: '负浮点数'},
{name:'[(-([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*))|0?\\.0+|0',description: '非正浮点数(负浮点数 + 0)'},
{name:'[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*|0?\\.0+|0',description: '非负浮点数(正浮点数 + 0)'},
{name:'x',description: '字符 x'},
{name:'\\\\',description: '反斜线字符'},
{name:'\\0n',description: '带有八进制值 0 的字符 n (0 <= n <= 7)'},
{name:'\\0nn',description: '带有八进制值 0 的字符 nn (0 <= n <= 7)'},
{name:'\\0mnn',description: '带有八进制值 0 的字符 mnn(0 <= m <= 3、0 <= n <= 7)'},
{name:'\\xhh',description: '带有十六进制值 0x 的字符 hh'},
{name:'\\uhhhh',description: '带有十六进制值 0x 的字符 hhhh'},
{name:'\\t',description: '制表符 (\'\u0009\')'},
{name:'\\n',description: '新行(换行)符 (\'\u000A\')'},
{name:'\\r',description: '回车符 (\'\u000D\')'},
{name:'\\f',description: '换页符 (\'\u000C\')'},
{name:'\\a',description: '报警 (bell) 符 (\'\u0007\')'},
{name:'\\e',description: '转义符 (\'\u001B\')'},
{name:'\\cx',description: '对应于 x 的控制符'},
{name:'[abc]',description: 'a、b 或 c(简单类)'},
{name:'[^abc]',description: '任何字符,除了 a、b 或 c(否定)'},
{name:'[a-zA-Z]',description: 'a 到 z 或 A 到 Z,两头的字母包括在内(范围)'},
{name:'[a-d[m-p]]',description: 'a 到 d 或 m 到 p:[a-dm-p](并集)'},
{name:'[a-z&&[def]]',description: '\td、e 或 f(交集)'},
{name:'[a-z&&[^bc]]',description: 'a 到 z,除了 b 和 c:[ad-z](减去)'},
{name:'[a-z&&[^m-p]]',description: 'a 到 z,而非 m 到 p:[a-lq-z](减去)'},
{name:'.',description: '任何字符(与行结束符可能匹配也可能不匹配)'},
{name:'\\d',description: '数字:[0-9]'},
{name:'\\D',description: '非数字: [^0-9]'},
{name:'\\s',description: '空白字符:[ \\t\\n\x0B\\f\\r]'},
{name:'\\S',description: '非空白字符:[^\\s]'},
{name:'\\w',description: '单词字符:[a-zA-Z_0-9]'},
{name:'\\W',description: '非单词字符:[^\\w]'},
{name:'\\p{Lower}',description: '小写字母字符:[a-z]'},
{name:'\\p{Upper}',description: '大写字母字符:[A-Z]'},
{name:'\\p{ASCII}',description: '所有 ASCII:[\x00-\x7F]'},
{name:'\\p{Alpha}',description: '字母字符:[\\p{Lower}\\p{Upper}]'},
{name:'\\p{Digit}',description: '十进制数字:[0-9]'},
{name:'\\p{Alnum}',description: '字母数字字符:[\\p{Alpha}\\p{Digit}]'},
{name:'\\p{Punct}',description: '标点符号:!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'},
{name:'\\p{Graph}',description: '可见字符:[\\p{Alnum}\\p{Punct}]'},
{name:'\\p{Print}',description: '可打印字符:[\\p{Graph}\x20]'},
{name:'\\p{Blank}',description: '空格或制表符:[ \\t]'},
{name:'\\p{Cntrl}',description: '控制字符:[\x00-\x1F\x7F]'},
{name:'\\p{XDigit}',description: '十六进制数字:[0-9a-fA-F]'},
{name:'\\p{Space}',description: '空白字符:[ \\t\\n\x0B\\f\\r]'},
{name:'\\p{javaLowerCase}',description: '等效于 java.lang.Character.isLowerCase()'},
{name:'\\p{javaUpperCase}',description: '等效于 java.lang.Character.isUpperCase()'},
{name:'\\p{javaWhitespace}',description: '等效于 java.lang.Character.isWhitespace()'},
{name:'\\p{javaMirrored}',description: '等效于 java.lang.Character.isMirrored()'},
{name:'\\p{InGreek}',description: 'Greek 块(简单块)中的字符'},
{name:'\\p{Lu}',description: '大写字母(简单类别)'},
{name:'\\p{Sc}',description: '货币符号'},
{name:'\\P{InGreek}',description: '所有字符,Greek 块中的除外(否定)'},
{name:'[\\p{L}&&[^\\p{Lu}]]',description: '所有字母,大写字母除外(减去)'},
{name:'^',description: '行的开头'},
{name:'$',description: '行的结尾'},
{name:'\\b',description: '单词边界'},
{name:'\\B',description: '非单词边界'},
{name:'\\A',description: '输入的开头'},
{name:'\\G',description: '上一个匹配的结尾'},
{name:'\\Z',description: '输入的结尾,仅用于最后的结束符(如果有的话)'},
{name:'\\z',description: '输入的结尾'},
{name:'X ?',description: 'X,一次或一次也没有'},
{name:'X *',description: 'X,零次或多次'},
{name:'X +',description: 'X,一次或多次'},
{name:'X {n }',description: 'X,恰好 n 次'},
{name:'X {n ,}',description: 'X,至少 n 次'},
{name:'X {n ,m }',description: 'X,至少 n 次,但是不超过 m 次'},
{name:'X ??',description: 'X,一次或一次也没有'},
{name:'X *?',description: 'X,零次或多次'},
{name:'X +?',description: 'X,一次或多次'},
{name:'X {n }?',description: 'X,恰好 n 次'},
{name:'X {n ,}?',description: 'X,至少 n 次'},
{name:'X {n ,m }?',description: 'X,至少 n 次,但是不超过 m 次'},
{name:'X ?+',description: 'X,一次或一次也没有'},
{name:'X *+',description: 'X,零次或多次'},
{name:'X ++',description: 'X,一次或多次'},
{name:'X {n }+',description: 'X,恰好 n 次'},
{name:'X {n ,}+',description: 'X,至少 n 次'},
{name:'X {n ,m }+',description: 'X,至少 n 次,但是不超过 m 次'},
{name:'XY',description: 'X 后跟 Y'},
{name:'X |Y',description: 'X 或 Y'},
{name:'(X )',description: 'X,作为捕获组'},
{name:'\\n',description: '任何匹配的 nth 捕获组'},
{name:'\\',description: 'Nothing,但是引用以下字符'},
{name:'\\Q',description: 'Nothing,但是引用所有字符,直到 \\E'},
{name:'\\E',description: 'Nothing,但是结束从 \\Q 开始的引用'},
{name:'(?:X )',description: 'X,作为非捕获组'},
{name:'(?idmsux-idmsux)',description: 'Nothing,但是将匹配标志由 on 转为 off'},
{name:'(?idmsux-idmsux:X )',description: 'X,作为带有给定标志 on - off 的非捕获组'},
{name:'(?=X )',description: 'X,通过零宽度的正 lookahead'},
{name:'(?!X )',description: 'X,通过零宽度的负 lookahead'},
{name:'(?<=X )',description: 'X,通过零宽度的正 lookbehind'},
{name:'(?X )',description: 'X,作为独立的非捕获组'}
]
table.render({
elem: '#table_' + filter,
id: 'table_' + filter,
height:585,
limit: -1,
cols: [[{
field: 'name',
title: '表达式',
width: 300
},{
field: 'description',
title: '使用说明',
width: 310
}]],
data:tableData,
done:function(res,cur,total){
},
rowDBLClick:function (thisTableFilter, record) {
var regexpValue=form.getValues(filter).regexp;
regexpValue+=record.name
form.setValues({regexp:regexpValue},filter);
}
});
},
yes:function(layero){
if(form.validata(filter)){
var values = form.getValues(filter,true);
layer.close(verifyuserIndex);
}
},
btn2:function(layero){
layer.close(verifyuserIndex);
}
});
}
this.refreshCLF = function () {
var that = this;
var tree = layui.tree;
tree.reload("tree_" + that.id);
};
this.refresh = function () {
var that = this;
layui.table.reload("table_" + that.id);
layui.table.reload("table_fullScreen_" + that.id);
};
this.refreshTEMP = function () {
var that = this;
layui.table.reload("temp_" + that.id);
};
this.ADVQUERY = function () {
var that = this;
if(!that.serinorQueryInstance) {
var dynamicCondition = layui.dynamicCondition;
$('[layui-filter="toolbar_' + that.id + '"]').append('');
that.checkColumns();
var dataFields = [];
for(var i = 0 ; i < that.columns.length ; i ++){
dataFields[i] = that.columns[i];
}
that.serinorQueryInstance = dynamicCondition.create({
fields: dataFields//查询字段
, tableId: "table_" + that.id//需要查询的表格
, type: "complex" //type:"simple"/"complex" 查询的方法 暂时写死为 complex
, queryCallBack: function (requestData) {//查询之后的callback
}
});
}
that.serinorQueryInstance.open();
};
this.ADDTEMP = function () {
var that = this;
that.addOrEditTEMP(true);
};
this.EDITTEMP = function(){
var that = this;
if(webUtil.isNull(that.currentItemOid)){
webUtil.showErrorMsg("请先从树上选择一条数据");
return false;
}
that.addOrEditTEMP(false,that.currentItemOid);
};
this.addOrEditTEMP = function(add,oid) {
var that = this;
var form = layui.form;
var filter ="form_" + that.id;
var addSaveIndex =webUtil.dialog({
title:add?'添加模板':'修改模板',
btn:['保存','取消'],
content:'',
resizing:function(layero){
form.doResize(filter);
},
success:function(layero,layerIndex,classP) {
form.addItems(filter,that.getFormTempItems(false),
function () {
if(!add){
form.load(filter,{
backPath:that.backPath,
url:that.url.tempController + that.url.getObjectByOidTemp,
method:'get',
params:{
oid:oid
}
});
}else{
var defaultValues = {};
if(that.currentItemAttributes) {
defaultValues["codeClassifyOid"] = that.currentItemOid;
defaultValues["codeClassifyOid" + "name"] = that.currentItemAttributes.name;
}
//可以手动在此处添加默认值
form.setValues(defaultValues,filter);
}
webUtil.relocationOpen(classP)
}, {}, {defaultColumnOneRow: 2});
},
yes:function(layero){
if(form.validata(filter)){
var values = form.getValues(filter,true);
var url = that.url.tempController + (add?that.url.addSaveTemp:that.url.editSaveTemp);
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.getFormTempItems = function(onlyShow) {
var that = this;
var table = layui.table;
return [{
field: 'id',
title: '模板编号',
required: true
},{
field: 'name',
title: '模板名称',
required: true
},{
field: 'description',
title: '描述',
inputWidth:475,
type:'textarea'
}];
};
};
var cs = new Class();
exports(cs.MODELNAME,cs);
});