wechat
parent
ba46652f9b
commit
a442c2ca59
|
|
@ -77,6 +77,8 @@
|
|||
"node-sass": "^6.0.1",
|
||||
"sass-loader": "^13.3.2",
|
||||
"uview-ui": "^1.8.8",
|
||||
"video.js": "^8.6.1",
|
||||
"videojs-contrib-hls": "^5.15.0",
|
||||
"vue": "^2.6.11",
|
||||
"vuex": "^3.2.0",
|
||||
"vuex-persistedstate": "^4.1.0"
|
||||
|
|
|
|||
10
src/App.vue
10
src/App.vue
|
|
@ -4,12 +4,13 @@ export default {
|
|||
onLaunch: function () {
|
||||
console.log('App Launch')
|
||||
|
||||
if (!(store.state.user_access_token && store.state.userInfo['id'])) {
|
||||
if (!store.state.user_access_token) {
|
||||
//未登录
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login',
|
||||
})
|
||||
} else {
|
||||
this.$store.dispatch('getUserInfo')
|
||||
// console.log(store.state.user_access_token)
|
||||
}
|
||||
},
|
||||
|
|
@ -28,7 +29,8 @@ export default {
|
|||
<style lang="scss">
|
||||
@import 'uview-ui/index.scss';
|
||||
/*每个页面公共css */
|
||||
body, uni-page-body {
|
||||
body,
|
||||
uni-page-body {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
|
|
@ -647,8 +649,8 @@ body, uni-page-body {
|
|||
}
|
||||
}
|
||||
|
||||
.dropdownClose{
|
||||
.u-dropdown__content{
|
||||
.dropdownClose {
|
||||
.u-dropdown__content {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
</u-popup>
|
||||
</template>
|
||||
<script>
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
|
|
@ -46,6 +47,14 @@ export default {
|
|||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
editAuth: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
delAuth: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
show: {
|
||||
|
|
@ -57,10 +66,10 @@ export default {
|
|||
},
|
||||
},
|
||||
isEdit() {
|
||||
return !!this.$listeners.onEdit
|
||||
return !!this.$listeners.onEdit && checkPermission(this.editAuth)
|
||||
},
|
||||
isDel() {
|
||||
return !!this.$listeners.onDel
|
||||
return !!this.$listeners.onDel && checkPermission(this.delAuth)
|
||||
},
|
||||
columsList() {
|
||||
const arr = []
|
||||
|
|
|
|||
|
|
@ -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) //这个bai属性是ios 10中设置可以让视频在小du窗内播放,也就是不是全zhi屏播放的video标签的一个属性
|
||||
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>
|
||||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,9 @@ Vue.component('ynSelectInputList', ynSelectInputList)
|
|||
Vue.prototype.$http = http
|
||||
Vue.prototype.$getFullUrl = getFullUrl
|
||||
App.mpType = 'app'
|
||||
import permission from '@/directive/permission/index.js'
|
||||
|
||||
Vue.directive('auth', permission)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
<view>
|
||||
<Appbar title="基地数据">
|
||||
<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>
|
||||
</Appbar>
|
||||
<u-sticky>
|
||||
|
|
@ -61,6 +66,8 @@
|
|||
:data="currentData"
|
||||
@onEdit="handleEdit"
|
||||
@onDel="handleDel"
|
||||
:editAuth="['endpoint.agricultural_basic.edit']"
|
||||
:delAuth="['endpoint.agricultural_basic.destroy']"
|
||||
></BaseTablePopup>
|
||||
<!-- 编辑 -->
|
||||
<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 BaseTablePopup from '@/components/base-table/popup.vue'
|
||||
import BasicsEdit from './components/basics-edit.vue'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
const baseTableColums = [
|
||||
{
|
||||
title: '基地名称',
|
||||
|
|
@ -164,22 +172,7 @@ export default {
|
|||
},
|
||||
},
|
||||
dataList: [],
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
formShow: false,
|
||||
baseShow: false,
|
||||
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: {
|
||||
handleSubmit(e) {
|
||||
this.filterParmas = e
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
<view class="bg-white p-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<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 class="grid grid-cols-2 mt-20rpx">
|
||||
<view class="grid grid-cols-2 mt-20rpx" v-auth="['endpoint.town_street.base_statistics']">
|
||||
<CountItem
|
||||
v-for="(item, i) in showCityList"
|
||||
:key="i"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view>
|
||||
<Appbar title="基地农作物">
|
||||
<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>
|
||||
</Appbar>
|
||||
<u-sticky>
|
||||
|
|
@ -52,17 +52,9 @@
|
|||
:data="currentData"
|
||||
@onEdit="handleEdit"
|
||||
@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>
|
||||
<!-- 编辑 -->
|
||||
<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 BaseTablePopup from '@/components/base-table/popup.vue'
|
||||
import BasicsEdit from './components/basics-edit.vue'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
const baseTableColums = [
|
||||
{
|
||||
title: '名称',
|
||||
|
|
@ -128,22 +121,6 @@ export default {
|
|||
},
|
||||
},
|
||||
dataList: [],
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
],
|
||||
formShow: false,
|
||||
baseShow: false,
|
||||
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: {
|
||||
handleSubmit(e) {
|
||||
this.filterParmas = e
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
<view>
|
||||
<Appbar title="城镇农作物">
|
||||
<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>
|
||||
</Appbar>
|
||||
<u-sticky>
|
||||
|
|
@ -52,20 +57,15 @@
|
|||
:data="currentData"
|
||||
@onEdit="handleEdit"
|
||||
@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>
|
||||
<!-- 编辑 -->
|
||||
<cuPopup v-model="formShow" :title="currentData ? '编辑农作物' : '新增农作物'">
|
||||
<cuPopup
|
||||
v-model="formShow"
|
||||
:title="currentData ? '编辑农作物' : '新增农作物'"
|
||||
>
|
||||
<BasicsEdit
|
||||
@cancel="formShow = false"
|
||||
@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 BaseTablePopup from '@/components/base-table/popup.vue'
|
||||
import BasicsEdit from './components/basics-edit.vue'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
const baseTableColums = [
|
||||
{
|
||||
title: '名称',
|
||||
|
|
@ -127,22 +128,6 @@ export default {
|
|||
},
|
||||
},
|
||||
dataList: [],
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
],
|
||||
formShow: false,
|
||||
baseShow: false,
|
||||
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: {
|
||||
handleSubmit(e) {
|
||||
this.filterParmas = e
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<u-navbar title="设备管理" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<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>
|
||||
</u-navbar>
|
||||
<view class="secreen-section">
|
||||
|
|
@ -172,8 +172,8 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view class="btn_del" v-auth="['endpoint.device.destroy']" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view class="btn_edit" v-auth="['endpoint.device.edit']" @click="editInfoId(formInfo.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
|
@ -288,6 +288,7 @@
|
|||
|
||||
<script>
|
||||
import {navigateBack} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -299,20 +300,6 @@
|
|||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
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() {
|
||||
this.queryDataList();
|
||||
this.getDeviceTypes();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,19 @@
|
|||
<template>
|
||||
<view class="bg-page">
|
||||
<u-navbar title="稻虾流向" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<u-navbar
|
||||
title="稻虾流向"
|
||||
:background="background"
|
||||
:custom-back="goback"
|
||||
:title-color="titleColor"
|
||||
:back-icon-color="titleColor"
|
||||
>
|
||||
<view class="nav_slot_right_box" slot="right">
|
||||
<view class="custom_btn add_btn" @click="addBtn()">新增</view>
|
||||
<view
|
||||
v-auth="['endpoint.rice_shrimp_flows.create']"
|
||||
class="custom_btn add_btn"
|
||||
@click="addBtn()"
|
||||
>新增</view
|
||||
>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<view class="secreen-section">
|
||||
|
|
@ -14,98 +24,120 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="content-box u-padding-25">
|
||||
<u-swipe-action class="tb_swipe_list"
|
||||
<u-swipe-action
|
||||
class="tb_swipe_list"
|
||||
v-for="(item, index) in list"
|
||||
:show="item.show" :index="index" :key="item.id"
|
||||
: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.year }}</view>
|
||||
</view>
|
||||
|
||||
<view class="row_box">
|
||||
<view class="text">季度:{{item.quarter|quartername}}</view>
|
||||
<view class="text">季度:{{ item.quarter | quartername }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">地区:{{ item.area }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">销量:{{ item.sales }}{{item.unit}}</view>
|
||||
<view class="text">销量:{{ item.sales }}{{ item.unit }}</view>
|
||||
</view>
|
||||
<!-- <view class="row_box">
|
||||
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</u-swipe-action>
|
||||
<u-loadmore :status="loading" margin-top="60"/>
|
||||
<u-loadmore :status="loading" margin-top="60" />
|
||||
</view>
|
||||
<!-- 编辑 -->
|
||||
<u-popup v-model="editShow" border-radius="28" width="92%" height="60%"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||
<u-popup
|
||||
v-model="editShow"
|
||||
border-radius="28"
|
||||
width="92%"
|
||||
height="60%"
|
||||
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;">
|
||||
<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 pdlr12">
|
||||
<u-input v-model="setInfo.id" :disabled="true" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="年份" label-width="140" :required='true'>
|
||||
<u-form-item label="年份" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="selectFn1()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.year">{{setInfo.year}}</view>
|
||||
<view class="value u-line-2" v-if="setInfo.year">{{
|
||||
setInfo.year
|
||||
}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
<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-form-item label="季度" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="selectFn2()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.quarter_name">{{setInfo.quarter_name}}</view>
|
||||
<view class="value u-line-2" v-if="setInfo.quarter_name">{{
|
||||
setInfo.quarter_name
|
||||
}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
<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-form-item label="地区" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.area" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="销量" label-width="140" :required='true'>
|
||||
<u-form-item label="销量" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.sales" type="number"/>
|
||||
<u-input v-model="setInfo.sales" type="number" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="单位" label-width="140" :required='true'>
|
||||
<u-form-item label="单位" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.unit" />
|
||||
</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>
|
||||
<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>
|
||||
|
|
@ -113,36 +145,47 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view
|
||||
v-auth="['endpoint.rice_shrimp_flows.destroy']"
|
||||
class="btn_del"
|
||||
@click="deleteInfoId(formInfo.id)"
|
||||
>删除</view
|
||||
>
|
||||
<view
|
||||
v-auth="['endpoint.rice_shrimp_flows.edit']"
|
||||
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.year}}</view>
|
||||
<view class="flex-1">{{ formInfo.year }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">季度</view>
|
||||
<view class="flex-1">{{formInfo.quarter|quartername}}</view>
|
||||
<view class="flex-1">{{ formInfo.quarter | quartername }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">地区</view>
|
||||
<view class="flex-1">{{formInfo.area}}</view>
|
||||
<view class="flex-1">{{ formInfo.area }}</view>
|
||||
</view>
|
||||
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">销量</view>
|
||||
<view class="flex-1">{{ formInfo.sales }}{{formInfo.unit}}</view>
|
||||
<view class="flex-1">{{ formInfo.sales }}{{ formInfo.unit }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">创建人</view>
|
||||
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||
<view class="flex-1">{{
|
||||
formInfo.created_by ? formInfo.created_by.name : '-'
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">更新时间</view>
|
||||
<view class="flex-1">{{ formInfo.updated_at|timeFormat}}</view>
|
||||
<view class="flex-1">{{ formInfo.updated_at | timeFormat }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -155,303 +198,341 @@
|
|||
<view class="row_ul u-padding-right-20 u-padding-top-40">
|
||||
<view class="row_list u-flex">
|
||||
<view class="label_tit small">年份</view>
|
||||
<yn-select-input-list :value="queryCond.year"
|
||||
rightIcon="calendar" placeholder="请选择年份"
|
||||
@click="selectFn1('q')"></yn-select-input-list>
|
||||
<yn-select-input-list
|
||||
:value="queryCond.year"
|
||||
rightIcon="calendar"
|
||||
placeholder="请选择年份"
|
||||
@click="selectFn1('q')"
|
||||
></yn-select-input-list>
|
||||
</view>
|
||||
<view class="row_list u-flex">
|
||||
<view class="label_tit small">季度</view>
|
||||
<yn-select-input-list :value="queryCond.quarter_name" placeholder="请选择季度"
|
||||
@click="selectFn2('q')"></yn-select-input-list>
|
||||
<yn-select-input-list
|
||||
:value="queryCond.quarter_name"
|
||||
placeholder="请选择季度"
|
||||
@click="selectFn2('q')"
|
||||
></yn-select-input-list>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="buttom_section u-padding-top-40">
|
||||
<u-button class="btn small_btn" type="default" @click="resetQuery()">重置</u-button>
|
||||
<u-button class="btn small_btn" @click="queryBtn()" type="primary">查询</u-button>
|
||||
<u-button class="btn small_btn" type="default" @click="resetQuery()"
|
||||
>重置</u-button
|
||||
>
|
||||
<u-button class="btn small_btn" @click="queryBtn()" type="primary"
|
||||
>查询</u-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-picker mode="time" v-model="selectShow1"
|
||||
:params="timeParams" :default-time="selectValue1"
|
||||
@confirm="uselectConfirm1"></u-picker>
|
||||
<u-select v-model="selectShow2" :list="quarterlist"
|
||||
:default-value="selectValue2" mode="single-column"
|
||||
@confirm="uselectConfirm2"></u-select>
|
||||
<u-picker
|
||||
mode="time"
|
||||
v-model="selectShow1"
|
||||
:params="timeParams"
|
||||
:default-time="selectValue1"
|
||||
@confirm="uselectConfirm1"
|
||||
></u-picker>
|
||||
<u-select
|
||||
v-model="selectShow2"
|
||||
:list="quarterlist"
|
||||
:default-value="selectValue2"
|
||||
mode="single-column"
|
||||
@confirm="uselectConfirm2"
|
||||
></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||
export default {
|
||||
import {
|
||||
formatDate,
|
||||
showLoading,
|
||||
hideLoading,
|
||||
navigateBack,
|
||||
} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
background: {
|
||||
backgroundColor:'#2a7dc9',
|
||||
backgroundColor: '#2a7dc9',
|
||||
},
|
||||
titleColor:"#ffffff",
|
||||
per_page:15,
|
||||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
formInfo:{},
|
||||
titleColor: '#ffffff',
|
||||
per_page: 15,
|
||||
page: 1,
|
||||
list: [],
|
||||
loading: 'loadmore',
|
||||
|
||||
popupShow: false,
|
||||
cindex: -1, //操作的索引
|
||||
editShow: false,
|
||||
formInfo: {},
|
||||
timeParams: {
|
||||
year: true,
|
||||
month: false,
|
||||
day: false,
|
||||
hour: false,
|
||||
minute: false,
|
||||
second: false
|
||||
second: false,
|
||||
},
|
||||
screenShow:false,
|
||||
isqueryselect:false,
|
||||
setInfo:{
|
||||
id:'',
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
area:'',
|
||||
sales:'',
|
||||
unit:''
|
||||
screenShow: false,
|
||||
isqueryselect: false,
|
||||
setInfo: {
|
||||
id: '',
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
area: '',
|
||||
sales: '',
|
||||
unit: '',
|
||||
},
|
||||
editShow:false,
|
||||
queryCond:{
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
editShow: false,
|
||||
queryCond: {
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
},
|
||||
selectShow1:false,
|
||||
selectShow2:false,
|
||||
selectValue1:'',
|
||||
selectValue2:[0],
|
||||
quarterlist:[
|
||||
selectShow1: false,
|
||||
selectShow2: false,
|
||||
selectValue1: '',
|
||||
selectValue2: [0],
|
||||
quarterlist: [
|
||||
{
|
||||
label:'第一季度',
|
||||
value:1,
|
||||
label: '第一季度',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label:'第二季度',
|
||||
value:2,
|
||||
label: '第二季度',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label:'第三季度',
|
||||
value:3,
|
||||
label: '第三季度',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label:'第四季度',
|
||||
value:4,
|
||||
label: '第四季度',
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
filters:{
|
||||
quartername(val){
|
||||
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}
|
||||
let name = keys[val]?keys[val]:val
|
||||
return name;
|
||||
},
|
||||
timeFormat(val){
|
||||
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');
|
||||
computed: {
|
||||
options() {
|
||||
return [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
permission: ['endpoint.rice_shrimp_flows.edit'],
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
onLoad(){
|
||||
this.queryDataList();
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
permission: ['endpoint.rice_shrimp_flows.destroy'],
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
methods:{
|
||||
addBtn(){
|
||||
this.setInfoKeys('add');
|
||||
this.editShow = true;
|
||||
},
|
||||
selectFn1(type){
|
||||
this.isqueryselect = false;
|
||||
let year = this.setInfo.year;
|
||||
if(type=='q'){
|
||||
this.isqueryselect = true;
|
||||
this.selectShow1 = true;
|
||||
year = this.queryCond.year;
|
||||
].filter((e) => checkPermission(e.permission))
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
quartername(val) {
|
||||
let keys = { 1: '第一季度', 2: '第二季度', 3: '第三季度', 4: '第四季度' }
|
||||
let name = keys[val] ? keys[val] : val
|
||||
return name
|
||||
},
|
||||
timeFormat(val) {
|
||||
return formatDate(val * 1000, 'yyyy-MM-dd hh:mm')
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.queryDataList()
|
||||
},
|
||||
methods: {
|
||||
addBtn() {
|
||||
this.setInfoKeys('add')
|
||||
this.editShow = true
|
||||
},
|
||||
selectFn1(type) {
|
||||
this.isqueryselect = false
|
||||
let year = this.setInfo.year
|
||||
if (type == 'q') {
|
||||
this.isqueryselect = true
|
||||
this.selectShow1 = true
|
||||
year = this.queryCond.year
|
||||
}
|
||||
if(year){
|
||||
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||
if (year) {
|
||||
this.selectValue1 = `${year}-01-01 00:00:01`
|
||||
}
|
||||
console.log(this.selectValue1)
|
||||
this.selectShow1 = true;
|
||||
this.selectShow1 = true
|
||||
},
|
||||
selectFn2(type){
|
||||
this.isqueryselect = false;
|
||||
let quarter = this.setInfo.quarter;
|
||||
if(type=='q'){
|
||||
this.isqueryselect = true;
|
||||
quarter = this.queryCond.quarter;
|
||||
selectFn2(type) {
|
||||
this.isqueryselect = false
|
||||
let quarter = this.setInfo.quarter
|
||||
if (type == 'q') {
|
||||
this.isqueryselect = true
|
||||
quarter = this.queryCond.quarter
|
||||
}
|
||||
for(let [index,item] of this.quarterlist.entries()){
|
||||
if(quarter==item.value){
|
||||
this.selectValue2 = [index];
|
||||
break;
|
||||
for (let [index, item] of this.quarterlist.entries()) {
|
||||
if (quarter == item.value) {
|
||||
this.selectValue2 = [index]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.selectShow2 = true;
|
||||
this.selectShow2 = true
|
||||
},
|
||||
resetQuery(){
|
||||
resetQuery() {
|
||||
this.queryCond = {
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
}
|
||||
},
|
||||
queryBtn(){
|
||||
this.list = [];
|
||||
this.queryDataList(true);
|
||||
this.screenShow = false;
|
||||
queryBtn() {
|
||||
this.list = []
|
||||
this.queryDataList(true)
|
||||
this.screenShow = false
|
||||
},
|
||||
uselectConfirm1(e){
|
||||
if(this.isqueryselect){
|
||||
console.log(e);
|
||||
this.queryCond.year = e.year;
|
||||
}else{
|
||||
this.setInfo.year = e.year;
|
||||
uselectConfirm1(e) {
|
||||
if (this.isqueryselect) {
|
||||
console.log(e)
|
||||
this.queryCond.year = e.year
|
||||
} else {
|
||||
this.setInfo.year = e.year
|
||||
}
|
||||
},
|
||||
uselectConfirm2(e){
|
||||
if(this.isqueryselect){
|
||||
console.log(e);
|
||||
this.queryCond.quarter = e[0].value;
|
||||
this.queryCond.quarter_name = e[0].label;
|
||||
}else{
|
||||
this.setInfo.quarter = e[0].value;
|
||||
this.setInfo.quarter_name = e[0].label;
|
||||
uselectConfirm2(e) {
|
||||
if (this.isqueryselect) {
|
||||
console.log(e)
|
||||
this.queryCond.quarter = e[0].value
|
||||
this.queryCond.quarter_name = e[0].label
|
||||
} else {
|
||||
this.setInfo.quarter = e[0].value
|
||||
this.setInfo.quarter_name = e[0].label
|
||||
}
|
||||
},
|
||||
screenShowFn(){
|
||||
this.screenShow = true;
|
||||
screenShowFn() {
|
||||
this.screenShow = true
|
||||
},
|
||||
showInfo(index){
|
||||
this.cindex = index;
|
||||
let _id = this.list[index].id;
|
||||
this.queryInfo(_id);
|
||||
this.formInfo = this.list[index];
|
||||
this.popupShow = true;
|
||||
|
||||
showInfo(index) {
|
||||
this.cindex = index
|
||||
let _id = this.list[index].id
|
||||
this.queryInfo(_id)
|
||||
this.formInfo = this.list[index]
|
||||
this.popupShow = true
|
||||
},
|
||||
open(index){
|
||||
this.list[index].show = 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.formInfo = this.list[index];
|
||||
this.queryInfo(_id);
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.list[index].show = false;
|
||||
|
||||
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.formInfo = this.list[index]
|
||||
this.queryInfo(_id)
|
||||
this.setInfoKeys()
|
||||
this.editShow = true
|
||||
this.list[index].show = false
|
||||
}
|
||||
|
||||
},
|
||||
queryDataList(refresh){
|
||||
if(refresh){
|
||||
this.loading = 'loadmore';
|
||||
this.page = 1;
|
||||
queryDataList(refresh) {
|
||||
if (refresh) {
|
||||
this.loading = 'loadmore'
|
||||
this.page = 1
|
||||
}
|
||||
if(this.loading=='nomore'){//超出最大页
|
||||
return false;
|
||||
if (this.loading == 'nomore') {
|
||||
//超出最大页
|
||||
return false
|
||||
}
|
||||
let params = {
|
||||
per_page:this.per_page,
|
||||
page: this.page ++,
|
||||
_t: new Date().getTime()
|
||||
per_page: this.per_page,
|
||||
page: this.page++,
|
||||
_t: new Date().getTime(),
|
||||
}
|
||||
for(let k in this.queryCond){
|
||||
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||
params[k] = this.queryCond[k];
|
||||
for (let k in this.queryCond) {
|
||||
if (this.queryCond[k] || this.queryCond[k] == '0') {
|
||||
params[k] = this.queryCond[k]
|
||||
}
|
||||
}
|
||||
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/rice-shrimp-flows',{params:params}).then(({data})=>{
|
||||
this.loading = 'loading'
|
||||
this.$http
|
||||
.get('/api/rice-shrimp-flows', { params: params })
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
this.screenShow = false;
|
||||
if(refresh){
|
||||
this.list = [];
|
||||
this.screenShow = false
|
||||
if (refresh) {
|
||||
this.list = []
|
||||
}
|
||||
this.loading = 'loadmore';
|
||||
if(data.code==200){
|
||||
let _list = data.data|| [];
|
||||
for(let item of _list){
|
||||
item.show = false;
|
||||
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';
|
||||
this.list = this.list.concat(_list)
|
||||
console.log(this.list)
|
||||
if (this.list.length >= data.meta.total) {
|
||||
this.loading = 'nomore'
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = 'loadmore';
|
||||
this.screenShow = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = 'loadmore'
|
||||
this.screenShow = false
|
||||
})
|
||||
},
|
||||
//修改
|
||||
editInfoBtn(){
|
||||
if(!this.valiFormRule()){
|
||||
return false;
|
||||
editInfoBtn() {
|
||||
if (!this.valiFormRule()) {
|
||||
return false
|
||||
}
|
||||
let params = {}
|
||||
params = this.setInfo;
|
||||
showLoading('请稍等...');
|
||||
if(params['id']){
|
||||
this.$http.put(`/api/rice-shrimp-flows/${params['id']}`,params).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
|
||||
this.editShow = false;
|
||||
this.queryDataList(true);
|
||||
|
||||
params = this.setInfo
|
||||
showLoading('请稍等...')
|
||||
if (params['id']) {
|
||||
this.$http
|
||||
.put(`/api/rice-shrimp-flows/${params['id']}`, params)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.editShow = false
|
||||
this.queryDataList(true)
|
||||
}
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
})
|
||||
}else{
|
||||
delete params['id'];
|
||||
this.$http.post(`/api/rice-shrimp-flows`,params).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
this.queryDataList(true);
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}else{
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
} else {
|
||||
delete params['id']
|
||||
this.$http
|
||||
.post(`/api/rice-shrimp-flows`, params)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.queryDataList(true)
|
||||
this.editShow = false
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
}
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
queryInfo(id){
|
||||
queryInfo(id) {
|
||||
// this.$http.get(`/api/rice-shrimp-flows/${id}`).then(({data})=>{
|
||||
// console.log(data,'queryInfo===')
|
||||
// if(data.code==200){
|
||||
|
|
@ -459,114 +540,112 @@
|
|||
// this.setInfoKeys();
|
||||
// }
|
||||
// }).catch((err)=>{
|
||||
|
||||
// })
|
||||
},
|
||||
editInfoId(id){
|
||||
editInfoId(id) {
|
||||
// this.queryInfo(id);
|
||||
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.popupShow = false;
|
||||
this.setInfoKeys()
|
||||
this.editShow = true
|
||||
this.popupShow = false
|
||||
},
|
||||
//删除deleteInfoId
|
||||
deleteInfoId(id){
|
||||
deleteInfoId(id) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确定删除?',
|
||||
success: (res)=> {
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
showLoading('请稍等...');
|
||||
this.$http.delete(`/api/rice-shrimp-flows/${id}`).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
this.formInfo = {};//重置删除
|
||||
this.popupShow = false;
|
||||
this.list.splice(this.cindex,1);
|
||||
console.log('用户点击确定')
|
||||
showLoading('请稍等...')
|
||||
this.$http
|
||||
.delete(`/api/rice-shrimp-flows/${id}`)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.formInfo = {} //重置删除
|
||||
this.popupShow = false
|
||||
this.list.splice(this.cindex, 1)
|
||||
// this.queryDataList(true);
|
||||
}
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
setInfoKeys(type){
|
||||
})
|
||||
},
|
||||
setInfoKeys(type) {
|
||||
let info = {
|
||||
id:'',
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
area:'',
|
||||
sales:'',
|
||||
unit:''
|
||||
id: '',
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
area: '',
|
||||
sales: '',
|
||||
unit: '',
|
||||
}
|
||||
if(type=='add'){
|
||||
this.setInfo = info;
|
||||
}else{
|
||||
let {id,year,quarter,area,sales,unit} = this.formInfo;
|
||||
try{
|
||||
for(let k in info){
|
||||
info[k] = this.formInfo[k];
|
||||
if (type == 'add') {
|
||||
this.setInfo = info
|
||||
} else {
|
||||
let { id, year, quarter, area, sales, unit } = this.formInfo
|
||||
try {
|
||||
for (let k in info) {
|
||||
info[k] = this.formInfo[k]
|
||||
}
|
||||
for(let item of this.quarterlist){
|
||||
if(quarter == item.value){
|
||||
info.quarter_name = item.label;
|
||||
break;
|
||||
for (let item of this.quarterlist) {
|
||||
if (quarter == item.value) {
|
||||
info.quarter_name = item.label
|
||||
break
|
||||
}
|
||||
}
|
||||
this.setInfo = info;
|
||||
|
||||
}catch(e){
|
||||
this.setInfo = info
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||
}
|
||||
}
|
||||
},
|
||||
valiFormRule(){
|
||||
let {id,year,quarter,area,sales,unit} = this.setInfo;
|
||||
valiFormRule() {
|
||||
let { id, year, quarter, area, sales, unit } = this.setInfo
|
||||
|
||||
if(year==''){
|
||||
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (year == '') {
|
||||
uni.showToast({ title: '年份不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(quarter==''){
|
||||
uni.showToast({ title: '季度不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (quarter == '') {
|
||||
uni.showToast({ title: '季度不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(area==''){
|
||||
uni.showToast({ title: '地区不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (area == '') {
|
||||
uni.showToast({ title: '地区不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(sales==''){
|
||||
uni.showToast({ title: '销量不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (sales == '') {
|
||||
uni.showToast({ title: '销量不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(unit==''){
|
||||
uni.showToast({ title: '单位不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (unit == '') {
|
||||
uni.showToast({ title: '单位不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
},
|
||||
goback(){
|
||||
goback() {
|
||||
navigateBack()
|
||||
}
|
||||
},
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryDataList();
|
||||
if (this.loading == 'loadmore') {
|
||||
this.queryDataList()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<u-navbar title="稻虾产业" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<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>
|
||||
</u-navbar>
|
||||
<view class="secreen-section">
|
||||
|
|
@ -125,8 +125,8 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view v-auth="['endpoint.rice_shrimp_industries.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view v-auth="['endpoint.rice_shrimp_industries.edit']" class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
|
@ -195,6 +195,7 @@
|
|||
|
||||
<script>
|
||||
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -206,20 +207,7 @@
|
|||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
|
|
@ -275,6 +263,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:{
|
||||
quartername(val){
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<u-navbar title="大宗物资" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<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>
|
||||
</u-navbar>
|
||||
<view class="secreen-section">
|
||||
|
|
@ -134,8 +134,8 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view class="btn_del" v-auth="['endpoint.materiels.destroy']" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view class="btn_edit" v-auth="['endpoint.materiels.edit']" @click="editInfoId(formInfo.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
|
@ -225,6 +225,7 @@
|
|||
|
||||
<script>
|
||||
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -236,20 +237,6 @@
|
|||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
|
|
@ -318,6 +305,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:{
|
||||
quartername(val){
|
||||
|
|
|
|||
|
|
@ -1,9 +1,19 @@
|
|||
<template>
|
||||
<view class="bg-page">
|
||||
<u-navbar title="稻虾价格" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<u-navbar
|
||||
title="稻虾价格"
|
||||
:background="background"
|
||||
:custom-back="goback"
|
||||
:title-color="titleColor"
|
||||
:back-icon-color="titleColor"
|
||||
>
|
||||
<view class="nav_slot_right_box" slot="right">
|
||||
<view class="custom_btn add_btn" @click="addBtn()">新增</view>
|
||||
<view
|
||||
v-auth="['endpoint.rice_shrimp_prices.create']"
|
||||
class="custom_btn add_btn"
|
||||
@click="addBtn()"
|
||||
>新增</view
|
||||
>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<view class="secreen-section">
|
||||
|
|
@ -14,21 +24,23 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="content-box u-padding-25">
|
||||
<u-swipe-action class="tb_swipe_list"
|
||||
<u-swipe-action
|
||||
class="tb_swipe_list"
|
||||
v-for="(item, index) in list"
|
||||
:show="item.show" :index="index" :key="item.id"
|
||||
: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.year }}</view>
|
||||
</view>
|
||||
|
||||
<view class="row_box">
|
||||
<view class="text">季度:{{item.quarter|quartername}}</view>
|
||||
<view class="text">季度:{{ item.quarter | quartername }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">价格:{{ item.price }}</view>
|
||||
|
|
@ -36,63 +48,83 @@
|
|||
<!-- <view class="row_box">
|
||||
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</u-swipe-action>
|
||||
<u-loadmore :status="loading" margin-top="60"/>
|
||||
<u-loadmore :status="loading" margin-top="60" />
|
||||
</view>
|
||||
<!-- 编辑 -->
|
||||
<u-popup v-model="editShow" border-radius="28" width="92%" height="700rpx"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||
<u-popup
|
||||
v-model="editShow"
|
||||
border-radius="28"
|
||||
width="92%"
|
||||
height="700rpx"
|
||||
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;">
|
||||
<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 pdlr12">
|
||||
<u-input v-model="setInfo.id" :disabled="true" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="年份" label-width="140" :required='true'>
|
||||
<u-form-item label="年份" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="selectFn1()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.year">{{setInfo.year}}</view>
|
||||
<view class="value u-line-2" v-if="setInfo.year">{{
|
||||
setInfo.year
|
||||
}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
<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-form-item label="季度" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="selectFn2()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.quarter_name">{{setInfo.quarter_name}}</view>
|
||||
<view class="value u-line-2" v-if="setInfo.quarter_name">{{
|
||||
setInfo.quarter_name
|
||||
}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
<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-form-item label="价格" label-width="140" :required="true">
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.price" type="number" />
|
||||
</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>
|
||||
<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>
|
||||
|
|
@ -100,29 +132,39 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view
|
||||
v-auth="['endpoint.rice_shrimp_prices.destroy']"
|
||||
class="btn_del"
|
||||
@click="deleteInfoId(formInfo.id)"
|
||||
>删除</view
|
||||
>
|
||||
<view
|
||||
v-auth="['endpoint.rice_shrimp_prices.edit']"
|
||||
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.year}}</view>
|
||||
<view class="flex-1">{{ formInfo.year }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">季度</view>
|
||||
<view class="flex-1">{{formInfo.quarter|quartername}}</view>
|
||||
<view class="flex-1">{{ formInfo.quarter | quartername }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">价格</view>
|
||||
<view class="flex-1">{{formInfo.price}}</view>
|
||||
<view class="flex-1">{{ formInfo.price }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">创建人</view>
|
||||
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||
<view class="flex-1">{{
|
||||
formInfo.created_by ? formInfo.created_by.name : '-'
|
||||
}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
|
@ -134,299 +176,335 @@
|
|||
<view class="row_ul u-padding-right-20 u-padding-top-40">
|
||||
<view class="row_list u-flex">
|
||||
<view class="label_tit small">年份</view>
|
||||
<yn-select-input-list :value="queryCond.year"
|
||||
rightIcon="calendar" placeholder="请选择年份"
|
||||
@click="selectFn1('q')"></yn-select-input-list>
|
||||
<yn-select-input-list
|
||||
:value="queryCond.year"
|
||||
rightIcon="calendar"
|
||||
placeholder="请选择年份"
|
||||
@click="selectFn1('q')"
|
||||
></yn-select-input-list>
|
||||
</view>
|
||||
<view class="row_list u-flex">
|
||||
<view class="label_tit small">季度</view>
|
||||
<yn-select-input-list :value="queryCond.quarter_name" placeholder="请选择季度"
|
||||
@click="selectFn2('q')"></yn-select-input-list>
|
||||
<yn-select-input-list
|
||||
:value="queryCond.quarter_name"
|
||||
placeholder="请选择季度"
|
||||
@click="selectFn2('q')"
|
||||
></yn-select-input-list>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="buttom_section u-padding-top-40">
|
||||
<u-button class="btn small_btn" type="default" @click="resetQuery()">重置</u-button>
|
||||
<u-button class="btn small_btn" @click="queryBtn()" type="primary">查询</u-button>
|
||||
<u-button class="btn small_btn" type="default" @click="resetQuery()"
|
||||
>重置</u-button
|
||||
>
|
||||
<u-button class="btn small_btn" @click="queryBtn()" type="primary"
|
||||
>查询</u-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-picker mode="time" v-model="selectShow1"
|
||||
:params="timeParams" :default-time="selectValue1"
|
||||
@confirm="uselectConfirm1"></u-picker>
|
||||
<u-select v-model="selectShow2" :list="quarterlist"
|
||||
:default-value="selectValue2" mode="single-column"
|
||||
@confirm="uselectConfirm2"></u-select>
|
||||
<u-picker
|
||||
mode="time"
|
||||
v-model="selectShow1"
|
||||
:params="timeParams"
|
||||
:default-time="selectValue1"
|
||||
@confirm="uselectConfirm1"
|
||||
></u-picker>
|
||||
<u-select
|
||||
v-model="selectShow2"
|
||||
:list="quarterlist"
|
||||
:default-value="selectValue2"
|
||||
mode="single-column"
|
||||
@confirm="uselectConfirm2"
|
||||
></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||
export default {
|
||||
import {
|
||||
formatDate,
|
||||
showLoading,
|
||||
hideLoading,
|
||||
navigateBack,
|
||||
} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
background: {
|
||||
backgroundColor:'#2a7dc9',
|
||||
backgroundColor: '#2a7dc9',
|
||||
},
|
||||
titleColor:"#ffffff",
|
||||
per_page:15,
|
||||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
formInfo:{},
|
||||
titleColor: '#ffffff',
|
||||
per_page: 15,
|
||||
page: 1,
|
||||
list: [],
|
||||
loading: 'loadmore',
|
||||
popupShow: false,
|
||||
cindex: -1, //操作的索引
|
||||
editShow: false,
|
||||
formInfo: {},
|
||||
timeParams: {
|
||||
year: true,
|
||||
month: false,
|
||||
day: false,
|
||||
hour: false,
|
||||
minute: false,
|
||||
second: false
|
||||
second: false,
|
||||
},
|
||||
screenShow:false,
|
||||
isqueryselect:false,
|
||||
setInfo:{
|
||||
id:'',
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
price:''
|
||||
screenShow: false,
|
||||
isqueryselect: false,
|
||||
setInfo: {
|
||||
id: '',
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
price: '',
|
||||
},
|
||||
editShow:false,
|
||||
queryCond:{
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
editShow: false,
|
||||
queryCond: {
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
},
|
||||
selectShow1:false,
|
||||
selectShow2:false,
|
||||
selectValue1:'',
|
||||
selectValue2:[0],
|
||||
quarterlist:[
|
||||
selectShow1: false,
|
||||
selectShow2: false,
|
||||
selectValue1: '',
|
||||
selectValue2: [0],
|
||||
quarterlist: [
|
||||
{
|
||||
label:'第一季度',
|
||||
value:1,
|
||||
label: '第一季度',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label:'第二季度',
|
||||
value:2,
|
||||
label: '第二季度',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label:'第三季度',
|
||||
value:3,
|
||||
label: '第三季度',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label:'第四季度',
|
||||
value:4,
|
||||
label: '第四季度',
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
filters:{
|
||||
quartername(val){
|
||||
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}
|
||||
let name = keys[val]?keys[val]:val
|
||||
return name;
|
||||
filters: {
|
||||
quartername(val) {
|
||||
let keys = { 1: '第一季度', 2: '第二季度', 3: '第三季度', 4: '第四季度' }
|
||||
let name = keys[val] ? keys[val] : val
|
||||
return name
|
||||
},
|
||||
|
||||
},
|
||||
onLoad(){
|
||||
this.queryDataList();
|
||||
computed: {
|
||||
options() {
|
||||
return [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
permission: ['endpoint.rice_shrimp_prices.edit'],
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
methods:{
|
||||
addBtn(){
|
||||
this.setInfoKeys('add');
|
||||
this.editShow = true;
|
||||
},
|
||||
selectFn1(type){
|
||||
this.isqueryselect = false;
|
||||
let year = this.setInfo.year;
|
||||
if(type=='q'){
|
||||
this.isqueryselect = true;
|
||||
this.selectShow1 = true;
|
||||
year = this.queryCond.year;
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
permission: ['endpoint.rice_shrimp_prices.destroy'],
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
].filter((e) => checkPermission(e.permission))
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.queryDataList()
|
||||
},
|
||||
methods: {
|
||||
addBtn() {
|
||||
this.setInfoKeys('add')
|
||||
this.editShow = true
|
||||
},
|
||||
selectFn1(type) {
|
||||
this.isqueryselect = false
|
||||
let year = this.setInfo.year
|
||||
if (type == 'q') {
|
||||
this.isqueryselect = true
|
||||
this.selectShow1 = true
|
||||
year = this.queryCond.year
|
||||
}
|
||||
if(year){
|
||||
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||
if (year) {
|
||||
this.selectValue1 = `${year}-01-01 00:00:01`
|
||||
}
|
||||
console.log(this.selectValue1)
|
||||
this.selectShow1 = true;
|
||||
this.selectShow1 = true
|
||||
},
|
||||
selectFn2(type){
|
||||
this.isqueryselect = false;
|
||||
let quarter = this.setInfo.quarter;
|
||||
if(type=='q'){
|
||||
this.isqueryselect = true;
|
||||
quarter = this.queryCond.quarter;
|
||||
selectFn2(type) {
|
||||
this.isqueryselect = false
|
||||
let quarter = this.setInfo.quarter
|
||||
if (type == 'q') {
|
||||
this.isqueryselect = true
|
||||
quarter = this.queryCond.quarter
|
||||
}
|
||||
for(let [index,item] of this.quarterlist.entries()){
|
||||
if(quarter==item.value){
|
||||
this.selectValue2 = [index];
|
||||
break;
|
||||
for (let [index, item] of this.quarterlist.entries()) {
|
||||
if (quarter == item.value) {
|
||||
this.selectValue2 = [index]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.selectShow2 = true;
|
||||
this.selectShow2 = true
|
||||
},
|
||||
resetQuery(){
|
||||
resetQuery() {
|
||||
this.queryCond = {
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
}
|
||||
},
|
||||
queryBtn(){
|
||||
this.list = [];
|
||||
this.queryDataList(true);
|
||||
this.screenShow = false;
|
||||
queryBtn() {
|
||||
this.list = []
|
||||
this.queryDataList(true)
|
||||
this.screenShow = false
|
||||
},
|
||||
uselectConfirm1(e){
|
||||
if(this.isqueryselect){
|
||||
console.log(e);
|
||||
this.queryCond.year = e.year;
|
||||
}else{
|
||||
this.setInfo.year = e.year;
|
||||
uselectConfirm1(e) {
|
||||
if (this.isqueryselect) {
|
||||
console.log(e)
|
||||
this.queryCond.year = e.year
|
||||
} else {
|
||||
this.setInfo.year = e.year
|
||||
}
|
||||
},
|
||||
uselectConfirm2(e){
|
||||
if(this.isqueryselect){
|
||||
console.log(e);
|
||||
this.queryCond.quarter = e[0].value;
|
||||
this.queryCond.quarter_name = e[0].label;
|
||||
}else{
|
||||
this.setInfo.quarter = e[0].value;
|
||||
this.setInfo.quarter_name = e[0].label;
|
||||
uselectConfirm2(e) {
|
||||
if (this.isqueryselect) {
|
||||
console.log(e)
|
||||
this.queryCond.quarter = e[0].value
|
||||
this.queryCond.quarter_name = e[0].label
|
||||
} else {
|
||||
this.setInfo.quarter = e[0].value
|
||||
this.setInfo.quarter_name = e[0].label
|
||||
}
|
||||
},
|
||||
screenShowFn(){
|
||||
this.screenShow = true;
|
||||
screenShowFn() {
|
||||
this.screenShow = true
|
||||
},
|
||||
showInfo(index){
|
||||
this.cindex = index;
|
||||
let _id = this.list[index].id;
|
||||
this.queryInfo(_id);
|
||||
this.formInfo = this.list[index];
|
||||
this.popupShow = true;
|
||||
|
||||
showInfo(index) {
|
||||
this.cindex = index
|
||||
let _id = this.list[index].id
|
||||
this.queryInfo(_id)
|
||||
this.formInfo = this.list[index]
|
||||
this.popupShow = true
|
||||
},
|
||||
open(index){
|
||||
this.list[index].show = 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.formInfo = this.list[index];
|
||||
this.queryInfo(_id);
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.list[index].show = false;
|
||||
|
||||
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.formInfo = this.list[index]
|
||||
this.queryInfo(_id)
|
||||
this.setInfoKeys()
|
||||
this.editShow = true
|
||||
this.list[index].show = false
|
||||
}
|
||||
|
||||
},
|
||||
queryDataList(refresh){
|
||||
if(refresh){
|
||||
this.loading = 'loadmore';
|
||||
this.page = 1;
|
||||
queryDataList(refresh) {
|
||||
if (refresh) {
|
||||
this.loading = 'loadmore'
|
||||
this.page = 1
|
||||
}
|
||||
if(this.loading=='nomore'){//超出最大页
|
||||
return false;
|
||||
if (this.loading == 'nomore') {
|
||||
//超出最大页
|
||||
return false
|
||||
}
|
||||
let params = {
|
||||
per_page:this.per_page,
|
||||
page: this.page ++,
|
||||
_t: new Date().getTime()
|
||||
per_page: this.per_page,
|
||||
page: this.page++,
|
||||
_t: new Date().getTime(),
|
||||
}
|
||||
for(let k in this.queryCond){
|
||||
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||
params[k] = this.queryCond[k];
|
||||
for (let k in this.queryCond) {
|
||||
if (this.queryCond[k] || this.queryCond[k] == '0') {
|
||||
params[k] = this.queryCond[k]
|
||||
}
|
||||
}
|
||||
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/rice-shrimp-prices',{params:params}).then(({data})=>{
|
||||
this.loading = 'loading'
|
||||
this.$http
|
||||
.get('/api/rice-shrimp-prices', { params: params })
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
this.screenShow = false;
|
||||
if(refresh){
|
||||
this.list = [];
|
||||
this.screenShow = false
|
||||
if (refresh) {
|
||||
this.list = []
|
||||
}
|
||||
this.loading = 'loadmore';
|
||||
if(data.code==200){
|
||||
let _list = data.data|| [];
|
||||
for(let item of _list){
|
||||
item.show = false;
|
||||
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';
|
||||
this.list = this.list.concat(_list)
|
||||
console.log(this.list)
|
||||
if (this.list.length >= data.meta.total) {
|
||||
this.loading = 'nomore'
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = 'loadmore';
|
||||
this.screenShow = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = 'loadmore'
|
||||
this.screenShow = false
|
||||
})
|
||||
},
|
||||
//修改
|
||||
editInfoBtn(){
|
||||
if(!this.valiFormRule()){
|
||||
return false;
|
||||
editInfoBtn() {
|
||||
if (!this.valiFormRule()) {
|
||||
return false
|
||||
}
|
||||
let params = {}
|
||||
params = this.setInfo;
|
||||
showLoading('请稍等');
|
||||
if(params['id']){
|
||||
this.$http.put(`/api/rice-shrimp-prices/${params['id']}`,params).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
|
||||
this.editShow = false;
|
||||
this.queryDataList(true);
|
||||
|
||||
params = this.setInfo
|
||||
showLoading('请稍等')
|
||||
if (params['id']) {
|
||||
this.$http
|
||||
.put(`/api/rice-shrimp-prices/${params['id']}`, params)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.editShow = false
|
||||
this.queryDataList(true)
|
||||
}
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
})
|
||||
}else{
|
||||
delete params['id'];
|
||||
this.$http.post(`/api/rice-shrimp-prices`,params).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
this.queryDataList(true);
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}else{
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
} else {
|
||||
delete params['id']
|
||||
this.$http
|
||||
.post(`/api/rice-shrimp-prices`, params)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.queryDataList(true)
|
||||
this.editShow = false
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
}
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
queryInfo(id){
|
||||
queryInfo(id) {
|
||||
// this.$http.get(`/api/rice-shrimp-prices/${id}`).then(({data})=>{
|
||||
// console.log(data,'queryInfo===')
|
||||
// if(data.code==200){
|
||||
|
|
@ -434,104 +512,102 @@
|
|||
// this.setInfoKeys();
|
||||
// }
|
||||
// }).catch((err)=>{
|
||||
|
||||
// })
|
||||
},
|
||||
editInfoId(id){
|
||||
editInfoId(id) {
|
||||
// this.queryInfo(id);
|
||||
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.popupShow = false;
|
||||
this.setInfoKeys()
|
||||
this.editShow = true
|
||||
this.popupShow = false
|
||||
},
|
||||
//删除deleteInfoId
|
||||
deleteInfoId(id){
|
||||
deleteInfoId(id) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确定删除?',
|
||||
success: (res)=> {
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
showLoading('请稍等');
|
||||
this.$http.delete(`/api/rice-shrimp-prices/${id}`).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
this.formInfo = {};//重置删除
|
||||
this.popupShow = false;
|
||||
this.list.splice(this.cindex,1);
|
||||
console.log('用户点击确定')
|
||||
showLoading('请稍等')
|
||||
this.$http
|
||||
.delete(`/api/rice-shrimp-prices/${id}`)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.formInfo = {} //重置删除
|
||||
this.popupShow = false
|
||||
this.list.splice(this.cindex, 1)
|
||||
// this.queryDataList(true);
|
||||
}
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
setInfoKeys(type){
|
||||
})
|
||||
},
|
||||
setInfoKeys(type) {
|
||||
let info = {
|
||||
id:'',
|
||||
year:'',
|
||||
quarter:'',
|
||||
quarter_name:'',
|
||||
price:''
|
||||
id: '',
|
||||
year: '',
|
||||
quarter: '',
|
||||
quarter_name: '',
|
||||
price: '',
|
||||
}
|
||||
if(type=='add'){
|
||||
this.setInfo = info;
|
||||
}else{
|
||||
let {id,year,quarter,price} = this.formInfo;
|
||||
try{
|
||||
for(let item of this.quarterlist){
|
||||
if(quarter == item.value){
|
||||
info.quarter_name = item.label;
|
||||
break;
|
||||
if (type == 'add') {
|
||||
this.setInfo = info
|
||||
} else {
|
||||
let { id, year, quarter, price } = this.formInfo
|
||||
try {
|
||||
for (let item of this.quarterlist) {
|
||||
if (quarter == item.value) {
|
||||
info.quarter_name = item.label
|
||||
break
|
||||
}
|
||||
}
|
||||
info['id'] = id;
|
||||
info['year'] = year;
|
||||
info['quarter'] = quarter;
|
||||
info['price'] = price;
|
||||
this.setInfo = info;
|
||||
|
||||
}catch(e){
|
||||
info['id'] = id
|
||||
info['year'] = year
|
||||
info['quarter'] = quarter
|
||||
info['price'] = price
|
||||
this.setInfo = info
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||
}
|
||||
}
|
||||
},
|
||||
valiFormRule(){
|
||||
let {id,year,quarter,price} = this.setInfo;
|
||||
if(year==''){
|
||||
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||
return false;
|
||||
valiFormRule() {
|
||||
let { id, year, quarter, price } = this.setInfo
|
||||
if (year == '') {
|
||||
uni.showToast({ title: '年份不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(quarter==''){
|
||||
uni.showToast({ title: '季度不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (quarter == '') {
|
||||
uni.showToast({ title: '季度不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(price==''){
|
||||
uni.showToast({ title: '价格不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (price == '') {
|
||||
uni.showToast({ title: '价格不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
},
|
||||
goback(){
|
||||
goback() {
|
||||
navigateBack()
|
||||
}
|
||||
},
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryDataList();
|
||||
if (this.loading == 'loadmore') {
|
||||
this.queryDataList()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
<template>
|
||||
<view class="bg-page">
|
||||
<u-navbar title="稻虾每周价格" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<u-navbar
|
||||
title="稻虾每周价格"
|
||||
:background="background"
|
||||
:custom-back="goback"
|
||||
:title-color="titleColor"
|
||||
:back-icon-color="titleColor"
|
||||
>
|
||||
<view class="nav_slot_right_box" slot="right">
|
||||
<view class="custom_btn add_btn" @click="addBtn()">新增</view>
|
||||
<view v-auth="['endpoint.rice_shrimp_weekly_prices.create']" class="custom_btn add_btn" @click="addBtn()">新增</view>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<view class="secreen-section">
|
||||
|
|
@ -14,21 +19,23 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="content-box u-padding-25">
|
||||
<u-swipe-action class="tb_swipe_list"
|
||||
<u-swipe-action
|
||||
class="tb_swipe_list"
|
||||
v-for="(item, index) in list"
|
||||
:show="item.show" :index="index" :key="item.id"
|
||||
: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.year }}</view>
|
||||
</view>
|
||||
|
||||
<view class="row_box">
|
||||
<view class="text">周:{{item.week_label}}</view>
|
||||
<view class="text">周:{{ item.week_label }}</view>
|
||||
</view>
|
||||
<view class="row_box">
|
||||
<view class="text">价格:{{ item.price }}</view>
|
||||
|
|
@ -36,66 +43,98 @@
|
|||
<!-- <view class="row_box">
|
||||
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</u-swipe-action>
|
||||
<u-loadmore :status="loading" margin-top="60"/>
|
||||
<u-loadmore :status="loading" margin-top="60" />
|
||||
</view>
|
||||
<!-- 编辑 -->
|
||||
<u-popup v-model="editShow" border-radius="28" width="92%" height="700rpx"
|
||||
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||
<u-popup
|
||||
v-model="editShow"
|
||||
border-radius="28"
|
||||
width="92%"
|
||||
height="700rpx"
|
||||
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 >
|
||||
<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 pdlr12">
|
||||
<u-input v-model="setInfo.id" :disabled="true" />
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="年份" label-width="140"
|
||||
prop="year" :required='true'>
|
||||
<u-form-item
|
||||
label="年份"
|
||||
label-width="140"
|
||||
prop="year"
|
||||
:required="true"
|
||||
>
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="selectFn1()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.year">{{setInfo.year}}</view>
|
||||
<view class="value u-line-2" v-if="setInfo.year">{{
|
||||
setInfo.year
|
||||
}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
<u-icon
|
||||
name="arrow-right"
|
||||
color="#999"
|
||||
size="28"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="周" label-width="140"
|
||||
prop="week" :required='true'>
|
||||
<u-form-item
|
||||
label="周"
|
||||
label-width="140"
|
||||
prop="week"
|
||||
:required="true"
|
||||
>
|
||||
<view class="input_box">
|
||||
<view class="u-select-list" @click="selectFn2()">
|
||||
<view class="value u-line-2"
|
||||
v-if="setInfo.week_name">{{setInfo.week_name}}</view>
|
||||
<view class="value u-line-2" v-if="setInfo.week_name">{{
|
||||
setInfo.week_name
|
||||
}}</view>
|
||||
<view class="placeholder" v-else>请选择</view>
|
||||
<view class="right">
|
||||
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||
<u-icon
|
||||
name="arrow-right"
|
||||
color="#999"
|
||||
size="28"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="价格" label-width="140"
|
||||
prop="week" :required='true'>
|
||||
<u-form-item
|
||||
label="价格"
|
||||
label-width="140"
|
||||
prop="week"
|
||||
:required="true"
|
||||
>
|
||||
<view class="input_box">
|
||||
<u-input v-model="setInfo.price" type="number"/>
|
||||
<u-input v-model="setInfo.price" type="number" />
|
||||
</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>
|
||||
<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>
|
||||
|
|
@ -103,29 +142,29 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view v-auth="['endpoint.rice_shrimp_weekly_prices.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view v-auth="['endpoint.rice_shrimp_weekly_prices.edit']" 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.year}}</view>
|
||||
<view class="flex-1">{{ formInfo.year }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">周</view>
|
||||
<view class="flex-1">{{formInfo.week_label}}</view>
|
||||
<view class="flex-1">{{ formInfo.week_label }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">价格</view>
|
||||
<view class="flex-1">{{formInfo.price}}</view>
|
||||
<view class="flex-1">{{ formInfo.price }}</view>
|
||||
</view>
|
||||
<view class="plist u-border-bottom">
|
||||
<view class="label_t">创建人</view>
|
||||
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||
<view class="flex-1">{{
|
||||
formInfo.created_by ? formInfo.created_by.name : '-'
|
||||
}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
|
@ -137,276 +176,312 @@
|
|||
<view class="row_ul u-padding-right-20 u-padding-top-40">
|
||||
<view class="row_list u-flex">
|
||||
<view class="label_tit small">年份</view>
|
||||
<yn-select-input-list :value="queryCond.year"
|
||||
rightIcon="calendar" placeholder="请选择年份"
|
||||
@click="selectFn1('q')"></yn-select-input-list>
|
||||
<yn-select-input-list
|
||||
:value="queryCond.year"
|
||||
rightIcon="calendar"
|
||||
placeholder="请选择年份"
|
||||
@click="selectFn1('q')"
|
||||
></yn-select-input-list>
|
||||
</view>
|
||||
<view class="row_list u-flex">
|
||||
<view class="label_tit small">周</view>
|
||||
<yn-select-input-list :value="queryCond.week_name" placeholder="请选择季度"
|
||||
@click="selectFn2('q')"></yn-select-input-list>
|
||||
<yn-select-input-list
|
||||
:value="queryCond.week_name"
|
||||
placeholder="请选择季度"
|
||||
@click="selectFn2('q')"
|
||||
></yn-select-input-list>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="buttom_section u-padding-top-40">
|
||||
<u-button class="btn small_btn" type="default" @click="resetQuery()">重置</u-button>
|
||||
<u-button class="btn small_btn" @click="queryBtn()" type="primary">查询</u-button>
|
||||
<u-button class="btn small_btn" type="default" @click="resetQuery()"
|
||||
>重置</u-button
|
||||
>
|
||||
<u-button class="btn small_btn" @click="queryBtn()" type="primary"
|
||||
>查询</u-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-picker mode="time" v-model="selectShow1"
|
||||
:params="timeParams" :default-time="selectValue1"
|
||||
@confirm="uselectConfirm1"></u-picker>
|
||||
<u-select v-model="selectShow2" :list="weeksperyearlist"
|
||||
:default-value="selectValue2" mode="single-column"
|
||||
@confirm="uselectConfirm2"></u-select>
|
||||
<u-picker
|
||||
mode="time"
|
||||
v-model="selectShow1"
|
||||
:params="timeParams"
|
||||
:default-time="selectValue1"
|
||||
@confirm="uselectConfirm1"
|
||||
></u-picker>
|
||||
<u-select
|
||||
v-model="selectShow2"
|
||||
:list="weeksperyearlist"
|
||||
:default-value="selectValue2"
|
||||
mode="single-column"
|
||||
@confirm="uselectConfirm2"
|
||||
></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||
export default {
|
||||
import {
|
||||
formatDate,
|
||||
showLoading,
|
||||
hideLoading,
|
||||
navigateBack,
|
||||
} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
background: {
|
||||
backgroundColor:'#2a7dc9',
|
||||
backgroundColor: '#2a7dc9',
|
||||
},
|
||||
titleColor:"#ffffff",
|
||||
per_page:15,
|
||||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
formInfo:{},
|
||||
titleColor: '#ffffff',
|
||||
per_page: 15,
|
||||
page: 1,
|
||||
list: [],
|
||||
loading: 'loadmore',
|
||||
popupShow: false,
|
||||
cindex: -1, //操作的索引
|
||||
editShow: false,
|
||||
formInfo: {},
|
||||
timeParams: {
|
||||
year: true,
|
||||
month: false,
|
||||
day: false,
|
||||
hour: false,
|
||||
minute: false,
|
||||
second: false
|
||||
second: false,
|
||||
},
|
||||
screenShow:false,
|
||||
isqueryselect:false,
|
||||
setInfo:{
|
||||
id:'',
|
||||
year:'',
|
||||
week:'',
|
||||
week_name:'',
|
||||
price:''
|
||||
screenShow: false,
|
||||
isqueryselect: false,
|
||||
setInfo: {
|
||||
id: '',
|
||||
year: '',
|
||||
week: '',
|
||||
week_name: '',
|
||||
price: '',
|
||||
},
|
||||
editShow:false,
|
||||
queryCond:{
|
||||
year:'',
|
||||
week:'',
|
||||
week_name:'',
|
||||
editShow: false,
|
||||
queryCond: {
|
||||
year: '',
|
||||
week: '',
|
||||
week_name: '',
|
||||
},
|
||||
selectShow1:false,
|
||||
selectShow2:false,
|
||||
selectValue1:'',
|
||||
selectValue2:[0],
|
||||
weeksperyearlist:[],
|
||||
|
||||
};
|
||||
},
|
||||
onLoad(){
|
||||
this.queryDataList();
|
||||
this.getweeksperyear();
|
||||
},
|
||||
methods:{
|
||||
addBtn(){
|
||||
this.setInfoKeys('add');
|
||||
this.editShow = true;
|
||||
},
|
||||
selectFn1(type){
|
||||
this.isqueryselect = false;
|
||||
let year = this.setInfo.year;
|
||||
if(type=='q'){
|
||||
this.isqueryselect = true;
|
||||
this.selectShow1 = true;
|
||||
year = this.queryCond.year;
|
||||
selectShow1: false,
|
||||
selectShow2: false,
|
||||
selectValue1: '',
|
||||
selectValue2: [0],
|
||||
weeksperyearlist: [],
|
||||
}
|
||||
if(year){
|
||||
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||
},
|
||||
computed: {
|
||||
options() {
|
||||
return [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
permission: ['endpoint.rice_shrimp_weekly_prices.edit'],
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
permission: ['endpoint.rice_shrimp_weekly_prices.destroy'],
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
].filter((e) => checkPermission(e.permission))
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.queryDataList()
|
||||
this.getweeksperyear()
|
||||
},
|
||||
methods: {
|
||||
addBtn() {
|
||||
this.setInfoKeys('add')
|
||||
this.editShow = true
|
||||
},
|
||||
selectFn1(type) {
|
||||
this.isqueryselect = false
|
||||
let year = this.setInfo.year
|
||||
if (type == 'q') {
|
||||
this.isqueryselect = true
|
||||
this.selectShow1 = true
|
||||
year = this.queryCond.year
|
||||
}
|
||||
if (year) {
|
||||
this.selectValue1 = `${year}-01-01 00:00:01`
|
||||
}
|
||||
console.log(this.selectValue1)
|
||||
this.selectShow1 = true;
|
||||
this.selectShow1 = true
|
||||
},
|
||||
selectFn2(type){
|
||||
this.isqueryselect = false;
|
||||
let week = this.setInfo.week;
|
||||
if(type=='q'){
|
||||
this.isqueryselect = true;
|
||||
week = this.queryCond.week;
|
||||
selectFn2(type) {
|
||||
this.isqueryselect = false
|
||||
let week = this.setInfo.week
|
||||
if (type == 'q') {
|
||||
this.isqueryselect = true
|
||||
week = this.queryCond.week
|
||||
}
|
||||
for(let [index,item] of this.weeksperyearlist.entries()){
|
||||
if(week==item.value){
|
||||
this.selectValue2 = [index];
|
||||
break;
|
||||
for (let [index, item] of this.weeksperyearlist.entries()) {
|
||||
if (week == item.value) {
|
||||
this.selectValue2 = [index]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.selectShow2 = true;
|
||||
this.selectShow2 = true
|
||||
},
|
||||
resetQuery(){
|
||||
resetQuery() {
|
||||
this.queryCond = {
|
||||
year:'',
|
||||
week:'',
|
||||
week_name:'',
|
||||
year: '',
|
||||
week: '',
|
||||
week_name: '',
|
||||
}
|
||||
},
|
||||
queryBtn(){
|
||||
this.list = [];
|
||||
this.queryDataList(true);
|
||||
this.screenShow = false;
|
||||
queryBtn() {
|
||||
this.list = []
|
||||
this.queryDataList(true)
|
||||
this.screenShow = false
|
||||
},
|
||||
uselectConfirm1(e){
|
||||
if(this.isqueryselect){
|
||||
console.log(e);
|
||||
this.queryCond.year = e.year;
|
||||
}else{
|
||||
this.setInfo.year = e.year;
|
||||
uselectConfirm1(e) {
|
||||
if (this.isqueryselect) {
|
||||
console.log(e)
|
||||
this.queryCond.year = e.year
|
||||
} else {
|
||||
this.setInfo.year = e.year
|
||||
}
|
||||
},
|
||||
uselectConfirm2(e){
|
||||
if(this.isqueryselect){
|
||||
console.log(e);
|
||||
this.queryCond.week = e[0].value;
|
||||
this.queryCond.week_name = e[0].label;
|
||||
}else{
|
||||
this.setInfo.week = e[0].value;
|
||||
this.setInfo.week_name = e[0].label;
|
||||
uselectConfirm2(e) {
|
||||
if (this.isqueryselect) {
|
||||
console.log(e)
|
||||
this.queryCond.week = e[0].value
|
||||
this.queryCond.week_name = e[0].label
|
||||
} else {
|
||||
this.setInfo.week = e[0].value
|
||||
this.setInfo.week_name = e[0].label
|
||||
}
|
||||
},
|
||||
screenShowFn(){
|
||||
this.screenShow = true;
|
||||
screenShowFn() {
|
||||
this.screenShow = true
|
||||
},
|
||||
showInfo(index){
|
||||
this.cindex = index;
|
||||
let _id = this.list[index].id;
|
||||
this.queryInfo(_id);
|
||||
this.formInfo = this.list[index];
|
||||
this.popupShow = true;
|
||||
|
||||
showInfo(index) {
|
||||
this.cindex = index
|
||||
let _id = this.list[index].id
|
||||
this.queryInfo(_id)
|
||||
this.formInfo = this.list[index]
|
||||
this.popupShow = true
|
||||
},
|
||||
open(index){
|
||||
this.list[index].show = 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.formInfo = this.list[index];
|
||||
this.queryInfo(_id);
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.list[index].show = false;
|
||||
|
||||
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.formInfo = this.list[index]
|
||||
this.queryInfo(_id)
|
||||
this.setInfoKeys()
|
||||
this.editShow = true
|
||||
this.list[index].show = false
|
||||
}
|
||||
|
||||
},
|
||||
queryDataList(refresh){
|
||||
if(refresh){
|
||||
this.loading = 'loadmore';
|
||||
this.page = 1;
|
||||
queryDataList(refresh) {
|
||||
if (refresh) {
|
||||
this.loading = 'loadmore'
|
||||
this.page = 1
|
||||
}
|
||||
if(this.loading=='nomore'){//超出最大页
|
||||
return false;
|
||||
if (this.loading == 'nomore') {
|
||||
//超出最大页
|
||||
return false
|
||||
}
|
||||
let params = {
|
||||
per_page:this.per_page,
|
||||
page: this.page ++,
|
||||
_t: new Date().getTime()
|
||||
per_page: this.per_page,
|
||||
page: this.page++,
|
||||
_t: new Date().getTime(),
|
||||
}
|
||||
for(let k in this.queryCond){
|
||||
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||
params[k] = this.queryCond[k];
|
||||
for (let k in this.queryCond) {
|
||||
if (this.queryCond[k] || this.queryCond[k] == '0') {
|
||||
params[k] = this.queryCond[k]
|
||||
}
|
||||
}
|
||||
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/rice-shrimp-weekly-prices',{params:params}).then(({data})=>{
|
||||
this.loading = 'loading'
|
||||
this.$http
|
||||
.get('/api/rice-shrimp-weekly-prices', { params: params })
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
this.screenShow = false;
|
||||
if(refresh){
|
||||
this.list = [];
|
||||
this.screenShow = false
|
||||
if (refresh) {
|
||||
this.list = []
|
||||
}
|
||||
this.loading = 'loadmore';
|
||||
if(data.code==200){
|
||||
let _list = data.data|| [];
|
||||
for(let item of _list){
|
||||
item.show = false;
|
||||
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';
|
||||
this.list = this.list.concat(_list)
|
||||
console.log(this.list)
|
||||
if (this.list.length >= data.meta.total) {
|
||||
this.loading = 'nomore'
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = 'loadmore';
|
||||
this.screenShow = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = 'loadmore'
|
||||
this.screenShow = false
|
||||
})
|
||||
},
|
||||
//修改
|
||||
editInfoBtn(){
|
||||
if(!this.valiFormRule()){
|
||||
return false;
|
||||
editInfoBtn() {
|
||||
if (!this.valiFormRule()) {
|
||||
return false
|
||||
}
|
||||
let params = {}
|
||||
params = this.setInfo;
|
||||
showLoading('请稍等');
|
||||
if(params['id']){
|
||||
this.$http.put(`/api/rice-shrimp-weekly-prices/${params['id']}`,params).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
|
||||
this.editShow = false;
|
||||
this.queryDataList(true);
|
||||
|
||||
params = this.setInfo
|
||||
showLoading('请稍等')
|
||||
if (params['id']) {
|
||||
this.$http
|
||||
.put(`/api/rice-shrimp-weekly-prices/${params['id']}`, params)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.editShow = false
|
||||
this.queryDataList(true)
|
||||
}
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
})
|
||||
}else{
|
||||
delete params['id'];
|
||||
this.$http.post(`/api/rice-shrimp-weekly-prices`,params).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
this.queryDataList(true);
|
||||
this.editShow = false;
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}else{
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
} else {
|
||||
delete params['id']
|
||||
this.$http
|
||||
.post(`/api/rice-shrimp-weekly-prices`, params)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.queryDataList(true)
|
||||
this.editShow = false
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
}
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
queryInfo(id){
|
||||
queryInfo(id) {
|
||||
// this.$http.get(`/api/rice-shrimp-weekly-prices/${id}`).then(({data})=>{
|
||||
// console.log(data,'queryInfo===')
|
||||
// if(data.code==200){
|
||||
|
|
@ -414,118 +489,117 @@
|
|||
// this.setInfoKeys();
|
||||
// }
|
||||
// }).catch((err)=>{
|
||||
|
||||
// })
|
||||
},
|
||||
editInfoId(id){
|
||||
editInfoId(id) {
|
||||
// this.queryInfo(id);
|
||||
|
||||
this.setInfoKeys();
|
||||
this.editShow = true;
|
||||
this.popupShow = false;
|
||||
this.setInfoKeys()
|
||||
this.editShow = true
|
||||
this.popupShow = false
|
||||
},
|
||||
getweeksperyear(){
|
||||
this.$http.get(`/api/weeks-per-year`).then(({data})=>{
|
||||
if(data.code==200){
|
||||
let list = data.data;
|
||||
let weeks = [];
|
||||
for(let item of list){
|
||||
weeks.push({label:item.name,value:item.id})
|
||||
getweeksperyear() {
|
||||
this.$http
|
||||
.get(`/api/weeks-per-year`)
|
||||
.then(({ data }) => {
|
||||
if (data.code == 200) {
|
||||
let list = data.data
|
||||
let weeks = []
|
||||
for (let item of list) {
|
||||
weeks.push({ label: item.name, value: item.id })
|
||||
}
|
||||
this.weeksperyearlist = weeks;
|
||||
this.weeksperyearlist = weeks
|
||||
}
|
||||
}).catch((err)=>{
|
||||
|
||||
})
|
||||
.catch((err) => {})
|
||||
},
|
||||
//删除deleteInfoId
|
||||
deleteInfoId(id){
|
||||
deleteInfoId(id) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确定删除?',
|
||||
success: (res)=> {
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
showLoading('请稍等');
|
||||
this.$http.delete(`/api/rice-shrimp-weekly-prices/${id}`).then(({data})=>{
|
||||
hideLoading();
|
||||
if(data.code==200){
|
||||
this.formInfo = {};//重置删除
|
||||
this.popupShow = false;
|
||||
this.list.splice(this.cindex,1);
|
||||
console.log('用户点击确定')
|
||||
showLoading('请稍等')
|
||||
this.$http
|
||||
.delete(`/api/rice-shrimp-weekly-prices/${id}`)
|
||||
.then(({ data }) => {
|
||||
hideLoading()
|
||||
if (data.code == 200) {
|
||||
this.formInfo = {} //重置删除
|
||||
this.popupShow = false
|
||||
this.list.splice(this.cindex, 1)
|
||||
// this.queryDataList(true);
|
||||
}
|
||||
uni.showToast({ title: data.message, icon: 'none' });
|
||||
}).catch(()=>{
|
||||
hideLoading();
|
||||
uni.showToast({ title: data.message, icon: 'none' })
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
setInfoKeys(type){
|
||||
})
|
||||
},
|
||||
setInfoKeys(type) {
|
||||
let info = {
|
||||
id:'',
|
||||
year:'',
|
||||
week:'',
|
||||
week_name:'',
|
||||
price:''
|
||||
id: '',
|
||||
year: '',
|
||||
week: '',
|
||||
week_name: '',
|
||||
price: '',
|
||||
}
|
||||
if(type=='add'){
|
||||
this.setInfo = info;
|
||||
}else{
|
||||
let {id,year,week,price} = this.formInfo;
|
||||
try{
|
||||
for(let item of this.weeksperyearlist){
|
||||
if(week == item.value){
|
||||
info.week_name = item.label;
|
||||
break;
|
||||
if (type == 'add') {
|
||||
this.setInfo = info
|
||||
} else {
|
||||
let { id, year, week, price } = this.formInfo
|
||||
try {
|
||||
for (let item of this.weeksperyearlist) {
|
||||
if (week == item.value) {
|
||||
info.week_name = item.label
|
||||
break
|
||||
}
|
||||
}
|
||||
info['id'] = id;
|
||||
info['year'] = year;
|
||||
info['week'] = week;
|
||||
info['price'] = price;
|
||||
this.setInfo = info;
|
||||
|
||||
}catch(e){
|
||||
info['id'] = id
|
||||
info['year'] = year
|
||||
info['week'] = week
|
||||
info['price'] = price
|
||||
this.setInfo = info
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||
}
|
||||
}
|
||||
},
|
||||
valiFormRule(){
|
||||
let {id,year,week,price} = this.setInfo;
|
||||
if(year==''){
|
||||
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||
return false;
|
||||
valiFormRule() {
|
||||
let { id, year, week, price } = this.setInfo
|
||||
if (year == '') {
|
||||
uni.showToast({ title: '年份不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(week==''){
|
||||
uni.showToast({ title: '周不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (week == '') {
|
||||
uni.showToast({ title: '周不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if(price==''){
|
||||
uni.showToast({ title: '价格不能为空', icon: 'none' });
|
||||
return false;
|
||||
if (price == '') {
|
||||
uni.showToast({ title: '价格不能为空', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
},
|
||||
goback(){
|
||||
goback() {
|
||||
navigateBack()
|
||||
}
|
||||
},
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryDataList();
|
||||
if (this.loading == 'loadmore') {
|
||||
this.queryDataList()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
<view class="content-box">
|
||||
<view
|
||||
class="menus-section"
|
||||
v-for="(menu, index) in menuList"
|
||||
v-for="(menu, index) in menus"
|
||||
: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
|
||||
>
|
||||
<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-li" v-for="(cdm, i) in menu.children" :key="i">
|
||||
<view class="menu_item" @click="linknavFn(cdm)">
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -42,44 +43,40 @@ export default {
|
|||
{
|
||||
label: '气象监测',
|
||||
url: '/pages/index/meteorological',
|
||||
permission: 'endpoint.weather.index',
|
||||
},
|
||||
{
|
||||
label: '智能监控',
|
||||
url: '/pages/index/monitor',
|
||||
permission: 'endpoint.camera.index',
|
||||
},
|
||||
{
|
||||
label: '土壤监控',
|
||||
url: '/pages/index/soil-monitoring',
|
||||
permission: 'endpoint.soil.index',
|
||||
},
|
||||
{
|
||||
label: '水质监控',
|
||||
url: '/pages/index/water-quality',
|
||||
permission: 'endpoint.water.index',
|
||||
},
|
||||
{
|
||||
label: '昆虫性诱监测',
|
||||
url: '/pages/index/insect-monitors',
|
||||
permission: 'endpoint.insect.index',
|
||||
},
|
||||
{
|
||||
label: '虫情监测',
|
||||
url: '/pages/index/pests',
|
||||
permission: 'endpoint.worm_statics.index',
|
||||
},
|
||||
{
|
||||
label: '杀虫灯检测',
|
||||
url: '/pages/index/insecticidal-lamp',
|
||||
permission: 'endpoint.insecticidal_lamp.index',
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// label:'基础数据管理',
|
||||
// children:[
|
||||
// {
|
||||
// label:'城镇数据',
|
||||
// },
|
||||
// {
|
||||
// label:'基地数据',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
label: '全市基础数据',
|
||||
parent: '基础数据管理',
|
||||
|
|
@ -87,10 +84,12 @@ export default {
|
|||
{
|
||||
label: '城镇数据',
|
||||
url: '/pages/basics/town-base',
|
||||
permission: 'endpoint.town_street.index',
|
||||
},
|
||||
{
|
||||
label: '基地数据',
|
||||
url: '/pages/basics/basics-base',
|
||||
permission: 'endpoint.agricultural_basic.index',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -101,10 +100,12 @@ export default {
|
|||
{
|
||||
label: '城镇农作物',
|
||||
url: '/pages/crop/town-crop',
|
||||
permission: 'endpoint.town_crops.index',
|
||||
},
|
||||
{
|
||||
label: '基地农作物',
|
||||
url: '/pages/crop/basics-crop',
|
||||
permission: 'endpoint.crops.index',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -115,10 +116,12 @@ export default {
|
|||
{
|
||||
label: '城镇产量',
|
||||
url: '/pages/yield/town-yield',
|
||||
permission: 'endpoint.town_crops_output.index',
|
||||
},
|
||||
{
|
||||
label: '基地产量',
|
||||
url: '/pages/yield/basics-yield',
|
||||
permission: 'endpoint.crops_output.index',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -129,22 +132,27 @@ export default {
|
|||
{
|
||||
label: '稻虾价格',
|
||||
url: '/pages/estate/estate-price',
|
||||
permission: 'endpoint.rice_shrimp_prices.index',
|
||||
},
|
||||
{
|
||||
label: '稻虾每周价格',
|
||||
url: '/pages/estate/estate-week-price',
|
||||
permission: 'endpoint.rice_shrimp_weekly_prices.index',
|
||||
},
|
||||
{
|
||||
label: '稻虾产业',
|
||||
url: '/pages/estate/estate-industry',
|
||||
permission: 'endpoint.rice_shrimp_industries.index',
|
||||
},
|
||||
{
|
||||
label: '稻虾流向',
|
||||
url: '/pages/estate/estate-flows',
|
||||
permission: 'endpoint.rice_shrimp_flows.index',
|
||||
},
|
||||
{
|
||||
label: '大宗物资',
|
||||
url: '/pages/estate/estate-materiels',
|
||||
permission: 'endpoint.materiels.index',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -154,18 +162,48 @@ export default {
|
|||
{
|
||||
label: '设备管理',
|
||||
url: '/pages/device/index',
|
||||
permission: 'endpoint.device.index',
|
||||
},
|
||||
{
|
||||
label: '警报明细',
|
||||
url: '/pages/device/warning',
|
||||
permission: 'endpoint.warnings.index',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
menus(){
|
||||
|
||||
return this.filterAsyncRoutes(this.menuList, this.userInfo?.permissions_slug ?? [])
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
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) {
|
||||
console.log(item)
|
||||
uni.navigateTo({
|
||||
|
|
|
|||
|
|
@ -1,156 +1,233 @@
|
|||
<template>
|
||||
<view class="monitor-page bg-page" >
|
||||
<view class="monitor-page bg-page">
|
||||
<view class="utab-section">
|
||||
<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
|
||||
<u-subsection
|
||||
:list="list"
|
||||
:current="current"
|
||||
@change="sectionChange"
|
||||
></u-subsection>
|
||||
</view>
|
||||
<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="基地"
|
||||
<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-model="is_recommend" title="全部"
|
||||
:options="options3" @change="change3"></u-dropdown-item>
|
||||
|
||||
: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-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" style="margin-bottom: 0;">
|
||||
<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" 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="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')">
|
||||
<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="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>
|
||||
<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')">
|
||||
<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 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>
|
||||
<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="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 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="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>{{ 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_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>
|
||||
<videoM3u8H5 v-if="video.video_type=='m3u8'" :url="video.video_url" :id="`m_${index}_refsM3u8`"></videoM3u8H5>
|
||||
<video-flv-h5 v-else :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>
|
||||
<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 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_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>
|
||||
<videoM3u8H5 v-if="video.video_type=='m3u8'" :url="video.video_url" :id="`m_${index}_refsM3u82`" ></videoM3u8H5>
|
||||
<video-flv-h5 v-else :url="video.video_url"></video-flv-h5>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view class="bottom-box">
|
||||
<view class="address">{{video.base_name}}-{{video.monitoring_point}}</view>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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 },
|
||||
import videoFlvH5 from '@/components/video-flv-h5/video-flv-h5.vue'
|
||||
import videoM3u8H5 from '@/components/video-m3u8-h5/video-m3u8-h5.vue'
|
||||
import Request from '@/api/luch-request/index.js'
|
||||
const http = new Request()
|
||||
export default {
|
||||
components: { videoFlvH5,videoM3u8H5 },
|
||||
data() {
|
||||
return {
|
||||
list:[
|
||||
list: [
|
||||
{
|
||||
name: '监控'
|
||||
name: '监控',
|
||||
},
|
||||
{
|
||||
name: '视频'
|
||||
name: '视频',
|
||||
},
|
||||
],
|
||||
current:0,
|
||||
current: 0,
|
||||
//筛选
|
||||
q_start_time:'',
|
||||
q_end_time:'',
|
||||
deviceAddressList:[],//筛选设备地区列表
|
||||
addressName:'',
|
||||
addressValue:'',
|
||||
device_id:'',//检测点 - options2中的设备id
|
||||
options2:[],
|
||||
start_date_c:'',
|
||||
end_date_c:'',
|
||||
device_type:1,//监控
|
||||
is_recommend:0,
|
||||
options3:[
|
||||
q_start_time: '',
|
||||
q_end_time: '',
|
||||
deviceAddressList: [], //筛选设备地区列表
|
||||
addressName: '',
|
||||
addressValue: '',
|
||||
device_id: '', //检测点 - options2中的设备id
|
||||
options2: [],
|
||||
start_date_c: '',
|
||||
end_date_c: '',
|
||||
device_type: 1, //监控
|
||||
is_recommend: 0,
|
||||
options3: [
|
||||
{
|
||||
label: '全部',
|
||||
value: 0,
|
||||
|
|
@ -158,373 +235,413 @@
|
|||
{
|
||||
label: '推荐',
|
||||
value: 1,
|
||||
}
|
||||
},
|
||||
],
|
||||
per_page:4,
|
||||
page:1,
|
||||
per_page: 4,
|
||||
page: 1,
|
||||
pickerParams: {
|
||||
year: true,
|
||||
month: true,
|
||||
day: true,
|
||||
hour: true,
|
||||
minute: true,
|
||||
second: false
|
||||
second: false,
|
||||
},
|
||||
defaultTime:'',
|
||||
pickerShow:false,//选择
|
||||
ctimeType:'',//当前点击
|
||||
addressValue2:'',
|
||||
addressName2:'',
|
||||
device_id2:'',
|
||||
options4:[],
|
||||
websocket:{},
|
||||
videoList:[],
|
||||
videoList2:[],
|
||||
per_page2:4,
|
||||
page2:1,
|
||||
loading:'loading',
|
||||
loading2:'',
|
||||
selectedTimeTip: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.queryWebsocketIp();
|
||||
|
||||
onLoad() {
|
||||
this.queryWebsocketIp()
|
||||
},
|
||||
methods:{
|
||||
methods: {
|
||||
sectionChange(index) {
|
||||
this.current = index;
|
||||
this.current = index
|
||||
},
|
||||
//地区1
|
||||
change(val){
|
||||
console.log(val);
|
||||
let narray = this.deviceAddressList.filter(item=>{
|
||||
return item.value==val;
|
||||
change(val) {
|
||||
console.log(val)
|
||||
let narray = this.deviceAddressList.filter((item) => {
|
||||
return item.value == val
|
||||
})
|
||||
console.log(narray);
|
||||
if(this.current==0){
|
||||
this.addressName = narray[0].name;
|
||||
}else{
|
||||
this.addressName2 = narray[0].name;
|
||||
console.log(narray)
|
||||
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);
|
||||
if (val == '') {
|
||||
this.addressName = '全部'
|
||||
this.queryDevices()
|
||||
} else {
|
||||
this.queryAddressDevicePoints(val)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
//地区下设备id
|
||||
change2(val){
|
||||
change2(val) {
|
||||
console.log(val)
|
||||
this.queryDevices();
|
||||
this.queryDevices()
|
||||
},
|
||||
//推荐
|
||||
change3(val){
|
||||
this.queryDevices();
|
||||
change3(val) {
|
||||
this.queryDevices()
|
||||
},
|
||||
//视频下-设备
|
||||
change4(val){
|
||||
|
||||
},
|
||||
change4(val) {},
|
||||
//时间选择
|
||||
pickerTimeFn(type){
|
||||
this.ctimeType = type;
|
||||
this.pickerShow = true;
|
||||
pickerTimeFn(type) {
|
||||
this.ctimeType = type
|
||||
this.pickerShow = true
|
||||
},
|
||||
//日期范围
|
||||
pickerChange(e){
|
||||
console.log(e,'日期范围')
|
||||
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,'日期范围')
|
||||
pickerChange(e) {
|
||||
console.log(e, '日期范围')
|
||||
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(type){
|
||||
if(type=='start'){
|
||||
this.start_date_c = '';
|
||||
}else if(type=='end'){
|
||||
this.end_date_c = '';
|
||||
}else{}
|
||||
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 = '';
|
||||
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;
|
||||
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;
|
||||
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
|
||||
}
|
||||
},
|
||||
//推特
|
||||
changeRecommend(value,index){
|
||||
console.log(value,index);
|
||||
let id = this.videoList[index].id;
|
||||
this.recommendId(id);
|
||||
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)=>{
|
||||
|
||||
recommendId(id) {
|
||||
this.$http
|
||||
.put(`/api/devices-update-recommend/${id}`)
|
||||
.then(({ data }) => {
|
||||
console.log(data, 'recommendId===')
|
||||
})
|
||||
.catch((err) => {})
|
||||
},
|
||||
async queryWebsocketIp(){
|
||||
async queryWebsocketIp() {
|
||||
let params = {
|
||||
_t: new Date().getTime()
|
||||
_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;
|
||||
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){
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
this.queryDeviceBasics('init');
|
||||
this.queryDeviceBasics('init')
|
||||
},
|
||||
//查询监测
|
||||
queryDevices(type){
|
||||
if(type!='more'){
|
||||
this.loading = 'loadmore';
|
||||
this.page = 1;
|
||||
queryDevices(type) {
|
||||
if (type != 'more') {
|
||||
this.loading = 'loadmore'
|
||||
this.page = 1
|
||||
}
|
||||
let params = {
|
||||
type:this.device_type,
|
||||
status:1,//在线
|
||||
per_page:this.per_page,
|
||||
page:this.page++,
|
||||
_t: new Date().getTime()
|
||||
type: this.device_type,
|
||||
status: 1, //在线
|
||||
per_page: this.per_page,
|
||||
page: this.page++,
|
||||
_t: new Date().getTime(),
|
||||
}
|
||||
if(this.addressValue){
|
||||
params['base'] = this.addressValue;
|
||||
if (this.addressValue) {
|
||||
params['base'] = this.addressValue
|
||||
}
|
||||
if(this.device_id){
|
||||
params['point'] = this.device_id;
|
||||
if (this.device_id) {
|
||||
params['point'] = this.device_id
|
||||
}
|
||||
if(this.is_recommend){
|
||||
params['is_recommend'] = this.is_recommend;
|
||||
if (this.is_recommend) {
|
||||
params['is_recommend'] = this.is_recommend
|
||||
}
|
||||
this.loading = 'loading';
|
||||
this.$http.get('/api/devices',{params:params}).then(({data})=>{
|
||||
this.loading = 'loadmore';
|
||||
if(type!='more'){
|
||||
this.videoList = [];
|
||||
this.loading = 'loading'
|
||||
this.$http
|
||||
.get('/api/devices', { params: params })
|
||||
.then(async ({ 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)}`
|
||||
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;
|
||||
const { supplier, extends: extend, sn } = item
|
||||
|
||||
if (item.supplier.id == 'device-supplier-biang') {
|
||||
const { data } = await http.get(
|
||||
'https://yun.bigdata5s.com/api/open-api/open/getSeedingLive',
|
||||
{
|
||||
params: {
|
||||
username: extend.username,
|
||||
password: extend.password,
|
||||
equipmentCode: sn,
|
||||
channelNo: extend.passage,
|
||||
},
|
||||
}
|
||||
this.videoList = this.videoList.concat(list);
|
||||
if(data.meta.current_page>= data.meta.last_page){
|
||||
this.loading = 'nomore';
|
||||
)
|
||||
item.video_url = data.data
|
||||
item.video_type = 'm3u8'
|
||||
}
|
||||
console.log(this.videoList,data);
|
||||
|
||||
item.bl_recommend = item.is_recommend == 1 ? true : false
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = 'loadmore';
|
||||
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;
|
||||
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()
|
||||
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.addressValue2) {
|
||||
params['base'] = this.addressValue2
|
||||
}
|
||||
if(this.device_id){
|
||||
params['point'] = this.device_id2;
|
||||
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;
|
||||
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.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';
|
||||
this.videoList2 = this.videoList2.concat(list)
|
||||
if (data.meta.current_page >= data.meta.last_page) {
|
||||
this.loading2 = 'nomore'
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading2 = 'loadmore';
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading2 = 'loadmore'
|
||||
})
|
||||
},
|
||||
//查询地址筛选
|
||||
queryDeviceBasics(type){
|
||||
queryDeviceBasics(type) {
|
||||
let params = {
|
||||
device_type:this.device_type,
|
||||
_t: new Date().getTime()
|
||||
device_type: this.device_type,
|
||||
_t: new Date().getTime(),
|
||||
}
|
||||
this.$http.get('/api/agricultural-device-basic',{params:params}).then(({data})=>{
|
||||
console.log(data);
|
||||
if(data.code==200){
|
||||
let _data = data.data;
|
||||
for(let item of _data){
|
||||
item['label'] = item.name;
|
||||
item['value'] = item.id;
|
||||
this.$http
|
||||
.get('/api/agricultural-device-basic', { params: params })
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
if (data.code == 200) {
|
||||
let _data = data.data
|
||||
for (let item of _data) {
|
||||
item['label'] = item.name
|
||||
item['value'] = item.id
|
||||
}
|
||||
this.deviceAddressList = JSON.parse(JSON.stringify(_data));
|
||||
this.deviceAddressList2 =_data;
|
||||
this.addressValue = _data[0].id;
|
||||
this.addressName = _data[0].name;
|
||||
this.addressValue2 = _data[0].id;
|
||||
this.addressName2 = _data[0].name;
|
||||
this.deviceAddressList.unshift({label:'全部',value:''});
|
||||
this.queryAddressDevicePoints(_data[0].id,type);
|
||||
this.deviceAddressList = JSON.parse(JSON.stringify(_data))
|
||||
this.deviceAddressList2 = _data
|
||||
this.addressValue = _data[0].id
|
||||
this.addressName = _data[0].name
|
||||
this.addressValue2 = _data[0].id
|
||||
this.addressName2 = _data[0].name
|
||||
this.deviceAddressList.unshift({ label: '全部', value: '' })
|
||||
this.queryAddressDevicePoints(_data[0].id, type)
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
//查询地址下的设备监控点
|
||||
queryAddressDevicePoints(id,type){
|
||||
queryAddressDevicePoints(id, type) {
|
||||
let params = {
|
||||
device_type:this.device_type,
|
||||
agricultural_basic:id,
|
||||
_t: new Date().getTime()
|
||||
device_type: this.device_type,
|
||||
agricultural_basic: id,
|
||||
_t: new Date().getTime(),
|
||||
}
|
||||
this.$http.get(`/api/agricultural-device-point/${id}`,{params:params}).then(({data})=>{
|
||||
console.log(data);
|
||||
if(data.code==200){
|
||||
let _data = data.data;
|
||||
let options = [];
|
||||
for(let k in _data){
|
||||
let item = {};
|
||||
item['label'] = _data[k];
|
||||
item['value'] = _data[k];
|
||||
options.push(item);
|
||||
this.$http
|
||||
.get(`/api/agricultural-device-point/${id}`, { params: params })
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
if (data.code == 200) {
|
||||
let _data = data.data
|
||||
let options = []
|
||||
for (let k in _data) {
|
||||
let item = {}
|
||||
item['label'] = _data[k]
|
||||
item['value'] = _data[k]
|
||||
options.push(item)
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
if (type == 'init') {
|
||||
//初始查询
|
||||
this.options4 = options
|
||||
this.device_id2 = options[0].value
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
},
|
||||
//触底加载
|
||||
onReachBottom() {
|
||||
if(this.current==0){
|
||||
if(this.loading=='loadmore'){
|
||||
this.queryDevices('more');
|
||||
if (this.current == 0) {
|
||||
if (this.loading == 'loadmore') {
|
||||
this.queryDevices('more')
|
||||
}
|
||||
}else{
|
||||
if(this.loading2=='loadmore'){
|
||||
this.queryDevices2('more');
|
||||
} else {
|
||||
if (this.loading2 == 'loadmore') {
|
||||
this.queryDevices2('more')
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.monitor-page{
|
||||
.monitor-page {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
.utab-section{
|
||||
.utab-section {
|
||||
padding: 30rpx;
|
||||
}
|
||||
.content-box{
|
||||
.content-box {
|
||||
padding: 30rpx;
|
||||
}
|
||||
.video_ul{
|
||||
.video_li{
|
||||
.video_ul {
|
||||
.video_li {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
padding: 0 12rpx;
|
||||
margin-bottom: 30rpx;
|
||||
.video_cd{
|
||||
.video_cd {
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.bottom-box{
|
||||
.bottom-box {
|
||||
padding-top: 30rpx;
|
||||
padding-bottom: 30rpx;
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
.row{
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
}
|
||||
.address{
|
||||
.address {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<view class="top_box u-border-bottom">
|
||||
<view class="tit">预警数据统计</view>
|
||||
<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 class="cont-box">
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<view class="top_box u-border-bottom">
|
||||
<view class="tit">预警数据统计</view>
|
||||
<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 class="cont-box">
|
||||
|
|
|
|||
|
|
@ -1,23 +1,29 @@
|
|||
<template>
|
||||
<view class="login-page bg-page">
|
||||
<view class="img-a">
|
||||
<view class="t-b">
|
||||
隆昌农业大数据监控平台
|
||||
|
||||
</view>
|
||||
<view class="t-b"> 隆昌农业大数据监控平台 </view>
|
||||
</view>
|
||||
<view class="login-view" style="">
|
||||
<view class="t-login">
|
||||
<form class="cl">
|
||||
<view class="t-a">
|
||||
<text class="txt">账号</text>
|
||||
<input type="text" name="username" placeholder="请输入您的账号"
|
||||
v-model="username" />
|
||||
<input
|
||||
type="text"
|
||||
name="username"
|
||||
placeholder="请输入您的账号"
|
||||
v-model="username"
|
||||
/>
|
||||
</view>
|
||||
<view class="t-a">
|
||||
<text class="txt">密码</text>
|
||||
<input type="password" name="password" maxlength="18"
|
||||
placeholder="请输入您的密码" v-model="password" />
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
maxlength="18"
|
||||
placeholder="请输入您的密码"
|
||||
v-model="password"
|
||||
/>
|
||||
</view>
|
||||
<button @tap="login()" type="button">登 录</button>
|
||||
<!-- <view class="reg" @tap="reg()">注 册</view> -->
|
||||
|
|
@ -27,64 +33,67 @@
|
|||
</view>
|
||||
</template>
|
||||
<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'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
username: '', //手机号码
|
||||
password: '' //密码
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
password: '', //密码
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {
|
||||
//当前登录按钮操作
|
||||
login() {
|
||||
if (!this.username) {
|
||||
uni.showToast({ title: '请输入您的账号', icon: 'none' });
|
||||
return;
|
||||
uni.showToast({ title: '请输入您的账号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.password) {
|
||||
uni.showToast({ title: '请输入您的密码', icon: 'none' });
|
||||
return;
|
||||
uni.showToast({ title: '请输入您的密码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
username:this.username,
|
||||
password:this.password
|
||||
};
|
||||
|
||||
this.$http.post('/api/auth/login',params,{
|
||||
custom:{
|
||||
auth:false
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
}
|
||||
}).then(({data})=>{
|
||||
console.log(data);
|
||||
if(data.code==200){
|
||||
let _data = data.data;
|
||||
let _info = _data.info;
|
||||
|
||||
this.$http
|
||||
.post('/api/auth/login', params, {
|
||||
custom: {
|
||||
auth: false,
|
||||
},
|
||||
})
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
if (data.code == 200) {
|
||||
let _data = data.data
|
||||
let _info = _data.info
|
||||
console.log(_data)
|
||||
jwt.setAccessToken(_data.token)
|
||||
this.$store.dispatch('USER_INFO',_info);
|
||||
this.$store.dispatch('getUserInfo')
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
uni.showToast({ title: '登录成功!', icon: 'none' });
|
||||
uni.showToast({ title: '登录成功!', icon: 'none' })
|
||||
}
|
||||
|
||||
}).catch(()=>{
|
||||
uni.showToast({ title: '登录失败!', icon: 'none' });
|
||||
})
|
||||
|
||||
.catch(() => {
|
||||
uni.showToast({ title: '登录失败!', icon: 'none' })
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.login-page{
|
||||
.login-page {
|
||||
background-color: #fff;
|
||||
.txt {
|
||||
font-size: 32rpx;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<view class="top-title-box">
|
||||
<view class="title">账号列表</view>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -127,9 +127,9 @@
|
|||
<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 v-auth="['endpoint.admin_users.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view v-auth="['endpoint.admin_users.edit_password']" class="btn_edit" @click="editPwdPopup(formInfo.id)">修改密码</view>
|
||||
<view v-auth="['endpoint.admin_users.edit']" class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
|
@ -235,6 +235,7 @@
|
|||
|
||||
<script>
|
||||
import {showLoading,hideLoading} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -242,20 +243,6 @@
|
|||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
|
|
@ -324,6 +311,26 @@
|
|||
};
|
||||
},
|
||||
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(){
|
||||
let arrName = [];
|
||||
for(let item of this.seletedBaseList){
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<u-navbar title="友情链接" :background="background" :custom-back="goback"
|
||||
:title-color="titleColor" :back-icon-color="titleColor">
|
||||
<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>
|
||||
</u-navbar>
|
||||
<u-sticky z-index="99">
|
||||
|
|
@ -164,8 +164,8 @@
|
|||
<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="editInfoId(formInfo.id)">编辑</view>
|
||||
<view v-auth="['endpoint.friend_links.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||
<view v-auth="['endpoint.friend_links.edit']" class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
|
@ -218,6 +218,7 @@
|
|||
|
||||
<script>
|
||||
import {formatDate,navigateBack,showLoading,hideLoading} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -229,20 +230,6 @@
|
|||
page:1,
|
||||
list:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
cindex:-1,//操作的索引
|
||||
editShow:false,
|
||||
|
|
@ -286,6 +273,28 @@
|
|||
q_type:'',
|
||||
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:{
|
||||
timeFormat(val){
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<view class="top-title-box">
|
||||
<view class="title">角色列表</view>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -82,8 +82,8 @@
|
|||
<view class="popup-form-info">
|
||||
<view class="top_box">
|
||||
<view class="handle-btns">
|
||||
<view class="btn_del" @click="deleteRoleId(info.id)">删除</view>
|
||||
<view class="btn_edit" @click="editRoleId(info.id)">编辑</view>
|
||||
<view v-auth="['endpoint.admin_roles.destroy']" class="btn_del" @click="deleteRoleId(info.id)">删除</view>
|
||||
<view v-auth="['endpoint.admin_roles.edit']" class="btn_edit" @click="editRoleId(info.id)">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section_c">
|
||||
|
|
@ -106,6 +106,7 @@
|
|||
<script>
|
||||
import DaTreeVue2 from '@/components/da-tree-vue2/index.vue'
|
||||
import {showLoading,hideLoading} from '@/com/utils.js'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
export default {
|
||||
components: { DaTreeVue2 },
|
||||
data() {
|
||||
|
|
@ -114,20 +115,6 @@
|
|||
page:1,
|
||||
rolelist:[],
|
||||
loading:'loadmore',
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}
|
||||
],
|
||||
popupShow:false,
|
||||
info:{},//详情
|
||||
cindex:-1,//操作的索引
|
||||
|
|
@ -143,6 +130,28 @@
|
|||
permissionsList:[],
|
||||
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() {
|
||||
this.queryAdminRoleList();
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@
|
|||
<view class="arrow_R"></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">
|
||||
<u-icon name="man-add" size="46"></u-icon>
|
||||
</view>
|
||||
<view class="item-c">
|
||||
<view class="item-c" >
|
||||
<view class="tname">角色管理</view>
|
||||
<view class="arrow_R"></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">
|
||||
<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/system/log')">
|
||||
<view v-auth="['endpoint.operation_log.index']" class="nav-list" @click="linnavF('/pages/system/log')">
|
||||
<view class="icon_img">
|
||||
<u-icon name="clock" size="46"></u-icon>
|
||||
</view>
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
<view class="arrow_R"></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">
|
||||
<u-icon name="attach" size="46"></u-icon>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view>
|
||||
<Appbar title="基地产量">
|
||||
<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>
|
||||
</Appbar>
|
||||
<u-sticky>
|
||||
|
|
@ -61,6 +61,8 @@
|
|||
:data="currentData"
|
||||
@onEdit="handleEdit"
|
||||
@onDel="handleDel"
|
||||
:eidtAuth="['endpoint.crops_output.edit']"
|
||||
:delAuth="['endpoint.crops_output.destroy']"
|
||||
></BaseTablePopup>
|
||||
<!-- 编辑 -->
|
||||
<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 BaseTablePopup from '@/components/base-table/popup.vue'
|
||||
import BasicsEdit from './components/basics-edit.vue'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
const baseTableColums = [
|
||||
{
|
||||
title: '街镇名称',
|
||||
|
|
@ -147,22 +150,6 @@ export default {
|
|||
},
|
||||
},
|
||||
dataList: [],
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
],
|
||||
formShow: false,
|
||||
baseShow: false,
|
||||
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: {
|
||||
handleSubmit(e) {
|
||||
this.filterParmas = e
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view>
|
||||
<Appbar title="城镇产量">
|
||||
<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>
|
||||
</Appbar>
|
||||
<u-sticky>
|
||||
|
|
@ -61,6 +61,8 @@
|
|||
:data="currentData"
|
||||
@onEdit="handleEdit"
|
||||
@onDel="handleDel"
|
||||
:eidtAuth="['endpoint.town_crops_output.edit']"
|
||||
:delAuth="['endpoint.town_crops_output.destroy']"
|
||||
></BaseTablePopup>
|
||||
<!-- 编辑 -->
|
||||
<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 BaseTablePopup from '@/components/base-table/popup.vue'
|
||||
import BasicsEdit from './components/basics-edit.vue'
|
||||
import checkPermission from '@/utils/permission.js'
|
||||
const baseTableColums = [
|
||||
{
|
||||
title: '街镇名称',
|
||||
|
|
@ -146,22 +149,7 @@ export default {
|
|||
},
|
||||
},
|
||||
dataList: [],
|
||||
options: [
|
||||
{
|
||||
text: '编辑',
|
||||
opt: 'edit',
|
||||
style: {
|
||||
backgroundColor: '#007aff',
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
opt: 'delete',
|
||||
style: {
|
||||
backgroundColor: '#dd524d',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
formShow: false,
|
||||
baseShow: false,
|
||||
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: {
|
||||
handleSubmit(e) {
|
||||
this.filterParmas = e
|
||||
|
|
|
|||
|
|
@ -1,16 +1,36 @@
|
|||
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 = {
|
||||
[types.USER_INFO]({commit},userInfo){
|
||||
[types.USER_INFO]({ commit }, userInfo) {
|
||||
let _data = {};
|
||||
if(userInfo&&userInfo.id){
|
||||
if (userInfo) {
|
||||
console.log(userInfo);
|
||||
_data = userInfo;
|
||||
// setStorage('userInfo',userInfo)
|
||||
}else{
|
||||
} 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'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export default actions;
|
||||
|
|
@ -17,11 +17,11 @@ const store = new Vuex.Store({
|
|||
createPersistedState({
|
||||
// 当state中的值发生变化的时候出发reduce函数
|
||||
reducer(val) {
|
||||
console.log(val,'createPersistedState') // value值为当前state中的所有值对象
|
||||
console.log(val, 'createPersistedState') // value值为当前state中的所有值对象
|
||||
// return什么,localstorage中的key值为vuex的value值就是什么,而且是实时与state中的值保持同步
|
||||
return {
|
||||
userInfo: val.userInfo,
|
||||
user_access_token:val.user_access_token
|
||||
user_access_token: val.user_access_token
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue