1、使用Promise,重写red.getJSON /red.post, 解决"回调地狱"问题

2、修改 数据源管理/平台信息管理
This commit is contained in:
2019-04-04 17:47:29 +08:00
parent 3de47eea46
commit 696222fcf0
15 changed files with 283 additions and 38 deletions

View File

@@ -76,13 +76,14 @@
</row>
<script>
let { platList, platSave } = plat;
var vm = new Vue({
el: ".plat",
data: {
cfg: {
title: "业务平台 管理",
cols: [
{col: "_id", label: "ID"},
{col: "name", label: "业务名称"},
{col: "token", label: "Token"},
{col: "remark", label: "说明"},
@@ -100,15 +101,9 @@
},
methods: {
findList: function () {
var para = {
doc:"sys_plat",
shows: JSON.stringify(["_id", "_key", "name", "token","remark", "status"]),
filter: JSON.stringify([{col:"status",type:"!=",value:-1}]),
};
red.getJSON("/meta/find", para, function (json) {
vm.list = json;
red.setData("sysPlats", json.rows);
findList () {
platList().then(res => {
vm.list = res
})
},
update: function (kv, row) {
@@ -127,14 +122,10 @@
$('#myModal').modal({moveable: true});
},
save: function (row) {
red.post("/meta/save", {
_id: row._id || "sys_plat",
doc: JSON.stringify(row)
}, function (json) {
red.showMsg();
$('#myModal').modal('hide');
vm.findList();
});
platSave({plat: row}).then(() => {
red.showMsg({msg: "操作成功"})
$('#myModal').modal('hide')
})
}
},
mounted: function () {