|
|
@@ -303,8 +303,14 @@
|
|
|
注:-1表示不做限制
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="坐席数量" prop="voiceCallerNumber">
|
|
|
- <el-input-number v-model="form.voiceCallerNumber" :min="0" :max="10000"></el-input-number>
|
|
|
+ <el-form-item label="sip分机号" prop="sipExtNumIds">
|
|
|
+ <div v-if="!form.sipExtNumIds || form.sipExtNumIds === ''">
|
|
|
+ <el-button type="primary" size="small" icon="el-icon-plus" @click="handleAddSipExtNum">添加分机号</el-button>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <el-button type="primary" size="small" icon="el-icon-view" @click="handleViewSipExtNum">查看分机</el-button>
|
|
|
+ <span style="margin-left: 10px; color: #909399;">{{ getSipExtNumDisplay() }}</span>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="管理员帐号" prop="userName" v-if="form.companyId==null">
|
|
|
<el-input v-model="form.userName" placeholder="请输入管理员帐号"/>
|
|
|
@@ -358,21 +364,6 @@
|
|
|
</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="通话API接口" prop="voiceApiId">
|
|
|
- <el-select
|
|
|
- v-model="form.voiceApiId"
|
|
|
- placeholder="请选择"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in voiceApis"
|
|
|
- :key="item.apiId"
|
|
|
- :label="item.apiName"
|
|
|
- :value="item.apiId"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="开始时间" prop="startTime">
|
|
|
<el-date-picker clearable size="small"
|
|
|
v-model="form.startTime"
|
|
|
@@ -462,23 +453,11 @@
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注"/>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="可用外呼网关" prop="showGatewayIds">
|
|
|
- <!-- <el-input v-model="" placeholder="请输入DeepSeekChat模型名称"></el-input> -->
|
|
|
- <el-select v-model="form.showGatewayIds" multiple filterable placeholder="请选择系统可见外呼网关">
|
|
|
- <el-option
|
|
|
- v-for="item in gatewayList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.gwDesc"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm" :loading="submitFormLoading">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -622,7 +601,7 @@
|
|
|
<div v-for="(account, index) in revenueForm.acctInfos" :key="index"
|
|
|
style="border: 1px solid #dcdfe6; padding: 20px; margin-bottom: 20px; border-radius: 4px;"
|
|
|
>
|
|
|
- <div style="display: flex; justify-content: between; align-items: center; margin-bottom: 15px;">
|
|
|
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
|
|
|
<div style="margin: 0; color: #409eff;">账户 {{ index + 1 }}</div>
|
|
|
<el-button
|
|
|
type="danger"
|
|
|
@@ -705,6 +684,152 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- SIP分机号选择对话框 -->
|
|
|
+ <el-dialog title="选择SIP分机号" :visible.sync="sipExtDialog.open" width="900px" append-to-body>
|
|
|
+ <el-form :model="sipExtDialog.queryParams" ref="sipExtQueryForm" :inline="true" label-width="100px">
|
|
|
+ <el-form-item label="分机号起始" prop="startExtNum">
|
|
|
+ <el-input
|
|
|
+ v-model="sipExtDialog.queryParams.startExtNum"
|
|
|
+ placeholder="请输入起始分机号"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="getSipExtList"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="分机号结束" prop="endExtNum">
|
|
|
+ <el-input
|
|
|
+ v-model="sipExtDialog.queryParams.endExtNum"
|
|
|
+ placeholder="请输入结束分机号"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="getSipExtList"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="getSipExtList">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetSipExtQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ v-loading="sipExtDialog.loading"
|
|
|
+ :data="sipExtDialog.extList"
|
|
|
+ @selection-change="handleSipExtSelectionChange"
|
|
|
+ height="400"
|
|
|
+ border
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="序号" type="index" width="60" align="center" />
|
|
|
+ <el-table-column label="分机号" align="center" prop="extNum" />
|
|
|
+ <el-table-column label="状态" align="center" prop="status">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="'success'" size="small">
|
|
|
+ 空闲
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div v-if="sipExtDialog.selectedExts.length > 0" style="margin-top: 10px; text-align: center; color: #409EFF; font-size: 14px;">
|
|
|
+ 已选中 {{ sipExtDialog.selectedExts.length }} 条数据
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="sipExtDialog.total > 0"
|
|
|
+ :total="sipExtDialog.total"
|
|
|
+ :page.sync="sipExtDialog.queryParams.pageNum"
|
|
|
+ :limit.sync="sipExtDialog.queryParams.pageSize"
|
|
|
+ :page-sizes="[10, 100, 500]"
|
|
|
+ @pagination="getSipExtList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="confirmSipExtSelection">确 定</el-button>
|
|
|
+ <el-button @click="sipExtDialog.open = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 查看已选SIP分机号对话框 -->
|
|
|
+ <el-dialog title="已选SIP分机号" :visible.sync="sipExtViewDialog.open" width="900px" append-to-body>
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <el-form :model="sipExtViewDialog.queryParams" ref="sipExtViewQueryForm" :inline="true" label-width="100px" style="margin-bottom: 10px;">
|
|
|
+ <el-form-item label="分机号" prop="extNum">
|
|
|
+ <el-input
|
|
|
+ v-model="sipExtViewDialog.queryParams.extNum"
|
|
|
+ placeholder="请输入分机号"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleSipExtViewSearch"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="销售名称" prop="userName">
|
|
|
+ <el-input
|
|
|
+ v-model="sipExtViewDialog.queryParams.userName"
|
|
|
+ placeholder="请输入销售名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleSipExtViewSearch"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSipExtViewSearch">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetSipExtViewQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-table v-loading="sipExtViewDialog.loading" :data="sipExtViewDialog.pagedExtList" height="400" border @selection-change="handleSipExtViewSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="序号" type="index" width="60" align="center" />
|
|
|
+ <el-table-column label="分机号" align="center" prop="extNum" />
|
|
|
+ <el-table-column label="分机密码" align="center" prop="extPass">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span @click="togglePasswordVisibility(scope.$index)" style="cursor: pointer; user-select: none;">
|
|
|
+ <i :class="scope.row.showPassword ? 'el-icon-view' : 'el-icon-lock'"></i>
|
|
|
+ {{ scope.row.showPassword ? scope.row.extPass : '******' }}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态" align="center" prop="userCode">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="scope.row.userCode ? 'danger' : 'success'" size="small">
|
|
|
+ {{ scope.row.userCode ? '占用' : '空闲' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="绑定销售" align="center" prop="userCode" />
|
|
|
+ <el-table-column label="操作" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-unlock"
|
|
|
+ @click="handleUnbindSipExt(scope.row)"
|
|
|
+ >解绑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="sipExtViewDialog.total > 0"
|
|
|
+ :total="sipExtViewDialog.total"
|
|
|
+ :page.sync="sipExtViewDialog.pageNum"
|
|
|
+ :limit.sync="sipExtViewDialog.pageSize"
|
|
|
+ :page-sizes="[10, 100, 500]"
|
|
|
+ @pagination="handleSipExtViewPageChange"
|
|
|
+ />
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" @click="handleAppendSipExt">添加分机号</el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-unlock"
|
|
|
+ :disabled="sipExtViewDialog.selectedExts.length === 0"
|
|
|
+ @click="handleBatchUnbindSipExt"
|
|
|
+ >批量解绑({{ sipExtViewDialog.selectedExts.length }})</el-button>
|
|
|
+ <el-button @click="sipExtViewDialog.open = false">关 闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -728,12 +853,10 @@ import {
|
|
|
} from '@/api/his/company'
|
|
|
import { getFollowDoctorList } from '@/api/his/doctor'
|
|
|
import { docList } from '@/api/his/doctor'
|
|
|
-import { getVoiceApiList } from '@/api/company/companyVoiceApi'
|
|
|
-import { getCitysArea } from '../../../api/company/company'
|
|
|
import { cateList } from '@/api/his/packageCate'
|
|
|
-import { getConfigByKey } from '@/api/system/config'
|
|
|
import { listDept } from '@/api/system/dept'
|
|
|
import { listAll } from '@/api/course/coursePlaySourceConfig'
|
|
|
+import { companyBatchUnbindSipExt, getSipExtDetail, getUnBindExtnumPage } from '@/api/aiSipCall/aiSipCallUser'
|
|
|
|
|
|
export default {
|
|
|
name: 'Company',
|
|
|
@@ -803,7 +926,6 @@ export default {
|
|
|
limitUserCount: null,
|
|
|
maxPadNum: -1
|
|
|
},
|
|
|
- voiceApis: [],
|
|
|
// 表单参数
|
|
|
rechargeForm: {
|
|
|
money: 0
|
|
|
@@ -821,7 +943,8 @@ export default {
|
|
|
courseMaAppId: null,
|
|
|
courseMiniAppId: null,
|
|
|
miniAppMaster: [],
|
|
|
- miniAppList: []
|
|
|
+ miniAppList: [],
|
|
|
+ sipExtNumIds: null
|
|
|
},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
@@ -915,6 +1038,38 @@ export default {
|
|
|
title: '批量修改小程序'
|
|
|
},
|
|
|
gatewayList:[],
|
|
|
+ // SIP分机号选择对话框
|
|
|
+ sipExtDialog: {
|
|
|
+ open: false,
|
|
|
+ loading: false,
|
|
|
+ extList: [],
|
|
|
+ total: 0,
|
|
|
+ selectedExts: [],
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ startExtNum: null,
|
|
|
+ endExtNum: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 查看已选SIP分机号对话框
|
|
|
+ sipExtViewDialog: {
|
|
|
+ open: false,
|
|
|
+ extList: [],
|
|
|
+ pagedExtList: [],
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 0,
|
|
|
+ loading: false,
|
|
|
+ selectedExts: [],
|
|
|
+ queryParams: {
|
|
|
+ extNum: null,
|
|
|
+ userName: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 原始sipExtNumIds值(用于比较新旧值)
|
|
|
+ originalSipExtNumIds: null,
|
|
|
+ submitFormLoading:false,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -925,9 +1080,6 @@ export default {
|
|
|
this.getDicts('sys_company_type').then(response => {
|
|
|
this.companyTypeOptions = response.data
|
|
|
})
|
|
|
- getVoiceApiList().then((response) => {
|
|
|
- this.voiceApis = response.data
|
|
|
- })
|
|
|
getFollowDoctorList().then((response) => {
|
|
|
this.followDoctorList = response.rows
|
|
|
})
|
|
|
@@ -947,10 +1099,6 @@ export default {
|
|
|
docList().then(response => {
|
|
|
this.doctor = response.rows
|
|
|
})
|
|
|
- getGatewayCompanyList().then(res=>{
|
|
|
- this.gatewayList = res.data;
|
|
|
- console.log(this.gatewayList);
|
|
|
- }).catch(res=>{});
|
|
|
},
|
|
|
methods: {
|
|
|
// 添加分账账户
|
|
|
@@ -1237,6 +1385,13 @@ export default {
|
|
|
} else {
|
|
|
this.form.miniAppMaster = []
|
|
|
}
|
|
|
+
|
|
|
+ // 保存原始的sipExtNumIds值(确保有值时才赋值)
|
|
|
+ if (this.form.sipExtNumIds && this.form.sipExtNumIds !== '') {
|
|
|
+ this.originalSipExtNumIds = this.form.sipExtNumIds;
|
|
|
+ } else {
|
|
|
+ this.originalSipExtNumIds = null;
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
getAppList(companyId) {
|
|
|
@@ -1264,45 +1419,65 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ // 创建提交数据的副本,避免修改原始表单数据
|
|
|
+ const submitData = { ...this.form };
|
|
|
|
|
|
- if (this.form.followDoctorIds == null || this.form.followDoctorIds.length == 0) {
|
|
|
- this.form.followDoctorIds = null
|
|
|
- }
|
|
|
+ // 添加原始sipExtNumIds值到提交数据中
|
|
|
+ submitData.originalSipExtNumIds = this.originalSipExtNumIds;
|
|
|
|
|
|
- if (this.form.followDoctorIds != null && this.form.followDoctorIds.length > 0) {
|
|
|
- this.form.followDoctorIds = JSON.stringify(this.form.followDoctorIds)
|
|
|
+ // 处理随访医生
|
|
|
+ if(submitData.followDoctorIds != null){
|
|
|
+ submitData.followDoctorIds = JSON.stringify(submitData.followDoctorIds);
|
|
|
}
|
|
|
|
|
|
- if (this.form.packageCateIds != null) {
|
|
|
- this.form.packageCateIds = JSON.stringify(this.form.packageCateIds)
|
|
|
+ // 处理套餐包分类
|
|
|
+ if(submitData.packageCateIds != null){
|
|
|
+ submitData.packageCateIds = JSON.stringify(submitData.packageCateIds);
|
|
|
}
|
|
|
- if (this.doctorIds != null) {
|
|
|
- this.form.doctorIds = (this.doctorIds).toString()
|
|
|
+
|
|
|
+ // ✅ 修复:正确处理处方医生IDs - 不修改原始表单数据
|
|
|
+ if(this.form.prescribeDoctorIds != null && this.form.prescribeDoctorIds.length > 0){
|
|
|
+ // 直接使用前端显示的数组值,转换为后端需要的格式
|
|
|
+ submitData.prescribeDoctorIds = this.form.prescribeDoctorIds.join(',')
|
|
|
+ } else {
|
|
|
+ submitData.prescribeDoctorIds = ''
|
|
|
}
|
|
|
- if (this.doctorIds != null) {
|
|
|
- this.form.doctorIds = (this.doctorIds).toString()
|
|
|
+ // 从组件 data 读取医生选择 (v-model 绑定的是 doctorIds)
|
|
|
+ if (this.doctorIds && this.doctorIds.length > 0) {
|
|
|
+ submitData.doctorIds = this.doctorIds.join(',')
|
|
|
+ } else {
|
|
|
+ submitData.doctorIds = ''
|
|
|
}
|
|
|
|
|
|
- if (this.form.miniAppMaster == null || this.form.miniAppMaster.length === 0) {
|
|
|
- this.form.miniAppMaster = null
|
|
|
+ // 处理sipExtNumIds字段:如果不为空,进行从小到大排序后再组成字符串
|
|
|
+ if (submitData.sipExtNumIds && submitData.sipExtNumIds !== '') {
|
|
|
+ // 将逗号分隔的字符串拆分为数组
|
|
|
+ const extNumArray = submitData.sipExtNumIds.split(',').filter(id => id.trim() !== '');
|
|
|
+ // 转换为数字并排序(从小到大)
|
|
|
+ const sortedExtNums = extNumArray.map(Number).sort((a, b) => a - b);
|
|
|
+ // 重新组合为字符串
|
|
|
+ submitData.sipExtNumIds = sortedExtNums.join(',');
|
|
|
}
|
|
|
|
|
|
- if (this.form.companyId != null) {
|
|
|
- /* if(this.form.maxPadNum < this.form.usedNum && this.form.maxPadNum !== -1){
|
|
|
- this.msgError("最大Pad数不能小于已使用Pad数,当前已使用"+this.form.usedNum)
|
|
|
- return;
|
|
|
- } */
|
|
|
- updateCompany(this.form).then(response => {
|
|
|
- this.msgSuccess('修改成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
+ this.submitFormLoading = true;
|
|
|
+ if (submitData.companyId != null) {
|
|
|
+ updateCompany(submitData).then(response => {
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ }).catch(res=>{
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ });
|
|
|
} else {
|
|
|
- addCompany(this.form).then(response => {
|
|
|
- this.msgSuccess('新增成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
+ addCompany(submitData).then(response => {
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ }).catch(res=>{
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -1370,6 +1545,282 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ /** 添加SIP分机号 */
|
|
|
+ handleAddSipExtNum() {
|
|
|
+ this.sipExtDialog.selectedExts = [];
|
|
|
+ this.sipExtDialog.queryParams = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ startExtNum: null,
|
|
|
+ endExtNum: null
|
|
|
+ };
|
|
|
+ this.sipExtDialog.open = true;
|
|
|
+ this.getSipExtList();
|
|
|
+ },
|
|
|
+ /** 获取SIP分机号列表 */
|
|
|
+ getSipExtList() {
|
|
|
+ this.sipExtDialog.loading = true;
|
|
|
+ getUnBindExtnumPage(this.sipExtDialog.queryParams).then(response => {
|
|
|
+ this.sipExtDialog.extList = response.rows || [];
|
|
|
+ this.sipExtDialog.total = response.total || 0;
|
|
|
+ this.sipExtDialog.loading = false;
|
|
|
+ }).catch(() => {
|
|
|
+ this.sipExtDialog.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 查看已选SIP分机号 */
|
|
|
+ handleViewSipExtNum() {
|
|
|
+ if (!this.form.sipExtNumIds || this.form.sipExtNumIds === '') {
|
|
|
+ this.$message.warning('暂无已选分机号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const extIds = this.form.sipExtNumIds.split(',').filter(id => id);
|
|
|
+ // 保存所有分机号ID
|
|
|
+ this.sipExtViewDialog.extList = extIds;
|
|
|
+ // 设置总数
|
|
|
+ this.sipExtViewDialog.total = extIds.length;
|
|
|
+ // 重置页码
|
|
|
+ this.sipExtViewDialog.pageNum = 1;
|
|
|
+ this.sipExtViewDialog.open = true;
|
|
|
+ // 加载第一页数据
|
|
|
+ this.loadSipExtDetailPage();
|
|
|
+ },
|
|
|
+ /** 加载当前页的分机号详细信息 */
|
|
|
+ loadSipExtDetailPage() {
|
|
|
+ if (!this.sipExtViewDialog.extList || this.sipExtViewDialog.extList.length === 0) {
|
|
|
+ this.sipExtViewDialog.pagedExtList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.sipExtViewDialog.loading = true;
|
|
|
+
|
|
|
+ // 如果userName有值,则传入所有分机号;否则只传入当前页的分机号
|
|
|
+ let extNumIds;
|
|
|
+ if (this.sipExtViewDialog.queryParams.userName) {
|
|
|
+ // 将所有分机号字符串数组转换为Long数组
|
|
|
+ extNumIds = this.sipExtViewDialog.extList.map(extNum => Number(extNum));
|
|
|
+ } else {
|
|
|
+ // 计算当前页的分机号
|
|
|
+ const start = (this.sipExtViewDialog.pageNum - 1) * this.sipExtViewDialog.pageSize;
|
|
|
+ const end = start + this.sipExtViewDialog.pageSize;
|
|
|
+ const currentPageExts = this.sipExtViewDialog.extList.slice(start, end);
|
|
|
+ // 将分机号字符串数组转换为Long数组
|
|
|
+ extNumIds = currentPageExts.map(extNum => Number(extNum));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建请求参数对象
|
|
|
+ const params = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 100,
|
|
|
+ sipExtNumList: extNumIds,
|
|
|
+ userCode:this.sipExtViewDialog.queryParams.userName,
|
|
|
+ extNum: this.sipExtViewDialog.queryParams.extNum
|
|
|
+ };
|
|
|
+
|
|
|
+ // 调用后端接口获取详细信息
|
|
|
+ getSipExtDetail(params).then(response => {
|
|
|
+ if (response.code === 0) {
|
|
|
+ this.sipExtViewDialog.pagedExtList = response.rows || [];
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '获取分机号详细信息失败');
|
|
|
+ this.sipExtViewDialog.pagedExtList = [];
|
|
|
+ }
|
|
|
+ this.sipExtViewDialog.loading = false;
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('获取分机号详细信息失败:', error);
|
|
|
+ this.$message.error('获取分机号详细信息失败');
|
|
|
+ this.sipExtViewDialog.pagedExtList = [];
|
|
|
+ this.sipExtViewDialog.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 获取SIP分机号显示文本 */
|
|
|
+ getSipExtNumDisplay() {
|
|
|
+ if (!this.form.sipExtNumIds || this.form.sipExtNumIds === '') {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ const exts = this.form.sipExtNumIds.split(',');
|
|
|
+ if (exts.length <= 5) {
|
|
|
+ return exts.join(', ');
|
|
|
+ }
|
|
|
+ return exts.slice(0, 5).join(', ') + `...等${exts.length}个`;
|
|
|
+ },
|
|
|
+ /** 重置SIP分机号查询 */
|
|
|
+ resetSipExtQuery() {
|
|
|
+ this.sipExtDialog.queryParams = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ startExtNum: null,
|
|
|
+ endExtNum: null
|
|
|
+ };
|
|
|
+ this.getSipExtList();
|
|
|
+ },
|
|
|
+ /** SIP分机号选择变化 */
|
|
|
+ handleSipExtSelectionChange(selection) {
|
|
|
+ this.sipExtDialog.selectedExts = selection.map(item => item.extNum);
|
|
|
+ },
|
|
|
+ /** 确认选择SIP分机号 */
|
|
|
+ confirmSipExtSelection() {
|
|
|
+ if (this.sipExtDialog.selectedExts.length === 0) {
|
|
|
+ this.$message.warning('请至少选择一个分机号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果是从查看对话框过来的,需要追加
|
|
|
+ if (this.form.sipExtNumIds && this.form.sipExtNumIds !== '') {
|
|
|
+ const existingExts = this.form.sipExtNumIds.split(',').filter(id => id);
|
|
|
+ const newExts = [...new Set([...existingExts, ...this.sipExtDialog.selectedExts])];
|
|
|
+ this.form.sipExtNumIds = newExts.join(',');
|
|
|
+ } else {
|
|
|
+ this.form.sipExtNumIds = this.sipExtDialog.selectedExts.join(',');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.sipExtDialog.open = false;
|
|
|
+ this.$message.success(`已选择${this.sipExtDialog.selectedExts.length}个分机号`);
|
|
|
+ },
|
|
|
+ /** 搜索已选分机号 */
|
|
|
+ handleSipExtViewSearch() {
|
|
|
+ // 重置页码
|
|
|
+ this.sipExtViewDialog.pageNum = 1;
|
|
|
+ // 重新加载数据
|
|
|
+ this.loadSipExtDetailPage();
|
|
|
+ },
|
|
|
+ /** 重置已选分机号查询 */
|
|
|
+ resetSipExtViewQuery() {
|
|
|
+ this.sipExtViewDialog.queryParams = {
|
|
|
+ extNum: null,
|
|
|
+ userName: null
|
|
|
+ };
|
|
|
+ this.sipExtViewDialog.pageNum = 1;
|
|
|
+ this.loadSipExtDetailPage();
|
|
|
+ },
|
|
|
+ /** SIP分机号查看对话框选择变化 */
|
|
|
+ handleSipExtViewSelectionChange(selection) {
|
|
|
+ this.sipExtViewDialog.selectedExts = selection.map(item => item);
|
|
|
+ },
|
|
|
+ /** 切换密码显示/隐藏 */
|
|
|
+ togglePasswordVisibility(index) {
|
|
|
+ if (this.sipExtViewDialog.pagedExtList[index]) {
|
|
|
+ this.$set(this.sipExtViewDialog.pagedExtList[index], 'showPassword',
|
|
|
+ !this.sipExtViewDialog.pagedExtList[index].showPassword);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 单个解绑SIP分机号 */
|
|
|
+ handleUnbindSipExt(row) {
|
|
|
+ // 将单个分机号包装成数组,调用统一的批量解绑方法
|
|
|
+ this.executeBatchUnbind([row]);
|
|
|
+ },
|
|
|
+ /** 执行批量解绑操作(统一入口) */
|
|
|
+ executeBatchUnbind(extList) {
|
|
|
+ if (!extList || extList.length === 0) {
|
|
|
+ this.$message.warning('请至少选择一个分机号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 格式化显示的分机号
|
|
|
+ const displayText = this.formatExtNumsDisplay(extList);
|
|
|
+ const totalCount = extList.length;
|
|
|
+
|
|
|
+ this.$confirm(`是否确认解绑以下分机号?\n${displayText}\n共 ${totalCount} 个分机需解绑`, "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ // 获取当前公司的ID
|
|
|
+ const companyId = this.form.companyId;
|
|
|
+
|
|
|
+ if (!companyId) {
|
|
|
+ this.$message.error('无法获取公司ID,请刷新页面后重试');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建包含extNum、userCode和companyId的对象数组
|
|
|
+ const extListParams = extList.map(item => {
|
|
|
+ return {
|
|
|
+ extNum: item.extNum,
|
|
|
+ userCode: item.userCode || ''
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ companyBatchUnbindSipExt(companyId,extListParams).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess("解绑成功");
|
|
|
+
|
|
|
+ // 清空选中项
|
|
|
+ this.sipExtViewDialog.selectedExts = [];
|
|
|
+
|
|
|
+ // 重新从后端获取公司最新信息,确保数据实时同步
|
|
|
+ getCompany(companyId).then(companyResponse => {
|
|
|
+ if (companyResponse.code === 200 && companyResponse.data) {
|
|
|
+ // 更新公司的分机号列表
|
|
|
+ const newSipExtNumIds = companyResponse.data.sipExtNumIds || '';
|
|
|
+ this.form.sipExtNumIds = newSipExtNumIds;
|
|
|
+
|
|
|
+ // 重新初始化extList
|
|
|
+ if (newSipExtNumIds && newSipExtNumIds !== '') {
|
|
|
+ const extIds = newSipExtNumIds.split(',').filter(id => id);
|
|
|
+ this.sipExtViewDialog.extList = extIds;
|
|
|
+ this.sipExtViewDialog.total = extIds.length;
|
|
|
+ } else {
|
|
|
+ this.sipExtViewDialog.extList = [];
|
|
|
+ this.sipExtViewDialog.total = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 调整页码
|
|
|
+ const totalPages = Math.ceil(this.sipExtViewDialog.total / this.sipExtViewDialog.pageSize);
|
|
|
+ if (this.sipExtViewDialog.pageNum > totalPages && totalPages > 0) {
|
|
|
+ this.sipExtViewDialog.pageNum = totalPages;
|
|
|
+ } else if (totalPages === 0) {
|
|
|
+ this.sipExtViewDialog.pageNum = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 刷新当前页数据
|
|
|
+ this.loadSipExtDetailPage();
|
|
|
+ } else {
|
|
|
+ this.$message.error('获取公司信息失败');
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('获取公司信息失败:', error);
|
|
|
+ this.$message.error('获取公司信息失败');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '解绑失败');
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error('解绑失败:'+ error);
|
|
|
+ });
|
|
|
+
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 格式化分机号显示(最多显示3个,超过用...标识) */
|
|
|
+ formatExtNumsDisplay(extList) {
|
|
|
+ if (!extList || extList.length === 0) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ const extNums = extList.map(item => item.extNum || item);
|
|
|
+ if (extNums.length <= 3) {
|
|
|
+ return extNums.join(', ');
|
|
|
+ }
|
|
|
+ return `${extNums.slice(0, 3).join(', ')}...等${extNums.length}个`;
|
|
|
+ },
|
|
|
+ /** 处理分机号查看对话框分页变化 */
|
|
|
+ handleSipExtViewPageChange() {
|
|
|
+ // 分页变化时,重新加载当前页数据
|
|
|
+ this.loadSipExtDetailPage();
|
|
|
+ },
|
|
|
+ /** 追加SIP分机号 */
|
|
|
+ handleAppendSipExt() {
|
|
|
+ this.sipExtViewDialog.open = false;
|
|
|
+ this.handleAddSipExtNum();
|
|
|
+ },
|
|
|
+ /** 批量解绑SIP分机号 */
|
|
|
+ handleBatchUnbindSipExt() {
|
|
|
+ if (this.sipExtViewDialog.selectedExts.length === 0) {
|
|
|
+ this.$message.warning('请至少选择一个分机号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 调用统一的批量解绑方法
|
|
|
+ this.executeBatchUnbind(this.sipExtViewDialog.selectedExts);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|