ソースを参照

fix 配额管理

dusenyao 3 年 前
コミット
894a94e2ef
4 ファイル変更35 行追加8 行削除
  1. 13 0
      src/api/org.js
  2. 1 1
      src/views/quota/SetQuota.vue
  3. 20 6
      src/views/quota/index.vue
  4. 1 1
      vue.config.js

+ 13 - 0
src/api/org.js

@@ -119,3 +119,16 @@ export function PageQueryOrgLiveUsedRecordList(data) {
     data
   });
 }
+
+/**
+ * 启用机构配额
+ * @param {Object} data
+ */
+export function EnableOrgQuota(data) {
+  return request({
+    method: 'post',
+    url: process.env.VUE_APP_FileServer,
+    params: getRequestParameter('live_quota_manager-EnableOrgQuota'),
+    data
+  });
+}

+ 1 - 1
src/views/quota/SetQuota.vue

@@ -147,7 +147,7 @@ export default {
     },
 
     close() {
-      this.$emit('update:visible', false);
+      this.$emit('close');
     }
   }
 };

+ 20 - 6
src/views/quota/index.vue

@@ -13,15 +13,17 @@
         <el-table-column prop="quota_used" label="累计已用" width="160" />
         <el-table-column prop="quota_status" label="状态" width="160">
           <template slot-scope="{ row }">
-            <span :style="{ color: row.quota_status ? '#CA0000' : '#019319' }">
-              {{ row.quota_status ? '已停用' : '使用中' }}
+            <span :style="{ color: row.quota_status ? '#019319' : '#CA0000' }">
+              {{ row.quota_status ? '使用中' : '已停用' }}
             </span>
           </template>
         </el-table-column>
         <el-table-column label="操作" fixed="right">
           <template slot-scope="{ row }">
             <span class="set-quota operation" @click="setQuota(row.org_id)">设置配额</span>
-            <span class="operation" @click="setStatus(row.org_id)">{{ row.quota_status ? '停用' : '启用' }}</span>
+            <span class="operation" @click="setStatus(row.org_id, !row.quota_status)">
+              {{ row.quota_status ? '停用' : '启用' }}
+            </span>
           </template>
         </el-table-column>
       </el-table>
@@ -40,12 +42,13 @@
       @size-change="changePageSize"
     />
 
-    <set-quota :visible.sync="visible" :org-id="curOrgId" />
+    <set-quota :org-id="curOrgId" :visible="visible" @close="closeSetQuota" />
   </div>
 </template>
 
 <script>
 import { PageQueryOrgQuotaList } from '@/api/list';
+import { EnableOrgQuota } from '@/api/org';
 import SetQuota from './SetQuota.vue';
 
 export default {
@@ -89,8 +92,19 @@ export default {
       this.curOrgId = org_id;
     },
 
-    setStatus(org_id) {
-      console.log(org_id);
+    setStatus(org_id, is_enabled) {
+      EnableOrgQuota({
+        org_id,
+        is_enabled
+      }).then(() => {
+        this.$message.success(`${is_enabled ? '启用' : '停用'}机构配额成功`);
+        this.pageQueryOrgQuotaList();
+      });
+    },
+
+    closeSetQuota() {
+      this.visible = false;
+      this.curOrgId = '';
     }
   }
 };

+ 1 - 1
vue.config.js

@@ -16,7 +16,7 @@ let proxy = {};
 if (NODE_ENV === 'development') {
   proxy = {
     [process.env.VUE_APP_BASE_API]: {
-      target: 'http://gcls.helxsoft.cn/',
+      target: 'https://gcls.helxsoft.cn/',
       changeOrigin: true,
       pathRewrite: {
         [`^${process.env.VUE_APP_BASE_API}`]: ''