Browse Source

企业研发费用支出明细账接口联调

ljb 10 months ago
parent
commit
d831223fd8

+ 4 - 4
src/api/yfCostManage/basicDataSetting/yfCostBill.js

@@ -2,7 +2,7 @@ import request from '@/router/axios';
 
 export const getList = (current, size, params) => {
   return request({
-    url: '/api/kd-scientific/direct-cost/page',
+    url: '/api/kd-scientific/xm/cost/details/page',
     method: 'get',
     params: {
       ...params,
@@ -14,7 +14,7 @@ export const getList = (current, size, params) => {
 
 export const add = (row) => {
   return request({
-    url: '/api/kd-scientific/direct-cost/submit',
+    url: '/api/kd-scientific/xm/cost/details/submit',
     method: 'post',
     data: row
   })
@@ -23,7 +23,7 @@ export const add = (row) => {
 
 export const update = (row) => {
   return request({
-    url: '/api/kd-scientific/direct-cost/submit',
+    url: '/api/kd-scientific/xm/cost/details/submit',
     method: 'post',
     data: row
   })
@@ -32,7 +32,7 @@ export const update = (row) => {
 
 export const remove = (ids) => {
   return request({
-    url: '/api/kd-scientific/direct-cost/remove',
+    url: '/api/kd-scientific/xm/cost/details/remove',
     method: 'post',
     params: {
       ids

+ 19 - 9
src/option/yfCostManage/basicDataSetting/yfCostBill.js

@@ -23,7 +23,7 @@ export default {
   column: [
     {
       label: '日期',
-      prop: 'rq',
+      prop: 'recordDate',
       type: 'date',
       valueFormat: 'yyyy-MM-dd',
       span: 24,
@@ -72,7 +72,7 @@ export default {
     },
     {
       label: '凭证字号',
-      prop: 'pzzh',
+      prop: 'voucherNumber',
       type: 'input',
       span: 24,
       width: 120,
@@ -81,7 +81,7 @@ export default {
     },
     {
       label: '摘要',
-      prop: 'zy',
+      prop: 'digest',
       type: 'input',
       span: 24,
       width: 140,
@@ -89,7 +89,7 @@ export default {
       showOverflowTooltip: true,
     },
     {
-      label: '科目代码',
+      label: '科目名称',
       prop: 'subjectId',
       type: 'tree',
       dicData: [],
@@ -101,10 +101,16 @@ export default {
       width: 100,
       align: 'center',
       showOverflowTooltip: true,
+      rules: [{
+        required: true,
+        message: '请选择科目名称',
+        trigger: 'blur',
+      }],
+      hide: true
     },
     {
       label: '科目代码',
-      prop: 'kmdm',
+      prop: 'subjectCode',
       span: 24,
       width: 100,
       align: 'center',
@@ -113,16 +119,15 @@ export default {
     },
     {
       label: '科目名称',
-      prop: 'kmmc',
+      prop: 'subjectName',
       span: 24,
       width: 180,
-      align: 'center',
       display: false,
       showOverflowTooltip: true,
     },
     {
       label: '金额(元)',
-      prop: 'je',
+      prop: 'amount',
       type: 'number',
       min: 0,
       precision: 2,
@@ -131,10 +136,15 @@ export default {
       align: 'center',
       search: true,
       showOverflowTooltip: true,
+      rules: [{
+        required: true,
+        message: '请输入金额',
+        trigger: 'blur',
+      }]
     },
     {
       label: '账簿名称',
-      prop: 'zpmc',
+      prop: 'cashbook',
       span: 24,
       width: 160,
       align: 'center',

+ 2 - 2
src/views/basic-resource/basic-database/comp-subject-setting.vue

@@ -128,13 +128,13 @@ export default window.$crudCommon({
       })
     },
     findParentNames(categories, childId, parentNames = []) {
-      const child = categories.find(cat => cat.id === childId);
+      const child = categories.find(cat => cat.id == childId);
       
       if (!child || !child.parentId) {
         return parentNames;
       }
       
-      const parent = categories.find(cat => cat.id === child.parentId);
+      const parent = categories.find(cat => cat.id == child.parentId);
       if (parent) {
         parentNames.unshift(parent.name); // 添加到数组开头保持顺序
         return this.findParentNames(categories, parent.id, parentNames);

+ 44 - 10
src/views/yf-cost-manage/basic-data-setting/yf-cost-bill.vue

@@ -48,12 +48,12 @@
         <project-select placeholder="请选择项目名称" v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }" @change="handleProjectChange"></project-select>
       </template>
 
-      <template slot="jeSearch">
+      <template slot="amountSearch">
         <div style="display: flex; align-items: center;">
           <span>金额(元):</span>
-          <avue-input-number v-model="params.jeMin" :min="0" style="width: 90px !important;"></avue-input-number>
+          <avue-input-number v-model="params.amountMin" :min="0" style="width: 90px !important;"></avue-input-number>
           <span style="width: 20px; text-align: center;">至</span>
-          <avue-input-number v-model="params.jeMax" :min="0" style="width: 90px !important;"></avue-input-number>
+          <avue-input-number v-model="params.amountMax" :min="0" style="width: 90px !important;"></avue-input-number>
         </div>
       </template>
       
@@ -95,6 +95,7 @@ export default window.$crudCommon({
         yearAndMonth: moment(new Date()).format('YYYYMM'),
       },
       isSelAnnual: false,
+      treeData: [],
 
       wideTableColumns: [],
       printTitle: "",
@@ -125,12 +126,11 @@ export default window.$crudCommon({
     this.getSubjectList();
   },
   methods: {
-    loadData() {},
     loopData(data, level) {
       level++;
       return data.map(item => {
         item.level = level;
-        // item.disabled = level === 4 ? false : true;
+        item.disabled = level === 4 ? false : true;
 
         if (item.children && item.children.length) {
           this.loopData(item.children, level);
@@ -146,22 +146,20 @@ export default window.$crudCommon({
 
           const column = this.findObject(this.option.column, "subjectId");
           column.dicData = this.loopData(JSON.parse(JSON.stringify(res.data.data)), 0);
+          this.treeData = column.dicData;
         }
       })
     },
-    getFormData() {
-      return { ...this.form, yearAndMonth: this.params.yearAndMonth };
-    },
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
-      this.$refs.uploadExcelDialog.open('', excelParams);
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/xm/cost/details/import', excelParams);
     },
     uploadAfter() {
       this.page.currentPage = 1;
       this.getList(this.page);
     },
     handleExport() {
-      exportBlob(`/api/kd-scientific//export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+      exportBlob(`/api/kd-scientific/xm/cost/details/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `${this.params.yearAndMonth}企业研发费用支出明细账.xlsx`);
       });
     },
@@ -176,6 +174,42 @@ export default window.$crudCommon({
         this.$refs.printWideTable.printTable(isLandscape);
       })
     },
+    findParentNames(categories, childId, parentNames = []) {
+      const child = categories.find(cat => cat.id == childId);
+      
+      if (!child || !child.parentId) {
+        return parentNames;
+      }
+      
+      const parent = categories.find(cat => cat.id == child.parentId);
+      if (parent) {
+        parentNames.unshift(parent.name); // 添加到数组开头保持顺序
+        return this.findParentNames(categories, parent.id, parentNames);
+      }
+      
+      return parentNames;
+    },
+    getFormData() {
+      let newList = [];
+      const getAllList = data => {
+        data.forEach(element => {
+          newList.push(element);
+          if (element.children && element.children.length) {
+            getAllList(element.children)
+          }
+        });
+      }
+      getAllList(this.treeData);
+      let parentNames = this.findParentNames(newList, this.form.subjectId);
+      let currSubjectObj = newList.find(item => item.id == this.form.subjectId);
+      
+      return {
+        ...this.form,
+        subjectName: `${parentNames.join('\\')}\\${this.form.$subjectId}`,
+        yearAndMonth: this.params.yearAndMonth,
+        subjectCode: currSubjectObj ? currSubjectObj.code : ''
+      };
+    },
   },
 }, {
   // 模块路径