fabInQuaModal.vue 4.7 KB

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