Ver Fonte

项目详情优化

songxy há 1 ano atrás
pai
commit
2676750b33

+ 2 - 0
client/src/interface/project.ts

@@ -187,7 +187,9 @@ export interface SubProject {
 
 export interface ProjectMember {
   workerId: string
+  id?: string
   responsibility?: string
+  isManager?: number
 }
 
 export interface HandleProjectMemberDTO extends ProjectMember {

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

@@ -143,6 +143,24 @@ export const addMember = async (data: HandleProjectMemberDTO) => {
   )
 }
 
+/**
+ * 编辑项目成员
+ * @param data
+ */
+export const editorMember = async (data: {
+  id: string
+  responsibility?: string
+  isManager?: number
+}) => {
+  return await request.put(
+    {
+      url: '/project-worker-relation',
+      data
+    },
+    '/business'
+  )
+}
+
 /**
  * 项目里程碑
  * @param projectId

+ 1 - 0
client/src/views/OaSystem/projectCenter/projectDetail/components/xmht/index.scss

@@ -21,6 +21,7 @@
         >h2 {
           font-weight: 500;
           font-size: 24px;
+          cursor: pointer;
         }
         >span {
           display: inline-block;

+ 36 - 5
client/src/views/OaSystem/projectCenter/projectDetail/components/xmht/index.vue

@@ -46,7 +46,9 @@
     <div class="content">
       <template v-if="contractInfoIndex === 0">
         <div class="titleBox">
-          <h2>{{ mContractDetail?.name ?? '' }} </h2>
+          <h2 @click="processLookHandle(mContractDetail.instanceId as string)">
+            {{ mContractDetail?.name ?? '' }}
+          </h2>
           <span v-if="mContractDetail?.amountStatus === 1" class="tag">已签</span>
           <span v-else-if="mContractDetail?.amountStatus === 2" class="tag">未付清</span>
           <span v-else-if="mContractDetail?.amountStatus === 3" class="tag">已付清</span>
@@ -118,10 +120,6 @@
               </td>
             </tr>
             <tr>
-              <td class="th">委托方编号:</td>
-              <td>
-                <el-input v-model="mContractDetail.clientNumber" :disabled="!editor" />
-              </td>
               <td class="th">受托方:</td>
               <td>
                 <TreeSelectV2
@@ -132,6 +130,17 @@
                   :disabled="!editor"
                 />
               </td>
+              <td class="th">签订状态:</td>
+              <td>
+                <el-select style="width: 100%" v-model="mContractDetail.isSign" :disabled="!editor">
+                  <el-option
+                    v-for="item in contractSignList"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="Number(item.value)"
+                  />
+                </el-select>
+              </td>
             </tr>
             <tr>
               <td class="th">合同拿出日期:</td>
@@ -554,6 +563,7 @@ defineOptions({ name: 'XmhtComp' })
 const mainTypeList = getDictOptions(DICT_TYPE.CONTRACT_MAIN_TYPE)
 const signWayList = getDictOptions(DICT_TYPE.CONTRACT_SIGN_WAY)
 const secondTypeList = getDictOptions(DICT_TYPE.CONTRACT_SECOND_TYPE)
+const contractSignList = getDictOptions(DICT_TYPE.CONTRACT_SIGN_STATUS)
 
 const { query } = useRoute()
 const { id: _currentProjectId = '', contractId = '' } = query as {
@@ -677,6 +687,27 @@ const { mutate: saveContract } = useMutation(putContract, {
 const handleEditor = () => {
   editor.value = !editor.value
 }
+/***
+ * 查看合同流程
+ */
+const { mutate: startContractFlowMuate } = useMutation(startContractInvoice, {
+  onSuccess: (data) => openFlow(router, data, '开票申请')
+})
+
+/**
+ * 流程查看
+ */
+const processLookHandle = (instanceId: string) => {
+  router.push({
+    path: '/processLook',
+    query: {
+      url: `${
+        import.meta.env.VITE_PROCESS_DETAIL_URI
+      }/IFlowInstance/redirectFlowPage?flowInstanceId=${instanceId}`
+    }
+  })
+}
+/**
 /**
  * 发起开票申请流程
  */

+ 1 - 9
client/src/views/OaSystem/projectCenter/projectDetail/components/xmxx/AddSubProject.vue

@@ -53,17 +53,9 @@ const rules = reactive({
 const ruleFormRef = ref()
 const projectChildForm = ref(_projectChildFormSource)
 const { mutate: addSubProject } = useMutation(postSubProject, {
-  onSuccess: (data) => {
+  onSuccess: () => {
     onSuccessCallBack()
     projectChildForm.value = _projectChildFormSource
-    if (data) {
-      //新增项目成员
-      addMember({
-        projectId: data,
-        responsibility: '',
-        workerId: xmjlId.value as string
-      })
-    }
   }
 })
 const message = useMessage() // 消息弹窗

+ 113 - 41
client/src/views/OaSystem/projectCenter/projectDetail/components/xmxx/ProjectMember.vue

@@ -1,25 +1,51 @@
 <script setup lang="ts">
 import { useMutation, useQuery } from '@tanstack/vue-query'
-import { addMember, deleteMember, getProjectMember } from '@/service/project'
+import { addMember, editorMember, deleteMember, getProjectMember } from '@/service/project'
 import { ProjectMember } from '@/interface/project'
 import { ElMessage } from 'element-plus'
 import UserOrgTree from '@/views/OaSystem/components/UserOrgTree/index.vue'
 
-const defaultMemberData = {
+const defaultMemberData: ProjectMember = {
   workerId: '',
-  responsibility: ''
+  responsibility: '',
+  isManager: 0
 }
 /**
  * 项目成员
  */
+//匹配是否在初始化项目成员时新增项目经理
+const isSubmit = ref<boolean>(true)
 const props = defineProps<{
   projectId: string
+  xmjlId: string
 }>()
 const workerRelationBool = ref<boolean>(false)
 const projectWorkerRelation = ref<ProjectMember>(defaultMemberData)
 const { data: projectWorkerRelationList, refetch } = useQuery(
   [getProjectMember.name, props.projectId],
-  async () => await getProjectMember(props?.projectId)
+  async () => await getProjectMember(props?.projectId),
+  {
+    onSuccess(data) {
+      //匹配项目详情中项目经理是否与项目成员匹配,匹配新增目经理,不匹配不做任何操作
+      if (!isSubmit.value) return
+      const xmjl = data.filter((item) => item.workerId === props.xmjlId)
+      if (xmjl.length === 0) {
+        const oXmjl = data.filter((item) => item.isManager === 1)
+        if (oXmjl.length > 0) {
+          handleEditor({
+            id: oXmjl[0]?.id as string,
+            isManager: 0
+          })
+        }
+        handleAdd({
+          workerId: props.xmjlId,
+          responsibility: '项目经理',
+          isManager: 1,
+          projectId: props.projectId as string
+        })
+      }
+    }
+  }
 )
 watch(
   () => props.projectId,
@@ -27,41 +53,80 @@ watch(
     refetch()
   }
 )
-const { mutate: handleDelete } = useMutation(deleteMember, {
+/**
+ * 新增项目成员
+ */
+const isAdd = ref<boolean>(true)
+const handleAddClick = () => {
+  isAdd.value = true
+  workerRelationBool.value = true
+}
+const { mutate: handleAdd } = useMutation(addMember, {
   onSuccess: () => {
+    isSubmit.value = false
     void refetch()
+    workerRelationBool.value = false
+    projectWorkerRelation.value = defaultMemberData
     ElMessage({
-      message: '删除成功',
+      message: '添加成员成功',
       type: 'success'
     })
   }
 })
-
-const { mutate: handleAdd } = useMutation(addMember, {
+/***
+ * 编辑项目成员
+ */
+const handleEditorClick = (item: ProjectMember) => {
+  isAdd.value = false
+  workerRelationBool.value = true
+  projectWorkerRelation.value['id'] = item['id']
+  projectWorkerRelation.value['workerId'] = item['workerId']
+  projectWorkerRelation.value['responsibility'] = item['responsibility']
+}
+const { mutate: handleEditor } = useMutation(editorMember, {
   onSuccess: () => {
+    isSubmit.value = false
     void refetch()
     workerRelationBool.value = false
     projectWorkerRelation.value = defaultMemberData
     ElMessage({
-      message: '添加成员成功',
+      message: '成员更新成功',
+      type: 'success'
+    })
+  }
+})
+const handleAddOrEditorMember = () => {
+  if (isAdd.value) {
+    handleAdd({
+      ...projectWorkerRelation.value,
+      projectId: props.projectId as string
+    })
+  } else {
+    handleEditor({
+      id: projectWorkerRelation.value?.id as string,
+      responsibility: projectWorkerRelation.value.responsibility as string
+    })
+  }
+}
+/***
+ * 删除成员
+ */
+const { mutate: handleDelete } = useMutation(deleteMember, {
+  onSuccess: () => {
+    isSubmit.value = false
+    void refetch()
+    ElMessage({
+      message: '删除成功',
       type: 'success'
     })
   }
 })
-
 const handleDeleteMember = (workerId: string) => {
   handleDelete({
     workerId,
     projectId: props.projectId as string
   })
 }
-
-const handleAddMember = () => {
-  handleAdd({
-    ...projectWorkerRelation.value,
-    projectId: props.projectId as string
-  })
-}
 // 获取assets静态资源
 const getAssetURL = (img: string) => {
   return new URL(`../../../../../../assets/imgs/${img}`, import.meta.url).href
@@ -74,7 +139,7 @@ const getAssetURL = (img: string) => {
       <div class="total"
         >当前项目参与人员:<b>{{ projectWorkerRelationList?.length ?? 0 }}人</b></div
       >
-      <div class="handle-add-btn" @click="workerRelationBool = true">+ 新增人员</div>
+      <div class="handle-add-btn" @click="handleAddClick">+ 新增人员</div>
     </div>
     <ul>
       <li v-for="(item, index) in projectWorkerRelationList" :key="index">
@@ -91,17 +156,23 @@ const getAssetURL = (img: string) => {
           <p class="txt">电话:{{ item['mobile'] }}</p>
         </div>
 
-        <el-popconfirm
-          title="确定删除该成员?"
-          width="180px"
-          @confirm="handleDeleteMember(item.workerId)"
-        >
-          <template #reference>
-            <i class="del_icon">
-              <Icon icon="ep:delete" />
-            </i>
-          </template>
-        </el-popconfirm>
+        <div class="icon_group">
+          <i class="edit_icon" @click="handleEditorClick(item)">
+            <Icon icon="ep:edit" />
+          </i>
+          <el-popconfirm
+            title="确定删除该成员?"
+            v-if="item.isManager != 1"
+            width="180px"
+            @confirm="handleDeleteMember(item.workerId)"
+          >
+            <template #reference>
+              <i class="del_icon">
+                <Icon icon="ep:delete" />
+              </i>
+            </template>
+          </el-popconfirm>
+        </div>
       </li>
     </ul>
   </div>
@@ -119,6 +190,7 @@ const getAssetURL = (img: string) => {
                 <el-form-item label="人员选择">
                   <UserOrgTree
                     :default-expand-all="true"
+                    :disabled="!isAdd"
                     v-model="projectWorkerRelation['workerId']"
                   />
                 </el-form-item>
@@ -137,7 +209,7 @@ const getAssetURL = (img: string) => {
     </div>
     <div class="btnGroup">
       <el-button type="default" @click="workerRelationBool = false">取消</el-button>
-      <el-button type="primary" @click="handleAddMember">保存</el-button>
+      <el-button type="primary" @click="handleAddOrEditorMember">保存</el-button>
     </div>
   </div>
 </template>
@@ -183,20 +255,20 @@ const getAssetURL = (img: string) => {
 
       &:not(.operation) {
         position: relative;
-
-        > .del_icon {
+        > .icon_group {
           position: absolute;
-          top: calc(50% - 7px);
+          bottom: 10px;
           right: 10px;
-          display: none;
-          cursor: pointer;
-        }
-
-        &:hover {
-          background-color: #f2f7ff;
-
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+          > i {
+            cursor: pointer;
+          }
           > .del_icon {
-            display: block;
+            display: inline-block;
+            cursor: pointer;
+            margin-left: 10px;
           }
         }
 

+ 6 - 2
client/src/views/OaSystem/projectCenter/projectDetail/components/xmxx/index.vue

@@ -198,7 +198,11 @@
         </div>
       </template>
       <!--项目成员-->
-      <ProjectMember v-else-if="currentIndex === 1" :projectId="currentProjectId" />
+      <ProjectMember
+        v-else-if="currentIndex === 1"
+        :xmjlId="projectDetail['xmjlId']"
+        :projectId="currentProjectId"
+      />
       <!--项目里程碑-->
       <ProjectMileStone v-else :projectId="currentProjectId" />
     </div>
@@ -213,7 +217,7 @@
 </template>
 <script setup lang="ts">
 import { ElMessage } from 'element-plus'
-import { DICT_TYPE, getDictLabel, getDictOptions } from '@/utils/dict'
+import { DICT_TYPE, getDictOptions } from '@/utils/dict'
 import UserOrgTree from '@/views/OaSystem/components/UserOrgTree/index.vue'
 import DeptTree from '@/views/OaSystem/components/DeptTree/index.vue'
 import DistrictTree from '@/views/OaSystem/components/DistrictTree/index.vue'

+ 2 - 0
client_h5/src/utils/request.ts

@@ -9,6 +9,8 @@ const instance = axios.create(Object.assign({}, defaultConfig));
  
 instance.interceptors.request.use(
     (config) => {
+    console.log("config-------------------")
+    console.log(config)
         return config;
     },
     (error) => {