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.

330 lines
8.6 KiB

2 weeks ago
  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. prop="flexId"
  31. label="进仓编号"
  32. min-width="150"
  33. show-overflow-tooltip />
  34. <el-table-column
  35. prop="supplierNo"
  36. label="供应商编码"
  37. width="120"
  38. align="center" />
  39. <el-table-column
  40. prop="supplierName"
  41. label="供应商名称"
  42. min-width="200"
  43. show-overflow-tooltip />
  44. <el-table-column
  45. prop="poCount"
  46. label="PO数量"
  47. width="100"
  48. align="center" />
  49. <el-table-column
  50. prop="shippedQty"
  51. label="已出货数量"
  52. width="120"
  53. align="center" />
  54. </el-table>
  55. <!-- 分页插件 -->
  56. <el-pagination style="margin-top: 0px"
  57. @size-change="sizeChangeHandle"
  58. @current-change="currentChangeHandle"
  59. :current-page="pageIndex"
  60. :page-sizes="[20, 50, 100, 200, 500]"
  61. :page-size="pageSize"
  62. :total="totalPage"
  63. layout="total, sizes, prev, pager, next, jumper">
  64. </el-pagination>
  65. <!-- 详情页签 -->
  66. <el-tabs v-model="activeTab" style="margin-top: 0px; width: 99%;" @tab-click="handleTabClick" class="customer-tab" type="border-card">
  67. <!-- PO清单 -->
  68. <el-tab-pane label="PO清单" name="poList">
  69. <el-table
  70. :data="poListData"
  71. border
  72. :height="detailHeight"
  73. v-loading="poListLoading"
  74. style="width: 100%;">
  75. <!-- <el-table-column-->
  76. <!-- type="index"-->
  77. <!-- label="序号"-->
  78. <!-- width="80"-->
  79. <!-- align="center" />-->
  80. <el-table-column
  81. prop="orderRef1"
  82. label="PO"
  83. min-width="150"
  84. show-overflow-tooltip />
  85. <el-table-column
  86. prop="orderDate"
  87. label="PO日期"
  88. width="120"
  89. align="center">
  90. <template slot-scope="scope">
  91. {{ formatDate(scope.row.orderDate) }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. prop="sku"
  96. label="SKU"
  97. min-width="150"
  98. show-overflow-tooltip />
  99. <el-table-column
  100. prop="qty"
  101. label="Qty"
  102. width="100"
  103. align="center" />
  104. <el-table-column
  105. prop="shippedQty"
  106. label="Qty Shipped"
  107. width="120"
  108. align="center" />
  109. </el-table>
  110. </el-tab-pane>
  111. <!-- 附件 -->
  112. <el-tab-pane label="附件" name="attachment">
  113. <logistics-attachment-tab ref="attachmentTab" :detail-data="currentRow" :table-height="detailHeight" />
  114. </el-tab-pane>
  115. </el-tabs>
  116. </div>
  117. </template>
  118. <script>
  119. import LogisticsAttachmentTab from './com_logisticsAttachmentTab.vue'
  120. import { searchLogistics, getPoList } from '@/api/npcIqc/npcIqc.js'
  121. export default {
  122. components: {
  123. LogisticsAttachmentTab
  124. },
  125. data () {
  126. return {
  127. height: 400,
  128. detailHeight: 400,
  129. currentRow: {},
  130. activeTab: 'poList',
  131. searchData: {
  132. flexId: '',
  133. supplierNo: '',
  134. supplierName: '',
  135. site: this.$store.state.user.site,
  136. page: 1,
  137. limit: 50
  138. },
  139. pageIndex: 1,
  140. pageSize: 50,
  141. totalPage: 0,
  142. mainDataList: [],
  143. poListData: [],
  144. dataListLoading: false,
  145. poListLoading: false
  146. }
  147. },
  148. mounted () {
  149. this.$nextTick(() => {
  150. this.height = (window.innerHeight - 220) / 2
  151. this.detailHeight = (window.innerHeight - 220) / 2
  152. this.getMainData()
  153. })
  154. },
  155. methods: {
  156. // 设置高度(供父组件调用)
  157. setHeight(height) {
  158. this.height = height * 0.5
  159. this.detailHeight = height * 0.5
  160. },
  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. padding: 0;
  274. margin-bottom: 0;
  275. }
  276. .search-row {
  277. display: flex;
  278. align-items: flex-end;
  279. flex-wrap: wrap;
  280. gap: 0;
  281. margin-bottom: 0;
  282. }
  283. .search-item {
  284. flex: none;
  285. margin-bottom: 0;
  286. margin-right: 12px;
  287. }
  288. /* 统一标签样式:使用 Element UI 默认字体大小(14px),移除自定义颜色 */
  289. .search-item /deep/ .el-form-item__label {
  290. padding-bottom: 5px;
  291. line-height: 1;
  292. height: auto;
  293. }
  294. .search-btn-item {
  295. flex: none;
  296. margin-bottom: 0;
  297. margin-right: 0;
  298. }
  299. .search-item /deep/ .el-form-item__content {
  300. line-height: normal;
  301. }
  302. /deep/ .customer-tab .el-tabs__content {
  303. padding: 5px !important;
  304. }
  305. </style>