12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337 |
- <template>
- <div class='configRules'>
- <a-spin :spinning="spinning">
-
-
- <div class="toolbox-automate-rules-create-body">
- <div class="toolbox-automate-rules-create-content_title"><h3> 新建空白模板</h3></div>
- <div class="toolbox-automate-rules-create-content">
- <a-form-model
- ref="ruleForm"
- :model="form"
- :rules="rules"
- >
- <div class="moduler">
- <!-- 应用对象 -->
- <div class="row-item" >
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">应用媒体</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <a-form-model-item ref="eventRuleLevel" prop="eventRuleLevel">
- <a-radio-group v-model="form.mediaType" :disabled="form.templateId!=null" @change="mediaTypeChange">
- <a-radio-button :value="3" >头条</a-radio-button>
- <a-radio-button :value="2">快手</a-radio-button>
- <!-- <a-radio-button :value="3">头条内广</a-radio-button>
- <a-radio-button :value="4">快手内广</a-radio-button> -->
-
- </a-radio-group>
- </a-form-model-item>
- </div>
- </div>
- <div class="row-item" >
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">模板名称</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <a-form-model-item ref="templateName" prop="templateName">
- <a-input
- v-model="form.templateName"
- :allowClear='!currentRuleId'
- @blur="blurTemplateName"
- />
- </a-form-model-item>
- </div>
- </div>
- <div class="row-item" >
- <div class="hint-item">
- <!-- <a-tooltip>
- <template slot="title">
- 针对计划或者账户粒度的消耗、成本、转化数等数据设置阈值作为监控条件,方便系统判断当前的计划状态;条件之间为「且」的关系
- </template>
- <a-icon type="question-circle" />
- </a-tooltip> -->
- </div>
- <div class="label-item">
- <div class="text-item">规则条件</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item extraClass" style="min-width:80%" >
- <!-- v-model="activeKey" defaultActiveKey='0'-->
- <a-collapse accordion v-model="activeKey" @change="collapseChange" ref="collapse">
- <template v-for="(item,index) in form.ruleList" >
- <a-collapse-panel :header="item.groupName" :style="customStyle" >
- <span slot="extra">
- <a-popconfirm
- :title="`确定删除吗?`"
- @confirm="deleteRule($event,item,index)"
- >
- <a-icon type="delete" @click="deleteIcon($event)"/>
- </a-popconfirm>
- </span>
-
-
- <div class="row-item" >
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">规则名称</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <!-- :disabled="!!item.groupId" -->
- <a-form-model-item ref="groupName" :prop="'ruleList.'+index+'.groupName'" :rules="[
- { required: true, message: '请填写规则名称', trigger: 'blur' },
- { min: 1, message: '长度不得小于1', trigger: 'blur' }]">
- <a-input
- v-model="item.groupName"
- placeholder="请输入规则名称"
- :allowClear="!item.groupId"
- style="width:400px"
- @blur="blurGroupName(item)"
- />
- </a-form-model-item>
- </div>
- </div>
- <div class="row-item" >
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">规则描述</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <!-- :disabled="!!item.groupId" -->
- <a-form-model-item ref="remark" :prop="'ruleList.'+index+'.remark'" :rules="[
- { required: true, message: '请填写规则描述', trigger: 'blur' },
- { min: 1, message: '长度不得小于1', trigger: 'blur' },
- ]" >
- <a-textarea
- v-model="item.remark"
- style="width:400px"
- placeholder="输入规则描述"
- :auto-size="{ minRows: 2, maxRows: 5 }"
- @blur="blurGroupName(item)"
- />
- </a-form-model-item>
- </div>
- </div>
-
- <div class="row-item" >
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">规则类型</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <a-form-model-item ref="ruleType" prop="ruleType">
- <a-radio-group v-model="item.ruleType" @change="ruleTypeChange(item)">
- <a-radio-button value="group">组合</a-radio-button>
- <a-radio-button value="base">基础</a-radio-button>
- </a-radio-group>
- </a-form-model-item>
- </div>
- </div>
- <div class="row-item" >
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">规则必填</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <a-form-model-item ref="isRequired" prop="isRequired">
- <a-radio-group v-model="item.isRequired" >
- <a-radio-button :value="1">是</a-radio-button>
- <a-radio-button :value="0">否</a-radio-button>
- </a-radio-group>
- </a-form-model-item>
- </div>
- </div>
- <div class="row-item" v-if="item.ruleType=='group'">
- <div class="hint-item"></div>
- <div class="label-item">
- <div class="text-item">规则复建</div>
- <div class="required-item"></div>
- </div>
- <div class="input-item">
- <a-form-model-item ref="isCopy" prop="isCopy">
- <a-radio-group v-model="item.isCopy" >
- <a-radio-button :value="1">是</a-radio-button>
- <a-radio-button :value="0">否</a-radio-button>
- </a-radio-group>
- </a-form-model-item>
- </div>
- </div>
- <div class="toolbox-automate-rules-create-content_rules-and-condition_rules">
- <div class="title">
- <a-form-model-item ref="ruleRelationship" prop="ruleRelationship">
- <span class="condition-title">如果</span>
- <a-select style="width: 300px" v-model="item.ruleRelationship" :disabled="!!item.groupId">
- <a-select-option value='and'>满足以下所有条件</a-select-option>
- <a-select-option value='or'>满足以下任意条件</a-select-option>
- </a-select>
- </a-form-model-item>
-
- </div>
- <div class="content">
- <div class="rules-list" v-for="(ele,ind) in item.ruleDetail" :key='ind'>
-
- <div class="rules-list-item">
- <div class="rules-list-item-subject" style="width:180px">
- <a-form-model-item ref="baseIndex" :prop="'ruleList.'+index+'.ruleDetail.'+ind+'.baseIndex'" :rules="[
- { required: true, message: '请选择指标', trigger: 'blur' },
- ]">
- <a-cascader
- v-model="ele.baseIndex"
- :options="rulesFieldList"
- placeholder="选择指标"
- @change="baseIndexChange(ele)"
- expand-trigger="hover"
- :disabled="!!ele.ruleId"
- :fieldNames="{ label:'name', value: 'code',children: 'children'}"
- />
- </a-form-model-item>
-
- </div>
- <template >
-
- <div class="rules-list-item-subject" >
- <a-form-model-item ref="ruleCondition" :prop="'ruleList.'+index+'.ruleDetail.'+ind+'.ruleCondition'" :rules="[
- { required: true, message: '请选择运算符', trigger: 'blur' },
- ]">
- <a-select v-model="ele.ruleCondition" placeholder="运算符" :disabled="!!ele.ruleId">
- <a-select-option v-for="item in ele.conditionList" :key="item.id" :value='item.ruleCondition'>{{item.conditionName}}</a-select-option>
- </a-select>
- </a-form-model-item>
- </div>
-
- <div class="rules-list-item-subject" >
- <a-form-model-item ref="variableType" prop="variableType">
- <a-select v-model="ele.variableType" :disabled="!!ele.ruleId">
- <a-select-option :value='0'>常量</a-select-option>
- <a-select-option :value='1'>变量</a-select-option>
- </a-select>
- </a-form-model-item>
- </div>
- <div class="rules-list-item-subject" >
- <a-form-model-item ref="judgeFormat" prop="judgeFormat">
- <a-select v-model="ele.judgeFormat" placeholder="" :disabled="!!ele.ruleId">
- <a-select-option :value='0'>筛选条件</a-select-option>
- <a-select-option :value='1'>判断条件</a-select-option>
- </a-select>
- </a-form-model-item>
- </div>
- <!-- <div class="rules-list-item-subject" v-if="ele.dataType=='number'">
- <a-input-number :min="0" style="width:100%" :max="9999999.99" :step="1" v-model="ele.threshold" placeholder="请输入" :disabled="!!ele.ruleId" />
- <span style="margin-left:8px;line-height:32px">{{ele.dataUnit }}</span>
- </div> -->
- <div class="rules-list-item-subject" >
- <a-form-model-item ref="isUnlimited" prop="isUnlimited">
- <a-select v-model="ele.isUnlimited" placeholder="是否必填" :disabled="!!ele.ruleId">
- <a-select-option :value='1'>必填</a-select-option>
- <a-select-option :value='0'>不必填</a-select-option>
- </a-select>
- </a-form-model-item>
- </div>
-
- </template>
- <div class="rules-list-item-delete" @click="deleteRulesListItem(index,ind)" v-if="ind!=0">
- <a-icon type="delete" style="font-size:16px;position: relative;top: 4px;" />
- </div>
- </div>
-
- </div>
-
- <div class="add-rule" @click="addCondition(item,index)" v-show="item.ruleType=='group'"> 添加条件</div>
- </div>
- </div>
- <div class="toolbox-automate-rules-create-content_rules-and-condition_rules">
- <div class="title">
- <span class="condition-title">则依次执行以下操作</span>
- </div>
- <div class="content">
- <div class="rules-list">
- <div class="rules-list-item">
- <div class="rules-list-item-subject" >
- <a-form-model-item ref="processMethod" prop="processMethod">
- <a-select v-model="item.operate" :disabled="!!item.groupId">
- <a-select-option value='SEND'>仅发送通知</a-select-option>
- <a-select-option value='PAUSE' >关停并发送通知</a-select-option>
-
- </a-select>
- </a-form-model-item>
- </div>
- <div class="rules-list-item-subject" >
- <a-form-model-item ref="processMethod" prop="processMethod">
- <a-select v-model="item.sendType" :disabled="!!item.groupId">
- <!-- <a-select-option value='message' >短信</a-select-option> -->
- <a-select-option value='Wechat'>企业微信</a-select-option>
- <a-select-option value='EMAIL'>邮箱</a-select-option>
- <!-- <a-select-option value='phone'>电话</a-select-option> -->
- </a-select>
- </a-form-model-item>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </a-collapse-panel>
- </template>
-
-
- </a-collapse>
- <div class="add-rule" @click="addRule"> 添加规则</div>
- </div>
- </div>
-
- </div>
-
- <div class="moduler">
- <!-- <div class="moduler-title">计划名称</div> -->
- <div class="opt">
- <a-button type="default" style="margin-right:15px" @click="goBack">取消</a-button>
- <a-button type="primary" style="margin-right:15px" @click="saveHandler" :loading="saveLoading">保存</a-button>
- </div>
- </div>
- </a-form-model>
- </div>
- </div>
- </a-spin>
- </div>
- </template>
- <script>
- import moment from 'moment';
- import { getAction, postAction, downFile, downFilePost,deleteAction,putAction } from '@/api/manage';
- import { Switch } from 'ant-design-vue';
- import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
- // import func from '../../../../vue-temp/vue-editor-bridge';
- export default {
- components:{
- Treeselect,
- },
- data() {
- return {
- activeKey:'0',
- // tabActiveKey:[0],
- customStyle:'background: #f9f9fa;border-radius: 4px;margin-bottom:15px;overflow: hidden;border: 1px solid #d9d9d9;',
- conditionList:[],
- url:{
- fieldList:'/ruleIndicator/list',
- ruleCondition:'/rule/ruleCondition/list',
- creativeTemplate:'/ruleTemplate/createTemplate',
- ruleGroupDelete:'/ruleGroup/delete',
- createRuleGroup:'/ruleGroup/createRuleGroup',
- queryDetailById:'/ruleTemplate/queryDetailById',
- },
-
-
- currentRuleId:'',
- rulesFieldList:[],
-
-
- spinning:false,
-
- saveLoading:false,
- // 用到的参数数组
-
- form: {
- mediaType:3,
- templateName: `空白模板_${moment().format('YYYY_MM_DD_hh:mm:ss')}`,
- ruleList:[
- {
- groupName:'默认规则',
- ruleRelationship:"and",
- ruleType:'base',
- remark:'',
- isRequired:1,
- isCopy:0,
- ruleDetail:[
- {
- ruleName:'',
- baseIndex:[],
- indicatorCode:undefined,
- ruleDimension:'',
- dataRange:'CURRENT_DAY_DATA',
- ruleCondition:undefined,
- threshold:0,
- variableType:1,
- dataUnit:'',
- conditionList:[],
- dataType:'',
- judgeFormat:0,
- isUnlimited:1,
- },
- ],
- operate:'SEND',//预警方式
- sendType:'Wechat',//通知方式
- },
-
- ],
- },
- rules: {
- templateName: [
- { required: true, message: '请填写规则的具体名称', trigger: 'blur' },
- { min: 2, message: '长度不得小于2', trigger: 'blur' },
- ],
-
- metricValueCode: [{ required: true, message: '请填写规则描述', trigger: 'change' }],
-
- // threshold: [
- // { required: true, message: '请填写具体值', trigger: 'blur' },
- // // { min: 2, message: '长度不得小于2', trigger: 'blur' },
- // ],
- },
- templateNameTrue:false,
- templateNameOld:''
- }
- },
- watch: {
- 'form.templateName':function(n,o){
- console.log(n,o)
- if(n!=o){
- this.templateNameTrue = true
- }else{
- this.templateNameTrue = false
- }
- },
- // 'form.mediaType':function(n,o){
- // getAction(this.url.fieldList,{
- // mediaType:n,
- // pageNo:1,
- // pageSize:500,
- // }).then(res=>{
- // console.log(res);
- // this.rulesFieldList = []
- // if(res.success){
- // this.rulesFieldList=res.result.map(item=>{
- // return {
- // name:item.dimensionName,
- // code:item.dimension,
- // children:item.dimensionList
- // }
- // })
- // this.getTempletDetail()
- // }
- // })
-
- // }
- },
- methods: {
- blurTemplateName(){
- console.log(this.form)
- if(this.currentRuleId){
- if(this.templateNameTrue){
- if(this.form.templateName!=''){
- putAction('/ruleTemplate/edit',{id:this.form.templateId,templateName:this.form.templateName}).then(res=>{
- if(res.success){
- }else{
- this.$message.error(res.message)
- }
- })
- }else{
- this.$message.error('模板名称不可以为空!!!')
- }
- }
- }
-
- },
- blurGroupName(item){
- if(this.currentRuleId&&item.groupId){
- if(item.groupName!=''&&item.remark!=''){
- putAction('/ruleGroup/edit',{id:item.groupId,groupName:item.groupName,remark:item.remark}).then(res=>{
- if(res.success){
- }else{
- this.$message.error(res.message)
- }
- })
- }else{
- this.$message.error('规则名称和规则描述不可以为空!!!')
- }
- }
-
- },
- ruleTypeChange(item){
- console.log(item)
- if(item.ruleType=='base'){
- item.isCopy=0;
- item.ruleDetail=item.ruleDetail.filter((item,index)=>{
- return index==0
- })
- }
- console.log(item)
- },
- inputCheck(val){
- console.log(val)
- },
- isCost(val){
- if(val.indexOf('Cost') != -1){
- return true
- } else if(val.indexOf('depletion') != -1){
- return true
- }else{
- return false
- }
-
- },
- baseIndexChange(ele) {
- console.log(ele,'========================执行了');
- ele.indicatorCode=ele.baseIndex[1];
- ele.ruleDimension=ele.baseIndex[0];
- this.rulesFieldList.forEach(element => {
- if(element.code==ele.baseIndex[0]){
- element.children.forEach(item=>{
- if(item.code==ele.baseIndex[1]){
- ele.ruleName=item.name
- ele.dataUnit=item.dataUnit
- ele.dataType=item.dataType;
- if(item.dataType!='number'){
- ele.threshold=''
- }
- getAction(this.url.ruleCondition,{
- dataType:item.dataType
- }).then(res=>{
- // console.log(res);
- ele.conditionList=[];
- if(res.success){
- ele.conditionList=res.result
- }
- })
- }
- })
- }
- });
- ele.ruleCondition=undefined;
- },
-
- filterOption(input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- );
- },
- // form-modal 自带方法
- onSubmit() {
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- console.log('submit!',valid);
- } else {s
- console.log('error submit!!');
- return false;
- }
- });
- },
- resetForm() {
- this.$refs.ruleForm.resetFields();
- },
- addCondition(item,index){
- if(item.groupId){
- this.$message.warning('不可编辑当前规则组')
- }else{
- this.form.ruleList[index].ruleDetail.push({
- ruleName:'',
- baseIndex:[],
- indicatorCode:undefined,
- ruleDimension:'',
- dataRange:'CURRENT_DAY_DATA',
- ruleCondition:undefined,
- threshold:0,
- variableType:1,
- dataUnit:'',
- conditionList:[],
- dataType:'',
- judgeFormat:0,
- isUnlimited:1,
- })
- }
-
- },
- collapseChange(key){
- console.log(key)
- },
- addRule(){
- this.form.ruleList.push(
- {
- groupName:'默认规则',
- ruleRelationship:"and",
- ruleType:'base',
- remark:'',
- operate:'SEND',//预警方式
- sendType:'Wechat',//通知方式
- isRequired:1,
- isCopy:0,
- ruleDetail:[
- {
- ruleName:'',
- baseIndex:[],
- indicatorCode:undefined,
- ruleDimension:'',
- dataRange:'CURRENT_DAY_DATA',
- ruleCondition:undefined,
- threshold:0,
- variableType:1,
- dataUnit:'',
- conditionList:[],
- dataType:'',
- judgeFormat:0,
- isUnlimited:1,
- },
- ]
- },
- )
- console.log(this.$refs.collapse)
-
- this.activeKey=(this.form.ruleList.length-1)+'';
-
-
- },
- deleteRulesListItem(index,ind){
- console.log(index,ind)
- this.form.ruleList[index].ruleDetail=this.form.ruleList[index].ruleDetail.filter((ele,i)=>{
- return i!=ind
- })
-
- },
- deleteIcon(event){
- event.stopPropagation();
- },
- deleteRule(event,item,index){
- event.stopPropagation();
- console.log(item,index)
- if(item.groupId){
- deleteAction(this.url.ruleGroupDelete,{
- id:item.groupId
- }).then(res=>{
- console.log(res);
- if(res.success){
- this.$message.success(res.message);
- this.form.ruleList=this.form.ruleList.filter((ele,ind)=>{
- return ind!=index
- })
- this.activeKey=(this.form.ruleList.length-1)+'';
- }else{
- this.$message.error(res.message)
- }
- })
- }else{
- this.form.ruleList=this.form.ruleList.filter((ele,ind)=>{
- return ind!=index
- })
- this.activeKey=(this.form.ruleList.length-1)+'';
- }
-
- },
- displayRender({ labels }) {
- return labels[labels.length - 1];
- },
- ruleConditionChange(item){
- console.log(item)
- if(item.metricValueName[1]=='COST'){
- item.judgeType='MONEY';
- }else{
- item.judgeType=undefined;
- }
- item.specificMoney=undefined;
- item.specificMoneyMin=undefined;
- item.specificMoneyMax=undefined;
- item.threshold=undefined;
- item.maxNumber=undefined;
- item.campaignStatus=undefined;
- item.unitStatus=undefined;
- },
-
- saveHandler(){
- this.$refs.ruleForm.validate(valid=> {
- if (valid) {
- // this.form.rulesList=this.rulesList;
- console.log(valid,this.form);
-
- this.saveLoading=true;
- if(this.currentRuleId){
- if(this.form.ruleList.length){
- let ruleList=this.form.ruleList.filter(item=>{
- return !item.groupId
- })
- console.log(ruleList)
- if(ruleList.length>0){
- postAction(this.url.createRuleGroup,{
- templateId:this.currentRuleId,
- ruleList
- }).then(res=>{
- console.log(res);
- this.saveLoading=false;
- if(res.success){
-
- this.$router.push('/earlyWarningRules/index')
- this.$bus.$emit('remove', `/earlyWarningRules/configRules?id=${this.currentRuleId}`)
- }else{
- this.$message.error(res.message)
- }
-
- })
- }else{
- this.$router.push('/earlyWarningRules/index')
- this.$bus.$emit('remove', `/earlyWarningRules/configRules?id=${this.currentRuleId}`)
- }
- }else{
- this.saveLoading=false;
- this.$message.error('模板内具体规则不能为空')
- }
-
-
- }else{
- postAction(this.url.creativeTemplate,this.form).then(res=>{
- console.log(res);
- this.saveLoading=false;
- if(res.success){
- this.$router.push('/earlyWarningRules/index')
- this.$bus.$emit('remove', '/earlyWarningRules/configRules')
- }else{
- this.$message.error(res.message)
- }
-
-
- })
- }
-
-
-
- } else {
- console.log('error submit!!');
- this.$message.error('请按提示填写必填项目!')
- return false;
- }
- });
- },
- goBack() {
- this.$router.push('/earlyWarningRules/index')
- this.$bus.$emit('remove', '/earlyWarningRules/configRules')
-
- },
- // 获取条件运算符
- getRuleCondition(dataType){
-
- },
- // huixianzhi
- getTempletDetail(){
- if(this.$route.query.id){
- this.spinning=true;
- getAction(this.url.queryDetailById,{
- id:this.$route.query.id
- }).then(res=>{
- console.log(res);
- // this.spinning=false;
- if(res.success){
- // this.spinning=false;
- new Promise((resolve,reject)=>{
- getAction(this.url.fieldList,{
- mediaType:res.result.mediaType,
- pageNo:1,
- pageSize:500,
- }).then(result=>{
- console.log(result);
- if(result.success){
- this.rulesFieldList=result.result.map(item=>{
- return {
- name:item.dimensionName,
- code:item.dimension,
- children:item.dimensionList
- }
- })
- resolve('success')
- }
- })
- }).then(data=>{
- if(res.result.ruleList){
- res.result.ruleList.map((item,index)=>{
- item.ruleDetail.forEach((ele,ind)=>{
- ele.baseIndex=[ele.ruleDimension,ele.indicatorCode];
- getAction(this.url.ruleCondition,{
- dataType:ele.dataType
- }).then(result=>{
- console.log(result)
- if(result.success){
- ele.conditionList=result.result
- console.log(this.form);
- this.form={};
- this.form=res.result
- }
- })
- })
- })
- this.form=res.result;
- this.spinning=false
- }else{
-
- this.form={
- ...res.result,
- ruleList:[]
- }
- // this.form.ruleList=[]
- this.spinning=false
- }
-
- // this.form=res.result;
-
- })
-
- }else{
- this.$message.error(res.message);
- this.spinning=false;
- }
- })
- }else{
- this.spinning=false;
- }
- },
- mediaTypeChange(e){
- console.log(e);
- this.getMediaTypeRuleField()
- },
- getMediaTypeRuleField(){
- this.rulesFieldList=[];
- getAction(this.url.fieldList,{
- mediaType:this.form.mediaType,
- pageNo:1,
- pageSize:500,
- }).then(res=>{
- console.log(res);
- if(res.success){
- this.rulesFieldList=[];
- this.rulesFieldList=res.result.map(item=>{
- return {
- name:item.dimensionName,
- code:item.dimension,
- children:item.dimensionList
- }
- })
-
- }
- })
- },
- },
- filters:{
- handlerApplyObj(val){
- let showVal=''
- switch (val) {
- case 'CAMPAIGN':
- showVal='计划'
- break;
- case 'UNIT':
- showVal='组'
- break;
- case 'CREATE':
- showVal='创意'
- break;
- default:
- break;
- }
- return showVal
- },
- handlerDANWEI(val){
- // console.log(val.indexOf("RATE") != -1)
- let returnVal='';
-
- if(val.indexOf("Roi") != -1){
- returnVal='';
- }else if(val.indexOf("Cost") != -1|| val.indexOf("depletion") != -1){
- returnVal='元'
- }else{
- returnVal=''
- }
- return returnVal
- },
-
- },
- mounted(){
- // this.spinning=true;
- this.currentRuleId=this.$route.query.id
- if(!this.$route.query.id){
- getAction(this.url.fieldList,{
- mediaType:this.form.mediaType,
- pageNo:1,
- pageSize:500,
- }).then(res=>{
- console.log(res);
- if(res.success){
- this.rulesFieldList=res.result.map(item=>{
- return {
- name:item.dimensionName,
- code:item.dimension,
- children:item.dimensionList
- }
- })
- this.getTempletDetail()
- }
- })
- }else{
- this.getTempletDetail()
- }
-
-
- // console.log(this.$route.query);
-
-
- },
- }
- </script>
- <style lang="scss" scoped>
- .configRules{
- .add-rule:hover {
- color: #2F88FF;
- border-color: #2F88FF;
- }
- .add-rule {
- cursor: pointer;
-
- height: 40px;
- border-radius: 2px;
- border: 1px dashed #dadfe3;
- font-size: 12px;
- display: flex;
- flex-flow: row column;
- justify-content: center;
- align-items: center;
- color: #666;
- margin-top: 5px;
- -moz-user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
- -khtml-user-select: none;
- user-select: none;
- }
- .toolbox-automate-rules-create-body {
- margin: 16px 12px 12px;
- padding: 32px 32px 16px;
- background-color: #fff;
- border-radius: 4px;
- }
- .toolbox-automate-rules-create-content_title {
- background-color: #fff;
- display: flex;
- flex-flow: row nowrap;
- justify-content: flex-start;
- align-items: center;
- margin-bottom: 28px;
- h3 {
- font-size: 22px;
- margin: 0;
- font-weight: 400;
- height: 30px;
- line-height: 30px;
- }
- }
- .toolbox-automate-rules-create-content {
- padding-left: 28px;
- }
- .moduler {
- .opt {
- text-align: right;
- }
- width: 100%;
- background: #fff;
- margin-bottom: 16px;
- position: relative;
- padding: 32px 24px 48px 32px;
- // border-radius: 4px;
- // box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.05);
- .moduler-title {
- display: flex;
- align-items: center;
- font-size: 22px;
- margin-bottom: 20px;
- }
- .extraClass{
- .row-item {
- margin-bottom: 20px;
- }
-
- }
- .row-item {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- margin-bottom: 25px;
- }
- .row-item:last-of-type {
- margin-bottom: 0;
- }
- .row-item .hint-item {
- width: 24px;
- min-width: 24px;
- align-self: flex-start;
- line-height: 20px;
- height: 20px;
- margin-top: 9px;
- }
- .row-item .label-item {
- position: relative;
- align-items: flex-start;
- align-self: flex-start;
- line-height: 20px;
- height: 20px;
- margin-top: 10px;
- width: 80px;
- min-width: 80px;
- .text-item {
- font-size: 14px;
- width: 60px;
- }
- }
- .row-item .required-item {
- width: 4px;
- height: 4px;
- border-radius: 2px;
- background: #f45858;
- position: absolute;
- right: 10px;
- top: 50%;
- transform: translateY(-50%);
- }
- .row-item .input-item {
- min-width: 480px;
- position: relative;
- // height: 35px;
- .tip {
- font-size: 12px;
- color: tomato;
- }
- }
- .adName{
- display: flex;
- .nameList{
- width: 90%;
- }
- .item{
- display: inline-block;
- width: 30%;
- margin-left: 15px;
- margin-bottom: 10px;
- }
- }
- }
- .toolbox-automate-rules-create-content_rules-and-condition_rules {
- margin-bottom: 24px;
- }
- .toolbox-automate-rules-create-content_rules-and-condition_rules, .toolbox-automate-rules-create-content_rules-and-condition_condition {
- width: 1138px;
- background: #fff;
- border-radius: 4px;
- border: 1px solid #dadfe3;
- }
- .toolbox-automate-rules-create-content_rules-and-condition_rules, .toolbox-automate-rules-create-content_rules-and-condition_condition{
- .title{
- font-size: 14px;
- font-weight: 600;
- color: #333;
-
- border-bottom: 1px solid #E4E9ED;
- padding-left: 24px;
- padding: 12px;
- // display: flex;
- // justify-content: flex-start;
- align-items: center;
- .condition-title{
- padding-right: 17px;
- }
- }
- .title2{
- font-size: 14px;
- font-weight: 600;
- color: #333;
- height: 56px;
- border-bottom: 1px solid #E4E9ED;
- padding-left: 24px;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .condition-title{
- padding-right: 17px;
- }
- }
- .content{
- padding: 15px;
- .add-rule {
- cursor: pointer;
-
- height: 40px;
- border-radius: 2px;
- border: 1px dashed #dadfe3;
- font-size: 12px;
- display: flex;
- flex-flow: row column;
- justify-content: center;
- align-items: center;
- color: #666;
- margin-top: 16px;
- -moz-user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
- -khtml-user-select: none;
- user-select: none;
- }
- .add-rule:hover {
- color: #2F88FF;
- border-color: #2F88FF;
- }
- .rules-list-item {
- box-sizing: border-box;
- width: 100%;
- padding: 20px;
- background: #f8f9fa;
- border-radius: 4px;
- margin-bottom: 16px;
- display: flex;
- align-items: center;
- position: relative;
- .rules-list-item-delete {
- position: absolute;
- right: 24px;
- height: 30px;
- padding-left: 24px;
- border-left: 1px solid #DADFE3;
- cursor: pointer;
- }
- .rules-list-item-subject {
- width: 120px;
- margin-right: 16px;
- display: flex;
- .ruleName{
- display: block;
- width: 100%;
- height: 32px;
- line-height: 32px;
- text-align: center;
- background-color: #fff;
- border: 1px solid #d9d9d9;
- border-radius: 4px;
- }
- }
- }
- .rules—list_item:last-of-type {
- margin-bottom: 0;
- }
- }
- }
- .selectedExist{
- width: 500px;
- padding-top: 5px;
- .inventory-tags-lists-header {
- background-color: #F8F9FA;
- border: 1px solid #E4E9ED;
- height: 36px;
- line-height: 33px;
- border-radius: 4px 4px 0 0;
- font-weight: bold;
- display: flex;
- }
- .inventory-tags-lists-container {
- border: 1px solid #E4E9ED;
- margin-top: -1px;
- height: 100%;
- padding: 4px 0px;
- border-radius: 0 0 4px 4px;
- height: 300px;
- overflow: auto;
-
- }
- .inventory-tags-lists-item {
- width: 100%;
- height: 37px;
- line-height: 37px;
- padding-left: 12px;
- padding-right: 12px;
- display: flex;
- font-size: 14px;
- color: #333;
- }
-
- .input{
- margin-bottom:16px ;
- }
- .campaign-have-list{
- font-family: PingFangSC-Regular;
- font-size: 14px;
- color: #333;
- border: 1px solid #DADFE3;
- border-radius: 4px;
- margin-bottom: 16px;
- height: 388px;
- .campaign-have-header {
- height: 38px;
- width: 100%;
- padding-left: 13px;
- line-height: 38px;
- background: #f8f9fa;
- border-radius: 4px 4px 0px 0px;
- border-bottom: 1px solid #DADFE3;
- }
- .campaign-have-list ul {
- width: 100%;
- height: 350px;
- padding-top: 6px;
-
- }
- li{
- padding: 6px 10px;
- cursor: pointer;
- }
- li:hover{
- background: #EDF1F5;
- }
- .ad-d-flex-between {
- justify-content: space-between !important;
- }
- .ad-d-flex, .ad-btn {
- display: flex;
- align-items: center;
- }
- .byted-loading-v {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 996;
- background-color: hsla(0,0%,96%,.9);
- }
- .info{
- width: 60%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .landing-type {
- color: #999;
- font-size: 12px;
- white-space: nowrap;
- }
- }
- .noAccountID{
- font-size: 14px;
- text-align: center;
- color: #999;
- line-height: 388px;
- }
- .fenye{
- height: 60px;
- padding-top: 12px;
- text-align: right;
- }
- }
- }
- </style>
- <style lang="scss">
- .configRules{
- .ant-collapse > .ant-collapse-item > .ant-collapse-header {
- position: relative;
- padding: 12px 16px;
- padding-left: 40px;
- color: rgba(0, 0, 0, 0.85);
- line-height: 22px;
- cursor: pointer;
- -webkit-transition: all 0.3s;
- height: 46px;
- transition: all 0.3s;
- }
- .ant-form-item {
- margin-bottom: 0;
-
- }
- .content{
- .ant-form-item {
- margin-bottom: 0;
- width: 100%;
- }
- }
- .ant-radio-button-wrapper {
-
- min-width: 70px;
- text-align: center;
- }
- .ant-checkbox-wrapper,
- .ant-checkbox-group-item {
- display: block;
- padding: 5px 15px;
- }
- .ant-checkbox-wrapper:first-child {
- padding: 0 15px 5px;
- }
- .ant-collapse{
- border: 1px solid #fff;
- background-color: #fff;
- }
- // .rules-list-item{
- .ant-form-explain{
- clear: both;
- min-height: 22px;
- margin-top: -2px;
- color: rgba(0, 0, 0, 0.45);
- font-size: 14px;
- line-height: 1.5;
- -webkit-transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
- transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
- position: absolute;
- }
- // }
-
- .has-error .ant-form-explain, .has-error .ant-form-split {
- color: #f5222d;
- }
- .has-error .ant-form-explain, .has-error .ant-form-split {
- color: #f5222d;
- }
- .has-error .ant-form-explain, .has-error .ant-form-split {
- color: #f5222d;
- }
- .has-error .ant-form-explain, .has-error .ant-form-split {
- color: #f5222d;
- }
- }
- </style>
|