fix: 优化白名单页面和安装包页面的逻辑,字段,删除多次弹窗的逻辑,控制组件显隐的判断

This commit is contained in:
张洋川 2024-04-09 14:44:39 +08:00
parent 8a0e6b5a34
commit 97cf321b57
4 changed files with 758 additions and 552 deletions

View File

@ -1,11 +1,10 @@
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
Vue.use(Router)
/* Layout */ /* Layout */
import Layout from '@/layout' import Layout from '@/layout'
Vue.use(Router)
/** /**
* Note: 路由配置项 * Note: 路由配置项
* *
@ -20,12 +19,12 @@ import Layout from '@/layout'
* roles: ['admin', 'common'] // 访问路由的角色权限 * roles: ['admin', 'common'] // 访问路由的角色权限
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限 * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
* meta : { * meta : {
noCache: true // 如果设置为true则不会被 <keep-alive> 缓存(默认 false) noCache: true // 如果设置为true则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字 title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标对应路径src/assets/icons/svg icon: 'svg-name' // 设置该路由的图标对应路径src/assets/icons/svg
breadcrumb: false // 如果设置为false则不会在breadcrumb面包屑中显示 breadcrumb: false // 如果设置为false则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。 activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
} }
*/ */
// 公共路由 // 公共路由
@ -161,12 +160,25 @@ export const dynamicRoutes = [
meta: { title: '修改生成配置', activeMenu: '/tool/gen' } meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
} }
] ]
},
{
path: '/publishLish/add',
component: Layout,
hidden: true,
children: [
{
path: 'index/:jobId(\\d+)',
component: () => import('@/views/monitor/job/log'),
name: 'PublishAdd',
meta: { title: '新建发布', activeMenu: '/FDS/publishList' }
}
]
} }
] ]
// 防止连续点击多次路由报错 // 防止连续点击多次路由报错
let routerPush = Router.prototype.push; let routerPush = Router.prototype.push
let routerReplace = Router.prototype.replace; let routerReplace = Router.prototype.replace
// push // push
Router.prototype.push = function push(location) { Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(err => err) return routerPush.call(this, location).catch(err => err)

View File

@ -1,21 +1,20 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-tabs v-model="activeTabs" type="card" @tab-click="handleClickTabs">
<el-tabs v-model="activeTabs">
<el-tab-pane <el-tab-pane
:key="item.name"
v-for="item in packTabs" v-for="item in packTabs"
:key="item.name"
:label="item.title" :label="item.title"
:name="item.name" :name="item.name"
> >
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="90px" size="small">
<el-form-item label="安装包名称" prop="installpackName"> <el-form-item label="安装包名称" prop="installpackName">
<el-input <el-input
v-model="queryParams.installpackName" v-model="queryParams.installpackName"
placeholder="请输入安装包名称"
clearable clearable
placeholder="请输入安装包名称"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -23,14 +22,14 @@
<el-form-item label="版本" prop="versions"> <el-form-item label="版本" prop="versions">
<el-input <el-input
v-model="queryParams.versions" v-model="queryParams.versions"
placeholder="请输入版本"
clearable clearable
placeholder="请输入版本"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="上传方式" prop="uploadMode"> <el-form-item label="上传方式" prop="uploadMode">
<el-select v-model="queryParams.uploadMode" placeholder="请选择上传方式" clearable> <el-select v-model="queryParams.uploadMode" clearable placeholder="请选择上传方式">
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
@ -42,16 +41,16 @@
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
style="width: 240px" end-placeholder="结束日期"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" style="width: 240px"
type="daterange"
value-format="yyyy-MM-dd"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="configType"> <el-form-item label="状态" prop="configType">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable> <el-select v-model="queryParams.status" clearable placeholder="请选择状态">
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
@ -61,7 +60,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -69,188 +68,164 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:config:add']" v-hasPermi="['system:config:add']"
>新建</el-button> icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新建
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info"
plain
icon="el-icon-plus"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:config:delete']" v-hasPermi="['system:config:delete']"
>批量删除</el-button> :disabled="multiple"
icon="el-icon-plus"
plain
size="mini"
type="info"
@click="handleDelete"
>批量删除
</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="configList" @selection-change="handleSelectionChange" v-if="activeTabs==1"> <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column align="center" type="selection" width="55"/>
<el-table-column label="安装包名称" align="center" prop="configId" /> <template v-if="activeTabs=='1'">
<el-table-column label="版本号" align="center" prop="configName" :show-overflow-tooltip="true" /> <el-table-column align="center" type="selection" width="55"/>
<el-table-column label="安装包大小" align="center" prop="configKey" :show-overflow-tooltip="true" /> <el-table-column align="center" label="离线包名称" prop="configId"/>
<el-table-column label="上传方式" align="center" prop="configValue" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="版本" prop="configName"/>
<el-table-column label="状态" align="center" prop="configType"> <el-table-column :show-overflow-tooltip="true" align="center" label="平台" prop="configValue"/>
<template slot-scope="scope"> <el-table-column :show-overflow-tooltip="true" align="center" label="创建人" prop="configValue"/>
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/> </template>
<template v-if="activeTabs=='2'">
<el-table-column align="center" label="安装包名称" prop="configId"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="版本号" prop="configName"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="安装包大小" prop="configKey"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="上传方式" prop="configValue"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="创建人" prop="configValue"/>
<el-table-column align="center" label="创建时间" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</template>
<el-table-column align="center" label="状态" prop="configType">
<template slot-scope="scopeA">
<dict-tag :options="dict.type.sys_yes_no" :value="scopeA.row.type"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建人" align="center" prop="configValue" :show-overflow-tooltip="true" /> <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="250">
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDownload(scope.row)"
v-hasPermi="['system:config:dowmload']" v-hasPermi="['system:config:dowmload']"
>下载安装包</el-button> icon="el-icon-edit"
<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" @click="handleDownload(scope.row)"
@click="handleEdit(scope.row)" >下载安装包
</el-button>
<el-button
v-hasPermi="['system:config:edit']" v-hasPermi="['system:config:edit']"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleDetail(scope.row)"
v-hasPermi="['system:config:detail']"
>详情</el-button>
<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" @click="handleEdit(scope.row)"
@click="handleDelete(scope.row)" >编辑
</el-button>
<el-button
v-hasPermi="['system:config:detail']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleDetail(scope.row)"
>详情
</el-button>
<el-button
v-hasPermi="['system:config:delete']" v-hasPermi="['system:config:delete']"
>删除</el-button> icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange" v-else>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="离线包名称" align="center" prop="configId" />
<el-table-column label="版本" align="center" prop="configName" :show-overflow-tooltip="true" />
<el-table-column label="平台" align="center" prop="configValue" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" prop="configType">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="configValue" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDownload(scope.row)"
v-hasPermi="['system:config:dowmload']"
>下载安装包</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
v-hasPermi="['system:config:edit']"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDetail(scope.row)"
v-hasPermi="['system:config:detail']"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:config:delete']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination <pagination
v-if="activeTabs==1"
v-show="total>0" v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination
v-else
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :total="total"
@pagination="getList" @pagination="getList"
/> />
<!-- 上传APP安装包的弹窗 --> <!-- 上传APP安装包的弹窗 -->
<el-dialog :title="title" :visible.sync="addOpen" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="addOpen" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="上传方式" prop="configName"> <el-form-item label="上传方式" prop="debug">
<el-radio-group v-model="form.debug"> <el-radio-group v-model="form.debug">
<el-radio <el-radio
:key="1" :key="1"
:label="在线上传" label="1"
>在线上传</el-radio> >在线上传
</el-radio>
<el-radio <el-radio
:key="2" :key="2"
:label="离线上传" label="2"
>离线上传</el-radio> >离线上传
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item :label="activeTabs==1?'安装包名称':'模块包名称'" prop="configKey"> <el-form-item :label="activeTabs=='1'?'安装包名称':'模块包名称'" prop="configKey">
<el-input v-model="form.configKey" :placeholder="activeTabs==1?'请输入安装包名称':'请输入模块包名称'" /> <el-input v-model="form.configKey" :placeholder="activeTabs=='1'?'请输入安装包名称':'请输入模块包名称'"/>
</el-form-item> </el-form-item>
<el-form-item label="版本号" prop="configName"> <el-form-item label="版本号">
<el-input v-model="form.configName" placeholder="请输入版本号" /> <el-input v-model="form.configName" placeholder="请输入版本号"/>
</el-form-item> </el-form-item>
<el-form-item label="安装包文件" prop="configName"> <el-form-item label="安装包文件">
<el-input v-model="form.configName" placeholder="请输入安装包版本号" /> <el-upload
ref="whiteListFiles"
:auto-upload="true"
:before-remove="beforeRemove"
:before-upload="beforeAvatarUpload"
:file-list="fileList"
:headers="{tokenId: tokenId}"
:multiple="false"
:on-success="handleSuccess"
accept=".zip"
action="https://jsonplaceholder.typicode.com/posts/"
class="upload"
>
<el-button slot="trigger" size="small" type="primary">上传文件</el-button>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item label="安装包大小" prop="configName"> <el-form-item label="安装包大小">
<el-input v-model="form.configName" placeholder="请输入安装包版本号" /> <el-input v-model="form.configName" placeholder="请输入安装包版本号"/>
</el-form-item> </el-form-item>
<el-form-item label="适用系统" prop="configName"> <el-form-item label="适用系统">
<el-radio-group v-model="form.debug"> <el-radio-group v-model="form.platform">
<el-radio <el-radio
:key="1" :key="1"
:label="Android" label="Android"
>Android</el-radio> >Android
</el-radio>
<el-radio <el-radio
:key="2" :key="2"
:label="鸿蒙" label="鸿蒙"
>鸿蒙</el-radio> >鸿蒙
</el-radio>
<el-radio <el-radio
:key="3" :key="3"
:label="IOS" label="IOS"
>IOS</el-radio> >IOS
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="适用模块" prop="configName" v-if="activeTabs!=1"> <el-form-item v-if="activeTabs!='1'" label="适用模块" prop="configName">
<el-select v-model="queryParams.uploadMode" placeholder="请选择对应的模块" clearable> <el-select v-model="queryParams.uploadMode" clearable placeholder="请选择对应的模块">
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
@ -262,23 +237,24 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm(2)"> </el-button> <el-button type="primary" @click="submitForm(2)"> </el-button>
<el-button @click="cancel(2)"> </el-button> <el-button @click="addOpen = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 安装包详情弹窗 --> <!-- 安装包详情弹窗 -->
<el-dialog title="安装包详情" :visible.sync="detailOpen" width="700px" append-to-body> <el-dialog :visible.sync="detailOpen" append-to-body title="安装包详情" width="700px">
<el-form ref="form" :model="form" label-width="150px" size="mini"> <el-form ref="form" :model="form" label-width="150px" size="mini">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="上传方式:">离线上传</el-form-item> <el-form-item label="上传方式:">离线上传</el-form-item>
<el-form-item <el-form-item
label="安装包名称:" label="安装包名称:"
>安装包11111</el-form-item> >安装包11111
</el-form-item>
<el-form-item label="安装包文件名称:">安装包1111.excel</el-form-item> <el-form-item label="安装包文件名称:">安装包1111.excel</el-form-item>
<el-form-item label="安装包大小:">58.1kb</el-form-item> <el-form-item label="安装包大小:">58.1kb</el-form-item>
<el-form-item label="适用系统:">安卓</el-form-item> <el-form-item label="适用系统:">安卓</el-form-item>
<el-form-item label="适用模块:" v-if="activeTabs!=1">登录模块</el-form-item> <el-form-item v-if="activeTabs!='1'" label="适用模块:">登录模块</el-form-item>
<el-form-item label="上传时间:">上传时间2024-04-07 1743</el-form-item> <el-form-item label="上传时间:">上传时间2024-04-07 1743</el-form-item>
<el-form-item label="上传状态:">已上传</el-form-item> <el-form-item label="上传状态:">已上传</el-form-item>
<el-form-item label="上传人员:">刮刮乐</el-form-item> <el-form-item label="上传人员:">刮刮乐</el-form-item>
@ -293,9 +269,10 @@
</div> </div>
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"; import { addConfig, delConfig, getConfig, listConfig, updateConfig } from '@/api/system/config'
export default { export default {
name: "installationList", name: 'installationList',
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
data() { data() {
return { return {
@ -312,13 +289,20 @@ export default {
// //
total: 0, total: 0,
// //
dataList: [],
configList: [], configList: [],
// //
title: "", title: '',
// //
addOpen: false, addOpen: false,
// //
detailOpen:false, detailOpen: false,
tokenId: '',
//
fileList: [],
// //
dateRange: [], dateRange: [],
// //
@ -334,46 +318,58 @@ export default {
// //
rules: { rules: {
configName: [ configName: [
{ required: true, message: "上传方式不能为空", trigger: "change" } { required: true, message: '上传方式不能为空', trigger: 'change' }
], ],
configKey: [ configKey: [
{ required: true, message: "安装包名称不能为空", trigger: "blur" } { required: true, message: '安装包名称不能为空', trigger: 'blur' }
], ]
}, },
// 1=APP2=H5 // 1=APP2=H5
activeTabs:1, activeTabs: '1',
packTabs:[{ packTabs: [{
name:1, name: '1',
title:'APP安装包' title: 'APP安装包'
},{ }, {
name:2, name: '2',
title: 'H5模块包' title: 'H5模块包'
}] }]
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList() { getList() {
this.loading = true; this.loading = true
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows; this.dataList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 查询参数列表 */
getConfigList() {
this.loading = true
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows
this.total = response.total
this.loading = false
}
)
},
// //
cancel(type) { cancel(type) {
if (type===1){ if (type === 1) {
this.addOpen= false this.addOpen = false
}else { } else {
this.configOpen = false this.configOpen = false
} }
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -382,70 +378,121 @@ export default {
configName: undefined, configName: undefined,
configKey: undefined, configKey: undefined,
configValue: undefined, configValue: undefined,
configType: "Y", configType: 'Y',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.addOpen = true; this.addOpen = true
this.title = "上传安装包"; this.title = '上传安装包'
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.configId) this.ids = selection.map(item => item.configId)
this.single = selection.length!=1 this.single = selection.length != 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.configId != undefined) { if (this.form.configId != undefined) {
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功')
this.addOpen = false; this.addOpen = false
this.getList(); this.getList()
}); })
} else { } else {
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功')
this.addOpen = false; this.addOpen = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const configIds = row.configId || this.ids; const configIds = row.configId || this.ids
this.$modal.confirm('是否确认删除编号为"' + configIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除编号为"' + configIds + '"的数据项?').then(function() {
return delConfig(configIds); return delConfig(configIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {
})
}, },
/** 修改按钮操作 */
handleEdit(row) {
this.reset()
const configId = row.configId || this.ids
getConfig(configId).then(response => {
this.form = response.data
this.addOpen = true
this.title = '修改安装包'
})
},
/** 查看详情弹窗 **/ /** 查看详情弹窗 **/
handleDetail() { handleDetail() {
this.detailOpen = true; this.detailOpen = true
},
/** 在上传之前进行校验 */
beforeAvatarUpload(file) {
const formatList = file.name.split('.')
const isFormat = formatList[formatList.length - 1] === 'zip'
if (!isFormat) {
this.$message.error(`上传格式只能是名称后缀为.zip的压缩文件!`)
}
},
/** 上传文件 */
handleSuccess(file) {
this.fileList = []
const nameList = file.context.path.split('/')
this.fileList.push({
name: file.context.name || nameList[nameList.length - 1],
url: file.context.path
})
this.addFormData.path = file.context.path
},
beforeRemove(files, filesList) {
return this.$confirm(`确定要移除${files.name}`)
},
/** 切换TAB触发的事件 */
handleClickTabs(e) {
this.getList()
},
/** 下载按钮 */
handleDownload(row) {
const configIds = row.configId || this.ids
this.$modal.confirm('是否确认下载编号为"' + configIds + '"的数据项?').then(function() {
return delConfig(configIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess('下载成功')
}).catch(() => {
})
} }
} }
}; }
</script> </script>

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="90px" size="small">
<el-form-item label="选择APP" prop="configName"> <el-form-item label="选择APP" prop="configName">
<el-select v-model="queryParams.configType" placeholder="请选择APP" clearable> <el-select v-model="queryParams.configType" clearable placeholder="请选择APP">
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
@ -14,8 +14,8 @@
<el-form-item label="版本号" prop="version"> <el-form-item label="版本号" prop="version">
<el-input <el-input
v-model="queryParams.version" v-model="queryParams.version"
placeholder="请输入版本号"
clearable clearable
placeholder="请输入版本号"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -24,18 +24,18 @@
<el-form-item label="公开时间"> <el-form-item label="公开时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
style="width: 240px" end-placeholder="结束日期"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" style="width: 240px"
type="daterange"
value-format="yyyy-MM-dd"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="configType"> <el-form-item label="状态" prop="configType">
<el-select v-model="queryParams.configType" placeholder="请选择状态" clearable> <el-select v-model="queryParams.configType" clearable placeholder="请选择状态">
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
@ -45,7 +45,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -53,84 +53,90 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
v-hasPermi="['system:config:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary" type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:config:add']" >新增
>新增</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info" :disabled="multiple"
plain
icon="el-icon-plus" icon="el-icon-plus"
plain
size="mini" size="mini"
type="info"
@click="handlePublish" @click="handlePublish"
>批量发布</el-button> >批量发布
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info"
plain
icon="el-icon-plus"
size="mini"
@click="handleDelete"
v-hasPermi="['system:config:add']" v-hasPermi="['system:config:add']"
>批量删除</el-button> :disabled="multiple"
icon="el-icon-plus"
plain
size="mini"
type="info"
@click="handleDelete"
>批量删除
</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="configList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column align="center" type="selection" width="55"/>
<el-table-column label="APP" align="center" prop="configId" /> <el-table-column align="center" label="APP" prop="configId"/>
<el-table-column label="文件类型" align="center" prop="configName" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="文件类型" prop="configName"/>
<el-table-column label="版本号" align="center" prop="version" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="版本号" prop="version"/>
<el-table-column label="子版本号" align="center" prop="configValue" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="子版本号" prop="configValue"/>
<el-table-column <el-table-column
prop="platform"
label="系统" label="系统"
min-width="80" min-width="80"
> <template scope="scope"> prop="platform"
<div>{{ scope.row.platform === '0'?'安卓':'IOS' }}</div> >
</template> <template scope="scope">
<div>{{ scope.row.platform === '0' ? '安卓' : 'IOS' }}</div>
</template>
</el-table-column> </el-table-column>
<el-table-column label="公开版" align="center" prop="createTime" width="180"> <el-table-column align="center" label="公开版" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="tagsView" class="drawer-switch" disabled/> <el-switch v-model="scope.row.tagsView" class="drawer-switch" disabled/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="强制更新" align="center" prop="createTime" width="180"> <el-table-column align="center" label="强制更新" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="tagsView" class="drawer-switch" disabled/> <el-switch v-model="scope.row.tagsView" class="drawer-switch" disabled/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上传时间" align="center" prop="createTime" width="180"> <el-table-column align="center" label="上传时间" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="发布环境" align="center" prop="configValue" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="发布环境" prop="configValue"/>
<el-table-column label="发布状态" align="center" prop="configType"> <el-table-column align="center" label="发布状态" prop="configType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/> <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="公开时间" align="center" prop="createTime" width="180"> <el-table-column align="center" label="公开时间" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="更新说明" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="更新说明" prop="remark"/>
<el-table-column <el-table-column
align="center" align="center"
label="二维码" label="二维码"
@ -147,121 +153,124 @@
<img :src="'data:image/jpg;base64,'+ scope.row.qrCode"> <img :src="'data:image/jpg;base64,'+ scope.row.qrCode">
<p v-if="scopeC.row.verifyCode">密码:{{ scope.row.verifyCode }}</p> <p v-if="scopeC.row.verifyCode">密码:{{ scope.row.verifyCode }}</p>
</div> </div>
<!-- <img slot="reference" src="@/assets/code.png" class="table-qr">--> <!-- <img slot="reference" src="@/assets/code.png" class="table-qr">-->
</el-popover> </el-popover>
<div v-else>-</div> <div v-else>-</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']" v-hasPermi="['system:config:edit']"
>下架</el-button> icon="el-icon-bottom"
<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" @click="handleDown(scope.row)"
@click="handleUpdate(scope.row)" >下架
</el-button>
<el-button
v-hasPermi="['system:config:edit']" v-hasPermi="['system:config:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>详情</el-button>
<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" @click="handleEdit(scope.row)"
@click="handleUpdate(scope.row)" >修改
v-hasPermi="['system:config:edit']" </el-button>
>下载安装包</el-button> <el-dropdown size="mini"
<el-button @command="(command) => handleCommand(command, scope.row)"
size="mini" >
type="text" <el-button icon="el-icon-d-arrow-right" size="mini" type="text">更多</el-button>
icon="el-icon-delete" <el-dropdown-menu slot="dropdown">
@click="handleDelete(scope.row)" <el-dropdown-item v-hasPermi="['system:user:resetPwd']" command="handleDetail"
v-hasPermi="['system:config:remove']" icon="el-icon-view"
>删除</el-button> >详情
</el-dropdown-item>
<el-dropdown-item v-hasPermi="['system:user:edit']" command="handleDownload"
icon="el-icon-download"
>下载安装包
</el-dropdown-item>
<el-dropdown-item v-hasPermi="['system:user:edit']" command="handleDelete"
icon="el-icon-delete"
>删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList" @pagination="getList"
/> />
<!-- 新增白名单弹出框 --> <!-- 新增白名单弹出框 -->
<el-dialog :title="title" :visible.sync="addOpen" width="500px" append-to-body> <!-- <el-dialog :title="title" :visible.sync="addOpen" append-to-body width="500px">-->
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px">-->
<el-form-item label="白名单名称" prop="configName"> <!-- <el-form-item label="白名单名称" prop="configName">-->
<el-input v-model="form.configName" placeholder="请输入参数名称" /> <!-- <el-input v-model="form.configName" placeholder="请输入参数名称"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="白名单类型" prop="configKey"> <!-- <el-form-item label="白名单类型" prop="configKey">-->
<el-input v-model="form.configKey" placeholder="请输入参数键名" /> <!-- <el-input v-model="form.configKey" placeholder="请输入参数键名"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="备注" prop="remark"> <!-- <el-form-item label="备注" prop="remark">-->
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <!-- <el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> <!-- </el-form>-->
<div slot="footer" class="dialog-footer"> <!-- <div slot="footer" class="dialog-footer">-->
<el-button type="primary" @click="submitForm(1)"> </el-button> <!-- <el-button type="primary" @click="submitForm(1)"> </el-button>-->
<el-button @click="cancel(1)"> </el-button> <!-- <el-button @click="cancel(1)"> </el-button>-->
</div> <!-- </div>-->
</el-dialog> <!-- </el-dialog>-->
<!-- 白名单配置弹出框 --> <!-- 白名单配置弹出框 -->
<el-dialog :title="title" :visible.sync="configOpen" width="500px" append-to-body> <!-- <el-dialog :title="title" :visible.sync="configOpen" append-to-body width="500px">-->
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px">-->
<el-form-item label="添加方式" prop="configName"> <!-- <el-form-item label="添加方式" prop="configName">-->
<el-radio-group v-model="form.debug"> <!-- <el-radio-group v-model="form.debug">-->
<el-radio <!-- <el-radio-->
:key="1" <!-- :key="1"-->
:label="手动添加" <!-- :label="手动添加"-->
>手动添加</el-radio> <!-- >手动添加-->
<el-radio <!-- </el-radio>-->
:key="2" <!-- <el-radio-->
:label="批量添加" <!-- :key="2"-->
>批量添加</el-radio> <!-- :label="批量添加"-->
<!-- >批量添加-->
<!-- </el-radio>-->
</el-radio-group> <!-- </el-radio-group>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="白名单类型" prop="configKey"> <!-- <el-form-item label="白名单类型" prop="configKey">-->
<el-input v-model="form.configKey" placeholder="请选择白名单类型" /> <!-- <el-input v-model="form.configKey" placeholder="请选择白名单类型"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="白名单ID" prop="configName"> <!-- <el-form-item label="白名单ID" prop="configName">-->
<el-input v-model="form.configName" placeholder="输入用户ID" /> <!-- <el-input v-model="form.configName" placeholder="输入用户ID"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="备注" prop="remark"> <!-- <el-form-item label="备注" prop="remark">-->
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" /> <!-- <el-input v-model="form.remark" placeholder="请输入备注" type="textarea"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> <!-- </el-form>-->
<div slot="footer" class="dialog-footer"> <!-- <div slot="footer" class="dialog-footer">-->
<el-button type="primary" @click="submitForm(2)"> </el-button> <!-- <el-button type="primary" @click="submitForm(2)"> </el-button>-->
<el-button @click="cancel(2)"> </el-button> <!-- <el-button @click="cancel(2)"> </el-button>-->
</div> <!-- </div>-->
</el-dialog> <!-- </el-dialog>-->
</div> </div>
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"; import { addConfig, delConfig, getConfig, listConfig, updateConfig } from '@/api/system/config'
export default { export default {
name: "Config", name: 'Config',
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
data() { data() {
return { return {
@ -280,11 +289,11 @@ export default {
// //
configList: [], configList: [],
// //
title: "", title: '',
// //
addOpen: false, addOpen: false,
// //
configOpen:false, configOpen: false,
// //
dateRange: [], dateRange: [],
// //
@ -300,39 +309,39 @@ export default {
// //
rules: { rules: {
configName: [ configName: [
{ required: true, message: "参数名称不能为空", trigger: "blur" } { required: true, message: '参数名称不能为空', trigger: 'blur' }
], ],
configKey: [ configKey: [
{ required: true, message: "参数键名不能为空", trigger: "blur" } { required: true, message: '参数键名不能为空', trigger: 'blur' }
], ],
configValue: [ configValue: [
{ required: true, message: "参数键值不能为空", trigger: "blur" } { required: true, message: '参数键值不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList() { getList() {
this.loading = true; this.loading = true
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows; this.configList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
cancel(type) { cancel(type) {
if (type===1){ if (type === 1) {
this.addOpen= false this.addOpen = false
}else { } else {
this.configOpen = false this.configOpen = false
} }
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -341,89 +350,118 @@ export default {
configName: undefined, configName: undefined,
configKey: undefined, configKey: undefined,
configValue: undefined, configValue: undefined,
configType: "Y", configType: 'Y',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
// this.addOpen = true; // 使ES6+
// this.title = ""; this.reset()
const type= 'add' const type = 'add'
this.$router.push("publishList/add" + type); this.$router.push({
name: 'PublishAdd'
})
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.configId) this.ids = selection.map(item => item.configId)
this.single = selection.length!=1 this.single = selection.length != 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const configId = row.configId || this.ids const configId = row.configId || this.ids
getConfig(configId).then(response => { getConfig(configId).then(response => {
this.form = response.data; this.form = response.data
this.addOpen = true; this.addOpen = true
this.title = "修改白名单"; this.title = '修改白名单'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.configId != undefined) { if (this.form.configId != undefined) {
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功')
this.addOpen = false; this.addOpen = false
this.getList(); this.getList()
}); })
} else { } else {
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功')
this.addOpen = false; this.addOpen = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { async handleDelete(row) {
const configIds = row.configId || this.ids; const configIds = row.configId || this.ids
this.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function() { try {
return delConfig(configIds); await this.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?')
}).then(() => { await delConfig(configIds)
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功')
}).catch(() => {}); } catch (error) {
console.error('删除失败', error)
//
}
}, },
// /** */ /**查看详情*/
// handleExport() { handleDetail() {
// this.download('system/config/export', {
// ...this.queryParams },
// }, `config_${new Date().getTime()}.xlsx`) /**下载安装包*/
// }, handleDownload() {
// /** */
// handleRefreshCache() { },
// refreshCache().then(() => { /**********编辑*******/
// this.$modal.msgSuccess(""); handleEdit() {
// });
// } },
/** 发布操作*/
handlePublish() {
},
//
handleCommand(command, row) {
switch (command) {
case 'handleDetail':
this.handleDetail(row)
break
case 'handleDownload':
this.handleDownload(row)
break
case 'handleDelete':
this.handleDelete(row)
break
default:
break
}
}
} }
}; }
</script> </script>

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="90px" size="small">
<el-form-item label="名单类型" prop="whiteListType"> <el-form-item label="名单类型" prop="whiteListType">
<el-input <el-input
v-model="queryParams.whiteListType" v-model="queryParams.whiteListType"
placeholder="请输入名单类型"
clearable clearable
placeholder="请输入名单类型"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -13,8 +13,8 @@
<el-form-item label="名称" prop="whiteListName"> <el-form-item label="名称" prop="whiteListName">
<el-input <el-input
v-model="queryParams.whiteListName" v-model="queryParams.whiteListName"
placeholder="请输入名称"
clearable clearable
placeholder="请输入名称"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -22,16 +22,16 @@
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
style="width: 240px" end-placeholder="结束日期"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" style="width: 240px"
type="daterange"
value-format="yyyy-MM-dd"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="configType"> <el-form-item label="状态" prop="configType">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable> <el-select v-model="queryParams.status" clearable placeholder="请选择状态">
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
@ -41,7 +41,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -49,115 +49,136 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:config:add']" v-hasPermi="['system:config:add']"
>新增</el-button> icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info"
plain
icon="el-icon-plus"
size="mini"
:disabled="multiple" :disabled="multiple"
icon="el-icon-plus"
plain
size="mini"
type="info"
@click="handlePublish" @click="handlePublish"
>批量发布</el-button> >批量发布
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info"
plain
icon="el-icon-plus"
size="mini"
:disabled="multiple" :disabled="multiple"
icon="el-icon-plus"
plain
size="mini"
type="info"
@click="handleDelete" @click="handleDelete"
>批量删除</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="configList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column align="center" type="selection" width="55"/>
<el-table-column label="白名单名称" align="center" prop="configId" /> <el-table-column align="center" label="白名单名称" prop="configId"/>
<el-table-column label="说明" align="center" prop="configName" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="说明" prop="configName"/>
<el-table-column label="白名单类型" align="center" prop="configKey" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="白名单类型" prop="configKey"/>
<el-table-column label="数量" align="center" prop="configValue" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="数量" prop="configValue"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column align="center" label="创建时间" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="configType"> <el-table-column align="center" label="状态" prop="configType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/> <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column :show-overflow-tooltip="true" align="center" label="备注" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini"
type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>下架</el-button>
<el-button
size="mini" size="mini"
type="text" type="text"
@click="handleDown(scope.row)"
>下架
</el-button>
<el-button
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>预览</el-button>
<el-button
size="mini" size="mini"
type="text" type="text"
@click="handleView(scope.row)"
>预览
</el-button>
<el-button
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>发布</el-button>
<el-button
size="mini" size="mini"
type="text" type="text"
@click="handlePublish(scope.row)"
>发布
</el-button>
<el-button
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>修改</el-button>
<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" @click="handleConfig(scope.row)"
@click="handleDelete(scope.row)" >名单配置
</el-button>
<el-button
v-hasPermi="['system:config:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleEdit(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:config:remove']" v-hasPermi="['system:config:remove']"
>删除</el-button> icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList" @pagination="getList"
/> />
<!-- 新增白名单弹出框 --> <!-- 新增白名单弹出框 -->
<el-dialog :title="title" :visible.sync="addOpen" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="addOpen" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="白名单名称" prop="configName"> <el-form-item label="白名单名称" prop="whiteListName">
<el-input v-model="form.whiteListName" placeholder="请输入白名单名称" /> <el-input v-model="form.whiteListName" placeholder="请输入白名单名称"/>
</el-form-item> </el-form-item>
<el-form-item label="白名单类型" prop="configKey"> <el-form-item label="白名单类型" prop="whiteListType">
<el-input v-model="form.whiteListType" placeholder="请选择白名单类型" /> <el-select v-model="form.whiteListType" clearable placeholder="请选择白名单类型">
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -166,28 +187,45 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 白名单配置弹出框 --> <!-- 白名单配置弹出框 -->
<el-dialog :title="title" :visible.sync="configOpen" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="configOpen" append-to-body width="500px">
<el-form ref="form" :model="configForm" :rules="configRules" label-width="80px"> <el-form ref="form" :model="configForm" :rules="configRules" label-width="120px">
<el-form-item label="添加方式" prop="configName"> <el-form-item label="添加方式" prop="configName">
<el-radio-group v-model="configForm.addMode"> <el-radio-group v-model="configForm.addMode">
<el-radio <el-radio
:key="1" :label="1"
:label="手动添加" >手动添加
>手动添加</el-radio> </el-radio>
<el-radio <el-radio
:key="2" :label="2"
:label="批量添加" >批量添加
>批量添加</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="白名单类型" prop="whiteListType"> <el-form-item label="白名单类型" prop="whiteListType">
<el-input v-model="form.whiteListType" placeholder="请选择白名单类型" /> <el-input v-model="configForm.whiteListType" placeholder="请选择白名单类型"/>
</el-form-item> </el-form-item>
<el-form-item label="白名单ID" prop="whitelistIds"> <el-form-item v-if="configForm.addMode==1" label="白名单ID" prop="whitelistIds">
<el-input v-model="form.whitelistIds" type="textarea" placeholder="请输入用户ID" /> <el-input v-model="configForm.whitelistIds" placeholder="请输入白名单ID" type="textarea"/>
</el-form-item>
<el-form-item v-else-if="configForm.addMode==2" label="白名单文件">
<el-upload
ref="whiteListFiles"
:auto-upload="true"
:before-remove="beforeRemove"
:before-upload="beforeAvatarUpload"
:file-list="fileList"
:headers="{tokenId: tokenId}"
:multiple="false"
:on-success="handleSuccess"
accept=".txt"
action="https://jsonplaceholder.typicode.com/posts/"
class="upload"
>
<el-button slot="trigger" size="small" type="primary">上传文件</el-button>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" /> <el-input v-model="configForm.remark" placeholder="请输入备注" type="textarea"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -199,12 +237,10 @@
</template> </template>
<script> <script>
import { addConfig, delConfig, getConfig, updateConfig } from '@/api/system/config' import { addConfig, delConfig, getConfig, listConfig, updateConfig } from '@/api/system/config'
import { Document11691998078000list } from '@/api/FDS/whiteList'
export default { export default {
name: "WhiteList", name: 'WhiteList',
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
data() { data() {
return { return {
@ -223,11 +259,11 @@ export default {
// //
configList: [], configList: [],
// //
title: "", title: '',
// //
addOpen: false, addOpen: false,
// //
configOpen:false, configOpen: false,
// //
dateRange: [], dateRange: [],
// //
@ -236,58 +272,63 @@ export default {
pageSize: 10, pageSize: 10,
whiteListName: undefined, whiteListName: undefined,
whiteListType: undefined, whiteListType: undefined,
status:undefined status: undefined
}, },
// //
form: {}, form: {},
// //
configForm: {}, configForm: {
addMode: 1,
whiteListType: undefined,
whitelistIds: undefined,
remark: undefined
},
// //
rules: { rules: {
whiteListName: [ whiteListName: [
{ required: true, message: "白名单名称不能为空", trigger: "blur" } { required: true, message: '白名单名称不能为空', trigger: 'blur' }
], ],
whiteListType: [ whiteListType: [
{ required: true, message: "白名单类型不能为空", trigger: "change" } { required: true, message: '白名单类型不能为空', trigger: 'change' }
], ]
}, },
// //
configRules: { configRules: {
addMode: [ addMode: [
{ required: true, message: "添加方式不能为空", trigger: "change" } { required: true, message: '添加方式不能为空', trigger: 'change' }
], ],
whiteListType: [ whiteListType: [
{ required: true, message: "白名单类型不能为空", trigger: "change" } { required: true, message: '白名单类型不能为空', trigger: 'change' }
], ],
whitelistIds: [ whitelistIds: [
{ required: true, message: "白名单名称不能为空", trigger: "blur" } { required: true, message: '白名单名称不能为空', trigger: 'blur' }
], ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList() { getList() {
this.loading = true; this.loading = true
Document11691998078000list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows; this.configList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
cancel(type) { cancel(type) {
if (type===1){ if (type === 1) {
this.addOpen= false this.addOpen = false
}else { } else {
this.configOpen = false this.configOpen = false
} }
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -296,100 +337,168 @@ export default {
configName: undefined, configName: undefined,
configKey: undefined, configKey: undefined,
configValue: undefined, configValue: undefined,
configType: "Y", configType: 'Y',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.addOpen = true; this.addOpen = true
this.title = "新增白名单"; this.title = '新增白名单'
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.configId) this.ids = selection.map(item => item.configId)
this.single = selection.length!=1 this.single = selection.length != 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleEdit(row) {
this.reset(); this.reset()
const configId = row.configId || this.ids const configId = row.configId || this.ids
getConfig(configId).then(response => { getConfig(configId).then(response => {
this.form = response.data; this.form = response.data
this.addOpen = true; this.addOpen = true
this.title = "修改白名单"; this.title = '修改白名单'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitAddForm: function() { submitAddForm: function() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.configId != undefined) { if (this.form.configId != undefined) {
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功')
this.addOpen = false; this.addOpen = false
this.getList(); this.getList()
}); })
} else { } else {
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功')
this.addOpen = false; this.addOpen = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 白名单配置提交 **/ /** 白名单配置提交 **/
submitConfigForm:function() { submitConfigForm: function() {
this.$refs["configForm"].validate(valid => { this.$refs['configForm'].validate(valid => {
if (valid) { if (valid) {
addConfig(this.configForm).then(response => { addConfig(this.configForm).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功')
this.configOpen = false; this.configOpen = false
this.getList(); this.getList()
}); })
} }
}); })
}, },
/** 白名单配置弹窗 **/
handleConfig(row) {
this.reset()
const configId = row.configId || this.ids
getConfig(configId).then(response => {
this.configForm = response.data
this.configForm.addMode = 1
this.configOpen = true
this.title = '白名单配置'
})
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const configIds = row.configId || this.ids; const configIds = row.configId || this.ids
this.$modal.confirm('是否确认删除编号为"' + configIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除编号为"' + configIds + '"的数据项?').then(function() {
return delConfig(configIds); return delConfig(configIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {
})
}, },
/** 发布按钮操作 */ /** 发布按钮操作 */
handlePublish() { handlePublish() {
const configIds = row.configId || this.ids; const configIds = row.configId || this.ids
this.$modal.confirm('是否确认发布编号为"' + configIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认发布编号为"' + configIds + '"的数据项?').then(function() {
return delConfig(configIds);
//
return delConfig(configIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("发布成功"); this.$modal.msgSuccess('发布成功')
}).catch(() => {}); }).catch(() => {
})
},
/** 下架按钮操作 */
handleDown() {
const configIds = row.configId || this.ids
this.$modal.confirm('是否确认下架编号为"' + configIds + '"的数据项?').then(function() {
//
return delConfig(configIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess('下架成功')
}).catch(() => {
})
},
/** 预览按钮操作 */
handleView() {
const configIds = row.configId || this.ids
this.$modal.confirm('是否确认预览编号为"' + configIds + '"的数据项?').then(function() {
//
return delConfig(configIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess('预览成功')
}).catch(() => {
})
},
/** 在上传之前进行校验 */
beforeAvatarUpload(file) {
const formatList = file.name.split('.')
const isFormat = file.type === 'text/plain' || formatList[formatList.length - 1] === 'txt'
if (!isFormat) {
this.$message.error(`上传格式只能是名称后缀为.txt的文本文件!`)
}
const isLt2M = file.size / 1024 / 1024 < 5
if (!isLt2M) {
this.$message.error(`上传文件大小不能超过5M!`)
}
return isLt2M && isFormat
},
/** 上传文件 */
handleSuccess(file) {
this.fileList = []
const nameList = file.context.path.split('/')
this.fileList.push({
name: file.context.name || nameList[nameList.length - 1],
url: file.context.path
})
this.addFormData.path = file.context.path
},
beforeRemove(files, filesList) {
return this.$confirm(`确定要移除${files.name}`)
} }
} }
}; }
</script> </script>