chenrui il y a 4 ans
Parent
commit
b061d3cfef

+ 1 - 1
src/views/productManagement/priceChangeRecord/list.vue

@@ -69,7 +69,7 @@
     </div>
     <!-- 总计 -->
     <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div slot="message">合计:<strong>{{ total }}</strong></div>
+      <div slot="message">合计:<strong>{{ total }}</strong></div>
     </a-alert>
     <!-- 列表 -->
     <s-table

+ 56 - 2
src/views/setting/noticeManagement/editModal.vue

@@ -39,6 +39,7 @@
             format="YYYY-MM-DD HH:mm:ss"
             placeholder="年/月/日 时/分/秒"
             :disabled-date="disabledDate"
+            :disabledTime="disabledDateTime"
             v-model="form.releaseDate"/>
         </a-form-model-item>
         <a-form-model-item label="图片上传" prop="imgPaths">
@@ -141,8 +142,61 @@ export default {
   },
   methods: {
     disabledDate (current) {
-      // Can not select days before today and today
-      return current && current < moment().subtract(1, 'days')
+      return current && current < moment().startOf('day')
+    },
+    disabledDateTime (date) {
+      if (!date) {
+        date = moment()
+      }
+      return {
+        disabledHours: () => this.getDisabledHours(date.format('YYYY-MM-DD HH:mm:ss')),
+        disabledMinutes: () => this.getDisabledMinutes(date.format('YYYY-MM-DD HH:mm:ss')),
+        disabledSeconds: () => this.getDisabledSeconds(date.format('YYYY-MM-DD HH:mm:ss'))
+      }
+    },
+    // 禁用时间范围  时
+    getDisabledHours (nowTime) {
+      const todayDate = moment().format('YYYY-MM-DD HH:mm:ss')
+      const time = nowTime.split(' ')
+      const times = todayDate.split(' ')
+      const timeArrs = times[1].split(':')
+      const hours = []
+      if (todayDate.split(' ')[0] == time[0]) {
+        for (var i = 0; i < parseInt(timeArrs[0]); i++) {
+          hours.push(i)
+        }
+      }
+      return hours
+    },
+    // 禁用时间范围  分
+    getDisabledMinutes (nowTime) {
+      const todayDate = moment().format('YYYY-MM-DD HH:mm:ss')
+      const time = nowTime.split(' ')
+      const times = todayDate.split(' ')
+      const timeArr = time[1].split(':')
+      const timeArrs = times[1].split(':')
+      const minutes = []
+      if (todayDate.split(' ')[0] == time[0] && timeArrs[0] == timeArr[0]) {
+        for (var i = 0; i < parseInt(timeArrs[1]); i++) {
+          minutes.push(i)
+        }
+      }
+      return minutes
+    },
+    // 禁用时间范围  秒
+    getDisabledSeconds (nowTime) {
+      const todayDate = moment().format('YYYY-MM-DD HH:mm:ss')
+      const time = nowTime.split(' ')
+      const times = todayDate.split(' ')
+      const timeArr = time[1].split(':')
+      const timeArrs = times[1].split(':')
+      const second = []
+      if (todayDate.split(' ')[0] == time[0] && timeArrs[0] == timeArr[0] && timeArrs[1] == timeArr[1]) {
+        for (var i = 0; i <= parseInt(timeArrs[2]); i++) {
+          second.push(i)
+        }
+      }
+      return second
     },
     //  详情
     getDetail () {