提交 b79693bd authored 作者: zgy's avatar zgy

一、二级分类新增图片

上级 d1b10389
...@@ -4,11 +4,11 @@ import java.io.Serializable; ...@@ -4,11 +4,11 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 实体 * 商品二级分类表实体
* 表名 tb_cf_goodstwotype * 表名 tb_cf_goodstwotype
* *
* @author lipengjun * @author lipengjun
* @date 2019-10-15 15:06:31 * @date 2020-03-05 13:29:28
*/ */
public class TbCfGoodstwotypeEntity implements Serializable { public class TbCfGoodstwotypeEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -25,6 +25,10 @@ public class TbCfGoodstwotypeEntity implements Serializable { ...@@ -25,6 +25,10 @@ public class TbCfGoodstwotypeEntity implements Serializable {
* 商品一级分类id * 商品一级分类id
*/ */
private String goodstypeId; private String goodstypeId;
/**
* 二级分类图片
*/
private String goodstwotypeUrl;
/** /**
* 设置:商品二级分类Id * 设置:商品二级分类Id
...@@ -65,4 +69,17 @@ public class TbCfGoodstwotypeEntity implements Serializable { ...@@ -65,4 +69,17 @@ public class TbCfGoodstwotypeEntity implements Serializable {
public String getGoodstypeId() { public String getGoodstypeId() {
return goodstypeId; return goodstypeId;
} }
/**
* 设置:二级分类图片
*/
public void setGoodstwotypeUrl(String goodstwotypeUrl) {
this.goodstwotypeUrl = goodstwotypeUrl;
}
/**
* 获取:二级分类图片
*/
public String getGoodstwotypeUrl() {
return goodstwotypeUrl;
}
} }
...@@ -23,6 +23,16 @@ public class GoodsTypeToGoodsTwo implements Serializable { ...@@ -23,6 +23,16 @@ public class GoodsTypeToGoodsTwo implements Serializable {
private String goodstypeTitle; private String goodstypeTitle;
private String goodstwotypeUrl;
public String getGoodstwotypeUrl() {
return goodstwotypeUrl;
}
public void setGoodstwotypeUrl(String goodstwotypeUrl) {
this.goodstwotypeUrl = goodstwotypeUrl;
}
/** /**
* 设置:商品二级分类Id * 设置:商品二级分类Id
*/ */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<result property="goodstwotypeId" column="goodstwotype_id"/> <result property="goodstwotypeId" column="goodstwotype_id"/>
<result property="goodstwotypeTitle" column="goodstwotype_title"/> <result property="goodstwotypeTitle" column="goodstwotype_title"/>
<result property="goodstypeId" column="goodstype_id"/> <result property="goodstypeId" column="goodstype_id"/>
<result property="goodstwotypeUrl" column="goodstwotype_url"/>
</resultMap> </resultMap>
<resultMap type="com.platform.entity.merge.GoodsTypeToGoodsTwo" id="GoodsToTwo"> <resultMap type="com.platform.entity.merge.GoodsTypeToGoodsTwo" id="GoodsToTwo">
...@@ -14,12 +15,14 @@ ...@@ -14,12 +15,14 @@
<result property="goodstwotypeTitle" column="goodstwotype_title"/> <result property="goodstwotypeTitle" column="goodstwotype_title"/>
<result property="goodstypeId" column="goodstype_id"/> <result property="goodstypeId" column="goodstype_id"/>
<result property="goodstypeTitle" column="goodstype_title"/> <result property="goodstypeTitle" column="goodstype_title"/>
<result property="goodstwotypeUrl" column="goodstwotype_url"/>
</resultMap> </resultMap>
<select id="queryGoodsTypeId" resultMap="GoodsToTwo"> <select id="queryGoodsTypeId" resultMap="GoodsToTwo">
SELECT SELECT
tw.`goodstwotype_id`, tw.`goodstwotype_id`,
tw.`goodstwotype_title`, tw.`goodstwotype_title`,
tw.`goodstwotype_url`,
ds.`goodstype_id`, ds.`goodstype_id`,
ds.`goodstype_title` ds.`goodstype_title`
FROM tb_cf_goodstwotype tw FROM tb_cf_goodstwotype tw
...@@ -30,6 +33,7 @@ ...@@ -30,6 +33,7 @@
select select
`goodstwotype_id`, `goodstwotype_id`,
`goodstwotype_title`, `goodstwotype_title`,
`goodstwotype_url`,
`goodstype_id` `goodstype_id`
from tb_cf_goodstwotype from tb_cf_goodstwotype
WHERE goodstype_id= #{id} WHERE goodstype_id= #{id}
...@@ -38,7 +42,8 @@ ...@@ -38,7 +42,8 @@
select select
`goodstwotype_id`, `goodstwotype_id`,
`goodstwotype_title`, `goodstwotype_title`,
`goodstype_id` `goodstype_id`,
`goodstwotype_url`
from tb_cf_goodstwotype from tb_cf_goodstwotype
where goodstwotype_id = #{id} where goodstwotype_id = #{id}
</select> </select>
...@@ -47,6 +52,7 @@ ...@@ -47,6 +52,7 @@
SELECT SELECT
tw.`goodstwotype_id`, tw.`goodstwotype_id`,
tw.`goodstwotype_title`, tw.`goodstwotype_title`,
tw.`goodstwotype_url`,
ds.`goodstype_id`, ds.`goodstype_id`,
ds.`goodstype_title` ds.`goodstype_title`
FROM tb_cf_goodstwotype tw FROM tb_cf_goodstwotype tw
...@@ -80,18 +86,21 @@ ...@@ -80,18 +86,21 @@
insert into tb_cf_goodstwotype( insert into tb_cf_goodstwotype(
`goodstwotype_id`, `goodstwotype_id`,
`goodstwotype_title`, `goodstwotype_title`,
`goodstype_id`) `goodstype_id`,
`goodstwotype_url`)
values( values(
#{goodstwotypeId}, #{goodstwotypeId},
#{goodstwotypeTitle}, #{goodstwotypeTitle},
#{goodstypeId}) #{goodstypeId},
#{goodstwotypeUrl})
</insert> </insert>
<update id="update" parameterType="com.platform.entity.TbCfGoodstwotypeEntity"> <update id="update" parameterType="com.platform.entity.TbCfGoodstwotypeEntity">
update tb_cf_goodstwotype update tb_cf_goodstwotype
<set> <set>
<if test="goodstwotypeTitle != null">`goodstwotype_title` = #{goodstwotypeTitle},</if> <if test="goodstwotypeTitle != null">`goodstwotype_title` = #{goodstwotypeTitle}, </if>
<if test="goodstypeId != null">`goodstype_id` = #{goodstypeId}</if> <if test="goodstypeId != null">`goodstype_id` = #{goodstypeId}, </if>
<if test="goodstwotypeUrl != null">`goodstwotype_url` = #{goodstwotypeUrl}</if>
</set> </set>
where goodstwotype_id = #{goodstwotypeId} where goodstwotype_id = #{goodstwotypeId}
</update> </update>
......
...@@ -69,8 +69,7 @@ ...@@ -69,8 +69,7 @@
update tb_cf_goodstype update tb_cf_goodstype
<set> <set>
<if test="goodstypeTitle != null">`goodstype_title` = #{goodstypeTitle},</if> <if test="goodstypeTitle != null">`goodstype_title` = #{goodstypeTitle},</if>
<if test="goodstypeSort != null">`goodstype_sort` = #{goodstypeSort}</if> <if test="goodstypeSort != null">`goodstype_sort` = #{goodstypeSort},</if>
<if test="goodstypeSort != null">`goodstype_sort` = #{goodstypeSort}</if>
<if test="goodstypeUrl != null">`goodstype_url` = #{goodstypeUrl}</if> <if test="goodstypeUrl != null">`goodstype_url` = #{goodstypeUrl}</if>
</set> </set>
where goodstype_id = #{goodstypeId} where goodstype_id = #{goodstypeId}
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head> <head>
<title></title> <title></title>
#parse("sys/header.html") #parse("sys/header.html")
...@@ -52,6 +52,11 @@ ...@@ -52,6 +52,11 @@
:value="el.goodstypeId">{{el.goodstypeTitle}}</i-option> :value="el.goodstypeId">{{el.goodstypeTitle}}</i-option>
</i-select> </i-select>
</Form-item> </Form-item>
<Form-item label="二级分类图片" prop="goodstwotypeUrl">
<img v-bind:src="tbCfGoodstwotype.goodstwotypeUrl" v-show="!!tbCfGoodstwotype.goodstwotypeUrl"/>
<input type="file" placeholder="二级分类图片" @change="tirggerFile($event)"/>
</Form-item>
<Form-item label="商品二级分类标题" prop="goodstwotypeTitle"> <Form-item label="商品二级分类标题" prop="goodstwotypeTitle">
<i-input v-model="tbCfGoodstwotype.goodstwotypeTitle" placeholder="商品二级分类标题"/> <i-input v-model="tbCfGoodstwotype.goodstwotypeTitle" placeholder="商品二级分类标题"/>
</Form-item> </Form-item>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head> <head>
<title></title> <title></title>
#parse("sys/header.html") #parse("sys/header.html")
...@@ -48,6 +48,12 @@ ...@@ -48,6 +48,12 @@
<Form-item label="商品分类标题" prop="goodstypeTitle"> <Form-item label="商品分类标题" prop="goodstypeTitle">
<i-input v-model="tbCfGoodstype.goodstypeTitle" placeholder="商品分类标题"/> <i-input v-model="tbCfGoodstype.goodstypeTitle" placeholder="商品分类标题"/>
</Form-item> </Form-item>
<Form-item label="一级分类图片" prop="goodstypeUrl">
<img v-bind:src="tbCfGoodstype.goodstypeUrl" v-show="!!tbCfGoodstype.goodstypeUrl"/>
<input type="file" placeholder="一级分类图片" @change="tirggerFile($event)"/>
</Form-item>
<Form-item label="排序编号" prop="goodstypeSort"> <Form-item label="排序编号" prop="goodstypeSort">
<i-input v-model="tbCfGoodstype.goodstypeSort" placeholder="排序编号"/> <i-input v-model="tbCfGoodstype.goodstypeSort" placeholder="排序编号"/>
</Form-item> </Form-item>
......
...@@ -4,11 +4,12 @@ $(function () { ...@@ -4,11 +4,12 @@ $(function () {
colModel: [ colModel: [
{label: 'ID', name: 'goodstwotypeId', index: 'goodstwotype_id', key: true}, {label: 'ID', name: 'goodstwotypeId', index: 'goodstwotype_id', key: true},
{label: '商品一级分类', name: 'goodstypeTitle', index: 'goodstype_title', width: 80}, {label: '商品一级分类', name: 'goodstypeTitle', index: 'goodstype_title', width: 80},
{label: '商品二级分类', name: 'goodstwotypeTitle', index: 'goodstwotype_title', width: 80}], {label: '商品二级分类', name: 'goodstwotypeTitle', index: 'goodstwotype_title', width: 80},
{label: '二级分类图片', name: 'goodstwotypeUrl', index: 'goodstwotype_url', width: 80, formatter: imageFormat}],
shrinkToFit: true, shrinkToFit: true,
datatype : "json", datatype: "json",
rowNum:15, rowNum: 15,
rowList:[15,30,45], rowList: [15, 30, 45],
mtype: "POST", mtype: "POST",
rownumbers: true, rownumbers: true,
rownumWidth: 40, rownumWidth: 40,
...@@ -26,7 +27,7 @@ let vm = new Vue({ ...@@ -26,7 +27,7 @@ let vm = new Vue({
showList: true, showList: true,
title: null, title: null,
tbCfGoodstwotype: {}, tbCfGoodstwotype: {},
Goodstype:null, Goodstype: null,
ruleValidate: { ruleValidate: {
name: [ name: [
{required: true, message: '名称不能为空', trigger: 'blur'} {required: true, message: '名称不能为空', trigger: 'blur'}
...@@ -71,7 +72,7 @@ let vm = new Vue({ ...@@ -71,7 +72,7 @@ let vm = new Vue({
}, },
del: function (event) { del: function (event) {
let goodstwotypeIds = getSelectedRows("#jqGrid"); let goodstwotypeIds = getSelectedRows("#jqGrid");
if (goodstwotypeIds == null){ if (goodstwotypeIds == null) {
return; return;
} }
...@@ -89,9 +90,9 @@ let vm = new Vue({ ...@@ -89,9 +90,9 @@ let vm = new Vue({
}); });
}); });
}, },
getInfo: function(goodstwotypeId){ getInfo: function (goodstwotypeId) {
Ajax.request({ Ajax.request({
url: "../tbcfgoodstwotype/info/"+goodstwotypeId, url: "../tbcfgoodstwotype/info/" + goodstwotypeId,
async: true, async: true,
successCallback: function (r) { successCallback: function (r) {
vm.tbCfGoodstwotype = r.tbCfGoodstwotype; vm.tbCfGoodstwotype = r.tbCfGoodstwotype;
...@@ -106,8 +107,35 @@ let vm = new Vue({ ...@@ -106,8 +107,35 @@ let vm = new Vue({
page: page page: page
}).trigger("reloadGrid"); }).trigger("reloadGrid");
vm.handleReset('formValidate'); vm.handleReset('formValidate');
}
,
handleReset: function (name) {
handleResetForm(this, name);
}, },
reloadSearch: function() { tirggerFile: function (event) {
var file = event.target.files[0];
var formData = new FormData();
formData.append("file", file);
$.ajax({
url: "../api/upload/image/",
type: "POST",
data: formData,
cache: false, //不设置缓存
processData: false, // 不处理数据
contentType: false,// 不设置内容类型
success: function (result) {
result = JSON.parse(result);
//console.log(result)
if (result.errno == 0) {//成功
vm.tbCfGoodstwotype.goodstwotypeUrl = result.data;
vm.$forceUpdate();
} else {
iview.Message.error(result.errmsg);
}
}
});
},
reloadSearch: function () {
vm.q = { vm.q = {
name: '' name: ''
}; };
...@@ -122,13 +150,13 @@ let vm = new Vue({ ...@@ -122,13 +150,13 @@ let vm = new Vue({
handleResetForm(this, name); handleResetForm(this, name);
} }
}, },
created(){ created() {
var that = this var that = this
$.get('../tbcfgoodstype/queryAll',function (res) { $.get('../tbcfgoodstype/queryAll', function (res) {
debugger debugger
// console.log(that,"this"); // console.log(that,"this");
that.Goodstype = res.list; that.Goodstype = res.list;
// console.log(that.Goodstype); // console.log(that.Goodstype);
}) })
} }
}); });
\ No newline at end of file
...@@ -2,10 +2,10 @@ $(function () { ...@@ -2,10 +2,10 @@ $(function () {
$("#jqGrid").Grid({ $("#jqGrid").Grid({
url: '../tbcfgoodstype/list', url: '../tbcfgoodstype/list',
colModel: [ colModel: [
{label: 'ID', name: 'goodstypeId', index: 'goodstype_id', key: true}, {label: 'ID', name: 'goodstypeId', index: 'goodstype_id', key: true,hidden: true},
{label: '商品一级分类', name: 'goodstypeTitle', index: 'goodstype_title', width: 80}, {label: '商品一级分类', name: 'goodstypeTitle', index: 'goodstype_title', width: 80},
{label: '排序编号', name: 'goodstypeSort', index: 'goodstype_sort', width: 80} {label: '排序编号', name: 'goodstypeSort', index: 'goodstype_sort', width: 80},
/*{label: '商品分类跳转链接', name: 'goodstypeUrl', index: 'goodstype_url', width: 80}*/], {label: '一级分类图片', name: 'goodstwotypeUrl', index: 'goodstype_url', width: 80, formatter: imageFormat}],
shrinkToFit: true, shrinkToFit: true,
datatype : "json", datatype : "json",
rowNum:15, rowNum:15,
...@@ -120,6 +120,29 @@ let vm = new Vue({ ...@@ -120,6 +120,29 @@ let vm = new Vue({
}, },
handleReset: function (name) { handleReset: function (name) {
handleResetForm(this, name); handleResetForm(this, name);
},
tirggerFile: function (event) {
var file = event.target.files[0];
var formData = new FormData();
formData.append("file", file);
$.ajax({
url: "../api/upload/image/",
type: "POST",
data: formData,
cache: false, //不设置缓存
processData: false, // 不处理数据
contentType: false,// 不设置内容类型
success: function (result) {
result = JSON.parse(result);
//console.log(result)
if (result.errno == 0) {//成功
vm.tbCfGoodstype.goodstypeUrl = result.data;
vm.$forceUpdate();
} else {
iview.Message.error(result.errmsg);
}
}
});
} }
} }
}); });
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论