warehouseDetail.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="inventoryQueryWarehouseDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="inventoryQueryWarehouseDetail-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="inventoryQueryWarehouseDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. </template>
  8. </a-page-header>
  9. <a-card size="small" :bordered="false" class="inventoryQueryWarehouseDetail-cont">
  10. <!-- 搜索条件 -->
  11. <div class="table-page-search-wrapper">
  12. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="变动类型">
  16. <v-select
  17. v-model="queryParam.flowType"
  18. ref="flowType"
  19. id="warehousingAuditList-flowType"
  20. code="STOCK_FLOW_TYPE"
  21. placeholder="请选择变动类型"
  22. allowClear></v-select>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="单据类型">
  27. <v-select
  28. v-model="queryParam.bizType"
  29. ref="bizType"
  30. id="inventoryQueryWarehouseDetail-bizType"
  31. code="STOCK_FLOW_BIZ_TYPE"
  32. placeholder="请选择单据类型"
  33. allowClear></v-select>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :md="6" :sm="24">
  37. <a-form-item label="仓库">
  38. <a-select id="inventoryQueryWarehouseDetail-warehouseSn" placeholder="请选择仓库" v-model="queryParam.warehouseSn" >
  39. <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  40. </a-select>
  41. </a-form-item>
  42. </a-col>
  43. <template v-if="advanced">
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="单据审核时间">
  46. <rangeDate ref="rangeDate" @change="dateChange" />
  47. </a-form-item>
  48. </a-col>
  49. <a-col :md="6" :sm="24">
  50. <a-form-item label="单位名称">
  51. <a-input id="inventoryQueryWarehouseDetail-unitName" v-model.trim="queryParam.unitName" allowClear placeholder="请输入单位名称"/>
  52. </a-form-item>
  53. </a-col>
  54. </template>
  55. <a-col :md="6" :sm="24">
  56. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryQueryWarehouseDetail-refresh">查询</a-button>
  57. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="inventoryQueryWarehouseDetail-reset">重置</a-button>
  58. <a @click="advanced=!advanced" style="margin-left: 8px">
  59. {{ advanced ? '收起' : '展开' }}
  60. <a-icon :type="advanced ? 'up' : 'down'"/>
  61. </a>
  62. </a-col>
  63. </a-row>
  64. </a-form>
  65. </div>
  66. <!-- 合计 -->
  67. <a-alert type="info" showIcon style="margin-bottom:15px">
  68. <div class="ftext" slot="message">当前库存总数量(个):<strong>{{ (productTotal&&productTotal.totalQty) ? productTotal.totalQty : 0 }}</strong>;当前库存总成本(¥):<strong>{{ (productTotal&&productTotal.totalCost) ? productTotal.totalCost : 0 }}</strong>。</div>
  69. </a-alert>
  70. <!-- 列表 -->
  71. <s-table
  72. class="sTable"
  73. ref="table"
  74. size="small"
  75. :rowKey="(record) => record.id"
  76. :columns="columns"
  77. :data="loadData"
  78. :scroll="{ x: 1760 }"
  79. bordered>
  80. <!-- 数量 -->
  81. <template slot="qty" slot-scope="text, record">
  82. <p :class="record.flowType=='PUT' ? 'green':'red'" style="margin: 0;">
  83. <span v-if="record.qty!=0">{{ record.flowType=='PUT' ? '+':'-' }}</span>
  84. {{ record.qty }}
  85. </p>
  86. </template>
  87. </s-table>
  88. </a-card>
  89. </div>
  90. </template>
  91. <script>
  92. import { STable, VSelect } from '@/components'
  93. import rangeDate from '@/views/common/rangeDate.vue'
  94. import { stockFlowList, stockFlowCount } from '@/api/stockFlow'
  95. import { warehouseAllList } from '@/api/warehouse'
  96. export default {
  97. components: { STable, VSelect, rangeDate },
  98. data () {
  99. return {
  100. advanced: false, // 高级搜索 展开/关闭
  101. queryParam: { // 查询条件
  102. beginDate: '',
  103. endDate: '',
  104. bizType: undefined,
  105. flowType: undefined,
  106. unitName: '',
  107. warehouseSn: undefined
  108. },
  109. disabled: false, // 查询、重置按钮是否可操作
  110. columns: [
  111. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  112. { title: '产品编码', dataIndex: 'product.code', width: 140, align: 'center', fixed: 'left', customRender: function (text) { return text || '--' } },
  113. { title: '产品名称', dataIndex: 'product.name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  114. { title: '原厂编码', dataIndex: 'product.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '入库批次时间', dataIndex: 'stockBatchNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  116. { title: '单据类型', dataIndex: 'bizTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  117. { title: '单据审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  118. { title: '单位名称', dataIndex: 'unitName', width: 200, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  119. { title: '仓库', dataIndex: 'warehouseName', width: 140, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  120. { title: '仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  121. { title: '数量', scopedSlots: { customRender: 'qty' }, width: 100, align: 'center' },
  122. { title: '总成本', dataIndex: 'totalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  123. { title: '总售价', dataIndex: 'totalPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  124. ],
  125. // 加载数据方法 必须为 Promise 对象
  126. loadData: parameter => {
  127. this.disabled = true
  128. const params = Object.assign(parameter, this.queryParam, { productSn: this.$route.params.sn })
  129. return stockFlowList(params).then(res => {
  130. const data = res.data
  131. const no = (data.pageNo - 1) * data.pageSize
  132. for (var i = 0; i < data.list.length; i++) {
  133. data.list[i].no = no + i + 1
  134. if (data.list[i].flowType == 'PUT') {
  135. data.list[i].qty = data.list[i].putQty
  136. } else if (data.list[i].flowType == 'OUT') {
  137. data.list[i].qty = data.list[i].outQty
  138. }
  139. }
  140. this.disabled = false
  141. this.getTotal(params)
  142. return data
  143. })
  144. },
  145. warehouseList: [], // 仓库 下拉数据
  146. productTotal: null // 合计
  147. }
  148. },
  149. methods: {
  150. // 时间 change
  151. dateChange (date) {
  152. this.queryParam.beginDate = date[0]
  153. this.queryParam.endDate = date[1]
  154. },
  155. // 合计
  156. getTotal (param) {
  157. stockFlowCount(param).then(res => {
  158. if (res.status == 200 && res.data) {
  159. this.productTotal = res.data
  160. } else {
  161. this.productTotal = null
  162. }
  163. })
  164. },
  165. // 重置
  166. resetSearchForm () {
  167. this.$refs.rangeDate.resetDate()
  168. this.queryParam.beginDate = ''
  169. this.queryParam.endDate = ''
  170. this.queryParam.bizType = undefined
  171. this.queryParam.flowType = undefined
  172. this.queryParam.unitName = ''
  173. this.queryParam.warehouseSn = undefined
  174. this.$refs.table.refresh(true)
  175. },
  176. // 返回列表
  177. handleBack () {
  178. this.$router.push({ path: '/inventoryManagement/inventoryQuery/list' })
  179. },
  180. // 仓库下拉数据
  181. getWarehouseList (type) {
  182. warehouseAllList({}).then(res => {
  183. if (res.status == 200) {
  184. this.warehouseList = res.data
  185. } else {
  186. this.warehouseList = []
  187. }
  188. })
  189. }
  190. },
  191. beforeRouteEnter (to, from, next) {
  192. next(vm => {
  193. vm.getWarehouseList()
  194. })
  195. }
  196. }
  197. </script>
  198. <style lang="less">
  199. .inventoryQueryWarehouseDetail-wrap{
  200. .inventoryQueryWarehouseDetail-back{
  201. margin-bottom: 15px;
  202. }
  203. .inventoryQueryWarehouseDetail-cont{
  204. margin-bottom: 15px;
  205. }
  206. .green{
  207. color: #19be6b;
  208. }
  209. .red{
  210. color: #ed1c24;
  211. }
  212. }
  213. </style>