list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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 _this = this
  142. const arr = [
  143. { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: '14%', align: 'center' },
  144. { title: '发货单号', scopedSlots: { customRender: 'sendBillNo' }, width: '14%', align: 'center' },
  145. { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  146. { title: '发货数量', dataIndex: 'totalPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  147. { title: '入库数量', dataIndex: 'totalRealPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  148. { title: '入库时间', dataIndex: 'stockPutTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '业务状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '入库', scopedSlots: { customRender: 'waitIn' }, width: '3%', align: 'center' },
  151. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  152. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  153. ]
  154. if (this.$hasPermissions('M_ShowAllCost')) {
  155. arr.splice(4, 0, { title: '发货金额', dataIndex: 'totalPutAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  156. arr.splice(6, 0, { title: '入库金额', dataIndex: 'totalRealPutAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  157. }
  158. return arr
  159. }
  160. },
  161. methods: {
  162. // 时间 change
  163. dateChange (date) {
  164. this.queryParam.beginDate = date[0]
  165. this.queryParam.endDate = date[1]
  166. },
  167. // 重置
  168. resetSearchForm () {
  169. this.$refs.rangeDate.resetDate(this.time)
  170. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  171. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  172. this.queryParam.purchaseBillNo = ''
  173. this.queryParam.sendBillNo = ''
  174. this.queryParam.auditState = undefined
  175. this.$refs.table.refresh(true)
  176. },
  177. // 详情
  178. handleDetail (row) {
  179. this.$router.push({ path: `/purchasingManagement/purchaseOrder/detail/${row.purchaseBillSn}`, query: { pageType: 'signWarehousingList' } })
  180. },
  181. // 备货单详情
  182. handleStockDetail (row) {
  183. this.$router.push({ path: `/purchasingManagement/signWarehousing/stockOrderDetail/${row.receivingBillSn}` })
  184. },
  185. // 签收入库
  186. handleWarehouse (row) {
  187. this.$router.push({ path: `/purchasingManagement/signWarehousing/edit/${row.receivingBillSn}` })
  188. },
  189. pageInit () {
  190. const _this = this
  191. this.$nextTick(() => { // 页面渲染完成后的回调
  192. _this.setTableH()
  193. })
  194. },
  195. setTableH () {
  196. const tableSearchH = this.$refs.tableSearch.offsetHeight
  197. this.tableHeight = window.innerHeight - tableSearchH - 200
  198. }
  199. },
  200. watch: {
  201. advanced (newValue, oldValue) {
  202. const _this = this
  203. this.$nextTick(() => { // 页面渲染完成后的回调
  204. _this.setTableH()
  205. })
  206. },
  207. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  208. this.setTableH()
  209. }
  210. },
  211. mounted () {
  212. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  213. this.pageInit()
  214. this.resetSearchForm()
  215. }
  216. },
  217. activated () {
  218. // 如果是新页签打开,则重置当前页面
  219. if (this.$store.state.app.isNewTab) {
  220. this.pageInit()
  221. this.resetSearchForm()
  222. }
  223. // 仅刷新列表,不重置页面
  224. if (this.$store.state.app.updateList) {
  225. this.pageInit()
  226. this.$refs.table.refresh()
  227. }
  228. },
  229. beforeRouteEnter (to, from, next) {
  230. next(vm => {})
  231. }
  232. }
  233. </script>