switchConfig.vue 18 KB

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