瀏覽代碼

feat: gis页面的修改,详情的接口的对接,导入的接口

allen 2 年之前
父節點
當前提交
ea56cead35

+ 10 - 0
src/api/farmer/list.js

@@ -48,3 +48,13 @@ export const getFarmerDetail = (query) => {
     params: query
   });
 };
+
+// 导入
+
+export const importExcel = (data) => {
+  return request({
+    url: '/wpr/farmer/import',
+    method: 'post',
+    data
+  });
+};

+ 16 - 0
src/api/tmn/index.js

@@ -16,3 +16,19 @@ export const getTopList = (query) => {
     params: query
   });
 };
+// 获取设备详细信息
+export const getBaseInfo = (query) => {
+  return request({
+    url: '/tmn/base/info',
+    method: 'get',
+    params: query
+  });
+};
+// 获取设备详细信息(统计)
+export const getBaseStatInfo = (query) => {
+  return request({
+    url: '/tmn/base/stat/info',
+    method: 'get',
+    params: query
+  });
+};

File diff suppressed because it is too large
+ 6 - 0
src/views/gisShow/assets/error.svg


src/views/gisShow/assets/shuijing.svg → src/views/gisShow/assets/live.svg


File diff suppressed because it is too large
+ 6 - 0
src/views/gisShow/assets/nolive.svg


File diff suppressed because it is too large
+ 6 - 0
src/views/gisShow/assets/runing.svg


File diff suppressed because it is too large
+ 6 - 0
src/views/gisShow/assets/warning.svg


+ 24 - 3
src/views/gisShow/components/mapContainer.vue

@@ -4,7 +4,10 @@
 </template>
 
 <script>  
-import shuijing from '../assets/shuijing.svg'
+import live from '../assets/live.svg'
+import error from '../assets/error.svg'
+import nolive from '../assets/nolive.svg'
+import runing from '../assets/runing.svg'
   export default {
     name: "v-map",
     props: {
@@ -52,8 +55,26 @@ import shuijing from '../assets/shuijing.svg'
         var layers = [new AMap.TileLayer.Satellite(), new AMap.TileLayer.RoadNet()];
         this.positions.forEach(item => {
           const lng = item?.tmnLongitude || 0, lat = item?.tmnLatitude || 0
+          const tmnstatusRunstatus = item?.tmnstatusRunstatus
+          let image = live
+          switch (tmnstatusRunstatus) {
+            case 'I':
+              image = live
+              break
+            case 'W':
+              image = runing
+              break
+            case 'E':
+              image = error
+              break
+            case 'O':
+              image = nolive
+              break
+            default:
+              image = live
+           }
           const icons = new AMap.Icon({
-            image: shuijing, //自定义图标路径
+            image, //自定义图标路径
             size: new AMap.Size(130, 130), //图片大小
             imageSize: new AMap.Size(50, 50), //图片拉伸设置
           });
@@ -66,7 +87,7 @@ import shuijing from '../assets/shuijing.svg'
             clickable: true
           });
           marker.on('click',(e) => {
-            this.$emit("handlerRecomposeShow",true)
+            this.$emit("handlerRecomposeShow",true, item)
           })
           map.add(marker);
           this.current_market.push(marker)

+ 117 - 56
src/views/gisShow/components/rightEquipment.vue

@@ -45,6 +45,7 @@
           placeholder="年份"
           style="width: 150px;"
           v-model="currentDate"
+          @change="selectYearHandler"
         >
           <el-option
             v-for="item in options"
@@ -55,12 +56,12 @@
         </el-select>
       </div>
       <el-row>
-        <el-col :span="12" v-for="item in current_history" :key="item.label">
+        <el-col :span="12" v-for="item in year_history" :key="item.label">
           <el-row>
-            <el-col :span="8">
+            <el-col :span="10">
               <label>{{item.label}}</label>
             </el-col>
-            <el-col :span="16">
+            <el-col :span="14">
               <span class="content">{{item.text}}</span>
             </el-col>
           </el-row>
@@ -68,26 +69,28 @@
       </el-row>
     </div>
     <div style="margin-right:20px;">
-      <echartsGradient style="margin-top:20px"/>
+      <echarts-gradient style="margin-top:20px"
+        :byMonthList="byMonthList"
+      />
     </div>
   </div>
   </el-drawer>
 </template>
 
 <script>
+import { getBaseInfo, getBaseStatInfo } from '@/api/tmn/index.js'
 import equipment from './assets/equipment.svg'
-import echartsGradient from './echartsGradient.vue';
+import echartsGradient from '../../home/components/echartsGradient.vue';
 export default {
   name: 'rightEquipment',
   props: {
-    data: {
-      default() {
-        return {};
-      }
-    },
     visible: {
       type: Boolean,
       default: false
+    },
+    rowData: {
+      type: Object,
+      default: () => { }
     }
   },
   components: {
@@ -95,61 +98,34 @@ export default {
   },
   data() {
     return {
+      tmnName: '',
+      tmnBizcode: '',
+      waterName: '',
+      cusareaName: '',
+      waterAddress: '',
+      tmnstatusRunstatusContent: '',
+      tmnstatusRunstatus: '',
       year_history: [{
         label: '使用次数:',
-        text:'50次'
-      },{
+        text: '50次'
+      }, {
         label: '使用人数:',
-        text:'20人'
-      },{
+        text: '20人'
+      }, {
         label: '累计用水量:',
-        text:'10000  m³ /s'
-      },{
+        text: '10000  m³ /s'
+      }, {
         label: '累计用电量:',
-        text:'42,125°'
-      }],
-      current_history: [{
-        label: '使用农户:',
-        text:'张三'
-      },{
-        label: 'IC卡号:',
-        text:'545454545454545'
-      },{
-        label: '当前流速:',
-        text:'10000  m³ /s'
-      },{
-        label: '瞬时流量:',
-        text:'10000  m³ /s'
-      },{
-        label: '已用时长:',
-        text:'2小时30分钟'
-      }],
-      list:[{
-        label: '设备名称:',
-        text: '1号水电双计设备'
-      },{
-        label: '设备编号:',
-        text: '54545415315569'
-      },{
-        label: '水源名称:',
-        text: '001号水井'
-      },{
-        label: '所属区域:',
-        text: '1号基地'
-      },{
-        label: '所在位置:',
-        text: '河南省郑州市金水区瀚海北金商业写字楼B座'
-      },{
-        label: '在线状态:',
-        text: '在线'
-      },{
-        label: '运行状态:',
-        text: '开'
+        text: '42,125°'
       }],
+      current_history: [],
+      list:[],
       equipment,
       dialogVisible: false,
       currentDate: new Date().getFullYear(),
-      options: []
+      options: [],
+      byMonthList: [],
+      tmnId: ''
     };
   },
   mounted() { 
@@ -161,8 +137,42 @@ export default {
         this.dialogVisible = val;
       }
     },
+    rowData: {
+      deep: true,
+      handler(value) {
+        const { tmnId } = value
+        this.tmnId = tmnId
+        this.getBaseInfo()
+        this.getBaseStatInfoHandler()
+      }
+    }
   },
   methods: {
+    selectYearHandler(value) { 
+      this.currentDate = value
+      this.getBaseStatInfoHandler()
+    },
+    async getBaseStatInfoHandler() { 
+      const respones = await getBaseStatInfo({
+        tmnId:this.tmnId,
+        year: this.currentDate
+      })
+      const value = respones?.data
+      this.byMonthList = value?.byMonthList
+      this.year_history =  [{
+        label: '使用次数:',
+        text: value?.count || 0
+      }, {
+        label: '使用人数:',
+        text: `${value?.farmerCount || 0} 人`
+      }, {
+        label: '累计用水量:',
+        text: `${value?.waterNumTotal || 0}  m³ /s`
+      }, {
+        label: '累计用电量:',
+        text: `${value?.elecNumTotal || 0} °`
+      }]
+    },
     setYearList() {
       let currentYear = new Date().getFullYear()
       for (let i = 0; i < 5; i++) {
@@ -173,6 +183,57 @@ export default {
         })
       }
     },
+    async getBaseInfo() { 
+      const response = await getBaseInfo({
+        tmnId: this.tmnId
+      })
+      const value = response?.data
+      this.tmnName = value?.tmnName;
+      this.tmnBizcode = value?.tmnBizcode;
+      this.waterName = value?.waterName;
+      this.cusareaName = value?.cusareaName;
+      this.waterAddress = value?.waterAddress;
+      this.tmnstatusRunstatusContent = value?.tmnstatusRunstatusContent;
+      this.tmnstatusRunstatus = value?.tmnstatusRunstatus;
+      this.list = [{
+        label: '设备名称:',
+        text: this.tmnName || '-'
+      }, {
+        label: '设备编号:',
+        text: this.tmnBizcode || '-'
+      }, {
+        label: '水源名称:',
+        text: this.waterName || '-'
+      }, {
+        label: '所属区域:',
+        text: this.cusareaName || '-'
+      }, {
+        label: '所在位置:',
+        text: this.waterAddress || '-'
+      }, {
+        label: '在线状态:',
+        text: this.tmnstatusRunstatus || '-'
+      }, {
+        label: '运行状态:',
+        text: this.tmnstatusRunstatusContent || '-'
+      }]
+      this.current_history = [{
+        label: '使用农户:',
+        text: value?.farmerName || '-'
+      }, {
+        label: 'IC卡号:',
+        text: value?.cardNo || '-'
+      }, {
+        label: '当前流速:',
+        text: '-'
+      }, {
+        label: '瞬时流量:',
+        text: '-'
+      }, {
+        label: '已用时长:',
+        text: value?.useTime || '-'
+      }]
+    },
     handleClose() {
       this.$emit('update:visible', false);
     },

+ 7 - 2
src/views/gisShow/index.vue

@@ -19,7 +19,10 @@
         </el-col>
       </el-row>
     </div>
-    <rightEquipmentVue :visible.sync="recomposeShow"/>
+    <rightEquipmentVue
+      :visible.sync="recomposeShow"
+      :rowData="rowData"
+    />
     <div class="input-search">
       <el-input class="inpu" clearable placeholder="请输入你要定位的地址" v-model="address">
       </el-input>
@@ -65,6 +68,7 @@ export default {
       zoom: 12,
       lng: '',
       lat: '',
+      rowData: {}
     }
   },
   components: {
@@ -80,7 +84,8 @@ export default {
       this.getBaseListHandler()
       // this.positions = this.positions.splice(0,1)
     },
-    recomposeShowHandler(flag) {
+    recomposeShowHandler(flag, item) {
+      this.rowData = item
       this.recomposeShow = flag
     },
     async getBaseListHandler() { 

+ 2 - 2
src/views/home/components/echartsGradient.vue

@@ -137,7 +137,7 @@ export default {
           nameTextStyle: {color: '#333'},
           type: "value",
           min:0,
-          max:this.waterMax,
+          max:(this.waterMax || 0) + 100,
           splitLine: {
             show: true,
             lineStyle: {
@@ -154,7 +154,7 @@ export default {
           nameTextStyle: {color: '#333',padding:[0,0,0,0]},
           type: "value",
           min:0,
-          max:this.elecMax,
+          max:(this.elecMax || 0) + 100,
           splitLine: {
             show: true,
             lineStyle: {

+ 4 - 3
src/views/infrastructure/deviceSetup.vue

@@ -71,13 +71,13 @@
                 @click="irrigationShowHistory(scope.row)"
                 >参数设置</el-link
               >
-              <el-link
+              <!-- <el-link
                 size="small"
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
                 @click="download(scope.row)"
-              >修改</el-link>
+              >修改</el-link> -->
             </template>
           </b-table>
         </el-col>
@@ -156,7 +156,8 @@ export default {
           prop: 'elecNumTotal',
           customRender: '',
           align: 'center'
-        },{
+        }
+        , {
           label: '更新时间',
           prop: 'tmnstatusUpdateddate',
           customRender: '',

二進制
src/views/peasantHouseholdManage/assets/template.xlsx


+ 60 - 5
src/views/peasantHouseholdManage/index.vue

@@ -17,10 +17,10 @@
     >
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
-          <div>
+          <div style="display:flex">
             <el-input
               v-model="farmerName"
-              style="width: 250px;margin-right:16px;"
+              style="width: 250px;"
               placeholder="请输入姓名/电话"
               @keyup.enter.native="handleSearch"
               clearable
@@ -28,9 +28,33 @@
             <el-button
               type="primary"
               size="small"
+              style="margin: 0 16px;"
               @click="handleSearch"
               >查询</el-button
-            >
+            > 
+            <el-upload
+              class="avatar-uploader"
+              :action="uploadUrl"
+              :show-file-list="false"
+              :on-success="handleAvatarSuccess"
+              :on-error="handleUploadError"
+              name="file"
+              :headers="headers"
+              :data="{areaId: this.currentClickId}"
+              :before-upload="beforeAvatarUpload"
+            ><el-button
+                size="small"
+                type="primary"
+                style="height:36px;margin-right:16px"
+              >导入</el-button>
+            </el-upload>
+            <el-button
+              class="filter-item"
+              size="mini"
+              type="primary"
+              icon="el-icon-download"
+              @click="downloadExcel()"
+              >下载模板</el-button>
           </div>
           <div class="top-left">
             <el-button
@@ -110,7 +134,8 @@
 </template>
 
 <script>
-import { Message } from 'element-ui';
+import { getToken } from "@/utils/auth";
+import { Message } from 'element-ui'
 import { getTree } from '@/api/tree.js'
 import { getFarmerList,deleteFarmer,getFarmerDetail } from '@/api/farmer/list.js'
 import BTable from '@/components/Table/index.vue';
@@ -125,8 +150,12 @@ export default {
   components: { BTable,DataReportLeft,AddedFarmers,FarmerManagement,IrrigationRecord },
   data() {
     return {
+      uploadUrl: process.env.VUE_APP_BASE_API + "/wpr/farmer/import", // 上传的图片服务器地址
+      headers: {
+        Authorization: "Bearer " + getToken()
+      },
       visibles: false,
-      farmerName:'',
+      farmerName: '',
       detailsData: {},
       treeData: [],
       currentClick:{},
@@ -138,6 +167,7 @@ export default {
       irrigationShow: false,
       editFarmerData: {},
       farmerId: '',
+      requestData: {},
       columns: [
         {
           label: '农户姓名',
@@ -183,6 +213,31 @@ export default {
     };
   },
   methods: {
+    handleAvatarSuccess(res, file) {
+      if (res.code !== '000000') {
+        Message.error(res?.msg)
+        return
+      } else { 
+        Message.error('导入成功')
+      }
+    },
+    handleUploadError() {
+      Message.error("图片插入失败");
+    },
+    beforeAvatarUpload(file) {
+      this.requestData = {
+        areaId: this.currentClickId
+      }
+    },
+    downloadExcel() {
+      let a = document.createElement("a");
+      a.href = "./assets/template.xlsx";
+      a.download = "农户信息统计表.xlsx";
+      a.style.display = "none";
+      document.body.appendChild(a);
+      a.click();
+      a.remove();
+    },
     editFarmerHandler(row) {
       this.associationManageShow = true
       this.isEdit = true