scorpioyq 2 years ago
parent
commit
bdf08d6ab3

+ 28 - 0
src/api/project/index.js

@@ -111,6 +111,10 @@ export default {
     // 单个项目包含阶段
     return fetch('/blade-project-manage-v2/stage/v2/projectStages', params)
   },
+  changeStage(params) {
+    // 切换阶段保存
+    return fetch('/blade-project-manage-v2/folder/change-stage', params)
+  },
   folderList(params) {
     // 阶段包含文件夹列表
     return fetch(
@@ -375,6 +379,30 @@ export default {
       'post',
       'json'
     )
+  },
+  //项目前期文件列表
+  preliminaryFiles(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/situation-file-list',
+      params
+    )
+  },
+  //添加项目前期文件
+  preliminaryFilesAdd(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/situation-save-file',
+      params,
+      'post',
+      'json'
+    )
+  },
+  //删除项目前期文件
+  preliminaryFilesRemove(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/situation-delete-file',
+      params,
+      'post'
+    )
   }
 }
 

+ 2 - 0
src/layout/top.vue

@@ -92,6 +92,7 @@ import { useStore } from '../store/user.js'
 import permissionStore from '@/store/permission.js'
 import search from './search/index.vue'
 import config from '../config/website.js'
+import { setWaterMark } from '@/utils/watermark.js'
 
 export default {
   name: 'top',
@@ -178,6 +179,7 @@ export default {
   mounted() {
     this.initWebSocket()
     this.readCount()
+    setWaterMark(this.user.info.deptName, this.user.info.nickName)
   },
   unmounted() {
     this.websock.close() // 离开路由之后断开websocket连接

+ 38 - 37
src/utils/watermark.js

@@ -1,53 +1,54 @@
 /**  水印添加方法  */
 
 let setWatermark = (str1, str2) => {
-    let id = '1.23452384164.123412415'
+  let id = '1.23452384164.123412415'
 
-    if (document.getElementById(id) !== null) {
-        document.body.removeChild(document.getElementById(id))
-    }
+  if (document.getElementById(id) !== null) {
+    document.body.removeChild(document.getElementById(id))
+  }
 
-    let can = document.createElement('canvas')
-    // 设置canvas画布大小
-    can.width = 250
-    can.height = 180
+  let can = document.createElement('canvas')
+  // 设置canvas画布大小
+  can.width = 420
+  can.height = 180
 
-    let cans = can.getContext('2d')
-    cans.rotate(-22.5 * Math.PI / 180) // 水印旋转角度
-    cans.font = '15px Vedana'
-    cans.fillStyle = '#666666'
-    cans.textAlign = 'center'
-    cans.textBaseline = 'Middle'
-    cans.fillText(str1, can.width / 2, can.height) // 水印在画布的位置x,y轴
-    cans.fillText(str2, can.width / 2, can.height + 22)
+  let cans = can.getContext('2d')
+  cans.rotate((-22.5 * Math.PI) / 180) // 水印旋转角度
+  cans.font = '15px Vedana'
+  cans.fillStyle = '#666666'
+  cans.textAlign = 'center'
+  cans.textBaseline = 'Middle'
+  cans.fillText(str1, can.width / 2, can.height) // 水印在画布的位置x,y轴
+  cans.fillText(str2, can.width / 2, can.height + 22)
 
-    let div = document.createElement('div')
-    div.id = id
-    div.style.pointerEvents = 'none'
-    div.style.top = '40px'
-    div.style.left = '0px'
-    div.style.opacity = '0.15'
-    div.style.position = 'fixed'
-    div.style.zIndex = '100000'
-    div.style.width = document.documentElement.clientWidth + 'px'
-    div.style.height = document.documentElement.clientHeight  + 'px'
-    div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat'
-    document.body.appendChild(div)
-    return id
+  let div = document.createElement('div')
+  div.id = id
+  div.style.pointerEvents = 'none'
+  div.style.top = '40px'
+  div.style.left = '0px'
+  div.style.opacity = '0.15'
+  div.style.position = 'fixed'
+  div.style.zIndex = '100000'
+  div.style.width = document.documentElement.clientWidth + 'px'
+  div.style.height = document.documentElement.clientHeight + 'px'
+  div.style.background =
+    'url(' + can.toDataURL('image/png') + ') left top repeat'
+  document.body.appendChild(div)
+  return id
 }
 
 // 添加水印方法
 export const setWaterMark = (str1, str2) => {
-    let id = setWatermark(str1, str2)
-    if (document.getElementById(id) === null) {
-        id = setWatermark(str1, str2)
-    }
+  let id = setWatermark(str1, str2)
+  if (document.getElementById(id) === null) {
+    id = setWatermark(str1, str2)
+  }
 }
 
 // 移除水印方法
 export const removeWatermark = () => {
-    let id = '1.23452384164.123412415'
-    if (document.getElementById(id) !== null) {
-        document.body.removeChild(document.getElementById(id))
-    }
+  let id = '1.23452384164.123412415'
+  if (document.getElementById(id) !== null) {
+    document.body.removeChild(document.getElementById(id))
+  }
 }

+ 61 - 42
src/views/project/componens/info2.vue

@@ -6,16 +6,24 @@
         :data="data"
         ref="crud"
         v-model="form"
+        v-model:page="page"
         :before-open="beforeOpen"
         @row-del="rowDel"
+        @current-change="currentChange"
+        @size-change="sizeChange"
         @refresh-change="refreshChange"
-        @row-save="rowSave"
-        @row-update="rowUpdate"
       >
+        <template #menu="{ row }">
+          <preview :id="row.bladeFileId">
+            <template #title>
+              <el-button type="primary" text icon="View">查看</el-button>
+            </template>
+          </preview>
+        </template>
         <template #menu-left>
           <div class="flex flex-center">
             <filepicker
-              :project-id="info.id"
+              :project-id="projectId"
               :command="dictList"
               @submit="selection"
             />
@@ -29,13 +37,30 @@
 <script>
 import wtCard from '@/components/wt-card/index.vue'
 import filepicker from '@/components/filepicker/index.vue'
+import preview from '@/views/resource/component/preview.vue'
 
 export default {
-  components: { wtCard, filepicker },
+  components: { wtCard, filepicker, preview },
   props: {
-    info: {
-      type: Object,
-      default: null
+    projectId: {
+      required: true,
+      type: String,
+      default: ''
+    },
+    stageId: {
+      required: true,
+      type: String,
+      default: ''
+    }
+  },
+  watch: {
+    projectId: {
+      handler(val) {
+        if (val.length > 0) {
+          this.onLoad()
+        }
+      },
+      immediate: true
     }
   },
   data() {
@@ -49,7 +74,7 @@ export default {
         size: 'mini',
         addBtn: false,
         editBtn: false,
-        viewBtn: true,
+        viewBtn: false,
         delBtn: true,
         columnBtn: false,
         labelWidth: 140,
@@ -57,22 +82,22 @@ export default {
         column: [
           {
             label: '文件名称',
-            prop: 'title',
+            prop: 'fileName',
             fixed: true,
             width: 400
           },
           {
             label: '文号',
-            prop: 'amount'
+            prop: 'docNumber'
           },
           {
             label: '上传人',
-            prop: 'contacts',
+            prop: 'createUserName',
             width: 120
           },
           {
             label: '上传时间',
-            prop: 'partyB'
+            prop: 'createDate'
           }
         ]
       },
@@ -92,7 +117,7 @@ export default {
         if (res.code === 200) {
           if (code === 'traffic') {
             this.dictList = res.data.map(e => {
-              return { label: e.dictValue, value: e.dictKey }
+              return { label: e.dictValue, value: e.dictKey, code: code }
             })
           }
         }
@@ -101,25 +126,16 @@ export default {
     onLoad() {
       this.loading = true
       const data = Object.assign({
-        projectId: this.projectId,
-        stageId: this.stageId
+        projectId: this.projectId
       })
-      this.$api.contract
-        .contractList(Object.assign(this.page, data))
+      this.$api.project
+        .preliminaryFiles(Object.assign(this.page, data))
         .then(res => {
-          this.data = res.data.records.map(ele => {
-            if (ele.contractsStatus === -1) {
-              ele.contractsStatus = ''
-            }
-            if (ele.type === -1) {
-              ele.type = ''
-            }
-            return ele
-          })
-          this.page.total = res.data.total
-        })
-        .finally(() => {
           this.loading = false
+          if (res.code === 200) {
+            this.data = res.data.records
+            this.page.total = res.data.total
+          }
         })
     },
     beforeOpen(done, type) {
@@ -135,16 +151,17 @@ export default {
       this.$confirm('确定将选择数据删除?', {
         type: 'warning'
       }).then(res => {
-        console.log(res)
         if (res === 'confirm') {
-          this.$api.contract.contractRemove({ ids: row.id }).then(res => {
-            if (res.code === 200) {
-              this.$message.success(res.msg)
-              this.onLoad()
-            } else {
-              this.$message.error(res.msg)
-            }
-          })
+          this.$api.project
+            .preliminaryFilesRemove({ ids: row.id })
+            .then(res => {
+              if (res.code === 200) {
+                this.$message.success(res.msg)
+                this.onLoad()
+              } else {
+                this.$message.error(res.msg)
+              }
+            })
         }
       })
     },
@@ -161,13 +178,15 @@ export default {
       console.log(command, extra)
       const tmps = list.map(ele => {
         return {
-          fileId: ele.fileId,
+          bladeFileId: ele.fileId,
           projectId: ele.projectId,
-          pid: ele.id,
-          type: command.value
+          fileId: ele.id,
+          dictKey: command.value,
+          code: command.code,
+          folderId: ele.parentId
         }
       })
-      this.$api.project.linkFile(tmps).then(res => {
+      this.$api.project.preliminaryFilesAdd(tmps).then(res => {
         if (res.code === 200) {
           this.refreshChange()
         } else {

+ 24 - 18
src/views/project/componens/top.vue

@@ -3,17 +3,17 @@
     <div class="white-bg border radius-5 picker flex flex-center">
       <span class="padding">项目阶段:</span>
       <el-select
-        class="padding-right"
-        style="width: 200px"
-        clearable
-        v-model="stage"
-        @change="changeStage"
+          class="padding-right"
+          style="width: 200px"
+          clearable
+          v-model="stage"
+          @change="changeStage"
       >
         <el-option
-          v-for="item in stages"
-          :key="item.id"
-          :label="item.name"
-          :value="item.id"
+            v-for="item in stages"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
         />
       </el-select>
     </div>
@@ -51,17 +51,23 @@ export default {
      */
     getStage() {
       this.$api.project
-        .includeStage({ projectId: this.projectId })
-        .then(res => {
-          if (res.code === 200) {
-            this.stages = res.data
-            this.stage = this.stages.find(ele => ele.isLastSelect === 1).id
-            this.$emit('change', this.stage)
-          }
-        })
+          .includeStage({projectId: this.projectId})
+          .then(res => {
+            if (res.code === 200) {
+              this.stages = res.data
+              this.stage = this.stages.find(ele => ele.isLastSelect === 1).id
+              this.$emit('change', this.stage)
+            }
+          })
     },
     changeStage(res) {
-      this.$emit('change', res)
+      this.$api.project.changeStage({projectId: this.projectId, stageId: res}).then(res => {
+        if (res.code === 200) {
+          this.$emit('change', res)
+        }
+      })
+
+
     }
   }
 }

+ 9 - 4
src/views/project/index.vue

@@ -11,15 +11,15 @@
       </template>
     </tips-custom>
     <!--    content-->
-    <div style="margin-bottom: 60px">
+    <div style="margin-bottom: 65px">
       <info1 :info="detail" />
-      <info2 :info="detail" />
+      <info2 :project-id="projectId" :stage-id="stageId" />
       <info3 :project-id="projectId" :stage-id="stageId" />
       <info4 :info="detail" />
       <info5 :info="detail" />
       <info6 :project-id="projectId" />
       <info7 :info="detail" />
-      <info8 :project-id="projectId" />
+      <info8 v-if="user.info.type === 4" :project-id="projectId" />
     </div>
     <!--    buttom-->
     <div class="bottom flex flex-center flex-justify-end">
@@ -52,6 +52,7 @@ import Info5 from '@/views/project/componens/info5.vue'
 import Info6 from '@/views/project/componens/info6.vue'
 import Info7 from '@/views/project/componens/info7.vue'
 import Info8 from '@/views/project/componens/info8.vue'
+import { useStore } from '@/store/user.js'
 
 export default {
   components: {
@@ -66,6 +67,10 @@ export default {
     info3,
     Info8
   },
+  setup() {
+    const user = useStore()
+    return { user }
+  },
   data() {
     return {
       projectId: '',
@@ -106,7 +111,7 @@ export default {
 .bottom {
   position: fixed;
   bottom: 0;
-  height: 66px;
+  height: 68px;
   width: 1300px;
   background-color: white;
   box-shadow: 0px -5px 10px rgba(52, 52, 52, 0.1);

+ 1 - 0
src/views/resource/component/preview.vue

@@ -96,6 +96,7 @@ export default {
   methods: {
     detail() {
       if (Number(this.id, 10).toString() === 'NaN') {
+        console.log('yyyy')
         // 如果id 不是数字开头,即mongo 62开头的id,查看文章详情
         this.$api.resource.fileDetail(this.id).then(res => {
           if (res.code === 200) {