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

View File

@ -77,6 +77,8 @@
"node-sass": "^6.0.1",
"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"

View File

@ -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;
}

View File

@ -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 = []

View File

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

View File

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

View File

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

View File

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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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,14 +24,16 @@
</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>
@ -39,73 +51,93 @@
<!-- <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" />
</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" />
</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,12 +145,21 @@
<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>
@ -138,7 +179,9 @@
</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>
@ -155,59 +198,70 @@
<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'
import {
formatDate,
showLoading,
hideLoading,
navigateBack,
} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
background: {
backgroundColor: '#2a7dc9',
},
titleColor:"#ffffff",
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,
@ -218,7 +272,7 @@
day: false,
hour: false,
minute: false,
second: false
second: false,
},
screenShow: false,
isqueryselect: false,
@ -229,7 +283,7 @@
quarter_name: '',
area: '',
sales: '',
unit:''
unit: '',
},
editShow: false,
queryCond: {
@ -257,57 +311,79 @@
{
label: '第四季度',
value: 4,
},
],
}
]
};
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.rice_shrimp_flows.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.rice_shrimp_flows.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters: {
quartername(val) {
let keys = { 1: '第一季度', 2: '第二季度', 3: '第三季度', 4: '第四季度' }
let name = keys[val] ? keys[val] : val
return name;
return name
},
timeFormat(val) {
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');
return formatDate(val * 1000, 'yyyy-MM-dd hh:mm')
},
},
onLoad() {
this.queryDataList();
this.queryDataList()
},
methods: {
addBtn() {
this.setInfoKeys('add');
this.editShow = true;
this.setInfoKeys('add')
this.editShow = true
},
selectFn1(type) {
this.isqueryselect = false;
let year = this.setInfo.year;
this.isqueryselect = false
let year = this.setInfo.year
if (type == 'q') {
this.isqueryselect = true;
this.selectShow1 = true;
year = this.queryCond.year;
this.isqueryselect = true
this.selectShow1 = true
year = this.queryCond.year
}
if (year) {
this.selectValue1 = `${year}-01-01 00:00:01`;
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;
this.isqueryselect = false
let quarter = this.setInfo.quarter
if (type == 'q') {
this.isqueryselect = true;
quarter = this.queryCond.quarter;
this.isqueryselect = true
quarter = this.queryCond.quarter
}
for (let [index, item] of this.quarterlist.entries()) {
if (quarter == item.value) {
this.selectValue2 = [index];
break;
this.selectValue2 = [index]
break
}
}
this.selectShow2 = true;
this.selectShow2 = true
},
resetQuery() {
this.queryCond = {
@ -317,139 +393,144 @@
}
},
queryBtn() {
this.list = [];
this.queryDataList(true);
this.screenShow = false;
this.list = []
this.queryDataList(true)
this.screenShow = false
},
uselectConfirm1(e) {
if (this.isqueryselect) {
console.log(e);
this.queryCond.year = e.year;
console.log(e)
this.queryCond.year = e.year
} else {
this.setInfo.year = e.year;
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;
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;
this.setInfo.quarter = e[0].value
this.setInfo.quarter_name = e[0].label
}
},
screenShowFn() {
this.screenShow = true;
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;
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;
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;
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;
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()
_t: new Date().getTime(),
}
for (let k in this.queryCond) {
if (this.queryCond[k] || this.queryCond[k] == '0') {
params[k] = this.queryCond[k];
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;
this.screenShow = false
if (refresh) {
this.list = [];
this.list = []
}
this.loading = 'loadmore';
this.loading = 'loadmore'
if (data.code == 200) {
let _list = data.data|| [];
let _list = data.data || []
for (let item of _list) {
item.show = false;
item.show = false
}
this.list = this.list.concat(_list);
console.log(this.list);
this.list = this.list.concat(_list)
console.log(this.list)
if (this.list.length >= data.meta.total) {
this.loading ='nomore';
this.loading = 'nomore'
}
}
}).catch(()=>{
this.loading = 'loadmore';
this.screenShow = false;
})
.catch(() => {
this.loading = 'loadmore'
this.screenShow = false
})
},
//
editInfoBtn() {
if (!this.valiFormRule()) {
return false;
return false
}
let params = {}
params = this.setInfo;
showLoading('请稍等...');
params = this.setInfo
showLoading('请稍等...')
if (params['id']) {
this.$http.put(`/api/rice-shrimp-flows/${params['id']}`,params).then(({data})=>{
hideLoading();
this.$http
.put(`/api/rice-shrimp-flows/${params['id']}`, params)
.then(({ data }) => {
hideLoading()
if (data.code == 200) {
this.editShow = false;
this.queryDataList(true);
this.editShow = false
this.queryDataList(true)
}
uni.showToast({ title: data.message, icon: 'none' });
}).catch(()=>{
hideLoading();
uni.showToast({ title: data.message, icon: 'none' })
})
.catch(() => {
hideLoading()
})
} else {
delete params['id'];
this.$http.post(`/api/rice-shrimp-flows`,params).then(({data})=>{
hideLoading();
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' });
this.queryDataList(true)
this.editShow = false
uni.showToast({ title: data.message, icon: 'none' })
} else {
uni.showToast({ title: data.message, icon: 'none' });
uni.showToast({ title: data.message, icon: 'none' })
}
}).catch(()=>{
hideLoading();
})
.catch(() => {
hideLoading()
})
}
},
queryInfo(id) {
// this.$http.get(`/api/rice-shrimp-flows/${id}`).then(({data})=>{
@ -459,15 +540,14 @@
// this.setInfoKeys();
// }
// }).catch((err)=>{
// })
},
editInfoId(id) {
// this.queryInfo(id);
this.setInfoKeys();
this.editShow = true;
this.popupShow = false;
this.setInfoKeys()
this.editShow = true
this.popupShow = false
},
//deleteInfoId
deleteInfoId(id) {
@ -476,26 +556,28 @@
content: '是否确定删除?',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
showLoading('请稍等...');
this.$http.delete(`/api/rice-shrimp-flows/${id}`).then(({data})=>{
hideLoading();
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.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) {
let info = {
@ -505,24 +587,23 @@
quarter_name: '',
area: '',
sales: '',
unit:''
unit: '',
}
if (type == 'add') {
this.setInfo = info;
this.setInfo = info
} else {
let {id,year,quarter,area,sales,unit} = this.formInfo;
let { id, year, quarter, area, sales, unit } = this.formInfo
try {
for (let k in info) {
info[k] = this.formInfo[k];
info[k] = this.formInfo[k]
}
for (let item of this.quarterlist) {
if (quarter == item.value) {
info.quarter_name = item.label;
break;
info.quarter_name = item.label
break
}
}
this.setInfo = info;
this.setInfo = info
} catch (e) {
//TODO handle the exception
uni.showToast({ title: '数据错误', icon: 'none' })
@ -530,43 +611,41 @@
}
},
valiFormRule() {
let {id,year,quarter,area,sales,unit} = this.setInfo;
let { id, year, quarter, area, sales, unit } = this.setInfo
if (year == '') {
uni.showToast({ title: '年份不能为空', icon: 'none' });
return false;
uni.showToast({ title: '年份不能为空', icon: 'none' })
return false
}
if (quarter == '') {
uni.showToast({ title: '季度不能为空', icon: 'none' });
return false;
uni.showToast({ title: '季度不能为空', icon: 'none' })
return false
}
if (area == '') {
uni.showToast({ title: '地区不能为空', icon: 'none' });
return false;
uni.showToast({ title: '地区不能为空', icon: 'none' })
return false
}
if (sales == '') {
uni.showToast({ title: '销量不能为空', icon: 'none' });
return false;
uni.showToast({ title: '销量不能为空', icon: 'none' })
return false
}
if (unit == '') {
uni.showToast({ title: '单位不能为空', icon: 'none' });
return false;
uni.showToast({ title: '单位不能为空', icon: 'none' })
return false
}
return true;
return true
},
goback() {
navigateBack()
}
},
},
//
onReachBottom() {
if (this.loading == 'loadmore') {
this.queryDataList();
this.queryDataList()
}
},
}
</script>
<style lang="scss">
</style>
<style lang="scss"></style>

View File

@ -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){

View File

@ -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){

View File

@ -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,14 +24,16 @@
</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>
@ -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" />
</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,12 +132,21 @@
<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>
@ -120,9 +161,10 @@
</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,59 +176,69 @@
<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'
import {
formatDate,
showLoading,
hideLoading,
navigateBack,
} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
background: {
backgroundColor: '#2a7dc9',
},
titleColor:"#ffffff",
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,
@ -197,7 +249,7 @@
day: false,
hour: false,
minute: false,
second: false
second: false,
},
screenShow: false,
isqueryselect: false,
@ -206,7 +258,7 @@
year: '',
quarter: '',
quarter_name: '',
price:''
price: '',
},
editShow: false,
queryCond: {
@ -234,55 +286,76 @@
{
label: '第四季度',
value: 4,
},
],
}
]
};
},
filters: {
quartername(val) {
let keys = { 1: '第一季度', 2: '第二季度', 3: '第三季度', 4: '第四季度' }
let name = keys[val] ? keys[val] : val
return name;
return name
},
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.rice_shrimp_prices.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.rice_shrimp_prices.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
onLoad() {
this.queryDataList();
this.queryDataList()
},
methods: {
addBtn() {
this.setInfoKeys('add');
this.editShow = true;
this.setInfoKeys('add')
this.editShow = true
},
selectFn1(type) {
this.isqueryselect = false;
let year = this.setInfo.year;
this.isqueryselect = false
let year = this.setInfo.year
if (type == 'q') {
this.isqueryselect = true;
this.selectShow1 = true;
year = this.queryCond.year;
this.isqueryselect = true
this.selectShow1 = true
year = this.queryCond.year
}
if (year) {
this.selectValue1 = `${year}-01-01 00:00:01`;
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;
this.isqueryselect = false
let quarter = this.setInfo.quarter
if (type == 'q') {
this.isqueryselect = true;
quarter = this.queryCond.quarter;
this.isqueryselect = true
quarter = this.queryCond.quarter
}
for (let [index, item] of this.quarterlist.entries()) {
if (quarter == item.value) {
this.selectValue2 = [index];
break;
this.selectValue2 = [index]
break
}
}
this.selectShow2 = true;
this.selectShow2 = true
},
resetQuery() {
this.queryCond = {
@ -292,139 +365,144 @@
}
},
queryBtn() {
this.list = [];
this.queryDataList(true);
this.screenShow = false;
this.list = []
this.queryDataList(true)
this.screenShow = false
},
uselectConfirm1(e) {
if (this.isqueryselect) {
console.log(e);
this.queryCond.year = e.year;
console.log(e)
this.queryCond.year = e.year
} else {
this.setInfo.year = e.year;
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;
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;
this.setInfo.quarter = e[0].value
this.setInfo.quarter_name = e[0].label
}
},
screenShowFn() {
this.screenShow = true;
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;
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;
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;
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;
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()
_t: new Date().getTime(),
}
for (let k in this.queryCond) {
if (this.queryCond[k] || this.queryCond[k] == '0') {
params[k] = this.queryCond[k];
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;
this.screenShow = false
if (refresh) {
this.list = [];
this.list = []
}
this.loading = 'loadmore';
this.loading = 'loadmore'
if (data.code == 200) {
let _list = data.data|| [];
let _list = data.data || []
for (let item of _list) {
item.show = false;
item.show = false
}
this.list = this.list.concat(_list);
console.log(this.list);
this.list = this.list.concat(_list)
console.log(this.list)
if (this.list.length >= data.meta.total) {
this.loading ='nomore';
this.loading = 'nomore'
}
}
}).catch(()=>{
this.loading = 'loadmore';
this.screenShow = false;
})
.catch(() => {
this.loading = 'loadmore'
this.screenShow = false
})
},
//
editInfoBtn() {
if (!this.valiFormRule()) {
return false;
return false
}
let params = {}
params = this.setInfo;
showLoading('请稍等');
params = this.setInfo
showLoading('请稍等')
if (params['id']) {
this.$http.put(`/api/rice-shrimp-prices/${params['id']}`,params).then(({data})=>{
hideLoading();
this.$http
.put(`/api/rice-shrimp-prices/${params['id']}`, params)
.then(({ data }) => {
hideLoading()
if (data.code == 200) {
this.editShow = false;
this.queryDataList(true);
this.editShow = false
this.queryDataList(true)
}
uni.showToast({ title: data.message, icon: 'none' });
}).catch(()=>{
hideLoading();
uni.showToast({ title: data.message, icon: 'none' })
})
.catch(() => {
hideLoading()
})
} else {
delete params['id'];
this.$http.post(`/api/rice-shrimp-prices`,params).then(({data})=>{
hideLoading();
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' });
this.queryDataList(true)
this.editShow = false
uni.showToast({ title: data.message, icon: 'none' })
} else {
uni.showToast({ title: data.message, icon: 'none' });
uni.showToast({ title: data.message, icon: 'none' })
}
}).catch(()=>{
hideLoading();
})
.catch(() => {
hideLoading()
})
}
},
queryInfo(id) {
// this.$http.get(`/api/rice-shrimp-prices/${id}`).then(({data})=>{
@ -434,15 +512,14 @@
// this.setInfoKeys();
// }
// }).catch((err)=>{
// })
},
editInfoId(id) {
// this.queryInfo(id);
this.setInfoKeys();
this.editShow = true;
this.popupShow = false;
this.setInfoKeys()
this.editShow = true
this.popupShow = false
},
//deleteInfoId
deleteInfoId(id) {
@ -451,26 +528,28 @@
content: '是否确定删除?',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
showLoading('请稍等');
this.$http.delete(`/api/rice-shrimp-prices/${id}`).then(({data})=>{
hideLoading();
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.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) {
let info = {
@ -478,25 +557,24 @@
year: '',
quarter: '',
quarter_name: '',
price:''
price: '',
}
if (type == 'add') {
this.setInfo = info;
this.setInfo = info
} else {
let {id,year,quarter,price} = this.formInfo;
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.quarter_name = item.label
break
}
}
info['id'] = id;
info['year'] = year;
info['quarter'] = quarter;
info['price'] = price;
this.setInfo = info;
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' })
@ -504,34 +582,32 @@
}
},
valiFormRule() {
let {id,year,quarter,price} = this.setInfo;
let { id, year, quarter, price } = this.setInfo
if (year == '') {
uni.showToast({ title: '年份不能为空', icon: 'none' });
return false;
uni.showToast({ title: '年份不能为空', icon: 'none' })
return false
}
if (quarter == '') {
uni.showToast({ title: '季度不能为空', icon: 'none' });
return false;
uni.showToast({ title: '季度不能为空', icon: 'none' })
return false
}
if (price == '') {
uni.showToast({ title: '价格不能为空', icon: 'none' });
return false;
uni.showToast({ title: '价格不能为空', icon: 'none' })
return false
}
return true;
return true
},
goback() {
navigateBack()
}
},
},
//
onReachBottom() {
if (this.loading == 'loadmore') {
this.queryDataList();
this.queryDataList()
}
},
}
</script>
<style lang="scss">
</style>
<style lang="scss"></style>

View File

@ -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,14 +19,16 @@
</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>
@ -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" />
</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"
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" />
</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,12 +142,11 @@
<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>
@ -123,9 +161,10 @@
</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,59 +176,69 @@
<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'
import {
formatDate,
showLoading,
hideLoading,
navigateBack,
} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
background: {
backgroundColor: '#2a7dc9',
},
titleColor:"#ffffff",
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,
@ -200,7 +249,7 @@
day: false,
hour: false,
minute: false,
second: false
second: false,
},
screenShow: false,
isqueryselect: false,
@ -209,7 +258,7 @@
year: '',
week: '',
week_name: '',
price:''
price: '',
},
editShow: false,
queryCond: {
@ -222,47 +271,68 @@
selectValue1: '',
selectValue2: [0],
weeksperyearlist: [],
};
}
},
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();
this.queryDataList()
this.getweeksperyear()
},
methods: {
addBtn() {
this.setInfoKeys('add');
this.editShow = true;
this.setInfoKeys('add')
this.editShow = true
},
selectFn1(type) {
this.isqueryselect = false;
let year = this.setInfo.year;
this.isqueryselect = false
let year = this.setInfo.year
if (type == 'q') {
this.isqueryselect = true;
this.selectShow1 = true;
year = this.queryCond.year;
this.isqueryselect = true
this.selectShow1 = true
year = this.queryCond.year
}
if (year) {
this.selectValue1 = `${year}-01-01 00:00:01`;
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;
this.isqueryselect = false
let week = this.setInfo.week
if (type == 'q') {
this.isqueryselect = true;
week = this.queryCond.week;
this.isqueryselect = true
week = this.queryCond.week
}
for (let [index, item] of this.weeksperyearlist.entries()) {
if (week == item.value) {
this.selectValue2 = [index];
break;
this.selectValue2 = [index]
break
}
}
this.selectShow2 = true;
this.selectShow2 = true
},
resetQuery() {
this.queryCond = {
@ -272,139 +342,144 @@
}
},
queryBtn() {
this.list = [];
this.queryDataList(true);
this.screenShow = false;
this.list = []
this.queryDataList(true)
this.screenShow = false
},
uselectConfirm1(e) {
if (this.isqueryselect) {
console.log(e);
this.queryCond.year = e.year;
console.log(e)
this.queryCond.year = e.year
} else {
this.setInfo.year = e.year;
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;
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;
this.setInfo.week = e[0].value
this.setInfo.week_name = e[0].label
}
},
screenShowFn() {
this.screenShow = true;
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;
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;
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;
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;
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()
_t: new Date().getTime(),
}
for (let k in this.queryCond) {
if (this.queryCond[k] || this.queryCond[k] == '0') {
params[k] = this.queryCond[k];
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;
this.screenShow = false
if (refresh) {
this.list = [];
this.list = []
}
this.loading = 'loadmore';
this.loading = 'loadmore'
if (data.code == 200) {
let _list = data.data|| [];
let _list = data.data || []
for (let item of _list) {
item.show = false;
item.show = false
}
this.list = this.list.concat(_list);
console.log(this.list);
this.list = this.list.concat(_list)
console.log(this.list)
if (this.list.length >= data.meta.total) {
this.loading ='nomore';
this.loading = 'nomore'
}
}
}).catch(()=>{
this.loading = 'loadmore';
this.screenShow = false;
})
.catch(() => {
this.loading = 'loadmore'
this.screenShow = false
})
},
//
editInfoBtn() {
if (!this.valiFormRule()) {
return false;
return false
}
let params = {}
params = this.setInfo;
showLoading('请稍等');
params = this.setInfo
showLoading('请稍等')
if (params['id']) {
this.$http.put(`/api/rice-shrimp-weekly-prices/${params['id']}`,params).then(({data})=>{
hideLoading();
this.$http
.put(`/api/rice-shrimp-weekly-prices/${params['id']}`, params)
.then(({ data }) => {
hideLoading()
if (data.code == 200) {
this.editShow = false;
this.queryDataList(true);
this.editShow = false
this.queryDataList(true)
}
uni.showToast({ title: data.message, icon: 'none' });
}).catch(()=>{
hideLoading();
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();
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' });
this.queryDataList(true)
this.editShow = false
uni.showToast({ title: data.message, icon: 'none' })
} else {
uni.showToast({ title: data.message, icon: 'none' });
uni.showToast({ title: data.message, icon: 'none' })
}
}).catch(()=>{
hideLoading();
})
.catch(() => {
hideLoading()
})
}
},
queryInfo(id) {
// this.$http.get(`/api/rice-shrimp-weekly-prices/${id}`).then(({data})=>{
@ -414,29 +489,29 @@
// this.setInfoKeys();
// }
// }).catch((err)=>{
// })
},
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})=>{
this.$http
.get(`/api/weeks-per-year`)
.then(({ data }) => {
if (data.code == 200) {
let list = data.data;
let weeks = [];
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) {
@ -445,26 +520,28 @@
content: '是否确定删除?',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
showLoading('请稍等');
this.$http.delete(`/api/rice-shrimp-weekly-prices/${id}`).then(({data})=>{
hideLoading();
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.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) {
let info = {
@ -472,25 +549,24 @@
year: '',
week: '',
week_name: '',
price:''
price: '',
}
if (type == 'add') {
this.setInfo = info;
this.setInfo = info
} else {
let {id,year,week,price} = this.formInfo;
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.week_name = item.label
break
}
}
info['id'] = id;
info['year'] = year;
info['week'] = week;
info['price'] = price;
this.setInfo = info;
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' })
@ -498,34 +574,32 @@
}
},
valiFormRule() {
let {id,year,week,price} = this.setInfo;
let { id, year, week, price } = this.setInfo
if (year == '') {
uni.showToast({ title: '年份不能为空', icon: 'none' });
return false;
uni.showToast({ title: '年份不能为空', icon: 'none' })
return false
}
if (week == '') {
uni.showToast({ title: '周不能为空', icon: 'none' });
return false;
uni.showToast({ title: '周不能为空', icon: 'none' })
return false
}
if (price == '') {
uni.showToast({ title: '价格不能为空', icon: 'none' });
return false;
uni.showToast({ title: '价格不能为空', icon: 'none' })
return false
}
return true;
return true
},
goback() {
navigateBack()
}
},
},
//
onReachBottom() {
if (this.loading == 'loadmore') {
this.queryDataList();
this.queryDataList()
}
},
}
</script>
<style lang="scss">
</style>
<style lang="scss"></style>

View File

@ -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({

View File

@ -1,59 +1,104 @@
<template>
<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;">
<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="基地"
<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
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="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">
@ -62,7 +107,12 @@
</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>
@ -70,7 +120,11 @@
</view>
<view class="secreen-show-box mt20" v-if="current == 0 && addressName">
<view class="label_t">当前位置</view>
<view class="info">{{addressName}}-{{device_id?device_id:'全部'}}-{{is_recommend?'推荐':'全部'}}</view>
<view class="info"
>{{ addressName }}-{{ device_id ? device_id : '全部' }}-{{
is_recommend ? '推荐' : '全部'
}}</view
>
</view>
<view class="secreen-show-box mt20" v-if="current == 1 && q_start_time">
<view class="label_t">查询</view>
@ -84,57 +138,80 @@
<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_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-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'
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 },
components: { videoFlvH5,videoM3u8H5 },
data() {
return {
list: [
{
name: '监控'
name: '监控',
},
{
name: '视频'
name: '视频',
},
],
current: 0,
@ -158,7 +235,7 @@
{
label: '推荐',
value: 1,
}
},
],
per_page: 4,
page: 1,
@ -168,7 +245,7 @@
day: true,
hour: true,
minute: true,
second: false
second: false,
},
defaultTime: '',
pickerShow: false, //
@ -185,308 +262,349 @@
loading: 'loading',
loading2: '',
selectedTimeTip: false, //
};
}
},
onLoad() {
this.queryWebsocketIp();
this.queryWebsocketIp()
},
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;
console.log(val)
let narray = this.deviceAddressList.filter((item) => {
return item.value == val
})
console.log(narray);
console.log(narray)
if (this.current == 0) {
this.addressName = narray[0].name;
this.addressName = narray[0].name
} else {
this.addressName2 = narray[0].name;
this.addressName2 = narray[0].name
}
if (val == '') {
this.addressName = '全部';
this.queryDevices();
this.addressName = '全部'
this.queryDevices()
} else {
this.queryAddressDevicePoints(val);
this.queryAddressDevicePoints(val)
}
},
//id
change2(val) {
console.log(val)
this.queryDevices();
this.queryDevices()
},
//
change3(val) {
this.queryDevices();
this.queryDevices()
},
//-
change4(val){
},
change4(val) {},
//
pickerTimeFn(type) {
this.ctimeType = type;
this.pickerShow = true;
this.ctimeType = type
this.pickerShow = true
},
//
pickerChange(e) {
console.log(e, '日期范围')
let dateTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`;
let dateTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
if (this.ctimeType == 'start') {
this.start_date_c = dateTime;
this.start_date_c = dateTime
} else if (this.ctimeType == 'end') {
this.end_date_c = dateTime;
}else{}
this.end_date_c = dateTime
} else {
}
console.log(dateTime, '日期范围')
},
//
deleteDateFn(type) {
if (type == 'start') {
this.start_date_c = '';
this.start_date_c = ''
} else if (type == 'end') {
this.end_date_c = '';
}else{}
this.end_date_c = ''
} else {
}
},
resetSecreen() {
this.start_date_c = '';
this.end_date_c = '';
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();
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;
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;
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);
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})=>{
this.$http
.put(`/api/devices-update-recommend/${id}`)
.then(({ data }) => {
console.log(data, 'recommendId===')
}).catch((err)=>{
})
.catch((err) => {})
},
async queryWebsocketIp() {
let params = {
_t: new Date().getTime()
_t: new Date().getTime(),
}
const {data} = await this.$http.get('/api/ffmpeg-websocket-ip',{params:params});
const { data } = await this.$http.get('/api/ffmpeg-websocket-ip', {
params: params,
})
try {
console.log(data,'queryWebsocketIp');
console.log(data, 'queryWebsocketIp')
if (data.code == 200) {
this.websocket = data.data;
this.websocket = data.data
}
} catch (e) {
//TODO handle the exception
}
this.queryDeviceBasics('init');
this.queryDeviceBasics('init')
},
//
queryDevices(type) {
if (type != 'more') {
this.loading = 'loadmore';
this.page = 1;
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()
_t: new Date().getTime(),
}
if (this.addressValue) {
params['base'] = this.addressValue;
params['base'] = this.addressValue
}
if (this.device_id) {
params['point'] = this.device_id;
params['point'] = this.device_id
}
if (this.is_recommend) {
params['is_recommend'] = this.is_recommend;
params['is_recommend'] = this.is_recommend
}
this.loading = 'loading';
this.$http.get('/api/devices',{params:params}).then(({data})=>{
this.loading = 'loadmore';
this.loading = 'loading'
this.$http
.get('/api/devices', { params: params })
.then(async ({ data }) => {
this.loading = 'loadmore'
if (type != 'more') {
this.videoList = [];
this.videoList = []
}
console.log(data,'监测视频');
console.log(data, '监测视频')
if (data.code == 200) {
let list = data.data;
let list = data.data
for (let item of list) {
let url = item.extends.rtsp_url;
let {ip,port} = this.websocket;
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.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);
)
item.video_url = data.data
item.video_type = 'm3u8'
}
item.bl_recommend = item.is_recommend == 1 ? true : false
}
this.videoList = this.videoList.concat(list)
if (data.meta.current_page >= data.meta.last_page) {
this.loading = 'nomore';
this.loading = 'nomore'
}
console.log(this.videoList,data);
console.log(this.videoList, data)
}
}).catch(()=>{
this.loading = 'loadmore';
})
.catch(() => {
this.loading = 'loadmore'
})
},
//
queryDevices2(type) {
if (type != 'more') {
this.loading2 = 'loadmore';
this.page2 = 1;
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()
_t: new Date().getTime(),
}
if (this.addressValue2) {
params['base'] = this.addressValue2;
params['base'] = this.addressValue2
}
if (this.device_id) {
params['point'] = this.device_id2;
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,'监测视频');
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;
let list = data.data
for (let item of list) {
let url = item.extends.rtsp_url;
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');
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);
this.videoList2 = this.videoList2.concat(list)
if (data.meta.current_page >= data.meta.last_page) {
this.loading2 = 'nomore';
this.loading2 = 'nomore'
}
}
}).catch(()=>{
this.loading2 = 'loadmore';
})
.catch(() => {
this.loading2 = 'loadmore'
})
},
//
queryDeviceBasics(type) {
let params = {
device_type: this.device_type,
_t: new Date().getTime()
_t: new Date().getTime(),
}
this.$http.get('/api/agricultural-device-basic',{params:params}).then(({data})=>{
console.log(data);
this.$http
.get('/api/agricultural-device-basic', { params: params })
.then(({ data }) => {
console.log(data)
if (data.code == 200) {
let _data = data.data;
let _data = data.data
for (let item of _data) {
item['label'] = item.name;
item['value'] = item.id;
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) {
let params = {
device_type: this.device_type,
agricultural_basic: id,
_t: new Date().getTime()
_t: new Date().getTime(),
}
this.$http.get(`/api/agricultural-device-point/${id}`,{params:params}).then(({data})=>{
console.log(data);
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 = [];
let _data = data.data
let options = []
for (let k in _data) {
let item = {};
item['label'] = _data[k];
item['value'] = _data[k];
options.push(item);
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(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');
this.queryDevices('more')
}
} else {
if (this.loading2 == 'loadmore') {
this.queryDevices2('more');
this.queryDevices2('more')
}
}
},
}
</script>
@ -522,7 +640,6 @@
align-items: center;
margin-bottom: 12rpx;
}
}
.address {
font-size: 28rpx;

View File

@ -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">

View File

@ -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">

View File

@ -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,61 +33,64 @@
</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
password: this.password,
}
}).then(({data})=>{
console.log(data);
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;
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 {

View File

@ -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){

View File

@ -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){

View File

@ -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();

View File

@ -40,7 +40,7 @@
<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>
@ -49,7 +49,7 @@
<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>

View File

@ -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

View File

@ -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

View File

@ -1,9 +1,13 @@
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) {
let _data = {};
if(userInfo&&userInfo.id){
if (userInfo) {
console.log(userInfo);
_data = userInfo;
// setStorage('userInfo',userInfo)
} else {
@ -11,6 +15,22 @@ const actions = {
}
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;

View File

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

21581
yarn.lock

File diff suppressed because it is too large Load Diff