This commit is contained in:
xiezhijun
2021-03-18 16:12:08 +08:00
7 changed files with 83 additions and 50 deletions

View File

@ -42,6 +42,7 @@ public class SysFileUploadController extends BaseController {
if (StringUtils.isNotEmpty(fileUrl)) { if (StringUtils.isNotEmpty(fileUrl)) {
ajax = AjaxResult.success(); ajax = AjaxResult.success();
ajax.put("fileUrl", fileUrl); ajax.put("fileUrl", fileUrl);
ajax.put("previewUrl", AliyunOSSUtils.generatePresignedUrl(fileUrl));
ajax.put("fileName", file.getOriginalFilename()); ajax.put("fileName", file.getOriginalFilename());
} else { } else {
ajax = AjaxResult.error("文件上传失败"); ajax = AjaxResult.error("文件上传失败");

View File

@ -3,6 +3,7 @@ package com.stdiet.common.utils.oss;
import com.aliyun.oss.model.GetObjectRequest; import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.OSSObject; import com.aliyun.oss.model.OSSObject;
import com.stdiet.common.config.AliyunOSSConfig; import com.stdiet.common.config.AliyunOSSConfig;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.file.FileUtils; import com.stdiet.common.utils.file.FileUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -233,6 +234,9 @@ public class AliyunOSSUtils {
* @return * @return
*/ */
public static String generatePresignedUrl(String fileUrl){ public static String generatePresignedUrl(String fileUrl){
if(StringUtils.isEmpty(fileUrl)) {
return null;
}
// 创建OSSClient实例。 // 创建OSSClient实例。
OSS ossClient = getOssClient(); OSS ossClient = getOssClient();

View File

@ -35,8 +35,15 @@
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult"> <select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/> <include refid="selectSysCustomerVo"/>
where del_flag = 0 where del_flag = 0
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%') or phone like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if> <if test="mainDietitian != null and mainDietitian != ''"> and main_dietitian = #{mainDietitian}</if>
<if test="mainDietitian == 0"> and isnull(main_dietitian) or main_dietitian=0</if>
<if test="salesman != null and salesman != ''"> and salesman = #{salesman}</if>
<if test="salesman == 0"> and isnull(salesman) or salesman=0</if>
<if test="afterDietitian != null and afterDietitian != ''"> and after_dietitian = #{afterDietitian}</if>
<if test="afterDietitian == 0"> and isnull(after_dietitian) or after_dietitian=0</if>
<if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if>
<if test="assistantDietitian == 0"> and isnull(assistant_dietitian) or assistant_dietitian=0</if>
<if test="fansChannel != null "> and fans_channel = #{fansChannel}</if> <if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
order by create_time desc order by create_time desc
</select> </select>

View File

@ -21,10 +21,15 @@ export default {
if ( if (
this.value && this.value &&
typeof this.value === "string" && typeof this.value === "string" &&
this.value.includes("</br>") (this.value.includes("</br>") || this.value.includes("\n"))
) { ) {
this.newLine = true; this.newLine = true;
return this.value.split("</br>"); if (this.value.includes("</br>")) {
return this.value.split("</br>");
} else if (this.value.includes("\n")) {
return this.value.split("\n");
}
return this.value;
} }
return this.value; return this.value;
}, },

View File

@ -7,24 +7,16 @@
v-show="showSearch" v-show="showSearch"
label-width="86px" label-width="86px"
> >
<el-form-item label="名字" prop="name"> <el-form-item label="客户信息" prop="name">
<el-input <el-input
v-model.trim="queryParams.name" v-model.trim="queryParams.name"
placeholder="请输入名字" placeholder="请输入名字或手机号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model.trim="queryParams.phone"
placeholder="请输入手机号"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="进粉渠道" prop="fansChannel"> <el-form-item label="进粉渠道" prop="fansChannel">
<el-select v-model="queryParams.fansChannel" placeholder="请选择"> <el-select v-model="queryParams.fansChannel" placeholder="请选择">
<el-option <el-option
@ -35,39 +27,51 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!--<el-form-item label="营养师助理" prop="assistantDietitian"> <el-form-item label="营养师" prop="mainDietitian">
<el-input <el-select v-model="queryParams.mainDietitian" placeholder="请选择">
v-model="queryParams.assistantDietitian" <el-option
placeholder="请输入营养师助理" v-for="dict in nutritionistIdOptions"
clearable :key="dict.dictValue"
size="small" :label="dict.dictLabel"
@keyup.enter.native="handleQuery" :value="parseInt(dict.dictValue)"
/> />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="售后营养师" prop="afterDietitian"> <el-form-item label="营养师助理" prop="assistantDietitian">
<el-input <el-select
v-model="queryParams.afterDietitian" v-model="queryParams.assistantDietitian"
placeholder="请输入售后营养师" placeholder="请选择"
clearable >
size="small" <el-option
@keyup.enter.native="handleQuery" v-for="dict in nutriAssisIdOptions"
/> :key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="销售人员" prop="salesman"> <el-form-item label="销售人员" prop="salesman">
<el-input <el-select v-model="queryParams.salesman" placeholder="请选择">
v-model="queryParams.salesman" <el-option
placeholder="请输入销售人员" v-for="dict in preSaleIdOptions"
clearable :key="dict.dictValue"
size="small" :label="dict.dictLabel"
@keyup.enter.native="handleQuery" :value="parseInt(dict.dictValue)"
/> />
</el-form-item>--> </el-select>
</el-form-item>
<el-form-item label="售后营养师" prop="afterDietitian">
<el-select v-model="queryParams.afterDietitian" placeholder="请选择">
<el-option
v-for="dict in afterSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="cyan" icon="el-icon-search" @click="handleQuery"
type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button >搜索</el-button
> >
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"

View File

@ -357,7 +357,9 @@
<em class="el-icon-upload" /> <em class="el-icon-upload" />
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处<em>点击上传</em> 将文件拖到此处<em>点击上传</em>
<div style="font-size: 12px; color: #8c8c8c">最多可上传5个文件且每个文件不超过10M</div> <div style="font-size: 12px; color: #8c8c8c">
最多可上传5个文件且每个文件不超过10M
</div>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
@ -598,8 +600,18 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { const params = JSON.parse(JSON.stringify(this.form));
updateIngredient(this.form).then((response) => { params.imgList = params.imgList.reduce((arr, cur) => {
if (cur.url) {
arr.push({
url: cur.url.substring(0, cur.url.indexOf("?")),
name: cur.name,
});
}
return arr;
}, []);
if (params.id != null) {
updateIngredient(params).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -607,7 +619,7 @@ export default {
} }
}); });
} else { } else {
addIngredient(this.form).then((response) => { addIngredient(params).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -658,7 +670,7 @@ export default {
this.form.imgList = fileList.map((data) => { this.form.imgList = fileList.map((data) => {
const { name, url, response } = data; const { name, url, response } = data;
if (response) { if (response) {
return { url: response.fileUrl, name: response.fileName }; return { url: response.previewUrl, name: response.fileName };
} }
return { url, name }; return { url, name };
}); });

View File

@ -266,7 +266,7 @@ export default {
}, },
], ],
}; };
console.log(option); // console.log(option);
this.chart.setOption(option); this.chart.setOption(option);
}, },
handleOnViewChange(view) { handleOnViewChange(view) {