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.

634 lines
20 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.supplierNo" style="width: 120px" @keyup.enter.native="getMainData"/>
  8. </el-form-item>
  9. <el-form-item label="供应商名称" class="search-item">
  10. <el-input v-model="searchData.supplierName" style="width: 200px" @keyup.enter.native="getMainData"/>
  11. </el-form-item>
  12. <el-form-item label="申请日期" class="search-item">
  13. <div class="date-range">
  14. <el-date-picker v-model="searchData.requestDateStart" type="date" value-format="yyyy-MM-dd" placeholder="开始" style="width: 100px"/>
  15. <span class="split">-</span>
  16. <el-date-picker v-model="searchData.requestDateEnd" type="date" value-format="yyyy-MM-dd" placeholder="结束" style="width: 100px"/>
  17. </div>
  18. </el-form-item>
  19. <el-form-item label="状态" class="search-item">
  20. <el-select v-model="searchData.status" disabled style="width: 100%">
  21. <el-option label="已排程" value="Scheduled" />
  22. </el-select>
  23. </el-form-item>
  24. </div>
  25. <div class="search-row">
  26. <el-form-item label="申请人员" class="search-item">
  27. <el-input v-model="searchData.createBy" style="width: 120px" @keyup.enter.native="getMainData"/>
  28. </el-form-item>
  29. <el-form-item label="申请单号" class="search-item">
  30. <el-input v-model="searchData.requestNo" style="width: 120px" @keyup.enter.native="getMainData"/>
  31. </el-form-item>
  32. <el-form-item label="建议验货日期" class="search-item">
  33. <div class="date-range">
  34. <el-date-picker v-model="searchData.needInspectDateStart" type="date" value-format="yyyy-MM-dd" placeholder="开始" style="width: 100px"/>
  35. <span class="split">-</span>
  36. <el-date-picker v-model="searchData.needInspectDateEnd" type="date" value-format="yyyy-MM-dd" placeholder="结束" style="width: 100px"/>
  37. </div>
  38. </el-form-item>
  39. <el-form-item label="计划验货日期" class="search-item">
  40. <div class="date-range">
  41. <el-date-picker v-model="searchData.planStartDate" type="date" value-format="yyyy-MM-dd" placeholder="开始" style="width: 100px"/>
  42. <span class="split">-</span>
  43. <el-date-picker v-model="searchData.planEndDate" type="date" value-format="yyyy-MM-dd" placeholder="结束" style="width: 100px"/>
  44. </div>
  45. </el-form-item>
  46. <el-form-item label=" " class="search-item search-btn-item">
  47. <el-button type="primary" @click="getMainData" style="">查询</el-button>
  48. </el-form-item>
  49. </div>
  50. </el-form>
  51. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  52. <el-table
  53. :height="height"
  54. :data="mainDataList"
  55. border
  56. ref="mainTable"
  57. highlight-current-row
  58. @row-click="changeData"
  59. v-loading="dataListLoading"
  60. style="margin-top: 0px; width: 100%;">
  61. <el-table-column
  62. v-for="(item,index) in columnArray1" :key="index"
  63. :sortable="item.columnSortable"
  64. :prop="item.columnProp"
  65. :header-align="item.headerAlign"
  66. :show-overflow-tooltip="item.showOverflowTooltip"
  67. :align="item.align"
  68. :fixed="item.fixed==''?false:item.fixed"
  69. :min-width="item.columnWidth"
  70. :label="item.columnLabel">
  71. <template slot-scope="scope">
  72. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  73. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  74. style="width: 100px; height: 100px"/></span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作">
  78. <template slot-scope="scope">
  79. <el-link style="cursor: pointer; color: #409EFF;" @click="viewDetail(scope.row)">查看</el-link>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <!-- 分页插件 -->
  84. <el-pagination style="margin-top: 0px"
  85. @size-change="sizeChangeHandle"
  86. @current-change="currentChangeHandle"
  87. :current-page="pageIndex"
  88. :page-sizes="[20, 50, 100, 200, 500]"
  89. :page-size="pageSize"
  90. :total="totalPage"
  91. layout="total, sizes, prev, pager, next, jumper">
  92. </el-pagination>
  93. <!-- 详情页签 -->
  94. <el-tabs v-model="activeTab" style="margin-top: 0px; width: 99%;" @tab-click="handleTabClick" class="customer-tab" type="border-card">
  95. <!-- 基本信息 -->
  96. <el-tab-pane label="基本信息" name="base">
  97. <inspection-request-detail :detail-data="currentRow" />
  98. </el-tab-pane>
  99. <!-- 验货明细 -->
  100. <el-tab-pane label="验货明细" name="detail">
  101. <inspection-request-detail-tab ref="inspectionDetailTab" :detail-data="currentRow" :table-height="detailHeight" />
  102. </el-tab-pane>
  103. <!-- 验货关联PO明细 -->
  104. <el-tab-pane label="验货关联PO明细" name="poDetail">
  105. <inspection-request-po-detail-tab ref="poDetailTab" :detail-data="currentRow" :table-height="detailHeight" />
  106. </el-tab-pane>
  107. <!-- 验货结果 -->
  108. <el-tab-pane label="验货结果" name="result">
  109. <inspection-result-tab ref="resultTab" :detail-data="currentRow" :table-height="detailHeight" />
  110. </el-tab-pane>
  111. <!-- 附件管理 -->
  112. <el-tab-pane label="附件管理" name="attachment">
  113. <inspection-request-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 { searchInspectionRequestHeaderList } from '@/api/inspection/inspectionRequestHeader.js'
  120. import Chooselist from '@/views/modules/common/Chooselist_eam'
  121. import ComInspectionRequestDetail from './com_inspectionRequestDetail.vue'
  122. import ComInspectionRequestDetailTab from './com_inspectionRequestDetailTab.vue'
  123. import ComInspectionRequestPoDetailTab from './com_inspectionRequestPoDetailTab.vue'
  124. import ComInspectionResultTab from './com_inspectionResultTab.vue'
  125. import ComInspectionRequestAttachmentTab from './com_inspectionRequestAttachmentTab.vue'
  126. export default {
  127. components: {
  128. Chooselist,
  129. InspectionRequestDetail: ComInspectionRequestDetail,
  130. InspectionRequestDetailTab: ComInspectionRequestDetailTab,
  131. InspectionRequestPoDetailTab: ComInspectionRequestPoDetailTab,
  132. InspectionResultTab: ComInspectionResultTab,
  133. InspectionRequestAttachmentTab: ComInspectionRequestAttachmentTab
  134. },
  135. data () {
  136. return {
  137. functionId: this.$route.meta.menuId,
  138. height: 400,
  139. detailHeight: 400,
  140. currentRow: {},
  141. tagNo: '',
  142. searchType: '',
  143. activeTab: 'base',
  144. searchData: {
  145. requestNo: '',
  146. supplierNo: '',
  147. supplierName: '',
  148. status: 'Scheduled', // 固定状态为已排程
  149. qcOperator: this.$store.state.user.name, // 固定为当前登录用户
  150. createBy: '',
  151. requestDateStart: '',
  152. requestDateEnd: '',
  153. needInspectDateStart: '',
  154. needInspectDateEnd: '',
  155. planStartDate: '',
  156. planEndDate: '',
  157. page: 1,
  158. limit: 50
  159. },
  160. pageIndex: 1,
  161. pageSize: 50,
  162. totalPage: 0,
  163. mainDataList: [],
  164. dataListLoading: false,
  165. columnArray1: [
  166. {
  167. userId: this.$store.state.user.name,
  168. functionId: this.functionId,
  169. serialNumber: 'PendingTable1RequestNo',
  170. tableId: 'PendingTable1',
  171. tableName: '待验货申请单',
  172. columnProp: 'requestNo',
  173. headerAlign: 'center',
  174. align: 'left',
  175. columnLabel: '申请单号',
  176. columnWidth: '120',
  177. columnHidden: false,
  178. columnImage: false,
  179. columnSortable: false,
  180. sortLv: 0,
  181. status: true,
  182. fixed: false
  183. },
  184. {
  185. userId: this.$store.state.user.name,
  186. functionId: this.functionId,
  187. serialNumber: 'PendingTable1RequestDate',
  188. tableId: 'PendingTable1',
  189. tableName: '待验货申请单',
  190. columnProp: 'requestDate',
  191. headerAlign: 'center',
  192. align: 'center',
  193. columnLabel: '申请日期',
  194. columnWidth: '120',
  195. columnHidden: false,
  196. columnImage: false,
  197. columnSortable: false,
  198. sortLv: 0,
  199. status: true,
  200. fixed: false
  201. },
  202. {
  203. userId: this.$store.state.user.name,
  204. functionId: this.functionId,
  205. serialNumber: 'PendingTable1SupplierNo',
  206. tableId: 'PendingTable1',
  207. tableName: '待验货申请单',
  208. columnProp: 'supplierNo',
  209. headerAlign: 'center',
  210. align: 'left',
  211. columnLabel: '供应商编码',
  212. columnWidth: '120',
  213. columnHidden: false,
  214. columnImage: false,
  215. columnSortable: false,
  216. sortLv: 0,
  217. status: true,
  218. fixed: false
  219. },
  220. {
  221. userId: this.$store.state.user.name,
  222. functionId: this.functionId,
  223. serialNumber: 'PendingTable1SupplierName',
  224. tableId: 'PendingTable1',
  225. tableName: '待验货申请单',
  226. columnProp: 'supplierName',
  227. headerAlign: 'center',
  228. align: 'left',
  229. columnLabel: '供应商名称',
  230. columnWidth: '150',
  231. columnHidden: false,
  232. columnImage: false,
  233. columnSortable: false,
  234. sortLv: 0,
  235. status: true,
  236. fixed: false
  237. },
  238. {
  239. userId: this.$store.state.user.name,
  240. functionId: this.functionId,
  241. serialNumber: 'PendingTable1CreateBy',
  242. tableId: 'PendingTable1',
  243. tableName: '待验货申请单',
  244. columnProp: 'createBy',
  245. headerAlign: 'center',
  246. align: 'left',
  247. columnLabel: '申请人员',
  248. columnWidth: '100',
  249. columnHidden: false,
  250. columnImage: false,
  251. columnSortable: false,
  252. sortLv: 0,
  253. status: true,
  254. fixed: false
  255. },
  256. {
  257. userId: this.$store.state.user.name,
  258. functionId: this.functionId,
  259. serialNumber: 'PendingTable1NeedInspectDate',
  260. tableId: 'PendingTable1',
  261. tableName: '待验货申请单',
  262. columnProp: 'needInspectDate',
  263. headerAlign: 'center',
  264. align: 'center',
  265. columnLabel: '建议验货日期',
  266. columnWidth: '120',
  267. columnHidden: false,
  268. columnImage: false,
  269. columnSortable: false,
  270. sortLv: 0,
  271. status: true,
  272. fixed: false
  273. },
  274. {
  275. userId: this.$store.state.user.name,
  276. functionId: this.functionId,
  277. serialNumber: 'PendingTable1InspectAddress',
  278. tableId: 'PendingTable1',
  279. tableName: '待验货申请单',
  280. columnProp: 'inspectAddress',
  281. headerAlign: 'center',
  282. align: 'left',
  283. columnLabel: '验货地址',
  284. columnWidth: '200',
  285. columnHidden: false,
  286. columnImage: false,
  287. columnSortable: false,
  288. sortLv: 0,
  289. status: true,
  290. fixed: false
  291. },
  292. {
  293. userId: this.$store.state.user.name,
  294. functionId: this.functionId,
  295. serialNumber: 'PendingTable1Contact',
  296. tableId: 'PendingTable1',
  297. tableName: '待验货申请单',
  298. columnProp: 'inspectContract',
  299. headerAlign: 'center',
  300. align: 'left',
  301. columnLabel: '联系人',
  302. columnWidth: '150',
  303. columnHidden: false,
  304. columnImage: false,
  305. columnSortable: false,
  306. sortLv: 0,
  307. status: true,
  308. fixed: false
  309. },
  310. {
  311. userId: this.$store.state.user.name,
  312. functionId: this.functionId,
  313. serialNumber: 'PendingTable1Remark',
  314. tableId: 'PendingTable1',
  315. tableName: '待验货申请单',
  316. columnProp: 'remark',
  317. headerAlign: 'center',
  318. align: 'left',
  319. columnLabel: '备注',
  320. columnWidth: '150',
  321. columnHidden: false,
  322. columnImage: false,
  323. columnSortable: false,
  324. sortLv: 0,
  325. status: true,
  326. fixed: false
  327. },
  328. {
  329. userId: this.$store.state.user.name,
  330. functionId: this.functionId,
  331. serialNumber: 'PendingTable1Status',
  332. tableId: 'PendingTable1',
  333. tableName: '待验货申请单',
  334. columnProp: 'status',
  335. headerAlign: 'center',
  336. align: 'center',
  337. columnLabel: '状态',
  338. columnWidth: '100',
  339. columnHidden: false,
  340. columnImage: false,
  341. columnSortable: false,
  342. sortLv: 0,
  343. status: true,
  344. fixed: false
  345. },
  346. {
  347. userId: this.$store.state.user.name,
  348. functionId: this.functionId,
  349. serialNumber: 'PendingTable1PlanStartDate',
  350. tableId: 'PendingTable1',
  351. tableName: '待验货申请单',
  352. columnProp: 'planStartDate',
  353. headerAlign: 'center',
  354. align: 'center',
  355. columnLabel: '计划验货日期',
  356. columnWidth: '120',
  357. columnHidden: false,
  358. columnImage: false,
  359. columnSortable: false,
  360. sortLv: 0,
  361. status: true,
  362. fixed: false
  363. },
  364. {
  365. userId: this.$store.state.user.name,
  366. functionId: this.functionId,
  367. serialNumber: 'PendingTable1QcOperator',
  368. tableId: 'PendingTable1',
  369. tableName: '待验货申请单',
  370. columnProp: 'qcOperator',
  371. headerAlign: 'center',
  372. align: 'left',
  373. columnLabel: 'QC人员',
  374. columnWidth: '100',
  375. columnHidden: false,
  376. columnImage: false,
  377. columnSortable: false,
  378. sortLv: 0,
  379. status: true,
  380. fixed: false
  381. }
  382. ]
  383. }
  384. },
  385. watch: {
  386. // 监听路由参数变化(用于从我的代办页面跳转时)
  387. '$route.query': {
  388. handler (newQuery, oldQuery) {
  389. // 只有当路由参数发生变化时才重新查询(避免初始化时重复查询)
  390. const hasChanges = newQuery.planStartDate !== (oldQuery && oldQuery.planStartDate) ||
  391. newQuery.planEndDate !== (oldQuery && oldQuery.planEndDate) ||
  392. newQuery.requestNo !== (oldQuery && oldQuery.requestNo) ||
  393. newQuery.supplierName !== (oldQuery && oldQuery.supplierName)
  394. if (hasChanges && (newQuery.planStartDate || newQuery.requestNo || newQuery.supplierName)) {
  395. // 设置日期筛选条件
  396. if (newQuery.planStartDate && newQuery.planEndDate) {
  397. this.searchData.planStartDate = newQuery.planStartDate
  398. this.searchData.planEndDate = newQuery.planEndDate
  399. }
  400. // 设置申请单号筛选条件
  401. if (newQuery.requestNo) {
  402. this.searchData.requestNo = newQuery.requestNo
  403. }
  404. // 设置供应商名称筛选条件
  405. if (newQuery.supplierName) {
  406. this.searchData.supplierName = newQuery.supplierName
  407. }
  408. this.getMainData()
  409. }
  410. },
  411. immediate: false
  412. }
  413. },
  414. mounted () {
  415. this.$nextTick(() => {
  416. this.height = (window.innerHeight - 220) / 2
  417. this.detailHeight = (window.innerHeight - 220) / 2
  418. // 从路由参数获取筛选条件
  419. const query = this.$route.query
  420. // 设置日期筛选条件
  421. if (query.planStartDate && query.planEndDate) {
  422. this.searchData.planStartDate = query.planStartDate
  423. this.searchData.planEndDate = query.planEndDate
  424. }
  425. // 设置申请单号筛选条件
  426. if (query.requestNo) {
  427. this.searchData.requestNo = query.requestNo
  428. }
  429. // 设置供应商名称筛选条件
  430. if (query.supplierName) {
  431. this.searchData.supplierName = query.supplierName
  432. }
  433. // 执行查询
  434. this.getMainData()
  435. })
  436. },
  437. methods: {
  438. // 获取基础数据列表
  439. getBaseList (val, type) {
  440. this.tagNo = val
  441. this.searchType = type || ''
  442. this.$nextTick(() => {
  443. let strVal = ''
  444. let conSql = ''
  445. if (val === 1100) {
  446. strVal = this.searchData.supplierNo || ''
  447. conSql = " and site = '" + this.$store.state.user.site + "'"
  448. }
  449. if (val === 2016) {
  450. strVal = type === 'createBy' ? (this.searchData.createBy || '') : ''
  451. }
  452. this.$refs.baseList.init(val, strVal, conSql)
  453. })
  454. },
  455. /* 列表方法的回调 */
  456. getBaseData (val) {
  457. if (this.tagNo === 1100) {
  458. this.searchData.supplierNo = val.supplier_no || ''
  459. this.searchData.supplierName = val.supplier_name || ''
  460. }
  461. if (this.tagNo === 2016) {
  462. if (this.searchType === 'createBy') {
  463. this.searchData.createBy = val.username || val.user_display || val.name
  464. }
  465. }
  466. },
  467. // 查询数据 - 🔑 核心方法:固定状态和QC人员
  468. getMainData () {
  469. this.searchData.limit = this.pageSize
  470. this.searchData.page = this.pageIndex
  471. // 🔑 固定状态为"已排程"
  472. this.searchData.status = 'Scheduled'
  473. // 🔑 固定QC人员为当前登录用户
  474. this.searchData.qcOperator = this.$store.state.user.name
  475. this.dataListLoading = true
  476. searchInspectionRequestHeaderList(this.searchData).then(({ data }) => {
  477. if (data.code === 0) {
  478. this.mainDataList = data.page.list
  479. this.pageIndex = data.page.currPage
  480. this.pageSize = data.page.pageSize
  481. this.totalPage = data.page.totalCount
  482. this.$nextTick(() => {
  483. if (this.$refs.mainTable) {
  484. this.$refs.mainTable.clearSelection()
  485. }
  486. })
  487. // 判断是否有数据
  488. if (this.mainDataList.length > 0) {
  489. this.$refs.mainTable.setCurrentRow(this.mainDataList[0])
  490. this.changeData(this.mainDataList[0])
  491. } else {
  492. this.changeData(null)
  493. }
  494. }
  495. this.dataListLoading = false
  496. }).catch(() => {
  497. this.dataListLoading = false
  498. })
  499. },
  500. // 每页数
  501. sizeChangeHandle (val) {
  502. this.pageSize = val
  503. this.pageIndex = 1
  504. this.getMainData()
  505. },
  506. // 当前页
  507. currentChangeHandle (val) {
  508. this.pageIndex = val
  509. this.getMainData()
  510. },
  511. // 页签点击事件
  512. handleTabClick (tab) {
  513. if (tab.name === 'detail') {
  514. this.$nextTick(() => {
  515. if (this.$refs.inspectionDetailTab) {
  516. this.$refs.inspectionDetailTab.loadDetailList()
  517. }
  518. })
  519. } else if (tab.name === 'poDetail') {
  520. this.$nextTick(() => {
  521. if (this.$refs.poDetailTab) {
  522. this.$refs.poDetailTab.loadDetailList()
  523. }
  524. })
  525. } else if (tab.name === 'result') {
  526. this.$nextTick(() => {
  527. if (this.$refs.resultTab) {
  528. this.$refs.resultTab.loadDetailList()
  529. }
  530. })
  531. } else if (tab.name === 'attachment') {
  532. this.$nextTick(() => {
  533. if (this.$refs.attachmentTab) {
  534. this.$refs.attachmentTab.loadAttachmentTypeList()
  535. }
  536. })
  537. }
  538. },
  539. // 行点击事件
  540. changeData (row) {
  541. this.currentRow = row ? JSON.parse(JSON.stringify(row)) : {}
  542. },
  543. // 查看详情
  544. viewDetail (row) {
  545. this.changeData(row)
  546. // 可以跳转到详情页面或展开详情
  547. }
  548. },
  549. created () {
  550. // 不在 created 中自动查询,等待 mounted 处理
  551. }
  552. }
  553. </script>
  554. <style scoped lang="scss">
  555. .search-form-inline {
  556. background: #fff;
  557. }
  558. .search-row {
  559. display: flex;
  560. align-items: flex-end;
  561. flex-wrap: nowrap;
  562. gap: 15px;
  563. }
  564. .search-item {
  565. flex: none;
  566. margin-bottom: 10px;
  567. }
  568. .search-btn-item {
  569. flex: none;
  570. margin-bottom: 10px;
  571. }
  572. .search-btn-item /deep/ .el-form-item__content {
  573. line-height: normal;
  574. }
  575. .search-item /deep/ .el-form-item__label {
  576. font-size: 13px;
  577. color: #606266;
  578. padding-bottom: 5px;
  579. line-height: 1;
  580. height: auto;
  581. }
  582. .search-item /deep/ .el-form-item__content {
  583. line-height: normal;
  584. }
  585. .date-range {
  586. display: flex;
  587. align-items: center;
  588. }
  589. .split {
  590. padding: 0 6px;
  591. color: #606266;
  592. font-size: 13px;
  593. }
  594. /deep/ .customer-tab .el-tabs__content {
  595. padding: 5px !important;
  596. }
  597. </style>