detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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="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 { STable, VSelect } from '@/components'
  105. import { checkWarehouseDetail, checkWarehouseDetailFinanceList, checkWarehouseDetailCount } from '@/api/checkWarehouse'
  106. export default {
  107. components: { STable, VSelect },
  108. data () {
  109. return {
  110. spinning: false,
  111. disabled: false,
  112. queryParam: {
  113. profitLossFlag: undefined,
  114. productCode: ''
  115. },
  116. // 加载数据方法 必须为 Promise 对象
  117. loadData: parameter => {
  118. this.disabled = true
  119. this.spinning = true
  120. const params = Object.assign(parameter, this.queryParam, { checkWarehouseSn: this.$route.params.sn })
  121. return checkWarehouseDetailFinanceList(params).then(res => {
  122. this.getCount(params)
  123. const data = res.data
  124. const no = (data.pageNo - 1) * data.pageSize
  125. for (var i = 0; i < data.list.length; i++) {
  126. data.list[i].no = no + i + 1
  127. }
  128. this.disabled = false
  129. this.spinning = false
  130. return data
  131. })
  132. },
  133. detail: null, // 详情数据
  134. foldState: false, // 是否仅显示盈亏
  135. productTotal: null // 合计
  136. }
  137. },
  138. computed:{
  139. columns(){
  140. const arr=[
  141. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  142. { title: '产品名称', dataIndex: 'productName', width: '11%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  143. { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  144. { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  145. { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  146. { title: '入库时间', dataIndex: 'lastStockTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  147. { title: '批次', dataIndex: 'stockBatchNo', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  150. { title: '盘点数量', dataIndex: 'checkQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '监盘数量', dataIndex: 'checkSuperviseQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  152. // { title: '单价', dataIndex: 'checkCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  153. { title: '盈亏数量', dataIndex: 'profitLossQty', scopedSlots: { customRender: 'profitLossQty' }, width: '6%', align: 'center' },
  154. // { title: '盈亏金额', dataIndex: 'profitLossCost', scopedSlots: { customRender: 'profitLossCost' }, width: '6%', align: 'center' }
  155. ]
  156. if(this.$hasPermissions('B_isShowCost')){ //成本价权限
  157. arr.splice(11, 0, { title: '单价', dataIndex: 'checkCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  158. arr.splice(13, 0, { title: '盈亏金额', dataIndex: 'profitLossCost', scopedSlots: { customRender: 'profitLossCost' }, width: '6%', align: 'center' })
  159. }
  160. return arr
  161. }
  162. },
  163. methods: {
  164. // 返回列表
  165. handleBack () {
  166. this.$router.push({ path: '/financialManagement/inventoryConfirmation/list', query: { closeLastOldTab: true } })
  167. },
  168. // 重置
  169. resetSearchForm () {
  170. this.queryParam.productCode = ''
  171. this.$refs.table.refresh(true)
  172. },
  173. getCount (params) {
  174. checkWarehouseDetailCount(params).then(res => {
  175. if (res.status == 200) {
  176. this.productTotal = res.data
  177. } else {
  178. this.productTotal = null
  179. }
  180. })
  181. },
  182. // 详情
  183. getDetail () {
  184. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  185. if (res.status == 200) {
  186. this.detail = res.data
  187. } else {
  188. this.detail = null
  189. }
  190. })
  191. },
  192. // 折叠列表
  193. foldStateChange (e) {
  194. if (e.target.checked) {
  195. this.queryParam.profitLossFlag = 1
  196. this.$refs.table.refresh(true)
  197. } else {
  198. this.queryParam.profitLossFlag = undefined
  199. this.$refs.table.refresh(true)
  200. }
  201. }
  202. },
  203. mounted () {
  204. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  205. this.resetSearchForm()
  206. this.getDetail()
  207. }
  208. },
  209. activated () {
  210. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  211. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  212. this.resetSearchForm()
  213. this.getDetail()
  214. }
  215. },
  216. beforeRouteEnter (to, from, next) {
  217. next(vm => {})
  218. }
  219. }
  220. </script>
  221. <style lang="less">
  222. .inventoryConfirmationDetail-wrap{
  223. .inventoryConfirmationDetail-cont{
  224. margin-bottom: 10px;
  225. .billno{
  226. font-size: 16px;
  227. font-weight: bold;
  228. margin: 0 15px;
  229. }
  230. .state-c{
  231. color: #ed1c24;
  232. font-size: 13px;
  233. font-weight: bold;
  234. }
  235. }
  236. }
  237. </style>