Browse Source

企业基础信息表增加读取上年度功能

ljb 9 months ago
parent
commit
c52aeaa58a

+ 17 - 0
src/api/basicResource/compInfoSetting.js

@@ -31,6 +31,7 @@ export const saveOrUpdateEnterInfo = (row) => {
   })
   })
 }
 }
 
 
+// 读取上年度企业基础信息表
 export const getLastYearEnterInfo = (params) => {
 export const getLastYearEnterInfo = (params) => {
   return request({
   return request({
     url: `/api/kd-scientific/enterpriseInfo/fetchLastYearData`,
     url: `/api/kd-scientific/enterpriseInfo/fetchLastYearData`,
@@ -39,5 +40,21 @@ export const getLastYearEnterInfo = (params) => {
   })
   })
 }
 }
 
 
+// 读取上年度二级单位
+export const getLastYearUnitInfo = (params) => {
+  return request({
+    url: `/api/kd-scientific/fetchLastYearData`,
+    method: 'get',
+    params
+  })
+}
 
 
+// 读取上年度高企证书或出勤信息
+export const getLastYearAttenInfo = (params) => {
+  return request({
+    url: `/api/kd-scientific/setting/fetchLastYearData`,
+    method: 'get',
+    params
+  })
+}
 
 

+ 21 - 2
src/views/basic-resource/comp-basic-info/comp-info-setting.vue

@@ -5,7 +5,6 @@
       <avue-form :option="logoOption" v-model="logoForm" style="width: 320px; margin: 0;" @submit="handleSubmitLogo"></avue-form>
       <avue-form :option="logoOption" v-model="logoForm" style="width: 320px; margin: 0;" @submit="handleSubmitLogo"></avue-form>
     </basic-card>
     </basic-card>
 
 
-    <!-- <year-month-select v-model="yearAndMonth" :showMonth="false" style="width: 120px;"></year-month-select> -->
     <div style="padding-left: 16px;">
     <div style="padding-left: 16px;">
       <el-date-picker
       <el-date-picker
         v-model="yearAndMonth"
         v-model="yearAndMonth"
@@ -30,10 +29,12 @@
     </basic-card>
     </basic-card>
 
 
     <basic-card title="高企证书上传">
     <basic-card title="高企证书上传">
+      <el-button type="primary" plain size="small" @click="handleLastYearData(2)" style="margin-bottom: 12px;">读取上年度数据</el-button>
       <avue-form :option="picOption" v-model="picForm" style="width: 320px; margin: 0;" @submit="handleHighTecChange"></avue-form>
       <avue-form :option="picOption" v-model="picForm" style="width: 320px; margin: 0;" @submit="handleHighTecChange"></avue-form>
     </basic-card>
     </basic-card>
 
 
     <basic-card title="出勤时间设置">
     <basic-card title="出勤时间设置">
+      <el-button type="primary" plain size="small" @click="handleLastYearData(1)" style="margin-bottom: 12px;">读取上年度数据</el-button>
       <avue-form :option="attendOption" v-model="attendForm" @submit="handleSubmitAtten" style="width: 320px; margin: 0;"></avue-form>
       <avue-form :option="attendOption" v-model="attendForm" @submit="handleSubmitAtten" style="width: 320px; margin: 0;"></avue-form>
     </basic-card>
     </basic-card>
   </basic-container>
   </basic-container>
@@ -42,7 +43,7 @@
 <script>
 <script>
 import {mapGetters} from "vuex";
 import {mapGetters} from "vuex";
 import { getDetail as getTenantDetail, update as updateTenant } from '@/api/system/tenant';
 import { getDetail as getTenantDetail, update as updateTenant } from '@/api/system/tenant';
-import { getAttenDetail, settingAttenInfo } from "@/api/basicResource/compInfoSetting";
+import { getAttenDetail, settingAttenInfo, getLastYearAttenInfo } from "@/api/basicResource/compInfoSetting";
 import YearMonthSelect from "@/components/year-month-select";
 import YearMonthSelect from "@/components/year-month-select";
 import basicCard from "@/components/basic-card";
 import basicCard from "@/components/basic-card";
 import compInfoTable from "./components/comp-info-table.vue";
 import compInfoTable from "./components/comp-info-table.vue";
@@ -143,6 +144,24 @@ export default {
     this.getAttenDetailFunc(this.yearAndMonth)
     this.getAttenDetailFunc(this.yearAndMonth)
   },
   },
   methods: {
   methods: {
+    /**
+     * 读取上年度高企证书或出勤信息
+     * @param type 1、出勤时长;2、高企证书
+     */
+    handleLastYearData(type) {
+      this.$confirm('请注意!读取上年度数据将覆盖当前所有数据,确认要读取吗?', '提示').then(() => {
+        this.loading = true;
+        getLastYearAttenInfo({ yearAndMonth: this.yearAndMonth, type }).then(({ data }) => {
+          this.loading = false;
+          if (data.code == 200) {
+            this.$message.success('读取成功!');
+            this.getAttenDetailFunc(this.yearAndMonth);
+          }
+        }).catch(() => {
+          this.loading = false;
+        });
+      });
+    },
     getTenantDetailFunc(tenantId) {
     getTenantDetailFunc(tenantId) {
       getTenantDetail(tenantId).then(({ data }) => {
       getTenantDetail(tenantId).then(({ data }) => {
         if (data.code == 200) {
         if (data.code == 200) {

+ 17 - 0
src/views/basic-resource/comp-basic-info/components/comp-dept-list.vue

@@ -6,6 +6,7 @@
         icon="el-icon-plus"
         icon="el-icon-plus"
         size="small"
         size="small"
         @click="handleAddParent">新增二级单位</el-button>
         @click="handleAddParent">新增二级单位</el-button>
+      <el-button type="primary" plain size="small" @click="handleLastYearData">读取上年度数据</el-button>
     </template>
     </template>
     <template slot="menu" slot-scope="{ row, size, type }">
     <template slot="menu" slot-scope="{ row, size, type }">
       <el-button
       <el-button
@@ -38,6 +39,8 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { getLastYearUnitInfo } from "@/api/basicResource/compInfoSetting";
+
 export default window.$crudCommon(
 export default window.$crudCommon(
   {
   {
     props: {
     props: {
@@ -54,6 +57,20 @@ export default window.$crudCommon(
       }
       }
     },
     },
     methods: {
     methods: {
+      handleLastYearData() {
+        this.$confirm('请注意!读取上年度数据将覆盖当前所有数据,确认要读取吗?', '提示').then(() => {
+          this.loading = true;
+          getLastYearUnitInfo({ yearAndMonth: this.yearAndMonth }).then(({ data }) => {
+            this.loading = false;
+            if (data.code == 200) {
+              this.$message.success('读取成功!');
+              this.loadData();
+            }
+          }).catch(() => {
+            this.loading = false;
+          });
+        });
+      },
       buildTree(flatList, options = {}) {
       buildTree(flatList, options = {}) {
         const {
         const {
           idKey = "id", // 节点ID的键名
           idKey = "id", // 节点ID的键名

+ 11 - 8
src/views/basic-resource/comp-basic-info/components/comp-info-table.vue

@@ -126,14 +126,17 @@ export default {
       });
       });
     },
     },
     handleLastYearData() {
     handleLastYearData() {
-      this.loading = true;
-      getLastYearEnterInfo({ yearAndMonth: this.yearAndMonth }).then(({ data }) => {
-        this.loading = false;
-        if (data.code == 200) {
-          this.initFormData(data.data);
-        }
-      }).catch(() => {
-        this.loading = false;
+      this.$confirm('请注意!读取上年度数据将覆盖当前所有数据,确认要读取吗?', '提示').then(() => {
+        this.loading = true;
+        getLastYearEnterInfo({ yearAndMonth: this.yearAndMonth }).then(({ data }) => {
+          this.loading = false;
+          if (data.code == 200) {
+            this.$message.success('读取成功!');
+            this.initFormData(data.data);
+          }
+        }).catch(() => {
+          this.loading = false;
+        });
       });
       });
     }
     }
   }
   }