wechat
ihzero 2023-10-29 18:20:33 +08:00
parent ba46652f9b
commit a442c2ca59
32 changed files with 12650 additions and 14801 deletions

View File

@ -77,6 +77,8 @@
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"sass-loader": "^13.3.2", "sass-loader": "^13.3.2",
"uview-ui": "^1.8.8", "uview-ui": "^1.8.8",
"video.js": "^8.6.1",
"videojs-contrib-hls": "^5.15.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vuex": "^3.2.0", "vuex": "^3.2.0",
"vuex-persistedstate": "^4.1.0" "vuex-persistedstate": "^4.1.0"

View File

@ -4,12 +4,13 @@ export default {
onLaunch: function () { onLaunch: function () {
console.log('App Launch') console.log('App Launch')
if (!(store.state.user_access_token && store.state.userInfo['id'])) { if (!store.state.user_access_token) {
// //
uni.redirectTo({ uni.redirectTo({
url: '/pages/login/login', url: '/pages/login/login',
}) })
} else { } else {
this.$store.dispatch('getUserInfo')
// console.log(store.state.user_access_token) // console.log(store.state.user_access_token)
} }
}, },
@ -28,7 +29,8 @@ export default {
<style lang="scss"> <style lang="scss">
@import 'uview-ui/index.scss'; @import 'uview-ui/index.scss';
/*每个页面公共css */ /*每个页面公共css */
body, uni-page-body { body,
uni-page-body {
background-color: #f8f8f8; background-color: #f8f8f8;
} }
@ -647,8 +649,8 @@ body, uni-page-body {
} }
} }
.dropdownClose{ .dropdownClose {
.u-dropdown__content{ .u-dropdown__content {
pointer-events: none; pointer-events: none;
} }
} }

View File

@ -32,6 +32,7 @@
</u-popup> </u-popup>
</template> </template>
<script> <script>
import checkPermission from '@/utils/permission.js'
export default { export default {
props: { props: {
value: { value: {
@ -46,6 +47,14 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
editAuth: {
type: Array,
default: () => [],
},
delAuth: {
type: Array,
default: () => [],
},
}, },
computed: { computed: {
show: { show: {
@ -57,10 +66,10 @@ export default {
}, },
}, },
isEdit() { isEdit() {
return !!this.$listeners.onEdit return !!this.$listeners.onEdit && checkPermission(this.editAuth)
}, },
isDel() { isDel() {
return !!this.$listeners.onDel return !!this.$listeners.onDel && checkPermission(this.delAuth)
}, },
columsList() { columsList() {
const arr = [] const arr = []

View File

@ -0,0 +1,103 @@
<template>
<div class="video-js" ref="videos" style="width: 100%; height: 100%"></div>
</template>
<script>
import videojs from 'video.js'
import 'videojs-contrib-hls'
import 'video.js/dist/video-js.css'
export default {
props: {
url: {
type: String,
default: '',
},
id: {
type: String,
default: 'videoRefI',
},
},
data() {
return {
player: null,
}
},
mounted() {
this.initVideo()
},
beforeDestroy() {
this.player?.dispose()
},
methods: {
initVideo() {
let video = document.createElement('video')
video.id = this.id
video.style = 'width: 100%; height: 100%;'
video.controls = true
video.preload = 'auto'
video.setAttribute('playsinline', true) //IOS
video.setAttribute('webkit-playsinline', true) //baiios 10duzhivideo
video.setAttribute('x5-video-player-type', 'h5') // H5 video西
let source = document.createElement('source')
source.src = this.url
video.appendChild(source)
// return
this.$refs.videos.appendChild(video)
let that = this
let player = videojs(
this.id,
{
playbackRates: [0.7, 1.0, 1.5, 2.0], //
autoDisable: true,
preload: 'none', //auto - meta - none -
language: 'zh-CN',
fluid: true, //
muted: true, //
aspectRatio: '16:9', // 使 - "16:9""4:3"
controls: false, // true,false ,api
autoplay: true, //true, autoplay: "muted", // //,muted:
loop: true, //
screenshot: true,
controlBar: {
volumePanel: {
//
inline: false, // 使
},
timeDivider: true, // 线
durationDisplay: true, //
progressControl: true, //
remainingTimeDisplay: true, //
fullscreenToggle: true, //
pictureInPictureToggle: true, //
},
},
function () {
this.on('error', function (err) {
//
console.log('请求数据时遇到错误', err)
})
this.on('stalled', function (stalled) {
//
console.log('网速失速', stalled)
})
}
)
},
},
}
</script>
<style lang="scss">
// .vjs-loading-spinner {
// .vjs-control-text {
// display: none !important;
// }
// }
.myvideo {
@apply w-full h-full;
video {
@apply w-full h-full;
}
}
</style>

View File

@ -0,0 +1,14 @@
import permission from './permission'
const install = function(Vue) {
Vue.directive('permission', permission)
}
if (window.Vue) {
window['permission'] = permission
Vue.use(install); // eslint-disable-line
}
permission.install = install
export default permission

View File

@ -0,0 +1,30 @@
import store from '@/store'
function checkPermission(el, binding) {
const { value } = binding
const roles = store.getters && (store.getters.userInfo?.permissions_slug ?? [])
if (value && value instanceof Array) {
if (value.length > 0) {
const permissionRoles = value
const hasPermission = roles.some(role => {
return permissionRoles.includes(role)
})
if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el)
}
}
} else {
throw new Error(`need roles! Like v-permission="['admin','editor']"`)
}
}
export default {
inserted(el, binding) {
checkPermission(el, binding)
},
update(el, binding) {
checkPermission(el, binding)
}
}

View File

@ -13,6 +13,9 @@ Vue.component('ynSelectInputList', ynSelectInputList)
Vue.prototype.$http = http Vue.prototype.$http = http
Vue.prototype.$getFullUrl = getFullUrl Vue.prototype.$getFullUrl = getFullUrl
App.mpType = 'app' App.mpType = 'app'
import permission from '@/directive/permission/index.js'
Vue.directive('auth', permission)

View File

@ -2,7 +2,12 @@
<view> <view>
<Appbar title="基地数据"> <Appbar title="基地数据">
<template #right> <template #right>
<view class="text-white mr-20px" @click="handleCreate"></view> <view
v-auth="['endpoint.agricultural_basic.create']"
class="text-white mr-20px"
@click="handleCreate"
>新增</view
>
</template> </template>
</Appbar> </Appbar>
<u-sticky> <u-sticky>
@ -61,6 +66,8 @@
:data="currentData" :data="currentData"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDel="handleDel" @onDel="handleDel"
:editAuth="['endpoint.agricultural_basic.edit']"
:delAuth="['endpoint.agricultural_basic.destroy']"
></BaseTablePopup> ></BaseTablePopup>
<!-- 编辑 --> <!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑基地' : '新增基地'"> <cuPopup v-model="formShow" :title="currentData ? '编辑基地' : '新增基地'">
@ -80,6 +87,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue' import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue' import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue' import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [ const baseTableColums = [
{ {
title: '基地名称', title: '基地名称',
@ -164,22 +172,7 @@ export default {
}, },
}, },
dataList: [], dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false, formShow: false,
baseShow: false, baseShow: false,
searchFormSchema: [ searchFormSchema: [
@ -211,6 +204,30 @@ export default {
], ],
} }
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.agricultural_basic.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.agricultural_basic.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) =>
checkPermission(e.permission)
)
},
},
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
this.filterParmas = e this.filterParmas = e

View File

@ -3,9 +3,9 @@
<view class="bg-white p-30rpx"> <view class="bg-white p-30rpx">
<view class="flex justify-between items-center"> <view class="flex justify-between items-center">
<view class="text-32rpx">全市数据统计</view> <view class="text-32rpx">全市数据统计</view>
<u-button size="mini" @click="cityEditShow = true">编辑</u-button> <u-button size="mini" v-auth="['endpoint.town_street.base_statistics_edit']" @click="cityEditShow = true"></u-button>
</view> </view>
<view class="grid grid-cols-2 mt-20rpx"> <view class="grid grid-cols-2 mt-20rpx" v-auth="['endpoint.town_street.base_statistics']">
<CountItem <CountItem
v-for="(item, i) in showCityList" v-for="(item, i) in showCityList"
:key="i" :key="i"

View File

@ -2,7 +2,7 @@
<view> <view>
<Appbar title="基地农作物"> <Appbar title="基地农作物">
<template #right> <template #right>
<view class="text-white mr-20px" @click="handleCreate"></view> <view v-auth="['endpoint.crops.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template> </template>
</Appbar> </Appbar>
<u-sticky> <u-sticky>
@ -52,17 +52,9 @@
:data="currentData" :data="currentData"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDel="handleDel" @onDel="handleDel"
:editAuth="['endpoint.crops.edit']"
:delAuth="['endpoint.crops.destroy']"
> >
<!-- <template #extends="{ data }">
<view
class="flex justify-between w-full px-30rpx py-20rpx"
v-for="(item, i) in data.value"
:key="i"
>
<view> 名称{{ item.name }}</view>
<view> 单位{{ item.unit }}</view>
</view>
</template> -->
</BaseTablePopup> </BaseTablePopup>
<!-- 编辑 --> <!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑农作物' : '新增农作物'"> <cuPopup v-model="formShow" :title="currentData ? '编辑农作物' : '新增农作物'">
@ -83,6 +75,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue' import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue' import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue' import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [ const baseTableColums = [
{ {
title: '名称', title: '名称',
@ -128,22 +121,6 @@ export default {
}, },
}, },
dataList: [], dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false, formShow: false,
baseShow: false, baseShow: false,
searchFormSchema: [ searchFormSchema: [
@ -158,6 +135,28 @@ export default {
], ],
} }
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.crops.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.crops.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
this.filterParmas = e this.filterParmas = e

View File

@ -2,7 +2,12 @@
<view> <view>
<Appbar title="城镇农作物"> <Appbar title="城镇农作物">
<template #right> <template #right>
<view class="text-white mr-20px" @click="handleCreate"></view> <view
v-auth="['endpoint.town_crops.create']"
class="text-white mr-20px"
@click="handleCreate"
>新增</view
>
</template> </template>
</Appbar> </Appbar>
<u-sticky> <u-sticky>
@ -52,20 +57,15 @@
:data="currentData" :data="currentData"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDel="handleDel" @onDel="handleDel"
:editAuth="['endpoint.town_crops.edit']"
:delAuth="['endpoint.town_crops.destroy']"
> >
<!-- <template #extends="{ data }">
<view
class="flex justify-between w-full px-30rpx py-20rpx"
v-for="(item, i) in data.value"
:key="i"
>
<view> 名称{{ item.name }}</view>
<view> 单位{{ item.unit }}</view>
</view>
</template> -->
</BaseTablePopup> </BaseTablePopup>
<!-- 编辑 --> <!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑农作物' : '新增农作物'"> <cuPopup
v-model="formShow"
:title="currentData ? '编辑农作物' : '新增农作物'"
>
<BasicsEdit <BasicsEdit
@cancel="formShow = false" @cancel="formShow = false"
@confirm="handleEditConfirm" @confirm="handleEditConfirm"
@ -82,6 +82,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue' import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue' import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue' import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [ const baseTableColums = [
{ {
title: '名称', title: '名称',
@ -127,22 +128,6 @@ export default {
}, },
}, },
dataList: [], dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false, formShow: false,
baseShow: false, baseShow: false,
searchFormSchema: [ searchFormSchema: [
@ -157,6 +142,28 @@ export default {
], ],
} }
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.town_crops.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.town_crops.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
this.filterParmas = e this.filterParmas = e

View File

@ -3,7 +3,7 @@
<u-navbar title="设备管理" :background="background" :custom-back="goback" <u-navbar title="设备管理" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.device.create']" class="custom_btn add_btn" @click="addBtn()"></view>
</view> </view>
</u-navbar> </u-navbar>
<view class="secreen-section"> <view class="secreen-section">
@ -172,8 +172,8 @@
<view class="popup-form-info"> <view class="popup-form-info">
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="handle-btns"> <view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view> <view class="btn_del" v-auth="['endpoint.device.destroy']" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view> <view class="btn_edit" v-auth="['endpoint.device.edit']" @click="editInfoId(formInfo.id)"></view>
</view> </view>
</view> </view>
<view class="section_c"> <view class="section_c">
@ -288,6 +288,7 @@
<script> <script>
import {navigateBack} from '@/com/utils.js' import {navigateBack} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default { export default {
data() { data() {
return { return {
@ -299,20 +300,6 @@
page:1, page:1,
list:[], list:[],
loading:'loadmore', loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false, popupShow:false,
cindex:-1,// cindex:-1,//
editShow:false, editShow:false,
@ -433,7 +420,28 @@
} }
}; };
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.device.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.device.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
onLoad() { onLoad() {
this.queryDataList(); this.queryDataList();
this.getDeviceTypes(); this.getDeviceTypes();

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<u-navbar title="稻虾产业" :background="background" :custom-back="goback" <u-navbar title="稻虾产业" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.rice_shrimp_industries.create']" class="custom_btn add_btn" @click="addBtn()"></view>
</view> </view>
</u-navbar> </u-navbar>
<view class="secreen-section"> <view class="secreen-section">
@ -125,8 +125,8 @@
<view class="popup-form-info"> <view class="popup-form-info">
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="handle-btns"> <view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view> <view v-auth="['endpoint.rice_shrimp_industries.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view> <view v-auth="['endpoint.rice_shrimp_industries.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view> </view>
</view> </view>
<view class="section_c"> <view class="section_c">
@ -195,6 +195,7 @@
<script> <script>
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js' import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default { export default {
data() { data() {
return { return {
@ -206,20 +207,7 @@
page:1, page:1,
list:[], list:[],
loading:'loadmore', loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false, popupShow:false,
cindex:-1,// cindex:-1,//
editShow:false, editShow:false,
@ -276,6 +264,28 @@
] ]
}; };
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.rice_shrimp_industries.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.rice_shrimp_industries.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters:{ filters:{
quartername(val){ quartername(val){
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'} let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}

View File

@ -3,7 +3,7 @@
<u-navbar title="大宗物资" :background="background" :custom-back="goback" <u-navbar title="大宗物资" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.materiels.create']" class="custom_btn add_btn" @click="addBtn()"></view>
</view> </view>
</u-navbar> </u-navbar>
<view class="secreen-section"> <view class="secreen-section">
@ -134,8 +134,8 @@
<view class="popup-form-info"> <view class="popup-form-info">
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="handle-btns"> <view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view> <view class="btn_del" v-auth="['endpoint.materiels.destroy']" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view> <view class="btn_edit" v-auth="['endpoint.materiels.edit']" @click="editInfoId(formInfo.id)"></view>
</view> </view>
</view> </view>
<view class="section_c"> <view class="section_c">
@ -225,6 +225,7 @@
<script> <script>
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js' import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default { export default {
data() { data() {
return { return {
@ -236,20 +237,6 @@
page:1, page:1,
list:[], list:[],
loading:'loadmore', loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false, popupShow:false,
cindex:-1,// cindex:-1,//
editShow:false, editShow:false,
@ -319,6 +306,28 @@
] ]
}; };
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.materiels.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.materiels.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters:{ filters:{
quartername(val){ quartername(val){
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'} let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,13 +10,13 @@
<view class="content-box"> <view class="content-box">
<view <view
class="menus-section" class="menus-section"
v-for="(menu, index) in menuList" v-for="(menu, index) in menus"
:key="index" :key="index"
> >
<view class="title-t" v-if="menu.parent" <view class="title-t" v-if="menu.parent && menu.children.length>0"
>{{ menu.parent }}-{{ menu.label }}</view >{{ menu.parent }}-{{ menu.label }}</view
> >
<view class="title-t" v-else>{{ menu.label }}</view> <view class="title-t" v-if="!menu.parent && menu.children.length>0">{{ menu.label }}</view>
<view class="menu-ul"> <view class="menu-ul">
<view class="menu-li" v-for="(cdm, i) in menu.children" :key="i"> <view class="menu-li" v-for="(cdm, i) in menu.children" :key="i">
<view class="menu_item" @click="linknavFn(cdm)"> <view class="menu_item" @click="linknavFn(cdm)">
@ -31,6 +31,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
data() { data() {
return { return {
@ -42,44 +43,40 @@ export default {
{ {
label: '气象监测', label: '气象监测',
url: '/pages/index/meteorological', url: '/pages/index/meteorological',
permission: 'endpoint.weather.index',
}, },
{ {
label: '智能监控', label: '智能监控',
url: '/pages/index/monitor', url: '/pages/index/monitor',
permission: 'endpoint.camera.index',
}, },
{ {
label: '土壤监控', label: '土壤监控',
url: '/pages/index/soil-monitoring', url: '/pages/index/soil-monitoring',
permission: 'endpoint.soil.index',
}, },
{ {
label: '水质监控', label: '水质监控',
url: '/pages/index/water-quality', url: '/pages/index/water-quality',
permission: 'endpoint.water.index',
}, },
{ {
label: '昆虫性诱监测', label: '昆虫性诱监测',
url: '/pages/index/insect-monitors', url: '/pages/index/insect-monitors',
permission: 'endpoint.insect.index',
}, },
{ {
label: '虫情监测', label: '虫情监测',
url: '/pages/index/pests', url: '/pages/index/pests',
permission: 'endpoint.worm_statics.index',
}, },
{ {
label: '杀虫灯检测', label: '杀虫灯检测',
url: '/pages/index/insecticidal-lamp', url: '/pages/index/insecticidal-lamp',
permission: 'endpoint.insecticidal_lamp.index',
}, },
], ],
}, },
// {
// label:'',
// children:[
// {
// label:'',
// },
// {
// label:'',
// },
// ],
// },
{ {
label: '全市基础数据', label: '全市基础数据',
parent: '基础数据管理', parent: '基础数据管理',
@ -87,10 +84,12 @@ export default {
{ {
label: '城镇数据', label: '城镇数据',
url: '/pages/basics/town-base', url: '/pages/basics/town-base',
permission: 'endpoint.town_street.index',
}, },
{ {
label: '基地数据', label: '基地数据',
url: '/pages/basics/basics-base', url: '/pages/basics/basics-base',
permission: 'endpoint.agricultural_basic.index',
}, },
], ],
}, },
@ -101,10 +100,12 @@ export default {
{ {
label: '城镇农作物', label: '城镇农作物',
url: '/pages/crop/town-crop', url: '/pages/crop/town-crop',
permission: 'endpoint.town_crops.index',
}, },
{ {
label: '基地农作物', label: '基地农作物',
url: '/pages/crop/basics-crop', url: '/pages/crop/basics-crop',
permission: 'endpoint.crops.index',
}, },
], ],
}, },
@ -115,10 +116,12 @@ export default {
{ {
label: '城镇产量', label: '城镇产量',
url: '/pages/yield/town-yield', url: '/pages/yield/town-yield',
permission: 'endpoint.town_crops_output.index',
}, },
{ {
label: '基地产量', label: '基地产量',
url: '/pages/yield/basics-yield', url: '/pages/yield/basics-yield',
permission: 'endpoint.crops_output.index',
}, },
], ],
}, },
@ -129,22 +132,27 @@ export default {
{ {
label: '稻虾价格', label: '稻虾价格',
url: '/pages/estate/estate-price', url: '/pages/estate/estate-price',
permission: 'endpoint.rice_shrimp_prices.index',
}, },
{ {
label: '稻虾每周价格', label: '稻虾每周价格',
url: '/pages/estate/estate-week-price', url: '/pages/estate/estate-week-price',
permission: 'endpoint.rice_shrimp_weekly_prices.index',
}, },
{ {
label: '稻虾产业', label: '稻虾产业',
url: '/pages/estate/estate-industry', url: '/pages/estate/estate-industry',
permission: 'endpoint.rice_shrimp_industries.index',
}, },
{ {
label: '稻虾流向', label: '稻虾流向',
url: '/pages/estate/estate-flows', url: '/pages/estate/estate-flows',
permission: 'endpoint.rice_shrimp_flows.index',
}, },
{ {
label: '大宗物资', label: '大宗物资',
url: '/pages/estate/estate-materiels', url: '/pages/estate/estate-materiels',
permission: 'endpoint.materiels.index',
}, },
], ],
}, },
@ -154,18 +162,48 @@ export default {
{ {
label: '设备管理', label: '设备管理',
url: '/pages/device/index', url: '/pages/device/index',
permission: 'endpoint.device.index',
}, },
{ {
label: '警报明细', label: '警报明细',
url: '/pages/device/warning', url: '/pages/device/warning',
permission: 'endpoint.warnings.index',
}, },
], ],
}, },
], ],
} }
}, },
computed: {
...mapGetters(['userInfo']),
menus(){
return this.filterAsyncRoutes(this.menuList, this.userInfo?.permissions_slug ?? [])
}
},
onLoad() {}, onLoad() {},
methods: { methods: {
hasPermission(roles, route) {
if (route.permission) {
return roles.some((role) => route.permission.includes(role))
} else {
return true
}
},
filterAsyncRoutes(routes, roles) {
const res = []
routes.forEach((route) => {
const tmp = { ...route }
if (this.hasPermission(roles, tmp)) {
if (tmp.children) {
tmp.children = this.filterAsyncRoutes(tmp.children, roles)
}
res.push(tmp)
}
})
return res
},
linknavFn(item) { linknavFn(item) {
console.log(item) console.log(item)
uni.navigateTo({ uni.navigateTo({

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="tit">预警数据统计</view> <view class="tit">预警数据统计</view>
<view class="set_warning"> <view class="set_warning">
<u-button class="set_btn" @click="setWarnInfo()" size="mini">设置</u-button> <u-button v-auth="['endpoint.soil.setting','endpoint.soil.setting_edit']" class="set_btn" @click="setWarnInfo()" size="mini"></u-button>
</view> </view>
</view> </view>
<view class="cont-box"> <view class="cont-box">

View File

@ -44,7 +44,7 @@
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="tit">预警数据统计</view> <view class="tit">预警数据统计</view>
<view class="set_warning"> <view class="set_warning">
<u-button class="set_btn" @click="setWarnInfo()" size="mini">设置</u-button> <u-button v-auth="['endpoint.water.setting','endpoint.water.setting_edit']" class="set_btn" @click="setWarnInfo()" size="mini"></u-button>
</view> </view>
</view> </view>
<view class="cont-box"> <view class="cont-box">

View File

@ -1,222 +1,231 @@
<template> <template>
<view class="login-page bg-page"> <view class="login-page bg-page">
<view class="img-a"> <view class="img-a">
<view class="t-b"> <view class="t-b"> 隆昌农业大数据监控平台 </view>
隆昌农业大数据监控平台 </view>
<view class="login-view" style="">
</view> <view class="t-login">
</view> <form class="cl">
<view class="login-view" style=""> <view class="t-a">
<view class="t-login"> <text class="txt">账号</text>
<form class="cl"> <input
<view class="t-a"> type="text"
<text class="txt">账号</text> name="username"
<input type="text" name="username" placeholder="请输入您的账号" placeholder="请输入您的账号"
v-model="username" /> v-model="username"
</view> />
<view class="t-a"> </view>
<text class="txt">密码</text> <view class="t-a">
<input type="password" name="password" maxlength="18" <text class="txt">密码</text>
placeholder="请输入您的密码" v-model="password" /> <input
</view> type="password"
<button @tap="login()" type="button"> </button> name="password"
<!-- <view class="reg" @tap="reg()"> </view> --> maxlength="18"
</form> placeholder="请输入您的密码"
</view> v-model="password"
</view> />
</view> </view>
<button @tap="login()" type="button"> </button>
<!-- <view class="reg" @tap="reg()"> </view> -->
</form>
</view>
</view>
</view>
</template> </template>
<script> <script>
import {getStorageSync,setStorageSync,setStorage, toast} from '@/com/utils.js' import {
getStorageSync,
setStorageSync,
setStorage,
toast,
} from '@/com/utils.js'
import jwt from '@/api/jwt.js' import jwt from '@/api/jwt.js'
export default { export default {
data() { data() {
return { return {
username: '', // username: '', //
password: '' // password: '', //
}; }
}, },
onLoad() { onLoad() {},
methods: {
}, //
methods: { login() {
// if (!this.username) {
login() { uni.showToast({ title: '请输入您的账号', icon: 'none' })
if (!this.username) { return
uni.showToast({ title: '请输入您的账号', icon: 'none' }); }
return;
} if (!this.password) {
uni.showToast({ title: '请输入您的密码', icon: 'none' })
if (!this.password) { return
uni.showToast({ title: '请输入您的密码', icon: 'none' }); }
return; let params = {
} username: this.username,
let params = { password: this.password,
username:this.username, }
password:this.password
}; this.$http
.post('/api/auth/login', params, {
this.$http.post('/api/auth/login',params,{ custom: {
custom:{ auth: false,
auth:false },
} })
}).then(({data})=>{ .then(({ data }) => {
console.log(data); console.log(data)
if(data.code==200){ if (data.code == 200) {
let _data = data.data; let _data = data.data
let _info = _data.info; let _info = _data.info
console.log(_data) console.log(_data)
jwt.setAccessToken(_data.token) jwt.setAccessToken(_data.token)
this.$store.dispatch('USER_INFO',_info); this.$store.dispatch('getUserInfo')
uni.switchTab({ uni.switchTab({
url:'/pages/index/index' url: '/pages/index/index',
}) })
uni.showToast({ title: '登录成功!', icon: 'none' }); uni.showToast({ title: '登录成功!', icon: 'none' })
} }
})
}).catch(()=>{ .catch(() => {
uni.showToast({ title: '登录失败!', icon: 'none' }); uni.showToast({ title: '登录失败!', icon: 'none' })
}) })
},
}, },
}
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.login-page{ .login-page {
background-color: #fff; background-color: #fff;
.txt { .txt {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
} }
.img-a { .img-a {
width: 100%; width: 100%;
height: 450rpx; height: 450rpx;
background-image: url(../../static/head.png); background-image: url(../../static/head.png);
background-size: 100%; background-size: 100%;
} }
.reg { .reg {
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
height: 90rpx; height: 90rpx;
line-height: 90rpx; line-height: 90rpx;
border-radius: 50rpx; border-radius: 50rpx;
font-weight: bold; font-weight: bold;
background: #f5f6fa; background: #f5f6fa;
color: #000000; color: #000000;
text-align: center; text-align: center;
margin-top: 30rpx; margin-top: 30rpx;
} }
.login-view { .login-view {
width: 100%; width: 100%;
position: relative; position: relative;
margin-top: -120rpx; margin-top: -120rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 8% 8% 0% 0; border-radius: 8% 8% 0% 0;
} }
.t-login { .t-login {
width: 600rpx; width: 600rpx;
margin: 0 auto; margin: 0 auto;
font-size: 28rpx; font-size: 28rpx;
padding-top: 80rpx; padding-top: 80rpx;
} }
.t-login button { .t-login button {
font-size: 28rpx; font-size: 28rpx;
background: #2796f2; background: #2796f2;
color: #fff; color: #fff;
height: 90rpx; height: 90rpx;
line-height: 90rpx; line-height: 90rpx;
border-radius: 50rpx; border-radius: 50rpx;
font-weight: bold; font-weight: bold;
} }
.t-login input { .t-login input {
height: 90rpx; height: 90rpx;
line-height: 90rpx; line-height: 90rpx;
margin-bottom: 50rpx; margin-bottom: 50rpx;
border-bottom: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9;
font-size: 28rpx; font-size: 28rpx;
} }
.t-login .t-a { .t-login .t-a {
position: relative; position: relative;
} }
.t-b { .t-b {
text-align: left; text-align: left;
font-size: 42rpx; font-size: 42rpx;
color: #ffffff; color: #ffffff;
padding: 130rpx 0 0 70rpx; padding: 130rpx 0 0 70rpx;
font-weight: bold; font-weight: bold;
line-height: 70rpx; line-height: 70rpx;
} }
.t-login .t-c { .t-login .t-c {
position: absolute; position: absolute;
right: 22rpx; right: 22rpx;
top: 22rpx; top: 22rpx;
background: #5677fc; background: #5677fc;
color: #fff; color: #fff;
font-size: 24rpx; font-size: 24rpx;
border-radius: 50rpx; border-radius: 50rpx;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
padding: 0 25rpx; padding: 0 25rpx;
} }
.t-login .t-d { .t-login .t-d {
text-align: center; text-align: center;
color: #999; color: #999;
margin: 80rpx 0; margin: 80rpx 0;
} }
.t-login .t-e { .t-login .t-e {
text-align: center; text-align: center;
width: 250rpx; width: 250rpx;
margin: 80rpx auto 0; margin: 80rpx auto 0;
} }
.t-login .t-g { .t-login .t-g {
float: left; float: left;
width: 50%; width: 50%;
} }
.t-login .t-e image { .t-login .t-e image {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
} }
.t-login .t-f { .t-login .t-f {
text-align: center; text-align: center;
margin: 150rpx 0 0 0; margin: 150rpx 0 0 0;
color: #666; color: #666;
} }
.t-login .t-f text { .t-login .t-f text {
margin-left: 20rpx; margin-left: 20rpx;
color: #aaaaaa; color: #aaaaaa;
font-size: 27rpx; font-size: 27rpx;
} }
.t-login .uni-input-placeholder { .t-login .uni-input-placeholder {
color: #aeaeae; color: #aeaeae;
} }
.cl { .cl {
zoom: 1; zoom: 1;
} }
.cl:after { .cl:after {
clear: both; clear: both;
display: block; display: block;
visibility: hidden; visibility: hidden;
height: 0; height: 0;
content: '\20'; content: '\20';
} }
} }
</style> </style>

View File

@ -4,7 +4,7 @@
<view class="top-title-box"> <view class="top-title-box">
<view class="title">账号列表</view> <view class="title">账号列表</view>
<view class="handle-option"> <view class="handle-option">
<u-button class="btn" size="medium" <u-button v-auth="['endpoint.admin_users.create']" class="btn" size="medium"
@click="addBtn()" type="primary">新增</u-button> @click="addBtn()" type="primary">新增</u-button>
</view> </view>
</view> </view>
@ -127,9 +127,9 @@
<view class="popup-form-info"> <view class="popup-form-info">
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="handle-btns"> <view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view> <view v-auth="['endpoint.admin_users.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editPwdPopup(formInfo.id)"></view> <view v-auth="['endpoint.admin_users.edit_password']" class="btn_edit" @click="editPwdPopup(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view> <view v-auth="['endpoint.admin_users.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view> </view>
</view> </view>
<view class="section_c"> <view class="section_c">
@ -235,6 +235,7 @@
<script> <script>
import {showLoading,hideLoading} from '@/com/utils.js' import {showLoading,hideLoading} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default { export default {
data() { data() {
return { return {
@ -242,20 +243,6 @@
page:1, page:1,
list:[], list:[],
loading:'loadmore', loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false, popupShow:false,
cindex:-1,// cindex:-1,//
editShow:false, editShow:false,
@ -324,6 +311,26 @@
}; };
}, },
computed:{ computed:{
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.device.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.device.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
seletedShow(){ seletedShow(){
let arrName = []; let arrName = [];
for(let item of this.seletedBaseList){ for(let item of this.seletedBaseList){

View File

@ -3,7 +3,7 @@
<u-navbar title="友情链接" :background="background" :custom-back="goback" <u-navbar title="友情链接" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.friend_links.edit']" class="custom_btn add_btn" @click="addBtn()"></view>
</view> </view>
</u-navbar> </u-navbar>
<u-sticky z-index="99"> <u-sticky z-index="99">
@ -164,8 +164,8 @@
<view class="popup-form-info"> <view class="popup-form-info">
<view class="top_box u-border-bottom"> <view class="top_box u-border-bottom">
<view class="handle-btns"> <view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view> <view v-auth="['endpoint.friend_links.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view> <view v-auth="['endpoint.friend_links.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view> </view>
</view> </view>
<view class="section_c"> <view class="section_c">
@ -218,6 +218,7 @@
<script> <script>
import {formatDate,navigateBack,showLoading,hideLoading} from '@/com/utils.js' import {formatDate,navigateBack,showLoading,hideLoading} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default { export default {
data() { data() {
return { return {
@ -229,20 +230,6 @@
page:1, page:1,
list:[], list:[],
loading:'loadmore', loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false, popupShow:false,
cindex:-1,// cindex:-1,//
editShow:false, editShow:false,
@ -287,6 +274,28 @@
dropDownShow:false, dropDownShow:false,
}; };
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.friend_links.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.friend_links.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters:{ filters:{
timeFormat(val){ timeFormat(val){
return formatDate(val*1000, 'yyyy-MM-dd hh:mm'); return formatDate(val*1000, 'yyyy-MM-dd hh:mm');

View File

@ -4,7 +4,7 @@
<view class="top-title-box"> <view class="top-title-box">
<view class="title">角色列表</view> <view class="title">角色列表</view>
<view class="handle-option"> <view class="handle-option">
<u-button class="btn" size="medium" <u-button v-auth="['endpoint.admin_roles.create']" class="btn" size="medium"
@click="addBtn()" type="primary">新增</u-button> @click="addBtn()" type="primary">新增</u-button>
</view> </view>
</view> </view>
@ -82,8 +82,8 @@
<view class="popup-form-info"> <view class="popup-form-info">
<view class="top_box"> <view class="top_box">
<view class="handle-btns"> <view class="handle-btns">
<view class="btn_del" @click="deleteRoleId(info.id)"></view> <view v-auth="['endpoint.admin_roles.destroy']" class="btn_del" @click="deleteRoleId(info.id)"></view>
<view class="btn_edit" @click="editRoleId(info.id)"></view> <view v-auth="['endpoint.admin_roles.edit']" class="btn_edit" @click="editRoleId(info.id)"></view>
</view> </view>
</view> </view>
<view class="section_c"> <view class="section_c">
@ -106,6 +106,7 @@
<script> <script>
import DaTreeVue2 from '@/components/da-tree-vue2/index.vue' import DaTreeVue2 from '@/components/da-tree-vue2/index.vue'
import {showLoading,hideLoading} from '@/com/utils.js' import {showLoading,hideLoading} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default { export default {
components: { DaTreeVue2 }, components: { DaTreeVue2 },
data() { data() {
@ -114,20 +115,6 @@
page:1, page:1,
rolelist:[], rolelist:[],
loading:'loadmore', loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false, popupShow:false,
info:{},// info:{},//
cindex:-1,// cindex:-1,//
@ -144,6 +131,28 @@
defaultCheckedKeysValue: [], defaultCheckedKeysValue: [],
}; };
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.admin_roles.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.admin_roles.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
onLoad() { onLoad() {
this.queryAdminRoleList(); this.queryAdminRoleList();
this.queryPermissions(); this.queryPermissions();

View File

@ -40,16 +40,16 @@
<view class="arrow_R"></view> <view class="arrow_R"></view>
</view> </view>
</view> </view>
<view class="nav-list" @click="linnavF('/pages/system/role')"> <view v-auth="['endpoint.admin_roles.index']" class="nav-list" @click="linnavF('/pages/system/role')">
<view class="icon_img"> <view class="icon_img">
<u-icon name="man-add" size="46"></u-icon> <u-icon name="man-add" size="46"></u-icon>
</view> </view>
<view class="item-c"> <view class="item-c" >
<view class="tname">角色管理</view> <view class="tname">角色管理</view>
<view class="arrow_R"></view> <view class="arrow_R"></view>
</view> </view>
</view> </view>
<view class="nav-list" @click="linnavF('/pages/system/account')"> <view v-auth="['endpoint.admin_users.index']" class="nav-list" @click="linnavF('/pages/system/account')">
<view class="icon_img"> <view class="icon_img">
<u-icon name="account" size="46"></u-icon> <u-icon name="account" size="46"></u-icon>
</view> </view>
@ -58,7 +58,7 @@
<view class="arrow_R"></view> <view class="arrow_R"></view>
</view> </view>
</view> </view>
<view class="nav-list" @click="linnavF('/pages/system/log')"> <view v-auth="['endpoint.operation_log.index']" class="nav-list" @click="linnavF('/pages/system/log')">
<view class="icon_img"> <view class="icon_img">
<u-icon name="clock" size="46"></u-icon> <u-icon name="clock" size="46"></u-icon>
</view> </view>
@ -67,7 +67,7 @@
<view class="arrow_R"></view> <view class="arrow_R"></view>
</view> </view>
</view> </view>
<view class="nav-list" @click="linnavF('/pages/system/links')"> <view v-auth="['endpoint.friend_links.index']" class="nav-list" @click="linnavF('/pages/system/links')">
<view class="icon_img"> <view class="icon_img">
<u-icon name="attach" size="46"></u-icon> <u-icon name="attach" size="46"></u-icon>
</view> </view>

View File

@ -2,7 +2,7 @@
<view> <view>
<Appbar title="基地产量"> <Appbar title="基地产量">
<template #right> <template #right>
<view class="text-white mr-20px" @click="handleCreate"></view> <view v-auth="['endpoint.crops_output.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template> </template>
</Appbar> </Appbar>
<u-sticky> <u-sticky>
@ -61,6 +61,8 @@
:data="currentData" :data="currentData"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDel="handleDel" @onDel="handleDel"
:eidtAuth="['endpoint.crops_output.edit']"
:delAuth="['endpoint.crops_output.destroy']"
></BaseTablePopup> ></BaseTablePopup>
<!-- 编辑 --> <!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑产量' : '新增产量'"> <cuPopup v-model="formShow" :title="currentData ? '编辑产量' : '新增产量'">
@ -81,6 +83,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue' import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue' import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue' import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [ const baseTableColums = [
{ {
title: '街镇名称', title: '街镇名称',
@ -147,22 +150,6 @@ export default {
}, },
}, },
dataList: [], dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false, formShow: false,
baseShow: false, baseShow: false,
searchFormSchema: [ searchFormSchema: [
@ -203,6 +190,28 @@ export default {
], ],
} }
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.crops_output.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.crops_output.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
this.filterParmas = e this.filterParmas = e

View File

@ -2,7 +2,7 @@
<view> <view>
<Appbar title="城镇产量"> <Appbar title="城镇产量">
<template #right> <template #right>
<view class="text-white mr-20px" @click="handleCreate"></view> <view v-auth="['endpoint.town_crops_output.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template> </template>
</Appbar> </Appbar>
<u-sticky> <u-sticky>
@ -61,6 +61,8 @@
:data="currentData" :data="currentData"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDel="handleDel" @onDel="handleDel"
:eidtAuth="['endpoint.town_crops_output.edit']"
:delAuth="['endpoint.town_crops_output.destroy']"
></BaseTablePopup> ></BaseTablePopup>
<!-- 编辑 --> <!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑产量' : '新增产量'"> <cuPopup v-model="formShow" :title="currentData ? '编辑产量' : '新增产量'">
@ -80,6 +82,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue' import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue' import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue' import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [ const baseTableColums = [
{ {
title: '街镇名称', title: '街镇名称',
@ -146,22 +149,7 @@ export default {
}, },
}, },
dataList: [], dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false, formShow: false,
baseShow: false, baseShow: false,
searchFormSchema: [ searchFormSchema: [
@ -202,6 +190,28 @@ export default {
], ],
} }
}, },
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.town_crops_output.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.town_crops_output.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
this.filterParmas = e this.filterParmas = e

View File

@ -1,16 +1,36 @@
import * as types from "./mutation-types"; import * as types from "./mutation-types";
import {getStorageSync,setStorageSync,setStorage} from '@/com/utils.js' import { getStorageSync, setStorageSync, setStorage, clearStorageSync } from '@/com/utils.js'
import jwt from '@/api/jwt.js'
import { http } from '@/api/index.js'
const actions = { const actions = {
[types.USER_INFO]({commit},userInfo){ [types.USER_INFO]({ commit }, userInfo) {
let _data = {}; let _data = {};
if(userInfo&&userInfo.id){ if (userInfo) {
_data = userInfo; console.log(userInfo);
// setStorage('userInfo',userInfo) _data = userInfo;
}else{ // setStorage('userInfo',userInfo)
_data = getStorageSync('userInfo'); } else {
_data = getStorageSync('userInfo');
}
commit(types.USER_INFO, _data);
},
logout({ commit }) {
clearStorageSync()
jwt.clearAccessToken()
},
async getUserInfo({ commit, dispatch }, userInfo) {
try {
const { data } = await http.get('/api/users/info')
dispatch(types.USER_INFO, data.data)
} catch (error) {
dispatch('logout')
uni.reLaunch({
url:'/pages/login/login'
})
}
} }
commit(types.USER_INFO, _data);
},
}; };
export default actions; export default actions;

View File

@ -14,17 +14,17 @@ const store = new Vuex.Store({
actions, actions,
mutations, mutations,
plugins: [ plugins: [
createPersistedState({ createPersistedState({
// 当state中的值发生变化的时候出发reduce函数 // 当state中的值发生变化的时候出发reduce函数
reducer(val) { reducer(val) {
console.log(val,'createPersistedState') // value值为当前state中的所有值对象 console.log(val, 'createPersistedState') // value值为当前state中的所有值对象
// return什么localstorage中的key值为vuex的value值就是什么而且是实时与state中的值保持同步 // return什么localstorage中的key值为vuex的value值就是什么而且是实时与state中的值保持同步
return { return {
userInfo: val.userInfo, userInfo: val.userInfo,
user_access_token:val.user_access_token user_access_token: val.user_access_token
} }
} }
}) })
] ]
}); });

View File

@ -0,0 +1,16 @@
import store from '@/store'
export default function checkPermission(value) {
if (value && value instanceof Array && value.length > 0) {
const roles = store.getters && (store.getters.userInfo?.permissions_slug ?? [])
const permissionRoles = value
const hasPermission = roles.some(role => {
return permissionRoles.includes(role)
})
return hasPermission
} else {
return false
}
}

21581
yarn.lock

File diff suppressed because it is too large Load Diff