/* ********** */
Root = window.top.Root;
RootRole = window.top.RootRole;
dataRoot = window.top.dataRoot;
dataRootFields = window.top.dataRootFields;
buttonsconfig = window.top.buttonsconfig;
Server = window.top.Server;
Sortable = window.top.Sortable;
system_config = window.top.config.system_config;
//显示大小基准
//分辨率基准
var screen_draft = [1920, 1080];
//var screen_draft = [1366, 768];
//可视范围基准
var wh_draft = [1366, 728];
var h_language = localStorage.getItem("userlanguage") || "zh";
dateFormat = window.top.dateFormat;
/* 流程架构 */
Vue.component("h-flow", {
template: [
'
',
'
',
'',
'
',
'
',
'',
'',
'',
'
',
'
',
'',
'',
'',
'
',
'
'].join(""),
props: {
flowData: Array, // 全部节点
highlightData: Array, // 高亮节点
isReadonly: {//是否只读
type: Boolean,
default: false
},
nodeDictionary: { // 节点字典
type: Array,
default: function(){
return [
{code: "ApprovalNode", name: "审批人"},
{code: "ConditionsNode", name: "条件分支"},
]
}
},
isDraggable: {//是否可拖拽节点
type: Boolean,
default: false
},
draggableType: {// 允许拖拽节泛范围, sameLevel同级拖拽,
type: String,
default: ""
},
isCheckbox: {//是否显示复选框
type: Boolean,
default: false
},
checkstrictly: {//在显示复选框的情况下,是否严格的遵循父子不互相关联的做法
type: Boolean,
default: false
},
checkOnClickNode: { // 是否可以点击节点进行选中
type: Boolean,
default: false
},
isfilter: {//是否可查询
type: Boolean,
default: false
},
isfilterchildren: { // 关键字查询结果是否带出子节点
type: Boolean,
default: true
},
defaultExpandAll: {//是否全部展开
type: Boolean,
default: true
},
expandOnClickNode: { // 是否在点击节点的时候展开或者收缩节点
type: Boolean,
default: false
},
accordion: {//是否手风琴
type: Boolean,
default: false
},
nodekey: { //
type: String,
default: "id"
},
markdelfield: { // 标记删除的字段,和标记字段没有关系
type: String,
default: "is_delete"
},
markfields: { // 标记字段
type: Array,
default: function(){
return [
{
field: "is_delete",
name: "已删除",
tagtype: "danger", // 标记
isclick: false,
}
]
}
},
treeTxtFormatter: {//
type: String,
default: "#{name}-{name}%"
},
defaultExpandedKeys: {//默认展开节点数组
type: Array,
default: function(){
return [];
}
},
defaultCheckedKeys: {//默认勾选节点数组
type: Array,
default: function(){
return [];
}
},
maxlevel: {//最大层级,可用来控制添加按键的显示
type: Number,
default: 0
},
isbottomadd: { // 最底层是否允许添加按键
type: Boolean,
default: false
},
currentnodekey: "",//默认选中节点
editTreeButton: {//编辑界面行按键(编辑,删除)
type: Object,
default: function(){
return {
add: {
isshow:true,
txt:"编辑"
},
edit: {
isshow:true,
txt:"编辑"
},
del: {
isshow:true,
txt:"删除"
},
}
}
},
treeheight: {// 树容器的高度
type: Number,
default: 0
},
},
data() {
return {
selectCheckedKeys: clone(this.defaultCheckedKeys),
iconclass: "el-icon-plus",
iconExpandedClass: "el-icon-minus", // 需要改element-ui中的index.js
indent: 24,
filterText: "", // 关键字查询
filterField: [], // 关键字查询的字段
treeTxtList: [
{value: "", type: "value/field"}
],
filterDataObj: {}, // 关键字查询的结果对象
}
},
watch: {
filterText(val) {
this.filterDataObj = {};
this.$refs.hierTree.filter(val);
},
defaultCheckedKeys() {
this.selectCheckedKeys = clone(this.defaultCheckedKeys)
}
},
mounted() {
this.nodeTxtFormatter();
},
methods: {
}
});
/* 节点(审批人)、、、预览、新增、删除、编辑 */
/* 节点(条件分支) */
//**************通用事件*******************
//根据分辨率和基准分辨率设置缩放
function bodyScale(el) {
var win_ratio = window.devicePixelRatio; // 当前显示设备的物理像素分辨率与CSS像素分辨率之比
var screen_width = window.screen.width; //document.documentElement.clientWidth;//获取当前分辨率下的可是区域宽度
var screen_height = window.screen.height; //document.documentElement.clientHeight;//获取当前分辨率下的可是区域宽度
var scale_w = screen_width / win_ratio / screen_draft[0]; // 分母——设计稿的分辨率
var scale_h = screen_height / win_ratio / screen_draft[1]; // 分母——设计稿的分辨率
var win_width = document.documentElement.clientWidth;//获取当前分辨率下的可是区域宽度
var win_height = document.documentElement.clientHeight;//获取当前分辨率下的可是区域宽度
var win_w = win_width / win_ratio / wh_draft[0]; // 分母——设计稿的尺寸
var win_h = win_height / win_ratio / wh_draft[1]; // 分母——设计稿的尺寸
if (scale_w > 1 && scale_h > 1) {
el.style.transform = "scale(" + scale_w + "," + scale_h + ")";//放大缩小相应倍数
}
else {
el.style.width = win_width - 2 + "px";
el.style.height = win_height - 2 + "px";
}
//el.style.transform = "scale(" + scale_w * win_w + "," + scale_h * win_h + ")";//放大缩小相应倍数
//document.getElementById('sys_iframe').style.transform = "scale(" + scale_w + "," + scale_h + ")";//放大缩小相应倍数
}
//滚屏效果
const cubic = value => Math.pow(value, 3);
const easeInOutCubic = value => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;