FastReply.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <template>
  2. <div class="row allAlignment" style=" position: relative;">
  3. <leftNav />
  4. <div>
  5. <hader />
  6. <messageCenter></messageCenter>
  7. <div>
  8. <el-container class="row">
  9. <!-- 私有库列表 -->
  10. <el-aside width="400px">
  11. <div class="tit">
  12. <span>私有库--快捷回复</span>
  13. </div>
  14. <!-- <div class="row library">
  15. <div class="line hover" @click="FastReplyLibrarySwitchClick(1)">
  16. <span :class="FastReplyLibrarySwitch==1?'acty':''">公有库</span>
  17. </div>
  18. <div class="hover" @click="FastReplyLibrarySwitchClick(2)">
  19. <span :class="FastReplyLibrarySwitch==2?'acty':''">私有库</span>
  20. </div>
  21. </div>
  22. <div class="search">
  23. <el-input placeholder="搜索快捷回复" suffix-icon="el-icon-search" v-model="leftSerch"></el-input>
  24. </div>
  25. <div class="phrases md20">
  26. <i class="el-icon-caret-bottom" style="color:#CCCCCC"></i>
  27. <span>常用语</span>
  28. </div> -->
  29. <div class="phrasesList md20">
  30. <!-- <div class="list row" v-for="(item) in ReplyArr" :key="item.id">
  31. <div style="width:100%;" class="row item-center allAlignment">
  32. <div>
  33. <span>#{{item.title}}</span>
  34. <span>{{item.content}}</span>
  35. </div>
  36. </div>
  37. </div> -->
  38. <!-- 私有库列表 -->
  39. <div class="list row" v-for="(item) in ReplyArr" :key="item.id">
  40. <div style="width:100%;" class="row item-center allAlignment" >
  41. <div class="row">
  42. <span class="ellipsis" style="display:block;max-width:100px;">#{{item.title}}</span>
  43. <span
  44. class="ellipsis"
  45. style="display:block;max-width:150px;margin-left:20px;"
  46. >{{item.content}}</span>
  47. </div>
  48. <div class="fnc">
  49. <i class="el-icon-edit-outline hover" style="margin-right:15px;" @click="popUpChange(item)"></i>
  50. <i class="el-icon-delete hover" @click="clickDel(item.id)"></i>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </el-aside>
  56. <!-- 私有库列表新增删除模块 -->
  57. <el-main style="width:35.4%;background:#f6f8ff;border-left:1px solid #D5E5FF;">
  58. <div class="mainTitle row rightAlignment">
  59. <!-- <div style="height:40px;width:238px;border:1px solid #ddd;">
  60. <input
  61. style="width:100%;height:100%;padding-left:10px;"
  62. placeholder="常用语组"
  63. type="text"
  64. v-model="matchingSerch"
  65. />
  66. <img style="width:16px;height:16px;" src="@/assets/img/serch.png" />
  67. </div> -->
  68. <div @click="popUpShow = true" class="row center hover"
  69. style="border-radius:5px;width:120px;margin-left:20px;height:40px;background:linear-gradient(180deg,rgba(245,245,245,1) 0%,rgba(238,238,238,1) 100%);border:1px solid #ddd;font-size:14px;color:#666;"
  70. >新增快捷回复</div>
  71. <div @click="deleteFastReply" class="row center hover"
  72. style="border-radius:5px;width:60px;margin-left:10px;height:40px;background:linear-gradient(180deg,rgba(245,245,245,1) 0%,rgba(238,238,238,1) 100%);border:1px solid #ddd;font-size:14px;color:#666;"
  73. >删除</div>
  74. </div>
  75. <div class="mainBox scroll">
  76. <el-form ref="form" label-width="80px">
  77. <el-form-item label>
  78. <el-checkbox-group v-model="deleteArr">
  79. <el-checkbox name="type" label="all" disabled>
  80. <!-- -->
  81. <div class="row" style="width:100%;height:100%;background:#E6EBFF;">
  82. <div style="color:#666;font-weight:bold;color:#666;width:100%; position: relative;">
  83. <p style="padding-right:40px;">快捷语</p>
  84. <p class="row item-center"style="color:#666;font-size:14px; position: absolute;left:16%;top:0;">回复内容</p>
  85. </div>
  86. </div>
  87. </el-checkbox>
  88. <el-checkbox name="type" :label="item.id" v-for="(item,index) in ReplyArr" :key="index">
  89. <div class="row" style="width:100%;height:100%;">
  90. <div style="color:#666;color:#666;width:100%; position: relative;">
  91. <!-- style="width:50px;" -->
  92. <p class="ellipsis">{{item.title}}</p>
  93. <p class="row item-center ellipsis addContent"
  94. >{{item.content}}</p>
  95. </div>
  96. </div>
  97. </el-checkbox>
  98. </el-checkbox-group>
  99. </el-form-item>
  100. </el-form>
  101. </div>
  102. </el-main>
  103. </el-container>
  104. </div>
  105. </div>
  106. <!-- 私有库新增模块窗口 -->
  107. <div class="popUp" v-if="popUpShow">
  108. <div class="popUpBg" @click="popUpEsc"></div>
  109. <div class="popUpBox column item-center">
  110. <p class="editor">添加新的快捷回复</p>
  111. <div class="popUpBoxData row center">
  112. <div>
  113. <div class="row">
  114. <p>类别<span>*</span></p>
  115. <!-- v-model="popUp.type" -->
  116. <el-select v-model="popUp.type" disabled placeholder="私人库模版" class="often">
  117. </el-select>
  118. </div>
  119. <div class="row" style="margin-top: 15px;">
  120. <p>关键词<span>*</span></p>
  121. <input class="oftenTitle" v-model="popUp.title" placeholder="请输入关键词" />
  122. </div>
  123. <div class="row" style="margin-top: 15px;">
  124. <p>回复内容<span>*</span></p>
  125. <textarea class="text" v-model="popUp.content" placeholder="请输入你要回复的内容"></textarea>
  126. </div>
  127. <div style="height:40px;margin-top:20px;" class="row average">
  128. <div @click="popUpEsc" class="row center hover"
  129. style="width:80px;height:40px;border:1px solid rgba(221,221,221,1);background:linear-gradient(180deg,rgba(245,245,245,1) 0%,rgba(238,238,238,1) 100%);border-radius:5px;font-size:16px;color:#666;"
  130. >取消</div>
  131. <div @click="newly()" class="row center hover"
  132. style="width:80px;height:40px;background:rgba(83,153,245,1);color:#FFF;border-radius:5px;font-size:16px;"
  133. >确定</div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. <!-- 私有库编辑模块窗口 -->
  140. <div class="popUp" v-if="popUpChangeShow">
  141. <div class="popUpBg" @click="popUpChangeShow = false,changePopUp = ''"></div>
  142. <div class="popUpBox column item-center">
  143. <p class="editor ">修改您的快捷回复</p>
  144. <div class="popUpBoxData row center">
  145. <div>
  146. <div class="row">
  147. <p>类别<span>*</span></p>
  148. <el-select disabled v-model="changePopUp.type" placeholder="私人库模版" class="often">
  149. </el-select>
  150. </div>
  151. <div class="row" style="margin-top: 15px;">
  152. <p>关键词<span>*</span></p>
  153. <input class="oftenTitle" v-model="changePopUp.title" placeholder="请输入关键词" />
  154. </div>
  155. <div class="row" style="margin-top: 15px;">
  156. <p>回复内容<span>*</span></p>
  157. <textarea class="text" v-model="changePopUp.content" placeholder="请输入你要回复的内容"></textarea>
  158. </div>
  159. <div style="height:40px;margin-top:20px;" class="row average ">
  160. <div
  161. @click="popUpChangeShow = false,changePopUp = ''"
  162. class="row center hover"
  163. style="width:80px;height:40px;border:1px solid rgba(221,221,221,1);background:linear-gradient(180deg,rgba(245,245,245,1) 0%,rgba(238,238,238,1) 100%);border-radius:5px;font-size:16px;color:#666;"
  164. >取消</div>
  165. <div
  166. @click="changeFastreply()"
  167. class="row center hover"
  168. style="width:80px;height:40px;background:rgba(83,153,245,1);color:#FFF;border-radius:5px;font-size:16px;"
  169. >确定</div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </template>
  177. <script>
  178. import "@/css/index.css";
  179. import leftNav from "@/components/leftNav";
  180. import hader from "@/components/hader";
  181. import messageCenter from "@/components/messageCenter";
  182. export default {
  183. name: "FastReply",
  184. data() {
  185. return {
  186. data: {},
  187. // FastReplyLibrarySwitch: 1,
  188. leftSerch: "", //左侧搜索
  189. matchingSerch: "", //右侧匹配搜索
  190. popUpShow: false, //添加常用语开关
  191. popUpChangeShow:false, // 修改常用语开关
  192. deleteArr: [],
  193. popUp: {
  194. //新增快捷回复
  195. status:1,
  196. content:'',//回复内容
  197. title:''//关键字
  198. },
  199. changePopUp:{ }, // 修改的快捷语
  200. ReplyArr: [], //快捷回复列表
  201. // page: 1, //分页
  202. // pageSize: 5, //分页大小
  203. // total: 25, //分页总条目
  204. time:{},
  205. };
  206. },
  207. methods: {
  208. /******************删除单条快捷回复*****************/
  209. clickDel(e){
  210. this.$confirm('您确定要删除该条快捷回复吗?', '提示', {
  211. confirmButtonText: '确定',
  212. cancelButtonText: '取消',
  213. type: 'warning'
  214. }).then(() => {
  215. this.deleteArr.push(e);
  216. this.deleteFastReply()
  217. }).catch(() => {
  218. this.$message({
  219. type: 'info',
  220. message: '已取消删除'
  221. });
  222. });
  223. },
  224. /******************显示编辑快捷窗口*******************/
  225. popUpChange(e){
  226. this.changePopUp = e;
  227. this.popUpChangeShow = true
  228. },
  229. /***********************提示信息集合*********************/
  230. succeed(num) {
  231. if (num == 1) {
  232. this.$notify({
  233. title: "成功",
  234. message: "操作成功",
  235. type: "success",
  236. duration: 1500
  237. });
  238. } else if (num == 2) {
  239. this.$notify({
  240. title: "错误",
  241. message: "操作失败",
  242. type: "error",
  243. duration: 1500
  244. });
  245. } else if (num == 3) {
  246. this.$notify({
  247. title: "警告",
  248. message: "请先核对再提交",
  249. type: "warning",
  250. duration: 1500
  251. });
  252. }
  253. },
  254. /********************关闭新增**********************/
  255. popUpEsc() {
  256. this.popUpShow = false;
  257. },
  258. // changePage(val) {
  259. // this.page = val;
  260. // },
  261. //
  262. /********************新增快捷回复******************/
  263. newly() {
  264. let obj = {
  265. headers: {
  266. apiToken: this.$md5("addwords" + "customer-service" + "words" + this.time[0] + "service"),
  267. userToken: this.token
  268. }
  269. };
  270. // this.popUp.status = 1;
  271. this.post("api"+ this.$ports.FastReply.addWords,this.popUp,obj).then(res => {
  272. if (res.data.code == 1) {
  273. this.succeed(1);
  274. this.ReplyArr.push({id:res.data.data.id,content:this.popUp.content,title:this.popUp.title});
  275. this.$set(this.popUp,'content','')
  276. this.$set(this.popUp,'title','')
  277. this.popUpShow = false;
  278. } else {
  279. this.succeed(2);
  280. }
  281. });
  282. },
  283. /**************查询快捷回复语列表***************/
  284. getFastReply() {
  285. let obj = {
  286. headers: {
  287. apiToken: this.$md5("userwords" + "customer-service" + "index" + this.time[0]+ "service"),
  288. userToken: this.token
  289. }
  290. };
  291. this.get("api" + this.$ports.FastReply.userWords, obj).then(res => {
  292. // console.log(res);
  293. if (res.data.code ==1) {
  294. //私有库
  295. this.ReplyArr = res.data.data.userWords; // res.data.data.sysWords
  296. }
  297. });
  298. },
  299. /********************删除快捷回复*****************/
  300. deleteFastReply() {
  301. let obj = {
  302. headers: {
  303. apiToken: this.$md5("deletewords" + "customer-service" + "words" + this.time[0] + "service"),
  304. userToken: this.token
  305. }
  306. };
  307. // console.log(this.deleteArr);
  308. if (this.deleteArr.length > 0) {
  309. this.post("api"+this.$ports.FastReply.deleteWords, this.deleteArr, obj).then(
  310. res => {
  311. if (res.data.code) {
  312. this.succeed(1);
  313. this.getFastReply();
  314. // this.showFastReply()
  315. } else {
  316. this.succeed(2);
  317. }
  318. }
  319. );
  320. } else {
  321. this.succeed(3);
  322. }
  323. },
  324. // // 库状态的更改
  325. // FastReplyLibrarySwitchClick(num) {
  326. // this.FastReplyLibrarySwitch = num;
  327. // },
  328. // 获取快捷语 用于展示(可修改)
  329. // showFastReply() {
  330. // let str =
  331. // "userwords" + "customer-service" + "index" + this.time + "service";
  332. // // str = str.toLowerCase();
  333. // let obj = {
  334. // headers: {
  335. // // "Content-Type": "application/x-www-form-urlencoded",
  336. // apiToken: this.$md5(str),
  337. // userToken: this.token
  338. // }
  339. // };
  340. // this.get("api/service/index/userWords", obj).then(res => {
  341. // if (res.data.code) {
  342. // this.data = res.data.data;
  343. // }
  344. // console.log(res);
  345. // });
  346. // },
  347. /********************修改快捷语********************/
  348. changeFastreply(){
  349. let obj = {
  350. headers: {
  351. apiToken: this.$md5("updatewords" + "customer-service" + "words" + this.time[0] + "service"),
  352. userToken: this.token
  353. }
  354. };
  355. this.post('api'+this.$ports.FastReply.updateWords,{
  356. id:this.changePopUp.id,
  357. content:this.changePopUp.content,
  358. status:1,
  359. title:this.changePopUp.title
  360. },obj).then((res)=>{
  361. if(res.data.code == 1){
  362. //this.getFastReply();
  363. // this.showFastReply();
  364. this.popUpChangeShow = false;
  365. this.changePopUp = '';
  366. this.succeed(1)
  367. }else{
  368. this.succeed(2)
  369. }
  370. //console.log(res)
  371. })
  372. }
  373. },
  374. mounted() {
  375. this.token = this.$store.getters.get_user_info.token ;
  376. this.time = JSON.parse(sessionStorage.getItem("time"));
  377. this.getFastReply();
  378. //this.showFastReply();
  379. },
  380. components: {
  381. leftNav,
  382. hader,
  383. messageCenter
  384. }
  385. };
  386. </script>
  387. <style>
  388. .hover:hover{
  389. cursor: pointer;
  390. }
  391. .editor{
  392. color:#666;
  393. font-size:16px;
  394. font-weight:bold;
  395. font-family:PingFang SC;
  396. text-align: center;
  397. margin-top:20px;
  398. }
  399. p {
  400. margin: 0;
  401. }
  402. .tit {
  403. padding-left: 20px;
  404. font-size: 14px;
  405. color: #666666;
  406. height: 50px;
  407. line-height: 50px;
  408. }
  409. .library {
  410. height: 50px;
  411. line-height: 50px;
  412. border: 1px solid #d5e5ff;
  413. border-right: none;
  414. }
  415. .library div {
  416. width: 50%;
  417. text-align: center;
  418. }
  419. /* .library div span {
  420. } */
  421. .line {
  422. position: relative;
  423. }
  424. .line::after {
  425. content: "";
  426. display: inline-block;
  427. width: 1px;
  428. height: 20px;
  429. line-height: 20px;
  430. background: #666666;
  431. position: absolute;
  432. right: 0;
  433. top: 15px;
  434. }
  435. .tit {
  436. padding-left: 20px;
  437. font-size: 14px;
  438. color: #666666;
  439. height: 50px;
  440. line-height: 50px;
  441. font-weight: bold;
  442. border-bottom: 1px solid #d5e5ff;
  443. }
  444. .library {
  445. height: 50px;
  446. line-height: 50px;
  447. border: 1px solid #d5e5ff;
  448. }
  449. .library div {
  450. width: 50%;
  451. text-align: center;
  452. }
  453. .library div span {
  454. color: #666666;
  455. font-size: 14px;
  456. padding-bottom: 13px;
  457. }
  458. div span.acty {
  459. color: #5399f5;
  460. border-bottom: 2px solid #5399f5;
  461. }
  462. .line {
  463. position: relative;
  464. }
  465. .line::after {
  466. content: "";
  467. display: inline-block;
  468. width: 1px;
  469. height: 20px;
  470. line-height: 20px;
  471. background: #666666;
  472. position: absolute;
  473. right: 0;
  474. top: 15px;
  475. }
  476. .search {
  477. margin: 20px 20px 22px;
  478. }
  479. .md20 {
  480. margin-left: 20px;
  481. margin-bottom: 20px;
  482. }
  483. .phrases span {
  484. color: #666666;
  485. font-size: 14px;
  486. }
  487. .list div span {
  488. color: #999999;
  489. font-size: 14px;
  490. }
  491. .list div span:nth-child(1) {
  492. color: #666666;
  493. font-weight: 400;
  494. }
  495. .list div {
  496. overflow: hidden;
  497. text-overflow: ellipsis;
  498. white-space: nowrap;
  499. }
  500. .fnc {
  501. margin-left: 37px;
  502. }
  503. .fnc i {
  504. color: #999999;
  505. display: inline-block;
  506. width: 20px;
  507. height: 20px;
  508. }
  509. /* main */
  510. .mainTitle {
  511. height: 60px;
  512. }
  513. .mainTitle div {
  514. position: relative;
  515. }
  516. .mainTitle div img {
  517. position: absolute;
  518. right: 12px;
  519. top: 0;
  520. bottom: 0;
  521. margin: auto 0;
  522. }
  523. .mainTitle div input {
  524. color: #ccc;
  525. }
  526. .mainTitle div input:focus {
  527. outline: none;
  528. color: #666;
  529. }
  530. .el-checkbox {
  531. width: 100%;
  532. }
  533. .el-form-item__content {
  534. margin-left: 0 !important;
  535. line-height: 0;
  536. height: 50px;
  537. }
  538. .el-checkbox {
  539. padding-left: 30px;
  540. height: 50px;
  541. display: flex;
  542. align-items: center;
  543. }
  544. /* .is-disabled{
  545. background: #E6EBFF;
  546. } */
  547. .el-checkbox:nth-child(even) {
  548. background: #fff;
  549. }
  550. .el-checkbox:nth-child(odd) {
  551. background: #eff2fd;
  552. }
  553. .el-checkbox:first-child {
  554. background: #e6ebff;
  555. }
  556. .el-form-item {
  557. margin-bottom: 0;
  558. }
  559. .el-main {
  560. overflow: visible;
  561. height: 92.1vh;
  562. }
  563. .el-checkbox__label {
  564. padding-left: 50px;
  565. display: block;
  566. width: 100%;
  567. }
  568. .mainBox {
  569. width: 100%;
  570. height: 80%;
  571. overflow-x: hidden;
  572. overflow-y: auto;
  573. margin-right: 0;
  574. }
  575. .addContent{
  576. color:#666;
  577. font-size:14px;
  578. position: absolute;
  579. left:16%;top:0;
  580. width:70%;
  581. overflow: hidden;
  582. text-overflow: ellipsis;
  583. white-space: nowrap;
  584. }
  585. .popUp {
  586. width: 100%;
  587. height: 100%;
  588. position: fixed;
  589. left: 0;
  590. top: 0;
  591. z-index: 99;
  592. }
  593. .popUpBg {
  594. width: 100%;
  595. height: 100%;
  596. background: rgba(0, 0, 0, 0.01);
  597. }
  598. .popUpBox {
  599. position: absolute;
  600. left: 0;
  601. right: 0;
  602. margin: auto auto;
  603. top: 0;
  604. bottom: 0;
  605. width: 380px;
  606. height: 400px;
  607. background: #fff;
  608. box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
  609. }
  610. .popUpBoxData {
  611. margin-top: 30px;
  612. /* padding: 0 44px; */
  613. }
  614. .popUpBoxData p {
  615. /* margin-top: 10px; */
  616. color: #666;
  617. font-size: 14px;
  618. /* height: 30px; */
  619. width: 92px;
  620. line-height: 40px;
  621. /* margin-bottom: 15px; */
  622. }
  623. .popUpBoxData p span {
  624. color: #f60;
  625. }
  626. .often {
  627. width: 200px;
  628. height: 40px;
  629. color: #999;
  630. position: relative;
  631. }
  632. .el-input__inner {
  633. border: 1px solid #ddd;
  634. border-radius: 0px;
  635. color: #666;
  636. padding-left: 7px;
  637. }
  638. .el-select-dropdown__item {
  639. padding-left: 10px;
  640. }
  641. .el-popper[x-placement^="bottom"] .popper__arrow::after {
  642. display: none;
  643. }
  644. .el-popper[x-placement^="bottom"] .popper__arrow {
  645. display: none;
  646. }
  647. .el-select .el-input__inner:focus {
  648. border-color: #ddd;
  649. }
  650. .el-select-dropdown {
  651. border-radius: 0;
  652. }
  653. .el-select .el-input.is-focus .el-input__inner {
  654. border-color: #ddd;
  655. }
  656. .el-popper[x-placement^="bottom"] {
  657. margin: 0;
  658. }
  659. .el-icon-arrow-up:before {
  660. content: "\E78F";
  661. color: #666;
  662. }
  663. .choose {
  664. width: 100%;
  665. position: absolute;
  666. left: 0;
  667. bottom: 0;
  668. background: #000;
  669. }
  670. .oftenTitle {
  671. width: 140px;
  672. height: 40px;
  673. border: 1px solid #ddd;
  674. padding-left: 7px;
  675. color: #999;
  676. }
  677. .oftenTitle:focus {
  678. outline: none;
  679. color: #666;
  680. }
  681. .el-input__inner::-webkit-input-placeholder {
  682. /* WebKit browsers */
  683. color: #666;
  684. }
  685. .text {
  686. width: 200px;
  687. height: 120px;
  688. resize: none;
  689. border: 1px solid #ddd;
  690. padding: 10px 7px;
  691. font-size: 14px;
  692. color: #999;
  693. }
  694. .list{
  695. line-height: 50px;
  696. }
  697. .phrasesList{
  698. padding-right: 20px;
  699. }
  700. .text:focus {
  701. outline: none;
  702. color: #666;
  703. }
  704. </style>