123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- <template>
- <!-- 订单内部统计表-->
- <div id="interiorStatistics">
- <!-- 查询区域 -->
- <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-range-picker
- style="width: 100%"
- :placeholder="['开始年月', '结束年月']"
- format="YYYY-MM"
- :mode="mode2"
- :value="value"
- @panelChange="handlePanelChange"
- @change="monthChange"
- required
- />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-item label="部门">
- <j-search-select-tag
- placeholder="请选择部门"
- v-model="queryParam.department"
- :dictOptions="cdepNameOption">
- </j-search-select-tag>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-item label="客户">
- <j-search-select-tag
- placeholder="请选择客户"
- v-model="queryParam.customer"
- :dictOptions="ccusNameOption">
- </j-search-select-tag>
- </a-form-item>
- </a-col>
- <template v-if="toggleSearchStatus"></template>
- <a-col :md="6" :sm="8">
- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
- <a-button type="primary" @click="searchQuery" :disabled="isDisabled" icon="search">查询</a-button>
- <a-button
- type="primary"
- @click="searchReset"
- :disabled="isDisabled"
- 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>
- <!-- 引入 echarts -->
- <a-card :bordered="false" style="marginTop:10px;">
- <div class="chart">
- <!-- 部门 -->
- <div class="depChartStyle" style="background:rgba(255, 165, 0,.09);">
- <departmentChart ref="departmentChart" @option="getCdepNameOption"/>
- </div>
- <!-- 客户 -->
- <div class="cusChartStyle" style="background:rgba(134, 151, 201,.08);" >
- <customerChart ref="customerChart" @option-ccusName="getCcusNameOption"/>
- </div>
- </div>
- </a-card>
- <!-- table -->
- <a-card :bordered="false" style="marginTop:10px;">
- <a-table
- v-if="data"
- bordered
- rowKey="index"
- :columns="columns"
- :data-source="data"
- :loading="loading"
- :pagination="pagination"
- @change="handleTableChange"
- >
- </a-table>
- </a-card>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import departmentChart from '@views/reportForms/order-statistics/chart/interior/departmentChart'
- import customerChart from '@views/reportForms/order-statistics/chart/interior/customerChart.vue'
- import { externalList } from '@api/reportForms/order-statistics.js'
- import { myFormatDate } from '@/utils/myutil'
- export default {
- name: 'InteriorStatistics', // 订单内部统计表
- mixins: [JeecgListMixin],
- components: { JEllipsis, moment, departmentChart, customerChart },
- data() {
- // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
- return {
- description: '订单内部统计表',
- columns: [
- {
- title: '序号',
- width: 90,
- dataIndex: 'index',
- key: 'index',
- customRender: (text, record, index) => `${index + 1}`,
- className: 'replacecolor'
- },
- {
- title: '部门',
- width: 140,
- dataIndex: 'cdepName',
- className: 'replacecolor'
- },
- {
- title: '客户',
- width: 140,
- dataIndex: 'cvenAbbName',
- className: 'replacecolor'
- },
- {
- title: '预计发货月份',
- width: 120,
- dataIndex: 'yearMonth',
- customRender: text => {
- return moment(text).format('YYYY-MM')
- },
- className: 'replacecolor'
- },
- { title: '含税单价', width: 120, dataIndex: 'inatUnitPrice', className: 'replacecolor' },
- {
- title: '实际数量',
- width: 120,
- dataIndex: 'iquantity',
- className: 'replacecolor'
- },
- { title: '本币金额', width: 150, dataIndex: 'inatMoney', className: 'replacecolor' }
- ],
- data: [],
- cdepNameOption: [], //部门下拉数据
- ccusNameOption: [],//客户下拉数据
- loading: false, // 表格加载
- // 查询条件
- queryParam: {
- vendorType: '内部'
- // pageNo: '',
- // startYearMonth: '',
- // endYearMonth: '',
- // department: '',
- // customer: ''
- },
- pagination: {
- // total: '', //总条数
- // current: '', //当前页
- // pageSize: '' //一页多少
- },
- mode2: ['month', 'month'],
- value: [], //起始月份
- isDisabled: false, //按钮禁止
- monthFormat: 'YYYY-MM'
- // dateFormat: 'YYYY-MM-DD'
- }
- },
- mounted() {},
- created() {
- // 初次加载当月数据
- this.getThisMonthData();
- //this.value = [];
- //this.value.push(myFormatDate(new Date(),"yyyy-MM"));
- //this.value.push(myFormatDate(new Date(),"yyyy-MM"));
- },
- methods: {
- // 初次加载当月数据(列表、图)
- getThisMonthData() {
- this.$nextTick(() => {
- this.loading = true;
- //let nowDate = new Date()
- //let date = {
- // year: nowDate.getFullYear(),
- // month: nowDate.getMonth() + 1
- //}
- //if (date.month >= 1 && date.month <= 9) {
- // date.month = '0' + date.month
- //}
- //var time = date.year + '-' + date.month
- //this.queryParam.startYearMonth = time
- //this.queryParam.endYearMonth = time
- this.queryParam.vendorType = '内部'
- externalList(this.queryParam).then(res => {
- this.loading = false;
- // 参数给 chart
- this.$refs.departmentChart.queryParam = this.queryParam
- this.$refs.customerChart.queryParam = this.queryParam
- // console.log('????', this.$refs.departmentChart.queryParam)
- if (res.success) {
- this.data = res.result.records
- console.log('订单内部列表', this.data)
- this.pagination = {
- total: res.result.total,
- current: res.result.current,
- pageSize: res.result.size
- }
- }
- })
- })
- },
- // 查询订单统计
- getExternalData() {
- this.$nextTick(() => {
- this.loading = true;
- this.queryParam.vendorType = '内部'
- externalList(this.queryParam).then(res => {
- this.loading = false;
- // 参数给 chart
- this.$refs.departmentChart.queryParam = this.queryParam
- this.$refs.customerChart.queryParam = this.queryParam
- if (res.success) {
- this.data = res.result.records
- console.log('订单内部列表', this.data)
- this.pagination = {
- total: res.result.total,
- current: res.result.current,
- pageSize: res.result.size
- }
- }
- })
- })
- },
- searchQuery() {
- this.queryParam.pageNo = ''
- if (this.queryParam) {
- // 清空部门chart数据
- this.$refs.departmentChart.cdepNameArr = []
- this.$refs.departmentChart.iquantityArr = []
- this.$refs.departmentChart.inatMoneyArr = []
- // 清空客户chart数据
- this.$refs.customerChart.ccusNameArr = []
- this.$refs.customerChart.iquantityArr = []
- this.$refs.customerChart.inatMoneyArr = []
- this.getExternalData()
- //查询条件 传给 部门chart + 渲染
- this.$refs.departmentChart.queryParam = this.queryParam
- this.$refs.departmentChart.getDepChartData()
- //查询条件 传给 客户chart + 渲染
- this.$refs.customerChart.queryParam = this.queryParam
- this.$refs.customerChart.getCusChartData()
- }
- this.isDisabled = true
- setTimeout(() => {
- let that = this
- that.isDisabled = false
- }, 3000)
- },
- searchReset() {
- this.queryParam = {}
- this.value = [] //起始年月重置
- this.queryParam.startYearMonth = []
- this.queryParam.endYearMonth = []
- // 清空部门chart数据 + 查询条件 + 重新渲染
- this.$refs.departmentChart.cdepNameArr = []
- this.$refs.departmentChart.iquantityArr = []
- this.$refs.departmentChart.inatMoneyArr = []
- this.$refs.departmentChart.queryParam = {}
- this.$refs.departmentChart.getDepChartData()
- // 清空客户chart数据 + 查询条件 + 重新渲染
- this.$refs.customerChart.ccusNameArr = []
- this.$refs.customerChart.iquantityArr = []
- this.$refs.customerChart.inatMoneyArr = []
- this.$refs.customerChart.queryParam = {}
- this.$refs.customerChart.getCusChartData()
- // 重新渲染列表数据
- this.getExternalData()
- // 按钮置灰
- this.isDisabled = true
- setTimeout(() => {
- let that = this
- that.isDisabled = false
- }, 3000)
- },
- // 日期面板变化时的回调
- handlePanelChange(value, mode) {
- this.value = value
- this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
- this.queryParam.startYearMonth = value[0].format('YYYY-MM')
- this.queryParam.endYearMonth = value[1].format('YYYY-MM')
- // console.log('开始年月:', this.queryParam.startYearMonth)
- // console.log('结束年月:', this.queryParam.endYearMonth)
- },
- // 时间发生变化的回调,发生在用户选择时间时
- monthChange(value) {
- this.value = value
- this.queryParam.startYearMonth = ''
- this.queryParam.endYearMonth = ''
- },
- handleTableChange(pagination, filters, sorter) {
- this.queryParam.pageNo = pagination.current
- this.getExternalData()
- },
- //整理部门下拉框数据
- getCdepNameOption(val){
- val.map(item=>{
- this.cdepNameOption.push({text:item,value:item})
- })
- },
- //整理客户下拉框数据
- getCcusNameOption(index) {
- index.map(item=>{
- this.ccusNameOption.push({text:item,value:item})
- })
- }
- }
- }
- </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;
- // }
- .depChartStyle,
- .cusChartStyle {
- // width: 100%;
- // height: 600px;
- text-align: center;
- padding-top: 10px;
- }
- .depChartStyle {
- margin-bottom: 20px;
- }
- </style>
|