|
|
@ -186,10 +186,6 @@
|
|
|
|
this.mMethod = "create";
|
|
|
|
this.mMethod = "create";
|
|
|
|
this.post(callback);
|
|
|
|
this.post(callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.create = function (callback) {
|
|
|
|
|
|
|
|
this.mMethod = "create";
|
|
|
|
|
|
|
|
this.post(callback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.delete = function (callback) {
|
|
|
|
this.delete = function (callback) {
|
|
|
|
this.mMethod = "delete";
|
|
|
|
this.mMethod = "delete";
|
|
|
|
this.post(callback);
|
|
|
|
this.post(callback);
|
|
|
@ -502,23 +498,50 @@
|
|
|
|
onClose: callback
|
|
|
|
onClose: callback
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 本标签打开
|
|
|
|
toOpen: function (url) {
|
|
|
|
toOpen: function (url) {
|
|
|
|
this.tipShow();
|
|
|
|
this.tipShow();
|
|
|
|
var url = url.substring(0, 1) == "/" ? url.substring(1) : url;
|
|
|
|
var url = url.substring(0, 1) == "/" ? url.substring(1) : url;
|
|
|
|
$("body").append($("<a id='wb-open' href='" + this.context + "/" + url + "' target='_self' style='dispaly:none;'></a>"))
|
|
|
|
$("body").append($("<a id='wb-open' href='" + this.context + "/" + url + "' target='_self' style='display:none;'></a>"))
|
|
|
|
document.getElementById("wb-open").click();
|
|
|
|
document.getElementById("wb-open").click();
|
|
|
|
$("#wb-open").remove();
|
|
|
|
$("#wb-open").remove();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 新标签打开
|
|
|
|
toOpenNew: function (url) {
|
|
|
|
toOpenNew: function (url) {
|
|
|
|
var url = url.substring(0, 1) == "/" ? url.substring(1) : url;
|
|
|
|
var url = url.substring(0, 1) == "/" ? url.substring(1) : url;
|
|
|
|
$("body").append($("<a id='wb-open' href='" + this.context + "/" + url + "' target='_blank' style='dispaly:none;'></a>"))
|
|
|
|
$("body").append($("<a id='wb-open' href='" + this.context + "/" + url + "' target='_blank' style='display:none;'></a>"))
|
|
|
|
document.getElementById("wb-open").click();
|
|
|
|
document.getElementById("wb-open").click();
|
|
|
|
$("#wb-open").remove();
|
|
|
|
$("#wb-open").remove();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 回到首页
|
|
|
|
toHome: function () {
|
|
|
|
toHome: function () {
|
|
|
|
this.tipShow();
|
|
|
|
this.tipShow();
|
|
|
|
location.href = this.context + "/"
|
|
|
|
location.href = this.context + "/"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 打开一个新Tab
|
|
|
|
|
|
|
|
toOpenTab: function (tab) {
|
|
|
|
|
|
|
|
if (window.index) {
|
|
|
|
|
|
|
|
window.index.addTab(tab)
|
|
|
|
|
|
|
|
} else if (window.parent.index) {
|
|
|
|
|
|
|
|
window.parent.index.addTab(tab)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 关闭Tab
|
|
|
|
|
|
|
|
toCloseTab: function (tabName) {
|
|
|
|
|
|
|
|
if (window.index) {
|
|
|
|
|
|
|
|
window.index.removeTab(tabName)
|
|
|
|
|
|
|
|
} else if (window.parent.index) {
|
|
|
|
|
|
|
|
window.parent.index.removeTab(tabName)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 关闭当前Tab
|
|
|
|
|
|
|
|
toCloseCurTab: function () {
|
|
|
|
|
|
|
|
if (window.index) {
|
|
|
|
|
|
|
|
window.index.removeTab(window.index.activeTabName)
|
|
|
|
|
|
|
|
} else if (window.parent.index) {
|
|
|
|
|
|
|
|
window.parent.index.removeTab(window.parent.index.activeTabName)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
// 滚动屏蔽至顶部
|
|
|
|
// 滚动屏蔽至顶部
|
|
|
|
scrollToTop: function () {
|
|
|
|
scrollToTop: function () {
|
|
|
|
var distance = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
|
var distance = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
@ -609,9 +632,20 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
value: {
|
|
|
|
type: String,
|
|
|
|
type: String | Object,
|
|
|
|
default: ''
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
valueFor: {
|
|
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
|
|
default: 'key',
|
|
|
|
|
|
|
|
validator: function (value) {
|
|
|
|
|
|
|
|
var r = (['key', 'value', 'item'].indexOf(value) !== -1);
|
|
|
|
|
|
|
|
if (!r) {
|
|
|
|
|
|
|
|
console.error("value-for的值只能是['key','value','item']中的一个.")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
dictName: {
|
|
|
|
dictName: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
default: ''
|
|
|
@ -624,31 +658,42 @@
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
change: {
|
|
|
|
|
|
|
|
type: Function,
|
|
|
|
|
|
|
|
default: function (item) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
input: function (value) {
|
|
|
|
input: function (item) {
|
|
|
|
this.$emit('input', value);
|
|
|
|
switch (this.valueFor) {
|
|
|
|
|
|
|
|
case "key":
|
|
|
|
|
|
|
|
this.$emit('input', item.key);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "value":
|
|
|
|
|
|
|
|
this.$emit('input', item.value);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "item":
|
|
|
|
|
|
|
|
this.$emit('input', item);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
created: function () {
|
|
|
|
if (this.dictName) {
|
|
|
|
if (this.dictName) {
|
|
|
|
new Ajax()
|
|
|
|
new Ajax("system", "dict", "load").data({dictName: this.dictName}).post(function (response) {
|
|
|
|
.module("system")
|
|
|
|
|
|
|
|
.target("dict")
|
|
|
|
|
|
|
|
.method("load")
|
|
|
|
|
|
|
|
.data({dictName: this.dictName})
|
|
|
|
|
|
|
|
.post(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.options = response.dictItems;
|
|
|
|
this.options = response.dictItems;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.bind(this))
|
|
|
|
}.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: '' +
|
|
|
|
template: '' +
|
|
|
|
'<el-select :value="value" @input="input" filterable clearable placeholder="请选择" :size="size" :placeholder="placeholder">' +
|
|
|
|
'<el-select :value="value" @input="input" filterable clearable placeholder="请选择" :size="size" :placeholder="placeholder" @change="change">' +
|
|
|
|
' <el-option v-for="item in options" :key="item.key" :label="item.value" :value="item.key">' +
|
|
|
|
' <el-option v-for="item in options" :key="item.key" :label="item.value" :value="item">' +
|
|
|
|
' <span style="float: left">{{ item.value }}</span>' +
|
|
|
|
' <span style="float: left">{{ item.value }}</span>' +
|
|
|
|
' <span style="float: right; color: #8492a6; font-size: 12px">{{ item.key }}</span>' +
|
|
|
|
' <span style="float: right; color: #8492a6; font-size: 12px">{{ item.key }}</span>' +
|
|
|
|
' </el-option>' +
|
|
|
|
' </el-option>' +
|
|
|
@ -689,12 +734,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
created: function () {
|
|
|
|
new Ajax()
|
|
|
|
new Ajax("system", "dept", "tree").data({dictName: this.dictName}).post(function (response) {
|
|
|
|
.module("system")
|
|
|
|
|
|
|
|
.target("dept")
|
|
|
|
|
|
|
|
.method("tree")
|
|
|
|
|
|
|
|
.data({dictName: this.dictName})
|
|
|
|
|
|
|
|
.post(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|