detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="bulkWarehousingOrderDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderDetail-cont" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="bulkWarehousingOrderDetail-back-btn" href="javascript:;" @click="handleBack" v-if="!outBizSn"><a-icon type="left" /> 返回列表</a>
  8. <a-button
  9. v-if="isEdit&&!outBizSn"
  10. type="primary"
  11. size="small"
  12. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  13. id="bulkWarehousingOrderDetail-edit-btn"
  14. @click.stop="handleEdit">编辑</a-button>
  15. <span class="head-order-number">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseNo) || '--' }}</span>
  16. </template>
  17. <template slot="tags">
  18. <a-tag color="red" v-if="basicInfoData&&basicInfoData.stateDictValue">{{ basicInfoData.stateDictValue }}</a-tag>
  19. <a-tag color="orange" v-if="basicInfoData&&basicInfoData.settleStateDictValue">{{ basicInfoData.settleStateDictValue }}</a-tag>
  20. </template>
  21. <!-- 操作区,位于 title 行的行尾 -->
  22. <template slot="extra" v-if="$hasPermissions('B_bulkWarehousingOrder_print')">
  23. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  24. </template>
  25. </a-page-header>
  26. <!-- 基础信息 -->
  27. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  28. <a-collapse :activeKey="['1']">
  29. <a-collapse-panel key="1" header="基础信息">
  30. <a-descriptions :column="3">
  31. <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="联系人">
  35. {{ (basicInfoData&&basicInfoData.supplierContactPerson) || '--' }}
  36. <span v-if="basicInfoData&&basicInfoData.supplierContactTel">({{ basicInfoData.supplierContactTel }})</span>
  37. </a-descriptions-item>
  38. <a-descriptions-item label="联系地址">
  39. <div v-if="basicInfoData&&(basicInfoData.supplierProvinceName || basicInfoData.supplierCityName || basicInfoData.supplierCountyName || basicInfoData.supplierAddress)">
  40. {{ (basicInfoData&&basicInfoData.supplierProvinceName) || '' }}
  41. {{ (basicInfoData&&basicInfoData.supplierCityName) || '' }}
  42. {{ (basicInfoData&&basicInfoData.supplierCountyName) || '' }}
  43. {{ (basicInfoData&&basicInfoData.supplierAddress) || '' }}
  44. </div>
  45. <span v-else>--</span>
  46. </a-descriptions-item>
  47. </a-descriptions>
  48. </a-collapse-panel>
  49. </a-collapse>
  50. </a-card>
  51. <!-- 产品详情 -->
  52. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  53. <a-collapse :activeKey="['1']">
  54. <a-collapse-panel key="1" header="产品详情">
  55. <!-- 总计 -->
  56. <a-alert type="info" style="margin-bottom:10px">
  57. <div slot="message">
  58. 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
  59. 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong> ,
  60. 总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? toThousands(productTotal.productTotalCost,2) : '--' }}</strong>
  61. </div>
  62. </a-alert>
  63. <!-- 列表 -->
  64. <s-table
  65. class="sTable"
  66. ref="table"
  67. size="small"
  68. :rowKey="(record) => record.id"
  69. :columns="columns"
  70. :data="loadData"
  71. :defaultLoadData="false"
  72. bordered>
  73. </s-table>
  74. </a-collapse-panel>
  75. </a-collapse>
  76. </a-card>
  77. <!-- 单据记录 二期 -->
  78. <!-- <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  79. <a-collapse :activeKey="['1']">
  80. <a-collapse-panel key="1" header="单据记录">
  81. <a-timeline class="timeline-box">
  82. <a-timeline-item>2021-02-01 15:22:38 王凯 审核通过</a-timeline-item>
  83. <a-timeline-item>
  84. <p>2021-02-01 15:22:38 王凯 审核通过</p>
  85. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  86. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  87. </a-timeline-item>
  88. <a-timeline-item>Technical testing 2015-09-01</a-timeline-item>
  89. <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
  90. </a-timeline>
  91. </a-collapse-panel>
  92. </a-collapse>
  93. </a-card> -->
  94. </a-spin>
  95. </div>
  96. </template>
  97. <script>
  98. import { commonMixin } from '@/utils/mixin'
  99. import { STable, VSelect } from '@/components'
  100. import { getOperationalPrecision } from '@/libs/tools.js'
  101. import { sparePartsPurDetailBySn, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailPrint } from '@/api/sparePartsPur'
  102. import Print from '@/views/common/print.vue'
  103. import { hdPrint } from '@/libs/JGPrint'
  104. export default {
  105. name: 'BulkWarehousingDetail',
  106. components: { STable, VSelect, Print },
  107. mixins: [commonMixin],
  108. props: {
  109. outBizSn: { // 有值则为弹框,无值则为页面
  110. type: [Number, String],
  111. default: ''
  112. }
  113. },
  114. data () {
  115. const _this = this
  116. return {
  117. spinning: false,
  118. // 表头
  119. columns: [
  120. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  121. { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  122. { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  123. { title: '采购单价', dataIndex: 'putCost', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
  124. { title: '采购数量', dataIndex: 'putQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  125. { title: '单位', dataIndex: 'productUnit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  126. { title: '采购金额', dataIndex: 'purchaseAmount', width: '7%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  127. { title: '仓库', dataIndex: 'warehouseName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  128. { title: '仓位', dataIndex: 'warehouseLocationName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  129. ],
  130. // 加载数据方法 必须为 Promise 对象
  131. loadData: parameter => {
  132. this.disabled = true
  133. this.spinning = true
  134. return sparePartsPurDetailList(Object.assign(parameter, { sparePartsPurchaseSn: this.outBizSn || this.$route.params.sn })).then(res => {
  135. let data
  136. if (res.status == 200) {
  137. data = res.data
  138. const no = (data.pageNo - 1) * data.pageSize
  139. for (var i = 0; i < data.list.length; i++) {
  140. data.list[i].no = no + i + 1
  141. // 采购金额 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  142. data.list[i].purchaseAmount = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
  143. }
  144. this.localDataSource = data.list
  145. this.disabled = false
  146. }
  147. this.spinning = false
  148. return data
  149. })
  150. },
  151. localDataSource: [],
  152. basicInfoData: null, // 基本信息
  153. productTotal: null // 合计
  154. }
  155. },
  156. computed: {
  157. isEdit () {
  158. return this.basicInfoData && this.basicInfoData.state != 'FINISH' && this.$hasPermissions('B_bulkWarehousingOrder_edit')
  159. }
  160. },
  161. methods: {
  162. // 返回列表
  163. handleBack () {
  164. this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
  165. },
  166. // 打印预览/快捷打印
  167. handlePrint (type, printerType) {
  168. const _this = this
  169. _this.spinning = true
  170. const url = sparePartsPurDetailPrint
  171. const params = { sn: this.outBizSn || this.$route.params.sn, type: printerType }
  172. // 打印或导出
  173. hdPrint(printerType, type, url, params, '散件入库单', function () {
  174. _this.spinning = false
  175. })
  176. },
  177. // 基本信息
  178. getDetail () {
  179. sparePartsPurDetailBySn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  180. if (res.status == 200) {
  181. this.basicInfoData = res.data
  182. } else {
  183. this.basicInfoData = null
  184. }
  185. })
  186. },
  187. // 合计
  188. getDetailCount () {
  189. sparePartsPurDetailCount({ sparePartsPurchaseSn: this.outBizSn || this.$route.params.sn }).then(res => {
  190. if (res.status == 200) {
  191. this.productTotal = res.data
  192. } else {
  193. this.productTotal = null
  194. }
  195. })
  196. },
  197. // 编辑
  198. handleEdit () {
  199. this.$router.push({ path: `/bulkManagement/bulkWarehousingOrder/edit/${this.basicInfoData.id}/${this.basicInfoData.sparePartsPurchaseSn}/${this.basicInfoData.supplierSn}` })
  200. }
  201. },
  202. mounted () {
  203. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新时调用
  204. this.$refs.table.refresh(true)
  205. this.getDetail()
  206. this.getDetailCount()
  207. }
  208. },
  209. activated () {
  210. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  211. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  212. this.$refs.table.refresh(true)
  213. this.getDetail()
  214. this.getDetailCount()
  215. }
  216. },
  217. beforeRouteEnter (to, from, next) {
  218. next(vm => {})
  219. }
  220. }
  221. </script>
  222. <style lang="less">
  223. .bulkWarehousingOrderDetail-cont{
  224. margin-bottom: 10px;
  225. .timeline-box{
  226. margin-top: 30px;
  227. .auxiliary-txt{
  228. color: #808695;
  229. }
  230. }
  231. }
  232. </style>