list.vue 9.8 KB

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