|
|
@ -47,7 +47,7 @@
|
|
|
|
.then(function (response) {
|
|
|
|
.then(function (response) {
|
|
|
|
if (response.data.errors && response.data.errors.length == 0) {
|
|
|
|
if (response.data.errors && response.data.errors.length == 0) {
|
|
|
|
nav.barFinish();
|
|
|
|
nav.barFinish();
|
|
|
|
} else if(response.data.errors && response.data.errors.length > 0) {
|
|
|
|
} else if (response.data.errors && response.data.errors.length > 0) {
|
|
|
|
nav.barError();
|
|
|
|
nav.barError();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.data = {errors: [{message: '服务器响应错误'}]};
|
|
|
|
response.data = {errors: [{message: '服务器响应错误'}]};
|
|
|
@ -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);
|
|
|
@ -290,7 +286,7 @@
|
|
|
|
new Ajax()
|
|
|
|
new Ajax()
|
|
|
|
.module(this.module)
|
|
|
|
.module(this.module)
|
|
|
|
.target(this.target)
|
|
|
|
.target(this.target)
|
|
|
|
.data( this.vm)
|
|
|
|
.data(this.vm)
|
|
|
|
.exports(function (response) {
|
|
|
|
.exports(function (response) {
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
@ -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;
|
|
|
@ -577,15 +600,15 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setCookie:function (name, value, expiretime) {
|
|
|
|
setCookie: function (name, value, expiretime) {
|
|
|
|
var exdate = new Date();
|
|
|
|
var exdate = new Date();
|
|
|
|
exdate.setDate(exdate.getTime() + expiretime);
|
|
|
|
exdate.setDate(exdate.getTime() + expiretime);
|
|
|
|
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + exdate.toGMTString() + ";path=/";
|
|
|
|
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + exdate.toGMTString() + ";path=/";
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getCookie:function (name) {
|
|
|
|
getCookie: function (name) {
|
|
|
|
if (document.cookie.length > 0) {
|
|
|
|
if (document.cookie.length > 0) {
|
|
|
|
c_start = document.cookie.indexOf(name + "=")
|
|
|
|
c_start = document.cookie.indexOf(name + "=")
|
|
|
|
if (c_start != -1){
|
|
|
|
if (c_start != -1) {
|
|
|
|
c_start = c_start + name.length + 1
|
|
|
|
c_start = c_start + name.length + 1
|
|
|
|
c_end = document.cookie.indexOf(";", c_start)
|
|
|
|
c_end = document.cookie.indexOf(";", c_start)
|
|
|
|
if (c_end == -1)
|
|
|
|
if (c_end == -1)
|
|
|
@ -595,7 +618,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clearCookie:function (name) {
|
|
|
|
clearCookie: function (name) {
|
|
|
|
this.setCookie(name, "", -1);
|
|
|
|
this.setCookie(name, "", -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -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")
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
.target("dict")
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
.method("load")
|
|
|
|
} else {
|
|
|
|
.data({dictName: this.dictName})
|
|
|
|
this.options = response.dictItems;
|
|
|
|
.post(function (response) {
|
|
|
|
}
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
}.bind(this));
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.options = response.dictItems;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.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>' +
|
|
|
@ -659,7 +704,7 @@
|
|
|
|
data: function () {
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
options: [],
|
|
|
|
options: [],
|
|
|
|
props:{
|
|
|
|
props: {
|
|
|
|
multiple: false,
|
|
|
|
multiple: false,
|
|
|
|
checkStrictly: true
|
|
|
|
checkStrictly: true
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -689,18 +734,13 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
created: function () {
|
|
|
|
new Ajax()
|
|
|
|
new Ajax("system", "dept", "tree").data({dictName: this.dictName}).post(function (response) {
|
|
|
|
.module("system")
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
.target("dept")
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
.method("tree")
|
|
|
|
} else {
|
|
|
|
.data({dictName: this.dictName})
|
|
|
|
this.options = response.result;
|
|
|
|
.post(function (response) {
|
|
|
|
}
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
}.bind(this))
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.options = response.result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: '' +
|
|
|
|
template: '' +
|
|
|
|
'<el-cascader ' +
|
|
|
|
'<el-cascader ' +
|
|
|
|