2 Commits a482146ef7 ... 8da77b21da

Auteur SHA1 Bericht Datum
  fuwb 8da77b21da 1、完成工资页面查询、按类型导入、查看详情、删除等功能 2 maanden geleden
  fuwb aa601ad6ce 1、新增工资删除接口 2 maanden geleden

+ 12 - 1
client/src/api/salary/index.ts

@@ -6,5 +6,16 @@ export const getSalaryPage = async (json: SalaryInfoPageDTO) => {
 }
 
 export const uploadFile = async (formData: FormData) => {
-  return await request.post({ url: '/salary/upload/file', data: formData }, '/business')
+  return await request.upload({ url: '/salary/upload/file', data: formData }, '/business')
+}
+
+export const getSalaryInfoDetail = async (id: string, importId: string) => {
+  return await request.get(
+    { url: '/salary/detail?id=' + id + '&importId=' + importId },
+    '/business'
+  )
+}
+
+export const deleteSalary = async (id: string) => {
+  return await request.delete({ url: '/salary/delete?id=' + id }, '/business')
 }

+ 4 - 1
client/src/api/salary/types.ts

@@ -1 +1,4 @@
-export type SalaryInfoPageDTO = {}
+export type SalaryInfoPageDTO = {
+  name?: string
+  isAdmin: number
+}

+ 126 - 34
client/src/views/OaSystem/searchCenter/salary/index.vue

@@ -11,25 +11,52 @@
         <el-button plain @click="resetSearchKey">重置</el-button>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" @click="handleUpload">导入文件</el-button>
+        <el-upload
+          action="#"
+          :limit="1"
+          :http-request="submitFile"
+          :show-file-list="false"
+          accept=".xlsx, .xls"
+        >
+          <el-button type="primary" @click="handleInsert('行政参公')">导入行政参公工资</el-button>
+        </el-upload>
+      </el-form-item>
+      <el-form-item>
+        <el-upload
+          action="#"
+          :limit="1"
+          :http-request="submitFile"
+          :show-file-list="false"
+          accept=".xlsx, .xls"
+        >
+          <el-button type="primary" @click="handleInsert('事业单位')">导入事业单位工资</el-button>
+        </el-upload>
       </el-form-item>
     </el-form>
   </div>
   <div class="container-main">
-    <el-table style="width: 100%" :data="list" @row-click="handleRowClick">
+    <el-table style="width: 100%" :data="list" show-overflow-tooltip>
       <el-table-column prop="id" label="" v-if="false" />
-      <el-table-column prop="year" label="年度" />
-      <el-table-column prop="month" label="月份" />
-      <el-table-column prop="importDate" label="导入时间" />
-      <el-table-column prop="name" label="姓名" />
-      <el-table-column prop="personnelType" label="人员类型" />
-      <el-table-column prop="idCard" label="身份证号码" />
-      <el-table-column prop="bankCard" label="银行卡号" />
-      <el-table-column prop="bank" label="银行" />
-      <el-table-column prop="workUnint" label="单位" />
-      <el-table-column prop="totalPayable" label="应发工资合计(元)" />
-      <el-table-column prop="totalDeducted" label="扣发工资合计(元)" />
-      <el-table-column prop="actualPay" label="实发工资合计(元)" />
+      <el-table-column prop="year" label="年度" width="80px" align="center" />
+      <el-table-column prop="month" label="月份" width="60px" align="center" />
+      <el-table-column prop="importDate" label="导入时间" width="130px" align="center" />
+      <el-table-column prop="name" label="姓名" width="80px" align="center" />
+      <el-table-column prop="personnelType" label="人员类型" width="100px" align="center" />
+      <el-table-column prop="idCard" label="身份证号码" align="center" />
+      <el-table-column prop="bankCard" label="银行卡号" align="center" />
+      <el-table-column prop="bank" label="银行" align="center" />
+      <el-table-column prop="workUnint" label="单位" align="center" />
+      <el-table-column prop="totalPayable" label="应发工资合计(元)" align="center" />
+      <el-table-column prop="totalDeducted" label="扣发工资合计(元)" align="center" />
+      <el-table-column prop="actualPay" label="实发工资合计(元)" align="center" />
+      <el-table-column label="操作" align="center">
+        <template #default="scope">
+          <el-button size="small" @click.stop="handleView(scope.row)">查看</el-button>
+          <el-button size="small" type="danger" @click.stop="handleDelete(scope.row)">
+            删除
+          </el-button>
+        </template>
+      </el-table-column>
     </el-table>
     <el-pagination
       background
@@ -41,20 +68,32 @@
     />
   </div>
 
-  <el-dialog v-model="uploadFileDialog" title="工资文件上传">
-    <el-upload :auto-upload="false" :limit="1" :on-change="changeFile">
-      <el-button type="primary">导入文件</el-button>
-      <template #tip>
-        <div class="el-upload__tip"> 只支持上传 xlsx 文件 </div>
-      </template>
-    </el-upload>
-    <el-button type="primary" @click="submitFile">上传文件</el-button>
+  <el-dialog
+    v-model="uploadFileDialog"
+    title="工资详情"
+    :close-on-click-modal="false"
+    @close="closeSalaryDialog"
+    top="6px"
+  >
+    <div style="display: flex; justify-content: space-between; width: 100%">
+      <el-table :data="rightTableData" style="width: 50%" show-overflow-tooltip>
+        <!-- 动态左列 -->
+        <el-table-column prop="key" label="" />
+        <!-- 动态右列 -->
+        <el-table-column prop="value" label="" />
+      </el-table>
+      <el-table :data="leftTableData" style="width: 50%" show-overflow-tooltip>
+        <el-table-column prop="key" label="" />
+        <el-table-column prop="value" label="" />
+      </el-table>
+    </div>
   </el-dialog>
 </template>
 
 <script lang="ts" setup>
 import { ref, reactive } from 'vue'
 import * as SalaryApi from '@/api/salary'
+import { UploadRequestOptions } from 'element-plus'
 
 const searchKey = ref('')
 const total = ref(0)
@@ -62,10 +101,15 @@ const list = ref([])
 const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
-  isAdmin: 1
+  isAdmin: 1,
+  searchKey: ''
 })
 const uploadFileDialog = ref(false)
-const file = ref()
+const rylx = ref()
+
+// 工资详情列表数据
+const leftTableData = ref<any>([])
+const rightTableData = ref<any>([])
 
 // 获取工资列表
 const salaryList = async (json) => {
@@ -74,20 +118,68 @@ const salaryList = async (json) => {
   list.value = data.records
 }
 
-const handleUpload = () => {
-  uploadFileDialog.value = true
+const handleInsert = (type) => {
+  rylx.value = type
 }
 
-// 选择文件
-const changeFile = (uploadFile) => {
-  file.value = uploadFile.raw
-}
-const submitFile = async () => {
+// 上传文件
+const submitFile = async (data: UploadRequestOptions) => {
   const formData = new FormData()
-  formData.append('file', file.value)
-  formData.append('type', '参公')
+  formData.append('file', data.file)
+  formData.append('type', rylx.value)
   const res = await SalaryApi.uploadFile(formData)
-  console.log(res)
+  if (res.code === 200) {
+    uploadFileDialog.value = false
+    ElMessage({ message: res.data, type: 'success' })
+    salaryList(queryParams)
+  } else {
+    ElMessage({ message: res.data, type: 'error' })
+  }
+}
+
+// 按供应商名称搜索
+const handleSearch = () => {
+  queryParams.searchKey = searchKey.value
+  salaryList(queryParams)
+}
+
+// 重置搜索关键字
+const resetSearchKey = () => {
+  searchKey.value = ''
+  queryParams.searchKey = searchKey.value
+  salaryList(queryParams)
+}
+
+// 点击行查看详情
+const handleView = async (row) => {
+  const res = await SalaryApi.getSalaryInfoDetail(row.id, row.importId)
+  for (let i = 0; i < res.length; i++) {
+    if (i % 2 != 0) {
+      leftTableData.value.push(res[i])
+    } else {
+      rightTableData.value.push(res[i])
+    }
+  }
+  uploadFileDialog.value = true
+}
+
+// 删除工资记录
+const handleDelete = async (row) => {
+  const res = await SalaryApi.deleteSalary(row.id)
+  ElMessage({ message: res, type: 'success' })
+  salaryList(queryParams)
+}
+
+// 关闭弹窗时清空数据
+const closeSalaryDialog = () => {
+  uploadFileDialog.value = false
+  leftTableData.value = []
+  rightTableData.value = []
+}
+
+const handleCurrentChange = (index) => {
+  queryParams.pageNo = index
+  salaryList(queryParams)
 }
 
 onMounted(() => {

+ 1 - 1
client/src/views/OaSystem/searchCenter/supplier/index.vue

@@ -42,7 +42,7 @@
   </div>
 
   <!-- 新增供应商的表单弹窗 -->
-  <el-dialog v-model="dialogFormVisible" :close-on-click-modal="false" :title="dialogTitle">
+  <el-dialog v-model:visible="dialogFormVisible" :close-on-click-modal="false" :title="dialogTitle">
     <el-form label-width="130px" :model="supply" ref="supplyRef">
       <el-form-item prop="supplierId">
         <el-input style="display: none" v-model="supply.supplierId" />

+ 11 - 0
zjugis-module-business/zjugis-module-business-biz/src/main/java/com/zjugis/module/business/flow/salary/controller/SalaryInfoController.java

@@ -54,4 +54,15 @@ public class SalaryInfoController extends BaseController {
         return success(salaryInfoService.getSalaryDetail(id, importId));
     }
 
+    /**
+     * 删除用户工资数据
+     *
+     * @param id
+     * @return
+     */
+    @DeleteMapping("/delete")
+    public String deleteSalaryDetailById(@RequestParam("id") String id) {
+        return success(salaryInfoService.deleteSalaryDetailById(id));
+    }
+
 }

+ 1 - 0
zjugis-module-business/zjugis-module-business-biz/src/main/java/com/zjugis/module/business/flow/salary/service/ISalaryInfoService.java

@@ -24,4 +24,5 @@ public interface ISalaryInfoService {
 
     List<SalaryInfoDetailVO> getSalaryDetail(String id, String importId);
 
+    String deleteSalaryDetailById(String id);
 }

+ 23 - 0
zjugis-module-business/zjugis-module-business-biz/src/main/java/com/zjugis/module/business/flow/salary/service/impl/SalaryInfoServiceImpl.java

@@ -29,6 +29,9 @@ import java.lang.reflect.Method;
 import java.time.LocalDateTime;
 import java.util.*;
 
+import static com.zjugis.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static com.zjugis.module.business.enums.ErrorCodeConstants.APPLICATION_INFO_NOT_EXISTS;
+
 /**
  * 工资信息表 服务实现类
  *
@@ -193,6 +196,26 @@ public class SalaryInfoServiceImpl implements ISalaryInfoService {
         return res;
     }
 
+    @Override
+    public String deleteSalaryDetailById(String id) {
+        validateExists(id);
+        int delete = infoMapper.deleteById(id);
+        if (delete == 1) {
+            return "删除成功";
+        }
+        return "删除失败";
+    }
+
+    /**
+     * 根据ID判断数据是否存在
+     *
+     * @param id
+     */
+    private void validateExists(String id) {
+        if (infoMapper.selectById(id) == null) {
+            throw exception(APPLICATION_INFO_NOT_EXISTS);
+        }
+    }
 
     /**
      * 根据人员类型及当前时间生成一条工资导入数据记录,并返回主键ID