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

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

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

Loading…
Cancel
Save