external-statistics.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <!-- 订单外部统计表-->
  3. <div id="externalStatistics">
  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-range-picker
  12. style="width: 100%"
  13. v-model="queryParam.timeRange"
  14. placeholder="['开始年月', '结束年月']"
  15. format="YYYY-MM"
  16. :mode="mode2"
  17. :value="value"
  18. @panelChange="handlePanelChange"
  19. @change="handleChange"
  20. />
  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.department"></a-input>
  26. <!-- <a-select placeholder="请选择部门" v-model="queryParam.">
  27. <a-select-option :value="''">请选择</a-select-option>
  28. <a-select-option :value="0">业务一部</a-select-option>
  29. <a-select-option :value="1">业务二部</a-select-option>
  30. </a-select> -->
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="8">
  34. <a-form-item label="客户">
  35. <a-input placeholder="请输入客户" v-model="queryParam.customer"></a-input>
  36. <!-- <a-select placeholder="请选择客户" v-model="queryParam.customer">
  37. <a-select-option :value="''">请选择</a-select-option>
  38. <a-select-option :value="0">FD</a-select-option>
  39. <a-select-option :value="1">PMK</a-select-option>
  40. </a-select> -->
  41. </a-form-item>
  42. </a-col>
  43. <template v-if="toggleSearchStatus"></template>
  44. <a-col :md="6" :sm="8">
  45. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  46. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  47. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  48. <a @click="handleToggleSearch" style="margin-left: 8px">
  49. {{ toggleSearchStatus ? '收起' : '展开' }}
  50. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  51. </a>
  52. </span>
  53. </a-col>
  54. </a-row>
  55. </a-form>
  56. </div>
  57. </a-card>
  58. <!-- 引入 echarts -->
  59. <a-card :bordered="false" style="marginTop:10px;">
  60. <div class="chart">
  61. <!-- 部门 "-->
  62. <div class="departmentChart" style="background:rgba(255, 165, 0,.08);">
  63. <departmentChart />
  64. </div>
  65. <!-- 客户 -->
  66. <div class="customerChart" style="background:rgba(134, 151, 201,.08);">
  67. <customerChart />
  68. </div>
  69. </div>
  70. </a-card>
  71. <!-- table rowKey="id" :scroll="{ x: 1500 }"-->
  72. <a-card :bordered="false" style="marginTop:10px;">
  73. <a-table
  74. bordered
  75. :row-key="record => record.id"
  76. :columns="externalStatisticsColumns"
  77. :data-source="externalStatisticsData"
  78. :loading="loading"
  79. :pagination="pagination"
  80. @change="handleTableChange"
  81. >
  82. </a-table>
  83. </a-card>
  84. </div>
  85. </template>
  86. <script>
  87. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  88. import JEllipsis from '@/components/jeecg/JEllipsis'
  89. import moment from 'moment'
  90. import departmentChart from '@views/reportForms/order-statistics/chart/external/departmentChart'
  91. import customerChart from '@views/reportForms/order-statistics/chart/external/customerChart.vue'
  92. import { external } from '@api/reportForms/order-statistics.js'
  93. export default {
  94. name: 'ExternalStatistics', // 订单外部统计表
  95. mixins: [JeecgListMixin],
  96. components: { JEllipsis, moment, departmentChart, customerChart },
  97. data() {
  98. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  99. return {
  100. description: '订单外部统计表',
  101. externalStatisticsColumns: [
  102. {
  103. title: '部门',
  104. width: 140,
  105. dataIndex: 'department',
  106. className: 'replacecolor'
  107. },
  108. {
  109. title: '供应商分类',
  110. width: 120,
  111. dataIndex: 'supplierType',
  112. className: 'replacecolor'
  113. // customRender: function(text) {
  114. // if (text == '1') {
  115. // return '销售类型1'
  116. // }
  117. // if (text == '2') {
  118. // return '销售类型2'
  119. // }
  120. // if (text == '3') {
  121. // return '销售类型3'
  122. // }
  123. // if (text == '4') {
  124. // return '销售类型4'
  125. // }
  126. // }
  127. },
  128. {
  129. title: '供应商',
  130. width: 140,
  131. dataIndex: 'supplier',
  132. className: 'replacecolor'
  133. },
  134. {
  135. title: '计划到货月份',
  136. width: 120,
  137. dataIndex: 'planDeliveryMonth',
  138. customRender: text => {
  139. return moment(text).format('YYYY-MM')
  140. },
  141. className: 'replacecolor'
  142. },
  143. { title: '含税单价', width: 120, dataIndex: 'priceInTax', className: 'replacecolor' },
  144. {
  145. title: '实际数量',
  146. width: 120,
  147. dataIndex: 'realQuantity',
  148. className: 'replacecolor'
  149. },
  150. { title: '本币金额', width: 150, dataIndex: 'localMoney', className: 'replacecolor' }
  151. ],
  152. externalStatisticsData: [],
  153. loading: false, // 表格加载
  154. // 查询条件
  155. queryParam: {
  156. vendorType: '外部',
  157. startYearMonth: '',
  158. endYearMonth: '',
  159. // timeRange: [],
  160. department: '',
  161. customer: ''
  162. },
  163. pagination: {
  164. // total: '', //总条数
  165. // current: '', //当前页
  166. // pageSize: '' //一页多少
  167. },
  168. mode2: ['month', 'month'],
  169. value: []
  170. // dateFormat: 'YYYY-MM-DD'
  171. }
  172. },
  173. created() {
  174. this.getExternalData()
  175. },
  176. methods: {
  177. getExternalData() {
  178. this.$nextTick(() => {
  179. external(this.queryParam).then(res => {
  180. if (res.success) {
  181. this.ExternalData = res.result.records
  182. console.log('订单外部列表', this.ExternalData)
  183. this.pagination = {
  184. total: res.result.total,
  185. current: 1,
  186. pageSize: res.result.size
  187. }
  188. }
  189. })
  190. })
  191. },
  192. // 日期面板变化时的回调
  193. handlePanelChange(value, mode) {
  194. this.value = value
  195. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
  196. console.log('this.mode2', this.mode2)
  197. console.log('value.dateString[0]', moment(value[0]))
  198. console.log('value.dateString[1]', moment(value[0]))
  199. // this.queryParam.startYearMonth = dateString[0]
  200. // this.queryParam.endYearMonth = dateString[1]
  201. },
  202. // onDateChange(value, dateString) {
  203. // console.log('起年月', dateString[0], '始年月', dateString[1])
  204. // this.queryParam.startYearMonth = dateString[0]
  205. // this.queryParam.endYearMonth = dateString[1]
  206. // }
  207. // 时间发生变化的回调,发生在用户选择时间时
  208. handleChange(value) {
  209. console.log('?', value)
  210. this.value = value
  211. console.log('this.value', this.value)
  212. },
  213. searchQuery() {
  214. this.getExternalData()
  215. },
  216. searchReset() {
  217. this.queryParam = {}
  218. this.getExternalData()
  219. },
  220. // 分页、排序、筛选变化时触发
  221. handleTableChange(pagination, filters, sorter) {
  222. // console.log('当前页信息>>>>',pagination)
  223. this.queryParam.pageNo = pagination.current
  224. this.getExternalData()
  225. }
  226. },
  227. computed: {},
  228. mounted() {}
  229. }
  230. </script>
  231. <style lang="less" scoped>
  232. @import '~@assets/less/common.less';
  233. @import '~@assets/less/overwriter.less';
  234. /deep/ .ant-table-thead > tr > th {
  235. text-align: center;
  236. // font-weight: 700;
  237. }
  238. /deep/ .ant-table-tbody {
  239. text-align: center;
  240. }
  241. // /deep/ th.replacecolor {
  242. // background-color: #ccc;
  243. // }
  244. .departmentChart,
  245. .customerChart {
  246. // width: 100%;
  247. height: 600px;
  248. text-align: center;
  249. padding-top: 10px;
  250. }
  251. .departmentChart {
  252. margin-bottom: 20px;
  253. }
  254. </style>