You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

329 lines
8.5 KiB

  1. <template>
  2. <div class="customer-css">
  3. <!-- 查询条件 -->
  4. <el-form :inline="true" label-position="top" class="search-form-inline">
  5. <div class="search-row">
  6. <el-form-item label="进仓编号" class="search-item">
  7. <el-input v-model="searchData.flexId" style="width: 150px" @keyup.enter.native="getMainData"/>
  8. </el-form-item>
  9. <el-form-item label="供应商编码" class="search-item">
  10. <el-input v-model="searchData.supplierNo" style="width: 120px" @keyup.enter.native="getMainData"/>
  11. </el-form-item>
  12. <el-form-item label="供应商名称" class="search-item">
  13. <el-input v-model="searchData.supplierName" style="width: 200px" @keyup.enter.native="getMainData"/>
  14. </el-form-item>
  15. <el-form-item label=" " class="search-item search-btn-item">
  16. <el-button type="primary" @click="getMainData">查询</el-button>
  17. </el-form-item>
  18. </div>
  19. </el-form>
  20. <el-table
  21. :height="height"
  22. :data="mainDataList"
  23. border
  24. ref="mainTable"
  25. highlight-current-row
  26. @row-click="changeData"
  27. v-loading="dataListLoading"
  28. style="margin-top: 0px; width: 100%;">
  29. <el-table-column
  30. type="index"
  31. label="序号"
  32. width="80"
  33. align="center" />
  34. <el-table-column
  35. prop="flexId"
  36. label="进仓编号"
  37. min-width="150"
  38. show-overflow-tooltip />
  39. <el-table-column
  40. prop="supplierNo"
  41. label="供应商编码"
  42. width="120"
  43. align="center" />
  44. <el-table-column
  45. prop="supplierName"
  46. label="供应商名称"
  47. min-width="200"
  48. show-overflow-tooltip />
  49. <el-table-column
  50. prop="poCount"
  51. label="PO数量"
  52. width="100"
  53. align="center" />
  54. <el-table-column
  55. prop="shippedQty"
  56. label="已出货数量"
  57. width="120"
  58. align="center" />
  59. </el-table>
  60. <!-- 分页插件 -->
  61. <el-pagination style="margin-top: 0px"
  62. @size-change="sizeChangeHandle"
  63. @current-change="currentChangeHandle"
  64. :current-page="pageIndex"
  65. :page-sizes="[20, 50, 100, 200, 500]"
  66. :page-size="pageSize"
  67. :total="totalPage"
  68. layout="total, sizes, prev, pager, next, jumper">
  69. </el-pagination>
  70. <!-- 详情页签 -->
  71. <el-tabs v-model="activeTab" style="margin-top: 0px; width: 99%;" @tab-click="handleTabClick" class="customer-tab" type="border-card">
  72. <!-- PO清单 -->
  73. <el-tab-pane label="PO清单" name="poList">
  74. <el-table
  75. :data="poListData"
  76. border
  77. :height="detailHeight"
  78. v-loading="poListLoading"
  79. style="width: 100%;">
  80. <el-table-column
  81. type="index"
  82. label="序号"
  83. width="80"
  84. align="center" />
  85. <el-table-column
  86. prop="orderNo"
  87. label="PO"
  88. min-width="150"
  89. show-overflow-tooltip />
  90. <el-table-column
  91. prop="orderDate"
  92. label="PO日期"
  93. width="120"
  94. align="center">
  95. <template slot-scope="scope">
  96. {{ formatDate(scope.row.orderDate) }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column
  100. prop="partNo"
  101. label="SKU"
  102. min-width="150"
  103. show-overflow-tooltip />
  104. <el-table-column
  105. prop="qty"
  106. label="Qty"
  107. width="100"
  108. align="center" />
  109. <el-table-column
  110. prop="shippedQty"
  111. label="Qty Shipped"
  112. width="120"
  113. align="center" />
  114. </el-table>
  115. </el-tab-pane>
  116. <!-- 附件 -->
  117. <el-tab-pane label="附件" name="attachment">
  118. <logistics-attachment-tab ref="attachmentTab" :detail-data="currentRow" :table-height="detailHeight" />
  119. </el-tab-pane>
  120. </el-tabs>
  121. </div>
  122. </template>
  123. <script>
  124. import LogisticsAttachmentTab from './com_logisticsAttachmentTab.vue'
  125. import { searchLogistics, getPoList } from '@/api/npcIqc/npcIqc.js'
  126. export default {
  127. components: {
  128. LogisticsAttachmentTab
  129. },
  130. data () {
  131. return {
  132. height: 400,
  133. detailHeight: 400,
  134. currentRow: {},
  135. activeTab: 'poList',
  136. searchData: {
  137. flexId: '',
  138. supplierNo: '',
  139. supplierName: '',
  140. site: this.$store.state.user.site,
  141. page: 1,
  142. limit: 50
  143. },
  144. pageIndex: 1,
  145. pageSize: 50,
  146. totalPage: 0,
  147. mainDataList: [],
  148. poListData: [],
  149. dataListLoading: false,
  150. poListLoading: false
  151. }
  152. },
  153. mounted () {
  154. this.$nextTick(() => {
  155. this.height = (window.innerHeight - 220) / 2
  156. this.detailHeight = (window.innerHeight - 220) / 2
  157. this.getMainData()
  158. })
  159. },
  160. methods: {
  161. // 查询数据
  162. getMainData () {
  163. this.searchData.limit = this.pageSize
  164. this.searchData.page = this.pageIndex
  165. this.dataListLoading = true
  166. searchLogistics(this.searchData).then(({ data }) => {
  167. if (data.code === 0) {
  168. this.mainDataList = data.page.list
  169. this.pageIndex = data.page.currPage
  170. this.pageSize = data.page.pageSize
  171. this.totalPage = data.page.totalCount
  172. this.$nextTick(() => {
  173. if (this.$refs.mainTable) {
  174. this.$refs.mainTable.clearSelection()
  175. }
  176. })
  177. // 判断是否有数据
  178. if (this.mainDataList.length > 0) {
  179. this.$refs.mainTable.setCurrentRow(this.mainDataList[0])
  180. this.changeData(this.mainDataList[0])
  181. } else {
  182. this.changeData(null)
  183. }
  184. }
  185. this.dataListLoading = false
  186. }).catch(() => {
  187. this.dataListLoading = false
  188. })
  189. },
  190. // 每页数
  191. sizeChangeHandle (val) {
  192. this.pageSize = val
  193. this.pageIndex = 1
  194. this.getMainData()
  195. },
  196. // 当前页
  197. currentChangeHandle (val) {
  198. this.pageIndex = val
  199. this.getMainData()
  200. },
  201. // 页签点击事件
  202. handleTabClick (tab) {
  203. if (tab.name === 'poList') {
  204. this.loadPoList()
  205. } else if (tab.name === 'attachment') {
  206. this.$nextTick(() => {
  207. if (this.$refs.attachmentTab) {
  208. this.$refs.attachmentTab.searchTable()
  209. }
  210. })
  211. }
  212. },
  213. // 行点击事件
  214. changeData (row) {
  215. this.currentRow = row ? JSON.parse(JSON.stringify(row)) : {}
  216. this.loadPoList()
  217. },
  218. // 加载PO清单
  219. loadPoList () {
  220. if (!this.currentRow.flexId) {
  221. this.poListData = []
  222. return
  223. }
  224. this.poListLoading = true
  225. const params = {
  226. flexId: this.currentRow.flexId,
  227. supplierNo: this.currentRow.supplierNo || '',
  228. site: this.$store.state.user.site,
  229. page: 1,
  230. limit: 1000
  231. }
  232. getPoList(params).then(({ data }) => {
  233. if (data.code === 0 && data.page) {
  234. this.poListData = data.page.list || []
  235. } else {
  236. this.poListData = []
  237. }
  238. this.poListLoading = false
  239. }).catch(() => {
  240. this.poListData = []
  241. this.poListLoading = false
  242. })
  243. },
  244. // 格式化日期为 yyyy-MM-dd
  245. formatDate (date) {
  246. if (!date) return ''
  247. // 如果已经是 yyyy-MM-dd 格式,直接返回
  248. if (typeof date === 'string' && date.length === 10) {
  249. return date
  250. }
  251. // 如果是时间戳或其他格式,进行转换
  252. const d = new Date(date)
  253. if (isNaN(d.getTime())) return date
  254. const year = d.getFullYear()
  255. const month = String(d.getMonth() + 1).padStart(2, '0')
  256. const day = String(d.getDate()).padStart(2, '0')
  257. return `${year}-${month}-${day}`
  258. }
  259. },
  260. created () {
  261. this.getMainData()
  262. }
  263. }
  264. </script>
  265. <style scoped lang="scss">
  266. .customer-css {
  267. padding: 0;
  268. margin: 0;
  269. background: #fff;
  270. }
  271. .search-form-inline {
  272. background: #fff;
  273. }
  274. .search-row {
  275. display: flex;
  276. align-items: flex-end;
  277. flex-wrap: nowrap;
  278. gap: 15px;
  279. }
  280. .search-item {
  281. flex: none;
  282. margin-bottom: 10px;
  283. }
  284. .search-btn-item {
  285. flex: none;
  286. margin-bottom: 10px;
  287. }
  288. .search-btn-item /deep/ .el-form-item__content {
  289. line-height: normal;
  290. }
  291. .search-item /deep/ .el-form-item__label {
  292. font-size: 13px;
  293. color: #606266;
  294. padding-bottom: 5px;
  295. line-height: 1;
  296. height: auto;
  297. }
  298. .search-item /deep/ .el-form-item__content {
  299. line-height: normal;
  300. }
  301. /deep/ .customer-tab .el-tabs__content {
  302. padding: 5px !important;
  303. }
  304. </style>