surplusYarnModal.vue 6.6 KB

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