tab切换问题

szh_zidingyibiaoti
lilu 2 years ago
parent 00fb4a7392
commit ed92452d82

@ -319,7 +319,7 @@ export default {
}
},
computed: {
...mapGetters(['bookingList', 'needSavePages', 'hasbookingDetail'])
...mapGetters(['bookingList', 'needSavePages', 'hasbookingDetail', 'bookingList', 'bookingGridOptions'])
},
created() {
this.init()
@ -397,6 +397,7 @@ export default {
}, 800)
},
beforeRouteLeave(to, from, next) {
console.log('== 订舱详情离开路由 ==')
this.inChildLoading = true
if (this.isCopy) {
const hisData = {
@ -464,7 +465,7 @@ export default {
})
},
methods: {
...mapActions(['setNeedSavePages']),
...mapActions(['setNeedSavePages', 'setBookingList', 'setBookingGridOptions']),
getRouterHis() {
this.inChildLoading = true
const newId = this.$route.query.id
@ -910,12 +911,30 @@ export default {
setTimeout(() => {
this.inAddSave = false
}, 2000)
console.log('== 新增订舱内容 ==', this.bookingList, this.bookingGridOptions, res.data)
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
newBookingGridOptions.data.push(res.data)
this.$set(newBookingList, res.data.id, res.data)
this.setBookingList(newBookingList)
this.setBookingGridOptions(newBookingGridOptions)
console.log('== 新增订舱内容 ==', newBookingList, newBookingGridOptions, res.data)
} else if (that.$route.query.mblno === that.bookingDetails.mblno) {
that.isCopy = false
that.isAdd = false
this.setDeatilsFun(res)
that.checkSaveFun({ type: 'hbList', hasChange: false })
that.checkSaveFun({ type: 'details', hasChange: false })
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
this.$set(newBookingList, res.data.id, res.data)
const arr = newBookingGridOptions.data.map((item, index) => {
return item.id
})
const index = arr.indexOf(res.data.id)
newBookingGridOptions.data[index] = res.data
console.log(index)
console.log('== 修改订舱内容 ==', this.bookingList, this.bookingGridOptions)
} else {
that.isCopy = false
that.isAdd = false
@ -931,6 +950,14 @@ export default {
mblno: res.data.mblno
}
})
console.log('== 复制订舱内容 ==', this.bookingList, this.bookingGridOptions, res.data)
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
newBookingGridOptions.data.push(res.data)
this.$set(newBookingList, res.data.id, res.data)
this.setBookingList(newBookingList)
this.setBookingGridOptions(newBookingGridOptions)
console.log('== 复制订舱内容 ==', newBookingList, newBookingGridOptions, res.data)
}
that.$forceUpdate()
} else {

@ -127,8 +127,8 @@
:labelCol="labelCol2"
:wrapperCol="wrapperCol2"
has-feedback
prop="contractno">
<inputView type="contractno" :parentVal="details.contractno" @getInputChange="inputChange"/>
prop="EPCode">
<inputView type="EPCode" :parentVal="details.EPCode" @getInputChange="inputChange"/>
</a-form-model-item>
</a-col>
</template>
@ -247,9 +247,17 @@
prop="etd"
>
<div class="date-box">
<a-date-picker size="small" class="date-picker" format="YYYY-MM-DD" v-model="details.etd" @change="changeEtd">
<datePickerView
class="date-picker"
:parentVal="details.etd"
type="etd"
format="YYYY-MM-DD"
@dateChange="dateChangeFun"
style="margin-top: -5px;"
></datePickerView>
<!-- <a-date-picker size="small" class="date-picker" format="YYYY-MM-DD" v-model="details.etd" @change="changeEtd">
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</a-date-picker> -->
<span class="week" v-if="etdWeek && etdWeek !== 'NaN'">W{{ etdWeek || '--' }}</span>
</div>
</a-form-model-item>
@ -266,9 +274,17 @@
prop="atd"
>
<div class="date-box">
<a-date-picker size="small" class="date-picker" format="YYYY-MM-DD" v-model="details.atd">
<datePickerView
class="date-picker"
:parentVal="details.atd"
type="atd"
format="YYYY-MM-DD"
@dateChange="dateChangeFun"
style="margin-top: -5px;"
></datePickerView>
<!-- <a-date-picker size="small" class="date-picker" format="YYYY-MM-DD" v-model="details.atd">
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</a-date-picker> -->
</div>
</a-form-model-item>
</a-col>
@ -475,6 +491,7 @@
import { XCard } from '@/components'
import inputView from './inputView'
import selectView from './selectView'
import datePickerView from './datePickerView'
import {
DjyCustomerdetail,
@ -489,7 +506,8 @@ export default {
components: {
XCard,
inputView,
selectView
selectView,
datePickerView
},
props: {
details: {
@ -953,7 +971,7 @@ export default {
console.log('=== 获取到选择数据 ===', type, res)
if (type === 'customername') {
this.details.customername = res.shortName || ''
this.details.customerid = res.id || ''
this.details.customerid = Number(res.id) || ''
if (res.op) {
this.details.op = res.op
this.details.opid = res.opid
@ -992,6 +1010,14 @@ export default {
this.details[`${type}id`] = res.id || ''
}
console.log('== 选中 ==', this.details, type)
},
dateChangeFun ({ type, value }) {
this.details[type] = value || ''
if (type === 'etd') {
this.etdWeek = this.getWeek(value)
console.log(this.etdWeek)
}
console.log('== 日期修改 ==', type, value, this.details[type])
}
}
}

@ -36,7 +36,14 @@
has-feedback
prop="issuedate"
>
<a-date-picker size="small" v-model="details.issuedate" format="YYYY-MM-DD" />
<datePickerView
class="date-picker"
:parentVal="details.issuedate"
type="issuedate"
format="YYYY-MM-DD"
@dateChange="dateChangeFun"
></datePickerView>
<!-- <a-date-picker size="small" v-model="details.issuedate" format="YYYY-MM-DD" /> -->
</a-form-model-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="8" :xl="6">
@ -80,7 +87,17 @@
has-feedback
prop="nobill"
>
<a-select size="small" :default-value="details.nobill || 'THREE'" v-model="details.nobill" @change="handleNoChange">
<selectView
type="nobill"
:defaultVal="details.nobill || 'THREE'"
searchApi="nobillData"
:searchQuery="{ name: '' }"
:showLabel="['name']"
:openSearch="false"
@change="getSelectViewRes"
></selectView>
<!-- <a-select size="small" :default-value="details.nobill || 'THREE'" v-model="details.nobill" @change="handleNoChange">
<a-select-option value="ONE"> ONE </a-select-option>
<a-select-option value="TWO"> TWO </a-select-option>
<a-select-option value="THREE"> THREE </a-select-option>
@ -91,7 +108,7 @@
<a-select-option value="EIGHT"> EIGHT </a-select-option>
<a-select-option value="NINE"> NINE </a-select-option>
<a-select-option value="TEN"> TEN </a-select-option>
</a-select>
</a-select> -->
</a-form-model-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="8" :xl="6">
@ -103,7 +120,17 @@
has-feedback
prop="copynobill"
>
<a-select size="small" :default-value="details.copynobill || 'THREE'" v-model="details.copynobill" @change="handleCopyNoChange">
<selectView
type="copynobill"
:defaultVal="details.copynobill || 'THREE'"
searchApi="copynobilllData"
:searchQuery="{ name: '' }"
:showLabel="['name']"
:openSearch="false"
@change="getSelectViewRes"
></selectView>
<!-- <a-select size="small" :default-value="details.copynobill || 'THREE'" v-model="details.copynobill" @change="handleCopyNoChange">
<a-select-option value="ONE"> ONE </a-select-option>
<a-select-option value="TWO"> TWO </a-select-option>
<a-select-option value="THREE"> THREE </a-select-option>
@ -114,7 +141,7 @@
<a-select-option value="EIGHT"> EIGHT </a-select-option>
<a-select-option value="NINE"> NINE </a-select-option>
<a-select-option value="TEN"> TEN </a-select-option>
</a-select>
</a-select> -->
</a-form-model-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="8" :xl="6">
@ -351,12 +378,14 @@
<script>
import inputView from './inputView'
import selectView from './selectView'
import datePickerView from './datePickerView'
export default {
name: '',
components: {
selectView,
inputView
inputView,
datePickerView
},
props: {
details: {
@ -437,6 +466,8 @@ export default {
this.details[`${type}id`] = res.ediCode || ''
} else if (['service'].includes(type)) {
this.details[type] = res.name || ''
} else if (['nobill', 'copynobill'].includes(type)) {
this.details[type] = res.code || ''
}
console.log(this.details, type, this.details[type])
},
@ -444,6 +475,10 @@ export default {
this.details[type] = value
console.log(this.details, type, this.details[type])
this.$forceUpdate()
},
dateChangeFun ({ type, value }) {
this.details[type] = value || ''
console.log('== 日期修改 ==', type, value, this.details[type])
}
}
}

@ -58,14 +58,24 @@
</div>
<div class="cargo-mark">
<div :class="{'required':rules['cargoid'] && rules['cargoid'][0].required}" class="tit">货物标志</div>
<a-form-model-item class="cargoid" has-feedback prop="cargoid" label="">
<selectView
type="cargoid"
:defaultVal="details.cargoid"
searchApi="cargoData"
:searchQuery="{ name: '' }"
:showLabel="['name']"
:openSearch="false"
@change="getSelectViewRes"
style="width: 120px;margin-top:7px;"
></selectView>
<!-- <a-form-model-item class="cargoid" has-feedback prop="cargoid" label="">
<a-select size="small" :default-value="details.cargoid || 'S'" v-model="details.cargoid" style="width: 120px" @change="handleChange">
<a-select-option value="S"> S 普通货 </a-select-option>
<a-select-option value="R"> R 冻柜 </a-select-option>
<a-select-option value="D"> D 危险品 </a-select-option>
<a-select-option value="O"> O 超限箱 </a-select-option>
</a-select>
</a-form-model-item>
</a-form-model-item> -->
</div>
<div class="input">
<div :class="{'required':rules['hscode'] && rules['hscode'][0].required}" calss="tit">HS编码</div>
@ -222,6 +232,8 @@ export default {
if (type === 'goodsname') {
this.details.goodscode = res.goodsCode || ''
this.details.goodsname = res.goodsNameEN || ''
} else if (type === 'cargoid') {
this.details.cargoid = res.code || ''
}
},
inputChange({ type, value }) {

@ -0,0 +1,85 @@
<template>
<div class="date-content">
<a-date-picker
size="small"
ref="dateInput"
:class="`date-picker-${type}`"
:format="format"
v-model="value"
:open="open"
:show-time="showTime"
@change="changeDate"
@openChange="handleOpenChange"
@focus="onFocus">
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</div>
</template>
<script>
export default {
name: '',
props: {
parentVal: {
type: [String, Number],
default: ''
},
type: {
type: String,
default: ''
},
format: {
type: String,
default: 'YYYY-MM-DD'
},
showTime: {
type: Boolean,
default: false
}
},
data() {
return {
value: this.parentVal !== 0 && !this.parentVal ? '' : this.parentVal,
open: false,
over: false
}
},
watch: {
parentVal(nval, oval) {
this.value = nval
}
},
mounted() {
},
methods: {
changeDate (date, dateString) {
if (!dateString) {
this.value = null
} else {
this.value = dateString
}
this.$emit('dateChange', {
type: this.type,
value: this.value
})
},
handleOpenChange (open) {
this.open = open;
if (!this.open) {
this.over = true
this.$refs.dateInput.$refs.picker.$refs.input.focus()
setTimeout(() => {
this.over = false
}, 1200)
}
},
onFocus () {
if (!this.open && !this.over) {
this.open = true
}
}
}
}
</script>
<style lang="less" scoped>
</style>

@ -2,6 +2,7 @@
<div class="input-content">
<input
class="ant-input input-box"
:class="`input-${type}`"
size="small"
:type="inputType"
v-model="value"

@ -272,9 +272,16 @@
has-feedback
prop="eta"
>
<a-date-picker format="YYYY-MM-DD" v-model="details.eta" @change="etaChange">
<datePickerView
class="date-picker"
:parentVal="details.eta"
type="eta"
format="YYYY-MM-DD"
@dateChange="dateChangeFun"
></datePickerView>
<!-- <a-date-picker format="YYYY-MM-DD" v-model="details.eta" @change="etaChange">
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</a-date-picker> -->
</a-form-model-item>
</a-col>
<a-col :span="12">
@ -286,7 +293,17 @@
has-feedback
prop="closingdate"
>
<a-date-picker
<datePickerView
class="date-picker"
style="min-width:100px"
:showTime="true"
:parentVal="details.closingdate"
type="closingdate"
format="YYYY-MM-DD HH:00"
@dateChange="dateChangeFun"
></datePickerView>
<!-- <a-date-picker
style="min-width:100px"
show-time
format="YYYY-MM-DD HH:00"
@ -294,7 +311,7 @@
@change="closingdateChange"
>
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</a-date-picker> -->
</a-form-model-item>
</a-col>
<a-col :span="12">
@ -306,7 +323,17 @@
has-feedback
prop="closedocdate"
>
<a-date-picker
<datePickerView
class="date-picker"
style="min-width:100px"
:showTime="true"
:parentVal="details.closedocdate"
type="closedocdate"
format="YYYY-MM-DD HH:00"
@dateChange="dateChangeFun"
></datePickerView>
<!-- <a-date-picker
style="min-width:100px"
show-time
format="YYYY-MM-DD HH:00"
@ -314,7 +341,7 @@
@change="closedocdateChange"
>
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</a-date-picker> -->
</a-form-model-item>
</a-col>
<a-col :span="12">
@ -326,7 +353,17 @@
has-feedback
prop="closevgmdate"
>
<a-date-picker
<datePickerView
class="date-picker"
style="min-width:100px"
:showTime="true"
:parentVal="details.closevgmdate"
type="closevgmdate"
format="YYYY-MM-DD HH:00"
@dateChange="dateChangeFun"
></datePickerView>
<!-- <a-date-picker
style="min-width:100px"
show-time
format="YYYY-MM-DD HH:00"
@ -334,7 +371,7 @@
@change="closevgmdateChange"
>
<a-icon slot="suffixIcon" type="time" style="display: none" />
</a-date-picker>
</a-date-picker> -->
</a-form-model-item>
</a-col>
<a-col :span="12">
@ -730,6 +767,7 @@ import { XCard } from '@/components'
import inputView from './inputView'
import textareaView from './textareaView'
import selectView from './selectView'
import datePickerView from './datePickerView'
import {
BookingTemplateAdd
} from '@/api/modular/main/BookingLedger'
@ -740,7 +778,8 @@ export default {
XCard,
textareaView,
inputView,
selectView
selectView,
datePickerView
},
props: {
details: {
@ -1389,6 +1428,15 @@ export default {
const enCapitalRes = this.SetTOTALNO(this.details.pkgs)
this.$emit('pkgsEnCapital', enCapitalRes)
}
},
dateChangeFun ({ type, value }) {
console.log(type, value)
if (['closingdate', 'closevgmdate', 'closedocdate'].includes(type)) {
this.details[type] = value + ':00'
} else {
this.details[type] = value || ''
}
console.log('== 日期修改 ==', type, value, this.details[type])
}
}
}

@ -2,16 +2,19 @@
<div class="select-content">
<a-select
size="small"
class="customer-input"
ref="selectView"
:class="`select-input-${type}`"
v-model="value"
show-search
:allowClear="true"
:filter-option="!this.openSearch ? filterOption : false"
:dropdownMatchSelectWidth="false"
:showArrow="!this.openSearch ? true : true"
:open="open"
optionLabelProp="label"
:notFoundContent="inLoading ? '加载中...' : '暂无数据'"
@focus="getSelectFirst"
@select="selectOption"
@change="(value,option)=> debounce(this.handleChange, 200, option)"
@search="debounce(handleSearch, 300, $event)"
>
@ -37,6 +40,7 @@
</template>
</a-select-option>
</a-select>
<div v-show="!open" class="select_overlap" @mouseup="openSelect"></div>
</div>
</template>
<script>
@ -98,7 +102,9 @@ export default {
selectList: [],
inEdit: false,
inLoading: false,
init: false
init: false,
open: false,
clickHandle: null
}
},
watch: {
@ -108,6 +114,23 @@ export default {
}
},
mounted() {
this.clickHandle = (e) => {
if (e.target && 'className' in e.target && this.open) {
const className = e.target.className;
if (className.indexOf('select_overlap') === -1) {
this.open = false
}
} else {
this.open = false
}
}
document.body.addEventListener('click', this.clickHandle)
},
beforeDestroy() {
if (this.clickHandle) {
document.body.removeEventListener('click', this.clickHandle)
this.clickHandle = null
}
},
methods: {
debounce(func, wait, ...args) {
@ -163,6 +186,115 @@ export default {
return getGoodsname
}
},
emnuData (type) {
switch (type) {
case 'cargoid':
return [
{
name: 'S 普通货',
code: 'S'
},
{
name: 'R 冻柜',
code: 'R'
},
{
name: 'D 危险品',
code: 'D'
},
{
name: 'O 超限箱',
code: 'O'
}
]
case 'nobill':
return [
{
name: 'ONE',
code: 'ONE'
},
{
name: 'TWO',
code: 'TWO'
},
{
name: 'THREE',
code: 'THREE'
},
{
name: 'FOUR',
code: 'FOUR'
},
{
name: 'FIVE',
code: 'FIVE'
},
{
name: 'SIX',
code: 'SIX'
},
{
name: 'SEVEN',
code: 'SEVEN'
},
{
name: 'EIGHT',
code: 'EIGHT'
},
{
name: 'NINE',
code: 'NINE'
},
{
name: 'TEN',
code: 'TEN'
}
]
case 'copynobill':
return [
{
name: 'ONE',
code: 'ONE'
},
{
name: 'TWO',
code: 'TWO'
},
{
name: 'THREE',
code: 'THREE'
},
{
name: 'FOUR',
code: 'FOUR'
},
{
name: 'FIVE',
code: 'FIVE'
},
{
name: 'SIX',
code: 'SIX'
},
{
name: 'SEVEN',
code: 'SEVEN'
},
{
name: 'EIGHT',
code: 'EIGHT'
},
{
name: 'NINE',
code: 'NINE'
},
{
name: 'TEN',
code: 'TEN'
}
]
}
},
filterOption(input, option) {
if (this.openSearch) { //
return true
@ -172,6 +304,7 @@ export default {
}
},
handleChange (op) {
// this.selectOpen = !this.selectOpen
this.inEdit = true
setTimeout(() => {
this.inEdit = false
@ -188,10 +321,20 @@ export default {
type: this.type,
res: this.selectList[num]
})
console.log(this.value, this.selectList[num])
}
},
getSelectFirst (e) {
getSelectFirst (e, canClick = true) {
if (canClick) {
document.getElementsByClassName(`select-input-${this.type}`)[0].click()
} else {
this.$refs.selectView.$refs.vcSelect.focus()
}
this.open = true
if (['cargoid', 'nobill', 'copynobill'].includes(this.type)) {
this.selectList = this.emnuData(this.type)
this.inLoading = false
return false
}
if (!e) {
// -
if (this.openSearch && this.value && this.selectList.length > 0) {
@ -204,7 +347,6 @@ export default {
// }
// })
}
console.log('== 加载数据 ==', this.searchQuery)
this.inLoading = true
this.getFromSelectData(this.emnuSelectApi(this.searchApi), this.searchQuery).then((data) => {
if (data.rows) {
@ -218,7 +360,6 @@ export default {
},
handleSearch (e) {
console.log('select - 搜索 :', e, this.openSearch)
if (this.openSearch) {
this.inEdit = true
setTimeout(() => {
@ -244,16 +385,25 @@ export default {
}
})
}
console.log('搜索 - 参数', this.searchQuery)
this.getFromSelectData(this.emnuSelectApi(this.searchApi), this.searchQuery).then((data) => {
if (data.rows) {
this.selectList = data.rows
} else {
this.selectList = data
}
console.log('== 搜索返回值 ==', data, this.selectList)
})
}
},
openSelect() {
if (!this.open) {
this.getSelectFirst('', false)
} else {
this.open = !this.open
}
},
selectOption() {
this.open = false
}
}
}
@ -292,4 +442,19 @@ export default {
color: #999;
}
}
.select-content {
position: relative;
.select_overlap {
cursor: pointer;
height: 32px;
width: 300px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
}
}
</style>

@ -612,20 +612,23 @@ export default {
next()
},
beforeRouteEnter (to, from, next) {
// console.log('')
console.log('路由进入')
next(vm => {
console.log('== 进入路由 - beforeRouteEnter ==', vm.bookingGridOptions)
if (Object.keys(vm.gridOptions).length > 0) {
vm.gridOptions = { ...vm.gridOptions, ...vm.bookingGridOptions }
}
// console.log('== - beforeRouteEnter ==', vm.bookingGridOptions)
// if (Object.keys(vm.gridOptions).length > 0) {
// vm.gridOptions = { ...vm.gridOptions, ...vm.bookingGridOptions }
// }
vm.upDate()
// vm.createdInit()
// vm.onresize()
})
},
created() {
console.log('== 列表页 - created ==')
this.createdInit()
},
mounted() {
console.log('== 列表页 - mounted ==')
this.onresize()
},
methods: {
@ -643,6 +646,23 @@ export default {
this.screenWidth = document.body.clientWidth
}
},
upDate () {
if (Object.keys(this.gridOptions).length > 0) {
if (Object.keys(this.bookingGridOptions) === 0) { return false }
const newData = JSON.parse(JSON.stringify(this.bookingGridOptions))
if (this.bookingGridOptions.data && this.bookingGridOptions.data.length > 0) {
const copyArr = JSON.parse(JSON.stringify(this.bookingGridOptions.data))
const first = copyArr.splice(0, 10)
const more = this.bookingGridOptions.data.splice(10, this.bookingGridOptions.data.length)
console.log(first, more)
newData.data = first
this.gridOptions = { ...this.gridOptions, ...newData }
setTimeout(() => {
this.gridOptions.data = [...this.gridOptions.data, ...more]
}, 1500)
}
}
},
//
editingHandleOk() {
const {
@ -1190,7 +1210,7 @@ export default {
this.$set(this.gridOptions.pagerConfig, 'total', res.data.totalCount)
this.$set(this.gridOptions, 'loading', false)
this.setBookingList(newBookingList)
console.log(this.gridOptions.data.length, Object.keys(newBookingList).length, this.gridOptions.data, newBookingList)
// console.log(this.gridOptions.data.length, Object.keys(newBookingList).length, this.gridOptions.data, newBookingList)
this.$forceUpdate()
} else {
this.$set(this.gridOptions, 'data', [...[]])

Loading…
Cancel
Save