1、文案管理模块查询条件校验优化

pull/254/head
xjs 4 years ago
parent cdbdd25516
commit 420e62eb6d

@ -33,7 +33,7 @@
placeholder="请输入请求参数" placeholder="请输入请求参数"
clearable clearable
size="small" size="small"
maxlength="1000" maxlength="100"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
@ -44,7 +44,7 @@
placeholder="请输入响应参数" placeholder="请输入响应参数"
clearable clearable
size="small" size="small"
maxlength="15000" maxlength="100"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>

@ -7,6 +7,7 @@
placeholder="请输入文案内容" placeholder="请输入文案内容"
clearable clearable
size="small" size="small"
maxlength="100"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
@ -16,6 +17,7 @@
placeholder="请输入文案来源" placeholder="请输入文案来源"
clearable clearable
size="small" size="small"
maxlength="50"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
@ -36,6 +38,7 @@
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
:picker-options="pickerOptions"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@ -57,7 +60,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['openapi:copywriting:remove']" v-hasPermi="['openapi:copywriting:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -67,7 +71,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['openapi:copywriting:export']" v-hasPermi="['openapi:copywriting:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -78,15 +83,16 @@
size="mini" size="mini"
@click="delRepeatCopyWriting" @click="delRepeatCopyWriting"
v-hasPermi="['openapi:copywriting:remove']" v-hasPermi="['openapi:copywriting:remove']"
>删除重复文案</el-button> >删除重复文案
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="copyWritingList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="copyWritingList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="文案内容" align="center" prop="content" :show-overflow-tooltip="true" width="700px"/> <el-table-column label="文案内容" align="center" prop="content" :show-overflow-tooltip="true" width="700px"/>
<el-table-column label="文案来源" align="center" prop="source" :show-overflow-tooltip="true" /> <el-table-column label="文案来源" align="center" prop="source" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" :show-overflow-tooltip="true"> <el-table-column label="创建时间" align="center" prop="createTime" width="180" :show-overflow-tooltip="true">
</el-table-column> </el-table-column>
<el-table-column label="文案类型" align="center" prop="type" :show-overflow-tooltip="true"> <el-table-column label="文案类型" align="center" prop="type" :show-overflow-tooltip="true">
@ -97,20 +103,20 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="点击查看详情" placement="top-start"> <el-tooltip class="item" effect="dark" content="点击查看详情" placement="top-start">
<el-button circle <el-button circle
type="" type=""
icon="el-icon-view" icon="el-icon-view"
@click="handleView(scope.row,scope.index)" @click="handleView(scope.row,scope.index)"
v-hasPermi="['openapi:copywriting:query']" v-hasPermi="['openapi:copywriting:query']"
></el-button> ></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip class="item" effect="dark" content="点击删除" placement="top-start"> <el-tooltip class="item" effect="dark" content="点击删除" placement="top-start">
<el-button circle <el-button circle
type="danger" type="danger"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['openapi:copywriting:remove']" v-hasPermi="['openapi:copywriting:remove']"
></el-button> ></el-button>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
@ -141,11 +147,13 @@
</template> </template>
<script> <script>
import { listCopyWriting, getCopyWriting,delRepeatCopyWriting, delCopyWriting } from "@/api/business/openapi/copywriting"; import {listCopyWriting, delRepeatCopyWriting, delCopyWriting} from "@/api/business/openapi/copywriting";
import {pickerOptions} from "@/layout/mixin/PickerOptions"
export default { export default {
name: "CopyWriting", name: "CopyWriting",
dicts: ['copywriting_type'], dicts: ['copywriting_type'],
mixins: [pickerOptions],
data() { data() {
return { return {
// //
@ -179,15 +187,8 @@ export default {
}, },
// //
form: {}, form: {},
//
rules: {
content: [
{ required: true, message: "文案内容不能为空", trigger: "blur" }
],
source: [
{ required: true, message: "文案来源不能为空", trigger: "blur" }
]
}
}; };
}, },
created() { created() {
@ -196,8 +197,8 @@ export default {
methods: { methods: {
// //
delRepeatCopyWriting() { delRepeatCopyWriting() {
delRepeatCopyWriting().then(res =>{ delRepeatCopyWriting().then(res => {
this.$modal.msgSuccess("删除"+res.data+"条"); this.$modal.msgSuccess("删除" + res.data + "条");
this.getList(); this.getList();
}) })
}, },
@ -222,22 +223,7 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
content: null,
source: null,
createTime: null,
type: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
@ -246,46 +232,28 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.daterangeCreateTime = []; this.daterangeCreateTime = [];
this.queryParams.createTime=null this.queryParams.createTime = null
this.queryParams.endCreateTime=null this.queryParams.endCreateTime = null
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCopyWriting(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCopyWriting(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除文案api通过api获取文案信息编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除文案api通过api获取文案信息编号为"' + ids + '"的数据项?').then(function () {
return delCopyWriting(ids); return delCopyWriting(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {

@ -46,12 +46,12 @@ public class ApiLog implements Serializable
/** 请求request */ /** 请求request */
@Excel(name = "请求request") @Excel(name = "请求request")
@Size(max = 1000, message = "请控制请求request长度在1000字符", groups = { SelectGroup.class}) @Size(max = 100, message = "请控制请求request长度在100字符", groups = { SelectGroup.class})
private String request; private String request;
/** 响应体 */ /** 响应体 */
@Excel(name = "响应体") @Excel(name = "响应体")
@Size(max = 15000, message = "请控制响应体长度在15000字符", groups = { SelectGroup.class}) @Size(max = 100, message = "请控制响应体长度在100字符", groups = { SelectGroup.class})
private String response; private String response;
/** 是否请求成功 */ /** 是否请求成功 */

@ -14,6 +14,7 @@ import com.xjs.copywriting.domain.CopyWriting;
import com.xjs.copywriting.domain.RequestBody; import com.xjs.copywriting.domain.RequestBody;
import com.xjs.copywriting.factory.CopyWritingFactory; import com.xjs.copywriting.factory.CopyWritingFactory;
import com.xjs.copywriting.service.CopyWritingService; import com.xjs.copywriting.service.CopyWritingService;
import com.xjs.validation.group.SelectGroup;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
@ -151,7 +152,7 @@ public class CopyWritingController extends BaseController {
@ApiOperation("文案列表") @ApiOperation("文案列表")
@RequiresPermissions("openapi:copywriting:list") @RequiresPermissions("openapi:copywriting:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(CopyWriting copyWriting) { public TableDataInfo list(@Validated({SelectGroup.class}) CopyWriting copyWriting) {
startPage(); startPage();
List<CopyWriting> list = copyWritingService.selectCopyWritingList(copyWriting); List<CopyWriting> list = copyWritingService.selectCopyWritingList(copyWriting);
return getDataTable(list); return getDataTable(list);

@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.xjs.validation.group.SelectGroup;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -27,10 +29,12 @@ public class CopyWriting implements Serializable {
/** 文案内容 */ /** 文案内容 */
@Excel(name = "文案内容") @Excel(name = "文案内容")
@Size(max = 100, message = "请控制文案内容长度在100字符", groups = {SelectGroup.class})
private String content; private String content;
/** 文案来源 */ /** 文案来源 */
@Excel(name = "文案来源") @Excel(name = "文案来源")
@Size(max = 50, message = "请控制文案来源长度在50字符", groups = {SelectGroup.class})
private String source; private String source;
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")

Loading…
Cancel
Save