detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="storeTransferOutDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle" v-if="!outBizSn">
  7. <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <a-button
  9. v-if="isEdit&&$hasPermissions('B_storeCallOutEdit')"
  10. type="primary"
  11. size="small"
  12. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  13. id="storeTransferOutDetail-edit-btn"
  14. @click.stop="handleEdit">编辑</a-button>
  15. </template>
  16. <!-- 操作区,位于 title 行的行尾 -->
  17. <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_storeCallOutPrint')">
  18. <a-checkbox key="4" v-model="printCostChecked">打印成本</a-checkbox>
  19. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  20. </template>
  21. </a-page-header>
  22. <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
  23. <a-collapse :activeKey="['1']">
  24. <a-collapse-panel key="1" header="基础信息">
  25. <a-descriptions :column="3">
  26. <a-descriptions-item label="调往对象名称">{{ (basicInfoData&&basicInfoData.putPersonName) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="店内调出单号">{{ (basicInfoData&&basicInfoData.storeCallOutNo) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="财务状态">{{ (basicInfoData&&basicInfoData.settleStateDictValue) || '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="调拨类型">{{ (basicInfoData&&basicInfoData.callOutTypeName) || '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remark) || '--' }}</a-descriptions-item>
  32. </a-descriptions>
  33. </a-collapse-panel>
  34. </a-collapse>
  35. </a-card>
  36. <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
  37. <!-- 总计 -->
  38. <a-alert type="info" style="margin-bottom:10px">
  39. <div slot="message">
  40. 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
  41. 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong>
  42. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  43. ,总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
  44. </div>
  45. </div>
  46. </a-alert>
  47. <!-- 列表 -->
  48. <s-table
  49. class="sTable"
  50. ref="table"
  51. size="small"
  52. :rowKey="(record) => record.id"
  53. :columns="columns"
  54. :data="loadData"
  55. :defaultLoadData="false"
  56. bordered>
  57. <div slot="costTitle">
  58. <a-tooltip placement="top">
  59. <template slot="title">
  60. 系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
  61. </template>
  62. <span style="margin-right: 5px;">实际总成本</span> <a-icon type="question-circle" />
  63. </a-tooltip>
  64. </div>
  65. <!-- 操作 -->
  66. <template slot="action" slot-scope="text, record">
  67. <a-button size="small" type="link" class="button-info" @click="handleViewDetail(record)">出库明细</a-button>
  68. </template>
  69. </s-table>
  70. <!-- 出入库明细 -->
  71. <outInDetialModal ref="outInDetialModal" outBizType="SHOP_CALL_OUT" :openModal="showOutInModal" @close="showOutInModal=false"></outInDetialModal>
  72. </a-card>
  73. </a-spin>
  74. </div>
  75. </template>
  76. <script>
  77. import { commonMixin } from '@/utils/mixin'
  78. import { STable, VSelect } from '@/components'
  79. import { getOperationalPrecision } from '@/libs/tools.js'
  80. import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn, storeCallOutDetailPrint } from '@/api/storeCallOut'
  81. import Print from '@/views/common/print.vue'
  82. import outInDetialModal from '@/views/common/outInDetialModal.vue'
  83. import { hdPrint } from '@/libs/JGPrint'
  84. export default {
  85. name: 'StoreCallOutDetail',
  86. components: { STable, VSelect, Print, outInDetialModal },
  87. mixins: [commonMixin],
  88. props: {
  89. outBizSn: { // 有值则为弹框,无值则为页面
  90. type: [Number, String],
  91. default: ''
  92. }
  93. },
  94. data () {
  95. return {
  96. spinning: false,
  97. showOutInModal: false,
  98. // 加载数据方法 必须为 Promise 对象
  99. loadData: parameter => {
  100. this.spinning = true
  101. return storeCallOutDetailList(Object.assign(parameter, { storeCallOutSn: this.outBizSn || this.$route.params.sn })).then(res => {
  102. let data
  103. if (res.status == 200) {
  104. data = res.data
  105. const no = (data.pageNo - 1) * data.pageSize
  106. for (var i = 0; i < data.list.length; i++) {
  107. data.list[i].no = no + i + 1
  108. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  109. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
  110. }
  111. this.localDataSource = data.list
  112. }
  113. this.spinning = false
  114. return data
  115. })
  116. },
  117. localDataSource: [],
  118. basicInfoData: null, // 基本信息
  119. productTotal: null, // 合计
  120. printCostChecked: true // 打印成本
  121. }
  122. },
  123. computed: {
  124. isEdit () {
  125. return ((this.basicInfoData && this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')) && this.$hasPermissions('B_storeCallOutEdit')
  126. },
  127. columns () {
  128. const arr = [
  129. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  130. { title: '产品编码', dataIndex: 'productCode', width: '22%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '产品名称', dataIndex: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  132. { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  133. // { title: '成本价(¥)', dataIndex: 'outCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  134. { title: '调出仓库', dataIndex: 'warehouseName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '调出数量', dataIndex: 'outQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  136. // { slots: { title: 'costTitle' }, dataIndex: 'costSubtotal', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  137. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  138. ]
  139. if (this.$hasPermissions('M_ShowAllCost')) {
  140. arr.splice(4, 0, { title: '成本价(¥)', dataIndex: 'outCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  141. arr.splice(7, 0, { slots: { title: 'costTitle' }, dataIndex: 'costSubtotal', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  142. }
  143. return arr
  144. }
  145. },
  146. methods: {
  147. // 返回列表
  148. handleBack () {
  149. this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
  150. },
  151. // 打印预览/快捷打印
  152. handlePrint (type, printerType) {
  153. const _this = this
  154. _this.spinning = true
  155. const url = storeCallOutDetailPrint
  156. const params = { sn: this.outBizSn || this.$route.params.sn, type: printerType, costFlag: this.printCostChecked ? '1' : '0' }
  157. // 打印或导出
  158. hdPrint(printerType, type, url, params, '', function () {
  159. _this.spinning = false
  160. })
  161. },
  162. // 出入库明细
  163. handleViewDetail (row) {
  164. this.showOutInModal = true
  165. this.$refs.outInDetialModal.getData(row)
  166. },
  167. // 基本信息
  168. getDetail () {
  169. storeCallOutDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  170. if (res.status == 200) {
  171. this.basicInfoData = res.data
  172. } else {
  173. this.basicInfoData = null
  174. }
  175. })
  176. },
  177. // 合计
  178. getDetailCount () {
  179. storeCallOutDetailCount({ storeCallOutSn: this.outBizSn || this.$route.params.sn }).then(res => {
  180. if (res.status == 200) {
  181. this.productTotal = res.data
  182. } else {
  183. this.productTotal = null
  184. }
  185. })
  186. },
  187. // 编辑
  188. handleEdit () {
  189. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${this.basicInfoData.id}/${this.basicInfoData.storeCallOutSn}` })
  190. }
  191. },
  192. mounted () {
  193. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  194. this.printCostChecked = true
  195. this.$refs.table.refresh(true)
  196. this.getDetail()
  197. this.getDetailCount()
  198. }
  199. },
  200. activated () {
  201. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  202. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  203. this.printCostChecked = true
  204. this.$refs.table.refresh(true)
  205. this.getDetail()
  206. this.getDetailCount()
  207. }
  208. },
  209. beforeRouteEnter (to, from, next) {
  210. next(vm => {})
  211. }
  212. }
  213. </script>
  214. <style lang="less">
  215. .storeTransferOutDetail-wrap{
  216. .storeTransferOutDetail-back{
  217. margin-bottom: 10px;
  218. }
  219. .storeTransferOutDetail-cont{
  220. margin-bottom: 10px;
  221. }
  222. }
  223. </style>