1111
This commit is contained in:
@@ -2,13 +2,7 @@
|
|||||||
<el-dialog title="新增客户图片" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
<el-dialog title="新增客户图片" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item :label="'用户编号'" prop="usercode">
|
<el-form-item :label="'用户编号'" prop="usercode">
|
||||||
<el-autocomplete
|
{{ info.userId }}
|
||||||
class="inline-input"
|
|
||||||
v-model="form.usercode"
|
|
||||||
:fetch-suggestions="querySearch"
|
|
||||||
placeholder="请输入内容"
|
|
||||||
@select="handleSelect"
|
|
||||||
></el-autocomplete>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机号" v-if="info.mobile">
|
<el-form-item label="手机号" v-if="info.mobile">
|
||||||
{{ info.mobile }}
|
{{ info.mobile }}
|
||||||
@@ -20,7 +14,7 @@
|
|||||||
<image-avatar :src="info.avatar"/>
|
<image-avatar :src="info.avatar"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="图片" prop="picture">
|
<el-form-item label="图片" prop="picture">
|
||||||
<image-upload2 v-model="form.picture" :limit="3" />
|
<image-upload2 v-model="form.picture" :limit="9" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@@ -31,9 +25,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getUserByUsercode, listUserByUserCode } from '@/api/xq/user'
|
|
||||||
import { vipTypeList } from '@/constant/statusMap'
|
import { vipTypeList } from '@/constant/statusMap'
|
||||||
import { addUserPictures, listUserPicturesByUserId } from '@/api/xq/userPictures'
|
import {batchUpdateUserPictures, listUserPicturesByUserId} from '@/api/xq/userPictures'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -51,50 +44,65 @@ export default {
|
|||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
usercode: [
|
|
||||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
picture: [
|
picture: [
|
||||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
buttonLoading: false,
|
buttonLoading: false,
|
||||||
|
oldUserPictureList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init () {
|
init (item) {
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.info = {};
|
this.info = item;
|
||||||
this.form.usercode = undefined
|
this.form.usercode = undefined
|
||||||
this.form.picture = undefined
|
this.form.picture = []
|
||||||
listUserPicturesByUserId('').then(res => {
|
listUserPicturesByUserId(item.userId).then(res => {
|
||||||
|
this.oldUserPictureList = res.data || []
|
||||||
|
if (this.oldUserPictureList.length > 0) {
|
||||||
|
this.oldUserPictureList.forEach((item) => {
|
||||||
|
this.form.picture.push({
|
||||||
|
name: item.updateTime,
|
||||||
|
ossId: item.id,
|
||||||
|
path: item.picture,
|
||||||
|
status: "success",
|
||||||
|
uid: 1713801600193,
|
||||||
|
url: item.picture,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
querySearch(querySearch,cb){
|
|
||||||
listUserByUserCode(querySearch).then(res => {
|
|
||||||
cb(res.data.map((terminal) => {
|
|
||||||
return {
|
|
||||||
value: terminal,
|
|
||||||
name: terminal,
|
|
||||||
};
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleSelect(item){
|
|
||||||
getUserByUsercode(item.value).then(res => {
|
|
||||||
this.info = res.data
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 表单提交
|
// 表单提交
|
||||||
submitForm () {
|
submitForm () {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
const userPictures = []
|
||||||
|
let pList = this.form.picture
|
||||||
|
if (!Array.isArray(this.form.picture)) {
|
||||||
|
pList = this.form.picture.split(',')
|
||||||
|
}
|
||||||
|
pList.forEach((item) => {
|
||||||
|
const p = this.oldUserPictureList.find((it) => it.picture === item)
|
||||||
|
if (!!p) {
|
||||||
|
userPictures.push(p)
|
||||||
|
} else {
|
||||||
|
userPictures.push({
|
||||||
|
userId: this.info.userId,
|
||||||
|
picture: item,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
this.buttonLoading = true;
|
this.buttonLoading = true;
|
||||||
addUserPictures(this.form).then(data => {
|
batchUpdateUserPictures({
|
||||||
this.$modal.msgSuccess("新增图片成功");
|
userId: this.info.userId,
|
||||||
|
userPictures
|
||||||
|
}).then(data => {
|
||||||
|
this.$modal.msgSuccess("保存图片成功");
|
||||||
this.buttonLoading = false;
|
this.buttonLoading = false;
|
||||||
this.open = false
|
this.open = false
|
||||||
this.$emit('refreshDataList')
|
this.$emit('refreshDataList')
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export default {
|
|||||||
handleEdit(row) {
|
handleEdit(row) {
|
||||||
this.addOrUpdateUserPictureDialogVisible = true
|
this.addOrUpdateUserPictureDialogVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdateUserPictureDialog.init(row.userId)
|
this.$refs.addOrUpdateUserPictureDialog.init(row)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ module.exports = {
|
|||||||
proxy: {
|
proxy: {
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
target: `http://localhost:8080`,
|
// target: `http://localhost:8080`,
|
||||||
// target: `http://xq.qiqizl.com/prod-api`,
|
target: `http://xq.qiqizl.com/prod-api`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
|
|||||||
Reference in New Issue
Block a user