InStorageDetail.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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,stockInexcel } 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. const stockInexcelFun = async (data:any)=>{
  52. console.log(data,info.value);
  53. const result:any = await stockInexcel({T_number:info.value!.T_number})
  54. if (result.Code === 200) {
  55. window.open(result.Data)
  56. }
  57. }
  58. onMounted(() => {
  59. getStorehouseContractGet()
  60. })
  61. </script>
  62. <template>
  63. <div class="contract-detail">
  64. <div class="info">
  65. <div style="display: flex;justify-content: space-between">
  66. <h1>入库详情</h1>
  67. <el-button type="primary" icon="Download" @click="stockInexcelFun">导出excel</el-button>
  68. </div>
  69. <el-divider />
  70. <div class="content">
  71. <el-row>
  72. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>入库单号:</span></el-col>
  73. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  74. ><span>{{ info?.T_number! }}</span></el-col
  75. >
  76. </el-row>
  77. <el-row>
  78. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>入库仓库:</span></el-col>
  79. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  80. ><span>{{ info?.T_depot_name! }}</span></el-col
  81. >
  82. </el-row>
  83. <el-row>
  84. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>入库日期:</span></el-col>
  85. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  86. ><span>{{ info?.T_date! }}</span></el-col
  87. >
  88. </el-row>
  89. <el-row>
  90. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>入库明细:</span></el-col>
  91. <el-col :span="21">
  92. <el-table
  93. :data="tableData"
  94. style="width: 100%"
  95. border
  96. stripe
  97. :header-cell-style="{
  98. background: '#909399',
  99. height: '50px',
  100. color: '#fff'
  101. }"
  102. >
  103. <template v-for="item in columns" :key="item.prop">
  104. <el-table-column v-bind="item" v-if="item.fixed !== 'right'" :show-overflow-tooltip="true">
  105. <template #default="{ row }" v-if="item.prop === item.name">
  106. <span v-if="item.prop === 'T_product_relation_sn'">
  107. <el-tag v-if="row.T_product_relation_sn === 1" effect="dark">是</el-tag>
  108. <el-tag v-else type="success" effect="dark">否</el-tag>
  109. </span>
  110. <ImageCom v-if="item.prop === 'T_product_img'" :src="row.T_product_img" />
  111. <el-tooltip
  112. v-if="item.prop === 'T_product_model'"
  113. effect="dark"
  114. :content="row.T_product_model"
  115. placement="bottom"
  116. >
  117. {{ row.T_product_model }}
  118. </el-tooltip>
  119. </template>
  120. </el-table-column>
  121. <el-table-column v-bind="item" v-if="item.fixed === 'right'">
  122. <template #default="{ row }">
  123. <el-button
  124. type="primary"
  125. :disabled="!row.T_product_relation_sn"
  126. @click="previewSn(row.T_device_list)"
  127. >查看</el-button
  128. >
  129. </template>
  130. </el-table-column>
  131. </template>
  132. </el-table>
  133. </el-col>
  134. </el-row>
  135. <el-row v-if="info?.T_type! === 2">
  136. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>退库项目:</span></el-col>
  137. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  138. ><span>{{ info?.T_project! }}</span></el-col
  139. >
  140. </el-row>
  141. <el-row v-if="info?.T_type! === 2">
  142. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>退库人:</span></el-col>
  143. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  144. ><span>{{ info?.T_return_user_name! }}</span></el-col
  145. >
  146. </el-row>
  147. <el-row>
  148. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>备注:</span></el-col>
  149. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
  150. ><span>{{ info?.T_remark! }}</span></el-col
  151. >
  152. </el-row>
  153. </div>
  154. <el-divider />
  155. <div class="submit">
  156. <el-button type="primary" round @click="router.back()">返回</el-button>
  157. </div>
  158. </div>
  159. <Drawer ref="drawerSnRef" :handleClose="callbackSnDrawer" size="30%">
  160. <el-table
  161. :data="tableSnData"
  162. style="width: 100%; height: 99%"
  163. :header-cell-style="{
  164. background: '#dedfe0',
  165. height: '50px'
  166. }"
  167. >
  168. <template v-for="item in snColumns" :key="item">
  169. <el-table-column show-overflow-tooltip v-if="item.type === 'index'" v-bind="item" />
  170. <el-table-column show-overflow-tooltip v-if="item.prop" v-bind="item" />
  171. </template>
  172. </el-table>
  173. </Drawer>
  174. </div>
  175. </template>
  176. <style scoped lang="scss">
  177. .contract-detail {
  178. height: 100%;
  179. font-weight: bold;
  180. color: var(--el-text-color-secondary);
  181. .info {
  182. height: 100%;
  183. padding: 20px;
  184. & .content {
  185. height: calc(100% - 72px - 25px - 40px);
  186. overflow-y: scroll;
  187. .el-row {
  188. margin-bottom: 16px;
  189. }
  190. }
  191. .submit {
  192. display: flex;
  193. justify-content: center;
  194. }
  195. }
  196. }
  197. </style>