list.vue 9.6 KB

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