interior-statistics.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <!-- 订单内部统计表-->
  3. <div id="interiorStatistics">
  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. required
  20. />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="8">
  24. <a-form-item label="部门">
  25. <j-search-select-tag
  26. placeholder="请选择部门"
  27. v-model="queryParam.department"
  28. dict="view_department,department,department">
  29. </j-search-select-tag>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="8">
  33. <a-form-item label="客户">
  34. <j-search-select-tag
  35. placeholder="请选择客户"
  36. v-model="queryParam.customer"
  37. dict="view_customer,customername,customername">
  38. </j-search-select-tag>
  39. </a-form-item>
  40. </a-col>
  41. <template v-if="toggleSearchStatus"></template>
  42. <a-col :md="6" :sm="8">
  43. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  44. <a-button type="primary" @click="searchQuery" :disabled="isDisabled" icon="search">查询</a-button>
  45. <a-button
  46. type="primary"
  47. @click="searchReset"
  48. :disabled="isDisabled"
  49. icon="reload"
  50. style="margin-left: 8px"
  51. >重置</a-button
  52. >
  53. <a @click="handleToggleSearch" style="margin-left: 8px">
  54. {{ toggleSearchStatus ? '收起' : '展开' }}
  55. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  56. </a>
  57. </span>
  58. </a-col>
  59. </a-row>
  60. </a-form>
  61. </div>
  62. </a-card>
  63. <!-- 引入 echarts -->
  64. <a-card :bordered="false" style="marginTop:10px;">
  65. <div class="chart">
  66. <!-- 部门 -->
  67. <div class="depChartStyle" style="background:rgba(255, 165, 0,.09);">
  68. <departmentChart ref="departmentChart" />
  69. </div>
  70. <!-- 客户 -->
  71. <div class="cusChartStyle" style="background:rgba(134, 151, 201,.08);">
  72. <customerChart ref="customerChart" />
  73. </div>
  74. </div>
  75. </a-card>
  76. <!-- table -->
  77. <a-card :bordered="false" style="marginTop:10px;">
  78. <a-table
  79. v-if="data"
  80. bordered
  81. rowKey="index"
  82. :columns="columns"
  83. :data-source="data"
  84. :loading="loading"
  85. :pagination="pagination"
  86. @change="handleTableChange"
  87. >
  88. </a-table>
  89. </a-card>
  90. </div>
  91. </template>
  92. <script>
  93. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  94. import JEllipsis from '@/components/jeecg/JEllipsis'
  95. import moment from 'moment'
  96. import departmentChart from '@views/reportForms/order-statistics/chart/interior/departmentChart'
  97. import customerChart from '@views/reportForms/order-statistics/chart/interior/customerChart.vue'
  98. import { externalList } from '@api/reportForms/order-statistics.js'
  99. import { myFormatDate } from '@/utils/myutil'
  100. export default {
  101. name: 'InteriorStatistics', // 订单内部统计表
  102. mixins: [JeecgListMixin],
  103. components: { JEllipsis, moment, departmentChart, customerChart },
  104. data() {
  105. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  106. return {
  107. description: '订单内部统计表',
  108. columns: [
  109. {
  110. title: '序号',
  111. width: 90,
  112. dataIndex: 'index',
  113. key: 'index',
  114. customRender: (text, record, index) => `${index + 1}`,
  115. className: 'replacecolor'
  116. },
  117. {
  118. title: '部门',
  119. width: 140,
  120. dataIndex: 'cdepName',
  121. className: 'replacecolor'
  122. },
  123. {
  124. title: '客户',
  125. width: 140,
  126. dataIndex: 'cvenAbbName',
  127. className: 'replacecolor'
  128. },
  129. {
  130. title: '计划到货月份',
  131. width: 120,
  132. dataIndex: 'yearMonth',
  133. customRender: text => {
  134. return moment(text).format('YYYY-MM')
  135. },
  136. className: 'replacecolor'
  137. },
  138. { title: '含税单价', width: 120, dataIndex: 'inatUnitPrice', className: 'replacecolor' },
  139. {
  140. title: '实际数量',
  141. width: 120,
  142. dataIndex: 'iquantity',
  143. className: 'replacecolor'
  144. },
  145. { title: '本币金额', width: 150, dataIndex: 'inatMoney', className: 'replacecolor' }
  146. ],
  147. data: [],
  148. loading: false, // 表格加载
  149. // 查询条件
  150. queryParam: {
  151. vendorType: '内部'
  152. // pageNo: '',
  153. // startYearMonth: '',
  154. // endYearMonth: '',
  155. // department: '',
  156. // customer: ''
  157. },
  158. pagination: {
  159. // total: '', //总条数
  160. // current: '', //当前页
  161. // pageSize: '' //一页多少
  162. },
  163. mode2: ['month', 'month'],
  164. value: [], //起始月份
  165. isDisabled: false, //按钮禁止
  166. monthFormat: 'YYYY-MM'
  167. // dateFormat: 'YYYY-MM-DD'
  168. }
  169. },
  170. mounted() {},
  171. created() {
  172. // 初次加载当月数据
  173. this.getThisMonthData();
  174. //this.value = [];
  175. //this.value.push(myFormatDate(new Date(),"yyyy-MM"));
  176. //this.value.push(myFormatDate(new Date(),"yyyy-MM"));
  177. },
  178. methods: {
  179. // 初次加载当月数据(列表、图)
  180. getThisMonthData() {
  181. this.$nextTick(() => {
  182. //let nowDate = new Date()
  183. //let date = {
  184. // year: nowDate.getFullYear(),
  185. // month: nowDate.getMonth() + 1
  186. //}
  187. //if (date.month >= 1 && date.month <= 9) {
  188. // date.month = '0' + date.month
  189. //}
  190. //var time = date.year + '-' + date.month
  191. //this.queryParam.startYearMonth = time
  192. //this.queryParam.endYearMonth = time
  193. this.queryParam.vendorType = '内部'
  194. externalList(this.queryParam).then(res => {
  195. // 参数给 chart
  196. this.$refs.departmentChart.queryParam = this.queryParam
  197. this.$refs.customerChart.queryParam = this.queryParam
  198. // console.log('????', this.$refs.departmentChart.queryParam)
  199. if (res.success) {
  200. this.data = res.result.records
  201. console.log('订单内部列表', this.data)
  202. this.pagination = {
  203. total: res.result.total,
  204. current: res.result.current,
  205. pageSize: res.result.size
  206. }
  207. }
  208. })
  209. })
  210. },
  211. // 查询订单统计
  212. getExternalData() {
  213. this.$nextTick(() => {
  214. this.queryParam.vendorType = '内部'
  215. externalList(this.queryParam).then(res => {
  216. // 参数给 chart
  217. this.$refs.departmentChart.queryParam = this.queryParam
  218. this.$refs.customerChart.queryParam = this.queryParam
  219. if (res.success) {
  220. this.data = res.result.records
  221. console.log('订单内部列表', this.data)
  222. this.pagination = {
  223. total: res.result.total,
  224. current: res.result.current,
  225. pageSize: res.result.size
  226. }
  227. }
  228. })
  229. })
  230. },
  231. searchQuery() {
  232. this.queryParam.pageNo = ''
  233. if (this.queryParam) {
  234. // 清空部门chart数据
  235. this.$refs.departmentChart.cdepNameArr = []
  236. this.$refs.departmentChart.iquantityArr = []
  237. this.$refs.departmentChart.inatMoneyArr = []
  238. // 清空客户chart数据
  239. this.$refs.customerChart.ccusNameArr = []
  240. this.$refs.customerChart.iquantityArr = []
  241. this.$refs.customerChart.inatMoneyArr = []
  242. this.getExternalData()
  243. //查询条件 传给 部门chart + 渲染
  244. this.$refs.departmentChart.queryParam = this.queryParam
  245. this.$refs.departmentChart.getDepChartData()
  246. //查询条件 传给 客户chart + 渲染
  247. this.$refs.customerChart.queryParam = this.queryParam
  248. this.$refs.customerChart.getCusChartData()
  249. }
  250. this.isDisabled = true
  251. setTimeout(() => {
  252. let that = this
  253. that.isDisabled = false
  254. }, 3000)
  255. },
  256. searchReset() {
  257. this.queryParam = {}
  258. this.value = [] //起始年月重置
  259. this.queryParam.startYearMonth = []
  260. this.queryParam.endYearMonth = []
  261. // 清空部门chart数据 + 查询条件 + 重新渲染
  262. this.$refs.departmentChart.cdepNameArr = []
  263. this.$refs.departmentChart.iquantityArr = []
  264. this.$refs.departmentChart.inatMoneyArr = []
  265. this.$refs.departmentChart.queryParam = {}
  266. this.$refs.departmentChart.getDepChartData()
  267. // 清空客户chart数据 + 查询条件 + 重新渲染
  268. this.$refs.customerChart.ccusNameArr = []
  269. this.$refs.customerChart.iquantityArr = []
  270. this.$refs.customerChart.inatMoneyArr = []
  271. this.$refs.customerChart.queryParam = {}
  272. this.$refs.customerChart.getCusChartData()
  273. // 重新渲染列表数据
  274. this.getExternalData()
  275. // 按钮置灰
  276. this.isDisabled = true
  277. setTimeout(() => {
  278. let that = this
  279. that.isDisabled = false
  280. }, 3000)
  281. },
  282. // 日期面板变化时的回调
  283. handlePanelChange(value, mode) {
  284. this.value = value
  285. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
  286. this.queryParam.startYearMonth = value[0].format('YYYY-MM')
  287. this.queryParam.endYearMonth = value[1].format('YYYY-MM')
  288. // console.log('开始年月:', this.queryParam.startYearMonth)
  289. // console.log('结束年月:', this.queryParam.endYearMonth)
  290. },
  291. // 时间发生变化的回调,发生在用户选择时间时
  292. monthChange(value) {
  293. this.value = value
  294. },
  295. handleTableChange(pagination, filters, sorter) {
  296. this.queryParam.pageNo = pagination.current
  297. this.getExternalData()
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="less" scoped>
  303. @import '~@assets/less/common.less';
  304. @import '~@assets/less/overwriter.less';
  305. /deep/ .ant-table-thead > tr > th {
  306. text-align: center;
  307. // font-weight: 700;
  308. }
  309. /deep/ .ant-table-tbody {
  310. text-align: center;
  311. }
  312. // /deep/ th.replacecolor {
  313. // background-color: #ccc;
  314. // }
  315. .depChartStyle,
  316. .cusChartStyle {
  317. // width: 100%;
  318. // height: 600px;
  319. text-align: center;
  320. padding-top: 10px;
  321. }
  322. .depChartStyle {
  323. margin-bottom: 20px;
  324. }
  325. </style>