fabRemQuaModal.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. planNum:'',
  85. }
  86. },
  87. // 接收父组件 方法
  88. props: {
  89. father: {
  90. type: Function,
  91. default: null
  92. },
  93. planNum:{
  94. type: String,
  95. default: null
  96. }
  97. },
  98. methods: {
  99. // 导出
  100. handleExportXls(fileName) {
  101. console.log('需导出的fileName:', fileName)
  102. const params = {
  103. planNum:this.planNum,
  104. syRemaining :this.data,
  105. sheetName:'面料余下'
  106. }
  107. console.log('导出参数', params)
  108. // var json = JSON.stringify(params)
  109. // debugger
  110. downFile1('/cost/syCostAllocation/exportXlsSyCostAllocation', params).then(data => {
  111. console.log('888')
  112. if (!data) {
  113. this.$message.warning('文件下载失败')
  114. return
  115. }
  116. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  117. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), this.planNum+'-'+fileName + '.xlsx')
  118. } else {
  119. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  120. let link = document.createElement('a')
  121. link.style.display = 'none'
  122. link.href = url
  123. link.setAttribute('download', this.planNum+'-'+fileName + '.xlsx')
  124. document.body.appendChild(link)
  125. link.click()
  126. document.body.removeChild(link) // 下载完成移除元素
  127. window.URL.revokeObjectURL(url) // 释放掉blob对象
  128. }
  129. })
  130. },
  131. // 打印
  132. print() {},
  133. cancel() {
  134. console.log('返回成本分配统计表')
  135. this.fabRemQuaModVis = false
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="less" scoped>
  141. @import '~@assets/less/common.less';
  142. @import '~@assets/less/overwriter.less';
  143. /deep/ .ant-table-thead > tr > th {
  144. text-align: center;
  145. // font-weight: 700;
  146. }
  147. /deep/ .ant-table-tbody {
  148. text-align: center;
  149. }
  150. // /deep/ th.replacecolor {
  151. // background-color: #ccc;
  152. // }
  153. </style>