123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <template>
- <!-- 染损报表 -->
- <div id="dyeLossRateTable">
- <!-- 查询区域 -->
- <a-card :bordered="false">
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="searchQuery">
- <a-row :gutter="24">
- <a-col :md="6" :sm="8">
- <a-form-item label="订单号">
- <a-input placeholder="请输入订单号" v-model="queryParam.code"></a-input>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-item label="订单类型">
- <a-input placeholder="请输入订单类型" v-model="queryParam.orderType"></a-input>
- <!-- <a-select placeholder="请选择订单类型" v-model="queryParam.orderType">
- <a-select-option :value="''">请选择</a-select-option>
- <a-select-option :value="0">订单类型1</a-select-option>
- <a-select-option :value="1">订单类型2</a-select-option>
- <a-select-option :value="2">订单类型3</a-select-option>
- </a-select> -->
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-item label="供应商">
- <a-input placeholder="请输入供应商" v-model="queryParam.venName"></a-input>
- </a-form-item>
- </a-col>
- <template v-if="toggleSearchStatus">
- <a-col :md="6" :sm="8">
- <a-form-item label="计划单号">
- <a-input placeholder="请输入计划单号" v-model="queryParam.planLotNumber"></a-input>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-item label="销售订单号">
- <a-input placeholder="请输入销售订单号" v-model="queryParam.csocode"></a-input>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="8">
- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
- <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
- <a @click="handleToggleSearch" style="margin-left: 8px">
- {{ toggleSearchStatus ? '收起' : '展开' }}
- <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
- </a>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </a-card>
- <!-- 导出 table-->
- <a-card :bordered="false" style="margin:10px 0;">
- <div class="table-operator">
- <a-button type="primary" icon="download" @click="handleExportXls('染损报表')">导出</a-button>
- </div>
- <!-- 子表合计 table rowKey="id" :scroll="{ x: 1500 }" :pagination="ipagination"-->
- <div>
- <a-table
- bordered
- rowKey="id"
- v-if="dyeLossRateData"
- :columns="dyeLossRateColumns"
- :data-source="dyeLossRateData"
- :loading="loading"
- :pagination="pagination"
- @change="handleTableChange"
- ref="table"
- :footer="totalFooterShow"
- >
- </a-table>
- </div>
- </a-card>
- <!-- 引入 echarts -->
- <a-card :bordered="false">
- <div class="chart">
- <div class="someoneLossChart" v-if="queryParam.venName">
- <!-- :fatherList="dyeLossRateData" -->
- <someoneLossChart />
- </div>
- <div v-else class="allLossChart">
- <allLossChart :fatherList="dyeLossRateData" />
- </div>
- </div>
- </a-card>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import allLossChart from '@views/reportForms/dye-loss-table/allLossChart.vue'
- import someoneLossChart from '@views/reportForms/dye-loss-table/someoneLossChart'
- import { dyeLossList } from '@api/reportForms/dye-loss-table.js'
- // import FileSaver from 'file-saver'
- // import XLSX from 'xlsx'
- export default {
- name: 'DyeLossRateTable', // 染损报表
- mixins: [JeecgListMixin],
- components: { JEllipsis, moment, allLossChart, someoneLossChart },
- data() {
- let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
- return {
- // 表头
- dyeLossRateColumns: [
- {
- title: '物料编码',
- width: 120,
- dataIndex: 'cinvCode',
- className: 'replacecolor'
- },
- {
- title: '物料名称',
- width: 160,
- dataIndex: 'cinvName',
- className: 'replacecolor'
- },
- { title: '颜色', width: 160, dataIndex: 'color', customRender: t => ellipsis(t), className: 'replacecolor' },
- { title: '供应商', width: 120, dataIndex: 'cvenName', className: 'replacecolor' },
- {
- title: '订单号',
- width: 160,
- dataIndex: 'ccode',
- className: 'replacecolor'
- },
- { title: '订单数量', width: 100, dataIndex: 'iquantity', className: 'replacecolor' },
- { title: '采购入库数', width: 100, dataIndex: 'iquantity2', className: 'replacecolor' },
- { title: '材料出库数', width: 100, dataIndex: 'iquantity3', className: 'replacecolor' },
- { title: '核销数量', width: 100, dataIndex: 'imsquantity', className: 'replacecolor' },
- { title: '染损', width: 120, dataIndex: 'dyeLossRate', className: 'replacecolor' }
- ],
- dyeLossRateData: [], //染损数据
- loading: false, // 表格加载
- queryParam: {
- code: '', //订单号
- orderType: '', //订单类型
- cvenName: '', //供应商
- planLotNumber: '', //计划单号
- csocode: '', //销售订单号
- pageNo: '' // 点击的页数
- },
- // 分页
- pagination: {
- // total: '', //总条数
- // current: '', //当前页
- // pageSize: '' //一页多少
- },
- cvenNameArr: [], //供应商数组 chart
- cinvNameArr: [], //物料名称数组chart
- colorArr: [] //颜色数组chart
- }
- },
- // html渲染出来后,操作dom
- mounted() {
- this.cancelLoading()
- this.initEcharts()
- },
- created() {
- // setTimeout(() => {
- // this.loading = !this.loading
- // }, 1000)
- this.getdyeLossList()
- // // console.log('000')
- },
- methods: {
- cancelLoading() {
- setTimeout(() => {
- this.loading = false
- }, 500)
- },
- // 分页查询 染损列表
- getdyeLossList() {
- this.$nextTick(() => {
- dyeLossList(this.queryParam).then(res => {
- // console.log(res.result)
- if (res.success) {
- this.dyeLossRateData = res.result.records
- console.log('染损列表', this.dyeLossRateData)
- this.pagination = {
- total: res.result.total,
- current: res.result.current,
- pageSize: res.result.size
- }
- console.log('分页器赋值:', this.pagination.total, this.pagination.current, this.pagination.pageSize)
- }
- })
- })
- },
- // 分页变化时触发
- handleTableChange(pagination, filters, sorter) {
- console.log('分页器信息>>>>', pagination)
- if (Object.keys(sorter).length > 0) {
- this.isorter.column = sorter.field
- this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
- }
- this.queryParam.pageNo = pagination.current
- // console.log('this.queryParam.pageNo', this.queryParam.pageNo)
- this.getdyeLossList()
- },
- // 查询按钮
- searchQuery() {
- this.getdyeLossList() // 渲染染损列表
- },
- searchReset() {
- this.queryParam = {}
- this.getdyeLossList()
- },
- // 获取导出信息
- // async getInfoXls(fileName) {},
- // 导出
- handleExportXls(fileName) {
- this.loading = false
- console.log('需导出的fileName:', fileName)
- const params = this.queryParam
- console.log('导出参数', params)
- },
- // 合计行 TODO: table 单元格合并
- totalFooterShow(data) {
- if (data) {
- console.log('需合计数据(合计行)data', data)
- return (
- <a-table
- rowKey={Math.random}
- bordered={false}
- pagination={false}
- columns={this.dyeLossRateColumns}
- dataSource={this.dyeLossRateDataSource || []}
- showHeader={false}
- ></a-table>
- )
- }
- }
- },
- computed: {
- // 合计数据
- dyeLossRateDataSource() {
- const summary = Object.assign({}, this.dyeLossRateData[1])
- for (const attr in summary) {
- summary[attr] = '合计'
- }
- let iQuantityNum = 0 //订单数量 合计
- this.dyeLossRateData.forEach(({ iquantity }) => {
- iQuantityNum = parseInt(iQuantityNum) + parseInt(iquantity)
- })
- summary['iquantity'] = iQuantityNum
- let iQuantity2Num = 0 //采购入库数 合计
- this.dyeLossRateData.forEach(({ iquantity2 }) => {
- iQuantity2Num = parseInt(iQuantity2Num) + parseInt(iquantity2)
- })
- summary['iquantity2'] = iQuantity2Num
- let iQuantity3Num = 0 //材料出库数 合计
- this.dyeLossRateData.forEach(({ iquantity3 }) => {
- iQuantity3Num = parseInt(iQuantity3Num) + parseInt(iquantity3)
- })
- summary['iquantity3'] = iQuantity3Num
- let iMSQuantityNum = 0 //核销数量 合计
- this.dyeLossRateData.forEach(({ imsquantity }) => {
- iMSQuantityNum = parseInt(iMSQuantityNum) + parseInt(imsquantity)
- })
- summary['imsquantity'] = iMSQuantityNum
- let dyeLossRateNum = 0 //染损合计
- this.dyeLossRateData.forEach(({ dyeLossRate }) => {
- dyeLossRateNum = parseInt(dyeLossRateNum) + parseInt(dyeLossRate)
- })
- summary['dyeLossRate'] = dyeLossRateNum
- return [summary]
- }
- }
- }
- </script>
- <style lang="less" scoped>
- @import '~@assets/less/common.less';
- @import '~@assets/less/overwriter.less';
- /deep/ .ant-table-thead > tr > th {
- text-align: center;
- // font-weight: 700;
- }
- /deep/ .ant-table-tbody {
- text-align: center;
- }
- // /deep/ th.replacecolor {
- // background-color: #ccc;
- // }
- /deep/ .ant-table-footer .ant-table.body {
- // overflow: hidden !important;
- }
- /deep/ .ant-table.ant-table-bordered .ant-table-footer {
- border: none;
- padding: 0;
- }
- .allLossChart,
- .someoneLossChart {
- height: 600px;
- text-align: center;
- padding-top: 10px;
- }
- </style>
|