dye-loss-table.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <!-- 染损表报 -->
  3. <a-card :bordered="false">
  4. <!-- 查询区域 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :md="6" :sm="8">
  9. <a-form-item label="订单号">
  10. <a-input placeholder="请输入订单号" v-model="queryParam.orderNum"></a-input>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="8">
  14. <a-form-item label="订单类型">
  15. <a-select placeholder="请选择订单类型" v-model="queryParam.orderType">
  16. <a-select-option :value="''">请选择</a-select-option>
  17. <a-select-option :value="0">订单类型1</a-select-option>
  18. <a-select-option :value="1">订单类型2</a-select-option>
  19. <a-select-option :value="2">订单类型3</a-select-option>
  20. </a-select>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="8">
  24. <a-form-item label="供应商">
  25. <a-input placeholder="请输入供应商" v-model="queryParam.supplier"></a-input>
  26. </a-form-item>
  27. </a-col>
  28. <template v-if="toggleSearchStatus">
  29. <a-col :md="6" :sm="8">
  30. <a-form-item label="计划单号">
  31. <a-input placeholder="请输入计划单号" v-model="queryParam.planNum"></a-input>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="8">
  35. <a-form-item label="销售订单号">
  36. <a-input placeholder="请输入销售订单号" v-model="queryParam.salesOrderNum"></a-input>
  37. </a-form-item>
  38. </a-col>
  39. </template>
  40. <a-col :md="6" :sm="8">
  41. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  42. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  43. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  44. <a @click="handleToggleSearch" style="margin-left: 8px">
  45. {{ toggleSearchStatus ? '收起' : '展开' }}
  46. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  47. </a>
  48. </span>
  49. </a-col>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. <!-- 操作按钮区域 -->
  54. <div class="table-operator">
  55. <a-button type="primary" @click="handleExportXls('染损报表')" icon="download">导出</a-button>
  56. </div>
  57. <!-- table区域 rowKey="id" :scroll="{ x: 1500 }"-->
  58. <div>
  59. <a-table
  60. ref="tableInfo"
  61. bordered
  62. :row-key="record => record.id"
  63. :columns="dyeLossColumns"
  64. :data-source="dyeLossData"
  65. :loading="loading"
  66. :pagination="ipagination"
  67. @change="handleTableChange"
  68. :footer="totalShow"
  69. :scroll="{ x: 1500 }"
  70. >
  71. </a-table>
  72. </div>
  73. </a-card>
  74. </template>
  75. <script>
  76. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  77. import JEllipsis from '@/components/jeecg/JEllipsis'
  78. import moment from 'moment'
  79. export default {
  80. name: 'DyeLossTable', // 染损报表
  81. mixins: [JeecgListMixin],
  82. components: { JEllipsis, moment },
  83. data() {
  84. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  85. return {
  86. description: '染损报表',
  87. // 表头
  88. dyeLossColumns: [
  89. {
  90. title: '物料编号',
  91. width: 160,
  92. dataIndex: 'materialNum',
  93. className: 'replacecolor'
  94. },
  95. {
  96. title: '物料名称',
  97. width: 160,
  98. dataIndex: 'materialName',
  99. className: 'replacecolor'
  100. },
  101. { title: '颜色', width: 160, dataIndex: 'color', className: 'replacecolor' },
  102. { title: '供应商', width: 120, dataIndex: 'supplier', className: 'replacecolor' },
  103. {
  104. title: '订单号',
  105. width: 160,
  106. dataIndex: 'orderNum',
  107. className: 'replacecolor'
  108. // customRender: function(text) {
  109. // if (text == '1') {
  110. // return '销售类型1'
  111. // }
  112. // if (text == '2') {
  113. // return '销售类型2'
  114. // }
  115. // if (text == '3') {
  116. // return '销售类型3'
  117. // }
  118. // if (text == '4') {
  119. // return '销售类型4'
  120. // }
  121. // }
  122. },
  123. { title: '订单数量', width: 100, dataIndex: 'orderQuantity', className: 'replacecolor' },
  124. { title: '采购入库数', width: 100, dataIndex: 'purchaseInQuantity', className: 'replacecolor' },
  125. { title: '材料出库数', width: 100, dataIndex: 'materialsOutQuantity', className: 'replacecolor' },
  126. { title: '核销数量', width: 100, dataIndex: 'verificationNum', className: 'replacecolor' },
  127. { title: '染损', width: 120, dataIndex: 'dyeLoss', className: 'replacecolor' }
  128. ],
  129. dyeLossData: [
  130. { orderQuantity: '10', purchaseInQuantity: '10', materialsOutQuantity: '10', verificationNum: '10' },
  131. { orderQuantity: '20', purchaseInQuantity: '20', materialsOutQuantity: '20', verificationNum: '20' },
  132. { orderQuantity: '30', purchaseInQuantity: '30', materialsOutQuantity: '30', verificationNum: '30' },
  133. { orderQuantity: '40', purchaseInQuantity: '40', materialsOutQuantity: '40', verificationNum: '40' }
  134. ],
  135. loading: false, // 表格加载
  136. // 查询条件
  137. queryParam: {
  138. orderNum: '',
  139. orderType: '',
  140. supplier: '',
  141. planNum: '',
  142. salesOrderNum: ''
  143. }
  144. }
  145. },
  146. created() {
  147. // 渲染订单销售列表
  148. },
  149. methods: {
  150. // 同步
  151. synchronization() {},
  152. // 查询按钮
  153. searchQuery() {
  154. // 渲染订单销售列表
  155. },
  156. searchReset() {
  157. // console.log('>>>>重置')
  158. this.queryParam = {}
  159. // 重新渲染订单销售列表
  160. },
  161. totalShow(data) {
  162. console.log('染损报表 ----合计')
  163. console.log('data', data)
  164. return (
  165. <a-table
  166. rowKey={Math.random}
  167. bordered={false}
  168. pagination={false}
  169. columns={this.dyeLossColumns}
  170. dataSource={this.footerData || []}
  171. showHeader={false}
  172. ></a-table>
  173. )
  174. }
  175. // 分页、排序、筛选变化时触发
  176. // handleTableChange(pagination, filters, sorter) {
  177. // // console.log('当前页信息>>>>',pagination)
  178. // this.queryParam.pageNo = pagination.current
  179. // // this.getOrderList()
  180. // }
  181. },
  182. watched: {
  183. dyeLossData(val) {
  184. // 同步表与 footer
  185. let dom = this.$refs.tableInfo.$el.querySelectAll('.ant-table-body')[0]
  186. dom.addEventListener(
  187. 'scroll',
  188. () => {
  189. this.$refs.tableInfo.$el.querySelectAll('.ant-table-body')[1].scrollLeft = dom.scrollLeft
  190. },
  191. true
  192. )
  193. }
  194. },
  195. computed: {
  196. // dyeLossDataSource() {
  197. // // 所有物料 对应单元格数量 合计
  198. // const total = Object.assign({}, this.dyeLossData[0])
  199. // for (const attr in total) {
  200. // total[attr] = '合计'
  201. // break
  202. // }
  203. // return [total]
  204. // }
  205. },
  206. mounted() {}
  207. }
  208. </script>
  209. <style lang="less" scoped>
  210. @import '~@assets/less/common.less';
  211. @import '~@assets/less/overwriter.less';
  212. /deep/ .ant-table-thead > tr > th {
  213. text-align: center;
  214. // font-weight: 700;
  215. }
  216. /deep/ .ant-table-tbody {
  217. text-align: center;
  218. }
  219. // /deep/ th.replacecolor {
  220. // background-color: #ccc;
  221. // }
  222. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  223. border: none;
  224. padding: 0;
  225. }
  226. </style>