switchConfig.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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::after {
  289. content: '*';
  290. // width: 4px;
  291. // height: 4px;
  292. // border-radius: 2px;
  293. // background: #f45858;
  294. color: #f5222d;
  295. font-size: 14px;
  296. position: absolute;
  297. left: -40px;
  298. top: -1px;
  299. font-family: SimSun, sans-serif;
  300. // transform: translateY(-50%);
  301. }
  302. .row-item .input-item {
  303. min-width: 480px;
  304. position: relative;
  305. // height: 35px;
  306. .tip {
  307. font-size: 12px;
  308. color: tomato;
  309. }
  310. }
  311. .adName {
  312. display: flex;
  313. .nameList {
  314. width: 90%;
  315. }
  316. .item {
  317. display: inline-block;
  318. width: 30%;
  319. margin-left: 15px;
  320. margin-bottom: 10px;
  321. }
  322. }
  323. }
  324. .toolbox-automate-rules-create-content_rules-and-condition_rules {
  325. margin-bottom: 24px;
  326. }
  327. .toolbox-automate-rules-create-content_rules-and-condition_rules,
  328. .toolbox-automate-rules-create-content_rules-and-condition_condition {
  329. width: 1138px;
  330. background: #fff;
  331. border-radius: 4px;
  332. border: 1px solid #dadfe3;
  333. }
  334. .toolbox-automate-rules-create-content_rules-and-condition_rules,
  335. .toolbox-automate-rules-create-content_rules-and-condition_condition {
  336. .title {
  337. font-size: 14px;
  338. font-weight: 600;
  339. color: #333;
  340. border-bottom: 1px solid #E4E9ED;
  341. padding-left: 24px;
  342. padding: 12px;
  343. // display: flex;
  344. // justify-content: flex-start;
  345. align-items: center;
  346. .condition-title {
  347. padding-right: 17px;
  348. }
  349. }
  350. .title2 {
  351. font-size: 14px;
  352. font-weight: 600;
  353. color: #333;
  354. height: 56px;
  355. border-bottom: 1px solid #E4E9ED;
  356. padding-left: 24px;
  357. display: flex;
  358. justify-content: flex-start;
  359. align-items: center;
  360. .condition-title {
  361. padding-right: 17px;
  362. }
  363. }
  364. .content {
  365. padding: 15px;
  366. .add-rule {
  367. cursor: pointer;
  368. height: 40px;
  369. border-radius: 2px;
  370. border: 1px dashed #dadfe3;
  371. font-size: 12px;
  372. display: flex;
  373. flex-flow: row column;
  374. justify-content: center;
  375. align-items: center;
  376. color: #666;
  377. margin-top: 16px;
  378. -moz-user-select: none;
  379. -webkit-user-select: none;
  380. -ms-user-select: none;
  381. -khtml-user-select: none;
  382. user-select: none;
  383. }
  384. .add-rule:hover {
  385. color: #2F88FF;
  386. border-color: #2F88FF;
  387. }
  388. .rules-list-item {
  389. box-sizing: border-box;
  390. width: 100%;
  391. padding: 15px;
  392. background: #f8f9fa;
  393. border-radius: 4px;
  394. margin-bottom: 16px;
  395. display: flex;
  396. align-items: center;
  397. position: relative;
  398. .rules-list-item-delete {
  399. position: absolute;
  400. right: 24px;
  401. height: 30px;
  402. padding-left: 24px;
  403. border-left: 1px solid #DADFE3;
  404. cursor: pointer;
  405. }
  406. .rules-list-item-subject {
  407. width: 120px;
  408. margin-right: 16px;
  409. display: flex;
  410. .ruleName {
  411. display: block;
  412. width: 100%;
  413. height: 32px;
  414. line-height: 32px;
  415. text-align: center;
  416. background-color: #fff;
  417. border: 1px solid #d9d9d9;
  418. border-radius: 4px;
  419. }
  420. }
  421. }
  422. .rules—list_item:last-of-type {
  423. margin-bottom: 0;
  424. }
  425. }
  426. }
  427. .selectedExist {
  428. width: 500px;
  429. padding-top: 5px;
  430. .inventory-tags-lists-header {
  431. background-color: #F8F9FA;
  432. border: 1px solid #E4E9ED;
  433. height: 36px;
  434. line-height: 33px;
  435. border-radius: 4px 4px 0 0;
  436. font-weight: bold;
  437. display: flex;
  438. }
  439. .inventory-tags-lists-container {
  440. border: 1px solid #E4E9ED;
  441. margin-top: -1px;
  442. height: 100%;
  443. padding: 4px 0px;
  444. border-radius: 0 0 4px 4px;
  445. height: 300px;
  446. overflow: auto;
  447. }
  448. .inventory-tags-lists-item {
  449. width: 100%;
  450. height: 37px;
  451. line-height: 37px;
  452. padding-left: 12px;
  453. padding-right: 12px;
  454. display: flex;
  455. font-size: 14px;
  456. color: #333;
  457. }
  458. .input {
  459. margin-bottom: 16px;
  460. }
  461. .campaign-have-list {
  462. font-family: PingFangSC-Regular;
  463. font-size: 14px;
  464. color: #333;
  465. border: 1px solid #DADFE3;
  466. border-radius: 4px;
  467. margin-bottom: 16px;
  468. height: 388px;
  469. .campaign-have-header {
  470. height: 38px;
  471. width: 100%;
  472. padding-left: 13px;
  473. line-height: 38px;
  474. background: #f8f9fa;
  475. border-radius: 4px 4px 0px 0px;
  476. border-bottom: 1px solid #DADFE3;
  477. }
  478. .campaign-have-list ul {
  479. width: 100%;
  480. height: 350px;
  481. padding-top: 6px;
  482. }
  483. li {
  484. padding: 6px 10px;
  485. cursor: pointer;
  486. }
  487. li:hover {
  488. background: #EDF1F5;
  489. }
  490. .ad-d-flex-between {
  491. justify-content: space-between !important;
  492. }
  493. .ad-d-flex,
  494. .ad-btn {
  495. display: flex;
  496. align-items: center;
  497. }
  498. .byted-loading-v {
  499. position: absolute;
  500. top: 0;
  501. right: 0;
  502. bottom: 0;
  503. left: 0;
  504. z-index: 996;
  505. background-color: hsla(0, 0%, 96%, 0.9);
  506. }
  507. .info {
  508. width: 60%;
  509. overflow: hidden;
  510. text-overflow: ellipsis;
  511. white-space: nowrap;
  512. }
  513. .landing-type {
  514. color: #999;
  515. font-size: 12px;
  516. white-space: nowrap;
  517. }
  518. }
  519. .noAccountID {
  520. font-size: 14px;
  521. text-align: center;
  522. color: #999;
  523. line-height: 388px;
  524. }
  525. .fenye {
  526. height: 60px;
  527. padding-top: 12px;
  528. text-align: right;
  529. }
  530. }
  531. }
  532. </style>
  533. <style lang="scss">
  534. .configRules {
  535. .ant-collapse > .ant-collapse-item > .ant-collapse-header {
  536. position: relative;
  537. padding: 12px 16px;
  538. padding-left: 40px;
  539. color: rgba(0, 0, 0, 0.85);
  540. line-height: 22px;
  541. cursor: pointer;
  542. -webkit-transition: all 0.3s;
  543. height: 46px;
  544. transition: all 0.3s;
  545. }
  546. .ant-form-item {
  547. margin-bottom: 0;
  548. }
  549. .content {
  550. .ant-form-item {
  551. margin-bottom: 0;
  552. width: 100%;
  553. }
  554. }
  555. .ant-radio-button-wrapper {
  556. min-width: 70px;
  557. text-align: center;
  558. }
  559. .ant-checkbox-wrapper,
  560. .ant-checkbox-group-item {
  561. display: block;
  562. padding: 5px 15px;
  563. }
  564. .ant-checkbox-wrapper:first-child {
  565. padding: 0 15px 5px;
  566. }
  567. }
  568. </style>