Browse Source

项目性详情优化

songxy 1 year ago
parent
commit
a41c0434bc

+ 16 - 0
client/src/service/project.ts

@@ -29,6 +29,22 @@ export const getProjectWithChildrenById = async (projectId: ProjectId): Promise<
   )
 }
 
+/**
+ * 发起项目验收、结项、中止
+ * @param projectId
+ */
+export const projectStatusAndProcess = async (params: {
+  projectId: ProjectId
+  sfys: string
+}): Promise<ProjectRecord> => {
+  return await request.get(
+    {
+      url: '/ProjectStatus/ProjectProcess',
+      params
+    },
+    '/business'
+  )
+}
 /**
  * 修改项目信息
  * @param data

+ 9 - 5
client/src/views/OaSystem/marketCenter/contractSubOut/applyIndex.vue

@@ -41,8 +41,8 @@
           >
           <el-button type="danger" @click="useMoneySubmit">
             <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
-            发起用款</el-button
-          >
+            发起用款
+          </el-button>
         </div>
       </div>
     </div>
@@ -197,6 +197,7 @@ const handleCurrentChange = (pageNo: number) => {
  */
 const currentProcess = ref<{
   id: string
+  contractId: string
   applyType: number
   isSign: number
   projectId?: string
@@ -204,12 +205,13 @@ const currentProcess = ref<{
 } | null>(null)
 const handleSelectionChange = (arrs) => {
   if (arrs.length === 0) return
-  console.log(arrs)
   const item = arrs[arrs.length - 1]
   currentProcess.value = {
     id: item.id,
+    contractId: item.contractId,
     applyType: item.applyType,
-    isSign: item.isSign
+    isSign: item.isSign,
+    projectId: item.projectId
   }
 }
 const processSubmit = async (): Promise<void> => {
@@ -238,13 +240,15 @@ const processSubmit = async (): Promise<void> => {
 }
 const useMoneySubmit = (): void => {
   const urlApi: string = '/UseMoney/contractProcess'
+  console.log(currentProcess.value)
   request
     .get(
       {
         url: urlApi,
         params: {
           projectId: currentProcess.value?.projectId,
-          supplierId: currentProcess.value?.clientId
+          supplierId: currentProcess.value?.clientId,
+          contractId: currentProcess.value?.contractId
         }
       },
       '/business'

+ 35 - 28
client/src/views/OaSystem/marketCenter/contractSubOut/signIndex.vue

@@ -35,10 +35,10 @@
             <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
             查询</el-button
           >
-          <el-button type="danger">
+          <el-button type="danger" @click="useMoneySubmit">
             <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
-            发起用款</el-button
-          >
+            发起用款
+          </el-button>
         </div>
       </div>
     </div>
@@ -107,6 +107,7 @@
 <script setup lang="ts">
 import { useRouter } from 'vue-router'
 import { ElMessage } from 'element-plus'
+import { openFlow } from '@/utils/flow'
 import { getAssetURL } from '@/utils/auth'
 import request from '@/config/axios'
 
@@ -182,47 +183,53 @@ const handleCurrentChange = (pageNo: number) => {
  */
 const currentProcess = ref<{
   id: string
+  contractId: string
   applyType: number
   isSign: number
+  projectId?: string
+  clientId?: string
 } | null>(null)
 const handleSelectionChange = (arrs) => {
   if (arrs.length === 0) return
   const item = arrs[arrs.length - 1]
-  alert(item.isSign)
   currentProcess.value = {
     id: item.id,
+    contractId: item.contractId,
     applyType: item.applyType,
-    isSign: item.isSign
+    isSign: item.isSign,
+    projectId: item.projectId
   }
 }
-const processSubmit = async (): Promise<void> => {
-  let urlApi: string = ''
-  if (currentProcess.value?.applyType === null) return
-  if (currentProcess.value?.isSign === 0) {
-    ElMessage.warning('该合同不能签合同,无法发起合同签订!')
+const useMoneySubmit = (): void => {
+  const urlApi: string = '/UseMoney/contractProcess'
+  request
+    .get(
+      {
+        url: urlApi,
+        params: {
+          projectId: currentProcess.value?.projectId,
+          supplierId: currentProcess.value?.clientId,
+          contractId: currentProcess.value?.contractId
+        }
+      },
+      '/business'
+    )
+    .then((data) => {
+      openFlow(router, data, '用款申请')
+    })
+}
+const operateClick = (row: any) => {
+  if (!row.projectId) {
+    ElMessage.warning('该项目ID不存在,无法打开项目详情!')
     return
   }
-  if (currentProcess.value?.applyType === 1) {
-    urlApi = `/subcontract/process`
-  } else if (currentProcess.value?.applyType === 2) {
-    urlApi = `/outsourcing/process`
+  if (!row.contractId) {
+    ElMessage.warning('该合同ID不存在,无法打开项目详情!')
+    return
   }
-  const result = await request.get(
-    {
-      url: urlApi,
-      params: {
-        applyId: currentProcess.value?.id
-      }
-    },
-    '/business'
-  )
-  console.log('result----------------------------')
-  console.log(result)
-}
-const operateClick = (row: any) => {
   router.push({
     path: '/projectDetail',
-    query: { id: row.id }
+    query: { id: row.projectId, contractId: row.contractId }
   })
 }
 onMounted(() => {

+ 53 - 11
client/src/views/OaSystem/projectCenter/projectDetail/projectDetail.vue

@@ -36,24 +36,37 @@
               </template>
             </el-popconfirm>
           </template>
-          <li v-show="currentIndex === 0" @click="addSubProject">添加子项目</li>
-          <li @click="handleStartSubcontract">分包申请</li>
-          <li @click="handleStartOutsourcing">外包申请</li>
-          <li v-if="projectDetail?.['xmzt'] === 1" @click="editorProjectState(4)">验收</li>
+          <li v-show="currentIndex === 0 && projectDetail?.['xmzt'] !== 3" @click="addSubProject">
+            添加子项目
+          </li>
+          <li v-show="projectDetail?.['xmzt'] !== 3" @click="handleStartSubcontract">分包申请</li>
+          <li v-show="projectDetail?.['xmzt'] !== 3" @click="handleStartOutsourcing">外包申请</li>
+          <li v-if="projectDetail?.['xmzt'] === 1" @click="projectStatusAndProcessHandler('ys')"
+            >验收</li
+          >
           <el-popconfirm
             v-if="projectDetail?.['xmzt'] === 1"
-            :title="`是否${projectDetail?.['xmzt'] === 3 ? '恢复' : '中止'}项目【${
-              projectDetail['xmbh']
-            }】?`"
+            :title="`是否中止项目【${projectDetail['xmbh']}】?`"
+            width="280px"
+            @confirm="editorProjectState(3)"
+          >
+            <template #reference>
+              <li @click="projectStatusAndProcessHandler('zz')">中止</li>
+            </template>
+          </el-popconfirm>
+          <el-popconfirm
+            v-if="projectDetail?.['xmzt'] === 3"
+            :title="`是否恢复项目【${projectDetail['xmbh']}】?`"
             width="280px"
             @confirm="editorProjectState(3)"
           >
             <template #reference>
-              <li>{{ projectDetail?.['xmzt'] === 3 ? '恢复中止' : '中止' }}</li>
+              <li @click="projectStatusAndProcessHandler('hf')">恢复</li>
             </template>
           </el-popconfirm>
-          <li v-if="projectDetail?.['xmzt'] === 4" @click="editorProjectState(2)">结项</li>
-          <li v-if="projectDetail?.['xmzt'] === 3" @click="editorProjectState(1)">恢复</li>
+          <li v-if="projectDetail?.['xmzt'] === 4" @click="projectStatusAndProcessHandler('jx')">
+            结项
+          </li>
           <li @click="processLookHandle">查看流程</li>
         </ul>
       </div>
@@ -128,7 +141,7 @@ import { openFlow } from '@/utils/flow'
 import { useMutation } from '@tanstack/vue-query'
 import { ProjectId } from '@/interface/project'
 import { Contract } from '@/interface/contract'
-import { getProjectWithChildrenById } from '@/service/project'
+import { getProjectWithChildrenById, projectStatusAndProcess } from '@/service/project'
 import XmxxComp from './components/xmxx/index.vue'
 import XmhtComp from './components/xmht/index.vue'
 import XmcbComp from './components/xmcb/index.vue'
@@ -162,6 +175,35 @@ const addSubProject: () => void = () => {
   dynamicRef.value?.handleAddSubProject()
 }
 
+/**
+ * 发起项目验收或结项
+ */
+const sfysType: Ref<string> = ref('')
+const { mutate: startProjectStatusAndProcess } = useMutation(projectStatusAndProcess, {
+  onSuccess: (data) => {
+    const subTitle: string =
+      sfysType.value === 'ys'
+        ? '验收'
+        : sfysType.value === 'jx'
+        ? '结项'
+        : sfysType.value === 'zz'
+        ? '中止'
+        : ''
+    openFlow(router, data, `合同${subTitle}`)
+  }
+})
+const projectStatusAndProcessHandler = (sfys: string) => {
+  if (!sfys) {
+    console.warn('sfys字段值不能为空!')
+    return
+  }
+  sfysType.value = sfys
+  startProjectStatusAndProcess({
+    projectId: projectId as ProjectId,
+    sfys
+  })
+}
+
 /**
  * 流程查看
  */