supply-capacity-table.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <template>
  2. <!-- 供应商产能报表 -->
  3. <div id="supplyCapacityTable">
  4. <!-- 查询区域 -->
  5. <a-card :bordered="false">
  6. <div class="table-page-search-wrapper">
  7. <a-form layout="inline" @keyup.enter.native="searchQuery">
  8. <a-row :gutter="24">
  9. <a-col :md="6" :sm="8">
  10. <a-form-item label="订单号">
  11. <a-input placeholder="请输入订单号" v-model="queryParam.csrccode"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="6" :sm="8">
  15. <a-form-item label="开始月份">
  16. <a-date-picker
  17. placeholder="请选择开始月份"
  18. style="width: 100%"
  19. format="YYYY-MM"
  20. v-model="queryParam.startDate"
  21. ></a-date-picker>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="8">
  25. <a-form-item label="结束月份">
  26. <a-date-picker
  27. placeholder="请选择结束月份"
  28. style="width: 100%"
  29. format="YYYY-MM"
  30. v-model="queryParam.endDate"
  31. ></a-date-picker>
  32. </a-form-item>
  33. </a-col>
  34. <template v-if="toggleSearchStatus">
  35. <a-col :md="6" :sm="8">
  36. <a-form-item label="订单类型">
  37. <a-input placeholder="请输入订单类型" v-model="queryParam.orderType"></a-input>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="8">
  41. <a-form-item label="供应商">
  42. <a-input placeholder="请输入供应商" v-model="queryParam.venCode"></a-input>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="8">
  46. <a-form-item label="计划单号">
  47. <a-input placeholder="请输入计划单号" v-model="queryParam.planLotNumber"></a-input>
  48. </a-form-item>
  49. </a-col>
  50. </template>
  51. <a-col :md="6" :sm="8">
  52. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  53. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  54. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  55. <a @click="handleToggleSearch" style="margin-left: 8px">
  56. {{ toggleSearchStatus ? '收起' : '展开' }}
  57. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  58. </a>
  59. </span>
  60. </a-col>
  61. </a-row>
  62. </a-form>
  63. </div>
  64. </a-card>
  65. <!-- 操作按钮区域 -->
  66. <a-card :bordered="false" style="marginTop:10px;">
  67. <div class="table-operator">
  68. <a-button type="primary" @click="handleExportXls('供应链产能报表')" icon="download">合并导出</a-button>
  69. <a-button type="primary" @click="monthSupplyExport('月份供应商合计导出')" icon="download"
  70. >月份供应商合计导出</a-button
  71. >
  72. <a-button type="primary" @click="monthDepartExport('月份部门合计导出')" icon="download"
  73. >月份部门合计导出</a-button
  74. >
  75. </div>
  76. <!-- 合计 table rowKey="id" :scroll="{ x: 1500 }" :pagination="ipagination -->
  77. <a-table
  78. bordered
  79. :row-key="record => record.id"
  80. :columns="supplyCapacityColumns"
  81. :data-source="supplyCapacityData"
  82. :loading="loading"
  83. :pagination="pagination"
  84. @change="handleTableChange"
  85. >
  86. </a-table>
  87. </a-card>
  88. </div>
  89. </template>
  90. <script>
  91. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  92. import JEllipsis from '@/components/jeecg/JEllipsis'
  93. import moment from 'moment'
  94. import { supplyCapList } from '@api/reportForms/supply-capacity-table'
  95. import { downFile } from '@/api/manage'
  96. export default {
  97. name: 'SupplyCapacityTable', // 供应商产能报表
  98. mixins: [JeecgListMixin],
  99. components: { JEllipsis, moment },
  100. data() {
  101. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  102. return {
  103. description: '供应商产能报表',
  104. supplyCapacityColumns: [
  105. {
  106. title: '订单号',
  107. width: 120,
  108. dataIndex: 'csrccode',
  109. className: 'replacecolor'
  110. },
  111. {
  112. title: '计划单号',
  113. width: 120,
  114. dataIndex: 'planLotNumber',
  115. className: 'replacecolor'
  116. },
  117. { title: '部门', width: 120, dataIndex: 'cDepCode', className: 'replacecolor' },
  118. { title: '业务员', width: 120, dataIndex: 'cPersonCode', className: 'replacecolor' },
  119. { title: '供应商', width: 120, dataIndex: 'venCode', className: 'replacecolor' },
  120. // customRender: function(text) {
  121. // if (text == '1') {
  122. // return '销售类型1'
  123. // }
  124. // if (text == '2') {
  125. // return '销售类型2'
  126. // }
  127. // if (text == '3') {
  128. // return '销售类型3'
  129. // }
  130. // if (text == '4') {
  131. // return '销售类型4'
  132. // }
  133. // }
  134. { title: '供应商类型', width: 120, dataIndex: 'venCodeType', className: 'replacecolor' },
  135. { title: '订单类型', width: 120, dataIndex: 'orderType', className: 'replacecolor' },
  136. {
  137. title: '数量',
  138. width: 120,
  139. dataIndex: 'iQuantity',
  140. className: 'replacecolor'
  141. },
  142. { title: '累计入库数量', width: 120, dataIndex: 'iReceivedQTY', className: 'replacecolor' },
  143. { title: '单位', width: 100, dataIndex: 'unit', className: 'replacecolor' },
  144. {
  145. title: '计划到货月份',
  146. width: 120,
  147. dataIndex: 'arriveMonth',
  148. // customRender: text => {
  149. // return moment(text).format('YYYY-MM')
  150. // },
  151. className: 'replacecolor'
  152. },
  153. {
  154. title: '计划到货日期',
  155. width: 120,
  156. dataIndex: 'planDeliveryData',
  157. // customRender: text => {
  158. // return moment(text).format('YYYY-MM-DD')
  159. // },
  160. className: 'replacecolor'
  161. },
  162. { title: '系数', width: 100, dataIndex: 'coefficient', className: 'replacecolor' }
  163. ],
  164. supplyCapacityData: [],
  165. loading: false, // 表格加载
  166. // 查询条件
  167. queryParam: {
  168. csrccode: '',
  169. startDate: '',
  170. endDate: '',
  171. orderType: '',
  172. venCode: '',
  173. planLotNumber: '',
  174. pageNo: '' // 当前页
  175. },
  176. // 分页
  177. pagination: {
  178. // total: '',
  179. // current: 0,
  180. // pageSize: 0
  181. },
  182. dateFormat: 'YYYY-MM-DD'
  183. }
  184. },
  185. created() {
  186. this.getSupplyCapList() // 渲染 供应链产能报表
  187. // console.log('000')
  188. },
  189. methods: {
  190. // 供应商产能数据
  191. getSupplyCapList() {
  192. this.$nextTick(() => {
  193. supplyCapList(this.queryParam).then(res => {
  194. // console.log('111')
  195. if (res.success) {
  196. // console.log('222')
  197. this.supplyCapacityData = res.result.records
  198. console.log('【供应商产能报表数据】:', this.supplyCapacityData)
  199. this.pagination = {
  200. total: res.result.total,
  201. current: res.result.current,
  202. pageSize: res.result.size
  203. }
  204. }
  205. })
  206. })
  207. },
  208. //合并导出
  209. handleExportXls(fileName) {
  210. console.log('需导出的fileName:', fileName)
  211. const params = this.supplyCapacityData
  212. console.log('导出参数', params)
  213. downFile('/scas/supplierCapacity/excel1', params).then(data => {
  214. if (!data) {
  215. this.$message.warning('文件下载失败')
  216. return
  217. }
  218. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  219. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  220. } else {
  221. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  222. let link = document.createElement('a')
  223. link.style.display = 'none'
  224. link.href = url
  225. link.setAttribute('download', fileName + '.xls')
  226. document.body.appendChild(link)
  227. link.click()
  228. document.body.removeChild(link) // 下载完成移除元素
  229. window.URL.revokeObjectURL(url) // 释放掉blob对象
  230. }
  231. })
  232. },
  233. // 月份供应链合计导出
  234. monthSupplyExport(fileName) {
  235. console.log('需导出的fileName:', fileName)
  236. const params = this.supplyCapacityData
  237. console.log('导出参数', params)
  238. downFile('/scas/supplierCapacity/excel3', params).then(data => {
  239. if (!data) {
  240. this.$message.warning('文件下载失败')
  241. return
  242. }
  243. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  244. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  245. } else {
  246. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  247. let link = document.createElement('a')
  248. link.style.display = 'none'
  249. link.href = url
  250. link.setAttribute('download', fileName + '.xls')
  251. document.body.appendChild(link)
  252. link.click()
  253. document.body.removeChild(link) // 下载完成移除元素
  254. window.URL.revokeObjectURL(url) // 释放掉blob对象
  255. }
  256. })
  257. },
  258. // 月份部门合计导出
  259. monthDepartExport(fileName) {
  260. console.log('需导出的fileName:', fileName)
  261. const params = this.supplyCapacityData
  262. console.log('导出参数', params)
  263. downFile('/scas/supplierCapacity/excel2', params).then(data => {
  264. if (!data) {
  265. this.$message.warning('文件下载失败')
  266. return
  267. }
  268. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  269. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  270. } else {
  271. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  272. let link = document.createElement('a')
  273. link.style.display = 'none'
  274. link.href = url
  275. link.setAttribute('download', fileName + '.xls')
  276. document.body.appendChild(link)
  277. link.click()
  278. document.body.removeChild(link) // 下载完成移除元素
  279. window.URL.revokeObjectURL(url) // 释放掉blob对象
  280. }
  281. })
  282. },
  283. // 查询按钮
  284. searchQuery() {
  285. this.getSupplyCapList()
  286. },
  287. searchReset() {
  288. this.queryParam = {}
  289. this.getSupplyCapList()
  290. },
  291. // 分页变化时触发
  292. handleTableChange(pagination, filters, sorter) {
  293. console.log('分页器信息', pagination)
  294. if (Object.keys(sorter).length > 0) {
  295. this.isorter.column = sorter.field
  296. this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
  297. }
  298. this.queryParam.pageNo = pagination.current
  299. this.getSupplyCapList()
  300. }
  301. }
  302. }
  303. </script>
  304. <style lang="less" scoped>
  305. @import '~@assets/less/common.less';
  306. @import '~@assets/less/overwriter.less';
  307. /deep/ .ant-table-thead > tr > th {
  308. text-align: center;
  309. // font-weight: 700;
  310. }
  311. /deep/ .ant-table-tbody {
  312. text-align: center;
  313. }
  314. // /deep/ th.replacecolor {
  315. // background-color: #ccc;
  316. // }
  317. /deep/ .ant-table-footer .ant-table.body {
  318. // overflow: hidden !important;
  319. }
  320. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  321. border: none;
  322. padding: 0;
  323. }
  324. </style>