uniqueCodeModal.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <a-modal
  3. centered
  4. class="unique-code-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. v-model="isShow"
  8. @cancel="isShow=false"
  9. :width="960">
  10. <solt>
  11. <div class="unique-code-tit">查看唯一码(产品编码:Y1602GN,唯一码数量:11)</div>
  12. </solt>
  13. <a-card size="small" :bordered="false" class="unique-code-con">
  14. <!-- 列表 -->
  15. <s-table
  16. class="sTable"
  17. ref="table"
  18. size="small"
  19. :rowKey="(record) => record.id"
  20. :columns="columns"
  21. :data="loadData"
  22. :scroll="{ y: 360 }"
  23. bordered>
  24. </s-table>
  25. </a-card>
  26. <div class="btn-cont">
  27. <a-button id="unique-code-modal-back" @click="isShow = false" style="margin-left: 15px;">关闭</a-button>
  28. </div>
  29. </a-modal>
  30. </template>
  31. <script>
  32. import { commonMixin } from '@/utils/mixin'
  33. import { STable } from '@/components'
  34. import { sparePartsDetailList } from '@/api/spareParts'
  35. export default {
  36. name: 'BulkWarehousingOrderDetailModal',
  37. mixins: [commonMixin],
  38. components: { STable },
  39. props: {
  40. openModal: { // 弹框显示状态
  41. type: Boolean,
  42. default: false
  43. },
  44. itemSn: {
  45. type: [Number, String],
  46. default: ''
  47. }
  48. },
  49. data () {
  50. return {
  51. isShow: this.openModal, // 是否打开弹框
  52. // 加载数据方法 必须为 Promise 对象
  53. loadData: parameter => {
  54. return sparePartsDetailList(Object.assign(parameter, { sparePartsSn: this.itemSn })).then(res => {
  55. let data
  56. if (res.status == 200) {
  57. data = res.data
  58. const no = (data.pageNo - 1) * data.pageSize
  59. for (var i = 0; i < data.list.length; i++) {
  60. data.list[i].no = no + i + 1
  61. }
  62. }
  63. return data
  64. })
  65. }
  66. }
  67. },
  68. computed: {
  69. columns () {
  70. const arr = [
  71. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  72. { title: '唯一码', dataIndex: 'productCode', width: '15%', align: 'left', customRender: function (text) { return text || '--' } }
  73. ]
  74. return arr
  75. }
  76. },
  77. watch: {
  78. // 父页面传过来的弹框状态
  79. openModal (newValue, oldValue) {
  80. this.isShow = newValue
  81. },
  82. // 重定义的弹框状态
  83. isShow (newValue, oldValue) {
  84. if (!newValue) {
  85. this.$emit('close')
  86. }
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="less">
  92. .unique-code-modal{
  93. .unique-code-tit{
  94. padding-bottom:20px;
  95. margin-bottom:20px;
  96. border-bottom:1px solid #e8e8e8;
  97. }
  98. .btn-cont {
  99. text-align: center;
  100. margin: 5px 0 10px;
  101. }
  102. }
  103. </style>