diff --git a/src/views/main/BookingLedger/detail/modules/basicInfo.vue b/src/views/main/BookingLedger/detail/modules/basicInfo.vue index 0f197c1..ec9acf9 100644 --- a/src/views/main/BookingLedger/detail/modules/basicInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/basicInfo.vue @@ -171,7 +171,7 @@ v-model="details.etd" @change="changeEtd" > - + W{{ etdWeek || '--' }} @@ -194,7 +194,7 @@ placeholder="实际开船" v-model="details.atd" > - + @@ -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 ( { + on-change={(val) => { console.log(val) }} /> ) - } + }, }, { field: 'col6', @@ -465,12 +459,12 @@ export default { return ( { + on-change={(val) => { console.log(val) }} /> ) - } + }, }, { field: 'col7', @@ -481,16 +475,16 @@ export default { return ( { + 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/1,参数之中,0代表月份,介于0(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 }, diff --git a/src/views/main/BookingLedger/detail/modules/cargoInfo.vue b/src/views/main/BookingLedger/detail/modules/cargoInfo.vue index 7d1e8f7..c51a0a4 100644 --- a/src/views/main/BookingLedger/detail/modules/cargoInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/cargoInfo.vue @@ -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: { diff --git a/src/views/main/BookingLedger/detail/modules/mailingInfo.vue b/src/views/main/BookingLedger/detail/modules/mailingInfo.vue index 876b2bc..797f626 100644 --- a/src/views/main/BookingLedger/detail/modules/mailingInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/mailingInfo.vue @@ -20,7 +20,7 @@ /> 保存
- * + * 35 40 50 @@ -51,7 +51,7 @@ /> 保存
- * + * 35 40 50 @@ -82,7 +82,7 @@ /> 保存
- * + * 35 40 50 @@ -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; // 截完一共多少行(如果余数大于1,则共有n+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) + } + } }, }