Merge branch 'master' of gitee.com:darlk/ShengTangManage into xzj
This commit is contained in:
commit
615286a1ae
@ -2,7 +2,9 @@ package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.redis.RedisCache;
|
||||
import com.stdiet.custom.service.ISysWxService;
|
||||
import com.stdiet.custom.utils.WxTokenUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -15,6 +17,9 @@ public class CusWxController extends BaseController {
|
||||
@Autowired
|
||||
public ISysWxService sysWxService;
|
||||
|
||||
@Autowired
|
||||
public RedisCache redisCache;
|
||||
|
||||
@GetMapping("/checkSign")
|
||||
public String wxCheckAuth(@RequestParam String signature, @RequestParam String timestamp, @RequestParam String nonce, @RequestParam String echostr) {
|
||||
return sysWxService.wxCheckAuth(signature, timestamp, nonce, echostr);
|
||||
@ -30,4 +35,9 @@ public class CusWxController extends BaseController {
|
||||
return sysWxService.getAccessToken();
|
||||
}
|
||||
|
||||
@GetMapping("/clearAccessToken")
|
||||
public AjaxResult clearAccessToken() {
|
||||
redisCache.deleteObject(WxTokenUtils.KEY_ACCESS_TOKEN);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@ -11,6 +12,7 @@ import java.math.BigDecimal;
|
||||
* @author wonder
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
@Data
|
||||
public class SysDishesIngredient extends SysIngredient {
|
||||
|
||||
private Long ingredientId;
|
||||
@ -21,68 +23,10 @@ public class SysDishesIngredient extends SysIngredient {
|
||||
|
||||
private BigDecimal cusWeight;
|
||||
|
||||
private Integer cusWei;
|
||||
|
||||
private BigDecimal weight;
|
||||
|
||||
private String remark;
|
||||
|
||||
@Override
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public Long getIngredientId() {
|
||||
return ingredientId;
|
||||
}
|
||||
|
||||
public void setIngredientId(Long ingredientId) {
|
||||
this.ingredientId = ingredientId;
|
||||
}
|
||||
|
||||
public Long getDishesId() {
|
||||
return dishesId;
|
||||
}
|
||||
|
||||
public void setDishesId(Long dishesId) {
|
||||
this.dishesId = dishesId;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getCusWeight() {
|
||||
return cusWeight;
|
||||
}
|
||||
|
||||
public void setCusWeight(BigDecimal cusWeight) {
|
||||
this.cusWeight = cusWeight;
|
||||
}
|
||||
|
||||
public Long getCusUnit() {
|
||||
return cusUnit;
|
||||
}
|
||||
|
||||
public void setCusUnit(Long cusUnit) {
|
||||
this.cusUnit = cusUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("ingredientId", getIngredientId())
|
||||
.append("dishesId", getDishesId())
|
||||
.append("weight", getWeight())
|
||||
.append("cusWeight", getCusWeight())
|
||||
.append("cusUnit", getCusUnit())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.stdiet.custom.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.stdiet.common.core.redis.RedisCache;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.http.HttpUtils;
|
||||
import com.stdiet.custom.domain.WxXmlData;
|
||||
@ -9,28 +8,30 @@ import com.stdiet.custom.domain.wechat.WxAccessToken;
|
||||
import com.stdiet.custom.domain.wechat.WxFileUploadResult;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class WxTokenUtils {
|
||||
|
||||
public static final String KEY_ACCESS_TOKEN="wx:access_token";
|
||||
public static final String KEY_ACCESS_TOKEN_WATHER="wx:access_token_watcher";
|
||||
public static final String KEY_ACCESS_TOKEN = "wx:access_token";
|
||||
public static final String KEY_ACCESS_TOKEN_WATHER = "wx:access_token_watcher";
|
||||
|
||||
// 与接口配置信息中的Token要一致
|
||||
private static String token = "shengtangdiet";
|
||||
// private static String appId = "wx4a9c1fc9dba53202";
|
||||
// private static String appSecret = "fff029ade5d3575df755f4cf9e52f8da";
|
||||
private static String appId = "wxaf10fe560ea043a0";
|
||||
private static String appSecret = "afb47e477337df23b7562c3c1f965826";
|
||||
// 胜唐体控
|
||||
private static String appId = "wx4a9c1fc9dba53202";
|
||||
private static String appSecret = "fff029ade5d3575df755f4cf9e52f8da";
|
||||
// 胜唐体控李晓
|
||||
// private static String appId = "wxaf10fe560ea043a0";
|
||||
// private static String appSecret = "afb47e477337df23b7562c3c1f965826";
|
||||
private static String tokenUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
private static String uploadMaterialUrl = "https://api.weixin.qq.com/cgi-bin/material/add_material";
|
||||
|
||||
private static String uploadMaterialUrl = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=image";
|
||||
|
||||
|
||||
public static WxAccessToken fetchAccessToken() {
|
||||
@ -48,18 +49,28 @@ public class WxTokenUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static WxFileUploadResult uploadImage(String filePath, String accessToken) {
|
||||
try {
|
||||
String url = uploadMaterialUrl + "?access_token" + accessToken + "&type=image";
|
||||
HttpPostUtil post = new HttpPostUtil(url);
|
||||
post.addParameter("media", new File(filePath));
|
||||
String resultStr = post.send();
|
||||
JSONObject obj = JSONObject.parseObject(resultStr);
|
||||
WxFileUploadResult result = JSONObject.toJavaObject(obj, WxFileUploadResult.class);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
/**
|
||||
* 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
|
||||
*
|
||||
* @return String url的响应信息返回值
|
||||
* @throws IOException
|
||||
*/
|
||||
public static WxFileUploadResult uploadImage(String filePath, String fileName, String accessToken) throws Exception {
|
||||
String[] cmds = {"curl", uploadMaterialUrl.replaceAll("ACCESS_TOKEN", accessToken), "-F"
|
||||
, "media=@" + filePath + ";filename=" + fileName};//必须分开写,不能有空格
|
||||
|
||||
ProcessBuilder process = new ProcessBuilder(cmds);
|
||||
Process p = process.start();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
builder.append(System.getProperty("line.separator"));
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(builder.toString());
|
||||
return JSONObject.toJavaObject(obj, WxFileUploadResult.class);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,6 +28,7 @@
|
||||
<result property="rec" column="rec" />
|
||||
<result property="notRec" column="not_rec" />
|
||||
<result property="cusWeight" column="cus_weight" />
|
||||
<result property="cusWei" column="cus_wei" />
|
||||
<result property="cusUnit" column="cus_unit" />
|
||||
<result property="weight" column="weight" />
|
||||
</resultMap>
|
||||
@ -48,7 +49,7 @@
|
||||
|
||||
<sql id="selectSysIngreditentsByIdVo">
|
||||
SELECT * FROM(
|
||||
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit, remark
|
||||
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_wei, cus_unit, remark
|
||||
FROM sys_dishes_ingredient
|
||||
WHERE dishes_id = #{id}
|
||||
) dishes
|
||||
@ -148,9 +149,9 @@
|
||||
</delete>
|
||||
|
||||
<insert id="bashInsertDishesIngredent">
|
||||
insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_weight, remark) values
|
||||
insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_wei, remark) values
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWeight}, #{item.remark})
|
||||
(#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWei}, #{item.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
@ -103,8 +103,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/custom/wxUserLog/wx/**",
|
||||
"/wx/**",
|
||||
"/investigate/**",
|
||||
"/common/customerUploadFile",
|
||||
"/custom/WxAccount/upload"
|
||||
"/common/customerUploadFile"
|
||||
).anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
|
@ -130,14 +130,14 @@ export default {
|
||||
this.orderList = res.rows.reduce((arr, cur) => {
|
||||
const tarOrder = arr.find((ord) => ord.startTime === cur.startTime);
|
||||
if (tarOrder) {
|
||||
const firstObj = JSON.parse(JSON.stringify(tarOrder));
|
||||
tarOrder.children = [
|
||||
{ ...firstObj, orderType: "main" },
|
||||
{ ...cur, orderType: "main" },
|
||||
];
|
||||
if (!tarOrder.children) {
|
||||
const firstObj = JSON.parse(JSON.stringify(tarOrder));
|
||||
tarOrder.children = [{ ...firstObj, orderType: "main" }];
|
||||
}
|
||||
tarOrder.amount += cur.amount;
|
||||
tarOrder.orderId += cur.orderId;
|
||||
tarOrder.orderType = "virtual";
|
||||
tarOrder.children.push({ ...cur, orderType: "main" });
|
||||
} else {
|
||||
cur.orderType = "main";
|
||||
arr.push(cur);
|
||||
|
@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="账号名称" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nickName"
|
||||
@ -11,7 +17,12 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号id" prop="accountId">
|
||||
<el-select v-model="queryParams.accountId" placeholder="请选择账号id" clearable size="small">
|
||||
<el-select
|
||||
v-model="queryParams.accountId"
|
||||
placeholder="请选择账号id"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in accountIdOptions"
|
||||
:key="dict.dictValue"
|
||||
@ -30,8 +41,16 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button
|
||||
type="cyan"
|
||||
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>
|
||||
|
||||
@ -43,7 +62,7 @@
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['custom:WxAccount:add']"
|
||||
>新增
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -54,7 +73,7 @@
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['custom:WxAccount:edit']"
|
||||
>修改
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -65,7 +84,7 @@
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['custom:WxAccount:remove']"
|
||||
>删除
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -75,24 +94,40 @@
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['custom:WxAccount:export']"
|
||||
>导出
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="WxAccountList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="手机号" align="center" prop="id"/>
|
||||
<el-table-column label="账号名称" align="center" prop="nickName"/>
|
||||
<el-table-column label="账号id" align="center" prop="accountId" :formatter="accountIdFormat"/>
|
||||
<el-table-column label="微信号" align="center" prop="wxId"/>
|
||||
<el-table-column label="手机号" align="center" prop="phone"/>
|
||||
<el-table-column label="手机号" align="center" prop="remark"/>
|
||||
<el-table-column label="二维码图片" align="center" prop="imgUrl"/>
|
||||
<el-table-column label="使用次数" align="center" prop="count"/>
|
||||
<el-table-column label="微信资源id" align="center" prop="mediaId"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="WxAccountList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="手机号" align="center" prop="id" />
|
||||
<el-table-column label="账号名称" align="center" prop="nickName" />
|
||||
<el-table-column
|
||||
label="账号id"
|
||||
align="center"
|
||||
prop="accountId"
|
||||
:formatter="accountIdFormat"
|
||||
/>
|
||||
<el-table-column label="微信号" align="center" prop="wxId" />
|
||||
<el-table-column label="手机号" align="center" prop="phone" />
|
||||
<el-table-column label="手机号" align="center" prop="remark" />
|
||||
<el-table-column label="二维码图片" align="center" prop="imgUrl" />
|
||||
<el-table-column label="使用次数" align="center" prop="count" />
|
||||
<el-table-column label="微信资源id" align="center" prop="mediaId" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@ -100,7 +135,7 @@
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['custom:WxAccount:edit']"
|
||||
>修改
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
@ -108,14 +143,14 @@
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['custom:WxAccount:remove']"
|
||||
>删除
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@ -123,10 +158,16 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改微信销售账号对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="open"
|
||||
:close-on-click-modal="false"
|
||||
width="500px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
||||
<el-form-item label="账号昵称" prop="nickName">
|
||||
<el-input v-model="form.nickName" placeholder="请输入账号名称"/>
|
||||
<el-input v-model="form.nickName" placeholder="请输入账号名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="账号id" prop="accountId">
|
||||
<el-select v-model="form.accountId" placeholder="请选择账号id">
|
||||
@ -139,35 +180,45 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信号" prop="wxId">
|
||||
<el-input v-model="form.wxId" placeholder="请输入微信号"/>
|
||||
<el-input v-model="form.wxId" placeholder="请输入微信号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号"/>
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="二维码图片" prop="imgUrl">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:class="`upload-demo ${
|
||||
upload.fileList.length ? 'has-file' : ''
|
||||
}`"
|
||||
ref="upload"
|
||||
drag
|
||||
:action="upload.url"
|
||||
:limit="upload.limit"
|
||||
:headers="upload.headers"
|
||||
:disabled="upload.isUploading"
|
||||
:file-list="upload.fileList"
|
||||
:multiple="upload.multiple"
|
||||
:on-change="handleFileChange"
|
||||
:on-remove="handleFileRemove"
|
||||
:on-exceed="handleFileexceed"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:on-error="handleFileFail"
|
||||
:data="upload.data"
|
||||
:auto-upload="true">
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
:auto-upload="true"
|
||||
list-type="picture"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或<em>点击上传</em>
|
||||
</div>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
只能上传jpg/png文件,且不超过500kb
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@ -179,244 +230,267 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addWxAccount,
|
||||
delWxAccount,
|
||||
exportWxAccount,
|
||||
getWxAccount,
|
||||
listWxAccount,
|
||||
updateWxAccount
|
||||
} from "@/api/custom/WxAccount";
|
||||
import {
|
||||
addWxAccount,
|
||||
delWxAccount,
|
||||
exportWxAccount,
|
||||
getWxAccount,
|
||||
listWxAccount,
|
||||
updateWxAccount,
|
||||
} from "@/api/custom/WxAccount";
|
||||
|
||||
export default {
|
||||
name: "WxAccount",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 微信销售账号表格数据
|
||||
WxAccountList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 账号id字典
|
||||
accountIdOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
nickName: null,
|
||||
accountId: null,
|
||||
phone: null,
|
||||
},
|
||||
upload: {
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/custom/WxAccount/upload",
|
||||
// 设置上传的请求头部
|
||||
headers: {
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
},
|
||||
// 其他需要携带的数据
|
||||
data: {},
|
||||
//文件列表
|
||||
fileList: [],
|
||||
//同时上传文件上限
|
||||
limit: 1,
|
||||
//每个文件大小
|
||||
fileSize: 1024 * 500,
|
||||
//是否支持同时选择多张
|
||||
multiple: false
|
||||
export default {
|
||||
name: "WxAccount",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 微信销售账号表格数据
|
||||
WxAccountList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 账号id字典
|
||||
accountIdOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
nickName: null,
|
||||
accountId: null,
|
||||
phone: null,
|
||||
},
|
||||
upload: {
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/custom/WxAccount/upload",
|
||||
// 设置上传的请求头部
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDicts("cus_account").then(response => {
|
||||
this.accountIdOptions = response.data;
|
||||
// 其他需要携带的数据
|
||||
data: {},
|
||||
//文件列表
|
||||
fileList: [],
|
||||
//同时上传文件上限
|
||||
limit: 1,
|
||||
//每个文件大小
|
||||
fileSize: 1024 * 500,
|
||||
//是否支持同时选择多张
|
||||
multiple: false,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDicts("cus_account").then((response) => {
|
||||
this.accountIdOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询微信销售账号列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listWxAccount(this.queryParams).then((response) => {
|
||||
this.WxAccountList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询微信销售账号列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listWxAccount(this.queryParams).then(response => {
|
||||
this.WxAccountList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 账号id字典翻译
|
||||
accountIdFormat(row, column) {
|
||||
return this.selectDictLabel(this.accountIdOptions, row.accountId);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
nickName: null,
|
||||
accountId: null,
|
||||
wxId: null,
|
||||
phone: null,
|
||||
remark: null,
|
||||
imgUrl: null,
|
||||
count: null,
|
||||
mediaId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
// 账号id字典翻译
|
||||
accountIdFormat(row, column) {
|
||||
return this.selectDictLabel(this.accountIdOptions, row.accountId);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
nickName: null,
|
||||
accountId: null,
|
||||
wxId: null,
|
||||
phone: null,
|
||||
remark: null,
|
||||
imgUrl: null,
|
||||
count: null,
|
||||
mediaId: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加微信销售账号";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getWxAccount(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "添加微信销售账号";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getWxAccount(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改微信销售账号";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateWxAccount(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addWxAccount(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.title = "修改微信销售账号";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateWxAccount(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addWxAccount(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除微信销售账号编号为"' + ids + '"的数据项?', "警告", {
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm(
|
||||
'是否确认删除微信销售账号编号为"' + ids + '"的数据项?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function () {
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(function () {
|
||||
return delWxAccount(ids);
|
||||
}).then(() => {
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function () {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有微信销售账号数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function () {
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm("是否确认导出所有微信销售账号数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return exportWxAccount(queryParams);
|
||||
}).then(response => {
|
||||
})
|
||||
.then((response) => {
|
||||
this.download(response.msg);
|
||||
}).catch(function () {
|
||||
});
|
||||
},
|
||||
//监控上传文件列表
|
||||
handleFileChange(file, fileList) {
|
||||
let sizeFlag = file.size > this.upload.fileSize;
|
||||
if (sizeFlag) {
|
||||
this.$message({
|
||||
message: "当前文件过大",
|
||||
type: "warning",
|
||||
});
|
||||
fileList.pop();
|
||||
}
|
||||
this.upload.fileList = fileList;
|
||||
|
||||
},
|
||||
// 文件数量超过限度
|
||||
handleFileexceed(file, fileList) {
|
||||
//console.log(this.upload.fileList.length);
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
//监控上传文件列表
|
||||
handleFileChange(file, fileList) {
|
||||
let sizeFlag = file.size > this.upload.fileSize;
|
||||
if (sizeFlag) {
|
||||
this.$message({
|
||||
message: "最多可上传" + this.upload.limit + "份文件",
|
||||
message: "当前文件过大",
|
||||
type: "warning",
|
||||
});
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
if (response != null && response.code === 200) {
|
||||
this.form.imgUrl = response.fileName;
|
||||
console.log(response)
|
||||
} else {
|
||||
this.fail();
|
||||
this.$message.error(response.msg);
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList) {
|
||||
if (err) {
|
||||
this.$message.error('文件上传失败,请检查文件格式');
|
||||
this.fail();
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
this.submitFlag = false;
|
||||
this.upload.isUploading = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
fileList.pop();
|
||||
}
|
||||
this.upload.fileList = fileList;
|
||||
},
|
||||
handleFileRemove(file, fileList) {
|
||||
this.upload.fileList = fileList;
|
||||
},
|
||||
// 文件数量超过限度
|
||||
handleFileexceed(file, fileList) {
|
||||
//console.log(this.upload.fileList.length);
|
||||
this.$message({
|
||||
message: "最多可上传" + this.upload.limit + "份文件",
|
||||
type: "warning",
|
||||
});
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
if (response != null && response.code === 200) {
|
||||
this.form.imgUrl = response.fileName;
|
||||
console.log(response);
|
||||
} else {
|
||||
this.fail();
|
||||
this.$message.error(response.msg);
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList) {
|
||||
if (err) {
|
||||
this.$message.error("文件上传失败,请检查文件格式");
|
||||
this.fail();
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
this.submitFlag = false;
|
||||
this.upload.isUploading = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.has-file .el-upload--picture {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.has-file .el-upload__tip {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -111,7 +111,7 @@
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="160"
|
||||
width="166"
|
||||
/>
|
||||
<el-table-column
|
||||
label="进粉时间"
|
||||
|
@ -251,13 +251,21 @@
|
||||
<el-table-column label="通俗计量">
|
||||
<template slot-scope="scope">
|
||||
<span class="cus-unit">
|
||||
<el-input-number
|
||||
<!-- <el-input-number
|
||||
v-model="scope.row.cusWeight"
|
||||
size="mini"
|
||||
controls-position="right"
|
||||
step="0.5"
|
||||
:min="0.5"
|
||||
/>
|
||||
/> -->
|
||||
<el-select size="mini" v-model="scope.row.cusWei">
|
||||
<el-option
|
||||
v-for="dict in cusWeightOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select size="mini" v-model="scope.row.cusUnit">
|
||||
<el-option
|
||||
v-for="dict in cusUnitOptions"
|
||||
@ -414,6 +422,8 @@ export default {
|
||||
typeOptions: [],
|
||||
// 通俗单位
|
||||
cusUnitOptions: [],
|
||||
//
|
||||
cusWeightOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -437,6 +447,9 @@ export default {
|
||||
});
|
||||
this.getDicts("cus_cus_unit").then((response) => {
|
||||
this.cusUnitOptions = response.data;
|
||||
});
|
||||
this.getDicts("cus_cus_weight").then((response) => {
|
||||
this.cusWeightOptions = response.data;
|
||||
});
|
||||
this.getDicts("cus_review_status").then((response) => {
|
||||
this.reviewStatusOptions = response.data;
|
||||
@ -488,6 +501,9 @@ export default {
|
||||
cusUnitFormat(row, column) {
|
||||
return this.selectDictLabel(this.cusUnitOptions, row.type);
|
||||
},
|
||||
cusWeightFormat(row, column) {
|
||||
return this.selectDictLabel(this.cusWeightOptions, row.cusWei);
|
||||
},
|
||||
// 地域字典翻译
|
||||
reviewStatusFormat(row, column) {
|
||||
return this.selectDictLabel(this.reviewStatusOptions, row.area);
|
||||
@ -670,7 +686,7 @@ export default {
|
||||
newTableData.push({
|
||||
...tmpTableObj,
|
||||
weight: 100,
|
||||
cusWeight: 1,
|
||||
cusWei: 1,
|
||||
cusUnit: 1,
|
||||
});
|
||||
}
|
||||
@ -784,7 +800,8 @@ export default {
|
||||
|
||||
.cus-unit .el-select .el-input__inner {
|
||||
padding: 0 4px;
|
||||
border: unset;
|
||||
/* border: unset; */
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.weight {
|
||||
|
Loading…
x
Reference in New Issue
Block a user