external-statistics.vue 8.2 KB

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