new
parent
79431d1622
commit
7eb7e05bf4
|
|
@ -7043,6 +7043,11 @@
|
|||
"integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==",
|
||||
"dev": true
|
||||
},
|
||||
"es6-promise": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmmirror.com/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
|
||||
},
|
||||
"escalade": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.1.1.tgz",
|
||||
|
|
@ -7599,6 +7604,15 @@
|
|||
"readable-stream": "^2.3.6"
|
||||
}
|
||||
},
|
||||
"flv.js": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmmirror.com/flv.js/-/flv.js-1.6.2.tgz",
|
||||
"integrity": "sha512-xre4gUbX1MPtgQRKj2pxJENp/RnaHaxYvy3YToVVCrSmAWUu85b9mug6pTXF6zakUjNP2lFWZ1rkSX7gxhB/2A==",
|
||||
"requires": {
|
||||
"es6-promise": "^4.2.8",
|
||||
"webworkify-webpack": "^2.1.5"
|
||||
}
|
||||
},
|
||||
"flyio": {
|
||||
"version": "0.6.14",
|
||||
"resolved": "https://registry.npmmirror.com/flyio/-/flyio-0.6.14.tgz",
|
||||
|
|
@ -17412,6 +17426,11 @@
|
|||
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
|
||||
"dev": true
|
||||
},
|
||||
"webworkify-webpack": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmmirror.com/webworkify-webpack/-/webworkify-webpack-2.1.5.tgz",
|
||||
"integrity": "sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw=="
|
||||
},
|
||||
"whatwg-encoding": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz",
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@
|
|||
"@dcloudio/uni-stat": "^2.0.2-3081220230817001",
|
||||
"@vue/shared": "^3.0.0",
|
||||
"core-js": "^3.6.5",
|
||||
"flv.js": "^1.6.2",
|
||||
"flyio": "^0.6.2",
|
||||
"uview-ui": "^1.8.8",
|
||||
"vue": "^2.6.11",
|
||||
|
|
|
|||
187
src/App.vue
187
src/App.vue
|
|
@ -57,10 +57,14 @@
|
|||
.flex-row{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
}
|
||||
.flex-1{
|
||||
flex: 1;
|
||||
}
|
||||
.align-items{
|
||||
align-items: center;
|
||||
}
|
||||
.clamp {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
@ -160,7 +164,7 @@
|
|||
.bg_colorf8{
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
// 顶部筛选样式
|
||||
//公用 顶部筛选样式
|
||||
.secreen-section{
|
||||
.slot-content{
|
||||
padding: 30rpx;
|
||||
|
|
@ -174,6 +178,7 @@
|
|||
.time_box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 44rpx;
|
||||
.tip_txt{
|
||||
color: #ccc;
|
||||
}
|
||||
|
|
@ -183,6 +188,12 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.btn_group{
|
||||
display: flex;
|
||||
.btn{
|
||||
width: 300rpx;
|
||||
}
|
||||
}
|
||||
.quick_times{
|
||||
padding: 18rpx 24rpx 24rpx 24rpx;
|
||||
.tab-section{
|
||||
|
|
@ -234,6 +245,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
//弹出预警温度
|
||||
.u-popup-section{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
|
@ -281,4 +293,177 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
//公用底部弹出详情
|
||||
.popup-form-info{
|
||||
min-height: 450rpx;
|
||||
padding-bottom: 75rpx;
|
||||
.top_box{
|
||||
height: 96rpx;
|
||||
padding: 0 40rpx;
|
||||
.handle-btns{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
.btn_del{
|
||||
color:#fa3534;
|
||||
|
||||
}
|
||||
.btn_edit{
|
||||
color:#2979ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.form_edit{
|
||||
padding: 0 30rpx;
|
||||
|
||||
}
|
||||
.plist{
|
||||
display: flex;
|
||||
padding: 20rpx 40rpx;
|
||||
.label_t{
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
//弹窗表单详情编辑
|
||||
.popup-form-ubox{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.top_box{
|
||||
height: 96rpx;
|
||||
padding: 0 40rpx;
|
||||
.title{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.form_edit{
|
||||
padding: 0 30rpx;
|
||||
.label_tit{
|
||||
padding-top: 28rpx;
|
||||
}
|
||||
}
|
||||
.label_tit{
|
||||
padding: 18rpx 0;
|
||||
}
|
||||
.scroll-y{
|
||||
flex: 1;
|
||||
flex-shrink: 0;
|
||||
min-height: 1px;
|
||||
}
|
||||
.buttom_section{
|
||||
display: flex;
|
||||
padding: 40rpx 24rpx 40rpx 24rpx;
|
||||
.btn{
|
||||
width: 220rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 公用 swiper列表样式
|
||||
.tb_swipe_list{
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 6rpx;
|
||||
.tb_body{
|
||||
padding: 16rpx;
|
||||
background-color: #fff;
|
||||
position: relative;
|
||||
|
||||
.row_box{
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333;
|
||||
&:nth-of-type(1){
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 5rpx;
|
||||
padding-right: 100rpx;
|
||||
}
|
||||
}
|
||||
.tag_status{
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.tip_err_text{
|
||||
font-size: 28rpx;
|
||||
color: #fa3534;
|
||||
}
|
||||
.secreen-show-box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 20rpx 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
.placeholder{
|
||||
color: rgb(192, 196, 204);
|
||||
}
|
||||
.u-select-list{
|
||||
display: flex;
|
||||
position: relative;
|
||||
padding-right: 70rpx;
|
||||
.value{
|
||||
line-height: initial;
|
||||
}
|
||||
.right{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
.popup-select-section{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.top_section{
|
||||
padding: 30rpx;
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
.scrollY{
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
min-height: 300rpx;
|
||||
|
||||
}
|
||||
.info_cont{
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.buttom_section{
|
||||
display: flex;
|
||||
padding: 30rpx;
|
||||
.btn{
|
||||
width: 240rpx;
|
||||
}
|
||||
}
|
||||
.select-box{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding-bottom: 30rpx;
|
||||
.select-item{
|
||||
border: 1px solid #2979ff;
|
||||
color: #2979ff;
|
||||
padding: 4rpx 28rpx;
|
||||
border-radius: 72rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
&.active{
|
||||
color: #fff;
|
||||
background-color: #2979ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
export const SHJGTMPLID = 'Xejag3ttwOw_xLvXsrMULjnoNcm5bJIyu-ACnshUnKY';//审核结果
|
||||
|
||||
export const SFTZTMPLID = 'slzGT4a8GDQUjmd4uHrZmHYD8ta55KrXe9RTOrL0qRc';//收费通知
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<template>
|
||||
<view class="video_flv_h5">
|
||||
<div class="video_h5" ref="myPlayer">
|
||||
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import flvjs from 'flv.js'
|
||||
export default {
|
||||
props: {
|
||||
url: {
|
||||
type: String,
|
||||
default: null,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
player: null,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.videoPlayer()
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.destroyVideos()
|
||||
},
|
||||
methods: {
|
||||
destroyVideos() {
|
||||
if (!this.player) return
|
||||
this.player?.pause()
|
||||
this.player?.unload()
|
||||
this.player?.detachMediaElement()
|
||||
this.player?.destroy()
|
||||
this.player = null,
|
||||
this.$refs.myPlayer.innerHTML="";
|
||||
},
|
||||
videoPlayer() {
|
||||
|
||||
if (!this.url) return
|
||||
if (flvjs.isSupported()) {
|
||||
let player = document.createElement('video');
|
||||
player.enableProgressGesture = true
|
||||
player.controls=true
|
||||
player.showCenterPlayBtn=true
|
||||
player.showPlayBtn=true
|
||||
player.showFullscreenBtn=true
|
||||
player.x5VideoPlayerType='h5-page'
|
||||
player.x5VideoPlayerFullscreen="false"
|
||||
player.autoplay= true // 以上均为 video标签的属性配置
|
||||
player.style = 'width: 100%;height:100%';
|
||||
let videoElement = this.$refs.myPlayer;
|
||||
|
||||
// console.log(videoElement,'videoPlayer=========')
|
||||
videoElement.appendChild(player);
|
||||
let flvPlayer = flvjs.createPlayer({
|
||||
type: 'flv', // 媒体类型,默认是 flv,
|
||||
isLive: true, // 是否是直播流
|
||||
url: this.url, //你的url地址
|
||||
})
|
||||
flvPlayer.attachMediaElement(player)
|
||||
flvPlayer.load()
|
||||
flvPlayer.play()
|
||||
this.player = flvPlayer;
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
url() {
|
||||
this.destroyVideos()
|
||||
this.videoPlayer()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video_flv_h5{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.video_h5{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
// video::-webkit-media-controls-enclosure {
|
||||
// display: none;
|
||||
// }
|
||||
// /* 进度条 */
|
||||
// video::-webkit-media-controls-timeline {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
// video::-webkit-media-controls-current-time-display {
|
||||
// display: none;
|
||||
// }
|
||||
// /* 音量按钮 */
|
||||
// video::-webkit-media-controls-mute-button {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
// video::-webkit-media-controls-toggle-closed-captions-button {
|
||||
// display: none;
|
||||
// }
|
||||
// /* 音量的控制条 */
|
||||
// video::-webkit-media-controls-volume-slider {
|
||||
// display: none;
|
||||
// }
|
||||
// /* 播放按钮 */
|
||||
// video::-webkit-media-controls-play-button {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
// video::-webkit-media-controls {
|
||||
// display: none !important;
|
||||
// }
|
||||
|
||||
// video::-webkit-media-controls-enclosure {
|
||||
// display: none !important;
|
||||
// }
|
||||
</style>
|
||||
|
|
@ -82,6 +82,24 @@
|
|||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "pages/system/account",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "账号管理",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "pages/system/log",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "系统日志",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "white",
|
||||
|
|
|
|||
|
|
@ -3,43 +3,130 @@
|
|||
<view class="utab-section">
|
||||
<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
|
||||
</view>
|
||||
<view class="secreen-section">
|
||||
<u-dropdown class="dropdown-box" ref="uDropdown" @open="openDropDown">
|
||||
<view class="secreen-section" style="background-color: #fff;">
|
||||
<u-dropdown class="dropdown-box" v-if="current==0" ref="uDropdown">
|
||||
<u-dropdown-item v-model="addressValue" title="基地"
|
||||
height="700rpx"
|
||||
:options="deviceAddressList" @change="change"></u-dropdown-item>
|
||||
<u-dropdown-item v-model="device_id" title="检测点" height="700rpx"
|
||||
:options="options2" @change="change2"></u-dropdown-item>
|
||||
<u-dropdown-item v-if="current==0" v-model="is_recommend" title="推荐"
|
||||
<u-dropdown-item v-model="is_recommend" title="全部"
|
||||
:options="options3" @change="change3"></u-dropdown-item>
|
||||
|
||||
</u-dropdown>
|
||||
<u-dropdown class="dropdown-box" v-if="current==1" ref="uDropdown2"
|
||||
@open="openDropDown">
|
||||
<u-dropdown-item v-model="addressValue2" title="基地" height="700rpx"
|
||||
:options="deviceAddressList2" @change="change"></u-dropdown-item>
|
||||
<u-dropdown-item v-model="device_id2" title="检测点" height="700rpx"
|
||||
:options="options4" @change="change4"></u-dropdown-item>
|
||||
<u-dropdown-item v-if="current==1" title="日期">
|
||||
<view class="slot-content" style="background-color: #FFFFFF;">
|
||||
<view class="select-date u-border-bottom" >
|
||||
<view class="name" @click="calendarShow = true">
|
||||
<view class="select-date u-border-bottom" style="margin-bottom: 0;">
|
||||
<view class="name" @click="pickerTimeFn('start')">
|
||||
<u-icon name="calendar" color="#333" size="32"></u-icon>
|
||||
<text style="margin-left: 6rpx;">选择日期:</text>
|
||||
<text style="margin-left: 6rpx;">开始时间:</text>
|
||||
</view>
|
||||
<view class="time_box">
|
||||
<view class="tip_txt" v-if="!start_date_c"
|
||||
@click="calendarShow = true">开始日期-结束日期</view>
|
||||
@click="pickerTimeFn('start')">请选择开始时间</view>
|
||||
<view class="tile_val" v-else
|
||||
@click="calendarShow = true">{{start_date_c}} ~ {{end_date_c}}</view>
|
||||
<view class="delete_btn" v-if="start_date_c" @click="deleteDateFn()">
|
||||
@click="pickerTimeFn('start')">{{start_date_c}}</view>
|
||||
<view class="delete_btn" v-if="start_date_c" @click="deleteDateFn('start')">
|
||||
<u-icon name="close-circle" color="#333" size="34"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<u-button type="primary" @click="selectedDateConform()">确定</u-button>
|
||||
<view class="select-date u-border-bottom" style="margin-bottom: 0;">
|
||||
<view class="name" @click="pickerTimeFn('end')">
|
||||
<u-icon name="calendar" color="#333" size="32"></u-icon>
|
||||
<text style="margin-left: 6rpx;">结束时间:</text>
|
||||
</view>
|
||||
<view class="time_box">
|
||||
<view class="tip_txt" v-if="!end_date_c"
|
||||
@click="pickerTimeFn('end')">请选择结束时间</view>
|
||||
<view class="tile_val" v-else
|
||||
@click="pickerTimeFn('end')">{{end_date_c}}</view>
|
||||
<view class="delete_btn" v-if="end_date_c" @click="deleteDateFn('end')">
|
||||
<u-icon name="close-circle" color="#333" size="34"></u-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="select-date u-border-bottom" v-if="selectedTimeTip">
|
||||
<view class="tip_err_text" >
|
||||
请选择开始时间和结束时间,查询视频
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn_group">
|
||||
<u-button class="btn" @click="resetSecreen()">重置</u-button>
|
||||
<u-button class="btn" type="primary" @click="selectedDateConform()">查询</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-dropdown-item>
|
||||
</u-dropdown>
|
||||
</view>
|
||||
<view class="secreen-show-box mt20" v-if="current==0&&addressName">
|
||||
<view class="label_t">当前位置:</view>
|
||||
<view class="info">{{addressName}}-{{device_id?device_id:'全部'}}-{{is_recommend?'推荐':'全部'}}</view>
|
||||
</view>
|
||||
<view class="secreen-show-box mt20" v-if="current==1&&q_start_time">
|
||||
<view class="label_t">查询:</view>
|
||||
<view class="info">
|
||||
<view>{{addressName2}}-{{device_id2}}</view>
|
||||
<view>{{q_start_time}} 到 {{q_end_time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-box">
|
||||
<view class="video_ul" v-show="current==0">
|
||||
<view class="video_li" v-for="(video,index) in videoList" :key="index">
|
||||
<view class="video_cd">
|
||||
<!-- #ifdef H5 -->
|
||||
<video-flv-h5 :url="video.video_url"></video-flv-h5>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view class="bottom-box">
|
||||
<view class="row flex-row">
|
||||
<view class="lab">推荐:</view>
|
||||
<u-switch v-model="video.bl_recommend" size="30"
|
||||
@change="changeRecommend($event,index)"></u-switch>
|
||||
</view>
|
||||
<view class="address">{{video.base_name}}-{{video.monitoring_point}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore :status="loading" />
|
||||
</view>
|
||||
<view class="video_ul" v-show="current==1">
|
||||
<view class="video_li" v-for="(video,index) in videoList2" :key="index">
|
||||
<view class="video_cd">
|
||||
<!-- #ifdef H5 -->
|
||||
<video-flv-h5 :url="video.video_url"></video-flv-h5>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view class="bottom-box">
|
||||
<view class="address">{{video.base_name}}-{{video.monitoring_point}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-loadmore :status="loading2" v-if="loading2"/>
|
||||
<u-empty text="请选择要查看的视频的日期" mode="history" margin-top="100"
|
||||
v-if="!(videoList2&&videoList2.length)"></u-empty>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- 选择时间 -->
|
||||
<u-picker mode="time" v-model="pickerShow" @confirm="pickerChange"
|
||||
:params="pickerParams" :default-time="defaultTime"></u-picker>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import videoFlvH5 from '@/components/video-flv-h5/video-flv-h5.vue'
|
||||
export default {
|
||||
components: { videoFlvH5 },
|
||||
data() {
|
||||
return {
|
||||
list:[
|
||||
|
|
@ -59,7 +146,6 @@
|
|||
addressValue:'',
|
||||
device_id:'',//检测点 - options2中的设备id
|
||||
options2:[],
|
||||
calendarShow:false,//选择日期
|
||||
start_date_c:'',
|
||||
end_date_c:'',
|
||||
device_type:1,//监控
|
||||
|
|
@ -74,83 +160,254 @@
|
|||
value: 1,
|
||||
}
|
||||
],
|
||||
per_page:10,
|
||||
per_page:4,
|
||||
page:1,
|
||||
pickerParams: {
|
||||
year: true,
|
||||
month: true,
|
||||
day: true,
|
||||
hour: true,
|
||||
minute: true,
|
||||
second: false
|
||||
},
|
||||
defaultTime:'',
|
||||
pickerShow:false,//选择
|
||||
ctimeType:'',//当前点击
|
||||
addressValue2:'',
|
||||
addressName2:'',
|
||||
device_id2:'',
|
||||
options4:[],
|
||||
websocket:{},
|
||||
videoList:[],
|
||||
videoList2:[],
|
||||
per_page2:4,
|
||||
page2:1,
|
||||
loading:'loading',
|
||||
loading2:'',
|
||||
selectedTimeTip:false,//选择时间段提示
|
||||
};
|
||||
},
|
||||
onLoad(){
|
||||
this.queryDeviceBasics();
|
||||
this.queryWebsocketIp();
|
||||
|
||||
},
|
||||
methods:{
|
||||
sectionChange(index) {
|
||||
this.current = index;
|
||||
},
|
||||
//地区
|
||||
//地区1
|
||||
change(val){
|
||||
console.log(val);
|
||||
let narray = this.deviceAddressList.filter(item=>{
|
||||
return item.value==val;
|
||||
})
|
||||
console.log(narray);
|
||||
this.addressName = narray[0].name;
|
||||
this.queryAddressDevicePoints(val);
|
||||
if(this.current==0){
|
||||
this.addressName = narray[0].name;
|
||||
}else{
|
||||
this.addressName2 = narray[0].name;
|
||||
}
|
||||
if(val==''){
|
||||
this.addressName = '全部';
|
||||
this.queryDevices();
|
||||
}else{
|
||||
this.queryAddressDevicePoints(val);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
//地区下设备id
|
||||
change2(val){
|
||||
console.log(val)
|
||||
this.queryDevices();
|
||||
},
|
||||
//推荐
|
||||
change3(val){
|
||||
this.queryDevices();
|
||||
},
|
||||
//视频下-设备
|
||||
change4(val){
|
||||
|
||||
},
|
||||
//时间选择
|
||||
pickerTimeFn(type){
|
||||
this.ctimeType = type;
|
||||
this.pickerShow = true;
|
||||
},
|
||||
//日期范围
|
||||
calendarChange(e){
|
||||
pickerChange(e){
|
||||
console.log(e,'日期范围')
|
||||
this.start_date_c = e.startDate;
|
||||
this.end_date_c = e.endDate;
|
||||
let dateTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`;
|
||||
if(this.ctimeType=='start'){
|
||||
this.start_date_c = dateTime;
|
||||
}else if(this.ctimeType=='end'){
|
||||
this.end_date_c = dateTime;
|
||||
}else{}
|
||||
console.log(dateTime,'日期范围')
|
||||
},
|
||||
//删除选择的时间
|
||||
deleteDateFn(){
|
||||
deleteDateFn(type){
|
||||
if(type=='start'){
|
||||
this.start_date_c = '';
|
||||
}else if(type=='end'){
|
||||
this.end_date_c = '';
|
||||
}else{}
|
||||
},
|
||||
resetSecreen(){
|
||||
this.start_date_c = '';
|
||||
this.end_date_c = '';
|
||||
},
|
||||
selectedDateConform(){
|
||||
if(this.start_date_c&&this.end_date_c){
|
||||
this.selectedTimeTip = false;
|
||||
this.q_start_time = this.start_date_c;
|
||||
this.q_end_time = this.end_date_c;
|
||||
this.queryDevices2();
|
||||
this.$refs.uDropdown2.close();
|
||||
}else{
|
||||
this.selectedTimeTip = true;
|
||||
}
|
||||
},
|
||||
//时间筛选
|
||||
openDropDown(index){
|
||||
console.log(index,'openDropDown');
|
||||
this.selectedTimeTip = false;
|
||||
if(index==2){//日期
|
||||
this.start_date_c = this.q_start_time;
|
||||
this.end_date_c = this.q_end_time;
|
||||
}
|
||||
},
|
||||
//查询监测视频
|
||||
queryDevices(){
|
||||
//推特
|
||||
changeRecommend(value,index){
|
||||
console.log(value,index);
|
||||
let id = this.videoList[index].id;
|
||||
this.recommendId(id);
|
||||
},
|
||||
recommendId(id){
|
||||
this.$http.put(`/api/devices-update-recommend/${id}`).then(({data})=>{
|
||||
console.log(data,'recommendId===')
|
||||
|
||||
}).catch((err)=>{
|
||||
|
||||
})
|
||||
},
|
||||
async queryWebsocketIp(){
|
||||
let params = {
|
||||
_t: new Date().getTime()
|
||||
}
|
||||
const {data} = await this.$http.get('/api/ffmpeg-websocket-ip',{params:params});
|
||||
try{
|
||||
console.log(data,'queryWebsocketIp');
|
||||
if(data.code==200){
|
||||
this.websocket = data.data;
|
||||
}
|
||||
}catch(e){
|
||||
//TODO handle the exception
|
||||
}
|
||||
this.queryDeviceBasics('init');
|
||||
},
|
||||
//查询监测
|
||||
queryDevices(type){
|
||||
if(type!='more'){
|
||||
this.loading = 'loadmore';
|
||||
this.page = 1;
|
||||
}
|
||||
let params = {
|
||||
type:this.device_type,
|
||||
base:this.addressValue,
|
||||
status:1,//在线
|
||||
per_page:this.per_page,
|
||||
page:this.page,
|
||||
page:this.page++,
|
||||
_t: new Date().getTime()
|
||||
}
|
||||
if(this.addressValue){
|
||||
params['base'] = this.addressValue;
|
||||
}
|
||||
if(this.device_id){
|
||||
params['point'] = this.device_id;
|
||||
}
|
||||
if(this.is_recommend){
|
||||
params['is_recommend'] = this.is_recommend;
|
||||
}
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/devices',{params:params}).then(({data})=>{
|
||||
console.log(data);
|
||||
this.loading = 'loadmore';
|
||||
if(type!='more'){
|
||||
this.videoList = [];
|
||||
}
|
||||
console.log(data,'监测视频');
|
||||
if(data.code==200){
|
||||
|
||||
let list = data.data;
|
||||
for(let item of list){
|
||||
let url = item.extends.rtsp_url;
|
||||
let {ip,port} = this.websocket;
|
||||
if(url){
|
||||
item.video_url = `ws://${ip}:${port}/rtsp?url=${window.btoa(url)}`
|
||||
}
|
||||
item.bl_recommend = item.is_recommend==1?true:false;
|
||||
}
|
||||
this.videoList = this.videoList.concat(list);
|
||||
if(data.meta.current_page>= data.meta.last_page){
|
||||
this.loading = 'nomore';
|
||||
}
|
||||
console.log(this.videoList,data);
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
this.loading = 'loadmore';
|
||||
})
|
||||
},
|
||||
//查询视频
|
||||
queryDevices2(type){
|
||||
if(type!='more'){
|
||||
this.loading2 = 'loadmore';
|
||||
this.page2 = 1;
|
||||
}
|
||||
let params = {
|
||||
type:this.device_type,
|
||||
status:1,//在线
|
||||
per_page:this.per_page2,
|
||||
page:this.page2++,
|
||||
_t: new Date().getTime()
|
||||
}
|
||||
if(this.addressValue2){
|
||||
params['base'] = this.addressValue2;
|
||||
}
|
||||
if(this.device_id){
|
||||
params['point'] = this.device_id2;
|
||||
}
|
||||
if(this.q_start_time){//时间
|
||||
params['start_time'] = this.q_start_time;
|
||||
params['end_time'] = this.q_end_time;
|
||||
}
|
||||
this.loading2 = 'loading';
|
||||
this.$http.get('/api/devices',{params:params}).then(({data})=>{
|
||||
this.loading2 = 'loadmore';
|
||||
if(type!='more'){this.videoList2 = [];}
|
||||
console.log(data,'监测视频');
|
||||
if(data.code==200){
|
||||
let list = data.data;
|
||||
for(let item of list){
|
||||
let url = item.extends.rtsp_url;
|
||||
if(url){
|
||||
let {username,password,ip,passage,port} = item.extends
|
||||
let stime = this.$u.timeFormat(params['start_time'], 'yyyy_mm_dd_hh_MM_ss');
|
||||
let etime = this.$u.timeFormat(params['end_time'], 'yyyy_mm_dd_hh_MM_ss');
|
||||
let p_url = `rtsp://${username}:${password}@${ip}:${port}/cam/playback?channel=${passage}&subtype=0`;
|
||||
let rtsp_url = `${p_url}&starttime=${stime}&endtime=${etime}`;
|
||||
item.video_url = `ws://${this.websocket.ip}:${this.websocket.port}/rtsp?url=${window.btoa(rtsp_url)}}`
|
||||
console.log(rtsp_url,item.video_url,'视频url');
|
||||
}
|
||||
}
|
||||
this.videoList2 = this.videoList2.concat(list);
|
||||
if(data.meta.current_page>= data.meta.last_page){
|
||||
this.loading2 = 'nomore';
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading2 = 'loadmore';
|
||||
})
|
||||
},
|
||||
//查询地址筛选
|
||||
queryDeviceBasics(){
|
||||
queryDeviceBasics(type){
|
||||
let params = {
|
||||
device_type:this.device_type,
|
||||
_t: new Date().getTime()
|
||||
|
|
@ -163,19 +420,21 @@
|
|||
item['label'] = item.name;
|
||||
item['value'] = item.id;
|
||||
}
|
||||
|
||||
this.deviceAddressList = _data;
|
||||
this.deviceAddressList = JSON.parse(JSON.stringify(_data));
|
||||
this.deviceAddressList2 =_data;
|
||||
this.addressValue = _data[0].id;
|
||||
this.addressName = _data[0].name;
|
||||
|
||||
this.queryAddressDevicePoints(this.addressValue);
|
||||
this.addressValue2 = _data[0].id;
|
||||
this.addressName2 = _data[0].name;
|
||||
this.deviceAddressList.unshift({label:'全部',value:''});
|
||||
this.queryAddressDevicePoints(_data[0].id,type);
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
},
|
||||
//查询地址下的设备监控点
|
||||
queryAddressDevicePoints(id){
|
||||
queryAddressDevicePoints(id,type){
|
||||
let params = {
|
||||
device_type:this.device_type,
|
||||
agricultural_basic:id,
|
||||
|
|
@ -192,16 +451,43 @@
|
|||
item['value'] = _data[k];
|
||||
options.push(item);
|
||||
}
|
||||
this.options2 = options;
|
||||
this.device_id = options[0].value;
|
||||
console.log(this.options2,this.device_id,'this.options2')
|
||||
this.queryDevices();
|
||||
|
||||
console.log(type,'初始查询')
|
||||
|
||||
console.log(this.options2,this.device_id,'this.options2');
|
||||
if(this.current==0){//监控
|
||||
this.options2 = JSON.parse(JSON.stringify(options));;
|
||||
this.device_id = options[0].value;
|
||||
this.options2.unshift({label:'全部',value:''});
|
||||
this.queryDevices();
|
||||
}else{//视频
|
||||
this.options4 = options;
|
||||
this.device_id2 = options[0].value;
|
||||
|
||||
}
|
||||
if(type=='init'){//初始查询
|
||||
this.options4 = options;
|
||||
this.device_id2 = options[0].value;
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.current==0){
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryDevices('more');
|
||||
}
|
||||
}else{
|
||||
if(this.loading2=='loadmore'){
|
||||
this.queryDevices2('more');
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -212,4 +498,35 @@
|
|||
.utab-section{
|
||||
padding: 30rpx;
|
||||
}
|
||||
.content-box{
|
||||
padding: 30rpx;
|
||||
}
|
||||
.video_ul{
|
||||
.video_li{
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
padding: 0 12rpx;
|
||||
margin-bottom: 30rpx;
|
||||
.video_cd{
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.bottom-box{
|
||||
padding-top: 30rpx;
|
||||
padding-bottom: 30rpx;
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
.row{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
}
|
||||
.address{
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,700 @@
|
|||
<template>
|
||||
<view class="role-page bg-page">
|
||||
<u-sticky>
|
||||
<view class="top-title-box">
|
||||
<view class="title">账号列表</view>
|
||||
<view class="handle-option">
|
||||
<u-button class="btn" size="medium"
|
||||
@click="addBtn()" type="primary">新增</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<view class="content-box">
|
||||
<u-swipe-action class="tb_swipe_list"
|
||||
v-for="(item, index) in list"
|
||||
:show="item.show" :index="index" :key="item.id"
|
||||
@click="click"
|
||||
@open="open"
|
||||
:options="options"
|
||||
>
|
||||
<view class="tb_body" @click="showInfo(index)">
|
||||
<view class="row_box">
|
||||
<view class="text">用户名:{{ item.username }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">昵称:{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">部门:{{ item.department?item.department:'-' }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">是否启用:{{item.is_enable==1?'是':'否'}}</view>
|
||||
</view>
|
||||
<view class="tag_status">
|
||||
<u-tag text="在职" v-if="item.status==1" type="success" size="mini"/>
|
||||
<u-tag text="离职" v-if="item.status==2" type="error" size="mini"/>
|
||||
<u-tag text="休假" v-if="item.status==3" type="info" size="mini"/>
|
||||
</view>
|
||||
</view>
|
||||
</u-swipe-action>
|
||||
</view>
|
||||
<!-- 编辑 -->
|
||||
<u-popup v-model="editShow" border-radius="28" width="92%" height="70%"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||
<view class="popup-form-ubox">
|
||||
<view class="top_box">
|
||||
<view class="title" v-if="setInfo.id">编辑账号</view>
|
||||
<view class="title" v-else>新增账号</view>
|
||||
</view>
|
||||
<scroll-view class="scroll-y" scroll-y="true">
|
||||
<view class="form_edit" style="padding-left: 50rpx;">
|
||||
<u-form>
|
||||
<u-form-item label="用户ID" label-width="140" v-if="setInfo.id">
|
||||
<view class="input_box bg_colorf8">
|
||||
<u-input v-model="setInfo.id" :disabled="true" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="用户名" label-width="140" :required='true'>
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.username" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="密码" v-if="!setInfo.id" label-width="140" :required='true'>
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.password" type="password"/>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="昵称" label-width="140" :required='true'>
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.name" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="角色选择" label-width="140" :required='true'>
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="roleSelectFn()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.role_id">{{setInfo.role_name}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="状态" label-width="140" :required='true'>
|
||||
<u-radio-group v-model="setInfo.status"
|
||||
@change="radioGroupChange">
|
||||
<u-radio
|
||||
v-for="(item, index) in statusList" :key="index"
|
||||
:name="item.value">
|
||||
{{item.name}}
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item>
|
||||
<u-form-item label="部门" label-width="140">
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.department" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号" label-width="140">
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.phone" type="number"/>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="基地数据" label-width="140">
|
||||
<view class="input_box">
|
||||
<view class="u-select-list select_multiple" @click="basePopupShow()">
|
||||
<view class="value u-line-2"
|
||||
v-if="seletedShow">{{seletedShow}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="buttom_section">
|
||||
<u-button class="btn" type="default" @click="editShow = false">取消</u-button>
|
||||
<u-button class="btn" @click="editInfoBtn()" type="primary">确定</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||
<view class="popup-form-info">
|
||||
<view class="top_box u-border-bottom">
|
||||
<view class="handle-btns">
|
||||
<view class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view class="btn_edit" @click="editPwdPopup(formInfo.id)">修改密码</view>
|
||||
<view class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">用户名</view>
|
||||
<view class="flex-1">{{formInfo.username}}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">昵称</view>
|
||||
<view class="flex-1">{{formInfo.name}}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">电话</view>
|
||||
<view class="flex-1">{{formInfo.phone}}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">部门</view>
|
||||
<view class="flex-1">{{formInfo.department?formInfo.department:'-' }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">是否启用</view>
|
||||
<view class="flex-1 flex-row align-items">
|
||||
<view class="text" style="margin-right: 20rpx;">
|
||||
{{formInfo.is_enable==1?'是':'否'}}
|
||||
</view>
|
||||
<u-switch v-model="checked" size="34"
|
||||
@change="enableChange"></u-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">状态</view>
|
||||
<view class="flex-1" v-if="formInfo.status==1">
|
||||
<u-tag text="在职" type="success" size="mini"/>
|
||||
</view>
|
||||
<view class="flex-1" v-if="formInfo.status==2">
|
||||
<u-tag text="离职" type="error" size="mini"/>
|
||||
</view>
|
||||
<view class="flex-1" v-if="formInfo.status==3">
|
||||
<u-tag text="休假" type="info" size="mini"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- 基地数据 -->
|
||||
<u-popup v-model="popupShow2" border-radius="28" width="90%" height="60%"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="920">
|
||||
<view class="popup-select-section">
|
||||
<view class="top_section">
|
||||
<view class="title">基地数据</view>
|
||||
</view>
|
||||
<scroll-view class="scrollY" scroll-y="true">
|
||||
<view class="info_cont">
|
||||
<view class="select-box">
|
||||
<view class="select-item" v-for="(item,index) in basicList" :key="index"
|
||||
@click="selectedItem(item,index)" :class="[item.active?'active':'']">
|
||||
<view class="label">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="buttom_section">
|
||||
<u-button class="btn" type="default" @click="popupShow2 = false">取消</u-button>
|
||||
<u-button class="btn" @click="baseSelectedConfirm()" type="primary">确定</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- 修改密码 -->
|
||||
<u-popup v-model="editPwdShow" border-radius="28" width="92%" height="550rpx"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||
<view class="popup-form-ubox">
|
||||
<view class="top_box">
|
||||
<view class="title">修改密码</view>
|
||||
</view>
|
||||
<scroll-view class="scroll-y" scroll-y="true">
|
||||
<view class="form_edit" style="padding-left: 50rpx;">
|
||||
<u-form :model="form" ref="uFormPwd">
|
||||
<u-form-item label="密码" prop="password" label-width="160" :required='true'>
|
||||
<view class="input_box">
|
||||
<u-input v-model="form.password" type="password"/>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="确定密码" prop="password2" label-width="160" :required='true'>
|
||||
<view class="input_box">
|
||||
<u-input v-model="form.password2" type="password"/>
|
||||
</view>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="buttom_section">
|
||||
<u-button class="btn" type="default" @click="editPwdShow = false">取消</u-button>
|
||||
<u-button class="btn" @click="editPassword()" type="primary">确定</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-select v-model="select2" :list="rolelist" :default-value="defaultRoleValue" mode="single-column"
|
||||
@confirm="uselectConfirm"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
per_page:10,
|
||||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
formInfo:{},
|
||||
basicList:[],//基地数据
|
||||
popupShow2:false,//选择基地数据
|
||||
seletedBaseList:[],
|
||||
statusList:[
|
||||
{
|
||||
name: '在职',
|
||||
value:1
|
||||
},
|
||||
{
|
||||
name: '离职',
|
||||
value:2
|
||||
},
|
||||
{
|
||||
name: '休假',
|
||||
value:3
|
||||
}
|
||||
],
|
||||
setInfo:{
|
||||
id:'',
|
||||
username:'',
|
||||
name:'',
|
||||
password:'',
|
||||
role_id:'',
|
||||
role_name:'',
|
||||
status:'',
|
||||
department:'',
|
||||
phone:'',
|
||||
base_ids:[]
|
||||
},
|
||||
rolelist:[],
|
||||
select2:false,
|
||||
checked:false,
|
||||
editPwdShow:false,
|
||||
form: {
|
||||
id:'',
|
||||
password:'',
|
||||
password2:'',
|
||||
},
|
||||
rules: {
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入密码',
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
password2: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入密码',
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
return value==this.form.password;
|
||||
},
|
||||
message: '两次密码不一致',
|
||||
trigger: ['blur'],
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
seletedShow(){
|
||||
let arrName = [];
|
||||
for(let item of this.seletedBaseList){
|
||||
arrName.push(item.name);
|
||||
}
|
||||
let showName = arrName.length?arrName.join(','):'';
|
||||
return showName;
|
||||
},
|
||||
defaultRoleValue(){
|
||||
let def_val = [0];
|
||||
let roleId = this.setInfo.role_id;
|
||||
if(roleId){
|
||||
for(let i=0;i< this.rolelist.length;i++){
|
||||
if(this.rolelist[i].id==roleId){
|
||||
def_val = [i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return def_val;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.queryDataList();
|
||||
this.getAgriculturalBasic();
|
||||
this.getRoles();
|
||||
},
|
||||
methods: {
|
||||
enableChange(val){
|
||||
this.formInfo.is_enable = val?1:0;
|
||||
let id = this.formInfo.id;
|
||||
if(id){
|
||||
this.$http.put(`/api/admin-users/${id}/enable`).then(({data})=>{
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
addBtn(){
|
||||
this.setInfoKeys('add');
|
||||
this.editShow = true;
|
||||
},
|
||||
roleSelectFn(){
|
||||
this.select2 = true;
|
||||
},
|
||||
uselectConfirm(e){
|
||||
console.log(e)
|
||||
this.setInfo.role_id = e[0].value;
|
||||
this.setInfo.role_name = e[0].label;
|
||||
},
|
||||
radioGroupChange(e){
|
||||
console.log(e)
|
||||
},
|
||||
basePopupShow(){
|
||||
let seletIds = this.setInfo.base_ids;
|
||||
this.basicList.forEach((item)=>{item.active = false;})
|
||||
for(let base of this.basicList){
|
||||
for(let id of seletIds){
|
||||
if(base.id==id){
|
||||
base.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.popupShow2 = true;
|
||||
},
|
||||
showInfo(index){
|
||||
this.cindex = index;
|
||||
let _id = this.list[index].id;
|
||||
this.queryInfo(_id);
|
||||
this.formInfo = this.list[index];
|
||||
this.checked = this.formInfo.is_enable==1?true:false;
|
||||
this.popupShow = true;
|
||||
|
||||
},
|
||||
open(index){
|
||||
this.list[index].show = true;
|
||||
},
|
||||
click(index, index1) {
|
||||
console.log(index,index1,this.list[index])
|
||||
if(index1 == 1) {
|
||||
this.cindex = index;
|
||||
let _id = this.list[index].id;
|
||||
this.deleteInfoId(_id);
|
||||
} else {//编辑
|
||||
let _id = this.list[index].id;
|
||||
this.queryInfo(_id);
|
||||
this.formInfo = this.list[index];
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.list[index].show = false;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
queryDataList(refresh){
|
||||
if(refresh){
|
||||
this.loading = 'loadmore';
|
||||
this.page = 1;
|
||||
}
|
||||
if(this.loading=='nomore'){//超出最大页
|
||||
return false;
|
||||
}
|
||||
let params = {
|
||||
per_page:this.per_page,
|
||||
page: this.page ++,
|
||||
_t: new Date().getTime()
|
||||
}
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/admin-users',{params:params}).then(({data})=>{
|
||||
console.log(data)
|
||||
if(refresh){
|
||||
this.list = [];
|
||||
}
|
||||
this.loading = 'loadmore';
|
||||
if(data.code==200){
|
||||
let _list = data.data|| [];
|
||||
for(let item of _list){
|
||||
item.show = false;
|
||||
}
|
||||
this.list = this.list.concat(_list);
|
||||
console.log(this.list);
|
||||
if(this.list.length>= data.meta.total){
|
||||
this.loading ='nomore';
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = 'loadmore';
|
||||
})
|
||||
},
|
||||
//修改
|
||||
editInfoBtn(){
|
||||
let {id,username,name,role_id,status,department,phone,base_ids,password} = this.setInfo;
|
||||
let params = {
|
||||
name:name,
|
||||
username:username,
|
||||
role_id:role_id,
|
||||
status:status,
|
||||
base_ids:base_ids,
|
||||
phone:phone,
|
||||
department:department,
|
||||
}
|
||||
if(id){params['id'] = id;}
|
||||
if(params['id']){
|
||||
this.$http.put(`/api/admin-users/${id}`,params).then(({data})=>{
|
||||
if(data.code==200){
|
||||
this.editShow = false;
|
||||
this.queryDataList(true);
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
}else{
|
||||
params['password'] = password;
|
||||
this.$http.post(`/api/admin-users`,params).then(({data})=>{
|
||||
if(data.code==200){
|
||||
this.queryDataList(true);
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
editInfoId(id){
|
||||
// this.queryInfo(id);
|
||||
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.popupShow = false;
|
||||
},
|
||||
setInfoKeys(type){
|
||||
let info = {
|
||||
id:'',
|
||||
username:'',
|
||||
name:'',
|
||||
password:'',
|
||||
role_id:'',
|
||||
role_name:'',
|
||||
status:'',
|
||||
department:'',
|
||||
phone:'',
|
||||
base_ids:[],
|
||||
base_names:[],
|
||||
}
|
||||
if(type=='add'){
|
||||
this.seletedBaseList = [];
|
||||
this.setInfo = info;
|
||||
}else{
|
||||
let {id,name,username,status,department,phone,bases,roles} = this.formInfo;
|
||||
info['id'] = id;
|
||||
info['username'] = username;
|
||||
info['name'] = name;
|
||||
info['status'] = status;
|
||||
info['department'] = department;
|
||||
info['phone'] = phone;
|
||||
if(roles&&roles[0]&&roles[0].id){
|
||||
info['role_id'] = roles[0].id;
|
||||
info['role_name'] = roles[0].name;
|
||||
}
|
||||
if(bases&&bases.length){
|
||||
let arr = [];
|
||||
for(let b of bases){
|
||||
arr.push(b.id);
|
||||
}
|
||||
info['base_ids'] = arr;
|
||||
this.seletedBaseList = bases;
|
||||
}else{
|
||||
info['base_ids'] = [];
|
||||
this.seletedBaseList = [];
|
||||
}
|
||||
this.setInfo = info;
|
||||
}
|
||||
},
|
||||
//删除deleteInfoId
|
||||
deleteInfoId(id){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确定删除?',
|
||||
success: (res)=> {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
this.$http.delete(`/api/admin-users/${id}`).then(({data})=>{
|
||||
if(data.code==200){
|
||||
this.formInfo = {};//重置删除
|
||||
this.popupShow = false;
|
||||
this.list.splice(this.cindex,1);
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
editPwdPopup(id){
|
||||
this.form.id = id;
|
||||
this.editPwdShow = true;
|
||||
setTimeout(()=>{
|
||||
this.$refs.uFormPwd.setRules(this.rules);
|
||||
},600)
|
||||
|
||||
},
|
||||
//修改密码
|
||||
editPassword(){
|
||||
this.$refs.uFormPwd.validate(valid => {
|
||||
if (valid) {
|
||||
console.log('验证通过');
|
||||
let params = {
|
||||
password:this.form.password,
|
||||
password_confirmation:this.form.password2
|
||||
}
|
||||
this.$http.put(`/api/admin-users/${this.form.id}/edit-password`,params).then(({data})=>{
|
||||
if(data.code==200){
|
||||
this.editPwdShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
} else {
|
||||
console.log('验证失败');
|
||||
}
|
||||
});
|
||||
},
|
||||
queryInfo(id){
|
||||
this.$http.get(`/api/admin-users/${id}`).then(({data})=>{
|
||||
console.log(data,'queryInfo===')
|
||||
if(data.code==200){
|
||||
this.formInfo = data.data;
|
||||
this.setInfoKeys();
|
||||
}
|
||||
}).catch((err)=>{
|
||||
|
||||
})
|
||||
},
|
||||
//选择
|
||||
selectedItem(item,index){
|
||||
this.basicList[index].active = !this.basicList[index].active;
|
||||
},
|
||||
//基础数据
|
||||
baseSelectedConfirm(){
|
||||
let seleteds = [];
|
||||
let ids = [];
|
||||
console.log(this.basicList)
|
||||
for(let item of this.basicList){
|
||||
if(item.active){
|
||||
seleteds.push(item);
|
||||
ids.push(item.id);
|
||||
}
|
||||
}
|
||||
this.seletedBaseList = seleteds;
|
||||
this.setInfo.base_ids = ids;
|
||||
this.popupShow2 = false;
|
||||
},
|
||||
//基地数据
|
||||
getAgriculturalBasic(){
|
||||
let params = { type: 1, per_page: 9999, page: 1 }
|
||||
this.$http.get(`/api/agricultural-basic`,{params:params}).then(({data})=>{
|
||||
if(data.code==200){
|
||||
let list = data.data;
|
||||
for(let item of list){
|
||||
item.active = false;
|
||||
}
|
||||
this.basicList = JSON.parse(JSON.stringify(list));
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
},
|
||||
getRoles(){
|
||||
let params = { type: 1, per_page: 999, page: 1 }
|
||||
this.$http.get(`/api/admin-roles`,{params:params}).then(({data})=>{
|
||||
if(data.code==200){
|
||||
let list = data.data;
|
||||
for(let item of list){
|
||||
item.label = item.name;
|
||||
item.value = item.id
|
||||
}
|
||||
this.rolelist = JSON.parse(JSON.stringify(list));
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
},
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryDataList();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.role-page{
|
||||
.content-box{
|
||||
padding: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.input_box{
|
||||
width: 100%;
|
||||
padding: 0 12rpx;
|
||||
}
|
||||
|
||||
.top-title-box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
justify-content: space-between;
|
||||
border-top: 12rpx solid #eeeeef;
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.handle-option{
|
||||
.btn{
|
||||
font-size: 32rpx;
|
||||
height: 60rpx;
|
||||
padding: 0 40rpx;
|
||||
background-color: rgb(42, 125, 201);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
<template>
|
||||
<view class="bg-page">
|
||||
<u-sticky>
|
||||
<view class="secreen-section" style="background-color: #fff;">
|
||||
<u-dropdown class="dropdown-box" ref="uDropdown">
|
||||
<u-dropdown-item v-model="typevalue" title="动作"
|
||||
:options="typeList" @change="change"></u-dropdown-item>
|
||||
<u-dropdown-item title="时间范围">
|
||||
<view class="slot-content" style="background-color: #FFFFFF;">
|
||||
<view class="select-date u-border-bottom" style="margin-bottom: 0;">
|
||||
<view class="name" @click="pickerTimeFn('start')">
|
||||
<u-icon name="calendar" color="#333" size="32"></u-icon>
|
||||
<text style="margin-left: 6rpx;">开始时间:</text>
|
||||
</view>
|
||||
<view class="time_box">
|
||||
<view class="tip_txt" v-if="!start_date_c"
|
||||
@click="pickerTimeFn('start')">请选择开始时间</view>
|
||||
<view class="tile_val" v-else
|
||||
@click="pickerTimeFn('start')">{{start_date_c}}</view>
|
||||
<view class="delete_btn" v-if="start_date_c" @click="deleteDateFn('start');">
|
||||
<u-icon name="close-circle" color="#333" size="34"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="select-date u-border-bottom" style="margin-bottom: 0;">
|
||||
<view class="name" @click="pickerTimeFn('end')">
|
||||
<u-icon name="calendar" color="#333" size="32"></u-icon>
|
||||
<text style="margin-left: 6rpx;">结束时间:</text>
|
||||
</view>
|
||||
<view class="time_box">
|
||||
<view class="tip_txt" v-if="!end_date_c"
|
||||
@click="pickerTimeFn('end')">请选择结束时间</view>
|
||||
<view class="tile_val" v-else
|
||||
@click="pickerTimeFn('end')">{{end_date_c}}</view>
|
||||
<view class="delete_btn" v-if="end_date_c" @click="deleteDateFn('end')">
|
||||
<u-icon name="close-circle" color="#333" size="34"></u-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn_group">
|
||||
<u-button class="btn" @click="resetSecreen()">重置</u-button>
|
||||
<u-button class="btn" type="primary" @click="selectedDateConform()">查询</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-dropdown-item>
|
||||
|
||||
</u-dropdown>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<u-calendar v-model="calendarShow" :mode="'range'"
|
||||
@change="calendarChange"></u-calendar>
|
||||
<view class="content-box" style="padding-bottom: 60rpx;">
|
||||
<view class="tb_swipe_list"
|
||||
v-for="(item, index) in loglist"
|
||||
:show="item.show" :index="index":key="item.id"
|
||||
>
|
||||
<view class="tb_body" @click="showInfo(index)">
|
||||
<view class="index_num">{{item.snumber}}</view>
|
||||
<view class="row_box">
|
||||
<view class="text">操作人:{{ item.user_name }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">动作:{{ item.type|typename }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">详情:{{ item.message }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">时间:{{ item.created_at|timeFormat}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore :status="loading" margin-top="60"/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {showLoading,toast,formatDate} from '@/com/utils.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
per_page:15,
|
||||
page:1,
|
||||
loglist:[],
|
||||
loading:'loadmore',
|
||||
typeList:[
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '创建',
|
||||
value: 'create',
|
||||
},
|
||||
{
|
||||
label: '修改',
|
||||
value: 'update',
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
value: 'delete',
|
||||
}
|
||||
],
|
||||
typevalue:'',
|
||||
calendarShow:false,
|
||||
start_date_c:'',
|
||||
end_date_c:'',
|
||||
q_start_date:'',
|
||||
q_end_date:'',
|
||||
};
|
||||
},
|
||||
filters:{
|
||||
timeFormat(val){
|
||||
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');
|
||||
},
|
||||
typename(val){
|
||||
let keys = {
|
||||
delete:'删除',
|
||||
create:'创建',
|
||||
update:'修改'
|
||||
}
|
||||
let name = keys[val]?keys[val]:'其它'
|
||||
return name;
|
||||
},
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
this.queryloglist();
|
||||
|
||||
},
|
||||
methods: {
|
||||
change(val){
|
||||
console.log(val);
|
||||
this.queryloglist(true);
|
||||
},
|
||||
selectedDateConform(){
|
||||
this.q_start_date = this.start_date_c;
|
||||
this.q_end_date = this.end_date_c;
|
||||
this.queryloglist(true);
|
||||
this.calendarShow = false;
|
||||
},
|
||||
pickerTimeFn(){
|
||||
this.start_date_c = this.q_start_date;
|
||||
this.end_date_c = this.q_end_date;
|
||||
this.calendarShow = true;
|
||||
},
|
||||
//日期范围
|
||||
calendarChange(e){
|
||||
console.log(e,'日期范围')
|
||||
this.start_date_c = e.startDate;
|
||||
this.end_date_c = e.endDate;
|
||||
},
|
||||
deleteDateFn(){
|
||||
this.resetSecreen();
|
||||
},
|
||||
resetSecreen(){
|
||||
this.start_date_c = '';
|
||||
this.end_date_c = '';
|
||||
},
|
||||
queryloglist(refresh){
|
||||
if(refresh){
|
||||
this.loading = 'loadmore';
|
||||
this.loglist = [];
|
||||
this.page = 1;
|
||||
}
|
||||
if(this.loading=='nomore'){//超出最大页
|
||||
return false;
|
||||
}
|
||||
let params = {
|
||||
per_page:this.per_page,
|
||||
page: this.page ++,
|
||||
_t: new Date().getTime()
|
||||
}
|
||||
if(this.typevalue){
|
||||
params['type'] = this.typevalue;
|
||||
}
|
||||
if(this.q_start_date){
|
||||
params['start_time'] = this.q_start_date+' 00:00:00';
|
||||
params['end_time'] = this.q_end_date+' 23:59:59';
|
||||
}
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/operation-logs',{params:params}).then(({data})=>{
|
||||
|
||||
console.log(data)
|
||||
this.loading = 'loadmore';
|
||||
if(data.code==200){
|
||||
let _list = data.data|| [];
|
||||
let {current_page,per_page,last_page} = data.meta;
|
||||
for(let [index,item] of _list.entries()){
|
||||
console.log(item,index)
|
||||
item.snumber = parseInt(per_page*(current_page-1)+(index+1));
|
||||
}
|
||||
this.loglist = this.loglist.concat(_list);
|
||||
console.log(this.loglist);
|
||||
if(current_page >= last_page){
|
||||
this.loading ='nomore';
|
||||
}
|
||||
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = 'loadmore';
|
||||
})
|
||||
},
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryloglist();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-box{
|
||||
padding: 30rpx 30rpx 60rpx 30rpx;
|
||||
}
|
||||
|
||||
.tb_swipe_list{
|
||||
.tb_body{
|
||||
position: relative;
|
||||
padding-left: 100rpx;
|
||||
.index_num{
|
||||
width: 100rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 34rpx;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top-title-box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
justify-content: space-between;
|
||||
margin-top: 12rpx;
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.handle-option{
|
||||
.btn{
|
||||
font-size: 32rpx;
|
||||
height: 60rpx;
|
||||
padding: 0 40rpx;
|
||||
background-color: rgb(42, 125, 201);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,7 +1,16 @@
|
|||
<template>
|
||||
<view class="role-page bg-page">
|
||||
<u-sticky>
|
||||
<view class="top-title-box">
|
||||
<view class="title">角色列表</view>
|
||||
<view class="handle-option">
|
||||
<u-button class="btn" size="medium"
|
||||
@click="addBtn()" type="primary">新增</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<view class="content-box">
|
||||
<u-swipe-action class="tb_list"
|
||||
<u-swipe-action class="tb_swipe_list"
|
||||
v-for="(item, index) in rolelist"
|
||||
:show="item.show" :index="index" :key="item.id"
|
||||
@click="click"
|
||||
|
|
@ -24,14 +33,15 @@
|
|||
<!-- 编辑 -->
|
||||
<u-popup v-model="editShow" border-radius="28" width="92%" height="70%"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||
<view class="popup-section">
|
||||
<view class="popup-form-ubox">
|
||||
<view class="top_box">
|
||||
<view class="title">编辑角色</view>
|
||||
<view class="title" v-if="formInfo.id">编辑角色</view>
|
||||
<view class="title" v-else>新增角色</view>
|
||||
</view>
|
||||
<scroll-view class="scroll-y" scroll-y="true">
|
||||
<view class="form_edit">
|
||||
<u-form :model="formInfo">
|
||||
<u-form-item label="角色ID" label-width="140">
|
||||
<u-form-item label="角色ID" v-if="formInfo.id" label-width="140">
|
||||
<view class="input_box bg_colorf8">
|
||||
<u-input v-model="formInfo.id" :disabled="true" />
|
||||
</view>
|
||||
|
|
@ -69,7 +79,7 @@
|
|||
</view>
|
||||
</u-popup>
|
||||
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||
<view class="popup-box">
|
||||
<view class="popup-form-info">
|
||||
<view class="top_box">
|
||||
<view class="handle-btns">
|
||||
<view class="btn_del" @click="deleteRoleId(info.id)">删除</view>
|
||||
|
|
@ -138,6 +148,11 @@
|
|||
|
||||
},
|
||||
methods: {
|
||||
addBtn(){
|
||||
this.resetForm();
|
||||
this.isgetInfo = true;
|
||||
this.editShow = true;
|
||||
},
|
||||
handleTreeChange(allSelectedKeys, currentItem) {
|
||||
console.log('handleTreeChange ==>', allSelectedKeys, currentItem);
|
||||
this.formInfo.permissions = allSelectedKeys;
|
||||
|
|
@ -181,10 +196,12 @@
|
|||
}
|
||||
let params = {
|
||||
per_page:this.per_page,
|
||||
page: this.page ++
|
||||
page: this.page ++,
|
||||
_t: new Date().getTime()
|
||||
}
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/admin-roles',{params:params}).then(({data})=>{
|
||||
|
||||
console.log(data)
|
||||
this.loading = 'loadmore';
|
||||
if(data.code==200){
|
||||
|
|
@ -195,7 +212,7 @@
|
|||
this.rolelist = this.rolelist.concat(_list);
|
||||
console.log(this.rolelist);
|
||||
if(this.rolelist.length>= data.meta.total){
|
||||
this.loading=='nomore';
|
||||
this.loading ='nomore';
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
|
@ -207,21 +224,33 @@
|
|||
if(!this.isgetInfo){
|
||||
return false
|
||||
}
|
||||
let id = this.formInfo.id;
|
||||
let params = {
|
||||
name:this.formInfo.name,
|
||||
slug:this.formInfo.slug,
|
||||
permission_ids:this.formInfo.permissions
|
||||
}
|
||||
this.$http.put(`/api/admin-roles/${id}`,params).then(({data})=>{
|
||||
if(data.code==200){
|
||||
let id = this.formInfo.id;
|
||||
if(id){
|
||||
this.$http.put(`/api/admin-roles/${id}`,params).then(({data})=>{
|
||||
if(data.code==200){
|
||||
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
}else{
|
||||
this.$http.post(`/api/admin-roles`,params).then(({data})=>{
|
||||
if(data.code==200){
|
||||
this.queryAdminRoleList(true);
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
editRoleId(id){
|
||||
this.queryRoleInfo(id);
|
||||
|
|
@ -277,6 +306,16 @@
|
|||
|
||||
})
|
||||
},
|
||||
resetForm(){
|
||||
this.formInfo = {
|
||||
id:'',
|
||||
name:'',
|
||||
slug:'',
|
||||
permissions:'',
|
||||
get_permissions:false
|
||||
};
|
||||
this.defaultCheckedKeysValue = [];
|
||||
}
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
|
|
@ -294,94 +333,27 @@
|
|||
}
|
||||
}
|
||||
|
||||
.tb_list{
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 6rpx;
|
||||
.tb_body{
|
||||
padding: 16rpx;
|
||||
background-color: #fff;
|
||||
.row_box{
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.popup-box{
|
||||
min-height: 450rpx;
|
||||
.top_box{
|
||||
height: 96rpx;
|
||||
padding: 0 40rpx;
|
||||
|
||||
|
||||
.handle-btns{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
.btn_del{
|
||||
color:#fa3534;
|
||||
|
||||
}
|
||||
.btn_edit{
|
||||
color:#2979ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.form_edit{
|
||||
padding: 0 30rpx;
|
||||
|
||||
}
|
||||
.plist{
|
||||
display: flex;
|
||||
padding: 20rpx 40rpx;
|
||||
.label_t{
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.input_box{
|
||||
width: 100%;
|
||||
padding: 0 12rpx;
|
||||
}
|
||||
.popup-section{
|
||||
height: 100%;
|
||||
.top-title-box{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.top_box{
|
||||
height: 96rpx;
|
||||
padding: 0 40rpx;
|
||||
.title{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
align-items: center;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
justify-content: space-between;
|
||||
border-top: 12rpx solid #eeeeef;
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.form_edit{
|
||||
padding: 0 30rpx;
|
||||
.label_tit{
|
||||
padding-top: 28rpx;
|
||||
}
|
||||
}
|
||||
.label_tit{
|
||||
padding: 18rpx 0;
|
||||
}
|
||||
.scroll-y{
|
||||
flex: 1;
|
||||
flex-shrink: 0;
|
||||
min-height: 1px;
|
||||
}
|
||||
.buttom_section{
|
||||
display: flex;
|
||||
padding: 40rpx 24rpx 40rpx 24rpx;
|
||||
.handle-option{
|
||||
.btn{
|
||||
width: 220rpx;
|
||||
font-size: 32rpx;
|
||||
height: 60rpx;
|
||||
padding: 0 40rpx;
|
||||
background-color: rgb(42, 125, 201);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<view class="arrow_R"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nav-list" @click="linnavF('/pages/user/password-edit')">
|
||||
<view class="nav-list" @click="linnavF('/pages/system/account')">
|
||||
<view class="icon_img">
|
||||
<u-icon name="account" size="46"></u-icon>
|
||||
</view>
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
<view class="arrow_R"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nav-list" @click="linnavF('/pages/user/password-edit')">
|
||||
<view class="nav-list" @click="linnavF('/pages/system/log')">
|
||||
<view class="icon_img">
|
||||
<u-icon name="clock" size="46"></u-icon>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue