修改海报照片上传

master
username 12 months ago
parent 3f110c11bd
commit d6027d1dbd

@ -12,7 +12,11 @@ import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.xmlbeans.impl.validator.ValidatorUtil;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -43,6 +47,20 @@ public class CmAttachController extends BaseController {
return getDataTable(list);
}
@PostMapping("/api/file/upload")
@ApiOperation("文件上传")
@Log(title = "文件上传", businessType = BusinessType.OTHER)
// @RepeatSubmit 有点小问题 先注释
public AjaxResult upload(@RequestParam String fileId, CmAttach attach, @RequestParam("files") MultipartFile[] files) {
if (StringUtils.isBlank(fileId) || "null".equals(fileId)) {
return AjaxResult.error("fileId不能为空");
}
if (Validator.isEmpty(files)) {
return AjaxResult.error("上传文件不可为空!");
}
return AjaxResult.success(cmAttachService.uploadFileBatch(files, fileId)) ;
}
/**
*
*/

@ -1,8 +1,10 @@
package com.bs.cm.service;
import com.bs.cm.domain.CmAttach;
import com.bs.common.core.domain.AjaxResult;
import com.github.yulichang.base.MPJBaseService;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* Service
@ -12,4 +14,5 @@ import com.github.yulichang.base.MPJBaseService;
*/
public interface ICmAttachService extends MPJBaseService<CmAttach>{
List<CmAttach> uploadFileBatch(MultipartFile[] files, String fileId);
}

@ -1,11 +1,30 @@
package com.bs.cm.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.bs.cm.mapper.CmAttachMapper;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.constant.Constants;
import com.bs.common.exception.ServiceException;
import com.bs.common.utils.FileUtil;
import com.bs.common.utils.OsInfoUtil;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static cn.hutool.core.date.DateUtil.format;
import static com.bs.common.config.BsConfig.*;
/**
* Service
*
@ -15,5 +34,77 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional(rollbackFor = Exception.class)
public class CmAttachServiceImpl extends MPJBaseServiceImpl<CmAttachMapper, CmAttach> implements ICmAttachService {
@Resource
private ICmAttachService cmAttachService;
public static final String SEPARATOR = "/";
public static final String SUFFIX = Constants.RESOURCE_PREFIX + SEPARATOR;
@Autowired
private Environment env;
@Override
public List<CmAttach> uploadFileBatch(MultipartFile[] files, String fileId) {
List<CmAttach> attachs = new ArrayList<>();
for (MultipartFile file : files) {
//插入附件表
attachs.add(uploadFile(file, fileId));
}
if (attachs.size() == 0) {
return null;
}
// 插入附件中间表
List<CmAttach> attachVos = new ArrayList<>();
cmAttachService.saveBatch(attachs);
// cmAttachService.saveBatch(getAttachRef(attachs,attachVos, fileId, businessUnits));
return attachVos;
}
/**
*
*/
@Transactional
public CmAttach uploadFile(MultipartFile multipartFile, String fileId) {
FileUtil.checkSize(Long.parseLong(env.getProperty("chain.maxSize")), multipartFile.getSize());
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
String type = FileUtil.getFileType(suffix);
//新的文件名+后缀
String fileName = FileUtil.fileRenameMos(null, null) + "." + suffix;
//绝对路径+年份+文件类型+文件名
String filePath = format(new Date(), "yyyy") + SEPARATOR +
type + SEPARATOR + fileName;
File file = FileUtil.uploadMos(multipartFile, getFilePath() + SEPARATOR + filePath);
if (ObjectUtil.isNull(file)) {
throw new ServiceException("上传失败");
}
try {
CmAttach attach = new CmAttach();
attach.setFileId(fileId);
// attach.setAttachId(UUIDUtils.generatorUUID());
attach.setAttachName(fileName);
attach.setAttachFileType(type);
attach.setAttachContentType(multipartFile.getContentType());
attach.setAttachFileSize((long) multipartFile.getSize());
attach.setAttachFileUrl(SUFFIX + filePath);
attach.setOldName(multipartFile.getOriginalFilename());
// cmAttachMapper.insert(attach);
return attach;
} catch (Exception e) {
FileUtil.del(file);
throw e;
}
}
/**
*
*
* @return
*/
public static String getFilePath() {
if (OsInfoUtil.isLinux()) {
return getLinuxLocalFilePath();
}
if (OsInfoUtil.isMacOS() || OsInfoUtil.isMacOSX()) {
return getMacLocalFilePath();
}
return getWinLocalFilePath();
}
}

@ -0,0 +1,203 @@
<template>
<div class="banner-image" :style="{width: width}">
<el-carousel v-loading="loading" ref="carousel" :height="height" arrow="never" class="banner-carousel" indicator-position="none"
@change="carouselChange">
<el-carousel-item v-for="item in imageDatas" :key="item.attachId">
<div class="banner-carousel-item">
<el-image style="width:100%;height:100%" :src="getFullImageUrl(item)" fit="fill"
@click="handlePreview(item)"></el-image>
<el-button class="banner-delete" type="danger" size="mini" icon="el-icon-delete" circle v-if="!readonly"
@click.stop="handleRemove(item)"></el-button>
</div>
</el-carousel-item>
</el-carousel>
<el-pagination layout="prev, pager, next" hide-on-single-page small :current-page="currentPage" :page-size="1"
:total="imageDatas.length" @current-change="currentPageChange">
</el-pagination>
<el-upload style="margin-top: 10px;" v-if="imageDatas.length < maxLength && !readonly" :action="action" :headers="headers" name="files" accept="image"
:data="{ fileId: bannerId, businessUnits: businessUnits }" :disabled="!bannerId" :before-upload="beforeUpload" multiple :limit="limit"
:show-file-list="false" :file-list="fileList" :on-success="uploadSucess">
<el-button size="small" type="primary">添加照片</el-button>
</el-upload>
<my-image-viewer ref="previewImage" v-model="imageDatas" :options="{
edit: !readonly,
check: !readonly,
delete: !readonly,
}"></my-image-viewer>
</div>
</template>
<script>
import {getAttachList,deleteFile as deleteAttach} from "@/api/common/file";
// import { getAttachs, deleteFile as deleteAttach } from '@/api/system/file.js';
import { getToken } from '@/utils/auth'
export default {
name: 'BannerUpload',
props: {
bannerId: null,
readonly: {
type: Boolean,
default: false
},
//
businessUnits: {
type: String,
default: '',
},
// 9
maxLength: {
type: Number,
default: 9,
},
height: {
type: String,
default: '210px',
},
width: {
type: String,
default: '200px',
}
},
computed: {
limit() {
if (this.imageDatas) {
return Math.max(0, this.maxLength - this.imageDatas.length);
}
return this.maxLength;
}
},
watch: {
bannerId: {
handler(val) {
this.imageDatas = [];
if (val) {
this.getImages();
}
},
immediate: true,
}
},
data() {
return {
action: process.env.VUE_APP_BASE_API + '/api/file/upload',
headers: {
Authorization: 'Bearer ' + getToken(),
},
imageDatas: [],
currentPage: 1,
dialogVisible: false,
dialogImageUrl: '',
fileList: [],
loading: false,
}
},
methods: {
getFullImageUrl(item) {
return process.env.VUE_APP_BASE_API + item.attachFileurl;
},
beforeUpload(file) {
const isImg = file.type.indexOf('image/') !== -1;
if (!isImg) {
this.$message.warning('只能上传图片');
}
this.loading = true;
return isImg;
},
getImages() {
if (!this.bannerId) {
return;
}
this.loading = true;
getAttachList(this.bannerId).then((res) => {
this.loading = false;
this.imageDatas = res.data || [];
}).catch(e => {
this.loading = false;
});
},
uploadSucess(response, file, fileList) {
this.fileList = [];
this.loading = false;
if (response.success) {
setTimeout(() => {
//
this.getImages();
}, 1000);
}
},
handleRemove(item) {
this.$confirm('是否确认删除当前照片', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.loading = true;
deleteAttach(item.attachId).then((res) => {
this.loading = false;
if (res.status !== 200) return;
this.getImages();
this.msgSuccess('删除成功');
});
}).catch(() => {
this.loading = false;
});
},
handlePreview(item) {
// this.dialogImageUrl = this.getFullImageUrl(item);
// this.dialogVisible = true;
const index = this.imageDatas.findIndex(val => val.attachId === item.attachId);
this.$refs.previewImage.open(index);
},
carouselChange(page) {
this.currentPage = page + 1;
},
currentPageChange(page) {
if (this.$refs.carousel) {
this.$refs.carousel.setActiveItem(page - 1);
}
}
}
}
</script>
<style scoped>
.banner-image {
display: flex;
flex-direction: column;
align-items: center;
padding: 0px 0px 20px 20px;
}
.banner-carousel {
background-color: #f3f3f3;
border-color: gray;
border-radius: 4px;
border-width: 2px;
width: 100%;
}
.banner-delete {
position: absolute;
top: 2px;
right: 2px;
/* font-size: 20px; */
display: none;
/* background-color: #f3f3f3; */
}
.banner-carousel-item {
width: 100%;
height: 100%;
position: relative;
background-color: #f3f3f3;
border-color: gray;
border-radius: 4px;
border-width: 2px;
}
.banner-carousel-item:hover .banner-delete {
display: block;
}
</style>

@ -0,0 +1,152 @@
<template>
<div>
<div v-if="readonly" v-loading="loading" class="image-list" :style="readListStyle">
<el-empty v-if="fileList.length === 0 && !hideEmpty" description="未上传照片" :image-size="80"
style="padding: 5px;width: 100%;"></el-empty>
<img v-for="(item, index) in fileList" :key="index" class="image-item" :style="readItemStyle" :src="item.url"
@click="handlePreview(item)" />
</div>
<el-upload v-else v-loading="loading" :action="action" :headers="headers" name="file" accept="image" :limit="0"
:data="{ fileId: bizId, businessUnits: businessUnits }" :disabled="!bizId" :before-upload="beforeUpload" multiple
:file-list="fileList" :on-success="uploadSucess" list-type="picture-card" :on-preview="handlePreview"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
<!-- <my-image-viewer ref="previewImage" v-model="fileList" :options="{-->
<!-- edit: !readonly,-->
<!-- check: !readonly,-->
<!-- delete: !readonly,-->
<!-- }"></my-image-viewer>-->
</div>
</template>
<script>
// import { getAttachs, deleteFile as deleteAttach } from '@/api/system/file.js';
import {getAttachList,deleteFile as deleteAttach} from "@/api/common/file";
import { getToken } from '@/utils/auth'
export default {
name: 'PictureUpload',
props: {
bizId: null,
readonly: false,
hideEmpty: false,
readItemStyle: null,
readListStyle: null,
//
businessUnits: {
type: String,
default: '',
},
},
watch: {
bizId: {
handler(val) {
this.fileList = [];
if (val) {
this.getImages();
}
},
immediate: true,
}
},
data() {
return {
action: process.env.VUE_APP_BASE_API + '/common/upload',
headers: {
Authorization: 'Bearer ' + getToken(),
},
previewUrl: null,
fileList: [],
loading: false,
}
},
computed: {
previewSrcList() {
return this.fileList.map(v => v.url);
}
},
methods: {
getFullImageUrl(item) {
return process.env.VUE_APP_BASE_API + item.attachFileUrl;
},
beforeUpload(file) {
const isImg = file.type.indexOf('image/') !== -1;
if (!isImg) {
this.$message.warning('只能上传图片');
}
return isImg;
},
getImages() {
if (!this.bizId) {
return;
}
this.loading = true;
getAttachList(this.bizId, { businessUnits: this.businessUnits }).then((res) => {
this.loading = false;
if (res.code !== 200) return;
this.fileList = res.data.map(v => {
return {
...v,
url: this.getFullImageUrl(v),
name: v.oldName,
};
});
this.$emit('fetched', this.fileList);
}).catch(e => {
this.loading = false;
});
},
uploadSucess(response, file, fileList) {
if (response.success && response.data[0]) {
this.fileList = fileList.map(v => {
if (v.uid === file.uid) {
return {
...v,
...response.data[0],
url: this.getFullImageUrl(response.data[0]),
};
}
return v;
});
this.$emit('fetched', this.fileList);
} else {
// this.msgError(response.msg);
}
},
handleRemove(item) {
this.fileList = this.fileList.filter(v => v.id !== item.id);
this.$emit('fetched', this.fileList);
if (!item.id) {
return;
}
deleteAttach(item.id).then((res) => {
}).catch(e => {
});
},
handlePreview(item,) {
const index = this.fileList.findIndex(val => val.attachId === item.attachId);
this.$refs.previewImage.open(index);
// this.previewUrl = item.url;
// this.$nextTick(() => {
// this.$refs.previewImage.clickHandler();
// })
},
}
}
</script>
<style lang="scss" scoped>
.image-list {
display: flex;
.image-item {
width: 148px;
height: 148px;
border: 1px solid #C0CCDA;
border-radius: 6px;
margin-right: 8px;
margin-bottom: 8px;
overflow: hidden;
}
}</style>

@ -19,7 +19,7 @@
>
<i class="el-icon-plus"></i>
</el-upload>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
@ -63,6 +63,7 @@ export default {
type: Array,
default: () => ["png", "jpg", "jpeg"],
},
//
isShowTip: {
type: Boolean,
@ -77,7 +78,7 @@ export default {
dialogVisible: false,
hideUpload: false,
baseUrl: process.env.VUE_APP_BASE_API,
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/uploads", //
headers: {
Authorization: "Bearer " + getToken(),
},
@ -87,6 +88,8 @@ export default {
watch: {
value: {
handler(val) {
console.log("val" + val);
console.log( val);
if (val) {
//
const list = Array.isArray(val) ? val : this.value.split(',');
@ -101,6 +104,8 @@ export default {
}
return item;
});
console.log("this.fileList");
console.log(this.fileList);
} else {
this.fileList = [];
return [];
@ -119,6 +124,7 @@ export default {
methods: {
// loading
handleBeforeUpload(file) {
console.log("file" + file);
let isImg = false;
if (this.fileType.length) {
let fileExtension = "";

@ -45,6 +45,8 @@ import Rq from '@/components/Rq';
import MyPage from '@/components/MyPage';
import MyFormItem from '@/components/MyFormItem';
import MySelectButton from '@/components/MySelectButton';
import BannerUpload from '@/components/FileUpload/BannerUpload';
import PictureUpload from '@/components/FileUpload/PictureUpload';
// 全局方法挂载
Vue.prototype.getDicts = getDicts
@ -74,6 +76,8 @@ Vue.component('Rq', Rq)
Vue.component('MyPage', MyPage)
Vue.component('MyFormItem', MyFormItem)
Vue.component('MySelectButton', MySelectButton)
Vue.component('BannerUpload', BannerUpload)
Vue.component('PictureUpload', PictureUpload)
Vue.use(directive)
Vue.use(plugins)

@ -381,7 +381,7 @@ export default {
articleTitle: null,
publishTime: null,
articleContent: null,
status: null,
status: "0",
remark: null,
};
this.resetForm("form");

@ -326,7 +326,7 @@ export default {
momentKind: null,
momentTitle: null,
momentContent: null,
status: null,
status: "0",
remark: null,
};
this.resetForm("form");

@ -1,30 +1,567 @@
<template>
<my-page :left-style="{width: '50%'}">
<template slot="left">
<OrderUser ref="oderUser" :extraHeight="100" style="height: 97%;" @row-click="handleRowClick"></OrderUser>
</template>
<DfOrder ref="dfOrder" :extraHeight="100" style="height: 97%;margin-left: 8px;" :rowData="rowData"></DfOrder>
</my-page>
</template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="95px">
<el-form-item label="订单号" prop="orderNo">
<el-input
v-model="queryParams.orderNo"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择客户" clearable>
<el-option
v-for="item in lsUser"
:key="item.userId"
:label="item.userName"
:value="item.userId"
/>
</el-select>
</el-form-item>
<el-form-item label="代理商名称" prop="brokerId">
<treeselect v-model="queryParams.brokerId" :options="brokerOptions" props="lable" :show-count="true" style="width: 200px"
:defaultExpandLevel="Infinity"
placeholder="选择代理商名称" :normalizer="tenantIdnormalizer" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="提交时间">
<el-date-picker
v-model="dateRange"
style="width: 210px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<!-- <el-form-item label="放款利率" prop="loanRate">-->
<!-- <el-input-->
<!-- v-model="queryParams.loanRate"-->
<!-- placeholder="请输入放款利率"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="贷款期限" prop="loadMonth">-->
<!-- <el-input-->
<!-- v-model="queryParams.loadMonth"-->
<!-- placeholder="请输入贷款期限"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="是否首贷" prop="isFirst">-->
<!-- <el-select v-model="queryParams.isFirst" placeholder="请选择是否首贷" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in lsIsFirst"-->
<!-- :key="dict.id"-->
<!-- :label="dict.name"-->
<!-- :value="dict.id"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="状态" prop="staus">
<el-select v-model="queryParams.staus" placeholder="请选择状态" clearable>
<el-option
v-for="dict in lsStatus"
:key="dict.id"
:label="dict.name"
:value="dict.id"
@keyup.enter.native="handleQuery"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['order:order:add']"-->
<!-- >新增-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['order:order:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['order:order:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['order:order:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="orderList" @sort-change="handleSortChange"
row-key="id"
>
<el-table-column type="selection" width="55" align="center"/>
<!-- <el-table-column label="id" align="center" prop="id" sortable='custom' />-->
<el-table-column label="订单号" align="center" prop="orderNo" sortable='custom' width="90px"/>
<el-table-column label="客户" align="center" prop="userName"/>
<el-table-column label="代理商" align="center" prop="brokerName" width="90px"/>
<el-table-column label="产品名称" align="center" prop="productName" sortable='custom' width="100px"/>
<el-table-column label="提交时间" align="center" prop="submitTime" width="180" sortable='custom'>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.submitTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="申请额" align="center" prop="applyAmount" sortable='custom' width="90px"/>
<el-table-column label="授信额" align="center" prop="limitAmount" sortable='custom' width="90px"/>
<el-table-column label="放款额" align="center" prop="loanAmount" sortable='custom' width="90px"/>
<el-table-column label="放款利率" align="center" prop="loanRate" sortable='custom' width="100px"/>
<el-table-column label="贷款期限" align="center" prop="loadMonth" sortable='custom' width="100px"/>
<el-table-column label="首贷" align="center" prop="isFirst" sortable='custom'/>
<el-table-column label="可结算金额" align="center" prop="settleAmount" sortable='custom' width="120px"/>
<el-table-column label="状态" align="center" prop="staus" sortable='custom'>
<template slot-scope="scope">
<el-tag v-if="scope.row.staus == '0'" type="warning"></el-tag>
<el-tag v-if="scope.row.staus == '1'" type="success"></el-tag>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" sortable='custom'/>
</el-table>
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="订单号" prop="orderNo">
<BillNumberInput v-model="form.orderNo" title="订单编号"></BillNumberInput>
<!-- <el-input v-model="form.orderNo" placeholder="请输入订单号"/>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户" prop="userId">
<el-select style="width: 100%;" v-model="form.userId" placeholder="请选择客户" clearable>
<el-option v-for="info in lsUser" :key="info.userId" :label="info.userName"
:value="info.userId"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="代理商" prop="brokerId">
<treeselect v-model="form.brokerId" :options="brokerOptions" props="lable" :show-count="true"
:defaultExpandLevel="Infinity"
placeholder="选择上级代理商" :normalizer="tenantIdnormalizer"/>
<!-- <el-input v-model="form.brokerId" placeholder="请输入代理商"/>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产品" prop="productId">
<el-select style="width: 100%;" v-model="form.productId" placeholder="请选择产品" clearable>
<el-option v-for="info in lsProduct" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
<!-- <el-input v-model="form.productId" placeholder="请输入产品id"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="产品名称" prop="productName">-->
<!-- <el-input v-model="form.productName" placeholder="请输入产品名称" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="提交时间" prop="submitTime">
<el-date-picker clearable
style="width: 100%"
v-model="form.submitTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择提交时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请额(万元)" prop="applyAmount">
<el-input-number v-model="form.applyAmount" placeholder="请输入申请额" :min="0" style="width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="授信额(万元)" prop="limitAmount">
<el-input-number v-model="form.limitAmount" placeholder="请输入授信额" :min="0" style="width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="放款额(万元)" prop="loanAmount">
<el-input-number v-model="form.loanAmount" placeholder="请输入放款额" :min="0" style="width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="放款利率" prop="loanRate">
<el-input-number v-model="form.loanRate" placeholder="请输入放款利率" :min="0" style="width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="贷款期限(月)" prop="loadMonth">
<el-input-number v-model="form.loadMonth" placeholder="请输入贷款期限" :min="0" style="width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否首贷" prop="isFirst">
<el-select style="width: 100%;" v-model="form.isFirst" placeholder="请选择是否首贷" clearable>
<el-option v-for="info in lsIsFirst" :key="info.id" :label="info.name"
:value="info.id"/>
</el-select>
<!-- <el-input v-model="form.isFirst" placeholder="请输入是否首贷"/>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="可结算金额(万元)" prop="settleAmount">
<el-input-number v-model="form.settleAmount" placeholder="请输入可结算金额" :min="0" style="width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="状态" prop="staus">
<el-select style="width: 100%;" v-model="form.staus" placeholder="请选择状态" clearable>
<el-option v-for="info in lsStatus" :key="info.id" :label="info.name"
:value="info.id"/>
</el-select>
<!-- <el-input v-model="form.staus" placeholder="请输入状态"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import OrderUser from './components/OrderUser.vue';
import DfOrder from './components/DfOrder.vue';
import {pageListOrder, getOrder, delOrder, addOrder, updateOrder} from "@/api/order/order";
import {
listUserByType,
} from "@/api/system/user";
import {
listBrokerByTree
} from "@/api/broker/broker";
import {pageListInfo, getInfo, delInfo, addInfo, updateInfo, changeStatus, listInfo} from "@/api/product/info";
import AutoTableHeight from '@/views/broker/AutoTableHeight';
import {changeUserStatus} from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Order",
components: {
OrderUser,
DfOrder,
},
mixins: [AutoTableHeight],
dicts: ["df_broker_staus", "sys_yes_no"],
components: {Treeselect},
data() {
return {
rowData: null
//
dateRange: [],
userId: "",
lsStatus: [
{id: '0', name: "未完成"},
{id: '1', name: "已完成"},
],
lsIsFirst: [
{id: '1', name: "是"},
{id: '0', name: "否"}
],
lsProduct: [],
brokerOptions: [],
lsUser: [],
//
loading: true,
//
ids: [],
//
names: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
orderList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
orderNo: null,
userId: null,
brokerId: null,
productId: null,
productName: null,
submitTime: null,
applyAmount: null,
limitAmount: null,
loanAmount: null,
loanRate: null,
loadMonth: null,
isFirst: null,
settleAmount: null,
staus: null,
submitTimeBegin: null,
submitTimeEnd: null,
},
//
form: {},
//
rules: {
orderNo: [
{required: true, message: "订单号不能为空", trigger: "blur"}
],
userId: [
{required: true, message: "客户不能为空", trigger: "blur"}
],
brokerId: [
{required: true, message: "代理商不能为空", trigger: "blur"}
],
productId: [
{required: true, message: "产品不能为空", trigger: "blur"}
],
// productName: [
// {required: true, message: "", trigger: "blur"}
// ],
submitTime: [
{required: true, message: "提交时间不能为空", trigger: "blur"}
],
staus: [
{required: true, message: "状态不能为空", trigger: "blur"}
],
}
};
},
created() {
this.getList();
this.getUser();
this.getBroker();
this.getProuct();
},
methods: {
handleRowClick(row) {
this.rowData = row;// row
getProuct() {
listInfo().then(response => {
this.lsProduct = response.data;
});
},
tenantIdnormalizer(node, instanceId) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.id,
label: node.brokerName,
children: node.children
}
},
getBroker() {
listBrokerByTree().then(response => {
this.brokerOptions = response.data;
});
},
getUser() {
var params = {
userType: "kh",
selectAll: "1"
}
listUserByType(params).then(response => {
this.lsUser = response.rows;
});
},
/** 查询客户订单列表 */
getList() {
this.loading = true;
this.queryParams.submitTimeBegin = this.dateRange[0];
this.queryParams.submitTimeEnd = this.dateRange[1];
pageListOrder(this.queryParams).then(response => {
this.orderList = response.rows;
this.total = response.total;
this.loading = false;
}).catch(e => {
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
orderNo: null,
userId: null,
brokerId: null,
productId: null,
productName: null,
submitTime: null,
applyAmount: null,
limitAmount: null,
loanAmount: null,
loanRate: null,
loadMonth: null,
isFirst: null,
settleAmount: null,
staus: null,
remark: null,
};
this.resetForm("form");
},
//
handleSortChange(col) {
this.$sortBy(col, this.queryParams);
this.getList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.names = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.form.submitTime = new Date();
this.form.staus = '0';
this.title = "添加客户订单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getOrder(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改客户订单";
});
},
/** 提交按钮 */
submitForm() {
var productId = this.form.productId;
var product = this.lsProduct.find(function (item) {
return item.id === productId;
});
this.form.productName = product ? product.productName : null;
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
const names = row.id || this.names;
this.$modal.confirm('是否确认删除客户订单为"' + names + '"的数据项?').then(function () {
return delOrder(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('order/order/export', {
...this.queryParams
}, `客户订单_${new Date().getTime()}.xlsx`)
}
}
};

@ -133,7 +133,7 @@
<dict-tag :options="dict.type.poster_tag" :value="scope.row.posterTag"/>
</template>
</el-table-column>
<!-- <el-table-column label="海报图片" align="center" prop="posterFileId" sortable='custom'/>-->
<!-- <el-table-column label="海报图片" align="center" prop="posterFileId" sortable='custom'/>-->
<el-table-column label="状态" align="center" prop="status" sortable='custom'>
<template slot-scope="scope">
<dict-tag :options="dict.type.product_status" :value="scope.row.status"/>
@ -199,7 +199,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="海报标签" prop="posterTag">
<el-select style="width: 100%;" v-model="form.posterTag" placeholder="选择海报标签" filterable clearable multiple>
<el-select style="width: 100%;" v-model="form.posterTag" placeholder="选择海报标签" filterable clearable
multiple>
<el-option v-for="dict in dict.type.poster_tag" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
@ -207,11 +208,11 @@
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="海报图片" prop="posterFileId">-->
<!-- <el-input v-model="form.posterFileId" placeholder="请输入海报图片"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="海报图片" prop="posterFileId">-->
<!-- <el-input v-model="form.posterFileId" placeholder="请输入海报图片"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-select style="width: 100%;" v-model="form.status" placeholder="选择状态" clearable>
@ -228,6 +229,13 @@
</el-form-item>
</el-col>
</el-row>
<el-form-item label="上传" prop="field">
<el-form :model="form">
<PictureUpload :biz-id="form.id" ></PictureUpload>
</el-form>
<!-- <BannerUpload v-show="form.id" :bannerId="form.id" :businessUnits="'海报信息'" :maxLength="1">-->
<!-- </BannerUpload>-->
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -238,14 +246,24 @@
</template>
<script>
import {pageListPoster, getPoster, delPoster, addPoster, updatePoster,changeStatusByPoster} from "@/api/poster/poster";
import {pageListPoster, getPoster, delPoster, addPoster, updatePoster, changeStatusByPoster} from "@/api/poster/poster";
import {changeStatus, listInfo} from "@/api/product/info";
import {uploadFiles, getAttachList} from "@/api/common/file";
import {getToken} from "@/utils/auth";
export default {
name: "Poster",
dicts: ["product_status", "product_classify","poster_tag"],
dicts: ["product_status", "product_classify", "poster_tag"],
data() {
return {
headers: {
Authorization: "Bearer " + getToken(),
},
formData: {
field101: null,
},
field101Action: process.env.VUE_APP_BASE_API + '/common/uploads',
fileList: [],
//
lsInfo: [],
//
@ -312,7 +330,7 @@ export default {
this.getInfoList();
},
methods: {
offShelves(){
offShelves() {
const ids = this.ids;
let param = {
ids: ids,
@ -323,7 +341,7 @@ export default {
this.$modal.msgSuccess("修改成功");
});
},
shelves(){
shelves() {
const ids = this.ids;
let param = {
ids: ids,
@ -364,7 +382,7 @@ export default {
posterName: null,
posterTag: null,
posterFileId: null,
status: null,
status: "0",
remark: null,
};
this.resetForm("form");
@ -406,6 +424,9 @@ export default {
if (this.form.posterTag) {
this.form.posterTag = this.form.posterTag.split(',');
}
getAttachList(this.form.id).then(response => {
this.fileList = response.data;
});
this.open = true;
this.title = "修改产品海报";
});
@ -454,3 +475,9 @@ export default {
}
};
</script>
<style>
.el-upload__tip {
line-height: 1.2;
}
</style>

@ -569,7 +569,6 @@ export default {
let businessCities = this.form.businessCity.split(',');
businessCities.forEach(cityId => {
let matchedCity = this.cityList.find(city => city.areaId == cityId);
console.log(matchedCity);
if (matchedCity) {
selectedCities.push({
areaId: matchedCity.areaId,
@ -591,7 +590,6 @@ export default {
this.$message.warning('该城市已经添加过了!');
} else {
this.selectedCities.push(city);
this.$message.success('成功添加城市!');
}
},
isCitySelected(city) {
@ -670,7 +668,7 @@ export default {
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
status: "0",
remark: null,
maxAmountBegin: null,
maxAmountEnd: null,

Loading…
Cancel
Save