对接可用时间字段
This commit is contained in:
parent
f91249159d
commit
d5d3ce3c43
|
@ -135,6 +135,15 @@ export default class addKnockGold extends Component {
|
||||||
this.props.data.time_limit.use_time.fiexd_time?.start_time
|
this.props.data.time_limit.use_time.fiexd_time?.start_time
|
||||||
model.fixed_time[1] =
|
model.fixed_time[1] =
|
||||||
this.props.data.time_limit.use_time.fiexd_time?.end_time
|
this.props.data.time_limit.use_time.fiexd_time?.end_time
|
||||||
|
if (this.props.data.time_limit.use_time.type === 'week') {
|
||||||
|
model.ruleWeek = this.props.data.time_limit.use_time?.week
|
||||||
|
model.ruleDate = this.props.data.time_limit.use_time?.time
|
||||||
|
}
|
||||||
|
if (this.props.data.time_limit.use_time.type === 'irregular') {
|
||||||
|
model.irregularDate = this.props.data.time_limit.use_time?.day
|
||||||
|
model.irregularTime = this.props.data.time_limit.use_time?.time
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({ model: model })
|
this.setState({ model: model })
|
||||||
}
|
}
|
||||||
this.getUserSelectList()
|
this.getUserSelectList()
|
||||||
|
@ -357,7 +366,6 @@ export default class addKnockGold extends Component {
|
||||||
|
|
||||||
/* 提交 */
|
/* 提交 */
|
||||||
async submit() {
|
async submit() {
|
||||||
console.log(this.state.model)
|
|
||||||
if (
|
if (
|
||||||
this.refs.form.validator() &&
|
this.refs.form.validator() &&
|
||||||
this.refs.form1.validator() &&
|
this.refs.form1.validator() &&
|
||||||
|
@ -467,10 +475,7 @@ export default class addKnockGold extends Component {
|
||||||
|
|
||||||
use_time: {
|
use_time: {
|
||||||
type: this.state.model.usable_time,
|
type: this.state.model.usable_time,
|
||||||
fiexd_time: {
|
...this.withTimeFunction(this.state.model.usable_time),
|
||||||
start_time: this.state.model.fixed_time[0],
|
|
||||||
end_time: this.state.model.fixed_time[1]
|
|
||||||
},
|
|
||||||
effect_day: this.state.model.effect_date,
|
effect_day: this.state.model.effect_date,
|
||||||
effect_date_type: this.state.model.effect_date_type?.key
|
effect_date_type: this.state.model.effect_date_type?.key
|
||||||
}
|
}
|
||||||
|
@ -479,6 +484,28 @@ export default class addKnockGold extends Component {
|
||||||
return transformData
|
return transformData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 处理可用时间段 */
|
||||||
|
withTimeFunction(type) {
|
||||||
|
let obj = {}
|
||||||
|
switch (type) {
|
||||||
|
case 'week':
|
||||||
|
obj.time = this.state.model.ruleDate
|
||||||
|
obj.week = this.state.model.ruleWeek
|
||||||
|
break
|
||||||
|
case 'irregular':
|
||||||
|
obj.time = this.state.model.irregularTime
|
||||||
|
obj.day = this.state.model.irregularDate
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
obj.fiexd_time = {
|
||||||
|
start_time: this.state.model.fixed_time[0],
|
||||||
|
end_time: this.state.model.fixed_time[1]
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
testDateFunction(arr) {
|
testDateFunction(arr) {
|
||||||
return arr.map((item) => this.setTime(item)).filter((item) => item)
|
return arr.map((item) => this.setTime(item)).filter((item) => item)
|
||||||
}
|
}
|
||||||
|
@ -532,7 +559,7 @@ export default class addKnockGold extends Component {
|
||||||
|
|
||||||
/* 验证有效期内,规则日期可用 */
|
/* 验证有效期内,规则日期可用 */
|
||||||
|
|
||||||
if (this.state.model.usable_time === 'ruleDate') {
|
if (this.state.model.usable_time === 'week') {
|
||||||
if (
|
if (
|
||||||
this.testDateFunction(this.state.model.ruleDate).length > 0 ||
|
this.testDateFunction(this.state.model.ruleDate).length > 0 ||
|
||||||
this.state.model.ruleWeek.length < 1
|
this.state.model.ruleWeek.length < 1
|
||||||
|
@ -543,7 +570,7 @@ export default class addKnockGold extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 有效期内,不规则日期可用 */
|
/* 有效期内,不规则日期可用 */
|
||||||
if (this.state.model.usable_time === 'irregularDate') {
|
if (this.state.model.usable_time === 'irregular') {
|
||||||
if (
|
if (
|
||||||
this.testDateFunction(this.state.model.irregularDate).length > 0 ||
|
this.testDateFunction(this.state.model.irregularDate).length > 0 ||
|
||||||
this.testDateFunction(this.state.model.irregularTime).length > 0
|
this.testDateFunction(this.state.model.irregularTime).length > 0
|
||||||
|
@ -628,7 +655,6 @@ export default class addKnockGold extends Component {
|
||||||
|
|
||||||
//限制时间
|
//限制时间
|
||||||
setTime(data) {
|
setTime(data) {
|
||||||
console.log(data)
|
|
||||||
if (!isArray(data) || data?.length === 0) return true
|
if (!isArray(data) || data?.length === 0) return true
|
||||||
const newData = data.map((item) => Boolean(item))
|
const newData = data.map((item) => Boolean(item))
|
||||||
let blr = null
|
let blr = null
|
||||||
|
@ -726,7 +752,6 @@ export default class addKnockGold extends Component {
|
||||||
<FormItem labelname='卷模板编号' prop='temp_no' id='batch_number'>
|
<FormItem labelname='卷模板编号' prop='temp_no' id='batch_number'>
|
||||||
<Ipt
|
<Ipt
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
console.log(value)
|
|
||||||
this.onHandleChange(value, 'temp_no')
|
this.onHandleChange(value, 'temp_no')
|
||||||
}}
|
}}
|
||||||
onClearItem={() => {
|
onClearItem={() => {
|
||||||
|
@ -1174,7 +1199,7 @@ export default class addKnockGold extends Component {
|
||||||
this.onHandleChange([[]], 'irregularDate')
|
this.onHandleChange([[]], 'irregularDate')
|
||||||
this.onHandleChange([[]], 'irregularTime')
|
this.onHandleChange([[]], 'irregularTime')
|
||||||
}}>
|
}}>
|
||||||
<Radio value='ruleDate'>有效期内,规则日期可用</Radio>
|
<Radio value='week'>有效期内,规则日期可用</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
<Checkbox.Group
|
<Checkbox.Group
|
||||||
value={this.state.model.ruleWeek}
|
value={this.state.model.ruleWeek}
|
||||||
|
@ -1232,7 +1257,7 @@ export default class addKnockGold extends Component {
|
||||||
this.onHandleChange([[]], 'ruleWeek')
|
this.onHandleChange([[]], 'ruleWeek')
|
||||||
this.onHandleChange([[]], 'ruleDate')
|
this.onHandleChange([[]], 'ruleDate')
|
||||||
}}>
|
}}>
|
||||||
<Radio value='irregularDate'>有效期内,不规则日期可用</Radio>
|
<Radio value='irregular'>有效期内,不规则日期可用</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
<p className='notice' style={{ width: '600px' }}>
|
<p className='notice' style={{ width: '600px' }}>
|
||||||
可在有效期内任意选择时间天数,以及可用时段。
|
可在有效期内任意选择时间天数,以及可用时段。
|
||||||
|
|
Loading…
Reference in New Issue