自定义白名单修改
parent
258f6838d1
commit
fcdd120cea
@ -0,0 +1,284 @@
|
|||||||
|
<!-- 自定义白名单-->
|
||||||
|
<template>
|
||||||
|
<div class="detail_dic" style="width:100%;height: 100%;position: inherit;">
|
||||||
|
<div style="padding-bottom:10px;">
|
||||||
|
<el-button type="primary" @click="addData" size="default" :icon="addButton">新增</el-button>
|
||||||
|
<el-button type="primary" @click="batchDelData" size="default" :icon="deleteButton">删除</el-button>
|
||||||
|
</div>
|
||||||
|
<div style="height:88%;width:100%;position:relative">
|
||||||
|
<div style="height: 100%;width: 100%">
|
||||||
|
<el-table :data="tableData" width="100%" height="100%" id="table_el" :header-cell-style="{background:'rgb(213,216,217)',align:'center'}" border
|
||||||
|
@selection-change="selectDatas"
|
||||||
|
@select-all="selectAllData"
|
||||||
|
v-loading="tableLoading"
|
||||||
|
:row-style="rowStyle"
|
||||||
|
:cell-style="cellStyle" >
|
||||||
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
|
<el-table-column prop="memo" label="memo" v-if="false" align="center"/>
|
||||||
|
<el-table-column type="index" label="序号" align="center"/>
|
||||||
|
<el-table-column prop="dicname" label="字典名称" :show-overflow-tooltip="true" width="170px" :formatter="dateFormatterSSS" resizable align="center" />
|
||||||
|
<el-table-column prop="discrp" label="组合描述" :show-overflow-tooltip="true" width="1600px" resizable align="center" />
|
||||||
|
<el-table-column label="操作" fixed="right" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" :icon="editButton" size="small" @click="editData(scope.row)">详情</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div style="height: 5%;width: 100%;position:fixed">
|
||||||
|
<!-- 分页 -->
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[15, 30,50,100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="totalCount"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
style="width: 90%;height:5%;padding: 0;position:inherit;margin-top:10px;bottom: 0;font-size: x-small">
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 新增页面-->
|
||||||
|
<el-dialog v-model="showDic" title="自定义白名单"
|
||||||
|
width="60%" align-center :close-on-click-modal="closeModal" :show-close="closeModal">
|
||||||
|
<whiteDicAdd ref="whiteDicAdd" style="width:100%;height: 100%" :key="now()" ></whiteDicAdd>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer" style="text-align: right">
|
||||||
|
<el-button @click="cancelUpdateFormData">取消</el-button>
|
||||||
|
<el-button type="primary" :icon="saveButton" @click="saveUpdateFormData">保存</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
<!-- 详情页面-->
|
||||||
|
<el-dialog v-model="showDetailDic" title="自定义白名单"
|
||||||
|
width="40%" align-center :close-on-click-modal="closeModal">
|
||||||
|
<el-form >
|
||||||
|
<el-form-item label="字典名称:">{{detailDicName}}</el-form-item>
|
||||||
|
<el-form-item label="组合描述:">{{detailDicDescrb}}</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<style>
|
||||||
|
body{
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
html{
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
#table_el{
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
.el-table .cell{
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script >
|
||||||
|
|
||||||
|
import { ref} from "vue";
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import {getCarnoDicByPage, batchDelCarnoDicDatas} from "../../../util/api/api.js";
|
||||||
|
import {Search,Delete,Refresh,Edit,Plus,Position,Expand,Collection} from '@element-plus/icons-vue'
|
||||||
|
import whiteDicAdd from "@/views/dev/detail/whiteDicAdd.vue"
|
||||||
|
import whiteListBatchUpdate from "@/views/dev/detail/whiteListBatchUpdate.vue"
|
||||||
|
import {now} from "moment";
|
||||||
|
var _this;
|
||||||
|
export default{
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
totalCount:0,
|
||||||
|
selectData:[],
|
||||||
|
tableData :ref([]),
|
||||||
|
deleteButton:Delete,
|
||||||
|
saveButton:Collection,
|
||||||
|
addButton:Plus,
|
||||||
|
dioTitle:"新增",
|
||||||
|
tableLoading:true,
|
||||||
|
isDisabled:false,
|
||||||
|
refreshButton:Refresh,
|
||||||
|
showDic:false,
|
||||||
|
batchParamsIds:"",
|
||||||
|
updateDatas:{},
|
||||||
|
doubleclikIndex:-1,//双击选中的行号
|
||||||
|
detailDicName:"",
|
||||||
|
detailDicDescrb:"",
|
||||||
|
showDetailDic:false,
|
||||||
|
closeModal:false,
|
||||||
|
}},
|
||||||
|
methods:{
|
||||||
|
now,
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
this.isLoding=true;
|
||||||
|
getTableDatas();
|
||||||
|
},handleCurrentChange(val) {
|
||||||
|
this.currentPage = val;
|
||||||
|
this.isLoding=true;
|
||||||
|
getTableDatas();
|
||||||
|
},addData(){//新增
|
||||||
|
this.showDic=true;
|
||||||
|
},editData(row){
|
||||||
|
this.showDetailDic=true;
|
||||||
|
this.detailDicName= row.dicname;
|
||||||
|
this.detailDicDescrb= row.discrp;
|
||||||
|
},cancelUpdateFormData(){
|
||||||
|
this.showDic=false;
|
||||||
|
}, saveUpdateFormData(){
|
||||||
|
this.$refs["whiteDicAdd"].validate((valid) => {
|
||||||
|
if(valid){
|
||||||
|
this.$refs["whiteDicAdd"].saveBatchData((code,msg)=>{
|
||||||
|
if(code===1){
|
||||||
|
alert(msg);
|
||||||
|
getTableDatas();
|
||||||
|
this.showDic=false;
|
||||||
|
}else{
|
||||||
|
alert(msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},batchDelData(){//批量删除
|
||||||
|
if(this.selectData.length<1){
|
||||||
|
alert("请选择数据!");
|
||||||
|
}else{
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'此操作将永久删除数据, 是否继续?',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '删除',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
showClose:false,
|
||||||
|
closeOnClickModal:false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
batchDelData(this.selectData);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: '取消删除',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},selectDatas(selection){
|
||||||
|
if(selection.length>0){
|
||||||
|
for(var k=0;k<selection.length;k++){
|
||||||
|
var _selection=selection[k];
|
||||||
|
_selection.opermano=(localStorage.getItem("manno")===null || localStorage.getItem("manno")==='null' || localStorage.getItem("manno")===undefined ?"test":localStorage.getItem("manno"));
|
||||||
|
_selection.opermaname=(localStorage.getItem("man")===null || localStorage.getItem("man")==='null' || localStorage.getItem("man")===undefined ?"test":localStorage.getItem("man"));
|
||||||
|
this.selectData.push(_selection);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.selectData=ref([]);
|
||||||
|
}
|
||||||
|
},selectAllData(selection){
|
||||||
|
if(selection.length>0){
|
||||||
|
for(var k=0;k<selection.length;k++){
|
||||||
|
var _selection=selection[k];
|
||||||
|
_selection.opermano=(localStorage.getItem("manno")===null || localStorage.getItem("manno")==='null' || localStorage.getItem("manno")===undefined ?"test":localStorage.getItem("manno"));
|
||||||
|
_selection.opermaname=(localStorage.getItem("man")===null || localStorage.getItem("man")==='null' || localStorage.getItem("man")===undefined ?"test":localStorage.getItem("man"));
|
||||||
|
this.selectData.push(_selection);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.selectData=ref([]);
|
||||||
|
}
|
||||||
|
},rowStyle(row,rowIndex){
|
||||||
|
if(this.doubleclikIndex===row.row.RN){
|
||||||
|
return {
|
||||||
|
"background-color":"lightcyan",
|
||||||
|
"cursor":"pointer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"cursor":"pointer"
|
||||||
|
}
|
||||||
|
},cellStyle({row,column,rowIndex,columnIndex}){
|
||||||
|
if(columnIndex ==12 || columnIndex ==2 ){
|
||||||
|
if(row.promperty==="已过期"){
|
||||||
|
return {
|
||||||
|
"color":"red"
|
||||||
|
}
|
||||||
|
}else if(row.promperty==="将到期"){
|
||||||
|
return {
|
||||||
|
"color":"orange"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"cursor":""
|
||||||
|
}
|
||||||
|
},cancelFormData(){
|
||||||
|
this.showAddCondiftion=false;
|
||||||
|
},resetFormData(){
|
||||||
|
this.$refs["whiteListAdd"].resetForm();
|
||||||
|
}, saveFormData(){
|
||||||
|
this.$refs["whiteListAdd"].validate((valid) => {
|
||||||
|
if(valid){
|
||||||
|
this.$refs["whiteListAdd"].saveData((code,msg)=>{
|
||||||
|
if(code===1){
|
||||||
|
alert(msg);
|
||||||
|
getTableDatas();
|
||||||
|
this.showAddCondiftion=false;
|
||||||
|
}else{
|
||||||
|
alert(msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},components:{
|
||||||
|
Delete,
|
||||||
|
Search,
|
||||||
|
Refresh,
|
||||||
|
Edit,
|
||||||
|
Plus,
|
||||||
|
whiteDicAdd,
|
||||||
|
whiteListBatchUpdate,
|
||||||
|
Position,
|
||||||
|
Expand,
|
||||||
|
Collection
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
_this=this;
|
||||||
|
getTableDatas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getTableDatas(){
|
||||||
|
var paramsData={
|
||||||
|
"pageSize":_this.pageSize,
|
||||||
|
"pageNum":_this.currentPage
|
||||||
|
}
|
||||||
|
getCarnoDicByPage(paramsData).then(res=>{
|
||||||
|
_this.tableLoading=false;
|
||||||
|
if(res.code<=0){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
_this.totalCount=res.total;
|
||||||
|
_this.tableData=res.records;
|
||||||
|
_this.isLoding=false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function batchDelData(delDatas){
|
||||||
|
batchDelCarnoDicDatas(delDatas).then(res=>{
|
||||||
|
_this.tableLoading=false;
|
||||||
|
if(res.code<=0){
|
||||||
|
alert(res.data);
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
alert(res.data);
|
||||||
|
getTableDatas();
|
||||||
|
_this.selectData=[];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue