index.vue 27 KB

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