index-old.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  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="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入任务名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="机器人" prop="robot">
  14. <el-select v-model="queryParams.robot" filterable clearable>
  15. <el-option v-for="item in robotList" :label="item.name + '('+item.num+')'" :value="item.id"/>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="话术" prop="dialogId">
  19. <el-select v-model="queryParams.dialogId" filterable clearable>
  20. <el-option v-for="item in dialogList" :label="item.name" :value="item.id"/>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  25. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  26. </el-form-item>
  27. </el-form>
  28. <el-row :gutter="10" class="mb8">
  29. <el-col :span="1.5">
  30. <el-button
  31. type="primary"
  32. icon="el-icon-plus"
  33. size="mini"
  34. @click="handleAdd"
  35. v-hasPermi="['system:companyVoiceRobotic:add']"
  36. >新增
  37. </el-button>
  38. </el-col>
  39. <el-col :span="1.5">
  40. <el-button
  41. type="success"
  42. icon="el-icon-edit"
  43. size="mini"
  44. :disabled="single"
  45. @click="handleUpdate"
  46. v-hasPermi="['system:companyVoiceRobotic:edit']"
  47. >修改
  48. </el-button>
  49. </el-col>
  50. <el-col :span="1.5">
  51. <el-button
  52. type="danger"
  53. icon="el-icon-delete"
  54. size="mini"
  55. :disabled="multiple"
  56. @click="handleDelete"
  57. v-hasPermi="['system:companyVoiceRobotic:remove']"
  58. >删除
  59. </el-button>
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-button
  63. type="warning"
  64. icon="el-icon-download"
  65. size="mini"
  66. @click="handleExport"
  67. v-hasPermi="['system:companyVoiceRobotic:export']"
  68. >导出
  69. </el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="success"
  74. icon="el-icon-refresh"
  75. size="mini"
  76. @click="updateStatusFun"
  77. v-hasPermi="['system:companyVoiceRobotic:list']"
  78. >更新状态
  79. </el-button>
  80. </el-col>
  81. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  82. </el-row>
  83. <el-table v-loading="loading" :data="roboticList" @selection-change="handleSelectionChange">
  84. <el-table-column type="selection" width="55" align="center"/>
  85. <el-table-column label="ID" align="center" prop="id"/>
  86. <el-table-column label="任务名称" align="center" prop="name"/>
  87. <el-table-column label="三方名称" align="center" prop="taskName"/>
  88. <el-table-column label="三方ID" align="center" prop="taskId"/>
  89. <el-table-column label="机器人" align="center" prop="robot">
  90. <template slot-scope="scope">
  91. <p v-for="(item, index) in robotList" v-if="scope.row.robot && scope.row.robot == item.id">{{ item.name }}</p>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="话术" align="center" prop="dialogId">
  95. <template slot-scope="scope">
  96. <p v-for="(item, index) in dialogList" v-if="scope.row.dialogId && scope.row.dialogId == item.id">
  97. {{ item.name }}</p>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="加微方式" align="center" prop="dialogId">
  101. <template slot-scope="scope">
  102. <el-tag v-if="scope.row.addType == 0">平均</el-tag>
  103. <el-tag v-if="scope.row.addType == 1">意向</el-tag>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="工作日" align="center" prop="weekDay1">
  107. <template slot-scope="scope">
  108. <el-tag v-for="(item, index) in weekList"
  109. v-if="scope.row.weekDay1 && scope.row.weekDay1.indexOf(item.value) != -1">{{ item.label }}
  110. </el-tag>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="开始时间" align="center" prop="startTime1"/>
  114. <el-table-column label="结束时间" align="center" prop="endTime1"/>
  115. <el-table-column label="未分配数量" align="center">
  116. <template slot-scope="scope">
  117. <el-tag :type="Number(scope.row.num) > 0 ?'danger' : ''">{{scope.row.num}}个</el-tag>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="当前状态" align="center">
  121. <template slot-scope="scope">
  122. <div v-loading="loadingStatus">
  123. <p v-if="statusObj.hasOwnProperty(scope.row.taskId)">
  124. <el-tag v-if="statusObj[scope.row.taskId].runningStatus == 0">未启动</el-tag>
  125. <el-tag v-if="statusObj[scope.row.taskId].runningStatus == 1">运行中</el-tag>
  126. <el-tag v-if="statusObj[scope.row.taskId].runningStatus == 2">已暂停</el-tag>
  127. <el-tag v-if="statusObj[scope.row.taskId].runningStatus == 3">已停止</el-tag>
  128. </p>
  129. <p v-if="!statusObj.hasOwnProperty(scope.row.taskId)">
  130. <el-tag>空</el-tag>
  131. </p>
  132. </div>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  136. <template slot-scope="scope">
  137. <el-button
  138. size="mini"
  139. type="text"
  140. @click="calleesOpen(scope.row.id)"
  141. v-hasPermi="['system:companyVoiceRobotic:list']"
  142. >客户列表
  143. </el-button>
  144. <el-button
  145. size="mini"
  146. type="text"
  147. @click="wxOpen(scope.row.id)"
  148. v-hasPermi="['system:companyVoiceRobotic:list']"
  149. >加微统计
  150. </el-button>
  151. <el-button
  152. size="mini"
  153. type="text"
  154. v-if="statusObj.hasOwnProperty(scope.row.taskId) && (statusObj[scope.row.taskId].runningStatus == 0 || statusObj[scope.row.taskId].runningStatus == 3)"
  155. @click="startRoboticFun(scope.row.taskId)"
  156. v-hasPermi="['system:companyVoiceRobotic:list']"
  157. >启动任务
  158. </el-button>
  159. <el-button
  160. size="mini"
  161. type="text"
  162. v-if="statusObj.hasOwnProperty(scope.row.taskId) && (statusObj[scope.row.taskId].runningStatus == 1 || statusObj[scope.row.taskId].runningStatus == 2)"
  163. @click="stopRoboticFun(scope.row.taskId)"
  164. v-hasPermi="['system:companyVoiceRobotic:list']"
  165. >停止任务
  166. </el-button>
  167. <el-button
  168. size="mini"
  169. type="text"
  170. @click="addRoboticFun(scope.row)"
  171. v-hasPermi="['system:companyVoiceRobotic:edit']"
  172. >追加个微
  173. </el-button>
  174. <el-button
  175. size="mini"
  176. type="text"
  177. icon="el-icon-delete"
  178. @click="handleDelete(scope.row)"
  179. v-hasPermi="['system:companyVoiceRobotic:remove']"
  180. >删除
  181. </el-button>
  182. </template>
  183. </el-table-column>
  184. </el-table>
  185. <pagination
  186. v-show="total>0"
  187. :total="total"
  188. :page.sync="queryParams.pageNum"
  189. :limit.sync="queryParams.pageSize"
  190. @pagination="getList"
  191. />
  192. <!-- 添加或修改机器人外呼任务对话框 -->
  193. <el-drawer size="75%" :title="title" :visible.sync="open" width="500px" append-to-body>
  194. <div class="app-container">
  195. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  196. <el-form-item label="任务名称" prop="name">
  197. <el-input v-model="form.name" placeholder="请输入任务名称"/>
  198. </el-form-item>
  199. <el-form-item label="机器人" prop="robot">
  200. <el-select v-model="form.robot" filterable>
  201. <el-option v-for="item in robotList" :label="item.name + '('+item.num+')'" :value="item.id"/>
  202. </el-select>
  203. </el-form-item>
  204. <el-form-item label="话术" prop="dialogId">
  205. <el-select v-model="form.dialogId" filterable>
  206. <el-option v-for="item in dialogList" :label="item.name" :value="item.id"/>
  207. </el-select>
  208. </el-form-item>
  209. <el-form-item label="拨打客户" prop="userIds">
  210. <el-button @click="openSelect">选择客户({{ form.userIds ? form.userIds.length : 0 }})</el-button>
  211. </el-form-item>
  212. <el-form-item label="加微方式" prop="addType">
  213. <el-radio v-model="form.addType" :label="0">平均</el-radio>
  214. <el-radio v-model="form.addType" :label="1">意向</el-radio>
  215. </el-form-item>
  216. <el-form-item label="分配账号">
  217. <el-button @click="addQwUser">添加</el-button>
  218. <el-row :gutter="24" v-for="(item, index) in form.qwUser" style="margin-top: 5px">
  219. <el-col :span="5">
  220. <el-select v-model="item.intention" placeholder="意向等级" filterable clearable>
  221. <el-option v-for="item in levelList" :label="item.dictLabel" :value="item.dictLabel"/>
  222. </el-select>
  223. </el-col>
  224. <el-col :span="4">
  225. <el-button @click="openQwUserSelect(index)">
  226. 选择个微({{ item.companyUserId ? item.companyUserId.length : 0 }})
  227. </el-button>
  228. </el-col>
  229. <el-col :span="5">
  230. <el-select v-model="item.wxDialogId" placeholder="话术" filterable>
  231. <el-option v-for="item in wxDialogList" :label="item.name" :value="item.id"/>
  232. </el-select>
  233. </el-col>
  234. <el-col :span="3">
  235. <el-button type="danger" icon="el-icon-delete" circle @click="removeQwUser(index)"></el-button>
  236. </el-col>
  237. </el-row>
  238. </el-form-item>
  239. <el-form-item label="模式" prop="mode">
  240. <el-select v-model="form.mode">
  241. <el-option label="呼叫机器人后挂断" :value="7"/>
  242. </el-select>
  243. </el-form-item>
  244. <el-form-item label="呼叫倍率" prop="multiplier">
  245. <el-select v-model="form.multiplier">
  246. <el-option :value="1"/>
  247. <el-option :value="2"/>
  248. <el-option :value="3"/>
  249. <el-option :value="4"/>
  250. <el-option :value="5"/>
  251. </el-select>
  252. </el-form-item>
  253. <el-form-item label="自动重呼" prop="autoRecall">
  254. <el-radio v-model="form.autoRecall" label="0">否</el-radio>
  255. <el-radio v-model="form.autoRecall" label="1">是</el-radio>
  256. </el-form-item>
  257. <el-form-item label="重呼次数" prop="recallTimes" v-if="form.autoRecall == 1">
  258. <el-select v-model="form.recallTimes">
  259. <el-option label="不自动重呼" :value="0"/>
  260. <el-option :value="1"/>
  261. <el-option :value="2"/>
  262. <el-option :value="3"/>
  263. <el-option :value="4"/>
  264. <el-option :value="5"/>
  265. </el-select>
  266. </el-form-item>
  267. <el-form-item label="工作日" prop="weekDay">
  268. <el-select v-model="form.weekDay" multiple style="width: 100%">
  269. <el-option v-for="item in weekList" :label="item.label" :value="item.value"/>
  270. </el-select>
  271. </el-form-item>
  272. <el-form-item label="开始时间" prop="startTime1">
  273. <el-time-select
  274. v-model="form.startTime1"
  275. format="HH:mm"
  276. value-format="HH:mm:00"
  277. :picker-options="{
  278. start: '00:00',
  279. end: '23:59',
  280. step: '00:30',
  281. }"
  282. placeholder="请选择开始时间">
  283. </el-time-select>
  284. </el-form-item>
  285. <el-form-item label="结束时间" prop="endTime1">
  286. <el-time-select
  287. v-model="form.endTime1"
  288. format="HH:mm"
  289. value-format="HH:mm:00"
  290. :picker-options="{
  291. start: '00:00',
  292. end: '23:59',
  293. step: '00:30',
  294. minTime: form.startTime1
  295. }"
  296. placeholder="请选择结束时间">
  297. </el-time-select>
  298. </el-form-item>
  299. </el-form>
  300. <div slot="footer" class="dialog-footer">
  301. <el-button type="primary" @click="submitForm">确 定</el-button>
  302. <el-button @click="cancel">取 消</el-button>
  303. </div>
  304. </div>
  305. </el-drawer>
  306. <customer-select @success="selectFun" ref="customer"/>
  307. <qw-user-select @success="selectQwUserFun" ref="qwUserSelect"/>
  308. <qw-user-select @success="selectQwUserFunTow" ref="qwUserSelectTow"/>
  309. <el-drawer title="呼叫客户列表" size="60%" :visible.sync="callees.show" width="800px" append-to-body>
  310. <el-table v-loading="callees.loading" :data="callees.list">
  311. <el-table-column label="电话号码" align="center" prop="phone"/>
  312. <el-table-column label="客户名称" align="center" prop="userName"/>
  313. <el-table-column label="客户ID" align="center" prop="userId"/>
  314. <el-table-column label="是否回调" align="center">
  315. <template slot-scope="scope">
  316. <el-tag v-if="scope.row.result == 0">否</el-tag>
  317. <el-tag v-if="scope.row.result == 1">是</el-tag>
  318. </template>
  319. </el-table-column>
  320. <el-table-column label="意向等级" align="center" prop="intention"/>
  321. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  322. <template slot-scope="scope">
  323. <el-button
  324. size="mini"
  325. type="text"
  326. @click="openCustomer(scope.row.userId)"
  327. >客户信息详情
  328. </el-button>
  329. </template>
  330. </el-table-column>
  331. </el-table>
  332. <pagination
  333. v-show="callees.total>0"
  334. :total="callees.total"
  335. :page.sync="callees.queryParams.pageNum"
  336. :limit.sync="callees.queryParams.pageSize"
  337. @pagination="getCalleesList"
  338. />
  339. </el-drawer>
  340. <el-drawer title="加微详情" size="60%" :visible.sync="wx.show" append-to-body>
  341. <el-table v-loading="wx.loading" :data="wx.list">
  342. <el-table-column label="意向等级" align="center" prop="intention"/>
  343. <el-table-column label="微信昵称" align="center" prop="wxNickName"/>
  344. <el-table-column label="微信号" align="center" prop="wxNo"/>
  345. <el-table-column label="手机号" align="center" prop="phone"/>
  346. <el-table-column label="员工名称" align="center" prop="companyUserName"/>
  347. <el-table-column label="话术" align="center" prop="dialogName"/>
  348. <el-table-column label="分配数量" align="center" prop="num"/>
  349. <el-table-column label="添加数量" align="center" prop="addNum"/>
  350. </el-table>
  351. <pagination
  352. v-show="wx.total>0"
  353. :total="wx.total"
  354. :page.sync="wx.queryParams.pageNum"
  355. :limit.sync="wx.queryParams.pageSize"
  356. @pagination="getWxList"
  357. />
  358. </el-drawer>
  359. <el-drawer size="75%" title="客户详情" :visible.sync="customerDetailShow" append-to-body>
  360. <customer-details ref="customerDetails"/>
  361. </el-drawer>
  362. <!-- 添加或修改添加个微信账号对话框 -->
  363. <el-dialog title="追加个微" :visible.sync="openAdd" width="75%" append-to-body>
  364. <el-form ref="form" :model="formOpen" label-width="80px">
  365. <el-form-item label="分配账号">
  366. <el-button @click="addQwUserTow">添加</el-button>
  367. <el-row :gutter="24" v-for="(item, index) in formOpen.qwUser" style="margin-top: 5px">
  368. <el-col :span="5">
  369. <el-select v-model="item.intention" placeholder="意向等级" filterable clearable>
  370. <el-option v-for="item in levelList" :label="item.dictLabel" :value="item.dictLabel"/>
  371. </el-select>
  372. </el-col>
  373. <el-col :span="5">
  374. <el-button @click="openQwUserSelectTow(index)">
  375. 选择企微({{ item.companyUserId ? item.companyUserId.length : 0 }})
  376. </el-button>
  377. </el-col>
  378. <el-col :span="5">
  379. <el-select v-model="item.wxDialogId" placeholder="话术" filterable>
  380. <el-option v-for="item in wxDialogList" :label="item.name" :value="item.id"/>
  381. </el-select>
  382. </el-col>
  383. <el-col :span="3">
  384. <el-button type="danger" icon="el-icon-delete" circle
  385. @click="removeQwUser(index)"></el-button>
  386. </el-col>
  387. </el-row>
  388. </el-form-item>
  389. </el-form>
  390. <div slot="footer" class="dialog-footer">
  391. <el-button type="primary" @click="submitFormTow">确 定</el-button>
  392. <el-button @click="openAdd = false">取 消</el-button>
  393. </div>
  394. </el-dialog>
  395. </div>
  396. </template>
  397. <script>
  398. import {
  399. listRobotic,
  400. getRobotic,
  401. delRobotic,
  402. addRobotic,
  403. updateRobotic,
  404. exportRobotic,
  405. calleesList,
  406. statusList,
  407. startRobotic,
  408. stopRobotic,
  409. addScheme,
  410. companyUserList,
  411. wxList,
  412. getTypes
  413. } from "@/api/company/companyVoiceRobotic";
  414. import {listAll} from '@/api/company/wxDialog';
  415. import customerSelect from '@/views/crm/components/CustomerSelect.vue';
  416. import qwUserSelect from '@/views/components/QwUserSelect.vue';
  417. import customerDetails from "@/views/crm/components/customerDetails.vue";
  418. import {clearTime} from "element-ui";
  419. import {getDicts} from "@/api/system/dict/data";
  420. export default {
  421. name: "Robotic",
  422. components: {customerDetails, customerSelect, qwUserSelect},
  423. data() {
  424. return {
  425. // 遮罩层
  426. loading: true,
  427. // 选中数组
  428. ids: [],
  429. weekList: [
  430. {label: "星期一", value: 1},
  431. {label: "星期二", value: 2},
  432. {label: "星期三", value: 3},
  433. {label: "星期四", value: 4},
  434. {label: "星期五", value: 5},
  435. {label: "星期六", value: 6},
  436. {label: "星期日", value: 0},
  437. ],
  438. // 非单个禁用
  439. single: true,
  440. // 非多个禁用
  441. multiple: true,
  442. // 显示搜索条件
  443. showSearch: true,
  444. loadingStatus: true,
  445. // 总条数
  446. total: 0,
  447. // 机器人外呼任务表格数据
  448. roboticList: [],
  449. userTableList: [],
  450. // 弹出层标题
  451. title: "",
  452. // 是否显示弹出层
  453. open: false,
  454. openAdd: false,
  455. // 查询参数
  456. queryParams: {
  457. pageNum: 1,
  458. pageSize: 10,
  459. name: null,
  460. taskName: null,
  461. taskId: null,
  462. robot: null,
  463. dialogId: null,
  464. mode: null,
  465. multiplier: null,
  466. autoRecall: null,
  467. recallTimes: null,
  468. cidGroupId: null,
  469. weekDay1: null,
  470. startTime1: null,
  471. endTime1: null,
  472. weekDay2: null,
  473. startTime2: null,
  474. endTime2: null,
  475. createUser: null
  476. },
  477. // 表单参数
  478. form: {},
  479. formOpen: {},
  480. statusObj: {},
  481. levelList: {},
  482. robotList: [],
  483. dialogList: [],
  484. wxDialogList: [],
  485. qwUserList: [],
  486. selectQwUserList: [],
  487. thisQwUserIndex: 0,
  488. updateTime: null,
  489. customer: {
  490. show: false,
  491. },
  492. customerDetailShow: false,
  493. callees: {
  494. show: false,
  495. list: [],
  496. loading: false,
  497. total: 0,
  498. queryParams: {
  499. id: null,
  500. pageNum: 1,
  501. pageSize: 10,
  502. },
  503. },
  504. wx: {
  505. show: false,
  506. list: [],
  507. loading: false,
  508. total: 0,
  509. queryParams: {
  510. id: null,
  511. pageNum: 1,
  512. pageSize: 10,
  513. },
  514. },
  515. // 表单校验
  516. rules: {}
  517. };
  518. },
  519. created() {
  520. getTypes().then(e => {
  521. this.robotList = e.robot;
  522. this.dialogList = e.dialog;
  523. })
  524. listAll().then(e => {
  525. this.wxDialogList = e.data;
  526. })
  527. companyUserList().then(e => {
  528. this.qwUserList = e.data;
  529. })
  530. getDicts("customer_intention_level").then(e => {
  531. this.levelList = e.data;
  532. })
  533. this.getList();
  534. },
  535. methods: {
  536. /** 查询机器人外呼任务列表 */
  537. getList() {
  538. this.loading = true;
  539. listRobotic(this.queryParams).then(response => {
  540. this.roboticList = response.rows;
  541. this.roboticList.forEach(e => {
  542. if (e.weekDay1) {
  543. e.weekDay = e.weekDay1.split(",")
  544. }
  545. })
  546. this.total = response.total;
  547. this.loading = false;
  548. this.updateStatusFun();
  549. });
  550. },
  551. updateStatusFun() {
  552. if (!this.roboticList) {
  553. return;
  554. }
  555. this.loadingStatus = true;
  556. statusList(this.roboticList.map(e => e.taskId).join()).then(e => {
  557. this.loadingStatus = false;
  558. this.statusObj = e.data;
  559. });
  560. },
  561. // 取消按钮
  562. cancel() {
  563. this.open = false;
  564. this.reset();
  565. },
  566. // 表单重置
  567. reset() {
  568. this.form = {
  569. id: null,
  570. name: null,
  571. taskName: null,
  572. taskId: null,
  573. robot: null,
  574. dialogId: null,
  575. mode: null,
  576. multiplier: null,
  577. autoRecall: null,
  578. recallTimes: null,
  579. cidGroupId: null,
  580. weekDay1: null,
  581. startTime1: null,
  582. addType: 0,
  583. endTime1: null,
  584. weekDay2: null,
  585. startTime2: null,
  586. endTime2: null,
  587. createTime: null,
  588. qwUser: [],
  589. createUser: null
  590. };
  591. this.resetForm("form");
  592. },
  593. /** 搜索按钮操作 */
  594. handleQuery() {
  595. this.queryParams.pageNum = 1;
  596. this.getList();
  597. },
  598. /** 重置按钮操作 */
  599. resetQuery() {
  600. this.resetForm("queryForm");
  601. this.handleQuery();
  602. },
  603. // 多选框选中数据
  604. handleSelectionChange(selection) {
  605. this.ids = selection.map(item => item.id)
  606. this.single = selection.length !== 1
  607. this.multiple = !selection.length
  608. },
  609. /** 新增按钮操作 */
  610. handleAdd() {
  611. this.reset();
  612. this.open = true;
  613. this.title = "添加机器人外呼任务";
  614. },
  615. /** 修改按钮操作 */
  616. handleUpdate(row) {
  617. this.reset();
  618. const id = row.id || this.ids
  619. getRobotic(id).then(response => {
  620. this.form = response.data;
  621. this.open = true;
  622. this.title = "修改机器人外呼任务";
  623. });
  624. },
  625. /** 提交按钮 */
  626. submitForm() {
  627. this.$refs["form"].validate(valid => {
  628. if (valid) {
  629. if (this.form.weekDay && this.form.weekDay.length > 0) {
  630. this.form.weekDay1 = this.form.weekDay.join(",")
  631. }
  632. let list = [];
  633. this.form.qwUser.forEach(l => {
  634. list = list.concat(l.companyUserId.map(e => {
  635. return {intention: l.intention, companyUserId: e, wxDialogId: l.wxDialogId}
  636. }))
  637. })
  638. this.form.qwUserList = list;
  639. if (!this.form.qwUserList || this.form.qwUserList.length == 0) {
  640. this.msgError("请选者加微方案");
  641. return;
  642. }
  643. if (this.form.id != null) {
  644. updateRobotic(this.form).then(response => {
  645. if (response.code === 200) {
  646. this.msgSuccess("修改成功");
  647. this.open = false;
  648. this.getList();
  649. }
  650. });
  651. } else {
  652. addRobotic(this.form).then(response => {
  653. if (response.code === 200) {
  654. this.msgSuccess("新增成功");
  655. this.open = false;
  656. this.getList();
  657. }
  658. });
  659. }
  660. }
  661. });
  662. },
  663. /** 提交按钮 */
  664. submitFormTow() {
  665. let list = [];
  666. this.formOpen.qwUser.forEach(l => {
  667. list = list.concat(l.companyUserId.map(e => {
  668. return {intention: l.intention, companyUserId: e, wxDialogId: l.wxDialogId}
  669. }))
  670. })
  671. this.formOpen.qwUserList = list;
  672. if (!this.formOpen.qwUserList || this.formOpen.qwUserList.length == 0) {
  673. this.msgError("请选者加微方案");
  674. return;
  675. }
  676. addScheme(this.formOpen).then(response => {
  677. if (response.code === 200) {
  678. this.msgSuccess("修改成功");
  679. this.open = false;
  680. this.getList();
  681. }
  682. });
  683. },
  684. /** 删除按钮操作 */
  685. handleDelete(row) {
  686. const ids = row.id || this.ids;
  687. this.$confirm('是否确认删除机器人外呼任务编号为"' + ids + '"的数据项?', "警告", {
  688. confirmButtonText: "确定",
  689. cancelButtonText: "取消",
  690. type: "warning"
  691. }).then(function () {
  692. return delRobotic(ids);
  693. }).then(() => {
  694. this.getList();
  695. this.msgSuccess("删除成功");
  696. }).catch(function () {
  697. });
  698. },
  699. /** 导出按钮操作 */
  700. handleExport() {
  701. const queryParams = this.queryParams;
  702. this.$confirm('是否确认导出所有机器人外呼任务数据项?', "警告", {
  703. confirmButtonText: "确定",
  704. cancelButtonText: "取消",
  705. type: "warning"
  706. }).then(function () {
  707. return exportRobotic(queryParams);
  708. }).then(response => {
  709. this.download(response.msg);
  710. }).catch(function () {
  711. });
  712. },
  713. openSelect() {
  714. this.$refs.customer.setRows(this.form.userTableList);
  715. },
  716. openQwUserSelectTow(index) {
  717. this.thisQwUserIndex = index;
  718. this.$nextTick(() => {
  719. this.$refs.qwUserSelectTow.setRows(this.selectQwUserList[index]);
  720. })
  721. },
  722. openQwUserSelect(index) {
  723. this.thisQwUserIndex = index;
  724. this.$nextTick(() => {
  725. this.$refs.qwUserSelect.setRows(this.selectQwUserList[index]);
  726. })
  727. },
  728. selectFun(e) {
  729. this.form.userIds = e.ids;
  730. this.form.userNames = e.names;
  731. this.form.userTableList = e.rows;
  732. this.$forceUpdate()
  733. },
  734. selectQwUserFunTow(e) {
  735. console.info(this.formOpen.qwUser[this.thisQwUserIndex])
  736. this.formOpen.qwUser[this.thisQwUserIndex].companyUserId = e.ids;
  737. console.info(this.formOpen)
  738. this.selectQwUserList[this.thisQwUserIndex] = e.rows;
  739. this.$forceUpdate()
  740. },
  741. selectQwUserFun(e) {
  742. this.form.qwUser[this.thisQwUserIndex].companyUserId = e.ids;
  743. this.selectQwUserList[this.thisQwUserIndex] = e.rows;
  744. this.$forceUpdate()
  745. },
  746. calleesOpen(id) {
  747. this.callees.show = true;
  748. this.callees.queryParams.id = id;
  749. this.getCalleesList();
  750. },
  751. getCalleesList() {
  752. this.callees.loading = true;
  753. calleesList(this.callees.queryParams).then(response => {
  754. this.callees.list = response.rows;
  755. this.callees.total = response.total;
  756. this.callees.loading = false;
  757. });
  758. },
  759. wxOpen(id) {
  760. this.wx.show = true;
  761. this.wx.queryParams.id = id;
  762. this.getWxList();
  763. },
  764. getWxList() {
  765. this.wx.loading = true;
  766. wxList(this.wx.queryParams).then(response => {
  767. this.wx.list = response.rows;
  768. this.wx.total = response.total;
  769. this.wx.loading = false;
  770. });
  771. },
  772. openCustomer(id) {
  773. this.customerDetailShow = true;
  774. this.$nextTick(() => {
  775. this.$refs.customerDetails.getDetails(id);
  776. })
  777. },
  778. startRoboticFun(id) {
  779. startRobotic(id).then(e => {
  780. this.updateStatusFun();
  781. })
  782. },
  783. stopRoboticFun(id) {
  784. stopRobotic(id).then(e => {
  785. this.updateStatusFun();
  786. })
  787. },
  788. addQwUserTow(row) {
  789. this.formOpen.qwUser.push({});
  790. },
  791. addRoboticFun(row) {
  792. this.openAdd = true;
  793. this.formOpen = {id: row.id, qwUser: []};
  794. },
  795. addQwUser() {
  796. this.form.qwUser.push({});
  797. },
  798. removeQwUser(index) {
  799. this.form.qwUser.splice(index, 1)
  800. }
  801. }
  802. };
  803. </script>