Explorar o código

'修改预警展示'

魏志佳 %!s(int64=4) %!d(string=hai) anos
pai
achega
538c419c17

+ 340 - 0
src/components/formComponents/Cascader.vue

@@ -0,0 +1,340 @@
+<style lang="scss">
+.ul-radio-group {
+  border-radius: 5px;
+  height: 32px;
+  padding: 0;
+  margin: 0;
+  border: none;
+  background: transparent;
+
+  .btn {
+    background: transparent;
+    padding: 0;
+    margin: 0;
+    border: none;
+  }
+  .item {
+    min-width: 80px;
+    padding: 0px 15px;
+    text-align: center;
+    display: inline-block;
+    border: 1px solid #ccc;
+    border-left: 0;
+    height: 32px;
+    line-height: 32px;
+    cursor: pointer;
+    .checkbox-button-input {
+      width: 0;
+      height: 0;
+      opacity: 0;
+    }
+    .ant-checkbox {
+      display: none;
+    }
+  }
+  .bgcolor {
+    color: rgba(0, 0, 0, 0.25);
+    background-color: #f5f5f5;
+    border-color: #d9d9d9;
+    cursor: not-allowed;
+  }
+  .item::after {
+    content: '';
+    position: absolute;
+    right: 1px;
+    top: -2px;
+    width: 0;
+    height: 0;
+    border-top: 6px solid transparent;
+    border-bottom: 6px solid transparent;
+    border-left: 6px solid;
+    border-left-color: #e0e0e0;
+    -webkit-transform: rotate(-45deg);
+    -ms-transform: rotate(-45deg);
+    transform: rotate(-45deg);
+    border-radius: 2px;
+  }
+  .item:hover {
+    color: #1890ff;
+  }
+  .selection {
+    color: #fff;
+    background: #1890ff;
+    // border-color: #1890ff;
+  }
+  .item.selection:hover {
+    color: #fff;
+    background: #40a9ff;
+  }
+  .item.selection:after {
+    border-left: 6px solid #1890ff;
+  }
+  .item:hover::after {
+    // border-color: #40a9ff;
+    border-left: 6px solid #40a9ff;
+  }
+  .bgcolor:hover {
+    color: rgba(0, 0, 0, 0.25);
+    background-color: #f5f5f5;
+    border-color: #d9d9d9;
+    cursor: not-allowed;
+  }
+  .bgcolor:hover::after {
+    // border-color: #40a9ff;
+    border-left: 6px solid #e0e0e0;
+  }
+  .bgcolor.selection:after {
+    border-left: 6px solid #e0e0e0;
+  }
+  .bgcolor.selection {
+    color: rgba(0, 0, 0, 0.25);
+    background-color: #f5f5f5;
+    border-color: #d9d9d9;
+    cursor: not-allowed;
+  }
+  .bgcolor.selection:hover {
+    // color: #1890ff;
+    color: rgba(0, 0, 0, 0.25);
+    background-color: #f5f5f5;
+    border-color: #d9d9d9;
+    cursor: not-allowed;
+  }
+  .bgcolor.selection:after {
+    border-left: 6px solid #e0e0e0;
+  }
+  .ant-checkbox-wrapper + .ant-checkbox-wrapper {
+    margin-left: 0;
+  }
+}
+.ul-radio-group .item:first-child {
+  border-radius: 5px 0 0 5px;
+  border-left: 1px solid #ccc;
+}
+.ul-radio-group .item.selection:first-child {
+  border-radius: 5px 0 0 5px;
+  border-left: 1px solid #1890ff;
+}
+.ul-radio-group .item.selection:nth-child(2) {
+  border-left: 1px solid #1890ff;
+}
+.ul-radio-group .item:first-child:after {
+  border-left: 0;
+}
+.ul-radio-group .item:last-child {
+  border-radius: 0px 5px 5px 0px;
+}
+</style>
+<template>
+  <div class="ul-radio-group">
+    <!-- <a-checkbox-group v-model="selectedVal" :disabled="disabled" style="width: 100%">
+      <a-checkbox
+        v-for="item of selectOption"
+        :label="item.label"
+        :key="item.value"
+        :value="item.value"
+        :class="{
+          item: true && userButton,
+          selection: selectedVal && selectedVal.indexOf(item.value) > -1 && userButton,
+          bgcolor: item.disabled,
+        }"
+        >{{ item.label }}</a-checkbox
+      >
+    </a-checkbox-group> -->
+        <el-cascader
+        v-model='selectedVal'
+        :disabled="disabled"
+        :options="selectOption"
+        :props="props"
+        clearable
+        collapse-tags
+        :show-all-levels="false"
+        ></el-cascader>
+  </div>
+</template>
+
+<script>
+// import { dictionary } from '@/components/service/core/dictionary'
+import { isArray } from '@/utils/Tools'
+import { httpAction, getAction } from '@/api/manage'
+export default {
+  name: 'Cascader', // Cascader组件二次封装
+  props: {
+    userButton: {
+      type: Boolean,
+      default() {
+        return true
+      },
+    },
+    code: {
+      // 参数code
+      type: String,
+      default: '',
+    },
+    allValue: {
+      type: Boolean,
+      default() {
+        return false
+      },
+    },
+    options: {
+      // 外部传入的option 可替代请求项
+      type: Array,
+      default() {
+        return []
+      },
+    },
+    value: {
+      // v-model绑定值
+      type: [Number, Array, String],
+      default() {
+        return []
+      },
+    },
+    label: {
+      // label 绑定值
+      type: [Array, String],
+      default: '',
+    },
+    radioStyle: {
+      // 是否复选框模拟单选效果
+      type: Boolean,
+      default: false,
+    },
+    disabled: {
+      // 是否禁用
+      type: Boolean,
+      default: false,
+    },
+  },
+  components: {},
+  data() {
+    return {
+      selectOption: [],
+      props: { multiple: true },
+    }
+  },
+  watch: {
+    options(val) {
+      if (isArray(val)) {
+        this.selectOption.splice(0, this.selectOption.length)
+        this.selectOption.push(...val)
+      }
+    },
+    selectedVal(n, o) {
+      if (this.radioStyle && !this.allValue) {
+        if (n.length == 0) {
+          this.selectedVal = o
+        }
+      }
+    },
+  },
+  computed: {
+    selectedVal: {
+      get: function () {
+        return this.value
+      },
+      set: function (val) {
+        this.selectChange(val)
+      },
+    },
+  },
+  mounted() {
+    this.$nextTick(() => {
+      if (this.code && this.options.length == 0) {
+        // 如果code值不为空且options.lengt==0, 则去请求字典项
+        this.getOptions()
+      } else {
+        // 否则直接获取外部传入的options
+        this.selectOption.splice(0, this.selectOption.length)
+        this.selectOption.push(...this.options)
+      }
+    })
+  },
+  methods: {
+    getOptions() {
+      // 获取字典项
+      getAction('/sys/dictItem/list', { dictId: this.code, pageSize: 1000, pageNo: 1 }).then((res) => {
+        if (res.success && isArray(res.result.records)) {
+          var data = res.result.records
+          data = data.map((item) => {
+            return {
+              label: item.itemText,
+              value: item.itemValue,
+              ...item,
+            }
+          })
+          if (this.allValue) {
+            data.unshift({ label: '不检查', value: 'unlimited' })
+            if (this.value == '' || this.value == '' || this.value == null || this.value.length == 0) {
+              this.selectedVal = ['unlimited']
+            }
+          } else {
+            if (this.value == '' || this.value == '' || this.value == null || this.value.length == 0) {
+              this.selectedVal = []
+            }
+          }
+          this.selectOption.push(...data)
+        }
+      })
+    },
+    selectChange(val) {
+      // 选择事件
+      if (!this.radioStyle) {
+        // 多选
+        var retrunData = []
+        let label = this.selectOption.filter((v) => val.findIndex((item) => item == v.value) > -1).map((v) => v.label)
+        if (this.allValue) {
+          if (val.findIndex((item) => item == 'unlimited') == 0) {
+            retrunData = val.slice(-1)
+          } else if (val.findIndex((item) => item == 'unlimited') == val.length - 1) {
+            retrunData = ['unlimited']
+          } else {
+            retrunData = val
+          }
+        } else {
+          retrunData = val
+        }
+
+        this.$emit('input', retrunData)
+        this.$emit('update:label', label)
+        this.$emit('change', val)
+        // this.consoleFun('VALUE: ', val, 'LABEL:', label)
+      } else {
+        // 模拟单选radio效果
+        let selectVal = []
+        if (this.allValue) {
+          if (val.length == 0) {
+            selectVal = ['unlimited']
+          }
+        } else {
+          if (val.length == 0) {
+            selectVal = []
+          }
+        }
+
+        if (val.length > 0) {
+          selectVal = val.slice(-1)
+        }
+        let label = this.selectOption
+          .filter((v) => selectVal.findIndex((item) => item == v.value) > -1)
+          .map((v) => v.label)
+        this.$emit('input', selectVal)
+        this.$emit('update:label', label)
+        this.$emit('change', selectVal)
+        // this.consoleFun('VALUE: ', selectVal, 'LABEL:', label)
+      }
+    },
+    emitChange(...args) {
+      // emit change事件
+      this.$emit('change', ...args)
+    },
+    consoleFun(...args) {
+      // 打印信息
+      if (process.env.NODE_ENV == 'development') {
+        console.log(...args)
+      }
+    },
+  },
+}
+</script>
+

+ 9 - 1
src/components/formComponents/toutiaoTime.vue

@@ -294,7 +294,15 @@
       scheduleTime: {
         immediate: true, // immediate选项可以开启首次赋值监听
         handler(newVal, oldVal) {
-          this.init()
+          console.log(newVal,'-----', oldVal);
+          if(newVal==''){
+            this.$emit('update:scheduleTime', oldVal)
+            
+            this.init()
+          }else{
+            this.init()
+          }
+          
         }
       }
     }

+ 44 - 2
src/views/modules/advertiser/UserAllocationList.vue

@@ -98,6 +98,11 @@
 
           <a-switch v-model="record.accountStatus == 0 ? true : false" @change="onChangeSwitch(record)" />
         </span>
+        <span slot="deleteComment" slot-scope="text, record">
+          <!-- {{ text == 0 ? '启用' : '禁用' }} -->
+
+          <a-switch v-model="record.deleteComment == 0 ? true : false" @change="deleteCommentChangeSwitch(record)" />
+        </span>
         <span slot="mediaId" slot-scope="text">{{ text == 1 ? '头条' : '快手' }}</span>
 
         <div slot="authName" slot-scope="text, record">
@@ -107,18 +112,33 @@
         </div>
 
         <span slot="action" slot-scope="text, record">
-          <a @click="account(record)">转移项目</a>
+          <!-- <a @click="account(record)">转移项目</a>
 
           <a-divider type="vertical" />
           <a @click="project(record)">转让账户</a>
 
-          <a-divider type="vertical" />
+          <a-divider type="vertical" /> -->
           <a @click="handleEdit(record)">编辑</a>
 
           <a-divider type="vertical" v-show="roleCode == 'admin'" />
           <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" v-show="roleCode == 'admin'">
             <a>删除</a>
           </a-popconfirm>
+          <a-divider type="vertical" />
+          <a-dropdown :trigger="['click']">
+            <a class="ant-dropdown-link" @click="e => e.preventDefault()">
+              更多 <a-icon type="down" />
+            </a>
+            <a-menu slot="overlay">
+              <a-menu-item key="0">
+                <a @click="account(record)">转移项目</a>
+              </a-menu-item>
+              <a-menu-item key="1">
+                <a @click="project(record)">转让账户</a>
+              </a-menu-item>
+             
+            </a-menu>
+          </a-dropdown>
         </span>
       </a-table>
     </div>
@@ -368,9 +388,19 @@ export default {
           align: 'center',
         },
         {
+          title: '是否开启删评论',
+          dataIndex: 'deleteComment',
+          align: 'center',
+          width:80,
+          scopedSlots: {
+            customRender: 'deleteComment',
+          },
+        },
+        {
           title: '操作',
           dataIndex: 'action',
           align: 'center',
+          width: 160,
           scopedSlots: {
             customRender: 'action',
           },
@@ -449,6 +479,18 @@ export default {
         }
       })
     },
+    deleteCommentChangeSwitch(record){
+      console.log(record)
+      var params = {}
+      params.accountId = record.accountId
+      params.switchType = record.deleteComment ==0 ? 1 : 0
+
+      postAction('/ctop/userAllocation/onOrOffDeleteComment', qs.stringify(params)).then((res) => {
+        if (res.success) {
+          this.loadData()
+        }
+      })
+    },
     getParticipateList() {
       getAction('/ctop/projectMember/participateList', {
         userId: this.userInfo().id,

+ 33 - 4
src/views/modules/earlyWarningRules/configRules.vue

@@ -21,11 +21,11 @@
                         </div>
                         <div class="input-item"> 
                              <a-form-model-item ref="eventRuleLevel"  prop="eventRuleLevel">
-                                <a-radio-group v-model="form.mediaType" :disabled="form.templateId!=null">
+                                <a-radio-group v-model="form.mediaType" :disabled="form.templateId!=null" @change="mediaTypeChange">
                                     <a-radio-button :value="1" >头条</a-radio-button>
-                                    <!-- <a-radio-button :value="2">快手</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-button :value="4">快手内广</a-radio-button>
                                    
                                 </a-radio-group>
                             </a-form-model-item>
@@ -725,6 +725,32 @@ export default {
             }
 
         },
+
+        mediaTypeChange(e){
+            console.log(e);
+            this.getMediaTypeRuleField()
+        },
+
+        getMediaTypeRuleField(){
+            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:{
@@ -760,13 +786,15 @@ export default {
 
             return returnVal
         },
+
+        
     },
 
     mounted(){
         // this.spinning=true;
         this.currentRuleId=this.$route.query.id
         getAction(this.url.fieldList,{   
-            mediaType:3,
+            mediaType:this.form.mediaType,
             pageNo:1,
             pageSize:500,
         }).then(res=>{
@@ -782,6 +810,7 @@ export default {
                 this.getTempletDetail()   
             }            
         })
+        
 
         // console.log(this.$route.query);
         

+ 33 - 7
src/views/modules/earlyWarningRules/ruleModule.vue

@@ -34,8 +34,8 @@
         <div class="toolbox-automate-rules-create-content">
           <a-form-model ref="ruleForm" :model="form" layout="horizontal">
             <div class="moduler">
-              <template v-for="(item, index) of form.ruleList">
-                <div class="row-item" v-if="item.ruleType == 'base' && item.isCopy == 0">
+              <template v-for="(item, index) of form.ruleList" >
+                <div class="row-item" v-if="item.ruleType == 'base' && item.isCopy == 0" :key="index">
                   <div class="hint-item">
                     <a-tooltip>
                       <template slot="title">
@@ -121,12 +121,32 @@
                         v-else-if="value.modelType == 'tagBox'"
                       >
                       </a-select>
+
+                      <!-- <p v-else-if="value.modelType == 'timeRange'">{{value.threshold}}</p> -->
+                      <scheduleTime
+                         
+                        style="width:100%"
+                        :scheduleTime.sync="value.threshold"
+                        ref="selectCheck"                      
+                        v-else-if="value.modelType == 'scheduleTime'"
+                      >
+
+                      </scheduleTime>
+
+                       <region
+                        :disabled="!editShow"
+                        style="width: 100%"
+                        v-model="value.threshold"
+                        v-else-if="value.modelType == 'region'"
+                      >
+                      </region>
+
                       {{ value.dataUnit }}
                     </a-form-model-item>
                   </div>
                 </div>
 
-                <div class="row-item" v-else-if="item.ruleType == 'group' && item.isCopy == 0">
+                <div class="row-item" v-else-if="item.ruleType == 'group' && item.isCopy == 0" :key="index">
                   <div class="hint-item">
                     <a-tooltip>
                       <template slot="title">
@@ -145,7 +165,7 @@
                         <div class="rules-list">
                           <div class="rules-list-item">
                             <template v-for="(value, valueIndex) of item.ruleDetail">
-                              <div class="row-item row-group" v-if="value.variableType == 1">
+                              <div class="row-item row-group" v-if="value.variableType == 1" :key="valueIndex">
                                 <!-- <div class="hint-item"></div>
                               <div class="label-item">
                                 <div class="text-item"></div>
@@ -250,7 +270,7 @@
                     </div>
                   </div>
                 </div>
-                <div class="row-item" v-else-if="item.ruleType == 'group' && item.isCopy == 1">
+                <div class="row-item" v-else-if="item.ruleType == 'group' && item.isCopy == 1" :key="index">
                   <div class="hint-item">
                     <a-tooltip>
                       <template slot="title">
@@ -266,10 +286,10 @@
                   <div class="input-item">
                     <div class="toolbox-automate-rules-create-content_rules-and-condition_rules">
                       <div class="content">
-                        <div class="rules-list" v-for="(valueElse, valueIndex) of item.ruleDetail">
+                        <div class="rules-list" v-for="(valueElse, valueIndex) of item.ruleDetail" :key="valueIndex">
                           <div class="rules-list-item">
                             <template v-for="(value, valueElseIndex) of valueElse">
-                              <div class="row-item row-group" v-if="value.variableType == 1">
+                              <div class="row-item row-group" v-if="value.variableType == 1" :key="valueElseIndex">
                                 <!-- <div class="hint-item"></div>
                               <div class="label-item">
                                 <div class="text-item"></div>
@@ -403,8 +423,10 @@
                                 class="rules-list-item-delete"
                                 v-if="item.isCopy == 1"
                                 @click="addData(item, valueElse, valueIndex)"
+                                :key="valueElseIndex"
                               >
                                 {{ valueIndex == 0 ? '复建' : '删除' }}
+                                
                               </div>
                             </template>
                           </div>
@@ -449,6 +471,8 @@ import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
 import selectGroup from '@/components/formComponents/selectGroup'
 import checkBoxGroup from '@/components/formComponents/checkBoxGroup'
 import timeRange from '@/components/formComponents/timeRange'
+import scheduleTime from '@/components/formComponents/toutiaoTime'
+import region from '@/components/formComponents/Cascader'
 import switchConfig from './switchConfig'
 let statusList = [
   {
@@ -543,6 +567,8 @@ export default {
     checkBoxGroup,
     timeRange,
     switchConfig,
+    scheduleTime,
+    region,
   },
   data() {
     return {