zx 6 дней назад
Родитель
Сommit
7a847526c4

+ 4 - 0
src/api/admin/moduleUsage.js

@@ -4,6 +4,10 @@ export function listModuleUsage(query) {
   return request({ url: '/admin/module-usage/list', method: 'get', params: query })
 }
 
+export function listModuleUsageSummary(query) {
+  return request({ url: '/admin/module-usage/summary', method: 'get', params: query })
+}
+
 export function getProxyDetail(proxyId, statDate) {
   return request({ url: `/admin/module-usage/proxy/${proxyId}`, method: 'get', params: { statDate } })
 }

+ 1 - 6
src/views/admin/menu.js

@@ -16,12 +16,7 @@ export default [
     name: 'SysCompanyAdmin',
     meta: { title: '租户管理', icon: 'el-icon-building', permission: ['admin:company:list'] }
   },
-  {
-    path: '/admin/user',
-    component: () => import('@/views/admin/sysUser/index'),
-    name: 'SysUserAdmin',
-    meta: { title: '员工管理', icon: 'el-icon-user-solid', permission: ['admin:user:list'] }
-  },
+
   {
     path: '/admin/aiProvider',
     component: () => import('@/views/admin/aiProvider/index'),

+ 6 - 17
src/views/admin/moduleUsage/index.vue

@@ -4,9 +4,6 @@
       <el-form-item label="租户名称" prop="tenantName">
         <el-input v-model="queryParams.tenantName" placeholder="请输入租户名称" clearable size="small" @keyup.enter.native="handleQuery" />
       </el-form-item>
-      <el-form-item label="统计日期" prop="statDate">
-        <el-date-picker v-model="queryParams.statDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择统计日期" clearable size="small" style="width:180px" />
-      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -23,11 +20,9 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table border v-loading="loading" :data="list" @selection-change="handleSelectionChange" style="width:100%">
-      <el-table-column type="selection" width="50" align="center" fixed="left" />
+    <el-table border v-loading="loading" :data="list" style="width:100%">
       <el-table-column label="租户名称" align="center" prop="tenantName" width="140" fixed="left" />
       <el-table-column label="归属代理" align="center" prop="proxyName" width="120" />
-      <el-table-column label="统计日期" align="center" prop="statDate" width="110" />
       <!-- 组织管理 -->
       <el-table-column label="部门数" align="center" prop="deptCount" width="75" />
       <el-table-column label="员工数" align="center" prop="employeeCount" width="75" />
@@ -57,7 +52,7 @@
           <el-tag type="success" size="small">{{ scope.row.activeModuleCount || 0 }}</el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="当月消费总额" align="center" prop="totalConsumeAmount" width="120" fixed="right">
+      <el-table-column label="消费总额" align="center" prop="totalConsumeAmount" width="110" fixed="right">
         <template slot-scope="scope">¥{{ scope.row.totalConsumeAmount || '0.00' }}</template>
       </el-table-column>
       <el-table-column label="操作" align="center" width="80" fixed="right">
@@ -74,7 +69,6 @@
       <el-descriptions :column="3" border>
         <el-descriptions-item label="租户名称">{{ detail.tenantName }}</el-descriptions-item>
         <el-descriptions-item label="归属代理">{{ detail.proxyName || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="统计日期">{{ detail.statDate }}</el-descriptions-item>
         <el-descriptions-item label="部门数量">{{ detail.deptCount || 0 }}</el-descriptions-item>
         <el-descriptions-item label="员工数量">{{ detail.employeeCount || 0 }}</el-descriptions-item>
         <el-descriptions-item label="外呼拨打次数">{{ detail.outboundCallCount || 0 }}</el-descriptions-item>
@@ -95,14 +89,14 @@
         <el-descriptions-item label="活跃模块数">
           <el-tag type="success" size="small">{{ detail.activeModuleCount || 0 }}</el-tag>
         </el-descriptions-item>
-        <el-descriptions-item label="当月消费总额">¥{{ detail.totalConsumeAmount || '0.00' }}</el-descriptions-item>
+        <el-descriptions-item label="消费总额">¥{{ detail.totalConsumeAmount || '0.00' }}</el-descriptions-item>
       </el-descriptions>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import { listModuleUsage, getTenantDetail, refreshStatistics } from '@/api/admin/moduleUsage'
+import { listModuleUsageSummary, getTenantDetail, refreshStatistics } from '@/api/admin/moduleUsage'
 
 export default {
   name: 'AdminModuleUsage',
@@ -111,7 +105,6 @@ export default {
       loading: false,
       exportLoading: false,
       showSearch: true,
-      ids: [],
       list: [],
       total: 0,
       detailVisible: false,
@@ -119,8 +112,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        tenantName: null,
-        statDate: null
+        tenantName: null
       }
     }
   },
@@ -130,7 +122,7 @@ export default {
   methods: {
     getList() {
       this.loading = true
-      listModuleUsage(this.queryParams).then(res => {
+      listModuleUsageSummary(this.queryParams).then(res => {
         this.list = res.rows || []
         this.total = res.total || 0
         this.loading = false
@@ -144,9 +136,6 @@ export default {
       this.resetForm('queryForm')
       this.handleQuery()
     },
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.usageId)
-    },
     handleDetail(row) {
       getTenantDetail(row.tenantId).then(res => {
         this.detail = res.data || {}

+ 4 - 183
src/views/admin/proxy/index.vue

@@ -55,11 +55,9 @@
                 @change="handleStatusChange(s.row)" v-hasPermi="['admin:proxy:edit']" />
             </template>
           </el-table-column>
-          <el-table-column label="操作" align="center" width="220" class-name="small-padding fixed-width">
+          <el-table-column label="操作" align="center" width="140" class-name="small-padding fixed-width">
             <template slot-scope="s">
               <el-button size="mini" type="text" icon="el-icon-edit" @click="openProxyDialog(s.row)" v-hasPermi="['admin:proxy:edit']">编辑</el-button>
-              <el-button size="mini" type="text" icon="el-icon-price-tag" @click="openPriceConfig(s.row)">价格配置</el-button>
-              <el-button size="mini" type="text" icon="el-icon-connection" @click="openTenantRel(s.row)">关联租户</el-button>
               <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteProxy(s.row)" v-hasPermi="['admin:proxy:remove']">删除</el-button>
             </template>
           </el-table-column>
@@ -68,85 +66,6 @@
         <pagination v-show="proxyTotal>0" :total="proxyTotal" :page.sync="proxyQuery.pageNum" :limit.sync="proxyQuery.pageSize" @pagination="loadProxyList" />
       </el-tab-pane>
 
-      <!-- ==================== Tab 2:服务价格配置(允许先选代理) ==================== -->
-      <el-tab-pane label="服务价格配置" name="priceConfig">
-        <el-form :inline="true" size="small" class="mb8">
-          <el-form-item label="选择代理">
-            <el-select v-model="priceProxyId" placeholder="请选择代理" clearable filterable @change="loadPriceConfig">
-              <el-option v-for="p in enabledProxyList" :key="p.proxyId" :label="p.proxyName" :value="p.proxyId" />
-            </el-select>
-          </el-form-item>
-          <el-form-item v-if="priceProxyId">
-            <el-button type="primary" icon="el-icon-edit" size="mini" @click="priceEditing = true">批量编辑</el-button>
-            <el-button type="success" icon="el-icon-check" size="mini" @click="submitPriceConfig" v-if="priceEditing">保存</el-button>
-            <el-button size="mini" @click="cancelEditPrice" v-if="priceEditing">取消</el-button>
-          </el-form-item>
-        </el-form>
-
-        <template v-if="priceProxyId">
-          <el-table border :data="priceConfigList">
-            <el-table-column label="服务类型" prop="serviceTypeName" />
-            <el-table-column label="收费单位" prop="feeUnit" width="80" align="center" />
-            <el-table-column label="平台成本价" align="center" width="140">
-              <template slot-scope="s">
-                <el-input v-if="priceEditing" v-model="s.row.platformCost" size="small" type="number" style="width:100px" />
-                <span v-else>¥{{ s.row.platformCost || 0 }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column label="租户售价" align="center" width="140">
-              <template slot-scope="s">
-                <el-input v-if="priceEditing" v-model="s.row.tenantPrice" size="small" type="number" style="width:100px" />
-                <span v-else>¥{{ s.row.tenantPrice || 0 }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column label="分成比例(%)" align="center" width="130">
-              <template slot-scope="s">
-                <el-input v-if="priceEditing" v-model="s.row.proxyRatio" size="small" type="number" style="width:80px" />
-                <span v-else>{{ s.row.proxyRatio || 0 }}%</span>
-              </template>
-            </el-table-column>
-          </el-table>
-        </template>
-        <el-empty v-else description="请先选择一个代理查看价格配置" :image-size="80" />
-      </el-tab-pane>
-
-      <!-- ==================== Tab 3:代理-租户关联 ==================== -->
-      <el-tab-pane label="代理-租户关联" name="tenantRel">
-        <el-form :inline="true" size="small" class="mb8">
-          <el-form-item label="选择代理">
-            <el-select v-model="relProxyId" placeholder="请选择代理" clearable filterable @change="loadTenantRelList">
-              <el-option v-for="p in enabledProxyList" :key="p.proxyId" :label="p.proxyName" :value="p.proxyId" />
-            </el-select>
-          </el-form-item>
-          <el-form-item v-if="relProxyId">
-            <el-button type="primary" icon="el-icon-plus" size="mini" @click="bindDialogVisible = true">绑定租户</el-button>
-          </el-form-item>
-        </el-form>
-
-        <template v-if="relProxyId">
-          <el-table border :data="tenantRelList">
-            <el-table-column label="租户ID" prop="tenantId" width="80" align="center" />
-            <el-table-column label="租户名称" prop="tenantName" />
-            <el-table-column label="分账比例" align="center">
-              <template slot-scope="s">{{ s.row.profitShareRatio || 0 }}%</template>
-            </el-table-column>
-            <el-table-column label="绑定时间" align="center" prop="bindTime" />
-            <el-table-column label="状态" align="center" prop="status">
-              <template slot-scope="s">
-                <el-tag v-if="s.row.status === 1" type="success">启用</el-tag>
-                <el-tag v-else type="danger">禁用</el-tag>
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" align="center" width="120">
-              <template slot-scope="s">
-                <el-button size="mini" type="text" icon="el-icon-delete" @click="handleUnbindTenant(s.row)" v-hasPermi="['proxy:tenantRel:unbind']">解绑</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-        </template>
-        <el-empty v-else description="请先选择一个代理查看关联租户" :image-size="80" />
-      </el-tab-pane>
-
     </el-tabs>
 
     <!-- ==================== 代理编辑弹窗 ==================== -->
@@ -189,29 +108,12 @@
       </div>
     </el-dialog>
 
-    <!-- ==================== 绑定租户弹窗 ==================== -->
-    <el-dialog title="绑定租户到代理" :visible.sync="bindDialogVisible" width="450px" append-to-body>
-      <el-form ref="bindForm" :model="bindForm" :rules="bindRules" label-width="100px">
-        <el-form-item label="租户ID" prop="tenantId">
-          <el-input-number v-model="bindForm.tenantId" :min="1" placeholder="请输入租户ID" style="width:100%" />
-        </el-form-item>
-        <el-form-item label="分账比例(%)" prop="profitShareRatio">
-          <el-input-number v-model="bindForm.profitShareRatio" :min="0" :max="100" :precision="2" style="width:100%" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer">
-        <el-button @click="bindDialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="submitBindForm">确 定</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
-  listProxy, getProxy, addProxy, updateProxy, delProxy, changeProxyStatus, allEnabledProxies,
-  getServicePriceByProxy, batchUpdateServicePrice, initDefaultPriceConfig,
-  getTenantsByProxy, bindTenant, unbindTenant
+  listProxy, getProxy, addProxy, updateProxy, delProxy, changeProxyStatus
 } from '@/api/admin/proxy'
 
 import InlineTenantSelector from "@/components/InlineTenantSelector"
@@ -241,31 +143,15 @@ export default {
         contactMobile: [{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确手机号', trigger: 'blur' }]
       },
 
-      // ======== 价格配置 ========
-      enabledProxyList: [],
-      priceProxyId: null,
-      priceConfigList: [],
-      priceEditing: false,
+      // ======== 价格配置(已移除) ========
 
-      // ======== 租户关联 ========
-      relProxyId: null,
-      tenantRelList: [],
-      bindDialogVisible: false,
-      bindForm: { tenantId: null, profitShareRatio: 0 },
-      bindRules: {
-        tenantId: [{ required: true, message: '请输入租户ID', trigger: 'blur' }]
-      }
+      // ======== 租户关联(已移除) ========
     }
   },
   created() {
     this.loadProxyList()
-    this.loadEnabledProxies()
   },
   methods: {
-    handleTabClick() {
-      if (this.activeTab === 'priceConfig') this.loadEnabledProxies()
-      if (this.activeTab === 'tenantRel') this.loadEnabledProxies()
-    },
 
     /** 租户选择器变更 / 搜索查询 */
     handleQuery() {
@@ -310,12 +196,6 @@ export default {
           this.$message.success(this.proxyForm.proxyId ? '修改成功' : '新增成功')
           this.proxyDialogVisible = false
           this.loadProxyList()
-          this.loadEnabledProxies()
-          // 新增代理后自动初始化价格配置
-          const newProxyId = this.proxyForm.proxyId
-          if (newProxyId) {
-            initDefaultPriceConfig(newProxyId, this.proxyForm.proxyName)
-          }
         }).finally(() => { this.proxySubmitting = false })
       })
     },
@@ -332,65 +212,6 @@ export default {
         delProxy(row.proxyId).then(() => {
           this.$message.success('删除成功')
           this.loadProxyList()
-          this.loadEnabledProxies()
-        })
-      })
-    },
-
-    // ======== 价格配置 ========
-    loadEnabledProxies() {
-      allEnabledProxies().then(r => { this.enabledProxyList = r.data || [] })
-    },
-    loadPriceConfig(proxyId) {
-      const id = proxyId || this.priceProxyId
-      if (!id) { this.priceConfigList = []; return }
-      getServicePriceByProxy(id).then(r => { this.priceConfigList = r.data || [] })
-    },
-    openPriceConfig(row) {
-      this.activeTab = 'priceConfig'
-      this.priceProxyId = row.proxyId
-      this.loadPriceConfig(row.proxyId)
-      this.loadEnabledProxies()
-    },
-    cancelEditPrice() {
-      this.priceEditing = false
-      this.loadPriceConfig()
-    },
-    submitPriceConfig() {
-      batchUpdateServicePrice(this.priceConfigList).then(() => {
-        this.$message.success('保存成功')
-        this.priceEditing = false
-      })
-    },
-
-    // ======== 租户关联 ========
-    loadTenantRelList(id) {
-      const proxyId = id || this.relProxyId
-      if (!proxyId) { this.tenantRelList = []; return }
-      getTenantsByProxy(proxyId).then(r => { this.tenantRelList = r.data || [] })
-    },
-    openTenantRel(row) {
-      this.activeTab = 'tenantRel'
-      this.relProxyId = row.proxyId
-      this.loadTenantRelList(row.proxyId)
-      this.loadEnabledProxies()
-    },
-    submitBindForm() {
-      this.$refs['bindForm'].validate(valid => {
-        if (!valid) return
-        bindTenant(this.relProxyId, this.bindForm.tenantId, this.bindForm.profitShareRatio).then(() => {
-          this.$message.success('绑定成功')
-          this.bindDialogVisible = false
-          this.loadTenantRelList()
-          this.bindForm = { tenantId: null, profitShareRatio: 0 }
-        })
-      })
-    },
-    handleUnbindTenant(row) {
-      this.$confirm(`确认解绑租户 "${row.tenantName || row.tenantId}"?`, '提示', { type: 'warning' }).then(() => {
-        unbindTenant(row.tenantId).then(() => {
-          this.$message.success('解绑成功')
-          this.loadTenantRelList()
         })
       })
     },