فهرست منبع

Merge remote-tracking branch 'origin/saas_adminUi' into saas_adminUi

yys 1 ماه پیش
والد
کامیت
74be099410

+ 2 - 9
src/components/InlineTenantSelector/index.vue

@@ -56,15 +56,8 @@ export default {
       })
     },
     handleChange(val) {
-      this.$store.dispatch('tenant/setCompanyId', val || null)
-      const item = val ? this.tenantList.find(t => t.id === val) : null
-      this.$emit('change', val || null, item)
-    },
-    /** 供父组件「重置」时清空租户选择 */
-    reset() {
-      this.selectedId = null
-      this.$store.dispatch('tenant/setCompanyId', null)
-      this.$emit('change', null, null)
+      this.$store.dispatch('tenant/setTenantId', val)
+      this.$emit('change', val)
     }
   }
 }

+ 1 - 1
src/components/TenantSelector/index.vue

@@ -45,7 +45,7 @@ export default {
       })
     },
     handleTenantChange(val) {
-      this.$store.dispatch('tenant/setCompanyId', val)
+      this.$store.dispatch('tenant/setTenantId', val)
     }
   }
 }

+ 2 - 2
src/main.js

@@ -36,8 +36,8 @@ Vue.prototype.$runtimeConfig = {}
 // 全局方法挂载
 
 // 全局 $modal 插件(若依风格)
-import modal from '@/plugins/modal'
-Vue.use(modal)
+// import modal from '@/plugins/modal'
+// Vue.use(modal)
 
 import { VueJsonp } from 'vue-jsonp'
 Vue.use(VueJsonp)

+ 12 - 12
src/mixins/tenantMixin.js

@@ -1,31 +1,31 @@
 /**
  * 租户选择器全局混入
- * 在所有Vue组件中提供 this.$companyId 和 this.$setCompanyId
+ * 在所有Vue组件中提供 this.$tenantId 和 this.$setTenantId
  * 用法:
- *   - this.$companyId 获取当前选中的租户ID(可能为null)
- *   - this.$setCompanyId(id) 设置当前租户ID
- *   - 在API请求中: listData('/store/storeOrder', { companyId: this.$companyId, ...queryParams })
+ *   - this.$tenantId 获取当前选中的租户ID(可能为null)
+ *   - this.$setTenantId(id) 设置当前租户ID
+ *   - 在API请求中: listData('/store/storeOrder', { tenantId: this.$tenantId, ...queryParams })
  */
 export default {
   computed: {
-    $companyId() {
-      return this.$store.getters.selectedCompanyId
+    $tenantId() {
+      return this.$store.getters.selectedTenantId
     }
   },
   methods: {
-    $setCompanyId(companyId) {
-      this.$store.dispatch('tenant/setCompanyId', companyId)
+    $setTenantId(tenantId) {
+      this.$store.dispatch('tenant/setTenantId', tenantId)
     },
     /**
      * 构建带租户ID的查询参数
      * @param {Object} params 原始查询参数
-     * @returns {Object} 带companyId的查询参数(如果选中了租户)
+     * @returns {Object} 带tenantId的查询参数(如果选中了租户)
      */
     $withTenant(params = {}) {
-      if (this.$companyId) {
-        params.companyId = this.$companyId
+      if (this.$tenantId) {
+        params.tenantId = this.$tenantId
       }
       return params
     }
   }
-}
+}

+ 1 - 1
src/store/getters.js

@@ -14,6 +14,6 @@ const getters = {
   topbarRouters:state => state.permission.topbarRouters,
   defaultRoutes:state => state.permission.defaultRoutes,
   sidebarRouters:state => state.permission.sidebarRouters,
-  selectedCompanyId: state => state.tenant.selectedCompanyId,
+  selectedTenantId: state => state.tenant.selectedTenantId,
 }
 export default getters

+ 5 - 5
src/store/modules/tenant.js

@@ -1,16 +1,16 @@
 const state = {
-  selectedCompanyId: null
+  selectedTenantId: null
 }
 
 const mutations = {
-  SET_COMPANY_ID: (state, companyId) => {
-    state.selectedCompanyId = companyId
+  SET_TENANT_ID: (state, tenantId) => {
+    state.selectedTenantId = tenantId
   }
 }
 
 const actions = {
-  setCompanyId({ commit }, companyId) {
-    commit('SET_COMPANY_ID', companyId)
+  setTenantId({ commit }, tenantId) {
+    commit('SET_TENANT_ID', tenantId)
   }
 }
 

+ 6 - 0
src/utils/request.js

@@ -32,6 +32,12 @@ service.interceptors.request.use(config => {
   if (getToken() && !isToken) {
     config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
   }
+  // 内容审计模块: 当选择了租户时, 设置 datasource-type=saas 通知后端切库
+  const tenantId = store.getters.selectedTenantId
+  if (tenantId) {
+    config.headers['datasource-type'] = 'saas'
+    config.headers['tenant-id'] = tenantId
+  }
   // get请求映射params参数
   if (config.method === 'get' && config.params) {
     let url = config.url + '?';

+ 20 - 36
src/views/admin/article/index.vue

@@ -2,22 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="small">
-      <el-form-item label="租户名称" prop="companyId">
-        <el-select
-          v-model="queryParams.companyId"
-          placeholder="选择租户"
-          clearable
-          filterable
-          size="small"
-          style="width: 200px"
-        >
-          <el-option
-            v-for="item in companyList"
-            :key="item.companyId"
-            :label="item.companyName"
-            :value="item.companyId"
-          />
-        </el-select>
+      <el-form-item label="租户名称" prop="tenantId">
+        <inline-tenant-selector @change="handleTenantChange" />
       </el-form-item>
       <el-form-item label="文章标题" prop="articleTitle">
         <el-input
@@ -216,25 +202,18 @@
 
 <script>
 import { listAllArticles, listPendingArticles, getArticleInfo, auditArticle, deleteArticle, getArticleStatistics, exportAllArticles } from '@/api/admin/article'
-import { listAllCompanies } from '@/api/admin/sysCompany'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'ArticleAdmin',
+  components: { InlineTenantSelector },
   data() {
     return {
-      // 遮罩层
       loading: true,
-      // 导出遮罩层
       exportLoading: false,
-      // 显示搜索条件
       showSearch: true,
-      // 总条数
       total: 0,
-      // 文章列表
       articleList: [],
-      // 租户列表
-      companyList: [],
-      // 统计数据
       statistics: {
         totalCount: 0,
         pendingCount: 0,
@@ -251,7 +230,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyId: null,
+        tenantId: null,
         articleTitle: null,
         status: null
       },
@@ -271,18 +250,16 @@ export default {
     }
   },
   created() {
-    this.getCompanyList()
     this.getList()
   },
   methods: {
-    /** 获取租户列表 */
-    getCompanyList() {
-      listAllCompanies({ pageSize: 9999 }).then(response => {
-        this.companyList = response.rows || []
-      })
-    },
-    /** 查询列表 */
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.articleList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listAllArticles(this.queryParams).then(response => {
         this.articleList = response.rows
@@ -301,13 +278,20 @@ export default {
     },
     /** 搜索按钮操作 */
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
-    /** 重置按钮操作 */
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      this.handleQuery()
+    },
     resetQuery() {
       this.resetForm('queryForm')
-      this.queryParams.companyId = null
+      this.queryParams.tenantId = null
       this.handleQuery()
     },
     /** 查看详情 */

+ 18 - 11
src/views/admin/callRecord/index.vue

@@ -2,14 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
     <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
-      <el-form-item label="租户名称" prop="companyName">
-        <el-input
-          v-model="queryParams.companyName"
-          placeholder="请输入租户名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+      <el-form-item label="租户名称" prop="tenantId">
+        <inline-tenant-selector @change="handleTenantChange" />
       </el-form-item>
       <el-form-item label="员工名称" prop="userName">
         <el-input
@@ -30,7 +24,6 @@
         />
       </el-form-item>
       <el-form-item>
-        <inline-tenant-selector @change="handleQuery" />
       <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>
       </el-form-item>
@@ -299,7 +292,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyName: null,
+        tenantId: null,
         userName: null,
         customerPhone: null
       },
@@ -331,6 +324,12 @@ export default {
   methods: {
     /** 查询列表 */
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.callRecordList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listAllCallRecords(this.queryParams).then(response => {
         this.callRecordList = response.rows
@@ -340,12 +339,20 @@ export default {
     },
     /** 搜索按钮操作 */
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
-    /** 重置按钮操作 */
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      this.handleQuery()
+    },
     resetQuery() {
       this.resetForm('queryForm')
+      this.queryParams.tenantId = null
       this.handleQuery()
     },
     /** 查看详情 */

+ 36 - 57
src/views/admin/live/index.vue

@@ -2,22 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="small">
-      <el-form-item label="租户名称" prop="companyId">
-        <el-select
-          v-model="queryParams.companyId"
-          placeholder="选择租户"
-          clearable
-          filterable
-          size="small"
-          style="width: 200px"
-        >
-          <el-option
-            v-for="item in companyList"
-            :key="item.companyId"
-            :label="item.companyName"
-            :value="item.companyId"
-          />
-        </el-select>
+      <el-form-item label="租户名称" prop="tenantId">
+        <inline-tenant-selector :key="tenantSelectorKey" @change="handleTenantChange" />
       </el-form-item>
       <el-form-item label="直播标题" prop="liveTitle">
         <el-input
@@ -88,8 +74,8 @@
       <el-table-column label="直播时长" align="center" prop="duration" min-width="90" />
       <el-table-column label="直播状态" align="center" prop="status" min-width="90">
         <template slot-scope="scope">
-          <el-tag v-if="scope.row.status == 0" type="success">直播中</el-tag>
-          <el-tag v-else-if="scope.row.status == 1" type="warning">未开始</el-tag>
+          <el-tag v-if="scope.row.status == 2" type="success">直播中</el-tag>
+          <el-tag v-else-if="scope.row.status == 1" type="warning">待支付</el-tag>
           <el-tag v-else type="info">已结束</el-tag>
         </template>
       </el-table-column>
@@ -139,8 +125,8 @@
           <span>{{ viewForm.duration }}</span>
         </el-form-item>
         <el-form-item label="直播状态">
-          <el-tag v-if="viewForm.status == 0" type="success">直播中</el-tag>
-          <el-tag v-else-if="viewForm.status == 1" type="warning">未开始</el-tag>
+          <el-tag v-if="viewForm.status == 2" type="success">直播中</el-tag>
+          <el-tag v-else-if="viewForm.status == 1" type="warning">待支付</el-tag>
           <el-tag v-else type="info">已结束</el-tag>
         </el-form-item>
       </el-form>
@@ -182,65 +168,50 @@
 
 <script>
 import { listAllLives, getLiveInfo, getLiveStatistics, exportAllLives } from '@/api/admin/live'
-import { listAllCompanies } from '@/api/admin/sysCompany'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'LiveAdmin',
+  components: { InlineTenantSelector },
   data() {
     return {
-      // 遮罩层
-      loading: true,
-      // 导出遮罩层
+      loading: false,
       exportLoading: false,
-      // 显示搜索条件
       showSearch: true,
-      // 总条数
       total: 0,
-      // 直播列表
       liveList: [],
-      // 租户列表
-      companyList: [],
-      // 统计数据
       statistics: {
         totalCount: 0,
         totalViewerCount: 0,
         livingCount: 0,
         endedCount: 0
       },
-      // 状态选项
       statusOptions: [
-        { value: 0, label: '直播中' },
-        { value: 1, label: '未开始' },
-        { value: 2, label: '已结束' }
+        { value: 1, label: '待支付' },
+        { value: 2, label: '直播中' },
+        { value: 3, label: '已结束' }
       ],
-      // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyId: null,
+        tenantId: null,
         liveTitle: null,
         status: null
       },
-      // 详情弹窗
       viewOpen: false,
       viewForm: {},
-      // 统计弹窗
-      showStatistics: false
+      showStatistics: false,
+      tenantSelectorKey: 0
     }
   },
-  created() {
-    this.getCompanyList()
-    this.getList()
-  },
   methods: {
-    /** 获取租户列表 */
-    getCompanyList() {
-      listAllCompanies({ pageSize: 9999 }).then(response => {
-        this.companyList = response.rows || []
-      })
-    },
-    /** 查询列表 */
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.liveList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listAllLives(this.queryParams).then(response => {
         this.liveList = response.rows
@@ -248,32 +219,40 @@ export default {
         this.loading = false
       })
     },
-    /** 搜索按钮操作 */
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      if (val) {
+        this.handleQuery()
+      }
+    },
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
-    /** 重置按钮操作 */
     resetQuery() {
+      this.$store.dispatch('tenant/setTenantId', null)
       this.resetForm('queryForm')
-      this.queryParams.companyId = null
-      this.handleQuery()
+      this.queryParams.tenantId = null
+      this.liveList = []
+      this.total = 0
+      this.tenantSelectorKey++
     },
-    /** 查看详情 */
     handleView(row) {
       getLiveInfo(row.liveId).then(response => {
         this.viewForm = response.data
         this.viewOpen = true
       })
     },
-    /** 查看统计 */
     showStatisticsDialog() {
       getLiveStatistics().then(response => {
         this.statistics = response.data
         this.showStatistics = true
       })
     },
-    /** 导出按钒操作 */
     handleExport() {
       this.exportLoading = true
       exportAllLives(this.queryParams).then(response => {

+ 28 - 31
src/views/admin/liveVideo/index.vue

@@ -2,22 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small" label-width="100px">
-        <el-form-item label="租户名称" prop="companyId">
-          <el-select
-            v-model="queryParams.companyId"
-            placeholder="选择租户"
-            clearable
-            filterable
-            size="small"
-            style="width: 200px"
-          >
-            <el-option
-              v-for="item in companyList"
-              :key="item.companyId"
-              :label="item.companyName"
-              :value="item.companyId"
-            />
-          </el-select>
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector :key="tenantSelectorKey" @change="handleTenantChange" />
         </el-form-item>
         <el-form-item label="视频标题" prop="videoTitle">
           <el-input v-model="queryParams.videoTitle" placeholder="请输入视频标题" clearable size="small" @keyup.enter.native="handleQuery" />
@@ -51,36 +37,34 @@
 
 <script>
 import { listAllLiveVideos } from '@/api/admin/liveVideo'
-import { listAllCompanies } from '@/api/admin/sysCompany'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'AdminLiveVideo',
+  components: { InlineTenantSelector },
   data() {
     return {
       loading: false,
       showSearch: true,
       list: [],
       total: 0,
-      companyList: [],
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyId: null,
+        tenantId: null,
         videoTitle: null
-      }
+      },
+      tenantSelectorKey: 0
     }
   },
-  created() {
-    this.getCompanyList()
-    this.getList()
-  },
   methods: {
-    getCompanyList() {
-      listAllCompanies({ pageSize: 9999 }).then(response => {
-        this.companyList = response.rows || []
-      })
-    },
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.list = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listAllLiveVideos(this.queryParams).then(res => {
         this.list = res.rows
@@ -88,14 +72,27 @@ export default {
         this.loading = false
       }).catch(() => { this.loading = false })
     },
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      if (val) {
+        this.handleQuery()
+      }
+    },
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
     resetQuery() {
+      this.$store.dispatch('tenant/setTenantId', null)
       this.resetForm('queryForm')
-      this.queryParams.companyId = null
-      this.handleQuery()
+      this.queryParams.tenantId = null
+      this.list = []
+      this.total = 0
+      this.tenantSelectorKey++
     }
   }
 }

+ 30 - 42
src/views/admin/product/index.vue

@@ -2,22 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small" label-width="100px">
-        <el-form-item label="租户名称" prop="companyId">
-          <el-select
-            v-model="queryParams.companyId"
-            placeholder="选择租户"
-            clearable
-            filterable
-            size="small"
-            style="width: 200px"
-          >
-            <el-option
-              v-for="item in companyList"
-              :key="item.companyId"
-              :label="item.companyName"
-              :value="item.companyId"
-            />
-          </el-select>
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector :key="tenantSelectorKey" @change="handleTenantChange" />
         </el-form-item>
         <el-form-item label="商品名称" prop="productName">
           <el-input
@@ -224,32 +210,24 @@
 
 <script>
 import { listAllProducts, listPendingProducts, getProductInfo, auditProduct, getProductStatistics, exportAllProducts } from '@/api/admin/product'
-import { listAllCompanies } from '@/api/admin/sysCompany'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'ProductAdmin',
+  components: { InlineTenantSelector },
   data() {
     return {
-      // 遮罩层
-      loading: true,
-      // 导出遮罩层
+      loading: false,
       exportLoading: false,
-      // 显示搜索条件
       showSearch: true,
-      // 总条数
       total: 0,
-      // 商品列表
       productList: [],
-      // 租户列表
-      companyList: [],
-      // 统计数据
       statistics: {
         totalCount: 0,
         pendingCount: 0,
         onlineCount: 0,
         rejectedCount: 0
       },
-      // 状态选项
       statusOptions: [
         { value: 0, label: '待审核' },
         { value: 1, label: '已上架' },
@@ -259,7 +237,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyId: null,
+        tenantId: null,
         productName: null,
         status: null
       },
@@ -275,22 +253,19 @@ export default {
         auditRemark: ''
       },
       // 统计弹窗
-      showStatistics: false
+      showStatistics: false,
+      // 租户选择器 key,用于重置时强制重建组件
+      tenantSelectorKey: 0
     }
   },
-  created() {
-    this.getCompanyList()
-    this.getList()
-  },
   methods: {
-    /** 获取租户列表 */
-    getCompanyList() {
-      listAllCompanies({ pageSize: 9999 }).then(response => {
-        this.companyList = response.rows || []
-      })
-    },
-    /** 查询列表 */
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.productList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listAllProducts(this.queryParams).then(response => {
         this.productList = response.rows
@@ -307,16 +282,29 @@ export default {
         this.loading = false
       })
     },
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      if (val) {
+        this.handleQuery()
+      }
+    },
     /** 搜索按钮操作 */
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
+      this.$store.dispatch('tenant/setTenantId', null)
       this.resetForm('queryForm')
-      this.queryParams.companyId = null
-      this.handleQuery()
+      this.queryParams.tenantId = null
+      this.productList = []
+      this.total = 0
+      this.tenantSelectorKey++
     },
     /** 查看详情 */
     handleView(row) {

+ 25 - 3
src/views/admin/sms/index.vue

@@ -31,8 +31,8 @@
     <!-- 搜索栏 -->
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
-        <el-form-item label="租户名称" prop="companyName">
-          <el-input v-model="queryParams.companyName" placeholder="请输入租户名称" clearable @keyup.enter.native="handleQuery" />
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector @change="handleTenantChange" />
         </el-form-item>
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
@@ -110,9 +110,11 @@
 
 <script>
 import request from '@/utils/request'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'AdminSms',
+  components: { InlineTenantSelector },
   data() {
     return {
       loading: false,
@@ -125,7 +127,8 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyName: null
+        companyName: null,
+        tenantId: null
       },
       editVisible: false,
       editForm: {
@@ -149,6 +152,12 @@ export default {
   },
   methods: {
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.smsList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       request({
         url: '/admin/sms-admin/list',
@@ -161,6 +170,10 @@ export default {
       }).catch(() => { this.loading = false })
     },
     getCount() {
+      if (!this.queryParams.tenantId) {
+        this.smsCount = {}
+        return
+      }
       request({
         url: '/admin/sms-admin/count',
         method: 'get'
@@ -169,11 +182,20 @@ export default {
       })
     },
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      this.handleQuery()
+    },
     resetQuery() {
       this.resetForm('queryForm')
+      this.queryParams.tenantId = null
       this.handleQuery()
     },
     handleEdit(row) {

+ 20 - 3
src/views/admin/smsOrder/index.vue

@@ -3,8 +3,8 @@
     <!-- 搜索栏 -->
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
-        <el-form-item label="租户名称" prop="companyName">
-          <el-input v-model="queryParams.companyName" placeholder="请输入租户名称" clearable @keyup.enter.native="handleQuery" />
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector @change="handleTenantChange" />
         </el-form-item>
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
@@ -78,9 +78,11 @@
 
 <script>
 import request from '@/utils/request'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'AdminSmsOrder',
+  components: { InlineTenantSelector },
   data() {
     return {
       loading: false,
@@ -91,7 +93,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyName: null
+        tenantId: null
       },
       detailVisible: false,
       detail: {}
@@ -102,6 +104,12 @@ export default {
   },
   methods: {
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.orderList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       request({
         url: '/admin/sms-order/list',
@@ -114,11 +122,20 @@ export default {
       }).catch(() => { this.loading = false })
     },
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      this.handleQuery()
+    },
     resetQuery() {
       this.resetForm('queryForm')
+      this.queryParams.tenantId = null
       this.handleQuery()
     },
     handleDetail(row) {

+ 35 - 27
src/views/admin/storeOrder/index.vue

@@ -2,22 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small" label-width="100px">
-        <el-form-item label="租户名称" prop="companyId">
-          <el-select
-            v-model="queryParams.companyId"
-            placeholder="选择租户"
-            clearable
-            filterable
-            size="small"
-            style="width: 200px"
-          >
-            <el-option
-              v-for="item in companyList"
-              :key="item.companyId"
-              :label="item.companyName"
-              :value="item.companyId"
-            />
-          </el-select>
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector :key="tenantSelectorKey" @change="handleTenantChange" />
         </el-form-item>
         <el-form-item label="订单编号" prop="orderNo">
           <el-input v-model="queryParams.orderNo" placeholder="请输入订单编号" clearable size="small" @keyup.enter.native="handleQuery" />
@@ -51,25 +37,27 @@
 
 <script>
 import { listStoreOrder, exportStoreOrder } from '@/api/admin/storeOrder'
-import { listAllCompanies } from '@/api/admin/sysCompany'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'AdminStoreOrder',
+  components: { InlineTenantSelector },
   data() {
     return {
       loading: false, exportLoading: false, showSearch: true,
-      list: [], total: 0, companyList: [],
-      queryParams: { pageNum: 1, pageSize: 10, orderNo: null, companyId: null }
+      list: [], total: 0,
+      tenantSelectorKey: 0,
+      queryParams: { pageNum: 1, pageSize: 10, orderNo: null, tenantId: null }
     }
   },
-  created() { this.getCompanyList(); this.getList() },
   methods: {
-    getCompanyList() {
-      listAllCompanies({ pageSize: 9999 }).then(response => {
-        this.companyList = response.rows || []
-      })
-    },
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.list = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listStoreOrder(this.queryParams).then(res => {
         this.list = res.rows || []
@@ -77,8 +65,28 @@ export default {
         this.loading = false
       }).catch(() => { this.loading = false })
     },
-    handleQuery() { this.queryParams.pageNum = 1; this.getList() },
-    resetQuery() { this.resetForm('queryForm'); this.queryParams.companyId = null; this.handleQuery() },
+    handleTenantChange(val) {
+      if (val) {
+        this.queryParams.tenantId = val
+        this.handleQuery()
+      }
+    },
+    handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.list = []
+      this.total = 0
+      this.queryParams.tenantId = null
+      this.$store.dispatch('tenant/setTenantId', null)
+      this.tenantSelectorKey++
+    },
     handleExport() {
       this.exportLoading = true
       exportStoreOrder(this.queryParams).then(response => {

+ 20 - 29
src/views/admin/videoResource/index.vue

@@ -2,22 +2,8 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small" label-width="100px">
-        <el-form-item label="租户名称" prop="companyId">
-          <el-select
-            v-model="queryParams.companyId"
-            placeholder="选择租户"
-            clearable
-            filterable
-            size="small"
-            style="width: 200px"
-          >
-            <el-option
-              v-for="item in companyList"
-              :key="item.companyId"
-              :label="item.companyName"
-              :value="item.companyId"
-            />
-          </el-select>
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector @change="handleTenantChange" />
         </el-form-item>
         <el-form-item label="视频名称" prop="videoName">
           <el-input v-model="queryParams.videoName" placeholder="请输入视频名称" clearable size="small" @keyup.enter.native="handleQuery" />
@@ -51,36 +37,33 @@
 
 <script>
 import { listAllVideoResources } from '@/api/admin/videoResource'
-import { listAllCompanies } from '@/api/admin/sysCompany'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 export default {
   name: 'AdminVideoResource',
+  components: { InlineTenantSelector },
   data() {
     return {
       loading: false,
       showSearch: true,
       list: [],
       total: 0,
-      companyList: [],
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        companyId: null,
+        tenantId: null,
         videoName: null
       }
     }
   },
-  created() {
-    this.getCompanyList()
-    this.getList()
-  },
   methods: {
-    getCompanyList() {
-      listAllCompanies({ pageSize: 9999 }).then(response => {
-        this.companyList = response.rows || []
-      })
-    },
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.list = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listAllVideoResources(this.queryParams).then(res => {
         this.list = res.rows
@@ -88,13 +71,21 @@ export default {
         this.loading = false
       }).catch(() => { this.loading = false })
     },
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      this.handleQuery()
+    },
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
     resetQuery() {
       this.resetForm('queryForm')
-      this.queryParams.companyId = null
+      this.queryParams.tenantId = null
       this.handleQuery()
     }
   }

+ 25 - 9
src/views/admin/voice/index.vue

@@ -2,6 +2,9 @@
   <div class="app-container">
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" size="small" label-width="100px">
+        <el-form-item label="租户名称" prop="tenantId">
+          <inline-tenant-selector @change="handleTenantChange" />
+        </el-form-item>
         <el-form-item label="任务名称" prop="taskName">
           <el-input
             v-model="queryParams.taskName"
@@ -10,14 +13,6 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
-        <el-form-item label="租户名称" prop="companyName">
-          <el-input
-            v-model="queryParams.companyName"
-            placeholder="请输入租户名称"
-            clearable
-            @keyup.enter.native="handleQuery"
-          />
-        </el-form-item>
         <el-form-item label="状态" prop="status">
           <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
             <el-option label="待启动" :value="0" />
@@ -132,6 +127,7 @@
 
 <script>
 import request from '@/utils/request'
+import InlineTenantSelector from '@/components/InlineTenantSelector'
 
 // admin专用:走 /admin/ 前缀,代理到 fs-admin 8004
 function listRobotic(query) {
@@ -146,6 +142,7 @@ function exportRobotic(query) {
 
 export default {
   name: 'AdminVoice',
+  components: { InlineTenantSelector },
   data() {
     return {
       loading: true,
@@ -157,7 +154,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         taskName: null,
-        companyName: null,
+        tenantId: null,
         status: null
       },
       detailOpen: false,
@@ -169,6 +166,12 @@ export default {
   },
   methods: {
     getList() {
+      if (!this.queryParams.tenantId) {
+        this.dataList = []
+        this.total = 0
+        this.loading = false
+        return
+      }
       this.loading = true
       listRobotic(this.queryParams).then(response => {
         this.dataList = response.rows
@@ -177,11 +180,20 @@ export default {
       })
     },
     handleQuery() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.queryParams.pageNum = 1
       this.getList()
     },
+    handleTenantChange(val) {
+      this.queryParams.tenantId = val || null
+      this.handleQuery()
+    },
     resetQuery() {
       this.resetForm('queryForm')
+      this.queryParams.tenantId = null
       this.handleQuery()
     },
     handleDetail(row) {
@@ -191,6 +203,10 @@ export default {
       })
     },
     handleExport() {
+      if (!this.queryParams.tenantId) {
+        this.$message.warning('请先选择租户')
+        return
+      }
       this.exportLoading = true
       exportRobotic(this.queryParams).then(response => {
         this.download(response.msg)

+ 12 - 12
vue.config.js

@@ -57,73 +57,73 @@ module.exports = {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
-      // 以下路径前缀代理到 fs-company(8006) - 租户服务端
+      // 以下路径前缀代理到 fs-company(8003) - 租户服务端
       // adminui前端API中这些路径只有fs-company有Controller
       [process.env.VUE_APP_BASE_API + '/adv']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/aicall']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/common']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/company']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/companyWorkflow']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/qwAssignRule']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/qwCustomerLink']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/qwGroupActual']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/qwGroupLiveCode']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
         }
       },
       [process.env.VUE_APP_BASE_API + '/shop']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
@@ -137,7 +137,7 @@ module.exports = {
         }
       },
       [process.env.VUE_APP_BASE_API + '/workflow']: {
-        target: 'http://localhost:8006',
+        target: 'http://localhost:8003',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''