index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeName" >
  4. <el-tab-pane label="客户管理配置" name="sysConfig">
  5. <el-form ref="sysConfig" :model="sysConfig" label-width="120px">
  6. <el-form-item label="公海回收规则">
  7. <el-row>
  8. <el-input-number v-model="sysConfig.visitLimt" :min="0" :max="100" ></el-input-number>
  9. </el-row>
  10. <el-row>
  11. <span class="tip">认领后N天自动回收</span>
  12. </el-row>
  13. </el-form-item>
  14. <div class="line"></div>
  15. <div style="float:right;margin-right:20px">
  16. <el-button type="primary" @click="onSubmit1">提交</el-button>
  17. </div>
  18. </el-form>
  19. </el-tab-pane>
  20. <el-tab-pane label="企微客服配置" name="qwkfConfig">
  21. <el-form ref="qwkfConfig" :model="qwkfConfig" label-width="120px">
  22. <el-form-item label="企业CoripID">
  23. <el-input v-model="qwkfConfig.corpId" style="width:400px" ></el-input>
  24. </el-form-item>
  25. <el-form-item label="Secret">
  26. <el-input v-model="qwkfConfig.secret" style="width:400px" ></el-input>
  27. </el-form-item>
  28. <el-form-item label="Token">
  29. <el-input v-model="qwkfConfig.token" style="width:400px" ></el-input>
  30. </el-form-item>
  31. <el-form-item label="EncodingAESKey">
  32. <el-input v-model="qwkfConfig.encodingAESKey" style="width:400px" ></el-input>
  33. </el-form-item>
  34. <el-form-item label="回调地接">
  35. <el-input disabled v-model="qwkfConfig.notifyUrl" style="width:600px" ></el-input>
  36. </el-form-item>
  37. <div class="line"></div>
  38. <div style="float:right;margin-right:20px">
  39. <el-button type="primary" @click="onSubmit3">提交</el-button>
  40. </div>
  41. </el-form>
  42. </el-tab-pane>
  43. <el-tab-pane label="客户字段配置" name="customerExt">
  44. <el-row :gutter="10" class="mb8" style="margin:0px 0px 10px;">
  45. <el-col :span="1.5">
  46. <el-button
  47. type="primary"
  48. icon="el-icon-plus"
  49. size="mini"
  50. @click="handleCustomerExtAdd"
  51. >新增</el-button>
  52. </el-col>
  53. </el-row>
  54. <el-table border :data="customerExtList" >
  55. <el-table-column label="ID" align="center" prop="extId" />
  56. <el-table-column label="字段名称" align="center" prop="name" />
  57. <el-table-column label="状态" align="center" prop="status">
  58. <template slot-scope="scope">
  59. <el-tag prop="status" v-for="(item, index) in statusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="排序号" align="center" prop="sort" />
  63. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  64. <template slot-scope="scope">
  65. <el-button
  66. size="mini"
  67. type="text"
  68. icon="el-icon-edit"
  69. @click="handleCustomerExtUpdate(scope.row)"
  70. >修改</el-button>
  71. <el-button
  72. size="mini"
  73. type="text"
  74. icon="el-icon-delete"
  75. @click="handleCustomerExtDelete(scope.row)"
  76. >删除</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <div class="line"></div>
  81. <div style="float:right;margin-right:20px">
  82. <el-button type="primary" @click="onSubmit2">提交</el-button>
  83. </div>
  84. </el-tab-pane>
  85. <el-tab-pane label="企微配置" name="qwConfig">
  86. <el-form ref="qwConfig" :model="qwConfig" label-width="200px">
  87. <el-form-item label="企业CoripID">
  88. <el-input v-model="qwConfig.corpId" style="width:400px" ></el-input>
  89. </el-form-item>
  90. <el-form-item label="通讯录Secret">
  91. <el-input v-model="qwConfig.bookSecret" style="width:400px" ></el-input>
  92. </el-form-item>
  93. <el-form-item label="应用Secret">
  94. <el-input v-model="qwConfig.appSecret" style="width:400px" ></el-input>
  95. </el-form-item>
  96. <el-form-item label="应用AgentId">
  97. <el-input v-model="qwConfig.AgentId" style="width:400px" ></el-input>
  98. </el-form-item>
  99. <el-form-item label="Token">
  100. <el-input v-model="qwConfig.token" style="width:400px" :readonly="true"></el-input>
  101. </el-form-item>
  102. <el-form-item label="EncodingAESKey">
  103. <el-input v-model="qwConfig.encodingAESKey" style="width:400px" :readonly="true"></el-input>
  104. </el-form-item>
  105. <el-form-item label="域名地址">
  106. <el-input v-model="qwConfig.realmNameURL" style="width:600px"></el-input>
  107. </el-form-item>
  108. <el-form-item label="回调地接">
  109. <el-input v-model="qwConfig.notifyUrl" style="width:600px" :readonly="true"></el-input>
  110. </el-form-item>
  111. <el-form-item label="聊天工具栏跳转地址">
  112. <el-input v-model="qwConfig.chatToolbar" style="width:600px" :readonly="true"></el-input>
  113. </el-form-item>
  114. <el-form-item label="聊天工具栏实际运用地址">
  115. <el-input v-model="qwConfig.chatToolbarOAuth2" :rows="2" type="textarea" style="width:1000px;" :readonly="true"></el-input>
  116. </el-form-item>
  117. <div class="line"></div>
  118. <div style="float:right;margin-right:20px">
  119. <el-button type="primary" @click="onSubmit4">提交</el-button>
  120. </div>
  121. </el-form>
  122. </el-tab-pane>
  123. <el-tab-pane label="AI客服配置" name="AiKfConfig">
  124. <el-form ref="AiKfConfig" :model="AiKfConfig" label-width="120px">
  125. <el-form-item label="通用Key">
  126. <el-input v-model="AiKfConfig.Key" style="width:600px" ></el-input>
  127. </el-form-item>
  128. <el-form-item label="调用地址">
  129. <el-input v-model="AiKfConfig.url" style="width:600px" ></el-input>
  130. </el-form-item>
  131. <div class="line"></div>
  132. <div style="float:right;margin-right:20px">
  133. <el-button type="primary" @click="onSubmit5">提交</el-button>
  134. </div>
  135. </el-form>
  136. </el-tab-pane>
  137. <el-tab-pane label="配置销售会员审核" name="companyUserConfig">
  138. <el-form ref="companyUserConfig" label-width="140px">
  139. <el-form-item label="会员是否默认黑名单">
  140. <el-row>
  141. <el-switch v-model="userIsDefaultBlack"></el-switch>
  142. </el-row>
  143. </el-form-item>
  144. <div style="float:right;margin-right:20px">
  145. <el-button type="primary" @click="onSubmit6">提交</el-button>
  146. </div>
  147. </el-form>
  148. </el-tab-pane>
  149. </el-tabs>
  150. <el-dialog :title="customerExt.title" :visible.sync="customerExt.open" width="500px" append-to-body>
  151. <el-form ref="customerExtForm" :model="customerExtForm" :rules="customerExtRules" label-width="80px">
  152. <el-form-item label="字段名称" prop="name">
  153. <el-input v-model="customerExtForm.name" placeholder="请输入字段名称" />
  154. </el-form-item>
  155. <el-form-item label="状态">
  156. <el-radio-group v-model="customerExtForm.status">
  157. <el-radio label="1" >正常</el-radio>
  158. <el-radio label="0">禁用</el-radio>
  159. </el-radio-group>
  160. </el-form-item>
  161. <el-form-item label="排序号" prop="sort">
  162. <el-input-number v-model="customerExtForm.sort" :min="1" placeholder="请输入排序号" />
  163. </el-form-item>
  164. </el-form>
  165. <div slot="footer" class="dialog-footer">
  166. <el-button type="primary" @click="submitCustomerExtForm">确 定</el-button>
  167. <el-button @click="customerExt.open=false">取 消</el-button>
  168. </div>
  169. </el-dialog>
  170. </div>
  171. </template>
  172. <script>
  173. import { getCompanyInfo } from "@/api/company/company";
  174. import { getConfigKey,updateConfig,configUserCheck } from "@/api/company/companyConfig";
  175. import { listCustomerExt, getCustomerExt, delCustomerExt, addCustomerExt, updateCustomerExt } from "@/api/crm/customerExt";
  176. export default {
  177. name: "config",
  178. watch: {
  179. qwConfig: {
  180. handler(newValue) {
  181. // 根据新值更新
  182. this.qwConfig.chatToolbarOAuth2="https://open.weixin.qq.com/connect/oauth2/authorize?" +
  183. "appid="+newValue.corpId+"" +
  184. "&redirect_uri="+newValue.chatToolbar+"" +
  185. "&response_type=code" +
  186. "&scope=snsapi_base" +
  187. "&state=STATE" +
  188. "&agentid="+newValue.AgentId+"#wechat_redirect";
  189. this.qwConfig.notifyUrl=newValue.realmNameURL+"/qw/data/"+this.company.companyId;
  190. },
  191. deep: true
  192. }
  193. },
  194. data() {
  195. return {
  196. company:null,
  197. statusOptions:[],
  198. customerExt:{
  199. open:false,
  200. title:"扩展字段"
  201. },
  202. customerExtForm:{
  203. name:"",
  204. status:"1",
  205. sort:"1",
  206. },
  207. customerExtRules:{
  208. },
  209. customerExtList: [],
  210. activeName: 'sysConfig',
  211. customerConfig:{
  212. rlLimit: 1,
  213. txLimit: 1,
  214. hsLimit: 1
  215. },
  216. sysConfig:{
  217. tel:"18900000000",
  218. noticeType:1,
  219. visitLimt:0,
  220. contractLimt:0
  221. },
  222. sysConfigForm:{},
  223. customerConfigForm:{},
  224. qwkfConfig:{
  225. },
  226. AiKfConfig:{},
  227. AiKfConfigForm:{},
  228. qwConfig:{
  229. },
  230. qwConfigForm:{},
  231. qwkfConfigForm:{},
  232. companyUserConfig: {},
  233. userIsDefaultBlack: null,
  234. };
  235. },
  236. created() {
  237. this.getCompanyInfo();
  238. this.getConfigKey("sys:config");
  239. this.getConfigKey("qw:config");
  240. this.getConfigKey("sys:qw:config");
  241. this.getConfigKey("customer:config");
  242. this.getConfigKey("sys:AiKf:config");
  243. this.getDicts("sys_company_status").then((response) => {
  244. this.statusOptions = response.data;
  245. });
  246. this.getCustomerExt()
  247. },
  248. mounted() {
  249. },
  250. methods: {
  251. getCompanyInfo(){
  252. getCompanyInfo().then(response => {
  253. this.company = response.data;
  254. if(response.data.fsUserIsDefaultBlack != null){
  255. const userIsDefaultBlack = response.data.fsUserIsDefaultBlack
  256. if(userIsDefaultBlack == 1){
  257. this.userIsDefaultBlack = true
  258. } else{
  259. this.userIsDefaultBlack = false
  260. }
  261. }
  262. });
  263. },
  264. /** 新增按钮操作 */
  265. handleCustomerExtAdd() {
  266. this.customerExt.open = true;
  267. this.customerExt.title = "添加客户字段";
  268. this.customerExtForm={
  269. name:"",
  270. status:"1",
  271. sort:"1",
  272. }
  273. },
  274. /** 修改按钮操作 */
  275. handleCustomerExtUpdate(row) {
  276. const extId = row.extId
  277. getCustomerExt(extId).then(response => {
  278. this.customerExtForm = response.data;
  279. this.customerExt.open = true;
  280. this.customerExtForm.status = response.data.status.toString();
  281. this.customerExt.title = "修改客户字段";
  282. });
  283. },
  284. /** 提交按钮 */
  285. submitCustomerExtForm() {
  286. this.$refs["customerExtForm"].validate(valid => {
  287. if (valid) {
  288. if (this.customerExtForm.extId != null) {
  289. updateCustomerExt(this.customerExtForm).then(response => {
  290. if (response.code === 200) {
  291. this.getCustomerExt("修改成功");
  292. this.customerExt.open = false;
  293. this.getList();
  294. }
  295. });
  296. } else {
  297. addCustomerExt(this.customerExtForm).then(response => {
  298. if (response.code === 200) {
  299. this.msgSuccess("新增成功");
  300. this.customerExt.open = false;
  301. this.getCustomerExt();
  302. }
  303. });
  304. }
  305. }
  306. });
  307. },
  308. /** 删除按钮操作 */
  309. handleCustomerExtDelete(row) {
  310. const extIds = row.extId || this.ids;
  311. this.$confirm('是否确认删除客户字段扩展编号为"' + extIds + '"的数据项?', "警告", {
  312. confirmButtonText: "确定",
  313. cancelButtonText: "取消",
  314. type: "warning"
  315. }).then(function() {
  316. return delCustomerExt(extIds);
  317. }).then(() => {
  318. this.getCustomerExt();
  319. this.msgSuccess("删除成功");
  320. }).catch(function() {});
  321. },
  322. getCustomerExt() {
  323. var data={}
  324. listCustomerExt(data).then(response => {
  325. this.customerExtList = response.data;
  326. });
  327. },
  328. getConfigKey(key){
  329. getConfigKey(key).then((response) => {
  330. if(key=="sys:config"){
  331. this.sysConfigForm=response.data;
  332. if(response.data.configValue!=null){
  333. this.sysConfig=JSON.parse(response.data.configValue);
  334. }
  335. }
  336. else if(key=="qw:config"){
  337. this.qwkfConfigForm=response.data;
  338. if(response.data.configValue!=null){
  339. this.qwkfConfig=JSON.parse(response.data.configValue);
  340. this.qwkfConfig.notifyUrl="http://kf.qw.ifeiyu100.com/app/common/weixinkfAuth/"+this.company.companyId;
  341. }
  342. }
  343. else if(key=="customer:config"){
  344. this.customerConfigForm=response.data;
  345. if(response.data.configValue!=null){
  346. this.customerConfig=JSON.parse(response.data.configValue);
  347. }
  348. }
  349. else if(key=="sys:qw:config"){
  350. this.qwConfigForm=response.data;
  351. if(response.data.configValue!=null){
  352. this.qwConfig=JSON.parse(response.data.configValue);
  353. }
  354. this.qwConfig.token="1o62d3YxvdHd4LEUiltnu7sK";
  355. this.qwConfig.encodingAESKey="UJfTQ5qKTKlegjkXtp1YuzJzxeHlUKvq5GyFbERN1iU";
  356. this.qwConfig.notifyUrl=this.qwConfig.realmNameURL+"/qw/data/"+this.company.companyId;
  357. this.qwConfig.chatToolbar="https://company.his.cdwjyyh.com/qwh5/?companyId="+this.company.companyId;
  358. this.qwConfig.chatToolbarOAuth2="https://open.weixin.qq.com/connect/oauth2/authorize?" +
  359. "appid="+this.qwConfig.corpId+"" +
  360. "&redirect_uri="+this.qwConfig.chatToolbar+"" +
  361. "&response_type=code" +
  362. "&scope=snsapi_base" +
  363. "&state=STATE" +
  364. "&agentid="+this.qwConfig.AgentId+"#wechat_redirect";
  365. }else if (key=="sys:AiKf:config"){
  366. this.AiKfConfigForm=response.data;
  367. if(response.data.configValue!=null){
  368. this.AiKfConfig=JSON.parse(response.data.configValue);
  369. }
  370. }else if (key=="companyUser:config"){
  371. console.log(response.data)
  372. this.companyUserConfig=response.data;
  373. if(response.data.configValue != null){
  374. this.userIsDefaultBlack = JSON.parse(response.data.configValue);
  375. }
  376. }
  377. });
  378. },
  379. onSubmit1() {
  380. this.sysConfigForm.configValue=JSON.stringify(this.sysConfig);
  381. updateConfig(this.sysConfigForm).then(response => {
  382. if (response.code === 200) {
  383. this.msgSuccess("修改成功");
  384. this.getConfigKey("sys:config");
  385. }
  386. });
  387. },
  388. onSubmit2() {
  389. this.customerConfigForm.configValue=JSON.stringify(this.customerConfig);
  390. updateConfig(this.customerConfigForm).then(response => {
  391. if (response.code === 200) {
  392. this.msgSuccess("修改成功");
  393. this.getConfigKey("customer:config");
  394. }
  395. });
  396. },
  397. onSubmit3() {
  398. this.qwkfConfigForm.configValue=JSON.stringify(this.qwkfConfig);
  399. updateConfig(this.qwkfConfigForm).then(response => {
  400. if (response.code === 200) {
  401. this.msgSuccess("修改成功");
  402. this.getConfigKey("sys:config");
  403. }
  404. });
  405. },
  406. onSubmit4() {
  407. this.qwConfigForm.configValue=JSON.stringify(this.qwConfig);
  408. updateConfig(this.qwConfigForm).then(response => {
  409. if (response.code === 200) {
  410. this.msgSuccess("修改成功");
  411. this.getConfigKey("sys:qw:config");
  412. }
  413. });
  414. },
  415. onSubmit5() {
  416. this.AiKfConfigForm.configValue=JSON.stringify(this.AiKfConfig);
  417. updateConfig(this.AiKfConfigForm).then(response => {
  418. if (response.code === 200) {
  419. this.msgSuccess("修改成功");
  420. this.getConfigKey("sys:AiKf:config");
  421. }
  422. });
  423. },
  424. onSubmit6() {
  425. this.companyUserConfig.configValue=JSON.stringify(this.userIsDefaultBlack);
  426. console.log(this.companyUserConfig)
  427. console.log(this.userIsDefaultBlack)
  428. configUserCheck({userIsDefaultBlack: this.userIsDefaultBlack}).then(response => {
  429. if (response.code === 200) {
  430. this.msgSuccess("修改成功");
  431. this.getConfigKey("companyUser:config");
  432. }
  433. });
  434. },
  435. }
  436. };
  437. </script>
  438. <style scoped lang="scss">
  439. .tip{
  440. color:indianred;
  441. }
  442. .line{
  443. margin: 10px 0;
  444. background-color:gainsboro;
  445. height:1px;
  446. }
  447. .el-row {
  448. margin-bottom: 0px;
  449. &:last-child {
  450. margin-bottom: 0;
  451. }
  452. }
  453. </style>