/**
|
* 主题库分类页面
|
* @author weidy
|
* @date 2022-01-24
|
*/
|
layui.define(['layer','element','form','table','dynamicCondition' ,'tree','mdm/refer/CodeClassTemplateRefer','transferTable','mdm/MdmEngineForm'],function(exports) {
|
var webUtil = $webUtil;
|
var Class = function () {
|
this.MODELNAME = "mdm/CodeClassify";
|
this.moduleKey = "CodeClassify";
|
this.backPath = configData.compatibility ? path : configData.mdmService;
|
this.url = {
|
attrController: 'codeClassifyAttrController/',
|
controller: 'codeClassifyController/',
|
attrRefer: 'gridCodeClassifyAttribute',
|
tempController: 'codeClassifyTemplateController/',
|
tempDataGrid: 'gridCodeClassifyTemplate',
|
templateAttrController: 'codeClassifyTempAttrController/',
|
templateAttrDataGrid: 'gridCodeClassifyTemplateAttr',
|
processLinkController:'codeClsProcessTempController/',
|
processLinkDataGrid:'gridCodeClassifyProcessTemp',
|
processLinkAddSave:'addSave',
|
processLinkEditSave:'editSave',
|
processLinkDeleteUrl:'deleteData',
|
processLinkGetObjectByOid:'getObjectByOid',
|
phaseController:'codeTempPhaseController/',
|
phaseDataGrid:'gridCodeTemplatePhase',
|
phaseAddSave:'addSave',
|
phaseEditSave:'editSave',
|
phaseDeleteUrl:'deleteData',
|
phaseGetObjectByOid:'getObjectByOid',
|
phaseUnUsedAttribute:'gridUnUsedAttribute',
|
phaseUsedAttribute:'gridUsedAttribute',
|
buttonController:'codeClsTempButtonController/',
|
buttonDataGrid:'gridCodeClassifyTemplateButton',
|
buttonAddSave:'addSave',
|
buttonEditSave:'editSave',
|
buttonDeleteUrl:'deleteData',
|
buttonGetObjectByOid:'getObjectByOid',
|
tree: 'treeCodeClassify',
|
addSave: 'addSave',
|
editSave: 'editSave',
|
checkIsCanDelete: 'checkIsCanDelete',
|
referTree: 'referTree',
|
deleteUrl: 'deleteData',
|
enableData: 'enableData',
|
disableData: 'disableData',
|
getObjectByOid: 'getObjectByOid'
|
};
|
this.vciFieldTypeMap = {
|
VTBoolean: "布尔型",
|
VTClob: "长文本",
|
VTDate: "日期",
|
VTDateTime: "日期时间",
|
VTTime: "时间",
|
VTLong: "长整型",
|
VTDouble: "金额/双精度",
|
VTInteger: "整形",
|
VTFilePath: "文件",
|
VTString: "字符串"
|
};
|
this.getContent = function () {
|
var that = this;
|
return '<div id="UIContent_' + that.id + '" style="overflow: auto;padding:0 5px"></div>';
|
};
|
this.showContent = function () {
|
var that = this;
|
var html = [
|
'<div class="layui-layout easyui-layout UIContentLayout" id="easyuiLayout_', that.id, '" data-options="fit:true" style="display:block;overflow-y: hidden;">',
|
'<div data-options="region:\'west\',split:true" style="width:270px;padding: 5px;">',
|
that.getWestToolbarHtml(),
|
'<div class="layui-vci-tree" style="overflow: auto;margin-top: 5px;">',
|
'<ul layui-filter="tree_', that.id, '"></ul>',
|
'</div>',
|
'</div>',
|
'<div data-options="region:\'center\'" style="padding-left: 5px;padding-right: 5px;" id="border_', that.id, '">',
|
'<div class="layui-center" style="overflow-y:auto;">',
|
'<div class="layui-layout-border layui-tab" style="display:block;margin:0px;">',
|
'<ul class="layui-tab-title tabTitle tab_center_', that.id, '" lay-allowClose="false">',
|
'<li class="layui-this">基本信息</li>',
|
'<li>模板管理</li>',
|
'</ul>',
|
'<ul class="layui-tab-content tabContent">',
|
'<li class="layui-tab-item layui-show">',
|
'<form class="layui-form" lay-filter="form_info_', that.id, '"></form>',
|
'</li>',
|
'<li class="layui-tab-item">',
|
'<div id="easyuiLayoutCenter_', that.id, '" class="easyui-layout" data-options="fit:true">',
|
'<div data-options="region:\'north\',split:true" style="height: 300px;border-top: none;border-left: none;border-right: none;">',
|
that.getNorthToolbarHtml(),
|
'<table id="temp_', that.id, '" lay-filter="temp_', that.id, '" style="overflow-x:auto;"></table>',
|
'</div>',
|
'<div data-options="region:\'center\',split:true" style="" id="border_center_', that.id, '">',
|
'<div class="layui-center layui-tab" style="overflow-y:auto;">',
|
'<ul class="layui-tab-title tabTitle" lay-allowClose="false">',
|
'<li class="layui-this">模板属性</li>',
|
'<li>模板流程</li>',
|
'<li>模板阶段</li>',
|
'<li>模板按钮扩展</li>',
|
'</ul>',
|
'<ul class="layui-tab-content tabContent">',
|
'<li class="layui-tab-item layui-show">',
|
that.getToolbarHtml(),
|
'<div style="overflow-y: auto">',
|
'<table id="tempAttr_', that.id, '" lay-filter="tempAttr_', that.id, '" style="overflow-x:auto;"></table>',
|
'</div>',
|
'</li>',
|
'<li class="layui-tab-item">',
|
that.getProcessToolbarHtml(),
|
'<table id="process_', that.id, '" lay-filter="process_', that.id, '" style="overflow-x:auto;"></table>',
|
'</li>',
|
'<li class="layui-tab-item">',
|
that.getPhaseToolbarHtml(),
|
'<table id="phase_', that.id, '" lay-filter="phase_', that.id, '" style="overflow-x:auto;"></table>',
|
'</li>',
|
'<li class="layui-tab-item">',
|
that.getButtonToolbarHtml(),
|
'<table id="button_', that.id, '" lay-filter="button_', that.id, '" style="overflow-x:auto;"></table>',
|
'</li>',
|
'</ul>',
|
'</div>',
|
'</div>',
|
'</div>',
|
'</li>',
|
'</ul>',
|
'</div>',
|
'</div>',
|
'</div>',
|
'</div>'
|
];
|
$("#UIContent_" + that.id).html(html.join(''));
|
};
|
this.getWestToolbarHtml = function () {
|
var that = this;
|
var html = [
|
'<div layui-filter="toolbar_west_', that.id, '" class="layui-btn-container layui-buttons">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_ADDClassify"><i class="layui-icon layui-icon-add-1"></i>添加</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_EDITClassify"><i class="layui-icon layui-icon-edit"></i>修改</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_DELClassify"><i class="layui-icon layui-icon-delete"></i>删除</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_ENABLEClassify"><i class="layui-icon layui-icon-ok-circle"></i>启用</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_DISABLEClassify"><i class="layui-icon layui-icon-404"></i>停用</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_EXPORTClassify"><i class="layui-icon layui-icon-export"></i>导出</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_IMPORTClassify"><i class="layui-icon layui-icon-upload"></i>导入</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_west_', that.id, '_refreshClassify"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
|
'</div>'
|
].join("");
|
return html;
|
};
|
this.createWestSearchHtml = function () {
|
var that = this;
|
webUtil.bindDefultButtonLisenter(that, "west_" + that.id);
|
};
|
this.getNorthToolbarHtml = function () {
|
var that = this;
|
var html = [
|
'<div layui-filter="toolbar_', that.id, '" class="layui-btn-container layui-buttons">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_ADDTEMP"><i class="layui-icon layui-icon-add-1"></i>添加</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_EDITTEMP"><i class="layui-icon layui-icon-edit"></i>修改</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_DELTEMP"><i class="layui-icon layui-icon-delete"></i>删除</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_ADVQUERYTEMP"><i class="layui-icon layui-icon-search"></i>查询</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_refreshTEMP"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_cloneTEMP"><i class="layui-icon layui-icon-share"></i>从其他模板克隆</button>',
|
'</div>'
|
].join("");
|
return html;
|
};
|
this.getToolbarHtml = function (isfull) {
|
var that = this;
|
var html = ['<div layui-filter="toolbar_attr_', that.id, '" class="layui-btn-container layui-buttons">'];
|
if (isfull) {
|
html.push('<div class="layui-btn-group">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_UNBATCHEDIT" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-screen-restore"></i>退出全屏编辑</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_VERIFYUSER" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-auz"></i>验证规则</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_GROUPATTR" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-template-1"></i>属性分组</button>',
|
'</div>')
|
} else {
|
html.push('<div class="layui-btn-group">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_ADD" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-add-1"></i>添加</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_BATCHEDIT" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-screen-full"></i>全屏编辑</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_VERIFYUSER" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-auz"></i>验证规则</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_GROUPATTR" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-template-1"></i>属性分组</button>',
|
'</div>')
|
}
|
html.push('<div class="layui-btn-group">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_CLASSIFYUSE" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-tree"></i>分类注入</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_COMPUSE" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-template"></i>组合规则</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_ENUMUSE" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-rss"></i>枚举注入</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_PARENTATTR" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-release"></i>级联属性</button>',
|
//'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_UPSELECT" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-up"></i>上移</button>',
|
//'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_DOWNSELECT" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-down"></i>下移</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_VIEWORDER" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-down"></i>预览排序</button>',
|
'</div>',
|
'<div class="layui-btn-group">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_SAVE" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-ok"></i>保存</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_DEL" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-delete"></i>删除</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_CANCEL" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-refresh-3"></i>重置</button>',
|
//'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_ADVQUERY" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-search"></i>查询</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_syncAttr" isfull="'+(isfull?'true':'flase')+'"><i class="layui-icon layui-icon-share"></i>同步到其他模板</button>',
|
'</div>')
|
html.push('<div class="layui-btn-group">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_attr_', that.id, '_VIEWCODE" isfull="'+(isfull?'true':'flase')+'">编码申请预览</button>',
|
'</div>')
|
html.push('<div class="layui-input-inline" style="position: relative;margin-left: 10px"><div id="selectWrapForIE" style="display:none"></div><select class="layui-btn layui-btn-sm layui-btn-primary" style="border:2px solid #C9C9C9;line-height: 18px;display: block;text-align: left" name="attr_switch_select'+(isfull?'_full':'')+'"></select></div>')
|
html.push('<div class="layui-form" lay-filter="form_selectattrflag'+(isfull?'_full':'')+'" style="display: inline-block;margin-top: 0;position: relative;top:7px"><input type="checkbox" name="selectattrflag'+(isfull?'full':'')+'" value="false" lay-skin="switch" lay-text="是|否" lay-filter="selectattrflag'+(isfull?'full':'')+'"></div>')
|
html.push('</div>')
|
return html.join("");
|
};
|
this.getProcessToolbarHtml = function (){
|
var that = this;
|
var html = [
|
'<div layui-filter="toolbar_process_', that.id, '" class="layui-btn-container layui-buttons">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_process_', that.id, '_ADDPROCESS"><i class="layui-icon layui-icon-add-1"></i>添加</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_process_', that.id, '_EDITPROCESS"><i class="layui-icon layui-icon-edit"></i>修改</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_process_', that.id, '_DELPROCESS"><i class="layui-icon layui-icon-delete"></i>删除</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_process_', that.id, '_refreshPROCESS"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
|
'</div>'
|
].join("");
|
return html;
|
};
|
this.getPhaseToolbarHtml = function (){
|
var that = this;
|
var html = [
|
'<div layui-filter="toolbar_phase_', that.id, '" class="layui-btn-container layui-buttons">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_phase_', that.id, '_ADDPHASE"><i class="layui-icon layui-icon-add-1"></i>添加</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_phase_', that.id, '_EDITPHASE"><i class="layui-icon layui-icon-edit"></i>修改</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_phase_', that.id, '_DELPHASE"><i class="layui-icon layui-icon-delete"></i>删除</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_phase_', that.id, '_refreshPHASE"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
|
'</div>'
|
].join("");
|
return html;
|
};
|
this.getButtonToolbarHtml = function (){
|
var that = this;
|
var html = [
|
'<div layui-filter="toolbar_button_', that.id, '" class="layui-btn-container layui-buttons">',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_button_', that.id, '_ADDBUTTON"><i class="layui-icon layui-icon-add-1"></i>添加</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_button_', that.id, '_EDITBUTTON"><i class="layui-icon layui-icon-edit"></i>修改</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_button_', that.id, '_DELBUTTON"><i class="layui-icon layui-icon-delete"></i>删除</button>',
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_button_', that.id, '_refreshBUTTON"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
|
'</div>'
|
].join("");
|
return html;
|
};
|
this.createSearchHtml = function () {
|
var that = this;
|
webUtil.createSearchHtml({id:"模板编号",name:"模板名称"},$("[layui-filter='toolbar_" + that.id + "']"),'temp_'+that.id);
|
webUtil.bindDefultButtonLisenter(that, that.id);
|
webUtil.bindDefultButtonLisenter(that, 'attr_'+that.id);
|
that.createAttrSelect()
|
};
|
this.createAttrSelect=function (isfull){
|
var that=this;
|
var optionsHtml = ['<option value="keyattrflag">关键属性</option>','<option value="queryattrflag">查询属性</option>',
|
'<option value="seniorqueryattrflag">高级查询属性</option>','<option value="samerepeatattrflag">相似查重属性</option>',
|
'<option value="barcodeflag">一维码</option>','<option value="qrcodeflag">二维码</option>',
|
'<option value="requireflag">必输</option>','<option value="formdisplayflag">表单显示</option>',
|
'<option value="tabledisplayflag">列表显示</option>','<option value="readonlyflag">只读</option>',
|
'<option value="sortattrflag">列表排序</option>','<option value="textareaflag">多行文本</option>',
|
'<option value="imageflag">预览图</option>']
|
$('select[name="attr_switch_select'+(isfull?'_full':'')+'"]').append(optionsHtml.join(''))
|
layui.form.render('checkbox','form_selectattrflag'+(isfull?'_full':'')+'')
|
layui.form.on('switch(selectattrflag'+(isfull?'full':'')+')', function(obj){
|
var name=$('select[name="attr_switch_select'+(isfull?'_full':'')+'"]').val();
|
var tabledata=layui.table.checkStatus('tempAttr_'+(isfull?'fullScreen_':'')+that.id,true).data;
|
var alltrs=$('div[lay-id="tempAttr_'+(isfull?'fullScreen_':'')+that.id+'"] .layui-table-main tr')
|
layui.each(tabledata,function (i,item){
|
item[name]=='' && (item[name]='false')
|
if(item[name]!=obj.value){
|
$('.layui-form-switch',alltrs.eq(item['LAY_TABLE_INDEX']).find('td[data-field="'+name+'"]')).trigger('click')
|
}
|
})
|
|
});
|
}
|
|
this.init = function () {
|
var that = this;
|
webUtil.copyConfig(that, that.moduleKey);
|
//需要加在定时中,否则样式不能正确展示,不知道原因 wangting
|
setTimeout(function () {
|
that.showContent();
|
var easyuiLayout = $('#easyuiLayout_' + that.id)
|
easyuiLayout.css({height: $('#portal_body').height() - 43, width: $('#portal_body').width() - 15})
|
easyuiLayout.layout();
|
that.createWestSearchHtml();
|
|
that.initForm();
|
that.initTempTable();
|
that.initTempAttrTable();
|
that.initTree();
|
|
that.createProcessSearchHtml();
|
that.initProcessTable();
|
|
that.createPhaseSearchHtml();
|
that.initPhaseTable();
|
|
that.createButtonSearchHtml();
|
that.initButtonTable();
|
|
$('.tab_center_' + that.id + ' li').click(function () {
|
if ($(this).text() == "模板管理" && $(this).attr('isload') != 'true') {
|
$(this).attr('isload', 'true')
|
setTimeout(function () {
|
var easyuiLayout = $('#easyuiLayoutCenter_' + that.id)
|
easyuiLayout.css({
|
height: $("#border_" + that.id).height() - 43,
|
width: $("#border_" + that.id).width() - 10
|
})
|
easyuiLayout.layout();
|
that.createSearchHtml();
|
}, 1)
|
|
}
|
});
|
}, 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.controller + that.url.tree,
|
backPath: that.backPath,
|
extraParams: {
|
isMuti: false,
|
isQueryAllColumn: true
|
},
|
templet: function (d) {
|
if (d.attributes.lcStatus == 'Disable') {
|
return d.name + '【停用】'
|
} else {
|
return d.name
|
}
|
},
|
showSearch: true,
|
click: function (item, elem, options) {
|
that.currentItem = item;
|
that.currentItemOid = item.oid;
|
that.currentItemAttributes = item.attributes;
|
that.setFormValues();
|
}
|
});
|
};
|
this.setFormValues = function () {
|
var that = this;
|
layui.form.load("form_info_" + that.id, {
|
url: that.url.controller + that.url.getObjectByOid,
|
method: 'get',
|
params: {
|
"oid": that.currentItemAttributes.oid
|
},
|
});
|
//列表
|
layui.table.reload('temp_' + that.id, {
|
where: {
|
"conditionMap['codeclassifyoid']": that.currentItemAttributes.oid
|
}
|
})
|
};
|
this.getFormItems = function (onlyShow,isHidden,typeText) {
|
var that = this;
|
var table = layui.table;
|
return [{
|
field: 'id',
|
title: typeText + '编号',
|
required: true,
|
readOnly: onlyShow
|
}, {
|
field: 'name',
|
title: typeText + '名称',
|
required: true,
|
readOnly: onlyShow
|
}, {
|
field: 'description',
|
title: '描述',
|
useAllWidth: true,
|
inputWidth: 575,
|
readOnly: onlyShow
|
}, {
|
field: 'btmtypeid',
|
title: '存储的业务类型',
|
type: 'refer',
|
readOnly: onlyShow,
|
hidden:isHidden,
|
required: (!isHidden),
|
showField: 'btmtypename',
|
useAllWidth: true,
|
inputWidth: 575,
|
referConfig: {
|
type:'platform/objectService/OsBtmTypeRefer'
|
}
|
}, {
|
field: 'coderuleoid',
|
title: '编码规则',
|
type: 'refer',
|
useAllWidth: true,
|
inputWidth: 575,
|
showField: 'coderuleoidName',
|
referConfig: {
|
type: 'default',
|
referBo: 'coderule',
|
where:{
|
lcstatus:'Released'
|
}
|
},
|
readOnly: onlyShow
|
}, {
|
field: 'codekeyattrrepeatoid',
|
title: '关键属性查询规则',
|
type: 'refer',
|
useAllWidth: true,
|
inputWidth: 575,
|
showField: 'codekeyattrrepeatoidName',
|
referConfig: {
|
type: 'default',
|
referBo: 'codekeyattrrepeat',
|
where:{
|
lcstatus:'Enabled'
|
}
|
},
|
readOnly: onlyShow
|
},{
|
field: 'codeResembleRuleOid',
|
title: '相似查询规则',
|
type:'refer',
|
useAllWidth: true,
|
showField: 'codeResembleRuleOidName',
|
inputWidth: 575,
|
referConfig: {
|
type: 'default',
|
referBo: 'coderesemblerule',
|
where:{
|
lcstatus:'Enabled'
|
}
|
},
|
readOnly: onlyShow
|
}];
|
};
|
this.initForm = function () {
|
var that = this;
|
var form = layui.form;
|
form.addItems("form_info_" + that.id, that.getFormItems(true,false,'主题库/分类'), function () {
|
}, {}, {
|
defaultColumnOneRow: 2,
|
labelWidth: 200
|
});
|
};
|
this.initTempAttrTable = function (parentFieldName) {
|
var that = this;
|
var table = layui.table;
|
that.checkTempAttrColumns();
|
//$('#tempAttr_' + that.id).parent().height($("#border_" + that.id).height()-442)
|
var options = {
|
elem: '#tempAttr_' + that.id,
|
id: 'tempAttr_' + that.id,
|
data:[],
|
limit:-1,
|
selectMode: table.selectMode.muti,
|
cols: [that.tempAttrColumns],
|
width:$("#border_center_" + that.id).width(),
|
height:Math.max($("#border_" + that.id).height()-450,160),
|
remoteSort:false,
|
done: function (res, cur, total) {
|
table.on('tool(tempAttr_' + that.id + ')', function (obj) {
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if (layEvent == 'UP') {
|
that.UPTempAttr(data,'tempAttr_' + that.id);
|
} else if (layEvent == 'DOWN') {
|
that.DOWNTempAttr(data,'tempAttr_' + that.id);
|
} else if (layEvent == 'REM') {
|
that.REMTempAttr(data,'tempAttr_' + that.id);
|
}
|
});
|
that.bindSwitch('tempAttr_'+that.id)
|
}
|
};
|
if (parentFieldName) {
|
options.treeConfig = {
|
treepid: parentFieldName,
|
treeid: 'id',
|
showField: 'name'
|
};
|
}
|
table.render(options);
|
that.getTempAttrData('tempAttr_' + that.id)
|
};
|
this.getTempAttrData=function (filter){
|
var that=this;
|
var params = {};
|
var sourceDataParams = {}
|
var options=layui.table.getConfig(filter)
|
params['page'] = 1;
|
params['limit'] = -1;
|
if (options.sourceDataParams) {
|
//说明是扩展属性
|
for (var key in options.sourceDataParams) {
|
if (key && key.constructor === Object) return;
|
sourceDataParams['sourceData["' + key + '"]'] = options.sourceDataParams[key];//新的方式
|
}
|
}
|
//参数
|
var where = $.extend(params, options.where, options.extraParams,options.queryParams, sourceDataParams);
|
$webUtil.ajax('get', that.url.templateAttrController + that.url.templateAttrDataGrid, where, function (res) {
|
layui.table.reload(filter, {
|
data:res.data
|
})
|
}, function (e, msg) {
|
$webUtil.showDebugMsg('数据接口请求异常,错误提示:' + msg);
|
}, that.backPath,true);
|
}
|
this.checkTempAttrColumns = function () {
|
var that = this;
|
var table = layui.table;
|
if (that.tempAttrColumns == null || that.tempAttrColumns.length == 0) {
|
that.tempAttrColumns = [{
|
field: 'ordernum',
|
title: '排序号',
|
sort: true,
|
edit: 'number',
|
width: 60,
|
fixed:'left'
|
}, table.getCheckColumn({fixed:'left'}), {
|
field: 'id',
|
title: '属性英文编号',
|
sort: true,
|
width: 100,
|
fixed:'left'
|
}, {
|
field: 'name',
|
title: '属性中文名称',
|
sort: true,
|
edit: 'text',
|
width: 130,
|
fixed:'left'
|
},
|
{
|
title: '属性分组',
|
field: 'attributegroup',
|
sort: true,
|
edit: 'text',
|
width: 90
|
},
|
{
|
title: '类型',
|
field: 'attributeDataTypeText',
|
sort: true,
|
width: 60
|
},{
|
title: '列表宽度',
|
field: 'attrTableWidth',
|
width: 80,
|
edit:'number'
|
},
|
{
|
title: '关键属性',
|
field: 'keyattrflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="keyattrflag" value="'+d.keyattrflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.keyattrflag==true||d.keyattrflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '查询属性',
|
field: 'queryattrflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="queryattrflag" value="'+d.queryattrflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.queryattrflag==true||d.queryattrflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '高级查询属性',
|
field: 'seniorqueryattrflag',
|
width: 85,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="seniorqueryattrflag" value="'+d.seniorqueryattrflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.seniorqueryattrflag==true||d.seniorqueryattrflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '相似查重属性',
|
field: 'samerepeatattrflag',
|
width: 85,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="samerepeatattrflag" value="'+d.samerepeatattrflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.samerepeatattrflag==true||d.samerepeatattrflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '一维码',
|
field: 'barcodeflag',
|
width: 65,
|
hidden:true,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="barcodeflag" value="'+d.barcodeflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.barcodeflag==true||d.barcodeflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '二维码',
|
field: 'qrcodeflag',
|
width: 65,
|
hidden:true,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="qrcodeflag" value="'+d.qrcodeflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.qrcodeflag==true||d.qrcodeflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '必输',
|
field: 'requireflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="requireflag" value="'+d.requireflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.requireflag==true||d.requireflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '表单显示',
|
field: 'formdisplayflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="formdisplayflag" value="'+d.formdisplayflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.formdisplayflag==true||d.formdisplayflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '列表显示',
|
field: 'tabledisplayflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="tabledisplayflag" value="'+d.tabledisplayflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.tabledisplayflag==true||d.tabledisplayflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '只读',
|
field: 'readonlyflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="readonlyflag" value="'+d.readonlyflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.readonlyflag==true||d.readonlyflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '列表排序',
|
field: 'sortattrflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="sortattrflag" value="'+d.sortattrflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.sortattrflag==true||d.sortattrflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '多行文本',
|
field: 'textareaflag',
|
width: 65,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
return '<input type="checkbox" name="textareaflag" value="'+d.textareaflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.textareaflag==true||d.textareaflag=='true' ? 'checked' : '') +'>';
|
}
|
},
|
{
|
title: '预览图',
|
field: 'imageflag',
|
width: 65,
|
hidden:true,
|
data: [{key: "true", value: "是"}, {key: "false", value: "否"}],
|
templet: function (d) {
|
//return webUtil.formateBoolean(d.imageflag);
|
return '<input type="checkbox" name="imageflag" value="'+d.imageflag+'" lay-skin="switch" lay-text="是|否" lay-filter="attrflag" '+(d.imageflag ==true||d.imageflag=='true'? 'checked' : '') +'>'
|
}
|
},
|
{
|
title: '默认值',
|
field: 'defaultvalue',
|
sort: true,
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '前缀',
|
field: 'prefixvalue',
|
sort: true,
|
edit: 'select',
|
editConfig: {
|
editable:true,
|
comboxKey:'prefixvalue',
|
comboxConfig:{
|
url:"bdSelectInputController/listByFlag",
|
backPath:that.backPath,
|
extraParams:{
|
namespace:'codeclstempattr',
|
flag:'prefix'
|
}
|
}
|
},
|
width: 80
|
},
|
{
|
title: '后缀',
|
field: 'suffixvalue',
|
sort: true,
|
edit: 'select',
|
editConfig: {
|
editable:true,
|
comboxKey: 'suffixvalue',
|
comboxConfig:{
|
url:"bdSelectInputController/listByFlag",
|
backPath:that.backPath,
|
extraParams:{
|
namespace:'codeclstempattr',
|
flag:'suffix'
|
}
|
}
|
},
|
width: 80
|
},
|
{
|
title: '组合规则',
|
field: 'componentrule',
|
sort: true,
|
edit: 'refer',
|
editConfig:{
|
referConfig:{
|
type:'formulaEditor',
|
currentVarsUrl:'codeClassifyTempAttrController/gridCodeClassifyTemplateAttr',
|
currentVarsParams: {
|
"conditionMap[\"classifyTemplateOid\"]":"${formValues.classifytemplateoid}",
|
"conditionMap[\"oid\"]":"!=${formValues.oid}"
|
}
|
}
|
},
|
width: 180
|
},
|
{
|
title: '验证规则',
|
field: 'verifyrule',
|
sort: true,
|
edit: 'refer',
|
editConfig:{
|
referConfig:{
|
type:'mdm/CodeClassifyVerifyUser'
|
}
|
},
|
width: 150
|
},
|
{
|
title: '时间格式',
|
field: 'codedateformat',
|
sort: true,
|
edit: 'select',
|
editConfig: {
|
editable:true,
|
comboxKey: 'codedateformat',
|
comboxConfig:{
|
url:"bdSelectInputController/listByFlag",
|
backPath:that.backPath,
|
extraParams:{
|
namespace:'codeclstempattr',
|
flag:'dateFormates'
|
}
|
}
|
},
|
width: 150
|
},
|
{
|
title: '分类注入(层级/名称)',
|
field: 'classifyinvokelevel',
|
edit: 'refer',
|
editConfig:{
|
referConfig:{
|
type:'mdm/CodeClassifyClassifyuse',
|
setValue: 'layui.table.changeRecord(that.key, index, rawValue)'
|
}
|
},
|
width: 200,
|
templet: function (d) {
|
if(d.classifyinvokeattr){
|
var value='注入类型:'+d.classifyinvokeattr+';';
|
if(d.classifyinvokeattr=='id'){
|
value+='注入类型名称:分类代号;'
|
}else{
|
value+='注入类型名称:分类名称;'
|
}
|
value+='层级设置:'+d.classifyinvokelevel+';';
|
value+='是否可修改:'+webUtil.formateBoolean(d.classifyinvokeeditflag);
|
return value;
|
}else{
|
return ''
|
}
|
}
|
},
|
{
|
title: '枚举注入',
|
field: 'enumString',
|
edit: 'refer',
|
editConfig:{
|
referConfig:{
|
type:'mdm/CodeClassifyEnumUse'
|
}
|
},
|
width: 150
|
},
|
{
|
title: '级联属性',
|
field: 'parentCode',
|
edit: 'refer',
|
editConfig:{
|
referConfig:{
|
type:'mdm/CodeClassifyAttribute',
|
setValue: 'layui.table.changeRecord(that.key, index, rawValue)'
|
}
|
},
|
width: 150,
|
templet: function (d) {
|
return d.parentCode?(d.parentCode+'('+d.parentName+')'): '';
|
}
|
},
|
{
|
title: '参照配置',
|
field: 'referConfig',
|
edit: 'refer',
|
editConfig:{
|
referConfig:{
|
type:'referConfig'
|
}
|
},
|
width: 150
|
},
|
{
|
title: '级联查询属性',
|
field: 'parentQueryAttr',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '选择库标识',
|
field: 'libraryIdentification',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '填写提示',
|
field: 'explain',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '表单显示样式',
|
field: 'formdisplaystyle',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '表格显示样式',
|
field: 'tabledisplaystyle',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '表单超链接',
|
field: 'formhref',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '表格超链接',
|
field: 'tablehref',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '表格显示js',
|
field: 'tabledisplayjs',
|
edit: 'text',
|
width: 150
|
},
|
{
|
title: '长度',
|
field: 'controllength',
|
width: 60
|
},
|
{
|
title: '小数精度(刻度)',
|
field: 'precisionlength',
|
width: 100
|
},
|
{
|
title: '取值范围',
|
field: 'valuearea',
|
sort: true,
|
edit: 'text',
|
width: 150
|
},
|
{
|
field: 'options',
|
title: '操作',
|
width: 70,
|
fixed:'right',
|
templet: function (d) {
|
return ['<a class="layui-btn layui-btn-intable" lay-event="REM">移除</a>'].join('');
|
}
|
}];
|
|
that.tempAttrdataFields = [{
|
field: 'id',
|
title: '属性英文编号'
|
}, {
|
field: 'name',
|
title: '属性中文名称'
|
},
|
{
|
title: '属性分组',
|
field: 'attributegroup'
|
},
|
{
|
title: '类型',
|
field: 'attributedatatypeText',
|
type: 'combox',
|
data: []
|
},
|
{
|
title: '关键属性',
|
field: 'keyattrflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '查询属性',
|
field: 'queryattrflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '高级查询属性',
|
field: 'seniorqueryattrflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '相似查重属性',
|
field: 'samerepeatattrflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
/*{
|
title: '一维码',
|
field: 'barcodeflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '二维码',
|
field: 'qrcodeflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},*/
|
{
|
title: '必输',
|
field: 'requireflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '表单显示',
|
field: 'formdisplayflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '列表显示',
|
field: 'tabledisplayflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '只读',
|
field: 'readonlyflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '列表排序',
|
field: 'sortattrflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
},
|
{
|
title: '长度',
|
field: 'controllength',
|
type: 'number'
|
},
|
{
|
title: '默认值',
|
field: 'defaultvalue'
|
},
|
{
|
title: '前缀',
|
field: 'prefixvalue'
|
},
|
{
|
title: '后缀',
|
field: 'suffixvalue'
|
},
|
{
|
title: '小数精度(刻度)',
|
field: 'precisionlength',
|
type: 'number'
|
},
|
{
|
title: '组合规则',
|
field: 'componentrule'
|
},
|
{
|
title: '验证规则',
|
field: 'verifyrule'
|
},
|
{
|
title: '取值范围',
|
field: 'valuearea'
|
},
|
{
|
title: '时间格式',
|
field: 'codedateformat'
|
},
|
{
|
title: '分类注入(层级/名称)',
|
field: 'classifyinvokelevel'
|
},
|
{
|
title: '枚举注入',
|
field: 'enumid'
|
},
|
{
|
title: '参照配置',
|
field: 'referConfig'
|
},
|
{
|
title: '表单显示样式',
|
field: 'formdisplaystyle'
|
},
|
{
|
title: '表格显示样式',
|
field: 'tabledisplaystyle'
|
},
|
{
|
title: '表单超链接',
|
field: 'formhref'
|
},
|
{
|
title: '表格超链接',
|
field: 'tablehref'
|
},
|
{
|
title: '表格显示js',
|
field: 'tabledisplayjs'
|
},
|
{
|
title: '多行文本',
|
field: 'textareaflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
}/*,
|
{
|
title: '预览图',
|
field: 'imageflag',
|
type: 'combox',
|
comboxKey: [{key: "true", value: "是"}, {key: "false", value: "否"}]
|
}*/]
|
}
|
};
|
this.bindSwitch=function (tableId){
|
var that=this;
|
layui.form.on('switch(attrflag)', function(obj){
|
var tr=$(obj.othis).parents('tr');
|
var data= layui.table.getData(tableId)[tr.attr('data-index')]
|
data[this.name]=obj.elem.checked
|
//layui.table.changeRecord(tableId,tr.attr('data-index'),data);
|
$(obj.othis).parents('td').addClass('layui-table-edit_notsubmit')
|
});
|
}
|
this.initTempTable = function () {
|
var that = this;
|
var table = layui.table;
|
that.checkTempColumns();
|
var tableWidth = $("#border_" + that.id).width();
|
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
|
},
|
selectMode: table.selectMode.muti,
|
cols: [that.tempColumns],
|
method: 'get',
|
done: function (res, cur, total) {
|
if (!that.fristMainLoad) {
|
table.on('tool(temp_' + that.id + ')', function (obj) {
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if (layEvent == 'EDIT') {
|
that.addOrEditTEMP(false,false, data);
|
} else if (layEvent == 'UPREVSION') {
|
that.doUPTEMP(data.oid, data.ts);
|
}else if(layEvent=='DISABLE'){
|
webUtil.showConfirmMsg("模板只有发布状态才能被使用,是否确定停用?", function () {
|
that.disableOrEnableTEMP(false, data.oid, data.ts);
|
});
|
}else if(layEvent=='ENABLE'){
|
webUtil.showConfirmMsg("是否确定启用/发布这个模板,模板只有发布状态才能被使用,是否继续?", function () {
|
that.disableOrEnableTEMP(true, data.oid, data.ts);
|
});
|
}
|
});
|
} else {
|
if (total > 0) {
|
table.selectRecord('temp_' + that.id, {index: 0});
|
}else {
|
table.reload("tempAttr_" + that.id, {
|
data:[]
|
})
|
}
|
}
|
that.fristMainLoad = true;
|
},
|
rowClick: function (thisTableFilter, record) {
|
var options=layui.table.getConfig('tempAttr_' + that.id)
|
options.extraParams={
|
"conditionMap['classifyTemplateOid']": record.oid
|
}
|
table.setConfig(options)
|
that.getTempAttrData('tempAttr_' + that.id)
|
table.reload("process_" + that.id, {
|
extraParams: {
|
"conditionMap['classifyTemplateOid']": record.oid
|
}
|
})
|
table.reload("phase_" + that.id,{
|
extraParams: {
|
"conditionMap['codeClassifyTemplateOid']": record.oid
|
}
|
})
|
table.reload("button_" + that.id,{
|
extraParams: {
|
"conditionMap['classifyTemplateOid']": record.oid
|
}
|
})
|
}
|
};
|
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: 200,
|
fixed:'right',
|
templet: function (d) {
|
var btns=[];
|
if (d.lcStatus == 'Editing') {
|
btns.push('<a class="layui-btn layui-btn-intable" lay-event="EDIT">编辑</a><a class="layui-btn layui-btn-intable" lay-event="ENABLE">启用/发布</a>')
|
}else if(d.lcStatus=='Disabled'){
|
btns.push('<a class="layui-btn layui-btn-intable" lay-event="ENABLE">启用/发布</a>');
|
}else if(d.lcStatus=='Released' || d.lcStatus=='Enabled'){
|
btns.push('<a class="layui-btn layui-btn-intable" lay-event="DISABLE">停用/失效</a><a class="layui-btn layui-btn-intable" lay-event="UPREVSION">升版</a>');
|
}
|
return btns.join("");
|
}
|
}];
|
that.tempdataFields = [{
|
field: 'id',
|
title: '模板编号'
|
}, {
|
field: 'name',
|
title: '模板名称'
|
}, {
|
field: 'description',
|
title: '模板描述'
|
}, {
|
field: 'revisionValue',
|
title: '版本号'
|
}, {
|
field: 'lcStatus',
|
title: '状态',
|
type: 'combox',
|
comboxKey: [{key: "Editing", value: "编辑中"}, {key: "Released", value: "已撤销"}, {
|
key: "Designing",
|
value: "已挂起"
|
}, {key: "Finish", value: "已完工"}, {key: "Scrap", value: "已作废"}]
|
}]
|
}
|
};
|
this.createProcessSearchHtml = function (){
|
var that = this;
|
webUtil.createSearchHtml({name:"模板名称"},$("[layui-filter='toolbar_process_" + that.id + "']"),'process_' + that.id);
|
webUtil.bindDefultButtonLisenter(that, "process_" + that.id);
|
|
};
|
this.initProcessTable = function () {
|
var that = this;
|
var table = layui.table;
|
that.checkProcessColumns();
|
var tableWidth = $("#border_" + that.id).width() - 15;
|
var options = {
|
elem: '#process_' + that.id,
|
id: 'process_' + that.id,
|
backPath: that.backPath,
|
url: that.url.processLinkController + that.url.processLinkDataGrid,
|
page: {
|
limit: 15,
|
page: 1
|
},
|
width: tableWidth,
|
selectMode: table.selectMode.muti,
|
cols: [that.processColumns],
|
method: 'get',
|
done: function (res, cur, total) {
|
if (!that.fristProcessLoad) {
|
table.on('tool(process_' + that.id + ')', function (obj) {
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if (layEvent == 'EDIT') {
|
that.addOrEditProcess(false,data.classifyTemplateOid,data.oid);
|
}
|
});
|
} else {
|
if (total > 0) {
|
table.selectRecord('process_' + that.id, {index: 0});
|
}
|
}
|
that.fristProcessLoad = true;
|
}
|
};
|
table.render(options);
|
};
|
this.checkProcessColumns = function (){
|
var that = this;
|
var table = layui.table;
|
if(that.processColumns==null || that.processColumns.length==0){
|
that.processColumns = [table.getIndexColumn(),table.getCheckColumn(),
|
{
|
title: '模板key',
|
field: 'id',
|
sort:true,
|
width: 150
|
},{
|
title: '模板名称',
|
field: 'name',
|
sort:true,
|
width: 200
|
},{
|
title: '模板版本',
|
field: 'processVersion',
|
width: 70
|
}, {
|
title: '流程模板用途',
|
field: 'codeprocessuseText',
|
sort:true,
|
sortField:'codeprocessuse',
|
type:'combox',
|
comboxKey:"codeClassifyProcessUse",
|
width: 150
|
},{
|
field: 'codeTempAttrOidArrName',
|
title: '流程树显示属性',
|
width: 200
|
},
|
{
|
field:'options',
|
title:'操作',
|
width: 100,
|
templet:function(d){
|
return '<a class="layui-btn layui-btn-intable" lay-event="EDIT">编辑</a>';
|
}
|
}];
|
}
|
};
|
|
this.createPhaseSearchHtml = function (){
|
var that = this;
|
webUtil.createSearchHtml({name:"阶段名称"},$("[layui-filter='toolbar_phase_" + that.id + "']"),'phase_' + that.id);
|
webUtil.bindDefultButtonLisenter(that, "phase_" + that.id);
|
};
|
this.initPhaseTable = function (){
|
var that = this;
|
var table = layui.table;
|
that.checkPhaseColumns();
|
var tableWidth = $("#border_" + that.id).width() - 15;
|
var options = {
|
elem: '#phase_' + that.id,
|
id: 'phase_' + that.id,
|
backPath: that.backPath,
|
url: that.url.phaseController + that.url.phaseDataGrid,
|
page: {
|
limit: 15,
|
page: 1
|
},
|
width: tableWidth,
|
selectMode: table.selectMode.muti,
|
cols: [that.phaseColumns],
|
method: 'get',
|
done: function (res, cur, total) {
|
if (!that.fristPhaseLoad) {
|
table.on('tool(phase_' + that.id + ')', function (obj) {
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if (layEvent == 'EDITPHASE') {
|
that.addOrEditPhase(false,data.oid);
|
}
|
if (layEvent == 'VIEWPHASE') {
|
that.addOrEditPhase(false,data.oid,true);
|
}
|
});
|
} else {
|
if (total > 0) {
|
table.selectRecord('phase_' + that.id, {index: 0});
|
}
|
}
|
that.fristPhaseLoad = true;
|
}
|
};
|
table.render(options);
|
};
|
this.checkPhaseColumns = function (){
|
var that = this;
|
var table = layui.table;
|
if(that.phaseColumns==null || that.phaseColumns.length==0){
|
that.phaseColumns = [table.getIndexColumn(),table.getCheckColumn(),
|
{
|
field:'id',
|
title: '阶段编号',
|
width: 150
|
},{
|
field: 'name',
|
title: '阶段名称',
|
width: 200
|
},{
|
field: 'description',
|
title: '描述',
|
width: 150
|
},
|
{
|
field:'options',
|
title:'操作',
|
width: 150,
|
templet:function(d){
|
return '<a class="layui-btn layui-btn-intable" lay-event="EDITPHASE">编辑</a><a class="layui-btn layui-btn-intable" lay-event="VIEWPHASE">查看</a>';
|
}
|
}];
|
}
|
};
|
this.createButtonSearchHtml = function (){
|
var that = this;
|
webUtil.createSearchHtml({name:"按钮名称"},$("[layui-filter='toolbar_button_" + that.id + "']"),'button_' + that.id);
|
webUtil.bindDefultButtonLisenter(that, "button_" + that.id);
|
};
|
this.initButtonTable = function (){
|
var that = this;
|
var table = layui.table;
|
that.checkButtonColumns();
|
var tableWidth = $("#border_" + that.id).width() - 15;
|
var options = {
|
elem: '#button_' + that.id,
|
id: 'button_' + that.id,
|
backPath: that.backPath,
|
url: that.url.buttonController + that.url.buttonDataGrid,
|
page: {
|
limit: 15,
|
page: 1
|
},
|
width: tableWidth,
|
selectMode: table.selectMode.muti,
|
cols: [that.buttonColumns],
|
method: 'get',
|
done: function (res, cur, total) {
|
if (!that.fristButtonLoad) {
|
table.on('tool(button_' + that.id + ')', function (obj) {
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if (layEvent == 'EDITBUTTON') {
|
that.addOrEditButton(false,data.oid);
|
}
|
});
|
} else {
|
if (total > 0) {
|
table.selectRecord('phase_' + that.id, {index: 0});
|
}
|
}
|
that.fristButtonLoad = true;
|
}
|
};
|
table.render(options);
|
};
|
this.checkButtonColumns = function(){
|
var that = this;
|
var table = layui.table;
|
if(that.buttonColumns==null || that.buttonColumns.length==0){
|
that.buttonColumns = [table.getIndexColumn(),table.getCheckColumn(),
|
{
|
title: '按钮标识',
|
field: 'id',
|
sort:true,
|
width: 150
|
},
|
{
|
title: '按钮名称',
|
field: 'classifybuttonoidName',
|
width: 150
|
},
|
{
|
title: '按钮用途',
|
field: 'buttonUseText',
|
sortField:'buttonuse',
|
sort:true,
|
width: 150
|
},
|
{
|
title: '排序号',
|
field: 'ordernum',
|
type: 'number',
|
width: 100
|
}];
|
}
|
};
|
this.ADDClassify = function () {
|
var that = this;
|
that.addOrEditClassify(true);
|
};
|
this.EDITClassify = function () {
|
var that = this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从树上选择一条数据");
|
return false;
|
}
|
that.addOrEditClassify(false, that.currentItemOid);
|
};
|
//添加修改主题库分类
|
this.addOrEditClassify = function (add, oid) {
|
var that = this;
|
var form = layui.form;
|
var filter = "form_" + that.id;
|
var typeText = $webUtil.isNull(that.currentItemOid)?'主题库':'分类';
|
var title = (add ? '添加' : '修改') + typeText;
|
var addSaveIndex = webUtil.dialog({
|
title: title,
|
btn: ['保存', '取消'],
|
content: '<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form" style="margin:10px 50px 10px 0" ></form>',
|
resizing: function (layero) {
|
form.doResize(filter);
|
},
|
success: function (layero, layerIndex, classP) {
|
var isHidden=false;
|
if((add && that.currentItemOid) || (!add && webUtil.isNotNull(that.currentItemAttributes.parentcodeclassifyoid))){
|
isHidden=true;
|
}
|
form.addItems(filter, that.getFormItems(false,isHidden,typeText),
|
function () {
|
if (!add) {
|
form.load(filter, {
|
backPath: that.backPath,
|
url: that.url.controller + that.url.getObjectByOid,
|
method: 'get',
|
params: {
|
oid: oid
|
}
|
});
|
} else {
|
var defaultValues = {};
|
if (that.currentItemAttributes) {
|
defaultValues["parentcodeclassifyoid"] = that.currentItemOid;
|
defaultValues["parentcodeclassifyoidname"] = that.currentItemAttributes.name;
|
}
|
//可以手动在此处添加默认值
|
form.setValues(defaultValues, filter);
|
}
|
webUtil.relocationOpen(classP)
|
}, {}, {defaultColumnOneRow: 3, labelWidth: 160});
|
},
|
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);
|
if ($webUtil.isNull(values.parentcodeclassifyoid)
|
&& $webUtil.isNull(values.btmtypeid)) {
|
$webUtil.showErrorMsg('主题库必须设置业务类型');
|
return false;
|
}
|
if($webUtil.isNotNull(values.parentcodeclassifyoid)){
|
values.btmtypeid=''
|
values.btmtypename=''
|
}
|
webUtil.manualAjax(add ? 'post' : 'put', url, JSON.stringify(values), function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, (add ? "添加成功" : "修改成功"));
|
layer.close(addSaveIndex);
|
that.refreshClassify();
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
}
|
},
|
btn2: function (layero) {
|
layer.close(addSaveIndex);
|
}
|
});
|
};
|
this.DELClassify = function () {
|
var that = this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从树上的节点");
|
return false;
|
}
|
var ts = that.currentItemAttributes.ts;
|
webUtil.showConfirmMsg("是否删除当前选择的分类,将会把子分类一并删除,如果存在编码数据将不能被删除,是否继续?", function () {
|
var submitValue = {oid: that.currentItemOid, ts: ts};
|
webUtil.post(that.url.controller + that.url.checkIsCanDelete, submitValue, function (result) {
|
if (result.success) {
|
if ('true' == result.obj || true == result.obj) {
|
webUtil.showConfirmMsg("当前数据包含有下级数据,要删除的话会和下级数据一起删除,你确认继续?", function () {
|
that.doDeleteClassify(submitValue);
|
});
|
} else {
|
//说明可以删除
|
that.doDeleteClassify(submitValue);
|
}
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, error) {
|
webUtil.showErrorMsg("校验删除出现了错误,可能是服务器未启动")
|
}, that.backPath);
|
});
|
};
|
this.doDeleteClassify = function (submitValue) {
|
var that = this;
|
webUtil.deleteRequest( that.url.controller + that.url.deleteUrl, submitValue, function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, "删除成功");
|
that.currentItemOid=null;
|
that.currentItemAttributes=null;
|
that.currentItem=null;
|
that.refreshClassify();
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("执行删除的时候出错了错误,可能是服务器暂时无法访问");
|
}, that.backPath);
|
};
|
|
this.DISABLEClassify = function () {
|
var that = this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从树上选择一条数据");
|
return false;
|
}
|
if(that.currentItemAttributes.lcStatus!='Enabled'){
|
webUtil.showErrorMsg("当前分类不是启用状态");
|
return false;
|
}
|
webUtil.showConfirmMsg("是否停用当前分类,停用后,子分类也将不能被使用,是否继续?", function () {
|
that.disableOrEnableClassify(false);
|
});
|
|
};
|
this.ENABLEClassify = function () {
|
var that = this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从树上选择一条数据");
|
return false;
|
}
|
if(that.currentItemAttributes.lcStatus!='Disabled' && that.currentItemAttributes.lcStatus!='Editing' ){
|
webUtil.showErrorMsg("当前分类不是停用状态");
|
return false;
|
}
|
var enableIndex = layer.open({
|
title: '需要您确认',
|
btn: ['是', '否', '取消'],
|
content: '<div style="padding: 0px 0px 0px 35px;text-align: left;"><i class="layui-layer-ico layui-layer-ico3"></i>是否将子分类一并启用?</div>',
|
resizing: function (layero) {
|
},
|
success: function (layero, layerIndex, classP) {
|
webUtil.relocationOpen(classP)
|
},
|
yes: function (layero) {
|
that.disableOrEnableClassify(true, true);
|
},
|
btn2: function (layero) {
|
that.disableOrEnableClassify(true, false);
|
},
|
btn3: function (layero) {
|
layer.close(enableIndex);
|
}
|
})
|
|
};
|
//停用启用主题库分类
|
this.disableOrEnableClassify = function (enable, ablechildren) {
|
var that = this;
|
var oid;
|
var ts;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从树上选择一条数据");
|
return false;
|
}
|
oid = that.currentItemOid;
|
ts = that.currentItemAttributes.ts;
|
webUtil.post(that.url.controller + (enable ? that.url.enableData : that.url.disableData), {
|
oid: oid,
|
ts: ts,
|
ablechildren: ablechildren
|
}, function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, (enable ? '启用成功' : '停用成功'));
|
that.refreshClassify();
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
};
|
|
this.refreshClassify = function (buttonid, ele) {
|
var that = this;
|
var tree = layui.tree;
|
if (that.currentItem && !buttonid) {
|
if (webUtil.isNotNull(that.currentItem.parentId)) {
|
tree.reloadNode("tree_" + that.id, that.currentItem.parentId, function (filter, elem, data) {
|
var currentelem = layui.tree.getElemByItem("tree_" + that.id, that.currentItemOid);
|
if (currentelem.length > 0) {
|
currentelem.children('a').trigger('click')
|
} else {
|
elem.children('a').trigger('click').trigger('click')
|
}
|
});
|
} else {
|
tree.reload("tree_" + that.id, {
|
loadCallback: function (filter, tempNode) {
|
if (that.currentItemOid) {
|
var currentelem = layui.tree.getElemByItem("tree_" + that.id, that.currentItemOid);
|
if (currentelem.length > 0) {
|
currentelem.children('a').trigger('click')
|
}
|
}
|
}
|
});
|
}
|
}else{
|
tree.reload("tree_" + that.id, {
|
loadCallback: function (filter, tempNode) {
|
}
|
});
|
that.currentItemOid=null;
|
that.currentItemAttributes=null;
|
that.currentItem=null;
|
}
|
};
|
this.ADVQUERYClassify = function () {
|
var that = this;
|
if (!that.serinorQueryInstance) {
|
var dynamicCondition = layui.dynamicCondition;
|
$('[layui-filter="toolbar_' + that.id + '"]').append('<div id="toolbar' + that.id + '" class="layui-inline"></div>');
|
that.checkColumns();
|
that.serinorQueryInstance = dynamicCondition.create({
|
fields: that.dataFields//查询字段
|
, tableId: "table_" + that.id//需要查询的表格
|
, type: "complex" //type:"simple"/"complex" 查询的方法 暂时写死为 complex
|
, queryCallBack: function (requestData) {//查询之后的callback
|
|
}
|
});
|
}
|
that.serinorQueryInstance.open();
|
};
|
|
//判断模板数据状态
|
this.checkTEMPStatus = function (isStatus,statusMsg) {
|
var that = this;
|
var checkData = layui.table.checkStatus("temp_" + that.id).data;
|
if (checkData.length != 1) {
|
webUtil.showErrorMsg('请选择一个模板');
|
return false;
|
}
|
isStatus=false;
|
if (isStatus) {
|
if (checkData[0].lcStatus != 'Editing') {
|
webUtil.showErrorMsg(statusMsg || '模板状态不是“编辑中”');
|
return false;
|
}
|
}
|
return checkData[0];
|
};
|
//模板属性添加
|
this.ADD = function (type,button) {
|
var that = this;
|
var tempData=that.checkTEMPStatus(true)
|
if (!tempData) {
|
return false;
|
}
|
var table = layui.table;
|
var filter = "add_attr_" + that.id;
|
var addSaveIndex = webUtil.dialog({
|
title: '从业务类型中选择属性',
|
btn: ['确定选择', '取消'],
|
area: ['1280px', '600px'],
|
content: '<div class="layui-form-item" style="height:24px;margin:5px 5px 0 5px;display:inline-block"> ' +
|
'<div class="layui-input-inline" style="height:24px;line-height:24px;width:120px;min-width: 120px">' +
|
'<select name="searchAttr_' + filter + '" style="height:24px;width:120px;font-size:15px;">' +
|
'<option value="id">属性英文名称</option>' +
|
'<option value="name">属性英文名称</option>' +
|
'</select>' +
|
'</div>' +
|
'<div class="layui-input-inline"><input type="text" style="height:24px;font-size:14px;" name="searchvalue_'+ filter + '" placeholder="输入值后回车进行模糊查询" class="layui-input" ></div>'+
|
'<div class="layui-input-inline" ><button class="layui-btn" style="height:24px;line-height:24px;margin: 0" name="searchbtn_'+ filter + '" >查询</button></div>' +
|
'</div>'+
|
'<table id="table_' + filter + '" lay-filter="' + filter + '" style="margin-top:5px" ></table>',
|
success: function (layero, layerIndex, classP) {
|
var columns = [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: 60,
|
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: 130,
|
templet: function (d) {
|
if (!d.enumFlag) {
|
return '';
|
} else {
|
return d.enumId
|
}
|
}
|
}]
|
var options = {
|
elem: '#table_' + filter,
|
id: 'table_' + filter,
|
backPath: that.backPath,
|
url: that.url.templateAttrController + 'codeClassifyTemplateAttrByBtm',
|
extraParams:{
|
"conditionMap['oid']":tempData.oid
|
},
|
selectMode: table.selectMode.muti,
|
limit: -1,
|
cols: [columns]
|
};
|
table.render(options);
|
|
$('[name="searchbtn_'+ filter +'"]').click(function(){
|
var searchField = $(this).parent().parent().find('select').val();
|
var searchValue = $(this).parent().parent().find('[name="searchvalue_' + filter + '"]').val();
|
queryByCondition('table_' + filter,searchField,searchValue);
|
});
|
$('[name="searchvalue_'+ filter +'"]').keydown(function(e){
|
if(e.keyCode == 13) {
|
var searchField = $(this).parent().parent().find('select').val();
|
var searchValue = $(this).val();
|
queryByCondition('table_' + filter, searchField,searchValue);
|
}
|
});
|
|
queryByCondition = function(tableId,searchField,searchValue){
|
if($webUtil.isNotNull(searchValue)){
|
searchValue = "*" + searchValue + "*";
|
}
|
var requestData={}
|
requestData['conditionMap["' + searchField + '"]'] = searchValue;
|
requestData['page']= 1;
|
var table = layui.table;
|
table.reload(
|
tableId, {
|
where: requestData
|
}
|
);
|
}
|
},
|
yes: function (layero) {
|
var checkData = layui.table.checkStatus("table_" + filter).data;
|
if (checkData.length < 1) {
|
webUtil.showErrorMsg('请选择属性集');
|
return false;
|
} else {
|
var tempAttrData = layui.table.getData('tempAttr_' + that.id, true);
|
var addData = [];
|
var ordernum=tempAttrData.length
|
$.each(checkData, function (ci, citem) {
|
var isCopy=false;
|
$.each(tempAttrData, function (i, item) {
|
if(citem.id == item.id){
|
isCopy=true;
|
return false;
|
}
|
})
|
if(!isCopy) {
|
citem.oid=''
|
addData.push($.extend({}, citem, {
|
ordernum:++ordernum,
|
attributedatatype:citem.attrDataType,
|
attributeDataTypeText:that.vciFieldTypeMap[citem.attrDataType],
|
controllength: citem.attributeLength,
|
valuearea:citem.range,
|
referbtmid:citem.referBtmTypeId,
|
referbtmname:citem.referBtmTypeName,
|
referConfig:'',
|
enumid:citem.enumId,
|
precisionlength:(citem.precisionLength?citem.precisionLength:'')+(citem.scaleLength?'('+citem.scaleLength+')':''),
|
classifyTemplateOid:tempData.oid,
|
formdisplayflag:true,
|
tabledisplayflag:true,
|
sortattrflag:true,
|
queryattrflag:true,
|
seniorqueryattrflag:true,
|
attrTableWidth:120
|
}))
|
}
|
})
|
layui.table.addData('tempAttr_' + that.id, addData);
|
layer.close(addSaveIndex);
|
}
|
},
|
btn2: function (layero) {
|
layer.close(addSaveIndex);
|
}
|
});
|
};
|
this.REMTempAttr = function (data,filter) {
|
var that = this;
|
layui.table.removeData(filter, data[layui.table.config.indexName]);
|
}
|
//模板属性删除
|
this.DEL = function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if (tempAttrData.length == 0) {
|
webUtil.showErrorMsg("请选择需要删除的模板属性");
|
return false;
|
}
|
$.each(tempAttrData, function (i, item) {
|
that.REMTempAttr(item,filter)
|
})
|
|
};
|
//模板属性保存
|
this.SAVE = function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id;
|
that.VIEWORDER(type,button)
|
var tempAttrData=layui.table.getData(filter,true);
|
var ischeck=true;
|
layui.each(tempAttrData,function (index,item){
|
tempAttrData[index].ordernum=index+1;
|
if((item.requireflag && item.requireflag.toString()=='true') && (item.readonlyflag && item.readonlyflag.toString()=='true')){
|
webUtil.showErrorMsg(item.name+"("+item.id+")必输的属性不能是只读");
|
ischeck=false;
|
return;
|
}
|
var num=0;
|
if(webUtil.isNotNull(item.componentrule)){
|
//组合规则
|
num++
|
}
|
if(webUtil.isNotNull(item.enumString) || webUtil.isNotNull(item.enumid)){
|
//枚举
|
num++
|
}
|
if(webUtil.isNotNull(item.referConfig) || webUtil.isNotNull(item.referbtmid)){
|
//参照
|
num++
|
}
|
if(webUtil.isNotNull(item.codedateformat)){
|
//时间格式
|
num++
|
}
|
if(webUtil.isNotNull(item.classifyinvokelevel)){
|
//分类注入
|
num++
|
}
|
/*if(item.barcodeflag=='true' || item.barcodeflag==true){
|
//一维码
|
num++
|
}
|
if(item.qrcodeflag=='true' || item.qrcodeflag==true){
|
//二维码
|
num++
|
}
|
if(item.imageflag=='true' || item.imageflag==true){
|
//缩略图
|
num++
|
}*/
|
if(num>1){
|
webUtil.showErrorMsg(item.name+"("+item.id+") 属性只能是组合规则,枚举,参照,时间格式,分类注入中的一种");
|
ischeck=false;
|
return;
|
}
|
})
|
if(!ischeck){
|
return ;
|
}
|
webUtil.manualAjax('post', that.url.templateAttrController+'batchAddSave', JSON.stringify(tempAttrData), function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, ("保存成功"));
|
that.refresh(type,button);
|
if(filter=='tempAttr_fullScreen_'+that.id) that.getTempAttrData("tempAttr_" + that.id);
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
}
|
//模板属性重置
|
this.CANCEL = function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
that.refresh(type,button);
|
}
|
//模板属性全屏编辑
|
this.BATCHEDIT = function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(false)) {
|
return false;
|
}
|
var filter = "fullScreen_" + that.id;
|
var table = layui.table;
|
that.BATCHEDITIndex = layer.open({
|
type: 1,
|
title: '模板属性',
|
content: '<div id="' + filter + '" lay-filter="' + filter + '" style="margin:5px" >' + that.getToolbarHtml(true) + '<table id="tempAttr_' + filter + '" lay-filter="tempAttr_' + filter + '" style="overflow-x:auto;"></table></div>',
|
fullScreen: true,
|
closeBtn: 0,
|
shadeClose: false,
|
resizing: function (layero) {
|
form.doResize(filter);
|
},
|
success: function (layero) {
|
var options = table.getConfig('tempAttr_' + that.id);
|
options.elem = '#tempAttr_' + filter
|
options.id = 'tempAttr_' + filter;
|
options.width = 'auto';
|
options.maxHeight=layero.height()-110;
|
if(options.data.length*33+45<options.maxHeight){
|
options.height = 'auto';
|
}else{
|
options.height = options.maxHeight;
|
}
|
options.done= function (res, cur, total) {
|
table.on('tool(tempAttr_' + filter + ')', function (obj) {
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if (layEvent == 'UP') {
|
that.UPTempAttr(data,'tempAttr_' + filter);
|
} else if (layEvent == 'DOWN') {
|
that.DOWNTempAttr(data,'tempAttr_' +filter);
|
} else if (layEvent == 'REM') {
|
that.REMTempAttr(data,'tempAttr_' + filter);
|
}
|
});
|
that.bindSwitch('tempAttr_'+filter)
|
}
|
table.render(options);
|
webUtil.bindDefultButtonLisenter(that, 'attr_'+that.id);
|
that.createAttrSelect(true)
|
}
|
});
|
}
|
|
this.UNBATCHEDIT = function () {
|
var that = this;
|
layer.close(that.BATCHEDITIndex)
|
}
|
//模板属性分类注入
|
this.CLASSIFYUSE=function (type,button){
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if (tempAttrData.length != 1) {
|
webUtil.showErrorMsg('请选择一条模板属性数据');
|
return false;
|
}
|
layui.use('mdm/CodeClassifyClassifyuse', function () {
|
var CodeClassifyClassifyuse = layui['mdm/CodeClassifyClassifyuse'];
|
CodeClassifyClassifyuse.showReferDialog({
|
formValues:tempAttrData[0],
|
target: {
|
setValue: function (thisfilter, name, value, rawValue, isClose, allSelectValues) {
|
layui.table.changeRecord(filter, tempAttrData[0][layui.table.config.indexName], rawValue)
|
}
|
}
|
})
|
})
|
}
|
//模板属性组合规则
|
this.COMPUSE = function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter, true).data;
|
if (tempAttrData.length != 1) {
|
webUtil.showErrorMsg("请选择一条模板属性数据");
|
return false;
|
}
|
var allData=layui.table.getData(filter,true);
|
layui.use('formulaEditor', function () {
|
var editor = layui['formulaEditor'];
|
editor.showReferDialog({
|
formValues:tempAttrData[0],
|
value: tempAttrData[0].componentrule,
|
currentVars:allData,
|
target: {
|
setValue: function (thisfilter, name, value, rawValue, isClose, allSelectValues) {
|
tempAttrData[0].componentrule = value;
|
layui.table.changeRecord(filter, tempAttrData[0][layui.table.config.indexName], tempAttrData[0])
|
}
|
}
|
})
|
})
|
}
|
//模板属性效验规则
|
this.VERIFYUSER = function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if (tempAttrData.length == 0) {
|
webUtil.showErrorMsg("请选择模板属性数据");
|
return false;
|
}
|
layui.use('mdm/CodeClassifyVerifyUser', function () {
|
var CodeClassifyVerifyUser = layui['mdm/CodeClassifyVerifyUser'];
|
CodeClassifyVerifyUser.showReferDialog({
|
target: {
|
setValue: function (thisfilter, name, value, rawValue, isClose, allSelectValues) {
|
layui.each(tempAttrData,function (index,item){
|
tempAttrData[index].verifyrule=value;
|
layui.table.changeRecord(filter,item[layui.table.config.indexName],item)
|
})
|
}
|
}
|
})
|
})
|
}
|
|
//模板属性枚举注入
|
this.ENUMUSE=function (type,button){
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if (tempAttrData.length != 1) {
|
webUtil.showErrorMsg('请选择一条模板属性数据');
|
return false;
|
}
|
layui.use('mdm/CodeClassifyEnumUse', function () {
|
var CodeClassifyEnumUse = layui['mdm/CodeClassifyEnumUse'];
|
|
CodeClassifyEnumUse.showReferDialog({
|
value: tempAttrData[0].enumString,
|
formValues:tempAttrData[0],
|
target: {
|
setValue: function (thisfilter, name, value, rawValue, isClose, allSelectValues) {
|
tempAttrData[0].enumString = value;
|
layui.table.changeRecord(filter, tempAttrData[0][layui.table.config.indexName], tempAttrData[0])
|
}
|
}
|
})
|
})
|
}
|
//模板属性分组
|
this.GROUPATTR=function (type,button){
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var tablefilter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(tablefilter,true).data;
|
if (tempAttrData.length == 0) {
|
webUtil.showErrorMsg("请选择模板属性数据");
|
return false;
|
}
|
var filter = "groupattr_" + that.id;
|
var form = layui.form;
|
var content = ['<form id="form_' , filter ,'" lay-filter="' , filter , '" class="layui-form" style="margin-top:15px" ></form>'];
|
var addSaveIndex = $webUtil.dialog({
|
title: '输入分组的名称',
|
btn: ['保存', '取消'],
|
content: content.join(''),
|
area: ['330px', '180px'],
|
targetObject:that,
|
resizing: function (layero) {
|
form.doResize(filter);
|
},
|
success: function (layero) {
|
form.addItems(filter,[{
|
field: 'attributegroup',
|
text: '属性分组'
|
}],
|
function () {}
|
, {}
|
, {});
|
},
|
yes:function(layero){
|
if(form.validata(filter)){
|
var formValues = form.getValues(filter,true);
|
layui.each(tempAttrData,function (index,item){
|
tempAttrData[index].attributegroup=formValues.attributegroup;
|
layui.table.changeRecord(tablefilter,item[layui.table.config.indexName],item)
|
})
|
layer.close(addSaveIndex)
|
}
|
}
|
});
|
}
|
//上级属性
|
this.PARENTATTR=function (type,button){
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if (tempAttrData.length != 1) {
|
webUtil.showErrorMsg('请选择一条模板属性数据');
|
return false;
|
}
|
layui.use('mdm/CodeClassifyAttribute', function () {
|
var CodeClassifyAttribute = layui['mdm/CodeClassifyAttribute'];
|
CodeClassifyAttribute.showReferDialog({
|
formValues:tempAttrData[0],
|
target: {
|
setValue: function (thisfilter, name, value, rawValue, isClose, allSelectValues) {
|
layui.table.changeRecord(filter, tempAttrData[0][layui.table.config.indexName], rawValue)
|
}
|
}
|
})
|
})
|
}
|
this.UPTempAttr=function (data,filter){
|
var that=this;
|
data.LAY_TABLE_INDEX!=0 && layui.table.moveData( filter,data.LAY_TABLE_INDEX,data.LAY_TABLE_INDEX-1)
|
}
|
this.DOWNTempAttr=function (data,filter){
|
var that=this;
|
data.LAY_TABLE_INDEX!=layui.table.getData(filter).length-1 && layui.table.moveData( filter,data.LAY_TABLE_INDEX,data.LAY_TABLE_INDEX+1)
|
}
|
this.VIEWORDER=function (type,button){
|
var that=this;
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
layui.table.sort(filter,'ordernum', 'asc',true);
|
}
|
this.UPSELECT=function (type,button) {
|
var that = this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if (tempAttrData.length != 1) {
|
webUtil.showErrorMsg('请选择一条模板属性数据');
|
return false;
|
}
|
that.UPTempAttr(tempAttrData[0],filter);
|
}
|
this.DOWNSELECT=function (type,button){
|
var that=this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if(tempAttrData.length !=1){
|
webUtil.showErrorMsg('请选择一条模板属性数据');
|
return false;
|
}
|
that.DOWNTempAttr(tempAttrData[0],filter);
|
}
|
//模板属性同步到其他模板
|
this.syncAttr=function (type,button){
|
var that=this;
|
if (!that.checkTEMPStatus(true)) {
|
return false;
|
}
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
var tempAttrData = layui.table.checkStatus(filter,true).data;
|
if(tempAttrData.length !=1){
|
webUtil.showErrorMsg('请选择一条模板属性数据');
|
return false;
|
}
|
webUtil.manualAjax('post',that.url.templateAttrController + 'copyto', JSON.stringify({oid: tempAttrData[0].oid}), function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, "同步成功");
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
}
|
//编码申请预览
|
this.VIEWCODE=function (type,button) {
|
var that = this;
|
var tempData=that.checkTEMPStatus(false);
|
if(!tempData){
|
return false;
|
}
|
var filter = $(button).attr('isfull') == 'true' ? 'tempAttr_fullScreen_' + that.id : "tempAttr_" + that.id
|
var MdmEngineForm = layui['mdm/MdmEngineForm'];
|
MdmEngineForm.getFormDefine(tempData.oid, that.currentItemOid, function (componentVO) {
|
var formDefineVO = componentVO.formDefineVO;
|
if (formDefineVO) {
|
filter += "_view_form";
|
var form = layui.form;
|
var colCount = MdmEngineForm.getFormCol(formDefineVO);
|
var items = MdmEngineForm.getFormItemsByVO(formDefineVO, false,colCount);
|
var hasResemble = (componentVO.resembleTableVO && componentVO.resembleTableVO.cols && componentVO.resembleTableVO.cols.length > 0);
|
|
var html = [
|
'<div class="easyui-layout UIContentLayout" id="easyuiLayout_', filter, '" data-options="fit:true" style="display:block;overflow-y: hidden;">',
|
'<div data-options="region:\'center\'" style="padding: 5px;">',
|
'<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form " style="margin-top:5px" ></form>',
|
'</div>',
|
'<div data-options="region:\'south\',split:true" style="height:270px;padding-left: 5px;padding-right: 5px;" id="border_', filter, '">',
|
'<div class="layui-layout-border layui-tab" style="display:block;margin:5px;">',
|
'<ul class="layui-tab-title tabTitle tab_center_', filter, '">',
|
'<li class="layui-this">相似项查询</li>',
|
'</ul>',
|
'<ul class="layui-tab-content tabContent">',
|
'<li class="layui-tab-item layui-show" lay-id="resemble">',
|
'<table id="resemble_', filter, '" lay-filter="resemble_', filter, '" style="overflow-x:auto;"></table>',
|
'</li>',
|
'</ul>',
|
'</div>',
|
'</div>',
|
'</div>'
|
]
|
if(!hasResemble){
|
html = ['<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form " style="margin-top:15px" ></form>']
|
}
|
var dialogIndex = webUtil.dialog({
|
title: "编码申请预览",
|
btn: !hasResemble?['效验', '取消']:['效验', '取消', '相似项查询'],
|
fullScreen: true,
|
content: html.join(''),
|
resizing: function (layero) {
|
form.doResize(filter);
|
},
|
success: function (layero) {
|
if(!!hasResemble){
|
var easyuiLayout = $('#easyuiLayout_' + filter)
|
easyuiLayout.css({height: easyuiLayout.parents('.layui-layer-content').height()-10, width: easyuiLayout.parents('.layui-layer-content').width()-10})
|
easyuiLayout.parent().parent().css({padding: '5px'})
|
easyuiLayout.layout();
|
MdmEngineForm.initResembleTable(componentVO, filter);
|
}
|
form.addItems(filter, items,
|
function () {
|
}, {}, {defaultColumnOneRow: colCount, labelWidth: 160});
|
},
|
yes: function (layero) {
|
if (form.validata(filter)) {
|
var values = form.getDefaultValues(filter, true);
|
var datas = {
|
codeClassifyOid: that.currentItemOid,
|
templateOid: tempData.oid,
|
codeRuleOid: that.codeRuleOid,
|
data: values.otherValue
|
}
|
$.extend(datas, values.defaultValues);
|
webUtil.manualAjax('post', 'mdmEngineController/previewCompRule', JSON.stringify(datas), function (res) {
|
if (res.success) {
|
form.setValues(res.obj, filter);
|
webUtil.showMsgFromResult(res, '效验通过');
|
} else {
|
webUtil.showErrorMsg(res.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
}
|
},
|
btn2: function (layero) {
|
layer.close(dialogIndex);
|
},
|
btn3: function (layero) {
|
if (form.validata(filter)) {
|
webUtil.get('mdmEngineController/getCodeRuleByClassifyOid', {codeClassifyOid: that.currentItemOid}, function (result) {
|
if (!result.success) {
|
$webUtil.showErrorMsg(result.msg);
|
} else {
|
var values = form.getDefaultValues(filter, true);
|
that.codeRuleOid=result.obj.oid;
|
var datas = {
|
codeClassifyOid: that.currentItemOid,
|
templateOid: tempData.oid,
|
codeRuleOid: result.obj.oid,
|
data: values.otherValue
|
}
|
$.extend(datas, values.defaultValues);
|
webUtil.manualAjax('post', 'mdmEngineController/resembleQuery', JSON.stringify(datas), function (res) {
|
if (res.success) {
|
layui.table.reload("resemble_" + filter, {
|
data: res.data
|
});
|
} else {
|
webUtil.showErrorMsg(res.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
}
|
});
|
}
|
return false;
|
}
|
});
|
}
|
});
|
}
|
this.refresh = function (type,button) {
|
var that = this;
|
var filter=$(button).attr('isfull')=='true'?'tempAttr_fullScreen_'+that.id:"tempAttr_" + that.id
|
that.getTempAttrData(filter);
|
|
};
|
|
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('<div id="toolbar' + that.id + '" class="layui-inline"></div>');
|
that.checkTempAttrColumns();
|
that.serinorQueryInstance = dynamicCondition.create({
|
fields: that.tempAttrdataFields//查询字段
|
, tableId: "tempAttr_" + that.id//需要查询的表格
|
, type: "complex" //type:"simple"/"complex" 查询的方法 暂时写死为 complex
|
, queryCallBack: function (requestData) {//查询之后的callback
|
|
}
|
});
|
}
|
that.serinorQueryInstance.open();
|
};
|
this.ADVQUERYTEMP = function () {
|
var that = this;
|
if (!that.serinorQueryInstance) {
|
var dynamicCondition = layui.dynamicCondition;
|
$('[layui-filter="toolbar_' + that.id + '"]').append('<div id="toolbar' + that.id + '" class="layui-inline"></div>');
|
that.checkTempColumns();
|
that.serinorQueryInstance = dynamicCondition.create({
|
fields: that.tempdataFields//查询字段
|
, tableId: "temp_" + that.id//需要查询的表格
|
, type: "complex" //type:"simple"/"complex" 查询的方法 暂时写死为 complex
|
, queryCallBack: function (requestData) {//查询之后的callback
|
|
}
|
});
|
}
|
that.serinorQueryInstance.open();
|
};
|
this.ADDTEMP = function () {
|
var that = this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从树上选择一条数据");
|
return false;
|
}
|
that.addOrEditTEMP(true,false);
|
};
|
this.EDITTEMP = function () {
|
var that = this;
|
var tempData=that.checkTEMPStatus(true,'只能修改编辑中的数据');
|
if(!tempData){
|
return false;
|
}
|
that.addOrEditTEMP(false,false, tempData);
|
};
|
this.addOrEditTEMP = function (add,clone, data) {
|
var that = this;
|
|
var form = layui.form;
|
var filter = "form_" + that.id;
|
var addSaveIndex = webUtil.dialog({
|
title: add ? (clone?"克隆模板":"添加模板") : '修改模板',
|
btn: ['保存', '取消'],
|
content: '<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form" style="margin-top:5px" ></form>',
|
resizing: function (layero) {
|
form.doResize(filter);
|
},
|
success: function (layero, layerIndex, classP) {
|
form.addItems(filter, that.getFormTempItems(false),
|
function () {
|
if (!add) {
|
form.setValues(data, filter);
|
} else {
|
var defaultValues = {};
|
if (that.currentItemAttributes) {
|
defaultValues["codeClassifyOid"] = that.currentItemOid;
|
defaultValues["codeClassifyOidname"] = that.currentItemAttributes.name;
|
}
|
if(clone){
|
defaultValues=$.extend(data,defaultValues)
|
//defaultValues.oid='';
|
defaultValues["codeclassifyoid"] = that.currentItemOid;
|
defaultValues["codeclassifyoidName"] = 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 ? (clone?'copy':that.url.addSave) : that.url.editSave);
|
webUtil.manualAjax(add ? 'post' : 'put', url, JSON.stringify(values), function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, (add ? (clone?"克隆成功":"添加成功") : "修改成功"));
|
layer.close(addSaveIndex);
|
that.refreshTEMP();
|
} 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'
|
}];
|
};
|
|
this.DELTEMP = function () {
|
var that = this;
|
var tempData=that.checkTEMPStatus(true,'只能删除编辑中的数据');
|
if(!tempData){
|
return false;
|
}
|
webUtil.showConfirmMsg("是否删除这条数据?如果被引用将不能被删除!", function () {
|
webUtil.deleteRequest(that.url.tempController + that.url.deleteUrl, {
|
oid: tempData.oid,
|
ts: tempData.ts
|
}, function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, "删除成功");
|
that.refreshTEMP();
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
});
|
};
|
//模板升版
|
this.UPTEMP = function () {
|
var that = this;
|
var checkData = layui.table.checkStatus("temp_" + that.id).data;
|
if (checkData.length != 1) {
|
webUtil.showErrorMsg('请选择一条数据');
|
return false;
|
}
|
that.doUPTEMP(checkData[0].oid, checkData[0].ts)
|
}
|
this.doUPTEMP = function (oid, ts) {
|
var that = this;
|
webUtil.showConfirmMsg("是否进行升版?", function () {
|
webUtil.manualAjax('post',that.url.tempController + 'upgrade',JSON.stringify({oid: oid, ts: ts}) , function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, "升版成功");
|
that.refreshTEMP();
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
});
|
}
|
//模板停用
|
this.DISABLETEMP = function () {
|
var that = this;
|
var checkData = layui.table.checkStatus("temp_" + that.id).data;
|
if (checkData.length != 1) {
|
webUtil.showErrorMsg('请选择一条数据');
|
return false;
|
}
|
webUtil.showConfirmMsg("模板只有发布状态才能被使用,是否确定停用?", function () {
|
that.disableOrEnableTEMP(false, checkData[0].oid, checkData[0].ts);
|
});
|
|
};
|
//模板启用
|
this.ENABLETEMP = function () {
|
var that = this;
|
var checkData = layui.table.checkStatus("temp_" + that.id).data;
|
if (checkData.length != 1) {
|
webUtil.showErrorMsg('请选择一条数据');
|
return false;
|
}
|
webUtil.showConfirmMsg("是否确定启用/发布这个模板,模板只有发布状态才能被使用,是否继续?", function () {
|
that.disableOrEnableTEMP(true, checkData[0].oid, checkData[0].ts);
|
});
|
|
};
|
//停用启用模板
|
this.disableOrEnableTEMP = function (enable, oid, ts) {
|
var that = this;
|
webUtil.post( that.url.tempController + (enable ? that.url.enableData : that.url.disableData), {
|
oid: oid,
|
ts: ts
|
}, function (result) {
|
if (result.success) {
|
webUtil.showMsgFromResult(result, (enable ? '启用成功' : '停用成功'));
|
that.refreshTEMP();
|
} else {
|
webUtil.showErrorMsg(result.msg);
|
}
|
}, function (xhr, err) {
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
}, that.backPath);
|
};
|
//从其他模板克隆
|
this.cloneTEMP = function () {
|
var that=this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从[主题库分类】树上选择一条数据");
|
return false;
|
}
|
var referConfig = {
|
filter: "clone_" + that.id,
|
name: 'temp',
|
title: '克隆模板',
|
options: {
|
isMuti: false
|
},
|
isMuti: false,
|
target: {
|
setValue: function (filter, name, value, rawValue, isClose, allSelectValues) {
|
that.addOrEditTEMP(true, true, allSelectValues[0])
|
}
|
},
|
value: '',
|
text: ''
|
};
|
layui['mdm/refer/CodeClassTemplateRefer'].showReferDialog(referConfig);
|
};
|
this.ADDPROCESS = function (){
|
var that=this;
|
if (webUtil.isNull(that.currentItemOid)) {
|
webUtil.showErrorMsg("请先从[主题库分类】树上选择一条数据");
|
return false;
|
}
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
that.addOrEditProcess(true,tempData.oid,null);
|
};
|
this.addOrEditProcess = function (add,tempOid,oid){
|
var that = this;
|
var form = layui.form;
|
var filter ="form_process" + that.id;
|
var addSaveIndex =webUtil.dialog({
|
title:add?'添加使用的流程模板':'修改使用的流程模板',
|
btn:['保存','取消'],
|
area:['800px','400px'],
|
content:'<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form" style="margin-top:5px" ></form>',
|
resizing:function(layero){
|
form.doResize(filter);
|
},
|
success:function(layero) {
|
form.addItems(filter,that.getProcessFormItems(tempOid,false),
|
function () {
|
if(!add){
|
form.load(filter,{
|
backPath:that.backPath,
|
url:that.url.processLinkController + that.url.processLinkGetObjectByOid,
|
method:'get',
|
params:{
|
oid:oid
|
}
|
});
|
}else{
|
var defaultValues = {
|
codeClassifyOid:that.currentItemOid,
|
classifyTemplateOid:webUtil.getOidFromGrid("temp_" + that.id,false,false)
|
};
|
//可以手动在此处添加默认值
|
form.setValues(defaultValues,filter);
|
}
|
form.on('select('+filter+')',function (data){
|
if(data.name=='id'){
|
form.setValues({
|
processVersion: data.rowData[0].version
|
},filter,true);
|
}
|
})
|
}, {}, {defaultColumnOneRow: 2,labelWidth:150});
|
},
|
yes:function(layero){
|
if(form.validata(filter)){
|
var values = form.getValues(filter,true);
|
var url = that.url.processLinkController + (add?that.url.processLinkAddSave:that.url.processLinkEditSave);
|
webUtil.manualAjax(add?'post':'put',url,JSON.stringify(values),function(result){
|
if(result.success){
|
webUtil.showMsgFromResult(result,(add ? "关联流程模板成功" : "修改关联的流程模板成功"));
|
layer.close(addSaveIndex);
|
that.refreshPROCESS();
|
}else{
|
webUtil.showErrorMsg(result.msg);
|
}
|
},function(xhr,err){
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
},that.backPath);
|
}
|
},
|
btn2:function(layero){
|
layer.close(addSaveIndex);
|
}
|
});
|
};
|
this.getProcessFormItems = function (tempOid,onlyShow){
|
return [
|
{
|
field: 'id',
|
title: '流程模板',
|
required: true,
|
type: 'refer',
|
showField: 'name',
|
referConfig: {
|
type:'refer/WfProcessTemplateRefer'
|
},
|
defaultValue:"",
|
readOnly:onlyShow
|
} ,{
|
field: 'processVersion',
|
title: '模板的版本',
|
required: true,
|
readOnly: true
|
}, {
|
field: 'codeprocessuse',
|
title: '流程模板用途',
|
required: true,
|
type: 'combox',
|
comboxKey: 'codeClassifyProcessUse',
|
defaultValue: "code_cls_flow_use_order",
|
readOnly: onlyShow
|
}, {
|
field: 'codeTempAttrOidArr',
|
title: '流程树显示属性',
|
required: true,
|
showField: 'codeTempAttrOidArrName',
|
type: 'refer',
|
referConfig: {
|
type:'mdm/refer/CodeClassTemplateAttrRefer',
|
displayType:null,
|
isMuti: true,
|
valueField:'id',
|
where:{'conditionMap["classifytemplateoid"]':tempOid}
|
},
|
defaultValue: ""
|
}];
|
};
|
this.EDITPROCESS = function (){
|
var that = this;
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
var oid = webUtil.getOidFromGrid("process_" + that.id,true,true);
|
if(!oid){
|
return false;
|
}
|
var classifyTemplateOid = webUtil.getOidFromGrid("process_" + that.id,true,true,'classifyTemplateOid');
|
this.addOrEditProcess(false,classifyTemplateOid,oid);
|
};
|
this.DELPROCESS = function (){
|
var that = this;
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
var oid = webUtil.getOidFromGrid("process_" +that.id,true,true);
|
if(!oid){
|
return false;
|
}
|
var ts= webUtil.getOidFromGrid("process_" +that.id,false,false,"ts");
|
webUtil.showConfirmMsg("是否删除这条数据?如果被引用将不能被删除!",function () {
|
webUtil.deleteRequest(that.url.processLinkController + that.url.processLinkDeleteUrl,{oid:oid,ts:ts},function(result){
|
if(result.success){
|
webUtil.showMsgFromResult(result,"删除成功");
|
that.refreshPROCESS();
|
}else{
|
webUtil.showErrorMsg(result.msg);
|
}
|
},function(xhr,err){
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
},that.backPath);
|
});
|
};
|
this.refreshPROCESS = function (){
|
var that = this;
|
layui.table.reload("process_" + that.id);
|
};
|
this.ADDPHASE = function (){
|
this.addOrEditPhase(true,null);
|
};
|
this.EDITPHASE = function (){
|
var that = this;
|
var oid = webUtil.getOidFromGrid('phase_' + that.id,true,true);
|
that.addOrEditPhase(false,oid,false);
|
};
|
this.DELPHASE = function (){
|
var that = this;
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
var oid = webUtil.getOidFromGrid('phase_' + that.id,true,true);
|
var ts= webUtil.getOidFromGrid("phase_" +that.id,false,false,"ts");
|
webUtil.showConfirmMsg("是否删除这条数据?",function () {
|
webUtil.deleteRequest(that.url.phaseController + that.url.phaseDeleteUrl,{oid:oid,ts:ts},function(result){
|
if(result.success){
|
webUtil.showMsgFromResult(result,"删除成功");
|
that.refreshPHASE();
|
}else{
|
webUtil.showErrorMsg(result.msg);
|
}
|
},function(xhr,err){
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
},that.backPath);
|
});
|
};
|
this.refreshPHASE = function (){
|
var that = this;
|
layui.table.reload("phase_" + that.id);
|
};
|
this.addOrEditPhase = function (add,oid,onlyView){
|
var that = this;
|
var form = layui.form;
|
var filter ="form_phase" + that.id;
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
var tempOid=tempData.oid;
|
var addSaveIndex =webUtil.dialog({
|
title:(add?'添加模板阶段':(onlyView?'查看模板阶段':'修改模板阶段')),
|
btn:(onlyView?[]:['保存','取消']),
|
area:['1000px','700px'],
|
content:'<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form" style="margin-top:5px" ></form><hr class="layui-border-blue">' +
|
'<div id="phase_used_'+filter+'" style="margin: 0 5px;"></div>',
|
resizing:function(layero){
|
form.doResize(filter);
|
},
|
success:function(layero) {
|
form.addItems(filter,that.getPhaseFormItems(false),
|
function () {
|
if(!add){
|
form.load(filter,{
|
backPath:that.backPath,
|
url:that.url.phaseController + that.url.phaseGetObjectByOid,
|
method:'get',
|
params:{
|
oid:oid
|
}
|
});
|
}else{
|
var defaultValues = {};
|
//可以手动在此处添加默认值
|
form.setValues(defaultValues,filter);
|
}
|
//表单成功后再加载下面的内容
|
layui.transferTable.render({
|
elem:'#phase_used_'+filter,
|
id:'phase_used_'+filter
|
,leftTable:{
|
backPath:that.backPath
|
,url: that.url.phaseController + that.url.phaseUnUsedAttribute
|
,cols: [[layui.table.getIndexColumn(),layui.table.getCheckColumn(),
|
{
|
field:'id',
|
title:'属性编号',
|
width:120,
|
sort:true
|
},{
|
field: 'name',
|
title: '属性名称',
|
width: 150,
|
sort: true
|
},{
|
field:'attributegroup',
|
title: '属性分组',
|
width: 90,
|
sort: true
|
}
|
|
]]
|
,limit:-1
|
,id:'transferTable_1_1'
|
,width:450
|
,height:500
|
,extraParams:{'conditionMap["classifyTemplateOid"]':tempOid,codePhaseOid:oid}
|
}
|
,rightTable:{
|
backPath:that.backPath
|
,url: that.url.phaseController + that.url.phaseUsedAttribute
|
,cols: [[layui.table.getIndexColumn(),layui.table.getCheckColumn(),
|
{
|
field:'id',
|
title:'属性编号',
|
width:120
|
},{
|
field: 'name',
|
title: '属性名称',
|
width: 150
|
},{
|
field:'attributegroup',
|
title: '属性分组',
|
width: 90,
|
sort: true
|
}
|
]]
|
,id:'transferTable_2_2',
|
limit:-1
|
,width:450
|
,height:500
|
,extraParams: {"conditionMap['codePhaseOid']":oid}
|
}
|
})
|
}, {}, {defaultColumnOneRow: 3});
|
},
|
yes:function(layero){
|
if(form.validata(filter)){
|
var values = form.getValues(filter,true);
|
var linkAttrs = layui.transferTable.getData('phase_used_'+filter);
|
if(!linkAttrs || linkAttrs.length == 0){
|
webUtil.showErrorMsg("请选择阶段中所需的属性");
|
return false;
|
}
|
values.attributes = linkAttrs;
|
values.codeClassifyTemplateOid = tempOid;
|
var url = that.url.phaseController + (add?that.url.phaseAddSave:that.url.phaseEditSave);
|
webUtil.manualAjax(add?'post':'put',url,JSON.stringify(values),function(result){
|
if(result.success){
|
webUtil.showMsgFromResult(result,(add ? "添加成功" : "修改成功"));
|
layer.close(addSaveIndex);
|
that.refreshPHASE();
|
}else{
|
webUtil.showErrorMsg(result.msg);
|
}
|
},function(xhr,err){
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
},that.backPath);
|
}
|
},
|
btn2:function(layero){
|
layer.close(addSaveIndex);
|
}
|
});
|
};
|
this.getPhaseFormItems = function (onlyShow){
|
return [
|
{
|
field: 'id',
|
title: '阶段编号',
|
defaultValue:"",
|
readOnly:onlyShow
|
} , {
|
|
field: 'name',
|
title: '阶段名称',
|
defaultValue:"",
|
required:true,
|
readOnly:onlyShow
|
}, {
|
field: 'description',
|
title: '描述',
|
defaultValue:"",
|
readOnly:onlyShow
|
}];
|
};
|
this.refreshBUTTON = function () {
|
var that = this;
|
layui.table.reload("button_" + that.id);
|
};
|
this.ADDBUTTON = function (){
|
this.addOrEditButton(true,null);
|
};
|
this.EDITBUTTON = function (){
|
var that = this;
|
var oid = webUtil.getOidFromGrid('button_' + that.id,true,true);
|
that.addOrEditButton(false,oid);
|
};
|
this.DELBUTTON = function (){
|
var that = this;
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
var oid = webUtil.getOidFromGrid('button_' + that.id,true,true);
|
var ts= webUtil.getOidFromGrid("button_" +that.id,false,false,"ts");
|
webUtil.showConfirmMsg("是否删除这条数据?",function () {
|
webUtil.deleteRequest(that.url.buttonController + that.url.buttonDeleteUrl,{oid:oid,ts:ts},function(result){
|
if(result.success){
|
webUtil.showMsgFromResult(result,"删除成功");
|
that.refreshBUTTON();
|
}else{
|
webUtil.showErrorMsg(result.msg);
|
}
|
},function(xhr,err){
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
},that.backPath);
|
});
|
};
|
this.addOrEditButton = function (add,oid){
|
var that = this;
|
var form = layui.form;
|
var filter ="form_button" + that.id;
|
var tempData=that.checkTEMPStatus(true);
|
if(!tempData){
|
return false;
|
}
|
var tempOid=tempData.oid;
|
var addSaveIndex =webUtil.dialog({
|
title:(add?'添加扩展按钮':'修改扩展按钮'),
|
btn:['保存','取消'],
|
area:['800px','400px'],
|
content:'<form id="form_' + filter + '" lay-filter="' + filter + '" class="layui-form" style="margin-top:5px" ></form>',
|
resizing:function(layero){
|
form.doResize(filter);
|
},
|
success:function(layero) {
|
form.addItems(filter,that.getButtonFormItems(false),
|
function () {
|
if(!add){
|
form.load(filter,{
|
backPath:that.backPath,
|
url:that.url.buttonController + that.url.buttonGetObjectByOid,
|
method:'get',
|
params:{
|
oid:oid
|
}
|
});
|
}else{
|
var defaultValues = {};
|
//可以手动在此处添加默认值
|
form.setValues(defaultValues,filter);
|
}
|
form.on('select('+filter+')',function (data){
|
if(data.name=='classifybuttonoid'){
|
form.setValues({
|
id: data.rowData[0].id,
|
name:data.rowData[0].name
|
},filter,true);
|
}
|
});
|
}, {}, {defaultColumnOneRow: 2});
|
},
|
yes:function(layero){
|
if(form.validata(filter)){
|
var values = form.getValues(filter,true);
|
values.classifyTemplateOid = tempOid;
|
var url = that.url.buttonController + (add?that.url.buttonAddSave:that.url.buttonEditSave);
|
webUtil.manualAjax(add?'post':'put',url,JSON.stringify(values),function(result){
|
if(result.success){
|
webUtil.showMsgFromResult(result,(add ? "添加成功" : "修改成功"));
|
layer.close(addSaveIndex);
|
that.refreshBUTTON();
|
}else{
|
webUtil.showErrorMsg(result.msg);
|
}
|
},function(xhr,err){
|
webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
|
},that.backPath);
|
}
|
},
|
btn2:function(layero){
|
layer.close(addSaveIndex);
|
}
|
});
|
};
|
this.getButtonFormItems = function (onlyShow){
|
return [ {
|
field: 'classifybuttonoid',
|
title: '所属按钮',
|
required: true,
|
type: 'refer',
|
showField: 'classifybuttonoidName',
|
referConfig: {
|
type:'default',
|
referBo:'codebutton'
|
},
|
defaultValue:"",
|
readOnly:onlyShow
|
}, {
|
field: 'id',
|
title: '按钮标识',
|
hidden: true
|
},{
|
field: 'name',
|
title: '按钮名称',
|
hidden: true
|
} ,{
|
field: 'buttonuse',
|
title: '按钮用途',
|
type: 'combox',
|
defaultValue:"",
|
comboxKey:'codeTemplateButtonUse',
|
readOnly:onlyShow
|
} ];
|
};
|
this.EXPORTClassify = function (){
|
var that = this;
|
//导出分类
|
if(!that.currentItemOid){
|
$webUtil.showErrorMsg("请先选择要导出的主题库分类");
|
return false;
|
}
|
$webUtil.fileDownload(that.backPath + that.url.controller + "exportClassify?oid=" + that.currentItemOid);
|
};
|
this.IMPORTClassify=function (){
|
var that = this;
|
var filter = "classify_" + that.id;
|
var form = layui.form;
|
var content = ['<form id="', filter, '" lay-filter="', filter, '" class="layui-form" style="margin:15px 30px 15px 0;" >' +
|
'</form>',
|
'<button type="button" className="layui-btn" id="upload_button_' , filter ,
|
'" style="margin:5px 50px;display: block;float:left;"><i className="layui-icon layui-icon-upload"></i>浏览文件</button>'
|
].join('');
|
var addSaveIndex = $webUtil.dialog({
|
title: '主题库分类导入',
|
btn: ['下载导入模板', '关闭'],
|
content: content,
|
area: ['800px', '600px'],
|
success: function (layero) {
|
//主题库分类不导规则
|
var items = [{
|
type: 'line',
|
field: 'tips',
|
text: '导入提示'
|
}, {
|
field: 'keyAttrTips',
|
text: '1.红色字体表示必输项',
|
type: 'label',
|
labelWidth: 600,
|
labelStyle: 'margin-left:50px',
|
useAllWidth: true
|
}, {
|
field: 'classifyTips',
|
text: '2.分类的路径需要用#分隔',
|
type: 'label',
|
labelWidth: 600,
|
labelStyle: 'margin-left:50px',
|
useAllWidth: true
|
},{
|
field: 'requiredTips',
|
text:'3.每次仅能最多导入10000条数据',
|
type: 'label',
|
labelWidth:600,
|
labelStyle:'margin-left:50px',
|
useAllWidth:true
|
}, {
|
type: 'line',
|
field: 'excelFile',
|
text: 'excel文件,选择文件后会自动上传'
|
}];
|
form.addItems(filter, items, function () {
|
}, {}, {defaultColumnOneRow: 1, labelWidth: 160});
|
var upload = layui.upload;
|
//执行实例
|
var uploadInst = upload.render({
|
elem: '#upload_button_' + filter //绑定元素
|
, accept: 'file'
|
, acceptMime: 'file/*'
|
, exts: 'xls|xlsx'
|
, url: that.backPath + that.url.controller + 'importClassify'//上传接口
|
, auto: true
|
, before: function (obj) {
|
}
|
, done: function (result) {//不需要输入内容,因此没有before
|
if (result.success) {
|
layer.close(addSaveIndex);
|
$webUtil.showMsgFromResult(result, "导入成功!");
|
that.refreshClassify();
|
}else{
|
//需要去下载错误信息
|
$webUtil.fileDownload(that.backPath + that.url.controller + "downloadErrorFile?uuid=" + result.obj,null,'导入错误,请查看下载的【错误信息】文件');
|
}
|
}
|
, error: function () {
|
//请求异常回调
|
$webUtil.showErrorMsg("上传异常,服务端出错了");
|
}
|
});
|
},
|
yes: function (layero) {
|
$webUtil.fileDownload(that.backPath + that.url.controller + "downloadImportExcel");
|
},
|
btn2: function (layero) {
|
layer.close(addSaveIndex);
|
}
|
});
|
}
|
}
|
|
var cs = new Class();
|
exports(cs.MODELNAME, cs);
|
});
|