[FIX]bug_GFRS-468客户管理重要事件列表-已提醒状态事件去掉编辑按钮

[FIX]bug_GFRS-467客户管理重要事件提醒-编辑客户事件时,提醒时间应当不可以选择当前时间之前的时间
This commit is contained in:
yuweiqi
2020-01-14 15:21:59 +08:00
parent 05a8c9f7c1
commit 7b78f0135d
3 changed files with 384 additions and 367 deletions

View File

@@ -1,43 +1,50 @@
<template> <template>
<div class="addMilesone"> <div class="addMilesone">
<van-cell-group> <van-cell-group>
<van-field v-model="noticeDate" class="fs14" label="提醒日期" v-validate="'required'" name="提醒日期" placeholder="请选择" @click="show = true" :readonly="true"/> <van-field
v-model="noticeDate"
class="fs14"
label="提醒日期"
v-validate="'required'"
name="提醒日期"
placeholder="请选择"
@click="show = true"
:readonly="true"
/>
</van-cell-group> </van-cell-group>
<van-cell-group> <van-cell-group>
<van-field v-model="noticeTime" class="fs14" label="提醒时间" v-validate="'required'" name="提醒时间" placeholder="请选择" @click="timeShow = true" :readonly="true"/> <van-field
v-model="noticeTime"
class="fs14"
label="提醒时间"
v-validate="'required'"
name="提醒时间"
placeholder="请选择"
@click="timeShow = true"
:readonly="true"
/>
</van-cell-group> </van-cell-group>
<van-cell-group> <van-cell-group>
<van-field v-model="eventContent" label="事件内容" v-validate="'required'" name="事件内容" placeholder="请输入" class="text fs14" type="textarea" /> <van-field v-model="eventContent" label="事件内容" v-validate="'required'" name="事件内容" placeholder="请输入" class="text fs14" type="textarea" />
</van-cell-group> </van-cell-group>
<van-button type="danger" @click="save" class="bottom-btn fs16">保存</van-button> <van-button type="danger" @click="save" class="bottom-btn fs16">保存</van-button>
<van-popup v-model="show" position="bottom"> <van-popup v-model="show" position="bottom">
<van-datetime-picker <van-datetime-picker v-model="currentDate" type="date" @confirm="ok" @cancel="cancel" :min-date="minDate" :formatter="formatter" />
v-model="currentDate"
type="date"
@confirm="ok"
@cancel="cancel"
:min-date="minDate"
:formatter="formatter"
/>
</van-popup> </van-popup>
<van-popup v-model="timeShow" position="bottom"> <van-popup v-model="timeShow" position="bottom">
<van-datetime-picker <van-datetime-picker v-model="currentTime" type="time" @confirm="okTime" @cancel="cancelTime" :filter="filter" />
v-model="currentTime"
type="time"
@confirm="okTime"
@cancel="cancelTime"
:filter="filter"
/>
</van-popup> </van-popup>
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue'
import { Field,CellGroup,DatetimePicker,Popup } from 'vant'; import { Field, CellGroup, DatetimePicker, Popup } from 'vant'
import { saveOrUpdate } from '@/api/ebiz/milestone/milestone.js' import { saveOrUpdate } from '@/api/ebiz/milestone/milestone.js'
Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup); Vue.use(Field)
.use(CellGroup)
.use(DatetimePicker)
.use(Popup)
export default { export default {
name: 'addMilestone', name: 'addMilestone',
data() { data() {
@@ -55,9 +62,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
minHour: 0 minHour: 0
} }
}, },
mounted(){ mounted() {},
},
methods: { methods: {
save() { save() {
this.$validator.validate().then(valid => { this.$validator.validate().then(valid => {
@@ -77,7 +82,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
eventContent: $this.eventContent, // 事件内容 eventContent: $this.eventContent, // 事件内容
noticeDate: $this.noticeDate, //提示日期 yyyy-MM-dd noticeDate: $this.noticeDate, //提示日期 yyyy-MM-dd
noticeTime: $this.noticeTime + ':00', // 提示时间 HH:mm:ss noticeTime: $this.noticeTime + ':00', // 提示时间 HH:mm:ss
noticeStatus: "00"// 提示状态 00 未提醒(固定) noticeStatus: '00' // 提示状态 00 未提醒(固定)
} }
} }
console.log(123, data) console.log(123, data)
@@ -90,7 +95,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
flag: 'goBack', flag: 'goBack',
extra: { extra: {
refresh: '1', refresh: '1',
index: '-1', index: '-1'
}, },
routerInfo: { routerInfo: {
type: 2, type: 2,
@@ -101,13 +106,15 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
}, 100) }, 100)
} }
}) })
.catch(err => {$this.$toast('保存失败')}) .catch(err => {
$this.$toast('保存失败')
})
}, },
cancel() { cancel() {
this.show = false; this.show = false
}, },
ok(value) { ok(value) {
this.show = false; this.show = false
var date = new Date(value) var date = new Date(value)
var year = date.getFullYear() var year = date.getFullYear()
var month = date.getMonth() + 1 var month = date.getMonth() + 1
@@ -124,7 +131,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
this.getTime() this.getTime()
if (this.noticeTime.split(':')[0] < this.minHour) { if (this.noticeTime.split(':')[0] < this.minHour) {
this.noticeTime = '' this.noticeTime = ''
}else if(this.noticeTime.split(':')[0]=this.minHour){ } else if ((this.noticeTime.split(':')[0] = this.minHour)) {
if (this.noticeTime.split(':')[1] < this.minMinute) { if (this.noticeTime.split(':')[1] < this.minMinute) {
this.noticeTime = '' this.noticeTime = ''
} }
@@ -137,48 +144,47 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
if (this.date == this.minDate.getTime()) { if (this.date == this.minDate.getTime()) {
if (value.split(':')[0] < this.minHour) { if (value.split(':')[0] < this.minHour) {
this.$toast('不能小于当前时间') this.$toast('不能小于当前时间')
}else if(value.split(':')[0]=this.minHour){ } else if ((value.split(':')[0] = this.minHour)) {
if (value.split(':')[1] < this.minMinute) { if (value.split(':')[1] < this.minMinute) {
this.$toast('不能小于当前时间') this.$toast('不能小于当前时间')
} else { } else {
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} }
} else { } else {
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} }
} else { } else {
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} }
}, },
cancelTime() { cancelTime() {
this.timeShow = false; this.timeShow = false
}, },
formatter(type, value) { formatter(type, value) {
if (type === 'year') { if (type === 'year') {
return `${value}`; return `${value}`
} else if (type === 'month') { } else if (type === 'month') {
return `${value}` return `${value}`
} else if (type === 'day') { } else if (type === 'day') {
return `${value}` return `${value}`
} }
return value; return value
}, },
filter(type, options) { filter(type, options) {
if (type === 'minute') { if (type === 'minute') {
return options.filter(option => option % 15 === 0) return options.filter(option => option % 15 === 0)
} }
return options; return options
}, },
getTime() { getTime() {
let date=new Date(); let date = new Date()
let hour=date.getHours(); let hour = date.getHours()
let minute=date.getMinutes(); let minute = date.getMinutes()
if (minute < 15) { if (minute < 15) {
minute='15'; minute = '15'
} else if (minute >= 15 && minute < 30) { } else if (minute >= 15 && minute < 30) {
minute = '30' minute = '30'
} else if (minute >= 30 && minute < 45) { } else if (minute >= 30 && minute < 45) {
@@ -188,7 +194,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
hour = hour + 1 hour = hour + 1
} }
if (hour < 10) { if (hour < 10) {
hour='0'+hour; hour = '0' + hour
} }
this.currentTime = hour + ':' + minute this.currentTime = hour + ':' + minute
this.minHour = hour this.minHour = hour
@@ -201,9 +207,9 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
<style scoped> <style scoped>
.addMilesone { .addMilesone {
height: 100%; height: 100%;
background-color: #fff background-color: #fff;
} }
.text { .text {
min-height: 22vw min-height: 22vw;
} }
</style> </style>

View File

@@ -1,43 +1,51 @@
<template> <template>
<div class="editMilesone"> <div class="editMilesone">
<van-cell-group> <van-cell-group>
<van-field v-model="noticeDate" class="fs14" label="提醒日期" v-validate="'required'" name="提醒日期" placeholder="请选择" @click="show = true" :readonly="true"/> <van-field
v-model="noticeDate"
class="fs14"
label="提醒日期"
v-validate="'required'"
name="提醒日期"
placeholder="请选择"
@click="show = true"
:readonly="true"
/>
</van-cell-group> </van-cell-group>
<van-cell-group> <van-cell-group>
<van-field v-model="noticeTime" class="fs14" label="提醒时间" v-validate="'required'" name="提醒时间" placeholder="请选择" @click="timeShow = true" :readonly="true"/> <van-field
v-model="noticeTime"
class="fs14"
label="提醒时间"
v-validate="'required'"
name="提醒时间"
placeholder="请选择"
@click="timeShow = true"
:readonly="true"
/>
</van-cell-group> </van-cell-group>
<van-cell-group> <van-cell-group>
<van-field v-model="eventContent" label="事件内容" v-validate="'required'" name="事件内容" placeholder="请输入" class="text fs14" type="textarea" /> <van-field v-model="eventContent" label="事件内容" v-validate="'required'" name="事件内容" placeholder="请输入" class="text fs14" type="textarea" />
</van-cell-group> </van-cell-group>
<van-button type="danger" @click="save" class="bottom-btn fs16">保存</van-button> <van-button type="danger" @click="save" class="bottom-btn fs16">保存</van-button>
<van-popup v-model="show" position="bottom"> <van-popup v-model="show" position="bottom">
<van-datetime-picker <van-datetime-picker v-model="currentDate" type="date" @confirm="ok" @cancel="cancel" :min-date="minDate" :formatter="formatter" />
v-model="currentDate"
type="date"
@confirm="ok"
@cancel="cancel"
:min-date="minDate"
:formatter="formatter"
/>
</van-popup> </van-popup>
<van-popup v-model="timeShow" position="bottom"> <van-popup v-model="timeShow" position="bottom">
<van-datetime-picker <van-datetime-picker v-model="currentTime" type="time" @confirm="okTime" @cancel="cancelTime" :filter="filter" />
v-model="currentTime"
type="time"
@confirm="okTime"
@cancel="cancelTime"
:filter="filter"
/>
</van-popup> </van-popup>
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue'
import { Field,CellGroup,DatetimePicker,Popup } from 'vant'; import { Field, CellGroup, DatetimePicker, Popup } from 'vant'
import { saveOrUpdate } from '@/api/ebiz/milestone/milestone.js' import { saveOrUpdate } from '@/api/ebiz/milestone/milestone.js'
Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup); Vue.use(Field)
.use(CellGroup)
.use(DatetimePicker)
.use(Popup)
export default { export default {
name: 'editMilestone', name: 'editMilestone',
data() { data() {
@@ -88,7 +96,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
eventContent: $this.eventContent, // 事件内容 eventContent: $this.eventContent, // 事件内容
noticeDate: $this.noticeDate, //提示日期 yyyy-MM-dd noticeDate: $this.noticeDate, //提示日期 yyyy-MM-dd
noticeTime: $this.noticeTime + ':00', // 提示时间 HH:mm:ss noticeTime: $this.noticeTime + ':00', // 提示时间 HH:mm:ss
noticeStatus: "00"// 提示状态 00 未提醒(固定) noticeStatus: '00' // 提示状态 00 未提醒(固定)
} }
} }
console.log(123, data) console.log(123, data)
@@ -102,7 +110,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
flag: 'goBack', flag: 'goBack',
extra: { extra: {
refresh: '1', refresh: '1',
index: '-1', index: '-1'
}, },
routerInfo: { routerInfo: {
type: 2, type: 2,
@@ -113,13 +121,15 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
}, 100) }, 100)
} }
}) })
.catch(err => {$this.$toast('保存失败')}) .catch(err => {
$this.$toast('保存失败')
})
}, },
cancel() { cancel() {
this.show = false; this.show = false
}, },
ok(value) { ok(value) {
this.show = false; this.show = false
var date = new Date(value) var date = new Date(value)
var year = date.getFullYear() var year = date.getFullYear()
var month = date.getMonth() + 1 var month = date.getMonth() + 1
@@ -136,7 +146,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
this.getTime() this.getTime()
if (this.noticeTime.split(':')[0] < this.minHour) { if (this.noticeTime.split(':')[0] < this.minHour) {
this.noticeTime = '' this.noticeTime = ''
}else if(this.noticeTime.split(':')[0]=this.minHour){ } else if ((this.noticeTime.split(':')[0] = this.minHour)) {
if (this.noticeTime.split(':')[1] < this.minMinute) { if (this.noticeTime.split(':')[1] < this.minMinute) {
this.noticeTime = '' this.noticeTime = ''
} }
@@ -146,62 +156,63 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
okTime(value) { okTime(value) {
console.log(value.split(':')[0]) console.log(value.split(':')[0])
this.getTime() this.getTime()
let flag=this.noticeDate.split('-')[0]<this.y||(this.noticeDate.split('-')[0]==this.y&&this.noticeDate.split('-')[1]<this.m)||(this.noticeDate.split('-')[0]==this.y&&this.noticeDate.split('-')[1]==this.m&&this.noticeDate.split('-')[2]<this.d) let flag =
this.noticeDate.split('-')[0] < this.y ||
(this.noticeDate.split('-')[0] == this.y && this.noticeDate.split('-')[1] < this.m) ||
(this.noticeDate.split('-')[0] == this.y && this.noticeDate.split('-')[1] == this.m && this.noticeDate.split('-')[2] < this.d)
if (flag) { if (flag) {
this.noticeDate = '' this.noticeDate = ''
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} else { } else {
if (this.noticeDate == this.today) { if (this.noticeDate == this.today) {
if (value.split(':')[0] < this.minHour) { if (value.split(':')[0] < this.minHour) {
this.$toast('不能小于当前时间') this.$toast('不能小于当前时间')
}else if(value.split(':')[0]=this.minHour){ } else if ((value.split(':')[0] = this.minHour)) {
if (value.split(':')[1] < this.minMinute) { if (value.split(':')[1] < this.minMinute) {
this.$toast('不能小于当前时间') this.$toast('不能小于当前时间')
} else { } else {
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} }
} else { } else {
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} }
} else { } else {
this.timeShow = false; this.timeShow = false
this.noticeTime = value this.noticeTime = value
} }
} }
}, },
cancelTime() { cancelTime() {
this.timeShow = false; this.timeShow = false
}, },
formatter(type, value) { formatter(type, value) {
if (type === 'year') { if (type === 'year') {
return `${value}`; return `${value}`
} else if (type === 'month') { } else if (type === 'month') {
return `${value}` return `${value}`
} else if (type === 'day') { } else if (type === 'day') {
return `${value}` return `${value}`
} }
return value; return value
}, },
filter(type, options) { filter(type, options) {
if (type === 'minute') { if (type === 'minute') {
return options.filter(option => option % 15 === 0) return options.filter(option => option % 15 === 0)
} }
return options; return options
}, },
getTime() { getTime() {
let date=new Date(); let date = new Date()
let hour=date.getHours(); let hour = date.getHours()
let minute=date.getMinutes(); let minute = date.getMinutes()
this.y = date.getFullYear(); // 年 this.y = date.getFullYear() // 年
this.m = date.getMonth() + 1; // 月份从0开始的 this.m = date.getMonth() + 1 > 9 ? date.getMonth() + 1 : '0' + Number(date.getMonth() + 1) // 月份从0开始的
this.d = date.getDate(); //日 this.d = date.getDate() > 9 ? date.getDate() : '0' + Number(date.getDate()) //日
if (minute < 15) { if (minute < 15) {
minute='15'; minute = '15'
} else if (minute >= 15 && minute < 30) { } else if (minute >= 15 && minute < 30) {
minute = '30' minute = '30'
} else if (minute >= 30 && minute < 45) { } else if (minute >= 30 && minute < 45) {
@@ -211,7 +222,7 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
hour = hour + 1 hour = hour + 1
} }
if (hour < 10) { if (hour < 10) {
hour='0'+hour; hour = '0' + hour
} }
this.today = this.y + '-' + this.m + '-' + this.d this.today = this.y + '-' + this.m + '-' + this.d
this.currentTime = hour + ':' + minute this.currentTime = hour + ':' + minute
@@ -225,9 +236,9 @@ Vue.use(Field).use(CellGroup).use(DatetimePicker).use(Popup);
<style scoped> <style scoped>
.editMilesone { .editMilesone {
height: 100%; height: 100%;
background-color: #fff background-color: #fff;
} }
.text { .text {
min-height: 22vw min-height: 22vw;
} }
</style> </style>

View File

@@ -22,7 +22,7 @@
</van-col> </van-col>
</van-row> </van-row>
<van-row class="text-right pv5 card-title"> <van-row class="text-right pv5 card-title">
<van-button type="danger" @click="edit(item)" size="small" class="mr5" round>编辑</van-button> <van-button type="danger" @click="edit(item)" size="small" class="mr5" round v-if="item.noticeStatus != '01'">编辑</van-button>
<van-button type="danger" plain @click="del(item)" size="small" class="mr5" round>删除</van-button> <van-button type="danger" plain @click="del(item)" size="small" class="mr5" round>删除</van-button>
</van-row> </van-row>
</div> </div>