Merge branch 'master' of https://gitea.hmily.club/pdkj/lcny-admin-mobile-vue
commit
ff41fb1e0f
|
|
@ -1,7 +1,16 @@
|
||||||
<script>
|
<script>
|
||||||
|
import store from './store/index.js'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
|
|
||||||
|
if(!(store.state.user_access_token&&store.state.userInfo['id'])){//未登录
|
||||||
|
uni.redirectTo({
|
||||||
|
url:'/pages/login/login'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
// console.log(store.state.user_access_token)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import Request from './luch-request/index.js'
|
||||||
import jwt from './jwt.js'
|
import jwt from './jwt.js'
|
||||||
import {toast} from '@/com/utils.js'
|
import {toast} from '@/com/utils.js'
|
||||||
//测试地址
|
//测试地址
|
||||||
const baseApi = 'http://36.133.205.221:81';
|
// const baseApi = 'http://36.133.205.221:81';
|
||||||
|
const baseApi = 'http://lcny.sk797.cn';
|
||||||
const http = new Request();
|
const http = new Request();
|
||||||
|
|
||||||
http.setConfig((config) => { /* 设置全局配置 */
|
http.setConfig((config) => { /* 设置全局配置 */
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,4 @@ const app = new Vue({
|
||||||
...App
|
...App
|
||||||
})
|
})
|
||||||
app.$mount()
|
app.$mount()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -148,6 +149,56 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/estate/estate-week-price",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "稻虾每周价格",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/estate/estate-industry",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "稻虾产业",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/estate/estate-flows",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "稻虾流向",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/estate/estate-materiels",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "大宗物资",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/index/warning-list",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "预警列表",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "white",
|
"navigationBarTextStyle": "white",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,572 @@
|
||||||
|
<template>
|
||||||
|
<view class="bg-page">
|
||||||
|
<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>
|
||||||
|
</u-navbar>
|
||||||
|
<view class="secreen-section">
|
||||||
|
<view class="search-box">
|
||||||
|
<view class="search-input-vh u-border" @click="screenShowFn()">
|
||||||
|
<view class="placeholder_text">筛选条件</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content-box u-padding-25">
|
||||||
|
<u-swipe-action class="tb_swipe_list"
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:show="item.show" :index="index" :key="item.id"
|
||||||
|
@click="click"
|
||||||
|
@open="open"
|
||||||
|
:options="options"
|
||||||
|
>
|
||||||
|
|
||||||
|
<view class="tb_body" @click="showInfo(index)">
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">年份:{{ item.year }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">季度:{{item.quarter|quartername}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">地区:{{ item.area }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">销量:{{ item.sales }}{{item.unit}}</view>
|
||||||
|
</view>
|
||||||
|
<!-- <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">
|
||||||
|
<view class="popup-form-ubox">
|
||||||
|
<view class="top_box">
|
||||||
|
<view class="title" v-if="setInfo.id">编辑价格</view>
|
||||||
|
<view class="title" v-else>新增价格</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<view class="form_edit" style="padding-left: 50rpx;">
|
||||||
|
<u-form>
|
||||||
|
<u-form-item label="ID" label-width="140" v-if="setInfo.id">
|
||||||
|
<view class="input_box bg_colorf8 pdlr12">
|
||||||
|
<u-input v-model="setInfo.id" :disabled="true" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="年份" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<view class="u-select-list" @click="selectFn1()">
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<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="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="地区" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.area" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<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'>
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||||
|
<view class="popup-form-info">
|
||||||
|
<view class="top_box u-border-bottom">
|
||||||
|
<view class="handle-btns">
|
||||||
|
<view class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||||
|
<view class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="section_c">
|
||||||
|
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">年份</view>
|
||||||
|
<view class="flex-1">{{formInfo.year}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">季度</view>
|
||||||
|
<view class="flex-1">{{formInfo.quarter|quartername}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">地区</view>
|
||||||
|
<view class="flex-1">{{formInfo.area}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">销量</view>
|
||||||
|
<view class="flex-1">{{ formInfo.sales }}{{formInfo.unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">创建人</view>
|
||||||
|
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">更新时间</view>
|
||||||
|
<view class="flex-1">{{ formInfo.updated_at|timeFormat}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 筛选查询条件 -->
|
||||||
|
<u-popup v-model="screenShow" mode="top" z-index="9">
|
||||||
|
<view class="popup-screen-groups">
|
||||||
|
<view class="status_bar_top"></view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
background: {
|
||||||
|
backgroundColor:'#2a7dc9',
|
||||||
|
},
|
||||||
|
titleColor:"#ffffff",
|
||||||
|
per_page:15,
|
||||||
|
page:1,
|
||||||
|
list:[],
|
||||||
|
loading:'loadmore',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
text: '编辑',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#007aff'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#dd524d'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
popupShow:false,
|
||||||
|
cindex:-1,//操作的索引
|
||||||
|
editShow:false,
|
||||||
|
formInfo:{},
|
||||||
|
timeParams: {
|
||||||
|
year: true,
|
||||||
|
month: false,
|
||||||
|
day: false,
|
||||||
|
hour: false,
|
||||||
|
minute: false,
|
||||||
|
second: false
|
||||||
|
},
|
||||||
|
screenShow:false,
|
||||||
|
isqueryselect:false,
|
||||||
|
setInfo:{
|
||||||
|
id:'',
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
area:'',
|
||||||
|
sales:'',
|
||||||
|
unit:''
|
||||||
|
},
|
||||||
|
editShow:false,
|
||||||
|
queryCond:{
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
},
|
||||||
|
selectShow1:false,
|
||||||
|
selectShow2:false,
|
||||||
|
selectValue1:'',
|
||||||
|
selectValue2:[0],
|
||||||
|
quarterlist:[
|
||||||
|
{
|
||||||
|
label:'第一季度',
|
||||||
|
value:1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第二季度',
|
||||||
|
value:2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第三季度',
|
||||||
|
value:3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第四季度',
|
||||||
|
value:4,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
filters:{
|
||||||
|
quartername(val){
|
||||||
|
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}
|
||||||
|
let name = keys[val]?keys[val]:val
|
||||||
|
return name;
|
||||||
|
},
|
||||||
|
timeFormat(val){
|
||||||
|
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
this.queryDataList();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
addBtn(){
|
||||||
|
this.setInfoKeys('add');
|
||||||
|
this.editShow = true;
|
||||||
|
},
|
||||||
|
selectFn1(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let year = this.setInfo.year;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
this.selectShow1 = true;
|
||||||
|
year = this.queryCond.year;
|
||||||
|
}
|
||||||
|
if(year){
|
||||||
|
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||||
|
}
|
||||||
|
console.log(this.selectValue1)
|
||||||
|
this.selectShow1 = true;
|
||||||
|
},
|
||||||
|
selectFn2(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let quarter = this.setInfo.quarter;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
quarter = this.queryCond.quarter;
|
||||||
|
}
|
||||||
|
for(let [index,item] of this.quarterlist.entries()){
|
||||||
|
if(quarter==item.value){
|
||||||
|
this.selectValue2 = [index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectShow2 = true;
|
||||||
|
},
|
||||||
|
resetQuery(){
|
||||||
|
this.queryCond = {
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryBtn(){
|
||||||
|
this.list = [];
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.screenShow = false;
|
||||||
|
},
|
||||||
|
uselectConfirm1(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.year = e.year;
|
||||||
|
}else{
|
||||||
|
this.setInfo.year = e.year;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uselectConfirm2(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.quarter = e[0].value;
|
||||||
|
this.queryCond.quarter_name = e[0].label;
|
||||||
|
}else{
|
||||||
|
this.setInfo.quarter = e[0].value;
|
||||||
|
this.setInfo.quarter_name = e[0].label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
screenShowFn(){
|
||||||
|
this.screenShow = true;
|
||||||
|
},
|
||||||
|
showInfo(index){
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.queryInfo(_id);
|
||||||
|
this.formInfo = this.list[index];
|
||||||
|
this.popupShow = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
open(index){
|
||||||
|
this.list[index].show = true;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryDataList(refresh){
|
||||||
|
if(refresh){
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.page = 1;
|
||||||
|
}
|
||||||
|
if(this.loading=='nomore'){//超出最大页
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
per_page:this.per_page,
|
||||||
|
page: this.page ++,
|
||||||
|
_t: new Date().getTime()
|
||||||
|
}
|
||||||
|
for(let k in this.queryCond){
|
||||||
|
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||||
|
params[k] = this.queryCond[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = 'loading';
|
||||||
|
this.$http.get('/api/rice-shrimp-flows',{params:params}).then(({data})=>{
|
||||||
|
console.log(data)
|
||||||
|
this.screenShow = false;
|
||||||
|
if(refresh){
|
||||||
|
this.list = [];
|
||||||
|
}
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
if(data.code==200){
|
||||||
|
let _list = data.data|| [];
|
||||||
|
for(let item of _list){
|
||||||
|
item.show = false;
|
||||||
|
}
|
||||||
|
this.list = this.list.concat(_list);
|
||||||
|
console.log(this.list);
|
||||||
|
if(this.list.length>= data.meta.total){
|
||||||
|
this.loading ='nomore';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.screenShow = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//修改
|
||||||
|
editInfoBtn(){
|
||||||
|
if(!this.valiFormRule()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {}
|
||||||
|
params = this.setInfo;
|
||||||
|
showLoading('请稍等...');
|
||||||
|
if(params['id']){
|
||||||
|
this.$http.put(`/api/rice-shrimp-flows/${params['id']}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
|
||||||
|
this.editShow = false;
|
||||||
|
this.queryDataList(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
delete params['id'];
|
||||||
|
this.$http.post(`/api/rice-shrimp-flows`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.editShow = false;
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}else{
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryInfo(id){
|
||||||
|
// this.$http.get(`/api/rice-shrimp-flows/${id}`).then(({data})=>{
|
||||||
|
// console.log(data,'queryInfo===')
|
||||||
|
// if(data.code==200){
|
||||||
|
// this.formInfo = data.data;
|
||||||
|
// this.setInfoKeys();
|
||||||
|
// }
|
||||||
|
// }).catch((err)=>{
|
||||||
|
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
editInfoId(id){
|
||||||
|
// this.queryInfo(id);
|
||||||
|
|
||||||
|
this.setInfoKeys();
|
||||||
|
this.editShow = true;
|
||||||
|
this.popupShow = false;
|
||||||
|
},
|
||||||
|
//删除deleteInfoId
|
||||||
|
deleteInfoId(id){
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确定删除?',
|
||||||
|
success: (res)=> {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等...');
|
||||||
|
this.$http.delete(`/api/rice-shrimp-flows/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.formInfo = {};//重置删除
|
||||||
|
this.popupShow = false;
|
||||||
|
this.list.splice(this.cindex,1);
|
||||||
|
// this.queryDataList(true);
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
setInfoKeys(type){
|
||||||
|
let info = {
|
||||||
|
id:'',
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
area:'',
|
||||||
|
sales:'',
|
||||||
|
unit:''
|
||||||
|
}
|
||||||
|
if(type=='add'){
|
||||||
|
this.setInfo = info;
|
||||||
|
}else{
|
||||||
|
let {id,year,quarter,area,sales,unit} = this.formInfo;
|
||||||
|
try{
|
||||||
|
for(let k in info){
|
||||||
|
info[k] = this.formInfo[k];
|
||||||
|
}
|
||||||
|
for(let item of this.quarterlist){
|
||||||
|
if(quarter == item.value){
|
||||||
|
info.quarter_name = item.label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setInfo = info;
|
||||||
|
|
||||||
|
}catch(e){
|
||||||
|
//TODO handle the exception
|
||||||
|
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
valiFormRule(){
|
||||||
|
let {id,year,quarter,area,sales,unit} = this.setInfo;
|
||||||
|
|
||||||
|
if(year==''){
|
||||||
|
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(quarter==''){
|
||||||
|
uni.showToast({ title: '季度不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(area==''){
|
||||||
|
uni.showToast({ title: '地区不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(sales==''){
|
||||||
|
uni.showToast({ title: '销量不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(unit==''){
|
||||||
|
uni.showToast({ title: '单位不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
goback(){
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//触底加载
|
||||||
|
onReachBottom() {
|
||||||
|
if(this.loading=='loadmore'){
|
||||||
|
this.queryDataList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,600 @@
|
||||||
|
<template>
|
||||||
|
<view class="bg-page">
|
||||||
|
<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>
|
||||||
|
</u-navbar>
|
||||||
|
<view class="secreen-section">
|
||||||
|
<view class="search-box">
|
||||||
|
<view class="search-input-vh u-border" @click="screenShowFn()">
|
||||||
|
<view class="placeholder_text">筛选条件</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content-box u-padding-25">
|
||||||
|
<u-swipe-action class="tb_swipe_list"
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:show="item.show" :index="index" :key="item.id"
|
||||||
|
@click="click"
|
||||||
|
@open="open"
|
||||||
|
:options="options"
|
||||||
|
>
|
||||||
|
|
||||||
|
<view class="tb_body" @click="showInfo(index)">
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">年份:{{ item.year }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">季度:{{item.quarter|quartername}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">面积:{{item.area}}{{item.area_unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">产量:{{ item.product_output}}{{ item.product_output_unit}}</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="70%"
|
||||||
|
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||||
|
<view class="popup-form-ubox">
|
||||||
|
<view class="top_box">
|
||||||
|
<view class="title" v-if="setInfo.id">编辑价格</view>
|
||||||
|
<view class="title" v-else>新增价格</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<view class="form_edit" style="padding-left: 50rpx;">
|
||||||
|
<u-form>
|
||||||
|
<u-form-item label="ID" label-width="140" v-if="setInfo.id">
|
||||||
|
<view class="input_box bg_colorf8 pdlr12">
|
||||||
|
<u-input v-model="setInfo.id" :disabled="true" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="年份" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<view class="u-select-list" @click="selectFn1()">
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<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="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="面积" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.area" type="number" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="产量" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.product_output" type="number" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="产值" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.product_value" type="number" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="面积单位" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.area_unit" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="产量单位" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.product_output_unit" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="产值单位" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.product_value_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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||||
|
<view class="popup-form-info">
|
||||||
|
<view class="top_box u-border-bottom">
|
||||||
|
<view class="handle-btns">
|
||||||
|
<view class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||||
|
<view class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="section_c">
|
||||||
|
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">年份</view>
|
||||||
|
<view class="flex-1">{{formInfo.year}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">季度</view>
|
||||||
|
<view class="flex-1">{{formInfo.quarter|quartername}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">面积</view>
|
||||||
|
<view class="flex-1">{{formInfo.area}}{{formInfo.area_unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">产量</view>
|
||||||
|
<view class="flex-1">{{formInfo.product_output}}{{formInfo.product_output_unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">产值</view>
|
||||||
|
<view class="flex-1">{{formInfo.product_value}}{{formInfo.product_value_unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">创建人</view>
|
||||||
|
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 筛选查询条件 -->
|
||||||
|
<u-popup v-model="screenShow" mode="top" z-index="9">
|
||||||
|
<view class="popup-screen-groups">
|
||||||
|
<view class="status_bar_top"></view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
background: {
|
||||||
|
backgroundColor:'#2a7dc9',
|
||||||
|
},
|
||||||
|
titleColor:"#ffffff",
|
||||||
|
per_page:15,
|
||||||
|
page:1,
|
||||||
|
list:[],
|
||||||
|
loading:'loadmore',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
text: '编辑',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#007aff'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#dd524d'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
popupShow:false,
|
||||||
|
cindex:-1,//操作的索引
|
||||||
|
editShow:false,
|
||||||
|
formInfo:{},
|
||||||
|
timeParams: {
|
||||||
|
year: true,
|
||||||
|
month: false,
|
||||||
|
day: false,
|
||||||
|
hour: false,
|
||||||
|
minute: false,
|
||||||
|
second: false
|
||||||
|
},
|
||||||
|
screenShow:false,
|
||||||
|
isqueryselect:false,
|
||||||
|
setInfo:{
|
||||||
|
id:'',
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
area:'',
|
||||||
|
area_unit:'',
|
||||||
|
product_output:'',
|
||||||
|
product_output_unit:'',
|
||||||
|
product_value:'',
|
||||||
|
product_value_unit:'',
|
||||||
|
},
|
||||||
|
editShow:false,
|
||||||
|
queryCond:{
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
},
|
||||||
|
selectShow1:false,
|
||||||
|
selectShow2:false,
|
||||||
|
selectValue1:'',
|
||||||
|
selectValue2:[0],
|
||||||
|
quarterlist:[
|
||||||
|
{
|
||||||
|
label:'第一季度',
|
||||||
|
value:1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第二季度',
|
||||||
|
value:2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第三季度',
|
||||||
|
value:3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第四季度',
|
||||||
|
value:4,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
filters:{
|
||||||
|
quartername(val){
|
||||||
|
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}
|
||||||
|
let name = keys[val]?keys[val]:val
|
||||||
|
return name;
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
this.queryDataList();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
addBtn(){
|
||||||
|
this.setInfoKeys('add');
|
||||||
|
this.editShow = true;
|
||||||
|
},
|
||||||
|
selectFn1(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let year = this.setInfo.year;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
this.selectShow1 = true;
|
||||||
|
year = this.queryCond.year;
|
||||||
|
}
|
||||||
|
if(year){
|
||||||
|
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||||
|
}
|
||||||
|
console.log(this.selectValue1)
|
||||||
|
this.selectShow1 = true;
|
||||||
|
},
|
||||||
|
selectFn2(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let quarter = this.setInfo.quarter;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
quarter = this.queryCond.quarter;
|
||||||
|
}
|
||||||
|
for(let [index,item] of this.quarterlist.entries()){
|
||||||
|
if(quarter==item.value){
|
||||||
|
this.selectValue2 = [index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectShow2 = true;
|
||||||
|
},
|
||||||
|
resetQuery(){
|
||||||
|
this.queryCond = {
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryBtn(){
|
||||||
|
this.list = [];
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.screenShow = false;
|
||||||
|
},
|
||||||
|
uselectConfirm1(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.year = e.year;
|
||||||
|
}else{
|
||||||
|
this.setInfo.year = e.year;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uselectConfirm2(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.quarter = e[0].value;
|
||||||
|
this.queryCond.quarter_name = e[0].label;
|
||||||
|
}else{
|
||||||
|
this.setInfo.quarter = e[0].value;
|
||||||
|
this.setInfo.quarter_name = e[0].label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
screenShowFn(){
|
||||||
|
this.screenShow = true;
|
||||||
|
},
|
||||||
|
showInfo(index){
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.queryInfo(_id);
|
||||||
|
this.formInfo = this.list[index];
|
||||||
|
this.popupShow = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
open(index){
|
||||||
|
this.list[index].show = true;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryDataList(refresh){
|
||||||
|
if(refresh){
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.page = 1;
|
||||||
|
}
|
||||||
|
if(this.loading=='nomore'){//超出最大页
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
per_page:this.per_page,
|
||||||
|
page: this.page ++,
|
||||||
|
_t: new Date().getTime()
|
||||||
|
}
|
||||||
|
for(let k in this.queryCond){
|
||||||
|
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||||
|
params[k] = this.queryCond[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = 'loading';
|
||||||
|
this.$http.get('/api/rice-shrimp-industries',{params:params}).then(({data})=>{
|
||||||
|
console.log(data)
|
||||||
|
this.screenShow = false;
|
||||||
|
if(refresh){
|
||||||
|
this.list = [];
|
||||||
|
}
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
if(data.code==200){
|
||||||
|
let _list = data.data|| [];
|
||||||
|
for(let item of _list){
|
||||||
|
item.show = false;
|
||||||
|
}
|
||||||
|
this.list = this.list.concat(_list);
|
||||||
|
console.log(this.list);
|
||||||
|
if(this.list.length>= data.meta.total){
|
||||||
|
this.loading ='nomore';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.screenShow = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//修改
|
||||||
|
editInfoBtn(){
|
||||||
|
if(!this.valiFormRule()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {}
|
||||||
|
params = this.setInfo;
|
||||||
|
showLoading('请稍等..');
|
||||||
|
if(params['id']){
|
||||||
|
this.$http.put(`/api/rice-shrimp-industries/${params['id']}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
|
||||||
|
this.editShow = false;
|
||||||
|
this.queryDataList(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
delete params['id'];
|
||||||
|
this.$http.post(`/api/rice-shrimp-industries`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.editShow = false;
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}else{
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryInfo(id){
|
||||||
|
// this.$http.get(`/api/rice-shrimp-industries/${id}`).then(({data})=>{
|
||||||
|
// console.log(data,'queryInfo===')
|
||||||
|
// if(data.code==200){
|
||||||
|
// this.formInfo = data.data;
|
||||||
|
// this.setInfoKeys();
|
||||||
|
// }
|
||||||
|
// }).catch((err)=>{
|
||||||
|
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
editInfoId(id){
|
||||||
|
// this.queryInfo(id);
|
||||||
|
|
||||||
|
this.setInfoKeys();
|
||||||
|
this.editShow = true;
|
||||||
|
this.popupShow = false;
|
||||||
|
},
|
||||||
|
//删除deleteInfoId
|
||||||
|
deleteInfoId(id){
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确定删除?',
|
||||||
|
success: (res)=> {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等..');
|
||||||
|
this.$http.delete(`/api/rice-shrimp-industries/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.formInfo = {};//重置删除
|
||||||
|
this.popupShow = false;
|
||||||
|
this.list.splice(this.cindex,1);
|
||||||
|
// this.queryDataList(true);
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
setInfoKeys(type){
|
||||||
|
let info = {
|
||||||
|
id:'',
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
area:'',
|
||||||
|
area_unit:'',
|
||||||
|
product_output:'',
|
||||||
|
product_output_unit:'',
|
||||||
|
product_value:'',
|
||||||
|
product_value_unit:'',
|
||||||
|
}
|
||||||
|
if(type=='add'){
|
||||||
|
this.setInfo = info;
|
||||||
|
}else{
|
||||||
|
let {id,quarter} = this.formInfo;
|
||||||
|
try{
|
||||||
|
for(let k in info){
|
||||||
|
info[k] = this.formInfo[k];
|
||||||
|
}
|
||||||
|
for(let item of this.quarterlist){
|
||||||
|
if(quarter == item.value){
|
||||||
|
info.quarter_name = item.label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setInfo = info;
|
||||||
|
|
||||||
|
}catch(e){
|
||||||
|
//TODO handle the exception
|
||||||
|
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
valiFormRule(){
|
||||||
|
let {id,year,quarter,area,product_output,area_unit,product_value,
|
||||||
|
product_output_unit,product_value_unit} = this.setInfo;
|
||||||
|
if(year==''){
|
||||||
|
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(quarter==''){
|
||||||
|
uni.showToast({ title: '季度不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(area==''){
|
||||||
|
uni.showToast({ title: '面积不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(product_output==''){
|
||||||
|
uni.showToast({ title: '产量不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(product_value==''){
|
||||||
|
uni.showToast({ title: '产值不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(area_unit==''){
|
||||||
|
uni.showToast({ title: '面积单位不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(product_output_unit==''){
|
||||||
|
uni.showToast({ title: '产量单位不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(product_value_unit==''){
|
||||||
|
uni.showToast({ title: '产值单位不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
goback(){
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//触底加载
|
||||||
|
onReachBottom() {
|
||||||
|
if(this.loading=='loadmore'){
|
||||||
|
this.queryDataList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,671 @@
|
||||||
|
<template>
|
||||||
|
<view class="bg-page">
|
||||||
|
<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>
|
||||||
|
</u-navbar>
|
||||||
|
<view class="secreen-section">
|
||||||
|
<view class="search-box">
|
||||||
|
<view class="search-input-vh u-border" @click="screenShowFn()">
|
||||||
|
<view class="placeholder_text">筛选条件</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content-box u-padding-25">
|
||||||
|
<u-swipe-action class="tb_swipe_list"
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:show="item.show" :index="index" :key="item.id"
|
||||||
|
@click="click"
|
||||||
|
@open="open"
|
||||||
|
:options="options"
|
||||||
|
>
|
||||||
|
|
||||||
|
<view class="tb_body" @click="showInfo(index)">
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">名称:{{ item.name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">年份:{{ item.year }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">季度:{{item.quarter|quartername}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">类型:
|
||||||
|
<u-tag text="饲料" v-if="item.type==1" type="success" size="mini"/>
|
||||||
|
<u-tag text="肥料" v-if="item.type==2" type="error" size="mini"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <view class="row_box">
|
||||||
|
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</u-swipe-action>
|
||||||
|
<u-loadmore :status="loading" margin-top="60"/>
|
||||||
|
</view>
|
||||||
|
<!-- 编辑 -->
|
||||||
|
<u-popup v-model="editShow" border-radius="28" width="92%" height="70%"
|
||||||
|
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||||
|
<view class="popup-form-ubox">
|
||||||
|
<view class="top_box">
|
||||||
|
<view class="title" v-if="setInfo.id">编辑价格</view>
|
||||||
|
<view class="title" v-else>新增价格</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<view class="form_edit" style="padding-left: 50rpx;">
|
||||||
|
<u-form>
|
||||||
|
<u-form-item label="ID" label-width="140" v-if="setInfo.id">
|
||||||
|
<view class="input_box bg_colorf8 pdlr12">
|
||||||
|
<u-input v-model="setInfo.id" :disabled="true" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="名称" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.name" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<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="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="季度" label-width="140" :required='true'>
|
||||||
|
<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="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="类型" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<view class="u-select-list" @click="selectFn3()">
|
||||||
|
<view class="value u-line-2"
|
||||||
|
v-if="setInfo.type">{{setInfo.type_name}}</view>
|
||||||
|
<view class="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="最低价" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.lowest_price" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="最高价" label-width="140" :required='true'>
|
||||||
|
<view class="input_box">
|
||||||
|
<u-input v-model="setInfo.highest_price" type="number"/>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||||
|
<view class="popup-form-info">
|
||||||
|
<view class="top_box u-border-bottom">
|
||||||
|
<view class="handle-btns">
|
||||||
|
<view class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||||
|
<view class="btn_edit" @click="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.name}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">年份</view>
|
||||||
|
<view class="flex-1">{{formInfo.year}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">季度</view>
|
||||||
|
<view class="flex-1">{{formInfo.quarter|quartername}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">类型</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<u-tag text="饲料" v-if="formInfo.type==1" type="success" size="mini"/>
|
||||||
|
<u-tag text="肥料" v-if="formInfo.type==2" type="error" size="mini"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">最低价</view>
|
||||||
|
<view class="flex-1">{{ formInfo.lowest_price }}{{formInfo.unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">最高价</view>
|
||||||
|
<view class="flex-1">{{ formInfo.highest_price }}{{formInfo.unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">创建人</view>
|
||||||
|
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">更新时间</view>
|
||||||
|
<view class="flex-1">{{ formInfo.updated_at|timeFormat}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 筛选查询条件 -->
|
||||||
|
<u-popup v-model="screenShow" mode="top" z-index="9">
|
||||||
|
<view class="popup-screen-groups">
|
||||||
|
<view class="status_bar_top"></view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
<view class="row_list u-flex">
|
||||||
|
<view class="label_tit small">类型</view>
|
||||||
|
<yn-select-input-list :value="queryCond.type_name" placeholder="请选择类型"
|
||||||
|
@click="selectFn3('q')"></yn-select-input-list>
|
||||||
|
</view>
|
||||||
|
<view class="row_list u-flex">
|
||||||
|
<view class="label_tit small">名称</view>
|
||||||
|
<u-input v-model="queryCond.name" border/>
|
||||||
|
</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>
|
||||||
|
</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-select v-model="selectShow3" :list="typelist"
|
||||||
|
:default-value="selectValue3" mode="single-column"
|
||||||
|
@confirm="uselectConfirm3"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
background: {
|
||||||
|
backgroundColor:'#2a7dc9',
|
||||||
|
},
|
||||||
|
titleColor:"#ffffff",
|
||||||
|
per_page:15,
|
||||||
|
page:1,
|
||||||
|
list:[],
|
||||||
|
loading:'loadmore',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
text: '编辑',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#007aff'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#dd524d'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
popupShow:false,
|
||||||
|
cindex:-1,//操作的索引
|
||||||
|
editShow:false,
|
||||||
|
formInfo:{},
|
||||||
|
timeParams: {
|
||||||
|
year: true,
|
||||||
|
month: false,
|
||||||
|
day: false,
|
||||||
|
hour: false,
|
||||||
|
minute: false,
|
||||||
|
second: false
|
||||||
|
},
|
||||||
|
screenShow:false,
|
||||||
|
isqueryselect:false,
|
||||||
|
setInfo:{
|
||||||
|
id:'',
|
||||||
|
name:'',
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
type:'',
|
||||||
|
type_name:'',
|
||||||
|
lowest_price:'',
|
||||||
|
highest_price:'',
|
||||||
|
unit:''
|
||||||
|
},
|
||||||
|
editShow:false,
|
||||||
|
queryCond:{
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
name:''
|
||||||
|
},
|
||||||
|
selectShow1:false,
|
||||||
|
selectShow2:false,
|
||||||
|
selectShow3:false,
|
||||||
|
selectValue1:'',
|
||||||
|
selectValue2:[0],
|
||||||
|
selectValue3:[0],
|
||||||
|
quarterlist:[
|
||||||
|
{
|
||||||
|
label:'第一季度',
|
||||||
|
value:1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第二季度',
|
||||||
|
value:2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第三季度',
|
||||||
|
value:3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'第四季度',
|
||||||
|
value:4,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
typelist:[
|
||||||
|
{
|
||||||
|
label:'饲料',
|
||||||
|
value:1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'肥料',
|
||||||
|
value:2,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
filters:{
|
||||||
|
quartername(val){
|
||||||
|
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}
|
||||||
|
let name = keys[val]?keys[val]:val
|
||||||
|
return name;
|
||||||
|
},
|
||||||
|
timeFormat(val){
|
||||||
|
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
this.queryDataList();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
addBtn(){
|
||||||
|
this.setInfoKeys('add');
|
||||||
|
this.editShow = true;
|
||||||
|
},
|
||||||
|
selectFn1(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let year = this.setInfo.year;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
this.selectShow1 = true;
|
||||||
|
year = this.queryCond.year;
|
||||||
|
}
|
||||||
|
if(year){
|
||||||
|
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||||
|
}
|
||||||
|
console.log(this.selectValue1)
|
||||||
|
this.selectShow1 = true;
|
||||||
|
},
|
||||||
|
selectFn2(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let quarter = this.setInfo.quarter;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
quarter = this.queryCond.quarter;
|
||||||
|
}
|
||||||
|
for(let [index,item] of this.quarterlist.entries()){
|
||||||
|
if(quarter==item.value){
|
||||||
|
this.selectValue2 = [index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectShow2 = true;
|
||||||
|
},
|
||||||
|
selectFn3(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let qtype = this.setInfo.type;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
qtype = this.queryCond.type;
|
||||||
|
}
|
||||||
|
for(let [index,item] of this.typelist.entries()){
|
||||||
|
if(qtype==item.value){
|
||||||
|
this.selectValue3 = [index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectShow3 = true;
|
||||||
|
},
|
||||||
|
resetQuery(){
|
||||||
|
this.queryCond = {
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryBtn(){
|
||||||
|
this.list = [];
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.screenShow = false;
|
||||||
|
},
|
||||||
|
uselectConfirm1(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.year = e.year;
|
||||||
|
}else{
|
||||||
|
this.setInfo.year = e.year;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uselectConfirm2(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.quarter = e[0].value;
|
||||||
|
this.queryCond.quarter_name = e[0].label;
|
||||||
|
}else{
|
||||||
|
this.setInfo.quarter = e[0].value;
|
||||||
|
this.setInfo.quarter_name = e[0].label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uselectConfirm3(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.type = e[0].value;
|
||||||
|
this.queryCond.type_name = e[0].label;
|
||||||
|
}else{
|
||||||
|
this.setInfo.type = e[0].value;
|
||||||
|
this.setInfo.type_name = e[0].label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
screenShowFn(){
|
||||||
|
this.screenShow = true;
|
||||||
|
},
|
||||||
|
showInfo(index){
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.queryInfo(_id);
|
||||||
|
this.formInfo = this.list[index];
|
||||||
|
this.popupShow = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
open(index){
|
||||||
|
this.list[index].show = true;
|
||||||
|
},
|
||||||
|
click(index, index1) {
|
||||||
|
console.log(index,index1,this.list[index])
|
||||||
|
if(index1 == 1) {
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.deleteInfoId(_id);
|
||||||
|
} else {//编辑
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.formInfo = this.list[index];
|
||||||
|
this.queryInfo(_id);
|
||||||
|
this.setInfoKeys();
|
||||||
|
this.editShow = true;
|
||||||
|
this.list[index].show = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryDataList(refresh){
|
||||||
|
if(refresh){
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.page = 1;
|
||||||
|
}
|
||||||
|
if(this.loading=='nomore'){//超出最大页
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
per_page:this.per_page,
|
||||||
|
page: this.page ++,
|
||||||
|
_t: new Date().getTime()
|
||||||
|
}
|
||||||
|
for(let k in this.queryCond){
|
||||||
|
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||||
|
params[k] = this.queryCond[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = 'loading';
|
||||||
|
this.$http.get('/api/materiels',{params:params}).then(({data})=>{
|
||||||
|
console.log(data)
|
||||||
|
this.screenShow = false;
|
||||||
|
if(refresh){
|
||||||
|
this.list = [];
|
||||||
|
}
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
if(data.code==200){
|
||||||
|
let _list = data.data|| [];
|
||||||
|
for(let item of _list){
|
||||||
|
item.show = false;
|
||||||
|
}
|
||||||
|
this.list = this.list.concat(_list);
|
||||||
|
console.log(this.list);
|
||||||
|
if(this.list.length>= data.meta.total){
|
||||||
|
this.loading ='nomore';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.screenShow = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//修改
|
||||||
|
editInfoBtn(){
|
||||||
|
if(!this.valiFormRule()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {}
|
||||||
|
params = this.setInfo;
|
||||||
|
showLoading('请稍等..');
|
||||||
|
if(params['id']){
|
||||||
|
this.$http.put(`/api/materiels/${params['id']}`,params).then(({data})=>{
|
||||||
|
hideLoading()
|
||||||
|
if(data.code==200){
|
||||||
|
|
||||||
|
this.editShow = false;
|
||||||
|
this.queryDataList(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
delete params['id'];
|
||||||
|
this.$http.post(`/api/materiels`,params).then(({data})=>{
|
||||||
|
hideLoading()
|
||||||
|
if(data.code==200){
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.editShow = false;
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}else{
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryInfo(id){
|
||||||
|
// this.$http.get(`/api/materiels/${id}`).then(({data})=>{
|
||||||
|
// console.log(data,'queryInfo===')
|
||||||
|
// if(data.code==200){
|
||||||
|
// this.formInfo = data.data;
|
||||||
|
// this.setInfoKeys();
|
||||||
|
// }
|
||||||
|
// }).catch((err)=>{
|
||||||
|
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
editInfoId(id){
|
||||||
|
// this.queryInfo(id);
|
||||||
|
|
||||||
|
this.setInfoKeys();
|
||||||
|
this.editShow = true;
|
||||||
|
this.popupShow = false;
|
||||||
|
},
|
||||||
|
//删除deleteInfoId
|
||||||
|
deleteInfoId(id){
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确定删除?',
|
||||||
|
success: (res)=> {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等..');
|
||||||
|
this.$http.delete(`/api/materiels/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.formInfo = {};//重置删除
|
||||||
|
this.popupShow = false;
|
||||||
|
this.list.splice(this.cindex,1);
|
||||||
|
// this.queryDataList(true);
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
setInfoKeys(_type){
|
||||||
|
let info = {
|
||||||
|
id:'',
|
||||||
|
name:'',
|
||||||
|
year:'',
|
||||||
|
quarter:'',
|
||||||
|
quarter_name:'',
|
||||||
|
type:'',
|
||||||
|
type_name:'',
|
||||||
|
lowest_price:'',
|
||||||
|
highest_price:'',
|
||||||
|
unit:''
|
||||||
|
}
|
||||||
|
if(_type=='add'){
|
||||||
|
this.setInfo = info;
|
||||||
|
}else{
|
||||||
|
let {quarter,type} = this.formInfo;
|
||||||
|
try{
|
||||||
|
for(let k in info){
|
||||||
|
info[k] = this.formInfo[k];
|
||||||
|
}
|
||||||
|
for(let item of this.quarterlist){
|
||||||
|
if(quarter == item.value){
|
||||||
|
info.quarter_name = item.label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(let item of this.typelist){
|
||||||
|
if(type == item.value){
|
||||||
|
info.type_name = item.label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setInfo = info;
|
||||||
|
}catch(e){
|
||||||
|
//TODO handle the exception
|
||||||
|
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
valiFormRule(){
|
||||||
|
let {id,name,year,quarter,type,lowest_price,highest_price,unit} = this.setInfo;
|
||||||
|
if(name==''){
|
||||||
|
uni.showToast({ title: '名称不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(year==''){
|
||||||
|
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(quarter==''){
|
||||||
|
uni.showToast({ title: '季度不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(type==''){
|
||||||
|
uni.showToast({ title: '类型不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(lowest_price==''){
|
||||||
|
uni.showToast({ title: '最低价不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(highest_price==''){
|
||||||
|
uni.showToast({ title: '最高价不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(unit==''){
|
||||||
|
uni.showToast({ title: '单位不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
goback(){
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//触底加载
|
||||||
|
onReachBottom() {
|
||||||
|
if(this.loading=='loadmore'){
|
||||||
|
this.queryDataList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -33,9 +33,9 @@
|
||||||
<view class="row_box">
|
<view class="row_box">
|
||||||
<view class="text">价格:{{ item.price }}</view>
|
<view class="text">价格:{{ item.price }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="row_box">
|
<!-- <view class="row_box">
|
||||||
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</u-swipe-action>
|
</u-swipe-action>
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
</u-form-item>
|
</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="input_box">
|
||||||
<u-input v-model="setInfo.price" />
|
<u-input v-model="setInfo.price" type="number" />
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {formatDate,navigateBack} from '@/com/utils.js'
|
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
backgroundColor:'#2a7dc9',
|
backgroundColor:'#2a7dc9',
|
||||||
},
|
},
|
||||||
titleColor:"#ffffff",
|
titleColor:"#ffffff",
|
||||||
per_page:10,
|
per_page:15,
|
||||||
page:1,
|
page:1,
|
||||||
list:[],
|
list:[],
|
||||||
loading:'loadmore',
|
loading:'loadmore',
|
||||||
|
|
@ -390,11 +390,15 @@
|
||||||
},
|
},
|
||||||
//修改
|
//修改
|
||||||
editInfoBtn(){
|
editInfoBtn(){
|
||||||
let {id,} = this.setInfo;
|
if(!this.valiFormRule()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let params = {}
|
let params = {}
|
||||||
params = this.setInfo;
|
params = this.setInfo;
|
||||||
|
showLoading('请稍等');
|
||||||
if(params['id']){
|
if(params['id']){
|
||||||
this.$http.put(`/api/rice-shrimp-prices/${id}`,params).then(({data})=>{
|
this.$http.put(`/api/rice-shrimp-prices/${params['id']}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
|
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
|
|
@ -403,11 +407,12 @@
|
||||||
}
|
}
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
delete params['id'];
|
delete params['id'];
|
||||||
this.$http.post(`/api/rice-shrimp-prices`,params).then(({data})=>{
|
this.$http.post(`/api/rice-shrimp-prices`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.queryDataList(true);
|
this.queryDataList(true);
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
|
|
@ -416,7 +421,7 @@
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -447,7 +452,9 @@
|
||||||
success: (res)=> {
|
success: (res)=> {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
console.log('用户点击确定');
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等');
|
||||||
this.$http.delete(`/api/rice-shrimp-prices/${id}`).then(({data})=>{
|
this.$http.delete(`/api/rice-shrimp-prices/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.formInfo = {};//重置删除
|
this.formInfo = {};//重置删除
|
||||||
this.popupShow = false;
|
this.popupShow = false;
|
||||||
|
|
@ -456,7 +463,7 @@
|
||||||
}
|
}
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消');
|
console.log('用户点击取消');
|
||||||
|
|
@ -496,6 +503,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
valiFormRule(){
|
||||||
|
let {id,year,quarter,price} = this.setInfo;
|
||||||
|
if(year==''){
|
||||||
|
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(quarter==''){
|
||||||
|
uni.showToast({ title: '季度不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(price==''){
|
||||||
|
uni.showToast({ title: '价格不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
goback(){
|
goback(){
|
||||||
navigateBack()
|
navigateBack()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,531 @@
|
||||||
|
<template>
|
||||||
|
<view class="bg-page">
|
||||||
|
<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>
|
||||||
|
</u-navbar>
|
||||||
|
<view class="secreen-section">
|
||||||
|
<view class="search-box">
|
||||||
|
<view class="search-input-vh u-border" @click="screenShowFn()">
|
||||||
|
<view class="placeholder_text">筛选条件</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content-box u-padding-25">
|
||||||
|
<u-swipe-action class="tb_swipe_list"
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:show="item.show" :index="index" :key="item.id"
|
||||||
|
@click="click"
|
||||||
|
@open="open"
|
||||||
|
:options="options"
|
||||||
|
>
|
||||||
|
|
||||||
|
<view class="tb_body" @click="showInfo(index)">
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">年份:{{ item.year }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">周:{{item.week_label}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">价格:{{ item.price }}</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="row_box">
|
||||||
|
<view class="text">创建人:{{ item.created_by?item.created_by.name:'-' }}</view>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</u-swipe-action>
|
||||||
|
<u-loadmore :status="loading" margin-top="60"/>
|
||||||
|
</view>
|
||||||
|
<!-- 编辑 -->
|
||||||
|
<u-popup v-model="editShow" border-radius="28" width="92%" height="700rpx"
|
||||||
|
mode="center" :closeable="true" :mask-close-able="false" z-index="910">
|
||||||
|
<view class="popup-form-ubox">
|
||||||
|
<view class="top_box">
|
||||||
|
<view class="title" v-if="setInfo.id">编辑价格</view>
|
||||||
|
<view class="title" v-else>新增价格</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<view class="form_edit" style="padding-left: 50rpx;">
|
||||||
|
<u-form >
|
||||||
|
<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'>
|
||||||
|
<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="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="周" label-width="140"
|
||||||
|
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="placeholder" v-else>请选择</view>
|
||||||
|
<view class="right">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="价格" label-width="140"
|
||||||
|
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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||||
|
<view class="popup-form-info">
|
||||||
|
<view class="top_box u-border-bottom">
|
||||||
|
<view class="handle-btns">
|
||||||
|
<view class="btn_del" @click="deleteInfoId(formInfo.id)">删除</view>
|
||||||
|
<view class="btn_edit" @click="editInfoId(formInfo.id)">编辑</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="section_c">
|
||||||
|
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">年份</view>
|
||||||
|
<view class="flex-1">{{formInfo.year}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">周</view>
|
||||||
|
<view class="flex-1">{{formInfo.week_label}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">价格</view>
|
||||||
|
<view class="flex-1">{{formInfo.price}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">创建人</view>
|
||||||
|
<view class="flex-1">{{ formInfo.created_by?formInfo.created_by.name:'-' }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 筛选查询条件 -->
|
||||||
|
<u-popup v-model="screenShow" mode="top" z-index="9">
|
||||||
|
<view class="popup-screen-groups">
|
||||||
|
<view class="status_bar_top"></view>
|
||||||
|
<scroll-view class="scroll-y" scroll-y="true">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
background: {
|
||||||
|
backgroundColor:'#2a7dc9',
|
||||||
|
},
|
||||||
|
titleColor:"#ffffff",
|
||||||
|
per_page:15,
|
||||||
|
page:1,
|
||||||
|
list:[],
|
||||||
|
loading:'loadmore',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
text: '编辑',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#007aff'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#dd524d'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
popupShow:false,
|
||||||
|
cindex:-1,//操作的索引
|
||||||
|
editShow:false,
|
||||||
|
formInfo:{},
|
||||||
|
timeParams: {
|
||||||
|
year: true,
|
||||||
|
month: false,
|
||||||
|
day: false,
|
||||||
|
hour: false,
|
||||||
|
minute: false,
|
||||||
|
second: false
|
||||||
|
},
|
||||||
|
screenShow:false,
|
||||||
|
isqueryselect:false,
|
||||||
|
setInfo:{
|
||||||
|
id:'',
|
||||||
|
year:'',
|
||||||
|
week:'',
|
||||||
|
week_name:'',
|
||||||
|
price:''
|
||||||
|
},
|
||||||
|
editShow:false,
|
||||||
|
queryCond:{
|
||||||
|
year:'',
|
||||||
|
week:'',
|
||||||
|
week_name:'',
|
||||||
|
},
|
||||||
|
selectShow1:false,
|
||||||
|
selectShow2:false,
|
||||||
|
selectValue1:'',
|
||||||
|
selectValue2:[0],
|
||||||
|
weeksperyearlist:[],
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
this.queryDataList();
|
||||||
|
this.getweeksperyear();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
addBtn(){
|
||||||
|
this.setInfoKeys('add');
|
||||||
|
this.editShow = true;
|
||||||
|
},
|
||||||
|
selectFn1(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let year = this.setInfo.year;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
this.selectShow1 = true;
|
||||||
|
year = this.queryCond.year;
|
||||||
|
}
|
||||||
|
if(year){
|
||||||
|
this.selectValue1 = `${year}-01-01 00:00:01`;
|
||||||
|
}
|
||||||
|
console.log(this.selectValue1)
|
||||||
|
this.selectShow1 = true;
|
||||||
|
},
|
||||||
|
selectFn2(type){
|
||||||
|
this.isqueryselect = false;
|
||||||
|
let week = this.setInfo.week;
|
||||||
|
if(type=='q'){
|
||||||
|
this.isqueryselect = true;
|
||||||
|
week = this.queryCond.week;
|
||||||
|
}
|
||||||
|
for(let [index,item] of this.weeksperyearlist.entries()){
|
||||||
|
if(week==item.value){
|
||||||
|
this.selectValue2 = [index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectShow2 = true;
|
||||||
|
},
|
||||||
|
resetQuery(){
|
||||||
|
this.queryCond = {
|
||||||
|
year:'',
|
||||||
|
week:'',
|
||||||
|
week_name:'',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryBtn(){
|
||||||
|
this.list = [];
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.screenShow = false;
|
||||||
|
},
|
||||||
|
uselectConfirm1(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.year = e.year;
|
||||||
|
}else{
|
||||||
|
this.setInfo.year = e.year;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uselectConfirm2(e){
|
||||||
|
if(this.isqueryselect){
|
||||||
|
console.log(e);
|
||||||
|
this.queryCond.week = e[0].value;
|
||||||
|
this.queryCond.week_name = e[0].label;
|
||||||
|
}else{
|
||||||
|
this.setInfo.week = e[0].value;
|
||||||
|
this.setInfo.week_name = e[0].label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
screenShowFn(){
|
||||||
|
this.screenShow = true;
|
||||||
|
},
|
||||||
|
showInfo(index){
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.queryInfo(_id);
|
||||||
|
this.formInfo = this.list[index];
|
||||||
|
this.popupShow = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
open(index){
|
||||||
|
this.list[index].show = true;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryDataList(refresh){
|
||||||
|
if(refresh){
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.page = 1;
|
||||||
|
}
|
||||||
|
if(this.loading=='nomore'){//超出最大页
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
per_page:this.per_page,
|
||||||
|
page: this.page ++,
|
||||||
|
_t: new Date().getTime()
|
||||||
|
}
|
||||||
|
for(let k in this.queryCond){
|
||||||
|
if(this.queryCond[k]||this.queryCond[k]=='0'){
|
||||||
|
params[k] = this.queryCond[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = 'loading';
|
||||||
|
this.$http.get('/api/rice-shrimp-weekly-prices',{params:params}).then(({data})=>{
|
||||||
|
console.log(data)
|
||||||
|
this.screenShow = false;
|
||||||
|
if(refresh){
|
||||||
|
this.list = [];
|
||||||
|
}
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
if(data.code==200){
|
||||||
|
let _list = data.data|| [];
|
||||||
|
for(let item of _list){
|
||||||
|
item.show = false;
|
||||||
|
}
|
||||||
|
this.list = this.list.concat(_list);
|
||||||
|
console.log(this.list);
|
||||||
|
if(this.list.length>= data.meta.total){
|
||||||
|
this.loading ='nomore';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.screenShow = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//修改
|
||||||
|
editInfoBtn(){
|
||||||
|
if(!this.valiFormRule()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {}
|
||||||
|
params = this.setInfo;
|
||||||
|
showLoading('请稍等');
|
||||||
|
if(params['id']){
|
||||||
|
this.$http.put(`/api/rice-shrimp-weekly-prices/${params['id']}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
|
||||||
|
this.editShow = false;
|
||||||
|
this.queryDataList(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
delete params['id'];
|
||||||
|
this.$http.post(`/api/rice-shrimp-weekly-prices`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.queryDataList(true);
|
||||||
|
this.editShow = false;
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}else{
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
queryInfo(id){
|
||||||
|
// this.$http.get(`/api/rice-shrimp-weekly-prices/${id}`).then(({data})=>{
|
||||||
|
// console.log(data,'queryInfo===')
|
||||||
|
// if(data.code==200){
|
||||||
|
// this.formInfo = data.data;
|
||||||
|
// this.setInfoKeys();
|
||||||
|
// }
|
||||||
|
// }).catch((err)=>{
|
||||||
|
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
editInfoId(id){
|
||||||
|
// this.queryInfo(id);
|
||||||
|
|
||||||
|
this.setInfoKeys();
|
||||||
|
this.editShow = true;
|
||||||
|
this.popupShow = false;
|
||||||
|
},
|
||||||
|
getweeksperyear(){
|
||||||
|
this.$http.get(`/api/weeks-per-year`).then(({data})=>{
|
||||||
|
if(data.code==200){
|
||||||
|
let list = data.data;
|
||||||
|
let weeks = [];
|
||||||
|
for(let item of list){
|
||||||
|
weeks.push({label:item.name,value:item.id})
|
||||||
|
}
|
||||||
|
this.weeksperyearlist = weeks;
|
||||||
|
}
|
||||||
|
}).catch((err)=>{
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//删除deleteInfoId
|
||||||
|
deleteInfoId(id){
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确定删除?',
|
||||||
|
success: (res)=> {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等');
|
||||||
|
this.$http.delete(`/api/rice-shrimp-weekly-prices/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.formInfo = {};//重置删除
|
||||||
|
this.popupShow = false;
|
||||||
|
this.list.splice(this.cindex,1);
|
||||||
|
// this.queryDataList(true);
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
setInfoKeys(type){
|
||||||
|
let info = {
|
||||||
|
id:'',
|
||||||
|
year:'',
|
||||||
|
week:'',
|
||||||
|
week_name:'',
|
||||||
|
price:''
|
||||||
|
}
|
||||||
|
if(type=='add'){
|
||||||
|
this.setInfo = info;
|
||||||
|
}else{
|
||||||
|
let {id,year,week,price} = this.formInfo;
|
||||||
|
try{
|
||||||
|
for(let item of this.weeksperyearlist){
|
||||||
|
if(week == item.value){
|
||||||
|
info.week_name = item.label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info['id'] = id;
|
||||||
|
info['year'] = year;
|
||||||
|
info['week'] = week;
|
||||||
|
info['price'] = price;
|
||||||
|
this.setInfo = info;
|
||||||
|
|
||||||
|
}catch(e){
|
||||||
|
//TODO handle the exception
|
||||||
|
uni.showToast({ title: '数据错误', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
valiFormRule(){
|
||||||
|
let {id,year,week,price} = this.setInfo;
|
||||||
|
if(year==''){
|
||||||
|
uni.showToast({ title: '年份不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(week==''){
|
||||||
|
uni.showToast({ title: '周不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(price==''){
|
||||||
|
uni.showToast({ title: '价格不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
goback(){
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//触底加载
|
||||||
|
onReachBottom() {
|
||||||
|
if(this.loading=='loadmore'){
|
||||||
|
this.queryDataList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="content-box">
|
<view class="content-box">
|
||||||
<view class="menus-section" v-for="(menu,index) in menuList" :key="index">
|
<view class="menus-section" v-for="(menu,index) in menuList" :key="index">
|
||||||
<view class="title-t">{{menu.label}}</view>
|
<view class="title-t" v-if="menu.parent">{{menu.parent}}-{{menu.label}}</view>
|
||||||
|
<view class="title-t" v-else>{{menu.label}}</view>
|
||||||
<view class="menu-ul">
|
<view class="menu-ul">
|
||||||
<view class="menu-li" v-for="(cdm,i) in menu.children" :key="i">
|
<view class="menu-li" v-for="(cdm,i) in menu.children" :key="i">
|
||||||
<view class="menu_item" @click="linknavFn(cdm)">
|
<view class="menu_item" @click="linknavFn(cdm)">
|
||||||
|
|
@ -51,8 +52,20 @@
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// label:'基础数据管理',
|
||||||
|
// children:[
|
||||||
|
// {
|
||||||
|
// label:'城镇数据',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label:'基地数据',
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
label:'基础数据管理',
|
label:'全市基础数据',
|
||||||
|
parent:'基础数据管理',
|
||||||
children:[
|
children:[
|
||||||
{
|
{
|
||||||
label:'城镇数据',
|
label:'城镇数据',
|
||||||
|
|
@ -60,35 +73,57 @@
|
||||||
{
|
{
|
||||||
label:'基地数据',
|
label:'基地数据',
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'农作物数据',
|
||||||
|
parent:'基础数据管理',
|
||||||
|
children:[
|
||||||
{
|
{
|
||||||
label:'城镇农作物',
|
label:'城镇农作物',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'基地农作物',
|
label:'基地农作物',
|
||||||
|
}
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label:'农作物产量',
|
||||||
|
parent:'基础数据管理',
|
||||||
|
children:[
|
||||||
{
|
{
|
||||||
label:'城镇产量',
|
label:'城镇产量',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'基地产量',
|
label:'基地产量',
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'重点产业',
|
||||||
|
parent:'基础数据管理',
|
||||||
|
children:[
|
||||||
{
|
{
|
||||||
label:'稻虾价格',
|
label:'稻虾价格',
|
||||||
url:'/pages/estate/estate-price'
|
url:'/pages/estate/estate-price'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'稻虾每周价格',
|
label:'稻虾每周价格',
|
||||||
|
url:'/pages/estate/estate-week-price'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'稻虾产业',
|
label:'稻虾产业',
|
||||||
|
url:'/pages/estate/estate-industry'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'稻虾流向',
|
label:'稻虾流向',
|
||||||
|
url:'/pages/estate/estate-flows'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'大宗物资',
|
label:'大宗物资',
|
||||||
|
url:'/pages/estate/estate-materiels'
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'设备管理',
|
label:'设备管理',
|
||||||
|
|
@ -132,6 +167,7 @@
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
.content-box{
|
.content-box{
|
||||||
padding-top: 30rpx;
|
padding-top: 30rpx;
|
||||||
|
padding-bottom: 150rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.menus-section{
|
.menus-section{
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
<view class="cart_box">
|
<view class="cart_box">
|
||||||
<qiun-data-charts
|
<qiun-data-charts
|
||||||
type="area"
|
type="area"
|
||||||
:opts="opts"
|
:opts="optsc"
|
||||||
:chartData="chart_air_temperature"
|
:chartData="chart_air_temperature"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -187,6 +187,7 @@
|
||||||
components: { QiunDataCharts },
|
components: { QiunDataCharts },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
optsc:{},
|
||||||
opts: {
|
opts: {
|
||||||
dataLabel:false,//显示数据
|
dataLabel:false,//显示数据
|
||||||
padding:[10,40,25,25],
|
padding:[10,40,25,25],
|
||||||
|
|
@ -197,6 +198,11 @@
|
||||||
yAxis: {
|
yAxis: {
|
||||||
gridType: "dash",
|
gridType: "dash",
|
||||||
dashLength: 5,
|
dashLength: 5,
|
||||||
|
data:[
|
||||||
|
{
|
||||||
|
min:0
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
extra: {
|
extra: {
|
||||||
area: {
|
area: {
|
||||||
|
|
@ -207,6 +213,7 @@
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
opts2: {
|
opts2: {
|
||||||
dataLabel:false,//显示数据
|
dataLabel:false,//显示数据
|
||||||
padding:[10,40,25,25],
|
padding:[10,40,25,25],
|
||||||
|
|
@ -310,6 +317,7 @@
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
this.queryDeviceBasics();
|
this.queryDeviceBasics();
|
||||||
|
this.optsc = JSON.parse(JSON.stringify(this.opts));
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
|
|
||||||
|
|
@ -324,13 +332,13 @@
|
||||||
})
|
})
|
||||||
console.log(narray);
|
console.log(narray);
|
||||||
this.addressName = narray[0].name;
|
this.addressName = narray[0].name;
|
||||||
this.$refs.uDropdown.highlight(0);
|
this.$refs.uDropdown.highlight();
|
||||||
this.queryAddressDevicePoints(val);
|
this.queryAddressDevicePoints(val);
|
||||||
},
|
},
|
||||||
|
|
||||||
//地区下设备id
|
//地区下设备id
|
||||||
change2(val){
|
change2(val){
|
||||||
this.$refs.uDropdown.highlight(1);
|
this.$refs.uDropdown.highlight();
|
||||||
this.queryMonitoringData();
|
this.queryMonitoringData();
|
||||||
},
|
},
|
||||||
//日期范围
|
//日期范围
|
||||||
|
|
@ -400,7 +408,6 @@
|
||||||
this.deviceAddressList = _data;
|
this.deviceAddressList = _data;
|
||||||
this.addressValue = _data[0].id;
|
this.addressValue = _data[0].id;
|
||||||
this.addressName = _data[0].name;
|
this.addressName = _data[0].name;
|
||||||
this.$refs.uDropdown.highlight(0);
|
|
||||||
this.queryAddressDevicePoints(this.addressValue);
|
this.queryAddressDevicePoints(this.addressValue);
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
|
@ -446,12 +453,8 @@
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
let info = data.data;
|
let info = data.data;
|
||||||
let chartInfo = {};
|
let chartInfo = {};
|
||||||
if(params.start_time!=params.end_time){//不是当天
|
|
||||||
this.opts.xAxis.labelCount = 3;
|
|
||||||
this.opts2.xAxis.labelCount = 3;
|
|
||||||
this.opts3.xAxis.labelCount = 3;
|
|
||||||
this.opts4.xAxis.labelCount = 3;
|
|
||||||
}
|
|
||||||
for(let fk in info){
|
for(let fk in info){
|
||||||
let _item = {
|
let _item = {
|
||||||
categories: [],
|
categories: [],
|
||||||
|
|
@ -472,6 +475,26 @@
|
||||||
chartInfo[fk] = _item;
|
chartInfo[fk] = _item;
|
||||||
}
|
}
|
||||||
console.log(chartInfo,'chartDatas--')
|
console.log(chartInfo,'chartDatas--')
|
||||||
|
let labcount = 5;
|
||||||
|
if(params.start_time!=params.end_time){//不是当天
|
||||||
|
labcount = 3;
|
||||||
|
}else{
|
||||||
|
let len = chartInfo.air_temperature.categories.length-1;
|
||||||
|
labcount = 5;
|
||||||
|
let aw = len>10?len%6:len%5;
|
||||||
|
if(aw==3||aw==0||aw==1){
|
||||||
|
labcount = 4;
|
||||||
|
}else if(aw==2){
|
||||||
|
labcount = 3;
|
||||||
|
}else{
|
||||||
|
labcount=5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.optsc.xAxis.labelCount = labcount;
|
||||||
|
this.opts.xAxis.labelCount = labcount;
|
||||||
|
this.opts2.xAxis.labelCount = labcount;
|
||||||
|
this.opts3.xAxis.labelCount = labcount;
|
||||||
|
this.opts4.xAxis.labelCount = labcount;
|
||||||
|
|
||||||
//start 空气温度 air_temperature
|
//start 空气温度 air_temperature
|
||||||
this.air_temperature = chartInfo.air_temperature;
|
this.air_temperature = chartInfo.air_temperature;
|
||||||
|
|
@ -486,6 +509,16 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
let min_temperature = 0;
|
||||||
|
for(let val of this.air_temperature.data){
|
||||||
|
if(val<0){
|
||||||
|
min_temperature = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(min_temperature<0){
|
||||||
|
this.optsc.yAxis.data = [];
|
||||||
|
}
|
||||||
|
|
||||||
this.chart_air_temperature = JSON.parse(JSON.stringify(res));
|
this.chart_air_temperature = JSON.parse(JSON.stringify(res));
|
||||||
//end 空气温度 air_temperature
|
//end 空气温度 air_temperature
|
||||||
//start 空气湿度
|
//start 空气湿度
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,19 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cont-box">
|
<view class="cont-box">
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(1)">
|
||||||
<view class="name">Ⅰ级预警</view>
|
<view class="name">Ⅰ级预警</view>
|
||||||
<view class="val">{{deviceWarning[1]?deviceWarning[1]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[1]?deviceWarning[1]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(2)">
|
||||||
<view class="name">Ⅱ级预警</view>
|
<view class="name">Ⅱ级预警</view>
|
||||||
<view class="val">{{deviceWarning[2]?deviceWarning[2]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[2]?deviceWarning[2]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(3)">
|
||||||
<view class="name">Ⅲ级预警</view>
|
<view class="name">Ⅲ级预警</view>
|
||||||
<view class="val">{{deviceWarning[3]?deviceWarning[3]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[3]?deviceWarning[3]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(4)">
|
||||||
<view class="name">Ⅳ级预警</view>
|
<view class="name">Ⅳ级预警</view>
|
||||||
<view class="val">{{deviceWarning[4]?deviceWarning[4]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[4]?deviceWarning[4]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
<view class="cart_box">
|
<view class="cart_box">
|
||||||
<qiun-data-charts
|
<qiun-data-charts
|
||||||
type="area"
|
type="area"
|
||||||
:opts="opts"
|
:opts="optsc"
|
||||||
:chartData="chart_temperature"
|
:chartData="chart_temperature"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -200,6 +200,7 @@
|
||||||
components: { QiunDataCharts },
|
components: { QiunDataCharts },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
optsc:{},
|
||||||
opts: {
|
opts: {
|
||||||
dataLabel:false,//显示数据
|
dataLabel:false,//显示数据
|
||||||
padding:[10,40,25,25],
|
padding:[10,40,25,25],
|
||||||
|
|
@ -283,11 +284,19 @@
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
this.queryDeviceBasics();
|
this.queryDeviceBasics();
|
||||||
|
this.optsc = JSON.parse(JSON.stringify(this.opts));
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
|
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
warningClickFn(lv){
|
||||||
|
|
||||||
|
let urlparams = `?lv=${lv}&base=${this.addressValue}&device=${this.device_id}&title=水质监控`;
|
||||||
|
uni.navigateTo({
|
||||||
|
url:`/pages/index/warning-list${urlparams}`
|
||||||
|
})
|
||||||
|
},
|
||||||
//设置预警值
|
//设置预警值
|
||||||
setWarnInfo(){
|
setWarnInfo(){
|
||||||
this.getDeviceWarningRules();
|
this.getDeviceWarningRules();
|
||||||
|
|
@ -403,7 +412,6 @@
|
||||||
this.deviceAddressList = _data;
|
this.deviceAddressList = _data;
|
||||||
this.addressValue = _data[0].id;
|
this.addressValue = _data[0].id;
|
||||||
this.addressName = _data[0].name;
|
this.addressName = _data[0].name;
|
||||||
this.$refs.uDropdown.highlight(0);
|
|
||||||
this.queryAddressDevicePoints(this.addressValue);
|
this.queryAddressDevicePoints(this.addressValue);
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
|
@ -475,6 +483,7 @@
|
||||||
console.log(chartInfo,'chartDatas--')
|
console.log(chartInfo,'chartDatas--')
|
||||||
if(params.start_time!=params.end_time){//不是当天
|
if(params.start_time!=params.end_time){//不是当天
|
||||||
this.opts.xAxis.labelCount = 3;
|
this.opts.xAxis.labelCount = 3;
|
||||||
|
this.optsc.xAxis.labelCount = 3;
|
||||||
}else{
|
}else{
|
||||||
let len = chartInfo.conductivity.categories.length-1;
|
let len = chartInfo.conductivity.categories.length-1;
|
||||||
let v = 5;
|
let v = 5;
|
||||||
|
|
@ -485,6 +494,7 @@
|
||||||
v = 3;
|
v = 3;
|
||||||
}else{v=5}
|
}else{v=5}
|
||||||
this.opts.xAxis.labelCount = v;
|
this.opts.xAxis.labelCount = v;
|
||||||
|
this.optsc.xAxis.labelCount = v;
|
||||||
console.log(this.opts,v,len,'配置',aw)
|
console.log(this.opts,v,len,'配置',aw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -528,7 +538,15 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
let min_temperature = 0;
|
||||||
|
for(let val of chartInfo.temperature.data){
|
||||||
|
if(val<0){
|
||||||
|
min_temperature = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(min_temperature<0){
|
||||||
|
this.optsc.yAxis.data = [];
|
||||||
|
}
|
||||||
this.chart_temperature = JSON.parse(JSON.stringify(res3));
|
this.chart_temperature = JSON.parse(JSON.stringify(res3));
|
||||||
//end 温度
|
//end 温度
|
||||||
//start 氮 k
|
//start 氮 k
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
<template>
|
||||||
|
<view class="bg-page">
|
||||||
|
<u-navbar title="预警列表" :background="background" :custom-back="goback"
|
||||||
|
:title-color="titleColor" :back-icon-color="titleColor">
|
||||||
|
</u-navbar>
|
||||||
|
<view class="secreen-section" style="background-color: #fff;">
|
||||||
|
<view class="quick_times">
|
||||||
|
<u-subsection :list="sublist" :animation="true"
|
||||||
|
:current="currentIndex" @change="subChange1"></u-subsection>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="title" class="top-title-box u-padding-20 u-margin-top-15"
|
||||||
|
style="background-color: #fff;font-size: 30rpx;font-weight: bold;">
|
||||||
|
{{title}}</view>
|
||||||
|
<view class="content-box">
|
||||||
|
<u-swipe-action class="tb_swipe_list"
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:show="item.show" :index="index" :key="item.id"
|
||||||
|
@click="click"
|
||||||
|
@open="open"
|
||||||
|
:options="options"
|
||||||
|
>
|
||||||
|
<view class="tb_body" @click="showInfo(index)">
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">基地:{{ item.base_name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">监控点:{{ item.point_name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">等级:{{lvname[item.lv]}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">状态:
|
||||||
|
<u-tag v-if="item.status==1" text="已处理" type="success" size="mini"/>
|
||||||
|
<u-tag v-if="item.status==0" text="未处理" type="error" size="mini"/>
|
||||||
|
<u-tag v-if="item.status==2" text="已忽略" type="info" size="mini"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">设备类型:{{devicetypename[item.device_type]}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="row_box">
|
||||||
|
<view class="text">开始时间:{{item.created_at|timeFormat}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</u-swipe-action>
|
||||||
|
<u-loadmore :status="loading" margin-top="60"/>
|
||||||
|
</view>
|
||||||
|
<u-popup v-model="popupShow" mode="bottom" border-radius="28" z-index="900">
|
||||||
|
<view class="popup-form-info">
|
||||||
|
<view class="top_box u-border-bottom">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="section_c">
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">ID</view>
|
||||||
|
<view class="flex-1">{{formInfo.id}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">基地</view>
|
||||||
|
<view class="flex-1">{{formInfo.base_name}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">监控点</view>
|
||||||
|
<view class="flex-1">{{formInfo.point_name}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">等级</view>
|
||||||
|
<view class="flex-1">{{lvname[formInfo.lv]}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">状态</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<u-tag v-if="formInfo.status==1" text="已处理" type="success" size="mini"/>
|
||||||
|
<u-tag v-if="formInfo.status==0" text="未处理" type="error" size="mini"/>
|
||||||
|
<u-tag v-if="formInfo.status==2" text="已忽略" type="info" size="mini"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">设备类型</view>
|
||||||
|
<view class="flex-1">{{devicetypename[formInfo.device_type]}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">创建时间</view>
|
||||||
|
<view class="flex-1">{{formInfo.created_at|timeFormat}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="plist u-border-bottom">
|
||||||
|
<view class="label_t">内容</view>
|
||||||
|
<view class="flex-1">{{formInfo.content}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {formatDate,navigateBack,showLoading,hideLoading} from '@/com/utils.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
background: {
|
||||||
|
backgroundColor:'#2a7dc9',
|
||||||
|
},
|
||||||
|
titleColor:"#ffffff",
|
||||||
|
per_page:10,
|
||||||
|
page:1,
|
||||||
|
list:[],
|
||||||
|
loading:'loadmore',
|
||||||
|
currentIndex:0,
|
||||||
|
sublist:[
|
||||||
|
{
|
||||||
|
name: '未处理',
|
||||||
|
value:0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '已处理',
|
||||||
|
value:1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '已忽略',
|
||||||
|
value:2
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [
|
||||||
|
// {
|
||||||
|
// text: '标记',
|
||||||
|
// style: {
|
||||||
|
// backgroundColor: '#007aff'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
],
|
||||||
|
popupShow:false,
|
||||||
|
cindex:-1,//操作的索引
|
||||||
|
formInfo:{},
|
||||||
|
getParams:{},
|
||||||
|
title:'',
|
||||||
|
statusValue:0,
|
||||||
|
lvname:{
|
||||||
|
1:'Ⅰ级预警',
|
||||||
|
2:'Ⅱ级预警',
|
||||||
|
3:'Ⅲ级预警',
|
||||||
|
4:'Ⅳ级预警'
|
||||||
|
},
|
||||||
|
devicetypename:{
|
||||||
|
1:'监控设备',
|
||||||
|
2:'土壤设备',
|
||||||
|
3:'水质设备',
|
||||||
|
4:'气象设备'
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
filters:{
|
||||||
|
timeFormat(val){
|
||||||
|
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
console.log(e);
|
||||||
|
this.getParams = e;
|
||||||
|
if(e.title){
|
||||||
|
this.title = `${e.title}-预警`
|
||||||
|
}
|
||||||
|
this.queryDataList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
subChange1(index){
|
||||||
|
console.log(index);
|
||||||
|
this.statusValue = this.sublist[index].value;
|
||||||
|
this.queryDataList(true)
|
||||||
|
},
|
||||||
|
showInfo(index){
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.formInfo = this.list[index];
|
||||||
|
this.popupShow = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
open(index){
|
||||||
|
this.list[index].show = true;
|
||||||
|
},
|
||||||
|
click(index, index1) {
|
||||||
|
console.log(index,index1,this.list[index])
|
||||||
|
if(index1 == 1) {
|
||||||
|
this.cindex = index;
|
||||||
|
let _id = this.list[index].id;
|
||||||
|
this.deleteInfoId(_id);
|
||||||
|
} else {//编辑
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryDataList(refresh){
|
||||||
|
if(refresh){
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
this.page = 1;
|
||||||
|
this.list = [];
|
||||||
|
}
|
||||||
|
if(this.loading=='nomore'){//超出最大页
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
per_page:this.per_page,
|
||||||
|
page: this.page ++,
|
||||||
|
status:this.statusValue,
|
||||||
|
_t: new Date().getTime()
|
||||||
|
}
|
||||||
|
params = Object.assign(params,this.getParams);
|
||||||
|
this.loading = 'loading';
|
||||||
|
this.$http.get('/api/device-warning-logs',{params:params}).then(({data})=>{
|
||||||
|
console.log(data)
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
if(data.code==200){
|
||||||
|
let _list = data.data|| [];
|
||||||
|
for(let item of _list){
|
||||||
|
item.show = false;
|
||||||
|
}
|
||||||
|
this.list = this.list.concat(_list);
|
||||||
|
console.log(this.list);
|
||||||
|
if(this.list.length>= data.meta.total){
|
||||||
|
this.loading ='nomore';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
this.loading = 'loadmore';
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//标记Id
|
||||||
|
warningmarkId(id){
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确定标记?',
|
||||||
|
success: (res)=> {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等...');
|
||||||
|
this.$http.delete(`/api/device-warning-mark/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
|
if(data.code==200){
|
||||||
|
this.formInfo = {};//重置
|
||||||
|
this.popupShow = false;
|
||||||
|
this.queryDataList(true);
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
goback(){
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//触底加载
|
||||||
|
onReachBottom() {
|
||||||
|
if(this.loading=='loadmore'){
|
||||||
|
this.queryDataList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.content-box{
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -48,19 +48,19 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cont-box">
|
<view class="cont-box">
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(1)">
|
||||||
<view class="name">Ⅰ级预警</view>
|
<view class="name">Ⅰ级预警</view>
|
||||||
<view class="val">{{deviceWarning[1]?deviceWarning[1]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[1]?deviceWarning[1]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(2)">
|
||||||
<view class="name">Ⅱ级预警</view>
|
<view class="name">Ⅱ级预警</view>
|
||||||
<view class="val">{{deviceWarning[2]?deviceWarning[2]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[2]?deviceWarning[2]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(3)">
|
||||||
<view class="name">Ⅲ级预警</view>
|
<view class="name">Ⅲ级预警</view>
|
||||||
<view class="val">{{deviceWarning[3]?deviceWarning[3]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[3]?deviceWarning[3]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @click="warningClickFn(4)">
|
||||||
<view class="name">Ⅳ级预警</view>
|
<view class="name">Ⅳ级预警</view>
|
||||||
<view class="val">{{deviceWarning[4]?deviceWarning[4]:0}}<text class="unit">个</text></view>
|
<view class="val">{{deviceWarning[4]?deviceWarning[4]:0}}<text class="unit">个</text></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
<view class="cart_box">
|
<view class="cart_box">
|
||||||
<qiun-data-charts
|
<qiun-data-charts
|
||||||
type="area"
|
type="area"
|
||||||
:opts="opts"
|
:opts="optsc"
|
||||||
:chartData="chart_temperature"
|
:chartData="chart_temperature"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -201,6 +201,7 @@
|
||||||
components: { QiunDataCharts },
|
components: { QiunDataCharts },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
optsc:{},
|
||||||
opts: {
|
opts: {
|
||||||
dataLabel:false,//显示数据
|
dataLabel:false,//显示数据
|
||||||
padding:[10,40,25,25],
|
padding:[10,40,25,25],
|
||||||
|
|
@ -285,11 +286,19 @@
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
this.queryDeviceBasics();
|
this.queryDeviceBasics();
|
||||||
|
this.optsc = JSON.parse(JSON.stringify(this.opts));
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
|
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
warningClickFn(lv){
|
||||||
|
|
||||||
|
let urlparams = `?lv=${lv}&base=${this.addressValue}&device=${this.device_id}&title=水质监控`;
|
||||||
|
uni.navigateTo({
|
||||||
|
url:`/pages/index/warning-list${urlparams}`
|
||||||
|
})
|
||||||
|
},
|
||||||
//设置预警值
|
//设置预警值
|
||||||
setWarnInfo(){
|
setWarnInfo(){
|
||||||
this.getDeviceWarningRules();
|
this.getDeviceWarningRules();
|
||||||
|
|
@ -405,7 +414,7 @@
|
||||||
this.deviceAddressList = _data;
|
this.deviceAddressList = _data;
|
||||||
this.addressValue = _data[0].id;
|
this.addressValue = _data[0].id;
|
||||||
this.addressName = _data[0].name;
|
this.addressName = _data[0].name;
|
||||||
this.$refs.uDropdown.highlight(0);
|
|
||||||
this.queryAddressDevicePoints(this.addressValue);
|
this.queryAddressDevicePoints(this.addressValue);
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
|
@ -477,6 +486,7 @@
|
||||||
console.log(chartInfo,'chartDatas--')
|
console.log(chartInfo,'chartDatas--')
|
||||||
if(params.start_time!=params.end_time){//不是当天
|
if(params.start_time!=params.end_time){//不是当天
|
||||||
this.opts.xAxis.labelCount = 3;
|
this.opts.xAxis.labelCount = 3;
|
||||||
|
this.optsc.xAxis.labelCount = 3;
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
let len = chartInfo.conductivity.categories.length-1;
|
let len = chartInfo.conductivity.categories.length-1;
|
||||||
|
|
@ -488,6 +498,7 @@
|
||||||
v = 3;
|
v = 3;
|
||||||
}else{v=5}
|
}else{v=5}
|
||||||
this.opts.xAxis.labelCount = v;
|
this.opts.xAxis.labelCount = v;
|
||||||
|
this.optsc.xAxis.labelCount = v;
|
||||||
console.log(this.opts,v,len,'配置',aw)
|
console.log(this.opts,v,len,'配置',aw)
|
||||||
}
|
}
|
||||||
//start 氯
|
//start 氯
|
||||||
|
|
@ -558,6 +569,15 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
let min_temperature = 0;
|
||||||
|
for(let val of chartInfo.temperature.data){
|
||||||
|
if(val<0){
|
||||||
|
min_temperature = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(min_temperature<0){
|
||||||
|
this.optsc.yAxis.data = [];
|
||||||
|
}
|
||||||
this.chart_temperature = JSON.parse(JSON.stringify(res5));
|
this.chart_temperature = JSON.parse(JSON.stringify(res5));
|
||||||
//end 温度 temperature
|
//end 温度 temperature
|
||||||
//start 浊度 turbidity
|
//start 浊度 turbidity
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@ export default {
|
||||||
password: '' //密码
|
password: '' //密码
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {},
|
onLoad() {
|
||||||
|
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//当前登录按钮操作
|
//当前登录按钮操作
|
||||||
login() {
|
login() {
|
||||||
|
|
@ -69,12 +71,13 @@ export default {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
})
|
})
|
||||||
|
uni.showToast({ title: '登录成功!', icon: 'none' });
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
uni.showToast({ title: '登录失败!', icon: 'none' });
|
||||||
})
|
})
|
||||||
uni.showToast({ title: '登录成功!', icon: 'none' });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,10 +229,12 @@
|
||||||
</u-popup>
|
</u-popup>
|
||||||
<u-select v-model="select2" :list="rolelist" :default-value="defaultRoleValue" mode="single-column"
|
<u-select v-model="select2" :list="rolelist" :default-value="defaultRoleValue" mode="single-column"
|
||||||
@confirm="uselectConfirm"></u-select>
|
@confirm="uselectConfirm"></u-select>
|
||||||
|
<u-loadmore :status="loading" margin-top="40"/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {showLoading,hideLoading} from '@/com/utils.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -420,6 +422,7 @@
|
||||||
if(refresh){
|
if(refresh){
|
||||||
this.loading = 'loadmore';
|
this.loading = 'loadmore';
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
|
this.list = [];
|
||||||
}
|
}
|
||||||
if(this.loading=='nomore'){//超出最大页
|
if(this.loading=='nomore'){//超出最大页
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -432,9 +435,9 @@
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
this.$http.get('/api/admin-users',{params:params}).then(({data})=>{
|
this.$http.get('/api/admin-users',{params:params}).then(({data})=>{
|
||||||
console.log(data)
|
console.log(data)
|
||||||
if(refresh){
|
// if(refresh){
|
||||||
this.list = [];
|
// this.list = [];
|
||||||
}
|
// }
|
||||||
this.loading = 'loadmore';
|
this.loading = 'loadmore';
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
let _list = data.data|| [];
|
let _list = data.data|| [];
|
||||||
|
|
@ -463,27 +466,52 @@
|
||||||
phone:phone,
|
phone:phone,
|
||||||
department:department,
|
department:department,
|
||||||
}
|
}
|
||||||
|
if (username=='') {
|
||||||
|
uni.showToast({ title: '请填写用户名', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (name=='') {
|
||||||
|
uni.showToast({ title: '请填写昵称', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (role_id=='') {
|
||||||
|
uni.showToast({ title: '请选择角色', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (status=='') {
|
||||||
|
uni.showToast({ title: '请选择状态', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showLoading('请稍等...');
|
||||||
if(id){params['id'] = id;}
|
if(id){params['id'] = id;}
|
||||||
if(params['id']){
|
if(params['id']){
|
||||||
this.$http.put(`/api/admin-users/${id}`,params).then(({data})=>{
|
this.$http.put(`/api/admin-users/${id}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
this.queryDataList(true);
|
this.queryDataList(true);
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
|
||||||
}
|
|
||||||
}).catch(()=>{
|
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
|
if (!password) {
|
||||||
|
uni.showToast({ title: '请填写密码', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
params['password'] = password;
|
params['password'] = password;
|
||||||
this.$http.post(`/api/admin-users`,params).then(({data})=>{
|
this.$http.post(`/api/admin-users`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.queryDataList(true);
|
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
this.queryDataList(true);
|
||||||
}
|
|
||||||
}).catch(()=>{
|
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -546,7 +574,9 @@
|
||||||
success: (res)=> {
|
success: (res)=> {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
console.log('用户点击确定');
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等...');
|
||||||
this.$http.delete(`/api/admin-users/${id}`).then(({data})=>{
|
this.$http.delete(`/api/admin-users/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.formInfo = {};//重置删除
|
this.formInfo = {};//重置删除
|
||||||
this.popupShow = false;
|
this.popupShow = false;
|
||||||
|
|
@ -554,7 +584,7 @@
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消');
|
console.log('用户点击取消');
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,12 @@
|
||||||
<u-input v-model="setInfo.name" />
|
<u-input v-model="setInfo.name" />
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="排序" label-width="140" :required='true'>
|
<u-form-item label="排序" label-width="140">
|
||||||
<view class="input_box">
|
<view class="input_box">
|
||||||
<u-input v-model="setInfo.sort" type="number"/>
|
<u-input v-model="setInfo.sort" type="number"/>
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="是否内链" label-width="140" :required='true'>
|
<u-form-item label="是否内链" label-width="140">
|
||||||
<view class="input_box flex-row align-items-c">
|
<view class="input_box flex-row align-items-c">
|
||||||
<u-switch v-model="setInfo.is_iframe" size="34"
|
<u-switch v-model="setInfo.is_iframe" size="34"
|
||||||
></u-switch>
|
></u-switch>
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="推荐" label-width="140" :required='true'>
|
<u-form-item label="推荐" label-width="140">
|
||||||
<view class="input_box flex-row align-items-c">
|
<view class="input_box flex-row align-items-c">
|
||||||
<u-switch v-model="setInfo.is_recommend" size="34"
|
<u-switch v-model="setInfo.is_recommend" size="34"
|
||||||
></u-switch>
|
></u-switch>
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="状态" label-width="140" :required='true'>
|
<u-form-item label="状态" label-width="140">
|
||||||
<view class="input_box flex-row align-items-c">
|
<view class="input_box flex-row align-items-c">
|
||||||
<u-switch v-model="setInfo.is_show" size="34"
|
<u-switch v-model="setInfo.is_show" size="34"
|
||||||
></u-switch>
|
></u-switch>
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {formatDate,navigateBack} from '@/com/utils.js'
|
import {formatDate,navigateBack,showLoading,hideLoading} from '@/com/utils.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -255,7 +255,7 @@
|
||||||
setInfo:{
|
setInfo:{
|
||||||
id:'',
|
id:'',
|
||||||
name:'',
|
name:'',
|
||||||
sort:'',
|
sort:1,
|
||||||
is_iframe:false,
|
is_iframe:false,
|
||||||
is_recommend:false,
|
is_recommend:false,
|
||||||
is_show:true,
|
is_show:true,
|
||||||
|
|
@ -278,15 +278,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
select2Value:[0],
|
select2Value:[0],
|
||||||
rules: {
|
|
||||||
password: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入密码',
|
|
||||||
trigger: ['blur', 'change']
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
start_date_c:'',
|
start_date_c:'',
|
||||||
end_date_c:'',
|
end_date_c:'',
|
||||||
calendarShow:false,
|
calendarShow:false,
|
||||||
|
|
@ -413,6 +404,9 @@
|
||||||
},
|
},
|
||||||
//修改
|
//修改
|
||||||
editInfoBtn(){
|
editInfoBtn(){
|
||||||
|
if(!this.valiFormRule()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let {id,name,sort,is_iframe,is_recommend,is_show,type,content} = this.setInfo;
|
let {id,name,sort,is_iframe,is_recommend,is_show,type,content} = this.setInfo;
|
||||||
let params = {
|
let params = {
|
||||||
name:name,
|
name:name,
|
||||||
|
|
@ -423,28 +417,29 @@
|
||||||
type:type,
|
type:type,
|
||||||
content:content,
|
content:content,
|
||||||
}
|
}
|
||||||
|
showLoading('请稍等...');
|
||||||
if(id){params['id'] = id;}
|
if(id){params['id'] = id;}
|
||||||
if(params['id']){
|
if(params['id']){
|
||||||
this.$http.put(`/api/friend-links/${id}`,params).then(({data})=>{
|
this.$http.put(`/api/friend-links/${id}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
this.queryDataList(true);
|
this.queryDataList(true);
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
|
||||||
}
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.$http.post(`/api/friend-links`,params).then(({data})=>{
|
this.$http.post(`/api/friend-links`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.queryDataList(true);
|
this.queryDataList(true);
|
||||||
this.editShow = false;
|
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(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -460,7 +455,7 @@
|
||||||
let info = {
|
let info = {
|
||||||
id:'',
|
id:'',
|
||||||
name:'',
|
name:'',
|
||||||
sort:'',
|
sort:1,
|
||||||
is_iframe:false,
|
is_iframe:false,
|
||||||
is_recommend:false,
|
is_recommend:false,
|
||||||
is_show:true,
|
is_show:true,
|
||||||
|
|
@ -490,15 +485,18 @@
|
||||||
success: (res)=> {
|
success: (res)=> {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
console.log('用户点击确定');
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等...');
|
||||||
this.$http.delete(`/api/friend-links/${id}`).then(({data})=>{
|
this.$http.delete(`/api/friend-links/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.formInfo = {};//重置删除
|
this.formInfo = {};//重置删除
|
||||||
this.popupShow = false;
|
this.popupShow = false;
|
||||||
this.list.splice(this.cindex,1);
|
this.list.splice(this.cindex,1);
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
|
||||||
}
|
|
||||||
}).catch(()=>{
|
|
||||||
|
|
||||||
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消');
|
console.log('用户点击取消');
|
||||||
|
|
@ -507,6 +505,25 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
valiFormRule(){
|
||||||
|
let {id,name,sort,is_iframe,is_recommend,is_show,type,content} = this.setInfo;
|
||||||
|
|
||||||
|
if(name==''){
|
||||||
|
uni.showToast({ title: '名称不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type==''){
|
||||||
|
uni.showToast({ title: '类型不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(content==''){
|
||||||
|
uni.showToast({ title: '地址不能为空', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
queryInfo(id){
|
queryInfo(id){
|
||||||
this.$http.get(`/api/friend-links/${id}`).then(({data})=>{
|
this.$http.get(`/api/friend-links/${id}`).then(({data})=>{
|
||||||
console.log(data,'queryInfo===')
|
console.log(data,'queryInfo===')
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,13 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-loadmore :status="loading" margin-top="40"/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DaTreeVue2 from '@/components/da-tree-vue2/index.vue'
|
import DaTreeVue2 from '@/components/da-tree-vue2/index.vue'
|
||||||
|
import {showLoading,hideLoading} from '@/com/utils.js'
|
||||||
export default {
|
export default {
|
||||||
components: { DaTreeVue2 },
|
components: { DaTreeVue2 },
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -230,25 +232,35 @@
|
||||||
permission_ids:this.formInfo.permissions
|
permission_ids:this.formInfo.permissions
|
||||||
}
|
}
|
||||||
let id = this.formInfo.id;
|
let id = this.formInfo.id;
|
||||||
|
if (params.name=='') {
|
||||||
|
uni.showToast({ title: '请填写角色名称', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (params.slug=='') {
|
||||||
|
uni.showToast({ title: '请填写角色编码', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showLoading('请稍等...');
|
||||||
if(id){
|
if(id){
|
||||||
this.$http.put(`/api/admin-roles/${id}`,params).then(({data})=>{
|
this.$http.put(`/api/admin-roles/${id}`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
|
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
|
||||||
}
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.$http.post(`/api/admin-roles`,params).then(({data})=>{
|
this.$http.post(`/api/admin-roles`,params).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.queryAdminRoleList(true);
|
this.queryAdminRoleList(true);
|
||||||
this.editShow = false;
|
this.editShow = false;
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
|
||||||
}
|
}
|
||||||
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -265,7 +277,9 @@
|
||||||
success: (res)=> {
|
success: (res)=> {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
console.log('用户点击确定');
|
console.log('用户点击确定');
|
||||||
|
showLoading('请稍等...');
|
||||||
this.$http.delete(`/api/admin-roles/${id}`).then(({data})=>{
|
this.$http.delete(`/api/admin-roles/${id}`).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
this.formInfo = {};//重置删除
|
this.formInfo = {};//重置删除
|
||||||
this.popupShow = false;
|
this.popupShow = false;
|
||||||
|
|
@ -273,7 +287,7 @@
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消');
|
console.log('用户点击取消');
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {showLoading,hideLoading} from '@/com/utils.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -45,15 +46,17 @@
|
||||||
uni.showToast({ title: '两次密码不一致', icon: 'none' });
|
uni.showToast({ title: '两次密码不一致', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
showLoading('请稍等...');
|
||||||
this.$http.put('/api/users/reset-password',this.form).then(({data})=>{
|
this.$http.put('/api/users/reset-password',this.form).then(({data})=>{
|
||||||
|
hideLoading();
|
||||||
console.log(data)
|
console.log(data)
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
|
uni.showToast({ title: '修改成功', icon: 'none' });
|
||||||
}else{
|
}else{
|
||||||
uni.showToast({ title: data.message, icon: 'none' });
|
uni.showToast({ title: data.message, icon: 'none' });
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
hideLoading();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters,mapActions} from 'vuex'
|
import {mapGetters,mapActions} from 'vuex'
|
||||||
import {USER_INFO} from '@/store/mutation-types.js'
|
import {USER_INFO} from '@/store/mutation-types.js'
|
||||||
import {showLoading,toast,setStorage,stringHide} from '@/com/utils.js'
|
import {showLoading,toast,setStorage,stringHide,clearStorageSync} from '@/com/utils.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -146,9 +146,12 @@
|
||||||
handleLoginOut(){
|
handleLoginOut(){
|
||||||
this.$http.delete('/api/users/logout').then(({data})=>{
|
this.$http.delete('/api/users/logout').then(({data})=>{
|
||||||
if(data.code==200){
|
if(data.code==200){
|
||||||
|
clearStorageSync();
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url:'/pages/login/login'
|
url:'/pages/login/login'
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
toast('退出失败');
|
||||||
}
|
}
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ const store = new Vuex.Store({
|
||||||
console.log(val,'createPersistedState') // value值为当前state中的所有值对象
|
console.log(val,'createPersistedState') // value值为当前state中的所有值对象
|
||||||
// return什么,localstorage中的key值为vuex的value值就是什么,而且是实时与state中的值保持同步
|
// return什么,localstorage中的key值为vuex的value值就是什么,而且是实时与state中的值保持同步
|
||||||
return {
|
return {
|
||||||
userInfo: val.userInfo
|
userInfo: val.userInfo,
|
||||||
|
user_access_token:val.user_access_token
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue