detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="inventoryConfirmationDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="inventoryConfirmationDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="inventoryConfirmationDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span class="billno">单号:{{ detail&&detail.checkWarehouseNo }}</span>
  9. </template>
  10. </a-page-header>
  11. <!-- 基础信息 -->
  12. <a-card size="small" :bordered="false" class="inventoryConfirmationDetail-cont">
  13. <a-collapse>
  14. <a-collapse-panel key="1" header="基础信息">
  15. <a-descriptions :column="3">
  16. <a-descriptions-item label="创建人">{{ (detail&&detail.creatorName) || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="创建时间">{{ (detail&&detail.createDate) || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="盘点类型">{{ (detail&&detail.checkTypeDictValue) || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="盘点状态">{{ (detail&&detail.checkStateDictValue) || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="盘点人">{{ (detail&&detail.checkPersonName) || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="盘点时间">{{ (detail&&detail.checkTime) || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="监盘状态">{{ (detail&&detail.checkSuperviseStateDictValue) || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="监盘人">{{ (detail&&detail.checkSupervisePersonName) || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="监盘时间">{{ (detail&&detail.checkSuperviseTime) || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="财务确认时间">{{ (detail&&detail.financeAuditTime) || '--' }}</a-descriptions-item>
  26. </a-descriptions>
  27. </a-collapse-panel>
  28. </a-collapse>
  29. </a-card>
  30. <!-- 产品详情 -->
  31. <a-card size="small" :bordered="false" class="inventoryConfirmationDetail-cont">
  32. <!-- 总计 -->
  33. <a-alert type="info" style="margin-bottom:10px">
  34. <div slot="message" style="display: flex;">
  35. 盘盈数量:<strong :style="{ color: productTotal && productTotal.profitQty>0?'red':productTotal && productTotal.profitQty<0?'green':'' }">{{ productTotal && (productTotal.profitQty || productTotal.profitQty==0) ? productTotal.profitQty : '--' }}</strong>,
  36. <div v-if="$hasPermissions('B_isShowCost')">
  37. 盘盈金额:<strong :style="{ color: productTotal && productTotal.profitCost>0?'red':productTotal && productTotal.profitCost<0?'green':'' }">{{ productTotal && (productTotal.profitCost || productTotal.profitCost==0) ? productTotal.profitCost : '--' }}</strong>,
  38. </div>
  39. 盘亏数量:<strong :style="{ color: productTotal && productTotal.lossQty>0?'red':productTotal && productTotal.lossQty<0?'green':'' }">{{ productTotal && (productTotal.lossQty || productTotal.lossQty==0) ? productTotal.lossQty : '--' }}</strong>,
  40. <div v-if="$hasPermissions('B_isShowCost')">
  41. 盘亏金额:<strong :style="{ color: productTotal && productTotal.lossCost>0?'red':productTotal && productTotal.lossCost<0?'green':'' }">{{ productTotal && (productTotal.lossCost || productTotal.lossCost==0) ? productTotal.lossCost : '--' }}</strong>,
  42. </div>
  43. 盈亏总数量:<strong :style="{ color: productTotal && productTotal.profitLossQty>0?'red':productTotal && productTotal.profitLossQty<0?'green':'' }">{{ productTotal && (productTotal.profitLossQty || productTotal.profitLossQty ==0) ? productTotal.profitLossQty : '--' }}</strong>,
  44. <div v-if="$hasPermissions('B_isShowCost')">
  45. 盈亏总金额:<strong :style="{ color: productTotal && productTotal.profitLossCost>0?'red':productTotal && productTotal.profitLossCost<0?'green':'' }">{{ productTotal && (productTotal.profitLossCost || productTotal.profitLossCost==0) ? productTotal.profitLossCost : '--' }}</strong>
  46. </div>
  47. </div>
  48. </a-alert>
  49. <!-- 搜索条件 -->
  50. <div class="table-page-search-wrapper">
  51. <a-row :gutter="15">
  52. <a-col :span="18">
  53. <a-form-model :model="queryParam" layout="inline" @keyup.enter.native="$refs.table.refresh(true)" >
  54. <a-row :gutter="15">
  55. <a-col :md="8" :sm="24">
  56. <a-form-model-item label="产品编码">
  57. <a-input v-model.trim="queryParam.productCode" allowClear placeholder="输入产品编码" />
  58. </a-form-model-item>
  59. </a-col>
  60. <a-col :md="8" :sm="24">
  61. <a-form-model-item style="margin-bottom: 10px;">
  62. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryConfirmationDetail-refresh">查询</a-button>
  63. <a-button style="margin-left: 5px" @click="resetSearchForm" id="inventoryConfirmationDetail-reset">重置</a-button>
  64. </a-form-model-item>
  65. </a-col>
  66. </a-row>
  67. </a-form-model>
  68. </a-col>
  69. <a-col :span="6">
  70. <div style="float:right;overflow: hidden;">
  71. <a-checkbox v-model="foldState" @change="foldStateChange"><span style="display: inline-block;margin-top: 1px;">仅显示盈亏</span></a-checkbox>
  72. </div>
  73. </a-col>
  74. </a-row>
  75. </div>
  76. <!-- 列表 -->
  77. <s-table
  78. class="sTable"
  79. ref="table"
  80. size="small"
  81. :rowKey="(record) => record.id"
  82. :columns="columns"
  83. :data="loadData"
  84. :defaultLoadData="false"
  85. bordered>
  86. <!-- 盈亏数量 -->
  87. <template slot="profitLossQty" slot-scope="text, record">
  88. <span :style="{ color: record.profitLossQty>0?'red':record.profitLossQty<0?'green':'', fontWeight: record.profitLossQty!=0?'bold':'' }">
  89. {{ (record.profitLossQty || record.profitLossQty==0) ? record.profitLossQty : '--' }}
  90. </span>
  91. </template>
  92. <!-- 盈亏金额 -->
  93. <template slot="profitLossCost" slot-scope="text, record">
  94. <span :style="{ color: record.profitLossCost>0?'red':record.profitLossCost<0?'green':'', fontWeight: record.profitLossCost!=0?'bold':'' }">
  95. {{ (record.profitLossCost || record.profitLossCost==0) ? record.profitLossCost : '--' }}
  96. </span>
  97. </template>
  98. </s-table>
  99. </a-card>
  100. </a-spin>
  101. </div>
  102. </template>
  103. <script>
  104. import { commonMixin } from '@/utils/mixin'
  105. import { STable, VSelect } from '@/components'
  106. import { checkWarehouseDetail, checkWarehouseDetailFinanceList, checkWarehouseDetailCount } from '@/api/checkWarehouse'
  107. export default {
  108. name: 'InventoryConfirmationDetail',
  109. mixins: [commonMixin],
  110. components: { STable, VSelect },
  111. data () {
  112. return {
  113. spinning: false,
  114. disabled: false,
  115. queryParam: {
  116. profitLossFlag: undefined,
  117. productCode: ''
  118. },
  119. // 加载数据方法 必须为 Promise 对象
  120. loadData: parameter => {
  121. this.disabled = true
  122. this.spinning = true
  123. const params = Object.assign(parameter, this.queryParam, { checkWarehouseSn: this.$route.params.sn })
  124. return checkWarehouseDetailFinanceList(params).then(res => {
  125. let data
  126. if (res.status == 200) {
  127. data = res.data
  128. this.getCount(params)
  129. const no = (data.pageNo - 1) * data.pageSize
  130. for (var i = 0; i < data.list.length; i++) {
  131. data.list[i].no = no + i + 1
  132. }
  133. this.disabled = false
  134. }
  135. this.spinning = false
  136. return data
  137. })
  138. },
  139. detail: null, // 详情数据
  140. foldState: false, // 是否仅显示盈亏
  141. productTotal: null // 合计
  142. }
  143. },
  144. computed: {
  145. columns () {
  146. const arr = [
  147. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  148. { title: '产品名称', dataIndex: 'productName', width: '11%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  149. { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  151. { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  152. { title: '入库时间', dataIndex: 'lastStockTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  153. { title: '批次', dataIndex: 'stockBatchNo', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  156. { title: '盘点数量', dataIndex: 'checkQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  157. { title: '监盘数量', dataIndex: 'checkSuperviseQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  158. // { title: '单价', dataIndex: 'checkCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  159. { title: '盈亏数量', dataIndex: 'profitLossQty', scopedSlots: { customRender: 'profitLossQty' }, width: '6%', align: 'center' }
  160. // { title: '盈亏金额', dataIndex: 'profitLossCost', scopedSlots: { customRender: 'profitLossCost' }, width: '6%', align: 'center' }
  161. ]
  162. if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
  163. arr.splice(11, 0, { title: '单价', dataIndex: 'checkCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  164. arr.splice(13, 0, { title: '盈亏金额', dataIndex: 'profitLossCost', scopedSlots: { customRender: 'profitLossCost' }, width: '6%', align: 'center' })
  165. }
  166. return arr
  167. }
  168. },
  169. methods: {
  170. // 返回列表
  171. handleBack () {
  172. this.$router.push({ path: '/financialManagement/inventoryConfirmation/list', query: { closeLastOldTab: true } })
  173. },
  174. // 重置
  175. resetSearchForm () {
  176. this.queryParam.productCode = ''
  177. this.$refs.table.refresh(true)
  178. },
  179. getCount (params) {
  180. checkWarehouseDetailCount(params).then(res => {
  181. if (res.status == 200) {
  182. this.productTotal = res.data
  183. } else {
  184. this.productTotal = null
  185. }
  186. })
  187. },
  188. // 详情
  189. getDetail () {
  190. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  191. if (res.status == 200) {
  192. this.detail = res.data
  193. } else {
  194. this.detail = null
  195. }
  196. })
  197. },
  198. // 折叠列表
  199. foldStateChange (e) {
  200. if (e.target.checked) {
  201. this.queryParam.profitLossFlag = 1
  202. this.$refs.table.refresh(true)
  203. } else {
  204. this.queryParam.profitLossFlag = undefined
  205. this.$refs.table.refresh(true)
  206. }
  207. }
  208. },
  209. mounted () {
  210. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  211. this.resetSearchForm()
  212. this.getDetail()
  213. }
  214. },
  215. activated () {
  216. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  217. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  218. this.resetSearchForm()
  219. this.getDetail()
  220. }
  221. },
  222. beforeRouteEnter (to, from, next) {
  223. next(vm => {})
  224. }
  225. }
  226. </script>
  227. <style lang="less">
  228. .inventoryConfirmationDetail-wrap{
  229. .inventoryConfirmationDetail-cont{
  230. margin-bottom: 10px;
  231. .billno{
  232. font-size: 16px;
  233. font-weight: bold;
  234. margin: 0 15px;
  235. }
  236. .state-c{
  237. color: #ed1c24;
  238. font-size: 13px;
  239. font-weight: bold;
  240. }
  241. }
  242. }
  243. </style>