list.vue 10 KB

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