supply-capacity-table.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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-range-picker
  17. style="width: 100%"
  18. v-model="timeRange"
  19. format="YYYY-MM"
  20. valueFormat="YYYY-MM"
  21. :mode="mode2"
  22. :open="open"
  23. :placeholder="['开始时间', '结束时间']"
  24. @panelChange="handlePanelChange2"
  25. @openChange="onDateChange"
  26. @change="changeData"
  27. />
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="6" :sm="8">
  31. <a-form-item label="订单类型">
  32. <a-select v-model="queryParam.orderType" placeholder="请选择订单类型" >
  33. <a-select-option value="">请选择</a-select-option>
  34. <a-select-option value="采购订单">采购订单</a-select-option>
  35. <a-select-option value="委外订单">委外订单</a-select-option>
  36. </a-select>
  37. <!-- <a-input placeholder="请输入" v-model="queryParam.orderType"></a-input> -->
  38. </a-form-item>
  39. </a-col>
  40. <template v-if="toggleSearchStatus">
  41. <a-col :md="6" :sm="8">
  42. <a-form-item label="供应商">
  43. <a-input placeholder="请输入供应商" v-model="queryParam.venName"></a-input>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="6" :sm="8">
  47. <a-form-item label="计划单号">
  48. <a-input placeholder="请输入计划单号" v-model="queryParam.planLotNumber"></a-input>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="8">
  52. <a-form-item label="供应商类型">
  53. <j-search-select-tag
  54. placeholder="请选择"
  55. v-model="queryParam.CVenCodeType"
  56. dict="view_cVenCodeType,cVenCodeType,cVenCodeType">
  57. </j-search-select-tag>
  58. <!-- <a-input placeholder="请输入供应商类型" v-model="queryParam.CVenCodeType"></a-input> -->
  59. </a-form-item>
  60. </a-col>
  61. <a-col :md="6" :sm="8">
  62. <a-form-item label="款号">
  63. <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :md="6" :sm="8">
  67. <a-form-item label="部门">
  68. <j-search-select-tag
  69. placeholder="请选择"
  70. v-model="queryParam.CDepCode"
  71. dict="view_cdepcode,cdepcode,cdepcode">
  72. </j-search-select-tag>
  73. <!-- <a-input placeholder="请输入部门" v-model="queryParam.CDepCode"></a-input> -->
  74. </a-form-item>
  75. </a-col>
  76. </template>
  77. <a-col :md="6" :sm="8">
  78. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  79. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  80. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  81. <a @click="handleToggleSearch" style="margin-left: 8px">
  82. {{ toggleSearchStatus ? '收起' : '展开' }}
  83. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  84. </a>
  85. </span>
  86. </a-col>
  87. </a-row>
  88. </a-form>
  89. </div>
  90. </a-card>
  91. <!-- 操作按钮区域 -->
  92. <a-card :bordered="false" style="marginTop:10px;">
  93. <div class="table-operator">
  94. <a-button type="primary" @click="handleExportXls('供应链产能报表')" icon="download">合并导出</a-button>
  95. <a-button type="primary" @click="monthSupplyExport('月份供应商合计导出')" icon="download"
  96. >月份供应商合计导出</a-button
  97. >
  98. <a-button type="primary" @click="monthDepartExport('月份部门合计导出')" icon="download"
  99. >月份部门合计导出</a-button
  100. >
  101. </div>
  102. <!-- 合计 table rowKey="id" :scroll="{ x: 1500 }" :pagination="ipagination -->
  103. <a-table
  104. bordered
  105. :row-key="record => record.id"
  106. :columns="supplyCapacityColumns"
  107. :data-source="supplyCapacityData"
  108. :loading="loading"
  109. :pagination="pagination"
  110. :scroll="{ x: 1800}"
  111. @change="handleTableChange"
  112. >
  113. </a-table>
  114. </a-card>
  115. </div>
  116. </template>
  117. <script>
  118. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  119. import JEllipsis from '@/components/jeecg/JEllipsis'
  120. import moment from 'moment'
  121. import { supplyCapList } from '@api/reportForms/supply-capacity-table'
  122. import { downFile } from '@/api/manage'
  123. export default {
  124. name: 'SupplyCapacityTable', // 供应商产能报表
  125. mixins: [JeecgListMixin],
  126. components: { JEllipsis, moment },
  127. data() {
  128. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  129. return {
  130. description: '供应商产能报表',
  131. mode2:['month', 'month'],
  132. timeRange:[],
  133. supplyCapacityColumns: [
  134. {
  135. title: '账套号',
  136. width: 60,
  137. align: 'left',
  138. dataIndex: 'account',
  139. ellipsis: true,
  140. className: 'replacecolor'
  141. },
  142. {
  143. title: '订单号',
  144. width: 95,
  145. align: 'left',
  146. dataIndex: 'csrccode',
  147. className: 'replacecolor',
  148. },
  149. {
  150. title: '款号',
  151. width:80,
  152. dataIndex: 'itemNumber',
  153. className: 'replacecolor',
  154. },
  155. { title: '部门', width: 70, dataIndex: 'cdepCode', className: 'replacecolor',ellipsis: true, },
  156. { title: '业务员', width: 60, dataIndex: 'cpersonCode', className: 'replacecolor',ellipsis: true, },
  157. { title: '供应商', width: 80, dataIndex: 'cvenCode', className: 'replacecolor',ellipsis: true,},
  158. { title: '供应商类型', width: 65, dataIndex: 'cvenCodeType', className: 'replacecolor',ellipsis: true, },
  159. { title: '订单类型', width: 70, dataIndex: 'iorderType', className: 'replacecolor',ellipsis: true, },
  160. {
  161. title: '预约发货月份 ',
  162. width: 75,
  163. dataIndex: 'darriveDate',
  164. // customRender: text => {
  165. // return moment(text).format('YYYY-MM')
  166. // },
  167. className: 'replacecolor',
  168. ellipsis: true,
  169. },
  170. // {
  171. // title: '计划到货日期',
  172. // width: 120,
  173. // dataIndex: 'darriveDate',
  174. // customRender: text => {
  175. // return moment(text).format('YYYY-MM')
  176. // },
  177. // className: 'replacecolor'
  178. // },
  179. // className: 'replacecolor'
  180. // },
  181. {
  182. title: '件数',
  183. width: 50,
  184. dataIndex: 'total',
  185. className: 'replacecolor',
  186. ellipsis: true,
  187. },
  188. { title: '工时(分)', width: 55, dataIndex: 'coefficient', className: 'replacecolor',ellipsis: true, },
  189. {
  190. title: '计划单号',
  191. width: 80,
  192. dataIndex: 'cplanLotNumber',
  193. className: 'replacecolor',
  194. ellipsis: true,
  195. },
  196. {
  197. title: '数量',
  198. width: 50,
  199. dataIndex: 'iquantity',
  200. className: 'replacecolor',
  201. ellipsis: true,
  202. },
  203. { title: '累计入库数量', width: 85, dataIndex: 'ireceivedQTY', className: 'replacecolor',ellipsis: true, },
  204. { title: '单位', width: 70, dataIndex: 'unit', className: 'replacecolor',ellipsis: true, },
  205. ],
  206. supplyCapacityData: [],
  207. loading: false, // 表格加载
  208. // 查询条件
  209. queryParam: {
  210. csrccode: '',
  211. startDate: '',
  212. endDate: '',
  213. CVenCodeType:'成衣厂',
  214. // timeRange = [], 月份范围
  215. orderType: '',
  216. venCode: '',
  217. planLotNumber: '',
  218. pageNo: '1',
  219. pageSize: '10'
  220. },
  221. open:false,
  222. // 分页
  223. pagination: {
  224. // total: '',
  225. // current: 0,
  226. // pageSize: 0
  227. },
  228. dateFormat: 'YYYY-MM-DD'
  229. }
  230. },
  231. created() {
  232. this.getData()
  233. this.getSupplyCapList() // 渲染 供应链产能报表
  234. },
  235. methods: {
  236. getData(){
  237. var month = moment(moment(new Date()).format('YYYY-MM'))
  238. var year =new Date().getFullYear()
  239. year = moment(year+'-'+'12')
  240. this.timeRange=[month,year]
  241. this.queryParam.startDate = this.timeRange[0].format('YYYY-MM')
  242. this.queryParam.endDate = this.timeRange[1].format('YYYY-MM')
  243. },
  244. // 供应商产能数据
  245. getSupplyCapList() {
  246. this.$nextTick(() => {
  247. this.loading = true
  248. supplyCapList(this.queryParam).then(res => {
  249. this.loading = false
  250. if (res.success) {
  251. // res.result.records.map(item=>{
  252. // item.
  253. // })
  254. this.supplyCapacityData = res.result.records
  255. console.log('【供应商产能报表数据】:', this.supplyCapacityData)
  256. this.pagination = {
  257. total: res.result.total,
  258. current: res.result.current,
  259. pageSize: res.result.size
  260. }
  261. }
  262. })
  263. })
  264. },
  265. //合并导出
  266. handleExportXls(fileName) {
  267. console.log('需导出的fileName:', fileName)
  268. const params = this.supplyCapacityData
  269. console.log('导出参数', params)
  270. downFile('/scas/supplierCapacity/excel1', this.queryParam).then(data => {
  271. if (!data) {
  272. this.$message.warning('文件下载失败')
  273. return
  274. }
  275. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  276. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  277. } else {
  278. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  279. let link = document.createElement('a')
  280. link.style.display = 'none'
  281. link.href = url
  282. link.setAttribute('download', fileName + '.xls')
  283. document.body.appendChild(link)
  284. link.click()
  285. document.body.removeChild(link) // 下载完成移除元素
  286. window.URL.revokeObjectURL(url) // 释放掉blob对象
  287. }
  288. })
  289. },
  290. // 月份供应链合计导出
  291. monthSupplyExport(fileName) {
  292. console.log('需导出的fileName:', fileName)
  293. const params = this.supplyCapacityData
  294. console.log('导出参数', this.queryParam)
  295. downFile('/scas/supplierCapacity/excel3', this.queryParam).then(data => {
  296. if (!data) {
  297. this.$message.warning('文件下载失败')
  298. return
  299. }
  300. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  301. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  302. } else {
  303. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  304. let link = document.createElement('a')
  305. link.style.display = 'none'
  306. link.href = url
  307. link.setAttribute('download', fileName + '.xls')
  308. document.body.appendChild(link)
  309. link.click()
  310. document.body.removeChild(link) // 下载完成移除元素
  311. window.URL.revokeObjectURL(url) // 释放掉blob对象
  312. }
  313. })
  314. },
  315. // 月份部门合计导出
  316. monthDepartExport(fileName) {
  317. console.log('需导出的fileName:', fileName)
  318. const params = this.supplyCapacityData
  319. console.log('导出参数', params)
  320. downFile('/scas/supplierCapacity/excel2', this.queryParam).then(data => {
  321. if (!data) {
  322. this.$message.warning('文件下载失败')
  323. return
  324. }
  325. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  326. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  327. } else {
  328. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  329. let link = document.createElement('a')
  330. link.style.display = 'none'
  331. link.href = url
  332. link.setAttribute('download', fileName + '.xls')
  333. document.body.appendChild(link)
  334. link.click()
  335. document.body.removeChild(link) // 下载完成移除元素
  336. window.URL.revokeObjectURL(url) // 释放掉blob对象
  337. }
  338. })
  339. },
  340. // 查询按钮
  341. searchQuery() {
  342. this.queryParam.pageNo = ''
  343. this.getSupplyCapList()
  344. },
  345. searchReset() {
  346. this.queryParam = {
  347. CVenCodeType:'成衣厂'
  348. }
  349. this.getData()
  350. this.getSupplyCapList()
  351. },
  352. // 查询条件 月范围份转换成字符串并赋值
  353. onDateChange(status) {
  354. if(status){
  355. this.open = true;
  356. }else{
  357. this.open = false
  358. }
  359. },
  360. handlePanelChange2(value,mode){
  361. if (this.timeRange[1] && this.timeRange[1]._d != value[1]._d) {
  362. this.open = false;
  363. }
  364. this.timeRange = value
  365. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  366. this.queryParam.startDate = value[0].format('YYYY-MM')
  367. this.queryParam.endDate = value[1].format('YYYY-MM')
  368. },
  369. onDateOk(value) {
  370. console.log('value', value)
  371. },
  372. changeData(value){
  373. this.timeRange = value
  374. this.queryParam.startDate = this.timeRange[0]
  375. this.queryParam.endDate = this.timeRange[1]
  376. },
  377. // 分页变化时触发
  378. handleTableChange(pagination, filters, sorter) {
  379. console.log('分页器信息', pagination)
  380. if (Object.keys(sorter).length > 0) {
  381. this.isorter.column = sorter.field
  382. this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
  383. }
  384. this.queryParam.pageNo = pagination.current
  385. this.getSupplyCapList()
  386. }
  387. }
  388. }
  389. </script>
  390. <style lang="less" scoped>
  391. @import '~@assets/less/common.less';
  392. @import '~@assets/less/overwriter.less';
  393. /deep/ .ant-table-thead > tr > th {
  394. text-align: center;
  395. // font-weight: 700;
  396. }
  397. /deep/ .ant-table-tbody {
  398. text-align: center;
  399. }
  400. // /deep/ th.replacecolor {
  401. // background-color: #ccc;
  402. // }
  403. /deep/ .ant-table-footer .ant-table.body {
  404. // overflow: hidden !important;
  405. }
  406. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  407. border: none;
  408. padding: 0;
  409. }
  410. </style>