浏览代码

提交代码

朱鑫波 4 年之前
父节点
当前提交
ef873a4e10

+ 3 - 3
src/components/ctop/ActorModal.vue

@@ -21,16 +21,16 @@
             :accessKeySecret="accessKeySecret"
           ></upload-to-ali> -->
 
-          <uploadFile :value.sync="coverUrl" :fileCount="1" uploadType="image" :multiple="false" />
+          <uploadFile :value.sync="coverUrl" :fileCount="1" uploadType="image" :multiple="false" :sizeCheck="false"/>
         </a-form-item>
         <a-form-item label="照片" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="!model.name">
-          <uploadFile :value.sync="imageUrl" :fileCount="10" uploadType="image"  />
+          <uploadFile :value.sync="imageUrl" :fileCount="10" uploadType="image"  :sizeCheck="false"/>
           <!-- <upload-to-ali v-model="imageUrl" :customDomain="customDomain" multiple preview :region="region"
             :bucket="bucket" :accept="acceptImage" :max="10" :size="1024000" :accessKeyId="accessKeyId"
             :accessKeySecret="accessKeySecret"></upload-to-ali> -->
         </a-form-item>
         <a-form-item label="视频作品" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="!model.name">
-          <uploadFile :value.sync="videoUrl" :fileCount="10" uploadType="video" />
+          <uploadFile :value.sync="videoUrl" :fileCount="10" uploadType="video" :sizeCheck="false"/>
           <!-- <upload-to-ali v-model="videoUrl" :customDomain="customDomain" multiple preview :region="region"
             :bucket="bucket" :accept="acceptVideo" :max="10" :size="1024000" :accessKeyId="accessKeyId"
             :accessKeySecret="accessKeySecret"></upload-to-ali> -->

+ 1 - 1
src/components/ctop/propModal.vue

@@ -10,7 +10,7 @@
         </a-form-item>
         <a-form-item label="照片" :labelCol="labelCol" :wrapperCol="wrapperCol">
           <uploadFile  v-if="visible" :value.sync="imageUrl" :fileCount="10"
-            uploadType="image" />
+            uploadType="image" :sizeCheck="false"/>
           <!-- <upload-to-ali v-model="imageUrl" :customDomain="customDomain" multiple preview :region="region"
             :bucket="bucket" :accept="acceptImage" :max="10" :size="1024000" :accessKeyId="accessKeyId"
             :accessKeySecret="accessKeySecret"></upload-to-ali> -->

+ 2 - 2
src/components/ctop/vm-card-prop.vue

@@ -199,7 +199,7 @@ li {
       @ok="handleOk('photo')"
       @cancel="handleCancel('photo')"
     >
-    <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false" />
+    <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false" :sizeCheck="false"/>
       <!-- <upload-to-ali
         style="margin:10px"
         v-model="imageUrl"
@@ -221,7 +221,7 @@ li {
       @ok="handleOk('video')"
       @cancel="handleCancel('video')"
     >
-    <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false" />
+    <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false" :sizeCheck="false"/>
       <!-- <upload-to-ali
         style="margin:10px"
         v-model="videoUrl"

+ 2 - 2
src/components/ctop/vm-card.vue

@@ -222,7 +222,7 @@ li {
       @ok="handleOk('photo')"
       @cancel="handleCancel('photo')"
     >
-    <uploadFile :value.sync="imageUrl" :fileCount="10" uploadType="image" />
+    <uploadFile :value.sync="imageUrl" :fileCount="10" uploadType="image" :sizeCheck="false"/>
       <!-- <upload-to-ali
         style="margin:10px"
         v-model="imageUrl"
@@ -244,7 +244,7 @@ li {
       @ok="handleOk('video')"
       @cancel="handleCancel('video')"
     >
-    <uploadFile :value.sync="videoUrl" :fileCount="10" uploadType="video" />
+    <uploadFile :value.sync="videoUrl" :fileCount="10" uploadType="video" :sizeCheck="false"/>
       <!-- <upload-to-ali
         style="margin:10px"
         v-model="videoUrl"

+ 17 - 131
src/components/formComponents/timeRange.vue

@@ -1,16 +1,7 @@
 
 <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, selection: selectedVal.indexOf(item.value) > -1, bgcolor: item.disabled }"
-        >{{ item.label }}</a-checkbox
-      >
-    </a-checkbox-group>
+  <div class="rang-picker">
+    <a-range-picker v-model="timeRange" :format="format" :allowClear="allowClear" :disabled-date="disabledDate" />
   </div>
 </template>
 
@@ -18,25 +9,26 @@
 // import { dictionary } from '@/components/service/core/dictionary'
 import { isArray } from '@/utils/Tools'
 import { httpAction, getAction } from '@/api/manage'
+import moment from 'moment'
 export default {
-  name: 'CheckboxGroup', // checkbox组件二次封装
+  name: 'rang-picker', // 日期选择器组件二次封装
   props: {
-    code: {
-      // 参数code
+    format: {
       type: String,
-      default: '',
+      default() {
+        return 'YYYY-MM-DD'
+      },
     },
-    allValue: {
+    allowClear: {
       type: Boolean,
       default() {
         return false
       },
     },
-    options: {
-      // 外部传入的option 可替代请求项
-      type: Array,
-      default() {
-        return []
+    disabledDate: {
+      type: Function,
+      default(current) {
+        return current && current < moment().subtract(1, 'days')
       },
     },
     value: {
@@ -46,16 +38,6 @@ export default {
         return []
       },
     },
-    label: {
-      // label 绑定值
-      type: [Array, String],
-      default: '',
-    },
-    radioStyle: {
-      // 是否复选框模拟单选效果
-      type: Boolean,
-      default: false,
-    },
     disabled: {
       // 是否禁用
       type: Boolean,
@@ -68,121 +50,25 @@ export default {
       selectOption: [],
     }
   },
-  watch: {
-    options(val) {
-      if (isArray(val)) {
-        this.selectOption.splice(0, this.selectOption.length)
-        this.selectOption.push(...val)
-      }
-    },
-    selectedVal(n, o) {
-      console.log(n, o)
-      if (this.radioStyle && !this.allValue) {
-        if (n.length == 0) {
-          this.selectedVal = o
-        }
-      }
-    },
-  },
+  watch: {},
   computed: {
-    selectedVal: {
+    timeRange: {
       get: function () {
         return this.value
       },
       set: function (val) {
-        this.selectChange(val)
+        this.$emit('input', 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)
-      }
-    })
+    this.$nextTick(() => {})
   },
   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: '' })
-          }
-          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 == '') == 0) {
-            retrunData = val.slice(-1)
-          } else if (val.findIndex((item) => item == '') == val.length - 1) {
-            retrunData = ['']
-          } 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 = ['']
-          }
-        } 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>

+ 337 - 0
src/components/formComponents/toutiaoTime.vue

@@ -0,0 +1,337 @@
+<template>
+  <div class="calendar">
+    <table class="time_table table" v-on:mouseleave="mouseleave">
+      <thead>
+        <tr>
+          <th rowspan="2" style="width:120px">日期/时间(时)</th>
+        </tr>
+        <tr>
+          <th class="unselectable" colspan="2" v-for="(num, index) in numData" :key="index" style="width:50px">{{ num }}
+          </th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr v-for="(options, index) in timeData" :key="index">
+          <th scope="row">{{ options.date }}</th>
+          <td v-for="(timeItem, key) in options.time" :key="key" style="width:15px"
+            :class="[{ active_select: timeItem.isSelected, active_select_move: timeItem.show }]"
+            v-on:mousedown="mousedown(index, key)" v-on:mouseover="mouseover(index, key)"
+            v-on:mouseup="mouseup(index, key)" @click="showOne(index, key)"></td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+</template>
+<script>
+  var arr = []
+  for (let i = 0; i < 48; i++) {
+    arr.push(i / 2)
+  }
+  export default {
+    name: 'calendar-table',
+    props: {
+      scheduleTime: {
+        type: String,
+        default () {
+          var str = ''
+          for (let i = 0; i < 7 * 48; i++) {
+            str += '0'
+          }
+          return str
+        }
+      }
+    },
+    data() {
+      return {
+        show: false,
+        numData: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ],
+        // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ],
+        dateTime: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
+        timeData: [{
+            date: '周一',
+            time: []
+          },
+          {
+            date: '周二',
+            time: []
+          },
+          {
+            date: '周三',
+            time: []
+          },
+          {
+            date: '周四',
+            time: []
+          },
+          {
+            date: '周五',
+            time: []
+          },
+          {
+            date: '周六',
+            time: []
+          },
+          {
+            date: '周日',
+            time: []
+          }
+        ],
+        selectFlag: false,
+        max: {
+          x: 0,
+          y: 0
+        },
+        dataString: ''
+      }
+    },
+    methods: {
+      // handleClose(item) {
+      //   var index = Math.floor(item / 24)
+      //   var key = item % 7
+      //   if (this.timeData[index].time[key].value == false) {
+      //     if (this.timeData[index].time[key].isSelected) {
+      //       this.timeData[index].time[key].isSelected = false
+      //     } else {
+      //       this.$set(this.timeData[index].time[key], 'isSelected', true)
+      //     }
+      //   }
+      // },
+      showOne(index, key) {
+        //   this.timeData[index].time[key].isSelected = !this.timeData[index].time[key].isSelected
+      },
+      mousedown: function (index, key) {
+        this.selectStart = []
+        this.selectFlag = true
+        if (this.timeData[index].time[key].value == false) {
+          if (this.timeData[index].time[key].isSelected) {
+            this.timeData[index].time[key].isSelected = false
+          } else {
+            this.$set(this.timeData[index].time[key], 'isSelected', true)
+          }
+        }
+        this.selectStart.push({
+          index: index,
+          key: key
+        })
+      },
+      mouseover: function (index, key) {
+        // x 垂直方向  y 水平方向
+        if (this.selectFlag) {
+          if (index >= this.max.x) {
+            this.max.x = index
+          }
+          if (key >= this.max.y) {
+            this.max.y = key
+          }
+          var start = {
+            x: this.selectStart[0].index,
+            y: this.selectStart[0].key
+          }
+          var end = {
+            x: index,
+            y: key
+          }
+          for (var i = end.x; i <= this.max.x; i++) {
+            for (var j = end.y; j <= this.max.y; j++) {
+              this.$set(this.timeData[i].time[j], 'isSelected', false)
+            }
+          }
+          /* 渲染选中的区域 */
+          // for (var i = start.x; i <= end.x; i++) {
+          //   for (var j = start.y; j <= end.y; j++) {
+          //     // this.$set(this.timeData[i].time[j], 'isSelected', true)
+          //     this.$set(this.timeData[i].time[j], 'show', true)
+          //   }
+          // }
+          for (var i = start.x; i <= end.x; i++) {
+            for (var j = start.y; j <= end.y; j++) {
+              this.$set(this.timeData[i].time[j], 'isSelected', true)
+            }
+          }
+        }
+      },
+      mouseup: function (index, key) {
+        var start = {
+          x: this.selectStart[0].index,
+          y: this.selectStart[0].key
+        }
+        var end = {
+          x: index,
+          y: key
+        }
+        /* 渲染选中的区域 */
+        var data = []
+        var arr = []
+        //   for (let i = 0; i < this.timeData.length; i++) {
+        //     for (let j = 0; j < this.timeData[i].time.length; j++) {
+        //       this.timeData[i].time[j].show = false
+        //     }
+        //   }
+        arr = data.concat(
+          this.timeData[0].time,
+          this.timeData[1].time,
+          this.timeData[2].time,
+          this.timeData[3].time,
+          this.timeData[4].time,
+          this.timeData[5].time,
+          this.timeData[6].time
+        )
+        this.dataString = arr.map(item => {
+          if (item.isSelected) {
+            return 1
+          } else {
+            return 0
+          }
+        })
+        console.log(this.dataString.join(''))
+        this.$emit('update:scheduleTime', this.dataString.join(''))
+        this.selectFlag = false
+        this.max = {
+          x: 0,
+          y: 0
+        }
+      },
+      mouseleave: function () {
+        this.selectFlag = false
+      },
+      setItemDate(sum) {
+        let i = sum
+        if (i < 24) {
+          return '周一' + i + ':00~' + (i + 1) + ':00'
+        } else if (i < 48 && i >= 24) {
+          return '周二' + (i - 24) + ':00~' + (i - 23) + ':00'
+        } else if (i < 72 && i >= 48) {
+          return '周三' + (i - 48) + ':00~' + (i - 47) + ':00'
+        } else if (i < 96 && i >= 72) {
+          return '周四' + (i - 72) + ':00~' + (i - 71) + ':00'
+        } else if (i < 120 && i >= 96) {
+          return '周五' + (i - 96) + ':00~' + (i - 95) + ':00'
+        } else if (i < 144 && i >= 120) {
+          return '周六' + (i - 120) + ':00~' + (i - 119) + ':00'
+        } else {
+          return '周日' + (i - 144) + ':00~' + (i - 143) + ':00'
+        }
+      },
+      init() {
+        var str = this.scheduleTime
+        var arr = str.split('')
+        this.timeData = [{
+            date: '周一',
+            time: []
+          },
+          {
+            date: '周二',
+            time: []
+          },
+          {
+            date: '周三',
+            time: []
+          },
+          {
+            date: '周四',
+            time: []
+          },
+          {
+            date: '周五',
+            time: []
+          },
+          {
+            date: '周六',
+            time: []
+          },
+          {
+            date: '周日',
+            time: []
+          }
+        ]
+        for (let i = 0; i < arr.length; i++) {
+          if (i < 48) {
+            this.timeData[0].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          } else if (i < 96 && i >= 48) {
+            this.timeData[1].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          } else if (i < 144 && i >= 96) {
+            this.timeData[2].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          } else if (i < 192 && i >= 144) {
+            this.timeData[3].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          } else if (i < 240 && i >= 192) {
+            this.timeData[4].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          } else if (i < 288 && i >= 240) {
+            this.timeData[5].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          } else {
+            this.timeData[6].time.push({
+              isSelected: arr[i] == 1 ? true : false,
+              move: false,
+              value: false
+            })
+          }
+        }
+      }
+    },
+    watch: {
+      scheduleTime: {
+        immediate: true, // immediate选项可以开启首次赋值监听
+        handler(newVal, oldVal) {
+          this.init()
+        }
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  .time_table {
+    border: 1px solid #ccc;
+    border-collapse: collapse;
+  }
+
+  .time_table th,
+  .time_table td {
+    border: 1px solid #ccc;
+    text-align: center;
+  }
+
+  .time_table .unselectable {
+    width: 5px !important;
+    height: 30px;
+  }
+
+  .active_select {
+    background: cornflowerblue;
+  }
+
+  .active_select_move {
+    background: aqua;
+  }
+
+  * {
+    -webkit-touch-callout: none !important;
+    -webkit-user-select: none !important;
+    -moz-user-select: none !important;
+    -ms-user-select: none !important;
+    user-select: none !important;
+  }
+</style>

+ 237 - 216
src/components/uploadFile.vue

@@ -4,95 +4,105 @@
 </style>
 <template>
   <div class="upload-file">
-    <a-upload name="file" :multiple="multiple" list-type="picture-card" class="avatar-uploader"
-      action="https://media-1301855440.cos.ap-chongqing.myqcloud.com/" :before-upload="beforeUpload"
-      @change="handleChange" :accept="uploadType+'/'+(uploadType=='image'?'jpeg,image/jpg':'mp4')" :file-list="fileList"
-      :remove="removeFile" @preview="handlePreview" :disabled="loadingElse||disabled">
-      <div v-if="fileList.length < fileCount||fileList.length<1">
-        <a-progress v-if='loadingElse' :percent="percent" :show-info="false" />
-        <div class="ant-upload-text">
-          点击上传
-        </div>
+    <a-upload
+      name="file"
+      :multiple="multiple"
+      list-type="picture-card"
+      class="avatar-uploader"
+      action="https://media-1301855440.cos.ap-chongqing.myqcloud.com/"
+      :before-upload="beforeUpload"
+      @change="handleChange"
+      :accept="uploadType + '/' + (uploadType == 'image' ? 'jpeg,image/jpg' : 'mp4')"
+      :file-list="fileList"
+      :remove="removeFile"
+      @preview="handlePreview"
+      :disabled="loadingElse || disabled"
+    >
+      <div v-if="fileList.length < fileCount || fileList.length < 1">
+        <a-progress v-if="loadingElse" :percent="percent" :show-info="false" />
+        <div class="ant-upload-text">点击上传</div>
       </div>
     </a-upload>
-    <div style="color:red">{{uploadType=='image'?'请上传jpg格式的图片,并且大小在2m之内':'请上传mp4格式,大小在100m之内'}}</div>
+    <div style="color: red" v-if="sizeCheck">
+      {{ uploadType == 'image' ? '请上传jpg格式的图片,并且大小在2m之内' : '请上传mp4格式,大小在100m之内' }}
+    </div>
     <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
-      <img alt="example" style="width: 100%" :src="previewImage" v-if="uploadType=='image'" />
+      <img alt="example" style="width: 100%" :src="previewImage" v-if="uploadType == 'image'" />
       <video :src="previewImage" v-else style="width: 100%" controls="controls">您的浏览器不支持 video 标签。</video>
     </a-modal>
   </div>
 </template>
 
 <script>
-  import {
-    stopOtherVideo,
-    closeAllVideoFun
-  } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
-  import {
-    mapGetters
-  } from 'vuex'
-  import moment from 'moment'
+import { stopOtherVideo, closeAllVideoFun } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
+import { mapGetters } from 'vuex'
+import moment from 'moment'
 
-  import BMF from 'browser-md5-file'
+import BMF from 'browser-md5-file'
 
-  import qs from 'qs'
-  var COS = require('cos-js-sdk-v5');
-  var cos = new COS({
-    SecretId: 'AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets',
-    SecretKey: 'tXzuwMfplTTK3c9GFUyETilasvQfePu9',
-  });
-  var i = 0
-  const oneKB = 1024
+import qs from 'qs'
+var COS = require('cos-js-sdk-v5')
+var cos = new COS({
+  SecretId: 'AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets',
+  SecretKey: 'tXzuwMfplTTK3c9GFUyETilasvQfePu9',
+})
+var i = 0
+const oneKB = 1024
 
-  function getBase64(file) {
-    return new Promise((resolve, reject) => {
-      const reader = new FileReader();
-      reader.readAsDataURL(file);
-      reader.onload = () => resolve(reader.result);
-      reader.onerror = error => reject(error);
-    });
-  }
-  export default {
-    name: 'upload-file',
-    components: {},
-    props: {
-      uploadType: { //上传类型  值为  image/video,同时目录名称也是这样
-        type: String,
-        default () {
-          return 'image'
-        }
-      },
-      multiple: { // true 可以批量上传  false 不可以
-        type: Boolean,
-        default () {
-          return true
-        }
+function getBase64(file) {
+  return new Promise((resolve, reject) => {
+    const reader = new FileReader()
+    reader.readAsDataURL(file)
+    reader.onload = () => resolve(reader.result)
+    reader.onerror = (error) => reject(error)
+  })
+}
+export default {
+  name: 'upload-file',
+  components: {},
+  props: {
+    uploadType: {
+      //上传类型  值为  image/video,同时目录名称也是这样
+      type: String,
+      default() {
+        return 'image'
       },
-      fileCount: { //最大上传数量
-        type: Number,
-        default () {
-          return 10
-        }
+    },
+    multiple: {
+      // true 可以批量上传  false 不可以
+      type: Boolean,
+      default() {
+        return true
       },
-      checkFile: { //返回promise方法,判读文件是否上传过,进行上传拦截
-        type: Function,
-        default () {
-          return Promise.resolve()
-        }
+    },
+    fileCount: {
+      //最大上传数量
+      type: Number,
+      default() {
+        return 10
       },
-      disabled: {
-        type: Boolean,
-        default () {
-          return false
-        }
+    },
+    checkFile: {
+      //返回promise方法,判读文件是否上传过,进行上传拦截
+      type: Function,
+      default() {
+        return Promise.resolve()
       },
-      value: {
-        type: [String, Array],
-        required: true
+    },
+    disabled: {
+      type: Boolean,
+      default() {
+        return false
       },
-      size: {
-        type: Number,
-        default () {
+    },
+    value: {
+      type: [String, Array],
+      required: true,
+    },
+    size: {
+      type: Number,
+      default() {
+        if (this.sizeCheck) {
           if (this.uploadType == 'image') {
             return 2048
           } else {
@@ -100,172 +110,178 @@
           }
         }
       },
-      onOversize: {
-        type: Function,
-        default () {
-          alert(`请选择${this.size}KB内的文件!`)
-        }
-      },
     },
-    data() {
-      return {
-        fileList: [],
-        loadingElse: false,
-        imageUrl: '',
-        percent: 0,
-        previewVisible: false,
-        previewImage: '',
-      }
+    sizeCheck: {
+      type: Boolean,
+      default() {
+        return true
+      },
     },
-    filters: {},
-    computed: {},
-    mounted() {
-
+    onOversize: {
+      type: Function,
+      default() {
+        alert(`请选择${this.size}KB内的文件!`)
+      },
     },
-    watch: {
-      //    fileListAll
-      value: {
-        immediate: true,
-        handler(n, o) {
-          if (this.fileList.length == 0) {
-            if (typeof n == 'object') {
-              this.fileList = n.map((item, index) => {
-                return {
-                  uid: index + 1,
-                  name: index + 1,
-                  status: 'done',
-                  url: item,
-                }
-              })
+  },
+  data() {
+    return {
+      fileList: [],
+      loadingElse: false,
+      imageUrl: '',
+      percent: 0,
+      previewVisible: false,
+      previewImage: '',
+    }
+  },
+  filters: {},
+  computed: {},
+  mounted() {},
+  watch: {
+    //    fileListAll
+    value: {
+      immediate: true,
+      handler(n, o) {
+        if (this.fileList.length == 0) {
+          if (typeof n == 'object') {
+            this.fileList = n.map((item, index) => {
+              return {
+                uid: index + 1,
+                name: index + 1,
+                status: 'done',
+                url: item,
+              }
+            })
+          } else {
+            if (n == '') {
+              this.fileList = []
             } else {
-              if (n == '') {
-                this.fileList = []
-              } else {
-                this.fileList = [{
+              this.fileList = [
+                {
                   uid: 1,
                   name: 1,
                   status: 'done',
                   url: n,
-                }]
-
-              }
-
-            }
-          } else {
-            if (n.length == 0 || n == '') {
-              this.clearAll()
+                },
+              ]
             }
           }
-
-        },
-        deep: true
-      }
-    },
-    methods: {
-      handleCancel() {
-        closeAllVideoFun()
-        this.previewVisible = false;
-      },
-      handleChange(info) {
-        if (info.file.status === 'uploading') {
-          this.loading = true;
-          return;
-        }
-        if (info.file.status === 'done') {
-          // Get this url from response in real world.
-          getBase64(info.file.originFileObj, imageUrl => {
-            this.imageUrl = imageUrl;
-            this.loading = false;
-          });
-        }
-      },
-      removeFile(file) {
-        // console.log(file)
-        var index = this.fileList.findIndex(v => v.uid === file.uid)
-        this.fileList.splice(index, 1)
-        this.$emit('removeUpload', file)
-      },
-      async handlePreview(file) {
-        if (!file.url && !file.preview) {
-          file.preview = await getBase64(file.originFileObj);
+        } else {
+          if (n.length == 0 || n == '') {
+            this.clearAll()
+          }
         }
-        this.previewImage = file.url || file.preview;
-        this.previewVisible = true;
       },
-      beforeUpload(file) {
-        this.percent = 0
-        this.loadingElse = true
-        const fileOvesize = (file.size > this.size * oneKB)
-        // console.log(fileOvesize)
-        if (fileOvesize) {
-          this.onOversize()
-          this.loadingElse = false
-          return
-        } else {
-          this.checkFile(file).then(res => {
+      deep: true,
+    },
+  },
+  methods: {
+    handleCancel() {
+      closeAllVideoFun()
+      this.previewVisible = false
+    },
+    handleChange(info) {
+      if (info.file.status === 'uploading') {
+        this.loading = true
+        return
+      }
+      if (info.file.status === 'done') {
+        // Get this url from response in real world.
+        getBase64(info.file.originFileObj, (imageUrl) => {
+          this.imageUrl = imageUrl
+          this.loading = false
+        })
+      }
+    },
+    removeFile(file) {
+      // console.log(file)
+      var index = this.fileList.findIndex((v) => v.uid === file.uid)
+      this.fileList.splice(index, 1)
+      this.$emit('removeUpload', file)
+    },
+    async handlePreview(file) {
+      if (!file.url && !file.preview) {
+        file.preview = await getBase64(file.originFileObj)
+      }
+      this.previewImage = file.url || file.preview
+      this.previewVisible = true
+    },
+    beforeUpload(file) {
+      this.percent = 0
+      this.loadingElse = true
+      const fileOvesize = file.size > this.size * oneKB
+      // console.log(fileOvesize)
+      if (fileOvesize && this.sizeCheck) {
+        this.onOversize()
+        this.loadingElse = false
+        return
+      } else {
+        this.checkFile(file)
+          .then((res) => {
             this.cosUpload(file)
-
-          }).catch(() => {
-            this.loadingElse = false
           })
-          return new Promise(function (resolve, reject) {
-            reject()
+          .catch(() => {
+            this.loadingElse = false
           })
+        return new Promise(function (resolve, reject) {
+          reject()
+        })
+      }
+    },
+    clearAll() {
+      this.fileList = []
+    },
+    cosUpload(file) {
+      var that = this
+      let date = new Date()
+      let y = date.getFullYear()
+      let MM = date.getMonth() + 1
+      MM = MM < 10 ? '0' + MM : MM
+      let d = date.getDate()
+      d = d < 10 ? '0' + d : d
+      var timeElse = new Date().getTime()
+      var arr = file.name.split('.')
 
-        }
-
-      },
-      clearAll() {
-        this.fileList = []
-      },
-      cosUpload(file) {
-        var that = this
-        let date = new Date()
-        let y = date.getFullYear()
-        let MM = date.getMonth() + 1
-        MM = MM < 10 ? '0' + MM : MM
-        let d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var timeElse = new Date().getTime()
-        var arr = file.name.split('.')
-
-        var str = ''
-        for (let i = 0; i < arr.length; i++) {
-          if (i == arr.length - 1) {} else {
-            if (i == arr.length - 2) {
-              str += arr[i]
-            } else {
-              str += (arr[i] + '.')
-            }
+      var str = ''
+      for (let i = 0; i < arr.length; i++) {
+        if (i == arr.length - 1) {
+        } else {
+          if (i == arr.length - 2) {
+            str += arr[i]
+          } else {
+            str += arr[i] + '.'
           }
-
         }
-        // console.log(str + '-' + timeElse + '.' + arr[arr.length - 1])
-        cos.putObject({
+      }
+      // console.log(str + '-' + timeElse + '.' + arr[arr.length - 1])
+      cos.putObject(
+        {
           Bucket: 'media-1301855440',
           /* 必须 */
           Region: 'ap-chongqing',
           /* 存储桶所在地域,必须字段 */
-          Key: that.uploadType + '/' + y + '-' + MM + '-' + d + '/' + str + '-' + timeElse + '.' + arr[arr
-            .length - 1],
+          Key: that.uploadType + '/' + y + '-' + MM + '-' + d + '/' + str + '-' + timeElse + '.' + arr[arr.length - 1],
           /* 必须 */
           StorageClass: 'STANDARD',
           Body: file, // 上传文件对象
-          onProgress: function (progressData) { //进度条方法
+          onProgress: function (progressData) {
+            //进度条方法
 
-            that.percent = (progressData.percent * 100)
+            that.percent = progressData.percent * 100
           },
           onTaskReady: function (tid) {
             // console.log('onTaskReady', tid);
           },
-          onTaskStart: function (info) { //开始上传
+          onTaskStart: function (info) {
+            //开始上传
             // console.log('onTaskStart', info);
           },
-        }, function (err, data) {
+        },
+        function (err, data) {
           if (err) {
             that.loadingElse = false
             that.$message.error('上传失败!!!' + err)
-            return;
+            return
           }
           // alert('成功')
           that.loadingElse = false
@@ -283,24 +299,29 @@
             that.$emit('overUpload', that.fileList)
 
             if (that.multiple) {
-              that.$emit('update:value', that.fileList.map(item => {
-                return item.url
-              }))
+              that.$emit(
+                'update:value',
+                that.fileList.map((item) => {
+                  return item.url
+                })
+              )
             } else {
-              that.$emit('update:value', that.fileList.map(item => {
-                return item.url
-              })[0])
+              that.$emit(
+                'update:value',
+                that.fileList.map((item) => {
+                  return item.url
+                })[0]
+              )
             }
-
-
           } else {
             that.$message.error('上传已达上限' + that.fileCount + '张')
           }
-        });
-      }
-    }
-  }
+        }
+      )
+    },
+  },
+}
 </script>
 <style scoped>
-  @import '~@assets/less/common.less';
+@import '~@assets/less/common.less';
 </style>

+ 3 - 3
src/views/modules/actor/modules/ActorModal.vue

@@ -23,7 +23,7 @@
           :wrapperCol="wrapperCol"
         >
 
-        <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false" />
+        <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false"  :sizeCheck="false"/>
           <!-- <upload-to-ali
             v-model="imageUrl"
             :customDomain="customDomain"
@@ -43,7 +43,7 @@
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
         >
-        <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false" />
+        <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false"  :sizeCheck="false"/>
           <!-- <upload-to-ali
             v-model="videoUrl"
             :customDomain="customDomain"
@@ -53,7 +53,7 @@
             :bucket="bucket"
             :accept="acceptVideo"
             :max="10"
-            :size="1024000"
+            :size="1024000" 
             :accessKeyId="accessKeyId"
             :accessKeySecret="accessKeySecret"
           ></upload-to-ali> -->

+ 8 - 3
src/views/modules/earlyWarningRules/ruleModule.vue

@@ -2,7 +2,7 @@
   <div class="ruleModule">
     <div class="toolbox-automate-rules-create-body">
       <div class="toolbox-automate-rules-create-content_title"><h3>新建自动规则</h3></div>
-      {{ ceshi }}
+      {{ ceshi }}{{ time }}
       <br />
       <selectGroup v-model="ceshi2" style="width: 300px" code="37f678d06fc45b494a924894355d6f76" :multiple="true" />
       <checkBoxGroup
@@ -12,6 +12,7 @@
         :allValue="false"
         :radioStyle="true"
       />
+      <timeRange v-model="time" :allowClear="true" :disabledDate="disabledDate" />
       <div class="toolbox-automate-rules-create-content">
         <a-form-model ref="ruleForm" :model="form" :rules="rules">
           <div class="moduler">
@@ -437,7 +438,7 @@ import { Switch } from 'ant-design-vue'
 import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
 import selectGroup from '@/components/formComponents/selectGroup'
 import checkBoxGroup from '@/components/formComponents/checkBoxGroup'
-import radioCheck from '@/components/formComponents/radioCheck'
+import timeRange from '@/components/formComponents/timeRange'
 let statusList = [
   // {
   //     id:1,
@@ -555,12 +556,13 @@ export default {
     Treeselect,
     selectGroup,
     checkBoxGroup,
-    radioCheck,
+    timeRange,
   },
   data() {
     return {
       ceshi: ['CONVERSION'],
       ceshi2: [],
+      time: [moment('2020/11/16', 'YYYY-MM-DD'), moment('2020/11/17', 'YYYY-MM-DD')],
       campaignList: [],
       currentRuleId: '',
       rulesFieldList: [],
@@ -656,6 +658,9 @@ export default {
     },
   },
   methods: {
+    disabledDate(current) {
+      return current && current < moment().subtract(1, 'days')
+    },
     // 应用方式改变
     applyRangeChange(e) {
       console.log(e.target.value)

+ 1 - 1
src/views/modules/prop/modules/ActorModal.vue

@@ -10,7 +10,7 @@
         </a-form-item>
         <a-form-item label="照片" :labelCol="labelCol" :wrapperCol="wrapperCol">
           <uploadFile  v-if="visible" :value.sync="imageUrl" :fileCount="10"
-            uploadType="image" />
+            uploadType="image"  :sizeCheck="false"/>
           <!-- <upload-to-ali v-model="imageUrl" :customDomain="customDomain" multiple preview :region="region"
             :bucket="bucket" :accept="acceptImage" :max="10" :size="1024000" :accessKeyId="accessKeyId"
             :accessKeySecret="accessKeySecret"></upload-to-ali> -->

+ 4 - 4
src/views/modules/yard/YardList.vue

@@ -128,7 +128,7 @@
               <li v-for="(item,index) of photoList" :key="index" @click="showImage(item)">
                 <a-icon type="close-circle"
                   style="position:absolute;top:-5px;right:-5px;color:red;z-index:10;cursor: pointer;"
-                  @click="deteleImg(item.id)" />
+                  @click.stop="deteleImg(item.id)" />
                 <img :src="item.photoUrl" alt />
               </li>
             </ul>
@@ -184,14 +184,14 @@
 
     <!-- 新增图集 -->
     <a-modal v-model="addPhoto" title="新增图集" @ok="handleOk('photo')" @cancel="handleCancel('photo')">
-        <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false" />
+        <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false" :sizeCheck="false"/>
       <!-- <upload-to-ali style="margin:10px" v-model="imageUrl" :customDomain="customDomain" preview :region="region"
         :bucket="bucket" :accept="acceptImage" :max="1" :size="1024000" :accessKeyId="accessKeyId"
         :accessKeySecret="accessKeySecret"></upload-to-ali> -->
     </a-modal>
     <!-- 新增作品 -->
     <a-modal v-model="addVideo" title="新增作品" @ok="handleOk('video')" @cancel="handleCancel('video')">
-        <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false" />
+        <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false"  :sizeCheck="false"/>
       <!-- <upload-to-ali style="margin:10px" v-model="videoUrl" :customDomain="customDomain" preview :region="region"
         :bucket="bucket" :accept="acceptVideo" :max="1" :size="1024000" :accessKeyId="accessKeyId"
         :accessKeySecret="accessKeySecret"></upload-to-ali> -->
@@ -348,7 +348,7 @@
         if (key == '1') {
           this.currentPage = 1
           this.getPhoto()
-        } else if (key == '2') {
+        } else if (key == '3') {
           this.currentPage = 1
           this.getVideo()
         }

+ 2 - 2
src/views/modules/yard/modules/YardModal.vue

@@ -17,10 +17,10 @@
           <a-input placeholder="请输入地址" v-decorator="['address']" />
         </a-form-item>
         <a-form-item label="照片" :labelCol="labelCol" :wrapperCol="wrapperCol">
-          <uploadFile v-if="visible" :value.sync="imageUrl" :fileCount="10" uploadType="image" />
+          <uploadFile v-if="visible" :value.sync="imageUrl" :fileCount="10" uploadType="image" :sizeCheck="false"/>
         </a-form-item>
         <a-form-item label="视频" :labelCol="labelCol" :wrapperCol="wrapperCol">
-          <uploadFile v-if="visible" :value.sync="videoUrl" :fileCount="10" uploadType="video" />
+          <uploadFile v-if="visible" :value.sync="videoUrl" :fileCount="10" uploadType="video" :sizeCheck="false"/>
         </a-form-item>
 
         <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="联系人姓名">

+ 2 - 2
src/views/modules/yard/modules/yardDetail.vue

@@ -103,7 +103,7 @@ li {
       @ok="handleOk('photo')"
       @cancel="handleCancel('photo')"
     >
-     <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false" />
+     <uploadFile :value.sync="imageUrl" :fileCount="1" uploadType="image" :multiple="false"  :sizeCheck="false"/>
       <!-- <upload-to-ali
         style="margin:10px"
         v-model="imageUrl"
@@ -125,7 +125,7 @@ li {
       @ok="handleOk('video')"
       @cancel="handleCancel('video')"
     >
-    <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false" />
+    <uploadFile :value.sync="videoUrl" :fileCount="1" uploadType="video" :multiple="false"  :sizeCheck="false"/>
       <!-- <upload-to-ali
         style="margin:10px"
         v-model="videoUrl"