Sfoglia il codice sorgente

Merge branch 'master' of http://code.nyzhwlw.com:3000/com_yunfeiyun_develop/yf_water_price

yf_zhb 1 anno fa
parent
commit
caef85b08b
52 ha cambiato i file con 3112 aggiunte e 1922 eliminazioni
  1. 2 2
      .env.development
  2. BIN
      public/favicon.ico
  3. BIN
      public/favicon1.ico
  4. BIN
      public/static/template.xlsx
  5. 9 0
      src/api/card/index2.js
  6. 1 1
      src/api/farmer/list.js
  7. 8 2
      src/api/portal/portal.js
  8. 3 0
      src/assets/styles/index.scss
  9. 136 123
      src/assets/styles/ruoyi.scss
  10. 16 1
      src/components/DataReportLeft/index.vue
  11. 28 0
      src/components/WaterMark/index.vue
  12. 73 0
      src/components/WaterMark/js/devtools.js
  13. 132 0
      src/components/WaterMark/js/waterMark.js
  14. 0 1
      src/layout/components/Navbar.vue
  15. 6 0
      src/layout/components/Sidebar/Logo.vue
  16. 31 22
      src/layout/index.vue
  17. 11 1
      src/main.js
  18. 1 0
      src/permission.js
  19. 164 149
      src/router/index.js
  20. 14 0
      src/store/modules/settings.js
  21. 10 4
      src/store/modules/user.js
  22. 9 3
      src/utils/request.js
  23. 196 0
      src/utils/request2.js
  24. 201 202
      src/utils/sso.js
  25. 0 34
      src/views/dataReport/components/addedFarmers.vue
  26. 88 74
      src/views/dataReport/intakeWaterAnalysis.vue
  27. 21 4
      src/views/dataReport/saveWaterAnalysis.vue
  28. 23 3
      src/views/dataReport/waterConsumption.vue
  29. 13 1
      src/views/gisShow/components/rightEquipment.vue
  30. 1 1
      src/views/gisShow/index.vue
  31. 13 0
      src/views/home/index.vue
  32. 0 1
      src/views/infrastructure/components/recompose.vue
  33. 4 3
      src/views/infrastructure/components/setAnnualWaterRight.vue
  34. 420 0
      src/views/infrastructure/components/setAnnualWaterRightAdd.vue
  35. 16 2
      src/views/infrastructure/components/setPreferenc.vue
  36. 2 2
      src/views/infrastructure/components/waterPriceSetting.vue
  37. 92 60
      src/views/infrastructure/deviceSetup.vue
  38. 165 96
      src/views/infrastructure/waterElectricityPriceSetting.vue
  39. 65 45
      src/views/infrastructure/waterEstablishment.vue
  40. 91 203
      src/views/monitoringMamage/components/IrrigationRecord.vue
  41. 63 188
      src/views/monitoringMamage/components/realTimeMonitor.vue
  42. 286 217
      src/views/monitoringMamage/index.vue
  43. 74 35
      src/views/peasantHouseholdManage/components/addedFarmers.vue
  44. 144 94
      src/views/peasantHouseholdManage/index.vue
  45. 83 48
      src/views/waterCardManage/components/rechargeCard.vue
  46. 164 120
      src/views/waterCardManage/index.vue
  47. 70 56
      src/views/waterManage/index.vue
  48. 21 2
      src/views/waterMarket/component/waterDeal.vue
  49. 49 58
      src/views/waterMarket/index.vue
  50. 3 3
      src/views/waterSubsidy/components/newPolicy.vue
  51. 71 59
      src/views/waterSubsidy/index.vue
  52. 19 2
      vue.config.js

+ 2 - 2
.env.development

@@ -5,13 +5,13 @@ VUE_APP_TITLE = 水价改革管理系统
 ENV = 'development'
 
 # 开发环境 API BASEURL
-VUE_APP_BASE_API = 
+VUE_APP_BASE_API = '/wprprod-api'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
 
 #
-VUE_APP_BASE_RESOURCE_PREFIX = 
+VUE_APP_BASE_RESOURCE_PREFIX = /wprprod-api
 
 SYS_ID = TODO
 

BIN
public/favicon.ico


BIN
public/favicon1.ico


BIN
public/static/template.xlsx


+ 9 - 0
src/api/card/index2.js

@@ -0,0 +1,9 @@
+window.a = false;
+import request from '@/utils/request2';
+// 实时监测
+export const getDataInfo = (query) => {
+  return request({
+    url: `/icsprod-api/ics/tmn/data/info/${query}`,
+    method: 'get'
+  });
+};

+ 1 - 1
src/api/farmer/list.js

@@ -61,7 +61,7 @@ export const importExcel = (data) => {
 // 查询
 export const getAreaInfo = (query) => {
   return request({
-    url: ' /wpr/waterright/area/info',
+    url: '/wpr/waterright/area/info',
     method: 'get',
     params: query
   });

+ 8 - 2
src/api/portal/portal.js

@@ -5,8 +5,8 @@ const baseURL = process.env.VUE_APP_BASE_API;
 
 // 获取portal配置
 export async function getSsoInfo() {
-  let res = await axios({ method: 'get', url: baseURL + '/portal/cfg/cfg' });
-  let cfg =
+  const res = await axios({ method: 'get', url: baseURL + '/portal/cfg/cfg' });
+  const cfg =
     res.status === 200 &&
     res.data &&
     res.data.code === '000000' &&
@@ -21,3 +21,9 @@ export function fetchSSOConfigInfo() {
     method: 'get'
   });
 }
+export function getPortalImg() {
+  return request({
+    url: '/portalprod-api/system/theme/info',
+    method: 'get'
+  });
+}

+ 3 - 0
src/assets/styles/index.scss

@@ -18,6 +18,9 @@ body {
   font-family: SourceHanSansCnRegular, SimSun, '宋体';
 }
 
+.el-select-dropdown__empty{
+  display: none !important;
+}
 label {
   font-weight: 700;
 }

+ 136 - 123
src/assets/styles/ruoyi.scss

@@ -1,129 +1,141 @@
- /**
+/**
  * 通用css样式布局处理
  * Copyright (c) 2019 杨晓辉
  */
 
- /** 基础通用 **/
+/** 基础通用 **/
 .pt5 {
-	padding-top: 5px;
+  padding-top: 5px;
 }
 .pr5 {
-	padding-right: 5px;
+  padding-right: 5px;
 }
 .pb5 {
-	padding-bottom: 5px;
+  padding-bottom: 5px;
 }
 .mt5 {
-	margin-top: 5px;
+  margin-top: 5px;
 }
 .mr5 {
-	margin-right: 5px;
+  margin-right: 5px;
 }
 .mb5 {
-	margin-bottom: 5px;
+  margin-bottom: 5px;
 }
 .mb8 {
-	margin-bottom: 8px;
+  margin-bottom: 8px;
 }
 .ml5 {
-	margin-left: 5px;
+  margin-left: 5px;
 }
 .mt10 {
-	margin-top: 10px;
+  margin-top: 10px;
 }
 .mr10 {
-	margin-right: 10px;
+  margin-right: 10px;
 }
 .mb10 {
-	margin-bottom: 10px;
+  margin-bottom: 10px;
 }
 .ml10 {
-	margin-left: 10px;
+  margin-left: 10px;
 }
 .mt20 {
-	margin-top: 20px;
+  margin-top: 20px;
 }
 .mr20 {
-	margin-right: 20px;
+  margin-right: 20px;
 }
 .mb20 {
-	margin-bottom: 20px;
+  margin-bottom: 20px;
 }
 .ml20 {
-	margin-left: 20px;
+  margin-left: 20px;
 }
 
-.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
-	font-family: inherit;
-	font-weight: 500;
-	line-height: 1.1;
-	color: inherit;
+.h1,
+.h2,
+.h3,
+.h4,
+.h5,
+.h6,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+  font-family: inherit;
+  font-weight: 500;
+  line-height: 1.1;
+  color: inherit;
 }
 
-.el-message-box__status + .el-message-box__message{
-    word-break: break-word;
+.el-message-box__status + .el-message-box__message {
+  word-break: break-word;
 }
 
 .el-dialog:not(.is-fullscreen) {
-	margin-top: 6vh !important;
+  margin-top: 6vh !important;
 }
 
 .el-dialog__wrapper.scrollbar .el-dialog .el-dialog__body {
-    overflow: auto;
-	overflow-x: hidden;
-	max-height: 70vh;
-	padding: 10px 20px 0;
+  overflow: auto;
+  overflow-x: hidden;
+  max-height: 70vh;
+  padding: 10px 20px 0;
 }
 
 .el-table {
-	.el-table__header-wrapper, .el-table__fixed-header-wrapper {
-		th {
-			word-break: break-word;
-			background-color: #f8f8f9;
-			color: #515a6e;
-			height: 40px;
-			font-size: 13px;
-		}
-	}
-	.el-table__body-wrapper {
-		.el-button [class*="el-icon-"] + span {
-			margin-left: 1px;
-		}
-	}
+  .el-table__header-wrapper,
+  .el-table__fixed-header-wrapper {
+    th {
+      word-break: break-word;
+      background-color: #f8f8f9;
+      color: #515a6e;
+      height: 40px;
+      font-size: 13px;
+    }
+  }
+  .el-table__body-wrapper {
+    .el-button [class*='el-icon-'] + span {
+      margin-left: 1px;
+    }
+  }
 }
 
 /** 表单布局 **/
 .form-header {
-    font-size:15px;
-	color:#6379bb;
-	border-bottom:1px solid #ddd;
-	margin:8px 10px 25px 10px;
-	padding-bottom:5px
+  font-size: 15px;
+  color: #6379bb;
+  border-bottom: 1px solid #ddd;
+  margin: 8px 10px 25px 10px;
+  padding-bottom: 5px;
 }
 
 /** 表格布局 **/
 .pagination-container {
-	position: relative;
-	height: 25px;
-	margin-bottom: 10px;
-	margin-top: 15px;
-	padding: 10px 20px !important;
+  position: relative;
+  height: 25px;
+  margin-bottom: 10px;
+  margin-top: 15px;
+  padding: 10px 20px !important;
 }
 
 /* tree border */
 .tree-border {
-    margin-top: 5px;
-    border: 1px solid #e5e6e7;
-    background: #FFFFFF none;
-    border-radius:4px;
+  margin-top: 5px;
+  border: 1px solid #e5e6e7;
+  background: #ffffff none;
+  border-radius: 4px;
 }
 
 .pagination-container .el-pagination {
-	right: 0;
-	position: absolute;
+  right: 0;
+  position: absolute;
 }
 
-@media ( max-width : 768px) {
+@media (max-width: 768px) {
   .pagination-container .el-pagination > .el-pagination__jump {
     display: none !important;
   }
@@ -133,145 +145,146 @@
 }
 
 .el-table .fixed-width .el-button--mini {
-	padding-left: 0;
-	padding-right: 0;
-	width: inherit;
+  padding-left: 0;
+  padding-right: 0;
+  width: inherit;
 }
 
 /** 表格更多操作下拉样式 */
-.el-table .el-dropdown-link,.el-table .el-dropdown-selfdefine {
-	cursor: pointer;
-	margin-left: 5px;
+.el-table .el-dropdown-link,
+.el-table .el-dropdown-selfdefine {
+  cursor: pointer;
+  margin-left: 5px;
 }
 
-.el-table .el-dropdown, .el-icon-arrow-down {
-	font-size: 12px;
+.el-table .el-dropdown,
+.el-icon-arrow-down {
+  font-size: 12px;
 }
 
 .el-tree-node__content > .el-checkbox {
-	margin-right: 8px;
+  margin-right: 8px;
 }
 
 .list-group-striped > .list-group-item {
-	border-left: 0;
-	border-right: 0;
-	border-radius: 0;
-	padding-left: 0;
-	padding-right: 0;
+  border-left: 0;
+  border-right: 0;
+  border-radius: 0;
+  padding-left: 0;
+  padding-right: 0;
 }
 
 .list-group {
-	padding-left: 0px;
-	list-style: none;
+  padding-left: 0px;
+  list-style: none;
 }
 
 .list-group-item {
-	border-bottom: 1px solid #e7eaec;
-	border-top: 1px solid #e7eaec;
-	margin-bottom: -1px;
-	padding: 11px 0px;
-	font-size: 13px;
+  border-bottom: 1px solid #e7eaec;
+  border-top: 1px solid #e7eaec;
+  margin-bottom: -1px;
+  padding: 11px 0px;
+  font-size: 13px;
 }
 
 .pull-right {
-	float: right !important;
+  float: right !important;
 }
 
 .el-card__header {
-	padding: 14px 15px 7px;
-	min-height: 40px;
+  padding: 14px 15px 7px;
+  min-height: 40px;
 }
 
 .el-card__body {
-	padding: 15px 20px 20px 20px;
+  padding: 15px 20px 20px 20px;
 }
 
 .card-box {
-	padding-right: 15px;
-	padding-left: 15px;
-	margin-bottom: 10px;
+  padding-right: 15px;
+  padding-left: 15px;
+  margin-bottom: 10px;
 }
 
 /* button color */
 .el-button--cyan.is-active,
 .el-button--cyan:active {
-  background: #20B2AA;
-  border-color: #20B2AA;
-  color: #FFFFFF;
+  background: #20b2aa;
+  border-color: #20b2aa;
+  color: #ffffff;
 }
 
 .el-button--cyan:focus,
 .el-button--cyan:hover {
-  background: #48D1CC;
-  border-color: #48D1CC;
-  color: #FFFFFF;
+  background: #48d1cc;
+  border-color: #48d1cc;
+  color: #ffffff;
 }
 
 .el-button--cyan {
-  background-color: #20B2AA;
-  border-color: #20B2AA;
-  color: #FFFFFF;
+  background-color: #20b2aa;
+  border-color: #20b2aa;
+  color: #ffffff;
 }
 
 /* text color */
 .text-navy {
-	color: #1ab394;
+  color: #1ab394;
 }
 
 .text-primary {
-	color: inherit;
+  color: inherit;
 }
 
 .text-success {
-	color: #1c84c6;
+  color: #1c84c6;
 }
 
 .text-info {
-	color: #23c6c8;
+  color: #23c6c8;
 }
 
 .text-warning {
-	color: #f8ac59;
+  color: #f8ac59;
 }
 
 .text-danger {
-	color: #ed5565;
+  color: #ed5565;
 }
 
 .text-muted {
-	color: #888888;
+  color: #888888;
 }
 
 /* image */
 .img-circle {
-	border-radius: 50%;
+  border-radius: 50%;
 }
 
 .img-lg {
-	width: 120px;
-	height: 120px;
+  width: 120px;
+  height: 120px;
 }
 
 .avatar-upload-preview {
-	position: relative;
-	top: 50%;
-	left: 50%;
-	transform: translate(-50%, -50%);
-	width: 200px;
-	height: 200px;
-	border-radius: 50%;
-	box-shadow: 0 0 4px #ccc;
-	overflow: hidden;
+  position: relative;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+  width: 200px;
+  height: 200px;
+  box-shadow: 0 0 4px #ccc;
+  overflow: hidden;
 }
 
 /* 拖拽列样式 */
-.sortable-ghost{
-	opacity: .8;
-	color: #fff!important;
-	background: #42b983!important;
+.sortable-ghost {
+  opacity: 0.8;
+  color: #fff !important;
+  background: #42b983 !important;
 }
 
 .top-right-btn {
-	position: relative;
-	float: right;
+  position: relative;
+  float: right;
 }

+ 16 - 1
src/components/DataReportLeft/index.vue

@@ -2,8 +2,11 @@
   <div>
     <el-tree
      :data="treeData"
+     ref="tree"
      node-key="id"
+     :highlight-current="true"
      :default-expanded-keys="[1]"
+     :current-node-key="currentNodekey"
      :props="defaultProps"
      @node-click="handleNodeClick"
      ></el-tree>
@@ -24,11 +27,23 @@ export default {
         children: 'children',
         label: 'cusareaName'
       },
+      currentNodekey: ''
     };
   },
+  watch: {
+    treeData: { 
+      handler(res) {
+        this.currentNodekey = res[0].id;
+        this.$nextTick(() => {
+          this.$refs.tree.setCurrentKey(this.currentNodekey);
+        });
+      },
+      deep: true
+    }
+  },
   methods: {
     handleNodeClick(data) {
-      this.$emit("setCurrentData",data?.cusareaId)
+      this.$emit("setCurrentData",data?.cusareaId,data)
     }
   }
 };

+ 28 - 0
src/components/WaterMark/index.vue

@@ -0,0 +1,28 @@
+<template>
+  <div class="water-mark" ref="waterMark"></div>
+</template>
+<script>
+import { watermarkText } from './js/waterMark';
+import './js/devtools';
+
+export default {
+  mounted() {
+    watermarkText(this.$refs.waterMark, '云飞科技', {
+      width: 200,
+      start: -30
+    });
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.water-mark {
+  position: fixed;
+  width: 100%;
+  height: 100vh;
+  left: 0;
+  top: 0;
+  pointer-events: none;
+  z-index: 1000;
+}
+</style>

+ 73 - 0
src/components/WaterMark/js/devtools.js

@@ -0,0 +1,73 @@
+(() => {
+  function block() {
+    // if (
+    //   window.outerHeight - window.innerHeight > 200 ||
+    //   window.outerWidth - window.innerWidth > 200
+    // ) {
+    //   document.body.innerHTML = '检测到非法调试,请关闭后刷新重试!';
+    // }
+    // setInterval(() => {
+    //   (function () {
+    //     return false;
+    //   })
+    //     ['constructor']('debugger')
+    //     ['call']();
+    // }, 50);
+
+    setInterval(() => {
+      Function('debugger')();
+    }, 50);
+  }
+  try {
+    window.onkeydown =
+      window.onkeyup =
+      window.onkeypress =
+        function (event) {
+          // 判断是否按下F12,F12键码为123
+          if (event.keyCode === 123) {
+            event.preventDefault(); // 阻止默认事件行为
+            window.event.returnValue = false;
+          }
+        };
+
+    window.oncontextmenu = function () {
+      event.preventDefault(); // 阻止默认事件行为
+      return false;
+    };
+
+    block();
+  } catch (err) {}
+})();
+
+!(function () {
+  var _0x1cbb = ['tor', 'struc', 'call', 'ger', 'con', 'bug', 'de', 'apply'];
+  setInterval(check, 2e3);
+  function check() {
+    function doCheck(_0x1834ff) {
+      if (
+        ('' + _0x1834ff / _0x1834ff)['length'] !== 0x1 ||
+        _0x1834ff % 0x14 === 0x0
+      ) {
+        (function () {
+          return !![];
+        })
+          [_0x1cbb[0x4] + _0x1cbb[0x1] + _0x1cbb[0x0]](
+            _0x1cbb[0x6] + _0x1cbb[0x5] + _0x1cbb[0x3]
+          )
+          [_0x1cbb[0x2]]();
+      } else {
+        (function () {
+          return ![];
+        })
+          [_0x1cbb[0x4] + _0x1cbb[0x1] + _0x1cbb[0x0]](
+            _0x1cbb[0x6] + _0x1cbb[0x5] + _0x1cbb[0x3]
+          )
+          [_0x1cbb[0x7]]();
+      }
+      doCheck(++_0x1834ff);
+    }
+    try {
+      doCheck(0);
+    } catch (err) {}
+  }
+})();

+ 132 - 0
src/components/WaterMark/js/waterMark.js

@@ -0,0 +1,132 @@
+// 创建画布
+function createCanvas(width, height) {
+  // 创建一个画布
+  let canvas = document.createElement('canvas');
+  // 设置画布的宽高
+  canvas.width = width;
+  canvas.height = height;
+
+  return {
+    canvas,
+    ctx: canvas.getContext('2d')
+  };
+}
+
+// 填充水印
+function fillMark(canvas, html) {
+  html.style.pointerEvents = 'none';
+  html.style.background =
+    'url(' + canvas.toDataURL('image/png') + ') left top repeat';
+}
+
+// 文字水印生成
+export function watermarkText(html, str, options = {}) {
+  let {
+    fontSize = 18, // 设置字体大小
+    fontFamily = 'Vedana', // 设置字体
+    width = str.length * fontSize, // 设置画布的宽
+    height = 320, // 设置画布的高
+    color = 'rgba(0, 0, 0, 0.3)', // 设置填充绘画的颜色/渐变模式
+    angle = -25, // 旋转角度
+    textAlign = 'left', // 设置文本内容的对齐方式
+    font, // 设置字体及大小
+    textBaseline = 'Middle', // 设置文本基线
+    start = 0, // 开始绘制文本的X坐标位置
+    end = height / 1.2 // 开始绘制文本的Y坐标位置
+  } = options;
+
+  // 创建画布
+  let cans = createCanvas(width, height);
+  let canvas = cans.canvas;
+  let ctx = cans.ctx;
+  ctx.rotate((angle * Math.PI) / 180);
+  ctx.font = font || fontSize + 'px ' + fontFamily;
+  ctx.fillStyle = color;
+  ctx.textAlign = textAlign;
+  ctx.textBaseline = textBaseline;
+  // 在画布上绘制填色的文本(输出的文本,开始绘制文本的X坐标位置,开始绘制文本的Y坐标位置)
+  ctx.fillText(str, start, end);
+  // 填充水印
+  fillMark(canvas, html);
+}
+
+// 图片水印生成
+export function watermarkImg(html, options = {}) {
+  let {
+    width = 200, // 设置画布的宽
+    height = 120, // 设置画布的高
+    angle = -25, // 旋转角度
+    x = 0, // 放置图像的x坐标
+    y = height / 1.5, // 放置图像的y坐标
+    src = '' // 图片地址
+  } = options;
+
+  // 创建画布
+  let cans = createCanvas(width, height);
+  let canvas = cans.canvas;
+  let ctx = cans.ctx;
+  ctx.rotate((angle * Math.PI) / 180);
+  let img = new Image(); // 创建图片
+  img.onload = function (e) {
+    // 监听图片加载完成
+    ctx.drawImage(img, x, y, this.width, this.height);
+    // 填充水印
+    fillMark(canvas, html);
+  };
+  img.src = src;
+}
+
+export class SvgWay {
+  constructor(watermark) {
+    this.watermark = watermark;
+  }
+
+  render() {
+    const { txt, x, y, width, height, color, font, fontSize, alpha, angle } =
+      this.watermark;
+    const svgStr = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}px" height="${height}px">
+                <text x="${x}px" y="${y}px" dy="${fontSize}px"
+                    text-anchor="start"
+                    stroke="${color}"
+                    stroke-opacity="${alpha}"
+                    fill="none"
+                    transform="rotate(${angle},${x} ${y})"
+                    font-weight="100"
+                    font-size="${fontSize}"
+                    font-family="${font}"
+                    >
+                    ${txt}
+                </text>
+            </svg>`;
+    return `data:image/svg+xml;base64,${window.btoa(
+      unescape(encodeURIComponent(svgStr))
+    )}`;
+  }
+}
+
+export class CanvasWay {
+  constructor(watermark) {
+    this.watermark = watermark;
+    const { width, height } = watermark;
+    this.canvas = document.createElement('canvas');
+    this.canvas.setAttribute('width', width);
+    this.canvas.setAttribute('height', height);
+  }
+
+  render() {
+    const { txt, x, y, width, height, font, color, fontSize, alpha, angle } =
+      this.watermark;
+    const ctx = this.canvas.getContext('2d');
+    ctx.clearRect(0, 0, width, height);
+    ctx.textBaseline = 'top';
+    ctx.textAlign = 'left';
+    ctx.fillStyle = color;
+    ctx.globalAlpha = alpha;
+    ctx.font = `${fontSize}px ${font}`;
+    ctx.translate(x, y);
+    ctx.rotate((Math.PI / 180) * angle);
+    ctx.translate(-x, -y - fontSize);
+    ctx.fillText(txt, x, y + fontSize);
+    return this.canvas.toDataURL();
+  }
+}

+ 0 - 1
src/layout/components/Navbar.vue

@@ -177,7 +177,6 @@ export default {
           width: 32px;
           height: 32px;
           margin-right: 10px;
-          border-radius: 50%;
         }
 
         .user-name {

+ 6 - 0
src/layout/components/Sidebar/Logo.vue

@@ -51,6 +51,7 @@
 <script>
 import logoImg from '@/assets/images/logo.png';
 import variables from '@/assets/styles/variables.scss';
+import { mapState } from 'vuex';
 
 export default {
   name: 'SidebarLogo',
@@ -61,6 +62,11 @@ export default {
     }
   },
   computed: {
+    ...mapState({
+      logo: function (state) {
+        return this.formatImg(state.settings.logo) || logoImg;
+      }
+    }),
     variables() {
       return variables;
     },

+ 31 - 22
src/layout/index.vue

@@ -1,27 +1,30 @@
 <template>
-  <div
-    :class="classObj"
-    class="app-wrapper"
-    :style="{ '--current-color': theme }"
-  >
+  <div>
+    <WaterMark v-if="userRegion == 'EXPERIENCE'" />
     <div
-      v-if="device === 'mobile' && sidebar.opened"
-      class="drawer-bg"
-      @click="handleClickOutside"
-    />
-    <sidebar v-if="!sidebar.hide" class="sidebar-container" />
-    <div
-      :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
-      class="main-container"
+      :class="classObj"
+      class="app-wrapper"
+      :style="{ '--current-color': theme }"
     >
-      <div :class="{ 'fixed-header': fixedHeader }">
-        <navbar />
-        <tags-view v-if="needTagsView" />
+      <div
+        v-if="device === 'mobile' && sidebar.opened"
+        class="drawer-bg"
+        @click="handleClickOutside"
+      />
+      <sidebar v-if="!sidebar.hide" class="sidebar-container" />
+      <div
+        :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
+        class="main-container"
+      >
+        <div :class="{ 'fixed-header': fixedHeader }">
+          <navbar />
+          <tags-view v-if="needTagsView" />
+        </div>
+        <app-main />
+        <right-panel>
+          <settings />
+        </right-panel>
       </div>
-      <app-main />
-      <right-panel>
-        <settings />
-      </right-panel>
     </div>
   </div>
 </template>
@@ -32,6 +35,7 @@ import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components';
 import ResizeMixin from './mixin/ResizeHandler';
 import { mapState } from 'vuex';
 import variables from '@/assets/styles/variables.scss';
+import WaterMark from '@/components/WaterMark';
 
 export default {
   name: 'Layout',
@@ -41,7 +45,8 @@ export default {
     RightPanel,
     Settings,
     Sidebar,
-    TagsView
+    TagsView,
+    WaterMark
   },
   mixins: [ResizeMixin],
   computed: {
@@ -51,7 +56,8 @@ export default {
       sidebar: (state) => state.app.sidebar,
       device: (state) => state.app.device,
       needTagsView: (state) => state.settings.tagsView,
-      fixedHeader: (state) => state.settings.fixedHeader
+      fixedHeader: (state) => state.settings.fixedHeader,
+      userInfo: (state) => state.user.userInfo
     }),
     classObj() {
       return {
@@ -65,6 +71,9 @@ export default {
       return variables;
     }
   },
+  created() {
+    this.userRegion = this.userInfo.userRegion;
+  },
   methods: {
     handleClickOutside() {
       this.$store.dispatch('app/closeSideBar', { withoutAnimation: false });

+ 11 - 1
src/main.js

@@ -1,7 +1,7 @@
 import Vue from 'vue';
 
 import Cookies from 'store';
-
+import { startsWith } from 'lodash-es';
 import Element from 'element-ui';
 import './assets/styles/element-variables.scss';
 import 'fontawesome-free-6.2.1/css/all.min.css';
@@ -49,7 +49,17 @@ import VueMeta from 'vue-meta';
 import DictData from '@/components/DictData';
 
 import VueAMap from 'vue-amap';
+function formatImg(url) {
+  const prefix = process.env.VUE_APP_BASE_API;
+
+  if (!url) {
+    return '-';
+  }
+
+  return startsWith(url, 'http') ? url : prefix + url;
+}
 
+Vue.filter('formatImg', formatImg);
 // 全局方法挂载
 Vue.prototype.getDataByDatatypeCode = getDataByDatatypeCode;
 Vue.prototype.getConfigKey = getConfigKey;

+ 1 - 0
src/permission.js

@@ -31,6 +31,7 @@ router.beforeEach(async (to, from, next) => {
   }
   refreshTitle();
   if (token) {
+    store.dispatch('settings/getPortalSystemInfo');
     to.meta.title && store.dispatch('settings/setTitle', to.meta.title);
     /* has token*/
     if (to.path === '/login') {

+ 164 - 149
src/router/index.js

@@ -49,155 +49,170 @@ export const constantRoutes = [
       }
     ]
   },
-  {
-    path: '/waterCardManageDataDetail',
-    component: () => import('@/views/waterCardManage/dataDetail'),
-    hidden: true
-  },
-  {
-    path: '/',
-    component: Layout,
-    redirect: '/home',
-    children: [
-      {
-        path: 'home',
-        name: 'home',
-        meta: { title: '首页',icon:'peoples' },
-        component: () => import('@/views/home')
-      }
-    ]
-  },{
-    path: '/gisShow',
-    component: Layout,
-    redirect: '/gisShow',
-    children: [
-      {
-        path: 'gisShow',
-        name: 'gisShow',
-        meta: { title: 'GIS 展示',icon:'shopping' },
-        component: () => import('@/views/gisShow')
-      }
-    ]
-  },
-  {
-    path: '/monitoringMamage',
-    component: Layout,
-    redirect: '/monitoringMamage',
-    children: [
-      {
-        path: 'monitoringMamage',
-        name: 'monitoringMamage',
-        meta: { title: '监测管理',icon:'shopping' },
-        component: () => import('@/views/monitoringMamage')
-      }
-    ]
-  },{
-    path: '/peasantHouseholdManage',
-    component: Layout,
-    redirect: '/peasantHouseholdManage',
-    children: [
-      {
-        path: 'peasantHouseholdManage',
-        name: 'peasantHouseholdManage',
-        meta: { title: '农户管理',icon:'peoples' },
-        component: () => import('@/views/peasantHouseholdManage')
-      }
-    ]
-  },{
-    path: '/waterCardManage',
-    component: Layout,
-    redirect: '/waterCardManage',
-    children: [
-      {
-        path: 'waterCardManage',
-        name: 'waterCardManage',
-        meta: { title: '水卡管理',icon:'shopping' },
-        component: () => import('@/views/waterCardManage')
-      }
-    ]
-  },{
-    path: '/infrastructure',
-    component: Layout,
-    redirect: '/waterEstablishment',
-    meta: { title: '基础设施', icon: 'peoples' },
-    children: [
-      {
-        path: 'waterEstablishment',
-        name: 'waterEstablishment',
-        meta: { title: '水权设置',icon:'shopping' },
-        component: () => import('@/views/infrastructure/waterEstablishment')
-      },{
-        path: 'waterElectricityPriceSetting',
-        name: 'waterElectricityPriceSetting',
-        meta: { title: '水电价设置',icon:'shopping' },
-        component: () => import('@/views/infrastructure/waterElectricityPriceSetting')
-      },{
-        path: 'deviceSetup',
-        name: 'deviceSetup',
-        meta: { title: '设备管理',icon:'shopping' },
-        component: () => import('@/views/infrastructure/deviceSetup')
-      }
-    ]
-  },{
-    path: '/dataReport',
-    component: Layout,
-    redirect: '/intakeWaterAnalysis',
-    meta: { title: '数据报表', icon: 'peoples' },
-    children: [
-      {
-        path: 'intakeWaterAnalysis',
-        name: 'intakeWaterAnalysis',
-        meta: { title: '用水统计(组织)',icon:'shopping' },
-        component: () => import('@/views/dataReport/intakeWaterAnalysis')
-      },{
-        path: 'saveWaterAnalysis',
-        name: 'saveWaterAnalysis',
-        meta: { title: '节水分析(农户)',icon:'shopping' },
-        component: () => import('@/views/dataReport/saveWaterAnalysis')
-      },{
-        path: 'waterConsumption',
-        name: 'waterConsumption',
-        meta: { title: '取水分析(机井)',icon:'shopping' },
-        component: () => import('@/views/dataReport/waterConsumption')
-      },
-    ]
-  },{
-    path: '/waterSubsidy',
-    component: Layout,
-    redirect: '/waterSubsidy',
-    children: [
-      {
-        path: 'waterSubsidy',
-        name: 'waterSubsidy',
-        meta: { title: '节水政策补贴',icon:'shopping' },
-        component: () => import('@/views/waterSubsidy')
-      }
-    ]
-  },{
-    path: '/waterMarket',
-    component: Layout,
-    redirect: '/waterMarket',
-    children: [
-      {
-        path: 'waterMarket',
-        name: 'waterMarket',
-        meta: { title: '水权交易',icon:'shopping' },
-        component: () => import('@/views/waterMarket')
-      }
-    ]
-  },{
-    path: '/waterManage',
-    component: Layout,
-    redirect: '/waterManage',
-    children: [
-      {
-        path: 'waterManage',
-        name: 'waterManage',
-        meta: { title: '用水协会管理',icon:'shopping' },
-        component: () => import('@/views/waterManage')
-      }
-    ]
-  },
+
+  // {
+  //   path: '/waterCardManageDataDetail',
+  //   component: () => import('@/views/waterCardManage/dataDetail'),
+  //   hidden: true
+  // },
+  // {
+  //   path: '/',
+  //   component: Layout,
+  //   redirect: '/home',
+  //   children: [
+  //     {
+  //       path: 'home',
+  //       name: 'home',
+  //       meta: { title: '首页', icon: 'peoples' },
+  //       component: () => import('@/views/home')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/gisShow',
+  //   component: Layout,
+  //   redirect: '/gisShow',
+  //   children: [
+  //     {
+  //       path: 'gisShow',
+  //       name: 'gisShow',
+  //       meta: { title: 'GIS 展示', icon: 'shopping' },
+  //       component: () => import('@/views/gisShow')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/monitoringMamage',
+  //   component: Layout,
+  //   redirect: '/monitoringMamage',
+  //   children: [
+  //     {
+  //       path: 'monitoringMamage',
+  //       name: 'monitoringMamage',
+  //       meta: { title: '监测管理', icon: 'shopping' },
+  //       component: () => import('@/views/monitoringMamage')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/peasantHouseholdManage',
+  //   component: Layout,
+  //   redirect: '/peasantHouseholdManage',
+  //   children: [
+  //     {
+  //       path: 'peasantHouseholdManage',
+  //       name: 'peasantHouseholdManage',
+  //       meta: { title: '农户管理', icon: 'peoples' },
+  //       component: () => import('@/views/peasantHouseholdManage')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterCardManage',
+  //   component: Layout,
+  //   redirect: '/waterCardManage',
+  //   children: [
+  //     {
+  //       path: 'waterCardManage',
+  //       name: 'waterCardManage',
+  //       meta: { title: '水卡管理', icon: 'shopping' },
+  //       component: () => import('@/views/waterCardManage')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/infrastructure',
+  //   component: Layout,
+  //   redirect: '/waterEstablishment',
+  //   meta: { title: '基础设施', icon: 'peoples' },
+  //   children: [
+  //     {
+  //       path: 'waterEstablishment',
+  //       name: 'waterEstablishment',
+  //       meta: { title: '水权设置', icon: 'shopping' },
+  //       component: () => import('@/views/infrastructure/waterEstablishment')
+  //     },
+  //     {
+  //       path: 'waterElectricityPriceSetting',
+  //       name: 'waterElectricityPriceSetting',
+  //       meta: { title: '水电价设置', icon: 'shopping' },
+  //       component: () =>
+  //         import('@/views/infrastructure/waterElectricityPriceSetting')
+  //     },
+  //     {
+  //       path: 'deviceSetup',
+  //       name: 'deviceSetup',
+  //       meta: { title: '设备管理', icon: 'shopping' },
+  //       component: () => import('@/views/infrastructure/deviceSetup')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/dataReport',
+  //   component: Layout,
+  //   redirect: '/intakeWaterAnalysis',
+  //   meta: { title: '数据报表', icon: 'peoples' },
+  //   children: [
+  //     {
+  //       path: 'intakeWaterAnalysis',
+  //       name: 'intakeWaterAnalysis',
+  //       meta: { title: '用水统计(组织)', icon: 'shopping' },
+  //       component: () => import('@/views/dataReport/intakeWaterAnalysis')
+  //     },
+  //     {
+  //       path: 'saveWaterAnalysis',
+  //       name: 'saveWaterAnalysis',
+  //       meta: { title: '节水分析(农户)', icon: 'shopping' },
+  //       component: () => import('@/views/dataReport/saveWaterAnalysis')
+  //     },
+  //     {
+  //       path: 'waterConsumption',
+  //       name: 'waterConsumption',
+  //       meta: { title: '取水分析(机井)', icon: 'shopping' },
+  //       component: () => import('@/views/dataReport/waterConsumption')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterSubsidy',
+  //   component: Layout,
+  //   redirect: '/waterSubsidy',
+  //   children: [
+  //     {
+  //       path: 'waterSubsidy',
+  //       name: 'waterSubsidy',
+  //       meta: { title: '节水政策补贴', icon: 'shopping' },
+  //       component: () => import('@/views/waterSubsidy')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterMarket',
+  //   component: Layout,
+  //   redirect: '/waterMarket',
+  //   children: [
+  //     {
+  //       path: 'waterMarket',
+  //       name: 'waterMarket',
+  //       meta: { title: '水权交易', icon: 'shopping' },
+  //       component: () => import('@/views/waterMarket')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterManage',
+  //   component: Layout,
+  //   redirect: '/waterManage',
+  //   children: [
+  //     {
+  //       path: 'waterManage',
+  //       name: 'waterManage',
+  //       meta: { title: '用水协会管理', icon: 'shopping' },
+  //       component: () => import('@/views/waterManage')
+  //     }
+  //   ]
+  // },
+
   {
     path: '/login',
     component: () => import('@/views/login'),

+ 14 - 0
src/store/modules/settings.js

@@ -1,4 +1,5 @@
 import defaultSettings from '@/settings';
+import { getPortalImg } from '@/api/portal/portal';
 
 const {
   sideTheme,
@@ -14,6 +15,7 @@ const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '';
 const state = {
   title: '',
   theme: storageSetting.theme || '#14A478',
+  logo: '',
   sideTheme: storageSetting.sideTheme || sideTheme,
   showSettings: showSettings,
   topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
@@ -48,6 +50,18 @@ const actions = {
   // 设置网页标题
   setTitle({ commit }, title) {
     state.title = title;
+  },
+  getPortalSystemInfo(context) {
+    const { commit, state } = context;
+    if (state.logo) {
+      return Promise.resolve(state.logo);
+    }
+
+    return getPortalImg().then((res) => {
+      commit('CHANGE_SETTING', { key: 'logo', value: res.data.logoUrl });
+
+      return res.data;
+    });
   }
 };
 

+ 10 - 4
src/store/modules/user.js

@@ -63,10 +63,16 @@ const user = {
         getInfo()
           .then((res) => {
             const user = res.user;
-            const avatar =
-              user.userAvatar == '' || user.userAvatar == null
-                ? require('@/assets/images/profile.jpg')
-                : process.env.VUE_APP_BASE_API + user.userAvatar;
+            let avatar = '';
+            if (user.userAvatar != null && user.userAvatar !== '') {
+              if (String(user.userAvatar).startsWith('http')) {
+                avatar = user.userAvatar;
+              } else {
+                avatar = process.env.VUE_APP_BASE_API + user.userAvatar;
+              }
+            } else {
+              avatar = require('@/assets/images/profile.jpg');
+            }
             if (res.roles && res.roles.length > 0) {
               // 验证返回的roles是否是一个非空数组
               commit('SET_ROLES', res.roles);

+ 9 - 3
src/utils/request.js

@@ -6,7 +6,7 @@ import errorCode from '@/utils/errorCode';
 import { tansParams, blobValidate } from '@/utils/ruoyi';
 import cache from '@/plugins/cache';
 import { saveAs } from 'file-saver';
-
+const whitePrefixUrlList = ['/iot', '/portalprod-api'];
 let downloadLoadingInstance;
 // 是否显示重新登录
 export const isRelogin = { show: false };
@@ -23,6 +23,12 @@ const service = axios.create({
 // request拦截器
 service.interceptors.request.use(
   (config) => {
+    const isHideBaseUrl =
+      whitePrefixUrlList.findIndex((item) => config.url.includes(item)) > -1;
+
+    if (isHideBaseUrl) {
+      config.baseURL = '';
+    }
     if (config.url.includes('/iot')) {
       config.baseURL = '';
     }
@@ -165,10 +171,10 @@ export function download(url, params, filename, config) {
     .post(url, params, {
       transformRequest: [
         (params) => {
-          return tansParams(params);
+          return JSON.stringify(params);
         }
       ],
-      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+      // headers: { 'Content-Type': 'multipart/form-data' },
       responseType: 'blob',
       ...config
     })

+ 196 - 0
src/utils/request2.js

@@ -0,0 +1,196 @@
+import axios from 'axios';
+import { Notification, MessageBox, Message, Loading } from 'element-ui';
+import store from '@/store';
+import { getToken } from '@/utils/auth';
+import errorCode from '@/utils/errorCode';
+import { tansParams, blobValidate } from '@/utils/ruoyi';
+import cache from '@/plugins/cache';
+import { saveAs } from 'file-saver';
+
+let downloadLoadingInstance;
+// 是否显示重新登录
+export const isRelogin = { show: false };
+console.log(process.env.VUE_APP_BASE_API, 'process.env.VUE_APP_BASE_API');
+axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
+// 创建axios实例
+const service = axios.create({
+  // axios中请求配置有baseURL选项,表示请求URL公共部分
+  baseURL: '',
+  // 超时
+  timeout: 30000
+});
+
+// request拦截器
+service.interceptors.request.use(
+  (config) => {
+    if (config.url.includes('/iot')) {
+      config.baseURL = '';
+    }
+
+    // 是否需要设置 token
+    const isToken = (config.headers || {}).isToken === false;
+    // 是否需要防止数据重复提交
+    const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
+    if (getToken() && !isToken) {
+      config.headers['Authorization'] = 'Bearer ' + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
+    }
+    // get请求映射params参数
+    if (config.method === 'get' && config.params) {
+      let url = config.url + '?' + tansParams(config.params);
+      url = url.slice(0, -1);
+      config.params = {};
+      config.url = url;
+    }
+    if (
+      !isRepeatSubmit &&
+      (config.method === 'post' || config.method === 'put')
+    ) {
+      const requestObj = {
+        url: config.url,
+        data:
+          typeof config.data === 'object'
+            ? JSON.stringify(config.data)
+            : config.data,
+        time: new Date().getTime()
+      };
+      const sessionObj = cache.session.getJSON('sessionObj');
+      if (
+        sessionObj === undefined ||
+        sessionObj === null ||
+        sessionObj === ''
+      ) {
+        cache.session.setJSON('sessionObj', requestObj);
+      } else {
+        const s_url = sessionObj.url; // 请求地址
+        const s_data = sessionObj.data; // 请求数据
+        const s_time = sessionObj.time; // 请求时间
+        const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
+        if (
+          s_data === requestObj.data &&
+          requestObj.time - s_time < interval &&
+          s_url === requestObj.url
+        ) {
+          const message = '数据正在处理,请勿重复提交';
+          console.warn(`[${s_url}]: ` + message);
+          return Promise.reject(new Error(message));
+        } else {
+          cache.session.setJSON('sessionObj', requestObj);
+        }
+      }
+    }
+    return config;
+  },
+  (error) => {
+    console.log(error);
+    Promise.reject(error);
+  }
+);
+
+// 响应拦截器
+service.interceptors.response.use(
+  (res) => {
+    // 未设置状态码则默认成功状态
+    const code = res.data.code;
+    // 获取错误信息
+    const msg = errorCode[code] || res.data.msg || errorCode['default'];
+    // 二进制数据则直接返回
+    if (
+      res.request.responseType === 'blob' ||
+      res.request.responseType === 'arraybuffer'
+    ) {
+      return res.data;
+    }
+    // if (code === '200001' || code === '300002') {
+    if (code === '300002') {
+      if (!isRelogin.show) {
+        isRelogin.show = true;
+        MessageBox.confirm(
+          '登录状态已过期,您可以继续留在该页面,或者重新登录',
+          '系统提示',
+          {
+            confirmButtonText: '重新登录',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        )
+          .then(() => {
+            isRelogin.show = false;
+            store.dispatch('LogOut').then(() => {
+              location.reload();
+            });
+          })
+          .catch(() => {
+            isRelogin.show = false;
+          });
+      }
+      return Promise.reject(
+        new Error('无效的会话,或者会话已过期,请重新登录。')
+      );
+    } else if (code === '500') {
+      Message({ message: msg, type: 'error' });
+      return Promise.reject(new Error(msg));
+    } else if (code === '601') {
+      Message({ message: msg, type: 'warning' });
+      return Promise.reject(new Error('error'));
+    } else if (code !== '000000') {
+      Notification.error({ title: msg });
+      return Promise.reject(new Error('error'));
+    } else {
+      return res.data;
+    }
+  },
+  (error) => {
+    console.log('err' + error);
+    let { message } = error;
+    if (message == 'Network Error') {
+      message = '后端接口连接异常';
+    } else if (message.includes('timeout')) {
+      message = '系统接口请求超时';
+    } else if (message.includes('Request failed with status code')) {
+      message = '系统接口' + message.substr(message.length - 3) + '异常';
+    }
+    Message({ message: message, type: 'error', duration: 5 * 1000 });
+    return Promise.reject(error);
+  }
+);
+
+// 通用下载方法
+export function download(url, params, filename, config) {
+  downloadLoadingInstance = Loading.service({
+    text: '正在下载数据,请稍候',
+    spinner: 'el-icon-loading',
+    background: 'rgba(0, 0, 0, 0.7)'
+  });
+  return service
+    .post(url, params, {
+      transformRequest: [
+        (params) => {
+          return tansParams(params);
+        }
+      ],
+      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+      responseType: 'blob',
+      ...config
+    })
+    .then(async (data) => {
+      const isBlob = blobValidate(data);
+      if (isBlob) {
+        const blob = new Blob([data]);
+        saveAs(blob, filename);
+      } else {
+        const resText = await data.text();
+        const rspObj = JSON.parse(resText);
+        const errMsg =
+          errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
+        Message.error(errMsg);
+      }
+      downloadLoadingInstance.close();
+    })
+    .catch((r) => {
+      console.error(r);
+      Message.error('下载文件出现错误,请联系管理员!');
+      downloadLoadingInstance.close();
+    });
+}
+
+export default service;

+ 201 - 202
src/utils/sso.js

@@ -1,202 +1,201 @@
-import request from '@/utils/request';
-import {
-  getSSOConfig,
-  setPlatformToken,
-  setSysMenuConfigID,
-  setSysTitle
-} from '@/utils/auth';
-import { defaults, omit } from 'lodash-es';
-const baseURL = process.env.VUE_APP_BASE_API;
-const APP_PORT = process.env.port || process.env.npm_config_port || 8008; // 端口
-const PTS_PORT = 7000;
-
-const locationUrl = location.protocol + '//' + location.hostname;
-
-let isUpdatedSSOConfig = false;
-export let ssoConfig = {
-  appId: process.env.VUE_APP_SYS_ID,
-  ssoEnabled: process.env.VUE_APP_SSO_ENABLED === 'TRUE',
-  verifyTokenUrl: '/sso/verifyToken',
-  ssoLoginUrl: `${locationUrl}:${PTS_PORT}/portal/login?redirect=`,
-  appRedirectUrl: `${locationUrl}:${APP_PORT}/fms/index`,
-  appLocalUrl: `/fms/index`,
-  isRedirect: false
-};
-
-const updateSSOConfig = () => {
-  if (isUpdatedSSOConfig) {
-    return;
-  }
-
-  try {
-    let configInfo = getSSOConfig();
-    if (configInfo) {
-      configInfo = JSON.parse(configInfo);
-    }
-
-    const { ssoEnabled, appName, ssoLoginUrl } = configInfo || {};
-    ssoConfig = defaults(
-      {
-        appId: appName,
-        ssoEnabled:
-          process.env.NODE_ENV === 'development'
-            ? undefined
-            : ssoEnabled === '1',
-        ssoLoginUrl:
-          process.env.NODE_ENV === 'development' ? undefined : ssoLoginUrl
-      },
-      ssoConfig
-    );
-    //alert("开关=" + ssoConfig.ssoEnabled);
-    isUpdatedSSOConfig = true;
-  } catch (error) {
-    alert('解析ssoConfig错误=' + error);
-    console.error(error, '解析configinfo 出错');
-  }
-};
-
-const parseTarget = (target) => {
-  if (/(http|https):\/\/([\w.]+\/?)\S*/.test(target)) {
-    return target;
-  }
-  return target;
-};
-
-const goTarget = function (href) {
-  window.open(href, '_blank');
-};
-const goUrl = function (href) {
-  window.location.href = href;
-};
-
-// 获取portal配置
-export async function getSsoInfo() {
-  let res = await axios({ method: 'get', url: baseURL + '/portal/cfg/cfg' });
-  let cfg =
-    res.status === 200 &&
-    res.data &&
-    res.data.code === '000000' &&
-    res.data.data;
-
-  return cfg;
-}
-
-const getQueryData = () => {
-  let oSearchItem = {};
-  let searchString = window.location.search;
-  let reg = /[?&][^?&]+=[^?&]+/g;
-  let arr = searchString.match(reg);
-  if (arr) {
-    arr.forEach((item) => {
-      let tempArr = item.substring(1).split('=');
-      let key = decodeURIComponent(tempArr[0]);
-      let value = decodeURIComponent(tempArr[1]);
-      oSearchItem[key] = value;
-    });
-  }
-  return oSearchItem;
-};
-
-export function authSSoToken(ssoToken) {
-  //alert( "请求ssoToken=" + ssoToken );
-
-  return request({
-    url: ssoConfig.verifyTokenUrl,
-    method: 'post',
-    data: {
-      ptsToken: ssoToken,
-      sysName: ssoConfig.appId,
-      sysId: ssoConfig.appId
-    }
-  });
-}
-
-export function resdirectApp(redirect, ssoToken) {
-  if (ssoConfig.appId === 'PTS') {
-    if (/(http|https):\/\/([\w.]+\/?)\S*/.test(redirect)) {
-      return redirect + '?token=' + ssoToken;
-    }
-    return redirect + '';
-  } else {
-    return parseTarget('/');
-  }
-}
-
-export function getResdirectAppUrl(ssoToken) {
-  updateSSOConfig();
-
-  if (!ssoToken) {
-    const currentUrl = location.href;
-    const isIndex =
-      location.pathname === '/index' || location.pathname === '/fms';
-    let backUrl = '/';
-    if (ssoConfig.isRedirect) {
-      backUrl = isIndex ? '/' : currentUrl || ssoConfig.appRedirectUrl;
-    }
-
-    let redirectUrl = ssoConfig.ssoEnabled
-      ? parseTarget(
-          ssoConfig.ssoLoginUrl + backUrl + `&appid=${ssoConfig.appId}`
-        )
-      : process.env.VUE_APP_SYS_BASE_URL + '/login';
-    // alert(  ssoConfig.ssoEnabled );
-    // alert(redirectUrl);
-    // alert(ssoConfig.ssoLoginUrl);
-    goUrl(redirectUrl);
-  }
-}
-
-export function parseSSoToken(store, next, to, router, subName) {
-  updateSSOConfig();
-  const { token, siblingToken, subid } = to.query;
-
-  if (subid) {
-    setSysMenuConfigID(subid);
-  }
-  if (subName) {
-    setSysTitle(subName, subid);
-  }
-  refreshTitle();
-  if (token) {
-    let ssoToken = token;
-    // alert('全局ssoToken=' + ssoToken);
-    if (typeof ssoToken === 'undefined') {
-      if (ssoConfig.appId !== 'PTS') {
-        if (ssoConfig.ssoEnabled) {
-          goUrl(
-            `${ssoConfig.ssoLoginUrl}${ssoConfig.appRedirectUrl}${to.fullPath}`
-          ); // 否则全部重定向到登录页
-        } else {
-        }
-      }
-    } else {
-      setPlatformToken(ssoToken);
-      return store.dispatch('SaveBindToken', ssoToken).then(() => {
-        router.replace({
-          path: to.path,
-          query: omit(to.query, ['token', 'siblingToken', 'subid', 'subName'])
-        });
-
-        return true;
-      });
-    }
-  } else if (siblingToken) {
-    setPlatformToken(siblingToken);
-    //
-    return store.dispatch('SaveSiblingToken', siblingToken).then(() => {
-      router.replace({
-        path: to.path,
-        query: omit(to.query, ['token', 'siblingToken', 'subid', 'subName']),
-        replace: true
-      });
-
-      return true;
-    });
-  } else {
-    return Promise.resolve(false);
-  }
-}
-
-export function refreshTitle() {
-  // document.title = getSysTitle();
-}
+import request from '@/utils/request';
+import {
+  getSSOConfig,
+  setPlatformToken,
+  setSysMenuConfigID,
+  setSysTitle
+} from '@/utils/auth';
+import { defaults, omit } from 'lodash-es';
+const baseURL = process.env.VUE_APP_BASE_API;
+const APP_PORT = process.env.port || process.env.npm_config_port || 8008; // 端口
+const PTS_PORT = 7000;
+
+const locationUrl = location.protocol + '//' + location.hostname;
+
+let isUpdatedSSOConfig = false;
+export let ssoConfig = {
+  appId: process.env.VUE_APP_SYS_ID,
+  ssoEnabled: process.env.VUE_APP_SSO_ENABLED === 'TRUE',
+  verifyTokenUrl: '/sso/verifyToken',
+  ssoLoginUrl: `${locationUrl}:${PTS_PORT}/portal/login?redirect=`,
+  appRedirectUrl: `${locationUrl}:${APP_PORT}/fms/index`,
+  appLocalUrl: `/fms/index`,
+  isRedirect: false
+};
+
+const updateSSOConfig = () => {
+  if (isUpdatedSSOConfig) {
+    return;
+  }
+
+  try {
+    let configInfo = getSSOConfig();
+    if (configInfo) {
+      configInfo = JSON.parse(configInfo);
+    }
+
+    const { ssoEnabled, appName, ssoLoginUrl } = configInfo || {};
+    ssoConfig = defaults(
+      {
+        appId: appName,
+        ssoEnabled:
+          process.env.NODE_ENV === 'development'
+            ? undefined
+            : ssoEnabled === '1',
+        ssoLoginUrl:
+          process.env.NODE_ENV === 'development' ? undefined : ssoLoginUrl
+      },
+      ssoConfig
+    );
+    //alert("开关=" + ssoConfig.ssoEnabled);
+    isUpdatedSSOConfig = true;
+  } catch (error) {
+    alert('解析ssoConfig错误=' + error);
+    console.error(error, '解析configinfo 出错');
+  }
+};
+
+const parseTarget = (target) => {
+  if (/(http|https):\/\/([\w.]+\/?)\S*/.test(target)) {
+    return target;
+  }
+  return target;
+};
+
+const goTarget = function (href) {
+  window.open(href, '_blank');
+};
+const goUrl = function (href) {
+  window.location.href = href;
+};
+
+// 获取portal配置
+export async function getSsoInfo() {
+  let res = await axios({ method: 'get', url: baseURL + '/portal/cfg/cfg' });
+  let cfg =
+    res.status === 200 &&
+    res.data &&
+    res.data.code === '000000' &&
+    res.data.data;
+
+  return cfg;
+}
+
+const getQueryData = () => {
+  let oSearchItem = {};
+  let searchString = window.location.search;
+  let reg = /[?&][^?&]+=[^?&]+/g;
+  let arr = searchString.match(reg);
+  if (arr) {
+    arr.forEach((item) => {
+      let tempArr = item.substring(1).split('=');
+      let key = decodeURIComponent(tempArr[0]);
+      let value = decodeURIComponent(tempArr[1]);
+      oSearchItem[key] = value;
+    });
+  }
+  return oSearchItem;
+};
+
+export function authSSoToken(ssoToken) {
+  //alert( "请求ssoToken=" + ssoToken );
+
+  return request({
+    url: ssoConfig.verifyTokenUrl,
+    method: 'post',
+    data: {
+      ptsToken: ssoToken,
+      sysName: ssoConfig.appId,
+      sysId: ssoConfig.appId
+    }
+  });
+}
+
+export function resdirectApp(redirect, ssoToken) {
+  if (ssoConfig.appId === 'PTS') {
+    if (/(http|https):\/\/([\w.]+\/?)\S*/.test(redirect)) {
+      return redirect + '?token=' + ssoToken;
+    }
+    return redirect + '';
+  } else {
+    return parseTarget('/');
+  }
+}
+
+export function getResdirectAppUrl(ssoToken) {
+  updateSSOConfig();
+
+  if (!ssoToken) {
+    const currentUrl = location.href;
+    const isIndex =
+      location.pathname === '/index' || location.pathname === '/fms';
+    let backUrl = '/';
+    if (ssoConfig.isRedirect) {
+      backUrl = isIndex ? '/' : currentUrl || ssoConfig.appRedirectUrl;
+    }
+
+    let redirectUrl = ssoConfig.ssoEnabled
+      ? parseTarget(
+          ssoConfig.ssoLoginUrl + backUrl + `&appid=${ssoConfig.appId}`
+        )
+      : process.env.VUE_APP_SYS_BASE_URL + '/login';
+    // alert(  ssoConfig.ssoEnabled );
+    // alert(redirectUrl);
+    // alert(ssoConfig.ssoLoginUrl);
+    goUrl(redirectUrl);
+  }
+}
+
+export function parseSSoToken(store, next, to, router) {
+  updateSSOConfig();
+  const { token, siblingToken, subid, subName } = to.query;
+
+  if (subid) {
+    setSysMenuConfigID(subid);
+  }
+  if (subName) {
+    setSysTitle(subName, subid);
+  }
+  refreshTitle();
+  if (token) {
+    let ssoToken = token;
+    // alert('全局ssoToken=' + ssoToken);
+    if (typeof ssoToken === 'undefined') {
+      if (ssoConfig.appId !== 'PTS') {
+        if (ssoConfig.ssoEnabled) {
+          goUrl(
+            `${ssoConfig.ssoLoginUrl}${ssoConfig.appRedirectUrl}${to.fullPath}`
+          ); // 否则全部重定向到登录页
+        } else {
+        }
+      }
+    } else {
+      setPlatformToken(ssoToken);
+      return store.dispatch('SaveBindToken', ssoToken).then(() => {
+        router.replace({
+          path: to.path,
+          query: omit(to.query, ['token', 'siblingToken', 'subid', 'subName'])
+        });
+
+        return true;
+      });
+    }
+  } else if (siblingToken) {
+    setPlatformToken(siblingToken);
+    //
+    return store.dispatch('SaveSiblingToken', siblingToken).then(() => {
+      router.replace({
+        path: to.path,
+        query: omit(to.query, ['token', 'siblingToken', 'subid', 'subName']),
+        replace: true
+      });
+
+      return true;
+    });
+  } else {
+    return Promise.resolve(false);
+  }
+}
+export function refreshTitle() {
+  // document.title = getSysTitle();
+}

+ 0 - 34
src/views/dataReport/components/addedFarmers.vue

@@ -236,9 +236,6 @@ export default {
         if (val) {
           assign(this.baseForm, this.data);
           if (!this.hasFetched) {
-            this.getProductList();
-            this.getSyinfoList();
-            this.getProcessList();
             this.hasFetched = true;
           }
         }
@@ -253,38 +250,7 @@ export default {
       }
     }
   },
-  created() {},
-  mounted() {},
   methods: {
-    getProductList() {
-    },
-    getSyinfoList() {
-    },
-    getProcessList() {
-    },
-    goProductsPage() {
-      this.handleClose();
-      this.$router.push({
-        path: '/Products',
-        query: {}
-      });
-    },
-    goSourceInfoPage() {
-      this.handleClose();
-      this.$router.push({
-        path: '/sourceInfo',
-        query: {
-          type: 'add'
-        }
-      });
-    },
-    goProcessPage() {
-      this.handleClose();
-      this.$router.push({
-        path: '/basicsettings/process',
-        query: {}
-      });
-    },
     resetForm(formName) {
       this.$refs[formName].resetFields();
       this.resetFormData();

+ 88 - 74
src/views/dataReport/intakeWaterAnalysis.vue

@@ -1,75 +1,73 @@
 <template>
   <el-row class="el-row-container" v-loading="loading">
-    <el-col
-      :span="4"
-      style="height:100%;padding-bottom:32px;"
-    >
-    <el-card style="margin:16px;height: 100%; overflow-y: auto">
-      <data-report-left
-        @setCurrentData="setCurrentData"
-        :treeData="treeData"
-      ></data-report-left>
-    </el-card>
+    <el-col :span="4" style="height: 100%; padding-bottom: 32px">
+      <el-card style="margin: 16px; height: 100%; overflow-y: auto">
+        <data-report-left
+          @setCurrentData="setCurrentData"
+          :treeData="treeData"
+        ></data-report-left>
+      </el-card>
     </el-col>
-    <el-col
-      :span="20"
-      style="padding: 16px 16px 16px 0; height: 100%;"
-    >
-    <el-card style="height: 100%; overflow-y: auto">
-      <el-col :span="24" class="elrow-main__col-top">
-        <div>
-          <el-select
-            v-model="currentYear"
-            style="width: 250px;margin-right: 16px;"
+    <el-col :span="20" style="padding: 16px 16px 16px 0; height: 100%">
+      <el-card style="height: 100%; overflow-y: auto">
+        <el-col :span="24" class="elrow-main__col-top">
+          <div>
+            <el-select
+              v-model="currentYear"
+              style="width: 250px; margin-right: 16px"
+            >
+              <el-option
+                v-for="item in options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+            <el-button type="primary" size="small" @click="handleSearch"
+              >查询</el-button
+            >
+          </div>
+          <i
+            class="el-icon-download"
+            @click="downloadHandler"
+            v-hasPermi="['wpr:organization:download']"
+          ></i>
+        </el-col>
+        <el-col :span="24" class="elrow-main__col-bottom">
+          <b-table
+            ref="tableRef"
+            :args="{ 'highlight-current-row': true }"
+            :data="loadData"
+            :columns="columns"
+            isShowIndex
           >
-            <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value">
-            </el-option>
-          </el-select>
-          <el-button
-            type="primary"
-            size="small"
-            @click="handleSearch"
-            >查询</el-button
-          > 
-        </div>
-        <i
-          class="el-icon-download"
-          @click="downloadHandler"
-        ></i>
-      </el-col>
-      <el-col :span="24" class="elrow-main__col-bottom">
-        <b-table
-          ref="tableRef"
-          :args="{ 'highlight-current-row': true }"
-          :data="loadData"
-          :columns="columns"
-          isShowIndex
-        >
-        </b-table>
-      </el-col>
-    </el-card>
+          </b-table>
+        </el-col>
+      </el-card>
     </el-col>
   </el-row>
 </template>
 
 <script>
-import { getAreaList } from '@/api/statistics/index.js'
-import { getTree } from '@/api/tree.js'
+import { getAreaList } from '@/api/statistics/index.js';
+import { getTree } from '@/api/tree.js';
 import BTable from '@/components/Table/index.vue';
-import DataReportLeft from '@/components/DataReportLeft/index.vue'
+import DataReportLeft from '@/components/DataReportLeft/index.vue';
 import { assign, omit } from 'lodash-es';
 
 export default {
   name:"waterManage",
-  components: { BTable,DataReportLeft},
+  components: { BTable, DataReportLeft },
+  mounted() { 
+    this.setYear()
+  },
   data() {
+    let date = new Date()
+    let currentYear = date.getFullYear()
     return {
       activeName:'first',
-      currentYear: '',
+      currentYear,
       loading: false,
       associationManageShow: false,
       treeData: [],
@@ -96,7 +94,7 @@ export default {
           align: 'center'
         },
         {
-          label: '面积',
+          label: '面积(亩)',
           prop: 'waterrightAreasize',
           customRender: '',
           align: 'center'
@@ -127,58 +125,74 @@ export default {
       this.$refs.tableRef.refresh(true);
     },
     async loadData(parameter) {
-      this.setYear()
       if (!this.currentClickId) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
-        } else { 
-          res = await getTree()
-          this.$store.dispatch('tree/setTree',res)
+          res = treeList;
+        } else {
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.currentClick = res?.data[0]
         this.currentClickId = this.currentClick?.cusareaId
       }
       const params = {
         areaId: this.currentClickId,
         year: this.currentYear
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
       return getAreaList(payload);
     },
     downloadHandler() {
+      const params = {
+        areaId: this.currentClickId,
+        year: this.currentYear
+      }
       this.download(
         'wpr/stat/area/export',
         {
-          ...this.queryParams
+          ...params
         },
         `FmsCrop_${new Date().getTime()}.xlsx`
       );
     },
     setYear() {
       this.options = []
-      let date = new Date
+      let date = new Date()
       let currentYear = date.getFullYear()
       this.currentYear = currentYear
       for (let i = 0; i < 5; i++) {
         this.options.push({
           label: currentYear - i,
           value: currentYear - i
-        })  
+        });
       }
     },
-   setCurrentData(areaId) {
-      this.currentClickId = areaId
+    setCurrentData(areaId) {
+      this.currentClickId = areaId;
       this.$refs.tableRef.refresh(false);
-    },
+    }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {
@@ -197,9 +211,9 @@ export default {
       margin-right: 5px;
     }
   }
-  .el-icon-download{
-    font-size:26px;
-    color:#14A478;
+  .el-icon-download {
+    font-size: 26px;
+    color: #14a478;
     cursor: pointer;
   }
 }

+ 21 - 4
src/views/dataReport/saveWaterAnalysis.vue

@@ -14,7 +14,7 @@
               </el-option>
             </el-select>
             <el-input style="width: 250px;margin-right: 16px;"
-              placeholder="请输入农户编号/姓名/电话"
+              placeholder="请输入姓名/电话"
               v-model="keyword"
             />
             <el-button type="primary" size="small" @click="handleSearch">查询</el-button>
@@ -45,10 +45,15 @@ import { assign, omit } from 'lodash-es';
 export default {
   name: "waterManage",
   components: { BTable, DataReportLeft },
+  mounted() { 
+    this.setYear()
+  },
   data() {
+    let date = new Date()
+    let currentYear = date.getFullYear()
     return {
       activeName: 'first',
-      currentYear: '',
+      currentYear,
       keyword: '',
       loading: false,
       associationManageShow: false,
@@ -111,7 +116,6 @@ export default {
       this.$refs.tableRef.refresh(true);
     },
     async loadData(parameter) {
-      this.setYear()
       if (!this.currentClickId) {
         const treeList = this.$store.state.tree.treeList
         let res = []
@@ -122,6 +126,19 @@ export default {
           this.$store.dispatch('tree/setTree', res)
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.currentClick = res?.data[0]
         this.currentClickId = this.currentClick?.cusareaId
       }
@@ -135,7 +152,7 @@ export default {
     },
     setYear() {
       this.options = []
-      let date = new Date
+      let date = new Date()
       let currentYear = date.getFullYear()
       this.currentYear = currentYear
       for (let i = 0; i < 5; i++) {

+ 23 - 3
src/views/dataReport/waterConsumption.vue

@@ -26,6 +26,7 @@
             <i
               class="el-icon-download"
               @click="downloadHandler"
+               v-hasPermi="['wpr:well:download']"
             ></i>
           </div>
         </el-col>
@@ -97,10 +98,17 @@ export default {
       this.$refs.tableRef.refresh(true);
     },
     downloadHandler() {
+      const [startTime, endTime] = this.dateValue ??= []
+      const params = {
+        areaId: this.currentClickId,
+        startTime,
+        endTime,
+        keyword: this.keyword
+      }
       this.download(
         'wpr/stat/water/export',
         {
-          ...this.queryParams
+          ...params
         },
         `FmsCrop_${new Date().getTime()}.xlsx`
       );
@@ -116,8 +124,20 @@ export default {
           this.$store.dispatch('tree/setTree', res)
         }
         this.treeData = res?.data
-        this.currentClick = res?.data[0]
-        this.currentClickId = this.currentClick?.cusareaId
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id:'',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
+        this.currentClickId = this.treeData[0]?.cusareaId
       }
       
       const [startTime, endTime] = this.dateValue ??= []

+ 13 - 1
src/views/gisShow/components/rightEquipment.vue

@@ -183,6 +183,18 @@ export default {
         })
       }
     },
+    changeStatus(flag) {
+      switch (flag) { 
+        case 'I':
+          return '在线'
+        case 'W':
+          return '运行'
+        case 'E':
+          return '故障'
+        case 'O':
+          return '离线'
+      }
+     },
     async getBaseInfo() { 
       const response = await getBaseInfo({
         tmnId: this.tmnId
@@ -194,7 +206,7 @@ export default {
       this.cusareaName = value?.cusareaName;
       this.waterAddress = value?.waterAddress;
       this.tmnstatusRunstatusContent = value?.tmnstatusRunstatusContent;
-      this.tmnstatusRunstatus = value?.tmnstatusRunstatus;
+      this.tmnstatusRunstatus = this.changeStatus(value?.tmnstatusRunstatus);
       this.list = [{
         label: '设备名称:',
         text: this.tmnName || '-'

+ 1 - 1
src/views/gisShow/index.vue

@@ -94,7 +94,7 @@ export default {
         tmnstatusRunstatus: this.tmnstatusRunstatus
       })
       this.positions = res?.data
-      this.center = [res?.data[0]?.tmnLongitude || 116.397428, res?.data[0]?.tmnLatitude || 39.90923]
+      this.center = [res?.data[0]?.tmnLongitude || 113.61, res?.data[0]?.tmnLatitude || 33.44]
     },
     searchMap() {
       let that = this;

+ 13 - 0
src/views/home/index.vue

@@ -224,6 +224,19 @@ export default {
         this.$store.dispatch('tree/setTree', res)
       }
       this.treeData = res?.data
+      let tflag = true
+      this.treeData.forEach(t => {
+        if (t?.cusareaName == '全部') {
+          tflag = false
+        }
+      })
+      if (tflag) {
+        this.treeData.unshift({
+          id: '',
+          cusareaId: '',
+          cusareaName: '全部'
+        })
+      }
       this.cusareaName ||= this.treeData[0].cusareaName
       this.areaId = this.treeData[0].cusareaId
       this.getHomeListHandler()

+ 0 - 1
src/views/infrastructure/components/recompose.vue

@@ -176,7 +176,6 @@ export default {
     },
     editRow:{
       handler(val) {
-        console.log(val, 'valvalvalvlavlas')
         const { cusareaParentid } = val
         this.cusareaParentid = cusareaParentid
         this.visible && this.getWaterrightUpareaList(val)

+ 4 - 3
src/views/infrastructure/components/setAnnualWaterRight.vue

@@ -271,7 +271,8 @@ export default {
       if (this.constantWaterPrice == 1) { 
         for (let i = 0; i < this.baseForm.waterPriceSteps.length; i++) {
           const waterPriceItem = this.baseForm.waterPriceSteps[i]
-          if (waterPriceItem?.pricestepUsagemin != ''  && waterPriceItem?.pricestepUsagemax != '' && +waterPriceItem?.pricestepUsagemax < +waterPriceItem?.pricestepUsagemin) {
+          const waterMax = waterPriceItem?.pricestepUsagemax == null ? 9999999 : +waterPriceItem?.pricestepUsagemax
+          if (waterPriceItem?.pricestepUsagemin != '' && waterPriceItem?.pricestepUsagemax != '' && waterMax < +waterPriceItem?.pricestepUsagemin) {
             Message({
               type: 'warning',
               message: `水价第${i+1}阶梯的最大量不能小于最小量`
@@ -291,7 +292,8 @@ export default {
       if (this.ladderLikeWaterPrice == 1) {
         for (let i = 0; i < this.baseForm.elecPriceSteps.length; i++) {
           const elePriceItem = this.baseForm.elecPriceSteps[i]
-          if (elePriceItem?.pricestepUsagemin != '' && elePriceItem?.pricestepUsagemax != '' && +elePriceItem?.pricestepUsagemax < +elePriceItem?.pricestepUsagemin) {
+          const eleMax = elePriceItem?.pricestepUsagemax == null ? 9999999 : +elePriceItem?.pricestepUsagemax
+          if (elePriceItem?.pricestepUsagemin != '' && elePriceItem?.pricestepUsagemax != '' && eleMax < +elePriceItem?.pricestepUsagemin) {
             Message({
               type: 'warning',
               message: `电价第${i + 1}阶梯的最大量不能小于最小量`
@@ -334,7 +336,6 @@ export default {
     },
 
     submitForm(formName) {
-      console.log(this.priceconfigElectricityunitprice,'priceconfigElectricityunitpricepriceconfigElectricityunitprice')
       this.$refs[formName].validate((valid) => {
         valid && this.editPriceHandler()
       })

+ 420 - 0
src/views/infrastructure/components/setAnnualWaterRightAdd.vue

@@ -0,0 +1,420 @@
+<template>
+  <el-dialog
+    title="新增"
+    :visible.sync="dialogVisible"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    @close="handleClose"
+    width="660px"
+  >
+  <el-tooltip
+    class="item_tooltip" 
+    effect="dark"
+    content="操作提示:设置每亩农田同水量的水价信息和用电量的电价信息"
+    placement="right"
+  >
+    <i class="el-alert__icon el-icon-info"></i>
+  </el-tooltip>
+    <el-form
+      ref="baseForm"
+      class="base-form"
+      label-position="right"
+      label-width="100px"
+      :model="baseForm"
+      size="small"
+    >
+    <el-row>
+      <el-col :span="24">
+        <el-form-item label="所属区域">
+          <el-row>
+            <el-col :span="24">
+              <select-tree 
+                :placeholder="'行政区域(全国)'" 
+                style="width:100%"
+                :treeData="treeData"
+                @handlerClick="handlerClick"
+                :checkVal="baseForm.cusareaName"
+              ></select-tree>
+            </el-col>
+          </el-row>
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <el-row>
+      <h3>水价</h3>
+      <el-col :span="24">
+        <el-form-item label="水价计费方式">
+          <el-row>
+            <el-col :span="18">
+              <el-radio v-model="constantWaterPrice" label="0">恒定水价</el-radio>
+              <el-radio v-model="constantWaterPrice" label="1">阶梯水价</el-radio>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <el-form-item label="水价" 
+          v-if="constantWaterPrice == 0" 
+          prop="priceconfigWaterunitprice"
+          :rules="[{ required: true, message: '请选择您的恒定水价', trigger: 'blur' }]"
+        >
+          <el-row>
+            <el-col :span="18">
+              <el-input
+                style="width: 50%"
+                type="number"
+                v-model="baseForm.priceconfigWaterunitprice"
+              />
+              <span style="display:inline-block;margin-left:5px">元/吨</span>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <ladderLikeWaterPrice
+          v-else
+          :type="'water'"
+          @changeList="changeList"
+          :list="baseForm.waterPriceSteps || []"
+        />
+      </el-col>
+    </el-row>
+    <el-row>
+      <h3>电价</h3>
+      <el-col :span="24">
+        <el-form-item label="电价计费方式">
+          <el-row>
+            <el-col :span="18">
+              <el-radio v-model="ladderLikeWaterPrice" label="0">恒定电价</el-radio>
+              <el-radio v-model="ladderLikeWaterPrice" label="1">阶梯电价</el-radio>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <el-form-item
+          label="电价"
+          v-if="ladderLikeWaterPrice == 0"
+          :rules="[{ required: true, message: '请选择您的恒定电价', trigger: 'blur' }]"
+          prop="priceconfigElectricityunitprice"
+        >
+          <el-row>
+            <el-col :span="18">
+              <el-input 
+                style="width: 50%" 
+                type="number"
+                v-model="baseForm.priceconfigElectricityunitprice"
+              />
+              <span style="display:inline-block;margin-left:5px">元/度</span>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <ladderLikeWaterPrice 
+          v-else
+          :type="'electricity'"
+          @changeList="changeList"
+          :list="baseForm.elecPriceSteps || []"
+        />
+      </el-col>
+    </el-row>
+    </el-form>
+
+    <div style="text-align: right;margin-top: 20px;">
+      <el-button type="info" plain @click="resetForm('baseForm')"
+        >取消</el-button
+      >
+      <el-button
+        type="primary"
+        style="margin-left:16px;"
+        @click="submitForm('baseForm')"
+        :disabled="dialogSubmitLoading"
+        :loading="dialogSubmitLoading"
+        >确定</el-button
+      >
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import SelectTree from '@/components/SelectTree';
+import { getTree } from '@/api/tree.js'
+import { assign } from 'lodash-es';
+import { Message  } from 'element-ui'
+import ladderLikeWaterPrice from './ladderLikeWaterPrice.vue'
+import { addPrice } from '@/api/price/index.js'
+export default {
+  name: 'setAnnualWaterRightAdd',
+  props: {
+    data: {
+      default() {
+        return {};
+      }
+    },
+    visible: {
+      type: Boolean,
+      default: false
+    },
+  },
+  components: {
+    ladderLikeWaterPrice,
+    SelectTree
+  },
+  data() {
+    return {
+      treeData: [],
+      areaId: '',
+      dialogSubmitLoading: false,
+      constantWaterPrice: '1',
+      ladderLikeWaterPrice: '1',
+      dialogVisible: false,
+      priceconfigElectricityunitprice: '',
+      priceconfigWaterunitprice: '',
+      baseForm: {
+        cusareaName: '',
+        priceconfigElectricityunitprice: '',
+        priceconfigWaterunitprice: '',
+        elecPriceSteps: [{
+          pricestepUsagemin: '0',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }, {
+          pricestepUsagemin: '',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }],
+        waterPriceSteps: [{
+          pricestepUsagemin: '0',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }, {
+          pricestepUsagemin: '',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }]
+      },
+      hasFetched: false,
+      rules1: {
+        priceconfigWaterunitprice: [
+          { required: true, message: '输入您的恒定水价', trigger: 'blur' }
+        ],
+      },
+      rules2: {
+        priceconfigElectricityunitprice: [
+          { required: true, message: '输入您的恒定电价', trigger: 'blur' }
+        ]
+      },
+      rules3: {
+        priceconfigWaterunitprice: [
+          { required: true, message: '输入您的恒定水价', trigger: 'blur' }
+        ],
+        priceconfigElectricityunitprice: [
+          { required: true, message: '输入您的恒定电价', trigger: 'blur' }
+        ]
+      },
+      rules4: {
+        stockAmount: [
+          { required: true, message: '请选择负责人', trigger: 'blur' }
+        ],
+        sourceinfoId: [
+          { required: true, message: '请选择管辖范围', trigger: 'blur' }
+        ],
+        productName: [
+          { required: true, message: '请输入协会名称', trigger: 'blur' }
+        ],
+        supplierId: [
+          { required: false, message: '请输入协会介绍', trigger: 'blur' }
+        ],
+        goodsSpecValue: [
+          { required: true, message: '请选择规格', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  watch: {
+    visible(val) {
+      if (val !== this.dialogVisible) {
+        this.dialogVisible = val;
+        if (val) {
+          assign(this.baseForm, this.data);
+          if (!this.hasFetched) {
+            this.hasFetched = true;
+          }
+        }
+      }
+    },
+    data: {
+      deep: true,
+      handler(val) {
+        assign(this.baseForm, val);
+      }
+    },
+  },
+  mounted() { 
+    this.getWaterrightList()
+  },
+  methods: {
+    handlerClick(value) {
+      this.areaId = value?.cusareaId
+    },
+    async getWaterrightList() {
+      if (!this.areaId) {
+        const res = await getTree()
+        this.treeData = res?.data
+        this.areaId = this.treeData[0].cusareaId
+      }
+    },
+    changeList(list,type,row, index) {
+      if (type === 'water') {
+        if (this.baseForm.waterPriceSteps[index + 1]) {
+          const params = this.baseForm.waterPriceSteps[index + 1]
+          params.pricestepUsagemin = row
+          this.$set(this.baseForm.waterPriceSteps, index + 1, params)
+         }
+      } else { 
+        if (this.baseForm.elecPriceSteps[index + 1]) {
+          const params = this.baseForm.elecPriceSteps[index + 1]
+          params.pricestepUsagemin = row
+          this.$set(this.baseForm.elecPriceSteps, index + 1, params)
+         }
+      }
+     },
+    async editPriceHandler() {
+      const { priceconfigId } = this.baseForm
+      if (this.constantWaterPrice == 1) { 
+        for (let i = 0; i < this.baseForm.waterPriceSteps.length; i++) {
+          const waterPriceItem = this.baseForm.waterPriceSteps[i]
+          if (waterPriceItem?.pricestepUsagemin != ''  && waterPriceItem?.pricestepUsagemax != '' && +waterPriceItem?.pricestepUsagemax < +waterPriceItem?.pricestepUsagemin) {
+            Message({
+              type: 'warning',
+              message: `水价第${i+1}阶梯的最大量不能小于最小量`
+            })
+            return
+          }
+          if (!waterPriceItem?.pricestepUnitprice) {
+            Message({
+              type: 'warning',
+              message: '请正确输入您的水价信息'
+            })
+            return
+          }
+          waterPriceItem.pricestepNum = i
+        }
+      }
+      if (this.ladderLikeWaterPrice == 1) {
+        for (let i = 0; i < this.baseForm.elecPriceSteps.length; i++) {
+          const elePriceItem = this.baseForm.elecPriceSteps[i]
+          if (elePriceItem?.pricestepUsagemin != '' && elePriceItem?.pricestepUsagemax != '' && +elePriceItem?.pricestepUsagemax < +elePriceItem?.pricestepUsagemin) {
+            Message({
+              type: 'warning',
+              message: `电价第${i + 1}阶梯的最大量不能小于最小量`
+            })
+            return
+          }
+          if (!elePriceItem?.pricestepUnitprice) {
+            Message({
+              type: 'warning',
+              message: '请正确输入您的电价信息'
+            })
+            return
+          }
+          elePriceItem.pricestepNum = i
+        }
+      }
+      
+      const params = {
+        areaId:this.areaId,
+        priceconfigId,
+        priceconfigWaterchargingtype: this.constantWaterPrice,
+        priceconfigElectricityunitprice:  this.ladderLikeWaterPrice == 0 ? this.baseForm.priceconfigElectricityunitprice: '0',
+        priceconfigElectricitychargingtype: this.ladderLikeWaterPrice,
+        priceconfigWaterunitprice: this.constantWaterPrice == 0 ? this.baseForm.priceconfigWaterunitprice :'0',
+        waterPriceSteps: this.constantWaterPrice == 1 ? this.baseForm.waterPriceSteps : [],
+        elePriceSteps: this.ladderLikeWaterPrice == 1 ? this.baseForm.elecPriceSteps : [],
+      }
+      await addPrice(
+        params
+      )
+      this.handleClose()
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+      this.resetFormData();
+      this.dialogVisible = false;
+    },
+    resetFormData() {
+      this.baseForm =  {
+        cusareaName: '',
+        priceconfigElectricityunitprice: '',
+        priceconfigWaterunitprice: '',
+        elecPriceSteps: [{
+          pricestepUsagemin: '0',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }, {
+          pricestepUsagemin: '',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }],
+        waterPriceSteps: [{
+          pricestepUsagemin: '0',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }, {
+          pricestepUsagemin: '',
+          pricestepUsagemax: '',
+          pricestepUnitprice: '',
+        }]
+      }
+    },
+
+    submitForm(formName) {
+      this.$refs[formName].validate((valid) => {
+        valid && this.editPriceHandler()
+      })
+    },
+    handleClose() {
+      this.$emit('update:visible', false);
+      this.$emit('clearEdit')
+      this.resetForm('baseForm');
+    },
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-form-item__label{
+  text-align: right !important;
+}
+
+.item_tooltip{
+  position: absolute;
+  top: 25px;
+  left: 70px;
+  color: #00000066;
+}
+h3{
+  color: #303133;
+  font-family: Source Han Sans CN VF;
+  font-size: 14px;
+  font-style: normal;
+  font-weight: 700;
+  line-height: 24px;
+}
+.base-form {
+  max-height: 70vh;
+  overflow-y: auto;
+  overflow-x: hidden;
+  padding: 0 20px;
+}
+</style>
+<style lang="css" scoped>
+::v-deep .el-dialog__header {
+  border-bottom: 1px solid #ebeef5;
+}
+</style>
+<style>
+.el-tooltip__popper.is-dark {
+	background: rgba(0,0,0,0.5);
+}
+
+.el-tooltip__popper[x-placement^=right] .popper__arrow{
+  border-right-color:#888;
+}
+.el-tooltip__popper[x-placement^=right] .popper__arrow::after{
+  border-right-color:#888;
+}
+</style>

+ 16 - 2
src/views/infrastructure/components/setPreferenc.vue

@@ -24,8 +24,22 @@
           <el-row>
             <el-col :span="12">
               <el-form-item label="计算模式:" prop="tmnconfigMeteredmodel">
-                <el-input placeholder="请输入" v-model="baseForm.tmnconfigMeteredmodel">
-                </el-input>
+                <!-- <el-input placeholder="请输入" v-model="baseForm.tmnconfigMeteredmodel"> -->
+                <!-- </el-input> -->
+                <el-select  v-model="baseForm.tmnconfigMeteredmodel" style="width:100%">
+                  <el-option
+                    label="水电双计"
+                    value="0"
+                  ></el-option>
+                  <el-option
+                    label="只计水"
+                    value="1"
+                  ></el-option>
+                  <el-option
+                    label="只计电"
+                    value="2"
+                  ></el-option>
+                </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="12">

+ 2 - 2
src/views/infrastructure/components/waterPriceSetting.vue

@@ -117,8 +117,8 @@ export default {
       this.currentYear = currentYear
       for (let i = 0; i < 5; i++) {
         this.options.push({
-          label: currentYear - i,
-          value: currentYear - i
+          label: currentYear + i,
+          value: currentYear + i
         })
       }
     },

+ 92 - 60
src/views/infrastructure/deviceSetup.vue

@@ -1,20 +1,14 @@
 <template>
   <el-row class="el-row-container" style="height: 100%" v-loading="loading">
-    <el-col
-      :span="4"
-      style="height:100%;padding-bottom:32px;"
-    >
-    <el-card style="margin:16px;height: 100%; overflow-y: auto">
-      <data-report-left
-        @setCurrentData="setCurrentData"
-        :treeData="treeData"
-      ></data-report-left>
-    </el-card>
+    <el-col :span="4" style="height: 100%; padding-bottom: 32px">
+      <el-card style="margin: 16px; height: 100%; overflow-y: auto">
+        <data-report-left
+          @setCurrentData="setCurrentData"
+          :treeData="treeData"
+        ></data-report-left>
+      </el-card>
     </el-col>
-    <el-col
-      :span="20"
-      style="padding: 16px 16px 16px 0; height: 100%"
-    >
+    <el-col :span="20" style="padding: 16px 16px 16px 0; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
           <div>
@@ -37,10 +31,7 @@
               >
               </el-option>
             </el-select>
-            <el-button
-              type="primary"
-              size="small"
-              @click="handleSearch"
+            <el-button type="primary" size="small" @click="handleSearch"
               >查询</el-button
             >
           </div>
@@ -54,11 +45,29 @@
             isShowIndex
           >
             <template #status="scope">
-              <span style="display:flex;align-items:center;justify-content:center">
-                <span class="status nowork" v-if="scope.row.tmnstatusRunstatusContent == '空闲中'"></span>
-                <span class="status work" v-if="scope.row.tmnstatusRunstatusContent == '工作中'"></span>
-                <span class="status error" v-if="scope.row.tmnstatusRunstatusContent == '故障'"></span>
-                <span class="status nolive" v-if="scope.row.tmnstatusRunstatusContent == '离线'"></span>
+              <span
+                style="
+                  display: flex;
+                  align-items: center;
+                  justify-content: center;
+                "
+              >
+                <span
+                  class="status nowork"
+                  v-if="scope.row.tmnstatusRunstatusContent == '空闲中'"
+                ></span>
+                <span
+                  class="status work"
+                  v-if="scope.row.tmnstatusRunstatusContent == '工作中'"
+                ></span>
+                <span
+                  class="status error"
+                  v-if="scope.row.tmnstatusRunstatusContent == '故障'"
+                ></span>
+                <span
+                  class="status nolive"
+                  v-if="scope.row.tmnstatusRunstatusContent == '离线'"
+                ></span>
                 {{ scope.row.tmnstatusRunstatusContent }}
               </span>
             </template>
@@ -67,8 +76,9 @@
                 size="small"
                 :underline="false"
                 type="primary"
-                style="margin-right: 10px;color:rgb(219, 162, 28)"
+                style="margin-right: 10px; color: rgb(219, 162, 28)"
                 @click="irrigationShowHistory(scope.row)"
+                v-hasPermi="['wpr:device:setup']"
                 >参数设置</el-link
               >
               <!-- <el-link
@@ -92,22 +102,29 @@
 </template>
 
 <script>
-import { getBaseList, getTmnconfigInfo, addTmnconfig } from '@/api/tmn/index.js'
-import { getTree } from '@/api/tree.js'
+import {
+  getBaseList,
+  getTmnconfigInfo,
+  addTmnconfig
+} from '@/api/tmn/index.js';
+import { getTree } from '@/api/tree.js';
 import BTable from '@/components/Table/index.vue';
-import DataReportLeft from '@/components/DataReportLeft/index.vue'
-import setPreferencs from './components/setPreferenc.vue'
+import DataReportLeft from '@/components/DataReportLeft/index.vue';
+import setPreferencs from './components/setPreferenc.vue';
 import { assign, omit } from 'lodash-es';
 
 export default {
   name: 'deviceSetup',
-  components: { BTable,DataReportLeft,setPreferencs },
+  components: { BTable, DataReportLeft, setPreferencs },
   data() {
     return {
-      tmnstatusRunstatus:'I',
+      tmnstatusRunstatus:'',
       treeData: [],
       waterKeyword: '',
       tmnstatusList: [{
+        label: '全部',
+        value: ''
+      },{
         label: '空闲中',
         value: 'I'
       }, {
@@ -149,18 +166,20 @@ export default {
           prop: 'tmnstatusRunstatusContent',
           customRender: 'status',
           align: 'center'
-        },{
+        },
+        {
           label: '累计用水量',
           prop: 'waterNumTotal',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '累计用电量',
           prop: 'elecNumTotal',
           customRender: '',
           align: 'center'
-        }
-        , {
+        },
+        {
           label: '更新时间',
           prop: 'tmnstatusUpdateddate',
           customRender: '',
@@ -179,29 +198,42 @@ export default {
       const res = await getFarmerList({
         farmerName,
         areaId
-      })
-      this.userList = res.data
+      });
+      this.userList = res.data;
     },
     setCurrentData(areaId) {
-      this.currentClickId = areaId
-      this.areaId = areaId
+      this.currentClickId = areaId;
+      this.areaId = areaId;
       this.$refs.tableRef.refresh(false);
     },
     irrigationShowHistory(row) {
-      this.tmnId = row?.tmnId
-      this.associationManageShow = true
-     },
+      this.tmnId = row?.tmnId;
+      this.associationManageShow = true;
+    },
     async loadData(parameter) {
       if (!this.currentClickId) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.currentClick = res?.data[0]
         this.currentClickId = this.currentClick?.cusareaId
         this.areaId = this.currentClickId
@@ -210,25 +242,25 @@ export default {
         areaId: this.areaId,
         waterKeyword: this.waterKeyword,
         tmnstatusRunstatus: this.tmnstatusRunstatus
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
       return this.getTableData(payload);
     },
-    getTableData(payload) {  
-      return getBaseList(payload)
+    getTableData(payload) {
+      return getBaseList(payload);
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
     },
     goDetail(row) {
-      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
-    },
+      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno);
+    }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {
@@ -248,23 +280,23 @@ export default {
     }
   }
 }
-.status{
+.status {
   display: inline-block;
   width: 8px;
   height: 8px;
   border-radius: 50%;
   margin-right: 8px;
 }
-.nowork{
-  background: #14A478;
+.nowork {
+  background: #14a478;
 }
-.work{
-  background: #1890FF;
+.work {
+  background: #1890ff;
 }
-.error{
-  background: #F4A72F;
+.error {
+  background: #f4a72f;
 }
-.nolive{
+.nolive {
   background: rgba(0, 0, 0, 0.26);
 }
 </style>

+ 165 - 96
src/views/infrastructure/waterElectricityPriceSetting.vue

@@ -3,68 +3,92 @@
     <el-col :span="24" style="padding: 16px; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
-          <div style="display:flex">
-            <select-tree 
-              :placeholder="'行政区域(全国)'" 
-              style="width:50%"
+          <div style="display: flex">
+            <select-tree
+              :placeholder="'行政区域(全国)'"
+              style="width: 50%"
               :treeData="treeData"
               @handlerClick="handlerClick"
               :checkVal="cusareaName"
             ></select-tree>
-            <el-select style="margin:0 20px;width: 50%" placeholder="全部" v-model="priceConfigVal" @change="handleChange">
-              <el-option v-for="(item, index) in priceConfigList" :key="index" :label="item.label" :value="item.value">
+            <el-select
+              style="margin: 0 20px; width: 50%"
+              placeholder="全部"
+              v-model="priceConfigVal"
+              @change="handleChange"
+            >
+              <el-option
+                v-for="(item, index) in priceConfigList"
+                :key="index"
+                :label="item.label"
+                :value="item.value"
+              >
               </el-option>
             </el-select>
-            <el-button type="primary" size="small" @click="handleSearch">查询</el-button>
+            <el-button type="primary" size="small" @click="handleSearch"
+              >查询</el-button
+            >
           </div>
-          <!-- <div class="top-left">
+          <div class="top-left">
             <el-button
               type="primary"
               size="small"
               @click="addAssociation"
+                v-hasPermi="['wpr:price:add']"
+
               >新增
               </el-button
-          ></div> -->
+          ></div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
-          <b-table ref="tableRef" 
+          <b-table
+            ref="tableRef"
             border
             :args="{ 'highlight-current-row': true }"
-            :data="loadData" 
+            :data="loadData"
             :columns="columns"
-            isShowIndex>
+            isShowIndex
+          >
             <template #priceconfigWaterchargingtype="scope">
-              {{ scope.row.priceconfigWaterchargingtype == 1 ? '是': '否'}}
+              {{ scope.row.priceconfigWaterchargingtype == 1 ? '是' : '否' }}
             </template>
             <template #waterPriceName="scope">
               <span v-if="scope.row.priceconfigWaterchargingtype == 1">
-                <div v-for="(item, index) in scope.row.waterPriceSteps" :key="index" class="pricestepNum">
-                  {{ 
-                    item.pricestepNum == '0' ? '第1阶梯' : item.pricestepNum == '1' ? '第2阶梯' : '第3阶梯'
+                <div
+                  v-for="(item, index) in scope.row.waterPriceSteps"
+                  :key="index"
+                  class="pricestepNum"
+                >
+                  {{
+                    item.pricestepNum == '0'
+                      ? '第1阶梯'
+                      : item.pricestepNum == '1'
+                      ? '第2阶梯'
+                      : '第3阶梯'
                   }}
                 </div>
               </span>
               <span v-else>
-                <div class="pricestepNum">
-                  恒定水价
-                </div>
+                <div class="pricestepNum">恒定水价</div>
               </span>
             </template>
             <template #priceYield="scope">
               <span v-if="scope.row.priceconfigWaterchargingtype == 1">
                 <div v-for="(item, index) in scope.row.waterPriceSteps" :key="index" class="pricestepNum">
-                  {{ item.pricestepUsagemin + ' - ' + item.pricestepUsagemax }}
+                  {{ item.pricestepUsagemin + ' - ' + changeNum(item.pricestepUsagemax) }}
                 </div>
               </span>
               <span v-else>
-                <div class="pricestepNum">
-                  -
-                </div>
+                <div class="pricestepNum">-</div>
               </span>
             </template>
             <template #averageWaterPrice="scope">
               <span v-if="scope.row.priceconfigWaterchargingtype == 1">
-                <div v-for="(item, index) in scope.row.waterPriceSteps" :key="index" class="pricestepNum">
+                <div
+                  v-for="(item, index) in scope.row.waterPriceSteps"
+                  :key="index"
+                  class="pricestepNum"
+                >
                   {{ item.pricestepUnitprice }}
                 </div>
               </span>
@@ -75,39 +99,49 @@
               </span>
             </template>
             <template #stepPriceOrNot="scope">
-             {{ scope.row.priceconfigElectricitychargingtype == 1 ? '是' : '否' }}
+              {{
+                scope.row.priceconfigElectricitychargingtype == 1 ? '是' : '否'
+              }}
             </template>
             <template #elecPriceName="scope">
               <span v-if="scope.row.priceconfigElectricitychargingtype == 1">
-                <div v-for="(item, index) in scope.row.elecPriceSteps" :key="index" class="pricestepNum">
+                <div
+                  v-for="(item, index) in scope.row.elecPriceSteps"
+                  :key="index"
+                  class="pricestepNum"
+                >
                   {{
-                    item.pricestepNum == '0' ? '第1阶梯' : item.pricestepNum == '1' ? '第2阶梯': '第3阶梯'
+                    item.pricestepNum == '0'
+                      ? '第1阶梯'
+                      : item.pricestepNum == '1'
+                      ? '第2阶梯'
+                      : '第3阶梯'
                   }}
                 </div>
               </span>
               <span v-else>
-                <div class="pricestepNum">
-                  恒定电价
-                </div>
+                <div class="pricestepNum">恒定电价</div>
               </span>
             </template>
             <template #elecPriceSteps="scope">
               <span v-if="scope.row.priceconfigElectricitychargingtype == 1">
                 <div v-for="(item, index) in scope.row.elecPriceSteps" :key="index" class="pricestepNum">
-                  {{ item.pricestepUsagemin + ' - ' + item.pricestepUsagemax }}
+                  {{ item.pricestepUsagemin + ' - ' + changeNum(item.pricestepUsagemax) }}
                 </div>
               </span>
               <span v-else>
-                <div class="pricestepNum">
-                  -
-                </div>
+                <div class="pricestepNum">-</div>
               </span>
             </template>
             <template #averageElecPriceSteps="scope">
               <span v-if="scope.row.priceconfigElectricitychargingtype == 1">
-              <div v-for="(item, index) in scope.row.elecPriceSteps" :key="index" class="pricestepNum">
-                {{ item.pricestepUnitprice }}
-              </div>
+                <div
+                  v-for="(item, index) in scope.row.elecPriceSteps"
+                  :key="index"
+                  class="pricestepNum"
+                >
+                  {{ item.pricestepUnitprice }}
+                </div>
               </span>
               <span v-else>
                 <div class="pricestepNum">
@@ -116,10 +150,24 @@
               </span>
             </template>
             <template #operate="scope">
-              <el-link size="small" :underline="false" type="primary" style="margin-right: 10px"
-                @click="editAssociation(scope.row)">修改</el-link>
-              <el-link size="small" :underline="false" type="danger" style="margin-right: 10px"
-                @click="deleteHandler(scope.row)">删除</el-link>
+              <el-link
+                size="small"
+                :underline="false"
+                type="primary"
+                style="margin-right: 10px"
+                @click="editAssociation(scope.row)"
+                v-hasPermi="['wpr:price:edit']"
+                >修改</el-link
+              >
+              <el-link
+                size="small"
+                :underline="false"
+                type="danger"
+                style="margin-right: 10px"
+                @click="deleteHandler(scope.row)"
+                v-hasPermi="['wpr:price:delete']"
+                >删除</el-link
+              >
             </template>
           </b-table>
         </el-col>
@@ -130,6 +178,10 @@
       :editRow="editRow"
       @clearEdit="handlerClearEdit"
     />
+    <set-annual-water-right-add
+      :visible.sync="addAssociationManageShow"
+      @clearEdit="handlerClearEdit"
+    />
   </el-row>
 </template>
 
@@ -139,13 +191,14 @@ import SelectTree from '@/components/SelectTree';
 import BTable from '@/components/Table/index.vue';
 import { Waterchargingtype, Electricitychargingtype } from './status'
 import setAnnualWaterRight from './components/setAnnualWaterRight.vue'
+import setAnnualWaterRightAdd from './components/setAnnualWaterRightAdd.vue'
 import { getPriceList, deletePrice } from '@/api/price/index.js'
 import { getTree } from '@/api/tree.js'
 import { assign, omit } from 'lodash-es';
 
 export default {
   name: 'waterElectricityPriceSetting',
-  components: { BTable, setAnnualWaterRight, SelectTree },
+  components: { BTable, setAnnualWaterRight, SelectTree, setAnnualWaterRightAdd },
   data() {
     return {
       form: {
@@ -154,6 +207,7 @@ export default {
       areaId: '',
       loading: false,
       associationManageShow: false,
+      addAssociationManageShow: false,
       priceConfigVal: '',
       priceconfigWaterchargingtype: '',
       priceconfigElectricitychargingtype: '',
@@ -172,19 +226,22 @@ export default {
           value: '0',
           label: '恒定水价',
           type: Waterchargingtype
-        }, {
+        },
+        {
           value: '1',
           label: '阶梯水价',
           type: Waterchargingtype
-        }, {
+        },
+        {
           value: '2',
           label: '恒定电价',
           type: Electricitychargingtype
-        }, {
+        },
+        {
           value: '3',
           label: '阶梯电价',
           type: Electricitychargingtype
-        },
+        }
       ],
       columns: [
         {
@@ -210,27 +267,32 @@ export default {
           prop: 'waterPriceSteps',
           customRender: 'priceYield',
           align: 'center'
-        }, {
+        },
+        {
           label: '水价(元/m³)',
           prop: 'waterPriceSteps',
           customRender: 'averageWaterPrice',
           align: 'center'
-        }, {
+        },
+        {
           label: '是否阶梯电价',
           prop: 'priceconfigElectricitychargingtype',
           customRender: 'stepPriceOrNot',
           align: 'center'
-        }, {
+        },
+        {
           label: '电价名称',
           prop: 'elecPriceSteps',
           customRender: 'elecPriceName',
           align: 'center'
-        }, {
+        },
+        {
           label: '电量(度)',
           prop: 'elecPriceSteps',
           customRender: 'elecPriceSteps',
           align: 'center'
-        }, {
+        },
+        {
           label: '电价(元/度)',
           prop: 'elecPriceSteps',
           customRender: 'averageElecPriceSteps',
@@ -245,72 +307,81 @@ export default {
     };
   },
   mounted() {
-    this.getWaterrightList()
+    this.getWaterrightList();
   },
   methods: {
+    changeNum(num) {
+      return num == null ? '∞' : num
+     },
+    addAssociation() { 
+      this.addAssociationManageShow = true
+    },
     editAssociation(row) {
-      this.editRow = row
-      this.associationManageShow = true
+      this.editRow = row;
+      this.associationManageShow = true;
     },
     async getWaterrightList() {
       if (!this.areaId) {
-        const res = await getTree()
-        this.treeData = res?.data
+        const res = await getTree();
+        this.treeData = res?.data;
         this.treeData.unshift({
+          id: '',
           cusareaId: '',
-          cusareaName: '行政区域(全国)'
+          cusareaName: '全部'
         })
         this.areaId = this.treeData[0].cusareaId
       }
     },
     handlerClick(value) {
-      this.areaId = value?.cusareaId
+      this.areaId = value?.cusareaId;
     },
     handlerClearEdit() {
       this.editRow = {
         cusareaName: ''
-      }
-      this.handleSearch()
+      };
+      this.handleSearch();
     },
     handleChange(value) {
       switch (value) {
         case '0':
-          this.priceconfigWaterchargingtype = 0
-          this.priceconfigElectricitychargingtype = ''
-          break
+          this.priceconfigWaterchargingtype = 0;
+          this.priceconfigElectricitychargingtype = '';
+          break;
         case '1':
-          this.priceconfigWaterchargingtype = 1
-          this.priceconfigElectricitychargingtype = ''
-          break
+          this.priceconfigWaterchargingtype = 1;
+          this.priceconfigElectricitychargingtype = '';
+          break;
         case '2':
-          this.priceconfigWaterchargingtype = ''
-          this.priceconfigElectricitychargingtype = 0
-          break
+          this.priceconfigWaterchargingtype = '';
+          this.priceconfigElectricitychargingtype = 0;
+          break;
         case '3':
-          this.priceconfigWaterchargingtype = ''
-          this.priceconfigElectricitychargingtype = 1
-          break
+          this.priceconfigWaterchargingtype = '';
+          this.priceconfigElectricitychargingtype = 1;
+          break;
         default:
-          this.priceconfigWaterchargingtype = ''
-          this.priceconfigElectricitychargingtype = ''
+          this.priceconfigWaterchargingtype = '';
+          this.priceconfigElectricitychargingtype = '';
       }
     },
     loadData(parameter) {
       const params = {
         areaId: this.areaId,
         priceconfigWaterchargingtype: this.priceconfigWaterchargingtype,
-        priceconfigElectricitychargingtype: this.priceconfigElectricitychargingtype
-      }
+        priceconfigElectricitychargingtype:
+          this.priceconfigElectricitychargingtype
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return getPriceList(payload)
+      return getPriceList(payload);
     },
     getTableData() {
       const params = {
         areaId: this.areaId,
         priceconfigWaterchargingtype: this.priceconfigWaterchargingtype,
-        priceconfigElectricitychargingtype: this.priceconfigElectricitychargingtype
-      }
-      return getPriceList(params)
+        priceconfigElectricitychargingtype:
+          this.priceconfigElectricitychargingtype
+      };
+      return getPriceList(params);
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
@@ -319,40 +390,38 @@ export default {
       this.$refs.tableRef.refresh(false);
     },
     goDetail(row) {
-      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
+      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno);
     },
     deleteHandler(row) {
-      const { priceconfigId } = row
-      this.$modal
-      .confirm(`是否确认删除`)
-      .then(() => {
+      const { priceconfigId } = row;
+      this.$modal.confirm(`是否确认删除`).then(() => {
         deletePrice({
           priceconfigIds: priceconfigId
         }).then(() => {
-          Message({ message: "删除成功", type: 'success' });
-          this.handlerChange()
-        })
-      })
+          Message({ message: '删除成功', type: 'success' });
+          this.handlerChange();
+        });
+      });
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
   min-height: 100%;
 }
-.pricestepNum{
-  border-bottom: 1px solid #EBEEF5;
+.pricestepNum {
+  border-bottom: 1px solid #ebeef5;
 }
-::v-deep .el-table__row{
-  .el-table__cell{
+::v-deep .el-table__row {
+  .el-table__cell {
     padding: 0;
   }
-  .cell{
+  .cell {
     padding: 0;
-    line-height:44px;
+    line-height: 44px;
   }
 }
 .elrow-main__col-top {

+ 65 - 45
src/views/infrastructure/waterEstablishment.vue

@@ -1,14 +1,11 @@
 <template>
   <el-row class="el-row-container" v-loading="loading">
-    <el-col
-      :span="24"
-      style="padding: 16px; height: 100%"
-    >
+    <el-col :span="24" style="padding: 16px; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
-          <div style="display:flex">
+          <div style="display: flex">
             <el-select
-              style="width: 100%;margin-right:16px;"
+              style="width: 100%; margin-right: 16px"
               laceholder="请选择您的年份"
               v-model="waterrightYear"
             >
@@ -16,18 +13,19 @@
                 v-for="item in options"
                 :key="item.value"
                 :label="item.label"
-                :value="item.value">
+                :value="item.value"
+              >
               </el-option>
             </el-select>
             <select-tree
-              :placeholder="'年份'" 
-              style="width:100%"
+              :placeholder="'年份'"
+              style="width: 100%"
               :treeData="treeData"
               @handlerClick="handlerClick"
               :checkVal="cusareaName"
             ></select-tree>
             <el-button
-              style="margin-left: 16px;"
+              style="margin-left: 16px"
               type="primary"
               size="small"
               @click="handleSearch"
@@ -39,9 +37,10 @@
               type="primary"
               size="small"
               @click="setAnnualWaterRight"
+              v-hasPermi="['wpr:power:setup']"
               >设置年度水权
-              </el-button
-            ></div>
+            </el-button>
+          </div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
           <!--  -->
@@ -57,6 +56,7 @@
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
+                v-hasPermi="['wpr:power:edit']"
                 @click="handlerRecompose(scope.row)"
                 >修改</el-link
               >
@@ -71,36 +71,42 @@
       @resetEdit="resetEdit"
       @refresh="handlerChange"
     />
-    <water-price-setting :visible.sync="waterprice" @refresh="handleSearch"/>
+    <water-price-setting :visible.sync="waterprice" @refresh="handleSearch" />
   </el-row>
 </template>
 
 <script>
-import { getTree } from '@/api/tree.js'
-import { getWaterrightList } from '@/api/waterright/index.js'
+import { getTree } from '@/api/tree.js';
+import { getWaterrightList } from '@/api/waterright/index.js';
 import SelectTree from '@/components/SelectTree';
 import BTable from '@/components/Table/index.vue';
-import setAnnualWaterRight from './components/setAnnualWaterRight.vue'
-import waterPriceSetting from './components/waterPriceSetting.vue'
-import recompose from './components/recompose.vue'
+import setAnnualWaterRight from './components/setAnnualWaterRight.vue';
+import waterPriceSetting from './components/waterPriceSetting.vue';
+import recompose from './components/recompose.vue';
 import { assign, omit } from 'lodash-es';
 
 export default {
   name: 'waterEstablishment',
-  components: { BTable,setAnnualWaterRight, recompose,waterPriceSetting,SelectTree },
+  components: {
+    BTable,
+    setAnnualWaterRight,
+    recompose,
+    waterPriceSetting,
+    SelectTree
+  },
   data() {
     return {
       form: {
         productName: ''
       },
-      options:[],
+      options: [],
       treeData: [],
       loading: false,
       recomposeShow: false,
       waterprice: false,
-      cusareaName:'',
+      cusareaName: '',
       waterrightYear: new Date().getFullYear(),
-      areaId:'',
+      areaId: '',
       editRow: {},
       columns: [
         {
@@ -120,7 +126,8 @@ export default {
           prop: 'waterrightAmount',
           customRender: '',
           align: 'left'
-        },{
+        },
+        {
           label: '亩均水权(亩/m³)',
           prop: 'amountPerMu',
           customRender: '',
@@ -137,56 +144,69 @@ export default {
   },
   methods: {
     setYear() {
-      this.options = []
-      let date = new Date
-      let currentYear = date.getFullYear()
-      this.currentYear = currentYear
+      this.options = [];
+      let date = new Date();
+      let currentYear = date.getFullYear();
+      this.currentYear = currentYear;
       for (let i = 0; i < 5; i++) {
         this.options.push({
           label: currentYear - i,
           value: currentYear - i
-        })
+        });
       }
     },
     resetEdit() {
-      this.editRow = {}
+      this.editRow = {};
     },
     async loadData(parameter) {
-      this.setYear()
-      if(!this.areaId) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+      this.setYear();
+      if (!this.areaId) {
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.cusareaName ||= this.treeData[0].cusareaName
         this.areaId = this.treeData[0].cusareaId
       }
       const params = {
         areaId: this.areaId,
         waterrightYear: this.waterrightYear
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return this.getTableData(payload)
+      return this.getTableData(payload);
     },
     getTableData(payload) {
-      return getWaterrightList(payload)
+      return getWaterrightList(payload);
     },
     handlerClick(value) {
-      this.areaId = value?.cusareaId
+      this.areaId = value?.cusareaId;
     },
-    handleSearch() { 
+    handleSearch() {
       this.$refs.tableRef.refresh(true);
     },
     handlerChange() {
       this.$refs.tableRef.refresh(false);
     },
     setAnnualWaterRight() {
-      this.waterprice = true
+      this.waterprice = true;
     },
     // loadData(parameter) {
     //   const queryform = this.form;
@@ -197,15 +217,15 @@ export default {
     //   return {}
     // },
     handlerRecompose(row) {
-      this.editRow = row
-      this.recomposeShow = true
+      this.editRow = row;
+      this.recomposeShow = true;
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {

+ 91 - 203
src/views/monitoringMamage/components/IrrigationRecord.vue

@@ -1,271 +1,154 @@
 <template>
-  <el-dialog
-    title="灌溉记录"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    @close="handleClose"
-    width="1200px"
-  >
-  <div style="margin-bottom: 20px">
-    <span>农户姓名:</span>
-    <el-input
-      v-model="form.tarcecodeapplyno"
-      style="width: 250px;margin:0 15px;"
-      placeholder="请i输入农户编号/姓名/电话"
-      @keyup.enter.native="handleSearch"
-      clearable
-    />
-    <span>时间:</span>
-    <el-input
-      v-model="form.tarcecodeapplyno"
-      style="width: 250px;margin:0 15px;"
-      placeholder="请i输入农户编号/姓名/电话"
-      @keyup.enter.native="handleSearch"
-      clearable
-    />
-    <el-button
-      type="primary"
-      size="small"
-      @click="handleSearch"
-      >查询</el-button
-    >
-  </div>
-  <b-table
-    ref="tableRef"
-    :args="{ 'highlight-current-row': true }"
-    :data="loadData"
-    :columns="columns"
-  >
-    <template #styleImg="scope">
-      <el-image
-        :src="scope.row.imgPreview"
-        :preview-src-list="[scope.row.imgPreview]"
-        slot="error"
-        class="image-slot"
-        style="width: 100px; height: 50px"
-      >
-        <div slot="error" class="image-slot"></div>
-      </el-image>
-    </template>
-    <template #number="scope">
-      <div>1</div>
-      <div>2</div>
-      {{ scope.row.finishGoodName&&scope.row.finishgoodNo?scope.row.finishGoodName + '-' + scope.row.finishgoodNo:'' }}
-    </template>
-    <template #codeNo="scope">           
-      <el-link
-        type="primary"
-        :underline="false"
-        @click="goDetail(scope.row)"
-        >{{ scope.row.traceCodeApplyConcat }}</el-link
-      >
-    </template>
-    <template #status="scope">
-      <span style="display:flex;align-items:center;justify-content:center">
-        <span class="status"></span>
-        {{ scope.row.name }}
-      </span>
-    </template>
-    <template #useNumber="scope">
-      {{ scope.row.useNumber + '/' + scope.row.totalNumber }}
-    </template>
-    <template #finishGoodName="scope">
-      {{ scope.row.finishGoodName&&scope.row.finishgoodNo?scope.row.finishGoodName + '-' + scope.row.finishgoodNo:'' }}
-    </template>
-  </b-table>
+  <el-dialog title="灌溉记录" :visible.sync="dialogVisible" :close-on-click-modal="false" :close-on-press-escape="false"
+    @close="handleClose" width="1400px">
+    <div style="margin-bottom: 20px">
+      <el-date-picker v-model="dateValue" clearable type="daterange" value-format="yyyy-MM-dd HH:mm:ss"
+        :default-time="['00:00:00', '23:59:59']" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
+      </el-date-picker>
+      <el-button type="primary" size="small" style="margin-left: 16px;" @click="handleSearch">查询</el-button>
+    </div>
+    <b-table ref="tableRef" :args="{ 'highlight-current-row': true }" :data="loadData" :columns="columns" showIndex>
+      <template #cardusercdBillingtype="scope">
+        <span style="display:flex;align-items:center;justify-content:center">
+          {{ changeDict(scope.row.cardusercdBillingtype) }}
+        </span>
+      </template>
+    </b-table>
   </el-dialog>
 </template>
 
 <script>
+import { getCardusercdList } from '@/api/card/index.js'
 import { assign, omit } from 'lodash-es';
 import LeftImg from '../assets/img.svg'
 import BTable from '@/components/Table'
 export default {
   name: 'IrrigationRecord',
   props: {
-    data: {
-      default() {
-        return {};
-      }
-    },
     visible: {
       type: Boolean,
       default: false
+    },
+    irrigationDetail: {
+      type: Object,
+      default: () => { }
     }
   },
   data() {
     return {
       LeftImg: LeftImg,
+      dateValue: '',
       columns: [
         {
-          label: '行政区',
-          prop: 'person',
+          label: '水源编号',
+          prop: 'waterNum',
           customRender: '',
-          align: 'center'
+          align: 'center',
         },
         {
-          label: '农户',
-          prop: 'area',
+          label: '水源名称',
+          prop: 'waterName',
           customRender: '',
           align: 'center'
         },
         {
-          label: '手机号',
-          prop: 'name',
+          label: '本次耗水量(m³)',
+          prop: 'cardusercdWaternum',
           customRender: '',
           align: 'center'
         },
         {
-          label: '计量模式',
-          prop: 'phone',
-          customRender: 'number',
-          align: 'center'
-        },{
-          label: '总金额',
-          prop: 'phone',
+          label: '本次用电量(度)',
+          prop: 'cardusercdElectricnum',
           customRender: '',
           align: 'center'
-        },{
-          label: '用水量',
-          prop: 'phone',
-          customRender: '',
-          align: 'center'
-        },{
-          label: '用水金额',
-          prop: 'phone',
+        },
+        {
+          label: '开始时间',
+          prop: 'cardusercdStarttime',
           customRender: '',
           align: 'center'
-        },{
-          label: '用电量',
-          prop: 'phone',
+        },
+        {
+          label: '结束时间',
+          prop: 'cardusercdEndtime',
           customRender: '',
           align: 'center'
-        },{
-          label: '用电金额',
-          prop: 'phone',
+        },
+        {
+          label: '使用时长',
+          prop: 'cardusercdDuration',
           customRender: '',
           align: 'center'
-        },{
-          label: '开泵时间',
-          prop: 'phone',
-          customRender: '',
+        },
+        {
+          label: '计费方式',
+          prop: 'cardusercdBillingtype',
+          customRender: 'cardusercdBillingtype',
           align: 'center'
-        },{
-          label: '关泵时间',
-          prop: 'phone',
+        },
+        {
+          label: '计费标准',
+          prop: 'cardusercdPriceinfo',
           customRender: '',
           align: 'center'
-        },{
-          label: '灌溉时长',
-          prop: 'phone',
+        },
+        {
+          label: '扣除金额',
+          prop: 'cardusercdUsemoney',
           customRender: '',
           align: 'center'
         }
       ],
-      form: {
-        productName: ''
-      },
       dialogVisible: false,
-      baseForm: {
-        productName: '',
-        stockAmount: '',
-        goodsSpecValue: '',
-        supplierId: '',
-      },
-      hasFetched: false,
-      rules: {
-        stockAmount: [
-          { required: true, message: '请选择负责人', trigger: 'blur' }
-        ],
-        sourceinfoId: [
-          { required: true, message: '请选择管辖范围', trigger: 'blur' }
-        ],
-        productName: [
-          { required: true, message: '请输入协会名称', trigger: 'blur' }
-        ],
-        supplierId: [
-          { required: false, message: '请输入协会介绍', trigger: 'blur' }
-        ],
-        goodsSpecValue: [
-          { required: true, message: '请选择规格', trigger: 'blur' }
-        ]
-      }
     };
   },
-  components:{
+  components: {
     BTable
   },
   watch: {
     visible(val) {
       if (val !== this.dialogVisible) {
         this.dialogVisible = val;
-        if (val) {
-          assign(this.baseForm, this.data);
-          if (!this.hasFetched) {
-            this.hasFetched = true;
-          }
-        }
       }
     },
-    data: {
-      deep: true,
+    irrigationDetail: {
       handler(val) {
-        assign(this.baseForm, val);
-      }
+        const tmnId = val?.tmnId
+        this.tmnId = tmnId
+        this.handleSearch()
+      },
+      deep: true
     }
   },
   methods: {
+    changeDict(flag) {
+      switch (flag) {
+        case '0':
+          return '水电双计'
+        case '1':
+          return '只计水'
+        case '2':
+          return '只计电'
+       }
+     },
     loadData(parameter) {
-      const queryform = this.form;
-      const payload = omit(assign({}, parameter, queryform, {orderByColumn:'tarcecodeapplyCreateddate',isAsc:'desc'}), []);
+      const payload = omit(assign({}, parameter), []);
       return this.getTableData(payload);
     },
-    handleSearch() { },
-    getTableData(payload) {
-      return Promise.resolve({
-        data: [{
-            person:"王大虎",
-            area: '2016-05-02',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙<br>江路 1518 弄'
-          }, {
-            person:"王大虎",
-            area: '2016-05-04',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1517 弄'
-          }, {
-            person:"王大虎",
-            area: '2016-05-01',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1519 弄'
-          }, {
-            person:"王大虎",
-            area: '2016-05-03',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1516 弄'
-          }]
-      })
+    handleSearch() {
+      this.$refs.tableRef && this.$refs.tableRef.refresh(true);
     },
-    resetForm(formName) {
-      this.dialogVisible = false;
-    },
-    resetFormData() {
-      this.baseForm = {};
-    },
-    submitForm(formName) {
-      this.$refs[formName].validate((valid) => {
-        console.log(valid)
+    getTableData() {
+      const [startTime, endTime] = this.dateValue
+      return getCardusercdList({
+        tmdId: this.tmnId,
+        startTime,
+        endTime
       })
     },
-
     handleClose() {
       this.$emit('update:visible', false);
-      this.resetForm('baseForm');
     },
   }
 };
@@ -275,25 +158,30 @@ export default {
 .input-number {
   width: 100%;
 }
-h3{
+
+h3 {
   height: 14px;
   color: #333333;
   font-size: 14px;
   font-weight: 700;
-  margin:0 0 20px 0;
+  margin: 0 0 20px 0;
 }
-.right_content{
+
+.right_content {
   margin-bottom: 10px;
-  label{
+
+  label {
     color: #999;
     font-size: 14px;
     font-weight: 400;
   }
-  span{
+
+  span {
     color: #333333;
     font-size: 14px;
   }
 }
+
 .base-form {
   max-height: 70vh;
   overflow-y: auto;

+ 63 - 188
src/views/monitoringMamage/components/realTimeMonitor.vue

@@ -1,13 +1,13 @@
 <template>
   <el-dialog
-    title="实时测"
+    title="实时测"
     :visible.sync="dialogVisible"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
     @close="handleClose"
     width="1200px"
   >
-  <h3>淮河社区居民委员会机井(6544425)</h3>
+  <h3>{{ realDtaile.waterName }}</h3>
   <el-row style="margin-bottom: 20px;">
     <el-col :span="6">
       <el-image :src="LeftImg"/>
@@ -16,16 +16,16 @@
       <el-row class="right_content">
         <el-col :span="6">
           <label>设备状态:</label>
-          <span>在线</span>
+          <span>{{ realDtaile.tmnstatusRunstatusContent || '-' }}</span>
         </el-col>
         <el-col :span="12">
           <label>水泵:</label>
-          <span></span>
+          <span>{{ tmnstatusRunstatus }}</span>
         </el-col>
       </el-row>
       <div class="right_content">
         <label>详细地址:</label>
-        <span>河南省/郑州市/二七区/淮河路街道/淮河社区居民委员会</span>
+        <span>{{ realDtaile.waterAddress  || '-' }}</span>
       </div>
       <el-row class="right_content">
         <el-col :span="6">
@@ -34,12 +34,12 @@
         </el-col>
         <el-col :span="12">
           <label>水泵功率:</label>
-          <span>3W</span>
+          <span>-</span>
         </el-col>
       </el-row>
       <div class="right_content" style="margin:0">
         <label>灌溉面积:</label>
-        <span>125亩</span>
+        <span>-</span>
       </div>
     </el-col>
   </el-row>
@@ -50,40 +50,10 @@
     :data="loadData"
     :columns="columns"
     isShowIndex
-    :showPagination="false"
   >
-    <template #styleImg="scope">
-      <el-image
-        :src="scope.row.imgPreview"
-        :preview-src-list="[scope.row.imgPreview]"
-        slot="error"
-        class="image-slot"
-        style="width: 100px; height: 50px"
-      >
-        <div slot="error" class="image-slot"></div>
-      </el-image>
-    </template>
-    <template #codeNo="scope">           
-      <el-link
-        type="primary"
-        :underline="false"
-        @click="goDetail(scope.row)"
-        >{{ scope.row.traceCodeApplyConcat }}</el-link
-      >
+     <template #pump_status="scope">           
+      {{ scope.row.pump_status == 0 ? '关': '开' }}
     </template>
-    <template #status="scope">
-      <span style="display:flex;align-items:center;justify-content:center">
-        <span class="status"></span>
-        {{ scope.row.name }}
-      </span>
-    </template>
-    <template #useNumber="scope">
-      {{ scope.row.useNumber + '/' + scope.row.totalNumber }}
-    </template>
-    <template #finishGoodName="scope">
-      {{ scope.row.finishGoodName&&scope.row.finishgoodNo?scope.row.finishGoodName + '-' + scope.row.finishgoodNo:'' }}
-    </template>
-
     <template #operate="scope">
       <el-link
         size="small"
@@ -103,45 +73,35 @@
       >
     </template>
   </b-table>
-
-    <div style="text-align: right;margin-top:20px">
-      <el-button type="info" plain @click="resetForm('baseForm')"
-        >取消</el-button
-      >
-      <el-button
-        type="primary"
-        style="margin-left:16px;"
-        @click="submitForm('baseForm')"
-        :disabled="dialogSubmitLoading"
-        :loading="dialogSubmitLoading"
-        >确定</el-button
-      >
-    </div>
+  <div style="text-align: right;margin-top:20px">
+   
+  </div>
   </el-dialog>
 </template>
 
 <script>
+import dayjs from 'dayjs'
 import { assign, omit } from 'lodash-es';
-import { UPLOAD_TYPE_MAP } from '@/utils/constants';
 import LeftImg from '../assets/img.svg'
 import BTable from '@/components/Table'
+import { getDataInfo } from '@/api/card/index2.js'
 export default {
   name: 'realTimeMonitor',
   props: {
-    data: {
-      default() {
-        return {};
-      }
-    },
     visible: {
       type: Boolean,
       default: false
+    },
+    realDtaile: {
+      type: Object,
+      default: () => { }
     }
   },
   data() {
     return {
       LeftImg: LeftImg,
-      imageUploadType: UPLOAD_TYPE_MAP.FARMING_RECORD,
+      query: '',
+      tmnstatusRunstatus: '关',
       columns: [
         {
           label: '农户姓名',
@@ -151,39 +111,39 @@ export default {
         },
         {
           label: '手机号',
-          prop: 'area',
+          prop: 'phone',
           customRender: '',
           align: 'center'
         },
         {
           label: '瞬时流量( m³/s)',
-          prop: 'name',
+          prop: 'cur_flow',
           customRender: '',
           align: 'center'
         },
         {
           label: '累计流量(m³)',
-          prop: 'phone',
+          prop: 'sum_water',
           customRender: '',
           align: 'center'
         },{
           label: '电压(v)',
-          prop: 'phone',
+          prop: 'voltage',
           customRender: '',
           align: 'center'
         },{
           label: '水位(m)',
-          prop: 'phone',
+          prop: 'liu_deep',
           customRender: '',
           align: 'center'
         },{
           label: '状态',
-          prop: 'phone',
-          customRender: '',
+          prop: 'pump_status',
+          customRender: 'pump_status',
           align: 'center'
         },{
           label: '上传时间',
-          prop: 'phone',
+          prop: 'timer',
           customRender: '',
           align: 'center'
         }
@@ -200,28 +160,6 @@ export default {
         supplierId: '',
         imageArr2: []
       },
-      productList: [],
-      syinfoList: [],
-      processList: [],
-      hasFetched: false,
-      landList: [], //基地列表
-      rules: {
-        stockAmount: [
-          { required: true, message: '请选择负责人', trigger: 'blur' }
-        ],
-        sourceinfoId: [
-          { required: true, message: '请选择管辖范围', trigger: 'blur' }
-        ],
-        productName: [
-          { required: true, message: '请输入协会名称', trigger: 'blur' }
-        ],
-        supplierId: [
-          { required: false, message: '请输入协会介绍', trigger: 'blur' }
-        ],
-        goodsSpecValue: [
-          { required: true, message: '请选择规格', trigger: 'blur' }
-        ]
-      }
     };
   },
   components:{
@@ -231,118 +169,55 @@ export default {
     visible(val) {
       if (val !== this.dialogVisible) {
         this.dialogVisible = val;
-        if (val) {
-          assign(this.baseForm, this.data);
-          if (!this.hasFetched) {
-            this.getProductList();
-            this.getSyinfoList();
-            this.getProcessList();
-            this.hasFetched = true;
-          }
-        }
       }
     },
-    data: {
-      deep: true,
+    realDtaile: {
       handler(val) {
-        // console.log(val)
-        assign(this.baseForm, val);
-        // console.log(this.baseForm)
-      }
+        this.query = val?.tmnId
+        this.handleSearch()
+      },
+      deep: true
     }
   },
-  created() {},
-  mounted() {},
   methods: {
-    loadData(parameter) {
-      const queryform = this.form;
-      const payload = omit(assign({}, parameter, queryform, {orderByColumn:'tarcecodeapplyCreateddate',isAsc:'desc'}), []);
-      return this.getTableData(payload);
-    },
-    getTableData(payload) {
-      return Promise.resolve({
-        data: [{
-            person:"王大虎",
-            area: '2016-05-02',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1518 弄'
-          }, {
-            person:"王大虎",
-            area: '2016-05-04',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1517 弄'
-          }, {
-            person:"王大虎",
-            area: '2016-05-01',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1519 弄'
-          }, {
-            person:"王大虎",
-            area: '2016-05-03',
-            name: '王小虎',
-            phone: 1588888888,
-            address: '上海市普陀区金沙江路 1516 弄'
-          }]
-      })
-    },
-    getProductList() {
-    },
-    getSyinfoList() {
-    },
-    getProcessList() {
-    },
-    goProductsPage() {
-      this.handleClose();
-      this.$router.push({
-        path: '/Products',
-        query: {}
-      });
-    },
-    goSourceInfoPage() {
-      this.handleClose();
-      this.$router.push({
-        path: '/sourceInfo',
-        query: {
-          type: 'add'
-        }
-      });
-    },
-    goProcessPage() {
-      this.handleClose();
-      this.$router.push({
-        path: '/basicsettings/process',
-        query: {}
-      });
-    },
     resetForm(formName) {
       this.dialogVisible = false;
     },
-    resetFormData() {
-      this.baseForm = {};
+    loadData(parameter) {
+      const payload = omit(assign({}, parameter), []);
+      return this.getTableData(payload);
     },
-    submitForm(formName) {
-      this.$refs[formName].validate((valid) => {
-        console.log(valid)
-      })
+    handleSearch() {
+      this.$refs.tableRef && this.$refs.tableRef.refresh(true);
     },
-
-    handleClose() {
-      this.$emit('update:visible', false);
-      this.resetForm('baseForm');
+   async getTableData() {
+     const res = await getDataInfo(this.query)
+     const resData = res?.data
+     const list = resData?.valve
+     const list2 = resData?.nowData
+     const resList = {}
+     resList.person = '-'
+     resList.phone = '-'
+     resList.voltage = '-'
+     resList.timer = dayjs().format('YYYY-MM-DD')
+     resList.pump_status = list?.pump_status?.value
+     this.tmnstatusRunstatus = resList.pump_status == 0 ? '关':'开'
+     resList.sum_ele = list?.sum_ele?.value
+     resList.sum_water = list?.sum_water?.value
+     resList.cur_flow = list2?.cur_flow?.value
+     resList.line_press = list2?.line_press?.value
+     resList.liu_deep = list2?.liu_deep?.value
+     const params = {
+       data: [resList],
+       total: 1
+     }
+     return new Promise((resolve, reject) => { 
+      resolve(params)
+     })
     },
-    handleSuccess() {
-      this.resetForm('baseForm');
+    handleClose() {
       this.$emit('update:visible', false);
-      this.$emit('success');
     },
-    handleKeyUp(target, key) {
-      target[key] = target[key].match(/\d+(\.\d{0,2})?/)
-        ? target[key].match(/\d+(\.\d{0,2})?/)[0]
-        : '';
-    }
   }
 };
 </script>

+ 286 - 217
src/views/monitoringMamage/index.vue

@@ -1,217 +1,264 @@
 <template>
   <el-row class="el-row-container" v-loading="loading">
-    <el-col
-      :span="4"
-      style="height:100%;padding-bottom:32px;"
-    >
-    <el-card style="margin:16px;height: 100%; overflow-y: auto">
-      <data-report-left
-        @setCurrentData="setCurrentData"
-        :treeData="treeData"
-      ></data-report-left>
-    </el-card>
+    <el-col :span="4" style="height: 100%; padding-bottom: 32px">
+      <el-card style="margin: 16px; height: 100%; overflow-y: auto">
+        <data-report-left
+          @setCurrentData="setCurrentData"
+          :treeData="treeData"
+        ></data-report-left>
+      </el-card>
     </el-col>
-    <el-col
-      :span="20"
-    >
-    <el-card style="overflow-y: hidden;min-height:180px;margin-bottom:16px;">
-      <div style="margin-bottom: 16px; display:flex;justify-content:space-between">
-        <div>
-          <span style="font-weight:bold">机井情况</span>(总数: {{ resData.tmnCount }} 口)
-        </div>
-        <div>
-          <el-date-picker
-            v-model="dateValue"
-            type="daterange"
-            value-format="yyyy-MM-dd HH:mm:ss"
-            :default-time="['00:00:00', '23:59:59']"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            style="width: 300px; margin:0 16px"
-          >
-          </el-date-picker>
-          <el-button
-            type="primary"
-            size="small"
-            @click="getTopListHandler"
-            >查询</el-button
-          >
+    <el-col :span="20">
+      <el-card
+        style="overflow-y: hidden; min-height: 180px; margin-bottom: 16px"
+      >
+        <div
+          style="
+            margin-bottom: 16px;
+            display: flex;
+            justify-content: space-between;
+          "
+        >
+          <div>
+            <span style="font-weight: bold">机井情况</span>(总数:
+            {{ resData.tmnCount }} 口)
+          </div>
+          <div>
+            <el-date-picker
+              v-model="dateValue"
+              type="daterange"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              :default-time="['00:00:00', '23:59:59']"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              style="width: 300px; margin: 0 16px"
+            >
+            </el-date-picker>
+            <el-button type="primary" size="small" @click="getTopListHandler"
+              >查询</el-button
+            >
+          </div>
         </div>
-      </div>
-      <div style="height:100px;width:auto;overflow:hidden">
-        <el-row>
-          <el-col :span="14">
-            <el-row :gutter="8">
-              <el-col 
-                :span="4" 
-                class="right_width" 
-                v-for="item in dataList" 
-                :key="item.title"
-              >
-                <div class="left">
-                  <span>
-                    <div :class="item.styleClass"></div>
+        <div style="height: 100px; width: auto; overflow: hidden">
+          <el-row>
+            <el-col :span="14">
+              <el-row :gutter="8">
+                <el-col
+                  :span="4"
+                  class="right_width"
+                  v-for="item in dataList"
+                  :key="item.title"
+                >
+                  <div class="left">
+                    <span>
+                      <div :class="item.styleClass"></div>
                       {{ item.title }}
                     </span>
-                  <div>
-                    {{ item.number }}
-                  </div>
-                </div>
-              </el-col>
-            </el-row>
-          </el-col>
-          <el-col :span="10">
-            <div style="display:flex;justify-content: space-around">
-              <echarts-pie style="width:30%;margin-left:5%" :proportion="proportion"/>
-              <div style="width:65%">
-              <el-row :gutter="20">
-                <el-col :span="12">
-                  <div class="radius_container">
-                    <span class="radius"></span>
-                    <span class="label">计划用水量: </span> {{ resData.waterrightAmount }} 吨
-                  </div>
-                  <div class="radius_container">
-                    <span class="radius"></span>
-                    <span class="label">累计用水量: </span>  {{ resData.waterNumTotal }} 吨
-                  </div>
-                  <div class="radius_container">
-                    <span class="radius"></span>
-                    <span class="label">累计用电量: </span>  {{ resData.elecNumTotal }} 吨
-                  </div>
-                </el-col>
-                <el-col :span="12">
-                  <div class="radius_container">
-                    <span class="label">累计费用: </span>  {{ resData.useMoneyTotal }} 元
-                  </div>
-                  <div class="radius_container">
-                    <span class="label">累计用水费用: </span>  {{ resData.usewatermoneyTotal }} 元
-                  </div>
-                  <div class="radius_container">
-                    <span class="label">累计用电费用: </span>  {{ resData.useelecmoneyTotal }} 元
+                    <div>
+                      {{ item.number }}
+                    </div>
                   </div>
                 </el-col>
               </el-row>
-            </div>
-            </div>
-          </el-col>
-        </el-row>
-      </div>
-    </el-card>
-    <el-card style="height: calc(100% - 180px); overflow-y: auto;">
-      <el-col :span="24" class="elrow-main__col-top">
-        <div>
-          <el-input
-            v-model="waterKeyword"
-            style="width: 250px;margin-right:20px;"
-            placeholder="请输入机井编号/机井名称"
-            clearable
-          />
-          <el-select
-            v-model="tmnstatusRunstatus"
-            style="width: 200px;margin-right:16px"
-            placeholder="设备状态"
-            clearable
-          >
-          <el-option
-            v-for="item in options"
-            :key="item.value"
-            :value="item.value"
-            :label="item.label"
-          ></el-option>
-        </el-select>
-          <el-button
-            type="primary"
-            size="small"
-            @click="handleSearch"
-            >查询</el-button
-          >
+            </el-col>
+            <el-col :span="10">
+              <div style="display: flex; justify-content: space-around">
+                <echarts-pie
+                  style="width: 30%; margin-left: 5%"
+                  :proportion="proportion"
+                />
+                <div style="width: 65%">
+                  <el-row :gutter="20">
+                    <el-col :span="12">
+                      <div class="radius_container">
+                        <span class="radius"></span>
+                        <span class="label">计划用水量: </span>
+                        {{ resData.waterrightAmount }} 吨
+                      </div>
+                      <div class="radius_container">
+                        <span class="radius"></span>
+                        <span class="label">累计用水量: </span>
+                        {{ resData.waterNumTotal }} 吨
+                      </div>
+                      <div class="radius_container">
+                        <span class="radius"></span>
+                        <span class="label">累计用电量: </span>
+                        {{ resData.elecNumTotal }} 吨
+                      </div>
+                    </el-col>
+                    <el-col :span="12">
+                      <div class="radius_container">
+                        <span class="label">累计费用: </span>
+                        {{ resData.useMoneyTotal }} 元
+                      </div>
+                      <div class="radius_container">
+                        <span class="label">累计用水费用: </span>
+                        {{ resData.usewatermoneyTotal }} 元
+                      </div>
+                      <div class="radius_container">
+                        <span class="label">累计用电费用: </span>
+                        {{ resData.useelecmoneyTotal }} 元
+                      </div>
+                    </el-col>
+                  </el-row>
+                </div>
+              </div>
+            </el-col>
+          </el-row>
         </div>
-      </el-col>
-      <el-col :span="24" class="elrow-main__col-bottom">
-        <b-table
-          ref="tableRef"
-          :args="{ 'highlight-current-row': true }"
-          :data="loadData"
-          :columns="columns"
-          isShowIndex
-        >
-          <template #status="scope">
-            <span style="display:flex;align-items:center;justify-content:center">
-              <span class="status nowork" v-if="scope.row.tmnstatusRunstatusContent == '空闲中'"></span>
-              <span class="status work" v-if="scope.row.tmnstatusRunstatusContent == '工作中'"></span>
-              <span class="status error" v-if="scope.row.tmnstatusRunstatusContent == '故障'"></span>
-              <span class="status nolive" v-if="scope.row.tmnstatusRunstatusContent == '离线'"></span>
-              {{ scope.row.tmnstatusRunstatusContent }}
-            </span>
-          </template>
-
-          <template #operate="scope">
-            <el-link
-              size="small"
-              :underline="false"
-              type="primary"
-              style="margin-right: 10px"
-              @click="realTime(scope.row)"
-              >实时监测</el-link
+      </el-card>
+      <el-card style="height: calc(100% - 180px); overflow-y: auto">
+        <el-col :span="24" class="elrow-main__col-top">
+          <div>
+            <el-input
+              v-model="waterKeyword"
+              style="width: 250px; margin-right: 20px"
+              placeholder="请输入机井编号/机井名称"
+              clearable
+            />
+            <el-select
+              v-model="tmnstatusRunstatus"
+              style="width: 200px; margin-right: 16px"
+              placeholder="设备状态"
+              clearable
             >
-            <el-link
-              size="small"
-              :underline="false"
-              type="primary"
-              style="margin-right: 10px"
-              @click="irrigationShowHistory(scope.row)"
-              >灌溉记录</el-link
+              <el-option
+                v-for="item in options"
+                :key="item.value"
+                :value="item.value"
+                :label="item.label"
+              ></el-option>
+            </el-select>
+            <el-button type="primary" size="small" @click="handleSearch"
+              >查询</el-button
             >
-          </template>
-        </b-table>
-      </el-col>
-    </el-card>
+          </div>
+        </el-col>
+        <el-col :span="24" class="elrow-main__col-bottom">
+          <b-table
+            ref="tableRef"
+            :args="{ 'highlight-current-row': true }"
+            :data="loadData"
+            :columns="columns"
+            isShowIndex
+          >
+            <template #status="scope">
+              <span
+                style="
+                  display: flex;
+                  align-items: center;
+                  justify-content: center;
+                "
+              >
+                <span
+                  class="status nowork"
+                  v-if="scope.row.tmnstatusRunstatusContent == '空闲中'"
+                ></span>
+                <span
+                  class="status work"
+                  v-if="scope.row.tmnstatusRunstatusContent == '工作中'"
+                ></span>
+                <span
+                  class="status error"
+                  v-if="scope.row.tmnstatusRunstatusContent == '故障'"
+                ></span>
+                <span
+                  class="status nolive"
+                  v-if="scope.row.tmnstatusRunstatusContent == '离线'"
+                ></span>
+                {{ scope.row.tmnstatusRunstatusContent }}
+              </span>
+            </template>
+
+            <template #operate="scope">
+              <el-link
+                size="small"
+                :underline="false"
+                type="primary"
+                style="margin-right: 10px"
+                @click="realTime(scope.row)"
+                v-hasPermi="['wpr:monitor:realtime']"
+                >实时监测</el-link
+              >
+              <el-link
+                size="small"
+                :underline="false"
+                type="primary"
+                style="margin-right: 10px"
+                @click="irrigationShowHistory(scope.row)"
+                v-hasPermi="['wpr:Irrigation:records']"
+                >灌溉记录</el-link
+              >
+            </template>
+          </b-table>
+        </el-col>
+      </el-card>
     </el-col>
-    <real-time-monitor :visible.sync="realTimeShow"/>
-    <irrigation-record :visible.sync="irrigationShow" />
+    <real-time-monitor
+      :visible.sync="realTimeShow"
+      :realDtaile="realDtaile"
+    />
+    <irrigation-record 
+      :visible.sync="irrigationShow"
+      :irrigationDetail="irrigationDetail"
+    />
   </el-row>
 </template>
 
 <script>
-import { getBaseList, getTopList } from '@/api/tmn/index.js'
-import EchartsPie from './components/echartsPie.vue'
+import { getBaseList, getTopList } from '@/api/tmn/index.js';
+import EchartsPie from './components/echartsPie.vue';
 import BTable from '@/components/Table/index.vue';
-import DataReportLeft from '@/components/DataReportLeft/index.vue'
+import DataReportLeft from '@/components/DataReportLeft/index.vue';
 import realTimeMonitor from './components/realTimeMonitor.vue';
 import IrrigationRecord from './components/IrrigationRecord.vue';
-import { getTree } from '@/api/tree.js'
+import { getTree } from '@/api/tree.js';
 import { assign, omit } from 'lodash-es';
 
 export default {
   name: 'monitoringMamage',
-  components: { BTable,DataReportLeft,EchartsPie,realTimeMonitor,IrrigationRecord },
+  components: {
+    BTable,
+    DataReportLeft,
+    EchartsPie,
+    realTimeMonitor,
+    IrrigationRecord
+  },
   data() {
     return {
+      irrigationDetail: {},
+      realDtaile: {},
       dateValue:'',
       form: {
         productName: ''
       },
-      dataList: [{
-        title: '在线',
-        number: 0,
-        styleClass: 'radius'
-      }, {
-        title: '运行',
-        number: 0,
-        styleClass: 'radius run'
-      }, {
-        title: '故障',
-        number: 0,
-        styleClass: 'radius error'
-      }, {
-        title: '告警',
-        number: 0,
-        styleClass: 'radius waring'
-      }, {
-        title: '离线',
-        number: 0,
-        styleClass: 'radius noliving'
-      }],
+      dataList: [
+        {
+          title: '在线',
+          number: 0,
+          styleClass: 'radius'
+        },
+        {
+          title: '运行',
+          number: 0,
+          styleClass: 'radius run'
+        },
+        {
+          title: '故障',
+          number: 0,
+          styleClass: 'radius error'
+        },
+        {
+          title: '告警',
+          number: 0,
+          styleClass: 'radius waring'
+        },
+        {
+          title: '离线',
+          number: 0,
+          styleClass: 'radius noliving'
+        }
+      ],
       options: [
         {
           label: '全部',
@@ -232,7 +279,7 @@ export default {
         {
           label: '离线',
           value: 'O'
-        },
+        }
       ],
       treeData: [],
       loading: false,
@@ -269,22 +316,25 @@ export default {
           prop: 'tmnstatusRunstatusContent',
           customRender: 'status',
           align: 'center'
-        }, {
+        },
+        {
           label: '累计用水量',
           prop: 'waterNumTotal',
           customRender: '',
           align: 'center'
-        }, {
+        },
+        {
           label: '累计用电量',
           prop: 'elecNumTotal',
           customRender: '',
           align: 'center'
-        }, {
+        },
+        {
           label: '更新时间',
           prop: 'tmnstatusUpdateddate',
           customRender: '',
           align: 'center'
-        }, 
+        },
         {
           label: '操作',
           customRender: 'operate',
@@ -307,28 +357,43 @@ export default {
     //   const data = res?.data
     //   this.treeData = data
     // },
-    irrigationShowHistory() {
+    irrigationShowHistory(row) {
       this.irrigationShow = true
+      this.irrigationDetail = row
     },
-    
+
     setCurrentData(areaId) {
-      this.areaId = areaId
+      this.areaId = areaId;
       this.$refs.tableRef.refresh(false);
     },
-    realTime() {
+    realTime(row) {
       this.realTimeShow = true
+      this.realDtaile = row
     },
     async loadData(parameter) {
       if (!this.areaId) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.cusareaName ||= this.treeData[0].cusareaName
         this.areaId = this.treeData[0].cusareaId
       }
@@ -336,55 +401,59 @@ export default {
         areaId: this.areaId,
         tmnstatusRunstatus: this.tmnstatusRunstatus,
         waterKeyword: this.waterKeyword
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
-      this.getTopListHandler()
-      return this.getTableData(payload)
+      this.getTopListHandler();
+      return this.getTableData(payload);
     },
     getTableData(payload) {
-      return getBaseList(payload)
+      return getBaseList(payload);
     },
-    async getTopListHandler() { 
-      let [startTime, endTime] = this.dateValue
-      startTime ||= new Date().getFullYear()
+    async getTopListHandler() {
+      let [startTime, endTime] = this.dateValue;
+      startTime ||= new Date().getFullYear();
       const res = await getTopList({
         areaId: this.areaId,
         startTime,
         endTime
-      })
-      const resData = res?.data
-      this.resData = resData
-      this.proportion = this.resData.proportion
+      });
+      const resData = res?.data;
+      this.resData = resData;
+      this.proportion = this.resData.proportion;
       this.dataList = [
         {
           title: '在线',
           number: resData?.tmnCount1,
           styleClass: 'radius'
-        }, {
+        },
+        {
           title: '运行',
           number: resData?.tmnCount2,
           styleClass: 'radius run'
-        }, {
+        },
+        {
           title: '故障',
           number: resData?.tmnCount3,
           styleClass: 'radius error'
-        }, {
+        },
+        {
           title: '告警',
           number: resData?.tmnCount5,
           styleClass: 'radius waring'
-        }, {
+        },
+        {
           title: '离线',
           number: resData?.tmnCount4,
           styleClass: 'radius noliving'
         }
-      ]
+      ];
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
     },
     goDetail(row) {
-      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
-    },
+      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno);
+    }
   },
   mounted() {
     // this.getTreeList()
@@ -393,5 +462,5 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-@import './monitoringMamage.scss'
+@import './monitoringMamage.scss';
 </style>

+ 74 - 35
src/views/peasantHouseholdManage/components/addedFarmers.vue

@@ -102,6 +102,27 @@
                 </el-row>
               </el-form-item>
             </el-col>
+              <el-col :span="12">
+                <el-form-item label="土地面积" prop="farmerAreasize">
+                  <el-row>
+                    <el-col style="position:relative">
+                      <el-input
+                        v-model="baseForm.farmerAreasize"
+                        type="number"
+                        filterable
+                        style="width: 90%"
+                        placeholder="请输入土地面积"
+                      >
+                      </el-input>
+                      <span style="position:absolute;margin-left:10px">亩</span>
+                    </el-col>
+                  </el-row>
+                </el-form-item>
+              </el-col>
+          </el-row>
+        </el-col>
+        <el-col :span="24">
+          <el-row>
             <el-col :span="12">
               <el-form-item label="水权" prop="farmerWramount">
                 <el-row>
@@ -120,27 +141,6 @@
             </el-col>
           </el-row>
         </el-col>
-        <el-col :span="24">
-          <el-row>
-            <el-col :span="12">
-              <el-form-item label="土地面积" prop="farmerAreasize">
-                <el-row>
-                  <el-col style="position:relative">
-                    <el-input
-                      v-model="baseForm.farmerAreasize"
-                      type="number"
-                      filterable
-                      style="width: 90%"
-                      placeholder="请输入土地面积"
-                    >
-                    </el-input>
-                    <span style="position:absolute;margin-left:10px">亩</span>
-                  </el-col>
-                </el-row>
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-col>
       </el-row>
     </el-form>
     <div style="text-align: right">
@@ -160,8 +160,8 @@
 </template>
 
 <script>
+import { Message } from 'element-ui'
 import { isValidIDCard, checkPhone } from '@/utils/index.js'
-import { assign } from 'lodash-es';
 import SelectTree from '@/components/SelectTree';
 import { addFarmer,editFarmer, getAreaInfo } from '@/api/farmer/list.js'
 
@@ -202,7 +202,9 @@ export default {
       areaAll: '0',
       waterRightAll: '0',
       yieldPer: '0',
-      residualWaterRight:'0',
+      residualWaterRight: '0',
+      areasizeResidue: '0',
+      currentItem: {},
       rules: {
         areaId: [
           { required: true, message: '请选择所属区域', trigger: 'blur' }
@@ -239,21 +241,33 @@ export default {
           {
             required: true, validator: (rule, value, callback) => {
               if (!value) { callback(new Error('请输入土地面积')); return }
-              if (isNaN(value)) callback(new Error('请正确输入您的土地面积'))
-              else if (value > this.areaAll) {
-                callback(new Error('输入的土地面积不能大于总面积'))
+              if (+value < 0) {  callback(new Error('土地面积不能为负数')); return }
+              if (isNaN(value)) { callback(new Error('请正确输入您的土地面积')); return }
+              if (this.isEdit) {
+                if (+value > (+this.areasizeResidue) + (+this.editFarmerData.farmerAreasize)) {
+                  callback(new Error('输入的土地面积不能大于总面积'))
+                  return
+                } else {
+                  callback()
+                }
               } else {
-                callback()
+                if (+value > +this.areasizeResidue) {
+                  callback(new Error('输入的水权不能大于剩余面积'))
+                  return
+                } else {
+                  callback()
+                }
               }
             }, trigger: 'blur' }
         ],
         farmerWramount: [
           {
             required: true, validator: (rule, value, callback) => {
-              if (!value) { callback(new Error('请输入水权')); return }
+              if (value == 0) { callback(new Error('请输入水权')); return }
+              if (+value < 0) { callback(new Error('水权不能为负数')); return }
               if (isNaN(value)) { callback(new Error('请正确输入您的水权')); return }
               if (this.isEdit) {
-                if (+value > (+this.residualWaterRight) + (+this.editFarmerData.farmerWrbalance)) {
+                if (+value > (+this.residualWaterRight) + (+this.editFarmerData.farmerWramount)) {
                   callback(new Error('输入的水权不能大于剩余水权'))
                   return
                 } else { 
@@ -278,20 +292,29 @@ export default {
         this.dialogVisible = val;
       }
       if (!val) {
-        this.$refs.baseForm.clearValidate()
-        this.baseForm = {}
+        this.$refs.baseForm?.clearValidate()
+        this.baseForm = { areaId:'' }
+        this.$emit('closeHandler')
         this.cusareaName = ''
         this.clearItem()
       }
     },
+    'baseForm.farmerAreasize': {
+      handler(val) {
+        if (this.yieldPer > 0) { 
+          this.baseForm.farmerWramount = Number(this.yieldPer) * val
+        }
+      },
+      deep: true,
+      immediate: true
+    },
     editFarmerData: {
       handler(val) {
-        if (this.isEdit) { 
+        if (this.isEdit && val?.areaId) { 
           this.baseForm = { ...val }
           this.handlerClick(val)
-          this.cusareaName = val?.cusareaName || ''
         } else {
-          this.baseForm = {}
+          this.baseForm = { areaId: '' }
           this.cusareaName =  ''
         }
       },
@@ -303,6 +326,12 @@ export default {
       },
       deep: true,
       immediate: true
+    },
+    'baseForm.areaId': {
+      handler(val) {
+        val && this.$refs.baseForm?.clearValidate('areaId')
+      },
+      deep: true
     }
   },
   methods: {
@@ -314,6 +343,7 @@ export default {
       this.yieldPer = value ? value?.waterrightAmount == 0 ? 0 : (value?.waterrightAreasize) / (value?.waterrightAmount) : 0
       this.yieldPer = (+this.yieldPer).toFixed(2)
       this.residualWaterRight = value?.amountResidue ?? 0
+      this.areasizeResidue = value?.areasizeResidue ?? 0
       this.residualWaterRight = (+this.residualWaterRight).toFixed(2)
     },
     clearItem() { 
@@ -330,14 +360,23 @@ export default {
         waterrightYear: new Date().getFullYear(),
         areaId: item.areaId
       })
+      this.currentItem = item
       const value = res?.data
-      this.baseForm.areaId = value?.areaId
+      this.cusareaName = item?.cusareaName
+      const areaId = item?.areaId || ''
+      this.baseForm.areaId = areaId
+      this.$set(this.baseForm,'areaId', areaId)
       this.setItem(value)
     },
     resetForm() {
       this.dialogVisible = false;
+      this.cusareaName = ''
     },
     async handlerAddFarmer() {
+      if (this.currentItem?.children?.length > 0) {
+        Message.warning('请选择最小行政区块')
+        return
+       }
       if(!this.isEdit){
         const res = await addFarmer(this.baseForm)
         if(res?.code === "000000") {

+ 144 - 94
src/views/peasantHouseholdManage/index.vue

@@ -1,26 +1,20 @@
 <template>
   <el-row class="el-row-container" style="height: 100%" v-loading="loading">
-    <el-col
-      :span="4"
-      style="height:100%;padding-bottom:32px;"
-    >
-    <el-card style="margin:16px;height: 100%; overflow-y: auto">
-      <data-report-left
-        @setCurrentData="setCurrentData"
-        :treeData="treeData"
-      ></data-report-left>
-    </el-card>
+    <el-col :span="4" style="height: 100%; padding-bottom: 32px">
+      <el-card style="margin: 16px; height: 100%; overflow-y: auto">
+        <data-report-left
+          @setCurrentData="setCurrentData"
+          :treeData="treeData"
+        ></data-report-left>
+      </el-card>
     </el-col>
-    <el-col
-      :span="20"
-      style="padding: 16px 16px 16px 0; height: 100%"
-    >
+    <el-col :span="20" style="padding: 16px 16px 16px 0; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
-          <div style="display:flex">
+          <div style="display: flex">
             <el-input
               v-model="farmerName"
-              style="width: 250px;"
+              style="width: 250px"
               placeholder="请输入姓名/电话"
               @keyup.enter.native="handleSearch"
               clearable
@@ -28,10 +22,10 @@
             <el-button
               type="primary"
               size="small"
-              style="margin: 0 16px;"
+              style="margin: 0 16px"
               @click="handleSearch"
               >查询</el-button
-            > 
+            >
             <el-upload
               class="avatar-uploader"
               :action="uploadUrl"
@@ -40,13 +34,15 @@
               :on-error="handleUploadError"
               name="file"
               :headers="headers"
-              :data="{areaId: this.currentClickId}"
+              :data="{ areaId: this.currentClickId }"
               :before-upload="beforeAvatarUpload"
-            ><el-button
+              ><el-button
                 size="small"
                 type="primary"
-                style="height:36px;margin-right:16px"
-              >导入</el-button>
+                style="height: 36px; margin-right: 16px"
+                v-hasPermi="['wpr:farmer:import']"
+                >导入</el-button
+              >
             </el-upload>
             <el-button
               class="filter-item"
@@ -54,16 +50,19 @@
               type="primary"
               icon="el-icon-download"
               @click="downloadExcel()"
-              >下载模板</el-button>
+              v-hasPermi="['wpr:farmer:template:upload']"
+              >下载模板</el-button
+            >
           </div>
           <div class="top-left">
             <el-button
               type="primary"
               size="small"
               @click="addAssociation"
+              v-hasPermi="['wpr:farmer:add']"
               >新增农户
-              </el-button
-            ></div>
+            </el-button>
+          </div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
           <b-table
@@ -74,7 +73,13 @@
             isShowIndex
           >
             <template #status="scope">
-              <span style="display:flex;align-items:center;justify-content:center">
+              <span
+                style="
+                  display: flex;
+                  align-items: center;
+                  justify-content: center;
+                "
+              >
                 <span class="status"></span>
                 {{ scope.row.name }}
               </span>
@@ -86,6 +91,7 @@
                 type="primary"
                 style="margin-right: 10px"
                 @click="irrigationShowHistory(scope.row)"
+                v-hasPermi="['wpr:farmer:Irrigation:records']"
                 >灌溉记录</el-link
               >
               <el-link
@@ -93,23 +99,29 @@
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
+                v-hasPermi="['wpr:farmer:edit']"
                 @click="editFarmerHandler(scope.row)"
-              >修改</el-link>
+                >修改</el-link
+              >
               <el-link
                 size="small"
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
+                v-hasPermi="['wpr:farmer:info']"
                 @click="showDetails(scope.row)"
-              >详情</el-link>
+                >详情</el-link
+              >
               <el-link
                 slot="reference"
                 size="small"
                 :underline="false"
                 type="danger"
                 style="margin-right: 10px"
+                v-hasPermi="['wpr:farmer:delete']"
                 @click="deleteRow(scope.row)"
-              >删除</el-link>
+                >删除</el-link
+              >
             </template>
           </b-table>
         </el-col>
@@ -122,6 +134,7 @@
     :isEdit="isEdit"
     :currentClickId="currentClickId"
     @refresh="handleSearch"
+    @closeHandler="closeHandler"
   />
   <farmer-management 
     :visible.sync="farmerManageShow"
@@ -135,33 +148,44 @@
 </template>
 
 <script>
-import { getToken } from "@/utils/auth";
-import { Message } from 'element-ui'
-import { getTree } from '@/api/tree.js'
-import { getWaterrightList } from '@/api/waterright/index.js'
-import { getFarmerList,deleteFarmer,getFarmerDetail } from '@/api/farmer/list.js'
+import { getToken } from '@/utils/auth';
+import { Message } from 'element-ui';
+import { getTree } from '@/api/tree.js';
+import { getWaterrightList } from '@/api/waterright/index.js';
+import {
+  getFarmerList,
+  deleteFarmer,
+  getFarmerDetail
+} from '@/api/farmer/list.js';
 import BTable from '@/components/Table/index.vue';
-import DataReportLeft from '@/components/DataReportLeft/index.vue'
-import AddedFarmers from './components/addedFarmers.vue'
+import DataReportLeft from '@/components/DataReportLeft/index.vue';
+import AddedFarmers from './components/addedFarmers.vue';
 import FarmerManagement from './components/farmerManagement.vue';
 import IrrigationRecord from './components/IrrigationRecord.vue';
 import { assign, omit } from 'lodash-es';
 
 export default {
   name: 'peasantHouseholdManage',
-  components: { BTable,DataReportLeft,AddedFarmers,FarmerManagement,IrrigationRecord },
+  components: {
+    BTable,
+    DataReportLeft,
+    AddedFarmers,
+    FarmerManagement,
+    IrrigationRecord
+  },
   data() {
     return {
-      uploadUrl: process.env.VUE_APP_BASE_API + "/wpr/farmer/import", // 上传的图片服务器地址
+      uploadUrl: process.env.VUE_APP_BASE_API + '/wpr/farmer/import', // 上传的图片服务器地址
       headers: {
-        Authorization: "Bearer " + getToken()
+        Authorization: 'Bearer ' + getToken()
       },
+      currentData: {},
       visibles: false,
       farmerName: '',
       detailsData: {},
       treeData: [],
       treeDatas: [],
-      currentClick:{},
+      currentClick: {},
       irrigationDetail: {},
       isEdit: false,
       loading: false,
@@ -171,7 +195,7 @@ export default {
       editFarmerData: {},
       farmerId: '',
       requestData: {},
-      currentClickId:'',
+      currentClickId: '',
       columns: [
         {
           label: '农户姓名',
@@ -182,26 +206,29 @@ export default {
         {
           label: '农户身份证',
           prop: 'farmerIdcard',
+          width: 200,
           customRender: '',
           align: 'center',
-          width: 160
         },
         {
           label: '联系电话',
           prop: 'farmerPhone',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '种植面积(亩)',
           prop: 'farmerAreasize',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '水权数量(m³)',
           prop: 'farmerWramount',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '剩余水权(m³)',
           prop: 'farmerWrbalance',
           customRender: '',
@@ -213,95 +240,120 @@ export default {
           width: 200,
           align: 'center'
         }
-      ],
+      ]
     };
   },
   methods: {
+    closeHandler() {
+      this.editFarmerData = {}
+    },
     handleAvatarSuccess(res, file) {
       if (res.code !== '000000') {
-        Message.error(res?.msg)
-        return
-      } else { 
-        Message.success('导入成功')
+        Message.error(res?.msg);
+        return;
+      } else {
+        Message.success('导入成功');
       }
     },
     handleUploadError() {
-      Message.error("图片插入失败");
+      Message.error('图片插入失败');
     },
-    beforeAvatarUpload(file) {
+    beforeAvatarUpload() {
+      if (this.currentData?.children?.length > 0) { 
+        Message.warning('请选择最小行政区块')
+        return false
+      }
       this.requestData = {
         areaId: this.currentClickId
-      }
+      };
     },
     downloadExcel() {
-      const href = process.env.NODE_ENV === 'production' ? "../../../wpr/static/template.xlsx" : "../../../static/template.xlsx"
-      let a = document.createElement("a");
+      const href =
+        process.env.NODE_ENV === 'production'
+          ? '../../../wpr/static/template.xlsx'
+          : '../../../static/template.xlsx';
+      let a = document.createElement('a');
       a.href = href;
-      a.download = "农户信息统计表.xlsx";
-      a.style.display = "none";
+      a.download = '农户信息统计表.xlsx';
+      a.style.display = 'none';
       document.body.appendChild(a);
       a.click();
       a.remove();
     },
     editFarmerHandler(row) {
-      this.associationManageShow = true
-      this.isEdit = true
-      this.editFarmerData = row
+      this.associationManageShow = true;
+      this.isEdit = true;
+      this.editFarmerData = row;
     },
     async getDetail(farmerId) {
-      const res  = await getFarmerDetail({
+      const res = await getFarmerDetail({
         farmerId
-      })
-      this.detailsData = res?.data
+      });
+      this.detailsData = res?.data;
     },
     async getWaterrighTreetList(currentClickId) {
-      const date = new Date()
-      const waterrightYear = date.getFullYear()
+      const date = new Date();
+      const waterrightYear = date.getFullYear();
       const res = await getWaterrightList({
         waterrightYear
-      })
-      this.treeDatas = res?.data ?? []
+      });
+      this.treeDatas = res?.data ?? [];
     },
     async loadData(parameter) {
-      if(!this.currentClickId ) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+      if (!this.currentClickId) {
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.currentClick = res?.data[0]
         this.currentClickId = this.currentClick?.cusareaId
+        this.currentData = this.currentClick
         this.getWaterrighTreetList(this.currentClickId)
       }
       const params = {
         farmerName: this.farmerName,
         areaId: this.currentClickId
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return getFarmerList(payload)
+      return getFarmerList(payload);
     },
-    setCurrentData(areaId) {
+    setCurrentData(areaId, data) {
+      this.currentData = data
       this.currentClickId = areaId
       this.$refs.tableRef.refresh(false);
     },
     irrigationShowHistory(row) {
-      this.irrigationDetail = row
-      this.irrigationShow = true
+      this.irrigationDetail = row;
+      this.irrigationShow = true;
     },
     // 详情
-    showDetails(row){
-      this.farmerManageShow = true
-      this.farmerId = row.farmerId
-      this.getDetail(row.farmerId)
+    showDetails(row) {
+      this.farmerManageShow = true;
+      this.farmerId = row.farmerId;
+      this.getDetail(row.farmerId);
     },
     addAssociation() {
-      this.isEdit = false
-      this.editFarmerData = {}
-      this.associationManageShow = true
+      this.isEdit = false;
+      this.editFarmerData = {};
+      this.associationManageShow = true;
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
@@ -310,23 +362,21 @@ export default {
       this.$refs.tableRef.refresh(false);
     },
     deleteRow(row) {
-      this.$modal
-      .confirm(`是否确认删除农户${row.farmerName}`)
-      .then(()=> {
+      this.$modal.confirm(`是否确认删除农户${row.farmerName}`).then(() => {
         deleteFarmer({
           farmerIds: row.farmerId
         }).then(() => {
-          Message({ message: "删除成功", type: 'success' });
-          this.handlerChange()
-        })
-      })
+          Message({ message: '删除成功', type: 'success' });
+          this.handlerChange();
+        });
+      });
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {
@@ -346,7 +396,7 @@ export default {
     }
   }
 }
-.status{
+.status {
   display: inline-block;
   width: 8px;
   height: 8px;

+ 83 - 48
src/views/waterCardManage/components/rechargeCard.vue

@@ -47,11 +47,11 @@
           </el-form-item>
         </el-col>
       </el-row>
-      
+
       <el-row :gutter="10">
         <el-col :span="24">
           <el-form-item label="当前余额" prop="cardAmount">
-            {{rechargeCardData.cardAmount}} 元
+            {{ rechargeCardData.cardAmount }} 元
           </el-form-item>
         </el-col>
       </el-row>
@@ -63,8 +63,9 @@
                 <el-input
                   type="number"
                   placeholder="充值金额"
-                  style="width: 100px;margin-right: 10px"
-                  v-model="baseForm.rechargercdRechargeamount">
+                  style="width: 100px; margin-right: 10px"
+                  v-model="baseForm.rechargercdRechargeamount"
+                >
                 </el-input>
               </el-col>
@@ -76,23 +77,49 @@
         <el-col :span="24">
           <el-form-item label="支付方式" prop="rechargercdRechargetype">
             <div>
-              <span @click="() => changePayType('pay')" :class="payType === 'pay' ? 'xianjin_pay_action' : ''" class="pay">
+              <span
+                @click="() => changePayType('pay')"
+                :class="payType === 'pay' ? 'xianjin_pay_action' : ''"
+                class="pay"
+              >
                 <div class="img_container">
-                  <img :src="cash" class="icon"/>
+                  <img :src="cash" class="icon" />
                   现金支付
+                  <img
+                    :src="weixinRightBottom"
+                    class="bottomRight"
+                    v-if="payType === 'pay'"
+                  />
                 </div>
               </span>
-              <span  @click="() => changePayType('weixin')" :class="payType === 'weixin' ? 'weixin_pay_action' : ''" class="pay">
+              <span
+                @click="() => changePayType('weixin')"
+                :class="payType === 'weixin' ? 'weixin_pay_action' : ''"
+                class="pay"
+              >
                 <div class="img_container">
-                  <img :src="weixin" class="icon"/>
+                  <img :src="weixin" class="icon" />
                   微信支付
-                  <img :src="weixinRightBottom" class="bottomRight" v-if="payType === 'weixin'"/>
+                  <img
+                    :src="weixinRightBottom"
+                    class="bottomRight"
+                    v-if="payType === 'weixin'"
+                  />
                 </div>
               </span>
-              <span  @click="() => changePayType('zhifubao')" :class="payType === 'zhifubao' ? 'zhifubao_pay_action' : ''" class="pay">
+              <span
+                @click="() => changePayType('zhifubao')"
+                :class="payType === 'zhifubao' ? 'zhifubao_pay_action' : ''"
+                class="pay"
+              >
                 <div class="img_container">
-                <img :src="zhifubao" class="icon_zfb"/>
-              </div>
+                  <img :src="zhifubao" class="icon_zfb" />
+                  <img
+                    :src="weixinRightBottom"
+                    class="bottomRight"
+                    v-if="payType === 'zhifubao'"
+                  />
+                </div>
               </span>
             </div>
           </el-form-item>
@@ -106,7 +133,7 @@
       >
       <el-button
         type="primary"
-        style="margin-left:16px;"
+        style="margin-left: 16px"
         @click="submitForm('baseForm')"
         :disabled="dialogSubmitLoading"
         :loading="dialogSubmitLoading"
@@ -117,13 +144,13 @@
 </template>
 
 <script>
-import { rechargeCard } from '@/api/card/index.js'
+import { rechargeCard } from '@/api/card/index.js';
 import { assign } from 'lodash-es';
-import cash from '../assets/cash.svg'
-import weixin from '../assets/weixin.svg'
-import weixinAction from '../assets/weixin_action.svg'
-import zhifubao from '../assets/zhifubao.svg'
-import weixinRightBottom from '../assets/weixin_right_bottom.svg'
+import cash from '../assets/cash.svg';
+import weixin from '../assets/weixin.svg';
+import weixinAction from '../assets/weixin_action.svg';
+import zhifubao from '../assets/zhifubao.svg';
+import weixinRightBottom from '../assets/weixin_right_bottom.svg';
 export default {
   name: 'rechargeCard',
   props: {
@@ -131,7 +158,7 @@ export default {
       type: Boolean,
       default: false
     },
-    rechargeCardData:{
+    rechargeCardData: {
       type: Object,
       default: () => {}
     }
@@ -153,7 +180,12 @@ export default {
       hasFetched: false,
       rules: {
         rechargercdRechargeamount: [
-          { required: true, pattern: /^[1-9]\d*(\.\d+)?$/, message: '请正确输入充值金额', trigger: 'blur' }
+          {
+            required: true,
+            pattern: /^[1-9]\d*(\.\d+)?$/,
+            message: '请正确输入充值金额',
+            trigger: 'blur'
+          }
         ]
       }
     };
@@ -169,12 +201,13 @@ export default {
           }
         }
       }
-    },
+    }
   },
   methods: {
     changePayType(payType) {
-      this.payType = payType
-      this.rechargercdRechargetype = payType == 'pay' ? 0 : payType == 'weixin' ? 1 : 2
+      this.payType = payType;
+      this.rechargercdRechargetype =
+        payType == 'pay' ? 0 : payType == 'weixin' ? 1 : 2;
     },
     resetForm(formName) {
       this.$refs[formName].resetFields();
@@ -185,8 +218,10 @@ export default {
       this.baseForm = {};
     },
     async rechargeCardHandler() {
-      const { cardId  } = this.rechargeCardData
-      const rechargercdRechargeamount = Number(this.baseForm.rechargercdRechargeamount)
+      const { cardId } = this.rechargeCardData;
+      const rechargercdRechargeamount = Number(
+        this.baseForm.rechargercdRechargeamount
+      );
       /*
         现金 0
         微信 1
@@ -196,21 +231,21 @@ export default {
         cardId,
         rechargercdRechargeamount,
         rechargercdRechargetype: this.rechargercdRechargetype
-      })
-      if(res?.code === "000000") {
-        this.handleClose()
-        this.$emit('refresh')
+      });
+      if (res?.code === '000000') {
+        this.handleClose();
+        this.$emit('refresh');
       }
     },
     submitForm(formName) {
       this.$refs[formName].validate((valid) => {
-        valid && this.rechargeCardHandler()
-      })
+        valid && this.rechargeCardHandler();
+      });
     },
     handleClose() {
       this.$emit('update:visible', false);
       this.resetForm('baseForm');
-    },
+    }
   }
 };
 </script>
@@ -232,7 +267,7 @@ export default {
   overflow-x: hidden;
   padding: 0 20px;
 }
-.img_container{
+.img_container {
   display: flex;
   height: 40px;
   justify-content: center;
@@ -241,28 +276,28 @@ export default {
   color: #333333;
   font-size: 14px;
   font-weight: 400;
-  .bottomRight{
+  .bottomRight {
     position: absolute;
-    right:0;
-    bottom:0;
+    right: 0;
+    bottom: 0;
   }
-  .icon{
-    margin:0 8px 0 8px;
+  .icon {
+    margin: 0 8px 0 8px;
   }
-  .icon_zfb{
+  .icon_zfb {
     margin-left: -12px;
   }
 }
-.xianjin_pay_action{
-  border: 1px solid #F4A72F !important;
+.xianjin_pay_action {
+  border: 1px solid #f4a72f !important;
 }
-.weixin_pay_action{
-  border: 1px solid #14A478 !important;
+.weixin_pay_action {
+  border: 1px solid #14a478 !important;
 }
-.zhifubao_pay_action{
-  border: 1px solid #35B4FD !important;
+.zhifubao_pay_action {
+  border: 1px solid #35b4fd !important;
 }
-.pay{
+.pay {
   display: block;
   width: 124px;
   height: 40px;
@@ -270,7 +305,7 @@ export default {
   margin-bottom: 7px;
   text-align: center;
   border-radius: 5px;
-  border:1px solid #e4e7ed;
+  border: 1px solid #e4e7ed;
   cursor: pointer;
   align-items: center;
 }

+ 164 - 120
src/views/waterCardManage/index.vue

@@ -1,39 +1,37 @@
 <template>
-  <el-row  class="el-row-container" v-loading="loading">
+  <el-row class="el-row-container" v-loading="loading">
     <el-col
       v-if="!detailType"
       :span="4"
-      style="height:100%;padding-bottom:32px;"
+      style="height: 100%; padding-bottom: 32px"
     >
-    <el-card style="margin:16px;height: 100%; overflow-y: auto">
-      <data-report-left
-        @setCurrentData="setCurrentData"
-        :treeData="treeData"
-      ></data-report-left>
-    </el-card>
+      <el-card style="margin: 16px; height: 100%; overflow-y: auto">
+        <data-report-left
+          @setCurrentData="setCurrentData"
+          :treeData="treeData"
+        ></data-report-left>
+      </el-card>
     </el-col>
     <el-col
       v-show="!detailType"
       :span="20"
-      style="padding: 16px 16px 16px 0;  height: 100%"
+      style="padding: 16px 16px 16px 0; height: 100%"
     >
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
           <div>
-            <el-select 
-              placeholder="用户卡号" 
-              v-model="labelType"
-            >
+            <el-select placeholder="用户卡号" v-model="labelType">
               <el-option
                 v-for="item in options"
                 :key="item.value"
                 :label="item.label"
-                :value="item.value">
+                :value="item.value"
+              >
               </el-option>
             </el-select>
             <el-input
               v-model="inputContent"
-              style="width: 250px;margin:0 16px;"
+              style="width: 250px; margin: 0 16px"
               placeholder="请输入内容"
               @keyup.enter.native="handleSearch"
               clearable
@@ -41,19 +39,17 @@
             <el-select
               placeholder="IC卡状态"
               v-model="cardStatus"
-              style="margin-right:16px"
+              style="margin-right: 16px"
             >
               <el-option
                 v-for="item in icType"
                 :key="item.value"
                 :label="item.label"
-                :value="item.value">
+                :value="item.value"
+              >
               </el-option>
             </el-select>
-            <el-button
-              type="primary"
-              size="small"
-              @click="handleSearch"
+            <el-button type="primary" size="small" @click="handleSearch"
               >查询</el-button
             >
           </div>
@@ -62,9 +58,10 @@
               type="primary"
               size="small"
               @click="addICard"
+              v-hasPermi="['wpr:card:add']"
               >新增IC卡
-              </el-button
-            ></div>
+            </el-button>
+          </div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
           <b-table
@@ -75,12 +72,24 @@
             isShowIndex
           >
             <template #status="scope">
-              <span style="display:flex;align-items:center;justify-content:center">
+              <span
+                style="
+                  display: flex;
+                  align-items: center;
+                  justify-content: center;
+                "
+              >
                 {{ scope.row.cardStatusContent }}
               </span>
             </template>
             <template #cardAmount="scope">
-              <span style="display:flex;align-items:center;justify-content:center">
+              <span
+                style="
+                  display: flex;
+                  align-items: center;
+                  justify-content: center;
+                "
+              >
                 {{ Number(scope.row.cardAmount).toFixed(2) }}
               </span>
             </template>
@@ -88,9 +97,10 @@
               <el-link
                 size="small"
                 :underline="false"
-                :type="scope.row.cardStatus == '2'?'info':'primary'"
+                :type="scope.row.cardStatus == '2' ? 'info' : 'primary'"
                 style="margin-right: 10px"
-                @click="editCardHandler(scope.row,2)"
+                @click="editCardHandler(scope.row, 2)"
+                v-hasPermi="['wpr:card:logoff']"
                 >注销</el-link
               >
               <el-link
@@ -99,23 +109,29 @@
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
-                @click="editCardHandler(scope.row,1)"
-              >挂失</el-link>
+                @click="editCardHandler(scope.row, 1)"
+                v-hasPermi="['wpr:card:loss']"
+                >挂失</el-link
+              >
               <el-link
                 size="small"
                 v-if="scope.row.cardStatus == '1'"
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
-                @click="editCardHandler(scope.row,0)"
-              >解挂</el-link>
+                @click="editCardHandler(scope.row, 0)"
+                v-hasPermi="['wpr:card:unhook']"
+                >解挂</el-link
+              >
               <el-link
                 size="small"
                 :underline="false"
                 type="danger"
                 style="margin-right: 10px"
                 @click="deleteCardHandler(scope.row)"
-              >删除</el-link>
+                v-hasPermi="['wpr:card:delete']"
+                >删除</el-link
+              >
               <el-link
                 v-if="scope.row.cardStatus !== '2'"
                 size="small"
@@ -123,20 +139,24 @@
                 type="warning"
                 style="margin-right: 10px"
                 @click="rechargeCardHandler(scope.row)"
-              >充值</el-link>
+                v-hasPermi="['wpr:card:recharge']"
+                >充值</el-link
+              >
               <el-link
                 size="small"
                 :underline="false"
                 type="primary"
                 style="margin-right: 10px"
                 @click="changeDataDetailShow(scope.row)"
-              >数据详情</el-link>
+                v-hasPermi="['wpr:card:info']"
+                >数据详情</el-link
+              >
             </template>
           </b-table>
         </el-col>
       </el-card>
     </el-col>
-    <AddedICCard 
+    <AddedICCard
       :visible.sync="associationManageShow"
       :areaId="currentClickId"
       :userList="userList"
@@ -147,7 +167,7 @@
       :rechargeCardData="rechargeCardData"
       @refresh="handlerChange"
     />
-    <data-detail 
+    <data-detail
       v-if="detailType"
       :detailCardId="detailCardId"
       @backPage="showList"
@@ -157,52 +177,61 @@
 
 <script>
 import { Message } from 'element-ui';
-import { getFarmerList } from '@/api/farmer/list.js'
-import { getTree } from '@/api/tree.js'
-import { getCardList,editCard,deleteCard } from '@/api/card/index.js'
+import { getFarmerList } from '@/api/farmer/list.js';
+import { getTree } from '@/api/tree.js';
+import { getCardList, editCard, deleteCard } from '@/api/card/index.js';
 import BTable from '@/components/Table/index.vue';
-import DataReportLeft from '@/components/DataReportLeft/index.vue'
-import AddedICCard from './components/addedICCard.vue'
+import DataReportLeft from '@/components/DataReportLeft/index.vue';
+import AddedICCard from './components/addedICCard.vue';
 import RechargeCard from './components/rechargeCard.vue';
 import DataDetail from './dataDetail.vue';
 import { assign, omit } from 'lodash-es';
 
 export default {
   name: 'waterCardManage',
-  components: { BTable,DataReportLeft,AddedICCard,RechargeCard,DataDetail },
+  components: { BTable, DataReportLeft, AddedICCard, RechargeCard, DataDetail },
   data() {
     return {
-      inputContent:'',
-      labelType:0,
-      options:[{
-        value: 0,
-        label: '农户手机号',
-      },{
-        value: 1,
-        label: '用户卡号',
-      },{
-        value: 2,
-        label: '农户姓名',
-      }],
+      inputContent: '',
+      labelType: 0,
+      options: [
+        {
+          value: 0,
+          label: '农户手机号'
+        },
+        {
+          value: 1,
+          label: '用户卡号'
+        },
+        {
+          value: 2,
+          label: '农户姓名'
+        }
+      ],
       cardStatus: '',
-      icType: [{
-        value:'',
-        label:'全部'
-      },{
-        value: 0,
-        label: '正常'
-      },{
-        value: 1,
-        label: '挂失'
-      },{
-        value: 2,
-        label: '注销'
-      }],
+      icType: [
+        {
+          value: '',
+          label: '全部'
+        },
+        {
+          value: 0,
+          label: '正常'
+        },
+        {
+          value: 1,
+          label: '挂失'
+        },
+        {
+          value: 2,
+          label: '注销'
+        }
+      ],
       detailType: false,
       form: {
         productName: ''
       },
-      currentClickId:'',
+      currentClickId: '',
       treeData: [],
       loading: false,
       associationManageShow: false,
@@ -229,22 +258,26 @@ export default {
           prop: 'cardStatusContent',
           customRender: 'status',
           align: 'center'
-        },{
+        },
+        {
           label: '停泵下限',
           prop: 'phone',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '卡内余额',
           prop: 'cardAmount',
           customRender: 'cardAmount',
           align: 'center'
-        },{
+        },
+        {
           label: '累计用水量',
           prop: 'waterNumTotal',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '累计用电量',
           prop: 'electricNumTotal',
           customRender: '',
@@ -261,89 +294,100 @@ export default {
   },
   methods: {
     // 注销 cardStatus = 2,解挂 cardStatus = 0,挂失 cardStatus = 1
-    async editCardHandler(row,cardStatus) {
+    async editCardHandler(row, cardStatus) {
       // if(cardStatus == '2')return
-      const { farmerId,cardNo,cardAmount,cardId } = row
+      const { farmerId, cardNo, cardAmount, cardId } = row;
       await editCard({
         farmerId,
         cardNo,
         cardAmount,
         cardId,
         cardStatus
-      })
-      this.handlerChange()
+      });
+      this.handlerChange();
     },
     // 删除
-    deleteCardHandler(row){
-      const {cardId,farmerName} = row
-      this.$modal
-      .confirm(`是否确认删除农户${farmerName}`)
-      .then(()=> {
+    deleteCardHandler(row) {
+      const { cardId, farmerName } = row;
+      this.$modal.confirm(`是否确认删除农户${farmerName}`).then(() => {
         deleteCard({
           cardIds: cardId
         }).then(() => {
-          Message({ message: "删除成功", type: 'success' });
-          this.handlerChange()
-        })
-      })
+          Message({ message: '删除成功', type: 'success' });
+          this.handlerChange();
+        });
+      });
     },
     // 充值
     async rechargeCardHandler() {},
-    async searchHandler(farmerName,areaId) {
+    async searchHandler(farmerName, areaId) {
       const res = await getFarmerList({
         farmerName,
         areaId,
         pageNum: 1,
         pageSize: 9999999
-      })
-      this.userList = res.data
+      });
+      this.userList = res.data;
     },
     setCurrentData(areaId) {
-      this.currentClickId = areaId
+      this.currentClickId = areaId;
       this.$refs.tableRef.refresh(false);
-      this.searchHandler(this.farmerName,areaId)
+      this.searchHandler(this.farmerName, areaId);
     },
-    showList(){
-      this.detailType = false
+    showList() {
+      this.detailType = false;
     },
     async addICard() {
-      this.associationManageShow = true
+      this.associationManageShow = true;
     },
     async loadData(parameter) {
-      if(!this.currentClickId ) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+      if (!this.currentClickId) {
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.currentClick = res?.data[0]
         this.currentClickId = this.currentClick?.cusareaId
       }
-      this.searchHandler(this.farmerName,this.currentClickId)
-      return this.getTableData(parameter,this.currentClickId);
+      this.searchHandler(this.farmerName, this.currentClickId);
+      return this.getTableData(parameter, this.currentClickId);
     },
     changeDataDetailShow(row) {
-      this.detailType = true
-      const {cardId} = row
-      this.detailCardId = cardId
+      this.detailType = true;
+      const { cardId } = row;
+      this.detailCardId = cardId;
     },
-    getTableData(parameter,areaId) {
-      switch(this.labelType){
+    getTableData(parameter, areaId) {
+      switch (this.labelType) {
         case 0:
-          this.farmerPhone = this.inputContent
-          break
+          this.farmerPhone = this.inputContent;
+          break;
         case 1:
-          this.cardNo = this.inputContent
-          break
+          this.cardNo = this.inputContent;
+          break;
         case 2:
-          this.farmerName = this.inputContent
-          break
+          this.farmerName = this.inputContent;
+          break;
         default:
-          this.farmerPhone = this.inputContent
+          this.farmerPhone = this.inputContent;
       }
       const params = {
         farmerName: this.farmerName,
@@ -351,26 +395,26 @@ export default {
         farmerPhone: this.farmerPhone,
         areaId,
         cardStatus: this.cardStatus
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return getCardList(payload)
+      return getCardList(payload);
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
     },
-    handlerChange() { 
+    handlerChange() {
       this.$refs.tableRef.refresh(false);
     },
     rechargeCardHandler(row) {
-      this.rechargeCardData = row
-      this.rechargeShow = true
+      this.rechargeCardData = row;
+      this.rechargeShow = true;
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {
@@ -390,7 +434,7 @@ export default {
     }
   }
 }
-.status{
+.status {
   display: inline-block;
   width: 15px;
   height: 15px;

+ 70 - 56
src/views/waterManage/index.vue

@@ -1,12 +1,9 @@
 <template>
   <el-row class="el-row-container" v-loading="loading">
-    <el-col
-      :span="24"
-      style="padding: 16px; height: 100%"
-    >
+    <el-col :span="24" style="padding: 16px; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
-          <div style="display: flex;">
+          <div style="display: flex">
             <select-tree
               v-model="form.goodsName"
               style="width: 250px"
@@ -17,14 +14,11 @@
             ></select-tree>
             <el-input
               v-model="assocName"
-              style="width: 250px;margin:0 16px;"
+              style="width: 250px; margin: 0 16px"
               placeholder="请输入用户协会名称"
               clearable
             />
-            <el-button
-              type="primary"
-              size="small"
-              @click="handleSearch"
+            <el-button type="primary" size="small" @click="handleSearch"
               >查询</el-button
             >
           </div>
@@ -33,8 +27,10 @@
               type="primary"
               size="small"
               @click="addAssociation"
+              v-hasPermi="['wpr:society:add']"
               >新增协会</el-button
-            ></div>
+            >
+          </div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
           <b-table
@@ -51,15 +47,17 @@
                 type="primary"
                 style="margin-right: 10px"
                 @click="editRowHandler(scope.row)"
+                v-hasPermi="['wpr:society:edit']"
                 >修改</el-link
               >
               <el-link
-              size="small"
-              :underline="false"
-              type="danger"
-              style="margin-right: 10px"
-              @click="deleteRowHandler(scope.row)"
-              >删除</el-link
+                size="small"
+                :underline="false"
+                type="danger"
+                style="margin-right: 10px"
+                @click="deleteRowHandler(scope.row)"
+                v-hasPermi="['wpr:society:delete']"
+                >删除</el-link
               >
             </template>
           </b-table>
@@ -68,7 +66,7 @@
     </el-col>
   <association-manage
     :visible.sync="associationManageShow"
-    :treeData="treeData"
+    :treeData="treeData2"
     :userList="userList"
     @getList="handleSearch"
     :typeAssoc="typeAssoc"
@@ -78,25 +76,27 @@
 </template>
 
 <script>
-import { getAssocList, deleteAssoc } from '@/api/assoc/index.js'
-import { listUser } from '@/api/system/user.js'
+import { getAssocList, deleteAssoc } from '@/api/assoc/index.js';
+import { listUser } from '@/api/system/user.js';
 import BTable from '@/components/Table/index.vue';
-import AssociationManage from './component/associationManage.vue'
+import AssociationManage from './component/associationManage.vue';
 import SelectTree from '@/components/SelectTree';
-import { getTree } from '@/api/tree.js'
-import { Message } from 'element-ui'
+import { getTree } from '@/api/tree.js';
+import { Message } from 'element-ui';
 import { assign, omit } from 'lodash-es';
+import { deepClone } from '@/utils/index.js'
 
 export default {
-  name:"waterManage",
-  components: { BTable,AssociationManage, SelectTree },
+  name: 'waterManage',
+  components: { BTable, AssociationManage, SelectTree },
   data() {
     return {
       form: {
         productName: ''
       },
       userList: [],
-      treeData:[],
+      treeData: [],
+      treeData2: [],
       loading: false,
       cusareaName: '',
       associationManageShow: false,
@@ -137,58 +137,72 @@ export default {
       ]
     };
   },
-  mounted() { 
-    this.searchHandler()
+  mounted() {
+    this.searchHandler();
   },
   methods: {
     async searchHandler() {
       const res = await listUser({
         pageSize: 99999
-      })
-      this.userList = res.data
+      });
+      this.userList = res.data;
     },
     addAssociation() {
-      this.typeAssoc = 'add'
-      this.editRow = {}
-      this.associationManageShow = true
+      this.typeAssoc = 'add';
+      this.editRow = {};
+      this.associationManageShow = true;
     },
     // 删除
     deleteRowHandler(row) {
-      const { assocId: assocIds } = row
-      this.$modal
-        .confirm(`是否确认删除`)
-        .then(() => {
-          deleteAssoc({
-            assocIds
-          }).then(() => {
-            Message({ message: "删除成功", type: 'success' });
-            this.handlerChange()
-          })
-      })
+      const { assocId: assocIds } = row;
+      this.$modal.confirm(`是否确认删除`).then(() => {
+        deleteAssoc({
+          assocIds
+        }).then(() => {
+          Message({ message: '删除成功', type: 'success' });
+          this.handlerChange();
+        });
+      });
     },
     async loadData(parameter) {
       if (!this.areaId) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        this.treeData2 = []
+        this.treeData2 = deepClone(res?.data)
+        this.treeData2 = this.treeData2.filter(t => t?.cusareaName != '全部')
+        let tflag = true
+        this.treeData.forEach(t => { 
+          if (t?.cusareaName == '全部') { 
+            tflag = false
+          }
+        })
+        if (tflag) { 
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.cusareaName ||= this.treeData[0].cusareaName
         this.areaId = this.treeData[0].cusareaId
       }
       const params = {
         assocName: this.assocName,
         areaId: this.areaId
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return getAssocList(payload)
+      return getAssocList(payload);
     },
     handlerClick(value) {
-      this.areaId = value?.cusareaId
+      this.areaId = value?.cusareaId;
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
@@ -198,16 +212,16 @@ export default {
     },
     // 修改
     editRowHandler(row) {
-      this.typeAssoc = 'edit'
-      this.editRow = row
-      this.associationManageShow = true
+      this.typeAssoc = 'edit';
+      this.editRow = row;
+      this.associationManageShow = true;
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {

+ 21 - 2
src/views/waterMarket/component/waterDeal.vue

@@ -172,10 +172,27 @@ export default {
       },
       rules: {
         trxrcdSellerid: [
-          { required: true, message: '请选择您的卖方用水户', trigger: 'change' }
+          {
+            required: true, validator: (rule, value, callback) => {
+              if (!value) callback(new Error('请选择您的卖方用水户'))
+              if (value === this.baseForm?.trxrcdBuyerid) {
+                callback(new Error('卖方和买方不能是同一个用户'))
+                return
+              } else { 
+                callback()
+              }
+           }, trigger: 'change' }
         ],
         trxrcdBuyerid: [
-          { required: true, message: '请选择您的买方用水户', trigger: 'change' }
+          { required: true, validator: (rule, value, callback) => {
+              if (!value) callback(new Error('请选择您的买方用水户'))
+            if (value === this.baseForm?.trxrcdSellerid) {
+              callback(new Error('卖方和买方不能是同一个用户'))
+              return
+            } else { 
+              callback()
+            }
+            },  trigger: 'change' }
         ],
         trxrcdPrice: [
           { required: true, validator: (rule, value, callback) => {
@@ -192,6 +209,8 @@ export default {
               if (!value) callback(new Error('请输入您的交易价格'));
               if (value <= 0) {
                 callback(new Error('请正确输入您的交易价格'));
+              } else if (value > this.sellerRow.farmerWrbalance) { 
+                callback(new Error('交易水量不能大于可用水权'));
               } else {
                 callback()
               }

+ 49 - 58
src/views/waterMarket/index.vue

@@ -1,31 +1,20 @@
 <template>
   <el-row class="el-row-container" v-loading="loading">
-    <el-col
-      :span="24"
-      style="padding: 16px; height: 100%"
-    >
+    <el-col :span="24" style="padding: 16px; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
           <div>
             <el-select
-              style="display:inline-block;width: 100px;margin-right: "
+              style="display: inline-block; width: 100px; margin-right: "
               v-model="roleType"
               @change="changeRoleType"
             >
-              <el-option
-                label="买方"
-                value="0"
-              >
-              </el-option>
-              <el-option
-                label="卖方"
-                value="1"
-              >
-              </el-option>
+              <el-option label="买方" value="0"> </el-option>
+              <el-option label="卖方" value="1"> </el-option>
             </el-select>
             <el-input
               v-model="trxrcdName"
-              style="width: 250px;margin-left: 16px"
+              style="width: 250px; margin-left: 16px"
               :placeholder="placeholder"
               @keyup.enter.native="handleSearch"
               clearable
@@ -37,13 +26,10 @@
               :default-time="['00:00:00', '23:59:59']"
               start-placeholder="开始日期"
               end-placeholder="结束日期"
-              style="width: 300px; margin:0 16px"
+              style="width: 300px; margin: 0 16px"
             >
             </el-date-picker>
-            <el-button
-              type="primary"
-              size="small"
-              @click="handleSearch"
+            <el-button type="primary" size="small" @click="handleSearch"
               >查询</el-button
             >
           </div>
@@ -52,9 +38,10 @@
               type="primary"
               size="small"
               @click="addAssociation"
+              v-hasPermi="['wpr:trade:add']"
               >新增交易
-              </el-button
-            ></div>
+            </el-button>
+          </div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
           <b-table
@@ -74,13 +61,13 @@
                 >修改</el-link
               >
               <el-link
-              size="small"
-              :underline="false"
-              type="danger"
-              style="margin-right: 10px"
-              @click="download(scope.row)"
-              >删除</el-link
-            >
+                size="small"
+                :underline="false"
+                type="danger"
+                style="margin-right: 10px"
+                @click="download(scope.row)"
+                >删除</el-link
+              >
             </template>
           </b-table>
         </el-col>
@@ -95,21 +82,21 @@
 </template>
 
 <script>
-import { getFarmerList } from '@/api/farmer/list.js'
-import { getTrxrcdList } from '@/api/trxrcd/index.js'
+import { getFarmerList } from '@/api/farmer/list.js';
+import { getTrxrcdList } from '@/api/trxrcd/index.js';
 import BTable from '@/components/Table/index.vue';
-import WaterDeal from './component/waterDeal.vue'
+import WaterDeal from './component/waterDeal.vue';
 import { assign, omit } from 'lodash-es';
 
 export default {
-  name:'waterMarket',
+  name: 'waterMarket',
   components: { BTable, WaterDeal },
   data() {
     return {
       placeholder: '请输入买方姓名',
       roleType: '0',
-      dateValue:"",
-      trxrcdName:'',
+      dateValue: '',
+      trxrcdName: '',
       loading: false,
       associationManageShow: false,
       columns: [
@@ -136,12 +123,14 @@ export default {
           prop: 'trxrcdPrice',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '成交金额(元)',
           prop: 'trxrcdMoney',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '成交时间',
           prop: 'trxrcdCreateddate',
           customRender: '',
@@ -152,58 +141,60 @@ export default {
     };
   },
   mounted() {
-    this.getFarmerListHandler()
+    this.getFarmerListHandler();
   },
   methods: {
     async getFarmerListHandler() {
-      const res = await getFarmerList()
+      const res = await getFarmerList({
+        pageSize: 99999
+      })
       this.farmerList = res.data
     },
     changeRoleType(type) {
-      this.placeholder = type == 1 ? '请输入卖方姓名':'请输入买方姓名'
+      this.placeholder = type == 1 ? '请输入卖方姓名' : '请输入买方姓名';
     },
     addAssociation() {
-      this.associationManageShow = true
+      this.associationManageShow = true;
     },
     loadData(parameter) {
       return this.getTableData(parameter);
     },
     getTableData(parameter) {
       if (this.roleType == '0') {
-        this.buyerName = this.trxrcdName
-        this.sellerName = ''
-      } else { 
-        this.sellerName = this.trxrcdName
-        this.buyerName = ''
+        this.buyerName = this.trxrcdName;
+        this.sellerName = '';
+      } else {
+        this.sellerName = this.trxrcdName;
+        this.buyerName = '';
       }
-      const startTime = this.dateValue[0] || ''
-      const endTime = this.dateValue[1] || ''
+      const startTime = this.dateValue[0] || '';
+      const endTime = this.dateValue[1] || '';
       const params = {
         buyerName: this.buyerName,
         sellerName: this.sellerName,
         startTime,
-        endTime,
-      }
+        endTime
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return getTrxrcdList(payload)
+      return getTrxrcdList(payload);
     },
-    addSuccessHandler() { 
-      this.handleSearch()
+    addSuccessHandler() {
+      this.handleSearch();
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
+      this.getFarmerListHandler()
     },
     goDetail(row) {
-      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
+      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno);
     },
-    download(row) {
-    }
+    download(row) {}
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {

+ 3 - 3
src/views/waterSubsidy/components/newPolicy.vue

@@ -16,6 +16,7 @@
       :model="baseForm"
       :rules="rules"
       size="small"
+      style="height:600px;"
     >
       <el-row>
         <el-form-item label="标题:" prop="subsidypolicyTitle">
@@ -38,7 +39,7 @@
              name="file"
              :headers="headers"
              :before-upload="beforeAvatarUpload">
-             <img v-if="baseForm.src" :src="baseForm.src" class="avatar">
+             <img v-if="baseForm.src" :src="baseForm.src | formatImg" class="avatar">
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
            <span style="color:#F56C6C">仅支持上传jpg/jpeg/png且大小不超过5M的图片</span>
@@ -47,7 +48,7 @@
       <el-row style="height: 200px;">
         <el-form-item label="内容:" prop="subsidypolicyContent">
           <Editor
-            style="height: 150px"
+            style="height: 300px"
             v-model="baseForm.subsidypolicyContent"
             :mode="mode"
             @onCreated="onCreated"
@@ -166,7 +167,6 @@ export default {
       deep: true
     },
     'baseForm.src'(val) {
-      console.log(val, 'valvalvlalvalslsdkal12312')
       if(val) this.$refs.baseForm.clearValidate(['src'])
     },
     'baseForm.subsidypolicyContent'(val) {

+ 71 - 59
src/views/waterSubsidy/index.vue

@@ -1,28 +1,22 @@
 <template>
   <el-row class="el-row-container" v-loading="loading">
-    <el-col
-      :span="24"
-      style="padding: 16px; height: 100%"
-    >
+    <el-col :span="24" style="padding: 16px; height: 100%">
       <el-card style="height: 100%; overflow-y: auto">
         <el-col :span="24" class="elrow-main__col-top">
-          <div style="display: flex;">
-            <select-tree 
-              :placeholder="'年份'" 
+          <div style="display: flex">
+            <select-tree
+              :placeholder="'年份'"
               style="width: 250px"
               :treeData="treeData"
               @handlerClick="handlerClick"
               :checkVal="cusareaName"
             ></select-tree>
             <el-input
-              style="width: 250px;margin: 0 16px;"
+              style="width: 250px; margin: 0 16px"
               placeholder="请输入关键字"
               v-model="subsidypolicyTitle"
             />
-            <el-button
-              type="primary"
-              size="small"
-              @click="handleSearch"
+            <el-button type="primary" size="small" @click="handleSearch"
               >查询</el-button
             >
           </div>
@@ -31,9 +25,10 @@
               type="primary"
               size="small"
               @click="addAssociation"
+              v-hasPermi="['wpr:policy:add']"
               >发布新政策
-              </el-button
-            ></div>
+            </el-button>
+          </div>
         </el-col>
         <el-col :span="24" class="elrow-main__col-bottom">
           <b-table
@@ -45,7 +40,7 @@
           >
             <template #styleImg="scope">
               <el-image
-                :src="dialogImageUrl + scope.row.previews || ''"
+                :src="scope.row.previews | formatImg"
                 :preview-src-list="[dialogImageUrl + scope.row.previews || '']"
                 slot="error"
                 class="image-slot"
@@ -61,16 +56,18 @@
                 type="primary"
                 style="margin-right: 10px"
                 @click="editHandler(scope.row)"
+                v-hasPermi="['wpr:policy:edit']"
                 >修改</el-link
               >
               <el-link
-              size="small"
-              :underline="false"
-              type="danger"
-              style="margin-right: 10px"
-              @click="deleteHandler(scope.row)"
-              >删除</el-link
-            >
+                size="small"
+                :underline="false"
+                type="danger"
+                style="margin-right: 10px"
+                @click="deleteHandler(scope.row)"
+                v-hasPermi="['wpr:policy:delete']"
+                >删除</el-link
+              >
             </template>
           </b-table>
         </el-col>
@@ -87,24 +84,27 @@
 </template>
 
 <script>
-import { getSubsidyPolicy, deleteSubsidyPolicy } from '@/api/subsidypolicy/index.js'
+import {
+  getSubsidyPolicy,
+  deleteSubsidyPolicy
+} from '@/api/subsidypolicy/index.js';
 import SelectTree from '@/components/SelectTree';
 import BTable from '@/components/Table/index.vue';
-import { getTree } from '@/api/tree.js'
-import newPolicy from './components/newPolicy.vue'
-import { Message } from 'element-ui'
+import { getTree } from '@/api/tree.js';
+import newPolicy from './components/newPolicy.vue';
+import { Message } from 'element-ui';
 import { assign, omit } from 'lodash-es';
 
 export default {
-  name:'waterSubsidy',
-  components: { BTable,newPolicy, SelectTree },
+  name: 'waterSubsidy',
+  components: { BTable, newPolicy, SelectTree },
   data() {
     return {
       form: {
         productName: ''
       },
       policyType: 'add',
-      subsidypolicyTitle:'',
+      subsidypolicyTitle: '',
       loading: false,
       showPolicy: false,
       treeData: [],
@@ -136,7 +136,8 @@ export default {
           prop: 'subsidypolicyCreatorName',
           customRender: '',
           align: 'center'
-        },{
+        },
+        {
           label: '发布时间',
           prop: 'subsidypolicyCreateddate',
           customRender: '',
@@ -150,40 +151,53 @@ export default {
       ]
     };
   },
-  mounted() { 
-    this.dialogImageUrl = process.env.VUE_APP_BASE_API
+  mounted() {
+    this.dialogImageUrl = process.env.VUE_APP_BASE_API;
   },
   methods: {
-    addSuccessHandler() { 
-      this.handleSearch()
+    addSuccessHandler() {
+      this.handleSearch();
     },
     addAssociation() {
-      this.policyType = 'add'
-      this.showPolicy = true
+      this.policyType = 'add';
+      this.showPolicy = true;
     },
     async loadData(parameter) {
       if (!this.areaId) {
-        const treeList = this.$store.state.tree.treeList
-        let res = []
+        const treeList = this.$store.state.tree.treeList;
+        let res = [];
         if (treeList.code === '000000') {
-          res = treeList
+          res = treeList;
         } else {
-          res = await getTree()
-          this.$store.dispatch('tree/setTree', res)
+          res = await getTree();
+          this.$store.dispatch('tree/setTree', res);
         }
         this.treeData = res?.data
+        let tflag = true
+        this.treeData.forEach(t => {
+          if (t?.cusareaName == '全部') {
+            tflag = false
+          }
+        })
+        if (tflag) {
+          this.treeData.unshift({
+            id: '',
+            cusareaId: '',
+            cusareaName: '全部'
+          })
+        }
         this.cusareaName ||= this.treeData[0].cusareaName
         this.areaId = this.treeData[0].cusareaId
       }
       const params = {
         areaIds: this.areaId,
         subsidypolicyTitle: this.subsidypolicyTitle
-      }
+      };
       const payload = omit(assign({}, parameter, params), []);
-      return getSubsidyPolicy(payload)
+      return getSubsidyPolicy(payload);
     },
     handlerClick(value) {
-      this.areaId = value?.cusareaId
+      this.areaId = value?.cusareaId;
     },
     handleSearch() {
       this.$refs.tableRef.refresh(true);
@@ -192,39 +206,37 @@ export default {
       this.$refs.tableRef.refresh(false);
     },
     goDetail(row) {
-      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
+      this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno);
     },
     editHandler(row) {
-      this.policyType = 'edit'
+      this.policyType = 'edit';
       const params = {
         subsidypolicyTitle: row?.subsidypolicyTitle,
-        src: this.dialogImageUrl + row?.previews,
+        src: row?.previews,
         subsidypolicyContent: row?.subsidypolicyContent,
         subsidypolicyId: row?.subsidypolicyId,
         resIds: row?.resIds
-      }
-      this.editRow = params
-      this.showPolicy = true
+      };
+      this.editRow = params;
+      this.showPolicy = true;
     },
     deleteHandler(row) {
-      const { subsidypolicyId } = row
-      this.$modal
-      .confirm(`是否确认删除`)
-      .then(() => {
+      const { subsidypolicyId } = row;
+      this.$modal.confirm(`是否确认删除`).then(() => {
         deleteSubsidyPolicy({
           subsidypolicyIds: subsidypolicyId
         }).then(() => {
-          Message({ message: "删除成功", type: 'success' });
-          this.handlerChange()
-        })
-      })
+          Message({ message: '删除成功', type: 'success' });
+          this.handlerChange();
+        });
+      });
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.el-row-container{
+.el-row-container {
   height: 100%;
 }
 .elrow-main__col-top {

+ 19 - 2
vue.config.js

@@ -39,7 +39,16 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       ['/iotprod-api']: {
-        target: `http://192.168.1.57:8027`,
+        // target: `http://192.168.1.57:8027`,
+        target: `http://192.168.1.221:7000`,
+        changeOrigin: true,
+        pathRewrite: {
+          ['^' + process.env.VUE_APP_BASE_API]: ''
+        }
+      },
+      ['/icsprod-api']: {
+        // target: `http://192.168.1.57:8027`,
+        target: `http://192.168.1.221:7000`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
@@ -48,12 +57,20 @@ module.exports = {
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://192.168.1.57:8027`,
         // target: `http://192.168.95:8021`,
-        // target: `http://114.55.0.7:7000`,
         target: `http://192.168.1.221:7000`,
         changeOrigin: true,
         pathRewrite: {
           // ['^' + process.env.VUE_APP_BASE_API]: ''
         }
+      },
+      ['/portalprod-api']: {
+        // target: `http://192.168.1.95:7000`,
+        target: `http://192.168.1.221:7000`,
+        // target: `http://114.55.0.7:7000`,
+        changeOrigin: true,
+        pathRewrite: {
+          // ['^' + process.env.VUE_APP_BASE_API]: ''
+        }
       }
     },
     disableHostCheck: true