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

szh_zidingyibiaoti
lilu 2 years ago
parent 9442dfcd61
commit 38ae6af6fc

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

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

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

@ -7,7 +7,29 @@
<a-date-picker format="YYYY-MM-DD" @change="changeDate" v-model="value"/> <a-date-picker format="YYYY-MM-DD" @change="changeDate" v-model="value"/>
</template> </template>
<template v-else-if="labelData.type == 'dateRange'"> <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>
<template v-else-if="labelData.type == 'select'"> <template v-else-if="labelData.type == 'select'">
<a-select <a-select
@ -95,14 +117,23 @@ export default {
}, },
watch: { watch: {
resetType (nval, oval) { resetType (nval, oval) {
console.log('== 重置 ==', nval)
if (!nval) { if (!nval) {
this.value = '' this.value = ''
this.dateVal = [] this.dateVal = []
// this.$emit('change', { this.startValue = ''
// form: this.labelData, this.endValue = ''
// value: ''
// })
} }
},
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() { data() {
@ -111,6 +142,9 @@ export default {
value: '', value: '',
// //
dateVal: [], dateVal: [],
startValue: null,
endValue: null,
endOpen: false,
// select // select
dataList: this.labelData.dataList || [], dataList: this.labelData.dataList || [],
dataSourceList: [] dataSourceList: []
@ -136,25 +170,52 @@ export default {
value: mode value: mode
}) })
}, },
changeRangeDate(e, mode) { // start
this.$emit('change', {
form: this.labelData, // changeRangeDate(e, mode) {
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)
// }
// })
// this.$emit('change', { // this.$emit('change', {
// form: this.labelData, // 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) { formatDate (now) {
var date = new Date(now) var date = new Date(now)
@ -182,6 +243,7 @@ export default {
// //
return y + '-' + m + '-' + d + ' ' + h + ':' + min + ':' + s return y + '-' + m + '-' + d + ' ' + h + ':' + min + ':' + s
}, },
// end
// == == // == ==
filterOption(input, option) { filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0

Loading…
Cancel
Save