list.vue 12 KB

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