diff --git a/src/views/main/BookingLedger/detail/modules/basicInfo.vue b/src/views/main/BookingLedger/detail/modules/basicInfo.vue
index 20ce760..6ea9c22 100644
--- a/src/views/main/BookingLedger/detail/modules/basicInfo.vue
+++ b/src/views/main/BookingLedger/detail/modules/basicInfo.vue
@@ -988,8 +988,8 @@ export default {
this.details.shipagency = res.name || ''
this.details.shipagencyid = res.code || ''
} else if (['sale', 'op', 'doc', 'custservice', 'route'].includes(type)) {
- this[type] = res.name || ''
- this[`${type}id`] = res.id || ''
+ this.details[type] = res.name || ''
+ this.details[`${type}id`] = res.id || ''
}
console.log('== 选中 ==', this.details, type)
}
diff --git a/src/views/main/BookingLedger/list/index.vue b/src/views/main/BookingLedger/list/index.vue
index 15f648f..c4b9c6f 100644
--- a/src/views/main/BookingLedger/list/index.vue
+++ b/src/views/main/BookingLedger/list/index.vue
@@ -617,7 +617,6 @@ export default {
},
created() {
// this.createdInit()
- // this.getConfigUser()
},
mounted() {
// this.onresize()
@@ -633,6 +632,7 @@ export default {
this.getTableList()
this.getPageSize()
this.getCarrier()
+ // this.getConfigUser()
},
onresize () {
// console.log('=== 列表加载完成 ===')
@@ -761,13 +761,14 @@ export default {
res.data.map((item, index) => {
switch (item.type) {
case 'booking_list_cond':
- this.getFormData(res.data)
- return
+ this.setFormData(item)
+ break
case 'booking_list_column':
- this.getTableList(res.data)
- return
+ this.setTableList(item)
+ break
case 'booking_list_page':
- this.getPageSize(res.data)
+ this.setPageSize(item)
+ break
}
})
})
@@ -832,6 +833,99 @@ export default {
console.log(err)
})
},
+ setFormData (data, isReset = false) {
+ if (data && JSON.parse(data.configJson).length) {
+ const arr = JSON.parse(data.configJson)
+ const nowData = []
+ const moreData = []
+ arr.map((item, index) => {
+ this.formAllData.map((fitem, findex) => {
+ if (fitem.label === item) {
+ nowData.push(fitem)
+ }
+ })
+ })
+ this.formAllData.map((item, index) => {
+ if (!arr.includes(item.label)) {
+ moreData.push(item)
+ }
+ })
+ this.formData = nowData
+ this.formMoreData = moreData
+ } else {
+ const nowData = this.formData.map((item, index) => {
+ return item.label
+ })
+ const moreData = []
+ this.formAllData.map((item, index) => {
+ if (!nowData.includes(item.label)) {
+ moreData.push(item)
+ }
+ })
+ this.formMoreData = moreData
+ }
+ this.formData.map((item, index) => {
+ this.$set(this.formRes, item.label, this.formRes[item.label] || '')
+ // select 船公司 等获取下拉列表
+ if (item.type === 'select') {
+ if (['NOBILL', 'CARGOID'].includes(item.label)) {
+ item.dataList = item.data
+ setTimeout(() => {
+ this.$refs[`fromlabel-${item.label}`][0].$data.dataList = item.data
+ }, 300)
+ }
+ }
+ })
+ console.log('== 获取到form, 准备获取列表 ==', isReset, this.formRes)
+ if (!isReset) {
+ this.getList(this.formRes)
+ }
+ const len = this.formData.length % 4
+ if (this.formData.length === 4 || this.formData.length > 4) {
+ this.formBtnCol = 8
+ } else {
+ this.formBtnCol = 24 - len * 4
+ }
+ this.$forceUpdate()
+ },
+ setTableList (data) {
+ if (data && JSON.parse(data.configJson).length) {
+ this.gridOptions.columns = JSON.parse(data.configJson)
+ this.formTableData = JSON.parse(data.configJson)
+ const nowTableArr = this.formTableData.map((item, index) => {
+ return item.field
+ })
+ const moreTableArr = []
+ this.fromTableAllData.map((item, index) => {
+ if (!nowTableArr.includes(item.field)) {
+ moreTableArr.push(item)
+ }
+ })
+ this.formMoreTableData = moreTableArr
+ this.$forceUpdate()
+ } else {
+ const nowTableArr = this.formTableData.map((item, index) => {
+ return item.field
+ })
+ const moreTableArr = []
+ this.fromTableAllData.map((item, index) => {
+ if (!nowTableArr.includes(item.field)) {
+ moreTableArr.push(item)
+ }
+ })
+ this.formMoreTableData = moreTableArr
+ this.$forceUpdate()
+ }
+ },
+ setPageSize (data) {
+ if (data && JSON.parse(data.configJson)) {
+ this.gridOptions.pagerConfig.pageSize = JSON.parse(data.configJson).pageSize
+ this.getList(this.formRes)
+ this.$forceUpdate()
+ }
+ },
+
+ // 获取表单设置内容
getFormData(isReset = false) {
DjyUserConfigGet({ type: 'booking_list_cond' }).then(res => {
if (res.data && JSON.parse(res.data.configJson).length) {
@@ -995,7 +1089,7 @@ export default {
}
},
tableRefresh() {
- let data = { ...this.formRes }
+ const data = { ...this.formRes }
this.init(this.formRes)
this.formRes = data
},
@@ -1065,6 +1159,7 @@ export default {
this.$refs[label][0].$data.value = ''
}
})
+ this.getFormData()
this.init()
})
},
@@ -1077,8 +1172,8 @@ export default {
} else if (form.type === 'date') {
this.formRes[form.label] = value
} else if (form.type === 'dateRange') {
- this.formRes[form.resLabel[0]] = value[0]
- this.formRes[form.resLabel[1]] = value[1]
+ this.formRes[form.resLabel[0]] = value[0] || ''
+ this.formRes[form.resLabel[1]] = value[1] || ''
} else if (form.type === 'select') {
this.formRes[form.label] = value
} else if (form.type === 'complete') {
diff --git a/src/views/main/BookingLedger/list/modules/formLabel.vue b/src/views/main/BookingLedger/list/modules/formLabel.vue
index b45e289..f221ff0 100644
--- a/src/views/main/BookingLedger/list/modules/formLabel.vue
+++ b/src/views/main/BookingLedger/list/modules/formLabel.vue
@@ -7,7 +7,7 @@
-
+
{
+ // if (item._d) {
+ // const date = this.formatDate(item._d).substr(0, 10)
+ // arr.push(date)
+ // console.log(date)
+ // }
+ // })
+ // this.$emit('change', {
+ // form: this.labelData,
+ // value: arr
+ // })
+ },
+ formatDate (now) {
+ var date = new Date(now)
+ var y = date.getFullYear() // 年份
+ var m = date.getMonth() + 1 // 月份,注意:js里的月要加1
+ if (m < 10) {
+ m = '0' + m;
+ }
+ var d = date.getDate() // 日
+ if (d < 10) {
+ d = '0' + d;
+ }
+ var h = date.getHours() // 小时
+ if (h < 10) {
+ h = '0' + h;
+ }
+ var min = date.getMinutes() // 分钟
+ if (min < 10) {
+ min = '0' + min;
+ }
+ var s = date.getSeconds() // 秒
+ if (s < 10) {
+ s = '0' + s;
+ }
+ // 返回值,根据自己需求调整,现在已经拿到了年月日时分秒了
+ return y + '-' + m + '-' + d + ' ' + h + ':' + min + ':' + s
+ },
// == 下拉选择 ==
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0