Selaa lähdekoodia

修改提交.添加水量报表

chc 9 kuukautta sitten
vanhempi
commit
9137d0f788

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 268 - 195
public/config 20231031.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 268 - 195
public/config 20231112.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 273 - 192
public/config.js


+ 1 - 0
src/main.ts

@@ -67,6 +67,7 @@ Vue.config.productionTip = false
 
 new Vue({
   el: '#app',
+   //@ts-ignore
   router,
   store,
   render: h => h(App)

+ 2 - 1
src/router/_import.js

@@ -280,5 +280,6 @@ const map = {
   indexMng:() => import('@/views/zhpt/basicInfoManage/indexMng/widget.vue'),
   monitorSystem:() => import('@/views/zhpt/basicInfoManage/monitorSite/monitorSystem/widget.vue'),
   standards:() => import('@/views/zhpt/basicInfoManage/monitorSite/standards/widget.vue'),
-
+  // 水量报表
+  waterReportForm:()=>import('@/views/zhpt/scadaDayManYear/widget.vue')
 }

+ 262 - 136
src/views/dataOps/components/Tree/SiteTree/index.vue

@@ -14,33 +14,39 @@
     ref="baseTree"
   >
     <!-- <pre style="font-size: 12px; margin: 0">{{ JSON.stringify(treeNode, null, 2) }}</pre> -->
-    <template #leaf="{node, data}">
+    <template #leaf="{ node, data }">
       <text-view :content="node.label" />
     </template>
   </base-tree>
 </template>
 
 <script lang="ts">
-import { getTreeList } from '@/api/base'
-import { IComputedPumpOrSiteTreeItem } from '@/views/dataOps/api/common'
-import { get as _get } from 'lodash'
-import { Component, Prop, Vue } from 'vue-property-decorator'
-import BaseTree from '../Base/index.vue'
-import { TextView } from '@/views/dataOps/components/Text'
-import { fetchDeviceList, fetchIndexList } from '@/views/dataOps/api/standards'
+import { getTreeList } from "@/api/base";
+import { IComputedPumpOrSiteTreeItem } from "@/views/dataOps/api/common";
+import { get as _get } from "lodash";
+import { Component, Prop, Vue } from "vue-property-decorator";
+import BaseTree from "../Base/index.vue";
+import { TextView } from "@/views/dataOps/components/Text";
+import { fetchDeviceList, fetchIndexList } from "@/views/dataOps/api/standards";
 import { sqlQuery } from "@/views/zhpt/common/arcgisUtil/query.ts";
+import { devicesPage} from "@/api/basicData/monitorSite.ts";
+import { indexQuery } from '@/api/basicData/indexManage.ts'
+import $ from 'jquery'
+import { appconfig } from "staticPub/config";
+import { geteSessionStorage } from "@/utils/auth";
+import { getSewageList } from '@/views/operationCenter/common/api/config.ts'
 
-@Component({ name: 'SiteTree', components: { BaseTree, TextView } })
+@Component({ name: "SiteTree", components: { BaseTree, TextView } })
 export default class SiteTree extends Vue {
-  @Prop({ type: Boolean, default: false }) showCheckbox!: boolean
-  defaultExpandedKeys = []
-  defaultCheckedKeys = []
-  current = 1
-  loading: boolean = false
+  @Prop({ type: Boolean, default: false }) showCheckbox!: boolean;
+  defaultExpandedKeys = [];
+  defaultCheckedKeys = [];
+  current = 1;
+  loading: boolean = false;
 
-  treeData = []
-  checkedIndexes = []
-  checkedStationIds = []
+  treeData = [];
+  checkedIndexes = [];
+  checkedStationIds = [];
   get attrs() {
     return this.showCheckbox
       ? {
@@ -49,155 +55,275 @@ export default class SiteTree extends Vue {
           showCheckbox: true,
           // defaultExpandAll: true,
           props: {
-            children: 'children',
-            label: 'label',
-            isLeaf: 'isLeaf',
-            disabled: (data, { checked }) => {
-              if (this.checkedIndexes.length >= 8 || this.checkedStationIds.length >= 8) {
-                return !checked
-              }
-              if (((this.$attrs.lazy as unknown) as boolean) === false) {
-                return data.flag < 2
-              }
-              return data.flag < 4
-            }
+            children: "children",
+            label: "label",
+            isLeaf: "isLeaf",
+            // disabled: (data, { checked }) => {
+            //   if (
+            //     this.checkedIndexes.length >= 8 ||
+            //     this.checkedStationIds.length >= 8
+            //   ) {
+            //     return !checked;
+            //   }
+            //   if ((this.$attrs.lazy as unknown as boolean) === false) {
+            //     return data.flag < 2;
+            //   }
+            //   return data.flag < 4;
+            // },
           },
-          ...this.$attrs
+          ...this.$attrs,
 
           // defaultExpandAll: true
         }
-      : this.$attrs
+      : this.$attrs;
   }
 
   async loadNode(node, resolve) {
-    //@ts-ignore
-    const { data: { children, label, id, flag } = {} } = node || {}
-    // console.log(node.data)
-    if (!flag) {
-      resolve([])
-      return
+    console.log(node, resolve,'hhh')
+     //@ts-ignore
+        const { data: { children, label, id, flag } = {} } = node || {};
+            if (!flag) {
+      resolve([]);
+      return;
     }
-    if (flag === '1') {
-      resolve(children)
-    } else if (flag === '2') {
-      const {
-        result: { records }
-      } = await fetchDeviceList({
-        sewageIds: id,
-        current: 1,
-        size: 500,
-        deptId: this.$store.state.user.departmentId
-      })
-      resolve(
+    if (flag === "1") {
+    // 查询污水厂绑定的设备
+    devicesPage({size:10000,belongStationId:id}).then(res=>{
+      if(res.code==1&&res.result.records.length>0){
+        let records=res.result.records
+           resolve(
         (records || []).map(({ name, id, no }) => {
-          return { label: String(name).replace(label, ''), id: `3_${id}`, code: no, flag: '3' }
+          return {
+            label: name,
+            id: id,
+            code: no,
+            flag: "3",
+            disabled:true
+          };
         })
-      )
-    } else if (flag === '3' && id) {
-      const {
-        result: { records }
-      } = await fetchIndexList({ deviceIdList: String(id).split('_')[1], current: 1, size: 500 })
-      resolve(
+      );
+      }else{
+        resolve([]);
+      }
+    })
+    } else if (flag === "3") {
+      // 查询设备指标
+      indexQuery({deviceIdList:id}).then(res=>{
+        if(res.code==1&&res.result.records.length>0){
+        let records=res.result.records
+           resolve(
         (records || []).map(({ name, id, code }) => {
           return {
-            label: String(name).replace(String(label).replace(/\d/g, ''), ''),
-            id: `4_${id}`,
-            code,
-            flag: '4',
-            isLeaf: true
-          }
+            label: name,
+            id: id,
+            code: code,
+            flag: "4",
+            isLeaf: true,
+          };
         })
-      )
-    } else {
-      resolve([])
+      );
+      }else{
+        resolve([]);
+      }
+      })
     }
+
+    //@ts-ignore
+    // const { data: { children, label, id, flag } = {} } = node || {};
+    // // console.log(node.data)
+    // if (!flag) {
+    //   resolve([]);
+    //   return;
+    // }
+    // if (flag === "1") {
+    //   resolve(children);
+    // } else if (flag === "2") {
+    //   const {
+    //     result: { records },
+    //   } = await fetchDeviceList({
+    //     sewageIds: id,
+    //     current: 1,
+    //     size: 500,
+    //     deptId: this.$store.state.user.departmentId,
+    //   });
+    //   resolve(
+    //     (records || []).map(({ name, id, no }) => {
+    //       return {
+    //         label: String(name).replace(label, ""),
+    //         id: `3_${id}`,
+    //         code: no,
+    //         flag: "3",
+    //       };
+    //     })
+    //   );
+    // } else if (flag === "3" && id) {
+    //   const {
+    //     result: { records },
+    //   } = await fetchIndexList({
+    //     deviceIdList: String(id).split("_")[1],
+    //     current: 1,
+    //     size: 500,
+    //   });
+    //   resolve(
+    //     (records || []).map(({ name, id, code }) => {
+    //       return {
+    //         label: String(name).replace(String(label).replace(/\d/g, ""), ""),
+    //         id: `4_${id}`,
+    //         code,
+    //         flag: "4",
+    //         isLeaf: true,
+    //       };
+    //     })
+    //   );
+    // } else {
+    //   resolve([]);
+    // }
   }
 
   async fetchTreeData() {
     try {
-      this.initQuery()
+      this.initQuery();
       // const { result } = await getTreeList({ deptId: this.$store.state.user.departmentId, type: 1 })
       // this.treeData = result
-      // this.getFirstItem()
+      this.getFirstItem()
     } catch (error) {
-      console.log(error)
+      console.log(error);
     }
   }
   // 查询污水厂
   async initQuery() {
-    
-      await sqlQuery(
-        "1=1",
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/MapServer/19"
-      ).then((res:any) => {
-        if (res.features.length) {
-          // this.total = res.features.length;
-          let data = [];
-          res.features.forEach(fea => {
-            const attri = {
-              fea: fea,
-              ...fea.attributes
-            };
-            data.push(attri);
-          });
-          let arr=[]
-          data.forEach(i=>{
-            arr.push({
-              id:i.OBJECTID,
-              label:i.NAME
-            })
-          })
-          this.treeData = arr;
-          console.log(this.treeData,data,'this.treeData')
-        }
-      });
-    }
+    getSewageList({size: 10000 }).then(res => {
+      if (res && res.code == 1) {
+        this.treeData = res.result.records.map(({ id, name, deptId }) => ({
+          id,
+          label:name,
+          deptId,
+          disabled:true,
+          flag:'1'
+        }));
+      }
+    });
+
+    // let token= geteSessionStorage('arcgistoken')
+    //   let layerId = "19";
+    //   let queryText = "1=1";
+    //   $.ajax({
+    //     url:
+    //       appconfig.gisResource.business_map.config[0].url +
+    //       "/" +
+    //       layerId +
+    //       "/query",
+    //     type: "POST",
+    //     data: {
+    //       where: queryText,
+    //       outFields: "*",
+    //       f: "pjson",
+    //       token
+    //     },
+    //     success: data => {
+    //       data = JSON.parse(data);
+    //       console.log(data, "data");
+    //       let arr = [] as any;
+    //       data.features.map(e => {
+    //         let attributes = e.attributes;
+    //         if(e.geometry){
+    //           attributes.geometry = e.geometry;
+    //         }
+    //         attributes.id=attributes.OBJECTID
+    //         attributes.label=attributes.NAME
+    //         attributes.disabled=true
+    //         attributes.flag='1'
+    //         arr.push(attributes);
+    //       });
+    //       this.treeData=arr
+    //     },
+    //     error: error => this.$message.error(error)
+    //   });
+
+    // await sqlQuery(
+    //   "1=1",
+    //   "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/MapServer/19"
+    // ).then((res: any) => {
+    //   if (res.features.length) {
+    //     // this.total = res.features.length;
+    //     let data = [];
+    //     res.features.forEach((fea) => {
+    //       const attri = {
+    //         fea: fea,
+    //         ...fea.attributes,
+    //       };
+    //       data.push(attri);
+    //     });
+    //     let arr = [];
+    //     data.forEach((i) => {
+    //       arr.push({
+    //         id: i.OBJECTID,
+    //         label: i.NAME,
+    //         disabled:true,
+    //         flag:'1'
+    //       });
+    //     });
+    //     this.treeData = arr;
+    //     console.log(this.treeData, data, "this.treeData");
+    //   }
+    // });
+  }
 
   async created() {
-    this.loading = true
-    await this.fetchTreeData()
-    this.loading = false
+    this.loading = true;
+    await this.fetchTreeData();
+    this.loading = false;
   }
   get listeners() {
-    const { 'node-click': nodeClick, check, ...rest } = this.$listeners
-    return rest
+    const { "node-click": nodeClick, check, ...rest } = this.$listeners;
+    return rest;
   }
 
-  treeNode = {}
+  treeNode = {};
   nodeClick(data) {
     // return
-    if (this.showCheckbox) return
-    let ids: number[] = []
+    if (this.showCheckbox) return;
+    let ids: number[] = [];
     const getIds = (source: IComputedPumpOrSiteTreeItem) => {
-      const { children, id } = source
+      const { children, id } = source;
       if (Array.isArray(children)) {
-        children.forEach(getIds)
+        children.forEach(getIds);
       } else {
-        ids.push(id)
+        ids.push(id);
       }
-    }
-    getIds(data)
-    this.treeNode = ids
-    this.current = data.id as number
-    this.$emit('change', ids)
+    };
+    getIds(data);
+    this.treeNode = ids;
+    this.current = data.id as number;
+    this.$emit("change", ids);
   }
 
   onCheck(_, { checkedNodes, halfCheckedNodes }) {
-    if (((this.attrs.lazy as unknown) as boolean) === false) {
-      const checkedStationIds = checkedNodes.filter((item) => item.flag === '2').map((item) => item.id)
-      this.checkedStationIds = checkedStationIds
-      this.$emit('check', checkedStationIds)
+    if ((this.attrs.lazy as unknown as boolean) === false) {
+      const checkedStationIds = checkedNodes
+        .filter((item) => item.flag === "2")
+        .map((item) => item.id);
+      this.checkedStationIds = checkedStationIds;
+      this.$emit("check", checkedStationIds);
     } else {
-      const deviceCodes = checkedNodes.filter((item) => item.flag === '3').map((item) => item.code)
-      const indexCodes = checkedNodes.filter((item) => item.flag === '4').map((item) => item.code)
-      const halfCheckedDeviceCodes = halfCheckedNodes.filter((item) => item.flag === '3').map((item) => item.code)
-      const halfCheckedStationIds = halfCheckedNodes.filter((item) => item.flag === '2').map((item) => item.id)
-      this.checkedIndexes = indexCodes
-      this.$emit('check', {
+      const deviceCodes = checkedNodes
+        .filter((item) => item.flag === "3")
+        .map((item) => item.code);
+      const indexCodes = checkedNodes
+        .filter((item) => item.flag === "4")
+        .map((item) => item.code);
+      const halfCheckedDeviceCodes = halfCheckedNodes
+        .filter((item) => item.flag === "3")
+        .map((item) => item.code);
+      const halfCheckedStationIds = halfCheckedNodes
+        .filter((item) => item.flag === "2")
+        .map((item) => item.id);
+      this.checkedIndexes = indexCodes;
+      this.$emit("check", {
         deviceCodes: [...deviceCodes, ...halfCheckedDeviceCodes],
         indexCodes,
-        stationIds: halfCheckedStationIds
-      })
+        stationIds: halfCheckedStationIds,
+      });
     }
   }
 
@@ -206,27 +332,27 @@ export default class SiteTree extends Vue {
       const current = (() => {
         const getLastFirstSon = (data) => {
           if (Array.isArray(data)) {
-            return getLastFirstSon(data[0])
+            return getLastFirstSon(data[0]);
           } else {
-            const { children } = data
+            const { children } = data;
             if (!children || children.length === 0) {
-              return data
+              return data;
             }
-            return getLastFirstSon(children)
+            return getLastFirstSon(children);
           }
-        }
-        return getLastFirstSon(this.treeData)
-      })()
+        };
+        return getLastFirstSon(this.treeData);
+      })();
 
-      this.defaultExpandedKeys = [current.id]
-      this.current = current.id
+      this.defaultExpandedKeys = [current.id];
+      this.current = current.id;
       if (!this.showCheckbox) {
-        this.$emit('change', [current.id])
+        this.$emit("change", [current.id]);
       } else {
-        if (((this.$attrs.lazy as unknown) as boolean) === false) {
-          this.$emit('check', [current.id])
+        if ((this.$attrs.lazy as unknown as boolean) === false) {
+          this.$emit("check", [current.id]);
         }
-        this.defaultCheckedKeys = [current.id]
+        this.defaultCheckedKeys = [current.id];
       }
     }
   }

+ 362 - 0
src/views/dataOps/components/Tree/SiteTree/index2.vue

@@ -0,0 +1,362 @@
+<template>
+  <base-tree
+    v-bind="attrs"
+    v-on="listeners"
+    :data="treeData"
+    node-key="id"
+    @node-click="nodeClick"
+    @check="onCheck"
+    :current-node-key="current"
+    :empty-text="loading ? '加载中...' : '暂无数据'"
+    :expand-on-click-node="false"
+    :default-expanded-keys="defaultExpandedKeys"
+    :default-checked-keys="defaultCheckedKeys"
+    ref="baseTree"
+  >
+    <!-- <pre style="font-size: 12px; margin: 0">{{ JSON.stringify(treeNode, null, 2) }}</pre> -->
+    <template #leaf="{ node, data }">
+      <text-view :content="node.label" />
+    </template>
+  </base-tree>
+</template>
+
+<script lang="ts">
+import { getTreeList } from "@/api/base";
+import { IComputedPumpOrSiteTreeItem } from "@/views/dataOps/api/common";
+import { get as _get } from "lodash";
+import { Component, Prop, Vue } from "vue-property-decorator";
+import BaseTree from "../Base/index.vue";
+import { TextView } from "@/views/dataOps/components/Text";
+import { fetchDeviceList, fetchIndexList } from "@/views/dataOps/api/standards";
+import { sqlQuery } from "@/views/zhpt/common/arcgisUtil/query.ts";
+import { devicesPage} from "@/api/basicData/monitorSite.ts";
+import { indexQuery } from '@/api/basicData/indexManage.ts'
+import $ from 'jquery'
+import { appconfig } from "staticPub/config";
+import { geteSessionStorage } from "@/utils/auth";
+import { getSewageList } from '@/views/operationCenter/common/api/config.ts'
+
+@Component({ name: "SiteTree", components: { BaseTree, TextView } })
+export default class SiteTree extends Vue {
+  @Prop({ type: Boolean, default: false }) showCheckbox!: boolean;
+  defaultExpandedKeys = [];
+  defaultCheckedKeys = [];
+  current = 1;
+  loading: boolean = false;
+
+  treeData = [];
+  checkedIndexes = [];
+  checkedStationIds = [];
+  get attrs() {
+    return this.showCheckbox
+      ? {
+          load: this.loadNode,
+          lazy: true,
+          showCheckbox: true,
+          // defaultExpandAll: true,
+          props: {
+            children: "children",
+            label: "label",
+            isLeaf: "isLeaf",
+            // disabled: (data, { checked }) => {
+            //   if (
+            //     this.checkedIndexes.length >= 8 ||
+            //     this.checkedStationIds.length >= 8
+            //   ) {
+            //     return !checked;
+            //   }
+            //   if ((this.$attrs.lazy as unknown as boolean) === false) {
+            //     return data.flag < 2;
+            //   }
+            //   return data.flag < 4;
+            // },
+          },
+          ...this.$attrs,
+
+          // defaultExpandAll: true
+        }
+      : this.$attrs;
+  }
+
+  async loadNode(node, resolve) {
+    console.log(node, resolve,'hhh')
+        //@ts-ignore
+        const { data: { children, label, id, flag} = {} } = node || {};
+            if (!flag) {
+      resolve([]);
+      return;
+    }
+    if (flag === "1") {
+          // 查询污水厂绑定的设备
+    devicesPage({size:10000,belongStationId:id}).then(res=>{
+      if(res.code==1&&res.result.records.length>0){
+        let records=res.result.records
+           resolve(
+        (records || []).map(({ name, id, no }) => {
+          return {
+            label: name,
+            id: id,
+            code: no,
+            flag: "3",
+            disabled:true
+          };
+        })
+      );
+      }else{
+        resolve([]);
+      }
+    })
+    } else if (flag === "3") {
+      // 查询设备指标
+      indexQuery({deviceIdList:id}).then(res=>{
+        if(res.code==1&&res.result.records.length>0){
+        let records=res.result.records
+           resolve(
+        (records || []).map(({ name, id, code }) => {
+          return {
+            label: name,
+            id: id,
+            code: code,
+            flag: "4",
+            isLeaf: true,
+          };
+        })
+      );
+      }else{
+        resolve([]);
+      }
+      })
+    }
+
+    //@ts-ignore
+    // const { data: { children, label, id, flag } = {} } = node || {};
+    // // console.log(node.data)
+    // if (!flag) {
+    //   resolve([]);
+    //   return;
+    // }
+    // if (flag === "1") {
+    //   resolve(children);
+    // } else if (flag === "2") {
+    //   const {
+    //     result: { records },
+    //   } = await fetchDeviceList({
+    //     sewageIds: id,
+    //     current: 1,
+    //     size: 500,
+    //     deptId: this.$store.state.user.departmentId,
+    //   });
+    //   resolve(
+    //     (records || []).map(({ name, id, no }) => {
+    //       return {
+    //         label: String(name).replace(label, ""),
+    //         id: `3_${id}`,
+    //         code: no,
+    //         flag: "3",
+    //       };
+    //     })
+    //   );
+    // } else if (flag === "3" && id) {
+    //   const {
+    //     result: { records },
+    //   } = await fetchIndexList({
+    //     deviceIdList: String(id).split("_")[1],
+    //     current: 1,
+    //     size: 500,
+    //   });
+    //   resolve(
+    //     (records || []).map(({ name, id, code }) => {
+    //       return {
+    //         label: String(name).replace(String(label).replace(/\d/g, ""), ""),
+    //         id: `4_${id}`,
+    //         code,
+    //         flag: "4",
+    //         isLeaf: true,
+    //       };
+    //     })
+    //   );
+    // } else {
+    //   resolve([]);
+    // }
+  }
+
+  async fetchTreeData() {
+    try {
+      this.initQuery();
+      // const { result } = await getTreeList({ deptId: this.$store.state.user.departmentId, type: 1 })
+      // this.treeData = result
+      // this.getFirstItem()
+    } catch (error) {
+      console.log(error);
+    }
+  }
+  // 查询污水厂
+  async initQuery() {
+    getSewageList({size: 10000 }).then(res => {
+      if (res && res.code == 1) {
+        this.treeData = res.result.records.map(({ id, name, deptId }) => ({
+          id,
+          label:name,
+          deptId,
+          // disabled:true,
+          flag:'2'
+        }));
+      }
+    });
+    // let token= geteSessionStorage('arcgistoken')
+    //   let layerId = "19";
+    //   let queryText = "1=1";
+    //   $.ajax({
+    //     url:
+    //       appconfig.gisResource.business_map.config[0].url +
+    //       "/" +
+    //       layerId +
+    //       "/query",
+    //     type: "POST",
+    //     data: {
+    //       where: queryText,
+    //       outFields: "*",
+    //       f: "pjson",
+    //       token
+    //     },
+    //     success: data => {
+    //       data = JSON.parse(data);
+    //       console.log(data, "data");
+    //       let arr = [] as any;
+    //       data.features.map(e => {
+    //         let attributes = e.attributes;
+    //         if(e.geometry){
+    //           attributes.geometry = e.geometry;
+    //         }
+    //         attributes.id=attributes.OBJECTID
+    //         attributes.label=attributes.NAME
+    //         // attributes.disabled=true
+    //         attributes.flag='2'
+    //         arr.push(attributes);
+    //       });
+    //       this.treeData=arr
+    //     },
+    //     error: error => this.$message.error(error)
+    //   });
+    // await sqlQuery(
+    //   "1=1",
+    //   "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/MapServer/19"
+    // ).then((res: any) => {
+    //   if (res.features.length) {
+    //     // this.total = res.features.length;
+    //     let data = [];
+    //     res.features.forEach((fea) => {
+    //       const attri = {
+    //         fea: fea,
+    //         ...fea.attributes,
+    //       };
+    //       data.push(attri);
+    //     });
+    //     let arr = [];
+    //     data.forEach((i) => {
+    //       arr.push({
+    //         id: i.OBJECTID,
+    //         label: i.NAME,
+    //         // disabled:true,
+    //         flag:'2'
+    //       });
+    //     });
+    //     this.treeData = arr;
+    //     console.log(this.treeData, data, "this.treeData");
+    //   }
+    // });
+  }
+
+  async created() {
+    this.loading = true;
+    await this.fetchTreeData();
+    this.loading = false;
+  }
+  get listeners() {
+    const { "node-click": nodeClick, check, ...rest } = this.$listeners;
+    return rest;
+  }
+
+  treeNode = {};
+  nodeClick(data) {
+    // return
+    if (this.showCheckbox) return;
+    let ids: number[] = [];
+    const getIds = (source: IComputedPumpOrSiteTreeItem) => {
+      const { children, id } = source;
+      if (Array.isArray(children)) {
+        children.forEach(getIds);
+      } else {
+        ids.push(id);
+      }
+    };
+    getIds(data);
+    this.treeNode = ids;
+    this.current = data.id as number;
+    this.$emit("change", ids);
+  }
+
+  onCheck(_, { checkedNodes, halfCheckedNodes }) {
+    if ((this.attrs.lazy as unknown as boolean) === false) {
+      const checkedStationIds = checkedNodes
+        .filter((item) => item.flag === "2")
+        .map((item) => item.id);
+      this.checkedStationIds = checkedStationIds;
+      this.$emit("check", checkedStationIds);
+    } else {
+      const deviceCodes = checkedNodes
+        .filter((item) => item.flag === "3")
+        .map((item) => item.code);
+      const indexCodes = checkedNodes
+        .filter((item) => item.flag === "4")
+        .map((item) => item.code);
+      const halfCheckedDeviceCodes = halfCheckedNodes
+        .filter((item) => item.flag === "3")
+        .map((item) => item.code);
+      const halfCheckedStationIds = halfCheckedNodes
+        .filter((item) => item.flag === "2")
+        .map((item) => item.id);
+      this.checkedIndexes = indexCodes;
+      this.$emit("check", {
+        deviceCodes: [...deviceCodes, ...halfCheckedDeviceCodes],
+        indexCodes,
+        stationIds: halfCheckedStationIds,
+      });
+    }
+  }
+
+  getFirstItem() {
+    if (this.treeData.length) {
+      const current = (() => {
+        const getLastFirstSon = (data) => {
+          if (Array.isArray(data)) {
+            return getLastFirstSon(data[0]);
+          } else {
+            const { children } = data;
+            if (!children || children.length === 0) {
+              return data;
+            }
+            return getLastFirstSon(children);
+          }
+        };
+        return getLastFirstSon(this.treeData);
+      })();
+
+      this.defaultExpandedKeys = [current.id];
+      this.current = current.id;
+      if (!this.showCheckbox) {
+        this.$emit("change", [current.id]);
+      } else {
+        if ((this.$attrs.lazy as unknown as boolean) === false) {
+          this.$emit("check", [current.id]);
+        }
+        this.defaultCheckedKeys = [current.id];
+      }
+    }
+  }
+
+  mounted() {
+    // console.log(this)
+  }
+}
+</script>

+ 3 - 2
src/views/opsControl/report/production/widget.vue

@@ -20,7 +20,8 @@
 
 <script lang="ts">
 import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
-import { SiteTree } from '@/views/dataOps/components/Tree'
+// import { SiteTree } from '@/views/dataOps/components/Tree'
+import SiteTree from '@/views/dataOps/components/Tree/SiteTree/index2.vue'
 import { GridContainer } from '@/views/dataOps/components/Container'
 import { MonitorChart } from '@/views/dataOps/components/Chart'
 import QueryForm from '@/views/opsControl/report/components/QueryForm.vue'
@@ -87,7 +88,7 @@ export default class ProductionReport extends Vue {
   onQuery(query = {}) {
     this.query = { ...query }
     this.indexes = this.query.indexes
-    // this.doQuery()
+    this.doQuery()
   }
 
   onIndexChange(data) {

+ 220 - 173
src/views/zhpt/basicInfoManage/drainageSubarea/formDialog.vue

@@ -12,9 +12,19 @@
       <tf-title>基本信息</tf-title>
       <el-col :span="8">
         <el-form-item label="分区类型" prop="FQLX">
-          <el-select v-model="form.FQLX" style="width: 100%" clearable placeholder="请选择分区类型">
+          <el-select
+            v-model="form.FQLX"
+            style="width: 100%"
+            clearable
+            placeholder="请选择分区类型"
+          >
             <!-- codeValue -->
-            <el-option v-for="item in outfallTypes" :key="item.notes" :label="item.notes" :value="item.notes" />
+            <el-option
+              v-for="item in outfallTypes"
+              :key="item.notes"
+              :label="item.notes"
+              :value="item.notes"
+            />
           </el-select>
         </el-form-item>
       </el-col>
@@ -32,7 +42,10 @@
 
       <el-col :span="8">
         <el-form-item label="汇水面积">
-          <el-input v-model="form.HSMJ" placeholder="请输入监控面积或者在地图上绘制">
+          <el-input
+            v-model="form.HSMJ"
+            placeholder="请输入监控面积或者在地图上绘制"
+          >
             <template slot="append">平方公里</template>
           </el-input>
         </el-form-item>
@@ -40,8 +53,18 @@
 
       <el-col :span="8">
         <el-form-item label="分区等级" prop="FQDJ">
-          <el-select v-model="form.FQDJ" style="width: 100%" clearable placeholder="请选择分区等级">
-            <el-option v-for="item in subareaRanks" :key="item.notes" :label="item.notes" :value="item.notes" />
+          <el-select
+            v-model="form.FQDJ"
+            style="width: 100%"
+            clearable
+            placeholder="请选择分区等级"
+          >
+            <el-option
+              v-for="item in subareaRanks"
+              :key="item.notes"
+              :label="item.notes"
+              :value="item.notes"
+            />
           </el-select>
         </el-form-item>
       </el-col>
@@ -125,22 +148,22 @@
 </template>
 
 <script>
-import tfMap from '@/views/zhpt/common/tfMap.vue'
-import { IP } from '@/utils/request'
-import { parseTime } from '@/utils/index'
-import { serialize } from 'object-to-formdata'
-import { WKT } from 'ol/format'
-import GeoJSON from 'ol/format/GeoJSON'
-import Feature from 'ol/Feature'
-import { MultiLineString, Polygon } from 'ol/geom'
-import MultiPolygon from 'ol/geom/MultiPolygon'
+import tfMap from "@/views/zhpt/common/tfMap.vue";
+import { IP } from "@/utils/request";
+import { parseTime } from "@/utils/index";
+import { serialize } from "object-to-formdata";
+import { WKT } from "ol/format";
+import GeoJSON from "ol/format/GeoJSON";
+import Feature from "ol/Feature";
+import { MultiLineString, Polygon } from "ol/geom";
+import MultiPolygon from "ol/geom/MultiPolygon";
 
-import editFeature from '@/views/zhpt/common/olMapUtil/editFeature.ts'
-import { mapUtil } from '@/views/zhpt/common/olMapUtil/common.ts'
-import { esriConfig, appconfig } from 'staticPub/config'
+import editFeature from "@/views/zhpt/common/olMapUtil/editFeature.ts";
+import { mapUtil } from "@/views/zhpt/common/olMapUtil/common.ts";
+import { esriConfig, appconfig } from "staticPub/config";
 import {
   addFeature,
-  updateFeature
+  updateFeature,
 } from "@/views/zhpt/common/arcgisUtil/query.ts";
 export default {
   components: { tfMap },
@@ -151,45 +174,51 @@ export default {
      */
     data: {
       type: Object,
-      required: true
+      required: true,
     },
     /**
      * 图层编号
      */
     layerId: {
       type: String,
-      required: true
+      required: true,
     },
     /**
      * 字典
      */
     dict: {
       type: Object,
-      required: true
-    }
+      required: true,
+    },
   },
   data() {
     return {
       rules: {
-        fqmc: [{ required: true, message: '请输入排水分区名称', trigger: 'blur' }],
-        subareaid: [{ required: true, message: '请输入排水分区编号', trigger: 'blur' }],
-        fqlx: [{ required: true, message: '请选择排水类型', trigger: 'change' }]
+        fqmc: [
+          { required: true, message: "请输入排水分区名称", trigger: "blur" },
+        ],
+        subareaid: [
+          { required: true, message: "请输入排水分区编号", trigger: "blur" },
+        ],
+        fqlx: [
+          { required: true, message: "请选择排水类型", trigger: "change" },
+        ],
       },
       rangeForm: {
-        type: '1',
+        type: "1",
         width: 2,
-        boundary: '#409EFF',
-        fill: 'rgba(255,255,255,0.1)',
-        geometry: ''
+        boundary: "#409EFF",
+        fill: "rgba(255,255,255,0.1)",
+        geometry: "",
       },
       form: {
-        FQLX:'',//分区类型
-        FQMC:'', //分区名称
-        SUBAREAID:'',//排水系统编号
-        HSMJ:0,//范围
-        FQDJ:'',
-        PSTZSM:'',
-        REMARK:'',//备注
+        FQLX: "", //分区类型
+        FQMC: "", //分区名称
+        SUBAREAID: "", //排水系统编号
+        HSMJ: 0, //范围
+        FQDJ: "",
+        PSTZSM: "",
+        REMARK: "", //备注
       },
 
       visible: false,
@@ -198,35 +227,35 @@ export default {
       loading: false,
       outfallTypes: [], //设备类型
       subareaRanks: [], //分区等级
-      feature: null
-    }
+      feature: null,
+    };
   },
   watch: {
     visible() {
-      console.log('框选样式:', this.rangeForm)
-    }
+      console.log("框选样式:", this.rangeForm);
+    },
   },
 
   created() {
-    this.loading = false
-    let flag = false
-    this.outfallTypes = this.dict.outfallTypes ? this.dict.outfallTypes : []
-    this.subareaRanks = this.dict.subareaRanks ? this.dict.subareaRanks : []
-    Object.keys(this.data).length === 0 ? (flag = false) : (flag = true)
+    this.loading = false;
+    let flag = false;
+    this.outfallTypes = this.dict.outfallTypes ? this.dict.outfallTypes : [];
+    this.subareaRanks = this.dict.subareaRanks ? this.dict.subareaRanks : [];
+    Object.keys(this.data).length === 0 ? (flag = false) : (flag = true);
     if (flag) {
-      this.loading = true
-      this.initFormData(this.data)
-      this.flag = true
-      this.loading = false
+      this.loading = true;
+      this.initFormData(this.data);
+      this.flag = true;
+      this.loading = false;
       // 查看?修改
-      if (this.data.flag == 'updateBtn') {
-        this.disabled = false
+      if (this.data.flag == "updateBtn") {
+        this.disabled = false;
       } else {
-        this.disabled = true
+        this.disabled = true;
       }
     } else {
-      this.form.subareaid = this.getUniqueCode()
-      this.flag = false
+      this.form.subareaid = this.getUniqueCode();
+      this.flag = false;
     }
   },
 
@@ -234,66 +263,69 @@ export default {
     this.$nextTick(() => {
       if (this.data.feature) {
         if (this.data.feature.geometry) {
-          let polygon = new Feature({ geometry: new Polygon(this.data.feature.geometry.coordinates[0]) })
-          this.drawPolygonByFeature(polygon)
+          let polygon = new Feature({
+            geometry: new Polygon(this.data.feature.geometry.coordinates[0]),
+          });
+          this.drawPolygonByFeature(polygon);
           //定位面
-          let center = new mapUtil().getCenterFromFeatures(polygon)
-          let tfmap = this.$refs.tfMap
-          tfmap.setCenter(center)
+          let center = new mapUtil().getCenterFromFeatures(polygon);
+          let tfmap = this.$refs.tfMap;
+          tfmap.setCenter(center);
         }
       }
-    })
+    });
   },
 
   methods: {
     initFormData(data) {
       for (let field in this.form) {
-        if (Object.hasOwnProperty.call(data,field)) this.form[field] = data[field]
+        if (Object.hasOwnProperty.call(data, field))
+          this.form[field] = data[field];
       }
-      console.log('表单数据', data, this.form)
+      console.log("表单数据", data, this.form);
     },
     // 获取数据
     async getData(id) {
-      const data = { result: null }
-      this.form = data.result
-      this.form.category = Number(this.form.category)
+      const data = { result: null };
+      this.form = data.result;
+      this.form.category = Number(this.form.category);
     },
 
     // 提交
     submitForm() {
-      const _this = this
-      let { userId, realName } = this.$store.state.user
+      const _this = this;
+      let { userId, realName } = this.$store.state.user;
       _this.$refs.form.validate((valid) => {
         if (valid) {
-          let param = { ..._this.form }
+          let param = { ..._this.form };
           if (_this.flag) {
-            param['U_USERID'] = userId
-            param['U_USERNAME'] = realName
-            param['U_TIME'] = parseTime(new Date(), '{y}-{m}-{d}')
+            param["U_USERID"] = userId;
+            param["U_USERNAME"] = realName;
+            param["U_TIME"] = parseTime(new Date(), "{y}-{m}-{d}");
           } else {
-            param['U_USERID'] = userId
-            param['U_USERNAME'] = realName
-            param['U_TIME'] = parseTime(new Date(), '{y}-{m}-{d}')
-            param['C_USERID'] = userId
-            param['C_USERNAME'] = realName
-            param['C_TIME'] = parseTime(new Date(), '{y}-{m}-{d}')
+            param["U_USERID"] = userId;
+            param["U_USERNAME"] = realName;
+            param["U_TIME"] = parseTime(new Date(), "{y}-{m}-{d}");
+            param["C_USERID"] = userId;
+            param["C_USERNAME"] = realName;
+            param["C_TIME"] = parseTime(new Date(), "{y}-{m}-{d}");
           }
-          let data = param
+          let data = param;
           if (!_this.flag) {
-            _this.newSubmit(data)
+            _this.newSubmit(data);
           } else {
-            data['OBJECTID']=this.data['OBJECTID']
-            _this.editSubmit(data)
+            data["OBJECTID"] = this.data["OBJECTID"];
+            _this.editSubmit(data);
           }
-          return true
+          return true;
         } else {
-          return false
+          return false;
         }
-      })
+      });
     },
 
     handleClick(tab, event) {
-      console.log(tab, event)
+      console.log(tab, event);
     },
     /**
      * 新增图层
@@ -301,19 +333,19 @@ export default {
     async newSubmit(fieldsValue) {
       let info = {
         type: "Point",
-        attributes: fieldsValue
+        attributes: fieldsValue,
       };
 
       addFeature(
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/23",
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/23",
         info
-      ).then(res => { 
-          if(!res.addResults){
-            this.$emit('remind', '1')
-            return this.$message.success("操作成功!");
-          }else{
-            return this.$message.error("操作失败!");
-          }
+      ).then((res) => {
+        if (!res.addResults) {
+          this.$emit("remind", "1");
+          return this.$message.success("操作成功!");
+        } else {
+          return this.$message.error("操作失败!");
+        }
       });
       // debugger
       // if (this.feature === null) return this.$message.warning('请先绘制片区')
@@ -336,19 +368,19 @@ export default {
     async editSubmit(fieldsValue) {
       let info = {
         type: "Point",
-        attributes: fieldsValue
+        attributes: fieldsValue,
       };
 
       updateFeature(
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/23",
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/23",
         info
-      ).then(res => { 
-          if(!res.updateResults){
-            this.$emit('remind', '1')
-            return this.$message.success("操作成功!");
-          }else{
-            return this.$message.error("操作失败!");
-          }
+      ).then((res) => {
+        if (!res.updateResults) {
+          this.$emit("remind", "1");
+          return this.$message.success("操作成功!");
+        } else {
+          return this.$message.error("操作失败!");
+        }
       });
       // if (this.feature === null) return this.$message.warning('请先绘制片区')
       // const id = this.data.id
@@ -367,25 +399,25 @@ export default {
     },
     // 重置
     resetFields() {
-      this.$refs.form.resetFields()
+      this.$refs.form.resetFields();
     },
 
     /**
      * 绘制点
      */
     drawPoint() {
-      let mapTool = this.$refs.tfMap
+      let mapTool = this.$refs.tfMap;
       if (mapTool) {
         const callback = (feature) => {
-          let coordinates = feature.getGeometry().getCoordinates()
+          let coordinates = feature.getGeometry().getCoordinates();
           let coors = coordinates.map((item) => {
-            return item.toFixed(6)
-          })
-          this.form.longitude = coors[0] //经度
-          this.form.latitude = coors[1] //纬度
-          this.form.coordinate = coors.join(',')
-        }
-        mapTool.drawPoint(true, callback)
+            return item.toFixed(6);
+          });
+          this.form.longitude = coors[0]; //经度
+          this.form.latitude = coors[1]; //纬度
+          this.form.coordinate = coors.join(",");
+        };
+        mapTool.drawPoint(true, callback);
       }
     },
 
@@ -393,117 +425,133 @@ export default {
      * 绘制面
      */
     drawPolygon() {
-      let mapTool = this.$refs.tfMap
+      let mapTool = this.$refs.tfMap;
       if (mapTool) {
         const callback = (feature) => {
-          this.feature = feature
-          this.drawPolygonByFeature(feature)
-          this.rangeForm.geometry = new WKT().writeFeature(feature)
+          this.feature = feature;
+          this.drawPolygonByFeature(feature);
+          this.rangeForm.geometry = new WKT().writeFeature(feature);
           // let mapTool = this.$refs.tfMap
           // if (mapTool) {
           //   let geo = feature.getGeometry()
           //   let area = mapTool.formatArea(geo)
           //   this.form.area = area.toFixed(2)
           // }
-        }
-        mapTool.drawPolygon(true, callback)
+        };
+        mapTool.drawPolygon(true, callback);
       }
     },
 
     drawPolygonByFeature(feature) {
-      this.feature = feature
+      this.feature = feature;
       //边线宽度
-      let outlineWidth = this.rangeForm.width ? this.rangeForm.width : 2
+      let outlineWidth = this.rangeForm.width ? this.rangeForm.width : 2;
       //边线颜色,十六进制
-      let outlineColor = this.rangeForm.boundary ? this.rangeForm.boundary : '#409EFF'
+      let outlineColor = this.rangeForm.boundary
+        ? this.rangeForm.boundary
+        : "#409EFF";
       //填充色和透明度
-      let fill = this.rangeForm.fill ? this.rangeForm.fill : 'rgba(255,255,255,1)'
+      let fill = this.rangeForm.fill
+        ? this.rangeForm.fill
+        : "rgba(255,255,255,1)";
       //fill = fill.match(/rgba\((\S*)\)/)[1]
-      let begin = fill.indexOf('(')
-      let end = fill.indexOf(')')
-      fill = fill.substring(begin + 1, end)
+      let begin = fill.indexOf("(");
+      let end = fill.indexOf(")");
+      fill = fill.substring(begin + 1, end);
 
-      let fillColor = fill.split(',')
+      let fillColor = fill.split(",");
       if (fillColor.length === 4) {
-        fillColor[0] = parseInt(fillColor[0])
-        fillColor[1] = parseInt(fillColor[1])
-        fillColor[2] = parseInt(fillColor[2])
-        fillColor[3] = parseFloat(fillColor[3])
+        fillColor[0] = parseInt(fillColor[0]);
+        fillColor[1] = parseInt(fillColor[1]);
+        fillColor[2] = parseInt(fillColor[2]);
+        fillColor[3] = parseFloat(fillColor[3]);
       }
-      let mapTool = this.$refs.tfMap
+      let mapTool = this.$refs.tfMap;
 
       if (mapTool) {
-        let style = mapTool.styleFunction(fillColor, outlineWidth, outlineColor)
-        mapTool.drawFeature(feature, style)
+        let style = mapTool.styleFunction(
+          fillColor,
+          outlineWidth,
+          outlineColor
+        );
+        mapTool.drawFeature(feature, style);
       }
     },
 
     styleChange() {
-      let mapTool = this.$refs.tfMap
+      let mapTool = this.$refs.tfMap;
       //边线宽度
-      let outlineWidth = this.rangeForm.width ? this.rangeForm.width : 2
+      let outlineWidth = this.rangeForm.width ? this.rangeForm.width : 2;
       //边线颜色,十六进制
-      let outlineColor = this.rangeForm.boundary ? this.rangeForm.boundary : '#409EFF'
+      let outlineColor = this.rangeForm.boundary
+        ? this.rangeForm.boundary
+        : "#409EFF";
       //填充色和透明度
-      let fill = this.rangeForm.fill ? this.rangeForm.fill : 'rgba(255,255,255,1)'
+      let fill = this.rangeForm.fill
+        ? this.rangeForm.fill
+        : "rgba(255,255,255,1)";
       //fill = fill.match(/rgba\((\S*)\)/)[1]
-      let begin = fill.indexOf('(')
-      let end = fill.indexOf(')')
-      fill = fill.substring(begin + 1, end)
+      let begin = fill.indexOf("(");
+      let end = fill.indexOf(")");
+      fill = fill.substring(begin + 1, end);
 
-      let fillColor = fill.split(',')
+      let fillColor = fill.split(",");
       if (fillColor.length === 4) {
-        fillColor[0] = parseInt(fillColor[0])
-        fillColor[1] = parseInt(fillColor[1])
-        fillColor[2] = parseInt(fillColor[2])
-        fillColor[3] = parseFloat(fillColor[3])
+        fillColor[0] = parseInt(fillColor[0]);
+        fillColor[1] = parseInt(fillColor[1]);
+        fillColor[2] = parseInt(fillColor[2]);
+        fillColor[3] = parseFloat(fillColor[3]);
       }
-      let style = mapTool.styleFunction(fillColor, outlineWidth, outlineColor)
-      mapTool.styleChange(style)
+      let style = mapTool.styleFunction(fillColor, outlineWidth, outlineColor);
+      mapTool.styleChange(style);
     },
 
     /**
      * 清理绘制点
      */
     clearDrawPoint() {
-      let mapTool = this.$refs.tfMap
+      let mapTool = this.$refs.tfMap;
       if (mapTool) {
-        mapTool.clearPoint()
+        mapTool.clearPoint();
       }
     },
 
-     /**
+    /**
      * 清除绘制面
      */
-     clearDrawPolygon() {
-      let mapTool = this.$refs.tfMap
+    clearDrawPolygon() {
+      let mapTool = this.$refs.tfMap;
       if (mapTool) {
-        mapTool.clearPolygon()
+        mapTool.clearPolygon();
       }
-      this.form.area = 0
+      this.form.area = 0;
     },
     /**
      * 生成唯一编码
      */
     getUniqueCode() {
       //form.prj_no
-      const _charStr = 'ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789'
+      const _charStr = "ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789";
       let min = 0,
         max = _charStr.length - 1,
-        _str = ''
+        _str = "";
       //判断是否指定长度,否则默认长度为15
-      let len = 2
+      let len = 2;
       //循环生成字符串
       for (var i = 0, index; i < len; i++) {
-        index = this.RandomIndex(_charStr, min, max, i)
-        _str += _charStr[index]
+        index = this.RandomIndex(_charStr, min, max, i);
+        _str += _charStr[index];
       }
-      const nowDate = new Date()
-      const nowYear = nowDate.getFullYear()
-      const nowMonth = nowDate.getMonth() > 9 ? nowDate.getMonth() + 1 : '0' + (nowDate.getMonth() + 1)
-      const nowDay = nowDate.getDate() > 9 ? nowDate.getDate() : '0' + nowDate.getDate()
-      const next = nowYear + '' + nowMonth + '' + nowDay
-      return 'PSFQ' + next + '-' + _str
+      const nowDate = new Date();
+      const nowYear = nowDate.getFullYear();
+      const nowMonth =
+        nowDate.getMonth() > 9
+          ? nowDate.getMonth() + 1
+          : "0" + (nowDate.getMonth() + 1);
+      const nowDay =
+        nowDate.getDate() > 9 ? nowDate.getDate() : "0" + nowDate.getDate();
+      const next = nowYear + "" + nowMonth + "" + nowDay;
+      return "PSFQ" + next + "-" + _str;
     },
     /**
      * 随机生成索引
@@ -513,18 +561,18 @@ export default {
      */
     RandomIndex(_charStr, min, max, i) {
       let index = Math.floor(Math.random() * (max - min + 1) + min),
-        numStart = _charStr.length - 10
+        numStart = _charStr.length - 10;
       //如果字符串第一位是数字,则递归重新获取
       if (i == 0 && index >= numStart) {
-        index = this.RandomIndex(_charStr, min, max, i)
+        index = this.RandomIndex(_charStr, min, max, i);
       }
       //返回最终索引值
-      return index
+      return index;
     },
 
-    paletteBtn() {}
-  }
-}
+    paletteBtn() {},
+  },
+};
 </script>
 <style lang="scss" scoped>
 .map {
@@ -563,4 +611,3 @@ export default {
   }
 }
 </style>
-

+ 289 - 222
src/views/zhpt/basicInfoManage/drainageSubarea/widget.vue

@@ -1,25 +1,51 @@
 <template>
   <div class="drainageSubarea">
     <div class="head">
-      <el-form :inline="true" class="demo-form-inline" size="mini" style="height: 40px">
+      <el-form
+        :inline="true"
+        class="demo-form-inline"
+        size="mini"
+        style="height: 40px"
+      >
         <el-form-item label="关键字">
           <el-input v-model="input" clearable placeholder="请输入分区名称" />
         </el-form-item>
         <el-form-item label="分区类型:">
           <el-checkbox-group v-model="checkList" @change="queryResult">
-            <el-checkbox v-for="outType in dict.outfallTypes" :label="outType.notes" :key="outType.notes">{{
-              outType.notes
-            }}</el-checkbox>
+            <el-checkbox
+              v-for="outType in dict.outfallTypes"
+              :label="outType.notes"
+              :key="outType.notes"
+              >{{ outType.notes }}</el-checkbox
+            >
           </el-checkbox-group>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" size="mini" icon="el-icon-search" @click="queryResult">查询</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            icon="el-icon-search"
+            @click="queryResult"
+            >查询</el-button
+          >
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" size="mini" icon="el-icon-plus" @click="insertBtn">添加</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            icon="el-icon-plus"
+            @click="insertBtn"
+            >添加</el-button
+          >
         </el-form-item>
         <el-form-item>
-          <el-button type="danger" size="mini" icon="el-icon-delete" @click="deleteBtnHandle">删除</el-button>
+          <el-button
+            type="danger"
+            size="mini"
+            icon="el-icon-delete"
+            @click="deleteBtnHandle"
+            >删除</el-button
+          >
         </el-form-item>
       </el-form>
     </div>
@@ -43,8 +69,16 @@
             :destroy-on-close="true"
             @remind="remind"
           />
-          <span v-if="dialogTitle !== '详情'" slot="footer" class="dialog-footer">
-            <el-button size="small" style="margin-bottom: 10px" :loading="loading" @click="dialogVisible = false"
+          <span
+            v-if="dialogTitle !== '详情'"
+            slot="footer"
+            class="dialog-footer"
+          >
+            <el-button
+              size="small"
+              style="margin-bottom: 10px"
+              :loading="loading"
+              @click="dialogVisible = false"
               >取 消</el-button
             >
             <el-button
@@ -75,7 +109,8 @@
           <img src="@/assets/icon/null.png" alt="暂无数据" />
         </template>
         <el-table-column type="selection" width="40"></el-table-column>
-        <el-table-column type="index" width="50" label="序号"> </el-table-column>
+        <el-table-column type="index" width="50" label="序号">
+        </el-table-column>
         <el-table-column
           v-for="col in column"
           :prop="col.prop"
@@ -87,9 +122,27 @@
         ></el-table-column>
         <el-table-column fixed="right" label="操作" align="center" :width="160">
           <template slot-scope="scope">
-            <el-button @click="readBtn(scope.row)" type="text" style="color: #2d74e7" size="small">详情</el-button>
-            <el-button @click="updateBtn(scope.row)" type="text" style="color: #2d74e7" size="small">修改</el-button>
-            <el-button @click="deleteBtn(scope.row)" type="text" style="color: #fa2d2d" size="small">删除</el-button>
+            <el-button
+              @click="readBtn(scope.row)"
+              type="text"
+              style="color: #2d74e7"
+              size="small"
+              >详情</el-button
+            >
+            <el-button
+              @click="updateBtn(scope.row)"
+              type="text"
+              style="color: #2d74e7"
+              size="small"
+              >修改</el-button
+            >
+            <el-button
+              @click="deleteBtn(scope.row)"
+              type="text"
+              style="color: #fa2d2d"
+              size="small"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -110,74 +163,73 @@
 </template>
 
 <script>
-import { client } from '@/utils/index'
-import FormDialog from './formDialog.vue'
-import { getDicValueByKeys } from '@/api/base'
-import { appconfig } from 'staticPub/config'
-import tf from '@/ToflyGIS/toflyGis'
-import GeoJSON from 'ol/format/GeoJSON'
-import editFeature from '@/views/zhpt/common/olMapUtil/editFeature.ts'
-import request from '@/utils/request'
-import {
-  deleteFeature
-} from "@/views/zhpt/common/arcgisUtil/query.ts";
+import { client } from "@/utils/index";
+import FormDialog from "./formDialog.vue";
+import { getDicValueByKeys } from "@/api/base";
+import { appconfig } from "staticPub/config";
+import tf from "@/ToflyGIS/toflyGis";
+import GeoJSON from "ol/format/GeoJSON";
+import editFeature from "@/views/zhpt/common/olMapUtil/editFeature.ts";
+import request from "@/utils/request";
+import { deleteFeature } from "@/views/zhpt/common/arcgisUtil/query.ts";
+import { geteSessionStorage } from '@/utils/auth'
 
 export default {
-  name: 'drainageSubarea',
+  name: "drainageSubarea",
   components: { FormDialog },
   data() {
     return {
-      input: '',
+      input: "",
       column: [
         {
-          label: '分区编码',
-          prop: 'subareaid',
-          width: '180',
-          align: 'center',
-          overflow: false
+          label: "分区编码",
+          prop: "subareaid",
+          width: "180",
+          align: "center",
+          overflow: false,
         },
         {
-          label: '分区名称',
-          prop: 'fqmc',
-          width: '220',
-          align: 'center',
-          overflow: false
+          label: "分区名称",
+          prop: "fqmc",
+          width: "220",
+          align: "center",
+          overflow: false,
         },
         {
-          label: '分区类型',
-          prop: 'fqlx',
-          width: '180',
-          align: 'center',
-          overflow: false
+          label: "分区类型",
+          prop: "fqlx",
+          width: "180",
+          align: "center",
+          overflow: false,
         },
         {
-          label: '汇水面积(km²)',
-          prop: 'hsmj',
-          width: '180',
-          align: 'center',
-          overflow: false
+          label: "汇水面积(km²)",
+          prop: "hsmj",
+          width: "180",
+          align: "center",
+          overflow: false,
         },
         {
-          label: '分区等级',
-          prop: 'fqdj',
-          width: '180',
-          align: 'center',
-          overflow: false
+          label: "分区等级",
+          prop: "fqdj",
+          width: "180",
+          align: "center",
+          overflow: false,
         },
         {
-          label: '排水体制说明',
-          prop: 'pstzsm',
-          width: '180',
-          align: 'left',
-          overflow: true
+          label: "排水体制说明",
+          prop: "pstzsm",
+          width: "180",
+          align: "left",
+          overflow: true,
         },
         {
-          label: '备注',
-          prop: 'remark',
-          width: '0',
-          align: 'left',
-          overflow: true
-        }
+          label: "备注",
+          prop: "remark",
+          width: "0",
+          align: "left",
+          overflow: true,
+        },
       ],
       tableData: [],
       total: 0,
@@ -185,7 +237,7 @@ export default {
       selectedData: [],
       multipleSelection: [],
       pagination: { current: 1, size: 30 },
-      dialogTitle: '标题名称',
+      dialogTitle: "标题名称",
       listLoading: true,
       loading: false,
       dialogVisible: false,
@@ -193,77 +245,80 @@ export default {
       typeNum: [0, 0, 0, 0],
       dict: {
         outfallTypes: [],
-        subareaRanks: []
+        subareaRanks: [],
       },
-      dictTypes: ['subareaRank', 'outfall_type'],
-      layerId: 'tf_psps_subarea_b', //排水分区
+      dictTypes: ["subareaRank", "outfall_type"],
+      layerId: "tf_psps_subarea_b", //排水分区
       queryTask: null,
-      allTableData: []
-    }
+      allTableData: [],
+    };
   },
   computed: {
     tableheight() {
-      return client().height - 64 - 43 - 40 - 55 + 'px'
-    }
+      return client().height - 64 - 43 - 40 - 55 + "px";
+    },
   },
   watch: {},
   created() {
-    this.queryResult()
-    this.initDictionary()
+    this.queryResult();
+    this.initDictionary();
     // this.fetchData()
   },
   methods: {
-     // 从arcgis通过id删除数据
-     delResult(ids) {
+    // 从arcgis通过id删除数据
+    delResult(ids) {
+      let token= geteSessionStorage('arcgistoken')
       $.ajax({
-        url:  "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/23/applyEdits",
+        url: "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/23/applyEdits",
         type: "POST",
         data: {
           deletes: ids,
-          f: "pjson"
+          f: "pjson",
+          token
         },
-        success: data => {
+        success: (data) => {
           data = JSON.parse(data);
-        if(data.deleteResults){
-          this.queryResult()
-         this.$message.success('删除成功!')
-        }  
+          if (data.deleteResults) {
+            this.queryResult();
+            this.$message.success("删除成功!");
+          }
         },
-        error: error => this.$message.error(error)
+        error: (error) => this.$message.error(error),
       });
     },
-     // 从arcgis获取数据
-     queryResult() {
-      this.tableData =[] 
-      this.allTableData=[]
-      console.log(this.checkList,'hdhd')
+    // 从arcgis获取数据
+    queryResult() {
+      let token= geteSessionStorage('arcgistoken')
+      this.tableData = [];
+      this.allTableData = [];
+      console.log(this.checkList, "hdhd");
       this.analysisDisable = true;
       let layerId = "23";
       // let queryText=  'SID'+ " like '%" + queText + "%'"
       let queryText = "1=1";
-      if(this.input){
-        queryText = 'FQMC'+ " like '%" + this.input + "%'";
+      if (this.input) {
+        queryText = "FQMC" + " like '%" + this.input + "%'";
       }
-      if(this.checkList.length>0&&queryText!=='1=1'){
-        queryText+='and'
-        let str=''
-        this.checkList.forEach((i,index)=>{
-          if(index==0){
+      if (this.checkList.length > 0 && queryText !== "1=1") {
+        queryText += "and";
+        let str = "";
+        this.checkList.forEach((i, index) => {
+          if (index == 0) {
             str += `FQLX ='${i}'`;
-          }else{
+          } else {
             str += ` or FQLX ='${i}'`;
           }
-        })
-        queryText+=`(${str})`
-      }else if(this.checkList.length>0){
-        queryText=''
-        this.checkList.forEach((i,index)=>{
-          if(index==0){
+        });
+        queryText += `(${str})`;
+      } else if (this.checkList.length > 0) {
+        queryText = "";
+        this.checkList.forEach((i, index) => {
+          if (index == 0) {
             queryText = `FQLX = '${i}' `;
-          }else{
+          } else {
             queryText += `or FQLX = '${i}' `;
           }
-        })
+        });
       }
       $.ajax({
         url:
@@ -275,9 +330,10 @@ export default {
         data: {
           where: queryText,
           outFields: "*",
-          f: "pjson"
+          f: "pjson",
+          token
         },
-        success: data => {
+        success: (data) => {
           data = JSON.parse(data);
           console.log(data, "data");
           this.analysisDisable = false;
@@ -295,7 +351,7 @@ export default {
           // }
 
           let arr = [];
-          data.features.map(e => {
+          data.features.map((e) => {
             let attributes = e.attributes;
             attributes.geometry = e.geometry;
             arr.push(attributes);
@@ -310,7 +366,7 @@ export default {
               label: data.fieldAliases[key],
               prop: key,
               width: 100,
-              align: "center"
+              align: "center",
             };
             if (key == "SID") {
               obj.width = 150;
@@ -325,29 +381,31 @@ export default {
           //   this.$store.dispatch('map/changeMethod', this.panel)
           // }
         },
-        error: error => this.$message.error(error)
+        error: (error) => this.$message.error(error),
       });
     },
     async initDictionary() {
-      request({ url: '/base/syscommoncode/getByfjId?pCid=66551,66622', method: 'get' }).then(res => {
+      request({
+        url: "/base/syscommoncode/getByfjId?pCid=66551,66622",
+        method: "get",
+      }).then((res) => {
         if (res.code == 1) {
-          let result=res.result
-          let codeList = result.filter(i=>i.ccode=='drainage_type') 
-          let arr=[]
-           codeList[0].codeList.map((item) => {
-          arr.push({notes: item.cname}) 
-        })
-        this.dict.outfallTypes =arr
-
-          let codeList2 = result.filter(i=>i.ccode=='subareaRank') 
-          let arr2=[]
-           codeList2[0].codeList.map((item) => {
-          arr2.push({notes: item.cname}) 
-        })
-        this.dict.subareaRanks =arr2
-        } else this.$message(res.message)
+          let result = res.result;
+          let codeList = result.filter((i) => i.ccode == "drainage_type");
+          let arr = [];
+          codeList[0].codeList.map((item) => {
+            arr.push({ notes: item.cname });
+          });
+          this.dict.outfallTypes = arr;
 
-      })
+          let codeList2 = result.filter((i) => i.ccode == "subareaRank");
+          let arr2 = [];
+          codeList2[0].codeList.map((item) => {
+            arr2.push({ notes: item.cname });
+          });
+          this.dict.subareaRanks = arr2;
+        } else this.$message(res.message);
+      });
       // let result = await this.getValueListByKeys(this.dictTypes.toString())
       // //排水类型
       // if (Object.hasOwnProperty.call(result, 'drainage_type')) {
@@ -366,91 +424,100 @@ export default {
      * 根据字典codeKey值查询value
      */
     getValueListByKeys(dictName) {
-      let param = null
-      if (dictName != '') {
+      let param = null;
+      if (dictName != "") {
         param = {
-          keys: dictName
-        }
+          keys: dictName,
+        };
       }
       return new Promise((resolve) => {
         getDicValueByKeys(param).then((res) => {
           if (res.code == 1) {
-            resolve(res.result)
+            resolve(res.result);
           } else {
-            resolve({})
+            resolve({});
           }
-        })
-      })
+        });
+      });
     },
 
     /**
      * 数据查询
      */
     fetchData() {
-      if (this.layerId == '') return
-      this.listLoading = true
-      let dataService = appconfig.gisResource.geoserver_resource.queryServer
+      if (this.layerId == "") return;
+      this.listLoading = true;
+      let dataService = appconfig.gisResource.geoserver_resource.queryServer;
 
       let option = {
         map: null,
         namespace: dataService.namespace,
         uri: dataService.uri,
         srsName: dataService.srsName,
-        fieldsConfig: []
-      }
+        fieldsConfig: [],
+      };
 
-      let s = this.dict.outfallTypes
-      let queryText = ''
+      let s = this.dict.outfallTypes;
+      let queryText = "";
       this.checkList.map((item, index) => {
         queryText =
-          index < this.checkList.length - 1 ? queryText + "fqlx='" + item + "' or " : queryText + "fqlx='" + item + "'"
-      })
-      if (queryText === '') queryText = ' 1=1 '
-      if (this.input != '') queryText = queryText + ' and ' + `fqmc like '%${this.input}%'`
+          index < this.checkList.length - 1
+            ? queryText + "fqlx='" + item + "' or "
+            : queryText + "fqlx='" + item + "'";
+      });
+      if (queryText === "") queryText = " 1=1 ";
+      if (this.input != "")
+        queryText = queryText + " and " + `fqmc like '%${this.input}%'`;
 
-      this.queryTask = new tf.GeoQuery(option)
+      this.queryTask = new tf.GeoQuery(option);
       let callback = (data) => {
-        console.log('查询出的数据', data)
+        console.log("查询出的数据", data);
         if (data && data.length > 0) {
-          this.getTableData(data)
+          this.getTableData(data);
         }
-        this.listLoading = false
-      }
+        this.listLoading = false;
+      };
       //目标图层,查询条件、回调
-      this.queryTask.queryWFSBySQL([this.layerId], queryText, callback)
-      this.listLoading = false
+      this.queryTask.queryWFSBySQL([this.layerId], queryText, callback);
+      this.listLoading = false;
     },
 
     /***
      * 获取table数据
      */
     getTableData(data) {
-      let table = data[0]
-      this.total = 0
-      this.allTableData = []
+      let table = data[0];
+      this.total = 0;
+      this.allTableData = [];
       if (!table) {
-        this.tableData = []
-        return this.$message.warning('未查询到数据!')
+        this.tableData = [];
+        return this.$message.warning("未查询到数据!");
       }
-      let features = table.features ? table.features : []
+      let features = table.features ? table.features : [];
       if (features.length === 0) {
-        this.tableData = []
-        return this.$message.warning('未查询到数据!')
+        this.tableData = [];
+        return this.$message.warning("未查询到数据!");
       }
-      this.total = features.length
+      this.total = features.length;
       features.map((fea, index) => {
-        const { geometry, geometry_name, id } = fea
-        let fields = Object.assign({}, fea.properties)
-        Object.assign(fields, { feature: fea, geometry, geometry_name, id, tfno: index })
-        this.allTableData.push(fields)
-      })
-      this.doPagination()
+        const { geometry, geometry_name, id } = fea;
+        let fields = Object.assign({}, fea.properties);
+        Object.assign(fields, {
+          feature: fea,
+          geometry,
+          geometry_name,
+          id,
+          tfno: index,
+        });
+        this.allTableData.push(fields);
+      });
+      this.doPagination();
     },
 
     /**
      * 分页
      */
-     doPagination() {
+    doPagination() {
       this.total = this.allTableData.length;
       const begin = (this.pagination.current - 1) * this.pagination.size;
       const end = this.pagination.current * this.pagination.size;
@@ -460,72 +527,72 @@ export default {
     },
 
     updateBtn(row) {
-      this.dialogVisible = true
-      this.dialogTitle = '修改'
-      this.editData = row
-      this.editData.flag = 'updateBtn'
+      this.dialogVisible = true;
+      this.dialogTitle = "修改";
+      this.editData = row;
+      this.editData.flag = "updateBtn";
     },
     readBtn(row) {
-      this.dialogVisible = true
-      this.dialogTitle = '详情'
-      this.editData = row
-      this.editData.flag = 'read'
+      this.dialogVisible = true;
+      this.dialogTitle = "详情";
+      this.editData = row;
+      this.editData.flag = "read";
     },
 
     deleteBtn(row) {
-      this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
+      this.$confirm("此操作将永久删除该信息, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
       })
         .then(() => {
-          this.deleteSubmit(row)
+          this.deleteSubmit(row);
         })
         .catch(() => {
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          })
-        })
+            type: "info",
+            message: "已取消删除",
+          });
+        });
     },
 
     deleteBtnHandle() {
-      if (this.multipleSelection.length < 1) return
-      this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
+      if (this.multipleSelection.length < 1) return;
+      this.$confirm("此操作将永久删除该信息, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
       })
         .then(() => {
-          this.multiDeleteSubmit(this.multipleSelection)
+          this.multiDeleteSubmit(this.multipleSelection);
         })
         .catch(() => {
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          })
-        })
+            type: "info",
+            message: "已取消删除",
+          });
+        });
     },
 
     /**
      * 删除
      */
     async deleteSubmit(row) {
-      let ids=row['OBJECTID']
-      this.delResult(ids)
+      let ids = row["OBJECTID"];
+      this.delResult(ids);
     },
 
     /**
      * 批量删除
      */
-     async multiDeleteSubmit(rows) {
-      let arr=[]
-      if(rows.length>0){
-        rows.forEach(j=>{
-          arr.push(j.OBJECTID)
-        })
-        let ids= arr.join(',')
-      this.delResult(ids)
+    async multiDeleteSubmit(rows) {
+      let arr = [];
+      if (rows.length > 0) {
+        rows.forEach((j) => {
+          arr.push(j.OBJECTID);
+        });
+        let ids = arr.join(",");
+        this.delResult(ids);
       }
       // let feas = []
       // rows.map(item=>{
@@ -545,36 +612,36 @@ export default {
     },
 
     insertBtn() {
-      this.dialogTitle = '添加'
-      this.editData = {}
-      this.dialogVisible = true
+      this.dialogTitle = "添加";
+      this.editData = {};
+      this.dialogVisible = true;
     },
 
     handleCurrentChange(currentPage) {
-      this.pagination.current = currentPage
-      this.doPagination()
+      this.pagination.current = currentPage;
+      this.doPagination();
     },
     handleSizeChange(pagesize) {
-      this.pagination.current = 1
-      this.pagination.size = pagesize
-      this.doPagination()
+      this.pagination.current = 1;
+      this.pagination.size = pagesize;
+      this.doPagination();
     },
     handleSelectionChange(value) {
-      this.multipleSelection = [...value]
+      this.multipleSelection = [...value];
     },
     remind(val) {
-      if (val == '1') {
-        this.dialogVisible = false
+      if (val == "1") {
+        this.dialogVisible = false;
         // this.fetchData(this.pagination)
-        this.queryResult()
-      } else if (val == '2') {
-        this.loading = true
+        this.queryResult();
+      } else if (val == "2") {
+        this.loading = true;
       } else {
-        this.loading = false
+        this.loading = false;
       }
-    }
-  }
-}
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>

+ 3 - 3
src/views/zhpt/basicInfoManage/monitorSite/deviceArchives/DeviceForm.vue

@@ -373,8 +373,8 @@ export default class TypeForm extends Vue {
         // onChange: this.onChangeCategory
       },
       {
-        label: '所属对象',
-        name: 'belongObj',
+        label: '所属厂站',
+        name: 'belongStationId',
         type: 'select',
         required: true,
         options: this.dict['sewages'],
@@ -406,7 +406,7 @@ export default class TypeForm extends Vue {
     name: [
       { required: true, message: '设备名称不能为空!', trigger: 'blur' },
       { max: 50, message: '设备名称不超过50个字符', trigger: 'blur' },
-      { pattern: /^[\u4e00-\u9fa5\w -]+$/, message: '允许输入汉字、英文、数字', trigger: 'blur' }
+      // { pattern: /^[\u4e00-\u9fa5\w -]+$/, message: '允许输入汉字、英文、数字', trigger: 'blur' }
     ],
     sn: [{ required: true, message: '请输入出厂编码', trigger: 'blur' }],
     // type: [{ required: true, message: '请选择设备类型', trigger: 'change' }],

+ 9 - 9
src/views/zhpt/basicInfoManage/monitorSite/deviceArchives/QueryForm.vue

@@ -33,9 +33,9 @@
         <el-option v-for="item in dict['deviceCategories']" :key="item.id" :label="item.name" :value="item.id" />
       </el-select>
     </el-form-item>
-    <el-form-item label="所属对象" prop="type">
-      <el-select v-model="formData.belongObj" @change="onChangeBelongObj" filterable placeholder="请选择所属对象" size="small" clearable>
-        <el-option v-for="item in dict['sewages']" :key="item.OBJECTID" :label="item.NAME" :value="item.OBJECTID" />
+    <el-form-item label="所属厂站" prop="type">
+      <el-select v-model="formData.belongStationId" @change="onChangeBelongObj" filterable placeholder="请选择所属对象" size="small" clearable>
+        <el-option v-for="item in dict['sewages']" :key="item.id" :label="item.name" :value="item.id" />
       </el-select>
     </el-form-item>
     <el-form-item label="设备状态" prop="type">
@@ -125,7 +125,7 @@ export interface ILoading {
 export interface IQuery {
   deptId?: string | number
   category?: string | number
-  belongObj?: string
+  belongStationId?: string
   status?: string
   isRespect?: string
   isGenerateCode?: string
@@ -175,16 +175,16 @@ export default class QueryForm extends Vue {
   */
   onChangeBelongObj(val){
     const obj = this.objects.find(item => item.id === val)
-    this.formData['belongObj'] = obj ? obj.name : val
+    this.formData['belongStationId'] = obj ? obj.name : val
     this.$emit('query', { ...this.formData })
-    this.formData['belongObj'] = val
+    this.formData['belongStationId'] = val
   }
 
   query(){
-    const obj = this.objects.find(item => item.id === this.formData['belongObj'])
-    this.formData['belongObj'] = obj ? obj.name : this.formData['belongObj']
+    const obj = this.objects.find(item => item.id === this.formData['belongStationId'])
+    this.formData['belongStationId'] = obj ? obj.name : this.formData['belongStationId']
     this.$emit('query', { ...this.formData })
-    this.formData['belongObj'] = obj.id
+    this.formData['belongStationId'] = obj.id
   }
 }
 </script>

+ 46 - 33
src/views/zhpt/basicInfoManage/monitorSite/deviceArchives/widget.vue

@@ -106,6 +106,7 @@ import { IP } from "@/utils/request";
 import { geteSessionStorage } from "@/utils/auth";
 import { getSewageList } from "@/views/operationCenter/common/api/config.ts";
 import request from "@/utils/request";
+import $ from 'jquery'
 
 
 @Component({
@@ -436,39 +437,50 @@ export default class DeviceDeviceArchives extends Vue {
   }
   // 查询污水厂
   queryWSC() {
-    
-      let layerId = "19";
-      let queryText = "1=1";
-      $.ajax({
-        url:
-          appconfig.gisResource.business_map.config[0].url +
-          "/" +
-          layerId +
-          "/query",
-        type: "POST",
-        data: {
-          where: queryText,
-          outFields: "*",
-          f: "pjson"
-        },
-        success: data => {
-          data = JSON.parse(data);
-          console.log(data, "data");
-          let arr = [] as any;
-          data.features.map(e => {
-            let attributes = e.attributes;
-            if(e.geometry){
-              attributes.geometry = e.geometry;
-            }
-            attributes.id=attributes.OBJECTID
-            attributes.name=attributes.NAME
-            attributes.label=attributes.NAME
-            arr.push(attributes);
-          });
-          this.dict.sewages=arr
-        },
-        error: error => this.$message.error(error)
-      });
+    getSewageList({ size:10000 }).then(res => {
+      if (res && res.code == 1) {
+        this.dict.sewages = res.result.records.map(({ id, name, deptId }) => ({
+          id,
+          name,
+          label:name,
+          deptId
+        }));
+      }
+    });
+    // let token= geteSessionStorage('arcgistoken')
+    //   let layerId = "19";
+    //   let queryText = "1=1";
+    //   $.ajax({
+    //     url:
+    //       appconfig.gisResource.business_map.config[0].url +
+    //       "/" +
+    //       layerId +
+    //       "/query",
+    //     type: "POST",
+    //     data: {
+    //       where: queryText,
+    //       outFields: "*",
+    //       f: "pjson",
+    //       token
+    //     },
+    //     success: data => {
+    //       data = JSON.parse(data);
+    //       console.log(data, "data");
+    //       let arr = [] as any;
+    //       data.features.map(e => {
+    //         let attributes = e.attributes;
+    //         if(e.geometry){
+    //           attributes.geometry = e.geometry;
+    //         }
+    //         attributes.id=attributes.OBJECTID
+    //         attributes.name=attributes.NAME
+    //         attributes.label=attributes.NAME
+    //         arr.push(attributes);
+    //       });
+    //       this.dict.sewages=arr
+    //     },
+    //     error: error => this.$message.error(error)
+    //   });
     }
   handleDeptChange(deptId) {
     this.deptId = deptId;
@@ -515,6 +527,7 @@ export default class DeviceDeviceArchives extends Vue {
       }
     });
   }
+  // 
   /**
    * 查询图层
    */

+ 1 - 1
src/views/zhpt/basicInfoManage/monitorSite/standards/widget.vue

@@ -320,7 +320,7 @@ export default class MonitoringStandards extends Vue {
     try {
       // const values = await getDictKeys()
       // this.levels = (values as IDictionary[]) || []
-      request({ url: '/base/syscommoncode/getByfjId?pCid=66640', method: 'get' }).then(res => {
+      request({ url: '/base/syscommoncode/getByfjId?pCid=66613', method: 'get' }).then(res => {
         if (res.code == 1) {
           let result=res.result
           let codeList = result.filter(i=>i.ccode=='monitor_judge') 

+ 1 - 1
src/views/zhpt/basicInfoManage/monitorSite/utils.ts

@@ -65,7 +65,7 @@ export const settingDeviceArchiveCols: ColItem[] = [
   { prop: 'statusName', label: '设备状态', minWidth: '130px' },
   { prop: 'monitorTypeName', label: '监测类型', minWidth: '100px' },
   { prop: 'categoryName', label: '所属类别', minWidth: '120px' },
-  { prop: 'belongObj', label: '所属对象', minWidth: '100px' },
+  { prop: 'belongStationName', label: '所属厂站', minWidth: '120px' },
   { prop: 'action', label: '操作', width: '180px', _slot: true,fixed:'right' },
 ]
 

+ 58 - 55
src/views/zhpt/basicInfoManage/pumpStation/formDialog.vue

@@ -135,14 +135,14 @@
                 v-model="form.S_AREA"
                 :style="
                   'width: ' +
-                    (parseFloat(form.S_AREA ? form.S_AREA : 0) === 0
-                      ? '100%'
-                      : 'calc(100% - 28px)')
+                  (parseFloat(form.S_AREA ? form.S_AREA : 0) === 0
+                    ? '100%'
+                    : 'calc(100% - 28px)')
                 "
                 placeholder="请输入监控面积或者在地图上绘制"
               >
                 <!-- <template slot="append">平方米</template> -->
-                <i slot="suffix" style="color: #000;font-style: unset;"
+                <i slot="suffix" style="color: #000; font-style: unset"
                   >平方米</i
                 >
               </el-input>
@@ -158,7 +158,7 @@
             <el-form-item label="坐标">
               <el-row type="flex" justify="space-between" :gutter="10">
                 <el-col>
-                  <el-form-item prop="form.X" style="margin-bottom:0px;">
+                  <el-form-item prop="form.X" style="margin-bottom: 0px">
                     <el-input
                       v-model="form.X"
                       placeholder="请输入坐标或者在右边地图上选择坐标"
@@ -167,7 +167,7 @@
                 </el-col>
                 <el-col style="flex: 0 0 1em; text-align: center"> ~ </el-col>
                 <el-col>
-                  <el-form-item prop="form.Y" style="margin-bottom:0px;">
+                  <el-form-item prop="form.Y" style="margin-bottom: 0px">
                     <el-input
                       v-model="form.Y"
                       :style="'width: 100%'"
@@ -229,7 +229,7 @@
                       v-model.number="form['SDE_DCSW.TF_PSPS_PUMPSTATI.AREA']"
                       placeholder="请输入占地面积"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >平方米</i
                       >
                     </el-input>
@@ -242,7 +242,7 @@
                       v-model.number="form.SJYSPSNL"
                       placeholder="请输入设计雨水处理能力"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >万吨/天</i
                       >
                     </el-input>
@@ -255,7 +255,7 @@
                       v-model.number="form.CUR_STROM"
                       placeholder="请输入现有雨水处理能力"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >万吨/天</i
                       >
                     </el-input>
@@ -268,7 +268,7 @@
                       v-model.number="form.SJWSPSNL"
                       placeholder="请输入设计污水处理能力"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >万吨/天</i
                       >
                     </el-input>
@@ -281,7 +281,7 @@
                       v-model.number="form.CUR_SEW"
                       placeholder="请输入现有污水处理能力"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >万吨/天</i
                       >
                     </el-input>
@@ -294,7 +294,7 @@
                       v-model.number="form.S_INVERT"
                       placeholder="请输入溢流管底标高"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -307,7 +307,7 @@
                       v-model.number="form.PSIZE"
                       placeholder="请输入溢流管管径"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >个</i
                       >
                     </el-input>
@@ -340,7 +340,7 @@
                       v-model.number="form.MIN_LEVEL"
                       placeholder="请输入最低控制水位"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -353,7 +353,7 @@
                       v-model.number="form.ZCYXSW"
                       placeholder="请输入正常运行水位"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -366,7 +366,7 @@
                       v-model.number="form.JJSW"
                       placeholder="请输入警戒水位"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -379,7 +379,7 @@
                       v-model.number="form.FOREBAYLEN"
                       placeholder="请输入集水池长"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -392,7 +392,7 @@
                       v-model.number="form.FOREBAYWID"
                       placeholder="请输入集水池宽"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -405,7 +405,7 @@
                       v-model.number="form.FOREBAYDEP"
                       placeholder="请输入集水池高"
                     >
-                      <i slot="suffix" style="color: #000;font-style: unset;"
+                      <i slot="suffix" style="color: #000; font-style: unset"
                         >米</i
                       >
                     </el-input>
@@ -609,12 +609,12 @@ import { Point, MultiPoint } from "ol/geom";
 import {
   deleteGeoFiles,
   getGeoFiles,
-  uploadGeoFiles
+  uploadGeoFiles,
 } from "@/api/basicData/sewagePlant.ts";
 import { IP } from "@/utils/request";
 import {
   addFeature,
-  updateFeature
+  updateFeature,
 } from "@/views/zhpt/common/arcgisUtil/index.ts";
 
 export default {
@@ -623,25 +623,27 @@ export default {
   props: {
     data: {
       type: Object,
-      required: true
+      required: true,
     },
     dict: {
       type: Object,
-      required: true
+      required: true,
     },
     openType: {
       type: String,
-      requied: "view"
-    }
+      requied: "view",
+    },
   },
   data() {
     return {
       rules: {
         NAME: [{ required: true, message: "请输入泵站名称", trigger: "blur" }],
         EXP_NO: [
-          { required: true, message: "请输入泵站编号", trigger: "blur" }
+          { required: true, message: "请输入泵站编号", trigger: "blur" },
+        ],
+        TYPE: [
+          { required: true, message: "请选择泵站类型", trigger: "change" },
         ],
-        TYPE: [{ required: true, message: "请选择泵站类型", trigger: "change" }]
       },
       form: {
         TYPE: "", //泵站类型
@@ -686,7 +688,7 @@ export default {
         GLDW: "",
         GLBM: "",
         GLFZR: "",
-        GLLXDH: ""
+        GLLXDH: "",
       },
       visible: false,
       disabled: false,
@@ -704,7 +706,7 @@ export default {
       pumpTypes: [], //泵站小类
       regions: [], //所属区域
       subareas: [],
-      sewages: [] //所属水厂
+      sewages: [], //所属水厂
     };
   },
 
@@ -830,13 +832,13 @@ export default {
       fieldsValue.GEOSTRING = this.vertices.toString();
       let info = {
         type: "Point",
-        attributes: fieldsValue
+        attributes: fieldsValue,
       };
 
       updateFeature(
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/21",
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/21",
         info
-      ).then(async res => {
+      ).then(async (res) => {
         if (res.updateFeatureResults.length) {
           await this.submitFiles();
           this.$emit("remind", "1");
@@ -860,13 +862,13 @@ export default {
       fieldsValue.GEOSTRING = this.vertices ? this.vertices.toString() : "";
       let info = {
         type: "Point",
-        attributes: fieldsValue
+        attributes: fieldsValue,
       };
 
       addFeature(
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/21",
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/21",
         info
-      ).then(async res => {
+      ).then(async (res) => {
         this.loading = false;
         this.$emit("remind", "0");
         if (res.addFeatureResults.length) {
@@ -884,7 +886,7 @@ export default {
     async submitFiles() {
       if (this.fileList.length < 1) {
         if (this.beforeFiles.length < 1) return;
-        const ids = this.beforeFiles.map(item => item.id);
+        const ids = this.beforeFiles.map((item) => item.id);
         await deleteGeoFiles({ ids: ids.toString() });
       } else {
         let formdata = new FormData();
@@ -900,7 +902,7 @@ export default {
           if (this.fileList.lenght === 1) {
             //如果该文件该保存文件status='ready',删除之前所有文件,同时上传改文件
             if (this.fileList[0].status === "ready") {
-              const ids = this.beforeFiles.map(item => item.id);
+              const ids = this.beforeFiles.map((item) => item.id);
               const name = this.layer.tableName + "." + this.form.exp_no;
               formdata.append("name", name);
               if (this.beforeFiles.length > 0) {
@@ -914,18 +916,18 @@ export default {
               else {
                 //找出删除的删除
                 let files = this.beforeFiles.filter(
-                  item => item.id !== this.fileList[0].id
+                  (item) => item.id !== this.fileList[0].id
                 );
-                const ides = files.map(f => f.id);
+                const ides = files.map((f) => f.id);
                 deleteGeoFiles({ ids: ids.toString() });
               }
             }
           } else {
             const successFile = this.fileList.filter(
-              item => item.status === "success"
+              (item) => item.status === "success"
             );
             const readyFile = this.fileList.filter(
-              item => item.status === "ready"
+              (item) => item.status === "ready"
             );
             //看看保存文件是否存在成功的
             if (successFile.length === 0) {
@@ -937,7 +939,7 @@ export default {
                 await this.saveGeoFile(formdata);
               } else {
                 //如果之前文件有,则先删除,在上传
-                const ids = this.beforeFiles.map(item => item.id);
+                const ids = this.beforeFiles.map((item) => item.id);
                 const res = await deleteGeoFiles({ ids: ids.toString() });
                 if (res && res.code === 1) {
                   const name = this.layer.tableName + "." + this.form.exp_no;
@@ -952,8 +954,8 @@ export default {
               //存在删除
               if (this.beforeFiles.length > successFile.length) {
                 let d_ids = [];
-                this.beforeFiles.map(bf => {
-                  const obj = successFile.find(s => s.id === bf.id);
+                this.beforeFiles.map((bf) => {
+                  const obj = successFile.find((s) => s.id === bf.id);
                   if (!obj) d_ids.push(bf.id);
                 });
                 const res = await deleteGeoFiles({ ids: d_ids.toString() });
@@ -980,7 +982,7 @@ export default {
      * @formdata 格式FormData
      */
     async saveGeoFile(formdata) {
-      await uploadGeoFiles(formdata).then(res => {
+      await uploadGeoFiles(formdata).then((res) => {
         if (res.code === 1) {
         } else {
           this.$message.error("上传文件失败");
@@ -993,25 +995,25 @@ export default {
      */
     queryFiles(name) {
       const param = {
-        name
+        name,
       };
       this.beforeFiles = [];
-      getGeoFiles(param).then(res => {
+      getGeoFiles(param).then((res) => {
         if (res.code === 1) {
           if (res.result && Object.hasOwnProperty.call(res.result, name)) {
             this.fileList = [];
             let files = res.result[name];
-            files.map(item => {
+            files.map((item) => {
               this.fileList.push({
                 name: item.fileName,
                 filePath: item.filePath,
-                id: item.id
+                id: item.id,
               });
 
               this.beforeFiles.push({
                 name: item.fileName,
                 filePath: item.filePath,
-                id: item.id
+                id: item.id,
               });
             });
           }
@@ -1114,7 +1116,8 @@ export default {
 
     // 电话号码验证规则
     isvalidPhone(phone) {
-      const isPhone = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/; // 11位合法手机号码
+      const isPhone =
+        /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/; // 11位合法手机号码
       const isMob1 = /0\d{2,3}\d{7,8}/; // 不带-的座机:02985111752
       const isMob2 = /^([0-9]{3,4}-)?[0-9]{7,8}$/; // 带一个-:029-85111752
       const isMob3 = /^\d{3,4}-\d{3,4}-\d{3,4}$/; // 带三个-: 0752-250-520
@@ -1144,7 +1147,7 @@ export default {
       if (mapTool) {
         const callback = (x, y) => {
           let coordinates = [x, y];
-          let coors = coordinates.map(item => {
+          let coors = coordinates.map((item) => {
             return item.toFixed(6);
           });
           this.form.X = coors[0];
@@ -1160,7 +1163,7 @@ export default {
     drawPolygon() {
       let mapTool = this.$refs.tfMap;
       if (mapTool) {
-        const callback = res => {
+        const callback = (res) => {
           let mapTool = this.$refs.tfMap;
           if (mapTool) {
             this.form.S_AREA = res.area;
@@ -1206,8 +1209,8 @@ export default {
      * description  地图
      */
 
-    paletteBtn() {}
-  }
+    paletteBtn() {},
+  },
 };
 </script>
 <style lang="scss" scoped>

+ 74 - 80
src/views/zhpt/basicInfoManage/pumpStation/widget.vue

@@ -165,7 +165,7 @@
         :page-size="pagination.size"
         layout="total, sizes, prev, pager, next, jumper"
         :total="total"
-        style="margin-top: 6px;margin-bottom: 8px;"
+        style="margin-top: 6px; margin-bottom: 8px"
       >
       </el-pagination>
       <!-- <el-table
@@ -198,7 +198,10 @@ import FormDialog from "./formDialog.vue";
 import { appconfig } from "staticPub/config";
 import GeoJSON from "ol/format/GeoJSON";
 import tf from "@/ToflyGIS/toflyGis";
-import { sqlQuery, deleteFeature } from "@/views/zhpt/common/arcgisUtil/index.ts";
+import {
+  sqlQuery,
+  deleteFeature,
+} from "@/views/zhpt/common/arcgisUtil/index.ts";
 import { TFGeoQuery } from "@/views/zhpt/common/olMapUtil/geoserverQuery.ts";
 import editFeature from "@/views/zhpt/common/olMapUtil/editFeature.ts";
 import { getDicValueByKeys } from "@/api/base";
@@ -216,80 +219,80 @@ export default {
           label: "泵站名称",
           prop: "NAME",
           width: "140",
-          align: "center"
+          align: "center",
         },
         {
           label: "泵站编号",
           prop: "EXP_NO",
           width: "180",
-          align: "center"
+          align: "center",
         },
         {
           label: "泵站类别",
           prop: "TYPE",
           width: "180",
-          align: "center"
+          align: "center",
         },
         {
           label: "泵站小类",
           prop: "BZLX",
           width: "180",
-          align: "center"
+          align: "center",
         },
         {
           label: "所属区域", //缺少字段
           prop: "SZYSFQ",
           width: "100",
-          align: "center"
+          align: "center",
         },
         {
           label: "所在排水分区",
           prop: "SZPSXT",
           width: "200",
-          align: "right"
+          align: "right",
         },
         {
           label: "泵站分组",
           prop: "GROUP_",
           width: "160",
-          align: "center"
+          align: "center",
         },
         {
           label: "投运日期",
           prop: "RUNTIME",
           width: "120",
-          align: "left"
+          align: "left",
         },
         {
           label: "设计雨水处理能力(m³/s)",
           prop: "SJYSPSNL",
           width: "160",
-          align: "center"
+          align: "center",
         },
         {
           label: "设计污水处理能力(m³/s)",
           prop: "SJWSPSNL",
           width: "160",
-          align: "center"
+          align: "center",
         },
         {
           label: "地址",
           prop: "ADDRESS",
           width: "160",
-          align: "left"
+          align: "left",
         },
         {
           label: "修改人",
           prop: "U_USERNAME",
           width: "100",
-          align: "center"
+          align: "center",
         },
         {
           label: "修改时间",
           prop: "U_TIME",
           width: "120",
-          align: "center"
-        }
+          align: "center",
+        },
       ],
 
       allTableData: [],
@@ -319,28 +322,19 @@ export default {
         workmanships: [], //处理工艺
         sewageDisposalTypes: [], //污水处理设施种类
         sewageDisposalLevels: [], //污水处理级别
-        sewages: [] //污水厂
+        sewages: [], //污水厂
       },
       dictTypes: [
-        66516,
-        66519,
-        66633,
-        66524,
-        66528,
-        66636,
-        66533,
-        66542,
-        66544,
-        66547
+        66516, 66519, 66633, 66524, 66528, 66636, 66533, 66542, 66544, 66547,
       ],
       isDel: true,
-      beforeFiles: []
+      beforeFiles: [],
     };
   },
   computed: {
     tableheight() {
       return client().height - 64 - 43 - 40 - 55 + "px";
-    }
+    },
   },
   watch: {},
   created() {
@@ -354,65 +348,65 @@ export default {
 
       //泵站类型
       this.dict.outfallTypes = result.filter(
-        item => item.ccode == "outfall_type"
+        (item) => item.ccode == "outfall_type"
       )[0].codeList;
 
       //泵站小类
       this.dict.pumpTypes = result.filter(
-        item => item.ccode == "pumpType"
+        (item) => item.ccode == "pumpType"
       )[0].codeList;
 
       //排水系统
       this.dict.sysDrainages = result.filter(
-        item => item.ccode == "drainage_sys"
+        (item) => item.ccode == "drainage_sys"
       )[0].codeList;
 
       //所属区域
       this.dict.regions = result.filter(
-        item => item.ccode == "region"
+        (item) => item.ccode == "region"
       )[0].codeList;
 
       //污水厂建设状态
       this.dict.bstates = result.filter(
-        item => item.ccode == "bstate"
+        (item) => item.ccode == "bstate"
       )[0].codeList;
 
       //所属流域
       this.dict.rivers = result.filter(
-        item => item.ccode == "river"
+        (item) => item.ccode == "river"
       )[0].codeList;
 
       //受纳水体
       this.dict.waterBodies = result.filter(
-        item => item.ccode == "accepted_water_body"
+        (item) => item.ccode == "accepted_water_body"
       )[0].codeList;
 
       //处理工艺
       this.dict.workmanships = result.filter(
-        item => item.ccode == "workmanship"
+        (item) => item.ccode == "workmanship"
       )[0].codeList;
 
       //污水处理设施种类
       this.dict.sewageDisposalTypes = result.filter(
-        item => item.ccode == "sewage_disposal_type"
+        (item) => item.ccode == "sewage_disposal_type"
       )[0].codeList;
 
       //污水处理级别
       this.dict.sewageDisposalLevels = result.filter(
-        item => item.ccode == "sewage_disposal_level"
+        (item) => item.ccode == "sewage_disposal_level"
       )[0].codeList;
 
       ///所在排水分区
       await sqlQuery(
         "1=1",
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/MapServer/23"
-      ).then(res => {
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/MapServer/23"
+      ).then((res) => {
         if (res.features.length) {
-          res.features.forEach(fea => {
+          res.features.forEach((fea) => {
             console.log(fea, "psfq");
             this.dict.subareas.push({
               codeValue: fea.attributes.SUBAREAID,
-              notes: fea.attributes.FQMC
+              notes: fea.attributes.FQMC,
             });
           });
         }
@@ -420,13 +414,13 @@ export default {
       // 所在污水厂
       await sqlQuery(
         "1=1",
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/MapServer/19"
-      ).then(res => {
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/MapServer/19"
+      ).then((res) => {
         if (res.features.length) {
-          res.features.forEach(fea => {
+          res.features.forEach((fea) => {
             this.dict.sewages.push({
               codeValue: fea.attributes.EXP_NO,
-              notes: fea.attributes.NAME
+              notes: fea.attributes.NAME,
             });
           });
         }
@@ -440,7 +434,7 @@ export default {
         namespace: dataService.namespace,
         uri: dataService.uri,
         srsName: dataService.srsName,
-        fieldsConfig: []
+        fieldsConfig: [],
       };
       let queryTask = new tf.GeoQuery(option);
       //目标图层,查询条件、回调
@@ -454,11 +448,11 @@ export default {
       let param = null;
       if (dictName != "") {
         param = {
-          pCid: dictName
+          pCid: dictName,
         };
       }
-      return new Promise(resolve => {
-        getDicValueByKeys(param).then(res => {
+      return new Promise((resolve) => {
+        getDicValueByKeys(param).then((res) => {
           if (res.code == 1) {
             resolve(res.result);
           } else {
@@ -473,16 +467,16 @@ export default {
     async initQuery() {
       await sqlQuery(
         "1=1",
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/MapServer/21"
-      ).then(res => {
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/MapServer/21"
+      ).then((res) => {
         console.log(res, "initquery");
         if (res.features.length) {
           this.total = res.features.length;
           let data = [];
-          res.features.forEach(fea => {
+          res.features.forEach((fea) => {
             const attri = {
               fea: fea,
-              ...fea.attributes
+              ...fea.attributes,
             };
             data.push(attri);
           });
@@ -496,19 +490,21 @@ export default {
     getLayerFields(features) {
       if (!features) return;
       let fields = {};
-      features.map(item => {
+      features.map((item) => {
         const attributes = item.attributes;
         if (Object.hasOwnProperty.call(fields, attributes.v_lyname)) {
           fields[attributes.v_lyname].fids.push({
             en: attributes.v_fname,
             ch: attributes.v_fcname,
-            show: 1
+            show: 1,
           });
         } else {
           fields[attributes.v_lyname] = null;
           fields[attributes.v_lyname] = {
             des: attributes.v_lyname,
-            fids: [{ en: attributes.v_fname, ch: attributes.v_fcname, show: 1 }]
+            fids: [
+              { en: attributes.v_fname, ch: attributes.v_fcname, show: 1 },
+            ],
           };
         }
       });
@@ -541,10 +537,10 @@ export default {
         let fields = Object.assign({}, fea.attributes);
         if (fea.attributes.hasOwnProperty("SZWSFQ")) {
           let obj = this.dict.sysDrainages.find(
-            item => item.codeValue === fea.attributes.SZWSFQ
+            (item) => item.codeValue === fea.attributes.SZWSFQ
           );
           fields = Object.assign({}, fields, {
-            szwsfqName: obj ? obj.SZWSFQ : ""
+            szwsfqName: obj ? obj.SZWSFQ : "",
           });
         }
         if (Object.hasOwnProperty.call(fields, "RDATE")) {
@@ -573,7 +569,7 @@ export default {
         }
         Object.assign(fields, {
           fea: fea,
-          tfno: index
+          tfno: index,
         });
         this.allTableData.push(fields);
       });
@@ -588,7 +584,7 @@ export default {
       const begin = (this.pagination.current - 1) * this.pagination.size;
       const end = this.pagination.current * this.pagination.size;
       this.tableData = this.allTableData.filter(
-        item => item.tfno >= begin && item.tfno < end
+        (item) => item.tfno >= begin && item.tfno < end
       );
     },
 
@@ -599,17 +595,15 @@ export default {
 
       //关键字查询
       if (this.keywords != "") {
-        let name = `(NAME like '%${this.keywords}%' or ADDRESS like '%${
-          this.keywords
-        }%')`;
+        let name = `(NAME like '%${this.keywords}%' or ADDRESS like '%${this.keywords}%')`;
         queryText = queryText + " and " + name;
       }
       //目标图层,查询条件、回调
 
       await sqlQuery(
         queryText,
-        "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/MapServer/21"
-      ).then(res => {
+        "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/MapServer/21"
+      ).then((res) => {
         this.getTableData(res);
       });
 
@@ -667,7 +661,7 @@ export default {
     deleteMultil() {
       let rows = this.$refs.dataTable.selection;
       if (rows.length < 1) return;
-      let names = rows.map(item => {
+      let names = rows.map((item) => {
         return item.NAME;
       });
       this.$confirm(
@@ -676,17 +670,17 @@ export default {
         {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
-          type: "warning"
+          type: "warning",
         }
       )
         .then(async () => {
-          const info = rows.map(item => {
+          const info = rows.map((item) => {
             return item.fea;
           });
           await deleteFeature(
-            "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/21",
+            "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/21",
             info
-          ).then(res => {
+          ).then((res) => {
             if (res.deleteFeatureResults.length) {
               this.searchBtn();
               return this.$message.success("操作成功!");
@@ -696,7 +690,7 @@ export default {
         .catch(() => {
           this.$message({
             type: "info",
-            message: "已取消删除"
+            message: "已取消删除",
           });
         });
     },
@@ -708,25 +702,25 @@ export default {
         {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
-          type: "warning"
+          type: "warning",
         }
       )
         .then(async () => {
           await deleteFeature(
-            "http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW/FeatureServer/21",
+            "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS/FeatureServer/21",
             [row.fea]
-          ).then(res => {
+          ).then((res) => {
             if (res.deleteFeatureResults.length) {
               this.searchBtn();
               return this.$message.success("操作成功!");
             } else return this.$message.error("操作失败!");
           });
         })
-        .catch(e => {
+        .catch((e) => {
           console.log(e);
           this.$message({
             type: "info",
-            message: "已取消删除"
+            message: "已取消删除",
           });
         });
     },
@@ -747,8 +741,8 @@ export default {
       } else {
         this.loading = false;
       }
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 60 - 57
src/views/zhpt/basicInfoManage/sewagePlantMng/widget.vue

@@ -199,13 +199,18 @@ import { appconfig } from "staticPub/config";
 import GeoJSON from "ol/format/GeoJSON";
 import tf from "@/ToflyGIS/toflyGis";
 import { TFGeoQuery } from "@/views/zhpt/common/olMapUtil/geoserverQuery.ts";
-import { sqlQuery, deleteFeature } from "@/views/zhpt/common/arcgisUtil/index.ts";
+import {
+  sqlQuery,
+  deleteFeature,
+} from "@/views/zhpt/common/arcgisUtil/index.ts";
 import editFeature from "@/views/zhpt/common/olMapUtil/editFeature.ts";
 import { getDicValueByKeys, getKeyPage } from "@/api/base";
+import { getDicValueByKeys, getKeyPage } from "@/api/base";
 import ExportBtn from "@/views/zhpt/wxreportforms/components/ExportBtn.vue";
 import { parseTime } from "@/utils/index";
 import { getQRCodes } from "@/api/basicData/qrcode.ts";
 import { layerId, featureServerUrl, mapServerUrl } from '@/views/zhpt/basicInfoManage/config/index.ts'
+import { layerId, featureServerUrl, mapServerUrl } from '@/views/zhpt/basicInfoManage/config/index.ts'
 
 export default {
   name: "sewagePlantMng",
@@ -219,74 +224,74 @@ export default {
           label: "污水厂名称",
           prop: "NAME",
           width: "180",
-          align: "center"
+          align: "center",
         },
         {
           label: "污水厂编号",
           prop: "EXP_NO",
           width: "180",
-          align: "center"
+          align: "center",
         },
         {
           label: "污水厂类型",
           prop: "WWTPTYPE",
           width: "180",
-          align: "center"
+          align: "center",
         },
         {
           label: "建设状态",
           prop: "BSTATE",
           width: "100",
-          align: "center"
+          align: "center",
         },
         {
           label: "投运时间",
           prop: "RDATE",
           width: "100",
-          align: "center"
+          align: "center",
         },
         {
           label: "污水设计处理能力(吨/天)",
           prop: "WSSJCLNL",
           width: "200",
-          align: "right"
+          align: "right",
         },
         {
           label: "所在雨水分区",
           prop: "SZYSFQ",
           width: "160",
-          align: "center"
+          align: "center",
         },
         {
           label: "所在污水分区",
           prop: "SZWSFQ",
           width: "160",
-          align: "center"
+          align: "center",
         },
         {
           label: "所属流域",
           prop: "BASIN",
           width: "120",
-          align: "center"
+          align: "center",
         },
         {
           label: "地址",
           prop: "ADDRESS",
           width: "",
-          align: "left"
+          align: "left",
         },
         {
           label: "修改人",
           prop: "U_USERNAME",
           width: "100",
-          align: "center"
+          align: "center",
         },
         {
           label: "修改时间",
           prop: "U_TIME",
           width: "100",
-          align: "center"
-        }
+          align: "center",
+        },
       ],
 
       allTableData: [],
@@ -314,29 +319,20 @@ export default {
         subareas: [], //所在排水分区
         workmanships: [], //处理工艺
         sewageDisposalTypes: [], //污水处理设施种类
-        sewageDisposalLevels: [] //污水处理级别
+        sewageDisposalLevels: [], //污水处理级别
       },
       dictTypes: [
-        66516,
-        66519,
-        66521,
-        66524,
-        66528,
-        66530,
-        66533,
-        66542,
-        66544,
-        66547
+        66516, 66519, 66521, 66524, 66528, 66530, 66533, 66542, 66544, 66547,
       ],
       isDel: true,
       //
-      selections: []
+      selections: [],
     };
   },
   computed: {
     tableheight() {
       return client().height - 64 - 43 - 40 - 55 + "px";
-    }
+    },
   },
   watch: {},
   created() {
@@ -346,7 +342,7 @@ export default {
   methods: {
     handleGetQRcode() {
       const sbids = this.selections.map(({ EXP_NO }) => EXP_NO).join(",");
-      getQRCodes({ sbid: sbids }).then(res => {
+      getQRCodes({ sbid: sbids }).then((res) => {
         let bstr = atob(res.result);
         let n = bstr.length;
         let u8arr = new Uint8Array(n);
@@ -354,7 +350,7 @@ export default {
           u8arr[n] = bstr.charCodeAt(n);
         }
         let blob = new Blob([u8arr], {
-          type: "application/pdf;chartset=UTF-8"
+          type: "application/pdf;chartset=UTF-8",
         });
         let url = URL.createObjectURL(blob);
         const a = document.createElement("a");
@@ -386,13 +382,15 @@ export default {
       });
 
       //所在排水分区
+      await sqlQuery("1=1", `${mapServerUrl}/${layerId.psfq}`).then(res => {
+        console.log('获取排水分区数据', res)
       await sqlQuery("1=1", `${mapServerUrl}/${layerId.psfq}`).then(res => {
         console.log('获取排水分区数据', res)
         if (res.features.length) {
-          res.features.forEach(fea => {
+          res.features.forEach((fea) => {
             this.dict.subareas.push({
               codeValue: fea.attributes.SUBAREAID,
-              notes: fea.attributes.FQMC
+              notes: fea.attributes.FQMC,
             });
           });
         }
@@ -406,7 +404,7 @@ export default {
         namespace: dataService.namespace,
         uri: dataService.uri,
         srsName: dataService.srsName,
-        fieldsConfig: []
+        fieldsConfig: [],
       };
       let queryTask = new tf.GeoQuery(option);
       //目标图层,查询条件、回调
@@ -420,11 +418,11 @@ export default {
       let param = null;
       if (dictName != "") {
         param = {
-          pCid: dictName
+          pCid: dictName,
         };
       }
-      return new Promise(resolve => {
-        getDicValueByKeys(param).then(res => {
+      return new Promise((resolve) => {
+        getDicValueByKeys(param).then((res) => {
           if (res.code == 1) {
             resolve(res.result);
           } else {
@@ -437,15 +435,16 @@ export default {
      * 初始化查询
      */
     async initQuery() {
+      await sqlQuery("1=1", `${mapServerUrl}/${layerId.wsc}`).then(res => {
       await sqlQuery("1=1", `${mapServerUrl}/${layerId.wsc}`).then(res => {
         console.log(res, "initquery");
         if (res.features.length) {
           this.total = res.features.length;
           let data = [];
-          res.features.forEach(fea => {
+          res.features.forEach((fea) => {
             const attri = {
               fea: fea,
-              ...fea.attributes
+              ...fea.attributes,
             };
             data.push(attri);
           });
@@ -459,19 +458,21 @@ export default {
     getLayerFields(features) {
       if (!features) return;
       let fields = {};
-      features.map(item => {
+      features.map((item) => {
         const properties = item.properties;
         if (Object.hasOwnProperty.call(fields, properties.v_lyname)) {
           fields[properties.v_lyname].fids.push({
             en: properties.v_fname,
             ch: properties.v_fcname,
-            show: 1
+            show: 1,
           });
         } else {
           fields[properties.v_lyname] = null;
           fields[properties.v_lyname] = {
             des: properties.v_lyname,
-            fids: [{ en: properties.v_fname, ch: properties.v_fcname, show: 1 }]
+            fids: [
+              { en: properties.v_fname, ch: properties.v_fcname, show: 1 },
+            ],
           };
         }
       });
@@ -489,16 +490,16 @@ export default {
 
       //关键字查询
       if (this.keywords != "") {
-        let name = `(NAME like '%${this.keywords}%' or ADDRESS like '%${
-          this.keywords
-        }%')`;
+        let name = `(NAME like '%${this.keywords}%' or ADDRESS like '%${this.keywords}%')`;
         queryText = queryText + " and " + name;
       }
       //目标图层,查询条件、回调
       
+      
       await sqlQuery(
         queryText,
         `${mapServerUrl}/${layerId.wsc}`
+        `${mapServerUrl}/${layerId.wsc}`
       ).then(res => {
         this.getTableData(res);
       });
@@ -533,10 +534,10 @@ export default {
         let fields = Object.assign({}, fea.attributes);
         if (Object.hasOwnProperty.call(fea.attributes, "SZWSFQ")) {
           let obj = this.dict.sysDrainages.find(
-            item => item.codeValue === fea.attributes.SZWSFQ
+            (item) => item.codeValue === fea.attributes.SZWSFQ
           );
           fields = Object.assign({}, fields, {
-            szwsfqName: obj ? obj.SZWSFQ : ""
+            szwsfqName: obj ? obj.SZWSFQ : "",
           });
         }
         if (Object.hasOwnProperty.call(fields, "RDATE")) {
@@ -557,7 +558,7 @@ export default {
         }
         Object.assign(fields, {
           fea: fea,
-          tfno: index
+          tfno: index,
         });
         this.allTableData.push(fields);
       });
@@ -576,7 +577,7 @@ export default {
         end = this.pagination.size;
       }
       this.tableData = this.allTableData.filter(
-        item => item.tfno >= begin && item.tfno < end
+        (item) => item.tfno >= begin && item.tfno < end
       );
     },
     /**
@@ -613,7 +614,7 @@ export default {
     deleteMultil() {
       let rows = this.$refs.dataTable.selection;
       if (rows.length < 1) return;
-      let names = rows.map(item => {
+      let names = rows.map((item) => {
         return item.NAME;
       });
       this.$confirm(
@@ -622,17 +623,18 @@ export default {
         {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
-          type: "warning"
+          type: "warning",
         }
       )
         .then(async () => {
-          const info = rows.map(item => {
+          const info = rows.map((item) => {
             return item.fea;
           });
           await deleteFeature(
+            `${featureServerUrl}/${layerId.wsc}`,
             `${featureServerUrl}/${layerId.wsc}`,
             info
-          ).then(res => {
+          ).then((res) => {
             if (res.deleteFeatureResults.length) {
               this.updateTable();
               return this.$message.success("操作成功!");
@@ -642,7 +644,7 @@ export default {
         .catch(() => {
           this.$message({
             type: "info",
-            message: "已取消删除"
+            message: "已取消删除",
           });
         });
     },
@@ -655,14 +657,15 @@ export default {
         {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
-          type: "warning"
+          type: "warning",
         }
       )
         .then(async () => {
           await deleteFeature(
+            `${featureServerUrl}/${layerId.wsc}`,
             `${featureServerUrl}/${layerId.wsc}`,
             [row.fea]
-          ).then(res => {
+          ).then((res) => {
             if (res.deleteFeatureResults.length) {
               this.updateTable();
               return this.$message.success("操作成功!");
@@ -672,7 +675,7 @@ export default {
         .catch(() => {
           this.$message({
             type: "info",
-            message: "已取消删除"
+            message: "已取消删除",
           });
         });
     },
@@ -691,8 +694,8 @@ export default {
       } else {
         this.loading = false;
       }
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 447 - 195
src/views/zhpt/index.vue

@@ -1,21 +1,96 @@
 <template>
-  <div id="viewDiv" v-loading="loading" :element-loading-text="loadText" element-loading-spinner="el-icon-loading" element-loading-background="rgba(255, 255, 255, 0.8)">
-    <tf-dialog :show.sync="panels.tfDialog.Show" :hide.sync="panels.tfDialog.Hide" :set-size.sync="panels.tfDialog.setSize" />
+  <div
+    id="viewDiv"
+    v-loading="loading"
+    :element-loading-text="loadText"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(255, 255, 255, 0.8)"
+  >
+    <tf-dialog
+      :show.sync="panels.tfDialog.Show"
+      :hide.sync="panels.tfDialog.Hide"
+      :set-size.sync="panels.tfDialog.setSize"
+    />
     <el-container style="height: 100%; width: 100%">
-      <el-container :style="{ height: 'calc(100% - ' + footer_height + ')', width: '100%' }">
+      <el-container
+        :style="{ height: 'calc(100% - ' + footer_height + ')', width: '100%' }"
+      >
         <el-main>
           <!-- <float-panels :data='FloatPanels' @handelClose='handelClose'></float-panels> -->
-          <div id="antherPanel" ref="antP" style="display: none; width: calc(50% - 2px); height: 100%; float: left;">
+          <div
+            id="antherPanel"
+            ref="antP"
+            style="
+              display: none;
+              width: calc(50% - 2px);
+              height: 100%;
+              float: left;
+            "
+          >
             <!-- <div class="qufen" style="left:calc(50% - 175px)"><span>副视图</span><span>主视图</span></div> -->
           </div>
-          <div style="display: none; width: 3px; height: 100%; background:#ccc; z-index:2; float: left; position: relative;" />
+          <div
+            style="
+              display: none;
+              width: 3px;
+              height: 100%;
+              background: #ccc;
+              z-index: 2;
+              float: left;
+              position: relative;
+            "
+          />
           <div id="mapView" class="mapView">
-            <div id="any" ref="any" style="position: absolute; left: calc(50% - 250px); top: calc(50% - 150px);display:none;width:600px;border">
-              <div id="any_title" class="label" style="width:100%;height:40px;background:rgb(45,116,231); border-radius: 5px 5px 0px 0px;">
-                <div class="label" style="float:left; color:#fff; font-size: 18px; padding-left: 20px; padding-top: 10px;">分析结果</div>
-                <span class="label" style="float:right; cursor: pointer;color:#fff; margin-right: 10px; margin-top: 10px;" @click="closeAny"><i class="el-icon-close" /></span>
+            <div
+              id="any"
+              ref="any"
+              style="position: absolute; left: calc(50% - 250px); top: calc(50% - 150px);display:none;width:600px;border"
+            >
+              <div
+                id="any_title"
+                class="label"
+                style="
+                  width: 100%;
+                  height: 40px;
+                  background: rgb(45, 116, 231);
+                  border-radius: 5px 5px 0px 0px;
+                "
+              >
+                <div
+                  class="label"
+                  style="
+                    float: left;
+                    color: #fff;
+                    font-size: 18px;
+                    padding-left: 20px;
+                    padding-top: 10px;
+                  "
+                >
+                  分析结果
+                </div>
+                <span
+                  class="label"
+                  style="
+                    float: right;
+                    cursor: pointer;
+                    color: #fff;
+                    margin-right: 10px;
+                    margin-top: 10px;
+                  "
+                  @click="closeAny"
+                  ><i class="el-icon-close"
+                /></span>
               </div>
-              <div id="any_contant" style="width:100%;height:400px;background:#fff;border:1px solid rgb(218,218,218); border-radius: 0px 0px 5px 5px;" />
+              <div
+                id="any_contant"
+                style="
+                  width: 100%;
+                  height: 400px;
+                  background: #fff;
+                  border: 1px solid rgb(218, 218, 218);
+                  border-radius: 0px 0px 5px 5px;
+                "
+              />
             </div>
             <!-- 视图工具 -->
             <WidgetGroup :map-view="view" :that="this" />
@@ -28,7 +103,13 @@
           </div>
           <div v-show="labelShow" id="mapLabel">
             <span id="mapView_title">地图图例</span>
-            <span id="mapView_close" ref="legend_close" title="收缩" @click="legendClick">▼</span>
+            <span
+              id="mapView_close"
+              ref="legend_close"
+              title="收缩"
+              @click="legendClick"
+              >▼</span
+            >
             <div id="mapView_legend" ref="legend" style="height: 350px" />
           </div>
           <!-- 鼠标位置 -->
@@ -39,10 +120,18 @@
           <div id="map-index-floatPanels" ref="floatPanels" />
         </el-main>
         <el-aside :style="{ width: side_width, height: '100%' }">
-          <side-panels :panels="Panels" :data="panels" :side-width.sync="side_width" :panel-visible.sync="sidepanel_visible" @handelClose="handelClose" />
+          <side-panels
+            :panels="Panels"
+            :data="panels"
+            :side-width.sync="side_width"
+            :panel-visible.sync="sidepanel_visible"
+            @handelClose="handelClose"
+          />
         </el-aside>
       </el-container>
-      <el-footer :style="{ height: footer_height, width: '100%', padding: '0px' }">
+      <el-footer
+        :style="{ height: footer_height, width: '100%', padding: '0px' }"
+      >
         <half-panels
           :panels="HalfPanels"
           :data="panels"
@@ -67,24 +156,39 @@
   </div>
 </template>
 <script>
-import Comps from '@/layout/components/loadComps'
-import { HalfPanels, FullPanels, FloatPanels, SidePanels } from '@/layout/components/index'
-import { esriConfig, appconfig } from 'staticPub/config'
-import { loadModules } from 'esri-loader'
-import { loadCss } from '@/utils/loadResources'
-import request from '@/utils/request'
-import tfDialog from './common/Dialog'
-import OverviewMap from './tongyonggongju/overviewMap/widget.vue'
-import Scalebar from './tongyonggongju/scaleBar/widget.vue'
-import MouseLocation from './tongyonggongju/mouseLocation/widget.vue'
-import WidgetGroup from './tongyonggongju/widgetGroup/widget.vue'
-import MeasureTool from './tongyonggongju/measureTool/widget.vue'
-import QueryTool from './tongyonggongju/queryTool/widget.vue'
-import SimpleQueryTool from './tongyonggongju/simpleQueryTool/widget.vue'
+import Comps from "@/layout/components/loadComps";
+import {
+  HalfPanels,
+  FullPanels,
+  FloatPanels,
+  SidePanels,
+} from "@/layout/components/index";
+import { esriConfig, appconfig } from "staticPub/config";
+import { loadModules } from "esri-loader";
+import { loadCss } from "@/utils/loadResources";
+import request from "@/utils/request";
+import tfDialog from "./common/Dialog";
+import OverviewMap from "./tongyonggongju/overviewMap/widget.vue";
+import Scalebar from "./tongyonggongju/scaleBar/widget.vue";
+import MouseLocation from "./tongyonggongju/mouseLocation/widget.vue";
+import WidgetGroup from "./tongyonggongju/widgetGroup/widget.vue";
+import MeasureTool from "./tongyonggongju/measureTool/widget.vue";
+import QueryTool from "./tongyonggongju/queryTool/widget.vue";
+import SimpleQueryTool from "./tongyonggongju/simpleQueryTool/widget.vue";
 export default {
   components: {
-    HalfPanels, FullPanels, FloatPanels, SidePanels, tfDialog, Scalebar, OverviewMap,
-    MouseLocation, WidgetGroup, MeasureTool, QueryTool, SimpleQueryTool
+    HalfPanels,
+    FullPanels,
+    FloatPanels,
+    SidePanels,
+    tfDialog,
+    Scalebar,
+    OverviewMap,
+    MouseLocation,
+    WidgetGroup,
+    MeasureTool,
+    QueryTool,
+    SimpleQueryTool,
   },
   props: { params: Object },
   data() {
@@ -92,117 +196,226 @@ export default {
       view: null,
       Comps,
       show: true,
-      themSrc: '',
+      themSrc: "",
       labelShow: false,
-      side_width: '0%',
-      footer_height: '0%',
+      side_width: "0%",
+      footer_height: "0%",
       sidepanel_visible: false,
       floatpanel_visible: false,
       halfpanel_visible: false,
       fullpanel_visible: false,
-      halfpanel_defaultHeight: '400px',
+      halfpanel_defaultHeight: "400px",
       legendHide: true,
       loading: true,
-      loadText: '',
+      loadText: "",
       panels: {
         mapView: this.view,
         that: this,
         // 当前激活的模块
         activeModel: null,
-        tfDialog: { Show: null, Hide: null, setSize: null }
-      }
-    }
+        tfDialog: { Show: null, Hide: null, setSize: null },
+      },
+    };
   },
   computed: {
-    Panels: function() { return this.$store.state.map.panels },
-    FullPanels: function() { return this.$store.state.map.fullPanels },
-    HalfPanels: function() { return this.$store.state.map.halfPanels },
-    FloatPanels: function() { return this.$store.state.map.floatPanels },
-    jumpText: function() { return this.$store.state.jumpText }
+    Panels: function () {
+      return this.$store.state.map.panels;
+    },
+    FullPanels: function () {
+      return this.$store.state.map.fullPanels;
+    },
+    HalfPanels: function () {
+      return this.$store.state.map.halfPanels;
+    },
+    FloatPanels: function () {
+      return this.$store.state.map.floatPanels;
+    },
+    jumpText: function () {
+      return this.$store.state.jumpText;
+    },
   },
   watch: {
-    FullPanels: function() { this.show = true },
+    FullPanels: function () {
+      this.show = true;
+    },
     loading(value) {
       if (value == false) {
-        var str = this.$store.state.jumpText
-        if (!str) return
-        str = str.split(',')
-        this.$store.dispatch('map/changeMethod', { pathId: str[0], widgetid: str[1], label: str[2] })
+        var str = this.$store.state.jumpText;
+        if (!str) return;
+        str = str.split(",");
+        this.$store.dispatch("map/changeMethod", {
+          pathId: str[0],
+          widgetid: str[1],
+          label: str[2],
+        });
       }
     },
     jumpText(n, o) {
-      if (!n) return
-      n = n.split(',')
-      this.$store.dispatch('map/changeMethod', { pathId: n[0], widgetid: n[1], label: n[2] })
-    }
+      if (!n) return;
+      n = n.split(",");
+      this.$store.dispatch("map/changeMethod", {
+        pathId: n[0],
+        widgetid: n[1],
+        label: n[2],
+      });
+    },
   },
-  created: function() {
-    console.log('=====', this.Comps)
+  created: function () {
+    console.log("=====", this.Comps);
   },
-  mounted: function() {
-    loadCss(esriConfig.baseCssUrl) // 本地css资源
-    this.initConfig() // 加载配置 ==> 加载地图
+  mounted: function () {
+    loadCss(esriConfig.baseCssUrl); // 本地css资源
+    this.initConfig(); // 加载配置 ==> 加载地图
   },
   methods: {
     handelClose() {
-      this.show = false
+      this.show = false;
     },
     initMap() {
-      var config = esriConfig
-      var aconfig = appconfig
+      var config = esriConfig;
+      var aconfig = appconfig;
       loadModules(
         [
-          'esri/Map', 'esri/views/MapView',
-          'esri/layers/WebTileLayer', 'esri/Basemap',
-          'esri/layers/TileLayer', 'esri/layers/MapImageLayer',
-          'esri/layers/support/LOD', 'esri/config', 'esri/identity/IdentityManager'
+          "esri/Map",
+          "esri/views/MapView",
+          "esri/layers/WebTileLayer",
+          "esri/Basemap",
+          "esri/layers/TileLayer",
+          "esri/layers/MapImageLayer",
+          "esri/layers/support/LOD",
+          "esri/config",
+          "esri/identity/IdentityManager",
         ],
         { url: esriConfig.baseUrl }
       ).then(
         ([
-          Map, MapView, WebTileLayer,
-          Basemap, TileLayer, MapImageLayer, Lod, mapConfig, IdentityManager
+          Map,
+          MapView,
+          WebTileLayer,
+          Basemap,
+          TileLayer,
+          MapImageLayer,
+          Lod,
+          mapConfig,
+          IdentityManager,
         ]) => {
-          mapConfig.fontsUrl = esriConfig.font_url
+          mapConfig.fontsUrl = esriConfig.font_url;
 
-          var layerType = { 'webTiled': WebTileLayer, 'dynamic': MapImageLayer, 'tiled': TileLayer }
-          var layersConfig
-          var key = aconfig.isonline ? appconfig.tianMapKey : ''
-          var baselayers
+          var layerType = {
+            webTiled: WebTileLayer,
+            dynamic: MapImageLayer,
+            tiled: TileLayer,
+          };
+          var layersConfig;
+          var key = aconfig.isonline ? appconfig.tianMapKey : "";
+          var baselayers;
           // 判断在线/离线 设置天地图底图
-          var tileInfo = aconfig.isonline ? (visible) => {
-            return {
-              visible: visible,
-              subDomains: '01234567'.split('').map(e => 't' + e),
-              tileInfo: {
-                rows: 256, cols: 256, origin: { x: -180, y: 90 }, spatialReference: { wkid: 4490 },
-                lods: Array.from({ length: 19 }, (e, i) => i).map((e, i) => {
-                  return { level: i + 2, levelValue: i + 2, resolution: 0.3515625 / Math.pow(2, i), scale: 147748796.52937502 / Math.pow(2, i) }
-                })
-              }, spatialReference: 4490, fullExtent: { xmin: -180, ymin: -90, xmax: 180, ymax: 90, spatialReference: 4490 }
-            }
-          } : (visible) => { return { visible: visible } }
-          layersConfig = aconfig.isonline ? [
-            [aconfig.gisResource.tian_online_vector.config[0].url, aconfig.gisResource.tian_online_vector.type],
-            [aconfig.gisResource.tian_online_vector_label.config[0].url, aconfig.gisResource.tian_online_vector_label.type],
-            [aconfig.gisResource.tian_online_raster.config[0].url, aconfig.gisResource.tian_online_raster.type],
-            [aconfig.gisResource.tian_online_raster_label.config[0].url, aconfig.gisResource.tian_online_raster_label.type],
-            [aconfig.gisResource.business_map.config[0].url + '?token=' + this.$store.state.user.arcgistoken, aconfig.gisResource.business_map.type]
-          ] : [
-            [aconfig.gisResource.tian_offline_vector.config[0].url, aconfig.gisResource.tian_offline_vector.type],
-            [aconfig.gisResource.tian_offline_vector_label.config[0].url, aconfig.gisResource.tian_offline_vector_label.type],
-            [aconfig.gisResource.tian_offline_raster.config[0].url, aconfig.gisResource.tian_offline_raster.type],
-            [aconfig.gisResource.tian_offline_raster_label.config[0].url, aconfig.gisResource.tian_offline_raster_label.type],
-            [aconfig.gisResource.business_map.config[0].url + '?token=' + this.$store.state.user.arcgistoken, aconfig.gisResource.business_map.type]
-          ]
+          var tileInfo = aconfig.isonline
+            ? (visible) => {
+                return {
+                  visible: visible,
+                  subDomains: "01234567".split("").map((e) => "t" + e),
+                  tileInfo: {
+                    rows: 256,
+                    cols: 256,
+                    origin: { x: -180, y: 90 },
+                    spatialReference: { wkid: 4490 },
+                    lods: Array.from({ length: 19 }, (e, i) => i).map(
+                      (e, i) => {
+                        return {
+                          level: i + 2,
+                          levelValue: i + 2,
+                          resolution: 0.3515625 / Math.pow(2, i),
+                          scale: 147748796.52937502 / Math.pow(2, i),
+                        };
+                      }
+                    ),
+                  },
+                  spatialReference: 4490,
+                  fullExtent: {
+                    xmin: -180,
+                    ymin: -90,
+                    xmax: 180,
+                    ymax: 90,
+                    spatialReference: 4490,
+                  },
+                };
+              }
+            : (visible) => {
+                return { visible: visible };
+              };
+          layersConfig = aconfig.isonline
+            ? [
+                [
+                  aconfig.gisResource.tian_online_vector.config[0].url,
+                  aconfig.gisResource.tian_online_vector.type,
+                ],
+                [
+                  aconfig.gisResource.tian_online_vector_label.config[0].url,
+                  aconfig.gisResource.tian_online_vector_label.type,
+                ],
+                [
+                  aconfig.gisResource.tian_online_raster.config[0].url,
+                  aconfig.gisResource.tian_online_raster.type,
+                ],
+                [
+                  aconfig.gisResource.tian_online_raster_label.config[0].url,
+                  aconfig.gisResource.tian_online_raster_label.type,
+                ],
+                [
+                  aconfig.gisResource.business_map.config[0].url +
+                    "?token=" +
+                    this.$store.state.user.arcgistoken,
+                  aconfig.gisResource.business_map.type,
+                ],
+              ]
+            : [
+                [
+                  aconfig.gisResource.tian_offline_vector.config[0].url,
+                  aconfig.gisResource.tian_offline_vector.type,
+                ],
+                [
+                  aconfig.gisResource.tian_offline_vector_label.config[0].url,
+                  aconfig.gisResource.tian_offline_vector_label.type,
+                ],
+                [
+                  aconfig.gisResource.tian_offline_raster.config[0].url,
+                  aconfig.gisResource.tian_offline_raster.type,
+                ],
+                [
+                  aconfig.gisResource.tian_offline_raster_label.config[0].url,
+                  aconfig.gisResource.tian_offline_raster_label.type,
+                ],
+                [
+                  aconfig.gisResource.business_map.config[0].url +
+                    "?token=" +
+                    this.$store.state.user.arcgistoken,
+                  aconfig.gisResource.business_map.type,
+                ],
+              ];
 
           baselayers = [
-            new layerType[layersConfig[0][1]](layersConfig[0][0] + key, tileInfo(true)),
-            new layerType[layersConfig[1][1]](layersConfig[1][0] + key, tileInfo(true)),
-            new layerType[layersConfig[2][1]](layersConfig[2][0] + key, tileInfo(false)),
-            new layerType[layersConfig[3][1]](layersConfig[3][0] + key, tileInfo(false)),
-            new layerType[layersConfig[4][1]]({ url: layersConfig[4][0], token: this.$store.state.user.arcgistoken })
-          ]
+            new layerType[layersConfig[0][1]](
+              layersConfig[0][0] + key,
+              tileInfo(true)
+            ),
+            new layerType[layersConfig[1][1]](
+              layersConfig[1][0] + key,
+              tileInfo(true)
+            ),
+            new layerType[layersConfig[2][1]](
+              layersConfig[2][0] + key,
+              tileInfo(false)
+            ),
+            new layerType[layersConfig[3][1]](
+              layersConfig[3][0] + key,
+              tileInfo(false)
+            ),
+            new layerType[layersConfig[4][1]]({
+              url: layersConfig[4][0],
+              token: this.$store.state.user.arcgistoken,
+            }),
+          ];
 
           // baselayers.forEach(item => {
           //   console.log(item)
@@ -220,14 +433,15 @@ export default {
           // 底图
           var basemap = new Basemap({
             baseLayers: baselayers,
-            title: 'basemap',
-            id: 'basemap'
-          })
+            title: "basemap",
+            id: "basemap",
+          });
 
           IdentityManager.registerToken({
-            server: 'http://36.138.232.112:6080/arcgis/rest/services/DCSW/PIPE_DCSW',
-            token: this.$store.state.user.arcgistoken
-          })
+            server:
+              "http://36.138.232.112:6080/arcgis/rest/services/PIPE_DCSW_CS",
+            token: this.$store.state.user.arcgistoken,
+          });
 
           // mapConfig.request.interceptors.push({
           //   urls: basemap.baseLayers.items[4].url,
@@ -242,31 +456,39 @@ export default {
           // })
           // 地图视角设置缩放步进级别
           basemap.baseLayers.items[4].load().then((e) => {
-            mapview.constraints.lods = [125000, 64000, 32000, 16000, 8000, 4000, 2000, 1000, 500, 100].map((s, i) => { return new Lod({ level: i, scale: s }) })
-          })
-          const map = new Map({ basemap: basemap })
-          const mapview = window.TF_mapView = new MapView({
-            container: 'mapView',
+            mapview.constraints.lods = [
+              125000, 64000, 32000, 16000, 8000, 4000, 2000, 1000, 500, 100,
+            ].map((s, i) => {
+              return new Lod({ level: i, scale: s });
+            });
+          });
+          const map = new Map({ basemap: basemap });
+          const mapview = (window.TF_mapView = new MapView({
+            container: "mapView",
             map: map,
             spatialReference: { wkid: 4490 },
             popup: {
-              alignment: 'top-center',
+              alignment: "top-center",
               actions: [],
               dockEnabled: true,
-              dockOptions: { buttonEnabled: false }
-            }
+              dockOptions: { buttonEnabled: false },
+            },
             // authentication: {
             //   token: this.$store.state.user.arcgistoken
             // }
-          })
+          }));
 
-          mapview.TF_floatPanel = this.$refs.floatPanels
-          mapview.TF_layerInfo = tileInfo
+          mapview.TF_floatPanel = this.$refs.floatPanels;
+          mapview.TF_layerInfo = tileInfo;
           // 初始视角
           this.$nextTick(() => {
-            mapview.center = { x: aconfig.initCenter.x, y: aconfig.initCenter.y, spatialReference: mapview.spatialReference }
-            mapview.zoom = aconfig.initZoom
-          })
+            mapview.center = {
+              x: aconfig.initCenter.x,
+              y: aconfig.initCenter.y,
+              spatialReference: mapview.spatialReference,
+            };
+            mapview.zoom = aconfig.initZoom;
+          });
           // 图层全部加载完成设置
           // mapview.on('layerview-create', (event) => {
           //   mapview.center = { x: aconfig.initCenter.x, y: aconfig.initCenter.y, spatialReference: mapview.spatialReference }
@@ -274,84 +496,107 @@ export default {
           //   // mapview.map.basemap.baseLayers.items[5].sublayers.items[0].visible = false // 默认隐藏路网数据
           //   // mapview.map.basemap.baseLayers.items[5].sublayers.items[0].sublayers.items[0].visible = false
           // })
-          mapview.ui.components = []
-          this.panels.mapView = this.view = mapview
+          mapview.ui.components = [];
+          this.panels.mapView = this.view = mapview;
           if (this.params) {
             // this.$store.dispatch('map/changeMethod',
             // { pathId: 'queryResult3', widgetid: 'HalfPanel', label: '查询结果', param: {
             //   oids: row.featureIds,
             //   layer: id
             // } })
-            var str = 1
+            var str = 1;
           }
 
           // 请求图例
           $.ajax({
-            url: aconfig.gisResource.business_map.config[0].url + '/legend?f=pjson&token=' + this.$store.state.user.arcgistoken,
-            type: 'GET',
+            url:
+              aconfig.gisResource.business_map.config[0].url +
+              "/legend?f=pjson&token=" +
+              this.$store.state.user.arcgistoken,
+            type: "GET",
             success: (data) => {
-              data = JSON.parse(data)
+              data = JSON.parse(data);
               if (data.error) {
-                return this.$message.error('图例加载失败:' + data.error.message)
+                return this.$message.error(
+                  "图例加载失败:" + data.error.message
+                );
               }
-              data = data.layers
-              var inStr = ''
+              data = data.layers;
+              var inStr = "";
               for (let i = 0, ii = data.length; i < ii; i++) {
-                var label = data[i].layerName
-                for (let j = 0, jl = data[i].legend, jj = jl.length; j < jj; j++) {
-                  inStr += '<div><img src="data:image/png;base64,' + jl[j].imageData + '" alt /><span>' +
-                    (jl[j].label == '' ? label : jl[j].label) + '</span></div>'
+                var label = data[i].layerName;
+                for (
+                  let j = 0, jl = data[i].legend, jj = jl.length;
+                  j < jj;
+                  j++
+                ) {
+                  inStr +=
+                    '<div><img src="data:image/png;base64,' +
+                    jl[j].imageData +
+                    '" alt /><span>' +
+                    (jl[j].label == "" ? label : jl[j].label) +
+                    "</span></div>";
                 }
               }
-              this.$refs.legend.innerHTML = inStr
+              this.$refs.legend.innerHTML = inStr;
             },
-            error: (error) => { console.log(error) }
-          })
-        }, (reason) => { console.log(reason) }
-      )
+            error: (error) => {
+              console.log(error);
+            },
+          });
+        },
+        (reason) => {
+          console.log(reason);
+        }
+      );
     },
-    legendClick: function() {
-      this.legendHide = !this.legendHide
-      var whichP = [['收缩', 350, '▼'], ['展开', 0, '▲']][this.legendHide ? 0 : 1]
-      this.$refs.legend_close.title = whichP[0]
-      this.$refs.legend.style.height = whichP[1] + 'px'
-      this.$refs.legend_close.innerHTML = whichP[2]
+    legendClick: function () {
+      this.legendHide = !this.legendHide;
+      var whichP = [
+        ["收缩", 350, "▼"],
+        ["展开", 0, "▲"],
+      ][this.legendHide ? 0 : 1];
+      this.$refs.legend_close.title = whichP[0];
+      this.$refs.legend.style.height = whichP[1] + "px";
+      this.$refs.legend_close.innerHTML = whichP[2];
     },
-    closeAny: function() {
-      this.$refs.any.style.display = 'none'
+    closeAny: function () {
+      this.$refs.any.style.display = "none";
     },
     initConfig() {
-      var index = appconfig.gisResource
+      var index = appconfig.gisResource;
       var nextDo = () => {
-        this.loadText = '地图加载中'
-        this.$nextTick(this.initMap)
-      }
-      console.log('是否获取后台配置服务:' + appconfig.isloadServer)
+        this.loadText = "地图加载中";
+        this.$nextTick(this.initMap);
+      };
+      console.log("是否获取后台配置服务:" + appconfig.isloadServer);
       if (appconfig.isloadServer) {
-        this.loadText = '服务加载中'
-        request({ url: '/base/sourcedic/getTreeService', method: 'get' }).then(res => {
-          if (res.code == 1) {
-            res = res.result
-            for (var i = 0, ii = res.length; i < ii; i++) {
-              var dr = res[i]
-              if (index.hasOwnProperty(dr.code)) {
-                var odr = index[dr.code]
-                odr.type = dr.type
-                odr.groupname = dr.name
-                if (dr.child) {
-                  odr.config = dr.child.map(e => {
-                    return { 'name': e.name, 'url': e.cval }
-                  })
+        this.loadText = "服务加载中";
+        request({ url: "/base/sourcedic/getTreeService", method: "get" }).then(
+          (res) => {
+            if (res.code == 1) {
+              res = res.result;
+              for (var i = 0, ii = res.length; i < ii; i++) {
+                var dr = res[i];
+                if (index.hasOwnProperty(dr.code)) {
+                  var odr = index[dr.code];
+                  odr.type = dr.type;
+                  odr.groupname = dr.name;
+                  if (dr.child) {
+                    odr.config = dr.child.map((e) => {
+                      return { name: e.name, url: e.cval };
+                    });
+                  }
                 }
               }
-            }
-            nextDo()
-          } else this.$message('服务加载失败 启用默认服务配置')
-        })
-      } else nextDo()
-    }
-  }
-}
+              nextDo();
+            } else this.$message("服务加载失败 启用默认服务配置");
+          }
+        );
+      } else nextDo();
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
 #viewDiv {
@@ -387,13 +632,15 @@ export default {
     margin-top: 4px;
     overflow: hidden hidden;
     transition: 0.4s;
-    >>> div{
-      padding:2px;
-      img{
-        width:18px;height:18px
+    >>> div {
+      padding: 2px;
+      img {
+        width: 18px;
+        height: 18px;
       }
-      span{
-        padding-left: 3px;font-size:12px
+      span {
+        padding-left: 3px;
+        font-size: 12px;
       }
     }
   }
@@ -412,13 +659,13 @@ export default {
     user-select: none;
   }
 }
-.qufen{
+.qufen {
   position: absolute;
   top: 0px;
   background: chartreuse;
   padding: 5px;
 }
-#antherPanel::after{
+#antherPanel::after {
   content: "副视图  主视图";
   border-radius: 0px 0px 5px 5px;
   border: 1px solid #2d74e7;
@@ -486,11 +733,11 @@ export default {
         color: #373737;
         flex: 1;
         &::after {
-          content: ':';
+          content: ":";
         }
       }
       .scadaLayer-float-value {
-        color: #2D74E7;
+        color: #2d74e7;
         font-weight: bold;
         margin-left: 8px;
         animation: mymove 0.8s;
@@ -499,24 +746,24 @@ export default {
       .scadaLayer-float-unit {
       }
       .scadaLayer-float-arrow2::after {
-        content: '↑';
-        color: #F56C6C;
+        content: "↑";
+        color: #f56c6c;
         animation: mymove 0.8s;
       }
       .scadaLayer-float-arrow0::after {
-        content: '↓';
-        color: #67C23A;
+        content: "↓";
+        color: #67c23a;
         animation: mymove 0.8s;
       }
       .scadaLayer-float-arrow1::after {
-        content: '-';
+        content: "-";
         color: #909399;
         animation: mymove 0.8s;
       }
     }
   }
   &::after {
-    content: '';
+    content: "";
     width: 0;
     height: 0;
     border-top: 9px solid #fff;
@@ -532,10 +779,15 @@ export default {
       max-height: 500px;
     }
   }
-  @keyframes mymove
-  {
-    from { background: rgb(158,54,153); color: #fff; }
-    to { background: #fff0; color: #2D74E7; }
+  @keyframes mymove {
+    from {
+      background: rgb(158, 54, 153);
+      color: #fff;
+    }
+    to {
+      background: #fff0;
+      color: #2d74e7;
+    }
   }
 }
 #map-index-floatPanels >>> .eventPanel {
@@ -552,7 +804,7 @@ export default {
   font-size: 14px;
 
   &::after {
-    content: '';
+    content: "";
     width: 0;
     height: 0;
     border-top: 9px solid #fff;

BIN
src/views/zhpt/scadaDayManYear/images/statistic.png


+ 114 - 0
src/views/zhpt/scadaDayManYear/reportTable.vue

@@ -0,0 +1,114 @@
+<template>
+  <div class="reportTable" style="width:100%;height:100%;overflow-y: auto;">
+    <div v-show="!(tableList.data.length>0)" slot="empty" style="width:100%;height:100%;text-align: center; padding-top: 10%;">
+      <img src="@/assets/icon/null.png" alt="">
+      <p class="empty-p">暂无数据</p>
+    </div>
+    <template v-if="tableList.data.length>0">
+      <table :id="tableList.tableId" class="tableReport" border="1" cellspacing="0">
+        <tr style="width: 100%; ">
+          <th colspan="4">{{ tableList.title }}</th>
+        </tr>
+        <template v-for="(item,index) in tableList.data">
+          <tr>
+            <td width="15%">员工姓名</td>
+            <td class="staffName" width="15%" align="left">{{ item.userName }}</td>
+            <td width="15%">巡查日期</td>
+            <td class="date" width="20%" colspan="1" align="left">{{ item.inspectionDate.split(' ')[0] }}</td>
+          </tr>
+          <tr>
+            <td width="15%">巡检里程(m)</td>
+            <td class="mileage" width="15%" align="left">{{ item.planTotalDistance }}</td>
+            <td width="20%">上报隐患(个)</td>
+            <td class="averageSpeed" width="20%" align="left">{{ item.findTroubleNum }}</td>
+          </tr>
+          <tr>
+            <td width="15%">有效里程(m)</td>
+            <td class="mileage" width="15%" align="left">{{ item.vaildTotalDistance }}</td>
+            <td width="20%">上报工地(个)</td>
+            <td class="averageSpeed" width="20%" align="left">{{ item.buildingsitefinded }}</td>
+          </tr>
+          <tr>
+            <th colspan="4">工作完成情况</th>
+          </tr>
+          <tr>
+            <td align="center">任务类型</td>
+            <td colspan="2" style="text-align:center;" align="center">任务执行情况</td>
+            <td align="center" width="20%">任务周期</td>
+          </tr>
+
+          <template v-if="item.workCompletionVoList&&item.workCompletionVoList.length>0">
+            <template v-for="item2 of item.workCompletionVoList">
+              <tr>
+                <td class="reportTrouble" align="center">{{ item2.planType }}</td>
+                <td colspan="2" class="troubleCheck" align="center">{{ item2.node }}</td>
+                <td class="siteCheck" align="center" width="20%">{{ item2.period }}</td>
+              </tr>
+            </template>
+          </template>
+          <template v-else>
+            <tr>
+              <td colspan="4" class="troubleCheck" align="center">暂无巡检信息</td>
+            </tr>
+          </template>
+          <template v-if="index<(tableList.data.length-1)">
+            <tr style="width: 100%;">
+              <th colspan="4" />
+            </tr>
+          </template>
+        </template>
+      </table>
+    </template>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'ReportTable',
+  props: { dataList: Object },
+  data() {
+    return {
+      tableList: {
+        title: '2021.6.11日报',
+        data: []
+      }
+    }
+  },
+  computed: { watchDataList() { return this.dataList } },
+  watch: {
+    'watchDataList': function() {
+      this.tableList = this.dataList
+    }
+  },
+  mounted: function() {
+    this.tableList = this.dataList
+  },
+  created() {},
+  destroyed() {},
+  methods: { }
+}
+</script>
+<style scoped>
+.tableReport {
+	position: relative;
+	margin-top: 10px;
+	margin-bottom: 10px;
+	border-color: rgba(222, 226, 230, 0.5);
+}
+th {
+    font-size: 14px;
+    font-weight: 600;
+    color: #333333;
+    width: 1680px;
+    height: 50px;
+}
+td {
+	height: 30px;
+	color: #333333;
+	font-size: 14px;
+	text-indent: 20px;
+}
+tr:nth-child(2n+1) {
+	background-color: #F7F7F7;
+}
+</style>

+ 877 - 0
src/views/zhpt/scadaDayManYear/widget.vue

@@ -0,0 +1,877 @@
+<template>
+  <div id="scadaDayManYear" class="scadaDayManYear">
+    <div class="menus">
+      <span class="title2">类型:</span>
+      <el-select
+        v-model="deviceType"
+        clearable
+        filterable
+        style="display: inline-block; margin-left: 5px; width: 140px"
+        size="small"
+        placeholder="请选择类型"
+        @clear="selectClear"
+        @change="selectChange"
+      >
+        <el-option key="1" label="日" value="0" />
+        <el-option key="2" label="月" value="1" />
+        <el-option key="3" label="年" value="2" />
+      </el-select>
+      <span v-if="!allSwitch">
+        &nbsp;&nbsp;
+      <span class="title2">设备名称:</span>
+      <el-select
+        ref="site"
+        v-model="deviceId"
+        style="display: inline-block; margin-right: 5px; width: 450px"
+        size="small"
+        placeholder="请选择"
+        clearable
+        multiple
+        filterable
+        collapse-tags
+        @change="queryData"
+      >
+        <el-option v-for="item in isSeletcSite" :key="item.id" :label="item.name" :value="item.id" />
+      </el-select>
+      </span>
+      &nbsp;&nbsp;
+      <span class="title2" style="margin-left: 8px">日期</span>
+      <el-date-picker v-model="monthTime" size="small" :type="rangeType" placeholder="请选择日期" />
+      &nbsp;&nbsp;
+      <span class="title2">查看供水总量:</span>
+      <el-switch v-model="allSwitch" @change="getAllData"></el-switch>
+      <div style="float: right;margin-right: 30px">
+        <el-button size="small" type="primary" @click="queryData">查询</el-button>
+      <!-- <el-button size="small" type="primary" @click="getExport">导出</el-button> -->
+      <export-btn table-id="waterReportTable" file="水量统计" />
+      </div>
+    </div>
+    <div class="statistics" style="height: calc(100% - 40px)">
+      <table-item
+        id="waterReportTable"
+        ref="comTable"
+        :table-data="dataList"
+        :column="column"
+        :for-id="true"
+        :pagination="true"
+        :pagesize="pageInfo.size"
+        :currentpage="pageInfo.current"
+        :border="true"
+        :multiple="false"
+        :total="pageInfo.tableTotal"
+        :fixed="true"
+        :isdelete="false"
+        :is-select="false"
+        :stripe="true"
+        @handleCurrentChange="handleCurrentChange"
+        @handleSizeChange="handleSizeChange"
+      />
+    </div>
+
+  </div>
+</template>
+<script>
+import dayjs from 'dayjs'
+import TableItem from '@/components/TableAuto'
+import { getSysCommonCode } from '@/api/dataCenter'
+import {
+  viewScadaData,
+  viewScadaDataExport,
+  queryDevice
+} from '@/api/scadaApi'
+import ExportBtn from '@/views/zhpt/wxreportforms/components/ExportBtn'
+export default {
+  name: 'WaterSumReporting',
+  components: { TableItem, ExportBtn },
+  props: ['data'],
+  data() {
+    return {
+      allSwitch:false,
+      rangeType: 'date',
+      value1: '',
+      deviceType: '0',
+      deviceTypeIds: '',
+      componentTable: null,
+      startTime: '',
+      endTime: '',
+      startOptions: {
+        disabledDate: (time) => {
+          if (this.endTime) {
+            return time.getTime() >= new Date(this.endTime)
+          }
+        }
+      },
+      endOptions: {
+        disabledDate: (time) => {
+          if (this.startTime) {
+            return (
+              new Date(this.startTime) - 1000 * 60 * 60 * 24 > time.getTime()
+            )
+          }
+        }
+      },
+      dataList: [],
+      searchGroupUserVoList: [],
+      searchGroupArray: [
+        { id: '', name: '全部' },
+        { id: '1', name: '水厂' },
+        { id: '2', name: '管网' }
+      ], // 巡检组列表
+      searchWorkers: [], // 人员列表
+      chooseGroup: '', // 巡检组
+      chooseWorker: '', // 巡检人
+      dataTime: '', // 查询时间
+      deptId: '',
+      hasGroup: false, // 是否在巡检组内
+      column: [],
+      column1: [
+        {
+          label: '时间',
+          prop: 'scadaTime',
+          align: 'center',
+          width: '180'
+        },
+        {
+          label: '设备名称',
+          prop: 'deviceName',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '指标名称',
+          prop: 'displayName',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '0时',
+          prop: '00',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '1时',
+          prop: '01',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '2时',
+          prop: '02',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '3时',
+          prop: '03',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '4时',
+          prop: '04',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '5时',
+          prop: '05',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '6时',
+          prop: '06',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '7时',
+          prop: '07',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '8时',
+          prop: '08',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '9时',
+          prop: '09',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '10时',
+          prop: '10',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '11时',
+          prop: '11',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '12时',
+          prop: '12',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '13时',
+          prop: '13',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '14时',
+          prop: '14',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '15时',
+          prop: '15',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '16时',
+          prop: '16',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '17时',
+          prop: '17',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '18时',
+          prop: '18',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '19时',
+          prop: '19',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '20时',
+          prop: '20',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '21时',
+          prop: '21',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '22时',
+          prop: '22',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '23时',
+          prop: '23',
+          align: 'center',
+          width: '150'
+        }
+      ],
+      column3: [
+        {
+          label: '时间',
+          prop: 'scadaTime',
+          align: 'center',
+          width: '180'
+        },
+        {
+          label: '设备名称',
+          prop: 'deviceName',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '指标名称',
+          prop: 'displayName',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '1月',
+          prop: '01',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '2月',
+          prop: '02',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '3月',
+          prop: '03',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '4月',
+          prop: '04',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '5月',
+          prop: '05',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '6月',
+          prop: '06',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '7月',
+          prop: '07',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '8月',
+          prop: '08',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '9月',
+          prop: '09',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '10月',
+          prop: '10',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '11月',
+          prop: '11',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '12月',
+          prop: '12',
+          align: 'center',
+          width: '150'
+        }
+      ],
+      column2: [
+        {
+          label: '时间',
+          prop: 'scadaTime',
+          align: 'center',
+          width: '180'
+        },
+        {
+          label: '设备名称',
+          prop: 'deviceName',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '指标名称',
+          prop: 'displayName',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '1日',
+          prop: '01',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '2日',
+          prop: '02',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '3日',
+          prop: '03',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '4日',
+          prop: '04',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '5日',
+          prop: '05',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '6日',
+          prop: '06',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '7日',
+          prop: '07',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '8日',
+          prop: '08',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '9日',
+          prop: '09',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '10日',
+          prop: '10',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '11日',
+          prop: '11',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '12日',
+          prop: '12',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '13日',
+          prop: '13',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '14日',
+          prop: '14',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '15日',
+          prop: '15',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '16日',
+          prop: '16',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '17日',
+          prop: '17',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '18日',
+          prop: '18',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '19日',
+          prop: '19',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '20日',
+          prop: '20',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '21日',
+          prop: '21',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '22日',
+          prop: '22',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '23日',
+          prop: '23',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '24日',
+          prop: '24',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '25日',
+          prop: '25',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '26日',
+          prop: '26',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '27日',
+          prop: '27',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '28日',
+          prop: '28',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '29日',
+          prop: '29',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '30日',
+          prop: '30',
+          align: 'center',
+          width: '150'
+        },
+        {
+          label: '31日',
+          prop: '31',
+          align: 'center',
+          width: '150'
+        }
+      ],
+
+      categoryName: '1',
+      deviceId: [],
+      isSeletcSite: [],
+      type: '',
+      types: [],
+      indexName: [],
+      indexNames: [],
+      monthTime: '',
+      pageInfo: { current: 1, size: 20 } // 分页数据
+    }
+  },
+  watch: {},
+  mounted: function() {
+    const data = this.getTimeSplit()
+    this.startTime = data.now
+    this.endTime = data.next
+    // this.dataTime=[data.now,data.next];
+    // this.dataList.title = 'Scada日报(' + data.now + '~' + data.next + ')'
+    // this.getGroupUserMap()
+    this.queryDevice() // 绑定测站名称
+    this.componentTable = this.$refs.comTable.$children[0].$el
+    this.monthTime = this.getNowTime(0)
+    this.column = this.column1
+    this.getDailyReportData()
+  },
+  methods: {
+    getAllData(e){
+      // 
+      if(e){
+        // 清空表格 查询水总量
+      }else{
+
+      }
+    },
+    getNowTime(type = 0) {
+      const formatStr = ['YYYY-MM-DD', 'YYYY-MM', 'YYYY']
+      return dayjs().format(formatStr[type])
+    },
+    formatDate(type, time) {
+      const obj = {
+        '0': (time) => {
+          const startDate = dayjs(time).format('YYYY-MM-DD') + ' 00:00:00'
+          const endDate = dayjs(time).format('YYYY-MM-DD') + ' 23:59:59'
+          return [startDate, endDate]
+        },
+        '1': (time) => {
+          const startDate = dayjs(time).startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
+          const endDate = dayjs(time).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
+          return [startDate, endDate]
+        },
+        '2': (time) => {
+          const startDate = dayjs(time).startOf('month').format('YYYY') + '-01-01 00:00:00'
+          const endDate = dayjs(time).endOf('month').format('YYYY') + '-12-31 23:59:59'
+          return [startDate, endDate]
+        }
+      }
+      return obj[type](time)
+    },
+    // 查询参数重置
+    resetPage() {
+      this.pageInfo.current = 1
+    },
+    queryData() {
+      this.resetPage()
+      this.getDailyReportData()
+    },
+    // 获取巡查日报信息
+    getDailyReportData() {
+      const time = this.formatDate(this.deviceType, this.monthTime)
+      const data = {
+        tableType: '2',
+        statisticsType: this.deviceType,
+        startDate: time[0],
+        endDate: time[1],
+        deviceIdList: this.deviceId.toString()
+      }
+      Object.assign(data, this.pageInfo)
+      viewScadaData(data).then((res) => {
+        if (+res.code === 1) {
+          const records = res.result.records || []
+          const sliceCount = [[11, 13], [8, 10], [5, 7]]
+          records.forEach((item) => {
+            item.dataList.forEach((item1, index) => {
+              const str = item1.scadaTime.slice(...sliceCount[+this.deviceType])
+              item[str] = Number(item1.indexValue).toFixed(2)
+            })
+          })
+          this.pageInfo.tableTotal = Number(res.result.total)
+          /*
+          if (this.deviceType == 0) {
+            records.forEach((item) => {
+              item.dataList.forEach((item1, index) => {
+                item.displayName = item1.scadaTime
+                const str = item1.scadaTime.slice(11, 13)
+                item[str] = Number(item1.indexValue).toFixed(2)
+              })
+            })
+          } else if (this.deviceType == 1) {
+            records.forEach((item) => {
+              item.dataList.forEach((item1, index) => {
+                item.displayName = item1.scadaTime
+                const str = item1.scadaTime.slice(8, 10)
+                item[str] = Number(item1.indexValue).toFixed(2)
+              })
+            })
+          } else if (this.deviceType == 2) {
+            records.forEach((item) => {
+              item.dataList.forEach((item1, index) => {
+                item.displayName = item1.scadaTime
+                const str = item1.scadaTime.slice(5, 7)
+                item[str] = Number(item1.indexValue).toFixed(2)
+              })
+            })
+          }
+          */
+
+          this.dataList = records
+        }
+      })
+    },
+    getExport() {
+      const time = this.formatDate(this.deviceType, this.monthTime)
+      const data = {
+        tableType: '2',
+        statisticsType: this.deviceType,
+        startDate: time[0],
+        endDate: time[1],
+        isExport: '1',
+        deviceIdList: this.deviceId.toString()
+      }
+      Object.assign(data, this.pageInfo)
+      viewScadaDataExport(data).then((res) => {
+        if (!res) return
+        const fileName = '供水统计.xlsx'
+        const url = window.URL.createObjectURL(new Blob([res]))
+        const link = document.createElement('a')
+        link.href = url
+        link.setAttribute('download', `${fileName}`)
+        document.body.appendChild(link)
+        link.click()
+        window.URL.revokeObjectURL(url) // 释放内存
+      })
+    },
+    // 获取当前时间
+    getTimeSplit() {
+      const next = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+      // const now = dayjs().format('YYYY-MM-DD')
+      return {
+        now: next,
+        next: next
+      }
+    },
+    // 改变巡检组的情况
+    changeGroup() {
+      const index = this.searchGroupUserVoList.findIndex((item) => {
+        return item.id + '' === this.chooseGroup + ''
+      })
+      const data = this.searchGroupUserVoList[index].data
+      this.searchWorkers = data
+      this.chooseWorker = ''
+    },
+    // 获取当前用户下的所有巡检组和人员并初始化巡检组下拉内容
+    getGroupUserMap() {
+      getSysCommonCode({ pCid: '53400' }).then((res) => {
+        this.searchWorkers = res.result[0].codeList
+        this.getDailyReportData()
+      })
+    },
+    selectClear() {
+      this.categoryName = ''
+      this.dataList = []
+      this.$forceUpdate()
+    },
+    selectChange(val) {
+      this.types = []
+      this.deviceId = []
+      this.type = ''
+      this.dataList = []
+      const columnList = [this.column1, this.column2, this.column3]
+      this.column = columnList[+this.deviceType] || []
+
+      const rangeType = ['date', 'month', 'year']
+      this.rangeType = rangeType[+this.deviceType] || rangeType[0]
+
+      this.monthTime = this.getNowTime(+this.deviceType)
+    },
+    queryDevice() {
+      queryDevice({
+        deviceTypeIds: '2,3,12,13,14',
+        size: 10000,
+        deviceType: ''
+      }).then((res) => {
+        this.isSeletcSite = res.result.records
+      })
+    },
+    process(arr) {
+      // 缓存用于记录
+      const cache = []
+      for (const t of arr) {
+        // 检查缓存中是否已经存在
+        if (cache.find((c) => c.type === t.type)) {
+          // 已经存在说明以前记录过,现在这个就是多余的,直接忽略
+          continue
+        }
+        // 不存在就说明以前没遇到过,把它记录下来
+        cache.push(t)
+      }
+
+      // 记录结果就是过滤后的结果
+      return cache
+    },
+    // 设备名称发生改变时触发
+    // bindTsNameChange() {
+    //   // console.log(this.ruleForm.site);
+    //   this.tabsItem = [];
+    //   this.types = [];
+    //   this.indexNames = [];
+    //   this.targetIndex = {};
+    //   this.type = "";
+    //   this.indexName = [];
+    //   this.dataList = [];
+    //   // this.queryIndexConfiguration()
+    // },
+    handleSizeChange(val) {
+      this.pageInfo.size = val
+      this.getDailyReportData()
+    },
+    handleCurrentChange(val) {
+      this.pageInfo.current = val
+      this.getDailyReportData()
+    }
+  }
+}
+</script>
+
+<style lang='scss' scoped>
+.scadaDayManYear {
+  position: relative;
+  height: 100%;
+  width: 100%;
+  padding: 5px;
+
+  .menus {
+    position: absolute;
+    z-index: 2;
+    height: 40px;
+    width: 100%;
+
+    .select_name {
+      position: relative;
+      float: left;
+      // font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
+      font-size: 14px;
+      font-weight: 500;
+      color: black;
+      margin-left: 10px;
+      margin-top: 6px;
+
+      .xjDate {
+        left: 185px;
+      }
+    }
+
+    .select_option {
+      position: relative;
+      float: left;
+      left: 5px;
+      // font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
+      font-size: 14px;
+      font-weight: 500;
+      color: black;
+      // .user_select {
+      //   position: absolute;
+      //   left: 280px;
+      //   z-index: 2;
+      // }
+    }
+  }
+
+  .statistics {
+    position: relative;
+    width: 100%;
+    top: 35px;
+    height: 500px;
+    background-size: 100% 100%;
+  }
+}
+</style>