|
|
@ -329,6 +329,8 @@ |
|
|
|
v-model="colItem.show" |
|
|
|
@change="changeVal($event, index, itemIndex)" |
|
|
|
@backspace="backspace($event, index, itemIndex)" |
|
|
|
@confirmText="confirmText(index, itemIndex)" |
|
|
|
@cancelText="confirmText(index, itemIndex)" |
|
|
|
></u-keyboard> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -347,7 +349,10 @@ import { infoList } from '@/config/yyInfo'; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'Info', |
|
|
|
props: { personalInfo: { type: Object, default: () => {} } }, |
|
|
|
props: { |
|
|
|
personalInfo: { type: Object, default: () => {} }, |
|
|
|
isEdit: { type: Boolean, default: false }, |
|
|
|
}, |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
@ -365,7 +370,6 @@ export default { |
|
|
|
city: true, |
|
|
|
area: false, |
|
|
|
}, |
|
|
|
isEdit: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -381,22 +385,40 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
personalInfo(val) { |
|
|
|
if (val && val.userName) { |
|
|
|
this.setDate(val); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
if (this.personalInfo && this.personalInfo.userName) { |
|
|
|
this.setDate(this.personalInfo); |
|
|
|
this.isEdit = true; |
|
|
|
} else { |
|
|
|
this.$nextTick(() => { |
|
|
|
if (!this.isEdit) { |
|
|
|
this.$emit('setEmptyInfo'); |
|
|
|
const info = this.$t.storage.getStorageSync('infoList'); |
|
|
|
if (info !== 'null') { |
|
|
|
if (info !== 'null' && !this.isEdit) { |
|
|
|
this.infoList = JSON.parse(info); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
changeVal(e, index, itemIndex) { |
|
|
|
const info = this.infoList[index][itemIndex]; |
|
|
|
|
|
|
|
if (info.value === null) { |
|
|
|
info.value = e.toString(); |
|
|
|
} else { |
|
|
|
if (typeof e === 'number') { |
|
|
|
const str = e.toString(); |
|
|
|
info.value += str; |
|
|
|
} else { |
|
|
|
info.value += e; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.isEdit) { |
|
|
|
this.updateTrainee(info); |
|
|
|
} |
|
|
@ -410,6 +432,10 @@ export default { |
|
|
|
this.updateTrainee(info); |
|
|
|
} |
|
|
|
}, |
|
|
|
confirmText(index, itemIndex) { |
|
|
|
const info = this.infoList[index][itemIndex]; |
|
|
|
info.show = false; |
|
|
|
}, |
|
|
|
|
|
|
|
changeShow(index, itemIndex) { |
|
|
|
this.infoList[index][itemIndex].show = !this.infoList[index][itemIndex].show; |
|
|
@ -431,7 +457,7 @@ export default { |
|
|
|
} |
|
|
|
case 5: { |
|
|
|
// 多选 |
|
|
|
let checkerList = info.value; |
|
|
|
let checkerList = info.value || []; |
|
|
|
if (checkerList.length) { |
|
|
|
const i = checkerList.findIndex(item => item === e.name || item.substring(0, 2) === e.name); |
|
|
|
if (i < 0) { |
|
|
@ -498,11 +524,11 @@ export default { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.$t.storage.setStorageSync('infoList', this.infoList); |
|
|
|
|
|
|
|
if (this.isEdit) { |
|
|
|
this.updateTrainee(info); |
|
|
|
this.$t.storage.setStorageSync('infoList', null); |
|
|
|
} else { |
|
|
|
this.$t.storage.setStorageSync('infoList', this.infoList); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|