| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 40px;">
- <view style="position: fixed;z-index: 100;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="四情基地"></uni-nav-bar>
- <view class="bases_search">
- <view class="bases_search_text">
- <u-icon name="search" class="search" @click="search"></u-icon>
- <input type="text" v-model="data.search" placeholder="请输入基地名称" @input="searchinput" />
- </view>
- </view>
- </view>
- <view class="bases_none" v-if="base_none">
- 暂无数据
- </view>
- <view class="bases" v-else>
- <view class="bases_list" v-for="(items,index) in baselist" :key="index" @click="details(items.id)">
- <view class="bases_list_bgi">
- <image :src="items.base_img" mode=""></image>
- <view class="bgcolor">
- </view>
- </view>
- <view class="bases_list_text">
- <p >{{items.base_name}}</p>
- <p style="margin-right: 24rpx;">面积:{{items.base_area}}亩</p>
- <p style="font-size: 24rpx;">联系人:{{items.base_charge}}</p>
- <p style="font-size: 24rpx;">联系电话:{{items.base_phone}}</p>
- <p style="font-size: 24rpx;">描述:{{items.base_describe}}</p>
- </view>
- <!-- <u-icon name="more-dot-fill" class="bases_list_xiangqing" @click.native.stop="XQclick(items)"></u-icon> -->
- <view class="bases_list_xiangqing">
- <u-icon name="more-dot-fill" class="" @click.native.stop="XQclick(items)"></u-icon>
- </view>
- <view class="photoshow">
- <image :src="$imageURL+'/bigdata_app'+'/image/fourMoodBase/1.png'" mode=""></image>
- <image :src="$imageURL+'/bigdata_app'+'/image/fourMoodBase/3.png'" mode=""></image>
- <image :src="$imageURL+'/bigdata_app'+'/image/fourMoodBase/5.png'" mode=""></image>
- <view class="photoshow_num">
- {{items.num}}
- </view>
- </view>
- </view>
- <u-action-sheet :list="actionSheetList" v-model="post_show" @click="message"></u-action-sheet>
- </view>
- </view>
- <view class="addindent" @click="clickRight">
- 新 增 基 地
- </view>
- <view class="top" v-if="isTop" @click="top">
- <image :src="$imageURL+'/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
- </view>
- </view>
- </template>
- <script>
- import {
- Debounce,
- Throttle
- } from "../../util/anitthro.js"
- export default {
- data() {
- return {
- data: {
- ret: 'list',
- search: '',
- page_size: 10,
- page: 1
- },
- baselist: [],
- actionSheetList: [{
- text: "编辑基地"
- }, {
- text: "删除基地"
- }],
- post_show: false,
- delid: "",
- facilitynum: "",
- isTop:false,
- jurisdiction:{
- addbase:false,
- alter:false
- },
- base_none:true
- }
- },
- methods: {
- async getFourbase() { //基地列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=base.bases.base_list',
- data: this.data
- })
- this.baselist = this.baselist.concat(res.data)
- console.log(this.baselist)
- if(this.baselist.length==0){
- this.base_none = true
- }else{
- this.base_none = false
- }
- for (var i = 0; i < this.baselist.length; i++) {
- var arr = this.baselist[i].base_equip.split("#")
- if (arr[0] == '') {
- arr.shift(1)
- }
- console.log(arr)
- this.baselist[i].num = arr.length
- }
- },
- async delbase() { //基地列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=base.bases.base_list',
- data: {
- ret: "del",
- base_id: this.delid.id
- }
- })
- },
- clickLeft() { //返回主页
- uni.switchTab({
- url: "../index/index"
- })
- },
- clickRight() { //添加基地
- if(this.jurisdiction.addbase){
- uni.navigateTo({
- url: "./addbase"
- })
- }else{
- uni.showToast({
- title: "您暂无权限进行此操作,如有需要,请联系管理员",
- icon: "none"
- })
- }
- },
- searchinput() { //搜索
- this.data.page = 1
- this.baselist = []
- Debounce(() => {
- this.getFourbase()
- }, 1000)()
- },
- search() { //搜索按钮
- this.data.page = 1
- this.baselist = []
- this.getFourbase()
- this.$forceUpdate()
- },
- details(id) { //详情页
- uni.navigateTo({
- url: "./basefacility?id=" + id
- })
- },
- XQclick(item) { //编辑
- this.post_show = !this.post_show
- this.delid = item
- },
- message(index) { //编辑或者删除
- console.log(index)
- if (index == 1) {
- console.log(this.delid.id)
- uni.showModal({
- title: '提示',
- content: '确定要删除该基地吗?',
- success: (res) => {
- if (res.confirm) {
- this.delbase()
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- } else {
- if(this.jurisdiction.addbase){
- uni.navigateTo({
- url: "./modification?id=" + JSON.stringify(this.delid)
- })
- }else{
- uni.showToast({
- title: "您暂无权限进行此操作,如有需要,请联系管理员",
- icon: "none"
- })
- }
- }
- this.$forceUpdate()
- },
- top() {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 500
- })
- }
- },
- onLoad() {
- this.getFourbase()
- uni.getStorage({
- key:"jurisdiction",
- success:(res)=>{
- console.log(JSON.parse(res.data))
- let items = JSON.parse(res.data).filter((item)=>{
- return item.pur_id == 25//"四情基地"
- })
- let items2 = items[0].children.filter((item)=>{
- return item.pur_id == 26//"基地管理"
- })
- console.log(items2)
- this.jurisdiction.addbase =items2[0].children.some((item)=>{
- return item.pur_id == 111//"新增"
- })
- this.jurisdiction.alter =items2[0].children.some((item)=>{
- return item.pur_id == 110//"修改"
- })
- },
- })
- },
- onReachBottom() { //滑动到底部加载
- this.data.page++
- this.getFourbase()
- },
- onShow() {
- this.$forceUpdate()
- },
- onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
- if (e.scrollTop > 200) { //距离大于200时显示
- this.isTop = true
- } else { //距离小于200时隐藏
- this.isTop = false
- }
- },
- }
- </script>
- <style lang="scss">
- .tianjia {
- position: absolute;
- top: 24rpx;
- right: 24rpx;
- font-size: 38rpx;
- }
- .bases_search {
- width: 100%;
- position: fixed;
- top: 84px;
- z-index: 100;
- background-color: #FFFFFF;
- .bases_search_text {
- width: 90%;
- margin: 0 auto;
- background-color: #F8F8F8;
- height: 60rpx;
- border-radius: 30rpx;
- display: flex;
- line-height: 60rpx;
- .search {
- padding: 0 20rpx;
- font-size: 34rpx;
- }
- input {
- width: 80%;
- margin-top: 10rpx;
- font-size: 28rpx;
- }
- }
- }
- .bases_none{
- width: 100%;
- position: relative;
- top: 200rpx;
- font-size: 36rpx;
- text-align: center;
- }
- .bases {
- width: 100%;
- height: 90%;
- position: relative;
- top: 170rpx;
- margin-bottom:100rpx;
- .bases_list {
- width: 90%;
- margin: 0 auto 20rpx;
- height: 276rpx;
- position: relative;
- .bases_list_bgi {
- .bgcolor {
- width: 100%;
- height: 276rpx;
- background-color: rgba(0, 0, 0, 0.3);
- border-radius: 25rpx;
- }
- image {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 276rpx;
- border-radius: 25rpx;
- z-index: -1;
- }
- }
- .bases_list_text {
- width: 100%;
- position: absolute;
- top: 0;
- left: 0;
- z-index: 10;
- padding: 40rpx;
- color: #FFFFFF;
- box-sizing: border-box;
- p:first-child{
- font-size: 36rpx;
- width: 80%;
- }
- p:nth-child(3){
- width: 70%;
- }
- p:last-child{
- width: 70%;
- }
- p {
- margin-bottom: 10rpx;
- overflow: hidden;//溢出隐藏
- white-space: nowrap;//禁止换行
- text-overflow: ellipsis;//...
- }
- }
- .bases_list_xiangqing {
- position: absolute;
- top: 20rpx;
- right: 20rpx;
- transform: rotate(90deg);
- font-size: 26rpx;
- color: #FFFFFF;
- width: 40rpx;
- height: 40rpx;
- z-index: 99999;
- }
- .photoshow {
- width: 160rpx;
- height: 34rpx;
- display: flex;
- position: absolute;
- bottom: 26rpx;
- right: 36rpx;
- background-color: #a7a8a0;
- border-radius: 18rpx;
- padding: 4rpx;
- image {
- width: 32rpx;
- height: 32rpx;
- margin-right: 4rpx;
- }
- .photoshow_num {
- width: 50rpx;
- height: 30rpx;
- border: 1px solid #FFFFFF;
- border-radius: 17rpx;
- text-align: center;
- line-height: 28rpx;
- font-size: 24rpx;
- color: #FFFFFF;
- }
- }
- }
- }
- .top {
- position: fixed;
- right: 30px;
- bottom: 100px;
- z-index: 100;
- image {
- width: 100rpx;
- height: 100rpx;
- }
- }
- .addindent{
- width: 100%;
- position: fixed;
- bottom: 0;
- left: 0;
- height: 80rpx;
- text-align: center;
- line-height: 80rpx;
- background-color: #71cd9a;
- color: #ffffff;
- font-size: 16px;
- z-index: 100;
- }
- </style>
|