index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="员工姓名" prop="companyUserNickName">
  5. <el-input
  6. v-model="queryParams.companyUserNickName"
  7. placeholder="请输入员工姓名"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="手机号" prop="mobile">
  14. <el-input
  15. v-model="queryParams.mobile"
  16. placeholder="请输入手机号"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <!-- <el-form-item label="状态" prop="status">
  23. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  24. <el-option
  25. v-for="dict in statusOptions"
  26. :key="dict.dictValue"
  27. :label="dict.dictLabel"
  28. :value="dict.dictValue"
  29. />
  30. </el-select>
  31. </el-form-item> -->
  32. <el-form-item>
  33. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  34. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  35. </el-form-item>
  36. </el-form>
  37. <el-row :gutter="10" class="mb8">
  38. <el-col :span="1.5">
  39. <el-button
  40. type="primary"
  41. icon="el-icon-plus"
  42. size="mini"
  43. @click="handleBind"
  44. v-hasPermi="['company:companyVoiceCaller:bind']"
  45. >绑定坐席</el-button>
  46. </el-col>
  47. <!-- <el-col :span="1.5">
  48. <el-button
  49. type="success"
  50. icon="el-icon-edit"
  51. size="mini"
  52. :disabled="single"
  53. @click="handleUpdate"
  54. v-hasPermi="['company:companyVoiceCaller:edit']"
  55. >修改</el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button
  59. type="danger"
  60. icon="el-icon-delete"
  61. size="mini"
  62. :disabled="multiple"
  63. @click="handleDelete"
  64. v-hasPermi="['company:companyVoiceCaller:remove']"
  65. >删除</el-button>
  66. </el-col> -->
  67. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  68. </el-row>
  69. <el-table height="500" border v-loading="loading" :data="companyCallerList" @selection-change="handleSelectionChange">
  70. <el-table-column type="selection" width="55" align="center" />
  71. <el-table-column label="ID" align="center" prop="callerId" />
  72. <el-table-column label="员工姓名" align="center" prop="companyUserNickName" />
  73. <el-table-column label="线路" align="center" prop="callerLine" />
  74. <el-table-column label="坐席号" align="center" prop="callerNo" />
  75. <el-table-column label="手机号" align="center" prop="mobile" />
  76. <!-- <el-table-column label="状态" align="center" prop="status" >
  77. <template slot-scope="scope">
  78. <el-tag prop="status" v-for="(item, index) in statusOptions" :type="scope.row.status==1?'success':'danger'" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  79. </template>
  80. </el-table-column> -->
  81. <el-table-column label="备注" align="center" prop="remark" />
  82. <el-table-column label="操作" width="120px" align="center" class-name="small-padding fixed-width">
  83. <template slot-scope="scope">
  84. <el-button
  85. size="mini"
  86. type="text"
  87. icon="el-icon-delete"
  88. @click="handleDelete(scope.row)"
  89. v-hasPermi="['company:companyVoiceCaller:remove']"
  90. >删除</el-button>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <pagination
  95. v-show="total>0"
  96. :total="total"
  97. :page.sync="queryParams.pageNum"
  98. :limit.sync="queryParams.pageSize"
  99. @pagination="getList"
  100. />
  101. <!-- 添加或修改企业用户坐席对话框 -->
  102. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  103. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  104. <el-form-item label="员工" prop="companyUserId">
  105. <el-select v-model="form.companyUserId" filterable placeholder="请选择员工" clearable size="small">
  106. <el-option
  107. @change="userChange"
  108. v-for="item in users"
  109. v-if="item.status !== '1'"
  110. :key="item.userId"
  111. :label="item.nickName"
  112. :value="item.userId"
  113. />
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item label="线路" prop="callerLine">
  117. <el-select v-model="form.callerLine" @change="handleCallerLineChange" placeholder="请选择线路" clearable size="small">
  118. <el-option
  119. v-for="item in callerApis"
  120. :key="item.apiId"
  121. :label="item.apiName"
  122. :value="item.apiId"
  123. />
  124. </el-select>
  125. </el-form-item>
  126. <el-form-item label="坐席" prop="callerId" v-if="form.callerLine != null">
  127. <el-select v-model="form.callerId" placeholder="请选择坐席" clearable size="small">
  128. <el-option
  129. v-for="item in callers"
  130. :key="item.callerId"
  131. :label="item.callerNo"
  132. :value="item.callerId"
  133. />
  134. </el-select>
  135. </el-form-item>
  136. <el-form-item label="手机号" prop="mobile">
  137. <el-input v-model="form.mobile" maxlength="11" style="width: 215px" placeholder="请输入手机号" />
  138. </el-form-item>
  139. <!-- <el-form-item label="验证码" prop="code">
  140. <el-input v-model="form.code" maxlength="4" style="width: 215px" placeholder="请输入验证码" />
  141. <span v-if="codeShow" class="get-code" @click="getSmsCode">获取验证码</span>
  142. <span v-if="!codeShow" class="get-code">{{ codeCount }}s</span>
  143. </el-form-item> -->
  144. <!-- <el-form-item label="坐度有效期" prop="userLimitTime">
  145. <el-date-picker clearable size="small" style="width: 215px"
  146. v-model="form.userLimitTime"
  147. type="date"
  148. value-format="yyyy-MM-dd"
  149. placeholder="选择坐度有效期">
  150. </el-date-picker>
  151. </el-form-item> -->
  152. <el-form-item label="状态">
  153. <el-radio-group v-model="form.status">
  154. <el-radio v-for="dict in statusOptions" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
  155. </el-radio-group>
  156. </el-form-item>
  157. <el-form-item label="备注" prop="remark">
  158. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  159. </el-form-item>
  160. </el-form>
  161. <div slot="footer" class="dialog-footer">
  162. <el-button type="primary" @click="submitForm">确 定</el-button>
  163. <el-button @click="cancel">取 消</el-button>
  164. </div>
  165. </el-dialog>
  166. </div>
  167. </template>
  168. <script>
  169. import { bindCallerNo,listCompanyVoiceCaller, getCompanyVoiceCaller, delCompanyVoiceCaller, addCompanyVoiceCaller, updateCompanyVoiceCaller, exportCompanyVoiceCaller } from "@/api/company/companyVoiceCaller";
  170. import { getUserList } from "@/api/company/companyUser";
  171. import { getCallerList } from "@/api/company/companyVoiceCaller";
  172. import {getCallerApiList} from "@/api/company/companyVoiceApi"
  173. import { sendSmsCode } from "@/api/common";
  174. export default {
  175. name: "CompanyCaller",
  176. data() {
  177. return {
  178. callerApis:[],
  179. callers:[],
  180. // codeShow: true, // 获取验证码样式
  181. // codeFlag:true,
  182. // codeCount: 60, // 验证码倒计时
  183. // codeText:"获取验证码",
  184. companys:[],
  185. users:[],
  186. statusOptions:[],
  187. // 遮罩层
  188. loading: true,
  189. // 选中数组
  190. ids: [],
  191. // 非单个禁用
  192. single: true,
  193. // 非多个禁用
  194. multiple: true,
  195. // 显示搜索条件
  196. showSearch: true,
  197. // 总条数
  198. total: 0,
  199. // 企业用户坐席表格数据
  200. companyCallerList: [],
  201. // 弹出层标题
  202. title: "",
  203. // 是否显示弹出层
  204. open: false,
  205. // 查询参数
  206. queryParams: {
  207. pageNum: 1,
  208. pageSize: 10,
  209. companyId: null,
  210. userId: null,
  211. mobile: null,
  212. status: null
  213. },
  214. // 表单参数
  215. form: {},
  216. // 表单校验
  217. rules: {
  218. companyUserId: [
  219. { required: true, message: "员工不能为空", trigger: "blur" }
  220. ],
  221. mobile: [
  222. { required: true, message: "手机号不能为空", trigger: "blur" }
  223. ],
  224. callerId: [
  225. { required: true, message: "坐席编号不能为空", trigger: "blur" }
  226. ],
  227. callerLine:[
  228. { required: true, message: "线路不能为空", trigger: "blur" }
  229. ]
  230. // code: [
  231. // { required: true, message: "验证码不能为空", trigger: "blur" }
  232. // ],
  233. // userLimitTime: [
  234. // { required: true, message: "坐席到期时间不能为空", trigger: "blur" }
  235. // ],
  236. }
  237. };
  238. },
  239. created() {
  240. this.getDicts("company_status").then((response) => {
  241. this.statusOptions = response.data;
  242. });
  243. this.getList();
  244. this.getUserList();
  245. },
  246. methods: {
  247. // getSmsCode(){
  248. // if(!this.codeFlag){
  249. // return;
  250. // }
  251. // if(this.form.mobile==null){
  252. // this.msgError("请输入手机号");
  253. // return;
  254. // }
  255. // this.codeFlag=false;
  256. // var that=this;
  257. // var data={mobile:this.form.mobile}
  258. // sendSmsCode(data).then(
  259. // response => {
  260. // if (response.code === 200) {
  261. // that.getCode()
  262. // }
  263. // else{
  264. // this.msgError(response.msg);
  265. // }
  266. // }
  267. // ).catch(() => {
  268. // this.codeFlag = true;
  269. // });
  270. // },
  271. // // 获取验证码
  272. // getCode() {
  273. // const TIME_COUNT = 60;
  274. // var that=this;
  275. // if (!this.timer) {
  276. // this.codeCount = TIME_COUNT;
  277. // this.codeShow = false;
  278. // this.timer = setInterval(() => {
  279. // if (this.codeCount > 0 && this.codeCount <= TIME_COUNT) {
  280. // this.codeCount--;
  281. // } else {
  282. // that.codeFlag=true;
  283. // that.codeShow = true;
  284. // clearInterval(that.timer);
  285. // that.timer = null;
  286. // }
  287. // }, 1000)
  288. // }
  289. // },
  290. userChange(e){
  291. console.log(e)
  292. },
  293. handleCallerLineChange(){
  294. this.getCallerList();
  295. },
  296. getCallerList() {
  297. console.log("-------------------" + JSON.stringify(this.form))
  298. const param = {callerLine :this.form.callerLine}
  299. getCallerList(param).then(response => {
  300. this.callers = response.data;
  301. });
  302. },
  303. getCallerApiList() {
  304. const param = {status:1}
  305. getCallerApiList(param).then(response => {
  306. this.callerApis = response.rows;
  307. });
  308. },
  309. getUserList() {
  310. getUserList().then(response => {
  311. this.users = response.data;
  312. });
  313. },
  314. /** 查询企业用户坐席列表 */
  315. getList() {
  316. this.loading = true;
  317. listCompanyVoiceCaller(this.queryParams).then(response => {
  318. this.companyCallerList = response.rows;
  319. this.total = response.total;
  320. this.loading = false;
  321. });
  322. },
  323. // 取消按钮
  324. cancel() {
  325. this.open = false;
  326. this.reset();
  327. },
  328. // 表单重置
  329. reset() {
  330. this.form = {
  331. callerId: null,
  332. companyId: null,
  333. companyUserId: null,
  334. mobile: null,
  335. remark: null,
  336. status: "1"
  337. };
  338. this.resetForm("form");
  339. },
  340. /** 搜索按钮操作 */
  341. handleQuery() {
  342. this.queryParams.pageNum = 1;
  343. this.getList();
  344. },
  345. /** 重置按钮操作 */
  346. resetQuery() {
  347. this.resetForm("queryForm");
  348. this.handleQuery();
  349. },
  350. // 多选框选中数据
  351. handleSelectionChange(selection) {
  352. this.ids = selection.map(item => item.callerId)
  353. this.single = selection.length!==1
  354. this.multiple = !selection.length
  355. },
  356. /** 新增按钮操作 */
  357. handleBind() {
  358. this.reset();
  359. this.open = true;
  360. this.title = "员工坐席绑定";
  361. this.getCallerApiList();
  362. // this.getCallerList();
  363. },
  364. /** 修改按钮操作 */
  365. // handleUpdate(row) {
  366. // var that=this;
  367. // this.reset();
  368. // this.getCallerList();
  369. // const callerId = row.callerId || this.ids
  370. // getCompanyVoiceCaller(callerId).then(response => {
  371. // this.form = response.data;
  372. // this.form.nickName=row.companyUserNickName;
  373. // this.form.status = response.data.status.toString();
  374. // this.open = true;
  375. // this.title = "修改员工坐席";
  376. // });
  377. // },
  378. /** 提交按钮 */
  379. submitForm() {
  380. this.$refs["form"].validate(valid => {
  381. if (valid) {
  382. bindCallerNo(this.form).then(response => {
  383. if (response.code === 200) {
  384. this.msgSuccess("操作成功");
  385. this.open = false;
  386. this.getList();
  387. }
  388. });
  389. }
  390. });
  391. },
  392. /** 删除按钮操作 */
  393. handleDelete(row) {
  394. const callerIds = row.callerId || this.ids;
  395. this.$confirm('是否确认删除坐席编号为"' + callerIds + '"的数据项?', "警告", {
  396. confirmButtonText: "确定",
  397. cancelButtonText: "取消",
  398. type: "warning"
  399. }).then(function() {
  400. return delCompanyVoiceCaller(callerIds);
  401. }).then(() => {
  402. this.getList();
  403. this.msgSuccess("删除成功");
  404. }).catch(function() {});
  405. },
  406. /** 导出按钮操作 */
  407. handleExport() {
  408. const queryParams = this.queryParams;
  409. this.$confirm('是否确认导出所有企业用户坐席数据项?', "警告", {
  410. confirmButtonText: "确定",
  411. cancelButtonText: "取消",
  412. type: "warning"
  413. }).then(function() {
  414. return exportCompanyVoiceCaller(queryParams);
  415. }).then(response => {
  416. this.download(response.msg);
  417. }).catch(function() {});
  418. }
  419. }
  420. };
  421. </script>
  422. <style scoped>
  423. .get-code{
  424. display: inline-block;
  425. text-align: center;
  426. font-size: 14px;
  427. color: #0051ff;
  428. cursor: pointer;
  429. }
  430. </style>