interior-statistics.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. :dictOptions="cdepNameOption">
  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. :dictOptions="ccusNameOption">
  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" @option="getCdepNameOption"/>
  69. </div>
  70. <!-- 客户 -->
  71. <div class="cusChartStyle" style="background:rgba(134, 151, 201,.08);" >
  72. <customerChart ref="customerChart" @option-ccusName="getCcusNameOption"/>
  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. cdepNameOption: [], //部门下拉数据
  149. ccusNameOption: [],//客户下拉数据
  150. loading: false, // 表格加载
  151. // 查询条件
  152. queryParam: {
  153. vendorType: '内部'
  154. // pageNo: '',
  155. // startYearMonth: '',
  156. // endYearMonth: '',
  157. // department: '',
  158. // customer: ''
  159. },
  160. pagination: {
  161. // total: '', //总条数
  162. // current: '', //当前页
  163. // pageSize: '' //一页多少
  164. },
  165. mode2: ['month', 'month'],
  166. value: [], //起始月份
  167. isDisabled: false, //按钮禁止
  168. monthFormat: 'YYYY-MM'
  169. // dateFormat: 'YYYY-MM-DD'
  170. }
  171. },
  172. mounted() {},
  173. created() {
  174. // 初次加载当月数据
  175. this.getThisMonthData();
  176. //this.value = [];
  177. //this.value.push(myFormatDate(new Date(),"yyyy-MM"));
  178. //this.value.push(myFormatDate(new Date(),"yyyy-MM"));
  179. },
  180. methods: {
  181. // 初次加载当月数据(列表、图)
  182. getThisMonthData() {
  183. this.$nextTick(() => {
  184. this.loading = true;
  185. //let nowDate = new Date()
  186. //let date = {
  187. // year: nowDate.getFullYear(),
  188. // month: nowDate.getMonth() + 1
  189. //}
  190. //if (date.month >= 1 && date.month <= 9) {
  191. // date.month = '0' + date.month
  192. //}
  193. //var time = date.year + '-' + date.month
  194. //this.queryParam.startYearMonth = time
  195. //this.queryParam.endYearMonth = time
  196. this.queryParam.vendorType = '内部'
  197. externalList(this.queryParam).then(res => {
  198. this.loading = false;
  199. // 参数给 chart
  200. this.$refs.departmentChart.queryParam = this.queryParam
  201. this.$refs.customerChart.queryParam = this.queryParam
  202. // console.log('????', this.$refs.departmentChart.queryParam)
  203. if (res.success) {
  204. this.data = res.result.records
  205. console.log('订单内部列表', this.data)
  206. this.pagination = {
  207. total: res.result.total,
  208. current: res.result.current,
  209. pageSize: res.result.size
  210. }
  211. }
  212. })
  213. })
  214. },
  215. // 查询订单统计
  216. getExternalData() {
  217. this.$nextTick(() => {
  218. this.loading = true;
  219. this.queryParam.vendorType = '内部'
  220. externalList(this.queryParam).then(res => {
  221. this.loading = false;
  222. // 参数给 chart
  223. this.$refs.departmentChart.queryParam = this.queryParam
  224. this.$refs.customerChart.queryParam = this.queryParam
  225. if (res.success) {
  226. this.data = res.result.records
  227. console.log('订单内部列表', this.data)
  228. this.pagination = {
  229. total: res.result.total,
  230. current: res.result.current,
  231. pageSize: res.result.size
  232. }
  233. }
  234. })
  235. })
  236. },
  237. searchQuery() {
  238. this.queryParam.pageNo = ''
  239. if (this.queryParam) {
  240. // 清空部门chart数据
  241. this.$refs.departmentChart.cdepNameArr = []
  242. this.$refs.departmentChart.iquantityArr = []
  243. this.$refs.departmentChart.inatMoneyArr = []
  244. // 清空客户chart数据
  245. this.$refs.customerChart.ccusNameArr = []
  246. this.$refs.customerChart.iquantityArr = []
  247. this.$refs.customerChart.inatMoneyArr = []
  248. this.getExternalData()
  249. //查询条件 传给 部门chart + 渲染
  250. this.$refs.departmentChart.queryParam = this.queryParam
  251. this.$refs.departmentChart.getDepChartData()
  252. //查询条件 传给 客户chart + 渲染
  253. this.$refs.customerChart.queryParam = this.queryParam
  254. this.$refs.customerChart.getCusChartData()
  255. }
  256. this.isDisabled = true
  257. setTimeout(() => {
  258. let that = this
  259. that.isDisabled = false
  260. }, 3000)
  261. },
  262. searchReset() {
  263. this.queryParam = {}
  264. this.value = [] //起始年月重置
  265. this.queryParam.startYearMonth = []
  266. this.queryParam.endYearMonth = []
  267. // 清空部门chart数据 + 查询条件 + 重新渲染
  268. this.$refs.departmentChart.cdepNameArr = []
  269. this.$refs.departmentChart.iquantityArr = []
  270. this.$refs.departmentChart.inatMoneyArr = []
  271. this.$refs.departmentChart.queryParam = {}
  272. this.$refs.departmentChart.getDepChartData()
  273. // 清空客户chart数据 + 查询条件 + 重新渲染
  274. this.$refs.customerChart.ccusNameArr = []
  275. this.$refs.customerChart.iquantityArr = []
  276. this.$refs.customerChart.inatMoneyArr = []
  277. this.$refs.customerChart.queryParam = {}
  278. this.$refs.customerChart.getCusChartData()
  279. // 重新渲染列表数据
  280. this.getExternalData()
  281. // 按钮置灰
  282. this.isDisabled = true
  283. setTimeout(() => {
  284. let that = this
  285. that.isDisabled = false
  286. }, 3000)
  287. },
  288. // 日期面板变化时的回调
  289. handlePanelChange(value, mode) {
  290. this.value = value
  291. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
  292. this.queryParam.startYearMonth = value[0].format('YYYY-MM')
  293. this.queryParam.endYearMonth = value[1].format('YYYY-MM')
  294. // console.log('开始年月:', this.queryParam.startYearMonth)
  295. // console.log('结束年月:', this.queryParam.endYearMonth)
  296. },
  297. // 时间发生变化的回调,发生在用户选择时间时
  298. monthChange(value) {
  299. this.value = value
  300. this.queryParam.startYearMonth = ''
  301. this.queryParam.endYearMonth = ''
  302. },
  303. handleTableChange(pagination, filters, sorter) {
  304. this.queryParam.pageNo = pagination.current
  305. this.getExternalData()
  306. },
  307. //整理部门下拉框数据
  308. getCdepNameOption(val){
  309. val.map(item=>{
  310. this.cdepNameOption.push({text:item,value:item})
  311. })
  312. },
  313. //整理客户下拉框数据
  314. getCcusNameOption(index) {
  315. index.map(item=>{
  316. this.ccusNameOption.push({text:item,value:item})
  317. })
  318. }
  319. }
  320. }
  321. </script>
  322. <style lang="less" scoped>
  323. @import '~@assets/less/common.less';
  324. @import '~@assets/less/overwriter.less';
  325. /deep/ .ant-table-thead > tr > th {
  326. text-align: center;
  327. // font-weight: 700;
  328. }
  329. /deep/ .ant-table-tbody {
  330. text-align: center;
  331. }
  332. // /deep/ th.replacecolor {
  333. // background-color: #ccc;
  334. // }
  335. .depChartStyle,
  336. .cusChartStyle {
  337. // width: 100%;
  338. // height: 600px;
  339. text-align: center;
  340. padding-top: 10px;
  341. }
  342. .depChartStyle {
  343. margin-bottom: 20px;
  344. }
  345. </style>