warehouseDetail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="shelfMonitoringWarehousing-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="shelfMonitoringWarehousing-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span class="store-info" v-if="basicInfoData">{{ basicInfoData.shelfName || '' }} —— 货位号{{ basicInfoData.shelfPlaceCode || '' }}</span>
  9. </template>
  10. </a-page-header>
  11. <!-- 内容 -->
  12. <a-card size="small" :bordered="false" class="shelfMonitoringWarehousing-cont">
  13. <!-- 搜索条件 -->
  14. <div ref="tableSearch" class="table-page-search-wrapper">
  15. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="变动时间">
  19. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="关联单据类型">
  24. <v-select
  25. v-model="queryParam.bizType"
  26. ref="bizType"
  27. id="shelfMonitoringWarehousing-bizType"
  28. code="STOCK_BIZ_TYPE"
  29. placeholder="请选择关联单据类型"
  30. allowClear></v-select>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="关联单据号">
  35. <a-input id="shelfMonitoringWarehousing-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入关联单据号"/>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <span class="table-page-search-submitButtons">
  40. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shelfMonitoringWarehousing-refresh">查询</a-button>
  41. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="shelfMonitoringWarehousing-reset">重置</a-button>
  42. </span>
  43. </a-col>
  44. </a-row>
  45. </a-form>
  46. </div>
  47. <div style="margin-top: 25px;font-weight: bold;display: flex;align-items: center;">
  48. <p style="margin: 0 70px 8px 0;">产品编码:{{ (basicInfoData&&basicInfoData.productCode) || '--' }}</p>
  49. <p style="margin: 0 0 8px;">产品名称:{{ (basicInfoData&&basicInfoData.productName) || '--' }}</p>
  50. </div>
  51. <!-- 列表 -->
  52. <s-table
  53. class="sTable"
  54. ref="table"
  55. size="small"
  56. :rowKey="(record) => record.id"
  57. :columns="columns"
  58. :data="loadData"
  59. :defaultLoadData="false"
  60. bordered>
  61. <template slot="qty" slot-scope="text, record">
  62. {{ (record.bizType == 'PUT_REPLENISH_BILL' || record.bizType == 'MONTH') ? '+' : (record.bizType == 'OUT_RECALL_BILL' || record.bizType == 'OUT_ORDER_BILL') ? '-':'' }}
  63. {{ (record.qty || record.qty==0) ? record.qty : '--' }}
  64. </template>
  65. </s-table>
  66. </a-card>
  67. </a-spin>
  68. </div>
  69. </template>
  70. <script>
  71. import { commonMixin } from '@/utils/mixin'
  72. import { STable, VSelect } from '@/components'
  73. import rangeDate from '@/views/common/rangeDate.vue'
  74. import { shelfPutOutDetailList, shelfProductDetail } from '@/api/shelf'
  75. export default {
  76. components: { STable, VSelect, rangeDate },
  77. mixins: [commonMixin],
  78. data () {
  79. return {
  80. spinning: false,
  81. disabled: false, // 查询、重置按钮是否可操作
  82. time: [],
  83. queryParam: {
  84. beginDate: undefined,
  85. endDate: undefined,
  86. bizType: undefined,
  87. bizNo: ''
  88. },
  89. columns: [
  90. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  91. { title: '变动时间', dataIndex: 'changeDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  92. { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
  93. { title: '产品名称', dataIndex: 'productName', width: '24%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  94. { title: '关联单据类型', dataIndex: 'bizTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  95. { title: '关联单据号', dataIndex: 'bizNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  96. { title: '数量', scopedSlots: { customRender: 'qty' }, width: '8%', align: 'center' }
  97. // { title: '状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  98. ],
  99. // 加载数据方法 必须为 Promise 对象
  100. loadData: parameter => {
  101. this.disabled = true
  102. this.spinning = true
  103. return shelfPutOutDetailList(Object.assign(parameter, this.queryParam, { shelfPlaceSn: this.$route.params.shelfPlaceSn, productSn: this.$route.params.productSn })).then(res => {
  104. let data
  105. if (res.status == 200) {
  106. data = res.data
  107. const no = (data.pageNo - 1) * data.pageSize
  108. for (var i = 0; i < data.list.length; i++) {
  109. data.list[i].no = no + i + 1
  110. }
  111. this.disabled = false
  112. }
  113. this.spinning = false
  114. return data
  115. })
  116. },
  117. basicInfoData: null
  118. }
  119. },
  120. methods: {
  121. // 重置
  122. resetSearchForm () {
  123. this.$refs.rangeDate.resetDate()
  124. this.queryParam.beginDate = undefined
  125. this.queryParam.endDate = undefined
  126. this.queryParam.bizType = undefined
  127. this.queryParam.bizNo = ''
  128. this.$refs.table.refresh(true)
  129. },
  130. // 基本信息
  131. getDetail () {
  132. shelfProductDetail({ shelfPlaceSn: this.$route.params.shelfPlaceSn }).then(res => {
  133. if (res.status == 200) {
  134. this.basicInfoData = res.data
  135. } else {
  136. this.basicInfoData = null
  137. }
  138. })
  139. },
  140. // 返回列表
  141. handleBack () {
  142. this.$router.push({ path: '/numsGoodsShelves/shelfMonitoring/list' })
  143. },
  144. // 时间 change
  145. dateChange (date) {
  146. this.queryParam.beginDate = date[0] ? date[0] + ' 00:00:00' : null
  147. this.queryParam.endDate = date[1] ? date[1] + ' 23:59:59' : null
  148. }
  149. },
  150. mounted () {
  151. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  152. this.getDetail()
  153. this.resetSearchForm()
  154. }
  155. },
  156. activated () {
  157. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  158. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  159. this.getDetail()
  160. this.resetSearchForm()
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="less">
  166. .shelfMonitoringWarehousing-wrap{
  167. .store-info{
  168. margin: 0 15px;
  169. color: rgb(102, 102, 102);
  170. }
  171. .shelfMonitoringWarehousing-cont{
  172. margin-top: 10px;
  173. }
  174. .ant-descriptions-item-label.ant-descriptions-item-colon{
  175. width: 120px;
  176. }
  177. }
  178. </style>