瀏覽代碼

项目产值BUG修复和功能优化

songxy 10 月之前
父節點
當前提交
ea87ae2310

+ 21 - 11
client/src/views/OaSystem/marketCenter/projectCheck/index.vue

@@ -29,14 +29,14 @@
           @selection-change="handleSelectionChange"
           v-loading="loading"
         >
-          <el-table-column type="selection" width="55" />
+          <el-table-column v-if="currentTab === '0'" type="selection" width="55" />
           <el-table-column label="序号" width="100" align="center">
             <template #default="scope">{{ scope.$index + 1 }}</template>
           </el-table-column>
           <el-table-column :show-overflow-tooltip="true" prop="xmmc" label="项目名称" width="280" />
-          <el-table-column :show-overflow-tooltip="true" prop="xmbm" label="项目部门" width="250" />
-          <el-table-column label="项目经理" prop="xmjl" width="160" />
-          <el-table-column label="项目状态" width="120" align="center">
+          <el-table-column :show-overflow-tooltip="true" prop="xmbm" label="项目部门" width="160" />
+          <el-table-column label="项目经理" prop="xmjl" width="100" />
+          <el-table-column label="项目状态" width="100" align="center">
             <template #default="scope">
               {{ getDictLabel(DICT_TYPE.PROJECT_STATUS, scope.row.xmzt) }}
             </template>
@@ -48,11 +48,11 @@
             <template #default="scope">{{ scope.row.returnAmount }}</template>
           </el-table-column>
           <el-table-column label="本年初始进度" width="140" align="center">
-            <template #default="scope">{{ scope.row.finishProgress }}</template>
+            <template #default="scope">{{ scope.row.finishProgress * 100 }}%</template>
           </el-table-column>
           <el-table-column label="现进度" width="120" align="center">
             <template #default="scope">
-              <span>{{ scope.row.reportProgress }}</span>
+              <span>{{ scope.row.reportProgress }}%</span>
             </template>
           </el-table-column>
           <el-table-column label="进度说明" width="220" align="center">
@@ -141,9 +141,11 @@
             :timestamp="convertTimeToDate(activity.auditDate)"
           >
             <p>
-              <span>审核人:{{ activity.auditor }}</span>
-              <span :style="{ color: activity.auditStatus === '11' ? 'red' : '' }">
-                状态:{{ getDictLabel(DICT_TYPE.PROJECT_REPORT_STATUS, activity.auditStatus) }}
+              <span style="margin-right: 20px">审核人:{{ activity.auditor }}</span>
+              <span>
+                状态:<span :style="{ color: activity.auditStatus === '11' ? 'red' : '' }">
+                  {{ getDictLabel(DICT_TYPE.PROJECT_REPORT_STATUS, activity.auditStatus) }}
+                </span>
               </span>
             </p>
             <p> {{ activity.comments }}</p>
@@ -229,18 +231,25 @@ const passProjectReportHandle = async (data: any) => {
     getProjectCheckByList()
   }
 }
-const selections = ref<any>()
+const selections = ref<any>([])
 const passBatchProjectReportHandle = async () => {
+  if (selections.value.length === 0) {
+    message.error('请至少选择一条数据!')
+    return
+  }
   const data = selections.value.map((item) => {
     return {
       id: item['auditId'],
       reportId: item['reportId']
     }
   })
+  const sendData = {
+    passList: data
+  }
   const result: any = await request.post(
     {
       url: '/projectReport/pass-batch',
-      data
+      data: sendData
     },
     '/business'
   )
@@ -324,6 +333,7 @@ onMounted(() => {
 .btnBox {
   position: absolute;
   right: 20px;
+  z-index: 999;
 }
 .tabs {
   margin-bottom: 10px;

+ 27 - 15
client/src/views/OaSystem/marketCenter/projectCheckPass/index.vue

@@ -7,7 +7,7 @@
           开启填报
         </el-button>
         <el-button type="danger" v-if="status === 0" @click="archiveProjectReportPeriodHandle">
-          归档
+          结束本年度考核
         </el-button>
       </div>
     </div>
@@ -19,7 +19,7 @@
           v-for="(item, index) in tabList"
           :class="{ active: cTabIndex === index }"
           :key="index"
-          @click="switchTabHandle(item, index)"
+          @click="switchTabHandle(index)"
           >{{ item['xmbm'] }}</li
         >
       </ul>
@@ -108,7 +108,7 @@
                 <template #default="scope">{{ scope.row.returnAmount }}</template>
               </el-table-column>
               <el-table-column label="本年初始进度" width="140" align="center">
-                <template #default="scope">{{ scope.row.finishProgress }}</template>
+                <template #default="scope">{{ scope.row.finishProgress * 100 }}%</template>
               </el-table-column>
               <el-table-column label="现进度" width="120" align="center">
                 <template #default="scope">
@@ -214,7 +214,8 @@ const getProjectPassByList = async () => {
   )
   tabList.value.push(...getRowMapByList(result, 'xmbm'))
   if (tabList.value.length === 1) {
-    switchTabHandle(tabList.value[0], 0)
+    cTabIndex.value = 0
+    initInfoData(tabList.value[cTabIndex.value])
   }
 }
 const getRowMapByList = (arrs: any[], key: string) => {
@@ -240,10 +241,16 @@ const getRowMapByList = (arrs: any[], key: string) => {
   })
   return nArr
 }
-const switchTabHandle = (item, index) => {
-  infoList[0]['num'] = item['num1']
-  infoList[1]['num'] = item['num2']
-  infoList[2]['num'] = item['num3']
+const computedRowMap = (arr, xmbm: string) => {
+  const obj = {}
+  obj['xmbm'] = xmbm
+  obj['num1'] = arr.length
+  obj['num2'] = arr.reduce((a, b) => a + b['periodCheckValue'], 0)
+  obj['num3'] = arr.reduce((a, b) => a + b['periodValue'], 0)
+  obj['data'] = arr
+  return obj
+}
+const switchTabHandle = (index) => {
   cTabIndex.value = index
   queryParams.value = {
     xmmc: '',
@@ -252,6 +259,11 @@ const switchTabHandle = (item, index) => {
   }
   searchHandle()
 }
+const initInfoData = (item) => {
+  infoList[0]['num'] = item['num1']
+  infoList[1]['num'] = item['num2']
+  infoList[2]['num'] = item['num3']
+}
 const searchHandle = async () => {
   const result: any = await request.get(
     {
@@ -260,14 +272,12 @@ const searchHandle = async () => {
     },
     '/business'
   )
-  if (result && result.length === 0) {
-    tabList.value[cTabIndex.value]['data'] = []
-    return
-  }
+  const xmbm = tabList.value[cTabIndex.value]['xmbm']
   const nArr = result.filter((item) => {
-    return String(item['xmbm']) == tabList.value[cTabIndex.value]['xmbm']
+    return String(item['xmbm']) == xmbm
   })
-  tabList.value[cTabIndex.value]['data'] = nArr
+  tabList.value[cTabIndex.value] = computedRowMap(nArr, xmbm)
+  initInfoData(tabList.value[cTabIndex.value])
 }
 const currentYear = ref<string>('')
 const status = ref<number>()
@@ -292,7 +302,8 @@ const startProjectReportPeriodHandle = async () => {
     '/business'
   )
   if (result) {
-    message.success('开启成功!')
+    message.success('结束成功!')
+    getProjectPassByList()
   }
 }
 const archiveProjectReportPeriodHandle = async () => {
@@ -304,6 +315,7 @@ const archiveProjectReportPeriodHandle = async () => {
   )
   if (result) {
     message.success('开启成功!')
+    getProjectPassByList()
   }
 }
 onMounted(() => {

+ 32 - 27
client/src/views/OaSystem/marketCenter/projectReport/index.vue

@@ -28,7 +28,6 @@
             <template #default="scope">{{ scope.$index + 1 }}</template>
           </el-table-column>
           <el-table-column :show-overflow-tooltip="true" prop="xmmc" label="项目名称" width="280" />
-          <el-table-column label="项目经理" prop="xmjl" width="100" />
           <el-table-column label="项目状态" width="120" align="center">
             <template #default="scope">
               {{ getDictLabel(DICT_TYPE.PROJECT_STATUS, scope.row.xmzt) }}
@@ -41,7 +40,7 @@
             <template #default="scope">{{ scope.row.returnAmount }}</template>
           </el-table-column>
           <el-table-column label="本年初始进度" width="140" align="center">
-            <template #default="scope">{{ scope.row.finishProgress }}</template>
+            <template #default="scope">{{ scope.row.finishProgress * 100 }}%</template>
           </el-table-column>
           <el-table-column label="现进度" width="220" align="center">
             <template #default="scope">
@@ -200,22 +199,24 @@ const getProjectReportByList = async () => {
 }
 const { wsCache } = useCache()
 const user = wsCache.get(CACHE_KEY.USER)
-const saveProjectReport = async (data = {}) => {
-  const sendData = {}
-  Object.assign(sendData, data)
-  sendData['reportProgress'] = data['reportProgress'] / 100
+const saveProjectReport = (data) => {
+  data['id'] = data['reportId']
   data['xmbm'] = user.user.deptName ? user.user.deptName : '部门信息'
-  const result: any = await request.post(
-    {
-      url: '/projectReport/save',
-      data
-    },
-    '/business'
-  )
-  if (result) {
-    message.success('保存成功!')
-    getProjectReportByList()
-  }
+  request
+    .post(
+      {
+        url: '/projectReport/save',
+        data
+      },
+      '/business'
+    )
+    .then((result) => {
+      if (result) {
+        message.success('保存成功!')
+        getProjectReportByList()
+      }
+      data.isEditor = !data.isEditor
+    })
 }
 
 const commitProjectReport = async (row: { reportId: string }) => {
@@ -234,25 +235,29 @@ const commitProjectReport = async (row: { reportId: string }) => {
   }
 }
 const reportProgressHandle = (row) => {
-  console.log(Number(row.reportProgress))
-  if (row.passProgress && Number(row.reportProgress) < row.passProgress * 100) {
-    ElMessage.warning('现进度不能小于审核通过进度!')
-    return
-  } else if (Number(row.reportProgress) < row.finishProgress * 100) {
-    ElMessage.warning('现进度不能小于本年初始进度!')
-    return
-  }
   if (row.reportProgress) {
     row.periodValue = ((row.reportProgress - row.finishProgress) / 100) * row.virtualAmount
     row.surplusValue = ((100 - row.reportProgress) / 100) * row.virtualAmount
     row.periodCheckValue = row.shareRatio * row.periodValue
   }
 }
-const editorHandle = (row) => {
+const editorHandle = async (row) => {
   if (row.isEditor) {
+    if (row.passProgress && Number(row.reportProgress) < row.passProgress * 100) {
+      ElMessage.warning('现进度不能小于审核通过进度!')
+      return
+    } else if (Number(row.reportProgress) < row.finishProgress * 100) {
+      ElMessage.warning('现进度不能小于本年初始进度!')
+      return
+    }
+    if (row.xmzt === 1 && row.reportProgress >= 100) {
+      ElMessage.warning('项目状态为进行中现进度的值不能大于等于100%!')
+      return
+    }
     saveProjectReport(row)
+  } else {
+    row.isEditor = !row.isEditor
   }
-  row.isEditor = !row.isEditor
 }
 const auditorVisiabled = ref<boolean>(false)
 const activities = ref<any[]>([])