invoiceNumModal.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <a-modal
  3. title="发票号码明细"
  4. v-model="invoiceNumModVis"
  5. :confirmLoading="confirmLoading"
  6. width="86%"
  7. :footer="null"
  8. >
  9. <!-- tabel 加载 -->
  10. <a-spin :spinning="confirmLoading">
  11. <!-- 查询 -->
  12. <div class="table-page-search-wrapper">
  13. <a-form layout="inline" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="物料">
  17. <a-input placeholder="请输入物料" v-model="queryParam.cinvName"></a-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  22. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  23. <a-button type="primary" icon="download" @click="exportExcel" style="margin-left: 8px">导出</a-button>
  24. <JsonExcel
  25. :fetch="getExportDataList"
  26. :fields="exportFields"
  27. :header="exportTitle"
  28. name="发票号码明细.xls"
  29. style="display:none"
  30. >
  31. <!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
  32. <a-button type="primary" icon="download" ref="realExportExcel">导出</a-button>
  33. </JsonExcel>
  34. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  35. <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
  36. {{ toggleSearchStatus ? '收起' : '展开' }}
  37. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  38. </a> -->
  39. </span>
  40. </a-col>
  41. </a-row>
  42. </a-form>
  43. </div>
  44. <!-- table -->
  45. <div>
  46. <a-table
  47. bordered
  48. :loading="loading"
  49. :columns="invoiceNumColumns"
  50. :data-source="invoiceNumData"
  51. :pagination="false"
  52. :scroll="{ y: 500 }"
  53. :footer="showTotal"
  54. >
  55. </a-table>
  56. <!-- 导出 打印 返回 -->
  57. <a-row style="marginTop:20px;">
  58. <a-col :md="24" :sm="12">
  59. <span style="float: right;" class="table-operator">
  60. <!-- <a-button type="primary" icon="download" @click="handleExportXls('采购数量')">导出</a-button>
  61. <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
  62. <a-button type="primary" @click="backFabricLossTable" icon="rollback">关闭</a-button>
  63. </span>
  64. </a-col>
  65. </a-row>
  66. </div>
  67. </a-spin>
  68. </a-modal>
  69. </template>
  70. <script>
  71. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  72. import JEllipsis from '@/components/jeecg/JEllipsis'
  73. import JsonExcel from 'vue-json-excel'
  74. export default {
  75. name: 'InvoiceNumModal', // 发票号明细 弹框
  76. mixins: [JeecgListMixin],
  77. components: { JEllipsis,JsonExcel },
  78. data() {
  79. return {
  80. exportTitle:"发票号码明细",
  81. // 表头
  82. invoiceNumColumns: [
  83. {
  84. title: '序号',
  85. width:80,
  86. customRender: (text, record, index) => {
  87. if (record.cinvName == "合计")
  88. return "";
  89. else
  90. return index + 1;
  91. }
  92. },
  93. {
  94. title: '物料',
  95. dataIndex: 'cinvName',
  96. width: 400,
  97. key: '',
  98. className: 'replacecolor'
  99. },
  100. {
  101. title: '数量',
  102. dataIndex: 'iquantity',
  103. width: 120,
  104. key: '',
  105. className: 'replacecolor'
  106. },
  107. {
  108. title: '开票单价',
  109. dataIndex: 'iprice',
  110. width: 120,
  111. key: '',
  112. className: 'replacecolor'
  113. },
  114. {
  115. title: '合计金额',
  116. dataIndex: 'inatSum',
  117. width: 120,
  118. key: '',
  119. className: 'replacecolor'
  120. }
  121. ],
  122. invoiceNumData: [],
  123. allDataList:[],
  124. loading: false, // 表格加载
  125. // orderDataform: this.$form.createForm(this),
  126. confirmLoading: false,
  127. invoiceNumModVis: false,
  128. // 查询条件
  129. queryParam: {
  130. material: '', // 物料
  131. invoicingPrice: '' // 开票单价
  132. }
  133. }
  134. },
  135. // 接收父组件 方法
  136. props: {
  137. father: {
  138. type: Function,
  139. default: null
  140. }
  141. },
  142. created() {},
  143. computed: {
  144. // 合计展示
  145. totalDataSource(){
  146. // 开票成本-衬衣 合计
  147. var item = {
  148. "cinvName":"合计"
  149. };
  150. var iquantity = 0,inatSum = 0;
  151. for (let row of this.invoiceNumData){
  152. iquantity += row.iquantity*1;
  153. inatSum += row.inatSum*1;
  154. }
  155. item.iquantity= parseFloat(iquantity.toFixed(4));
  156. item.inatSum= parseFloat(inatSum.toFixed(2));
  157. return [item];
  158. },
  159. // 获取导出json定义
  160. exportFields(){
  161. var ret = {};
  162. this.invoiceNumColumns.forEach((record,index)=>{
  163. if (record.title != "序号"){
  164. if (record.title != "入库单号")
  165. ret[record.title] = record.dataIndex;
  166. else
  167. ret[record.title] = record.dataIndex+"_ex";
  168. }
  169. });
  170. return ret;
  171. }
  172. },
  173. methods: {
  174. // 第一行 导出
  175. handleExportXls() {},
  176. // 打印
  177. print() {},
  178. // 返回
  179. backFabricLossTable() {
  180. console.log('返回到面料损耗表')
  181. // this.$router.push('fabricLoss-table')
  182. // this.invoiceNumModVis = false
  183. this.close()
  184. },
  185. // 弹框查询按钮
  186. searchQuery() {
  187. this.invoiceNumData = this.allDataList.filter(e=>
  188. (this.queryParam.cinvName == null || e.cinvName.toLowerCase().indexOf(this.queryParam.cinvName.toLowerCase())>-1)
  189. );
  190. },
  191. // 重置
  192. searchReset() {
  193. this.queryParam = {}
  194. // this.getShipmentList()
  195. },
  196. close() {
  197. this.$emit('close')
  198. this.invoiceNumModVis = false
  199. },
  200. showTotal(data) {
  201. return (
  202. <a-table
  203. rowKey={Math.random}
  204. bordered={false}
  205. pagination={false}
  206. columns={this.invoiceNumColumns}
  207. dataSource={this.totalDataSource || []}
  208. showHeader={false}
  209. ></a-table>
  210. )
  211. },
  212. // 导出excel
  213. exportExcel(){
  214. this.$refs.realExportExcel.$el.click();
  215. },
  216. // 生成导出数据
  217. getExportDataList(){
  218. this.invoiceNumData.forEach((item,index)=>{item["ccode_ex"]="&nbsp;"+item["ccode"]});
  219. return this.invoiceNumData;
  220. }
  221. }
  222. }
  223. </script>
  224. <style lang="less" scoped>
  225. @import '~@assets/less/common.less';
  226. @import '~@assets/less/overwriter.less';
  227. /deep/ .ant-table-thead > tr > th {
  228. text-align: center;
  229. // font-weight: 700;
  230. }
  231. /deep/ .ant-table-tbody {
  232. text-align: center;
  233. }
  234. /deep/.ant-modal-body{
  235. height: auto !important;
  236. overflow-y: scroll;
  237. }
  238. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  239. width: calc(100% + 9px);//减去滚动条的宽度
  240. }
  241. // /deep/ th.replacecolor {
  242. // background-color: #ccc;
  243. // }
  244. </style>