门店列表门店历史键值对错乱问题修复

main
wangdong 9 months ago
parent 414b908958
commit 16ebf73cc5
  1. 8
      src/views/store/shop/Create.vue
  2. 21
      src/views/store/shop/Update.vue

@ -85,12 +85,12 @@
> >
<a-date-picker <a-date-picker
format="YYYY-MM-DD" format="YYYY-MM-DD"
v-decorator="[`historysTime${index}`, { rules: [{ required: true, message: '请指定日期' }] }]" v-decorator="[`historysTime${k.id}`, { rules: [{ required: true, message: '请指定日期' }] }]"
style="width: 30%; margin-right: 8px" style="width: 30%; margin-right: 8px"
/> />
<a-input <a-input
placeholder="请输入门店历史" placeholder="请输入门店历史"
v-decorator="[`historysContenmt${index}`, { rules: [{ required: true }] }]" v-decorator="[`historysContenmt${k.id}`, { rules: [{ required: true }] }]"
style="width: 30%; margin-right: 8px" style="width: 30%; margin-right: 8px"
/> />
<a-icon <a-icon
@ -280,8 +280,8 @@ export default {
const form = { ...values, remark: this.tags, shop_image_id: values.shop_image_id.join(',') } const form = { ...values, remark: this.tags, shop_image_id: values.shop_image_id.join(',') }
form.history = form.historys.map((x, i) => { form.history = form.historys.map((x, i) => {
return { return {
time: form[`historysTime${i}`] && form[`historysTime${i}`].format('YYYY-MM-DD'), time: form[`historysTime${x.id}`] && form[`historysTime${x.id}`].format('YYYY-MM-DD'),
contenmt: form[`historysContenmt${i}`], contenmt: form[`historysContenmt${x.id}`],
} }
}) })

@ -89,12 +89,12 @@
> >
<a-date-picker <a-date-picker
format="YYYY-MM-DD" format="YYYY-MM-DD"
v-decorator="[`historysTime${index}`, { rules: [{ required: true, message: '请指定日期' }] }]" v-decorator="[`historysTime${k.id}`, { rules: [{ required: true, message: '请指定日期' }] }]"
style="width: 30%; margin-right: 8px" style="width: 30%; margin-right: 8px"
/> />
<a-input <a-input
placeholder="请输入门店历史" placeholder="请输入门店历史"
v-decorator="[`historysContenmt${index}`, { rules: [{ required: true }] }]" v-decorator="[`historysContenmt${k.id}`, { rules: [{ required: true }] }]"
style="width: 30%; margin-right: 8px" style="width: 30%; margin-right: 8px"
/> />
<a-icon <a-icon
@ -265,14 +265,14 @@ export default {
}) })
record.historys.forEach((x, i) => { record.historys.forEach((x, i) => {
x.time && (record[`historysTime${i}`] = moment(new Date(x.time))) x.time && (record[`historysTime${x.id}`] = moment(new Date(x.time)))
record[`historysContenmt${i}`] = x.contenmt record[`historysContenmt${x.id}`] = x.contenmt
timeAry.push(`historysTime${i}`) timeAry.push(`historysTime${x.id}`)
contenmtAry.push(`historysContenmt${i}`) contenmtAry.push(`historysContenmt${x.id}`)
this.form.getFieldDecorator(`historysTime${i}`, { initialValue: '', preserve: true }) this.form.getFieldDecorator(`historysTime${x.id}`, { initialValue: '', preserve: true })
this.form.getFieldDecorator(`historysContenmt${i}`, { initialValue: '', preserve: true }) this.form.getFieldDecorator(`historysContenmt${x.id}`, { initialValue: '', preserve: true })
}) })
} }
@ -323,7 +323,6 @@ export default {
return return
} }
keys.splice(index, 1) keys.splice(index, 1)
console.log(keys)
form.setFieldsValue({ form.setFieldsValue({
historys: keys, historys: keys,
@ -365,8 +364,8 @@ export default {
const form = { ...values, remark: this.tags, shop_image_id: values.shop_image_id.join(',') } const form = { ...values, remark: this.tags, shop_image_id: values.shop_image_id.join(',') }
form.history = form.historys.map((x, i) => { form.history = form.historys.map((x, i) => {
return { return {
time: form[`historysTime${i}`] && form[`historysTime${i}`].format('YYYY-MM-DD'), time: form[`historysTime${x.id}`] && form[`historysTime${x.id}`].format('YYYY-MM-DD'),
contenmt: form[`historysContenmt${i}`], contenmt: form[`historysContenmt${x.id}`],
} }
}) })

Loading…
Cancel
Save