Browse Source

其他费用信息台账接口联调

ljb 9 months ago
parent
commit
79a81a3b0e

+ 4 - 4
src/api/yfCostManage/basicDataSetting/otherCostLedger.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/other-cost/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/other-cost/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/other-cost/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/other-cost/remove',
     method: 'post',
     params: {
       ids

+ 2 - 0
src/option/basicResource/compSubjectSetting.js

@@ -5,6 +5,8 @@ export default {
   searchShow: true,
   searchMenuSpan: 6,
   border: true,
+  index: true,
+  selection: true,
   searchLabelWidth: 140,
   labelWidth: 110,
   menuWidth: 140,

+ 0 - 1
src/option/techPerson/cyPersonRoster.js

@@ -7,7 +7,6 @@ export default {
   border: true,
   index: true,
   viewBtn: true,
-  selection: true,
   addBtn: false,
   delBtn: false,
   menu: false,

+ 0 - 1
src/option/techPerson/highTechPersonSumList.js

@@ -8,7 +8,6 @@ export default {
   index: true,
   addBtn: false,
   viewBtn: true,
-  selection: true,
   menu: false,
   searchLabelWidth: 140,
   labelWidth: 140,

+ 20 - 11
src/option/yfCostManage/basicDataSetting/otherCostLedger.js

@@ -35,7 +35,7 @@ export default {
       label: '研发项目名称',
       prop: 'xmmc',
       span: 24,
-      minWidth: 160,
+      width: 160,
       search: true,
       showOverflowTooltip: true,
       display: false
@@ -57,20 +57,20 @@ export default {
     },
     {
       label: '费用类型',
-      prop: 'type',
+      prop: 'costType',
       type: 'select',
       span: 24,
-      width: 120,
+      width: 90,
       align: 'center',
       display: false,
     },
     {
       label: '日期',
-      prop: 'rq',
+      prop: 'recordDate',
       type: 'date',
       valueFormat: 'yyyy-MM-dd',
       span: 24,
-      width: 100,
+      width: 90,
       align: 'center',
       search: true,
       showOverflowTooltip: true,
@@ -82,22 +82,31 @@ export default {
     },
     {
       label: '费用内容',
-      prop: 'fynr',
-      type: 'select',
+      prop: 'subjectId',
+      type: 'tree',
       dicData: [],
       props: {
         label: 'name',
         value: 'id'
       },
       span: 24,
-      minWidth: 160,
+      width: 100,
+      align: 'center',
       showOverflowTooltip: true,
-      search: true,
       rules: [{
         required: true,
         message: '请选择费用内容',
-        trigger: 'blur'
-      }]
+        trigger: 'blur',
+      }],
+      hide: true
+    },
+    {
+      label: '费用内容',
+      prop: 'subjectName',
+      span: 24,
+      minWidth: 180,
+      display: false,
+      showOverflowTooltip: true,
     },
     {
       label: '单价(元)',

+ 68 - 10
src/views/yf-cost-manage/basic-data-setting/other-cost-ledger.vue

@@ -44,9 +44,10 @@
         </div>
       </template>
 
-      <template slot="rqSearch">
+      <template slot="recordDateSearch">
+        <span>日期:</span>
         <el-date-picker
-          v-model="params.rq"
+          v-model="params.recordDate"
           type="daterange"
           range-separator="至"
           start-placeholder="开始日期"
@@ -58,7 +59,7 @@
       </template>
 
       <template slot="xmIdForm">
-        <project-select placeholder="请选择项目名称" v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }" @change="handleProjectChange"></project-select>
+        <project-select placeholder="请选择项目名称" v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }"></project-select>
       </template>
       
     </avue-crud>
@@ -129,30 +130,52 @@ 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;
+
+        if (item.children && item.children.length) {
+          this.loopData(item.children, level);
+        }
+        
+        return item;
+      });
+    },
     getSubjectList() {
-      getSubjectTreeList({ code: '53010108' }).then(res => {
+      getSubjectTreeList().then(res => {
         this.loading = false;
         if (res.data.code == 200) {
-          const data = res.data.data || [];
-          const column = this.findObject(this.option.column, "fynr");
-          column.dicData = data.length ? data[0].children : [];
+
+          const column = this.findObject(this.option.column, "subjectId");
+          column.dicData = this.loopData(JSON.parse(JSON.stringify(res.data.data)), 0);
+          this.treeData = column.dicData;
         }
       })
     },
+    getSearchParams() {
+      let params = { ...this.params };
+      if (params.recordDate && params.recordDate.length) {
+        params.recordDateMin = params.recordDate[0];
+        params.recordDateMax = params.recordDate[1];
+      }
+      delete params.recordDate;
+      return params;
+    },
     getFormData() {
       return { ...this.form, yearAndMonth: this.params.yearAndMonth };
     },
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
-      this.$refs.uploadExcelDialog.open('/api/kd-scientific/other-cost/import', excelParams);
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/xm/other-cost/import', excelParams);
     },
     uploadAfter() {
       this.page.currentPage = 1;
       this.getList(this.page);
     },
     handleExport() {
-      exportBlob(`/api/kd-scientific/other-cost/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+      exportBlob(`/api/kd-scientific/xm/other-cost/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `${this.params.yearAndMonth}其他费用-基本信息台账.xlsx`);
       });
     },
@@ -167,6 +190,41 @@ 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);
+      
+      return {
+        ...this.form,
+        subjectName: `${parentNames.join('\\')}\\${this.form.$subjectId}`,
+        costType: '其他费用',
+        yearAndMonth: this.params.yearAndMonth,
+      };
+    },
   },
 }, {
   // 模块路径

+ 4 - 4
src/views/yf-cost-manage/yf-cost-statistics/person-cost-statistics/yf-work-hours-allocation-list.vue

@@ -25,28 +25,28 @@
       </template>
 
       <template slot="gslb" slot-scope="{ row }">
-        <div v-if="row.dailyHoursList.length" class="custom-cell">
+        <div class="custom-cell">
           <div class="custom-cell-line">研发工时</div>
           <div class="custom-cell-line">非研发工时</div>
         </div>
       </template>
 
       <template v-for="col of allMonthCols" :slot="col" slot-scope="{ row }">
-        <div v-if="row.dailyHoursList.length" class="custom-cell" :key="col">
+        <div class="custom-cell" :key="col">
           <div class="custom-cell-line">{{ row.dailyHoursList[0] ? row.dailyHoursList[0][col] : '' }}</div>
           <div class="custom-cell-line">{{ row.dailyHoursList[1] ? row.dailyHoursList[1][col] : '' }}</div>
         </div>
       </template>
 
       <template slot="hoursTotal" slot-scope="{ row }">
-        <div v-if="row.dailyHoursList.length" class="custom-cell">
+        <div class="custom-cell">
           <div class="custom-cell-line">{{ row.workHoursTotal }}</div>
           <div class="custom-cell-line">{{ row.unworkHoursTotal }}</div>
         </div>
       </template>
 
       <template slot="hoursRate" slot-scope="{ row }">
-        <div v-if="row.dailyHoursList.length" class="custom-cell">
+        <div class="custom-cell">
           <div class="custom-cell-line">{{ row.workHoursRate }}</div>
           <div class="custom-cell-line">{{ row.unworkHoursRate }}</div>
         </div>