Browse Source

fix: 监测管理的实时监测和灌溉记录的修改

allen 2 years atrás
parent
commit
c4a01bc696

+ 7 - 0
src/api/card/index.js

@@ -71,3 +71,10 @@ export const getCardusercdList = (query) => {
     params: query
   });
 };
+// 实时监测
+export const getDataInfo = (query) => {
+  return request({
+    url: `icsprod-api/ics/tmn/data/info/${query}`,
+    method: 'get'
+  });
+};

+ 75 - 202
src/views/monitoringMamage/components/IrrigationRecord.vue

@@ -1,271 +1,139 @@
 <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>
+    </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',
+        },
+        {
+          label: '计费方式',
+          prop: 'cardusercdBillingtype',
           customRender: '',
           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: {
     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 +143,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;

+ 62 - 187
src/views/monitoringMamage/components/realTimeMonitor.vue

@@ -7,7 +7,7 @@
     @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.waterAddresss  || '-' }}</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/index.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>

+ 14 - 4
src/views/monitoringMamage/index.vue

@@ -167,8 +167,14 @@
       </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>
 
@@ -187,6 +193,8 @@ export default {
   components: { BTable,DataReportLeft,EchartsPie,realTimeMonitor,IrrigationRecord },
   data() {
     return {
+      irrigationDetail: {},
+      realDtaile: {},
       dateValue:'',
       form: {
         productName: ''
@@ -307,16 +315,18 @@ export default {
     //   const data = res?.data
     //   this.treeData = data
     // },
-    irrigationShowHistory() {
+    irrigationShowHistory(row) {
       this.irrigationShow = true
+      this.irrigationDetail = row
     },
     
     setCurrentData(areaId) {
       this.areaId = areaId
       this.$refs.tableRef.refresh(false);
     },
-    realTime() {
+    realTime(row) {
       this.realTimeShow = true
+      this.realDtaile = row
     },
     async loadData(parameter) {
       if (!this.areaId) {

+ 11 - 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,7 +57,7 @@ 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]: ''