list.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <a-card size="small" :bordered="false" class="signWarehousingList-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. <rangeDateTime 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. <a-input id="signWarehousingList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="发货单号">
  20. <a-input id="signWarehousingList-sendBillNo" v-model.trim="queryParam.sendBillNo" allowClear placeholder="请输入发货单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="业务状态">
  26. <v-select
  27. v-model="queryParam.auditState"
  28. ref="auditState"
  29. id="chainTransferOutList-auditState"
  30. code="RECEIVING_BILL_STATUS"
  31. placeholder="请选择业务状态"
  32. allowClear></v-select>
  33. </a-form-item>
  34. </a-col>
  35. </template>
  36. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  37. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="signWarehousingList-refresh">查询</a-button>
  38. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="signWarehousingList-reset">重置</a-button>
  39. <a @click="advanced=!advanced" style="margin-left: 5px">
  40. {{ advanced ? '收起' : '展开' }}
  41. <a-icon :type="advanced ? 'up' : 'down'"/>
  42. </a>
  43. </a-col>
  44. </a-row>
  45. </a-form>
  46. </div>
  47. <!-- 列表 -->
  48. <s-table
  49. class="sTable fixPagination"
  50. ref="table"
  51. :style="{ height: tableHeight+84.5+'px' }"
  52. size="small"
  53. :rowKey="(record) => record.id"
  54. :columns="columns"
  55. :data="loadData"
  56. :scroll="{ y: tableHeight }"
  57. :defaultLoadData="false"
  58. bordered>
  59. <!-- 单号 -->
  60. <template slot="purchaseBillNo" slot-scope="text, record">
  61. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_purchaseDetail')" @click="handleDetail(record)">{{ record.purchaseBillNo || '--' }}</span>
  62. <span v-else>{{ record.purchaseBillNo || '--' }}</span>
  63. </template>
  64. <!-- 单号 -->
  65. <template slot="sendBillNo" slot-scope="text, record">
  66. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_signWarehousingDetail')" @click="handleStockDetail(record)">{{ record.sendBillNo || '--' }}</span>
  67. <span v-else>{{ record.sendBillNo || '--' }}</span>
  68. </template>
  69. <!-- 操作 -->
  70. <template slot="action" slot-scope="text, record">
  71. <a-button
  72. size="small"
  73. type="link"
  74. class="button-warning"
  75. v-if="(record.auditState == 'PUT_WAREHOUSE_AUDIT_REJECT' || record.auditState == 'WAIT_PUT_WAREHOUSE')&&$hasPermissions('B_signWarehousingSign')"
  76. @click="handleWarehouse(record)"
  77. >签收入库</a-button>
  78. <span v-if="!((record.auditState == 'PUT_WAREHOUSE_AUDIT_REJECT' || record.auditState == 'WAIT_PUT_WAREHOUSE')&&$hasPermissions('B_signWarehousingSign'))">--</span>
  79. </template>
  80. </s-table>
  81. </a-spin>
  82. </a-card>
  83. </template>
  84. <script>
  85. import { STable, VSelect } from '@/components'
  86. import rangeDateTime from '@/views/common/rangeDateTime.vue'
  87. import getDate from '@/libs/getDate.js'
  88. import { receivingStockList } from '@/api/receiving'
  89. export default {
  90. components: { STable, VSelect, rangeDateTime },
  91. data () {
  92. return {
  93. spinning: false,
  94. advanced: true, // 高级搜索 展开/关闭
  95. time: [
  96. getDate.getCurrMonthDays().starttime + ' 00:00:00',
  97. getDate.getCurrMonthDays().endtime + ' 23:59:59'
  98. ],
  99. queryParam: { // 查询条件
  100. beginDate: getDate.getCurrMonthDays().starttime + ' 00:00:00',
  101. endDate: getDate.getCurrMonthDays().endtime + ' 23:59:59',
  102. purchaseBillNo: '', // 采购单号
  103. sendBillNo: '', // 发货单号
  104. auditState: undefined
  105. },
  106. disabled: false, // 查询、重置按钮是否可操作
  107. tableHeight: 0,
  108. columns: [
  109. { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: '18%', align: 'center' },
  110. { title: '发货单号', scopedSlots: { customRender: 'sendBillNo' }, width: '18%', align: 'center' },
  111. { title: '创建时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  112. { title: '发货数量', dataIndex: 'totalPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  113. { title: '发货金额', dataIndex: 'totalPutAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  114. { title: '入库时间', dataIndex: 'stockPutTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '业务状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  116. { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
  117. ],
  118. // 加载数据方法 必须为 Promise 对象
  119. loadData: parameter => {
  120. this.disabled = true
  121. this.spinning = true
  122. return receivingStockList(Object.assign(parameter, this.queryParam)).then(res => {
  123. const data = res.data
  124. const no = (data.pageNo - 1) * data.pageSize
  125. for (var i = 0; i < data.list.length; i++) {
  126. data.list[i].no = no + i + 1
  127. }
  128. this.disabled = false
  129. this.spinning = false
  130. return data
  131. })
  132. },
  133. purchaseTragetType: []
  134. }
  135. },
  136. methods: {
  137. // 时间 change
  138. dateChange (date) {
  139. this.queryParam.beginDate = date[0]
  140. this.queryParam.endDate = date[1]
  141. },
  142. // 重置
  143. resetSearchForm () {
  144. this.$refs.rangeDate.resetDate(this.time)
  145. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime + ' 00:00:00'
  146. this.queryParam.endDate = getDate.getCurrMonthDays().endtime + ' 23:59:59'
  147. this.queryParam.purchaseBillNo = ''
  148. this.queryParam.sendBillNo = ''
  149. this.queryParam.auditState = undefined
  150. this.$refs.table.refresh(true)
  151. },
  152. // 详情
  153. handleDetail (row) {
  154. this.$router.push({ path: `/purchasingManagement/purchaseOrder/detail/${row.purchaseBillSn}`, query: { pageType: 'signWarehousingList' } })
  155. },
  156. // 备货单详情
  157. handleStockDetail (row) {
  158. this.$router.push({ path: `/purchasingManagement/signWarehousing/stockOrderDetail/${row.receivingBillSn}` })
  159. },
  160. // 签收入库
  161. handleWarehouse (row) {
  162. this.$router.push({ path: `/purchasingManagement/signWarehousing/edit/${row.receivingBillSn}` })
  163. },
  164. pageInit () {
  165. const _this = this
  166. this.$nextTick(() => { // 页面渲染完成后的回调
  167. _this.setTableH()
  168. })
  169. },
  170. setTableH () {
  171. const tableSearchH = this.$refs.tableSearch.offsetHeight
  172. this.tableHeight = window.innerHeight - tableSearchH - 200
  173. }
  174. },
  175. watch: {
  176. advanced (newValue, oldValue) {
  177. const _this = this
  178. setTimeout(() => {
  179. _this.setTableH()
  180. }, 400)
  181. },
  182. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  183. this.setTableH()
  184. }
  185. },
  186. mounted () {
  187. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  188. this.pageInit()
  189. this.resetSearchForm()
  190. }
  191. },
  192. activated () {
  193. // 如果是新页签打开,则重置当前页面
  194. if (this.$store.state.app.isNewTab) {
  195. this.pageInit()
  196. this.resetSearchForm()
  197. }
  198. // 仅刷新列表,不重置页面
  199. if (this.$store.state.app.updateList) {
  200. this.pageInit()
  201. this.$refs.table.refresh()
  202. }
  203. },
  204. beforeRouteEnter (to, from, next) {
  205. next(vm => {})
  206. }
  207. }
  208. </script>