修改必填项、 台账时间区间

szh_zidingyibiaoti
lilu 2 years ago
parent 80701fe3dd
commit 9442dfcd61

@ -988,8 +988,8 @@ export default {
this.details.shipagency = res.name || '' this.details.shipagency = res.name || ''
this.details.shipagencyid = res.code || '' this.details.shipagencyid = res.code || ''
} else if (['sale', 'op', 'doc', 'custservice', 'route'].includes(type)) { } else if (['sale', 'op', 'doc', 'custservice', 'route'].includes(type)) {
this[type] = res.name || '' this.details[type] = res.name || ''
this[`${type}id`] = res.id || '' this.details[`${type}id`] = res.id || ''
} }
console.log('== 选中 ==', this.details, type) console.log('== 选中 ==', this.details, type)
} }

@ -617,7 +617,6 @@ export default {
}, },
created() { created() {
// this.createdInit() // this.createdInit()
// this.getConfigUser()
}, },
mounted() { mounted() {
// this.onresize() // this.onresize()
@ -633,6 +632,7 @@ export default {
this.getTableList() this.getTableList()
this.getPageSize() this.getPageSize()
this.getCarrier() this.getCarrier()
// this.getConfigUser()
}, },
onresize () { onresize () {
// console.log('=== ===') // console.log('=== ===')
@ -761,13 +761,14 @@ export default {
res.data.map((item, index) => { res.data.map((item, index) => {
switch (item.type) { switch (item.type) {
case 'booking_list_cond': case 'booking_list_cond':
this.getFormData(res.data) this.setFormData(item)
return break
case 'booking_list_column': case 'booking_list_column':
this.getTableList(res.data) this.setTableList(item)
return break
case 'booking_list_page': case 'booking_list_page':
this.getPageSize(res.data) this.setPageSize(item)
break
} }
}) })
}) })
@ -832,6 +833,99 @@ export default {
console.log(err) 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) { getFormData(isReset = false) {
DjyUserConfigGet({ type: 'booking_list_cond' }).then(res => { DjyUserConfigGet({ type: 'booking_list_cond' }).then(res => {
if (res.data && JSON.parse(res.data.configJson).length) { if (res.data && JSON.parse(res.data.configJson).length) {
@ -995,7 +1089,7 @@ export default {
} }
}, },
tableRefresh() { tableRefresh() {
let data = { ...this.formRes } const data = { ...this.formRes }
this.init(this.formRes) this.init(this.formRes)
this.formRes = data this.formRes = data
}, },
@ -1065,6 +1159,7 @@ export default {
this.$refs[label][0].$data.value = '' this.$refs[label][0].$data.value = ''
} }
}) })
this.getFormData()
this.init() this.init()
}) })
}, },
@ -1077,8 +1172,8 @@ export default {
} else if (form.type === 'date') { } else if (form.type === 'date') {
this.formRes[form.label] = value this.formRes[form.label] = value
} else if (form.type === 'dateRange') { } else if (form.type === 'dateRange') {
this.formRes[form.resLabel[0]] = value[0] this.formRes[form.resLabel[0]] = value[0] || ''
this.formRes[form.resLabel[1]] = value[1] this.formRes[form.resLabel[1]] = value[1] || ''
} else if (form.type === 'select') { } else if (form.type === 'select') {
this.formRes[form.label] = value this.formRes[form.label] = value
} else if (form.type === 'complete') { } else if (form.type === 'complete') {

@ -7,7 +7,7 @@
<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" v-model="dateVal"/> <a-range-picker style="overflow: hidden;margin-top:3px;" format="YYYY-MM-DD" @change="changeRangeDate" @calendarChange="openChangeRangeDate" v-model="dateVal"/>
</template> </template>
<template v-else-if="labelData.type == 'select'"> <template v-else-if="labelData.type == 'select'">
<a-select <a-select
@ -137,13 +137,51 @@ export default {
}) })
}, },
changeRangeDate(e, mode) { changeRangeDate(e, mode) {
console.log('== date-range ==', e, mode)
// this.value = mode
this.$emit('change', { this.$emit('change', {
form: this.labelData, form: this.labelData,
value: 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', {
// form: this.labelData,
// value: arr
// })
},
formatDate (now) {
var date = new Date(now)
var y = date.getFullYear() //
var m = date.getMonth() + 1 // js1
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) { 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