detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <div class="inventoryCheckDetail-wrap" :style="{paddingBottom:detail&&(detail.state!='FINISH' && detail.state!='DELETE')?'51px':'0px'}">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="inventoryCheckDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="inventoryCheckDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span class="billno">单号:{{ detail&&detail.checkWarehouseNo }}</span>
  9. <span class="state-c" v-if="detail&&detail.state=='DELETE'">已作废</span>
  10. <a-button size="small" type="link" class="button-default" id="inventoryCheckDetail-desc-btn" @click="showDetail=!showDetail">
  11. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  12. </a-button>
  13. </template>
  14. </a-page-header>
  15. <!-- 基础信息 -->
  16. <a-card size="small" :bordered="false" class="inventoryCheckDetail-cont" v-show="showDetail">
  17. <a-descriptions :column="4">
  18. <a-descriptions-item label="创建人">{{ (detail&&detail.creatorName) || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="创建时间">{{ (detail&&detail.createDate) || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="盘点类型">{{ (detail&&detail.checkTypeDictValue) || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="仓库">{{ (detail&&detail.warehouseName) || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="盘点状态">{{ (detail&&detail.checkStateDictValue) || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="盘点人">{{ (detail&&detail.checkPersonName) || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="盘点时间">{{ (detail&&detail.checkTime) || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="监盘状态">{{ (detail&&detail.checkSuperviseStateDictValue) || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="监盘人">{{ (detail&&detail.checkSupervisePersonName) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="监盘时间">{{ (detail&&detail.checkSuperviseTime) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="财务确认时间">{{ (detail&&detail.financeAuditTime) || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="作废时间" v-if="detail&&detail.state=='DELETE'">{{ (detail&&detail.deleteTime) || '--' }}</a-descriptions-item>
  30. </a-descriptions>
  31. </a-card>
  32. <!-- 产品详情 -->
  33. <a-card size="small" :bordered="false" class="inventoryCheckDetail-cont">
  34. <!-- 总计 -->
  35. <a-alert type="info" style="margin-bottom:10px">
  36. <div slot="message">
  37. 库存数量:<strong>{{ productTotal && (productTotal.stockQty || productTotal.stockQty==0) ? productTotal.stockQty : '--' }}</strong>,
  38. 盘点数量:<strong>{{ productTotal && (productTotal.checkQty || productTotal.checkQty==0) ? productTotal.checkQty : '--' }}</strong>,
  39. 监盘数量:<strong>{{ productTotal && (productTotal.checkSuperviseQty || productTotal.checkSuperviseQty==0) ? productTotal.checkSuperviseQty : '--' }}</strong>
  40. </div>
  41. </a-alert>
  42. <!-- 搜索条件 -->
  43. <div class="table-page-search-wrapper">
  44. <a-row :gutter="15">
  45. <a-col :span="18">
  46. <a-form-model :model="queryParam" layout="inline" @keyup.enter.native="getList(1)" >
  47. <a-row :gutter="15">
  48. <a-col :md="8" :sm="24">
  49. <a-form-model-item label="产品编码">
  50. <a-input id="inventoryCheckDetail-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="输入产品编码" />
  51. </a-form-model-item>
  52. </a-col>
  53. <a-col :md="8" :sm="24">
  54. <a-button type="primary" @click="getList(1)" :disabled="disabled" id="inventoryCheckDetail-refresh">查询</a-button>
  55. <a-button style="margin-left: 5px" @click="resetSearchForm" id="inventoryCheckDetail-reset">重置</a-button>
  56. </a-col>
  57. </a-row>
  58. </a-form-model>
  59. </a-col>
  60. <a-col :span="6">
  61. <div style="float:right;overflow: hidden;margin-top:6px;">
  62. <a-checkbox id="inventoryCheckDetail-foldState" v-model="foldState" @change="foldStateChange"><span style="display: inline-block;margin-top: 1px;">折叠列表</span></a-checkbox>
  63. </div>
  64. </a-col>
  65. </a-row>
  66. </div>
  67. <!-- 列表 -->
  68. <a-table
  69. class="sTable"
  70. ref="table"
  71. size="small"
  72. :rowKey="(record) => record.id + record.type"
  73. :columns="columns"
  74. :pagination="false"
  75. :data-source="list"
  76. :loading="loading"
  77. @expand="handleExpand"
  78. :expandedRowKeys="expandedRowKeys"
  79. :expandRowByClick="true"
  80. bordered>
  81. </a-table>
  82. <!-- 分页 -->
  83. <tablePagination
  84. ref="tablePagination"
  85. :total="paginationProps.total"
  86. :current="paginationProps.current"
  87. :pageSize="paginationProps.pageSize"
  88. @changePageSize="changePageSize"
  89. @changePage="changePage" />
  90. </a-card>
  91. </a-spin>
  92. <div class="affix-cont" v-if="detail&&(detail.state!='FINISH' && detail.state!='DELETE') && $hasPermissions('B_inventoryCheckVoid')">
  93. <a-button
  94. type="primary"
  95. id="inventoryCheckDetail-submit-btn"
  96. size="large"
  97. class="button-primary"
  98. :disabled="spinning"
  99. @click="handleSubmit"
  100. style="padding: 0 60px;">作废盘点单</a-button>
  101. </div>
  102. </div>
  103. </template>
  104. <script>
  105. import { commonMixin } from '@/utils/mixin'
  106. import { STable, VSelect } from '@/components'
  107. import tablePagination from '@/views/common/tablePagination.vue'
  108. import { checkWarehouseDetail, checkWarehouseDetailList, checkWarehouseDetailCount, checkWarehouseDelete } from '@/api/checkWarehouse'
  109. export default {
  110. name: 'InventoryCheckDetail',
  111. mixins: [commonMixin],
  112. components: { STable, VSelect, tablePagination },
  113. data () {
  114. return {
  115. spinning: false,
  116. disabled: false,
  117. loading: false,
  118. showDetail: false,
  119. queryParam: {
  120. productCode: '' // 产品编码
  121. },
  122. // 表头
  123. columns: [
  124. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  125. { title: '产品名称', dataIndex: 'productName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  126. { title: '单位', dataIndex: 'productUnit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  128. { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  129. { title: '入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  130. { title: '批次', dataIndex: 'stockBatchNo', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '产品编码', dataIndex: 'productCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  133. { title: '盘点数量', dataIndex: 'checkQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  134. { title: '监盘数量', dataIndex: 'checkSuperviseQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  135. ],
  136. list: [], // 列表数据
  137. paginationProps: {
  138. total: 0, // 分页总条数
  139. current: 1,
  140. pageSize: 20
  141. },
  142. expandedRowKeys: [], // 展开行
  143. detail: null, // 详情数据
  144. foldState: false, // 是否折叠列表
  145. productTotal: null // 合计
  146. }
  147. },
  148. methods: {
  149. // 返回列表
  150. handleBack () {
  151. this.$router.push({ name: 'inventoryCheckList', params: { type: 0 } })
  152. },
  153. // 重置
  154. resetSearchForm () {
  155. this.queryParam.productCode = ''
  156. this.getList(1)
  157. },
  158. // 作废盘点单
  159. handleSubmit () {
  160. const _this = this
  161. this.$confirm({
  162. title: '提示',
  163. content: '作废后数据无法恢复,确认作废吗?',
  164. centered: true,
  165. closable: true,
  166. onOk () {
  167. _this.spinning = true
  168. checkWarehouseDelete({ checkWarehouseSn: _this.$route.params.sn }).then(res => {
  169. if (res.status == 200) {
  170. _this.$message.success(res.message)
  171. _this.$router.push({ name: 'inventoryCheckList', params: { type: 1 } })
  172. }
  173. _this.spinning = false
  174. })
  175. }
  176. })
  177. },
  178. // 获取列表数据
  179. getList (pageNo) {
  180. this.disabled = true
  181. this.paginationProps.current = pageNo || this.paginationProps.current
  182. const params = {
  183. pageNo: this.paginationProps.current,
  184. pageSize: this.paginationProps.pageSize,
  185. checkWarehouseSn: this.$route.params.sn,
  186. productCode: this.queryParam.productCode
  187. }
  188. this.loading = true
  189. checkWarehouseDetailList(params).then(res => {
  190. this.loading = false
  191. if (res.status == 200) {
  192. this.getCount(params)
  193. const data = res.data
  194. // 分页总记录数
  195. this.paginationProps.total = Number(res.data.count) || 0
  196. this.paginationProps.current = data.pageNo
  197. const no = (data.pageNo - 1) * data.pageSize
  198. // 可展开行
  199. this.expandedRowKeys = []
  200. for (var i = 0; i < data.list.length; i++) {
  201. data.list[i].no = no + i + 1
  202. if (!this.foldState) {
  203. this.expandedRowKeys.push(data.list[i].id + data.list[i].type)
  204. }
  205. }
  206. this.list = data.list
  207. this.disabled = false
  208. } else {
  209. this.paginationProps.total = 0
  210. this.paginationProps.current = 1
  211. this.paginationProps.pageSize = 20
  212. this.list = []
  213. }
  214. })
  215. },
  216. // 统计数据
  217. getCount (params) {
  218. checkWarehouseDetailCount(params).then(res => {
  219. if (res.status == 200) {
  220. this.productTotal = res.data
  221. } else {
  222. this.productTotal = null
  223. }
  224. })
  225. },
  226. // 分页 一页多少条change
  227. changePageSize (current, pageSize) {
  228. this.paginationProps.current = current
  229. this.paginationProps.pageSize = pageSize
  230. this.getList()
  231. },
  232. // 分页 页码change
  233. changePage (current) {
  234. this.paginationProps.current = current
  235. this.getList()
  236. },
  237. // 详情
  238. getDetail () {
  239. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  240. if (res.status == 200) {
  241. this.detail = res.data
  242. this.resetSearchForm()
  243. } else {
  244. this.detail = null
  245. }
  246. })
  247. },
  248. // 展开收起
  249. handleExpand (expanded, record) {
  250. if (record.type == 'superior') { // 只处理父级
  251. if (expanded) {
  252. this.expandedRowKeys.push(record.id + record.type)
  253. } else {
  254. if (this.expandedRowKeys.length > 0) {
  255. const expandedRowKeys = this.expandedRowKeys.filter(RowKey => RowKey !== (record.id + record.type))
  256. this.expandedRowKeys = expandedRowKeys
  257. }
  258. }
  259. }
  260. },
  261. // 折叠列表
  262. foldStateChange (e) {
  263. // 收起
  264. if (e.target.checked) {
  265. this.expandedRowKeys = []
  266. } else {
  267. // 展开
  268. this.expandedRowKeys = []
  269. this.list.map(item => {
  270. this.expandedRowKeys.push(item.id + item.type)
  271. })
  272. }
  273. }
  274. },
  275. mounted () {
  276. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  277. this.getDetail()
  278. }
  279. },
  280. activated () {
  281. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  282. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  283. this.getDetail()
  284. }
  285. },
  286. beforeRouteEnter (to, from, next) {
  287. next(vm => {})
  288. }
  289. }
  290. </script>
  291. <style lang="less">
  292. .inventoryCheckDetail-wrap{
  293. position: relative;
  294. height: 100%;
  295. padding-bottom: 51px;
  296. box-sizing: border-box;
  297. >.ant-spin-nested-loading{
  298. overflow-y: scroll;
  299. height: 100%;
  300. }
  301. .inventoryCheckDetail-cont{
  302. margin-bottom: 6px;
  303. .billno{
  304. font-size: 16px;
  305. font-weight: bold;
  306. margin: 0 15px;
  307. }
  308. .state-c{
  309. color: #ed1c24;
  310. font-size: 13px;
  311. font-weight: bold;
  312. margin: 0 15px 0 0;
  313. }
  314. }
  315. }
  316. </style>