Browse Source

Merge branch 'dev' of http://192.168.2.241:3000/wanghai/bimgis_sx into dev

zxh 2 years ago
parent
commit
4b795744b6
29 changed files with 4304 additions and 3139 deletions
  1. 1 1
      package-lock.json
  2. 42 1
      src/api/APIs.ts
  3. 1 1
      src/api/ftp.ts
  4. 62 3
      src/components/Base/Dialog/ImagePreview.vue
  5. 6 1
      src/components/Base/Dialog/index.vue
  6. 111 0
      src/components/Base/FileUploader/index.vue
  7. 5 53
      src/config/bigScreenConfig.js
  8. 337 339
      src/layout/components/Header/AccountApply.vue
  9. 239 241
      src/layout/components/Header/UserInfoEdit.vue
  10. 1 1
      src/settings.js
  11. 7 7
      src/store/modules/user.ts
  12. 7 8
      src/views/OnlineImport/widgets/DataImport/components/PbsTree.vue
  13. 0 1
      src/views/OnlineImport/widgets/DataImport/widget.vue
  14. 808 0
      src/views/OnlineImport/widgets/PipeOnlineImport/widget.vue
  15. 1162 954
      src/views/currentSystem/authorityManagement/userRights/index.vue
  16. 944 944
      src/views/currentSystem/authorityManagement/userRights/index3.vue
  17. 279 279
      src/views/currentSystem/authorityManagement/userRights/mergeUser/index.vue
  18. 133 136
      src/views/currentSystem/dashboard/components/UserDoc/index.vue
  19. 48 22
      src/views/groupPage/districtPageModules/customTools/projectPipeSpeedInfoCheck.vue
  20. 0 3
      src/views/pipelineDefect/mixin/map.ts
  21. 22 7
      src/views/spectrum/configuration/api/common.ts
  22. 17 80
      src/views/spectrum/configuration/device/DeviceForm.vue
  23. 34 34
      src/views/spectrum/configuration/neighbor/NeighborForm.vue
  24. 3 3
      src/views/spectrum/configuration/point/PointForm/DeviceForm.vue
  25. 21 4
      src/views/spectrum/configuration/point/PointForm/index.vue
  26. 1 0
      src/views/spectrum/configuration/point/widget.vue
  27. 6 9
      src/views/spectrum/configuration/type/ParamForm.vue
  28. 3 3
      src/views/spectrum/configuration/type/TypeForm.vue
  29. 4 4
      src/views/spectrum/configuration/type/widget.vue

+ 1 - 1
package-lock.json

@@ -8438,7 +8438,7 @@
     },
     "crypto-js": {
       "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
+      "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz",
       "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
     },
     "css": {

+ 42 - 1
src/api/APIs.ts

@@ -215,7 +215,7 @@ export const videoList_api = (data) => {
   });
 };
 
-//  pbs工程结构树 & 照片墙等树状列表,多个模块重要通用
+/** pbs工程结构树 & 照片墙等树状列表,多个模块重要通用*/  
 export const pbsTreeList_api = (data) => {
   return request({
     method: "get",
@@ -223,7 +223,48 @@ export const pbsTreeList_api = (data) => {
     params: data,
   });
 };
+/** 根据id查找树结构明细*/ 
+export const getStructureDetailByID = (data) => {
+  return request({
+    method: "get",
+    url: `/tofly-sxgk/structuredetail/${data.id}`,
+    params: data,
+  });
+};
+/**  根据id 查询PBS模板层级信息*/
+export const getPbsLevelByID = (data) => {
+  return request({
+    method: "get",
+    url: `/tofly-sxgk/pbslevel/${data.id}`,
+    params: data,
+  });
+};
+/** PBS模板层级分页查询*/ 
+export const getPbsLevelPage = (data) => {
+  return request({
+    method: "get",
+    url: `/tofly-sxgk/pbslevel/page`,
+    params: data,
+  });
+};
 
+/** 业务对象分页查询*/ 
+export const getBoinfoPage = (data) => {
+  return request({
+    method: "get",
+    url: `/tofly-sxgk/boinfo/page`,
+    params: data,
+  });
+};
+
+/** pbs模板详细信息分页查询*/ 
+export const getPbsCodeDetailPage = (data) => {
+  return request({
+    method: "get",
+    url: `/tofly-sxgk/pbscodedetailx/page`,
+    params: data,
+  });
+};
 //pbs工程结构树设计搜索
 export const pbsTreeSearch_api = (data) => {
   return request({

+ 1 - 1
src/api/ftp.ts

@@ -6,7 +6,7 @@ import { IP } from '@/utils/request'
 // 获取图片地址
 const tokenFormSession = () => sessionStorage.getItem('token')
 
-export const getRemoteImg = (path: string) =>
+export const getRemoteFile = (path: string) =>
   path
     ? `${String(IP.startsWith('http://192') ? 'http://221.182.8.141:1118' : IP).replace(
         /\/$/,

+ 62 - 3
src/components/Base/Dialog/ImagePreview.vue

@@ -1,24 +1,83 @@
 <template>
   <tf-dialog
     :visible.sync="dialogVisible"
-    width="80vw"
+    :width="width"
     :footer="false"
     :gutter="false"
+    :title="title"
+    max-height="100vh"
     v-bind="$attrs"
     v-on="$listeners"
+    @closed="onClosed"
   >
-    <img v-if="src" :src="src" alt="" style="display: block; width: 100%" />
+    <div v-loading="loading" element-loading-background="transparent">
+      <el-image :src="src" :alt="alt" @click="onZoomIn" class="img" />
+    </div>
   </tf-dialog>
 </template>
 
 <script lang="ts">
-  import { Vue, Component, Prop, PropSync } from 'vue-property-decorator'
+  import { Vue, Component, Prop, PropSync, Watch } from 'vue-property-decorator'
   import TfDialog from './index.vue'
+  const DEFAULT_WIDTH = '375px'
 
   @Component({ name: 'TfImagePreview', components: { TfDialog } })
   export default class TfImagePreview extends Vue {
     @Prop({ type: String }) src!: string
     @Prop({ type: String }) alt!: string
+    @Prop({ type: String, default: '图片查看' }) title!: string
     @PropSync('visible', { type: Boolean }) dialogVisible!: boolean
+    width: string = DEFAULT_WIDTH
+    loading: boolean = false
+    onZoomIn() {
+      window.open(this.src, this.title, 'toolbar=no,menubar=no,location=no,status=no,scrollbar=no')
+    }
+    onClosed() {
+      this.width = DEFAULT_WIDTH
+    }
+    @Watch('src')
+    onSrcChange(src: string) {
+      this.loading = false
+      if (src) {
+        const image = new Image()
+        this.loading = true
+        image.src = src
+        image.onload = () => {
+          this.loading = false
+          const {
+            naturalWidth
+            // naturalHeight
+          } = image
+          const {
+            clientWidth
+            //  clientHeight
+          } = document.body
+          const maxWidth = clientWidth * 0.8
+          // const maxHeight = clientHeight * 0.8
+          const width = naturalWidth > maxWidth ? maxWidth : naturalWidth
+          // const height = naturalHeight > width ? maxHeight : naturalHeight
+          this.width = `${width}px`
+        }
+        image.onerror = () => {
+          this.width = DEFAULT_WIDTH
+          this.loading = false
+        }
+      } else {
+        this.width = DEFAULT_WIDTH
+      }
+    }
   }
 </script>
+<style lang="scss" scoped>
+  .img {
+    width: 100%;
+    min-height: 100px;
+    >>> img {
+      cursor: zoom-in;
+    }
+    >>> .el-image__error {
+      text-align: center;
+      height: 100px;
+    }
+  }
+</style>

+ 6 - 1
src/components/Base/Dialog/index.vue

@@ -9,6 +9,7 @@
     @open="onOpen"
     @opened="onOpened"
     v-on="listeners"
+    :style="`--max-height: ${maxHeight.includes('calc') ? maxHeight : `calc(${maxHeight} - 54px)`}`"
   >
     <slot name="title">
       <div slot="title">
@@ -41,6 +42,7 @@
     @Prop({ type: Boolean, default: true }) clear!: boolean
     @Prop({ type: Boolean, default: true }) footer!: boolean
     @Prop({ type: Boolean, default: true }) gutter!: boolean
+    @Prop({ type: String, default: 'calc(90vh - 54px)' }) maxHeight!: string
 
     timer: number = null
     submitted: boolean = false
@@ -160,7 +162,7 @@
     $radius: $--border-radius-base;
     $font-color: $--color-white;
     $bg-color: $--color-primary;
-
+    --max-height: calc(85vh - 54px);
     border-radius: $radius;
     display: flex;
     justify-content: center;
@@ -206,6 +208,9 @@
       }
       .el-dialog__body {
         padding: $gutter-medium;
+        max-height: var(--max-height);
+        overflow: hidden auto;
+        @include base-scroll-bar();
       }
     }
     &.no-gutter {

+ 111 - 0
src/components/Base/FileUploader/index.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="tf-file-uploader">
+    <slot name="title">{{ title }}</slot>
+    <span style="margin-left: 5px; color: #ccc">(最多上传{{ limit }}张)</span>
+    <div
+      style="margin-top: 20px"
+      class="upload"
+      :style="`--display: ${files.length >= limit ? 'none' : 'inline-flex'}`"
+    >
+      <el-upload :file-list="files" v-on="$listeners" v-bind="attrs">
+        <i class="el-icon-plus" />
+      </el-upload>
+    </div>
+    <tf-image-preview :visible.sync="visible" :src="url" />
+  </div>
+</template>
+
+<script lang="ts">
+  import { ElUploadInternalFileDetail } from 'element-ui/types/upload'
+  import { Vue, Component, Prop, VModel } from 'vue-property-decorator'
+
+  @Component({ name: 'TfFileUploader', inheritAttrs: false })
+  export default class TfFileUploader extends Vue {
+    @VModel({ type: Array, default: () => [] }) files!: ElUploadInternalFileDetail[]
+    @Prop({ type: String }) title!: string
+    @Prop({ type: Number, default: 9 }) limit!: number
+    @Prop({ type: Number, default: 10 }) maxSize!: number
+
+    url: string = ''
+    visible: boolean = false
+
+    get attrs() {
+      return {
+        listType: 'picture-card',
+        multiple: true,
+        autoUpload: false,
+        action: 'whatever',
+        accept: '.jpg,.jpeg,.png',
+        drag: true,
+        onRemove: this.onRemove,
+        onChange: this.onFileChange,
+        onPreview: this.onPreview,
+        ...this.$attrs
+      }
+    }
+
+    onRemove(file) {
+      this.files = this.files.filter((item) => item.uid !== file.uid)
+    }
+    onPreview(file) {
+      this.url = file.url
+      this.visible = true
+    }
+
+    async onFileChange(file: ElUploadInternalFileDetail, files: ElUploadInternalFileDetail[]) {
+      setTimeout(() => {
+        const imageTypes = ['image/jpeg', 'image/png']
+        const { size, name, raw: { type } = {} } = file
+        const accept = this.attrs.accept.split(',')
+
+        const handleError = (msg) => {
+          console.log(msg, '\n', files.length, this.files.length)
+          this.$message.error(msg)
+          this.onRemove(file)
+          return new Error(msg)
+        }
+        if (!imageTypes.includes(type) || !accept.some((item) => String(name).endsWith(item))) {
+          return handleError(`上传文件只能是 ${accept.join(', ')} 格式!`)
+        }
+        if (size / 1024 / 1024 > this.maxSize) {
+          return handleError(`上传文件大小不能超过 ${this.maxSize} MB!`)
+        }
+        if (this.files.length >= this.limit) {
+          return handleError(`最多可以上传${this.limit}张图片!`)
+        }
+        this.files = [...this.files, file]
+        console.log(this.$attrs)
+        return true
+      }, 0)
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  .tf-file-uploader {
+    .upload {
+      overflow: hidden;
+      margin-right: -16px;
+      >>> .el-upload {
+        &-list__item,
+        &--picture-card,
+        &-dragger {
+          width: 130px;
+          height: 130px;
+          line-height: normal;
+          display: inline-flex;
+          align-items: center;
+          justify-content: center;
+        }
+        &-dragger {
+          width: 100%;
+          height: 100%;
+          border: none;
+        }
+        &.el-upload--picture-card {
+          display: var(--display);
+        }
+      }
+    }
+  }
+</style>

+ 5 - 53
src/config/bigScreenConfig.js

@@ -21,57 +21,28 @@ export const appconfig = {
         "name": "离线影像服务",
         "type": "tiled",
         "config": {
-          "chinavec2d": {
-            "name": "中国电子地图",
-            "url": BASE_URL + "/services/map-citymap-3/rest/maps/citymap_yc"
-          }
+
         }
       },
       "scenes": {
         "name": "场景服务",
         "type": "scene",
         "config": {
-          // "wscj": {
-          //   "name": "污水厂",
-          //   "url": BASE_URL + "/services/3D-liduershuichang/rest/realspace"
-          // },
-          // "scj": {
-          //   "name": "水厂",
-          //   "url": BASE_URL + "/services/3D-BaiYinShuiChang/rest/realspace"
-          // },
-          "jzcj": {
-            "name": "建筑场景",
-            "url": BASE_URL + "/services/3D-TF_PAPN_BUILD-2/rest/realspace"
-          },
-          "gcgdcj": {
-            "name": "设计管网",
-            // "url": "/services/3D-hbyc_sj/rest/realspace"
-            "url": BASE_URL + "/services/3D-hbyc_sj_lx_20220829/rest/realspace"
-          },
+
         }
       },
       "maps": {
         "name": "地图服务",
         "type": "map",
         "config": {
-          "sjdt": {
-            "name": "设计管线",
-            "url": BASE_URL + "/services/map-sxgk_yc/rest/maps/hnyy_sj"
-          },
+
         }
       },
       "tiplayers": {
         "name": "数据服务",
         "type": "data",
         "config": {
-          "sjfw": {
-            "name": "宜昌数据服务",
-            "url": BASE_URL + "/services/data-sxgk_yc/rest/data"
-          },
-          "bjsmidfw": {
-            "name": "部件SMID查询",
-            "url": BASE_URL + "/services/map-sxgk_yc/rest/maps/hnyy_query"
-          },
+
         }
       },
       "geometry": {
@@ -85,26 +56,7 @@ export const appconfig = {
         "name": "专题地图服务",
         "type": "theme",
         "config": {
-          "sjtypedt": {
-            "isDisplay": "1",
-            "name": "管网施工状态专题图",
-            "url": BASE_URL + "/services/map-sxgk_yc/rest/maps/hnyy_pressure_dp"
-          },
-          "pcdtps": {
-            "isDisplay": "0",
-            "name": "质量验评专题图",
-            "url": BASE_URL + "/services/map-sxgk_yc/rest/maps/hnyy_zlyp"
-          },
-          "clpsgw": {
-            "isDisplay": "0",
-            "name": "存量排水管网",
-            "url": BASE_URL + "/services/map-sxgk_yc/rest/maps/hnyy_pc_ps_dp"
-          },
-          "sjpsgw": {
-            "isDisplay": "0",
-            "name": "设计排水管网",
-            "url": BASE_URL + "/services/map-sxgk_yc/rest/maps/hnyy_sj_lx_dp"
-          },
+
         }
       }
     }

+ 337 - 339
src/layout/components/Header/AccountApply.vue

@@ -124,7 +124,7 @@
                   :options="deptmentTree"
                   :props="{ expandTrigger: 'hover', label: 'name', value: 'id', checkStrictly: true }"
                   size="small"
-                  style="width:100%"
+                  style="width: 100%"
                   filterable
                   clearable
                   @change="onDeptChange"
@@ -179,9 +179,7 @@
                       <img v-if="head" :src="head" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon el-upload" />
                     </el-upload>
-                    <div class="msg">
-                      ⚠️注意:上传图片只能是 JPG或png 格式!单张图片大小不能超过 2MB!
-                    </div>
+                    <div class="msg">⚠️注意:上传图片只能是 JPG或png 格式!单张图片大小不能超过 2MB!</div>
                   </el-form-item>
                 </el-col>
               </el-row>
@@ -274,377 +272,377 @@
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
-import { accountApplyHistory, accountApplyFill, getCompanyAll, getAllAuditors, getAllDepartments } from '@/api/base'
-import { getRemoteImg } from '@/api/ftp'
-import { regPhone, regEmail, regPassword, regUserName, regRealName } from '@/utils/reg'
+  import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
+  import { accountApplyHistory, accountApplyFill, getCompanyAll, getAllAuditors, getAllDepartments } from '@/api/base'
+  import { getRemoteFile } from '@/api/ftp'
+  import { regPhone, regEmail, regPassword, regUserName, regRealName } from '@/utils/reg'
 
-// eslint-disable-next-line no-unused-vars
-import { ElForm } from 'element-ui/types/form'
+  // eslint-disable-next-line no-unused-vars
+  import { ElForm } from 'element-ui/types/form'
 
-const sha1Hex = require('sha1-hex')
-const columns = [
-  { prop: 'order', label: '序号', width: '80' },
-  { prop: 'username', label: '登录名' },
-  { prop: 'realName', label: '用户姓名' },
-  { prop: 'createTime', label: '申请时间' },
-  { prop: 'applyername', label: '申请人' },
-  {
-    prop: 'auditstatus',
-    label: '审核意见',
-    formatter: (row, col, cellValue, index) => {
-      if (cellValue === '0') return '不同意'
-      if (cellValue === '1') return '未审核'
-      if (cellValue === '2') return '同意'
-    }
-  },
-  { prop: 'audittime', label: '审核时间' },
-  { label: '操作', scopedSlot: 'actions' }
-]
-const getDefaultVal = () => ({
-  username: '',
-  password: '',
-  realName: '',
-  phone: '',
-  email: '',
-  departmentId: [],
-  recipient: '', // 审核人
-  note: '',
-  job: '',
-  applystate: '',
-  file: '', // 用户头像
-  electronicFile: '' // 电子签名
-})
+  const sha1Hex = require('sha1-hex')
+  const columns = [
+    { prop: 'order', label: '序号', width: '80' },
+    { prop: 'username', label: '登录名' },
+    { prop: 'realName', label: '用户姓名' },
+    { prop: 'createTime', label: '申请时间' },
+    { prop: 'applyername', label: '申请人' },
+    {
+      prop: 'auditstatus',
+      label: '审核意见',
+      formatter: (row, col, cellValue, index) => {
+        if (cellValue === '0') return '不同意'
+        if (cellValue === '1') return '未审核'
+        if (cellValue === '2') return '同意'
+      }
+    },
+    { prop: 'audittime', label: '审核时间' },
+    { label: '操作', scopedSlot: 'actions' }
+  ]
+  const getDefaultVal = () => ({
+    username: '',
+    password: '',
+    realName: '',
+    phone: '',
+    email: '',
+    departmentId: [],
+    recipient: '', // 审核人
+    note: '',
+    job: '',
+    applystate: '',
+    file: '', // 用户头像
+    electronicFile: '' // 电子签名
+  })
 
-@Component({
-  filters: {
-    formatteAuditStatus(val) {
-      switch (val) {
-        case '0':
-          return '不同意'
+  @Component({
+    filters: {
+      formatteAuditStatus(val) {
+        switch (val) {
+          case '0':
+            return '不同意'
 
-        case '1':
-          return '未审核'
+          case '1':
+            return '未审核'
 
-        case '2':
-          return '同意'
+          case '2':
+            return '同意'
+        }
       }
     }
-  }
-})
-export default class AccountApply extends Vue {
-  @Prop({ default: false }) showApply: boolean
-  formatteAuditStatus: any
-  accountApply = getDefaultVal()
-  accountApplyRules = {
-    username: [
-      { required: true, message: '请输入登录名', trigger: 'blur' },
-      {
-        pattern: regUserName(),
-        message: '4-16位字母与数字,不可包含非法字符!',
-        trigger: 'blur'
-      }
-    ],
-    password: [
-      { required: true, message: '请输入密码', trigger: 'blur' },
-      {
-        pattern: regPassword(),
-        message: '密码位数8-16位,必须包含大小写字母和数字,不可包含非法字符!',
-        trigger: 'blur'
-      }
-    ],
-    realName: [
-      { required: true, message: '请输入用户姓名', trigger: 'blur' },
-      {
-        pattern: regRealName(),
-        message: '2-6位中文字符,不可包含非法字符!',
-        trigger: 'blur'
+  })
+  export default class AccountApply extends Vue {
+    @Prop({ default: false }) showApply: boolean
+    formatteAuditStatus: any
+    accountApply = getDefaultVal()
+    accountApplyRules = {
+      username: [
+        { required: true, message: '请输入登录名', trigger: 'blur' },
+        {
+          pattern: regUserName(),
+          message: '4-16位字母与数字,不可包含非法字符!',
+          trigger: 'blur'
+        }
+      ],
+      password: [
+        { required: true, message: '请输入密码', trigger: 'blur' },
+        {
+          pattern: regPassword(),
+          message: '密码位数8-16位,必须包含大小写字母和数字,不可包含非法字符!',
+          trigger: 'blur'
+        }
+      ],
+      realName: [
+        { required: true, message: '请输入用户姓名', trigger: 'blur' },
+        {
+          pattern: regRealName(),
+          message: '2-6位中文字符,不可包含非法字符!',
+          trigger: 'blur'
+        }
+      ],
+      phone: [{ pattern: regPhone(), message: '请输入正确的联系电话', trigger: 'blur' }],
+      email: [{ pattern: regEmail(), message: '请输入正确的邮箱', trigger: 'blur' }],
+      // role: [{ required: true, message: '请输入角色', trigger: 'blur' }],
+      departmentId: [{ required: true, message: '请选择部门', trigger: 'blur' }],
+      recipient: [{ required: true, message: '请选择审核人', trigger: 'blur' }]
+      // sign: [{ required: true, message: '请上传个性签名', trigger: 'blur' }],
+      // applyNote: [
+      //   { required: true, message: '请输入备注信息', trigger: 'blur' }
+      // ],
+      // applyState: [
+      //   { required: true, message: '请输入申请说明', trigger: 'blur' }
+      // ]
+    }
+    accountApplyTab = false
+    applyDetailTab = false
+    columns
+    activeTab = 'history'
+    departmentIdOptions = []
+    recipients = [] // 审核人列表
+    value = ''
+    fileList = []
+    applyRealName = ''
+    applyStatus = ''
+    applyTime = ''
+    applyHistory = []
+    pageSize = 10
+    page = 1
+    total = 0
+    detailInfo = null
+    activeNames = ['baseInfo']
+    esign = ''
+    head = ''
+    @Watch('showApply')
+    showApplyChange(val) {
+      if (val === false) {
+        this.accountApplyTab && (this.$refs.accountApply as ElForm).resetFields()
+        this.accountApplyTab = false
+        this.applyDetailTab = false
+        this.activeTab = 'history'
       }
-    ],
-    phone: [{ pattern: regPhone(), message: '请输入正确的联系电话', trigger: 'blur' }],
-    email: [{ pattern: regEmail(), message: '请输入正确的邮箱', trigger: 'blur' }],
-    // role: [{ required: true, message: '请输入角色', trigger: 'blur' }],
-    departmentId: [{ required: true, message: '请选择部门', trigger: 'blur' }],
-    recipient: [{ required: true, message: '请选择审核人', trigger: 'blur' }]
-    // sign: [{ required: true, message: '请上传个性签名', trigger: 'blur' }],
-    // applyNote: [
-    //   { required: true, message: '请输入备注信息', trigger: 'blur' }
-    // ],
-    // applyState: [
-    //   { required: true, message: '请输入申请说明', trigger: 'blur' }
-    // ]
-  }
-  accountApplyTab = false
-  applyDetailTab = false
-  columns
-  activeTab = 'history'
-  departmentIdOptions = []
-  recipients = [] // 审核人列表
-  value = ''
-  fileList = []
-  applyRealName = ''
-  applyStatus = ''
-  applyTime = ''
-  applyHistory = []
-  pageSize = 10
-  page = 1
-  total = 0
-  detailInfo = null
-  activeNames = ['baseInfo']
-  esign = ''
-  head = ''
-  @Watch('showApply')
-  showApplyChange(val) {
-    if (val === false) {
-      this.accountApplyTab && (this.$refs.accountApply as ElForm).resetFields()
-      this.accountApplyTab = false
-      this.applyDetailTab = false
-      this.activeTab = 'history'
     }
-  }
-  departmentId = ''
-  get reviewers() {
-    return (this.recipients || []).filter(({ departmentId: id }) => {
-      return id === this.departmentId
-    })
-  }
-  onDeptChange(val = []) {
-    this.accountApply.recipient = ''
-    this.departmentId = val[val.length - 1] || ''
-  }
-  mounted() {
-    this.columns = columns
-    this.historyList()
-    this.getdepartmentId()
-    this.getAuditors()
-  }
-  // 打开账号申请界面
-  toggleAccountApplyTab() {
-    this.accountApplyTab = true
-    if (this.accountApplyTab) this.activeTab = 'account'
+    departmentId = ''
+    get reviewers() {
+      return (this.recipients || []).filter(({ departmentId: id }) => {
+        return id === this.departmentId
+      })
+    }
+    onDeptChange(val = []) {
+      this.accountApply.recipient = ''
+      this.departmentId = val[val.length - 1] || ''
+    }
+    mounted() {
+      this.columns = columns
+      this.historyList()
+      this.getdepartmentId()
+      this.getAuditors()
+    }
+    // 打开账号申请界面
+    toggleAccountApplyTab() {
+      this.accountApplyTab = true
+      if (this.accountApplyTab) this.activeTab = 'account'
 
-    console.log(this.recipients)
-  }
-  // 打开申请详情页面
-  toggleAccountApplyDetailTab(data) {
-    this.detailInfo = data
-    this.applyDetailTab = true
-    if (this.applyDetailTab) this.activeTab = 'accountApplyDetail'
-    const arr = [this.detailInfo.avatar, this.detailInfo.esignature]
-    // arr.forEach((item, index) => {
-    // item !== null &&
-    // getRemoteImg(item).then((res) => {
-    //   if (res.status === 200) {
-    //     index === 1
-    //       ? (this.detailInfo.esignature = res.config.url)
-    //       : (this.detailInfo.avatar = res.config.url)
-    //   }
-    // })
+      console.log(this.recipients)
+    }
+    // 打开申请详情页面
+    toggleAccountApplyDetailTab(data) {
+      this.detailInfo = data
+      this.applyDetailTab = true
+      if (this.applyDetailTab) this.activeTab = 'accountApplyDetail'
+      const arr = [this.detailInfo.avatar, this.detailInfo.esignature]
+      // arr.forEach((item, index) => {
+      // item !== null &&
+      // getRemoteFile(item).then((res) => {
+      //   if (res.status === 200) {
+      //     index === 1
+      //       ? (this.detailInfo.esignature = res.config.url)
+      //       : (this.detailInfo.avatar = res.config.url)
+      //   }
+      // })
 
-    // })
-    const { departmentId } = this.accountApply
+      // })
+      const { departmentId } = this.accountApply
 
-    this.detailInfo = {
-      ...this.detailInfo,
-      departmentId: Array.isArray(departmentId) ? [...departmentId].pop() : departmentId,
-      esignature: getRemoteImg(this.detailInfo.esignature),
-      avatar: getRemoteImg(this.detailInfo.avatar)
+      this.detailInfo = {
+        ...this.detailInfo,
+        departmentId: Array.isArray(departmentId) ? [...departmentId].pop() : departmentId,
+        esignature: getRemoteFile(this.detailInfo.esignature),
+        avatar: getRemoteFile(this.detailInfo.avatar)
+      }
     }
-  }
-  // 关闭dialog
-  closeDialog() {
-    this.$emit('update:showApply', false)
-  }
-  // 历史申请记录
-  historyList() {
-    const data = {
-      realName: this.applyRealName,
-      auditStatus: this.applyStatus,
-      startAuditTime: (this.applyTime !== null && this.applyTime[0]) || '',
-      endAuditTime: (this.applyTime !== null && this.applyTime[1]) || '',
-      current: this.page,
-      size: this.pageSize
-      // 'orders[0].asc': false,
-      // 'orders[0].column': 'ID'
+    // 关闭dialog
+    closeDialog() {
+      this.$emit('update:showApply', false)
     }
-    accountApplyHistory(data).then((res) => {
-      this.total = res.result.total
-      res.result.records.forEach((item, index) => {
-        item.order = index + 1
+    // 历史申请记录
+    historyList() {
+      const data = {
+        realName: this.applyRealName,
+        auditStatus: this.applyStatus,
+        startAuditTime: (this.applyTime !== null && this.applyTime[0]) || '',
+        endAuditTime: (this.applyTime !== null && this.applyTime[1]) || '',
+        current: this.page,
+        size: this.pageSize
+        // 'orders[0].asc': false,
+        // 'orders[0].column': 'ID'
+      }
+      accountApplyHistory(data).then((res) => {
+        this.total = res.result.total
+        res.result.records.forEach((item, index) => {
+          item.order = index + 1
+        })
+        this.applyHistory = res.result.records
       })
-      this.applyHistory = res.result.records
-    })
-  }
-  // 申请账号
-  submitApply() {
-    ;(this.$refs.accountApply as ElForm).validate((valid) => {
-      if (valid) {
-        const data = new FormData()
-        for (const key in this.accountApply) {
-          if (key === 'departmentId') {
-            data.append(
-              key,
-              Array.isArray(this.accountApply[key]) ? [...this.accountApply[key]].pop() : this.accountApply[key]
-            )
-          } else {
-            data.append(key, key === 'password' ? sha1Hex(this.accountApply[key]) : this.accountApply[key])
+    }
+    // 申请账号
+    submitApply() {
+      ;(this.$refs.accountApply as ElForm).validate((valid) => {
+        if (valid) {
+          const data = new FormData()
+          for (const key in this.accountApply) {
+            if (key === 'departmentId') {
+              data.append(
+                key,
+                Array.isArray(this.accountApply[key]) ? [...this.accountApply[key]].pop() : this.accountApply[key]
+              )
+            } else {
+              data.append(key, key === 'password' ? sha1Hex(this.accountApply[key]) : this.accountApply[key])
+            }
           }
+          accountApplyFill(data).then((res) => {
+            // 用户存在的时候, 后台返回的数据多包了一层,造成永远都是code = 1, 报错的时候是res.result.code === -1
+            if ((res.result || {}).code === -1) {
+              this.$message({
+                type: 'warning',
+                message: res.result.message
+              })
+              return
+            }
+            if (res.code === 1) {
+              this.$message({
+                type: 'success',
+                message: '用户申请成功'
+              })
+
+              this.accountApplyTab = false
+              this.accountApply = getDefaultVal()
+              this.activeTab = 'history'
+              this.$store.dispatch('user/finnishApply', true)
+              this.historyList()
+            }
+          })
+        } else {
+          return false
         }
-        accountApplyFill(data).then((res) => {
-          // 用户存在的时候, 后台返回的数据多包了一层,造成永远都是code = 1, 报错的时候是res.result.code === -1
-          if ((res.result || {}).code === -1) {
-            this.$message({
-              type: 'warning',
-              message: res.result.message
-            })
-            return
-          }
-          if (res.code === 1) {
-            this.$message({
-              type: 'success',
-              message: '用户申请成功'
-            })
+      })
+    }
+    // 上传之前做验证和文件转换
+    beforePicUpload(file, type) {
+      const isJPG = file.type === 'image/jpeg'
+      const isPng = file.type === 'image/png'
+      const isLt2M = file.size / 1024 / 1024 < 2
 
-            this.accountApplyTab = false
-            this.accountApply = getDefaultVal()
-            this.activeTab = 'history'
-            this.$store.dispatch('user/finnishApply', true)
-            this.historyList()
-          }
-        })
-      } else {
+      if (!isJPG && !isPng) {
+        this.$message.error('上传图片只能是 JPG或png 格式!')
         return false
       }
-    })
-  }
-  // 上传之前做验证和文件转换
-  beforePicUpload(file, type) {
-    const isJPG = file.type === 'image/jpeg'
-    const isPng = file.type === 'image/png'
-    const isLt2M = file.size / 1024 / 1024 < 2
-
-    if (!isJPG && !isPng) {
-      this.$message.error('上传图片只能是 JPG或png 格式!')
-      return false
-    }
-    if (!isLt2M) {
-      this.$message.error('上传头像图片大小不能超过 2MB!')
+      if (!isLt2M) {
+        this.$message.error('上传头像图片大小不能超过 2MB!')
+        return false
+      }
+      const _this = this
+      const reader = new FileReader()
+      type === 'sign' ? (this.accountApply.electronicFile = file) : (this.accountApply.file = file)
+      // 转base64
+      reader.onload = function (e) {
+        type === 'sign' ? (_this.esign = e.target.result.toString()) : (_this.head = e.target.result.toString()) // 将图片路径赋值给src
+      }
+      reader.readAsDataURL(file)
       return false
     }
-    const _this = this
-    const reader = new FileReader()
-    type === 'sign' ? (this.accountApply.electronicFile = file) : (this.accountApply.file = file)
-    // 转base64
-    reader.onload = function(e) {
-      type === 'sign' ? (_this.esign = e.target.result.toString()) : (_this.head = e.target.result.toString()) // 将图片路径赋值给src
+    // 获取部门
+    getdepartmentId() {
+      getAllDepartments().then((res) => {
+        this.departmentIdOptions = res.result || []
+      })
     }
-    reader.readAsDataURL(file)
-    return false
-  }
-  // 获取部门
-  getdepartmentId() {
-    getAllDepartments().then((res) => {
-      this.departmentIdOptions = res.result || []
-    })
-  }
 
-  get deptmentTree() {
-    const getChildren = (parent) => {
-      const { id: parentId } = parent
-      const children = this.departmentIdOptions.filter((item) => item.parentId === parentId)
-      if (!!children.length) parent.children = children.map(getChildren)
-      return parent
+    get deptmentTree() {
+      const getChildren = (parent) => {
+        const { id: parentId } = parent
+        const children = this.departmentIdOptions.filter((item) => item.parentId === parentId)
+        if (!!children.length) parent.children = children.map(getChildren)
+        return parent
+      }
+      return this.departmentIdOptions.filter((item) => !item.parentId).map(getChildren)
     }
-    return this.departmentIdOptions.filter((item) => !item.parentId).map(getChildren)
-  }
 
-  // 获取审核人
-  getAuditors() {
-    getAllAuditors(null).then((res) => {
-      this.recipients = res.result.map((item) => {
-        return {
-          name: item.realName,
-          id: item.id,
-          departmentId: item.departmentId
-        }
+    // 获取审核人
+    getAuditors() {
+      getAllAuditors(null).then((res) => {
+        this.recipients = res.result.map((item) => {
+          return {
+            name: item.realName,
+            id: item.id,
+            departmentId: item.departmentId
+          }
+        })
       })
-    })
-  }
-  handleSizeChange(size) {
-    this.pageSize = size
-    this.historyList()
-  }
-  handleCurrentChange(data) {
-    this.page = data
-    this.historyList()
+    }
+    handleSizeChange(size) {
+      this.pageSize = size
+      this.historyList()
+    }
+    handleCurrentChange(data) {
+      this.page = data
+      this.historyList()
+    }
   }
-}
 </script>
 
 <style lang="scss" scoped>
-.apply-account-container {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  .avatar-uploader .el-upload {
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    overflow: hidden;
-  }
-  .avatar-uploader .el-upload:hover {
-    border-color: #409eff;
-  }
-  .avatar-uploader-icon {
-    font-size: 28px;
-    color: #8c939d;
-    width: 178px;
-    height: 178px;
-    line-height: 178px;
-    text-align: center;
-  }
-  .avatar {
-    width: 178px;
-    height: 178px;
-    display: block;
-    object-fit: cover;
-  }
-  .msg {
-    color: #c0c4cc;
-    font-size: 12px;
-    line-height: 20px;
-  }
-}
-.base-info {
-  .el-row {
+  .apply-account-container {
     display: flex;
-    margin-bottom: 20px;
-    .title {
-      display: inline-block;
-      width: 100px;
-      text-align: right;
+    justify-content: center;
+    align-items: center;
+    .avatar-uploader .el-upload {
+      border: 1px dashed #d9d9d9;
+      border-radius: 6px;
+      cursor: pointer;
+      position: relative;
+      overflow: hidden;
     }
-    .title + span,
-    img {
-      display: inline-block;
-      width: 380px;
+    .avatar-uploader .el-upload:hover {
+      border-color: #409eff;
+    }
+    .avatar-uploader-icon {
+      font-size: 28px;
+      color: #8c939d;
+      width: 178px;
+      height: 178px;
+      line-height: 178px;
+      text-align: center;
+    }
+    .avatar {
+      width: 178px;
+      height: 178px;
+      display: block;
+      object-fit: cover;
     }
-    img {
-      width: 120px;
+    .msg {
+      color: #c0c4cc;
+      font-size: 12px;
+      line-height: 20px;
     }
   }
-}
-.custom-row {
-  display: flex;
-  margin-bottom: 20px;
-  span {
-    display: inline-block;
-    width: 80%;
-    &.title {
-      width: 100px;
-      text-align: right;
+  .base-info {
+    .el-row {
+      display: flex;
+      margin-bottom: 20px;
+      .title {
+        display: inline-block;
+        width: 100px;
+        text-align: right;
+      }
+      .title + span,
+      img {
+        display: inline-block;
+        width: 380px;
+      }
+      img {
+        width: 120px;
+      }
+    }
+  }
+  .custom-row {
+    display: flex;
+    margin-bottom: 20px;
+    span {
+      display: inline-block;
+      width: 80%;
+      &.title {
+        width: 100px;
+        text-align: right;
+      }
     }
   }
-}
 </style>

+ 239 - 241
src/layout/components/Header/UserInfoEdit.vue

@@ -65,9 +65,7 @@
               <img v-if="form.avatar" :src="form.avatar" class="avatar" />
               <i v-else class="el-icon-plus avatar-uploader-icon el-upload" />
             </el-upload>
-            <div class="msg">
-              ⚠️注意:上传图片只能是 JPG/JPEG 或png 格式!单张图片大小不能超过 2MB!
-            </div>
+            <div class="msg">⚠️注意:上传图片只能是 JPG/JPEG 或png 格式!单张图片大小不能超过 2MB!</div>
           </el-form-item>
         </el-col>
       </el-row>
@@ -80,274 +78,274 @@
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop } from 'vue-property-decorator'
-// import { getInfo } from '@/api/dashboard'
-import { editUser, getUserList } from '@/api/base'
-import { getRemoteImg } from '@/api/ftp'
-import { regUserName, regPhone, regEmail } from '@/utils/reg'
-import { ElForm } from 'element-ui/types/form'
-@Component({})
-export default class UserInfoEdit extends Vue {
-  @Prop({ default: false }) showApply: boolean
+  import { Vue, Component, Prop } from 'vue-property-decorator'
+  // import { getInfo } from '@/api/dashboard'
+  import { editUser, getUserList } from '@/api/base'
+  import { getRemoteFile } from '@/api/ftp'
+  import { regUserName, regPhone, regEmail } from '@/utils/reg'
+  import { ElForm } from 'element-ui/types/form'
+  @Component({})
+  export default class UserInfoEdit extends Vue {
+    @Prop({ default: false }) showApply: boolean
 
-  difference = true
-  data = null
-  ruleForm = {
-    username: '',
-    // password: '',
-    realName: '',
-    phone: '',
-    email: '',
-    departmentId: '',
-    roles: [],
-    job: '',
-    note: '',
-    file: '',
-    electronicFile: ''
-  }
-  form = {
-    avatar: '',
-    signPic: '',
-    imageUrl: ''
-  }
-  rules = {
-    username: [
-      { required: true, message: '请输入登录名', trigger: 'blur' },
-      {
-        pattern: regUserName(),
-        message: '登录名只能输入英文、数字',
-        trigger: 'blur'
-      }
-    ],
-    realName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
-    phone: [{ pattern: regPhone(), message: '请输入正确联系手机号', trigger: 'blur' }],
-    email: [{ pattern: regEmail(), message: '请输入正确邮箱', trigger: 'blur' }]
-  }
-  mounted() {
-    this.getUserInfo()
-  }
-  /**
-   * @description 获取用户信息
-   */
-  getUserInfo() {
-    const userId = this.$store.state.user.userId
+    difference = true
+    data = null
+    ruleForm = {
+      username: '',
+      // password: '',
+      realName: '',
+      phone: '',
+      email: '',
+      departmentId: '',
+      roles: [],
+      job: '',
+      note: '',
+      file: '',
+      electronicFile: ''
+    }
+    form = {
+      avatar: '',
+      signPic: '',
+      imageUrl: ''
+    }
+    rules = {
+      username: [
+        { required: true, message: '请输入登录名', trigger: 'blur' },
+        {
+          pattern: regUserName(),
+          message: '登录名只能输入英文、数字',
+          trigger: 'blur'
+        }
+      ],
+      realName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
+      phone: [{ pattern: regPhone(), message: '请输入正确联系手机号', trigger: 'blur' }],
+      email: [{ pattern: regEmail(), message: '请输入正确邮箱', trigger: 'blur' }]
+    }
+    mounted() {
+      this.getUserInfo()
+    }
+    /**
+     * @description 获取用户信息
+     */
+    getUserInfo() {
+      const userId = this.$store.state.user.userId
 
-    var that = this
-    getUserList({ id: userId }).then((res) => {
-      console.log(res)
-      if (res.code !== -1) {
-        const result = res.result
-        if (result.records.length > 0) {
-          that.data = result.records[0]
-          that.data.phone = that.strIsNull(that.data.phone) ? '' : that.data.phone // 联系电话
-          that.data.email = that.strIsNull(that.data.email) ? '' : that.data.email // 邮箱
-          that.data.job = that.strIsNull(that.data.job) ? '' : that.data.job // 工作岗位
-          that.data.note = that.strIsNull(that.data.note) ? '' : that.data.note // 工作职责
-          this.$store.commit('user/SET_AVATAR', getRemoteImg(that.data.avatar))
-          that.handleEdit()
+      var that = this
+      getUserList({ id: userId }).then((res) => {
+        console.log(res)
+        if (res.code !== -1) {
+          const result = res.result
+          if (result.records.length > 0) {
+            that.data = result.records[0]
+            that.data.phone = that.strIsNull(that.data.phone) ? '' : that.data.phone // 联系电话
+            that.data.email = that.strIsNull(that.data.email) ? '' : that.data.email // 邮箱
+            that.data.job = that.strIsNull(that.data.job) ? '' : that.data.job // 工作岗位
+            that.data.note = that.strIsNull(that.data.note) ? '' : that.data.note // 工作职责
+            this.$store.commit('user/SET_AVATAR', getRemoteFile(that.data.avatar))
+            that.handleEdit()
+          } else {
+            that.$message.error('未查询到相关的用户信息')
+          }
         } else {
-          that.$message.error('未查询到相关的用户信息')
+          // @ts-ignore
+          that.$message.error(res.$message)
         }
-      } else {
-        // @ts-ignore
-        that.$message.error(res.$message)
-      }
-    })
-  }
+      })
+    }
 
-  // 上传之前的钩子函数
-  beforeAvatarUpload(file, type) {
-    const isJPG = file.type === 'image/jpeg'
-    const isPng = file.type === 'image/png'
-    const isLt2M = file.size / 1024 / 1024 < 2
+    // 上传之前的钩子函数
+    beforeAvatarUpload(file, type) {
+      const isJPG = file.type === 'image/jpeg'
+      const isPng = file.type === 'image/png'
+      const isLt2M = file.size / 1024 / 1024 < 2
 
-    if (!isJPG && !isPng) {
-      this.$message.error('上传图片只能是 JPG或png 格式!')
-      return false
-    }
-    if (!isLt2M) {
-      this.$message.error('上传头像图片大小不能超过 2MB!')
-      return false
+      if (!isJPG && !isPng) {
+        this.$message.error('上传图片只能是 JPG或png 格式!')
+        return false
+      }
+      if (!isLt2M) {
+        this.$message.error('上传头像图片大小不能超过 2MB!')
+        return false
+      }
+      // console.log('2222', file)
+      type === 'avatar' ? (this.ruleForm.file = file) : (this.ruleForm.electronicFile = file)
+      const _this = this
+      const reader = new FileReader()
+      // 转base64
+      reader.onload = function (e) {
+        type === 'sign'
+          ? (_this.form.signPic = e.target.result.toString())
+          : (_this.form.avatar = e.target.result.toString()) // 将图片路径赋值给src
+      }
+      reader.readAsDataURL(file)
+      return false // 屏蔽了action的默认上传
     }
-    // console.log('2222', file)
-    type === 'avatar' ? (this.ruleForm.file = file) : (this.ruleForm.electronicFile = file)
-    const _this = this
-    const reader = new FileReader()
-    // 转base64
-    reader.onload = function(e) {
-      type === 'sign'
-        ? (_this.form.signPic = e.target.result.toString())
-        : (_this.form.avatar = e.target.result.toString()) // 将图片路径赋值给src
+    // 图片上传成功实现本地预览
+    handleAvatarSuccess(res, file) {
+      this.form.imageUrl = URL.createObjectURL(file.raw) // 表单获取到提交时要传的图片路径
     }
-    reader.readAsDataURL(file)
-    return false // 屏蔽了action的默认上传
-  }
-  // 图片上传成功实现本地预览
-  handleAvatarSuccess(res, file) {
-    this.form.imageUrl = URL.createObjectURL(file.raw) // 表单获取到提交时要传的图片路径
-  }
 
-  // 拼接数据
-  readyData() {
-    const data = new FormData()
-    // data.append('file', this.ruleForm.file)// 图片
-    // 传其他参数
-    for (const key in this.ruleForm) {
-      if (key === 'roles') {
-        data.append(key, this.ruleForm[key].toString())
-      } else if (key === 'phone' || key === 'email' || key === 'job' || key === 'note') {
-        let tempVal = this.ruleForm[key] + ''
-        if (this.strIsNull(tempVal)) {
-          tempVal = 'null'
+    // 拼接数据
+    readyData() {
+      const data = new FormData()
+      // data.append('file', this.ruleForm.file)// 图片
+      // 传其他参数
+      for (const key in this.ruleForm) {
+        if (key === 'roles') {
+          data.append(key, this.ruleForm[key].toString())
+        } else if (key === 'phone' || key === 'email' || key === 'job' || key === 'note') {
+          let tempVal = this.ruleForm[key] + ''
+          if (this.strIsNull(tempVal)) {
+            tempVal = 'null'
+          }
+          data.append(key, tempVal)
+        } else {
+          data.append(key, this.ruleForm[key])
         }
-        data.append(key, tempVal)
-      } else {
-        data.append(key, this.ruleForm[key])
       }
+      // 编辑添加id
+      data.append('id', this.data.id)
+      return data
     }
-    // 编辑添加id
-    data.append('id', this.data.id)
-    return data
-  }
-  // 提交
-  submitForm() {
-    const _this = this
-    ;(this.$refs.ruleForm as ElForm).validate((valid) => {
-      if (valid) {
-        const data = _this.readyData()
-        _this.editSubmit(data)
-      } else {
-        return false
-      }
-    })
-  }
-
-  // 修改提交
-  editSubmit(data) {
-    const _this = this
-    editUser(data).then((res) => {
-      if (res.code !== -1) {
-        if (res.result.code === -1) {
-          this.$message.error(res.result.message)
+    // 提交
+    submitForm() {
+      const _this = this
+      ;(this.$refs.ruleForm as ElForm).validate((valid) => {
+        if (valid) {
+          const data = _this.readyData()
+          _this.editSubmit(data)
         } else {
-          this.getUserInfo()
-          _this.$message.success('修改成功')
-          _this.closeDialog()
+          return false
         }
-      }
-    })
-  }
+      })
+    }
 
-  // 编辑参数回显
-  handleEdit() {
-    this.ruleForm = this.assignment(this.ruleForm, this.data) as any
-    // const arr = [this.data.avatar, this.data.esignature]
-    // arr.forEach((item, index) => {
-    //   if (item === null) return
-    //   getRemoteImg(item).then((res) => {
-    //     if (res.status === 200) {
-    //       index === 1
-    //         ? (this.form.signPic = res.config.url)
-    //         : (this.form.avatar = res.config.url)
-    //     }
-    //   })
-    // })
-    this.form = {
-      ...this.form,
-      signPic: getRemoteImg(this.data.esignature),
-      avatar: getRemoteImg(this.data.avatar)
+    // 修改提交
+    editSubmit(data) {
+      const _this = this
+      editUser(data).then((res) => {
+        if (res.code !== -1) {
+          if (res.result.code === -1) {
+            this.$message.error(res.result.message)
+          } else {
+            this.getUserInfo()
+            _this.$message.success('修改成功')
+            _this.closeDialog()
+          }
+        }
+      })
     }
-  }
 
-  // 赋值
-  assignment(par, role) {
-    const data = {}
-    for (const key in par) {
-      if (key === 'roles') {
-        data[key] = role.roleIdList && role.roleIdList != null && role.roleIdList.split(',')
-      } else {
-        data[key] = role[key]
+    // 编辑参数回显
+    handleEdit() {
+      this.ruleForm = this.assignment(this.ruleForm, this.data) as any
+      // const arr = [this.data.avatar, this.data.esignature]
+      // arr.forEach((item, index) => {
+      //   if (item === null) return
+      //   getRemoteFile(item).then((res) => {
+      //     if (res.status === 200) {
+      //       index === 1
+      //         ? (this.form.signPic = res.config.url)
+      //         : (this.form.avatar = res.config.url)
+      //     }
+      //   })
+      // })
+      this.form = {
+        ...this.form,
+        signPic: getRemoteFile(this.data.esignature),
+        avatar: getRemoteFile(this.data.avatar)
       }
     }
-    return data
-  }
 
-  // 关闭dialog
-  closeDialog() {
-    this.$emit('update:showApply', false)
-  }
+    // 赋值
+    assignment(par, role) {
+      const data = {}
+      for (const key in par) {
+        if (key === 'roles') {
+          data[key] = role.roleIdList && role.roleIdList != null && role.roleIdList.split(',')
+        } else {
+          data[key] = role[key]
+        }
+      }
+      return data
+    }
 
-  /*
-   * @description 判断字符串是否为空
-   */
-  strIsNull(strVal) {
-    strVal = strVal || ''
-    return typeof strVal === 'undefined' || strVal == null || strVal == '' || strVal == 'null'
+    // 关闭dialog
+    closeDialog() {
+      this.$emit('update:showApply', false)
+    }
+
+    /*
+     * @description 判断字符串是否为空
+     */
+    strIsNull(strVal) {
+      strVal = strVal || ''
+      return typeof strVal === 'undefined' || strVal == null || strVal == '' || strVal == 'null'
+    }
   }
-}
 </script>
 
 <style lang="scss" scoped>
-.apply-account-container {
-  .avatar-uploader .el-upload {
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    overflow: hidden;
-  }
-  .avatar-uploader .el-upload:hover {
-    border-color: #409eff;
-  }
-  .avatar-uploader-icon {
-    font-size: 28px;
-    color: #8c939d;
-    width: 178px;
-    height: 178px;
-    line-height: 178px;
-    text-align: center;
-  }
-  .avatar {
-    width: 178px;
-    height: 178px;
-    display: block;
-    // object-fit: cover;
+  .apply-account-container {
+    .avatar-uploader .el-upload {
+      border: 1px dashed #d9d9d9;
+      border-radius: 6px;
+      cursor: pointer;
+      position: relative;
+      overflow: hidden;
+    }
+    .avatar-uploader .el-upload:hover {
+      border-color: #409eff;
+    }
+    .avatar-uploader-icon {
+      font-size: 28px;
+      color: #8c939d;
+      width: 178px;
+      height: 178px;
+      line-height: 178px;
+      text-align: center;
+    }
+    .avatar {
+      width: 178px;
+      height: 178px;
+      display: block;
+      // object-fit: cover;
+    }
+    .msg {
+      color: #c0c4cc;
+      font-size: 12px;
+      line-height: 20px;
+    }
   }
-  .msg {
-    color: #c0c4cc;
-    font-size: 12px;
-    line-height: 20px;
+  .base-info {
+    .el-row {
+      display: flex;
+      margin-bottom: 20px;
+      .title {
+        display: inline-block;
+        width: 100px;
+        text-align: right;
+      }
+      .title + span,
+      img {
+        display: inline-block;
+        width: 380px;
+      }
+      img {
+        width: 120px;
+      }
+    }
   }
-}
-.base-info {
-  .el-row {
+  .custom-row {
     display: flex;
     margin-bottom: 20px;
-    .title {
-      display: inline-block;
-      width: 100px;
-      text-align: right;
-    }
-    .title + span,
-    img {
+    span {
       display: inline-block;
-      width: 380px;
-    }
-    img {
-      width: 120px;
-    }
-  }
-}
-.custom-row {
-  display: flex;
-  margin-bottom: 20px;
-  span {
-    display: inline-block;
-    width: 80%;
-    &.title {
-      width: 100px;
-      text-align: right;
+      width: 80%;
+      &.title {
+        width: 100px;
+        text-align: right;
+      }
     }
   }
-}
 </style>

+ 1 - 1
src/settings.js

@@ -48,5 +48,5 @@ module.exports = {
   settings: true,
 
   // 系统名称
-  sysTitle: '三峡发展智慧EPC综合决策分析中心'
+  sysTitle: '三峡发展智慧EPC综合决策分析平台'
 }

+ 7 - 7
src/store/modules/user.ts

@@ -1,6 +1,6 @@
-import { login, logout,loginwithcode } from '@/api/user'
+import { login, logout, loginwithcode } from '@/api/user'
 import { getToken, setToken, removeToken, setSessionStorage, removeSessionStorage } from '@/utils/auth'
-import { getRemoteImg } from '@/api/ftp'
+import { getRemoteFile } from '@/api/ftp'
 import { resetRouter } from '@/router'
 const sha1Hex = require('sha1-hex')
 
@@ -52,10 +52,10 @@ const mutations = {
 const actions = {
   // user login
   login({ commit, dispatch }, userInfo) {
-    const { username, password,msg } = userInfo
+    const { username, password, msg } = userInfo
     // setSessionStorage('username', username)
     return new Promise((resolve, reject) => {
-      loginwithcode({ username: username, password: sha1Hex(password),shortMessageCode:msg })
+      loginwithcode({ username: username, password: sha1Hex(password), shortMessageCode: msg })
         .then((response) => {
           // console.log('2222', response)
           // const data = {
@@ -77,14 +77,14 @@ const actions = {
           setSessionStorage('userId', id)
           setSessionStorage('departmentId', departmentId)
           if (avatar) {
-            // getRemoteImg(avatar).then(res => {
+            // getRemoteFile(avatar).then(res => {
             //   if (res.status === 200) {
             //     commit('SET_AVATAR', res.config.url)
             //     setSessionStorage('avatar', res.config.url)
             //   }
             // })
-            commit('SET_AVATAR', getRemoteImg(avatar))
-            setSessionStorage('avatar', getRemoteImg(avatar))
+            commit('SET_AVATAR', getRemoteFile(avatar))
+            setSessionStorage('avatar', getRemoteFile(avatar))
           }
           resolve(response)
         })

+ 7 - 8
src/views/OnlineImport/widgets/DataImport/components/PbsTree.vue

@@ -8,7 +8,7 @@
   </div>
 </template>
 <script>
-import request from '@/utils/request'
+import {pbsTreeList_api} from '@/api/APIs'
 export default {
   name: "commonTree",//显示工程树
   data() {
@@ -27,10 +27,7 @@ export default {
   },
   methods: {
     getPbsTree() {
-      request({
-        method: "get",
-        url: "/tofly-sxgk/structure/list"
-      }).then(res => {
+      pbsTreeList_api({}).then(res => {
         const { code, result } = res;
         if (code === 1) {
           function formatTree(obj) {
@@ -45,8 +42,11 @@ export default {
               return parent.pid === null; // 返回顶层,依据实际情况判断这里的返回值
             });
           }
-          if (result[0])
-            this.datas = formatTree(result[0].structures);
+          if (result[0]){
+            let data=formatTree(result[0].structures);
+            this.datas = data
+            this.$emit('getTreeList',data);
+          }
         } else {
           this.$message.error("信息获取失败");
         }
@@ -54,7 +54,6 @@ export default {
     },
     // 点击tree节点
     nodeClick(item) {
-      debugger;
       const { id, name, code } = item
       this.treeValue.id = id;
       this.treeValue.label = name;

+ 0 - 1
src/views/OnlineImport/widgets/DataImport/widget.vue

@@ -108,7 +108,6 @@ import PbsTree from './components/PbsTree.vue'
 import { getDefaultPagination } from '@/utils/constant'
 import { pageSizes } from '@/utils/constant'
 import { IPagination } from '@/api/common'
-import { result } from 'lodash'
 @Component({
   name: 'DataImport',
   components: { PbsTree }

+ 808 - 0
src/views/OnlineImport/widgets/PipeOnlineImport/widget.vue

@@ -0,0 +1,808 @@
+<template>
+  <div>
+    <tf-page>
+      <template v-slot:action>
+        <el-row style="padding-bottom:10px;">
+          <el-col :span="12">
+            <el-row>
+              <el-col></el-col>
+            </el-row>
+            <span></span>
+            <span>工程名称</span>
+            <pbs-tree @getTreeList="getTreeList" @changeProjectName="treeNodeClick" style="width:50%;display:inline-block;"></pbs-tree>
+            <el-button type="primary" size="mini">查询</el-button>
+          </el-col>
+          <el-col :span="6" :offset="6">
+            <el-button type="primary" size="mini">数据发布</el-button>
+          </el-col>
+        </el-row>
+      </template>
+      <tf-table :stripe='false' row-key="id" border style='width:100%' :data="tableData" :tree-props="{children:'children'}">
+        <el-table-column prop="name" label="节点名称" width="400">
+
+        </el-table-column>
+        <el-table-column prop="code" label="PBS编码">
+
+        </el-table-column>
+        <el-table-column prop="levelname" label="类型">
+
+        </el-table-column>
+        <el-table-column prop="" label="发布状态">
+
+        </el-table-column>
+        <el-table-column prop="" label="创建时间">
+
+        </el-table-column>
+        <el-table-column prop="" label="操作">
+          <template slot-scope="scope">
+            <div v-if="scope.row.levelname==='工程'||scope.row.levelname==='单项工程'||scope.row.levelname==='单位工程(CWP)'">
+              <el-button size="mini" type="success" @click="openNewNode(scope.row)">新建</el-button>
+            </div>
+            <div v-else-if="scope.row.levelname==='分部工程(专业)'">
+              <el-button size="mini" type="primary" @click="pipeDataImport(scope.row)">导入</el-button>
+              <el-button size="mini" type="danger">删除</el-button>
+            </div>
+            <div v-else>
+              <el-button size="mini" type="success" @click="openNewNode(scope.row)">新建</el-button>
+              <el-button size="mini" type="danger">删除</el-button>
+            </div>
+          </template>
+        </el-table-column>
+      </tf-table>
+    </tf-page>
+    <tf-dialog :visible.sync="newNodeDialogShow" title="新建下级节点" width="600px">
+      <el-form :model="addNodeForm" label-width="140px">
+        <el-form-item label="当前节点">
+          <el-input v-model="addNodeForm.pName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="当前节点PBS编码">
+          <el-input v-model="addNodeForm.pCode" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="下级节点选择">
+          <el-select @change="nextNodeChange()" v-model="addNodeForm.id" clearable style="width:100%">
+            <el-option v-for="(item,index) in nodeOptions" :key="index" :label="item.name" :value="item.value">
+              <span style="float: left">{{ item.name }}</span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="下级节点PBS编码">
+          <el-input v-model="addNodeForm.code" disabled></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" style="text-align:right;">
+        <el-button type="primary" @click="addNodeSubmit()" size="small">提 交</el-button>
+        <el-button @click="newNodeDialogShow = false" size="small">取 消</el-button>
+      </div>
+    </tf-dialog>
+    <tf-dialog class="fullDialog" title="管线数据导入" max-width="100%" max-height="calc(100vh - 54px)" :fullscreen="true" :visible.sync="importDialogShow">
+      <el-container style="height:100%;">
+        <el-aside width="300px" style="overflow-x:hidden">
+          <div>
+            <el-form ref='addForm' :model="impForm" size="mini">
+              <el-form-item label="项目工程" prop="prjName" class="impForm" :rules="addRules">
+                <pbs-tree @changeProjectName="treeNodeClick" style="width:100%;"></pbs-tree>
+                <!-- <el-input v-model="impForm.prjName"></el-input> -->
+              </el-form-item>
+              <el-form-item label="数据阶段" prop="stage">
+                <el-select v-model="impForm.stage" style="width:100%">
+                  <el-option label="设计" value="SJ"></el-option>
+                  <!-- <el-option label="普查" value="PC"></el-option>
+          <el-option label="竣工" value="JG"></el-option> -->
+                </el-select>
+              </el-form-item>
+              <el-form-item label="成果表">
+                <el-upload class="eluploadcontainer" action="https://jsonplaceholder.typicode.com/posts/" :file-list="fileList" accept=".xls,.xlsx" multiple :limit="2" :before-remove="onBeforeRemove" :on-remove="onRemove" :on-change="onChange" :auto-upload="false" :on-exceed="onExceed">
+                  <el-button slot="trigger" size="small" type="primary">本地文件</el-button>
+                  <el-button size="small" type="primary" @click="OnlineAccess">在线获取</el-button>
+                </el-upload>
+              </el-form-item>
+              <el-form-item>
+                <el-row :gutter="20">
+                  <el-col :span="12">
+                    <el-button type="primary" style="width:100%" @click="buildDatasets">预览</el-button>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-button type="primary" style="width:100%" @click="zsbuildDatasets">提交</el-button>
+                  </el-col>
+                </el-row>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" style="width:100%" @click="deleteData">删除数据</el-button>
+              </el-form-item>
+            </el-form>
+            <tf-dialog title="在线获取数据成果" :visible.sync="dialogVisible" width="80%" top="3%">
+              <el-form :inline="true" class="toolbar" size="mini">
+                <el-form-item label="所属区域">
+                  <el-select v-model="areaName" filterable clearable placeholder="请选择" size="mini">
+                    <el-option v-for="item in prjOptions" :key="item.code" :label="item.name" :value="item.value">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="项目">
+                  <el-select v-model="selectPrjId" filterable clearable placeholder="请选择" size="mini">
+                    <el-option v-for="item in optionsoffter" :key="item.key" :label="item.name" :value="item.value">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item>
+                  <el-input v-model="queryPara" clearable placeholder="支持数据名称,上传单位">
+                    <el-button type="primary" slot="append" size="mini" icon="el-icon-search" @click="getlist"></el-button>
+                  </el-input>
+                  <!-- <el-button type="primary" size="mini" icon="el-icon-search" @click="getlist"></el-button> -->
+                </el-form-item>
+                <el-form-item label="提交状态">
+                  <el-radio-group v-model="radio" @change="getlist">
+                    <el-radio label="">全部</el-radio>
+                    <el-radio label="1">未提交</el-radio>
+                    <el-radio label="0">已提交</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+                <el-form-item>
+                  <el-radio-group v-model="radio2" @change="getlist">
+                    <el-radio label="">全部</el-radio>
+                    <el-radio label="2">设计</el-radio>
+                    <el-radio label="1">普查</el-radio>
+                    <el-radio label="3">竣工</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+              </el-form>
+              <!-- 弹出框表单 -->
+              <div class="content-body" style="height:410px;">
+                <tf-table @page-change="onPageChange" :data="onlineRecords" :pagination="pagination">
+                  <template slot="empty">
+                    <img src="@/assets/icon/null.png" alt="暂无数据" />
+                  </template>
+                  <el-table-column prop="id" label="ID" width="100"></el-table-column>
+                  <el-table-column prop="areaName" label="所属区域"></el-table-column>
+                  <el-table-column prop="fullName" label="项目"></el-table-column>
+                  <el-table-column prop="division" label="片区"></el-table-column>
+                  <el-table-column prop="batchName" label="数据名称" :show-overflow-tooltip="true"></el-table-column>
+                  <el-table-column prop="dataSource" label="数据阶段"></el-table-column>
+                  <el-table-column prop="submitStatus" label="提交状态"></el-table-column>
+                  <el-table-column prop="detectionUnit" label="上传单位" :show-overflow-tooltip="true"></el-table-column>
+                  <el-table-column prop="updateTime" label="上传时间" width="150px"></el-table-column>
+                  <el-table-column label="下载" width="50">
+                    <template slot-scope="scope">
+                      <el-button type="text" icon="el-icon-download" @click="downLoadFile(scope.row)"></el-button>
+                    </template>
+                  </el-table-column>
+                </tf-table>
+              </div>
+              <!-- <div class="content-footer">
+        <el-pagination class="pagination" @size-change="onPageChange" @current-change="onPageChange" :current-page="pagination.current" :page-sizes="pageSizes" :page-size="pagination.size" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
+      </div> -->
+            </tf-dialog>
+          </div>
+        </el-aside>
+        <el-main>
+          <el-tabs>
+            <el-tab-pane label="表格"></el-tab-pane>
+            <el-tab-pane label="地图"></el-tab-pane>
+          </el-tabs>
+        </el-main>
+      </el-container>
+      <div slot="footer">
+      </div>
+    </tf-dialog>
+  </div>
+</template>
+
+<script lang='ts'>
+/**
+ *@description 该功能为管网数据在线入库
+ *@author lishun <876330731@qq.com>
+ */
+import { Vue, Prop, Watch, Component } from 'vue-property-decorator'
+import request, { IP } from '@/utils/request'
+import { getDefaultPagination } from '@/utils/constant'
+import {
+  pbsTreeList_api,
+  getStructureDetailByID,
+  getPbsLevelByID,
+  getPbsLevelPage,
+  getBoinfoPage,
+  getPbsCodeDetailPage
+} from '@/api/APIs'
+import { pageSizes } from '@/utils/constant'
+import { IPagination } from '@/api/common'
+import PbsTree from '../DataImport/components/PbsTree.vue'
+@Component({
+  name: 'PipeOnlineImprt',
+  components: { PbsTree }
+})
+export default class PipeOnlineImprt extends Vue {
+  impForm = {
+    prjName: '',
+    stage: 'SJ',
+    paperName: '',
+    paperUnit: '',
+    paperPerson: '',
+    origin: ''
+  }
+  /**新建下级节点弹框显隐 */
+  newNodeDialogShow = false
+  /**导入弹框显隐控制 */
+  importDialogShow=false
+  /**下级节点列表 */
+  nodeOptions = []
+  /**下级节点连接符 */
+  connector = ''
+  tableData = []
+  pageSizes = pageSizes
+  addNodeForm = {
+    pName: '',
+    pCode: '',
+    id: '',
+    code: ''
+  }
+  addRules = {
+    prjName: [{ required: true, message: '请选择单位工程', trigger: 'blur' }],
+    stage: [{ required: true, message: '请选择数据阶段', trigger: 'change' }],
+    paperName: [{ required: true, message: '请输入图纸名称', trigger: 'blur' }],
+    paperUnit: [{ required: true, message: '请输入图纸提供单位', trigger: 'blur' }],
+    paperPerson: [{ required: true, message: '请输入图纸提供人', trigger: 'blur' }]
+  }
+  /**
+   * PBS结构树层级ID
+   */
+  selectProjID = null
+  /**
+  在线获取弹窗开关
+   */
+  dialogVisible = false
+  radio = ''
+  radio2 = ''
+  areaName = ''
+  selectPrjId = ''
+  queryPara = ''
+  prjOptions = []
+  optionsoffter = [{ name: '全部', value: '', key: '2' }]
+  pagination: IPagination = getDefaultPagination()
+  tableColumns = [
+    {
+      prop: 'id',
+      label: 'ID'
+    },
+    {
+      prop: 'areaName',
+      label: '所属区域'
+    },
+    {
+      prop: 'fullName',
+      label: '项目'
+    },
+    {
+      prop: 'division',
+      label: '片区'
+    },
+    {
+      prop: 'batchName',
+      label: '数据名称',
+      showOverflowTooltip: true
+    },
+    {
+      prop: 'dataSource',
+      label: '数据阶段'
+    },
+    {
+      prop: 'submitStatus',
+      label: '提交状态'
+    },
+    {
+      prop: 'detectionUnit',
+      label: '上传单位',
+      showOverflowTooltip: true
+    },
+    {
+      prop: 'proName',
+      label: '上传人'
+    },
+    {
+      prop: 'updateTime',
+      label: '上传时间',
+      minWidth: '150px'
+    },
+    {
+      slot: 'DownloadBtn',
+      width: '50px'
+    }
+  ]
+  /**
+   * 在线文件列表数据
+   */
+  onlineRecords = []
+  /**
+   * 上传文件
+   */
+  fileList = []
+  /**
+   * 最终提交的上传文件
+   */
+  files = []
+  onBeforeRemove(file, fileList) {
+    return this.$confirm(`确定移除${file.name}?`)
+  }
+  onRemove(file, fileList) {
+    this.fileList = fileList
+  }
+  onCheckFile(file) {
+    let fileName = file.name
+    let esuffixt = fileName.substr(fileName.lastIndexOf('.') + 1)
+
+    const isIMAGE = esuffixt === 'xls' || esuffixt === 'xlsx'
+    //const isLt1M = file.size / 1024 / 1024 < 10
+
+    if (!isIMAGE) {
+      this.$message.error('上传文件只能是excel文件!')
+    }
+    // if (!isLt1M) {
+    //   this.$message.error('上传文件大小不能超过 10MB!')
+    // }
+    return isIMAGE
+  }
+  onChange(file, fileList) {
+    const isLoad = this.onCheckFile(file.raw)
+    if (isLoad) {
+      this.fileMap(fileList)
+    } else {
+      fileList.pop()
+    }
+  }
+  fileMap(fileList) {
+    if (fileList.length !== 0) {
+      const files = fileList.map((v) => {
+        return v.raw
+      })
+      this.files = files
+    }
+  }
+  getTreeList(list) {
+    console.log(list)
+    this.tableData = list
+  }
+  onExceed(files, fileList) {
+    this.$message.warning(
+      `当前限制选择 2 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`
+    )
+  }
+  treeNodeClick(info) {
+    if (!info) return
+    this.selectProjID = info.id
+  }
+  /**
+   * 该方法用于新建节点
+   */
+  openNewNode(row) {
+    this.addNodeForm.id = ''
+    this.addNodeForm.code = ''
+    this.newNodeDialogShow = true
+    this.addNodeForm.pName = row.name
+    this.addNodeForm.pCode = row.code
+    getStructureDetailByID({ id: row.id }).then((result) => {
+      //获取PBSlevel id
+      if (result.code === 1) {
+        getPbsLevelByID({ id: result.result.pbslevelId }).then((pbslevel) => {
+          //获取pbslevel信息
+          if (pbslevel.code === 1) {
+            this.connector = pbslevel.result.connector ? pbslevel.result.connector : ''
+            //获取下级PBSlevel信息
+            getPbsLevelPage({ alevel: pbslevel.result.alevel + 1, pbsId: pbslevel.result.pbsId }).then(
+              (nextPbslevel) => {
+                if (nextPbslevel.code === 1 && nextPbslevel.result.records.length === 1) {
+                  //获取层级对应的业务对象
+                  getPbsCodeDetailPage({ pbslevelId: nextPbslevel.result.records[0].id }).then((codeDetail) => {
+                    if (codeDetail.code === 1 && codeDetail.result.records.length === 1) {
+                      getBoinfoPage({
+                        boId: codeDetail.result.records[0].boId,
+                        size: 100,
+                        'orders[0].column': 'code',
+                        'orders[0].asc': true
+                      }).then((boinfos) => {
+                        if (boinfos.code === 1) {
+                          console.log(boinfos)
+                          const list = boinfos.result.records.map((item) => {
+                            return { name: item.name, value: item.code }
+                          })
+                          this.nodeOptions = list
+                        }
+                      })
+                    }
+                  })
+                }
+              }
+            )
+          }
+        })
+      }
+    })
+  }
+  /**该方法用于提交新建节点信息 */
+  addNodeSubmit() {}
+  /**下级节点选择器选中事件 */
+  nextNodeChange() {
+    const node = this.nodeOptions.find((item) => {
+      return item.value === this.addNodeForm.id
+    })
+    this.addNodeForm.code = this.addNodeForm.pCode + this.connector + node.value
+  }
+  /**导入按钮点击事件 */
+  pipeDataImport(row){
+    this.importDialogShow=true;
+  }
+  /**
+  导入excel表,创建二三维数据集  
+   */
+  buildDatasets() {
+    if (this.files.length === 0) {
+      this.$message.warning('请上传管网数据表')
+      return
+    }
+    if (!this.selectProjID) {
+      this.$message.warning('请选择导入层级')
+      return
+    }
+    const formdata = new FormData()
+    this.files.forEach((item) => {
+      formdata.append('files', item)
+    })
+    formdata.append('importType', '0')
+    formdata.append('id', '' + this.selectProjID)
+
+    request({
+      url: '/tofly-lzd-data/data/import/' + this.selectProjID,
+      method: 'POST',
+      data: formdata
+    })
+      .then((result) => {
+        if (result.code === 1) {
+          this.$message.success('生成数据集成功')
+          this.buildNetwork()
+        }
+      })
+      .catch((err) => {
+        this.$message.error('生成数据集失败')
+        console.log(err)
+      })
+  }
+  /**
+  导入excel表,创建二三维数据集【正式库】  
+   */
+  zsbuildDatasets() {
+    if (this.files.length === 0) {
+      this.$message.warning('请上传管网数据表')
+      return
+    }
+    if (!this.selectProjID) {
+      this.$message.warning('请选择导入层级')
+      return
+    }
+    const formdata = new FormData()
+    this.files.forEach((item) => {
+      formdata.append('files', item)
+    })
+    formdata.append('importType', '1')
+    formdata.append('id', '' + this.selectProjID)
+
+    request({
+      url: '/tofly-lzd-data/data/import/' + this.selectProjID,
+      method: 'POST',
+      data: formdata
+    })
+      .then((result) => {
+        this.$message.success('生成数据集成功')
+        this.buildNetwork()
+      })
+      .catch((err) => {
+        this.$message.error('导入excel出错')
+        console.log(err)
+      })
+  }
+  /**
+    重建三维网络【临时库】
+   */
+  buildNetwork() {
+    request({
+      url: '/tofly-lzd-data/data/createNetwork?importType=0',
+      method: 'POST'
+    })
+      .then((result) => {
+        console.log(result)
+        if (result.code === 1) {
+          this.$message.success('三维网络生成成功')
+          this.buildModelTiles()
+        }
+      })
+      .catch((err) => {
+        this.$message.error('三维网络生成失败')
+        console.log(err)
+      })
+  }
+  /**
+    重建三维网络【正式库】
+   */
+  zsbuildNetwork() {
+    request({
+      url: '/tofly-lzd-data/data/createNetwork?importType=1',
+      method: 'POST'
+    })
+      .then((result) => {
+        console.log(result)
+        if (result.code === 1) {
+          this.$message.success('三维网络生成成功')
+          this.zsbuildModelTiles()
+        }
+      })
+      .catch((err) => {
+        this.$message.error('三维网络生成失败')
+        console.log(err)
+      })
+  }
+  /**
+    制作场景缓存【临时库】
+   */
+  buildModelTiles() {
+    request({
+      url: '/tofly-lzd-data/data/modelSlice3d?importType=0',
+      method: 'POST'
+    })
+      .then((result) => {
+        if (result.code === 1) {
+          this.$message.success('场景缓存生成成功')
+          this.publishService()
+        }
+      })
+      .catch((err) => {
+        this.$message.error('场景缓存生成失败')
+        console.log(err)
+      })
+  }
+  /**
+    制作场景缓存【正式库】
+   */
+  zsbuildModelTiles() {
+    request({
+      url: '/tofly-lzd-data/data/modelSlice3d?importType=1',
+      method: 'POST'
+    })
+      .then((result) => {
+        console.log(result)
+        if (result.code === 1) {
+          this.$message.success('场景缓存生成成功')
+          this.zspublishService()
+        }
+      })
+      .catch((err) => {
+        this.$message.error('场景缓存生成失败')
+        console.log(err)
+      })
+  }
+  /**
+    发布服务【临时库】
+   */
+  publishService() {
+    request({
+      url: '/tofly-lzd-data/data/publishService?importType=0',
+      method: 'POST'
+    })
+      .then((result) => {
+        console.log(result)
+        if (result.code === 1) {
+          this.$message.success('服务发布成功')
+          this.addScene(result.result + '/realspace').then((layers) => {
+            this.$message.success('三维管线模型加载完成')
+          })
+        }
+      })
+      .catch((err) => {
+        this.$message.error('服务发布失败')
+        console.log(err)
+      })
+  }
+  /**
+    发布服务
+   */
+  zspublishService() {
+    request({
+      url: '/tofly-lzd-data/data/publishService?importType=1',
+      method: 'POST'
+    })
+      .then((result) => {
+        console.log(result)
+        if (result.code === 1) {
+          this.$message.success('服务发布成功')
+          this.addScene(result.result + '/realspace').then((layers) => {
+            this.$message.success('三维管线模型加载完成')
+          })
+        }
+      })
+      .catch((err) => {
+        this.$message.error('服务发布失败')
+        console.log(err)
+      })
+  }
+  addScene(url) {
+    //@ts-ignore
+    const viewer = window.viewer
+    return viewer.scene.open(url, undefined, {
+      autoSetView: false
+    })
+  }
+  /**
+   * 根据工程id删除数据
+   */
+  deleteData() {
+    if (!this.selectProjID) {
+      this.$message.success('请选择PBS结构树层级')
+      return
+    }
+    request({
+      url: '/tofly-lzd-data/data/deleteData/' + this.selectProjID + '?importType=1&id=' + this.selectProjID,
+      method: 'POST'
+    })
+      .then((result) => {
+        if (result.code === 1) {
+          this.$message.success('数据删除成功')
+        }
+      })
+      .catch((err) => {
+        this.$message.error('数据删除成功')
+        console.log(err)
+      })
+  }
+  OnlineAccess() {
+    this.dialogVisible = true
+    this.getlist()
+    this.getAreaInfo()
+    // const obj = await this.$PortApi.getAreaInfo_api();//公司名称
+    // this.prjOptions = obj.data.result;
+    // console.log(this.prjOptions, '公司名称');
+  }
+  /**
+   * 在线获取-项目公司列表信息
+   */
+  getAreaInfo() {
+    request({
+      url: '/tofly-sxgk/outpiper/getAreaInfo',
+      method: 'GET',
+      params: {}
+    }).then((result) => {
+      if (result.code !== 1) {
+        return
+      }
+      const list = [{ name: '全部', value: '' }]
+      result.result.forEach((item) => {
+        list.push({ name: item.name, value: item.name })
+      })
+      this.prjOptions = list
+    })
+  }
+  onPageChange(pagination) {
+    this.pagination = { ...this.pagination, ...pagination }
+    this.getlist()
+  }
+  /**
+   * 在线获取- 文件下载
+   */
+  downLoadFile(row) {
+    let filename = row.files[0].fileSourceName
+    let fileurl
+    if (row.files[0].localFileUrl != null) {
+      fileurl = row.files[0].localFileUrl
+      let url =
+        IP +
+        '/base/file/downloadFile?remotePath=' +
+        fileurl +
+        '&fileName=' +
+        filename +
+        '&access_token=' +
+        this.$store.getters.token
+      window.open(url, '_parent')
+    } else {
+      let id = row.files[0].id.toString()
+      request({
+        url: '/tofly-sxgk/pipepr/downloadRemote',
+        method: 'GET',
+        params: { fileIdsStr: id }
+      }).then((result) => {
+        if (result.code !== 1) return
+        if (result) {
+          fileurl = result.result[0].url
+          let url =
+            IP +
+            '/base/file/downloadFile?remotePath=' +
+            fileurl +
+            '&fileName=' +
+            filename +
+            '&access_token=' +
+            this.$store.getters.token
+          window.open(url, '_parent')
+        }
+      })
+    }
+  }
+  /**
+   * 获取图纸在线表单
+   */
+  getlist() {
+    let params = {
+      submitStatus: this.radio,
+      areaName: this.areaName,
+      proName: '',
+      queryPara: this.queryPara,
+      dataSource: this.radio2,
+      current: this.pagination.current,
+      size: this.pagination.size
+    }
+    request({
+      method: 'get',
+      url: '/tofly-sxgk/outpiper/page',
+      params: params
+    }).then((res) => {
+      //      pagesizes: [10, 25, 50, 100],
+      // pagesize: 10,
+      // currentPage: 1,
+      // totalNum: 0,
+      const { records, size, total, current } = res.result
+      //this.onlineRecords = records
+      this.pagination.size = size
+      this.pagination.current = current
+      this.pagination.total = total
+      let obj = {
+        2: '设计',
+        1: '普查',
+        3: '竣工'
+      }
+      const status = {
+        0: '已提交',
+        1: '未提交'
+      }
+      this.onlineRecords = records.map((item) => {
+        Object.keys(item).forEach((val) => (item[val] = item[val] || '暂无'))
+        return {
+          ...item,
+          dataSource: obj[item.dataSource],
+          submitStatus: status[item.submitStatus]
+        }
+      })
+    })
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.eluploadcontainer {
+  >>> .el-upload-list {
+    height: 100px;
+    border: 1px solid #dcdfe6;
+    margin-top: 10px;
+  }
+}
+.fullDialog{
+    >>> .el-dialog{
+      max-width: 100vw !important;
+      .el-dialog__body{
+        height:100%;
+      }
+    }
+}
+.content-body {
+  .el-table {
+    >>> th > .cell {
+      white-space: pre-line;
+    }
+    >>> .el-table__body {
+      td.el-table__cell {
+        padding: 0 !important;
+        height: 34px;
+      }
+    }
+  }
+}
+.content-footer {
+  width: 100%;
+  height: 55px;
+  line-height: 35px;
+  padding: 10px 20px;
+}
+</style>

File diff suppressed because it is too large
+ 1162 - 954
src/views/currentSystem/authorityManagement/userRights/index.vue


File diff suppressed because it is too large
+ 944 - 944
src/views/currentSystem/authorityManagement/userRights/index3.vue


+ 279 - 279
src/views/currentSystem/authorityManagement/userRights/mergeUser/index.vue

@@ -101,309 +101,309 @@
 </template>
 
 <script lang="ts">
-import { Vue, Prop, Component, Watch } from 'vue-property-decorator'
-import { addUser, editUser, getDeptUserList, getUserList } from '@/api/base'
-import { getRemoteImg } from '@/api/ftp'
-import { regNewUserName, regPhone, regEmail } from '@/utils/reg'
-import { ElForm } from 'element-ui/types/form'
-import {desCodeConvert } from '@/utils/auth'
-const sha1Hex = require('sha1-hex')
-@Component({
-  name: 'MergeUser'
-})
-export default class MergeUser extends Vue {
-  @Prop() data!: any // 编辑的数据
-  @Prop(Array) company!: any[] // 单位信息
-  @Prop(Array) optionsRole!: any[]
-  ruleForm = {
-    username: '',
-    // password: '',
-    realName: '',
-    phone: '',
-    email: '',
-    departmentId: [],
-    roles: [],
-    job: '',
-    note: '',
-    file: '',
-    electronicFile: ''
-  }
-  form = {
-    avatar: '',
-    signPic: '',
-    imageUrl: ''
-  }
-  rules = {
-    username: [
-      { required: true, message: '请输入登录名', trigger: 'blur' },
-      {
-        pattern: regNewUserName(),
-        message: '登录名只能输入英文、数字',
-        trigger: 'blur'
-      }
-    ],
-    password: [
-      { required: true, message: '请输入密码', trigger: 'blur' },
-      { min: 6, max: 12, message: '长度在 6 到 12 个字符', trigger: 'blur' }
-    ],
-    realName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
-    phone: [{ required: true, pattern: regPhone(), message: '请输入正确联系手机号', trigger: 'blur' }],
-    email: [{ pattern: regEmail(), message: '请输入正确邮箱', trigger: 'blur' }],
-    departmentId: [{ required: true, message: '请选择部门', trigger: 'change' }],
-    roles: [{ required: true, message: '请选择角色', trigger: 'change' }]
-  }
-  difference = false
-
-  copyRole = [] //选择的复制角色用户
-  copyUsers = [] // 用户列表
-  created() {
-    // console.log("333", JSON.stringify(this.data));
-    this.difference = JSON.stringify(this.data) !== '{}'
-    if (this.difference) {
-      this.handleEdit()
+  import { Vue, Prop, Component, Watch } from 'vue-property-decorator'
+  import { addUser, editUser, getDeptUserList, getUserList } from '@/api/base'
+  import { getRemoteFile } from '@/api/ftp'
+  import { regNewUserName, regPhone, regEmail } from '@/utils/reg'
+  import { ElForm } from 'element-ui/types/form'
+  import { desCodeConvert } from '@/utils/auth'
+  const sha1Hex = require('sha1-hex')
+  @Component({
+    name: 'MergeUser'
+  })
+  export default class MergeUser extends Vue {
+    @Prop() data!: any // 编辑的数据
+    @Prop(Array) company!: any[] // 单位信息
+    @Prop(Array) optionsRole!: any[]
+    ruleForm = {
+      username: '',
+      // password: '',
+      realName: '',
+      phone: '',
+      email: '',
+      departmentId: [],
+      roles: [],
+      job: '',
+      note: '',
+      file: '',
+      electronicFile: ''
+    }
+    form = {
+      avatar: '',
+      signPic: '',
+      imageUrl: ''
+    }
+    rules = {
+      username: [
+        { required: true, message: '请输入登录名', trigger: 'blur' },
+        {
+          pattern: regNewUserName(),
+          message: '登录名只能输入英文、数字',
+          trigger: 'blur'
+        }
+      ],
+      password: [
+        { required: true, message: '请输入密码', trigger: 'blur' },
+        { min: 6, max: 12, message: '长度在 6 到 12 个字符', trigger: 'blur' }
+      ],
+      realName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
+      phone: [{ required: true, pattern: regPhone(), message: '请输入正确联系手机号', trigger: 'blur' }],
+      email: [{ pattern: regEmail(), message: '请输入正确邮箱', trigger: 'blur' }],
+      departmentId: [{ required: true, message: '请选择部门', trigger: 'change' }],
+      roles: [{ required: true, message: '请选择角色', trigger: 'change' }]
     }
+    difference = false
 
-    // if(typeof(this.data.username) !== 'undefined'){
-    //   this.handleEdit()
-    // }else{
-    //   this.ruleForm.roles = this.data.roles
-    // }
+    copyRole = [] //选择的复制角色用户
+    copyUsers = [] // 用户列表
+    created() {
+      // console.log("333", JSON.stringify(this.data));
+      this.difference = JSON.stringify(this.data) !== '{}'
+      if (this.difference) {
+        this.handleEdit()
+      }
 
-    //获取用户信息
-    this.getCopyDeptUserList()
-  }
-  // 上传之前的钩子函数
-  beforeAvatarUpload(file, type) {
-    const isJPG = file.type === 'image/jpeg'
-    const isPng = file.type === 'image/png'
-    const isLt2M = file.size / 1024 / 1024 < 2
+      // if(typeof(this.data.username) !== 'undefined'){
+      //   this.handleEdit()
+      // }else{
+      //   this.ruleForm.roles = this.data.roles
+      // }
 
-    if (!isJPG && !isPng) {
-      this.$message.error('上传图片只能是 JPG或png 格式!')
-      return false
+      //获取用户信息
+      this.getCopyDeptUserList()
     }
-    if (!isLt2M) {
-      this.$message.error('上传头像图片大小不能超过 2MB!')
-      return false
-    }
-    // console.log('2222', file)
-    type === 'avatar' ? (this.ruleForm.file = file) : (this.ruleForm.electronicFile = file)
-    const _this = this
-    const reader = new FileReader()
-    // 转base64
-    reader.onload = function (e) {
-      type === 'sign'
-        ? (_this.form.signPic = e.target.result.toString())
-        : (_this.form.avatar = e.target.result.toString()) // 将图片路径赋值给src
-    }
-    reader.readAsDataURL(file)
-    return false // 屏蔽了action的默认上传
-  }
-  // 图片上传成功实现本地预览
-  handleAvatarSuccess(res, file) {
-    this.form.imageUrl = URL.createObjectURL(file.raw) // 表单获取到提交时要传的图片路径
-  }
-  // 重置
-  resetFields() {
-    ;(this.$refs.ruleForm as ElForm).resetFields()
-  }
-  // 拼接数据
-  readyData() {
-    const data = new FormData()
-    // data.append('file', this.ruleForm.file)// 图片
-    // 传其他参数
-    for (const key in this.ruleForm) {
-      if (key === 'departmentId') {
-        data.append(key, Array.isArray(this.ruleForm[key]) ? [...this.ruleForm[key]].pop() : this.ruleForm[key])
-      } else if (key === 'password') {
-        data.append(key, sha1Hex(this.ruleForm[key]))
-      } else if (key === 'roles') {
-        data.append(key, this.ruleForm[key].toString())
-      }else if (key === 'phone') {
-        data.append(key, desCodeConvert(this.ruleForm[key],true,false))
-      }else if (key === 'email') {
-        data.append(key, desCodeConvert(this.ruleForm[key],true,false))
+    // 上传之前的钩子函数
+    beforeAvatarUpload(file, type) {
+      const isJPG = file.type === 'image/jpeg'
+      const isPng = file.type === 'image/png'
+      const isLt2M = file.size / 1024 / 1024 < 2
+
+      if (!isJPG && !isPng) {
+        this.$message.error('上传图片只能是 JPG或png 格式!')
+        return false
       }
-      // else if (key === 'phone' || key === 'email' || key === 'job' || key === 'note') {
-      //   let tempVal = this.ruleForm[key] + ''
-      //   if (this.strIsNull(tempVal)) {
-      //     tempVal = 'null'
-      //   }
-      //   data.append(key, tempVal)
-      // }
-      else {
-        data.append(key, this.ruleForm[key])
+      if (!isLt2M) {
+        this.$message.error('上传头像图片大小不能超过 2MB!')
+        return false
       }
-      // }
+      // console.log('2222', file)
+      type === 'avatar' ? (this.ruleForm.file = file) : (this.ruleForm.electronicFile = file)
+      const _this = this
+      const reader = new FileReader()
+      // 转base64
+      reader.onload = function (e) {
+        type === 'sign'
+          ? (_this.form.signPic = e.target.result.toString())
+          : (_this.form.avatar = e.target.result.toString()) // 将图片路径赋值给src
+      }
+      reader.readAsDataURL(file)
+      return false // 屏蔽了action的默认上传
     }
-    // 编辑添加id
-    if (this.difference) {
-      data.append('id', this.data.id)
+    // 图片上传成功实现本地预览
+    handleAvatarSuccess(res, file) {
+      this.form.imageUrl = URL.createObjectURL(file.raw) // 表单获取到提交时要传的图片路径
     }
-    return data
-  }
-  // 提交
-  submitForm() {
-    const _this = this
-    ;(this.$refs.ruleForm as ElForm).validate((valid) => {
-      if (valid) {
-        const data = _this.readyData()
-        // console.log('file', data, _this.file)
-        if (!this.difference) {
-          _this.newAddUser(data)
-        } else {
-          _this.editSubmit(data)
+    // 重置
+    resetFields() {
+      ;(this.$refs.ruleForm as ElForm).resetFields()
+    }
+    // 拼接数据
+    readyData() {
+      const data = new FormData()
+      // data.append('file', this.ruleForm.file)// 图片
+      // 传其他参数
+      for (const key in this.ruleForm) {
+        if (key === 'departmentId') {
+          data.append(key, Array.isArray(this.ruleForm[key]) ? [...this.ruleForm[key]].pop() : this.ruleForm[key])
+        } else if (key === 'password') {
+          data.append(key, sha1Hex(this.ruleForm[key]))
+        } else if (key === 'roles') {
+          data.append(key, this.ruleForm[key].toString())
+        } else if (key === 'phone') {
+          data.append(key, desCodeConvert(this.ruleForm[key], true, false))
+        } else if (key === 'email') {
+          data.append(key, desCodeConvert(this.ruleForm[key], true, false))
+        }
+        // else if (key === 'phone' || key === 'email' || key === 'job' || key === 'note') {
+        //   let tempVal = this.ruleForm[key] + ''
+        //   if (this.strIsNull(tempVal)) {
+        //     tempVal = 'null'
+        //   }
+        //   data.append(key, tempVal)
+        // }
+        else {
+          data.append(key, this.ruleForm[key])
         }
-        return true
+        // }
       }
-    })
-  }
+      // 编辑添加id
+      if (this.difference) {
+        data.append('id', this.data.id)
+      }
+      return data
+    }
+    // 提交
+    submitForm() {
+      const _this = this
+      ;(this.$refs.ruleForm as ElForm).validate((valid) => {
+        if (valid) {
+          const data = _this.readyData()
+          // console.log('file', data, _this.file)
+          if (!this.difference) {
+            _this.newAddUser(data)
+          } else {
+            _this.editSubmit(data)
+          }
+          return true
+        }
+      })
+    }
 
-  // 新增提交
-  newAddUser(data) {
-    const _this = this
-    addUser(data).then((res) => {
-      if (res.code !== -1) {
-        if (res.result.code === -1) {
-          this.$message.error(res.result.message)
-        } else {
-          _this.$message.success('新增成功')
-          _this.$emit('remind', '成功')
-          _this.resetFields()
+    // 新增提交
+    newAddUser(data) {
+      const _this = this
+      addUser(data).then((res) => {
+        if (res.code !== -1) {
+          if (res.result.code === -1) {
+            this.$message.error(res.result.message)
+          } else {
+            _this.$message.success('新增成功')
+            _this.$emit('remind', '成功')
+            _this.resetFields()
+          }
         }
-      }
-    })
-  }
-  // 修改提交
-  editSubmit(data) {
-    const _this = this
-    editUser(data).then((res) => {
-      if (res.code !== -1) {
-        if (res.result.code === -1) {
-          this.$message.error(res.result.message)
-        } else {
-          _this.$message.success('修改成功')
-          _this.$emit('remind', '成功')
-          _this.resetFields()
+      })
+    }
+    // 修改提交
+    editSubmit(data) {
+      const _this = this
+      editUser(data).then((res) => {
+        if (res.code !== -1) {
+          if (res.result.code === -1) {
+            this.$message.error(res.result.message)
+          } else {
+            _this.$message.success('修改成功')
+            _this.$emit('remind', '成功')
+            _this.resetFields()
+          }
         }
-      }
-    })
-  }
+      })
+    }
 
-  // 编辑参数回显
-  handleEdit() {
-    this.ruleForm = this.assignment(this.ruleForm, this.data) as any
-    // const arr = [this.data.avatar, this.data.esignature]
-    // arr.forEach((item, index) => {
-    //   if (item === null) return
-    //   getRemoteImg(item).then((res) => {
-    //     if (res.status === 200) {
-    //       index === 1 ? (this.form.signPic = res.config.url) : (this.form.avatar = res.config.url)
-    //     }
-    //   })
-    // })
-    this.form = {
-      ...this.form,
-      signPic: getRemoteImg(this.data.esignature),
-      avatar: getRemoteImg(this.data.avatar)
+    // 编辑参数回显
+    handleEdit() {
+      this.ruleForm = this.assignment(this.ruleForm, this.data) as any
+      // const arr = [this.data.avatar, this.data.esignature]
+      // arr.forEach((item, index) => {
+      //   if (item === null) return
+      //   getRemoteFile(item).then((res) => {
+      //     if (res.status === 200) {
+      //       index === 1 ? (this.form.signPic = res.config.url) : (this.form.avatar = res.config.url)
+      //     }
+      //   })
+      // })
+      this.form = {
+        ...this.form,
+        signPic: getRemoteFile(this.data.esignature),
+        avatar: getRemoteFile(this.data.avatar)
+      }
     }
-  }
-  // 赋值
-  assignment(par, role) {
-    const data = {}
-    for (const key in par) {
-      if (key === 'departmentId') {
-        data[key] = typeof role[key] === 'string' ? [role[key]] : Array.isArray(role[key]) ? role[key] : role[key]
-      } else if (key === 'roles') {
-        data[key] = role.roleIdList && role.roleIdList != null && role.roleIdList.split(',')
-      } else {
-        data[key] = role[key]
+    // 赋值
+    assignment(par, role) {
+      const data = {}
+      for (const key in par) {
+        if (key === 'departmentId') {
+          data[key] = typeof role[key] === 'string' ? [role[key]] : Array.isArray(role[key]) ? role[key] : role[key]
+        } else if (key === 'roles') {
+          data[key] = role.roleIdList && role.roleIdList != null && role.roleIdList.split(',')
+        } else {
+          data[key] = role[key]
+        }
       }
+      return data
     }
-    return data
-  }
 
-  /**
-   * @description 获取用户信息
-   */
-  getCopyDeptUserList() {
-    let deptId = this.ruleForm.departmentId
-    // console.log('部门编码:' + deptId)
-    let data = {
-      userLevel: 1,
-      departmentId: Array.isArray(deptId) ? [...deptId].pop() : deptId,
-      current: 1,
-      size: 10000000
+    /**
+     * @description 获取用户信息
+     */
+    getCopyDeptUserList() {
+      let deptId = this.ruleForm.departmentId
+      // console.log('部门编码:' + deptId)
+      let data = {
+        userLevel: 1,
+        departmentId: Array.isArray(deptId) ? [...deptId].pop() : deptId,
+        current: 1,
+        size: 10000000
+      }
+      getUserList(data).then((res) => {
+        //console.log(res);
+        this.copyUsers = res.result.records
+      })
     }
-    getUserList(data).then((res) => {
-      //console.log(res);
-      this.copyUsers = res.result.records
-    })
-  }
 
-  /**
-   * @description 获取选中用户的角色,并赋值
-   */
-  copyRoleChange(roleAry) {
-    // console.log('参数:' + roleAry)
-    //筛选出角色
-    let roleUsers = this.copyUsers.filter((item, index) => {
-      return roleAry.includes(item.id)
-    })
+    /**
+     * @description 获取选中用户的角色,并赋值
+     */
+    copyRoleChange(roleAry) {
+      // console.log('参数:' + roleAry)
+      //筛选出角色
+      let roleUsers = this.copyUsers.filter((item, index) => {
+        return roleAry.includes(item.id)
+      })
 
-    let roleIdAry = []
-    //获取选中的角色数据
-    roleUsers.forEach((userinfo) => {
-      let roleIdList = userinfo.roleIdList
-      if (!this.strIsNull(roleIdList)) {
-        let roleIds = roleIdList.split(',')
-        //角色ID
-        roleIds.forEach((roleId) => {
-          roleIdAry.push(roleId)
-        })
-      }
-    })
-    let roleId = Array.from(new Set(roleIdAry))
-    this.ruleForm.roles = roleId
-  }
+      let roleIdAry = []
+      //获取选中的角色数据
+      roleUsers.forEach((userinfo) => {
+        let roleIdList = userinfo.roleIdList
+        if (!this.strIsNull(roleIdList)) {
+          let roleIds = roleIdList.split(',')
+          //角色ID
+          roleIds.forEach((roleId) => {
+            roleIdAry.push(roleId)
+          })
+        }
+      })
+      let roleId = Array.from(new Set(roleIdAry))
+      this.ruleForm.roles = roleId
+    }
 
-  /*
-   * @description 判断字符串是否为空
-   */
-  strIsNull(strVal) {
-    strVal = strVal || ''
-    return typeof strVal == 'undefined' || strVal == null || strVal == ''
+    /*
+     * @description 判断字符串是否为空
+     */
+    strIsNull(strVal) {
+      strVal = strVal || ''
+      return typeof strVal == 'undefined' || strVal == null || strVal == ''
+    }
   }
-}
 </script>
 <style lang="scss" scoped>
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409eff;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 178px;
-  height: 178px;
-  line-height: 178px;
-  text-align: center;
-}
-.avatar {
-  width: 178px;
-  height: 178px;
-  display: block;
-  // object-fit: cover;
-}
-.msg {
-  color: #c0c4cc;
-  font-size: 12px;
-  line-height: 20px;
-}
+  .avatar-uploader .el-upload {
+    border: 1px dashed #d9d9d9;
+    border-radius: 6px;
+    cursor: pointer;
+    position: relative;
+    overflow: hidden;
+  }
+  .avatar-uploader .el-upload:hover {
+    border-color: #409eff;
+  }
+  .avatar-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 178px;
+    height: 178px;
+    line-height: 178px;
+    text-align: center;
+  }
+  .avatar {
+    width: 178px;
+    height: 178px;
+    display: block;
+    // object-fit: cover;
+  }
+  .msg {
+    color: #c0c4cc;
+    font-size: 12px;
+    line-height: 20px;
+  }
 </style>

+ 133 - 136
src/views/currentSystem/dashboard/components/UserDoc/index.vue

@@ -59,163 +59,160 @@
 </template>
 
 <script>
-import Blocks from '../Layout/Blocks'
-import { getInfo } from '@/api/dashboard'
-import { getRemoteImg } from '@/api/ftp'
+  import Blocks from '../Layout/Blocks'
+  import { getInfo } from '@/api/dashboard'
+  import { getRemoteFile } from '@/api/ftp'
 
-export default {
-  components: { Blocks },
-  data() {
-    return {
-      userinfo: {
-        realName: '',
-        departmentName: '',
-        phone: '',
-        email: '',
-        avatar: '',
-        job: '', //工作岗位
-        note: '' //工作职责
+  export default {
+    components: { Blocks },
+    data() {
+      return {
+        userinfo: {
+          realName: '',
+          departmentName: '',
+          phone: '',
+          email: '',
+          avatar: '',
+          job: '', //工作岗位
+          note: '' //工作职责
+        }
       }
-    }
-  },
-  watch: {},
-  destroyed() {},
-  filters: {
-    null2empty: (val) => (val === 'null' ? '' : val || '')
-  },
-  computed: {
-    avatar() {
-      return this.$store.getters.avatar || this.userinfo.avatar
-    }
-  },
-  methods: {
-    /**
-     * @description 获取用户信息
-     */
-    getUserInfo() {
-      var that = this
-      getInfo({}).then((res) => {
-        if (res.code !== -1) {
-          let result = res.result
+    },
+    watch: {},
+    destroyed() {},
+    filters: {
+      null2empty: (val) => (val === 'null' ? '' : val || '')
+    },
+    computed: {
+      avatar() {
+        return this.$store.getters.avatar || this.userinfo.avatar
+      }
+    },
+    methods: {
+      /**
+       * @description 获取用户信息
+       */
+      getUserInfo() {
+        var that = this
+        getInfo({}).then((res) => {
+          if (res.code !== -1) {
+            let result = res.result
 
-          that.userinfo.realName = result.realName
-          that.userinfo.departmentName = result.departmentName
-          that.userinfo.phone = result.phone
-          that.userinfo.email = result.email
-          // that.userinfo.avatar = result.avatar
-          that.userinfo.job = result.job
-          if (!that.strIsNull(result.note)) {
-            that.userinfo.note = result.note
-              .replace(/\r\n/g, '<br/>')
-              .replace(/\n/g, '<br/>')
-              .replace(/\s/g, ' ')
-          }
+            that.userinfo.realName = result.realName
+            that.userinfo.departmentName = result.departmentName
+            that.userinfo.phone = result.phone
+            that.userinfo.email = result.email
+            // that.userinfo.avatar = result.avatar
+            that.userinfo.job = result.job
+            if (!that.strIsNull(result.note)) {
+              that.userinfo.note = result.note.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ')
+            }
 
-          //获取图片
-          if (!that.strIsNull(result.avatar)) {
-            that.getUserAvatar(result.avatar)
+            //获取图片
+            if (!that.strIsNull(result.avatar)) {
+              that.getUserAvatar(result.avatar)
+            }
+          } else {
+            that.$message.error(res.$message)
           }
-        } else {
-          that.$message.error(res.$message)
-        }
-      })
-    },
+        })
+      },
 
-    /**
-     * @description 获取用户图片
-     */
-    getUserAvatar(avatar) {
-      const img = getRemoteImg(avatar)
-      this.userinfo.avatar = img
-      this.$store.commit('user/SET_AVATAR', img)
-      // getRemoteImg(avatar).then((res) => {
-      //   this.userinfo.avatar = null
-      //   if (res.status === 200) {
-      //     this.userinfo.avatar = res.config.url
-      //   }
-      // })
-    },
+      /**
+       * @description 获取用户图片
+       */
+      getUserAvatar(avatar) {
+        const img = getRemoteFile(avatar)
+        this.userinfo.avatar = img
+        this.$store.commit('user/SET_AVATAR', img)
+        // getRemoteFile(avatar).then((res) => {
+        //   this.userinfo.avatar = null
+        //   if (res.status === 200) {
+        //     this.userinfo.avatar = res.config.url
+        //   }
+        // })
+      },
 
-    // 打开表格弹窗
-    handleDialogShow(data) {
-      console.log('参数:' + data)
-    },
+      // 打开表格弹窗
+      handleDialogShow(data) {
+        console.log('参数:' + data)
+      },
 
-    /**
-     * @description 判断字符串是否为空
-     */
-    strIsNull(strVal) {
-      strVal = strVal || ''
-      return typeof strVal == 'undefined' || strVal == null || strVal == ''
+      /**
+       * @description 判断字符串是否为空
+       */
+      strIsNull(strVal) {
+        strVal = strVal || ''
+        return typeof strVal == 'undefined' || strVal == null || strVal == ''
+      }
+    },
+    mounted() {
+      this.getUserInfo()
     }
-  },
-  mounted() {
-    this.getUserInfo()
   }
-}
 </script>
 
 <style lang="scss" scoped>
-.userinfo-container {
-  display: flex;
-  justify-content: space-between;
-  // align-items: center;
-  width: 100%;
-  height: 100%;
-  // border:1px red solid;
-  // position: static;
-
-  .userAvatar {
-    // display: block;
+  .userinfo-container {
+    display: flex;
+    justify-content: space-between;
+    // align-items: center;
+    width: 100%;
+    height: 100%;
     // border:1px red solid;
-    // height: 100%;
-    // width: 28%;
+    // position: static;
+
+    .userAvatar {
+      // display: block;
+      // border:1px red solid;
+      // height: 100%;
+      // width: 28%;
 
-    // height: 50%;
-    width: 30%;
-    border-radius: 6px;
-    // text-align: right;
-    // clear: both;
-    // overflow: hidden;
-    //  transform:translate(-50%,-50%);
+      // height: 50%;
+      width: 30%;
+      border-radius: 6px;
+      // text-align: right;
+      // clear: both;
+      // overflow: hidden;
+      //  transform:translate(-50%,-50%);
 
-    img {
-      display: inline;
-      float: right;
-      // border: 1px red solid;
-      max-height: 260px;
-      max-width: 200px;
+      img {
+        display: inline;
+        float: right;
+        // border: 1px red solid;
+        max-height: 260px;
+        max-width: 200px;
+      }
     }
-  }
 
-  .userDoc {
-    // border:1px red solid;
-    height: 100%;
-    padding: 10px;
-    width: 70%;
+    .userDoc {
+      // border:1px red solid;
+      height: 100%;
+      padding: 10px;
+      width: 70%;
 
-    .el-row {
-      display: flex;
-      margin-bottom: 10px;
-      // border: 1px red solid;
-      overflow: hidden;
-      .title {
-        width: 100px;
-        text-align: right;
-        color: #333333;
-        font-size: 14px;
-        font-weight: bold;
-        // border:1px red solid;
-      }
+      .el-row {
+        display: flex;
+        margin-bottom: 10px;
+        // border: 1px red solid;
+        overflow: hidden;
+        .title {
+          width: 100px;
+          text-align: right;
+          color: #333333;
+          font-size: 14px;
+          font-weight: bold;
+          // border:1px red solid;
+        }
 
-      .title + span {
-        display: inline-block;
-        width: 100%;
-        color: #333333;
-        font-size: 14px;
-        font-weight: bold;
+        .title + span {
+          display: inline-block;
+          width: 100%;
+          color: #333333;
+          font-size: 14px;
+          font-weight: bold;
+        }
       }
     }
   }
-}
 </style>

+ 48 - 22
src/views/groupPage/districtPageModules/customTools/projectPipeSpeedInfoCheck.vue

@@ -140,9 +140,7 @@ export default class ProjectPipeSpeedInfoCheck extends Vue {
     let t = {}
     t[this.active] = {
       style: { color: '#1989FA', fontWeight: 'bold' },
-      label: `${moment(
-        this.active !== this.timeSteps.length - 1 ? this.timeSteps[this.active][0] : this.timeSteps[this.active][1]
-      ).format('YYYY-MM-DD')}`
+      label: this.settings()
     }
     // t[0] = {
     //   style: { color: '#1989FA', fontWeight: 'bold' },
@@ -154,6 +152,24 @@ export default class ProjectPipeSpeedInfoCheck extends Vue {
     // }
     return t
   }
+  settings() {
+    let label = ''
+    switch (this.timeInterval) {
+      case 1:
+        label = `${moment(
+          this.active !== this.timeSteps.length - 1 ? this.timeSteps[this.active][0] : this.timeSteps[this.active][1]
+        ).format('YYYY/MM/DD')}`
+        break
+      default:
+        label =
+          `${moment(this.timeSteps[this.active][0]).format('YYYY/MM/DD')}` +
+          `至` +
+          `\n${moment(this.timeSteps[this.active][1]).format('YYYY/MM/DD')}`
+        break
+    }
+
+    return label
+  }
   //
   isFirst = true
   timeLag = []
@@ -455,6 +471,7 @@ export default class ProjectPipeSpeedInfoCheck extends Vue {
           console.log('地图查询结果', geoResult)
           //交互事件
           that.getCurrentInfo()
+          let promiseArr = []
           geoResult.originResult.recordsets.forEach((record) => {
             const features = record.features
             if (features.length > 1) {
@@ -467,26 +484,32 @@ export default class ProjectPipeSpeedInfoCheck extends Vue {
             const scanProj = _.find(cwpInfos, function (scanItem) {
               return scanItem.code === features[0]['fieldValues'][0]
             })
-
-            let labelText = dateRange.beginDate + '~' + dateRange.endDate
-
             let position = features[0].geometry.points[0]
-            // position = Cesium.Cartesian3.fromDegrees(position.x, position.y, position.z)
-            // that.addUnitBillboard({
-            //   id: scanProj.code,
-            //   name: scanProj.code,
-            //   text: labelText,
-            //   position: position,
-            //   scanProj: scanProj
-            // })
-            this.addEntity({
-              id: scanProj.code,
-              name: scanProj.code,
-              position: Cesium.Cartesian3.fromDegrees(position.x, position.y, position.z),
-              scanProj: scanProj
-            })
+            promiseArr.push(
+              new Promise((resolve, reject) => {
+                let isLoaded = this.addEntity({
+                  id: scanProj.code,
+                  name: scanProj.code,
+                  position: Cesium.Cartesian3.fromDegrees(position.x, position.y, position.z),
+                  scanProj: scanProj
+                })
+                if (isLoaded) {
+                  resolve(true)
+                } else {
+                  reject(false)
+                }
+              })
+            )
           })
-          that.isShowCompletion = true
+          Promise.all(promiseArr).then(
+            () => isCompleted(),
+            () => isCompleted()
+          )
+          function isCompleted() {
+            setTimeout(() => {
+              that.isShowCompletion = true
+            }, 500)
+          }
         }
         queryMapByAttribute({
           url: geourl,
@@ -534,6 +557,9 @@ export default class ProjectPipeSpeedInfoCheck extends Vue {
     entity.displayData = options.scanProj
     if (!gCustomDataSource.entities.getById(options.id)) {
       gCustomDataSource.entities.add(entity)
+      return true
+    } else {
+      return false
     }
   }
   /**
@@ -1126,7 +1152,7 @@ export default class ProjectPipeSpeedInfoCheck extends Vue {
       /deep/ .el-slider {
         width: 100%;
         .el-slider__marks-text {
-          white-space: nowrap;
+          white-space: pre-wrap;
         }
         .el-slider__button {
           border: 2px solid #04eaff;

+ 0 - 3
src/views/pipelineDefect/mixin/map.ts

@@ -47,19 +47,16 @@ export const mapMixin = {
             if (psource && dsource && [...dsource.entities.values, ...psource.entities.values].length !== 0) {
                 this.setPipeAndDefectVisible()
             } else {
-                // this.$store.dispatch('map/mapLaoding', true)
                 getDefectData().then(res => {
                     console.log('获取数据')
                     let data = res.result
                     let { strucDefectFeatures, funcDefectFeatures, pipeDefectFeatures } = this.getFeatures(data)
                     if ([...strucDefectFeatures, ...funcDefectFeatures, ...pipeDefectFeatures].length !== 0) {
                         let lines = [...strucDefectFeatures, ...funcDefectFeatures]
-                        // this.cesiumUitl.flyTo(lines[0])
                         this.addLines(lines)
                         this.addDefects(pipeDefectFeatures)
                         this.setPipeAndDefectVisible()
                     }
-                    // this.$store.dispatch('map/mapLaoding', false)
                 })
             }
         },

+ 22 - 7
src/views/spectrum/configuration/api/common.ts

@@ -1,5 +1,5 @@
-import { ICreator, IFile, IUpdater } from '@/api/common'
-import { ElUploadInternalFileDetail } from 'element-ui/types/upload'
+import { ICreator, IUpdater } from '@/api/common'
+import { ElUploadInternalFileDetail, ElUploadInternalRawFile } from 'element-ui/types/upload'
 
 export const base = '/survey'
 export interface IDeviceType extends ICreator, IUpdater {
@@ -209,9 +209,24 @@ export interface IPointDetail {
     warningLevel: number
     warningName: string
   }[]
-  fileList: (string | Partial<ElUploadInternalFileDetail>)[]
+  fileList: Partial<ElUploadInternalRawFile>[]
 }
 
+export interface IFile {
+  createTime: string
+  createUser: number
+  createUserName: string
+  fileFormat: string
+  fileName: string
+  filePath: string
+  fileSize: string
+  fileType: string
+  id: number
+  otherName: string
+  projectId: number
+  statusFlag: number
+  tableName: string
+}
 export interface IPointDetailResult {
   id: number
   projectId: number
@@ -238,10 +253,10 @@ export interface IPointDetailResult {
     liaisonPhone: string
     installTime: string
     dismantleTime: string
-    files: any
-    uploadFiles: any
-    thumbnailFiles: any
-    thumbnailUploadFiles: any
+    files: string
+    uploadFiles: IFile[]
+    thumbnailFiles: string
+    thumbnailUploadFiles: IFile[]
     dismantlePeople: string
     dismantlePhone: string
     deviceName: string

+ 17 - 80
src/views/spectrum/configuration/device/DeviceForm.vue

@@ -54,29 +54,7 @@
           </el-form-item>
         </el-form>
       </el-col>
-      <el-col :span="12">
-        设备照片
-        <span style="margin-left: 5px; color: #ccc">(最多上传9张)</span>
-        <div style="margin-top: 20px" class="upload">
-          <el-upload
-            list-type="picture-card"
-            :on-preview="handlePictureCardPreview"
-            :on-remove="handleRemovePic"
-            multiple
-            :auto-upload="false"
-            :file-list="formData.filesPath"
-            :on-change="onFileChange"
-            action="whatever"
-            accept=".jpg,.jpeg,.png"
-          >
-            <i class="el-icon-plus"></i>
-          </el-upload>
-        </div>
-
-        <el-dialog :visible.sync="dialogVisible" title="" append-to-body class="preview">
-          <img width="100%" :src="dialogImageUrl" alt="" />
-        </el-dialog>
-      </el-col>
+      <el-col :span="12"><tf-file-uploader v-model="formData.filesPath" title="设备照片" /></el-col>
     </el-row>
   </tf-dialog>
 </template>
@@ -84,7 +62,7 @@
 <script lang="ts">
   import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
   import { ElForm } from 'element-ui/types/form'
-  import { getRemoteImg } from '@/api/ftp'
+  import { getRemoteFile } from '@/api/ftp'
   import { ElUploadInternalFileDetail } from 'element-ui/types/upload'
   import { deviceTypeParamPage } from '../api/deviceType'
   import { IDevice, IDeviceType } from '../api/common'
@@ -107,8 +85,6 @@
     @Prop({ type: Object, default: () => ({}) }) data!: IDevice
     @Prop({ type: Array, default: () => [] }) types!: IDeviceType[]
     $refs!: { form: ElForm }
-    dialogVisible = false
-    dialogImageUrl = ''
     formData: Partial<Omit<IDevice, 'filesPath'>> & {
       filesPath?: Partial<ElUploadInternalFileDetail>[]
       param?: string
@@ -229,43 +205,24 @@
     onSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
-          const { param, filesPath, ...rest } = this.formData
-          this.$emit('submit', { ...rest, filesPath: filesPath.map(({ raw }) => raw) })
+          const {
+            param,
+            filesPath,
+            // thumbnailFiles, thumbnailUploadFiles,
+            ...rest
+          } = this.formData
+          const newFiles = filesPath.filter((item) => !!item.raw).map(({ raw }) => raw)
+          // const oldFiles = (thumbnailUploadFiles || []).filter(({ id }) => filesPath.some(({ uid }) => uid === id))
+          this.$emit('submit', {
+            ...rest,
+            // thumbnailUploadFiles: oldFiles,
+            // thumbnailFiles: oldFiles.map((item) => item.id).join(','),
+            filesPath: newFiles
+          })
         }
       })
     }
 
-    onFileChange(file, filesPath) {
-      console.log(filesPath)
-      const isJPG = file.raw.type === 'image/jpeg'
-      const isPng = file.raw.type === 'image/png'
-      const isLt2M = file.size / 1024 / 1024 < 2
-      let needRemove = false
-      if (!isJPG && !isPng) {
-        this.$message.error('上传图片只能是 JPG/JPEG或png 格式!')
-        needRemove = true
-      }
-      if (!isLt2M) {
-        this.$message.error('上传头像图片大小不能超过 2MB!')
-        needRemove = true
-      }
-      if (filesPath.length > 9) {
-        this.$message.error('最多可以上传9张图片!')
-        needRemove = true
-      }
-
-      this.formData.filesPath = needRemove ? filesPath.filter((item) => item.uid !== file.uid) : [...filesPath]
-    }
-
-    handleRemovePic(file, filesPath) {
-      this.formData.filesPath = filesPath.filter((item) => item.uid !== file.uid)
-    }
-
-    handlePictureCardPreview(file) {
-      this.dialogImageUrl = file.url
-      this.dialogVisible = true
-    }
-
     @Watch('data', { immediate: true })
     setDefaultData(val: IDevice) {
       this.formData = val.id
@@ -273,7 +230,7 @@
             ...val,
             filesPath: (val.thumbnailUploadFiles || []).map((file) => ({
               name: file.fileName || file.filePath,
-              url: getRemoteImg(file.filePath),
+              url: getRemoteFile(file.filePath),
               uid: file.id
             }))
           }
@@ -282,23 +239,3 @@
     }
   }
 </script>
-<style lang="scss" scoped>
-  .upload {
-    /deep/ .el-upload-list--picture-card .el-upload-list__item,
-    /deep/ .el-upload--picture-card {
-      width: 120px;
-      height: 120px;
-    }
-    /deep/ .el-upload--picture-card {
-      line-height: normal;
-      display: inline-flex;
-      align-items: center;
-      justify-content: center;
-    }
-  }
-  .preview {
-    /deep/ .el-dialog .el-dialog__header {
-      border-bottom: 0;
-    }
-  }
-</style>

+ 34 - 34
src/views/spectrum/configuration/neighbor/NeighborForm.vue

@@ -32,46 +32,46 @@
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
-import { ElForm } from 'element-ui/types/form'
-import { INeighbor, IPoint } from '../api/common'
+  import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
+  import { ElForm } from 'element-ui/types/form'
+  import { INeighbor, IPoint } from '../api/common'
 
-const getDefaultValue = (): Partial<INeighbor> => ({ siteId: undefined, upperSiteId: undefined })
+  const getDefaultValue = (): Partial<INeighbor> => ({ siteId: undefined, upperSiteId: undefined })
 
-@Component({ name: 'TeamForm', components: {} })
-export default class TeamForm extends Vue {
-  @Prop({ type: Object, default: () => ({}) }) data!: object
-  @Prop({ type: Array, default: () => [] }) points!: IPoint[]
-  @Prop({ type: Boolean, default: false }) loading!: boolean
-  $refs!: { form: ElForm }
+  @Component({ name: 'TeamForm', components: {} })
+  export default class TeamForm extends Vue {
+    @Prop({ type: Object, default: () => ({}) }) data!: object
+    @Prop({ type: Array, default: () => [] }) points!: IPoint[]
+    @Prop({ type: Boolean, default: false }) loading!: boolean
+    $refs!: { form: ElForm }
 
-  formData: Partial<INeighbor> = getDefaultValue()
+    formData: Partial<INeighbor> = getDefaultValue()
 
-  get listeners() {
-    const { submit, ...rest } = this.$listeners
-    return rest
-  }
+    get listeners() {
+      const { submit, ...rest } = this.$listeners
+      return rest
+    }
 
-  rules = {
-    siteId: [{ required: true, message: '请选择监测站点', trigger: 'blur' }],
-    upperSiteId: [{ required: true, message: '请选择上游监测站点', trigger: 'blur' }]
-  }
+    rules = {
+      siteId: [{ required: true, message: '请选择监测站点', trigger: 'change' }],
+      upperSiteId: [{ required: true, message: '请选择上游监测站点', trigger: 'change' }]
+    }
 
-  onSubmit() {
-    this.$refs.form.validate((valid) => {
-      if (valid) {
-        this.$emit('submit', this.formData)
-      }
-    })
-  }
-  onClosed() {
-    this.formData = getDefaultValue()
-    this.$emit('closed')
-  }
+    onSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.$emit('submit', this.formData)
+        }
+      })
+    }
+    onClosed() {
+      this.formData = getDefaultValue()
+      this.$emit('closed')
+    }
 
-  @Watch('data', { immediate: true })
-  setDefaultData(val) {
-    this.formData = val.id ? { ...val } : {}
+    @Watch('data', { immediate: true })
+    setDefaultData(val) {
+      this.formData = val.id ? { ...val } : {}
+    }
   }
-}
 </script>

+ 3 - 3
src/views/spectrum/configuration/point/PointForm/DeviceForm.vue

@@ -44,7 +44,7 @@
           />
         </el-form-item>
       </el-col>
-      <el-col :span="12"> image area </el-col>
+      <el-col :span="12"><tf-file-uploader v-model="formData.fileList" title="安装照片" /></el-col>
     </el-row>
   </el-form>
 </template>
@@ -77,12 +77,12 @@
       /** 站点ID */
       siteId: number
     }
-    fileList: (string | Partial<ElUploadInternalFileDetail>)[]
+    fileList: Partial<ElUploadInternalFileDetail>[]
   }
 
   @Component({ name: 'DeviceForm', components: {} })
   export default class DeviceForm extends Vue {
-    @ModelSync('value', 'change', { type: Object }) readonly formData!: IInstall
+    @ModelSync('value', 'change', { type: Object, default: () => [] }) readonly formData!: IInstall
     @Prop({ type: String, default: '8em' }) labelWidth!: string
     @Prop({ type: Array, default: () => ({}) }) types!: IDeviceType[]
     getDefalutNumberProp = getDefalutNumberProp

+ 21 - 4
src/views/spectrum/configuration/point/PointForm/index.vue

@@ -41,6 +41,8 @@
   import PipeQueryHelper from '@/utils/mapCommon/PipeQueryHelper'
   import { CesiumToSuperMap } from '@/utils/mapCommon/tools'
   import pipeConfig from '@/views/widgets/PipeUnitInfo/config.json'
+  import { ElUploadInternalFileDetail } from 'element-ui/types/upload'
+  import { getRemoteFile } from '@/api/ftp'
 
   interface IFormData {
     basis: {
@@ -64,12 +66,12 @@
     device: {
       typeId: number
       install: Partial<IPointDetailResult['installVo']>
+      fileList: Partial<ElUploadInternalFileDetail>[]
     }
     threshold: {
       standardId: number
       items: Partial<IPointDetailResult['targetVos']>
     }
-    fileList: IPointDetail['fileList']
   }
 
   const getDefaultFormData = () => ({
@@ -185,13 +187,19 @@
       const valid = !(await Promise.all(this.keys.map((key) => this.$refs[key].validate()))).some((item) => !item)
       if (valid) {
         console.log(this.formData)
-        const { basis, connect, device, threshold } = this.formData
+        const {
+          basis,
+          connect,
+          device: { fileList, ...device },
+          threshold
+        } = this.formData
         const data: IPointDetail = {
           ...basis,
           ...connect,
           ...device,
           ...this.$store.getters['project/info'],
-          targets: threshold.items as IPointDetail['targets']
+          targets: threshold.items,
+          fileList: (fileList || []).map((item) => item.raw).filter((item) => !!item)
         }
         this.$emit('submit', data)
       }
@@ -234,9 +242,18 @@
         ...rest
       } = result || {}
       const typeId = ((targetVos || [])[0] || {}).typeId
+      const { uploadFiles, ...install } = installVo
       this.formData = {
         connect: { drainageId, drainageName, drainageRoadName, drainageType, longitude2, latitude2, layerName },
-        device: { typeId, install: installVo || {} },
+        device: {
+          typeId,
+          install,
+          fileList: (uploadFiles || []).map(({ filePath: url, fileName: name, id: uid }) => ({
+            url: getRemoteFile(url),
+            name: name || url,
+            uid
+          }))
+        },
         threshold: {
           standardId: undefined,
           items: (targetVos || []).map((item) => {

+ 1 - 0
src/views/spectrum/configuration/point/widget.vue

@@ -143,6 +143,7 @@
     }
 
     async onSubmit(data: IPointDetail) {
+      console.log(data)
       this.loading[data.id ? 'update' : 'add'] = true
       try {
         const { result } = await (data.id ? updatePoint(data) : addPoint(data))

+ 6 - 9
src/views/spectrum/configuration/type/ParamForm.vue

@@ -2,11 +2,9 @@
   <tf-dialog v-bind="$attrs" v-on="listeners" @submit="onSubmit" :loading="loading">
     <el-form class="form" ref="form" v-bind="{ labelWidth: 'auto', size: 'small' }" :rules="rules" :model="formData">
       <el-form-item
-        v-for="{ name, label, type, required = false, options, on, ...rest } of formItems"
+        v-for="{ name, label, type, options, on, ...rest } of formItems"
         :key="name"
-        :required="required"
         :label="label"
-        :rules="rules"
         :prop="name"
       >
         <el-switch v-if="type === 'switch'" v-model="formData[name]" v-bind="rest" />
@@ -14,7 +12,7 @@
           v-else-if="type === 'input-number'"
           v-model="formData[name]"
           :placeholder="`请输入${label}`"
-          v-bind="{ ...rest, ...getDefalutNumberProp() }"
+          v-bind="{ ...getDefalutNumberProp(), ...rest }"
           clearable
           controls-position="right"
         />
@@ -47,7 +45,7 @@
   import { IDeviceTypeParamDictionary, IDeviceTypeParam } from '../api/common'
   import { getDefalutNumberProp } from '@/utils/constant'
 
-  const getDefaultData = () => ({ isshow: 1 })
+  const getDefaultData = () => ({ isshow: 1, showNo: 0 })
 
   @Component({ name: 'ParamForm', components: {} })
   export default class ParamForm extends Vue {
@@ -68,10 +66,9 @@
       return {
         dictionaryId: [{ required: true, message: '请选择设备指标', trigger: 'change' }],
         targetAlias: [
-          { required: true, message: '指标别名(缩写)不能为空', trigger: 'blur' },
+          { required: true, message: '指标别名(缩写)不能为空', trigger: 'blur' },
           { max: 40, message: '指标别名(缩写)不超过40个字符' }
         ],
-        isshow: [{ required: true, message: '请选择是否显示', trigger: 'blur' }],
         remark: [{ required: false, max: 255, message: '备注不能超过255个字符' }]
       }
     }
@@ -90,11 +87,11 @@
           }
         },
         { label: '指标名称', name: 'targetName', disabled: true },
-        { label: '指标别名(缩写)', name: 'targetAlias', required: true, maxlength: 40 },
+        { label: '指标别名(缩写)', name: 'targetAlias', maxlength: 40 },
         { label: '指标字段名', name: 'targetCode', disabled: true },
         { label: '指标单位', name: 'targetUnit', disabled: true },
         { label: '是否显示', name: 'isshow', type: 'switch', activeValue: 1, inactiveValue: 0 },
-        { label: '显示顺序', name: 'showNo', type: 'input-number' },
+        { label: '显示顺序', name: 'showNo', type: 'input-number', min: -9999 },
         { label: '备注', name: 'remark', type: 'textarea', rows: 4 }
       ]
     }

+ 3 - 3
src/views/spectrum/configuration/type/TypeForm.vue

@@ -27,7 +27,7 @@
   import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
   import { ElForm } from 'element-ui/types/form'
   import { IDeviceTypeDictionary, IDeviceType } from '../api/common'
-  import { getRemoteImg } from '@/api/ftp'
+  import { getRemoteFile } from '@/api/ftp'
   import { ElUploadInternalFileDetail } from 'element-ui/types/upload'
 
   const getDefaultValue = () => ({ dictionaryId: undefined, file: undefined, fileTypeID: 803 })
@@ -102,13 +102,13 @@
         this.formData = { ...val }
         const { iconFiles } = val || {}
         const { filePath } = (iconFiles || [])[0]
-        this.imageUrl = getRemoteImg(filePath)
+        this.imageUrl = getRemoteFile(filePath)
       } else {
         this.formData = getDefaultValue()
         this.imageUrl = ''
       }
 
-      if (filePath) this.imageUrl = getRemoteImg(filePath)
+      if (filePath) this.imageUrl = getRemoteFile(filePath)
     }
   }
 </script>

+ 4 - 4
src/views/spectrum/configuration/type/widget.vue

@@ -52,7 +52,7 @@
           @current-change="onCurrentTypeChange"
         >
           <template v-slot:icon="{ row }">
-            <el-image :src="getRemoteImg(row)" style="width: 100%" />
+            <el-image :src="getRemoteFile(row)" style="width: 100%" />
           </template>
         </tf-table>
       </el-col>
@@ -119,7 +119,7 @@
   import { getDefaultPagination } from '@/utils/constant'
   import { IDeviceType, IDeviceTypeParam, IDeviceTypeDictionary, IDeviceTypeParamDictionary } from '../api/common'
   import { deviceTypeCols, deviceTypeParamCols } from '../utils'
-  import { getRemoteImg } from '@/api/ftp'
+  import { getRemoteFile } from '@/api/ftp'
   import { IPagination } from '@/api/common'
 
   @Component({ name: 'DeviceTypes', components: { TypeForm, ParamForm } })
@@ -128,10 +128,10 @@
     deviceTypeCols = deviceTypeCols
     deviceTypeParamCols = deviceTypeParamCols
 
-    getRemoteImg(row: IDeviceType) {
+    getRemoteFile(row: IDeviceType) {
       const { iconFiles } = row || {}
       const { filePath } = (iconFiles || [])[0]
-      return getRemoteImg(filePath)
+      return getRemoteFile(filePath)
     }
 
     visible = { type: false, param: false }