fabRemQuaModal.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <!-- 面料 余下数量 弹框 成本分配统计表 -->
  3. <a-modal
  4. title="面料 - 余下数量"
  5. v-model="fabRemQuaModVis"
  6. :confirmLoading="confirmLoading"
  7. width="86%"
  8. style="top:330px;left:100px;"
  9. :footer="null"
  10. >
  11. <!-- tabel 加载 -->
  12. <a-spin :spinning="confirmLoading">
  13. <a-table :loading="loading" bordered :columns="columns" :data-source="data" :pagination="false"> </a-table>
  14. <!-- 导出 打印 返回 -->
  15. <a-row style="marginTop:20px;">
  16. <a-col :md="24" :sm="12">
  17. <span style="float: right;" class="table-operator">
  18. <a-button type="primary" icon="download" @click="handleExportXls('成本分配-面料-转入数量')">导出</a-button>
  19. <!-- <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
  20. <a-button type="primary" @click="cancel" icon="rollback">取消</a-button>
  21. </span>
  22. </a-col>
  23. </a-row>
  24. </a-spin>
  25. </a-modal>
  26. </template>
  27. <script>
  28. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  29. import JEllipsis from '@/components/jeecg/JEllipsis'
  30. import moment from 'moment'
  31. import { downFile,downFile1 } from '@/api/manage'
  32. export default {
  33. name: 'FabRemQuaModal', // 面料 余下数量 弹框
  34. mixins: [JeecgListMixin],
  35. components: { JEllipsis, moment },
  36. data() {
  37. return {
  38. columns: [
  39. {
  40. title: '存货名称',
  41. dataIndex: 'goodsName',
  42. width: 120,
  43. className: 'replacecolor'
  44. },
  45. {
  46. title: '颜色',
  47. dataIndex: 'color',
  48. width: 120,
  49. className: 'replacecolor'
  50. },
  51. {
  52. title: '计划单号',
  53. dataIndex: 'planCode',
  54. width: 120,
  55. className: 'replacecolor'
  56. },
  57. {
  58. title: '使用数量',
  59. dataIndex: 'number',
  60. width: 120,
  61. className: 'replacecolor'
  62. },
  63. {
  64. title: '单位成本',
  65. dataIndex: 'unitCost',
  66. width: 120,
  67. className: 'replacecolor',
  68. customRender: (text, record, index) => {
  69. var re = Number(text).toFixed(4)
  70. return re
  71. }
  72. },
  73. {
  74. title: '总成本',
  75. dataIndex: 'cost',
  76. width: 120,
  77. className: 'replacecolor'
  78. }
  79. ],
  80. data: [],
  81. loading: false,
  82. confirmLoading: false,
  83. fabRemQuaModVis: false
  84. }
  85. },
  86. // 接收父组件 方法
  87. props: {
  88. father: {
  89. type: Function,
  90. default: null
  91. }
  92. },
  93. methods: {
  94. // 导出
  95. handleExportXls(fileName) {
  96. console.log('需导出的fileName:', fileName)
  97. const params = {
  98. planNum:this.planNum,
  99. syRemaining :this.data,
  100. sheetName:'面料余下'
  101. }
  102. console.log('导出参数', params)
  103. // var json = JSON.stringify(params)
  104. // debugger
  105. downFile1('/cost/syCostAllocation/exportXlsSyCostAllocation', params).then(data => {
  106. console.log('888')
  107. if (!data) {
  108. this.$message.warning('文件下载失败')
  109. return
  110. }
  111. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  112. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  113. } else {
  114. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  115. let link = document.createElement('a')
  116. link.style.display = 'none'
  117. link.href = url
  118. link.setAttribute('download', fileName + '.xlsx')
  119. document.body.appendChild(link)
  120. link.click()
  121. document.body.removeChild(link) // 下载完成移除元素
  122. window.URL.revokeObjectURL(url) // 释放掉blob对象
  123. }
  124. })
  125. },
  126. // 打印
  127. print() {},
  128. cancel() {
  129. console.log('返回成本分配统计表')
  130. this.fabRemQuaModVis = false
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="less" scoped>
  136. @import '~@assets/less/common.less';
  137. @import '~@assets/less/overwriter.less';
  138. /deep/ .ant-table-thead > tr > th {
  139. text-align: center;
  140. // font-weight: 700;
  141. }
  142. /deep/ .ant-table-tbody {
  143. text-align: center;
  144. }
  145. // /deep/ th.replacecolor {
  146. // background-color: #ccc;
  147. // }
  148. </style>