invoiceQuantityModal.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <a-modal
  3. title="发票数量"
  4. v-model="invoiceQuantityModVis"
  5. :confirmLoading="confirmLoading"
  6. width="86%"
  7. :footer="null"
  8. >
  9. <!-- tabel 加载 -->
  10. <a-spin :spinning="confirmLoading">
  11. <!-- table -->
  12. <div style="marginTop:30px;">
  13. <a-table
  14. :loading="loading"
  15. :columns="invoiceQuantityColumns"
  16. :data-source="invoiceQuantityData"
  17. :pagination="false"
  18. bordered
  19. :scroll="{ y: 500 }"
  20. :footer="showTotal"
  21. >
  22. </a-table>
  23. <!-- 导出 打印 返回 -->
  24. <a-row>
  25. <a-col :md="24" :sm="12" style="marginTop:20px;">
  26. <span style="float: right;" class="table-operator">
  27. <a-button type="primary" icon="download" @click="handleExportXls('采购数量')">导出</a-button>
  28. <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button>
  29. <a-button type="primary" @click="backFabricLossTable" icon="rollback">返回</a-button>
  30. </span>
  31. </a-col>
  32. </a-row>
  33. </div>
  34. </a-spin>
  35. </a-modal>
  36. </template>
  37. <script>
  38. export default {
  39. name: 'InvoiceQuantityModal', // 发票数量 弹框
  40. components: {},
  41. data() {
  42. return {
  43. // 表头
  44. invoiceQuantityColumns: [
  45. {
  46. title: '序号',
  47. width:80,
  48. customRender: (text, record, index) => {
  49. if (record.cinvName == "合计")
  50. return "合计";
  51. else
  52. return index + 1;
  53. }
  54. },
  55. {
  56. title: '开票数',
  57. dataIndex: 'iquantityInvoice',
  58. width: 120,
  59. key: '',
  60. className: 'replacecolor'
  61. },
  62. {
  63. title: '未开票数',
  64. dataIndex: 'iquantityInvoiceN',
  65. width: 120,
  66. key: '',
  67. className: 'replacecolor'
  68. },
  69. {
  70. title: '结算数量',
  71. dataIndex: 'iquantitySettle',
  72. width: 120,
  73. key: '',
  74. className: 'replacecolor'
  75. },
  76. {
  77. title: '未结算数量',
  78. dataIndex: 'iquantitySettleN',
  79. width: 120,
  80. key: '',
  81. className: 'replacecolor'
  82. }
  83. ],
  84. invoiceQuantityData: [],
  85. allDataList:[],
  86. size: 'small', // 查询按钮变小
  87. loading: false, // 表格加载
  88. // orderDataform: this.$form.createForm(this),
  89. confirmLoading: false,
  90. invoiceQuantityModVis: false
  91. }
  92. },
  93. // 接收父组件 方法
  94. props: {
  95. father: {
  96. type: Function,
  97. default: null
  98. }
  99. },
  100. created() {},
  101. computed: {
  102. // 合计展示
  103. totalDataSource(){
  104. // 开票成本-衬衣 合计
  105. var item = {
  106. "cinvName":"合计"
  107. };
  108. var iquantityInvoice = 0,iquantityInvoiceN = 0, iquantitySettle=0, iquantitySettleN=0;
  109. for (let row of this.invoiceQuantityData){
  110. iquantityInvoice += row.iquantityInvoice*1;
  111. iquantityInvoiceN += row.iquantityInvoiceN*1;
  112. iquantitySettle += row.iquantitySettle*1;
  113. iquantitySettleN += row.iquantitySettleN*1;
  114. }
  115. item.iquantityInvoice= parseFloat(iquantityInvoice.toFixed(4));
  116. item.iquantityInvoiceN= parseFloat(iquantityInvoiceN.toFixed(4));
  117. item.iquantitySettle= parseFloat(iquantitySettle.toFixed(4));
  118. item.iquantitySettleN= parseFloat(iquantitySettleN.toFixed(4));
  119. return [item];
  120. }
  121. },
  122. methods: {
  123. // 第一行 导出
  124. handleExportXls() {},
  125. // 打印
  126. print() {},
  127. // 返回
  128. backFabricLossTable() {
  129. console.log('返回到面料损耗表')
  130. // this.$router.push('fabricLoss-table')
  131. // this.invoiceQuantityModVis = false
  132. this.close()
  133. },
  134. close() {
  135. this.$emit('close')
  136. this.invoiceQuantityModVis = false
  137. },
  138. showTotal(data) {
  139. return (
  140. <a-table
  141. rowKey={Math.random}
  142. bordered={false}
  143. pagination={false}
  144. columns={this.invoiceQuantityColumns}
  145. dataSource={this.totalDataSource || []}
  146. showHeader={false}
  147. ></a-table>
  148. )
  149. },
  150. }
  151. }
  152. </script>
  153. <style lang="less" scoped>
  154. @import '~@assets/less/common.less';
  155. @import '~@assets/less/overwriter.less';
  156. /deep/ .ant-table-thead > tr > th {
  157. text-align: center;
  158. // font-weight: 700;
  159. }
  160. /deep/ .ant-table-tbody {
  161. text-align: center;
  162. }
  163. // /deep/ th.replacecolor {
  164. // background-color: #ccc;
  165. // }
  166. </style>