list.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <a-card size="small" :bordered="false" class="allocationPresentationList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form-model
  7. id="allocationPresentationList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :model="queryParam"
  12. :rules="rules"
  13. @keyup.enter.native="handleSearch">
  14. <a-row :gutter="15">
  15. <a-col :md="6" :sm="24">
  16. <a-form-model-item label="调拨日期" prop="time">
  17. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <a-form-model-item label="客户名称">
  22. <a-input id="allocationPresentationList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入客户名称"/>
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-model-item label="客户级别">
  27. <v-select
  28. v-model="queryParam.dealer.dealerLevel"
  29. ref="dealerLevel"
  30. id="allocationPresentationList-dealerLevel"
  31. code="DEALER_LEVEL"
  32. placeholder="请选择客户级别"
  33. allowClear></v-select>
  34. </a-form-model-item>
  35. </a-col>
  36. <template v-if="advanced">
  37. <a-col :md="6" :sm="24">
  38. <a-form-model-item label="调拨单号">
  39. <a-input id="allocationPresentationList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  40. </a-form-model-item>
  41. </a-col>
  42. <a-col :md="6" :sm="24">
  43. <a-form-model-item label="所在区域">
  44. <subarea id="allocationPresentationList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :md="12" :sm="24">
  48. <a-row>
  49. <a-form-model-item label="地区" style="margin-bottom: 0!important;">
  50. <a-col span="7">
  51. <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
  52. <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
  53. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  54. </a-select>
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col span="7" offset="1">
  58. <a-form-model-item prop="dealerCitySn" style="margin: 0;">
  59. <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
  60. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  61. </a-select>
  62. </a-form-model-item>
  63. </a-col>
  64. <a-col span="7" offset="1">
  65. <a-form-model-item prop="dealerCountySn" style="margin: 0;">
  66. <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
  67. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  68. </a-select>
  69. </a-form-model-item>
  70. </a-col>
  71. </a-form-model-item>
  72. </a-row>
  73. </a-col>
  74. </template>
  75. <a-col :md="6" :sm="24">
  76. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="allocationPresentationList-refresh">查询</a-button>
  77. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocationPresentationList-reset">重置</a-button>
  78. <a-button
  79. style="margin-left: 5px"
  80. type="primary"
  81. class="button-warning"
  82. @click="handleExport"
  83. :disabled="disabled"
  84. :loading="exportLoading"
  85. v-if="$hasPermissions('B_allocationPresentationExport')"
  86. id="allocationPresentationList-export">导出</a-button>
  87. <a @click="advanced=!advanced" style="margin-left: 5px">
  88. {{ advanced ? '收起' : '展开' }}
  89. <a-icon :type="advanced ? 'up' : 'down'"/>
  90. </a>
  91. </a-col>
  92. </a-row>
  93. </a-form-model>
  94. </div>
  95. <!-- 列表 -->
  96. <s-table
  97. class="sTable"
  98. ref="table"
  99. size="small"
  100. :defaultLoadData="false"
  101. :rowKey="(record) => record.id"
  102. :columns="columns"
  103. :data="loadData"
  104. :scroll="{ x: 1840 }"
  105. bordered>
  106. <template slot="footer">
  107. <a-row>
  108. <a-col span="2">合计:</a-col>
  109. <a-col span="22">
  110. <a-row>
  111. <a-col span="4">配送品调拨:{{ (totalData && (totalData.pspdb || totalData.pspdb==0)) ? totalData.pspdb : '--' }}</a-col>
  112. <a-col span="4">有偿调拨:{{ (totalData && (totalData.ycdb || totalData.ycdb==0)) ? totalData.ycdb : '--' }}</a-col>
  113. <a-col span="4">促销调拨:{{ (totalData && (totalData.cxdb || totalData.cxdb==0)) ? totalData.cxdb : '--' }}</a-col>
  114. <a-col span="4">退换品调拨:{{ (totalData && (totalData.thpdb || totalData.thpdb==0)) ? totalData.thpdb : '--' }}</a-col>
  115. <a-col span="4">样品调拨:{{ (totalData && (totalData.ypdb || totalData.ypdb==0)) ? totalData.ypdb : '--' }}</a-col>
  116. <a-col span="4">仓库误差调拨:{{ (totalData && (totalData.ckwcdb || totalData.ckwcdb==0)) ? totalData.ckwcdb : '--' }}</a-col>
  117. <a-col span="4">TBU刹车片配送品调拨:{{ (totalData && (totalData.tbudb || totalData.tbudb==0)) ? totalData.tbudb : '--' }}</a-col>
  118. <a-col span="4">NGK配送品调拨:{{ (totalData && (totalData.ngkdb || totalData.ngkdb==0)) ? totalData.ngkdb : '--' }}</a-col>
  119. <a-col span="4">德路斯调拨:{{ (totalData && (totalData.dlsdb || totalData.dlsdb==0)) ? totalData.dlsdb : '--' }}</a-col>
  120. <a-col span="4">新加盟商政策调拨:{{ (totalData && (totalData.xjmszcdb || totalData.xjmszcdb==0)) ? totalData.xjmszcdb : '--' }}</a-col>
  121. <a-col span="4">特殊申请配送品调拨:{{ (totalData && (totalData.tssqpspdb || totalData.tssqpspdb==0)) ? totalData.tssqpspdb : '--' }}</a-col>
  122. <a-col span="4">特殊申请促销调拨:{{ (totalData && (totalData.tssqcxdb || totalData.tssqcxdb==0)) ? totalData.tssqcxdb : '--' }}</a-col>
  123. <a-col span="4">卡扣配送品调拨:{{ (totalData && (totalData.kkpspdb || totalData.kkpspdb==0)) ? totalData.kkpspdb : '--' }}</a-col>
  124. <a-col span="4">客诉样品调拨:{{ (totalData && (totalData.ksypdb || totalData.ksypdb==0)) ? totalData.ksypdb : '--' }}</a-col>
  125. <a-col span="6" v-if="$hasPermissions('B_isShowPrice')">调拨单合计金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? totalData.totalCost : '--' }}</a-col>
  126. </a-row>
  127. </a-col>
  128. </a-row>
  129. </template>
  130. </s-table>
  131. </a-spin>
  132. <!-- 导出提示框 -->
  133. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  134. </a-card>
  135. </template>
  136. <script>
  137. import { commonMixin } from '@/utils/mixin'
  138. import { STable, VSelect } from '@/components'
  139. import rangeDate from '@/views/common/rangeDate.vue'
  140. import reportModal from '@/views/common/reportModal.vue'
  141. import subarea from '@/views/common/subarea.js'
  142. import { getArea } from '@/api/data'
  143. import { hdExportExcel } from '@/libs/exportExcel'
  144. import { reportAllocateDbjdReportList, reportAllocateDbjdReportCount, reportAllocateDbjdReportExport } from '@/api/reportData'
  145. export default {
  146. name: 'AllocationPresentationList',
  147. mixins: [commonMixin],
  148. components: { STable, VSelect, rangeDate, subarea, reportModal },
  149. data () {
  150. return {
  151. spinning: false,
  152. advanced: true, // 高级搜索 展开/关闭
  153. showExport: false,
  154. queryParam: { // 查询条件
  155. time: [],
  156. beginDate: '',
  157. endDate: '',
  158. allocateNo: '',
  159. targetName: '',
  160. dealer: {
  161. 'provinceSn': undefined,
  162. 'citySn': undefined,
  163. 'districtSn': undefined,
  164. 'subareaSn': undefined,
  165. 'dealerLevel': undefined
  166. }
  167. },
  168. rules: {
  169. 'time': [{ required: true, message: '请选择调拨日期', trigger: 'change' }]
  170. },
  171. disabled: false, // 查询、重置按钮是否可操作
  172. exportLoading: false,
  173. // 加载数据方法 必须为 Promise 对象
  174. loadData: parameter => {
  175. this.disabled = true
  176. this.spinning = true
  177. const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) // 有分页
  178. return reportAllocateDbjdReportList(paramsPage).then(res => {
  179. let data
  180. if (res.status == 200) {
  181. data = res.data
  182. this.getCount(paramsPage)
  183. const no = (data.pageNo - 1) * data.pageSize
  184. for (var i = 0; i < data.list.length; i++) {
  185. data.list[i].no = no + i + 1
  186. }
  187. this.disabled = false
  188. }
  189. this.spinning = false
  190. return data
  191. })
  192. },
  193. totalData: null,
  194. addrProvinceList: [], // 省下拉
  195. addrCityList: [], // 市下拉
  196. addrDistrictList: [] // 区下拉
  197. }
  198. },
  199. computed: {
  200. columns () {
  201. const arr = [
  202. { title: '区域', dataIndex: 'dealerEntity.subareaNameSet', width: 100, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
  203. { title: '调拨单号', dataIndex: 'allocateNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  204. { title: '省份', dataIndex: 'dealerEntity.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  205. { title: '客户名称', dataIndex: 'targetName',width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  206. { title: '客户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  207. { title: '调拨类型',
  208. align: 'center',
  209. children: [
  210. {
  211. title: '配送品调拨',
  212. dataIndex: 'pspdb',
  213. align: 'center',
  214. width: 80,
  215. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  216. },
  217. {
  218. title: '有偿调拨',
  219. dataIndex: 'ycdb',
  220. align: 'center',
  221. width: 80,
  222. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  223. },
  224. {
  225. title: '促销调拨',
  226. dataIndex: 'cxdb',
  227. align: 'center',
  228. width: 80,
  229. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  230. },
  231. {
  232. title: '退换品调拨',
  233. dataIndex: 'thpdb',
  234. align: 'center',
  235. width: 80,
  236. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  237. },
  238. {
  239. title: '样品调拨',
  240. dataIndex: 'ypdb',
  241. align: 'center',
  242. width: 80,
  243. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  244. },
  245. {
  246. title: '仓库误差调拨',
  247. dataIndex: 'ckwcdb',
  248. align: 'center',
  249. width: 80,
  250. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  251. },
  252. {
  253. title: 'TBU刹车片配送品调拨',
  254. dataIndex: 'tbudb',
  255. align: 'center',
  256. width: 80,
  257. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  258. },
  259. {
  260. title: 'NGK配送品调拨',
  261. dataIndex: 'ngkdb',
  262. align: 'center',
  263. width: 80,
  264. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  265. },
  266. {
  267. title: '德路斯调拨',
  268. dataIndex: 'dlsdb',
  269. align: 'center',
  270. width: 80,
  271. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  272. },
  273. {
  274. title: '新加盟商政策调拨',
  275. dataIndex: 'xjmszcdb',
  276. align: 'center',
  277. width: 80,
  278. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  279. },
  280. {
  281. title: '特殊申请配送品调拨',
  282. dataIndex: 'tssqpspdb',
  283. align: 'center',
  284. width: 80,
  285. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  286. },
  287. {
  288. title: '特殊申请促销调拨',
  289. dataIndex: 'tssqcxdb',
  290. align: 'center',
  291. width: 80,
  292. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  293. },
  294. {
  295. title: '卡扣配送品调拨',
  296. dataIndex: 'kkpspdb',
  297. align: 'center',
  298. width: 80,
  299. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  300. },
  301. {
  302. title: '客诉样品调拨',
  303. dataIndex: 'ksypdb',
  304. align: 'center',
  305. width: 80,
  306. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  307. }
  308. ]
  309. }
  310. // { title: '调拨单合计金额', width: 90, dataIndex: 'totalCost', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
  311. ]
  312. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  313. arr.splice(arr.length, 0, { title: '调拨单合计金额', width: 90, dataIndex: 'totalCost', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } })
  314. }
  315. return arr
  316. }
  317. },
  318. methods: {
  319. // 导出
  320. handleExport () {
  321. const _this = this
  322. this.$refs.ruleForm.validate(valid => {
  323. if (valid) {
  324. const params = _this.queryParam
  325. _this.showExport = true
  326. delete params.time
  327. _this.exportLoading = true
  328. _this.spinning = true
  329. hdExportExcel(reportAllocateDbjdReportExport, params, '调拨交单报表', function () {
  330. _this.exportLoading = false
  331. _this.spinning = false
  332. })
  333. } else {
  334. return false
  335. }
  336. })
  337. },
  338. // 总计
  339. getCount (params) {
  340. reportAllocateDbjdReportCount(params).then(res => {
  341. if (res.status == 200 && res.data) {
  342. this.totalData = res.data
  343. } else {
  344. this.totalData = null
  345. }
  346. })
  347. },
  348. handleSearch () {
  349. const _this = this
  350. this.$refs.ruleForm.validate(valid => {
  351. if (valid) {
  352. _this.$refs.table.refresh(true)
  353. } else {
  354. return false
  355. }
  356. })
  357. },
  358. // 创建时间 change
  359. dateChange (date) {
  360. if (date[0] && date[1]) {
  361. this.queryParam.time = date
  362. } else {
  363. this.queryParam.time = []
  364. }
  365. this.queryParam.beginDate = date[0] || ''
  366. this.queryParam.endDate = date[1] || ''
  367. },
  368. // 重置
  369. resetSearchForm () {
  370. this.queryParam.time = []
  371. this.$refs.rangeDate.resetDate(this.queryParam.time)
  372. this.queryParam.beginDate = ''
  373. this.queryParam.endDate = ''
  374. this.queryParam.allocateNo = ''
  375. this.queryParam.targetName = ''
  376. this.queryParam.dealer = {
  377. 'provinceSn': undefined,
  378. 'citySn': undefined,
  379. 'districtSn': undefined,
  380. 'subareaSn': undefined,
  381. 'dealerLevel': undefined
  382. }
  383. this.totalData = null
  384. this.$refs.ruleForm.resetFields()
  385. this.$refs.table.clearTable()
  386. },
  387. // 获取城市列表
  388. getCityList (val) {
  389. this.addrCityList = []
  390. this.addrDistrictList = []
  391. this.queryParam.dealer.citySn = undefined
  392. this.queryParam.dealer.districtSn = undefined
  393. if (val) {
  394. this.getArea('city', val)
  395. }
  396. },
  397. // 获取区县列表
  398. getAreaList (val) {
  399. this.addrDistrictList = []
  400. this.queryParam.dealer.districtSn = undefined
  401. if (val) {
  402. this.getArea('district', val)
  403. }
  404. },
  405. // 省/市/区
  406. getArea (leve, sn) {
  407. let params
  408. if (leve == 'province') {
  409. params = { type: '2' }
  410. } else {
  411. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  412. }
  413. getArea(params).then(res => {
  414. if (res.status == 200) {
  415. if (leve == 'province') {
  416. this.addrProvinceList = res.data || []
  417. } else if (leve == 'city') {
  418. this.addrCityList = res.data || []
  419. } else if (leve == 'district') {
  420. this.addrDistrictList = res.data || []
  421. }
  422. } else {
  423. if (leve == 'province') {
  424. this.addrProvinceList = []
  425. } else if (leve == 'city') {
  426. this.addrCityList = []
  427. } else if (leve == 'district') {
  428. this.addrDistrictList = []
  429. }
  430. }
  431. })
  432. },
  433. pageInit () {
  434. this.getArea('province')
  435. }
  436. },
  437. mounted () {
  438. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  439. this.pageInit()
  440. this.resetSearchForm()
  441. }
  442. },
  443. activated () {
  444. // 如果是新页签打开,则重置当前页面
  445. if (this.$store.state.app.isNewTab) {
  446. this.pageInit()
  447. this.resetSearchForm()
  448. }
  449. },
  450. beforeRouteEnter (to, from, next) {
  451. next(vm => {})
  452. }
  453. }
  454. </script>