(一)数组转字符串
备注(主要是这句):
this.modifyForm.prefecture =this.modifyForm.prefecture.toString()
async handleAdclick() {
this.modifyForm.prefecture = this.modifyForm.prefecture
.toString()
.replace(/,/gi, '|')
const result = await addCustomer(this.modifyForm)
if (result.code === 200) {
/* 添加完置空表单 */
this.modifyForm = {
address: '',
age: '',
avatar: '',
mobile: '',
memo: '',
conditionTags: '',
email: '',
employeeId: '',
enterpriseWechatTags: '',
name: '',
rfmtags: '',
sex: true,
sources: '',
wxNickname: '',
prefecture: ''
}
this.$message.success('添加成功')
this.$router.go(-1)
} else {
this.$message.error('添加失败')
}
}
(二)字符串转数组
备注(主要是这句):
this.distrubuteForm.ids = this.writerAnotherId.split(‘,’)
(我这里有个字段赋值,对应好你的字段即可)
async handleAdclick() {
this.distrubuteForm.ids = this.writerAnotherId.split(',')
const result = await distrubuteCustom(this.distrubuteForm)
if (result.code === 200) {
/* 添加完置空表单 */
this.distrubuteForm = {
crmId: '',
followUpUserId: '',
ids: [],
optUserId: ''
}
this.$message.success('分配成功')
this.distributionDialogVisible = false
this.getList()
} else {
this.$message.error('分配失败')
}
}