Commit 30ff42df authored by 王晓旭's avatar 王晓旭
parents 45280699 ffae5126
......@@ -44,6 +44,16 @@
(current - 1) * size + index + 1
}}</span>
<!-- 主题封面 -->
<template slot="cover" slot-scope="text">
<img
class="cover"
v-if="text.cover"
:src="api2 + text.cover"
@click="handlePreview(api2 + text.cover)"
/>
<span v-else>--</span>
</template>
<!-- 创建时间 -->
<template slot="createTime" slot-scope="text">
{{ text.createTime | dateFormat }}
......@@ -65,6 +75,11 @@
:addVisile.sync="addVisile"
@addSuccess="getCategoryList"
></AddTheme>
<!-- 预览 -->
<PrevieModal
:previewData="previewData"
:previewVisible.sync="previewVisible"
></PrevieModal>
</div>
</template>
......@@ -73,6 +88,7 @@ import { getCategoryList, deleteCategory } from "@/services/market";
import AddTheme from "../modal/AddTheme";
import local from "@/utils/local";
import { pageSizeOptions } from "@/config/pageConfig.js";
import PrevieModal from "@/components/PrevieModal.vue";
const columns = [
{
title: "序号",
......@@ -94,6 +110,12 @@ const columns = [
title: "主题编码",
dataIndex: "categoryCode",
},
{
title: "主题封面",
scopedSlots: {
customRender: "cover",
},
},
{
title: "排序",
dataIndex: "sort",
......@@ -113,12 +135,15 @@ const columns = [
export default {
components: {
AddTheme,
PrevieModal,
},
data() {
return {
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
columns,
previewData: {}, // 预览
previewVisible: false,
siteId: local.getLocal("siteId"),
tableData: [], // 表格数据
loading: false,
......@@ -227,8 +252,21 @@ export default {
},
});
},
// 预览封面
handlePreview(url) {
this.previewData = {
type: "img",
url: url,
};
this.previewVisible = true;
},
},
};
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.cover {
width: 50px;
cursor: pointer;
}
</style>
......@@ -48,26 +48,6 @@
<div class="ant-upload-text">选择图标</div>
</div>
</a-upload>
<!-- <a-upload
name="file"
list-type="picture-card"
class="avatar-uploader"
:show-upload-list="false"
:action="api + 'base/file/commonupload'"
:before-upload="iconBeforeUpload"
@change="handleChangeIcon"
>
<img
class="icon"
v-if="form.appIconPath"
:src="api2 + form.appIconPath"
/>
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text">选择图标</div>
</div>
</a-upload> -->
</a-form-model-item>
<a-form-model-item label="应用简介" prop="summary">
<a-textarea
......@@ -102,6 +82,7 @@
<a-radio :value="1"> 应用程序 </a-radio>
<a-radio :value="2"> URL </a-radio>
<a-radio :value="3" v-if="form.type != 1"> 微信小程序 </a-radio>
<a-radio :value="4" v-if="form.type != 2"> 天府通办 </a-radio>
</a-radio-group>
</a-form-model-item>
<a-form-model-item
......
......@@ -25,10 +25,32 @@
<a-form-model-item label="主题编码" prop="categoryCode">
<a-input v-model="form.categoryCode" placeholder="请输入主题编码" />
</a-form-model-item>
<a-form-model-item label="主题封面" prop="cover">
<a-upload
name="file"
list-type="picture-card"
:action="api + 'base/file/commonupload'"
:file-list="fileList"
@change="handleChangeCover"
:accept="accept"
:before-upload="beforeUpload"
@preview="handlePreview"
>
<div v-if="fileList.length < 1">
<a-icon type="plus" />
<div class="ant-upload-text">选择封面</div>
</div>
</a-upload>
</a-form-model-item>
<a-form-model-item label="排序" prop="sort">
<a-input-number v-model="form.sort" :min="1" />
</a-form-model-item>
</a-form-model>
<!-- 预览 -->
<PrevieModal
:previewData="previewData"
:previewVisible.sync="previewVisible"
></PrevieModal>
</a-modal>
</div>
</template>
......@@ -36,6 +58,7 @@
<script>
import { saveCategory } from "@/services/market";
import local from "@/utils/local";
import PrevieModal from "@/components/PrevieModal.vue";
export default {
props: {
addVisile: {
......@@ -48,15 +71,25 @@ export default {
default: "新增分类",
},
},
components: {},
components: {
PrevieModal,
},
data() {
return {
accept: "image/jpeg,image/png",
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
fileList: [],
previewData: {}, // 预览
previewVisible: false,
form: {
siteId: local.getLocal("siteId"), // 站点id
siteName: local.getLocal("siteName"), // 站点名称
categoryName: "", // 分类名称
categoryCode: "", // 分类编码
sort: 99, // 排序
cover: "", // 封面
remark: "", // 备注
},
rules: {
categoryName: [
......@@ -88,9 +121,21 @@ export default {
// 编辑
onEdit(data) {
this.form = { ...data };
if (this.form.cover) {
this.fileList = [
{
uid: "-2",
name: this.form.cover,
status: "done",
url: this.api2 + this.form.cover,
url2: this.form.cover,
},
];
}
},
// 关闭弹窗
handleClose() {
this.fileList = [];
this.$refs.form.resetFields();
this.Visible = false;
},
......@@ -108,6 +153,43 @@ export default {
}
});
},
// 上传之前
beforeUpload(file) {
const isJpgOrPng =
file.type === "image/jpeg" || file.type === "image/png";
if (!isJpgOrPng) {
this.$message.error("请上传jpeg、png格式图片!");
}
const isLt10M = file.size / 1024 / 1024 < 10;
if (!isLt10M) {
this.$message.error("图片大小不能超过 10MB!");
}
return isJpgOrPng && isLt10M;
},
// 上传封面
handleChangeCover({ fileList }) {
this.fileList = [...fileList].slice(-1);
this.fileList = this.fileList.map((v) => {
if (v.response) {
v.url2 = v.response.url;
v.url = this.api2 + v.response.url;
}
return v;
});
if (this.fileList[0]) {
this.form.cover = this.fileList[0].url2;
} else {
this.form.cover = "";
}
},
// 预览
handlePreview(info) {
this.previewData = {
type: "img",
url: info.url,
};
this.previewVisible = true;
},
// 重置
handleReset() {
this.$refs.form.resetFields();
......
......@@ -671,6 +671,7 @@ export default {
// 业务下拉
handleChange(val, node) {
this.$refs.formData.validateField("siteBusinessId");
if (node) {
let { text } = node.componentOptions.children[0];
this.siteBusiness.siteBusinessName = text;
......
......@@ -184,3 +184,11 @@ CREATE TABLE mortals_sys_app_category(
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='自助终端应用分类';
-- ----------------------------
2023-7-05
-- ----------------------------
ALTER TABLE mortals_sys_app_category ADD COLUMN `cover` varchar(256) DEFAULT '' COMMENT '封面' AFTER sort;
ALTER TABLE mortals_sys_app_category ADD COLUMN `remark` varchar(256) DEFAULT '' COMMENT '备注' AFTER cover;
......@@ -7,11 +7,11 @@ import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.app.model.vo.AppCategoryVo;
import lombok.Data;
/**
* 自助终端应用分类实体对象
*
* @author zxfei
* @date 2023-06-15
*/
* 自助终端应用分类实体对象
*
* @author zxfei
* @date 2023-07-05
*/
@Data
public class AppCategoryEntity extends AppCategoryVo {
private static final long serialVersionUID = 1L;
......@@ -36,6 +36,14 @@ public class AppCategoryEntity extends AppCategoryVo {
* 排序字段
*/
private Integer sort;
/**
* 封面
*/
private String cover;
/**
* 备注
*/
private String remark;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -63,5 +71,9 @@ public class AppCategoryEntity extends AppCategoryVo {
this.categoryName = "";
this.sort = 0;
this.cover = "";
this.remark = "";
}
}
\ No newline at end of file
......@@ -3,11 +3,11 @@ package com.mortals.xhx.module.app.model;
import java.util.List;
import com.mortals.xhx.module.app.model.AppCategoryEntity;
/**
* 自助终端应用分类查询对象
*
* @author zxfei
* @date 2023-06-15
*/
* 自助终端应用分类查询对象
*
* @author zxfei
* @date 2023-07-05
*/
public class AppCategoryQuery extends AppCategoryEntity {
/** 开始 主键ID,主键,自增长 */
private Long idStart;
......@@ -111,6 +111,16 @@ public class AppCategoryQuery extends AppCategoryEntity {
/** 结束 更新时间 */
private String updateTimeEnd;
/** 封面 */
private List<String> coverList;
/** 封面排除列表 */
private List <String> coverNotList;
/** 备注 */
private List<String> remarkList;
/** 备注排除列表 */
private List <String> remarkNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<AppCategoryQuery> orConditionList;
......@@ -684,6 +694,70 @@ public class AppCategoryQuery extends AppCategoryEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 封面
* @return coverList
*/
public List<String> getCoverList(){
return this.coverList;
}
/**
* 设置 封面
* @param coverList
*/
public void setCoverList(List<String> coverList){
this.coverList = coverList;
}
/**
* 获取 封面
* @return coverNotList
*/
public List<String> getCoverNotList(){
return this.coverNotList;
}
/**
* 设置 封面
* @param coverNotList
*/
public void setCoverNotList(List<String> coverNotList){
this.coverNotList = coverNotList;
}
/**
* 获取 备注
* @return remarkList
*/
public List<String> getRemarkList(){
return this.remarkList;
}
/**
* 设置 备注
* @param remarkList
*/
public void setRemarkList(List<String> remarkList){
this.remarkList = remarkList;
}
/**
* 获取 备注
* @return remarkNotList
*/
public List<String> getRemarkNotList(){
return this.remarkNotList;
}
/**
* 设置 备注
* @param remarkNotList
*/
public void setRemarkNotList(List<String> remarkNotList){
this.remarkNotList = remarkNotList;
}
/**
* 设置 主键ID,主键,自增长
* @param id
......@@ -1013,6 +1087,44 @@ public class AppCategoryQuery extends AppCategoryEntity {
}
/**
* 设置 封面
* @param cover
*/
public AppCategoryQuery cover(String cover){
setCover(cover);
return this;
}
/**
* 设置 封面
* @param coverList
*/
public AppCategoryQuery coverList(List<String> coverList){
this.coverList = coverList;
return this;
}
/**
* 设置 备注
* @param remark
*/
public AppCategoryQuery remark(String remark){
setRemark(remark);
return this;
}
/**
* 设置 备注
* @param remarkList
*/
public AppCategoryQuery remarkList(List<String> remarkList){
this.remarkList = remarkList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.app.dao.ibatis.AppCategoryDaoImpl">
<!-- 字段和属性映射 -->
......@@ -15,6 +15,8 @@
<result property="createUserId" column="createUserId" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
<result property="cover" column="cover" />
<result property="remark" column="remark" />
</resultMap>
......@@ -52,23 +54,29 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('cover') or colPickMode == 1 and data.containsKey('cover')))">
a.cover,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
a.remark,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="AppCategoryEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_sys_app_category
(siteId,siteName,categoryCode,categoryName,sort,createTime,createUserId,updateUserId,updateTime)
(siteId,siteName,categoryCode,categoryName,sort,createTime,createUserId,updateUserId,updateTime,cover,remark)
VALUES
(#{siteId},#{siteName},#{categoryCode},#{categoryName},#{sort},#{createTime},#{createUserId},#{updateUserId},#{updateTime})
(#{siteId},#{siteName},#{categoryCode},#{categoryName},#{sort},#{createTime},#{createUserId},#{updateUserId},#{updateTime},#{cover},#{remark})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_sys_app_category
(siteId,siteName,categoryCode,categoryName,sort,createTime,createUserId,updateUserId,updateTime)
(siteId,siteName,categoryCode,categoryName,sort,createTime,createUserId,updateUserId,updateTime,cover,remark)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteId},#{item.siteName},#{item.categoryCode},#{item.categoryName},#{item.sort},#{item.createTime},#{item.createUserId},#{item.updateUserId},#{item.updateTime})
(#{item.siteId},#{item.siteName},#{item.categoryCode},#{item.categoryName},#{item.sort},#{item.createTime},#{item.createUserId},#{item.updateUserId},#{item.updateTime},#{item.cover},#{item.remark})
</foreach>
</insert>
......@@ -117,6 +125,12 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('cover')) or (colPickMode==1 and !data.containsKey('cover'))">
a.cover=#{data.cover},
</if>
<if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
a.remark=#{data.remark},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -212,6 +226,20 @@
</if>
</foreach>
</trim>
<trim prefix="cover=(case" suffix="ELSE cover end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('cover')) or (colPickMode==1 and !item.containsKey('cover'))">
when a.id=#{item.id} then #{item.cover}
</if>
</foreach>
</trim>
<trim prefix="remark=(case" suffix="ELSE remark end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('remark')) or (colPickMode==1 and !item.containsKey('remark'))">
when a.id=#{item.id} then #{item.remark}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -556,6 +584,48 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('cover')">
<if test="conditionParamRef.cover != null and conditionParamRef.cover != ''">
${_conditionType_} a.cover like #{${_conditionParam_}.cover}
</if>
<if test="conditionParamRef.cover == null">
${_conditionType_} a.cover is null
</if>
</if>
<if test="conditionParamRef.containsKey('coverList') and conditionParamRef.coverList.size() > 0">
${_conditionType_} a.cover in
<foreach collection="conditionParamRef.coverList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('coverNotList') and conditionParamRef.coverNotList.size() > 0">
${_conditionType_} a.cover not in
<foreach collection="conditionParamRef.coverNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('remark')">
<if test="conditionParamRef.remark != null and conditionParamRef.remark != ''">
${_conditionType_} a.remark like #{${_conditionParam_}.remark}
</if>
<if test="conditionParamRef.remark == null">
${_conditionType_} a.remark is null
</if>
</if>
<if test="conditionParamRef.containsKey('remarkList') and conditionParamRef.remarkList.size() > 0">
${_conditionType_} a.remark in
<foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('remarkNotList') and conditionParamRef.remarkNotList.size() > 0">
${_conditionType_} a.remark not in
<foreach collection="conditionParamRef.remarkNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -619,6 +689,16 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('cover')">
a.cover
<if test='orderCol.cover != null and "DESC".equalsIgnoreCase(orderCol.cover)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('remark')">
a.remark
<if test='orderCol.remark != null and "DESC".equalsIgnoreCase(orderCol.remark)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment