|
|
@@ -106,10 +106,14 @@
|
|
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['customer:customerInfo:add']">新增</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain :disabled="single" v-hasPermi="['customer:customerInfo:edit']">转移业务员</el-button>
|
|
|
+ <el-button type="primary" plain :disabled="single" @click="handleTransferSalesPerson" v-hasPermi="['customer:customerInfo:edit']"
|
|
|
+ >转移业务员</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain :disabled="single" v-hasPermi="['customer:customerInfo:edit']">转移客服人员</el-button>
|
|
|
+ <el-button type="primary" plain :disabled="single" @click="handleTransferServiceStaff" v-hasPermi="['customer:customerInfo:edit']"
|
|
|
+ >转移客服人员</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain :disabled="single" @click="updateCreditAmountBtn" v-hasPermi="['customer:customerInfo:edit']"
|
|
|
@@ -216,6 +220,75 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 转移业务员确认对话框 -->
|
|
|
+ <el-dialog title="提示" v-model="transferConfirmDialog.visible" width="500px" append-to-body>
|
|
|
+ <div style="display: flex; align-items: flex-start; gap: 10px">
|
|
|
+ <el-icon color="#e6a23c" :size="20"><WarningFilled /></el-icon>
|
|
|
+ <span>是否将选中的{{ ids.length }}个客户转移给其他负责人?转移成功之后,该操作将无法恢复。</span>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="transferConfirmDialog.visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmTransfer" :loading="transferConfirmLoading">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 选择业务员对话框 -->
|
|
|
+ <el-dialog title="转移业务员" v-model="transferDialog.visible" width="500px" append-to-body>
|
|
|
+ <el-form ref="transferFormRef" :model="transferForm" :rules="transferRules" label-width="100px">
|
|
|
+ <el-form-item label="业务员" prop="salesPersonId">
|
|
|
+ <el-select
|
|
|
+ v-model="transferForm.salesPersonId"
|
|
|
+ placeholder="请选择业务员"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ @change="handleStaffChange"
|
|
|
+ >
|
|
|
+ <el-option v-for="item in comStaffList" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="transferDialog.visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitTransfer" :loading="transferLoading">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 转移客服人员确认对话框 -->
|
|
|
+ <el-dialog title="提示" v-model="transferServiceConfirmDialog.visible" width="500px" append-to-body>
|
|
|
+ <div style="display: flex; align-items: flex-start; gap: 10px">
|
|
|
+ <el-icon color="#e6a23c" :size="20"><WarningFilled /></el-icon>
|
|
|
+ <span>是否将选中的{{ ids.length }}个客户转移给其他负责人?转移成功之后,该操作将无法恢复。</span>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="transferServiceConfirmDialog.visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmServiceTransfer" :loading="transferServiceConfirmLoading">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 选择客服人员对话框 -->
|
|
|
+ <el-dialog title="转移客服人员" v-model="transferServiceDialog.visible" width="500px" append-to-body>
|
|
|
+ <el-form ref="transferServiceFormRef" :model="transferServiceForm" :rules="transferServiceRules" label-width="100px">
|
|
|
+ <el-form-item label="客服人员" prop="serviceStaffId">
|
|
|
+ <el-select v-model="transferServiceForm.serviceStaffId" placeholder="请选择客服人员" clearable filterable style="width: 100%">
|
|
|
+ <el-option v-for="item in comStaffList" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="transferServiceDialog.visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitServiceTransfer" :loading="transferServiceLoading">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -228,7 +301,9 @@ import {
|
|
|
updateCustomerInfo,
|
|
|
changeStatus,
|
|
|
updateCreditAmount,
|
|
|
- setCustomerInfoTag
|
|
|
+ setCustomerInfoTag,
|
|
|
+ transferSalesPerson,
|
|
|
+ transferServiceStaff
|
|
|
} from '@/api/customer/customerFile/customerInfo';
|
|
|
import { CustomerInfoVO, CustomerInfoQuery, CustomerInfoForm } from '@/api/customer/customerFile/customerInfo/types';
|
|
|
import { listCustomerTag } from '@/api/customer/customerCategory/customerTag';
|
|
|
@@ -243,6 +318,7 @@ import { listComStaff, getComStaff } from '@/api/company/comStaff';
|
|
|
import { ComStaffVO, ComStaffQuery, ComStaffForm } from '@/api/company/comStaff/types';
|
|
|
import { listComDept, getComDept } from '@/api/company/comDept';
|
|
|
import { ComDeptVO } from '@/api/company/comDept/types';
|
|
|
+import { WarningFilled } from '@element-plus/icons-vue';
|
|
|
const router = useRouter();
|
|
|
const customerInfoList = ref<CustomerInfoVO[]>([]);
|
|
|
const customerTagList = ref<CustomerTagVO[]>([]);
|
|
|
@@ -253,6 +329,10 @@ const comStaffList = ref<ComStaffVO[]>([]);
|
|
|
const comDeptList = ref<ComDeptVO[]>([]);
|
|
|
const buttonLoading = ref(false);
|
|
|
const loading = ref(true);
|
|
|
+const transferConfirmLoading = ref(false);
|
|
|
+const transferLoading = ref(false);
|
|
|
+const transferServiceConfirmLoading = ref(false);
|
|
|
+const transferServiceLoading = ref(false);
|
|
|
const showSearch = ref(true);
|
|
|
const ids = ref<Array<string | number>>([]);
|
|
|
const single = ref(true);
|
|
|
@@ -325,6 +405,55 @@ const tagDialog = reactive<DialogOption>({
|
|
|
// 选中的标签
|
|
|
const selectedTags = ref<Array<string | number>>([]);
|
|
|
|
|
|
+// 转移业务员确认对话框
|
|
|
+const transferConfirmDialog = reactive<DialogOption>({
|
|
|
+ visible: false,
|
|
|
+ title: '提示'
|
|
|
+});
|
|
|
+
|
|
|
+// 转移业务员对话框
|
|
|
+const transferDialog = reactive<DialogOption>({
|
|
|
+ visible: false,
|
|
|
+ title: '转移业务员'
|
|
|
+});
|
|
|
+
|
|
|
+// 转移业务员表单
|
|
|
+const transferForm = reactive({
|
|
|
+ salesPersonId: undefined,
|
|
|
+ deptId: undefined
|
|
|
+});
|
|
|
+
|
|
|
+const transferFormRef = ref<ElFormInstance>();
|
|
|
+
|
|
|
+// 转移业务员表单验证规则
|
|
|
+const transferRules = {
|
|
|
+ salesPersonId: [{ required: true, message: '请选择业务员', trigger: 'change' }]
|
|
|
+};
|
|
|
+
|
|
|
+// 转移客服人员确认对话框
|
|
|
+const transferServiceConfirmDialog = reactive<DialogOption>({
|
|
|
+ visible: false,
|
|
|
+ title: '提示'
|
|
|
+});
|
|
|
+
|
|
|
+// 转移客服人员对话框
|
|
|
+const transferServiceDialog = reactive<DialogOption>({
|
|
|
+ visible: false,
|
|
|
+ title: '转移客服人员'
|
|
|
+});
|
|
|
+
|
|
|
+// 转移客服人员表单
|
|
|
+const transferServiceForm = reactive({
|
|
|
+ serviceStaffId: undefined
|
|
|
+});
|
|
|
+
|
|
|
+const transferServiceFormRef = ref<ElFormInstance>();
|
|
|
+
|
|
|
+// 转移客服人员表单验证规则
|
|
|
+const transferServiceRules = {
|
|
|
+ serviceStaffId: [{ required: true, message: '请选择客服人员', trigger: 'change' }]
|
|
|
+};
|
|
|
+
|
|
|
const initFormData: CustomerInfoForm = {
|
|
|
id: undefined,
|
|
|
customerNo: undefined,
|
|
|
@@ -524,6 +653,97 @@ const submitTags = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/** 转移业务员按钮操作 */
|
|
|
+const handleTransferSalesPerson = () => {
|
|
|
+ if (ids.value.length === 0) {
|
|
|
+ proxy?.$modal.msgWarning('请至少选择一条记录');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ transferConfirmDialog.visible = true;
|
|
|
+};
|
|
|
+
|
|
|
+/** 确认转移 */
|
|
|
+const confirmTransfer = () => {
|
|
|
+ transferConfirmLoading.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ transferConfirmLoading.value = false;
|
|
|
+ transferConfirmDialog.visible = false;
|
|
|
+ transferForm.salesPersonId = undefined;
|
|
|
+ transferForm.deptId = undefined;
|
|
|
+ transferFormRef.value?.resetFields();
|
|
|
+ transferDialog.visible = true;
|
|
|
+ }, 300);
|
|
|
+};
|
|
|
+
|
|
|
+/** 业务员选择变化时获取部门ID */
|
|
|
+const handleStaffChange = (staffId: number) => {
|
|
|
+ const staff = comStaffList.value.find((item) => item.staffId === staffId);
|
|
|
+ if (staff) {
|
|
|
+ transferForm.deptId = staff.deptId;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 提交转移业务员 */
|
|
|
+const submitTransfer = () => {
|
|
|
+ transferFormRef.value?.validate(async (valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ try {
|
|
|
+ transferLoading.value = true;
|
|
|
+ await transferSalesPerson(ids.value as number[], transferForm.salesPersonId as number, transferForm.deptId);
|
|
|
+ proxy?.$modal.msgSuccess('转移成功');
|
|
|
+ transferDialog.visible = false;
|
|
|
+ await getList();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('转移业务员失败:', error);
|
|
|
+ proxy?.$modal.msgError('转移失败,请重试');
|
|
|
+ } finally {
|
|
|
+ transferLoading.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+/** 转移客服人员按钮操作 */
|
|
|
+const handleTransferServiceStaff = () => {
|
|
|
+ if (ids.value.length === 0) {
|
|
|
+ proxy?.$modal.msgWarning('请至少选择一条记录');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ transferServiceConfirmDialog.visible = true;
|
|
|
+};
|
|
|
+
|
|
|
+/** 确认转移客服人员 */
|
|
|
+const confirmServiceTransfer = () => {
|
|
|
+ transferServiceConfirmLoading.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ transferServiceConfirmLoading.value = false;
|
|
|
+ transferServiceConfirmDialog.visible = false;
|
|
|
+ transferServiceForm.serviceStaffId = undefined;
|
|
|
+ transferServiceFormRef.value?.resetFields();
|
|
|
+ transferServiceDialog.visible = true;
|
|
|
+ }, 300);
|
|
|
+};
|
|
|
+
|
|
|
+/** 提交转移客服人员 */
|
|
|
+const submitServiceTransfer = () => {
|
|
|
+ transferServiceFormRef.value?.validate(async (valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ try {
|
|
|
+ transferServiceLoading.value = true;
|
|
|
+ await transferServiceStaff(ids.value as number[], transferServiceForm.serviceStaffId as number);
|
|
|
+ proxy?.$modal.msgSuccess('转移成功');
|
|
|
+ transferServiceDialog.visible = false;
|
|
|
+ await getList();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('转移客服人员失败:', error);
|
|
|
+ proxy?.$modal.msgError('转移失败,请重试');
|
|
|
+ } finally {
|
|
|
+ transferServiceLoading.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
/** 提交按钮 */
|
|
|
const submitForm = () => {
|
|
|
customerInfoFormRef.value?.validate(async (valid: boolean) => {
|
|
|
@@ -607,6 +827,8 @@ const loadComStaffList = async () => {
|
|
|
try {
|
|
|
const query: ComStaffQuery = { status: '0' } as any;
|
|
|
const res = await listComStaff(query);
|
|
|
+ console.log(res);
|
|
|
+
|
|
|
comStaffList.value = res.rows || [];
|
|
|
} catch (error) {
|
|
|
console.error('加载员工列表失败:', error);
|