index.vue 27 KB

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