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.

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