From 0bd6cf169f427e08ac21fd8dd9a06025c9affa87 Mon Sep 17 00:00:00 2001 From: "double.huang" <2637309949@qq.com> Date: Wed, 21 Oct 2020 14:55:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20script=20=E7=94=9F=E6=88=90=E6=B5=8B?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/dolphin/gen/template/assets.go | 6 +- cmd/dolphin/gen/template/assets/apis.tmpl | 24 +++- platform/script/apis/sys_app_fun.js | 72 +++++++--- platform/script/apis/sys_area.js | 65 +++++++-- platform/script/apis/sys_attachment.js | 89 +++++++++--- platform/script/apis/sys_cas.js | 107 ++++++++++----- platform/script/apis/sys_client.js | 82 ++++++++--- platform/script/apis/sys_comment.js | 65 +++++++-- platform/script/apis/sys_data_permission.js | 65 +++++++-- platform/script/apis/sys_debug.js | 129 ++++++++++++------ platform/script/apis/sys_dingtalk.js | 7 +- platform/script/apis/sys_domain.js | 65 +++++++-- platform/script/apis/sys_menu.js | 96 +++++++++---- platform/script/apis/sys_notification.js | 65 +++++++-- platform/script/apis/sys_optionset.js | 82 ++++++++--- platform/script/apis/sys_org.js | 89 +++++++++--- platform/script/apis/sys_permission.js | 65 +++++++-- platform/script/apis/sys_role.js | 96 +++++++++---- platform/script/apis/sys_role_menu.js | 99 +++++++++++--- platform/script/apis/sys_schedule.js | 82 ++++++++--- platform/script/apis/sys_schedule_history.js | 7 +- platform/script/apis/sys_scheduling.js | 65 +++++++-- platform/script/apis/sys_setting.js | 82 ++++++++--- platform/script/apis/sys_table.js | 82 ++++++++--- platform/script/apis/sys_table_column.js | 82 ++++++++--- platform/script/apis/sys_tag.js | 82 ++++++++--- platform/script/apis/sys_tag_group.js | 65 +++++++-- platform/script/apis/sys_tracker.js | 14 +- platform/script/apis/sys_user.js | 106 ++++++++++---- platform/script/apis/sys_user_template.js | 65 +++++++-- .../script/apis/sys_user_template_detail.js | 65 +++++++-- platform/script/apis/sys_wechat.js | 7 +- platform/script/apis/sys_worker.js | 24 +++- platform/xml/controller/sys_debug.xml | 22 +-- 34 files changed, 1671 insertions(+), 547 deletions(-) diff --git a/cmd/dolphin/gen/template/assets.go b/cmd/dolphin/gen/template/assets.go index 1e2a826b..f6b39bf5 100644 --- a/cmd/dolphin/gen/template/assets.go +++ b/cmd/dolphin/gen/template/assets.go @@ -32,10 +32,10 @@ var Assets = func() http.FileSystem { }, "/apis.tmpl": &vfsgen۰CompressedFileInfo{ name: "apis.tmpl", - modTime: time.Date(2020, 10, 20, 8, 20, 47, 771277868, time.UTC), - uncompressedSize: 1030, + modTime: time.Date(2020, 10, 21, 6, 53, 49, 617678673, time.UTC), + uncompressedSize: 1314, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x93\xcf\x6e\xdb\x3c\x10\xc4\xef\x7a\x8a\x81\x10\x7c\xb2\xe0\x2f\xd4\xdd\x80\xfa\x07\x76\x5b\x18\x68\x93\xa0\x71\x72\x29\x7a\x60\xcc\xb5\x4d\x44\x26\x15\x72\x55\xd8\x10\xf8\xee\xc5\x4a\x42\xd0\xa0\xcd\xa5\xd7\x5e\x08\x6a\x67\x96\x4b\xfc\x86\xaa\x2a\x2c\xbd\x21\xec\xc9\x51\xd0\x4c\x06\x0f\x67\x18\xdf\xe0\xa1\xb3\x8d\x51\x58\x5d\xe3\xea\x7a\x83\x0f\xab\xf5\x46\x65\x5b\xef\x22\x43\x9f\xac\x8f\xa8\x11\xe8\xa9\xb3\x81\x66\xc5\xbb\xaa\x63\xdb\xc4\x4a\x0a\x14\xb9\x28\x95\xa1\x9d\xee\x1a\xce\xfa\x3e\x68\xb7\x27\xa8\xa5\x77\x1c\x7c\xd3\x50\x50\xef\x6f\xd6\xb7\x29\x65\x7d\x7f\x89\x0b\x76\x58\xd4\x50\x1b\x7f\xd7\xb6\x14\x96\x3a\x12\xd4\x95\x3e\x52\x4a\x59\x55\xa1\xef\xd5\xe7\xed\x47\x1b\x22\x8b\x33\x25\x29\xac\x28\x6e\x53\xca\x8e\xde\x74\x0d\x29\x3a\xb5\x3e\x70\x54\xbf\x39\x6b\xcc\x8c\x66\x5d\xa2\x7e\x83\x3e\x03\x64\x9a\xdd\x81\x9e\xa0\xbe\x10\x1f\xbc\x41\xbe\x27\xce\x53\xca\x80\x86\x18\x5d\x68\x50\xa3\x98\x6c\xda\x19\xcc\x1c\xe1\xe2\xd7\x7b\xdf\x04\xda\xd9\x13\xf2\xbc\x7c\x5d\xab\xf2\x32\xa5\xbe\xff\x83\x26\xe5\x4b\x50\x13\x49\x06\xbc\xde\x3f\xb6\xdf\xdb\x96\x82\xfa\x44\x7c\xcb\xc1\xba\x3d\xf2\x03\x73\xab\xda\xc1\x95\x4f\x47\x39\x23\x1b\xc1\x39\x75\xab\x7b\x0a\xd1\x7a\xf7\x5c\xd6\x7c\x78\x39\x46\xd0\x62\x5a\x45\x4d\xe9\x6d\x91\x01\x3b\x1f\x30\xfb\xa1\x03\x1e\xe9\x0c\xeb\x30\x92\x13\x6c\x18\xc0\xcc\xeb\x41\x99\xa3\xa8\x0b\xcc\x41\x6e\xeb\x0d\xdd\x7d\x5d\x2f\xfd\xb1\xf5\x8e\x1c\x0f\xac\xbf\x3d\xd2\xf9\x7b\x29\xae\xff\xe4\x50\x21\x1b\x88\xbb\xe0\xc6\x07\x33\x7b\x3e\x6f\x21\xcb\xff\xc3\xd7\x71\xc8\x62\x21\xe0\xa7\x5c\x52\x1a\x9a\xcb\x29\x33\x01\x36\x84\x34\x3e\xbd\x7f\x35\xa6\xe2\xaf\x61\x8e\x92\xe4\xf3\x02\xab\xdc\x2a\x93\x9f\x70\xdc\xfd\x0c\x00\x00\xff\xff\x18\x29\x78\x0b\x06\x04\x00\x00"), + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x94\x4f\x4f\xdb\x4c\x10\xc6\xef\xfe\x14\x8f\x2c\xf4\xda\x16\xb0\xbe\x23\xf9\x6d\xab\xa4\xad\x22\xb5\x80\x4a\xe0\x52\xf5\x60\xb2\x93\x64\x85\xb3\x6b\xd6\xe3\x2a\x91\xd9\xef\x5e\x8d\x6d\x52\x28\xa4\x17\x8e\xbd\xac\xc6\xf3\x77\xfd\xfc\x46\x9b\xe7\x98\x38\x4d\x58\x91\x25\x5f\x32\x69\xdc\xee\xa0\x5d\x85\xdb\xd6\x54\x5a\x61\x7a\x81\xf3\x8b\x39\x3e\x4e\x67\x73\x15\x2d\x9c\x6d\x18\xe5\xd6\xb8\x06\x05\x3c\xdd\xb7\xc6\x53\x9a\xbc\xcf\x5b\x36\x55\x93\x8b\x83\x1a\x4e\x32\xa5\x69\x59\xb6\x15\x47\x5d\xe7\x4b\xbb\x22\xa8\x89\xb3\xec\x5d\x55\x91\x57\x1f\x2e\x67\x57\x21\x44\x5d\x77\x8a\x23\xb6\x38\x2b\xa0\xe6\xee\xba\xae\xc9\x4f\xca\x86\xa0\xce\xcb\x0d\x85\x10\xe5\x39\xba\x4e\x7d\x59\x7c\x32\xbe\x61\xc9\x0c\x41\x1c\x53\x6a\x16\x21\x44\x1b\xa7\xdb\x8a\x14\x6d\x6b\xe7\xb9\x51\x2f\x32\x0b\xa4\xba\xe4\x12\x05\xba\x70\x02\x57\x73\x6f\x65\x28\xfe\x47\x17\x01\x32\xdc\x2c\x41\xf7\x50\x5f\x89\xd7\x4e\x23\x5e\x11\xc7\x21\x44\x40\x45\x8c\xd6\x57\x28\xa4\x4c\x89\xf5\xf0\x80\x64\xac\x28\xad\x46\x6a\x09\x47\x4f\xff\xe8\xd2\xd3\xd2\x6c\x11\xc7\xd9\xe1\x58\x1e\x67\x21\x74\xdd\x2b\x31\x71\x9f\x82\xaa\x86\x64\xc0\xe1\xfa\xa1\xfc\xc6\xd4\xe4\xd5\x67\xe2\x2b\xf6\xc6\xae\x10\xaf\x99\x6b\x55\xf7\x59\xf1\xd8\xca\x6a\x31\x44\xe8\xb1\x5a\xdd\x90\x6f\x8c\xb3\x7b\x77\xc9\xeb\xe7\x63\x44\x74\x8c\xa7\x44\x43\x78\x97\x44\xc0\xd2\x79\xa4\x3f\x4b\x8f\x3b\xda\xc1\x58\x88\xa6\x59\xaf\x20\x7a\x8d\x8e\x8b\x3e\x72\x8c\xa4\x48\x70\x0c\xb2\x0b\xa7\xe9\xfa\xdb\x6c\xe2\x36\xb5\xb3\x64\xb9\xa7\xf0\xfd\x8e\x76\x3f\x32\xc9\xfa\x4f\x9a\x8a\xc8\x9e\xb8\xf5\x76\x58\xa5\x74\xdf\xef\x4c\x8e\x93\xfe\x6b\xd3\x63\x39\x13\xe1\x47\x44\x21\x24\x43\x48\x29\xe5\x6a\x96\x46\xd9\x88\xb2\x17\xaf\x87\x37\x6c\xe8\x0b\x7c\xff\x20\x3f\x51\xda\x2c\x91\xa6\xcf\xb7\xf8\xb7\x98\x19\x8a\xa2\x40\xb2\x22\x4e\x1e\x91\xfe\x0d\xf7\x1b\x80\x0f\xc8\x5f\x85\xfe\x27\xf6\x27\xe0\xe5\x62\x8f\xce\x3d\xf2\x11\xfa\x5b\x57\x48\x2e\x79\x70\x99\x44\xfe\x48\x1e\xa8\xc1\xfa\x15\x00\x00\xff\xff\x45\x80\x57\x71\x22\x05\x00\x00"), }, "/app.tmpl": &vfsgen۰CompressedFileInfo{ name: "app.tmpl", diff --git a/cmd/dolphin/gen/template/assets/apis.tmpl b/cmd/dolphin/gen/template/assets/apis.tmpl index f016b9e4..f54ee610 100644 --- a/cmd/dolphin/gen/template/assets/apis.tmpl +++ b/cmd/dolphin/gen/template/assets/apis.tmpl @@ -3,22 +3,34 @@ const axios = require('@/utils/request').default {{range .Controller.APIS}} {{- $tn := .ToUpperCase .Name}} // {{.LcFirst $tn}} {{.Desc}} -module.exports.{{.LcFirst $tn}} = (data) => { +module.exports.{{.LcFirst $tn}} = (data = {}, opt = {}) => { {{- if eq .Method "get"}} - let url = '{{- if and (ne $.Controller.Prefix "") (ne $.Controller.Prefix "/")}}{{$.Controller.Prefix}}{{- else if ne $.Controller.Prefix "/"}}{{$.Viper.GetString "http.prefix"}}{{- end}}{{.APIPrefix .Version}}{{.APIPath $.Controller.Name .Name .Path}}?' + let url = opt.url || '{{- if and (ne $.Controller.Prefix "") (ne $.Controller.Prefix "/")}}{{$.Controller.Prefix}}{{- else if ne $.Controller.Prefix "/"}}{{$.Viper.GetString "http.prefix"}}{{- end}}{{.APIPrefix .Version}}{{.APIPath $.Controller.Name .Name .Path}}?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: '{{.Method}}' + method: '{{.Method}}', + ...opt }) - {{- else}} - const url = '{{- if and (ne $.Controller.Prefix "") (ne $.Controller.Prefix "/")}}{{$.Controller.Prefix}}{{- else if ne $.Controller.Prefix "/"}}{{$.Viper.GetString "http.prefix"}}{{- end}}{{.APIPrefix .Version}}{{.APIPath $.Controller.Name .Name .Path}}' + {{- else }} + const url = opt.url || '{{- if and (ne $.Controller.Prefix "") (ne $.Controller.Prefix "/")}}{{$.Controller.Prefix}}{{- else if ne $.Controller.Prefix "/"}}{{$.Viper.GetString "http.prefix"}}{{- end}}{{.APIPrefix .Version}}{{.APIPath $.Controller.Name .Name .Path}}' + if ((opt.url || '{{.Method}}') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: '{{.Method}}', - data + data, + ...opt }) {{- end}} } diff --git a/platform/script/apis/sys_app_fun.js b/platform/script/apis/sys_app_fun.js index b3e77d67..bff99723 100755 --- a/platform/script/apis/sys_app_fun.js +++ b/platform/script/apis/sys_app_fun.js @@ -2,68 +2,104 @@ const axios = require('@/utils/request').default // add 添加APP功能 -module.exports.add = (data) => { - const url = '/api/sys/app/fun/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/app/fun/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除APP功能 -module.exports.del = (data) => { - const url = '/api/sys/app/fun/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/app/fun/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新APP功能 -module.exports.update = (data) => { - const url = '/api/sys/app/fun/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/app/fun/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page APP功能分页查询 -module.exports.page = (data) => { - let url = '/api/sys/app/fun/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/app/fun/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // tree 菜单树形结构 -module.exports.tree = (data) => { - let url = '/api/sys/app/fun/tree?' +module.exports.tree = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/app/fun/tree?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取APP功能信息 -module.exports.get = (data) => { - let url = '/api/sys/app/fun/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/app/fun/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_area.js b/platform/script/apis/sys_area.js index 57d6a5d5..be413ba1 100755 --- a/platform/script/apis/sys_area.js +++ b/platform/script/apis/sys_area.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加区域 -module.exports.add = (data) => { - const url = '/api/sys/area/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/area/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除区域 -module.exports.del = (data) => { - const url = '/api/sys/area/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/area/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新区域 -module.exports.update = (data) => { - const url = '/api/sys/area/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/area/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 区域分页查询 -module.exports.page = (data) => { - let url = '/api/sys/area/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/area/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取区域信息 -module.exports.get = (data) => { - let url = '/api/sys/area/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/area/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_attachment.js b/platform/script/apis/sys_attachment.js index bea850a6..7ed9d2ad 100755 --- a/platform/script/apis/sys_attachment.js +++ b/platform/script/apis/sys_attachment.js @@ -2,78 +2,125 @@ const axios = require('@/utils/request').default // add 添加附件 -module.exports.add = (data) => { - const url = '/api/sys/attachment/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/attachment/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // upload 上传附件 -module.exports.upload = (data) => { - const url = '/api/sys/attachment/upload' +module.exports.upload = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/attachment/upload' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // export 附件导出 -module.exports.export = (data) => { - let url = '/api/sys/attachment/export?' +module.exports.export = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/attachment/export?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // del 删除附件 -module.exports.del = (data) => { - const url = '/api/sys/attachment/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/attachment/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新附件 -module.exports.update = (data) => { - const url = '/api/sys/attachment/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/attachment/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 附件分页查询 -module.exports.page = (data) => { - let url = '/api/sys/attachment/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/attachment/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取附件信息 -module.exports.get = (data) => { - let url = '/api/sys/attachment/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/attachment/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_cas.js b/platform/script/apis/sys_cas.js index 185fd3da..a372b10c 100755 --- a/platform/script/apis/sys_cas.js +++ b/platform/script/apis/sys_cas.js @@ -2,128 +2,169 @@ const axios = require('@/utils/request').default // login 用户认证 -module.exports.login = (data) => { - const url = '/api/sys/cas/login' +module.exports.login = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/cas/login' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // logout 注销信息 -module.exports.logout = (data) => { - let url = '/api/sys/cas/logout?' +module.exports.logout = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/logout?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // affirm 用户授权 -module.exports.affirm = (data) => { - const url = '/api/sys/cas/affirm' +module.exports.affirm = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/cas/affirm' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // authorize 用户授权 -module.exports.authorize = (data) => { - let url = '/api/sys/cas/authorize?' +module.exports.authorize = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/authorize?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // token 获取令牌 -module.exports.token = (data) => { - const url = '/api/sys/cas/token' +module.exports.token = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/cas/token' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // uRL 授权地址 -module.exports.uRL = (data) => { - let url = '/api/sys/cas/url?' +module.exports.uRL = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/url?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // oauth2 授权回调 -module.exports.oauth2 = (data) => { - let url = '/api/sys/cas/oauth2?' +module.exports.oauth2 = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/oauth2?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // refresh 刷新令牌 -module.exports.refresh = (data) => { - let url = '/api/sys/cas/refresh?' +module.exports.refresh = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/refresh?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // check 检验令牌 -module.exports.check = (data) => { - let url = '/api/sys/cas/check?' +module.exports.check = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/check?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // profile 用户信息 -module.exports.profile = (data) => { - let url = '/api/sys/cas/profile?' +module.exports.profile = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/profile?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // qrcode 扫码登录(绑定第三方) -module.exports.qrcode = (data) => { - let url = '/api/sys/cas/qrcode?' +module.exports.qrcode = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/cas/qrcode?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_client.js b/platform/script/apis/sys_client.js index 07b78859..1a3f92bf 100755 --- a/platform/script/apis/sys_client.js +++ b/platform/script/apis/sys_client.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加客户端 -module.exports.add = (data) => { - const url = '/api/sys/client/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/client/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除客户端 -module.exports.del = (data) => { - const url = '/api/sys/client/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/client/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除客户端 -module.exports.batchDel = (data) => { - const url = '/api/sys/client/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/client/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新客户端 -module.exports.update = (data) => { - const url = '/api/sys/client/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/client/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 客户端分页查询 -module.exports.page = (data) => { - let url = '/api/sys/client/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/client/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取客户端信息 -module.exports.get = (data) => { - let url = '/api/sys/client/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/client/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_comment.js b/platform/script/apis/sys_comment.js index 958e8e7f..f328ed49 100755 --- a/platform/script/apis/sys_comment.js +++ b/platform/script/apis/sys_comment.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加评论 -module.exports.add = (data) => { - const url = '/api/sys/comment/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/comment/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除评论 -module.exports.del = (data) => { - const url = '/api/sys/comment/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/comment/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新评论 -module.exports.update = (data) => { - const url = '/api/sys/comment/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/comment/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 评论分页查询 -module.exports.page = (data) => { - let url = '/api/sys/comment/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/comment/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取评论信息 -module.exports.get = (data) => { - let url = '/api/sys/comment/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/comment/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_data_permission.js b/platform/script/apis/sys_data_permission.js index c4b0f6b5..592d4f2d 100755 --- a/platform/script/apis/sys_data_permission.js +++ b/platform/script/apis/sys_data_permission.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加数据权限 -module.exports.add = (data) => { - const url = '/api/sys/data/permission/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/data/permission/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除数据权限 -module.exports.del = (data) => { - const url = '/api/sys/data/permission/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/data/permission/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新数据权限 -module.exports.update = (data) => { - const url = '/api/sys/data/permission/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/data/permission/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 数据权限分页查询 -module.exports.page = (data) => { - let url = '/api/sys/data/permission/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/data/permission/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取数据权限信息 -module.exports.get = (data) => { - let url = '/api/sys/data/permission/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/data/permission/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_debug.js b/platform/script/apis/sys_debug.js index 0deb7567..710e3aa7 100755 --- a/platform/script/apis/sys_debug.js +++ b/platform/script/apis/sys_debug.js @@ -2,112 +2,153 @@ const axios = require('@/utils/request').default // pprof -module.exports.pprof = (data) => { - const url = '/debug/pprof/' +module.exports.pprof = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // heap -module.exports.heap = (data) => { - const url = '/debug/pprof/heap' +module.exports.heap = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/heap?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // goroutine -module.exports.goroutine = (data) => { - const url = '/debug/pprof/goroutine' +module.exports.goroutine = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/goroutine?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // allocs -module.exports.allocs = (data) => { - const url = '/debug/pprof/allocs' +module.exports.allocs = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/allocs?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // block -module.exports.block = (data) => { - const url = '/debug/pprof/block' +module.exports.block = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/block?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // threadcreate -module.exports.threadcreate = (data) => { - const url = '/debug/pprof/threadcreate' +module.exports.threadcreate = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/threadcreate?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // cmdline -module.exports.cmdline = (data) => { - const url = '/debug/pprof/cmdline' +module.exports.cmdline = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/cmdline?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // profile -module.exports.profile = (data) => { - const url = '/debug/pprof/profile' +module.exports.profile = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/profile?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // symbol -module.exports.symbol = (data) => { - const url = '/debug/pprof/symbol' +module.exports.symbol = (data = {}, opt = {}) => { + const url = opt.url || '/debug/pprof/symbol' + if ((opt.url || 'get,post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, - method: 'GET,POST', - data + method: 'get,post', + data, + ...opt }) } // trace -module.exports.trace = (data) => { - const url = '/debug/pprof/trace' +module.exports.trace = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/trace?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } // mutex -module.exports.mutex = (data) => { - const url = '/debug/pprof/mutex' +module.exports.mutex = (data = {}, opt = {}) => { + let url = opt.url || '/debug/pprof/mutex?' + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } return axios({ url: url, - method: 'GET', - data + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_dingtalk.js b/platform/script/apis/sys_dingtalk.js index d3e47f0f..e31fb036 100755 --- a/platform/script/apis/sys_dingtalk.js +++ b/platform/script/apis/sys_dingtalk.js @@ -2,14 +2,15 @@ const axios = require('@/utils/request').default // oauth2 授权回调 -module.exports.oauth2 = (data) => { - let url = '/api/sys/dingtalk/oauth2?' +module.exports.oauth2 = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/dingtalk/oauth2?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_domain.js b/platform/script/apis/sys_domain.js index c611629d..9c488406 100755 --- a/platform/script/apis/sys_domain.js +++ b/platform/script/apis/sys_domain.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加域 -module.exports.add = (data) => { - const url = '/api/sys/domain/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/domain/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除域 -module.exports.del = (data) => { - const url = '/api/sys/domain/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/domain/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新域 -module.exports.update = (data) => { - const url = '/api/sys/domain/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/domain/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 域分页查询 -module.exports.page = (data) => { - let url = '/api/sys/domain/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/domain/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取域信息 -module.exports.get = (data) => { - let url = '/api/sys/domain/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/domain/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_menu.js b/platform/script/apis/sys_menu.js index 20bb964a..f537faa0 100755 --- a/platform/script/apis/sys_menu.js +++ b/platform/script/apis/sys_menu.js @@ -2,90 +2,138 @@ const axios = require('@/utils/request').default // add 添加菜单 -module.exports.add = (data) => { - const url = '/api/sys/menu/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/menu/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除菜单 -module.exports.del = (data) => { - const url = '/api/sys/menu/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/menu/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除菜单 -module.exports.batchDel = (data) => { - const url = '/api/sys/menu/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/menu/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新菜单 -module.exports.update = (data) => { - const url = '/api/sys/menu/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/menu/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // sidebar 系统菜单 -module.exports.sidebar = (data) => { - let url = '/api/sys/menu/sidebar?' +module.exports.sidebar = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/menu/sidebar?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // page 菜单分页查询 -module.exports.page = (data) => { - let url = '/api/sys/menu/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/menu/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // tree 菜单树形结构 -module.exports.tree = (data) => { - let url = '/api/sys/menu/tree?' +module.exports.tree = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/menu/tree?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取菜单信息 -module.exports.get = (data) => { - let url = '/api/sys/menu/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/menu/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_notification.js b/platform/script/apis/sys_notification.js index 8bcd4636..2edebc48 100755 --- a/platform/script/apis/sys_notification.js +++ b/platform/script/apis/sys_notification.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加站内消息 -module.exports.add = (data) => { - const url = '/api/sys/notification/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/notification/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除站内消息 -module.exports.del = (data) => { - const url = '/api/sys/notification/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/notification/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新站内消息 -module.exports.update = (data) => { - const url = '/api/sys/notification/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/notification/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 站内消息分页查询 -module.exports.page = (data) => { - let url = '/api/sys/notification/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/notification/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取站内消息信息 -module.exports.get = (data) => { - let url = '/api/sys/notification/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/notification/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_optionset.js b/platform/script/apis/sys_optionset.js index 903cbd01..5bc439ff 100755 --- a/platform/script/apis/sys_optionset.js +++ b/platform/script/apis/sys_optionset.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加字典 -module.exports.add = (data) => { - const url = '/api/sys/optionset/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/optionset/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除字典 -module.exports.del = (data) => { - const url = '/api/sys/optionset/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/optionset/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除字典 -module.exports.batchDel = (data) => { - const url = '/api/sys/optionset/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/optionset/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新字典 -module.exports.update = (data) => { - const url = '/api/sys/optionset/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/optionset/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 字典分页查询 -module.exports.page = (data) => { - let url = '/api/sys/optionset/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/optionset/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取字典信息 -module.exports.get = (data) => { - let url = '/api/sys/optionset/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/optionset/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_org.js b/platform/script/apis/sys_org.js index 9fc30fd8..4521ada0 100755 --- a/platform/script/apis/sys_org.js +++ b/platform/script/apis/sys_org.js @@ -2,78 +2,125 @@ const axios = require('@/utils/request').default // add 添加组织 -module.exports.add = (data) => { - const url = '/api/sys/org/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/org/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除组织 -module.exports.del = (data) => { - const url = '/api/sys/org/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/org/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除组织 -module.exports.batchDel = (data) => { - const url = '/api/sys/org/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/org/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新组织 -module.exports.update = (data) => { - const url = '/api/sys/org/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/org/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 组织分页查询 -module.exports.page = (data) => { - let url = '/api/sys/org/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/org/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // tree 菜单树形结构 -module.exports.tree = (data) => { - let url = '/api/sys/org/tree?' +module.exports.tree = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/org/tree?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取组织信息 -module.exports.get = (data) => { - let url = '/api/sys/org/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/org/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_permission.js b/platform/script/apis/sys_permission.js index b406f25d..6c1fe6ab 100755 --- a/platform/script/apis/sys_permission.js +++ b/platform/script/apis/sys_permission.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加权限 -module.exports.add = (data) => { - const url = '/api/sys/permission/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/permission/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除权限 -module.exports.del = (data) => { - const url = '/api/sys/permission/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/permission/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新权限 -module.exports.update = (data) => { - const url = '/api/sys/permission/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/permission/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 权限分页查询 -module.exports.page = (data) => { - let url = '/api/sys/permission/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/permission/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取权限信息 -module.exports.get = (data) => { - let url = '/api/sys/permission/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/permission/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_role.js b/platform/script/apis/sys_role.js index 9ca2a9a0..23f8490b 100755 --- a/platform/script/apis/sys_role.js +++ b/platform/script/apis/sys_role.js @@ -2,90 +2,138 @@ const axios = require('@/utils/request').default // add 添加角色 -module.exports.add = (data) => { - const url = '/api/sys/role/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除角色 -module.exports.del = (data) => { - const url = '/api/sys/role/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除角色 -module.exports.batchDel = (data) => { - const url = '/api/sys/role/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新角色 -module.exports.update = (data) => { - const url = '/api/sys/role/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 角色分页查询 -module.exports.page = (data) => { - let url = '/api/sys/role/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/role/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // roleMenuTree 角色菜单树形结构 -module.exports.roleMenuTree = (data) => { - let url = '/api/sys/role/role_menu_tree?' +module.exports.roleMenuTree = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/role/role_menu_tree?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // roleAppFunTree 角色App功能树形结构 -module.exports.roleAppFunTree = (data) => { - let url = '/api/sys/role/role_app_fun_tree?' +module.exports.roleAppFunTree = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/role/role_app_fun_tree?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取角色信息 -module.exports.get = (data) => { - let url = '/api/sys/role/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/role/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_role_menu.js b/platform/script/apis/sys_role_menu.js index cc367fcb..8299329a 100755 --- a/platform/script/apis/sys_role_menu.js +++ b/platform/script/apis/sys_role_menu.js @@ -2,76 +2,133 @@ const axios = require('@/utils/request').default // add 添加角色菜单 -module.exports.add = (data) => { - const url = '/api/sys/role/menu/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/menu/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // batchAdd 添加角色菜单 -module.exports.batchAdd = (data) => { - const url = '/api/sys/role/menu/batch_add' +module.exports.batchAdd = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/menu/batch_add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除角色菜单 -module.exports.del = (data) => { - const url = '/api/sys/role/menu/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/menu/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除角色菜单 -module.exports.batchDel = (data) => { - const url = '/api/sys/role/menu/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/menu/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新角色菜单 -module.exports.update = (data) => { - const url = '/api/sys/role/menu/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/role/menu/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 角色菜单分页查询 -module.exports.page = (data) => { - let url = '/api/sys/role/menu/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/role/menu/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取角色菜单信息 -module.exports.get = (data) => { - let url = '/api/sys/role/menu/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/role/menu/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_schedule.js b/platform/script/apis/sys_schedule.js index 8e09d87d..ff3657db 100755 --- a/platform/script/apis/sys_schedule.js +++ b/platform/script/apis/sys_schedule.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加调度 -module.exports.add = (data) => { - const url = '/api/sys/schedule/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/schedule/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除调度 -module.exports.del = (data) => { - const url = '/api/sys/schedule/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/schedule/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除调度 -module.exports.batchDel = (data) => { - const url = '/api/sys/schedule/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/schedule/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新调度 -module.exports.update = (data) => { - const url = '/api/sys/schedule/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/schedule/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 调度分页查询 -module.exports.page = (data) => { - let url = '/api/sys/schedule/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/schedule/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取调度信息 -module.exports.get = (data) => { - let url = '/api/sys/schedule/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/schedule/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_schedule_history.js b/platform/script/apis/sys_schedule_history.js index bd79605f..3dbea5c1 100755 --- a/platform/script/apis/sys_schedule_history.js +++ b/platform/script/apis/sys_schedule_history.js @@ -2,14 +2,15 @@ const axios = require('@/utils/request').default // page 调度分页查询 -module.exports.page = (data) => { - let url = '/api/sys/schedule/history/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/schedule/history/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_scheduling.js b/platform/script/apis/sys_scheduling.js index d9de3145..2087f90a 100755 --- a/platform/script/apis/sys_scheduling.js +++ b/platform/script/apis/sys_scheduling.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加调度 -module.exports.add = (data) => { - const url = '/api/sys/scheduling/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/scheduling/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除调度 -module.exports.del = (data) => { - const url = '/api/sys/scheduling/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/scheduling/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新调度 -module.exports.update = (data) => { - const url = '/api/sys/scheduling/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/scheduling/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 调度分页查询 -module.exports.page = (data) => { - let url = '/api/sys/scheduling/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/scheduling/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取调度信息 -module.exports.get = (data) => { - let url = '/api/sys/scheduling/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/scheduling/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_setting.js b/platform/script/apis/sys_setting.js index dd6392d9..01416459 100755 --- a/platform/script/apis/sys_setting.js +++ b/platform/script/apis/sys_setting.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加设置 -module.exports.add = (data) => { - const url = '/api/sys/setting/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/setting/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除设置 -module.exports.del = (data) => { - const url = '/api/sys/setting/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/setting/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除设置 -module.exports.batchDel = (data) => { - const url = '/api/sys/setting/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/setting/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新设置 -module.exports.update = (data) => { - const url = '/api/sys/setting/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/setting/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 设置分页查询 -module.exports.page = (data) => { - let url = '/api/sys/setting/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/setting/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取设置信息 -module.exports.get = (data) => { - let url = '/api/sys/setting/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/setting/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_table.js b/platform/script/apis/sys_table.js index c64eb9a8..21381c0e 100755 --- a/platform/script/apis/sys_table.js +++ b/platform/script/apis/sys_table.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加表 -module.exports.add = (data) => { - const url = '/api/sys/table/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除表 -module.exports.del = (data) => { - const url = '/api/sys/table/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除表 -module.exports.batchDel = (data) => { - const url = '/api/sys/table/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新表 -module.exports.update = (data) => { - const url = '/api/sys/table/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 表分页查询 -module.exports.page = (data) => { - let url = '/api/sys/table/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/table/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取表信息 -module.exports.get = (data) => { - let url = '/api/sys/table/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/table/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_table_column.js b/platform/script/apis/sys_table_column.js index 21f97dd8..c95190e8 100755 --- a/platform/script/apis/sys_table_column.js +++ b/platform/script/apis/sys_table_column.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加表字段 -module.exports.add = (data) => { - const url = '/api/sys/table/column/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/column/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除表字段 -module.exports.del = (data) => { - const url = '/api/sys/table/column/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/column/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除表字段 -module.exports.batchDel = (data) => { - const url = '/api/sys/table/column/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/column/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新表字段 -module.exports.update = (data) => { - const url = '/api/sys/table/column/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/table/column/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 表字段分页查询 -module.exports.page = (data) => { - let url = '/api/sys/table/column/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/table/column/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取表字段信息 -module.exports.get = (data) => { - let url = '/api/sys/table/column/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/table/column/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_tag.js b/platform/script/apis/sys_tag.js index 125db03b..fda919af 100755 --- a/platform/script/apis/sys_tag.js +++ b/platform/script/apis/sys_tag.js @@ -2,66 +2,112 @@ const axios = require('@/utils/request').default // add 添加标签 -module.exports.add = (data) => { - const url = '/api/sys/tag/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除标签 -module.exports.del = (data) => { - const url = '/api/sys/tag/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除标签 -module.exports.batchDel = (data) => { - const url = '/api/sys/tag/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新标签 -module.exports.update = (data) => { - const url = '/api/sys/tag/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 标签分页查询 -module.exports.page = (data) => { - let url = '/api/sys/tag/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/tag/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取标签信息 -module.exports.get = (data) => { - let url = '/api/sys/tag/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/tag/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_tag_group.js b/platform/script/apis/sys_tag_group.js index 9d0d8598..a912b868 100755 --- a/platform/script/apis/sys_tag_group.js +++ b/platform/script/apis/sys_tag_group.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加标签组 -module.exports.add = (data) => { - const url = '/api/sys/tag/group/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/group/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除标签组 -module.exports.del = (data) => { - const url = '/api/sys/tag/group/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/group/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新标签组 -module.exports.update = (data) => { - const url = '/api/sys/tag/group/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/tag/group/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 标签组分页查询 -module.exports.page = (data) => { - let url = '/api/sys/tag/group/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/tag/group/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取标签组信息 -module.exports.get = (data) => { - let url = '/api/sys/tag/group/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/tag/group/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_tracker.js b/platform/script/apis/sys_tracker.js index 50c7b551..f5ea47ba 100755 --- a/platform/script/apis/sys_tracker.js +++ b/platform/script/apis/sys_tracker.js @@ -2,26 +2,28 @@ const axios = require('@/utils/request').default // page 日志分页查询 -module.exports.page = (data) => { - let url = '/api/sys/tracker/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/tracker/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取日志信息 -module.exports.get = (data) => { - let url = '/api/sys/tracker/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/tracker/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_user.js b/platform/script/apis/sys_user.js index 40c0b788..8a90913b 100755 --- a/platform/script/apis/sys_user.js +++ b/platform/script/apis/sys_user.js @@ -2,88 +2,146 @@ const axios = require('@/utils/request').default // add 添加用户 -module.exports.add = (data) => { - const url = '/api/sys/user/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除用户 -module.exports.del = (data) => { - const url = '/api/sys/user/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // batchDel 删除用户 -module.exports.batchDel = (data) => { - const url = '/api/sys/user/batch_del' +module.exports.batchDel = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/batch_del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新用户 -module.exports.update = (data) => { - const url = '/api/sys/user/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 用户分页查询 -module.exports.page = (data) => { - let url = '/api/sys/user/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取用户信息 -module.exports.get = (data) => { - let url = '/api/sys/user/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // login 用户认证 -module.exports.login = (data) => { - const url = '/api/sys/user/login' +module.exports.login = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/login' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // logout 用户退出登录 -module.exports.logout = (data) => { - let url = '/api/sys/user/logout?' +module.exports.logout = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/logout?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_user_template.js b/platform/script/apis/sys_user_template.js index a9770a26..6579b205 100755 --- a/platform/script/apis/sys_user_template.js +++ b/platform/script/apis/sys_user_template.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加用户模板 -module.exports.add = (data) => { - const url = '/api/sys/user/template/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/template/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除用户模板 -module.exports.del = (data) => { - const url = '/api/sys/user/template/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/template/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新用户模板 -module.exports.update = (data) => { - const url = '/api/sys/user/template/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/template/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 用户模板分页查询 -module.exports.page = (data) => { - let url = '/api/sys/user/template/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/template/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取用户模板信息 -module.exports.get = (data) => { - let url = '/api/sys/user/template/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/template/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_user_template_detail.js b/platform/script/apis/sys_user_template_detail.js index bee7febb..d06e1e7a 100755 --- a/platform/script/apis/sys_user_template_detail.js +++ b/platform/script/apis/sys_user_template_detail.js @@ -2,56 +2,91 @@ const axios = require('@/utils/request').default // add 添加用户模板详情 -module.exports.add = (data) => { - const url = '/api/sys/user/template/detail/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/template/detail/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // del 删除用户模板详情 -module.exports.del = (data) => { - const url = '/api/sys/user/template/detail/del' +module.exports.del = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/template/detail/del' + if ((opt.url || 'delete') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'delete', - data + data, + ...opt }) } // update 更新用户模板详情 -module.exports.update = (data) => { - const url = '/api/sys/user/template/detail/update' +module.exports.update = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/user/template/detail/update' + if ((opt.url || 'put') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'put', - data + data, + ...opt }) } // page 用户模板详情分页查询 -module.exports.page = (data) => { - let url = '/api/sys/user/template/detail/page?' +module.exports.page = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/template/detail/page?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } // get 获取用户模板详情信息 -module.exports.get = (data) => { - let url = '/api/sys/user/template/detail/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/user/template/detail/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_wechat.js b/platform/script/apis/sys_wechat.js index e9c4fa2a..114df4d7 100755 --- a/platform/script/apis/sys_wechat.js +++ b/platform/script/apis/sys_wechat.js @@ -2,14 +2,15 @@ const axios = require('@/utils/request').default // oauth2 授权回调 -module.exports.oauth2 = (data) => { - let url = '/api/sys/wechat/oauth2?' +module.exports.oauth2 = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/wechat/oauth2?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/script/apis/sys_worker.js b/platform/script/apis/sys_worker.js index 49b6be8c..866daf00 100755 --- a/platform/script/apis/sys_worker.js +++ b/platform/script/apis/sys_worker.js @@ -2,24 +2,36 @@ const axios = require('@/utils/request').default // add 添加worker -module.exports.add = (data) => { - const url = '/api/sys/worker/add' +module.exports.add = (data = {}, opt = {}) => { + const url = opt.url || '/api/sys/worker/add' + if ((opt.url || 'post') === 'get') { + for (var key in data) { + url += key + '=' + encodeURIComponent(data[key]) + '&' + } + return axios({ + url: url, + method: 'get', + ...opt + }) + } return axios({ url: url, method: 'post', - data + data, + ...opt }) } // get 获取worker信息 -module.exports.get = (data) => { - let url = '/api/sys/worker/get?' +module.exports.get = (data = {}, opt = {}) => { + let url = opt.url || '/api/sys/worker/get?' for (var key in data) { url += key + '=' + encodeURIComponent(data[key]) + '&' } return axios({ url: url, - method: 'get' + method: 'get', + ...opt }) } diff --git a/platform/xml/controller/sys_debug.xml b/platform/xml/controller/sys_debug.xml index 54534ccb..83fb048e 100644 --- a/platform/xml/controller/sys_debug.xml +++ b/platform/xml/controller/sys_debug.xml @@ -1,65 +1,65 @@ - + - + - + - + - + - + - + - + - + - + - +