Merge branch 'master-dev' of http://git.hivekion.com:3000/xiaoguangbin/AnalysisSystemForRadionuclide_vue into master-dev
This commit is contained in:
commit
779acbab5c
|
@ -6,7 +6,8 @@
|
||||||
:arrowPointAtCenter="true"
|
:arrowPointAtCenter="true"
|
||||||
overlayClassName="header-notice-wrapper"
|
overlayClassName="header-notice-wrapper"
|
||||||
@visibleChange="handleHoverChange"
|
@visibleChange="handleHoverChange"
|
||||||
:overlayStyle="{ width: '300px', top: '50px' }">
|
:overlayStyle="{ width: '300px', top: '50px' }"
|
||||||
|
>
|
||||||
<template slot="content">
|
<template slot="content">
|
||||||
<a-spin :spinning="loadding">
|
<a-spin :spinning="loadding">
|
||||||
<a-tabs>
|
<a-tabs>
|
||||||
|
@ -30,17 +31,21 @@
|
||||||
</a-list>-->
|
</a-list>-->
|
||||||
<a-list>
|
<a-list>
|
||||||
<a-list-item :key="index" v-for="(record, index) in announcement1">
|
<a-list-item :key="index" v-for="(record, index) in announcement1">
|
||||||
<div style="margin-left: 5%;width: 80%">
|
<div style="margin-left: 5%; width: 80%">
|
||||||
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
|
<p>
|
||||||
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p>
|
<a @click="showAnnouncement(record)">{{ record.titile }}</a>
|
||||||
|
</p>
|
||||||
|
<p style="color: #c9f6f6; margin-bottom: 0px">{{ record.createTime }} 发布</p>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
|
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
|
||||||
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange">重要消息</a-tag>
|
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange"
|
||||||
|
>重要消息</a-tag
|
||||||
|
>
|
||||||
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>
|
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>
|
||||||
</div>
|
</div>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
<div style="margin-top: 5px;text-align: center">
|
<div style="margin-top: 5px; text-align: center">
|
||||||
<a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>
|
<a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>
|
||||||
</div>
|
</div>
|
||||||
</a-list>
|
</a-list>
|
||||||
|
@ -48,17 +53,21 @@
|
||||||
<a-tab-pane :tab="msg2Title" key="2">
|
<a-tab-pane :tab="msg2Title" key="2">
|
||||||
<a-list>
|
<a-list>
|
||||||
<a-list-item :key="index" v-for="(record, index) in announcement2">
|
<a-list-item :key="index" v-for="(record, index) in announcement2">
|
||||||
<div style="margin-left: 5%;width: 80%">
|
<div style="margin-left: 5%; width: 80%">
|
||||||
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
|
<p>
|
||||||
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p>
|
<a @click="showAnnouncement(record)">{{ record.titile }}</a>
|
||||||
|
</p>
|
||||||
|
<p style="color: #c9f6f6; margin-bottom: 0px">{{ record.createTime }} 发布</p>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
|
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
|
||||||
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange">重要消息</a-tag>
|
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange"
|
||||||
|
>重要消息</a-tag
|
||||||
|
>
|
||||||
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>
|
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>
|
||||||
</div>
|
</div>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
<div style="margin-top: 5px;text-align: center">
|
<div style="margin-top: 5px; text-align: center">
|
||||||
<a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>
|
<a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>
|
||||||
</div>
|
</div>
|
||||||
</a-list>
|
</a-list>
|
||||||
|
@ -68,291 +77,297 @@
|
||||||
</template>
|
</template>
|
||||||
<span @click="fetchNotice" class="header-notice">
|
<span @click="fetchNotice" class="header-notice">
|
||||||
<a-badge :count="msgTotal">
|
<a-badge :count="msgTotal">
|
||||||
<img src="@/assets/images/header/notice.png" alt="">
|
<img src="@/assets/images/header/notice.png" alt="" />
|
||||||
</a-badge>
|
</a-badge>
|
||||||
</span>
|
</span>
|
||||||
<show-announcement ref="ShowAnnouncement" @ok="modalFormOk"></show-announcement>
|
<show-announcement ref="ShowAnnouncement" @ok="modalFormOk"></show-announcement>
|
||||||
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>
|
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData" />
|
||||||
</a-popover>
|
</a-popover>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAction,putAction } from '@/api/manage'
|
import { getAction, putAction } from '@/api/manage'
|
||||||
import ShowAnnouncement from './ShowAnnouncement'
|
import ShowAnnouncement from './ShowAnnouncement'
|
||||||
import store from '@/store/'
|
import store from '@/store/'
|
||||||
import DynamicNotice from './DynamicNotice'
|
import DynamicNotice from './DynamicNotice'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "HeaderNotice",
|
name: 'HeaderNotice',
|
||||||
components: {
|
components: {
|
||||||
DynamicNotice,
|
DynamicNotice,
|
||||||
ShowAnnouncement,
|
ShowAnnouncement,
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
loadding: false,
|
loadding: false,
|
||||||
url:{
|
url: {
|
||||||
listCementByUser:"/sys/annountCement/listByUser",
|
listCementByUser: '/sys/annountCement/listByUser',
|
||||||
editCementSend:"/sys/sysAnnouncementSend/editByAnntIdAndUserId",
|
editCementSend: '/sys/sysAnnouncementSend/editByAnntIdAndUserId',
|
||||||
queryById:"/sys/annountCement/queryById",
|
queryById: '/sys/annountCement/queryById',
|
||||||
},
|
|
||||||
hovered: false,
|
|
||||||
announcement1:[],
|
|
||||||
announcement2:[],
|
|
||||||
msg1Count:"0",
|
|
||||||
msg2Count:"0",
|
|
||||||
msg1Title:"通知(0)",
|
|
||||||
msg2Title:"",
|
|
||||||
stopTimer:false,
|
|
||||||
websock: null,
|
|
||||||
lockReconnect:false,
|
|
||||||
//websocket错误连接次数
|
|
||||||
wsConnectErrorTime:1,
|
|
||||||
heartCheck:null,
|
|
||||||
formData:{},
|
|
||||||
openPath:''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed:{
|
|
||||||
msgTotal () {
|
|
||||||
return parseInt(this.msg1Count)+parseInt(this.msg2Count);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.loadData();
|
|
||||||
//this.timerFun();
|
|
||||||
this.initWebSocket();
|
|
||||||
// this.heartCheckFun();
|
|
||||||
},
|
|
||||||
destroyed: function () { // 离开页面生命周期函数
|
|
||||||
this.websocketOnclose();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
timerFun() {
|
|
||||||
this.stopTimer = false;
|
|
||||||
let myTimer = setInterval(()=>{
|
|
||||||
// 停止定时器
|
|
||||||
if (this.stopTimer == true) {
|
|
||||||
clearInterval(myTimer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loadData()
|
|
||||||
},6000)
|
|
||||||
},
|
},
|
||||||
loadData (){
|
hovered: false,
|
||||||
try {
|
announcement1: [],
|
||||||
// 获取系统消息
|
announcement2: [],
|
||||||
getAction(this.url.listCementByUser).then((res) => {
|
msg1Count: '0',
|
||||||
if (res.success) {
|
msg2Count: '0',
|
||||||
this.announcement1 = res.result.anntMsgList;
|
msg1Title: '通知(0)',
|
||||||
this.msg1Count = res.result.anntMsgTotal;
|
msg2Title: '',
|
||||||
this.msg1Title = "通知(" + res.result.anntMsgTotal + ")";
|
stopTimer: false,
|
||||||
this.announcement2 = res.result.sysMsgList;
|
websock: null,
|
||||||
this.msg2Count = res.result.sysMsgTotal;
|
lockReconnect: false,
|
||||||
this.msg2Title = "系统消息(" + res.result.sysMsgTotal + ")";
|
//websocket错误连接次数
|
||||||
}
|
wsConnectErrorTime: 1,
|
||||||
}).catch(error => {
|
heartCheck: null,
|
||||||
console.log("系统消息通知异常",error);//这行打印permissionName is undefined
|
formData: {},
|
||||||
this.stopTimer = true;
|
openPath: '',
|
||||||
console.log("清理timer");
|
}
|
||||||
});
|
},
|
||||||
} catch (err) {
|
computed: {
|
||||||
this.stopTimer = true;
|
msgTotal() {
|
||||||
console.log("通知异常",err);
|
return parseInt(this.msg1Count) + parseInt(this.msg2Count)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
fetchNotice () {
|
mounted() {
|
||||||
if (this.loadding) {
|
this.loadData()
|
||||||
this.loadding = false
|
//this.timerFun();
|
||||||
|
this.initWebSocket()
|
||||||
|
// this.heartCheckFun();
|
||||||
|
},
|
||||||
|
destroyed: function () {
|
||||||
|
// 离开页面生命周期函数
|
||||||
|
this.websocketOnclose()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
timerFun() {
|
||||||
|
this.stopTimer = false
|
||||||
|
let myTimer = setInterval(() => {
|
||||||
|
// 停止定时器
|
||||||
|
if (this.stopTimer == true) {
|
||||||
|
clearInterval(myTimer)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.loadding = true
|
this.loadData()
|
||||||
setTimeout(() => {
|
}, 6000)
|
||||||
this.loadding = false
|
},
|
||||||
}, 200)
|
loadData() {
|
||||||
},
|
try {
|
||||||
showAnnouncement(record){
|
// 获取系统消息
|
||||||
putAction(this.url.editCementSend,{anntId:record.id}).then((res)=>{
|
getAction(this.url.listCementByUser)
|
||||||
if(res.success){
|
.then((res) => {
|
||||||
this.loadData();
|
if (res.success) {
|
||||||
}
|
this.announcement1 = res.result.anntMsgList
|
||||||
});
|
this.msg1Count = res.result.anntMsgTotal
|
||||||
this.hovered = false;
|
this.msg1Title = '通知(' + res.result.anntMsgTotal + ')'
|
||||||
if(record.openType==='component'){
|
this.announcement2 = res.result.sysMsgList
|
||||||
this.openPath = record.openPage;
|
this.msg2Count = res.result.sysMsgTotal
|
||||||
this.formData = {id:record.busId};
|
this.msg2Title = '系统消息(' + res.result.sysMsgTotal + ')'
|
||||||
this.$refs.showDynamNotice.detail(record.openPage);
|
}
|
||||||
}else{
|
})
|
||||||
this.$refs.ShowAnnouncement.detail(record);
|
.catch((error) => {
|
||||||
|
console.log('系统消息通知异常', error) //这行打印permissionName is undefined
|
||||||
|
this.stopTimer = true
|
||||||
|
console.log('清理timer')
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
this.stopTimer = true
|
||||||
|
console.log('通知异常', err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fetchNotice() {
|
||||||
|
if (this.loadding) {
|
||||||
|
this.loadding = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.loadding = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.loadding = false
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
showAnnouncement(record) {
|
||||||
|
putAction(this.url.editCementSend, { anntId: record.id }).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.loadData()
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
toMyAnnouncement(){
|
this.hovered = false
|
||||||
this.$router.push({
|
if (record.openType === 'component') {
|
||||||
path: '/isps/userAnnouncement'
|
this.openPath = record.openPage
|
||||||
});
|
this.formData = { id: record.busId }
|
||||||
},
|
this.$refs.showDynamNotice.detail(record.openPage)
|
||||||
modalFormOk(){
|
} else {
|
||||||
},
|
this.$refs.ShowAnnouncement.detail(record)
|
||||||
handleHoverChange (visible) {
|
}
|
||||||
this.hovered = visible;
|
},
|
||||||
},
|
toMyAnnouncement() {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/isps/userAnnouncement',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
modalFormOk() {},
|
||||||
|
handleHoverChange(visible) {
|
||||||
|
this.hovered = visible
|
||||||
|
},
|
||||||
|
|
||||||
initWebSocket: function () {
|
initWebSocket: function () {
|
||||||
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
||||||
var userId = store.getters.userInfo.id;
|
var userId = store.getters.userInfo.id
|
||||||
var url = window._CONFIG['domianURL'].replace("https://","wss://").replace("http://","ws://")+"/websocket/"+userId;
|
var url =
|
||||||
//console.log(url);
|
window._CONFIG['domianURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
|
||||||
//update-begin-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
//console.log(url);
|
||||||
let token = Vue.ls.get(ACCESS_TOKEN)
|
//update-begin-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
||||||
this.websock = new WebSocket(url, [token]);
|
let token = Vue.ls.get(ACCESS_TOKEN)
|
||||||
//update-end-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
this.websock = new WebSocket(url, [token])
|
||||||
this.websock.onopen = this.websocketOnopen;
|
//update-end-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
||||||
this.websock.onerror = this.websocketOnerror;
|
this.websock.onopen = this.websocketOnopen
|
||||||
this.websock.onmessage = this.websocketOnmessage;
|
this.websock.onerror = this.websocketOnerror
|
||||||
this.websock.onclose = this.websocketOnclose;
|
this.websock.onmessage = this.websocketOnmessage
|
||||||
},
|
this.websock.onclose = this.websocketOnclose
|
||||||
websocketOnopen: function () {
|
},
|
||||||
console.log("WebSocket连接成功");
|
websocketOnopen: function () {
|
||||||
//心跳检测重置
|
console.log('WebSocket连接成功')
|
||||||
//this.heartCheck.reset().start();
|
//心跳检测重置
|
||||||
},
|
//this.heartCheck.reset().start();
|
||||||
websocketOnerror: function (e) {
|
},
|
||||||
console.log("WebSocket连接发生错误,第%s次",this.wsConnectErrorTime);
|
websocketOnerror: function (e) {
|
||||||
|
console.log('WebSocket连接发生错误,第%s次', this.wsConnectErrorTime)
|
||||||
|
|
||||||
this.wsConnectErrorTime = this.wsConnectErrorTime + 1;
|
this.wsConnectErrorTime = this.wsConnectErrorTime + 1
|
||||||
if(this.wsConnectErrorTime>5){
|
if (this.wsConnectErrorTime > 5) {
|
||||||
console.log("WebSocket连接错误超过5次,就不再重新连了!");
|
console.log('WebSocket连接错误超过5次,就不再重新连了!')
|
||||||
this.lockReconnect = true
|
this.lockReconnect = true
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reconnect();
|
this.reconnect()
|
||||||
},
|
},
|
||||||
websocketOnmessage: function (e) {
|
websocketOnmessage: function (e) {
|
||||||
console.log("-----接收消息-------",e.data);
|
console.log('-----接收消息-------', e.data)
|
||||||
var data = eval("(" + e.data + ")"); //解析对象
|
var data = eval('(' + e.data + ')') //解析对象
|
||||||
this.voiceBroadcast(data.msgTxt)
|
this.voiceBroadcast(data.msgTxt)
|
||||||
if(data.cmd == "topic"){
|
if (data.cmd == 'topic') {
|
||||||
//系统通知
|
//系统通知
|
||||||
this.loadData();
|
this.loadData()
|
||||||
}else if(data.cmd == "user"){
|
} else if (data.cmd == 'user') {
|
||||||
//用户消息
|
//用户消息
|
||||||
this.loadData();
|
this.loadData()
|
||||||
}
|
}
|
||||||
//心跳检测重置
|
//心跳检测重置
|
||||||
//this.heartCheck.reset().start();
|
//this.heartCheck.reset().start();
|
||||||
},
|
},
|
||||||
websocketOnclose: function (e) {
|
websocketOnclose: function (e) {
|
||||||
console.log("connection closed (" + e + ")");
|
console.log('connection closed (' + e + ')')
|
||||||
if(e){
|
if (e) {
|
||||||
console.log("connection closed (" + e.code + ")");
|
console.log('connection closed (' + e.code + ')')
|
||||||
}
|
}
|
||||||
this.reconnect();
|
this.reconnect()
|
||||||
},
|
},
|
||||||
websocketSend(text) { // 数据发送
|
websocketSend(text) {
|
||||||
try {
|
// 数据发送
|
||||||
this.websock.send(text);
|
try {
|
||||||
} catch (err) {
|
this.websock.send(text)
|
||||||
console.log("send failed (" + err.code + ")");
|
} catch (err) {
|
||||||
}
|
console.log('send failed (' + err.code + ')')
|
||||||
},
|
}
|
||||||
//语音播报系统通知
|
},
|
||||||
voiceBroadcast(text){
|
//语音播报系统通知
|
||||||
var url = "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=" + encodeURI(text); // baidu文字转语音
|
voiceBroadcast(text) {
|
||||||
var voiceContent = new Audio(url);
|
var url = 'http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=' + encodeURI(text) // baidu文字转语音
|
||||||
voiceContent.src = url;
|
var voiceContent = new Audio(url)
|
||||||
voiceContent.play();
|
voiceContent.src = url
|
||||||
},
|
voiceContent.play()
|
||||||
openNotification (data) {
|
},
|
||||||
var text = data.msgTxt;
|
openNotification(data) {
|
||||||
const key = `open${Date.now()}`;
|
var text = data.msgTxt
|
||||||
this.$notification.open({
|
const key = `open${Date.now()}`
|
||||||
message: '消息提醒',
|
this.$notification.open({
|
||||||
placement:'bottomRight',
|
message: '消息提醒',
|
||||||
description: text,
|
placement: 'bottomRight',
|
||||||
key,
|
description: text,
|
||||||
btn: (h)=>{
|
key,
|
||||||
return h('a-button', {
|
btn: (h) => {
|
||||||
|
return h(
|
||||||
|
'a-button',
|
||||||
|
{
|
||||||
props: {
|
props: {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
size: 'small',
|
size: 'small',
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
click: () => this.showDetail(key,data)
|
click: () => this.showDetail(key, data),
|
||||||
}
|
},
|
||||||
}, '查看详情')
|
},
|
||||||
},
|
'查看详情'
|
||||||
});
|
)
|
||||||
},
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
reconnect() {
|
reconnect() {
|
||||||
var that = this;
|
var that = this
|
||||||
if(that.lockReconnect) return;
|
if (that.lockReconnect) return
|
||||||
that.lockReconnect = true;
|
that.lockReconnect = true
|
||||||
//没连接上会一直重连,设置延迟避免请求过多
|
//没连接上会一直重连,设置延迟避免请求过多
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
console.info("尝试重连...");
|
console.info('尝试重连...')
|
||||||
that.initWebSocket();
|
that.initWebSocket()
|
||||||
that.lockReconnect = false;
|
that.lockReconnect = false
|
||||||
}, 20000);
|
}, 20000)
|
||||||
},
|
},
|
||||||
heartCheckFun(){
|
heartCheckFun() {
|
||||||
var that = this;
|
var that = this
|
||||||
//心跳检测,每20s心跳一次
|
//心跳检测,每20s心跳一次
|
||||||
that.heartCheck = {
|
that.heartCheck = {
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
timeoutObj: null,
|
timeoutObj: null,
|
||||||
serverTimeoutObj: null,
|
serverTimeoutObj: null,
|
||||||
reset: function(){
|
reset: function () {
|
||||||
clearTimeout(this.timeoutObj);
|
clearTimeout(this.timeoutObj)
|
||||||
//clearTimeout(this.serverTimeoutObj);
|
//clearTimeout(this.serverTimeoutObj);
|
||||||
return this;
|
return this
|
||||||
},
|
},
|
||||||
start: function(){
|
start: function () {
|
||||||
var self = this;
|
var self = this
|
||||||
this.timeoutObj = setTimeout(function(){
|
this.timeoutObj = setTimeout(function () {
|
||||||
//这里发送一个心跳,后端收到后,返回一个心跳消息,
|
//这里发送一个心跳,后端收到后,返回一个心跳消息,
|
||||||
//onmessage拿到返回的心跳就说明连接正常
|
//onmessage拿到返回的心跳就说明连接正常
|
||||||
that.websocketSend("HeartBeat");
|
that.websocketSend('HeartBeat')
|
||||||
console.info("客户端发送心跳");
|
console.info('客户端发送心跳')
|
||||||
//self.serverTimeoutObj = setTimeout(function(){//如果超过一定时间还没重置,说明后端主动断开了
|
//self.serverTimeoutObj = setTimeout(function(){//如果超过一定时间还没重置,说明后端主动断开了
|
||||||
// that.websock.close();//如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
|
// that.websock.close();//如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
|
||||||
//}, self.timeout)
|
//}, self.timeout)
|
||||||
}, this.timeout)
|
}, this.timeout)
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
showDetail(key, data) {
|
||||||
|
this.$notification.close(key)
|
||||||
|
var id = data.msgId
|
||||||
|
getAction(this.url.queryById, { id: id }).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
var record = res.result
|
||||||
|
this.showAnnouncement(record)
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
showDetail(key,data){
|
}
|
||||||
this.$notification.close(key);
|
|
||||||
var id = data.msgId;
|
|
||||||
getAction(this.url.queryById,{id:id}).then((res) => {
|
|
||||||
if (res.success) {
|
|
||||||
var record = res.result;
|
|
||||||
this.showAnnouncement(record);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
.header-notice-wrapper {
|
.header-notice-wrapper {
|
||||||
top: 50px !important;
|
top: 50px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.header-notice{
|
.header-notice {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
vertical-align: initial;
|
vertical-align: initial;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -231,7 +231,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTheData() {
|
getTheData() {
|
||||||
console.log(this.serverOptions)
|
|
||||||
let hostId = this.serverOptions.find((item) => {
|
let hostId = this.serverOptions.find((item) => {
|
||||||
return item.value == this.currId
|
return item.value == this.currId
|
||||||
}).hostId
|
}).hostId
|
||||||
|
@ -278,7 +277,6 @@ export default {
|
||||||
totalCpu.push(item)
|
totalCpu.push(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(totalCpu)
|
|
||||||
this.cpuDiff_xData = totalCpu[0].list.map((item) => {
|
this.cpuDiff_xData = totalCpu[0].list.map((item) => {
|
||||||
return dateFormat(new Date(item.date * 1000), 'hh:mm')
|
return dateFormat(new Date(item.date * 1000), 'hh:mm')
|
||||||
})
|
})
|
||||||
|
@ -357,14 +355,17 @@ export default {
|
||||||
onServerChange(val) {
|
onServerChange(val) {
|
||||||
this.currId = val.key
|
this.currId = val.key
|
||||||
this.currLabel = val.label
|
this.currLabel = val.label
|
||||||
|
this.getTheData()
|
||||||
},
|
},
|
||||||
onTimeChange(val) {
|
onTimeChange(val) {
|
||||||
this.getBeforeHours(val)
|
this.getBeforeHours(val)
|
||||||
|
this.getTheData()
|
||||||
},
|
},
|
||||||
onRangeDateChange(date, dateString) {
|
onRangeDateChange(date, dateString) {
|
||||||
this.queryParams.timer = 0
|
this.queryParams.timer = 0
|
||||||
this.queryParams.startDate = dateString[0]
|
this.queryParams.startDate = dateString[0]
|
||||||
this.queryParams.endDate = dateString[1]
|
this.queryParams.endDate = dateString[1]
|
||||||
|
this.getTheData()
|
||||||
},
|
},
|
||||||
drawChart1() {
|
drawChart1() {
|
||||||
let myLine = echarts.init(document.getElementById('chart1'))
|
let myLine = echarts.init(document.getElementById('chart1'))
|
||||||
|
@ -754,6 +755,11 @@ export default {
|
||||||
data: item.data,
|
data: item.data,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
option.legend.type = 'scroll'
|
||||||
|
option.legend.pageIconColor = '#9ab1bc'
|
||||||
|
option.legend.pageTextStyle = {
|
||||||
|
color: '#9ab1bc',
|
||||||
|
}
|
||||||
this.drawLine(option)
|
this.drawLine(option)
|
||||||
} else {
|
} else {
|
||||||
this.drawLine(option)
|
this.drawLine(option)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
:class="{ 'ant-list-item-active': index === currIndex }"
|
:class="{ 'ant-list-item-active': index === currIndex }"
|
||||||
slot="renderItem"
|
slot="renderItem"
|
||||||
slot-scope="item, index"
|
slot-scope="item, index"
|
||||||
@click="handleBasicItem(index)"
|
@click="handleBasicItem(index, item)"
|
||||||
>
|
>
|
||||||
<div>{{ item.sourceName }}</div>
|
<div>{{ item.sourceName }}</div>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
@ -512,7 +512,6 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// Echarts (时间线)
|
// Echarts (时间线)
|
||||||
EchartsTimeline() {
|
EchartsTimeline() {
|
||||||
console.log(3456789)
|
|
||||||
const params = {
|
const params = {
|
||||||
itemId: '37550',
|
itemId: '37550',
|
||||||
itemType: 0,
|
itemType: 0,
|
||||||
|
@ -647,7 +646,6 @@ export default {
|
||||||
}
|
}
|
||||||
getAction('/systemMonitor/queryItemHistoryData', params).then((res) => {
|
getAction('/systemMonitor/queryItemHistoryData', params).then((res) => {
|
||||||
const arr = res.result.map((x) => x.value)
|
const arr = res.result.map((x) => x.value)
|
||||||
console.log(Math.max(...arr), Math.min(...arr))
|
|
||||||
this.cpuData.max = Math.max(...arr).toFixed(2)
|
this.cpuData.max = Math.max(...arr).toFixed(2)
|
||||||
this.cpuData.min = Math.min(...arr).toFixed(2)
|
this.cpuData.min = Math.min(...arr).toFixed(2)
|
||||||
let sum = arr.reduce((tatal, num) => tatal + num, 0)
|
let sum = arr.reduce((tatal, num) => tatal + num, 0)
|
||||||
|
@ -743,8 +741,12 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleBasicItem(i) {
|
handleBasicItem(i, item) {
|
||||||
this.currIndex = i
|
this.currIndex = i
|
||||||
|
this.currItemId = item.cpuUsedItemId
|
||||||
|
this.getBasiclnfo(item.hostId)
|
||||||
|
this.getCpuUtilizationData()
|
||||||
|
this.getTimeLineData()
|
||||||
},
|
},
|
||||||
getServerAlarmHistory(callBack) {
|
getServerAlarmHistory(callBack) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
|
@ -333,7 +333,6 @@ export default {
|
||||||
let oneHourAgo = moment().subtract(num, 'hours')
|
let oneHourAgo = moment().subtract(num, 'hours')
|
||||||
this.queryParams.startDate = oneHourAgo.format('YYYY-MM-DD HH:mm:ss')
|
this.queryParams.startDate = oneHourAgo.format('YYYY-MM-DD HH:mm:ss')
|
||||||
this.queryParams.endDate = currentTime.format('YYYY-MM-DD HH:mm:ss')
|
this.queryParams.endDate = currentTime.format('YYYY-MM-DD HH:mm:ss')
|
||||||
console.log(this.queryParams)
|
|
||||||
},
|
},
|
||||||
moment,
|
moment,
|
||||||
onRangeDateChange(date, dateString) {
|
onRangeDateChange(date, dateString) {
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="height: 100%;">
|
<div style="height: 100%">
|
||||||
<a-spin :spinning="spinning">
|
<List
|
||||||
|
:stationList="stationList"
|
||||||
|
:columns="columns"
|
||||||
|
:dataType="dataType"
|
||||||
|
fileName="CALIBPHD"
|
||||||
|
pageType="CALIB"
|
||||||
|
></List>
|
||||||
|
<!-- <a-spin :spinning="spinning">
|
||||||
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
|
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
|
||||||
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
||||||
<a-space style="float: right" class="btn-group" slot="additional">
|
<a-space style="float: right" class="btn-group" slot="additional">
|
||||||
|
@ -28,7 +35,7 @@
|
||||||
</custom-table>
|
</custom-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
<Detail v-if="isDetail" type="BLANKPHD" :sampleId="currSampleId" :allData="detailJson" @back="handleBack"></Detail>
|
<Detail v-if="isDetail" type="BLANKPHD" :sampleId="currSampleId" :allData="detailJson" @back="handleBack"></Detail> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -36,7 +43,7 @@ const columns = [
|
||||||
{
|
{
|
||||||
title: 'NO',
|
title: 'NO',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
width:80,
|
width: 80,
|
||||||
scopedSlots: {
|
scopedSlots: {
|
||||||
customRender: 'index',
|
customRender: 'index',
|
||||||
},
|
},
|
||||||
|
@ -81,225 +88,227 @@ const columns = [
|
||||||
dataIndex: 'acquisitionStop',
|
dataIndex: 'acquisitionStop',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
// import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
import { getAction, getFileAction } from '../../../../../api/manage'
|
import { getAction, getFileAction } from '../../../../../api/manage'
|
||||||
import dateFormat from '../../../../../components/jeecg/JEasyCron/format-date'
|
import List from '../../../list.vue'
|
||||||
import Detail from "../../../detail.vue"
|
// import dateFormat from '../../../../../components/jeecg/JEasyCron/format-date'
|
||||||
|
// import Detail from '../../../detail.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'menuTree',
|
// name: 'menuTree',
|
||||||
mixins: [JeecgListMixin],
|
// mixins: [JeecgListMixin],
|
||||||
components: {
|
components: {
|
||||||
Detail,
|
List,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
spinning: false,
|
// spinning: false,
|
||||||
isImmediate:true,
|
// isImmediate: true,
|
||||||
isDetail:false,
|
// isDetail: false,
|
||||||
columns,
|
columns,
|
||||||
queryParam: {
|
dataType: 'B',
|
||||||
dataType: 'B',
|
// queryParam: {
|
||||||
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
|
// dataType: 'B',
|
||||||
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
|
// startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
|
||||||
stationIds: [],
|
// endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
|
||||||
spectralQualifie:""
|
// stationIds: [],
|
||||||
},
|
// spectralQualifie: '',
|
||||||
|
// },
|
||||||
url: {
|
url: {
|
||||||
list: '/webStatistics/findParticulatePage',
|
// list: '/webStatistics/findParticulatePage',
|
||||||
findStationList: '/webStatistics/findStationList',
|
findStationList: '/webStatistics/findStationList',
|
||||||
},
|
},
|
||||||
stationList: [],
|
stationList: [],
|
||||||
dataSource: [],
|
// dataSource: [],
|
||||||
detailJson: {},
|
// detailJson: {},
|
||||||
strIds: "",
|
// strIds: '',
|
||||||
allChecked: false,
|
// allChecked: false,
|
||||||
currSampleId: "",
|
// currSampleId: '',
|
||||||
pageType:"ACQ"
|
// pageType: 'ACQ',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.findStationList()
|
this.findStationList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleExcel() {
|
// handleExcel() {
|
||||||
if (this.dataSource.length>0) {
|
// if (this.dataSource.length>0) {
|
||||||
let params = {
|
// let params = {
|
||||||
...this.queryParam,
|
// ...this.queryParam,
|
||||||
pageType:this.pageType
|
// pageType:this.pageType
|
||||||
}
|
// }
|
||||||
getFileAction("/webStatistics/radionuclideExport", params).then(res => {
|
// getFileAction("/webStatistics/radionuclideExport", params).then(res => {
|
||||||
if (res.code && res.code == 500) {
|
// if (res.code && res.code == 500) {
|
||||||
this.$message.warning("This operation fails. Contact your system administrator")
|
// this.$message.warning("This operation fails. Contact your system administrator")
|
||||||
} else {
|
// } else {
|
||||||
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
// const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
||||||
let link = document.createElement('a')
|
// let link = document.createElement('a')
|
||||||
link.href = window.URL.createObjectURL(blob)
|
// link.href = window.URL.createObjectURL(blob)
|
||||||
link.download = "BLANKPHD"
|
// link.download = "BLANKPHD"
|
||||||
document.body.appendChild(link)
|
// document.body.appendChild(link)
|
||||||
link.click()
|
// link.click()
|
||||||
URL.revokeObjectURL(link.href)
|
// URL.revokeObjectURL(link.href)
|
||||||
document.body.removeChild(link)
|
// document.body.removeChild(link)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
this.$message.warning("No downloadable data")
|
// this.$message.warning("No downloadable data")
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
searchQueryData() {
|
// searchQueryData() {
|
||||||
this.isImmediate = false
|
// this.isImmediate = false
|
||||||
this.loading = true
|
// this.loading = true
|
||||||
let params = {
|
// let params = {
|
||||||
...this.queryParam,
|
// ...this.queryParam,
|
||||||
pageNo: 1,
|
// pageNo: 1,
|
||||||
pageSize: 10
|
// pageSize: 10
|
||||||
}
|
// }
|
||||||
getAction(this.url.list, params).then((res) => {
|
// getAction(this.url.list, params).then((res) => {
|
||||||
this.loading = false
|
// this.loading = false
|
||||||
if (res.success) {
|
// if (res.success) {
|
||||||
this.ipagination.current = res.result.current
|
// this.ipagination.current = res.result.current
|
||||||
this.ipagination.pageSize = res.result.size
|
// this.ipagination.pageSize = res.result.size
|
||||||
this.ipagination.total = res.result.total
|
// this.ipagination.total = res.result.total
|
||||||
this.dataSource = res.result.records
|
// this.dataSource = res.result.records
|
||||||
} else {
|
// } else {
|
||||||
this.$message.warning("This operation fails. Contact your system administrator")
|
// this.$message.warning("This operation fails. Contact your system administrator")
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
handleDetail(record) {
|
// handleDetail(record) {
|
||||||
this.spinning = true
|
// this.spinning = true
|
||||||
this.currSampleId = record.sampleId
|
// this.currSampleId = record.sampleId
|
||||||
getAction("webStatistics/findGeneratedReport", { sampleId: record.sampleId }).then(res => {
|
// getAction('webStatistics/findGeneratedReport', { sampleId: record.sampleId })
|
||||||
this.spinning = false
|
// .then((res) => {
|
||||||
if (res.success) {
|
// this.spinning = false
|
||||||
this.detailJson = res.result
|
// if (res.success) {
|
||||||
this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
|
// this.detailJson = res.result
|
||||||
this.isDetail = true
|
// this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
|
||||||
} else {
|
// this.isDetail = true
|
||||||
this.$message.warning("This operation fails. Contact your system administrator")
|
// } else {
|
||||||
}
|
// this.$message.warning('This operation fails. Contact your system administrator')
|
||||||
}).catch(err => {
|
// }
|
||||||
this.spinning = false
|
// })
|
||||||
})
|
// .catch((err) => {
|
||||||
},
|
// this.spinning = false
|
||||||
handleBack(flag) {
|
// })
|
||||||
this.isDetail = flag
|
// },
|
||||||
},
|
// handleBack(flag) {
|
||||||
|
// this.isDetail = flag
|
||||||
|
// },
|
||||||
findStationList() {
|
findStationList() {
|
||||||
getAction(this.url.findStationList, { menuName: 'Particulate' }).then((res) => {
|
getAction(this.url.findStationList, { menuName: 'Particulate' }).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
if (res.result.length>0) {
|
if (res.result.length > 0) {
|
||||||
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
|
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
|
||||||
} else {
|
} else {
|
||||||
this.stationList=[]
|
this.stationList = []
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning("This operation fails. Contact your system administrator")
|
this.$message.warning('This operation fails. Contact your system administrator')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleSelectChange(val) {
|
// handleSelectChange(val) {
|
||||||
let length = this.stationList.length
|
// let length = this.stationList.length
|
||||||
if (val.length === length) {
|
// if (val.length === length) {
|
||||||
this.allChecked = true
|
// this.allChecked = true
|
||||||
} else {
|
// } else {
|
||||||
this.allChecked = false
|
// this.allChecked = false
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
handleSelectChangeAll(val) {
|
// handleSelectChangeAll(val) {
|
||||||
this.allChecked = val
|
// this.allChecked = val
|
||||||
if (val) {
|
// if (val) {
|
||||||
this.queryParam.stationIds = this.stationList.map(item => item.value)
|
// this.queryParam.stationIds = this.stationList.map(item => item.value)
|
||||||
} else {
|
// } else {
|
||||||
this.queryParam.stationIds =[]
|
// this.queryParam.stationIds =[]
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
filterOption(input, option) {
|
// filterOption(input, option) {
|
||||||
return (
|
// return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||||
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
// },
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
formItems() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
type: 'a-input',
|
|
||||||
label: '',
|
|
||||||
name: 'search',
|
|
||||||
props: {
|
|
||||||
placeholder: 'search...',
|
|
||||||
style: {
|
|
||||||
width: '166px',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
width: 'auto',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'custom-all-select',
|
|
||||||
label: 'Stations',
|
|
||||||
name: 'stationIds',
|
|
||||||
props: {
|
|
||||||
allChecked: this.allChecked,
|
|
||||||
filterOption:this.filterOption,
|
|
||||||
placeholder: 'select stations',
|
|
||||||
mode: 'multiple',
|
|
||||||
maxTagCount: 1,
|
|
||||||
options: [
|
|
||||||
...this.stationList,
|
|
||||||
],
|
|
||||||
style: {
|
|
||||||
width: '200px',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on: {
|
|
||||||
change: this.handleSelectChange,
|
|
||||||
changeAll: this.handleSelectChangeAll
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
width: 'auto',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Start date',
|
|
||||||
type: 'custom-date-picker',
|
|
||||||
name: 'startTime',
|
|
||||||
props: {
|
|
||||||
format: 'YYYY-MM-DD',
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
style: {
|
|
||||||
minWidth: 'auto',
|
|
||||||
width: '200px',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
width: 'auto',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'End date',
|
|
||||||
type: 'custom-date-picker',
|
|
||||||
name: 'endTime',
|
|
||||||
props: {
|
|
||||||
format: 'YYYY-MM-DD',
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
style: {
|
|
||||||
minWidth: 'auto',
|
|
||||||
width: '200px',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
width: 'auto',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
// computed: {
|
||||||
|
// formItems() {
|
||||||
|
// return [
|
||||||
|
// {
|
||||||
|
// type: 'a-input',
|
||||||
|
// label: '',
|
||||||
|
// name: 'search',
|
||||||
|
// props: {
|
||||||
|
// placeholder: 'search...',
|
||||||
|
// style: {
|
||||||
|
// width: '166px',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// style: {
|
||||||
|
// width: 'auto',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// type: 'custom-all-select',
|
||||||
|
// label: 'Stations',
|
||||||
|
// name: 'stationIds',
|
||||||
|
// props: {
|
||||||
|
// allChecked: this.allChecked,
|
||||||
|
// filterOption:this.filterOption,
|
||||||
|
// placeholder: 'select stations',
|
||||||
|
// mode: 'multiple',
|
||||||
|
// maxTagCount: 1,
|
||||||
|
// options: [
|
||||||
|
// ...this.stationList,
|
||||||
|
// ],
|
||||||
|
// style: {
|
||||||
|
// width: '200px',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// on: {
|
||||||
|
// change: this.handleSelectChange,
|
||||||
|
// changeAll: this.handleSelectChangeAll
|
||||||
|
// },
|
||||||
|
// style: {
|
||||||
|
// width: 'auto',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: 'Start date',
|
||||||
|
// type: 'custom-date-picker',
|
||||||
|
// name: 'startTime',
|
||||||
|
// props: {
|
||||||
|
// format: 'YYYY-MM-DD',
|
||||||
|
// valueFormat: 'YYYY-MM-DD',
|
||||||
|
// style: {
|
||||||
|
// minWidth: 'auto',
|
||||||
|
// width: '200px',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// style: {
|
||||||
|
// width: 'auto',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: 'End date',
|
||||||
|
// type: 'custom-date-picker',
|
||||||
|
// name: 'endTime',
|
||||||
|
// props: {
|
||||||
|
// format: 'YYYY-MM-DD',
|
||||||
|
// valueFormat: 'YYYY-MM-DD',
|
||||||
|
// style: {
|
||||||
|
// minWidth: 'auto',
|
||||||
|
// width: '200px',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// style: {
|
||||||
|
// width: 'auto',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
// },
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.icon-edit{
|
.icon-edit {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -4,171 +4,115 @@
|
||||||
:width="drawerWidth"
|
:width="drawerWidth"
|
||||||
@close="handleCancel"
|
@close="handleCancel"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirmLoading="confirmLoading">
|
:confirmLoading="confirmLoading"
|
||||||
|
>
|
||||||
|
<div :style="{ width: '100%', border: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff' }">
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
||||||
|
<a-form-model-item label="Menu Type" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
|
<a-radio-group @change="onChangeMenuType" v-model="model.menuType">
|
||||||
|
<a-radio :value="0">First Level Menu</a-radio>
|
||||||
|
<a-radio :value="1">Child Menu</a-radio>
|
||||||
|
<a-radio :value="2">Button/Permission</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-model-item>
|
||||||
|
|
||||||
<div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
|
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="menuLabel" prop="name" hasFeedback>
|
||||||
<a-spin :spinning="confirmLoading">
|
<a-input v-model="model.name" :readOnly="disableSubmit" />
|
||||||
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
</a-form-model-item>
|
||||||
|
|
||||||
<a-form-model-item label="Menu Type" :labelCol="labelCol" :wrapperCol="wrapperCol" >
|
<a-form-model-item
|
||||||
<a-radio-group @change="onChangeMenuType" v-model="model.menuType">
|
v-show="model.menuType != 0"
|
||||||
<a-radio :value="0">First Level Menu</a-radio>
|
label="Parent Menu"
|
||||||
<a-radio :value="1">Child Menu</a-radio>
|
:labelCol="labelCol"
|
||||||
<a-radio :value="2">Button/Permission</a-radio>
|
:wrapperCol="wrapperCol"
|
||||||
</a-radio-group>
|
:validate-status="validateStatus"
|
||||||
</a-form-model-item>
|
:hasFeedback="true"
|
||||||
|
:required="true"
|
||||||
|
>
|
||||||
|
<span slot="help">{{ validateStatus == 'error' ? 'Please Select Parent Menu' : ' ' }}</span>
|
||||||
|
<a-tree-select
|
||||||
|
style="width: 100%"
|
||||||
|
:dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
|
||||||
|
:treeData="treeData"
|
||||||
|
v-model="model.parentId"
|
||||||
|
placeholder="Please Select Parent Menu"
|
||||||
|
:disabled="disableSubmit"
|
||||||
|
@change="handleParentIdChange"
|
||||||
|
>
|
||||||
|
</a-tree-select>
|
||||||
|
</a-form-model-item>
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url" label="Menu Route">
|
||||||
:labelCol="labelCol"
|
<a-input v-model="model.url" :readOnly="disableSubmit" />
|
||||||
:wrapperCol="wrapperCol"
|
</a-form-model-item>
|
||||||
:label="menuLabel"
|
|
||||||
prop="name"
|
|
||||||
hasFeedback >
|
|
||||||
<a-input v-model="model.name" :readOnly="disableSubmit"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
|
<a-form-model-item
|
||||||
|
v-show="show"
|
||||||
|
:labelCol="labelCol"
|
||||||
|
:wrapperCol="wrapperCol"
|
||||||
|
prop="component"
|
||||||
|
label="Component"
|
||||||
|
>
|
||||||
|
<a-input v-model="model.component" :readOnly="disableSubmit" />
|
||||||
|
</a-form-model-item>
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item
|
||||||
v-show="model.menuType!=0"
|
v-show="model.menuType == 0"
|
||||||
label="Parent Menu"
|
:labelCol="labelCol"
|
||||||
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
||||||
:wrapperCol="wrapperCol"
|
label="Redirect Params"
|
||||||
:validate-status="validateStatus"
|
>
|
||||||
:hasFeedback="true"
|
<a-input v-model="model.redirect" :readOnly="disableSubmit" />
|
||||||
:required="true">
|
</a-form-model-item>
|
||||||
<span slot="help">{{ validateStatus=='error'?'Please Select Parent Menu':' ' }}</span>
|
|
||||||
<a-tree-select
|
|
||||||
style="width:100%"
|
|
||||||
:dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
|
|
||||||
:treeData="treeData"
|
|
||||||
v-model="model.parentId"
|
|
||||||
placeholder="Please Select Parent Menu"
|
|
||||||
:disabled="disableSubmit"
|
|
||||||
@change="handleParentIdChange">
|
|
||||||
</a-tree-select>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item v-show="!show" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="perms" label="Perms">
|
||||||
:labelCol="labelCol"
|
<a-input placeholder="Enter Perms, like: user:list" v-model="model.perms" :readOnly="disableSubmit" />
|
||||||
:wrapperCol="wrapperCol"
|
</a-form-model-item>
|
||||||
prop="url"
|
|
||||||
label="Menu Route">
|
|
||||||
<a-input v-model="model.url" :readOnly="disableSubmit"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item v-show="!show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Auth Category">
|
||||||
v-show="show"
|
<j-dict-select-tag v-model="model.permsType" :type="'radio'" dictCode="global_perms_type" />
|
||||||
:labelCol="labelCol"
|
</a-form-model-item>
|
||||||
:wrapperCol="wrapperCol"
|
<a-form-model-item v-show="!show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Status">
|
||||||
prop="component"
|
<j-dict-select-tag v-model="model.status" :type="'radio'" dictCode="valid_status" />
|
||||||
label="Component">
|
</a-form-model-item>
|
||||||
<a-input v-model="model.component" :readOnly="disableSubmit"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Icon">
|
||||||
v-show="model.menuType==0"
|
<a-input placeholder="Click Select Icon" v-model="model.icon" :readOnly="disableSubmit">
|
||||||
:labelCol="labelCol"
|
<a-icon slot="addonAfter" type="setting" @click="selectIcons" />
|
||||||
:wrapperCol="wrapperCol"
|
</a-input>
|
||||||
label="Redirect Params">
|
</a-form-model-item>
|
||||||
<a-input v-model="model.redirect" :readOnly="disableSubmit"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sortNo" label="Sort">
|
||||||
v-show="!show"
|
<a-input-number v-model="model.sortNo" style="width: 200px" :readOnly="disableSubmit" />
|
||||||
:labelCol="labelCol"
|
</a-form-model-item>
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
prop="perms"
|
|
||||||
label="Perms">
|
|
||||||
<a-input placeholder="Enter Perms, like: user:list" v-model="model.perms" :readOnly="disableSubmit"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Is Route Menu">
|
||||||
v-show="!show"
|
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.route" />
|
||||||
:labelCol="labelCol"
|
</a-form-model-item>
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Auth Category">
|
|
||||||
<j-dict-select-tag v-model="model.permsType" :type="'radio'" dictCode="global_perms_type"/>
|
|
||||||
|
|
||||||
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Hidden">
|
||||||
|
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.hidden" />
|
||||||
|
</a-form-model-item>
|
||||||
|
|
||||||
</a-form-model-item>
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Keep Alive">
|
||||||
<a-form-model-item
|
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.keepAlive" />
|
||||||
v-show="!show"
|
</a-form-model-item>
|
||||||
:labelCol="labelCol"
|
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Status">
|
|
||||||
<j-dict-select-tag v-model="model.status" :type="'radio'" dictCode="valid_status"/>
|
|
||||||
|
|
||||||
</a-form-model-item>
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Combine Route">
|
||||||
|
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.alwaysShow" />
|
||||||
|
</a-form-model-item>
|
||||||
|
|
||||||
<a-form-model-item
|
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Open Type">
|
||||||
v-show="show"
|
<a-switch checkedChildren="External" unCheckedChildren="Internal" v-model="model.internalOrExternal" />
|
||||||
:labelCol="labelCol"
|
</a-form-model-item>
|
||||||
:wrapperCol="wrapperCol"
|
</a-form-model>
|
||||||
label="Icon">
|
|
||||||
<a-input placeholder="Click Select Icon" v-model="model.icon" :readOnly="disableSubmit">
|
|
||||||
<a-icon slot="addonAfter" type="setting" @click="selectIcons" />
|
|
||||||
</a-input>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
<!-- 选择图标 -->
|
||||||
v-show="show"
|
<icons @choose="handleIconChoose" @close="handleIconCancel" :iconChooseVisible="iconChooseVisible"></icons>
|
||||||
:labelCol="labelCol"
|
</a-spin>
|
||||||
:wrapperCol="wrapperCol"
|
<a-row :style="{ textAlign: 'right' }">
|
||||||
prop="sortNo"
|
<a-button :style="{ marginRight: '8px' }" @click="handleCancel" type="warn"> Cancel </a-button>
|
||||||
label="Sort">
|
|
||||||
<a-input-number v-model="model.sortNo" style="width: 200px" :readOnly="disableSubmit"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
|
||||||
v-show="show"
|
|
||||||
:labelCol="labelCol"
|
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Is Route Menu">
|
|
||||||
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.route"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
|
||||||
v-show="show"
|
|
||||||
:labelCol="labelCol"
|
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Hidden">
|
|
||||||
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.hidden"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
|
||||||
v-show="show"
|
|
||||||
:labelCol="labelCol"
|
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Keep Alive">
|
|
||||||
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.keepAlive"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
|
|
||||||
<a-form-model-item
|
|
||||||
v-show="show"
|
|
||||||
:labelCol="labelCol"
|
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Combine Route">
|
|
||||||
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.alwaysShow"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
<a-form-model-item
|
|
||||||
v-show="show"
|
|
||||||
:labelCol="labelCol"
|
|
||||||
:wrapperCol="wrapperCol"
|
|
||||||
label="Open Type">
|
|
||||||
<a-switch checkedChildren="External" unCheckedChildren="Internal" v-model="model.internalOrExternal"/>
|
|
||||||
</a-form-model-item>
|
|
||||||
|
|
||||||
</a-form-model>
|
|
||||||
|
|
||||||
<!-- 选择图标 -->
|
|
||||||
<icons @choose="handleIconChoose" @close="handleIconCancel" :iconChooseVisible="iconChooseVisible"></icons>
|
|
||||||
</a-spin>
|
|
||||||
<a-row :style="{textAlign:'right'}">
|
|
||||||
<a-button :style="{marginRight: '8px'}" @click="handleCancel" type="warn">
|
|
||||||
Cancel
|
|
||||||
</a-button>
|
|
||||||
<a-button :disabled="disableSubmit" @click="handleOk" type="primary">Ok</a-button>
|
<a-button :disabled="disableSubmit" @click="handleOk" type="primary">Ok</a-button>
|
||||||
</a-row>
|
</a-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -176,203 +120,206 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {addPermission,editPermission,queryTreeList, duplicateCheck} from '@/api/api'
|
import { addPermission, editPermission, queryTreeList, duplicateCheck } from '@/api/api'
|
||||||
import Icons from './icon/Icons'
|
import Icons from './icon/Icons'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PermissionModal",
|
name: 'PermissionModal',
|
||||||
components: {Icons},
|
components: { Icons },
|
||||||
data () {
|
data() {
|
||||||
|
return {
|
||||||
|
drawerWidth: 700,
|
||||||
|
treeData: [],
|
||||||
|
title: '操作',
|
||||||
|
visible: false,
|
||||||
|
disableSubmit: false,
|
||||||
|
model: {},
|
||||||
|
show: true, //根据菜单类型,动态显示隐藏表单元素
|
||||||
|
menuLabel: 'Menu Name',
|
||||||
|
labelCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 5 },
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
},
|
||||||
|
confirmLoading: false,
|
||||||
|
iconChooseVisible: false,
|
||||||
|
validateStatus: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
validatorRules: function () {
|
||||||
return {
|
return {
|
||||||
drawerWidth:700,
|
name: [{ required: true, message: 'Please Enter Menu Name' }],
|
||||||
treeData:[],
|
component: [{ required: this.show, message: 'Please Enter Component' }],
|
||||||
title:"操作",
|
url: [{ required: this.show, message: 'Plaase Enter Route Path' }],
|
||||||
visible: false,
|
permsType: [{ required: true, message: 'Please Enter Auth Category' }],
|
||||||
disableSubmit:false,
|
perms: [{ required: false, message: 'Please Enter Perms' }, { validator: this.validatePerms }],
|
||||||
model: {},
|
|
||||||
show:true,//根据菜单类型,动态显示隐藏表单元素
|
|
||||||
menuLabel:'Menu Name',
|
|
||||||
labelCol: {
|
|
||||||
xs: { span: 24 },
|
|
||||||
sm: { span: 5 },
|
|
||||||
},
|
|
||||||
wrapperCol: {
|
|
||||||
xs: { span: 24 },
|
|
||||||
sm: { span: 16 },
|
|
||||||
},
|
|
||||||
confirmLoading: false,
|
|
||||||
iconChooseVisible: false,
|
|
||||||
validateStatus:""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
},
|
||||||
validatorRules:function() {
|
created() {},
|
||||||
return {
|
methods: {
|
||||||
name:[{ required: true, message: 'Please Enter Menu Name' }],
|
loadTree() {
|
||||||
component:[{ required: this.show, message: 'Please Enter Component' }],
|
var that = this
|
||||||
url: [{ required: this.show, message: 'Plaase Enter Route Path' }],
|
queryTreeList().then((res) => {
|
||||||
permsType: [{ required: true, message: 'Please Enter Auth Category' }],
|
if (res.success) {
|
||||||
perms:[{ required: false, message: 'Please Enter Perms' },{validator: this.validatePerms }]
|
console.log(res)
|
||||||
}
|
that.treeData = []
|
||||||
}
|
let treeList = res.result.treeList
|
||||||
},
|
for (let a = 0; a < treeList.length; a++) {
|
||||||
created () {
|
let temp = treeList[a]
|
||||||
},
|
temp.isLeaf = temp.leaf
|
||||||
methods: {
|
that.treeData.push(temp)
|
||||||
loadTree(){
|
|
||||||
var that = this;
|
|
||||||
queryTreeList().then((res)=>{
|
|
||||||
if(res.success){
|
|
||||||
console.log(res)
|
|
||||||
that.treeData = [];
|
|
||||||
let treeList = res.result.treeList
|
|
||||||
for(let a=0;a<treeList.length;a++){
|
|
||||||
let temp = treeList[a];
|
|
||||||
temp.isLeaf = temp.leaf;
|
|
||||||
that.treeData.push(temp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
},
|
})
|
||||||
add () {
|
},
|
||||||
//初始化默认值
|
add() {
|
||||||
this.edit({status:'1', permsType:'1', sortNo:1.0, route:true, menuType:0,component:'layouts/RouteView' });
|
//初始化默认值
|
||||||
},
|
this.edit({ status: '1', permsType: '1', sortNo: 1.0, route: true, menuType: 0, component: 'layouts/RouteView' })
|
||||||
edit (record) {
|
},
|
||||||
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
|
edit(record) {
|
||||||
this.model = Object.assign({}, record);
|
this.resetScreenSize() // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
|
||||||
|
this.model = Object.assign({}, record)
|
||||||
|
|
||||||
//根据菜单类型,动态展示页面字段
|
//根据菜单类型,动态展示页面字段
|
||||||
console.log('record: ',record)
|
console.log('record: ', record)
|
||||||
this.show = record.menuType==2?false:true;
|
this.show = record.menuType == 2 ? false : true
|
||||||
this.menuLabel = record.menuType==2?'Button/Permission':'Menu Name';
|
this.menuLabel = record.menuType == 2 ? 'Button/Permission' : 'Menu Name'
|
||||||
|
|
||||||
this.visible = true;
|
this.visible = true
|
||||||
this.loadTree();
|
this.loadTree()
|
||||||
},
|
},
|
||||||
close () {
|
close() {
|
||||||
this.$emit('close');
|
this.$emit('close')
|
||||||
this.disableSubmit = false;
|
this.disableSubmit = false
|
||||||
this.visible = false;
|
this.visible = false
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields()
|
||||||
},
|
},
|
||||||
handleOk () {
|
handleOk() {
|
||||||
const that = this;
|
const that = this
|
||||||
// 触发表单验证
|
// 触发表单验证
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if ((this.model.menuType == 1 || this.model.menuType == 2) && !this.model.parentId) {
|
if ((this.model.menuType == 1 || this.model.menuType == 2) && !this.model.parentId) {
|
||||||
that.validateStatus = 'error';
|
that.validateStatus = 'error'
|
||||||
that.$message.error("Please Check The Form");
|
that.$message.error('Please Check The Form')
|
||||||
return;
|
return
|
||||||
} else {
|
} else {
|
||||||
that.validateStatus = 'success';
|
that.validateStatus = 'success'
|
||||||
}
|
}
|
||||||
that.confirmLoading = true;
|
that.confirmLoading = true
|
||||||
let obj;
|
let obj
|
||||||
if (!this.model.id) {
|
if (!this.model.id) {
|
||||||
obj = addPermission(this.model);
|
obj = addPermission(this.model)
|
||||||
} else {
|
} else {
|
||||||
obj = editPermission(this.model);
|
obj = editPermission(this.model)
|
||||||
}
|
}
|
||||||
obj.then((res) => {
|
obj
|
||||||
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
that.$message.success(res.message);
|
that.$message.success(res.message)
|
||||||
that.$emit('ok');
|
that.$emit('ok')
|
||||||
} else {
|
} else {
|
||||||
that.$message.warning(res.message);
|
that.$message.warning(res.message)
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
})
|
||||||
that.confirmLoading = false;
|
.finally(() => {
|
||||||
that.close();
|
that.confirmLoading = false
|
||||||
});
|
that.close()
|
||||||
}else{
|
})
|
||||||
return false;
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
validateNumber(rule, value, callback) {
|
||||||
|
if (!value || new RegExp(/^[0-9]*[1-9][0-9]*$/).test(value)) {
|
||||||
|
callback()
|
||||||
|
} else {
|
||||||
|
callback('Please Enter Positive Integer')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validatePerms(rule, value, callback) {
|
||||||
|
if (value && value.length > 0) {
|
||||||
|
//校验授权标识是否存在
|
||||||
|
var params = {
|
||||||
|
tableName: 'sys_permission',
|
||||||
|
fieldName: 'perms',
|
||||||
|
fieldVal: value,
|
||||||
|
dataId: this.model.id,
|
||||||
|
}
|
||||||
|
duplicateCheck(params).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
callback()
|
||||||
|
} else {
|
||||||
|
callback('Perms Already Exist')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
} else {
|
||||||
handleCancel () {
|
callback()
|
||||||
this.close()
|
}
|
||||||
},
|
},
|
||||||
validateNumber(rule, value, callback){
|
onChangeMenuType(e) {
|
||||||
if(!value || new RegExp(/^[0-9]*[1-9][0-9]*$/).test(value)){
|
if (this.model.menuType == 2) {
|
||||||
callback();
|
this.show = false
|
||||||
}else{
|
this.menuLabel = 'Menu/Permission'
|
||||||
callback("Please Enter Positive Integer");
|
} else {
|
||||||
}
|
this.show = true
|
||||||
},
|
this.menuLabel = 'Menu Name'
|
||||||
validatePerms(rule, value, callback){
|
}
|
||||||
if(value && value.length>0){
|
|
||||||
//校验授权标识是否存在
|
|
||||||
var params = {
|
|
||||||
tableName: 'sys_permission',
|
|
||||||
fieldName: 'perms',
|
|
||||||
fieldVal: value,
|
|
||||||
dataId: this.model.id
|
|
||||||
};
|
|
||||||
duplicateCheck(params).then((res) => {
|
|
||||||
if (res.success) {
|
|
||||||
callback()
|
|
||||||
} else {
|
|
||||||
callback("Perms Already Exist")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onChangeMenuType(e) {
|
|
||||||
if(this.model.menuType == 2){
|
|
||||||
this.show = false;
|
|
||||||
this.menuLabel = 'Menu/Permission';
|
|
||||||
}else{
|
|
||||||
this.show = true;
|
|
||||||
this.menuLabel = 'Menu Name';
|
|
||||||
}
|
|
||||||
|
|
||||||
//update-begin---author:wangshuai ---date:20220729 for:[VUEN-1834]只有一级菜单,才默认值,子菜单的时候,清空------------
|
//update-begin---author:wangshuai ---date:20220729 for:[VUEN-1834]只有一级菜单,才默认值,子菜单的时候,清空------------
|
||||||
if(!this.model.id){
|
if (!this.model.id) {
|
||||||
if(this.model.menuType === 1 && this.model.component === 'layouts/RouteView'){
|
if (this.model.menuType === 1 && this.model.component === 'layouts/RouteView') {
|
||||||
this.model.component = ""
|
this.model.component = ''
|
||||||
}
|
|
||||||
}
|
|
||||||
//update-end---author:wangshuai ---date:20220729 for:[VUEN-1834]只有一级菜单,才默认值,子菜单的时候,清空--------------
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.form.validateField(['url','component']);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
selectIcons(){
|
|
||||||
this.iconChooseVisible = true
|
|
||||||
},
|
|
||||||
handleIconCancel () {
|
|
||||||
this.iconChooseVisible = false
|
|
||||||
},
|
|
||||||
handleIconChoose (value) {
|
|
||||||
console.log(value)
|
|
||||||
this.model.icon = value
|
|
||||||
this.iconChooseVisible = false
|
|
||||||
},
|
|
||||||
// 根据屏幕变化,设置抽屉尺寸
|
|
||||||
resetScreenSize(){
|
|
||||||
let screenWidth = document.body.clientWidth;
|
|
||||||
if(screenWidth < 500){
|
|
||||||
this.drawerWidth = screenWidth;
|
|
||||||
}else{
|
|
||||||
this.drawerWidth = 700;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleParentIdChange(value){
|
|
||||||
if(!value){
|
|
||||||
this.validateStatus="error"
|
|
||||||
}else{
|
|
||||||
this.validateStatus="success"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//update-end---author:wangshuai ---date:20220729 for:[VUEN-1834]只有一级菜单,才默认值,子菜单的时候,清空--------------
|
||||||
}
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.form.validateField(['url', 'component'])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectIcons() {
|
||||||
|
this.iconChooseVisible = true
|
||||||
|
},
|
||||||
|
handleIconCancel() {
|
||||||
|
this.iconChooseVisible = false
|
||||||
|
},
|
||||||
|
handleIconChoose(value) {
|
||||||
|
console.log(value)
|
||||||
|
this.model.icon = value
|
||||||
|
this.iconChooseVisible = false
|
||||||
|
},
|
||||||
|
// 根据屏幕变化,设置抽屉尺寸
|
||||||
|
resetScreenSize() {
|
||||||
|
let screenWidth = document.body.clientWidth
|
||||||
|
if (screenWidth < 500) {
|
||||||
|
this.drawerWidth = screenWidth
|
||||||
|
} else {
|
||||||
|
this.drawerWidth = 700
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleParentIdChange(value) {
|
||||||
|
if (!value) {
|
||||||
|
this.validateStatus = 'error'
|
||||||
|
} else {
|
||||||
|
this.validateStatus = 'success'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
|
.ant-select-dropdown {
|
||||||
|
background-color: #03353f !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user