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-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item :label="'用户编号'" prop="usercode">
|
||||
<el-autocomplete
|
||||
class="inline-input"
|
||||
v-model="form.usercode"
|
||||
:fetch-suggestions="querySearch"
|
||||
placeholder="请输入内容"
|
||||
@select="handleSelect"
|
||||
></el-autocomplete>
|
||||
{{ info.userId }}
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" v-if="info.mobile">
|
||||
{{ info.mobile }}
|
||||
@@ -20,7 +14,7 @@
|
||||
<image-avatar :src="info.avatar"/>
|
||||
</el-form-item>
|
||||
<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>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -31,9 +25,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getUserByUsercode, listUserByUserCode } from '@/api/xq/user'
|
||||
import { vipTypeList } from '@/constant/statusMap'
|
||||
import { addUserPictures, listUserPicturesByUserId } from '@/api/xq/userPictures'
|
||||
import {batchUpdateUserPictures, listUserPicturesByUserId} from '@/api/xq/userPictures'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -51,50 +44,65 @@ export default {
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
usercode: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
picture: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
buttonLoading: false,
|
||||
oldUserPictureList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
init (item) {
|
||||
this.open = true;
|
||||
this.info = {};
|
||||
this.info = item;
|
||||
this.form.usercode = undefined
|
||||
this.form.picture = undefined
|
||||
listUserPicturesByUserId('').then(res => {
|
||||
this.form.picture = []
|
||||
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 () {
|
||||
this.$refs['form'].validate((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;
|
||||
addUserPictures(this.form).then(data => {
|
||||
this.$modal.msgSuccess("新增图片成功");
|
||||
batchUpdateUserPictures({
|
||||
userId: this.info.userId,
|
||||
userPictures
|
||||
}).then(data => {
|
||||
this.$modal.msgSuccess("保存图片成功");
|
||||
this.buttonLoading = false;
|
||||
this.open = false
|
||||
this.$emit('refreshDataList')
|
||||
|
||||
@@ -140,7 +140,7 @@ export default {
|
||||
handleEdit(row) {
|
||||
this.addOrUpdateUserPictureDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdateUserPictureDialog.init(row.userId)
|
||||
this.$refs.addOrUpdateUserPictureDialog.init(row)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ module.exports = {
|
||||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://localhost:8080`,
|
||||
// target: `http://xq.qiqizl.com/prod-api`,
|
||||
// target: `http://localhost:8080`,
|
||||
target: `http://xq.qiqizl.com/prod-api`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
||||
Reference in New Issue
Block a user