InStorageDetail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <script setup lang="ts">
  2. import { ref, onMounted } from 'vue'
  3. import { GlobalStore } from '@/stores/index'
  4. import { useRoute, useRouter } from 'vue-router'
  5. import Drawer from '@/components/Drawer/index.vue'
  6. import { InStorageInfoType } from '@/hooks/useDepot'
  7. import { Storehouse_StockIn_Get } from '@/api/storehouse/index'
  8. import ImageCom from '@/components/Image/index.vue'
  9. const tableData = ref<any[]>([])
  10. const tableSnData = ref<any[]>([])
  11. const globalStore = GlobalStore()
  12. const info = ref<InStorageInfoType | undefined>()
  13. const drawerSnRef = ref<InstanceType<typeof Drawer> | null>(null)
  14. const route = useRoute()
  15. const router = useRouter()
  16. const columns = [
  17. { type: 'index', label: '序号', width: 80, align: 'center ' },
  18. { label: '产品图片', prop: 'T_product_img', align: 'center ', name: 'T_product_img' },
  19. { label: '产品名称', prop: 'T_product_name', align: 'center ' },
  20. { label: '产品分类', prop: 'T_product_class_name', align: 'center ' },
  21. { label: '产品型号', prop: 'T_product_model', align: 'center ', name: 'T_product_model' },
  22. { label: '产品规格', prop: 'T_product_spec', align: 'center ' },
  23. { label: '是否关联SN', prop: 'T_product_relation_sn', align: 'center ', width: 120, name: 'T_product_relation_sn' },
  24. { label: '数量', prop: 'T_num', align: 'center ' },
  25. { prop: 'operation', label: '关联设备', width: 100, fixed: 'right', align: 'center ' }
  26. ]
  27. const snColumns = [
  28. { type: 'index', label: '序号', width: 80, align: 'center ' },
  29. { label: 'SN', prop: 'sn', align: 'center ' }
  30. ]
  31. const getStorehouseContractGet = async () => {
  32. const res: any = await Storehouse_StockIn_Get({ User_tokey: globalStore.GET_User_tokey, T_number: route.params.id })
  33. if (res.Code === 200) {
  34. info.value = res.Data
  35. tableData.value = res.Data.T_Product
  36. }
  37. }
  38. /**
  39. * 回调
  40. */
  41. const callbackSnDrawer = (done: () => void) => done()
  42. const previewSn = (devicelist: string[]) => {
  43. drawerSnRef.value?.openDrawer()
  44. if (!devicelist) return
  45. tableSnData.value = devicelist.map((item: string) => {
  46. return {
  47. sn: item
  48. }
  49. })
  50. }
  51. onMounted(() => {
  52. getStorehouseContractGet()
  53. })
  54. </script>
  55. <template>
  56. <div class="contract-detail">
  57. <div class="info">
  58. <h1>入库详情</h1>
  59. <el-divider />
  60. <div class="content">
  61. <el-row>
  62. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>入库单号:</span></el-col>
  63. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  64. ><span>{{ info?.T_number! }}</span></el-col
  65. >
  66. </el-row>
  67. <el-row>
  68. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>入库仓库:</span></el-col>
  69. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  70. ><span>{{ info?.T_depot_name! }}</span></el-col
  71. >
  72. </el-row>
  73. <el-row>
  74. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>入库日期:</span></el-col>
  75. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  76. ><span>{{ info?.T_date! }}</span></el-col
  77. >
  78. </el-row>
  79. <el-row>
  80. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>入库明细:</span></el-col>
  81. <el-col :span="21">
  82. <el-table
  83. :data="tableData"
  84. style="width: 100%"
  85. border
  86. stripe
  87. :header-cell-style="{
  88. background: '#909399',
  89. height: '50px',
  90. color: '#fff'
  91. }"
  92. >
  93. <template v-for="item in columns" :key="item.prop">
  94. <el-table-column v-bind="item" v-if="item.fixed !== 'right'">
  95. <template #default="{ row }" v-if="item.prop === item.name">
  96. <span v-if="item.prop === 'T_product_relation_sn'">
  97. <el-tag v-if="row.T_product_relation_sn === 1" effect="dark">是</el-tag>
  98. <el-tag v-else type="success" effect="dark">否</el-tag>
  99. </span>
  100. <ImageCom v-if="item.prop === 'T_product_img'" :src="row.T_product_img" />
  101. <el-tooltip
  102. v-if="item.prop === 'T_product_model'"
  103. effect="dark"
  104. :content="row.T_product_model"
  105. placement="bottom"
  106. >
  107. {{ row.T_product_model }}
  108. </el-tooltip>
  109. </template>
  110. </el-table-column>
  111. <el-table-column v-bind="item" v-if="item.fixed === 'right'">
  112. <template #default="{ row }">
  113. <el-button
  114. type="primary"
  115. :disabled="!row.T_product_relation_sn"
  116. @click="previewSn(row.T_device_list)"
  117. >查看</el-button
  118. >
  119. </template>
  120. </el-table-column>
  121. </template>
  122. </el-table>
  123. </el-col>
  124. </el-row>
  125. <el-row>
  126. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>备注:</span></el-col>
  127. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  128. ><span>{{ info?.T_remark! }}</span></el-col
  129. >
  130. </el-row>
  131. </div>
  132. <el-divider />
  133. <div class="submit">
  134. <el-button type="primary" round @click="router.back()">返回</el-button>
  135. </div>
  136. </div>
  137. <Drawer ref="drawerSnRef" :handleClose="callbackSnDrawer" size="30%">
  138. <el-table
  139. :data="tableSnData"
  140. style="width: 100%; height: 99%"
  141. :header-cell-style="{
  142. background: '#dedfe0',
  143. height: '50px'
  144. }"
  145. >
  146. <template v-for="item in snColumns" :key="item">
  147. <el-table-column v-if="item.type === 'index'" v-bind="item" />
  148. <el-table-column v-if="item.prop" v-bind="item" />
  149. </template>
  150. </el-table>
  151. </Drawer>
  152. </div>
  153. </template>
  154. <style scoped lang="scss">
  155. .contract-detail {
  156. height: 100%;
  157. font-weight: bold;
  158. color: var(--el-text-color-secondary);
  159. .info {
  160. height: 100%;
  161. padding: 20px;
  162. & .content {
  163. height: calc(100% - 72px - 25px - 40px);
  164. overflow-y: scroll;
  165. .el-row {
  166. margin-bottom: 16px;
  167. }
  168. }
  169. .submit {
  170. display: flex;
  171. justify-content: center;
  172. }
  173. }
  174. }
  175. </style>