提交 文件

dev
张同海 2 years ago
parent 1678ce64f9
commit b197c0f0b0

@ -171,7 +171,7 @@
v-model="details.etd"
@change="changeEtd"
>
<a-icon slot="suffixIcon" type="time" style="display: none;" />
<a-icon slot="suffixIcon" type="time" style="display: none;"/>
</a-date-picker>
<span class="week" v-if="etdWeek">W{{ etdWeek || '--' }}</span>
</div>
@ -194,7 +194,7 @@
placeholder="实际开船"
v-model="details.atd"
>
<a-icon slot="suffixIcon" type="time" style="display: none;" />
<a-icon slot="suffixIcon" type="time" style="display: none;"/>
</a-date-picker>
</div>
</a-form-item>
@ -348,26 +348,20 @@
import { XCard } from '@/components'
import { AutoComplete } from 'ant-design-vue'
import {
DjyCustomerpage,
GetCarrierlist,
GetVessellist,
GetSysUserPage,
GetForwarderlist
} from '@/api/modular/main/BookingLedger'
import { DjyCustomerpage, GetCarrierlist, GetVessellist, GetSysUserPage, GetForwarderlist } from '@/api/modular/main/BookingLedger'
export default {
name: 'BookingDetail',
components: {
XCard,
AutoComplete
AutoComplete,
},
props: {
details: {
type: Object,
default: () => {
return {}
}
},
},
ishd: {
type: Boolean,
@ -380,12 +374,12 @@ export default {
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
md: { span: 10 }
md: { span: 10 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 },
md: { span: 13 }
md: { span: 13 },
},
form: this.$form.createForm(this),
dataSource: ['Burns Bay Road', 'Downing Street', 'Wall Street'],
@ -406,14 +400,14 @@ export default {
customerModelconfirm: false,
rowStyleOption: {
clickHighlight: false,
hoverHighlight: false
hoverHighlight: false,
},
cellAutofillOption: true,
editOption: {
// cell value change
cellValueChange: ({ row, column }) => {
console.log('编辑', row, column)
}
},
},
checkboxOption: {
hideSelectAll: false,
@ -424,7 +418,7 @@ export default {
//
selectedAllChange: ({ isSelected, selectedRowKeys }) => {
console.log('全选', isSelected, selectedRowKeys)
}
},
},
columns: [
{
@ -434,7 +428,7 @@ export default {
title: '',
width: 50,
operationColumn: true,
align: 'center'
align: 'center',
},
{ field: 'col1', key: 'col1', title: '联系人', edit: true },
{ field: 'col2', key: 'col2', title: '邮箱', edit: true },
@ -449,12 +443,12 @@ export default {
return (
<a-checkbox
value={row['BC']}
on-change={val => {
on-change={(val) => {
console.log(val)
}}
/>
)
}
},
},
{
field: 'col6',
@ -465,12 +459,12 @@ export default {
return (
<a-checkbox
value={row['col6']}
on-change={val => {
on-change={(val) => {
console.log(val)
}}
/>
)
}
},
},
{
field: 'col7',
@ -481,16 +475,16 @@ export default {
return (
<a-checkbox
value={row['col7']}
on-change={val => {
on-change={(val) => {
console.log(val)
}}
/>
)
}
}
},
},
],
tableData: [],
etdWeek: ''
etdWeek: '',
// / - end
}
},
@ -640,7 +634,7 @@ export default {
} else {
return []
}
}
},
},
watch: {
details: {
@ -648,11 +642,11 @@ export default {
// console.log('', nval)
this.$emit('changeDetail', {
detail: nval,
type: 'baseInfo'
type: 'baseInfo',
})
},
deep: true
}
deep: true,
},
},
created() {
this.init()
@ -679,15 +673,15 @@ export default {
SearchValue: name,
PropString: key
})
.then(res => {
.then((res) => {
if (res.code === 200) {
// this.customerData = res.data.rows
this[`${type}Data`] = res.data.rows
console.log(this[`${type}DataArr`])
console.log(this[`${type}DataArr`])
this.$forceUpdate()
}
})
.catch(err => {
.catch((err) => {
console.log(err)
})
},
@ -712,15 +706,15 @@ export default {
// - start
getCarrier(name = '') {
GetCarrierlist({
CnName: name
CnName: name,
})
.then(res => {
.then((res) => {
if (res.code === 200) {
this.carrierData = res.data
this.$forceUpdate()
}
})
.catch(err => {
.catch((err) => {
console.log(err)
})
},
@ -737,15 +731,15 @@ export default {
// - start
getForwarderlist(name = '') {
GetForwarderlist({
Name: name
Name: name,
})
.then(res => {
.then((res) => {
if (res.code === 200) {
this.shipagencyData = res.data
this.$forceUpdate()
}
})
.catch(err => {
.catch((err) => {
console.log(err)
})
},
@ -761,15 +755,15 @@ export default {
// - start
getVessel(name = '') {
GetVessellist({
Name: name
Name: name,
})
.then(res => {
.then((res) => {
if (res.code === 200) {
this.vesselData = res.data
this.$forceUpdate()
}
})
.catch(err => {
.catch((err) => {
console.log(err)
})
},
@ -814,9 +808,9 @@ export default {
// - start
getUserList(name = '', type) {
GetSysUserPage({
SearchValue: name
SearchValue: name,
})
.then(res => {
.then((res) => {
if (res.code === 200) {
if (type === 'sale') {
this.saleUserList = res.data.rows
@ -829,7 +823,7 @@ export default {
}
}
})
.catch(err => {
.catch((err) => {
console.log(err)
})
},
@ -878,13 +872,8 @@ export default {
// - start
changeCustomer(type) {
if (type == 'add') {
this.$router.push({ name: 'CustomerInformationManagementAdd' })
localStorage.setItem('CustomerInformationManagementAdd', 'new')
} else {
this.customerType = type
this.customerVisible = true
}
this.customerType = type
this.customerVisible = true
},
handleModelSubmit() {
this.handleModelCancel()
@ -899,35 +888,21 @@ export default {
this.etdWeek = this.getWeek(dateString)
},
getWeek(dateTime) {
// 1970
// eslint-disable-next-line camelcase
const temp_ms = new Date(dateTime).getTime()
const temptTime = new Date(temp_ms)
// 7
const weekday = temptTime.getDay() & 7
// 1+5=6,
//
temptTime.setDate(temptTime.getDate() - weekday + 1 + 5)
// /1/100(1) ~11(12)getDay
//
let firstDay = new Date(temptTime.getFullYear(), 0, 1)
const dayOfWeek = firstDay.getDay()
let spendDay = 1
//
if (dayOfWeek !== 0) {
spendDay = 7 - dayOfWeek + 1
}
const yearOfW = temptTime.getFullYear()
firstDay = new Date(yearOfW, 0, 1 + spendDay)
/*
1.Math.ceil 取大于等于所给值的最小整数
2.86400000是换算到天的基数js的时间差值为时间戳即毫秒数
1000毫秒 * 60 * 60分钟* 24小时 = 86400000
3.temptTime是当前日期firstDay是当年第一天周数计算公式就是当前日期-第一天天数/7 就是本年的第几周
4.d是差距天数res是周数
*/
const d = Math.ceil((temptTime.valueOf() - firstDay.valueOf()) / 86400000)
const res = Math.ceil(d / 7) + 1
// const weekOfNow = firstDay.getFullYear().toString() + res.toString()
const weekOfNow = res.toString()
return weekOfNow
},

@ -57,10 +57,15 @@ export default {
return {}
},
},
moreStr: {
type: String,
default: ''
}
},
data() {
return {
showKey: ['1'],
moreIndex: 0
}
},
watch: {
@ -74,6 +79,13 @@ export default {
},
deep: true,
},
moreStr (nval, oval) {
if (nval !== oval) {
this.moreIndex++
this.details.description += `${this.moreIndex * '*'} ${this.moreIndex}`
console.log(this.details.description)
}
}
},
created() {},
methods: {

@ -20,7 +20,7 @@
/>
<a-button class="save-btn" type="link" size="small" icon="save" @click="saveModel('shipper')"></a-button>
<div class="right">
<span class="btn-circle">*</span>
<span class="btn-circle" @click="spliceMore('shipper')">*</span>
<span class="btn" @click="changeCode(35, 'shipper')">35</span>
<span class="btn" @click="changeCode(40, 'shipper')">40</span>
<span class="btn" @click="changeCode(50, 'shipper')">50</span>
@ -51,7 +51,7 @@
/>
<a-button class="save-btn" type="link" size="small" icon="save" @click="saveModel('consignee')"></a-button>
<div class="right">
<span class="btn-circle">*</span>
<span class="btn-circle" @click="spliceMore('consignee')">*</span>
<span class="btn" @click="changeCode(35, 'consignee')">35</span>
<span class="btn" @click="changeCode(40, 'consignee')">40</span>
<span class="btn" @click="changeCode(50, 'consignee')">50</span>
@ -82,7 +82,7 @@
/>
<a-button class="save-btn" type="link" size="small" icon="save" @click="saveModel('notifyparty')"></a-button>
<div class="right">
<span class="btn-circle">*</span>
<span class="btn-circle" @click="spliceMore('notifyparty')">*</span>
<span class="btn" @click="changeCode(35, 'notifyparty')">35</span>
<span class="btn" @click="changeCode(40, 'notifyparty')">40</span>
<span class="btn" @click="changeCode(50, 'notifyparty')">50</span>
@ -798,7 +798,8 @@ export default {
// - start
getTemplate(name = '', type) {
BookingTemplate({
SearchValue: name
SearchValue: name,
Type: this.enmuType(type)
})
.then((res) => {
if (res.code === 200) {
@ -1051,6 +1052,8 @@ export default {
return 20
case 'notifypart':
return 30
case 'notify':
return 30
}
},
handleModelCancel () {
@ -1060,7 +1063,6 @@ export default {
},
changeCode(num, type) {
// const newStr = this.senderInfo.replace(/\n|\r/g, '')
const newStr = this.details[type].replace(/\n|\r/g, '')
console.log(newStr)
const indexs = []
@ -1071,24 +1073,45 @@ export default {
count += 1
}
}
const splitPosition = this.findId(indexs, num)
console.log(splitPosition)
let resStr = ``
splitPosition.map((split, sindex) => {
const start = sindex === 0 ? 0 : splitPosition[sindex - 1]
console.log(sindex, start, newStr.slice(start, split))
if (sindex === splitPosition.length - 1) {
console.log('last', newStr.slice(start, split), newStr.slice(split))
resStr += `${newStr.slice(start, split)}
${newStr.slice(split)}`
} else {
resStr += `${newStr.slice(start, split)}
`
if (indexs.length > 0) {
const splitPosition = this.findId(indexs, num)
let resStr = ``
splitPosition.map((split, sindex) => {
const start = sindex === 0 ? 0 : splitPosition[sindex - 1]
console.log(sindex, start, newStr.slice(start, split))
if (sindex === splitPosition.length - 1) {
console.log('last', newStr.slice(start, split), newStr.slice(split))
resStr += `${newStr.slice(start, split)}
${newStr.slice(split)}`
} else {
resStr += `${newStr.slice(start, split)}
`
}
})
if (resStr) {
this.details[type] = resStr
}
})
this.details[type] = resStr
} else {
var remainder = newStr.length % num; //
var n = (newStr.length - remainder) / num; // 1n+1
let resStr = ''
for (var i = 0; i < n; i++) {
// resStr += str.slice(i*num,(i+1)*num) + '\n';
resStr += `${newStr.slice(i*num,(i+1)*num)}
`
}
if (remainder > 0) {
// resStr += str.slice(n*num) + '\n'
resStr += `${newStr.slice(n*num)}
`
}
if (resStr) {
this.details[type] = resStr
}
}
},
findId(arr, id) {
// [40, 41, 82, 83, 94] 35
const newarr = []
let count = 1
arr.map((item, index) => {
@ -1105,6 +1128,83 @@ ${newStr.slice(split)}`
})
return newarr
},
spliceMore1 (type) {
const arr = this.details[type].split('\n')
const str = arr.splice(5, arr.length - 1).toString()
console.log(arr, str)
this.$emit('spliceMore', str)
const index = this.details[type].indexOf(arr[5])
this.details[type] = this.details[type].substring(0, index)
debugger
},
spliceMore (field) {
const maxStarLine = 5
// var strShipper = $("textarea[name='" + field + "']").val();
const strShipper = this.details[field]
const arr = strShipper.split('\n');
if (arr.length > maxStarLine) {
var strStar = '*'
var str1 = ''
var str2 = ''
let arrTmp = null
// **
if (field === 'consignee') {
// var arrTmp = $("textarea[name='SHIPPER']").val().split('\n')
arrTmp = this.details['shipper'].split('\n')
if (arrTmp.length > 0 && arrTmp[arrTmp.length - 1].endsWith('*')) {
strStar += '*'
}
}
// **
if (field === 'notifyparty') {
// var arrTmp = $("textarea[name='SHIPPER']").val().split('\n')
arrTmp = this.details['shipper'].split('\n')
if (arrTmp.length > 0 && arrTmp[arrTmp.length - 1].endsWith('*')) {
strStar += '*'
}
// arrTmp = $("textarea[name='CONSIGNEE']").val().split('\n')
arrTmp = this.details['consignee'].split('\n')
if (arrTmp.length > 0 && arrTmp[arrTmp.length - 1].endsWith('*')) {
strStar += '*'
}
}
for (let idx = 0; idx < arr.length; idx++) {
if (idx < maxStarLine) {
str1 += arr[idx]
if (idx !== maxStarLine - 1) {
str1 += '\n'
} else {
str1 += ' ' + strStar
}
} else {
str2 += arr[idx]
if (idx !== arr.length - 1) {
str2 += '\n'
}
}
}
// $("textarea[name='" + field + "']").val(str1);
this.details[field] = str1
this.$emit('spliceMore', strStar + str2)
// var areaDesp = $("textarea[name='DESCRIPTION']")
// var valSrc = areaDesp.val()
// if (valSrc.length > 0) {
// valSrc += '\n'
// }
// areaDesp.val(valSrc + strStar + str2);
// console.log("str1:")
// console.log(str1)
// console.log("str2:")
// console.log(str2)
}
}
},
}
</script>

Loading…
Cancel
Save