Browse Source

语音席位

三七 1 ngày trước cách đây
mục cha
commit
11c4f26a0a

+ 1 - 1
package.json

@@ -89,7 +89,7 @@
     "@amap/amap-jsapi-loader": "^1.0.1",
     "@huaweicloud/huaweicloud-sdk-core": "^3.1.105",
     "@huaweicloud/huaweicloud-sdk-vod": "^3.1.105",
-    "@openim/wasm-client-sdk": "^3.8.3-patch.12",
+    "@openim/wasm-client-sdk": "^3.8.3-patch.14",
     "@riophae/vue-treeselect": "0.4.0",
     "@wecom/jssdk": "^2.4.0",
     "axios": "0.21.0",

+ 6 - 6
src/api/company/companyUserAll.js

@@ -191,19 +191,19 @@ export function updateBatchUserRoles(data) {
   })
 }
 
-export function getAllNotVoiceList(query) {
+export function getAllNotVoiceList(data) {
   return request({
     url: '/company/CompanyUserAll/getAllNotVoiceList',
-    method: 'get',
-    params: query
+    method: 'post',
+    data: data
   })
 }
 
-export function getAllVoiceList(query) {
+export function getAllVoiceList(data) {
   return request({
     url: '/company/CompanyUserAll/getAllVoiceList' ,
-    method: 'get',
-    params: query
+    method: 'post',
+    data: data
   })
 }
 

+ 10 - 1
src/api/qw/qwIpadServer.js

@@ -9,6 +9,15 @@ export function listQwIpadServer(query) {
   })
 }
 
+//查询ipad服务器列表 去重版
+export function listDisQwIpadServer(query) {
+  return request({
+    url: '/qw/qwIpadServer/disList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询ipad服务器详细
 export function getQwIpadServer(id) {
   return request({
@@ -59,4 +68,4 @@ export function release(data) {
     method: 'post',
     data: data
   })
-}
+}

+ 9 - 7
src/views/company/companyUser/indexAll.vue

@@ -204,6 +204,8 @@
             <template slot-scope="scope">
               <el-tag
                 :type="scope.row.isRecordVoiceSeat === 1 ? 'success' : 'info'">{{scope.row.isRecordVoiceSeat === 1 ? '是' : '否' }}</el-tag>
+              <br>
+              已录次数({{scope.row.times}})
             </template>
           </el-table-column>
           <el-table-column label="是否单独注册会员" align="center" prop="isNeedRegisterMember" width="80px">
@@ -678,16 +680,16 @@
 
     <!-- 语音席位转接弹窗 -->
     <el-dialog title="语音席位转接" :visible.sync="voiceTransfer.open" width="800px" append-to-body>
-      <el-form ref="voiceTransferForm" :model="voiceTransfer" :rules="voiceTransferRules" label-width="100px">
+      <el-form ref="voiceTransferForm" :model="voiceTransfer" :rules="voiceTransferRules" label-width="120px">
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="被转接员工" prop="companyUserIdOld">
+            <el-form-item label="被转接员工(编号)" prop="companyUserIdOld">
               <el-select
                 v-model="voiceTransfer.companyUserIdOld"
                 filterable
                 remote
                 reserve-keyword
-                placeholder="请输入被转接员工"
+                placeholder="请输入被转接员工(编号)"
                 :remote-method="searchOldEmployee"
                 :loading="voiceTransfer.oldLoading"
                 clearable
@@ -705,13 +707,13 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="转接员工" prop="companyUserIdNew">
+            <el-form-item label="转接员工(编号)" prop="companyUserIdNew">
               <el-select
                 v-model="voiceTransfer.companyUserIdNew"
                 filterable
                 remote
                 reserve-keyword
-                placeholder="请输入转接员工"
+                placeholder="请输入转接员工(编号)"
                 :remote-method="searchNewEmployee"
                 :loading="voiceTransfer.newLoading"
                 clearable
@@ -1823,7 +1825,7 @@ export default {
     /** 初始化被转接员工列表 */
     initOldEmployeeList() {
       this.voiceTransfer.oldLoading = true;
-      getAllVoiceList({ companyUserId: '', pageNum: 1, pageSize: 10 }).then(res => {
+      getAllVoiceList({ companyUserId: null, pageNum: 1, pageSize: 10 }).then(res => {
         this.voiceTransfer.oldOptions = res.rows || res.data || [];
         this.voiceTransfer.oldLoading = false;
       }).catch(() => {
@@ -1833,7 +1835,7 @@ export default {
     /** 初始化转接员工列表 */
     initNewEmployeeList() {
       this.voiceTransfer.newLoading = true;
-      getAllNotVoiceList({ companyUserId: '', pageNum: 1, pageSize: 10 }).then(res => {
+      getAllNotVoiceList({ companyUserId: null, pageNum: 1, pageSize: 10 }).then(res => {
         this.voiceTransfer.newOptions = res.rows || res.data || [];
         this.voiceTransfer.newLoading = false;
       }).catch(() => {

+ 289 - 14
src/views/qw/qwCompany/index.vue

@@ -81,6 +81,17 @@
           v-hasPermi="['qw:qwCompany:export']"
         >导出</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-s-grid"
+          size="mini"
+          :disabled="single"
+          @click="handleSelectArea"
+          v-hasPermi="['qw:qwCompany:edit']"
+        >选择区域</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -96,6 +107,11 @@
           </div>
         </template>
       </el-table-column>
+      <el-table-column label="关联区域" align="center" prop="addressBindIp">
+        <template slot-scope="scope">
+          <span v-if="scope.row.addressBindIp">{{ getAddressLabels(scope.row.addressBindIp) }}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">
           <dict-tag :options="statusOptions" :value="scope.row.status"/>
@@ -221,6 +237,17 @@
           </el-select>
 
 
+        </el-form-item>
+        <el-form-item label="关联区域" prop="addressBindIp">
+          <el-select filterable v-model="form.addressIds" multiple placeholder="请选择区域" clearable style="width: 50%;">
+            <el-option
+              v-for="item in availableAddressList"
+              :key="item.ip"
+              :label="item.title +(item.ip)"
+              :value="item.ip"
+              :disabled="item.disabled"
+            />
+          </el-select>
         </el-form-item>
         <el-form-item label="状态">
           <el-radio-group v-model="form.status">
@@ -237,13 +264,45 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 选择区域弹窗 -->
+    <el-dialog :title="areaDialogTitle" :visible.sync="areaDialogVisible" width="800px" append-to-body>
+      <el-form :inline="true">
+        <el-form-item label="筛选区域">
+          <el-input v-model="areaFilter" placeholder="输入区域名称筛选" clearable size="small" style="width: 200px;" />
+        </el-form-item>
+      </el-form>
+      <el-table
+        :data="filteredAddressList"
+        @selection-change="handleAreaSelectionChange"
+        ref="areaTable"
+        max-height="400"
+      >
+        <el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" />
+        <el-table-column label="区域IP" align="center" prop="ip" />
+        <el-table-column label="标题" align="center" prop="title" />
+        <el-table-column label="地址ID" align="center" prop="addressId" />
+        <el-table-column label="状态" align="center" prop="status">
+          <template slot-scope="scope">
+            <el-tag v-if="boundAddrIds.indexOf(scope.row.ip) > -1" type="danger">已被其他主体绑定</el-tag>
+            <el-tag v-else-if="currentAreaSelection.indexOf(scope.row.ip) > -1" type="success">当前选中</el-tag>
+            <el-tag v-else type="info">未绑定</el-tag>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitAreaSelection">确 定</el-button>
+        <el-button @click="areaDialogVisible = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listQwCompany, getQwCompany, delQwCompany, addQwCompany, updateQwCompany, exportQwCompany } from "@/api/qw/qwCompany";
+import { listQwCompany, getQwCompany, delQwCompany, addQwCompany, updateQwCompany, exportQwCompany, allCorp } from "@/api/qw/qwCompany";
 import { getCompanyList } from "@/api/company/company";
 import { listAll } from '@/api/course/coursePlaySourceConfig'
+import { listDisQwIpadServer } from '@/api/qw/qwIpadServer'
 export default {
   name: "QwCompany",
   watch: {
@@ -312,6 +371,15 @@ export default {
       maAppList:[],
       miniAppList:[],
       customAppList:[],
+      // 区域选择相关
+      areaDialogVisible: false,
+      areaDialogTitle: "",
+      areaList: [],
+      areaFilter: "",
+      currentAreaSelection: [],
+      currentCompanyForArea: null,
+      boundAddrIds: [],
+      currentAddrIdsForForm: [],
       // 表单校验
       rules: {
         corpId: [{ required: true, message: '请输入企业CorpID', trigger: 'blur' }],
@@ -330,6 +398,10 @@ export default {
         this.companys = response.data;
 
     });
+    // 加载区域列表用于表格展示
+    listDisQwIpadServer({ pageNum: 1, pageSize: 9999 }).then(response => {
+      this.areaList = this.normalizeAreaData(response.rows || response.data || []);
+    });
   },
   methods: {
     /** 查询企微主体列表 */
@@ -365,6 +437,7 @@ export default {
         chatToolbar: null,
         chatToolbarOauth: null,
         companyIds: null,
+        addressIds: [],
         status: 0,
         createTime: null,
         updateTime: null,
@@ -416,7 +489,9 @@ export default {
     handleAdd() {
       this.reset();
       this.getAppList()
-      this.open = true;
+      this.loadAddressListForForm(null).then(() => {
+        this.open = true;
+      });
       this.form.token="1o62d3YxvdHd4LEUiltnu7sK";
       this.form.encodingAesKey="UJfTQ5qKTKlegjkXtp1YuzJzxeHlUKvq5GyFbERN1iU";
       this.title = "添加企微主体";
@@ -429,7 +504,10 @@ export default {
       getQwCompany(id).then(response => {
         this.form = response.data;
         this.form.companyIds=((this.form.companyIds).split(",")).map(Number)
-        this.open = true;
+        this.$set(this.form, 'addressIds', this.form.addressBindIp ? this.form.addressBindIp.split(",") : []);
+        this.loadAddressListForForm(this.form.corpId).then(() => {
+          this.open = true;
+        });
         this.title = "修改企微主体";
       });
     },
@@ -437,20 +515,49 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          console.log(this.form.companyIds)
+
            this.form.companyIds = (this.form.companyIds).join(',');
-          if (this.form.id != null) {
-            updateQwCompany(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
+           if (this.form.addressIds && this.form.addressIds.length > 0) {
+             this.form.addressBindIp = this.form.addressIds.join(',');
+           } else {
+             this.form.addressBindIp = '';
+           }
+          // 提交前校验ip唯一性
+          const doSubmit = () => {
+            if (this.form.id != null) {
+              updateQwCompany(this.form).then(response => {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addQwCompany(this.form).then(response => {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          };
+          if (this.form.addressIds && this.form.addressIds.length > 0) {
+            allCorp().then(corpRes => {
+              const allCorps = corpRes.data || [];
+              const boundIps = [];
+              allCorps.forEach(corp => {
+                if (corp.corpId !== this.form.corpId && corp.addressBindIp) {
+                  corp.addressBindIp.split(",").forEach(id => {
+                    if (id && boundIps.indexOf(id) === -1) boundIps.push(id);
+                  });
+                }
+              });
+              const conflictIps = this.form.addressIds.filter(ip => boundIps.indexOf(ip) > -1);
+              if (conflictIps.length > 0) {
+                this.$message.error("以下IP已被其他主体绑定,不能重复绑定:" + conflictIps.join(", "));
+                return;
+              }
+              doSubmit();
             });
           } else {
-            addQwCompany(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+            doSubmit();
           }
         }
       });
@@ -483,6 +590,174 @@ export default {
           this.download(response.msg);
           this.exportLoading = false;
         }).catch(() => {});
+    },
+    /** 加载表单中可选区域列表 */
+    loadAddressListForForm(currentCompanyId) {
+      return Promise.all([
+        listDisQwIpadServer({ pageNum: 1, pageSize: 9999 }),
+        allCorp()
+      ]).then(([serverRes, corpRes]) => {
+        this.areaList = this.normalizeAreaData(serverRes.rows || serverRes.data || []);
+        const allCorps = corpRes.data || [];
+        this.boundAddrIds = [];
+        this.currentAddrIdsForForm = currentCompanyId
+          ? ((allCorps.find(c => c.corpId === currentCompanyId) || {}).addressBindIp || "").split(",").filter(Boolean)
+          : [];
+        allCorps.forEach(corp => {
+          if (corp.corpId !== currentCompanyId && corp.addressBindIp) {
+            const ids = corp.addressBindIp.split(",");
+            ids.forEach(id => {
+              if (id && this.boundAddrIds.indexOf(id) === -1) {
+                this.boundAddrIds.push(id);
+              }
+            });
+          }
+        });
+      });
+    },
+    /** 打开选择区域弹窗 */
+    handleSelectArea() {
+      const ids = this.ids;
+      if (!ids || ids.length === 0) {
+        this.$message.warning("请先选择一条企微主体记录");
+        return;
+      }
+      const currentRow = this.qwCompanyList.find(item => item.id === ids[0]);
+      if (!currentRow) {
+        return;
+      }
+      this.currentCompanyForArea = currentRow;
+      this.areaDialogTitle = "选择区域 - " + currentRow.corpName;
+      this.currentAreaSelection = currentRow.addressBindIp ? currentRow.addressBindIp.split(",") : [];
+      const preSelectedIps = [...this.currentAreaSelection];
+      this.areaFilter = "";
+
+      // 加载区域列表和已绑定的addressId
+      Promise.all([
+        listDisQwIpadServer({ pageNum: 1, pageSize: 9999 }),
+        allCorp()
+      ]).then(([serverRes, corpRes]) => {
+        this.areaList = this.normalizeAreaData(serverRes.rows || serverRes.data || []);
+        const allCorps = corpRes.data || [];
+        // 收集所有已被其他主体绑定的addressId(排除当前主体)
+        this.boundAddrIds = [];
+        allCorps.forEach(corp => {
+          if (corp.corpId !== currentRow.corpId && corp.addressBindIp) {
+            const ids = corp.addressBindIp.split(",");
+            ids.forEach(id => {
+              if (id && this.boundAddrIds.indexOf(id) === -1) {
+                this.boundAddrIds.push(id);
+              }
+            });
+          }
+        });
+        this.areaDialogVisible = true;
+        // 在表格中回显已选中的行(延时确保表格渲染完毕)
+        this.$nextTick(() => {
+          setTimeout(() => {
+            if (this.$refs.areaTable) {
+              this.areaList.forEach(row => {
+                if (preSelectedIps.indexOf(row.ip) > -1 && this.boundAddrIds.indexOf(row.ip) === -1) {
+                  this.$refs.areaTable.toggleRowSelection(row, true);
+                }
+              });
+            }
+          }, 100);
+        });
+      });
+    },
+    /** 区域表格多选变化 */
+    handleAreaSelectionChange(selection) {
+      // 当前可以被选中的(排除已被其他主体绑定的)
+      const validSelection = selection.filter(row => this.boundAddrIds.indexOf(row.ip) === -1);
+      this.currentAreaSelection = validSelection.map(row => row.ip);
+    },
+    /** 控制行是否可选(已被其他主体绑定的不可选) */
+    checkSelectable(row) {
+      return this.boundAddrIds.indexOf(row.ip) === -1;
+    },
+    /** 提交区域选择 */
+    submitAreaSelection() {
+      if (!this.currentCompanyForArea) {
+        return;
+      }
+      // 提交前实时校验:保证选中的ip没有被其他主体绑定
+      allCorp().then(corpRes => {
+        const allCorps = corpRes.data || [];
+        const boundIps = [];
+        allCorps.forEach(corp => {
+          if (corp.corpId !== this.currentCompanyForArea.corpId && corp.addressBindIp) {
+            corp.addressBindIp.split(",").forEach(id => {
+              if (id && boundIps.indexOf(id) === -1) boundIps.push(id);
+            });
+          }
+        });
+        const conflictIps = this.currentAreaSelection.filter(ip => boundIps.indexOf(ip) > -1);
+        if (conflictIps.length > 0) {
+          this.$message.error("以下IP已被其他主体绑定,不能重复绑定:" + conflictIps.join(", "));
+          return;
+        }
+        const addressBindIp = this.currentAreaSelection.join(",");
+        const data = {
+          id: this.currentCompanyForArea.id,
+          addressBindIp: addressBindIp
+        };
+        updateQwCompany(data).then(() => {
+          this.msgSuccess("区域选择成功");
+          this.areaDialogVisible = false;
+          this.getList();
+        });
+      });
+    },
+    /** 统一区域数据格式(兼容字符串数组和对象数组) */
+    normalizeAreaData(data) {
+      return (data || []).map(item => {
+        if (typeof item === 'string') {
+          return { ip: item, title: '', addressId: '' };
+        }
+        return item;
+      });
+    },
+    getAddressLabels(addressIdStr) {
+      if (!addressIdStr || !this.areaList.length) {
+        return addressIdStr || "";
+      }
+      const ids = addressIdStr.split(",");
+      return ids.map(id => {
+        const item = this.areaList.find(a => a.ip === id);
+        return item ? (item.ip || id) : id;
+      }).join("、");
+    }
+  },
+  computed: {
+    /** 筛选后的区域列表 */
+    filteredAddressList() {
+      if (!this.areaFilter) {
+        return this.areaList;
+      }
+      const filter = this.areaFilter.toLowerCase();
+      return this.areaList.filter(item =>
+        (item.ip && item.ip.toLowerCase().indexOf(filter) > -1) ||
+        (item.title && item.title.toLowerCase().indexOf(filter) > -1) ||
+        (item.addressId && item.addressId.toLowerCase().indexOf(filter) > -1)
+      );
+    },
+    /** 表单中可选区域列表(排除已被其他主体绑定的) */
+    availableAddressList() {
+      if (!this.areaList.length) {
+        return [];
+      }
+      const currentFormCorpId = this.form.corpId;
+      const result = this.areaList.map(item => {
+        const isBoundToOther = this.boundAddrIds.indexOf(item.ip) > -1;
+        // 编辑时,当前主体已绑定的地址应该可选
+        const isCurrentOwn = currentFormCorpId && this.currentAddrIdsForForm && this.currentAddrIdsForForm.indexOf(item.ip) > -1;
+        return {
+          ...item,
+          disabled: isBoundToOther && !isCurrentOwn
+        };
+      });
+      return result;
     }
   }
 };