switchConfig.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <div class="configRules">
  3. <a-spin :spinning="spinning">
  4. <div class="toolbox-automate-rules-create-body">
  5. <div class="toolbox-automate-rules-create-content_title"><h3>开关配置</h3></div>
  6. <div class="toolbox-automate-rules-create-content">
  7. <a-form-model ref="ruleForm" :model="form" :rules="rules">
  8. <div class="moduler">
  9. <!-- 应用对象 -->
  10. <div class="row-item">
  11. <div class="hint-item"></div>
  12. <div class="label-item">
  13. <div class="text-item">落地页链接预警</div>
  14. <div class="required-item"></div>
  15. </div>
  16. <div class="input-item">
  17. <a-form-model-item ref="landingSwitch" prop="landingSwitch">
  18. <a-radio-group v-model="form.landingSwitch" @change="landingSwitchChange" :disabled='disabled'>
  19. <a-radio-button value="on">开启</a-radio-button>
  20. <a-radio-button value="off">关闭</a-radio-button>
  21. </a-radio-group>
  22. </a-form-model-item>
  23. </div>
  24. </div>
  25. <div class="row-item">
  26. <div class="hint-item"></div>
  27. <div class="label-item">
  28. <div class="text-item">监测链接预警</div>
  29. <div class="required-item"></div>
  30. </div>
  31. <div class="input-item">
  32. <a-form-model-item ref="monitoringLinkSwitch" prop="monitoringLinkSwitch">
  33. <a-radio-group v-model="form.monitoringLinkSwitch" @change="monitoringLinkSwitchChange" :disabled='disabled'>
  34. <a-radio-button value="on">开启</a-radio-button>
  35. <a-radio-button value="off">关闭</a-radio-button>
  36. </a-radio-group>
  37. </a-form-model-item>
  38. </div>
  39. </div>
  40. </div>
  41. </a-form-model>
  42. </div>
  43. </div>
  44. </a-spin>
  45. </div>
  46. </template>
  47. <script>
  48. import moment from 'moment'
  49. import { getAction, postAction, downFile, downFilePost, deleteAction } from '@/api/manage'
  50. import { Switch } from 'ant-design-vue'
  51. import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
  52. import qs from 'qs'
  53. export default {
  54. components: {
  55. Treeselect,
  56. },
  57. props: {
  58. disabled: {
  59. type: Boolean,
  60. default() {
  61. return false
  62. },
  63. },
  64. },
  65. data() {
  66. return {
  67. ruleDetail:{},
  68. url: {
  69. onOrOffMonitoringLink: '/rule/switch/onOrOffMonitoringLink',
  70. onOrOffLandingPage: '/rule/switch/onOrOffLandingPage',
  71. },
  72. currentRuleId: '',
  73. spinning: false,
  74. form: {
  75. landingSwitch: 'off',
  76. monitoringLinkSwitch: 'off',
  77. },
  78. rules: {
  79. templateName: [
  80. { required: true, message: '请填写规则的具体名称', trigger: 'blur' },
  81. { min: 2, message: '长度不得小于2', trigger: 'blur' },
  82. ],
  83. },
  84. }
  85. },
  86. watch: {},
  87. methods: {
  88. landingSwitchChange(e) {
  89. console.log(e.target.value)
  90. postAction(
  91. this.url.onOrOffLandingPage,
  92. qs.stringify({
  93. accountId: this.ruleDetail.accountId,
  94. switchType: e.target.value,
  95. })
  96. ).then((res) => {
  97. console.log(res)
  98. this.$message(res.message)
  99. })
  100. },
  101. monitoringLinkSwitchChange(e) {
  102. console.log(e.target.value)
  103. postAction(
  104. this.url.onOrOffMonitoringLink,
  105. qs.stringify({
  106. accountId: this.ruleDetail.accountId,
  107. switchType: e.target.value,
  108. })
  109. ).then((res) => {
  110. console.log(res)
  111. this.$message(res.message)
  112. })
  113. },
  114. // form-modal 自带方法
  115. onSubmit() {
  116. this.$refs.ruleForm.validate((valid) => {
  117. if (valid) {
  118. console.log('submit!', valid)
  119. } else {
  120. s
  121. console.log('error submit!!')
  122. return false
  123. }
  124. })
  125. },
  126. resetForm() {
  127. this.$refs.ruleForm.resetFields()
  128. },
  129. displayRender({ labels }) {
  130. return labels[labels.length - 1]
  131. },
  132. saveHandler() {
  133. this.$router.replace('/earlyWarningRules/useRuleList')
  134. this.$bus.$emit('remove', '/earlyWarningRules/ruleModule')
  135. },
  136. // goBack() {
  137. // this.$router.push('/earlyWarningRules/index')
  138. // this.$bus.$emit('remove', '/earlyWarningRules/configRules')
  139. // },
  140. // huixianzhi
  141. getTempletDetail() {
  142. if (this.$route.query.id) {
  143. this.spinning = true
  144. getAction(this.url.queryDetailById, {
  145. id: this.$route.query.id,
  146. }).then((res) => {
  147. console.log(res)
  148. if (res.success) {
  149. this.spinning = false
  150. res.result.ruleList.map((item, index) => {
  151. item.ruleDetail.forEach((ele, ind) => {
  152. ele.baseIndex = [ele.ruleDimension, ele.indicatorCode]
  153. getAction(this.url.ruleCondition, {
  154. dataType: ele.dataType,
  155. }).then((result) => {
  156. console.log(result)
  157. if (result.success) {
  158. ele.conditionList = result.result
  159. console.log(this.form)
  160. this.form = {}
  161. this.form = res.result
  162. }
  163. })
  164. })
  165. })
  166. this.form = res.result
  167. }
  168. })
  169. } else {
  170. this.spinning = false
  171. }
  172. },
  173. },
  174. filters: {},
  175. mounted() {
  176. // console.log(this.$route.query);
  177. var data = JSON.parse(localStorage.getItem('getRuleDetail'))
  178. this.ruleDetail=data;
  179. this.spinning=true;
  180. postAction('/rule/switch/echoSwitchStatus',qs.stringify({
  181. accountId:this.ruleDetail.accountId
  182. })).then(res=>{
  183. console.log(res);
  184. this.spinning=false;
  185. if(res.success){
  186. this.form.landingSwitch=res.result.landing_page?'off':'on';
  187. this.form.monitoringLinkSwitch=res.result.monitoring_link?'off':'on';
  188. }
  189. })
  190. },
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .configRules {
  195. .add-rule:hover {
  196. color: #2F88FF;
  197. border-color: #2F88FF;
  198. }
  199. .add-rule {
  200. cursor: pointer;
  201. height: 40px;
  202. border-radius: 2px;
  203. border: 1px dashed #dadfe3;
  204. font-size: 12px;
  205. display: flex;
  206. flex-flow: row column;
  207. justify-content: center;
  208. align-items: center;
  209. color: #666;
  210. margin-top: 16px;
  211. -moz-user-select: none;
  212. -webkit-user-select: none;
  213. -ms-user-select: none;
  214. -khtml-user-select: none;
  215. user-select: none;
  216. }
  217. .toolbox-automate-rules-create-body {
  218. margin: 16px 12px 12px;
  219. padding: 32px 32px 16px;
  220. background-color: #fff;
  221. border-radius: 4px;
  222. }
  223. .toolbox-automate-rules-create-content_title {
  224. background-color: #fff;
  225. display: flex;
  226. flex-flow: row nowrap;
  227. justify-content: flex-start;
  228. align-items: center;
  229. margin-bottom: 28px;
  230. h3 {
  231. font-size: 22px;
  232. margin: 0;
  233. font-weight: 400;
  234. height: 30px;
  235. line-height: 30px;
  236. }
  237. }
  238. .toolbox-automate-rules-create-content {
  239. padding-left: 28px;
  240. }
  241. .moduler {
  242. .opt {
  243. text-align: right;
  244. }
  245. width: 100%;
  246. background: #fff;
  247. margin-bottom: 16px;
  248. position: relative;
  249. padding: 32px 24px 48px 32px;
  250. // border-radius: 4px;
  251. // box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.05);
  252. .moduler-title {
  253. display: flex;
  254. align-items: center;
  255. font-size: 22px;
  256. margin-bottom: 20px;
  257. }
  258. .row-item {
  259. display: flex;
  260. justify-content: flex-start;
  261. align-items: center;
  262. margin-bottom: 32px;
  263. }
  264. .row-item:last-of-type {
  265. margin-bottom: 0;
  266. }
  267. .row-item .hint-item {
  268. width: 24px;
  269. min-width: 24px;
  270. align-self: flex-start;
  271. line-height: 20px;
  272. height: 20px;
  273. margin-top: 9px;
  274. }
  275. .row-item .label-item {
  276. position: relative;
  277. align-items: flex-start;
  278. align-self: flex-start;
  279. line-height: 20px;
  280. height: 20px;
  281. margin-top: 10px;
  282. width: 120px;
  283. .text-item {
  284. font-size: 14px;
  285. width: 100px;
  286. }
  287. }
  288. .row-item .required-item {
  289. width: 4px;
  290. height: 4px;
  291. border-radius: 2px;
  292. background: #f45858;
  293. position: absolute;
  294. right: 10px;
  295. top: 50%;
  296. transform: translateY(-50%);
  297. }
  298. .row-item .input-item {
  299. min-width: 480px;
  300. position: relative;
  301. // height: 35px;
  302. .tip {
  303. font-size: 12px;
  304. color: tomato;
  305. }
  306. }
  307. .adName {
  308. display: flex;
  309. .nameList {
  310. width: 90%;
  311. }
  312. .item {
  313. display: inline-block;
  314. width: 30%;
  315. margin-left: 15px;
  316. margin-bottom: 10px;
  317. }
  318. }
  319. }
  320. .toolbox-automate-rules-create-content_rules-and-condition_rules {
  321. margin-bottom: 24px;
  322. }
  323. .toolbox-automate-rules-create-content_rules-and-condition_rules,
  324. .toolbox-automate-rules-create-content_rules-and-condition_condition {
  325. width: 1138px;
  326. background: #fff;
  327. border-radius: 4px;
  328. border: 1px solid #dadfe3;
  329. }
  330. .toolbox-automate-rules-create-content_rules-and-condition_rules,
  331. .toolbox-automate-rules-create-content_rules-and-condition_condition {
  332. .title {
  333. font-size: 14px;
  334. font-weight: 600;
  335. color: #333;
  336. border-bottom: 1px solid #E4E9ED;
  337. padding-left: 24px;
  338. padding: 12px;
  339. // display: flex;
  340. // justify-content: flex-start;
  341. align-items: center;
  342. .condition-title {
  343. padding-right: 17px;
  344. }
  345. }
  346. .title2 {
  347. font-size: 14px;
  348. font-weight: 600;
  349. color: #333;
  350. height: 56px;
  351. border-bottom: 1px solid #E4E9ED;
  352. padding-left: 24px;
  353. display: flex;
  354. justify-content: flex-start;
  355. align-items: center;
  356. .condition-title {
  357. padding-right: 17px;
  358. }
  359. }
  360. .content {
  361. padding: 15px;
  362. .add-rule {
  363. cursor: pointer;
  364. height: 40px;
  365. border-radius: 2px;
  366. border: 1px dashed #dadfe3;
  367. font-size: 12px;
  368. display: flex;
  369. flex-flow: row column;
  370. justify-content: center;
  371. align-items: center;
  372. color: #666;
  373. margin-top: 16px;
  374. -moz-user-select: none;
  375. -webkit-user-select: none;
  376. -ms-user-select: none;
  377. -khtml-user-select: none;
  378. user-select: none;
  379. }
  380. .add-rule:hover {
  381. color: #2F88FF;
  382. border-color: #2F88FF;
  383. }
  384. .rules-list-item {
  385. box-sizing: border-box;
  386. width: 100%;
  387. padding: 15px;
  388. background: #f8f9fa;
  389. border-radius: 4px;
  390. margin-bottom: 16px;
  391. display: flex;
  392. align-items: center;
  393. position: relative;
  394. .rules-list-item-delete {
  395. position: absolute;
  396. right: 24px;
  397. height: 30px;
  398. padding-left: 24px;
  399. border-left: 1px solid #DADFE3;
  400. cursor: pointer;
  401. }
  402. .rules-list-item-subject {
  403. width: 120px;
  404. margin-right: 16px;
  405. display: flex;
  406. .ruleName {
  407. display: block;
  408. width: 100%;
  409. height: 32px;
  410. line-height: 32px;
  411. text-align: center;
  412. background-color: #fff;
  413. border: 1px solid #d9d9d9;
  414. border-radius: 4px;
  415. }
  416. }
  417. }
  418. .rules—list_item:last-of-type {
  419. margin-bottom: 0;
  420. }
  421. }
  422. }
  423. .selectedExist {
  424. width: 500px;
  425. padding-top: 5px;
  426. .inventory-tags-lists-header {
  427. background-color: #F8F9FA;
  428. border: 1px solid #E4E9ED;
  429. height: 36px;
  430. line-height: 33px;
  431. border-radius: 4px 4px 0 0;
  432. font-weight: bold;
  433. display: flex;
  434. }
  435. .inventory-tags-lists-container {
  436. border: 1px solid #E4E9ED;
  437. margin-top: -1px;
  438. height: 100%;
  439. padding: 4px 0px;
  440. border-radius: 0 0 4px 4px;
  441. height: 300px;
  442. overflow: auto;
  443. }
  444. .inventory-tags-lists-item {
  445. width: 100%;
  446. height: 37px;
  447. line-height: 37px;
  448. padding-left: 12px;
  449. padding-right: 12px;
  450. display: flex;
  451. font-size: 14px;
  452. color: #333;
  453. }
  454. .input {
  455. margin-bottom: 16px;
  456. }
  457. .campaign-have-list {
  458. font-family: PingFangSC-Regular;
  459. font-size: 14px;
  460. color: #333;
  461. border: 1px solid #DADFE3;
  462. border-radius: 4px;
  463. margin-bottom: 16px;
  464. height: 388px;
  465. .campaign-have-header {
  466. height: 38px;
  467. width: 100%;
  468. padding-left: 13px;
  469. line-height: 38px;
  470. background: #f8f9fa;
  471. border-radius: 4px 4px 0px 0px;
  472. border-bottom: 1px solid #DADFE3;
  473. }
  474. .campaign-have-list ul {
  475. width: 100%;
  476. height: 350px;
  477. padding-top: 6px;
  478. }
  479. li {
  480. padding: 6px 10px;
  481. cursor: pointer;
  482. }
  483. li:hover {
  484. background: #EDF1F5;
  485. }
  486. .ad-d-flex-between {
  487. justify-content: space-between !important;
  488. }
  489. .ad-d-flex,
  490. .ad-btn {
  491. display: flex;
  492. align-items: center;
  493. }
  494. .byted-loading-v {
  495. position: absolute;
  496. top: 0;
  497. right: 0;
  498. bottom: 0;
  499. left: 0;
  500. z-index: 996;
  501. background-color: hsla(0, 0%, 96%, 0.9);
  502. }
  503. .info {
  504. width: 60%;
  505. overflow: hidden;
  506. text-overflow: ellipsis;
  507. white-space: nowrap;
  508. }
  509. .landing-type {
  510. color: #999;
  511. font-size: 12px;
  512. white-space: nowrap;
  513. }
  514. }
  515. .noAccountID {
  516. font-size: 14px;
  517. text-align: center;
  518. color: #999;
  519. line-height: 388px;
  520. }
  521. .fenye {
  522. height: 60px;
  523. padding-top: 12px;
  524. text-align: right;
  525. }
  526. }
  527. }
  528. </style>
  529. <style lang="scss">
  530. .configRules {
  531. .ant-collapse > .ant-collapse-item > .ant-collapse-header {
  532. position: relative;
  533. padding: 12px 16px;
  534. padding-left: 40px;
  535. color: rgba(0, 0, 0, 0.85);
  536. line-height: 22px;
  537. cursor: pointer;
  538. -webkit-transition: all 0.3s;
  539. height: 46px;
  540. transition: all 0.3s;
  541. }
  542. .ant-form-item {
  543. margin-bottom: 0;
  544. }
  545. .content {
  546. .ant-form-item {
  547. margin-bottom: 0;
  548. width: 100%;
  549. }
  550. }
  551. .ant-radio-button-wrapper {
  552. min-width: 70px;
  553. text-align: center;
  554. }
  555. .ant-checkbox-wrapper,
  556. .ant-checkbox-group-item {
  557. display: block;
  558. padding: 5px 15px;
  559. }
  560. .ant-checkbox-wrapper:first-child {
  561. padding: 0 15px 5px;
  562. }
  563. }
  564. </style>