Browse Source

修改

wangqin
hui 9 months ago
parent
commit
0766c1eacf
  1. 10
      ruoyi-ui/src/views/JiHeExpressway/pages/service/sensitive/components/AddNEditDialog.vue
  2. 87
      ruoyi-ui/src/views/JiHeExpressway/pages/service/sensitive/index.vue

10
ruoyi-ui/src/views/JiHeExpressway/pages/service/sensitive/components/AddNEditDialog.vue

@ -73,7 +73,7 @@ export default {
methods: { methods: {
checkRepeat(word){ checkRepeat(word){
let temp = _.find(this.dataAll, { word: word }); let temp = _.find(this.dataAll, { word: word });
if (temp && Object.keys(temp).length>0) { if (temp && Object.keys(temp).length>0 && !(this.data && this.data.id==temp.id)) {
this.$message.error("该关键词已存在。"); this.$message.error("该关键词已存在。");
return false return false
} else { } else {
@ -84,14 +84,14 @@ export default {
this.$refs.FormConfigRef.validate() this.$refs.FormConfigRef.validate()
.then((data) => { .then((data) => {
data.word = data.word.trim(); data.word = data.word.trim();
if(!this.checkRepeat(data.word)){
return ;
}
this.submitting = true; this.submitting = true;
if (this.data) data.id = this.data.id; if (this.data) data.id = this.data.id;
if (!this.checkRepeat(data.word)) {
return;
}
request({ request({
url: `/business/dcInfoBoardVocabulary`, url: `/business/dcInfoBoardVocabulary`,
method: this.data ? 'PUT' : 'POST', method: this.data ? 'PUT' : 'POST',

87
ruoyi-ui/src/views/JiHeExpressway/pages/service/sensitive/index.vue

@ -1,5 +1,6 @@
<template> <template>
<div class='sensitiveWord'> <div class='sensitiveWord'>
<div class="filter"> <div class="filter">
<div> <div>
<ButtonGradient @click.native="handleAddEdit(true)"> <ButtonGradient @click.native="handleAddEdit(true)">
@ -26,30 +27,38 @@
</div> </div>
<div class="body"> <div class="body" :style="{'overflow-y': (data.length && data.length>42) ? 'scroll':'auto' }">
<Empty v-if="!data.length && !isFirst" class="no-data" style="position: absolute">暂无数据</Empty> <Empty v-if="!data.length && !isFirst" class="no-data" style="position: absolute">暂无数据</Empty>
<template v-else> <template v-else>
<div class="cardBox" v-for="(item, index) in data" :key="index"> <div class="cardBox" v-for="(item, index) in data" :key="index" style="overflow: hidden; height: 145px;">
<Card :buttonIcon="null" :keyMap="keyMap" :cardData="item" class="card" <Card :buttonIcon="null" :keyMap="keyMap" :cardData="item" class="card"
buttonText="详情"> buttonText="详情">
<template #form-word="{ data }"> <template #form-word="{ data }">
<div class="keyword"> <div class="keyword">
{{ data.word }} {{ data.word }}
</div> </div>
</template> </template>
<template #button> <template #button>
<Button @click.native="() => handleAddEdit(true, item)"> <Button @click.native="() => handleAddEdit(true, item)">
修改 修改
</Button> </Button>
<Button style="background-color: #FF5F5F;" @click.native="handleDelete(item)"> <Button style="background-color: #FF5F5F;" @click.native="handleDelete(item)">
删除 删除
</Button> </Button>
</template> </template>
</Card> </Card>
</div> </div>
</template> </template>
</div> </div>
<AddNEditDialog v-model="isShowDialog" :data="dialogData" @onSuccess = "getData" :dataAll="data"/>;
<!-- 分页 -->
<div class="footer" v-if="numTotal>0">
<Pagination :total="numTotal" :current-page.sync="currentPage" :page-size="pageSize" layout="prev, pager, next"
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
<AddNEditDialog v-model="isShowDialog" :data="dialogData" @onSuccess = "getData" :dataAll="data"/>
</div> </div>
</template> </template>
@ -59,6 +68,7 @@ import AddNEditDialog from "./components/AddNEditDialog.vue"
import InputSearch from '@screen/components/InputSearch/index.vue'; import InputSearch from '@screen/components/InputSearch/index.vue';
import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue'; import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue';
import Button from '@screen/components/Buttons/Button.vue'; import Button from '@screen/components/Buttons/Button.vue';
import Pagination from '@screen/components/Pagination.vue';
import { searchFormList } from "./data"; import { searchFormList } from "./data";
import request from "@/utils/request"; import request from "@/utils/request";
@ -70,6 +80,7 @@ import { Message } from "element-ui";
export default { export default {
name: 'sensitiveWord', name: 'sensitiveWord',
components: { components: {
Pagination,
Card, Card,
ButtonGradient, ButtonGradient,
InputSearch, InputSearch,
@ -80,6 +91,11 @@ export default {
return { return {
searchText:"关键词搜索", searchText:"关键词搜索",
searchFormList, searchFormList,
numTotal:0,
pageSize:42,
currentPage:1,
keyMap: [ keyMap: [
{ {
key: "word", key: "word",
@ -108,8 +124,8 @@ export default {
getSearchData() { getSearchData() {
let params = { let params = {
word: this.searchData?.word, word: this.searchData?.word,
pageSize: 1000000, pageSize: this.pageSize,
pageNum: 1 pageNum: this.currentPage
}; };
// params = { // params = {
// pageSize: 1000000, // pageSize: 1000000,
@ -162,16 +178,24 @@ export default {
this.searchText = this.searchData?.word || "关键词搜索"; this.searchText = this.searchData?.word || "关键词搜索";
if (result.code != 200) return; if (result.code != 200) return;
this.data = result.rows; this.data = result.rows;
// this.data = [ this.numTotal = result.total;
// ...result.rows,...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows
// , ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows // this.pageTotal = Math.ceil(result.total/this.pageSize);
// ];
Array.from(result.rows);
}).finally(() => { }).finally(() => {
this.isFirst = false; this.isFirst = false;
closeLoading(); closeLoading();
}) })
},
handleSizeChange(size) {
this.pageSize = size;
this.getData();
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage;
this.getData();
} }
} }
} }
@ -194,7 +218,7 @@ export default {
} }
.body { .body {
height: 0; flex: 1; overflow-y: scroll; height: 0; flex: 1;
display: flex; flex-wrap: wrap; align-content: flex-start; display: flex; flex-wrap: wrap; align-content: flex-start;
.cardBox{ .cardBox{
flex-basis: percentage(1/7); width: 0; padding-right: 10px; padding-bottom: 10px; flex-basis: percentage(1/7); width: 0; padding-right: 10px; padding-bottom: 10px;
@ -205,5 +229,14 @@ export default {
color: #00B3CC; color: #00B3CC;
} }
} }
.footer {
margin-top: 15px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
}
} }
</style> </style>

Loading…
Cancel
Save