ly 1 an în urmă
părinte
comite
903f8e2934

+ 2 - 2
src/api/business/production/tax.js

@@ -23,10 +23,10 @@ export function exportFinalTax(data) {
 }
 
 // 查询报税详细
-export function getTax(id) {
+export function getTax(id,year,month) {
   request.defaults.baseURL = '/ezhizao-yzbh-finance'
   return request({
-    url: '/business/financialReportTaxNonZero/getDetailById/' + id,
+    url: '/business/financialReportTaxNonZero/getDetailById/'  + id + "/" + year + "/" + month,
     method: 'get'
   })
 }

+ 2 - 2
src/api/business/production/taxIsZero.js

@@ -23,10 +23,10 @@ export function exportFinalTax(data) {
 }
 
 // 查询报税详细
-export function getTax(id) {
+export function getTax(id,year,month) {
   request.defaults.baseURL = '/ezhizao-yzbh-finance'
   return request({
-    url: '/business/financialReportTax/getDetailById/' + id,
+    url: '/business/financialReportTax/getDetailById/' + id + "/" + year + "/" + month,
     method: 'get'
   })
 }

+ 266 - 278
src/views/business/housingFund/declare/form.vue

@@ -1,14 +1,8 @@
 <template>
-  <el-dialog
-    title="公积金申报信息"
-    v-model="visible"
-    :width="width"
-    append-to-body
-    draggable
-    @close="close"
-    :close-on-click-modal = "false"
-  >
+  <el-dialog title="公积金申报信息" v-model="visible" :width="width" append-to-body draggable @close="close"
+    :close-on-click-modal="false">
     <!-- 功能按钮 -->
+     <div v-loading="loading">
     <div style="padding: 8px 24px 16px 24px">
       <el-form size="small" label-width="120px" v-model="form">
         <el-row :gutter="30">
@@ -19,7 +13,9 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="所属月份">
-              <div>{{ form.year }}-{{ form.month }}</div>
+             <!-- <div>{{ form.year }}-{{ form.month }}</div> -->
+             <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+             @change="changeMonthHandle" />
             </el-form-item>
           </el-col>
           <el-col v-if="form.status === 4" :span="12">
@@ -64,28 +60,16 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="单位缴纳:">
-              <el-input-number
-                v-model="form.unitAmount"
-                size="small"
-                placeholder="单位缴纳"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
+              <el-input-number v-model="form.unitAmount" size="small" v-if="form.status !==3" placeholder="单位缴纳" :precision="2"
+                :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitAmount) }}</div>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="个人缴纳:">
-              <el-input-number
-                v-model="form.individualAmount"
-                size="small"
-                placeholder="个人缴纳"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
+              <el-input-number v-model="form.individualAmount" v-if="form.status !==3" size="small" placeholder="个人缴纳" :precision="2"
+                :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualAmount) }}</div>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -98,64 +82,30 @@
           </el-col>
           <el-col :span="24">
             <el-form-item label="备注">
-              <el-input v-model.trim="form.content" type="textarea" rows="2" />
+              <el-input v-model.trim="form.content" v-if="form.status !==3"  type="textarea" rows="2" />
+              <div v-else>{{form.content}}</div>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="凭证" required>
-              <el-upload
-                action="#"
-                :http-request="upload"
-                :with-credentials="true"
-                :show-file-list="false"
-                multiple
-              >
-                <el-button size="small" type="primary" icon="Upload"
-                  >点击上传</el-button
-                >
+              <el-upload action="#" :http-request="upload" :with-credentials="true" :show-file-list="false" multiple>
+                <el-button size="small" type="primary" icon="Upload"  v-if="form.status !==3" >点击上传</el-button>
               </el-upload>
-              <el-table
-              style="margin-top: 15px;"
-                ref="dbTable"
-                :data="form.evidenceFiles"
-                size="small"
-                border
-                header-row-class-name="list-header-row"
-                row-class-name="list-row"
-              >
-                <el-table-column
-                  label="文件名"
-                  prop="originalFileName"
-                  align="center"
-                  show-overflow-tooltip
-                >
+              <el-table style="margin-top: 15px;" ref="dbTable" :data="form.evidenceFiles" size="small" border
+                header-row-class-name="list-header-row" row-class-name="list-row">
+                <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
                   <template #default="scope">
-                    <el-button
-                      size="small"
-                      type="text"
-                      @click="openFile(scope.row)"
-                      >{{
-                        scope.row.originalFileName == ""
-                          ? "打开文件"
-                          : scope.row.originalFileName
-                      }}</el-button
-                    >
+                    <el-button size="small" type="text" @click="openFile(scope.row)">{{
+                      scope.row.originalFileName == ""
+                      ? "打开文件"
+                      : scope.row.originalFileName
+                      }}</el-button>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  label="操作"
-                  width="80"
-                  prop="fileType"
-                  align="center"
-                >
+                <el-table-column label="操作" width="80" prop="fileType" align="center">
                   <template #default="scope">
-                    <el-button
-                      size="small"
-                      link
-                      type="danger"
-                      @click="handleDel(scope.row, scope.$index)"
-                      >删除</el-button
-                    >
+                    <el-button size="small" link type="danger"
+                      @click="handleDel(scope.row, scope.$index)"  v-if="form.status !==3" >删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
@@ -165,238 +115,276 @@
       </el-form>
     </div>
     <div class="form-btns-container" style="height: 40px">
-      <el-button
-        size="small"
-        icon="close"
-        style="float: right; margin-left: 12px; margin-right: 12px"
-        @click="close"
-        >取消</el-button
-      >
-      <el-button
-        type="primary"
-        style="float: right"
-        size="small"
-        icon="Finished"
-        @click="handleSave"
-      >
-        保存</el-button
-      >
+      <el-button size="small" icon="close" v-if="form.status !== 3" style="float: right; margin-left: 12px; margin-right: 12px"
+        @click="close">取消</el-button>
+      <el-button type="primary" style="float: right" size="small" v-if="form.status !== 3" icon="Finished" @click="handleSave">
+        保存</el-button>
+        <el-button v-hasPermi="['business:housingFundDeclare:verify']" v-if="!stopUseBack" style="float: right;" icon="back" size="small"
+        type="warning" :disabled="
+    form == null || form.status !== 3
+  " @click="turnBack(form)">退回</el-button>
     </div>
+  </div>
     <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
   </el-dialog>
 </template>
 <script setup>
-import {
-  getDetail,
-  saveDetail,
-} from "@/api/business/production/housingFundDeclare";
-import { uploadFile } from "@/api/tool/file";
-import { rowNum } from "@/utils/index";
-import { ref } from "vue";
-const { proxy } = getCurrentInstance();
-const visible = ref(false);
-const width = ref(800);
-const selections = ref([]);
-const currentSource = ref(null);
-const editStatus = ref(false);
-const canSave = ref(false);
-const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
-const props = defineProps({
-  getList: {
-    type: Function,
-    default: () => {},
-  },
-});
-
-const { getList } = toRefs(props);
-const total = ref(0);
-
-const employeeEmptyData = {
-  id: null,
-  title: "",
-  remark: "",
-  employeeName: "",
-  departmentName: "",
-  idCardImage: "",
-  idCardImageBack: "",
-  idiograph: "",
-  details: [],
-  editStatus: true,
-};
-
-const form = ref({});
+  import {
+    getDetail,
+    saveDetail, turnBackDetail,
+  } from "@/api/business/production/housingFundDeclare";
+  import { uploadFile } from "@/api/tool/file";
+  import { rowNum } from "@/utils/index";
+  import { ref } from "vue";
+  const { proxy } = getCurrentInstance();
+  const visible = ref(false);
+  const width = ref(800);
+  const selections = ref([]);
+  const currentSource = ref(null);
+  const editStatus = ref(false);
+  const loading = ref(false);
+  const canSave = ref(false);
+  const stopUseBack = ref(false);
+  const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => { },
+    },
+  });
 
-const emptyForm = {
-  details: [],
-};
+  const { getList } = toRefs(props);
+  const total = ref(0);
 
-function open(detail) {
-  visible.value = true;
-  form.value = detail;
-  loadData();
-}
+  const employeeEmptyData = {
+    id: null,
+    title: "",
+    remark: "",
+    employeeName: "",
+    departmentName: "",
+    idCardImage: "",
+    idCardImageBack: "",
+    idiograph: "",
+    details: [],
+    editStatus: true,
+  };
+  const currentMonth = ref(
+    proxy.moment().format("YYYY-MM-01")
+  );
+  const form = ref({});
 
-function loadData() {
-  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();
+  const emptyForm = {
+    details: [],
+  };
+  function changeMonthHandle() {
+    // isView.value = true
+    const nowDate = ref(
+      proxy.moment().format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
+    if (nowyear + nowmonth == year + month) {
+      // isView.value = false
+      stopUseBack.value = false
+    } else {
+      stopUseBack.value = true
     }
-    amountChangeHandler();
-  });
-}
+    loadData()
+  }
+  function open(detail) {
+    visible.value = true;
+    currentMonth.value = proxy.moment().format("YYYY-MM-01")
+    form.value = detail;
+    loadData();
+  }
 
-function close() {
-  visible.value = false;
-  reset();
-}
+  function loadData() {
+    loading.value = true;
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    const {year,month,housingFundDeclareId,companyId} = form.value
+    const clearForm = {year,month,housingFundDeclareId,companyId}
+    getDetail(clearForm).then((res) => {
+      form.value = { ...proxy.deepClone(emptyForm), ...res.data };
+      // if (form.value.status === 2 || form.value.status === 3) {
+      //   proxy.$modal.msgError("该信息已提交待审核");
+      //   close();
+      // }
+      amountChangeHandler();
+    }).finally(() => {
+      loading.value = false;
+    });
+  }
 
-function reset() {
-  form.value = proxy.deepClone(emptyForm);
-  canSave.value = false;
-}
+  function close() {
+    visible.value = false;
+    reset();
+  }
+  function turnBack(detail) {
+    loading.value = true
+    form.value.status = 1;
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    turnBackDetail(form.value)
+      .then((res) => {
+        getList.value();
+      })
+      .catch((err) => {
+        proxy.$modal.msgError(err.message);
+      }).finally(() => {
+        loading.value = false
+        visible.value = false;
+      });
+  }
+  function reset() {
+    form.value = proxy.deepClone(emptyForm);
+    canSave.value = false;
+  }
 
-function handleCurrentChange(row) {
-  currentSource.value = row;
-}
+  function handleCurrentChange(row) {
+    currentSource.value = row;
+  }
 
-function handleCheckChange(selection) {
-  selections.value = selection.map((item) => item);
-}
+  function handleCheckChange(selection) {
+    selections.value = selection.map((item) => item);
+  }
 
-function handleSave() {
-  if (form.value.isFirstHousingFund === 0 && form.value.isPayOnWindow === 0) {
-    if (!form.value.housingFundUnitAccount) {
-      proxy.$modal.msgError("请输入公积金单位账号");
-      return;
-    }
-    if (!form.value.housingFundPassword) {
-      proxy.$modal.msgError("请输入公积金秘钥密码");
-      return;
-    }
-    if (!passwordCheck(form.value.housingFundPassword)) {
-      proxy.$modal.msgError("请输入正确的公积金秘钥密码");
-      return;
-    }
-    if (!form.value.housingFundDeductionPassword) {
-      proxy.$modal.msgError("请输入公积金划款密码");
-      return;
+  function handleSave() {
+    if (form.value.isFirstHousingFund === 0 && form.value.isPayOnWindow === 0) {
+      if (!form.value.housingFundUnitAccount) {
+        proxy.$modal.msgError("请输入公积金单位账号");
+        return;
+      }
+      if (!form.value.housingFundPassword) {
+        proxy.$modal.msgError("请输入公积金秘钥密码");
+        return;
+      }
+      if (!passwordCheck(form.value.housingFundPassword)) {
+        proxy.$modal.msgError("请输入正确的公积金秘钥密码");
+        return;
+      }
+      if (!form.value.housingFundDeductionPassword) {
+        proxy.$modal.msgError("请输入公积金划款密码");
+        return;
+      }
+      if (!passwordCheck(form.value.housingFundDeductionPassword)) {
+        proxy.$modal.msgError("请输入正确的公积金密码");
+        return;
+      }
     }
-    if (!passwordCheck(form.value.housingFundDeductionPassword)) {
-      proxy.$modal.msgError("请输入正确的公积金密码");
+    if (
+      form.value.evidenceFiles == null ||
+      form.value.evidenceFiles.length === 0
+    ) {
+      proxy.$modal.msgError("请上传凭证");
       return;
     }
-  }
-  if (
-    form.value.evidenceFiles == null ||
-    form.value.evidenceFiles.length === 0
-  ) {
-    proxy.$modal.msgError("请上传凭证");
-    return;
-  }
-  proxy.$modal
-    .confirm("确认保存么?")
-    .then(() => {
-      const saveValue = proxy.deepClone(form.value);
-      saveValue.status = 3;
-      saveDetail(saveValue).then((res) => {
-        proxy.$modal.msgSuccess("保存成功");
-        reset();
-        close();
-        getList.value();
+    proxy.$modal
+      .confirm("确认保存么?")
+      .then(() => {
+        const saveValue = proxy.deepClone(form.value);
+        saveValue.status = 3;
+        saveValue.year = proxy.moment(currentMonth.value).format("YYYY");
+        saveValue.month = proxy.moment(currentMonth.value).format("MM");
+        saveDetail(saveValue).then((res) => {
+          proxy.$modal.msgSuccess("保存成功");
+          reset();
+          close();
+          getList.value();
+        });
+      })
+      .catch((err) => {
+        proxy.$modal.msg("取消保存");
       });
-    })
-    .catch((err) => {
-      proxy.$modal.msg("取消保存");
-    });
-}
-
-function passwordCheckHandler(value, field) {
-  // console.log(value)
-  if (!passwordCheck(form.value[field])) {
-    proxy.$modal.msgError("请输入正确密码");
   }
-}
 
-function passwordCheck(value) {
-  const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
-  if (!pattern.test(value)) {
-    return false;
+  function passwordCheckHandler(value, field) {
+    // console.log(value)
+    if (!passwordCheck(form.value[field])) {
+      proxy.$modal.msgError("请输入正确密码");
+    }
   }
-  return true;
-}
 
-function upload(param) {
-  const formData = new FormData();
-  formData.append("file", param.file);
-  uploadFile(formData).then((res) => {
-    if (res.code === 200) {
-      const file = {};
-      file.fileName = res.newFileName;
-      file.evidenceFileType =
-        res.newFileName.split(".")[res.newFileName.split(".").length - 1];
-      file.url = res.url;
-      file.originalFileName = res.originalFilename;
-      file.fileUrl = res.fileName;
-      form.value.evidenceFiles.push(file);
+  function passwordCheck(value) {
+    const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
+    if (!pattern.test(value)) {
+      return false;
     }
-  });
-}
+    return true;
+  }
+
+  function upload(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.evidenceFileType =
+          res.newFileName.split(".")[res.newFileName.split(".").length - 1];
+        file.url = res.url;
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        form.value.evidenceFiles.push(file);
+      }
+    });
+  }
 
-function openFile(row) {
-  window.open(`${baseUrl.value}${row.fileUrl}`);
-}
+  function openFile(row) {
+    window.open(`${baseUrl.value}${row.fileUrl}`);
+  }
 
-function changeEdit() {
-  editStatus.value = !editStatus.value;
-}
+  function changeEdit() {
+    editStatus.value = !editStatus.value;
+  }
 
-function amountChangeHandler() {
-  let amount = 0;
-  amount += form.value.unitAmount == null ? 0 : form.value.unitAmount;
-  amount +=
-    form.value.individualAmount == null ? 0 : form.value.individualAmount;
-  console.log("金额", form.value.unitAmount);
-  form.value.amount = amount;
-}
+  function amountChangeHandler() {
+    let amount = 0;
+    amount += form.value.unitAmount == null ? 0 : form.value.unitAmount;
+    amount +=
+      form.value.individualAmount == null ? 0 : form.value.individualAmount;
+    console.log("金额", form.value.unitAmount);
+    form.value.amount = amount;
+  }
 
-function handleDel(row, index) {
-  proxy.$modal
-    .confirm("确定删除吗?")
-    .then((_) => {
-      form.value.evidenceFiles.splice(index, 1);
-    })
-    .catch((_) => {
-      proxy.$modal.msg("已取消删除");
-    });
-}
+  function handleDel(row, index) {
+    proxy.$modal
+      .confirm("确定删除吗?")
+      .then((_) => {
+        form.value.evidenceFiles.splice(index, 1);
+      })
+      .catch((_) => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
 
-// 暴露给父组件的方法
-defineExpose({
-  open,
-});
+  // 暴露给父组件的方法
+  defineExpose({
+    open,
+  });
 </script>
 <style scoped>
-.img {
-  width: 23px;
-  height: 23px;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-}
+  .img {
+    width: 23px;
+    height: 23px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
 
-::v-deep(.el-upload) {
-  display: flex;
-  text-align: center;
-  justify-content: center;
-  cursor: pointer;
-  outline: 0;
-}
+  ::v-deep(.el-upload) {
+    display: flex;
+    text-align: center;
+    justify-content: center;
+    cursor: pointer;
+    outline: 0;
+  }
 
-.required::after {
-  content: "*";
-  color: red;
-}
+  .required::after {
+    content: "*";
+    color: red;
+  }
 </style>

+ 356 - 327
src/views/business/housingFund/declare/view.vue

@@ -1,371 +1,400 @@
 <template>
-  <el-dialog
-    title="公积金申报信息"
-    v-model="visible"
-    :width="width"
-    append-to-body
-    draggable
-    @close="close"
-    :close-on-click-modal = "false"
-  >
+  <el-dialog title="公积金申报信息" v-model="visible" :width="width" append-to-body draggable @close="close"
+    :close-on-click-modal="false">
     <!-- <div slot="title" class="dialog-title-container">
       <span class="title-label"><i class="el-icon-document" /> 工资信息</span>
       <i class="el-icon-close" @click="close" />
     </div> -->
     <!-- 功能按钮 -->
-    <div style="padding: 8px 24px 16px 24px">
-      <el-form size="small" label-width="120px" v-model="form">
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="客户名称">
-              <div>{{ form.companyName }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="所属月份">
-              <div>{{ form.year }}-{{ form.month }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="窗口缴纳:" required class="edit-label">
-              <template #label>
-                <div>窗口缴纳</div>
-              </template>
-              <div>{{ form.isPayOnWindow === 1 ? "是" : "否" }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="公积金单位账号" required class="edit-label">
-              <template #label>
-                <div>公积金单位账号</div>
-              </template>
-              <div>{{ form.housingFundUnitAccount }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="公积金秘钥密码" required class="edit-label">
-              <template #label>
-                <div>公积金秘钥密码</div>
-              </template>
-              <div>{{ form.housingFundPassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="公积金划款密码" required class="edit-label">
-              <template #label>
-                <div>公积金划款密码</div>
-              </template>
-              <div>{{ form.housingFundDeductionPassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-divider />
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位缴纳:">
-              <div>{{ rowNum(form.unitAmount) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人缴纳:">
-              <div>{{ rowNum(form.individualAmount) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-divider />
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="备注">
-              <div>{{ form.content }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="凭证" required>
-              <el-table
-                ref="dbTable"
-                :data="form.evidenceFiles"
-                size="small"
-                border
-                header-row-class-name="list-header-row"
-                row-class-name="list-row"
-              >
-                <el-table-column
-                  label="文件名"
-                  prop="originalFileName"
-                  align="center"
-                  show-overflow-tooltip
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      type="text"
-                      @click="openFile(scope.row)"
-                      >{{
+    <div v-loading="loading">
+      <div style="padding: 8px 24px 16px 24px">
+        <el-form size="small" label-width="120px" v-model="form">
+          <el-row :gutter="30">
+            <el-col :span="12">
+              <el-form-item label="客户名称">
+                <div>{{ form.companyName }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="所属月份">
+                <!-- <div>{{ form.year }}-{{ form.month }}</div> -->
+                <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+                  @change="changeMonthHandle" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="窗口缴纳:" required class="edit-label">
+                <template #label>
+                  <div>窗口缴纳</div>
+                </template>
+                <div>{{ form.isPayOnWindow === 1 ? "是" : "否" }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="公积金单位账号" required class="edit-label">
+                <template #label>
+                  <div>公积金单位账号</div>
+                </template>
+                <div>{{ form.housingFundUnitAccount }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="公积金秘钥密码" required class="edit-label">
+                <template #label>
+                  <div>公积金秘钥密码</div>
+                </template>
+                <div>{{ form.housingFundPassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="公积金划款密码" required class="edit-label">
+                <template #label>
+                  <div>公积金划款密码</div>
+                </template>
+                <div>{{ form.housingFundDeductionPassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider />
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位缴纳:">
+                <el-input-number v-model="form.unitAmount" size="small" v-if="form.status !==3" placeholder="单位缴纳"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitAmount) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人缴纳:">
+                <el-input-number v-model="form.individualAmount" v-if="form.status !==3" size="small" placeholder="个人缴纳"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualAmount) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider />
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="备注">
+                <el-input v-model.trim="form.content" v-if="form.status !==3" type="textarea" rows="2" />
+                <div v-else>{{form.content}}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="凭证" required>
+                <el-upload action="#" :http-request="upload" :with-credentials="true" :show-file-list="false" multiple>
+                  <el-button size="small" type="primary" icon="Upload" v-if="form.status !==3">点击上传</el-button>
+                </el-upload>
+                <el-table style="margin-top: 15px;" ref="dbTable" :data="form.evidenceFiles" size="small" border
+                  header-row-class-name="list-header-row" row-class-name="list-row">
+                  <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
+                    <template #default="scope">
+                      <el-button size="small" type="text" @click="openFile(scope.row)">{{
                         scope.row.originalFileName == ""
-                          ? "打开文件"
-                          : scope.row.originalFileName
-                      }}</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-    </div>
-    <div class="form-btns-container" style="height: 40px">
-      <el-button size="small" icon="Close" style="float: right" @click="close">
-        取消</el-button
-      >
+                        ? "打开文件"
+                        : scope.row.originalFileName
+                        }}</el-button>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="操作" width="80" prop="fileType" align="center">
+                    <template #default="scope">
+                      <el-button size="small" link type="danger" @click="handleDel(scope.row, scope.$index)"
+                        v-if="form.status !==3">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <div class="form-btns-container" style="height: 40px">
+        <el-button size="small" icon="close" v-if="form.status !== 3" style="float: right; margin-left: 12px; margin-right: 12px"
+          @click="close">取消</el-button>
+        <el-button type="primary" style="float: right" size="small" v-if="form.status !== 3" icon="Finished" @click="handleSave">
+          保存</el-button>
+          <el-button v-hasPermi="['business:housingFundDeclare:verify']" v-if="!stopUseBack" style="float: right;" icon="back" size="small"
+          type="warning" :disabled="
+      form == null || form.status !== 3
+    " @click="turnBack(form)">退回</el-button>
+      </div>
     </div>
     <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
   </el-dialog>
 </template>
 <script setup>
-import {
-  getDetail,
-  saveDetail,
-} from "@/api/business/production/housingFundDeclare";
-import { uploadFile } from "@/api/tool/file";
-import { ref } from "vue";
-import { rowNum } from "@/utils/index";
-const { proxy } = getCurrentInstance();
-const visible = ref(false);
-const width = ref(800);
-const selections = ref([]);
-const currentSource = ref(null);
-const editStatus = ref(false);
-const canSave = ref(false);
-const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
-const props = defineProps({
-  getList: {
-    type: Function,
-    default: () => {},
-  },
-});
-
-const { getList } = toRefs(props);
-const total = ref(0);
-
-const employeeEmptyData = {
-  id: null,
-  title: "",
-  remark: "",
-  employeeName: "",
-  departmentName: "",
-  idCardImage: "",
-  idCardImageBack: "",
-  idiograph: "",
-  details: [],
-  editStatus: true,
-};
+  import {
+    getDetail,
+    saveDetail, turnBackDetail
+  } from "@/api/business/production/housingFundDeclare";
+  import { uploadFile } from "@/api/tool/file";
+  import { ref } from "vue";
+  import { rowNum } from "@/utils/index";
+  const { proxy } = getCurrentInstance();
+  const visible = ref(false);
+  const width = ref(800);
+  const selections = ref([]);
+  const currentSource = ref(null);
+  const editStatus = ref(false);
+  const canSave = ref(false);
+  const loading = ref(false);
+  const stopUseBack = ref(false)
+  const currentMonth = ref(
+    proxy.moment().format("YYYY-MM-01")
+  );
+  const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => { },
+    },
+  });
 
-const form = ref({});
+  const { getList } = toRefs(props);
+  const total = ref(0);
 
-const emptyForm = {
-  details: [],
-};
+  const employeeEmptyData = {
+    id: null,
+    title: "",
+    remark: "",
+    employeeName: "",
+    departmentName: "",
+    idCardImage: "",
+    idCardImageBack: "",
+    idiograph: "",
+    details: [],
+    editStatus: true,
+  };
 
-function open(detail) {
-  visible.value = true;
-  form.value = detail;
-  loadData();
-}
+  const form = ref({});
 
-function loadData() {
-  getDetail(form.value).then((res) => {
-    form.value = { ...proxy.deepClone(emptyForm), ...res.data };
-    amountChangeHandler();
-  });
-}
+  const emptyForm = {
+    details: [],
+  };
 
-function close() {
-  visible.value = false;
-  reset();
-}
+  function open(detail) {
+    visible.value = true;
+    currentMonth.value = proxy.moment().format("YYYY-MM-01")
+    form.value = detail;
+    loadData();
+  }
 
-function reset() {
-  form.value = proxy.deepClone(emptyForm);
-  canSave.value = false;
-}
+  function loadData() {
+    loading.value = true
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    const { year, month, socialSecurityDeclareId, companyId } = form.value
+    const clearForm = { year, month, socialSecurityDeclareId, companyId }
+    getDetail(clearForm).then((res) => {
+      form.value = { ...proxy.deepClone(emptyForm), ...res.data };
+      amountChangeHandler();
 
-function handleCurrentChange(row) {
-  currentSource.value = row;
-}
+    }).finally(() => {
+      loading.value = false
+    });
 
-function handleCheckChange(selection) {
-  selections.value = selection.map((item) => item);
-}
+  }
+  function changeMonthHandle() {
 
-function handleSave() {
-  for (let i = 0; i < form.value.details.length; i++) {
-    const l = form.value.details[i];
-    // 数据校验
-    if (l.employeeName == null || l.employeeName === "") {
-      proxy.$modal.msgError(`第${i + 1}行姓名不能为空`);
-      return;
-    }
-    if (l.phone == null || l.phone === "") {
-      proxy.$modal.msgError(`第${i + 1}行电话不能为空`);
-      return;
-    }
-    // 正则表达式匹配身份证号的格式
-    const regExp = /1[3-9]\d{9}/;
-    if (!regExp.test(l.phone)) {
-      proxy.$modal.msgError(`第${i + 1}行请输入正确的电话号码!`);
-      return;
-    }
-    if (!l.idCardImage) {
-      proxy.$modal.msgError(`第${i + 1}行身份证正面照不能为空`);
-      return;
-    }
-    if (!l.idCardImageBack) {
-      proxy.$modal.msgError(`第${i + 1}行身份证反面照不能为空`);
-      return;
-    }
-    if (!l.cardinalNumber) {
-      proxy.$modal.msgError(`第${i + 1}行基数不能为空`);
-      return;
+    // isView.value = true
+    const nowDate = ref(
+      proxy.moment().format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
+    if (nowyear + nowmonth == year + month) {
+      // isView.value = false
+      stopUseBack.value = false
+    } else {
+      stopUseBack.value = true
     }
-   // if (!l.medicalCardinalNumber) {
-     // proxy.$modal.msgError(`第${i + 1}行医疗基数不能为空`);
-//return;
-//}
+    loadData()
+
   }
-  if (form.value.isFirstSocialSecurity === 0) {
-    if (!form.value.governmentAccountNo) {
-      proxy.$modal.msgError("请输入政务网账号");
-      return;
-    }
-    if (!form.value.governmentPassword) {
-      proxy.$modal.msgError("请输入政务网密码");
-      return;
-    }
-    if (!passwordCheck(form.value.governmentPassword)) {
-      proxy.$modal.msgError("请输入正确的政务网密码");
-      return;
-    }
-    if (!form.value.socialSecurityAccountNo) {
-      proxy.$modal.msgError("请输入社保账号");
-      return;
-    }
-    if (!form.value.socialSecurityPassword) {
-      proxy.$modal.msgError("请输入社保密码");
-      return;
-    }
-    if (!passwordCheck(form.value.socialSecurityPassword)) {
-      proxy.$modal.msgError("请输入正确的社保密码");
-      return;
-    }
-    if (!form.value.employeePassword) {
-      proxy.$modal.msgError("请输入用工密码");
-      return;
-    }
-    if (!passwordCheck(form.value.employeePassword)) {
-      proxy.$modal.msgError("请输入正确的用工密码");
-      return;
-    }
+  function close() {
+    visible.value = false;
+    reset();
   }
-  proxy.$modal
-    .confirm("确认保存么?")
-    .then(() => {
-      const saveValue = proxy.deepClone(form.value);
-      saveValue.status = 3;
-      saveDetail(saveValue).then((res) => {
-        proxy.$modal.msgSuccess("保存成功");
-        reset();
-        close();
+  function turnBack(detail) {
+    loading.value = true
+    form.value.status = 1;
+
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    turnBackDetail(form.value)
+      .then((res) => {
         getList.value();
+      })
+      .catch((err) => {
+        proxy.$modal.msgError(err.message);
+      }).finally(() => {
+        loading.value = false
+        visible.value = false;
       });
-    })
-    .catch((err) => {
-      proxy.$modal.msg("取消保存");
-    });
-}
+  }
+  function reset() {
+    form.value = proxy.deepClone(emptyForm);
+    canSave.value = false;
+  }
 
-function passwordCheckHandler(value, field) {
-  // console.log(value)
-  if (!passwordCheck(form.value[field])) {
-    proxy.$modal.msgError("请输入正确密码");
+  function handleCurrentChange(row) {
+    currentSource.value = row;
   }
-}
 
-function passwordCheck(value) {
-  const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
-  if (!pattern.test(value)) {
-    return false;
+  function handleCheckChange(selection) {
+    selections.value = selection.map((item) => item);
   }
-  return true;
-}
 
-function upload(param) {
-  const formData = new FormData();
-  formData.append("file", param.file);
-  uploadFile(formData).then((res) => {
-    if (res.code === 200) {
-      const file = {};
-      file.fileName = res.newFileName;
-      file.url = res.url;
-      file.originalFileName = res.originalFilename;
-      file.fileUrl = res.fileName;
-      form.value.evidenceFiles.push(file);
+  function handleSave() {
+    if (form.value.isFirstSocialSecurity === 0) {
+      if (!form.value.governmentAccountNo) {
+        proxy.$modal.msgError("请输入政务网账号");
+        return;
+      }
+      if (!form.value.governmentPassword) {
+        proxy.$modal.msgError("请输入政务网密码");
+        return;
+      }
+      if (!passwordCheck(form.value.governmentPassword)) {
+        proxy.$modal.msgError("请输入正确的政务网密码");
+        return;
+      }
+      if (!form.value.socialSecurityAccountNo) {
+        proxy.$modal.msgError("请输入社保账号");
+        return;
+      }
+      if (!form.value.socialSecurityPassword) {
+        proxy.$modal.msgError("请输入社保密码");
+        return;
+      }
+      if (!passwordCheck(form.value.socialSecurityPassword)) {
+        proxy.$modal.msgError("请输入正确的社保密码");
+        return;
+      }
+      if (!form.value.employeePassword) {
+        proxy.$modal.msgError("请输入用工密码");
+        return;
+      }
+      if (!passwordCheck(form.value.employeePassword)) {
+        proxy.$modal.msgError("请输入正确的用工密码");
+        return;
+      }
     }
-  });
-}
+    if (
+      form.value.evidenceFiles == null ||
+      form.value.evidenceFiles.length === 0
+    ) {
+      proxy.$modal.msgError("请上传凭证");
+      return;
+    }
+    // if (form.value.reportFiles == null || form.value.reportFiles.length === 0) {
+    //   proxy.$modal.msgError("请上传报表");
+    //   return;
+    // }
 
-function openFile(row) {
-  window.open(`${baseUrl.value}${row.fileUrl}`);
-}
+    proxy.$modal
+      .confirm("确认保存么?")
+      .then(() => {
+        const saveValue = proxy.deepClone(form.value);
+        saveValue.status = 3;
+        saveValue.year = proxy.moment(currentMonth.value).format("YYYY");
+        saveValue.month = proxy.moment(currentMonth.value).format("MM");
+        saveDetail(saveValue).then((res) => {
+          proxy.$modal.msgSuccess("保存成功");
+          reset();
+          close();
+          getList.value();
+        });
+      })
+      .catch((err) => {
+        proxy.$modal.msg("取消保存");
+      });
+  }
 
-function changeEdit() {
-  editStatus.value = !editStatus.value;
-}
+  function passwordCheckHandler(value, field) {
+    // console.log(value)
+    if (!passwordCheck(form.value[field])) {
+      proxy.$modal.msgError("请输入正确密码");
+    }
+  }
 
-function amountChangeHandler() {
-  let amount = 0;
-  amount += form.value.unitAmount == null ? 0 : form.value.unitAmount;
-  amount +=
-    form.value.individualAmount == null ? 0 : form.value.individualAmount;
-  form.value.amount = amount;
-}
+  function passwordCheck(value) {
+    const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
+    if (!pattern.test(value)) {
+      return false;
+    }
+    return true;
+  }
 
-function handleDel(row, index) {
-  proxy.$modal
-    .confirm("确定删除吗?")
-    .then((_) => {
-      form.value.evidenceFiles.splice(index, 1);
-    })
-    .catch((_) => {
-      proxy.$modal.msg("已取消删除");
+  function upload(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.url = res.url;
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        form.value.evidenceFiles.push(file);
+      }
     });
-}
+  }
+
+  function openFile(row) {
+    window.open(`${baseUrl.value}${row.fileUrl}`);
+  }
+
+  function changeEdit() {
+    editStatus.value = !editStatus.value;
+  }
+
+  function amountChangeHandler() {
+    let amount = 0;
+    amount += form.value.unitAmount == null ? 0 : form.value.unitAmount;
+    amount +=
+      form.value.individualAmount == null ? 0 : form.value.individualAmount;
+    form.value.amount = amount;
+  }
 
-// 暴露给父组件的方法
-defineExpose({
-  open,
-});
+  function handleDel(row, index) {
+    proxy.$modal
+      .confirm("确定删除吗?")
+      .then((_) => {
+        form.value.evidenceFiles.splice(index, 1);
+      })
+      .catch((_) => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
+
+  // 暴露给父组件的方法
+  defineExpose({
+    open,
+  });
 </script>
 <style scoped>
-.img {
-  width: 23px;
-  height: 23px;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-}
+  .img {
+    width: 23px;
+    height: 23px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
 
-::v-deep(.el-upload) {
-  display: flex;
-  text-align: center;
-  justify-content: center;
-  cursor: pointer;
-  outline: 0;
-}
+  ::v-deep(.el-upload) {
+    display: flex;
+    text-align: center;
+    justify-content: center;
+    cursor: pointer;
+    outline: 0;
+  }
 
-.required::after {
-  content: "*";
-  color: red;
-}
+  .required::after {
+    content: "*";
+    color: red;
+  }
 </style>

+ 71 - 18
src/views/business/production/IndividualIncomeTaxIs/FormDialog.vue

@@ -19,7 +19,9 @@
                   <div>{{ currentMember }}</div>
                 </el-form-item>
                 <el-form-item label="所属月份">
-                  <div>{{ year }}-{{ month }}</div>
+                  <!-- <div>{{ year }}-{{ month }}</div> -->
+                  <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+                  @change="changeMonthHandle" />
                 </el-form-item>
               </el-col>
               <el-col :span="24">
@@ -50,7 +52,7 @@
                       v-if="emptyForm.evidenceFile == null || emptyForm.evidenceFile == ''" />
                     <img v-else style="height: 148px; width: 148px" :src="`${baseUrl}/${emptyForm.evidenceFile}`"
                       class="avatar" @click="openEvidience('evidenceFile')" />
-                      <div v-if="!isView">
+                      <div v-if="!isView|| emptyForm.status !== 3">
                         <el-icon :size="20" v-if="emptyForm.evidenceFile !== '' ||emptyForm.evidenceFile == null " @click="emptyForm.evidenceFile = ''"
                         class="delete-button" >
                         <Delete />
@@ -96,7 +98,7 @@
               <el-col :span="24" style="padding: 15px 15px 16px 15px">
                 <div class="details-btns-container">
                   <el-form-item label="报表文件" prop="reportFile" required>
-                    <el-upload v-if="!isView" action="#" :http-request="uploadextFile" :with-credentials="true"
+                    <el-upload v-if="!isView || emptyForm.status !== 3" action="#" :http-request="uploadextFile" :with-credentials="true"
                       :show-file-list="false" multiple>
                       <el-button size="small" type="primary" icon="Upload">点击上传</el-button>
                     </el-upload>
@@ -112,7 +114,7 @@
                         </el-button>
                       </template>
                     </el-table-column>
-                    <el-table-column v-if="!isView" label="操作" width="50" align="center">
+                    <el-table-column v-if="!isView || emptyForm.status !== 3" label="操作" width="50" align="center">
                       <template #default="scope">
                         <el-button size="small" link type="danger" @click="handleDelFile(scope.$index)">删除</el-button>
                       </template>
@@ -124,14 +126,22 @@
           </el-form>
         </div>
       </div>
-      <div class="form-btns-container" v-if="!isView" style="height: 40px">
-        <el-button size="small" icon="close" style="float: right; margin-left: 12px; margin-right: 12px" @click="close">
+      <div class="form-btns-container"  style="height: 40px">
+        <el-button size="small" icon="close" v-if="!isView || emptyForm.status !== 3" style="float: right; margin-left: 12px; margin-right: 12px" @click="close">
           取消
         </el-button>
-        <el-button type="primary" size="small" icon="Finished"
+        <el-button type="primary" size="small" icon="Finished" v-if="!isView || emptyForm.status !== 3"
           v-hasPermi="['business:individualIncomeTaxDetail:saveDetail']" style="float: right" @click="handleSave">
           保存
         </el-button>
+        <el-button 
+        v-if="!stopUseBack" icon="back"
+        type="warning" size="small" 
+        style="float: right;" 
+        :disabled="(emptyForm == null || emptyForm.status !== 3)  " 
+        @click="turnBack(emptyForm)" v-hasPermi="['business:individualIncomeTaxDetail:deductionTurnBack']">
+        退回
+      </el-button>
       </div>
     </div>
   </el-dialog>
@@ -174,7 +184,10 @@
   const sourceCategories = ref([]);
   const tenantId = ref(0);
   const addType = ref(1);
-
+  const stopUseBack = ref(false);
+  const currentMonth = ref(
+    proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+  );
   const emptyForm = ref({
     financialIndividualIncomeTaxId: null,
     companyId: null,
@@ -231,6 +244,7 @@
     mainInfo.value = mainRow;
     monthInfo.value = monthItem;
     console.log("id", id);
+    currentMonth.value = proxy.moment().subtract(1, "month").format("YYYY-MM-01")
     if (id == 0) {
       isAdd.value = true;
       isView.value = false;
@@ -245,21 +259,22 @@
       isAdd.value = false;
       getInfoId(id);
     }
-
-    // getDetail(queryParams.value).then((response) => {
-    //   detailList.value = response.rows;
-    //   total.value = response.total;
-    //   loading.value = false;
-    // });
+    getDetail(queryParams.value).then((response) => {
+      detailList.value = response.rows;
+      total.value = response.total;
+      loading.value = false;
+    });
   }
 
   function getInfoId(id) {
     console.log("id", mainInfo.value);
-    getInfo(mainInfo.value.detail.id).then((response) => {
+    getInfo(mainInfo.value.id, monthInfo.value.year, monthInfo.value.month).then((response) => {
       console.log("response", response);
       mainInfo.value.detail = response.data;
       reportFiles.value = response.data.reportFiles;
       emptyForm.value = response.data;
+
+      console.log(123,emptyForm.value.status);
       loadData(id);
     });
   }
@@ -285,7 +300,41 @@
       }
     }
   }
+    /** 退回按钮操作 */
+    function turnBack(row) {
+    loading.value = true
+    emptyForm.value.status = 1;
+    // emptyForm.value.workOrderId = workOrderId;
+    emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
+    console.log(emptyForm);
+    updateIndividualIncomeTaxDetail(emptyForm.value);
+    loading.value = false;
+    getList.value();
+    visible.value = false;
+  }
+  function changeMonthHandle(parentId) {
+    isView.value =true
+    const nowDate = ref(
+    proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
 
+    if(nowyear+nowmonth == year+month){
+      isView.value =false
+      stopUseBack.value = false
+    }else{
+      stopUseBack.value = true
+    }
+    getInfo(mainInfo.value.id, year, month).then((response) => {
+      mainInfo.value.detail = response.data;
+      emptyForm.value = response.data;
+      loadData(parentId);
+    });
+  }
   /** 上传报表附件 */
   function uploadextFile(param) {
     const formData = new FormData();
@@ -333,8 +382,10 @@
     }
     loading.value = true
     emptyForm.value.files = fileList.value;
-    emptyForm.value.year = year.value;
-    emptyForm.value.month = month.value;
+    // emptyForm.value.year = year.value;
+    // emptyForm.value.month = month.value;
+    emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
     emptyForm.value.status = 3;
     emptyForm.value.reportFiles = reportFiles.value;
     if (isAdd.value) {
@@ -405,9 +456,11 @@
 
   /** 关闭 */
   function close() {
-    visible.value = false;
+    visible.value = true;
     emptyForm.value = {};
     reportFiles.value = [];
+    getList.value();
+    visible.value = false;
   }
 
   function openEvidenceFile(row) {

+ 5 - 3
src/views/business/production/IndividualIncomeTaxIs/index.vue

@@ -146,7 +146,7 @@
         </template>
       </el-table-column>
       <el-table-column label="执行人" align="center" prop="serviceName" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template #default="scope">
           <el-button size="small" type="text" :disabled="
               scope.row.detail == null || scope.row.detail.status !== 3
@@ -154,7 +154,7 @@
               'business:individualIncomeTaxDetail:deductionTurnBack',
             ]">退回</el-button>
         </template>
-      </el-table-column>
+      </el-table-column> -->
     </el-table>
 
     <!-- 分页 -->
@@ -162,7 +162,7 @@
       v-model:limit="queryParams.pageSize" @pagination="getList" />
     <!-- 表单 -->
     <MemberDialog ref="memberDialog" :get-list="getList"></MemberDialog>
-    <FormDialog ref="fromDialog" :get-list="getList"></FormDialog>
+    <FormDialog ref="fromDialog" :get-list="getList" :workOrderId = workOrderId></FormDialog>
 
     <!-- 更多搜索弹窗 -->
     <el-dialog title="更多搜索" v-model="moreSearch" width="620px" append-to-body size="small" draggable :close-on-click-modal = "false">
@@ -237,6 +237,7 @@
   const single = ref(true);
   const multiple = ref(true);
   const total = ref(0);
+  const workOrderId = ref(null);
   const currentMonth = ref(
     proxy.moment().subtract(1, "month").format("YYYY-MM-01")
   );
@@ -316,6 +317,7 @@
 
   /** 填写按钮操作 */
   function fillIn(row) {
+    workOrderId.value = row.workOrderId 
     if (row.detail == null) {
       openByPermission(0, row, {
         month: queryParams.value.month,

+ 21 - 6
src/views/business/production/IndividualIncomeTaxIsZero/FormDialog.vue

@@ -89,6 +89,7 @@
           style="float: right" @click="handleSave">
           保存</el-button>
         <el-button 
+        v-if="!stopUseBack"
         type="primary" size="small" 
         style="float: right;" 
         :disabled="emptyForm == null || emptyForm.status !== 3 " 
@@ -141,7 +142,7 @@
     proxy.moment().subtract(1, "month").format("YYYY-MM-01")
   );
   const addType = ref(1);
-
+  const stopUseBack = ref(false);
   const emptyForm = ref({
     financialIndividualIncomeTaxId: null,
     companyId: null,
@@ -224,7 +225,7 @@
     emptyForm.value.workOrderId = workOrderId;
     emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
     emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
-    console.log(emptyForm);
+    console.log( emptyForm.value);
     updateIndividualIncomeTaxDetail(emptyForm.value);
     loading.value = false;
     getList.value();
@@ -239,14 +240,27 @@
     });
   }
   function changeMonthHandle(parentId) {
+    loading.value = true
+    isView.value =true
+    const nowDate = ref(
+    proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
     const year = proxy.moment(currentMonth.value).format("YYYY");
     const month = proxy.moment(currentMonth.value).format("MM");
+    if(nowyear+nowmonth == year+month){
+      isView.value =false
+      stopUseBack.value = false
+    }else{
+      stopUseBack.value = true
+    }
     getInfo(mainInfo.value.id, year, month).then((response) => {
-      console.log("response", response);
       mainInfo.value.detail = response.data;
       emptyForm.value = response.data;
-      console.log(2323, emptyForm.value);
       loadData(parentId);
+    }).finally(() => {
+      loading.value = false;
     });
   }
 
@@ -297,7 +311,6 @@
     emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
     emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
     emptyForm.value.status = 3;
-    console.log(emptyForm.value);
     if (isAdd.value) {
       emptyForm.value.companyId = mainInfo.value.companyId;
       addIndividualIncomeTaxDetail(emptyForm.value)
@@ -367,7 +380,7 @@
 
   /** 关闭 */
   function close() {
-    visible.value = false;
+    visible.value = true;
     emptyForm.value = {
       financialIndividualIncomeTaxId: null,
       companyId: null,
@@ -378,6 +391,8 @@
       receiveDateRange: proxy.moment().format("YYYY-MM-DD"),
       receiveTimeRange: "08:00:00",
     };
+    getList.value();
+    visible.value = false;
   }
 
   function openEvidenceFile() { }

+ 102 - 34
src/views/business/production/financialReportTax/FormDialog.vue

@@ -15,18 +15,21 @@
 
               <el-col :span="12">
                 <el-form-item label="所属月份">
-                  <div>{{ year }}-{{ month }}</div>
+                  <!-- <div>{{ year }}-{{ month }}</div> -->
+                  <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+                    @change="changeMonthHandle" />
                 </el-form-item>
               </el-col>
 
               <el-col :span="12">
                 <el-form-item label="可弥补之前年度亏损">
-                  <el-input-number v-if="editStatus && !isView" size="small" placeholder="可弥补之前年度亏损"
-                    v-model="emptyForm.previousAnnualLosses" style="width: 120%" :precision="2" :controls="false" />
+                  <el-input-number v-if="(editStatus && !isView)|| emptyForm.status !== 3" size="small"
+                    placeholder="可弥补之前年度亏损" v-model="emptyForm.previousAnnualLosses" style="width: 120%" :precision="2"
+                    :controls="false" />
                   <div v-else>
                     {{ rowNum(emptyForm.previousAnnualLosses ? null : 0.0) }}
-                    <el-button link type="primary" icon="Edit" size="small" style="margin-left: 20px" v-if="!isView"
-                      @click="editStatus = true" />
+                    <el-button link type="primary" icon="Edit" size="small" style="margin-left: 20px"
+                      v-if="!isView || emptyForm.status !== 3" @click="editStatus = true" />
                   </div>
                   <template v-if="isView">
                     <span>{{ rowNum(emptyForm.previousAnnualLosses) }}</span>
@@ -39,7 +42,8 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="增值税">
-                  <el-input-number v-if="!isView" placeholder="增值税" v-model="emptyForm.valueAddedTax" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="增值税"
+                    v-model="emptyForm.valueAddedTax" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -50,7 +54,8 @@
 
               <el-col :span="12">
                 <el-form-item label="城建税">
-                  <el-input-number v-if="!isView" placeholder="城建税" v-model="emptyForm.cityConstructTax" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="城建税"
+                    v-model="emptyForm.cityConstructTax" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -61,7 +66,8 @@
 
               <el-col :span="12">
                 <el-form-item label="教育费附加">
-                  <el-input-number v-if="!isView" placeholder="教育费附加" v-model="emptyForm.additionsTaxOfEducation" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="教育费附加"
+                    v-model="emptyForm.additionsTaxOfEducation" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -74,8 +80,8 @@
 
               <el-col :span="12">
                 <el-form-item label="地方教育费附加">
-                  <el-input-number v-if="!isView" placeholder="地方教育费附加" v-model="emptyForm.ladditionsTaxOfEducation"
-                    style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="地方教育费附加"
+                    v-model="emptyForm.ladditionsTaxOfEducation" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -88,7 +94,8 @@
 
               <el-col :span="12">
                 <el-form-item label="企业所得税">
-                  <el-input-number v-if="!isView" placeholder="企业所得税" v-model="emptyForm.businessIncomeTax" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="企业所得税"
+                    v-model="emptyForm.businessIncomeTax" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -99,7 +106,8 @@
 
               <el-col :span="12">
                 <el-form-item label="印花税">
-                  <el-input-number v-if="!isView" placeholder="印花税" v-model="emptyForm.stampTax" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="印花税"
+                    v-model="emptyForm.stampTax" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -110,7 +118,8 @@
 
               <el-col :span="12">
                 <el-form-item label="文化事业建设税">
-                  <el-input-number v-if="!isView" placeholder="文化事业建设税" v-model="emptyForm.culturalConstructTax" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="文化事业建设税"
+                    v-model="emptyForm.culturalConstructTax" style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -121,7 +130,8 @@
 
               <el-col :span="12">
                 <el-form-item label="消费税">
-                  <el-input-number v-if="!isView" placeholder="消费税" v-model="emptyForm.excise" style="
+                  <el-input-number v-if="!isView || emptyForm.status !== 3" placeholder="消费税" v-model="emptyForm.excise"
+                    style="
                     display: flex;
                     align-items: center;
                     justify-content: center;
@@ -142,7 +152,7 @@
                 <el-divider />
               </el-col>
 
-              <el-col :span="12" v-if="!isView">
+              <el-col :span="12" v-if="!isView || emptyForm.status !== 3">
                 <el-form-item label="备注">
                   <el-input type="textarea" rows="2" maxlength="200" show-word-limit v-model="emptyForm.content" />
                 </el-form-item>
@@ -155,7 +165,7 @@
                       v-if="emptyForm.evidenceFile == null || emptyForm.evidenceFile == ''" />
                     <img v-else style="height: 148px; width: 148px" :src="`${baseUrl}/${emptyForm.evidenceFile}`"
                       class="avatar" @click="openEvidience('evidenceFile')" />
-                    <div v-if="!isView">
+                    <div v-if="!isView || emptyForm.status !== 3">
                       <el-icon :size="20" v-if="emptyForm.evidenceFile !== '' ||emptyForm.evidenceFile == null "
                         @click="emptyForm.evidenceFile = ''" class="delete-button">
                         <Delete />
@@ -201,8 +211,8 @@
               <el-col :span="24" style="padding: 15px 15px 16px 15px">
                 <div class="details-btns-container">
                   <el-form-item label="报表文件" prop="reportFile">
-                    <el-upload v-if="!isView" action="#" :http-request="uploadextFile" :with-credentials="true"
-                      :show-file-list="false" multiple>
+                    <el-upload v-if="!isView || emptyForm.status !== 3" action="#" :http-request="uploadextFile"
+                      :with-credentials="true" :show-file-list="false" multiple>
                       <el-button size="small" type="primary" icon="Upload">点击上传</el-button>
                     </el-upload>
                   </el-form-item>
@@ -225,7 +235,7 @@
                         </el-link>
                       </template>
                     </el-table-column>
-                    <el-table-column v-if="!isView" label="操作" width="50" align="center">
+                    <el-table-column v-if="!isView || emptyForm.status !== 3" label="操作" width="50" align="center">
                       <template #default="scope">
                         <el-button size="small" link type="danger" @click="handleDelFile(scope.$index)">删除</el-button>
                       </template>
@@ -237,13 +247,18 @@
           </el-form>
         </div>
       </div>
-      <div class="form-btns-container" v-if="!isView" style="height: 40px">
-        <el-button size="small" icon="close" style="float: right; margin-left: 12px; margin-right: 12px"
-          @click="close">取消
+      <div class="form-btns-container" style="height: 40px">
+        <el-button size="small" icon="close" v-if="!isView || emptyForm.status !== 3"
+          style="float: right; margin-left: 12px; margin-right: 12px" @click="close">取消
         </el-button>
-        <el-button type="primary" size="small" icon="Finished" @click="handleSave"
-          v-hasPermi="['business:financialReportTax:saveDetail']" style="float: right">
+        <el-button type="primary" size="small" v-if="!isView || emptyForm.status !== 3" icon="Finished"
+          @click="handleSave" v-hasPermi="['business:financialReportTax:saveDetail']" style="float: right">
           保存</el-button>
+        <el-button v-if="!stopUseBack" type="warning" size="small" style="float: right;" icon="back"
+          :disabled="emptyForm == null || emptyForm.status !== 3 " @click="turnBack(emptyForm)"
+          v-hasPermi="['business:financialReportTaxNonZero:back']">
+          退回
+        </el-button>
       </div>
     </div>
   </el-dialog>
@@ -283,7 +298,9 @@
   const files = ref([]);
   const reportFiles = ref([]);
   const tenantId = ref(0);
-
+  const currentMonth = ref(
+    proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+  );
   const sourceCategories = ref([]);
 
   const addType = ref(1);
@@ -300,7 +317,7 @@
     reportFiles: [],
     workOrderId: null,
   });
-
+  const stopUseBack = ref(false);
   const data = reactive({
     form: {},
   });
@@ -316,14 +333,14 @@
     }
   });
 
-  import { saveDetail, updateTax, getTax } from "@/api/business/production/tax";
+  import { saveDetail, updateTax, getTax, deductionTurnBack } from "@/api/business/production/tax";
   import { uploadFile } from "@/api/tool/file";
   import dragUpload from "@/components/dragUpload"
   // import { de } from "element-plus/es/locale";
   import { ref } from "vue";
 
   const baseUrl = import.meta.env.VITE_APP_BASE_API;
-
+  const parentId = ref(null);
   const { form, rules } = toRefs(data);
 
   const followQuery = ref({});
@@ -337,6 +354,8 @@
     mainInfo.value = mainRow;
     monthInfo.value = monthItem;
     tenantId.value = mainRow.tenantId;
+    currentMonth.value = proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+    parentId.value = id
     if (id == 0) {
       isAdd.value = true;
       isView.value = false;
@@ -354,7 +373,7 @@
 
   function getTaxId(mainRow, id) {
     if (mainRow.detail != null) {
-      getTax(mainRow.detail.id).then((res) => {
+      getTax(mainInfo.value.id, monthInfo.value.year, monthInfo.value.month).then((res) => {
         if (res.code === 200) {
           emptyForm.value = res.data;
 
@@ -366,6 +385,34 @@
       loadData(id);
     }
   }
+  function changeMonthHandle(parentId) {
+
+    loading.value = true
+    isView.value = true
+    const nowDate = ref(
+      proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
+    if (nowyear + nowmonth == year + month) {
+      isView.value = false
+      stopUseBack.value = false
+    } else {
+      stopUseBack.value = true
+    }
+    getTax(mainInfo.value.id, year, month).then((res) => {
+      if (res.code === 200) {
+        console.log("查询成功");
+        emptyForm.value = res.data;
+        reportFiles.value = emptyForm.value.reportFiles;
+        loadData(parentId);
+      }
+    }).finally(() => {
+      loading.value = false
+    });
+  }
 
   function openEvidience() {
     window.open(`${baseUrl}${emptyForm.value.evidenceFile}`);
@@ -386,7 +433,25 @@
       }
     }
   }
-
+  /** 退回按钮操作 */
+  function turnBack(detail) {
+    loading.value = true
+    emptyForm.value.status = 1;
+    emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
+    deductionTurnBack(emptyForm.value)
+      .then((res) => {
+        proxy.$modal.msgSuccess("保存成功!");
+        getList().value();
+      })
+      .catch((err) => {
+        proxy.$modal.$modalMsgError(err);
+        getList().value();
+      });
+    getList.value();
+    loading.value = false;
+    visible.value = false;
+  }
   /** 计算税额 */
   function taxChangeHandler() {
     let amount = 0;
@@ -434,9 +499,10 @@
     }
 
     emptyForm.value.files = files.value;
-    emptyForm.value.year = year.value;
-    emptyForm.value.month = month.value;
-
+    // emptyForm.value.year = year.value;
+    // emptyForm.value.month = month.value;
+    emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
     console.log("monthInfo", monthInfo.value);
     console.log("month", month.value);
     emptyForm.value.status = 3;
@@ -567,8 +633,10 @@
 
   /** 关闭 */
   function close() {
-    visible.value = false;
+    visible.value = true;
     reset();
+    getList.value();
+    visible.value = false;
   }
 
   function openEvidenceFile() {

+ 2 - 2
src/views/business/production/financialReportTax/index.vue

@@ -145,14 +145,14 @@
         </template>
       </el-table-column>
       <el-table-column label="执行人" align="center" min-width="100" prop="serviceName" />
-      <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width">
+      <!-- <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width">
         <template #default="scope">
           <el-button size="small" link type="primary" :disabled="
               scope.row.detail == null || scope.row.detail.status !== 3
             " @click="turnBack(scope.row.detail)"
             v-hasPermi="['business:financialReportTaxNonZero:back']">退回</el-button>
         </template>
-      </el-table-column>
+      </el-table-column> -->
     </el-table>
 
     <!-- 分页 -->

+ 82 - 22
src/views/business/production/financialReportTaxIsZero/FormDialog.vue

@@ -15,7 +15,9 @@
 
               <el-col :span="12">
                 <el-form-item label="所属月份">
-                  <div>{{ year }}-{{ month }}</div>
+                  <!-- <div>{{ year }}-{{ month }}</div> -->
+                  <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+                    @change="changeMonthHandle" />
                 </el-form-item>
               </el-col>
               <el-col :span="24">
@@ -23,7 +25,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="备注">
-                  <el-input v-if="!isView" type="textarea" rows="2" show-word-limit maxlength="200"
+                  <el-input v-if="!isView||emptyForm.status !== 3" type="textarea" rows="2" show-word-limit maxlength="200"
                     v-model="emptyForm.content" />
                   <span v-else>{{ emptyForm.content }}</span>
                 </el-form-item>
@@ -36,7 +38,7 @@
                       v-if="emptyForm.evidenceFile == null || emptyForm.evidenceFile == ''" />
                     <img v-else style="height: 148px; width: 148px" :src="`${baseUrl}/${emptyForm.evidenceFile}`"
                       class="avatar" @click="openEvidience('evidenceFile')" />
-                    <div v-if="!isView">
+                    <div v-if="!isView|| emptyForm.status !== 3">
                       <el-icon :size="20" v-if="emptyForm.evidenceFile !== '' ||emptyForm.evidenceFile == null "
                         @click="emptyForm.evidenceFile = ''" class="delete-button">
                         <Delete />
@@ -82,8 +84,8 @@
               <el-col :span="24" style="padding: 15px 15px 16px 15px">
                 <div class="details-btns-container">
                   <el-form-item label="报表文件" prop="reportFile">
-                    <el-upload v-if="!isView" action="#" :http-request="uploadextFile" :with-credentials="true"
-                      :show-file-list="false" multiple>
+                    <el-upload v-if="!isView|| emptyForm.status !== 3" action="#" :http-request="uploadextFile"
+                      :with-credentials="true" :show-file-list="false" multiple>
                       <el-button size="small" type="primary" icon="Upload">点击上传</el-button>
                     </el-upload>
                   </el-form-item>
@@ -106,7 +108,7 @@
                         </el-link>
                       </template>
                     </el-table-column>
-                    <el-table-column v-if="!isView" label="操作" width="50" align="center">
+                    <el-table-column v-if="!isView|| emptyForm.status !== 3" label="操作" width="50" align="center">
                       <template #default="scope">
                         <el-button size="small" link type="danger" @click="handleDelFile(scope.$index)">删除</el-button>
                       </template>
@@ -118,12 +120,18 @@
           </el-form>
         </div>
       </div>
-      <div class="form-btns-container" v-if="!isView" style="height: 40px">
-        <el-button size="small" icon="close" style="float: right; margin-left: 12px; margin-right: 12px"
-          @click="close">取消
+      <div class="form-btns-container" style="height: 40px">
+        <el-button size="small" icon="close" v-if="!isView || emptyForm.status !== 3"
+          style="float: right; margin-left: 12px; margin-right: 12px" @click="close">取消
         </el-button>
-        <el-button size="small" type="primary" style="float: right" icon="Finished" @click="handleSave">
+        <el-button size="small" type="primary" v-if="!isView || emptyForm.status !== 3" style="float: right"
+          icon="Finished" @click="handleSave">
           保存</el-button>
+        <el-button v-if="!stopUseBack" type="warning" icon="back" size="small" style="float: right;"
+          :disabled="emptyForm == null || emptyForm.status !== 3 " @click="turnBack(emptyForm)"
+          v-hasPermi="['business:financialReportTax:back']">
+          退回
+        </el-button>
       </div>
     </div>
   </el-dialog>
@@ -192,18 +200,20 @@
   import {
     saveDetail,
     updateTax,
-    getTax,
+    getTax, deductionTurnBack
   } from "@/api/business/production/taxIsZero";
   import { uploadFile } from "@/api/tool/file";
   // import { de } from "element-plus/es/locale";
   import { ref } from "vue";
   import dragUpload from "@/components/dragUpload"
   const baseUrl = import.meta.env.VITE_APP_BASE_API;
-
+  const currentMonth = ref(
+    proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+  );
   const { form, rules } = toRefs(data);
-
+  const parentId = ref(null);
   const followQuery = ref({});
-
+  const stopUseBack = ref(false);
   /***********************  表单页方法 ****************************/
 
   /** 抽屉打开 */
@@ -213,7 +223,9 @@
     mainInfo.value = mainRow;
     monthInfo.value = monthItem;
     tenantId.value = mainRow.tenantId;
+    parentId.value = id
     console.log("打开form", mainRow);
+    currentMonth.value = proxy.moment().subtract(1, "month").format("YYYY-MM-01")
     if (id == 0) {
       isAdd.value = true;
       console.log("新增");
@@ -228,26 +240,75 @@
       isView.value = false;
       isAdd.value = false;
     }
-
+    console.log(isView.value,2323);
     getTaxId(mainRow, id);
   }
 
   function getTaxId(mainRow, id) {
+    loading.value = true
     console.log("获取", mainRow);
     if (mainRow.detail != null) {
-      getTax(mainRow.detail.id).then((res) => {
+      getTax(mainInfo.value.id, monthInfo.value.year, monthInfo.value.month).then((res) => {
         if (res.code === 200) {
           console.log("查询成功");
           emptyForm.value = res.data;
           reportFiles.value = emptyForm.value.reportFiles;
           loadData(id);
         }
+      }).finally(() =>{
+        loading.value = false
       });
     } else {
       loadData(id);
     }
   }
 
+
+  function changeMonthHandle(parentId) {
+    isView.value = true
+    const nowDate = ref(
+      proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
+    if (nowyear + nowmonth == year + month) {
+      isView.value = false
+      stopUseBack.value = false
+    } else {
+        stopUseBack.value = true
+    }
+    getTax(mainInfo.value.id, year, month).then((res) => {
+      if (res.code === 200) {
+        console.log("查询成功");
+        emptyForm.value = res.data;
+        reportFiles.value = emptyForm.value.reportFiles;
+        loadData(parentId);
+      }
+    });
+  }
+
+
+
+  /** 退回按钮操作 */
+  function turnBack(detail) {
+    loading.value = true
+    emptyForm.value.status = 1;
+    emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
+    deductionTurnBack( emptyForm.value)
+      .then((res) => {
+        getList.value();
+      })
+      .catch((err) => {
+        proxy.$modal.$modalMsgError(err);
+        getList.value();
+      });
+    getList.value();
+    loading.value = false;
+    visible.value = false;
+  }
   function openEvidience() {
     window.open(`${baseUrl}${emptyForm.value.evidenceFile}`);
   }
@@ -314,11 +375,8 @@
     }
 
     emptyForm.value.files = files.value;
-    emptyForm.value.year = year.value;
-    emptyForm.value.month = month.value;
-
-    console.log("monthInfo", monthInfo.value);
-    console.log("month", month.value);
+    emptyForm.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    emptyForm.value.month = proxy.moment(currentMonth.value).format("MM");
     emptyForm.value.status = 3;
     console.log("保存", emptyForm.value);
     loading.value = true
@@ -413,8 +471,10 @@
 
   /** 关闭 */
   function close() {
-    visible.value = false;
+    visible.value = true;
     reset();
+    getList.value();
+    visible.value = false;
   }
 
   function openEvidenceFile() {

+ 2 - 2
src/views/business/production/financialReportTaxIsZero/index.vue

@@ -226,7 +226,7 @@
         </template>
       </el-table-column>
       <el-table-column label="执行人" align="center" prop="serviceName" />
-      <el-table-column
+      <!-- <el-table-column
         label="操作"
         align="center"
         class-name="small-padding fixed-width"
@@ -244,7 +244,7 @@
             >退回</el-button
           >
         </template>
-      </el-table-column>
+      </el-table-column> -->
     </el-table>
 
     <!-- 分页 -->

+ 532 - 625
src/views/business/socialSecurity/declare/form.vue

@@ -1,225 +1,161 @@
 <template>
-  <el-dialog
-    title="社保申报信息"
-    v-model="visible"
-    :width="width"
-    append-to-body
-    draggable
-    @close="close"
-    :close-on-click-modal = "false"
-  >
+  <el-dialog title="社保申报信息" v-model="visible" :width="width" append-to-body draggable @close="close"
+    :close-on-click-modal="false">
     <!-- <div slot="title" class="dialog-title-container">
       <span class="title-label"><i class="el-icon-document" /> 工资信息</span>
       <i class="el-icon-close" @click="close" />
     </div> -->
     <!-- 功能按钮 -->
-    <div style="padding: 8px 24px 16px 24px">
-      <el-form size="small" label-width="100px" v-model="form">
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="客户名称">
-              <div>{{ form.companyName }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="所属月份">
-              <div>{{ form.year }}-{{ form.month }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col v-if="form.status === 4" :span="12">
-            <el-form-item label="驳回原因">
-              <div>{{ form.feedbackContent }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="政务网账号" required class="edit-label">
-              <template #label>
-                <div>政务网账号</div>
-              </template>
-              <div>{{ form.governmentAccountNo }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="政务网密码" required class="edit-label">
-              <template #label>
-                <div>政务网密码</div>
-              </template>
-              <div>{{ form.governmentPassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="社保账号" required class="edit-label">
-              <template #label>
-                <div>社保账号</div>
-              </template>
-              <div>{{ form.socialSecurityAccountNo }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="社保密码" required class="edit-label">
-              <template #label>
-                <div>社保密码</div>
-              </template>
-              <div>{{ form.socialSecurityPassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="用工密码" required class="edit-label">
-              <template #label>
-                <div>用工密码</div>
-              </template>
-              <div>{{ form.employeePassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-divider />
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位养老金:">
-              <el-input-number
-                v-model="form.unitPension"
-                size="small"
-                placeholder="单位养老金"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位医疗险:">
-              <el-input-number
-                v-model="form.unitMedical"
-                size="small"
-                placeholder="单位医疗险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位工伤险:">
-              <el-input-number
-                v-model="form.unitInjury"
-                size="small"
-                placeholder="单位工伤险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位失业金:">
-              <el-input-number
-                v-model="form.unitUnemployment"
-                size="small"
-                placeholder="单位失业金"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位生育险:">
-              <el-input-number
-                v-model="form.unitProcreate"
-                size="small"
-                placeholder="单位生育险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位大病险:">
-              <el-input-number
-                v-model="form.unitSeriousIllness"
-                size="small"
-                placeholder="单位大病险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位采暖费:">
-              <el-input-number
-                v-model="form.unitHeatingFee"
-                size="small"
-                placeholder="单位大病险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人养老金:">
-              <el-input-number
-                v-model="form.individualPension"
-                size="small"
-                placeholder="个人养老金"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人医疗险:">
-              <el-input-number
-                v-model="form.individualMedical"
-                size="small"
-                placeholder="个人医疗险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人失业金:">
-              <el-input-number
-                v-model="form.individualUnemployment"
-                size="small"
-                placeholder="个人失业金"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人大病险:">
-              <el-input-number
-                v-model="form.individualSeriousIllness"
-                size="small"
-                placeholder="个人大病险"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                @change="amountChangeHandler"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="合计:">
-              <!-- <el-input-number
+    <div v-loading="loading">
+      <div style="padding: 8px 24px 16px 24px">
+        <el-form size="small" label-width="100px" v-model="form">
+          <el-row :gutter="30">
+            <el-col :span="12">
+              <el-form-item label="客户名称">
+                <div>{{ form.companyName }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="所属月份">
+                <!-- <div>{{ form.year }}-{{ form.month }}</div> -->
+                <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+                  @change="changeMonthHandle" />
+              </el-form-item>
+            </el-col>
+            <el-col v-if="form.status === 4" :span="12">
+              <el-form-item label="驳回原因">
+                <div>{{ form.feedbackContent }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="政务网账号" required class="edit-label">
+                <template #label>
+                  <div>政务网账号</div>
+                </template>
+                <div>{{ form.governmentAccountNo }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="政务网密码" required class="edit-label">
+                <template #label>
+                  <div>政务网密码</div>
+                </template>
+                <div>{{ form.governmentPassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="社保账号" required class="edit-label">
+                <template #label>
+                  <div>社保账号</div>
+                </template>
+                <div>{{ form.socialSecurityAccountNo }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="社保密码" required class="edit-label">
+                <template #label>
+                  <div>社保密码</div>
+                </template>
+                <div>{{ form.socialSecurityPassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="用工密码" required class="edit-label">
+                <template #label>
+                  <div>用工密码</div>
+                </template>
+                <div>{{ form.employeePassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider />
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位养老金:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitPension" size="small" placeholder="单位养老金"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitPension) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位医疗险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitMedical" size="small" placeholder="单位医疗险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitMedical) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位工伤险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitInjury" size="small" placeholder="单位工伤险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitInjury) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位失业金:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitUnemployment" size="small"
+                  placeholder="单位失业金" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitUnemployment) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位生育险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitProcreate" size="small" placeholder="单位生育险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitProcreate) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位大病险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitSeriousIllness" size="small"
+                  placeholder="单位大病险" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitSeriousIllness) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位采暖费:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitHeatingFee" size="small" placeholder="单位大病险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitHeatingFee) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人养老金:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualPension" size="small"
+                  placeholder="个人养老金" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualPension) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人医疗险:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualMedical" size="small"
+                  placeholder="个人医疗险" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualMedical) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人失业金:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualUnemployment" size="small"
+                  placeholder="个人失业金" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualUnemployment) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人大病险:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualSeriousIllness" size="small"
+                  placeholder="个人大病险" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualSeriousIllness) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="合计:">
+                <!-- <el-input-number
                 v-model="form.amount"
                 size="small"
                 placeholder="合计"
@@ -227,460 +163,431 @@
                 :controls="false"
                 style="width: 100%"
               /> -->
-              {{ rowNum(form.amount) }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-divider />
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="备注">
-              <el-input
-                v-model.trim="form.content"
-                maxlength="200"
-                show-word-limit
-                type="textarea"
-                rows="2"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="凭证" required>
-              <el-upload
-                action="#"
-                :http-request="upload"
-                :with-credentials="true"
-                :show-file-list="false"
-                multiple
-              >
-                <el-button size="small" type="primary" icon="Upload"
-                  >点击上传</el-button
-                >
-              </el-upload>
-              <el-table
-                ref="dbTable"
-                :data="form.evidenceFiles"
-                size="small"
-                border
-                header-row-class-name="list-header-row"
-                row-class-name="list-row"
-              >
-                <el-table-column
-                  label="文件名"
-                  prop="originalFileName"
-                  align="center"
-                  show-overflow-tooltip
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      type="text"
-                      @click="openFile(scope.row)"
-                      >{{
+                {{ rowNum(form.amount) }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider />
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="备注">
+                <el-input v-model.trim="form.content" v-if="form.status !==3" maxlength="200" show-word-limit
+                  type="textarea" rows="2" />
+                <div v-else>{{form.content}}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="凭证" required>
+                <el-upload action="#" :http-request="upload" :with-credentials="true" :show-file-list="false" multiple>
+                  <el-button size="small" type="primary" icon="Upload" v-if="form.status !==3">点击上传</el-button>
+                </el-upload>
+                <el-table ref="dbTable" :data="form.evidenceFiles" size="small" border
+                  header-row-class-name="list-header-row" row-class-name="list-row">
+                  <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
+                    <template #default="scope">
+                      <el-button size="small" type="text" @click="openFile(scope.row)">{{
                         scope.row.originalFileName == ""
-                          ? "打开文件"
-                          : scope.row.originalFileName
-                      }}</el-button
-                    >
-                  </template>
-                </el-table-column>
-                <!-- <el-table-column
+                        ? "打开文件"
+                        : scope.row.originalFileName
+                        }}</el-button>
+                    </template>
+                  </el-table-column>
+                  <!-- <el-table-column
                   label="文件类型"
                   width="80"
                   prop="fileType"
                   align="center"
                 /> -->
-                <el-table-column
-                  label="操作"
-                  width="80"
-                  prop="fileType"
-                  align="center"
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      link
-                      type="danger"
-                      @click="handlerEportFilesDel(scope.row, scope.$index)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="报表" >
-              <el-upload
-                action="#"
-                :http-request="uploadStatement"
-                :with-credentials="true"
-                :show-file-list="false"
-                multiple
-              >
-                <el-button size="small" type="primary" icon="Upload"
-                  >点击上传</el-button
-                >
-              </el-upload>
-              <el-table
-                ref="dbTable"
-                :data="form.reportFiles"
-                size="small"
-                border
-                header-row-class-name="list-header-row"
-                row-class-name="list-row"
-              >
-                <el-table-column
-                  label="文件名"
-                  prop="originalFileName"
-                  align="center"
-                  show-overflow-tooltip
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      type="text"
-                      @click="openFile(scope.row)"
-                      >{{
+                  <el-table-column label="操作" width="80" prop="fileType" align="center">
+                    <template #default="scope">
+                      <el-button size="small" link type="danger" v-if=" form.status !== 3"
+                        @click="handlerEportFilesDel(scope.row, scope.$index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="报表">
+                <el-upload action="#" :http-request="uploadStatement" :with-credentials="true" :show-file-list="false"
+                  multiple>
+                  <el-button size="small" type="primary" icon="Upload" v-if="form.status !==3">点击上传</el-button>
+                </el-upload>
+                <el-table ref="dbTable" :data="form.reportFiles" size="small" border
+                  header-row-class-name="list-header-row" row-class-name="list-row">
+                  <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
+                    <template #default="scope">
+                      <el-button size="small" type="text" @click="openFile(scope.row)">{{
                         scope.row.originalFileName == ""
-                          ? "打开文件"
-                          : scope.row.originalFileName
-                      }}</el-button
-                    >
-                  </template>
-                </el-table-column>
+                        ? "打开文件"
+                        : scope.row.originalFileName
+                        }}</el-button>
+                    </template>
+                  </el-table-column>
 
-                <el-table-column
-                  label="操作"
-                  width="80"
-                  prop="fileType"
-                  align="center"
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      link
-                      type="danger"
-                      @click="handleDel(scope.row, scope.$index)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-    </div>
-    <div class="form-btns-container" style="height: 40px">
-      <el-button
-        size="small"
-        icon="close"
-        style="float: right; margin-left: 12px; margin-right: 12px"
-        @click="close"
-      >
-        取消</el-button
-      >
-      <el-button
-        type="primary"
-        size="small"
-        icon="Finished"
-        style="float: right"
-        @click="handleSave"
-      >
-        保存</el-button
-      >
+                  <el-table-column label="操作" width="80" prop="fileType" align="center">
+                    <template #default="scope">
+                      <el-button size="small" link type="danger" v-if=" form.status !== 3"
+                        @click="handleDel(scope.row, scope.$index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <div class="form-btns-container" style="height: 40px">
+        <el-button size="small" v-if="form.status !== 3" icon="close"
+          style="float: right; margin-left: 12px; margin-right: 12px" @click="close">
+          取消</el-button>
+        <el-button type="primary" v-if="form.status !== 3" size="small" icon="Finished" style="float: right"
+          @click="handleSave">
+          保存</el-button>
+        <el-button v-hasPermi="['business:socialSecurityDeclare:edit']" style="float: right;" v-if="!stopUseBack"
+          icon="back" size="small" type="warning" :disabled="
+      form == null || form.status !== 3
+    " @click="turnBack(form)">退回</el-button>
+      </div>
     </div>
     <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
   </el-dialog>
 </template>
 <script setup>
-import {
-  getDetail,
-  saveDetail,
-} from "@/api/business/production/socialSecurityDeclare";
-import { uploadFile } from "@/api/tool/file";
-import { rowNum } from "@/utils/index";
-import { ref } from "vue";
-const { proxy } = getCurrentInstance();
-const visible = ref(false);
-const width = ref(800);
-const selections = ref([]);
-const currentSource = ref(null);
-const editStatus = ref(false);
-const canSave = ref(false);
-const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
-const props = defineProps({
-  getList: {
-    type: Function,
-    default: () => {},
-  },
-});
+  import {
+    getDetail,
+    saveDetail, turnBackDetail
+  } from "@/api/business/production/socialSecurityDeclare";
+  import { uploadFile } from "@/api/tool/file";
+  import { rowNum } from "@/utils/index";
+  import { ref } from "vue";
+  const { proxy } = getCurrentInstance();
+  const visible = ref(false);
+  const width = ref(800);
+  const selections = ref([]);
+  const currentSource = ref(null);
+  const editStatus = ref(false);
+  const canSave = ref(false);
+  const loading = ref(false);
+  const stopUseBack = ref(false);
+  const currentMonth = ref(
+    proxy.moment().format("YYYY-MM-01")
+  );
+  const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => { },
+    },
+  });
 
-const { getList } = toRefs(props);
-const total = ref(0);
+  const { getList } = toRefs(props);
+  const total = ref(0);
 
-const employeeEmptyData = {
-  id: null,
-  title: "",
-  remark: "",
-  employeeName: "",
-  departmentName: "",
-  idCardImage: "",
-  idCardImageBack: "",
-  idiograph: "",
-  details: [],
-  editStatus: true,
-};
+  const employeeEmptyData = {
+    id: null,
+    title: "",
+    remark: "",
+    employeeName: "",
+    departmentName: "",
+    idCardImage: "",
+    idCardImageBack: "",
+    idiograph: "",
+    details: [],
+    editStatus: true,
+  };
 
-const form = ref({});
+  const form = ref({});
 
-const emptyForm = {
-  details: [],
-};
+  const emptyForm = {
+    details: [],
+  };
 
-function open(detail) {
-  visible.value = true;
-  form.value = detail;
-  console.log(detail);
-  loadData();
-}
+  function open(detail) {
+    visible.value = true;
+    currentMonth.value = proxy.moment().format("YYYY-MM-01")
+    form.value = detail;
+    console.log(detail);
+    loadData();
+  }
 
-function loadData() {
-  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();
+  function loadData() {
+    loading.value = true;
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    const { year, month, socialSecurityDeclareId, companyId } = form.value
+    const clearForm = { year, month, socialSecurityDeclareId, companyId }
+    getDetail(clearForm).then((res) => {
+      form.value = { ...proxy.deepClone(emptyForm), ...res.data };
+      // if (form.value.status === 2 || form.value.status === 3) {
+      //   proxy.$modal.msgError("该信息已提交待审核");
+      //   close();
+      // }
+      amountChangeHandler();
+    }).finally(() => {
+      loading.value = false;
+    });
+  }
+  function changeMonthHandle() {
+    // isView.value = true
+    const nowDate = ref(
+      proxy.moment().format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
+    if (nowyear + nowmonth == year + month) {
+      // isView.value = false
+      stopUseBack.value = false
+    } else {
+      stopUseBack.value = true
     }
-    amountChangeHandler();
-  });
-}
+    loadData()
+  }
+  function close() {
+    visible.value = false;
+    reset();
+  }
 
-function close() {
-  visible.value = false;
-  reset();
-}
+  function reset() {
+    form.value = proxy.deepClone(emptyForm);
+    canSave.value = false;
+  }
 
-function reset() {
-  form.value = proxy.deepClone(emptyForm);
-  canSave.value = false;
-}
+  function handleCurrentChange(row) {
+    currentSource.value = row;
+  }
+  function turnBack(detail) {
+    loading.value = true
+    form.value.status = 1;
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    turnBackDetail(form.value)
+      .then((res) => {
+        getList.value();
 
-function handleCurrentChange(row) {
-  currentSource.value = row;
-}
+      })
+      .catch((err) => {
+        proxy.$modal.msgError(err.message);
+      }).finally(() => {
+        loading.value = false
+        visible.value = false;
+      });
+  }
 
-function handleCheckChange(selection) {
-  selections.value = selection.map((item) => item);
-}
+  function handleCheckChange(selection) {
+    selections.value = selection.map((item) => item);
+  }
 
-function handleSave() {
-  if (form.value.isFirstSocialSecurity === 0) {
-    if (!form.value.governmentAccountNo) {
-      proxy.$modal.msgError("请输入政务网账号");
-      return;
+  function handleSave() {
+    if (form.value.isFirstSocialSecurity === 0) {
+      if (!form.value.governmentAccountNo) {
+        proxy.$modal.msgError("请输入政务网账号");
+        return;
+      }
+      if (!form.value.governmentPassword) {
+        proxy.$modal.msgError("请输入政务网密码");
+        return;
+      }
+      if (!passwordCheck(form.value.governmentPassword)) {
+        proxy.$modal.msgError("请输入正确的政务网密码");
+        return;
+      }
+      if (!form.value.socialSecurityAccountNo) {
+        proxy.$modal.msgError("请输入社保账号");
+        return;
+      }
+      if (!form.value.socialSecurityPassword) {
+        proxy.$modal.msgError("请输入社保密码");
+        return;
+      }
+      if (!passwordCheck(form.value.socialSecurityPassword)) {
+        proxy.$modal.msgError("请输入正确的社保密码");
+        return;
+      }
+      if (!form.value.employeePassword) {
+        proxy.$modal.msgError("请输入用工密码");
+        return;
+      }
+      if (!passwordCheck(form.value.employeePassword)) {
+        proxy.$modal.msgError("请输入正确的用工密码");
+        return;
+      }
     }
-    if (!form.value.governmentPassword) {
-      proxy.$modal.msgError("请输入政务网密码");
+    if (
+      form.value.evidenceFiles == null ||
+      form.value.evidenceFiles.length === 0
+    ) {
+      proxy.$modal.msgError("请上传凭证");
       return;
     }
-    if (!passwordCheck(form.value.governmentPassword)) {
-      proxy.$modal.msgError("请输入正确的政务网密码");
-      return;
-    }
-    if (!form.value.socialSecurityAccountNo) {
-      proxy.$modal.msgError("请输入社保账号");
-      return;
-    }
-    if (!form.value.socialSecurityPassword) {
-      proxy.$modal.msgError("请输入社保密码");
-      return;
-    }
-    if (!passwordCheck(form.value.socialSecurityPassword)) {
-      proxy.$modal.msgError("请输入正确的社保密码");
-      return;
-    }
-    if (!form.value.employeePassword) {
-      proxy.$modal.msgError("请输入用工密码");
-      return;
-    }
-    if (!passwordCheck(form.value.employeePassword)) {
-      proxy.$modal.msgError("请输入正确的用工密码");
-      return;
-    }
-  }
-  if (
-    form.value.evidenceFiles == null ||
-    form.value.evidenceFiles.length === 0
-  ) {
-    proxy.$modal.msgError("请上传凭证");
-    return;
-  }
-  // if (form.value.reportFiles == null || form.value.reportFiles.length === 0) {
-  //   proxy.$modal.msgError("请上传报表");
-  //   return;
-  // }
+    // if (form.value.reportFiles == null || form.value.reportFiles.length === 0) {
+    //   proxy.$modal.msgError("请上传报表");
+    //   return;
+    // }
 
-  proxy.$modal
-    .confirm("确认保存么?")
-    .then(() => {
-      const saveValue = proxy.deepClone(form.value);
-      saveValue.status = 3;
-      saveDetail(saveValue).then((res) => {
-        proxy.$modal.msgSuccess("保存成功");
-        reset();
-        close();
-        getList.value();
+    proxy.$modal
+      .confirm("确认保存么?")
+      .then(() => {
+        const saveValue = proxy.deepClone(form.value);
+        saveValue.status = 3;
+        saveValue.year = proxy.moment(currentMonth.value).format("YYYY");
+        saveValue.month = proxy.moment(currentMonth.value).format("MM");
+        saveDetail(saveValue).then((res) => {
+          proxy.$modal.msgSuccess("保存成功");
+          reset();
+          close();
+          getList.value();
+        });
+      })
+      .catch((err) => {
+        proxy.$modal.msg("取消保存");
       });
-    })
-    .catch((err) => {
-      proxy.$modal.msg("取消保存");
-    });
-}
-
-function passwordCheckHandler(value, field) {
-  // console.log(value)
-  if (!passwordCheck(form.value[field])) {
-    proxy.$modal.msgError("请输入正确密码");
   }
-}
 
-function passwordCheck(value) {
-  const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
-  if (!pattern.test(value)) {
-    return false;
+  function passwordCheckHandler(value, field) {
+    // console.log(value)
+    if (!passwordCheck(form.value[field])) {
+      proxy.$modal.msgError("请输入正确密码");
+    }
   }
-  return true;
-}
 
-function upload(param) {
-  const formData = new FormData();
-  formData.append("file", param.file);
-  uploadFile(formData).then((res) => {
-    if (res.code === 200) {
-      const file = {};
-      file.fileName = res.newFileName;
-      file.url = res.url;
-      file.fileType =
-        res.newFileName.split(".")[res.newFileName.split(".").length - 1];
-      file.originalFileName = res.originalFilename;
-      file.fileUrl = res.fileName;
-      form.value.evidenceFiles.push(file);
+  function passwordCheck(value) {
+    const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
+    if (!pattern.test(value)) {
+      return false;
     }
-  });
-}
+    return true;
+  }
 
-function uploadStatement(param) {
-  const formData = new FormData();
-  formData.append("file", param.file);
-  uploadFile(formData).then((res) => {
-    if (res.code === 200) {
-      const file = {};
-      file.fileName = res.newFileName;
-      file.url = res.url;
-      file.fileType =
-        res.newFileName.split(".")[res.newFileName.split(".").length - 1];
-      file.originalFileName = res.originalFilename;
-      file.fileUrl = res.fileName;
-      form.value.reportFiles.push(file);
-    }
-  });
-}
+  function upload(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.url = res.url;
+        file.fileType =
+          res.newFileName.split(".")[res.newFileName.split(".").length - 1];
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        form.value.evidenceFiles.push(file);
+      }
+    });
+  }
 
-function openFile(row) {
-  window.open(`${baseUrl.value}${row.fileUrl}`);
-}
+  function uploadStatement(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.url = res.url;
+        file.fileType =
+          res.newFileName.split(".")[res.newFileName.split(".").length - 1];
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        form.value.reportFiles.push(file);
+      }
+    });
+  }
 
-function changeEdit() {
-  editStatus.value = !editStatus.value;
-}
+  function openFile(row) {
+    window.open(`${baseUrl.value}${row.fileUrl}`);
+  }
 
-function amountChangeHandler() {
-  let amount = 0;
-  amount += form.value.unitInjury == null ? 0 : form.value.unitInjury;
-  amount += form.value.unitMedical == null ? 0 : form.value.unitMedical;
-  amount += form.value.unitPension == null ? 0 : form.value.unitPension;
-  amount += form.value.unitProcreate == null ? 0 : form.value.unitProcreate;
-  amount +=
-    form.value.unitSeriousIllness == null ? 0 : form.value.unitSeriousIllness;
-  amount +=
-    form.value.unitUnemployment == null ? 0 : form.value.unitUnemployment;
-  amount +=
-    form.value.individualMedical == null ? 0 : form.value.individualMedical;
-  amount +=
-    form.value.individualPension == null ? 0 : form.value.individualPension;
-  amount +=
-    form.value.individualSeriousIllness == null
-      ? 0
-      : form.value.individualSeriousIllness;
-  amount +=
-    form.value.individualUnemployment == null
-      ? 0
-      : form.value.individualUnemployment;
-  amount += form.value.unitHeatingFee == null ? 0 : form.value.unitHeatingFee;
-  form.value.amount = amount;
-  canSave.value =
-    form.value.unitInjury !== undefined &&
-    form.value.unitMedical !== undefined &&
-    form.value.unitPension !== undefined &&
-    form.value.unitProcreate !== undefined &&
-    form.value.unitSeriousIllness !== undefined &&
-    form.value.unitUnemployment !== undefined &&
-    form.value.individualMedical !== undefined &&
-    form.value.individualPension !== undefined &&
-    form.value.individualSeriousIllness !== undefined &&
-    form.value.individualUnemployment !== undefined &&
-    form.value.unitHeatingFee !== undefined;
-}
+  function changeEdit() {
+    editStatus.value = !editStatus.value;
+  }
 
-function handlerEportFilesDel(row, index) {
-  proxy.$modal
-    .confirm("确定删除吗?")
-    .then((_) => {
-      form.value.evidenceFiles.splice(index, 1);
-    })
-    .catch((_) => {
-      proxy.$modal.msg("已取消删除");
-    });
-}
+  function amountChangeHandler() {
+    let amount = 0;
+    amount += form.value.unitInjury == null ? 0 : form.value.unitInjury;
+    amount += form.value.unitMedical == null ? 0 : form.value.unitMedical;
+    amount += form.value.unitPension == null ? 0 : form.value.unitPension;
+    amount += form.value.unitProcreate == null ? 0 : form.value.unitProcreate;
+    amount +=
+      form.value.unitSeriousIllness == null ? 0 : form.value.unitSeriousIllness;
+    amount +=
+      form.value.unitUnemployment == null ? 0 : form.value.unitUnemployment;
+    amount +=
+      form.value.individualMedical == null ? 0 : form.value.individualMedical;
+    amount +=
+      form.value.individualPension == null ? 0 : form.value.individualPension;
+    amount +=
+      form.value.individualSeriousIllness == null
+        ? 0
+        : form.value.individualSeriousIllness;
+    amount +=
+      form.value.individualUnemployment == null
+        ? 0
+        : form.value.individualUnemployment;
+    amount += form.value.unitHeatingFee == null ? 0 : form.value.unitHeatingFee;
+    form.value.amount = amount;
+    canSave.value =
+      form.value.unitInjury !== undefined &&
+      form.value.unitMedical !== undefined &&
+      form.value.unitPension !== undefined &&
+      form.value.unitProcreate !== undefined &&
+      form.value.unitSeriousIllness !== undefined &&
+      form.value.unitUnemployment !== undefined &&
+      form.value.individualMedical !== undefined &&
+      form.value.individualPension !== undefined &&
+      form.value.individualSeriousIllness !== undefined &&
+      form.value.individualUnemployment !== undefined &&
+      form.value.unitHeatingFee !== undefined;
+  }
 
-function handleDel(row, index) {
-  proxy.$modal
-    .confirm("确定删除吗?")
-    .then((_) => {
-      form.value.reportFiles.splice(index, 1);
-    })
-    .catch((_) => {
-      proxy.$modal.msg("已取消删除");
-    });
-}
+  function handlerEportFilesDel(row, index) {
+    proxy.$modal
+      .confirm("确定删除吗?")
+      .then((_) => {
+        form.value.evidenceFiles.splice(index, 1);
+      })
+      .catch((_) => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
 
-// 暴露给父组件的方法
-defineExpose({
-  open,
-});
+  function handleDel(row, index) {
+    proxy.$modal
+      .confirm("确定删除吗?")
+      .then((_) => {
+        form.value.reportFiles.splice(index, 1);
+      })
+      .catch((_) => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
+
+  // 暴露给父组件的方法
+  defineExpose({
+    open,
+  });
 </script>
 <style scoped>
-.img {
-  width: 23px;
-  height: 23px;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-}
+  .img {
+    width: 23px;
+    height: 23px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
 
-::v-deep(.el-upload) {
-  display: flex;
-  text-align: center;
-  justify-content: center;
-  cursor: pointer;
-  outline: 0;
-}
+  ::v-deep(.el-upload) {
+    display: flex;
+    text-align: center;
+    justify-content: center;
+    cursor: pointer;
+    outline: 0;
+  }
 
-.required::after {
-  content: "*";
-  color: red;
-}
+  .required::after {
+    content: "*";
+    color: red;
+  }
 </style>

+ 2 - 2
src/views/business/socialSecurity/declare/index.vue

@@ -124,13 +124,13 @@
         </template>
       </el-table-column>
       <el-table-column label="执行人" width="80" align="center" prop="serviceName" />
-      <el-table-column label="操作" width="80" align="center" prop="">
+      <!-- <el-table-column label="操作" width="80" align="center" prop="">
         <template #default="scope">
           <el-button v-hasPermi="['business:socialSecurityDeclare:edit']" size="small" type="primary" link :disabled="
               scope.row.detail == null || scope.row.detail.status !== 3
             " @click="turnBack(scope.row.detail)">退回</el-button>
         </template>
-      </el-table-column>
+      </el-table-column> -->
     </el-table>
     <!-- 分页 -->
     <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"

+ 523 - 448
src/views/business/socialSecurity/declare/view.vue

@@ -1,492 +1,567 @@
 <template>
-  <el-dialog
-    title="社保申报信息"
-    v-model="visible"
-    :width="width"
-    append-to-body
-    draggable
-    @close="close"
-    :close-on-click-modal = "false"
-  >
-    <!-- <div slot="title" class="dialog-title-container">
+  <el-dialog title="社保申报信息" v-model="visible" :width="width" append-to-body draggable @close="close"
+    :close-on-click-modal="false">
+    <div v-loading="loading">
+      <!-- <div slot="title" class="dialog-title-container">
       <span class="title-label"><i class="el-icon-document" /> 工资信息</span>
       <i class="el-icon-close" @click="close" />
     </div> -->
-    <!-- 功能按钮 -->
-    <div style="padding: 8px 24px 16px 24px">
-      <el-form size="small" label-width="100px" v-model="form">
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="客户名称">
-              <div>{{ form.companyName }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="所属月份">
-              <div>{{ form.year }}-{{ form.month }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="政务网账号" required class="edit-label">
-              <template #label>
-                <div>政务网账号</div>
-              </template>
-              <div>{{ form.governmentAccountNo }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="政务网密码" required class="edit-label">
-              <template #label>
-                <div>政务网密码</div>
-              </template>
-              <div>{{ form.governmentPassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="社保账号" required class="edit-label">
-              <template #label>
-                <div>社保账号</div>
-              </template>
-              <div>{{ form.socialSecurityAccountNo }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="社保密码" required class="edit-label">
-              <template #label>
-                <div>社保密码</div>
-              </template>
-              <div>{{ form.socialSecurityPassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="用工密码" required class="edit-label">
-              <template #label>
-                <div>用工密码</div>
-              </template>
-              <div>{{ form.employeePassword }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-divider />
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位养老金:">
-              <div>{{ rowNum(form.unitPension) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位医疗险:">
-              <div>{{ rowNum(form.unitMedical) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位工伤险:">
-              <div>{{ rowNum(form.unitInjury) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位失业金:">
-              <!-- <el-input-number v-model="form.unitUnemployment" size="small" placeholder="单位失业金" :precision="2" :controls="false" style="width: 100%;" /> -->
-              <div>{{ rowNum(form.unitUnemployment) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位生育险:">
-              <div>{{ rowNum(form.unitProcreate) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位大病险:">
-              <div>{{ rowNum(form.unitSeriousIllness) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="单位采暖费:">
-              <div>{{ rowNum(form.unitHeatingFee) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人养老金:">
-              <div>{{ rowNum(form.individualPension) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人医疗险:">
-              <div>{{ rowNum(form.individualMedical) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人失业金:">
-              <div>{{ rowNum(form.individualUnemployment) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="个人大病险:">
-              <div>{{ rowNum(form.individualSeriousIllness) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="合计:">
-              <div>{{ rowNum(form.amount) }}</div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-divider />
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="备注:">
-              <span> {{ form.content }}</span>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="凭证" required>
-              <el-table
-                ref="dbTable"
-                :data="form.evidenceFiles"
-                size="small"
-                border
-                header-row-class-name="list-header-row"
-                row-class-name="list-row"
-              >
-                <el-table-column
-                  label="文件名"
-                  prop="originalFileName"
-                  align="center"
-                  show-overflow-tooltip
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      type="text"
-                      @click="openFile(scope.row)"
-                      >{{
+      <!-- 功能按钮 -->
+      <div style="padding: 8px 24px 16px 24px">
+        <el-form size="small" label-width="100px" v-model="form">
+          <el-row :gutter="30">
+            <el-col :span="12">
+              <el-form-item label="客户名称">
+                <div>{{ form.companyName }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="所属月份">
+                <!-- <div>{{ form.year }}-{{ form.month }}</div> -->
+                <el-date-picker v-model="currentMonth" type="month" placeholder="请选择时间" format="YYYY-MM"
+                  @change="changeMonthHandle" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="政务网账号" required class="edit-label">
+                <template #label>
+                  <div>政务网账号</div>
+                </template>
+                <div>{{ form.governmentAccountNo }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="政务网密码" required class="edit-label">
+                <template #label>
+                  <div>政务网密码</div>
+                </template>
+                <div>{{ form.governmentPassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="社保账号" required class="edit-label">
+                <template #label>
+                  <div>社保账号</div>
+                </template>
+                <div>{{ form.socialSecurityAccountNo }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="社保密码" required class="edit-label">
+                <template #label>
+                  <div>社保密码</div>
+                </template>
+                <div>{{ form.socialSecurityPassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="用工密码" required class="edit-label">
+                <template #label>
+                  <div>用工密码</div>
+                </template>
+                <div>{{ form.employeePassword }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider />
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位养老金:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitPension" size="small" placeholder="单位养老金"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitPension) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位医疗险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitMedical" size="small" placeholder="单位医疗险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitMedical) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位工伤险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitInjury" size="small" placeholder="单位工伤险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitInjury) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位失业金:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitUnemployment" size="small"
+                  placeholder="单位失业金" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitUnemployment) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位生育险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitProcreate" size="small" placeholder="单位生育险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitProcreate) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位大病险:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitSeriousIllness" size="small"
+                  placeholder="单位大病险" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitSeriousIllness) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="单位采暖费:">
+                <el-input-number v-if="form.status !==3" v-model="form.unitHeatingFee" size="small" placeholder="单位大病险"
+                  :precision="2" :controls="false" style="width: 100%" @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.unitHeatingFee) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人养老金:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualPension" size="small"
+                  placeholder="个人养老金" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualPension) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人医疗险:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualMedical" size="small"
+                  placeholder="个人医疗险" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualMedical) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人失业金:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualUnemployment" size="small"
+                  placeholder="个人失业金" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualUnemployment) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="个人大病险:">
+                <el-input-number v-if="form.status !==3" v-model="form.individualSeriousIllness" size="small"
+                  placeholder="个人大病险" :precision="2" :controls="false" style="width: 100%"
+                  @change="amountChangeHandler" />
+                <div v-else>{{ rowNum(form.individualSeriousIllness) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="合计:">
+                <div>{{ rowNum(form.amount) }}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider />
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="备注">
+                <el-input v-model.trim="form.content" v-if="form.status !==3" maxlength="200" show-word-limit
+                  type="textarea" rows="2" />
+                <div v-else>{{form.content}}</div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="凭证" required>
+                <el-upload action="#" :http-request="upload" :with-credentials="true" :show-file-list="false" multiple>
+                  <el-button size="small" type="primary" icon="Upload" v-if="form.status !==3">点击上传</el-button>
+                </el-upload>
+                <el-table ref="dbTable" :data="form.evidenceFiles" size="small" border
+                  header-row-class-name="list-header-row" row-class-name="list-row">
+                  <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
+                    <template #default="scope">
+                      <el-button size="small" type="text" @click="openFile(scope.row)">{{
                         scope.row.originalFileName == ""
-                          ? "打开文件"
-                          : scope.row.originalFileName
-                      }}</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="报表" required>
-              <el-table
-                ref="dbTable"
-                :data="form.reportFiles"
-                size="small"
-                border
-                header-row-class-name="list-header-row"
-                row-class-name="list-row"
-              >
-                <el-table-column
-                  label="文件名"
-                  prop="originalFileName"
-                  align="center"
-                  show-overflow-tooltip
-                >
-                  <template #default="scope">
-                    <el-button
-                      size="small"
-                      type="text"
-                      @click="openFile(scope.row)"
-                      >{{
+                        ? "打开文件"
+                        : scope.row.originalFileName
+                        }}</el-button>
+                    </template>
+                  </el-table-column>
+                  <!-- <el-table-column
+                    label="文件类型"
+                    width="80"
+                    prop="fileType"
+                    align="center"
+                  /> -->
+                  <el-table-column label="操作" width="80" prop="fileType" align="center">
+                    <template #default="scope">
+                      <el-button size="small" link type="danger" v-if=" form.status !== 3"
+                        @click="handlerEportFilesDel(scope.row, scope.$index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="报表">
+                <el-upload action="#" :http-request="uploadStatement" :with-credentials="true" :show-file-list="false"
+                  multiple>
+                  <el-button size="small" type="primary" icon="Upload" v-if="form.status !==3">点击上传</el-button>
+                </el-upload>
+                <el-table ref="dbTable" :data="form.reportFiles" size="small" border
+                  header-row-class-name="list-header-row" row-class-name="list-row">
+                  <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
+                    <template #default="scope">
+                      <el-button size="small" type="text" @click="openFile(scope.row)">{{
                         scope.row.originalFileName == ""
-                          ? "打开文件"
-                          : scope.row.originalFileName
-                      }}</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-    </div>
-    <div class="form-btns-container" style="height: 40px">
-      <el-button size="small" style="float: right" icon="close" @click="close">
-        取消</el-button
-      >
+                        ? "打开文件"
+                        : scope.row.originalFileName
+                        }}</el-button>
+                    </template>
+                  </el-table-column>
+
+                  <el-table-column label="操作" width="80" prop="fileType" align="center">
+                    <template #default="scope">
+                      <el-button size="small" link type="danger" v-if=" form.status !== 3"
+                        @click="handleDel(scope.row, scope.$index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <div class="form-btns-container" style="height: 40px">
+        <el-button size="small" v-if="form.status !== 3" icon="close" style="float: right; margin-left: 12px; margin-right: 12px" @click="close">
+          取消</el-button>
+        <el-button type="primary" v-if="form.status !== 3" size="small" icon="Finished" style="float: right" @click="handleSave">
+          保存</el-button>
+        <el-button v-hasPermi="['business:socialSecurityDeclare:edit']" style="float: right;" v-if="!stopUseBack"  icon="back" size="small" type="warning"
+          :disabled="
+        form == null || form.status !== 3
+      " @click="turnBack(form)">退回</el-button>
+      </div>
     </div>
     <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
     <print-dialog ref="printDialog" :parent="this" /> -->
   </el-dialog>
 </template>
 <script setup>
-import {
-  getDetail,
-  saveDetail,
-} from "@/api/business/production/socialSecurityDeclare";
-import { uploadFile } from "@/api/tool/file";
-import { ref } from "vue";
-import { rowNum } from "@/utils/index";
-const { proxy } = getCurrentInstance();
-const visible = ref(false);
-const width = ref(800);
-const selections = ref([]);
-const currentSource = ref(null);
-const editStatus = ref(false);
-const canSave = ref(false);
-const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
-const props = defineProps({
-  getList: {
-    type: Function,
-    default: () => {},
-  },
-});
-
-const { getList } = toRefs(props);
-const total = ref(0);
+  import {
+    getDetail,
+    saveDetail, turnBackDetail
+  } from "@/api/business/production/socialSecurityDeclare";
+  import { uploadFile } from "@/api/tool/file";
+  import { ref } from "vue";
+  import { rowNum } from "@/utils/index";
+  const { proxy } = getCurrentInstance();
+  const visible = ref(false);
+  const width = ref(800);
+  const stopUseBack = ref(false);
+  const selections = ref([]);
+  const currentSource = ref(null);
+  const editStatus = ref(false);
+  const canSave = ref(false);
+  const loading = ref(false);
+  const currentMonth = ref(
+    proxy.moment().format("YYYY-MM-01")
+  );
+  const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => { },
+    },
+  });
 
-const employeeEmptyData = {
-  id: null,
-  title: "",
-  remark: "",
-  employeeName: "",
-  departmentName: "",
-  idCardImage: "",
-  idCardImageBack: "",
-  idiograph: "",
-  details: [],
-  editStatus: true,
-};
+  const { getList } = toRefs(props);
+  const total = ref(0);
 
-const form = ref({});
+  const employeeEmptyData = {
+    id: null,
+    title: "",
+    remark: "",
+    employeeName: "",
+    departmentName: "",
+    idCardImage: "",
+    idCardImageBack: "",
+    idiograph: "",
+    details: [],
+    editStatus: true,
+  };
 
-const emptyForm = {
-  details: [],
-};
+  const form = ref({});
 
-function open(detail) {
-  visible.value = true;
-  form.value = detail;
-  loadData();
-}
+  const emptyForm = {
+    details: [],
+  };
 
-function loadData() {
-  getDetail(form.value).then((res) => {
-    form.value = { ...proxy.deepClone(emptyForm), ...res.data };
-    amountChangeHandler();
-  });
-}
+  function open(detail) {
+    visible.value = true;
+    currentMonth.value = proxy.moment().format("YYYY-MM-01")
+    form.value = detail;
+    loadData();
+  }
 
-function close() {
-  visible.value = false;
-  reset();
-}
+  function loadData() {
+    loading.value = true;
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    const { year, month, socialSecurityDeclareId, companyId } = form.value
+    const clearForm = { year, month, socialSecurityDeclareId, companyId }
+    getDetail(clearForm).then((res) => {
+      form.value = { ...proxy.deepClone(emptyForm), ...res.data };
+      amountChangeHandler();
+    }).finally(() => {
+        loading.value = false;
+    });
+  }
 
-function reset() {
-  form.value = proxy.deepClone(emptyForm);
-  canSave.value = false;
-}
+  function close() {
+    visible.value = false;
+    reset();
+  }
 
-function handleCurrentChange(row) {
-  currentSource.value = row;
-}
+  function reset() {
+    form.value = proxy.deepClone(emptyForm);
+    canSave.value = false;
+  }
+  function changeMonthHandle() {
+    // isView.value = true
+    const nowDate = ref(
+      proxy.moment().format("YYYY-MM-01")
+    );
+    let nowyear = proxy.moment(nowDate.value).format("YYYY");
+    let nowmonth = proxy.moment(nowDate.value).format("MM");
+    const year = proxy.moment(currentMonth.value).format("YYYY");
+    const month = proxy.moment(currentMonth.value).format("MM");
+    if (nowyear + nowmonth == year + month) {
+      // isView.value = false
+      stopUseBack.value = false
+    } else {
+      stopUseBack.value = true
+    }
+    loadData()
+  }
+  function handleCurrentChange(row) {
+    currentSource.value = row;
+  }
 
-function handleCheckChange(selection) {
-  selections.value = selection.map((item) => item);
-}
+  function handleCheckChange(selection) {
+    selections.value = selection.map((item) => item);
+  }
 
-function handleSave() {
-  for (let i = 0; i < form.value.details.length; i++) {
-    const l = form.value.details[i];
-    // 数据校验
-    if (l.employeeName == null || l.employeeName === "") {
-      proxy.$modal.msgError(`第${i + 1}行姓名不能为空`);
-      return;
-    }
-    if (l.phone == null || l.phone === "") {
-      proxy.$modal.msgError(`第${i + 1}行电话不能为空`);
-      return;
+  function handleSave() {
+    if (form.value.isFirstSocialSecurity === 0) {
+      if (!form.value.governmentAccountNo) {
+        proxy.$modal.msgError("请输入政务网账号");
+        return;
+      }
+      if (!form.value.governmentPassword) {
+        proxy.$modal.msgError("请输入政务网密码");
+        return;
+      }
+      if (!passwordCheck(form.value.governmentPassword)) {
+        proxy.$modal.msgError("请输入正确的政务网密码");
+        return;
+      }
+      if (!form.value.socialSecurityAccountNo) {
+        proxy.$modal.msgError("请输入社保账号");
+        return;
+      }
+      if (!form.value.socialSecurityPassword) {
+        proxy.$modal.msgError("请输入社保密码");
+        return;
+      }
+      if (!passwordCheck(form.value.socialSecurityPassword)) {
+        proxy.$modal.msgError("请输入正确的社保密码");
+        return;
+      }
+      if (!form.value.employeePassword) {
+        proxy.$modal.msgError("请输入用工密码");
+        return;
+      }
+      if (!passwordCheck(form.value.employeePassword)) {
+        proxy.$modal.msgError("请输入正确的用工密码");
+        return;
+      }
     }
-    // 正则表达式匹配身份证号的格式
-    const regExp = /1[3-9]\d{9}/;
-    if (!regExp.test(l.phone)) {
-      proxy.$modal.msgError(`第${i + 1}行请输入正确的电话号码!`);
+    if (
+      form.value.evidenceFiles == null ||
+      form.value.evidenceFiles.length === 0
+    ) {
+      proxy.$modal.msgError("请上传凭证");
       return;
     }
-    if (!l.idCardImage) {
-      proxy.$modal.msgError(`第${i + 1}行身份证正面照不能为空`);
-      return;
-    }
-    if (!l.idCardImageBack) {
-      proxy.$modal.msgError(`第${i + 1}行身份证反面照不能为空`);
-      return;
-    }
-    if (!l.cardinalNumber) {
-      proxy.$modal.msgError(`第${i + 1}行基数不能为空`);
-      return;
-    }
-    // if (!l.medicalCardinalNumber) {
-    //   proxy.$modal.msgError(`第${i + 1}行医疗基数不能为空`);
+    // if (form.value.reportFiles == null || form.value.reportFiles.length === 0) {
+    //   proxy.$modal.msgError("请上传报表");
     //   return;
     // }
+
+    proxy.$modal
+      .confirm("确认保存么?")
+      .then(() => {
+        const saveValue = proxy.deepClone(form.value);
+        saveValue.status = 3;
+        saveValue.year = proxy.moment(currentMonth.value).format("YYYY");
+        saveValue.month = proxy.moment(currentMonth.value).format("MM");
+        saveDetail(saveValue).then((res) => {
+          proxy.$modal.msgSuccess("保存成功");
+          reset();
+          close();
+          getList.value();
+        });
+      })
+      .catch((err) => {
+        proxy.$modal.msg("取消保存");
+      });
   }
-  if (form.value.isFirstSocialSecurity === 0) {
-    if (!form.value.governmentAccountNo) {
-      proxy.$modal.msgError("请输入政务网账号");
-      return;
-    }
-    if (!form.value.governmentPassword) {
-      proxy.$modal.msgError("请输入政务网密码");
-      return;
-    }
-    if (!passwordCheck(form.value.governmentPassword)) {
-      proxy.$modal.msgError("请输入正确的政务网密码");
-      return;
-    }
-    if (!form.value.socialSecurityAccountNo) {
-      proxy.$modal.msgError("请输入社保账号");
-      return;
-    }
-    if (!form.value.socialSecurityPassword) {
-      proxy.$modal.msgError("请输入社保密码");
-      return;
-    }
-    if (!passwordCheck(form.value.socialSecurityPassword)) {
-      proxy.$modal.msgError("请输入正确的社保密码");
-      return;
-    }
-    if (!form.value.employeePassword) {
-      proxy.$modal.msgError("请输入用工密码");
-      return;
-    }
-    if (!passwordCheck(form.value.employeePassword)) {
-      proxy.$modal.msgError("请输入正确的用工密码");
-      return;
-    }
-  }
-  proxy.$modal
-    .confirm("确认保存么?")
-    .then(() => {
-      const saveValue = proxy.deepClone(form.value);
-      saveValue.status = 3;
-      saveDetail(saveValue).then((res) => {
-        proxy.$modal.msgSuccess("保存成功");
-        reset();
-        close();
+  function turnBack(detail) {
+    loading.value = true
+    form.value.status = 1;
+
+    form.value.year = proxy.moment(currentMonth.value).format("YYYY");
+    form.value.month = proxy.moment(currentMonth.value).format("MM");
+    turnBackDetail(form.value)
+      .then((res) => {
         getList.value();
+      })
+      .catch((err) => {
+        proxy.$modal.msgError(err.message);
+      }).finally(() => {
+        loading.value = false
+        visible.value = false;
       });
-    })
-    .catch((err) => {
-      proxy.$modal.msg("取消保存");
-    });
-}
-
-function passwordCheckHandler(value, field) {
-  // console.log(value)
-  if (!passwordCheck(form.value[field])) {
-    proxy.$modal.msgError("请输入正确密码");
   }
-}
-
-function passwordCheck(value) {
-  const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
-  if (!pattern.test(value)) {
-    return false;
+  function passwordCheckHandler(value, field) {
+    // console.log(value)
+    if (!passwordCheck(form.value[field])) {
+      proxy.$modal.msgError("请输入正确密码");
+    }
   }
-  return true;
-}
 
-function upload(param) {
-  const formData = new FormData();
-  formData.append("file", param.file);
-  uploadFile(formData).then((res) => {
-    if (res.code === 200) {
-      const file = {};
-      file.fileName = res.newFileName;
-      file.url = res.url;
-      file.originalFileName = res.originalFilename;
-      file.fileUrl = res.fileName;
-      form.value.evidenceFiles.push(file);
+  function passwordCheck(value) {
+    const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
+    if (!pattern.test(value)) {
+      return false;
     }
-  });
-}
+    return true;
+  }
+  function uploadStatement(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.url = res.url;
+        file.fileType =
+          res.newFileName.split(".")[res.newFileName.split(".").length - 1];
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        form.value.reportFiles.push(file);
+      }
+    });
+  }
+  function upload(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.url = res.url;
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        form.value.evidenceFiles.push(file);
+      }
+    });
+  }
 
-function openFile(row) {
-  window.open(`${baseUrl.value}${row.fileUrl}`);
-}
+  function openFile(row) {
+    window.open(`${baseUrl.value}${row.fileUrl}`);
+  }
 
-function changeEdit() {
-  editStatus.value = !editStatus.value;
-}
+  function changeEdit() {
+    editStatus.value = !editStatus.value;
+  }
 
-function amountChangeHandler() {
-  let amount = 0;
-  amount += form.value.unitInjury == null ? 0 : form.value.unitInjury;
-  amount += form.value.unitMedical == null ? 0 : form.value.unitMedical;
-  amount += form.value.unitPension == null ? 0 : form.value.unitPension;
-  amount += form.value.unitProcreate == null ? 0 : form.value.unitProcreate;
-  amount +=
-    form.value.unitSeriousIllness == null ? 0 : form.value.unitSeriousIllness;
-  amount +=
-    form.value.unitUnemployment == null ? 0 : form.value.unitUnemployment;
-  amount +=
-    form.value.individualMedical == null ? 0 : form.value.individualMedical;
-  amount +=
-    form.value.individualPension == null ? 0 : form.value.individualPension;
-  amount +=
-    form.value.individualSeriousIllness == null
-      ? 0
-      : form.value.individualSeriousIllness;
-  amount +=
-    form.value.individualUnemployment == null
-      ? 0
-      : form.value.individualUnemployment;
-  amount += form.value.unitHeatingFee == null ? 0 : form.value.unitHeatingFee;
-  form.value.amount = amount;
-  canSave.value =
-    form.value.unitInjury !== undefined &&
-    form.value.unitMedical !== undefined &&
-    form.value.unitPension !== undefined &&
-    form.value.unitProcreate !== undefined &&
-    form.value.unitSeriousIllness !== undefined &&
-    form.value.unitUnemployment !== undefined &&
-    form.value.individualMedical !== undefined &&
-    form.value.individualPension !== undefined &&
-    form.value.individualSeriousIllness !== undefined &&
-    form.value.individualUnemployment !== undefined &&
-    form.value.unitHeatingFee !== undefined;
-}
+  function amountChangeHandler() {
+    let amount = 0;
+    amount += form.value.unitInjury == null ? 0 : form.value.unitInjury;
+    amount += form.value.unitMedical == null ? 0 : form.value.unitMedical;
+    amount += form.value.unitPension == null ? 0 : form.value.unitPension;
+    amount += form.value.unitProcreate == null ? 0 : form.value.unitProcreate;
+    amount +=
+      form.value.unitSeriousIllness == null ? 0 : form.value.unitSeriousIllness;
+    amount +=
+      form.value.unitUnemployment == null ? 0 : form.value.unitUnemployment;
+    amount +=
+      form.value.individualMedical == null ? 0 : form.value.individualMedical;
+    amount +=
+      form.value.individualPension == null ? 0 : form.value.individualPension;
+    amount +=
+      form.value.individualSeriousIllness == null
+        ? 0
+        : form.value.individualSeriousIllness;
+    amount +=
+      form.value.individualUnemployment == null
+        ? 0
+        : form.value.individualUnemployment;
+    amount += form.value.unitHeatingFee == null ? 0 : form.value.unitHeatingFee;
+    form.value.amount = amount;
+    canSave.value =
+      form.value.unitInjury !== undefined &&
+      form.value.unitMedical !== undefined &&
+      form.value.unitPension !== undefined &&
+      form.value.unitProcreate !== undefined &&
+      form.value.unitSeriousIllness !== undefined &&
+      form.value.unitUnemployment !== undefined &&
+      form.value.individualMedical !== undefined &&
+      form.value.individualPension !== undefined &&
+      form.value.individualSeriousIllness !== undefined &&
+      form.value.individualUnemployment !== undefined &&
+      form.value.unitHeatingFee !== undefined;
+  }
+  function handlerEportFilesDel(row, index) {
+    proxy.$modal
+      .confirm("确定删除吗?")
+      .then((_) => {
+        form.value.evidenceFiles.splice(index, 1);
+      })
+      .catch((_) => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
 
-function handleDel(row, index) {
-  proxy.$modal
-    .confirm("确定删除吗?")
-    .then((_) => {
-      form.value.evidenceFiles.splice(index, 1);
-    })
-    .catch((_) => {
-      proxy.$modal.msg("已取消删除");
-    });
-}
+  function handleDel(row, index) {
+    proxy.$modal
+      .confirm("确定删除吗?")
+      .then((_) => {
+        form.value.evidenceFiles.splice(index, 1);
+      })
+      .catch((_) => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
 
-// 暴露给父组件的方法
-defineExpose({
-  open,
-});
+  // 暴露给父组件的方法
+  defineExpose({
+    open,
+  });
 </script>
 <style scoped>
-.img {
-  width: 23px;
-  height: 23px;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-}
+  .img {
+    width: 23px;
+    height: 23px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
 
-::v-deep(.el-upload) {
-  display: flex;
-  text-align: center;
-  justify-content: center;
-  cursor: pointer;
-  outline: 0;
-}
+  ::v-deep(.el-upload) {
+    display: flex;
+    text-align: center;
+    justify-content: center;
+    cursor: pointer;
+    outline: 0;
+  }
 
-.required::after {
-  content: "*";
-  color: red;
-}
+  .required::after {
+    content: "*";
+    color: red;
+  }
 </style>