overall.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="inventoryCheckOverallList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="inventoryCheckOverallList-back" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="inventoryCheckOverallList-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span class="billno">单号:{{ basicInfoData&&basicInfoData.checkWarehouseNo }}</span>
  9. <a-tag color="blue">{{ basicInfoData&&basicInfoData.stateDictValue }}</a-tag>
  10. </template>
  11. </a-page-header>
  12. <!-- 基础信息 -->
  13. <a-card size="small" :bordered="false" class="inventoryCheckOverallList-cont">
  14. <a-collapse>
  15. <a-collapse-panel key="1" header="基础信息">
  16. <a-descriptions :column="3">
  17. <a-descriptions-item label="盘点类型">{{ (basicInfoData&&basicInfoData.checkTypeDictValue) || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="创建人">{{ (basicInfoData&&basicInfoData.creatorName) || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="创建时间">{{ (basicInfoData&&basicInfoData.createDate) || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="审核时间">{{ (basicInfoData&&basicInfoData.checkSuperviseTime) || '--' }}</a-descriptions-item>
  21. </a-descriptions>
  22. </a-collapse-panel>
  23. </a-collapse>
  24. </a-card>
  25. <a-card size="small" :bordered="false" class="inventoryCheckOverallList-cont">
  26. <!-- 总计 -->
  27. <a-alert type="info" style="margin-bottom:10px">
  28. <div slot="message">
  29. 总款数: <strong>{{ productTotal&&(productTotal.totalCategory || productTotal.totalCategory==0) ? productTotal.totalCategory : '--' }}</strong> ,
  30. 总数量: <strong>{{ productTotal&&(productTotal.stockQty || productTotal.stockQty==0) ? productTotal.stockQty : '--' }}</strong>
  31. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  32. ,总成本: <strong>{{ productTotal&&(productTotal.checkCost || productTotal.checkCost==0) ? '¥'+productTotal.checkCost : '--' }}</strong>。
  33. </div>
  34. </div>
  35. </a-alert>
  36. <!-- 筛选条件 -->
  37. <div class="table-page-search-wrapper">
  38. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  39. <a-row :gutter="15">
  40. <a-col :md="8" :sm="24">
  41. <a-form-item label="产品编码" prop="productCode">
  42. <a-input id="inventoryCheckOverallList-productCode" v-model.trim="queryParam.productCode" placeholder="请输入" allowClear />
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="8" :sm="24">
  46. <a-form-item label="产品名称" prop="productName">
  47. <a-input id="inventoryCheckOverallList-productName" v-model.trim="queryParam.productName" placeholder="请输入" allowClear />
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
  51. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckOverallList-refresh">查询</a-button>
  52. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckOverallList-reset">重置</a-button>
  53. </a-col>
  54. </a-row>
  55. </a-form>
  56. </div>
  57. <!-- 列表 -->
  58. <s-table
  59. class="sTable"
  60. ref="table"
  61. size="small"
  62. :rowKey="(record) => record.id"
  63. :columns="columns"
  64. :data="loadData"
  65. :defaultLoadData="false"
  66. bordered>
  67. </s-table>
  68. </a-card>
  69. </a-spin>
  70. <div class="affix-cont">
  71. <a-button
  72. type="primary"
  73. id="inventoryCheckOverallList-submit"
  74. size="large"
  75. :disabled="spinning"
  76. class="button-primary"
  77. @click="handleSubmit"
  78. style="padding: 0 60px;">提交</a-button>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import { commonMixin } from '@/utils/mixin'
  84. import { STable, VSelect } from '@/components'
  85. import { checkWarehouseDetailList, checkWarehouseDetailCount, checkWarehouseSubmit, checkWarehouseDetail } from '@/api/checkWarehouse'
  86. export default {
  87. name: 'CheckWarehouseOverall',
  88. components: { STable, VSelect },
  89. mixins: [commonMixin],
  90. props: {},
  91. data () {
  92. return {
  93. spinning: false,
  94. disabled: false,
  95. queryParam: {
  96. productCode: '',
  97. productName: ''
  98. },
  99. basicInfoData: null, // 基础信息
  100. productTotal: null,
  101. // 表头
  102. columns: [
  103. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  104. { title: '产品编码', dataIndex: 'productCode', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
  105. { title: '产品名称', dataIndex: 'productName', width: '36%', align: 'left', customRender: function (text) { return text || '--' } },
  106. { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  107. { title: '库存数量', dataIndex: 'stockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  108. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '16%', align: 'center', customRender: function (text) { return text || '--' } }
  109. ],
  110. // 加载数据方法 必须为 Promise 对象
  111. loadData: parameter => {
  112. this.disabled = true
  113. this.spinning = true
  114. return checkWarehouseDetailList(Object.assign(parameter, this.queryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  115. let data
  116. if (res.status == 200) {
  117. data = res.data
  118. const no = (data.pageNo - 1) * data.pageSize
  119. for (var i = 0; i < data.list.length; i++) {
  120. data.list[i].no = no + i + 1
  121. }
  122. this.getProduceTotal()
  123. this.disabled = false
  124. }
  125. this.spinning = false
  126. return data
  127. })
  128. }
  129. }
  130. },
  131. methods: {
  132. // 重置
  133. resetSearchForm () {
  134. this.queryParam.productCode = ''
  135. this.queryParam.productName = ''
  136. this.$refs.table.refresh(true)
  137. },
  138. // 提交
  139. handleSubmit () {
  140. const _this = this
  141. _this.spinning = true
  142. checkWarehouseSubmit({ id: this.$route.params.id }).then(res => {
  143. if (res.status == 200) {
  144. this.$message.success(res.message)
  145. setTimeout(() => {
  146. _this.handleBack()
  147. _this.spinning = false
  148. }, 1000)
  149. } else {
  150. _this.spinning = false
  151. }
  152. })
  153. },
  154. // 返回列表
  155. handleBack () {
  156. this.$router.push({ path: '/inventoryManagement/inventoryChecking/list' })
  157. },
  158. // 查询基础信息
  159. getDetail () {
  160. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  161. if (res.status == 200) {
  162. this.basicInfoData = res.data || null
  163. } else {
  164. this.basicInfoData = null
  165. }
  166. })
  167. },
  168. // 已选产品总计查询
  169. getProduceTotal () {
  170. checkWarehouseDetailCount(Object.assign(this.queryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  171. if (res.status == 200) {
  172. this.productTotal = res.data
  173. } else {
  174. this.productTotal = null
  175. }
  176. })
  177. }
  178. },
  179. mounted () {
  180. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  181. this.getDetail()
  182. this.resetSearchForm()
  183. }
  184. },
  185. activated () {
  186. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  187. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  188. this.getDetail()
  189. this.resetSearchForm()
  190. }
  191. },
  192. beforeRouteEnter (to, from, next) {
  193. next(vm => {})
  194. }
  195. }
  196. </script>
  197. <style lang="less">
  198. .inventoryCheckOverallList-wrap{
  199. position: relative;
  200. height: 100%;
  201. padding-bottom: 51px;
  202. box-sizing: border-box;
  203. .inventoryCheckOverallList-cont, .inventoryCheckOverallList-back{
  204. margin-bottom: 10px;
  205. }
  206. .billno{
  207. font-size: 16px;
  208. font-weight: bold;
  209. margin: 0 15px;
  210. }
  211. >.ant-spin-nested-loading{
  212. overflow-y: auto;
  213. height: 100%;
  214. }
  215. }
  216. </style>