scorpio hace 2 años
padre
commit
f111b257a3

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

@@ -289,6 +289,14 @@ export default {
       'post'
     )
   },
+  /**
+   * 更新下一个阶段
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  updateCurrentStage(params) {
+    return fetch('/blade-project-manage-v2/stage/v2/next-stage', params)
+  },
   /**
    * 管理员审批项目
    */

+ 81 - 0
src/views/project/componens/approval.vue

@@ -0,0 +1,81 @@
+<template>
+  <div>
+    <!--    项目审批-->
+    <el-dialog v-model="showDialog" title="审核" width="500px">
+      <div class="flex flex-justify-start flex-col">
+        <div class="full-width flex flex-justify-start flex-align-center mb-20">
+          <span>审核状态:</span>
+          <el-radio-group v-model="approvalStatus">
+            <el-radio :label="3">通过</el-radio>
+            <el-radio :label="4">不通过</el-radio>
+          </el-radio-group>
+        </div>
+        <el-input
+          class="mt-20"
+          type="textarea"
+          :rows="5"
+          v-model="approvalMsg"
+          placeholder="请填写审批意见"
+        />
+        <div class="full-width flex flex-justify-end mt-20">
+          <el-button plain type="primary" @click="showDialog = false"
+            >取消
+          </el-button>
+          <el-button type="primary" @click="projectApproval">确定</el-button>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    projectId: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      showDialog: false,
+      approvalMsg: '',
+      approvalStatus: 3
+    }
+  },
+  methods: {
+    show() {
+      this.showDialog = true
+    },
+    /**
+     * 管理员审批项目
+     * approvalStatus === 4 审核不通过,需要填写原因
+     */
+    projectApproval() {
+      if (this.approvalStatus === 4 && this.approvalMsg.length === 0) {
+        this.$message.error('请填写审核意见')
+        return
+      }
+      this.showDialog = false
+      this.$api.project
+        .approvalProject({
+          id: this.projectId,
+          reportType: this.approvalStatus,
+          receiptMsg: this.approvalMsg
+        })
+        .then(res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+            this.approvalStatus = 3
+            this.approvalMsg = ''
+            this.$emit('success')
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 6 - 1
src/views/project/componens/info3.vue

@@ -1,5 +1,6 @@
 <template>
   <wt-card title="相关合同" class="mt-10">
+    {{ form.can_update }}
     <div
       class="full-width text-right main-color pointer"
       style="margin-top: -10px"
@@ -20,7 +21,7 @@
         <template #menu-left>
           <div class="flex flex-center">
             <filepicker
-              v-if="form.can_update"
+              v-if="canEdit"
               btn-text="新增合同"
               :project-id="projectId"
               @submit="selection"
@@ -43,6 +44,10 @@ export default {
     filepicker
   },
   props: {
+    canEdit: {
+      type: Boolean,
+      default: false
+    },
     projectId: {
       required: true,
       type: String,

+ 1 - 7
src/views/project/componens/top.vue

@@ -68,13 +68,7 @@ export default {
     changeStage(res) {
       const tmp = this.stages.find(ele => ele.id === res)
       this.$emit('filter', tmp.sort)
-      this.$api.project
-        .changeStage({ projectId: this.projectId, stageId: res })
-        .then(res => {
-          if (res.code === 200) {
-            this.$emit('change', res)
-          }
-        })
+      this.$emit('change', res)
     }
   }
 }

+ 43 - 8
src/views/project/index.vue

@@ -8,6 +8,7 @@
       </template>
       <template #default>
         <top
+          ref="top"
           :project-id="projectId"
           @change="changeStage"
           @filter="filterStage"
@@ -29,7 +30,11 @@
         :industry="industry"
       />
       <!--      相关合同-->
-      <info3 :project-id="projectId" :stage-id="stageId" />
+      <info3
+        :project-id="projectId"
+        :can-edit="detail.can_update"
+        :stage-id="stageId"
+      />
       <!--      投资基本情况-->
       <info4 v-if="[4].includes(currentStage)" :project-id="projectId" />
       <!--      建成投产后效益测算-->
@@ -47,17 +52,29 @@
         <el-button type="primary" plain @click="projectCancel">退 库</el-button>
         <el-button
           type="primary"
-          v-if="detail.is_report === 0"
+          v-if="[0, 1, 4].includes(detail.report_type)"
           @click="projectReport"
           plain
           >上报审核</el-button
         >
-        <el-button type="primary" plain v-if="detail.report_type === 3"
+        <el-button
+          type="primary"
+          plain
+          v-if="detail.report_type === 2"
+          @click="$refs.approval.show()"
+          >审 核</el-button
+        >
+        <el-button
+          type="primary"
+          plain
+          v-if="detail.report_type === 3"
+          @click="projectReportFormal"
           >上报到固定资产</el-button
         >
         <el-button type="primary" @click="nextStage">下一阶段</el-button>
       </div>
     </div>
+    <approval ref="approval" :project-id="projectId" @success="getInfo" />
   </div>
 </template>
 
@@ -82,6 +99,7 @@ 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'
+import approval from '@/views/project/componens/approval.vue'
 
 export default {
   components: {
@@ -94,7 +112,8 @@ export default {
     tipsCustom,
     top,
     info3,
-    Info8
+    Info8,
+    approval
   },
   setup() {
     const user = useStore()
@@ -106,7 +125,8 @@ export default {
       stageId: '',
       currentStage: 1,
       industry: null,
-      detail: {}
+      detail: {},
+      stageFilter: false
     }
   },
   mounted() {
@@ -120,7 +140,9 @@ export default {
           this.detail = res.data
           delete this.detail._id
           this.stageId = res.data.stageId
-          this.currentStage = res.data.current_stage
+          if (this.stageFilter === false) {
+            this.currentStage = res.data.current_stage
+          }
           this.detail.tagsName =
             this.detail.tags === 1 ? '政府投资项目' : '企业投资项目'
           const status = confing.reportTypes.find(
@@ -140,7 +162,9 @@ export default {
       this.industry = industry
     },
     filterStage(res) {
+      this.stageFilter = true
       this.currentStage = res
+      this.getInfo()
     },
     nextStage() {
       this.$confirm(
@@ -162,11 +186,21 @@ export default {
       this.$api.project.proUpdate(this.detail).then(res => {
         if (res.code === 200) {
           this.$message.success(res.msg)
+          this.updateCurrentStage(this.detail.current_stage)
         } else {
           this.$message.error(res.msg)
         }
       })
     },
+    updateCurrentStage(sort) {
+      this.$api.project
+        .updateCurrentStage({ projectId: this.projectId, sort })
+        .then(res => {
+          if (res.code === 200) {
+            this.$refs.top.getStage()
+          }
+        })
+    },
     /**
      * 股室上报项目到管理员
      */
@@ -176,6 +210,7 @@ export default {
           this.$api.project.upReportType({ id: this.projectId }).then(res => {
             if (res.code === 200) {
               this.$message.success(res.msg)
+              this.getInfo()
             } else {
               this.$message.error(res.msg)
             }
@@ -194,6 +229,7 @@ export default {
             .then(res => {
               if (res.code === 200) {
                 this.$message.success(res.msg)
+                this.getInfo()
               } else {
                 this.$message.error(res.msg)
               }
@@ -205,7 +241,6 @@ export default {
      * 项目退库
      */
     projectCancel() {
-      console.log('rrrr')
       this.$prompt('请输入退库原因', '提示', {}).then(({ value }) => {
         if (value === null || value.length === 0) {
           this.$message.error('请输入退库原因')
@@ -216,7 +251,7 @@ export default {
           .then(res => {
             if (res.code === 200) {
               this.$message.success(res.msg)
-              this.refreshChange()
+              this.getInfo()
             } else {
               this.$message.error(res.msg)
             }