|
|
@ -1,18 +1,18 @@
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
jsonService = axios.create({
|
|
|
|
var jsonService = axios.create({
|
|
|
|
method: 'post',
|
|
|
|
method: 'post',
|
|
|
|
timeout: 30000,
|
|
|
|
timeout: 30000,
|
|
|
|
baseURL: '',
|
|
|
|
baseURL: '',
|
|
|
|
headers: {'Content-Type': 'application/json;charset=UTF-8'},
|
|
|
|
headers: {'Content-Type': 'application/json;charset=UTF-8'},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
downloadService = axios.create({
|
|
|
|
var downloadService = axios.create({
|
|
|
|
method: 'post',
|
|
|
|
method: 'post',
|
|
|
|
timeout: 30000,
|
|
|
|
timeout: 30000,
|
|
|
|
baseURL: '',
|
|
|
|
baseURL: '',
|
|
|
|
responseType: 'blob',
|
|
|
|
responseType: 'blob',
|
|
|
|
headers: {'Content-Type': 'application/json;charset=UTF-8'},
|
|
|
|
headers: {'Content-Type': 'application/json;charset=UTF-8'},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
uploadService = axios.create({
|
|
|
|
var uploadService = axios.create({
|
|
|
|
method: 'post',
|
|
|
|
method: 'post',
|
|
|
|
timeout: 30000,
|
|
|
|
timeout: 30000,
|
|
|
|
baseURL: '',
|
|
|
|
baseURL: '',
|
|
|
@ -147,99 +147,262 @@
|
|
|
|
return Promise.resolve(handleError(response.response.status));
|
|
|
|
return Promise.resolve(handleError(response.response.status));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 定义共享异步请求对象
|
|
|
|
function Ajax(module, target, method) {
|
|
|
|
Vue.prototype.$ajax = {
|
|
|
|
this.mModule = module;
|
|
|
|
post: function (config) {
|
|
|
|
this.mTarget = target;
|
|
|
|
return jsonRequest({
|
|
|
|
this.mMethod = method;
|
|
|
|
url: "/ajax/" + config["module"] + "/" + config["target"] + "/" + config["method"],
|
|
|
|
|
|
|
|
data: JSON.stringify(config["data"]),
|
|
|
|
this.module = function (module) {
|
|
|
|
})
|
|
|
|
this.mModule = module;
|
|
|
|
},
|
|
|
|
return this;
|
|
|
|
login: function (data) {
|
|
|
|
};
|
|
|
|
return jsonRequest({
|
|
|
|
this.target = function (target) {
|
|
|
|
url: "/ajax/system/User/login",
|
|
|
|
this.mTarget = target;
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
return this;
|
|
|
|
})
|
|
|
|
};
|
|
|
|
},
|
|
|
|
this.method = function (method) {
|
|
|
|
upload: function (data) {
|
|
|
|
this.mMethod = method;
|
|
|
|
return upRequest({
|
|
|
|
return this;
|
|
|
|
url: "/ajax/system/File/upload",
|
|
|
|
};
|
|
|
|
data: data,
|
|
|
|
this.data = function (data) {
|
|
|
|
})
|
|
|
|
this.mData = data;
|
|
|
|
},
|
|
|
|
return this;
|
|
|
|
download: function (data) {
|
|
|
|
};
|
|
|
|
return downRequest({
|
|
|
|
this.post = function (callback) {
|
|
|
|
url: "/ajax/system/File/download",
|
|
|
|
jsonRequest({
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
url: '/ajax/' + this.mModule + "/" + this.mTarget + "/" + this.mMethod,
|
|
|
|
})
|
|
|
|
data: JSON.stringify(this.mData),
|
|
|
|
},
|
|
|
|
}).then(callback)
|
|
|
|
create: function (module, target, data) {
|
|
|
|
};
|
|
|
|
return jsonRequest({
|
|
|
|
this.create = function (callback) {
|
|
|
|
url: '/ajax/' + module + "/" + target + "/create",
|
|
|
|
this.mMethod = "create";
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
this.post(callback);
|
|
|
|
})
|
|
|
|
};
|
|
|
|
},
|
|
|
|
this.create = function (callback) {
|
|
|
|
update: function (module, target, data) {
|
|
|
|
this.mMethod = "create";
|
|
|
|
return jsonRequest({
|
|
|
|
this.post(callback);
|
|
|
|
url: '/ajax/' + module + "/" + target + "/update",
|
|
|
|
};
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
this.delete = function (callback) {
|
|
|
|
})
|
|
|
|
this.mMethod = "delete";
|
|
|
|
},
|
|
|
|
this.post(callback);
|
|
|
|
delete: function (module, target, data) {
|
|
|
|
};
|
|
|
|
return jsonRequest({
|
|
|
|
this.update = function (callback) {
|
|
|
|
url: '/ajax/' + module + "/" + target + "/delete",
|
|
|
|
this.mMethod = "update";
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
this.post(callback);
|
|
|
|
})
|
|
|
|
};
|
|
|
|
},
|
|
|
|
this.find = function (callback) {
|
|
|
|
find: function (module, target, data) {
|
|
|
|
this.mMethod = "find";
|
|
|
|
return jsonRequest({
|
|
|
|
this.post(callback);
|
|
|
|
url: '/ajax/' + module + "/" + target + "/find",
|
|
|
|
};
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
this.get = function (callback) {
|
|
|
|
})
|
|
|
|
this.mMethod = "get";
|
|
|
|
},
|
|
|
|
this.post(callback);
|
|
|
|
get: function (module, target, data) {
|
|
|
|
};
|
|
|
|
return jsonRequest({
|
|
|
|
this.load = function (callback) {
|
|
|
|
url: '/ajax/' + module + "/" + target + "/get",
|
|
|
|
this.mMethod = "load";
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
this.post(callback);
|
|
|
|
})
|
|
|
|
};
|
|
|
|
},
|
|
|
|
this.template = function (callback) {
|
|
|
|
load: function (module, target, data) {
|
|
|
|
this.mMethod = "template";
|
|
|
|
return jsonRequest({
|
|
|
|
|
|
|
|
url: '/ajax/' + module + "/" + target + "/load",
|
|
|
|
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
template: function (module, target, data) {
|
|
|
|
|
|
|
|
return downRequest({
|
|
|
|
return downRequest({
|
|
|
|
url: "/ajax/" + module + "/" + target + "/template",
|
|
|
|
url: '/ajax/' + this.mModule + "/" + this.mTarget + "/" + this.mMethod,
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
data: JSON.stringify(this.mData),
|
|
|
|
})
|
|
|
|
}).then(callback)
|
|
|
|
},
|
|
|
|
};
|
|
|
|
imports: function (module, target, data) {
|
|
|
|
this.imports = function (callback) {
|
|
|
|
|
|
|
|
this.mMethod = "imports";
|
|
|
|
return upRequest({
|
|
|
|
return upRequest({
|
|
|
|
url: "/ajax/" + module + "/" + target + "/imports",
|
|
|
|
url: '/ajax/' + this.mModule + "/" + this.mTarget + "/" + this.mMethod,
|
|
|
|
data: data,
|
|
|
|
data: this.mData,
|
|
|
|
})
|
|
|
|
}).then(callback)
|
|
|
|
},
|
|
|
|
};
|
|
|
|
exports: function (module, target, data) {
|
|
|
|
this.exports = function (callback) {
|
|
|
|
|
|
|
|
this.mMethod = "exports";
|
|
|
|
return downRequest({
|
|
|
|
return downRequest({
|
|
|
|
url: "/ajax/" + module + "/" + target + "/exports",
|
|
|
|
url: '/ajax/' + this.mModule + "/" + this.mTarget + "/" + this.mMethod,
|
|
|
|
data: data,
|
|
|
|
data: JSON.stringify(this.mData),
|
|
|
|
})
|
|
|
|
}).then(callback)
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
var mixin = {
|
|
|
|
var mixin = {
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
activeIndex: 'home',
|
|
|
|
activeIndex: 'home',
|
|
|
|
contextPath: '${context?default("")}',
|
|
|
|
contextPath: '${context?default("")}',
|
|
|
|
homePath: '${home?default("")}',
|
|
|
|
homePath: '${home?default("")}',
|
|
|
|
loadingTip: '',
|
|
|
|
|
|
|
|
loadingBar: '',
|
|
|
|
|
|
|
|
isSubmit: false,
|
|
|
|
isSubmit: false,
|
|
|
|
result: [],
|
|
|
|
result: [],
|
|
|
|
select: []
|
|
|
|
select: []
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
onSearch: function () {
|
|
|
|
|
|
|
|
this.vm.pageNumber = 1;
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onReset: function (form) {
|
|
|
|
|
|
|
|
this.$refs[form].resetFields();
|
|
|
|
|
|
|
|
this.w('重置成功');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onPageChange: function (pageNumber) {
|
|
|
|
|
|
|
|
this.vm.pageNumber = pageNumber;
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onPageSizeChange: function (pageSize) {
|
|
|
|
|
|
|
|
this.vm.pageSize = pageSize;
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSelectionChange: function (select) {
|
|
|
|
|
|
|
|
this.select = select;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onTemplate: function () {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.method("template")
|
|
|
|
|
|
|
|
.data({})
|
|
|
|
|
|
|
|
.template()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onImport: function (item) {
|
|
|
|
|
|
|
|
utils.selectFile(function (files) {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data(files[0])
|
|
|
|
|
|
|
|
.imports();
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onExport: function () {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data( this.vm)
|
|
|
|
|
|
|
|
.exports();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSave: function () {
|
|
|
|
|
|
|
|
this.$refs['form'].validate(function (valid) {
|
|
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
|
|
if (this.form.id) {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data(this.form)
|
|
|
|
|
|
|
|
.update(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
this.$refs['form'].resetFields();
|
|
|
|
|
|
|
|
this.form.dialog = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data(this.form)
|
|
|
|
|
|
|
|
.create(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
this.$refs['form'].resetFields();
|
|
|
|
|
|
|
|
this.form.dialog = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onFind: function () {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data(this.vm)
|
|
|
|
|
|
|
|
.find(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.result = response.result;
|
|
|
|
|
|
|
|
this.vm.totalCount = Number(response.totalCount);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onDelete: function (item) {
|
|
|
|
|
|
|
|
this.$confirm('将删除该项, 是否继续?', '提示', {
|
|
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data({id: item.id})
|
|
|
|
|
|
|
|
.delete(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.s("删除成功");
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onBitchDelete: function () {
|
|
|
|
|
|
|
|
if (this.select.length == 0) {
|
|
|
|
|
|
|
|
this.w("至少选中一项");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$confirm('将删除已选择的项, 是否继续?', '提示', {
|
|
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
for (var i = 0; i < this.select.length; i++) {
|
|
|
|
|
|
|
|
(function (obj) {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module(this.module)
|
|
|
|
|
|
|
|
.target(this.target)
|
|
|
|
|
|
|
|
.data({id: obj.id})
|
|
|
|
|
|
|
|
.delete(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
for (var j = 0; j < this.select.length; j++) {
|
|
|
|
|
|
|
|
if (this.select[j].id === obj.id) {
|
|
|
|
|
|
|
|
this.select.splice(j, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.select.length === 0) {
|
|
|
|
|
|
|
|
this.s("删除成功")
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
}.bind(this))(this.select[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
created: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
filters: {},
|
|
|
|
|
|
|
|
watch: {}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// 实例化工具
|
|
|
|
|
|
|
|
window.nav = new Vue({
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
loadingTip: '',
|
|
|
|
|
|
|
|
loadingBar: '',
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
tipShow: function (msg) {
|
|
|
|
tipShow: function (msg) {
|
|
|
|
var message = "<i class='el-icon-loading'></i> 正在加载 ..."
|
|
|
|
var message = "<i class='el-icon-loading'></i> 正在加载 ..."
|
|
|
@ -384,137 +547,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
})();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onSearch: function () {
|
|
|
|
}
|
|
|
|
this.vm.pageNumber = 1;
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onReset: function (form) {
|
|
|
|
|
|
|
|
this.$refs[form].resetFields();
|
|
|
|
|
|
|
|
this.w('重置成功');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onPageChange: function (pageNumber) {
|
|
|
|
|
|
|
|
this.vm.pageNumber = pageNumber;
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onPageSizeChange: function (pageSize) {
|
|
|
|
|
|
|
|
this.vm.pageSize = pageSize;
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSelectionChange: function (select) {
|
|
|
|
|
|
|
|
this.select = select;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onTemplate: function () {
|
|
|
|
|
|
|
|
this.$ajax.template(this.module, this.target, {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onImport: function (item) {
|
|
|
|
|
|
|
|
utils.selectFile(function (files) {
|
|
|
|
|
|
|
|
this.$ajax.imports(this.module, this.target, files[0]);
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onExport: function () {
|
|
|
|
|
|
|
|
this.$ajax.exports(this.module, this.target, this.vm);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSave: function () {
|
|
|
|
|
|
|
|
this.$refs['form'].validate(function (valid) {
|
|
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
|
|
if (this.form.id) {
|
|
|
|
|
|
|
|
this.$ajax.update(this.module, this.target, this.form).then(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
this.$refs['form'].resetFields();
|
|
|
|
|
|
|
|
this.form.dialog = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$ajax.create(this.module, this.target, this.form).then(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
this.$refs['form'].resetFields();
|
|
|
|
|
|
|
|
this.form.dialog = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onFind: function () {
|
|
|
|
|
|
|
|
this.$ajax.find(this.module, this.target, this.vm).then(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
this.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.result = response.result;
|
|
|
|
|
|
|
|
this.vm.totalCount = Number(response.totalCount);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onDelete: function (item) {
|
|
|
|
|
|
|
|
this.$confirm('将删除该项, 是否继续?', '提示', {
|
|
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
this.$ajax.delete(this.module, this.target, {id: item.id}).then(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
this.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.s("删除成功");
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this));
|
|
|
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onBitchDelete: function () {
|
|
|
|
|
|
|
|
if (this.select.length == 0) {
|
|
|
|
|
|
|
|
this.w("至少选中一项");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$confirm('将删除已选择的项, 是否继续?', '提示', {
|
|
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
for (var i = 0; i < this.select.length; i++) {
|
|
|
|
|
|
|
|
(function (obj) {
|
|
|
|
|
|
|
|
this.$ajax.delete(this.module, this.target, {id: obj.id}).then(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
this.e(response.errors[0].message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
for (var j = 0; j < this.select.length; j++) {
|
|
|
|
|
|
|
|
if (this.select[j].id === obj.id) {
|
|
|
|
|
|
|
|
this.select.splice(j, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.select.length === 0) {
|
|
|
|
|
|
|
|
this.s("删除成功")
|
|
|
|
|
|
|
|
this.onFind();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
}.bind(this))(this.select[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
created: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
filters: {},
|
|
|
|
|
|
|
|
watch: {}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// 实例化工具
|
|
|
|
|
|
|
|
window.nav = new Vue({
|
|
|
|
|
|
|
|
mixins: [mixin]
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//字典组件
|
|
|
|
//字典组件
|
|
|
|
Vue.component('el-input-dict', {
|
|
|
|
Vue.component('el-input-dict', {
|
|
|
@ -548,13 +581,18 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
created: function () {
|
|
|
|
if (this.dictName) {
|
|
|
|
if (this.dictName) {
|
|
|
|
this.$ajax.load("system", "dict", {dictName: this.dictName}).then(function (response) {
|
|
|
|
new Ajax()
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
.module("system")
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
.target("dict")
|
|
|
|
} else {
|
|
|
|
.method("load")
|
|
|
|
this.options = response.dictItems;
|
|
|
|
.data({dictName: this.dictName})
|
|
|
|
}
|
|
|
|
.post(function (response) {
|
|
|
|
}.bind(this))
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.options = response.dictItems;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: '' +
|
|
|
|
template: '' +
|
|
|
@ -564,5 +602,65 @@
|
|
|
|
' <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>' +
|
|
|
|
'</el-select>'
|
|
|
|
'</el-select>'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//机构选择
|
|
|
|
|
|
|
|
Vue.component('el-input-dept', {
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
options: [],
|
|
|
|
|
|
|
|
props:{
|
|
|
|
|
|
|
|
multiple: false,
|
|
|
|
|
|
|
|
checkStrictly: true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
|
|
|
value: {
|
|
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
size: {
|
|
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
|
|
default: 'small'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
clearable: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
default: true
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
placeholder: {
|
|
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
input: function (value) {
|
|
|
|
|
|
|
|
this.$emit('input', value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
created: function () {
|
|
|
|
|
|
|
|
new Ajax()
|
|
|
|
|
|
|
|
.module("system")
|
|
|
|
|
|
|
|
.target("dept")
|
|
|
|
|
|
|
|
.method("tree")
|
|
|
|
|
|
|
|
.data({dictName: this.dictName})
|
|
|
|
|
|
|
|
.post(function (response) {
|
|
|
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
|
|
|
console.error(response.errors[0].message)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.options = response.result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.bind(this))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
template: '' +
|
|
|
|
|
|
|
|
'<el-cascader ' +
|
|
|
|
|
|
|
|
' @input="input" ' +
|
|
|
|
|
|
|
|
' :show-all-levels="false" ' +
|
|
|
|
|
|
|
|
' :options="options" ' +
|
|
|
|
|
|
|
|
' :clearable="clearable" ' +
|
|
|
|
|
|
|
|
' :size="size" ' +
|
|
|
|
|
|
|
|
' :props="props" ' +
|
|
|
|
|
|
|
|
' filterable ' +
|
|
|
|
|
|
|
|
' :placeholder="placeholder">' +
|
|
|
|
|
|
|
|
'</el-cascader>'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|