list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div>
  3. <!-- 搜索条件 -->
  4. <a-card size="small" :bordered="false" class="searchBoxNormal">
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form-model
  7. id="salesOrderWarehouseList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :rules="rules"
  12. :model="queryParam"
  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. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesManagementList-buyerName" @change="custChange" />
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-model-item label="销售单号">
  27. <a-input id="salesOrderWarehouseList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :md="6" :sm="24">
  31. <a-form-model-item label="业务状态">
  32. <v-select
  33. v-model="queryParam.billStatus"
  34. ref="billStatus"
  35. id="salesManagementList-billStatus"
  36. code="SALES_BILL_STATUS"
  37. placeholder="请选择业务状态"
  38. allowClear></v-select>
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  43. <Area id="salesOrderWarehouseList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  47. <a-form-model-item label="出库仓库">
  48. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  49. </a-form-model-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="salesOrderWarehouseList-refresh">查询</a-button>
  53. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesOrderWarehouseList-reset">重置</a-button>
  54. <a-button
  55. style="margin-left: 10px"
  56. type="primary"
  57. class="button-warning"
  58. @click="handleExport"
  59. :disabled="disabled"
  60. :loading="exportLoading"
  61. v-if="$hasPermissions('B_salesOrderWarehouseExport')"
  62. >导出</a-button>
  63. </a-col>
  64. </a-row>
  65. </a-form-model>
  66. </div>
  67. </a-card>
  68. <a-card size="small" :bordered="false" class="salesOrderWarehouseList-wrap">
  69. <a-spin :spinning="spinning" tip="Loading...">
  70. <div class="tongji-bar" style="margin-bottom:10px">
  71. <!-- 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '0' }}</strong>; -->
  72. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  73. </div>
  74. <!-- 列表 -->
  75. <v-table
  76. class="sTable fixPagination"
  77. ref="table"
  78. :style="{ height: tableHeight+35+'px' }"
  79. size="small"
  80. rowKeyName="no"
  81. :columns="columns"
  82. :pagination="{pageSize:30}"
  83. :data="loadData"
  84. :scroll="{ y: tableHeight }"
  85. :defaultLoadData="false"
  86. bordered>
  87. <!-- 单号 -->
  88. <template slot="stockOutNo" slot-scope="text, record" v-if="$hasPermissions('B_salesOrderWarehouseDetail')">
  89. <span class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  90. <a-badge count="促" v-if="record.promoFlag==1" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
  91. </template>
  92. </v-table>
  93. </a-spin>
  94. <!-- 导出提示框 -->
  95. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  96. </a-card>
  97. </div>
  98. </template>
  99. <script>
  100. import { commonMixin } from '@/utils/mixin'
  101. import moment from 'moment'
  102. import rangeDate from '@/views/common/rangeDate.vue'
  103. import getDate from '@/libs/getDate.js'
  104. import Area from '@/views/common/area.js'
  105. import reportModal from '@/views/common/reportModal.vue'
  106. import { VTable, VSelect } from '@/components'
  107. import chooseWarehouse from '@/views/common/chooseWarehouse'
  108. import { queryPageForWarehouse, queryCountForWarehouse, exportForWarehouse } from '@/api/salesNew'
  109. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  110. import { hdExportExcel } from '@/libs/exportExcel'
  111. export default {
  112. name: 'SalesOrderWarehouseList',
  113. mixins: [commonMixin],
  114. components: { VTable, VSelect, rangeDate, Area, chooseWarehouse, reportModal, dealerSubareaScopeList },
  115. data () {
  116. return {
  117. spinning: false,
  118. tableHeight: 0,
  119. queryParam: { // 查询条件
  120. time: [
  121. moment(getDate.getCurrMonthDays().starttime, 'YYYY-MM-DD'),
  122. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  123. ],
  124. beginDate: getDate.getThreeMonthDays().starttime, // 开始时间
  125. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  126. buyerSn: '', // 客户名称
  127. billStatus: 'WAIT_AUDIT', // 业务状态
  128. salesBillNo: '', // 销售单号
  129. shippingAddrProvinceSn: undefined, // 地址sn
  130. warehouseSn: undefined // 仓库sn
  131. },
  132. exportLoading: false, // 导出loading
  133. disabled: false, // 查询、重置按钮是否可操作
  134. loading: false,
  135. totalData: null, // 统计信息
  136. showExport: false, // 导出提示框
  137. // 校验规则
  138. rules: {
  139. 'time': [{ required: true, message: '请选择创建时间', trigger: 'change' }]
  140. },
  141. // 加载数据方法 必须为 Promise 对象
  142. loadData: parameter => {
  143. this.disabled = true
  144. this.spinning = true
  145. const params = Object.assign(parameter, this.queryParam)
  146. return queryPageForWarehouse(params).then(res => {
  147. let data
  148. if (res.status == 200) {
  149. data = res.data
  150. const no = (data.pageNo - 1) * data.pageSize
  151. for (var i = 0; i < data.list.length; i++) {
  152. data.list[i].no = no + i + 1
  153. }
  154. this.getCount(params)
  155. this.disabled = false
  156. }
  157. this.spinning = false
  158. return data
  159. })
  160. }
  161. }
  162. },
  163. computed: {
  164. columns () {
  165. const arr = [
  166. { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
  167. { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  168. { title: '销售单号', scopedSlots: { customRender: 'stockOutNo' }, width: '15%', align: 'center' },
  169. { title: '提交时间', dataIndex: 'submitDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '32%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  171. { title: '总数量', dataIndex: 'totalQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  172. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
  173. ]
  174. // 如果显示仓库
  175. if (this.isShowWarehouse) {
  176. arr.splice(5, 0, { title: '出库仓库', dataIndex: 'warehouseName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  177. }
  178. return arr
  179. }
  180. },
  181. methods: {
  182. // 查询
  183. handleSearch () {
  184. const _this = this
  185. this.$refs.ruleForm.validate(valid => {
  186. if (valid) {
  187. _this.$refs.table.refresh(true)
  188. } else {
  189. _this.$message.error('请选择创建时间')
  190. return false
  191. }
  192. })
  193. },
  194. // 选择客户
  195. custChange (val) {
  196. this.queryParam.buyerSn = val.key
  197. },
  198. // 获取总数量
  199. getCount (params) {
  200. queryCountForWarehouse(params).then(res => {
  201. if (res.status == 200) {
  202. this.totalData = res.data
  203. } else {
  204. this.totalData = null
  205. }
  206. })
  207. },
  208. // 导出
  209. handleExport () {
  210. const _this = this
  211. _this.exportLoading = true
  212. _this.spinning = true
  213. hdExportExcel(exportForWarehouse, _this.queryParam, '仓库销售单明细', function () {
  214. _this.exportLoading = false
  215. _this.spinning = false
  216. _this.showExport = true
  217. })
  218. },
  219. // 选择时间 change
  220. dateChange (date) {
  221. if (date[0] && date[1]) {
  222. this.queryParam.time = date
  223. } else {
  224. this.queryParam.time = []
  225. }
  226. this.queryParam.beginDate = date[0] || ''
  227. this.queryParam.endDate = date[1] || ''
  228. },
  229. // 重置
  230. resetSearchForm () {
  231. this.queryParam.time = [
  232. getDate.getCurrMonthDays().starttime,
  233. getDate.getCurrMonthDays().endtime
  234. ]
  235. this.$refs.rangeDate.resetDate(this.queryParam.time)
  236. this.$refs.dealerSubareaScopeList.resetForm()
  237. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  238. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  239. this.queryParam.buyerSn = ''
  240. this.queryParam.billStatus = 'WAIT_AUDIT'
  241. this.queryParam.salesBillNo = ''
  242. this.queryParam.shippingAddrProvinceSn = undefined
  243. this.queryParam.warehouseSn = undefined
  244. this.$refs.table.refresh(true)
  245. },
  246. // 打开详情页面
  247. handleDetail (row) {
  248. this.$router.push({ path: `/salesManagement/salesOrderWarehouse/detail/${row.salesBillSn}/${row.warehouseSn}` })
  249. },
  250. // 初始化
  251. pageInit () {
  252. const _this = this
  253. this.$nextTick(() => { // 页面渲染完成后的回调
  254. _this.setTableH()
  255. })
  256. this.rowSelectionInfo = null
  257. this.$refs.table.clearSelected()
  258. },
  259. setTableH () {
  260. const tableSearchH = this.$refs.tableSearch.offsetHeight
  261. this.tableHeight = window.innerHeight - tableSearchH - 190
  262. }
  263. },
  264. watch: {
  265. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  266. this.setTableH()
  267. }
  268. },
  269. mounted () {
  270. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  271. this.pageInit()
  272. this.resetSearchForm()
  273. }
  274. },
  275. activated () {
  276. // 如果是新页签打开,则重置当前页面
  277. if (this.$store.state.app.isNewTab) {
  278. this.pageInit()
  279. this.resetSearchForm()
  280. }
  281. // 仅刷新列表,不重置页面
  282. if (this.$store.state.app.updateList) {
  283. this.pageInit()
  284. this.$refs.table.refresh()
  285. }
  286. },
  287. beforeRouteEnter (to, from, next) {
  288. next(vm => {})
  289. }
  290. }
  291. </script>
  292. <style lang="less">
  293. .salesOrderWarehouseList-wrap{
  294. margin-bottom: 6px;
  295. &:first-child{
  296. .ant-card-body{
  297. padding-bottom: 2px;
  298. }
  299. }
  300. }
  301. </style>