Browse Source

研发费用统计模块打印功能配置

ljb 8 months ago
parent
commit
ceac2b9599

+ 1 - 1
src/option/yfCostManage/yfCostStatistics/devDepreAllocation.js

@@ -19,7 +19,7 @@ export default {
       label: '月份',
       prop: 'yearAndMonth',
       span: 24,
-      width: 60,
+      width: 65,
       align: 'center',
       showOverflowTooltip: true,
     },

+ 1 - 1
src/option/yfCostManage/yfCostStatistics/hourseDepreAllocation.js

@@ -19,7 +19,7 @@ export default {
       label: '月份',
       prop: 'yearAndMonth',
       span: 24,
-      width: 60,
+      width: 65,
       align: 'center',
       display: false,
       showOverflowTooltip: true,

+ 7 - 87
src/printOption/yfCostManage/yfCostStatistics/amortizeCostSummaryList.js

@@ -1,172 +1,92 @@
 export default {
-  height: 'auto',
-  calcHeight: 30,
-  tip: false,
-  searchShow: true,
-  searchMenuSpan: 6,
-  border: true,
-  index: true,
-  addBtn: false,
-  menu: false,
-  searchLabelWidth: 140,
-  labelWidth: 140,
-  menuWidth: 290,
-  dialogClickModal: false,
-  dialogWidth: 500,
-  dialogType: "drawer",
   column: [
     {
       label: '月份',
       prop: 'yearAndMonth',
-      span: 24,
       width: 60,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '研发项目编号',
       prop: 'xmbh',
-      span: 24,
       width: 100,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '研发项目名称',
       prop: 'xmmc',
-      span: 24,
-      width: 120,
-      search: true,
-      showOverflowTooltip: true,
+      width: 300,
     },
     {
       label: '资产编号',
       prop: 'zcbm',
-      type: 'input',
-      span: 24,
       width: 100,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '无形资产名称',
       prop: 'zcmc',
-      type: 'input',
-      span: 24,
-      minWidth: 120,
-      search: true,
-      showOverflowTooltip: true,
+      width: 260,
     },
     {
       label: '资产类别',
       prop: 'zclb',
-      type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zclb',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
-      span: 24,
       width: 90,
       align: 'center',
-      showOverflowTooltip: true,
-      search: true,
     },
     {
       label: '功率',
       prop: 'gl',
-      type: 'number',
-      span: 24,
       width: 60,
       align: 'center',
-      showOverflowTooltip: true,
-      display: true
     },
     {
       label: '用途',
       prop: 'yt',
-      type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zcyt',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
-      search: true,
-      span: 24,
       width: 65,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '资产原值(元)',
       prop: 'zcyz',
-      type: 'number',
-      span: 24,
       width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '净残值率(%)',
       prop: 'jcz',
-      type: 'number',
-      span: 24,
       width: 70,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
-      formatter:(row, value)=>{
-        return value+'%'
-      }
     },
     {
       label: '月摊销额(每节点/套)(K)',
       prop: 'ytxe',
-      type: 'number',
-      span: 24,
-      minWidth: 110,
+      width: 110,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '月使用工时(L)',
       prop: 'attendanceHours',
-      type: 'number',
-      span: 24,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '月研发工时(M)',
       prop: 'workHours',
-      type: 'number',
-      span: 24,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '研发分摊率(%)(N)',
       prop: 'yanfaFenTanLv',
-      type: 'number',
-      span: 24,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '研发摊销',
       prop: 'yanfaTanXiao',
-      type: 'number',
-      span: 24,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      showOverflowTooltip: true,
     },
   ],
 };

+ 8 - 84
src/printOption/yfCostManage/yfCostStatistics/devDepreAllocation.js

@@ -1,162 +1,86 @@
 export default {
-  height: 'auto',
-  calcHeight: 30,
-  tip: false,
-  searchShow: true,
-  searchMenuSpan: 6,
-  border: true,
-  index: true,
-  addBtn: false,
-  menu: false,
-  searchLabelWidth: 140,
-  labelWidth: 140,
-  menuWidth: 290,
-  dialogClickModal: false,
-  dialogWidth: 500,
-  dialogType: "drawer",
   column: [
     {
       label: '月份',
       prop: 'yearAndMonth',
-      span: 24,
-      width: 60,
+      width: 65,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '研发项目编号',
       prop: 'xmbh',
-      span: 24,
       width: 100,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '研发项目名称',
       prop: 'xmmc',
-      span: 24,
-      width: 120,
-      search: true,
-      showOverflowTooltip: true,
+      width: 360,
     },
     {
       label: '资产编号',
       prop: 'zcbm',
-      type: 'input',
-      span: 24,
       width: 100,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '资产名称',
       prop: 'zcmc',
-      type: 'input',
-      span: 24,
-      minWidth: 120,
-      search: true,
-      showOverflowTooltip: true,
+      width: 260,
     },
     {
       label: '资产类别',
       prop: 'zclb',
-      type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zclb',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
-      span: 24,
       width: 90,
       align: 'center',
-      showOverflowTooltip: true,
-      search: true,
     },
     {
       label: '用途',
       prop: 'yt',
-      type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zcyt',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
-      search: true,
-      span: 24,
       width: 65,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '资产原值(元)',
       prop: 'zcyz',
-      type: 'number',
-      span: 24,
       width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '净残值率(%)',
       prop: 'jcz',
-      type: 'number',
-      span: 24,
       width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
-      formatter:(row, value)=>{
-        return value+'%'
-      }
     },
     {
       label: '月折旧额(每台/套)',
       prop: 'yzje',
-      type: 'number',
-      span: 24,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '月总工时',
       prop: 'attendanceHours',
-      type: 'number',
-      span: 24,
-      minWidth: 70,
+      width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '月研发工时',
       prop: 'workHours',
-      type: 'number',
-      span: 24,
-      minWidth: 70,
+      width: 90,
       align: 'center',
-      search: true,
-      showOverflowTooltip: true,
     },
     {
       label: '研发分摊率(%)',
       prop: 'yanfaFenTanLv',
-      type: 'number',
-      span: 24,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '研发折旧费用',
       prop: 'yanfaTanXiao',
-      type: 'number',
-      span: 24,
-      minWidth: 70,
+      width: 90,
       align: 'center',
-      showOverflowTooltip: true,
     },
   ],
 };

+ 6 - 88
src/printOption/yfCostManage/yfCostStatistics/hourseDepreAllocation.js

@@ -1,161 +1,79 @@
 export default {
-  height: 'auto',
-  calcHeight: 30,
-  tip: false,
-  searchShow: true,
-  searchMenuSpan: 6,
-  border: true,
-  index: true,
-  addBtn: false,
-  delBtn: false,
-  searchLabelWidth: 140,
-  labelWidth: 110,
-  menuWidth: 80,
-  dialogClickModal: false,
-  dialogWidth: 500,
-  dialogType: "drawer",
   column: [
     {
       label: '月份',
       prop: 'yearAndMonth',
-      span: 24,
       width: 60,
       align: 'center',
-      display: false,
-      showOverflowTooltip: true,
     },
     {
       label: '研发项目编号',
       prop: 'xmbh',
-      span: 24,
       width: 100,
       align: 'center',
-      display: false,
-      showOverflowTooltip: true,
     },
     {
       label: '研发项目名称',
       prop: 'xmmc',
-      span: 24,
-      width: 120,
-      search: true,
-      display: false,
-      showOverflowTooltip: true,
+      width: 300,
     },
     {
       label: '资产编号',
       prop: 'zcbm',
-      type: 'input',
-      span: 24,
       width: 90,
       align: 'center',
-      display: false,
-      showOverflowTooltip: true,
     },
     {
       label: '资产名称',
       prop: 'zcmc',
-      type: 'input',
-      span: 24,
-      minWidth: 120,
-      search: true,
-      display: false,
-      showOverflowTooltip: true,
+      width: 260,
     },
     {
       label: '资产类别',
       prop: 'zclb',
-      type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zclb',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
-      span: 24,
       width: 90,
       align: 'center',
-      display: false,
-      showOverflowTooltip: true,
-      search: true,
     },
     {
       label: '用途',
       prop: 'yt',
-      type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zcyt',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
-      search: true,
-      span: 24,
       width: 65,
       align: 'center',
-      display: false,
-      showOverflowTooltip: true,
     },
     {
       label: '资产原值(元)',
       prop: 'zcyz',
-      type: 'number',
-      span: 24,
       width: 90,
       align: 'center',
-      search: true,
-      display: false,
-      showOverflowTooltip: true,
     },
     {
       label: '净残值率(%)',
       prop: 'jcz',
-      type: 'number',
-      span: 24,
       width: 90,
       align: 'center',
-      search: true,
-      display: false,
-      showOverflowTooltip: true,
-      formatter:(row, value)=>{
-        return value+'%'
-      }
     },
     {
       label: '月折旧额(每台/套)',
       prop: 'yzje',
-      type: 'number',
-      span: 24,
-      minWidth: 120,
+      width: 120,
       align: 'center',
-      search: true,
-      display: false,
-      showOverflowTooltip: true,
     },
     {
       label: '研发分摊率(%)',
       prop: 'yanfaFenTanLv',
-      type: 'number',
-      span: 24,
-      min: 0,
-      minWidth: 90,
+      width: 90,
       align: 'center',
-      showOverflowTooltip: true,
     },
     {
       label: '分摊确定依据',
       prop: 'fenTanLvQueDingYiJu',
-      span: 24,
-      minWidth: 120,
-      showOverflowTooltip: true,
+      width: 140,
     },
     {
       label: '研发折旧',
       prop: 'yanfaTanXiao',
-      type: 'number',
-      span: 24,
-      minWidth: 70,
+      width: 90,
       align: 'center',
-      display: false,
-      showOverflowTooltip: true,
     },
   ],
 };

+ 20 - 6
src/views/yf-cost-manage/yf-cost-statistics/wxzc-cost-statistics/amortize-cost-summary-list.vue

@@ -89,10 +89,15 @@
       ref="printWideTable"
       :columns="wideTableColumns"
       :data="data"
-      :print-title="printTitle"
+      :print-title="pageTitle"
       :rows-per-page="30"
       :default-landscape="true"
-    />
+      :zoom="80"
+    >
+      <template slot="tableFooter">
+        <div>研发负责人签字:</div>
+      </template>
+    </WideTablePrinter>
   </basic-container>
 </template>
 
@@ -126,6 +131,13 @@ export default window.$crudCommon({
       this.getList(this.page);
     }
   },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
+
+      return `${yearAndMonthCN}无形资产摊销费用分配表`;
+    }
+  },
   methods: {
     getSearchParams() {
       let newParams = { ...this.params, ...this.extraParams };
@@ -140,7 +152,7 @@ export default window.$crudCommon({
     },
     handleExport() {
       exportBlob(`/api/kd-scientific/lease/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `无形资产摊销费用分配表${this.params.yearAndMonth}.xlsx`);
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
       });
     },
     /**
@@ -148,8 +160,8 @@ export default window.$crudCommon({
      * @param isLandscape 是否横向打印
      */
     printTable(isLandscape) {
-      this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `无形资产摊销费用分配表${this.params.yearAndMonth}`;
+      this.wideTableColumns = this.printOption.column;
+
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       })
@@ -158,8 +170,10 @@ export default window.$crudCommon({
 }, {
   // 模块路径
   name: 'yfCostManage/yfCostStatistics/amortizeCostSummaryList',
-  res: ({ data }) => {
+  res: ({ data }, _this) => {
     data.records = data.records.map(item => {
+
+      item.yearAndMonth = _this.params.yearAndMonth;
       item.zcbm = item.asset ? item.asset.zcbm : '';
       item.zcmc = item.asset ? item.asset.zcmc : '';
       item.zclb = item.asset ? item.asset.zclb : '';

+ 17 - 6
src/views/yf-cost-manage/yf-cost-statistics/zjfy-cost-statistics/dev-depre-allocation.vue

@@ -76,10 +76,15 @@
       ref="printWideTable"
       :columns="wideTableColumns"
       :data="data"
-      :print-title="printTitle"
+      :print-title="pageTitle"
       :rows-per-page="30"
       :default-landscape="true"
-    />
+      :zoom="80"
+    >
+      <template slot="tableFooter">
+        <div>研发负责人签字:</div>
+      </template>
+    </WideTablePrinter>
   </basic-container>
 </template>
 
@@ -111,6 +116,12 @@ export default window.$crudCommon({
     'params.yearAndMonth'(newVal) {
       this.page.currentPage = 1;
       this.getList(this.page);
+    },
+  },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
+      return `${yearAndMonthCN}科研仪器设备折旧费用分配表`;
     }
   },
   methods: {
@@ -127,7 +138,7 @@ export default window.$crudCommon({
     },
     handleExport() {
       exportBlob(`/api/kd-scientific/asset/kyyqsbzjfyfpb?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `${this.params.yearAndMonth}科研仪器设备折旧费用分配表.xlsx`);
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
       });
     },
     /**
@@ -135,8 +146,8 @@ export default window.$crudCommon({
      * @param isLandscape 是否横向打印
      */
     printTable(isLandscape) {
-      this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `${this.params.yearAndMonth}科研仪器设备折旧费用分配表`;
+      this.wideTableColumns = this.printOption.column;
+
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       })
@@ -148,7 +159,7 @@ export default window.$crudCommon({
   res: ({ data }) => {
     data.records = data.records.map(item => {
       let _yanfaFenTanLv = item.yanfaFenTanLv;
-
+      
       item.zcbm = item.asset ? item.asset.zcbm : '';
       item.zcmc = item.asset ? item.asset.zcmc : '';
       item.zclb = item.asset ? item.asset.zclb : '';

+ 18 - 6
src/views/yf-cost-manage/yf-cost-statistics/zjfy-cost-statistics/hourse-depre-allocation.vue

@@ -58,10 +58,15 @@
       ref="printWideTable"
       :columns="wideTableColumns"
       :data="data"
-      :print-title="printTitle"
+      :print-title="pageTitle"
       :rows-per-page="30"
       :default-landscape="true"
-    />
+      :zoom="80"
+    >
+      <template slot="tableFooter">
+        <div>研发负责人签字:</div>
+      </template>
+    </WideTablePrinter>
   </basic-container>
 </template>
 
@@ -95,6 +100,12 @@ export default window.$crudCommon({
       this.getList(this.page);
     }
   },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
+      return `${yearAndMonthCN}科研房屋建筑物折旧费用分配表`;
+    }
+  },
   methods: {
     getSearchParams() {
       let newParams = { ...this.params, ...this.extraParams };
@@ -112,7 +123,7 @@ export default window.$crudCommon({
     },
     handleExport() {
       exportBlob(`/api/kd-scientific/lease/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `${this.params.yearAndMonth}科研房屋建筑物折旧费用分配表.xlsx`);
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
       });
     },
     /**
@@ -120,8 +131,7 @@ export default window.$crudCommon({
      * @param isLandscape 是否横向打印
      */
     printTable(isLandscape) {
-      this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `${this.params.yearAndMonth}科研房屋建筑物折旧费用分配表`;
+      this.wideTableColumns = this.printOption.column;
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       })
@@ -130,9 +140,11 @@ export default window.$crudCommon({
 }, {
   // 模块路径
   name: 'yfCostManage/yfCostStatistics/hourseDepreAllocation',
-  res: ({ data }) => {
+  res: ({ data }, _this) => {
     data.records = data.records.map(item => {
       let yanfaFenTanLvDec = new Decimal(item.yanfaFenTanLv || 0);
+
+      item.yearAndMonth = _this.params.yearAndMonth;
       item.zcbm = item.asset ? item.asset.zcbm : '';
       item.zcmc = item.asset ? item.asset.zcmc : '';
       item.zclb = item.asset ? item.asset.zclb : '';

+ 49 - 10
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/components/common-list.vue

@@ -1,12 +1,29 @@
 <template>
-  <avue-crud class="cl-crud" :option="options" :data="data">
-    <template slot="menuLeft">
-      <div style="display: flex; align-items: center;">
-        <div style="margin-right: 50px;">研发项目编号:{{ data[0].xmbh }}</div>
-        <div>项目项目名称:{{ data[0].xmmc }}</div>
+  <div class="table-wrap">
+    <div style="display: flex; width: 100%; align-items: center; justify-content: space-between;">
+      <div class="left">
+        <div style="display: flex; align-items: center;">
+          <div style="margin-right: 50px;">研发项目编号:{{ currProjectObj.xmbh }}</div>
+          <div>项目项目名称:{{ currProjectObj.xmmc }}</div>
+        </div>
       </div>
-    </template>
-  </avue-crud>
+      <div class="right">
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          style="margin-right: 10px;"
+        >
+          导出
+        </el-button>
+        <print-table-btn @click="printTable" />
+      </div>
+      
+    </div>
+    <avue-crud ref="crud" class="cl-crud" :option="options" :data="data"></avue-crud>
+  </div>
+  
 </template>
 
 <script>
@@ -19,7 +36,6 @@ export default {
     }
   },
   data() {
-    console.log(this.type)
     let codeLabel = '材料编号';
     let nameLabel = '材料名称';
     if (this.type === '动力') {
@@ -113,14 +129,37 @@ export default {
       },
     };
   },
-  methods: {},
+  computed: {
+    currProjectObj() {
+      return this.data.length ? this.data[0] : {}
+    }
+  },
+  methods: {
+    handleExport() {
+
+    },
+    printTable() {
+      let tableColumns = this.$refs.crud.tableOption.column.map(item => {
+        if (item.prop == 'name') {
+          item.width = 300;
+        }
+        return item;
+      });
+
+      let tableList = [...this.$refs.crud.list];
+      if (tableList.length) {
+        tableList.push(this.$refs.crud.sumsList);
+      }
+      this.$emit("printClick", { column: tableColumns, data: tableList, projectData: this.currProjectObj });
+    }
+  },
 };
 </script>
 
 <style lang="scss">
 .cl-crud {
   .avue-crud__header {
-    min-height: 26px;
+    min-height: 0 !important;
   }
 }
 </style>

+ 60 - 29
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/components/common-page.vue

@@ -19,26 +19,39 @@
         <el-button :size="size" icon="el-icon-delete" @click="handleResetBtn">清空</el-button>
       </template>
     </avue-form>
-    <div>
-      <el-button
-        type="warning"
-        size="small"
-        plain
-        icon="el-icon-download"
-        @click="handleExport"
-        style="margin-right: 10px;"
-      >
-        导出
-      </el-button>
-      <print-table-btn />
-    </div>
     <div style="display: flex; align-items: center;">
       <year-month-select v-model="yearAndMonth" :showAllYear="false" style="margin: 6px 0 20px;"></year-month-select>
     </div>
     <template v-if="listData.length">
-      <common-list v-for="(item, index) of listData" :data="item" :type="type" :key="index" style="margin-bottom: 25px;"></common-list>
+      <common-list v-for="(item, index) of listData" :data="item" :type="type" :key="index" style="margin-bottom: 25px;" @printClick="handlePrintClick"></common-list>
     </template>
     <el-empty v-else description="暂无数据"></el-empty>
+
+    <WideTablePrinter
+      ref="printWideTable"
+      :columns="wideTableColumns"
+      :data="wideTableData"
+      :print-title="pageTitle"
+      :rows-per-page="30"
+      :default-landscape="true"
+      :zoom="95"
+    >
+      <template slot="tableHeader">
+        <div>
+          <span style="margin-right: 140px;">{{ `研发项目编号:${currProject.xmbh}` }}</span>
+          <span>{{ `研发项目名称:${currProject.xmmc}` }}</span>
+        </div>
+      </template>
+      <template slot="tableFooter">
+        <div>
+          <span style="margin-right: 140px;">发料人:</span>
+          <span>发料人:</span>
+        </div>
+        <div style="margin-top: 6px;">
+          <span>项目负责人:</span>
+        </div>
+      </template>
+    </WideTablePrinter>
   </basic-container>
 </template>
 
@@ -46,9 +59,6 @@
 import YearMonthSelect from "@/components/year-month-select";
 import commonList from "./common-list.vue";
 import { getList } from "@/api/yfCostManage/yfCostStatistics/clCost";
-import {exportBlob} from "@/api/common";
-import {getToken} from "@/util/auth";
-import {downloadXls} from "@/util/util";
 import moment from "moment";
 import Decimal from "decimal.js";
 
@@ -65,6 +75,15 @@ export default {
     commonList
   },
   data() {
+    let codeLabel = '材料编号';
+    let nameLabel = '材料名称';
+    if (this.type === '动力') {
+      codeLabel = '动力编号';
+      nameLabel = '动力名称';
+    } else if (this.type === '燃料') {
+      codeLabel = '燃料编号';
+      nameLabel = '燃料名称';
+    }
     return {
       loading: false,
       searchOption: {
@@ -91,6 +110,10 @@ export default {
 
       yearAndMonth: "",
       params: {},
+
+      wideTableColumns: [],
+      wideTableData: [],
+      currProject: {}
     }
   },
   watch: {
@@ -98,6 +121,18 @@ export default {
       this.loadData();
     }
   },
+  computed: {
+    pageTitle() {
+      let title = '研发项目领料单';
+      if (this.type == '动力') {
+        title = '研发动力消耗单';
+      } else if (this.type == '燃料') {
+        title = '研发燃料消耗单';
+      }
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
+      return `${yearAndMonthCN}${title}`;
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params };
@@ -122,7 +157,6 @@ export default {
                 childItem.amount = new Decimal(childItem.unitPrice || 0).mul(new Decimal(childItem.useQuantity || 0)).toFixed(2);
                 return childItem;
               })
-              console.log(newList)
               allList.push(newList);
             });
           });
@@ -133,17 +167,6 @@ export default {
         this.loading = false;
       });
     },
-    handleExport() {
-      let title = '研发项目领料单';
-      if (this.type == '动力') {
-        title = '研发动力消耗单';
-      } else if (this.type == '燃料') {
-        title = '研发燃料消耗单';
-      }
-      exportBlob(`/api/kd-scientific/goods/yanfalingliaodan/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `${this.params.yearAndMonth}${title}.xlsx`);
-      });
-    },
     handleSearchBtn() {
       this.loadData();
     },
@@ -152,6 +175,14 @@ export default {
       this.$refs.searchForm.resetForm();
       this.loadData();
     },
+    handlePrintClick({ column, data, projectData }) {
+      this.wideTableColumns = [...column];
+      this.wideTableData = data;
+      this.currProject = projectData;
+      this.$nextTick(() => {
+        this.$refs.printWideTable.printTable(true);
+      })
+    }
   },
 }
 </script>

+ 47 - 8
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/dev-cost/components/common-list.vue

@@ -1,12 +1,28 @@
 <template>
-  <avue-crud class="cl-crud" :option="options" :data="data">
-    <template slot="menuLeft">
-      <div style="display: flex; align-items: center;">
-        <div style="margin-right: 50px;">研发项目编号:{{ data[0].xmbh }}</div>
-        <div>项目项目名称:{{ data[0].xmmc }}</div>
+  <div class="table-wrap">
+    <div style="display: flex; width: 100%; align-items: center; justify-content: space-between;">
+      <div class="left">
+        <div style="display: flex; align-items: center;">
+          <div style="margin-right: 50px;">研发项目编号:{{ currProjectObj.xmbh }}</div>
+          <div>项目项目名称:{{ currProjectObj.xmmc }}</div>
+        </div>
       </div>
-    </template>
-  </avue-crud>
+      <div class="right">
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          style="margin-right: 10px;"
+        >
+          导出
+        </el-button>
+        <print-table-btn @click="printTable" />
+      </div>
+      
+    </div>
+    <avue-crud ref="crud" class="cl-crud" :option="options" :data="data"></avue-crud>
+  </div>
 </template>
 
 <script>
@@ -94,7 +110,30 @@ export default {
       },
     };
   },
-  methods: {},
+  computed: {
+    currProjectObj() {
+      return this.data.length ? this.data[0] : {}
+    }
+  },
+  methods: {
+    handleExport() {
+      this.$message.warning("功能建设中...");
+    },
+    printTable() {
+      let tableColumns = this.$refs.crud.tableOption.column.map(item => {
+        if (item.prop == 'name') {
+          item.width = 300;
+        }
+        return item;
+      });
+
+      let tableList = [...this.$refs.crud.list];
+      if (tableList.length) {
+        tableList.push(this.$refs.crud.sumsList);
+      }
+      this.$emit("printClick", { column: tableColumns, data: tableList, projectData: this.currProjectObj });
+    }
+  },
 };
 </script>
 

+ 41 - 9
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/dev-cost/yf-lease-allocation-list.vue

@@ -36,9 +36,31 @@
       <year-month-select v-model="yearAndMonth" :showAllYear="false" style="margin: 6px 0 20px;"></year-month-select>
     </div>
     <template v-if="listData.length">
-      <common-list v-for="(item, index) of listData" :data="item" :type="type" :key="index" style="margin-bottom: 25px;"></common-list>
+      <common-list v-for="(item, index) of listData" :data="item" :key="index" @printClick="handlePrintClick" style="margin-bottom: 25px;"></common-list>
     </template>
     <el-empty v-else description="暂无数据"></el-empty>
+
+    <WideTablePrinter
+      ref="printWideTable"
+      :columns="wideTableColumns"
+      :data="wideTableData"
+      :print-title="pageTitle"
+      :rows-per-page="30"
+      :default-landscape="true"
+      :zoom="95"
+    >
+      <template slot="tableHeader">
+        <div>
+          <span style="margin-right: 140px;">{{ `研发项目编号:${currProject.xmbh}` }}</span>
+          <span>{{ `研发项目名称:${currProject.xmmc}` }}</span>
+        </div>
+      </template>
+      <template slot="tableFooter">
+        <div style="margin-top: 6px;">
+          <span>项目负责人:</span>
+        </div>
+      </template>
+    </WideTablePrinter>
   </basic-container>
 </template>
 
@@ -46,9 +68,6 @@
 import YearMonthSelect from "@/components/year-month-select";
 import commonList from "./components/common-list.vue";
 import { getList } from "@/api/yfCostManage/yfCostStatistics/yfLeaseAllocationList";
-import {exportBlob} from "@/api/common";
-import {getToken} from "@/util/auth";
-import {downloadXls} from "@/util/util";
 import moment from "moment";
 
 export default {
@@ -89,6 +108,10 @@ export default {
 
       yearAndMonth: "",
       params: {},
+
+      wideTableColumns: [],
+      wideTableData: [],
+      currProject: {}
     }
   },
   watch: {
@@ -96,6 +119,12 @@ export default {
       this.loadData();
     }
   },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
+      return `${yearAndMonthCN}研发租赁费用分配表`;
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params };
@@ -124,11 +153,6 @@ export default {
         this.loading = false;
       });
     },
-    handleExport() {
-      exportBlob(`/api/kd-scientific/lease/yfzlzcfyfpb/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `${this.params.yearAndMonth}研发租赁资产费用分配表.xlsx`);
-      });
-    },
     handleSearchBtn() {
       this.loadData();
     },
@@ -137,6 +161,14 @@ export default {
       this.$refs.searchForm.resetForm();
       this.loadData();
     },
+    handlePrintClick({ column, data, projectData }) {
+      this.wideTableColumns = [...column];
+      this.wideTableData = data;
+      this.currProject = projectData;
+      this.$nextTick(() => {
+        this.$refs.printWideTable.printTable(true);
+      })
+    }
   },
 }
 </script>