Pārlūkot izejas kodu

update:升级了sysconfig 的基本方法

zhangwenjian 5 gadi atpakaļ
vecāks
revīzija
a60554c997

+ 1 - 1
.env.production

@@ -2,5 +2,5 @@
 ENV = 'production'
 
 # base api
-VUE_APP_BASE_API = ''
+VUE_APP_BASE_API = 'https://api.go-admin.dev/'
 

+ 5 - 12
src/api/system/config.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 查询参数列表
 export function listConfig(query) {
   return request({
-    url: '/api/v1/configList',
+    url: '/api/v1/config',
     method: 'get',
     params: query
   })
@@ -20,8 +20,9 @@ export function getConfig(configId) {
 // 根据参数键名查询参数值
 export function getConfigKey(configKey) {
   return request({
-    url: '/api/v1/configKey/' + configKey,
-    method: 'get'
+    url: '/api/v1/configKey',
+    method: 'post',
+    data: { 'configKey': configKey }
   })
 }
 
@@ -37,7 +38,7 @@ export function addConfig(data) {
 // 修改参数配置
 export function updateConfig(data) {
   return request({
-    url: '/api/v1/config',
+    url: '/api/v1/config/' + data.ID,
     method: 'put',
     data: data
   })
@@ -51,11 +52,3 @@ export function delConfig(configId) {
   })
 }
 
-// 导出参数
-export function exportConfig(query) {
-  return request({
-    url: '/api/v1/config/export',
-    method: 'get',
-    params: query
-  })
-}

+ 7 - 7
src/views/config/index.vue

@@ -82,7 +82,7 @@
 
         <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
           <el-table-column type="selection" width="55" align="center" />
-          <el-table-column label="参数主键" width="80" align="center" prop="configId" />
+          <el-table-column label="参数主键" width="80" align="center" prop="ID" />
           <el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
           <el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
           <el-table-column label="参数键值" align="center" prop="configValue" />
@@ -238,7 +238,7 @@ export default {
     // 表单重置
     reset() {
       this.form = {
-        configId: undefined,
+        ID: undefined,
         configName: undefined,
         configKey: undefined,
         configValue: undefined,
@@ -267,15 +267,15 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.configId)
+      this.ids = selection.map(item => item.ID)
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset()
-      const configId = row.configId || this.ids
-      getConfig(configId).then(response => {
+      const ID = row.ID || this.ids
+      getConfig(ID).then(response => {
         this.form = response.data
         this.open = true
         this.title = '修改参数'
@@ -286,7 +286,7 @@ export default {
     submitForm: function() {
       this.$refs['form'].validate(valid => {
         if (valid) {
-          if (this.form.configId !== undefined) {
+          if (this.form.ID !== undefined) {
             updateConfig(this.form).then(response => {
               if (response.code === 200) {
                 this.msgSuccess('修改成功')
@@ -312,7 +312,7 @@ export default {
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const configIds = row.configId || this.ids
+      const configIds = row.ID || this.ids
       this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', '警告', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',

+ 1 - 1
src/views/sysuser/index.vue

@@ -431,7 +431,7 @@ export default {
       this.sexOptions = response.data
     })
     this.getConfigKey('sys.user.initPassword').then(response => {
-      this.initPassword = response.msg
+      this.initPassword = response.data.configValue
     })
   },
   methods: {