Prechádzať zdrojové kódy

新增销售易相关功能

zyy 1 deň pred
rodič
commit
0325e2d010

+ 240 - 0
src/api/xsy/xsy.js

@@ -0,0 +1,240 @@
+import request from '@/utils/request'
+
+
+
+/**
+ * 查询销售易账号列表
+ */
+export function listXsyAccount(query) {
+  return request({
+    url: '/xsy/account/company/list',
+    method: 'get',
+    params: query
+  })
+}
+
+/**
+ * 查询销售易账号详情
+ */
+export function getXsyAccount(id) {
+  return request({
+    url: '/xsy/account/get/' + id,
+    method: 'get'
+  })
+}
+
+/**
+ * 新增销售易账号
+ */
+export function addXsyAccount(data) {
+  return request({
+    url: '/xsy/account/add',
+    method: 'post',
+    data: data
+  })
+}
+
+/**
+ * 修改销售易账号
+ */
+export function updateXsyAccount(data) {
+  return request({
+    url: '/xsy/account/update',
+    method: 'post',
+    data: data
+  })
+}
+
+/**
+ * 删除销售易账号
+ */
+export function delXsyAccount(id) {
+  return request({
+    url: '/xsy/account/delete/' + id,
+    method: 'post'
+  })
+}
+
+/**
+ * 启用/禁用销售易账号
+ */
+export function updateXsyAccountStatus(id, status) {
+  return request({
+    url: '/xsy/account/status',
+    method: 'post',
+    params: {
+      id: id,
+      status: status
+    }
+  })
+}
+
+/**
+ * 获取授权地址
+ */
+export function getXsyAuthUrl(accountId) {
+  return request({
+    url: '/xsy/account/authUrl/' + accountId,
+    method: 'get'
+  })
+}
+
+
+
+/**
+ * 绑定销售易账号
+ */
+export function bindXsyAccount(data) {
+  return request({
+    url: '/xsy/bind/bind',
+    method: 'post',
+    data: data
+  })
+}
+
+export function unbindXsyAccount(data) {
+  return request({
+    url: '/xsy/bind/unbind',
+    method: 'post',
+    data: data
+  })
+}
+
+/**
+ * 查询绑定关系
+ */
+export function getXsyBind(companyUserId) {
+  return request({
+    url: '/xsy/bind/get',
+    method: 'get',
+    params: {
+      companyUserId: companyUserId
+    }
+  })
+}
+
+
+
+/**
+ * 获取授权URL(新接口)
+ */
+export function getXsyOauthUrl(accountId) {
+  return request({
+    url: '/xiaoShouYi/New/auth/url/' + accountId,
+    method: 'get'
+  })
+}
+
+
+
+/**
+ * 生成素材追踪链接
+ */
+export function generateXsyLink(companyUserId, data) {
+  return request({
+    url: '/xiaoShouYi/New/generateLink',
+    method: 'post',
+    params: {
+      companyUserId: companyUserId
+    },
+    data: data
+  })
+}
+
+/**
+ * 发送确认
+ */
+export function sendXsyConfirm(companyUserId, forwardId, forwardType) {
+  return request({
+    url: '/xiaoShouYi/New/sendConfirm',
+    method: 'post',
+    params: {
+      companyUserId: companyUserId,
+      forwardId: forwardId,
+      forwardType: forwardType
+    }
+  })
+}
+
+/**
+ * 查询素材列表
+ */
+export function queryXsyMaterials(companyUserId, data) {
+  return request({
+    url: '/xiaoShouYi/New/materials/query',
+    method: 'post',
+    params: {
+      companyUserId: companyUserId
+    },
+    data: data
+  })
+}
+
+/**
+ * 上传素材文件
+ */
+export function uploadXsyFile(companyUserId, file, isVideo) {
+  const formData = new FormData()
+  formData.append('file', file)
+  formData.append('isVideo', isVideo == null ? false : isVideo)
+
+  return request({
+    url: '/xiaoShouYi/New/uploadFile?companyUserId=' + companyUserId,
+    method: 'post',
+    data: formData,
+    headers: {
+      'Content-Type': 'multipart/form-data'
+    }
+  })
+}
+
+/**
+ * 创建素材
+ */
+export function createXsyMaterial(companyUserId, data) {
+  return request({
+    url: '/xiaoShouYi/New/createMaterial',
+    method: 'post',
+    params: {
+      companyUserId: companyUserId
+    },
+    data: data
+  })
+}
+
+/**
+ * 上传并创建素材
+ */
+export function createXsyMaterialWithUpload(params) {
+  const formData = new FormData()
+  formData.append('companyUserId', params.companyUserId)
+  formData.append('file', params.file)
+  formData.append('isVideo', params.isVideo == null ? false : params.isVideo)
+  formData.append('corpName', params.corpName)
+  formData.append('materialType', params.materialType)
+  formData.append('categoryName', params.categoryName)
+  formData.append('title', params.title)
+
+  return request({
+    url: '/xiaoShouYi/New/createMaterialWithUpload',
+    method: 'post',
+    data: formData,
+    headers: {
+      'Content-Type': 'multipart/form-data'
+    }
+  })
+}
+
+/**
+ * 完整流程:生成链接并发送确认
+ */
+export function fullProcessXsy(companyUserId, data) {
+  return request({
+    url: '/xiaoShouYi/New/fullProcess',
+    method: 'post',
+    params: {
+      companyUserId: companyUserId
+    },
+    data: data
+  })
+}

+ 129 - 1
src/views/company/companyUser/index.vue

@@ -308,6 +308,21 @@
               <el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)" v-hasPermi="['company:user:resetPwd']">重置密码</el-button>
               <el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)" v-hasPermi="['company:user:resetPwd']">重置密码</el-button>
               <el-button size="mini" type="text" icon="el-icon-edit" @click="checkBindSipCallUser(scope.row)" v-if="scope.row.aiSipCallUserId==null">绑定sip角色</el-button>
               <el-button size="mini" type="text" icon="el-icon-edit" @click="checkBindSipCallUser(scope.row)" v-if="scope.row.aiSipCallUserId==null">绑定sip角色</el-button>
               <el-button size="mini" type="text" icon="el-icon-search" @click="checkChangeSipCallUser(scope.row)" v-if="scope.row.aiSipCallUserId">修改sip角色</el-button>
               <el-button size="mini" type="text" icon="el-icon-search" @click="checkChangeSipCallUser(scope.row)" v-if="scope.row.aiSipCallUserId">修改sip角色</el-button>
+              <el-button
+                v-if="!scope.row.accountId"
+                size="mini"
+                type="text"
+                icon="el-icon-link"
+                @click="handleBindXsy(scope.row)"
+              >绑定销售易</el-button>
+
+              <el-button
+                v-if="scope.row.accountId"
+                size="mini"
+                type="text"
+                icon="el-icon-close"
+                @click="handleUnbindXsy(scope.row)"
+              >解绑销售易</el-button>
             </template>
             </template>
           </el-table-column>
           </el-table-column>
         </el-table>
         </el-table>
@@ -825,6 +840,37 @@
       </div>
       </div>
     </el-dialog>
     </el-dialog>
 
 
+    <!-- 绑定销售易账号 -->
+    <el-dialog :title="xsyBindDialog.title" :visible.sync="xsyBindDialog.open" width="500px" append-to-body>
+      <el-form ref="xsyBindFormRef" :model="xsyBindForm" label-width="100px">
+          <el-form-item label="员工姓名">
+              <el-input v-model="xsyBindForm.nickName" disabled />
+          </el-form-item>
+          <el-form-item label="销售易账号" prop="accountId">
+              <el-select
+                  v-model="xsyBindForm.accountId"
+                  filterable
+                  clearable
+                  placeholder="请选择销售易账号"
+                  style="width: 100%;"
+                  :loading="xsyBindDialog.loading"
+              >
+                  <el-option
+                      v-for="item in xsyAccountList"
+                      :key="item.id"
+                      :label="item.accountName"
+                      :value="item.id"
+                  />
+              </el-select>
+          </el-form-item>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitBindXsy">确 定</el-button>
+          <el-button @click="cancelBindXsy">取 消</el-button>
+      </div>
+    </el-dialog>
+
     <ai-sip-call-user ref="aiSipCallUser" v-show="false" @refreshParentData="getList" />
     <ai-sip-call-user ref="aiSipCallUser" v-show="false" @refreshParentData="getList" />
 
 
   </div>
   </div>
@@ -864,6 +910,7 @@ import {addCodeUrl, bindSaleAndFsUser, getSaleBindUserList} from "../../../api/c
 import selectDoctor from "@/views/qw/user/selectDoctor.vue";
 import selectDoctor from "@/views/qw/user/selectDoctor.vue";
 import {bindCidServer,unbindCidServer} from "@/api/company/companyAiWorkflowServer";
 import {bindCidServer,unbindCidServer} from "@/api/company/companyAiWorkflowServer";
 import AiSipCallUser from "../../aiSipCall/aiSipCallUser.vue";
 import AiSipCallUser from "../../aiSipCall/aiSipCallUser.vue";
+import { bindXsyAccount,unbindXsyAccount,listXsyAccount} from "@/api/xsy/xsy";
 export default {
 export default {
   name: "User",
   name: "User",
   components: {selectDoctor, Treeselect ,selectUser,AiSipCallUser},
   components: {selectDoctor, Treeselect ,selectUser,AiSipCallUser},
@@ -1092,6 +1139,20 @@ export default {
       selectedFsUserIds: [],
       selectedFsUserIds: [],
       boundUsersList: [],
       boundUsersList: [],
       bindUserLoading: false,
       bindUserLoading: false,
+      // 销售易绑定弹窗
+      xsyBindDialog: {
+        open: false,
+        title: '绑定销售易账号',
+        loading: false
+      },
+      // 销售易账号列表
+      xsyAccountList: [],
+      // 绑定表单
+      xsyBindForm: {
+        companyUserId: null,
+        nickName: '',
+        accountId: null
+      },
     };
     };
 
 
   },
   },
@@ -2123,7 +2184,74 @@ export default {
     },
     },
     checkChangeSipCallUser(row){
     checkChangeSipCallUser(row){
       this.$refs.aiSipCallUser.handleUpdateById(row.aiSipCallUserId);
       this.$refs.aiSipCallUser.handleUpdateById(row.aiSipCallUserId);
-    }
+    },
+    // 打开绑定销售易账号弹窗
+    handleBindXsy(row) {
+      this.xsyBindForm = {
+          companyUserId: row.userId,
+          nickName: row.nickName,
+          accountId: null
+      }
+      this.xsyAccountList = []
+      this.xsyBindDialog.open = true
+      this.xsyBindDialog.loading = true
+
+      listXsyAccount({
+          pageNum: 1,
+          pageSize: 9999
+      }).then(res => {
+          this.xsyAccountList = res.rows || []
+      }).finally(() => {
+          this.xsyBindDialog.loading = false
+      })
+    },
+
+  // 取消绑定销售易
+  cancelBindXsy() {
+      this.xsyBindDialog.open = false
+      this.xsyBindForm = {
+          companyUserId: null,
+          nickName: '',
+          accountId: null
+      }
+  },
+
+  // 提交绑定销售易
+  submitBindXsy() {
+      if (!this.xsyBindForm.accountId) {
+          this.$message.warning('请选择销售易账号')
+          return
+      }
+
+      bindXsyAccount({
+          companyUserId: this.xsyBindForm.companyUserId,
+          accountId: this.xsyBindForm.accountId
+      }).then(res => {
+          if (res.code === 200) {
+              this.msgSuccess('绑定成功')
+              this.xsyBindDialog.open = false
+              this.getList()
+          }
+      })
+  },
+
+  // 解绑销售易账号
+  handleUnbindXsy(row) {
+      this.$confirm('是否确认解绑当前员工的销售易账号?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+      }).then(() => {
+          return unbindXsyAccount({
+              companyUserId: row.userId
+          })
+      }).then(res => {
+          if (res.code === 200) {
+              this.msgSuccess('解绑成功')
+              this.getList()
+          }
+      }).catch(() => {})
+  },
   },
   },
 }
 }
 </script>
 </script>

+ 257 - 0
src/views/xsy/index.vue

@@ -0,0 +1,257 @@
+<template>
+  <div class="app-container">
+
+    <!-- 查询 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
+
+      <el-form-item label="ClientId">
+        <el-input v-model="queryParams.clientId" placeholder="请输入ClientId" size="small"/>
+      </el-form-item>
+
+      <el-form-item label="账号名称">
+        <el-input v-model="queryParams.accountName" placeholder="请输入账号名称"/>
+      </el-form-item>
+
+      <el-form-item label="状态">
+        <el-select v-model="queryParams.status" clearable size="small">
+          <el-option label="启用" :value="1"/>
+          <el-option label="禁用" :value="0"/>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="cyan" 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>
+
+    </el-form>
+
+    <!-- 按钮 -->
+    <el-row class="mb8">
+      <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
+      <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
+      <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
+    </el-row>
+
+    <!-- 表格 -->
+    <el-table v-loading="loading" :data="accountList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55"/>
+      <el-table-column prop="accountName" label="账号名称"/>
+      <el-table-column prop="id" label="ID"/>
+      <el-table-column prop="clientId" label="ClientId"/>
+      <el-table-column prop="redirectUri" label="回调地址"/>
+
+      <el-table-column label="状态">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.status==1?'success':'danger'">
+            {{ scope.row.status==1?'启用':'禁用' }}
+          </el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+
+          <el-button size="mini" type="text" @click="handleUpdate(scope.row)">修改</el-button>
+
+          <el-button size="mini" type="text" @click="handleDelete(scope.row)">删除</el-button>
+
+          <el-button size="mini" type="text" @click="toggleStatus(scope.row)">
+            {{scope.row.status==1?'禁用':'启用'}}
+          </el-button>
+
+          <el-button size="mini" type="text" @click="auth(scope.row.id)">
+            授权
+          </el-button>
+
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页(注意这里 total 用 length) -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 弹窗 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px">
+
+      <el-form ref="form" :model="form">
+
+        <el-form-item label="ClientId">
+          <el-input v-model="form.clientId"/>
+        </el-form-item>
+
+        <el-form-item label="账号名称">
+          <el-input v-model="form.accountName"/>
+        </el-form-item>
+
+        <el-form-item label="ClientSecret">
+          <el-input v-model="form.clientSecret"/>
+        </el-form-item>
+
+        <el-form-item label="回调地址">
+          <el-input v-model="form.redirectUri"/>
+        </el-form-item>
+
+      </el-form>
+
+      <div slot="footer">
+        <el-button type="primary" @click="submitForm">确定</el-button>
+        <el-button @click="cancel">取消</el-button>
+      </div>
+
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import {
+  listXsyAccount,
+  addXsyAccount,
+  updateXsyAccount,
+  delXsyAccount,
+  updateXsyAccountStatus,
+  getXsyAuthUrl
+} from "@/api/xsy/xsy";
+
+export default {
+  name: "XsyAccount",
+
+  data() {
+    return {
+      loading: true,
+      accountList: [],
+      total: 0,
+      ids: [],
+      single: true,
+      multiple: true,
+      showSearch: true,
+
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        clientId: null,
+        status: null
+      },
+
+      form: {},
+      open: false,
+      title: ""
+    };
+  },
+
+  created() {
+    this.getList();
+  },
+
+  methods: {
+
+    /** 查询列表 */
+    getList() {
+      this.loading = true;
+      listXsyAccount(this.queryParams).then(res => {
+        this.accountList = res.rows || [];
+        this.total = res.total || 0;
+        this.loading = false;
+      });
+    },
+
+    /** 搜索 */
+    handleQuery() {
+      this.getList();
+    },
+
+    /** 重置 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.getList();
+    },
+
+    /** 选中 */
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+
+    /** 新增 */
+    handleAdd() {
+      this.form = {};
+      this.open = true;
+      this.title = "新增账号";
+    },
+
+    /** 修改 */
+    handleUpdate(row) {
+      this.form = row || {};
+      this.open = true;
+      this.title = "修改账号";
+    },
+
+    /** 提交 */
+    submitForm() {
+      const api = this.form.id ? updateXsyAccount : addXsyAccount;
+
+      api(this.form).then(res => {
+        if (res.code === 200) {
+          this.msgSuccess("操作成功");
+          this.open = false;
+          this.getList();
+        }
+      });
+    },
+
+    /** 删除 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+
+      this.$confirm('是否确认删除编号为"' + ids + '"的数据项?', "警告")
+        .then(() => {
+          return delXsyAccount(ids);
+        })
+        .then(() => {
+          this.msgSuccess("删除成功");
+          this.getList();
+        });
+    },
+
+    /** 状态切换 */
+    toggleStatus(row) {
+      const status = row.status === 1 ? 0 : 1;
+
+      updateXsyAccountStatus(row.id, status).then(() => {
+        this.msgSuccess("状态修改成功");
+        this.getList();
+      });
+    },
+
+    /** 授权 */
+    auth(id) {
+      const win = window.open('', '_blank');
+
+      getXsyAuthUrl(id).then(res => {
+        if (res.code === 200) {
+          win.location.href = res.msg;
+        } else {
+          win.close();
+          this.msgError(res.msg);
+        }
+      }).catch(() => {
+        win.close();
+        this.msgError("授权失败");
+      });
+    },
+
+    cancel() {
+      this.open = false;
+    }
+
+  }
+};
+</script>