list.vue 11 KB

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