Browse Source

企业基础信息表接口联调

ljb 9 months ago
parent
commit
b40c1bf05d

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

@@ -0,0 +1,43 @@
+import request from '@/router/axios';
+
+export const getAttenDetail = (year) => {
+  return request({
+    url: `/api/kd-scientific/setting/detail/${year}`,
+    method: 'get',
+  })
+}
+
+export const settingAttenInfo = (row) => {
+  return request({
+    url: '/api/kd-scientific/setting/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const getEnterpriseInfo = (year) => {
+  return request({
+    url: `/api/kd-scientific/enterpriseInfo/detail/${year}`,
+    method: 'get',
+  })
+}
+
+
+export const saveOrUpdateEnterInfo = (row) => {
+  return request({
+    url: '/api/kd-scientific/enterpriseInfo/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const getLastYearEnterInfo = (params) => {
+  return request({
+    url: `/api/kd-scientific/enterpriseInfo/fetchLastYearData`,
+    method: 'get',
+    params
+  })
+}
+
+
+

+ 58 - 7
src/views/basic-resource/comp-basic-info/comp-info-setting.vue

@@ -5,7 +5,18 @@
       <avue-form :option="logoOption" v-model="logoForm" style="width: 320px; margin: 0;" @submit="handleSubmitLogo"></avue-form>
     </basic-card>
 
-    <year-month-select v-model="yearAndMonth" :showMonth="false" style="width: 120px;"></year-month-select>
+    <!-- <year-month-select v-model="yearAndMonth" :showMonth="false" style="width: 120px;"></year-month-select> -->
+    <div style="padding-left: 16px;">
+      <el-date-picker
+        v-model="yearAndMonth"
+        type="year"
+        placeholder="选择年"
+        value-format="yyyy"
+        :clearable="false"
+        style="margin-bottom: 6px;"
+      >
+      </el-date-picker>
+    </div>
 
     <basic-card title="企业基础信息表">
       <comp-info-table :yearAndMonth="yearAndMonth"></comp-info-table>
@@ -19,11 +30,11 @@
     </basic-card>
 
     <basic-card title="高企证书上传">
-      <avue-form :option="picOption" v-model="picForm" style="width: 320px; margin: 0;"></avue-form>
+      <avue-form :option="picOption" v-model="picForm" style="width: 320px; margin: 0;" @submit="handleHighTecChange"></avue-form>
     </basic-card>
 
     <basic-card title="出勤时间设置">
-      <avue-form :option="attendOption" v-model="attendForm" 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-container>
 </template>
@@ -31,6 +42,7 @@
 <script>
 import {mapGetters} from "vuex";
 import { getDetail as getTenantDetail, update as updateTenant } from '@/api/system/tenant';
+import { getAttenDetail, settingAttenInfo } from "@/api/basicResource/compInfoSetting";
 import YearMonthSelect from "@/components/year-month-select";
 import basicCard from "@/components/basic-card";
 import compInfoTable from "./components/comp-info-table.vue";
@@ -76,7 +88,7 @@ export default {
       },
 
       picForm: {
-        attachment: [],
+        highTechUrl: [],
       },
       picOption: {
         submitText: '保存',
@@ -84,7 +96,7 @@ export default {
         column: [
           {
             label: "高企证书",
-            prop: "attachment",
+            prop: "highTechUrl",
             type: "upload",
             listType: "picture-card",
             span: 24,
@@ -93,6 +105,7 @@ export default {
             limit: 5,
             propsHttp: {
               res: "data",
+              url: 'link',
             },
             tip: "请上传当前年度的高企证书",
             action: '/api/kd-resource/oss/endpoint/put-file',
@@ -107,7 +120,7 @@ export default {
         column: [
          {
             label: '作息时间',
-            prop: 'num',
+            prop: 'workHours',
             type: 'number',
             span: 24,
             min: 0,
@@ -120,8 +133,14 @@ export default {
   computed: {
     ...mapGetters(["userInfo"]),
   },
+  watch: {
+    yearAndMonth(newVal) {
+      console.log(newVal)
+    }
+  },
   mounted() {
     this.getTenantDetailFunc(this.userInfo.tenant_id);
+    this.getAttenDetailFunc(this.yearAndMonth)
   },
   methods: {
     getTenantDetailFunc(tenantId) {
@@ -141,7 +160,39 @@ export default {
       }).catch(() => {
         done();
       })
-    }
+    },
+    getAttenDetailFunc(yearAndMonth) {
+      getAttenDetail(yearAndMonth).then(({ data }) => {
+        if (data.code == 200 && Object.keys(data.data).length) {
+          const _data = data.data;
+          this.picForm = { id: _data.id, yearAndMonth: _data.yearAndMonth, highTechUrl: _data.highTechUrl ? _data.highTechUrl.split(',') : [] };
+          this.attendForm = { id: _data.id, yearAndMonth: _data.yearAndMonth, workHours: _data.workHours };
+        }
+      })
+    },
+    handleHighTecChange(form, done) {
+      const params = { ...this.picForm, yearAndMonth: this.yearAndMonth, highTechUrl: this.picForm.highTechUrl.join(',') };
+      settingAttenInfo(params).then(({ data }) => {
+       done();
+        if (data.code == 200) {
+          this.$message.success('保存成功!');
+        }
+      }).catch(() => {
+        done();
+      })
+    },
+    handleSubmitAtten(form, done) {
+      const params = { ...this.attendForm, yearAndMonth: this.yearAndMonth };
+      settingAttenInfo(params).then(({ data }) => {
+       done();
+        if (data.code == 200) {
+          this.$message.success('保存成功!');
+        }
+      }).catch(() => {
+        done();
+      })
+    },
+    
   }
 }
 </script>

+ 83 - 13
src/views/basic-resource/comp-basic-info/components/comp-info-table.vue

@@ -1,40 +1,58 @@
 <template>
   <div class="comp-info-table">
     <div class="top-btn">
-      <el-button type="primary" size="small" icon="el-icon-check">保存</el-button>
-      <el-button type="primary" plain size="small">读取上年度数据</el-button>
+      <el-button type="primary" size="small" icon="el-icon-check" @click="handleSaveBtn">保存</el-button>
+      <el-button type="primary" plain size="small" @click="handleLastYearData">读取上年度数据</el-button>
     </div>
     <div class="table-wrap">
-      <table>
+      <table v-loading="loading">
         <tr>
           <td class="label">本年度营业收入(万元)</td>
-          <td></td>
+          <td>
+            <avue-input-number v-model="form.currentYearIncome" :min="0" :precision="2" size="small" style="width: 200px"></avue-input-number>
+          </td>
           <td class="label">本年度研发费用(万元)</td>
-          <td></td>
+          <td>
+            <avue-input-number v-model="form.currentYearCost" :min="0" :precision="2" size="small" style="width: 200px"></avue-input-number>
+          </td>
         </tr>
         <tr>
           <td class="label">上年度营业收入(万元)</td>
-          <td></td>
+          <td>
+            <avue-input-number v-model="form.previousYearIncome" :min="0" :precision="2" size="small" style="width: 200px"></avue-input-number>
+          </td>
           <td class="label">上年度研发费用(万元)</td>
-          <td></td>
+          <td>
+            <avue-input-number v-model="form.previousYearCost" :min="0" :precision="2" size="small" style="width: 200px"></avue-input-number>
+          </td>
         </tr>
         <tr>
           <td class="label">上上年度营业收入(万元)</td>
-          <td></td>
+          <td>
+            <avue-input-number v-model="form.lastYearIncome" :min="0" :precision="2" size="small" style="width: 200px"></avue-input-number>
+          </td>
           <td class="label">上上年度研发费用(万元)</td>
-          <td></td>
+          <td>
+            <avue-input-number v-model="form.lastYearCost" :min="0" :precision="2" size="small" style="width: 200px"></avue-input-number>
+          </td>
         </tr>
         <tr>
           <td class="label">高新领域</td>
           <td></td>
           <td class="label">其他说明</td>
-          <td></td>
+          <td>
+            <input v-model="form.remark" style="width: 100%; border: none;" />
+          </td>
         </tr>
         <tr>
           <td class="label">高企认定年度</td>
-          <td></td>
+          <td>
+            <input v-model="form.highTechYear" style="width: 100%; border: none;" />
+          </td>
           <td class="label">高企编号</td>
-          <td></td>
+          <td>
+            <input v-model="form.highTechNumber" style="width: 100%; border: none;" />
+          </td>
         </tr>
       </table>
     </div>
@@ -42,8 +60,60 @@
 </template>
 
 <script>
+import { getEnterpriseInfo, saveOrUpdateEnterInfo, getLastYearEnterInfo } from "@/api/basicResource/compInfoSetting";
+
 export default {
-  
+  props: {
+    yearAndMonth: [String, Number]
+  },
+  data() {
+    return {
+      loading: false,
+      form: {}
+    }
+  },
+  watch: {
+    yearAndMonth(newVal) {
+      this.getEnterpriseInfoFunc(newVal);
+    }
+  },
+  mounted() {
+    this.getEnterpriseInfoFunc(this.yearAndMonth);
+  },
+  methods: {
+    getEnterpriseInfoFunc(yearAndMonth) {
+      this.loading = true;
+      getEnterpriseInfo(yearAndMonth).then(({ data }) => {
+        this.loading = false;
+        if (data.code == 200) {
+          this.form = data.data;
+        }
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    handleSaveBtn() {
+      const params = { ...this.form, yearAndMonth: this.yearAndMonth };
+      saveOrUpdateEnterInfo(params).then(({ data }) => {
+        if (data.code == 200) {
+          this.$message.success("保存成功!")
+        }
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    handleLastYearData() {
+      this.loading = true;
+      getLastYearEnterInfo({ yearAndMonth: this.yearAndMonth }).then(({ data }) => {
+        this.loading = false;
+        if (data.code == 200) {
+          this.form = data.data;
+        }
+      }).catch(() => {
+        this.loading = false;
+      });
+    }
+  }
 }
 </script>