修改列表时间区间,切换等

szh_zidingyibiaoti
lilu 2 years ago
parent 9442dfcd61
commit 38ae6af6fc

@ -953,7 +953,7 @@ export default {
console.log('=== 获取到选择数据 ===', type, res)
if (type === 'customername') {
this.details.customername = res.shortName || ''
this.details.customerid = res.codeName || ''
this.details.customerid = res.id || ''
if (res.op) {
this.details.op = res.op
this.details.opid = res.opid

@ -980,7 +980,7 @@ export default {
immediate: true,
handler(nD, oD) {
this.id = this.$route.query.id
// this.init()
this.init()
}
},
totalKgs() {

@ -15,6 +15,7 @@
<div class="name"><span class="iconfont icon-bianji"></span>发货人</div>
<selectView
type="shippername"
ref="shippernameInput"
:defaultVal="shippername"
searchApi="BookingTemplate"
:searchQuery="{ Title: '', Type: this.enmuType('shipper') }"
@ -56,6 +57,7 @@
<div class="name"><span class="iconfont icon-bianji"></span>收货人</div>
<selectView
type="consigneename"
ref="consigneenameInput"
:defaultVal="consigneename"
searchApi="BookingTemplate"
:searchQuery="{ Title: '', Type: this.enmuType('consignee') }"
@ -95,6 +97,7 @@
<div class="name"><span class="iconfont icon-bianji"></span>通知人</div>
<selectView
type="notifypartyname"
ref="notifypartynameInput"
:defaultVal="notifypartyname"
searchApi="BookingTemplate"
:searchQuery="{ Title: '', Type: this.enmuType('notifyparty') }"
@ -809,9 +812,11 @@ export default {
})
}
if (nval) {
this.shippername = ''
this.consigneename = ''
this.notifypartyname = ''
if (Object.keys(this.$refs).includes('shippernameInput')) {
this.$refs.shippernameInput.$data.value = ''
this.$refs.consigneenameInput.$data.value = ''
this.$refs.notifypartynameInput.$data.value = ''
}
}
},
deep: true
@ -820,9 +825,11 @@ export default {
immediate: true,
handler(nD, oD) {
this.id = this.$route.query.id
this.shippername = ''
this.consigneename = ''
this.notifypartyname = ''
if (Object.keys(this.$refs).includes('shippernameInput')) {
this.$refs.shippernameInput.$data.value = ''
this.$refs.consigneenameInput.$data.value = ''
this.$refs.notifypartynameInput.$data.value = ''
}
}
}
},
@ -879,8 +886,7 @@ export default {
this.yardVisible = false
this.yardType = ''
},
init() {
},
init() { },
//
saveModel(type) {

@ -7,7 +7,29 @@
<a-date-picker format="YYYY-MM-DD" @change="changeDate" v-model="value"/>
</template>
<template v-else-if="labelData.type == 'dateRange'">
<a-range-picker style="overflow: hidden;margin-top:3px;" format="YYYY-MM-DD" @change="changeRangeDate" @calendarChange="openChangeRangeDate" v-model="dateVal"/>
<!-- <a-range-picker style="overflow: hidden;margin-top:3px;" format="YYYY-MM-DD" @change="changeRangeDate" @calendarChange="openChangeRangeDate" v-model="dateVal"/> -->
<div class="picker-box" style="display:flex;">
<a-date-picker
style="min-width:30px; flex: 1;"
v-model="startValue"
:disabled-date="disabledStartDate"
format="YYYY-MM-DD"
suffixIcon=" "
placeholder="开始时间"
@openChange="handleStartOpenChange"
/>
<span style="margin:0 4px;">-</span>
<a-date-picker
style="min-width:30px;flex: 1;"
v-model="endValue"
:disabled-date="disabledEndDate"
format="YYYY-MM-DD"
placeholder="结束时间"
suffixIcon=" "
:open="endOpen"
@openChange="handleEndOpenChange"
/>
</div>
</template>
<template v-else-if="labelData.type == 'select'">
<a-select
@ -95,14 +117,23 @@ export default {
},
watch: {
resetType (nval, oval) {
console.log('== 重置 ==', nval)
if (!nval) {
this.value = ''
this.dateVal = []
// this.$emit('change', {
// form: this.labelData,
// value: ''
// })
this.startValue = ''
this.endValue = ''
}
},
startValue(val) {
if (!this.resetType) { return false }
console.log('startValue', val);
this.getDateRangeRes()
},
endValue(val) {
if (!this.resetType) { return false }
console.log('endValue', val);
this.getDateRangeRes()
}
},
data() {
@ -111,6 +142,9 @@ export default {
value: '',
//
dateVal: [],
startValue: null,
endValue: null,
endOpen: false,
// select
dataList: this.labelData.dataList || [],
dataSourceList: []
@ -136,25 +170,52 @@ export default {
value: mode
})
},
changeRangeDate(e, mode) {
this.$emit('change', {
form: this.labelData,
value: mode
})
},
openChangeRangeDate (e) {
// let arr = []
// e.map((item, index) => {
// if (item._d) {
// const date = this.formatDate(item._d).substr(0, 10)
// arr.push(date)
// console.log(date)
// }
// })
// start
// changeRangeDate(e, mode) {
// this.$emit('change', {
// form: this.labelData,
// value: arr
// value: mode
// })
// },
disabledStartDate(startValue) {
const endValue = this.endValue;
if (!startValue || !endValue) {
return false;
}
return startValue.valueOf() > endValue.valueOf();
},
disabledEndDate(endValue) {
const startValue = this.startValue;
if (!endValue || !startValue) {
return false;
}
return startValue.valueOf() >= endValue.valueOf();
},
handleStartOpenChange(open) {
if (!open) {
this.endOpen = true;
}
// if (this.startValue) {
// this.getDateRangeRes()
// }
},
handleEndOpenChange(open) {
this.endOpen = open;
// if (this.endValue) {
// this.getDateRangeRes()
// }
},
getDateRangeRes () {
const start = this.startValue ? this.formatDate(this.startValue._d).substr(0, 10) : ''
const end = this.endValue ? this.formatDate(this.endValue._d).substr(0, 10) : ''
const date = [start, end]
console.log('== 更新时间 ==', date)
this.$emit('change', {
form: this.labelData,
value: date
})
},
formatDate (now) {
var date = new Date(now)
@ -182,6 +243,7 @@ export default {
//
return y + '-' + m + '-' + d + ' ' + h + ':' + min + ':' + s
},
// end
// == ==
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0

Loading…
Cancel
Save