list.vue 8.8 KB

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