Bladeren bron

no message

ly 1 jaar geleden
bovenliggende
commit
2c9b302015

+ 8 - 0
src/api/business/production/salaryZero.js

@@ -137,4 +137,12 @@ export function exportSalaryPdf(id) {
     },
     `工资表${new Date().getTime()}.pdf`
   )
+}
+
+export function delSalarys(ids) {
+  request.defaults.baseURL = '/ezhizao-yzbh-production'
+  return request({
+    url: '/business/salaryZero/physical/' + ids,
+    method: 'delete'
+  })
 }

+ 2 - 2
src/plugins/modal.js

@@ -20,8 +20,8 @@ export default {
     ElMessage.warning(content)
   },
   // 弹出提示
-  alert(content) {
-    ElMessageBox.alert(content, "系统提示")
+  async alert(content) {   
+  return ElMessageBox.alert(content, "系统提示")
   },
   // 错误提示
   alertError(content) {

+ 23 - 5
src/views/business/housingFund/confirm/form.vue

@@ -4,6 +4,9 @@
       <span class="title-label"><i class="el-icon-document" /> 工资信息</span>
       <i class="el-icon-close" @click="close" />
     </div> -->
+    <div v-loading="loading">
+
+
     <!-- 功能按钮 -->
     <div style="padding: 8px 24px 16px 24px">
       <el-form size="small" label-width="135px" v-model="form">
@@ -288,6 +291,7 @@
       <el-button type="warning" size="small" icon="Edit" style="float: right" @click="handleSave(1)">
         待确认</el-button>
     </div>
+  </div>
     <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
   </el-dialog>
@@ -309,6 +313,7 @@
   const selections = ref([]);
   const currentSource = ref(null);
   const editStatus = ref(false);
+  const loading = ref(false);
   const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
   const props = defineProps({
     getList: {
@@ -358,13 +363,16 @@
     srcListback.value.push(val)
   }
   function loadData() {
+    loading.value = true
     getDetail(form.value).then((res) => {
       form.value = { ...proxy.deepClone(emptyForm), ...res.data };
       if (form.value.status === 2 || form.value.status === 3) {
         proxy.$modal.msgError("该信息已提交待审核");
         close();
       }
-    });
+    }).finally(() => {
+      loading.value = false
+    });;
   }
 
   function close() {
@@ -501,20 +509,25 @@
         saveValue.isChanged = 1;
         // saveValue.status = 2;
         saveValue.status = status;
+        loading.value = true
         if (saveValue.id == null) {
           saveDetail(saveValue).then((res) => {
             proxy.$modal.msgSuccess("保存成功");
             reset();
             close();
             getList.value();
-          });
+          }).finally(() => {
+            loading.value = false
+          });;
         } else {
           updateDetail(saveValue).then((res) => {
             proxy.$modal.msgSuccess("保存成功");
             reset();
             close();
             getList.value();
-          });
+          }).finally(() => {
+            loading.value = false
+          });;
         }
       });
     } else {
@@ -524,20 +537,25 @@
           const saveValue = proxy.deepClone(form.value);
           // saveValue.status = 2;
           saveValue.status = status;
+          loading.value = true
           if (saveValue.id == null) {
             saveDetail(saveValue).then((res) => {
               proxy.$modal.msgSuccess("保存成功");
               reset();
               close();
               getList.value();
-            });
+            }).finally(() => {
+            loading.value = false
+          });
           } else {
             updateDetail(saveValue).then((res) => {
               proxy.$modal.msgSuccess("保存成功");
               reset();
               close();
               getList.value();
-            });
+            }).finally(() => {
+            loading.value = false
+          });;
           }
         })
         .catch((err) => {

+ 20 - 8
src/views/business/production/salary/form.vue

@@ -206,8 +206,8 @@
         <el-button type="warning" size="small" icon="Edit" style="float: right" @click="handleSave(1)">
           待确认</el-button>
       </div>
-      <import-excel-dialog-customer ref="importExcelDialogRef" :companyId="companyId" v-bind="$attrs"
-        @loadData="loadData" />
+      <import-excel-dialog-customer ref="importExcelDialogRef" :companyId="companyId" :years="years" :months="months"
+        v-bind="$attrs" @loadData="loadData" />
       <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
     </div>
@@ -278,6 +278,8 @@
 
   const form = ref({});
   const companyId = ref(null)
+  const months = ref(null)
+  const years = ref(null)
   const emptyForm = {
     details: [],
   };
@@ -286,6 +288,8 @@
     visible.value = true;
     form.value = detail;
     companyId.value = detail.companyId
+    years.value = detail.year
+    months.value = detail.month
     loadData();
   }
 
@@ -339,14 +343,22 @@
 
   function handleEmployeeBatchDelete() {
     proxy.$modal
-      .confirm("确定后不可恢复!!确定删除?")
+      .confirm("您确认要删除选中人员的工资信息吗,删除后将无法恢复,确认删除?")
       .then(() => {
+        // 删除选中的明细
         console.log(selections.value);
-        let ids = selections.value.map(item => { return item.id })
-        delSalarys(ids).then(() => {
-          proxy.$modal.msg("删除成功");
-      
-      })
+        let ids = [];
+        selections.value.forEach(item => {
+          if (item.id != null)
+            ids.push(item.id)
+        })
+ 
+        if (ids != null && ids.length > 0) {
+          delSalarys(ids).then(() => {
+            proxy.$modal.msg("删除成功");
+          }).finally(() => {
+          });
+        }
         form.value.details = form.value.details.filter(
           (item) => selections.value.indexOf(item) === -1
         );

+ 166 - 191
src/views/business/production/salary/importExcelDialogCustomer.vue

@@ -1,53 +1,23 @@
 <template>
   <!-- 添加或修改菜单对话框 -->
-  <el-dialog
-    title="工资导入"
-    v-model="visible"
-    width="680px"
-    append-to-body
-    draggable
-    :close-on-click-modal = "false"
-  >
-    <el-form
-      ref="menuRef"
-      :model="form"
-      size="small"
-      :rules="rules"
-      label-width="100px"
-    >
+  <el-dialog title="工资导入" v-model="visible" width="680px" append-to-body draggable :close-on-click-modal="false">
+    <el-form ref="menuRef" :model="form" size="small" :rules="rules" label-width="100px">
       <el-row>
         <el-col :span="24">
           <el-form-item label="选择导入月份" prop="year">
-            <el-date-picker
-              v-model="currentMonth"
-              type="month"
-              format="YYYY年MM月"
-              style="width: 150px"
-              :clearable="false"
-              value-format="YYYY-MM-01"
-              :disabled-date="disabledDateHandler"
-              @change="monthChangeHandler"
-            />
+            <el-date-picker v-model="currentMonth" type="month" format="YYYY年MM月" style="width: 150px"
+              :clearable="false" value-format="YYYY-MM-01" :disabled-date="disabledDateHandler"
+              @change="monthChangeHandler" disabled />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row>
         <el-col :span="24">
           <el-form-item label="上传">
-            <el-upload
-              ref="uploadRef"
-              :limit="1"
-              accept=".xlsx, .xls"
-              :headers="upload.headers"
-              :action="upload.url + `?year=${year}&month=${month}&companyId=${companyId}`"
-              :fileList="fileList"
-              :before-upload="handleBeforeUpload"
-              :disabled="upload.isUploading"
-              :on-progress="handleFileUploadProgress"
-              :on-success="handleFileSuccess"
-              :auto-upload="false"
-              drag
-            >
+            <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
+              :action="upload.url + `?year=${years}&month=${months}&companyId=${companyId}`" :fileList="fileList"
+              :before-upload="handleBeforeUpload" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress"
+              :on-success="handleFileSuccess" :auto-upload="false" drag>
               <el-icon class="el-icon--upload">
                 <upload-filled />
               </el-icon>
@@ -56,16 +26,9 @@
               </div>
               <template #tip>
                 <div class="el-upload__tip text-center">
-                  <span
-                    >仅允许导入xls、xlsx格式文件。文件大小限制为&lt;50Mb</span
-                  >
-                  <el-link
-                    type="primary"
-                    :underline="false"
-                    style="font-size: 12px; vertical-align: baseline"
-                    @click="importTemplate"
-                    >下载模板</el-link
-                  >
+                  <span>仅允许导入xls、xlsx格式文件。文件大小限制为&lt;50Mb</span>
+                  <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
+                    @click="importTemplate">下载模板</el-link>
                 </div>
               </template>
             </el-upload>
@@ -75,13 +38,7 @@
     </el-form>
     <template #footer>
       <div class="dialog-footer">
-        <el-button
-          type="primary"
-          icon="Finished"
-          size="small"
-          @click="submitForm"
-          >确 定</el-button
-        >
+        <el-button type="primary" icon="Finished" size="small" @click="submitForm">确 定</el-button>
         <el-button icon="Close" size="small" @click="cancel">取 消</el-button>
       </div>
     </template>
@@ -90,148 +47,166 @@
 
 
 <script setup>
-import { exportSalaryTemplateNotCompany } from "@/api/business/production/salary";
-import { getToken, getTenant } from "@/utils/auth";
-import useUserStore from "@/store/modules/user";
-import { deepClone } from "@/utils";
-import {  useAttrs } from "vue";
-const attrs = useAttrs();
-const { proxy } = getCurrentInstance();
-/** 父组件传参 */
-const props = defineProps({
-  companyId: {
-    type: String,
-    default: () => {},
-  },
-  loadData:{
-    type:Function,
-    default:()=>{}
+  import { exportSalaryTemplateNotCompany } from "@/api/business/production/salary";
+  import { getToken, getTenant } from "@/utils/auth";
+  import useUserStore from "@/store/modules/user";
+  import { deepClone } from "@/utils";
+  import { useAttrs } from "vue";
+  const attrs = useAttrs();
+  const { proxy } = getCurrentInstance();
+  /** 父组件传参 */
+  const props = defineProps({
+    companyId: {
+      type: String,
+      default: () => { },
+    },
+    years: {
+      type: String,
+      default: () => { },
+    },
+    months: {
+      type: String,
+      default: () => { },
+    },
+    loadData: {
+      type: Function,
+      default: () => { }
+    }
+  });
+  const { companyId, years, months } = toRefs(props);
+
+  const emits = defineEmits(["loadData"]);
+  /** 字典数组区 */
+  /** 表单抽屉 页变量 */
+  const fileList = ref([]);
+  const visible = ref(false);
+  // const currentMonth = ref(proxy.moment().subtract("month").format("YYYY-MM-01"));
+  const currentMonth = ref(null);
+
+  const year = ref(proxy.moment().format("YYYY"));
+  const month = ref(proxy.moment().format("MM"));
+
+  const addType = ref(1);
+  const webHost = import.meta.env.VITE_APP_BASE_API;
+
+  const setHeaders = {
+    Authorization: getToken(),
+  };
+
+  const data = reactive({
+    form: {
+      year: proxy.moment().format("YYYY"),
+      month: proxy.moment().format("MM"),
+    },
+    followData: {},
+  });
+  const addComRef = ref(null);
+
+  /*** 客户导入参数 */
+  const upload = reactive({
+    // 是否禁用上传
+    isUploading: false,
+    // 设置上传的请求头部
+    headers: { Authorization: "Bearer " + getToken(), tenantId: getTenant() },
+    // 上传的地址
+    url: `/ezhizao-yzbh-production/business/salary/importData`,
+  });
+
+  /** 查询对象 */
+  const queryParams = ref({});
+
+  const followQuery = ref({});
+  const { form, rules, followData } = toRefs(data);
+
+  /***********************  表单页方法 ****************************/
+
+  /** 抽屉打开 */
+  function open() {
+    // reset();
+    visible.value = true;
+    currentMonth.value = years.value + "-" + months.value + "-01";
   }
-});
-const { companyId  } = toRefs(props);
-
-const emits = defineEmits(["loadData"]);
-/** 字典数组区 */
-/** 表单抽屉 页变量 */
-const fileList = ref([]);
-const visible = ref(false);
-const currentMonth = ref(proxy.moment().subtract("month").format("YYYY-MM-01"));
-const year = ref(proxy.moment().format("YYYY"));
-const month = ref(proxy.moment().format("MM"));
-
-const addType = ref(1);
-const webHost = import.meta.env.VITE_APP_BASE_API;
-
-const setHeaders = {
-  Authorization: getToken(),
-};
-
-const data = reactive({
-  form: {
-    year: proxy.moment().format("YYYY"),
-    month: proxy.moment().format("MM"),
-  },
-  followData: {},
-});
-const addComRef = ref(null);
-
-/*** 客户导入参数 */
-const upload = reactive({
-  // 是否禁用上传
-  isUploading: false,
-  // 设置上传的请求头部
-  headers: { Authorization: "Bearer " + getToken(), tenantId: getTenant() },
-  // 上传的地址
-  url: `/ezhizao-yzbh-production/business/salary/importData`,
-});
-
-/** 查询对象 */
-const queryParams = ref({});
-
-const followQuery = ref({});
-const { form, rules, followData } = toRefs(data);
-
-/***********************  表单页方法 ****************************/
-
-/** 抽屉打开 */
-function open() {
-  // reset();
-  visible.value = true;
-}
-
-//下载模板
-const importTemplate = () => {
-  exportSalaryTemplateNotCompany();
-};
-
-function reset() {
-  // console.log(addComRef.value)
-  if (addComRef.value != null) addComRef.value.reset();
-}
-
-function cancel() {
-  visible.value = false;
-}
-
-function submitForm() {
-  submitFileForm();
-}
-
-function handleBeforeUpload(file) {
-  console.log(file);
-  if (
-    file.type !==
+
+  //下载模板
+  const importTemplate = () => {
+    exportSalaryTemplateNotCompany();
+  };
+
+  function reset() {
+    // console.log(addComRef.value)
+    if (addComRef.value != null) addComRef.value.reset();
+  }
+
+  function cancel() {
+    visible.value = false;
+  }
+
+  function submitForm() {
+    submitFileForm();
+  }
+
+  function handleBeforeUpload(file) {
+    console.log(file);
+    if (
+      file.type !==
       "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
-    file.type !== "application/vnd.ms-excel"
-  ) {
-    proxy.$modal.msgError("请选择excel文件");
-    return false;
+      file.type !== "application/vnd.ms-excel"
+    ) {
+      proxy.$modal.msgError("请选择excel文件");
+      return false;
+    }
+    return true;
   }
-  return true;
-}
-
-/**文件上传中处理 */
-const handleFileUploadProgress = (event, file, fileList) => {
-  upload.isUploading = true;
-};
-/** 文件上传成功处理 */
-const handleFileSuccess = (response, file, fileList) => {
-  upload.open = false;
-  upload.isUploading = false;
-  proxy.$refs["uploadRef"].handleRemove(file);
-  proxy.$alert(
-    "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+
+  /**文件上传中处理 */
+  const handleFileUploadProgress = (event, file, fileList) => {
+    upload.isUploading = true;
+  };
+  /** 文件上传成功处理 */
+  const handleFileSuccess = (response, file, fileList) => {
+    upload.open = false;
+    upload.isUploading = false;
+    proxy.$refs["uploadRef"].handleRemove(file);
+    proxy.$alert(
+      "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
       response.msg +
       "</div>",
-    "导入结果",
-    { dangerouslyUseHTMLString: true }
-  );
-  attrs.onGetList();
-  emits("loadData");
-
-};
-/** 提交上传文件 */
-function submitFileForm() {
-  proxy.$refs["uploadRef"].submit();
-}
-
-function monthChangeHandler(arg) {
-  year.value = proxy.moment(arg).format("YYYY");
-  month.value = proxy.moment(arg).format("MM");
-}
-
-function disabledDateHandler(date) {
-  if (date <= proxy.moment().subtract("month")) {
-    return false;
-  } else {
-    return true;
+      "导入结果",
+      { dangerouslyUseHTMLString: true }
+    ).then(() => {
+      if (response.code == "200") {
+        visible.value = false;
+        attrs.onGetList();
+        emits("loadData");
+      }else{
+        visible.value = true;
+      }
+    });
+
+
+  };
+  /** 提交上传文件 */
+  function submitFileForm() {
+    proxy.$refs["uploadRef"].submit();
+  }
+
+  function monthChangeHandler(arg) {
+    year.value = proxy.moment(arg).format("YYYY");
+    month.value = proxy.moment(arg).format("MM");
+  }
+
+  function disabledDateHandler(date) {
+    if (date <= proxy.moment().subtract("month")) {
+      return false;
+    } else {
+      return true;
+    }
   }
-}
 
-// 暴露给父组件的方法
-defineExpose({
-  open,
-});
+  // 暴露给父组件的方法
+  defineExpose({
+    open,
+  });
 </script>
 
 <style></style>

+ 30 - 13
src/views/business/production/salaryZero/form.vue

@@ -418,7 +418,7 @@
         待确认</el-button
       >
     </div>
-    <import-excel-dialog-customer ref="importExcelDialogRef"  :companyId = "companyId" v-bind="$attrs" @loadData ="loadData"/>
+    <import-excel-dialog-customer ref="importExcelDialogRef"  :companyId = "companyId" :years = "years" :months = "months" v-bind="$attrs" @loadData ="loadData"/>
     <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
   </div>
@@ -428,7 +428,7 @@
 import {
   getDetail,
   saveDetail,
-  updateDetail,
+  updateDetail, delSalarys,
 } from "@/api/business/production/salaryZero";
 import { rowNum, numberToCurrencyNo } from "@/utils/index";
 import importExcelDialogCustomer from "./importExcelDialogCustomer.vue";
@@ -486,7 +486,8 @@ const employeeEmptyData = {
   details: [],
   editStatus: true,
 };
-
+const months = ref(null)
+const years = ref(null)
 const form = ref({});
 const  companyId = ref(null)
 const emptyForm = {
@@ -497,12 +498,14 @@ function open(detail) {
   visible.value = true;
   form.value = detail;
   companyId.value = detail.companyId
-  console.log(form.value);
+  years.value = detail.year
+  months.value = detail.month
   loadData();
 }
 
 function loadData() {
   loading.value = true
+  
   getDetail(form.value).then((res) => {
     form.value = { ...proxy.deepClone(emptyForm), ...res.data };
     if (form.value.status === 2 || form.value.status === 3) {
@@ -547,15 +550,29 @@ function handleEmployeeCreate() {
 
 function handleEmployeeBatchDelete() {
   proxy.$modal
-    .confirm("确定删除?")
-    .then(() => {
-      form.value.details = form.value.details.filter(
-        (item) => selections.value.indexOf(item) === -1
-      );
-    })
-    .catch(() => {
-      proxy.$modal.msg("已取消删除");
-    });
+      .confirm("您确认要删除选中人员的工资信息吗,删除后将无法恢复,确认删除?")
+      .then(() => {
+        // 删除选中的明细
+        console.log(selections.value);
+        let ids = [];
+        selections.value.forEach(item => {
+          if (item.id != null)
+            ids.push(item.id)
+        })
+ 
+        if (ids != null && ids.length > 0) {
+          delSalarys(ids).then(() => {
+            proxy.$modal.msg("删除成功");
+          }).finally(() => {
+          });
+        }
+        form.value.details = form.value.details.filter(
+          (item) => selections.value.indexOf(item) === -1
+        );
+      })
+      .catch(() => {
+        proxy.$modal.msg("已取消删除");
+      });
 }
 
 function rowChangeSum(row) {

+ 13 - 4
src/views/business/production/salaryZero/importExcelDialogCustomer.vue

@@ -115,7 +115,8 @@ const emits = defineEmits(["loadData"]);
 /** 表单抽屉 页变量 */
 const fileList = ref([]);
 const visible = ref(false);
-const currentMonth = ref(proxy.moment().subtract("month").format("YYYY-MM-01"));
+// const currentMonth = ref(proxy.moment().subtract("month").format("YYYY-MM-01"));
+const currentMonth = ref(null);
 const year = ref(proxy.moment().format("YYYY"));
 const month = ref(proxy.moment().format("MM"));
 
@@ -157,6 +158,7 @@ const { form, rules, followData } = toRefs(data);
 function open() {
   // reset();
   visible.value = true;
+  currentMonth.value =years.value+"-"+months.value+"-01";
 }
 
 //下载模板
@@ -205,9 +207,16 @@ const handleFileSuccess = (response, file, fileList) => {
       "</div>",
     "导入结果",
     { dangerouslyUseHTMLString: true }
-  );
-  attrs.onGetList();
-  emits("loadData");
+  ).then(() => {
+    console.log("response",response);
+      if (response.code == "200") {
+        visible.value = false;
+        attrs.onGetList();
+        emits("loadData");
+      }else{
+        visible.value = true;
+      }
+    });
 
 };
 /** 提交上传文件 */