提交 fe1fcf0e authored 作者: Messenger902's avatar Messenger902

Merge remote-tracking branch 'origin/master'

package com.platform.controller;
import com.platform.entity.TbCfArticleEntity;
import com.platform.service.TbCfArticleService;
import com.platform.utils.Constant;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 文章表Controller
*
* @author lipengjun
* @date 2020-03-17 19:13:04
*/
@Controller
@RequestMapping("tbcfarticle")
public class TbCfArticleController extends AbstractController {
@Autowired
private TbCfArticleService tbCfArticleService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("tbcfarticle:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<TbCfArticleEntity> tbCfArticleList = tbCfArticleService.queryList(query);
int total = tbCfArticleService.queryTotal(query);
PageUtils pageUtil = new PageUtils(tbCfArticleList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("tbcfarticle:info")
@ResponseBody
public R info(@PathVariable("id") String id) {
TbCfArticleEntity tbCfArticle = tbCfArticleService.queryObject(id);
return R.ok().put("tbCfArticle", tbCfArticle);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("tbcfarticle:save")
@ResponseBody
public R save(@RequestBody TbCfArticleEntity tbCfArticle) throws Exception {
tbCfArticle.setAuthor(getUser().getUserName());
tbCfArticleService.save(tbCfArticle);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("tbcfarticle:update")
@ResponseBody
public R update(@RequestBody TbCfArticleEntity tbCfArticle) throws Exception {
tbCfArticleService.update(tbCfArticle);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("tbcfarticle:delete")
@ResponseBody
public R delete(@RequestBody String[] ids) {
tbCfArticleService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<TbCfArticleEntity> list = tbCfArticleService.queryList(params);
return R.ok().put("list", list);
}
}
package com.platform.dao;
import com.platform.entity.TbCfArticleEntity;
/**
* 文章表Dao
*
* @author lipengjun
* @date 2020-03-17 19:13:04
*/
public interface TbCfArticleDao extends BaseDao<TbCfArticleEntity> {
}
package com.platform.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 文章表实体
* 表名 tb_cf_article
*
* @author lipengjun
* @date 2020-03-17 19:13:04
*/
public class TbCfArticleEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 文章ID
*/
private String id;
/**
* 文章标题
*/
private String title;
/**
* 文章内容
*/
private String content;
/**
* 图片
*/
private String picture;
/**
* 作者
*/
private String author;
/**
* 点赞人数
*/
private Long likeNum;
/**
* 删除标志 0:正常 1:已删除
*/
private Integer delFlag;
/**
* 创建时间
*/
private Date createtime;
/**
* 更新时间
*/
private Date updatetime;
/**
* 设置:文章ID
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:文章ID
*/
public String getId() {
return id;
}
/**
* 设置:文章标题
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 获取:文章标题
*/
public String getTitle() {
return title;
}
/**
* 设置:文章内容
*/
public void setContent(String content) {
this.content = content;
}
/**
* 获取:文章内容
*/
public String getContent() {
return content;
}
/**
* 设置:图片
*/
public void setPicture(String picture) {
this.picture = picture;
}
/**
* 获取:图片
*/
public String getPicture() {
return picture;
}
/**
* 设置:作者
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* 获取:作者
*/
public String getAuthor() {
return author;
}
/**
* 设置:点赞人数
*/
public void setLikeNum(Long likeNum) {
this.likeNum = likeNum;
}
/**
* 获取:点赞人数
*/
public Long getLikeNum() {
return likeNum;
}
/**
* 设置:删除标志 0:正常 1:已删除
*/
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
/**
* 获取:删除标志 0:正常 1:已删除
*/
public Integer getDelFlag() {
return delFlag;
}
/**
* 设置:创建时间
*/
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
/**
* 获取:创建时间
*/
public Date getCreatetime() {
return createtime;
}
/**
* 设置:更新时间
*/
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
/**
* 获取:更新时间
*/
public Date getUpdatetime() {
return updatetime;
}
}
package com.platform.service;
import com.platform.entity.TbCfArticleEntity;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
/**
* 文章表Service接口
*
* @author lipengjun
* @date 2020-03-17 19:13:04
*/
public interface TbCfArticleService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfArticleEntity queryObject(String id);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfArticleEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfArticle 实体
* @return 保存条数
*/
int save(TbCfArticleEntity tbCfArticle) throws UnsupportedEncodingException, Exception;
/**
* 根据主键更新实体
*
* @param tbCfArticle 实体
* @return 更新条数
*/
int update(TbCfArticleEntity tbCfArticle) throws Exception;
/**
* 根据主键删除
*
* @param id
* @return 删除条数
*/
int delete(String id);
/**
* 根据主键批量删除
*
* @param ids
* @return 删除条数
*/
int deleteBatch(String[] ids);
}
package com.platform.service.impl;
import com.platform.dao.TbCfArticleDao;
import com.platform.entity.TbCfArticleEntity;
import com.platform.service.TbCfArticleService;
import com.platform.utils.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.platform.utils.ShiroUtils.getUserId;
/**
* 文章表Service实现类
*
* @author lipengjun
* @date 2020-03-17 19:13:04
*/
@Service("tbCfArticleService")
public class TbCfArticleServiceImpl implements TbCfArticleService {
@Autowired
private TbCfArticleDao tbCfArticleDao;
@Override
public TbCfArticleEntity queryObject(String id) {
return tbCfArticleDao.queryObject(id);
}
@Override
public List<TbCfArticleEntity> queryList(Map<String, Object> map) {
return tbCfArticleDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfArticleDao.queryTotal(map);
}
@Override
public int save(TbCfArticleEntity tbCfArticle) throws Exception {
tbCfArticle.setUpdatetime(new Date());
tbCfArticle.setCreatetime(new Date());
tbCfArticle.setDelFlag(1);
tbCfArticle.setLikeNum(0L);
tbCfArticle.setId(IdUtil.createIdbyUUID());
tbCfArticle.setContent(URLDecoder.decode(tbCfArticle.getContent(),"utf-8"));
return tbCfArticleDao.save(tbCfArticle);
}
@Override
public int update(TbCfArticleEntity tbCfArticle)throws Exception {
tbCfArticle.setUpdatetime(new Date());
tbCfArticle.setContent(URLDecoder.decode(tbCfArticle.getContent(),"utf-8"));
return tbCfArticleDao.update(tbCfArticle);
}
@Override
public int delete(String id) {
return tbCfArticleDao.delete(id);
}
@Override
public int deleteBatch(String[] ids) {
return tbCfArticleDao.deleteBatch(ids);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.platform.dao.TbCfArticleDao">
<resultMap type="com.platform.entity.TbCfArticleEntity" id="tbCfArticleMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="picture" column="picture"/>
<result property="author" column="author"/>
<result property="likeNum" column="like_num"/>
<result property="delFlag" column="del_flag"/>
<result property="createtime" column="createTime"/>
<result property="updatetime" column="updateTime"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfArticleEntity">
select
`id`,
`title`,
`content`,
`picture`,
`author`,
`like_num`,
`del_flag`,
`createTime`,
`updateTime`
from tb_cf_article
where id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfArticleEntity">
select
`id`,
`title`,
`content`,
`picture`,
`author`,
`like_num`,
`del_flag`,
`createTime`,
`updateTime`
from tb_cf_article
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_article
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfArticleEntity">
insert into tb_cf_article(
`id`,
`title`,
`content`,
`picture`,
`author`,
`like_num`,
`del_flag`,
`createTime`,
`updateTime`)
values(
#{id},
#{title},
#{content},
#{picture},
#{author},
#{likeNum},
#{delFlag},
#{createtime},
#{updatetime})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfArticleEntity">
update tb_cf_article
<set>
<if test="title != null">`title` = #{title}, </if>
<if test="content != null">`content` = #{content}, </if>
<if test="picture != null">`picture` = #{picture}, </if>
<if test="author != null">`author` = #{author}, </if>
<if test="likeNum != null">`like_num` = #{likeNum}, </if>
<if test="delFlag != null">`del_flag` = #{delFlag}, </if>
<if test="createtime != null">`createTime` = #{createtime}, </if>
<if test="updatetime != null">`updateTime` = #{updatetime}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete from tb_cf_article where id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_article where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -2,13 +2,13 @@
#jdbc.username=root
#jdbc.password=root
#jdbc.url=jdbc:mysql://47.106.242.175:3306/platform?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
#jdbc.username=root
#jdbc.password=diaoyun666
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root
jdbc.password=diaoyun666
jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
jdbc.username: root
jdbc.password: Diaoyunnuli.8
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root
#jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5
jdbc.maxActive=30
......
<!DOCTYPE html>
<html>
<head>
<title>文章表</title>
#parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak style="height: calc(100% - 15px);">
<div v-show="showList" style="height: 100%;">
<Row :gutter="16">
<div class="search-group">
<i-col span="4">
<i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
</i-col>
<i-button @click="query">查询</i-button>
<i-button @click="reloadSearch">重置</i-button>
</div>
<div class="buttons-group">
#if($shiro.hasPermission("tbcfarticle:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
#end
#if($shiro.hasPermission("tbcfarticle:update"))
<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
#end
#if($shiro.hasPermission("tbcfarticle:delete"))
<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
#end
</div>
</Row>
<table id="jqGrid"></table>
</div>
<Card v-show="!showList">
<p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="tbCfArticle" :rules="ruleValidate" :label-width="80">
<Form-item label="文章标题" prop="title">
<i-input v-model="tbCfArticle.title" placeholder="文章标题"/>
</Form-item>
<!--<Form-item label="图片" prop="picture">
<i-input v-model="tbCfArticle.picture" placeholder="图片"/>
</Form-item>-->
<Form-item label="图片" prop="picture">
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
multiple
action="../api/osstest/uploadtest"
:before-upload="handleBeforeUpload"
:on-success="handleSuccess" :show-upload-list="false" accept="image/jpeg, image/png">
<i-button icon="ios-cloud-upload-outline">请选择图片</i-button>
</upload>
<div style="display: flex;position: relative;">
<div v-for="item in uploadList" style="margin-left: 5px;">
<img :src="item" width="100" height="100" id="itemImg">
<i class="ivu-icon ivu-icon-ios-trash-outline"
style="cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"
@click="delImg1(item)"></i>
</div>
</div>
</Form-item>
<!--<Form-item label="文章内容" prop="content">
<i-input v-model="tbCfArticle.content" placeholder="文章内容"/>
</Form-item>-->
<Form-item label="文章内容" prop="content">
<!-- <script id="Detail" name="tbCfVersion.versionDetail"type="text/plain">${pd.COLLSORT_DETAILS}</script>-->
<textarea id="content" style="width: 800px;height: 600px;"></textarea>
</Form-item>
<Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
<i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
</Form-item>
</i-form>
</Card>
</div>
<script src="${rc.contextPath}/statics/libs/iview.js"></script>
<script src="${rc.contextPath}/js/sys/tbcfarticle.js?_${date.systemTime}"></script>
<script type="text/javascript">
var content = UE.getEditor('content');
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function (action) {
if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
return '${rc.contextPath}/api/osstest/uploaditemimage';
} else {
return this._bkGetActionUrl.call(this, action);
}
};
</script>
</body>
</html>
\ No newline at end of file
......@@ -147,6 +147,118 @@
.default-price > h4 {
margin-bottom: 5px;
}
/* commnstyle */
.pp-text-center{
text-align: center;
margin:10px;
}
.pp-flex-sb{
display: flex;
justify-content: space-between;
align-items: center;
}
.pp-flex-start{
display: flex;
justify-content: start;
align-items: center;
}
/* 标签弹窗*/
.pp-popup-wrapper{
width:100vw;
height:100vh;
position:fixed;
top:0;
left:0;
z-index: 100;
}
.pp-popup-mask{
width:100%;
height:100%;
position: absolute;
left:0;
top:0;
z-index: -1;
background: #000;
opacity: 0.5;
}
.pp-popup-container{
position:absolute;
left:50%;
top:50%;
transform: translate(-50%,-50%);
height: 400px;
min-width:600px;
background: #fff;
border-radius: 6px;
overflow-y: scroll;
padding:10px;
}
.pp-tags-section{
margin-bottom:22px;
}
.pp-popup-close{
position: absolute;
bottom: 10px;
left:50%;
transform: translateY(-50%);
}
.pp-tags-subtag{
margin-left:10px;
margin-top:10px;
}
/*标签展示*/
.item-tag-container{
margin-bottom: 24px;
}
.item-tag-container>span{
width:80px;
text-align: right;
vertical-align: middle;
float: left;
font-size: 12px;
color: #495060;
line-height: 1;
padding: 10px 12px 10px 0;
box-sizing: border-box;
font-weight: bold;
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.item-tag-container>div{
width:720px;
min-height:32px;
background: white;
border-radius: 2px;
border: 1px solid #dddee1;
}
.tag-preview{
position: relative;
}
.add-tag-btn{
position: absolute;
right: 0;
top:50%;
transform: translateY(-50%);
}
.pp-tag{
margin:5px;
display: inline-block;
min-width:50px;
height:30px;
background: #f9f9f9;
border-radius: 4px;
border:1px solid #eee;
line-height:30px;
text-align: center;
justify-content: space-between;
padding: 0 4px;
}
.pp-tag>i{
padding:0 12px;
cursor: pointer;
color: black;
}
</style>
</head>
<body>
......@@ -258,9 +370,49 @@
<Form-item label="搜索关键字" prop="itemTags" style="width: 800px">
<i-input v-model="tbCfStationItem.itemTags" placeholder="搜索关键字"/>
</Form-item>
<Form-item label="商品标签" prop="itemLabel" style="width: 800px">
<i-input v-model="tbCfStationItem.itemLabel" placeholder="商品标签"/>
</Form-item>
<div class="item-tag-container pp-flex-start">
<span>标签</span>
<div class="tag-preview">
<transition-group tag="div" name="slide">
<div class="pp-tag" v-for="(element,index) in isSelectedArr" :key="index">
<span>{{element.labelName}}</span>
<i @click="deleteTag(element,index)">x</i>
</div>
</transition-group>
<div class="add-tag-btn" @click="showTagPopup()">
<i-button type="success" shape="circle" size="small">添加标签</i-button>
</div>
</div>
</div>
<div class="pp-popup-wrapper" v-if="tagshow">
<div class="pp-popup-mask"></div>
<div class="pp-popup-container">
<h3 class="pp-text-center">数据选择</h3>
<div class="pp-tags-section" v-for="(element,index) in tagLists" :key="index">
<i-button
size="large"
:type="element.isSelected?'success':'info'"
@click="selectTag(element,index)"
>{{element.labelName}}</i-button>
<transition-group tag="div" name="slide">
<i-button
class="pp-tags-subtag"
v-for="(subElement,subIndex) in subtaglist[index]" :key="subIndex"
size="small"
:type="subElement.isSelected?'success':''"
@click="selectSubTag(subElement,subIndex,index)"
>{{subElement.labelName}}</i-button>
</transition-group>
</div>
<div class="pp-popup-close" @click="hideTagPopup">
<i-button type="ghost">关闭</i-button>
</div>
</div>
</div>
<!-- <Form-item label="商品标签" prop="itemLabel" style="width: 800px">-->
<!-- <i-input v-model="tbCfStationItem.itemLabel" placeholder="商品标签"/>-->
<!-- <div>123</div>-->
<!-- </Form-item>-->
<Form-item label="原价" prop="itemPrice" style="width: 800px">
<i-input v-model="tbCfStationItem.itemPrice" placeholder="原价(可不填)"/>
</Form-item>
......
......@@ -470,25 +470,8 @@ imageFormat = function (cellvalue, options, rowObject) {
cellvalue = "<i class=\"fa fa-file-picture-o\" style=\"font-size:30px;\" title='无图'></i>";
} else {
cellvalue = '<img src="' + cellvalue + '" style="width:30px;height:30px;" />';
/* if (cellvalue.indexOf(',') > 0) {
let str = cellvalue.split(',')[0];
let str1 = str.split(',')[0];
let str2 = str.split(',')[1]
let url = str1.substring(5, str1.length);
let type = str2.substring(5, str2.length);
alert(length)
alert(type)
console.log(123, url)
console.log(456, type)
if (type === 'video') {
cellvalue = '<video src="' + url + '" style="width:30px;height:30px;" />';
} else {
cellvalue = '<img src="' + url + '" style="width:30px;height:30px;" />';
}
} else {
cellvalue = '<img src="' + cellvalue + '" style="width:30px;height:30px;" />';
}*/
cellvalue = '<img src="' + cellvalue + '" style="width:30px;height:30px;" />';
}
return cellvalue;
......
$(function () {
$("#jqGrid").Grid({
url: '../tbcfarticle/list',
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '文章标题', name: 'title', index: 'title', width: 80},
{label: '图片', name: 'picture', index: 'picture', width: 80},
{label: '作者', name: 'author', index: 'author', width: 80},
{label: '创建时间', name: 'createtime', index: 'createTime', width: 80}
]
});
});
let vm = new Vue({
el: '#rrapp',
data: {
showList: true,
uploadList: [],
title: null,
tbCfArticle: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.tbCfArticle = {};
this.uploadList.length = 0;
vm.tbCfArticle.content=''
},
update: function (event) {
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
}
vm.showList = false;
vm.title = "修改";
vm.getInfo(id);
},
saveOrUpdate: function (event) {
let url = vm.tbCfArticle.id == null ? "../tbcfarticle/save" : "../tbcfarticle/update";
vm.tbCfArticle.picture=this.uploadList.map(res=>res).join(',');
vm.tbCfArticle.content = encodeURI(UE.getEditor('content').getContent()); // 富文本取值
vm.tbCfArticle.content = vm.tbCfArticle.content.replace(/&nbsp;/g, " ");
Ajax.request({
url: url,
params: JSON.stringify(vm.tbCfArticle),
type: "POST",
contentType: "application/json",
successCallback: function (r) {
alert('操作成功', function (index) {
vm.reload();
});
}
});
},
del: function (event) {
let ids = getSelectedRows("#jqGrid");
if (ids == null){
return;
}
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../tbcfarticle/delete",
params: JSON.stringify(ids),
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
});
},
getInfo: function(id){
Ajax.request({
url: "../tbcfarticle/info/"+id,
async: true,
successCallback: function (r) {
vm.tbCfArticle = r.tbCfArticle;
let content = vm.tbCfArticle.content;
vm.uploadList = vm.tbCfArticle.picture.split(',');
if(content!=null){
UE.getEditor('content').setContent(content);
}else {
UE.getEditor('content').setContent('');
}
}
});
},
reload: function (event) {
vm.showList = true;
let page = $("#jqGrid").jqGrid('getGridParam', 'page');
$("#jqGrid").jqGrid('setGridParam', {
postData: {'name': vm.q.name},
page: page
}).trigger("reloadGrid");
vm.handleReset('formValidate');
},
reloadSearch: function() {
vm.q = {
name: ''
};
vm.reload();
},
handleSubmit: function (name) {
handleSubmitValidate(this, name, function () {
vm.saveOrUpdate()
});
},
handleReset: function (name) {
handleResetForm(this, name);
},
handleBeforeUpload(file) {
// 上传图片大小不超过5M
if (file.size > 5 * 1024 * 1024) {
alert('请上传不超过5M的图片');
return false;
}
console.log(123456,this.uploadList)
const check = this.uploadList.length < 9;
if (!check) {
this.$Notice.warning({
title: '最多只能上传九张图片'
});
return false;
}
// 限制上传文件的宽高
// return this.checkImageWH(file,750,320);
},
handleSuccess(response, file, fileList) {
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
vm.uploadList.push(response);
$("#itemImg").show();
},
// 删除上传图片
delImg1: function (url) {
if (vm.title != "详情") {
vm.uploadList.remove(url);
console.log(url);
Ajax.request({
url: "../api/upload/delFile?url=" + url,
async: false,
type: "POST",
contentType: "application/json",
successCallback: function (resultData) {
// console.log(resultData);
iview.Message.success(resultData.success);
}
});
}
}
}
});
\ No newline at end of file
......@@ -116,6 +116,7 @@ let vm = new Vue({
created(){
$.get('../tbcflabel/queryParentLabels', res => {
this.labelList = JSON.parse(res).list;
console.log()
this.labelList.unshift({
id: "0",
labelName: "标签组",
......
......@@ -64,9 +64,18 @@ let vm = new Vue({
setDefaultValue: false,
tmdSkudata: null,
isDisabled: false,
disabled: false
disabled: false,
itemLabel: null,
tagLists: [],//标签列表
subtaglist: [],//子便签
tagshow: false,
isSelectedArr: [] //选中标签的数组
},
methods: {
//获取二级分类
changeGoodstype() {
let url = "../tbcfstationitem/queryByItemType?typeId=" + this.tbCfStationItem.itemCategory;
......@@ -129,6 +138,8 @@ let vm = new Vue({
this.prevItem.forEach(item => {
resArr.push(item)
})
let label = null;
vm.tbCfStationItem.itemLabel = this.isSelectedArr.map(item=>item.id).join(',');
vm.tbCfStationItem.prevItem = resArr
vm.tbCfStationItem.putaway = this.putaway
this.$set(vm.tbCfStationItem, 'tree', this.attrItem)
......@@ -250,7 +261,7 @@ let vm = new Vue({
},
importExcel: function () {
this.modal=''
this.modal = ''
},
exportExcel: function () {
......@@ -515,9 +526,73 @@ let vm = new Vue({
save() {
console.log(this.prevItem) //sku组合数组
console.log(this.putaway) //是否立即上架
},
/* 获取标签数据*/
getTagsData() {
//一级
$.get('../tbcflabel/queryParentLabels', res => {
this.tagLists = JSON.parse(res).list;
this.tagLists.forEach((item, index) => {
this.$set(this.tagLists[index], 'isSelected', false)
this.subtaglist.push([])
})
})
},
/*子标签*/
async getSubTagsData(id) {
let result = null;
await $.get('../tbcflabel/queryParentLabels?parentId=' + id, res => {
result = res;
})
return result
},
async selectTag(e, i) {
this.tagLists[i].isSelected = !this.tagLists[i].isSelected;
if (this.subtaglist[i].length === 0) {
let subtagData = await this.getSubTagsData(e.id);
this.subtaglist[i] = JSON.parse(subtagData).list;
this.subtaglist[i].forEach((item, index) => {
this.$set(this.subtaglist[i][index], 'isSelected', true);
})
this.$forceUpdate();
} else {
//单纯选中
if (this.tagLists[i].isSelected) {
this.subtaglist[i].forEach((item, index) => {
item.isSelected = true;
})
}
}
},
// 选中子标签
selectSubTag(element, index, parentIndex) {
this.tagLists[parentIndex].isSelected = false;
this.subtaglist[parentIndex][index].isSelected = !this.subtaglist[parentIndex][index].isSelected;
let allSelected = this.subtaglist[parentIndex].every(item => item.isSelected === true);
allSelected ? this.tagLists[parentIndex].isSelected = true : null;
this.$forceUpdate();
},
showTagPopup() {
this.tagshow = true;
},
hideTagPopup() {
this.tagshow = false;
this.isSelectedArr = [];
this.subtaglist.forEach(item => {
item.forEach(_item => {
_item.isSelected ? this.isSelectedArr.push(_item) : null;
})
})
console.log(this.isSelectedArr)
},
deleteTag(e, i) {
this.$delete(this.isSelectedArr, i)
}
},
created() {
this.getTagsData();
//数据初始化
if (!localStorage.getItem('option')) {
localStorage.setItem('option', JSON.stringify(this.attrItem[0].option))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论