pilosityFewerModal.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <a-modal
  3. title="多发少发"
  4. v-model="pilosityFewerModVis"
  5. :confirmLoading="confirmLoading"
  6. width="86%"
  7. style="top:330px;left:100px;minHeight:700px"
  8. :footer="null"
  9. >
  10. <!-- tabel 加载 -->
  11. <a-spin :spinning="confirmLoading">
  12. <!-- 回显信息 -->
  13. <div class="table-page-search-wrapper" style="marginTop:20px;">
  14. <!-- <a-form layout="inline" @keyup.enter.native="searchQuery">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-item label="存货名称">
  18. <a-input v-model="pilosityFewerList.goodsName"></a-input>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-item label="色号">
  23. <a-input v-model="pilosityFewerList.color"></a-input>
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-item label="计划数量">
  28. <a-input v-model="pilosityFewerList.planQuantity"></a-input>
  29. </a-form-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-item label="购入数量">
  33. <a-input v-model="pilosityFewerList.purchaseQuantity"></a-input>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :md="6" :sm="8">
  37. <a-form-item label="多发少发">
  38. <a-input v-model="pilosityFewerList.pilosityFewer"></a-input>
  39. </a-form-item>
  40. </a-col> -->
  41. <!-- <a-col :md="6" :sm="8">
  42. <a-form-item label="备注">
  43. <a-input v-model="pilosityFewerList.styleNumber"></a-input>
  44. </a-form-item>
  45. </a-col> -->
  46. <!-- <a-col :md="24" :sm="24">
  47. <a-form-item label="备注" class="noteBg">
  48. <a-input type="textarea" v-model="pilosityFewerList.remarks" style="minHeight:100px;"></a-input> -->
  49. <a-table
  50. bordered
  51. :loading="loading"
  52. :columns="pilosityFewerColumns"
  53. :data-source="pilosityFewerList"
  54. :pagination="false"
  55. :scroll="{ y: 500 }"
  56. >
  57. <span slot="color" slot-scope="text,record">
  58. <a-input placeholder="请输入" v-model="record.color" />
  59. </span>
  60. <span slot="remarks" slot-scope="text,record">
  61. <a-input placeholder="请输入" v-model="record.remarks" />
  62. </span>
  63. </a-table>
  64. <!-- 导出 打印 返回 -->
  65. <a-row style="marginTop:20px;">
  66. <a-col :md="24" :sm="12">
  67. <span style="float: right;" class="table-operator">
  68. <a-button type="primary" icon="download" @click="handleExportXls('多发少发')">导出</a-button>
  69. <!-- <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
  70. <a-button type="primary" @click="backFabricLossTable" icon="rollback">返回</a-button>
  71. </span>
  72. </a-col>
  73. </a-row>
  74. <!-- </a-col>
  75. </a-row>
  76. </a-form> -->
  77. </div>
  78. </a-spin>
  79. </a-modal>
  80. </template>
  81. <script>
  82. import { downFile,downFile1 } from '@/api/manage'
  83. export default {
  84. name: 'pilosityFewerListModal', // 事故单 弹框
  85. components: {},
  86. data() {
  87. return {
  88. loading: false,
  89. confirmLoading: false,
  90. pilosityFewerModVis: false,
  91. planNum:'',
  92. pilosityFewerList: [],
  93. pilosityFewerColumns:[
  94. {
  95. title: '存货名称',
  96. dataIndex: 'goodsName',
  97. width: 120,
  98. className: 'replacecolor'
  99. },
  100. {
  101. title: '色号',
  102. dataIndex: 'color',
  103. width: 120,
  104. className: 'replacecolor',
  105. scopedSlots: { customRender: 'color' },
  106. },
  107. {
  108. title: '计划数量',
  109. dataIndex: 'planQuantity',
  110. width: 120,
  111. className: 'replacecolor'
  112. },
  113. {
  114. title: '购入数量',
  115. dataIndex: 'purchaseQuantity',
  116. width: 120,
  117. className: 'replacecolor'
  118. },
  119. {
  120. title: '多发少发',
  121. dataIndex: 'pilosityFewer',
  122. width: 120,
  123. className: 'replacecolor'
  124. },
  125. {
  126. title: '备注',
  127. dataIndex: 'remarks',
  128. width: 120,
  129. className: 'replacecolor',
  130. scopedSlots: { customRender: 'remarks' },
  131. },
  132. ]
  133. }
  134. },
  135. // 接收父组件 方法
  136. props: {
  137. father: {
  138. type: Function,
  139. default: null
  140. },
  141. planNum:{
  142. type: String,
  143. default: null
  144. }
  145. },
  146. created() {},
  147. methods: {
  148. // 导出
  149. handleExportXls(fileName) {
  150. console.log('需导出的fileName:', fileName)
  151. const params = {
  152. planNum:this.planNum,
  153. syPilosityFewer :this.pilosityFewerList,
  154. sheetName:'多发少发'
  155. }
  156. console.log('导出参数', params)
  157. downFile1('/cost/syCostAllocation/exportXlsSyCostAllocation', params).then(data => {
  158. console.log('888')
  159. if (!data) {
  160. this.$message.warning('文件下载失败')
  161. return
  162. }
  163. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  164. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), this.planNum+'-'+fileName + '.xlsx')
  165. } else {
  166. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  167. let link = document.createElement('a')
  168. link.style.display = 'none'
  169. link.href = url
  170. link.setAttribute('download', fileName + '.xlsx')
  171. document.body.appendChild(link)
  172. link.click()
  173. document.body.removeChild(link) // 下载完成移除元素
  174. window.URL.revokeObjectURL(url) // 释放掉blob对象
  175. }
  176. })
  177. },
  178. // 打印
  179. print() {},
  180. // 返回
  181. backFabricLossTable() {
  182. console.log('返回到面料损耗表')
  183. this.pilosityFewerModVis = false
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="less" scoped>
  189. @import '~@assets/less/common.less';
  190. @import '~@assets/less/overwriter.less';
  191. /deep/ .ant-table-thead > tr > th {
  192. text-align: center;
  193. // font-weight: 700;
  194. }
  195. /deep/ .ant-table-tbody {
  196. text-align: center;
  197. }
  198. // /deep/ th.replacecolor {
  199. // background-color: #ccc;
  200. // }
  201. </style>